diff --git a/index.js b/index.js index b580ded..b97c493 100644 --- a/index.js +++ b/index.js @@ -142,7 +142,7 @@ function splitPostpaidDetail(str) { } function calculateBaseBillAmount(detailSplitted, customKeywords) { - const keywords = customKeywords || ['TAGIHAN', 'DENDA', 'RPPREMI', 'BIAYA']; + const keywords = customKeywords || ['TAGIHAN', 'DENDA', 'RPPREMI', 'BIAYA', 'TOTALTAGIHAN']; let retval = 0; let detailCount = (detailSplitted || []).length; @@ -150,7 +150,8 @@ function calculateBaseBillAmount(detailSplitted, customKeywords) { for (let i = 0; i < detailCount; i += 1) { const item = detailSplitted[i]; if (keywords.indexOf(item.keyword.toUpperCase()) >= 0) { - retval += Number(item.value) || 0; + const value = (item.value || '').trim().replace(/^rp */i, '').replace(/\./g, ''); + retval += Number(value) || 0; } }