update migrations and create base migration. set discount and tax to sale invoices

This commit is contained in:
2026-05-28 16:39:07 +03:30
parent cd3492d625
commit a975f9d02a
55 changed files with 2152 additions and 2278 deletions
@@ -397,6 +397,11 @@ export class SharedSaleInvoiceCreateService {
invoice_date: normalizedInvoiceDate,
invoice_number: invoiceNumber,
total_amount: data.total_amount,
discount_amount: data.items.reduce(
(prev, curr) => (prev += curr.discount_amount),
0,
),
tax_amount: data.items.reduce((prev, curr) => (prev += curr.tax_amount), 0),
code: this.generateInvoiceCode(businessId, complexId, posId, invoiceNumber),
type,
settlement_type,
@@ -407,6 +412,8 @@ export class SharedSaleInvoiceCreateService {
quantity: item.quantity,
unit_price: item.unit_price,
total_amount: item.total_amount,
discount_amount: item.discount_amount,
tax_amount: item.tax_amount,
measure_unit_text: goodsById.get(item.good_id!)?.measure_unit.name || null,
measure_unit_code: goodsById.get(item.good_id!)?.measure_unit.code || null,
sku_code: goodsById.get(item.good_id!)?.sku.code || null,