Meni
Posts: 29 Joined: 8/3/2005 Status: offline
|
RE: summing up sales - 12/2/2005 12:54:33
the form that enters the data: <%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1255
Session.LCID = 1037
Err.Clear
strErrorUrl = ""
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear
Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"
Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"
fp_conn.Open Application("db_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"
fp_rs.Open "Products", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"
fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(5)
Dim arFormDBFields0(5)
Dim arFormValues0(5)
arFormFields0(0) = "employeeName"
arFormDBFields0(0) = "employeeName"
arFormValues0(0) = Request("employeeName")
arFormFields0(1) = "taarich"
arFormDBFields0(1) = "taarich"
arFormValues0(1) = Request("taarich")
arFormFields0(2) = "priceSold"
arFormDBFields0(2) = "priceSold"
arFormValues0(2) = Request("priceSold")
arFormFields0(3) = "productName"
arFormDBFields0(3) = "productName"
arFormValues0(3) = Request("productName")
arFormFields0(4) = "buyer"
arFormDBFields0(4) = "soldTo"
arFormValues0(4) = Request("buyer")
FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0
fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"
fp_rs.Close
fp_conn.Close
FP_FormConfirmation "text/html; charset=windows-1255",_
"Form Confirmation",_
"Thank you for submitting the following information:",_
"submission_form.asp",_
"Return to the form."
End If
End If
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
%>
<% Response.Buffer = True %>
<html dir="rtl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<meta http-equiv="Content-Language" content="he">
<title>מכירה חדשה</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>
<body background="http://***/images/bg.gif">
<!--#include file="../../../../head.inc"-->
<p>
<form METHOD="POST" action="--WEBBOT-SELF--" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">
<!--webbot bot="SaveDatabase" SuggestedExt="asp" S-DataConnection="db" S-RecordSource="Products" S-Form-Fields="employeeName taarich priceSold productName buyer" S-Form-DBFields="employeeName taarich priceSold productName soldTo" U-ASP-Include-Url="../../../_fpclass/fpdbform.inc" startspan U-Database-URL="../../../../fpdb/db.mdb" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="../../../_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan i-checksum="52631" -->
<table border="1" width="54%" id="table1" cellpadding="2" bordercolor="#800080">
<tr>
<td>תאריך המכירה </td>
<td><span dir="rtl">
<!--webbot bot="Validation" s-display-name="taarich" s-data-type="String" b-value-required="True" i-maximum-length="0" --><input type="TEXT" name="taarich" size="19" value="<%=Date%>"></span></td>
</tr>
<tr>
<td>שם המוצר הנמכר</td>
<td><span dir="rtl">
<!--webbot bot="Validation" s-display-name="productName" s-data-type="String" b-value-required="True" i-maximum-length="255" --><input type="TEXT" name="productName" size="64" value="" maxlength="255"></span></td>
</tr>
<tr>
<td>סכום המכירה</td>
<td><span dir="rtl">
<!--webbot bot="Validation" s-display-name="priceSold" s-data-type="String" b-value-required="True" i-maximum-length="255" --><input type="TEXT" name="priceSold" size="64" value="" maxlength="255"></span></td>
</tr>
<tr>
<td>שם המוכר</td>
<td><span dir="rtl"><nobr>
<!--webbot bot="DatabaseRegionStart" s-columnnames="Key,employeeName,employeeMobile,employeeEmail,employeeAddress,employeePassword" s-columntypes="3,202,202,202,202,3" s-dataconnection="db" b-tableformat="FALSE" b-menuformat="TRUE" s-menuchoice="employeeName" s-menuvalue="employeeName" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Employees" s-displaycolumns="Key,employeeName,employeeMobile,employeeEmail,employeeAddress,employeePassword" s-criteria s-order="[employeeName] -" s-sql="SELECT * FROM Employees ORDER BY employeeName DESC" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="../../../../_fpclass/fpdblib.inc" u-dbrgn1="../../../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../../../_fpclass/fpdbrgn2.inc" preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Database</span> " startspan --><!--#include file="../../../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Employees ORDER BY employeeName DESC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="db"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="employeeName"
fp_sMenuValue="employeeName"
fp_sColTypes="&Key=3&employeeName=202&employeeMobile=202&employeeEmail=202&employeeAddress=202&employeePassword=3&"
fp_iDisplayCols=6
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="37823" --><select NAME="employeeName" SIZE="1">
<!--webbot bot="AspInclude" clientside u-incfile="../../../../_fpclass/fpdbrgn1.inc" startspan --><!--#include file="../../../../_fpclass/fpdbrgn1.inc"--><!--webbot bot="AspInclude" endspan i-checksum="3394" -->
<option><%=FP_FieldHTML(fp_rs,"employeeName")%></option>
<!--webbot bot="AspInclude" clientside u-incfile="../../../../_fpclass/fpdbrgn2.inc" startspan --><!--#include file="../../../../_fpclass/fpdbrgn2.inc"--><!--webbot bot="AspInclude" endspan i-checksum="3522" -->
</select><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="../../../../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Results</span> " startspan --><!--webbot bot="DatabaseRegionEnd" endspan --></nobr></span></td>
</tr>
<tr>
<td>שם הקונה</td>
<td><span dir="rtl"><nobr>
<!--webbot bot="DatabaseRegionStart" s-columnnames="Key,firstName,lastName,sex,address,homePhone,mobilePhone,product,dateOfBirth,colorType,color1,color2,color3,oxygen,notes" s-columntypes="3,202,202,202,202,202,202,202,135,202,202,202,202,202,202" s-dataconnection="db" b-tableformat="FALSE" b-menuformat="TRUE" s-menuchoice="lastName" s-menuvalue="mobilePhone" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Results" s-displaycolumns="Key,firstName,lastName,sex,address,homePhone,mobilePhone,product,dateOfBirth,colorType,color1,color2,color3,oxygen,notes" s-criteria s-order s-sql="SELECT * FROM Results" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="1" u-dblib="../../../../_fpclass/fpdblib.inc" u-dbrgn1="../../../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../../../_fpclass/fpdbrgn2.inc" preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Database</span> " startspan --><!--#include file="../../../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="db"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="lastName"
fp_sMenuValue="mobilePhone"
fp_sColTypes="&Key=3&firstName=202&lastName=202&sex=202&address=202&homePhone=202&mobilePhone=202&product=202&dateOfBirth=135&colorType=202&color1=202&color2=202&color3=202&oxygen=202¬es=202&"
fp_iDisplayCols=15
fp_fCustomQuery=False
BOTID=1
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="54303" --><select NAME="buyer" SIZE="1">
<!--webbot bot="AspInclude" clientside u-incfile="../../../../_fpclass/fpdbrgn1.inc" startspan --><!--#include file="../../../../_fpclass/fpdbrgn1.inc"--><!--webbot bot="AspInclude" endspan i-checksum="3394" -->
<option VALUE="<%=FP_FieldHTML(fp_rs,"mobilePhone")%>" selected><%=FP_FieldHTML(fp_rs,"lastName")%>
</option>
<!--webbot bot="AspInclude" clientside u-incfile="../../../../_fpclass/fpdbrgn2.inc" startspan --><!--#include file="../../../../_fpclass/fpdbrgn2.inc"--><!--webbot bot="AspInclude" endspan i-checksum="3522" -->
</select><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="../../../../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Results</span> " startspan --><!--webbot bot="DatabaseRegionEnd" endspan --></nobr></span></td>
</tr>
</table>
<p><span dir="rtl"><input type="submit" value=" שלח "></span></p>
</form>
</body>
</html> the query page: <html dir="rtl">
<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1255"
FP_CodePage = 1255 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_LCID = 1037 %>
<meta http-equiv="Content-Language" content="he">
<title>New Page 1</title>
</head>
<body>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="../../../../_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" i-checksum="43374" endspan -->
<p><nobr>
<!--webbot bot="DatabaseRegionStart" s-columnnames="Key,employeeName,employeeMobile,employeeEmail,employeeAddress,employeePassword" s-columntypes="3,202,202,202,202,3" s-dataconnection="db" b-tableformat="FALSE" b-menuformat="TRUE" s-menuchoice="employeeName" s-menuvalue="employeeName" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Employees" s-displaycolumns="Key,employeeName,employeeMobile,employeeEmail,employeeAddress,employeePassword" s-criteria s-order s-sql="SELECT * FROM Employees" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="256" i-groupsize="0" botid="0" u-dblib="../../../_fpclass/fpdblib.inc" u-dbrgn1="../../../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../../../_fpclass/fpdbrgn2.inc" preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Database</span> " startspan --><!--#include file="../../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Employees"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="db"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="employeeName"
fp_sMenuValue="employeeName"
fp_sColTypes="&Key=3&employeeName=202&employeeMobile=202&employeeEmail=202&employeeAddress=202&employeePassword=3&"
fp_iDisplayCols=6
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="61091" --><select NAME="employeeName" SIZE="1">
<!--webbot bot="AspInclude" clientside u-incfile="../../../../_fpclass/fpdbrgn1.inc" startspan --><!--#include file="../../../../_fpclass/fpdbrgn1.inc"--><!--webbot bot="AspInclude" endspan i-checksum="3394" -->
<option value="<%=FP_FieldHTML(fp_rs,"employeeName")%>"><%=FP_FieldHTML(fp_rs,"employeeName")%></option>
<!--webbot bot="AspInclude" clientside u-incfile="../../../../_fpclass/fpdbrgn2.inc" startspan --><!--#include file="../../../../_fpclass/fpdbrgn2.inc"--><!--webbot bot="AspInclude" endspan i-checksum="3522" -->
</select><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="../../../../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Results</span> " startspan --><!--webbot bot="DatabaseRegionEnd" endspan --></nobr></p>
<p>התחלה <input type="text" name="startd" size="20" value="dd/mm/yyyy"></p>
<p>סיום <input type="text" name="endd" size="20" value="dd/mm/yyyy"></p>
<table width="100%" border="1">
<thead>
<tr>
<th ALIGN="LEFT"><b>employeeName</b></th>
<th ALIGN="LEFT"><b>totalSales</b></th>
<th ALIGN="LEFT"><b>productName</b></th>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart" s-columnnames="employeeName,totalSales,productName" s-columntypes="3,5,202" s-dataconnection="db" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns="employeeName,totalSales,productName" s-criteria s-order s-sql="SELECT employeeName, Sum(priceSold) AS totalSales, productName FROM Products GROUP BY employeeName, productName" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="1" u-dblib="../../../../_fpclass/fpdblib.inc" u-dbrgn1="../../../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../../../_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" width="100%"><font color="#000000">This is the start of a Database Results region.</font></td></tr>" startspan --><!--#include file="../../../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT employeeName, Sum(priceSold) AS totalSales, productName FROM Products GROUP BY employeeName, productName"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=3 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="db"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&employeeName=3&totalSales=5&productName=202&"
fp_iDisplayCols=3
fp_fCustomQuery=True
BOTID=1
fp_iRegion=BOTID
%>
<!--#include file="../../../../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="12684" --><tr>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="employeeName,totalSales,productName" s-column="employeeName" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>employeeName<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"employeeName")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="30904" --></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="employeeName,totalSales,productName" s-column="totalSales" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>totalSales<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"totalSales")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="33131" --></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="employeeName,totalSales,productName" s-column="productName" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>productName<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"productName")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="32605" --></td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../../../../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" width="100%"><font color="#000000">This is the end of a Database Results region.</font></td></tr>" startspan --><!--#include file="../../../../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="3554" --></tbody>
</table>
<p> </p>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
<p> </p>
</form>
</body>
</html>
|