update total invoice
This commit is contained in:
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"editor.language.colorizedBracketPairs": []
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
@@ -510,12 +510,15 @@ class Invoices extends CI_Controller {
|
||||
}
|
||||
|
||||
// ================= AMBIL TUNGGAKAN =================
|
||||
$this->db->select_sum('sisa_piutang');
|
||||
$this->db->select_sum('total');
|
||||
$this->db->select_sum('total_bayar');
|
||||
$this->db->where('customer_id', $data->customer_id);
|
||||
$this->db->where('status !=', 'paid');
|
||||
$this->db->where('id !=', $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);
|
||||
|
||||
// ================= MASUKKAN KE DATA =================
|
||||
$data->tunggakan = (int)$tunggakan;
|
||||
|
||||
Reference in New Issue
Block a user