News:

Looking for documentation? Take a look on our wiki

Main Menu

VirtueMart 3.6.11 10289 - invoice

Started by lostmail, April 02, 2020, 15:58:25 PM

Previous topic - Next topic

lostmail

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..
Joomla 3.x | VirtueMart 4.0.12 107771 | HORME3 PRO 1.9.6 / 2.0
VirtueMart 4.2.4 | Joomla 4.4.1 | PHP 8.1 | Vp_neoteric 1.3

lostmail

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 ?
Joomla 3.x | VirtueMart 4.0.12 107771 | HORME3 PRO 1.9.6 / 2.0
VirtueMart 4.2.4 | Joomla 4.4.1 | PHP 8.1 | Vp_neoteric 1.3

lostmail

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.

Joomla 3.x | VirtueMart 4.0.12 107771 | HORME3 PRO 1.9.6 / 2.0
VirtueMart 4.2.4 | Joomla 4.4.1 | PHP 8.1 | Vp_neoteric 1.3

lostmail

#3
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...??
Joomla 3.x | VirtueMart 4.0.12 107771 | HORME3 PRO 1.9.6 / 2.0
VirtueMart 4.2.4 | Joomla 4.4.1 | PHP 8.1 | Vp_neoteric 1.3

lostmail

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.

Joomla 3.x | VirtueMart 4.0.12 107771 | HORME3 PRO 1.9.6 / 2.0
VirtueMart 4.2.4 | Joomla 4.4.1 | PHP 8.1 | Vp_neoteric 1.3