Beispiel #1
0
 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;
 }
Beispiel #2
0
 public function importTaxFileAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     // Defines the list of tables to receive data
     $this->_tablesList = array('Catalog_TaxeZone');
     // Define the prefix used to define table/file to format object name
     $this->_prefix = 'Catalog_';
     // Process to import action
     $this->importAction();
     // Update Edith tax table
     $oTaxes = new TaxesObject();
     $oTaxes->importTaxes();
     // Delete tax file at the end of the process
     //Get the config file data
     $config = Zend_Registry::get('config');
     //Defines path to the folder containing files to import
     $this->_importFilesFolder = $this->_exportFilesFolder;
     $filePath = $this->_exportFilesFolder . $config->taxFileName;
     $nameForDb = $this->_exportFilesFolder . $config->taxTableName;
     unlink($filePath);
     unlink($nameForDb);
     // Redirect current action to default index page.
     // There's no need to set a view for this action
     $this->_redirect();
 }
Beispiel #3
0
 /**
  * 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;
 }