<% Response.expires = 0 Response.expiresabsolute = Now() - 1 Response.addHeader "pragma", "no-cache" Response.addHeader "cache-control", "private" Response.CacheControl = "no-cache" response.Buffer=true %> <% Group_qry=500 split_dat=2000 ' act times each action server.scripttimeout = 100000 If Session("design-desk-shop-DAT_status") <> "login" Then ' Response.Redirect "login.asp" end if xPart_No=0 xDescription=1 xExtra_desc=2 xPreferred_Supplier=3 xCategory=4 xMakers_RRP=5 xRetail_Price=6 xRetail_Inc=7 xCost_Price=8 xBulk_Qty=9 xActual_Cost=10 xAverage_Cost=11 xVAT_Code=12 xQty_Held=13 xQty_on_Order=14 xUnits=15 xLast_Bought_Date=16 xLast_Sold_Date=17 xBin_No_1=18 xBin_No_2=19 xWeight=20 xBarcode=21 xKudos_Barcode=22 xLast_Stock_Take_Date=23 xStock_type=24 'global DIM g_xpercentage,g_weight_price,g_vat 'Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'strPathtoTextFile=server.MapPath(".") & "\dat_file\" 'conn_txt.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPathtoTextFile & ";Extended Properties=""text;HDR=YES;FMT=csvDelimited""" IF request.Form("action")<>"" or request.querystring("spl")<>"" then IF request.Form("action")<>"" then ' frst time 'clear session("split_count")=0 session("total_rc")=0 session("Global_SQL")="" session("aborted_sql")="" session("updating_fld")="" session("new_val")="" session("started_update")=0 if request.form("replace_WeightPrice") <>"" THEn session("updating_fld")="Weight" session("new_val")=request.form("WeightPrice") end if if request.form("replace_Percentage") <>"" THEn session("updating_fld")="Percentage" session("new_val")=request.form("Percentage") end if if request.form("replace_VAT") <>"" THEn session("updating_fld")="VAT" session("new_val")=request.form("VAT") end if end if 'if request.form("WeightPrice") ="" or request.form("VAT")="" or request.form("Percentage")="" then 'response.Redirect("global_update.asp?msg=Please+Enter+Value+In+All+Fields") 'IF isnumeric(request.form("WeightPrice")) AND isnumeric(request.form("VAT")) ANd isnumeric(request.form("Percentage")) then ' else ' response.Redirect("global_update.asp?msg=Please+Enter+Numeric+Values") ' end if 'end if call Do_global_Update_new END if '********UPD Function Do_global_Update_new Set conn = Server.CreateObject("ADODB.Connection") conn.CommandTimeout = 0 conn.open xDb_Conn_Str grouped_sql="" ' Set rs_accessories_tmp = conn.Execute("SELECT * from accessories_import_tmp where [Part_No] in (select [Part_No] from accessories)") 'NEW split IF session("Global_SQL")<>"" then xSQL=session("Global_SQL") ELSE ' new submit if request.form("replace_WeightPrice") <>"" THEn xWhere=" Where WeightPrice='" & request.Form("replace_WeightPrice") &"'" if request.form("replace_Percentage") <>"" THEn xWhere=" Where Percentage='" & request.Form("replace_Percentage") &"'" if request.form("replace_VAT") <>"" THEn xWhere=" Where VAT='" & request.Form("replace_VAT") &"'" xSQL="SELECT accessories.[Part_No],accessories.WeightPrice,Weight,[Cost Price], accessories.VAT, accessories.Percentage" xSQL=xSQL & " FROM accessories" & xWhere END IF ' Set rs_accessories_tmp = conn.Execute(xSQL) Set rs_accessories_tmp = Server.CreateObject("ADODB.Recordset") rs_accessories_tmp.CursorLocation = 3 rs_accessories_tmp.Open xSQL, conn, 3, 3 session("Global_SQL")=xSQL If not rs_accessories_tmp.EOF THEN session("started_update")=1 ' nw split work If session("split_count")<>0 then rs_accessories_tmp.move session("split_count") end if If session("total_rc")=0 then ' xtotal=rs_accessories_tmp.recordcount ' xxSQL="SELECT count(accessories.[Part_No]) as TotalRC" ' xxSQL=xxSQL & " FROM accessories" & xWhere ' Set srs = conn.Execute(xxSQL) session("total_rc")=rs_accessories_tmp.recordcount ' session("total_rc")=srs("TotalRC") end if 'NEW do while not rs_accessories_tmp.eof 'get present NEW cWeightPrice=rs_accessories_tmp("WeightPrice") cVAT=rs_accessories_tmp("VAT") cPercentage=rs_accessories_tmp("Percentage") 'get what was entered at submit IF session("updating_fld")="Weight" then cWeightPrice=session("new_val") IF session("updating_fld")="Percentage" then cPercentage=session("new_val") IF session("updating_fld")="VAT" then cVAT=session("new_val") sSql="UPDATE Accessories set " sSql=sSql & " WeightPrice='"& cWeightPrice &"'," sSql=sSql & " VAT ='"& cVAT &"'," sSql=sSql & " Percentage ='"&cPercentage &"'," 'CALS Cost_Price=rs_accessories_tmp("Cost Price") xpercentage=cPercentage xxweight=rs_accessories_tmp("Weight") weight_price=cWeightPrice retail_price=c_retail_price(Cost_Price,xpercentage,xxweight,weight_price) xxretail_inc=cretail_inc(retail_price,cVAT) sSql=sSql & " [Retail Price] ='"&retail_price &"'," sSql=sSql & " [Retail inc] ='"& xxretail_inc&"'" 'END cals sSql=sSql & " WHERE [Part_No]= '"&REPLACE(rs_accessories_tmp("Part_No"),"'","") & "'" 'sSql=sSql & " WHERE [ID]= "&rs_accessories_tmp("ID") on error resume next ' Set rs_update = conn.Execute(sSql) grouped_sql=grouped_sql& sSql &";" IF zCount mod Group_qry= 0 then conn.Execute(grouped_sql) grouped_sql="" end if if err.number <>0 then session("data_dump")=session("data_dump") & "-ERR- " & sSql response.redirect "msg.asp" err.number =0 ' session("count_err")=session("count_err")+1 session("aborted_sql")=session("aborted_sql") & grouped_sql &";" grouped_sql="" end if 'response.write sSql & "
" zCount=zCount+1 session("split_count")=session("split_count")+1 if zCount >= split_dat then if session("split_count") < split_dat +100 then part="B" else part="C" end if ' response.redirect "import.asp?spl=t&msg=Part+Complete" if grouped_sql<>"" then conn.Execute(grouped_sql) ' Set rs_1 = Server.CreateObject("ADODB.Recordset") ' rs_1.CursorLocation = 3 ' rs_1.Open grouped_sql, conn, 3, 3 'session("data_dump")="HERE A-"'&grouped_sql ' response.redirect "msg.asp" grouped_sql="" end if ' response.redirect "nextpart.asp?c="&session("split_count")&"&p="&part 'response.redirect "global_update.asp?spl=t&c="&session("split_count")&"&p="&part end if rs_accessories_tmp.movenext Loop if grouped_sql<> "" then ' ignore 1st count , the header conn.Execute(grouped_sql) session("data_dump")="HERE B" & grouped_sql ' response.redirect "msg.asp" grouped_sql="" end if 'session("Updated")=zCount session("Updated")=session("split_count") session("status")= session("status") & " >> Updated (" & session("Updated")& ")" 'any final querys if session("aborted_sql")<>"" THEN conn.Execute(session("aborted_sql")) session("aborted_sql")="" 'response.redirect "msg.asp?finala+fixed" end if xtotal=session("total_rc") 'clear session("split_count")=0 session("Global_SQL")="" session("aborted_sql")="" session("updating_fld")="" session("new_val")="" session("total_rc")=0 session("started_update")=0 Set rs_txt = Nothing response.redirect "global_update.asp?done=Global+Update+Completed+[Records:"&xtotal&"]" else if session("started_update")=1 then ' there was record now its loop ends response.redirect "global_update.asp?done=Global+Update+Completed+Phase[Records:"&session("total_rc")&"]" else response.redirect "global_update.asp?done=No+Records+Matched"'&session("Global_SQL") end if end if End Function '************************ %>Global Update

[Home]

<%=request.QueryString("msg")%>

<% if request.QueryString("done")="" then%>

Global Update Will Update All Records With New Values & Will Re-calculate the Retail Price & Retail Inc

Weight Price  
Replace
With

 

Percentage  
Replace
With

 

VAT  
Replace
With

 

 

 


<%else%>

 

<%=request.QueryString("done")%> <% end if%>