<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Payment_Model extends MY_Model { function __construct() { parent::__construct(); } public function get_invoice_amount($invoice_id){ $this->db->select('I.*, SUM(T.amount) AS paid_amount'); $this->db->from('invoices AS I'); $this->db->join('transactions AS T', 'T.invoice_id = I.id', 'left'); $this->db->where('I.id', $invoice_id); return $this->db->get()->row(); } public function get_invoice_paid_amount($txn_id){ $this->db->select('T.*, T.amount AS paid_amount'); $this->db->from('transactions AS T'); $this->db->join('invoices AS I', 'I.id = T.invoice_id', 'left'); $this->db->where('T.id', $txn_id); return $this->db->get()->row(); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Discount_Model.php | File | 1.56 KB | 0777 |
|
Duefeeemailsms_Model.php | File | 5.36 KB | 0777 |
|
Expenditure_Model.php | File | 1.67 KB | 0777 |
|
Exphead_Model.php | File | 1.25 KB | 0777 |
|
Feetype_Model.php | File | 1.77 KB | 0777 |
|
Income_Model.php | File | 2 KB | 0777 |
|
Incomehead_Model.php | File | 1.38 KB | 0777 |
|
Invoice_Model.php | File | 8.05 KB | 0777 |
|
Payment_Model.php | File | 911 B | 0777 |
|
Receipt_Model.php | File | 6.48 KB | 0777 |
|
index.html | File | 131 B | 0777 |
|