accounting-engine 0.1.8 → 0.1.10
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
@@ -137,9 +137,15 @@ const normalizeInvoiceForAccounting = async (invoice, direction) => {
|
|
137
137
|
};
|
138
138
|
}
|
139
139
|
let amount = item.taxable;
|
140
|
-
if (
|
140
|
+
if (
|
141
|
+
item.code === '0015' &&
|
142
|
+
Number(item.percent) !== 0 &&
|
143
|
+
Number(item.amount) !== 0 &&
|
144
|
+
!Number.isNaN(Number(item.percent)) &&
|
145
|
+
!Number.isNaN(Number(item.amount))
|
146
|
+
) {
|
141
147
|
const calculatedAmount = Number(item.amount) / (Number(item.percent) / 100).toFixed(2);
|
142
|
-
if (Math.abs(calculatedAmount - item.taxable) > 1) {
|
148
|
+
if (Math.abs(calculatedAmount - (item.taxable || 0)) > 1) {
|
143
149
|
amount = calculatedAmount;
|
144
150
|
}
|
145
151
|
}
|
@@ -186,9 +192,15 @@ const normalizeInvoiceForAccounting = async (invoice, direction) => {
|
|
186
192
|
taxables[index].amount += item.taxable;
|
187
193
|
} else {
|
188
194
|
let amount = item.taxable;
|
189
|
-
if (
|
195
|
+
if (
|
196
|
+
item.code === '0015' &&
|
197
|
+
Number(item.percent) !== 0 &&
|
198
|
+
Number(item.amount) !== 0 &&
|
199
|
+
!Number.isNaN(Number(item.percent)) &&
|
200
|
+
!Number.isNaN(Number(item.amount))
|
201
|
+
) {
|
190
202
|
const calculatedAmount = Number(item.amount) / (Number(item.percent) / 100).toFixed(2);
|
191
|
-
if (Math.abs(calculatedAmount - item.taxable) > 1) {
|
203
|
+
if (Math.abs(calculatedAmount - (item.taxable || 0)) > 1) {
|
192
204
|
amount = calculatedAmount;
|
193
205
|
}
|
194
206
|
}
|
@@ -223,6 +235,7 @@ const normalizeInvoiceForAccounting = async (invoice, direction) => {
|
|
223
235
|
sender_object: invoice.sender_object,
|
224
236
|
receiver_object: invoice.receiver_object,
|
225
237
|
accounting_lines: accountingLines,
|
238
|
+
additional_document_reference: invoice.additional_document_reference,
|
226
239
|
};
|
227
240
|
return data;
|
228
241
|
};
|