Commit 332e2847cfbdaecc1767220170ef18812f73787c
1 parent
f59df686cc
Exists in
master
Perbaikan validitas totalTagihanItem
Showing 1 changed file with 9 additions and 3 deletions Side-by-side Diff
index.js
... | ... | @@ -173,20 +173,26 @@ function calculateBaseBillAmount(detailSplitted, customKeywords, productKeyval, |
173 | 173 | ) { |
174 | 174 | return calculateBaseBillAmountAuto(detailSplitted, customKeywords, productKeyval, billCount); |
175 | 175 | } |
176 | - | |
176 | + | |
177 | 177 | const billCountOrDefault = billCount || 1; |
178 | 178 | |
179 | 179 | const totalTagihanKeyword = productKeyval.KEYWORD_TOTALTAG; |
180 | 180 | if (!totalTagihanKeyword) return 0; |
181 | 181 | |
182 | 182 | const totalTagihanItem = detailSplitted.find((item) => (item.keyword || '').toUpperCase() === totalTagihanKeyword.toUpperCase()); |
183 | - const totalTagihanValue = Number((totalTagihanItem.value || '').trim().replace(/^rp */i, '').replace(/\./g, '')); | |
183 | + const totalTagihanValue = Number( | |
184 | + ((totalTagihanItem && totalTagihanItem.value) || '') | |
185 | + .trim() | |
186 | + .replace(/^rp */i, '') | |
187 | + .replace(/\./g, '') | |
188 | + ); | |
189 | + | |
184 | 190 | if (!totalTagihanValue) { |
185 | 191 | if (process.env.DEBUG_IRS_CALCULATE_BASE_BILL_AMOUNT) { |
186 | 192 | // eslint-disable-next-line no-console |
187 | 193 | console.log('=========== MISSING totalTagihanValue D7282FA7'); |
188 | 194 | } |
189 | - | |
195 | + | |
190 | 196 | return 0; |
191 | 197 | } |
192 | 198 |