fix laporan
This commit is contained in:
@@ -233,7 +233,7 @@ class AdminPageController extends Controller
|
|||||||
->groupBy(DB::connection($cawangan['mysql'])
|
->groupBy(DB::connection($cawangan['mysql'])
|
||||||
->raw("DATE_FORMAT(t_jual,'%Y%m')"))
|
->raw("DATE_FORMAT(t_jual,'%Y%m')"))
|
||||||
->whereYear('t_jual',$current->year)
|
->whereYear('t_jual',$current->year)
|
||||||
->where([['t_jual','<=',$current->toDateString()],['t_jual','>=',$monthly_date]])
|
// ->where([['t_jual','<=',$current->toDateString()],['t_jual','>=',$monthly_date]])
|
||||||
->orderBy('t_jual','asc')
|
->orderBy('t_jual','asc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
@@ -245,14 +245,21 @@ class AdminPageController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
$tebus = Tebus::on($cawangan['mysql'])
|
$tebus = Tebus::on($cawangan['mysql'])
|
||||||
->selectRaw('SUM(bakiupah) AS totalupahsimpan')
|
->selectRaw('SUM(bakiupah) AS totalupahsimpan')
|
||||||
->addSelect(DB::connection($cawangan['mysql'])
|
->addSelect(DB::connection($cawangan['mysql'])
|
||||||
->raw('DATE_FORMAT(t_tebus, "%Y-%m") as t_tebus'))
|
->raw('DATE_FORMAT(t_tebus, "%Y-%m") as t_tebus'))
|
||||||
->groupBy(DB::connection($cawangan['mysql'])
|
->groupBy(DB::connection($cawangan['mysql'])
|
||||||
->raw("DATE_FORMAT(t_tebus,'%Y%m')"))
|
->raw("DATE_FORMAT(t_tebus,'%Y%m')"))
|
||||||
->whereYear('t_tebus',$current->year)
|
->where(function($query) use ($current){
|
||||||
->where([['jenistebus','=','T'],['t_tebus','<=',$current->toDateString()],['t_tebus','>=',$monthly_date]])
|
$query
|
||||||
->orWhere([['jenistebus','=','A'],['t_tebus','<=',$current->toDateString()],['t_tebus','>=',$monthly_date]])
|
->where([['jenistebus','=','T'],['t_tebus','<=',$current->toDateString()]])
|
||||||
|
->whereYear('t_tebus',$current->year);
|
||||||
|
})
|
||||||
|
->orWhere(function($query) use ($current){
|
||||||
|
$query
|
||||||
|
->where([['jenistebus','=','T'],['t_tebus','<=',$current->toDateString()]])
|
||||||
|
->whereYear('t_tebus',$current->year);
|
||||||
|
})
|
||||||
->orderBy('t_tebus','asc')
|
->orderBy('t_tebus','asc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
@@ -265,8 +272,6 @@ class AdminPageController extends Controller
|
|||||||
|
|
||||||
$total = $totaltebus + $totallelong;
|
$total = $totaltebus + $totallelong;
|
||||||
|
|
||||||
// $total = $lelongupahsimpan + $tebus;
|
|
||||||
|
|
||||||
array_push($arrayKeuntungan,['bajet' => $bajetgroup,'total' => $total]);
|
array_push($arrayKeuntungan,['bajet' => $bajetgroup,'total' => $total]);
|
||||||
|
|
||||||
return response()->json($arrayKeuntungan);
|
return response()->json($arrayKeuntungan);
|
||||||
|
|||||||
@@ -138,47 +138,33 @@ class LaporanController extends Controller
|
|||||||
->where('trans.trans_type','!=','A')
|
->where('trans.trans_type','!=','A')
|
||||||
->where('trans.teller','<>','Online')
|
->where('trans.teller','<>','Online')
|
||||||
->whereDate('trans.created_at','=',$request->tarikh)
|
->whereDate('trans.created_at','=',$request->tarikh)
|
||||||
->where('trans.kodcaw','=',$request->kodcaw)
|
->where('trans.kodcaw','=',$request->kodcaw);
|
||||||
// ->whereNotNull('db2.hargajualan')
|
// ->whereNotNull('db2.hargajualan')
|
||||||
// ->sum('keuntungan_rebet');
|
// ->sum('keuntungan_rebet');
|
||||||
// ->get();
|
// ->get();
|
||||||
->pluck('transaksi_keuntungan.norujukan');
|
// ->pluck('transaksi_keuntungan.norujukan');
|
||||||
|
|
||||||
$gadaiDataKaunter = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$total_keuntunganbukanansuran_data_kaunter)->whereNotNull('hargajualan')->pluck('norujukan');
|
// dd($total_keuntunganbukanansuran_data_kaunter);
|
||||||
|
|
||||||
|
// $gadaiDataKaunter = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$total_keuntunganbukanansuran_data_kaunter)->whereNotNull('hargajualan')->pluck('norujukan');
|
||||||
|
|
||||||
|
|
||||||
$keuntunganbukanansuran_kaunter_query = TransaksiKeuntungan::on('mysql7')
|
// $keuntunganbukanansuran_kaunter_query = TransaksiKeuntungan::on('mysql7')
|
||||||
->selectRaw('sum(keuntungan_rebet) as sum')
|
// ->selectRaw('sum(keuntungan_rebet) as sum')
|
||||||
->whereIn('norujukan',$gadaiDataKaunter)
|
// ->whereIn('norujukan',$gadaiDataKaunter)
|
||||||
->whereDate('tarikh_bayaran','=',$request->tarikh)
|
// ->whereDate('tarikh_bayaran','=',$request->tarikh)
|
||||||
->where('kodcaw','=',$request->kodcaw)
|
// ->where('kodcaw','=',$request->kodcaw)
|
||||||
->where('bayaran_pembiayaan','>', 0)
|
// ->where('bayaran_pembiayaan','>', 0)
|
||||||
->groupby('norujukan')
|
// ->groupby('norujukan')
|
||||||
->pluck('sum');
|
// ->pluck('sum');
|
||||||
// ->sum('sum');
|
// ->sum('sum');
|
||||||
$sum = 0;
|
|
||||||
$countsum = 0;
|
|
||||||
foreach($keuntunganbukanansuran_kaunter_query as $quer)
|
|
||||||
{
|
|
||||||
$sum += $quer;
|
|
||||||
$countsum++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// $total_keuntunganbukanansuran_kaunter = $keuntunganbukanansuran_kaunter_query->sum('keuntungan_rebet');
|
$total_keuntunganbukanansuran_kaunter = $total_keuntunganbukanansuran_data_kaunter->sum('keuntungan_rebet');
|
||||||
|
|
||||||
// $bil_keuntunganbukanansuran_kaunter = $keuntunganbukanansuran_kaunter_query->count();
|
$bil_keuntunganbukanansuran_kaunter = $total_keuntunganbukanansuran_data_kaunter->count();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$total_keuntunganbukanansuran_kaunter = $sum;
|
|
||||||
|
|
||||||
$bil_keuntunganbukanansuran_kaunter = $countsum;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// dd($total_keuntunganbukanansuran_kaunter);
|
|
||||||
|
|
||||||
// $total_keuntunganbukanansuran = 0;
|
// $total_keuntunganbukanansuran = 0;
|
||||||
|
|
||||||
// if($total_keuntunganbukanansuran_data){
|
// if($total_keuntunganbukanansuran_data){
|
||||||
|
|||||||
Reference in New Issue
Block a user