How do I know the discount rate? Hi I wont to know about how can I use discount rate ?

$report_query = db_select('commerce_order','co');
$report_query-&gt;fields('co');
$report_query-&gt;orderBy('co.created','ASC');
$report_res = $report_query-&gt;execute();
while ($re = $report_res-&gt;fetchObject()) {
    $o_id = $re-&gt;order_id;
    $o_load = commerce_order_load($o_id);
    echo "&lt;pre&gt;";print_r($o_load);
}


Output: 

[1] =&gt; Array(
[name] =&gt; tax|vat_cst
[price] =&gt; Array(
        [amount] =&gt; 27556
        [currency_code] =&gt; INR
        [data] =&gt; Array(
                [tax_rate] =&gt; Array(                    
                        [name] =&gt; vat_cst
                        [display_title] =&gt; VAT/CST
                        [description] =&gt; VAT
                        [rate] =&gt; 0.125 // here display tax rate
                        [type] =&gt; vat
                        [rules_component] =&gt; commerce_tax_rate_vat_cst
                        [default_rules_component] =&gt; 1
                        [price_component] =&gt; tax|vat_cst
                        [calculation_callback] =&gt; commerce_tax_rate_calculate
                        [module] =&gt; commerce_tax_ui
                        [title] =&gt; VAT/CST
                        [admin_list] =&gt; 1
                    )
            )
    )
[included] =&gt; 1
) 

[2] =&gt; Array(
   [name] =&gt; discount-20% Off
   [price] =&gt; Array(
        [amount] =&gt; -49600
        [currency_code] =&gt; INR
        [data] =&gt; Array(                                           
          [discount_name] =&gt; discount_full_discount_20_
          [discount_component_title] =&gt; 20% Off
        )
   )
   [included] =&gt; 1
)


In vat_cst the rate is 0.125 but,how can I know which rate is used on total order?
The discount rate isn't always available as a percentage (like, for instance, taxes are) because discounts can be whole numbers as well. Regardless, you can ultimately get information about how a price is calculated by looking at the commerce_order_total field on an order or the commerce_total field on a line_item.

Here's an example:



In this screen shot, we'll take a look at 4 items. For the comments assume $price = $order-&gt;commerce_order_total[LANGUAGE_NONE][0].


$price['data']['components'][0]['price']['amount'] is the original amount. You know this because $price['data']['components'][0]['price']['amount'] is "base_price".
A discount price component will a name of "discount|DISCOUNT_ID" where DISCOUNT_ID is the machine name of the discount that is being referenced.
$price['data']['components'][1]['price']['amount'] in this instance is the discount that is applied.
$price['amount'] is the combination of all of the components under $price['data']['components'].


There is a data array under the price information on the discount. It contains the label and the machine name of the discount, but it doesn't have any other information. Custom discounts might put more information on there, but you can't necessarily depend on anything else being there.