accounting_automation: сверка инвойсов с QuickBooks (invoice-reconcile), оплата независима от согласования, сумма и вендор из ленты, сводка Анастасии, правки finalize, поиска чека, проверки инвойса, chargeback; документы
Миграция 071: acc_discrepancies.reason и уникальный индекс открытых расхождений, уникальный открытый card_fraud по операции, insurer в разборе сертификатов. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -80,7 +80,7 @@ async function activeVendors(pool: Pool): Promise<Vendor[]> {
|
||||
const { rows } = await pool.query<{ vendor_name: string; vendor_qbo_id: string | null }>(
|
||||
`select vendor_name, vendor_qbo_id from acc_contracts where total_amount - retained_amount - paid_amount > 0
|
||||
union all
|
||||
select vendor_name, vendor_qbo_id from acc_invoices where stage in ('checking', 'to_approve', 'approved', 'wait')`,
|
||||
select vendor_name, vendor_qbo_id from acc_invoices where stage in ('checking', 'to_approve', 'approved', 'wait') and paid_on is null`,
|
||||
);
|
||||
const m = new Map<string, Vendor>();
|
||||
for (const r of rows) {
|
||||
@@ -243,7 +243,7 @@ export async function refreshInsuranceFlags(pool: Pool, today: string): Promise<
|
||||
const okKeys = new Set(certs.map((c) => normalizeVendorName(c.vendor_name)));
|
||||
const okQbo = new Set(certs.map((c) => c.vendor_qbo_id).filter((x): x is string => !!x));
|
||||
const { rows: inv } = await pool.query<{ id: string; vendor_name: string; vendor_qbo_id: string | null; no_insurance: boolean }>(
|
||||
"select id, vendor_name, vendor_qbo_id, no_insurance from acc_invoices where stage <> 'paid'",
|
||||
"select id, vendor_name, vendor_qbo_id, no_insurance from acc_invoices where stage <> 'paid' and paid_on is null",
|
||||
);
|
||||
const flip: { id: string; v: boolean }[] = [];
|
||||
for (const i of inv) {
|
||||
|
||||
Reference in New Issue
Block a user