fix lejeram for lelong
This commit is contained in:
@@ -1336,7 +1336,7 @@ class LaporanController extends Controller
|
||||
->get()->toArray();
|
||||
|
||||
$upahlelong = Lelong::on($cawangan['mysql'])
|
||||
->where([['t_jual','>=',$request->mula],['t_jual','<=',$request->hingga],['t_jual','>','2022-07-24']])
|
||||
->where([['tagujrah','=',0],['t_jual','>=',$request->mula],['t_jual','<=',$request->hingga],['t_jual','>','2022-07-24']])
|
||||
->whereYear('t_jual','=',$mulaCarbon->year)
|
||||
->sum('bakiupah');
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ class ImbangDugaService
|
||||
->get()->toArray();
|
||||
|
||||
$upahlelong = Lelong::on($cawangan['mysql'])
|
||||
->where([['t_jual', '>=', $firstMonth], ['t_jual', '<=', $lastMonth], ['t_jual', '>', '2022-07-24']])
|
||||
->where([['tagujrah','=',0],['t_jual', '>=', $firstMonth], ['t_jual', '<=', $lastMonth], ['t_jual', '>', '2022-07-24']])
|
||||
->whereYear('t_jual', '=', $currentDate->year)
|
||||
->sum('bakiupah');
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Services\Reports;
|
||||
use App\AkruNetPecahan;
|
||||
use App\Cawangan;
|
||||
use App\CawanganDetail;
|
||||
use App\Lelong;
|
||||
use App\Gadai;
|
||||
use App\StokAudit1;
|
||||
use App\StokAudit10;
|
||||
@@ -409,8 +410,17 @@ class OnePercentService
|
||||
$ujrah_rebet = $this->filterCollection($keuntungan_semasa_collection,'T','ujrah_rebet');
|
||||
$onepercent_rebet = $this->filterCollection($keuntungan_semasa_collection,'T','onepercent_rebet');
|
||||
|
||||
$total_onepercent = $onepercent + $onepercent_rebet;
|
||||
$total_ujrah = $ujrah + $ujrah_rebet;
|
||||
$upahlelong = Lelong::on($cawangan['mysql'])
|
||||
->selectRaw('SUM(ujrah) as ujrah,SUM(onepercent) as onepercent')
|
||||
->where([['tagujrah','=',0],['t_jual','>=',$start],['t_jual','<=',$end]])
|
||||
->whereYear('t_jual','=',$year)
|
||||
->get()->toArray();
|
||||
|
||||
$ujrah_lelong = (empty($upahlelong)) ? 0 : $upahlelong[0]['ujrah'];
|
||||
$onepercent_lelong = (empty($upahlelong)) ? 0 : $upahlelong[0]['onepercent'];
|
||||
|
||||
$total_onepercent = $onepercent + $onepercent_rebet + $onepercent_lelong;
|
||||
$total_ujrah = $ujrah + $ujrah_rebet + $ujrah_lelong;
|
||||
|
||||
return ['ujrah' => $total_ujrah,'onepercent' => $total_onepercent];
|
||||
}
|
||||
@@ -479,7 +489,7 @@ class OnePercentService
|
||||
$array_type = ['T','S','P','AT'];
|
||||
return $collection->filter(function ($item) use($type,$array_type) {
|
||||
if($type == 'T')
|
||||
return in_array($type, $array_type);
|
||||
return in_array($item->trans_type, $array_type);
|
||||
|
||||
return $item->trans_type === $type;
|
||||
})->sum($sumtype);
|
||||
|
||||
Reference in New Issue
Block a user