sales tax
This commit is contained in:
@@ -534,8 +534,8 @@ async function upsertTaxPeriod(period) {
|
||||
(period_start, period_end, total_sales, nontaxable_sales, taxable_sales, tax_collected,
|
||||
adjustment_amount, adjustment_reason, adjustment_account_id, adjustment_account_name,
|
||||
net_paid, bank_account_id, bank_account_name,
|
||||
sales_tax_payable_id, sales_tax_payable_name, status)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16)
|
||||
sales_tax_payable_id, sales_tax_payable_name, status, district_breakdown)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17)
|
||||
ON CONFLICT (period_start, period_end) DO UPDATE SET
|
||||
total_sales = EXCLUDED.total_sales,
|
||||
nontaxable_sales = EXCLUDED.nontaxable_sales,
|
||||
@@ -551,6 +551,9 @@ async function upsertTaxPeriod(period) {
|
||||
sales_tax_payable_id = COALESCE(sales_tax_periods.sales_tax_payable_id, EXCLUDED.sales_tax_payable_id),
|
||||
sales_tax_payable_name = COALESCE(sales_tax_periods.sales_tax_payable_name, EXCLUDED.sales_tax_payable_name),
|
||||
status = COALESCE(sales_tax_periods.status, EXCLUDED.status),
|
||||
-- Additiv: ein bereits festgehaltener Breakdown wird nie durch NULL
|
||||
-- ueberschrieben; Altperioden bleiben ohne Snapshot.
|
||||
district_breakdown = COALESCE(EXCLUDED.district_breakdown, sales_tax_periods.district_breakdown),
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
RETURNING *`,
|
||||
[
|
||||
@@ -560,7 +563,8 @@ async function upsertTaxPeriod(period) {
|
||||
period.adjustment_account_id || null, period.adjustment_account_name || null,
|
||||
period.net_paid || null, period.bank_account_id || null, period.bank_account_name || null,
|
||||
period.sales_tax_payable_id || null, period.sales_tax_payable_name || null,
|
||||
period.status || 'open'
|
||||
period.status || 'open',
|
||||
period.district_breakdown ? JSON.stringify(period.district_breakdown) : null
|
||||
]
|
||||
);
|
||||
return result.rows[0];
|
||||
|
||||
Reference in New Issue
Block a user