<%@ 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 Inv 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 b.crp_id, b.cust_cd, (select cust_nm from stb010t(nolock) where cust_cd = b.cust_cd) customer, b.item, max(b.price) price, sum(a.in_qty1) - sum(a.out_qty1) inv_qty1, round(max(b.price) * (sum(a.in_qty1) - sum(a.out_qty1)),3) inv_amt1, sum(a.in_qty2) - sum(a.out_qty2) inv_qty2, round(max(b.price) * (sum(a.in_qty2) - sum(a.out_qty2)),3) inv_amt2, sum(a.in_qty3) - sum(a.out_qty3) inv_qty3, round(max(b.price) * (sum(a.in_qty3) - sum(a.out_qty3)),3) inv_amt3 " & _ "from (select a.cust_cd, a.item, sum(isnull(a.in_qty1,0)) in_qty1, sum(isnull(a.out_qty1,0)) out_qty1, sum(isnull(a.in_qty2,0)) in_qty2, sum(isnull(a.out_qty2,0)) out_qty2, sum(isnull(a.in_qty3,0)) in_qty3, sum(isnull(a.out_qty3,0)) out_qty3 " & _ "from ( select cust_cd, item, sum(qty) in_qty1 , 0 out_qty1, 0 in_qty2, 0 out_qty2, 0 in_qty3, 0 out_qty3 " & _ "from inout_table where class = '1' and crp_id ='10' and local_cd = '1' group by cust_cd, item " & _ "union select cust_cd, item, 0 in_qty1, sum(qty) out_qty1, 0 in_qty2 , 0 out_qty2, 0 in_qty3 , 0 out_qty3 " & _ "from inout_table where class = '2' and crp_id ='10' and local_cd = '1' group by cust_cd, item " & _ "union select cust_cd, item, 0 in_qty2 , 0 out_qty2, sum(qty) in_qty1 , 0 out_qty1, 0 in_qty3 , 0 out_qty3 " & _ "from inout_table where class = '1' and crp_id ='10' and local_cd = '2' group by cust_cd, item " & _ "union select cust_cd, item, 0 in_qty2 , 0 out_qty2, 0 in_qty1 , sum(qty) out_qty1, 0 in_qty3 , 0 out_qty3 " & _ "from inout_table where class = '2' and crp_id ='10' and local_cd = '2' group by cust_cd, item " & _ "union select cust_cd, item, 0 in_qty2 , 0 out_qty2, 0 in_qty3 , 0 out_qty3, sum(qty) in_qty1 , 0 out_qty1 " & _ "from inout_table where class = '1' and crp_id ='10' and local_cd = '3' group by cust_cd, item " & _ "union select cust_cd, item, 0 in_qty2 , 0 out_qty2, 0 in_qty3 , 0 out_qty3, 0 in_qty1 , sum(qty) out_qty3 " & _ "from inout_table where class = '2' and crp_id ='10' and local_cd = '3' group by cust_cd, item ) a group by a.cust_cd, a.item) a, (select crp_id, cust_cd, item, max(price) price from inout_table where class = '1' group by crp_id, cust_cd, item ) b " & _ "where a.cust_cd = b.cust_cd and a.item = b.item and b.crp_id ='10' and (a.in_qty1 - a.out_qty1 <> 0 or a.in_qty2 - a.out_qty2 <> 0 or a.in_qty3 - a.out_qty3 <> 0 ) group by b.crp_id, b.cust_cd, b.item order by b.crp_id, b.cust_cd, b.item") '((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&"' 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
Actual Inventory    Period: <%=Date_ini%> to <%=Date_ini+4%> <% 'Rsinven1.MoveFirst Do While Not Rscortos.EOF colorf="#FFFFFF" %> <% if isnull(Rscortos("inv_qty1")) then linv1=0 else linv1=Rscortos("inv_qty1") end if if isnull(Rscortos("inv_qty2")) then linv2=0 else linv2=Rscortos("inv_qty2") end if if isnull(Rscortos("inv_qty3")) then linv3=0 else linv3=Rscortos("inv_qty3") end if if isnull(Rscortos("inv_amt1")) then lamt1=0 else lamt1=Rscortos("inv_amt1") end if if isnull(Rscortos("inv_amt2")) then lamt2=0 else lamt2=Rscortos("inv_amt2") end if if isnull(Rscortos("inv_amt3")) then lamt3=0 else lamt3=Rscortos("inv_amt3") end if lTotInv=cdbl(linv1) + cdbl(linv2) + cdbl(linv3) lTotAmt=cdbl(lamt1) + cdbl(lamt2) + cdbl(lamt3) %> <% ltotqty1=ltotqty1+cdbl(Rscortos("inv_qty1")) ltotqty2=ltotqty2+cdbl(Rscortos("inv_qty2")) ltotqty3=ltotqty3+cdbl(Rscortos("inv_qty3")) ltotamt1=ltotamt1+cdbl(Rscortos("inv_amt1")) ltotamt2=ltotamt2+cdbl(Rscortos("inv_amt2")) ltotamt3=ltotamt3+cdbl(Rscortos("inv_amt3")) Rscortos.MoveNext Loop lsumqty=ltotqty1+ltotqty2+ltotqty3 lsumamt=ltotamt1+ltotamt2+ltotamt3 %>
CODE CUSTOMER ITEM PRICE QTY WH1 AMT WH1 QTY WH2 AMT WH2 QTY WH3 AMT WH3 QTY TOT AMT TOT
<%= Rscortos("cust_cd")%> <%= Rscortos("customer")%> <%= Rscortos("item")%> <%= Rscortos("price")%> <%= Rscortos("inv_qty1")%> <%= formatnumber(Rscortos("inv_amt1"),2)%> <%= Rscortos("inv_qty2")%> <%=formatnumber(Rscortos("inv_amt2"),2)%> <%= Rscortos("inv_qty3")%> <%=formatnumber(Rscortos("inv_amt3"),2)%> <%= lTotInv %> <%=formatnumber(lTotAmt,2)%>
<%= ltotqty1%> <%= formatnumber(ltotamt1,2)%> <%= ltotqty2%> <%=formatnumber(ltotamt2,2)%> <%= ltotqty3%> <%=formatnumber(ltotamt3,2)%> <%= lsumqty %> <%=formatnumber(lsumAmt,2)%>
<% End If Rscortos.Close Set Rscortos= Nothing '**************end inventory %>