Merge pull request 'feat: 新版发票视图' (#430) from feat_invoices_view into @hera/dev
Reviewed-on: daoyoucloud/tachycode#430 Reviewed-by: sealday <zhanglin@daoyoucloud.com>
This commit is contained in:
commit
91875cf6ac
@ -1,32 +0,0 @@
|
|||||||
CREATE OR REPLACE VIEW
|
|
||||||
public.view_invoice AS
|
|
||||||
SELECT "createdAt",
|
|
||||||
"updatedAt",
|
|
||||||
sort,
|
|
||||||
"createdById",
|
|
||||||
"updatedById",
|
|
||||||
id,
|
|
||||||
seller_id,
|
|
||||||
purchaser_id,
|
|
||||||
category,
|
|
||||||
type,
|
|
||||||
"Invoicing_date",
|
|
||||||
comment,
|
|
||||||
number,
|
|
||||||
inclusive_amount,
|
|
||||||
name,
|
|
||||||
conten,
|
|
||||||
tax_rate,
|
|
||||||
tax_amount,
|
|
||||||
net_amount,
|
|
||||||
authentication_date,
|
|
||||||
state,
|
|
||||||
CASE
|
|
||||||
WHEN "type"::text = 'input_invoice'::text THEN seller_id
|
|
||||||
ELSE purchaser_id
|
|
||||||
END AS opposite_id,
|
|
||||||
CASE
|
|
||||||
WHEN "type"::text = 'input_invoice'::text THEN purchaser_id
|
|
||||||
ELSE seller_id
|
|
||||||
END AS company_id
|
|
||||||
FROM invoice_new;
|
|
@ -0,0 +1,63 @@
|
|||||||
|
CREATE OR REPLACE VIEW
|
||||||
|
public.view_invoice_all AS
|
||||||
|
SELECT
|
||||||
|
"createdAt",
|
||||||
|
"updatedAt",
|
||||||
|
"createdById",
|
||||||
|
"updatedById",
|
||||||
|
number,
|
||||||
|
seller_id,
|
||||||
|
purchaser_id,
|
||||||
|
category,
|
||||||
|
TYPE,
|
||||||
|
"Invoicing_date",
|
||||||
|
COMMENT,
|
||||||
|
inclusive_amount,
|
||||||
|
NAME,
|
||||||
|
CONTENT,
|
||||||
|
tax_rate,
|
||||||
|
tax_amount,
|
||||||
|
net_amount,
|
||||||
|
authentication_date,
|
||||||
|
state,
|
||||||
|
CASE
|
||||||
|
WHEN "type"::TEXT = 'input_invoice'::TEXT THEN seller_id
|
||||||
|
ELSE purchaser_id
|
||||||
|
END AS opposite_id,
|
||||||
|
CASE
|
||||||
|
WHEN "type"::TEXT = 'input_invoice'::TEXT THEN purchaser_id
|
||||||
|
ELSE seller_id
|
||||||
|
END AS company_id
|
||||||
|
FROM
|
||||||
|
invoice_input
|
||||||
|
UNION
|
||||||
|
SELECT
|
||||||
|
"createdAt",
|
||||||
|
"updatedAt",
|
||||||
|
"createdById",
|
||||||
|
"updatedById",
|
||||||
|
number,
|
||||||
|
seller_id,
|
||||||
|
purchaser_id,
|
||||||
|
category,
|
||||||
|
TYPE,
|
||||||
|
"Invoicing_date",
|
||||||
|
COMMENT,
|
||||||
|
inclusive_amount,
|
||||||
|
NAME,
|
||||||
|
CONTENT,
|
||||||
|
tax_rate,
|
||||||
|
tax_amount,
|
||||||
|
net_amount,
|
||||||
|
authentication_date,
|
||||||
|
state,
|
||||||
|
CASE
|
||||||
|
WHEN "type"::TEXT = 'input_invoice'::TEXT THEN seller_id
|
||||||
|
ELSE purchaser_id
|
||||||
|
END AS opposite_id,
|
||||||
|
CASE
|
||||||
|
WHEN "type"::TEXT = 'input_invoice'::TEXT THEN purchaser_id
|
||||||
|
ELSE seller_id
|
||||||
|
END AS company_id
|
||||||
|
FROM
|
||||||
|
invoice_output;
|
Loading…
Reference in New Issue
Block a user