fix(penilai/surveyor): perbaikkan print out dokument jaminan
This commit is contained in:
committed by
Daeng Deni Mardaeni
parent
d52edb9481
commit
340dce7ed7
@@ -430,7 +430,8 @@ function getWilayahName($code, $type)
|
||||
}
|
||||
|
||||
|
||||
function formatLabel($key) {
|
||||
function formatLabel($key)
|
||||
{
|
||||
|
||||
static $labelCache = [];
|
||||
if (isset($labelCache[$key])) {
|
||||
@@ -468,3 +469,35 @@ function calculateSLA($permohonan, $type)
|
||||
|
||||
return $slaMap[$type] ?? null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Menghitung total nilai berdasarkan key dan jenis legalitas.
|
||||
*
|
||||
* @param array $detailsArray
|
||||
* @param string $key
|
||||
* @param int $jenisLegalitas
|
||||
* @return int
|
||||
*/
|
||||
function calculateTotalLuas($detailsArray, $key, $jenisLegalitas)
|
||||
{
|
||||
$total = 0;
|
||||
|
||||
if ($detailsArray) {
|
||||
foreach ($detailsArray as $item) {
|
||||
if (isset($item->jenis_legalitas_jaminan_id) && $item->jenis_legalitas_jaminan_id === $jenisLegalitas) {
|
||||
$details = json_decode($item->details, true);
|
||||
|
||||
if (is_array($details)) {
|
||||
foreach ($details as $detail) {
|
||||
if (isset($detail[$key])) {
|
||||
$total += (int) $detail[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user