<%@ LANGUAGE = "VBScript" %> <% 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_end=date() end if dia1=right("00"&day(Date_ini),2) mes1=right("00"&month(Date_ini),2) anno1=right("00"&year(Date_ini),4) 'Date_inii=cdate(dia1+"/"+mes1+"/"+anno1) cfechai=cdbl(anno1+mes1+dia1) dia2=right("00"&day(Date_end),2) mes2=right("00"&month(Date_end),2) anno2=right("00"&year(Date_end),4) 'cfechaf=cdate((dia2+"/"+mes2+"/"+anno2)) cfechaf=cdbl(anno2+mes2+dia2) '''''''''''''''''''''''''''''''''''''' strday = Right("00" & Day(Date_ini), 2) strmonth = Right("00" & Month(Date_ini), 2) stryear = Right("00" & Year(Date_ini), 4) strday2 = Right("00" & Day(Date_end), 2) strmonth2 = Right("00" & Month(Date_end), 2) stryear2 = Right("00" & Year(Date_end), 4) fechainicial = CDbl(stryear + strmonth + strday) fechafinal = CDbl(stryear2 + strmonth2 + strday2) '''''''''''''''''''''''''''''''''''''' %> Report Inventory Summary datepicker demo <% header if busca="" or busca=null then origen=doc end if %>
Report Summary List
<% d="/" ctipomov1="FACTURA" ctipomov2="REMISION" sla="/" cero1="00" cero2="0000" '''''''''''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(fechainicial)&" FI " ' response.write(fechafinal)&" Ff " layer=weekday(date()-1) If layer = 1 Then lfecinicial=date()-3 lfecfinal=date()-3 else if layer=7 then lfecinicial=date()-2 lfecfinal=date()-2 else lfecinicial=date()-1 lfecfinal=date()-1 end if end if strdaybook = Right("00" & Day(lfecinicial), 2) strmonthbook = Right("00" & Month(lfecinicial), 2) stryearbook = Right("00" & Year(lfecinicial), 4) lfechabook1 = CStr(stryearbook + strmonthbook + strdaybook) lfechabook2 = CStr(stryearbook + strmonthbook + strdaybook) If lvende = "" Then vendedor_i = "00000" vendedor_f = "99999" Else if cdbl(lvende)=0 then vendedor_i = "00000" vendedor_f = "99999" else vendedor_i = lvende vendedor_f = lvende end if End If 'response.write (fechainicial&"FI ") 'response.write (fechafinal&"Ff ") 'response.write (vendedor_I&"Vi ") 'response.write (vendedor_f&"VF ") 'response.write (cvende&"VS ") '************** Inventory Dim Rsinven1, Rsinven2,rswip Dim Sqlinven1,sqlinven2,sqlwip set Rsinven1=dbsql.execute("select b.crp_id,b.cust_cd,(select cust_nm from stb010t(nolock) where cust_cd = b.cust_cd) as customer,b.item, max(b.price) as price,sum(a.in_qty1) - sum(a.out_qty1) as inv_qty1,round(max(b.price) * (sum(a.in_qty1) - sum(a.out_qty1)),3) as inv_amt1, sum(a.in_qty2) - sum(a.out_qty2) as inv_qty2,round(max(b.price) * (sum(a.in_qty2) - sum(a.out_qty2)),3) as inv_amt2, sum(a.in_qty3) - sum(a.out_qty3) as inv_qty3,round(max(b.price) * (sum(a.in_qty3) - sum(a.out_qty3)),3) as 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_qty1 , 0 out_qty1,0 in_qty2, 0 out_qty2, sum(qty) in_qty3,0 out_qty3 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_qty1 ,0 out_qty1, 0 in_qty2 , 0 out_qty2, 0 in_qty3 , 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") If Rsinven1.EOF And Rsinven1.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) Else lOBSamsung = 0 lOTSamsung = 0 lOBSamsung2 = 0 lOTSamsung2 = 0 lOBSamsung2WH3 = 0 lOTSamsungWH3 = 0 lOBSamsung3 = 0 lOTSamsung3 = 0 lSamsungObsOB1 = 0 lSamsungObsOT1 = 0 lSamsungObsOB1WH3 = 0 lSamsungObsOT1WH3 = 0 lOthers1 = 0 lOthers2 = 0 lTotalQtyInv1 = 0 lTotalQtyInv2 = 0 lTotalM2Inv1 = 0 lTotalM2Inv2 = 0 lTotalDllInv1 = 0 lTotalDllInv2 = 0 lTotalQtyInvD = 0 lTotalM2InvD = 0 lTotalDllInvD = 0 lqtyinven = 0 lqtyinven2 = 0 lamtinven = 0 lm2inven = 0 Rsinven1.MoveFirst Do While Not Rsinven1.EOF 'response.write (lqtybook&",") 'response.write (Rsinven1("po_qty")&",") lqtyinven = lqtyinven + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lamtinven = lamtinven + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3")) lSubqty = cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lSubAmt = cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3")) set Rsinven3=dbsql.execute("select * from stb040t where cust_cd='" & Rsinven1("cust_cd") & "' and good_nm='" & Rsinven1("item") & "'") if not rsinven3.eof then localm2=((cdbl(Rsinven3("sht_size1")) * cdbl(Rsinven3("sht_size2")) / 1000000) / cdbl(Rsinven3("poksu")) / cdbl(Rsinven3("julsu")) * cdbl(Rsinven3("hapsu")) * lSubqty) end if lm2inven = lm2inven + cdbl(localm2) 'localm2=((cdbl(Rsinven1("sht_size1")) * cdbl(Rsinven1("sht_size2")) / 1000000) / cdbl(Rsinven1("poksu")) / cdbl(Rsinven1("julsu")) * cdbl(Rsinven1("hapsu")) * cdbl(Rsinven1("po_qty"))) 'lm2inven = lm2inven + localm2 if Rsinven1("cust_cd")="20001" then 'CTE ltypeBox="x" ltypeBox2="x" set Rsinven2=cnn.execute("select * from SamsungItems where good_nm='" & Rsinven1("item") & "'") if not Rsinven2.eof then 'RS ltypeBox=rsinven2("Note_4") ltypeBox2=rsinven2("Note_5") if rsinven2("Note_5")= "INBOX / PAD" then 'PAD lOTSamsung2 = lOTSamsung2 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lTotalQtyInvD = lTotalQtyInvD + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lOTSamsungWH3 = lOTSamsungWH3 + cdbl(Rsinven1("inv_qty3")) lTotalM2InvD = lTotalM2InvD + localm2 lTotalDllInvD =lTotalDllInvD + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3")) else if rsinven2("Note_5")= "NA" then 'NA if rsinven2("Note_4")= "Full Litho" or rsinven2("Note_4")= "Spot Label" or rsinven2("Note_4")= "No Label" then 'lOBSamsung = lOBSamsung + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lSamsungObsOB1 = lSamsungObsOB1 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lSamsungObsOB1WH3 = lSamsungObsOB1WH3 + cdbl(Rsinven1("inv_qty3")) 'lTotalM2Inv1 = lTotalM2Inv1 + localm2 'lTotalDllInv1 =lTotalDllInv1 + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3")) else 'lOTSamsung = lOTSamsung + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lSamsungObsOT1 = lSamsungObsOT1 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lSamsungObsOT1WH3 = lSamsungObsOT1WH3 + cdbl(Rsinven1("inv_qty3")) 'lTotalM2Inv1 = lTotalM2Inv1 + localm2 'lTotalDllInv1 =lTotalDllInv1 + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3")) end if else lOBSamsung2 = lOBSamsung2 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lOBSamsung2WH3 = lOBSamsung2WH3 + cdbl(Rsinven1("inv_qty3")) lTotalQtyInvD = lTotalQtyInvD + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lTotalM2InvD = lTotalM2InvD + localm2 lTotalDllInvD =lTotalDllInvD + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3")) end if 'NA end if 'PAD else lOTSamsung = lOTSamsung + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lOTSamsungWH3 = lOTSamsungWH3 + cdbl(Rsinven1("inv_qty3")) end if 'RS lTotalQtyInv1 = lTotalQtyInv1 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lTotalM2Inv1 = lTotalM2Inv1 + localm2 lTotalDllInv1 =lTotalDllInv1 + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3")) Rsinven2.Close Set Rsinven2 = Nothing else set Rsother=cnn.execute("select * from Items where good_nm='" & Rsinven1("item") & "'") if not Rsother.eof then 'RS ltypeBox=rsother("Note_4") ltypeBox2=rsother("Note_5") if rsother("Note_5")= "NA" then 'NA lOtherObs1 = lOtherObs1 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lOtherObsM2 = lOtherObsM2 + localm2 lOtherObsDll =lOtherObsDll + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3")) end if ELSE end if lOthers1 = lOthers1 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lOthers2 = 0 lTotalQtyInv2 = lTotalQtyInv2 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) lTotalM2Inv2 = lTotalM2Inv2 + localm2 lTotalDllInv2 =lTotalDllInv2 + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3")) end if Rsinven1.MoveNext Loop End If Rsinven1.Close Set Rsinven1 = Nothing '**************end inventory set Rswip=cnn.execute("select * from wip") lsheetwip=rswip("SHEETWIP") lboxwip=rswip("boxwip") lboxrwr=rswip("boxrwr") %>
ACTUAL INVENTORY
    OB WH3 Nordika
OB Total
Others WH3 Nordika
Others Total
TOTAL
Qty
M2
Dlls
Samsung
Obsolete
<%=(lSamsungObsOB1WH3)%>
<%=(lSamsungObsOB1)%>
<%=(lSamsungObsOT1WH3)%>
<%=(lSamsungObsOT1)%>
<%=formatnumber(lSamsungObsOB1+lSamsungObsOT1,0)%>
<%=formatnumber(lTotalM2Inv1-lTotalM2InvD,0)%>
$<%=formatnumber(lTotalDllInv1-lTotalDllInvD)%>
 
Actual
<%=lOBSamsung2WH3%>
<%=lOBSamsung2%>
<%=lOTSamsungWH3%>
<%=lOTSamsung2+lOTSamsung%>
<%=formatnumber(lTotalQtyInvD+lOTSamsung,0)%>
<%=formatnumber(lTotalM2InvD,0)%>
$<%=formatnumber(lTotalDllInvD)%>
  Total Samsung  
<%=(lSamsungObsOB1+lOBSamsung2)%>
 
<%=(lSamsungObsOT1+lOTSamsung2+lOTSamsung)%>
<%=formatnumber(lTotalQtyInv1,0)%>
<%=formatnumber(lTotalM2Inv1,0)%>
$<%=formatnumber(lTotalDllInv1)%>
Others
Obsolete
 
0
 
<%=(lOtherObs1)%>
<%=(lOtherObs1)%>
<%=formatnumber(lOtherObsM2,0)%>
$<%=formatnumber(lOtherObsDll)%>
 
Actual
 
0
 
<%=(lOthers1-lOtherObs1)%>
<%=formatnumber(lTotalQtyInv2-lOtherObs1,0)%>
<%=formatnumber(lTotalM2Inv2-lOtherObsM2,0)%>
$<%=formatnumber(lTotalDllInv2-lOtherObsDll)%>
 
Total Others
 
0
 
<%=lOthers1%>
<%=formatnumber(lTotalQtyInv2,0)%>
<%=formatnumber(lTotalM2Inv2,0)%>
$<%=formatnumber(lTotalDllInv2)%>
Total    
<%=(lSamsungObsOB1+lOBSamsung2)%>
 
<%=(lOthers1+lSamsungObsOT1+lOTSamsung2+lOTSamsung)%>
<%=formatnumber(lTotalQtyInv1+lTotalQtyInv2,0)%>
<%=formatnumber(lTotalM2Inv1+lTotalM2Inv2,0)%>
$<%=formatnumber(lTotalDllInv1+lTotalDllInv2)%>

 

W I P <% if lsheetwip=0 then%> <%else%> <%end if%> <% if lboxwip=0 then%> <%else%> <%end if%>
 
TOTAL
Qty
Dlls
SHEET
No Data
<%=formatnumber(lsheetwip,0)%>
 
BOX
No Data
<%=formatnumber(lboxwip,0)%>
 
 
<%=formatnumber((lsheetwip+lboxwip),0)%>
 

 

R W R <% if lboxrwr=0 then%> <%else%> <%end if%>
 
TOTAL
Qty
 
BOX
No Data
<%=formatnumber(lboxrwr,0)%>
 
 
0