Change Paid on Invoice to include Payment Date


Is there a way on the templates to show the payment method and payment date? Simply having the word “Paid” with the amount is not enough for our customers.

I was hoping this was already addressed elsewhere but I can’t seem to find a post for it.

Thanks in advance.

1 Like

Same like with the client details, moved to feature requests.

Development Reference: IP-191

1 Like

well what i did to include that date is put the following code into your template:

$invoice_id= $invoice->invoice_id;
$query = $this->db->query(“SELECT\n” . " payment_date\n" . “FROM\n” . " ip_payments\n" . “WHERE\n” . " invoice_id = " . $invoice_id);
$payment_date = $query->row()->payment_date;
echo date_from_mysql($payment_date, true);

but I am pretty sure that it should be in the controller as a function. (ie get_payment_date($invoice_id) )
Preferably a function that works out if there is more that one payment and then gives out the last date, or all in an array.
But this is for the devs to work out :wink:

<?php if ($payment_method): ?>
<div class="payments">
	<h4 class="payment-history ">
		<?php echo lang('payment_history') ?>
	<table class="payments-overview">
	            <th class="payment-method text-left" colspan="2"><?php echo lang('payment_method'); ?></th>
				<th class="payment-date text-right"><?php echo lang('payment_date'); ?></th>
				<th class="payment-amount text-right"><?php echo lang('amount'); ?></th>
			//lookup the payment(s) for this invoice
			$invoice_id= $invoice->invoice_id;
			$payments =$this->db->select("ip_payments.payment_id, ip_payments.invoice_id, ip_payments.payment_method_id, ip_payments.payment_date, ip_payments.payment_amount, ip_payments.payment_note, ip_payment_methods.payment_method_name");
			$payments =$this->db->from("ip_payments");
			$payments =$this->db->join("ip_payment_methods","ip_payments.payment_method_id = ip_payment_methods.payment_method_id");
			$payments =$this->db->where("invoice_id", $invoice_id);				
			$payments = $this->db->get();
			//create a nice row for each payment
			foreach($payments->result() as $payment) : ?>
					<td class="payment-method text-left" colspan="2"><?php echo $payment->payment_method_name; ?></td>
					<td class="payment-date text-right"><?php echo date_from_mysql($payment->payment_date, true); ?></td>
					<td class="payment-amount text-right"><?php echo format_currency($payment->payment_amount); ?></td>
			<?php endforeach ?>
			<tr class="amount-due">
				<td colspan="3" class="text-right text-green">
					<?php echo lang('balance'); ?>
	            <td class="text-right text-green">
	                <?php echo format_currency($invoice->invoice_balance); ?>
<?php endif; ?>

this is the code i have in my paid template, if it is any help to anyone


Muchas gracias,