<%@ LANGUAGE = "VBScript" %> <% 'Session.Timeout = 120 busca=request.QueryString("busca") doc=request.QueryString("doc") origen=request.QueryString("origen") Date_ini=Request.Form("Date_ini") Date_end=Request.Form("Date_end") lvende=Request.Form("cvende") criterio22=Request.Form("criterio22") if criterio22="" then xcriterio22=" Todos " end if if Date_ini="" or Date_ini=null then 'Date_ini=date()-(day(date()))+1 Date_ini=date() Date_end=date()+4 end if '''''''''''''''''''''''''''''''''''''' Set rsvende = Server.CreateObject("ADODB.RecordSet") xtipo="VENDEDOR" 'rsvende.CursorType = adOpenDynamic set rsvende=dbsql.execute("SELECT major_cd, minor_cd, code_nm FROM sta010t WHERE (((major_cd)='9001')) ORDER BY minor_cd") %> Report PO-DO datepicker demo <% 'header %>

<% '''''''''''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_ini+1), 2) strmonth2 = Right("00" & Month(Date_ini+1), 2) stryear2 = Right("00" & Year(Date_ini+1), 4) strday3 = Right("00" & Day(Date_ini+2), 2) strmonth3 = Right("00" & Month(Date_ini+2), 2) stryear3 = Right("00" & Year(Date_ini+2), 4) strday4 = Right("00" & Day(Date_ini+3), 2) strmonth4 = Right("00" & Month(Date_ini+3), 2) stryear4 = Right("00" & Year(Date_ini+3), 4) strday5 = Right("00" & Day(Date_ini+4), 2) strmonth5 = Right("00" & Month(Date_ini+4), 2) stryear5 = Right("00" & Year(Date_ini+4), 4) fechainicial = (stryear & strmonth & strday) fechafinal = (stryear2 & strmonth2 & strday2) lfec1= (strmonth & strday & stryear) lfec5= (strmonth5 & strday5 & stryear5) lfec2= (strmonth2 & strday2 & stryear2) lfec3= (strmonth3 & strday3 & stryear3) lfec4= (strmonth4 & strday4 & stryear4) 'response.write(fechainicial)&" FI " 'response.write(fechafinal)&" Ff " '************** cortos Dim Rscortos, Rsinven2,rswip Dim Sqlinven1,sqlinven2,sqlwip set Rscortos=dbsql.execute("select (select cust_nm from stb010t(nolock) where cust_cd = a.cust_cd) cust_nm, b.good_nm, dbo.usf_size(b.box_size1, b.box_size2, b.box_size3, 'b') box_size, (select flute_nm from stb080t(nolock) where flute_cd = b.flute_cd) flute_nm, (select code_nm from sta010t(nolock) where major_cd = '9003' and minor_cd = b.good_type) good_type, isnull((select proc_nm from stb160t(nolock) where proc_cd = b.proc_cd1),'') proc_nm1, isnull((select proc_nm from stb160t(nolock) where proc_cd = b.proc_cd2),'') proc_nm2, isnull((select proc_nm from stb160t(nolock) where proc_cd = b.proc_cd3),'') proc_nm3, a.po_no, a.po_date, a.po_seq, a.cust_cd, a.good_cd, a.price, a.po_qty, case a.po_qty when 0 then 0 else isnull(a.sales_qty,0) end sales_qty, case a.po_qty when 0 then 0 else isnull(a.sales_qty,0) - a.po_qty end po_bal, case a.po_qty when 0 then 0 else isnull(a.inv_qty,0) end inv_qty, a.nap_date, a.qty, dbo.usf_no('B', '1', a.ord_date, a.ord_seq, 4, '-') ord_no, case when a.po_qty = 0 then 0 when a.po_qty - isnull(a.sales_qty,0) > 0 then (isnull(a.sales_qty,0) - a.po_qty ) + isnull(a.inv_qty,0) else (isnull(a.sales_qty,0) - a.po_qty) + isnull(a.inv_qty,0) end po_bal2, 0 po_inv, a.sht_prod from (select a.po_date, a.po_seq, a.po_no, a.cust_cd, a.good_cd, a.price, a.nap_date, a.po_qty - a.dust_qty po_qty, a.qty, a.ord_date, a.ord_seq, isnull(c.sales_qty,0) sales_qty, isnull(d.in_qty,0) - isnull(d.out_qty,0) inv_qty, isnull(e.bal_qty,0) bal_qty, case isnull(c1.sht_prod,0) when 0 then '' else '*' end sht_prod from saa080t a(nolock) left outer join ( select cust_cd, good_cd, po_no, sum(sales_qty) sales_qty from sal020t(nolock) where goods_class = '2' group by cust_cd, good_cd, po_no) c on a.cust_cd = c.cust_cd and a.good_cd = c.good_cd and a.po_no = c.po_no left outer join ( select ord_date, ord_seq, sum(prod_qty) sht_prod from shb020t where goods_class = '2' group by ord_date, ord_seq) c1 on a.ord_date = c1.ord_date and a.ord_seq = c1.ord_seq left outer join( select a.cust_cd, a.good_cd, sum(isnull(a.in_qty,0)) in_qty, sum(isnull(a.out_qty,0)) out_qty from ( select a.cust_cd, b.good_cd, sum(qty) in_qty , 0 out_qty from inout_table a, stb040t b(nolock) where a.class = '1' and a.crp_id = '10' and a.cust_cd = b.cust_cd and a.item = b.good_nm group by a.cust_cd, b.good_cd union select a.cust_cd, b.good_cd, 0, sum(qty) out_qty from inout_table a, stb040t b(nolock) where a.class = '2' and a.crp_id = '10' and a.cust_cd = b.cust_cd and a.item = b.good_nm group by a.cust_cd, b.good_cd) a group by a.cust_cd, a.good_cd ) d on a.cust_cd = d.cust_cd and a.good_cd = d.good_cd, (select po_no, cust_cd, good_cd, max(po_qty) bal_qty, sum(dust_qty) dust_qty from saa080t(nolock) group by po_no, cust_cd, good_cd) e where a.crp_id = '10' and a.cust_cd <> '20001' and a.po_no = e.po_no and a.cust_cd = e.cust_cd and a.good_cd = e.good_cd and isnull(e.bal_qty,0)- isnull(e.dust_qty,0) - isnull(c.sales_qty,0) > 0 and ((a.nap_date)='"&lfec1&"' or (a.nap_date)='"&lfec2&"' or (a.nap_date)='"&lfec3&"' or (a.nap_date)='"&lfec4&"' or (a.nap_date)='"&lfec5&"')) a, stb040t b(nolock) where a.cust_cd = b.cust_cd and a.good_cd = b.good_cd order by a.nap_date, a.po_date,a.po_no,a.cust_cd, b.good_nm") '((a.nap_date)='"&lfec1&"' or (a.nap_date)='"&lfec2&"' or (a.nap_date)='"&lfec3&"' or (a.nap_date)='"&lfec4&"' or (a.nap_date)='"&lfec5&"') 'right((a.nap_date),4)='"&stryear&"' and left((a.nap_date),2)='"&strmonth&"' and substring((a.nap_date),3,2)='"&strday&"' ' (((Right([nap_date],4) & Left([nap_date],2) & Mid([nap_date],3,2))>="20150916" And (Right([nap_date],4) & Left([nap_date],2) & Mid([nap_date],3,2))<="20150921")); 'right((a.nap_date),4)&left((a.nap_date),2)&substring((a.nap_date),3,2)) 'and (((Right([nap_date],4) & Left([nap_date],2) & substring([nap_date],3,2))>='"&fechainicial&"' And (Right([nap_date],4) & Left([nap_date],2) & substring([nap_date],3,2))<='"&fechafinal&"')) If Rscortos.EOF And Rscortos.BOF Then ExisteUsuario = 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 %>

SINIL INDUSTRY
CORTOS     Period: <%=Date_ini%> to <%=Date_ini+4%> <% 'Rsinven1.MoveFirst Do While Not Rscortos.EOF if Rscortos("po_bal2")<>"0" then colorf="#FFFFFF" if Rscortos("nap_date")=lfec1 then colorf="#FF0000" if isnull(Rscortos("po_bal2")) then colorf="#FFFFFF" end if end if if Rscortos("nap_date")=lfec2 then colorf="#FF8000" if isnull(Rscortos("po_bal2")) then colorf="#FFFFFF" end if end if %> <% if Rscortos("nap_date")=lfec1 then %> <% else %> <% end if %> <% if Rscortos("nap_date")=lfec2 then %> <% else %> <% end if %> <% if Rscortos("nap_date")=lfec3 then %> <% else %> <% end if %> <% if Rscortos("nap_date")=lfec4 then %> <% else %> <% end if %> <% if Rscortos("nap_date")=lfec5 then %> <% else %> <% end if %> <% end if Rscortos.MoveNext Loop %>
CUSTOMER PO NO. PO Date ITEM DO Date <%=Date_ini%> DO Date <%=Date_ini+1%> DO Date <%=Date_ini+2%> DO Date <%=Date_ini+3%> DO Date <%=Date_ini+4%>
<%= Rscortos("cust_nm")%> <%= Rscortos("po_no")%> <%= Rscortos("po_date")%> <%= Rscortos("good_nm")%> <%= Rscortos("po_bal2")%>  <%= Rscortos("po_bal2")%>  <%= Rscortos("po_bal2")%>  <%= Rscortos("po_bal2")%>  <%= Rscortos("po_bal2")%>  
<% End If Rscortos.Close Set Rscortos= Nothing '**************end inventory %>