<%@ LANGUAGE = "VBScript" %> <% Session.Timeout = 120 Server.ScriptTimeout = 5000 busca=request.QueryString("busca") doc=request.QueryString("doc") origen=request.QueryString("origen") Date_ini=Request.Form("Date_ini") Date_end=Request.Form("Date_end") lvende=Request.Form("cvende") criterio22=Request.Form("criterio22") if criterio22="" then xcriterio22=" Todos " end if if Date_ini="" or Date_ini=null then if day(date())>1 then Date_ini=date()-(day(date()))+1 else Date_ini=date()-(day(date()-1)) end if Date_end=date()-1 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) '''''''''''''''''''''''''''''''''''''' renglon 824 y renglon 2188 daysoff=0 samsungdays=21-daysoff notsamdays=22-daysoff xdaytr1=0 xdaytr2=0 xrestandias=0 'no samsung xrestandias2=0 'samsung dfestivo1=0 ' restar de los dias transcurridos 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) '''''''''''''''''''''''' bpjan=4754000 bpfeb=3956000 bpmar=4382000 bpapr=5555000 bpmay=5344000 bpjun=5685000 bpjul=5442000 bpaug=7398000 bpsep=7924000 bpoct=8749000 bpnov=6086000 bpdec=4871000 bptot=(bpjan+bpfeb+bpmar+bpapr+bpmay+bpjun+bpjul+bpaug+bpsep+bpoct+bpnov+bpdec) '''''''''''''''''''''''''''''''''''''' Dim Rsfore0 Dim Sqlfore0 set Rsfore0=dbsql3.execute("SELECT * FROM forecast WHERE id=49") 'Set Rsfore = CurrentDb.OpenRecordset(Sqlfore) xday = Right("00" & Day(Date), 2) xmonth = Right("00" & Month(Date), 2) xyear = Right("00" & Year(Date), 4) xdate=xyear&xmonth&xday Dim Rsfore Dim Sqlfore xday2 = Right("00" & Rsfore0("month"), 2) xmonth2 = Right("00" & Rsfore0("forecast"), 2) xyear2 = Right("00" & Rsfore0("year"), 4) xdate2=xyear2&xmonth2&xday2 set Rsfore=dbsql3.execute("SELECT * FROM forecast WHERE month=" & Month(Date_end) & " and year=" & Year(Date_end)) 'Set Rsfore = CurrentDb.OpenRecordset(Sqlfore) If Rsfore.EOF And Rsfore.BOF Then forecast = 0 bussines = 0 Else forecast = Rsfore("forecast") bussines = Rsfore("bussines") End If Rsfore.Close Set Rsfore = Nothing '''' If xdate>xdate2 Then response.write (ErrorNo1) else 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 Sales Summary <% header if busca="" or busca=null then origen=doc end if %>
Report Summary List
Sales Rep:      
Period:  
         
<% 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 Dim Rsmir1, Rsmir2,RsInvoice,RsInvoice2 Dim Sqlmir1, sqlmir2, sqlInvoice, sqlInvoice2 'set Rsmir1=dbsql.execute("SELECT sal020t.good_date, sal020t.sales_class, sta010t.code_nm, sal020t.cust_cd, stb010t.cust_nm, sal020t.local_cd, sal020t.sales_qty, sal020t.sales_amt, sal020t.sales_m2, sal020t.chk_tit,sal020t.pack_no FROM (sal020t LEFT JOIN stb010t ON sal020t.cust_cd = stb010t.cust_cd) LEFT JOIN sta010t ON stb010t.sale_cd = sta010t.minor_cd " & _ '" WHERE ((((sal020t.good_date) = '" & fechainicial & "' Or (sal020t.good_date) > '" & fechainicial & "') And ((sal020t.good_date) = '" & fechafinal & "' Or (sal020t.good_date) < '" & fechafinal & "')) And (((sta010t.minor_cd) = '" & vendedor_i & "' Or (sta010t.minor_cd) > '" & vendedor_i & "') And ((sta010t.minor_cd) = '" & vendedor_f & "' Or (sta010t.minor_cd) < '" & vendedor_f & "')) AND ((sta010t.major_cd)='9001'))") lbl_lastyear = Year(Date_ini) - 1 lbl_actualyear = Year(Date_end) lventas=0 if lventas=1 then set Rsmir1=dbsql.execute("select a.cust_cd, max(b.cust_nm) cust_nm, max(a.pack_no) pack_no, sum(case a.local_cd when '1' then a.sales_qty else 0 end ) qty1, sum(case a.local_cd when '1' then a.sales_amt else 0 end ) amt1, sum(case a.local_cd when '2' then a.sales_qty else 0 end ) qty2, sum(case a.local_cd when '2' then a.sales_amt else 0 end ) amt2, sum(case a.local_cd when '3' then a.sales_qty else 0 end ) qty3, sum(case a.local_cd when '3' then a.sales_amt else 0 end ) amt3, sum(case a.local_cd when '4' then a.sales_qty else 0 end ) qty4, sum(case a.local_cd when '4' then a.sales_qty else 0 end ) qty4, sum(case a.local_cd when '4' then a.sales_amt else 0 end ) amt4, sum(a.sales_qty) sales_qty, sum(a.sales_amt) sales_amt, sum(a.sales_m2) sales_m2 from sal020t a(nolock), stb010t b(nolock), stb040t c(nolock) where a.cust_cd = b.cust_cd and a.cust_cd = c.cust_cd and a.good_cd = c.good_cd and a.crp_id = '10' and a.good_date between '" & fechainicial & "' and '" & fechafinal & "' and a.cust_cd like '%' and b.sale_cd like '%' and a.local_cd like '%' and a.sales_class like '1' and a.po_no like '%' and a.pack_no like '%' and a.good_nm like '%' and a.chk_tit like '%' and c.item_class like '%' group by a.cust_cd,a.pack_no order by a.cust_cd, a.pack_no") 'Set Rsmir1 = CurrentDb.OpenRecordset(Sqlmir1) If Rsmir1.EOF And Rsmir1.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 1." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) response.write ("Sin registros") Else lqtysamsung = 0 lqtyplant1=0 lamtplant1=0 lamtplant1_Inv=0 lm2plant1=0 lscrapqty1 = 0 lscrapamt1 = 0 lscrapmt21 = 0 lamtsamsung=0 Rsmir1.MoveFirst Do While Not Rsmir1.EOF '''''''''''''''''''******************************************* Quitar los Packing de partes obsoletas If left(Rsmir1("pack_no"),5) = "SCRAP" Then lscrapqty1 = lscrapqty1 + cdbl(Rsmir1("sales_qty")) lscrapamt1 = lscrapamt1 + cdbl(Rsmir1("sales_amt")) lscrapmt21 = lscrapmt21 + cdbl(Rsmir1("sales_m2")) Else 'If Rsmir1("cust_cd") = "20001" and Rsmir1("sales_class")="1" Then If Rsmir1("cust_cd") = "20001" Then lqtysamsung = lqtysamsung + cdbl(Rsmir1("sales_qty")) lamtsamsung = lamtsamsung + cdbl(Rsmir1("sales_amt")) lm2samsung = lm2samsung + cdbl(Rsmir1("sales_m2")) Else 'if Rsmir1("sales_class")="1" then lqtyplant1 = lqtyplant1 + cdbl(Rsmir1("sales_qty")) lamtplant1 = lamtplant1 + cdbl(Rsmir1("sales_amt")) lamtplant1_Inv = lamtplant1_Inv + cdbl(Rsmir1("sales_amt")) lm2plant1 = lm2plant1 + cdbl(Rsmir1("sales_m2")) 'end if End If End if Rsmir1.MoveNext Loop End If Rsmir1.Close Set Rsmir1 = Nothing 'usuario = Forms![Ingreso]!TxtLogin.Column(1) set Rsmir2=dbsql2.execute("SELECT sal020t.good_date, sta010t.code_nm, sal020t.cust_cd, stb010t.cust_nm, sal020t.local_cd, sal020t.sales_qty, sal020t.sales_amt, sal020t.sales_m2, sal020t.chk_tit FROM (sal020t LEFT JOIN stb010t ON sal020t.cust_cd = stb010t.cust_cd) LEFT JOIN sta010t ON stb010t.sale_cd = sta010t.minor_cd " & _ " WHERE (((((sal020t.good_date) = '" & fechainicial & "' Or (sal020t.good_date) > '" & fechainicial & "') And ((sal020t.good_date) = '" & fechafinal & "' Or (sal020t.good_date) < '" & fechafinal & "'))) And (((sta010t.minor_cd) = '" & vendedor_i & "' Or (sta010t.minor_cd) > '" & vendedor_i & "') And ((sta010t.minor_cd) = '" & vendedor_f & "' Or (sta010t.minor_cd) < '" & vendedor_f & "')) AND ((sta010t.major_cd)='9001'))") 'Set Rsmir2 = CurrentDb.OpenRecordset(sqlmir2) If Rsmir2.EOF And Rsmir2.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 2." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else lqtysamsung2 = 0 lqtyplant2=0 lamtplant2=0 lm2plant2=0 lqtyplant2sin=0 lamtplant2sin=0 lm2plant2sin=0 Rsmir2.MoveFirst Do While Not Rsmir2.EOF If Rsmir2("cust_cd") = "20001" Then lqtysamsung2 = lqtysamsung2 + cdbl(Rsmir2("sales_qty")) lamtsamsung2 = lamtsamsung2 + cdbl(Rsmir2("sales_amt")) lm2samsung2 = lm2samsung2 + cdbl(Rsmir2("sales_m2")) End If lqtyplant2 = lqtyplant2 + cdbl(Rsmir2("sales_qty")) lamtplant2 = lamtplant2 + cdbl(Rsmir2("sales_amt")) lm2plant2 = lm2plant2 + cdbl(Rsmir2("sales_m2")) If Rsmir2("cust_cd") = "99999" Then lqtyplant2sin = lqtyplant2sin + cdbl(Rsmir2("sales_qty")) lamtplant2sin = lamtplant2sin + cdbl(Rsmir2("sales_amt")) lm2plant2sin = lm2plant2sin + cdbl(Rsmir2("sales_m2")) end if Rsmir2.MoveNext Loop End If Rsmir2.Close Set Rsmir2 = Nothing '******************************************* INVOICE set RsInvoice=dbsql.execute("SELECT sal030t.crp_id, sal030t.sales_class, sal030t.goods_class, sal030t.good_date, sal030t.good_seq, sal030t.sales_chk, sal030t.pack_no, sal030t.cust_cd, sal030t.oncar_qty, sal030t.oncar_amt FROM sal030t WHERE (((sal030t.good_date)='" & fechainicial & "' Or (sal030t.good_date)>'" & fechainicial & "') And ((sal030t.good_date)='" & fechafinal & "' Or (sal030t.good_date)<'" & fechafinal & "')) AND ((sal030t.sales_chk)='1')") If RsInvoice.EOF And RsInvoice.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 hay datos Inv1") Else lqtysamsungInv = 0 lqtyplantinv=0 lamtplantInv=0 lm2plantInv=0 RsInvoice.MoveFirst Do While Not RsInvoice.EOF If left(RsInvoice("pack_no"),5) = "SCRAP" Then 'lscrapqty1 = lscrapqty1 + cdbl(Rsmir1("sales_qty")) 'lscrapamt1 = lscrapamt1 + cdbl(Rsmir1("sales_amt")) 'lscrapmt21 = lscrapmt21 + cdbl(Rsmir1("sales_m2")) Else If RsInvoice("cust_cd") = "20001" and RsInvoice("sales_class")="1" Then lqtysamsungInv = lqtysamsungInv + cdbl(RsInvoice("oncar_qty")) lamtsamsungInv = lamtsamsungInv + cdbl(RsInvoice("oncar_amt")) 'lm2samsungInv = lm2samsungInv + cdbl(RsInvoice("sales_m2")) else if RsInvoice("sales_class")="1" then lqtyplantInv = lqtyplantInv + cdbl(RsInvoice("oncar_qty")) lamtplantInv = lamtplantInv + cdbl(RsInvoice("oncar_amt")) end if End If End if RsInvoice.MoveNext Loop End If RsInvoice.Close Set RsInvoice = Nothing '''''''''''''''''''''''' set RsInvoice2=dbsql2.execute("SELECT sal030t.crp_id, sal030t.goods_class, sal030t.good_date, sal030t.good_seq, sal030t.sales_chk, sal030t.pack_no, sal030t.cust_cd, sal030t.oncar_qty, sal030t.oncar_amt FROM sal030t WHERE (((sal030t.good_date)='" & fechainicial & "' Or (sal030t.good_date)>'" & fechainicial & "') And ((sal030t.good_date)='" & fechafinal & "' Or (sal030t.good_date)<'" & fechafinal & "')) AND ((sal030t.sales_chk)='1')") If RsInvoice2.EOF And RsInvoice2.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 hay datos Inv2") Else lqtysamsungInv = 0 lqtyplantinv2=0 lamtplantInv2=0 lm2plantInv=0 RsInvoice2.MoveFirst Do While Not RsInvoice2.EOF If RsInvoice2("cust_cd") = "20240" Then lqtysamsungInv2 = lqtysamsungInv2 + cdbl(RsInvoice2("oncar_qty")) lamtsamsungInv2 = lamtsamsungInv2+ cdbl(RsInvoice2("oncar_amt")) 'lm2samsungInv = lm2samsungInv + cdbl(RsInvoice("sales_m2")) End If lqtyplantInv2 = lqtyplantInv2 + cdbl(RsInvoice2("oncar_qty")) lamtplantInv2 = lamtplantInv2 + cdbl(RsInvoice2("oncar_amt")) RsInvoice2.MoveNext Loop End If RsInvoice2.Close Set RsInvoice2 = Nothing '******************************************** END INVOICE '**************booking Dim Rsbook Dim Sqlbook set Rsbook=dbsql.execute("SELECT saa080t.po_date, saa080t.po_no, saa080t.po_seq, stb010t.cust_nm, stb040t.good_nm, saa080t.po_qty, saa080t.qty, saa080t.pending_qty, saa080t.price, saa080t.amt,stb040t.sht_size1, stb040t.sht_size2, stb040t.poksu, stb040t.julsu,stb040t.hapsu " & _ " FROM (saa080t INNER JOIN stb010t ON saa080t.cust_cd = stb010t.cust_cd) INNER JOIN stb040t ON (saa080t.good_cd = stb040t.good_cd) AND (saa080t.cust_cd = stb040t.cust_cd) " & _ " WHERE ((((saa080t.po_date)='" & lfechabook1 & "' Or (saa080t.po_date)>'" & lfechabook1 & "') And ((saa080t.po_date)='" & lfechabook2 & "' Or (saa080t.po_date)<'" & lfechabook2 & "')))") 'Set Rsbook = CurrentDb.OpenRecordset(Sqlbook) If Rsbook.EOF And Rsbook.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 2." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else lqtysamsung2 = 0 lqtybook = 0 lqtybook2 = 0 lamtbook = 0 lm2book = 0 Rsbook.MoveFirst Do While Not Rsbook.EOF 'response.write (lqtybook&",") 'response.write (rsbook("po_qty")&",") lqtybook = lqtybook + cdbl(Rsbook("po_qty")) lamtbook = lamtbook + cdbl(Rsbook("amt")) lm2book = lm2book + ((cdbl(Rsbook("sht_size1")) * cdbl(Rsbook("sht_size2")) / 1000000) / cdbl(Rsbook("poksu")) / cdbl(Rsbook("julsu")) * cdbl(Rsbook("hapsu")) * cdbl(Rsbook("po_qty"))) Rsbook.MoveNext Loop End If Rsbook.Close Set Rsbook = Nothing '**************end booking '*************** Inter company Dim Rsinterc Dim Sqlinterc set Rsinterc=dbsql.execute("SELECT mtd011t.bal_date, mtd011t.po_no, mtd011t.bal_seq, stb010t.cust_nm, mtd011t.bal_sub, mtd011t.bal_qty, mtd011t.nap_date, mtd011t.bal_amt, stb010t.cust_cd, mtd010t.jaje_nm" & _ " FROM (mtd011t INNER JOIN stb010t ON mtd011t.cust_cd = stb010t.cust_cd) INNER JOIN mtd010t ON (mtd011t.jaje_seq = mtd010t.jaje_seq) AND (mtd011t.crp_id = mtd010t.crp_id) " & _ " WHERE ((((mtd011t.bal_date) = '" & fechainicial & "' Or (mtd011t.bal_date) > '" & fechainicial & "') And ((mtd011t.bal_date) = '" & fechafinal & "' Or (mtd011t.bal_date) <'" & fechafinal & "')) And ((stb010t.cust_cd) = '60452')) " & _ " ORDER BY mtd011t.bal_date, mtd011t.bal_seq, mtd011t.bal_sub") 'Set Rsinterc = CurrentDb.OpenRecordset(Sqlinterc) If Rsinterc.EOF And Rsinterc.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 1." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else Dim lqtyinterc, lamtinterc, lm2interc Rsinterc.MoveFirst Do While Not Rsinterc.EOF lqtyinterc = lqtyinterc + cdbl(Rsinterc("bal_qty")) lamtinterc = lamtinterc + cdbl(Rsinterc("bal_amt")) 'lm2interc = lm2interc + rsinterc("sales_m2") Rsinterc.MoveNext Loop End If Rsinterc.Close Set Rsinterc = Nothing '*************** End Inter company 'Refresh qtybook = lqtybook amtbook = lamtbook m2book = lm2book Tot_sales_qty_sam = lqtysamsung Tot_sales_amt_sam = lamtsamsung Tot_sales_m2_sam = lm2samsung Tot_sales_qty = lqtyplant1 Tot_sales_amt = lamtplant1 Tot_sales_m2 = lm2plant1 Tot_sales_qty2 = lqtyplant2-lqtyplant2sin Tot_sales_amt2 = lamtplant2-lamtplant2sin Tot_sales_m2_2 = lm2plant2-lm2plant2sin qtyinterc = lqtyinterc amtinterc = lamtinterc m2interc = lm2interc '************* last year *************************************************************** xxx = 1 If xxx = 1 Then strday = Right("00" & Day(Date_ini), 2) strmonth = Right("00" & Month(Date_ini), 2) stryear = Right("00" & (Year(Date_ini) - 1), 4) strday2 = Right("00" & Day(Date_end), 2) strmonth2 = Right("00" & Month(Date_end), 2) stryear2 = Right("00" & (Year(Date_end) - 1), 4) fechainicial2 = Cstr(stryear + strmonth + strday) fechafinal2 = Cstr(stryear2 + strmonth2 + strday2) lperiod1 = stryear & "-" & strmonth & "-" & strday lperiod2 = stryear2 & "-" & strmonth2 & "-" & strday2 period1 = lperiod1 period2 = lperiod2 xperiodi = stryear & strmonth & strday xperiodf = stryear2 & strmonth2 & strday2 Dim rslast1, Rslast2 Dim Sqllast1, sqllast2 set Rslast1=dbsql.execute("SELECT sal020t.good_date, sal020t.sales_class, sta010t.code_nm, sal020t.cust_cd, stb010t.cust_nm, sal020t.local_cd, sal020t.sales_qty, sal020t.sales_amt, sal020t.sales_m2, sal020t.chk_tit,sal020t.pack_no FROM (sal020t LEFT JOIN stb010t ON sal020t.cust_cd = stb010t.cust_cd) LEFT JOIN sta010t ON stb010t.sale_cd = sta010t.minor_cd " & _ " WHERE ((((sal020t.good_date) = '" & fechainicial2 & "' Or (sal020t.good_date) > '" & fechainicial2 & "') And ((sal020t.good_date) = '" & fechafinal2 & "' Or (sal020t.good_date) < '" & fechafinal2 & "')) And (((sta010t.minor_cd) = '" & vendedor_i & "' Or (sta010t.minor_cd) > '" & vendedor_i & "') And ((sta010t.minor_cd) = '" & vendedor_f & "' Or (sta010t.minor_cd) < '" & vendedor_f & "')) AND ((sta010t.major_cd)='9001')) ORDER BY sta010t.code_nm, sal020t.cust_cd") 'Set rslast1 = CurrentDb.OpenRecordset(Sqllast1) If rslast1.EOF And rslast1.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 1." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else lqtysamsung3 = 0 Dim lqtyplant11, lamtplant11, lm2plant11 rslast1.MoveFirst Do While Not rslast1.EOF If left(Rslast1("pack_no"),5) = "SCRAP" Then 'lscrapqty1 = lscrapqty1 + cdbl(Rsmir1("sales_qty")) 'lscrapamt1 = lscrapamt1 + cdbl(Rsmir1("sales_amt")) 'lscrapmt21 = lscrapmt21 + cdbl(Rsmir1("sales_m2")) Else If rslast1("cust_cd") = "20001" and rslast1("sales_class")="1" Then lqtysamsung3 = lqtysamsung3 + cdbl(rslast1("sales_qty")) lamtsamsung3 = lamtsamsung3 + cdbl(rslast1("sales_amt")) lm2samsung3 = lm2samsung3 + cdbl(rslast1("sales_m2")) Else if rslast1("sales_class")="1" then lqtyplant11 = lqtyplant11 + cdbl(rslast1("sales_qty")) lamtplant11 = lamtplant11 + cdbl(rslast1("sales_amt")) lm2plant11 = lm2plant11 + cdbl(rslast1("sales_m2")) end if End If End if rslast1.MoveNext Loop End If rslast1.Close Set rslast1 = Nothing set Rslast2=dbsql2.execute("SELECT sal020t.good_date, sta010t.code_nm, sal020t.cust_cd, stb010t.cust_nm, sal020t.local_cd, sal020t.sales_qty, sal020t.sales_amt, sal020t.sales_m2, sal020t.chk_tit,sal020t.pack_no FROM (sal020t LEFT JOIN stb010t ON sal020t.cust_cd = stb010t.cust_cd) LEFT JOIN sta010t ON stb010t.sale_cd = sta010t.minor_cd " & _ " WHERE ((((sal020t.good_date) = '" & fechainicial2 & "' Or (sal020t.good_date) > '" & fechainicial2 & "') And ((sal020t.good_date) = '" & fechafinal2 & "' Or (sal020t.good_date) < '" & fechafinal2 & "')) And (((sta010t.minor_cd) = '" & vendedor_i & "' Or (sta010t.minor_cd) > '" & vendedor_i & "') And ((sta010t.minor_cd) = '" & vendedor_f & "' Or (sta010t.minor_cd) < '" & vendedor_f & "')) AND ((sta010t.major_cd)='9001')) ORDER BY sal020t.cust_cd,sta010t.code_nm") 'Set Rslast2 = CurrentDb.OpenRecordset(sqllast2) If Rslast2.EOF And Rslast2.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 2." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else lqtysamsung = 0 Dim lqtyplant22, lamtplant22, lm2plant22 Rslast2.MoveFirst Do While Not Rslast2.EOF If Rslast2("cust_cd") = "20001" Then lqtysamsung2 = lqtysamsung2 + cdbl(Rslast2("sales_qty")) lamtsamsung2 = lamtsamsung2 + cdbl(Rslast2("sales_amt")) lm2samsung2 = lm2samsung2 + cdbl(Rslast2("sales_m2")) End If lqtyplant22 = lqtyplant22 + cdbl(Rslast2("sales_qty")) lamtplant22 = lamtplant22 + cdbl(Rslast2("sales_amt")) lm2plant22 = lm2plant22 + cdbl(Rslast2("sales_m2")) If Rslast2("cust_cd") = "99999" Then lqtyplant2sinly = lqtyplant2sinly + cdbl(Rslast2("sales_qty")) lamtplant2sinly = lamtplant2sinly + cdbl(Rslast2("sales_amt")) lm2plant2sinly = lm2plant2sinly + cdbl(Rslast2("sales_m2")) end if Rslast2.MoveNext Loop End If Rslast2.Close Set Rslast2 = Nothing '**************book2ing Dim Rsbook2 Dim Sqlbook2 set Rsbook2=dbsql.execute("SELECT saa080t.po_date, saa080t.po_no, saa080t.po_seq, stb010t.cust_nm, stb040t.good_nm, saa080t.po_qty, saa080t.qty, saa080t.pending_qty, saa080t.price, saa080t.amt,stb040t.sht_size1, stb040t.sht_size2, stb040t.poksu, stb040t.julsu,stb040t.hapsu " & _ " FROM (saa080t INNER JOIN stb010t ON saa080t.cust_cd = stb010t.cust_cd) INNER JOIN stb040t ON (saa080t.good_cd = stb040t.good_cd) AND (saa080t.cust_cd = stb040t.cust_cd) " & _ " WHERE ((((saa080t.po_date)='" & fechainicial2 & "' Or (saa080t.po_date)>'" & fechainicial2 & "') And ((saa080t.po_date)='" & fechafinal2 & "' Or (saa080t.po_date)<'" & fechafinal2 & "')))") 'Set Rsbook2 = CurrentDb.OpenRecordset(Sqlbook2) If Rsbook2.EOF And Rsbook2.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 2." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else lqtysamsung2 = 0 Dim lqtybook2, lamtbook2, lm2book2 Rsbook2.MoveFirst Do While Not Rsbook2.EOF lqtybook2 = lqtybook2 + cdbl(Rsbook2("po_qty")) lamtbook2 = lamtbook2 + cdbl(Rsbook2("amt")) lm2book2 = lm2book2 + ((cdbl(Rsbook2("sht_size1")) * cdbl(Rsbook2("sht_size2")) / 1000000) / cdbl(Rsbook2("poksu")) / cdbl(Rsbook2("julsu")) * cdbl(Rsbook2("hapsu")) * cdbl(Rsbook2("po_qty"))) If Not Rsbook2.EOF Then Rsbook2.MoveNext End If Loop End If Rsbook2.Close Set Rsbook2 = Nothing '**************end book2ing '*************** Inter company Dim Rsinterc2 Dim Sqlinterc2 set Rsinterc2=dbsql.execute("SELECT mtd011t.bal_date, mtd011t.po_no, mtd011t.bal_seq, stb010t.cust_nm, mtd011t.bal_sub, mtd011t.bal_qty, mtd011t.nap_date, mtd011t.bal_amt, stb010t.cust_cd, mtd010t.jaje_nm" & _ " FROM (mtd011t INNER JOIN stb010t ON mtd011t.cust_cd = stb010t.cust_cd) INNER JOIN mtd010t ON (mtd011t.jaje_seq = mtd010t.jaje_seq) AND (mtd011t.crp_id = mtd010t.crp_id) " & _ " WHERE ((((mtd011t.bal_date) = '" & fechainicial2 & "' Or (mtd011t.bal_date) > '" & fechainicial2 & "') And ((mtd011t.bal_date) = '" & fechafinal2 & "' Or (mtd011t.bal_date) <'" & fechafinal2 & "')) And ((stb010t.cust_cd) = '60452')) " & _ " ORDER BY mtd011t.bal_date, mtd011t.bal_seq, mtd011t.bal_sub") 'Set Rsinterc2 = CurrentDb.OpenRecordset(Sqlinterc2) If Rsinterc2.EOF And Rsinterc2.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 1." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 ' Response = MsgBox(Msg, Style, Title, Help, ctxt) Else Dim lqtyinterc2, lamtinterc2, lm2interc2 Rsinterc2.MoveFirst Do While Not Rsinterc2.EOF lqtyinterc2 = lqtyinterc2 + cdbl(Rsinterc2("bal_qty")) lamtinterc2 = lamtinterc2 + cdbl(Rsinterc2("bal_amt")) 'lm2interc2 = lm2interc2 + rsinterc2("sales_m2") Rsinterc2.MoveNext Loop End If Rsinterc2.Close Set Rsinterc2 = Nothing '*************** End Inter company 'Refresh qtybook2 = lqtybook2 amtbook2 = lamtbook2 m2book2 = lm2book2 qtysamsung = lqtysamsung3 amtsamsung = lamtsamsung3 m2samsung = lm2samsung3 qtyplant1 = lqtyplant11 amtplant1 = lamtplant11 m2plant1 = lm2plant11 qtyplant2 = lqtyplant22 amtplant2 = lamtplant22-lamtplant2sinly m2plant2 = lm2plant22 qtyinterc2 = lqtyinterc2 amtinterc2 = lamtinterc2 m2interc2 = lm2interc2 End If '***************** '''''''''''calcula fin ''''''actual Tot_sales_QtyAll = Tot_sales_qty + Tot_sales_qty2 + Tot_sales_qty_sam Tot_sales_AmtAll = Tot_sales_amt + Tot_sales_amt2 + Tot_sales_amt_sam Tot_sales_AmtAll2 = lamtplantInv + lamtplantInv2 + Tot_sales_amt_sam Tot_sales_m2All = Tot_sales_m2 + Tot_sales_m2_2 + Tot_sales_m2_sam lbl_month = MonthName(Month(Date_ini), False) lbl_lastyear = Year(Date_ini) - 1 lbl_actualyear = Year(Date_end) If Tot_sales_amt > 0 Then CtoPiece = Tot_sales_amt / Tot_sales_qty CtoM2 = Tot_sales_amt / Tot_sales_m2 End If If Tot_sales_amt_sam > 0 Then CtoPiece_sam = Tot_sales_amt_sam / Tot_sales_qty_sam CtoM2_sam = Tot_sales_amt_sam / Tot_sales_m2_sam End If If Tot_sales_amt2 > 0 Then CtoPiece2 = Round(Tot_sales_amt2 / Tot_sales_qty2, 2) End If If amtbook > 0 Then ctopiece_book = Round(amtbook / qtybook, 2) CtoM2_book = Round(amtbook / m2book, 3) End If If amtinterc > 0 Then CtoPiece_inter = Round(amtinterc / qtyinterc, 2) End If If Tot_sales_AmtAll > 0 Then totpiece1 = Tot_sales_AmtAll / Tot_sales_QtyAll totm2_1 = Tot_sales_AmtAll / Tot_sales_m2All End If totqtylast = qtyplant1 + qtyplant2 + qtysamsung totamtlast = amtplant1 + amtplant2 + amtsamsung totm2last = m2plant1 + m2plant2 + m2samsung If amtbook2 > 0 Then CtoPiece_last1 = amtbook2 / qtybook2 CtoM2_last1 = amtbook2 / m2book2 End If If amtplant1 > 0 Then CtoPiece_last2 = amtplant1 / qtyplant1 CtoM2_last2 = amtplant1 / m2plant1 End If If amtplant2 > 0 Then CtoPiece_last3 = amtplant2 / qtyplant2 'CtoM2_last3 = amtplant2 / m2plant2 End If If amtsamsung > 0 Then CtoPiece_last4 = amtsamsung / qtysamsung CtoM2_last4 = amtsamsung / m2samsung End If If amtinterc2 > 0 Then CtoPiece_last5 = amtinterc2 / qtyinterc2 'CtoM2_last5 = amtinterc2 / m2book2 End If If totamtlast > 0 Then totpiece2 = totamtlast / totqtylast totm2_2 = totamtlast / totm2last End If strday = Right("00" & Day(Date_ini), 2) strmonth = Right("00" & Month(Date_ini), 2) stryear = Right("00" & Year(Date_ini), 4) iniciomes = cdate(strmonth&"/"&"01"&"/"&stryear) date_e = cdate(Date_end) date_i = cdate(Date_ini)-(day(Date_ini)-1) diastrans = 0 contador=1 Do While cdate(date_i) =< (cdate(date_e)) lweekday = Weekday(cdate(date_i)) If lweekday = 1 Or lweekday = 7 Then Else diastrans = diastrans + 1 End If 'response.write(" Date1: "&date_i&" Day W: "&lweekday) date_i = cdate(date_i) + 1 contador=contador+1 Loop if diastrans = 0 then diastrans = 1 end if 'response.write("dias trans: "&diastrans) diastranscurridos = diastrans lmonth = Month(Date_end) If lmonth = 1 Or lmonth = 3 Or lmonth = 5 Or lmonth = 7 Or lmonth = 8 Or lmonth = 10 Or lmonth = 12 Then ldiasmes = 31 End If If lmonth = 2 Then ldiasmes = 28 End If If lmonth = 4 Or lmonth = 6 Or lmonth = 9 Or lmonth = 11 Then ldiasmes = 30 End If findemes = cdate(Date_end) + (ldiasmes - Day(cdate(Date_end))) date_em = cdate(Date_end) 'date_im = Date_ini diasxtrans = 0 Do While cdate(date_em) < (cdate(findemes)) Or cdate(date_em) = (cdate(findemes)) lweekday = Weekday(cdate(Date_em)) If lweekday = 1 Or lweekday = 7 Then Else diasxtrans = diasxtrans + 1 End If date_em = cdate(date_em) + 1 Loop diasxtranscurrir = diasxtrans 'diasxtranscurrir =1 ' response.write(" dias xtrans: "&diasxtrans) current1 = Tot_sales_amt current2 = Tot_sales_amt2 current3 = Tot_sales_amt_sam diastrans1=(diastrans-0) diastrans3=(diastrans-0) if Tot_sales_amt>0 and ((diastrans1-0)>0) then dailyavg1 = Tot_sales_amt / (diastrans1-0) else dailyavg1 =0 end if 'dailyavg2 = (Tot_sales_amt2-lamtvboard) / diastrans 'dailyavg4 = lamtvboard / diastrans ' dailyavg3 = Tot_sales_amt_sam / diastrans 'projection3 = dailyavg3 * (21) 'projection1 = dailyavg1 * (diasxtrans + diastrans) 'projection2 = dailyavg2 * (diasxtrans + diastrans) 'projection3 = dailyavg3 * (diasxtrans + diastrans) 'projection1 = dailyavg1 * (notsamdays) 'not samsung projection1 = Tot_sales_amt + ( dailyavg1 * (notsamdays-(diastrans1-dfestivo1)-xrestandias)) ''projection1 = Tot_sales_amt + ( dailyavg1 * (diasxtranscurrir)) total_1 = current1 + current3 + current2 'If forecast > 0 Then 'fulfillment1 = total_3 / forecast 'fulfillment2 = total_3 / bussines 'End If ''''''actual fin ''''''last year ''''' Last year Plant1 strlastyear = Right("00" & (Year(Date_ini) - 2), 4) stryear3 = Right("00" & (Year(Date_end)), 4) fechainicial3 = Cstr(strlastyear + "12" + "31") fechafinal3 = CStr(stryear3 + "01" + "01") 'If xx = 1 Then Dim Rslast3 Dim sqllast3 set Rslast3=dbsql.execute("SELECT sal020t.good_date, sal020t.sales_class, sta010t.code_nm, sal020t.cust_cd, stb010t.cust_nm, sal020t.local_cd, sal020t.sales_qty, sal020t.sales_amt, sal020t.sales_m2, sal020t.chk_tit,sal020t.pack_no FROM (sal020t LEFT JOIN stb010t ON sal020t.cust_cd = stb010t.cust_cd) LEFT JOIN sta010t ON stb010t.sale_cd = sta010t.minor_cd " & _ " WHERE (((sal020t.good_date) > '" & fechainicial3 & "' and (sal020t.good_date) < '" & fechafinal3 & "') And (((sta010t.minor_cd) = '" & vendedor_i & "' Or (sta010t.minor_cd) > '" & vendedor_i & "') And ((sta010t.minor_cd) = '" & vendedor_f & "' Or (sta010t.minor_cd) < '" & vendedor_f & "')) AND ((sta010t.major_cd)='9001'))") 'Set Rslast3 = CurrentDb.OpenRecordset(sqllast3) If Rslast3.EOF And Rslast3.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 2." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else Rslast3.MoveFirst Do While Not Rslast3.EOF lmes1 = Mid(Rslast3("good_date"), 5, 2) If left(Rslast3("pack_no"),5) = "SCRAP" Then 'lscrapqty1 = lscrapqty1 + cdbl(Rsmir1("sales_qty")) 'lscrapamt1 = lscrapamt1 + cdbl(Rsmir1("sales_amt")) 'lscrapmt21 = lscrapmt21 + cdbl(Rsmir1("sales_m2")) Else If lmes1 = "01" Then if Rslast3("sales_class")="1" then ljan1 = ljan1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then ljan1SAM = ljan1SAM + cdbl(Rslast3("sales_amt")) end if End If If lmes1 = "02" Then if Rslast3("sales_class")="1" then lfeb1 = lfeb1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then lfeb1SAM = lfeb1SAM + cdbl(Rslast3("sales_amt")) end if End If If lmes1 = "03" Then if Rslast3("sales_class")="1" then lmar1 = lmar1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then lmar1SAM = lmar1SAM + cdbl(Rslast3("sales_amt")) end if End If If lmes1 = "04" Then if Rslast3("sales_class")="1" then lapr1 = lapr1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then lapr1SAM = lapr1SAM + cdbl(Rslast3("sales_amt")) end if End If If lmes1 = "05" Then if Rslast3("sales_class")="1" then lmay1 = lmay1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then lmay1SAM = lmay1SAM + cdbl(Rslast3("sales_amt")) end if End If If lmes1 = "06" Then if Rslast3("sales_class")="1" then ljun1 = ljun1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then ljun1SAM = ljun1SAM + cdbl(Rslast3("sales_amt")) end if End If If lmes1 = "07" Then if Rslast3("sales_class")="1" then ljul1 = ljul1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then ljul1SAM = ljul1SAM + cdbl(Rslast3("sales_amt")) end if End If If lmes1 = "08" Then if Rslast3("sales_class")="1" then laug1 = laug1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then laug1SAM = laug1SAM + cdbl(Rslast3("sales_amt")) end if End If If lmes1 = "09" Then if Rslast3("sales_class")="1" then lsep1 = lsep1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then lsep1SAM = lsep1SAM + cdbl(Rslast3("sales_amt")) end if End If If lmes1 = "10" Then if Rslast3("sales_class")="1" then loct1 = loct1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then loct1SAM = loct1SAM + cdbl(Rslast3("sales_amt")) end if End If If lmes1 = "11" Then if Rslast3("sales_class")="1" then lnov1 = lnov1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then lnov1SAM = lnov1SAM + cdbl(Rslast3("sales_amt")) end if End If If lmes1 = "12" Then if Rslast3("sales_class")="1" then ldec1 = ldec1 + cdbl(Rslast3("sales_amt")) end if if Rslast3("cust_cd")="20001" and Rslast3("sales_class")="1" then ldec1SAM = ldec1SAM + cdbl(Rslast3("sales_amt")) end if End If End if Rslast3.MoveNext Loop End If Rslast3.Close Set Rslast3 = Nothing 'End If ''''' Last year Plant 2 Dim Rslast4 Dim sqllast4 set Rslast4=dbsql2.execute("SELECT sal020t.good_date, sta010t.code_nm, sal020t.cust_cd, stb010t.cust_nm, sal020t.local_cd, sal020t.sales_qty, sal020t.sales_amt, sal020t.sales_m2, sal020t.chk_tit,sal020t.pack_no FROM (sal020t LEFT JOIN stb010t ON sal020t.cust_cd = stb010t.cust_cd) LEFT JOIN sta010t ON stb010t.sale_cd = sta010t.minor_cd " & _ " WHERE (((sal020t.good_date) > '" & fechainicial3 & "' and (sal020t.good_date) < '" & fechafinal3 & "') And (((sta010t.minor_cd) = '" & vendedor_i & "' Or (sta010t.minor_cd) > '" & vendedor_i & "') And ((sta010t.minor_cd) = '" & vendedor_f & "' Or (sta010t.minor_cd) < '" & vendedor_f & "')) AND ((sta010t.major_cd)='9001'))") 'Set Rslast4 = CurrentDb.OpenRecordset(sqllast4) If Rslast4.EOF And Rslast4.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 2." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else 'Dim ljan1, lfeb1, lmar1, lapr1, lmay1, ljun1, ljul1, laug1, lsep1, loct1, lnov1, ldec1 As Double Rslast4.MoveFirst Do While Not Rslast4.EOF lmes1 = Mid(Rslast4("good_date"), 5, 2) If left(Rslast4("pack_no"),5) = "SCRAP" Then 'lscrapqty1 = lscrapqty1 + cdbl(Rsmir1("sales_qty")) 'lscrapamt1 = lscrapamt1 + cdbl(Rsmir1("sales_amt")) 'lscrapmt21 = lscrapmt21 + cdbl(Rsmir1("sales_m2")) Else If lmes1 = "01" Then ljan1 = ljan1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then ljan1SAM = ljan1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then ljan1Sin = ljan1Sin + cdbl(Rslast4("sales_amt")) end if End If If lmes1 = "02" Then lfeb1 = lfeb1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then lfeb1SAM = lfeb1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then lfeb1Sin = lfeb1Sin + cdbl(Rslast4("sales_amt")) end if End If If lmes1 = "03" Then lmar1 = lmar1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then lmar1SAM = lmar1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then lmar1Sin = lmar1Sin + cdbl(Rslast4("sales_amt")) end if End If If lmes1 = "04" Then lapr1 = lapr1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then lapr1SAM = lapr1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then lapr1Sin = lapr1Sin + cdbl(Rslast4("sales_amt")) end if End If If lmes1 = "05" Then lmay1 = lmay1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then lmay1SAM = lmay1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then lmay1Sin = lmay1Sin + cdbl(Rslast4("sales_amt")) end if End If If lmes1 = "06" Then ljun1 = ljun1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then ljun1SAM = ljun1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then ljun1Sin = ljun1Sin + cdbl(Rslast4("sales_amt")) end if End If If lmes1 = "07" Then ljul1 = ljul1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then ljul1SAM = ljul1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then ljul1Sin = ljul1Sin + cdbl(Rslast4("sales_amt")) end if End If If lmes1 = "08" Then laug1 = laug1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then laug1SAM = laug1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then laug1Sin = laug1Sin + cdbl(Rslast4("sales_amt")) end if End If If lmes1 = "09" Then lsep1 = lsep1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then lsep1SAM = lsep1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then lsep1Sin = lsep1Sin + cdbl(Rslast4("sales_amt")) end if End If If lmes1 = "10" Then loct1 = loct1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then loct1SAM = loct1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then loct1Sin = loct1Sin + cdbl(Rslast4("sales_amt")) end if End If If lmes1 = "11" Then lnov1 = lnov1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then lnov1SAM = lnov1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then lnov1Sin = lnov1Sin + cdbl(Rslast4("sales_amt")) end if End If If lmes1 = "12" Then ldec1 = ldec1 + cdbl(Rslast4("sales_amt")) if Rslast4("cust_cd")="20001" then ldec1SAM = ldec1SAM + cdbl(Rslast4("sales_amt")) end if if Rslast4("cust_cd")="99999" then ldec1Sin = ldec1Sin + cdbl(Rslast4("sales_amt")) end if End If End if Rslast4.MoveNext Loop End If Rslast4.Close Set Rslast4 = Nothing '***************** jan1 = ljan1-ljan1Sin feb1 = lfeb1-lfeb1Sin mar1 = lmar1-lmar1Sin apr1 = lapr1-lapr1Sin may1 = lmay1-lmay1Sin jun1 = ljun1-ljun1Sin jul1 = ljul1-ljul1Sin aug1 = laug1-laug1Sin sep1 = lsep1-lsep1Sin oct1 = loct1-loct1Sin nov1 = lnov1-lnov1Sin dec1 = ldec1-ldec1Sin ltotyear1Sin=ljan1Sin + lfeb1Sin + lmar1Sin + lapr1Sin + lmay1Sin + ljun1Sin + ljul1Sin + laug1Sin + lsep1Sin + loct1Sin + lnov1Sin + ldec1Sin totyear1 = ljan1 + lfeb1 + lmar1 + lapr1 + lmay1 + ljun1 + ljul1 + laug1 + lsep1 + loct1 + lnov1 + ldec1-(ltotyear1Sin) ltotyear1SAM=ljan1SAM + lfeb1SAM + lmar1SAM + lapr1SAM + lmay1SAM + ljun1SAM + ljul1SAM + laug1SAM + lsep1SAM + loct1SAM + lnov1SAM + ldec1SAM ''''''last year fin ''''''''''''''''''''''' actual year ''' Actual year Plant 1 strlastyear = Right("00" & (Year(Date_ini) - 1), 4) stryear3 = Right("00" & (Year(Date_end) + 1), 4) fechainicial3 = Cstr(strlastyear + "12" + "31") fechafinal3 = Cstr(stryear3 + "01" + "01") Dim Rslast5 Dim sqllast5 set Rslast5=dbsql.execute("SELECT sal020t.good_date, sal020t.sales_class, sta010t.code_nm, sal020t.cust_cd, stb010t.cust_nm, sal020t.local_cd, sal020t.sales_qty, sal020t.sales_amt, sal020t.sales_m2, sal020t.chk_tit,sal020t.pack_no FROM (sal020t LEFT JOIN stb010t ON sal020t.cust_cd = stb010t.cust_cd) LEFT JOIN sta010t ON stb010t.sale_cd = sta010t.minor_cd " & _ " WHERE (((sal020t.good_date) > '" & fechainicial3 & "' and (sal020t.good_date) < '" & fechafinal3 & "') And (((sta010t.minor_cd) = '" & vendedor_i & "' Or (sta010t.minor_cd) > '" & vendedor_i & "') And ((sta010t.minor_cd) = '" & vendedor_f & "' Or (sta010t.minor_cd) < '" & vendedor_f & "')) AND ((sta010t.major_cd)='9001')) ORDER BY sta010t.code_nm, sal020t.cust_cd") 'Set Rslast5 = CurrentDb.OpenRecordset(sqllast4) If Rslast5.EOF And Rslast5.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 1." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else Dim ljan2, lfeb2, lmar2, lapr2, lmay2, ljun2, ljul2, laug2, lsep2, loct2, lnov2, ldec2 Rslast5.MoveFirst Do While Not Rslast5.EOF lmes2 = Mid(Rslast5("good_date"), 5, 2) If left(Rslast5("pack_no"),5) = "SCRAP" Then 'lscrapqty1 = lscrapqty1 + cdbl(Rsmir1("sales_qty")) 'lscrapamt1 = lscrapamt1 + cdbl(Rsmir1("sales_amt")) 'lscrapmt21 = lscrapmt21 + cdbl(Rsmir1("sales_m2")) Else If lmes2 = "01" Then if Rslast5("sales_class")="1" then ljan2 = ljan2 + cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then ljan2SAM = ljan2SAM + cdbl(Rslast5("sales_amt")) end if End If If lmes2 = "02" Then if Rslast5("sales_class")="1" then lfeb2 = lfeb2 + cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then lfeb2SAM = lfeb2SAM + cdbl(Rslast5("sales_amt")) end if End If If lmes2 = "03" Then if Rslast5("sales_class")="1" then lmar2 = lmar2 + cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then lmar2SAM = lmar2SAM + cdbl(Rslast5("sales_amt")) end if End If If lmes2 = "04" Then if Rslast5("sales_class")="1" then lapr2 = lapr2 + cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then lapr2SAM = lapr2SAM + cdbl(Rslast5("sales_amt")) end if End If If lmes2 = "05" Then if Rslast5("sales_class")="1" then lmay2 = lmay2 +cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then lmay2SAM = lmay2SAM + cdbl(Rslast5("sales_amt")) end if End If If lmes2 = "06" Then if Rslast5("sales_class")="1" then ljun2 = ljun2 + cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then ljun2SAM = ljun2SAM + cdbl(Rslast5("sales_amt")) end if End If If lmes2 = "07" Then if Rslast5("sales_class")="1" then ljul2 = ljul2 +cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then ljul2SAM = ljul2SAM + cdbl(Rslast5("sales_amt")) end if End If If lmes2 = "08" Then if Rslast5("sales_class")="1" then laug2 = laug2 + cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then laug2SAM = laug2SAM + cdbl(Rslast5("sales_amt")) end if End If If lmes2 = "09" Then if Rslast5("sales_class")="1" then lsep2 = lsep2 +cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then lsep2SAM = lsep2SAM + cdbl(Rslast5("sales_amt")) end if End If If lmes2 = "10" Then if Rslast5("sales_class")="1" then loct2 = loct2 + cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then loct2SAM = loct2SAM + cdbl(Rslast5("sales_amt")) end if End If If lmes2 = "11" Then if Rslast5("sales_class")="1" then lnov2 = lnov2 + cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then lnov2SAM = lnov2SAM + cdbl(Rslast5("sales_amt")) end if End If If lmes2 = "12" Then if Rslast5("sales_class")="1" then ldec2 = ldec2 + cdbl(Rslast5("sales_amt")) end if if Rslast5("cust_cd")="20001" and Rslast5("sales_class")="1" then ldec2SAM = ldec2SAM + cdbl(Rslast5("sales_amt")) end if End If end If Rslast5.MoveNext Loop End If Rslast5.Close Set Rslast5 = Nothing ''' Actual year Plant 2 Dim Rslast6 Dim sqllast6 set Rslast6=dbsql2.execute("SELECT sal020t.good_date, sta010t.code_nm, sal020t.cust_cd, stb010t.cust_nm, sal020t.local_cd, sal020t.sales_qty, sal020t.sales_amt, sal020t.sales_m2, sal020t.chk_tit FROM (sal020t LEFT JOIN stb010t ON sal020t.cust_cd = stb010t.cust_cd) LEFT JOIN sta010t ON stb010t.sale_cd = sta010t.minor_cd " & _ " WHERE (((sal020t.good_date) > '" & fechainicial3 & "' and (sal020t.good_date) < '" & fechafinal3 & "') And (((sta010t.minor_cd) = '" & vendedor_i & "' Or (sta010t.minor_cd) > '" & vendedor_i & "') And ((sta010t.minor_cd) = '" & vendedor_f & "' Or (sta010t.minor_cd) < '" & vendedor_f & "')) AND ((sta010t.major_cd)='9001')) ORDER BY sta010t.code_nm, sal020t.cust_cd") 'Set Rslast6 = CurrentDb.OpenRecordset(sqllast6) If Rslast6.EOF And Rslast6.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 2." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else 'Dim ljan2, lfeb2, lmar2, lapr2, lmay2, ljun2, ljul2, laug2, lsep2, loct2, lnov2, ldec2 As Double Rslast6.MoveFirst Do While Not Rslast6.EOF lmes2 = Mid(Rslast6("good_date"), 5, 2) If lmes2 = "01" Then ljan2 = ljan2 + cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then ljan2SAM = ljan2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then ljan2Sin = ljan2Sin + cdbl(Rslast6("sales_amt")) end if End If If lmes2 = "02" Then lfeb2 = lfeb2 + cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then lfeb2SAM = lfeb2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then lfeb2Sin = lfeb2Sin + cdbl(Rslast6("sales_amt")) end if End If If lmes2 = "03" Then lmar2 = lmar2 + cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then lmar2SAM = lmar2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then lmar2Sin = lmar2Sin + cdbl(Rslast6("sales_amt")) end if End If If lmes2 = "04" Then lapr2 = lapr2 + cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then lapr2SAM = lapr2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then lapr2Sin = lapr2Sin + cdbl(Rslast6("sales_amt")) end if End If If lmes2 = "05" Then lmay2 = lmay2 + cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then lmay2SAM = lmay2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then lmay2Sin = lmay2Sin + cdbl(Rslast6("sales_amt")) end if End If If lmes2 = "06" Then ljun2 = ljun2 + cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then ljun2SAM = ljun2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then ljun2Sin = ljun2Sin + cdbl(Rslast6("sales_amt")) end if End If If lmes2 = "07" Then ljul2 = ljul2 + cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then ljul2SAM = ljul2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then ljul2Sin = ljul2Sin + cdbl(Rslast6("sales_amt")) end if End If If lmes2 = "08" Then laug2 = laug2 +cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then laug2SAM = laug2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then laug2Sin = laug2Sin + cdbl(Rslast6("sales_amt")) end if End If If lmes2 = "09" Then lsep2 = lsep2 + cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then lsep2SAM = lsep2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then lsep2Sin = lsep2Sin + cdbl(Rslast6("sales_amt")) end if End If If lmes2 = "10" Then loct2 = loct2 + cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then loct2SAM = loct2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then loct2Sin = loct2Sin + cdbl(Rslast6("sales_amt")) end if End If If lmes2 = "11" Then lnov2 = lnov2 + cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then lnov2SAM = lnov2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then lnov2Sin = lnovSin + cdbl(Rslast6("sales_amt")) end if End If If lmes2 = "12" Then ldec2 = ldec2 + cdbl(Rslast6("sales_amt")) if Rslast6("cust_cd")="20001" then ldec2SAM = ldec2SAM + cdbl(Rslast6("sales_amt")) end if if Rslast6("cust_cd")="99999" then ldec2Sin = ldec2Sin + cdbl(Rslast6("sales_amt")) end if End If Rslast6.MoveNext Loop End If Rslast6.Close Set Rslast6 = Nothing '***************** jan2 = ljan2-ljan2Sin feb2 = lfeb2-lfeb2Sin mar2 = lmar2-lmar2Sin apr2 = lapr2-lapr2Sin may2 = lmay2-lmay2Sin jun2 = ljun2-ljun2Sin jul2 = ljul2-ljul2Sin aug2 = laug2-laug2Sin sep2 = lsep2-lsep2Sin oct2 = loct2-loct2Sin nov2 = lnov2-lnov2Sin dec2 = ldec2-ldec2Sin ltotyear2Sin=ljan2Sin + lfeb2Sin + lmar2Sinn + lapr2Sin + lmay2Sin + ljun2Sin + ljul2Sin + laug2Sin + lsep2Sin + loct2Sin + lnov2Sin + ldec2Sin totyear2 = jan2 + feb2 + mar2 + apr2 + may2 + jun2 + jul2 + aug2 + sep2 + oct2 + nov2 + dec2 ltotyear2SAM=ljan2SAM + lfeb2SAM + lmar2SAM + lapr2SAM + lmay2SAM + ljun2SAM + ljul2SAM + laug2SAM + lsep2SAM + loct2SAM + lnov2SAM + ldec2SAM ''''''''''''''''''''''' actual year fin '''''''''''''''''''''''''' ********** (2 años atras) llast2year1 = Right("00" & (Year(Date_ini) - 3), 4) llast2year2 = Right("00" & (Year(Date_ini) - 1), 4) fechainicial0 = Cstr(llast2year1 + "12" + "31") fechafinal0 = Cstr(llast2year2 + "01" + "01") Dim Rslast0 Dim sqllast0 set Rslast0=dbsql.execute("SELECT sal020t.good_date, sal020t.sales_class, sta010t.code_nm, sal020t.cust_cd, stb010t.cust_nm, sal020t.local_cd, sal020t.sales_qty, sal020t.sales_amt, sal020t.sales_m2, sal020t.chk_tit, sal020t.pack_no FROM (sal020t LEFT JOIN stb010t ON sal020t.cust_cd = stb010t.cust_cd) LEFT JOIN sta010t ON stb010t.sale_cd = sta010t.minor_cd " & _ " WHERE (((sal020t.good_date) > '" & fechainicial0 & "' and (sal020t.good_date) < '" & fechafinal0 & "') And (((sta010t.minor_cd) = '" & vendedor_i & "' Or (sta010t.minor_cd) > '" & vendedor_i & "') And ((sta010t.minor_cd) = '" & vendedor_f & "' Or (sta010t.minor_cd) < '" & vendedor_f & "')) AND ((sta010t.major_cd)='9001'))") If Rslast0.EOF And Rslast0.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 2." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else Rslast0.MoveFirst Do While Not Rslast0.EOF lmes0 = Mid(Rslast0("good_date"), 5, 2) If left(Rslast0("pack_no"),5) = "SCRAP" Then 'lscrapqty1 = lscrapqty1 + cdbl(Rsmir1("sales_qty")) 'lscrapamt1 = lscrapamt1 + cdbl(Rsmir1("sales_amt")) 'lscrapmt21 = lscrapmt21 + cdbl(Rsmir1("sales_m2")) Else If lmes0 = "01" Then if Rslast0("sales_class")="1" then ljan0 = ljan0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then ljan0SAM = ljan0SAM + cdbl(Rslast0("sales_amt")) end if End If If lmes0 = "02" Then if Rslast0("sales_class")="1" then lfeb0 = lfeb0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then lfeb0SAM = lfeb0SAM + cdbl(Rslast0("sales_amt")) end if End If If lmes0 = "03" Then if Rslast0("sales_class")="1" then lmar0 = lmar0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then lmar0SAM = lmar0SAM + cdbl(Rslast0("sales_amt")) end if End If If lmes0 = "04" Then if Rslast0("sales_class")="1" then lapr0 = lapr0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then lapr0SAM = lapr0SAM + cdbl(Rslast0("sales_amt")) end if End If If lmes0 = "05" Then if Rslast0("sales_class")="1" then lmay0 = lmay0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then lmay0SAM = lmay0SAM + cdbl(Rslast0("sales_amt")) end if End If If lmes0 = "06" Then if Rslast0("sales_class")="1" then ljun0 = ljun0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then ljun0SAM = ljun0SAM + cdbl(Rslast0("sales_amt")) end if End If If lmes0 = "07" Then if Rslast0("sales_class")="1" then ljul0 = ljul0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then ljul0SAM = ljul0SAM + cdbl(Rslast0("sales_amt")) end if End If If lmes0 = "08" Then if Rslast0("sales_class")="1" then laug0 = laug0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then laug0SAM = laug0SAM + cdbl(Rslast0("sales_amt")) end if End If If lmes0 = "09" Then if Rslast0("sales_class")="1" then lsep0 = lsep0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then lsep0SAM = lsep0SAM + cdbl(Rslast0("sales_amt")) end if End If If lmes0 = "10" Then if Rslast0("sales_class")="1" then loct0 = loct0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then loct0SAM = loct0SAM + cdbl(Rslast0("sales_amt")) end if End If If lmes0 = "11" Then if Rslast0("sales_class")="1" then lnov0 = lnov0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then lnov0SAM = lnov0SAM + cdbl(Rslast0("sales_amt")) end if End If If lmes0 = "12" Then if Rslast0("sales_class")="1" then ldec0 = ldec0 + cdbl(Rslast0("sales_amt")) end if if Rslast0("cust_cd")="20001" and Rslast0("sales_class")="1" then ldec0SAM = ldec0SAM + cdbl(Rslast0("sales_amt")) end if End If End if Rslast0.MoveNext Loop End If Rslast0.Close Set Rslast0 = Nothing 'End If ''''' Last year Plant 2 Dim Rslast02 Dim sqllast02 set Rslast02=dbsql2.execute("SELECT sal020t.good_date, sta010t.code_nm, sal020t.cust_cd, stb010t.cust_nm, sal020t.local_cd, sal020t.sales_qty, sal020t.sales_amt, sal020t.sales_m2, sal020t.chk_tit FROM (sal020t LEFT JOIN stb010t ON sal020t.cust_cd = stb010t.cust_cd) LEFT JOIN sta010t ON stb010t.sale_cd = sta010t.minor_cd " & _ " WHERE (((sal020t.good_date) > '" & fechainicial0 & "' and (sal020t.good_date) < '" & fechafinal0 & "') And (((sta010t.minor_cd) = '" & vendedor_i & "' Or (sta010t.minor_cd) > '" & vendedor_i & "') And ((sta010t.minor_cd) = '" & vendedor_f & "' Or (sta010t.minor_cd) < '" & vendedor_f & "')) AND ((sta010t.major_cd)='9001'))") If Rslast02.EOF And Rslast02.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 2." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else 'Dim ljan1, lfeb1, lmar1, lapr1, lmay1, ljun1, ljul1, laug1, lsep1, loct1, lnov1, ldec1 As Double Rslast02.MoveFirst Do While Not Rslast02.EOF lmes1 = Mid(Rslast02("good_date"), 5, 2) If lmes1 = "01" Then ljan0 = ljan0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then ljan0SAM = ljan0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then ljan0Sin = ljan0Sin + cdbl(Rslast02("sales_amt")) end if End If If lmes1 = "02" Then lfeb0 = lfeb0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then lfeb0SAM = lfeb0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then lfeb0Sin = lfeb0Sin + cdbl(Rslast02("sales_amt")) end if End If If lmes1 = "03" Then lmar0 = lmar0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then lmar0SAM = lmar0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then lmar0Sin = lmar0Sin + cdbl(Rslast02("sales_amt")) end if End If If lmes1 = "04" Then lapr0 = lapr0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then lapr0SAM = lapr0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then lapr0Sin = lapr0Sin + cdbl(Rslast02("sales_amt")) end if End If If lmes1 = "05" Then lmay0 = lmay0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then lmay0SAM = lmay0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then lmay0Sin = lmay0Sin + cdbl(Rslast02("sales_amt")) end if End If If lmes1 = "06" Then ljun0 = ljun0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then ljun0SAM = ljun0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then ljun0Sin = ljun0Sin + cdbl(Rslast02("sales_amt")) end if End If If lmes1 = "07" Then ljul0 = ljul0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then ljul0SAM = ljul0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then ljul0Sin = ljul0Sin + cdbl(Rslast02("sales_amt")) end if End If If lmes1 = "08" Then laug0 = laug0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then laug0SAM = laug0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then laug0Sin = laug0Sin + cdbl(Rslast02("sales_amt")) end if End If If lmes1 = "09" Then lsep0 = lsep0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then lsep0SAM = lsep0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then lsep0Sin = lsep0Sin + cdbl(Rslast02("sales_amt")) end if End If If lmes1 = "10" Then loct0 = loct0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then loct0SAM = loct0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then loct0Sin = loct0Sin + cdbl(Rslast02("sales_amt")) end if End If If lmes1 = "11" Then lnov0 = lnov0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then lnov0SAM = lnov0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then lnov0Sin = lnov0Sin + cdbl(Rslast02("sales_amt")) end if End If If lmes1 = "12" Then ldec0 = ldec0 + cdbl(Rslast02("sales_amt")) if Rslast02("cust_cd")="20001" then ldec0SAM = ldec0SAM + cdbl(Rslast02("sales_amt")) end if if Rslast02("cust_cd")="99999" then decl0Sin = ldec0Sin + cdbl(Rslast02("sales_amt")) end if End If Rslast02.MoveNext Loop End If Rslast02.Close Set Rslast02 = Nothing '***************** jan0 = ljan0-ljan0Sin feb0 = lfeb0-lfeb0Sin mar0 = lmar0-lmar0Sin apr0 = lapr0-lapr0Sin may0 = lmay0-lmay0Sin jun0 = ljun0-ljun0Sin jul0 = ljul0-ljul0Sin aug0 = laug0-laug0Sin sep0 = lsep0-lsep0Sin oct0 = loct0-loct0Sin nov0 = lnov0-lnov0Sin dec0 = ldec0-ldec0Sin ltotyear0Sin=ljan0Sin + lfeb0Sin + lmar0Sin + lapr0Sin + lmay0Sin + ljun0Sin + ljul0Sin + laug0Sin + lsep0Sin + loct0Sin + lnov0Sin + ldec0Sin totyear0 = ljan0 + lfeb0 + lmar0 + lapr0 + lmay0 + ljun0 + ljul0 + laug0 + lsep0 + loct0 + lnov0 + ldec0-(ltotyear0Sin) ltotyear0SAM=ljan0SAM + lfeb0SAM + lmar0SAM + lapr0SAM + lmay0SAM + ljun0SAM + ljul0SAM + laug0SAM + lsep0SAM + loct0SAM + lnov0SAM + ldec0SAM ''''''last year fin '''''''''''''''''''''''''' ********** Fin 2014 end if '************************************** V-Boards Plant 1 kraft31="31"& Chr(34) &" Kraft V-Board" kraft45="45"& Chr(34) &" Kraft V-Board" xxx=year(date_ini)-2 fechainicialvb=(Right("00" & xxx, 4)&"01"&"01" ) lastyear=Right("00" & xxx, 4) actualyear=Right("00" & Year(Date_end), 4) mesactual=Right("00" & month(Date_ini), 2) Dim Rsvboards1 set Rsvboards1=dbsql.execute("select b.sale_cd, (select code_nm from sta010t where major_cd = '9001' and minor_cd = b.sale_cd) sale_nm, a.cust_cd, a.good_date, (select cust_nm from stb010t where cust_cd = a.cust_cd) cust_nm, sum(case a.local_cd when '1' then a.sales_qty else 0 end ) qty1, sum(case a.local_cd when '1' then a.sales_amt else 0 end ) amt1, sum(case a.local_cd when '2' then a.sales_qty else 0 end ) qty2, sum(case a.local_cd when '2' then a.sales_amt else 0 end ) amt2, sum(case a.local_cd when '3' then a.sales_qty else 0 end ) qty3, sum(case a.local_cd when '3' then a.sales_amt else 0 end ) amt3, sum(case a.local_cd when '4' then a.sales_qty else 0 end ) qty4, sum(case a.local_cd when '4' then a.sales_amt else 0 end ) amt4, sum(a.sales_qty) sales_qty, sum(a.sales_amt) sales_amt from sal020t a(nolock), stb010t b(nolock), stb040t c(nolock) where a.cust_cd = b.cust_cd and a.good_cd = c.good_cd and a.crp_id ='10' and a.good_date >='"&fechainicialvb&"' and a.good_date <='"&fechafinal&"' and (a.good_nm=c.good_nm) and (c.proc_cd1='301') group by b.sale_cd, a.cust_cd,a.good_date order by b.sale_cd, a.cust_cd, a.good_date") lqtyvboard1=0 lamtvboard1=0 xlyearoff=right(" "&(lbl_actualyear-2),4) If Rsvboards1.EOF And Rsvboards1.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 2." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else Do While Not Rsvboards1.EOF lano2 = Mid(Rsvboards1("good_date"), 1, 4) lmes2 = Mid(Rsvboards1("good_date"), 5, 2) if lmes2=mesactual AND lano2=actualyear then 'lqtyvboard1 = lqtyvboard1 + cdbl(Rsvboards1("sales_qty")) 'lamtvboard1 = lamtvboard1 + cdbl(Rsvboards1("sales_amt")) end if if lmes2=mesactual AND lano2=lastyear then 'lqtyvboardly1 = lqtyvboardly1 + cdbl(Rsvboards1("sales_qty")) 'lamtvboardly1 = lamtvboardly1 + cdbl(Rsvboards1("sales_amt")) end if if Rsvboards1("good_date")=>fechainicial and Rsvboards1("good_date")=xperiodi and Rsvboards1("good_date")=='"&fechainicialvb&"' and a.good_date <='"&fechafinal&"' and (a.good_nm='BN69-12806A' or a.good_nm='BN69-12807A' or a.good_nm='BN69-00391U' or a.good_nm='BN69-00391Y' or a.good_nm='0330325 (V-BOARDS)' or a.good_nm='V Boards 2x2x96' or a.good_nm='"&kraft31&"' or a.good_nm='"&kraft45&"' or a.good_nm='8 Feets V-Board' or a.good_nm='BN69-05528A V-BOARD' or a.good_nm='BN69-00391E V-BOARD' or a.good_nm='BN69-06769A' or a.good_nm='BN69-12807A') group by b.sale_cd, a.cust_cd,a.good_date order by b.sale_cd, a.cust_cd, a.good_date") lqtyvboard=0 lamtvboard=0 If Rsvboards.EOF And Rsvboards.BOF Then ExisteUsuario = False Msg = "No records exist for this date in Plant 2." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else Do While Not Rsvboards.EOF lano2 = Mid(Rsvboards("good_date"), 1, 4) lmes2 = Mid(Rsvboards("good_date"), 5, 2) if lmes2=mesactual AND lano2=actualyear then 'lqtyvboard = lqtyvboard + cdbl(Rsvboards("sales_qty")) 'lamtvboard = lamtvboard + cdbl(Rsvboards("sales_amt")) end if if lmes2=mesactual AND lano2=lastyear then 'lqtyvboardly = lqtyvboardly + cdbl(Rsvboards("sales_qty")) 'lamtvboardly = lamtvboardly + cdbl(Rsvboards("sales_amt")) end if if Rsvboards("good_date")=>fechainicial and Rsvboards("good_date")=xperiodi and Rsvboards("good_date")=0 and (diastrans-0)>0 then dailyavg2 = (Tot_sales_amt2-lamtvboard) / (diastrans-0) else dailyavg2 = 0 end if if (lamtvboard+lamtvboard1)>0 and (diastrans-0)>0 then dailyavg4 = (lamtvboard+lamtvboard1) / (diastrans-0) else dailyavg4 =0 end if '''''''''''''''''''''''''''**************************** days of Month 'projection2 = (Tot_sales_amt2-lamtvboard) + ( dailyavg2 * (notsamdays-(diastrans-dfestivo1)-xrestandias)) 'projection4 = (lamtvboard+lamtvboard1) + ( dailyavg4 * (notsamdays-(diastrans-dfestivo1)-xrestandias)) 'dailyavg3 = (Tot_sales_amt_sam-lamtvboard1) / (diastrans3-dfestivo1) if diastrans>samsungdays then samsungdays=diastrans end if projection3 = (Tot_sales_amt_sam-lamtvboard1)+(dailyavg3 * (samsungdays-(diastrans3-xrestandias2))) '''''''''''''''''''''''''''*************************** total_2 = dailyavg1 + dailyavg2 + dailyavg3+ dailyavg4 total_3 = projection1 + projection2 + projection3+ projection4 If forecast > 0 Then fulfillment1 = total_3 / forecast end if if bussines > 0 then fulfillment2 = total_3 / bussines End If '************************************ %>
<% if lventas=1 then %> <%if (lqtyvboard>0 and lamtvboard>0) or (lqtyvboard1>0 and lamtvboard1>0) then%> <%else %> <%end if %> <%if (lamtvboardly>0 and lqtyvboardly>0) or (lamtvboardly1>0 and lqtyvboardly1>0) then%> <%else %> <%end if %>
 
Actual Month
 
Period:
<%=period1%> <%=period2%>    
 
<%=lbl_month%>
 
Last Year
  Total Sales Qty: Total Sales Amt: Total M2: By Piece: By M2:   Sales Qty: Sales Amt: M2: By Piece: By M2:
Bookings
<%=formatnumber(qtybook)%>
$<%=formatnumber(amtbook)%>
<%=formatnumber(m2book)%>
$<%=formatnumber(CtoPiece_book,3)%>
$<%=formatnumber(CtoM2_book,3)%>
<%=formatnumber(qtybook2)%>
$<%=formatnumber(amtbook2)%>
<%=formatnumber(m2book2)%>
$<%=formatnumber(CtoPiece_last1)%>
$<%=formatnumber(CtoM2_last1)%>
Plant 1
<%=formatnumber(Tot_sales_qty)%>
$<%=formatnumber(Tot_sales_amt)%>
<%=formatnumber(Tot_sales_m2)%>
$<%=formatnumber(CtoPiece,3)%>
$<%=formatnumber(CtoM2,3)%>
<%=formatnumber(qtyplant1)%>
$<%=formatnumber(amtplant1)%>
<%=formatnumber(m2plant1)%>
$<%=formatnumber(CtoPiece_last2)%>
$<%=formatnumber(CtoM2_last2)%>
Plant 2
<%=formatnumber(Tot_sales_qty2-lqtyvboard)%>
$<%=formatnumber(Tot_sales_amt2-lamtvboard)%>
<%=formatnumber(Tot_sales_m2_2)%>
$<%=formatnumber(CtoPiece2,3)%>
$<%=formatnumber(CtoM2_2,3)%>
<%=formatnumber(qtyplant2)%>
$<%=formatnumber(amtplant2-lamtvboardly)%>
<%=formatnumber(m2plant2)%>
$<%=formatnumber(CtoPiece_last3)%>
$<%=formatnumber(CtoM2_last3)%>
Samsung
<%=formatnumber(Tot_sales_qty_sam-lqtyvboard1)%>
$<%=formatnumber(Tot_sales_amt_sam-lamtvboard1)%>
<%=formatnumber(Tot_sales_m2_sam)%>
$<%=formatnumber(CtoPiece_sam,3)%>
$<%=formatnumber(CtoM2_sam,3)%>
<%=formatnumber(qtysamsung)%>
$<%=formatnumber(amtsamsung-lamtvboardly1)%>
<%=formatnumber(m2samsung)%>
$<%=formatnumber(CtoPiece_last4)%>
$<%=formatnumber(CtoM2_last4)%>
V-Board
<%=formatnumber(lqtyvboard+lqtyvboard1)%>
$<%=formatnumber(lamtvboard+lamtvboard1)%>
$<%=formatnumber((lamtvboard+lamtvboard1)/(lqtyvboard+lqtyvboard1),3)%>
$<%=formatnumber(0,3)%>
$
<%=formatnumber(lqtyvboardly+lqtyvboardly1)%>
$<%=formatnumber(lamtvboardly+lamtvboardly1)%>
$<%=formatnumber((lamtvboardly+lamtvboardly1)/(lqtyvboardly+lqtyvboardly1),3)%>
$<%=formatnumber(0,3)%>
$
Inter Company
<%=formatnumber(qtyinterc)%>
$<%=formatnumber(amtinterc)%>
<%=formatnumber(m2interc)%>
$<%=formatnumber(CtoPiece_inter,3)%>
$<%=formatnumber(CtoM2_inter,3)%>
<%=formatnumber(qtyinterc2)%>
$<%=formatnumber(amtinterc2)%>
<%=formatnumber(m2interc2)%>
$<%=formatnumber(CtoPiece_last5)%>
$<%=formatnumber(CtoM2_last5)%>
Offset > P1
<%=formatnumber(qtyplant2sin)%>
$<%=formatnumber(lamtplant2sin)%>
<%=formatnumber(lm2plant2sin)%>
$
$
<%=formatnumber(qtyinterc2)%>
$<%=formatnumber(amtinterc2)%>
<%=formatnumber(m2interc2)%>
$<%=formatnumber(CtoPiece_last5)%>
$<%=formatnumber(CtoM2_last5)%>
SCRAP
-<%=formatnumber(lscrapqty1)%>
-<%=formatnumber(lscrapamt1)%>
-<%=formatnumber(lscrapmt21)%>
Total:
<%=formatnumber(Tot_sales_qtyAll)%>
$<%=formatnumber(Tot_sales_amtAll)%>
<%=formatnumber(Tot_sales_m2All)%>
$<%=formatnumber(TotPiece1,3)%>
$<%=formatnumber(Totm2_1,3)%>
<%=formatnumber(Totqtylast)%>
$<%=formatnumber(Totamtlast)%>
<%=formatnumber(Totm2last)%>
$<%=formatnumber(Totpiece2)%>
$<%=formatnumber(Totm2_2)%>

  Current Sales: Invoiced Sales: Daily AVG: Projection:
Plant 1
$<%=formatnumber(Tot_sales_amt)%>
$<%=formatnumber(lamtplantInv)%>
$<%=formatnumber(DailyAvg1)%>
$<%=formatnumber(Projection1)%>
Plant 2
$<%=formatnumber(Tot_sales_amt2-lamtvboard)%>
$<%=formatnumber(lamtplantInv2)%>
$<%=formatnumber(DailyAvg2)%>
$<%=formatnumber(Projection2)%>
V-Board
$<%=formatnumber(lamtvboard+lamtvboard1)%>
$<%=formatnumber(Tot_sales_amt_sam)%>
$<%=formatnumber(DailyAvg4)%>
$<%=formatnumber(Projection4)%>
Samsung
$<%=formatnumber(Tot_sales_amt_sam-lamtvboard1)%>
$<%=formatnumber(DailyAvg3)%>
$<%=formatnumber(Projection3)%>
Total
$<%=formatnumber(Tot_sales_amtAll)%>
$<%=formatnumber(Tot_sales_amtAll2)%>
$<%=formatnumber(Total_2)%>
$<%=formatnumber(Total_3)%>
<% If fulfillment1 < 0.8001 Then colorf = "#ff0000" End If If fulfillment1 > 0.8 And fulfillment1 < 0.9001 Then colorf = "#ff9b00" End If If fulfillment1 > 0.9 Then colorf = "#33cc33" End If If fulfillment2 < 0.801 Then colorf2 = "#ff0000" End If If fulfillment2 > 0.8 And fulfillment2 < 0.9001 Then colorf2 = "#ff9b00" End If If fulfillment2 > 0.9 Then colorf2 = "#33cc33" End If %>
Forecast Bussines Plan
$<%=formatnumber(forecast)%>
$<%=formatnumber(Bussines)%>
<%=formatnumber(fulfillment1*100)%> %
<%=formatnumber(fulfillment2*100)%> %

<%if ljan2SAM>0 then %> <% else %> <% end if if lfeb2SAM>0 then %> <% else %> <% end if if lmar2SAM>0 then %> <% else %> <% end if if lapr2SAM>0 then %> <% else %> <% end if if lmay2SAM>0 then %> <% else %> <% end if if ljun2SAM>0 then %> <% else %> <% end if if ljul2SAM>0 then %> <% else %> <% end if if laug2SAM>0 then %> <% else %> <% end if if lsep2SAM>0 then %> <% else %> <% end if if loct2SAM>0 then %> <% else %> <% end if if lnov2SAM>0 then %> <% else %> <% end if if ldec2SAM>0 then %> <% else %> <% end if if ltotyear2SAM>0 then %> <% else %> <% end if %> <%if ljan2SAM>0 then %> <% else %> <% end if if lfeb2SAM>0 then %> <% else %> <% end if if lmar2SAM>0 then %> <% else %> <% end if if lapr2SAM>0 then %> <% else %> <% end if if lmay2SAM>0 then %> <% else %> <% end if if ljun2SAM>0 then %> <% else %> <% end if if ljul2SAM>0 then %> <% else %> <% end if if laug2SAM>0 then %> <% else %> <% end if if lsep2SAM>0 then %> <% else %> <% end if if loct2SAM>0 then %> <% else %> <% end if if lnov2SAM>0 then %> <% else %> <% end if if ldec2SAM>0 then %> <% else %> <% end if if ltotyear2SAM>0 then %> <% else %> <% end if %>
 
<%=lbl_lastyear%> vs <%=lbl_actualyear%>
  January February March April May June July August September October November December Total
<%=lbl_actualyear-2%>
$<%=formatnumber(jan0)%>
$<%=formatnumber(feb0)%>
$<%=formatnumber(mar0)%>
$<%=formatnumber(apr0)%>
$<%=formatnumber(May0)%>
$<%=formatnumber(jun0)%>
$<%=formatnumber(jul0)%>
$<%=formatnumber(aug0)%>
$<%=formatnumber(sep0)%>
$<%=formatnumber(oct0)%>
$<%=formatnumber(nov0)%>
$<%=formatnumber(dec0)%>
$<%=formatnumber(totyear0)%>
SAMSUNG
$<%=formatnumber(ljan0SAM)%>
$<%=formatnumber(lfeb0SAM)%>
$<%=formatnumber(lmar0SAM)%>
$<%=formatnumber(lapr0SAM)%>
$<%=formatnumber(lMay0SAM)%>
$<%=formatnumber(ljun0SAM)%>
$<%=formatnumber(ljul0SAM)%>
$<%=formatnumber(laug0SAM)%>
$<%=formatnumber(lsep0SAM)%>
$<%=formatnumber(loct0SAM)%>
$<%=formatnumber(lnov0SAM)%>
$<%=formatnumber(ldec0SAM)%>
$<%=formatnumber(ltotyear0SAM)%>
Percent
<%=formatnumber((ljan0SAM/jan0)*100,2)%>%
<%=formatnumber((lfeb0SAM/feb0)*100,2)%>%
<%=formatnumber((lmar0SAM/mar0)*100,2)%>%
<%=formatnumber((lapr0SAM/apr0)*100,2)%>%
<%=formatnumber((lmay0SAM/may0)*100,2)%>%
<%=formatnumber((ljun0SAM/jun0)*100,2)%>%
<%=formatnumber((ljul0SAM/jul0)*100,2)%>%
<%=formatnumber((laug0SAM/aug0)*100,2)%>%
<%=formatnumber((lsep0SAM/sep0)*100,2)%>%
<%=formatnumber((loct0SAM/oct0)*100,2)%>%
<%=formatnumber((lnov0SAM/nov0)*100,2)%>%
<%=formatnumber((ldec0SAM/dec0)*100,2)%>%
<%=formatnumber((ltotyear0SAM/totyear0)*100,2)%>%
Total V-Board <%=lbl_actualyear-2%> $<%=formatnumber(VBO3_1+VBS3_1+VB1O3_1+VB1S3_1)%> $<%=formatnumber(VBO3_2+VBS3_2+VB1O3_2+VB1S3_2)%> $<%=formatnumber(VBO3_3+VBS3_3+VB1O3_3+VB1S3_3)%> $<%=formatnumber(VBO3_4+VBS3_4+VB1O3_4+VB1S3_4)%> $<%=formatnumber(VBO3_5+VBS3_5+VB1O3_5+VB1S3_5)%> $<%=formatnumber(VBO3_6+VBS3_6+VB1O3_6+VB1S3_6)%> $<%=formatnumber(VBO3_7+VBS3_7+VB1O3_7+VB1S3_7)%> $<%=formatnumber(VBO3_8+VBS3_8+VB1O3_8+VB1S3_8)%> $<%=formatnumber(VBO3_9+VBS3_9+VB1O3_9+VB1S3_9)%> $<%=formatnumber(VBO3_10+VBS3_10+VB1O3_10+VB1S3_10)%> $<%=formatnumber(VBO3_11+VBS3_11+VB1O3_11+VB1S3_11)%> $<%=formatnumber(VBO3_12+VBS3_12+VB1O3_12+VB1S3_12)%> $<%=formatnumber(VBStotyear3+VBOtotyear3+VB1Stotyear3+VB1Ototyear3)%>
V-Board Percent
<%=formatnumber(((VBO3_1+VBS3_1+VB1O3_1+VB1S3_1)/jan0)*100,2)%>%
<%=formatnumber(((VBO3_2+VBS3_2+VB1O3_2+VB1S3_2)/feb0)*100,2)%>%
<%=formatnumber(((VBO3_3+VBS3_3+VB1O3_3+VB1S3_3)/mar0)*100,2)%>%
<%=formatnumber(((VBO3_4+VBS3_4+VB1O3_4+VB1S3_4)/apr0)*100,2)%>%
<%=formatnumber(((VBO3_5+VBS3_5+VB1O3_5+VB1S3_5)/may0)*100,2)%>%
<%=formatnumber(((VBO3_6+VBS3_6+VB1O3_6+VB1S3_6)/jun0)*100,2)%>%
<%=formatnumber(((VBO3_7+VBS3_7+VB1O3_7+VB1S3_7)/jul0)*100,2)%>%
<%=formatnumber(((VBO3_8+VBS3_8+VB1O3_8+VB1S3_8)/aug0)*100,2)%>%
<%=formatnumber(((VBO3_9+VBS3_9+VB1O3_9+VB1S3_9)/sep0)*100,2)%>%
<%=formatnumber(((VBO3_10+VBS3_10+VB1O3_10+VB1S3_10)/oct0)*100,2)%>%
<%=formatnumber(((VBO3_11+VBS3_11+VB1O3_11+VB1S3_11)/nov0)*100,2)%>%
<%=formatnumber(((VBO3_12+VBS3_12+VB1O3_12+VB1S3_12)/dec0)*100,2)%>%
<%=formatnumber(((VBStotyear3+VBOtotyear3+VB1Stotyear3+VB1Ototyear3)/totyear0)*100,2)%>%
<%=lbl_lastyear%>
$<%=formatnumber(jan1)%>
$<%=formatnumber(feb1)%>
$<%=formatnumber(mar1)%>
$<%=formatnumber(apr1)%>
$<%=formatnumber(May1)%>
$<%=formatnumber(jun1)%>
$<%=formatnumber(jul1)%>
$<%=formatnumber(aug1)%>
$<%=formatnumber(sep1)%>
$<%=formatnumber(oct1)%>
$<%=formatnumber(nov1)%>
$<%=formatnumber(dec1)%>
$<%=formatnumber(totyear1)%>
SAMSUNG
$<%=formatnumber(ljan1SAM)%>
$<%=formatnumber(lfeb1SAM)%>
$<%=formatnumber(lmar1SAM)%>
$<%=formatnumber(lapr1SAM)%>
$<%=formatnumber(lMay1SAM)%>
$<%=formatnumber(ljun1SAM)%>
$<%=formatnumber(ljul1SAM)%>
$<%=formatnumber(laug1SAM)%>
$<%=formatnumber(lsep1SAM)%>
$<%=formatnumber(loct1SAM)%>
$<%=formatnumber(lnov1SAM)%>
$<%=formatnumber(ldec1SAM)%>
$<%=formatnumber(ltotyear1SAM)%>
Percent
<%=formatnumber((ljan1SAM/jan1)*100,2)%>%
<%=formatnumber((lfeb1SAM/feb1)*100,2)%>%
<%=formatnumber((lmar1SAM/mar1)*100,2)%>%
<%=formatnumber((lapr1SAM/apr1)*100,2)%>%
<%=formatnumber((lmay1SAM/may1)*100,2)%>%
<%=formatnumber((ljun1SAM/jun1)*100,2)%>%
<%=formatnumber((ljul1SAM/jul1)*100,2)%>%
<%=formatnumber((laug1SAM/aug1)*100,2)%>%
<%=formatnumber((lsep1SAM/sep1)*100,2)%>%
<%=formatnumber((loct1SAM/oct1)*100,2)%>%
<%=formatnumber((lnov1SAM/nov1)*100,2)%>%
<%=formatnumber((ldec1SAM/dec1)*100,2)%>%
<%=formatnumber((ltotyear1SAM/totyear1)*100,2)%>%
Total V-Board <%=lbl_lastyear%> $<%=formatnumber(VBO1+VBS1+VB1O1+VB1S1)%> $<%=formatnumber(VBO2+VBS2+VB1O2+VB1S2)%> $<%=formatnumber(VBO3+VBS3+VB1O3+VB1S3)%> $<%=formatnumber(VBO4+VBS4+VB1O4+VB1S4)%> $<%=formatnumber(VBO5+VBS5+VB1O5+VB1S5)%> $<%=formatnumber(VBO6+VBS6+VB1O6+VB1S6)%> $<%=formatnumber(VBO7+VBS7+VB1O7+VB1S7)%> $<%=formatnumber(VBO8+VBS8+VB1O8+VB1S8)%> $<%=formatnumber(VBO9+VBS9+VB1O9+VB1S9)%> $<%=formatnumber(VBO10+VBS10+VB1O10+VB1S10)%> $<%=formatnumber(VBO11+VBS11+VB1O11+VB1S11)%> $<%=formatnumber(VBO12+VBS12+VB1O12+VB1S12)%> $<%=formatnumber(VBStotyear1+VBOtotyear1+VB1Stotyear1+VB1Ototyear1)%>
V-Board Percent
<%=formatnumber(((VBO1+VBS1+VB1O1+VB1S1)/jan1)*100,2)%>%
<%=formatnumber(((VBO2+VBS2+VB1O2+VB1S2)/feb1)*100,2)%>%
<%=formatnumber(((VBO3+VBS3+VB1O3+VB1S3)/mar1)*100,2)%>%
<%=formatnumber(((VBO4+VBS4+VB1O4+VB1S4)/apr1)*100,2)%>%
<%=formatnumber(((VBO5+VBS5+VB1O5+VB1S5)/may1)*100,2)%>%
<%=formatnumber(((VBO6+VBS6+VB1O6+VB1S6)/jun1)*100,2)%>%
<%=formatnumber(((VBO7+VBS7+VB1O7+VB1S7)/jul1)*100,2)%>%
<%=formatnumber(((VBO8+VBS8+VB1O8+VB1S8)/aug1)*100,2)%>%
<%=formatnumber(((VBO9+VBS9+VB1O9+VB1S9)/sep1)*100,2)%>%
<%=formatnumber(((VBO10+VBS10+VB1O10+VB1S10)/oct1)*100,2)%>%
<%=formatnumber(((VBO11+VBS11+VB1O11+VB1S11)/nov1)*100,2)%>%
<%=formatnumber(((VBO12+VBS12+VB1O12+VB1S12)/dec1)*100,2)%>%
<%=formatnumber(((VBStotyear1+VBOtotyear1+VB1Stotyear1+VB1Ototyear1)/totyear1)*100,2)%>%
<%=lbl_actualyear%> BP
$4'754 K
$3'956 K
$4'382 K
$5'555 K
$5'344 K
$5'685 K
$5'442 K
$7'398 K
$7'924 K
$8'749 K
$6'086 K
$4'871 K
$70'146 K
<%=lbl_actualyear%> Act
$<%=formatnumber(jan2)%>
$<%=formatnumber(feb2)%>
$<%=formatnumber(mar2)%>
$<%=formatnumber(apr2)%>
$<%=formatnumber(may2)%>
$<%=formatnumber(jun2)%>
$<%=formatnumber(jul2)%>
$<%=formatnumber(aug2)%>
$<%=formatnumber(sep2)%>
$<%=formatnumber(oct2)%>
$<%=formatnumber(nov2)%>
$<%=formatnumber(dec2)%>
$<%=formatnumber(totyear2)%>
<%=lbl_actualyear%> %
<%=formatnumber((jan2/bpjan)*100,1)%>%
<%=formatnumber((feb2/bpfeb)*100,1)%>%
<%=formatnumber((mar2/bpmar)*100,1)%>%
<%=formatnumber((apr2/bpapr)*100,1)%>%
<%=formatnumber((may2/bpmay)*100,1)%>%
<%=formatnumber((jun2/bpjun)*100,1)%>%
<%=formatnumber((jul2/bpjul)*100,1)%>%
<%=formatnumber((aug2/bpaug)*100,1)%>%
<%=formatnumber((sep2/bpsep)*100,1)%>%
<%=formatnumber((oct2/bpoct)*100,1)%>%
<%=formatnumber((nov2/bpnov)*100,1)%>%
<%=formatnumber((dec2/bpdec)*100,1)%>%
<%=formatnumber((totyear2/bptot)*100,1)%>%
SAMSUNG
$<%=formatnumber(ljan2SAM)%>
$<%=formatnumber(lfeb2SAM)%>
$<%=formatnumber(lmar2SAM)%>
$<%=formatnumber(lapr2SAM)%>
$<%=formatnumber(lmay2SAM)%>
$<%=formatnumber(ljun2SAM)%>
$<%=formatnumber(ljul2SAM)%>
$<%=formatnumber(laug2SAM)%>
$<%=formatnumber(lsep2SAM)%>
$<%=formatnumber(loct2SAM)%>
$<%=formatnumber(lnov2SAM)%>
$<%=formatnumber(ldec2SAM)%>
$<%=formatnumber(ltotyear2SAM)%>
Percent
<%=formatnumber((ljan2SAM/jan2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((lfeb2SAM/feb2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((lmar2SAM/mar2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((lapr2SAM/apr2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((lMay2SAM/may2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((ljun2SAM/jun2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((ljul2SAM/jul2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((laug2SAM/aug2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((lsep2SAM/sep2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((loct2SAM/oct2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((lnov2SAM/nov2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((ldec2SAM/dec2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber((ltotyear2SAM/totyear2)*100,2)%>%
<%=formatnumber(0,2)%>%
Total V-Board <%=lbl_actualyear%> $<%=formatnumber(VBO2_1+VBS2_1+(VB1O2_1+VB1S2_1))%> $<%=formatnumber(VBO2_2+VBS2_2+(VB1O2_2+VB1S2_2))%> $<%=formatnumber(VBO2_3+VBS2_3+(VB1O2_3+VB1S2_3))%> $<%=formatnumber(VBO2_4+VBS2_4+(VB1O2_4+VB1S2_4))%> $<%=formatnumber(VBO2_5+VBS2_5+(VB1O2_5+VB1S2_5))%> $<%=formatnumber(VBO2_6+VBS2_6+(VB1O2_6+VB1S2_6))%> $<%=formatnumber(VBO2_7+VBS2_7+(VB1O2_7+VB1S2_7))%> $<%=formatnumber(VBO2_8+VBS2_8+(VB1O2_8+VB1S2_8))%> $<%=formatnumber(VBO2_9+VBS2_9+(VB1O2_9+VB1S2_9))%> $<%=formatnumber(VBO2_10+VBS2_10+(VB1O2_10+VB1S2_10))%> $<%=formatnumber(VBO2_11+VBS2_11+(VB1O2_11+VB1S2_11))%> $<%=formatnumber(VBO2_12+VBS2_12+(VB1O2_12+VB1S2_12))%> $<%=formatnumber(VBStotyear2+VBOtotyear2+(VB1Stotyear2+VB1Ototyear2))%>
V-Board Percent
<%=formatnumber(((VBO2_1+VBS2_1+(VB1O2_1+VB1S2_1))/jan2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber(((VBO2_2+VBS2_2+(VB1O2_2+VB1S2_2))/feb2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber(((VBO2_3+VBS2_3+(VB1O2_3+VB1S2_3))/mar2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber(((VBO2_4+VBS2_4+(VB1O2_4+VB1S2_4))/apr2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber(((VBO2_5+VBS2_5+(VB1O2_5+VB1S2_5))/may2)*100,2)%>%
%
<%=formatnumber(((VBO2_6+VBS2_6+(VB1O2_6+VB1S2_6))/jun2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber(((VBO2_7+VBS2_7+(VB1O2_7+VB1S2_7))/jul2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber(((VBO2_8+VBS2_8+(VB1O2_8+VB1S2_8))/aug2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber(((VBO2_9+VBS2_9+(VB1O2_9+VB1S2_9))/sep2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber(((VBO2_10+VBS2_10+(VB1O2_10+VB1S2_10))/oct2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber(((VBO2_11+VBS2_11+(VB1O2_11+VB1S2_11))/nov2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber(((VBO2_12+VBS2_12+(VB1O2_12+VB1S2_12))/dec2)*100,2)%>%
<%=formatnumber(0,2)%>%
<%=formatnumber(((VBStotyear2+VBOtotyear2+(VB1Stotyear2+VB1Ototyear2))/totyear2)*100,2)%>%
<%=formatnumber(0,2)%>%
<% end if %>

<% %> <% %> <% %> <% %>
 
V_BOARD <%=lbl_lastyear-1%> vs <%=lbl_actualyear%>
  January February March April May June July August September October November December Total
V-Board Samsung <%=lbl_lastyear-1%>
$<%=formatnumber(VBS3_1+VB1S3_1)%>
$<%=formatnumber(VBS3_2+VB1S3_2)%>
$<%=formatnumber(VBS3_3+VB1S3_3)%>
$<%=formatnumber(VBS3_4+VB1S3_4)%>
$<%=formatnumber(VBS3_5+VB1S3_5)%>
$<%=formatnumber(VBS3_6+VB1S3_6)%>
$<%=formatnumber(VBS3_7+VB1S3_7)%>
$<%=formatnumber(VBS3_8+VB1S3_8)%>
$<%=formatnumber(VBS3_9+VB1S3_9)%>
$<%=formatnumber(VBS3_10+VB1S3_10)%>
$<%=formatnumber(VBS3_11+VB1S3_11)%>
$<%=formatnumber(VBS3_12+VB1S3_12)%>
$<%=formatnumber(VBStotyear3+VB1Stotyear3)%>
V-Board Others <%=lbl_lastyear-1%>
$<%=formatnumber(VBO3_1+VB1O3_1)%>
$<%=formatnumber(VBO3_2+VB1O3_2)%>
$<%=formatnumber(VBO3_3+VB1O3_3)%>
$<%=formatnumber(VBO3_4+VB1O3_4)%>
$<%=formatnumber(VBO3_5+VB1O3_5)%>
$<%=formatnumber(VBO3_6+VB1O3_6)%>
$<%=formatnumber(VBO3_7+VB1O3_7)%>
$<%=formatnumber(VBO3_8+VB1O3_8)%>
$<%=formatnumber(VBO3_9+VB1O3_9)%>
$<%=formatnumber(VBO3_10+VB1O3_10)%>
$<%=formatnumber(VBO3_11+VB1O3_11)%>
$<%=formatnumber(VBO3_12+VB1O3_12)%>
$<%=formatnumber(VBOtotyear3+VB1Ototyear3)%>
Total V-Board <%=lbl_lastyear-1%> $<%=formatnumber(VBS3_1+VB1S3_1+(VBO3_1+VB1O3_1))%> $<%=formatnumber(VBS3_2+VB1S3_2+(VBO3_2+VB1O3_2))%> $<%=formatnumber(VBS3_3+VB1S3_3+(VBO3_3+VB1O3_3))%> $<%=formatnumber(VBS3_4+VB1S3_4+(VBO3_4+VB1O3_4))%> $<%=formatnumber(VBS3_5+VB1S3_5+(VBO3_5+VB1O3_5))%> $<%=formatnumber(VBS3_6+VB1S3_6+(VBO3_6+VB1O3_6))%> $<%=formatnumber(VBS3_7+VB1S3_7+(VBO3_7+VB1O3_7))%> $<%=formatnumber(VBS3_8+VB1S3_8+(VBO3_8+VB1O3_8))%> $<%=formatnumber(VBS3_9+VB1S3_9+(VBO3_9+VB1O3_9))%> $<%=formatnumber(VBS3_10+VB1S3_10+(VBO3_10+VB1O3_10))%> $<%=formatnumber(VBS3_11+VB1S3_11+(VBO3_11+VB1O3_11))%> $<%=formatnumber(VBS3_12+VB1S3_12+(VBO3_12+VB1O3_12))%> $<%=formatnumber(VBStotyear3+VBOtotyear3+(VB1Stotyear3+VB1Ototyear3))%>
V-Board Samsung <%=lbl_lastyear%>
$<%=formatnumber(VBS1+VB1S1)%>
$<%=formatnumber(VBS2+VB1S2)%>
$<%=formatnumber(VBS3+VB1S3)%>
$<%=formatnumber(VBS4+VB1S4)%>
$<%=formatnumber(VBS5+VB1S5)%>
$<%=formatnumber(VBS6+VB1S6)%>
$<%=formatnumber(VBS7+VB1S7)%>
$<%=formatnumber(VBS8+VB1S8)%>
$<%=formatnumber(VBS9+VB1S9)%>
$<%=formatnumber(VBS10+VB1S10)%>
$<%=formatnumber(VBS11+VB1S11)%>
$<%=formatnumber(VBS12+VB1S12)%>
$<%=formatnumber(VBStotyear1+VB1Stotyear1)%>
V-Board Others <%=lbl_lastyear%>
$<%=formatnumber(VBO1+VB1O1)%>
$<%=formatnumber(VBO2+VB1O2)%>
$<%=formatnumber(VBO3+VB1O3)%>
$<%=formatnumber(VBo4+VB1O4)%>
$<%=formatnumber(VBO5+VB1O5)%>
$<%=formatnumber(VBO6+VB1O6)%>
$<%=formatnumber(VBO7+VB1O7)%>
$<%=formatnumber(VBO8+VB1O8)%>
$<%=formatnumber(VBO9+VB1O9)%>
$<%=formatnumber(VBO10+VB1O10)%>
$<%=formatnumber(VBO11+VB1O11)%>
$<%=formatnumber(VBO12+VB1O12)%>
$<%=formatnumber(VBOtotyear1+VB1Ototyear1)%>
Total V-Board <%=lbl_lastyear%> $<%=formatnumber(VBO1+VBS1+(VB1O1+VB1S1))%> $<%=formatnumber(VBO2+VBS2+(VB1O2+VB1S2))%> $<%=formatnumber(VBO3+VBS3+(VB1O3+VB1S3))%> $<%=formatnumber(VBO4+VBS4+(VB1O4+VB1S4))%> $<%=formatnumber(VBO5+VBS5+(VB1O5+VB1S5))%> $<%=formatnumber(VBO6+VBS6+(VB1O6+VB1S6))%> $<%=formatnumber(VBO7+VBS7+(VB1O7+VB1S7))%> $<%=formatnumber(VBO8+VBS8+(VB1O8+VB1S8))%> $<%=formatnumber(VBO9+VBS9+(VB1O9+VB1S9))%> $<%=formatnumber(VBO10+VBS10+(VB1O10+VB1S10))%> $<%=formatnumber(VBO11+VBS11+(VB1O11+VB1S11))%> $<%=formatnumber(VBO12+VBS12+(VB1O12+VB1S12))%> $<%=formatnumber(VBStotyear1+VBOtotyear1+(VB1Stotyear1+VB1Ototyear1))%>
V-Board Samsung <%=lbl_actualyear%>
$<%=formatnumber(VBS2_1+VB1S2_1)%>
$<%=formatnumber(VBS2_2+VB1S2_2)%>
$<%=formatnumber(VBS2_3+VB1S2_3)%>
$<%=formatnumber(VBS2_4+VB1S2_4)%>
$<%=formatnumber(VBS2_5+VB1S2_5)%>
$<%=formatnumber(VBS2_6+VB1S2_6)%>
$<%=formatnumber(VBS2_7+VB1S2_7)%>
$<%=formatnumber(VBS2_8+VB1S2_8)%>
$<%=formatnumber(VBS2_9+VB1S2_9)%>
$<%=formatnumber(VBS2_10+VB1S2_10)%>
$<%=formatnumber(VBS2_11+VB1S2_11)%>
$<%=formatnumber(VBS2_12+VB1S2_12)%>
$<%=formatnumber(VBStotyear2+VB1Stotyear2)%>
V-Board Others <%=lbl_actualyear%>
$<%=formatnumber(VBO2_1+VB1O2_1)%>
$<%=formatnumber(VBO2_2+VB1O2_2)%>
$<%=formatnumber(VBO2_3+VB1O2_3)%>
$<%=formatnumber(VBO2_4+VB1O2_4)%>
$<%=formatnumber(VBO2_5+VB1O2_5)%>
$<%=formatnumber(VBO2_6+VB1O2_6)%>
$<%=formatnumber(VBO2_7+VB1O2_7)%>
$<%=formatnumber(VBO2_8+VB1O2_8)%>
$<%=formatnumber(VBO2_9+VB1O2_9)%>
$<%=formatnumber(VBO2_10+VB1O2_10)%>
$<%=formatnumber(VBO2_11+VB1O2_11)%>
$<%=formatnumber(VBO2_12+VB1O2_12)%>
$<%=formatnumber(VBOtotyear2+VB1Ototyear2)%>
Total V-Board <%=lbl_actualyear%> $<%=formatnumber(VBO2_1+VBS2_1+(VB1O2_1+VB1S2_1))%> $<%=formatnumber(VBO2_2+VBS2_2+(VB1O2_2+VB1S2_2))%> $<%=formatnumber(VBO2_3+VBS2_3+(VB1O2_3+VB1S2_3))%> $<%=formatnumber(VBO2_4+VBS2_4+(VB1O2_4+VB1S2_4))%> $<%=formatnumber(VBO2_5+VBS2_5+(VB1O2_5+VB1S2_5))%> $<%=formatnumber(VBO2_6+VBS2_6+(VB1O2_6+VB1S2_6))%> $<%=formatnumber(VBO2_7+VBS2_7+(VB1O2_7+VB1S2_7))%> $<%=formatnumber(VBO2_8+VBS2_8+(VB1O2_8+VB1S2_8))%> $<%=formatnumber(VBO2_9+VBS2_9+(VB1O2_9+VB1S2_9))%> $<%=formatnumber(VBO2_10+VBS2_10+(VB1O2_10+VB1S2_10))%> $<%=formatnumber(VBO2_11+VBS2_11+(VB1O2_11+VB1S2_11))%> $<%=formatnumber(VBO2_12+VBS2_12+(VB1O2_12+VB1S2_12))%> $<%=formatnumber(VBStotyear2+VBOtotyear2+(VB1Stotyear2+VB1Ototyear2))%>

<% '********************************************************** 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, (select item_class from stb040t(nolock) where cust_cd=b.cust_cd and good_nm = b.item) as prodclass,(select proc_cd1 from stb040t(nolock) where cust_cd=b.cust_cd and good_nm = b.item) as machine1, max(b.price) as price, max(b.lastmov) as lastmov,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, sum(a.in_qty4) - sum(a.out_qty4) as inv_qty4,round(max(b.price) * (sum(a.in_qty4) - sum(a.out_qty4)),3) as inv_amt4 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,sum(isnull(a.in_qty4,0)) in_qty4, sum(isnull(a.out_qty4,0)) out_qty4 from (select cust_cd, item, sum(qty) in_qty1 , 0 out_qty1, 0 in_qty2 ,0 out_qty2, 0 in_qty3 , 0 out_qty3, 0 in_qty4 , 0 out_qty4 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, 0 in_qty4 , 0 out_qty4 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, 0 in_qty4 , 0 out_qty4 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, 0 in_qty4 , 0 out_qty4 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, 0 in_qty4 , 0 out_qty4 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, 0 in_qty4 , 0 out_qty4 from inout_table where class = '2' 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,0 out_qty3, sum(qty) in_qty4 , 0 out_qty4 from inout_table where class = '1' and crp_id = '10' and local_cd = '4' 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 , 0 out_qty3, 0 in_qty4 , sum(qty) out_qty4 from inout_table where class = '2' and crp_id = '10' and local_cd = '4' group by cust_cd, item) a group by a.cust_cd, a.item) a, (select crp_id, cust_cd, item, max(price) price, max(prod_date) lastmov 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 or a.in_qty4 - a.out_qty4 <> 0) group by b.crp_id, b.cust_cd, b.item order by b.crp_id, b.cust_cd, b.item") lspace=" " apostrofe="'" 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 lOBSamsung2WH4 = 0 lOTSamsungWH4 = 0 lSamsungObsOB1 = 0 lSamsungObsOT1 = 0 lSamsungObsOB1WH3 = 0 lSamsungObsOT1WH3 = 0 lSamsungObsOB1WH4 = 0 lSamsungObsOT1WH4 = 0 lOthers1 = 0 lOthers2 = 0 lOthers11 = 0 lOthers12 = 0 lOthers13 = 0 lOthers14 = 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 lcode1="BN69-12806A" lcode2="BN69-12807A" lcode3="BN69-00391U" lcode4="BN69-00391Y" lcode5="0330325 (V-BOARDS)" lcode10="BN69-05528A V-BOARD" lcode11="BN69-00391E V-BOARD" lcode12="BN69-06769A" lcode13="BN69-17053D" lcode14="BN69-17053J" lcode15="BN69-17053Q" lcode16="BN69-17053A" lcode17="BN69-17053E" lcode18="100033183" lcode19="100033185" lcode20="100033186" lcode21="100033201" lcode22="100033206" lcode23="100033211" lcode24="VBOARD 2 X 2 X 36" lcode25="BN69-17053S" lcode1qty=0 lcode1amt=0 lcode2qty=0 lcode2amt=0 lcode3qty=0 lcode3amt=0 lcode4qty=0 lcode4amt=0 lcode5qty=0 lcode5amt=0 lcode10qty=0 lcode10amt=0 lcode11qty=0 lcode11amt=0 lcode12qty=0 lcode12amt=0 lcode13qty=0 lcode13amt=0 lcode14qty=0 lcode14amt=0 lcode15qty=0 lcode15amt=0 lcode16qty=0 lcode16amt=0 lcode17qty=0 lcode17amt=0 lcode18qty=0 lcode18amt=0 lcode19qty=0 lcode19amt=0 lcode20qty=0 lcode20amt=0 lcode21qty=0 lcode21amt=0 lcode22qty=0 lcode22amt=0 lcode23qty=0 lcode23amt=0 lcode24qty=0 lcode24amt=0 lcode25qty=0 lcode25amt=0 totalvbqty3=0 totalvbqty4=0 totalvbamt3=0 totalvbamt4=0 Rsinven1.MoveFirst %>

V-Board Inventory <% 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"))+ cdbl(Rsinven1("inv_qty4")) lamtinven = lamtinven + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3"))+ cdbl(Rsinven1("inv_amt4")) lSubqty = cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3"))+ cdbl(Rsinven1("inv_qty4")) lSubAmt = cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3"))+ cdbl(Rsinven1("inv_amt4")) lspace=" " 'apostrofe="'" if InStr(Rsinven1("item"),"'") then set Rsinven3=dbsql.execute("select sht_size1,sht_size2,poksu,julsu,hapsu from stb040t where cust_cd='" & Rsinven1("cust_cd") & "' and replace(good_nm,char(39),'" & lspace & "')='" & replace(Rsinven1("item"),apostrofe,lspace) & "'") else set Rsinven3=dbsql.execute("select sht_size1,sht_size2,poksu,julsu,hapsu from stb040t where cust_cd='" & Rsinven1("cust_cd") & "' and good_nm='" & Rsinven1("item") & "'") end if if not rsinven3.eof then if isnumeric(Rsinven3("sht_size1")) and isnumeric(Rsinven3("sht_size2")) and isnumeric(Rsinven3("poksu")) and isnumeric(Rsinven3("julsu")) and isnumeric(Rsinven3("hapsu")) then localm2=((cdbl(Rsinven3("sht_size1")) * cdbl(Rsinven3("sht_size2")) / 1000000) / cdbl(Rsinven3("poksu")) / cdbl(Rsinven3("julsu")) * cdbl(Rsinven3("hapsu")) * lSubqty) else localm2=0 end if end if lm2inven = lm2inven + cdbl(localm2) lboxx=0 if Rsinven1("cust_cd")="20001" then 'CTE if Rsinven1("item") =lcode1 then lcode1qty = lcode1qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode1amt = lcode1amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode1qty4 = lcode1qty4 + cdbl(Rsinven1("inv_qty4")) lcode1amt4 = lcode1amt4 + cdbl(Rsinven1("inv_amt4")) lcode1qty1 = lcode1qty1 + cdbl(Rsinven1("inv_qty1")) lcode1amt1 = lcode1amt1 + cdbl(Rsinven1("inv_amt1")) lcode1qty2 = lcode1qty2 + cdbl(Rsinven1("inv_qty2")) lcode1amt2 = lcode1amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item") =lcode2 then lcode2qty = lcode2qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode2amt = lcode2amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode2qty4 = lcode2qty4 + cdbl(Rsinven1("inv_qty4")) lcode2amt4 = lcode2amt4 + cdbl(Rsinven1("inv_amt4")) lcode2qty1 = lcode2qty1 + cdbl(Rsinven1("inv_qty1")) lcode2amt1 = lcode2amt1 + cdbl(Rsinven1("inv_amt1")) lcode2qty2 = lcode2qty2 + cdbl(Rsinven1("inv_qty2")) lcode2amt2 = lcode2amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode3 then lcode3qty = lcode3qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode3amt = lcode3amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode3qty4 = lcode3qty4 + cdbl(Rsinven1("inv_qty4")) lcode3amt4 = lcode3amt4 + cdbl(Rsinven1("inv_amt4")) lcode3qty1 = lcode3qty1 + cdbl(Rsinven1("inv_qty1")) lcode3amt1 = lcode3amt1 + cdbl(Rsinven1("inv_amt1")) lcode3qty2 = lcode3qty2 + cdbl(Rsinven1("inv_qty2")) lcode3amt2 = lcode3amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode4 then lcode4qty = lcode4qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode4amt = lcode4amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode4qty4 = lcode4qty4 + cdbl(Rsinven1("inv_qty4")) lcode4amt4 = lcode4amt4 + cdbl(Rsinven1("inv_amt4")) lcode4qty1 = lcode4qty1 + cdbl(Rsinven1("inv_qty1")) lcode4amt1 = lcode4amt1 + cdbl(Rsinven1("inv_amt1")) lcode4qty2 = lcode4qty2 + cdbl(Rsinven1("inv_qty2")) lcode4amt2 = lcode4amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode5 then lcode5qty = lcode5qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode5amt = lcode5amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode5qty4 = lcode5qty4 + cdbl(Rsinven1("inv_qty4")) lcode5amt4 = lcode5amt4 + cdbl(Rsinven1("inv_amt4")) lcode5qty1 = lcode5qty1 + cdbl(Rsinven1("inv_qty1")) lcode5amt1 = lcode5amt1 + cdbl(Rsinven1("inv_amt1")) lcode5qty2 = lcode5qty2 + cdbl(Rsinven1("inv_qty2")) lcode5amt2 = lcode5amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode10 then lcode10qty = lcode10qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode10amt = lcode10amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode10qty4 = lcode10qty4 + cdbl(Rsinven1("inv_qty4")) lcode10amt4 = lcode10amt4 + cdbl(Rsinven1("inv_amt4")) lcode10qty1 = lcode10qty1 + cdbl(Rsinven1("inv_qty1")) lcode10amt1 = lcode10amt1 + cdbl(Rsinven1("inv_amt1")) lcode10qty2 = lcode10qty2 + cdbl(Rsinven1("inv_qty2")) lcode10amt2 = lcode10amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode11 then lcode11qty = lcode11qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode11amt = lcode11amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode11qty4 = lcode11qty4 + cdbl(Rsinven1("inv_qty4")) lcode11amt4 = lcode11amt4 + cdbl(Rsinven1("inv_amt4")) lcode11qty1 = lcode11qty1 + cdbl(Rsinven1("inv_qty1")) lcode11amt1 = lcode11amt1 + cdbl(Rsinven1("inv_amt1")) lcode11qty2 = lcode11qty2 + cdbl(Rsinven1("inv_qty2")) lcode11amt2 = lcode11amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode12 then lcode12qty = lcode12qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode12amt = lcode12amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode12qty4 = lcode12qty4 + cdbl(Rsinven1("inv_qty4")) lcode12amt4 = lcode12amt4 + cdbl(Rsinven1("inv_amt4")) lcode12qty1 = lcode12qty1 + cdbl(Rsinven1("inv_qty1")) lcode12amt1 = lcode12amt1 + cdbl(Rsinven1("inv_amt1")) lcode12qty2 = lcode12qty2 + cdbl(Rsinven1("inv_qty2")) lcode12amt2 = lcode12amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode13 then lcode13qty = lcode13qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode13amt = lcode13amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode13qty4 = lcode13qty4 + cdbl(Rsinven1("inv_qty4")) lcode13amt4 = lcode13amt4 + cdbl(Rsinven1("inv_amt4")) lcode13qty1 = lcode13qty1 + cdbl(Rsinven1("inv_qty1")) lcode13amt1 = lcode13amt1 + cdbl(Rsinven1("inv_amt1")) lcode13qty2 = lcode13qty2 + cdbl(Rsinven1("inv_qty2")) lcode13amt2 = lcode13amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode14 then lcode14qty = lcode14qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode14amt = lcode14amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode14qty4 = lcode14qty4 + cdbl(Rsinven1("inv_qty4")) lcode14amt4 = lcode14amt4 + cdbl(Rsinven1("inv_amt4")) lcode14qty1 = lcode14qty1 + cdbl(Rsinven1("inv_qty1")) lcode14amt1 = lcode14amt1 + cdbl(Rsinven1("inv_amt1")) lcode14qty2 = lcode14qty2 + cdbl(Rsinven1("inv_qty2")) lcode14amt2 = lcode14amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode15 then lcode15qty = lcode15qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode15amt = lcode15amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode15qty4 = lcode15qty4 + cdbl(Rsinven1("inv_qty4")) lcode15amt4 = lcode15amt4 + cdbl(Rsinven1("inv_amt4")) lcode15qty1 = lcode15qty1 + cdbl(Rsinven1("inv_qty1")) lcode15amt1 = lcode15amt1 + cdbl(Rsinven1("inv_amt1")) lcode15qty2 = lcode15qty2 + cdbl(Rsinven1("inv_qty2")) lcode15amt2 = lcode15amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode16 then lcode16qty = lcode16qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode16amt = lcode16amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode16qty4 = lcode16qty4 + cdbl(Rsinven1("inv_qty4")) lcode16amt4 = lcode16amt4 + cdbl(Rsinven1("inv_amt4")) lcode16qty1 = lcode16qty1 + cdbl(Rsinven1("inv_qty1")) lcode16amt1 = lcode16amt1 + cdbl(Rsinven1("inv_amt1")) lcode16qty2 = lcode16qty2 + cdbl(Rsinven1("inv_qty2")) lcode16amt2 = lcode16amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode17 then lcode17qty = lcode17qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode17amt = lcode17amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode17qty4 = lcode17qty4 + cdbl(Rsinven1("inv_qty4")) lcode17amt4 = lcode17amt4 + cdbl(Rsinven1("inv_amt4")) lcode17qty1 = lcode17qty1 + cdbl(Rsinven1("inv_qty1")) lcode17amt1 = lcode17amt1 + cdbl(Rsinven1("inv_amt1")) lcode17qty2 = lcode17qty2 + cdbl(Rsinven1("inv_qty2")) lcode17amt2 = lcode17amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode18 then lcode18qty = lcode18qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode18amt = lcode18amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode18qty4 = lcode18qty4 + cdbl(Rsinven1("inv_qty4")) lcode18amt4 = lcode18amt4 + cdbl(Rsinven1("inv_amt4")) lcode18qty1 = lcode18qty1 + cdbl(Rsinven1("inv_qty1")) lcode18amt1 = lcode18amt1 + cdbl(Rsinven1("inv_amt1")) lcode18qty2 = lcode18qty2 + cdbl(Rsinven1("inv_qty2")) lcode18amt2 = lcode18amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode19 then lcode19qty = lcode19qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode19amt = lcode19amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode19qty4 = lcode19qty4 + cdbl(Rsinven1("inv_qty4")) lcode19amt4 = lcode19amt4 + cdbl(Rsinven1("inv_amt4")) lcode19qty1 = lcode19qty1 + cdbl(Rsinven1("inv_qty1")) lcode19amt1 = lcode19amt1 + cdbl(Rsinven1("inv_amt1")) lcode19qty2 = lcode19qty2 + cdbl(Rsinven1("inv_qty2")) lcode19amt2 = lcode19amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode20 then lcode20qty = lcode20qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode20amt = lcode20amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode20qty4 = lcode20qty4 + cdbl(Rsinven1("inv_qty4")) lcode20amt4 = lcode20amt4 + cdbl(Rsinven1("inv_amt4")) lcode20qty1 = lcode20qty1 + cdbl(Rsinven1("inv_qty1")) lcode20amt1 = lcode20amt1 + cdbl(Rsinven1("inv_amt1")) lcode20qty2 = lcode20qty2 + cdbl(Rsinven1("inv_qty2")) lcode20amt2 = lcode20amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode21 then lcode21qty = lcode21qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode21amt = lcode21amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode21qty4 = lcode21qty4 + cdbl(Rsinven1("inv_qty4")) lcode21amt4 = lcode21amt4 + cdbl(Rsinven1("inv_amt4")) lcode21qty1 = lcode21qty1 + cdbl(Rsinven1("inv_qty1")) lcode21amt1 = lcode21amt1 + cdbl(Rsinven1("inv_amt1")) lcode21qty2 = lcode21qty2 + cdbl(Rsinven1("inv_qty2")) lcode21amt2 = lcode21amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode22 then lcode22qty = lcode22qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode22amt = lcode22amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode22qty4 = lcode22qty4 + cdbl(Rsinven1("inv_qty4")) lcode22amt4 = lcode22amt4 + cdbl(Rsinven1("inv_amt4")) lcode22qty1 = lcode22qty1 + cdbl(Rsinven1("inv_qty1")) lcode22amt1 = lcode22amt1 + cdbl(Rsinven1("inv_amt1")) lcode22qty2 = lcode22qty2 + cdbl(Rsinven1("inv_qty2")) lcode22amt2 = lcode22amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode23 then lcode23qty = lcode23qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode23amt = lcode23amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode23qty4 = lcode23qty4 + cdbl(Rsinven1("inv_qty4")) lcode23amt4 = lcode23amt4 + cdbl(Rsinven1("inv_amt4")) lcode23qty1 = lcode23qty1 + cdbl(Rsinven1("inv_qty1")) lcode23amt1 = lcode23amt1 + cdbl(Rsinven1("inv_amt1")) lcode23qty2 = lcode23qty2 + cdbl(Rsinven1("inv_qty2")) lcode23amt2 = lcode23amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode24 then lcode24qty = lcode24qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode24amt = lcode24amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode24qty4 = lcode24qty4 + cdbl(Rsinven1("inv_qty4")) lcode24amt4 = lcode24amt4 + cdbl(Rsinven1("inv_amt4")) lcode24qty1 = lcode24qty1 + cdbl(Rsinven1("inv_qty1")) lcode24amt1 = lcode24amt1 + cdbl(Rsinven1("inv_amt1")) lcode24qty2 = lcode24qty2 + cdbl(Rsinven1("inv_qty2")) lcode24amt2 = lcode24amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if if Rsinven1("item")=lcode25 then lcode25qty = lcode25qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode25amt = lcode25amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode25qty4 = lcode25qty4 + cdbl(Rsinven1("inv_qty4")) lcode25amt4 = lcode25amt4 + cdbl(Rsinven1("inv_amt4")) lcode25qty1 = lcode25qty1 + cdbl(Rsinven1("inv_qty1")) lcode25amt1 = lcode25amt1 + cdbl(Rsinven1("inv_amt1")) lcode25qty2 = lcode25qty2 + cdbl(Rsinven1("inv_qty2")) lcode25amt2 = lcode25amt2 + cdbl(Rsinven1("inv_amt2")) lboxx=1 end if 'if Rsinven1("prodclass")="03" then if Rsinven1("machine1")="301" then lcode35qty = lcode35qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) lcode35amt = lcode35amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) lcode35qty4 = lcode35qty4 + cdbl(Rsinven1("inv_qty4")) lcode35amt4 = lcode35amt4 + cdbl(Rsinven1("inv_amt4")) lcode35qty1 = lcode35qty1 + cdbl(Rsinven1("inv_qty1")) lcode35amt1 = lcode35amt1 + cdbl(Rsinven1("inv_amt1")) lcode35qty2 = lcode35qty2 + cdbl(Rsinven1("inv_qty2")) lcode35amt2 = lcode35amt2 + cdbl(Rsinven1("inv_amt2")) lcode35qty3 = lcode35qty3 + cdbl(Rsinven1("inv_qty3")) lcode35amt3 = lcode35amt3 + cdbl(Rsinven1("inv_amt3")) end if 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"))+ cdbl(Rsinven1("inv_qty4")) lTotalQtyInvD = lTotalQtyInvD + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3"))+ cdbl(Rsinven1("inv_qty4")) lOTSamsungWH3 = lOTSamsungWH3 + cdbl(Rsinven1("inv_qty3")) lOTSamsungWH4 = lOTSamsungWH4 + cdbl(Rsinven1("inv_qty4")) lOTSamsungWH1 = lOTSamsungWH1 + cdbl(Rsinven1("inv_qty1")) lOTSamsungWH2 = lOTSamsungWH2 + cdbl(Rsinven1("inv_qty2")) lTotalM2InvD = lTotalM2InvD + localm2 lTotalDllInvD =lTotalDllInvD + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3"))+ cdbl(Rsinven1("inv_amt4")) 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" OR rsinven2("Note_4")= "FULL LITHO" or rsinven2("Note_4")= "PRINTING" or rsinven2("Note_4")= "SPOT" 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"))+ cdbl(Rsinven1("inv_qty4")) lSamsungObsOB1WH3 = lSamsungObsOB1WH3 + cdbl(Rsinven1("inv_qty3")) lSamsungObsOB1WH4 = lSamsungObsOB1WH4 + cdbl(Rsinven1("inv_qty4")) lSamsungObsOB1WH1 = lSamsungObsOB1WH1 + cdbl(Rsinven1("inv_qty1")) '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"))+ cdbl(Rsinven1("inv_qty4")) IF lboxx=0 then lSamsungObsOT1WH3 = lSamsungObsOT1WH3 + cdbl(Rsinven1("inv_qty3")) lSamsungObsOT1WH2 = lSamsungObsOT1WH2 + cdbl(Rsinven1("inv_qty2")) lSamsungObsOT1WH4 = lSamsungObsOT1WH4 + cdbl(Rsinven1("inv_qty4")) lSamsungObsOT1WH1 = lSamsungObsOT1WH1 + cdbl(Rsinven1("inv_qty1")) end if 'lTotalM2Inv1 = lTotalM2Inv1 + localm2 'lTotalDllInv1 =lTotalDllInv1 + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3")) end if else 'NA ' response.write("cod "&Rsinven1("item")) lOBSamsung2 = lOBSamsung2 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3"))+ cdbl(Rsinven1("inv_qty4")) lOBSamsung2WH3 = lOBSamsung2WH3 + cdbl(Rsinven1("inv_qty3")) lOBSamsung2WH4 = lOBSamsung2WH4 + cdbl(Rsinven1("inv_qty4")) lOBSamsung2WH1 = lOBSamsung2WH1 + cdbl(Rsinven1("inv_qty1")) lTotalQtyInvD = lTotalQtyInvD + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3"))+ cdbl(Rsinven1("inv_qty4")) lTotalM2InvD = lTotalM2InvD + localm2 lTotalDllInvD =lTotalDllInvD + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3"))+ cdbl(Rsinven1("inv_amt4")) end if 'NA end if 'PAD else lOTSamsung = lOTSamsung + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) + cdbl(Rsinven1("inv_qty4")) lOTSamsungWH3 = lOTSamsungWH3 + cdbl(Rsinven1("inv_qty3")) lOTSamsungWH4 = lOTSamsungWH4 + cdbl(Rsinven1("inv_qty4")) lOTSamsungWH1 = lOTSamsungWH1 + cdbl(Rsinven1("inv_qty1")) end if 'RS lTotalQtyInv1 = lTotalQtyInv1 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3")) + cdbl(Rsinven1("inv_qty4")) lTotalM2Inv1 = lTotalM2Inv1 + localm2 lTotalDllInv1 =lTotalDllInv1 + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3"))+ cdbl(Rsinven1("inv_amt4")) Rsinven2.Close Set Rsinven2 = Nothing else lspace=" " if instr(Rsinven1("item"),"'") then set Rsother=cnn.execute("select * from Items where good_nm='" & replace(Rsinven1("item"),apostrofe,lspace) & "'") else set Rsother=cnn.execute("select * from Items where good_nm='" & Rsinven1("item") & "'") end if 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") )+ cdbl(Rsinven1("inv_qty4")) lOther1Obs1 = lOther1Obs1 + cdbl(Rsinven1("inv_qty1")) lOther2Obs1 = lOther2Obs1 + cdbl(Rsinven1("inv_qty2")) lOther3Obs1 = lOther3Obs1 + cdbl(Rsinven1("inv_qty3")) lOther4Obs1 = lOther4Obs1 + cdbl(Rsinven1("inv_qty4")) lOtherObsM2 = lOtherObsM2 + localm2 lOtherObsDll =lOtherObsDll + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3"))+ cdbl(Rsinven1("inv_amt4")) end if ELSE end if lOthers1 = lOthers1 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3"))+ cdbl(Rsinven1("inv_qty4")) lOthers11 = lOthers11 + cdbl(Rsinven1("inv_qty1")) lOthers12 = lOthers12 + cdbl(Rsinven1("inv_qty2")) lOthers13 = lOthers13 + cdbl(Rsinven1("inv_qty3")) lOthers14 = lOthers14 + cdbl(Rsinven1("inv_qty4")) 'lOthers2 = 0 lTotalQtyInv2 = lTotalQtyInv2 + cdbl(Rsinven1("inv_qty1")) + cdbl(Rsinven1("inv_qty2")) + cdbl(Rsinven1("inv_qty3"))+ cdbl(Rsinven1("inv_qty4")) lTotalM2Inv2 = lTotalM2Inv2 + localm2 lTotalDllInv2 =lTotalDllInv2 + cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3"))+ cdbl(Rsinven1("inv_amt4")) end if 'if Rsinven1("item")=lcode1 or Rsinven1("item")=lcode2 or Rsinven1("item")=lcode3 or Rsinven1("item")=lcode4 or Rsinven1("item")=lcode5 or Rsinven1("item")=lcode10 or Rsinven1("item")=lcode11 or Rsinven1("item")=lcode12 or Rsinven1("item")=lcode13 or Rsinven1("item")=lcode14 or Rsinven1("item")=lcode15 or Rsinven1("item")=lcode16 or Rsinven1("item")=lcode17 or Rsinven1("item")=lcode18 or Rsinven1("item")=lcode19 or Rsinven1("item")=lcode20 or Rsinven1("item")=lcode21 or Rsinven1("item")=lcode22 or Rsinven1("item")=lcode23 or Rsinven1("item")=lcode24 or Rsinven1("item")=lcode25 then 'if Rsinven1("prodclass")="03" then if Rsinven1("machine1")="301" then totalvbqty=totalvbqty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3"))+ cdbl(Rsinven1("inv_qty4")) totalvbamt=totalvbamt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3"))+ cdbl(Rsinven1("inv_amt4")) if Rsinven1("cust_cd")<>"20001" then totalvbqty1=totalvbqty1 + cdbl(Rsinven1("inv_qty1")) totalvbqty2=totalvbqty2+ cdbl(Rsinven1("inv_qty2")) totalvbamt1=totalvbamt1 + cdbl(Rsinven1("inv_amt1")) totalvbamt2=totalvbamt2 + cdbl(Rsinven1("inv_amt2")) totalvbqty3=totalvbqty3 + cdbl(Rsinven1("inv_qty3")) totalvbqty4=totalvbqty4 + cdbl(Rsinven1("inv_qty4")) totalvbamt3=totalvbamt3 + cdbl(Rsinven1("inv_amt3")) totalvbamt4=totalvbamt4 + cdbl(Rsinven1("inv_amt4")) end if diaa=right("0"&day(date-60),2) mesa=right("0"&month(date-60),2) yeara=right("00"&year(date-60),4) fecactual=yeara&mesa&diaa if Rsinven1("LastMov") <% end if Rsinven1.MoveNext Loop End If Rsinven1.Close Set Rsinven1 = Nothing %>
Customer Item 
TOTAL
Qty
Status / Last Mov.
Dlls
<%=Rsinven1("customer")%>  <%=Rsinven1("item")%> <%=cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3"))+ cdbl(Rsinven1("inv_qty4"))%> <%=lstatusprod%> <%=formatnumber(cdbl(Rsinven1("inv_amt1")) + cdbl(Rsinven1("inv_amt2")) + cdbl(Rsinven1("inv_amt3"))+ cdbl(Rsinven1("inv_amt4")),2)%>
   
<%=formatnumber(totalvbqty,0)%>
<%%>
<%=formatnumber(totalvbamt,2)%>
 
<% '**************end inventory '********************************************************** Inventory V-Board '***********************Planta 1 Vboard '********************** End VB planta 1 Dim Rsinvenvb2 set Rsinvenvb2=dbsql2.execute("select a.crp_id, a.cust_cd, (select cust_nm from stb010t(nolock) where cust_cd = a.cust_cd) cust_nm, a.good_cd, a.good_nm, max(a.inv_qty1) inv_qty1, max(a.inv_qty2) inv_qty2, max(a.inv_qty3) inv_qty3, max(a.inv_qty4) inv_qty4, max(a.inv_qty5) inv_qty5, max(a.inv_amt1) inv_amt1, max(a.inv_amt2) inv_amt2, max(a.inv_amt3) inv_amt3, max(a.inv_amt4) inv_amt4, max(a.inv_amt5) inv_amt5 from ( select a.crp_id, a.cust_cd, a.good_cd, a.good_nm, sum(isnull(a.jego_qty,0) - isnull(a.mov_qty,0) - isnull(a.sales_qty,0)) inv_qty1, 0 inv_qty2, 0 inv_qty3, 0 inv_qty4, 0 inv_qty5, sum(round((isnull(a.jego_qty,0) - isnull(a.mov_qty,0) - isnull(a.sales_qty,0)) * b.good_price,3)) inv_amt1, 0 inv_amt2, 0 inv_amt3, 0 inv_amt4, 0 inv_amt5 from sal011t 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.crp_id = '10' and a.local_cd = '1' and a.cust_cd ='20001' and a.real_jego_qty - a.mov_qty - a.sales_qty > 0 group by a.crp_id, a.cust_cd, a.good_cd, a.good_nm union all select a.crp_id, a.cust_cd, a.good_cd, a.good_nm, 0, sum(isnull(a.jego_qty,0) - isnull(a.mov_qty,0) - isnull(a.sales_qty,0)), 0 , 0 , 0, 0 inv_amt2, sum(round((isnull(a.jego_qty,0) - isnull(a.mov_qty,0) - isnull(a.sales_qty,0)) * b.good_price,3)) inv_amt1, 0 inv_amt3, 0 inv_amt4, 0 inv_amt5 from sal011t a(nolock), ooa010t 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.crp_id = '10' and a.local_cd in('A','B') and a.cust_cd ='20001' and a.real_jego_qty - a.mov_qty - a.sales_qty > 0 group by a.crp_id, a.cust_cd, a.good_cd, a.good_nm union all select a.crp_id, a.cust_cd, a.good_cd, a.good_nm, 0, 0, sum(isnull(a.jego_qty,0) - isnull(a.mov_qty,0) - isnull(a.sales_qty,0)) inv_qty1, 0 inv_qty4, 0 inv_qty5, 0 inv_amt2, 0 inv_amt3, sum(round((isnull(a.jego_qty,0) - isnull(a.mov_qty,0) - isnull(a.sales_qty,0)) * b.good_price,3)) inv_amt1, 0 inv_amt4, 0 inv_amt5 from sal011t 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.crp_id = '10' and a.local_cd <> '1' and a.cust_cd ='20001' and a.real_jego_qty - a.mov_qty - a.sales_qty > 0 group by a.crp_id, a.cust_cd, a.good_cd, a.good_nm union all select a.crp_id, a.cust_cd, a.good_cd, a.good_nm, 0, 0, 0, sum(isnull(a.mov_qty,0)), 0, 0 inv_amt2, 0 inv_amt3, 0 inv_amt4, sum(round(isnull(a.mov_qty,0) * b.good_price,3)) inv_amt1, 0 inv_amt5 from sal011t 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.crp_id = '10' and a.cust_cd ='20001' and a.mov_qty <> 0 and a.real_jego_qty - a.sales_qty > 0 group by a.crp_id, a.cust_cd, a.good_cd, a.good_nm union all select a.crp_id, a.cust_cd, a.good_cd, a.good_nm, 0, 0, 0, 0, sum(isnull(a.mov_qty,0)), 0 inv_amt2, 0 inv_amt3, 0 inv_amt4, 0 inv_amt5, sum(round(isnull(a.mov_qty,0) * b.good_price,3)) inv_amt1 from sal011t a(nolock), ooa010t 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.crp_id = '10' and a.cust_cd ='20001' and a.mov_qty <> 0 and a.real_jego_qty - a.sales_qty > 0 group by a.crp_id, a.cust_cd, a.good_cd, a.good_nm ) a group by a.crp_id, a.cust_cd, a.good_cd, a.good_nm order by a.crp_id, a.cust_cd, a.good_cd") txx=0 if txx=1 then larchivo="\\server2\reporte\InvTotSamsungVB.xlsx" Path=larchivo Set ConexionBD = Server.CreateObject("ADODB.Connection") ConexionBD.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & path & ";Extended Properties='Excel 12.0 Xml;HDR=no;IMEX=1';" Set rsVac = Server.CreateObject("ADODB.Recordset") rsVac.Open "Select * From [InvTotSamsungVB$]", ConexionBD,3 ,3 if rsVac.eof or rsVac.bof then ExisteUsuario = False Msg = "No inventory exist for this date." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else lqtyvb=0 lamtvb=0 ltotqtyvb=0 ltotamtvb=0 lcode1="BN69-12806A" lcode2="BN69-12807A" lcode3="BN69-00391U" lcode4="BN69-00391Y" lcode5="0330325 (V BOARDS)" lcode6="V Boards 2x2x96" lcode7="31"& Chr(34) &" Kraft V-Board" lcode8="45"& Chr(34) &" Kraft V-Board" lcode9="8 Feets V-Board" lcode10="BN69-05528A V-BOARD" lcode11="BN69-00391E V-BOARD" lcode12="BN69-06769A" lcode13="BN69-12807A" rsVac.MoveFirst Do While Not RsVac.EOF if rsVac(3) =lcode1 then lcode1qty = cdbl(rsVac(14)) lcode1amt = cdbl(rsVac(15)) end if if rsVac(3) =lcode2 then lcode2qty = cdbl(rsVac(14)) lcode2amt = cdbl(rsVac(15)) end if if rsVac(3)=lcode3 then lcode3qty = cdbl(rsVac(14)) lcode3amt = cdbl(rsVac(15)) end if if rsVac(3)=lcode4 then lcode4qty = cdbl(rsVac(14)) lcode4amt = cdbl(rsVac(15)) end if RsVac.MoveNext Loop End If RsVac.Close Set RsVac = Nothing else if Rsinvenvb2.eof or Rsinvenvb2.bof then ExisteUsuario = False Msg = "No inventory exist for this date." Style = vbDefaultButton2 Title = "Msg from System" Help = "" ctxt = 1000 'Response = MsgBox(Msg, Style, Title, Help, ctxt) Else lqtyvb=0 lamtvb=0 ltotqtyvb=0 ltotamtvb=0 lcode1="BN69-12806A" lcode2="BN69-12807A" lcode3="BN69-00391U" lcode4="BN69-00391Y" lcode5="0330325 (V BOARDS)" lcode6="V Boards 2x2x96" lcode7="31"& Chr(34) &" Kraft V-Board" lcode8="45"& Chr(34) &" Kraft V-Board" lcode9="8 Feets V-Board" lcode10="BN69-05528A V-BOARD" lcode11="BN69-00391E V-BOARD" lcode12="BN69-06769A" lcode13="BN69-12807A" Rsinvenvb2.MoveFirst Do While Not Rsinvenvb2.EOF if Rsinvenvb2("good_nm") =lcode1 then lcode1qty = lcode1qty + cdbl(Rsinvenvb2("inv_qty1"))+ cdbl(Rsinvenvb2("inv_qty2"))+ cdbl(Rsinvenvb2("inv_qty3"))+ cdbl(Rsinvenvb2("inv_qty4"))+ cdbl(Rsinvenvb2("inv_qty5")) lcode1amt = lcode1amt + cdbl(Rsinvenvb2("inv_amt1"))+ cdbl(Rsinvenvb2("inv_amt2"))+ cdbl(Rsinvenvb2("inv_amt3"))+ cdbl(Rsinvenvb2("inv_amt4"))+ cdbl(Rsinvenvb2("inv_amt5")) end if if Rsinvenvb2("good_nm") =lcode2 then lcode2qty = lcode2qty + cdbl(Rsinvenvb2("inv_qty1"))+ cdbl(Rsinvenvb2("inv_qty2"))+ cdbl(Rsinvenvb2("inv_qty3"))+ cdbl(Rsinvenvb2("inv_qty4"))+ cdbl(Rsinvenvb2("inv_qty5")) lcode2amt = lcode2amt + cdbl(Rsinvenvb2("inv_amt1"))+ cdbl(Rsinvenvb2("inv_amt2"))+ cdbl(Rsinvenvb2("inv_amt3"))+ cdbl(Rsinvenvb2("inv_amt4"))+ cdbl(Rsinvenvb2("inv_amt5")) end if if Rsinvenvb2("good_nm")=lcode3 then lcode3qty = lcode3qty + cdbl(Rsinvenvb2("inv_qty1"))+ cdbl(Rsinvenvb2("inv_qty2"))+ cdbl(Rsinvenvb2("inv_qty3"))+ cdbl(Rsinvenvb2("inv_qty4"))+ cdbl(Rsinvenvb2("inv_qty5")) lcode3amt = lcode3amt + cdbl(Rsinvenvb2("inv_amt1"))+ cdbl(Rsinvenvb2("inv_amt2"))+ cdbl(Rsinvenvb2("inv_amt3"))+ cdbl(Rsinvenvb2("inv_amt4"))+ cdbl(Rsinvenvb2("inv_amt5")) end if if Rsinvenvb2("good_nm")=lcode4 then lcode4qty = lcode4qty + cdbl(Rsinvenvb2("inv_qty1"))+ cdbl(Rsinvenvb2("inv_qty2"))+ cdbl(Rsinvenvb2("inv_qty3"))+ cdbl(Rsinvenvb2("inv_qty4"))+ cdbl(Rsinvenvb2("inv_qty5")) lcode4amt = lcode4amt + cdbl(Rsinvenvb2("inv_amt1"))+ cdbl(Rsinvenvb2("inv_amt2"))+ cdbl(Rsinvenvb2("inv_amt3"))+ cdbl(Rsinvenvb2("inv_amt4"))+ cdbl(Rsinvenvb2("inv_amt5")) end if Rsinvenvb2.MoveNext Loop End If Rsinvenvb2.Close Set Rsinvenvb2 = Nothing end if '**************end inventory V-Board set Rswip=cnn.execute("select * from wip") lsheetwip=rswip("SHEETWIP") lboxwip=rswip("boxwip") lboxrwr=rswip("boxrwr") lboxrwked=rswip("boxrwked") rswip.close set rswip = nothing cnn.close set cnn = nothing dbsql.Close Set dbsql = Nothing dbsql2.Close Set dbsql2 = Nothing 'db.close ''lsamsungvbqty=(lcode1qty+lcode2qty+lcode3qty+lcode4qty+lcode10qty+lcode11qty+lcode12qty+lcode13qty+lcode14qty+lcode15qty+lcode16qty+lcode17qty+lcode25qty) ''lsamsungvbamt=(lcode1amt+lcode2amt+lcode3amt+lcode4amt+lcode10amt+lcode11amt+lcode12amt+lcode13amt+lcode14amt+lcode15amt+lcode16amt+lcode17amt+lcode25amt) ''lsamsungvbqty4=(lcode1qty4+lcode2qty4+lcode3qty4+lcode4qty4+lcode10qty4+lcode11qty4+lcode12qty4+lcode13qty4+lcode14qty4+lcode15qty4+lcode16qty4+lcode17qty4+lcode25qty4) ''lsamsungvbamt4=(lcode1amt4+lcode2amt4+lcode3amt4+lcode4amt4+lcode10amt4+lcode11amt4+lcode12amt4+lcode13amt4+lcode14amt4+lcode15amt4+lcode16amt4+lcode17amt4+lcode25amt4) ''lsamsungvbqty1=(lcode1qty1+lcode2qty1+lcode3qty1+lcode4qty1+lcode10qty1+lcode11qty1+lcode12qty1+lcode13qty1+lcode14qty1+lcode15qty1+lcode16qty1+lcode17qty1+lcode25qty1) ''lsamsungvbamt1=(lcode1amt1+lcode2amt1+lcode3amt1+lcode4amt1+lcode10amt1+lcode11amt1+lcode12amt1+lcode13amt1+lcode14amt1+lcode15amt1+lcode16amt1+lcode17amt1+lcode25amt1) ''lsamsungvbqty2=(lcode1qty2+lcode2qty2+lcode3qty2+lcode4qty2+lcode10qty2+lcode11qty2+lcode12qty2+lcode13qty2+lcode14qty2+lcode15qty2+lcode16qty2+lcode17qty2+lcode25qty2) ''lsamsungvbamt2=(lcode1amt2+lcode2amt2+lcode3amt2+lcode4amt2+lcode10amt2+lcode11amt2+lcode12amt2+lcode13amt2+lcode14amt2+lcode15amt2+lcode16amt2+lcode17amt2+lcode25amt2) ' lcode35qty = lcode35qty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3")) ' lcode35amt = lcode35amt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3")) ' lcode35qty4 = lcode35qty4 + cdbl(Rsinven1("inv_qty4")) ' lcode35amt4 = lcode35amt4 + cdbl(Rsinven1("inv_amt4")) ' lcode35qty1 = lcode35qty1 + cdbl(Rsinven1("inv_qty1")) ' lcode35amt1 = lcode35amt1 + cdbl(Rsinven1("inv_amt1")) ' lcode35qty2 = lcode35qty2 + cdbl(Rsinven1("inv_qty2")) ' lcode35amt2 = lcode35amt2 + cdbl(Rsinven1("inv_amt2")) ' lcode35qty3 = lcode35qty3 + cdbl(Rsinven1("inv_qty3")) ' lcode35amt3 = lcode35amt3 + cdbl(Rsinven1("inv_amt3")) lsamsungvbqty=lcode35qty lsamsungvbamt=lcode35amt lsamsungvbqty4=lcode35qty4 lsamsungvbamt4=lcode35amt4 lsamsungvbqty1=lcode35qty1 lsamsungvbamt1=lcode35amt1 lsamsungvbqty2=lcode35qty2 lsamsungvbamt2=lcode35amt2 lsamsungvbqty3=lcode35qty3 lsamsungvbamt3=lcode35amt3 ' totalvbqty=totalvbqty + cdbl(Rsinven1("inv_qty1"))+ cdbl(Rsinven1("inv_qty2"))+ cdbl(Rsinven1("inv_qty3"))+ cdbl(Rsinven1("inv_qty4")) ' totalvbamt=totalvbamt + cdbl(Rsinven1("inv_amt1"))+ cdbl(Rsinven1("inv_amt2"))+ cdbl(Rsinven1("inv_amt3"))+ cdbl(Rsinven1("inv_amt4")) ' if Rsinven1("cust_cd")<>"20001" then ' totalvbqty1=totalvbqty1 + cdbl(Rsinven1("inv_qty1")) ' totalvbqty2=totalvbqty2+ cdbl(Rsinven1("inv_qty2")) ' totalvbamt1=totalvbamt1 + cdbl(Rsinven1("inv_amt1")) ' totalvbamt2=totalvbamt2 + cdbl(Rsinven1("inv_amt2")) ' totalvbqty3=totalvbqty3 + cdbl(Rsinven1("inv_qty3")) ' totalvbqty4=totalvbqty4 + cdbl(Rsinven1("inv_qty4")) ' totalvbamt3=totalvbamt3 + cdbl(Rsinven1("inv_amt3")) ' totalvbamt4=totalvbamt4 + cdbl(Rsinven1("inv_amt4")) lvbinv=0 if lvbinv=1 then %> <% end if %> ACTUAL INVENTORY
Generated: <%=time%>   OB WH3 Nordika WH4 OB Transfer
OB Total
Others WH3 Nordika WH4 Others Transfer WH2
Others Total
TOTAL
Qty
M2
Dlls
Samsung
Obsolete
<%=(lSamsungObsOB1WH3)%> <%=(lSamsungObsOB1WH4)%> <%=(lSamsungObsOB1WH1)%>
<%=(lSamsungObsOB1)%>
<%=(lSamsungObsOT1WH3)%> <%=(lSamsungObsOT1WH4)%> <%=(lSamsungObsOT1WH1)%>  
<%=(lSamsungObsOT1WH3+lSamsungObsOT1WH4+lSamsungObsOT1WH1)%>
<%=formatnumber(lSamsungObsOB1+lSamsungObsOT1WH3+lSamsungObsOT1WH4+lSamsungObsOT1WH1,0)%>
<%=formatnumber(lTotalM2Inv1-lTotalM2InvD,0)%>
$<%=formatnumber(lTotalDllInv1-lTotalDllInvD)%>
 
Actual
<%=lOBSamsung2WH3%> <%=lOBSamsung2WH4%> <%=lOBSamsung2WH1%>
<%=lOBSamsung2%>
<%=lOTSamsungWH3%> <%=lOTSamsungWH4%> <%=lOTSamsungWH1%>  
<%=lOTSamsung2+lOTSamsung%>
<%=formatnumber(lTotalQtyInvD+lOTSamsung,0)%>
<%=formatnumber(lTotalM2InvD,0)%>
$<%=formatnumber(lTotalDllInvD-lsamsungvbamt-lsamsungvbamt4)%>
  VB Actual         <%=(lSamsungvbqty3)%> <%=lSamsungvbqty4%> <%=lSamsungvbqty1%>   <%=(lSamsungvbqty)%> <%=formatnumber(lSamsungvbqty,0)%>   $<%=formatnumber(lsamsungvbamt)%>
  Total Samsung      
<%=(lSamsungObsOB1+lOBSamsung2)%>
       
<%=(lSamsungObsOT1+lOTSamsung2+lOTSamsung)%>
<%=formatnumber((lSamsungObsOB1+lSamsungObsOT1+lTotalQtyInvD+lOTSamsung),0)%>
<%=formatnumber(lTotalM2Inv1,0)%>
$<%=formatnumber((lTotalDllInv1-lTotalDllInvD)+(lTotalDllInvD-lsamsungvbamt-lsamsungvbamt4)+(lsamsungvbamt+lsamsungvbamt4))%>
Others
Obsolete
     
0
<%=(lOther3Obs1)%>
<%=(lOther4Obs1)%>
<%=(lOther1Obs1)%>
<%=(lOther2Obs1)%>
<%=(lOtherObs1)%>
<%=(lOtherObs1)%>
<%=formatnumber(lOtherObsM2,0)%>
$<%=formatnumber(lOtherObsDll)%>
 
Actual
     
0
<%=(lOthers13-lOther3Obs1-totalvbqty3)%>
<%=(lOthers14-lOther4Obs1-totalvbqty4)%>
<%=(lOthers11-lOther1Obs1)%>
<%=(lOthers12-lOther2Obs1)%>
<%=(lOthers1-lOtherObs1-totalvbqty3-totalvbqty4)%>
<%=formatnumber(lTotalQtyInv2-lOtherObs1-totalvbqty3-totalvbqty4,0)%>
<%=formatnumber(lTotalM2Inv2-lOtherObsM2,0)%>
$<%=formatnumber(lTotalDllInv2-lOtherObsDll-totalvbamt3-totalvbamt4)%>
  VB         <%=totalvbqty3 %> <%=totalvbqty4 %> <%=totalvbqty1 %> <%=totalvbqty2 %> <%=totalvbqty3+totalvbqty4+totalvbqty1+totalvbqty2 %> <%=totalvbqty3+totalvbqty4+totalvbqty1+totalvbqty2 %>  
$<%=formatnumber(totalvbamt3+totalvbamt4+totalvbamt1+totalvbamt2)%>
 
Total Others
     
0
<%=lOthers13%>
<%=lOthers14%>
<%=lOthers11%>
<%=lOthers12%>
<%=lOthers1%>
<%=formatnumber(lTotalQtyInv2,0)%>
<%=formatnumber(lTotalM2Inv2,0)%>
$<%=formatnumber(lTotalDllInv2)%>
Total        
<%=(lSamsungObsOB1+lOBSamsung2)%>
       
<%=(lOthers1+lSamsungObsOT1+lOTSamsung2+lOTSamsung)%>
<%=formatnumber((lSamsungObsOB1+lSamsungObsOT1+lTotalQtyInvD+lOTSamsung)+lTotalQtyInv2,0)%>
<%=formatnumber(lTotalM2Inv1+lTotalM2Inv2,0)%>
$<%=formatnumber((lTotalDllInv1-lTotalDllInvD)+(lTotalDllInvD-lsamsungvbamt-lsamsungvbamt4)+(lsamsungvbamt+lsamsungvbamt4)+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%> <% if lboxrwked=0 then%> <%else%> <%end if%>
 
TOTAL
Qty
 
BOX Inventory
No Data
<%=formatnumber(lboxrwr,0)%>
 
Box Reworked
0
<%=formatnumber(lboxrwked,0)%>
 

 

Copyright <% End If Rsfore0.Close Set Rsfore0 = Nothing ''''''''''''' dbsql3.Close Set dbsql3 = Nothing %>