Compare commits
6 Commits
091bd4ce00
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3986882771 | ||
|
|
79f6e6111f | ||
|
|
93b12de41d | ||
|
|
32b13838f2 | ||
|
|
32148a4a86 | ||
|
|
832a142e87 |
188
Database Backups/SQL Views/view_by_forex.sql
Normal file
188
Database Backups/SQL Views/view_by_forex.sql
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.view_by_forex AS
|
||||||
|
WITH contract_lines AS (
|
||||||
|
SELECT forex.id AS forex_id,
|
||||||
|
forex.number AS forex_number,
|
||||||
|
fcpc.id AS fcpc_id,
|
||||||
|
fcpc.amount AS forex_amount,
|
||||||
|
fcpc.amount AS forex_amount_for_all,
|
||||||
|
((fcpc.amount)::double precision * (((lh.quantity)::double precision * (unit.factor / unit_line.factor)) / pl.quantity)) AS line_amount,
|
||||||
|
((pl.unit_price)::double precision * ((lh.quantity)::double precision * (unit.factor / unit_line.factor))) AS qt_amount,
|
||||||
|
p.id AS purchase_id,
|
||||||
|
p.number AS purchase_number,
|
||||||
|
pl.id AS purchase_line_id,
|
||||||
|
pl.quantity,
|
||||||
|
pp.code AS product_code,
|
||||||
|
cc.code AS currency,
|
||||||
|
ll.lot_type,
|
||||||
|
ll.invoice_line,
|
||||||
|
ll.invoice_line_prov,
|
||||||
|
aml.reconciliation
|
||||||
|
FROM (((((((((((forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN purchase_purchase p ON ((fcpc.contract = p.id)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((p.currency = cc.id)))
|
||||||
|
LEFT JOIN lot_lot ll ON ((pl.id = ll.line)))
|
||||||
|
LEFT JOIN lot_qt_hist lh ON ((lh.lot = ll.id)))
|
||||||
|
LEFT JOIN lot_qt_type lt ON (((lh.quantity_type = lt.id) AND (lt.sequence = 1))))
|
||||||
|
LEFT JOIN product_uom unit ON ((unit.id = pl.unit)))
|
||||||
|
LEFT JOIN product_uom unit_line ON ((unit_line.id = ll.lot_unit_line)))
|
||||||
|
LEFT JOIN account_move_line aml ON (((split_part((aml.origin)::text, ','::text, 1) = 'invoice.line'::text) AND ((ll.invoice_line_prov = (split_part((aml.origin)::text, ','::text, 2))::integer) OR (ll.invoice_line = (split_part((aml.origin)::text, ','::text, 2))::integer)))))
|
||||||
|
WHERE ((forex.move IS NULL) AND (forex.buy_currency = 2))
|
||||||
|
), contracts_by_status AS (
|
||||||
|
SELECT contract_lines.forex_id,
|
||||||
|
contract_lines.forex_number,
|
||||||
|
contract_lines.fcpc_id,
|
||||||
|
contract_lines.line_amount,
|
||||||
|
contract_lines.forex_amount,
|
||||||
|
contract_lines.forex_amount_for_all,
|
||||||
|
contract_lines.qt_amount,
|
||||||
|
contract_lines.purchase_id,
|
||||||
|
contract_lines.purchase_number,
|
||||||
|
contract_lines.purchase_line_id,
|
||||||
|
contract_lines.quantity,
|
||||||
|
contract_lines.product_code,
|
||||||
|
contract_lines.currency,
|
||||||
|
contract_lines.lot_type,
|
||||||
|
contract_lines.invoice_line,
|
||||||
|
contract_lines.invoice_line_prov,
|
||||||
|
contract_lines.reconciliation,
|
||||||
|
CASE
|
||||||
|
WHEN ((contract_lines.lot_type)::text = 'virtual'::text) THEN 'open'::text
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND (contract_lines.invoice_line IS NULL) AND (contract_lines.invoice_line_prov IS NULL)) THEN 'shipped'::text
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND ((contract_lines.invoice_line IS NOT NULL) OR (contract_lines.invoice_line_prov IS NOT NULL)) AND ((contract_lines.reconciliation IS NULL) OR (contract_lines.reconciliation = 0))) THEN 'invoiced'::text
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND ((contract_lines.invoice_line IS NOT NULL) OR (contract_lines.invoice_line_prov IS NOT NULL)) AND (contract_lines.reconciliation > 0)) THEN 'paid'::text
|
||||||
|
ELSE 'total'::text
|
||||||
|
END AS qt_type,
|
||||||
|
CASE
|
||||||
|
WHEN ((contract_lines.lot_type)::text = 'virtual'::text) THEN 1
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND (contract_lines.invoice_line IS NULL) AND (contract_lines.invoice_line_prov IS NULL)) THEN 2
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND ((contract_lines.invoice_line IS NOT NULL) OR (contract_lines.invoice_line_prov IS NOT NULL)) AND ((contract_lines.reconciliation IS NULL) OR (contract_lines.reconciliation = 0))) THEN 3
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND ((contract_lines.invoice_line IS NOT NULL) OR (contract_lines.invoice_line_prov IS NOT NULL)) AND (contract_lines.reconciliation > 0)) THEN 4
|
||||||
|
ELSE 0
|
||||||
|
END AS qt_order
|
||||||
|
FROM contract_lines
|
||||||
|
), amounts_adjusted AS (
|
||||||
|
SELECT c.forex_id,
|
||||||
|
c.fcpc_id,
|
||||||
|
c.purchase_id,
|
||||||
|
c.purchase_number,
|
||||||
|
c.purchase_line_id,
|
||||||
|
c.product_code,
|
||||||
|
c.currency,
|
||||||
|
c.qt_type,
|
||||||
|
c.qt_order,
|
||||||
|
c.line_amount,
|
||||||
|
c.qt_amount,
|
||||||
|
NULL::numeric AS forex_amount,
|
||||||
|
GREATEST(LEAST(COALESCE(c.line_amount, (0)::double precision), ((COALESCE(c.forex_amount_for_all, (0)::numeric))::double precision - COALESCE(sum(COALESCE(c.line_amount, (0)::double precision)) OVER (PARTITION BY c.forex_id, c.fcpc_id ORDER BY c.qt_order DESC, c.purchase_line_id, c.invoice_line ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING), (0)::double precision))), (0)::double precision) AS amount_covered
|
||||||
|
FROM contracts_by_status c
|
||||||
|
WHERE (c.qt_type = ANY (ARRAY['paid'::text, 'invoiced'::text, 'shipped'::text, 'open'::text]))
|
||||||
|
), amounts_total AS (
|
||||||
|
SELECT a.forex_id,
|
||||||
|
a.fcpc_id,
|
||||||
|
a.purchase_id,
|
||||||
|
a.purchase_number,
|
||||||
|
NULL::integer AS purchase_line_id,
|
||||||
|
NULL::text AS product_code,
|
||||||
|
max((a.currency)::text) AS currency,
|
||||||
|
'total'::text AS qt_type,
|
||||||
|
5 AS qt_order,
|
||||||
|
NULL::numeric AS line_amount,
|
||||||
|
NULL::numeric AS qt_amount,
|
||||||
|
max(fcpc.amount) AS forex_amount,
|
||||||
|
NULL::numeric AS amount_covered
|
||||||
|
FROM (((forex_cover_physical_contract fcpc
|
||||||
|
JOIN purchase_purchase p ON ((fcpc.contract = p.id)))
|
||||||
|
JOIN forex_forex f ON ((f.id = fcpc.forex)))
|
||||||
|
JOIN amounts_adjusted a ON (((a.fcpc_id = fcpc.id) AND (a.purchase_id = p.id))))
|
||||||
|
GROUP BY a.forex_id, a.fcpc_id, a.purchase_id, a.purchase_number
|
||||||
|
), forex_summary AS (
|
||||||
|
SELECT forex.number AS forex_number,
|
||||||
|
'forex'::text AS line_type,
|
||||||
|
NULL::text AS purchase_number,
|
||||||
|
NULL::text AS purchase_line,
|
||||||
|
NULL::text AS qt_type,
|
||||||
|
0 AS qt_order,
|
||||||
|
max(forex.rate) AS rate,
|
||||||
|
NULL::numeric AS amount_covered,
|
||||||
|
NULL::numeric AS forex_amount,
|
||||||
|
NULL::numeric AS qt_amount,
|
||||||
|
forex.buy_amount AS total_amount_forex,
|
||||||
|
(forex.buy_amount - COALESCE(sum(fcpc.amount), (0)::numeric)) AS amount_remaining,
|
||||||
|
max((cc.code)::text) AS currency,
|
||||||
|
forex.value_date AS maturity_date,
|
||||||
|
forex.move
|
||||||
|
FROM ((forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((forex.buy_currency = cc.id)))
|
||||||
|
WHERE ((forex.move IS NULL) AND (forex.buy_currency = 2))
|
||||||
|
GROUP BY forex.id, forex.number, forex.buy_amount
|
||||||
|
)
|
||||||
|
SELECT forex_summary.forex_number,
|
||||||
|
forex_summary.line_type,
|
||||||
|
forex_summary.purchase_number,
|
||||||
|
forex_summary.purchase_line,
|
||||||
|
forex_summary.qt_type,
|
||||||
|
forex_summary.qt_order,
|
||||||
|
forex_summary.rate,
|
||||||
|
forex_summary.amount_covered,
|
||||||
|
forex_summary.forex_amount,
|
||||||
|
forex_summary.qt_amount,
|
||||||
|
forex_summary.total_amount_forex,
|
||||||
|
forex_summary.amount_remaining,
|
||||||
|
forex_summary.currency,
|
||||||
|
forex_summary.maturity_date,
|
||||||
|
CASE
|
||||||
|
WHEN (forex_summary.move > 0) THEN 'executed'::text
|
||||||
|
ELSE 'not executed'::text
|
||||||
|
END AS executed
|
||||||
|
FROM forex_summary
|
||||||
|
UNION ALL
|
||||||
|
SELECT c.number AS forex_number,
|
||||||
|
'contract'::text AS line_type,
|
||||||
|
a.purchase_number,
|
||||||
|
((a.product_code)::text || COALESCE(((' ('::text || a.purchase_line_id) || ')'::text), ''::text)) AS purchase_line,
|
||||||
|
a.qt_type,
|
||||||
|
a.qt_order,
|
||||||
|
NULL::numeric AS rate,
|
||||||
|
a.amount_covered,
|
||||||
|
a.forex_amount,
|
||||||
|
a.qt_amount,
|
||||||
|
NULL::numeric AS total_amount_forex,
|
||||||
|
NULL::numeric AS amount_remaining,
|
||||||
|
a.currency,
|
||||||
|
NULL::date AS maturity_date,
|
||||||
|
NULL::text AS executed
|
||||||
|
FROM (( SELECT amounts_adjusted.forex_id,
|
||||||
|
amounts_adjusted.fcpc_id,
|
||||||
|
amounts_adjusted.purchase_id,
|
||||||
|
amounts_adjusted.purchase_number,
|
||||||
|
amounts_adjusted.purchase_line_id,
|
||||||
|
amounts_adjusted.product_code,
|
||||||
|
amounts_adjusted.currency,
|
||||||
|
amounts_adjusted.qt_type,
|
||||||
|
amounts_adjusted.qt_order,
|
||||||
|
amounts_adjusted.line_amount,
|
||||||
|
amounts_adjusted.qt_amount,
|
||||||
|
amounts_adjusted.forex_amount,
|
||||||
|
amounts_adjusted.amount_covered
|
||||||
|
FROM amounts_adjusted
|
||||||
|
UNION ALL
|
||||||
|
SELECT amounts_total.forex_id,
|
||||||
|
amounts_total.fcpc_id,
|
||||||
|
amounts_total.purchase_id,
|
||||||
|
amounts_total.purchase_number,
|
||||||
|
amounts_total.purchase_line_id,
|
||||||
|
amounts_total.product_code,
|
||||||
|
amounts_total.currency,
|
||||||
|
amounts_total.qt_type,
|
||||||
|
amounts_total.qt_order,
|
||||||
|
amounts_total.line_amount,
|
||||||
|
amounts_total.qt_amount,
|
||||||
|
amounts_total.forex_amount,
|
||||||
|
amounts_total.amount_covered
|
||||||
|
FROM amounts_total) a
|
||||||
|
JOIN forex_forex c ON ((c.id = a.forex_id)))
|
||||||
|
ORDER BY 1, 2 DESC, 3, 6 DESC;;
|
||||||
34
Database Backups/SQL Views/view_contract_blocked.sql
Normal file
34
Database Backups/SQL Views/view_contract_blocked.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.view_contract_blocked AS
|
||||||
|
SELECT p.number AS purchase_number,
|
||||||
|
'contract'::text AS line_type,
|
||||||
|
NULL::character varying AS forex_number,
|
||||||
|
NULL::numeric AS amount_covered,
|
||||||
|
string_agg(DISTINCT (pp.code)::text, ', '::text) AS products,
|
||||||
|
max((pl.quantity * (pl.unit_price)::double precision)) AS total_contract_value,
|
||||||
|
(max((pl.quantity * (pl.unit_price)::double precision)) - (sum(fcpc.amount))::double precision) AS amount_remaining,
|
||||||
|
max((cc.code)::text) AS currency,
|
||||||
|
NULL::numeric AS rate,
|
||||||
|
NULL::date AS maturity_date
|
||||||
|
FROM ((((purchase_purchase p
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((fcpc.contract = p.id)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((p.currency = cc.id)))
|
||||||
|
WHERE (p.currency = 2)
|
||||||
|
GROUP BY p.number, pl.id
|
||||||
|
UNION ALL
|
||||||
|
SELECT p.number AS purchase_number,
|
||||||
|
'forex'::text AS line_type,
|
||||||
|
forex.number AS forex_number,
|
||||||
|
fcpc.amount AS amount_covered,
|
||||||
|
NULL::text AS products,
|
||||||
|
NULL::numeric AS total_contract_value,
|
||||||
|
NULL::numeric AS amount_remaining,
|
||||||
|
cc.code AS currency,
|
||||||
|
forex.rate,
|
||||||
|
forex.value_date AS maturity_date
|
||||||
|
FROM (((purchase_purchase p
|
||||||
|
JOIN forex_cover_physical_contract fcpc ON ((fcpc.contract = p.id)))
|
||||||
|
LEFT JOIN forex_forex forex ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((forex.buy_currency = cc.id)))
|
||||||
|
ORDER BY 1, 2;;
|
||||||
98
Database Backups/SQL Views/view_forex_blocked.sql
Normal file
98
Database Backups/SQL Views/view_forex_blocked.sql
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.view_forex_blocked AS
|
||||||
|
SELECT forex.number AS forex_number,
|
||||||
|
'forex'::text AS line_type,
|
||||||
|
NULL::character varying AS purchase_number,
|
||||||
|
NULL::text AS purchase_line,
|
||||||
|
NULL::text AS qt_type,
|
||||||
|
max(forex.rate) AS rate,
|
||||||
|
NULL::numeric AS amount_covered,
|
||||||
|
forex.buy_amount AS total_amount_forex,
|
||||||
|
(forex.buy_amount - COALESCE(sum(fcpc.amount), (0)::numeric)) AS amount_remaining,
|
||||||
|
max((cc.code)::text) AS currency,
|
||||||
|
forex.value_date AS maturity_date
|
||||||
|
FROM ((forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((forex.buy_currency = cc.id)))
|
||||||
|
GROUP BY forex.id, forex.number, forex.buy_amount
|
||||||
|
UNION ALL
|
||||||
|
SELECT forex.number AS forex_number,
|
||||||
|
'contract'::text AS line_type,
|
||||||
|
p.number AS purchase_number,
|
||||||
|
((((pp.code)::text || ' ('::text) || pl.quantity) || ')'::text) AS purchase_line,
|
||||||
|
'open'::text AS qt_type,
|
||||||
|
NULL::numeric AS rate,
|
||||||
|
fcpc.amount AS amount_covered,
|
||||||
|
NULL::numeric AS total_amount_forex,
|
||||||
|
NULL::numeric AS amount_remaining,
|
||||||
|
cc.code AS currency,
|
||||||
|
NULL::date AS maturity_date
|
||||||
|
FROM ((((((forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN purchase_purchase p ON ((fcpc.contract = p.id)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((p.currency = cc.id)))
|
||||||
|
LEFT JOIN lot_lot ll ON ((pl.id = ll.line)))
|
||||||
|
WHERE ((ll.lot_type)::text = 'virtual'::text)
|
||||||
|
UNION ALL
|
||||||
|
SELECT forex.number AS forex_number,
|
||||||
|
'contract'::text AS line_type,
|
||||||
|
p.number AS purchase_number,
|
||||||
|
((((pp.code)::text || ' ('::text) || pl.quantity) || ')'::text) AS purchase_line,
|
||||||
|
'shipped'::text AS qt_type,
|
||||||
|
NULL::numeric AS rate,
|
||||||
|
fcpc.amount AS amount_covered,
|
||||||
|
NULL::numeric AS total_amount_forex,
|
||||||
|
NULL::numeric AS amount_remaining,
|
||||||
|
cc.code AS currency,
|
||||||
|
NULL::date AS maturity_date
|
||||||
|
FROM ((((((forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN purchase_purchase p ON ((fcpc.contract = p.id)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((p.currency = cc.id)))
|
||||||
|
LEFT JOIN lot_lot ll ON ((pl.id = ll.line)))
|
||||||
|
WHERE (((ll.lot_type)::text = 'physic'::text) AND (ll.invoice_line_prov IS NULL) AND (ll.invoice_line IS NULL))
|
||||||
|
UNION ALL
|
||||||
|
SELECT forex.number AS forex_number,
|
||||||
|
'contract'::text AS line_type,
|
||||||
|
p.number AS purchase_number,
|
||||||
|
((((pp.code)::text || ' ('::text) || pl.quantity) || ')'::text) AS purchase_line,
|
||||||
|
'invoiced'::text AS qt_type,
|
||||||
|
NULL::numeric AS rate,
|
||||||
|
fcpc.amount AS amount_covered,
|
||||||
|
NULL::numeric AS total_amount_forex,
|
||||||
|
NULL::numeric AS amount_remaining,
|
||||||
|
cc.code AS currency,
|
||||||
|
NULL::date AS maturity_date
|
||||||
|
FROM ((((((forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN purchase_purchase p ON ((fcpc.contract = p.id)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((p.currency = cc.id)))
|
||||||
|
LEFT JOIN lot_lot ll ON ((pl.id = ll.line)))
|
||||||
|
WHERE (((ll.lot_type)::text = 'physic'::text) AND ((ll.invoice_line_prov > 0) OR (ll.invoice_line > 0)))
|
||||||
|
UNION ALL
|
||||||
|
SELECT forex.number AS forex_number,
|
||||||
|
'contract'::text AS line_type,
|
||||||
|
p.number AS purchase_number,
|
||||||
|
((((pp.code)::text || ' ('::text) || pl.quantity) || ')'::text) AS purchase_line,
|
||||||
|
'paid'::text AS qt_type,
|
||||||
|
NULL::numeric AS rate,
|
||||||
|
fcpc.amount AS amount_covered,
|
||||||
|
NULL::numeric AS total_amount_forex,
|
||||||
|
NULL::numeric AS amount_remaining,
|
||||||
|
cc.code AS currency,
|
||||||
|
NULL::date AS maturity_date
|
||||||
|
FROM (((((((forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN purchase_purchase p ON ((fcpc.contract = p.id)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((p.currency = cc.id)))
|
||||||
|
LEFT JOIN lot_lot ll ON ((pl.id = ll.line)))
|
||||||
|
LEFT JOIN account_move_line aml ON (((split_part((aml.origin)::text, ','::text, 1) = 'invoice.line'::text) AND ((ll.invoice_line_prov = (split_part((aml.origin)::text, ','::text, 2))::integer) OR (ll.invoice_line = (split_part((aml.origin)::text, ','::text, 2))::integer)))))
|
||||||
|
WHERE (((ll.lot_type)::text = 'physic'::text) AND ((ll.invoice_line_prov > 0) OR (ll.invoice_line > 0)) AND (aml.reconciliation > 0))
|
||||||
|
ORDER BY 1, 2 DESC;;
|
||||||
15
Database Backups/SQL Views/view_forex_summary.sql
Normal file
15
Database Backups/SQL Views/view_forex_summary.sql
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.view_forex_summary AS
|
||||||
|
SELECT forex.number AS forex_number,
|
||||||
|
fcpc.id AS coverage_id,
|
||||||
|
p.number AS purchase_number,
|
||||||
|
pp.code AS product_code,
|
||||||
|
pl.quantity AS purchase_quantity,
|
||||||
|
fcpc.amount AS amount_covered,
|
||||||
|
forex.for_amount AS forex_amount,
|
||||||
|
sum(fcpc.amount) OVER (PARTITION BY forex.id ORDER BY fcpc.id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_covered,
|
||||||
|
(forex.for_amount - sum(fcpc.amount) OVER (PARTITION BY forex.id ORDER BY fcpc.id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)) AS balance
|
||||||
|
FROM ((((forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN purchase_purchase p ON ((fcpc.contract = p.id)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)));;
|
||||||
39
Database Backups/SQL Views/vw_bi_dim_conformed_reference.sql
Normal file
39
Database Backups/SQL Views/vw_bi_dim_conformed_reference.sql
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_dim_conformed_reference AS
|
||||||
|
SELECT pc."strTradeId" AS "strConformedReferenceId",
|
||||||
|
pc."Contract Ref" AS "Conformed Trade Ref",
|
||||||
|
'Purchase'::text AS "Trade Type",
|
||||||
|
pc."Price Fixing Status",
|
||||||
|
pc."Bassin",
|
||||||
|
pc."Book",
|
||||||
|
pc."Supplier Country" AS "Counterparty Country"
|
||||||
|
FROM vw_bi_dim_purchase_physical_contract pc
|
||||||
|
WHERE ((1 = 1) AND (pc."intPurchaseLineId" > 0))
|
||||||
|
UNION ALL
|
||||||
|
SELECT sc."strTradeLineId" AS "strConformedReferenceId",
|
||||||
|
sc."Contract Ref" AS "Conformed Trade Ref",
|
||||||
|
'Sale'::text AS "Trade Type",
|
||||||
|
sc."Price Fixing Status",
|
||||||
|
sc."Bassin",
|
||||||
|
sc."Book",
|
||||||
|
sc."Customer Country" AS "Counterparty Country"
|
||||||
|
FROM vw_bi_dim_sale_physical_contract sc
|
||||||
|
WHERE ((1 = 1) AND (sc."intSaleLineId" > 0))
|
||||||
|
UNION ALL
|
||||||
|
SELECT DISTINCT ((s."intPurchaseLineId" || '_'::text) || s."intSaleLineId") AS "strConformedReferenceId",
|
||||||
|
CASE
|
||||||
|
WHEN ((pc."Contract Ref")::text <> (sc."Contract Ref")::text) THEN ((((pc."Contract Ref")::text || ' / '::text) || (sc."Contract Ref")::text))::character varying
|
||||||
|
ELSE pc."Contract Ref"
|
||||||
|
END AS "Conformed Trade Ref",
|
||||||
|
'Shipped'::text AS "Trade Type",
|
||||||
|
CASE
|
||||||
|
WHEN ((pc."Price Fixing Status" = sc."Price Fixing Status") AND (pc."Price Fixing Status" = 'Fixed'::text)) THEN 'Fixed'::text
|
||||||
|
WHEN ((pc."Price Fixing Status" = sc."Price Fixing Status") AND (pc."Price Fixing Status" = 'Unfixed'::text)) THEN 'Unfixed'::text
|
||||||
|
ELSE 'Partially Fixed'::text
|
||||||
|
END AS "Price Fixing Status",
|
||||||
|
pc."Bassin",
|
||||||
|
pc."Book",
|
||||||
|
sc."Customer Country" AS "Counterparty Country"
|
||||||
|
FROM ((vw_bi_itsa_fct_shipments s
|
||||||
|
JOIN vw_bi_dim_purchase_physical_contract pc ON ((s."intPurchaseLineId" = pc."intPurchaseLineId")))
|
||||||
|
JOIN vw_bi_dim_sale_physical_contract sc ON ((s."intSaleLineId" = sc."intSaleLineId")))
|
||||||
|
WHERE (1 = 1);;
|
||||||
6
Database Backups/SQL Views/vw_bi_dim_location.sql
Normal file
6
Database Backups/SQL Views/vw_bi_dim_location.sql
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_dim_location AS
|
||||||
|
SELECT "intLocationId",
|
||||||
|
"strLocationName" AS "Location",
|
||||||
|
"strLocationType" AS "Location Type"
|
||||||
|
FROM vw_utility_location
|
||||||
|
WHERE ("ysnIsActive" = true);;
|
||||||
14
Database Backups/SQL Views/vw_bi_dim_price_curve.sql
Normal file
14
Database Backups/SQL Views/vw_bi_dim_price_curve.sql
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_dim_price_curve AS
|
||||||
|
SELECT "intPriceCurveId",
|
||||||
|
"strPriceDescription" AS "Description",
|
||||||
|
"strPriceIndex" AS "Index",
|
||||||
|
"strCurrency" AS "Currency",
|
||||||
|
"strUnit" AS "Unit",
|
||||||
|
"strPriceCurveType" AS "Type",
|
||||||
|
"strPriceArea" AS "Area",
|
||||||
|
"strPriceCalendar" AS "Calendard",
|
||||||
|
"strPricingType" AS "Pricing Type",
|
||||||
|
"dtmPricingStartDate" AS "Pricing Start Date",
|
||||||
|
"dtmPricingEndDate" AS "Pricing End Date",
|
||||||
|
"strPricingMonth" AS "Pricing Month"
|
||||||
|
FROM vw_utility_price_curve p;;
|
||||||
9
Database Backups/SQL Views/vw_bi_dim_product.sql
Normal file
9
Database Backups/SQL Views/vw_bi_dim_product.sql
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_dim_product AS
|
||||||
|
SELECT "intProductId",
|
||||||
|
"strProductCode" AS "Product Code",
|
||||||
|
"strProductDescription" AS "Description",
|
||||||
|
"ysnActive" AS "Is Active",
|
||||||
|
"strTemplate" AS "Template",
|
||||||
|
"strTemplateCode" AS "Template Code",
|
||||||
|
"strDefaultUom" AS "Default Uom"
|
||||||
|
FROM vw_utility_product pr;;
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_dim_purchase_physical_contract AS
|
||||||
|
WITH pricingstatus AS (
|
||||||
|
SELECT pvl_1."intContractLineId",
|
||||||
|
pvl_1."strState"
|
||||||
|
FROM vw_utility_physical_valuation_line pvl_1
|
||||||
|
GROUP BY pvl_1."intContractLineId", pvl_1."strState"
|
||||||
|
)
|
||||||
|
SELECT dpc."intPurchaseLineId",
|
||||||
|
dpc."strContractNb" AS "Contract Nb",
|
||||||
|
dpc."strCounterparty" AS "Supplier",
|
||||||
|
dpc."strReference" AS "Contract Ref",
|
||||||
|
dpc."dtmContractDate" AS "Contract Date",
|
||||||
|
CASE
|
||||||
|
WHEN ((dpc."strContractStatus")::text = 'Draft'::text) THEN (((dpc."strContractStatus")::text || ' 🧾'::text))::character varying
|
||||||
|
WHEN ((dpc."strContractStatus")::text = 'Confirmed'::text) THEN (((dpc."strContractStatus")::text || ' ✅'::text))::character varying
|
||||||
|
WHEN ((dpc."strContractStatus")::text = 'Validated'::text) THEN (((dpc."strContractStatus")::text || ' ✔️'::text))::character varying
|
||||||
|
WHEN ((dpc."strContractStatus")::text = 'Processing'::text) THEN (((dpc."strContractStatus")::text || ' ⏳'::text))::character varying
|
||||||
|
ELSE dpc."strContractStatus"
|
||||||
|
END AS "Contract Status",
|
||||||
|
dpc."strPaymentTerm" AS "Payment Terms",
|
||||||
|
dpc."strCurrency" AS "Currency",
|
||||||
|
dpc."strWeightBasis" AS "Weight Basis",
|
||||||
|
dpc."strBroker" AS "Broker",
|
||||||
|
dpc."strCertif" AS "Certification",
|
||||||
|
dpc."strAssociation" AS "Association",
|
||||||
|
dpc."strCrop" AS "Crop",
|
||||||
|
dpc."dblTolMinPct" AS "Tolerance Min %",
|
||||||
|
dpc."dblTolMaxPct" AS "Tolerance Max %",
|
||||||
|
dpc."strIncoterm" AS "Inco Terms",
|
||||||
|
dpc."strLoadingPlace" AS "Loading Place",
|
||||||
|
dpc."strDestinationPlace" AS "Destination Place",
|
||||||
|
dpc."strProduct" AS "Product",
|
||||||
|
dpc."strDeliveryPeriod" AS "Delivery Period",
|
||||||
|
dpc."strRegion" AS "Bassin",
|
||||||
|
dpc."strBookName" AS "Book",
|
||||||
|
dpc."strStrategyName" AS "Strategy",
|
||||||
|
dpc."strQuantityUom" AS "Quantity UOM",
|
||||||
|
dpc."dtmDeliveryDateFrom" AS "Delivery Date From",
|
||||||
|
dpc."dtmDeliveryDateTo" AS "Delivery Date To",
|
||||||
|
CASE
|
||||||
|
WHEN (dpc."dtmDeliveryDateTo" < CURRENT_DATE) THEN 'Overdue'::text
|
||||||
|
WHEN ((dpc."dtmDeliveryDateFrom" <= CURRENT_DATE) AND (dpc."dtmDeliveryDateTo" >= CURRENT_DATE)) THEN 'Current'::text
|
||||||
|
WHEN (dpc."dtmDeliveryDateFrom" > CURRENT_DATE) THEN 'Future'::text
|
||||||
|
ELSE 'Unknown'::text
|
||||||
|
END AS "Delivery Status",
|
||||||
|
CASE
|
||||||
|
WHEN ((dpc."strBookName")::text ~~ '%Projection%'::text) THEN 'Yes'::text
|
||||||
|
ELSE 'No'::text
|
||||||
|
END AS "Is Projection",
|
||||||
|
dpc."strIncotermCode" AS "Incoterm Code",
|
||||||
|
dpc."dtmEstimatedBLDate" AS "Estimated BL Date",
|
||||||
|
dpc."strPricingType" AS "Pricing Type",
|
||||||
|
COALESCE(mtm."strStrategy", 'Undefined'::character varying) AS "MtM Strategy",
|
||||||
|
COALESCE(mtm."strScenario", 'Undefined'::character varying) AS "MtM Scenario",
|
||||||
|
COALESCE(mtm."strComponentCurve", 'Undefined'::character varying) AS "MtM Component Curve",
|
||||||
|
dpc."strCounterpartyCountry" AS "Supplier Country",
|
||||||
|
COALESCE(pvl."strState", ('Undefined'::character varying)::text) AS "Price Fixing Status",
|
||||||
|
(dpc."intPurchaseLineId" || '_0'::text) AS "strTradeId"
|
||||||
|
FROM ((vw_utility_dim_physical_purchase_contract dpc
|
||||||
|
LEFT JOIN vw_utility_physical_mtm_definition mtm ON (((dpc."intPurchaseLineId" = mtm."intContractLineId") AND (mtm."strContractType" = 'Purchase'::text) AND ((mtm."strComponentFixType")::text = 'Market price'::text))))
|
||||||
|
LEFT JOIN pricingstatus pvl ON ((dpc."intPurchaseLineId" = pvl."intContractLineId")));;
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_dim_sale_physical_contract AS
|
||||||
|
WITH pricingstatus AS (
|
||||||
|
SELECT pvl_1."intContractLineId",
|
||||||
|
pvl_1."strState"
|
||||||
|
FROM vw_utility_physical_valuation_line pvl_1
|
||||||
|
GROUP BY pvl_1."intContractLineId", pvl_1."strState"
|
||||||
|
)
|
||||||
|
SELECT dpc."intSaleLineId",
|
||||||
|
dpc."strContractNb" AS "Contract Nb",
|
||||||
|
dpc."strCounterparty" AS "Customer",
|
||||||
|
dpc."strReference" AS "Contract Ref",
|
||||||
|
dpc."dtmContractDate" AS "Contract Date",
|
||||||
|
CASE
|
||||||
|
WHEN ((dpc."strContractStatus")::text = 'Draft'::text) THEN (((dpc."strContractStatus")::text || ' 🧾'::text))::character varying
|
||||||
|
WHEN ((dpc."strContractStatus")::text = 'Confirmed'::text) THEN (((dpc."strContractStatus")::text || ' ✅'::text))::character varying
|
||||||
|
WHEN ((dpc."strContractStatus")::text = 'Validated'::text) THEN (((dpc."strContractStatus")::text || ' ✔️'::text))::character varying
|
||||||
|
WHEN ((dpc."strContractStatus")::text = 'Processing'::text) THEN (((dpc."strContractStatus")::text || ' ⏳'::text))::character varying
|
||||||
|
ELSE dpc."strContractStatus"
|
||||||
|
END AS "Contract Status",
|
||||||
|
dpc."strPaymentTerm" AS "Payment Terms",
|
||||||
|
dpc."strCurrency" AS "Currency",
|
||||||
|
dpc."strWeightBasis" AS "Weight Basis",
|
||||||
|
dpc."strBroker" AS "Broker",
|
||||||
|
dpc."strCertif" AS "Certification",
|
||||||
|
dpc."strAssociation" AS "Association",
|
||||||
|
dpc."strCrop" AS "Crop",
|
||||||
|
dpc."dblTolMinPct" AS "Tolerance Min %",
|
||||||
|
dpc."dblTolMaxPct" AS "Tolerance Max %",
|
||||||
|
dpc."strIncoterm" AS "Inco Terms",
|
||||||
|
dpc."strLoadingPlace" AS "Loading Place",
|
||||||
|
dpc."strDestinationPlace" AS "Destination Place",
|
||||||
|
dpc."strProduct" AS "Product",
|
||||||
|
dpc."strDeliveryPeriod" AS "Delivery Period",
|
||||||
|
dpc."strQuantityUom" AS "Quantity UOM",
|
||||||
|
dpc."dtmDeliveryDateFrom" AS "Delivery Date From",
|
||||||
|
dpc."dtmDeliveryDateTo" AS "Delivery Date To",
|
||||||
|
CASE
|
||||||
|
WHEN (dpc."dtmDeliveryDateTo" < CURRENT_DATE) THEN 'Overdue'::text
|
||||||
|
WHEN ((dpc."dtmDeliveryDateFrom" <= CURRENT_DATE) AND (dpc."dtmDeliveryDateTo" >= CURRENT_DATE)) THEN 'Current'::text
|
||||||
|
WHEN (dpc."dtmDeliveryDateFrom" > CURRENT_DATE) THEN 'Future'::text
|
||||||
|
ELSE 'Unknown'::text
|
||||||
|
END AS "Delivery Status",
|
||||||
|
dpc."strRegion" AS "Bassin",
|
||||||
|
dpc."strBookName" AS "Book",
|
||||||
|
dpc."strStrategyName" AS "Strategy",
|
||||||
|
CASE
|
||||||
|
WHEN ((dpc."strBookName")::text ~~ '%Projection%'::text) THEN 'Yes'::text
|
||||||
|
ELSE 'No'::text
|
||||||
|
END AS "Is Projection",
|
||||||
|
dpc."strIncotermCode" AS "Incoterm Code",
|
||||||
|
dpc."dtmEstimatedBLDate" AS "Estimated BL Date",
|
||||||
|
dpc."strPricingType" AS "Pricing Type",
|
||||||
|
COALESCE(mtm."strStrategy", 'Undefined'::character varying) AS "MtM Strategy",
|
||||||
|
COALESCE(mtm."strScenario", 'Undefined'::character varying) AS "MtM Scenario",
|
||||||
|
COALESCE(mtm."strComponentCurve", 'Undefined'::character varying) AS "MtM Component Curve",
|
||||||
|
dpc."strCounterpartyCountry" AS "Customer Country",
|
||||||
|
COALESCE(pvl."strState", ('Undefined'::character varying)::text) AS "Price Fixing Status",
|
||||||
|
('0_'::text || dpc."intSaleLineId") AS "strTradeLineId"
|
||||||
|
FROM ((vw_utility_dim_physical_sale_contract dpc
|
||||||
|
LEFT JOIN vw_utility_physical_mtm_definition mtm ON (((dpc."intSaleLineId" = mtm."intContractLineId") AND (mtm."strContractType" = 'Sale'::text) AND ((mtm."strComponentFixType")::text = 'Market price'::text))))
|
||||||
|
LEFT JOIN pricingstatus pvl ON ((dpc."intSaleLineId" = pvl."intContractLineId")));;
|
||||||
13
Database Backups/SQL Views/vw_bi_dim_shipment.sql
Normal file
13
Database Backups/SQL Views/vw_bi_dim_shipment.sql
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_dim_shipment AS
|
||||||
|
SELECT "intShipmentId",
|
||||||
|
"strShipmentNb" AS "Shipment Nb",
|
||||||
|
"strBillOfLading" AS "BL Number",
|
||||||
|
"dtmBillOfLadingDate" AS "BL Date",
|
||||||
|
"strState" AS "State",
|
||||||
|
"strFromLocation" AS "From Location",
|
||||||
|
"strToLocation" AS "To Location",
|
||||||
|
"strVessel" AS "Vessel",
|
||||||
|
"strCarrier" AS "Carrier",
|
||||||
|
"strSupplier" AS "Supplier",
|
||||||
|
"strCargoMode" AS "Cargo Mode"
|
||||||
|
FROM vw_utility_shipment_in s;;
|
||||||
28
Database Backups/SQL Views/vw_bi_dim_trade.sql
Normal file
28
Database Backups/SQL Views/vw_bi_dim_trade.sql
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_dim_trade AS
|
||||||
|
SELECT pc."intPurchaseLineId" AS "intTradeId",
|
||||||
|
(pc."intPurchaseLineId" || '_0'::text) AS "strTradeId",
|
||||||
|
'Physical'::text AS "Trade Category",
|
||||||
|
'Purchase'::text AS "Trade Type",
|
||||||
|
pc."strReference" AS "Trade Ref",
|
||||||
|
pc."strContractNb" AS "Trade Number",
|
||||||
|
pc."dtmContractDate" AS "Trade Date",
|
||||||
|
pc."strCounterparty" AS "Counterparty",
|
||||||
|
pc."strRegion" AS "Bassin",
|
||||||
|
pc."strBookName" AS "Book",
|
||||||
|
pc."strStrategyName" AS "Strategy"
|
||||||
|
FROM vw_utility_dim_physical_purchase_contract pc
|
||||||
|
WHERE ((1 = 1) AND (pc."intPurchaseLineId" > 0))
|
||||||
|
UNION ALL
|
||||||
|
SELECT sc."intSaleLineId" AS "intTradeId",
|
||||||
|
('0_'::text || sc."intSaleLineId") AS "strTradeId",
|
||||||
|
'Physical'::text AS "Trade Category",
|
||||||
|
'Sale'::text AS "Trade Type",
|
||||||
|
sc."strReference" AS "Trade Ref",
|
||||||
|
sc."strContractNb" AS "Trade Number",
|
||||||
|
sc."dtmContractDate" AS "Trade Date",
|
||||||
|
sc."strCounterparty" AS "Counterparty",
|
||||||
|
sc."strRegion" AS "Bassin",
|
||||||
|
sc."strBookName" AS "Book",
|
||||||
|
sc."strStrategyName" AS "Strategy"
|
||||||
|
FROM vw_utility_dim_physical_sale_contract sc
|
||||||
|
WHERE ((1 = 1) AND (sc."intSaleLineId" > 0));;
|
||||||
79
Database Backups/SQL Views/vw_bi_fct_open_position.sql
Normal file
79
Database Backups/SQL Views/vw_bi_fct_open_position.sql
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_fct_open_position AS
|
||||||
|
WITH purchase_position AS (
|
||||||
|
SELECT contracts."intTradeId",
|
||||||
|
contracts."Trade Category",
|
||||||
|
contracts."Trade Type",
|
||||||
|
contracts."Delivery Date",
|
||||||
|
to_char((contracts."Delivery Date")::timestamp with time zone, 'YYYY-MM'::text) AS delivery_month,
|
||||||
|
to_char((contracts."Delivery Date")::timestamp with time zone, 'Mon YYYY'::text) AS delivery_month_label,
|
||||||
|
to_char((contracts."Delivery Date")::timestamp with time zone, 'YYYYMM'::text) AS delivery_month_code,
|
||||||
|
contracts."Quantity",
|
||||||
|
(contracts."Quantity" - COALESCE(delivery.delivered_quantity, (0)::double precision)) AS "Open Position Quantity",
|
||||||
|
(((('Deal '::text || (dc."Contract Nb")::text) || ' ('::text) || (dc."Contract Ref")::text) || ')'::text) AS "Label"
|
||||||
|
FROM ((vw_bi_fct_trade_line contracts
|
||||||
|
JOIN vw_bi_dim_purchase_physical_contract dc ON ((contracts."intTradeId" = dc."intPurchaseLineId")))
|
||||||
|
LEFT JOIN ( SELECT ffe."intTradeId",
|
||||||
|
sum(ffe."Quantity") AS delivered_quantity
|
||||||
|
FROM vw_bi_fct_trade_fulfillment_event ffe
|
||||||
|
WHERE ((ffe."Trade Category" = 'Physical'::text) AND (ffe."Trade Type" = 'Purchase'::text))
|
||||||
|
GROUP BY ffe."intTradeId") delivery ON ((contracts."intTradeId" = delivery."intTradeId")))
|
||||||
|
WHERE ((1 = 1) AND (contracts."Trade Category" = 'Physical'::text) AND (contracts."Trade Type" = 'Purchase'::text))
|
||||||
|
), sale_position AS (
|
||||||
|
SELECT contracts."intTradeId",
|
||||||
|
contracts."Trade Category",
|
||||||
|
contracts."Trade Type",
|
||||||
|
contracts."Delivery Date",
|
||||||
|
to_char((contracts."Delivery Date")::timestamp with time zone, 'YYYY-MM'::text) AS delivery_month,
|
||||||
|
to_char((contracts."Delivery Date")::timestamp with time zone, 'Mon YYYY'::text) AS delivery_month_label,
|
||||||
|
to_char((contracts."Delivery Date")::timestamp with time zone, 'YYYYMM'::text) AS delivery_month_code,
|
||||||
|
contracts."Quantity",
|
||||||
|
((contracts."Quantity" - COALESCE(delivery.delivered_quantity, (0)::double precision)) * ('-1'::integer)::double precision) AS "Open Position Quantity",
|
||||||
|
(((('Deal '::text || (dc."Contract Nb")::text) || ' ('::text) || (dc."Contract Ref")::text) || ')'::text) AS "Label"
|
||||||
|
FROM ((vw_bi_fct_trade_line contracts
|
||||||
|
JOIN vw_bi_dim_sale_physical_contract dc ON ((contracts."intTradeId" = dc."intSaleLineId")))
|
||||||
|
LEFT JOIN ( SELECT ffe."intTradeId",
|
||||||
|
sum(ffe."Quantity") AS delivered_quantity
|
||||||
|
FROM vw_bi_fct_trade_fulfillment_event ffe
|
||||||
|
WHERE ((ffe."Trade Category" = 'Physical'::text) AND (ffe."Trade Type" = 'Sale'::text))
|
||||||
|
GROUP BY ffe."intTradeId") delivery ON ((contracts."intTradeId" = delivery."intTradeId")))
|
||||||
|
WHERE ((1 = 1) AND (contracts."Trade Category" = 'Physical'::text) AND (contracts."Trade Type" = 'Sale'::text))
|
||||||
|
)
|
||||||
|
SELECT purchase_position."intTradeId",
|
||||||
|
purchase_position."Trade Category",
|
||||||
|
purchase_position."Trade Type",
|
||||||
|
purchase_position."Delivery Date",
|
||||||
|
purchase_position.delivery_month,
|
||||||
|
purchase_position.delivery_month_label,
|
||||||
|
purchase_position.delivery_month_code,
|
||||||
|
purchase_position."Quantity",
|
||||||
|
purchase_position."Open Position Quantity",
|
||||||
|
purchase_position."Label"
|
||||||
|
FROM purchase_position
|
||||||
|
WHERE (purchase_position."Open Position Quantity" <> (0)::double precision)
|
||||||
|
UNION ALL
|
||||||
|
SELECT sale_position."intTradeId",
|
||||||
|
sale_position."Trade Category",
|
||||||
|
sale_position."Trade Type",
|
||||||
|
sale_position."Delivery Date",
|
||||||
|
sale_position.delivery_month,
|
||||||
|
sale_position.delivery_month_label,
|
||||||
|
sale_position.delivery_month_code,
|
||||||
|
sale_position."Quantity",
|
||||||
|
sale_position."Open Position Quantity",
|
||||||
|
sale_position."Label"
|
||||||
|
FROM sale_position
|
||||||
|
WHERE (sale_position."Open Position Quantity" <> (0)::double precision)
|
||||||
|
UNION ALL
|
||||||
|
SELECT ffe."intTradeId",
|
||||||
|
'Physical'::text AS "Trade Category",
|
||||||
|
'Shipped'::text AS "Trade Type",
|
||||||
|
sh."BL Date" AS "Delivery Date",
|
||||||
|
to_char((sh."BL Date")::timestamp with time zone, 'YYYY-MM'::text) AS delivery_month,
|
||||||
|
to_char((sh."BL Date")::timestamp with time zone, 'Mon YYYY'::text) AS delivery_month_label,
|
||||||
|
to_char((sh."BL Date")::timestamp with time zone, 'YYYYMM'::text) AS delivery_month_code,
|
||||||
|
ffe."Quantity",
|
||||||
|
0 AS "Open Position Quantity",
|
||||||
|
(((((('Shipment '::text || (sh."Shipment Nb")::text) || ' ('::text) || (dc."Contract Ref")::text) || ' - '::text) || (sh."Vessel")::text) || ')'::text) AS "Label"
|
||||||
|
FROM ((vw_bi_fct_trade_fulfillment_event ffe
|
||||||
|
JOIN vw_bi_dim_shipment sh ON ((ffe."intShipmentId" = sh."intShipmentId")))
|
||||||
|
JOIN vw_bi_dim_purchase_physical_contract dc ON ((ffe."intTradeId" = dc."intPurchaseLineId")));;
|
||||||
8
Database Backups/SQL Views/vw_bi_fct_prices.sql
Normal file
8
Database Backups/SQL Views/vw_bi_fct_prices.sql
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_fct_prices AS
|
||||||
|
SELECT "intPriceCurveId",
|
||||||
|
"dtmPriceDate" AS "Price Date",
|
||||||
|
"dblHighPrice" AS "High",
|
||||||
|
"dblLowPrice" AS "Low",
|
||||||
|
"dblOpenPrice" AS "Open",
|
||||||
|
"dblPriceValue" AS "Price Value"
|
||||||
|
FROM vw_utility_price_curve_prices;;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_fct_purchase_physical_contract AS
|
||||||
|
SELECT "intPurchaseLineId" AS "PurchaseLineId",
|
||||||
|
"dtmDeliveryDateFrom" AS "Delivery Date From",
|
||||||
|
"dtmDeliveryDateTo" AS "Delivery DateTo",
|
||||||
|
"dblQuantity" AS "Quantity",
|
||||||
|
"dblInTransitQuantity" AS "In Transit Quantity",
|
||||||
|
"dblDropshippedQuantity" AS "Dropship Quantity",
|
||||||
|
"dblReceivedQuantity" AS "Received Quantity",
|
||||||
|
"dblPrice" AS "Price",
|
||||||
|
"dblUnitPrice" AS "Unit Price",
|
||||||
|
"dblTheoriticalQuantity" AS "Theoretical Quantity",
|
||||||
|
"dblLineAmount" AS "Line Amount",
|
||||||
|
"dblPhysicalQty" AS "Physical Quantity",
|
||||||
|
"dblOpenQuantity" AS "Open Quantity",
|
||||||
|
"dblInInstructedQuantity" AS "Instructed Quantity"
|
||||||
|
FROM vw_utility_purchase_physical_contract pc;;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_fct_sale_physical_contract AS
|
||||||
|
SELECT "intSaleLineId",
|
||||||
|
"dtmDeliveryDateFrom" AS "Delivery Date From",
|
||||||
|
"dtmDeliveryDateTo" AS "Delivery DateTo",
|
||||||
|
"dblQuantity" AS "Quantity",
|
||||||
|
"dblPrice" AS "Price",
|
||||||
|
"dblUnitPrice" AS "Unit Price",
|
||||||
|
"dblTheoreticalQuantity" AS "Theoretical Quantity",
|
||||||
|
"dblLineAmount" AS "Line Amount",
|
||||||
|
"dblTheoreticalWeightKg" AS "Theoretical Weight(Kg)",
|
||||||
|
"dblPhysicalWeightKg" AS "Physical Weight(Kg)",
|
||||||
|
"dblOpenWeightKg" AS "Open Weight(Kg)"
|
||||||
|
FROM vw_utility_sale_physical_contract pc;;
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_fct_trade_fulfillment_event AS
|
||||||
|
SELECT sm."intPurchaseLineId" AS "intTradeId",
|
||||||
|
'Physical'::text AS "Trade Category",
|
||||||
|
'Purchase'::text AS "Trade Type",
|
||||||
|
'Shipped'::text AS "Event Type",
|
||||||
|
sm."dtmBLDate" AS "Event Date",
|
||||||
|
sm."dblQuantity" AS "Quantity",
|
||||||
|
sm."intLotId",
|
||||||
|
sm."strLotStatus" AS "Lot Status",
|
||||||
|
sm."intShipmentId"
|
||||||
|
FROM vw_utility_stock_movements sm
|
||||||
|
WHERE (sm."strMovementType" = 'Inbound'::text)
|
||||||
|
UNION ALL
|
||||||
|
SELECT sm."intSaleLineId" AS "intTradeId",
|
||||||
|
'Physical'::text AS "Trade Category",
|
||||||
|
'Sale'::text AS "Trade Type",
|
||||||
|
'Shipped'::text AS "Event Type",
|
||||||
|
sm."dtmBLDate" AS "Event Date",
|
||||||
|
sm."dblQuantity" AS "Quantity",
|
||||||
|
sm."intLotId",
|
||||||
|
sm."strLotStatus" AS "Lot Status",
|
||||||
|
sm."intShipmentId"
|
||||||
|
FROM vw_utility_stock_movements sm
|
||||||
|
WHERE (sm."strMovementType" = 'Outbound'::text)
|
||||||
|
UNION ALL
|
||||||
|
SELECT sm."intPurchaseLineId" AS "intTradeId",
|
||||||
|
'Physical'::text AS "Trade Category",
|
||||||
|
'Purchase'::text AS "Trade Type",
|
||||||
|
'Shipped'::text AS "Event Type",
|
||||||
|
sm."dtmBLDate" AS "Event Date",
|
||||||
|
sm."dblQuantity" AS "Quantity",
|
||||||
|
sm."intLotId",
|
||||||
|
sm."strLotStatus" AS "Lot Status",
|
||||||
|
sm."intShipmentId"
|
||||||
|
FROM vw_utility_stock_movements sm
|
||||||
|
WHERE (sm."strMovementType" = 'Dropship'::text)
|
||||||
|
UNION ALL
|
||||||
|
SELECT sm."intSaleLineId" AS "intTradeId",
|
||||||
|
'Physical'::text AS "Trade Category",
|
||||||
|
'Sale'::text AS "Trade Type",
|
||||||
|
'Shipped'::text AS "Event Type",
|
||||||
|
sm."dtmBLDate" AS "Event Date",
|
||||||
|
sm."dblQuantity" AS "Quantity",
|
||||||
|
sm."intLotId",
|
||||||
|
sm."strLotStatus" AS "Lot Status",
|
||||||
|
sm."intShipmentId"
|
||||||
|
FROM vw_utility_stock_movements sm
|
||||||
|
WHERE (sm."strMovementType" = 'Dropship'::text);;
|
||||||
24
Database Backups/SQL Views/vw_bi_fct_trade_line.sql
Normal file
24
Database Backups/SQL Views/vw_bi_fct_trade_line.sql
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_fct_trade_line AS
|
||||||
|
SELECT pc."intPurchaseLineId" AS "intTradeId",
|
||||||
|
'Physical'::text AS "Trade Category",
|
||||||
|
'Purchase'::text AS "Trade Type",
|
||||||
|
pc."dtmEstimatedBLDate" AS "Delivery Date",
|
||||||
|
pc."dblTheoriticalQuantity" AS "Contracted Quantity",
|
||||||
|
pc."dblQuantity" AS "Quantity",
|
||||||
|
pc."dblPrice" AS "Price",
|
||||||
|
pc."dblUnitPrice" AS "Unit Price",
|
||||||
|
'USD'::text AS "Price Currency",
|
||||||
|
pc."dblLineAmount" AS "Line Amount"
|
||||||
|
FROM vw_utility_purchase_physical_contract pc
|
||||||
|
UNION ALL
|
||||||
|
SELECT pc."intSaleLineId" AS "intTradeId",
|
||||||
|
'Physical'::text AS "Trade Category",
|
||||||
|
'Sale'::text AS "Trade Type",
|
||||||
|
pc."dtmEstimatedBLDate" AS "Delivery Date",
|
||||||
|
pc."dblTheoreticalQuantity" AS "Contracted Quantity",
|
||||||
|
pc."dblQuantity" AS "Quantity",
|
||||||
|
pc."dblPrice" AS "Price",
|
||||||
|
pc."dblUnitPrice" AS "Unit Price",
|
||||||
|
'USD'::text AS "Price Currency",
|
||||||
|
pc."dblLineAmount" AS "Line Amount"
|
||||||
|
FROM vw_utility_sale_physical_contract pc;;
|
||||||
9
Database Backups/SQL Views/vw_bi_itsa_dim_pnl_type.sql
Normal file
9
Database Backups/SQL Views/vw_bi_itsa_dim_pnl_type.sql
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_itsa_dim_pnl_type AS
|
||||||
|
SELECT 1 AS "intPnlTypeId",
|
||||||
|
'Expected'::text AS "PNL Type"
|
||||||
|
UNION ALL
|
||||||
|
SELECT 3 AS "intPnlTypeId",
|
||||||
|
'Realized'::text AS "PNL Type"
|
||||||
|
UNION ALL
|
||||||
|
SELECT 2 AS "intPnlTypeId",
|
||||||
|
'Forward'::text AS "PNL Type";;
|
||||||
12
Database Backups/SQL Views/vw_bi_itsa_dim_price_group.sql
Normal file
12
Database Backups/SQL Views/vw_bi_itsa_dim_price_group.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_itsa_dim_price_group AS
|
||||||
|
SELECT 1 AS "intPriceGroupId",
|
||||||
|
'Price'::text AS "Price Group",
|
||||||
|
1 AS "Group Order"
|
||||||
|
UNION ALL
|
||||||
|
SELECT 2 AS "intPriceGroupId",
|
||||||
|
'Fees'::text AS "Price Group",
|
||||||
|
2 AS "Group Order"
|
||||||
|
UNION ALL
|
||||||
|
SELECT 3 AS "intPriceGroupId",
|
||||||
|
'MTM'::text AS "Price Group",
|
||||||
|
2 AS "Group Order";;
|
||||||
49
Database Backups/SQL Views/vw_bi_itsa_fct_contract.sql
Normal file
49
Database Backups/SQL Views/vw_bi_itsa_fct_contract.sql
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_itsa_fct_contract AS
|
||||||
|
WITH valuation_info AS (
|
||||||
|
SELECT pvl."intContractId",
|
||||||
|
pvl."intContractLineId",
|
||||||
|
pvl."strState",
|
||||||
|
avg(pvl."dblPrice") AS "avgPrice",
|
||||||
|
avg(pvl."dblMtmPrice") AS "avgMtmPrice"
|
||||||
|
FROM vw_utility_physical_valuation_line pvl
|
||||||
|
GROUP BY pvl."intContractId", pvl."intContractLineId", pvl."strState"
|
||||||
|
)
|
||||||
|
SELECT 'Purchase'::text AS "TradeType",
|
||||||
|
pc."intPurchaseLineId" AS "TradeLineId",
|
||||||
|
pc."dblQuantity" AS "Quantity",
|
||||||
|
pc."dblTheoriticalQuantity" AS "Contract Quantity",
|
||||||
|
pc."dblInInstructedQuantity" AS "InstructedQuantity",
|
||||||
|
CASE
|
||||||
|
WHEN (pc."ysnFinished" = true) THEN (0)::numeric(18,3)
|
||||||
|
WHEN ((pc."dblTheoriticalQuantity")::double precision > pc."dblInInstructedQuantity") THEN (((pc."dblTheoriticalQuantity")::double precision - pc."dblInInstructedQuantity"))::numeric(18,3)
|
||||||
|
ELSE (0)::numeric(18,3)
|
||||||
|
END AS "Open Quantity",
|
||||||
|
COALESCE(pc."dtmEstimatedBLDate", pc."dtmDeliveryDateFrom") AS "Delivery Date",
|
||||||
|
COALESCE(vi."strState", 'Unknown'::text) AS "Price Fixing Status",
|
||||||
|
COALESCE(vi."avgPrice", (0)::numeric) AS "Avg Price",
|
||||||
|
COALESCE(vi."avgMtmPrice", (0)::numeric) AS "Avg Mtm Price",
|
||||||
|
pc."dblTheoriticalQuantity" AS "Contract Quantity Signed",
|
||||||
|
pc."dblInInstructedQuantity" AS "Instructed Quantity Signed"
|
||||||
|
FROM (vw_utility_purchase_physical_contract pc
|
||||||
|
LEFT JOIN valuation_info vi ON ((pc."intPurchaseLineId" = vi."intContractLineId")))
|
||||||
|
WHERE (1 = 1)
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'Sale'::text AS "TradeType",
|
||||||
|
pc."intSaleLineId" AS "TradeLineId",
|
||||||
|
pc."dblQuantity" AS "Quantity",
|
||||||
|
pc."dblTheoreticalQuantity" AS "Contract Quantity",
|
||||||
|
pc."dblInstructedQuantity" AS "InstructedQuantity",
|
||||||
|
CASE
|
||||||
|
WHEN (pc."ysnFinished" = true) THEN (0)::numeric(18,3)
|
||||||
|
WHEN ((pc."dblTheoreticalQuantity")::double precision > pc."dblInstructedQuantity") THEN (((pc."dblTheoreticalQuantity")::double precision - pc."dblInstructedQuantity"))::numeric(18,3)
|
||||||
|
ELSE (0)::numeric(18,3)
|
||||||
|
END AS "Open Quantity",
|
||||||
|
COALESCE(pc."dtmEstimatedBLDate", pc."dtmDeliveryDateFrom") AS "Delivery Date",
|
||||||
|
COALESCE(vi."strState", 'Unknown'::text) AS "Price Fixing Status",
|
||||||
|
COALESCE(vi."avgPrice", (0)::numeric) AS "Avg Price",
|
||||||
|
COALESCE(vi."avgMtmPrice", (0)::numeric) AS "Avg Mtm Price",
|
||||||
|
(pc."dblTheoreticalQuantity" * ('-1'::integer)::numeric) AS "Contract Quantity Signed",
|
||||||
|
(pc."dblInstructedQuantity" * (('-1'::integer)::numeric)::double precision) AS "Instructed Quantity Signed"
|
||||||
|
FROM (vw_utility_sale_physical_contract pc
|
||||||
|
LEFT JOIN valuation_info vi ON ((pc."intSaleLineId" = vi."intContractLineId")))
|
||||||
|
WHERE (1 = 1);;
|
||||||
22
Database Backups/SQL Views/vw_bi_itsa_fct_contract_fees.sql
Normal file
22
Database Backups/SQL Views/vw_bi_itsa_fct_contract_fees.sql
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_itsa_fct_contract_fees AS
|
||||||
|
SELECT "intFeeId",
|
||||||
|
"strContractType" AS "Contract Type",
|
||||||
|
"intContractLineId",
|
||||||
|
"strPackaging" AS "Packaging",
|
||||||
|
"strPayOrRec" AS "Pay or Rec",
|
||||||
|
"strType" AS "Type",
|
||||||
|
"strProduct" AS "Fee",
|
||||||
|
"strSupplier" AS "Supplier",
|
||||||
|
"strState" AS "State",
|
||||||
|
"strWeightType" AS "Weighing Type",
|
||||||
|
"dblQuantity" AS "Quantity",
|
||||||
|
("dblPrice" * ("dblSignMultiplier")::numeric) AS "Price",
|
||||||
|
"strCurrency" AS "Currency",
|
||||||
|
"strUnit" AS "Unit",
|
||||||
|
(("dblQuantity" * "dblPrice") * ("dblSignMultiplier")::numeric) AS "Amount",
|
||||||
|
CASE
|
||||||
|
WHEN (upper(("strProduct")::text) = 'MARITIME FREIGHT'::text) THEN "strProduct"
|
||||||
|
WHEN (upper(("strProduct")::text) = 'PROFIT SHARING'::text) THEN "strProduct"
|
||||||
|
ELSE 'Other Costs'::character varying
|
||||||
|
END AS "Cost Group"
|
||||||
|
FROM vw_utility_contract_fees;;
|
||||||
65
Database Backups/SQL Views/vw_bi_itsa_fct_full_pnl.sql
Normal file
65
Database Backups/SQL Views/vw_bi_itsa_fct_full_pnl.sql
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_itsa_fct_full_pnl AS
|
||||||
|
WITH trade AS (
|
||||||
|
SELECT pc."intPurchaseLineId" AS "intTradeId",
|
||||||
|
(pc."intPurchaseLineId" || '_0'::text) AS strtradeid
|
||||||
|
FROM vw_utility_dim_physical_purchase_contract pc
|
||||||
|
WHERE ((1 = 1) AND (pc."intPurchaseLineId" > 0))
|
||||||
|
UNION ALL
|
||||||
|
SELECT sc."intSaleLineId" AS "intTradeId",
|
||||||
|
('0_'::text || sc."intSaleLineId") AS strtradeid
|
||||||
|
FROM vw_utility_dim_physical_sale_contract sc
|
||||||
|
WHERE ((1 = 1) AND (sc."intSaleLineId" > 0))
|
||||||
|
)
|
||||||
|
SELECT 2 AS "intPnlTypeId",
|
||||||
|
trade.strtradeid AS "strConformedReferenceId",
|
||||||
|
contracts."intPriceGroupId",
|
||||||
|
contracts."Line Description",
|
||||||
|
contracts."Open Quantity Signed",
|
||||||
|
contracts."Price",
|
||||||
|
contracts."Open Cost Amount" AS amount,
|
||||||
|
contracts."Estimated BL Date" AS "Delivery Date"
|
||||||
|
FROM (vw_bi_itsa_physical_open_costs contracts
|
||||||
|
JOIN trade trade ON ((contracts."intTradeLineId" = trade."intTradeId")))
|
||||||
|
UNION ALL
|
||||||
|
SELECT 3 AS "intPnlTypeId",
|
||||||
|
((shipment."intPurchaseLineId" || '_'::text) || shipment."intSaleLineId") AS "strConformedReferenceId",
|
||||||
|
1 AS "intPriceGroupId",
|
||||||
|
'Purchase'::character varying AS "Line Description",
|
||||||
|
shipment."Shipped Quantity" AS "Open Quantity Signed",
|
||||||
|
shipment."Purchase Price" AS "Price",
|
||||||
|
(shipment."Shipped Quantity" * (shipment."Purchase Price")::double precision) AS amount,
|
||||||
|
shipment."BL Date" AS "Delivery Date"
|
||||||
|
FROM vw_bi_itsa_fct_shipments shipment
|
||||||
|
UNION ALL
|
||||||
|
SELECT 3 AS "intPnlTypeId",
|
||||||
|
((shipment."intPurchaseLineId" || '_'::text) || shipment."intSaleLineId") AS "strConformedReferenceId",
|
||||||
|
1 AS "intPriceGroupId",
|
||||||
|
'Sale'::character varying AS "Line Description",
|
||||||
|
shipment."Shipped Quantity" AS "Open Quantity Signed",
|
||||||
|
shipment."Sale Price" AS "Price",
|
||||||
|
(shipment."Shipped Quantity" * (shipment."Sale Price")::double precision) AS amount,
|
||||||
|
shipment."BL Date" AS "Delivery Date"
|
||||||
|
FROM vw_bi_itsa_fct_shipments shipment
|
||||||
|
UNION ALL
|
||||||
|
SELECT 3 AS "intPnlTypeId",
|
||||||
|
((shipment."intPurchaseLineId" || '_'::text) || shipment."intSaleLineId") AS "strConformedReferenceId",
|
||||||
|
2 AS "intPriceGroupId",
|
||||||
|
fees."Fee" AS "Line Description",
|
||||||
|
shipment."Shipped Quantity" AS "Open Quantity Signed",
|
||||||
|
fees."Price",
|
||||||
|
(shipment."Shipped Quantity" * (fees."Price")::double precision) AS amount,
|
||||||
|
shipment."BL Date" AS "Delivery Date"
|
||||||
|
FROM (vw_bi_itsa_fct_shipment_fees fees
|
||||||
|
JOIN vw_bi_itsa_fct_shipments shipment ON ((fees."intShipmentId" = shipment."intShipmentId")))
|
||||||
|
UNION ALL
|
||||||
|
SELECT 1 AS "intPnlTypeId",
|
||||||
|
trade."strTradeId" AS "strConformedReferenceId",
|
||||||
|
1 AS "intPriceGroupId",
|
||||||
|
'Expected Price'::character varying AS "Line Description",
|
||||||
|
ctr."Contract Quantity" AS "Open Quantity Signed",
|
||||||
|
ctr."Avg Price" AS "Price",
|
||||||
|
(ctr."Contract Quantity" * ctr."Avg Price") AS amount,
|
||||||
|
ctr."Delivery Date"
|
||||||
|
FROM (vw_bi_itsa_fct_contract ctr
|
||||||
|
JOIN vw_bi_dim_trade trade ON ((ctr."TradeLineId" = trade."intTradeId")))
|
||||||
|
WHERE ((trade."Book")::text ~~ '%Projection%'::text);;
|
||||||
29
Database Backups/SQL Views/vw_bi_itsa_fct_shipment_fees.sql
Normal file
29
Database Backups/SQL Views/vw_bi_itsa_fct_shipment_fees.sql
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_itsa_fct_shipment_fees AS
|
||||||
|
SELECT "intFeeId",
|
||||||
|
"strShipmentType" AS "Shipment Type",
|
||||||
|
"intShipmentId",
|
||||||
|
"strPackaging" AS "Packaging",
|
||||||
|
"strPayOrRec" AS "Pay or Rec",
|
||||||
|
"strType" AS "Type",
|
||||||
|
"strProduct" AS "Fee",
|
||||||
|
"strSupplier" AS "Supplier",
|
||||||
|
"strState" AS "State",
|
||||||
|
"strWeightType" AS "Weighing Type",
|
||||||
|
COALESCE("dblQuantity", (0)::numeric) AS "Quantity",
|
||||||
|
CASE
|
||||||
|
WHEN (upper(("strProduct")::text) = 'PROFIT SHARING'::text) THEN abs("dblPrice")
|
||||||
|
ELSE ("dblPrice" * ("dblSignMultiplier")::numeric)
|
||||||
|
END AS "Price",
|
||||||
|
"strCurrency" AS "Currency",
|
||||||
|
"strUnit" AS "Unit",
|
||||||
|
(COALESCE("dblQuantity", (0)::numeric) *
|
||||||
|
CASE
|
||||||
|
WHEN (upper(("strProduct")::text) = 'PROFIT SHARING'::text) THEN abs("dblPrice")
|
||||||
|
ELSE ("dblPrice" * ("dblSignMultiplier")::numeric)
|
||||||
|
END) AS "Amount",
|
||||||
|
CASE
|
||||||
|
WHEN (upper(("strProduct")::text) = 'MARITIME FREIGHT'::text) THEN "strProduct"
|
||||||
|
WHEN (upper(("strProduct")::text) = 'PROFIT SHARING'::text) THEN "strProduct"
|
||||||
|
ELSE 'Other Costs'::character varying
|
||||||
|
END AS "Cost Group"
|
||||||
|
FROM vw_utility_shipment_fees;;
|
||||||
18
Database Backups/SQL Views/vw_bi_itsa_fct_shipments.sql
Normal file
18
Database Backups/SQL Views/vw_bi_itsa_fct_shipments.sql
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_itsa_fct_shipments AS
|
||||||
|
SELECT sm."intLotId",
|
||||||
|
sm."intProductId",
|
||||||
|
sm."intFromLocationId",
|
||||||
|
sm."intToLocationId",
|
||||||
|
sm."intShipmentId",
|
||||||
|
sm."strMovementType" AS "Movement Type",
|
||||||
|
sm."intPurchaseLineId",
|
||||||
|
sm."intSaleLineId",
|
||||||
|
sm."dblQuantity" AS "Shipped Quantity",
|
||||||
|
sm."strUnit" AS "Quantity Unit",
|
||||||
|
COALESCE(p."dblUnitPrice", (0)::numeric) AS "Purchase Price",
|
||||||
|
COALESCE(s."dblUnitPrice", (0)::numeric) AS "Sale Price",
|
||||||
|
shipment."dtmBillOfLadingDate" AS "BL Date"
|
||||||
|
FROM (((vw_utility_stock_movements sm
|
||||||
|
JOIN vw_utility_shipment_in shipment ON ((sm."intShipmentId" = shipment."intShipmentId")))
|
||||||
|
LEFT JOIN vw_utility_purchase_physical_contract p ON ((sm."intPurchaseLineId" = p."intPurchaseLineId")))
|
||||||
|
LEFT JOIN vw_utility_sale_physical_contract s ON ((sm."intSaleLineId" = s."intSaleLineId")));;
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_itsa_monthly_trade_ifrs_adjustments AS
|
||||||
|
SELECT "intAdjustmentId",
|
||||||
|
"dtmAdjustmentDate" AS "Adjustment Date",
|
||||||
|
"dblAmount" AS "Amount",
|
||||||
|
"strCurrency" AS "Currency",
|
||||||
|
"strComments" AS "Comments"
|
||||||
|
FROM vw_utility_monthly_trade_ifrs_adjustments;;
|
||||||
148
Database Backups/SQL Views/vw_bi_itsa_physical_open_costs.sql
Normal file
148
Database Backups/SQL Views/vw_bi_itsa_physical_open_costs.sql
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_itsa_physical_open_costs AS
|
||||||
|
WITH valuation_info AS (
|
||||||
|
SELECT pvl."intContractId",
|
||||||
|
pvl."intContractLineId",
|
||||||
|
pvl."strState",
|
||||||
|
avg(pvl."dblPrice") AS "avgPrice",
|
||||||
|
(avg(pvl."dblMtmPrice"))::numeric(18,2) AS "avgMtmPrice"
|
||||||
|
FROM vw_utility_physical_valuation_line pvl
|
||||||
|
GROUP BY pvl."intContractId", pvl."intContractLineId", pvl."strState"
|
||||||
|
), contract_open_quantity AS (
|
||||||
|
SELECT 'Purchase'::text AS "TradeType",
|
||||||
|
pc."intPurchaseLineId" AS "TradeLineId",
|
||||||
|
pc."dblTheoriticalQuantity" AS "TheoriticalQuantity",
|
||||||
|
pc."dblInInstructedQuantity" AS "InstructedQuantity",
|
||||||
|
CASE
|
||||||
|
WHEN (pc."ysnFinished" = true) THEN (0)::numeric(18,3)
|
||||||
|
WHEN ((pc."dblTheoriticalQuantity")::double precision > pc."dblInInstructedQuantity") THEN (((pc."dblTheoriticalQuantity")::double precision - pc."dblInInstructedQuantity"))::numeric(18,3)
|
||||||
|
ELSE (0)::numeric(18,3)
|
||||||
|
END AS "OpenQuantity",
|
||||||
|
CASE
|
||||||
|
WHEN (pc."ysnFinished" = true) THEN (0)::numeric(18,3)
|
||||||
|
WHEN ((pc."dblTheoriticalQuantity")::double precision > pc."dblInInstructedQuantity") THEN (((pc."dblTheoriticalQuantity")::double precision - pc."dblInInstructedQuantity"))::numeric(18,3)
|
||||||
|
ELSE (0)::numeric(18,3)
|
||||||
|
END AS "OpenQuantitySigned",
|
||||||
|
COALESCE(vi."avgMtmPrice", (0)::numeric(18,2)) AS "AvgMtmPrice",
|
||||||
|
pc."dblTheoriticalQuantity" AS "TheoriticalQuantitySigned"
|
||||||
|
FROM (vw_utility_purchase_physical_contract pc
|
||||||
|
LEFT JOIN valuation_info vi ON ((pc."intPurchaseLineId" = vi."intContractLineId")))
|
||||||
|
WHERE (1 = 1)
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'Sale'::text AS "TradeType",
|
||||||
|
pc."intSaleLineId" AS "TradeLineId",
|
||||||
|
pc."dblTheoreticalQuantity" AS "TheoriticalQuantity",
|
||||||
|
pc."dblInstructedQuantity" AS "InstructedQuantity",
|
||||||
|
CASE
|
||||||
|
WHEN (pc."ysnFinished" = true) THEN (0)::numeric(18,3)
|
||||||
|
WHEN ((pc."dblTheoreticalQuantity")::double precision > pc."dblInstructedQuantity") THEN (((pc."dblTheoreticalQuantity")::double precision - pc."dblInstructedQuantity"))::numeric(18,3)
|
||||||
|
ELSE (0)::numeric(18,3)
|
||||||
|
END AS "OpenQuantity",
|
||||||
|
(
|
||||||
|
CASE
|
||||||
|
WHEN (pc."ysnFinished" = true) THEN (0)::numeric(18,3)
|
||||||
|
WHEN ((pc."dblTheoreticalQuantity")::double precision > pc."dblInstructedQuantity") THEN (((pc."dblTheoreticalQuantity")::double precision - pc."dblInstructedQuantity"))::numeric(18,3)
|
||||||
|
ELSE (0)::numeric(18,3)
|
||||||
|
END * ('-1'::integer)::numeric) AS "OpenQuantitySigned",
|
||||||
|
COALESCE(vi."avgMtmPrice", (0)::numeric(18,2)) AS "AvgMtmPrice",
|
||||||
|
(pc."dblTheoreticalQuantity" * ('-1'::integer)::numeric) AS "TheoriticalQuantitySigned"
|
||||||
|
FROM (vw_utility_sale_physical_contract pc
|
||||||
|
LEFT JOIN valuation_info vi ON ((pc."intSaleLineId" = vi."intContractLineId")))
|
||||||
|
WHERE (1 = 1)
|
||||||
|
)
|
||||||
|
SELECT 1 AS "Group Order",
|
||||||
|
'Price'::text AS "Group Type",
|
||||||
|
ctr."intPurchaseLineId" AS "intTradeLineId",
|
||||||
|
'Fixed Price'::character varying AS "Line Description",
|
||||||
|
pur."dblUnitPrice" AS "Price",
|
||||||
|
opq."OpenQuantitySigned" AS "Open Quantity Signed",
|
||||||
|
((opq."OpenQuantitySigned" * pur."dblUnitPrice") * ('-1'::integer)::numeric) AS "Open Cost Amount",
|
||||||
|
1 AS "intPriceGroupId",
|
||||||
|
ctr."dtmEstimatedBLDate" AS "Estimated BL Date",
|
||||||
|
opq."TheoriticalQuantitySigned" AS "Contract Quantity Signed"
|
||||||
|
FROM ((vw_utility_dim_physical_purchase_contract ctr
|
||||||
|
JOIN vw_utility_purchase_physical_contract pur ON ((ctr."intPurchaseLineId" = pur."intPurchaseLineId")))
|
||||||
|
JOIN contract_open_quantity opq ON (((ctr."intPurchaseLineId" = opq."TradeLineId") AND (opq."TradeType" = 'Purchase'::text))))
|
||||||
|
WHERE (((ctr."strPricingType")::text = 'priced'::text) AND (opq."OpenQuantity" <> (0)::numeric))
|
||||||
|
UNION ALL
|
||||||
|
SELECT 2 AS "Group Order",
|
||||||
|
'MTM'::text AS "Group Type",
|
||||||
|
ctr."intPurchaseLineId" AS "intTradeLineId",
|
||||||
|
mtm."strComponentCurve" AS "Line Description",
|
||||||
|
opq."AvgMtmPrice" AS "Price",
|
||||||
|
opq."OpenQuantitySigned" AS "Open Quantity Signed",
|
||||||
|
(opq."OpenQuantitySigned" * opq."AvgMtmPrice") AS "Open Cost Amount",
|
||||||
|
3 AS "intPriceGroupId",
|
||||||
|
ctr."dtmEstimatedBLDate" AS "Estimated BL Date",
|
||||||
|
opq."TheoriticalQuantitySigned" AS "Contract Quantity Signed"
|
||||||
|
FROM ((vw_utility_physical_mtm_definition mtm
|
||||||
|
JOIN vw_utility_dim_physical_purchase_contract ctr ON ((mtm."intContractLineId" = ctr."intPurchaseLineId")))
|
||||||
|
JOIN contract_open_quantity opq ON (((ctr."intPurchaseLineId" = opq."TradeLineId") AND (opq."TradeType" = 'Purchase'::text))))
|
||||||
|
WHERE ((mtm."strContractType" = 'Purchase'::text) AND (opq."OpenQuantity" <> (0)::numeric))
|
||||||
|
UNION ALL
|
||||||
|
SELECT 3 AS "Group Order",
|
||||||
|
'Fee'::text AS "Group Type",
|
||||||
|
fees."intContractLineId" AS "intTradeLineId",
|
||||||
|
fees."strProduct" AS "Line Description",
|
||||||
|
fees."dblPrice" AS "Price",
|
||||||
|
opq."OpenQuantitySigned" AS "Open Quantity Signed",
|
||||||
|
((((
|
||||||
|
CASE
|
||||||
|
WHEN ((fees."strPayOrRec")::text = 'pay'::text) THEN 1
|
||||||
|
ELSE '-1'::integer
|
||||||
|
END)::numeric * opq."OpenQuantity") * fees."dblPrice") * ('-1'::integer)::numeric) AS "Open Cost Amount",
|
||||||
|
2 AS "intPriceGroupId",
|
||||||
|
ctr."dtmEstimatedBLDate" AS "Estimated BL Date",
|
||||||
|
opq."TheoriticalQuantitySigned" AS "Contract Quantity Signed"
|
||||||
|
FROM ((vw_utility_contract_fees fees
|
||||||
|
JOIN vw_utility_dim_physical_purchase_contract ctr ON ((fees."intContractLineId" = ctr."intPurchaseLineId")))
|
||||||
|
JOIN contract_open_quantity opq ON (((ctr."intPurchaseLineId" = opq."TradeLineId") AND (opq."TradeType" = 'Purchase'::text))))
|
||||||
|
WHERE ((fees."strContractType" = 'Purchase'::text) AND (opq."OpenQuantity" <> (0)::numeric))
|
||||||
|
UNION ALL
|
||||||
|
SELECT 1 AS "Group Order",
|
||||||
|
'Price'::text AS "Group Type",
|
||||||
|
ctr."intSaleLineId" AS "intTradeLineId",
|
||||||
|
'Fixed Price'::character varying AS "Line Description",
|
||||||
|
sale."dblUnitPrice" AS "Price",
|
||||||
|
opq."OpenQuantitySigned" AS "Open Quantity Signed",
|
||||||
|
((opq."OpenQuantitySigned" * sale."dblUnitPrice") * ('-1'::integer)::numeric) AS "Open Cost Amount",
|
||||||
|
1 AS "intPriceGroupId",
|
||||||
|
ctr."dtmEstimatedBLDate" AS "Estimated BL Date",
|
||||||
|
opq."TheoriticalQuantitySigned" AS "Contract Quantity Signed"
|
||||||
|
FROM ((vw_utility_dim_physical_sale_contract ctr
|
||||||
|
JOIN vw_utility_sale_physical_contract sale ON ((ctr."intSaleLineId" = sale."intSaleLineId")))
|
||||||
|
JOIN contract_open_quantity opq ON (((ctr."intSaleLineId" = opq."TradeLineId") AND (opq."TradeType" = 'Sale'::text))))
|
||||||
|
WHERE (((ctr."strPricingType")::text = 'priced'::text) AND (opq."OpenQuantity" <> (0)::numeric))
|
||||||
|
UNION ALL
|
||||||
|
SELECT 2 AS "Group Order",
|
||||||
|
'MTM'::text AS "Group Type",
|
||||||
|
ctr."intSaleLineId" AS "intTradeLineId",
|
||||||
|
mtm."strComponentCurve" AS "Line Description",
|
||||||
|
opq."AvgMtmPrice" AS "Price",
|
||||||
|
opq."OpenQuantitySigned" AS "Open Quantity Signed",
|
||||||
|
(opq."OpenQuantitySigned" * opq."AvgMtmPrice") AS "Open Cost Amount",
|
||||||
|
3 AS "intPriceGroupId",
|
||||||
|
ctr."dtmEstimatedBLDate" AS "Estimated BL Date",
|
||||||
|
opq."TheoriticalQuantitySigned" AS "Contract Quantity Signed"
|
||||||
|
FROM ((vw_utility_physical_mtm_definition mtm
|
||||||
|
JOIN vw_utility_dim_physical_sale_contract ctr ON ((mtm."intContractLineId" = ctr."intSaleLineId")))
|
||||||
|
JOIN contract_open_quantity opq ON (((ctr."intSaleLineId" = opq."TradeLineId") AND (opq."TradeType" = 'Sale'::text))))
|
||||||
|
WHERE ((mtm."strContractType" = 'Sale'::text) AND (opq."OpenQuantity" <> (0)::numeric))
|
||||||
|
UNION ALL
|
||||||
|
SELECT 3 AS "Group Order",
|
||||||
|
'Fee'::text AS "Group Type",
|
||||||
|
fees."intContractLineId" AS "intTradeLineId",
|
||||||
|
fees."strProduct" AS "Line Description",
|
||||||
|
fees."dblPrice" AS "Price",
|
||||||
|
opq."OpenQuantitySigned" AS "Open Quantity Signed",
|
||||||
|
((((
|
||||||
|
CASE
|
||||||
|
WHEN ((fees."strPayOrRec")::text = 'pay'::text) THEN 1
|
||||||
|
ELSE '-1'::integer
|
||||||
|
END)::numeric * opq."OpenQuantity") * fees."dblPrice") * ('-1'::integer)::numeric) AS "Open Cost Amount",
|
||||||
|
2 AS "intPriceGroupId",
|
||||||
|
ctr."dtmEstimatedBLDate" AS "Estimated BL Date",
|
||||||
|
opq."TheoriticalQuantitySigned" AS "Contract Quantity Signed"
|
||||||
|
FROM ((vw_utility_contract_fees fees
|
||||||
|
JOIN vw_utility_dim_physical_sale_contract ctr ON ((fees."intContractLineId" = ctr."intSaleLineId")))
|
||||||
|
JOIN contract_open_quantity opq ON (((ctr."intSaleLineId" = opq."TradeLineId") AND (opq."TradeType" = 'Sale'::text))))
|
||||||
|
WHERE ((fees."strContractType" = 'Sale'::text) AND (opq."OpenQuantity" <> (0)::numeric));;
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_os_migration_instructed_shipments AS
|
||||||
|
SELECT il."intLotId" AS "intPurchaseLotId",
|
||||||
|
il."intLotId" AS "intSaleLotId",
|
||||||
|
il."intShipmentId",
|
||||||
|
il."intPurchaseLineId",
|
||||||
|
il."intSaleLineId",
|
||||||
|
il."dblQuantity",
|
||||||
|
il."strUnit",
|
||||||
|
pl.source_id AS purchase_source_id,
|
||||||
|
sl.source_id AS sale_source_id,
|
||||||
|
'Physical'::text AS "strLotType"
|
||||||
|
FROM ((vw_utility_instructed_lots il
|
||||||
|
LEFT JOIN vw_bi_os_migration_mapping pl ON (((il."intPurchaseLineId" = pl.tryton_id) AND (pl.tryton_model = '{purchase.line}'::character varying[]))))
|
||||||
|
LEFT JOIN vw_bi_os_migration_mapping sl ON (((il."intSaleLineId" = sl.tryton_id) AND (sl.tryton_model = '{sale.line}'::character varying[]))))
|
||||||
|
UNION ALL
|
||||||
|
SELECT ml."intPurchaseLotId",
|
||||||
|
ml."intSaleLotId",
|
||||||
|
ml."intLotShipmentIn" AS "intShipmentId",
|
||||||
|
pl."intPurchaseLineId",
|
||||||
|
sl."intSaleLineId",
|
||||||
|
ml."dblQuantity",
|
||||||
|
ml."strUnit",
|
||||||
|
ospl.source_id AS purchase_source_id,
|
||||||
|
ossl.source_id AS sale_source_id,
|
||||||
|
'Virtual'::text AS "strLotType"
|
||||||
|
FROM ((((vw_utility_matched_lots ml
|
||||||
|
JOIN vw_utility_lot pl ON ((ml."intPurchaseLotId" = pl."intLotId")))
|
||||||
|
JOIN vw_utility_lot sl ON ((ml."intSaleLotId" = sl."intLotId")))
|
||||||
|
LEFT JOIN vw_bi_os_migration_mapping ospl ON (((pl."intPurchaseLineId" = ospl.tryton_id) AND (ospl.tryton_model = '{purchase.line}'::character varying[]))))
|
||||||
|
LEFT JOIN vw_bi_os_migration_mapping ossl ON (((sl."intSaleLineId" = ossl.tryton_id) AND (ossl.tryton_model = '{sale.line}'::character varying[]))))
|
||||||
|
WHERE ((1 = 1) AND (ml."dblQuantity" > (0)::numeric) AND (ml."intLotShipmentIn" > 0));;
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_os_migration_mapping AS
|
||||||
|
SELECT object_type AS source_object_type,
|
||||||
|
source_id,
|
||||||
|
tryton_model,
|
||||||
|
tryton_id,
|
||||||
|
recon_key AS reconciliation_key,
|
||||||
|
write_date AS import_date
|
||||||
|
FROM os_migration_mapping;;
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_os_migration_purchase_line AS
|
||||||
|
SELECT mm.source_id,
|
||||||
|
mm.object_type,
|
||||||
|
mm.recon_key,
|
||||||
|
mm.tryton_id,
|
||||||
|
mm.write_date AS migration_date,
|
||||||
|
mm.tryton_model,
|
||||||
|
p.number AS tradon_number,
|
||||||
|
p.reference AS tradon_reference,
|
||||||
|
p.our_reference AS tradon_our_reference,
|
||||||
|
p.purchase_date AS tradon_purchase_date,
|
||||||
|
pa.name AS tradon_counterparty,
|
||||||
|
c.name AS tradon_currency,
|
||||||
|
pl.sequence AS tradon_line_number,
|
||||||
|
pl.quantity AS tradon_line_quantity,
|
||||||
|
pp.code AS tradon_product_code,
|
||||||
|
pu.symbol AS tradon_unit_symbol,
|
||||||
|
pl.from_del AS tradon_delivery_from_date,
|
||||||
|
pl.to_del AS tradon_delivery_to_date
|
||||||
|
FROM (((((((os_migration_mapping mm
|
||||||
|
JOIN purchase_line pl ON ((pl.id = mm.tryton_id)))
|
||||||
|
JOIN purchase_purchase p ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN party_party pa ON ((pa.id = p.party)))
|
||||||
|
LEFT JOIN currency_currency c ON ((c.id = p.currency)))
|
||||||
|
LEFT JOIN incoterm_incoterm i ON ((p.incoterm = i.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN product_uom pu ON ((pl.unit = pu.id)))
|
||||||
|
WHERE (mm.tryton_model = '{purchase.line}'::character varying[]);;
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_os_migration_purchase_purchase AS
|
||||||
|
SELECT (mm.source_id)::character varying AS source_id,
|
||||||
|
(mm.object_type)::character varying AS object_type,
|
||||||
|
(mm.recon_key)::character varying AS recon_key,
|
||||||
|
(mm.tryton_id)::integer AS tryton_id,
|
||||||
|
(mm.write_date)::timestamp without time zone AS migration_date,
|
||||||
|
(mm.tryton_model)::character varying[] AS tryton_model,
|
||||||
|
p.number AS tradon_number,
|
||||||
|
p.reference AS tradon_reference,
|
||||||
|
p.our_reference AS tradon_our_reference,
|
||||||
|
p.purchase_date AS tradon_purchase_date,
|
||||||
|
pa.name AS tradon_counterparty,
|
||||||
|
c.name AS tradon_currency,
|
||||||
|
p.state AS tradon_state,
|
||||||
|
p.invoice_method AS tradon_invoice_method,
|
||||||
|
i.code AS tradon_incoterm,
|
||||||
|
i.version AS tradon_incoterm_version,
|
||||||
|
fromloc.name AS tradon_from_location,
|
||||||
|
toloc.name AS tradon_to_location,
|
||||||
|
pwb.name AS tradon_weight_basis,
|
||||||
|
p.tol_max AS tradon_tol_max_pct,
|
||||||
|
p.tol_min AS tradon_tol_min_pct,
|
||||||
|
p.tol_max_qt AS tradon_tol_max_qty,
|
||||||
|
p.tol_min_qt AS tradon_tol_min_qty,
|
||||||
|
op.name AS tradon_operator,
|
||||||
|
tr.name AS tradon_trader
|
||||||
|
FROM (((((((((os_migration_mapping mm
|
||||||
|
JOIN purchase_purchase p ON ((p.id = mm.tryton_id)))
|
||||||
|
LEFT JOIN party_party pa ON ((pa.id = p.party)))
|
||||||
|
LEFT JOIN currency_currency c ON ((c.id = p.currency)))
|
||||||
|
LEFT JOIN incoterm_incoterm i ON ((p.incoterm = i.id)))
|
||||||
|
LEFT JOIN stock_location fromloc ON ((p.from_location = fromloc.id)))
|
||||||
|
LEFT JOIN stock_location toloc ON ((p.to_location = toloc.id)))
|
||||||
|
LEFT JOIN purchase_weight_basis pwb ON ((p.wb = pwb.id)))
|
||||||
|
LEFT JOIN party_party op ON ((p.operator = op.id)))
|
||||||
|
LEFT JOIN party_party tr ON ((p.trader = tr.id)))
|
||||||
|
WHERE (mm.tryton_model = ARRAY['purchase.purchase'::character varying])
|
||||||
|
UNION ALL
|
||||||
|
SELECT ''::character varying AS source_id,
|
||||||
|
''::character varying AS object_type,
|
||||||
|
NULL::character varying AS recon_key,
|
||||||
|
NULL::integer AS tryton_id,
|
||||||
|
NULL::timestamp without time zone AS migration_date,
|
||||||
|
NULL::character varying[] AS tryton_model,
|
||||||
|
p.number AS tradon_number,
|
||||||
|
p.reference AS tradon_reference,
|
||||||
|
p.our_reference AS tradon_our_reference,
|
||||||
|
p.purchase_date AS tradon_purchase_date,
|
||||||
|
pa.name AS tradon_counterparty,
|
||||||
|
c.name AS tradon_currency,
|
||||||
|
p.state AS tradon_state,
|
||||||
|
p.invoice_method AS tradon_invoice_method,
|
||||||
|
i.code AS tradon_incoterm,
|
||||||
|
i.version AS tradon_incoterm_version,
|
||||||
|
fromloc.name AS tradon_from_location,
|
||||||
|
toloc.name AS tradon_to_location,
|
||||||
|
pwb.name AS tradon_weight_basis,
|
||||||
|
p.tol_max AS tradon_tol_max_pct,
|
||||||
|
p.tol_min AS tradon_tol_min_pct,
|
||||||
|
p.tol_max_qt AS tradon_tol_max_qty,
|
||||||
|
p.tol_min_qt AS tradon_tol_min_qty,
|
||||||
|
op.name AS tradon_operator,
|
||||||
|
tr.name AS tradon_trader
|
||||||
|
FROM ((((((((purchase_purchase p
|
||||||
|
LEFT JOIN party_party pa ON ((pa.id = p.party)))
|
||||||
|
LEFT JOIN currency_currency c ON ((c.id = p.currency)))
|
||||||
|
LEFT JOIN incoterm_incoterm i ON ((p.incoterm = i.id)))
|
||||||
|
LEFT JOIN stock_location fromloc ON ((p.from_location = fromloc.id)))
|
||||||
|
LEFT JOIN stock_location toloc ON ((p.to_location = toloc.id)))
|
||||||
|
LEFT JOIN purchase_weight_basis pwb ON ((p.wb = pwb.id)))
|
||||||
|
LEFT JOIN party_party op ON ((p.operator = op.id)))
|
||||||
|
LEFT JOIN party_party tr ON ((p.trader = tr.id)))
|
||||||
|
WHERE (NOT (EXISTS ( SELECT 1
|
||||||
|
FROM os_migration_mapping mm
|
||||||
|
WHERE ((mm.tryton_id = p.id) AND (mm.tryton_model = ARRAY['purchase.purchase'::character varying])))));;
|
||||||
28
Database Backups/SQL Views/vw_bi_os_migration_sale_line.sql
Normal file
28
Database Backups/SQL Views/vw_bi_os_migration_sale_line.sql
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_os_migration_sale_line AS
|
||||||
|
SELECT mm.source_id,
|
||||||
|
mm.object_type,
|
||||||
|
mm.recon_key,
|
||||||
|
mm.tryton_id,
|
||||||
|
mm.write_date AS migration_date,
|
||||||
|
mm.tryton_model,
|
||||||
|
p.number AS tradon_number,
|
||||||
|
p.reference AS tradon_reference,
|
||||||
|
p.our_reference AS tradon_our_reference,
|
||||||
|
p.sale_date AS tradon_sale_date,
|
||||||
|
pa.name AS tradon_counterparty,
|
||||||
|
c.name AS tradon_currency,
|
||||||
|
pl.sequence AS tradon_line_number,
|
||||||
|
pl.quantity AS tradon_line_quantity,
|
||||||
|
pp.code AS tradon_product_code,
|
||||||
|
pu.symbol AS tradon_unit_symbol,
|
||||||
|
pl.from_del AS tradon_delivery_from_date,
|
||||||
|
pl.to_del AS tradon_delivery_to_date
|
||||||
|
FROM (((((((os_migration_mapping mm
|
||||||
|
JOIN sale_line pl ON ((pl.id = mm.tryton_id)))
|
||||||
|
JOIN sale_sale p ON ((pl.sale = p.id)))
|
||||||
|
LEFT JOIN party_party pa ON ((pa.id = p.party)))
|
||||||
|
LEFT JOIN currency_currency c ON ((c.id = p.currency)))
|
||||||
|
LEFT JOIN incoterm_incoterm i ON ((p.incoterm = i.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN product_uom pu ON ((pl.unit = pu.id)))
|
||||||
|
WHERE (mm.tryton_model = '{sale.line}'::character varying[]);;
|
||||||
75
Database Backups/SQL Views/vw_bi_os_migration_sale_sale.sql
Normal file
75
Database Backups/SQL Views/vw_bi_os_migration_sale_sale.sql
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_os_migration_sale_sale AS
|
||||||
|
SELECT (mm.source_id)::character varying AS source_id,
|
||||||
|
(mm.object_type)::character varying AS object_type,
|
||||||
|
(mm.recon_key)::character varying AS recon_key,
|
||||||
|
(mm.tryton_id)::integer AS tryton_id,
|
||||||
|
(mm.write_date)::timestamp without time zone AS migration_date,
|
||||||
|
(mm.tryton_model)::character varying[] AS tryton_model,
|
||||||
|
p.number AS tradon_number,
|
||||||
|
p.reference AS tradon_reference,
|
||||||
|
p.our_reference AS tradon_our_reference,
|
||||||
|
p.sale_date AS tradon_sale_date,
|
||||||
|
pa.name AS tradon_counterparty,
|
||||||
|
c.name AS tradon_currency,
|
||||||
|
p.state AS tradon_state,
|
||||||
|
p.invoice_method AS tradon_invoice_method,
|
||||||
|
i.code AS tradon_incoterm,
|
||||||
|
i.version AS tradon_incoterm_version,
|
||||||
|
fromloc.name AS tradon_from_location,
|
||||||
|
toloc.name AS tradon_to_location,
|
||||||
|
pwb.name AS tradon_weight_basis,
|
||||||
|
p.tol_max AS tradon_tol_max_pct,
|
||||||
|
p.tol_min AS tradon_tol_min_pct,
|
||||||
|
p.tol_max_qt AS tradon_tol_max_qty,
|
||||||
|
p.tol_min_qt AS tradon_tol_min_qty,
|
||||||
|
op.name AS tradon_operator,
|
||||||
|
tr.name AS tradon_trader
|
||||||
|
FROM (((((((((os_migration_mapping mm
|
||||||
|
JOIN sale_sale p ON ((p.id = mm.tryton_id)))
|
||||||
|
LEFT JOIN party_party pa ON ((pa.id = p.party)))
|
||||||
|
LEFT JOIN currency_currency c ON ((c.id = p.currency)))
|
||||||
|
LEFT JOIN incoterm_incoterm i ON ((p.incoterm = i.id)))
|
||||||
|
LEFT JOIN stock_location fromloc ON ((p.from_location = fromloc.id)))
|
||||||
|
LEFT JOIN stock_location toloc ON ((p.to_location = toloc.id)))
|
||||||
|
LEFT JOIN purchase_weight_basis pwb ON ((p.wb = pwb.id)))
|
||||||
|
LEFT JOIN party_party op ON ((p.operator = op.id)))
|
||||||
|
LEFT JOIN party_party tr ON ((p.trader = tr.id)))
|
||||||
|
WHERE (mm.tryton_model = ARRAY['sale.sale'::character varying])
|
||||||
|
UNION ALL
|
||||||
|
SELECT ''::character varying AS source_id,
|
||||||
|
''::character varying AS object_type,
|
||||||
|
NULL::character varying AS recon_key,
|
||||||
|
NULL::integer AS tryton_id,
|
||||||
|
NULL::timestamp without time zone AS migration_date,
|
||||||
|
NULL::character varying[] AS tryton_model,
|
||||||
|
p.number AS tradon_number,
|
||||||
|
p.reference AS tradon_reference,
|
||||||
|
p.our_reference AS tradon_our_reference,
|
||||||
|
p.sale_date AS tradon_sale_date,
|
||||||
|
pa.name AS tradon_counterparty,
|
||||||
|
c.name AS tradon_currency,
|
||||||
|
p.state AS tradon_state,
|
||||||
|
p.invoice_method AS tradon_invoice_method,
|
||||||
|
i.code AS tradon_incoterm,
|
||||||
|
i.version AS tradon_incoterm_version,
|
||||||
|
fromloc.name AS tradon_from_location,
|
||||||
|
toloc.name AS tradon_to_location,
|
||||||
|
pwb.name AS tradon_weight_basis,
|
||||||
|
p.tol_max AS tradon_tol_max_pct,
|
||||||
|
p.tol_min AS tradon_tol_min_pct,
|
||||||
|
p.tol_max_qt AS tradon_tol_max_qty,
|
||||||
|
p.tol_min_qt AS tradon_tol_min_qty,
|
||||||
|
op.name AS tradon_operator,
|
||||||
|
tr.name AS tradon_trader
|
||||||
|
FROM ((((((((sale_sale p
|
||||||
|
LEFT JOIN party_party pa ON ((pa.id = p.party)))
|
||||||
|
LEFT JOIN currency_currency c ON ((c.id = p.currency)))
|
||||||
|
LEFT JOIN incoterm_incoterm i ON ((p.incoterm = i.id)))
|
||||||
|
LEFT JOIN stock_location fromloc ON ((p.from_location = fromloc.id)))
|
||||||
|
LEFT JOIN stock_location toloc ON ((p.to_location = toloc.id)))
|
||||||
|
LEFT JOIN purchase_weight_basis pwb ON ((p.wb = pwb.id)))
|
||||||
|
LEFT JOIN party_party op ON ((p.operator = op.id)))
|
||||||
|
LEFT JOIN party_party tr ON ((p.trader = tr.id)))
|
||||||
|
WHERE (NOT (EXISTS ( SELECT 1
|
||||||
|
FROM os_migration_mapping mm
|
||||||
|
WHERE ((mm.tryton_id = p.id) AND (mm.tryton_model = ARRAY['sale.sale'::character varying])))));;
|
||||||
35
Database Backups/SQL Views/vw_bi_purchase_follow_up.sql
Normal file
35
Database Backups/SQL Views/vw_bi_purchase_follow_up.sql
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_purchase_follow_up AS
|
||||||
|
SELECT dpc."Contract Nb",
|
||||||
|
dpc."Supplier",
|
||||||
|
dpc."Contract Ref",
|
||||||
|
dpc."Contract Date",
|
||||||
|
dpc."Contract Status",
|
||||||
|
dpc."Payment Terms",
|
||||||
|
dpc."Currency",
|
||||||
|
dpc."Weight Basis",
|
||||||
|
dpc."Broker",
|
||||||
|
dpc."Certification",
|
||||||
|
dpc."Association",
|
||||||
|
dpc."Crop",
|
||||||
|
dpc."Tolerance Min %",
|
||||||
|
dpc."Tolerance Max %",
|
||||||
|
dpc."Inco Terms",
|
||||||
|
dpc."Loading Place",
|
||||||
|
dpc."Destination Place",
|
||||||
|
dpc."Product",
|
||||||
|
dpc."Delivery Period",
|
||||||
|
fpc."Delivery Date From",
|
||||||
|
fpc."Delivery DateTo",
|
||||||
|
fpc."Quantity",
|
||||||
|
fpc."In Transit Quantity",
|
||||||
|
fpc."Dropship Quantity",
|
||||||
|
fpc."Received Quantity",
|
||||||
|
fpc."Price",
|
||||||
|
fpc."Unit Price",
|
||||||
|
fpc."Theoretical Quantity",
|
||||||
|
fpc."Line Amount",
|
||||||
|
fpc."Physical Quantity",
|
||||||
|
fpc."Open Quantity",
|
||||||
|
fpc."Instructed Quantity"
|
||||||
|
FROM (vw_bi_fct_purchase_physical_contract fpc
|
||||||
|
JOIN vw_bi_dim_purchase_physical_contract dpc ON ((fpc."PurchaseLineId" = dpc."intPurchaseLineId")));;
|
||||||
34
Database Backups/SQL Views/vw_bi_sale_follow_up.sql
Normal file
34
Database Backups/SQL Views/vw_bi_sale_follow_up.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_bi_sale_follow_up AS
|
||||||
|
SELECT dsc."Contract Nb",
|
||||||
|
dsc."Customer",
|
||||||
|
dsc."Contract Ref",
|
||||||
|
dsc."Contract Date",
|
||||||
|
dsc."Contract Status",
|
||||||
|
dsc."Payment Terms",
|
||||||
|
dsc."Currency",
|
||||||
|
dsc."Weight Basis",
|
||||||
|
dsc."Broker",
|
||||||
|
dsc."Certification",
|
||||||
|
dsc."Association",
|
||||||
|
dsc."Crop",
|
||||||
|
dsc."Tolerance Min %",
|
||||||
|
dsc."Tolerance Max %",
|
||||||
|
dsc."Inco Terms",
|
||||||
|
dsc."Loading Place",
|
||||||
|
dsc."Destination Place",
|
||||||
|
dsc."Product",
|
||||||
|
dsc."Delivery Period",
|
||||||
|
dsc."Delivery Date From",
|
||||||
|
dsc."Delivery Date To",
|
||||||
|
dsc."Delivery Status",
|
||||||
|
fsc."Quantity",
|
||||||
|
dsc."Quantity UOM",
|
||||||
|
fsc."Price",
|
||||||
|
fsc."Unit Price",
|
||||||
|
fsc."Theoretical Quantity",
|
||||||
|
fsc."Line Amount",
|
||||||
|
fsc."Theoretical Weight(Kg)",
|
||||||
|
fsc."Physical Weight(Kg)",
|
||||||
|
fsc."Open Weight(Kg)"
|
||||||
|
FROM (vw_bi_fct_sale_physical_contract fsc
|
||||||
|
JOIN vw_bi_dim_sale_physical_contract dsc ON ((fsc."intSaleLineId" = dsc."intSaleLineId")));;
|
||||||
157
Database Backups/SQL Views/vw_cash_forecast.sql
Normal file
157
Database Backups/SQL Views/vw_cash_forecast.sql
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_cash_forecast AS
|
||||||
|
WITH contract_lines AS (
|
||||||
|
SELECT forex.id AS forex_id,
|
||||||
|
forex.number AS forex_number,
|
||||||
|
fcpc.id AS fcpc_id,
|
||||||
|
fcpc.amount AS forex_amount,
|
||||||
|
fcpc.amount AS forex_amount_for_all,
|
||||||
|
((fcpc.amount)::double precision * (((lh.quantity)::double precision * (unit.factor / unit_line.factor)) / pl.quantity)) AS line_amount,
|
||||||
|
(COALESCE(((pl.unit_price)::double precision * ((lh.quantity)::double precision * (unit.factor / unit_line.factor))), ((0)::numeric)::double precision) * ('-1'::integer)::double precision) AS qt_amount,
|
||||||
|
p.id AS contract_id,
|
||||||
|
p.number AS contract_number,
|
||||||
|
'purchase'::text AS contract_type,
|
||||||
|
COALESCE((pe.estimated_date + ptld.days), p.purchase_date) AS maturity_date,
|
||||||
|
pl.id AS contract_line_id,
|
||||||
|
pl.quantity,
|
||||||
|
pp.code AS product_code,
|
||||||
|
cc.code AS currency,
|
||||||
|
ll.lot_type,
|
||||||
|
ll.invoice_line,
|
||||||
|
ll.invoice_line_prov,
|
||||||
|
aml.reconciliation
|
||||||
|
FROM (((((((((((((((purchase_purchase p
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((p.id = fcpc.contract)))
|
||||||
|
LEFT JOIN forex_forex forex ON ((fcpc.forex = forex.id)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((p.currency = cc.id)))
|
||||||
|
LEFT JOIN account_invoice_payment_term pt ON ((pt.id = p.payment_term)))
|
||||||
|
LEFT JOIN account_invoice_payment_term_line ptl ON ((ptl.payment = pt.id)))
|
||||||
|
LEFT JOIN account_invoice_payment_term_line_delta ptld ON ((ptld.line = ptl.id)))
|
||||||
|
LEFT JOIN pricing_estimated pe ON (((pe.purchase = p.id) AND ((pe.trigger)::text = (ptl.trigger_event)::text))))
|
||||||
|
LEFT JOIN lot_lot ll ON ((pl.id = ll.line)))
|
||||||
|
LEFT JOIN lot_qt_hist lh ON ((lh.lot = ll.id)))
|
||||||
|
LEFT JOIN lot_qt_type lt ON (((lh.quantity_type = lt.id) AND (lt.sequence = 1))))
|
||||||
|
LEFT JOIN product_uom unit ON ((unit.id = pl.unit)))
|
||||||
|
LEFT JOIN product_uom unit_line ON ((unit_line.id = ll.lot_unit_line)))
|
||||||
|
LEFT JOIN account_move_line aml ON (((split_part((aml.origin)::text, ','::text, 1) = 'invoice.line'::text) AND ((ll.invoice_line_prov = (split_part((aml.origin)::text, ','::text, 2))::integer) OR (ll.invoice_line = (split_part((aml.origin)::text, ','::text, 2))::integer)))))
|
||||||
|
WHERE (p.currency = 2)
|
||||||
|
UNION ALL
|
||||||
|
SELECT forex.id AS forex_id,
|
||||||
|
forex.number AS forex_number,
|
||||||
|
fcpc.id AS fcpc_id,
|
||||||
|
fcpc.amount AS forex_amount,
|
||||||
|
fcpc.amount AS forex_amount_for_all,
|
||||||
|
((fcpc.amount)::double precision * (((lh.quantity)::double precision * (unit.factor / unit_line.factor)) / sl.quantity)) AS line_amount,
|
||||||
|
((sl.unit_price)::double precision * ((lh.quantity)::double precision * (unit.factor / unit_line.factor))) AS qt_amount,
|
||||||
|
s.id AS contract_id,
|
||||||
|
s.number AS contract_number,
|
||||||
|
'sale'::text AS contract_type,
|
||||||
|
s.sale_date AS maturity_date,
|
||||||
|
sl.id AS contract_line_id,
|
||||||
|
sl.quantity,
|
||||||
|
pp.code AS product_code,
|
||||||
|
cc.code AS currency,
|
||||||
|
ll.lot_type,
|
||||||
|
ll.sale_invoice_line AS invoice_line,
|
||||||
|
ll.sale_invoice_line_prov AS invoice_line_prov,
|
||||||
|
aml.reconciliation
|
||||||
|
FROM (((((((((((sale_sale s
|
||||||
|
LEFT JOIN forex_cover_physical_sale fcpc ON ((s.id = fcpc.contract)))
|
||||||
|
LEFT JOIN forex_forex forex ON ((fcpc.forex = s.id)))
|
||||||
|
LEFT JOIN sale_line sl ON ((sl.sale = s.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((sl.product = pp.id)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((s.currency = cc.id)))
|
||||||
|
LEFT JOIN lot_lot ll ON ((sl.id = ll.sale_line)))
|
||||||
|
LEFT JOIN lot_qt_hist lh ON ((lh.lot = ll.id)))
|
||||||
|
LEFT JOIN lot_qt_type lt ON (((lh.quantity_type = lt.id) AND (lt.sequence = 1))))
|
||||||
|
LEFT JOIN product_uom unit ON ((unit.id = sl.unit)))
|
||||||
|
LEFT JOIN product_uom unit_line ON ((unit_line.id = ll.lot_unit_line)))
|
||||||
|
LEFT JOIN account_move_line aml ON (((split_part((aml.origin)::text, ','::text, 1) = 'invoice.line'::text) AND ((ll.sale_invoice_line_prov = (split_part((aml.origin)::text, ','::text, 2))::integer) OR (ll.sale_invoice_line = (split_part((aml.origin)::text, ','::text, 2))::integer)))))
|
||||||
|
WHERE (s.currency = 2)
|
||||||
|
), contracts_by_status AS (
|
||||||
|
SELECT contract_lines.forex_id,
|
||||||
|
contract_lines.forex_number,
|
||||||
|
contract_lines.fcpc_id,
|
||||||
|
contract_lines.line_amount,
|
||||||
|
contract_lines.forex_amount,
|
||||||
|
contract_lines.forex_amount_for_all,
|
||||||
|
contract_lines.qt_amount,
|
||||||
|
contract_lines.contract_id,
|
||||||
|
contract_lines.contract_number,
|
||||||
|
contract_lines.contract_type,
|
||||||
|
contract_lines.maturity_date,
|
||||||
|
contract_lines.contract_line_id,
|
||||||
|
contract_lines.quantity,
|
||||||
|
contract_lines.product_code,
|
||||||
|
contract_lines.currency,
|
||||||
|
contract_lines.lot_type,
|
||||||
|
contract_lines.invoice_line,
|
||||||
|
contract_lines.invoice_line_prov,
|
||||||
|
contract_lines.reconciliation,
|
||||||
|
CASE
|
||||||
|
WHEN ((contract_lines.lot_type)::text = 'virtual'::text) THEN 'open'::text
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND (contract_lines.invoice_line IS NULL) AND (contract_lines.invoice_line_prov IS NULL)) THEN 'shipped'::text
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND ((contract_lines.invoice_line IS NOT NULL) OR (contract_lines.invoice_line_prov IS NOT NULL)) AND ((contract_lines.reconciliation IS NULL) OR (contract_lines.reconciliation = 0))) THEN 'invoiced'::text
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND ((contract_lines.invoice_line IS NOT NULL) OR (contract_lines.invoice_line_prov IS NOT NULL)) AND (contract_lines.reconciliation > 0)) THEN 'paid'::text
|
||||||
|
ELSE 'total'::text
|
||||||
|
END AS qt_type,
|
||||||
|
CASE
|
||||||
|
WHEN ((contract_lines.lot_type)::text = 'virtual'::text) THEN 1
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND (contract_lines.invoice_line IS NULL) AND (contract_lines.invoice_line_prov IS NULL)) THEN 2
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND ((contract_lines.invoice_line IS NOT NULL) OR (contract_lines.invoice_line_prov IS NOT NULL)) AND ((contract_lines.reconciliation IS NULL) OR (contract_lines.reconciliation = 0))) THEN 3
|
||||||
|
WHEN (((contract_lines.lot_type)::text = 'physic'::text) AND ((contract_lines.invoice_line IS NOT NULL) OR (contract_lines.invoice_line_prov IS NOT NULL)) AND (contract_lines.reconciliation > 0)) THEN 4
|
||||||
|
ELSE 0
|
||||||
|
END AS qt_order
|
||||||
|
FROM contract_lines
|
||||||
|
), forex_summary AS (
|
||||||
|
SELECT forex.number AS forex_number,
|
||||||
|
'forex'::text AS line_type,
|
||||||
|
NULL::text AS contract_number,
|
||||||
|
NULL::text AS contract_type,
|
||||||
|
NULL::text AS contract_line,
|
||||||
|
NULL::text AS qt_type,
|
||||||
|
0 AS qt_order,
|
||||||
|
max(forex.rate) AS rate,
|
||||||
|
NULL::numeric AS amount_covered,
|
||||||
|
NULL::numeric AS forex_amount,
|
||||||
|
forex.buy_amount AS qt_amount,
|
||||||
|
forex.buy_amount AS total_amount_forex,
|
||||||
|
(forex.buy_amount - COALESCE(sum(fcpc.amount), (0)::numeric)) AS amount_remaining,
|
||||||
|
max((cc.code)::text) AS currency,
|
||||||
|
forex.value_date AS maturity_date
|
||||||
|
FROM ((forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((forex.buy_currency = cc.id)))
|
||||||
|
GROUP BY forex.id, forex.number, forex.buy_amount
|
||||||
|
)
|
||||||
|
SELECT forex_summary.line_type,
|
||||||
|
forex_summary.forex_number AS contract_ref,
|
||||||
|
forex_summary.contract_line,
|
||||||
|
forex_summary.qt_type,
|
||||||
|
forex_summary.qt_order,
|
||||||
|
forex_summary.rate,
|
||||||
|
forex_summary.forex_amount,
|
||||||
|
forex_summary.qt_amount,
|
||||||
|
forex_summary.total_amount_forex,
|
||||||
|
forex_summary.amount_remaining,
|
||||||
|
forex_summary.currency,
|
||||||
|
forex_summary.maturity_date,
|
||||||
|
to_char((forex_summary.maturity_date)::timestamp with time zone, 'MONYY'::text) AS maturity_month
|
||||||
|
FROM forex_summary
|
||||||
|
UNION ALL
|
||||||
|
SELECT cl.contract_type AS line_type,
|
||||||
|
cl.contract_number AS contract_ref,
|
||||||
|
((cl.product_code)::text || COALESCE(((' ('::text || cl.contract_line_id) || ')'::text), ''::text)) AS contract_line,
|
||||||
|
cl.qt_type,
|
||||||
|
cl.qt_order,
|
||||||
|
NULL::numeric AS rate,
|
||||||
|
cl.forex_amount,
|
||||||
|
cl.qt_amount,
|
||||||
|
NULL::numeric AS total_amount_forex,
|
||||||
|
NULL::numeric AS amount_remaining,
|
||||||
|
cl.currency,
|
||||||
|
cl.maturity_date,
|
||||||
|
to_char((cl.maturity_date)::timestamp with time zone, 'MONYY'::text) AS maturity_month
|
||||||
|
FROM contracts_by_status cl
|
||||||
|
ORDER BY 1, 2 DESC, 3, 6 DESC;;
|
||||||
17
Database Backups/SQL Views/vw_forex.sql
Normal file
17
Database Backups/SQL Views/vw_forex.sql
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_forex AS
|
||||||
|
SELECT forex.number AS forex_number,
|
||||||
|
p.number AS purchase_number,
|
||||||
|
((((pp.code)::text || ' ('::text) || pl.quantity) || ')'::text) AS purchase_line,
|
||||||
|
ai.number AS invoice_number,
|
||||||
|
forex.for_amount AS forex_amount,
|
||||||
|
fcpc.amount AS amount_covered,
|
||||||
|
sum(fcpc.amount) OVER (PARTITION BY forex.id ORDER BY fcpc.id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_covered,
|
||||||
|
(forex.for_amount - sum(fcpc.amount) OVER (PARTITION BY forex.id ORDER BY fcpc.id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)) AS balance
|
||||||
|
FROM ((((((forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN purchase_purchase p ON ((fcpc.contract = p.id)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN account_invoice_line ail ON (((split_part((ail.origin)::text, ','::text, 1) = 'purchase.line'::text) AND (pl.id = (split_part((ail.origin)::text, ','::text, 2))::integer))))
|
||||||
|
LEFT JOIN account_invoice ai ON ((ail.invoice = ai.id)))
|
||||||
|
ORDER BY forex.number, fcpc.id;;
|
||||||
61
Database Backups/SQL Views/vw_fx_by_maturity_by_contract.sql
Normal file
61
Database Backups/SQL Views/vw_fx_by_maturity_by_contract.sql
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_fx_by_maturity_by_contract AS
|
||||||
|
WITH combined AS (
|
||||||
|
SELECT p.number AS purchase_number,
|
||||||
|
'contract'::text AS line_type,
|
||||||
|
NULL::character varying AS forex_number,
|
||||||
|
NULL::numeric AS amount_covered,
|
||||||
|
string_agg(DISTINCT (pp.code)::text, ', '::text) AS products,
|
||||||
|
max((pl.quantity * (pl.unit_price)::double precision)) AS total_contract_value,
|
||||||
|
(max((pl.quantity * (pl.unit_price)::double precision)) - COALESCE((sum(fcpc.amount))::double precision, (0)::double precision)) AS amount_remaining,
|
||||||
|
max((cc.code)::text) AS currency,
|
||||||
|
NULL::numeric AS rate,
|
||||||
|
COALESCE(max((pe.estimated_date + ptld.days)), max(p.purchase_date)) AS maturity_date,
|
||||||
|
NULL::text AS status
|
||||||
|
FROM ((((((((purchase_purchase p
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((fcpc.contract = p.id)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((p.currency = cc.id)))
|
||||||
|
LEFT JOIN account_invoice_payment_term pt ON ((pt.id = p.payment_term)))
|
||||||
|
LEFT JOIN account_invoice_payment_term_line ptl ON ((ptl.payment = pt.id)))
|
||||||
|
LEFT JOIN account_invoice_payment_term_line_delta ptld ON ((ptld.line = ptl.id)))
|
||||||
|
LEFT JOIN pricing_estimated pe ON (((pe.purchase = p.id) AND ((pe.trigger)::text = (ptl.trigger_event)::text))))
|
||||||
|
WHERE (p.currency = 2)
|
||||||
|
GROUP BY p.number
|
||||||
|
UNION ALL
|
||||||
|
SELECT p.number AS purchase_number,
|
||||||
|
'forex'::text AS line_type,
|
||||||
|
forex.number AS forex_number,
|
||||||
|
fcpc.amount AS amount_covered,
|
||||||
|
NULL::text AS products,
|
||||||
|
NULL::numeric AS total_contract_value,
|
||||||
|
NULL::numeric AS amount_remaining,
|
||||||
|
cc.code AS currency,
|
||||||
|
forex.rate,
|
||||||
|
forex.value_date AS maturity_date,
|
||||||
|
CASE
|
||||||
|
WHEN (forex.move > 0) THEN 'executed'::text
|
||||||
|
ELSE 'not executed'::text
|
||||||
|
END AS status
|
||||||
|
FROM (((purchase_purchase p
|
||||||
|
JOIN forex_cover_physical_contract fcpc ON ((fcpc.contract = p.id)))
|
||||||
|
JOIN forex_forex forex ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((forex.buy_currency = cc.id)))
|
||||||
|
WHERE (forex.buy_currency = 2)
|
||||||
|
)
|
||||||
|
SELECT to_char((max(maturity_date))::timestamp with time zone, 'MONYY'::text) AS maturity_month,
|
||||||
|
max(maturity_date) AS maturity_date,
|
||||||
|
line_type,
|
||||||
|
purchase_number,
|
||||||
|
forex_number,
|
||||||
|
max(status) AS status,
|
||||||
|
max(products) AS products,
|
||||||
|
COALESCE(sum(amount_covered), (0)::numeric) AS amount_covered,
|
||||||
|
COALESCE(sum(total_contract_value), (0)::double precision) AS total_contract_value,
|
||||||
|
COALESCE(sum(amount_remaining), (0)::double precision) AS amount_remaining,
|
||||||
|
((COALESCE(sum(amount_covered), (0)::numeric))::double precision / COALESCE(sum(total_contract_value), (1)::double precision)) AS percent_covered,
|
||||||
|
max(currency) AS currency,
|
||||||
|
max(rate) AS rate
|
||||||
|
FROM combined
|
||||||
|
GROUP BY line_type, purchase_number, forex_number
|
||||||
|
ORDER BY (max(maturity_date)), purchase_number, line_type, forex_number;;
|
||||||
68
Database Backups/SQL Views/vw_fx_by_maturity_by_forex.sql
Normal file
68
Database Backups/SQL Views/vw_fx_by_maturity_by_forex.sql
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_fx_by_maturity_by_forex AS
|
||||||
|
WITH combined AS (
|
||||||
|
SELECT p.number AS purchase_number,
|
||||||
|
'contract'::text AS line_type,
|
||||||
|
forex.number AS forex_number,
|
||||||
|
COALESCE(sum(fcpc.amount), (0)::numeric) AS amount_covered,
|
||||||
|
string_agg(DISTINCT (pp.code)::text, ', '::text) AS products,
|
||||||
|
COALESCE(max((pl.quantity * (pl.unit_price)::double precision)), (0)::double precision) AS total_contract_value,
|
||||||
|
max((cc.code)::text) AS currency,
|
||||||
|
forex.rate,
|
||||||
|
forex.value_date AS maturity_date,
|
||||||
|
CASE
|
||||||
|
WHEN (max(forex.move) > 0) THEN 'executed'::text
|
||||||
|
ELSE 'not executed'::text
|
||||||
|
END AS status
|
||||||
|
FROM (((((purchase_purchase p
|
||||||
|
JOIN forex_cover_physical_contract fcpc ON ((fcpc.contract = p.id)))
|
||||||
|
JOIN forex_forex forex ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN product_product pp ON ((pl.product = pp.id)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((forex.buy_currency = cc.id)))
|
||||||
|
WHERE (p.currency = 2)
|
||||||
|
GROUP BY p.number, forex.number, forex.rate, forex.value_date
|
||||||
|
UNION ALL
|
||||||
|
SELECT NULL::text AS purchase_number,
|
||||||
|
'forex'::text AS line_type,
|
||||||
|
forex.number AS forex_number,
|
||||||
|
COALESCE(NULL::numeric, (0)::numeric) AS amount_covered,
|
||||||
|
NULL::text AS products,
|
||||||
|
COALESCE(NULL::numeric, (0)::numeric) AS total_contract_value,
|
||||||
|
cc.code AS currency,
|
||||||
|
forex.rate,
|
||||||
|
forex.value_date AS maturity_date,
|
||||||
|
CASE
|
||||||
|
WHEN (forex.move > 0) THEN 'executed'::text
|
||||||
|
ELSE 'not executed'::text
|
||||||
|
END AS status
|
||||||
|
FROM (forex_forex forex
|
||||||
|
LEFT JOIN currency_currency cc ON ((forex.buy_currency = cc.id)))
|
||||||
|
WHERE (forex.buy_currency = 2)
|
||||||
|
)
|
||||||
|
SELECT to_char(date_trunc('month'::text, (c.maturity_date)::timestamp with time zone), 'MONYY'::text) AS maturity_period,
|
||||||
|
max(c.maturity_date) AS maturity_date,
|
||||||
|
c.line_type,
|
||||||
|
c.forex_number,
|
||||||
|
c.purchase_number,
|
||||||
|
max(c.status) AS status,
|
||||||
|
max(c.products) AS products,
|
||||||
|
max(c.currency) AS currency,
|
||||||
|
max(c.rate) AS rate,
|
||||||
|
CASE
|
||||||
|
WHEN (c.line_type = 'forex'::text) THEN fx.buy_amount
|
||||||
|
ELSE NULL::numeric
|
||||||
|
END AS forex_total_amount,
|
||||||
|
sum(COALESCE(c.amount_covered, (0)::numeric)) AS amount_covered,
|
||||||
|
CASE
|
||||||
|
WHEN (c.line_type = 'forex'::text) THEN (fx.buy_amount - COALESCE(sum(fc.amount_covered), (0)::numeric))
|
||||||
|
ELSE NULL::numeric
|
||||||
|
END AS amount_remaining
|
||||||
|
FROM ((combined c
|
||||||
|
LEFT JOIN forex_forex fx ON (((fx.number)::text = (c.forex_number)::text)))
|
||||||
|
LEFT JOIN ( SELECT forex.number AS forex_number,
|
||||||
|
sum(fcpc.amount) AS amount_covered
|
||||||
|
FROM (forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
GROUP BY forex.number) fc ON (((fc.forex_number)::text = (c.forex_number)::text)))
|
||||||
|
GROUP BY (date_trunc('month'::text, (c.maturity_date)::timestamp with time zone)), c.line_type, c.forex_number, c.purchase_number, fx.buy_amount
|
||||||
|
ORDER BY (date_trunc('month'::text, (c.maturity_date)::timestamp with time zone)), c.forex_number, c.line_type, c.purchase_number;;
|
||||||
20
Database Backups/SQL Views/vw_fx_by_maturity_sum.sql
Normal file
20
Database Backups/SQL Views/vw_fx_by_maturity_sum.sql
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_fx_by_maturity_sum AS
|
||||||
|
SELECT period,
|
||||||
|
max(maturity_date) AS max,
|
||||||
|
max(amount_remaining_contract) AS rem_ct,
|
||||||
|
COALESCE(max(amount_remaining_forex), (0)::numeric) AS rem_fx,
|
||||||
|
(COALESCE(max(amount_remaining_contract), (0)::double precision) - COALESCE((max(amount_remaining_forex))::double precision, (0)::double precision)) AS req_fx
|
||||||
|
FROM ( SELECT vw_fx_by_maturity_by_contract.maturity_month AS period,
|
||||||
|
max(vw_fx_by_maturity_by_contract.maturity_date) AS maturity_date,
|
||||||
|
sum(vw_fx_by_maturity_by_contract.amount_remaining) AS amount_remaining_contract,
|
||||||
|
NULL::numeric AS amount_remaining_forex
|
||||||
|
FROM vw_fx_by_maturity_by_contract
|
||||||
|
GROUP BY vw_fx_by_maturity_by_contract.maturity_month
|
||||||
|
UNION ALL
|
||||||
|
SELECT vw_fx_by_maturity_by_forex.maturity_period AS period,
|
||||||
|
max(vw_fx_by_maturity_by_forex.maturity_date) AS maturity_date,
|
||||||
|
NULL::double precision AS amount_remaining_contract,
|
||||||
|
sum(vw_fx_by_maturity_by_forex.amount_remaining) AS amount_remaining_forex
|
||||||
|
FROM vw_fx_by_maturity_by_forex
|
||||||
|
GROUP BY vw_fx_by_maturity_by_forex.maturity_period) m
|
||||||
|
GROUP BY period;;
|
||||||
48
Database Backups/SQL Views/vw_fx_running.sql
Normal file
48
Database Backups/SQL Views/vw_fx_running.sql
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_fx_running AS
|
||||||
|
WITH forex_event AS (
|
||||||
|
SELECT max(forex.value_date) AS event_date,
|
||||||
|
'Execution FX'::text AS type,
|
||||||
|
max(forex.buy_amount) AS amount,
|
||||||
|
forex.number AS event_ref,
|
||||||
|
string_agg((p.number)::text, ', '::text) AS linked_purchase
|
||||||
|
FROM ((forex_forex forex
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((fcpc.forex = forex.id)))
|
||||||
|
LEFT JOIN purchase_purchase p ON ((fcpc.contract = p.id)))
|
||||||
|
WHERE (forex.move IS NOT NULL)
|
||||||
|
GROUP BY forex.number
|
||||||
|
), all_events AS (
|
||||||
|
SELECT forex_event.event_date,
|
||||||
|
forex_event.type,
|
||||||
|
forex_event.amount,
|
||||||
|
forex_event.event_ref,
|
||||||
|
forex_event.linked_purchase
|
||||||
|
FROM forex_event
|
||||||
|
UNION ALL
|
||||||
|
SELECT max(am.post_date) AS event_date,
|
||||||
|
'Payment P'::text AS type,
|
||||||
|
(- max(aml.amount_second_currency)) AS amount,
|
||||||
|
max((p.number)::text) AS event_ref,
|
||||||
|
max(fe.linked_purchase) AS linked_purchase
|
||||||
|
FROM (((((((((((forex_forex forex
|
||||||
|
LEFT JOIN forex_event fe ON (((fe.event_ref)::text = (forex.number)::text)))
|
||||||
|
LEFT JOIN forex_cover_physical_contract fcpc ON ((forex.id = fcpc.forex)))
|
||||||
|
LEFT JOIN purchase_purchase p ON ((fcpc.contract = p.id)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.purchase = p.id)))
|
||||||
|
LEFT JOIN lot_lot ll ON ((pl.id = ll.line)))
|
||||||
|
LEFT JOIN account_invoice_line ail ON ((ll.invoice_line_prov = ail.id)))
|
||||||
|
LEFT JOIN account_invoice_line ail2 ON ((ll.invoice_line = ail2.id)))
|
||||||
|
LEFT JOIN account_invoice ai ON ((ail.invoice = ai.id)))
|
||||||
|
LEFT JOIN account_invoice ai2 ON ((ail2.invoice = ai2.id)))
|
||||||
|
LEFT JOIN account_move am ON (((split_part((am.origin)::text, ','::text, 1) = 'account.invoice'::text) AND ((ai.id = (split_part((am.origin)::text, ','::text, 2))::integer) OR (ai2.id = (split_part((am.origin)::text, ','::text, 2))::integer)))))
|
||||||
|
LEFT JOIN account_move_line aml ON ((am.id = aml.move)))
|
||||||
|
WHERE ((forex.move IS NOT NULL) AND (aml.reconciliation > 0))
|
||||||
|
GROUP BY forex.number
|
||||||
|
)
|
||||||
|
SELECT event_date,
|
||||||
|
type,
|
||||||
|
amount,
|
||||||
|
event_ref,
|
||||||
|
linked_purchase,
|
||||||
|
sum(amount) OVER (ORDER BY event_date) AS running_amount
|
||||||
|
FROM all_events
|
||||||
|
ORDER BY event_date;;
|
||||||
19
Database Backups/SQL Views/vw_pnl.sql
Normal file
19
Database Backups/SQL Views/vw_pnl.sql
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_pnl AS
|
||||||
|
SELECT pp.name AS "Supplier",
|
||||||
|
sp.name AS "Client",
|
||||||
|
CASE
|
||||||
|
WHEN (pt.name IS NOT NULL) THEN pt.name
|
||||||
|
ELSE pt2.name
|
||||||
|
END AS "Product",
|
||||||
|
v.amount AS "Amount"
|
||||||
|
FROM ((((((((((valuation_valuation v
|
||||||
|
LEFT JOIN product_product pr ON ((pr.id = v.product)))
|
||||||
|
LEFT JOIN product_template pt ON ((pt.id = v.product)))
|
||||||
|
LEFT JOIN product_template pt2 ON ((pt2.id = pr.template)))
|
||||||
|
LEFT JOIN product_product pr2 ON ((pr2.template = pt2.id)))
|
||||||
|
LEFT JOIN purchase_purchase p ON ((p.id = v.purchase)))
|
||||||
|
LEFT JOIN purchase_line pl ON ((pl.id = v.line)))
|
||||||
|
LEFT JOIN sale_sale s ON ((s.id = v.sale)))
|
||||||
|
LEFT JOIN sale_line sl ON ((sl.id = v.sale_line)))
|
||||||
|
LEFT JOIN party_party pp ON ((pp.id = p.party)))
|
||||||
|
LEFT JOIN party_party sp ON ((sp.id = s.party)));;
|
||||||
30
Database Backups/SQL Views/vw_utility_account_move.sql
Normal file
30
Database Backups/SQL Views/vw_utility_account_move.sql
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_account_move AS
|
||||||
|
SELECT am.id AS "intAccountMoveId",
|
||||||
|
am.date AS "dtmDate",
|
||||||
|
am.post_date AS "dtmPostDate",
|
||||||
|
COALESCE(am.post_number, ''::character varying) AS "strPostNumber",
|
||||||
|
COALESCE(am.description, ''::character varying) AS "strDescription",
|
||||||
|
am.journal AS "intJournalId",
|
||||||
|
am.number AS "strJournalNb",
|
||||||
|
am.state AS "strState",
|
||||||
|
COALESCE(split_part((am.origin)::text, ','::text, 1), ''::text) AS "strOrigin",
|
||||||
|
COALESCE((split_part((am.origin)::text, ','::text, 2))::integer, 0) AS "intOriginId",
|
||||||
|
aml.lot AS "intLotId",
|
||||||
|
COALESCE(aml.reconciliation, 0) AS "intReconciliation",
|
||||||
|
aml.debit AS "dblDebit",
|
||||||
|
aml.credit AS "dblCredit",
|
||||||
|
aml.maturity_date AS "dtmMaturityDate",
|
||||||
|
COALESCE(split_part((aml.origin)::text, ','::text, 1), ''::text) AS "strLineOrigin",
|
||||||
|
COALESCE((split_part((aml.origin)::text, ','::text, 2))::integer, 0) AS "intLineOriginId",
|
||||||
|
acc.name AS "strAccount",
|
||||||
|
aj.code AS "strAccountJournalCode",
|
||||||
|
aj.name AS "strAccountJournal",
|
||||||
|
aj.type AS "strAccountJournalType",
|
||||||
|
COALESCE(cc.name, ''::character varying) AS "strSecondCurrency",
|
||||||
|
COALESCE(aml.amount_second_currency, (0)::numeric) AS "dblAmountSecondCurrency",
|
||||||
|
(aml.debit - aml.credit) AS "dblAmount"
|
||||||
|
FROM ((((account_move am
|
||||||
|
JOIN account_move_line aml ON ((am.id = aml.move)))
|
||||||
|
JOIN account_account acc ON ((aml.account = acc.id)))
|
||||||
|
JOIN account_journal aj ON ((am.journal = aj.id)))
|
||||||
|
LEFT JOIN currency_currency cc ON ((aml.second_currency = cc.id)));;
|
||||||
32
Database Backups/SQL Views/vw_utility_book_dimension.sql
Normal file
32
Database Backups/SQL Views/vw_utility_book_dimension.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_book_dimension AS
|
||||||
|
WITH bookvalue AS (
|
||||||
|
SELECT ad.id AS "dimensionId",
|
||||||
|
adv.id AS "valueId",
|
||||||
|
ad.code AS "dimensionCode",
|
||||||
|
adv.code AS "valueCode",
|
||||||
|
adv.name AS "valueName"
|
||||||
|
FROM (analytic_dimension ad
|
||||||
|
JOIN analytic_dimension_value adv ON ((ad.id = adv.dimension)))
|
||||||
|
WHERE ((1 = 1) AND ((ad.code)::text = 'book'::text))
|
||||||
|
)
|
||||||
|
SELECT DISTINCT aa.purchase AS "intTradeId",
|
||||||
|
pl.id AS "intTradeLineId",
|
||||||
|
'Physical'::text AS "strTradeCategory",
|
||||||
|
'Purchase'::text AS "strTradeType",
|
||||||
|
bv."valueCode" AS "strValueCode",
|
||||||
|
bv."valueName" AS "strValueName"
|
||||||
|
FROM ((analytic_dimension_assignment aa
|
||||||
|
JOIN bookvalue bv ON (((aa.dimension = bv."dimensionId") AND (aa.value = bv."valueId"))))
|
||||||
|
JOIN purchase_line pl ON ((aa.purchase = pl.purchase)))
|
||||||
|
WHERE (COALESCE(aa.purchase, 0) > 0)
|
||||||
|
UNION ALL
|
||||||
|
SELECT DISTINCT aa.sale AS "intTradeId",
|
||||||
|
sl.id AS "intTradeLineId",
|
||||||
|
'Physical'::text AS "strTradeCategory",
|
||||||
|
'Sale'::text AS "strTradeType",
|
||||||
|
bv."valueCode" AS "strValueCode",
|
||||||
|
bv."valueName" AS "strValueName"
|
||||||
|
FROM ((analytic_dimension_assignment aa
|
||||||
|
JOIN bookvalue bv ON (((aa.dimension = bv."dimensionId") AND (aa.value = bv."valueId"))))
|
||||||
|
JOIN sale_line sl ON ((sl.sale = aa.sale)))
|
||||||
|
WHERE (COALESCE(aa.sale, 0) > 0);;
|
||||||
56
Database Backups/SQL Views/vw_utility_contract_fees.sql
Normal file
56
Database Backups/SQL Views/vw_utility_contract_fees.sql
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_contract_fees AS
|
||||||
|
SELECT f.id AS "intFeeId",
|
||||||
|
'Purchase'::text AS "strContractType",
|
||||||
|
f.line AS "intContractLineId",
|
||||||
|
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",
|
||||||
|
uom.name AS "strUnit",
|
||||||
|
CASE
|
||||||
|
WHEN (upper((f.p_r)::text) = 'REC'::text) THEN '-1'::integer
|
||||||
|
ELSE 1
|
||||||
|
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)))
|
||||||
|
JOIN product_uom uom ON ((f.unit = uom.id)))
|
||||||
|
JOIN party_party sup ON ((f.supplier = sup.id)))
|
||||||
|
WHERE (COALESCE(f.line, 0) > 0)
|
||||||
|
UNION ALL
|
||||||
|
SELECT f.id AS "intFeeId",
|
||||||
|
'Sale'::text AS "strContractType",
|
||||||
|
f.sale_line AS "intContractLineId",
|
||||||
|
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",
|
||||||
|
uom.name 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)))
|
||||||
|
JOIN product_uom uom ON ((f.unit = uom.id)))
|
||||||
|
JOIN party_party sup ON ((f.supplier = sup.id)))
|
||||||
|
WHERE (COALESCE(f.sale_line, 0) > 0);;
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_dim_physical_purchase_contract AS
|
||||||
|
SELECT 0 AS "intPurchaseLineId",
|
||||||
|
''::character varying AS "strContractNb",
|
||||||
|
''::character varying AS "strCounterparty",
|
||||||
|
''::character varying AS "strReference",
|
||||||
|
NULL::date AS "dtmContractDate",
|
||||||
|
''::character varying AS "strContractStatus",
|
||||||
|
''::character varying AS "strPaymentTerm",
|
||||||
|
''::character varying AS "strCurrency",
|
||||||
|
''::character varying AS "strCertification",
|
||||||
|
''::character varying AS "strWeightBasis",
|
||||||
|
''::character varying AS "strBroker",
|
||||||
|
''::character varying AS "strCertif",
|
||||||
|
''::character varying AS "strAssociation",
|
||||||
|
''::character varying AS "strCrop",
|
||||||
|
0 AS "dblTolMinPct",
|
||||||
|
0 AS "dblTolMaxPct",
|
||||||
|
''::character varying AS "strIncoterm",
|
||||||
|
''::character varying AS "strLoadingPlace",
|
||||||
|
''::character varying AS "strDestinationPlace",
|
||||||
|
''::text AS "strProduct",
|
||||||
|
''::character varying AS "strDeliveryPeriod",
|
||||||
|
NULL::date AS "dtmDeliveryDateFrom",
|
||||||
|
NULL::date AS "dtmDeliveryDateTo",
|
||||||
|
''::character varying AS "strRegion",
|
||||||
|
''::character varying AS "strStrategyName",
|
||||||
|
''::character varying AS "strBookName",
|
||||||
|
''::character varying AS "strQuantityUom",
|
||||||
|
''::character varying AS "strIncotermCode",
|
||||||
|
NULL::date AS "dtmEstimatedBLDate",
|
||||||
|
''::character varying AS "strPricingType",
|
||||||
|
''::character varying AS "strCounterpartyCountry"
|
||||||
|
UNION ALL
|
||||||
|
SELECT pl.id AS "intPurchaseLineId",
|
||||||
|
pc.number AS "strContractNb",
|
||||||
|
pty.name AS "strCounterparty",
|
||||||
|
pc.reference AS "strReference",
|
||||||
|
pc.purchase_date AS "dtmContractDate",
|
||||||
|
CASE
|
||||||
|
WHEN ((pc.state)::text = 'draft'::text) THEN 'Draft'::text
|
||||||
|
WHEN ((pc.state)::text = 'confirmed'::text) THEN 'Confirmed'::text
|
||||||
|
WHEN ((pc.state)::text = 'processing'::text) THEN 'Processing'::text
|
||||||
|
ELSE 'Validated'::text
|
||||||
|
END AS "strContractStatus",
|
||||||
|
COALESCE(pt.name, ''::character varying) AS "strPaymentTerm",
|
||||||
|
cur.name AS "strCurrency",
|
||||||
|
COALESCE(pc.certification, ''::character varying) AS "strCertification",
|
||||||
|
COALESCE(wbs.name, ''::character varying) AS "strWeightBasis",
|
||||||
|
COALESCE(brk.name, ''::character varying) AS "strBroker",
|
||||||
|
COALESCE(cer.name, ''::character varying) AS "strCertif",
|
||||||
|
COALESCE(ass.name, ''::character varying) AS "strAssociation",
|
||||||
|
COALESCE(crp.name, ''::character varying) AS "strCrop",
|
||||||
|
pc.tol_min AS "dblTolMinPct",
|
||||||
|
pc.tol_max AS "dblTolMaxPct",
|
||||||
|
COALESCE(inc.name, ''::character varying) AS "strIncoterm",
|
||||||
|
COALESCE(src.name, ''::character varying) AS "strLoadingPlace",
|
||||||
|
COALESCE(dst.name, ''::character varying) AS "strDestinationPlace",
|
||||||
|
concat('[', pr."strProductCode", '] ', pr."strTemplate") AS "strProduct",
|
||||||
|
COALESCE(pm.month_name) AS "strDeliveryPeriod",
|
||||||
|
pl.from_del AS "dtmDeliveryDateFrom",
|
||||||
|
pl.to_del AS "dtmDeliveryDateTo",
|
||||||
|
ad."strRegion",
|
||||||
|
strategy."strValueName" AS "strStrategyName",
|
||||||
|
book."strValueName" AS "strBookName",
|
||||||
|
pu1.name AS "strQuantityUom",
|
||||||
|
COALESCE(inc.code, ''::character varying) AS "strIncotermCode",
|
||||||
|
COALESCE(bl.estimated_date, pl.to_del) AS "dtmEstimatedBLDate",
|
||||||
|
pl.price_type AS "strPricingType",
|
||||||
|
COALESCE(ad."strCountry", 'Undefined'::character varying) AS "strCounterpartyCountry"
|
||||||
|
FROM (((((((((((((((((((purchase_line pl
|
||||||
|
JOIN purchase_purchase pc ON ((pl.purchase = pc.id)))
|
||||||
|
JOIN party_party pty ON ((pc.party = pty.id)))
|
||||||
|
JOIN currency_currency cur ON ((pc.currency = cur.id)))
|
||||||
|
JOIN product_uom pu1 ON ((pl.unit = pu1.id)))
|
||||||
|
LEFT JOIN party_party brk ON ((pc.broker = brk.id)))
|
||||||
|
LEFT JOIN account_invoice_payment_term pt ON ((pc.payment_term = pt.id)))
|
||||||
|
LEFT JOIN purchase_crop crp ON ((pc.crop = crp.id)))
|
||||||
|
LEFT JOIN purchase_certification cer ON ((pc.certif = cer.id)))
|
||||||
|
LEFT JOIN purchase_association ass ON ((pc.association = ass.id)))
|
||||||
|
LEFT JOIN purchase_weight_basis wbs ON ((pc.wb = wbs.id)))
|
||||||
|
LEFT JOIN stock_location src ON ((pc.from_location = src.id)))
|
||||||
|
LEFT JOIN stock_location dst ON ((pc.to_location = dst.id)))
|
||||||
|
LEFT JOIN incoterm_incoterm inc ON ((pc.incoterm = inc.id)))
|
||||||
|
JOIN vw_utility_product pr ON ((pl.product = pr."intProductId")))
|
||||||
|
LEFT JOIN product_month pm ON ((pl.del_period = pm.id)))
|
||||||
|
LEFT JOIN vw_utility_last_counterparty_address ad ON ((pty.id = ad."intPartyId")))
|
||||||
|
LEFT JOIN vw_utility_strategy_dimension strategy ON (((pl.id = strategy."intTradeLineId") AND (strategy."strTradeCategory" = 'Physical'::text) AND (strategy."strTradeType" = 'Purchase'::text))))
|
||||||
|
LEFT JOIN vw_utility_book_dimension book ON (((pl.id = book."intTradeLineId") AND (book."strTradeCategory" = 'Physical'::text) AND (book."strTradeType" = 'Purchase'::text))))
|
||||||
|
LEFT JOIN pricing_estimated bl ON (((pl.id = bl.line) AND ((bl.trigger)::text = 'bldate'::text))))
|
||||||
|
WHERE ((1 = 1) AND ((pl.type)::text = 'line'::text) AND ((pc.line_type)::text = 'goods'::text));;
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_dim_physical_sale_contract AS
|
||||||
|
SELECT 0 AS "intSaleLineId",
|
||||||
|
''::character varying AS "strContractNb",
|
||||||
|
''::character varying AS "strCounterparty",
|
||||||
|
''::character varying AS "strReference",
|
||||||
|
NULL::date AS "dtmContractDate",
|
||||||
|
''::character varying AS "strContractStatus",
|
||||||
|
''::character varying AS "strPaymentTerm",
|
||||||
|
''::character varying AS "strCurrency",
|
||||||
|
''::character varying AS "strCertification",
|
||||||
|
''::character varying AS "strWeightBasis",
|
||||||
|
''::character varying AS "strBroker",
|
||||||
|
''::character varying AS "strCertif",
|
||||||
|
''::character varying AS "strAssociation",
|
||||||
|
''::character varying AS "strCrop",
|
||||||
|
0 AS "dblTolMinPct",
|
||||||
|
0 AS "dblTolMaxPct",
|
||||||
|
''::character varying AS "strIncoterm",
|
||||||
|
''::character varying AS "strLoadingPlace",
|
||||||
|
''::character varying AS "strDestinationPlace",
|
||||||
|
''::text AS "strProduct",
|
||||||
|
''::character varying AS "strDeliveryPeriod",
|
||||||
|
NULL::date AS "dtmDeliveryDateFrom",
|
||||||
|
NULL::date AS "dtmDeliveryDateTo",
|
||||||
|
''::character varying AS "strQuantityUom",
|
||||||
|
''::character varying AS "strRegion",
|
||||||
|
''::character varying AS "strStrategyName",
|
||||||
|
''::character varying AS "strBookName",
|
||||||
|
''::character varying AS "strIncotermCode",
|
||||||
|
NULL::date AS "dtmEstimatedBLDate",
|
||||||
|
''::character varying AS "strPricingType",
|
||||||
|
''::character varying AS "strCounterpartyCountry"
|
||||||
|
UNION ALL
|
||||||
|
SELECT sl.id AS "intSaleLineId",
|
||||||
|
sc.number AS "strContractNb",
|
||||||
|
pty.name AS "strCounterparty",
|
||||||
|
sc.reference AS "strReference",
|
||||||
|
sc.sale_date AS "dtmContractDate",
|
||||||
|
sc.state AS "strContractStatus",
|
||||||
|
COALESCE(pt.name, ''::character varying) AS "strPaymentTerm",
|
||||||
|
cur.name AS "strCurrency",
|
||||||
|
COALESCE(sc.certification, ''::character varying) AS "strCertification",
|
||||||
|
COALESCE(wbs.name, ''::character varying) AS "strWeightBasis",
|
||||||
|
COALESCE(brk.name, ''::character varying) AS "strBroker",
|
||||||
|
COALESCE(cer.name, ''::character varying) AS "strCertif",
|
||||||
|
COALESCE(ass.name, ''::character varying) AS "strAssociation",
|
||||||
|
COALESCE(crp.name, ''::character varying) AS "strCrop",
|
||||||
|
sc.tol_min AS "dblTolMinPct",
|
||||||
|
sc.tol_max AS "dblTolMaxPct",
|
||||||
|
COALESCE(inc.name, ''::character varying) AS "strIncoterm",
|
||||||
|
COALESCE(src.name, ''::character varying) AS "strLoadingPlace",
|
||||||
|
COALESCE(dst.name, ''::character varying) AS "strDestinationPlace",
|
||||||
|
concat('[', pr."strProductCode", '] ', pr."strTemplate") AS "strProduct",
|
||||||
|
COALESCE(pm.month_name) AS "strDeliveryPeriod",
|
||||||
|
sl.from_del AS "dtmDeliveryDateFrom",
|
||||||
|
sl.to_del AS "dtmDeliveryDateTo",
|
||||||
|
pu1.name AS "strQuantityUom",
|
||||||
|
ad."strRegion",
|
||||||
|
strategy."strValueName" AS "strStrategyName",
|
||||||
|
book."strValueName" AS "strBookName",
|
||||||
|
COALESCE(inc.code, ''::character varying) AS "strIncotermCode",
|
||||||
|
COALESCE(bl.estimated_date, sl.to_del) AS "dtmEstimatedBLDate",
|
||||||
|
sl.price_type AS "strPricingType",
|
||||||
|
COALESCE(ad."strCountry", 'Undefined'::character varying) AS "strCounterpartyCountry"
|
||||||
|
FROM (((((((((((((((((((sale_line sl
|
||||||
|
JOIN sale_sale sc ON ((sl.sale = sc.id)))
|
||||||
|
JOIN party_party pty ON ((sc.party = pty.id)))
|
||||||
|
JOIN currency_currency cur ON ((sc.currency = cur.id)))
|
||||||
|
JOIN product_uom pu1 ON ((sl.unit = pu1.id)))
|
||||||
|
LEFT JOIN party_party brk ON ((sc.broker = brk.id)))
|
||||||
|
LEFT JOIN account_invoice_payment_term pt ON ((sc.payment_term = pt.id)))
|
||||||
|
LEFT JOIN purchase_crop crp ON ((sc.crop = crp.id)))
|
||||||
|
LEFT JOIN purchase_certification cer ON ((sc.certif = cer.id)))
|
||||||
|
LEFT JOIN purchase_association ass ON ((sc.association = ass.id)))
|
||||||
|
LEFT JOIN purchase_weight_basis wbs ON ((sc.wb = wbs.id)))
|
||||||
|
LEFT JOIN stock_location src ON ((sc.from_location = src.id)))
|
||||||
|
LEFT JOIN stock_location dst ON ((sc.to_location = dst.id)))
|
||||||
|
LEFT JOIN incoterm_incoterm inc ON ((sc.incoterm = inc.id)))
|
||||||
|
JOIN vw_utility_product pr ON ((sl.product = pr."intProductId")))
|
||||||
|
LEFT JOIN product_month pm ON ((sl.del_period = pm.id)))
|
||||||
|
LEFT JOIN vw_utility_last_counterparty_address ad ON ((pty.id = ad."intPartyId")))
|
||||||
|
LEFT JOIN vw_utility_strategy_dimension strategy ON (((sl.id = strategy."intTradeLineId") AND (strategy."strTradeCategory" = 'Physical'::text) AND (strategy."strTradeType" = 'Sale'::text))))
|
||||||
|
LEFT JOIN vw_utility_book_dimension book ON (((sl.id = book."intTradeLineId") AND (book."strTradeCategory" = 'Physical'::text) AND (book."strTradeType" = 'Sale'::text))))
|
||||||
|
LEFT JOIN pricing_estimated bl ON (((sl.id = bl.sale_line) AND ((bl.trigger)::text = 'bldate'::text))))
|
||||||
|
WHERE ((1 = 1) AND ((sl.type)::text = 'line'::text));;
|
||||||
12
Database Backups/SQL Views/vw_utility_dropshipped_lots.sql
Normal file
12
Database Backups/SQL Views/vw_utility_dropshipped_lots.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_dropshipped_lots AS
|
||||||
|
SELECT fm."intCompanyId",
|
||||||
|
fm."intPurchaseLineId",
|
||||||
|
fm."intShipmentId",
|
||||||
|
fm."intLotId",
|
||||||
|
fm."dblQuantity",
|
||||||
|
fm."strUnit",
|
||||||
|
fm."dblQuantityKg"
|
||||||
|
FROM ((vw_utility_stock_movements fm
|
||||||
|
JOIN vw_utility_shipment_in ds ON ((fm."intShipmentId" = ds."intShipmentId")))
|
||||||
|
JOIN vw_utility_location dl ON ((fm."intToLocationId" = dl."intLocationId")))
|
||||||
|
WHERE ((1 = 1) AND (fm."intLotId" > 0) AND ((ds."strToLocationType")::text <> 'storage'::text) AND ((dl."strLocationType")::text <> 'storage'::text) AND ((fm."strState")::text = 'done'::text));;
|
||||||
21
Database Backups/SQL Views/vw_utility_instructed_lots.sql
Normal file
21
Database Backups/SQL Views/vw_utility_instructed_lots.sql
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_instructed_lots AS
|
||||||
|
WITH stock_move AS (
|
||||||
|
SELECT DISTINCT mvt_1."intLotId",
|
||||||
|
mvt_1."intShipmentId",
|
||||||
|
mvt_1."dblQuantity",
|
||||||
|
mvt_1."strUnit",
|
||||||
|
mvt_1."dblQuantityKg"
|
||||||
|
FROM vw_utility_stock_movements mvt_1
|
||||||
|
WHERE ((1 = 1) AND (mvt_1."strMovementType" = ANY (ARRAY['Inbound'::text, 'Dropship'::text])))
|
||||||
|
)
|
||||||
|
SELECT mvt."intLotId",
|
||||||
|
mvt."intShipmentId",
|
||||||
|
lot."intPurchaseLineId",
|
||||||
|
mvt."dblQuantity",
|
||||||
|
mvt."strUnit",
|
||||||
|
mvt."dblQuantityKg",
|
||||||
|
lot."intSaleLineId"
|
||||||
|
FROM ((stock_move mvt
|
||||||
|
JOIN vw_utility_shipment_in spt ON ((mvt."intShipmentId" = spt."intShipmentId")))
|
||||||
|
JOIN vw_utility_lot lot ON ((mvt."intLotId" = lot."intLotId")))
|
||||||
|
WHERE ((1 = 1) AND ((spt."strState")::text = 'draft'::text));;
|
||||||
19
Database Backups/SQL Views/vw_utility_intransit_lots.sql
Normal file
19
Database Backups/SQL Views/vw_utility_intransit_lots.sql
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_intransit_lots AS
|
||||||
|
SELECT fm."intCompanyId",
|
||||||
|
fm."intPurchaseLineId",
|
||||||
|
fm."intShipmentId",
|
||||||
|
fm."intLotId",
|
||||||
|
fm."dblQuantity",
|
||||||
|
fm."strUnit",
|
||||||
|
fm."dblQuantityKg"
|
||||||
|
FROM ((vw_utility_stock_movements fm
|
||||||
|
JOIN vw_utility_shipment_in ds ON ((fm."intShipmentId" = ds."intShipmentId")))
|
||||||
|
JOIN vw_utility_location dl ON ((fm."intToLocationId" = dl."intLocationId")))
|
||||||
|
WHERE ((1 = 1) AND (fm."intLotId" > 0) AND ((ds."strToLocationType")::text = 'storage'::text) AND ((dl."strLocationType")::text = 'storage'::text) AND ((dl."strLocationName")::text = 'Transit'::text) AND ((fm."strState")::text = 'done'::text) AND (NOT (EXISTS ( SELECT fm2."intPurchaseLineId",
|
||||||
|
fm2."intShipmentId",
|
||||||
|
fm2."intLotId",
|
||||||
|
fm2."dblQuantity"
|
||||||
|
FROM ((vw_utility_stock_movements fm2
|
||||||
|
JOIN vw_utility_shipment_in ds2 ON ((fm2."intShipmentId" = ds2."intShipmentId")))
|
||||||
|
JOIN vw_utility_location dl2 ON ((fm2."intFromLocationId" = dl2."intLocationId")))
|
||||||
|
WHERE ((1 = 1) AND (fm2."intLotId" > 0) AND ((ds2."strToLocationType")::text = 'storage'::text) AND ((dl2."strLocationType")::text = 'storage'::text) AND ((dl2."strLocationName")::text = 'Transit'::text) AND ((fm2."strState")::text = 'done'::text) AND (fm2."intLotId" = fm."intLotId") AND (fm2."intPurchaseLineId" = fm."intPurchaseLineId") AND (fm2."intShipmentId" = fm."intShipmentId"))))));;
|
||||||
20
Database Backups/SQL Views/vw_utility_invoice_lines.sql
Normal file
20
Database Backups/SQL Views/vw_utility_invoice_lines.sql
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_invoice_lines AS
|
||||||
|
SELECT ail.invoice AS "intInvoiceId",
|
||||||
|
ail.id AS "intInvoiceLineId",
|
||||||
|
ail.lot AS "intLotId",
|
||||||
|
CASE
|
||||||
|
WHEN (COALESCE(split_part((ail.origin)::text, ','::text, 1), ''::text) = 'purchase.line'::text) THEN 'Purchase'::text
|
||||||
|
WHEN (COALESCE(split_part((ail.origin)::text, ','::text, 1), ''::text) = 'sale.line'::text) THEN 'Sale'::text
|
||||||
|
ELSE ''::text
|
||||||
|
END AS "strContractType",
|
||||||
|
COALESCE((split_part((ail.origin)::text, ','::text, 2))::integer, 0) AS "intContractLineId",
|
||||||
|
ail.quantity AS "dblQuantity",
|
||||||
|
pu.name AS "strQuantityUom",
|
||||||
|
cc.name AS "strCurrencyCode",
|
||||||
|
ail.unit_price AS "dblUnitPrice",
|
||||||
|
round(((ail.quantity * (ail.unit_price)::double precision))::numeric, get_rounding_position(cc.rounding)) AS "dblLineTotal"
|
||||||
|
FROM (((account_invoice_line ail
|
||||||
|
JOIN account_invoice ai ON ((ail.invoice = ai.id)))
|
||||||
|
JOIN currency_currency cc ON ((ai.currency = cc.id)))
|
||||||
|
JOIN product_uom pu ON ((ail.unit = pu.id)))
|
||||||
|
WHERE (1 = 1);;
|
||||||
57
Database Backups/SQL Views/vw_utility_invoices.sql
Normal file
57
Database Backups/SQL Views/vw_utility_invoices.sql
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_invoices AS
|
||||||
|
WITH invoice_lines_agg AS (
|
||||||
|
SELECT vil."intInvoiceId",
|
||||||
|
sum(vil."dblQuantity") AS "dblTotalQuantity",
|
||||||
|
sum(vil."dblLineTotal") AS "dblTotalLineAmount",
|
||||||
|
max(vil."intContractLineId") AS "intContractLineId"
|
||||||
|
FROM vw_utility_invoice_lines vil
|
||||||
|
GROUP BY vil."intInvoiceId"
|
||||||
|
), payments_agg AS (
|
||||||
|
SELECT am."intOriginId" AS "intInvoiceId",
|
||||||
|
sum(am."dblAmount") AS "dblPaidAmountInBaseCurrency",
|
||||||
|
sum(am."dblAmountSecondCurrency") AS "dblPaidAmountInSecondCurrency",
|
||||||
|
count(*) AS "intCountPayments"
|
||||||
|
FROM vw_utility_account_move am
|
||||||
|
WHERE ((1 = 1) AND (am."intReconciliation" > 0) AND ((am."strAccountJournalCode")::text = 'CASH'::text) AND (am."strOrigin" = 'account.invoice'::text))
|
||||||
|
GROUP BY am."intOriginId"
|
||||||
|
)
|
||||||
|
SELECT ai.id AS "intInvoiceId",
|
||||||
|
ai.company AS "intCompanyId",
|
||||||
|
company_party.name AS "strCompanyName",
|
||||||
|
cur.name AS "strCompanyCurrency",
|
||||||
|
COALESCE(ai.number, ''::character varying) AS "strInvoiceNumber",
|
||||||
|
ai.invoice_date AS "dtmInvoiceDate",
|
||||||
|
invoice_party.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",
|
||||||
|
COALESCE(ai.move, 0) AS "intMoveId",
|
||||||
|
ai.account AS "intAccountId",
|
||||||
|
aa.name AS "strAccountName",
|
||||||
|
ila."dblTotalQuantity" AS "dblInvoiceQuantity",
|
||||||
|
ila."dblTotalLineAmount" AS "dblInvoiceAmount",
|
||||||
|
ila."intContractLineId",
|
||||||
|
pa."dblPaidAmountInBaseCurrency",
|
||||||
|
pa."dblPaidAmountInSecondCurrency",
|
||||||
|
CASE
|
||||||
|
WHEN ((cur.name)::text = (cc.name)::text) THEN COALESCE(pa."dblPaidAmountInBaseCurrency", (0)::numeric)
|
||||||
|
ELSE COALESCE(pa."dblPaidAmountInSecondCurrency", (0)::numeric)
|
||||||
|
END AS "dblPaidAmount",
|
||||||
|
(ila."dblTotalLineAmount" -
|
||||||
|
CASE
|
||||||
|
WHEN ((cur.name)::text = (cc.name)::text) THEN COALESCE(pa."dblPaidAmountInBaseCurrency", (0)::numeric)
|
||||||
|
ELSE COALESCE(pa."dblPaidAmountInSecondCurrency", (0)::numeric)
|
||||||
|
END) AS "dblOpenedAmount"
|
||||||
|
FROM (((((((((account_invoice ai
|
||||||
|
JOIN invoice_lines_agg ila ON ((ila."intInvoiceId" = ai.id)))
|
||||||
|
JOIN currency_currency cc ON ((cc.id = ai.currency)))
|
||||||
|
JOIN party_party invoice_party ON ((invoice_party.id = ai.party)))
|
||||||
|
JOIN company_company comp ON ((comp.id = ai.company)))
|
||||||
|
JOIN currency_currency cur ON ((comp.currency = cur.id)))
|
||||||
|
JOIN party_party company_party ON ((company_party.id = comp.party)))
|
||||||
|
JOIN account_invoice_payment_term aipt ON ((aipt.id = ai.payment_term)))
|
||||||
|
LEFT JOIN account_account aa ON ((aa.id = ai.account)))
|
||||||
|
LEFT JOIN payments_agg pa ON ((pa."intInvoiceId" = ai.id)));;
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_last_counterparty_address AS
|
||||||
|
WITH lastaddresses AS (
|
||||||
|
SELECT pa_1.id,
|
||||||
|
row_number() OVER (PARTITION BY pa_1.party ORDER BY pa_1.create_date DESC) AS rn
|
||||||
|
FROM party_address pa_1
|
||||||
|
WHERE (pa_1.active = true)
|
||||||
|
)
|
||||||
|
SELECT pa.id AS "intPartyAddressId",
|
||||||
|
pa.party AS "intPartyId",
|
||||||
|
COALESCE(TRIM(BOTH FROM pa.street), ''::text) AS "strStreet",
|
||||||
|
COALESCE(pa.postal_code, ''::character varying) AS "strPostalCode",
|
||||||
|
pa.city AS "strCity",
|
||||||
|
c.name AS "strCountry",
|
||||||
|
COALESCE(cr.name, 'Undefined'::character varying) AS "strRegion"
|
||||||
|
FROM (((party_address pa
|
||||||
|
JOIN lastaddresses la ON ((pa.id = la.id)))
|
||||||
|
JOIN country_country c ON ((pa.country = c.id)))
|
||||||
|
LEFT JOIN country_region cr ON ((c.region = cr.id)))
|
||||||
|
WHERE (pa.active = true);;
|
||||||
11
Database Backups/SQL Views/vw_utility_location.sql
Normal file
11
Database Backups/SQL Views/vw_utility_location.sql
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_location AS
|
||||||
|
SELECT 0 AS "intLocationId",
|
||||||
|
''::character varying AS "strLocationName",
|
||||||
|
''::character varying AS "strLocationType",
|
||||||
|
true AS "ysnIsActive"
|
||||||
|
UNION ALL
|
||||||
|
SELECT sl.id AS "intLocationId",
|
||||||
|
sl.name AS "strLocationName",
|
||||||
|
sl.type AS "strLocationType",
|
||||||
|
sl.active AS "ysnIsActive"
|
||||||
|
FROM stock_location sl;;
|
||||||
34
Database Backups/SQL Views/vw_utility_lot.sql
Normal file
34
Database Backups/SQL Views/vw_utility_lot.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_lot AS
|
||||||
|
SELECT lot.id AS "intLotId",
|
||||||
|
COALESCE(lot.lot_container, ''::character varying) AS "strContainer",
|
||||||
|
COALESCE(lot.lot_name, ''::character varying) AS "strLotName",
|
||||||
|
COALESCE(lot.lot_status, ''::character varying) AS "strStatus",
|
||||||
|
COALESCE(lot.lot_type, ''::character varying) AS "strType",
|
||||||
|
COALESCE(lot.lot_av, ''::character varying) AS "strAvailability",
|
||||||
|
lot.line AS "intPurchaseLineId",
|
||||||
|
lot.sale_line AS "intSaleLineId",
|
||||||
|
lot.lot_product AS "intProductId",
|
||||||
|
lot.lot_state AS "intLotStateId",
|
||||||
|
lot.lot_unit AS "intUnitId",
|
||||||
|
lot.lot_unit_line AS "intUnitLineId",
|
||||||
|
lot.lot_qt AS "dblQuantity",
|
||||||
|
lot.invoice_line AS "intInvoiceLineId",
|
||||||
|
lot.invoice_line_prov AS "intInvoiceLineProvId",
|
||||||
|
COALESCE(lot.lot_pur_inv_state, ''::character varying) AS "strPurchaseInvoiceState",
|
||||||
|
COALESCE(lot.lot_sale_inv_state, ''::character varying) AS "strSaleInvoiceState",
|
||||||
|
lot.lot_shipment_in AS "intShipmentInId",
|
||||||
|
lot.lot_shipment_internal AS "intShipmentInternalId",
|
||||||
|
lot.lot_shipment_out AS "intShipmentOutId",
|
||||||
|
lot.sale_invoice_line AS "intSaleInvoiceLineId",
|
||||||
|
lot.sale_invoice_line_prov AS "intSaleInvoiceLineProvId",
|
||||||
|
qth.quantity AS "dblNetWeight",
|
||||||
|
qth.gross_quantity AS "dblGrossWeight",
|
||||||
|
pu.name AS "strUnitName",
|
||||||
|
pu_line.name AS "strUnitLineName",
|
||||||
|
convert_weight(qth.quantity, (pu_line.name)::text, 'Kilogram'::text) AS "dblNetWeightKg",
|
||||||
|
convert_weight(qth.gross_quantity, (pu_line.name)::text, 'Kilogram'::text) AS "dblGrossWeightKg"
|
||||||
|
FROM (((lot_lot lot
|
||||||
|
LEFT JOIN lot_qt_hist qth ON (((lot.id = qth.lot) AND (lot.lot_state = qth.quantity_type))))
|
||||||
|
LEFT JOIN product_uom pu ON ((lot.lot_unit = pu.id)))
|
||||||
|
LEFT JOIN product_uom pu_line ON ((lot.lot_unit_line = pu_line.id)))
|
||||||
|
WHERE (1 = 1);;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_lot_not_invoiced_on_purchase AS
|
||||||
|
SELECT pur.id AS "intPurchaseId",
|
||||||
|
pl.id AS "intPurchaseLineId",
|
||||||
|
l.id AS "intLotId",
|
||||||
|
si.id AS "intShipmentInId",
|
||||||
|
pur.party AS "intVendorId",
|
||||||
|
l.lot_qt AS "dblLotQuantity",
|
||||||
|
qth.quantity AS "dblNetWeight",
|
||||||
|
qth.gross_quantity AS "dblGrossWeight",
|
||||||
|
pl.quantity AS "dblLineQuantity",
|
||||||
|
pl.unit_price AS "dblLineUnitPrice",
|
||||||
|
pl.price_type AS "strLinePriceType",
|
||||||
|
pur.currency AS "intCurrencyId"
|
||||||
|
FROM ((((((lot_lot l
|
||||||
|
LEFT JOIN lot_qt_hist qth ON (((l.id = qth.lot) AND (l.lot_state = qth.quantity_type))))
|
||||||
|
JOIN stock_shipment_in si ON ((si.id = l.lot_shipment_in)))
|
||||||
|
JOIN purchase_line pl ON ((pl.id = l.line)))
|
||||||
|
JOIN purchase_purchase pur ON ((pur.id = pl.purchase)))
|
||||||
|
JOIN party_party pp ON ((pp.id = pur.party)))
|
||||||
|
JOIN currency_currency cur ON ((cur.id = pur.currency)))
|
||||||
|
WHERE ((1 = 1) AND ((l.lot_type)::text = 'physic'::text) AND ((si.state)::text = ANY ((ARRAY['received'::character varying, 'done'::character varying])::text[])) AND (l.invoice_line IS NULL));;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_lot_not_invoiced_on_sale AS
|
||||||
|
SELECT s.id AS "intSaleId",
|
||||||
|
sl.id AS "intSaleLineId",
|
||||||
|
l.id AS "intLotId",
|
||||||
|
so.id AS "intShipmentOutId",
|
||||||
|
s.party AS "intCustomerId",
|
||||||
|
l.lot_qt AS "dblLotQuantity",
|
||||||
|
qth.quantity AS "dblNetWeight",
|
||||||
|
qth.gross_quantity AS "dblGrossWeight",
|
||||||
|
sl.quantity AS "dblLineQuantity",
|
||||||
|
sl.unit_price AS "dblLineUnitPrice",
|
||||||
|
sl.price_type AS "strLinePriceType",
|
||||||
|
s.currency AS "intCurrencyId"
|
||||||
|
FROM ((((((lot_lot l
|
||||||
|
LEFT JOIN lot_qt_hist qth ON (((l.id = qth.lot) AND (l.lot_state = qth.quantity_type))))
|
||||||
|
JOIN stock_shipment_out so ON ((so.id = l.lot_shipment_out)))
|
||||||
|
JOIN sale_line sl ON ((sl.id = l.sale_line)))
|
||||||
|
JOIN sale_sale s ON ((s.id = sl.sale)))
|
||||||
|
JOIN party_party pp ON ((pp.id = s.party)))
|
||||||
|
JOIN currency_currency cur ON ((cur.id = s.currency)))
|
||||||
|
WHERE ((1 = 1) AND ((so.state)::text = 'done'::text) AND (l.sale_invoice_line IS NULL));;
|
||||||
12
Database Backups/SQL Views/vw_utility_matched_lots.sql
Normal file
12
Database Backups/SQL Views/vw_utility_matched_lots.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_matched_lots AS
|
||||||
|
SELECT matching.lot_p AS "intPurchaseLotId",
|
||||||
|
matching.lot_s AS "intSaleLotId",
|
||||||
|
COALESCE(matching.lot_shipment_in, 0) AS "intLotShipmentIn",
|
||||||
|
matching.lot_quantity AS "dblQuantity",
|
||||||
|
uom.name AS "strUnit",
|
||||||
|
matching.lot_av AS "strAvailability",
|
||||||
|
matching.lot_status AS "strStatus"
|
||||||
|
FROM ((lot_qt matching
|
||||||
|
LEFT JOIN vw_utility_shipment_in shipment ON ((matching.lot_shipment_in = shipment."intShipmentId")))
|
||||||
|
LEFT JOIN product_uom uom ON ((matching.lot_unit = uom.id)))
|
||||||
|
WHERE ((1 = 1) AND (COALESCE(matching.lot_p, 0) > 0) AND (COALESCE(matching.lot_s, 0) > 0));;
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_monthly_trade_ifrs_adjustments AS
|
||||||
|
SELECT apti.id AS "intAdjustmentId",
|
||||||
|
apti.date AS "dtmAdjustmentDate",
|
||||||
|
apti.amount AS "dblAmount",
|
||||||
|
cur.name AS "strCurrency",
|
||||||
|
apti.comment AS "strComments"
|
||||||
|
FROM (account_physical_trade_ifrs apti
|
||||||
|
JOIN currency_currency cur ON ((cur.id = apti.currency)));;
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_physical_mtm_definition AS
|
||||||
|
SELECT 'Purchase'::text AS "strContractType",
|
||||||
|
pp.id AS "intContractId",
|
||||||
|
pl.id AS "intContractLineId",
|
||||||
|
pl.quantity AS "dblLineQuantity",
|
||||||
|
ms.name AS "strStrategy",
|
||||||
|
msc.name AS "strScenario",
|
||||||
|
cur.symbol AS "strStrategyCurrency",
|
||||||
|
pc_mtm.price_source_type AS "strComponentPriceSource",
|
||||||
|
pc_mtm.ratio AS "strComponentRatioPct",
|
||||||
|
ft.name AS "strComponentFixType",
|
||||||
|
pi.price_desc AS "strComponentCurve",
|
||||||
|
pc_cal.name AS "strComponentCalendar"
|
||||||
|
FROM (((((((((purchase_strategy ps
|
||||||
|
JOIN purchase_line pl ON ((pl.id = ps.line)))
|
||||||
|
JOIN purchase_purchase pp ON ((pp.id = pl.purchase)))
|
||||||
|
JOIN mtm_strategy ms ON ((ms.id = ps.strategy)))
|
||||||
|
JOIN mtm_scenario msc ON ((msc.id = ms.scenario)))
|
||||||
|
JOIN currency_currency cur ON ((cur.id = ms.currency)))
|
||||||
|
LEFT JOIN pricing_component pc_mtm ON ((pc_mtm.strategy = ms.id)))
|
||||||
|
LEFT JOIN price_fixtype ft ON ((ft.id = pc_mtm.fix_type)))
|
||||||
|
LEFT JOIN price_price pi ON ((pi.id = pc_mtm.price_index)))
|
||||||
|
LEFT JOIN price_calendar pc_cal ON ((pc_cal.id = pc_mtm.calendar)))
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'Sale'::text AS "strContractType",
|
||||||
|
ss.id AS "intContractId",
|
||||||
|
sl.id AS "intContractLineId",
|
||||||
|
sl.quantity AS "dblLineQuantity",
|
||||||
|
ms.name AS "strStrategy",
|
||||||
|
msc.name AS "strScenario",
|
||||||
|
cur.symbol AS "strStrategyCurrency",
|
||||||
|
pc_mtm.price_source_type AS "strComponentPriceSource",
|
||||||
|
pc_mtm.ratio AS "strComponentRatioPct",
|
||||||
|
ft.name AS "strComponentFixType",
|
||||||
|
pi.price_desc AS "strComponentCurve",
|
||||||
|
pc_cal.name AS "strComponentCalendar"
|
||||||
|
FROM (((((((((sale_strategy sa
|
||||||
|
JOIN sale_line sl ON ((sl.id = sa.sale_line)))
|
||||||
|
JOIN sale_sale ss ON ((ss.id = sl.sale)))
|
||||||
|
JOIN mtm_strategy ms ON ((ms.id = sa.strategy)))
|
||||||
|
JOIN mtm_scenario msc ON ((msc.id = ms.scenario)))
|
||||||
|
JOIN currency_currency cur ON ((cur.id = ms.currency)))
|
||||||
|
LEFT JOIN pricing_component pc_mtm ON ((pc_mtm.strategy = ms.id)))
|
||||||
|
LEFT JOIN price_fixtype ft ON ((ft.id = pc_mtm.fix_type)))
|
||||||
|
LEFT JOIN price_price pi ON ((pi.id = pc_mtm.price_index)))
|
||||||
|
LEFT JOIN price_calendar pc_cal ON ((pc_cal.id = pc_mtm.calendar)));;
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_physical_valuation_line AS
|
||||||
|
SELECT 'Purchase'::text AS "strContractType",
|
||||||
|
vvl.date AS "dtmValuationDate",
|
||||||
|
vvl.reference AS "strReference",
|
||||||
|
vvl.purchase AS "intContractId",
|
||||||
|
vvl.line AS "intContractLineId",
|
||||||
|
vvl.lot AS "intLotId",
|
||||||
|
vvl.quantity AS "dblQuantity",
|
||||||
|
initcap((vvl.state)::text) AS "strState",
|
||||||
|
vvl.price AS "dblPrice",
|
||||||
|
COALESCE(vvl.mtm_price, (0)::numeric) AS "dblMtmPrice",
|
||||||
|
vvl.amount AS "dblAmount",
|
||||||
|
vvl.base_amount AS "dblBaseAmount"
|
||||||
|
FROM valuation_valuation_line vvl
|
||||||
|
WHERE ((1 = 1) AND ((vvl.type)::text = 'pur. priced'::text) AND (COALESCE(vvl.lot, 0) > 0) AND (COALESCE(vvl.purchase, 0) > 0) AND (COALESCE(vvl.line, 0) > 0))
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'Sale'::text AS "strContractType",
|
||||||
|
vvl.date AS "dtmValuationDate",
|
||||||
|
vvl.reference AS "strReference",
|
||||||
|
vvl.sale AS "intContractId",
|
||||||
|
vvl.sale_line AS "intContractLineId",
|
||||||
|
vvl.lot AS "intLotId",
|
||||||
|
vvl.quantity AS "dblQuantity",
|
||||||
|
initcap((vvl.state)::text) AS "strState",
|
||||||
|
vvl.price AS "dblPrice",
|
||||||
|
COALESCE(vvl.mtm_price, (0)::numeric) AS "dblMtmPrice",
|
||||||
|
vvl.amount AS "dblAmount",
|
||||||
|
vvl.base_amount AS "dblBaseAmount"
|
||||||
|
FROM valuation_valuation_line vvl
|
||||||
|
WHERE ((1 = 1) AND ((vvl.type)::text = 'sale priced'::text) AND (COALESCE(vvl.lot, 0) > 0) AND (COALESCE(vvl.sale, 0) > 0) AND (COALESCE(vvl.sale_line, 0) > 0));;
|
||||||
21
Database Backups/SQL Views/vw_utility_price_curve.sql
Normal file
21
Database Backups/SQL Views/vw_utility_price_curve.sql
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_price_curve AS
|
||||||
|
SELECT pp.id AS "intPriceCurveId",
|
||||||
|
pp.price_desc AS "strPriceDescription",
|
||||||
|
pp.price_index AS "strPriceIndex",
|
||||||
|
cc.name AS "strCurrency",
|
||||||
|
pu.name AS "strUnit",
|
||||||
|
pp.price_curve_type AS "strPriceCurveType",
|
||||||
|
COALESCE(pa.name, ''::character varying) AS "strPriceArea",
|
||||||
|
COALESCE(pc.name, ''::character varying) AS "strPriceCalendar",
|
||||||
|
COALESCE(pft.name, ''::character varying) AS "strPricingType",
|
||||||
|
pm.beg_date AS "dtmPricingStartDate",
|
||||||
|
pm.end_date AS "dtmPricingEndDate",
|
||||||
|
pm.month_name AS "strPricingMonth"
|
||||||
|
FROM ((((((price_price pp
|
||||||
|
JOIN currency_currency cc ON ((pp.price_currency = cc.id)))
|
||||||
|
LEFT JOIN price_area pa ON ((pp.price_area = pa.id)))
|
||||||
|
LEFT JOIN price_calendar pc ON ((pp.price_calendar = pc.id)))
|
||||||
|
LEFT JOIN product_uom pu ON ((pp.price_unit = pu.id)))
|
||||||
|
LEFT JOIN product_month pm ON ((pp.price_period = pm.id)))
|
||||||
|
LEFT JOIN price_fixtype pft ON ((pp.price_type = pft.id)))
|
||||||
|
WHERE ((1 = 1) AND (pp.active = true));;
|
||||||
10
Database Backups/SQL Views/vw_utility_price_curve_prices.sql
Normal file
10
Database Backups/SQL Views/vw_utility_price_curve_prices.sql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_price_curve_prices AS
|
||||||
|
SELECT pp.id AS "intPriceCurveId",
|
||||||
|
ppv.price_date AS "dtmPriceDate",
|
||||||
|
(ppv.high_price)::numeric(18,6) AS "dblHighPrice",
|
||||||
|
(ppv.low_price)::numeric(18,6) AS "dblLowPrice",
|
||||||
|
(ppv.open_price)::numeric(18,6) AS "dblOpenPrice",
|
||||||
|
(ppv.price_value)::numeric(18,6) AS "dblPriceValue"
|
||||||
|
FROM (price_price pp
|
||||||
|
LEFT JOIN price_price_value ppv ON (((pp.id = ppv.price) AND (ppv.active = true))))
|
||||||
|
WHERE ((1 = 1) AND (pp.active = true));;
|
||||||
54
Database Backups/SQL Views/vw_utility_product.sql
Normal file
54
Database Backups/SQL Views/vw_utility_product.sql
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_product AS
|
||||||
|
SELECT 0 AS "intProductId",
|
||||||
|
''::character varying AS "strProductCode",
|
||||||
|
''::text AS "strProductDescription",
|
||||||
|
true AS "ysnActive",
|
||||||
|
''::character varying AS "strTemplate",
|
||||||
|
''::character varying AS "strTemplateCode",
|
||||||
|
''::character varying AS "strDefaultUom",
|
||||||
|
0 AS "dblDefaultUomFactor",
|
||||||
|
0 AS "dblDefaultUomRate",
|
||||||
|
0 AS "dblDefaultUomRounding",
|
||||||
|
''::character varying(10) AS "strDefaultUomSymbol",
|
||||||
|
true AS "ysnAvailableOnPurchase",
|
||||||
|
''::character varying AS "strPurchaseUom",
|
||||||
|
0 AS "dblPurchaseUomFactor",
|
||||||
|
0 AS "dblPurchaseUomRate",
|
||||||
|
0 AS "dblPurchaseUomRounding",
|
||||||
|
''::character varying(10) AS "strPurchaseUomSymbol",
|
||||||
|
true AS "ysnAvailableOnSale",
|
||||||
|
''::character varying AS "strSaleUom",
|
||||||
|
0 AS "dblSaleUomFactor",
|
||||||
|
0 AS "dblSaleUomRate",
|
||||||
|
0 AS "dblSaleUomRounding",
|
||||||
|
''::character varying(10) AS "strSaleUomSymbol"
|
||||||
|
UNION ALL
|
||||||
|
SELECT p.id AS "intProductId",
|
||||||
|
p.code AS "strProductCode",
|
||||||
|
COALESCE(p.description, ''::text) AS "strProductDescription",
|
||||||
|
p.active AS "ysnActive",
|
||||||
|
pt.name AS "strTemplate",
|
||||||
|
pt.type AS "strTemplateCode",
|
||||||
|
pu1.name AS "strDefaultUom",
|
||||||
|
pu1.factor AS "dblDefaultUomFactor",
|
||||||
|
pu1.rate AS "dblDefaultUomRate",
|
||||||
|
pu1.rounding AS "dblDefaultUomRounding",
|
||||||
|
pu1.symbol AS "strDefaultUomSymbol",
|
||||||
|
pt.purchasable AS "ysnAvailableOnPurchase",
|
||||||
|
pu2.name AS "strPurchaseUom",
|
||||||
|
pu2.factor AS "dblPurchaseUomFactor",
|
||||||
|
pu2.rate AS "dblPurchaseUomRate",
|
||||||
|
pu2.rounding AS "dblPurchaseUomRounding",
|
||||||
|
pu2.symbol AS "strPurchaseUomSymbol",
|
||||||
|
pt.salable AS "ysnAvailableOnSale",
|
||||||
|
pu3.name AS "strSaleUom",
|
||||||
|
pu3.factor AS "dblSaleUomFactor",
|
||||||
|
pu3.rate AS "dblSaleUomRate",
|
||||||
|
pu3.rounding AS "dblSaleUomRounding",
|
||||||
|
pu3.symbol AS "strSaleUomSymbol"
|
||||||
|
FROM ((((product_product p
|
||||||
|
JOIN product_template pt ON ((p.template = pt.id)))
|
||||||
|
JOIN product_uom pu1 ON ((pt.default_uom = pu1.id)))
|
||||||
|
JOIN product_uom pu2 ON ((pt.purchase_uom = pu2.id)))
|
||||||
|
JOIN product_uom pu3 ON ((pt.sale_uom = pu3.id)))
|
||||||
|
WHERE (1 = 1);;
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_purchase_physical_contract AS
|
||||||
|
SELECT pl.id AS "intPurchaseLineId",
|
||||||
|
pl.from_del AS "dtmDeliveryDateFrom",
|
||||||
|
pl.to_del AS "dtmDeliveryDateTo",
|
||||||
|
pl.quantity AS "dblQuantity",
|
||||||
|
pu1.name AS "strPurchaseUom",
|
||||||
|
COALESCE(vult.dblintransitquantity, (0)::double precision) AS "dblInTransitQuantity",
|
||||||
|
COALESCE(dropship.dbldropshippedquantity, (0)::double precision) AS "dblDropshippedQuantity",
|
||||||
|
COALESCE(received.dblreceivedquantity, (0)::double precision) AS "dblReceivedQuantity",
|
||||||
|
COALESCE(pl.linked_price, (0)::numeric) AS "dblPrice",
|
||||||
|
pu2.name AS "strPriceUnit",
|
||||||
|
'n/a'::text AS "strPriceCurrency",
|
||||||
|
pl.unit_price AS "dblUnitPrice",
|
||||||
|
COALESCE(pl.quantity_theorical, (0)::numeric) AS "dblTheoriticalQuantity",
|
||||||
|
round(((pl.quantity * (pl.unit_price)::double precision))::numeric, get_rounding_position(mcr.rounding)) AS "dblLineAmount",
|
||||||
|
cur.name AS "strCurrency",
|
||||||
|
(0)::numeric AS "dblLineBaseAmount",
|
||||||
|
''::text AS "strBaseCurrency",
|
||||||
|
(0)::numeric AS "dblQuantityInBaseUnit",
|
||||||
|
''::text AS "strBaseUnit",
|
||||||
|
(0)::numeric AS "dblFixedPrice",
|
||||||
|
(0)::numeric AS "dblFixedQuantity",
|
||||||
|
(0)::numeric AS "dblFixedAmount",
|
||||||
|
(0)::numeric AS "dblUnFixedPrice",
|
||||||
|
(0)::numeric AS "dblUnfixedQuantity",
|
||||||
|
(0)::numeric AS "dblUnfixedAmount",
|
||||||
|
(0)::numeric AS "dblInvoicedQuantity",
|
||||||
|
(0)::numeric AS "dblInvoicedAmount",
|
||||||
|
''::text AS "strInvoiceCurrency",
|
||||||
|
COALESCE(phys.dblphysicalqty, (0)::double precision) AS "dblPhysicalQty",
|
||||||
|
(COALESCE((pl.quantity_theorical)::double precision, (0)::double precision) - COALESCE(phys.dblphysicalqty, (0)::double precision)) AS "dblOpenQuantity",
|
||||||
|
COALESCE(inst.dblinstructedqty, (0)::double precision) AS "dblInInstructedQuantity",
|
||||||
|
COALESCE(bl.estimated_date, pl.to_del) AS "dtmEstimatedBLDate",
|
||||||
|
pl.finished AS "ysnFinished"
|
||||||
|
FROM (((((((((((purchase_line pl
|
||||||
|
JOIN purchase_purchase pc ON ((pl.purchase = pc.id)))
|
||||||
|
JOIN product_uom pu1 ON ((pl.unit = pu1.id)))
|
||||||
|
LEFT JOIN product_uom pu2 ON ((pl.linked_unit = pu2.id)))
|
||||||
|
LEFT JOIN currency_linked cur ON ((pl.linked_currency = cur.id)))
|
||||||
|
LEFT JOIN currency_currency mcr ON ((cur.currency = mcr.id)))
|
||||||
|
LEFT JOIN ( SELECT transit."intPurchaseLineId",
|
||||||
|
sum(transit."dblQuantity") AS dblintransitquantity
|
||||||
|
FROM vw_utility_intransit_lots transit
|
||||||
|
GROUP BY transit."intPurchaseLineId") vult ON ((pl.id = vult."intPurchaseLineId")))
|
||||||
|
LEFT JOIN ( SELECT t1."intPurchaseLineId",
|
||||||
|
sum(t1."dblQuantity") AS dbldropshippedquantity
|
||||||
|
FROM vw_utility_dropshipped_lots t1
|
||||||
|
GROUP BY t1."intPurchaseLineId") dropship ON ((pl.id = dropship."intPurchaseLineId")))
|
||||||
|
LEFT JOIN ( SELECT t1."intPurchaseLineId",
|
||||||
|
sum(t1."dblQuantity") AS dblreceivedquantity
|
||||||
|
FROM vw_utility_received_lots t1
|
||||||
|
GROUP BY t1."intPurchaseLineId") received ON ((pl.id = received."intPurchaseLineId")))
|
||||||
|
LEFT JOIN ( SELECT t1."intPurchaseLineId",
|
||||||
|
sum(t1."dblQuantity") AS dblphysicalqty
|
||||||
|
FROM vw_utility_lot t1
|
||||||
|
WHERE ((t1."strType")::text = 'physic'::text)
|
||||||
|
GROUP BY t1."intPurchaseLineId") phys ON ((pl.id = phys."intPurchaseLineId")))
|
||||||
|
LEFT JOIN ( SELECT t1."intPurchaseLineId",
|
||||||
|
sum(t1."dblQuantity") AS dblinstructedqty
|
||||||
|
FROM vw_utility_instructed_lots t1
|
||||||
|
GROUP BY t1."intPurchaseLineId") inst ON ((pl.id = inst."intPurchaseLineId")))
|
||||||
|
LEFT JOIN pricing_estimated bl ON (((pl.id = bl.line) AND ((bl.trigger)::text = 'bldate'::text))))
|
||||||
|
WHERE (1 = 1);;
|
||||||
19
Database Backups/SQL Views/vw_utility_received_lots.sql
Normal file
19
Database Backups/SQL Views/vw_utility_received_lots.sql
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_received_lots AS
|
||||||
|
SELECT fm."intCompanyId",
|
||||||
|
fm."intPurchaseLineId",
|
||||||
|
fm."intShipmentId",
|
||||||
|
fm."intLotId",
|
||||||
|
fm."dblQuantity",
|
||||||
|
fm."strUnit",
|
||||||
|
fm."dblQuantityKg"
|
||||||
|
FROM ((vw_utility_stock_movements fm
|
||||||
|
JOIN vw_utility_shipment_in ds ON ((fm."intShipmentId" = ds."intShipmentId")))
|
||||||
|
JOIN vw_utility_location dl ON ((fm."intToLocationId" = dl."intLocationId")))
|
||||||
|
WHERE ((1 = 1) AND (fm."intLotId" > 0) AND ((ds."strToLocationType")::text = 'storage'::text) AND ((dl."strLocationType")::text = 'storage'::text) AND ((dl."strLocationName")::text = 'Transit'::text) AND ((fm."strState")::text = 'done'::text) AND (EXISTS ( SELECT fm2."intPurchaseLineId",
|
||||||
|
fm2."intShipmentId",
|
||||||
|
fm2."intLotId",
|
||||||
|
fm2."dblQuantity"
|
||||||
|
FROM ((vw_utility_stock_movements fm2
|
||||||
|
JOIN vw_utility_shipment_in ds2 ON ((fm2."intShipmentId" = ds2."intShipmentId")))
|
||||||
|
JOIN vw_utility_location dl2 ON ((fm2."intFromLocationId" = dl2."intLocationId")))
|
||||||
|
WHERE ((1 = 1) AND (fm2."intLotId" > 0) AND ((ds2."strToLocationType")::text = 'storage'::text) AND ((dl2."strLocationType")::text = 'storage'::text) AND ((dl2."strLocationName")::text = 'Transit'::text) AND ((fm2."strState")::text = 'done'::text) AND (fm2."intLotId" = fm."intLotId") AND (fm2."intPurchaseLineId" = fm."intPurchaseLineId") AND (fm2."intShipmentId" = fm."intShipmentId")))));;
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_sale_physical_contract AS
|
||||||
|
SELECT sl.id AS "intSaleLineId",
|
||||||
|
sl.from_del AS "dtmDeliveryDateFrom",
|
||||||
|
sl.to_del AS "dtmDeliveryDateTo",
|
||||||
|
sl.quantity AS "dblQuantity",
|
||||||
|
pu1.name AS "strSaleUom",
|
||||||
|
0 AS "dblDeliveredQuantity",
|
||||||
|
COALESCE(sl.linked_price, (0)::numeric) AS "dblPrice",
|
||||||
|
pu2.name AS "strPriceUnit",
|
||||||
|
'n/a'::text AS "strPriceCurrency",
|
||||||
|
sl.unit_price AS "dblUnitPrice",
|
||||||
|
COALESCE(sl.quantity_theorical, (0)::numeric) AS "dblTheoreticalQuantity",
|
||||||
|
round(((sl.quantity * (sl.unit_price)::double precision))::numeric, get_rounding_position((2)::numeric)) AS "dblLineAmount",
|
||||||
|
'n/a'::text AS "strCurrency",
|
||||||
|
(0)::numeric AS "dblLineBaseAmount",
|
||||||
|
''::text AS "strBaseCurrency",
|
||||||
|
(0)::numeric AS "dblQuantityInBaseUnit",
|
||||||
|
''::text AS "strBaseUnit",
|
||||||
|
(0)::numeric AS "dblFixedPrice",
|
||||||
|
(0)::numeric AS "dblFixedQuantity",
|
||||||
|
(0)::numeric AS "dblFixedAmount",
|
||||||
|
(0)::numeric AS "dblUnFixedPrice",
|
||||||
|
(0)::numeric AS "dblUnfixedQuantity",
|
||||||
|
(0)::numeric AS "dblUnfixedAmount",
|
||||||
|
(0)::numeric AS "dblInvoicedQuantity",
|
||||||
|
(0)::numeric AS "dblInvoicedAmount",
|
||||||
|
''::text AS "strInvoiceCurrency",
|
||||||
|
convert_weight(sl.quantity_theorical, (pu1.name)::text, 'Kilogram'::text) AS "dblTheoreticalWeightKg",
|
||||||
|
COALESCE((shipped."dblNetWeightKg")::double precision, (0)::double precision) AS "dblPhysicalWeightKg",
|
||||||
|
((convert_weight(sl.quantity_theorical, (pu1.name)::text, 'Kilogram'::text))::double precision - COALESCE((shipped."dblNetWeightKg")::double precision, (0)::double precision)) AS "dblOpenWeightKg",
|
||||||
|
COALESCE(bl.estimated_date, sl.from_del) AS "dtmEstimatedBLDate",
|
||||||
|
COALESCE(instructed.dblinstructedqty, ((0)::numeric)::double precision) AS "dblInstructedQuantity",
|
||||||
|
sl.finished AS "ysnFinished"
|
||||||
|
FROM ((((((sale_line sl
|
||||||
|
JOIN sale_sale sc ON ((sl.sale = sc.id)))
|
||||||
|
JOIN product_uom pu1 ON ((sl.unit = pu1.id)))
|
||||||
|
LEFT JOIN product_uom pu2 ON ((sl.linked_unit = pu2.id)))
|
||||||
|
LEFT JOIN ( SELECT lot."intSaleLineId",
|
||||||
|
sum(lot."dblNetWeightKg") AS "dblNetWeightKg"
|
||||||
|
FROM vw_utility_lot lot
|
||||||
|
WHERE (((lot."strType")::text = 'physic'::text) AND (lot."intSaleLineId" IS NOT NULL) AND (lot."intSaleLineId" > 0))
|
||||||
|
GROUP BY lot."intSaleLineId") shipped ON ((sl.id = shipped."intSaleLineId")))
|
||||||
|
LEFT JOIN pricing_estimated bl ON ((sl.id = bl.sale_line)))
|
||||||
|
LEFT JOIN ( SELECT t1."intSaleLineId",
|
||||||
|
sum(t1."dblQuantity") AS dblinstructedqty
|
||||||
|
FROM vw_utility_instructed_lots t1
|
||||||
|
WHERE (COALESCE(t1."intSaleLineId", 0) > 0)
|
||||||
|
GROUP BY t1."intSaleLineId") instructed ON ((sl.id = instructed."intSaleLineId")))
|
||||||
|
WHERE (1 = 1);;
|
||||||
28
Database Backups/SQL Views/vw_utility_shipment_fees.sql
Normal file
28
Database Backups/SQL Views/vw_utility_shipment_fees.sql
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
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);;
|
||||||
73
Database Backups/SQL Views/vw_utility_shipment_in.sql
Normal file
73
Database Backups/SQL Views/vw_utility_shipment_in.sql
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_shipment_in AS
|
||||||
|
SELECT 0 AS "intShipmentId",
|
||||||
|
NULL::date AS "dtmEffectiveDate",
|
||||||
|
''::character varying AS "strBookingNumber",
|
||||||
|
''::character varying AS "strShipmentNb",
|
||||||
|
''::character varying AS "strShipmentReference",
|
||||||
|
''::character varying AS "strBillOfLading",
|
||||||
|
NULL::date AS "dtmBillOfLadingDate",
|
||||||
|
NULL::date AS "dtmETADestination",
|
||||||
|
NULL::date AS "dtmOriginPlannedDate",
|
||||||
|
NULL::date AS "dtmPlannedDate",
|
||||||
|
''::character varying AS "strState",
|
||||||
|
''::character varying AS "strSupplier",
|
||||||
|
''::character varying AS "strWarehouse",
|
||||||
|
''::character varying AS "strWarehouseInput",
|
||||||
|
''::character varying AS "strStorage",
|
||||||
|
''::character varying AS "strFromLocation",
|
||||||
|
''::character varying AS "strToLocation",
|
||||||
|
''::character varying AS "strToLocationType",
|
||||||
|
''::character varying AS "strTransportType",
|
||||||
|
''::character varying AS "strVessel",
|
||||||
|
''::character varying AS "strVesselIMO",
|
||||||
|
''::character varying AS "strVesselYearOfBuilt",
|
||||||
|
''::character varying AS "strCarrier",
|
||||||
|
NULL::date AS "dtmETAPol",
|
||||||
|
NULL::date AS "dtmETD",
|
||||||
|
NULL::date AS "dtmETL",
|
||||||
|
NULL::date AS "dtmUnloadingDate",
|
||||||
|
NULL::date AS "dtmBookingDate",
|
||||||
|
''::character varying AS "strReceiveNumber",
|
||||||
|
NULL::date AS "dtmReceiveDate",
|
||||||
|
''::character varying AS "strCargoMode"
|
||||||
|
UNION ALL
|
||||||
|
SELECT ssin.id AS "intShipmentId",
|
||||||
|
ssin.effective_date AS "dtmEffectiveDate",
|
||||||
|
ssin.booking AS "strBookingNumber",
|
||||||
|
ssin.number AS "strShipmentNb",
|
||||||
|
ssin.reference AS "strShipmentReference",
|
||||||
|
ssin.bl_number AS "strBillOfLading",
|
||||||
|
ssin.bl_date AS "dtmBillOfLadingDate",
|
||||||
|
ssin.etad AS "dtmETADestination",
|
||||||
|
ssin.origin_planned_date AS "dtmOriginPlannedDate",
|
||||||
|
ssin.planned_date AS "dtmPlannedDate",
|
||||||
|
ssin.state AS "strState",
|
||||||
|
sup.name AS "strSupplier",
|
||||||
|
wh.name AS "strWarehouse",
|
||||||
|
inp.name AS "strWarehouseInput",
|
||||||
|
sto.name AS "strStorage",
|
||||||
|
src.name AS "strFromLocation",
|
||||||
|
dest.name AS "strToLocation",
|
||||||
|
dest.type AS "strToLocationType",
|
||||||
|
ssin.transport_type AS "strTransportType",
|
||||||
|
COALESCE(vessel.vessel_name, 'Unknown Vessel'::character varying) AS "strVessel",
|
||||||
|
COALESCE(vessel.vessel_imo, ''::character varying) AS "strVesselIMO",
|
||||||
|
COALESCE(vessel.vessel_year, ''::character varying) AS "strVesselYearOfBuilt",
|
||||||
|
car.name AS "strCarrier",
|
||||||
|
ssin.eta AS "dtmETAPol",
|
||||||
|
ssin.etd AS "dtmETD",
|
||||||
|
ssin.etl AS "dtmETL",
|
||||||
|
ssin.unloaded AS "dtmUnloadingDate",
|
||||||
|
ssin.booking_date AS "dtmBookingDate",
|
||||||
|
ssin.receive_nb AS "strReceiveNumber",
|
||||||
|
ssin.receive_date AS "dtmReceiveDate",
|
||||||
|
ssin.cargo_mode AS "strCargoMode"
|
||||||
|
FROM ((((((((stock_shipment_in ssin
|
||||||
|
LEFT JOIN party_party sup ON ((ssin.supplier = sup.id)))
|
||||||
|
LEFT JOIN stock_location wh ON ((ssin.warehouse = wh.id)))
|
||||||
|
LEFT JOIN stock_location inp ON ((ssin.warehouse_input = inp.id)))
|
||||||
|
LEFT JOIN stock_location sto ON ((ssin.warehouse_storage = sto.id)))
|
||||||
|
LEFT JOIN stock_location src ON ((ssin.from_location = src.id)))
|
||||||
|
LEFT JOIN stock_location dest ON ((ssin.to_location = dest.id)))
|
||||||
|
LEFT JOIN trade_vessel vessel ON ((ssin.vessel = vessel.id)))
|
||||||
|
LEFT JOIN party_party car ON ((ssin.carrier_ = car.id)));;
|
||||||
42
Database Backups/SQL Views/vw_utility_stock_movements.sql
Normal file
42
Database Backups/SQL Views/vw_utility_stock_movements.sql
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_stock_movements AS
|
||||||
|
SELECT sm.id AS "intStockId",
|
||||||
|
sm.company AS "intCompanyId",
|
||||||
|
COALESCE(sm.lot, 0) AS "intLotId",
|
||||||
|
COALESCE(sm.cost_price, (0)::numeric) AS "dblCostPrice",
|
||||||
|
cur.name AS "strCurrency",
|
||||||
|
sm.effective_date AS "dtmEffectiveDate",
|
||||||
|
sm.bldate AS "dtmBLDate",
|
||||||
|
sm.product AS "intProductId",
|
||||||
|
sm.from_location AS "intFromLocationId",
|
||||||
|
sm.to_location AS "intToLocationId",
|
||||||
|
sm.origin,
|
||||||
|
split_part((sm.origin)::text, ','::text, 1) AS "strSourceType",
|
||||||
|
COALESCE((split_part((sm.shipment)::text, ','::text, 2))::integer, 0) AS "intShipmentId",
|
||||||
|
CASE
|
||||||
|
WHEN (((sl_src.type)::text = 'supplier'::text) AND ((sl_dest.type)::text = 'customer'::text)) THEN 'Dropship'::text
|
||||||
|
WHEN (split_part((sm.origin)::text, ','::text, 1) = 'purchase.line'::text) THEN 'Inbound'::text
|
||||||
|
WHEN (split_part((sm.origin)::text, ','::text, 1) = 'sale.line'::text) THEN 'Outbound'::text
|
||||||
|
ELSE 'Unknown'::text
|
||||||
|
END AS "strMovementType",
|
||||||
|
CASE
|
||||||
|
WHEN (split_part((sm.origin)::text, ','::text, 1) = 'purchase.line'::text) THEN (split_part((sm.origin)::text, ','::text, 2))::integer
|
||||||
|
ELSE 0
|
||||||
|
END AS "intPurchaseLineId",
|
||||||
|
CASE
|
||||||
|
WHEN (((sl_src.type)::text = 'supplier'::text) AND ((sl_dest.type)::text = 'customer'::text)) THEN lot.sale_line
|
||||||
|
WHEN (split_part((sm.origin)::text, ','::text, 1) = 'sale.line'::text) THEN (split_part((sm.origin)::text, ','::text, 2))::integer
|
||||||
|
ELSE 0
|
||||||
|
END AS "intSaleLineId",
|
||||||
|
sm.quantity AS "dblQuantity",
|
||||||
|
uom.name AS "strUnit",
|
||||||
|
round(((sm.quantity * uom.factor))::numeric, get_rounding_position((uom.rounding)::numeric)) AS "dblQuantityKg",
|
||||||
|
sm.unit_price,
|
||||||
|
sm.unit_price_updated AS "ysnPriceUpdated",
|
||||||
|
sm.state AS "strState",
|
||||||
|
lot.lot_status AS "strLotStatus"
|
||||||
|
FROM (((((stock_move sm
|
||||||
|
JOIN currency_currency cur ON ((sm.currency = cur.id)))
|
||||||
|
LEFT JOIN lot_lot lot ON ((sm.lot = lot.id)))
|
||||||
|
LEFT JOIN product_uom uom ON ((sm.unit = uom.id)))
|
||||||
|
LEFT JOIN stock_location sl_src ON ((sl_src.id = sm.from_location)))
|
||||||
|
LEFT JOIN stock_location sl_dest ON ((sl_dest.id = sm.to_location)));;
|
||||||
32
Database Backups/SQL Views/vw_utility_strategy_dimension.sql
Normal file
32
Database Backups/SQL Views/vw_utility_strategy_dimension.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.vw_utility_strategy_dimension AS
|
||||||
|
WITH dimensionvalue AS (
|
||||||
|
SELECT ad.id AS "dimensionId",
|
||||||
|
adv.id AS "valueId",
|
||||||
|
ad.code AS "dimensionCode",
|
||||||
|
adv.code AS "valueCode",
|
||||||
|
adv.name AS "valueName"
|
||||||
|
FROM (analytic_dimension ad
|
||||||
|
JOIN analytic_dimension_value adv ON ((ad.id = adv.dimension)))
|
||||||
|
WHERE ((1 = 1) AND ((ad.code)::text = 'strategy'::text))
|
||||||
|
)
|
||||||
|
SELECT DISTINCT aa.purchase AS "intTradeId",
|
||||||
|
pl.id AS "intTradeLineId",
|
||||||
|
'Physical'::text AS "strTradeCategory",
|
||||||
|
'Purchase'::text AS "strTradeType",
|
||||||
|
bv."valueCode" AS "strValueCode",
|
||||||
|
bv."valueName" AS "strValueName"
|
||||||
|
FROM ((analytic_dimension_assignment aa
|
||||||
|
JOIN dimensionvalue bv ON (((aa.dimension = bv."dimensionId") AND (aa.value = bv."valueId"))))
|
||||||
|
JOIN purchase_line pl ON ((aa.purchase = pl.purchase)))
|
||||||
|
WHERE (COALESCE(aa.purchase, 0) > 0)
|
||||||
|
UNION ALL
|
||||||
|
SELECT DISTINCT aa.sale AS "intTradeId",
|
||||||
|
sl.id AS "intTradeLineId",
|
||||||
|
'Physical'::text AS "strTradeCategory",
|
||||||
|
'Sale'::text AS "strTradeType",
|
||||||
|
bv."valueCode" AS "strValueCode",
|
||||||
|
bv."valueName" AS "strValueName"
|
||||||
|
FROM ((analytic_dimension_assignment aa
|
||||||
|
JOIN dimensionvalue bv ON (((aa.dimension = bv."dimensionId") AND (aa.value = bv."valueId"))))
|
||||||
|
JOIN sale_line sl ON ((sl.sale = aa.sale)))
|
||||||
|
WHERE (COALESCE(aa.sale, 0) > 0);;
|
||||||
@@ -628,7 +628,7 @@ WHERE 1=1
|
|||||||
AND D.Status <> 'Cancelled'
|
AND D.Status <> 'Cancelled'
|
||||||
AND D.BuyOrSell = 1 -- Purchase contracts
|
AND D.BuyOrSell = 1 -- Purchase contracts
|
||||||
AND ISNULL(D.OtherReference, '') NOT LIKE '%ACCT Matching%'
|
AND ISNULL(D.OtherReference, '') NOT LIKE '%ACCT Matching%'
|
||||||
AND B.Description LIKE '%2025%'
|
AND B.Description LIKE '%2026%'
|
||||||
ORDER BY 3,1
|
ORDER BY 3,1
|
||||||
|
|
||||||
|
|
||||||
@@ -831,8 +831,7 @@ WHERE 1=1
|
|||||||
AND D.Status <> 'Cancelled'
|
AND D.Status <> 'Cancelled'
|
||||||
AND D.BuyOrSell = -1 -- Sale contracts
|
AND D.BuyOrSell = -1 -- Sale contracts
|
||||||
AND ISNULL(D.OtherReference, '') NOT LIKE '%ACCT Matching%'
|
AND ISNULL(D.OtherReference, '') NOT LIKE '%ACCT Matching%'
|
||||||
AND (B.Description LIKE '%2025%' OR B.Description LIKE '%2026%')
|
AND (B.Description LIKE '%2026%')
|
||||||
--AND D.Reference = 2112
|
|
||||||
ORDER BY 3,1
|
ORDER BY 3,1
|
||||||
|
|
||||||
|
|
||||||
@@ -862,7 +861,7 @@ SELECT
|
|||||||
'Per qt' AS mode,
|
'Per qt' AS mode,
|
||||||
ROUND (
|
ROUND (
|
||||||
(IIF(PFE.Quantity IS NULL, PFE.WeightBalance / 100, 1) * PFE.OutputPriceValue),
|
(IIF(PFE.Quantity IS NULL, PFE.WeightBalance / 100, 1) * PFE.OutputPriceValue),
|
||||||
2 ) AS price,
|
3 ) AS price,
|
||||||
ER.UnitReference AS unit
|
ER.UnitReference AS unit
|
||||||
|
|
||||||
FROM dbo.Deal AS D
|
FROM dbo.Deal AS D
|
||||||
@@ -875,14 +874,42 @@ WHERE 1=1
|
|||||||
AND D.Status <> 'Cancelled'
|
AND D.Status <> 'Cancelled'
|
||||||
AND D.BuyOrSell = 1 -- Purchase contracts
|
AND D.BuyOrSell = 1 -- Purchase contracts
|
||||||
AND ISNULL(D.OtherReference, '') NOT LIKE '%ACCT Matching%'
|
AND ISNULL(D.OtherReference, '') NOT LIKE '%ACCT Matching%'
|
||||||
--AND (B.Description LIKE '%2025%')
|
AND (B.Description LIKE '%2026%')
|
||||||
AND (B.Description LIKE '%2025%' OR B.Description LIKE '%2026%')
|
|
||||||
AND ER.FormulaGroup NOT IN (1,2) -- Not Price or MtM
|
AND ER.FormulaGroup NOT IN (1,2) -- Not Price or MtM
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SELECT PC.ContractNumber
|
||||||
|
, ER.FormulaGroup AS FormulaGroup
|
||||||
|
, er.Formula
|
||||||
|
, er.FormulaGroup
|
||||||
|
, s.[Description]
|
||||||
|
, CASE
|
||||||
|
WHEN ER.FormulaGroup IN (1, 2) THEN ISNULL(S.Description, IIF(PFE.FormulaType='Adjustment', PFE.FormulaType, IIF(PFE.IsDiscount = 0, 'Fixed Price ', 'Discount ' + ISNULL(PFE.Comment, ''))) )
|
||||||
|
ELSE BD.Description
|
||||||
|
END AS CostDescription
|
||||||
|
, (IIF(PFE.Quantity IS NULL, PFE.WeightBalance / 100, 1) * PFE.OutputPriceValue) AS Price
|
||||||
|
, CASE
|
||||||
|
WHEN ER.FormulaGroup = 4 THEN -1 * CASE WHEN ER.IsRevenue = 1 THEN -1 ELSE 1 END
|
||||||
|
WHEN ER.FormulaGroup = 1 THEN -1 * CASE WHEN PFE.IsDiscount = 1 THEN -1 ELSE 1 END * PC.ContractMultiplier --Need to invert sign for the good amount vs qty
|
||||||
|
ELSE PC.ContractMultiplier
|
||||||
|
END * PC.CtrRemainingQty * (IIF(PFE.Quantity IS NULL, PFE.WeightBalance / 100, 1) * PFE.OutputPriceValue) AS OpenCostAmount
|
||||||
|
FROM [singa].VW_REP_DIM_PHYSICAL_CTR PC
|
||||||
|
INNER JOIN dbo.Deal AS D ON D.Reference = PC.ContractNumber
|
||||||
|
INNER JOIN dbo.ExpenseRevenue AS ER ON ER.DealId = D.Id
|
||||||
|
INNER JOIN dbo.ExpenseRevenueValue AS ERV ON ER.EstimatedId = ERV.Id
|
||||||
|
INNER JOIN dbo.PriceFormulaElement AS PFE ON PFE.ExpenseRevenueId = ER.Id
|
||||||
|
LEFT JOIN dbo.BaseDefinition AS BD ON ER.CostTypeId = BD.Id
|
||||||
|
LEFT JOIN price.Maturity AS M ON PFE.MaturityId = M.Id
|
||||||
|
LEFT JOIN price.Symbol AS S ON M.SymbolId = S.Id
|
||||||
|
WHERE 1=1
|
||||||
|
AND (PFE.IsManuallySet = 0 OR ER.FormulaGroup != 1 OR (S.Description IS NULL AND ER.FormulaGroup = 1)) --we want only price at contract level, so not manually set
|
||||||
|
AND ER.FormulaGroup = 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Sale contract costs
|
-- Sale contract costs
|
||||||
SELECT
|
SELECT
|
||||||
|
|
||||||
@@ -921,7 +948,7 @@ WHERE 1=1
|
|||||||
AND D.Status <> 'Cancelled'
|
AND D.Status <> 'Cancelled'
|
||||||
AND D.BuyOrSell <> 1 -- Sale contracts
|
AND D.BuyOrSell <> 1 -- Sale contracts
|
||||||
AND ISNULL(D.OtherReference, '') NOT LIKE '%ACCT Matching%'
|
AND ISNULL(D.OtherReference, '') NOT LIKE '%ACCT Matching%'
|
||||||
AND (B.Description LIKE '%2025%' OR B.Description LIKE '%2026%')
|
AND (B.Description LIKE '%2026%')
|
||||||
AND ER.FormulaGroup NOT IN (1,2) -- Not Price or MtM
|
AND ER.FormulaGroup NOT IN (1,2) -- Not Price or MtM
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
|
|
||||||
@@ -957,12 +984,6 @@ AND (B.Description LIKE '%2025%' OR B.Description LIKE '%2026%')
|
|||||||
ORDER BY 1,2
|
ORDER BY 1,2
|
||||||
|
|
||||||
|
|
||||||
SELECT DISTINCT formulaType FROM PriceFormulaElement
|
|
||||||
|
|
||||||
Trigger, RangeDate
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Run that script to generate CSV for price_curve MTM used in physical contract in 2025 and 2026
|
-- Run that script to generate CSV for price_curve MTM used in physical contract in 2025 and 2026
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
|
|||||||
Binary file not shown.
@@ -9,12 +9,12 @@ SUPPLIER_STOCK_LOCATIONS_CSV = 'loaders/supplier_stock_locations.csv'
|
|||||||
SERVICES_CSV = 'loaders/services.csv'
|
SERVICES_CSV = 'loaders/services.csv'
|
||||||
VESSELS_CSV = 'loaders/vessels.csv'
|
VESSELS_CSV = 'loaders/vessels.csv'
|
||||||
|
|
||||||
PURCHASE_CONTRACTS_CSV = 'C:/Users/SylvainDUVERNAY/Open Squared/Production - Documents/TRADON Implementation/ITSA/Reference Data/python_project/loaders/Purchase_Contracts_with_mapping.csv'
|
PURCHASE_CONTRACTS_CSV = 'Reference Data\python_project\loaders\Purchase_Contracts_with_mapping.csv'
|
||||||
PURCHASE_FEES_CSV = 'Reference Data\python_project\loaders\Purchase_Fees 2.csv'
|
PURCHASE_FEES_CSV = 'Reference Data\python_project\loaders\Purchase_Fees 2.csv'
|
||||||
|
|
||||||
SALE_CONTRACTS_CSV = 'Reference Data\python_project\loaders\Sale_Contracts_with_mapping.csv'
|
SALE_CONTRACTS_CSV = 'Reference Data\python_project\loaders\Sale_Contracts_with_mapping.csv'
|
||||||
SALE_FEES_CSV = 'loaders/sale_fees.csv'
|
SALE_FEES_CSV = 'Reference Data\python_project\loaders\sale_fees.csv'
|
||||||
PRICES_CSV = 'loaders/Prices_6.csv'
|
PRICES_CSV = 'Reference Data\python_project\loaders\Prices.csv'
|
||||||
|
|
||||||
|
|
||||||
# XML-RPC Configuration (for Proteus interaction)
|
# XML-RPC Configuration (for Proteus interaction)
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
ContractType,ContractNumber,EstimatedBlDate
|
||||||
|
P,2086,2026-04-01
|
||||||
|
S,2081,2026-04-01
|
||||||
|
S,2102,2026-04-01
|
||||||
|
S,2179,2026-04-01
|
||||||
|
P,2133,2026-04-08
|
||||||
|
S,2134,2026-04-08
|
||||||
|
P,2061,2026-04-15
|
||||||
|
P,2128,2026-04-27
|
||||||
|
S,2170,2026-04-27
|
||||||
|
P,2095,2026-05-01
|
||||||
|
P,2111,2026-05-01
|
||||||
|
P,2135,2026-05-01
|
||||||
|
S,2112,2026-05-01
|
||||||
|
S,2120,2026-05-01
|
||||||
|
S,2136,2026-05-01
|
||||||
|
S,2168,2026-05-01
|
||||||
|
P,2087,2026-06-01
|
||||||
|
P,2137,2026-06-01
|
||||||
|
S,2068,2026-06-01
|
||||||
|
S,2103,2026-06-01
|
||||||
|
S,2138,2026-06-01
|
||||||
|
P,2065,2026-06-03
|
||||||
|
S,2066,2026-06-03
|
||||||
|
P,2063,2026-06-12
|
||||||
|
S,2064,2026-06-12
|
||||||
|
P,2067,2026-07-01
|
||||||
|
P,2113,2026-07-01
|
||||||
|
P,2139,2026-07-01
|
||||||
|
S,2079,2026-07-01
|
||||||
|
S,2114,2026-07-01
|
||||||
|
S,2140,2026-07-01
|
||||||
|
P,2090,2026-07-12
|
||||||
|
P,2088,2026-08-01
|
||||||
|
P,2141,2026-08-01
|
||||||
|
S,2082,2026-08-01
|
||||||
|
S,2142,2026-08-01
|
||||||
|
P,2073,2026-08-05
|
||||||
|
P,2094,2026-09-01
|
||||||
|
P,2115,2026-09-01
|
||||||
|
P,2129,2026-09-01
|
||||||
|
P,2143,2026-09-01
|
||||||
|
S,2116,2026-09-01
|
||||||
|
S,2121,2026-09-01
|
||||||
|
S,2144,2026-09-01
|
||||||
|
P,2069,2026-09-05
|
||||||
|
S,2070,2026-09-05
|
||||||
|
P,2145,2026-10-01
|
||||||
|
S,2080,2026-10-01
|
||||||
|
S,2146,2026-10-01
|
||||||
|
P,2062,2026-10-05
|
||||||
|
P,2096,2026-11-01
|
||||||
|
P,2117,2026-11-01
|
||||||
|
P,2147,2026-11-01
|
||||||
|
S,2083,2026-11-01
|
||||||
|
S,2118,2026-11-01
|
||||||
|
S,2148,2026-11-01
|
||||||
|
P,2149,2026-12-01
|
||||||
|
S,2104,2026-12-01
|
||||||
|
S,2150,2026-12-01
|
||||||
|
60
Reference Data/python_project/loaders/Contract_Update.csv
Normal file
60
Reference Data/python_project/loaders/Contract_Update.csv
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
ContractType,ContractNumber,EstimatedBlDate
|
||||||
|
P,2086,4/1/2026
|
||||||
|
S,2081,4/1/2026
|
||||||
|
S,2102,4/1/2026
|
||||||
|
S,2179,4/1/2026
|
||||||
|
P,2133,4/8/2026
|
||||||
|
S,2134,4/8/2026
|
||||||
|
P,2061,4/15/2026
|
||||||
|
P,2128,4/27/2026
|
||||||
|
S,2170,4/27/2026
|
||||||
|
P,2095,5/1/2026
|
||||||
|
P,2111,5/1/2026
|
||||||
|
P,2135,5/1/2026
|
||||||
|
S,2112,5/1/2026
|
||||||
|
S,2120,5/1/2026
|
||||||
|
S,2136,5/1/2026
|
||||||
|
S,2168,5/1/2026
|
||||||
|
P,2087,6/1/2026
|
||||||
|
P,2137,6/1/2026
|
||||||
|
S,2068,6/1/2026
|
||||||
|
S,2103,6/1/2026
|
||||||
|
S,2138,6/1/2026
|
||||||
|
P,2065,6/3/2026
|
||||||
|
S,2066,6/3/2026
|
||||||
|
P,2063,6/12/2026
|
||||||
|
S,2064,6/12/2026
|
||||||
|
P,2067,7/1/2026
|
||||||
|
P,2113,7/1/2026
|
||||||
|
P,2139,7/1/2026
|
||||||
|
S,2079,7/1/2026
|
||||||
|
S,2114,7/1/2026
|
||||||
|
S,2140,7/1/2026
|
||||||
|
P,2090,7/12/2026
|
||||||
|
P,2088,8/1/2026
|
||||||
|
P,2141,8/1/2026
|
||||||
|
S,2082,8/1/2026
|
||||||
|
S,2142,8/1/2026
|
||||||
|
P,2073,8/5/2026
|
||||||
|
P,2094,9/1/2026
|
||||||
|
P,2115,9/1/2026
|
||||||
|
P,2129,9/1/2026
|
||||||
|
P,2143,9/1/2026
|
||||||
|
S,2116,9/1/2026
|
||||||
|
S,2121,9/1/2026
|
||||||
|
S,2144,9/1/2026
|
||||||
|
P,2069,9/5/2026
|
||||||
|
S,2070,9/5/2026
|
||||||
|
P,2145,10/1/2026
|
||||||
|
S,2080,10/1/2026
|
||||||
|
S,2146,10/1/2026
|
||||||
|
P,2062,10/5/2026
|
||||||
|
P,2096,11/1/2026
|
||||||
|
P,2117,11/1/2026
|
||||||
|
P,2147,11/1/2026
|
||||||
|
S,2083,11/1/2026
|
||||||
|
S,2118,11/1/2026
|
||||||
|
S,2148,11/1/2026
|
||||||
|
P,2149,12/1/2026
|
||||||
|
S,2104,12/1/2026
|
||||||
|
S,2150,12/1/2026
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,53 +0,0 @@
|
|||||||
price_index,price_date,high_price,low_price,open_price,price_value
|
|
||||||
CFR Chile 2025-04,2024-04-05,123,123,123,123
|
|
||||||
CFR Chile 2025-04,2024-04-12,123,123,123,123
|
|
||||||
CFR Chile 2025-04,2024-04-19,123,123,123,123
|
|
||||||
CFR Chile 2025-04,2024-04-26,123,123,123,123
|
|
||||||
CFR Chile 2025-04,2024-05-03,123,123,123,123
|
|
||||||
CFR Chile 2025-04,2024-05-10,123,123,123,123
|
|
||||||
CFR Chile 2025-04,2024-05-16,123,123,123,123
|
|
||||||
CFR Chile 2025-04,2024-05-24,123,123,123,123
|
|
||||||
CFR Chile 2025-04,2024-05-31,123,123,123,123
|
|
||||||
CFR Chile 2025-04,2024-06-07,123,123,123,123
|
|
||||||
CFR Chile 2025-04,2024-06-14,126,126,126,126
|
|
||||||
CFR Chile 2025-04,2024-06-21,130,130,130,130
|
|
||||||
CFR Chile 2025-04,2024-06-28,130,130,130,130
|
|
||||||
CFR Chile 2025-04,2024-07-05,130,130,130,130
|
|
||||||
CFR Chile 2025-04,2024-07-12,130,130,130,130
|
|
||||||
CFR Chile 2025-04,2024-07-19,140,140,140,140
|
|
||||||
CFR Chile 2025-04,2024-07-23,140,140,140,140
|
|
||||||
CFR Chile 2025-04,2024-07-26,147,147,147,147
|
|
||||||
CFR Chile 2025-04,2024-08-02,147,147,147,147
|
|
||||||
CFR Chile 2025-04,2024-08-09,149,149,149,149
|
|
||||||
CFR Chile 2025-04,2024-08-16,150,150,150,150
|
|
||||||
CFR Chile 2025-04,2024-08-23,153,153,153,153
|
|
||||||
CFR Chile 2025-04,2024-08-30,153,153,153,153
|
|
||||||
CFR Chile 2025-04,2024-09-06,153,153,153,153
|
|
||||||
CFR Chile 2025-04,2024-09-13,153,153,153,153
|
|
||||||
CFR Chile 2025-04,2024-09-20,157,157,157,157
|
|
||||||
CFR Chile 2025-04,2024-09-27,159,159,159,159
|
|
||||||
CFR Chile 2025-04,2024-10-04,161,161,161,161
|
|
||||||
CFR Chile 2025-04,2024-10-11,161,161,161,161
|
|
||||||
CFR Chile 2025-04,2024-10-18,162,162,162,162
|
|
||||||
CFR Chile 2025-04,2024-10-25,162,162,162,162
|
|
||||||
CFR Chile 2025-04,2024-11-01,160,160,160,160
|
|
||||||
CFR Chile 2025-04,2024-11-08,154,154,154,154
|
|
||||||
CFR Chile 2025-04,2024-11-15,151,151,151,151
|
|
||||||
CFR Chile 2025-04,2024-11-22,151,151,151,151
|
|
||||||
CFR Chile 2025-04,2024-11-29,151,151,151,151
|
|
||||||
CFR Chile 2025-04,2024-12-06,152,152,152,152
|
|
||||||
CFR Chile 2025-04,2024-12-13,151,151,151,151
|
|
||||||
CFR Chile 2025-04,2024-12-20,150,150,150,150
|
|
||||||
CFR Chile 2025-04,2025-01-10,149,149,149,149
|
|
||||||
CFR Chile 2025-04,2025-01-17,150,150,150,150
|
|
||||||
CFR Chile 2025-04,2025-01-24,150,150,150,150
|
|
||||||
CFR Chile 2025-04,2025-01-31,149,149,149,149
|
|
||||||
CFR Chile 2025-04,2025-02-03,149,149,149,149
|
|
||||||
CFR Chile 2025-04,2025-02-07,145,145,145,145
|
|
||||||
CFR Chile 2025-04,2025-02-14,144,144,144,144
|
|
||||||
CFR Chile 2025-04,2025-02-21,144,144,144,144
|
|
||||||
CFR Chile 2025-04,2025-02-28,142,142,142,142
|
|
||||||
CFR Chile 2025-04,2025-03-07,142,142,142,142
|
|
||||||
CFR Chile 2025-04,2025-03-14,145,145,145,145
|
|
||||||
CFR Chile 2025-04,2025-03-21,150,150,150,150
|
|
||||||
CFR Chile 2025-04,2025-03-28,160,160,160,160
|
|
||||||
|
@@ -1,559 +0,0 @@
|
|||||||
price_index,price_date,high_price,low_price,open_price,price_value
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-02-26,135,135,135,135
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-02-19,135,135,135,135
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-02-12,130,130,130,130
|
|
||||||
CFR Gladstone 2026-03,2026-02-06,217,217,217,217
|
|
||||||
CFR India 2026-04,2026-02-06,165,165,165,165
|
|
||||||
FOB China 2026-03,2026-02-06,130,130,130,130
|
|
||||||
FOB NWE 2026-03,2026-02-06,127.5,127.5,127.5,127.5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-02-05,130,130,130,130
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-01-29,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-01-22,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-01-15,108,108,108,108
|
|
||||||
CFR Gladstone 2026-03,2026-01-09,202,202,202,202
|
|
||||||
CFR India 2026-04,2026-01-09,154,154,154,154
|
|
||||||
FOB China 2026-03,2026-01-09,125,125,125,125
|
|
||||||
FOB NWE 2026-03,2026-01-09,122,122,122,122
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-01-08,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-01-02,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-12-18,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-12-11,108,108,108,108
|
|
||||||
CFR Gladstone 2026-03,2025-12-05,192,192,192,192
|
|
||||||
CFR India 2026-04,2025-12-05,134,134,134,134
|
|
||||||
CFR LXML Fixed price 2026-01,2025-12-05,82.4,82.4,82.4,82.4
|
|
||||||
FOB China 2026-03,2025-12-05,105,105,105,105
|
|
||||||
FOB NWE 2026-03,2025-12-05,102,102,102,102
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-12-04,108,108,108,108
|
|
||||||
CFR Gladstone 2026-03,2025-12-01,192,192,192,192
|
|
||||||
CFR India 2026-04,2025-12-01,134,134,134,134
|
|
||||||
CFR LXML Fixed price 2026-01,2025-12-01,105,105,105,105
|
|
||||||
FOB China 2026-03,2025-12-01,105,105,105,105
|
|
||||||
FOB NWE 2026-03,2025-12-01,102,102,102,102
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-11-27,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-11-20,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-11-13,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-11-06,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-10-30,83,83,83,83
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-10-23,78,78,78,78
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-10-16,73,73,73,73
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-10-09,61,61,61,61
|
|
||||||
CFR Gladstone 2025-12,2025-10-03,155,155,155,155
|
|
||||||
CFR Gladstone 2026-03,2025-10-03,152,152,152,152
|
|
||||||
CFR India 2026-04,2025-10-03,99,99,99,99
|
|
||||||
CFR LXML Fixed price 2026-01,2025-10-03,75,75,75,75
|
|
||||||
FOB China 2026-03,2025-10-03,65,65,65,65
|
|
||||||
FOB NWE 2026-03,2025-10-03,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-10-02,61,61,61,61
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-09-25,61,61,61,61
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-09-18,63,63,63,63
|
|
||||||
CFR Chile 2025-10,2025-09-12,155,155,155,155
|
|
||||||
CFR Gladstone 2025-12,2025-09-12,157,157,157,157
|
|
||||||
CFR Gladstone 2026-03,2025-09-12,157,157,157,157
|
|
||||||
CFR India 2026-04,2025-09-12,104,104,104,104
|
|
||||||
CFR LXML Fixed price 2026-01,2025-09-12,75,75,75,75
|
|
||||||
FOB China 2026-03,2025-09-12,70,70,70,70
|
|
||||||
FOB Japan/South Korea 2025-10,2025-09-12,70,70,70,70
|
|
||||||
FOB NWE 2026-03,2025-09-12,60,60,60,60
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-09-11,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-09-04,74,74,74,74
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-08-28,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-08-21,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-08-14,80,80,80,80
|
|
||||||
CFR Chile 2025-10,2025-08-11,175,175,175,175
|
|
||||||
CFR Gladstone 2025-12,2025-08-11,177,177,177,177
|
|
||||||
CFR Gladstone 2026-03,2025-08-11,167,167,167,167
|
|
||||||
CFR India 2026-04,2025-08-11,119,119,119,119
|
|
||||||
CFR LXML Fixed price 2026-01,2025-08-11,75,75,75,75
|
|
||||||
FOB China 2026-03,2025-08-11,80,80,80,80
|
|
||||||
FOB Japan/South Korea 2025-10,2025-08-11,88,88,88,88
|
|
||||||
FOB NWE 2026-03,2025-08-11,100,100,100,100
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-08-07,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-07-31,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-07-24,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-07-17,80,80,80,80
|
|
||||||
CFR Chile 2025-10,2025-07-11,179,179,179,179
|
|
||||||
FOB Japan/South Korea 2025-10,2025-07-11,90,90,90,90
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-07-10,80,80,80,80
|
|
||||||
CFR Chile 2025-10,2025-07-04,179,179,179,179
|
|
||||||
CFR Gladstone 2025-12,2025-07-04,172,172,172,172
|
|
||||||
CFR Gladstone 2026-03,2025-07-04,167,167,167,167
|
|
||||||
CFR India 2026-04,2025-07-04,114,114,114,114
|
|
||||||
CFR LXML Fixed price 2026-01,2025-07-04,75,75,75,75
|
|
||||||
FOB China 2026-03,2025-07-04,80,80,80,80
|
|
||||||
FOB Japan/South Korea 2025-10,2025-07-04,90,90,90,90
|
|
||||||
FOB NWE 2026-03,2025-07-04,100,100,100,100
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-07-03,80,80,80,80
|
|
||||||
CFR Gladstone 2026-03,2025-07-02,167,167,167,167
|
|
||||||
CFR India 2026-04,2025-07-02,114,114,114,114
|
|
||||||
FOB China 2026-03,2025-07-02,80,80,80,80
|
|
||||||
FOB NWE 2026-03,2025-07-02,100,100,100,100
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-06-26,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-06-19,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-06-12,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-06-05,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-05-29,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-05-22,67,67,67,67
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-05-15,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-05-08,65,65,65,65
|
|
||||||
CFR Chile 2025-10,2025-05-02,150,150,150,150
|
|
||||||
CFR Gladstone 2025-12,2025-05-02,139,139,139,139
|
|
||||||
CFR Gladstone 2026-03,2025-05-02,139,139,139,139
|
|
||||||
CFR India 2026-04,2025-05-02,90,90,90,90
|
|
||||||
CFR LXML Fixed price 2026-01,2025-05-02,75,75,75,75
|
|
||||||
FOB China 2026-03,2025-05-02,50,50,50,50
|
|
||||||
FOB Japan/South Korea 2025-10,2025-05-02,50,50,50,50
|
|
||||||
FOB NWE 2026-03,2025-05-02,82,82,82,82
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-05-01,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-04-24,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-04-17,65,65,65,65
|
|
||||||
CFR Chile 2025-05,2025-04-11,165,165,165,165
|
|
||||||
CFR Chile 2025-10,2025-04-11,148,148,148,148
|
|
||||||
CFR Gladstone 2025-12,2025-04-11,136,136,136,136
|
|
||||||
CFR Gladstone 2026-03,2025-04-11,136,136,136,136
|
|
||||||
CFR India 2026-04,2025-04-11,88,88,88,88
|
|
||||||
CFR LXML Fixed price 2026-01,2025-04-11,75,75,75,75
|
|
||||||
FOB China 2026-03,2025-04-11,46,46,46,46
|
|
||||||
FOB Japan/South Korea 2025-10,2025-04-11,50,50,50,50
|
|
||||||
FOB NWE 2026-03,2025-04-11,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-04-10,60,60,60,60
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-04-03,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-03-27,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-03-20,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-03-13,50,50,50,50
|
|
||||||
CFR Chile 2025-05,2025-03-07,142,142,142,142
|
|
||||||
CFR Chile 2025-10,2025-03-07,140,140,140,140
|
|
||||||
CFR Gladstone 2025-12,2025-03-07,136,136,136,136
|
|
||||||
CFR Gladstone 2026-03,2025-03-07,136,136,136,136
|
|
||||||
CFR LXML Fixed price 2026-01,2025-03-07,75,75,75,75
|
|
||||||
CFR US Gulf 2025-04,2025-03-07,120,120,120,120
|
|
||||||
FOB China 2026-03,2025-03-07,46,46,46,46
|
|
||||||
FOB Japan/South Korea 2025-10,2025-03-07,42,42,42,42
|
|
||||||
FOB NWE 2026-03,2025-03-07,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-03-06,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-02-27,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-02-20,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-02-13,43,43,43,43
|
|
||||||
CFR Chile 2025-05,2025-02-07,145,145,145,145
|
|
||||||
CFR SEA 2025-03,2025-02-07,78.68,78.68,78.68,78.68
|
|
||||||
CFR US Gulf 2025-04,2025-02-07,135,135,135,135
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-02-06,43,43,43,43
|
|
||||||
CFR Chile 2025-05,2025-02-03,149,149,149,149
|
|
||||||
CFR Chile 2025-10,2025-02-03,149,149,149,149
|
|
||||||
CFR Gladstone 2025-12,2025-02-03,136,136,136,136
|
|
||||||
CFR LXML Fixed price 2026-01,2025-02-03,75,75,75,75
|
|
||||||
CFR SEA 2025-03,2025-02-03,82.68,82.68,82.68,82.68
|
|
||||||
CFR US Gulf 2025-04,2025-02-03,136,136,136,136
|
|
||||||
FOB Japan/South Korea 2025-10,2025-02-03,42,42,42,42
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-01-30,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-01-23,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-01-16,45,45,45,45
|
|
||||||
CFR Chile 2025-05,2025-01-10,149,149,149,149
|
|
||||||
CFR Chile 2025-10,2025-01-10,149,149,149,149
|
|
||||||
CFR Gladstone 2025-12,2025-01-10,135,135,135,135
|
|
||||||
CFR LXML Fixed price 2026-01,2025-01-10,75,75,75,75
|
|
||||||
CFR SEA 2025-03,2025-01-10,82.68,82.68,82.68,82.68
|
|
||||||
CFR US Gulf 2025-04,2025-01-10,139,139,139,139
|
|
||||||
FOB Japan/South Korea 2025-10,2025-01-10,41,41,41,41
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-01-09,44,44,44,44
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-01-03,44,44,44,44
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-12-19,44,44,44,44
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-12-12,44,44,44,44
|
|
||||||
CFR Chile 2025-05,2024-12-06,152,152,152,152
|
|
||||||
CFR Chile 2025-10,2024-12-06,152,152,152,152
|
|
||||||
CFR Gladstone 2025-12,2024-12-06,136,136,136,136
|
|
||||||
CFR SEA 2025-03,2024-12-06,80.68,80.68,80.68,80.68
|
|
||||||
CFR US Gulf 2025-04,2024-12-06,134,134,134,134
|
|
||||||
FOB Japan/South Korea 2025-10,2024-12-06,41,41,41,41
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-12-05,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-11-28,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-11-21,48,48,48,48
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-11-14,48,48,48,48
|
|
||||||
CFR Chile 2025-05,2024-11-08,154,154,154,154
|
|
||||||
CFR Chile 2025-10,2024-11-08,154,154,154,154
|
|
||||||
CFR SEA 2025-03,2024-11-08,75.68,75.68,75.68,75.68
|
|
||||||
CFR US Gulf 2025-04,2024-11-08,131,131,131,131
|
|
||||||
FOB Japan/South Korea 2025-10,2024-11-08,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-11-07,48,48,48,48
|
|
||||||
CFR Chile 2025-05,2024-11-01,160,160,160,160
|
|
||||||
CFR Chile 2025-10,2024-11-01,160,160,160,160
|
|
||||||
CFR SEA 2025-03,2024-11-01,76.68,76.68,76.68,76.68
|
|
||||||
CFR US Gulf 2025-04,2024-11-01,131,131,131,131
|
|
||||||
FOB Japan/South Korea 2025-10,2024-11-01,41,41,41,41
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-10-31,48,48,48,48
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-10-24,48,48,48,48
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-10-17,48,48,48,48
|
|
||||||
CFR Chile 2025-05,2024-10-11,161,161,161,161
|
|
||||||
CFR Chile 2025-10,2024-10-11,161,161,161,161
|
|
||||||
CFR SEA 2025-03,2024-10-11,77.68,77.68,77.68,77.68
|
|
||||||
CFR US Gulf 2025-04,2024-10-11,132,132,132,132
|
|
||||||
FOB Japan/South Korea 2025-10,2024-10-11,39,39,39,39
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-10-10,45,45,45,45
|
|
||||||
CFR Chile 2025-05,2024-10-04,161,161,161,161
|
|
||||||
CFR Chile 2025-10,2024-10-04,161,161,161,161
|
|
||||||
CFR SEA 2025-03,2024-10-04,75.68,75.68,75.68,75.68
|
|
||||||
CFR US Gulf 2025-04,2024-10-04,128,128,128,128
|
|
||||||
FOB Japan/South Korea 2025-10,2024-10-04,39,39,39,39
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-10-03,42,42,42,42
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-09-26,42,42,42,42
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-09-19,42,42,42,42
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-09-12,44,44,44,44
|
|
||||||
CFR Chile 2025-05,2024-09-06,153,153,153,153
|
|
||||||
CFR SEA 2025-03,2024-09-06,69.18,69.18,69.18,69.18
|
|
||||||
CFR US Gulf 2025-04,2024-09-06,109,109,109,109
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-09-05,44,44,44,44
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-08-29,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-08-22,42,42,42,42
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-08-15,40,40,40,40
|
|
||||||
CFR Chile 2025-05,2024-08-09,149,149,149,149
|
|
||||||
CFR SEA 2025-03,2024-08-09,67.75,67.75,67.75,67.75
|
|
||||||
CFR US Gulf 2025-04,2024-08-09,96,96,96,96
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-08-08,40,40,40,40
|
|
||||||
CFR Chile 2025-05,2024-08-02,147,147,147,147
|
|
||||||
CFR SEA 2025-03,2024-08-02,65.25,65.25,65.25,65.25
|
|
||||||
CFR US Gulf 2025-04,2024-08-02,96,96,96,96
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-08-01,37,37,37,37
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-07-25,37,37,37,37
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-07-18,30,30,30,30
|
|
||||||
CFR Chile 2025-05,2024-07-12,130,130,130,130
|
|
||||||
CFR SEA 2025-03,2024-07-12,58.25,58.25,58.25,58.25
|
|
||||||
CFR US Gulf 2025-04,2024-07-12,95,95,95,95
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-07-11,28,28,28,28
|
|
||||||
CFR Chile 2025-05,2024-07-05,130,130,130,130
|
|
||||||
CFR SEA 2025-03,2024-07-05,58.25,58.25,58.25,58.25
|
|
||||||
CFR US Gulf 2025-04,2024-07-05,92,92,92,92
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-07-04,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-06-27,22,22,22,22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-06-20,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-06-13,15,15,15,15
|
|
||||||
CFR Chile 2025-05,2024-06-07,123,123,123,123
|
|
||||||
CFR SEA 2025-03,2024-06-07,51.58,51.58,51.58,51.58
|
|
||||||
CFR US Gulf 2025-04,2024-06-07,92,92,92,92
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-06-06,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-05-30,12,12,12,12
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-05-23,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-05-16,15,15,15,15
|
|
||||||
CFR Chile 2025-05,2024-05-10,123,123,123,123
|
|
||||||
CFR SEA 2025-03,2024-05-10,51.08,51.08,51.08,51.08
|
|
||||||
CFR US Gulf 2025-04,2024-05-10,92,92,92,92
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-05-09,15,15,15,15
|
|
||||||
CFR Chile 2025-05,2024-05-03,123,123,123,123
|
|
||||||
CFR SEA 2025-03,2024-05-03,51.08,51.08,51.08,51.08
|
|
||||||
CFR US Gulf 2025-04,2024-05-03,92,92,92,92
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-05-02,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-04-25,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-04-18,15,15,15,15
|
|
||||||
CFR SEA 2025-03,2024-04-12,51.08,51.08,51.08,51.08
|
|
||||||
CFR US Gulf 2025-04,2024-04-12,95,95,95,95
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-04-11,10,10,10,10
|
|
||||||
CFR SEA 2025-03,2024-04-05,51.08,51.08,51.08,51.08
|
|
||||||
CFR US Gulf 2025-04,2024-04-05,95,95,95,95
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-04-04,6,6,6,6
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-03-28,2,2,2,2
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-03-21,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-03-14,5,5,5,5
|
|
||||||
CFR SEA 2025-03,2024-03-08,46.08,46.08,46.08,46.08
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-03-07,2,2,2,2
|
|
||||||
CFR SEA 2025-03,2024-03-01,48.08,48.08,48.08,48.08
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-02-29,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-02-22,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-02-15,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-02-08,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-02-01,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-01-25,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-01-18,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-01-11,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-01-04,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-12-21,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-12-14,12,12,12,12
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-12-07,16,16,16,16
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-11-30,23,23,23,23
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-11-23,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-11-16,27,27,27,27
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-11-09,32,32,32,32
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-11-02,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-10-26,38,38,38,38
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-10-19,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-10-12,38,38,38,38
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-10-05,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-09-28,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-09-21,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-09-14,38,38,38,38
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-09-07,28,28,28,28
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-08-31,28,28,28,28
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-08-24,18,18,18,18
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-08-17,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-08-10,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-08-03,-5,-5,-5,-5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-07-27,-15,-15,-15,-15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-07-20,-15,-15,-15,-15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-07-13,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-07-06,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-06-29,-7,-7,-7,-7
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-06-22,-5,-5,-5,-5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-06-15,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-06-08,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-06-01,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-05-25,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-05-18,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-05-11,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-05-04,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-04-27,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-04-20,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-04-13,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-04-06,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-03-30,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-03-23,-5,-5,-5,-5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-03-16,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-03-09,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-03-02,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-02-23,-18,-18,-18,-18
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-02-16,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-02-09,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-02-02,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-01-26,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-01-19,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-01-12,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-01-05,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-12-22,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-12-15,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-12-08,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-12-01,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-11-24,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-11-17,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-11-10,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-11-03,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-10-27,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-10-20,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-10-13,3,3,3,3
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-10-06,3,3,3,3
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-09-29,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-09-22,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-09-15,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-09-08,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-09-01,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-08-25,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-08-18,95,95,95,95
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-08-11,100,100,100,100
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-08-04,110,110,110,110
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-07-28,110,110,110,110
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-07-21,110,110,110,110
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-07-14,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-07-07,130,130,130,130
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-06-30,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-06-23,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-06-16,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-06-09,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-06-01,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-05-26,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-05-19,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-05-12,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-05-05,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-04-28,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-04-21,130,130,130,130
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-04-14,130,130,130,130
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-04-07,130,130,130,130
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-03-31,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-03-24,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-03-17,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-03-10,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-03-03,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-02-24,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-02-17,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-02-10,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-02-03,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-01-27,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-01-20,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-01-13,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-01-06,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-12-23,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-12-16,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-12-09,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-12-02,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-11-25,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-11-18,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-11-11,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-11-04,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-10-28,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-10-21,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-10-14,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-10-07,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-09-30,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-09-23,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-09-16,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-09-09,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-09-02,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-08-26,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-08-19,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-08-12,110,110,110,110
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-08-05,105,105,105,105
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-07-29,100,100,100,100
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-07-22,95,95,95,95
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-07-15,95,95,95,95
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-07-08,95,95,95,95
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-07-01,90,90,90,90
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-06-24,90,90,90,90
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-06-17,90,90,90,90
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-06-10,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-06-03,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-05-27,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-05-20,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-05-13,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-05-06,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-04-29,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-04-22,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-04-15,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-04-08,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-04-01,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-03-25,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-03-18,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-03-11,60,60,60,60
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-03-04,60,60,60,60
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-02-25,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-02-18,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-02-11,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-02-04,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-01-28,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-01-21,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-01-14,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-01-07,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-12-23,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-12-17,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-12-10,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-12-03,3,3,3,3
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-11-26,3,3,3,3
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-11-19,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-11-12,-4,-4,-4,-4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-11-05,-6,-6,-6,-6
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-10-29,-8,-8,-8,-8
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-10-22,-8,-8,-8,-8
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-10-15,-8,-8,-8,-8
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-10-08,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-10-01,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-09-24,-14,-14,-14,-14
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-09-17,-14,-14,-14,-14
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-09-10,-14,-14,-14,-14
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-09-03,-15,-15,-15,-15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-08-27,-20,-20,-20,-20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-08-20,-20,-20,-20,-20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-08-13,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-08-06,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-07-30,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-07-23,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-07-16,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-07-09,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-07-02,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-06-25,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-06-18,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-06-11,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-06-04,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-05-28,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-05-21,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-05-14,-20,-20,-20,-20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-05-07,-25,-25,-25,-25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-04-30,-35,-35,-35,-35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-04-23,-40,-40,-40,-40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-04-16,-45,-45,-45,-45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-04-09,-40,-40,-40,-40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-04-02,-40,-40,-40,-40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-03-26,-30,-30,-30,-30
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-03-19,-30,-30,-30,-30
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-03-12,-25,-25,-25,-25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-03-05,-20,-20,-20,-20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-02-27,-20,-20,-20,-20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-02-20,-11,-11,-11,-11
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-02-13,-11,-11,-11,-11
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-02-06,-5,-5,-5,-5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-01-30,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-01-23,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-01-16,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-01-09,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-01-03,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-12-19,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-12-12,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-12-05,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-11-28,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-11-21,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-11-14,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-11-07,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-10-31,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-10-24,8,8,8,8
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-10-17,9,9,9,9
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-10-10,9,9,9,9
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-10-03,9,9,9,9
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-09-26,9,9,9,9
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-09-19,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-09-12,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-09-05,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-08-29,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-08-22,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-08-15,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-08-08,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-08-01,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-07-25,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-07-18,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-07-11,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-07-04,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-06-27,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-06-20,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-06-13,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-06-06,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-05-30,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-05-23,28,28,28,28
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-05-16,28,28,28,28
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-05-09,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-05-02,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-04-25,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-04-18,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-04-11,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-04-04,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-03-28,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-03-21,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-03-14,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-03-07,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-02-28,58,58,58,58
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-02-21,58,58,58,58
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-02-14,58,58,58,58
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-02-07,62,62,62,62
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-01-31,62,62,62,62
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-01-24,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-01-17,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-01-10,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-01-03,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-12-20,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-12-13,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-12-06,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-11-29,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-11-22,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-11-15,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-11-08,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-11-01,67,67,67,67
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-10-25,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-10-18,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-10-11,62,62,62,62
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-10-04,62,62,62,62
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-09-27,62,62,62,62
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-09-20,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-09-13,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-09-06,52,52,52,52
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-08-30,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-08-23,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-08-16,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-08-09,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-08-02,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-07-26,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-07-19,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-07-12,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-07-05,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-06-28,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-06-21,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-06-14,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-06-07,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-05-31,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-05-24,30,30,30,30
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-05-17,30,30,30,30
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-05-10,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-05-03,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-04-26,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-04-19,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-04-12,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-04-05,25,25,25,25
|
|
||||||
|
@@ -1,406 +0,0 @@
|
|||||||
price_index,price_date,high_price,low_price,open_price,price_value
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-04-05,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-04-12,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-04-19,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-04-26,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-05-03,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-05-10,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-05-17,30,30,30,30
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-05-24,30,30,30,30
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-05-31,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-06-07,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-06-14,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-06-21,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-06-28,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-07-05,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-07-12,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-07-19,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-07-26,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-08-02,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-08-09,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-08-16,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-08-23,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-08-30,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-09-06,52,52,52,52
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-09-13,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-09-20,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-09-27,62,62,62,62
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-10-04,62,62,62,62
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-10-11,62,62,62,62
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-10-18,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-10-25,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-11-01,67,67,67,67
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-11-08,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-11-15,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-11-22,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-11-29,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-12-06,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-12-13,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2018-12-20,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-01-03,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-01-10,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-01-17,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-01-24,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-01-31,62,62,62,62
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-02-07,62,62,62,62
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-02-14,58,58,58,58
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-02-21,58,58,58,58
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-02-28,58,58,58,58
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-03-07,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-03-14,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-03-21,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-03-28,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-04-04,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-04-11,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-04-18,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-04-25,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-05-02,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-05-09,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-05-16,28,28,28,28
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-05-23,28,28,28,28
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-05-30,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-06-06,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-06-13,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-06-20,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-06-27,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-07-04,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-07-11,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-07-18,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-07-25,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-08-01,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-08-08,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-08-15,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-08-22,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-08-29,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-09-05,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-09-12,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-09-19,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-09-26,9,9,9,9
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-10-03,9,9,9,9
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-10-10,9,9,9,9
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-10-17,9,9,9,9
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-10-24,8,8,8,8
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-10-31,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-11-07,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-11-14,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-11-21,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-11-28,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-12-05,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-12-12,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2019-12-19,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-01-03,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-01-09,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-01-16,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-01-23,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-01-30,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-02-06,-5,-5,-5,-5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-02-13,-11,-11,-11,-11
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-02-20,-11,-11,-11,-11
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-02-27,-20,-20,-20,-20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-03-05,-20,-20,-20,-20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-03-12,-25,-25,-25,-25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-03-19,-30,-30,-30,-30
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-03-26,-30,-30,-30,-30
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-04-02,-40,-40,-40,-40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-04-09,-40,-40,-40,-40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-04-16,-45,-45,-45,-45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-04-23,-40,-40,-40,-40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-04-30,-35,-35,-35,-35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-05-07,-25,-25,-25,-25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-05-14,-20,-20,-20,-20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-05-21,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-05-28,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-06-04,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-06-11,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-06-18,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-06-25,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-07-02,-17,-17,-17,-17
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-07-09,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-07-16,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-07-23,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-07-30,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-08-06,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-08-13,-22,-22,-22,-22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-08-20,-20,-20,-20,-20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-08-27,-20,-20,-20,-20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-09-03,-15,-15,-15,-15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-09-10,-14,-14,-14,-14
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-09-17,-14,-14,-14,-14
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-09-24,-14,-14,-14,-14
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-10-01,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-10-08,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-10-15,-8,-8,-8,-8
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-10-22,-8,-8,-8,-8
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-10-29,-8,-8,-8,-8
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-11-05,-6,-6,-6,-6
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-11-12,-4,-4,-4,-4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-11-19,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-11-26,3,3,3,3
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-12-03,3,3,3,3
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-12-10,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-12-17,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2020-12-23,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-01-07,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-01-14,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-01-21,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-01-28,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-02-04,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-02-11,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-02-18,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-02-25,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-03-04,60,60,60,60
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-03-11,60,60,60,60
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-03-18,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-03-25,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-04-01,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-04-08,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-04-15,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-04-22,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-04-29,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-05-06,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-05-13,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-05-20,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-05-27,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-06-03,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-06-10,77,77,77,77
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-06-17,90,90,90,90
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-06-24,90,90,90,90
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-07-01,90,90,90,90
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-07-08,95,95,95,95
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-07-15,95,95,95,95
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-07-22,95,95,95,95
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-07-29,100,100,100,100
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-08-05,105,105,105,105
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-08-12,110,110,110,110
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-08-19,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-08-26,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-09-02,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-09-09,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-09-16,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-09-23,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-09-30,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-10-07,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-10-14,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-10-21,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-10-28,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-11-04,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-11-11,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-11-18,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-11-25,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-12-02,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-12-09,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-12-16,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2021-12-23,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-01-06,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-01-13,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-01-20,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-01-27,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-02-03,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-02-10,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-02-17,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-02-24,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-03-03,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-03-10,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-03-17,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-03-24,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-03-31,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-04-07,130,130,130,130
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-04-14,130,130,130,130
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-04-21,130,130,130,130
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-04-28,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-05-05,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-05-12,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-05-19,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-05-26,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-06-01,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-06-09,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-06-16,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-06-23,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-06-30,133,133,133,133
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-07-07,130,130,130,130
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-07-14,120,120,120,120
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-07-21,110,110,110,110
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-07-28,110,110,110,110
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-08-04,110,110,110,110
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-08-11,100,100,100,100
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-08-18,95,95,95,95
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-08-25,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-09-01,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-09-08,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-09-15,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-09-22,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-09-29,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-10-06,3,3,3,3
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-10-13,3,3,3,3
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-10-20,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-10-27,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-11-03,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-11-10,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-11-17,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-11-24,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-12-01,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-12-08,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-12-15,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2022-12-22,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-01-05,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-01-12,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-01-19,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-01-26,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-02-02,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-02-09,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-02-16,1,1,1,1
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-02-23,-18,-18,-18,-18
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-03-02,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-03-09,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-03-16,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-03-23,-5,-5,-5,-5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-03-30,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-04-06,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-04-13,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-04-20,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-04-27,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-05-04,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-05-11,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-05-18,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-05-25,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-06-01,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-06-08,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-06-15,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-06-22,-5,-5,-5,-5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-06-29,-7,-7,-7,-7
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-07-06,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-07-13,-10,-10,-10,-10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-07-20,-15,-15,-15,-15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-07-27,-15,-15,-15,-15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-08-03,-5,-5,-5,-5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-08-10,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-08-17,0,0,0,0
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-08-24,18,18,18,18
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-08-31,28,28,28,28
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-09-07,28,28,28,28
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-09-14,38,38,38,38
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-09-21,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-09-28,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-10-05,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-10-12,38,38,38,38
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-10-19,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-10-26,38,38,38,38
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-11-02,35,35,35,35
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-11-09,32,32,32,32
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-11-16,27,27,27,27
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-11-23,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-11-30,23,23,23,23
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-12-07,16,16,16,16
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-12-14,12,12,12,12
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2023-12-21,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-01-04,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-01-11,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-01-18,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-01-25,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-02-01,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-02-08,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-02-15,4,4,4,4
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-02-22,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-02-29,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-03-07,2,2,2,2
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-03-14,5,5,5,5
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-03-21,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-03-28,2,2,2,2
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-04-04,6,6,6,6
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-04-11,10,10,10,10
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-04-18,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-04-25,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-05-02,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-05-09,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-05-16,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-05-23,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-05-30,12,12,12,12
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-06-06,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-06-13,15,15,15,15
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-06-20,20,20,20,20
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-06-27,22,22,22,22
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-07-04,25,25,25,25
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-07-11,28,28,28,28
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-07-18,30,30,30,30
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-07-25,37,37,37,37
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-08-01,37,37,37,37
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-08-08,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-08-15,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-08-22,42,42,42,42
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-08-29,40,40,40,40
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-09-05,44,44,44,44
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-09-12,44,44,44,44
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-09-19,42,42,42,42
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-09-26,42,42,42,42
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-10-03,42,42,42,42
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-10-10,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-10-17,48,48,48,48
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-10-24,48,48,48,48
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-10-31,48,48,48,48
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-11-07,48,48,48,48
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-11-14,48,48,48,48
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-11-21,48,48,48,48
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-11-28,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-12-05,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-12-12,44,44,44,44
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2024-12-19,44,44,44,44
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-01-03,44,44,44,44
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-01-09,44,44,44,44
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-01-16,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-01-23,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-01-30,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-02-06,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-02-13,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-02-20,43,43,43,43
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-02-27,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-03-06,45,45,45,45
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-03-13,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-03-20,50,50,50,50
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-03-27,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-04-03,55,55,55,55
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-04-10,60,60,60,60
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-04-17,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-04-24,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-05-01,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-05-08,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-05-15,65,65,65,65
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-05-22,67,67,67,67
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-05-29,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-06-05,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-06-12,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-06-19,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-06-26,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-07-03,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-07-10,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-07-17,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-07-24,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-07-31,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-08-07,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-08-14,80,80,80,80
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-08-21,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-08-28,75,75,75,75
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-09-04,74,74,74,74
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-09-11,70,70,70,70
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-09-18,63,63,63,63
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-09-25,61,61,61,61
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-10-02,61,61,61,61
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-10-09,61,61,61,61
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-10-16,73,73,73,73
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-10-23,78,78,78,78
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-10-30,83,83,83,83
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-11-06,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-11-13,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-11-20,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-11-27,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-12-04,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-12-11,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2025-12-18,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-01-02,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-01-08,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-01-15,108,108,108,108
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-01-22,115,115,115,115
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-01-29,125,125,125,125
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-02-05,130,130,130,130
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-02-12,130,130,130,130
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-02-19,135,135,135,135
|
|
||||||
Sulphuric acid fob South Korea/Japan spot,2026-02-26,135,135,135,135
|
|
||||||
|
@@ -1,77 +1,3 @@
|
|||||||
source_id,source_line_id,number,reference,our_reference,party_name,currency_code,purchase_date,payment_term,warehouse_code,weight_basis,tol_min_pct,tol_max_pct,tol_min_qty,tol_max_qty,from_location_name,to_location_name,incoterm_name,invoice_method,description,comment,line_type,line_product_code,origin,line_quantity,line_unit_code,line_price,line_description,line_from_del,line_to_del,pricing_trigger,pricing_estimated_date,trader,operator,concentration,book,strategy,period_at,demurrage,laytime_hours,nor_extra_hours,pumping_rate,use_only_min_max,drop_remaining_quantity,,,,,,,,
|
source_id,source_line_id,number,reference,our_reference,party_name,currency_code,purchase_date,payment_term,warehouse_code,weight_basis,tol_min_pct,tol_max_pct,tol_min_qty,tol_max_qty,from_location_name,to_location_name,incoterm_name,invoice_method,description,comment,line_type,line_product_code,origin,line_quantity,line_unit_code,line_price,line_description,line_from_del,line_to_del,pricing_trigger,pricing_estimated_date,trader,operator,concentration,book,strategy,period_at,demurrage,laytime_hours,nor_extra_hours,pumping_rate,use_only_min_max,drop_remaining_quantity,,,,,,,,
|
||||||
53F9DE94-7002-4A19-86EC-A8C18D7AF953,53F9DE94-7002-4A19-86EC-A8C18D7AF953,2171,25030D,P25.018,SUMITOMO CORPORATION - MMC,USD,3/3/2026,NET ,,NCSW,0,0,598.977,598.977,Naoshima,Samut Prakan,FOB,manual,,2171 / H2SO4 FY 2025 / Thailand FY25,line,JP-H2SO4,Japan,598.977,Mt,45,598.977 Mt of sulphuric acid - Tel-quel,3/13/2026,3/22/2026,bldate,3/13/2026,Stephane Monnard, ,0,H2SO4 FY 2025,Thailand FY25,Laycan,,0,6,300,1,0,,,,,,,,
|
5E71530B-DEF7-4E7A-9245-6C2C2901230E,5E71530B-DEF7-4E7A-9245-6C2C2901230E,2195,25036A,P26.006,SUMITOMO CORPORATION - PPC,USD,4/14/2026,NET ,,NCSW,10,10,9000,11000,Saganoseki,Stockton,FOB,manual,,2195 / H2SO4 FY 2026 / Default,line,JP-H2SO4,Japan,10000,Mt,71,10000 Mt of sulphuric acid - Tel-quel,5/13/2026,5/27/2026,bldate,5/13/2026,Stephane Monnard, ,0,H2SO4 FY 2026,Default,Laycan,,0,6,300,0,0,,,,,,,,
|
||||||
E47C4BB2-FFB0-4B96-B450-38C00AF89AB1,E47C4BB2-FFB0-4B96-B450-38C00AF89AB1,2175,25030E,P25.018,SUMITOMO CORPORATION - MMC,USD,3/11/2026,NET ,,NCSW,0,0,401.023,401.023,Naoshima,Map Ta Phut,FOB,manual,,2175 / H2SO4 FY 2025 / Thailand FY25,line,JP-H2SO4,Japan,401.023,Mt,132.5,401.023 Mt of sulphuric acid - Tel-quel,3/13/2026,3/22/2026,bldate,3/13/2026,Stephane Monnard, ,0,H2SO4 FY 2025,Thailand FY25,Laycan,,0,6,300,1,0,,,,,,,,
|
|
||||||
E3B8720A-2576-4249-B3D0-CF8D197DDC64,E3B8720A-2576-4249-B3D0-CF8D197DDC64,2177,25030DF,P25.018,SUMITOMO CORPORATION - MMC,USD,3/12/2026,NET 7,,NCSW,0,0,800,800,Naoshima,Samut Prakan,FOB,manual,,2177 / H2SO4 FY 2025 / Thailand FY25,line,JP-H2SO4,Japan,800,Mt,45,800 Mt of sulphuric acid - Tel-quel,3/13/2026,3/22/2026,bldate,3/13/2026,Stephane Monnard, ,0,H2SO4 FY 2025,Thailand FY25,Laycan,,0,6,300,1,0,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
||||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||||
|
|||||||
|
@@ -1,4 +1,4 @@
|
|||||||
source_id,source_line_id,number,reference,our_reference,party_name,currency_code,sale_date,payment_term,warehouse_code,weight_basis,tol_min_pct,tol_max_pct,tol_min_qty,tol_max_qty,from_location_name,to_location_name,incoterm_name,invoice_method,description,comment,line_type,line_product_code,origin,line_quantity,line_unit_code,line_price,line_description,line_from_del,line_to_del,pricing_trigger,pricing_estimated_date,trader,operator,concentration,book,strategy,period_at,demurrage,laytime_hours,nor_extra_hours,pumping_rate,use_only_min_max,drop_remaining_quantity
|
source_id,source_line_id,number,reference,our_reference,party_name,currency_code,sale_date,payment_term,warehouse_code,weight_basis,tol_min_pct,tol_max_pct,tol_min_qty,tol_max_qty,from_location_name,to_location_name,incoterm_name,invoice_method,description,comment,line_type,line_product_code,origin,line_quantity,line_unit_code,line_price,line_description,line_from_del,line_to_del,pricing_trigger,pricing_estimated_date,trader,operator,concentration,book,strategy,period_at,demurrage,laytime_hours,nor_extra_hours,pumping_rate,use_only_min_max,drop_remaining_quantity,,,,,,,,
|
||||||
d5499f8c-8623-4c97-ade2-186e34dd1f31,d5499f8c-8623-4c97-ade2-186e34dd1f31,2172,25030D,S25.022,SUMITOMO CORPORATION THAILAND LTD.,USD,3/3/2026,NET ,,NCSW,0,0,598.977,598.977,Naoshima,Samut Prakan,CFR,manual,,2172 / H2SO4 FY 2025 / Thailand FY25,line,JP-H2SO4,Japan,598.98,Mt,130.32,598.977 Mt of sulphuric acid - Tel-quel,3/13/2026,3/22/2026,bldate,3/13/2026,Stephane Monnard, ,0,H2SO4 FY 2025,Thailand FY25,Laycan,,0,6,250,TRUE,FALSE
|
4D63D146-99BF-4AC8-8967-93183E7D1649,4D63D146-99BF-4AC8-8967-93183E7D1649,2194,25036B,S26.014,"INTERACID NORTH AMERICA, INC (Stockton)",USD,4/14/2026,NET 30,,NCSW,10,10,9000,11000,Saganoseki,Santa Rosalia,CFR,manual,,2194 / H2SO4 FY 2026 / Default,line,JP-H2SO4,Japan,10000,Mt,138.5,10000 Mt of sulphuric acid - Tel-quel,5/13/2026,5/27/2026,bldate,5/13/2026,Stephane Monnard, ,0,H2SO4 FY 2026,Default,Laycan,,0,6,350,0,0,,,,,,,,
|
||||||
40ccc41f-157d-40a2-9a76-60aa220e33e1,40ccc41f-157d-40a2-9a76-60aa220e33e1,2176,25030E,S25.022,SUMITOMO CORPORATION THAILAND LTD.,USD,3/11/2026,NET 30,,NCSW,0,0,401.023,401.023,Naoshima,Samut Prakan,CFR,manual,,2176 / H2SO4 FY 2025 / Thailand FY25,line,JP-H2SO4,Japan,401.02,Mt,130.32,401.023 Mt of sulphuric acid - Tel-quel,3/13/2026,3/22/2026,bldate,3/13/2026,Stephane Monnard, ,0,H2SO4 FY 2025,Thailand FY25,Laycan,,0,6,250,TRUE,FALSE
|
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||||
eefcd785-af5b-4212-8b1f-a448e946c443,eefcd785-af5b-4212-8b1f-a448e946c443,2178,25030F,S25.022,SUMITOMO CORPORATION THAILAND LTD.,USD,3/12/2026,NET 30,,NCSW,0,0,800,800,Naoshima,Samut Prakan,CFR,manual,,2178 / H2SO4 FY 2025 / Thailand FY25,line,JP-H2SO4,Japan,800,Mt,125.77,800 Mt of sulphuric acid - Tel-quel,3/13/2026,3/22/2026,bldate,3/13/2026,Stephane Monnard, ,0,H2SO4 FY 2025,Thailand FY25,Laycan,,0,6,250,TRUE,FALSE
|
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||||
|
|||||||
|
@@ -0,0 +1,179 @@
|
|||||||
|
import sys
|
||||||
|
import csv
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Add parent directory to Python path so we can import helpers
|
||||||
|
parent_dir = Path(__file__).parent.parent
|
||||||
|
sys.path.insert(0, str(parent_dir))
|
||||||
|
|
||||||
|
from helpers.config import get_db_connection
|
||||||
|
|
||||||
|
CSV_PATH = parent_dir / "loaders" / "Contract_Update.csv"
|
||||||
|
|
||||||
|
|
||||||
|
def check_contract_number_format(cur):
|
||||||
|
"""Show sample contract numbers from DB to confirm expected format."""
|
||||||
|
cur.execute("SELECT number FROM purchase_purchase ORDER BY id LIMIT 3")
|
||||||
|
pur_samples = [r[0] for r in cur.fetchall()]
|
||||||
|
cur.execute("SELECT number FROM sale_sale ORDER BY id LIMIT 3")
|
||||||
|
sale_samples = [r[0] for r in cur.fetchall()]
|
||||||
|
print(f" Sample purchase numbers : {pur_samples}")
|
||||||
|
print(f" Sample sale numbers : {sale_samples}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
def update_estimated_bl_dates(dry_run=False):
|
||||||
|
conn = get_db_connection()
|
||||||
|
cur = conn.cursor()
|
||||||
|
|
||||||
|
print("=== Contract BL Date Update ===")
|
||||||
|
print(f"CSV : {CSV_PATH}")
|
||||||
|
print(f"Mode : {'DRY RUN (no changes will be saved)' if dry_run else 'LIVE UPDATE'}\n")
|
||||||
|
|
||||||
|
print("DB contract number format check:")
|
||||||
|
check_contract_number_format(cur)
|
||||||
|
|
||||||
|
# Read CSV
|
||||||
|
rows = []
|
||||||
|
with open(CSV_PATH, newline="", encoding="utf-8") as f:
|
||||||
|
reader = csv.DictReader(f)
|
||||||
|
for row in reader:
|
||||||
|
contract_type = row["ContractType"].strip().upper()
|
||||||
|
contract_number = row["ContractNumber"].strip()
|
||||||
|
bl_date = row["EstimatedBlDate"].strip()
|
||||||
|
if contract_type and contract_number and bl_date:
|
||||||
|
rows.append((contract_type, contract_number, bl_date))
|
||||||
|
|
||||||
|
print(f"Rows loaded from CSV: {len(rows)}\n")
|
||||||
|
|
||||||
|
updated_count = 0
|
||||||
|
skipped_count = 0
|
||||||
|
not_found_count = 0
|
||||||
|
|
||||||
|
for contract_type, contract_number, bl_date in rows:
|
||||||
|
|
||||||
|
if contract_type == "P":
|
||||||
|
# Resolve purchase_line IDs for this purchase number
|
||||||
|
# Try both raw number (e.g. "2086") and P- prefix (e.g. "P-2086")
|
||||||
|
cur.execute(
|
||||||
|
"""
|
||||||
|
SELECT pl.id
|
||||||
|
FROM purchase_line pl
|
||||||
|
JOIN purchase_purchase pp ON pp.id = pl.purchase
|
||||||
|
WHERE pp.number IN (%s, %s)
|
||||||
|
AND pl.type = 'line'
|
||||||
|
ORDER BY pl.id
|
||||||
|
""",
|
||||||
|
(contract_number, f"P-{contract_number}"),
|
||||||
|
)
|
||||||
|
line_ids = [r[0] for r in cur.fetchall()]
|
||||||
|
|
||||||
|
if not line_ids:
|
||||||
|
print(f" [NOT FOUND] Purchase {contract_number} — no matching purchase_line rows")
|
||||||
|
not_found_count += 1
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Update pricing_estimated rows linked to those lines with trigger = bldate
|
||||||
|
cur.execute(
|
||||||
|
"""
|
||||||
|
UPDATE pricing_estimated
|
||||||
|
SET estimated_date = %s,
|
||||||
|
write_date = NOW(),
|
||||||
|
write_uid = 1
|
||||||
|
WHERE line = ANY(%s)
|
||||||
|
AND trigger = 'bldate'
|
||||||
|
RETURNING id, line, estimated_date
|
||||||
|
""",
|
||||||
|
(bl_date, line_ids),
|
||||||
|
)
|
||||||
|
updated_rows = cur.fetchall()
|
||||||
|
|
||||||
|
if updated_rows:
|
||||||
|
for pe_id, line_id, new_date in updated_rows:
|
||||||
|
print(
|
||||||
|
f" [{'DRY' if dry_run else 'OK '}] Purchase {contract_number}"
|
||||||
|
f" | purchase_line={line_id} | pricing_estimated.id={pe_id}"
|
||||||
|
f" | estimated_date -> {new_date}"
|
||||||
|
)
|
||||||
|
updated_count += len(updated_rows)
|
||||||
|
else:
|
||||||
|
print(
|
||||||
|
f" [SKIP] Purchase {contract_number} — lines {line_ids} found"
|
||||||
|
f" but no pricing_estimated row with trigger='bldate'"
|
||||||
|
)
|
||||||
|
skipped_count += 1
|
||||||
|
|
||||||
|
elif contract_type == "S":
|
||||||
|
# Resolve sale_line IDs for this sale number
|
||||||
|
# Try both raw number (e.g. "2086") and S- prefix (e.g. "S-2086")
|
||||||
|
cur.execute(
|
||||||
|
"""
|
||||||
|
SELECT sl.id
|
||||||
|
FROM sale_line sl
|
||||||
|
JOIN sale_sale ss ON ss.id = sl.sale
|
||||||
|
WHERE ss.number IN (%s, %s)
|
||||||
|
AND sl.type = 'line'
|
||||||
|
ORDER BY sl.id
|
||||||
|
""",
|
||||||
|
(contract_number, f"S-{contract_number}"),
|
||||||
|
)
|
||||||
|
line_ids = [r[0] for r in cur.fetchall()]
|
||||||
|
|
||||||
|
if not line_ids:
|
||||||
|
print(f" [NOT FOUND] Sale {contract_number} — no matching sale_line rows")
|
||||||
|
not_found_count += 1
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Update pricing_estimated rows linked to those sale lines with trigger = bldate
|
||||||
|
cur.execute(
|
||||||
|
"""
|
||||||
|
UPDATE pricing_estimated
|
||||||
|
SET estimated_date = %s,
|
||||||
|
write_date = NOW(),
|
||||||
|
write_uid = 1
|
||||||
|
WHERE sale_line = ANY(%s)
|
||||||
|
AND trigger = 'bldate'
|
||||||
|
RETURNING id, sale_line, estimated_date
|
||||||
|
""",
|
||||||
|
(bl_date, line_ids),
|
||||||
|
)
|
||||||
|
updated_rows = cur.fetchall()
|
||||||
|
|
||||||
|
if updated_rows:
|
||||||
|
for pe_id, sale_line_id, new_date in updated_rows:
|
||||||
|
print(
|
||||||
|
f" [{'DRY' if dry_run else 'OK '}] Sale {contract_number}"
|
||||||
|
f" | sale_line={sale_line_id} | pricing_estimated.id={pe_id}"
|
||||||
|
f" | estimated_date -> {new_date}"
|
||||||
|
)
|
||||||
|
updated_count += len(updated_rows)
|
||||||
|
else:
|
||||||
|
print(
|
||||||
|
f" [SKIP] Sale {contract_number} — lines {line_ids} found"
|
||||||
|
f" but no pricing_estimated row with trigger='bldate'"
|
||||||
|
)
|
||||||
|
skipped_count += 1
|
||||||
|
|
||||||
|
else:
|
||||||
|
print(f" [WARN] Unknown ContractType '{contract_type}' for contract {contract_number} — skipped")
|
||||||
|
skipped_count += 1
|
||||||
|
|
||||||
|
print("\n--- Summary ---")
|
||||||
|
print(f" Updated : {updated_count} pricing_estimated rows")
|
||||||
|
print(f" Skipped : {skipped_count} contracts (no bldate row in pricing_estimated)")
|
||||||
|
print(f" Not found: {not_found_count} contracts (contract number not in DB)")
|
||||||
|
|
||||||
|
if dry_run:
|
||||||
|
conn.rollback()
|
||||||
|
print("\nDry run — all changes rolled back, nothing saved.")
|
||||||
|
else:
|
||||||
|
conn.commit()
|
||||||
|
print("\nAll changes committed to database.")
|
||||||
|
|
||||||
|
cur.close()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
dry_run = "--dry-run" in sys.argv
|
||||||
|
update_estimated_bl_dates(dry_run=dry_run)
|
||||||
89
SQL/Contracts with MTM info.sql
Normal file
89
SQL/Contracts with MTM info.sql
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
-- Contracts with an MtM strategy, pricing_component details, and latest valuation snapshot
|
||||||
|
SELECT
|
||||||
|
'Purchase' AS side,
|
||||||
|
pp.number AS contract,
|
||||||
|
pl.quantity AS contracted_qty,
|
||||||
|
ms.name AS strategy_name,
|
||||||
|
msc.name AS scenario_name,
|
||||||
|
msc.valuation_date,
|
||||||
|
msc.use_last_price,
|
||||||
|
cur.symbol AS strategy_currency,
|
||||||
|
-- MtM component (pricing_component linked via strategy)
|
||||||
|
pc_mtm.price_source_type AS component_price_source,
|
||||||
|
pc_mtm.ratio AS component_ratio_pct,
|
||||||
|
ft.name AS component_fix_type,
|
||||||
|
pi.price_desc AS component_curve,
|
||||||
|
pc_cal.name AS component_calendar,
|
||||||
|
pc_mtm.auto AS component_auto,
|
||||||
|
pc_mtm.fallback AS component_fallback,
|
||||||
|
-- Latest valuation (physical price row)
|
||||||
|
vv.date AS last_valuation_date,
|
||||||
|
vv.price AS last_valuation_price,
|
||||||
|
vv.quantity AS last_valuation_qty,
|
||||||
|
vv.amount AS last_valuation_amount,
|
||||||
|
vv.mtm AS portfolio_mtm
|
||||||
|
FROM purchase_strategy ps
|
||||||
|
JOIN purchase_line pl ON pl.id = ps.line
|
||||||
|
JOIN purchase_purchase pp ON pp.id = pl.purchase
|
||||||
|
JOIN mtm_strategy ms ON ms.id = ps.strategy
|
||||||
|
JOIN mtm_scenario msc ON msc.id = ms.scenario
|
||||||
|
JOIN currency_currency cur ON cur.id = ms.currency
|
||||||
|
LEFT JOIN pricing_component pc_mtm ON pc_mtm.strategy = ms.id
|
||||||
|
LEFT JOIN price_fixtype ft ON ft.id = pc_mtm.fix_type
|
||||||
|
LEFT JOIN price_price pi ON pi.id = pc_mtm.price_index
|
||||||
|
LEFT JOIN price_calendar pc_cal ON pc_cal.id = pc_mtm.calendar
|
||||||
|
LEFT JOIN LATERAL (
|
||||||
|
SELECT date, price, quantity, amount, mtm
|
||||||
|
FROM valuation_valuation
|
||||||
|
WHERE line = pl.id
|
||||||
|
AND type = 'pur. priced'
|
||||||
|
AND reference = 'Purchase/Physic'
|
||||||
|
ORDER BY date DESC
|
||||||
|
LIMIT 1
|
||||||
|
) vv ON TRUE
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
'Sale',
|
||||||
|
ss.number,
|
||||||
|
sl.quantity,
|
||||||
|
ms.name,
|
||||||
|
msc.name,
|
||||||
|
msc.valuation_date,
|
||||||
|
msc.use_last_price,
|
||||||
|
cur.symbol,
|
||||||
|
pc_mtm.price_source_type,
|
||||||
|
pc_mtm.ratio,
|
||||||
|
ft.name,
|
||||||
|
pi.price_desc,
|
||||||
|
pc_cal.name,
|
||||||
|
pc_mtm.auto,
|
||||||
|
pc_mtm.fallback,
|
||||||
|
vv.date,
|
||||||
|
vv.price,
|
||||||
|
vv.quantity,
|
||||||
|
vv.amount,
|
||||||
|
vv.mtm
|
||||||
|
FROM sale_strategy sa
|
||||||
|
JOIN sale_line sl ON sl.id = sa.sale_line
|
||||||
|
JOIN sale_sale ss ON ss.id = sl.sale
|
||||||
|
JOIN mtm_strategy ms ON ms.id = sa.strategy
|
||||||
|
JOIN mtm_scenario msc ON msc.id = ms.scenario
|
||||||
|
JOIN currency_currency cur ON cur.id = ms.currency
|
||||||
|
LEFT JOIN pricing_component pc_mtm ON pc_mtm.strategy = ms.id
|
||||||
|
LEFT JOIN price_fixtype ft ON ft.id = pc_mtm.fix_type
|
||||||
|
LEFT JOIN price_price pi ON pi.id = pc_mtm.price_index
|
||||||
|
LEFT JOIN price_calendar pc_cal ON pc_cal.id = pc_mtm.calendar
|
||||||
|
LEFT JOIN LATERAL (
|
||||||
|
SELECT date, price, quantity, amount, mtm
|
||||||
|
FROM valuation_valuation
|
||||||
|
WHERE line = sl.id
|
||||||
|
AND type = 'sale priced'
|
||||||
|
AND reference = 'Sale/Physic'
|
||||||
|
ORDER BY date DESC
|
||||||
|
LIMIT 1
|
||||||
|
) vv ON TRUE
|
||||||
|
|
||||||
|
ORDER BY side, contract;
|
||||||
|
|
||||||
3
SQL/Delete price_price_value after 2026-04-09.sql
Normal file
3
SQL/Delete price_price_value after 2026-04-09.sql
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
DELETE FROM "public"."price_price_value"
|
||||||
|
WHERE "price_date" > '2026-04-09'
|
||||||
|
AND "active" = true;
|
||||||
450
SQL/Risk Management.sql
Normal file
450
SQL/Risk Management.sql
Normal file
@@ -0,0 +1,450 @@
|
|||||||
|
|
||||||
|
|
||||||
|
-- This shows where each lot currently stands across the full chain
|
||||||
|
SELECT
|
||||||
|
pp.name AS supplier,
|
||||||
|
pur.number AS purchase_contract,
|
||||||
|
pur.state AS contract_state,
|
||||||
|
si.number AS shipment,
|
||||||
|
si.state AS shipment_state,
|
||||||
|
pur.invoice_state AS invoice_state,
|
||||||
|
COUNT(l.id) AS lots,
|
||||||
|
SUM(l.lot_qt) AS quantity
|
||||||
|
FROM lot_lot l
|
||||||
|
LEFT JOIN stock_shipment_in si ON si.id = l.lot_shipment_in
|
||||||
|
LEFT JOIN purchase_line pl ON pl.id = l.line
|
||||||
|
LEFT JOIN purchase_purchase pur ON pur.id = pl.purchase
|
||||||
|
LEFT JOIN party_party pp ON pp.id = pur.party
|
||||||
|
GROUP BY pp.name, pur.number, pur.state, si.number, si.state, pur.invoice_state
|
||||||
|
ORDER BY pp.name, pur.number;
|
||||||
|
|
||||||
|
-- This shows the details of each lot that is still in draft shipment, to see where they are in the chain and what is missing
|
||||||
|
SELECT
|
||||||
|
pp.name AS supplier,
|
||||||
|
prod.name AS product,
|
||||||
|
pur.number AS purchase_contract,
|
||||||
|
si.number AS shipment_number,
|
||||||
|
tv.vessel_name AS vessel,
|
||||||
|
si.planned_date,
|
||||||
|
si.eta,
|
||||||
|
si.etd,
|
||||||
|
si.cargo_mode,
|
||||||
|
si.transport_type,
|
||||||
|
si.bl_number,
|
||||||
|
l.id AS lot_id,
|
||||||
|
pl.quantity AS contracted_qty,
|
||||||
|
u.name AS unit,
|
||||||
|
pl.unit_price,
|
||||||
|
cur.code AS currency,
|
||||||
|
pl.price_type,
|
||||||
|
l.lot_pur_inv_state,
|
||||||
|
l.lot_sale_inv_state
|
||||||
|
FROM lot_lot l
|
||||||
|
JOIN stock_shipment_in si ON si.id = l.lot_shipment_in
|
||||||
|
JOIN purchase_line pl ON pl.id = l.line
|
||||||
|
JOIN purchase_purchase pur ON pur.id = pl.purchase
|
||||||
|
JOIN party_party pp ON pp.id = pur.party
|
||||||
|
JOIN product_product prd ON prd.id = l.lot_product
|
||||||
|
JOIN product_template prod ON prod.id = prd.template
|
||||||
|
JOIN currency_currency cur ON cur.id = pur.currency
|
||||||
|
LEFT JOIN product_uom u ON u.id = pl.unit
|
||||||
|
LEFT JOIN trade_vessel tv ON tv.id = si.vessel
|
||||||
|
WHERE si.state = 'draft'
|
||||||
|
ORDER BY si.planned_date, pp.name, si.number, l.id;
|
||||||
|
|
||||||
|
-- This shows all the contracts that are fixed price
|
||||||
|
SELECT
|
||||||
|
'Purchase' AS side,
|
||||||
|
pur.number AS contract,
|
||||||
|
pur.state AS contract_state,
|
||||||
|
pp.name AS counterparty,
|
||||||
|
prod.name AS product,
|
||||||
|
pl.from_del,
|
||||||
|
pl.to_del,
|
||||||
|
pl.quantity AS contracted_qty,
|
||||||
|
u.name AS unit,
|
||||||
|
pl.unit_price AS fixed_price,
|
||||||
|
cur.code AS currency
|
||||||
|
FROM purchase_line pl
|
||||||
|
JOIN purchase_purchase pur ON pur.id = pl.purchase
|
||||||
|
JOIN party_party pp ON pp.id = pur.party
|
||||||
|
JOIN product_product prd ON prd.id = pl.product
|
||||||
|
JOIN product_template prod ON prod.id = prd.template
|
||||||
|
JOIN currency_currency cur ON cur.id = pur.currency
|
||||||
|
LEFT JOIN product_uom u ON u.id = pl.unit
|
||||||
|
WHERE pl.type = 'line' AND pl.price_type = 'priced'
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
'Sale' AS side,
|
||||||
|
s.number,
|
||||||
|
s.state,
|
||||||
|
pp.name,
|
||||||
|
prod.name,
|
||||||
|
sl.from_del,
|
||||||
|
sl.to_del,
|
||||||
|
sl.quantity,
|
||||||
|
u.name,
|
||||||
|
sl.unit_price,
|
||||||
|
cur.code
|
||||||
|
FROM sale_line sl
|
||||||
|
JOIN sale_sale s ON s.id = sl.sale
|
||||||
|
JOIN party_party pp ON pp.id = s.party
|
||||||
|
JOIN product_product prd ON prd.id = sl.product
|
||||||
|
JOIN product_template prod ON prod.id = prd.template
|
||||||
|
JOIN currency_currency cur ON cur.id = s.currency
|
||||||
|
LEFT JOIN product_uom u ON u.id = sl.unit
|
||||||
|
WHERE sl.type = 'line' AND sl.price_type = 'priced'
|
||||||
|
ORDER BY side, contract;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
WITH
|
||||||
|
|
||||||
|
-- Last fixation state per purchase line
|
||||||
|
pur_fix AS (
|
||||||
|
SELECT DISTINCT ON (line)
|
||||||
|
line,
|
||||||
|
fixed_qt,
|
||||||
|
fixed_qt_price,
|
||||||
|
unfixed_qt,
|
||||||
|
unfixed_qt_price AS unfixed_price
|
||||||
|
FROM pricing_pricing
|
||||||
|
WHERE line IS NOT NULL
|
||||||
|
ORDER BY line, last DESC NULLS LAST, pricing_date DESC
|
||||||
|
),
|
||||||
|
|
||||||
|
-- Last fixation state per sale line ← mirrors pur_fix exactly
|
||||||
|
sale_fix AS (
|
||||||
|
SELECT DISTINCT ON (sale_line)
|
||||||
|
sale_line,
|
||||||
|
fixed_qt,
|
||||||
|
fixed_qt_price,
|
||||||
|
unfixed_qt,
|
||||||
|
unfixed_qt_price AS unfixed_price
|
||||||
|
FROM pricing_pricing
|
||||||
|
WHERE sale_line IS NOT NULL
|
||||||
|
ORDER BY sale_line, last DESC NULLS LAST, pricing_date DESC
|
||||||
|
),
|
||||||
|
|
||||||
|
-- Most recent market price per price index
|
||||||
|
last_mkt AS (
|
||||||
|
SELECT DISTINCT ON (price)
|
||||||
|
price AS price_index_id,
|
||||||
|
price_date AS last_market_date,
|
||||||
|
price_value AS last_market_price
|
||||||
|
FROM price_price_value
|
||||||
|
ORDER BY price, price_date DESC
|
||||||
|
),
|
||||||
|
|
||||||
|
-- Next scheduled fixing date per purchase line
|
||||||
|
pur_next_fix AS (
|
||||||
|
SELECT DISTINCT ON (line)
|
||||||
|
line,
|
||||||
|
estimated_date AS next_fixing_date,
|
||||||
|
trigger AS fixing_trigger
|
||||||
|
FROM pricing_estimated
|
||||||
|
WHERE line IS NOT NULL
|
||||||
|
AND estimated_date >= CURRENT_DATE
|
||||||
|
ORDER BY line, estimated_date ASC
|
||||||
|
),
|
||||||
|
|
||||||
|
-- Next scheduled fixing date per sale line
|
||||||
|
sale_next_fix AS (
|
||||||
|
SELECT DISTINCT ON (sale_line)
|
||||||
|
sale_line,
|
||||||
|
estimated_date AS next_fixing_date,
|
||||||
|
trigger AS fixing_trigger
|
||||||
|
FROM pricing_estimated
|
||||||
|
WHERE sale_line IS NOT NULL
|
||||||
|
AND estimated_date >= CURRENT_DATE
|
||||||
|
ORDER BY sale_line, estimated_date ASC
|
||||||
|
)
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
'Purchase' AS side,
|
||||||
|
pur.number AS contract,
|
||||||
|
pur.state AS contract_state,
|
||||||
|
pp.name AS counterparty,
|
||||||
|
prod.name AS product,
|
||||||
|
pl.from_del,
|
||||||
|
pl.to_del,
|
||||||
|
pl.quantity AS contracted_qty,
|
||||||
|
u.name AS unit,
|
||||||
|
cur.symbol AS currency,
|
||||||
|
pi2.price_desc AS price_index,
|
||||||
|
nf.fixing_trigger,
|
||||||
|
nf.next_fixing_date,
|
||||||
|
COALESCE(pf.fixed_qt, 0) AS fixed_qty,
|
||||||
|
COALESCE(pf.fixed_qt_price, 0) AS avg_fixed_price,
|
||||||
|
pl.quantity - COALESCE(pf.fixed_qt, 0) AS unfixed_qty,
|
||||||
|
COALESCE(lm.last_market_price, pf.unfixed_price) AS unfixed_market_price,
|
||||||
|
lm.last_market_date,
|
||||||
|
lm.last_market_price
|
||||||
|
|
||||||
|
FROM purchase_line pl
|
||||||
|
JOIN purchase_purchase pur ON pur.id = pl.purchase
|
||||||
|
JOIN party_party pp ON pp.id = pur.party
|
||||||
|
JOIN product_product prd ON prd.id = pl.product
|
||||||
|
JOIN product_template prod ON prod.id = prd.template
|
||||||
|
JOIN currency_currency cur ON cur.id = pur.currency
|
||||||
|
LEFT JOIN product_uom u ON u.id = pl.unit
|
||||||
|
LEFT JOIN pricing_component pc ON pc.line = pl.id
|
||||||
|
LEFT JOIN price_price pi2 ON pi2.id = pc.price_index
|
||||||
|
LEFT JOIN last_mkt lm ON lm.price_index_id = pc.price_index
|
||||||
|
LEFT JOIN pur_fix pf ON pf.line = pl.id
|
||||||
|
LEFT JOIN pur_next_fix nf ON nf.line = pl.id
|
||||||
|
WHERE pl.type = 'line' AND pl.price_type = 'basis'
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
'Sale' AS side,
|
||||||
|
s.number,
|
||||||
|
s.state,
|
||||||
|
pp.name,
|
||||||
|
prod.name,
|
||||||
|
sl.from_del,
|
||||||
|
sl.to_del,
|
||||||
|
sl.quantity,
|
||||||
|
u.name,
|
||||||
|
cur.symbol,
|
||||||
|
pi2.price_desc,
|
||||||
|
nf.fixing_trigger,
|
||||||
|
nf.next_fixing_date,
|
||||||
|
COALESCE(sf.fixed_qt, 0) AS fixed_qty,
|
||||||
|
COALESCE(sf.fixed_qt_price, 0) AS avg_fixed_price,
|
||||||
|
sl.quantity - COALESCE(sf.fixed_qt, 0) AS unfixed_qty,
|
||||||
|
COALESCE(lm.last_market_price, sf.unfixed_price) AS unfixed_market_price,
|
||||||
|
lm.last_market_date,
|
||||||
|
lm.last_market_price
|
||||||
|
|
||||||
|
FROM sale_line sl
|
||||||
|
JOIN sale_sale s ON s.id = sl.sale
|
||||||
|
JOIN party_party pp ON pp.id = s.party
|
||||||
|
JOIN product_product prd ON prd.id = sl.product
|
||||||
|
JOIN product_template prod ON prod.id = prd.template
|
||||||
|
JOIN currency_currency cur ON cur.id = s.currency
|
||||||
|
LEFT JOIN product_uom u ON u.id = sl.unit
|
||||||
|
LEFT JOIN pricing_component pc ON pc.sale_line = sl.id
|
||||||
|
LEFT JOIN price_price pi2 ON pi2.id = pc.price_index
|
||||||
|
LEFT JOIN last_mkt lm ON lm.price_index_id = pc.price_index
|
||||||
|
LEFT JOIN sale_fix sf ON sf.sale_line = sl.id
|
||||||
|
LEFT JOIN sale_next_fix nf ON nf.sale_line = sl.id
|
||||||
|
WHERE sl.type = 'line' AND sl.price_type = 'basis'
|
||||||
|
|
||||||
|
ORDER BY side, contract;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- MtM strategy, component details, and last valuation per contract (purchase and sale)
|
||||||
|
-- Columns:
|
||||||
|
-- strategy_name / scenario_name / valuation_date → MtM setup header
|
||||||
|
-- component_* → from pricing_component linked via strategy (MtM strategy-level components)
|
||||||
|
-- pricing_* → from pricing_component linked via line/sale_line (contract fixation setup)
|
||||||
|
-- vv_* → latest snapshot from valuation_valuation (price = contract price, amount = contract value)
|
||||||
|
-- vvl_* → current state from valuation_valuation_line (same structure, always most recent)
|
||||||
|
WITH
|
||||||
|
|
||||||
|
-- Latest valuation_valuation row per purchase line (physical price row only)
|
||||||
|
last_vv_pur AS (
|
||||||
|
SELECT DISTINCT ON (line)
|
||||||
|
line,
|
||||||
|
date AS vv_date,
|
||||||
|
price AS vv_price,
|
||||||
|
quantity AS vv_quantity,
|
||||||
|
amount AS vv_amount,
|
||||||
|
base_amount AS vv_base_amount,
|
||||||
|
rate AS vv_rate
|
||||||
|
FROM valuation_valuation
|
||||||
|
WHERE line IS NOT NULL
|
||||||
|
AND type = 'pur. priced'
|
||||||
|
AND reference = 'Purchase/Physic'
|
||||||
|
ORDER BY line, date DESC
|
||||||
|
),
|
||||||
|
|
||||||
|
-- Latest valuation_valuation row per sale line
|
||||||
|
last_vv_sale AS (
|
||||||
|
SELECT DISTINCT ON (sale_line)
|
||||||
|
sale_line,
|
||||||
|
date AS vv_date,
|
||||||
|
price AS vv_price,
|
||||||
|
quantity AS vv_quantity,
|
||||||
|
amount AS vv_amount,
|
||||||
|
base_amount AS vv_base_amount,
|
||||||
|
rate AS vv_rate
|
||||||
|
FROM valuation_valuation
|
||||||
|
WHERE sale_line IS NOT NULL
|
||||||
|
AND type = 'sale priced'
|
||||||
|
AND reference = 'Sale/Physic'
|
||||||
|
ORDER BY sale_line, date DESC
|
||||||
|
),
|
||||||
|
|
||||||
|
-- valuation_valuation_line per purchase line (current state)
|
||||||
|
last_vvl_pur AS (
|
||||||
|
SELECT DISTINCT ON (line)
|
||||||
|
line,
|
||||||
|
date AS vvl_date,
|
||||||
|
price AS vvl_price,
|
||||||
|
quantity AS vvl_quantity,
|
||||||
|
amount AS vvl_amount,
|
||||||
|
base_amount AS vvl_base_amount,
|
||||||
|
rate AS vvl_rate
|
||||||
|
FROM valuation_valuation_line
|
||||||
|
WHERE line IS NOT NULL
|
||||||
|
AND type = 'pur. priced'
|
||||||
|
AND reference = 'Purchase/Physic'
|
||||||
|
ORDER BY line, date DESC
|
||||||
|
),
|
||||||
|
|
||||||
|
-- valuation_valuation_line per sale line (current state)
|
||||||
|
last_vvl_sale AS (
|
||||||
|
SELECT DISTINCT ON (sale_line)
|
||||||
|
sale_line,
|
||||||
|
date AS vvl_date,
|
||||||
|
price AS vvl_price,
|
||||||
|
quantity AS vvl_quantity,
|
||||||
|
amount AS vvl_amount,
|
||||||
|
base_amount AS vvl_base_amount,
|
||||||
|
rate AS vvl_rate
|
||||||
|
FROM valuation_valuation_line
|
||||||
|
WHERE sale_line IS NOT NULL
|
||||||
|
AND type = 'sale priced'
|
||||||
|
AND reference = 'Sale/Physic'
|
||||||
|
ORDER BY sale_line, date DESC
|
||||||
|
)
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
'Purchase' AS side,
|
||||||
|
pur.number AS contract,
|
||||||
|
pur.state AS contract_state,
|
||||||
|
pp.name AS counterparty,
|
||||||
|
prod.name AS product,
|
||||||
|
pl.from_del,
|
||||||
|
pl.to_del,
|
||||||
|
pl.quantity AS contracted_qty,
|
||||||
|
u.name AS unit,
|
||||||
|
-- Strategy
|
||||||
|
ms.name AS strategy_name,
|
||||||
|
ms_cur.symbol AS strategy_currency,
|
||||||
|
-- Scenario
|
||||||
|
msc.name AS scenario_name,
|
||||||
|
msc.valuation_date,
|
||||||
|
msc.use_last_price,
|
||||||
|
cal.name AS scenario_calendar,
|
||||||
|
-- MtM component (pricing_component linked via strategy)
|
||||||
|
pc_mtm.price_source_type AS component_price_source,
|
||||||
|
pc_mtm.ratio AS component_ratio_pct,
|
||||||
|
ft.name AS component_fix_type,
|
||||||
|
pi2.price_desc AS component_curve,
|
||||||
|
pc_mtm_cal.name AS component_calendar,
|
||||||
|
pc_mtm.auto AS component_auto,
|
||||||
|
pc_mtm.fallback AS component_fallback,
|
||||||
|
-- Pricing component (fixation setup — independent of MtM, already populated)
|
||||||
|
pc_idx.price_desc AS pricing_curve,
|
||||||
|
pc_ft.name AS pricing_fix_type,
|
||||||
|
pc.price_source_type AS pricing_source_type,
|
||||||
|
pc.ratio AS pricing_ratio_pct,
|
||||||
|
pc_cal.name AS pricing_calendar,
|
||||||
|
-- Last valuation snapshot (valuation_valuation — most recent run)
|
||||||
|
vv.vv_date AS last_valuation_date,
|
||||||
|
vv.vv_price AS last_valuation_price,
|
||||||
|
vv.vv_quantity AS last_valuation_qty,
|
||||||
|
vv.vv_amount AS last_valuation_amount,
|
||||||
|
vv.vv_base_amount AS last_valuation_base_amount,
|
||||||
|
vv.vv_rate AS last_valuation_rate,
|
||||||
|
-- Current valuation state (valuation_valuation_line — always latest)
|
||||||
|
vvl.vvl_date AS current_valuation_date,
|
||||||
|
vvl.vvl_price AS current_valuation_price,
|
||||||
|
vvl.vvl_quantity AS current_valuation_qty,
|
||||||
|
vvl.vvl_amount AS current_valuation_amount,
|
||||||
|
vvl.vvl_base_amount AS current_valuation_base_amount,
|
||||||
|
vvl.vvl_rate AS current_valuation_rate
|
||||||
|
FROM purchase_strategy ps
|
||||||
|
JOIN purchase_line pl ON pl.id = ps.line
|
||||||
|
JOIN purchase_purchase pur ON pur.id = pl.purchase
|
||||||
|
JOIN party_party pp ON pp.id = pur.party
|
||||||
|
JOIN product_product prd ON prd.id = pl.product
|
||||||
|
JOIN product_template prod ON prod.id = prd.template
|
||||||
|
LEFT JOIN product_uom u ON u.id = pl.unit
|
||||||
|
JOIN mtm_strategy ms ON ms.id = ps.strategy
|
||||||
|
JOIN mtm_scenario msc ON msc.id = ms.scenario
|
||||||
|
LEFT JOIN currency_currency ms_cur ON ms_cur.id = ms.currency
|
||||||
|
LEFT JOIN price_calendar cal ON cal.id = msc.calendar
|
||||||
|
LEFT JOIN pricing_component pc_mtm ON pc_mtm.strategy = ms.id
|
||||||
|
LEFT JOIN price_fixtype ft ON ft.id = pc_mtm.fix_type
|
||||||
|
LEFT JOIN price_price pi2 ON pi2.id = pc_mtm.price_index
|
||||||
|
LEFT JOIN price_calendar pc_mtm_cal ON pc_mtm_cal.id = pc_mtm.calendar
|
||||||
|
LEFT JOIN pricing_component pc ON pc.line = pl.id
|
||||||
|
LEFT JOIN price_price pc_idx ON pc_idx.id = pc.price_index
|
||||||
|
LEFT JOIN price_fixtype pc_ft ON pc_ft.id = pc.fix_type
|
||||||
|
LEFT JOIN price_calendar pc_cal ON pc_cal.id = pc.calendar
|
||||||
|
LEFT JOIN last_vv_pur vv ON vv.line = pl.id
|
||||||
|
LEFT JOIN last_vvl_pur vvl ON vvl.line = pl.id
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
'Sale' AS side,
|
||||||
|
s.number,
|
||||||
|
s.state,
|
||||||
|
pp.name,
|
||||||
|
prod.name,
|
||||||
|
sl.from_del,
|
||||||
|
sl.to_del,
|
||||||
|
sl.quantity,
|
||||||
|
u.name,
|
||||||
|
ms.name,
|
||||||
|
ms_cur.symbol,
|
||||||
|
msc.name,
|
||||||
|
msc.valuation_date,
|
||||||
|
msc.use_last_price,
|
||||||
|
cal.name,
|
||||||
|
pc_mtm.price_source_type,
|
||||||
|
pc_mtm.ratio,
|
||||||
|
ft.name,
|
||||||
|
pi2.price_desc,
|
||||||
|
pc_mtm_cal.name,
|
||||||
|
pc_mtm.auto,
|
||||||
|
pc_mtm.fallback,
|
||||||
|
pc_idx.price_desc,
|
||||||
|
pc_ft.name,
|
||||||
|
pc.price_source_type,
|
||||||
|
pc.ratio,
|
||||||
|
pc_cal.name,
|
||||||
|
vv.vv_date,
|
||||||
|
vv.vv_price,
|
||||||
|
vv.vv_quantity,
|
||||||
|
vv.vv_amount,
|
||||||
|
vv.vv_base_amount,
|
||||||
|
vv.vv_rate,
|
||||||
|
vvl.vvl_date,
|
||||||
|
vvl.vvl_price,
|
||||||
|
vvl.vvl_quantity,
|
||||||
|
vvl.vvl_amount,
|
||||||
|
vvl.vvl_base_amount,
|
||||||
|
vvl.vvl_rate
|
||||||
|
FROM sale_strategy ss
|
||||||
|
JOIN sale_line sl ON sl.id = ss.sale_line
|
||||||
|
JOIN sale_sale s ON s.id = sl.sale
|
||||||
|
JOIN party_party pp ON pp.id = s.party
|
||||||
|
JOIN product_product prd ON prd.id = sl.product
|
||||||
|
JOIN product_template prod ON prod.id = prd.template
|
||||||
|
LEFT JOIN product_uom u ON u.id = sl.unit
|
||||||
|
JOIN mtm_strategy ms ON ms.id = ss.strategy
|
||||||
|
JOIN mtm_scenario msc ON msc.id = ms.scenario
|
||||||
|
LEFT JOIN currency_currency ms_cur ON ms_cur.id = ms.currency
|
||||||
|
LEFT JOIN price_calendar cal ON cal.id = msc.calendar
|
||||||
|
LEFT JOIN pricing_component pc_mtm ON pc_mtm.strategy = ms.id
|
||||||
|
LEFT JOIN price_fixtype ft ON ft.id = pc_mtm.fix_type
|
||||||
|
LEFT JOIN price_price pi2 ON pi2.id = pc_mtm.price_index
|
||||||
|
LEFT JOIN price_calendar pc_mtm_cal ON pc_mtm_cal.id = pc_mtm.calendar
|
||||||
|
LEFT JOIN pricing_component pc ON pc.sale_line = sl.id
|
||||||
|
LEFT JOIN price_price pc_idx ON pc_idx.id = pc.price_index
|
||||||
|
LEFT JOIN price_fixtype pc_ft ON pc_ft.id = pc.fix_type
|
||||||
|
LEFT JOIN price_calendar pc_cal ON pc_cal.id = pc.calendar
|
||||||
|
LEFT JOIN last_vv_sale vv ON vv.sale_line = sl.id
|
||||||
|
LEFT JOIN last_vvl_sale vvl ON vvl.sale_line = sl.id
|
||||||
|
|
||||||
|
ORDER BY side, contract;
|
||||||
101
SQL/Update stock_location country.sql
Normal file
101
SQL/Update stock_location country.sql
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
-- Update stock_location.country based on port/city name identification
|
||||||
|
-- Skipped: root nodes (Customer, Supplier, Warehouse, Drop, Lost and Found),
|
||||||
|
-- generic entries (ANY PORT, To be defined, Transit, Input/Output/Storage Zone),
|
||||||
|
-- ambiguous entries (Limas - geography uncertain)
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 9 WHERE id = 1254; -- Adelaide -> Australia
|
||||||
|
UPDATE stock_location SET country = 9 WHERE id = 1260; -- Gladstone -> Australia
|
||||||
|
UPDATE stock_location SET country = 9 WHERE id = 1276; -- Port Hedland -> Australia
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 17 WHERE id = 1221; -- Antwerpen -> Belgium
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 24 WHERE id = 1278; -- Rio Grande -> Brazil
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 32 WHERE id = 1288; -- Vancouver -> Canada
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 35 WHERE id = 1257; -- Barquito -> Chile
|
||||||
|
UPDATE stock_location SET country = 35 WHERE id = 1272; -- Mejillones -> Chile
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 36 WHERE id = 1225; -- Fangcheng -> China
|
||||||
|
UPDATE stock_location SET country = 36 WHERE id = 1232; -- Laizhou -> China
|
||||||
|
UPDATE stock_location SET country = 36 WHERE id = 1234; -- Longkou -> China
|
||||||
|
UPDATE stock_location SET country = 36 WHERE id = 1237; -- Ningde -> China
|
||||||
|
UPDATE stock_location SET country = 36 WHERE id = 1242; -- Putian -> China
|
||||||
|
UPDATE stock_location SET country = 36 WHERE id = 1243; -- Qingdao -> China
|
||||||
|
UPDATE stock_location SET country = 36 WHERE id = 1244; -- Rizhao -> China
|
||||||
|
UPDATE stock_location SET country = 36 WHERE id = 1246; -- Rugao -> China
|
||||||
|
UPDATE stock_location SET country = 36 WHERE id = 1252; -- YIZHENG -> China
|
||||||
|
UPDATE stock_location SET country = 36 WHERE id = 1253; -- Zhangjiagang -> China
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 59 WHERE id = 1241; -- Pori (Supplier) -> Finland
|
||||||
|
UPDATE stock_location SET country = 59 WHERE id = 1286; -- Pori (Customer) -> Finland
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 60 WHERE id = 1119; -- STORAGE - ROUEN -> France
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 64 WHERE id = 1226; -- Hamburg -> Germany
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 65 WHERE id = 1282; -- Tema -> Ghana
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 76 WHERE id = 1259; -- Budge Budge -> India
|
||||||
|
UPDATE stock_location SET country = 76 WHERE id = 1227; -- Hazira -> India
|
||||||
|
UPDATE stock_location SET country = 76 WHERE id = 1266; -- Kakinada -> India
|
||||||
|
UPDATE stock_location SET country = 76 WHERE id = 1267; -- Kandla -> India
|
||||||
|
UPDATE stock_location SET country = 76 WHERE id = 1273; -- New Mangalore -> India
|
||||||
|
UPDATE stock_location SET country = 76 WHERE id = 1275; -- Paradip -> India
|
||||||
|
UPDATE stock_location SET country = 76 WHERE id = 1283; -- Tuticorin -> India
|
||||||
|
UPDATE stock_location SET country = 76 WHERE id = 1284; -- Visakhapatnam -> India
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 77 WHERE id = 1255; -- BAHODOPI-POSO -> Indonesia
|
||||||
|
UPDATE stock_location SET country = 77 WHERE id = 1262; -- Gresik -> Indonesia
|
||||||
|
UPDATE stock_location SET country = 77 WHERE id = 1269; -- LHOKSEUMAWE -> Indonesia
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 84 WHERE id = 1228; -- Hibi -> Japan
|
||||||
|
UPDATE stock_location SET country = 84 WHERE id = 1231; -- Japan -> Japan
|
||||||
|
UPDATE stock_location SET country = 84 WHERE id = 1235; -- Naoshima -> Japan
|
||||||
|
UPDATE stock_location SET country = 84 WHERE id = 1236; -- Niihama -> Japan
|
||||||
|
UPDATE stock_location SET country = 84 WHERE id = 1239; -- Onahama -> Japan
|
||||||
|
UPDATE stock_location SET country = 84 WHERE id = 1247; -- Saganoseki -> Japan
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 102 WHERE id = 1116; -- PORT KELANG FREE ZONE -> Malaysia
|
||||||
|
UPDATE stock_location SET country = 102 WHERE id = 1115; -- STORAGE - PORT KELANG -> Malaysia
|
||||||
|
UPDATE stock_location SET country = 102 WHERE id = 1268; -- Kemaman -> Malaysia
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 109 WHERE id = 1233; -- Lazaro Cardenas -> Mexico
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 115 WHERE id = 1265; -- Jorf Lasfar -> Morocco
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 128 WHERE id = 1238; -- Odda -> Norway
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 135 WHERE id = 1223; -- Callao -> Peru
|
||||||
|
UPDATE stock_location SET country = 135 WHERE id = 1230; -- Ilo -> Peru
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 136 WHERE id = 1264; -- Isabel -> Philippines
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 149 WHERE id = 1277; -- Ras Al Khair -> Saudi Arabia
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 160 WHERE id = 1224; -- Donghae -> South Korea
|
||||||
|
UPDATE stock_location SET country = 160 WHERE id = 1240; -- Onsan -> South Korea
|
||||||
|
UPDATE stock_location SET country = 160 WHERE id = 1250; -- Ulsan -> South Korea
|
||||||
|
UPDATE stock_location SET country = 160 WHERE id = 1251; -- Yeosu -> South Korea
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 162 WHERE id = 1229; -- Huelva -> Spain
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 166 WHERE id = 1245; -- Ronnskar -> Sweden
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 169 WHERE id = 1248; -- Taichung -> Taiwan
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 172 WHERE id = 1256; -- Bangkok -> Thailand
|
||||||
|
UPDATE stock_location SET country = 172 WHERE id = 1271; -- Map Ta Phut -> Thailand
|
||||||
|
UPDATE stock_location SET country = 172 WHERE id = 1279; -- Samut Prakan -> Thailand
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 177 WHERE id = 1222; -- Bandirma -> Turkey
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 184 WHERE id = 1258; -- Beaumont -> United States
|
||||||
|
UPDATE stock_location SET country = 184 WHERE id = 1274; -- New Orleans -> United States
|
||||||
|
UPDATE stock_location SET country = 184 WHERE id = 1280; -- San Juan -> United States (Puerto Rico)
|
||||||
|
UPDATE stock_location SET country = 184 WHERE id = 1281; -- Stockton -> United States
|
||||||
|
UPDATE stock_location SET country = 184 WHERE id = 1249; -- Tampa (Customer) -> United States
|
||||||
|
UPDATE stock_location SET country = 184 WHERE id = 1285; -- Tampa (Supplier) -> United States
|
||||||
|
|
||||||
|
UPDATE stock_location SET country = 189 WHERE id = 1261; -- Go Dau -> Vietnam
|
||||||
|
UPDATE stock_location SET country = 189 WHERE id = 1263; -- Hai Phong -> Vietnam
|
||||||
Reference in New Issue
Block a user