Documentation TYPO3 par Ameos

products_comp_calcScript.inc

00001 <?php
00002 /*
00003 
00004 products_comp_calcScript.php
00005 
00006 
00007 Calculation script for use with the default products.inc script
00008 
00009 The script is based on the assumption that you're going to add a fee for using MasterCard/Eurocard, VISA or Diners Club.
00010 MasterCard and VISA demands 5.75 % percent of the total amount in transaction fee. To compensate for this and let the customer pay the fee, this script calculates how much you need to add to the total in order to fully compensate.
00011 To compensate 5,75% you must add 6.10%, then 5,75 % percent of that total is exactly the same as the amount of the fee.
00012 
00013 TypoScript properties:
00014 
00015 .feeTax  = enter sales-tax percentage for the fee, if any
00016 .feePercent = the percent to be compensated for, default is 5.75 %
00017 
00018 */
00019 
00020 
00021 $baseAmount = $this->calculatedSums_tax["goodstotal"]+$this->calculatedSums_tax["shipping"];            // The fee is calculated from the total of the goods AND shipping
00022 $feePercent = doubleval($conf["feePercent"] ? $conf["feePercent"] : 5.75);              // Fee percent is by default 5.75 %
00023         # Calculate conpensating percentage by:   100/(1-pFee/100)-100 = pComp, where pFee is the percentage, eg. Mastercard is taking (5,75%) and pComp will thus be 6.1 %
00024 $compPercent = 100/(1-$feePercent/100)-100;             // The compensation percentage.
00025 
00026 $this->calculatedSums_no_tax["payment"] = $baseAmount/100*$compPercent;         // Add the amount to the no_tax total
00027 $this->calculatedSums_tax["payment"] = $this->calculatedSums_no_tax["payment"] * (1+$conf["feeTax"]/100);               // ..and add the amount to the tax total + tax of the amount, if any
00028 
00029 //debug($this->calculatedSums_tax);
00030 //debug($this->calculatedSums_no_tax);
00031 
00032 ?>


Généré par TYPO3 Ameos avec  doxygen 1.4.6