DO Period:
Plan Stand By <%=date()%> <%=time()%>
Machines1
<%= cmaquina%>
<%
if not rsmaquinas.eof then
rsmaquinas.movefirst
end if
while not rsmaquinas.eof
%>
"><%= rsmaquinas("proc_nm")%>
<%
rsmaquinas.movenext
wend%>
<%= cmaquina2%>
<%
if not rsmachine2.eof then
rsmachine2.movefirst
end if
while not rsmachine2.eof
%>
"><%= rsmachine2("proc_nm")%>
<%
rsmachine2.movenext
wend%>
<%= cmaquina3%>
<%
if not rsmachine3.eof then
rsmachine3.movefirst
end if
while not rsmachine3.eof
%>
"><%= rsmachine3("proc_nm")%>
<%
rsmachine3.movenext
wend%>
<%= cmaquina4%>
<%
if not rsmachine4.eof then
rsmachine4.movefirst
end if
while not rsmachine4.eof
%>
"><%= rsmachine4("proc_nm")%>
<%
rsmachine4.movenext
wend
%>
<%= cmaquina5%>
<%
if not rsmachine5.eof then
rsmachine5.movefirst
end if
while not rsmachine5.eof
%>
"><%= rsmachine5("proc_nm")%>
<%
rsmachine5.movenext
wend
%>
<%= cmaquina6%>
<%
if not rsmachine6.eof then
rsmachine6.movefirst
end if
while not rsmachine6.eof
%>
"><%= rsmachine6("proc_nm")%>
<%
rsmachine6.movenext
wend
%>
<%
'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'),ord_no")
'''''''''''''''''''''''**************************************** 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'),ord_no")
'''''''''''''''''''''''**************************************** 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'),ord_no")
'''''''''''''''''''''''**************************************** 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'),ord_no")
'''''''''''''''''''''''**************************************** 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'),ord_no")
'''''''''''''''''''''''**************************************** 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'),ord_no")
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
%>
<%= lmaq1 %>
<%= lmaq2%>
<%= lmaq3%>
<%= lmaq4%>
<%= lmaq5%>
<%= lmaq6%>
<%
lrenglon=1
Do While lrenglon<11 and lfin<>1
%>
ORDER NO
<% if Not Rsinven1.EOF then %>
<%= Rsinven1("ord_no")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas2.EOF then %>
<%= Rsmaquinas2("ord_no")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas3.EOF then %>
<%= Rsmaquinas3("ord_no")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas4.EOF then %>
<%= Rsmaquinas4("ord_no")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas5.EOF then %>
<%= Rsmaquinas5("ord_no")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas6.EOF then %>
<%= Rsmaquinas6("ord_no")%>
<%else%>
<%end if%>
CUSTOMER
<% if Not Rsinven1.EOF then %>
<%= Rsinven1("cust_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas2.EOF then %>
<%= Rsmaquinas2("cust_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas3.EOF then %>
<%= Rsmaquinas3("cust_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas4.EOF then %>
<%= Rsmaquinas4("cust_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas5.EOF then %>
<%= Rsmaquinas5("cust_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas6.EOF then %>
<%= Rsmaquinas6("cust_nm")%>
<%else%>
<%end if%>
ITEM
<% if Not Rsinven1.EOF then %>
<%= Rsinven1("good_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas2.EOF then %>
<%= Rsmaquinas2("good_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas3.EOF then %>
<%= Rsmaquinas3("good_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas4.EOF then %>
<%= Rsmaquinas4("good_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas5.EOF then %>
<%= Rsmaquinas5("good_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas6.EOF then %>
<%= Rsmaquinas6("good_nm")%>
<%else%>
<%end if%>
PLAN_QTY
<% if Not Rsinven1.EOF then %>
<%= Rsinven1("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas2.EOF then %>
<%= Rsmaquinas2("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas3.EOF then %>
<%= Rsmaquinas3("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas4.EOF then %>
<%= Rsmaquinas4("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas5.EOF then %>
<%= Rsmaquinas5("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas6.EOF then %>
<%= Rsmaquinas6("uwrk_qty")%>
<%else%>
<%end if%>
SHT Pending
<% if Not Rsinven1.EOF then %>
<%= Rsinven1("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas2.EOF then %>
<%= Rsmaquinas2("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas3.EOF then %>
<%= Rsmaquinas3("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas4.EOF then %>
<%= Rsmaquinas4("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas5.EOF then %>
<%= Rsmaquinas5("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas6.EOF then %>
<%= Rsmaquinas6("mwrk_qty")%>
<%else%>
<%end if%>
SHT Plan
<% if Not Rsinven1.EOF then %>
<%= Rsinven1("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas2.EOF then %>
<%= Rsmaquinas2("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas3.EOF then %>
<%= Rsmaquinas3("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas4.EOF then %>
<%= Rsmaquinas4("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas5.EOF then %>
<%= Rsmaquinas5("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas6.EOF then %>
<%= Rsmaquinas6("mi_plan_qty")%>
<%else%>
<%end if%>
SHT Ready
<% if Not Rsinven1.EOF then %>
<%= Rsinven1("mi_prod_qty")& " "%> <%=Rsinven1("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas2.EOF then %>
<%= Rsmaquinas2("mi_prod_qty")& " "%> <%=Rsmaquinas2("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas3.EOF then %>
<%= Rsmaquinas3("mi_prod_qty")& " "%> <%=Rsmaquinas3("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas4.EOF then %>
<%= Rsmaquinas4("mi_prod_qty")& " "%> <%=Rsmaquinas4("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas5.EOF then %>
<%= Rsmaquinas5("mi_prod_qty")& " "%> <%=Rsmaquinas5("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas6.EOF then %>
<%= Rsmaquinas6("mi_prod_qty")& " "%> <%=Rsmaquinas6("sht_prod_time")%>
<%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
lfin=1
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
%>
<%
End If
'**************end maquinas
'End if 'busca=ok
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''*****************FIN Page 1
%>
Machines2
<%= cmaquina7%>
<%
if not rsmachine7.eof then
rsmachine7.movefirst
end if
while not rsmachine7.eof
%>
"><%= rsmachine7("proc_nm")%>
<%
rsmachine7.movenext
wend%>
<%= cmaquina8%>
<%
if not rsmachine8.eof then
rsmachine8.movefirst
end if
while not rsmachine8.eof
%>
"><%= rsmachine8("proc_nm")%>
<%
rsmachine8.movenext
wend%>
<%= cmaquina9%>
<%
if not rsmachine9.eof then
rsmachine9.movefirst
end if
while not rsmachine9.eof
%>
"><%= rsmachine9("proc_nm")%>
<%
rsmachine9.movenext
wend%>
<%= cmaquina10%>
<%
if not rsmachine10.eof then
rsmachine10.movefirst
end if
while not rsmachine10.eof
%>
"><%= rsmachine10("proc_nm")%>
<%
rsmachine10.movenext
wend
%>
<%= cmaquina11%>
<%
if not rsmachine11.eof then
rsmachine11.movefirst
end if
while not rsmachine11.eof
%>
"><%= rsmachine11("proc_nm")%>
<%
rsmachine11.movenext
wend
%>
<%= cmaquina12%>
<%
if not rsmachine12.eof then
rsmachine12.movefirst
end if
while not rsmachine12.eof
%>
"><%= rsmachine12("proc_nm")%>
<%
rsmachine12.movenext
wend
%>
<%
Dim rsmaquinas7,rsmaquinas8,rsmaquinas9,rsmaquinas10,rsmaquinas11,rsmaquinas12
lmachine7_cd=cmaquina7
lmachine8_cd=cmaquina8
lmachine9_cd=cmaquina9
lmachine10_cd=cmaquina10
lmachine11_cd=cmaquina11
lmachine12_cd=cmaquina12
'''''''''''''''''''''''**************************************** MAQUINA 7
''''************* d-box2032
set Rsmaquinas7=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 '"& lmachine7_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 '"& lmachine7_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine7_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine7_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine7_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine7_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine7_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 '"& lmachine7_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 '"& lmachine7_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 '"& lmachine7_cd &"' when a.proc_cd1 then '"& lmachine7_cd &"' when a.proc_cd2 then '"& lmachine7_cd &"' when a.proc_cd3 then '"& lmachine7_cd &"' end = '"& lmachine7_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
'''''''''''''''''''''''**************************************** MAQUINA 2
set Rsmaquinas8=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 '"& lmachine8_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 '"& lmachine8_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine8_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine8_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine8_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine8_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine8_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 '"& lmachine8_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 '"& lmachine8_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 '"& lmachine8_cd &"' when a.proc_cd1 then '"& lmachine8_cd &"' when a.proc_cd2 then '"& lmachine8_cd &"' when a.proc_cd3 then '"& lmachine8_cd &"' end = '"& lmachine8_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
'''''''''''''''''''''''**************************************** MAQUINA 3
set Rsmaquinas9=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 '"& lmachine9_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 '"& lmachine9_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine9_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine9_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine9_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine9_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine9_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 '"& lmachine9_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 '"& lmachine9_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 '"& lmachine9_cd &"' when a.proc_cd1 then '"& lmachine9_cd &"' when a.proc_cd2 then '"& lmachine9_cd &"' when a.proc_cd3 then '"& lmachine9_cd &"' end = '"& lmachine9_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
'''''''''''''''''''''''**************************************** MAQUINA 10
set Rsmaquinas10=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 '"& lmachine10_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 '"& lmachine10_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine10_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine10_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine10_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine10_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine10_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 '"& lmachine10_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 '"& lmachine10_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 '"& lmachine10_cd &"' when a.proc_cd1 then '"& lmachine10_cd &"' when a.proc_cd2 then '"& lmachine10_cd &"' when a.proc_cd3 then '"& lmachine10_cd &"' end = '"& lmachine10_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
'''''''''''''''''''''''**************************************** MAQUINA 11
set Rsmaquinas11=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 '"& lmachine11_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 '"& lmachine11_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine11_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine11_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine11_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine11_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine11_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 '"& lmachine11_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 '"& lmachine11_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 '"& lmachine11_cd &"' when a.proc_cd1 then '"& lmachine11_cd &"' when a.proc_cd2 then '"& lmachine11_cd &"' when a.proc_cd3 then '"& lmachine11_cd &"' end = '"& lmachine11_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
'''''''''''''''''''''''**************************************** MAQUINA 12
set Rsmaquinas12=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 '"& lmachine12_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 '"& lmachine12_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine12_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine12_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine12_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine12_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine12_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 '"& lmachine12_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 '"& lmachine12_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 '"& lmachine12_cd &"' when a.proc_cd1 then '"& lmachine12_cd &"' when a.proc_cd2 then '"& lmachine12_cd &"' when a.proc_cd3 then '"& lmachine12_cd &"' end = '"& lmachine12_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
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
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
%>
<%= lmaq7 %>
<%= lmaq8%>
<%= lmaq9%>
<%= lmaq10%>
<%= lmaq11%>
<%= lmaq12%>
<%
lrenglon2=1
Do While lrenglon2<11 and lfin2<>1
%>
ORDER NO
<% if Not Rsmaquinas7.EOF then %>
<%= Rsmaquinas7("ord_no")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas8.EOF then %>
<%= Rsmaquinas8("ord_no")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas9.EOF then %>
<%= Rsmaquinas9("ord_no")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas10.EOF then %>
<%= Rsmaquinas10("ord_no")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas11.EOF then %>
<%= Rsmaquinas11("ord_no")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas12.EOF then %>
<%= Rsmaquinas12("ord_no")%>
<%else%>
<%end if%>
CUSTOMER
<% if Not Rsmaquinas7.EOF then %>
<%= Rsmaquinas7("cust_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas8.EOF then %>
<%= Rsmaquinas8("cust_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas9.EOF then %>
<%= Rsmaquinas9("cust_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas10.EOF then %>
<%= Rsmaquinas10("cust_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas11.EOF then %>
<%= Rsmaquinas11("cust_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas12.EOF then %>
<%= Rsmaquinas12("cust_nm")%>
<%else%>
<%end if%>
ITEM
<% if Not Rsmaquinas7.EOF then %>
<%= Rsmaquinas7("good_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas8.EOF then %>
<%= Rsmaquinas8("good_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas9.EOF then %>
<%= Rsmaquinas9("good_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas10.EOF then %>
<%= Rsmaquinas10("good_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas11.EOF then %>
<%= Rsmaquinas11("good_nm")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas12.EOF then %>
<%= Rsmaquinas12("good_nm")%>
<%else%>
<%end if%>
PLAN_QTY
<% if Not Rsmaquinas7.EOF then %>
<%= Rsmaquinas7("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas8.EOF then %>
<%= Rsmaquinas8("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas9.EOF then %>
<%= Rsmaquinas9("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas10.EOF then %>
<%= Rsmaquinas10("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas11.EOF then %>
<%= Rsmaquinas11("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas12.EOF then %>
<%= Rsmaquinas12("uwrk_qty")%>
<%else%>
<%end if%>
SHT Pending
<% if Not Rsmaquinas7.EOF then %>
<%= Rsmaquinas7("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas8.EOF then %>
<%= Rsmaquinas8("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas9.EOF then %>
<%= Rsmaquinas9("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas10.EOF then %>
<%= Rsmaquinas10("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas11.EOF then %>
<%= Rsmaquinas11("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas12.EOF then %>
<%= Rsmaquinas12("mwrk_qty")%>
<%else%>
<%end if%>
SHT Plan
<% if Not Rsmaquinas7.EOF then %>
<%= Rsmaquinas7("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas8.EOF then %>
<%= Rsmaquinas8("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas9.EOF then %>
<%= Rsmaquinas9("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas10.EOF then %>
<%= Rsmaquinas10("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas11.EOF then %>
<%= Rsmaquinas11("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas12.EOF then %>
<%= Rsmaquinas12("mi_plan_qty")%>
<%else%>
<%end if%>
SHT Ready
<% if Not Rsmaquinas7.EOF then %>
<%= Rsmaquinas7("mi_prod_qty")& " "%> <%=Rsmaquinas7("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas8.EOF then %>
<%= Rsmaquinas8("mi_prod_qty")& " "%> <%=Rsmaquinas8("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas9.EOF then %>
<%= Rsmaquinas9("mi_prod_qty")& " "%> <%=Rsmaquinas9("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas10.EOF then %>
<%= Rsmaquinas10("mi_prod_qty")& " "%> <%=Rsmaquinas10("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas11.EOF then %>
<%= Rsmaquinas11("mi_prod_qty")& " "%> <%=Rsmaquinas11("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not Rsmaquinas12.EOF then %>
<%= Rsmaquinas12("mi_prod_qty")& " "%> <%=Rsmaquinas12("sht_prod_time")%>
<%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
lfin2=1
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
%>
<%
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''*****************FIN Page 2
%>
Machines3
<%= cmaquina13%>
<%
if not rsmachine13.eof then
rsmachine13.movefirst
end if
while not rsmachine13.eof
%>
"><%= rsmachine13("proc_nm")%>
<%
rsmachine13.movenext
wend%>
<%= cmaquina14%>
<%
if not rsmachine14.eof then
rsmachine14.movefirst
end if
while not rsmachine14.eof
%>
"><%= rsmachine14("proc_nm")%>
<%
rsmachine14.movenext
wend%>
<%= cmaquina15%>
<%
if not rsmachine15.eof then
rsmachine15.movefirst
end if
while not rsmachine15.eof
%>
"><%= rsmachine15("proc_nm")%>
<%
rsmachine15.movenext
wend%>
<%= cmaquina16%>
<%
if not rsmachine16.eof then
rsmachine16.movefirst
end if
while not rsmachine16.eof
%>
"><%= rsmachine16("proc_nm")%>
<%
rsmachine16.movenext
wend
%>
<%= cmaquina17%>
<%
if not rsmachine17.eof then
rsmachine17.movefirst
end if
while not rsmachine17.eof
%>
"><%= rsmachine17("proc_nm")%>
<%
rsmachine17.movenext
wend
%>
<%= cmaquina18%>
<%
if not rsmachine18.eof then
rsmachine18.movefirst
end if
while not rsmachine18.eof
%>
"><%= rsmachine18("proc_nm")%>
<%
rsmachine18.movenext
wend
%>
<%
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
'''''''''''''''''''''''**************************************** MAQUINA 13
''''************* d-box2032
set rsmaquinas13=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 '"& lmachine13_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 '"& lmachine13_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine13_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine13_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine13_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine13_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine13_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 '"& lmachine13_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 '"& lmachine13_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 '"& lmachine13_cd &"' when a.proc_cd1 then '"& lmachine13_cd &"' when a.proc_cd2 then '"& lmachine13_cd &"' when a.proc_cd3 then '"& lmachine13_cd &"' end = '"& lmachine13_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
'''''''''''''''''''''''**************************************** MAQUINA 2
set rsmaquinas14=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 '"& lmachine14_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 '"& lmachine14_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine14_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine14_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine14_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine14_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine14_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 '"& lmachine14_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 '"& lmachine14_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 '"& lmachine14_cd &"' when a.proc_cd1 then '"& lmachine14_cd &"' when a.proc_cd2 then '"& lmachine14_cd &"' when a.proc_cd3 then '"& lmachine14_cd &"' end = '"& lmachine14_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
'''''''''''''''''''''''**************************************** MAQUINA 3
set rsmaquinas15=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 '"& lmachine15_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 '"& lmachine15_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine15_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine15_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine15_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine15_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine15_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 '"& lmachine15_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 '"& lmachine15_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 '"& lmachine15_cd &"' when a.proc_cd1 then '"& lmachine15_cd &"' when a.proc_cd2 then '"& lmachine15_cd &"' when a.proc_cd3 then '"& lmachine15_cd &"' end = '"& lmachine15_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
'''''''''''''''''''''''**************************************** MAQUINA 10
set rsmaquinas16=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 '"& lmachine16_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 '"& lmachine16_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine16_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine16_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine16_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine16_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine16_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 '"& lmachine16_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 '"& lmachine16_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 '"& lmachine16_cd &"' when a.proc_cd1 then '"& lmachine16_cd &"' when a.proc_cd2 then '"& lmachine16_cd &"' when a.proc_cd3 then '"& lmachine16_cd &"' end = '"& lmachine16_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
'''''''''''''''''''''''**************************************** MAQUINA 11
set rsmaquinas17=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 '"& lmachine17_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 '"& lmachine17_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine17_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine17_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine17_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine17_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine17_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 '"& lmachine17_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 '"& lmachine17_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 '"& lmachine17_cd &"' when a.proc_cd1 then '"& lmachine17_cd &"' when a.proc_cd2 then '"& lmachine17_cd &"' when a.proc_cd3 then '"& lmachine17_cd &"' end = '"& lmachine17_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
'''''''''''''''''''''''**************************************** MAQUINA 12
set rsmaquinas18=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 '"& lmachine18_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 '"& lmachine18_cd &"' when a.proc_cd1 then a.proc_cd1 else '' end proc_cd1, case '"& lmachine18_cd &"' when a.proc_cd1 then (a.ord_qty - isnull(a.proc_qty1, 0)) else 0 end proc_qty1, case '"& lmachine18_cd &"' when a.proc_cd2 then a.proc_cd2 else '' end proc_cd2, case '"& lmachine18_cd &"' when a.proc_cd2 then (a.ord_qty - isnull(a.proc_qty2, 0)) else 0 end proc_qty2, case '"& lmachine18_cd &"' when a.proc_cd3 then a.proc_cd3 else '' end proc_cd3, case '"& lmachine18_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 '"& lmachine18_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 '"& lmachine18_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 '"& lmachine18_cd &"' when a.proc_cd1 then '"& lmachine18_cd &"' when a.proc_cd2 then '"& lmachine18_cd &"' when a.proc_cd3 then '"& lmachine18_cd &"' end = '"& lmachine18_cd &"' and a.del_yn = '0' and xx.bal_qty > 0 order by isnull(a.nap_date, '00000000'),ord_no")
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
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
%>
<%= lmaq13 %>
<%= lmaq14%>
<%= lmaq15%>
<%= lmaq16%>
<%= lmaq17%>
<%= lmaq18%>
<%
lrenglon3=1
Do While lrenglon3<11 and lfin3<>1
%>
ORDER NO
<% if Not rsmaquinas13.EOF then %>
<%= rsmaquinas13("ord_no")%>
<%else%>
<%end if%>
<% if Not rsmaquinas14.EOF then %>
<%= rsmaquinas14("ord_no")%>
<%else%>
<%end if%>
<% if Not rsmaquinas15.EOF then %>
<%= rsmaquinas15("ord_no")%>
<%else%>
<%end if%>
<% if Not rsmaquinas16.EOF then %>
<%= rsmaquinas16("ord_no")%>
<%else%>
<%end if%>
<% if Not rsmaquinas17.EOF then %>
<%= rsmaquinas17("ord_no")%>
<%else%>
<%end if%>
<% if Not rsmaquinas18.EOF then %>
<%= rsmaquinas18("ord_no")%>
<%else%>
<%end if%>
CUSTOMER
<% if Not rsmaquinas13.EOF then %>
<%= rsmaquinas13("cust_nm")%>
<%else%>
<%end if%>
<% if Not rsmaquinas14.EOF then %>
<%= rsmaquinas14("cust_nm")%>
<%else%>
<%end if%>
<% if Not rsmaquinas15.EOF then %>
<%= rsmaquinas15("cust_nm")%>
<%else%>
<%end if%>
<% if Not rsmaquinas16.EOF then %>
<%= rsmaquinas16("cust_nm")%>
<%else%>
<%end if%>
<% if Not rsmaquinas17.EOF then %>
<%= rsmaquinas17("cust_nm")%>
<%else%>
<%end if%>
<% if Not rsmaquinas18.EOF then %>
<%= rsmaquinas18("cust_nm")%>
<%else%>
<%end if%>
ITEM
<% if Not rsmaquinas13.EOF then %>
<%= rsmaquinas13("good_nm")%>
<%else%>
<%end if%>
<% if Not rsmaquinas14.EOF then %>
<%= rsmaquinas14("good_nm")%>
<%else%>
<%end if%>
<% if Not rsmaquinas15.EOF then %>
<%= rsmaquinas15("good_nm")%>
<%else%>
<%end if%>
<% if Not rsmaquinas16.EOF then %>
<%= rsmaquinas16("good_nm")%>
<%else%>
<%end if%>
<% if Not rsmaquinas17.EOF then %>
<%= rsmaquinas17("good_nm")%>
<%else%>
<%end if%>
<% if Not rsmaquinas18.EOF then %>
<%= rsmaquinas18("good_nm")%>
<%else%>
<%end if%>
PLAN_QTY
<% if Not rsmaquinas13.EOF then %>
<%= rsmaquinas13("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas14.EOF then %>
<%= rsmaquinas14("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas15.EOF then %>
<%= rsmaquinas15("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas16.EOF then %>
<%= rsmaquinas16("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas17.EOF then %>
<%= rsmaquinas17("uwrk_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas18.EOF then %>
<%= rsmaquinas18("uwrk_qty")%>
<%else%>
<%end if%>
SHT Pending
<% if Not rsmaquinas13.EOF then %>
<%= rsmaquinas13("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas14.EOF then %>
<%= rsmaquinas14("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas15.EOF then %>
<%= rsmaquinas15("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas16.EOF then %>
<%= rsmaquinas16("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas17.EOF then %>
<%= rsmaquinas17("mwrk_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas18.EOF then %>
<%= rsmaquinas18("mwrk_qty")%>
<%else%>
<%end if%>
SHT Plan
<% if Not rsmaquinas13.EOF then %>
<%= rsmaquinas13("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas14.EOF then %>
<%= rsmaquinas14("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas15.EOF then %>
<%= rsmaquinas15("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas16.EOF then %>
<%= rsmaquinas16("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas17.EOF then %>
<%= rsmaquinas17("mi_plan_qty")%>
<%else%>
<%end if%>
<% if Not rsmaquinas18.EOF then %>
<%= rsmaquinas18("mi_plan_qty")%>
<%else%>
<%end if%>
SHT Ready
<% if Not rsmaquinas13.EOF then %>
<%= rsmaquinas13("mi_prod_qty")& " "%> <%=rsmaquinas13("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not rsmaquinas14.EOF then %>
<%= rsmaquinas14("mi_prod_qty")& " "%> <%=rsmaquinas14("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not rsmaquinas15.EOF then %>
<%= rsmaquinas15("mi_prod_qty")& " "%> <%=rsmaquinas15("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not rsmaquinas16.EOF then %>
<%= rsmaquinas16("mi_prod_qty")& " "%> <%=rsmaquinas16("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not rsmaquinas17.EOF then %>
<%= rsmaquinas17("mi_prod_qty")& " "%> <%=rsmaquinas17("sht_prod_time")%>
<%else%>
<%end if%>
<% if Not rsmaquinas18.EOF then %>
<%= rsmaquinas18("mi_prod_qty")& " "%> <%=rsmaquinas18("sht_prod_time")%>
<%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
lfin3=1
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
%>
<%
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''*****************FIN Page 2
%>