fix
This commit is contained in:
@@ -663,7 +663,7 @@ class AdminPageController extends Controller
|
||||
|
||||
|
||||
$tebus = Gadai::on($cawangan['mysql'])
|
||||
->selectRaw('SUM(pinjaman) AS totalpinjaman')
|
||||
->selectRaw('SUM(bakipjm) AS totalpinjaman')
|
||||
->addSelect(DB::connection($cawangan['mysql'])
|
||||
->raw('DATE_FORMAT(t_update, "%Y-%m") as t_update'))
|
||||
->groupBy(DB::connection($cawangan['mysql'])
|
||||
@@ -673,12 +673,30 @@ class AdminPageController extends Controller
|
||||
->orderBy('t_update','asc')
|
||||
->get();
|
||||
|
||||
$ansuran = Transaction::on('mysql7')
|
||||
->selectRaw('SUM(trans.bayaran_pembiayaan) AS total')
|
||||
->addSelect(DB::connection($cawangan['mysql'])
|
||||
->raw('DATE_FORMAT(transaction.created_at, "%Y-%m") as tarikh'))
|
||||
->groupBy(DB::connection($cawangan['mysql'])
|
||||
->raw("DATE_FORMAT(transaction.created_at,'%Y%m')"))
|
||||
->whereYear('transaction.created_at',$current->year)
|
||||
->leftJoin('transaksi_keuntungan as trans', function($join)
|
||||
{
|
||||
$join->on('transaction.norujukan', '=', 'trans.norujukan');
|
||||
$join->on('transaction.created_at', '=', 'trans.tarikh_bayaran');
|
||||
})
|
||||
->where('transaction.trans_type','=','A')
|
||||
->where([['trans.tarikh_bayaran','>=',$monthly_date . ' 00:00:00'],['trans.tarikh_bayaran','<=',$current->toDateString() . ' 23:59:59']])
|
||||
->where('trans.kodcaw','=',$request->kodcaw)
|
||||
->get()->toArray();
|
||||
|
||||
$total_tebus = 0;
|
||||
foreach($array_totalup as $array_index=>$totalup){
|
||||
foreach($tebus as $indextebus=>$tebus_detail){
|
||||
if($totalup['tarikh'] == $tebus_detail['t_update']){
|
||||
$total_tebus = $totalup['penebusan'];
|
||||
$total_tebus += $tebus_detail['totalpinjaman'];
|
||||
$total_tebus += $ansuran[$indextebus]['total'];
|
||||
$array_totalup[$array_index]['penebusan'] = $total_tebus;
|
||||
$array_totalup[$array_index]['bajettebus'] = (sizeof($bajettebus) > 0) ? $bajettebus[$array_index] : 0;
|
||||
}
|
||||
@@ -692,7 +710,6 @@ class AdminPageController extends Controller
|
||||
return response()->json($arrayPenyelesaian);
|
||||
|
||||
}
|
||||
|
||||
public function BilanganPenebusanBulanan(Request $request)
|
||||
{
|
||||
$current = Carbon::now();
|
||||
|
||||
Reference in New Issue
Block a user