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

📄 purchase.asp

📁 客户管理crm xitong ,希望能给你带来帮助
💻 ASP
字号:
<!--#include file="../function/connect.asp"-->
<!--#include file="../function/function.asp"-->
<%
	Purchase_ID=request("Purchase_ID")
	if request("submit")<>"" and request("meth")="add" then
		client_ID=request("client_ID")
		Contact_ID=request("Contact_ID")
		Purchase_Date=request("Purchase_Date")
		Purchase_Number=request("Purchase_Number")
		Currency_ID=request("Currency_ID")
		Invoice_ID=request("Invoice_ID")
		Amount=request("Amount")
		Paid_Amount=request("Paid_Amount")
		Invoiced_Amount=request("Invoiced_Amount")
		Note=getString(request("Note"))
		strsql="insert into Purchase(client_ID,Contact_ID,Purchase_Date,Purchase_Number,Currency_ID,Invoice_ID,Amount,Paid_Amount,Invoiced_Amount,[Note],Creator) values('"
		strsql=strsql & client_ID & "','"
		strsql=strsql & Contact_ID & "','"
		strsql=strsql & Purchase_Date & "','"
		strsql=strsql & Purchase_Number & "','"
		strsql=strsql & Currency_ID & "','"
		strsql=strsql & Invoice_ID & "','"
		strsql=strsql & Amount & "','"
		strsql=strsql & Paid_Amount & "','"
		strsql=strsql & Invoiced_Amount & "','"
		strsql=strsql & Note & "','"
		strsql=strsql & session("loginuser") & "')"
		'response.write strsql
		'response.end
		objConn.execute strsql
		strsql="select @@identity as Purchase_ID"
		Set objRs = Server.CreateObject("adodb.recordset")
    		objRs.Open strsql,objConn,1,1
    		Purchase_ID=objrs.fields("Purchase_ID")
    		response.redirect "Purchase.asp?Purchase_ID=" & Purchase_ID
    		response.end
	end if
	
	if request("submit")<>"" and request("meth")="edit" then
		Purchase_ID=request("Purchase_ID")
		client_ID=request("client_ID")
		Contact_ID=request("Contact_ID")
		Purchase_Date=request("Purchase_Date")
		Purchase_Number=request("Purchase_Number")
		Currency_ID=request("Currency_ID")
		Invoice_ID=request("Invoice_ID")
		Amount=request("Amount")
		Paid_Amount=request("Paid_Amount")
		Invoiced_Amount=request("Invoiced_Amount")
		Note=getString(request("Note"))
		strsql="update Purchase set "
		strsql=strsql & "client_ID='"& client_ID & "',"
		strsql=strsql & "Contact_ID='" & Contact_ID & "',"
		strsql=strsql & "Purchase_Date='"& Purchase_Date & "',"
		strsql=strsql & "Purchase_Number='" &Purchase_Number & "',"
		strsql=strsql & "Currency_ID='"&Currency_ID & "',"
		strsql=strsql & "Invoice_ID='"&Invoice_ID & "',"
		strsql=strsql & "Amount='"&Amount & "',"
		strsql=strsql & "Paid_Amount='" & Paid_Amount & "',"
		strsql=strsql & "Invoiced_Amount='" &Invoiced_Amount & "',"
		strsql=strsql & "[Note]='"&Note & "' "
		strsql=strsql & " where Purchase_ID=" & Purchase_ID
		'response.write strsql
		'response.end
		objConn.execute strsql
		response.redirect "Purchase.asp?Purchase_ID=" & Purchase_ID
    		response.end
	end if
	
	if Purchase_ID<>"" then
		strsql="select *,(select sum(Amount) from PurchaseDetails where Purchase_ID=" & Purchase_ID & ") as Amount1 from Purchase where Purchase_ID=" & Purchase_ID
		'response.write strsql
		Set objRs = Server.CreateObject("adodb.recordset")
    		objRs.Open strsql,objConn,1,1
    		if not objrs.eof then
    			client_ID=objrs.fields("client_ID")
			Contact_ID=objrs.fields("Contact_ID")
			Purchase_Date=objrs.fields("Purchase_Date")
			Purchase_Number=objrs.fields("Purchase_Number")
			Currency_ID=objrs.fields("Currency_ID")
			Invoice_ID=objrs.fields("Invoice_ID")
			Amount=objrs.fields("Amount1") & ""
			if Amount="" then
				Amount=objrs.fields("Amount")
			end if
			Paid_Amount=objrs.fields("Paid_Amount")
			Invoiced_Amount=objrs.fields("Invoiced_Amount")
			Note=objrs.fields("Note")
    		end if
    		'response.write Purchase_Number
	end if
%>
<html>
<head>
<title>进货</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../cssD.css" rel=stylesheet>
<STYLE>
	.memusty2{BORDER-BOTTOM: #99ccff 1px inset;BORDER-LEFT: #99ccff 1px inset;BORDER-RIGHT: #99ccff 1px inset;BORDER-TOP: #99ccff 1px inset;COLOR: #ffffff;CURSOR: hand;PADDING-BOTTOM: 3px;PADDING-LEFT: 3px;PADDING-RIGHT: 3px;PADDING-TOP: 3px}
	.tab {BORDER-RIGHT: gray 1px solid; BORDER-TOP: #FFFFFF 1px solid; BORDER-LEFT: #FFFFFF 1px solid; FONT-WEIGHT: normal; FONT-SIZE: 9pt; COLOR:#00000;FONT-FAMILY: Verdana; TEXT-ALIGN: center}
	.selTab {BORDER-RIGHT: black 1px solid; BORDER-TOP: #FFFFFF 2px solid; BORDER-LEFT: white 1px solid; FONT-WEIGHT: normal; FONT-SIZE: 9pt; COLOR:#000000;TEXT-ALIGN: center;}
</STYLE>
<script language = "javascript" src="../function/date-picker.js"></script>
<SCRIPT language="JavaScript">
function init(){
	oldtabContent=t1Contents;
	currentTab = t1;
	tabBase = t1base;
}	
function changeTabs(){
	if(window.event.srcElement.className == "tab"){
		currentTab.className = "tab";		
		tabBase.style.backgroundColor = "white";
		currentTab = window.event.srcElement;
		tabBaseID = currentTab.id + "base";
		tabContentID = currentTab.id + "Contents";
		tabBase = document.all(tabBaseID);
		tabContent = document.all(tabContentID);
		currentTab.className = "selTab";		
		tabBase.style.backgroundColor = "";
		oldtabContent.style.display="none";
		tabContent.style.display="";
		oldtabContent=tabContent;
	}
}
function check(){
	if(document.form1.client_ID.value==""){
		alert("相关客户不能为空");
		document.form1.client_ID.focus();
		return false;
	}
	if(document.form1.Contact_ID.value==""){
		alert("相关联系人不能为空");
		document.form1.Contact_ID.focus();
		return false;
	}
	if(document.form1.Purchase_Number.value==""){
		alert("进货单号不能为空");
		document.form1.Purchase_Number.focus();
		return false;
	}
}

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;
			//document.write(getInfo);
			subcat = new Array();
			eval(getInfo);
			changelocation(subcat)
		} 
	}
	function changelocation(subcat)
	{
		
		document.form1.Contact_ID.length = 0;
		var i;
		document.form1.Contact_ID.options[0] = new Option('====选择====','');
		for (i=0;i <subcat.length; i++)
		{
			document.form1.Contact_ID.options[document.form1.Contact_ID.length] = new Option(subcat[i][0], subcat[i][1]);
			if(subcat[i][1]=='<%=Contact_ID%>')
			{
				document.form1.Contact_ID.options[i+1].selected=true;
			}
		}
	}
</script>
</head>

<body bgcolor="#FFFFFF" scroll=no text="#000000" onclick="changeTabs()" onload="init()">
<table width="102%" border="1" cellspacing="0" cellpadding="2" bordercolorlight='#000000' bordercolordark='#FFFFFF'>
  <tr> 
    <td height="135"> 
      <TABLE style="HEIGHT: 100%; WIDTH:100%" cellSpacing="0" cellPadding="0" bgColor="#D4D0C8" id="Table3" >
      		<form name="form1" method="post" action="Purchase.asp" onsubmit="return check();">
				<TR id=tabtr>
					<TD class="selTab" id="t1" style="height:20;cursor:hand" width=2% nowrap>&nbsp;进货&nbsp; </TD>
					<TD class="tab" id="t2"  style="height:20;cursor:hand" width=2% nowrap>&nbsp;其他信息&nbsp;</TD>
					<TD class="tab" id="t3"   style="height:20;cursor:hand" width=2% nowrap>&nbsp;状态信息&nbsp;</TD>	
					<TD id="lastT" bgcolor="#D4D0C8" style='color:white;font-weight:bold' align=right>&nbsp;</TD>
				</TR>
				<TR id=basetr>
					<TD id="t1base" style="HEIGHT: 1px"></TD>
					<TD id="t2base" style="BACKGROUND-COLOR: white; HEIGHT: 1px"></TD>
					<TD id="t3base" style="BACKGROUND-COLOR: white; HEIGHT: 1px"></TD>
					<TD id="lastbase" style="BACKGROUND-COLOR: white; HEIGHT: 1px"></TD>
				</TR>
				<TR id=contentstr>
					<TD id="tabContents" style="BORDER-BOTTOM:  black 1px solid; BORDER-LEFT: white 1px solid; BORDER-RIGHT:  black 1px solid;padding:4px" colSpan="13" height="*">
					  <center id=t1Contents >
						<table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolorlight='#000000' bordercolordark='#FFFFFF'>
						  <tr> 
						      <td width="20%" height="22"> 
						        <div align="right">产品供应商:</div>
						    </td>
						      <td width="30%" height="22">
						      <select name="client_ID" style='width:150;' onchange="fnDo('Contacts','client_ID','Contact_ID',this.value,'Contact_Name');">
						      <option value="">====选择====</option>
						        <%
						        strsql="select * from clients where client_owner='" & session("loginuser") & "' or IsPublic=1"
						        	Set objRs = Server.CreateObject("adodb.recordset")
						    		objRs.Open strsql,objConn,1,1
						    		if not objrs.eof then
						    			do while not objrs.eof
						    				if client_id & "" =objrs.fields("client_id") & "" then
						    					response.write "<option value=" & objrs.fields("client_id") & " selected>" & objrs.fields("client_name") & "</option>"
						    				else
						    					response.write "<option value=" & objrs.fields("client_id") & ">" & objrs.fields("client_name") & "</option>"
						    				end if
						    			objrs.movenext
						    			loop
						    		end if
						        %>
						        </select>
						      </td>
						      <td width="20%" height="22"> 
						        <div align="right">相关联系人:</div>
						    </td>
						      <td width="30%" height="22">
						      <select name="Contact_ID" style="width:100">
						      	<option value="">====选择====</option>
						      </select>
						      </td>
						  </tr>
						  <tr> 
						      <td width="20%" height="22"> 
						        <div align="right">进货日期:</div>
						    </td>
						      <td width="30%" height="22">
						      <input type="text" size="10" class=input name="Purchase_Date" maxlength="20" onclick="show_calendar('form1.Purchase_Date',null,null,'MM/DD/YYYY')" onmouseover="window.status='选择时间';return true;" onmouseout="window.status='';return true;" value="<%=Purchase_Date%>"><input type="button" class=button value="..." onclick="show_calendar('form1.Purchase_Date',null,null,'YYYY-MM-DD')">
						      </td>
						      <td width="20%" height="22"> 
						        <div align="right">进货单号:</div>
						    </td>
						      <td width="30%" height="22">
						        <input type="text" name="Purchase_Number" class="input" value="<%=Purchase_Number%>">
						      </td>
						  </tr>
						  <tr> 
						      <td width="20%" height="22"> 
						        <div align="right">货币类型:</div>
						    </td>
						      <td width="30%" height="22"><%getSelectedNo "Currency_ID","select * from Dict_Currency ","Currency_Name","Currency_ID",Currency_ID%></td>
						      <td width="20%" height="22"> 
						        <div align="right">发票类型:</div>
						    </td>
						      <td width="30%" height="22"><%getSelectedNo "Invoice_ID","select * from Dict_Invoices ","Invoice","Invoice_ID",Invoice_ID%></td>
						  </tr>
						  <tr> 
						      <td width="20%" height="22"> 
						        <div align="right">总计金额:</div>
						    </td>
						      <td width="30%" height="22">
						        <input type="text" name="Amount" class="input" value="<%=Amount%>">
						      </td>
						      <td width="20%" height="22"> 
						        <div align="right">已付款金额:</div>
						    </td>
						      <td width="30%" height="22">
						        <input type="text" name="Paid_Amount" class="input" value="<%=Paid_Amount%>">
						      </td>
						  </tr>
						  <tr> 
						      <td width="20%" height="22"> 
						        <div align="right">已开票金额:</div>
						    </td>
						      <td width="30%" height="22">
						        <input type="text" name="Invoiced_Amount" class="input" value="<%=Invoiced_Amount%>">
						      </td>
						      <td colspan="2" height="22">&nbsp; 
						      <input type="hidden" name="Purchase_ID" value="<%=Purchase_ID%>">
						      <%if Purchase_ID<>"" then%>
						      <input type="hidden" name="meth" value="edit">
						      <%else%>
						      <input type="hidden" name="meth" value="add">
						      <%end if%>
						    </td>
						  </tr>
						</table>
					  </center>
					  <center id=t2Contents style="display:none">
						<table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolorlight='#000000' bordercolordark='#FFFFFF'>
						  <tr>
						      <td width="16%" height="92"> 
						        <div align="right">备注信息:</div>
						    </td>
						      
                    				<td width="84%" height="92"><textarea name="Note" cols="50" rows="8" class="input"><%=Note%></textarea></td>
						  </tr>
						</table>
					  
                			
              				  </center>
					  <center id=t3Contents style="display:none">
						待定义
					  </center>
					  </TD>
				</TR>
				<tr>
					<td colspan="4" align="center" height=25 >
							  <input type="submit" name="submit" value="  保存  " class="button">
						          <input type="reset" value="  重设  " class="button">
					</td>
				</tr>
				</form>
			</TABLE>	
		
	</td>
  </tr>
  <%if Purchase_ID<>"" then%>
  <tr> 
    <td height="320" valign="top">
		<iframe  style="height:100%; WIDTH: 100%;" src="purchasedetail.asp?Purchase_ID=<%=Purchase_ID%>" scrolling=auto frameborder=0></iframe>
      </td>
  </tr>
  <%end if%>
</table>
</body>
</html>
<script>
	if("<%=client_ID%>"!=""){
		fnDo('Contacts','client_ID','Contact_ID','<%=client_ID%>','Contact_Name');
	}
</script>

⌨️ 快捷键说明

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