home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cool Page Magazine 16
/
CoolPage_16.iso
/
dynadb
/
codes
/
prodlist.cfm
< prev
next >
Wrap
Text File
|
1998-01-29
|
6KB
|
199 lines
<html>
<head>
<title>┐∩╛▄│f¬½</title>
</head>
<cfset type_rec=ArrayNew(2)>
<cfset product_rec=ArrayNew(2)>
<cfset obj_name=ArrayNew(2)>
<cfset all_prod_id="">
<cfset v=0>
<cfset k=0>
<cfquery name="GetType" datasource="dynamic database">
select * from prodtype
</cfquery>
<cfoutput query="GetType">
<cfset k=k+1>
<cfset type_rec[k][1]=#type_code#>
<cfset type_rec[k][2]=#type_name#>
</cfoutput>
<BODY background="paper12l.jpg">
<h4>║⌠ ╡╕ «╔ ÑN ╣q ╕ú ╣s Ñ≤<br>
╜╨ ┐∩ ╛▄ ⌐╥ ¡n ┴╩ ╢R ¬║ ╣q ╕ú ▓╒ Ñ≤ íC ¡Y ╖Q ¬╛ ╣D ╗∙ «µ íA ╜╨ ½÷ ñU ¡╢ Ñ╜ ¬║ íu ¡p ║Γ ╗∙ ┐· ív
</h4><br>
<cfform name="ProductInfo" action="Calcu.cfm">
<cfloop index="m" from="1" to="#k#">
<!--------------------------------------------------------------------------------
ñU¡▒│o¼q Java Script ¼O¿C╖φÑ╬ñß½÷ñUcheck box«╔íAªp¬G╝╞╢q─µª∞¼O 0 ⌐╬ñ░╗≥│ú¿Sª│«╔íA
┤N▒N─µª∞│]¼░ 1
--------------------------------------------------------------------------------->
<cfoutput>
<script language="JavaScript">
<cfset function_name="SetText" & #m#>
function #function_name#()
{
<cfset text_name= "qty" & #m#>
<cfset check_name="check_box" & #m#>
if(document.ProductInfo.#check_name#.checked)
{
if(document.ProductInfo.#text_name#.value=="0"||document.ProductInfo.#text_name#.value=="")
document.ProductInfo.#text_name#.value="1"
}
}
</script>
</cfoutput>
<cfquery name="GetProduct" datasource="dynamic database">
select * from product
where type='#type_rec[m][1]#'
order by product_name
</cfquery>
<cfoutput query="GetProduct">
<cfset all_prod_id=all_prod_id & "#chr(168)#" & "#prod_id#">
</cfoutput>
<cfif GetProduct.RecordCount is not 0>
<cfset boxname="check_box" & #m#>
<CFINPUT TYPE="checkbox"
NAME=#boxname#
onClick=#function_name#()
CHECKED="No"><cfoutput>#type_rec[m][2]#</cfoutput>
<br>
<cfset gridname="grid_no" & #m#>
<CFGRID NAME=#gridname#
height="150"
width="400"
QUERY="GetProduct"
SELECTMODE="row"
selected="1"
appendkey="yes">
<CFGRIDCOLUMN NAME="prod_id" display="no">
<CFGRIDCOLUMN NAME="product_name" header="│f¬½ªW║┘">
<CFGRIDCOLUMN NAME="cost" header="╗∙┐·">
<CFGRIDCOLUMN NAME="type" display="no">
</CFGRID>
<br>
<cfset text_name="qty" & #m#>
▒²┴╩╝╞╢qíG<CFINPUT TYPE="text"
NAME="#text_name#"
VALUE="0"
REQUIRED="no"
VALIDATE="integer"
MESSAGE="#type_rec[m][2]#¬║╝╞╢qª│╗~íA╜╨┐ΘñJÑ┐╛π╝╞"
SIZE="10"
MAXLENGTH="3">
<br>
<hr>
<cfset v=v+1>
<cfset obj_name[v][1]="check_box" & #m#>
<cfset obj_name[v][2]="grid_no" & #m#>
<cfset obj_name[v][3]="#type_rec[m][2]#">
<cfset obj_name[v][4]="qty" & #m#>
</cfif>
</cfloop>
<input type="button" name="calculate" value="¡p║Γ╗∙┐·" onClick="SumPrice()">
┴`¡╚íGHK$<input type="text" name="totalprice" maxlength=7><br>
<input type="reset" value="▓M░ú─µª∞">
<hr>
<INPUT TYPE="Submit" VALUE="¡q┴╩" onClick="SumPrice()">
<input type="hidden" name="selected_id">
<input type="hidden" name="selected_qty">
</cfform>
</body>
</html>
<!-----------------------------------------------------------------------------------
ñU¡▒│o¼q Java Script ╖|¡p║Γ⌐╥┐∩¿·¬║│f¬½┴`¡╚íA¿├└╦¼dñ@ñUÑ╬ñߪ│¿Sª│Ñ╟┐∙
------------------------------------------------------------------------------------>
<script language="JavaScript">
function SumPrice()
{
var GridContent=""
TotalPrice=0
CheckedTerms=0
product_selected=""
qty_selected=""
grid_selected=""
id_selected=""
_CF_checkProductInfo(document.ProductInfo)
<cfloop index="counter" from="1" to="#v#">
<cfoutput>
if (document.ProductInfo.#obj_name[counter][1]#.checked)
{
<!-----------------------------------------------------------------
_CF_getGrid ╖|┐ΘÑX íu_CFGRID__COLUMN__=XXX;__CFGRID__DATA__=XXXív
------------------------------------------------------------------->
GridContent=_CF_getGrid(document.#obj_name[counter][2]#)
<!-----------------------------------------------------------------
¡Y╖Q¬╛╣D _CF_getGrid ╣Ω╗┌¬║┐ΘÑXíAÑiÑH░⌡ªµñUñ@ªµ¬║╗yÑy
------------------------------------------------------------------>
<!-----------------------------------------------------------------
alert(GridContent)
------------------------------------------------------------------>
if(GridContent=="")
{
alert("ºA┐∩¿·ñF#obj_name[counter][3]#íAª²¼O┴┘¿S┐∩¿·│f¬½")
}
else
{
Quantity=parseInt(document.ProductInfo.#obj_name[counter][4]#.value)
if(Quantity==0)
{
alert("#obj_name[counter][3]#¬║╝╞╢qñú▒o¼░╣s")
}
else
{
CostBeginPos=GridContent.indexOf("__CFGRID__COLUMN__=cost; __CFGRID__DATA__=")+("__CFGRID__COLUMN__=cost; __CFGRID__DATA__=").length
CostEndPos=GridContent.indexOf("__CFGRID__COLUMN__=type;")-2
Price=parseInt(GridContent.substring(CostBeginPos, CostEndPos))
TotalPrice=TotalPrice+Price*Quantity
pattern="__CFGRID__COLUMN__=prod_id; __CFGRID__DATA__="
idBeginPos=GridContent.indexOf(pattern)+(pattern).length
idEndPos=GridContent.indexOf("__CFGRID__COLUMN__=product_name;")-2
id_here=GridContent.substring(idBeginPos, idEndPos)
id_selected=id_selected+"#chr(168)#"+id_here
qty_selected=qty_selected + "#chr(168)#" + Quantity
CheckedTerms++
}
}
}
</cfoutput>
</cfloop>
document.ProductInfo.totalprice.value=TotalPrice
document.ProductInfo.selected_id.value=id_selected
document.ProductInfo.selected_qty.value=qty_selected
}
</script>