reducing method
This commit is contained in:
@@ -733,18 +733,36 @@ class TebusController extends Controller
|
||||
$daterequest = new Carbon($request->tarikh);
|
||||
$daterequest->addDays(1);
|
||||
|
||||
$dateSM = new Carbon('2021-04-21');
|
||||
$dateSM->addDays(1);
|
||||
|
||||
$dateRM = new Carbon('2021-04-22');
|
||||
$dateRM->addDays(1);
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$keuntungan = TransaksiKeuntungan::on('mysql7')
|
||||
->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan')
|
||||
// ->where('transaksi_keuntungan.tarikh_bayaran' ,'>=', $datetawarruq)
|
||||
->where('transaksi_keuntungan.tarikh_bayaran' ,'<=', $daterequest)
|
||||
->where('transaksi_keuntungan.tarikh_bayaran' ,'<=', $dateSM)
|
||||
->whereYear('tarikh_bayaran','=',$current->year)
|
||||
->whereNotNull('db2.hargajualan')
|
||||
->sum('bayaran_keuntungan');
|
||||
|
||||
return response($keuntungan);
|
||||
$keuntunganreducing = TransaksiKeuntungan::on('mysql7')
|
||||
->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan')
|
||||
// ->where('transaksi_keuntungan.tarikh_bayaran' ,'>=', $datetawarruq)
|
||||
->where('transaksi_keuntungan.tarikh_bayaran' ,'<=', $daterequest)
|
||||
->where('transaksi_keuntungan.tarikh_bayaran' ,'>=', $dateRM)
|
||||
->whereYear('tarikh_bayaran','=',$current->year)
|
||||
->whereNotNull('db2.hargajualan')
|
||||
->sum('bayaran_keuntungan');
|
||||
|
||||
|
||||
$total = $keuntungan + $keuntunganreducing;
|
||||
|
||||
return response($total);
|
||||
}
|
||||
|
||||
public function RebetCalculation($kodcaw,Request $request)
|
||||
|
||||
+1
-1
@@ -357,7 +357,7 @@ $router->group(['prefix'=>'api'], function () use ($router){
|
||||
|
||||
//-- Untung Rugi --//
|
||||
$router->get('UntungRugiCalculation/{kodcaw}',['uses'=>'TebusController@untungrugicalculation']); //panjar
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user