⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 js.jsp

📁 用java编写的网络架构程序
💻 JSP
字号:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="com.baosight.project.db.result.*"%>
<%@ page import="com.baosight.project.vo.CommonVo"%>
<%@ page import="com.baosight.project.util.*"%>

<script language='javascript'>
//查询按钮JS
function searchJs() {
  document.forms[0].TYPE.value = '1';
  //屏蔽所有按钮,只有在提交按钮中使用,弹出窗口的按钮不要使用屏蔽功能
  disAll();
  searchJsValue();
}
//到按钮JS
function goJs() {
  if(forwardCheck( "OPERATETYPE","Q","查询" )==false)return false;
  document.forms[0].TYPE.value = '2';
  pageSubmit();
}
//确认按钮JS
function confirmJs() {
  if(forwardCheck( "OPERATETYPE","Q","查询")==false)return false;
  //发票的报支状态必须为'0',否则不能修改
  if(document.forms[0].elements["FCWFP07__BILL_STATUS"].value!='0')
    {
	alert("发票的报支状态必须为'0',否则不能修改!");
        return false;
    }

  //获得FORM的长度
  var length=document.forms[0].length;

  //为删汇总判断设置标志
  var check_flag="N";
  var checklen=0;
  //计算总行数
  for (num=0;num<length;num++)
  {
    if (document.forms[0].elements[num].type=="checkbox")  checklen=checklen+1;
  }

  //对界面中的多行数据进行循环判断
  for (i=1;i<checklen;i++)
  {  if (document.forms[0].elements["C"+i].checked)
    {
       //存在被选择的项
       check_flag="Y";
    }
   }
 if (check_flag!="Y")
 {
   alert("您没有选择抵库的信息");
   return false;
 }

  //获得记录条数
  var rowcount=-1;
  for(i=0;i<length;i++){
    if(document.forms[0].elements[i].type=="checkbox" ){
     rowcount=rowcount+1;
     }
  }
  var sum=0;//开票金额的累计和
  var sum_tax=0;//开票税额的累计和
  for(index=1;index<=rowcount;index++){
    if(document.forms[0].elements["C"+index].checked){
      sum =sum*1 + (document.forms[0].elements[ "FCWFP07_OP__LIST_AMT"+ index ].value)*1;
      sum_tax =sum_tax*1 + (document.forms[0].elements[ "FCWFP07_OP__TAX_AMT"+ index ].value)*1;
    }
    //检核开票税额差额不得大于0.5
    if(balanceJs(index)==false) return false;
  }
  sum=Math.round(sum*100.0)/100.0;
  sum_tax=Math.round(sum_tax*100.0)/100.0;
  var vInvoiceAmt=document.forms[0].elements[ "FCWFP07__INVOICE_AMT"].value;//发票金额
  var vInvoiceTaxAmt=document.forms[0].elements[ "FCWFP07__TAX_AMT"].value;//发票税额
  if(sum*1!=vInvoiceAmt*1){
  	  alert("开票金额之和不等于发票金额!");
     return false;
  }
   if(sum_tax*1!=vInvoiceTaxAmt*1){
  	  alert("开票税额之和不等于发票税额!");
     return false;
  }
  if(window.confirm("确定修改吗?")==false)return false;
  document.forms[0].TYPE.value = '3';
  pageSubmit();
}
//根据金额变化计算税额和总额
function calculateJs(index){
    //开票金额必须为非空的正实数
      if(validateSelf("FCWFP07_OP__LIST_AMT" + index,"E0001","LIST_AMT")!="" ||
       validateSelf("FCWFP07_OP__LIST_AMT" + index,"N0005","LIST_AMT")!=""){
        alert("第" + index + "条记录的本次开票金额字段必须为非空并且小数位最多为两位的实数!");
        return false;
      }
    var vListAmt = document.forms[0].elements["FCWFP07_OP__LIST_AMT" + index].value;//开票金额
    var vArriveSum = document.forms[0].elements["FCWFP07_OP__ARRIVE_SUM_HIDDEN" + index].value;//抵库合同总价
    if(vListAmt*1>vArriveSum*1){
    	alert("第"+index+"条记录的开票金额必须小于或等于抵库合同总价!");
        return false;
    }
    var vTaxAmt = vListAmt *(document.forms[0].elements["FCWFP07__TAX_RATE"].value)*0.01;//税额
    var vListAmtTot = vListAmt*1.0 + vTaxAmt*1.0;//总额
    vTaxAmt=Math.round(vTaxAmt*100.0)/100.0;
    vListAmtTot=Math.round(vListAmtTot*100.0)/100.0;
    document.forms[0].elements["FCWFP07_OP__TAX_AMT" + index].value = vTaxAmt;
    document.forms[0].elements["FCWFP07_OP__LIST_AMT_TOT" + index].value = vListAmtTot;
}

//根据税额变化计算总额
function TaxAmt_calculateJs(index){
    var vListAmt = document.forms[0].elements["FCWFP07_OP__LIST_AMT" + index].value;//开票金额
    var vTaxAmt = document.forms[0].elements["FCWFP07_OP__TAX_AMT"+index].value;//税额

    //检核开票税额差额不得大于0.5
    if(balanceJs(index)==false) return false;

    var vListAmtTot = vListAmt*1.0 + vTaxAmt*1.0;//总额

    vListAmtTot=Math.round(vListAmtTot*100.0)/100.0;

    document.forms[0].elements["FCWFP07_OP__LIST_AMT_TOT" + index].value = vListAmtTot;
}

function detailJs() {
  var val = document.forms[0].elements["FCWFP07__INVOICE_ID"].value;
  location.href = "PCWFP06?WINDOW=open&PCWFP06__INVOICE_ID_S=" + val + "&TYPE=1&PAGE=1";
}

function showJs() {
  <%
    DbAccess da = new DbAccess();
    CommonVo vo = ( CommonVo )request.getAttribute( "VALUE_OBJECT" );
    int iRowCount = MyStr.intOf(vo.get("Length"));
    for(int i=1;i <= iRowCount;i++){
      String sInvoiceId = vo.get( "FCWFP07__INVOICE_ID" );
      String sArriveId = vo.get( "FCWFP07_OP__ARRIVE_ID_HIDDEN" + i);
      String sPurcPlnDtlId = vo.get( "FCWFP07_OP__PLAN_ID_HIDDEN" + i);
      String sReqPlnId = vo.get( "FCWFP03_OP__REQ_PLN_ID_HIDDEN" + i);
       String sql = "SELECT LIST_AMT,TAX_AMT,LIST_AMT_TOT FROM CWGL_B_INVOICE_LIST "
                 + " WHERE INVOICE_ID ='" + sInvoiceId + "' AND ARRIVE_ID = '" + sArriveId + "' AND PURC_PLN_DTL_ID='"+sPurcPlnDtlId+"' AND REQ_PLN_ID='"+sReqPlnId+"'";
       DbResult sqlR = da.queryAll(sql);
      sqlR.goTop();
      if(!sqlR.empty()) {
        out.println("document.forms[0].FCWFP07_OP__LIST_AMT" + i + ".value ='" + sqlR.valueOf("LIST_AMT")+"';");
        out.println("document.forms[0].FCWFP07_OP__LIST_AMT_H" + i + ".value ='" + sqlR.valueOf("LIST_AMT")+"';");
        out.println("document.forms[0].FCWFP07_OP__TAX_AMT" + i + ".value ='" + sqlR.valueOf("TAX_AMT")+"';");
        out.println("document.forms[0].FCWFP07_OP__TAX_AMT_H" + i + ".value ='" + sqlR.valueOf("TAX_AMT")+"';");
        out.println("document.forms[0].FCWFP07_OP__LIST_AMT_TOT" + i + ".value ='" + sqlR.valueOf("LIST_AMT_TOT")+"';");
        out.println("document.forms[0].C" + i + ".checked = true;");
      }else{
        out.println("document.forms[0].FCWFP07_OP__LIST_AMT" + i + ".value ='0';");
        out.println("document.forms[0].FCWFP07_OP__LIST_AMT_H" + i + ".value ='0';");
        out.println("document.forms[0].FCWFP07_OP__TAX_AMT" + i + ".value ='0';");
        out.println("document.forms[0].FCWFP07_OP__TAX_AMT_H" + i + ".value ='0';");
        out.println("document.forms[0].FCWFP07_OP__LIST_AMT_TOT" + i + ".value ='0';");
      }
    }
   %>

}

//检核开票税额差额不得大于0.5
function balanceJs(index){
  //理论计算的税额
  var x=document.forms[0].elements["FCWFP07_OP__LIST_AMT"+index].value;//本次开票金额
  var y=document.forms[0].elements["FCWFP07__TAX_RATE"].value;//税率
  var z=x*y*0.01;
  z=Math.round(z*100)/100;

  //输入的税额
  var vTAX_R = document.forms[0].elements["FCWFP07_OP__TAX_AMT"+index].value;
  if( Math.abs(z*1 - vTAX_R) > 0.5 ){
    alert("第"+index+"条输入的税额与理论税额之差额不得大于0.5,请重新输入税额!");
    document.forms[0].elements["FCWFP07_OP__TAX_AMT"+index].value=document.forms[0].elements["FCWFP07_OP__TAX_AMT_H"+index].value;
    return false;
  }
}
</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -