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

📄 purchasedetail.asp

📁 本系统是基于B/S结构的客户关系管理系统. 测试管理员和密码是super 用户名super 密码super 前台和后台是一次性同时登陆的 系统工能介绍: 客户管理---------- 添
💻 ASP
字号:
<!--#include file="../function/connect.asp"-->
<!--#include file="../function/function.asp"-->
<%
Purchase_ID=request("Purchase_ID")
if Purchase_ID="" then
	response.write "参数错误"
	response.end
end if

if request("meth")="del" then
	strsql="delete from PurchaseDetails where Purchase_Detail_ID in (" & request("Purchase_Detail_ID") & ")"
	'response.write strsql
	objConn.execute strsql
end if

strsql="select pd.*,p.product_name,c1.cat1_name,c2.cat2_name from PurchaseDetails pd,products p,cat1 c1,cat2 c2 where  pd.Product_ID=p.Product_ID and Product_Category_ID=c1.cat1_id and Product_CategoryII_ID=c2.cat2_id and Purchase_ID=" & Purchase_ID
Set objRs = Server.CreateObject("adodb.recordset")
    objRs.Open strsql,objConn,1,1
%>
<html>
<head>
<title>购买明细</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../cssD.css" rel=stylesheet>
<style>
BODY {
	BACKGROUND-COLOR: #FFFFFF; BORDER-RIGHT: #000000 0px outset; COLOR: #000000; FONT-SIZE: 9pt; LINE-HEIGHT: 14px; MARGIN-LEFT: 0px; MARGIN-TOP: 0px; TEXT-DECORATION: none; SCROLLBAR-FACE-COLOR: #333333; SCROLLBAR-HIGHLIGHT-COLOR: #FFFFFF; MARGIN-LEFT: 0px; SCROLLBAR-SHADOW-COLOR: #000000; SCROLLBAR-3DLIGHT-COLOR: #000000; SCROLLBAR-ARROW-COLOR: #ffffff; SCROLLBAR-DARKSHADOW-COLOR: #000000
}
</style>
<script>
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	function fnDo(strTable,strFIdName,strIdName,strIDValue,strShowName)
	{
		var xmlDom = new ActiveXObject("Msxml2.DOMDocument"); 
		var strURL = "GetCity.asp?strIDValue=" + strIDValue + "&strIdName="+strIdName+"&strTable="+strTable+"&strShowName="+strShowName+"&strFIdName="+strFIdName;
		//alert(strURL);
		
		xmlhttp.Open("POST",strURL , true);
		xmlhttp.onreadystatechange = fnRun;
		
		xmlhttp.Send(xmlDom);
	}
	//--------------------------------------------------------
	function fnRun()
	{
		var state = xmlhttp.readyState;
		var xmlDom = new ActiveXObject("Msxml2.DOMDocument");
	
		if (state == 4)
		{
			xmlDom.loadXML(xmlhttp.responseXML.xml);
			//alert(xmlDom.documentElement.selectSingleNode("//objXML").text)
			var getInfo = xmlDom.documentElement.selectSingleNode("//objXML").text;
			//alert(getInfo);
			subcat = new Array();
			eval(getInfo);
			changelocation(subcat)
		} 
	}
	function changelocation(subcat)
	{
		
		document.form2.Product_CategoryII_ID.length = 0;
		var i;
		document.form2.Product_CategoryII_ID.options[0] = new Option('====选择====','');
		for (i=0;i <subcat.length; i++)
		{
			document.form2.Product_CategoryII_ID.options[document.form2.Product_CategoryII_ID.length] = new Option(subcat[i][0], subcat[i][1]);
		}
	}
	
	
	xmlhttp1 = new ActiveXObject("Msxml2.XMLHTTP");
	function fnDo1(strTable,strFIdName,strIdName,strIDValue,strShowName)
	{
		var xmlDom1 = new ActiveXObject("Msxml2.DOMDocument"); 
		var strURL = "GetCity.asp?strIDValue=" + strIDValue + "&strIdName="+strIdName+"&strTable="+strTable+"&strShowName="+strShowName+"&strFIdName="+strFIdName;
		//alert(strURL);
		
		xmlhttp1.Open("POST",strURL , true);
		xmlhttp1.onreadystatechange = fnRun1;
		
		xmlhttp1.Send(xmlDom1);
	}
	//--------------------------------------------------------
	function fnRun1()
	{
		var state = xmlhttp1.readyState;
		var xmlDom = new ActiveXObject("Msxml2.DOMDocument");
	
		if (state == 4)
		{
			xmlDom.loadXML(xmlhttp1.responseXML.xml);
			//alert(xmlDom.documentElement.selectSingleNode("//objXML").text)
			var getInfo = xmlDom.documentElement.selectSingleNode("//objXML").text;
			//document.write(getInfo);
			subcat = new Array();
			eval(getInfo);
			changelocation1(subcat)
		} 
	}
	function changelocation1(subcat)
	{
		
		document.form2.Product_ID.length = 0;
		var i;
		document.form2.Product_ID.options[0] = new Option('====选择====','');
		for (i=0;i <subcat.length; i++)
		{
			document.form2.Product_ID.options[document.form2.Product_ID.length] = new Option(subcat[i][0], subcat[i][1]);
		}
	}
	
	
	xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
	function fnDo2(strTable,strIdName,strIDValue,strShowValue,strField)
	{
		var xmlDom2 = new ActiveXObject("Msxml2.DOMDocument"); 
		var strURL = "GetCode.asp?strIDValue=" + strIDValue + "&strIdName="+strIdName+"&strTable="+strTable+"&strShowValue="+strShowValue+"&strField="+strField;
		//alert(strURL);
		
		xmlhttp2.Open("POST",strURL , true);
		xmlhttp2.onreadystatechange = fnRun2;
		
		xmlhttp2.Send(xmlDom2);
	}
	//--------------------------------------------------------
	function fnRun2()
	{
		var state = xmlhttp2.readyState;
		var xmlDom22 = new ActiveXObject("Msxml2.DOMDocument");
	
		if (state == 4)
		{
			xmlDom22.loadXML(xmlhttp2.responseXML.xml);
			//alert(xmlDom.documentElement.selectSingleNode("//objXML").text)
			var getInfo = xmlDom22.documentElement.selectSingleNode("//objXML").text;
			//alert(getInfo);
			eval(getInfo);
		} 
	}
</script>
<script>
	function check2(){
		if(document.form2.Product_Category_ID.value==""){
			alert("产品大类不能为空");
			document.form2.Product_Category_ID.focus();
			return false;
		}
		if(document.form2.Product_CategoryII_ID.value==""){
			alert("产品小类不能为空");
			document.form2.Product_CategoryII_ID.focus();
			return false;
		}
	}
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="102%" border="1" cellspacing="0" cellpadding="2" bordercolorlight='#000000' bordercolordark='#FFFFFF'>
  <form name="form1" method="post" action="purchasedetail.asp">
          <tr> 
            <td height="22" colspan="8" class="tablehead"> 
              <div align="center">进货明细</div><input type="checkbox" name="Purchase_Detail_ID" value="0" disabled style="display:none;">
            </td>
          </tr>
          <tr class="tablehead2" align="center"> 
            <td height="22" width="2%"> 
              <input type="checkbox" name="checkall" value="1" onclick="checkAll();">
            </td>
            <td height="22" nowrap>产品</td>
            <td height="22" width="10%" nowrap>产品大类</td>
            <td height="22" width="10%" nowrap>产品小类</td>
            <td height="22" width="9%" nowrap>单价</td>
            <td height="22" width="10%" nowrap>进货数量</td>
            <td height="22" width="9%" nowrap>折扣</td>
            <td width="9%" nowrap>金额</td>
          </tr>
          <%if not objrs.eof then
          	do while not objrs.eof
          %>
          <tr align="center"> 
            <td height="22" width="2%" nowrap><input type="checkbox" name="Purchase_Detail_ID" value="<%=objrs.fields("Purchase_Detail_ID")%>"></td>
            <td height="22" nowrap><%=objrs.fields("product_name")%></td>
            <td height="22" width="9%" nowrap><%=objrs.fields("cat1_name")%></td>
            <td height="22" width="9%" nowrap><%=objrs.fields("cat2_name")%></td>
            <td height="22" width="9%" nowrap><%=objrs.fields("Unit_Price")%></td>
            <td height="22" width="9%" nowrap><%=objrs.fields("Quantity")%></td>
            <td height="22" width="9%" nowrap><%=objrs.fields("Discount")%>%</td>
            <td width="9%" nowrap><%=objrs.fields("Amount")%></td>
          </tr>
          <%
          	objrs.movenext
          	loop
           end if%>
          <tr class="tablehead2"> 
            <td height="22" colspan="7" align="left"> 
                <input type="button" name="Submit" value="  增加  " class="button" onclick="changeDis();">
                <input type="button" name="Submit2" value="  删除  " class="button" onclick="op('del')">
                <input type="button" name="Submit3" value="  修改  " class="button" onclick="op('edit')">
            </td>
            <td width="9%">&nbsp;<input type="hidden" name="Purchase_ID" value="<%=Purchase_ID%>"><input type="hidden" name="meth" value=""></td>
          </tr>
        </form>
      </table>
    
<table width="50%" border="1" cellspacing="0" cellpadding="2" bordercolorlight='#000000' bordercolordark='#FFFFFF' align="center" style="display:none" id="addpurchase">
  <form name="form2" method="post" action="../function/InsertToDB.asp?InsertTable=PurchaseDetails&RedirectUrl=../clients/Purchase.asp?Purchase_ID=<%=Purchase_ID%>" target="_parent" onsubmit="return check2();">
  <tr> 
    <td colspan="2" height="22" class="tablehead"> 
      <div align="center">添加进货明细</div>
    </td>
  </tr>
  <tr> 
    <td width="25%" height="22"> 
      <div align="right">产品大类:</div>
    </td>
    <td width="75%" height="22">
    <select name="Product_Category_ID" onchange="fnDo('cat2','cat2_cat1_id','cat2_id',this.value,'cat2_name');" style="width:100">
    <option value="">====选择====</option>
    <%
    strsql="select * from cat1"
    Set objRs = Server.CreateObject("adodb.recordset")
	objRs.Open strsql,objConn,1,1
	if not objrs.eof then
		do while not objrs.eof
			response.write "<option value=" & objrs.fields("cat1_id") & ">" & objrs.fields("cat1_name") & "</option>"
		objrs.movenext
		loop
	end if
    %>
    </select>
    </td>
  </tr>
  <tr> 
    <td width="25%" height="22"> 
      <div align="right">产品小类:</div>
    </td>
    <td width="75%" height="22">
    <select name="Product_CategoryII_ID" style="width:100" onchange="fnDo1('products','product_cat2_id','product_id',this.value,'product_name');">
    <option value="">====选择====</option>
    </select>
    </td>
  </tr>
   <tr> 
    <td width="25%" height="22"> 
      <div align="right">产品:</div>
    </td>
    <td width="75%" height="22">
    <select name="Product_ID" style="width:150" onchange="fnDo2('products','product_id',this.value,'product_sale_price','document.form2.Unit_Price');">
    <option value="">====选择====</option>
    </select>
    </td>
  </tr>
  <tr> 
    <td width="25%" height="22"> 
      <div align="right">单价:</div>
    </td>
    <td width="75%" height="22">
        <input type="text" name="Unit_Price" size="10" maxlength="10" class="input" value="0">
      </td>
  </tr>
  <tr> 
    <td width="25%" height="22"> 
      <div align="right">进货数量:</div>
    </td>
    <td width="75%" height="22">
        <input type="text" name="Quantity" size="10" maxlength="5" class="input" value="0" onchange="getMoney();">
      </td>
  </tr>
  <tr> 
    <td width="25%" height="22"> 
      <div align="right">折扣:</div>
    </td>
    <td width="75%" height="11">
        <input type="text" name="Discount" size="10" maxlength="5" class="input" value="100" onchange="getMoney();">%
      </td>
  </tr>
  <tr> 
    <td width="25%" height="22"> 
      <div align="right">金额:</div>
    </td>
    <td width="75%" height="22">
        <input type="text" name="Amount" size="20" maxlength="10" class="input" value="0" onclick="getMoney();">
      </td>
  </tr>
  <tr> 
    <td width="25%" height="22">&nbsp;<input type="hidden" name="Purchase_ID" value="<%=Purchase_ID%>"></td>
    <td width="75%" height="22">
        <input type="submit" value="  确定  " class="button" onclick="getMoney();">
        <input type="reset"  value="  重设  " class="button">
      </td>
  </tr>
  </form>
</table>
</body>
</html>
<script>
	function changeDis()
	{
		if(addpurchase.style.display=="none"){
			addpurchase.style.display="";
		}else{
			//addpurchase.style.display="none";
		}
	}
	function getMoney()
	{
		var Unit_Price=document.form2.Unit_Price.value;
		var Quantity=document.form2.Quantity.value;
		var Discount=document.form2.Discount.value;
		var allMoney=0;
		if(isNaN(Unit_Price) || isNaN(Quantity) || isNaN(Discount)){
			alert("请输入数字");
			return false;
		}
		allMoney=Unit_Price * Quantity * Discount /100;
		document.form2.Amount.value=allMoney;
	}
	function op(str){
		if(str=="del"){
			if(checkNum()>=1){
				document.form1.meth.value="del";
				document.form1.submit();
			}else{
				alert("请选择要删除的项目");
			}
		}
		if(str=="edit"){
			if(checkNum()==1){
				document.form1.action="editpurchasedetail.asp";
				document.form1.meth.value="edit";
				document.form1.submit();
			}else{
				alert("只能选择一个要修改的项目");
			}
		}
	}
	
	function checkNum()
	{
		rNum=0;
		var actID=document.all.Purchase_Detail_ID;
		for(i=1;i<actID.length;i++){
			if(actID[i].checked==true){
				rNum=rNum +1 ;
			}
		}
		return rNum;
	}
	function checkAll()
	{
		var actID=document.all.Purchase_Detail_ID;
		if(document.form1.checkall.checked==false){
			for(i=0;i<actID.length;i++){
				actID[i].checked=false;
			}
		}else{
			for(i=0;i<actID.length;i++){
				actID[i].checked=true;
			}
		}
	}
</script>

⌨️ 快捷键说明

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