爱问知识人 爱问教育 医院库

如何实现统计入住天数和结算折扣

首页

如何实现统计入住天数和结算折扣

在客户入住的那天起到退房结算,jsp或javascript代码是怎样计算入住期间的天数和实现会员打折结算的(结算金额是除去押金和折扣)。(希望各位能给出详细的代码!谢谢!)

提交回答

全部答案

    2009-01-17 11:25:27
  •     主程序是名为 ErrorCheck。Java ,有了这个 ErrorCheck 的 Bean,我们就再也不用为了表单校验去写那一大堆烦人的 javascript 代码了。ErrorCheck 类已帮我们生成了几乎所有你将会用到的校验方法,如是否为数字,长度的校验,是否为合法email等,你只需在 jsp 页面里调用相应的函数就可以了。
            目前一共有七个函数:      一 检测是否为数字   //输入输入框名和错误提示信息   numericCheck(String inputName,String errorMsg);      二 检测email是否合法   //输入输入框名和错误提示信息   emailCheck(String inputName,String errorMsg);      三 检测电话号码是否合法   //输入输入框名和错误提示信息   telCheck(String inputName,String errorMsg);      四 检测字串长度是否在规定范围那内   //输入输入框名,错误提示信息,最小长度,最大长度   lengthCheck(String inputName,String errorMsg,int min,int max);      五 检测字串中是否不含禁止的字串   //输入输入框名,错误提示信息,禁止字串   denyStrCheck(String inputName,String errorMsg,String str);      六 检测字串中是否含给定字串   //输入输入框名,错误提示信息,指定字串   stringCheck(String inputName,String errorMsg,String str);      七 检测日期格式是否为"yyyy-mm-dd"   //输入输入框名和错误提示信息   dateCheck(String inputName,String errorMsg);      只要调用一下这个bean,然后用setFromName()设定你的表单名,再调用以上函数,最后 intln(yourID。
      ErrorCheckScript()),就输出了一段 JavaScript 代码了,当然了,别忘了这个      ok,just enjoy it,今天太累,不想多少,有任何意见请写信给我或在我主页上留言。      注:我调试 errorcheck。
      jsp 的时候因服务器的问题不知为何不能用 usebean,setProperty 的方法,只好 new 了一下,我想你们是应该可以用useBean和setProperty的,自己改一下吧。      ===================================== errorcheck。
      jsp =====================================                              Errocheck Test            input a number:
            input a emial:
            input a telephone:
            input a string (length should between 6-8):
            input a string (shoulde not contain"jeru"):
            input a string (must contain"jeru"):
            input a date (yyyy-mm-dd):
            
                  ===================================== ErrorCheck。
      java =====================================      package dbclass;   /**   * ErrorCheck v 1。0   *   * 这个类是用来在客户端生成 JavaScript 代码来校验表单的   * 原是版本是同事 Macro 用 PHP 写的,我感觉十分好用,再也   * 不用再为那些表单区写烦人的 javascript 代码拉,感谢他!   * 这次我用 Java 改写,封装成一个类,并修复了少许的 bug,加   * 多了一条校验的功能,它的扩展性很好,以后可能会继续完善。
         *   * Mender :   *   Jeru Liu   * Homepage :   *     * Email: jeru@   *   */      import 。*;      public class ErrorCheck  {        /* public: the javascript string */   String errorCheckStr;        /* public: the form name you used */   public String formName;      public void setFormName(String formName) {     rmName = formName;   }      /***************************************************************************\    *    public: constrUCtor functions    *    构造函数   \***************************************************************************/   public ErrorCheck()  {         rorCheckStr =      ""+"\n"+      ""+"\n"+      ""+"\n";     return rorCheckStr;    }         /***************************************************************************\     *    public: check the numeric     *    检查录入框值是否是数字    \***************************************************************************/    public void numericCheck(String inputName, String errorMsg)  {      rorCheckStr +=      " if(fucCheckNUM(document。
      "+formName+"。"+inputName+"。value) == 0) {"+"\n"+      "  alert(\""+errorMsg+"。\");"+"\n"+      "  document。"+formName+"。
      "+inputName+"。focus();"+"\n"+      "  return(false);"+"\n"+      " }"+"\n\n";        }       /***************************************************************************\     *    public: check the length     *    检查录入框值的长度    \***************************************************************************/    public void lengthCheck(String inputName, String errorMsg, int MinLength, int MaxLength) {      rorCheckStr +=      " if(fucCheckLength(document。
      "+formName+"。"+inputName+"。value)"+MaxLength+") {"+"\n"+      "  alert(\""+errorMsg+"。\");"+"\n"+      "  document。"+formName+"。
      "+inputName+"。focus();"+"\n"+      "  return(false);"+"\n"+      " }"+"\n\n";    }         /***************************************************************************\     *    public: check the email     *    检查录入框值是否是正确的EMAIL格式    \***************************************************************************/    public void emailCheck(String inputName, String errorMsg)  {      rorCheckStr +=      " if(chkemail(document。
      "+formName+"。"+inputName+"。val 。

    s***

    2009-01-17 11:25:27

类似问题

换一换
  • 程序设计 相关知识

  • 电脑网络技术
  • 电脑网络

相关推荐

正在加载...
最新资料 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):