Skip to main content

Customization Bill

More
12 years 5 months ago #151639 by Antonioseo
-- url of the page with the problem -- : latiendaelectronica.es
-- HikaShop version -- : 2.3.0 (business)
-- Joomla version -- : 3.2.2
-- PHP version -- : x.x.x
-- Browser(s) name and version -- : Firefox 27.0.x

Hi
I would like customize bill generate by hikashop
where i can change and customize this bill as I attach, to show total price without VAT.
I would like show a row with price without VAT
Thanks
Best regards

Please Log in or Create an account to join the conversation.

More
12 years 5 months ago #151666 by Xavier
Replied by Xavier on topic Customization Bill
Hi,

At which place exactly you want to remove that ?
The order views are "order / show" in frontend template, "order / form" and "order / invoice" in backend template, this can be edited through the menu Display > Views.

If you use the PDF invoice plugin, so the modification needs to be made in the file "plugins/hikashop/attachinvoice/attachinvoice/invoice.php".

It require some PHP and HTML knowledges.
Here is some documentation about how to customize the layout:
hikashop.com/support/support/documentati...ize-the-display.html

Please Log in or Create an account to join the conversation.

More
12 years 5 months ago - 12 years 5 months ago #151859 by Antonioseo
Replied by Antonioseo on topic Customization Bill
Hello,
Sorry if I have not explained exactly the problem I have found.
In the invoice appears the following fields:

SUBTOTAL
SHIPPING
TAXES
TOTAL

SUBTOTAL => It has to be the price of the addition of all the items WITHOUT TAXES
SHIPPING => It has to be the shipping costs WITHOUT TAXES
TAXES => the taxes of the addition of SHIPPING and SUBTOTAL field (THIS IS CORRECT IN THE GENERATED INVOICE)
TOTAL => the addition of the subtotal+shipping+taxes (THIS IS ALSO CORRECT IN THE GENERATED INVOICE)

So, the only problem I have it is that the price which appears in SUBTOTAL and in SHIPPING have the taxes included on them, but they have to appear WITHOUT THE TAXES for European Invoices.

I need you to change or to tell me how to change the variables call in this fields in order to solve the problem. Hikashop has these data becuase the taxes and the total it is well calculated.

Thanks
Best regards
Last edit: 12 years 5 months ago by Antonioseo.

Please Log in or Create an account to join the conversation.

More
12 years 5 months ago #151904 by nicolas
Replied by nicolas on topic Customization Bill
Hi,

You need to edit the file "invoice" via the menu Display->Views for your backend template and change the line:
echo $this->currencyHelper->format($this->order->order_shipping_price,$this->order->order_currency_id);
to:
echo $this->currencyHelper->format($this->order->order_shipping_price-@$this->order->order_shipping_tax,$this->order->order_currency_id);

and the line:
echo $this->currencyHelper->format($this->order->order_subtotal,$this->order->order_currency_id);
to:
echo $this->currencyHelper->format($this->order->order_subtotal_no_vat,$this->order->order_currency_id);

Please Log in or Create an account to join the conversation.

More
12 years 5 months ago - 12 years 5 months ago #151943 by Antonioseo
Replied by Antonioseo on topic Customization Bill
Thank you for your help.
The problem we had it has been solved, furthermore, we have corrected other problem related with the unit product price, and now everything works as a charm.

The problem we have now it is we need the invoice with the following order (in order to accomplish the Spanish and European invoice law).

Price of “product 1” WITHOUT TAXES.
Price of “product 2” WITHOUT TAXES.
........product 3 .....
Shipping costs WITHOUT TAXES
Additional charges (as paypal comissions, etc.) WITHOUT TAXES

SUBTOTAL (the addition of all the fields) WITHOUT TAXES
TAXES (taxes of the subtotal without taxes,).
TOTAL

(see attached file)

It is attached the php file including your suggestions and including, also, the changes we have done (related with the unit price).


Could you adapt this php file in order to accomplish the Spanish and European fiscal lawas generating the invoices as we described ? We are sure it will be usefull for other European and Spanish customers. It will solve the problems some people has asked about in the forum (German and Italian people):


www.hikashop.com/forum/payment-methods/8...-methods.html#149433



Thank you very much for your attention.
Last edit: 12 years 5 months ago by Antonioseo.

Please Log in or Create an account to join the conversation.

More
12 years 5 months ago #152059 by Xavier
Replied by Xavier on topic Customization Bill
Hi,

I have not tried this code, but that should do the job:
Code:
<?php /** * @package HikaShop for Joomla! * @version 2.3.0 * @author hikashop.com * @copyright (C) 2010-2014 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?><div id="hikashop_invoice_main_div"> <div id="print" style="float:right"> <a href="#" onclick="document.getElementById('print').style.visibility='hidden';window.focus();window.print();return false;"> <img src="<?php echo HIKASHOP_IMAGES; ?>print.png"/> </a> </div> <br/> <table width="100%"> <tr> <td> <h1 style="text-align:center"> <?php if($this->invoice_type=='full'){ echo JText::_('INVOICE'); }else{ echo JText::_('SHIPPING_INVOICE'); } ?> </h1> <br/> <br/> </td> </tr> <tr> <td> <div style="float:right;width:100px;padding-top:20px"> <?php echo JText::_('DATE').': '.hikashop_getDate($this->element->order_created,'%d %B %Y ');?><br/> <?php if(!empty($this->element->order_invoice_number)) { echo JText::_('INVOICE').': '.$this->element->order_invoice_number; } else { echo JText::_('INVOICE').': '.@$this->element->order_number; } ?> </div> <p> <?php echo $this->store_address;?> </p> </td> </tr> <tr> <td> <br/> <br/> <table width="100%"> <tr> <?php if($this->invoice_type=='full' && !empty($this->element->billing_address)){?> <td> <fieldset class="adminform" id="htmlfieldset_billing"> <legend style="background-color: #FFFFFF;"><?php echo JText::_('HIKASHOP_BILLING_ADDRESS'); ?></legend> <?php $this->setLayout('address_template'); $html = $this->loadTemplate(); foreach($this->element->fields as $field){ $fieldname = $field->field_namekey; if(!empty($this->element->billing_address->$fieldname)) $html=str_replace('{'.$fieldname.'}',$this->fieldsClass->show($field,$this->element->billing_address->$fieldname),$html); } echo str_replace("\n","<br/>\n",trim(str_replace("\n\n","\n",preg_replace('#{(?:(?!}).)*}#i','',$html)),"\n")); ?> </fieldset> </td> <?php }?> <td> <?php if(!empty($this->element->order_shipping_id) && !empty($this->element->shipping_address)){ ?> <fieldset class="adminform" id="htmlfieldset_shipping"> <legend style="background-color: #FFFFFF;"><?php echo JText::_('HIKASHOP_SHIPPING_ADDRESS'); ?></legend> <?php if(empty($this->element->override_shipping_address)) { $this->setLayout('address_template'); $html = $this->loadTemplate(); foreach($this->element->fields as $field){ $fieldname = $field->field_namekey; if(!empty($this->element->shipping_address->$fieldname)) $html=str_replace('{'.$fieldname.'}',$this->fieldsClass->show($field,$this->element->shipping_address->$fieldname),$html); } echo str_replace("\n","<br/>\n",trim(str_replace("\n\n","\n",preg_replace('#{(?:(?!}).)*}#i','',$html)),"\n")); } else { echo $this->element->override_shipping_address; } ?> </fieldset> <?php } ?> </td> </tr> </table> </td> </tr> <tr> <td> <br/> <fieldset class="adminform" id="htmlfieldset_products"> <legend style="background-color: #FFFFFF;"><?php echo JText::_('PRODUCT_LIST'); ?></legend> <table class="adminlist table table-striped" cellpadding="1" width="100%"> <?php $colspan = 2; ?> <thead> <tr> <th class="title" width="60%"> <?php echo JText::_('PRODUCT'); ?> </th> <?php if ($this->config->get('show_code')) { $colspan++; ?> <th class="title" ><?php echo JText::_('CART_PRODUCT_CODE'); ?></th> <?php } ?> <?php if($this->invoice_type=='full'){?> <th class="title"> <?php echo JText::_('UNIT_PRICE'); ?> </th> <?php } ?> <th class="title titletoggle"> <?php echo JText::_('PRODUCT_QUANTITY'); ?> </th> <?php if($this->invoice_type=='full'){?> <th class="title titletoggle"> <?php echo JText::_('PRICE'); ?> </th> <?php } ?> </tr> </thead> <tbody> <?php $k=0; $group = $this->config->get('group_options',0); foreach($this->order->products as $product){ if($group && $product->order_product_option_parent_id) continue; ?> <tr class="row<?php echo $k;?>"> <td> <?php echo $product->order_product_name;?> <p class="hikashop_order_product_custom_item_fields"> <?php if($group){ $display_item_price=false; foreach($this->order->products as $j => $optionElement){ if($optionElement->order_product_option_parent_id != $product->order_product_id) continue; if($optionElement->order_product_price>0){ $display_item_price = true; } } if($display_item_price){ if($this->config->get('price_with_tax')){ echo ' '.$this->currencyHelper->format($product->order_product_price+$product->order_product_tax,$this->order->order_currency_id); }else{ echo ' '.$this->currencyHelper->format($product->order_product_price,$this->order->order_currency_id); } } } if(hikashop_level(2) && !empty($this->fields['item'])){ foreach($this->fields['item'] as $field){ $namekey = $field->field_namekey; if(empty($product->$namekey) && !strlen($product->$namekey)){ continue; } echo '<p class="hikashop_order_item_'.$namekey.'">'.$this->fieldsClass->getFieldName($field).': '.$this->fieldsClass->show($field,$product->$namekey).'</p>'; } } if($group){ foreach($this->order->products as $j => $optionElement){ if($optionElement->order_product_option_parent_id != $product->order_product_id) continue; $product->order_product_price +=$optionElement->order_product_price; $product->order_product_tax +=$optionElement->order_product_tax; $product->order_product_total_price+=$optionElement->order_product_total_price; $product->order_product_total_price_no_vat+=$optionElement->order_product_total_price_no_vat; ?> <p class="hikashop_order_option_name"> <?php echo $optionElement->order_product_name; if($optionElement->order_product_price>0){ if($this->config->get('price_with_tax')){ echo ' ( + '.$this->currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$this->order->order_currency_id).' )'; }else{ echo ' ( + '.$this->currencyHelper->format($optionElement->order_product_price,$this->order->order_currency_id).' )'; } } ?> </p> <?php } } ?> </p> </td> <?php if ($this->config->get('show_code')) { ?> <td><p class="hikashop_product_code_invoice"><?php echo $product->order_product_code; ?></p></td> <?php } ?> <?php if($this->invoice_type=='full'){?> <td> <?php if($this->config->get('price_with_tax')){ echo $this->currencyHelper->format($product->order_product_price+$product_no_vat->order_product_tax,$this->order->order_currency_id); }else{ echo $this->currencyHelper->format($product->order_product_price,$this->order->order_currency_id); } ?> </td> <?php } ?> <td align="center"> <?php echo $product->order_product_quantity;?> </td> <?php if($this->invoice_type=='full'){?> <td> <?php if($this->config->get('price_with_tax')){ echo $this->currencyHelper->format($product->order_product_total_price_no_vat,$this->order->order_currency_id); }else{ echo $this->currencyHelper->format($product->order_product_total_price_no_vat,$this->order->order_currency_id); } ?> </td> <?php } ?> </tr> <?php $k=1-$k; } ?> <?php if($this->invoice_type=='full'){?> <tr> <td style="border-top:2px solid #B8B8B8;" colspan="<?php echo $colspan; ?>"> </td> <td style="border-top:2px solid #B8B8B8;" class="key"> <label> <?php echo JText::_( 'SUBTOTAL' ); ?> </label> </td> <td style="border-top:2px solid #B8B8B8;"> <?php if($this->config->get('price_with_tax')){ echo $this->currencyHelper->format($this->order->order_subtotal_no_vat,$this->order->order_currency_id); }else{ echo $this->currencyHelper->format($this->order->order_subtotal_no_vat,$this->order->order_currency_id); } ?> </td> </tr> <?php if($this->order->order_discount_price != 0){ ?> <tr> <td colspan="<?php echo $colspan; ?>"> </td> <td class="key"> <label> <?php echo JText::_( 'HIKASHOP_COUPON' ); ?> </label> </td> <td> <?php if($this->config->get('price_with_tax')){ echo $this->currencyHelper->format($this->order->order_discount_price*-1.0,$this->order->order_currency_id); }else{ echo $this->currencyHelper->format(($this->order->order_discount_price-@$this->order->order_discount_tax)*-1.0,$this->order->order_currency_id); } ?> </td> </tr> <?php } if(!empty($this->order->additional)) { $exclude_additionnal = explode(',', $this->config->get('order_additional_hide', '')); foreach($this->order->additional as $additional) { if(in_array($additional->order_product_name, $exclude_additionnal)) continue; ?> <tr> <td colspan="<?php echo $colspan; ?>"> </td> <td class="hikashop_order_additionall_title key"> <label><?php echo JText::_($additional->order_product_name); ?></label> </td> <td ><?php if(!empty($additional->order_product_price)) { $additional->order_product_price = (float)$additional->order_product_price; } if(!empty($additional->order_product_price) || empty($additional->order_product_options)) { echo $this->currencyHelper->format($additional->order_product_price, $this->order->order_currency_id); } else { echo $additional->order_product_options; } ?></td> </tr> <?php } } if($this->order->order_shipping_price!=0 || ($this->config->get('price_with_tax') && $this->order->order_shipping_tax!=0)) { ?> <tr> <td colspan="<?php echo $colspan; ?>"> </td> <td class="key"> <label> <?php echo JText::_( 'SHIPPING' ); ?> </label> </td> <td> <?php if($this->config->get('price_with_tax')){ echo $this->currencyHelper->format($this->order->order_shipping_price-@$this->order->order_shipping_tax,$this->order->order_currency_id); }else{ echo $this->currencyHelper->format($this->order->order_shipping_price-@$this->order->order_shipping_tax,$this->order->order_currency_id); } ?> </td> </tr> <?php } if($this->order->order_payment_price!=0){ ?> <tr> <td colspan="<?php echo $colspan; ?>"> </td> <td class="key"> <label> <?php echo JText::_( 'HIKASHOP_PAYMENT' ); ?> </label> </td> <td> <?php echo $this->currencyHelper->format($this->order->order_payment_price,$this->order->order_currency_id); ?> </td> </tr> <tr> <td colspan="<?php echo $colspan; ?>"> </td> <td class="key"> <label> <?php echo JText::_( 'HIKASHOP_TOTAL_NO_TAX' ); ?> </label> </td> <td> <?php $total_no_vat = (float)$this->order->order_full_price - (float)$taxes; echo $this->currencyHelper->format($total_no_vat,$this->order->order_currency_id); ?> </td> </tr> <?php } $taxes = $this->order->order_subtotal-$this->order->order_subtotal_no_vat+$this->order->order_shipping_tax-$this->order->order_discount_tax; if($taxes != 0){ if($this->config->get('detailed_tax_display') && !empty($this->order->order_tax_info)){ foreach($this->order->order_tax_info as $tax){ ?> <tr> <td colspan="<?php echo $colspan; ?>"> </td> <td class="hikashop_order_tax_title key"> <label> <?php echo $tax->tax_namekey; ?> </label> </td> <td class="hikashop_order_tax_value"> <?php echo $this->currencyHelper->format($tax->tax_amount,$this->order->order_currency_id); ?> </td> </tr> <?php } }else{ ?> <tr> <td colspan="<?php echo $colspan; ?>"> </td> <td class="hikashop_order_tax_title key"> <label> <?php echo JText::_( 'VAT' ); ?> </label> </td> <td class="hikashop_order_tax_value"> <?php echo $this->currencyHelper->format($taxes,$this->order->order_currency_id); ?> </td> </tr> <?php } } ?> <tr> <td colspan="<?php echo $colspan; ?>"> </td> <td class="key"> <label> <?php echo JText::_( 'HIKASHOP_TOTAL' ); ?> </label> </td> <td> <?php echo $this->currencyHelper->format($this->order->order_full_price,$this->order->order_currency_id); ?> </td> </tr> <?php } ?> </tbody> </table> </fieldset> </td> </tr> <?php if($this->invoice_type=='full'){ $fieldsClass = hikashop_get('class.field'); $fields = $fieldsClass->getFields('backend',$this->order,'order'); if(!empty($fields)){ ?> <tr> <td> <fieldset class="hikashop_order_custom_fields_fieldset"> <legend><?php echo JText::_('ADDITIONAL_INFORMATION'); ?></legend> <table class="hikashop_order_custom_fields_table adminlist" cellpadding="1" width="100%"> <?php foreach($fields as $fieldName => $oneExtraField) { ?> <tr class="hikashop_order_custom_field_<?php echo $fieldName;?>_line"> <td class="key"> <?php echo $this->fieldsClass->getFieldName($oneExtraField);?> </td> <td> <?php echo $this->fieldsClass->show($oneExtraField,@$this->order->$fieldName); ?> </td> </tr> <?php }?> </table> </fieldset> </td> </tr> <?php } ?> <tr> <td> <?php if(!empty($this->shipping)){ echo JText::_('HIKASHOP_SHIPPING_METHOD').' : '.$this->shipping->getName($this->order->order_shipping_method,$this->order->order_shipping_id).'<br/>'; }?> <?php if(!empty($this->payment)){ echo JText::_('HIKASHOP_PAYMENT_METHOD').' : '.$this->payment->getName($this->order->order_payment_method,$this->order->order_payment_id); }?> </td> </tr> <?php } ?> <?php JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onAfterOrderProductsListingDisplay', array(&$this->order, 'order_back_invoice')); ?> <tr> <td> </td> </tr> </table> </div> <div style="page-break-after:always"></div>

Please Log in or Create an account to join the conversation.

More
12 years 5 months ago #152125 by Antonioseo
Replied by Antonioseo on topic Customization Bill
Now is cuasi-perfect
Only there is little error:
As you can see in attached file, HIKASHOP_TOTAL_NO_TAX has the same value than TOTAL

so, HIKASHOP_TOTAL_NO_TAX is total with tax but its value has to be total without tax

Thanks for you support
Best regards

Please Log in or Create an account to join the conversation.

More
12 years 5 months ago #152286 by Jerome
Replied by Jerome on topic Customization Bill
Hi,

In the previous code, please replace
Code:
$total_no_vat = (float)$this->order->order_full_price - (float)$taxes;
By:
Code:
$taxes = $this->order->order_subtotal-$this->order->order_subtotal_no_vat+$this->order->order_shipping_tax-$this->order->order_discount_tax; $total_no_vat = (float)$this->order->order_full_price - (float)$taxes;
So it will re-process the taxes value to process correctly the total without taxes.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

More
12 years 5 months ago #153058 by Antonioseo
Replied by Antonioseo on topic Customization Bill
Perfect
Now it works properly, and now is correct to use for spanish law invoice and maybe in all EU

I attach the correct "invoice.php" maybe in the future you need it

Thanks again
The following user(s) said Thank You: Xavier

Please Log in or Create an account to join the conversation.

Time to create page: 0.315 seconds
Powered by Kunena Forum