ERP完善合同起草(二十八)
前端的代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CRMContractNew.aspx.cs" Inherits="BioErpWeb.CRMSystem.CRMContract.CRMContractNew" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<script src="../../JS/CheckUserName.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../Scripts/validateExtender.js" type="text/javascript"></script>
<script src="../../Scripts/ValidateMessage_ZW.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.metadata.js" type="text/javascript"></script>
<script src="../../JS/CustomerName.js" type="text/javascript"></script>
<link href="../../Styles/InputStyle1.css" rel="stylesheet" type="text/css" />
<script src="../../JS/CheckDepartMent.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.7.custom.min.js" type="text/javascript"></script>
<link href="../../Scripts/jquery-ui-1.7.custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function () {
$("#form1").validate();
$("#txtCreatTime").datepicker({ dateFormat: 'yy-mm-dd' });
$("#txtSinTime").datepicker({ dateFormat: 'yy-mm-dd' });
$("#txtEffectiveTime").datepicker({ dateFormat: 'yy-mm-dd' });
$("#txtEndTime").datepicker({ dateFormat: 'yy-mm-dd' }) }); </script> </head>
<body>
<form id="form1" runat="server"> <div>
<table class="maintable Inupttable" style=" width:900px;">
<tr>
<td colspan="8" class="titlebar">合同起草</td>
</tr>
<tr>
<td>合同名称</td><td><asp:TextBox ID="txtName" CssClass="required" runat="server"></asp:TextBox></td>
<td>下次审批人</td><td><asp:TextBox ID="txtUser1" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox>
<input id="btnuser1" type="button" value="选择" onclick="showDialog3()" class="btnchoose"/>
</td>
<td>合同负责人</td><td><asp:TextBox ID="txtUser2" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox>
<input id="btnUser2" type="button" value="选择" onclick="showDialog3()" class="btnchoose"/>
</td>
<td>所属部门</td><td>
<asp:TextBox ID="txtDepartMentID" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox>
<input id="btnDepart" type="button" value="选择" class="btnchoose" onclick="showDepartMentDialog2()" /></td>
</tr>
<tr>
<td>签约客户</td><td><asp:TextBox ID="txtCustomer" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox>
<input id="btncustomer" type="button" value="选择" onclick="showCustomerDialog3()" class="btnchoose"/>
</td>
<td>签约金额</td><td><asp:TextBox ID="txtSum" CssClass="{required:true,number:true}" runat="server"></asp:TextBox>元(RMB)</td>
<td>合同创建时间</td><td><asp:TextBox ID="txtCreatTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td>
<td>计划签约时间</td><td><asp:TextBox ID="txtSinTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>生效时间</td><td ><asp:TextBox ID="txtEffectiveTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td>
<td>截止</td><td colspan="5"><asp:TextBox ID="txtEndTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td> </tr>
<tr>
<td>合同内容</td><td colspan="7">
<asp:TextBox ID="txtDesc" CssClass="required"
runat="server" Height="376px" Width="100%" Rows="10" TextMode="MultiLine"></asp:TextBox></td> </tr>
<tr>
<td>合同附件</td><td colspan="5">
<asp:FileUpload ID="FileUpload1" runat="server" Width="200px" />
</td>
<td>合同类型</td><td>
<asp:DropDownList ID="ddlType" runat="server">
<asp:ListItem>买卖合同</asp:ListItem>
<asp:ListItem>运输合同</asp:ListItem>
<asp:ListItem>技术合同</asp:ListItem>
<asp:ListItem>保管合同</asp:ListItem>
<asp:ListItem>仓储合同</asp:ListItem>
<asp:ListItem>委托合同</asp:ListItem>
</asp:DropDownList>
</td> </tr> <tr>
<td colspan="8" class="bottomtd">
<asp:Button ID="btnSubmit" runat="server" Text="合同申请提交"
onclick="btnSubmit_Click" /> </td>
</tr> </table> </div>
</form>
</body>
</html>
创建触发器:
CREATE TRIGGER [dbo].[CreateContractNoByContractID]
ON [dbo].[BioCRMContract]
AFTER INSERT
AS
BEGIN
DECLARE @str nvarchar(10)
DECLARE @ContractNo nvarchar(50)
DECLARE @ContractID nvarchar(50)
SET @str='0000000'
SELECT @ContractID=MAX(ContractID) FROM dbo.BioCRMContract
SET @ContractNo=RIGHT(@str+@ContractID,7)
UPDATE dbo.BioCRMContract SET ContractNumber=@ContractNo WHERE ContractID=@ContractID
end
后端的代码:
提交不成功删除原有的数据
protected void btnSubmit_Click(object sender, EventArgs e)
{ CrmContractBLL conbll = new CrmContractBLL();
BioCRMContract contract = new BioCRMContract();
CRMContractDocument condocument =null;
TaskListRecord tasklistRecord =null;
BioCrmCorrelationDocument document=null;
//获取合同相关信息
contract.UserID = int.Parse(this.txtUser2.Text);
contract.ContractName = this.txtName.Text;
contract.CustomerID = int.Parse(this.txtCustomer.Text);
contract.ContractSum = decimal.Parse(this.txtSum.Text);
contract.ContractType = this.ddlType.SelectedValue;
contract.EndTime = Convert.ToDateTime(this.txtEndTime.Text);
contract.EffectiveTime = Convert.ToDateTime(this.txtEffectiveTime.Text);
contract.SignTime = Convert.ToDateTime(this.txtSinTime.Text);
contract.ContractDesc = this.txtDesc.Text;
contract.ExecutiveState = "待审核";
contract.CreateTime = Convert.ToDateTime(this.txtCreatTime.Text); int ContractID = conbll.BioCRMContractadd(contract);
if (ContractID != 0)
{ //文档基本信息
if (this.FileUpload1.HasFile)
{
document = new BioCrmCorrelationDocument()
{
Subject = this.txtName.Text,
Content = this.FileUpload1.FileBytes,
DocumentSize = this.FileUpload1.FileContent.Length,
Type = this.FileUpload1.PostedFile.ContentType,
ExetendName = System.IO.Path.GetExtension(this.FileUpload1.FileName),
DocumentLevel = "绝密",
Name = this.FileUpload1.FileName,
Remark = "合同附件文档",
UserID = int.Parse(this.txtUser2.Text),
UploadTime = DateTime.Now
};
} BioCrmCorrelationDocumentBLL documentbll = new BioCrmCorrelationDocumentBLL(); int documentid = documentbll.BioCrmCorrelationDocumentAdd(document);
if (documentid != 0)
{
condocument = new CRMContractDocument()
{
DocumentID = documentid,
ContractID = ContractID }; int count = conbll.CRMContractDocumentADD(condocument); if (count != 0)
{ tasklistRecord = new TaskListRecord()
{
Accepter = int.Parse(this.txtUser1.Text),
Transmitter = int.Parse(this.txtUser2.Text),
AuditingSate = 0,
DepartMentId = int.Parse(this.txtDepartMentID.Text),
FirstAccepter = int.Parse(this.txtUser1.Text),
FirstSumitTime = DateTime.Now,
FirstTransmitter = int.Parse(Session["Userid"].ToString()),
Mind = "",
Pass = 1,
Subject = this.txtName.Text,
SumitTime = DateTime.Now,
TaskID = ContractID,
TaskTableID = 1
}; if (SqlComm.TaskListRecordAdd(tasklistRecord) != 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('合同申请提交成功,下次审批人员编号:" + this.txtUser1.Text + "')", true);
}
else
{
SqlComm.DeleteTableByCondition("BioErpCRMContractDocument", " where ContractID=" + ContractID);
SqlComm.DeleteTableByCondition("BioCrmCorrelationDocument", " where DocumentID=" + documentid);
SqlComm.DeleteTableByCondition("BioCRMContract", " where ContractID=" + ContractID);
} }
else {
SqlComm.DeleteTableByCondition("BioErpCRMContractDocument", " where ContractID=" + ContractID);
SqlComm.DeleteTableByCondition("BioCrmCorrelationDocument", " where DocumentID=" + documentid);
} }
else
{
SqlComm.DeleteTableByCondition("BioCRMContract", " where ContractID=" + ContractID);
} }
}
修改的业务(前端):
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CRMContractEidt.aspx.cs" Inherits="BioErpWeb.CRMSystem.CRMContract.CRMContractEidt" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<script src="../../JS/CheckUserName.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../Scripts/validateExtender.js" type="text/javascript"></script>
<script src="../../Scripts/ValidateMessage_ZW.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.metadata.js" type="text/javascript"></script>
<script src="../../JS/CustomerName.js" type="text/javascript"></script>
<link href="../../Styles/InputStyle1.css" rel="stylesheet" type="text/css" />
<script src="../../JS/CheckDepartMent.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.7.custom.min.js" type="text/javascript"></script>
<link href="../../Scripts/jquery-ui-1.7.custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function () {
$("#form1").validate();
$("#txtCreatTime").datepicker({ dateFormat: 'yy-mm-dd' });
$("#txtSinTime").datepicker({ dateFormat: 'yy-mm-dd' });
$("#txtEffectiveTime").datepicker({ dateFormat: 'yy-mm-dd' });
$("#txtEndTime").datepicker({ dateFormat: 'yy-mm-dd' })
}); </script> </head>
<body>
<form id="form1" runat="server"> <div>
<table class="maintable Inupttable" style=" width:900px;">
<tr>
<td colspan="8" class="titlebar">合同审核</td>
</tr>
<tr>
<td>合同名称</td><td><asp:TextBox ID="txtName" CssClass="required" runat="server"></asp:TextBox></td>
<td>下次审批人</td><td><asp:TextBox ID="txtUser1" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox>
<input id="btnuser1" type="button" value="选择" onclick="showDialog3()" class="btnchoose"/>
</td>
<td>合同负责人</td><td><asp:TextBox ID="txtUser2" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox>
<input id="btnUser2" type="button" value="选择" onclick="showDialog3()" class="btnchoose"/>
</td>
<td>所属部门</td><td>
<asp:TextBox ID="txtDepartMentID" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox>
<input id="btnDepart" type="button" value="选择" class="btnchoose" onclick="showDepartMentDialog2()" /></td>
</tr>
<tr>
<td>签约客户</td><td><asp:TextBox ID="txtCustomer" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox>
<input id="btncustomer" type="button" value="选择" onclick="showCustomerDialog3()" class="btnchoose"/>
</td>
<td>签约金额</td><td><asp:TextBox ID="txtSum" CssClass="{required:true,number:true}" runat="server"></asp:TextBox>元(RMB)</td>
<td>合同创建时间</td><td><asp:TextBox ID="txtCreatTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td>
<td>计划签约时间</td><td><asp:TextBox ID="txtSinTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>生效时间</td><td ><asp:TextBox ID="txtEffectiveTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td>
<td>截止</td><td colspan="5"><asp:TextBox ID="txtEndTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td> </tr>
<tr>
<td>合同内容</td><td colspan="7">
<asp:TextBox ID="txtDesc" CssClass="required"
runat="server" Height="300px" Width="100%" Rows="10" TextMode="MultiLine"></asp:TextBox></td> </tr>
<tr>
<td>合同附件</td><td colspan="5">
<asp:FileUpload ID="FileUpload1" runat="server" Width="200px" />
</td>
<td>合同类型</td><td>
<asp:DropDownList ID="ddlType" runat="server">
<asp:ListItem>买卖合同</asp:ListItem>
<asp:ListItem>运输合同</asp:ListItem>
<asp:ListItem>技术合同</asp:ListItem>
<asp:ListItem>保管合同</asp:ListItem>
<asp:ListItem>仓储合同</asp:ListItem>
<asp:ListItem>委托合同</asp:ListItem>
</asp:DropDownList>
</td> </tr> <tr>
<td colspan="8" class="bottomtd">
<asp:Button ID="btnSubmit" runat="server" Text="合同申请提交"
onclick="btnSubmit_Click" /> </td>
</tr> </table> </div>
</form>
</body>
</html>
定义相关的视图:根据合同编号获取合同的视图
CREATE VIEW [dbo].[View_ContactInfo]
AS
SELECT dbo.BioCRMContract.*, dbo.BioErpCRMContractDocument.AccessoryID, dbo.BioCrmCorrelationDocument.DocumentID, dbo.BioCrmCorrelationDocument.Subject,
dbo.BioCrmCorrelationDocument.Name, dbo.BioCrmCorrelationDocument.Type, dbo.BioCrmCorrelationDocument.DocumentLevel,
dbo.BioCrmCorrelationDocument.DocumentSize, dbo.BioCrmCorrelationDocument.ExetendName, dbo.BioCrmCorrelationDocument.[Content],
dbo.BioCrmCorrelationDocument.UploadTime, dbo.BioCrmCorrelationDocument.Remark
FROM dbo.BioCRMContract Left JOIN
dbo.BioErpCRMContractDocument ON dbo.BioCRMContract.ContractID = dbo.BioErpCRMContractDocument.ContractID Left JOIN
BLL层代码:
/// <summary>
/// 根据合同通编号获取合同视图实体对象
/// </summary>
/// <param name="id">编号</param>
/// <returns>ViewContactInfo</returns>
public ViewContactInfo getViewContactInfoByContactID(string id)
{
ViewContactInfo contactinfo= null;
SqlDataReader reader= SqlComm.GetDataReaderByCondition("View_ContactInfo", "*", " ContractID=" + id);
if (reader.Read())
{
contactinfo = new ViewContactInfo()
{
UserID = Convert.ToInt32(reader["UserID"].ToString()),
AccessoryID = Convert.ToInt32(reader["AccessoryID"].ToString()),
AssessorAuditing = Convert.ToBoolean(reader["AssessorAuditing"].ToString()),
ContractDesc = reader["ContractDesc"].ToString(),
ContractID = Convert.ToInt32(reader["ContractID"].ToString()),
ContractName = reader["ContractName"].ToString(),
ContractNumber = reader["ContractNumber"].ToString(),
ContractSum = Decimal.Parse(reader["ContractSum"].ToString()),
ContractType = reader["ContractType"].ToString(),
CreateTime = Convert.ToDateTime(reader["CreateTime"].ToString()),
CustomerID = Convert.ToInt32(reader["CustomerID"].ToString()),
DeleteState = Convert.ToBoolean(reader["DeleteState"].ToString()),
DocumentID = Convert.ToInt32(reader["DocumentID"].ToString()),
DocumentLevel = reader["DocumentLevel"].ToString(),
DocumentSize = long.Parse(reader["DocumentSize"].ToString()),
EndTime = Convert.ToDateTime(reader["EndTime"].ToString()),
EffectiveTime = Convert.ToDateTime(reader["EffectiveTime"].ToString()),
UploadTime = Convert.ToDateTime(reader["UploadTime"].ToString()),
ExecutiveState = reader["ExecutiveState"].ToString(),
ExetendName = reader["ExetendName"].ToString(),
Name = reader["Name"].ToString(),
Remark = reader["Remark"].ToString(),
SignTime = Convert.ToDateTime(reader["SignTime"].ToString()),
Subject = reader["Subject"].ToString(),
Type = reader["Type"].ToString()
};
}
reader.Close();
return contactinfo; }
根据任务表单编号和任务表编号查询返回数据表
/// <summary>
/// 根据任务表单编号,和 任务表编号进行查询返回数据表
/// </summary>
/// <param name="TaskID">TaskID:如合同管理单号为5</param>
/// <param name="TaskTableID">TaskTableID:如合同管理单(1)、商品供货单(2)、商品采购申请单(3)</param>
/// <returns></returns>
public static DataTable getTaskListRecordsByCondition(string TaskID, string TaskTableID)
{
SqlParameter[] pars = new SqlParameter[]{
new SqlParameter("@tableName","TaskListRecord"),
new SqlParameter("@columns"," * "),
new SqlParameter("@condition"," TaskID='"+TaskID+"' and TaskTableID='"+TaskTableID+"'")
};
return DataBaseHelper.SelectSQLReturnTable("GetDataByCondition", CommandType.StoredProcedure, pars);
}
存储过程:
-- Description: 根据指定列,指定条件,指定表查询数据
-- =============================================
CREATE PROCEDURE [dbo].[GetDataByCondition]
@tableName nvarchar(200),
@columns nvarchar(500),
@condition nvarchar(500)=' 1=1' AS
BEGIN SET NOCOUNT ON;
DECLARE @sqlStr nvarchar(2000)
SET @sqlStr='select '+@columns+' from '+@tableName+' where '+@condition
EXEC(@sqlStr) END
ERP完善合同起草(二十八)的更多相关文章
- Bootstrap <基础二十八>列表组
列表组.列表组件用于以列表形式呈现复杂的和自定义的内容.创建一个基本的列表组的步骤如下: 向元素 <ul> 添加 class .list-group. 向 <li> 添加 cl ...
- Web 前端开发人员和设计师必读文章推荐【系列二十八】
<Web 前端开发精华文章推荐>2014年第7期(总第28期)和大家见面了.梦想天空博客关注 前端开发 技术,分享各类能够提升网站用户体验的优秀 jQuery 插件,展示前沿的 HTML5 ...
- Citrix 服务器虚拟化之二十八 XenApp6.5发布文档内容
Citrix 服务器虚拟化之二十八 XenApp 6.5发布文档内容 XenApp可发布以下类型的资源向用户提供信息访问,这些资源可在服务器或桌面上虚拟化: 1) 服务器桌面:发布场中服务器的整个 ...
- WCF技术剖析之二十八:自己动手获取元数据[附源代码下载]
原文:WCF技术剖析之二十八:自己动手获取元数据[附源代码下载] 元数据的发布方式决定了元数据的获取行为,WCF服务元数据架构体系通过ServiceMetadataBehavior实现了基于WS-ME ...
- VMware vSphere 服务器虚拟化之二十八 桌面虚拟化之安装View传输服务器
VMware vSphere 服务器虚拟化之二十八 桌面虚拟化之安装View传输服务器 View 传输服务器用于管理和简化数据中心与在最终用户本地系统上检出使用的 View 桌面之间的数据传输.必须安 ...
- Bootstrap入门(二十八)JS插件5:工具提醒
Bootstrap入门(二十八)JS插件5:工具提醒 工具提示在使用过程中比较常见,但是实现起来有些麻烦,而bootstrap则很好地解决了这个问题. 我们来写一个简单的实例 先引入CSS文件和JS文 ...
- mysql进阶(二十八)MySQL GRANT REVOKE用法
mysql进阶(二十八)MySQL GRANT REVOKE用法 MySQL的权限系统围绕着两个概念: 认证->确定用户是否允许连接数据库服务器: 授权->确定用户是否拥有足够的权限执 ...
- JAVA之旅(二十八)——File概述,创建,删除,判断文件存在,创建文件夹,判断是否为文件/文件夹,获取信息,文件列表,文件过滤
JAVA之旅(二十八)--File概述,创建,删除,判断文件存在,创建文件夹,判断是否为文件/文件夹,获取信息,文件列表,文件过滤 我们可以继续了,今天说下File 一.File概述 文件的操作是非常 ...
- 条目二十八《正确理解由reverse_iterator的base()成员函数所产生的iterator的用法》
条目二十八<正确理解由reverse_iterator的base()成员函数所产生的iterator的用法> 迭代器的种类一共有四种,上面已经说过了.这里就不再次写出来. 这一个条目主要是 ...
随机推荐
- Spark记录-SparkSQL远程操作MySQL和ORACLE
1.项目引入mysql和oracle驱动 2.将mysql和oracle驱动上传到hdfs 3.远程调试源代码如下: import org.apache.spark.sql.SQLContext im ...
- quartz定时任务-job
1,首先添加对quartz组建的引用 quartz-2.2.3.jar,slf4j-api-1.7.7.jar https://files.cnblogs.com/files/renjing/quar ...
- webuploader
https://www.cnblogs.com/study-fanzeng/p/8930939.html http://fex.baidu.com/webuploader/doc/index.html ...
- beef框架使用
http://resources.infosecinstitute.com/beef-part-2/ http://resources.infosecinstitute.com/beef-part-1 ...
- JavaScript动态修改CSS
链接:https://www.cnblogs.com/aademeng/articles/6279060.html 在很多情况下,都需要对网页上元素的样式进行动态的修改.在JavaScript中提供几 ...
- C语言中#ifdef,#ifndef和#endif的作用
现在规定一下头文件书写规范, 根据陈皓编写的跟我一起些makefile,一定要记住:头文件中应该只是声明,而定义应该放在C/C++文件中.否则如果出现有定义,比如头文件中有int a =2;如果有多个 ...
- python manage.py syncdb Unknown command: 'syncdb'问题解决方法
在django1.9后的版本中,python manage.py syncdb命令修改为python manage.py migrate,执行正常. 选择sqlite可视化sqlitestudio-3 ...
- mysql 查询优化 ~ 善用profie利器
一 简介:利用profile分析慢语句的过程有助于我们进行语句的优化 二 执行过程 set profiling=1; set profiling=0; 2 执行sql 3 查看过程消耗 三 ...
- DSO windowed optimization 代码 (1)
这里不想解释怎么 marginalize,什么是 First-Estimates Jacobian (FEJ).这里只看看代码,看看Hessian矩阵是怎么构造出来的. 1 优化流程 整个优化过程,也 ...
- 文件打包(.zip)并返回打压缩包存放路径
1.由于公司需要将一个或多个视频进行打包,格式如下图: 2.创建zipUtil工具包: package com.seegot.util; import java.io.BufferedOutputSt ...