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

📄 index2.jsp

📁 jsp写的一个简单的售药系统(系统需求分析).采用sql2000数据库,通过odbc连接
💻 JSP
📖 第 1 页 / 共 2 页
字号:
					SelMatch(document.all.ypbh);
                   }
                    msg.appendChild(selText);
                    n++;
               }
             }
        }
        else {
            document.all.msg.style.display="none";
        }
    }
    else {
        //press down key
        if(event.keyCode==40){
            j++;
            for (var i=0; i<src.length; i++)
            {
                tmpObj = document.getElementById("selText"+i);
                if(tmpObj != null){
                    tmpObj.style.backgroundColor='#ffffff'; 
                    tmpObj.style.color ='#000000';
                }                
            }
            tmpObj = document.getElementById("selText"+j);
            if(tmpObj != null){
                tmpObj.style.backgroundColor='#003399';   
                tmpObj.style.color ='#ffffff'; 
            }else{
                j = 0;
            }            
        }
        //press up key
        if (event.keyCode==38){
            j--;
            for (var i=0; i<src.length; i++)
            {
                tmpObj = document.getElementById("selText"+i);
                if(tmpObj != null){
                    tmpObj.style.backgroundColor='#ffffff'; 
                    tmpObj.style.color ='#000000';
                }                
            }
            tmpObj = document.getElementById("selText"+j);
            if(tmpObj != null){
                tmpObj.style.backgroundColor='#003399';   
                tmpObj.style.color ='#ffffff'; 
            }else{
                j = 2;
            }        
        }
        //press enter key
        if (event.keyCode==13){
            tmpObj = document.getElementById("selText"+j);
            document.all.box2.value = tmpObj.innerHTML;
            msg.style.display="none";
            document.getElementById("txtSection").value=tmpObj.value;
        }
    }
}

function SelMatch(src)
{
    var currSel = document.all.box2.value;
    for (var i=0;i<src.length;i++){
        if (src(i).text==currSel)
        {
            src.options(i).selected = true;
			if(src(i).value != '') setCity(src.options(i).value);
        }        
    }
}

function NoMsg()
{    
    if(document.activeElement.id=="msg") 
        return false; 
    else
        document.all.msg.style.display='none';
}

//-->
  </Script>
	<script type="text/javascript">
		
		//定义临时参数id
var param_show_oldid="";
var param_show_number=0;
//鼠标移入到td区域,打开‘参数纠错’
function open_modify_div(param_id,kb){
	if (!(document.getElementById(param_id+'_3'))){
		if (param_show_number==1){
				var param_span_show='';
				param_span_show = document.getElementById(param_show_oldid+'_3');
				document.getElementById(param_show_oldid+'_2').removeChild(param_span_show);
				param_show_number--;	
				param_show_oldid="";
			}
		param_show_number++;
		param_show_oldid = param_id;
		var param_span_show='';
		param_span_show += '<span id="'+param_id+'_3" style="float:right;" bgcolor="#ffffff">';
		param_span_show += '<img src="./e2.gif" style="margin:7px">';
		param_span_show += '<a href="./index2.jsp?xzh='+kb+'&a0='+<%= request.getParameter("a0")%>+'">删除错误</a></span>';
		document.getElementById(param_id+'_2').innerHTML = param_span_show + document.getElementById(param_id+'_2').innerHTML;
	}
			//<span id="param_4871_3" style="float:right;" class="param_td1" bgcolor="#ffffff"><img src="http://icon.zol.com.cn/detail0802/e2.gif" style="margin:7px"><a href="javascript:modify_param('param_4871','133527','1');">参数纠错</a></span>
	return false;
}

		
		</script>
</head>

<body>
<form id="form1" name="form1" method="POST" action="index2.jsp">
  <table width="632" border="1">
    <tr>
      <th width="250" >药品编号</th>
      <th >批号</th>
      <th >数量</th>
      <th >金额:</th>
    </tr>
    <tr>
      <td>
<div style="position:relative;">   
<div style="margin-left:233px;width:18px;overflow:hidden;">  

<select style="HEIGHT: 22px; WIDTH: 250px; margin-left:-232px;" onchange="SelectValue(this) ;if(this.value != '') setCity(this.options[this.selectedIndex].value);" onclick="SelMatch(this)"   name="ypbh" id="ypbh" >
        <option value="">-请选择-</option>
        <%
while (Recordset1_hasData) {
%><option value="<%=Recordset1.getObject("ypbh")%>"><%=Recordset1.getObject("pm")%></option><%
  Recordset1_hasData = Recordset1.next();
}
Recordset1.close();
StatementRecordset1.close();
ConnRecordset1.close();
%>
      </select>
<input name="box2" id="box2" style="width:230px;position:absolute;left:0px;" onkeyup="InputValue(this)"  onblur="NoMsg()" onfocus="this.select();InputValue(this)" >   
<div id="msg" style="border:1px  solid green;  font-size :14PX;white-space:nowrap;overflow:hidden;
width:230px;position:absolute;left:0px;top:20px;display:none"></div></div>
    <Input Type="Hidden" Name="txtSection" id="txtSection">
</div>

</td>
      <td><select name="ph" id="ph">
        <option value="">-请选择-</option>
      </select>
</td>
      <td><input type="text" name="sl" id="sl"  onchange="if(this.value != '') setjine(this.value);"/></td>
      <td> ¥:<input type="text" name="je" id="je" /></td>
    </tr>
  </table>
  <p>
    <input type="submit" name="button" id="button" value="增加" />
    <input name="a0" type="hidden" id="a0" value="<%= ((request.getParameter("a0")!=null)?request.getParameter("a0"):"") %>" />
    <input name="xzh" type="hidden" id="xzh" value="111" />
  </p><p>&nbsp;
  <table width="710" border="1">
    <tr>
    <th  >细则号</th>
      <th  >药品名称</th>
      <th >批号</th>
      <th >数量</th>
      <th >金额</th>
    </tr>
    <%
	if(request.getParameter("xzh")!=null)
	{    
	String sssq2="delete from dbo.xsdxz where djh="+request.getParameter("a0").toString()+" and xzh="+request.getParameter("xzh").toString();

Driver DriverPrepared1 = (Driver)Class.forName(MM_syxt_DRIVER).newInstance();
Connection ConnPrepared1 = DriverManager.getConnection(MM_syxt_STRING,MM_syxt_USERNAME,MM_syxt_PASSWORD);
PreparedStatement Prepared1 = ConnPrepared1.prepareStatement(sssq2);
Prepared1.executeUpdate();


ConnPrepared1.close();

	}
	
	%>
    
    
    <%
Driver DriverRecordset0 = (Driver)Class.forName(MM_syxt_DRIVER).newInstance();
Connection ConnRecordset0 = DriverManager.getConnection(MM_syxt_STRING,MM_syxt_USERNAME,MM_syxt_PASSWORD);
PreparedStatement StatementRecordset0 = ConnRecordset0.prepareStatement("SELECT xzh,dbo.xsdxz.ypbh,pm,ph,sl,je FROM dbo.xsdxz,dbo.ypms where djh=? and dbo.ypms.ypbh=dbo.xsdxz.ypbh");
StatementRecordset0.setObject(1, request.getParameter("a0"));
ResultSet Recordset0 = StatementRecordset0.executeQuery();
boolean Recordset0_isEmpty = !Recordset0.next();
boolean Recordset0_hasData = !Recordset0_isEmpty;
Object Recordset0_data;
int Recordset0_numRows = 0;
%>
    
    
     <%
	 String xzh="";
while (Recordset0_hasData) {
xzh=Recordset0.getObject("xzh").toString();
String t01=Recordset0.getObject("ypbh").toString();

%>



    <tr onmouseover="open_modify_div('param_<%=xzh%>','<%=xzh%>')">
    <td id="param_<%=xzh%>_2"  align="center">&nbsp;<%=xzh%></td>
      <td align="center">&nbsp;<%=Recordset0.getObject("pm")%></td>
      <% String t02=Recordset0.getObject("ph").toString();  %>
      <td align="center">&nbsp;  <%=t02%></td>
      <% 
	  

	  Driver DriverRecordset00 = (Driver)Class.forName(MM_syxt_DRIVER).newInstance();
Connection ConnRecordset00 = DriverManager.getConnection(MM_syxt_STRING,MM_syxt_USERNAME,MM_syxt_PASSWORD);
PreparedStatement StatementRecordset00 = ConnRecordset00.prepareStatement("SELECT sl FROM dbo.kc where ypbh="+t01+" and ph="+t02);
ResultSet Recordset00 = StatementRecordset00.executeQuery();
boolean Recordset00_isEmpty = !Recordset00.next();
boolean Recordset00_hasData = !Recordset00_isEmpty;
Object Recordset00_data;
slst=Integer.parseInt(Recordset00.getObject("sl").toString());


Recordset00.close();
StatementRecordset00.close();
ConnRecordset00.close();

	  
	  
	  
	  
	  int sls=Integer.parseInt(Recordset0.getObject("sl").toString());
	  String jet=" ¥:"+Recordset0.getObject("je").toString()+sls+slst;
	  if(slst<sls)
	  {
	  jet="库存只有"+slst+",消除此项请按删除,或<a href=\".\\qxjy.jsp?a0="+request.getParameter("a0")+"\">取消交易</a>、<a href=\".\\scb.jsp?ypbh="+t01+"&ph="+t02+"&sl="+(sls-slst)+"\">提交库存不足到生产部</a>";
	  
	  }
  
	   %>
      
      <td align="center">&nbsp;<%=sls%></td>
      <td align="center">&nbsp;<%=jet%></td>
    </tr>
        <%
  Recordset0_hasData = Recordset0.next();
}
Recordset0.close();
StatementRecordset0.close();
ConnRecordset0.close();
%>



  </table>
  </p>
  <input type="hidden" name="MM_insert" value="form1" />
</form>
<form id="form2" name="form2" method="post" action="index3.jsp">
<input name="a0" type="hidden" id="a0" value="<%= ((request.getParameter("a0")!=null)?request.getParameter("a0"):"") %>" />
<input name="a1" type="hidden" id="a1" value="1" />
<input name="button2" type="submit" id="button2" value="完成,生成销售单" />
</form>
</body>
</html>

⌨️ 快捷键说明

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