accounting-engine 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -136,6 +136,13 @@ const normalizeInvoiceForAccounting = async (invoice, direction) => {
|
|
136
136
|
amount: line.withholding_tax_subtotals[0].amount,
|
137
137
|
};
|
138
138
|
}
|
139
|
+
let amount = item.taxable;
|
140
|
+
if (item.code === '0015' && Number(item.percent) !== 0 && Number(item.amount) !== 0) {
|
141
|
+
const calculatedAmount = Number(item.amount) / (Number(item.percent) / 100).toFixed(2);
|
142
|
+
if (Math.abs(calculatedAmount - item.taxable) > 1) {
|
143
|
+
amount = calculatedAmount;
|
144
|
+
}
|
145
|
+
}
|
139
146
|
taxables.push({
|
140
147
|
id: line.id,
|
141
148
|
name: line.name,
|
@@ -147,7 +154,7 @@ const normalizeInvoiceForAccounting = async (invoice, direction) => {
|
|
147
154
|
type: 'taxable',
|
148
155
|
code: item.code,
|
149
156
|
percent: item.percent,
|
150
|
-
amount
|
157
|
+
amount,
|
151
158
|
withholding,
|
152
159
|
});
|
153
160
|
}
|
@@ -178,11 +185,18 @@ const normalizeInvoiceForAccounting = async (invoice, direction) => {
|
|
178
185
|
const index = _.findIndex(taxables, { type: 'taxable', code: item.code, percent: item.percent });
|
179
186
|
taxables[index].amount += item.taxable;
|
180
187
|
} else {
|
188
|
+
let amount = item.taxable;
|
189
|
+
if (item.code === '0015' && Number(item.percent) !== 0 && Number(item.amount) !== 0) {
|
190
|
+
const calculatedAmount = Number(item.amount) / (Number(item.percent) / 100).toFixed(2);
|
191
|
+
if (Math.abs(calculatedAmount - item.taxable) > 1) {
|
192
|
+
amount = calculatedAmount;
|
193
|
+
}
|
194
|
+
}
|
181
195
|
taxables.push({
|
182
196
|
type: 'taxable',
|
183
197
|
code: item.code,
|
184
198
|
percent: item.percent,
|
185
|
-
amount
|
199
|
+
amount,
|
186
200
|
withholding: {
|
187
201
|
type: null,
|
188
202
|
code: null,
|