本文整理汇总了PHP中Mage_Sales_Model_Order_Creditmemo::getAdjustmentNegative方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Creditmemo::getAdjustmentNegative方法的具体用法?PHP Mage_Sales_Model_Order_Creditmemo::getAdjustmentNegative怎么用?PHP Mage_Sales_Model_Order_Creditmemo::getAdjustmentNegative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Creditmemo
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Creditmemo::getAdjustmentNegative方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$grandTotal = $creditmemo->getGrandTotal();
$baseGrandTotal = $creditmemo->getBaseGrandTotal();
$grandTotal += $creditmemo->getAdjustmentPositive();
$baseGrandTotal += $creditmemo->getBaseAdjustmentPositive();
$grandTotal -= $creditmemo->getAdjustmentNegative();
$baseGrandTotal -= $creditmemo->getBaseAdjustmentNegative();
$creditmemo->setGrandTotal($grandTotal);
$creditmemo->setBaseGrandTotal($baseGrandTotal);
$creditmemo->setAdjustment($creditmemo->getAdjustmentPositive() - $creditmemo->getAdjustmentNegative());
$creditmemo->setBaseAdjustment($creditmemo->getBaseAdjustmentPositive() - $creditmemo->getBaseAdjustmentNegative());
return $this;
}
示例2: collect
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$order = $creditmemo->getOrder();
$orderTaxPerc = 0;
$taxDetails = $order->getFullTaxInfo();
if (count($taxDetails)) {
$det = array_pop($taxDetails);
$orderTaxPerc = $det['percent'];
}
// Adding adjustment tax amounts to total tax
$totalAdjusment = $creditmemo->getAdjustmentPositive() - $creditmemo->getAdjustmentNegative();
$baseTotalAdjusment = $creditmemo->getBaseAdjustmentPositive() - $creditmemo->getBaseAdjustmentNegative();
// Adjustment values already include tax in my case. Modify calculation if you're entering values without tax
$totalAdjusmentTax = $totalAdjusment - $totalAdjusment * 100 / (100 + $orderTaxPerc);
$baseTotalAdjusmentTax = $baseTotalAdjusment - $baseTotalAdjusment * 100 / (100 + $orderTaxPerc);
parent::collect($creditmemo);
$creditmemo->setTaxAmount($creditmemo->getTaxAmount() + $totalAdjusmentTax);
$creditmemo->setBaseTaxAmount($creditmemo->getBaseTaxAmount() + $baseTotalAdjusmentTax);
return $this;
}
示例3: mapAdjustmentNegativeAsItemByCreditmemo
/**
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
* @return Payone_Api_Request_Parameter_Invoicing_Item
*
* used by Payone_Core_Model_Mapper_ApiRequest_Payment_Debit
*/
protected function mapAdjustmentNegativeAsItemByCreditmemo(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$configMiscCreditmemo = $this->getConfigMisc()->getCreditmemo();
$sku = $configMiscCreditmemo->getAdjustmentFeeSku();
$name = $configMiscCreditmemo->getAdjustmentFeeName();
if (empty($sku)) {
$sku = $this->helper()->__(self::DEFAULT_ADJUSTMENT_NEGATIVE_SKU);
}
if (empty($name)) {
$name = $this->helper()->__(self::DEFAULT_ADJUSTMENT_NEGATIVE_SKU);
}
$params['id'] = $sku;
$params['de'] = $name;
$params['no'] = 1;
$params['pr'] = $creditmemo->getAdjustmentNegative() * -1;
if ($this->getPaymentMethod()->mustTransmitInvoicingItemTypes()) {
$params['it'] = Payone_Api_Enum_InvoicingItemType::GOODS;
}
$item = new Payone_Api_Request_Parameter_Invoicing_Item();
$item->init($params);
return $item;
}
示例4: mapAdjustmentNegativeAsItemByCreditmemo
/**
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
* @return Payone_Api_Request_Parameter_Invoicing_Item
*
* used by Payone_Core_Model_Mapper_ApiRequest_Payment_Debit
*/
protected function mapAdjustmentNegativeAsItemByCreditmemo(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$configMiscCreditmemo = $this->getConfigMisc()->getCreditmemo();
$sku = $configMiscCreditmemo->getAdjustmentFeeSku();
$name = $configMiscCreditmemo->getAdjustmentFeeName();
if (empty($sku)) {
$sku = $this->helper()->__(self::DEFAULT_ADJUSTMENT_NEGATIVE_SKU);
}
if (empty($name)) {
$name = $this->helper()->__(self::DEFAULT_ADJUSTMENT_NEGATIVE_SKU);
}
$params['it'] = Payone_Api_Enum_InvoicingItemType::GOODS;
$params['id'] = $sku;
$params['de'] = $name;
$params['no'] = 1;
$params['pr'] = $creditmemo->getAdjustmentNegative() * -1;
$params['va'] = round($this->getShippingTaxRate() * 100);
// assuming that it has the same tax-rate as shipping - dont know from where to get the tax
$item = new Payone_Api_Request_Parameter_Invoicing_Item();
$item->init($params);
return $item;
}