#!/usr/bin/perl # Merchant OrderForm v1.53 - August 2000 # Cart Front End Collection and Preview # Copyright © August 2000, All Rights Reserved # Austin Contract Computing, Austin, Texas # Russell Alexander - rga@io.com # http://www.io.com/~rga/ # Written for Austin Contract Computing, Inc. All Rights Reserved 2000 # PLEASE NOTE_________________________________________________ # These programs are distributed as Trial Ware or Share Ware. # You are Welcome to install and test all portions of the programs. # The package is not limited in any way and code source is left readable. # Please make arrangements for the fee if you continue operating it on a Web Site # Feel free to contact me if you need special arrangements for use of MOF v1.53 # For personal web site use: $ 15.00 # For web development (3-10 sites): $ 45.00, includes limited support # For web development (above 10 sites): $ 150.00, includes limited support # Note: For Resale or hosting license please contact rga@io.com # For payment arrangements: http://www.merchantorderform.com/payment.html # IMPORTANT ____________________________________________ # Distribution of this file without owner consent is prohibited. # Please contact the authors of this product for any use outside # The original registration and user license # COPYRIGHT NOTICE____________________________________________ # The contents of this file is protected under the United States # copyright laws as an unpublished work, and is confidential and # proprietary to Austin Contract Computing, Inc. Its use or disclosure # in whole or in part without the expressed written permission of Austin # Contract Computing, Inc. is prohibited. # THIS IS THE FRONT END PROGRAM # THIS IS THE FRONT END PROGRAM # IMPORTANT: YOU SHOULD ONLY BE MODIFYING THE CONFIGURATION FILES # IMPORTANT: YOU SHOULD ONLY BE MODIFYING THE CONFIGURATION FILES # DO NOT CHANGE ANY OF THESE SETTINGS # =================================== require 5.001; require 'mof15.conf'; require 'mof15_lib.pl'; # cookie names must be the same in both program files # cookie names must be the same in both program files $cookiename_OrderID = 'mof_v15_OrderID'; $cookiename_InfoID = 'mof_v15_InfoID'; # START PROGRAM FLOW # START PROGRAM FLOW &SetDateVariable; # QUERY STRING INPUT # QUERY STRING INPUT if ($ENV{'QUERY_STRING'}) { &CheckAllowedDomains if (scalar(@ALLOWED_DOMAINS)); &ProcessQueryString; &CheckCookie; if ($view) { if ($cookieOrderID) { $frm{'previouspage'} = $qry{'previouspage'}; &ReadDataFile($cookieOrderID); $msg_function = "What's In Your Cart ?"; &AcceptOrder; } else { print "Location: $cookieredirect\n\n"; exit; } } else { if ($cookieOrderID) { &ReadDataFile($cookieOrderID); &ProcessDataFile; &WriteDataFile($cookieOrderID); $msg_function = "Adding $msg_i New Item" if ($msg_i == 1); $msg_function = "Adding $msg_i New Items" if ($msg_i != 1); if ($msg_d) { $msg_function = $msg_function . ", $msg_d Duplicate Item" if ($msg_d == 1); $msg_function = $msg_function . ", $msg_d Duplicate Items" if ($msg_d != 1); } &AcceptOrder; } else { &GenerateOrderID; &MakeCookie($cookiename_OrderID, $OrderID); @orders = @NewOrder; &WriteDataFile($OrderID); $msg_function = "Adding $msg_i New Item" if ($msg_i == 1); $msg_function = "Adding $msg_i New Items" if ($msg_i != 1); &AcceptOrder; } } # FORM POST INPUT # FORM POST INPUT } else { &CheckAllowedDomains if (scalar(@ALLOWED_DOMAINS)); &ProcessForm; # POSTMODE = SINGLEPOST-CHECKBOXES-QUANTITYBOXES # POSTMODE = SINGLEPOST-CHECKBOXES-QUANTITYBOXES if ($frm{'postmode'} eq "SINGLEPOST" || $frm{'postmode'} eq "CHECKBOXES" || $frm{'postmode'} eq "QUANTITYBOXES") { &CheckCookie; if ($cookieOrderID) { &ReadDataFile($cookieOrderID); &ProcessDataFile; &WriteDataFile($cookieOrderID); $msg_function = "Adding $msg_i New Item" if ($msg_i == 1); $msg_function = "Adding $msg_i New Items" if ($msg_i != 1); if ($msg_d) { $msg_function = $msg_function . ", $msg_d Duplicate Item" if ($msg_d == 1); $msg_function = $msg_function . ", $msg_d Duplicate Items" if ($msg_d != 1); } &AcceptOrder; } else { &GenerateOrderID; &MakeCookie($cookiename_OrderID, $OrderID); @orders = @NewOrder; &WriteDataFile($OrderID); $msg_function = "Adding $msg_i New Item" if ($msg_i == 1); $msg_function = "Adding $msg_i New Items" if ($msg_i != 1); &AcceptOrder; } # UPDATE CART # UPDATE CART } elsif ($frm{'postmode'} eq "UPDATE") { &CheckCookie; if ($cookieOrderID) { $OrderID = $frm{'OrderID'}; @orders = @NewOrder; &WriteDataFile($OrderID); $msg_function = "Updated $msg_i Cart Item" if ($msg_i == 1); $msg_function = "Updated $msg_i Cart Items" if ($msg_i != 1); &AcceptOrder; } else { print "Location: $cookieredirect\n\n"; exit; } # DELETE CART # DELETE CART } elsif ($frm{'postmode'} eq "DELETE") { $msg_i = $frm{'deleted_items'}; &CheckCookie; if ($cookieOrderID) { $OrderID = $frm{'OrderID'}; &WriteDataFile($OrderID); $msg_function = "Deleted $msg_i Cart Item" if ($msg_i == 1); $msg_function = "Deleted $msg_i Cart Items" if ($msg_i != 1); &AcceptOrder; } else { print "Location: $cookieredirect\n\n"; exit; } # PREVIEW INVOICE # PREVIEW INVOICE } elsif ($frm{'postmode'} eq "PREVIEW") { # setting up needed globals # setting up needed globals @UsingInfoFields = (); @MasterInfoList = (); %MissingInfoFields = (); %Computations = (); &CheckCookie; $OrderID = $frm{'OrderID'}; $InfoID = $cookieInfoID if ($cookieInfoID); $InfoID = $frm{'InfoID'} if $frm{'InfoID'}; @orders = @NewOrder; # Begin Preview Decision Flow # Begin Preview Decision Flow if (&CheckFieldsNeeded) { if ($cookieOrderID) { if ($frm{'submit_preview_info'} eq "NEWSUBMIT") { &ReadNewInfo; &WriteInfoFile($InfoID); $msg_function = "NEWSUBMIT"; } elsif ($frm{'submit_preview_info'} eq "EDITING") { &ReadInfoFile($InfoID); $msg_function = "EDITING"; } else { if ($cookieInfoID) { $InfoID = $cookieInfoID; &ReadInfoFile($InfoID); $msg_function = "FOUNDATA"; } else { &GenerateInfoID; &MakeNullList; $msg_function = "NEWLIST"; } } } else { print "Location: $cookieredirect\n\n"; exit; } } else { if ($cookieOrderID) { $msg_function = "Nothing Needed"; &MakeComputations; &PreviewOrder; exit; } else { print "Location: $cookieredirect\n\n"; exit; } } # End Preview Decision Flow # End Preview Decision Flow &MakeCookie($cookiename_InfoID, $InfoID); if (&CheckUsingInfoFields) { &PreviewInformation; } else { if ($frm{'submit_preview_info'} eq "EDITING") { &PreviewInformation; } else { &MakeComputations; &PreviewOrder; } } # CUSTOM MODE # CUSTOM MODE } elsif ($frm{'postmode'} eq "CUSTOM") { $ErrMsg="Designer has set a Custom Input Mode
"; $ErrMsg=$ErrMsg . "Designer has set a Custom Input Mode
"; $ErrMsg=$ErrMsg . "Designer has set a Custom Input Mode
"; $ErrMsg=$ErrMsg . "Designer has set a Custom Input Mode"; &ErrorMessage($ErrMsg); # MODE NOT FOUND # MODE NOT FOUND } else { $ErrMsg="Unable to determine Input Mode
"; $ErrMsg=$ErrMsg . "postmode: $frm{'postmode'}
"; $ErrMsg=$ErrMsg . "Contact the Web Developer
"; $ErrMsg=$ErrMsg . "Referring URL:
$ENV{'HTTP_REFERER'}"; &ErrorMessage($ErrMsg); } } # ACCEPT ORDER # ACCEPT ORDER sub AcceptOrder { @header = (); @footer = (); my ($i)=0; my (@list) = (); my ($nav_top, $nav_bottom) = (0,0); my ($li, $lk, $lv, $msg_status, $msg_n); my ($totalprice, $totalqnty, $temprice); my ($line, $qty, $item, $desc, $price, $ship, $taxit); if ($frm{'previouspage'}) { $previouspage = $frm{'previouspage'}; } else { $previouspage = $ENV{'HTTP_REFERER'}; } $msg_n = scalar(@orders); $msg_status = "Viewing $msg_n Items" if ($msg_n > 1); $msg_status = "Viewing $msg_n Item" if ($msg_n == 1); if ($msg_n == 0) {$msg_status = "Viewing No Items"} &GetTemplateFile($accept_order_template,"Main Template File"); print "Content-Type: text/html\n\n"; print "@header \n\n"; $OrderID = $cookieOrderID if ($cookieOrderID); $OrderID = $OrderID if ($OrderID); # START PRINTING FROM HEADER # START PRINTING FROM HEADER # Insert MOF navigation at TOP # Insert MOF navigation at TOP $nav_top++ if ($menu_previous_top); $nav_top++ if ($menu_help_top); if ($nav_top) { print " \n"; if ($menu_previous_top) { print " \n";} if ($menu_help_top) { print " \n";} print "
$menu_previous_top \n"; print " \n"; print "$menu_help_top

\n\n"; } # Update hidden POST AcceptOrder Quantities Form # Update hidden POST AcceptOrder Quantities Form print "
\n"; print "
\n"; print " \n"; print " \n"; print " \n\n"; print " \n"; print " \n"; print "
\n"; print "$action_message_s $msg_status
"; print "$msg_function $action_message_e
\n"; print "
\n"; print " \n"; print "\n"; print " \n"; print "
$datetime_s Order ID: $OrderID $datetime_e
$datetime_s $Date $ShortTime $datetime_e
\n"; print "
\n"; # printing orders in cart # printing orders in cart print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; # populate orders in table / store hidden input # populate orders in table / store hidden input foreach $line (@orders) { ($qty, $item, $desc, $price, $ship, $taxit) = split (/$delimit/, $line); ++$i; print " \n"; print " \n"; # Format User Input in Description # Format User Input in Description @list = split (/\|/, $desc); $desc = shift (@list); $desc =~ s/\[//g; $desc = $fontdesc_s . $desc . $fontdesc_e; foreach $li (@list) { ($lk, $lv) = split (/::/, $li); if ($makelist) { $desc = $desc . "$font_key_s
  • $lk: $font_key_e$font_val_s$lv$font_val_e"; } else { $desc = $desc . " - $font_key_s$lk: $font_key_e$font_val_s$lv$font_val_e"; } } print "
  • \n"; # Print row for single item or multiple to sub totals # Print row for single item or multiple to sub totals if ($qty > 1) { print "\n"; $sub_price = ($qty * $price); $totalprice += $sub_price; $totalqnty += $qty; $sub_price = sprintf "%.2f", $sub_price; $sub_price = CommifyMoney ($sub_price); $price = CommifyMoney ($price); $qty = CommifyNumbers ($qty); print "\n"; print "\n"; print "\n\n"; } else { $totalprice += $price; $totalqnty += $qty; $price = CommifyMoney ($price); print "\n\n"; } } print "
    $fontheading Qty$fontheading Item Name$fontheading Description$fontheading Price
    $fontqnty \n\n"; print " \n"; print " \n"; print " \n\n"; print "$fontitem $item $desc $fontprice \ \;
    \ \; $fontsubtext\n"; print "Sub Total $qty of $item at "; print "$currency $price each $fontsub $currency $sub_price
    $fontprice$currency $price
    \n"; print "$returntofont \n"; # Print Summary Totals # Print Summary Totals if ($totalqnty > 1) {$pd = "Products"} else {$pd = "Product"} $totalprice = sprintf "%.2f", $totalprice; $totalprice = CommifyMoney ($totalprice); $totalqnty = CommifyNumbers ($totalqnty); print " \n"; print " \n"; print "
    $totaltext Subtotal \n"; print "$totalqnty $pd ----> "; print "$totalcolor $currency $totalprice

    \n"; # Bottom Navigation Menu # Bottom Navigation Menu print " \n"; if ($menu_home_bottom) { print " \n";} if ($menu_previous_bottom) { print " \n";} # Update FORM ends here, Can only start another FORM POST now print " \n"; if ($menu_delete_bottom && $msg_n) { print " \n"; } if ($menu_preview_bottom && $msg_n) { print " \n"; } if ($menu_help_bottom) { print " \n";} print "
    $menu_home_bottom$menu_previous_bottom$menu_update_bottom"; print "
    \n"; print " \n"; print " \n"; print " \n"; print " \n"; print "$menu_delete_bottom
    "; print "
    \n"; print " \n"; print " \n"; print " \n\n"; foreach $line (@orders) {print " \n"} print "$menu_preview_bottom
    \n"; print " \n"; print "$menu_help_bottom
    "; if ($msg_n) { print "If you changed any quantities, please click "; print "update quantity ."; print "
    Click on Review Order button to check out and process your order. "; } else { print "You don't have any items in your cart
    "; print "You can return to your "; print "Previous Shopping Page
    "; print "Or you can return to our "; print "Site's Main Page
    "; } print "$returntofont\n"; print "@footer \n\n"; } # PREVIEW INFORMATION # PREVIEW INFORMATION sub PreviewInformation { my ($itm_n)=0; my ($key, $val); my (@InsuranceList) = (); my (@MethodList) = (); $msg_v; @country_list = (); @state_list = (); ($allow_shipping, $allow_tax) = (0,0); # count how many items failed validation $itm_m = scalar(keys(%MissingInfoFields)); # using shipping and/or tax flags $allow_shipping++ if (scalar(@use_shipping)); $allow_shipping++ if (scalar(keys(%use_method))); $allow_tax++ if (scalar(keys(%use_city_tax))); $allow_tax++ if (scalar(keys(%use_zipcode_tax))); $allow_tax++ if (scalar(keys(%use_state_tax))); $allow_tax++ if (scalar(keys(%use_country_tax))); @country_list = (&GetDropBoxList($use_country_list,'Ecom_ShipTo_Postal_CountryCode')) if ($use_country_list); @state_list = (&GetDropBoxList($use_state_list,'Ecom_ShipTo_Postal_StateProv')) if ($use_state_list); &GetTemplateFile($preview_info_template,"Preview Information File"); # you must call any sub routine that can ErrorMessage(ErrMsg) # BEFORE you set up the print Content-Type header # start HTML output # start HTML output print "Content-Type: text/html\n\n"; print "@header \n\n"; if ($itm_m == 1) {$fld = "Field is"} else {$fld = "Fields are"} if ($msg_function eq "FOUNDATA") { print "We found previous information for you. $itm_m $fld incomplete. "; print "Please complete all required information and continue by clicking the "; print "review order function below."; } elsif ($msg_function eq "EDITING") { print "You can Edit any of this information. When finished Editing, then "; print "click the review order function below to see your order summary. "; } elsif ($msg_function eq "NEWSUBMIT") { print "Some information for $itm_m $fld missing or incomplete. "; print "Please complete all required information and continue by clicking the "; print "review order function below."; } elsif ($msg_function eq "NEWLIST") { print "We are creating a new data file for you. $itm_m $fld required. "; print "Please complete all required information and continue by clicking the "; print "review order function below."; } print "

    \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n\n"; foreach $line (@orders) {print " \n"} print " \n\n"; # shipping info available # shipping info available if ($allow_shipping || $allow_tax) { $itm_n++; # Shipping or just tax Message ? # if not shipping then must be tax because of above branch if ($allow_shipping) { $box_heading = "What Is The Shipping Destination ?"; $box_message = "We need to know about the shipping destination in order to compute all "; $box_message = $box_message . "additional charges for shipping, handling, tax."; } else { $box_heading = "What Is The Tax Location ?"; $box_message = "We need to know what your taxing location is so that we can "; $box_message = $box_message . "assess any appropriate taxes."; } print " \n"; print " \n"; print " \n"; print " \n"; print "\n"; print "
    $itm_n.$preview_heading \n"; print "$box_heading "; print " EDITING " if ($msg_function eq "EDITING"); print "

    $preview_text \n"; print "$box_message

    \n"; # shipping-tax box input # shipping-tax box input print " \n"; print " \n"; print ""; print ""; print "

    \n\n"; print "
    \n"; print " \n"; if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_Name_Prefix'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_Name_Prefix')); print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_Name_First'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_Name_First')); print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_Name_Middle'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_Name_Middle')); print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_Name_Last'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_Name_Last')); print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_Name_Suffix'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_Name_Suffix')); print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_Company'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_Company')); print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_Street_Line1'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_Street_Line1')); print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_Street_Line2'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_Street_Line2')); print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_City'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_City')); print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_StateProv'})) { print " \n"; print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_PostalCode'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_PostalCode')); print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Postal_CountryCode'})) { print " \n"; print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Telecom_Phone_Number'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Telecom_Phone_Number')); print " \n"; } if (exists ($shipping_destination_fields{'Ecom_ShipTo_Online_Email'})) { print " \n"; print ""; $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Online_Email')); print " \n"; } print "
    $font_preview_titles Title: \n"; print "$msg_v
    $font_preview_titles First Name: \n"; print "$msg_v
    $font_preview_titles Middle Name: \n"; print "$msg_v
    $font_preview_titles Last Name: \n"; print "$msg_v
    $font_preview_titles Last Name Suffix: \n"; print "$msg_v
    $font_preview_titles Company Name: \n"; print "$msg_v
    $font_preview_titles Address: \n"; print "$msg_v
    $font_preview_titles Address: \n"; print "$msg_v
    $font_preview_titles City: \n"; print "$msg_v
    "; print "$font_preview_titles State - Province: \n"; # Does state field use Drop Box # Does state field use Drop Box if ($use_state_list) { print " \n"; } else { print " "; } $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_StateProv')); print "$msg_v
    $font_preview_titles Postal Code: \n"; print "$msg_v
    "; print "$font_preview_titles Country: \n"; # Does country field use Drop Box # Does country field use Drop Box if ($use_country_list) { print " \n"; } else { print " "; } $msg_v = (&ValidatePreviewFields('Ecom_ShipTo_Postal_CountryCode')); print "$msg_v
    $font_preview_titles Phone Number: \n"; print "$msg_v
    $font_preview_titles E-mail Address: \n"; print "$msg_v
    "; print "
    \n"; print "

    \n"; # shipping method # shipping method if (scalar(keys(%use_method))) { $itm_n++; print " \n"; print " \n"; print " \n"; print " \n"; print "\n"; print " \n"; print " \n"; print "\n"; print " \n"; print "
    $itm_n.$preview_heading \n"; print "Select The Shipping Method."; print " EDITING" if ($msg_function eq "EDITING"); print "

    $preview_text \n"; print "Please select the shipping method to be used in shipping your order to the "; print "above location.


    $preview_text \n"; # Build options # Build options @MethodList = (sort keys(%use_method)); if ($type_method_options =~ /\bdropbox\b/i) { print " \n"; } elsif ($type_method_options =~ /\bradio\b/i) { foreach $_ (@MethodList) { if ($NewInfo{'Compute_Shipping_Method'}) { if ($NewInfo{'Compute_Shipping_Method'} eq $_) { print " $use_method{$_}
    \n"; } else { print " $use_method{$_}
    \n"; } } else { if ($default_method eq $_) { print " $use_method{$_}
    \n"; } else { print " $use_method{$_}
    \n"; } } } } print "

    \n"; } # insurance options # insurance options if (scalar(keys(%use_insurance)) && $allow_shipping) { $itm_n++; print " \n"; print " \n"; print " \n"; print " \n"; print "\n"; print " \n"; print " \n"; print "\n"; print " \n"; print "
    $itm_n.$preview_heading \n"; print "Do You Want To Insure The Package ?"; print " EDITING" if ($msg_function eq "EDITING"); print "

    $preview_text \n"; print "Please select the amount of insurance you want.


    $preview_text \n"; # Build options # Build options @InsuranceList = (sort values(%use_insurance)); if ($type_insurance_options =~ /\bdropbox\b/i) { print " \n"; } elsif ($type_insurance_options =~ /\bradio\b/i) { foreach $_ (@InsuranceList) { while (($key, $val) = each (%use_insurance)) { if ($_ == $val) { if ($NewInfo{'Compute_Insurance'} == $val) { print " $key
    \n"; } else { print " $key
    \n"; } } } } } print "

    \n"; } # End use_insurance } # End overall usage of tax, address, method, insurance # discount coupons # discount coupons if (scalar(@use_coupons)) { $itm_n++; print " \n"; print " \n"; print " \n"; print " \n"; print "\n"; print " \n"; print " \n"; print "\n"; print " \n"; print "
    $itm_n.$preview_heading \n"; print "Do You Have Any Discount Coupons ?"; print " EDITING" if ($msg_function eq "EDITING"); print "

    $preview_text \n"; print "Please enter any discount coupon numbers or codes.
    "; print "Enter None or New Member if you don't have any.


    \n"; if ( $NewInfo{'Compute_Coupons'} ) { print " \n"; } else { print " \n"; } $msg_v = (&ValidatePreviewFields('Compute_Coupons')); print " $msg_v"; print "

    \n"; } # Submit Preview Information Menu # Submit Preview Information Menu print " \n"; if ($menu_home_bottom) { print " \n";} if ($menu_previous_bottom) { print " \n";} if ($menu_editcart_bottom) { print " \n"; } # Submit Preview FORM ends here print " \n"; if ($menu_help_bottom) { print " \n";} print "
    $menu_home_bottom$menu_previous_bottom"; print " "; print "$menu_editcart_bottom$menu_preview_bottom \n"; print " \n"; print "$menu_help_bottom
    "; # DEBUG PREVIEW INFO PAGE # DEBUG PREVIEW INFO PAGE # print "

    \%MissingInfoFields"; # while (($key, $val) = each (%MissingInfoFields)) { # print "
  • $key, $val \n"; # } # print "

    \%NewInfo Global Array "; # while (($key, $val) = each (%NewInfo)) { # print "
  • $key, $val \n"; # } # print "
    \@UsingInfoFields"; # foreach $_ (@UsingInfoFields) {print "
  • $_"} # print "

    \%shipping_destination_fields CONFIG"; # while (($key, $val) = each (%shipping_destination_fields)) { # print "
  • $key, $val \n"; # } # print "

    All Global Vars"; # print "
  • postmode = $frm{'postmode'}"; # print "
  • submit_preview_info = $frm{'submit_preview_info'}"; # print "
  • FRM-OrderID = $frm{'OrderID'}"; # print "
  • OrderID = $OrderID"; # print "
  • FRM-InfoID = $frm{'InfoID'}"; # print "
  • InfoID = $InfoID"; # print "
  • previouspage = $frm{'previouspage'}"; # print "
  • msg_i = $msg_i"; # print "
  • cookieOrderID = $cookieOrderID"; # print "
  • cookieInfoID = $cookieInfoID"; # TESTING ORDERS ARRAY # print "

    \n"; # print "\@orders Main List"; # foreach $line (@orders) {print "
  • $line";} print "$returntofont\n"; print "@footer \n\n"; } # PREVIEW INVOICE ORDER # PREVIEW INVOICE ORDER sub PreviewOrder { @header = (); @footer = (); my (@list) = (); my ($key, $val); my ($nav_top, $nav_bottom) = (0,0); my ($li, $lk, $lv, $msg_status); my ($totalprice, $totalqnty, $temprice); my ($line, $qty, $item, $desc, $price, $ship, $taxit); my ($DiscountOne); my ($DiscountTwo); my ($CombinedDiscount); my ($SubDiscount); my ($TaxRate); my ($AdjustedTax); my ($Tax); my ($HandlingCharge); my ($InsuranceCharge); my ($ShippingCharge); my ($FinalAmount) = CommifyMoney ($Computations{'Final_Amount'}); my ($FinalProducts) = CommifyNumbers ($Computations{'Primary_Products'}); my ($msg_tab); my ($msg_tab_ck) = 0; $msg_status = "$FinalProducts Products " if ($Computations{'Primary_Products'} > 1); $msg_status = "$FinalProducts Product " if ($Computations{'Primary_Products'} == 1); $msg_status = $msg_status . " $currency $FinalAmount "; # using shipping and/or tax flags $allow_shipping++ if (scalar(@use_shipping)); $allow_shipping++ if (scalar(keys(%use_method))); $allow_tax++ if (scalar(keys(%use_city_tax))); $allow_tax++ if (scalar(keys(%use_zipcode_tax))); $allow_tax++ if (scalar(keys(%use_state_tax))); $allow_tax++ if (scalar(keys(%use_country_tax))); &GetTemplateFile($preview_template,"Preview Template File"); print "Content-Type: text/html\n\n"; print "@header \n\n"; # Insert MOF navigation at TOP # Insert MOF navigation at TOP $nav_top++ if ($menu_previous_top); $nav_top++ if ($menu_viewcart_top); $nav_top++ if ($menu_help_top); if ($nav_top) { print " \n"; if ($menu_previous_top) { print " \n";} if ($menu_viewcart_top) { print " \n"; } if ($menu_help_top) { print " \n";} print "
    $menu_previous_top"; print " "; print "$menu_viewcart_top \n"; print " \n"; print "$menu_help_top

    \n\n"; } # Top information # Top information print "
    \n"; print " \n"; # Display shipping info, etc. # Display shipping info, etc. print " \n"; print "
    \n"; print " "; print "
    \n"; if ($allow_shipping) { $msg_tab = "SHIP TO:
    " ; } elsif ($allow_tax) { $msg_tab = "TAX AREA:
    " } else { $msg_tab = "ORDER PREVIEW:
    " ; $msg_tab = $msg_tab . "$msg_status $action_message_e\n" } print "$msg_tab \n"; print "$action_message_s \n"; $edit_check_top = 0; if ($NewInfo{'Ecom_ShipTo_Postal_Name_Prefix'}) { print "$NewInfo{'Ecom_ShipTo_Postal_Name_Prefix'} \n"; $msg_tab_ck++; $edit_check_top++; } if ($NewInfo{'Ecom_ShipTo_Postal_Name_First'}) { print "$NewInfo{'Ecom_ShipTo_Postal_Name_First'} \n"; $msg_tab_ck++; $edit_check_top++; } if ($NewInfo{'Ecom_ShipTo_Postal_Name_Middle'}) { print "$NewInfo{'Ecom_ShipTo_Postal_Name_Middle'} \n"; $msg_tab_ck++; $edit_check_top++; } if ($NewInfo{'Ecom_ShipTo_Postal_Name_Last'}) { print "$NewInfo{'Ecom_ShipTo_Postal_Name_Last'} \n"; $msg_tab_ck++; $edit_check_top++; } if ($NewInfo{'Ecom_ShipTo_Postal_Name_Suffix'}) { print "$NewInfo{'Ecom_ShipTo_Postal_Name_Suffix'} \n"; $msg_tab_ck++; $edit_check_top++; } print "
    " if ($msg_tab_ck); $msg_tab_ck = 0; if ($NewInfo{'Ecom_ShipTo_Postal_Company'}) { print "$NewInfo{'Ecom_ShipTo_Postal_Company'}
    \n"; $edit_check_top++; } if ($NewInfo{'Ecom_ShipTo_Postal_Street_Line1'}) { print "$NewInfo{'Ecom_ShipTo_Postal_Street_Line1'}
    \n"; $edit_check_top++; } if ($NewInfo{'Ecom_ShipTo_Postal_Street_Line2'}) { print "$NewInfo{'Ecom_ShipTo_Postal_Street_Line2'}
    \n"; $edit_check_top++; } if ($NewInfo{'Ecom_ShipTo_Postal_City'}) { print "$NewInfo{'Ecom_ShipTo_Postal_City'} \n"; $msg_tab_ck++; $edit_check_top++; } if ($NewInfo{'Ecom_ShipTo_Postal_StateProv'}) { print "$NewInfo{'Ecom_ShipTo_Postal_StateProv'} \n"; $msg_tab_ck++; $edit_check_top++; } if ($NewInfo{'Ecom_ShipTo_Postal_PostalCode'}) { print "$NewInfo{'Ecom_ShipTo_Postal_PostalCode'} \n"; $msg_tab_ck++; $edit_check_top++; } print "
    " if ($msg_tab_ck); $msg_tab_ck = 0; if ($NewInfo{'Ecom_ShipTo_Postal_CountryCode'}) { print "$NewInfo{'Ecom_ShipTo_Postal_CountryCode'} \n"; $edit_check_top++; } print "$action_message_e
    \n"; print "
    \n"; # Top Edit Button - Can't edit unless ship or tax # Top Edit Button - Can't edit unless ship or tax if ($allow_shipping || $allow_tax) { if ($menu_edit_preview_top) { print "
    \n"; print "
    \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n\n"; foreach $line (@orders) {print " \n"} print "$menu_edit_preview_top
    \n"; } } # Displaying OrderID Date # Displaying OrderID Date print "
    \n"; print " \n"; print "\n"; print " \n"; print "
    $datetime_s Order ID: $OrderID $datetime_e
    $datetime_s $Date $ShortTime $datetime_e
    \n"; print "
    \n"; # printing orders in cart # printing orders in cart print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; # populate orders in table / store hidden input # populate orders in table / store hidden input foreach $line (@orders) { ($qty, $item, $desc, $price, $ship, $taxit) = split (/$delimit/, $line); print " \n"; print " \n"; if ($Computations{'Tax_Amount'} > 0 && $identify_tax_items && $taxit) { print " \n"; } else { print " \n"; } # Format User Input in Description # Format User Input in Description @list = split (/\|/, $desc); $desc = shift (@list); $desc =~ s/\[//g; $desc = $fontdesc_s . $desc . $fontdesc_e; foreach $li (@list) { ($lk, $lv) = split (/::/, $li); if ($makelist) { $desc = $desc . "$font_key_s
  • $lk: $font_key_e$font_val_s$lv$font_val_e"; } else { $desc = $desc . " - $font_key_s$lk: $font_key_e$font_val_s$lv$font_val_e"; } } print "
  • \n"; # Print row for single item or multiple to sub totals # Print row for single item or multiple to sub totals if ($qty > 1) { print "\n"; $sub_price = ($qty * $price); $totalprice += $sub_price; $totalqnty += $qty; $sub_price = sprintf "%.2f", $sub_price; $sub_price = CommifyMoney ($sub_price); $price = CommifyMoney ($price); $qty = CommifyNumbers ($qty); print "\n"; print "\n"; print "\n\n"; } else { $totalprice += $price; $totalqnty += $qty; $price = CommifyMoney ($price); print "\n\n"; } } print "
    $fontheading Qty$fontheading Item Name$fontheading Description$fontheading Price
    $fontqnty $qty
    $fontitem $item $identify_tax_items $fontitem $item $desc $fontprice \ \;
    \ \; $fontsubtext\n"; print "Sub Total $qty of $item at "; print "$currency $price each $fontsub $currency $sub_price
    $fontprice$currency $price
    \n"; print "$returntofont \n"; # start edit link # start edit link print " \n"; if ($menu_edit_preview_summary) { $edit_check = 0; $edit_check++ if ($Computations{'Shipping_Amount'} > 0 && $allow_shipping); $edit_check++ if ($Computations{'Tax_Amount'} > 0 && $allow_tax); $edit_check++ if ($Computations{'Insurance'} > 0); $edit_check++ if ($Computations{'Coupon_Discount'} > 0); if ($edit_check) { print " \n\n"; } } # Right Summary tables # Right Summary tables print "
    \n"; print "
    \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n\n"; foreach $line (@orders) {print " \n"} print "$menu_edit_preview_summary
    "; print "
    "; # Display Summary Totals # Display Summary Totals if ($totalqnty > 1) {$pd = "Products"} else {$pd = "Product"} $totalprice = sprintf "%.2f", $totalprice; $totalprice = CommifyMoney ($totalprice); $totalqnty = CommifyNumbers ($totalqnty); print " \n"; print " \n"; print "
    $totaltext Subtotal \n"; print "$totalqnty $pd ----> "; print "$totalcolor $currency $totalprice
    \n"; # Totals from %Computations ------------------> # Totals from %Computations ------------------> # CommifyMoney here, keep computations free of formatting # Display First Discount # Display First Discount if ($Computations{'Primary_Discount'} > 0) { $DiscountOne = CommifyMoney ($Computations{'Primary_Discount'}); print " \n"; print "
    $totaltext \n"; print "Discount $Computations{'Primary_Discount_Status'} ----> \n"; print "- $totalcolor $currency "; print " $DiscountOne
    \n"; } # Display Coupon Discount # Display Coupon Discount if ($Computations{'Coupon_Discount'} > 0) { $DiscountTwo = CommifyMoney ($Computations{'Coupon_Discount'}); print " \n"; print "
    $totaltext \n"; print "Discount $Computations{'Coupon_Discount_Status'} ----> \n"; print "- $totalcolor $currency "; print "$DiscountTwo
    \n"; } # Display Subtotal if discounts # Display Subtotal if discounts if ($Computations{'Combined_Discount'} > 0 ) { $SubDiscount = CommifyMoney ($Computations{'Sub_Final_Discount'}); $CombinedDiscount = CommifyMoney ($Computations{'Combined_Discount'}); print " \n"; print "
    $totaltext \n"; print "Sub Total After $currency $CombinedDiscount Total Discount ----> \n"; print " "; print "$totalcolor $currency $SubDiscount
    \n"; } # Tax Before # Tax Before if ($Computations{'Tax_Amount'} > 0 && $Computations{'Tax_Rule'} eq "BEFORE") { $TaxRate = ($Computations{'Tax_Rate'} * 100); $AdjustedTax = CommifyMoney ($Computations{'Adjusted_Tax_Amount_Before'}); $Tax = CommifyMoney ($Computations{'Tax_Amount'}); print " \n"; print "
    $totaltext \n"; print "Sales tax $TaxRate\% \(on $currency $AdjustedTax taxable\) ----> \n"; print " "; print "$totalcolor $currency $Tax
    \n"; } # Handling Charges # Handling Charges if ($Computations{'Handling'} > 0) { $HandlingCharges = CommifyMoney ($Computations{'Handling'}); print " \n"; print "
    $totaltext \n"; print "Handling $Computations{'Handling_Status'} ----> \n"; print " "; print "$totalcolor $currency $HandlingCharges
    \n"; } # Insurance Charges # Insurance Charges if ($Computations{'Insurance'} > 0) { $InsuranceCharges = CommifyMoney ($Computations{'Insurance'}); print " \n"; print "
    $totaltext \n"; print "Insurance $Computations{'Insurance_Status'} ----> \n"; print " "; print "$totalcolor $currency $InsuranceCharges
    \n"; } # Shipping Charges # Shipping Charges if ($Computations{'Shipping_Amount'} > 0 ) { $ShippingCharges = CommifyMoney ($Computations{'Shipping_Amount'}); print " \n"; print "
    $totaltext \n"; print "$Computations{'Shipping_Message'} ----> \n"; print " "; print "$totalcolor $currency $ShippingCharges
    \n"; } # Tax After # Tax After if ($Computations{'Tax_Amount'} > 0 && $Computations{'Tax_Rule'} eq "AFTER") { $TaxRate = ($Computations{'Tax_Rate'} * 100); $AdjustedTax = CommifyMoney ($Computations{'Adjusted_Tax_Amount_After'}); $Tax = CommifyMoney ($Computations{'Tax_Amount'}); print " \n"; print "
    $totaltext \n"; print "Sales tax $TaxRate\% \(on $currency $AdjustedTax taxable\) ----> \n"; print " "; print "$totalcolor $currency $Tax
    \n"; } # Final Total # Final Total print " \n"; print "
    $totaltext \n"; print "Total Order Amount ----> \n"; print " "; print "$totalcolor $currency $FinalAmount
    \n"; # overall table for edit link print "
    \n"; # Bottom Navigation Menu # Bottom Navigation Menu print "

    \n"; if ($menu_home_bottom) { print " \n";} if ($menu_previous_bottom) { print " \n";} if ($menu_editcart_bottom) { print " \n"; } # Edit Preview Information # Edit Preview Information if (scalar(@UsingInfoFields)) { if ($menu_edit_preview_bottom) { print " \n"; } } # PAYMENT CENTER POST # PAYMENT CENTER POST print " \n"; if ($menu_help_bottom) { print " \n";} print "
    $menu_home_bottom$menu_previous_bottom"; print " "; print "$menu_editcart_bottom"; print "
    \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n\n"; foreach $line (@orders) {print " \n"} print "$menu_edit_preview_bottom
    "; print "
    \n"; print "\n\n"; # parse collected data ----------------> # parse collected data ----------------> while (($key, $val) = each (%Computations)) { print " \n"; } foreach $_ (@orders) { print " \n" } while (($key, $val) = each (%NewInfo)) { print " \n"; } print " \n"; print " \n"; print " \n"; print " \n"; print " \n\n"; print "$menu_payment_bottom
    \n"; print " \n"; print "$menu_help_bottom
    "; # DEBUG PREVIEW # DEBUG PREVIEW # print "


    \%Computations"; # while (($key, $val) = each (%Computations)) { # print "
  • $key, $val \n"; # } # print "

    \%MissingInfoFields"; # while (($key, $val) = each (%MissingInfoFields)) { # print "
  • $key, $val \n"; # } # print "

    \%NewInfo Global Array "; # while (($key, $val) = each (%NewInfo)) { # print "
  • $key, $val \n"; # } # print "
    \@UsingInfoFields"; # foreach $_ (@UsingInfoFields) {print "
  • $_"} # print "

    \%shipping_destination_fields CONFIG"; # while (($key, $val) = each (%shipping_destination_fields)) { # print "
  • $key, $val \n"; # } # print "

    All Global Vars"; # print "
  • postmode = $frm{'postmode'}"; # print "
  • submit_preview_info = $frm{'submit_preview_info'}"; # print "
  • FRM-OrderID = $frm{'OrderID'}"; # print "
  • OrderID = $OrderID"; # print "
  • FRM-InfoID = $frm{'InfoID'}"; # print "
  • InfoID = $InfoID"; # print "
  • previouspage = $frm{'previouspage'}"; # print "
  • msg_i = $msg_i"; # print "
  • cookieOrderID = $cookieOrderID"; # print "
  • cookieInfoID = $cookieInfoID"; # TESTING ORDERS ARRAY # print "

    \n"; # print "\@orders Main List"; # foreach $line (@orders) {print "
  • $line";} print "$returntofont\n"; print "@footer \n\n"; }