本文整理汇总了PHP中Mage_Sales_Model_Order_Invoice::getIncrementId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Invoice::getIncrementId方法的具体用法?PHP Mage_Sales_Model_Order_Invoice::getIncrementId怎么用?PHP Mage_Sales_Model_Order_Invoice::getIncrementId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Invoice
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Invoice::getIncrementId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: invoice
/**
* 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 OnePica_AvaTax_Model_Service_Result_Invoice
*/
public function invoice($invoice, $queue)
{
$this->_lines = array();
$order = $invoice->getOrder();
$storeId = $order->getStoreId();
$invoiceDate = $this->_convertGmtDate($invoice->getCreatedAt(), $storeId);
$orderDate = $this->_convertGmtDate($order->getCreatedAt(), $storeId);
$statusDate = $this->_convertGmtDate($queue->getUpdatedAt(), $storeId);
$shippingAddress = $order->getShippingAddress() ? $order->getShippingAddress() : $order->getBillingAddress();
$this->_request = new GetTaxRequest();
$this->_request->setDocCode($invoice->getIncrementId());
$this->_request->setDocType(DocumentType::$SalesInvoice);
$this->_addGeneralInfo($order);
$this->_addShipping($invoice);
$items = $invoice->getItemsCollection();
$this->_initProductCollection($items);
$this->_initTaxClassCollection($invoice);
//Added code for calculating tax for giftwrap items
$this->_addGwOrderAmount($invoice);
$this->_addGwItemsAmount($invoice);
$this->_addGwPrintedCardAmount($invoice);
$this->_setOriginAddress($order->getStoreId());
$this->_setDestinationAddress($shippingAddress);
$this->_request->setDocDate($invoiceDate);
$this->_request->setPaymentDate($invoiceDate);
$this->_request->setTaxDate($orderDate);
$this->_request->setStatusDate($statusDate);
$configAction = Mage::getStoreConfig('tax/avatax/action', $order->getStoreId());
$commitAction = OnePica_AvaTax_Model_Service_Abstract_Config::ACTION_CALC_SUBMIT_COMMIT;
$this->_request->setCommit($configAction == $commitAction ? true : false);
foreach ($items as $item) {
/** @var Mage_Sales_Model_Order_Invoice_Item $item */
$this->_newLine($item);
}
$this->_request->setLines($this->_lines);
//send to AvaTax
$result = $this->_send($order->getStoreId());
/** @var OnePica_AvaTax_Model_Service_Result_Invoice $invoiceResult */
$invoiceResult = Mage::getModel('avatax/service_result_invoice');
$resultHasError = $result->getResultCode() != SeverityLevel::$Success;
$invoiceResult->setHasError($resultHasError);
//if successful
if (!$resultHasError) {
$totalTax = $result->getTotalTax();
$invoiceResult->setTotalTax($totalTax);
$documentCode = $result->getDocCode();
$invoiceResult->setDocumentCode($documentCode);
//if not successful
} else {
$messages = array();
foreach ($result->getMessages() as $message) {
$messages[] = $message->getSummary();
}
$invoiceResult->setErrors($messages);
}
return $invoiceResult;
}
示例3: invoice
/**
* Save order in AvaTax system
*
* @see OnePica_AvaTax_Model_Observer::salesOrderPlaceAfter()
* @param Mage_Sales_Model_Order_Invoice $invoice
* @param OnePica_AvaTax_Model_Records_Queue $queue
* @return bool
* @throws OnePica_AvaTax_Exception
* @throws OnePica_AvaTax_Model_Avatax_Exception_Commitfailure
* @throws OnePica_AvaTax_Model_Avatax_Exception_Unbalanced
*/
public function invoice($invoice, $queue)
{
$order = $invoice->getOrder();
$storeId = $order->getStoreId();
$invoiceDate = $this->_convertGmtDate($invoice->getCreatedAt(), $storeId);
$orderDate = $this->_convertGmtDate($order->getCreatedAt(), $storeId);
$statusDate = $this->_convertGmtDate($queue->getUpdatedAt(), $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($invoice->getIncrementId());
$this->_request->setDocType(DocumentType::$SalesInvoice);
$this->_addGeneralInfo($order);
$this->_addShipping($invoice);
$items = $invoice->getItemsCollection();
$this->_initProductCollection($items);
$this->_initTaxClassCollection($invoice);
//Added code for calculating tax for giftwrap items
$this->_addGwOrderAmount($invoice);
$this->_addGwItemsAmount($invoice);
$this->_addGwPrintedCardAmount($invoice);
$this->_setOriginAddress($order->getStoreId());
$this->_setDestinationAddress($shippingAddress);
$this->_request->setDocDate($invoiceDate);
$this->_request->setPaymentDate($invoiceDate);
$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_Invoice_Item $item */
$this->_newLine($item);
}
$this->_request->setLines($this->_lines);
//send to AvaTax
$result = $this->_send($order->getStoreId());
//if successful
if ($result->getResultCode() == SeverityLevel::$Success) {
$message = Mage::helper('avatax')->__('Invoice #%s was saved to AvaTax', $result->getDocCode());
$this->_addStatusHistoryComment($order, $message);
if ($result->getTotalTax() != $invoice->getBaseTaxAmount()) {
throw new OnePica_AvaTax_Model_Avatax_Exception_Unbalanced('Collected: ' . $invoice->getBaseTaxAmount() . ', 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 true;
}
示例4: _getInvoiceDocumentCode
/**
* Get document code for invoice
*
* @param Mage_Sales_Model_Order_Invoice $invoice
* @return string
*/
protected function _getInvoiceDocumentCode($invoice)
{
return self::DOCUMENT_CODE_INVOICE_PREFIX . $invoice->getIncrementId();
}
示例5: getInvoiceDocCode
public function getInvoiceDocCode(Mage_Sales_Model_Order_Invoice $invoice)
{
$prefix = trim($this->getConfig('invoice_prefix', $invoice->getStore()), self::DOC_CODE_SEPARATOR);
$prefix = (empty($prefix) ? 'I' : $prefix) . self::DOC_CODE_SEPARATOR;
if ($invoice->getAvataxDocument()) {
return $invoice->getAvataxDocument();
} elseif ($invoice->getIncrementId()) {
return $prefix . $invoice->getIncrementId();
} else {
return null;
}
}
示例6: _filterInvoice
/**
* @param Mage_Sales_Model_Order_Invoice $invoice
*
* @return Bronto_Common_Model_Email_Template_Filter
*/
protected function _filterInvoice(Mage_Sales_Model_Order_Invoice $invoice)
{
if (!in_array('invoice', $this->_filteredObjects)) {
$index = 1;
foreach ($invoice->getAllItems() as $item) {
$_item = $item->getOrderItem();
if (!$_item->getParentItem()) {
$this->_filterOrderItem($_item, $index);
$index++;
}
}
// Add Related Content
$this->_items = $invoice->getAllItems();
$this->setField('invoiceIncrementId', $invoice->getIncrementId());
$this->setField('invoiceItems', $this->_filterInvoiceItems($invoice));
$this->_filteredObjects[] = 'invoice';
}
return $this;
}