【发布时间】:2016-10-12 12:42:24
【问题描述】:
我已在我的共享主机帐户上安装了InvoicePlane v1.4.6。
能够执行常规任务,例如制作报价并将其转换为发票以及几乎所有预期的功能。
现在,我的发票需要显示为此特定发票发生的交易,例如。已收到预付款,已收到额外预付款。
我们正在将通过 cmets 收到的每笔付款注册到应用程序的“付款”部分。
以下是我已采取的步骤,并尝试查看是否可以使此选项起作用。
在文件application/helpers/pdf_helper.php中添加了几行代码如下:
$CI->load->model('quotes/mdl_quotes');
$quote = $CI->mdl_quotes->where('ip_quotes.invoice_id', $invoice_id)->get()->result();
$CI->load->model('payments/mdl_payments');
$payment = $CI->mdl_payments->where('ip_payments.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),
'payment' => (isset($payment[0]) ? $payment[0] : null),
'items' => $items,
'payment_method' => $payment_method,
'output_type' => 'pdf',
'show_discounts' => $show_discounts,
);
然后我将一些代码作为表格格式添加到发票 PDF 模板文件application/views/invoice_templates/pdf/InvoicePlane.php 中,如下所示:
<table class="item-table">
<thead>
<tr>
<th>Date of Payment</th>
<th>Payment Method</th>
<th>Amount Paid</th>
<th>Payment Journal</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $payment->payment_date; ?></td>
<td><?php echo $payment->payment_method_name; ?></td>
<td><?php echo $payment->payment_amount; ?></td>
<td><?php echo $payment->payment_note; ?></td>
</tr>
</tbody>
</table>
所以现在,付款细节开始出现在发票上,但它只显示收到的第一笔付款交易。
我想我错过了一些循环迭代来获取此特定发票的所有付款交易行项目。
我会请求帮助和指导,看看我们如何才能显示该特定发票的所有付款收据交易。
PS:我也曾在 InvoicePlane 论坛上问过这个问题,但没有回应 - https://community.invoiceplane.com/t/topic/2771。
我也确实使用了他们的 wiki - https://wiki.invoiceplane.com/en/1.0/templates/using-templates 和 https://wiki.invoiceplane.com/en/1.0/templates/customize-templates
【问题讨论】:
标签: php mysql transactions invoice