Ejemplo n.º 1
0
 public function __get($strName)
 {
     switch ($strName) {
         case 'Price':
             return $this->GetPrice(TaxCode::GetDefault(), $this->product->tax_status_id);
         case 'PriceExclusive':
             return $this->GetPrice(TaxCode::GetDefault(), $this->product->tax_status_id, true);
         default:
             return parent::__get($strName);
     }
 }
Ejemplo n.º 2
0
 /**
  * Update Cart by setting taxes when in Tax Inclusive
  */
 public function UpdateTaxInclusive()
 {
     if (_xls_get_conf('TAX_INCLUSIVE_PRICING', '0') != '1') {
         return;
     }
     $TAX_DECIMAL = _xls_get_conf('TAX_DECIMAL', 2);
     // Reset taxes
     $this->tax1 = 0;
     $this->tax2 = 0;
     $this->tax3 = 0;
     $this->tax4 = 0;
     $this->tax5 = 0;
     // Get the rowid for "No Tax"
     $objNoTax = TaxCode::GetNoTaxCode();
     $intNoTax = 999;
     if ($objNoTax) {
         $intNoTax = $objNoTax->lsid;
     }
     // Tax Inclusive && Want taxes, so return and set prices back to inclusive if needed
     if ($this->fk_tax_code_id != $intNoTax) {
         if (!$this->tax_inclusive) {
             //if the last destination was exclusive, and we have inclusive now, we need to reset the line items
             $this->tax_inclusive = 1;
             foreach ($this->documentItems as $objItem) {
                 // Set back tax inclusive prices
                 $objItem->sell = $objItem->product->GetPrice($objItem->qty);
                 $objItem->sell_base = $objItem->sell;
                 $objItem->tax_in = true;
                 $objItem->save();
             }
         }
         return;
     }
     $this->tax_inclusive = 0;
     // Tax Inclusive && Don't want taxes
     foreach ($this->documentItems as $objItem) {
         // For quote to cart, we have to remove prices manually
         if ($objItem->cart_type == CartType::quote && $objItem->tax_in) {
             $taxes = $objItem->product->CalculateTax(TaxCode::GetDefault(), $objItem->Sell);
             // Taxes are deducted from cart for Lightspeed
             $this->tax1 -= $taxes[1];
             $this->tax2 -= $taxes[2];
             $this->tax3 -= $taxes[3];
             $this->tax4 -= $taxes[4];
             $this->tax5 -= $taxes[5];
             $objItem->sell -= round(array_sum($taxes), $TAX_DECIMAL);
             $objItem->sell_base = $objItem->Sell;
             $objItem->sell_total = $objItem->sell * $objItem->qty;
             $objItem->tax_in = false;
             $objItem->save();
         } elseif ($objItem->cart_type = CartType::order && $objItem->tax_in) {
             // Set Tax Exclusive price
             $objItem->sell = $objItem->product->GetPrice($objItem->qty, true);
             $objItem->sell_base = $objItem->sell;
             $objItem->tax_in = false;
             $objItem->save();
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Checks if current taxcode should be tax inclusive or not..
  * @return
  */
 public function ResetTaxIncFlag()
 {
     $this->tax_inclusive = 0;
     if (_xls_get_conf('TAX_INCLUSIVE_PRICING', '0') == 1) {
         $objTaxCode = TaxCode::GetDefault();
         if ($objTaxCode instanceof TaxCode) {
             $this->tax_code_id = $objTaxCode->lsid;
             $this->tax_inclusive = 1;
         }
     }
 }