CountTaxes
float CSaleOrderTax::CountTaxes( float Price, array &arTaxList, string DefCurrency );
The method CountTaxes calculates the total amount of specified taxes applied to a product with the specified price.
Parameters
Parameter | Description |
---|---|
Price | The product total value. |
arTaxList | Array of taxes in the form of array of associated arrays:
array("APPLY_ORDER"=>application_order, "VALUE"=>tax_rate_percentage, "IS_IN_PRICE"=>"included_in_price(Y/N)") |
DefCurrency | Default order currency. |
Returned values
Returns the total amount of taxes applied to a product. Upon return, the arTaxList contains a new key TAX_VAL containing the absolute amount of this tax applied.
Example
<? // Create an array of active taxes for the current site, // payer type 2 and location 48 $arTaxList = array(); $arTaxFilter = array( "LID" => SITE_ID, "PERSON_TYPE_ID" => 2, "ACTIVE" => "Y", "LOCATION" => 48 ); $db_tax_rate_tmp = CSaleTaxRate::GetList(array("APPLY_ORDER"=>"ASC"), $arTaxFilter); while ($ar_tax_rate_tmp = $db_tax_rate_tmp->Fetch()) { $arTaxList[] = $ar_tax_rate_tmp; } // Calculate the amount of all taxes for a product at the cost of 38.95 $TAX_PRICE_tmp = CSaleOrderTax::CountTaxes(38.95, $arTaxList, "USD"); echo "Total tax: ".$TAX_PRICE_tmp."<br>"; echo "including: "; for ($i = 0; $i<count($arTaxList); $i++) { echo $arTaxList[$di]["NAME"]." - ".$arTaxList[$di]["TAX_VAL"]."<br>"; } ?>
© «Bitrix24», 2001-2024