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
+13 -3
View File
@@ -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);