本文整理汇总了PHP中Line::setTaxIncluded方法的典型用法代码示例。如果您正苦于以下问题:PHP Line::setTaxIncluded方法的具体用法?PHP Line::setTaxIncluded怎么用?PHP Line::setTaxIncluded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Line
的用法示例。
在下文中一共展示了Line::setTaxIncluded方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _newLine
/**
* Makes a Line object from a product item object
*
* @param Varien_Object|Mage_Sales_Model_Quote_Item $item
* @return int|bool
*/
protected function _newLine($item)
{
if (!$item->getId()) {
$this->setCanSendRequest(false);
return $this;
}
$this->_addGwItemsAmount($item);
if ($this->isProductCalculated($item)) {
return false;
}
$product = $this->_getProductByProductId($this->_retrieveProductIdFromQuoteItem($item));
$taxClass = $this->_getTaxClassCodeByProduct($product);
$price = $item->getBaseRowTotal();
if ($this->_getTaxDataHelper()->applyTaxAfterDiscount($item->getStoreId())) {
$price = $item->getBaseRowTotal() - $item->getBaseDiscountAmount();
}
$lineNumber = count($this->_lines);
$line = new Line();
$line->setNo($lineNumber);
$line->setItemCode($this->_getCalculationHelper()->getItemCode($this->_getProductForItemCode($item), $item->getStoreId()));
$line->setDescription($item->getName());
$line->setQty($item->getTotalQty());
$line->setAmount($price);
$line->setDiscounted((double) $item->getDiscountAmount() && $this->_getTaxDataHelper()->applyTaxAfterDiscount($item->getStoreId()));
if ($this->_getTaxDataHelper()->priceIncludesTax($item->getStoreId())) {
$line->setTaxIncluded(true);
}
if ($taxClass) {
$line->setTaxCode($taxClass);
}
$ref1Value = $this->_getRefValueByProductAndNumber($product, 1, $item->getStoreId());
if ($ref1Value) {
$line->setRef1($ref1Value);
}
$ref2Value = $this->_getRefValueByProductAndNumber($product, 2, $item->getStoreId());
if ($ref2Value) {
$line->setRef2($ref2Value);
}
$this->_lines[$lineNumber] = $line;
$this->_lineToLineId[$lineNumber] = $item->getId();
return $lineNumber;
}
示例2: _newLine
/**
* Makes a Line object from a product item object
*
* @param Mage_Sales_Model_Order_Invoice_Item|Mage_Sales_Model_Order_Creditmemo_Item $item
* @param bool $credit
* @return null
*/
protected function _newLine($item, $credit = false)
{
if ($this->isProductCalculated($item->getOrderItem())) {
return false;
}
if ($item->getQty() == 0) {
return false;
}
$line = new Line();
$storeId = $this->_retrieveStoreIdFromItem($item);
$price = $item->getBaseRowTotal();
if ($this->_getTaxDataHelper()->priceIncludesTax($storeId)) {
$line->setTaxIncluded(true);
$price = $item->getBaseRowTotalInclTax();
}
if ($this->_getTaxDataHelper()->applyTaxAfterDiscount($storeId)) {
$price -= $item->getBaseDiscountAmount();
}
if ($credit) {
//@startSkipCommitHooks
$price *= -1;
//@finishSkipCommitHooks
}
$line->setNo(count($this->_lines));
$line->setItemCode($this->_getCalculationHelper()->getItemCode($this->_getProductForItemCode($item), $storeId, $item));
$line->setDescription($item->getName());
$line->setQty($item->getQty());
$line->setAmount($price);
$line->setDiscounted((double) $item->getBaseDiscountAmount() && $this->_getTaxDataHelper()->applyTaxAfterDiscount($storeId));
$productData = $this->_getLineProductData($item, $storeId);
$line->setTaxCode($productData->getTaxCode());
$line->setRef1($productData->getRef1());
$line->setRef2($productData->getRef2());
$this->_lineToItemId[count($this->_lines)] = $item->getOrderItemId();
$this->_lines[] = $line;
}
示例3: _addAdjustments
/**
* Adds adjustments to request as items
*
* @param float $positive
* @param float $negative
* @param int $storeId
* @return array
*/
protected function _addAdjustments($positive, $negative, $storeId)
{
if ($positive != 0) {
$lineNumber = count($this->_lines);
$identifier = Mage::helper('avatax')->getPositiveAdjustmentSku($storeId);
$line = new Line();
$line->setNo($lineNumber);
$line->setItemCode($identifier ? $identifier : 'adjustment');
$line->setDescription('Adjustment refund');
$line->setTaxCode($identifier);
$line->setQty(1);
$line->setAmount($positive * -1);
$line->setDiscounted(false);
$line->setTaxIncluded(true);
$this->_lineToItemId[$lineNumber] = 'positive-adjustment';
$this->_lines[$lineNumber] = $line;
$this->_request->setLines($this->_lines);
}
if ($negative != 0) {
$lineNumber = count($this->_lines);
$identifier = Mage::helper('avatax')->getNegativeAdjustmentSku($storeId);
$line = new Line();
$line->setNo($lineNumber);
$line->setItemCode($identifier ? $identifier : 'adjustment');
$line->setDescription('Adjustment fee');
$line->setTaxCode($identifier);
$line->setQty(1);
$line->setAmount($negative);
$line->setDiscounted(false);
$line->setTaxIncluded(true);
$this->_lineToItemId[$lineNumber] = 'negative-adjustment';
$this->_lines[$lineNumber] = $line;
$this->_request->setLines($this->_lines);
}
}