VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: lostmail on April 02, 2020, 15:58:25 PM

Title: VirtueMart 3.6.11 10289 - invoice
Post by: lostmail on April 02, 2020, 15:58:25 PM
I installed the BETA release VirtueMart 3.6.11 10289 and when i print an invoice in admin backend i see that the calculation rule DBTaxRulesBill is now double in 2 lines.

I searched for DBTaxRulesBill in the files in VM and in Template/virtuemart but I can not find any where this line is double...

Any idea how to fix that ?
(I have no template modification - it`s a default VM System) - so i think it`s a bug somewhere..
Title: Re: VirtueMart 3.6.11 10289 - invoice
Post by: lostmail on April 02, 2020, 16:55:22 PM
I found that it must be located in the file com_virtuemart/views/invoice/tmpl/invoice_items.php:

Quote<?php
   if($discountsBill){
      foreach($discountsBill as $rule){ ?>
   <tr >
      <td colspan="6" style="text-align: right;" class="pricePad"><?php echo $rule->calc_rule_name ?> </td>
      <?php if ( VmConfig::get('show_tax')) { ?>
      <td style="text-align: right;">&nbsp;</td>
      <?php } ?>
      <td style="text-align: right;"><?php echo $this->currency->priceDisplay($rule->calc_amount, $this->user_currency_id); ?></td>
      <td style="text-align: right;"><?php echo $this->currency->priceDisplay($rule->calc_amount, $this->user_currency_id); ?></td>
   </tr>
         <?php
      }
   } ?>

   <?php
   foreach($this->orderDetails['calc_rules'] as $rule){
      if ($rule->calc_kind== 'DBTaxRulesBill') { ?>
            <tr>
                <td colspan="6"  style="text-align: right;" class="pricePad"><?php echo $rule->calc_rule_name ?> </td>
            <?php if ( VmConfig::get('show_tax')) { ?>
                    <td style="text-align: right;">&nbsp;</td>
            <?php } ?>
                <td style="text-align: right;"><?php echo  $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id);  ?> </td>
                <td style="text-align: right;"><?php echo  $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id);  ?> </td>
            </tr>
         <?php
      } elseif ($rule->calc_kind == 'taxRulesBill') { ?>
            <tr>
                <td colspan="6"  style="text-align: right;" class="pricePad"><?php echo $rule->calc_rule_name ?> </td>
            <?php if ( VmConfig::get('show_tax')) { ?>
                    <td style="text-align: right;"><?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id); ?> </td>
            <?php } ?>
                <td style="text-align: right;">&nbsp;</td>
                <td style="text-align: right;"><?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id); ?> </td>
            </tr>
         <?php
      } elseif ($rule->calc_kind == 'DATaxRulesBill') { ?>
            <tr>
                <td colspan="6" style="text-align: right;" class="pricePad"><?php echo $rule->calc_rule_name ?> </td>
            <?php if ( VmConfig::get('show_tax')) { ?>
                    <td style="text-align: right;">&nbsp;</td>
            <?php } ?>
                <td style="text-align: right;"><?php  echo   $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id);  ?> </td>
                <td style="text-align: right;"><?php echo $this->currency->priceDisplay($rule->calc_amount,$this->user_currency_id);  ?> </td>
            </tr>
         <?php
      }
   } ?>

This area makes that in printing an invoice the line for caluclation & rules is visible twice....
What`s going wrong here ?
Title: Re: VirtueMart 3.6.11 10289 - invoice
Post by: lostmail on April 04, 2020, 11:13:11 AM
I deleted this part :
Quote<?php
   if($discountsBill){
      foreach($discountsBill as $rule){ ?>
   <tr >
      <td colspan="6" style="text-align: right;" class="pricePad"><?php echo $rule->calc_rule_name ?> </td>
      <?php if ( VmConfig::get('show_tax')) { ?>
      <td style="text-align: right;">&nbsp;</td>
      <?php } ?>
      <td style="text-align: right;"><?php echo $this->currency->priceDisplay($rule->calc_amount, $this->user_currency_id); ?></td>
      <td style="text-align: right;"><?php echo $this->currency->priceDisplay($rule->calc_amount, $this->user_currency_id); ?></td>
   </tr>
         <?php
      }
   } ?>

Now it is not double anymore.

Title: Re: VirtueMart 3.6.11 10289 - invoice
Post by: lostmail on April 04, 2020, 11:15:03 AM
I recognised the tax in order confirmation is wrong calculated in the last line (it seems the tax for additional tax/rule -  DBTaxBill  - is not considered):

The red marked amount should also be 6,00 EUR like in the line before....don`t know why it is different here...??
Title: Re: VirtueMart 3.6.11 10289 - invoice
Post by: lostmail on April 04, 2020, 22:09:02 PM
Changed this line in invoice_items.php:

from:
Quote<td style="text-align: right;"><?php echo $this->currency->priceDisplay($rule->calc_amount, $this->user_currency_id); ?></td>

to:
Quote<td style="text-align: right;"><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_billTaxAmount, $this->user_currency_id); ?></td>

Don`t know if it is correct but it works for me.