Jump to content

Help plz in invoice [factur]


guessous

Recommended Posts

It looks like a modification. How can we help if we cannot see the invoice code?

Thanks you for your help

ok this is invoice.tpl

<div style=" width:100%; height:100%; border-left:1px solid red;border-right:1px solid red;display: inline-table;">
<div style="font-size: 8pt; color: #444">

<table>
	<tr><td> </td></tr>
</table>

<!-- ADDRESSES -->
<table style="width: 100%">
	<tr>
		<td style="width:75%"></td>
		<td style="font-size: 8pt; color: #000;text-align:center;text-justify:inter-word;">
			{if !empty($delivery_address)}
				<table style="width: 100%">
					<tr>
						<td style="width: 50%">
						
							 {$delivery_address}
						</td>
						<td style="width: 50%">
							
							 {$invoice_address}
						</td>
					</tr>
				</table>
			{else}
				<table style="width: 100%">
					<tr>

						<td style="width: 50%">
							
							 {$invoice_address}
						</td>
						<td style="width: 50%">

						</td>
					</tr>
				</table>
			{/if}
		</td>
	</tr>
</table>
<!-- / ADDRESSES -->
<table style="border: 1px solid #000;width:200px;margin:0 0 0 5px;">
    <tr>
        <td style="font-size: 12pt; color: #4f4545;text-align:left;text-justify:inter-word;padding:5px 5px 0;">{$title|escape:'htmlall':'UTF-8'}</td>
    </tr>
    <tr>
        <td style="font-size: 8pt; color: #000;text-align:left;text-justify:inter-word;padding:5px 5px 0;">{l s='Order Number:' pdf='true'}  {$order->getUniqReference()}
        </td>
    </tr>
    <tr>
        <td style="font-size: 8pt; color: #000;text-align:left;text-justify:inter-word;padding:5px 5px 0;">{l s='Payed :' pdf='true'}	{dateFormat date=$order->date_add full=0}
        </td>
    </tr>
    <tr>
        <td></td>
    </tr>
</table>
<div style="line-height: 1pt"> </div>

<!-- PRODUCTS TAB -->
<table style="width: 100%">
	<tr>
		
		<td style="width: 100%; text-align: center" >
			<table style="width: 100%; font-size: 8pt;padding:5px;" border="1">
				<tr style="line-height:4px;">
					<td style="text-align: left; background-color: #b13034; color: #FFF; padding-left: 10px; font-weight: bold; width: 40%;">{l s='Product description' pdf='true'}</td>
					<td style="background-color: #b13034; color: #FFF; text-align: center; font-weight: bold; width: 10%;">{l s='Quantity' pdf='true'}</td>
                    <!-- unit price tax excluded is mandatory -->
					{if !$tax_excluded_display}
						<td style="background-color: #b13034; color: #FFF; text-align: center; font-weight: bold; width: 10%;">{l s='Unit Price' pdf='true'} <br />{l s='(Tax Excl.)' pdf='true'}</td>
					{/if}
					<td style="background-color: #b13034; color: #FFF; text-align: center; font-weight: bold; width: 15%;">
						{l s='Unit Price' pdf='true'}
						{if $tax_excluded_display}
							 {l s='(Tax Excl.)' pdf='true'}
						{else}
							 {l s='(Tax Incl.)' pdf='true'}
						{/if}
					</td>
                    <td style="background-color: #b13034; color: #FFF; text-align: center; font-weight: bold; width: 10%;">{l s='VAT Rate' pdf='true'}</td>
					<td style="background-color: #b13034; color: #FFF; text-align: center; font-weight: bold; width: 10%;">{l s='Discount' pdf='true'}</td>
					
					<td style="background-color: #b13034; color: #FFF; text-align: center; font-weight: bold; width: {if !$tax_excluded_display}5%{else}15%{/if};">
						{l s='Total' pdf='true'}
						{if $tax_excluded_display}
							{l s='(Tax Excl.)' pdf='true'}
						{else}
							{l s='(Tax Incl.)' pdf='true'}
						{/if}
					</td>
				</tr>
				<!-- PRODUCTS -->
				{foreach $order_details as $order_detail}
				{cycle values='#FFF,#DDD' assign=bgcolor}
				<tr style="line-height:6px;background-color:#f7f5f3;">
					<td style="text-align: left; width: 40%">{$order_detail.product_name}</td>
                    <td style="text-align: center; width: 10%">{$order_detail.product_quantity}</td>
					<!-- unit price tax excluded is mandatory -->
					{if !$tax_excluded_display}
						<td style="text-align: center; width: 10%">
						{displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_excl}
						</td>
					{/if}
					<td style="text-align: center; width: 15%">
					{if $tax_excluded_display}
						{displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_excl}
					{else}
						{displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_incl}
					{/if}
					</td>
                    <td style="text-align: center; width: 10%">20%
                    </td>
					<td style="text-align: center; width: 10%">
					{if (isset($order_detail.reduction_amount) && $order_detail.reduction_amount > 0)}
						-{displayPrice currency=$order->id_currency price=$order_detail.reduction_amount}
					{else if (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)}
						-{$order_detail.reduction_percent}%
					{else}
					0€
					{/if}
					</td>
					
					<td style="width: 15%; text-align: center;  width: {if !$tax_excluded_display}5%{else}15%{/if}">
					{if $tax_excluded_display}
						{displayPrice currency=$order->id_currency price=$order_detail.total_price_tax_excl}
					{else}
						{displayPrice currency=$order->id_currency price=$order_detail.total_price_tax_incl}
					{/if}
					</td>
				</tr>
					{foreach $order_detail.customizedDatas as $customizationPerAddress}
						{foreach $customizationPerAddress as $customizationId => $customization}
							<tr style="line-height:6px;background-color:#f7f5f3; ">
								<td style="line-height:3px; text-align: left; width: 60%; vertical-align: top">

										<blockquote>
											{if isset($customization.datas[$smarty.const._CUSTOMIZE_TEXTFIELD_]) && count($customization.datas[$smarty.const._CUSTOMIZE_TEXTFIELD_]) > 0}
												{foreach $customization.datas[$smarty.const._CUSTOMIZE_TEXTFIELD_] as $customization_infos}
													{$customization_infos.name}: {$customization_infos.value}
													{if !$smarty.foreach.custo_foreach.last}<br />
													{else}
													<div style="line-height:0.4pt"> </div>
													{/if}
												{/foreach}
											{/if}

											{if isset($customization.datas[$smarty.const._CUSTOMIZE_FILE_]) && count($customization.datas[$smarty.const._CUSTOMIZE_FILE_]) > 0}
												{count($customization.datas[$smarty.const._CUSTOMIZE_FILE_])} {l s='image(s)' pdf='true'}
											{/if}
										</blockquote>
								</td>
								<td style="text-align: center; width: 15%"></td>
								<td style="text-align: center; width: 10%; vertical-align: top">({$customization.quantity})</td>
								<td style="width: 15%; text-align: center;"></td>
							</tr>
						{/foreach}
					{/foreach}
				{/foreach}
				<!-- END PRODUCTS -->

				<!-- CART RULES -->
				{assign var="shipping_discount_tax_incl" value="0"}
				{foreach $cart_rules as $cart_rule}
					{if $cart_rule.free_shipping}
						{assign var="shipping_discount_tax_incl" value=$order_invoice->total_shipping_tax_incl}
					{/if}
					{cycle values='#FFF,#DDD' assign=bgcolor}
					<tr style="line-height:6px;background-color:{$bgcolor}" text-align="left">
						<td style="line-height:3px;text-align:left;width:60%;vertical-align:top" colspan="{if !$tax_excluded_display}5{else}4{/if}">{$cart_rule.name}</td>
						<td>
							{if $tax_excluded_display}
								- {$cart_rule.value_tax_excl}
							{else}
								- {$cart_rule.value}
							{/if}
						</td>
					</tr>
				{/foreach}
				<!-- END CART RULES -->
			</table>

			<table style="width: 100%;float:center" >
				{if (($order_invoice->total_paid_tax_incl - $order_invoice->total_paid_tax_excl) > 0)}
				<tr style="line-height:5px;">
                    <td style="width:60%"></td>
					<td border="1" style="width: 25%; text-align: center; font-weight: bold">{l s='Product Total (Tax Excl.)' pdf='true'}</td>
					<td border="1" style="width: 15%; text-align: center;">{displayPrice currency=$order->id_currency price=$order_invoice->total_products}</td>
				</tr>

			
				{else}
				<tr style="line-height:5px;">
					<td style="width:60%"></td>
					<td border="1" style="width: 25%; text-align: center; font-weight: bold">{l s='Total HT' pdf='true'}</td>
					<td border="1" style="width: 15%; text-align: center;">{displayPrice currency=$order->id_currency price=$order_invoice->total_products}</td>
				</tr>
				{/if}
                {if ($order_invoice->total_paid_tax_incl - $order_invoice->total_paid_tax_excl) > 0}
				<tr style="line-height:5px;">
					<td style="width:60%"></td>
					<td border="1" style="width: 25%;text-align: center; font-weight: bold">{l s='VAT 20%' pdf='true'}</td>
					<td border="1" style="width: 15%; text-align: center;">{displayPrice currency=$order->id_currency price=($order_invoice->total_paid_tax_incl - $order_invoice->total_paid_tax_excl)}</td>
				</tr>
				{/if}

				<tr style="line-height:5px;">
					<td style="width:60%"></td>
					<td border="1" style="width: 25%;text-align: center; font-weight: bold">{l s='Total amount payable including taxes' pdf='true'}</td>
					<td border="1" style="width: 15%; text-align: center;">{displayPrice currency=$order->id_currency price=$order_invoice->total_paid_tax_incl}</td>
				</tr>
				{if $order_invoice->total_discount_tax_incl > 0}
				<tr style="line-height:5px;">
					<td style="width:60%"></td>
					<td border="1" style="width: 25%;text-align: center; font-weight: bold">{l s='VAT 20%' pdf='true'}</td>
					<td border="1" style="width: 15%; text-align: center;">-{displayPrice currency=$order->id_currency price=($order_invoice->total_discount_tax_incl + $shipping_discount_tax_incl)}</td>
				</tr>
				{/if}

				{if $order_invoice->total_wrapping_tax_incl > 0}
				<tr style="line-height:5px;">
					<td style="width:60%"></td>
					<td border="1" style="width: 25%;text-align: center; font-weight: bold">{l s='Wrapping Cost' pdf='true'}</td>
					<td border="1" style="width: 15%; text-align: center;">
					{if $tax_excluded_display}
						{displayPrice currency=$order->id_currency price=$order_invoice->total_wrapping_tax_excl}
					{else}
						{displayPrice currency=$order->id_currency price=$order_invoice->total_wrapping_tax_incl}
					{/if}
					</td>
				</tr>
				{/if}

				{if $order_invoice->total_shipping_tax_incl > 0}
				<tr style="line-height:5px;">
					<td style="text-align: center; font-weight: bold">{l s='Shipping Cost' pdf='true'}</td>
					<td style="width: 15%; text-align: center;">
						{if $tax_excluded_display}
							{displayPrice currency=$order->id_currency price=$order_invoice->total_shipping_tax_excl}
							{else}
							{displayPrice currency=$order->id_currency price=$order_invoice->total_shipping_tax_incl}
						{/if}
					</td>
				</tr>
				{/if}

	
			
				
			</table>

		</td>
	</tr>
</table>
<!-- / PRODUCTS TAB -->

<div style="line-height: 1pt"> </div>



{if isset($order_invoice->note) && $order_invoice->note}
<div style="line-height: 1pt"> </div>
<table style="width: 100%">
	<tr>
		<td style="width: 15%"></td>
		<td style="width: 85%">{$order_invoice->note|nl2br}</td>
	</tr>
</table>
{/if}

{if isset($HOOK_DISPLAY_PDF)}
<div style="line-height: 1pt"> </div>
<table style="width: 100%">
	<tr>
		<td style="width: 15%"></td>
		<td style="width: 85%">{$HOOK_DISPLAY_PDF}</td>
	</tr>
</table>
{/if}

</div>
<div style="clear:both;"></div>
</div>

and yhis is footer.tpl

<div style=" width:100%; height:100%;border-left:1px solid red;border-right:1px solid red;border-bottom:1px solid red;">
<table>
	<tr>
		<td style="text-align: center; font-size: 6pt; color: #444">
            {if $available_in_your_account}
                {l s='An electronic version of this invoice is available in your account. To access it, log in to our website using your e-mail address and password (which you created when placing your first order).' pdf='true'}             
    			<br />
            {/if}
            {$shop_name|escape:'htmlall':'UTF-8'} <br />
			-1 Place Charles de Gaulle - 78180 Montigny le Bretonneux - France -
            <br />
           
			{if !empty($shop_phone) OR !empty($shop_fax)}
			
				{if !empty($shop_phone)}
					Tel: {$shop_phone|escape:'htmlall':'UTF-8'}
				{/if}

				{if !empty($shop_fax)}
					Fax: {$shop_fax|escape:'htmlall':'UTF-8'}
				{/if}
				<br />
			{/if}
            
            {if isset($shop_details)}
                {$shop_details|escape:'htmlall':'UTF-8'}<br />
            {/if}

            {if isset($free_text)}
    			{$free_text|escape:'htmlall':'UTF-8'}<br />
            {/if}
		</td>
	</tr>
</table>
</div>
Edited by guessous (see edit history)
Link to comment
Share on other sites

The top div from the invoice.tpl has not 100% height. Try to set background color for both invoice and footer divs to see their rectangles. I'm not sure if you can expect 100% height. You can also try to replace divs with tables or set borders on the body of the invoice.

 

Also look at

$this->SetFooterMargin(18);

in the /pdf/PDFGenerator.php file, writePage() function.

Link to comment
Share on other sites

The top div from the invoice.tpl has not 100% height. Try to set background color for both invoice and footer divs to see their rectangles. I'm not sure if you can expect 100% height. You can also try to replace divs with tables or set borders on the body of the invoice.

 

Also look at

$this->SetFooterMargin(18);

in the /pdf/PDFGenerator.php file, writePage() function.

I try change div by table but i hav this errore


Warning: Division by zero in /home/invsol/public_html/lingua-v4/tools/tcpdf/tcpdf.php on line 22977

Warning: array_fill() [function.array-fill]: Number of elements must be positive in /home/invsol/public_html/lingua-v4/tools/tcpdf/tcpdf.php on line 22979

Warning: Invalid argument supplied for foreach() in /home/invsol/public_html/lingua-v4/tools/tcpdf/tcpdf.php on line 24388

Warning: Invalid argument supplied for foreach() in /home/invsol/public_html/lingua-v4/tools/tcpdf/tcpdf.php on line 24420

Warning: Cannot modify header information - headers already sent by (output started at /home/invsol/public_html/lingua-v4/tools/tcpdf/tcpdf.php:22977) in /home/invsol/public_html/lingua-v4/tools/tcpdf/tcpdf.php on line 8961
TCPDF ERROR: Some data has already been output to browser, can't send PDF file
Link to comment
Share on other sites

I would try the body border but test an invoice on two pages as well.

you right man,

 

when we added too many products, we got en error in PDF it was generated empty without any products. But when we took off the code of border we got the products on two pages

 

Thank you 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...