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


PHP Mage_Sales_Model_Order_Creditmemo::getCreatedAt方法代码示例

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


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

示例1: creditmemoToFeed

 /**
  * Convert a creditmemo to a LinkShare refund row.
  *
  * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
  * @return array
  */
 public function creditmemoToFeed(Mage_Sales_Model_Order_Creditmemo $creditmemo)
 {
     $orderDate = new Zend_Date($creditmemo->getOrderDate(), Varien_Date::DATETIME_INTERNAL_FORMAT);
     $orderDate = $orderDate->toString('yyyy-MM-dd');
     $cmDate = new Zend_Date($creditmemo->getCreatedAt(), Varien_Date::DATETIME_INTERNAL_FORMAT);
     $cmDate = $cmDate->toString('yyyy-MM-dd');
     $rows = array();
     foreach ($creditmemo->getAllItems() as $cmItem) {
         /* @var $cmItem Mage_Sales_Model_Order_Creditmemo_Item */
         if ($cmItem->getBaseRowTotal()) {
             $rows[] = array('order_id' => $creditmemo->getOrderIncrementId(), 'site_id' => '', 'order_date' => $orderDate, 'transaction_date' => $cmDate, 'sku' => $cmItem->getSku(), 'quantity' => round($cmItem->getQty()), 'amount' => ($cmItem->getBaseRowTotal() - $cmItem->getBaseDiscountAmount()) * -100, 'currency' => $creditmemo->getBaseCurrencyCode(), 'blank' => '', 'blank' => '', 'blank' => '', 'product_name' => '');
         }
     }
     return $rows;
 }
开发者ID:adrian-green,项目名称:productfeed,代码行数:21,代码来源:Refund.php

示例2: creditmemo

 /**
  * Save order's creditmemo in AvaTax system
  *
  * @see OnePica_AvaTax_Model_Observer_SalesOrderCreditmemoSaveAfter::execute()
  * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
  * @param OnePica_AvaTax_Model_Records_Queue $queue
  * @return mixed
  * @throws OnePica_AvaTax_Exception
  * @throws OnePica_AvaTax_Model_Service_Exception_Commitfailure
  * @throws OnePica_AvaTax_Model_Service_Exception_Unbalanced
  */
 public function creditmemo($creditmemo, $queue)
 {
     $this->_lines = array();
     $order = $creditmemo->getOrder();
     $storeId = $order->getStoreId();
     $creditmemoDate = $this->_convertGmtDate($creditmemo->getCreatedAt(), $storeId);
     $orderDate = $this->_convertGmtDate($order->getCreatedAt(), $storeId);
     $shippingAddress = $order->getShippingAddress() ? $order->getShippingAddress() : $order->getBillingAddress();
     // Set up document for request
     $this->_request = $this->_getNewDocumentRequestObject();
     // set up header
     $header = $this->_getRequestHeaderWithMainValues($storeId, $order);
     $header->setDocumentCode($this->_getCreditmemoDocumentCode($creditmemo));
     $header->setTransactionDate($creditmemoDate);
     $header->setTaxCalculationDate($orderDate);
     $header->setDefaultLocations($this->_getHeaderDefaultLocations($shippingAddress));
     $this->_request->setHeader($header);
     $this->_addShipping($creditmemo, true);
     $items = $creditmemo->getAllItems();
     $this->_initProductCollection($items);
     $this->_initTaxClassCollection($creditmemo);
     //Added code for calculating tax for giftwrap items
     $this->_addGwOrderAmount($creditmemo, true);
     $this->_addGwItemsAmount($creditmemo, true);
     $this->_addGwPrintedCardAmount($creditmemo, true);
     $this->_addAdjustments($creditmemo->getBaseAdjustmentPositive(), $creditmemo->getBaseAdjustmentNegative(), $order->getStoreId());
     foreach ($items as $item) {
         /** @var Mage_Sales_Model_Order_Creditmemo_Item $item */
         $this->_newLine($item, true);
     }
     $this->_setLinesToRequest();
     //send to AvaTax
     $result = $this->_send($order->getStoreId());
     /** @var OnePica_AvaTax_Model_Service_Result_Creditmemo $creditmemoResult */
     $creditmemoResult = Mage::getModel('avatax/service_result_creditmemo');
     $creditmemoResult->setHasError($result->getHasError());
     //if successful
     if (!$result->getHasError()) {
         $totalTax = $result->getCalculatedTaxSummary()->getTotalTax();
         $creditmemoResult->setTotalTax($totalTax);
         $documentCode = $result->getHeader()->getDocumentCode();
         $creditmemoResult->setDocumentCode($documentCode);
         //if not successful
     } else {
         $creditmemoResult->setErrors($result->getErrors());
     }
     return $creditmemoResult;
 }
开发者ID:onepica,项目名称:avatax,代码行数:59,代码来源:Invoice.php

示例3: creditmemo

 /**
  * Save order in AvaTax system
  *
  * @see OnePica_AvaTax_Model_Observer::salesOrderPlaceAfter()
  * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
  * @param OnePica_AvaTax_Model_Records_Queue $queue
  * @return mixed
  * @throws OnePica_AvaTax_Exception
  * @throws OnePica_AvaTax_Model_Avatax_Exception_Commitfailure
  * @throws OnePica_AvaTax_Model_Avatax_Exception_Unbalanced
  */
 public function creditmemo($creditmemo, $queue)
 {
     $order = $creditmemo->getOrder();
     $storeId = $order->getStoreId();
     $orderDate = $this->_convertGmtDate($order->getCreatedAt(), $storeId);
     $statusDate = $this->_convertGmtDate($queue->getUpdatedAt(), $storeId);
     $creditmemoDate = $this->_convertGmtDate($creditmemo->getCreatedAt(), $storeId);
     $shippingAddress = $order->getShippingAddress() ? $order->getShippingAddress() : $order->getBillingAddress();
     if (!$shippingAddress) {
         throw new OnePica_AvaTax_Exception($this->__('There is no address attached to this order'));
     }
     $this->_request = new GetTaxRequest();
     $this->_request->setDocCode($creditmemo->getIncrementId());
     $this->_request->setDocType(DocumentType::$ReturnInvoice);
     $this->_addGeneralInfo($order);
     $this->_addShipping($creditmemo, true);
     $items = $creditmemo->getAllItems();
     $this->_initProductCollection($items);
     $this->_initTaxClassCollection($creditmemo);
     //Added code for calculating tax for giftwrap items
     $this->_addGwOrderAmount($creditmemo, true);
     $this->_addGwItemsAmount($creditmemo, true);
     $this->_addGwPrintedCardAmount($creditmemo, true);
     $this->_addAdjustments($creditmemo->getAdjustmentPositive(), $creditmemo->getAdjustmentNegative(), $order->getStoreId());
     $this->_setOriginAddress($order->getStoreId());
     $this->_setDestinationAddress($shippingAddress);
     // Set the tax date for calculation.
     $override = new TaxOverride();
     $override->setTaxDate($orderDate);
     $override->setTaxOverrideType(TaxOverrideType::$TaxDate);
     $override->setReason('Credit memo - refund');
     $this->_request->setTaxOverride($override);
     $this->_request->setDocDate($creditmemoDate);
     $this->_request->setPaymentDate($creditmemoDate);
     $this->_request->setTaxDate($orderDate);
     $this->_request->setStatusDate($statusDate);
     $configAction = Mage::getStoreConfig('tax/avatax/action', $order->getStoreId());
     $commitAction = OnePica_AvaTax_Model_Config::ACTION_CALC_SUBMIT_COMMIT;
     $this->_request->setCommit($configAction == $commitAction ? true : false);
     foreach ($items as $item) {
         /** @var Mage_Sales_Model_Order_Creditmemo_Item $item */
         $this->_newLine($item, true);
     }
     $this->_request->setLines($this->_lines);
     //send to AvaTax
     $result = $this->_send($order->getStoreId());
     //if successful
     if ($result->getResultCode() == SeverityLevel::$Success) {
         $message = Mage::helper('avatax')->__('Credit memo #%s was saved to AvaTax', $result->getDocCode());
         $this->_addStatusHistoryComment($order, $message);
         if ($result->getTotalTax() != $creditmemo->getBaseTaxAmount() * -1) {
             throw new OnePica_AvaTax_Model_Avatax_Exception_Unbalanced('Collected: ' . $creditmemo->getTaxAmount() . ', Actual: ' . $result->getTotalTax());
         }
         //if not successful
     } else {
         $messages = array();
         foreach ($result->getMessages() as $message) {
             $messages[] = $message->getSummary();
         }
         throw new OnePica_AvaTax_Model_Avatax_Exception_Commitfailure(implode(' // ', $messages));
     }
     return $result;
 }
开发者ID:virtual97,项目名称:avatax,代码行数:74,代码来源:Invoice.php


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