fix imbang duga akru for keuntungan penggadai and added fix of previous imbang duga

This commit is contained in:
Hafifie PKB
2024-04-01 22:06:12 +08:00
parent 3be2247cb0
commit 13890767dd
7 changed files with 493 additions and 10 deletions
+7 -2
View File
@@ -1480,6 +1480,7 @@ class TebusController extends Controller
->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->hingga)
->whereYear('tarikh_bayaran','=',$current->year)
->where('trans.kodcaw',$request->kodcaw)
->where('transaksi_keuntungan.margin_semasa',0)
// ->whereNotNull('db2.hargajualan')
// ->sum('keuntungan_rebet');
->get();
@@ -1506,6 +1507,7 @@ class TebusController extends Controller
->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->hingga)
->whereYear('tarikh_bayaran','=',$current->year)
->where('trans.kodcaw',$request->kodcaw)
->where('transaksi_keuntungan.margin_semasa',0)
// ->whereNotNull('db2.hargajualan')
// ->sum('bayaran_keuntungan');
->get();
@@ -1525,6 +1527,8 @@ class TebusController extends Controller
->whereYear('t_jual','=',$current->year)
->sum('bakiupah');
dd($ansuran,$bukanansuran,$upahlelong);
$total = ($ansuran + $bukanansuran + $upahlelong);
}
@@ -1615,7 +1619,7 @@ class TebusController extends Controller
$date_sekarang = clone $date;
$month_sebelum = $date->subMonth()->format('m');
$month_sekarang = $date_sekarang->format('m');
$year_generate = $date->format('Y');
$year_generate = $date_sekarang->format('Y');
if($determine_past->isToday())
{
@@ -1632,7 +1636,8 @@ class TebusController extends Controller
}else{
$result_audit_backdate = $this->StokAuditGenerateTerakru($month_sekarang,$cawangan,$year_generate);
$totaltunggakan_now = $result_audit_backdate->sum('upahblmbyar');
$totaltunggakan_now = $result_audit_backdate->selectRaw('SUM(upahblmbyar) + SUM(ujrah) + SUM(utgonepercent) as total_sum')->first();
$totaltunggakan_now = $totaltunggakan_now['total_sum'];
}
return response()->json($totaltunggakan_now);