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
@@ -436,7 +436,9 @@ class BackupStokAuditController extends Controller
$calculation = new V2Calculation();
$kiraan = $calculation->kiraanKeuntunganRebet($q['bakipjm'],$q['nilaimarhun'],$q['kadarupah'],(($q['bakipjm']/$q['nilaimarhun']) * 100));
$className::on($cawangan['mysql'])->where('norujukan',$q['norujukan'])->update(array(
'upahblmbyar' => 0,
'utgonepercent' => $calculation->getRoundedMethod($kiraan['onepercent'] * $q['tempohblmbyar']),
'ujrah' => $calculation->getRoundedMethod($kiraan['ujrah'] * $q['tempohblmbyar']),
));
@@ -10,10 +10,10 @@ use Illuminate\Http\Request;
class OnePercentController extends Controller
{
public function getKeuntunganImbangDuga(string $kod_cawangan)
public function getKeuntunganImbangDuga(string $kod_cawangan,Request $request)
{
$reports = new ReportOne($kod_cawangan);
$response = $reports->getTotalKeuntungan('B');
$response = $reports->getTotalKeuntungan('B',$request->tarikh);
return response()->json($response);
}
@@ -67,4 +67,25 @@ class OnePercentController extends Controller
return response()->json($totalrebate);
}
public function getAccruedincome(Request $request){
$reports = new ReportOne($request->kodcaw);
$response = $reports->calculateAccruedIncome($request);
return response()->json($response);
}
public function getAllCawanganAccruedIncome(Request $request){
$reports = new ReportOne($request->kodcaw);
$response = $reports->getAllCawanganAccruedIncome($request);
return response()->json($response);
}
public function getCurrentProfit($kod_cawangan,Request $request){
$reports = new ReportOne($kod_cawangan);
$response = $reports->CurrentProfit($request->mula,$request->hingga,$kod_cawangan);
return response()->json($response);
}
}
+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);