diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index ca57849..ab8f95a 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -300,7 +300,7 @@ class CustomerController extends Controller // $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); $gadai = Customer::on('mysql7') - ->where('tarikhdaftar','=',$tarikh) + ->where([['tarikhdaftar','=',$tarikh],['kodcaw',$kodcaw]]) ->orderBy('tarikhdaftar', 'desc') ->get(); diff --git a/app/Http/Controllers/LaporanController.php b/app/Http/Controllers/LaporanController.php index c6a5197..cf17956 100644 --- a/app/Http/Controllers/LaporanController.php +++ b/app/Http/Controllers/LaporanController.php @@ -59,7 +59,7 @@ class LaporanController extends Controller $bilangan_gadai = Gadai::on($cawangan['mysql'])->where('t_gadai','=',$request->tarikh)->count(); $bilangan_tebus = Tebus::on($cawangan['mysql'])->where('t_tebus','=',$request->tarikh)->count(); $bilangan_ansuran = Transaction::on('mysql7')->whereRaw('DATE(created_at) = ?',[$request->tarikh])->where([['trans_type','=','A'],['kodcaw','=',$request->kodcaw]])->count(); - $bilangan_customer_baru = Customer::on('mysql7')->where('tarikhdaftar','=',$request->tarikh)->count(); + $bilangan_customer_baru = Customer::on('mysql7')->where([['tarikhdaftar','=',$request->tarikh],['kodcaw',$request->kodcaw]])->count(); //c /* Sistem */ @@ -360,8 +360,9 @@ class LaporanController extends Controller public function CalcXtra($kodcaw,Request $request) { - $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + $upahsimpan = GlCode::on($cawangan['mysql']) ->where('glcode','=','5000/413') ->sum('amaun'); @@ -369,14 +370,14 @@ class LaporanController extends Controller $bakilelongxtra = GlCode::on($cawangan['mysql']) ->where('glcode','=','7000/190') ->sum('amaun'); - + $untungrugiterkumpul = GlCode::on($cawangan['mysql']) ->where('glcode','=','7000/201') ->sum('amaun'); $kerugianlelongxtra = GlCode::on($cawangan['mysql']) - ->where('glcode','=','3000/120') - ->sum('amaun'); + ->where('glcode','=','3000/120') + ->sum('amaun'); $arrayxtra = ['upahsimpan' => floatval($upahsimpan), 'bakilelong' => floatval($bakilelongxtra), 'untungrugiterkumpul' => floatval($untungrugiterkumpul), 'kerugianlelong' => floatval($kerugianlelongxtra)]; diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index a0d3952..57f43c7 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -1000,10 +1000,9 @@ class TebusController extends Controller ->whereNotNull('db2.hargajualan') ->sum('keuntungan_rebet'); - $bukanansuran = TransaksiKeuntungan::on('mysql7') ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') - ->join('transaction as trans', function($join) + ->leftJoin('transaction as trans', function($join) { $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); @@ -1017,7 +1016,7 @@ class TebusController extends Controller $ansuran = TransaksiKeuntungan::on('mysql7') ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') - ->join('transaction as trans', function($join) + ->leftJoin('transaction as trans', function($join) { $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); @@ -1029,8 +1028,7 @@ class TebusController extends Controller ->whereNotNull('db2.hargajualan') ->sum('bayaran_keuntungan'); - - $total = $bukanansuran + $ansuran + $keuntungan; + $total = ($keuntungan + $keuntunganreducing + $ansuran + $bukanansuran); return response($total); } diff --git a/routes/web.php b/routes/web.php index 90a2ac4..d7e4a61 100644 --- a/routes/web.php +++ b/routes/web.php @@ -496,4 +496,4 @@ $router->group(['prefix'=>'dashboard'], function () use ($router){ $router->get('komoditi/jumlah/baki',['uses'=>'KomuditiController@jumlahKomoditiDashboard']); $router->post('komoditi/statistik',['uses'=>'KomuditiController@statistikKomoditiDashboard']); -}); \ No newline at end of file +});