fix lejeram for lelong

This commit is contained in:
Hafifie PKB
2024-08-28 15:40:10 +08:00
parent d49874fb5d
commit e438bfe7bc
3 changed files with 15 additions and 5 deletions
+1 -1
View File
@@ -1336,7 +1336,7 @@ class LaporanController extends Controller
->get()->toArray(); ->get()->toArray();
$upahlelong = Lelong::on($cawangan['mysql']) $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) ->whereYear('t_jual','=',$mulaCarbon->year)
->sum('bakiupah'); ->sum('bakiupah');
+1 -1
View File
@@ -147,7 +147,7 @@ class ImbangDugaService
->get()->toArray(); ->get()->toArray();
$upahlelong = Lelong::on($cawangan['mysql']) $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) ->whereYear('t_jual', '=', $currentDate->year)
->sum('bakiupah'); ->sum('bakiupah');
+13 -3
View File
@@ -5,6 +5,7 @@ namespace App\Services\Reports;
use App\AkruNetPecahan; use App\AkruNetPecahan;
use App\Cawangan; use App\Cawangan;
use App\CawanganDetail; use App\CawanganDetail;
use App\Lelong;
use App\Gadai; use App\Gadai;
use App\StokAudit1; use App\StokAudit1;
use App\StokAudit10; use App\StokAudit10;
@@ -409,8 +410,17 @@ class OnePercentService
$ujrah_rebet = $this->filterCollection($keuntungan_semasa_collection,'T','ujrah_rebet'); $ujrah_rebet = $this->filterCollection($keuntungan_semasa_collection,'T','ujrah_rebet');
$onepercent_rebet = $this->filterCollection($keuntungan_semasa_collection,'T','onepercent_rebet'); $onepercent_rebet = $this->filterCollection($keuntungan_semasa_collection,'T','onepercent_rebet');
$total_onepercent = $onepercent + $onepercent_rebet; $upahlelong = Lelong::on($cawangan['mysql'])
$total_ujrah = $ujrah + $ujrah_rebet; ->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]; return ['ujrah' => $total_ujrah,'onepercent' => $total_onepercent];
} }
@@ -479,7 +489,7 @@ class OnePercentService
$array_type = ['T','S','P','AT']; $array_type = ['T','S','P','AT'];
return $collection->filter(function ($item) use($type,$array_type) { return $collection->filter(function ($item) use($type,$array_type) {
if($type == 'T') if($type == 'T')
return in_array($type, $array_type); return in_array($item->trans_type, $array_type);
return $item->trans_type === $type; return $item->trans_type === $type;
})->sum($sumtype); })->sum($sumtype);