Page Break problem in invoice template

  • Posts: 61
  • Thank you received: 5
4 years 3 months ago #327141



Hi

How can i prevent strage page breaks at my invoices? See example attached. It happen when the item table is very long.

Many thx
Nadine

Attachments:

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
4 years 3 months ago #327144

Hi,

This depends on how your browser handle the printing of big tables.
Here is a page which talks about this issue:
stackoverflow.com/questions/1763639/how-...g-a-large-html-table
You can try adding CSS to the table element of the invoice. You could do that by directly adding the CSS in the order / invoice.php view file via the menu Display>Views

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

  • Posts: 61
  • Thank you received: 5
4 years 3 months ago #327180

Thank you for the post.

Which solution i should use and place it where?

THX

Attachments:

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

  • Posts: 4816
  • Thank you received: 654
  • MODERATOR
4 years 3 months ago #327181

Hello,

The easiest to set up would be to add some css, via a <style></style> with the required Css command at the beginning of your view/file.
For have a good css command you must define a good selector with targeted html class.
From this, process some test to see which css command & value will fit your need will be easy and quick.

Hope this will help you to fix your display issue.
Regards

Last edit: 4 years 3 months ago by Philip.

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

  • Posts: 61
  • Thank you received: 5
4 years 3 months ago #327283

Mhh...

I cant figure it out sorry ::ohmy::

This is not working. Its the wrong placementt?

.--

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.6.4
 * @author	hikashop.com
 * @copyright	(C) 2010-2016 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
 */
/**
 * @package	HikaShop for Joomla!
 * @version	2.6.4
 * @author	hikashop.com
 * @copyright	(C) 2010-2016 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikashop_invoice_main_div avoidBreak">
  <script>
    function Print(){
    $(".tableToPrint td, .tableToPrint th").each(function(){ $(this).css("width",  $(this).width() + "px")  });
    $(".tableToPrint tr").wrap("<div class='avoidBreak'></div>");
    window.print();
}</script>
  <style type="text/css">
  .avoidBreak { 
    border: 2px solid;
    page-break-inside:avoid;
}
</style>
	<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>
	<table class="avoidBreak" width="100%">
		<tr>
			<td>
				<h1 style="text-align:center; font-size:14px;">
				<?php
				if($this->invoice_type=='full'){
					echo JText::_('INVOICE');
					if ($this->order->zbedingung!="Rechnung") {
							echo "-".$this->order->zbedingung;
					}

				}else{
					echo JText::_('SHIPPING_INVOICE');
				}
				?>
				</h1>

....

...

Last edit: 4 years 3 months ago by nicolas.

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
4 years 3 months ago #327285

Hi,

Well, I can't say. We would have to do testing.
However, the script tag is placed well.
Did you try the first recommendation on that page ?

<style type="text/css">
    table { page-break-inside:auto }
    tr    { page-break-inside:avoid; page-break-after:auto }
    thead { display:table-header-group }
    tfoot { display:table-footer-group }
</style>

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

  • Posts: 61
  • Thank you received: 5
4 years 3 months ago #327328

Still the same

Attachments:

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

  • Posts: 61
  • Thank you received: 5
4 years 3 months ago #327380

Can in solve this problem with this plugin?
www.hikainvoices.com/

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
4 years 3 months ago #327388

Hi,

Well, HikaInvoice has its own invoice generator. So it might indeed work better.
However, we're not the developers of that extension and are not affiliated with them.
One simpler and cheaper alternative would be this plugin:
www.hikashop.com/marketplace/product/18-plugin-pdf.html

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

  • Posts: 61
  • Thank you received: 5
4 years 3 months ago #327430

Hi

Yes your Plugin is a solution. I already customized the layout.
But at one point i still need your advice.

I need to show the Total Price without Tax at the invoice. At the moment i get only the Subtotal without Tax.

Attachments:

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
4 years 3 months ago #327434

Hi,

That value is not already calculated.
However, you have the total with taxes in $order->order_full_price and the taxes amount in $taxes
So you can use such code:

<tr class="total_without_taxes">
			<td colspan="3" class="newarea">
				Total without taxes
			</td>
			<td  class="price" >
				<?php echo $currencyHelper->format($order->order_full_price-$taxes,$order->order_currency_id); ?>
			</td>
		</tr>

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

  • Posts: 61
  • Thank you received: 5
4 years 3 months ago #327454

Hi

Thank you for your code, but this one get only the total amount incl. tax

I need to show the net total price (Items + shipping)



Sorry :)

Attachments:

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
4 years 3 months ago #327492

Hi,

lol. You placed my code 2 lines before the line where the $taxes variable is generated :)
Because of that the $taxes used in the code I gave is understood as 0 and thus you get the price with taxes.
So no, the code I gave is correct, but you need to move it somewhere after the line calculating $taxes (line 278 on your screenshot).

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

  • Posts: 61
  • Thank you received: 5
4 years 3 months ago #327497

You made my day. Now it's fine.

And i was wondering why this code is not working :o) sorry *hihi*

It's solved. THANK YOU!!!!

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

Time to create page: 0.109 seconds
Powered by Kunena Forum