reducing method

This commit is contained in:
MUHD HAFIFIE
2021-04-22 14:26:39 +08:00
parent 22c86c697a
commit 7bf66c7a04
2 changed files with 21 additions and 3 deletions
+20 -2
View File
@@ -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
View File
@@ -357,7 +357,7 @@ $router->group(['prefix'=>'api'], function () use ($router){
//-- Untung Rugi --//
$router->get('UntungRugiCalculation/{kodcaw}',['uses'=>'TebusController@untungrugicalculation']); //panjar