1
SELECT o.ad_client_id,
2
o.ad_org_id,
3
o.isactive,
4
o.created,
5
o.createdby,
6
o.updated,
7
o.updatedby,
8
'en_US'::character varying AS ad_language,
9
o.pp_order_id,
10
o.documentno,
11
o.docstatus,
12
o.c_doctype_id,
13
oi.c_location_id AS org_location_id,
14
oi.taxid,
15
o.m_warehouse_id,
16
wh.c_location_id AS warehouse_location_id,
17
d.printname AS documenttype,
18
d.documentnote AS documenttypenote,
19
o.planner_id,
20
u.name AS salesrep_name,
21
o.datestart,
22
o.datestartschedule,
23
o.floatafter,
24
o.floatbefored,
25
o.line,
26
o.lot,
27
o.serno,
28
o.c_uom_id,
29
o.s_resource_id,
30
o.pp_product_bom_id,
31
o.ad_workflow_id,
32
o.assay,
33
o.c_orderline_id,
34
o.priorityrule,
35
o.qtybatchsize,
36
o.qtybatchs,
37
o.qtydelivered,
38
o.qtyentered,
39
o.qtyordered,
40
o.dateconfirm,
41
o.datedelivered,
42
o.datefinish,
43
o.datefinishschedule,
44
o.dateordered,
45
o.datepromised,
46
o.qtyreject,
47
o.qtyreserved,
48
o.qtyscrap,
49
o.yield,
50
o.c_campaign_id,
51
o.c_project_id,
52
o.c_activity_id,
53
ob.bomtype,
54
ob.bomuse,
55
ob.description,
56
ob.help,
57
ob.m_attributesetinstance_id,
58
ob.m_product_id,
59
ob.name,
60
ob.revision,
61
ob.validfrom,
62
ob.validto,
63
COALESCE(oi.logo_id, ci.logo_id) AS logo_id
64
FROM ((((((pp_order o
65
JOIN c_doctype d ON ((o.c_doctype_id = d.c_doctype_id)))
66
JOIN pp_order_bom ob ON ((ob.pp_order_id = o.pp_order_id)))
67
JOIN m_warehouse wh ON ((o.m_warehouse_id = wh.m_warehouse_id)))
68
JOIN ad_orginfo oi ON ((o.ad_org_id = oi.ad_org_id)))
69
JOIN ad_clientinfo ci ON ((o.ad_client_id = ci.ad_client_id)))
70
LEFT JOIN ad_user u ON ((o.planner_id = u.ad_user_id)));