当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Order_Invoice类代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order_Invoice的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Invoice类的具体用法?PHP Mage_Sales_Model_Order_Invoice怎么用?PHP Mage_Sales_Model_Order_Invoice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Mage_Sales_Model_Order_Invoice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $totalTax = 0;
     $baseTotalTax = 0;
     foreach ($invoice->getAllItems() as $item) {
         $orderItem = $item->getOrderItem();
         $orderItemTax = $orderItem->getTaxAmount();
         $baseOrderItemTax = $orderItem->getBaseTaxAmount();
         $orderItemQty = $orderItem->getQtyOrdered();
         if ($orderItemTax && $orderItemQty) {
             /**
              * Resolve rounding problems
              */
             if ($item->isLast()) {
                 $tax = $orderItemTax - $orderItem->getTaxInvoiced();
                 $baseTax = $baseOrderItemTax - $orderItem->getBaseTaxInvoiced();
             } else {
                 $tax = $orderItemTax * $item->getQty() / $orderItemQty;
                 $baseTax = $baseOrderItemTax * $item->getQty() / $orderItemQty;
                 $tax = $invoice->getStore()->roundPrice($tax);
                 $baseTax = $invoice->getStore()->roundPrice($baseTax);
             }
             $item->setTaxAmount($tax);
             $item->setBaseTaxAmount($baseTax);
             $totalTax += $tax;
             $baseTotalTax += $baseTax;
         }
     }
     $invoice->setTaxAmount($totalTax);
     $invoice->setBaseTaxAmount($baseTotalTax);
     $invoice->setGrandTotal($invoice->getGrandTotal() + $totalTax);
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTotalTax);
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:34,代码来源:Tax.php

示例2: collect

 /**
  * @param Mage_Sales_Model_Order_Invoice $invoice
  *
  * @return $this
  */
 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $order = $invoice->getOrder();
     /**
      * The COD fee is always added to the first invoice, so if this order already has invoices, we don't have to add
      * anything.
      */
     if ($order->hasInvoices()) {
         return $this;
     }
     /**
      * Get the COD fee amounts.
      */
     $fee = $order->getBuckarooFee();
     $baseFee = $order->getBaseBuckarooFee();
     /**
      * If no COD fee is set, there is nothing to add/
      */
     if ($fee < 0.01 || $baseFee < 0.01) {
         return $this;
     }
     /**
      * Add the COD fee amounts to the invoice and update the amounts for the order.
      */
     $grandTotal = $invoice->getGrandTotal();
     $baseGrandTotal = $invoice->getBaseGrandTotal();
     $invoice->setBuckarooFee($fee)->setBaseBuckarooFee($baseFee)->setGrandTotal($grandTotal + $fee)->setBaseGrandTotal($baseGrandTotal + $baseFee);
     $order->setBuckarooFeeInvoiced($fee)->setBaseBuckarooFeeInvoiced($baseFee);
     return $this;
 }
开发者ID:technomagegithub,项目名称:olgo.nl,代码行数:35,代码来源:Fee.php

示例3: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $codTax = 0;
     $baseCodTax = 0;
     $includeCodTax = true;
     /**
      * Check Cod amount in previus invoices
      */
     foreach ($invoice->getOrder()->getInvoiceCollection() as $previusInvoice) {
         if ($previusInvoice->getCodFee() && !$previusInvoice->isCanceled()) {
             $includeCodTax = false;
         }
     }
     if ($includeCodTax) {
         $codTax += $invoice->getOrder()->getCodTaxAmount();
         $baseCodTax += $invoice->getOrder()->getBaseCodTaxAmount();
         $invoice->setCodTaxAmount($invoice->getOrder()->getCodTaxAmount());
         $invoice->setBaseCodTaxAmount($invoice->getOrder()->getBaseCodTaxAmount());
         $invoice->getOrder()->setCodTaxAmountInvoiced($codTax);
         $invoice->getOrder()->setBaseCodTaxAmountInvoice($baseCodTax);
     }
     //$invoice->setTaxAmount($invoice->getTaxAmount() + $codTax);
     //$invoice->setBaseTaxAmount($invoice->getBaseTaxAmount() + $baseCodTax);
     //$invoice->setGrandTotal($invoice->getGrandTotal() + $codTax);
     //$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseCodTax);
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:27,代码来源:Tax.php

示例4: setEntity

 /**
  * Set entity
  *
  * @param Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $object
  * @return $this
  */
 public function setEntity($object)
 {
     $this->setEntityId($object->getId());
     $this->setEntityIncrementId($object->getIncrementId());
     $this->setStoreId($object->getStoreId());
     return $this;
 }
开发者ID:onepica,项目名称:avatax,代码行数:13,代码来源:Queue.php

示例5: getShippingTaxRate

 /**
  * retrieves used shipping tax rate
  *
  * @param Mage_Sales_Model_Order_Invoice $invoice
  *
  * @return float
  */
 protected function getShippingTaxRate(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $taxRate = 0.0;
     $order = $invoice->getOrder();
     $taxRate = floatval(Mage::helper('ops/payment_request')->getShippingTaxRate($order));
     return $taxRate;
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:14,代码来源:OpenInvoiceNlAbstract.php

示例6: process

 /**
  * Save order in AvaTax system
  *
  * @see OnePica_AvaTax_Model_Observer_SalesOrderInvoiceSaveAfter::execute()
  * @param Mage_Sales_Model_Order_Invoice     $invoice
  * @param OnePica_AvaTax_Model_Records_Queue $queue
  * @return bool
  * @throws OnePica_AvaTax_Exception
  * @throws OnePica_AvaTax_Model_Service_Exception_Commitfailure
  * @throws OnePica_AvaTax_Model_Service_Exception_Unbalanced
  */
 public function process($invoice, $queue)
 {
     $order = $invoice->getOrder();
     $storeId = $order->getStoreId();
     $this->setStoreId($storeId);
     $shippingAddress = $order->getShippingAddress() ? $order->getShippingAddress() : $order->getBillingAddress();
     if (!$shippingAddress) {
         throw new OnePica_AvaTax_Exception($this->_getHelper()->__('There is no address attached to this order'));
     }
     /** @var OnePica_AvaTax_Model_Service_Result_Invoice $invoiceResult */
     $invoiceResult = $this->_getService()->invoice($invoice, $queue);
     //if successful
     if (!$invoiceResult->getHasError()) {
         $message = $this->_getHelper()->__('Invoice #%s was saved to AvaTax', $invoiceResult->getDocumentCode());
         $this->_getHelper()->addStatusHistoryComment($order, $message);
         $totalTax = $invoiceResult->getTotalTax();
         if ($totalTax != $invoice->getBaseTaxAmount()) {
             throw new OnePica_AvaTax_Model_Service_Exception_Unbalanced('Collected: ' . $invoice->getBaseTaxAmount() . ', Actual: ' . $totalTax);
         }
         //if not successful
     } else {
         $messages = $invoiceResult->getErrors();
         throw new OnePica_AvaTax_Model_Service_Exception_Commitfailure(implode(' // ', $messages));
     }
     return true;
 }
开发者ID:onepica,项目名称:avatax,代码行数:37,代码来源:Invoice.php

示例7: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $order = $invoice->getOrder();
     $store = $order->getStore();
     $invoiceTaxClass = Mage::getHelper('billmateinvoice')->getInvoiceTaxClass($store);
     $custTaxClassId = $order->getQuote()->getCustomerTaxClassId();
     $address = $order->getBillingAddress();
     $taxCalculationModel = Mage::getSingleton('tax/calculation');
     /* @var $taxCalculationModel Mage_Tax_Model_Calculation */
     $request = $taxCalculationModel->getRateRequest($invoice, $order->getQuote()->getBillingAddress(), $custTaxClassId, $store);
     if ($invoiceTaxClass) {
         if ($rate = $taxCalculationModel->getRate($request->setProductClassId($invoiceTaxClass))) {
             if (!Mage::helper('billmateinvoice')->InvoicePriceIncludesTax()) {
                 $InvoiceTax = $invoice->getFeeAmount() * $rate / 100;
                 $InvoiceBaseTax = $invoice->getBaseFeeAmount() * $rate / 100;
             } else {
                 $InvoiceTax = $invoice->getPaymentTaxAmount();
                 $InvoiceBaseTax = $invoice->getBasePaymentTaxAmount();
             }
             $InvoiceTax = $store->roundPrice($InvoiceTax);
             $InvoiceBaseTax = $store->roundPrice($InvoiceBaseTax);
             $invoice->setTaxAmount($invoice->getTaxAmount() + $InvoiceTax);
             $invoice->setBaseTaxAmount($invoice->getBaseTaxAmount() + $InvoiceBaseTax);
             $this->_saveAppliedTaxes($invoice, $taxCalculationModel->getAppliedRates($request), $InvoiceTax, $InvoiceBaseTax, $rate);
         }
     }
     if (!Mage::helper('billmateinvoice')->InvoicePriceIncludesTax()) {
         $invoice->setInvoiceTaxAmount($InvoiceTax);
         $invoice->setBaseInvoiceTaxAmount($InvoiceBaseTax);
     }
     $invoice->setGrandTotal($invoice->getGrandTotal() + $invoice->getPaymentTaxAmount());
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $invoice->getBasePaymentTaxAmount());
     return $this;
 }
开发者ID:ext,项目名称:magento,代码行数:34,代码来源:Tax.php

示例8: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $order = $invoice->getOrder();
     if ($order->getWebposChange() < 0.0001) {
         return;
     }
     $invoice->setWebposChange($order->getWebposChange())->setWebposBaseChange($order->getWebposBaseChange());
 }
开发者ID:javik223,项目名称:Evron-Magento,代码行数:8,代码来源:Change.php

示例9: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     /**
      * Check order grand total and invoice amounts
      */
     if ($invoice->isLast()) {
         //
     }
     return $this;
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:10,代码来源:Grand.php

示例10: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $order_id = $invoice->getOrderId();
     $order = Mage::getModel('sales/order')->load($order_id);
     $invoice->setFeeAmount($order->getFeeAmount());
     $invoice->setBaseFeeAmount($order->getBaseFeeAmount());
     $invoice->setGrandTotal($invoice->getGrandTotal() + $invoice->getFeeAmount());
     $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $invoice->getBaseFeeAmount());
     return $this;
 }
开发者ID:axovel,项目名称:exqzt,代码行数:10,代码来源:Codcharges.php

示例11: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $order = $invoice->getOrder();
     if ($order->getPayment()->getMethodInstance()->getCode() != 'cashondelivery') {
         return $this;
     }
     if (!$order->getCodFee()) {
         return $this;
     }
     foreach ($invoice->getOrder()->getInvoiceCollection() as $previusInvoice) {
         if ($previusInvoice->getCodAmount() && !$previusInvoice->isCanceled()) {
             $includeCodTax = false;
         }
     }
     $baseCodFee = $order->getBaseCodFee();
     $baseCodFeeInvoiced = $order->getBaseCodFeeInvoiced();
     $baseInvoiceTotal = $invoice->getBaseGrandTotal();
     $codFee = $order->getCodFee();
     $codFeeInvoiced = $order->getCodFeeInvoiced();
     $invoiceTotal = $invoice->getGrandTotal();
     if (!$baseCodFee || $baseCodFeeInvoiced == $baseCodFee) {
         return $this;
     }
     $baseCodFeeToInvoice = $baseCodFee - $baseCodFeeInvoiced;
     $codFeeToInvoice = $codFee - $codFeeInvoiced;
     $baseInvoiceTotal = $baseInvoiceTotal + $baseCodFeeToInvoice;
     $invoiceTotal = $invoiceTotal + $codFeeToInvoice;
     $invoice->setBaseGrandTotal($baseInvoiceTotal);
     $invoice->setGrandTotal($invoiceTotal);
     $invoice->setBaseCodFee($baseCodFeeToInvoice);
     $invoice->setCodFee($codFeeToInvoice);
     $order->setBaseCodFeeInvoiced($baseCodFeeInvoiced + $baseCodFeeToInvoice);
     $order->setCodFeeInvoiced($codFeeInvoiced + $codFeeToInvoice);
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:35,代码来源:Total.php

示例12: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $baseDiscount = 0;
     $discount = 0;
     foreach ($invoice->getAllItems() as $item) {
         if ($item->getOrderItem()->isDummy()) {
             continue;
         }
         $orderItem = $item->getOrderItem();
         $orderItemDiscount = (double) $orderItem->getAffiliateplusAmount();
         $baseOrderItemDiscount = (double) $orderItem->getBaseAffiliateplusAmount();
         $orderItemQty = $orderItem->getQtyOrdered();
         if ($orderItemDiscount && $orderItemQty) {
             $discount -= $orderItemDiscount * $item->getQty() / $orderItemQty;
             $baseDiscount -= $baseOrderItemDiscount * $item->getQty() / $orderItemQty;
         }
     }
     if (!floatval($baseDiscount)) {
         $order = $invoice->getOrder();
         $baseDiscount = $order->getBaseAffiliateplusDiscount();
         $discount = $order->getAffiliateplusDiscount();
     }
     if (floatval($baseDiscount)) {
         $baseDiscount = Mage::app()->getStore()->roundPrice($baseDiscount);
         $discount = Mage::app()->getStore()->roundPrice($discount);
         $invoice->setBaseAffiliateplusDiscount($baseDiscount);
         $invoice->setAffiliateplusDiscount($discount);
         $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseDiscount);
         $invoice->setGrandTotal($invoice->getGrandTotal() + $discount);
     }
     return $this;
 }
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:32,代码来源:Magestore_Affiliateplus_Model_Total_Invoice_Affiliateplus.php

示例13: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $order = $invoice->getOrder();
     if (!preg_match('/^capayable/', $order->getPayment()->getMethodInstance()->getCode())) {
         return $this;
     }
     if (!$order->getCapayableFee()) {
         return $this;
     }
     foreach ($invoice->getOrder()->getInvoiceCollection() as $prevInvoice) {
         if ($prevInvoice->getCapayableFeeAmount() && !$prevInvoice->isCanceled()) {
             $includeFeeTax = FALSE;
         }
     }
     $basePaymentFee = $order->getBaseCapayableFee();
     $basePaymentFeeInvoiced = $order->getBaseCapayableFeeInvoiced();
     $baseInvoiceTotal = $invoice->getBaseGrandTotal();
     $paymentFee = $order->getCapayableFee();
     $paymentFeeInvoiced = $order->getCapayableFeeInvoiced();
     $invoiceTotal = $invoice->getGrandTotal();
     if (!$basePaymentFee || $basePaymentFeeInvoiced == $basePaymentFee) {
         return $this;
     }
     $basePaymentFeeToInvoice = $basePaymentFee - $basePaymentFeeInvoiced;
     $paymentFeeToInvoice = $paymentFee - $paymentFeeInvoiced;
     $baseInvoiceTotal = $baseInvoiceTotal + $basePaymentFeeToInvoice;
     $invoiceTotal = $invoiceTotal + $paymentFeeToInvoice;
     $invoice->setBaseGrandTotal($baseInvoiceTotal);
     $invoice->setGrandTotal($invoiceTotal);
     $invoice->setBaseCapayableFee($basePaymentFeeToInvoice);
     $invoice->setCapayableFee($paymentFeeToInvoice);
     $order->setBaseCapayableFeeInvoiced($basePaymentFeeInvoiced + $basePaymentFeeToInvoice);
     $order->setCapayableFeeInvoiced($paymentFeeInvoiced + $paymentFeeToInvoice);
     return $this;
 }
开发者ID:blueglobeNL,项目名称:tritac-capayable,代码行数:35,代码来源:Total.php

示例14: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $order = $invoice->getOrder();
     $feeAmountLeft = floatval($order->getDamageWaiverAmount() - $order->getDamageWaiverAmountInvoiced());
     $baseFeeAmountLeft = floatval($order->getBaseDamageWaiverAmount() - $order->getBaseDamageWaiverAmountInvoiced());
     if ($baseFeeAmountLeft > 0) {
         $invoice->setDamageWaiverAmount($feeAmountLeft);
         $invoice->setBaseDamageWaiverAmount($baseFeeAmountLeft);
     }
     return $this;
 }
开发者ID:hueyl77,项目名称:fourwindsgear,代码行数:11,代码来源:Damagewaiver.php

示例15: collect

 /**
  * Collect total cost of invoiced items
  *
  * @param Mage_Sales_Model_Order_Invoice $invoice
  * @return Mage_Sales_Model_Order_Invoice_Total_Cost
  */
 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $baseInvoiceTotalCost = 0;
     foreach ($invoice->getAllItems() as $item) {
         if (!$item->getHasChildren()) {
             $baseInvoiceTotalCost += $item->getBaseCost() * $item->getQty();
         }
     }
     $invoice->setBaseCost($baseInvoiceTotalCost);
     return $this;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:17,代码来源:Cost.php


注:本文中的Mage_Sales_Model_Order_Invoice类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。