テーブル情報
システム名 http://www.as-link.com/  作成者 秦 松甫 
サブシステム名 ERPlus@iDempiere3.1_daily  作成日 2016/3/7 
スキーマ名 adempiere  更新日  
論理テーブル名   RDBMS  PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9), 64-bit 9.4.5 
物理テーブル名 c_order_linetax_v     
備考


カラム情報
No 論理名 物理名 データ型 Not Null デフォルト 備考
1 ad_client_id numeric(10)  
2 ad_org_id numeric(10)  
3 isactive character(1)  
4 created timestamp without time zone  
5 createdby numeric(10)  
6 updated timestamp without time zone  
7 updatedby numeric(10)  
8 ad_language text  
9 c_order_id numeric(10)  
10 c_orderline_id numeric  
11 c_tax_id numeric  
12 taxindicator character varying  
13 c_bpartner_id numeric  
14 c_bpartner_location_id numeric  
15 bpname character varying  
16 c_location_id numeric  
17 line numeric  
18 m_product_id numeric  
19 vendorproductno character varying  
20 qtyordered numeric  
21 qtyentered numeric  
22 uomsymbol character varying  
23 name character varying  
24 description character varying  
25 documentnote character varying  
26 upc character varying  
27 sku character varying  
28 productvalue character varying  
29 resourcedescription character varying  
30 pricelist numeric  
31 priceenteredlist numeric  
32 discount numeric  
33 priceactual numeric  
34 priceentered numeric  
35 linenetamt numeric  
36 productdescription character varying  
37 imageurl character varying  
38 c_campaign_id numeric  
39 c_project_id numeric  
40 c_activity_id numeric  
41 c_projectphase_id numeric  
42 c_projecttask_id numeric  
43 c_orderline_ad_orgtrx_id numeric  
44 c_orderline_c_charge_id numeric  
45 c_orderline_c_currency_id numeric  
46 c_uom_id numeric  
47 datedelivered timestamp without time zone  
48 dateinvoiced timestamp without time zone  
49 dateordered timestamp without time zone  
50 c_orderline_datepromised timestamp without time zone  
51 c_orderline_freightamt numeric  
52 isdescription character  
53 link_orderline_id numeric  
54 m_promotion_id numeric  
55 c_orderline_m_shipper_id numeric  
56 c_orderline_m_warehouse_id numeric  
57 pricecost numeric  
58 pricelimit numeric  
59 c_orderline_processed character  
60 qtydelivered numeric  
61 qtyinvoiced numeric  
62 qtylostsales numeric  
63 qtyreserved numeric  
64 ref_orderline_id numeric  
65 rramt numeric  
66 rrstartdate timestamp without time zone  
67 s_resourceassignment_id numeric  
68 c_orderline_user1_id numeric  
69 c_orderline_user2_id numeric  
70 c_uom_ad_org_id numeric  
71 costingprecision numeric  
72 c_uom_description character varying  
73 c_uom_isactive character  
74 isdefault character  
75 c_uom_name character varying  
76 stdprecision numeric  
77 uomtype character varying  
78 x12de355 character varying  
79 c_order_ad_org_id numeric  
80 c_order_ad_orgtrx_id numeric  
81 ad_user_id numeric  
82 amountrefunded numeric  
83 amounttendered numeric  
84 bill_bpartner_id numeric  
85 bill_location_id numeric  
86 bill_user_id numeric  
87 c_order_c_activity_id numeric  
88 c_order_c_bpartner_id numeric  
89 c_order_c_campaign_id numeric  
90 c_cashline_id numeric  
91 c_cashplanline_id numeric  
92 c_order_c_charge_id numeric  
93 c_conversiontype_id numeric  
94 c_order_c_currency_id numeric  
95 c_doctype_id numeric  
96 c_doctypetarget_id numeric  
97 chargeamt numeric  
98 copyfrom character  
99 c_payment_id numeric  
100 c_paymentterm_id numeric  
101 c_pos_id numeric  
102 c_order_c_project_id numeric  
103 c_order_created timestamp without time zone  
104 c_order_createdby numeric  
105 dateacct timestamp without time zone  
106 dateprinted timestamp without time zone  
107 c_order_datepromised timestamp without time zone  
108 deliveryrule character  
109 deliveryviarule character  
110 c_order_description character varying  
111 docaction character  
112 docstatus character  
113 documentno character varying  
114 dropship_bpartner_id numeric  
115 dropship_location_id numeric  
116 dropship_user_id numeric  
117 c_order_freightamt numeric  
118 freightcostrule character  
119 grandtotal numeric  
120 invoicerule character  
121 c_order_isactive character  
122 isapproved character  
123 iscreditapproved character  
124 isdelivered character  
125 c_order_isdiscountprinted character  
126 c_order_isdropship character  
127 isinvoiced character  
128 ispayschedulevalid character  
129 isprinted character  
130 isselected character  
131 c_order_isselfservice character  
132 issotrx character  
133 istaxincluded character  
134 istransferred character  
135 link_order_id numeric  
136 c_order_m_freightcategory_id numeric  
137 c_order_m_pricelist_id numeric  
138 c_order_m_shipper_id numeric  
139 c_order_m_warehouse_id numeric  
140 ordertype character varying  
141 pay_bpartner_id numeric  
142 pay_location_id numeric  
143 c_order_paymentrule character  
144 poreference character varying  
145 posted character  
146 priorityrule character  
147 c_order_processed character  
148 processedon numeric  
149 promotioncode character varying  
150 ref_order_id numeric  
151 salesrep_id numeric  
152 c_order_sendemail character  
153 totallines numeric  
154 c_order_updated timestamp without time zone  
155 c_order_updatedby numeric  
156 c_order_user1_id numeric  
157 c_order_user2_id numeric  
158 c_order_volume numeric  
159 c_order_weight numeric  
160 m_product_ad_org_id numeric  
161 classification character varying  
162 m_product_copyfrom character  
163 m_product_created timestamp without time zone  
164 m_product_createdby numeric  
165 c_revenuerecognition_id numeric  
166 c_subscriptiontype_id numeric  
167 c_taxcategory_id numeric  
168 m_product_c_uom_id numeric  
169 descriptionurl character varying  
170 m_product_discontinued character  
171 m_product_discontinuedat timestamp without time zone  
172 group1 character varying  
173 group2 character varying  
174 guaranteedays numeric  
175 guaranteedaysmin numeric  
176 help character varying  
177 m_product_isactive character  
178 isbom character  
179 m_product_isdropship character  
180 isexcludeautodelivery character  
181 isinvoiceprintdetails character  
182 ispicklistprintdetails character  
183 ispurchased character  
184 m_product_isselfservice character  
185 issold character  
186 isstocked character  
187 m_product_issummary character  
188 isverified character  
189 iswebstorefeatured character  
190 lowlevel numeric  
191 m_attributeset_id numeric  
192 m_attributesetinstance_id numeric  
193 m_product_m_freightcategory_id numeric  
194 m_locator_id numeric  
195 m_product_product_category_id numeric  
196 m_product_processing character  
197 producttype character  
198 r_mailtext_id numeric  
199 m_product_salesrep_id numeric  
200 s_expensetype_id numeric  
201 shelfdepth numeric  
202 shelfheight numeric  
203 shelfwidth numeric  
204 s_resource_id numeric  
205 unitsperpack numeric  
206 unitsperpallet numeric  
207 m_product_updated timestamp without time zone  
208 m_product_updatedby numeric  
209 versionno character varying  
210 m_product_volume numeric  
211 m_product_weight numeric  
212 m_product_po_ad_org_id numeric  
213 m_product_po_c_bpartner_id numeric  
214 m_product_po_c_currency_id numeric  
215 costperorder numeric  
216 m_product_po_created timestamp without time zone  
217 m_product_po_createdby numeric  
218 m_product_po_c_uom_id numeric  
219 deliverytime_actual numeric  
220 deliverytime_promised numeric  
221 m_product_po_discontinued character  
222 m_product_po_discontinuedat timestamp without time zone  
223 m_product_po_isactive character  
224 iscurrentvendor character  
225 m_product_po_manufacturer character  
226 m_product_po_m_product_id numeric  
227 order_min numeric  
228 order_pack numeric  
229 priceeffective timestamp without time zone  
230 pricelastinv numeric  
231 pricelastpo numeric  
232 m_product_po_pricelist numeric  
233 pricepo numeric  
234 m_product_po_qualityrating numeric  
235 royaltyamt numeric  
236 m_product_po_upc character varying  
237 m_product_po_updated timestamp without time zone  
238 m_product_po_updatedby numeric  
239 m_product_po_vendorcategory character  
240 s_resourceassignment_ad_org_id numeric  
241 assigndatefrom timestamp without time zone  
242 assigndateto timestamp without time zone  
243 s_resourceassignment_created timestamp without time zone  
244 s_resourceassignment_createby numeric  
245 s_resourceassignment_isactive character  
246 isconfirmed character  
247 s_resourceassignment_name character varying  
248 s_resourceassignment_qty numeric  
249 s_resourceassignment_s_resour numeric  
250 s_resourceassignment_updated timestamp without time zone  
251 s_resourceassignment_updatedby numeric  
252 c_charge_c_org_id numeric  
253 c_charge_c_bpartner_id numeric  
254 c_chargetype_id numeric  
255 c_charge_chargeamt numeric  
256 c_charge_c_taxcategory_id numeric  
257 c_charge_description character varying  
258 c_charge_isactive character  
259 issamecurrency character  
260 issametax character  
261 c_charge_istaxincluded character  
262 c_bpartner_product_ad_org_id numeric  
263 c_bp_product_c_bpartner_id numeric  
264 c_bpartner_product_created timestamp without time zone  
265 c_bpartner_product_createdby numeric  
266 c_bpartner_product_description character varying  
267 c_bpartner_product_isactive character  
268 ismanufacturer character  
269 c_bpartner_product_manufactur character varying  
270 c_bpartner_product_qualityrat numeric  
271 shelflifemindays numeric  
272 c_bpartner_product_shelflifem numeric  
273 c_bpartner_product_updated timestamp without time zone  
274 c_bpartner_product_updatedby numeric  
275 c_bpartner_product_vendorcate character varying  
276 acqusitioncost numeric  
277 actuallifetimevalue numeric  
278 c_bpartner_ad_language character varying  
279 ad_orgbp_id numeric  
280 c_bpartner_ad_org_id numeric  
281 bpartner_parent_id numeric  
282 c_bp_group_id numeric  
283 c_dunning_id numeric  
284 c_greeting_id numeric  
285 c_invoiceschedule_id numeric  
286 c_bpartner_c_paymentterm_id numeric  
287 c_bpartner_created timestamp without time zone  
288 c_bpartner_createdby numeric  
289 c_bpartner_c_taxgroup_id numeric  
290 c_bpartner_deliveryrule character  
291 c_bpartner_deliveryviarule character  
292 c_bpartner_description character varying  
293 c_bpartner_dunninggrace date  
294 duns character  
295 c_bpartner_firstsale timestamp without time zone  
296 c_bpartner_flatdiscount numeric  
297 c_bpartner_freightcostrule character  
298 c_bpartner_invoicerule character  
299 c_bpartner_isactive character  
300 iscustomer character  
301 c_bpartner_isdiscountprinted character  
302 c_bpartner_isemployee character  
303 c_bpartner_ismanufacturer character  
304 isonetime character  
305 ispotaxexempt character  
306 isprospect character  
307 issalesrep character  
308 c_bpartner_issummary character  
309 c_bpartner_istaxexempt character  
310 isvendor character  
311 logo_id numeric  
312 m_discountschema_id numeric  
313 c_bpartner_m_pricelist_id numeric  
314 naics character  
315 c_bpartner_name character varying  
316 c_bpartner_name2 character varying  
317 numberemployees numeric  
318 c_bpartner_paymentrule character  
319 paymentrulepo character  
320 po_discountschema_id numeric  
321 po_paymentterm_id numeric  
322 po_pricelist_id numeric  
323 c_bpartner_poreference character varying  
324 potentiallifetimevalue numeric  
325 c_bpartner_rating character  
326 c_bpartner_referenceno character varying  
327 c_bpartner_salesrep_id numeric  
328 salesvolume numeric  
329 c_bpartner_sendemail character  
330 shareofcustomer numeric  
331 c_bpartner_shelflifeminpct numeric  
332 so_creditlimit numeric  
333 socreditstatus character  
334 so_creditused numeric  
335 so_description character varying  
336 c_bpartner_taxid character varying  
337 totalopenbalance numeric  
338 c_bpartner_updated timestamp without time zone  
339 c_bpartner_updatedby numeric  
340 c_bpartner_url character varying  
341 c_bpartner_value character varying  
342 c_bpartner_location_ad_org_id numeric  
343 c_bpartner_location_c_bpartne numeric  
344 c_bpartner_location_created timestamp without time zone  
345 c_bpartner_location_createdby numeric  
346 c_salesregion_id numeric  
347 c_bpartner_location_fax character varying  
348 c_bpartner_location_isactive character  
349 isbillto character  
350 isdn character varying  
351 ispayfrom character  
352 isremitto character  
353 isshipto character  
354 c_bpartner_location_name character varying  
355 c_bpartner_location_phone character varying  
356 c_bpartner_location_phone2 character varying  
357 c_bpartner_location_updated timestamp without time zone  
358 c_bpartner_location_updatedby numeric  
359 c_tax_ad_org_id numeric  
360 ad_rule_id numeric  
361 c_country_id numeric  
362 c_region_id numeric  
363 c_tax_c_taxcategory_id numeric  
364 c_tax_description character varying  
365 c_tax_isactive character  
366 c_tax_isdefault character  
367 isdocumentlevel character  
368 issalestax character  
369 c_tax_issummary character  
370 c_tax_istaxexempt character  
371 c_tax_name character varying  
372 parent_tax_id numeric  
373 rate numeric  
374 requirestaxcertificate character  
375 sopotype character  
376 to_country_id numeric  
377 c_tax_to_region_id numeric  
378 validfrom timestamp without time zone  


ソース
ソース
 SELECT ol.ad_client_id,
ol.ad_org_id,
ol.isactive,
ol.created,
ol.createdby,
ol.updated,
ol.updatedby,
'en_US'::text AS ad_language,
ol.c_order_id,
ol.c_orderline_id,
ol.c_tax_id,
t.taxindicator,
ol.c_bpartner_id,
ol.c_bpartner_location_id,
bp.name AS bpname,
bpl.c_location_id,
ol.line,
p.m_product_id,
po.vendorproductno,
CASE
WHEN ((ol.qtyordered <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN ol.qtyordered
ELSE NULL::numeric
END AS qtyordered,
CASE
WHEN ((ol.qtyentered <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN ol.qtyentered
ELSE NULL::numeric
END AS qtyentered,
CASE
WHEN ((ol.qtyentered <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN uom.uomsymbol
ELSE NULL::character varying
END AS uomsymbol,
COALESCE(c.name, (((p.name)::text || (productattribute(ol.m_attributesetinstance_id))::text))::character varying, ol.description) AS name,
CASE
WHEN (COALESCE(c.name, p.name) IS NOT NULL) THEN ol.description
ELSE NULL::character varying
END AS description,
p.documentnote,
p.upc,
p.sku,
COALESCE(pp.vendorproductno, p.value) AS productvalue,
ra.description AS resourcedescription,
CASE
WHEN ((i.isdiscountprinted = 'Y'::bpchar) AND (ol.pricelist <> (0)::numeric)) THEN ol.pricelist
ELSE NULL::numeric
END AS pricelist,
CASE
WHEN (((i.isdiscountprinted = 'Y'::bpchar) AND (ol.pricelist <> (0)::numeric)) AND (ol.qtyentered <> (0)::numeric)) THEN ((ol.pricelist * ol.qtyordered) / ol.qtyentered)
ELSE NULL::numeric
END AS priceenteredlist,
CASE
WHEN (((i.isdiscountprinted = 'Y'::bpchar) AND (ol.pricelist > ol.priceactual)) AND (ol.pricelist <> (0)::numeric)) THEN (((ol.pricelist - ol.priceactual) / ol.pricelist) * (100)::numeric)
ELSE NULL::numeric
END AS discount,
CASE
WHEN ((ol.priceactual <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN ol.priceactual
ELSE NULL::numeric
END AS priceactual,
CASE
WHEN ((ol.priceentered <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN ol.priceentered
ELSE NULL::numeric
END AS priceentered,
CASE
WHEN ((ol.linenetamt <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN ol.linenetamt
ELSE NULL::numeric
END AS linenetamt,
p.description AS productdescription,
p.imageurl,
ol.c_campaign_id,
ol.c_project_id,
ol.c_activity_id,
ol.c_projectphase_id,
ol.c_projecttask_id,
ol.ad_orgtrx_id AS c_orderline_ad_orgtrx_id,
ol.c_charge_id AS c_orderline_c_charge_id,
ol.c_currency_id AS c_orderline_c_currency_id,
ol.c_uom_id,
ol.datedelivered,
ol.dateinvoiced,
ol.dateordered,
ol.datepromised AS c_orderline_datepromised,
ol.freightamt AS c_orderline_freightamt,
ol.isdescription,
ol.link_orderline_id,
ol.m_promotion_id,
ol.m_shipper_id AS c_orderline_m_shipper_id,
ol.m_warehouse_id AS c_orderline_m_warehouse_id,
ol.pricecost,
ol.pricelimit,
ol.processed AS c_orderline_processed,
ol.qtydelivered,
ol.qtyinvoiced,
ol.qtylostsales,
ol.qtyreserved,
ol.ref_orderline_id,
ol.rramt,
ol.rrstartdate,
ol.s_resourceassignment_id,
ol.user1_id AS c_orderline_user1_id,
ol.user2_id AS c_orderline_user2_id,
uom.ad_org_id AS c_uom_ad_org_id,
uom.costingprecision,
uom.description AS c_uom_description,
uom.isactive AS c_uom_isactive,
uom.isdefault,
uom.name AS c_uom_name,
uom.stdprecision,
uom.uomtype,
uom.x12de355,
i.ad_org_id AS c_order_ad_org_id,
i.ad_orgtrx_id AS c_order_ad_orgtrx_id,
i.ad_user_id,
i.amountrefunded,
i.amounttendered,
i.bill_bpartner_id,
i.bill_location_id,
i.bill_user_id,
i.c_activity_id AS c_order_c_activity_id,
i.c_bpartner_id AS c_order_c_bpartner_id,
i.c_campaign_id AS c_order_c_campaign_id,
i.c_cashline_id,
i.c_cashplanline_id,
i.c_charge_id AS c_order_c_charge_id,
i.c_conversiontype_id,
i.c_currency_id AS c_order_c_currency_id,
i.c_doctype_id,
i.c_doctypetarget_id,
i.chargeamt,
i.copyfrom,
i.c_payment_id,
i.c_paymentterm_id,
i.c_pos_id,
i.c_project_id AS c_order_c_project_id,
i.created AS c_order_created,
i.createdby AS c_order_createdby,
i.dateacct,
i.dateprinted,
i.datepromised AS c_order_datepromised,
i.deliveryrule,
i.deliveryviarule,
i.description AS c_order_description,
i.docaction,
i.docstatus,
i.documentno,
i.dropship_bpartner_id,
i.dropship_location_id,
i.dropship_user_id,
i.freightamt AS c_order_freightamt,
i.freightcostrule,
i.grandtotal,
i.invoicerule,
i.isactive AS c_order_isactive,
i.isapproved,
i.iscreditapproved,
i.isdelivered,
i.isdiscountprinted AS c_order_isdiscountprinted,
i.isdropship AS c_order_isdropship,
i.isinvoiced,
i.ispayschedulevalid,
i.isprinted,
i.isselected,
i.isselfservice AS c_order_isselfservice,
i.issotrx,
i.istaxincluded,
i.istransferred,
i.link_order_id,
i.m_freightcategory_id AS c_order_m_freightcategory_id,
i.m_pricelist_id AS c_order_m_pricelist_id,
i.m_shipper_id AS c_order_m_shipper_id,
i.m_warehouse_id AS c_order_m_warehouse_id,
i.ordertype,
i.pay_bpartner_id,
i.pay_location_id,
i.paymentrule AS c_order_paymentrule,
i.poreference,
i.posted,
i.priorityrule,
i.processed AS c_order_processed,
i.processedon,
i.promotioncode,
i.ref_order_id,
i.salesrep_id,
i.sendemail AS c_order_sendemail,
i.totallines,
i.updated AS c_order_updated,
i.updatedby AS c_order_updatedby,
i.user1_id AS c_order_user1_id,
i.user2_id AS c_order_user2_id,
i.volume AS c_order_volume,
i.weight AS c_order_weight,
p.ad_org_id AS m_product_ad_org_id,
p.classification,
p.copyfrom AS m_product_copyfrom,
p.created AS m_product_created,
p.createdby AS m_product_createdby,
p.c_revenuerecognition_id,
p.c_subscriptiontype_id,
p.c_taxcategory_id,
p.c_uom_id AS m_product_c_uom_id,
p.descriptionurl,
p.discontinued AS m_product_discontinued,
p.discontinuedat AS m_product_discontinuedat,
p.group1,
p.group2,
p.guaranteedays,
p.guaranteedaysmin,
p.help,
p.isactive AS m_product_isactive,
p.isbom,
p.isdropship AS m_product_isdropship,
p.isexcludeautodelivery,
p.isinvoiceprintdetails,
p.ispicklistprintdetails,
p.ispurchased,
p.isselfservice AS m_product_isselfservice,
p.issold,
p.isstocked,
p.issummary AS m_product_issummary,
p.isverified,
p.iswebstorefeatured,
p.lowlevel,
p.m_attributeset_id,
p.m_attributesetinstance_id,
p.m_freightcategory_id AS m_product_m_freightcategory_id,
p.m_locator_id,
p.m_product_category_id AS m_product_product_category_id,
p.processing AS m_product_processing,
p.producttype,
p.r_mailtext_id,
p.salesrep_id AS m_product_salesrep_id,
p.s_expensetype_id,
p.shelfdepth,
p.shelfheight,
p.shelfwidth,
p.s_resource_id,
p.unitsperpack,
p.unitsperpallet,
p.updated AS m_product_updated,
p.updatedby AS m_product_updatedby,
p.versionno,
p.volume AS m_product_volume,
p.weight AS m_product_weight,
po.ad_org_id AS m_product_po_ad_org_id,
po.c_bpartner_id AS m_product_po_c_bpartner_id,
po.c_currency_id AS m_product_po_c_currency_id,
po.costperorder,
po.created AS m_product_po_created,
po.createdby AS m_product_po_createdby,
po.c_uom_id AS m_product_po_c_uom_id,
po.deliverytime_actual,
po.deliverytime_promised,
po.discontinued AS m_product_po_discontinued,
po.discontinuedat AS m_product_po_discontinuedat,
po.isactive AS m_product_po_isactive,
po.iscurrentvendor,
po.manufacturer AS m_product_po_manufacturer,
po.m_product_id AS m_product_po_m_product_id,
po.order_min,
po.order_pack,
po.priceeffective,
po.pricelastinv,
po.pricelastpo,
po.pricelist AS m_product_po_pricelist,
po.pricepo,
po.qualityrating AS m_product_po_qualityrating,
po.royaltyamt,
po.upc AS m_product_po_upc,
po.updated AS m_product_po_updated,
po.updatedby AS m_product_po_updatedby,
po.vendorcategory AS m_product_po_vendorcategory,
ra.ad_org_id AS s_resourceassignment_ad_org_id,
ra.assigndatefrom,
ra.assigndateto,
ra.created AS s_resourceassignment_created,
ra.createdby AS s_resourceassignment_createby,
ra.isactive AS s_resourceassignment_isactive,
ra.isconfirmed,
ra.name AS s_resourceassignment_name,
ra.qty AS s_resourceassignment_qty,
ra.s_resource_id AS s_resourceassignment_s_resour,
ra.updated AS s_resourceassignment_updated,
ra.updatedby AS s_resourceassignment_updatedby,
c.ad_org_id AS c_charge_c_org_id,
c.c_bpartner_id AS c_charge_c_bpartner_id,
c.c_chargetype_id,
c.chargeamt AS c_charge_chargeamt,
c.c_taxcategory_id AS c_charge_c_taxcategory_id,
c.description AS c_charge_description,
c.isactive AS c_charge_isactive,
c.issamecurrency,
c.issametax,
c.istaxincluded AS c_charge_istaxincluded,
pp.ad_org_id AS c_bpartner_product_ad_org_id,
pp.c_bpartner_id AS c_bp_product_c_bpartner_id,
pp.created AS c_bpartner_product_created,
pp.createdby AS c_bpartner_product_createdby,
pp.description AS c_bpartner_product_description,
pp.isactive AS c_bpartner_product_isactive,
pp.ismanufacturer,
pp.manufacturer AS c_bpartner_product_manufactur,
pp.qualityrating AS c_bpartner_product_qualityrat,
pp.shelflifemindays,
pp.shelflifeminpct AS c_bpartner_product_shelflifem,
pp.updated AS c_bpartner_product_updated,
pp.updatedby AS c_bpartner_product_updatedby,
pp.vendorcategory AS c_bpartner_product_vendorcate,
bp.acqusitioncost,
bp.actuallifetimevalue,
bp.ad_language AS c_bpartner_ad_language,
bp.ad_orgbp_id,
bp.ad_org_id AS c_bpartner_ad_org_id,
bp.bpartner_parent_id,
bp.c_bp_group_id,
bp.c_dunning_id,
bp.c_greeting_id,
bp.c_invoiceschedule_id,
bp.c_paymentterm_id AS c_bpartner_c_paymentterm_id,
bp.created AS c_bpartner_created,
bp.createdby AS c_bpartner_createdby,
bp.c_taxgroup_id AS c_bpartner_c_taxgroup_id,
bp.deliveryrule AS c_bpartner_deliveryrule,
bp.deliveryviarule AS c_bpartner_deliveryviarule,
bp.description AS c_bpartner_description,
bp.dunninggrace AS c_bpartner_dunninggrace,
bp.duns,
bp.firstsale AS c_bpartner_firstsale,
bp.flatdiscount AS c_bpartner_flatdiscount,
bp.freightcostrule AS c_bpartner_freightcostrule,
bp.invoicerule AS c_bpartner_invoicerule,
bp.isactive AS c_bpartner_isactive,
bp.iscustomer,
bp.isdiscountprinted AS c_bpartner_isdiscountprinted,
bp.isemployee AS c_bpartner_isemployee,
bp.ismanufacturer AS c_bpartner_ismanufacturer,
bp.isonetime,
bp.ispotaxexempt,
bp.isprospect,
bp.issalesrep,
bp.issummary AS c_bpartner_issummary,
bp.istaxexempt AS c_bpartner_istaxexempt,
bp.isvendor,
bp.logo_id,
bp.m_discountschema_id,
bp.m_pricelist_id AS c_bpartner_m_pricelist_id,
bp.naics,
bp.name AS c_bpartner_name,
bp.name2 AS c_bpartner_name2,
bp.numberemployees,
bp.paymentrule AS c_bpartner_paymentrule,
bp.paymentrulepo,
bp.po_discountschema_id,
bp.po_paymentterm_id,
bp.po_pricelist_id,
bp.poreference AS c_bpartner_poreference,
bp.potentiallifetimevalue,
bp.rating AS c_bpartner_rating,
bp.referenceno AS c_bpartner_referenceno,
bp.salesrep_id AS c_bpartner_salesrep_id,
bp.salesvolume,
bp.sendemail AS c_bpartner_sendemail,
bp.shareofcustomer,
bp.shelflifeminpct AS c_bpartner_shelflifeminpct,
bp.so_creditlimit,
bp.socreditstatus,
bp.so_creditused,
bp.so_description,
bp.taxid AS c_bpartner_taxid,
bp.totalopenbalance,
bp.updated AS c_bpartner_updated,
bp.updatedby AS c_bpartner_updatedby,
bp.url AS c_bpartner_url,
bp.value AS c_bpartner_value,
bpl.ad_org_id AS c_bpartner_location_ad_org_id,
bpl.c_bpartner_id AS c_bpartner_location_c_bpartne,
bpl.created AS c_bpartner_location_created,
bpl.createdby AS c_bpartner_location_createdby,
bpl.c_salesregion_id,
bpl.fax AS c_bpartner_location_fax,
bpl.isactive AS c_bpartner_location_isactive,
bpl.isbillto,
bpl.isdn,
bpl.ispayfrom,
bpl.isremitto,
bpl.isshipto,
bpl.name AS c_bpartner_location_name,
bpl.phone AS c_bpartner_location_phone,
bpl.phone2 AS c_bpartner_location_phone2,
bpl.updated AS c_bpartner_location_updated,
bpl.updatedby AS c_bpartner_location_updatedby,
t.ad_org_id AS c_tax_ad_org_id,
t.ad_rule_id,
t.c_country_id,
t.c_region_id,
t.c_taxcategory_id AS c_tax_c_taxcategory_id,
t.description AS c_tax_description,
t.isactive AS c_tax_isactive,
t.isdefault AS c_tax_isdefault,
t.isdocumentlevel,
t.issalestax,
t.issummary AS c_tax_issummary,
t.istaxexempt AS c_tax_istaxexempt,
t.name AS c_tax_name,
t.parent_tax_id,
t.rate,
t.requirestaxcertificate,
t.sopotype,
t.to_country_id,
t.to_region_id AS c_tax_to_region_id,
t.validfrom
FROM ((((((((((c_orderline ol
JOIN c_uom uom ON ((ol.c_uom_id = uom.c_uom_id)))
JOIN c_order i ON ((ol.c_order_id = i.c_order_id)))
LEFT JOIN m_product p ON ((ol.m_product_id = p.m_product_id)))
LEFT JOIN m_product_po po ON (((p.m_product_id = po.m_product_id) AND (i.c_bpartner_id = po.c_bpartner_id))))
LEFT JOIN s_resourceassignment ra ON ((ol.s_resourceassignment_id = ra.s_resourceassignment_id)))
LEFT JOIN c_charge c ON ((ol.c_charge_id = c.c_charge_id)))
LEFT JOIN c_bpartner_product pp ON (((ol.m_product_id = pp.m_product_id) AND (i.c_bpartner_id = pp.c_bpartner_id))))
JOIN c_bpartner bp ON ((ol.c_bpartner_id = bp.c_bpartner_id)))
JOIN c_bpartner_location bpl ON ((ol.c_bpartner_location_id = bpl.c_bpartner_location_id)))
LEFT JOIN c_tax t ON ((ol.c_tax_id = t.c_tax_id)))
UNION
SELECT ol.ad_client_id,
ol.ad_org_id,
ol.isactive,
ol.created,
ol.createdby,
ol.updated,
ol.updatedby,
'en_US'::text AS ad_language,
ol.c_order_id,
ol.c_orderline_id,
ol.c_tax_id,
NULL::character varying AS taxindicator,
NULL::numeric AS c_bpartner_id,
NULL::numeric AS c_bpartner_location_id,
NULL::character varying AS bpname,
NULL::numeric AS c_location_id,
(ol.line + (bl.line / (100)::numeric)) AS line,
p.m_product_id,
po.vendorproductno,
CASE
WHEN (bl.isqtypercentage = 'N'::bpchar) THEN (ol.qtyordered * bl.qtybom)
ELSE (ol.qtyordered * (bl.qtybatch / (100)::numeric))
END AS qtyordered,
CASE
WHEN (bl.isqtypercentage = 'N'::bpchar) THEN (ol.qtyentered * bl.qtybom)
ELSE (ol.qtyentered * (bl.qtybatch / (100)::numeric))
END AS qtyentered,
uom.uomsymbol,
p.name,
bl.description,
p.documentnote,
p.upc,
p.sku,
p.value AS productvalue,
NULL::character varying AS resourcedescription,
NULL::numeric AS pricelist,
NULL::numeric AS priceenteredlist,
NULL::numeric AS discount,
NULL::numeric AS priceactual,
NULL::numeric AS priceentered,
NULL::numeric AS linenetamt,
p.description AS productdescription,
p.imageurl,
ol.c_campaign_id,
ol.c_project_id,
ol.c_activity_id,
ol.c_projectphase_id,
ol.c_projecttask_id,
ol.ad_orgtrx_id AS c_orderline_ad_orgtrx_id,
ol.c_charge_id AS c_orderline_c_charge_id,
ol.c_currency_id AS c_orderline_c_currency_id,
ol.c_uom_id,
ol.datedelivered,
ol.dateinvoiced,
ol.dateordered,
ol.datepromised AS c_orderline_datepromised,
ol.freightamt AS c_orderline_freightamt,
ol.isdescription,
ol.link_orderline_id,
ol.m_promotion_id,
ol.m_shipper_id AS c_orderline_m_shipper_id,
ol.m_warehouse_id AS c_orderline_m_warehouse_id,
ol.pricecost,
ol.pricelimit,
ol.processed AS c_orderline_processed,
ol.qtydelivered,
ol.qtyinvoiced,
ol.qtylostsales,
ol.qtyreserved,
ol.ref_orderline_id,
ol.rramt,
ol.rrstartdate,
ol.s_resourceassignment_id,
ol.user1_id AS c_orderline_user1_id,
ol.user2_id AS c_orderline_user2_id,
uom.ad_org_id AS c_uom_ad_org_id,
uom.costingprecision,
uom.description AS c_uom_description,
uom.isactive AS c_uom_isactive,
uom.isdefault,
uom.name AS c_uom_name,
uom.stdprecision,
uom.uomtype,
uom.x12de355,
i.ad_org_id AS c_order_ad_org_id,
i.ad_orgtrx_id AS c_order_ad_orgtrx_id,
i.ad_user_id,
i.amountrefunded,
i.amounttendered,
i.bill_bpartner_id,
i.bill_location_id,
i.bill_user_id,
i.c_activity_id AS c_order_c_activity_id,
i.c_bpartner_id AS c_order_c_bpartner_id,
i.c_campaign_id AS c_order_c_campaign_id,
i.c_cashline_id,
i.c_cashplanline_id,
i.c_charge_id AS c_order_c_charge_id,
i.c_conversiontype_id,
i.c_currency_id AS c_order_c_currency_id,
i.c_doctype_id,
i.c_doctypetarget_id,
i.chargeamt,
i.copyfrom,
i.c_payment_id,
i.c_paymentterm_id,
i.c_pos_id,
i.c_project_id AS c_order_c_project_id,
i.created AS c_order_created,
i.createdby AS c_order_createdby,
i.dateacct,
i.dateprinted,
i.datepromised AS c_order_datepromised,
i.deliveryrule,
i.deliveryviarule,
i.description AS c_order_description,
i.docaction,
i.docstatus,
i.documentno,
i.dropship_bpartner_id,
i.dropship_location_id,
i.dropship_user_id,
i.freightamt AS c_order_freightamt,
i.freightcostrule,
i.grandtotal,
i.invoicerule,
i.isactive AS c_order_isactive,
i.isapproved,
i.iscreditapproved,
i.isdelivered,
i.isdiscountprinted AS c_order_isdiscountprinted,
i.isdropship AS c_order_isdropship,
i.isinvoiced,
i.ispayschedulevalid,
i.isprinted,
i.isselected,
i.isselfservice AS c_order_isselfservice,
i.issotrx,
i.istaxincluded,
i.istransferred,
i.link_order_id,
i.m_freightcategory_id AS c_order_m_freightcategory_id,
i.m_pricelist_id AS c_order_m_pricelist_id,
i.m_shipper_id AS c_order_m_shipper_id,
i.m_warehouse_id AS c_order_m_warehouse_id,
i.ordertype,
i.pay_bpartner_id,
i.pay_location_id,
i.paymentrule AS c_order_paymentrule,
i.poreference,
i.posted,
i.priorityrule,
i.processed AS c_order_processed,
i.processedon,
i.promotioncode,
i.ref_order_id,
i.salesrep_id,
i.sendemail AS c_order_sendemail,
i.totallines,
i.updated AS c_order_updated,
i.updatedby AS c_order_updatedby,
i.user1_id AS c_order_user1_id,
i.user2_id AS c_order_user2_id,
i.volume AS c_order_volume,
i.weight AS c_order_weight,
p.ad_org_id AS m_product_ad_org_id,
p.classification,
p.copyfrom AS m_product_copyfrom,
p.created AS m_product_created,
p.createdby AS m_product_createdby,
p.c_revenuerecognition_id,
p.c_subscriptiontype_id,
p.c_taxcategory_id,
p.c_uom_id AS m_product_c_uom_id,
p.descriptionurl,
p.discontinued AS m_product_discontinued,
p.discontinuedat AS m_product_discontinuedat,
p.group1,
p.group2,
p.guaranteedays,
p.guaranteedaysmin,
p.help,
p.isactive AS m_product_isactive,
p.isbom,
p.isdropship AS m_product_isdropship,
p.isexcludeautodelivery,
p.isinvoiceprintdetails,
p.ispicklistprintdetails,
p.ispurchased,
p.isselfservice AS m_product_isselfservice,
p.issold,
p.isstocked,
p.issummary AS m_product_issummary,
p.isverified,
p.iswebstorefeatured,
p.lowlevel,
p.m_attributeset_id,
p.m_attributesetinstance_id,
p.m_freightcategory_id AS m_product_m_freightcategory_id,
p.m_locator_id,
p.m_product_category_id AS m_product_product_category_id,
p.processing AS m_product_processing,
p.producttype,
p.r_mailtext_id,
p.salesrep_id AS m_product_salesrep_id,
p.s_expensetype_id,
p.shelfdepth,
p.shelfheight,
p.shelfwidth,
p.s_resource_id,
p.unitsperpack,
p.unitsperpallet,
p.updated AS m_product_updated,
p.updatedby AS m_product_updatedby,
p.versionno,
p.volume AS m_product_volume,
p.weight AS m_product_weight,
po.ad_org_id AS m_product_po_ad_org_id,
po.c_bpartner_id AS m_product_po_c_bpartner_id,
po.c_currency_id AS m_product_po_c_currency_id,
po.costperorder,
po.created AS m_product_po_created,
po.createdby AS m_product_po_createdby,
po.c_uom_id AS m_product_po_c_uom_id,
po.deliverytime_actual,
po.deliverytime_promised,
po.discontinued AS m_product_po_discontinued,
po.discontinuedat AS m_product_po_discontinuedat,
po.isactive AS m_product_po_isactive,
po.iscurrentvendor,
po.manufacturer AS m_product_po_manufacturer,
po.m_product_id AS m_product_po_m_product_id,
po.order_min,
po.order_pack,
po.priceeffective,
po.pricelastinv,
po.pricelastpo,
po.pricelist AS m_product_po_pricelist,
po.pricepo,
po.qualityrating AS m_product_po_qualityrating,
po.royaltyamt,
po.upc AS m_product_po_upc,
po.updated AS m_product_po_updated,
po.updatedby AS m_product_po_updatedby,
po.vendorcategory AS m_product_po_vendorcategory,
NULL::numeric AS s_resourceassignment_ad_org_id,
NULL::timestamp without time zone AS assigndatefrom,
NULL::timestamp without time zone AS assigndateto,
NULL::timestamp without time zone AS s_resourceassignment_created,
NULL::numeric AS s_resourceassignment_createby,
NULL::bpchar AS s_resourceassignment_isactive,
NULL::bpchar AS isconfirmed,
NULL::character varying AS s_resourceassignment_name,
NULL::numeric AS s_resourceassignment_qty,
NULL::numeric AS s_resourceassignment_s_resour,
NULL::timestamp without time zone AS s_resourceassignment_updated,
NULL::numeric AS s_resourceassignment_updatedby,
NULL::numeric AS c_charge_c_org_id,
NULL::numeric AS c_charge_c_bpartner_id,
NULL::numeric AS c_chargetype_id,
NULL::numeric AS c_charge_chargeamt,
NULL::numeric AS c_charge_c_taxcategory_id,
NULL::character varying AS c_charge_description,
NULL::bpchar AS c_charge_isactive,
NULL::bpchar AS issamecurrency,
NULL::bpchar AS issametax,
NULL::bpchar AS c_charge_istaxincluded,
NULL::numeric AS c_bpartner_product_ad_org_id,
NULL::numeric AS c_bp_product_c_bpartner_id,
NULL::timestamp without time zone AS c_bpartner_product_created,
NULL::numeric AS c_bpartner_product_createdby,
NULL::character varying AS c_bpartner_product_description,
NULL::bpchar AS c_bpartner_product_isactive,
NULL::bpchar AS ismanufacturer,
NULL::character varying AS c_bpartner_product_manufactur,
NULL::numeric AS c_bpartner_product_qualityrat,
NULL::numeric AS shelflifemindays,
NULL::numeric AS c_bpartner_product_shelflifem,
NULL::timestamp without time zone AS c_bpartner_product_updated,
NULL::numeric AS c_bpartner_product_updatedby,
NULL::character varying AS c_bpartner_product_vendorcate,
NULL::numeric AS acqusitioncost,
NULL::numeric AS actuallifetimevalue,
NULL::character varying AS c_bpartner_ad_language,
NULL::numeric AS ad_orgbp_id,
NULL::numeric AS c_bpartner_ad_org_id,
NULL::numeric AS bpartner_parent_id,
NULL::numeric AS c_bp_group_id,
NULL::numeric AS c_dunning_id,
NULL::numeric AS c_greeting_id,
NULL::numeric AS c_invoiceschedule_id,
NULL::numeric AS c_bpartner_c_paymentterm_id,
NULL::timestamp without time zone AS c_bpartner_created,
NULL::numeric AS c_bpartner_createdby,
NULL::numeric AS c_bpartner_c_taxgroup_id,
NULL::bpchar AS c_bpartner_deliveryrule,
NULL::bpchar AS c_bpartner_deliveryviarule,
NULL::character varying AS c_bpartner_description,
NULL::date AS c_bpartner_dunninggrace,
NULL::bpchar AS duns,
NULL::timestamp without time zone AS c_bpartner_firstsale,
NULL::numeric AS c_bpartner_flatdiscount,
NULL::bpchar AS c_bpartner_freightcostrule,
NULL::bpchar AS c_bpartner_invoicerule,
NULL::bpchar AS c_bpartner_isactive,
NULL::bpchar AS iscustomer,
NULL::bpchar AS c_bpartner_isdiscountprinted,
NULL::bpchar AS c_bpartner_isemployee,
NULL::bpchar AS c_bpartner_ismanufacturer,
NULL::bpchar AS isonetime,
NULL::bpchar AS ispotaxexempt,
NULL::bpchar AS isprospect,
NULL::bpchar AS issalesrep,
NULL::bpchar AS c_bpartner_issummary,
NULL::bpchar AS c_bpartner_istaxexempt,
NULL::bpchar AS isvendor,
NULL::numeric AS logo_id,
NULL::numeric AS m_discountschema_id,
NULL::numeric AS c_bpartner_m_pricelist_id,
NULL::bpchar AS naics,
NULL::character varying AS c_bpartner_name,
NULL::character varying AS c_bpartner_name2,
NULL::numeric AS numberemployees,
NULL::bpchar AS c_bpartner_paymentrule,
NULL::bpchar AS paymentrulepo,
NULL::numeric AS po_discountschema_id,
NULL::numeric AS po_paymentterm_id,
NULL::numeric AS po_pricelist_id,
NULL::character varying AS c_bpartner_poreference,
NULL::numeric AS potentiallifetimevalue,
NULL::bpchar AS c_bpartner_rating,
NULL::character varying AS c_bpartner_referenceno,
NULL::numeric AS c_bpartner_salesrep_id,
NULL::numeric AS salesvolume,
NULL::bpchar AS c_bpartner_sendemail,
NULL::numeric AS shareofcustomer,
NULL::numeric AS c_bpartner_shelflifeminpct,
NULL::numeric AS so_creditlimit,
NULL::bpchar AS socreditstatus,
NULL::numeric AS so_creditused,
NULL::character varying AS so_description,
NULL::character varying AS c_bpartner_taxid,
NULL::numeric AS totalopenbalance,
NULL::timestamp without time zone AS c_bpartner_updated,
NULL::numeric AS c_bpartner_updatedby,
NULL::character varying AS c_bpartner_url,
NULL::character varying AS c_bpartner_value,
NULL::numeric AS c_bpartner_location_ad_org_id,
NULL::numeric AS c_bpartner_location_c_bpartne,
NULL::timestamp without time zone AS c_bpartner_location_created,
NULL::numeric AS c_bpartner_location_createdby,
NULL::numeric AS c_salesregion_id,
NULL::character varying AS c_bpartner_location_fax,
NULL::bpchar AS c_bpartner_location_isactive,
NULL::bpchar AS isbillto,
NULL::character varying AS isdn,
NULL::bpchar AS ispayfrom,
NULL::bpchar AS isremitto,
NULL::bpchar AS isshipto,
NULL::character varying AS c_bpartner_location_name,
NULL::character varying AS c_bpartner_location_phone,
NULL::character varying AS c_bpartner_location_phone2,
NULL::timestamp without time zone AS c_bpartner_location_updated,
NULL::numeric AS c_bpartner_location_updatedby,
NULL::numeric AS c_tax_ad_org_id,
NULL::numeric AS ad_rule_id,
NULL::numeric AS c_country_id,
NULL::numeric AS c_region_id,
NULL::numeric AS c_tax_c_taxcategory_id,
NULL::character varying AS c_tax_description,
NULL::bpchar AS c_tax_isactive,
NULL::bpchar AS c_tax_isdefault,
NULL::bpchar AS isdocumentlevel,
NULL::bpchar AS issalestax,
NULL::bpchar AS c_tax_issummary,
NULL::bpchar AS c_tax_istaxexempt,
NULL::character varying AS c_tax_name,
NULL::numeric AS parent_tax_id,
NULL::numeric AS rate,
NULL::bpchar AS requirestaxcertificate,
NULL::bpchar AS sopotype,
NULL::numeric AS to_country_id,
NULL::numeric AS c_tax_to_region_id,
NULL::timestamp without time zone AS validfrom
FROM (((((((pp_product_bom b
JOIN c_orderline ol ON ((b.m_product_id = ol.m_product_id)))
JOIN c_order i ON ((ol.c_order_id = i.c_order_id)))
JOIN m_product bp ON (((((bp.m_product_id = ol.m_product_id) AND (bp.isbom = 'Y'::bpchar)) AND (bp.isverified = 'Y'::bpchar)) AND (bp.isinvoiceprintdetails = 'Y'::bpchar))))
JOIN pp_product_bomline bl ON ((bl.pp_product_bom_id = b.pp_product_bom_id)))
JOIN m_product p ON ((p.m_product_id = bl.m_product_id)))
LEFT JOIN m_product_po po ON (((p.m_product_id = po.m_product_id) AND (i.c_bpartner_id = po.c_bpartner_id))))
JOIN c_uom uom ON ((p.c_uom_id = uom.c_uom_id)))
UNION
SELECT i.ad_client_id,
i.ad_org_id,
i.isactive,
i.created,
i.createdby,
i.updated,
i.updatedby,
'en_US'::text AS ad_language,
i.c_order_id,
NULL::numeric AS c_orderline_id,
NULL::numeric AS c_tax_id,
NULL::character varying AS taxindicator,
NULL::numeric AS c_bpartner_id,
NULL::numeric AS c_bpartner_location_id,
NULL::character varying AS bpname,
NULL::numeric AS c_location_id,
NULL::numeric AS line,
NULL::numeric AS m_product_id,
NULL::character varying AS vendorproductno,
NULL::numeric AS qtyordered,
NULL::numeric AS qtyentered,
NULL::character varying AS uomsymbol,
NULL::character varying AS name,
NULL::character varying AS description,
NULL::character varying AS documentnote,
NULL::character varying AS upc,
NULL::character varying AS sku,
NULL::character varying AS productvalue,
NULL::character varying AS resourcedescription,
NULL::numeric AS pricelist,
NULL::numeric AS priceenteredlist,
NULL::numeric AS discount,
NULL::numeric AS priceactual,
NULL::numeric AS priceentered,
NULL::numeric AS linenetamt,
NULL::character varying AS productdescription,
NULL::character varying AS imageurl,
NULL::numeric AS c_campaign_id,
NULL::numeric AS c_project_id,
NULL::numeric AS c_activity_id,
NULL::numeric AS c_projectphase_id,
NULL::numeric AS c_projecttask_id,
NULL::numeric AS c_orderline_ad_orgtrx_id,
NULL::numeric AS c_orderline_c_charge_id,
NULL::numeric AS c_orderline_c_currency_id,
NULL::numeric AS c_uom_id,
NULL::timestamp without time zone AS datedelivered,
NULL::timestamp without time zone AS dateinvoiced,
NULL::timestamp without time zone AS dateordered,
NULL::timestamp without time zone AS c_orderline_datepromised,
NULL::numeric AS c_orderline_freightamt,
NULL::bpchar AS isdescription,
NULL::numeric AS link_orderline_id,
NULL::numeric AS m_promotion_id,
NULL::numeric AS c_orderline_m_shipper_id,
NULL::numeric AS c_orderline_m_warehouse_id,
NULL::numeric AS pricecost,
NULL::numeric AS pricelimit,
NULL::bpchar AS c_orderline_processed,
NULL::numeric AS qtydelivered,
NULL::numeric AS qtyinvoiced,
NULL::numeric AS qtylostsales,
NULL::numeric AS qtyreserved,
NULL::numeric AS ref_orderline_id,
NULL::numeric AS rramt,
NULL::timestamp without time zone AS rrstartdate,
NULL::numeric AS s_resourceassignment_id,
NULL::numeric AS c_orderline_user1_id,
NULL::numeric AS c_orderline_user2_id,
NULL::numeric AS c_uom_ad_org_id,
NULL::numeric AS costingprecision,
NULL::character varying AS c_uom_description,
NULL::bpchar AS c_uom_isactive,
NULL::bpchar AS isdefault,
NULL::character varying AS c_uom_name,
NULL::numeric AS stdprecision,
NULL::character varying AS uomtype,
NULL::character varying AS x12de355,
NULL::numeric AS c_order_ad_org_id,
NULL::numeric AS c_order_ad_orgtrx_id,
NULL::numeric AS ad_user_id,
NULL::numeric AS amountrefunded,
NULL::numeric AS amounttendered,
NULL::numeric AS bill_bpartner_id,
NULL::numeric AS bill_location_id,
NULL::numeric AS bill_user_id,
NULL::numeric AS c_order_c_activity_id,
NULL::numeric AS c_order_c_bpartner_id,
NULL::numeric AS c_order_c_campaign_id,
NULL::numeric AS c_cashline_id,
NULL::numeric AS c_cashplanline_id,
NULL::numeric AS c_order_c_charge_id,
NULL::numeric AS c_conversiontype_id,
NULL::numeric AS c_order_c_currency_id,
NULL::numeric AS c_doctype_id,
NULL::numeric AS c_doctypetarget_id,
NULL::numeric AS chargeamt,
NULL::bpchar AS copyfrom,
NULL::numeric AS c_payment_id,
NULL::numeric AS c_paymentterm_id,
NULL::numeric AS c_pos_id,
NULL::numeric AS c_order_c_project_id,
NULL::timestamp without time zone AS c_order_created,
NULL::numeric AS c_order_createdby,
NULL::timestamp without time zone AS dateacct,
NULL::timestamp without time zone AS dateprinted,
NULL::timestamp without time zone AS c_order_datepromised,
NULL::bpchar AS deliveryrule,
NULL::bpchar AS deliveryviarule,
NULL::character varying AS c_order_description,
NULL::bpchar AS docaction,
NULL::bpchar AS docstatus,
NULL::character varying AS documentno,
NULL::numeric AS dropship_bpartner_id,
NULL::numeric AS dropship_location_id,
NULL::numeric AS dropship_user_id,
NULL::numeric AS c_order_freightamt,
NULL::bpchar AS freightcostrule,
NULL::numeric AS grandtotal,
NULL::bpchar AS invoicerule,
NULL::bpchar AS c_order_isactive,
NULL::bpchar AS isapproved,
NULL::bpchar AS iscreditapproved,
NULL::bpchar AS isdelivered,
NULL::bpchar AS c_order_isdiscountprinted,
NULL::bpchar AS c_order_isdropship,
NULL::bpchar AS isinvoiced,
NULL::bpchar AS ispayschedulevalid,
NULL::bpchar AS isprinted,
NULL::bpchar AS isselected,
NULL::bpchar AS c_order_isselfservice,
NULL::bpchar AS issotrx,
NULL::bpchar AS istaxincluded,
NULL::bpchar AS istransferred,
NULL::numeric AS link_order_id,
NULL::numeric AS c_order_m_freightcategory_id,
NULL::numeric AS c_order_m_pricelist_id,
NULL::numeric AS c_order_m_shipper_id,
NULL::numeric AS c_order_m_warehouse_id,
NULL::character varying AS ordertype,
NULL::numeric AS pay_bpartner_id,
NULL::numeric AS pay_location_id,
NULL::bpchar AS c_order_paymentrule,
NULL::character varying AS poreference,
NULL::bpchar AS posted,
NULL::bpchar AS priorityrule,
NULL::bpchar AS c_order_processed,
NULL::numeric AS processedon,
NULL::character varying AS promotioncode,
NULL::numeric AS ref_order_id,
NULL::numeric AS salesrep_id,
NULL::bpchar AS c_order_sendemail,
NULL::numeric AS totallines,
NULL::timestamp without time zone AS c_order_updated,
NULL::numeric AS c_order_updatedby,
NULL::numeric AS c_order_user1_id,
NULL::numeric AS c_order_user2_id,
NULL::numeric AS c_order_volume,
NULL::numeric AS c_order_weight,
NULL::numeric AS m_product_ad_org_id,
NULL::character varying AS classification,
NULL::bpchar AS m_product_copyfrom,
NULL::timestamp without time zone AS m_product_created,
NULL::numeric AS m_product_createdby,
NULL::numeric AS c_revenuerecognition_id,
NULL::numeric AS c_subscriptiontype_id,
NULL::numeric AS c_taxcategory_id,
NULL::numeric AS m_product_c_uom_id,
NULL::character varying AS descriptionurl,
NULL::bpchar AS m_product_discontinued,
NULL::timestamp without time zone AS m_product_discontinuedat,
NULL::character varying AS group1,
NULL::character varying AS group2,
NULL::numeric AS guaranteedays,
NULL::numeric AS guaranteedaysmin,
NULL::character varying AS help,
NULL::bpchar AS m_product_isactive,
NULL::bpchar AS isbom,
NULL::bpchar AS m_product_isdropship,
NULL::bpchar AS isexcludeautodelivery,
NULL::bpchar AS isinvoiceprintdetails,
NULL::bpchar AS ispicklistprintdetails,
NULL::bpchar AS ispurchased,
NULL::bpchar AS m_product_isselfservice,
NULL::bpchar AS issold,
NULL::bpchar AS isstocked,
NULL::bpchar AS m_product_issummary,
NULL::bpchar AS isverified,
NULL::bpchar AS iswebstorefeatured,
NULL::numeric AS lowlevel,
NULL::numeric AS m_attributeset_id,
NULL::numeric AS m_attributesetinstance_id,
NULL::numeric AS m_product_m_freightcategory_id,
NULL::numeric AS m_locator_id,
NULL::numeric AS m_product_product_category_id,
NULL::bpchar AS m_product_processing,
NULL::bpchar AS producttype,
NULL::numeric AS r_mailtext_id,
NULL::numeric AS m_product_salesrep_id,
NULL::numeric AS s_expensetype_id,
NULL::numeric AS shelfdepth,
NULL::numeric AS shelfheight,
NULL::numeric AS shelfwidth,
NULL::numeric AS s_resource_id,
NULL::numeric AS unitsperpack,
NULL::numeric AS unitsperpallet,
NULL::timestamp without time zone AS m_product_updated,
NULL::numeric AS m_product_updatedby,
NULL::character varying AS versionno,
NULL::numeric AS m_product_volume,
NULL::numeric AS m_product_weight,
NULL::numeric AS m_product_po_ad_org_id,
NULL::numeric AS m_product_po_c_bpartner_id,
NULL::numeric AS m_product_po_c_currency_id,
NULL::numeric AS costperorder,
NULL::timestamp without time zone AS m_product_po_created,
NULL::numeric AS m_product_po_createdby,
NULL::numeric AS m_product_po_c_uom_id,
NULL::numeric AS deliverytime_actual,
NULL::numeric AS deliverytime_promised,
NULL::bpchar AS m_product_po_discontinued,
NULL::timestamp without time zone AS m_product_po_discontinuedat,
NULL::bpchar AS m_product_po_isactive,
NULL::bpchar AS iscurrentvendor,
NULL::bpchar AS m_product_po_manufacturer,
NULL::numeric AS m_product_po_m_product_id,
NULL::numeric AS order_min,
NULL::numeric AS order_pack,
NULL::timestamp without time zone AS priceeffective,
NULL::numeric AS pricelastinv,
NULL::numeric AS pricelastpo,
NULL::numeric AS m_product_po_pricelist,
NULL::numeric AS pricepo,
NULL::numeric AS m_product_po_qualityrating,
NULL::numeric AS royaltyamt,
NULL::character varying AS m_product_po_upc,
NULL::timestamp without time zone AS m_product_po_updated,
NULL::numeric AS m_product_po_updatedby,
NULL::bpchar AS m_product_po_vendorcategory,
NULL::numeric AS s_resourceassignment_ad_org_id,
NULL::timestamp without time zone AS assigndatefrom,
NULL::timestamp without time zone AS assigndateto,
NULL::timestamp without time zone AS s_resourceassignment_created,
NULL::numeric AS s_resourceassignment_createby,
NULL::bpchar AS s_resourceassignment_isactive,
NULL::bpchar AS isconfirmed,
NULL::character varying AS s_resourceassignment_name,
NULL::numeric AS s_resourceassignment_qty,
NULL::numeric AS s_resourceassignment_s_resour,
NULL::timestamp without time zone AS s_resourceassignment_updated,
NULL::numeric AS s_resourceassignment_updatedby,
NULL::numeric AS c_charge_c_org_id,
NULL::numeric AS c_charge_c_bpartner_id,
NULL::numeric AS c_chargetype_id,
NULL::numeric AS c_charge_chargeamt,
NULL::numeric AS c_charge_c_taxcategory_id,
NULL::character varying AS c_charge_description,
NULL::bpchar AS c_charge_isactive,
NULL::bpchar AS issamecurrency,
NULL::bpchar AS issametax,
NULL::bpchar AS c_charge_istaxincluded,
NULL::numeric AS c_bpartner_product_ad_org_id,
NULL::numeric AS c_bp_product_c_bpartner_id,
NULL::timestamp without time zone AS c_bpartner_product_created,
NULL::numeric AS c_bpartner_product_createdby,
NULL::character varying AS c_bpartner_product_description,
NULL::bpchar AS c_bpartner_product_isactive,
NULL::bpchar AS ismanufacturer,
NULL::character varying AS c_bpartner_product_manufactur,
NULL::numeric AS c_bpartner_product_qualityrat,
NULL::numeric AS shelflifemindays,
NULL::numeric AS c_bpartner_product_shelflifem,
NULL::timestamp without time zone AS c_bpartner_product_updated,
NULL::numeric AS c_bpartner_product_updatedby,
NULL::character varying AS c_bpartner_product_vendorcate,
NULL::numeric AS acqusitioncost,
NULL::numeric AS actuallifetimevalue,
NULL::character varying AS c_bpartner_ad_language,
NULL::numeric AS ad_orgbp_id,
NULL::numeric AS c_bpartner_ad_org_id,
NULL::numeric AS bpartner_parent_id,
NULL::numeric AS c_bp_group_id,
NULL::numeric AS c_dunning_id,
NULL::numeric AS c_greeting_id,
NULL::numeric AS c_invoiceschedule_id,
NULL::numeric AS c_bpartner_c_paymentterm_id,
NULL::timestamp without time zone AS c_bpartner_created,
NULL::numeric AS c_bpartner_createdby,
NULL::numeric AS c_bpartner_c_taxgroup_id,
NULL::bpchar AS c_bpartner_deliveryrule,
NULL::bpchar AS c_bpartner_deliveryviarule,
NULL::character varying AS c_bpartner_description,
NULL::date AS c_bpartner_dunninggrace,
NULL::bpchar AS duns,
NULL::timestamp without time zone AS c_bpartner_firstsale,
NULL::numeric AS c_bpartner_flatdiscount,
NULL::bpchar AS c_bpartner_freightcostrule,
NULL::bpchar AS c_bpartner_invoicerule,
NULL::bpchar AS c_bpartner_isactive,
NULL::bpchar AS iscustomer,
NULL::bpchar AS c_bpartner_isdiscountprinted,
NULL::bpchar AS c_bpartner_isemployee,
NULL::bpchar AS c_bpartner_ismanufacturer,
NULL::bpchar AS isonetime,
NULL::bpchar AS ispotaxexempt,
NULL::bpchar AS isprospect,
NULL::bpchar AS issalesrep,
NULL::bpchar AS c_bpartner_issummary,
NULL::bpchar AS c_bpartner_istaxexempt,
NULL::bpchar AS isvendor,
NULL::numeric AS logo_id,
NULL::numeric AS m_discountschema_id,
NULL::numeric AS c_bpartner_m_pricelist_id,
NULL::bpchar AS naics,
NULL::character varying AS c_bpartner_name,
NULL::character varying AS c_bpartner_name2,
NULL::numeric AS numberemployees,
NULL::bpchar AS c_bpartner_paymentrule,
NULL::bpchar AS paymentrulepo,
NULL::numeric AS po_discountschema_id,
NULL::numeric AS po_paymentterm_id,
NULL::numeric AS po_pricelist_id,
NULL::character varying AS c_bpartner_poreference,
NULL::numeric AS potentiallifetimevalue,
NULL::bpchar AS c_bpartner_rating,
NULL::character varying AS c_bpartner_referenceno,
NULL::numeric AS c_bpartner_salesrep_id,
NULL::numeric AS salesvolume,
NULL::bpchar AS c_bpartner_sendemail,
NULL::numeric AS shareofcustomer,
NULL::numeric AS c_bpartner_shelflifeminpct,
NULL::numeric AS so_creditlimit,
NULL::bpchar AS socreditstatus,
NULL::numeric AS so_creditused,
NULL::character varying AS so_description,
NULL::character varying AS c_bpartner_taxid,
NULL::numeric AS totalopenbalance,
NULL::timestamp without time zone AS c_bpartner_updated,
NULL::numeric AS c_bpartner_updatedby,
NULL::character varying AS c_bpartner_url,
NULL::character varying AS c_bpartner_value,
NULL::numeric AS c_bpartner_location_ad_org_id,
NULL::numeric AS c_bpartner_location_c_bpartne,
NULL::timestamp without time zone AS c_bpartner_location_created,
NULL::numeric AS c_bpartner_location_createdby,
NULL::numeric AS c_salesregion_id,
NULL::character varying AS c_bpartner_location_fax,
NULL::bpchar AS c_bpartner_location_isactive,
NULL::bpchar AS isbillto,
NULL::character varying AS isdn,
NULL::bpchar AS ispayfrom,
NULL::bpchar AS isremitto,
NULL::bpchar AS isshipto,
NULL::character varying AS c_bpartner_location_name,
NULL::character varying AS c_bpartner_location_phone,
NULL::character varying AS c_bpartner_location_phone2,
NULL::timestamp without time zone AS c_bpartner_location_updated,
NULL::numeric AS c_bpartner_location_updatedby,
NULL::numeric AS c_tax_ad_org_id,
NULL::numeric AS ad_rule_id,
NULL::numeric AS c_country_id,
NULL::numeric AS c_region_id,
NULL::numeric AS c_tax_c_taxcategory_id,
NULL::character varying AS c_tax_description,
NULL::bpchar AS c_tax_isactive,
NULL::bpchar AS c_tax_isdefault,
NULL::bpchar AS isdocumentlevel,
NULL::bpchar AS issalestax,
NULL::bpchar AS c_tax_issummary,
NULL::bpchar AS c_tax_istaxexempt,
NULL::character varying AS c_tax_name,
NULL::numeric AS parent_tax_id,
NULL::numeric AS rate,
NULL::bpchar AS requirestaxcertificate,
NULL::bpchar AS sopotype,
NULL::numeric AS to_country_id,
NULL::numeric AS c_tax_to_region_id,
NULL::timestamp without time zone AS validfrom
FROM c_order i
UNION
SELECT ot.ad_client_id,
ot.ad_org_id,
ot.isactive,
ot.created,
ot.createdby,
ot.updated,
ot.updatedby,
'en_US'::text AS ad_language,
ot.c_order_id,
NULL::numeric AS c_orderline_id,
ot.c_tax_id,
t.taxindicator,
NULL::numeric AS c_bpartner_id,
NULL::numeric AS c_bpartner_location_id,
NULL::character varying AS bpname,
NULL::numeric AS c_location_id,
NULL::numeric AS line,
NULL::numeric AS m_product_id,
NULL::character varying AS vendorproductno,
NULL::numeric AS qtyordered,
NULL::numeric AS qtyentered,
NULL::character varying AS uomsymbol,
t.name,
NULL::character varying AS description,
NULL::character varying AS documentnote,
NULL::character varying AS upc,
NULL::character varying AS sku,
NULL::character varying AS productvalue,
NULL::character varying AS resourcedescription,
NULL::numeric AS pricelist,
NULL::numeric AS priceenteredlist,
NULL::numeric AS discount,
CASE
WHEN (ot.istaxincluded = 'Y'::bpchar) THEN ot.taxamt
ELSE ot.taxbaseamt
END AS priceactual,
CASE
WHEN (ot.istaxincluded = 'Y'::bpchar) THEN ot.taxamt
ELSE ot.taxbaseamt
END AS priceentered,
CASE
WHEN (ot.istaxincluded = 'Y'::bpchar) THEN NULL::numeric
ELSE ot.taxamt
END AS linenetamt,
NULL::character varying AS productdescription,
NULL::character varying AS imageurl,
NULL::numeric AS c_campaign_id,
NULL::numeric AS c_project_id,
NULL::numeric AS c_activity_id,
NULL::numeric AS c_projectphase_id,
NULL::numeric AS c_projecttask_id,
NULL::numeric AS c_orderline_ad_orgtrx_id,
NULL::numeric AS c_orderline_c_charge_id,
NULL::numeric AS c_orderline_c_currency_id,
NULL::numeric AS c_uom_id,
NULL::timestamp without time zone AS datedelivered,
NULL::timestamp without time zone AS dateinvoiced,
NULL::timestamp without time zone AS dateordered,
NULL::timestamp without time zone AS c_orderline_datepromised,
NULL::numeric AS c_orderline_freightamt,
NULL::bpchar AS isdescription,
NULL::numeric AS link_orderline_id,
NULL::numeric AS m_promotion_id,
NULL::numeric AS c_orderline_m_shipper_id,
NULL::numeric AS c_orderline_m_warehouse_id,
NULL::numeric AS pricecost,
NULL::numeric AS pricelimit,
NULL::bpchar AS c_orderline_processed,
NULL::numeric AS qtydelivered,
NULL::numeric AS qtyinvoiced,
NULL::numeric AS qtylostsales,
NULL::numeric AS qtyreserved,
NULL::numeric AS ref_orderline_id,
NULL::numeric AS rramt,
NULL::timestamp without time zone AS rrstartdate,
NULL::numeric AS s_resourceassignment_id,
NULL::numeric AS c_orderline_user1_id,
NULL::numeric AS c_orderline_user2_id,
NULL::numeric AS c_uom_ad_org_id,
NULL::numeric AS costingprecision,
NULL::character varying AS c_uom_description,
NULL::bpchar AS c_uom_isactive,
NULL::bpchar AS isdefault,
NULL::character varying AS c_uom_name,
NULL::numeric AS stdprecision,
NULL::character varying AS uomtype,
NULL::character varying AS x12de355,
NULL::numeric AS c_order_ad_org_id,
NULL::numeric AS c_order_ad_orgtrx_id,
NULL::numeric AS ad_user_id,
NULL::numeric AS amountrefunded,
NULL::numeric AS amounttendered,
NULL::numeric AS bill_bpartner_id,
NULL::numeric AS bill_location_id,
NULL::numeric AS bill_user_id,
NULL::numeric AS c_order_c_activity_id,
NULL::numeric AS c_order_c_bpartner_id,
NULL::numeric AS c_order_c_campaign_id,
NULL::numeric AS c_cashline_id,
NULL::numeric AS c_cashplanline_id,
NULL::numeric AS c_order_c_charge_id,
NULL::numeric AS c_conversiontype_id,
NULL::numeric AS c_order_c_currency_id,
NULL::numeric AS c_doctype_id,
NULL::numeric AS c_doctypetarget_id,
NULL::numeric AS chargeamt,
NULL::bpchar AS copyfrom,
NULL::numeric AS c_payment_id,
NULL::numeric AS c_paymentterm_id,
NULL::numeric AS c_pos_id,
NULL::numeric AS c_order_c_project_id,
NULL::timestamp without time zone AS c_order_created,
NULL::numeric AS c_order_createdby,
NULL::timestamp without time zone AS dateacct,
NULL::timestamp without time zone AS dateprinted,
NULL::timestamp without time zone AS c_order_datepromised,
NULL::bpchar AS deliveryrule,
NULL::bpchar AS deliveryviarule,
NULL::character varying AS c_order_description,
NULL::bpchar AS docaction,
NULL::bpchar AS docstatus,
NULL::character varying AS documentno,
NULL::numeric AS dropship_bpartner_id,
NULL::numeric AS dropship_location_id,
NULL::numeric AS dropship_user_id,
NULL::numeric AS c_order_freightamt,
NULL::bpchar AS freightcostrule,
NULL::numeric AS grandtotal,
NULL::bpchar AS invoicerule,
NULL::bpchar AS c_order_isactive,
NULL::bpchar AS isapproved,
NULL::bpchar AS iscreditapproved,
NULL::bpchar AS isdelivered,
NULL::bpchar AS c_order_isdiscountprinted,
NULL::bpchar AS c_order_isdropship,
NULL::bpchar AS isinvoiced,
NULL::bpchar AS ispayschedulevalid,
NULL::bpchar AS isprinted,
NULL::bpchar AS isselected,
NULL::bpchar AS c_order_isselfservice,
NULL::bpchar AS issotrx,
NULL::bpchar AS istaxincluded,
NULL::bpchar AS istransferred,
NULL::numeric AS link_order_id,
NULL::numeric AS c_order_m_freightcategory_id,
NULL::numeric AS c_order_m_pricelist_id,
NULL::numeric AS c_order_m_shipper_id,
NULL::numeric AS c_order_m_warehouse_id,
NULL::character varying AS ordertype,
NULL::numeric AS pay_bpartner_id,
NULL::numeric AS pay_location_id,
NULL::bpchar AS c_order_paymentrule,
NULL::character varying AS poreference,
NULL::bpchar AS posted,
NULL::bpchar AS priorityrule,
NULL::bpchar AS c_order_processed,
NULL::numeric AS processedon,
NULL::character varying AS promotioncode,
NULL::numeric AS ref_order_id,
NULL::numeric AS salesrep_id,
NULL::bpchar AS c_order_sendemail,
NULL::numeric AS totallines,
NULL::timestamp without time zone AS c_order_updated,
NULL::numeric AS c_order_updatedby,
NULL::numeric AS c_order_user1_id,
NULL::numeric AS c_order_user2_id,
NULL::numeric AS c_order_volume,
NULL::numeric AS c_order_weight,
NULL::numeric AS m_product_ad_org_id,
NULL::character varying AS classification,
NULL::bpchar AS m_product_copyfrom,
NULL::timestamp without time zone AS m_product_created,
NULL::numeric AS m_product_createdby,
NULL::numeric AS c_revenuerecognition_id,
NULL::numeric AS c_subscriptiontype_id,
NULL::numeric AS c_taxcategory_id,
NULL::numeric AS m_product_c_uom_id,
NULL::character varying AS descriptionurl,
NULL::bpchar AS m_product_discontinued,
NULL::timestamp without time zone AS m_product_discontinuedat,
NULL::character varying AS group1,
NULL::character varying AS group2,
NULL::numeric AS guaranteedays,
NULL::numeric AS guaranteedaysmin,
NULL::character varying AS help,
NULL::bpchar AS m_product_isactive,
NULL::bpchar AS isbom,
NULL::bpchar AS m_product_isdropship,
NULL::bpchar AS isexcludeautodelivery,
NULL::bpchar AS isinvoiceprintdetails,
NULL::bpchar AS ispicklistprintdetails,
NULL::bpchar AS ispurchased,
NULL::bpchar AS m_product_isselfservice,
NULL::bpchar AS issold,
NULL::bpchar AS isstocked,
NULL::bpchar AS m_product_issummary,
NULL::bpchar AS isverified,
NULL::bpchar AS iswebstorefeatured,
NULL::numeric AS lowlevel,
NULL::numeric AS m_attributeset_id,
NULL::numeric AS m_attributesetinstance_id,
NULL::numeric AS m_product_m_freightcategory_id,
NULL::numeric AS m_locator_id,
NULL::numeric AS m_product_product_category_id,
NULL::bpchar AS m_product_processing,
NULL::bpchar AS producttype,
NULL::numeric AS r_mailtext_id,
NULL::numeric AS m_product_salesrep_id,
NULL::numeric AS s_expensetype_id,
NULL::numeric AS shelfdepth,
NULL::numeric AS shelfheight,
NULL::numeric AS shelfwidth,
NULL::numeric AS s_resource_id,
NULL::numeric AS unitsperpack,
NULL::numeric AS unitsperpallet,
NULL::timestamp without time zone AS m_product_updated,
NULL::numeric AS m_product_updatedby,
NULL::character varying AS versionno,
NULL::numeric AS m_product_volume,
NULL::numeric AS m_product_weight,
NULL::numeric AS m_product_po_ad_org_id,
NULL::numeric AS m_product_po_c_bpartner_id,
NULL::numeric AS m_product_po_c_currency_id,
NULL::numeric AS costperorder,
NULL::timestamp without time zone AS m_product_po_created,
NULL::numeric AS m_product_po_createdby,
NULL::numeric AS m_product_po_c_uom_id,
NULL::numeric AS deliverytime_actual,
NULL::numeric AS deliverytime_promised,
NULL::bpchar AS m_product_po_discontinued,
NULL::timestamp without time zone AS m_product_po_discontinuedat,
NULL::bpchar AS m_product_po_isactive,
NULL::bpchar AS iscurrentvendor,
NULL::bpchar AS m_product_po_manufacturer,
NULL::numeric AS m_product_po_m_product_id,
NULL::numeric AS order_min,
NULL::numeric AS order_pack,
NULL::timestamp without time zone AS priceeffective,
NULL::numeric AS pricelastinv,
NULL::numeric AS pricelastpo,
NULL::numeric AS m_product_po_pricelist,
NULL::numeric AS pricepo,
NULL::numeric AS m_product_po_qualityrating,
NULL::numeric AS royaltyamt,
NULL::character varying AS m_product_po_upc,
NULL::timestamp without time zone AS m_product_po_updated,
NULL::numeric AS m_product_po_updatedby,
NULL::bpchar AS m_product_po_vendorcategory,
NULL::numeric AS s_resourceassignment_ad_org_id,
NULL::timestamp without time zone AS assigndatefrom,
NULL::timestamp without time zone AS assigndateto,
NULL::timestamp without time zone AS s_resourceassignment_created,
NULL::numeric AS s_resourceassignment_createby,
NULL::bpchar AS s_resourceassignment_isactive,
NULL::bpchar AS isconfirmed,
NULL::character varying AS s_resourceassignment_name,
NULL::numeric AS s_resourceassignment_qty,
NULL::numeric AS s_resourceassignment_s_resour,
NULL::timestamp without time zone AS s_resourceassignment_updated,
NULL::numeric AS s_resourceassignment_updatedby,
NULL::numeric AS c_charge_c_org_id,
NULL::numeric AS c_charge_c_bpartner_id,
NULL::numeric AS c_chargetype_id,
NULL::numeric AS c_charge_chargeamt,
NULL::numeric AS c_charge_c_taxcategory_id,
NULL::character varying AS c_charge_description,
NULL::bpchar AS c_charge_isactive,
NULL::bpchar AS issamecurrency,
NULL::bpchar AS issametax,
NULL::bpchar AS c_charge_istaxincluded,
NULL::numeric AS c_bpartner_product_ad_org_id,
NULL::numeric AS c_bp_product_c_bpartner_id,
NULL::timestamp without time zone AS c_bpartner_product_created,
NULL::numeric AS c_bpartner_product_createdby,
NULL::character varying AS c_bpartner_product_description,
NULL::bpchar AS c_bpartner_product_isactive,
NULL::bpchar AS ismanufacturer,
NULL::character varying AS c_bpartner_product_manufactur,
NULL::numeric AS c_bpartner_product_qualityrat,
NULL::numeric AS shelflifemindays,
NULL::numeric AS c_bpartner_product_shelflifem,
NULL::timestamp without time zone AS c_bpartner_product_updated,
NULL::numeric AS c_bpartner_product_updatedby,
NULL::character varying AS c_bpartner_product_vendorcate,
NULL::numeric AS acqusitioncost,
NULL::numeric AS actuallifetimevalue,
NULL::character varying AS c_bpartner_ad_language,
NULL::numeric AS ad_orgbp_id,
NULL::numeric AS c_bpartner_ad_org_id,
NULL::numeric AS bpartner_parent_id,
NULL::numeric AS c_bp_group_id,
NULL::numeric AS c_dunning_id,
NULL::numeric AS c_greeting_id,
NULL::numeric AS c_invoiceschedule_id,
NULL::numeric AS c_bpartner_c_paymentterm_id,
NULL::timestamp without time zone AS c_bpartner_created,
NULL::numeric AS c_bpartner_createdby,
NULL::numeric AS c_bpartner_c_taxgroup_id,
NULL::bpchar AS c_bpartner_deliveryrule,
NULL::bpchar AS c_bpartner_deliveryviarule,
NULL::character varying AS c_bpartner_description,
NULL::date AS c_bpartner_dunninggrace,
NULL::bpchar AS duns,
NULL::timestamp without time zone AS c_bpartner_firstsale,
NULL::numeric AS c_bpartner_flatdiscount,
NULL::bpchar AS c_bpartner_freightcostrule,
NULL::bpchar AS c_bpartner_invoicerule,
NULL::bpchar AS c_bpartner_isactive,
NULL::bpchar AS iscustomer,
NULL::bpchar AS c_bpartner_isdiscountprinted,
NULL::bpchar AS c_bpartner_isemployee,
NULL::bpchar AS c_bpartner_ismanufacturer,
NULL::bpchar AS isonetime,
NULL::bpchar AS ispotaxexempt,
NULL::bpchar AS isprospect,
NULL::bpchar AS issalesrep,
NULL::bpchar AS c_bpartner_issummary,
NULL::bpchar AS c_bpartner_istaxexempt,
NULL::bpchar AS isvendor,
NULL::numeric AS logo_id,
NULL::numeric AS m_discountschema_id,
NULL::numeric AS c_bpartner_m_pricelist_id,
NULL::bpchar AS naics,
NULL::character varying AS c_bpartner_name,
NULL::character varying AS c_bpartner_name2,
NULL::numeric AS numberemployees,
NULL::bpchar AS c_bpartner_paymentrule,
NULL::bpchar AS paymentrulepo,
NULL::numeric AS po_discountschema_id,
NULL::numeric AS po_paymentterm_id,
NULL::numeric AS po_pricelist_id,
NULL::character varying AS c_bpartner_poreference,
NULL::numeric AS potentiallifetimevalue,
NULL::bpchar AS c_bpartner_rating,
NULL::character varying AS c_bpartner_referenceno,
NULL::numeric AS c_bpartner_salesrep_id,
NULL::numeric AS salesvolume,
NULL::bpchar AS c_bpartner_sendemail,
NULL::numeric AS shareofcustomer,
NULL::numeric AS c_bpartner_shelflifeminpct,
NULL::numeric AS so_creditlimit,
NULL::bpchar AS socreditstatus,
NULL::numeric AS so_creditused,
NULL::character varying AS so_description,
NULL::character varying AS c_bpartner_taxid,
NULL::numeric AS totalopenbalance,
NULL::timestamp without time zone AS c_bpartner_updated,
NULL::numeric AS c_bpartner_updatedby,
NULL::character varying AS c_bpartner_url,
NULL::character varying AS c_bpartner_value,
NULL::numeric AS c_bpartner_location_ad_org_id,
NULL::numeric AS c_bpartner_location_c_bpartne,
NULL::timestamp without time zone AS c_bpartner_location_created,
NULL::numeric AS c_bpartner_location_createdby,
NULL::numeric AS c_salesregion_id,
NULL::character varying AS c_bpartner_location_fax,
NULL::bpchar AS c_bpartner_location_isactive,
NULL::bpchar AS isbillto,
NULL::character varying AS isdn,
NULL::bpchar AS ispayfrom,
NULL::bpchar AS isremitto,
NULL::bpchar AS isshipto,
NULL::character varying AS c_bpartner_location_name,
NULL::character varying AS c_bpartner_location_phone,
NULL::character varying AS c_bpartner_location_phone2,
NULL::timestamp without time zone AS c_bpartner_location_updated,
NULL::numeric AS c_bpartner_location_updatedby,
NULL::numeric AS c_tax_ad_org_id,
NULL::numeric AS ad_rule_id,
NULL::numeric AS c_country_id,
NULL::numeric AS c_region_id,
NULL::numeric AS c_tax_c_taxcategory_id,
NULL::character varying AS c_tax_description,
NULL::bpchar AS c_tax_isactive,
NULL::bpchar AS c_tax_isdefault,
NULL::bpchar AS isdocumentlevel,
NULL::bpchar AS issalestax,
NULL::bpchar AS c_tax_issummary,
NULL::bpchar AS c_tax_istaxexempt,
NULL::character varying AS c_tax_name,
NULL::numeric AS parent_tax_id,
NULL::numeric AS rate,
NULL::bpchar AS requirestaxcertificate,
NULL::bpchar AS sopotype,
NULL::numeric AS to_country_id,
NULL::numeric AS c_tax_to_region_id,
NULL::timestamp without time zone AS validfrom
FROM (c_ordertax ot
JOIN c_tax t ON ((ot.c_tax_id = t.c_tax_id)));


インデックス情報
No インデックス名 カラムリスト ユニーク 備考


外部キー情報
No 外部キー名 カラムリスト 参照先 参照先カラムリスト


外部キー情報(PK側)
No 外部キー名 カラムリスト 参照元 参照元カラムリスト


RDBMS固有の情報
No プロパティ名 プロパティ値
1 schemaname adempiere
2 viewname c_order_linetax_v
3 viewowner adempiere
4 definition SELECT ol.ad_client_id,
ol.ad_org_id,
ol.isactive,
ol.created,
ol.createdby,
ol.updated,
ol.updatedby,
'en_US'::text AS ad_language,
ol.c_order_id,
ol.c_orderline_id,
ol.c_tax_id,
t.taxindicator,
ol.c_bpartner_id,
ol.c_bpartner_location_id,
bp.name AS bpname,
bpl.c_location_id,
ol.line,
p.m_product_id,
po.vendorproductno,
CASE
WHEN ((ol.qtyordered <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN ol.qtyordered
ELSE NULL::numeric
END AS qtyordered,
CASE
WHEN ((ol.qtyentered <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN ol.qtyentered
ELSE NULL::numeric
END AS qtyentered,
CASE
WHEN ((ol.qtyentered <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN uom.uomsymbol
ELSE NULL::character varying
END AS uomsymbol,
COALESCE(c.name, (((p.name)::text || (productattribute(ol.m_attributesetinstance_id))::text))::character varying, ol.description) AS name,
CASE
WHEN (COALESCE(c.name, p.name) IS NOT NULL) THEN ol.description
ELSE NULL::character varying
END AS description,
p.documentnote,
p.upc,
p.sku,
COALESCE(pp.vendorproductno, p.value) AS productvalue,
ra.description AS resourcedescription,
CASE
WHEN ((i.isdiscountprinted = 'Y'::bpchar) AND (ol.pricelist <> (0)::numeric)) THEN ol.pricelist
ELSE NULL::numeric
END AS pricelist,
CASE
WHEN (((i.isdiscountprinted = 'Y'::bpchar) AND (ol.pricelist <> (0)::numeric)) AND (ol.qtyentered <> (0)::numeric)) THEN ((ol.pricelist * ol.qtyordered) / ol.qtyentered)
ELSE NULL::numeric
END AS priceenteredlist,
CASE
WHEN (((i.isdiscountprinted = 'Y'::bpchar) AND (ol.pricelist > ol.priceactual)) AND (ol.pricelist <> (0)::numeric)) THEN (((ol.pricelist - ol.priceactual) / ol.pricelist) * (100)::numeric)
ELSE NULL::numeric
END AS discount,
CASE
WHEN ((ol.priceactual <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN ol.priceactual
ELSE NULL::numeric
END AS priceactual,
CASE
WHEN ((ol.priceentered <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN ol.priceentered
ELSE NULL::numeric
END AS priceentered,
CASE
WHEN ((ol.linenetamt <> (0)::numeric) OR (ol.m_product_id IS NOT NULL)) THEN ol.linenetamt
ELSE NULL::numeric
END AS linenetamt,
p.description AS productdescription,
p.imageurl,
ol.c_campaign_id,
ol.c_project_id,
ol.c_activity_id,
ol.c_projectphase_id,
ol.c_projecttask_id,
ol.ad_orgtrx_id AS c_orderline_ad_orgtrx_id,
ol.c_charge_id AS c_orderline_c_charge_id,
ol.c_currency_id AS c_orderline_c_currency_id,
ol.c_uom_id,
ol.datedelivered,
ol.dateinvoiced,
ol.dateordered,
ol.datepromised AS c_orderline_datepromised,
ol.freightamt AS c_orderline_freightamt,
ol.isdescription,
ol.link_orderline_id,
ol.m_promotion_id,
ol.m_shipper_id AS c_orderline_m_shipper_id,
ol.m_warehouse_id AS c_orderline_m_warehouse_id,
ol.pricecost,
ol.pricelimit,
ol.processed AS c_orderline_processed,
ol.qtydelivered,
ol.qtyinvoiced,
ol.qtylostsales,
ol.qtyreserved,
ol.ref_orderline_id,
ol.rramt,
ol.rrstartdate,
ol.s_resourceassignment_id,
ol.user1_id AS c_orderline_user1_id,
ol.user2_id AS c_orderline_user2_id,
uom.ad_org_id AS c_uom_ad_org_id,
uom.costingprecision,
uom.description AS c_uom_description,
uom.isactive AS c_uom_isactive,
uom.isdefault,
uom.name AS c_uom_name,
uom.stdprecision,
uom.uomtype,
uom.x12de355,
i.ad_org_id AS c_order_ad_org_id,
i.ad_orgtrx_id AS c_order_ad_orgtrx_id,
i.ad_user_id,
i.amountrefunded,
i.amounttendered,
i.bill_bpartner_id,
i.bill_location_id,
i.bill_user_id,
i.c_activity_id AS c_order_c_activity_id,
i.c_bpartner_id AS c_order_c_bpartner_id,
i.c_campaign_id AS c_order_c_campaign_id,
i.c_cashline_id,
i.c_cashplanline_id,
i.c_charge_id AS c_order_c_charge_id,
i.c_conversiontype_id,
i.c_currency_id AS c_order_c_currency_id,
i.c_doctype_id,
i.c_doctypetarget_id,
i.chargeamt,
i.copyfrom,
i.c_payment_id,
i.c_paymentterm_id,
i.c_pos_id,
i.c_project_id AS c_order_c_project_id,
i.created AS c_order_created,
i.createdby AS c_order_createdby,
i.dateacct,
i.dateprinted,
i.datepromised AS c_order_datepromised,
i.deliveryrule,
i.deliveryviarule,
i.description AS c_order_description,
i.docaction,
i.docstatus,
i.documentno,
i.dropship_bpartner_id,
i.dropship_location_id,
i.dropship_user_id,
i.freightamt AS c_order_freightamt,
i.freightcostrule,
i.grandtotal,
i.invoicerule,
i.isactive AS c_order_isactive,
i.isapproved,
i.iscreditapproved,
i.isdelivered,
i.isdiscountprinted AS c_order_isdiscountprinted,
i.isdropship AS c_order_isdropship,
i.isinvoiced,
i.ispayschedulevalid,
i.isprinted,
i.isselected,
i.isselfservice AS c_order_isselfservice,
i.issotrx,
i.istaxincluded,
i.istransferred,
i.link_order_id,
i.m_freightcategory_id AS c_order_m_freightcategory_id,
i.m_pricelist_id AS c_order_m_pricelist_id,
i.m_shipper_id AS c_order_m_shipper_id,
i.m_warehouse_id AS c_order_m_warehouse_id,
i.ordertype,
i.pay_bpartner_id,
i.pay_location_id,
i.paymentrule AS c_order_paymentrule,
i.poreference,
i.posted,
i.priorityrule,
i.processed AS c_order_processed,
i.processedon,
i.promotioncode,
i.ref_order_id,
i.salesrep_id,
i.sendemail AS c_order_sendemail,
i.totallines,
i.updated AS c_order_updated,
i.updatedby AS c_order_updatedby,
i.user1_id AS c_order_user1_id,
i.user2_id AS c_order_user2_id,
i.volume AS c_order_volume,
i.weight AS c_order_weight,
p.ad_org_id AS m_product_ad_org_id,
p.classification,
p.copyfrom AS m_product_copyfrom,
p.created AS m_product_created,
p.createdby AS m_product_createdby,
p.c_revenuerecognition_id,
p.c_subscriptiontype_id,
p.c_taxcategory_id,
p.c_uom_id AS m_product_c_uom_id,
p.descriptionurl,
p.discontinued AS m_product_discontinued,
p.discontinuedat AS m_product_discontinuedat,
p.group1,
p.group2,
p.guaranteedays,
p.guaranteedaysmin,
p.help,
p.isactive AS m_product_isactive,
p.isbom,
p.isdropship AS m_product_isdropship,
p.isexcludeautodelivery,
p.isinvoiceprintdetails,
p.ispicklistprintdetails,
p.ispurchased,
p.isselfservice AS m_product_isselfservice,
p.issold,
p.isstocked,
p.issummary AS m_product_issummary,
p.isverified,
p.iswebstorefeatured,
p.lowlevel,
p.m_attributeset_id,
p.m_attributesetinstance_id,
p.m_freightcategory_id AS m_product_m_freightcategory_id,
p.m_locator_id,
p.m_product_category_id AS m_product_product_category_id,
p.processing AS m_product_processing,
p.producttype,
p.r_mailtext_id,
p.salesrep_id AS m_product_salesrep_id,
p.s_expensetype_id,
p.shelfdepth,
p.shelfheight,
p.shelfwidth,
p.s_resource_id,
p.unitsperpack,
p.unitsperpallet,
p.updated AS m_product_updated,
p.updatedby AS m_product_updatedby,
p.versionno,
p.volume AS m_product_volume,
p.weight AS m_product_weight,
po.ad_org_id AS m_product_po_ad_org_id,
po.c_bpartner_id AS m_product_po_c_bpartner_id,
po.c_currency_id AS m_product_po_c_currency_id,
po.costperorder,
po.created AS m_product_po_created,
po.createdby AS m_product_po_createdby,
po.c_uom_id AS m_product_po_c_uom_id,
po.deliverytime_actual,
po.deliverytime_promised,
po.discontinued AS m_product_po_discontinued,
po.discontinuedat AS m_product_po_discontinuedat,
po.isactive AS m_product_po_isactive,
po.iscurrentvendor,
po.manufacturer AS m_product_po_manufacturer,
po.m_product_id AS m_product_po_m_product_id,
po.order_min,
po.order_pack,
po.priceeffective,
po.pricelastinv,
po.pricelastpo,
po.pricelist AS m_product_po_pricelist,
po.pricepo,
po.qualityrating AS m_product_po_qualityrating,
po.royaltyamt,
po.upc AS m_product_po_upc,
po.updated AS m_product_po_updated,
po.updatedby AS m_product_po_updatedby,
po.vendorcategory AS m_product_po_vendorcategory,
ra.ad_org_id AS s_resourceassignment_ad_org_id,
ra.assigndatefrom,
ra.assigndateto,
ra.created AS s_resourceassignment_created,
ra.createdby AS s_resourceassignment_createby,
ra.isactive AS s_resourceassignment_isactive,
ra.isconfirmed,
ra.name AS s_resourceassignment_name,
ra.qty AS s_resourceassignment_qty,
ra.s_resource_id AS s_resourceassignment_s_resour,
ra.updated AS s_resourceassignment_updated,
ra.updatedby AS s_resourceassignment_updatedby,
c.ad_org_id AS c_charge_c_org_id,
c.c_bpartner_id AS c_charge_c_bpartner_id,
c.c_chargetype_id,
c.chargeamt AS c_charge_chargeamt,
c.c_taxcategory_id AS c_charge_c_taxcategory_id,
c.description AS c_charge_description,
c.isactive AS c_charge_isactive,
c.issamecurrency,
c.issametax,
c.istaxincluded AS c_charge_istaxincluded,
pp.ad_org_id AS c_bpartner_product_ad_org_id,
pp.c_bpartner_id AS c_bp_product_c_bpartner_id,
pp.created AS c_bpartner_product_created,
pp.createdby AS c_bpartner_product_createdby,
pp.description AS c_bpartner_product_description,
pp.isactive AS c_bpartner_product_isactive,
pp.ismanufacturer,
pp.manufacturer AS c_bpartner_product_manufactur,
pp.qualityrating AS c_bpartner_product_qualityrat,
pp.shelflifemindays,
pp.shelflifeminpct AS c_bpartner_product_shelflifem,
pp.updated AS c_bpartner_product_updated,
pp.updatedby AS c_bpartner_product_updatedby,
pp.vendorcategory AS c_bpartner_product_vendorcate,
bp.acqusitioncost,
bp.actuallifetimevalue,
bp.ad_language AS c_bpartner_ad_language,
bp.ad_orgbp_id,
bp.ad_org_id AS c_bpartner_ad_org_id,
bp.bpartner_parent_id,
bp.c_bp_group_id,
bp.c_dunning_id,
bp.c_greeting_id,
bp.c_invoiceschedule_id,
bp.c_paymentterm_id AS c_bpartner_c_paymentterm_id,
bp.created AS c_bpartner_created,
bp.createdby AS c_bpartner_createdby,
bp.c_taxgroup_id AS c_bpartner_c_taxgroup_id,
bp.deliveryrule AS c_bpartner_deliveryrule,
bp.deliveryviarule AS c_bpartner_deliveryviarule,
bp.description AS c_bpartner_description,
bp.dunninggrace AS c_bpartner_dunninggrace,
bp.duns,
bp.firstsale AS c_bpartner_firstsale,
bp.flatdiscount AS c_bpartner_flatdiscount,
bp.freightcostrule AS c_bpartner_freightcostrule,
bp.invoicerule AS c_bpartner_invoicerule,
bp.isactive AS c_bpartner_isactive,
bp.iscustomer,
bp.isdiscountprinted AS c_bpartner_isdiscountprinted,
bp.isemployee AS c_bpartner_isemployee,
bp.ismanufacturer AS c_bpartner_ismanufacturer,
bp.isonetime,
bp.ispotaxexempt,
bp.isprospect,
bp.issalesrep,
bp.issummary AS c_bpartner_issummary,
bp.istaxexempt AS c_bpartner_istaxexempt,
bp.isvendor,
bp.logo_id,
bp.m_discountschema_id,
bp.m_pricelist_id AS c_bpartner_m_pricelist_id,
bp.naics,
bp.name AS c_bpartner_name,
bp.name2 AS c_bpartner_name2,
bp.numberemployees,
bp.paymentrule AS c_bpartner_paymentrule,
bp.paymentrulepo,
bp.po_discountschema_id,
bp.po_paymentterm_id,
bp.po_pricelist_id,
bp.poreference AS c_bpartner_poreference,
bp.potentiallifetimevalue,
bp.rating AS c_bpartner_rating,
bp.referenceno AS c_bpartner_referenceno,
bp.salesrep_id AS c_bpartner_salesrep_id,
bp.salesvolume,
bp.sendemail AS c_bpartner_sendemail,
bp.shareofcustomer,
bp.shelflifeminpct AS c_bpartner_shelflifeminpct,
bp.so_creditlimit,
bp.socreditstatus,
bp.so_creditused,
bp.so_description,
bp.taxid AS c_bpartner_taxid,
bp.totalopenbalance,
bp.updated AS c_bpartner_updated,
bp.updatedby AS c_bpartner_updatedby,
bp.url AS c_bpartner_url,
bp.value AS c_bpartner_value,
bpl.ad_org_id AS c_bpartner_location_ad_org_id,
bpl.c_bpartner_id AS c_bpartner_location_c_bpartne,
bpl.created AS c_bpartner_location_created,
bpl.createdby AS c_bpartner_location_createdby,
bpl.c_salesregion_id,
bpl.fax AS c_bpartner_location_fax,
bpl.isactive AS c_bpartner_location_isactive,
bpl.isbillto,
bpl.isdn,
bpl.ispayfrom,
bpl.isremitto,
bpl.isshipto,
bpl.name AS c_bpartner_location_name,
bpl.phone AS c_bpartner_location_phone,
bpl.phone2 AS c_bpartner_location_phone2,
bpl.updated AS c_bpartner_location_updated,
bpl.updatedby AS c_bpartner_location_updatedby,
t.ad_org_id AS c_tax_ad_org_id,
t.ad_rule_id,
t.c_country_id,
t.c_region_id,
t.c_taxcategory_id AS c_tax_c_taxcategory_id,
t.description AS c_tax_description,
t.isactive AS c_tax_isactive,
t.isdefault AS c_tax_isdefault,
t.isdocumentlevel,
t.issalestax,
t.issummary AS c_tax_issummary,
t.istaxexempt AS c_tax_istaxexempt,
t.name AS c_tax_name,
t.parent_tax_id,
t.rate,
t.requirestaxcertificate,
t.sopotype,
t.to_country_id,
t.to_region_id AS c_tax_to_region_id,
t.validfrom
FROM ((((((((((c_orderline ol
JOIN c_uom uom ON ((ol.c_uom_id = uom.c_uom_id)))
JOIN c_order i ON ((ol.c_order_id = i.c_order_id)))
LEFT JOIN m_product p ON ((ol.m_product_id = p.m_product_id)))
LEFT JOIN m_product_po po ON (((p.m_product_id = po.m_product_id) AND (i.c_bpartner_id = po.c_bpartner_id))))
LEFT JOIN s_resourceassignment ra ON ((ol.s_resourceassignment_id = ra.s_resourceassignment_id)))
LEFT JOIN c_charge c ON ((ol.c_charge_id = c.c_charge_id)))
LEFT JOIN c_bpartner_product pp ON (((ol.m_product_id = pp.m_product_id) AND (i.c_bpartner_id = pp.c_bpartner_id))))
JOIN c_bpartner bp ON ((ol.c_bpartner_id = bp.c_bpartner_id)))
JOIN c_bpartner_location bpl ON ((ol.c_bpartner_location_id = bpl.c_bpartner_location_id)))
LEFT JOIN c_tax t ON ((ol.c_tax_id = t.c_tax_id)))
UNION
SELECT ol.ad_client_id,
ol.ad_org_id,
ol.isactive,
ol.created,
ol.createdby,
ol.updated,
ol.updatedby,
'en_US'::text AS ad_language,
ol.c_order_id,
ol.c_orderline_id,
ol.c_tax_id,
NULL::character varying AS taxindicator,
NULL::numeric AS c_bpartner_id,
NULL::numeric AS c_bpartner_location_id,
NULL::character varying AS bpname,
NULL::numeric AS c_location_id,
(ol.line + (bl.line / (100)::numeric)) AS line,
p.m_product_id,
po.vendorproductno,
CASE
WHEN (bl.isqtypercentage = 'N'::bpchar) THEN (ol.qtyordered * bl.qtybom)
ELSE (ol.qtyordered * (bl.qtybatch / (100)::numeric))
END AS qtyordered,
CASE
WHEN (bl.isqtypercentage = 'N'::bpchar) THEN (ol.qtyentered * bl.qtybom)
ELSE (ol.qtyentered * (bl.qtybatch / (100)::numeric))
END AS qtyentered,
uom.uomsymbol,
p.name,
bl.description,
p.documentnote,
p.upc,
p.sku,
p.value AS productvalue,
NULL::character varying AS resourcedescription,
NULL::numeric AS pricelist,
NULL::numeric AS priceenteredlist,
NULL::numeric AS discount,
NULL::numeric AS priceactual,
NULL::numeric AS priceentered,
NULL::numeric AS linenetamt,
p.description AS productdescription,
p.imageurl,
ol.c_campaign_id,
ol.c_project_id,
ol.c_activity_id,
ol.c_projectphase_id,
ol.c_projecttask_id,
ol.ad_orgtrx_id AS c_orderline_ad_orgtrx_id,
ol.c_charge_id AS c_orderline_c_charge_id,
ol.c_currency_id AS c_orderline_c_currency_id,
ol.c_uom_id,
ol.datedelivered,
ol.dateinvoiced,
ol.dateordered,
ol.datepromised AS c_orderline_datepromised,
ol.freightamt AS c_orderline_freightamt,
ol.isdescription,
ol.link_orderline_id,
ol.m_promotion_id,
ol.m_shipper_id AS c_orderline_m_shipper_id,
ol.m_warehouse_id AS c_orderline_m_warehouse_id,
ol.pricecost,
ol.pricelimit,
ol.processed AS c_orderline_processed,
ol.qtydelivered,
ol.qtyinvoiced,
ol.qtylostsales,
ol.qtyreserved,
ol.ref_orderline_id,
ol.rramt,
ol.rrstartdate,
ol.s_resourceassignment_id,
ol.user1_id AS c_orderline_user1_id,
ol.user2_id AS c_orderline_user2_id,
uom.ad_org_id AS c_uom_ad_org_id,
uom.costingprecision,
uom.description AS c_uom_description,
uom.isactive AS c_uom_isactive,
uom.isdefault,
uom.name AS c_uom_name,
uom.stdprecision,
uom.uomtype,
uom.x12de355,
i.ad_org_id AS c_order_ad_org_id,
i.ad_orgtrx_id AS c_order_ad_orgtrx_id,
i.ad_user_id,
i.amountrefunded,
i.amounttendered,
i.bill_bpartner_id,
i.bill_location_id,
i.bill_user_id,
i.c_activity_id AS c_order_c_activity_id,
i.c_bpartner_id AS c_order_c_bpartner_id,
i.c_campaign_id AS c_order_c_campaign_id,
i.c_cashline_id,
i.c_cashplanline_id,
i.c_charge_id AS c_order_c_charge_id,
i.c_conversiontype_id,
i.c_currency_id AS c_order_c_currency_id,
i.c_doctype_id,
i.c_doctypetarget_id,
i.chargeamt,
i.copyfrom,
i.c_payment_id,
i.c_paymentterm_id,
i.c_pos_id,
i.c_project_id AS c_order_c_project_id,
i.created AS c_order_created,
i.createdby AS c_order_createdby,
i.dateacct,
i.dateprinted,
i.datepromised AS c_order_datepromised,
i.deliveryrule,
i.deliveryviarule,
i.description AS c_order_description,
i.docaction,
i.docstatus,
i.documentno,
i.dropship_bpartner_id,
i.dropship_location_id,
i.dropship_user_id,
i.freightamt AS c_order_freightamt,
i.freightcostrule,
i.grandtotal,
i.invoicerule,
i.isactive AS c_order_isactive,
i.isapproved,
i.iscreditapproved,
i.isdelivered,
i.isdiscountprinted AS c_order_isdiscountprinted,
i.isdropship AS c_order_isdropship,
i.isinvoiced,
i.ispayschedulevalid,
i.isprinted,
i.isselected,
i.isselfservice AS c_order_isselfservice,
i.issotrx,
i.istaxincluded,
i.istransferred,
i.link_order_id,
i.m_freightcategory_id AS c_order_m_freightcategory_id,
i.m_pricelist_id AS c_order_m_pricelist_id,
i.m_shipper_id AS c_order_m_shipper_id,
i.m_warehouse_id AS c_order_m_warehouse_id,
i.ordertype,
i.pay_bpartner_id,
i.pay_location_id,
i.paymentrule AS c_order_paymentrule,
i.poreference,
i.posted,
i.priorityrule,
i.processed AS c_order_processed,
i.processedon,
i.promotioncode,
i.ref_order_id,
i.salesrep_id,
i.sendemail AS c_order_sendemail,
i.totallines,
i.updated AS c_order_updated,
i.updatedby AS c_order_updatedby,
i.user1_id AS c_order_user1_id,
i.user2_id AS c_order_user2_id,
i.volume AS c_order_volume,
i.weight AS c_order_weight,
p.ad_org_id AS m_product_ad_org_id,
p.classification,
p.copyfrom AS m_product_copyfrom,
p.created AS m_product_created,
p.createdby AS m_product_createdby,
p.c_revenuerecognition_id,
p.c_subscriptiontype_id,
p.c_taxcategory_id,
p.c_uom_id AS m_product_c_uom_id,
p.descriptionurl,
p.discontinued AS m_product_discontinued,
p.discontinuedat AS m_product_discontinuedat,
p.group1,
p.group2,
p.guaranteedays,
p.guaranteedaysmin,
p.help,
p.isactive AS m_product_isactive,
p.isbom,
p.isdropship AS m_product_isdropship,
p.isexcludeautodelivery,
p.isinvoiceprintdetails,
p.ispicklistprintdetails,
p.ispurchased,
p.isselfservice AS m_product_isselfservice,
p.issold,
p.isstocked,
p.issummary AS m_product_issummary,
p.isverified,
p.iswebstorefeatured,
p.lowlevel,
p.m_attributeset_id,
p.m_attributesetinstance_id,
p.m_freightcategory_id AS m_product_m_freightcategory_id,
p.m_locator_id,
p.m_product_category_id AS m_product_product_category_id,
p.processing AS m_product_processing,
p.producttype,
p.r_mailtext_id,
p.salesrep_id AS m_product_salesrep_id,
p.s_expensetype_id,
p.shelfdepth,
p.shelfheight,
p.shelfwidth,
p.s_resource_id,
p.unitsperpack,
p.unitsperpallet,
p.updated AS m_product_updated,
p.updatedby AS m_product_updatedby,
p.versionno,
p.volume AS m_product_volume,
p.weight AS m_product_weight,
po.ad_org_id AS m_product_po_ad_org_id,
po.c_bpartner_id AS m_product_po_c_bpartner_id,
po.c_currency_id AS m_product_po_c_currency_id,
po.costperorder,
po.created AS m_product_po_created,
po.createdby AS m_product_po_createdby,
po.c_uom_id AS m_product_po_c_uom_id,
po.deliverytime_actual,
po.deliverytime_promised,
po.discontinued AS m_product_po_discontinued,
po.discontinuedat AS m_product_po_discontinuedat,
po.isactive AS m_product_po_isactive,
po.iscurrentvendor,
po.manufacturer AS m_product_po_manufacturer,
po.m_product_id AS m_product_po_m_product_id,
po.order_min,
po.order_pack,
po.priceeffective,
po.pricelastinv,
po.pricelastpo,
po.pricelist AS m_product_po_pricelist,
po.pricepo,
po.qualityrating AS m_product_po_qualityrating,
po.royaltyamt,
po.upc AS m_product_po_upc,
po.updated AS m_product_po_updated,
po.updatedby AS m_product_po_updatedby,
po.vendorcategory AS m_product_po_vendorcategory,
NULL::numeric AS s_resourceassignment_ad_org_id,
NULL::timestamp without time zone AS assigndatefrom,
NULL::timestamp without time zone AS assigndateto,
NULL::timestamp without time zone AS s_resourceassignment_created,
NULL::numeric AS s_resourceassignment_createby,
NULL::bpchar AS s_resourceassignment_isactive,
NULL::bpchar AS isconfirmed,
NULL::character varying AS s_resourceassignment_name,
NULL::numeric AS s_resourceassignment_qty,
NULL::numeric AS s_resourceassignment_s_resour,
NULL::timestamp without time zone AS s_resourceassignment_updated,
NULL::numeric AS s_resourceassignment_updatedby,
NULL::numeric AS c_charge_c_org_id,
NULL::numeric AS c_charge_c_bpartner_id,
NULL::numeric AS c_chargetype_id,
NULL::numeric AS c_charge_chargeamt,
NULL::numeric AS c_charge_c_taxcategory_id,
NULL::character varying AS c_charge_description,
NULL::bpchar AS c_charge_isactive,
NULL::bpchar AS issamecurrency,
NULL::bpchar AS issametax,
NULL::bpchar AS c_charge_istaxincluded,
NULL::numeric AS c_bpartner_product_ad_org_id,
NULL::numeric AS c_bp_product_c_bpartner_id,
NULL::timestamp without time zone AS c_bpartner_product_created,
NULL::numeric AS c_bpartner_product_createdby,
NULL::character varying AS c_bpartner_product_description,
NULL::bpchar AS c_bpartner_product_isactive,
NULL::bpchar AS ismanufacturer,
NULL::character varying AS c_bpartner_product_manufactur,
NULL::numeric AS c_bpartner_product_qualityrat,
NULL::numeric AS shelflifemindays,
NULL::numeric AS c_bpartner_product_shelflifem,
NULL::timestamp without time zone AS c_bpartner_product_updated,
NULL::numeric AS c_bpartner_product_updatedby,
NULL::character varying AS c_bpartner_product_vendorcate,
NULL::numeric AS acqusitioncost,
NULL::numeric AS actuallifetimevalue,
NULL::character varying AS c_bpartner_ad_language,
NULL::numeric AS ad_orgbp_id,
NULL::numeric AS c_bpartner_ad_org_id,
NULL::numeric AS bpartner_parent_id,
NULL::numeric AS c_bp_group_id,
NULL::numeric AS c_dunning_id,
NULL::numeric AS c_greeting_id,
NULL::numeric AS c_invoiceschedule_id,
NULL::numeric AS c_bpartner_c_paymentterm_id,
NULL::timestamp without time zone AS c_bpartner_created,
NULL::numeric AS c_bpartner_createdby,
NULL::numeric AS c_bpartner_c_taxgroup_id,
NULL::bpchar AS c_bpartner_deliveryrule,
NULL::bpchar AS c_bpartner_deliveryviarule,
NULL::character varying AS c_bpartner_description,
NULL::date AS c_bpartner_dunninggrace,
NULL::bpchar AS duns,
NULL::timestamp without time zone AS c_bpartner_firstsale,
NULL::numeric AS c_bpartner_flatdiscount,
NULL::bpchar AS c_bpartner_freightcostrule,
NULL::bpchar AS c_bpartner_invoicerule,
NULL::bpchar AS c_bpartner_isactive,
NULL::bpchar AS iscustomer,
NULL::bpchar AS c_bpartner_isdiscountprinted,
NULL::bpchar AS c_bpartner_isemployee,
NULL::bpchar AS c_bpartner_ismanufacturer,
NULL::bpchar AS isonetime,
NULL::bpchar AS ispotaxexempt,
NULL::bpchar AS isprospect,
NULL::bpchar AS issalesrep,
NULL::bpchar AS c_bpartner_issummary,
NULL::bpchar AS c_bpartner_istaxexempt,
NULL::bpchar AS isvendor,
NULL::numeric AS logo_id,
NULL::numeric AS m_discountschema_id,
NULL::numeric AS c_bpartner_m_pricelist_id,
NULL::bpchar AS naics,
NULL::character varying AS c_bpartner_name,
NULL::character varying AS c_bpartner_name2,
NULL::numeric AS numberemployees,
NULL::bpchar AS c_bpartner_paymentrule,
NULL::bpchar AS paymentrulepo,
NULL::numeric AS po_discountschema_id,
NULL::numeric AS po_paymentterm_id,
NULL::numeric AS po_pricelist_id,
NULL::character varying AS c_bpartner_poreference,
NULL::numeric AS potentiallifetimevalue,
NULL::bpchar AS c_bpartner_rating,
NULL::character varying AS c_bpartner_referenceno,
NULL::numeric AS c_bpartner_salesrep_id,
NULL::numeric AS salesvolume,
NULL::bpchar AS c_bpartner_sendemail,
NULL::numeric AS shareofcustomer,
NULL::numeric AS c_bpartner_shelflifeminpct,
NULL::numeric AS so_creditlimit,
NULL::bpchar AS socreditstatus,
NULL::numeric AS so_creditused,
NULL::character varying AS so_description,
NULL::character varying AS c_bpartner_taxid,
NULL::numeric AS totalopenbalance,
NULL::timestamp without time zone AS c_bpartner_updated,
NULL::numeric AS c_bpartner_updatedby,
NULL::character varying AS c_bpartner_url,
NULL::character varying AS c_bpartner_value,
NULL::numeric AS c_bpartner_location_ad_org_id,
NULL::numeric AS c_bpartner_location_c_bpartne,
NULL::timestamp without time zone AS c_bpartner_location_created,
NULL::numeric AS c_bpartner_location_createdby,
NULL::numeric AS c_salesregion_id,
NULL::character varying AS c_bpartner_location_fax,
NULL::bpchar AS c_bpartner_location_isactive,
NULL::bpchar AS isbillto,
NULL::character varying AS isdn,
NULL::bpchar AS ispayfrom,
NULL::bpchar AS isremitto,
NULL::bpchar AS isshipto,
NULL::character varying AS c_bpartner_location_name,
NULL::character varying AS c_bpartner_location_phone,
NULL::character varying AS c_bpartner_location_phone2,
NULL::timestamp without time zone AS c_bpartner_location_updated,
NULL::numeric AS c_bpartner_location_updatedby,
NULL::numeric AS c_tax_ad_org_id,
NULL::numeric AS ad_rule_id,
NULL::numeric AS c_country_id,
NULL::numeric AS c_region_id,
NULL::numeric AS c_tax_c_taxcategory_id,
NULL::character varying AS c_tax_description,
NULL::bpchar AS c_tax_isactive,
NULL::bpchar AS c_tax_isdefault,
NULL::bpchar AS isdocumentlevel,
NULL::bpchar AS issalestax,
NULL::bpchar AS c_tax_issummary,
NULL::bpchar AS c_tax_istaxexempt,
NULL::character varying AS c_tax_name,
NULL::numeric AS parent_tax_id,
NULL::numeric AS rate,
NULL::bpchar AS requirestaxcertificate,
NULL::bpchar AS sopotype,
NULL::numeric AS to_country_id,
NULL::numeric AS c_tax_to_region_id,
NULL::timestamp without time zone AS validfrom
FROM (((((((pp_product_bom b
JOIN c_orderline ol ON ((b.m_product_id = ol.m_product_id)))
JOIN c_order i ON ((ol.c_order_id = i.c_order_id)))
JOIN m_product bp ON (((((bp.m_product_id = ol.m_product_id) AND (bp.isbom = 'Y'::bpchar)) AND (bp.isverified = 'Y'::bpchar)) AND (bp.isinvoiceprintdetails = 'Y'::bpchar))))
JOIN pp_product_bomline bl ON ((bl.pp_product_bom_id = b.pp_product_bom_id)))
JOIN m_product p ON ((p.m_product_id = bl.m_product_id)))
LEFT JOIN m_product_po po ON (((p.m_product_id = po.m_product_id) AND (i.c_bpartner_id = po.c_bpartner_id))))
JOIN c_uom uom ON ((p.c_uom_id = uom.c_uom_id)))
UNION
SELECT i.ad_client_id,
i.ad_org_id,
i.isactive,
i.created,
i.createdby,
i.updated,
i.updatedby,
'en_US'::text AS ad_language,
i.c_order_id,
NULL::numeric AS c_orderline_id,
NULL::numeric AS c_tax_id,
NULL::character varying AS taxindicator,
NULL::numeric AS c_bpartner_id,
NULL::numeric AS c_bpartner_location_id,
NULL::character varying AS bpname,
NULL::numeric AS c_location_id,
NULL::numeric AS line,
NULL::numeric AS m_product_id,
NULL::character varying AS vendorproductno,
NULL::numeric AS qtyordered,
NULL::numeric AS qtyentered,
NULL::character varying AS uomsymbol,
NULL::character varying AS name,
NULL::character varying AS description,
NULL::character varying AS documentnote,
NULL::character varying AS upc,
NULL::character varying AS sku,
NULL::character varying AS productvalue,
NULL::character varying AS resourcedescription,
NULL::numeric AS pricelist,
NULL::numeric AS priceenteredlist,
NULL::numeric AS discount,
NULL::numeric AS priceactual,
NULL::numeric AS priceentered,
NULL::numeric AS linenetamt,
NULL::character varying AS productdescription,
NULL::character varying AS imageurl,
NULL::numeric AS c_campaign_id,
NULL::numeric AS c_project_id,
NULL::numeric AS c_activity_id,
NULL::numeric AS c_projectphase_id,
NULL::numeric AS c_projecttask_id,
NULL::numeric AS c_orderline_ad_orgtrx_id,
NULL::numeric AS c_orderline_c_charge_id,
NULL::numeric AS c_orderline_c_currency_id,
NULL::numeric AS c_uom_id,
NULL::timestamp without time zone AS datedelivered,
NULL::timestamp without time zone AS dateinvoiced,
NULL::timestamp without time zone AS dateordered,
NULL::timestamp without time zone AS c_orderline_datepromised,
NULL::numeric AS c_orderline_freightamt,
NULL::bpchar AS isdescription,
NULL::numeric AS link_orderline_id,
NULL::numeric AS m_promotion_id,
NULL::numeric AS c_orderline_m_shipper_id,
NULL::numeric AS c_orderline_m_warehouse_id,
NULL::numeric AS pricecost,
NULL::numeric AS pricelimit,
NULL::bpchar AS c_orderline_processed,
NULL::numeric AS qtydelivered,
NULL::numeric AS qtyinvoiced,
NULL::numeric AS qtylostsales,
NULL::numeric AS qtyreserved,
NULL::numeric AS ref_orderline_id,
NULL::numeric AS rramt,
NULL::timestamp without time zone AS rrstartdate,
NULL::numeric AS s_resourceassignment_id,
NULL::numeric AS c_orderline_user1_id,
NULL::numeric AS c_orderline_user2_id,
NULL::numeric AS c_uom_ad_org_id,
NULL::numeric AS costingprecision,
NULL::character varying AS c_uom_description,
NULL::bpchar AS c_uom_isactive,
NULL::bpchar AS isdefault,
NULL::character varying AS c_uom_name,
NULL::numeric AS stdprecision,
NULL::character varying AS uomtype,
NULL::character varying AS x12de355,
NULL::numeric AS c_order_ad_org_id,
NULL::numeric AS c_order_ad_orgtrx_id,
NULL::numeric AS ad_user_id,
NULL::numeric AS amountrefunded,
NULL::numeric AS amounttendered,
NULL::numeric AS bill_bpartner_id,
NULL::numeric AS bill_location_id,
NULL::numeric AS bill_user_id,
NULL::numeric AS c_order_c_activity_id,
NULL::numeric AS c_order_c_bpartner_id,
NULL::numeric AS c_order_c_campaign_id,
NULL::numeric AS c_cashline_id,
NULL::numeric AS c_cashplanline_id,
NULL::numeric AS c_order_c_charge_id,
NULL::numeric AS c_conversiontype_id,
NULL::numeric AS c_order_c_currency_id,
NULL::numeric AS c_doctype_id,
NULL::numeric AS c_doctypetarget_id,
NULL::numeric AS chargeamt,
NULL::bpchar AS copyfrom,
NULL::numeric AS c_payment_id,
NULL::numeric AS c_paymentterm_id,
NULL::numeric AS c_pos_id,
NULL::numeric AS c_order_c_project_id,
NULL::timestamp without time zone AS c_order_created,
NULL::numeric AS c_order_createdby,
NULL::timestamp without time zone AS dateacct,
NULL::timestamp without time zone AS dateprinted,
NULL::timestamp without time zone AS c_order_datepromised,
NULL::bpchar AS deliveryrule,
NULL::bpchar AS deliveryviarule,
NULL::character varying AS c_order_description,
NULL::bpchar AS docaction,
NULL::bpchar AS docstatus,
NULL::character varying AS documentno,
NULL::numeric AS dropship_bpartner_id,
NULL::numeric AS dropship_location_id,
NULL::numeric AS dropship_user_id,
NULL::numeric AS c_order_freightamt,
NULL::bpchar AS freightcostrule,
NULL::numeric AS grandtotal,
NULL::bpchar AS invoicerule,
NULL::bpchar AS c_order_isactive,
NULL::bpchar AS isapproved,
NULL::bpchar AS iscreditapproved,
NULL::bpchar AS isdelivered,
NULL::bpchar AS c_order_isdiscountprinted,
NULL::bpchar AS c_order_isdropship,
NULL::bpchar AS isinvoiced,
NULL::bpchar AS ispayschedulevalid,
NULL::bpchar AS isprinted,
NULL::bpchar AS isselected,
NULL::bpchar AS c_order_isselfservice,
NULL::bpchar AS issotrx,
NULL::bpchar AS istaxincluded,
NULL::bpchar AS istransferred,
NULL::numeric AS link_order_id,
NULL::numeric AS c_order_m_freightcategory_id,
NULL::numeric AS c_order_m_pricelist_id,
NULL::numeric AS c_order_m_shipper_id,
NULL::numeric AS c_order_m_warehouse_id,
NULL::character varying AS ordertype,
NULL::numeric AS pay_bpartner_id,
NULL::numeric AS pay_location_id,
NULL::bpchar AS c_order_paymentrule,
NULL::character varying AS poreference,
NULL::bpchar AS posted,
NULL::bpchar AS priorityrule,
NULL::bpchar AS c_order_processed,
NULL::numeric AS processedon,
NULL::character varying AS promotioncode,
NULL::numeric AS ref_order_id,
NULL::numeric AS salesrep_id,
NULL::bpchar AS c_order_sendemail,
NULL::numeric AS totallines,
NULL::timestamp without time zone AS c_order_updated,
NULL::numeric AS c_order_updatedby,
NULL::numeric AS c_order_user1_id,
NULL::numeric AS c_order_user2_id,
NULL::numeric AS c_order_volume,
NULL::numeric AS c_order_weight,
NULL::numeric AS m_product_ad_org_id,
NULL::character varying AS classification,
NULL::bpchar AS m_product_copyfrom,
NULL::timestamp without time zone AS m_product_created,
NULL::numeric AS m_product_createdby,
NULL::numeric AS c_revenuerecognition_id,
NULL::numeric AS c_subscriptiontype_id,
NULL::numeric AS c_taxcategory_id,
NULL::numeric AS m_product_c_uom_id,
NULL::character varying AS descriptionurl,
NULL::bpchar AS m_product_discontinued,
NULL::timestamp without time zone AS m_product_discontinuedat,
NULL::character varying AS group1,
NULL::character varying AS group2,
NULL::numeric AS guaranteedays,
NULL::numeric AS guaranteedaysmin,
NULL::character varying AS help,
NULL::bpchar AS m_product_isactive,
NULL::bpchar AS isbom,
NULL::bpchar AS m_product_isdropship,
NULL::bpchar AS isexcludeautodelivery,
NULL::bpchar AS isinvoiceprintdetails,
NULL::bpchar AS ispicklistprintdetails,
NULL::bpchar AS ispurchased,
NULL::bpchar AS m_product_isselfservice,
NULL::bpchar AS issold,
NULL::bpchar AS isstocked,
NULL::bpchar AS m_product_issummary,
NULL::bpchar AS isverified,
NULL::bpchar AS iswebstorefeatured,
NULL::numeric AS lowlevel,
NULL::numeric AS m_attributeset_id,
NULL::numeric AS m_attributesetinstance_id,
NULL::numeric AS m_product_m_freightcategory_id,
NULL::numeric AS m_locator_id,
NULL::numeric AS m_product_product_category_id,
NULL::bpchar AS m_product_processing,
NULL::bpchar AS producttype,
NULL::numeric AS r_mailtext_id,
NULL::numeric AS m_product_salesrep_id,
NULL::numeric AS s_expensetype_id,
NULL::numeric AS shelfdepth,
NULL::numeric AS shelfheight,
NULL::numeric AS shelfwidth,
NULL::numeric AS s_resource_id,
NULL::numeric AS unitsperpack,
NULL::numeric AS unitsperpallet,
NULL::timestamp without time zone AS m_product_updated,
NULL::numeric AS m_product_updatedby,
NULL::character varying AS versionno,
NULL::numeric AS m_product_volume,
NULL::numeric AS m_product_weight,
NULL::numeric AS m_product_po_ad_org_id,
NULL::numeric AS m_product_po_c_bpartner_id,
NULL::numeric AS m_product_po_c_currency_id,
NULL::numeric AS costperorder,
NULL::timestamp without time zone AS m_product_po_created,
NULL::numeric AS m_product_po_createdby,
NULL::numeric AS m_product_po_c_uom_id,
NULL::numeric AS deliverytime_actual,
NULL::numeric AS deliverytime_promised,
NULL::bpchar AS m_product_po_discontinued,
NULL::timestamp without time zone AS m_product_po_discontinuedat,
NULL::bpchar AS m_product_po_isactive,
NULL::bpchar AS iscurrentvendor,
NULL::bpchar AS m_product_po_manufacturer,
NULL::numeric AS m_product_po_m_product_id,
NULL::numeric AS order_min,
NULL::numeric AS order_pack,
NULL::timestamp without time zone AS priceeffective,
NULL::numeric AS pricelastinv,
NULL::numeric AS pricelastpo,
NULL::numeric AS m_product_po_pricelist,
NULL::numeric AS pricepo,
NULL::numeric AS m_product_po_qualityrating,
NULL::numeric AS royaltyamt,
NULL::character varying AS m_product_po_upc,
NULL::timestamp without time zone AS m_product_po_updated,
NULL::numeric AS m_product_po_updatedby,
NULL::bpchar AS m_product_po_vendorcategory,
NULL::numeric AS s_resourceassignment_ad_org_id,
NULL::timestamp without time zone AS assigndatefrom,
NULL::timestamp without time zone AS assigndateto,
NULL::timestamp without time zone AS s_resourceassignment_created,
NULL::numeric AS s_resourceassignment_createby,
NULL::bpchar AS s_resourceassignment_isactive,
NULL::bpchar AS isconfirmed,
NULL::character varying AS s_resourceassignment_name,
NULL::numeric AS s_resourceassignment_qty,
NULL::numeric AS s_resourceassignment_s_resour,
NULL::timestamp without time zone AS s_resourceassignment_updated,
NULL::numeric AS s_resourceassignment_updatedby,
NULL::numeric AS c_charge_c_org_id,
NULL::numeric AS c_charge_c_bpartner_id,
NULL::numeric AS c_chargetype_id,
NULL::numeric AS c_charge_chargeamt,
NULL::numeric AS c_charge_c_taxcategory_id,
NULL::character varying AS c_charge_description,
NULL::bpchar AS c_charge_isactive,
NULL::bpchar AS issamecurrency,
NULL::bpchar AS issametax,
NULL::bpchar AS c_charge_istaxincluded,
NULL::numeric AS c_bpartner_product_ad_org_id,
NULL::numeric AS c_bp_product_c_bpartner_id,
NULL::timestamp without time zone AS c_bpartner_product_created,
NULL::numeric AS c_bpartner_product_createdby,
NULL::character varying AS c_bpartner_product_description,
NULL::bpchar AS c_bpartner_product_isactive,
NULL::bpchar AS ismanufacturer,
NULL::character varying AS c_bpartner_product_manufactur,
NULL::numeric AS c_bpartner_product_qualityrat,
NULL::numeric AS shelflifemindays,
NULL::numeric AS c_bpartner_product_shelflifem,
NULL::timestamp without time zone AS c_bpartner_product_updated,
NULL::numeric AS c_bpartner_product_updatedby,
NULL::character varying AS c_bpartner_product_vendorcate,
NULL::numeric AS acqusitioncost,
NULL::numeric AS actuallifetimevalue,
NULL::character varying AS c_bpartner_ad_language,
NULL::numeric AS ad_orgbp_id,
NULL::numeric AS c_bpartner_ad_org_id,
NULL::numeric AS bpartner_parent_id,
NULL::numeric AS c_bp_group_id,
NULL::numeric AS c_dunning_id,
NULL::numeric AS c_greeting_id,
NULL::numeric AS c_invoiceschedule_id,
NULL::numeric AS c_bpartner_c_paymentterm_id,
NULL::timestamp without time zone AS c_bpartner_created,
NULL::numeric AS c_bpartner_createdby,
NULL::numeric AS c_bpartner_c_taxgroup_id,
NULL::bpchar AS c_bpartner_deliveryrule,
NULL::bpchar AS c_bpartner_deliveryviarule,
NULL::character varying AS c_bpartner_description,
NULL::date AS c_bpartner_dunninggrace,
NULL::bpchar AS duns,
NULL::timestamp without time zone AS c_bpartner_firstsale,
NULL::numeric AS c_bpartner_flatdiscount,
NULL::bpchar AS c_bpartner_freightcostrule,
NULL::bpchar AS c_bpartner_invoicerule,
NULL::bpchar AS c_bpartner_isactive,
NULL::bpchar AS iscustomer,
NULL::bpchar AS c_bpartner_isdiscountprinted,
NULL::bpchar AS c_bpartner_isemployee,
NULL::bpchar AS c_bpartner_ismanufacturer,
NULL::bpchar AS isonetime,
NULL::bpchar AS ispotaxexempt,
NULL::bpchar AS isprospect,
NULL::bpchar AS issalesrep,
NULL::bpchar AS c_bpartner_issummary,
NULL::bpchar AS c_bpartner_istaxexempt,
NULL::bpchar AS isvendor,
NULL::numeric AS logo_id,
NULL::numeric AS m_discountschema_id,
NULL::numeric AS c_bpartner_m_pricelist_id,
NULL::bpchar AS naics,
NULL::character varying AS c_bpartner_name,
NULL::character varying AS c_bpartner_name2,
NULL::numeric AS numberemployees,
NULL::bpchar AS c_bpartner_paymentrule,
NULL::bpchar AS paymentrulepo,
NULL::numeric AS po_discountschema_id,
NULL::numeric AS po_paymentterm_id,
NULL::numeric AS po_pricelist_id,
NULL::character varying AS c_bpartner_poreference,
NULL::numeric AS potentiallifetimevalue,
NULL::bpchar AS c_bpartner_rating,
NULL::character varying AS c_bpartner_referenceno,
NULL::numeric AS c_bpartner_salesrep_id,
NULL::numeric AS salesvolume,
NULL::bpchar AS c_bpartner_sendemail,
NULL::numeric AS shareofcustomer,
NULL::numeric AS c_bpartner_shelflifeminpct,
NULL::numeric AS so_creditlimit,
NULL::bpchar AS socreditstatus,
NULL::numeric AS so_creditused,
NULL::character varying AS so_description,
NULL::character varying AS c_bpartner_taxid,
NULL::numeric AS totalopenbalance,
NULL::timestamp without time zone AS c_bpartner_updated,
NULL::numeric AS c_bpartner_updatedby,
NULL::character varying AS c_bpartner_url,
NULL::character varying AS c_bpartner_value,
NULL::numeric AS c_bpartner_location_ad_org_id,
NULL::numeric AS c_bpartner_location_c_bpartne,
NULL::timestamp without time zone AS c_bpartner_location_created,
NULL::numeric AS c_bpartner_location_createdby,
NULL::numeric AS c_salesregion_id,
NULL::character varying AS c_bpartner_location_fax,
NULL::bpchar AS c_bpartner_location_isactive,
NULL::bpchar AS isbillto,
NULL::character varying AS isdn,
NULL::bpchar AS ispayfrom,
NULL::bpchar AS isremitto,
NULL::bpchar AS isshipto,
NULL::character varying AS c_bpartner_location_name,
NULL::character varying AS c_bpartner_location_phone,
NULL::character varying AS c_bpartner_location_phone2,
NULL::timestamp without time zone AS c_bpartner_location_updated,
NULL::numeric AS c_bpartner_location_updatedby,
NULL::numeric AS c_tax_ad_org_id,
NULL::numeric AS ad_rule_id,
NULL::numeric AS c_country_id,
NULL::numeric AS c_region_id,
NULL::numeric AS c_tax_c_taxcategory_id,
NULL::character varying AS c_tax_description,
NULL::bpchar AS c_tax_isactive,
NULL::bpchar AS c_tax_isdefault,
NULL::bpchar AS isdocumentlevel,
NULL::bpchar AS issalestax,
NULL::bpchar AS c_tax_issummary,
NULL::bpchar AS c_tax_istaxexempt,
NULL::character varying AS c_tax_name,
NULL::numeric AS parent_tax_id,
NULL::numeric AS rate,
NULL::bpchar AS requirestaxcertificate,
NULL::bpchar AS sopotype,
NULL::numeric AS to_country_id,
NULL::numeric AS c_tax_to_region_id,
NULL::timestamp without time zone AS validfrom
FROM c_order i
UNION
SELECT ot.ad_client_id,
ot.ad_org_id,
ot.isactive,
ot.created,
ot.createdby,
ot.updated,
ot.updatedby,
'en_US'::text AS ad_language,
ot.c_order_id,
NULL::numeric AS c_orderline_id,
ot.c_tax_id,
t.taxindicator,
NULL::numeric AS c_bpartner_id,
NULL::numeric AS c_bpartner_location_id,
NULL::character varying AS bpname,
NULL::numeric AS c_location_id,
NULL::numeric AS line,
NULL::numeric AS m_product_id,
NULL::character varying AS vendorproductno,
NULL::numeric AS qtyordered,
NULL::numeric AS qtyentered,
NULL::character varying AS uomsymbol,
t.name,
NULL::character varying AS description,
NULL::character varying AS documentnote,
NULL::character varying AS upc,
NULL::character varying AS sku,
NULL::character varying AS productvalue,
NULL::character varying AS resourcedescription,
NULL::numeric AS pricelist,
NULL::numeric AS priceenteredlist,
NULL::numeric AS discount,
CASE
WHEN (ot.istaxincluded = 'Y'::bpchar) THEN ot.taxamt
ELSE ot.taxbaseamt
END AS priceactual,
CASE
WHEN (ot.istaxincluded = 'Y'::bpchar) THEN ot.taxamt
ELSE ot.taxbaseamt
END AS priceentered,
CASE
WHEN (ot.istaxincluded = 'Y'::bpchar) THEN NULL::numeric
ELSE ot.taxamt
END AS linenetamt,
NULL::character varying AS productdescription,
NULL::character varying AS imageurl,
NULL::numeric AS c_campaign_id,
NULL::numeric AS c_project_id,
NULL::numeric AS c_activity_id,
NULL::numeric AS c_projectphase_id,
NULL::numeric AS c_projecttask_id,
NULL::numeric AS c_orderline_ad_orgtrx_id,
NULL::numeric AS c_orderline_c_charge_id,
NULL::numeric AS c_orderline_c_currency_id,
NULL::numeric AS c_uom_id,
NULL::timestamp without time zone AS datedelivered,
NULL::timestamp without time zone AS dateinvoiced,
NULL::timestamp without time zone AS dateordered,
NULL::timestamp without time zone AS c_orderline_datepromised,
NULL::numeric AS c_orderline_freightamt,
NULL::bpchar AS isdescription,
NULL::numeric AS link_orderline_id,
NULL::numeric AS m_promotion_id,
NULL::numeric AS c_orderline_m_shipper_id,
NULL::numeric AS c_orderline_m_warehouse_id,
NULL::numeric AS pricecost,
NULL::numeric AS pricelimit,
NULL::bpchar AS c_orderline_processed,
NULL::numeric AS qtydelivered,
NULL::numeric AS qtyinvoiced,
NULL::numeric AS qtylostsales,
NULL::numeric AS qtyreserved,
NULL::numeric AS ref_orderline_id,
NULL::numeric AS rramt,
NULL::timestamp without time zone AS rrstartdate,
NULL::numeric AS s_resourceassignment_id,
NULL::numeric AS c_orderline_user1_id,
NULL::numeric AS c_orderline_user2_id,
NULL::numeric AS c_uom_ad_org_id,
NULL::numeric AS costingprecision,
NULL::character varying AS c_uom_description,
NULL::bpchar AS c_uom_isactive,
NULL::bpchar AS isdefault,
NULL::character varying AS c_uom_name,
NULL::numeric AS stdprecision,
NULL::character varying AS uomtype,
NULL::character varying AS x12de355,
NULL::numeric AS c_order_ad_org_id,
NULL::numeric AS c_order_ad_orgtrx_id,
NULL::numeric AS ad_user_id,
NULL::numeric AS amountrefunded,
NULL::numeric AS amounttendered,
NULL::numeric AS bill_bpartner_id,
NULL::numeric AS bill_location_id,
NULL::numeric AS bill_user_id,
NULL::numeric AS c_order_c_activity_id,
NULL::numeric AS c_order_c_bpartner_id,
NULL::numeric AS c_order_c_campaign_id,
NULL::numeric AS c_cashline_id,
NULL::numeric AS c_cashplanline_id,
NULL::numeric AS c_order_c_charge_id,
NULL::numeric AS c_conversiontype_id,
NULL::numeric AS c_order_c_currency_id,
NULL::numeric AS c_doctype_id,
NULL::numeric AS c_doctypetarget_id,
NULL::numeric AS chargeamt,
NULL::bpchar AS copyfrom,
NULL::numeric AS c_payment_id,
NULL::numeric AS c_paymentterm_id,
NULL::numeric AS c_pos_id,
NULL::numeric AS c_order_c_project_id,
NULL::timestamp without time zone AS c_order_created,
NULL::numeric AS c_order_createdby,
NULL::timestamp without time zone AS dateacct,
NULL::timestamp without time zone AS dateprinted,
NULL::timestamp without time zone AS c_order_datepromised,
NULL::bpchar AS deliveryrule,
NULL::bpchar AS deliveryviarule,
NULL::character varying AS c_order_description,
NULL::bpchar AS docaction,
NULL::bpchar AS docstatus,
NULL::character varying AS documentno,
NULL::numeric AS dropship_bpartner_id,
NULL::numeric AS dropship_location_id,
NULL::numeric AS dropship_user_id,
NULL::numeric AS c_order_freightamt,
NULL::bpchar AS freightcostrule,
NULL::numeric AS grandtotal,
NULL::bpchar AS invoicerule,
NULL::bpchar AS c_order_isactive,
NULL::bpchar AS isapproved,
NULL::bpchar AS iscreditapproved,
NULL::bpchar AS isdelivered,
NULL::bpchar AS c_order_isdiscountprinted,
NULL::bpchar AS c_order_isdropship,
NULL::bpchar AS isinvoiced,
NULL::bpchar AS ispayschedulevalid,
NULL::bpchar AS isprinted,
NULL::bpchar AS isselected,
NULL::bpchar AS c_order_isselfservice,
NULL::bpchar AS issotrx,
NULL::bpchar AS istaxincluded,
NULL::bpchar AS istransferred,
NULL::numeric AS link_order_id,
NULL::numeric AS c_order_m_freightcategory_id,
NULL::numeric AS c_order_m_pricelist_id,
NULL::numeric AS c_order_m_shipper_id,
NULL::numeric AS c_order_m_warehouse_id,
NULL::character varying AS ordertype,
NULL::numeric AS pay_bpartner_id,
NULL::numeric AS pay_location_id,
NULL::bpchar AS c_order_paymentrule,
NULL::character varying AS poreference,
NULL::bpchar AS posted,
NULL::bpchar AS priorityrule,
NULL::bpchar AS c_order_processed,
NULL::numeric AS processedon,
NULL::character varying AS promotioncode,
NULL::numeric AS ref_order_id,
NULL::numeric AS salesrep_id,
NULL::bpchar AS c_order_sendemail,
NULL::numeric AS totallines,
NULL::timestamp without time zone AS c_order_updated,
NULL::numeric AS c_order_updatedby,
NULL::numeric AS c_order_user1_id,
NULL::numeric AS c_order_user2_id,
NULL::numeric AS c_order_volume,
NULL::numeric AS c_order_weight,
NULL::numeric AS m_product_ad_org_id,
NULL::character varying AS classification,
NULL::bpchar AS m_product_copyfrom,
NULL::timestamp without time zone AS m_product_created,
NULL::numeric AS m_product_createdby,
NULL::numeric AS c_revenuerecognition_id,
NULL::numeric AS c_subscriptiontype_id,
NULL::numeric AS c_taxcategory_id,
NULL::numeric AS m_product_c_uom_id,
NULL::character varying AS descriptionurl,
NULL::bpchar AS m_product_discontinued,
NULL::timestamp without time zone AS m_product_discontinuedat,
NULL::character varying AS group1,
NULL::character varying AS group2,
NULL::numeric AS guaranteedays,
NULL::numeric AS guaranteedaysmin,
NULL::character varying AS help,
NULL::bpchar AS m_product_isactive,
NULL::bpchar AS isbom,
NULL::bpchar AS m_product_isdropship,
NULL::bpchar AS isexcludeautodelivery,
NULL::bpchar AS isinvoiceprintdetails,
NULL::bpchar AS ispicklistprintdetails,
NULL::bpchar AS ispurchased,
NULL::bpchar AS m_product_isselfservice,
NULL::bpchar AS issold,
NULL::bpchar AS isstocked,
NULL::bpchar AS m_product_issummary,
NULL::bpchar AS isverified,
NULL::bpchar AS iswebstorefeatured,
NULL::numeric AS lowlevel,
NULL::numeric AS m_attributeset_id,
NULL::numeric AS m_attributesetinstance_id,
NULL::numeric AS m_product_m_freightcategory_id,
NULL::numeric AS m_locator_id,
NULL::numeric AS m_product_product_category_id,
NULL::bpchar AS m_product_processing,
NULL::bpchar AS producttype,
NULL::numeric AS r_mailtext_id,
NULL::numeric AS m_product_salesrep_id,
NULL::numeric AS s_expensetype_id,
NULL::numeric AS shelfdepth,
NULL::numeric AS shelfheight,
NULL::numeric AS shelfwidth,
NULL::numeric AS s_resource_id,
NULL::numeric AS unitsperpack,
NULL::numeric AS unitsperpallet,
NULL::timestamp without time zone AS m_product_updated,
NULL::numeric AS m_product_updatedby,
NULL::character varying AS versionno,
NULL::numeric AS m_product_volume,
NULL::numeric AS m_product_weight,
NULL::numeric AS m_product_po_ad_org_id,
NULL::numeric AS m_product_po_c_bpartner_id,
NULL::numeric AS m_product_po_c_currency_id,
NULL::numeric AS costperorder,
NULL::timestamp without time zone AS m_product_po_created,
NULL::numeric AS m_product_po_createdby,
NULL::numeric AS m_product_po_c_uom_id,
NULL::numeric AS deliverytime_actual,
NULL::numeric AS deliverytime_promised,
NULL::bpchar AS m_product_po_discontinued,
NULL::timestamp without time zone AS m_product_po_discontinuedat,
NULL::bpchar AS m_product_po_isactive,
NULL::bpchar AS iscurrentvendor,
NULL::bpchar AS m_product_po_manufacturer,
NULL::numeric AS m_product_po_m_product_id,
NULL::numeric AS order_min,
NULL::numeric AS order_pack,
NULL::timestamp without time zone AS priceeffective,
NULL::numeric AS pricelastinv,
NULL::numeric AS pricelastpo,
NULL::numeric AS m_product_po_pricelist,
NULL::numeric AS pricepo,
NULL::numeric AS m_product_po_qualityrating,
NULL::numeric AS royaltyamt,
NULL::character varying AS m_product_po_upc,
NULL::timestamp without time zone AS m_product_po_updated,
NULL::numeric AS m_product_po_updatedby,
NULL::bpchar AS m_product_po_vendorcategory,
NULL::numeric AS s_resourceassignment_ad_org_id,
NULL::timestamp without time zone AS assigndatefrom,
NULL::timestamp without time zone AS assigndateto,
NULL::timestamp without time zone AS s_resourceassignment_created,
NULL::numeric AS s_resourceassignment_createby,
NULL::bpchar AS s_resourceassignment_isactive,
NULL::bpchar AS isconfirmed,
NULL::character varying AS s_resourceassignment_name,
NULL::numeric AS s_resourceassignment_qty,
NULL::numeric AS s_resourceassignment_s_resour,
NULL::timestamp without time zone AS s_resourceassignment_updated,
NULL::numeric AS s_resourceassignment_updatedby,
NULL::numeric AS c_charge_c_org_id,
NULL::numeric AS c_charge_c_bpartner_id,
NULL::numeric AS c_chargetype_id,
NULL::numeric AS c_charge_chargeamt,
NULL::numeric AS c_charge_c_taxcategory_id,
NULL::character varying AS c_charge_description,
NULL::bpchar AS c_charge_isactive,
NULL::bpchar AS issamecurrency,
NULL::bpchar AS issametax,
NULL::bpchar AS c_charge_istaxincluded,
NULL::numeric AS c_bpartner_product_ad_org_id,
NULL::numeric AS c_bp_product_c_bpartner_id,
NULL::timestamp without time zone AS c_bpartner_product_created,
NULL::numeric AS c_bpartner_product_createdby,
NULL::character varying AS c_bpartner_product_description,
NULL::bpchar AS c_bpartner_product_isactive,
NULL::bpchar AS ismanufacturer,
NULL::character varying AS c_bpartner_product_manufactur,
NULL::numeric AS c_bpartner_product_qualityrat,
NULL::numeric AS shelflifemindays,
NULL::numeric AS c_bpartner_product_shelflifem,
NULL::timestamp without time zone AS c_bpartner_product_updated,
NULL::numeric AS c_bpartner_product_updatedby,
NULL::character varying AS c_bpartner_product_vendorcate,
NULL::numeric AS acqusitioncost,
NULL::numeric AS actuallifetimevalue,
NULL::character varying AS c_bpartner_ad_language,
NULL::numeric AS ad_orgbp_id,
NULL::numeric AS c_bpartner_ad_org_id,
NULL::numeric AS bpartner_parent_id,
NULL::numeric AS c_bp_group_id,
NULL::numeric AS c_dunning_id,
NULL::numeric AS c_greeting_id,
NULL::numeric AS c_invoiceschedule_id,
NULL::numeric AS c_bpartner_c_paymentterm_id,
NULL::timestamp without time zone AS c_bpartner_created,
NULL::numeric AS c_bpartner_createdby,
NULL::numeric AS c_bpartner_c_taxgroup_id,
NULL::bpchar AS c_bpartner_deliveryrule,
NULL::bpchar AS c_bpartner_deliveryviarule,
NULL::character varying AS c_bpartner_description,
NULL::date AS c_bpartner_dunninggrace,
NULL::bpchar AS duns,
NULL::timestamp without time zone AS c_bpartner_firstsale,
NULL::numeric AS c_bpartner_flatdiscount,
NULL::bpchar AS c_bpartner_freightcostrule,
NULL::bpchar AS c_bpartner_invoicerule,
NULL::bpchar AS c_bpartner_isactive,
NULL::bpchar AS iscustomer,
NULL::bpchar AS c_bpartner_isdiscountprinted,
NULL::bpchar AS c_bpartner_isemployee,
NULL::bpchar AS c_bpartner_ismanufacturer,
NULL::bpchar AS isonetime,
NULL::bpchar AS ispotaxexempt,
NULL::bpchar AS isprospect,
NULL::bpchar AS issalesrep,
NULL::bpchar AS c_bpartner_issummary,
NULL::bpchar AS c_bpartner_istaxexempt,
NULL::bpchar AS isvendor,
NULL::numeric AS logo_id,
NULL::numeric AS m_discountschema_id,
NULL::numeric AS c_bpartner_m_pricelist_id,
NULL::bpchar AS naics,
NULL::character varying AS c_bpartner_name,
NULL::character varying AS c_bpartner_name2,
NULL::numeric AS numberemployees,
NULL::bpchar AS c_bpartner_paymentrule,
NULL::bpchar AS paymentrulepo,
NULL::numeric AS po_discountschema_id,
NULL::numeric AS po_paymentterm_id,
NULL::numeric AS po_pricelist_id,
NULL::character varying AS c_bpartner_poreference,
NULL::numeric AS potentiallifetimevalue,
NULL::bpchar AS c_bpartner_rating,
NULL::character varying AS c_bpartner_referenceno,
NULL::numeric AS c_bpartner_salesrep_id,
NULL::numeric AS salesvolume,
NULL::bpchar AS c_bpartner_sendemail,
NULL::numeric AS shareofcustomer,
NULL::numeric AS c_bpartner_shelflifeminpct,
NULL::numeric AS so_creditlimit,
NULL::bpchar AS socreditstatus,
NULL::numeric AS so_creditused,
NULL::character varying AS so_description,
NULL::character varying AS c_bpartner_taxid,
NULL::numeric AS totalopenbalance,
NULL::timestamp without time zone AS c_bpartner_updated,
NULL::numeric AS c_bpartner_updatedby,
NULL::character varying AS c_bpartner_url,
NULL::character varying AS c_bpartner_value,
NULL::numeric AS c_bpartner_location_ad_org_id,
NULL::numeric AS c_bpartner_location_c_bpartne,
NULL::timestamp without time zone AS c_bpartner_location_created,
NULL::numeric AS c_bpartner_location_createdby,
NULL::numeric AS c_salesregion_id,
NULL::character varying AS c_bpartner_location_fax,
NULL::bpchar AS c_bpartner_location_isactive,
NULL::bpchar AS isbillto,
NULL::character varying AS isdn,
NULL::bpchar AS ispayfrom,
NULL::bpchar AS isremitto,
NULL::bpchar AS isshipto,
NULL::character varying AS c_bpartner_location_name,
NULL::character varying AS c_bpartner_location_phone,
NULL::character varying AS c_bpartner_location_phone2,
NULL::timestamp without time zone AS c_bpartner_location_updated,
NULL::numeric AS c_bpartner_location_updatedby,
NULL::numeric AS c_tax_ad_org_id,
NULL::numeric AS ad_rule_id,
NULL::numeric AS c_country_id,
NULL::numeric AS c_region_id,
NULL::numeric AS c_tax_c_taxcategory_id,
NULL::character varying AS c_tax_description,
NULL::bpchar AS c_tax_isactive,
NULL::bpchar AS c_tax_isdefault,
NULL::bpchar AS isdocumentlevel,
NULL::bpchar AS issalestax,
NULL::bpchar AS c_tax_issummary,
NULL::bpchar AS c_tax_istaxexempt,
NULL::character varying AS c_tax_name,
NULL::numeric AS parent_tax_id,
NULL::numeric AS rate,
NULL::bpchar AS requirestaxcertificate,
NULL::bpchar AS sopotype,
NULL::numeric AS to_country_id,
NULL::numeric AS c_tax_to_region_id,
NULL::timestamp without time zone AS validfrom
FROM (c_ordertax ot
JOIN c_tax t ON ((ot.c_tax_id = t.c_tax_id)));