コード例 #1
0
ファイル: FunctionsGeneral.php プロジェクト: anunay/stentors
 public static function provinceTax($amount = 0)
 {
     if (Zend_Session::namespaceIsset('order')) {
         $session = Zend_Session::namespaceGet('order');
     } else {
         throw new Exception('Session namespace "order" is undefined.
             Thus state id is not set. It is not possible to get TVQ rate.
             Modify code to set state if or create the session namespace with
             stateId parameter.');
     }
     $oTaxe = new TaxesObject();
     $taxes = $oTaxe->getTaxData($session['stateId']);
     $rate = $taxes['TP_Rate'] / 100;
     if ($taxes['TP_Code'] == "QC") {
         $taxValue = ($amount + self::federalTax($amount)) * $rate;
     } else {
         $taxValue = $amount * $rate;
     }
     $taxValue = (double) $taxValue;
     $session = new Zend_Session_Namespace('order');
     $session->order['rateProv'] = $taxes;
     $session->tvq = $taxValue;
     return $taxValue;
 }
コード例 #2
0
ファイル: MemberProfile.php プロジェクト: anunay/stentors
 /**
  * Allows to add values of taxes for orders to the customer data.
  *
  * @param array $memberData
  *
  * @return array
  */
 public function addTaxRate(array $memberData)
 {
     $data = array();
     $memberId = $memberData['member_id'];
     $addrId = $memberData['addrBill'];
     $oAddres = new AddressObject();
     $oTaxes = new TaxesObject();
     $stateId = $oAddres->getStateId($addrId);
     $taxRate = $oTaxes->getTaxData($stateId);
     $memberData['taxProv'] = $taxRate['TP_Rate'];
     $memberData['taxCode'] = $taxRate['TZ_GroupName'];
     return $memberData;
 }