29 lines
1.0 KiB
SQL
29 lines
1.0 KiB
SQL
CREATE OR REPLACE VIEW public.vw_utility_shipment_fees AS
|
|
SELECT f.id AS "intFeeId",
|
|
'ShipmentIn'::text AS "strShipmentType",
|
|
f.shipment_in AS "intShipmentId",
|
|
f.mode AS "strPackaging",
|
|
f.p_r AS "strPayOrRec",
|
|
f.type AS "strType",
|
|
p.code AS "strProduct",
|
|
sup.name AS "strSupplier",
|
|
f.state AS "strState",
|
|
CASE
|
|
WHEN (upper((f.weight_type)::text) = 'BRUT'::text) THEN 'Gross'::text
|
|
ELSE 'Net'::text
|
|
END AS "strWeightType",
|
|
f.quantity AS "dblQuantity",
|
|
f.price AS "dblPrice",
|
|
c.name AS "strCurrency",
|
|
COALESCE(uom.name, 'Mt'::character varying) AS "strUnit",
|
|
CASE
|
|
WHEN (upper((f.p_r)::text) = 'REC'::text) THEN 1
|
|
ELSE '-1'::integer
|
|
END AS "dblSignMultiplier"
|
|
FROM ((((fee_fee f
|
|
JOIN currency_currency c ON ((f.currency = c.id)))
|
|
JOIN product_product p ON ((f.product = p.id)))
|
|
LEFT JOIN product_uom uom ON ((f.unit = uom.id)))
|
|
JOIN party_party sup ON ((f.supplier = sup.id)))
|
|
WHERE (COALESCE(f.shipment_in, 0) > 0);;
|