<--#include file=../__Inc/goperation.asp-->
<%
Dim intBillTotal, intBillType, intBillValue, dtaToday, i, strBillCode
Rem Number of single records (preparation quantity)
intBillTotal= request.Form(bn)
intBillTotal= toNum(intBillTotal, 10)
intBillType= getOperType()
intBillValue= getOperValue()
dtaToday= Date()
Rem ############################################################################################ ##################################################################################
Rem ## Operation item
Dim dtaBillDate, strBillUser, strBillCheckUser, strBillContent
Dim curBillCost, curBillCostAsp, intCustID, strCustName, strPayType, intTotalNum
Dim dtaBillYear, intBillID, intBillPlanID, strBillPlanNum
Rem ## dtaBillDate Single date, strBillUser form filler, strBillCheckUser pickup, intBillID Single ID
Rem ## strBillContent single note, strBillCode flow number, curBillCost total price (js), curBillCostAsp total price (asp)
Rem ## intCustID Customer ID, strCustName Customer Name, strPayType Payment Method, intTotalNum Number of single lines
Rem ## intBillType Single type, intBillValue Single type description, intBillPlanID Plan ID, strBillPlanNum Plan number
Rem ## Single date of operation
dtaBillDate = RePlace(Trim(request.Form(BillDate)), ., -)
If Not IsDate(dtaBillDate) Then
oUser.gs_AddMessage The single date of the operation is empty
Else
dtaBillDate = CDate(dtaBillDate)
dtaBillYear = Year(dtaBillDate)
If (oSys.CheckYearOut(dtaBillYear)) Then
oUser.gs_AddMessage Single date of operation ( & dtaBillYear & ) out of range
End If
Rem ############################################################################################ ###############################################################################
Rem ## Data storage restrictions
Rem ############################################################################################ ###############################################################################
End If
Rem ## Form filler
strBillUser = Trim(request.Form(BillUser) & )
If strBillUser = Then
oUser.gs_AddMessage The form is empty
End If
Rem ## pickup
strBillCheckUser = Trim(request.Form(BillCheckUser) & )
If strBillCheckUser = Then
oUser.gs_AddMessage The pickup holder is empty
End If
Rem ## Error turning
oUser.gs_ShowMessage 1
Rem ## Other projects
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 ## Get user input data
Dim arrRecordInfo()
Dim intTempID, curTempPrice, curTempTotal, curTempCost, curTempAspC
Dim strTempCode, strTempName, strTempSpec, strTempUnit, intTempOut, strTempContent
Rem ## intTempID Temporary product ID, curTempPrice unit price, curTempTotal quantity, curTempCost total price (js)
Rem ## curTempAspC Total Product Price (asp), strTempCode Code, strTempName Name, strTempSpec Specification
Rem ## strTempUnit unit, strTempContent Notes
ReDim arrRecordInfo(10, 0)
Rem ## Initialize the number of single rows to 0, and filter out the number of rows to 0
intTotalNum = 0
intTempOut= 0
Rem ## Initialize useful data submitted by the client
For i = 1 to intBillTotal
intTempID= toNum(request.Form(fpid & i), 0)
curTempPrice= toCur(request.Form(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
intTotalNum = intTotalNum + 1
curBillCostAsp = curBillCostAsp + curTempAspC
strTempCode= Trim(request.Form(fpmodel & i))
strTempName= Trim(request.Form(fpvalue & i))
strTempSpec= Trim(request.Form(fspec & i))
strTempUnit= Trim(request.Form(fpunit & i))
strTempContent= Trim(request.Form(fpcontent & i))
ReDim Preserve arrRecordInfo(10, intTotalNum)
arrRecordInfo(0, intTotalNum) = intTempID
arrRecordInfo(1, intTotalNum) = strTempName
arrRecordInfo(2, intTotalNum) = strTempCode
arrRecordInfo(3, intTotalNum) = strTempSpec
arrRecordInfo(4, intTotalNum) = strTempUnit
arrRecordInfo(5, intTotalNum) = curTempPrice
arrRecordInfo(6, intTotalNum) = curTempTotal
arrRecordInfo(7, intTotalNum) = curTempCost
arrRecordInfo(8, intTotalNum) = curTempAspC
arrRecordInfo(9, intTotalNum) = strTempContent
ElseIf (intTempID >0) Then
intTempOut = intTempOut + 1
End If
Next
If intTotalNum < 1 Then
oUser.gs_AddMessage No product data in the operation order
oUser.gs_AddMessage A total of & intTempOut & data (the product unit price is 0, empty or negative, the quantity is 0 or empty) is filtered
oUser.gs_ShowMessage 1
End If
Rem ############################################################################################ ##################################################################################
Rem ## Open connection
f__OpenConn
Rem ############################################################################################ ##################################################################################
Rem ## Check whether the table exists or not
Dim tblTableName
tblTableName = oUser.getBillTable(dtaBillYear)
Rem ############################################################################################ ##################################################################################
Rem ############################################################################################ ##################################################################################
Rem ## Construct single-project SQL statements and save them
strBillCode= getOpeBill()
sql = SELECT * FROM [ & 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)= intBillPlanID
rs(BitPlanNum)= strBillPlanNum
rs(BitType)= intBillType
rs(BitName)= intBillValue
rs(BitCode)= strBillCode
rs(BitNum)= intTotalNum
rs(BitPrice)= curBillCost
rs(BitPriceAsp)= curBillCostAsp
rs(BitDate)= dtaBillDate
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 ############################################################################################ ##################################################################################
Rem ## Constructs data row SQL statements and saves
For i = 1 to intTotalNum
sql = insert into [ & tblTableName & ] & _
(BitType, BitValue, BitID, BitCode, ProductID, ProductName, ProductCode, ProductSpec & _
, ProductUnit, ProductPrice, ProductNum, PriceCount, PriceAspC, 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) & & _
, # & dtaBillDate & # & _
, ' & toSqlr(arrRecordInfo(9, i)) & ' & _
)
conn.execute(sql)
Next
Rem ############################################################################################ ##################################################################################
Rem ## Close the connection
f__CloseConn
Rem ############################################################################################ ##################################################################################
Rem ## Output prompt information
oUser.gs_AddMessage A total of & intTempOut & data (the product unit price is 0, empty or negative, the quantity is 0 or empty) is filtered
oUser.gs_AddMessage A total of & intTotalNum & items are saved and stored in the database, total price: & FormatNumber(curBillCost, 2, true) & ( & FormatNumber(curBillCostAsp, 2, true) & )
oUser.gs_AddMessage View this list ( & strBillCode & ) information
oUser.gs_AddMessage Print this order
oUser.gs_ShowMessage 0
Rem ############################################################################################ ##################################################################################
%>