Can one tweak one of the php files to include the originating quote number after converting a quote to an invoice.
Would be nice to have for cross-reference at the customer side.
Thanks
Stephane
Can one tweak one of the php files to include the originating quote number after converting a quote to an invoice.
Would be nice to have for cross-reference at the customer side.
Thanks
Stephane
Change the file /application/helpers/pdf_helper.php Line 41
from
$data = array(
'invoice' => $invoice,
'invoice_tax_rates' => $CI->mdl_invoice_tax_rates->where('invoice_id', $invoice_id)->get()->result(),
'items' => $CI->mdl_items->where('invoice_id', $invoice_id)->get()->result(),
'payment_method' => $payment_method,
'output_type' => 'pdf'
);
to
$CI->load->model('quotes/mdl_quotes');
$quote = $CI->mdl_quotes->where('ip_quotes.invoice_id', $invoice_id)->get()->result();
$data = array(
'invoice' => $invoice,
'invoice_tax_rates' => $CI->mdl_invoice_tax_rates->where('invoice_id', $invoice_id)->get()->result();
'quote' => (isset($quote[0]) ? $quote[0] : null),
'items' => $CI->mdl_items->where('invoice_id', $invoice_id)->get()->result(),
'payment_method' => $payment_method,
'output_type' => 'pdf'
);
and the quote number should be available via $quote->quote_number
I did the edit above in /application/helpers/pdf_helper.php
plus edited the application/views/invoice_templates/pdf/InvoicePlane.php as below but only get ‘:’ printed on the line with quote_number and no title nor value
<div class="invoice-details clearfix">
<table>
<tr>
<td><?php echo lang('quote_number') . ':'; ?></td>
<td><?php echo $quote->quote_number; ?></td>
</tr>
<tr>
<td><?php echo lang('invoice_date') . ':'; ?></td>
<td><?php echo date_from_mysql($invoice->invoice_date_created, true); ?></td>
</tr>
<tr>
<td><?php echo lang('due_date') . ': '; ?></td>
<td><?php echo date_from_mysql($invoice->invoice_date_due, true); ?></td>
</tr>
<tr>
<td><?php echo lang('amount_due') . ': '; ?></td>
<td><?php echo format_currency($invoice->invoice_balance); ?></td>
</tr>
<?php if ($payment_method): ?>
<tr>
<td><?php echo lang('payment_method') . ': '; ?></td>
<td><?php echo $payment_method->payment_method_name; ?></td>
</tr>
<?php endif; ?>
</table>
</div>
what did I mis?
THX
Are you sure that this particular invoice was created from a quote?
You should also wrap the quote number part info a conditional statement for cases where there was no relation saved.
You are right, I am one step further now and only miss the title on the left of ":"
I figured the code <td><?php echo lang('quote_number') . ':'; ?></td>
from the surrounding but have no clue if this is valid, can you help me for that one please?
<main>
<div class="invoice-details clearfix">
<table>
if (isset($quote->quote_number)) {
<tr>
<td><?php echo lang('quote_number') . ':'; ?></td>
<td><?php echo $quote->quote_number; ?></td>
</tr>
}
<tr>
<td><?php echo lang('invoice_date') . ':'; ?></td>
<td><?php echo date_from_mysql($invoice->invoice_date_created, true); ?></td>
</tr>
Thanks
S
PS figured it out from the pdf template for quotes, it should be ‘quote’ and not ‘quote_number’
<td><?php echo lang('quote') . ':'; ?></td>
Only thing left, my testing does not rule and Quote : is always shown even when no quote_number is added, I did not formulate my test correctly.
What should I replace if (isset($quote->quote_number)) {
with to account for invoices not derived from quotes ?
I start to like this too much
It should look like this:
<table>
<?php if (isset($quote->quote_number)) {?>
<tr>
<td><?php echo lang('quote') . ':'; ?></td>
<td><?php echo $quote->quote_number; ?></td>
</tr>
<?php } ?>
<tr>
your php syntax correction made the difference.
Thanks a LOT for that ‘K’, I will NEED to learn PHP at some point .
Best
This topic was automatically closed after 24 hours. New replies are no longer allowed.