INSERT INTO OEORDHDR_SQL(ord_type,ord_no,status,<cfif LookupHold.Hold_fg eq "Y">Hold_fg,</cfif>entered_dt,ord_dt,oe_po_no,cus_no,slspsn_no,
oe_cash_no,curr_cd,selection_cd,
bal_meth,bill_to_name,bill_to_addr_1,bill_to_addr_2,bill_to_addr_3,
bill_to_country,<cfif Len(Arguments.cus_alt_adr_cd)>'#Arguments.cus_alt_adr_cd#',</cfif>
ship_to_name,ship_to_addr_1,ship_to_addr_2,ship_to_addr_3,
ship_to_country,shipping_dt,ship_via_cd,ar_terms_cd,<cfif Len(Arguments.frt_pay_cd)>frt_pay_cd,</cfif>
ship_instruction_1,ship_instruction_2,
slspsn_pct_comm,<cfif Len(Arguments.Slspsn_no_2)>slspsn_no_2,slspsn_pct_comm_2,</cfif>tax_cd,tax_pct,mfg_loc,<cfif Len(Arguments.job_no)>job_no,</cfif>
tot_sls_amt,tot_sls_disc,tot_tax_amt,tot_cost,misc_amt,
prepayment_fg,orig_trx_rt,curr_trx_rt,form_no,tax_fg,tot_dollars,
<cfif Len(Variables.cmt_2)>cmt_2,</cfif><cfif Len(Variables.cmt_3)>cmt_3,</cfif>apply_to_no,slspsn_comm_amt,slspsn_comm_amt_2,
slspsn_comm_amt_3,
slspsn_pct_comm_3,tax_pct_2,tax_pct_3,discount_pct,tot_weight,
frt_amt,sls_tax_amt_1,sls_tax_amt_2,sls_tax_amt_3,comm_amt,comm_pct,payment_amt,
payment_disc_amt,accum_misc_amt,accum_frt_amt,accum_tot_tax_amt,accum_sls_tax_amt,accum_tot_sls_amt,chk_no,chk_dt,billed_dt,
picked_dt,inv_no,posted_dt,
inv_dt,shipped_dt,award_probability,orig_ord_dt,orig_ord_no,
tot_tax_cost,pre_select_status,packing_no,rma_no)
VALUES('O','#Variables.ord_no#',<cfif LookupHold.Hold_fg eq "Y">'C',<cfelse>'1',</cfif>
<cfif LookupHold.Hold_fg eq "Y">'H',</cfif>#Variables.Today#,#Variables.Today#,'#Arguments.oe_po_no#','#GetCustomer.Cus_no#','#Arguments.Slspsn_no#',
0,'','C','#GetBal_Meth.Bal_meth#','#Arguments.cus_name#',
'#Addr_1#','#Addr_2#','#Arguments.City#, #Arguments.State# #Arguments.Zip#','#Arguments.Country#',
<cfif Len(Arguments.cus_alt_adr_cd)>'#Arguments.cus_alt_adr_cd#',</cfif>'#Arguments.Ship_cus_name#',
'#Arguments.Ship_addr_1#','#Arguments.Ship_addr_2#',
'#Arguments.Ship_City#, #Arguments.Ship_State# #Arguments.Ship_Zip#','#Arguments.Ship_Country#',
<cfif Len(Arguments.Shipping_dt)>#DateFormat(CreateODBCDate(Shipping_dt),'yyyymmdd')#,<cfelse>0,</cfif>'#Arguments.Ship_via_cd#','#Arguments.Ar_terms_cd#',
<cfif Len(Arguments.frt_pay_cd)>'#Arguments.frt_pay_cd#',</cfif>'#Arguments.Ship_instruction_1#',
'#Arguments.Ship_instruction_2#',#Arguments.Slspsn_pct_comm#,
<cfif Len(Arguments.Slspsn_no_2)>'#Arguments.slspsn_no_2#','#Arguments.slspsn_pct_comm_2#',</cfif>
'#Arguments.Tax_cd#',#Arguments.Tax_pct#,'#Arguments.loc#',
<cfif Len(Arguments.job_no)>'#Arguments.job_no#',</cfif>#Variables.LineSum#,#Variables.SalesDisc#,
#Variables.TaxSum#,#Variables.CostSum#,#Variables.MiscSum#,
'N',1,1,#getLastOrderNo.dflt_form#,<cfif Arguments.Taxable eq 1>'Y',<cfelse>'N',</cfif>#Variables.LineSum#,<cfif Len(Variables.cmt_2)>'#Variables.cmt_2#',</cfif>
<cfif Len(Variables.cmt_3)>'#Variables.cmt_3#',
</cfif>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'00000000',0,1,0,0)