本文整理汇总了PHP中Mage_Sales_Model_Order_Creditmemo::getAdjustmentPositive方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Creditmemo::getAdjustmentPositive方法的具体用法?PHP Mage_Sales_Model_Order_Creditmemo::getAdjustmentPositive怎么用?PHP Mage_Sales_Model_Order_Creditmemo::getAdjustmentPositive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Creditmemo
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Creditmemo::getAdjustmentPositive方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: isCreditmemoAllowed
/**
* Is the given creditmemo allowed
*
* @param Mage_Sales_Model_Order_Creditmemo
*/
private function isCreditmemoAllowed(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
if ($creditmemo->getShippingAmount() < $creditmemo->getOrder()->getShippingAmount() && $creditmemo->getShippingAmount() > 0) {
$this->_errorMessage = 'Only full return of shipping is possible.';
return false;
}
if ($creditmemo->getAdjustmentPositive() > 0 && $this->_getItemCount($creditmemo) > 0) {
$this->_errorMessage = 'Please create product returns and positive adjustments separately.';
return false;
}
return true;
}
示例4: mapAdjustmentPositiveAsItemByCreditmemo
/**
* @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 mapAdjustmentPositiveAsItemByCreditmemo(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$configMiscCreditmemo = $this->getConfigMisc()->getCreditmemo();
$sku = $configMiscCreditmemo->getAdjustmentRefundSku();
$name = $configMiscCreditmemo->getAdjustmentRefundName();
if (empty($sku)) {
$sku = $this->helper()->__(self::DEFAULT_ADJUSTMENT_POSITIVE_SKU);
}
if (empty($name)) {
$name = $this->helper()->__(self::DEFAULT_ADJUSTMENT_POSITIVE_SKU);
}
$params['id'] = $sku;
$params['de'] = $name;
$params['no'] = 1;
$params['pr'] = $creditmemo->getAdjustmentPositive();
if ($this->getPaymentMethod()->mustTransmitInvoicingItemTypes()) {
$params['it'] = Payone_Api_Enum_InvoicingItemType::VOUCHER;
}
$item = new Payone_Api_Request_Parameter_Invoicing_Item();
$item->init($params);
return $item;
}
示例5: mapAdjustmentPositiveAsItemByCreditmemo
/**
* @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 mapAdjustmentPositiveAsItemByCreditmemo(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$configMiscCreditmemo = $this->getConfigMisc()->getCreditmemo();
$sku = $configMiscCreditmemo->getAdjustmentRefundSku();
$name = $configMiscCreditmemo->getAdjustmentRefundName();
if (empty($sku)) {
$sku = $this->helper()->__(self::DEFAULT_ADJUSTMENT_POSITIVE_SKU);
}
if (empty($name)) {
$name = $this->helper()->__(self::DEFAULT_ADJUSTMENT_POSITIVE_SKU);
}
$params['it'] = Payone_Api_Enum_InvoicingItemType::VOUCHER;
$params['id'] = $sku;
$params['de'] = $name;
$params['no'] = 1;
$params['pr'] = $creditmemo->getAdjustmentPositive();
$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;
}