fix pendahuluanserahanbakieloong
This commit is contained in:
@@ -234,26 +234,42 @@ class LelongController extends Controller
|
||||
|
||||
public function BakiLelongCalculationLejer($kodcaw,Request $request)
|
||||
{
|
||||
$cas_lelong = 0;
|
||||
$jumlah_lelong = 0;
|
||||
$baki_lelong = 0;
|
||||
$rugi_lelong = 0;
|
||||
|
||||
$tarikhbaru = $request->mula;
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
|
||||
$bakilelong = Lelong::on($cawangan['mysql'])
|
||||
->where('trkhtuntut','>=',$request->mula)
|
||||
->where('trkhtuntut','<=',$request->hingga)
|
||||
->where('baki','>=',0)
|
||||
->sum('baki');
|
||||
->where('trkhtuntut','>=',$request->mula)
|
||||
->where('trkhtuntut','<=',$request->hingga)
|
||||
->where('baki','>=',0)
|
||||
->sum('baki');
|
||||
|
||||
$rugilelong = Lelong::on($cawangan['mysql'])
|
||||
->where('trkhtuntut','>=',$request->mula)
|
||||
->where('trkhtuntut','<=',$request->hingga)
|
||||
->where('baki','<',0)
|
||||
->sum('baki');
|
||||
|
||||
$data_lelong = Lelong::on($cawangan['mysql'])->where([['t_jual','>=',$request->mula],['t_jual','<=',$request->hingga]])->get();
|
||||
|
||||
$rugitotal = $rugilelong;
|
||||
foreach($data_lelong as $index=>$lelong){
|
||||
if($lelong['baki'] >= 0){
|
||||
$cas_lelong += $lelong['cajlelong'];
|
||||
$jumlah_lelong += $lelong['hargajual'];
|
||||
$baki_lelong += $lelong['baki'];
|
||||
}elseif($lelong['baki'] < 0){
|
||||
$cas_lelong += $lelong['cajlelong'];
|
||||
$jumlah_lelong += $lelong['hargajual'];
|
||||
$rugi_lelong += abs($lelong['baki']);
|
||||
}
|
||||
}
|
||||
|
||||
$arraylelong = ['bakilelong' => $bakilelong, 'rugilelong' => $rugitotal];
|
||||
$arraylelong = ['bakilelong' => $bakilelong, 'rugilelong' => $rugilelong, 'baki' => $baki_lelong, 'rugi' => $rugi_lelong, 'jumlahlelong' => $jumlah_lelong, 'caslelong' => $cas_lelong];
|
||||
|
||||
return response()->json($arraylelong,200);
|
||||
}
|
||||
@@ -479,6 +495,19 @@ class LelongController extends Controller
|
||||
return response()->json($cajlelong,200);
|
||||
}
|
||||
|
||||
public function cajlelongcalculationLejer($kodcaw,Request $request)
|
||||
{
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
$cajlelong = Lelong::on($cawangan['mysql'])
|
||||
->whereNotNull('t_jual')
|
||||
->where([['t_jual','<=', $request->mula],['t_jual','>=',$request->hingga]])
|
||||
->sum('cajlelong');
|
||||
|
||||
return response()->json($cajlelong,200);
|
||||
}
|
||||
|
||||
public function cajperkhidmatancalculation($kodcaw,Request $request)
|
||||
{
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
Reference in New Issue
Block a user