Purchase Review

[php]

$vdv_version=(isset($_POST[‘vdv_version’])) ? $_POST[‘vdv_version’] : 0;
$additional_sites=(isset($_POST[‘additional_sites’])) ? $_POST[‘additional_sites’] : -1;
$vdv_service=(isset($_POST[‘vdv_service’])) ? $_POST[‘vdv_service’] : 0;
$data_service_toolkit=(isset($_POST[‘data_service_toolkit’])) ? $_POST[‘data_service_toolkit’] : -1;
$alarm_toolkit=(isset($_POST[‘alarm_toolkit’])) ? $_POST[‘alarm_toolkit’] : -1;
$report_toolkit=(isset($_POST[‘report_toolkit’])) ? $_POST[‘report_toolkit’] : -1;
$validation_toolkit=(isset($_POST[‘validation_toolkit’])) ? $_POST[‘validation_toolkit’] : -1;
$displacement_graph_toolkit=(isset($_POST[‘displacement_graph_toolkit’])) ? $_POST[‘displacement_graph_toolkit’] : -1;
$wind_energy_toolkit=(isset($_POST[‘wind_energy_toolkit’])) ? $_POST[‘wind_energy_toolkit’] : -1;
$gmap_toolkit=(isset($_POST[‘gmap_toolkit’])) ? $_POST[‘gmap_toolkit’] : -1;
$vdv_file_converter=(isset($_POST[‘vdv_file_converter’])) ? $_POST[‘vdv_file_converter’] : -1;
$initial_configuration=(isset($_POST[‘initial_configuration’])) ? $_POST[‘initial_configuration’] : -1;
$cd_delivery=(isset($_POST[‘cd_delivery’])) ? $_POST[‘cd_delivery’] : -1;
$fedex_delivery=(isset($_POST[‘fedex_delivery’])) ? $_POST[‘fedex_delivery’] : -1;
$promotional_code=(isset($_POST[‘promotional_code’])) ? $_POST[‘promotional_code’] : -1;

//syntax for promo array: (active,discount_type($%),base_discount,standard_discount,pro_discount)
$promo_code_array = array (“VDV-APGEO89″ => array(1,”%”,20,33,33),”VDV-ADVM2″ => array(1,”%”,20,33,33),”VDV-BENCH9402″ => array(1,”%”,20,33,33),”VDV-BOLTEC” => array(1,”%”,20,33,33), “VDV-BDI9324″ => array(0,”%”,20,33,33), “VDV-ELA8290″ => array(1,”%”,20,33,33), “VDV-ELAN-FC1″ => array(1,”US$”,806,1786,4931), “VDV-CSICA36″ => array(1,”%”,33,33,33), “VDV-SVAL8932″ => array(0,”US$”,0,0,2253), “VDV-MAL843A” => array(0,”US$”,0,0,1098), “VDV-INM8212″ => array(1,”%”,20,33,33), “VDV-PIN9032″ => array(0,”US$”,0,0,-600), “VDV-ITAS843″ => array(1,”US$”,0,0,492), “VDV-HAY8939″ => array(0,”US$”,0,0,2020), “VDV-LOC4863″ => array(0,”US$”,0,0,1086), “VDV-AND4193″ => array(0,”US$”,0,947,0), “VDV-KUM8934″ => array(1,”US$”,161,0,0), “VDV-UW1684″ => array(1,”US$”,0,502,0), “VDV-DRI3840″ => array(1,”US$”,0,0,617), “VDV-IBAC358″ => array(1,”US$”,0,2005,0), “VDV-Erite0809″ => array(1,”%”,20,33,33), “VDV-STANDARD-UPGRADE” => array(1,”US$”,0,0,2070),”VDV-FOU8249″ => array(1,”US$”,0,0,948),”VDV-MBLE531″ => array(1,”US$”,0,230,0),”VDV-FOU291a” => array(1,”US$”,0,0,2148),”VDV-ALASKAEDU” => array(1,”%”,0,0,20),”VDV-FOU33iC” => array(1,”%”,20,33,33),”VDV-COMP2ij8″ => array(1,”%”,10,10,10),”VDV-TOM23sa” => array(1,”%”,50,50,50),
“VDV-GEOINSTR” => array(1,”US$”,0,0,-1500),
“VDV-GEOGRUP” => array(1,”%”,20,33,33),
“VDV-BOZTEK” => array(1,”%”,20,33,33),
“VDV-DRIEDU” => array(1,”%”,50,50,50),
“VDV-ASC” => array(1,”%”,20,33,33));

if($vdv_version==0 && $additional_sites==0 && ($vdv_service==0||$vdv_service==1) && $displacement_graph_toolkit==-1 && $wind_energy_toolkit==-1 && $gmap_toolkit==-1 && $vdv_file_converter == -1 && $data_service_toolkit == -1 && $initial_configuration == -1)
{
echo”Please Select a which VDV options you wish to purchase.”;
//exit();
}
else
{
if($vdv_version==1)
{
$version_str = “Base”;
$total_amount += 1430;
$vdv_version_amount = 1430;
}
else if($vdv_version==2)
{
$version_str = “Standard”;
$total_amount += 2400;
$vdv_version_amount = 2400;
}
else if($vdv_version==3)
{
$version_str = “Professional”;
$total_amount += 5500;
$vdv_version_amount = 5500;
}
else if($vdv_version==4)
{
$version_str = “Enterprise”;
$total_amount += 11300;
$vdv_version_amount = 11300;
}

if($additional_sites>0)
{
$total_amount += $additional_sites*300;
$additional_sites_amount += $additional_sites*300;
$number_of_sites = $additional_sites*10;
$vdv_additional_sites_str = $number_of_sites.” Sites”;
}

if($vdv_service==1)
{
$total_amount += 0;
$vdv_service_str = “Basic (0 US$)”;
$vdv_service_desc_str = “Basic”;
}
else if($vdv_service==2)
{
$total_amount += 1670;
$vdv_service_str = “Business (1670 US$)”;
$vdv_service_desc_str = “Business “;
}
else if($vdv_service==3)
{
$total_amount += 4500;
$vdv_service_str = “Premium (4500 US$)”;
$vdv_service_desc_str = “Premium “;
}
if($data_service_toolkit==1)
{
$total_amount += 250;
$toolkit_amount += 250;
$toolkit_str .= “Data Service Toolkit, “;
}
if($displacement_graph_toolkit==1)
{
$total_amount += 510;
}
if($wind_energy_toolkit==1)
{
$total_amount += 510;
}
if($gmap_toolkit==1)
{
$total_amount += 250;
}
if($vdv_file_converter==1)
{
$total_amount += 250;
}
if($initial_configuration==1)
{
$total_amount += 1500;
}
if($cd_delivery==1)
{$total_amount += 60;}
if($fedex_delivery==1)
{$total_amount += 200;}
$promo_pucrhase = 0;
//if($promotional_code == $promotional_code_key)
if (array_key_exists($promotional_code, $promo_code_array))
{
$promo_code_info = $promo_code_array[$promotional_code];
if($promo_code_info[0]==1)
{
$discount_type = $promo_code_info[1];
$promo_pucrhase = 1;
if($vdv_version == 3)
{$version_index = 4;}
else if($vdv_version == 2)
{$version_index = 3;}
else if($vdv_version == 0)
{$version_index = 3;}
else
{$version_index = 2;}
if($discount_type==”US$”)
{
$total_amount = floor($total_amount-$promo_code_info[$version_index]);
$discount_str = $promo_code_info[$version_index].$promo_code_info[1];
}
else
{
$total_amount = floor($total_amount*((100-$promo_code_info[$version_index])/100));
$discount_str = $promo_code_info[$version_index].$promo_code_info[1];
}
}
if($total_amount==666)
{$total_amount = 665;}
}
echo”[strong]Purchase Vista Data Vision – Review Order Selection[/strong][br]”;
if($vdv_version>0)
{
echo”Purchase Version: [strong]VDV $version_str ($vdv_version_amount US$)[/strong][br]”;
$description .= “Vista Data Vision “.$version_str.” Version + “;
}
if($additional_sites>0)
{
echo”VDV additional Sites ($vdv_additional_sites_str): [strong]($additional_sites_amount US$)[/strong][br]”;
$description .= “Additional Sites: $vdv_additional_sites_str: + “;
}
if($vdv_service>0)
{
echo”VDV Service Subscription Year fee: [strong]$vdv_service_str[/strong][br][br]”;
$description .= “VDV Service Subscription Year fee: $vdv_service_desc_str + “;
}
if($initial_configuration==1) {
$description .= “Initial Configuration + “;
echo”Initial Configuration: [strong](1500 US$)[/strong][br]”;
}
if($data_service_toolkit==1)
{
$description .= “Data Service Toolkit + “;
echo”Data Service Toolkit: [strong]($toolkit_amount US$)[/strong][br]”;
}
if($alarm_toolkit==1 || $report_toolkit==1 || $validation_toolkit==1)
{
$description .= “Toolkits: “.$toolkit_str.” + “;
echo”General Toolkits: [strong]$toolkit_str ($toolkit_amount US$)[/strong][br]”;
}
if($displacement_graph_toolkit==1)
{
echo”Displacement Graph Toolkit: [strong](510 US$)[/strong][br]”;
$description .= “Displacement Graph Toolkit + “;
}
if($wind_energy_toolkit==1)
{
echo”Wind Energy Toolkit: [strong](510 US$)[/strong][br]”;
$description .= “Wind Energy Toolkit “;
}
if($gmap_toolkit==1)
{
echo”Google Maps Toolkit: [strong](250 US$)[/strong][br]”;
$description .= “Google Maps Toolkit + “;
}
if($vdv_file_converter==1)
{
echo”
VDV File Converter: [strong](250 US$)[/strong][br]”;
$description .= “VDV File Converter + “;
}
if($cd_delivery==1)
{
$description .= “CD Delivery: Yes + “;
echo”
CD Delivery: [strong]Yes (60 US$)[/strong][br]”;
}
else
{$description .= “CD Delivery: No + “;}
if($fedex_delivery==1)
{
$description .= “Fedex Delivery: Yes + “;
echo”
Fedex Delivery: [strong]Yes (200 US$)[/strong][br]”;
}

if($promo_pucrhase == 1)
{
$description .= “Promotional Code: $promotional_code”;
echo”[br][br]
Promotional Code: [strong]$promotional_code[/strong][br]”;
//Promotional Code: [strong]$promotional_code ($discount_str Discount)[/strong]”;
}
echo”
[/p]
Total Price: [strong]$total_amount US$[/strong][br]
No VAT is added.
For sales in Iceland contact Vista Engineering [a href=\”mailto:vista@vista.is\”]vista@vista.is[/a].[br]”;
// Data received from Korta, you get them when you have applied with KORTA !
$merchant = ‘8180633’;
$terminal= ‘7293’;
$secretcode = ‘FfnKaKJfNbtGpsDoxRgjifz3YhBog89bJb5hByt7’;
// Information from your system ! Lines in description are separated by
$amount = $total_amount;
$cur = ‘USD’;
//$description = ‘Íslensk lýsing á þinni vöru’;
// Electronic signature used so that KORTA can confirm that the payment was received from you un-altered !
$checkvaluemd5 = md5(htmlentities($amount . $cur . $merchant . $terminal . $description . $secretcode)) ;
$your_downloadurl = ‘http://’.$_SERVER[‘HTTP_HOST’].’/purchase-complete/’;
echo “[input type=’button’ value=’Purchase’ onclick=’vdv_purchase_form.submit();’]”;
echo”[form name=’vdv_purchase_form’ action=’https://netgreidslur.korta.is/’ method=’post’]
[input type=’hidden’ name=’amount’ value=’$amount’ /]
[input type=’hidden’ name=’currency’ value=’$cur’ /]
[input type=’hidden’ name=’lang’ value=’en’ /]
[input type=’hidden’ name=’merchant’ value=’$merchant’ /]
[input type=’hidden’ name=’terminal’ value=’$terminal’ /]
[input name=’description’ type=’hidden’ value=’$description’ /]
[input type=’hidden’ name=’checkvaluemd5′ value=’$checkvaluemd5′ /]


[input type=’hidden’ name=’refermethod’ value=’POST’ /]
[input type=’hidden’ name=’refertarget’ value=’_top’ /]
[input type=’hidden’ name=’downloadurl’ value=’$your_downloadurl’ /]

[/form]”;
}
[/php]