update total invoice
This commit is contained in:
@@ -88,12 +88,16 @@ class Generateinvoice extends CI_Controller {
|
||||
// =========================
|
||||
$total = (float)$invi['total'];
|
||||
|
||||
$this->db->select_sum('sisa_piutang');
|
||||
// ================= AMBIL TUNGGAKAN =================
|
||||
$this->db->select_sum('total');
|
||||
$this->db->select_sum('total_bayar');
|
||||
$this->db->where('customer_id', $invi['customer_id']);
|
||||
$this->db->where('status !=', 'paid');
|
||||
$this->db->where('id !=', $invoice_id); // exclude invoice sekarang
|
||||
|
||||
$tunggakan = $this->db->get('invoices')->row()->sisa_piutang ?? 0;
|
||||
$row = $this->db->get('invoices')->row();
|
||||
|
||||
$tunggakan = ($row->total ?? 0) - ($row->total_bayar ?? 0);
|
||||
|
||||
// Ngambil Data Tunggakan bulan lalu jika ada.
|
||||
$keteranganlain = 'Akumulasi Tunggakan Invoice Bulan Lalu';
|
||||
|
||||
Reference in New Issue
Block a user