First initial commit

This commit is contained in:
AzureAD\SylvainDUVERNAY
2026-01-07 14:38:55 +01:00
parent 0d02c89192
commit 022f4e0a2a
16 changed files with 587 additions and 2 deletions

31
vw_utility_invoices.sql Normal file
View File

@@ -0,0 +1,31 @@
-- View: public.vw_utility_invoices
-- DROP VIEW public.vw_utility_invoices;
CREATE OR REPLACE VIEW public.vw_utility_invoices AS
SELECT ai.id AS "intInvoiceId",
ai.company AS "intCompanyId",
cparty.name AS "strCompanyName",
ai.number AS "strInvoiceNumber",
ai.invoice_date AS "dtmInvoiceDate",
p.name AS "strPartyName",
ai.type AS "strInvoiceType",
aipt.name AS "strPaymentTerm",
ai.accounting_date AS "dtmAccountingDate",
ai.currency AS "intCurrencyId",
cc.name AS "strCurrencyCode",
ai.state AS "strInvoiceState",
ai.move AS "intMoveId",
ai.account AS "intAccountId",
aa.name AS "strAccountName"
FROM account_invoice ai
JOIN currency_currency cc ON ai.currency = cc.id
JOIN party_party p ON ai.party = p.id
JOIN company_company comp ON ai.company = comp.id
JOIN party_party cparty ON comp.party = cparty.id
JOIN account_invoice_payment_term aipt ON ai.payment_term = aipt.id
LEFT JOIN account_account aa ON ai.account = aa.id
WHERE 1 = 1;
ALTER TABLE public.vw_utility_invoices
OWNER TO postgres;