0
我正在與Magento合作,我需要獲得當前國家(法國)的增值稅稅率。我只知道不含稅價格的信息,有時僅含稅價格的信息,但從來都不是。你能給我解決方案嗎?謝謝如何在沒有訂單對象或產品的情況下獲得Magento的增值稅稅率
PS:請原諒我蹩腳的英語
對於GET稅率由產品:
<?php
//$_product = our product object
$store = Mage::app()->getStore('default');
$request = Mage::getSingleton('tax/calculation')->getRateRequest(null, null, null, $store);
$taxclassid = $product->getData('tax_class_id')
$percent = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxclassid));
?>
我創建了一段代碼,以獲得通過訂單對象這樣的速度:
/**
* Get Tax Values By Order
*
* @param Mage_Sales_Orders_Model $order
* @param float $amount [montant à traiter]
* @param bool $include_tax [indique si $amount contient les taxes]
*
* @return array $result [tax_ratio, tax_percent , tax_amount, ttc_amount, ht_amount]
*/
public function getTaxValuesByOrder($order,$amount,$include_tax = false){
//On traite le montant passé en paramètre
$amount = round(floatval($amount),3);
//On calcule le pourcentage de la taxe
$tax_info = $order->getFullTaxInfo();
$tax_percent = round(floatval($tax_info[0]['percent']),2);
$tax_coeff =100/(100 + $tax_percent);
if($include_tax){
$ttc_amount = $amount;
$ht_amount = $ttc_amount * $tax_coeff;
$tax_amount = $ttc_amount - $ht_amount;
}
else{
$ht_amount = $amount;
$tax_amount = $ht_amount * $tax_percent/100;
$tcc_amount = $ht_amount + $tax_amount;
}
return array(
'tax_ratio' => $tax_coeff,
'tax_percent' => $tax_percent,
'tax_amount' => $tax_amount,
'ttc_amount' => $ttc_amount,
'ht_amount' => $ht_amount
);
}
它向我返回一個包含轉換比率,稅率,稅額,免稅金額和最終稅額的數組
你想看哪個部分?我在談論稅務助理,所以我不知道你會怎麼看待... –