InvoicePlane : List Payment Transaction on Invoice
<p>I have installed <a href="https://invoiceplane.com/" rel="nofollow">InvoicePlane</a> v1.4.6 on my Shared Hosting Account.
Able to perform regular tasks like, making Quotes and convert them to Invoice and almost all the functionalities which it was intended for.<br>
Now, my Invoices require to display the transactions which has happened for this particular Invoice, for eg. Advance received, additional Advance Amount received.<br>
We are registering each payment received with comments into the Payments section of the application.<br>
Below is the steps I have taken and tried to see if I can get this option working.<br>
Added a few codes of lines in the file <code>application/helpers/pdf_helper.php</code> as below:  </p>

<pre><code>$CI-&gt;load-&gt;model('quotes/mdl_quotes');
$quote = $CI-&gt;mdl_quotes-&gt;where('ip_quotes.invoice_id', $invoice_id)-&gt;get()-&gt;result();
$CI-&gt;load-&gt;model('payments/mdl_payments');
$payment = $CI-&gt;mdl_payments-&gt;where('ip_payments.invoice_id', $invoice_id)-&gt;get()-&gt;result();
$data = array(
    'invoice' =&gt; $invoice,
    'invoice_tax_rates' =&gt; $CI-&gt;mdl_invoice_tax_rates-&gt;where('invoice_id', $invoice_id)-&gt;get()-&gt;result(),
    'quote' =&gt; (isset($quote[0]) ? $quote[0] : null),
    'payment' =&gt; (isset($payment[0]) ? $payment[0] : null),
    'items' =&gt; $items,
    'payment_method' =&gt; $payment_method,
    'output_type' =&gt; 'pdf',
    'show_discounts' =&gt; $show_discounts,
);
</code></pre>

<p>I then added a few codes as table format into the Invoice PDF Template file <code>application/views/invoice_templates/pdf/InvoicePlane.php</code> as below:  </p>

<pre><code>&lt;table class="item-table"&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Date of Payment&lt;/th&gt;
            &lt;th&gt;Payment Method&lt;/th&gt;
            &lt;th&gt;Amount Paid&lt;/th&gt;
            &lt;th&gt;Payment Journal&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;?php echo $payment-&gt;payment_date; ?&gt;&lt;/td&gt;
            &lt;td&gt;&lt;?php echo $payment-&gt;payment_method_name; ?&gt;&lt;/td&gt;
            &lt;td&gt;&lt;?php echo $payment-&gt;payment_amount; ?&gt;&lt;/td&gt;
            &lt;td&gt;&lt;?php echo $payment-&gt;payment_note; ?&gt;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p>So now, it came to a condition where the payment detail started to show up on the Invoice, but it is showing only the first transaction of payment received.<br>
I guess I am missing some looping iteration to get all the line items of payment transactions of this particular Invoice.<br>
I would request help and guidance to see how we can make it to display all the transactions of payment receipt for that particular Invoice.  </p>

<p>PS : I did ask this on the InvoicePlane Forum as well, but no response that - <a href="https://community.invoiceplane.com/t/topic/2771" rel="nofollow">https://community.invoiceplane.com/t/topic/2771</a>.<br>
I also did use their wiki - <a href="https://wiki.invoiceplane.com/en/1.0/templates/using-templates" rel="nofollow">https://wiki.invoiceplane.com/en/1.0/templates/using-templates</a>  and  <a href="https://wiki.invoiceplane.com/en/1.0/templates/customize-templates" rel="nofollow">https://wiki.invoiceplane.com/en/1.0/templates/customize-templates</a></p>