Commit 86c8c00efb8cc01a3eca0a1bc898bb0bb01abca9
1 parent
4cc6eab525
Exists in
master
TOTALTAGIHAN untuk FIF
Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff
index.js
... | ... | @@ -142,7 +142,7 @@ function splitPostpaidDetail(str) { |
142 | 142 | } |
143 | 143 | |
144 | 144 | function calculateBaseBillAmount(detailSplitted, customKeywords) { |
145 | - const keywords = customKeywords || ['TAGIHAN', 'DENDA', 'RPPREMI', 'BIAYA']; | |
145 | + const keywords = customKeywords || ['TAGIHAN', 'DENDA', 'RPPREMI', 'BIAYA', 'TOTALTAGIHAN']; | |
146 | 146 | |
147 | 147 | let retval = 0; |
148 | 148 | let detailCount = (detailSplitted || []).length; |
... | ... | @@ -150,7 +150,8 @@ function calculateBaseBillAmount(detailSplitted, customKeywords) { |
150 | 150 | for (let i = 0; i < detailCount; i += 1) { |
151 | 151 | const item = detailSplitted[i]; |
152 | 152 | if (keywords.indexOf(item.keyword.toUpperCase()) >= 0) { |
153 | - retval += Number(item.value) || 0; | |
153 | + const value = (item.value || '').trim().replace(/^rp */i, '').replace(/\./g, ''); | |
154 | + retval += Number(value) || 0; | |
154 | 155 | } |
155 | 156 | } |
156 | 157 |