home *** CD-ROM | disk | FTP | other *** search
/ Cool Page Magazine 16 / CoolPage_16.iso / dynadb / codes / calcu.cfm < prev    next >
Text File  |  1998-01-29  |  6KB  |  207 lines

  1. <!-----------------------------------------------------------------
  2.         checked_id ¬║╡▓║cíG
  3.         checked_id[x][1] │f¬½╜s╕╣
  4.         checked_id[x][2] ¡q┴╩╝╞╢q
  5.         checked_id[x][3] │f¬½ªW║┘
  6.         checked_id[x][4] ║╪├■ªW║┘
  7.         checked_id[x][5] │f¬½╗∙«µ
  8. ------------------------------------------------------------------>
  9. <html>
  10. <head>
  11. <title>┼U½╚╕Ω«╞</title>
  12. </head>
  13. <BODY background="paper12l.jpg">
  14.  
  15. <cfif #totalprice# is 0>
  16.     ºA ┴┘ ¿S ┐∩ ┴╩ │f ¬½ íA ╜╨ ½÷ ñU ┬s ─² ╛╣ ¬║ íuBackív ¡½ ╖s ┐∩ ╛▄
  17. <cfelse>
  18.     <cfoutput>
  19.         <cfset checked_id=ArrayNew(2)>
  20.         <cfset insufficent_prod=ArrayNew(2)>
  21.         <cfset checked_id[1][1]="">
  22.         <cfset checked_id[1][2]=0>
  23.         <cfset tmpstr="">    
  24.         <cfset id_list="">
  25.         <cfset idSelected=#selected_id#>
  26.         <cfset qtyselected=#selected_qty#>
  27.         <cfset total_id_char=len(idSelected)>
  28.         <cfset total_qty_char=len(qtyselected)>    
  29.         <cfset x=1>
  30.         <cfset GrossTotal=0>
  31.         <cfset insufficient_qty=false>
  32.     </cfoutput>
  33.  
  34.     <cfloop index="y" from="1" to ="#total_id_char#">
  35.         <cfoutput>
  36.         <cfif #mid(selected_id, y, 1)# is not #chr(168)#>
  37.             <cfset checked_id[x][1]=checked_id[x][1] & mid(idSelected, y, 1)>
  38.         <cfelse>
  39.             <cfif y is not 1>
  40.                 <cfset x=x+1>
  41.                 <cfset checked_id[x][1]="">
  42.             </cfif>
  43.         </cfif>
  44.         </cfoutput>
  45.     </cfloop>
  46.     
  47.     <cfset x=1>
  48.     <cfloop index="y" from="1" to ="#total_qty_char#">
  49.         <cfoutput>
  50.         <cfif #mid(qtyselected, y, 1)# is not #chr(168)#>
  51.             <cfset tmpstr=tmpstr & mid(qtyselected, y, 1)>
  52.         <cfelse>            
  53.             <cfif y is not 1>
  54.                 <cfset checked_id[x][2]=val(tmpstr)>
  55.                     <cfset x=x+1>
  56.                     <cfset checked_id[x][2]=0>
  57.                     <cfset tmpstr="">
  58.                 </cfif>
  59.             </cfif>
  60.         </cfoutput>
  61.     </cfloop>    
  62.     
  63.         <cfset checked_id[x][2]=val(tmpstr)>
  64.         <cfset y=0>
  65.         <cfloop index=z from="1" to =#x#>    
  66.             <cfquery name="GetProduct" datasource="dynamic database">
  67.                 select * from product, prodtype
  68.                 where product.prod_id='#checked_id[z][1]#'
  69.                 and product.type=prodtype.type_code
  70.             </cfquery>
  71.             <cfoutput query="GetProduct">
  72.                 <cfif checked_id[z][2] greater than #quantity#>
  73.                     <cfset y=y+1>
  74.                     <cfset insufficient_qty=true>
  75.                     <cfset insufficent_prod[y][1]=#product_name#>
  76.                     <cfset insufficent_prod[y][2]=#type_name#>
  77.                     <cfset insufficent_prod[y][3]=#quantity#>
  78.                 <cfelse>    
  79.         
  80.                     <cfset checked_id[z][3] = #product_name#>
  81.                     <cfset checked_id[z][4] = #type_name#>
  82.                     <cfset checked_id[z][5] = #cost#>    
  83.                 </cfif>
  84.             </cfoutput>
  85.         </cfloop>
  86.     
  87.     
  88.     <cfif insufficient_qty>
  89.         º┌ ¡╠ ╝╞ ╛┌ «w ¬║ │f ¬½ ╝╞ ╢q ñú ¿¼ íA ╜╨ ½÷ ñU ┬s ─² ╛╣ ¬║ íuBackív ½÷ ╢s íA ¿├
  90.         º≤ Ñ┐ ñU ªC ¬║ │f ½~ ╝╞ ╢q íC
  91.         <TABLE BORDER="3" ALIGN="DEFAULT" WIDTH="100%">
  92.         <TR>
  93.         <TD align="left">│f½~ªW║┘</TD>
  94.         <TD align="left">╝╞╢qÑ▓╢╖ñúñj⌐≤</TD>
  95.         <TD align="left">║╪├■</TD>
  96.         </TR>
  97.     
  98.         <cfloop index=z from="1" to =#y#>
  99.         <cfoutput>    
  100.             <TD align="left">#insufficent_prod[z][1]#</TD>
  101.             <TD align="left">#insufficent_prod[z][2]#</TD>
  102.             <TD align="left">#insufficent_prod[z][3]#</TD>
  103.             </tr>
  104.         </cfoutput>
  105.         </cfloop>
  106.         </table>
  107.     <cfelse>
  108.         ºA ┐∩ ╛▄ ñF ñU ªC │f ¬½ íC ªp ¬G ¡n º≤ Ñ┐ ¬║ ╕▄ íA ╜╨ ½÷ ñU ┬s ─² ╛╣ ¬║ íuBackív 
  109.         ½÷ ╢s íC ªp ¬G Ñ┐ ╜T íA ╜╨ ╢± º┤ ¡╙ ñH ╕Ω «╞ íA ╡M ½ß ½÷ ñU íu ¡q ┴╩ ív ½÷ ╢s íC
  110.         <hr>
  111.     
  112.         <TABLE BORDER="3" ALIGN="DEFAULT" WIDTH="100%">
  113.         
  114.         <TR>
  115.         <TD align="left">│f½~ªW║┘</TD>
  116.         <TD align="left">╝╞╢q</TD>
  117.         <TD align="left">║╪├■</TD>
  118.         <TD align="left">│µ╗∙</TD>
  119.         <TD align="left">ñp¡p</TD>
  120.         </TR>
  121.             
  122.         <cfloop index=z from="1" to =#x#>
  123.         <cfoutput>    
  124.             <cfset sub_total=#checked_id[z][2]# * #checked_id[z][5]#>
  125.             <cfset GrossTotal=GrossTotal+sub_total>
  126.             <TD align="left">#checked_id[z][3]#</TD>
  127.             <TD align="right">#checked_id[z][2]#</TD>
  128.             <TD align="left">#checked_id[z][4]#</TD>
  129.             <TD align="right">#checked_id[z][5]#</TD>
  130.             <TD align="right">#sub_total#</td>
  131.             </tr>
  132.         </cfoutput>
  133.         </cfloop>
  134.         </table>
  135.         <cfoutput>
  136.         <h2 align="right">┴`├BíG#GrossTotal#<br>
  137.         </cfoutput>
  138.         <hr>
  139.         <h2 align="center">┼U½╚╕Ω«╞
  140.         <h4 align="left">
  141.         <cfFORM ACTION="calcu2.cfm">        
  142. <pre>
  143. ⌐m        <CFINPUT TYPE="text" NAME="family_name" 
  144.             REQUIRED="Yes" 
  145.             MESSAGE="⌐mñ@─µª│╗~" 
  146.             SIZE="25"
  147.             MAXLENGTH="50">
  148. ªW        <CFINPUT TYPE="text" 
  149.             NAME="given_name" 
  150.             REQUIRED="Yes" 
  151.             MESSAGE="ªWñ@─µª│╗~" 
  152.             SIZE="25"
  153.             MAXLENGTH="50">
  154. ªaº}        <CFINPUT TYPE="text" NAME="address" 
  155.             REQUIRED="Yes" 
  156.             MESSAGE="ªaº}ñ@─µª│╗~" 
  157.             SIZE="50"
  158.             MAXLENGTH="50">
  159. ╣q╕▄        <CFINPUT TYPE="text" NAME="tel" 
  160.             REQUIRED="Yes" 
  161.             MESSAGE="╣q╕▄ñ@─µª│╗~" 
  162.             SIZE="8"
  163.             MAXLENGTH="8">
  164. ╢╟»u        <TD align="left"><CFINPUT TYPE="text" 
  165.             NAME="fax" 
  166.             REQUIRED="no" 
  167.             MESSAGE="╢╟»uñ@─µª│╗~" 
  168.             SIZE="8"
  169.             MAXLENGTH="8">
  170. ╣q╢l        <CFINPUT TYPE="text" 
  171.             NAME="email" 
  172.             REQUIRED="no" 
  173.             MESSAGE="╣q╢lñ@─µª│╗~" 
  174.             SIZE="50"
  175.             MAXLENGTH="50">
  176. ÑI┤┌ñΦªí     <CFINPUT TYPE="radio" NAME="payby" 
  177.             checked="yes" 
  178.             VALUE="creditcard">½HÑ╬Ñd
  179.         <CFINPUT TYPE="radio" NAME="payby" 
  180.             VALUE="cash">▓{¬≈
  181.         <CFINPUT TYPE="radio" NAME="payby" 
  182.             VALUE="cheque">ñΣ▓╝
  183. ½HÑ╬Ñd        <CFINPUT TYPE="text" NAME="visa" 
  184.             REQUIRED="no"     
  185.             MESSAGE="½HÑ╬Ñd╕╣╜Xª│╗~" 
  186.             SIZE="16" 
  187.             MAXLENGTH="16" 
  188.             validate="creditcard">
  189.  
  190. <INPUT TYPE="Submit" VALUE="¡q┴╩">    <INPUT Type="reset" Value="▓M░ú─µª∞">
  191. <pre>
  192. <hr>    
  193.     <cfoutput>
  194.     <INPUT type="hidden" NAME="family_name_required" VALUE="ºA┴┘¿S┐ΘñJ⌐m">
  195.     <INPUT type="hidden" NAME="given_name_required" VALUE="ºA┴┘¿S┐ΘñJªW">
  196.     <INPUT type="hidden" NAME="address_required" VALUE="ºA┴┘¿S┐ΘñJªaº}">
  197.     <INPUT type="hidden" NAME="tel_required" VALUE="ºA┴┘¿S┐ΘñJ╣q╕▄">    
  198.     <input type="hidden" name="selected_prodid" value=#idSelected#>
  199.     <input type="hidden" name="selected_prodqty" value=#qtyselected#>
  200.     </cfoutput>
  201.     
  202.     
  203. </cfFORM>    
  204. </cfif>
  205. </cfif>
  206. </body>
  207. </html>