<%@ LANGUAGE = "VBScript" %> <% Session.Timeout = 120 Server.ScriptTimeout = 5000 busca=request.QueryString("busca") doc=request.QueryString("doc") origen=request.QueryString("origen") Date_ini=Request.Form("Date_ini") Date_end=Request.Form("Date_end") lvende=Request.Form("cvende") cmaquina=Request.Form("cmaquina") cmaquina2=Request.Form("cmaquina2") cmaquina3=Request.Form("cmaquina3") cmaquina4=Request.Form("cmaquina4") cmaquina5=Request.Form("cmaquina5") cmaquina6=Request.Form("cmaquina6") cmaquina7=Request.Form("cmaquina7") cmaquina8=Request.Form("cmaquina8") cmaquina9=Request.Form("cmaquina9") cmaquina10=Request.Form("cmaquina10") cmaquina11=Request.Form("cmaquina11") cmaquina12=Request.Form("cmaquina12") cmaquina13=Request.Form("cmaquina13") cmaquina14=Request.Form("cmaquina14") cmaquina15=Request.Form("cmaquina15") cmaquina16=Request.Form("cmaquina10") cmaquina17=Request.Form("cmaquina17") cmaquina18=Request.Form("cmaquina18") criterio22=Request.Form("criterio22") if criterio22="" then xcriterio22=" Todos " end if if Date_ini="" or Date_ini=null then 'Date_ini=date()-(day(date()))+1 Date_ini=date() Date_end=date()+13 end if if cmaquina=null or cmaquina="" then cmaquina="231" end if if cmaquina2=null or cmaquina2="" then cmaquina2="232" end if if cmaquina3=null or cmaquina3="" then cmaquina3="241" end if if cmaquina4=null or cmaquina4="" then cmaquina4="242" end if if cmaquina5=null or cmaquina5="" then cmaquina5="245" end if if cmaquina6=null or cmaquina6="" then cmaquina6="243" end if if cmaquina7=null or cmaquina7="" then cmaquina7="233" end if if cmaquina8=null or cmaquina8="" then cmaquina8="234" end if if cmaquina9=null or cmaquina9="" then cmaquina9="246" end if if cmaquina10=null or cmaquina10="" then cmaquina10="236" end if if cmaquina11=null or cmaquina11="" then cmaquina11="237" end if if cmaquina12=null or cmaquina12="" then cmaquina12="238" end if if cmaquina13=null or cmaquina13="" then cmaquina13="235" end if if cmaquina14=null or cmaquina14="" then cmaquina14="239" end if if cmaquina15=null or cmaquina15="" then cmaquina15="240" end if if cmaquina16=null or cmaquina16="" then cmaquina16="252" end if if cmaquina17=null or cmaquina17="" then cmaquina17="000" end if if cmaquina18=null or cmaquina18="" then cmaquina18="258" end if dia1=right("00"&day(Date_ini),2) mes1=right("00"&month(Date_ini),2) anno1=right("00"&year(Date_ini),4) 'Date_inii=cdate(dia1+"/"+mes1+"/"+anno1) cfechai=cdbl(anno1+mes1+dia1) dia2=right("00"&day(Date_end),2) mes2=right("00"&month(Date_end),2) anno2=right("00"&year(Date_end),4) 'cfechaf=cdate((dia2+"/"+mes2+"/"+anno2)) cfechaf=cdbl(anno2+mes2+dia2) '''''''''''''''''''''''''''''''''''''' strday = Right("00" & Day(Date_ini), 2) strmonth = Right("00" & Month(Date_ini), 2) stryear = Right("00" & Year(Date_ini), 4) strday2 = Right("00" & Day(Date_end), 2) strmonth2 = Right("00" & Month(Date_end), 2) stryear2 = Right("00" & Year(Date_end), 4) fechainicial = CDbl(stryear + strmonth + strday) fechafinal = CDbl(stryear2 + strmonth2 + strday2) set Rsmaquinas=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine2=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine3=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine4=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine5=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine6=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine7=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine8=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine9=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine10=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine11=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine12=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine13=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine14=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine15=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine16=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine17=dbsql.execute("SELECT * FROM stb160t a(nolock)") set Rsmachine18=dbsql.execute("SELECT * FROM stb160t a(nolock)") 'response.Write("cmaq1 "&cmaquina) set Rsm1=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina & "'") lmaq1=rsm1("proc_nm") rsm1.close set rsm1=nothing set Rsm2=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina2 & "'") lmaq2=rsm2("proc_nm") rsm2.close set rsm2=nothing set Rsm3=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina3 & "'") lmaq3=rsm3("proc_nm") rsm3.close set rsm3=nothing set Rsm4=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina4 & "'") lmaq4=rsm4("proc_nm") rsm4.close set rsm4=nothing set Rsm5=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina5 & "'") lmaq5=rsm5("proc_nm") rsm5.close set rsm5=nothing set Rsm6=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina6 & "'") lmaq6=rsm6("proc_nm") rsm6.close set rsm6=nothing set Rsm7=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina7 & "'") lmaq7=rsm7("proc_nm") rsm7.close set rsm7=nothing set Rsm8=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina8 & "'") lmaq8=rsm8("proc_nm") rsm8.close set rsm8=nothing set Rsm9=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina9 & "'") lmaq9=rsm9("proc_nm") rsm9.close set rsm9=nothing set Rsm10=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina10 & "'") lmaq10=rsm10("proc_nm") rsm10.close set rsm10=nothing set Rsm11=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina11 & "'") lmaq11=rsm11("proc_nm") rsm11.close set rsm11=nothing set Rsm12=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina12 & "'") lmaq12=rsm12("proc_nm") rsm12.close set rsm12=nothing set Rsm13=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina13 & "'") lmaq13=rsm13("proc_nm") rsm13.close set rsm13=nothing set Rsm14=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina14 & "'") lmaq14=rsm14("proc_nm") rsm14.close set rsm14=nothing set Rsm15=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina15 & "'") lmaq15=rsm15("proc_nm") rsm15.close set rsm15=nothing set Rsm16=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina16 & "'") if not rsm16.eof then lmaq16=rsm16("proc_nm") else lmaq16="" end if rsm16.close set rsm16=nothing set Rsm17=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina17 & "'") if not rsm17.eof then lmaq17=rsm17("proc_nm") else lmaq17="" end if rsm17.close set rsm17=nothing set Rsm18=dbsql.execute("SELECT * FROM stb160t a(nolock) where proc_cd='" & cmaquina18 & "'") if not rsm18.eof then lmaq18=rsm18("proc_nm") else lmaq18="" end if rsm18.close set rsm18=nothing '''''''''''''''''''''''''''''''''''''' %> Planing WO datepicker demo

<% 'if busca="ok" then '''''''''''calcula strday = Right("00" & Day(Date_ini), 2) strmonth = Right("00" & Month(Date_ini), 2) stryear = Right("00" & Year(Date_ini), 4) strday2 = Right("00" & Day(Date_end), 2) strmonth2 = Right("00" & Month(Date_end), 2) stryear2 = Right("00" & Year(Date_end), 4) fechainicial = CStr(stryear + strmonth + strday) fechafinal = CStr(stryear2 + strmonth2 + strday2) 'response.write(" FI "&fechainicial) ' response.write(fechafinal)&" Ff " '************** Inventory Dim Rsinven1, Rsinven2,rsmaquinas2,rsmaquinas3,rsmaquinas4,rsmaquinas5,rsmaquinas6 Dim Sqlinven1,sqlinven2,sqlwip lmachine_cd=cmaquina lmachine2_cd=cmaquina2 lmachine3_cd=cmaquina3 lmachine4_cd=cmaquina4 lmachine5_cd=cmaquina5 lmachine6_cd=cmaquina6 'response.write(" maquina: "&lmachine_cd) '''''''''''''''''''''''**************************************** MAQUINA 1 ''''************* d-box2032 set Rsinven1=dbsql.execute("select case isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) when '1' then '0' else '0' end choice_click, a.cust_cd, a.good_cd, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = a.cust_cd) cust_nm, a.good_nm, dbo.usf_size(a.sht_size1, a.sht_size2, 0, 'S') sht_size, dbo.usf_size(a.box_size1, a.box_size2, a.box_size3, 'b') box_size, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, case '"& lmachine_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) end uwrk_qty, right(a.nap_date,6) nap_day, (isnull(b.ord_qty, 0) - isnull(b.plan_qty, 0)) mwrk_qty, (isnull(e.plan_qty, 0)) mi_plan_qty, case isnull(d.prod_qty, 0) when 0 then 0 else (isnull(d.prod_qty, 0) - isnull(xx.tuip_qty,0)) end mi_prod_qty, a.sht_qty, '1' sht_use_class, b.goods_class s_goods_class, b.ord_date s_ord_date, b.ord_seq s_ord_seq, a.julsu, a.hapsu, a.sheet_poksu, (select nap_nm from stb030t(nolock) where stb030t.crp_id = a.crp_id and stb030t.cust_cd = a.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = a.nap_cd) nap_nm, (select flute_nm from stb080t(nolock) where flute_cd = a.flute_cd) flute_nm, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd1) mtrl_nm1, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd2) mtrl_nm2, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd3) mtrl_nm3, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd4) mtrl_nm4, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd5) mtrl_nm5, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd6) mtrl_nm6, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd7) mtrl_nm7, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd1) proc_nm1, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd2) proc_nm2, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd3) proc_nm3, case '"& lmachine_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine_cd &"' when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) else 0 end proc_qty3, a.note_1, a.note_2, 1 proc_set1, 1 proc_set2, 1 proc_set3, case '"& lmachine_cd &"' when a.proc_cd1 then case a.proc_cd2 when '' then '1' else '0' end when a.proc_cd2 then case a.proc_cd3 when '' then '1' else '0' end when a.proc_cd3 then '1' end proc_chk, 0 tmp_plan_qty, case a.defer_gubun when '0' then '' else 'DEFER' end defer_gubun, a.defer_note, isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) credit_chk, case isnull(d.prod_qty,0) when 0 then '' else right(dbo.f_datetermymd(d.e_time),11) end sht_prod_time from boa010t a(nolock) left outer join sha010t b(nolock) on a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.plan_qty - a.prod_qty) plan_qty from shb010t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' and a.plan_qty - a.prod_qty > 0 group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) e on a.crp_id = e.crp_id and a.goods_class = e.goods_class and a.ord_date = e.ord_date and a.ord_seq = e.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.prod_qty) prod_qty, max(a.e_time) e_time from shb020t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) d on a.crp_id = d.crp_id and a.goods_class = d.goods_class and a.ord_date = d.ord_date and a.ord_seq = d.ord_seq, boc010t xx(nolock) where a.crp_id = xx.crp_id and a.goods_class = xx.goods_class and a.ord_date = xx.ord_date and a.ord_seq = xx.ord_seq and a.crp_id = '10' and a.ord_date <= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end >= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end <= '"& fechafinal &"' and case '"& lmachine_cd &"' when a.proc_cd1 then a.ord_qty - floor(isnull(a.proc_qty1, 0) * 1) when a.proc_cd2 then a.ord_qty - floor(isnull(a.proc_qty2, 0) * 1) when a.proc_cd3 then a.ord_qty - floor(isnull(a.proc_qty3, 0) * 1) end > 0 and a.ord_class = '1' and a.sheet_proc_yn <> '3' and case '"& lmachine_cd &"' when a.proc_cd1 then '"& lmachine_cd &"' when a.proc_cd2 then '"& lmachine_cd &"' when a.proc_cd3 then '"& lmachine_cd &"' end = '"& lmachine_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000')") '''''''''''''''''''''''**************************************** MAQUINA 2 set Rsmaquinas2=dbsql.execute("select case isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) when '1' then '0' else '0' end choice_click, a.cust_cd, a.good_cd, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = a.cust_cd) cust_nm, a.good_nm, dbo.usf_size(a.sht_size1, a.sht_size2, 0, 'S') sht_size, dbo.usf_size(a.box_size1, a.box_size2, a.box_size3, 'b') box_size, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, case '"& lmachine2_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) end uwrk_qty, right(a.nap_date,6) nap_day, (isnull(b.ord_qty, 0) - isnull(b.plan_qty, 0)) mwrk_qty, (isnull(e.plan_qty, 0)) mi_plan_qty, case isnull(d.prod_qty, 0) when 0 then 0 else (isnull(d.prod_qty, 0) - isnull(xx.tuip_qty,0)) end mi_prod_qty, a.sht_qty, '1' sht_use_class, b.goods_class s_goods_class, b.ord_date s_ord_date, b.ord_seq s_ord_seq, a.julsu, a.hapsu, a.sheet_poksu, (select nap_nm from stb030t(nolock) where stb030t.crp_id = a.crp_id and stb030t.cust_cd = a.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = a.nap_cd) nap_nm, (select flute_nm from stb080t(nolock) where flute_cd = a.flute_cd) flute_nm, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd1) mtrl_nm1, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd2) mtrl_nm2, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd3) mtrl_nm3, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd4) mtrl_nm4, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd5) mtrl_nm5, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd6) mtrl_nm6, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd7) mtrl_nm7, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd1) proc_nm1, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd2) proc_nm2, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd3) proc_nm3, case '"& lmachine2_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine2_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine2_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine2_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine2_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine2_cd &"' when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) else 0 end proc_qty3, a.note_1, a.note_2, 1 proc_set1, 1 proc_set2, 1 proc_set3, case '"& lmachine2_cd &"' when a.proc_cd1 then case a.proc_cd2 when '' then '1' else '0' end when a.proc_cd2 then case a.proc_cd3 when '' then '1' else '0' end when a.proc_cd3 then '1' end proc_chk, 0 tmp_plan_qty, case a.defer_gubun when '0' then '' else 'DEFER' end defer_gubun, a.defer_note, isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) credit_chk, case isnull(d.prod_qty,0) when 0 then '' else right(dbo.f_datetermymd(d.e_time),11) end sht_prod_time from boa010t a(nolock) left outer join sha010t b(nolock) on a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.plan_qty - a.prod_qty) plan_qty from shb010t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' and a.plan_qty - a.prod_qty > 0 group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) e on a.crp_id = e.crp_id and a.goods_class = e.goods_class and a.ord_date = e.ord_date and a.ord_seq = e.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.prod_qty) prod_qty, max(a.e_time) e_time from shb020t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) d on a.crp_id = d.crp_id and a.goods_class = d.goods_class and a.ord_date = d.ord_date and a.ord_seq = d.ord_seq, boc010t xx(nolock) where a.crp_id = xx.crp_id and a.goods_class = xx.goods_class and a.ord_date = xx.ord_date and a.ord_seq = xx.ord_seq and a.crp_id = '10' and a.ord_date <= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end >= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end <= '"& fechafinal &"' and case '"& lmachine2_cd &"' when a.proc_cd1 then a.ord_qty - floor(isnull(a.proc_qty1, 0) * 1) when a.proc_cd2 then a.ord_qty - floor(isnull(a.proc_qty2, 0) * 1) when a.proc_cd3 then a.ord_qty - floor(isnull(a.proc_qty3, 0) * 1) end > 0 and a.ord_class = '1' and a.sheet_proc_yn <> '3' and case '"& lmachine2_cd &"' when a.proc_cd1 then '"& lmachine2_cd &"' when a.proc_cd2 then '"& lmachine2_cd &"' when a.proc_cd3 then '"& lmachine2_cd &"' end = '"& lmachine2_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000')") '''''''''''''''''''''''**************************************** MAQUINA 3 set Rsmaquinas3=dbsql.execute("select case isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) when '1' then '0' else '0' end choice_click, a.cust_cd, a.good_cd, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = a.cust_cd) cust_nm, a.good_nm, dbo.usf_size(a.sht_size1, a.sht_size2, 0, 'S') sht_size, dbo.usf_size(a.box_size1, a.box_size2, a.box_size3, 'b') box_size, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, case '"& lmachine3_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) end uwrk_qty, right(a.nap_date,6) nap_day, (isnull(b.ord_qty, 0) - isnull(b.plan_qty, 0)) mwrk_qty, (isnull(e.plan_qty, 0)) mi_plan_qty, case isnull(d.prod_qty, 0) when 0 then 0 else (isnull(d.prod_qty, 0) - isnull(xx.tuip_qty,0)) end mi_prod_qty, a.sht_qty, '1' sht_use_class, b.goods_class s_goods_class, b.ord_date s_ord_date, b.ord_seq s_ord_seq, a.julsu, a.hapsu, a.sheet_poksu, (select nap_nm from stb030t(nolock) where stb030t.crp_id = a.crp_id and stb030t.cust_cd = a.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = a.nap_cd) nap_nm, (select flute_nm from stb080t(nolock) where flute_cd = a.flute_cd) flute_nm, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd1) mtrl_nm1, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd2) mtrl_nm2, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd3) mtrl_nm3, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd4) mtrl_nm4, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd5) mtrl_nm5, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd6) mtrl_nm6, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd7) mtrl_nm7, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd1) proc_nm1, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd2) proc_nm2, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd3) proc_nm3, case '"& lmachine3_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine3_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine3_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine3_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine3_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine3_cd &"' when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) else 0 end proc_qty3, a.note_1, a.note_2, 1 proc_set1, 1 proc_set2, 1 proc_set3, case '"& lmachine3_cd &"' when a.proc_cd1 then case a.proc_cd2 when '' then '1' else '0' end when a.proc_cd2 then case a.proc_cd3 when '' then '1' else '0' end when a.proc_cd3 then '1' end proc_chk, 0 tmp_plan_qty, case a.defer_gubun when '0' then '' else 'DEFER' end defer_gubun, a.defer_note, isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) credit_chk, case isnull(d.prod_qty,0) when 0 then '' else right(dbo.f_datetermymd(d.e_time),11) end sht_prod_time from boa010t a(nolock) left outer join sha010t b(nolock) on a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.plan_qty - a.prod_qty) plan_qty from shb010t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' and a.plan_qty - a.prod_qty > 0 group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) e on a.crp_id = e.crp_id and a.goods_class = e.goods_class and a.ord_date = e.ord_date and a.ord_seq = e.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.prod_qty) prod_qty, max(a.e_time) e_time from shb020t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) d on a.crp_id = d.crp_id and a.goods_class = d.goods_class and a.ord_date = d.ord_date and a.ord_seq = d.ord_seq, boc010t xx(nolock) where a.crp_id = xx.crp_id and a.goods_class = xx.goods_class and a.ord_date = xx.ord_date and a.ord_seq = xx.ord_seq and a.crp_id = '10' and a.ord_date <= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end >= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end <= '"& fechafinal &"' and case '"& lmachine3_cd &"' when a.proc_cd1 then a.ord_qty - floor(isnull(a.proc_qty1, 0) * 1) when a.proc_cd2 then a.ord_qty - floor(isnull(a.proc_qty2, 0) * 1) when a.proc_cd3 then a.ord_qty - floor(isnull(a.proc_qty3, 0) * 1) end > 0 and a.ord_class = '1' and a.sheet_proc_yn <> '3' and case '"& lmachine3_cd &"' when a.proc_cd1 then '"& lmachine3_cd &"' when a.proc_cd2 then '"& lmachine3_cd &"' when a.proc_cd3 then '"& lmachine3_cd &"' end = '"& lmachine3_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000')") '''''''''''''''''''''''**************************************** MAQUINA 4 set Rsmaquinas4=dbsql.execute("select case isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) when '1' then '0' else '0' end choice_click, a.cust_cd, a.good_cd, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = a.cust_cd) cust_nm, a.good_nm, dbo.usf_size(a.sht_size1, a.sht_size2, 0, 'S') sht_size, dbo.usf_size(a.box_size1, a.box_size2, a.box_size3, 'b') box_size, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, case '"& lmachine4_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) end uwrk_qty, right(a.nap_date,6) nap_day, (isnull(b.ord_qty, 0) - isnull(b.plan_qty, 0)) mwrk_qty, (isnull(e.plan_qty, 0)) mi_plan_qty, case isnull(d.prod_qty, 0) when 0 then 0 else (isnull(d.prod_qty, 0) - isnull(xx.tuip_qty,0)) end mi_prod_qty, a.sht_qty, '1' sht_use_class, b.goods_class s_goods_class, b.ord_date s_ord_date, b.ord_seq s_ord_seq, a.julsu, a.hapsu, a.sheet_poksu, (select nap_nm from stb030t(nolock) where stb030t.crp_id = a.crp_id and stb030t.cust_cd = a.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = a.nap_cd) nap_nm, (select flute_nm from stb080t(nolock) where flute_cd = a.flute_cd) flute_nm, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd1) mtrl_nm1, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd2) mtrl_nm2, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd3) mtrl_nm3, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd4) mtrl_nm4, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd5) mtrl_nm5, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd6) mtrl_nm6, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd7) mtrl_nm7, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd1) proc_nm1, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd2) proc_nm2, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd3) proc_nm3, case '"& lmachine4_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine4_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine4_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine4_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine4_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine4_cd &"' when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) else 0 end proc_qty3, a.note_1, a.note_2, 1 proc_set1, 1 proc_set2, 1 proc_set3, case '"& lmachine4_cd &"' when a.proc_cd1 then case a.proc_cd2 when '' then '1' else '0' end when a.proc_cd2 then case a.proc_cd3 when '' then '1' else '0' end when a.proc_cd3 then '1' end proc_chk, 0 tmp_plan_qty, case a.defer_gubun when '0' then '' else 'DEFER' end defer_gubun, a.defer_note, isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) credit_chk, case isnull(d.prod_qty,0) when 0 then '' else right(dbo.f_datetermymd(d.e_time),11) end sht_prod_time from boa010t a(nolock) left outer join sha010t b(nolock) on a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.plan_qty - a.prod_qty) plan_qty from shb010t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' and a.plan_qty - a.prod_qty > 0 group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) e on a.crp_id = e.crp_id and a.goods_class = e.goods_class and a.ord_date = e.ord_date and a.ord_seq = e.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.prod_qty) prod_qty, max(a.e_time) e_time from shb020t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) d on a.crp_id = d.crp_id and a.goods_class = d.goods_class and a.ord_date = d.ord_date and a.ord_seq = d.ord_seq, boc010t xx(nolock) where a.crp_id = xx.crp_id and a.goods_class = xx.goods_class and a.ord_date = xx.ord_date and a.ord_seq = xx.ord_seq and a.crp_id = '10' and a.ord_date <= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end >= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end <= '"& fechafinal &"' and case '"& lmachine4_cd &"' when a.proc_cd1 then a.ord_qty - floor(isnull(a.proc_qty1, 0) * 1) when a.proc_cd2 then a.ord_qty - floor(isnull(a.proc_qty2, 0) * 1) when a.proc_cd3 then a.ord_qty - floor(isnull(a.proc_qty3, 0) * 1) end > 0 and a.ord_class = '1' and a.sheet_proc_yn <> '3' and case '"& lmachine4_cd &"' when a.proc_cd1 then '"& lmachine4_cd &"' when a.proc_cd2 then '"& lmachine4_cd &"' when a.proc_cd3 then '"& lmachine4_cd &"' end = '"& lmachine4_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000')") '''''''''''''''''''''''**************************************** MAQUINA 5 set Rsmaquinas5=dbsql.execute("select case isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) when '1' then '0' else '0' end choice_click, a.cust_cd, a.good_cd, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = a.cust_cd) cust_nm, a.good_nm, dbo.usf_size(a.sht_size1, a.sht_size2, 0, 'S') sht_size, dbo.usf_size(a.box_size1, a.box_size2, a.box_size3, 'b') box_size, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, case '"& lmachine5_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) end uwrk_qty, right(a.nap_date,6) nap_day, (isnull(b.ord_qty, 0) - isnull(b.plan_qty, 0)) mwrk_qty, (isnull(e.plan_qty, 0)) mi_plan_qty, case isnull(d.prod_qty, 0) when 0 then 0 else (isnull(d.prod_qty, 0) - isnull(xx.tuip_qty,0)) end mi_prod_qty, a.sht_qty, '1' sht_use_class, b.goods_class s_goods_class, b.ord_date s_ord_date, b.ord_seq s_ord_seq, a.julsu, a.hapsu, a.sheet_poksu, (select nap_nm from stb030t(nolock) where stb030t.crp_id = a.crp_id and stb030t.cust_cd = a.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = a.nap_cd) nap_nm, (select flute_nm from stb080t(nolock) where flute_cd = a.flute_cd) flute_nm, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd1) mtrl_nm1, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd2) mtrl_nm2, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd3) mtrl_nm3, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd4) mtrl_nm4, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd5) mtrl_nm5, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd6) mtrl_nm6, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd7) mtrl_nm7, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd1) proc_nm1, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd2) proc_nm2, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd3) proc_nm3, case '"& lmachine5_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine5_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine5_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine5_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine5_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine5_cd &"' when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) else 0 end proc_qty3, a.note_1, a.note_2, 1 proc_set1, 1 proc_set2, 1 proc_set3, case '"& lmachine5_cd &"' when a.proc_cd1 then case a.proc_cd2 when '' then '1' else '0' end when a.proc_cd2 then case a.proc_cd3 when '' then '1' else '0' end when a.proc_cd3 then '1' end proc_chk, 0 tmp_plan_qty, case a.defer_gubun when '0' then '' else 'DEFER' end defer_gubun, a.defer_note, isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) credit_chk, case isnull(d.prod_qty,0) when 0 then '' else right(dbo.f_datetermymd(d.e_time),11) end sht_prod_time from boa010t a(nolock) left outer join sha010t b(nolock) on a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.plan_qty - a.prod_qty) plan_qty from shb010t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' and a.plan_qty - a.prod_qty > 0 group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) e on a.crp_id = e.crp_id and a.goods_class = e.goods_class and a.ord_date = e.ord_date and a.ord_seq = e.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.prod_qty) prod_qty, max(a.e_time) e_time from shb020t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) d on a.crp_id = d.crp_id and a.goods_class = d.goods_class and a.ord_date = d.ord_date and a.ord_seq = d.ord_seq, boc010t xx(nolock) where a.crp_id = xx.crp_id and a.goods_class = xx.goods_class and a.ord_date = xx.ord_date and a.ord_seq = xx.ord_seq and a.crp_id = '10' and a.ord_date <= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end >= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end <= '"& fechafinal &"' and case '"& lmachine5_cd &"' when a.proc_cd1 then a.ord_qty - floor(isnull(a.proc_qty1, 0) * 1) when a.proc_cd2 then a.ord_qty - floor(isnull(a.proc_qty2, 0) * 1) when a.proc_cd3 then a.ord_qty - floor(isnull(a.proc_qty3, 0) * 1) end > 0 and a.ord_class = '1' and a.sheet_proc_yn <> '3' and case '"& lmachine5_cd &"' when a.proc_cd1 then '"& lmachine5_cd &"' when a.proc_cd2 then '"& lmachine5_cd &"' when a.proc_cd3 then '"& lmachine5_cd &"' end = '"& lmachine5_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000')") '''''''''''''''''''''''**************************************** MAQUINA 6 set Rsmaquinas6=dbsql.execute("select case isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) when '1' then '0' else '0' end choice_click, a.cust_cd, a.good_cd, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = a.cust_cd) cust_nm, a.good_nm, dbo.usf_size(a.sht_size1, a.sht_size2, 0, 'S') sht_size, dbo.usf_size(a.box_size1, a.box_size2, a.box_size3, 'b') box_size, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, case '"& lmachine6_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) end uwrk_qty, right(a.nap_date,6) nap_day, (isnull(b.ord_qty, 0) - isnull(b.plan_qty, 0)) mwrk_qty, (isnull(e.plan_qty, 0)) mi_plan_qty, case isnull(d.prod_qty, 0) when 0 then 0 else (isnull(d.prod_qty, 0) - isnull(xx.tuip_qty,0)) end mi_prod_qty, a.sht_qty, '1' sht_use_class, b.goods_class s_goods_class, b.ord_date s_ord_date, b.ord_seq s_ord_seq, a.julsu, a.hapsu, a.sheet_poksu, (select nap_nm from stb030t(nolock) where stb030t.crp_id = a.crp_id and stb030t.cust_cd = a.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = a.nap_cd) nap_nm, (select flute_nm from stb080t(nolock) where flute_cd = a.flute_cd) flute_nm, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd1) mtrl_nm1, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd2) mtrl_nm2, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd3) mtrl_nm3, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd4) mtrl_nm4, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd5) mtrl_nm5, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd6) mtrl_nm6, (select code_nm from sta010t(nolock) where major_cd = '9005' and minor_cd = a.mtrl_cd7) mtrl_nm7, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd1) proc_nm1, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd2) proc_nm2, (select proc_nm from stb160t(nolock) where proc_cd = a.proc_cd3) proc_nm3, case '"& lmachine6_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine6_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine6_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine6_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine6_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine6_cd &"' when a.proc_cd3 then (a.ord_qty - isnull(a.proc_qty3, 0)) else 0 end proc_qty3, a.note_1, a.note_2, 1 proc_set1, 1 proc_set2, 1 proc_set3, case '"& lmachine6_cd &"' when a.proc_cd1 then case a.proc_cd2 when '' then '1' else '0' end when a.proc_cd2 then case a.proc_cd3 when '' then '1' else '0' end when a.proc_cd3 then '1' end proc_chk, 0 tmp_plan_qty, case a.defer_gubun when '0' then '' else 'DEFER' end defer_gubun, a.defer_note, isnull((select isnull(max(plan_chk),'0') from stb012t(nolock) where crp_id = a.crp_id and cust_cd = a.cust_cd and job_date <= '"& fechainicial &"' group by cust_cd),0) credit_chk, case isnull(d.prod_qty,0) when 0 then '' else right(dbo.f_datetermymd(d.e_time),11) end sht_prod_time from boa010t a(nolock) left outer join sha010t b(nolock) on a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.plan_qty - a.prod_qty) plan_qty from shb010t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' and a.plan_qty - a.prod_qty > 0 group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) e on a.crp_id = e.crp_id and a.goods_class = e.goods_class and a.ord_date = e.ord_date and a.ord_seq = e.ord_seq left outer join (select a.crp_id, a.goods_class, a.ord_date, a.ord_seq, sum(a.prod_qty) prod_qty, max(a.e_time) e_time from shb020t a(nolock), boa010t b(nolock) where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.del_yn = '0' group by a.crp_id, a.goods_class, a.ord_date, a.ord_seq) d on a.crp_id = d.crp_id and a.goods_class = d.goods_class and a.ord_date = d.ord_date and a.ord_seq = d.ord_seq, boc010t xx(nolock) where a.crp_id = xx.crp_id and a.goods_class = xx.goods_class and a.ord_date = xx.ord_date and a.ord_seq = xx.ord_seq and a.crp_id = '10' and a.ord_date <= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end >= '"& fechainicial &"' and case isnull(a.nap_date, '00000000') when '00000000' then '"& fechainicial &"' when '' then '"& fechainicial &"' else a.nap_date end <= '"& fechafinal &"' and case '"& lmachine6_cd &"' when a.proc_cd1 then a.ord_qty - floor(isnull(a.proc_qty1, 0) * 1) when a.proc_cd2 then a.ord_qty - floor(isnull(a.proc_qty2, 0) * 1) when a.proc_cd3 then a.ord_qty - floor(isnull(a.proc_qty3, 0) * 1) end > 0 and a.ord_class = '1' and a.sheet_proc_yn <> '3' and case '"& lmachine6_cd &"' when a.proc_cd1 then '"& lmachine6_cd &"' when a.proc_cd2 then '"& lmachine6_cd &"' when a.proc_cd3 then '"& lmachine6_cd &"' end = '"& lmachine6_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000')") If Rsinven1.EOF And Rsinven1.BOF Then Existe1=0 else Existe1 = 1 end if If Rsmaquinas2.EOF And Rsmaquinas2.BOF Then Existe2=0 else Existe2 = 1 end if If Rsmaquinas3.EOF And Rsmaquinas3.BOF Then Existe3=0 else Existe3 = 1 end if If Rsmaquinas4.EOF And Rsmaquinas4.BOF Then Existe4=0 else Existe4 = 1 end if If Rsmaquinas5.EOF And Rsmaquinas5.BOF Then Existe5=0 else Existe5 = 1 end if If Rsmaquinas6.EOF And Rsmaquinas6.BOF Then Existe6=0 else Existe6 = 1 end if ' response.write(" ex 1 "&Existe1) ' response.write(" ex 2 "&Existe2) ' response.write(" ex 3 "&Existe3) ' response.write(" ex 4 "&Existe4) 'If Rsinven1.EOF And Rsinven1.BOF Then if existe1=0 and existe2=0 and existe3=0 and existe4=0 and existe5=0 and existe6=0 then 'Existe1 = False Msg = "No records exist for this date." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) response.Write("No records exist for this date.") Else %>

<% lrenglon=1 Do While lrenglon<11 %> <% if Not Rsinven1.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas2.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas3.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas4.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas5.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas6.EOF then %> <%else%> <%end if%> <% if Not Rsinven1.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas2.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas3.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas4.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas5.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas6.EOF then %> <%else%> <%end if%> <% if Not Rsinven1.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas2.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas3.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas4.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas5.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas6.EOF then %> <%else%> <%end if%> <% if Not Rsinven1.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas2.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas3.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas4.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas5.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas6.EOF then %> <%else%> <%end if%> <% if Not Rsinven1.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas2.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas3.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas4.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas5.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas6.EOF then %> <%else%> <%end if%> <% if Not Rsinven1.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas2.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas3.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas4.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas5.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas6.EOF then %> <%else%> <%end if%> <% if Not Rsinven1.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas2.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas3.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas4.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas5.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas6.EOF then %> <%else%> <%end if%> <% if Not Rsinven1.EOF then rsinven1.movenext else existe1=0 end if if Not Rsmaquinas2.EOF then rsmaquinas2.movenext else existe2=0 end if if Not rsmaquinas3.EOF then rsmaquinas3.movenext else existe3=0 end if if Not Rsmaquinas4.EOF then rsmaquinas4.movenext else existe4=0 end if if Not Rsmaquinas5.EOF then rsmaquinas5.movenext else existe4=0 end if if Not Rsmaquinas6.EOF then rsmaquinas6.movenext else existe4=0 end if if Rsinven1.EOF and Rsmaquinas2.EOF and Rsmaquinas3.EOF and Rsmaquinas4.EOF and Rsmaquinas5.EOF and Rsmaquinas6.EOF then 'exit do 'lrenglon=5 end if lrenglon=lrenglon+1 Loop Rsinven1.Close Set Rsinven1 = Nothing Rsmaquinas2.Close Set Rsmaquinas2 = Nothing Rsmaquinas3.Close Set Rsmaquinas3 = Nothing Rsmaquinas4.Close Set Rsmaquinas4 = Nothing Rsmaquinas5.Close Set Rsmaquinas5 = Nothing Rsmaquinas6.Close Set Rsmaquinas6 = Nothing rsmaquinas.close set rsmaquinas = nothing rsmachine2.close set rsmachine2 = nothing rsmachine3.close set rsmachine3 = nothing rsmachine4.close set rsmachine4 = nothing rsmachine5.close set rsmachine5 = nothing rsmachine6.close set rsmachine6 = nothing %>
DO Period: Planing WO by machine      <%=date()%>  <%=time()%>
Machines1
<%= lmaq1 %> <%= lmaq2%> <%= lmaq3%> <%= lmaq4%> <%= lmaq5%> <%= lmaq6%>
ORDER NO <%= Rsinven1("ord_no")%>   <%= Rsmaquinas2("ord_no")%>   <%= Rsmaquinas3("ord_no")%>   <%= Rsmaquinas4("ord_no")%>   <%= Rsmaquinas5("ord_no")%>   <%= Rsmaquinas6("ord_no")%>  
CUSTOMER <%= Rsinven1("cust_nm")%> <%= Rsmaquinas2("cust_nm")%> <%= Rsmaquinas3("cust_nm")%> <%= Rsmaquinas4("cust_nm")%> <%= Rsmaquinas5("cust_nm")%> <%= Rsmaquinas6("cust_nm")%> 
ITEM <%= Rsinven1("good_nm")%>  <%= Rsmaquinas2("good_nm")%>  <%= Rsmaquinas3("good_nm")%>  <%= Rsmaquinas4("good_nm")%>  <%= Rsmaquinas5("good_nm")%>  <%= Rsmaquinas6("good_nm")%>  
PLAN_QTY <%= Rsinven1("uwrk_qty")%>  <%= Rsmaquinas2("uwrk_qty")%>  <%= Rsmaquinas3("uwrk_qty")%>  <%= Rsmaquinas4("uwrk_qty")%>  <%= Rsmaquinas5("uwrk_qty")%>  <%= Rsmaquinas6("uwrk_qty")%>  
SHT Pending <%= Rsinven1("mwrk_qty")%>  <%= Rsmaquinas2("mwrk_qty")%>  <%= Rsmaquinas3("mwrk_qty")%>  <%= Rsmaquinas4("mwrk_qty")%>  <%= Rsmaquinas5("mwrk_qty")%>  <%= Rsmaquinas6("mwrk_qty")%>  
SHT Plan <%= Rsinven1("mi_plan_qty")%>  <%= Rsmaquinas2("mi_plan_qty")%>  <%= Rsmaquinas3("mi_plan_qty")%>  <%= Rsmaquinas4("mi_plan_qty")%>  <%= Rsmaquinas5("mi_plan_qty")%>  <%= Rsmaquinas6("mi_plan_qty")%>  
SHT Ready <%= Rsinven1("mi_prod_qty")& " " & Rsinven1("sht_prod_time")%>  <%= Rsmaquinas2("mi_prod_qty")& " " & Rsmaquinas2("sht_prod_time")%>  <%= Rsmaquinas3("mi_prod_qty")& " " & Rsmaquinas3("sht_prod_time")%>  <%= Rsmaquinas4("mi_prod_qty")& " " & Rsmaquinas4("sht_prod_time")%>  <%= Rsmaquinas5("mi_prod_qty")& " " & Rsmaquinas5("sht_prod_time")%>  <%= Rsmaquinas6("mi_prod_qty")& " " & Rsmaquinas6("sht_prod_time")%>  
 
 
<% End If '**************end maquinas 'End if 'busca=ok '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''*****************Page 2 %>

<% 'if busca="ok" then '''''''''''calcula strday = Right("00" & Day(Date_ini), 2) strmonth = Right("00" & Month(Date_ini), 2) stryear = Right("00" & Year(Date_ini), 4) strday2 = Right("00" & Day(Date_end), 2) strmonth2 = Right("00" & Month(Date_end), 2) stryear2 = Right("00" & Year(Date_end), 4) fechainicial = CStr(stryear + strmonth + strday) fechafinal = CStr(stryear2 + strmonth2 + strday2) 'response.write(" FI "&fechainicial) ' response.write(fechafinal)&" Ff " '************** Inventory Dim Rsinven3, Rsinven4,rsmaquinas7,rsmaquinas8,rsmaquinas9,rsmaquinas10,rsmaquinas11,rsmaquinas12 lmachine7_cd=cmaquina7 lmachine8_cd=cmaquina8 lmachine9_cd=cmaquina9 lmachine10_cd=cmaquina10 lmachine11_cd=cmaquina11 lmachine12_cd=cmaquina12 'response.write(" maquina: "&lmachine_cd) '''''''''''''''''''''''**************************************** MAQUINA 1 set Rsmaquinas7=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine7_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine7_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine7_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine7_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine7_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine7_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine7_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine7_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine7_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") '''''''''''''''''''''''**************************************** MAQUINA 2 set Rsmaquinas8=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine8_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine8_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine8_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine8_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine8_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine8_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine8_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine8_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine8_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") '''''''''''''''''''''''**************************************** MAQUINA 9 set Rsmaquinas9=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine9_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine9_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine9_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine9_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine9_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine9_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine9_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine9_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine9_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") '''''''''''''''''''''''**************************************** MAQUINA 10 set Rsmaquinas10=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine10_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine10_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine10_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine10_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine10_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine10_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine10_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine10_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine10_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") '''''''''''''''''''''''**************************************** MAQUINA 11 set Rsmaquinas11=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine11_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine11_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine11_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine11_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine11_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine11_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine11_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine11_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine11_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") '''''''''''''''''''''''**************************************** MAQUINA 12 set Rsmaquinas12=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine12_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine12_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine12_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine12_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine12_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine12_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine12_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine12_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine12_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") If Rsmaquinas7.EOF And Rsmaquinas7.BOF Then Existe7=0 else Existe7 = 1 end if If Rsmaquinas8.EOF And Rsmaquinas8.BOF Then Existe8=0 else Existe8 = 1 end if If Rsmaquinas9.EOF And Rsmaquinas9.BOF Then Existe9=0 else Existe9 = 1 end if If Rsmaquinas10.EOF And Rsmaquinas10.BOF Then Existe10=0 else Existe10 = 1 end if If Rsmaquinas11.EOF And Rsmaquinas11.BOF Then Existe11=0 else Existe11 = 1 end if If Rsmaquinas12.EOF And Rsmaquinas12.BOF Then Existe12=0 else Existe12 = 1 end if ' response.write(" ex 1 "&Existe1) ' response.write(" ex 2 "&Existe2) ' response.write(" ex 3 "&Existe3) ' response.write(" ex 4 "&Existe4) 'If Rsinven1.EOF And Rsinven1.BOF Then if existe7=0 and existe8=0 and existe9=0 and existe10=0 and existe11=0 and existe12=0 then 'Existe1 = False Msg = "No records exist for this date." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) response.Write("No records exist for this date.") Else %>

<% lrenglon2=1 Do While lrenglon2<6 %> <% if Not Rsmaquinas7.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas8.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas9.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas10.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas11.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas12.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas7.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas8.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas9.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas10.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas11.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas12.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas7.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas8.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas9.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas10.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas11.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas12.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas7.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas8.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas9.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas10.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas11.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas12.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas7.EOF then Rsmaquinas7.movenext else existe7=0 end if if Not Rsmaquinas8.EOF then rsmaquinas8.movenext else existe8=0 end if if Not rsmaquinas9.EOF then rsmaquinas9.movenext else existe9=0 end if if Not Rsmaquinas10.EOF then rsmaquinas10.movenext else existe10=0 end if if Not Rsmaquinas11.EOF then rsmaquinas11.movenext else existe11=0 end if if Not Rsmaquinas12.EOF then rsmaquinas12.movenext else existe12=0 end if if Rsmaquinas7.EOF and Rsmaquinas8.EOF and Rsmaquinas9.EOF and Rsmaquinas10.EOF and Rsmaquinas11.EOF and Rsmaquinas12.EOF then 'exit do 'lrenglon2=5 end if lrenglon2=lrenglon2+1 Loop Rsmaquinas7.Close Set Rsmaquinas7 = Nothing Rsmaquinas8.Close Set Rsmaquinas8 = Nothing Rsmaquinas9.Close Set Rsmaquinas9 = Nothing Rsmaquinas10.Close Set Rsmaquinas10 = Nothing Rsmaquinas11.Close Set Rsmaquinas11 = Nothing Rsmaquinas12.Close Set Rsmaquinas12 = Nothing rsmachine7.close set rsmachine7 = nothing rsmachine8.close set rsmachine8 = nothing rsmachine9.close set rsmachine9 = nothing rsmachine10.close set rsmachine10 = nothing rsmachine11.close set rsmachine11 = nothing rsmachine12.close set rsmachine12 = nothing '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''******** Page3 %>
Machines2
<%= lmaq7 %> <%= lmaq8%> <%= lmaq9%> <%= lmaq10%> <%= lmaq11%> <%= lmaq12%>
ORDER NO <%= Rsmaquinas7("ord_no")%>   <%= Rsmaquinas8("ord_no")%>   <%= Rsmaquinas9("ord_no")%>   <%= Rsmaquinas10("ord_no")%>   <%= Rsmaquinas11("ord_no")%>   <%= Rsmaquinas12("ord_no")%>  
CUSTOMER <%= Rsmaquinas7("cust_nm")%> <%= Rsmaquinas8("cust_nm")%> <%= Rsmaquinas9("cust_nm")%> <%= Rsmaquinas10("cust_nm")%> <%= Rsmaquinas11("cust_nm")%> <%= Rsmaquinas12("cust_nm")%> 
ITEM <%= Rsmaquinas7("good_nm")%>  <%= Rsmaquinas8("good_nm")%>  <%= Rsmaquinas9("good_nm")%>  <%= Rsmaquinas10("good_nm")%>  <%= Rsmaquinas11("good_nm")%>  <%= Rsmaquinas12("good_nm")%>  
PLAN_QTY <%= Rsmaquinas7("plan_qty")%>  <%= Rsmaquinas8("plan_qty")%>  <%= Rsmaquinas9("plan_qty")%>  <%= Rsmaquinas10("plan_qty")%>  <%= Rsmaquinas11("plan_qty")%>  <%= Rsmaquinas12("plan_qty")%>  
 
 
<% End If %>

<% 'if busca="ok" then '''''''''''calcula strday = Right("00" & Day(Date_ini), 2) strmonth = Right("00" & Month(Date_ini), 2) stryear = Right("00" & Year(Date_ini), 4) strday2 = Right("00" & Day(Date_end), 2) strmonth2 = Right("00" & Month(Date_end), 2) stryear2 = Right("00" & Year(Date_end), 4) fechainicial = CStr(stryear + strmonth + strday) fechafinal = CStr(stryear2 + strmonth2 + strday2) 'response.write(" FI "&fechainicial) ' response.write(fechafinal)&" Ff " '************** Inventory Dim rsmaquinas13,rsmaquinas14,rsmaquinas15,rsmaquinas16,rsmaquinas17,rsmaquinas18 lmachine13_cd=cmaquina13 lmachine14_cd=cmaquina14 lmachine15_cd=cmaquina15 lmachine16_cd=cmaquina16 lmachine17_cd=cmaquina17 lmachine18_cd=cmaquina18 'response.write(" maquina: "&lmachine_cd) '''''''''''''''''''''''**************************************** MAQUINA 1 set Rsmaquinas13=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine13_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine13_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine13_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine13_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine13_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine13_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine13_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine13_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine13_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") '''''''''''''''''''''''**************************************** MAQUINA 2 set Rsmaquinas14=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine14_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine14_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine14_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine14_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine14_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine14_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine14_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine14_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine14_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") '''''''''''''''''''''''**************************************** MAQUINA 9 set Rsmaquinas15=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine15_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine15_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine15_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine15_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine15_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine15_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine15_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine15_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine15_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") '''''''''''''''''''''''**************************************** MAQUINA 10 set Rsmaquinas16=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine16_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine16_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine16_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine16_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine16_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine16_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine16_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine16_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine16_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") '''''''''''''''''''''''**************************************** MAQUINA 11 set Rsmaquinas17=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine17_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine17_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine17_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine17_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine17_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine17_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine17_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine17_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine17_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") '''''''''''''''''''''''**************************************** MAQUINA 12 set Rsmaquinas18=dbsql.execute("select a.crp_id, a.plan_date, right(a.plan_date,6) plan_day, a.plan_seq, a.goods_class, a.ord_date, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, a.ord_seq, a.proc_cd, a.plan_no, a.plan_qty, a.prod_qty, (select cust_nm from stb010t(nolock) where stb010t.cust_cd = b.cust_cd) cust_nm, b.ord_qty, b.good_nm, (select nap_nm from stb030t where stb030t.crp_id = b.crp_id and stb030t.cust_cd = b.cust_cd and stb030t.nap_cd <> '1' and stb030t.nap_cd = b.nap_cd) nap_nm, b.box_size1, b.box_size2, b.box_size3, b.nap_date, ' ' nap_time, a.sht_use_class, b.sht_size1, b.sht_size2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd1) mtrl_nm1, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd2) mtrl_nm2, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd3) mtrl_nm3, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd4) mtrl_nm4, (Select mtrl_dis_nm from stb070t(nolock) where mtrl_cd = b.mtrl_cd5) mtrl_nm5, (Select code_nm from sta010t(nolock) where major_cd = '9006' and minor_cd = b.flute_cd) flute_nm, case '"& lmachine18_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine18_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine18_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine18_cd &"' when a.proc_cd1 then a.proc_qty1 else 0 end proc_qty1, case '"& lmachine18_cd &"' when a.proc_cd2 then a.proc_qty2 else 0 end proc_qty2, case '"& lmachine18_cd &"' when a.proc_cd3 then a.proc_qty3 else 0 end proc_qty3, (select proc_nm from stb160t(nolock) where proc_cd = case '"& lmachine18_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end) proc_nm1, b.good_cd, b.cust_cd, B.ord_qty, (select color_nm from stb190t(nolock) where color_cd = e.color1) color_nm1, (select color_nm from stb190t(nolock) where color_cd = e.color2) color_nm2, (select color_nm from stb190t(nolock) where color_cd = e.color3) color_nm3, (select color_nm from stb190t(nolock) where color_cd = e.color4) color_nm4, e.keep_cd, e.note1, e.note2, e.note3, b.design_no, (select code_nm from sta010t (nolock) where major_cd = '1009' and minor_cd = b.packing_way and b.packing_way > '0') packing_way_nm, (select code_nm from sta010t (nolock) where major_cd = '1010' and minor_cd = b.join_way and b.join_way > '0') join_way_nm, d.pallet_kind, (select in_size from stb041t(nolock) where pallet_no = d.pallet_kind) in_size, d.bundle * d.bundle_qty * d.layer_pallet pallet_qty , b.sht_note_1 note_1, b.sht_note_2 note_2, d.note_1 note_3, d.note_2 note_4, case a.work_gubun when '0' then '1S' when '1' then '2S' when '2' then '3S' end work_gubun_nm, b.mae_m2 " & _ "from bob010t a(nolock), boa010t b(nolock) left outer join (select crp_id, cust_cd, good_cd, keep_cd, note1, note2, note3, color1, color2, color3, color4 from stb180t(nolock) where crp_id = '10') e on b.crp_id = e.crp_id and b.cust_cd = e.cust_cd and b.good_cd = e.good_cd, stb040t d(nolock) "& _ "where a.crp_id = b.crp_id and a.goods_class = b.goods_class and a.ord_date = b.ord_date and a.ord_seq = b.ord_seq and b.cust_cd = d.cust_cd and b.good_cd = d.good_cd and a.crp_id = '10' and a.plan_date >= '"& fechainicial &"' and a.plan_date <= '"& fechafinal &"' and case '"& lmachine18_cd &"' when a.proc_cd1 then a.proc_cd1 when a.proc_cd2 then a.proc_cd2 when a.proc_cd3 then a.proc_cd3 end = '"& lmachine18_cd &"' and a.plan_qty - a.prod_qty > 0 " & _ "order by a.plan_date, a.proc_cd, a.work_gubun, a.plan_no, a.plan_seq, a.ord_date, a.ord_seq") If Rsmaquinas13.EOF And Rsmaquinas13.BOF Then Existe13=0 else Existe13 = 1 end if If Rsmaquinas14.EOF And Rsmaquinas14.BOF Then Existe14=0 else Existe14 = 1 end if If Rsmaquinas15.EOF And Rsmaquinas15.BOF Then Existe15=0 else Existe15 = 1 end if If Rsmaquinas16.EOF And Rsmaquinas16.BOF Then Existe16=0 else Existe16 = 1 end if If Rsmaquinas17.EOF And Rsmaquinas17.BOF Then Existe17=0 else Existe17 = 1 end if If Rsmaquinas18.EOF And Rsmaquinas18.BOF Then Existe18=0 else Existe18 = 1 end if ' response.write(" ex 1 "&Existe1) ' response.write(" ex 2 "&Existe2) ' response.write(" ex 3 "&Existe3) ' response.write(" ex 4 "&Existe4) 'If Rsinven1.EOF And Rsinven1.BOF Then if existe13=0 and existe14=0 and existe15=0 and existe16=0 and existe17=0 and existe18=0 then 'Existe1 = False Msg = "No records exist for this date." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) response.Write("No records exist for this date.") Else %>

<% lrenglon3=1 Do While lrenglon3<6 %> <% if Not Rsmaquinas13.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas14.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas15.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas16.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas17.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas18.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas13.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas14.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas15.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas16.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas17.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas18.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas13.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas14.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas15.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas16.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas17.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas18.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas13.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas14.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas15.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas16.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas17.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas18.EOF then %> <%else%> <%end if%> <% if Not Rsmaquinas13.EOF then Rsmaquinas13.movenext else existe13=0 end if if Not Rsmaquinas14.EOF then rsmaquinas14.movenext else existe14=0 end if if Not rsmaquinas15.EOF then rsmaquinas15.movenext else existe15=0 end if if Not Rsmaquinas16.EOF then rsmaquinas16.movenext else existe16=0 end if if Not Rsmaquinas17.EOF then rsmaquinas17.movenext else existe17=0 end if if Not Rsmaquinas18.EOF then rsmaquinas18.movenext else existe18=0 end if if Rsmaquinas13.EOF and Rsmaquinas14.EOF and Rsmaquinas15.EOF and Rsmaquinas16.EOF and Rsmaquinas17.EOF and Rsmaquinas18.EOF then 'exit do 'lrenglon3=5 end if lrenglon3=lrenglon3+1 Loop Rsmaquinas13.Close Set Rsmaquinas13 = Nothing Rsmaquinas14.Close Set Rsmaquinas14 = Nothing Rsmaquinas15.Close Set Rsmaquinas15 = Nothing Rsmaquinas16.Close Set Rsmaquinas16 = Nothing Rsmaquinas17.Close Set Rsmaquinas17 = Nothing Rsmaquinas18.Close Set Rsmaquinas18 = Nothing rsmachine13.close set rsmachine13 = nothing rsmachine14.close set rsmachine14 = nothing rsmachine15.close set rsmachine15 = nothing rsmachine16.close set rsmachine16 = nothing rsmachine17.close set rsmachine17 = nothing rsmachine18.close set rsmachine18 = nothing %>
Machines3
<%= lmaq13 %> <%= lmaq14%> <%= lmaq15%> <%= lmaq16%> <%= lmaq17%> <%= lmaq18%>
ORDER NO <%= Rsmaquinas13("ord_no")%>   <%= Rsmaquinas14("ord_no")%>   <%= Rsmaquinas15("ord_no")%>   <%= Rsmaquinas16("ord_no")%>   <%= Rsmaquinas17("ord_no")%>   <%= Rsmaquinas18("ord_no")%>  
CUSTOMER <%= Rsmaquinas13("cust_nm")%> <%= Rsmaquinas14("cust_nm")%> <%= Rsmaquinas15("cust_nm")%> <%= Rsmaquinas16("cust_nm")%> <%= Rsmaquinas17("cust_nm")%> <%= Rsmaquinas18("cust_nm")%> 
ITEM <%= Rsmaquinas13("good_nm")%>  <%= Rsmaquinas14("good_nm")%>  <%= Rsmaquinas15("good_nm")%>  <%= Rsmaquinas16("good_nm")%>  <%= Rsmaquinas17("good_nm")%>  <%= Rsmaquinas18("good_nm")%>  
PLAN_QTY <%= Rsmaquinas13("plan_qty")%>  <%= Rsmaquinas14("plan_qty")%>  <%= Rsmaquinas15("plan_qty")%>  <%= Rsmaquinas16("plan_qty")%>  <%= Rsmaquinas17("plan_qty")%>  <%= Rsmaquinas18("plan_qty")%>  
 
 
''''''''''''''''''''''''''''''''''''''''''''''''************* fin page 3
<% End If '**************end maquinas %>