Batch data entry, secondary input data, and related detection (ASP server side)
Author: Xiao Yuehen
Related links: Batch data entry, secondary input data, and related detection (JScript client) (original)
<%
Dim Intbilltotal, INTBILLTYPE, INTBILLVALUE, DTATODAY, I, STRBILLCODE
REM single record number (prestant)
INTBILLTOTAL = Request.form ("BN")
INTBILLTOTAL = Tonum (INTBILLTOTAL, 10)
INTBILLTYPE = GetOpertype ()
INTBILLVALUE = GetOperValue ()
DTATODAY = DATE ()
Rem ############################################################# #############################################################
Rem ## operational single project
Dim DTabildate, Strbilluser, StrbillCheckuser, strbillcontent
DIM Curbillcost, Curbillcostasp, Intcustid, StrcustName, StrPaytype, INTTOUM
Dim Dtabillyear, INTBILLID, INTBILLLANID, STRBILLPLANNUM
Rem ## dtabilldate single date, strbilluser fused, strbillcheckuser deliveryman, intbillid single ID
Rem ## strbillcontent single-note, strbillcode water number, Curbillcost single total price (JS), Curbillcostasp single total price (ASP)
Rem ## intcustid customer ID, STRCUSTNAME customer name, StrPaytype payment method, INTTOTALNUM single line quantity
Rem ## intbilltype single type, intbillvalue single type description, INTBILLPLANID plan ID, STRBILLPLANNUM plan number
REM ## Operation Single Date
DTABILDATE = Replace (TRIM ("" "," ""), ".", "-")
IF not isdate (DTABILLDATE) THEN
OUSER.GS_ADDMESSAGE "Operation Single Date is empty"
Else
DTABILDATE = CDATE (DTABILLDATE)
DTABILLYEAR = Year (DTABILDATE)
IF (OSYS.CHECKYEAROUT (DTABILLYEAR) THEN
OUSER.GS_ADDMESSAGE "Operation Single Date (" & DTabillyear & ")
END IF
Rem ############################################################# #############################################################
REM ## Data Seasoning Limit
Rem ############################################################# #############################################################
END IF
Rem ## fill in the table
Strbilluser = trim (Request.form ("Billuser") & "") if strbilluser = "" "
OUSER.GS_ADDMESSAGE "Fill in the table"
END IF
Rem ## deliveryman
StrbillCheckuser = Trim (Request.form ("BillCheckuser") & "")
If strbillcheckuser = "" "" "
OUSER.GS_ADDMESSAGE "delivery person empty"
END IF
REM ## error
OUSER.GS_SHOWMESSAGE 1
Rem ## other project
Curbillcost = Tocur (Request.form ("TotalPrice" & "", 0)
Curbillcostasp = 0
INTCUSTID = Tonum (Request.form ("Custid") & "", 0)
StrcustName = Request.form ("CustName")
StrPayType = Request.form ("PayType")
Strbillcontent = Request.form ("BillContent")
INTBILLPLANID = Tonum (Request.form ("BillPlan") & "", 0)
StrbillPlannum = GetBillNuber (INTBILLPLANID)
Rem ############################################################# #############################################################
Rem ############################################################# #############################################################
Rem ## gets the data entered by the user
DIM ARRRECORDINFO ()
DIM INTTEMPID, CURTEMPPRICE, CURTEMPTOAL, CURTEMPCOST, CURTEMPASPC
DIM Strtempcode, StrtempName, StrtempSpec, StrtempUnit, IntTempout, StrtempContent
Rem ## intTempid temporary product ID, CURTEMPPRICE unit price, number of CURTEMPCOST (JS)
Rem ## CurtemPaspc Product Total Price (ASP), Strtempcode Code, StrtemPName Name, StrtemPSpec Specification
Rem ## strTempunit unit, StrtempContent Remarks
Redim Arrrecordinfo (10, 0)
REM ## initialization single line number is 0, the number of rows filtered out is 0
INTTTOTALNUM = 0
INTTEMPOUT = 0
REM ## Initialize the useful data submitted by the client
For i = 1 to intbilltotal
INTTEMPID = Tonum (Request.form ("FPID" & I), 0)
CURTEMPPRICE = TOCUR ("FPPRice" & i), 0) CurtemPtotal = TOCUR (Request.form ("FPTOTAL" & I), 0)
CURTEMPCOST = TOCUR (Request.form ("FPCost" & i), 0)
CurtemPaspc = CURTEMPPRICE * CURTEMPTOTAL
IF (CURTEMPPRICE> 0) and (curtemptotal <> 0) and (intTempid> 0)) THEN
REM ## available data
INTTTOTALNUM = INTTOTALNUM 1
Curbillcostasp = CurbillCostasp CurtemPaspc
Strtempcode = TRIM (Request.form ("FPMODEL" & i))
StrtempName = Trim (Request.form ("FPValue" & i))
StrtempSpec = Trim (Request.form ("FPSPEC" & i))
StrtempUnit = Trim (Request.form ("FPUnit" & i))
StrtempContent = Trim (Request.form ("FPContent" & i))
Redim Preserve ArrrecordInfo (10, INTTOTALNUM)
Arrrecordinfo (0, INTTOTAALNUM) = INTTEMPID
Arrrecordinfo (1, INTTOTAALNUM) = StrtemPname
Arrrecordinfo (2, INTTOTAALNUM) = StrtempCode
ArrrecordInfo (3, INTTOTAALNUM) = Strtempspec
Arrrecordinfo (4, INTTOTAALNUM) = StrtempUnit
Arrrecordinfo (5, INTTOTAALNUM) = CURTEMPPRICE
Arrrecordinfo (6, INTTOTAALNUM) = CURTEMPTOAL
Arrrecordinfo (7, INTTOTAALNUM) = CURTEMPCOST
Arrrecordinfo (8, INTTOTALNUM) = CurtemPaspc
Arrrecordinfo (9, INTTOTALNUM) = StrtempContent
Elseif (INTTEMPID> 0) THEN
INTTEMPOUT = INTTEMPOUT 1
END IF
NEXT
IF INTTTOTAALNUM <1 THEN
OUSER.GS_ADDMESSAGE "No Product Data in Operation"
OUSER.GS_ADDMESSAGE "A total of" & IntTempout & "strip data (product unit price is 0, empty or negative, number is 0 or empty) is filtered
OUSER.GS_SHOWMESSAGE 1
END IF
Rem ############################################################# #############################################################
Rem ## open connection
f__openconn
Rem ############################################################# ################################# detection Table existence or not
DIM TBLTABLENAME
TBLTABLENAME = OUSER.GETBILLTABLE (DTABILLLYEAR)
Rem ############################################################# #############################################################
Rem ############################################################# #############################################################
Rem ## Construct a single item SQL statement and save
Strbillcode = getopebill ()
SQL = "SELECT *" "& gbl__str_tab_inf_bill &"] "
SET RS = Server.createObject ("AdoDb.Recordset")
RS.Open SQL, CONN, 1, 3
rs.addnew
RS ("Customerid" = intcustid
RS ("Customername") = strcustname
RS ("BitPlanid") = INTBILLLLANID
RS ("BitPlannum") = strbillplannum
RS ("BitType") = INTBILLTYPE
RS ("BitName") = INTBILLVALUE
RS ("Bitcode") = strbillcode
RS ("BitNum") = INTTOTALNUM
RS ("Bitprice") = Curbillcost
RS ("BitPriceasp") = curbillcostasp
RS ("BitDate") = DTABILDATE
RS ("BitPay") = STRPAYTYPE
RS ("BitContent") = strbillcontent
RS ("Filluser") = strbilluser
RS ("Sureuser") = strbillcheckuser
RS ("UserID") = OUSER.UID
RS ("UserName") = OUSER.USERNAME
Rs.Update
INTBILLID = RS ("ID")
Strbillcode = getBillNuber (intbillid)
RS ("Bitcode") = strbillcode
Rs.Update
Rs.close
Rem ############################################################# #############################################################
Rem ############################################################# ################################## 构 构Data row SQL statement and save
For i = 1 to INTTOTALNUM
SQL = "INSERT INTO [" & TBLTABLENAME & "]" & _
(Bittype, BitValue, Bitid, Bitcode, Productid, ProductName, Productcode, Productspec "& _
", ProductUnit, ProductPrice, ProductNum, PriceCount, PriceSpc, Billdate, Content) &_
VALUES ("& _
"& INTBILLTYPE &" & "& _
", '" & TOSQLR (INTBILLVALUE) & "'" & _
"," & INTBILLID & "& _
", '" & TOSQLR (Strbillcode) & "'" & _
"," & Arrrecordinfo (0, I) & "& _
", '" & TOSQLR (ArrRecordinfo (1, I)) & "'" & _
", '" & TOSQLR (ARRRECORDINFO (2, I)) & "'" & _
", '" & TOSQLR (ArrRecordinfo (3, I)) & "'" & _
", '" & TOSQLR (ARRRECORDINFO (4, I)) & "'" & _
"," & Arrrecordinfo (5, I) & "& _
"," & Arrrecordinfo (6, I) & "& _
"," & Arrrecordinfo (7, I) & "& _
"," & Arrrecordinfo (8, I) & "& _
", #" & DTABILDATE & "#" & _
", '" & TOSQLR (ARRRECORDINFO (9, I)) & "'" & _
")"
CONN.EXECUTE (SQL)
NEXT
Rem ############################################################# #############################################################
REM ## Close connection
f__closeconn
Rem ############################################################# ################################## 输出Tip information
OUSER.GS_ADDMESSAGE "A total of" & IntTempout & "strip data (product unit price is 0, empty or negative, number is 0 or empty) is filtered
OUSER.GS_ADDMESSAGE "Total" & InttotalNum & "items are saved in the library, total price:" & FormatNumber (Curbillcost, 2, True) & "&" ("& FormatNumber (Curbillcostasp, 2, True) &")
OUSER.GS_ADDMESSAGE " View this list (" & strbillcode & ") information a > "
OUSER.GS_ADDMESSAGE " Print this single "
OUSER.GS_SHOWMESSAGE 0
Rem ############################################################# #############################################################
%>