合同审批流程:

前端的代码:

<%@ 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>
<style type="text/css">
.style1
{
width: 73px;
}
</style>
</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 class="style1">合同名称</td><td class="style3"><asp:TextBox ID="txtName" CssClass="required" runat="server"></asp:TextBox></td>
<td class="style4">下次审批人</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 class="style7">合同负责人</td><td class="style6"><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 class="style1">签约客户</td><td class="style3"><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 class="style4">签约金额</td><td><asp:TextBox ID="txtSum" CssClass="{required:true,number:true}" runat="server"></asp:TextBox>元(RMB)</td>
<td class="style7">合同创建时间</td><td class="style6"><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 class="style1">生效时间</td><td class="style3" ><asp:TextBox ID="txtEffectiveTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td>
<td class="style4">截止</td><td colspan="5"><asp:TextBox ID="txtEndTime" CssClass="{required:true,dateISO:true}" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td class="style1">合同内容</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 class="style1">合同附件</td><td colspan="5">
<asp:FileUpload ID="FileUpload1" runat="server" Width="200px" />
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/Web/images/files.gif" Width="26px" Height="24px"
onclick="ImageButton1_Click"/>
(下载)</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 class="style1">历史意见</td><td colspan="7">
<asp:Label ID="lbHistory" Width="99%" runat="server"
Text=""></asp:Label> </td>
</tr>
<tr>
<td class="style1">审批意见</td><td colspan="5">
<asp:TextBox ID="txtMind" Width="80%" runat="server"></asp:TextBox> </td>
<td>
<asp:Label ID="lbIsCheck" runat="server" Visible="false" Text="法律顾问意见"></asp:Label> </td><td>
<asp:CheckBox ID="cbIsCheck" Text="符合法律效应" Visible="false" BorderStyle="None" runat="server" /></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>

根据员工编号返回员工权限字符串的自定义函数:

-- Description:	根据员工编号返回员工权限字符串
-- =============================================
CREATE FUNCTION [dbo].[GetUserRightsByUserID]
(
@userid INT
)
RETURNS NVARCHAR(200)
AS
BEGIN DECLARE cur CURSOR FOR
SELECT RightID FROM dbo.tbUserRight WHERE tbUserRight.UserId =@userid
OPEN cur
DECLARE @Rightid NVARCHAR(20)
DECLARE @Rightids NVARCHAR(1000)
SET @Rightids=''
FETCH NEXT FROM cur INTO @Rightid
WHILE @@FETCH_STATUS =0
BEGIN
SET @Rightids=@Rightids+@Rightid+','
FETCH NEXT FROM cur INTO @Rightid
END
CLOSE cur
DEALLOCATE cur RETURN @Rightids END

存储过程的封装:

CREATE PROCEDURE Sp_getUserRightsbyUserid
@userid int
AS
BEGIN
SET NOCOUNT ON;
SELECT dbo.GetUserRightsByUserID(@userid)
END

公用类的调用:

        /// <summary>
/// 根据用户编号返回用户的权限值字符串
/// </summary>
/// <param name="userid">用户编号</param>
/// <returns>权限值字符串</returns>
public static string getUserRightsByUserId(string userid)
{
//dbo.GetUserRightsByUserID
SqlParameter[] pars = new SqlParameter[]{
new SqlParameter("@userid",userid)
}; object obj= DataBaseHelper.SelectSQLReturnObject("Sp_getUserRightsbyUserid", CommandType.StoredProcedure, pars);
if (obj != null)
{
return obj.ToString();
}
else
{
return "";
}
}

后端代码:

  static  byte[] filecontent = null;

       static string contractid = "";
static string tasklistid = "";
static string documentsid = "";
/// <summary>
/// 绑定页面信息
/// </summary>
protected void pageinfo()
{
contractid = "5";
tasklistid = "2";
#region 从合同信息表中绑定数据
CrmContractBLL cbll = new CrmContractBLL();
ViewContactInfo contactinfo = new ViewContactInfo();
contactinfo = cbll.getViewContactInfoByContactID(contractid);
this.txtName.Text = contactinfo.ContractName;
this.txtUser2.Text = contactinfo.UserID.ToString();
this.txtSinTime.Text = Convert.ToDateTime(contactinfo.SignTime.ToString()).ToString("yyyy-MM-dd");
this.txtCreatTime.Text = Convert.ToDateTime(contactinfo.CreateTime.ToString()).ToString("yyyy-MM-dd");
this.txtCustomer.Text = contactinfo.CustomerID.ToString();
this.txtSum.Text = Convert.ToDecimal(contactinfo.ContractSum.ToString()).ToString("0.00");
this.txtEffectiveTime.Text = Convert.ToDateTime(contactinfo.EffectiveTime).ToString("yyyy-MM-dd");
this.txtDesc.Text = contactinfo.ContractDesc;
this.txtEndTime.Text = Convert.ToDateTime(contactinfo.EndTime).ToString("yyyy-MM-dd");
this.ddlType.SelectedItem.Text = contactinfo.ContractType.ToString(); this.cbIsCheck.Checked =bool.Parse(contactinfo.AssessorAuditing.ToString()); #endregion #region 从流程表中绑定数据
//1代表 合同管理表单
System.Data.DataTable dt = SqlComm.getTaskListRecordsByCondition(contractid, "1");
System.Data.DataRow[] dr0 = dt.Select(" listID=" + tasklistid);
//如果当前表单流程的审批人和当前登录用户不一致,则跳出
if (dr0[0].ItemArray[5].ToString() != Session["Userid"].ToString())
{
this.FileUpload1.Visible = false;
}
else
{
this.FileUpload1.Visible = true;
}
string historys = "";
for (int i = 1; i < dt.Rows.Count; i++)
{
historys+= dt.Rows[i]["Mind"].ToString() + " " + Convert.ToDateTime(dt.Rows[i]["SumitTime"].ToString()).ToString("yyyy-MM-dd")+"</br>"; }
if (historys.Length == 0)
{
historys = "暂无审核意见";
}
this.lbHistory.Text = historys; this.txtDepartMentID.Text = dr0[0].ItemArray[12].ToString();
this.txtUser1.Text = dr0[0].ItemArray[5].ToString();
#endregion filecontent = Comm.GetDownDocumet("BioCrmCorrelationDocument", "Content", " DocumentID=" + contactinfo.DocumentID);
documentsid = contactinfo.DocumentID.ToString(); if (SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("45") || this.cbIsCheck.Checked==true)
{
this.lbIsCheck.Visible = true;
this.cbIsCheck.Visible = true;
}
else
{
this.lbIsCheck.Visible = false;
this.cbIsCheck.Visible = false; }
} //如果不是合同负责人本人,则不能修改合同的相关信息,只能发表审批意见或则如果是法律顾问权限人员则可以修改法律审核备注
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.ContractID = int.Parse(contractid);
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 = "待审核"; if (this.cbIsCheck.Visible == true)
{
contract.AssessorAuditing = cbIsCheck.Checked;
} contract.CreateTime = Convert.ToDateTime(this.txtCreatTime.Text); int count = conbll.BioCRMContractaUpdate(contract); //文档基本信息
if (this.FileUpload1.HasFile)
{
document = new BioCrmCorrelationDocument()
{
DocumentID = int.Parse(documentsid.ToString()),
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(); documentbll.BioCrmCorrelationDocumentUpdate(document); } 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 =this.txtMind.Text,
Pass = 1,
Subject = this.txtName.Text,
SumitTime = DateTime.Now,
TaskID =int.Parse(contractid),
TaskTableID = 1
}; //向流程表添加一条新的记录
if (SqlComm.TaskListRecordAdd(tasklistRecord) != 0)
{
SqlComm.UpdateTableByCondition("dbo.TaskListRecord", " AuditingSate=1", " ListID=" + tasklistid);
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('合同申请提交成功,下次审批人员编号:" + this.txtUser1.Text + "')", true);
}
} /// <summary>
/// 下载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{ //创建弹出式Windows下载窗体
Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(this.txtName.Text));
//把二进制数组写入Http输出流
Response.BinaryWrite(filecontent);
//想当前客户端缓冲区输出
Response.Flush();
//停止执行
Response.End();
}

创建没有审核的视图:

CREATE VIEW View_NoAuditingState
AS
SELECT ListID,Subject,dbo.TaskListRecord.TaskID,dbo.TaskListRecord.TaskTableID
,Transmitter,Accepter,SumitTime,LinEdit=(
SELECT LinkEdit FROM dbo.TaskNavigate WHERE dbo.TaskNavigate.TaskTableID=
dbo.TaskListRecord.TaskTableID
) FROM dbo.TaskListRecord
  /// <summary>
/// 获取未审核表单信息
/// </summary>
public void getNoAuditing()
{
NoAuditingList.DataSource= SqlComm.GetDataByCondition("dbo.View_NoAuditingSate", "*", " AuditingSate=0 and Accepter='" + Session["Userid"] + "'");
this.NoAuditingList.DataBind();
} public string setToString(string str)
{ if (str == "0")
{
return "未受理";
}
else if (str == "1")
{ return "受理中";
}
else if (str == "2")
{ return "已解决";
}
else
{ return "过期";
} }

ERP合同审核流程处理(二十九)的更多相关文章

  1. 使用Typescript重构axios(二十九)——添加baseURL

    0. 系列文章 1.使用Typescript重构axios(一)--写在最前面 2.使用Typescript重构axios(二)--项目起手,跑通流程 3.使用Typescript重构axios(三) ...

  2. Bootstrap <基础二十九>面板(Panels)

    Bootstrap 面板(Panels).面板组件用于把 DOM 组件插入到一个盒子中.创建一个基本的面板,只需要向 <div> 元素添加 class .panel 和 class .pa ...

  3. Web 开发人员和设计师必读文章推荐【系列二十九】

    <Web 前端开发精华文章推荐>2014年第8期(总第29期)和大家见面了.梦想天空博客关注 前端开发 技术,分享各类能够提升网站用户体验的优秀 jQuery 插件,展示前沿的 HTML5 ...

  4. WCF技术剖析之二十九:换种不同的方式调用WCF服务[提供源代码下载]

    原文:WCF技术剖析之二十九:换种不同的方式调用WCF服务[提供源代码下载] 我们有两种典型的WCF调用方式:通过SvcUtil.exe(或者添加Web引用)导入发布的服务元数据生成服务代理相关的代码 ...

  5. VMwarevSphere 服务器虚拟化之二十九 桌面虚拟化之安装View副本服务器

    VMwarevSphere 服务器虚拟化之二十九  桌面虚拟化之安装View副本服务器 VMware View中高可用性可是一个必须要考虑的问题.在整个虚拟桌面环境中View Connection S ...

  6. Bootstrap入门(二十九)JS插件6:弹出框

    Bootstrap入门(二十九)JS插件6:弹出框 加入小覆盖的内容,像在iPad上,用于存放非主要信息 弹出框是依赖于工具提示插件的,那它也和工具提示是一样的,是需要初始化才能够使用的 首先我们引入 ...

  7. mysql进阶(二十九)常用函数

    mysql进阶(二十九)常用函数 一.数学函数 ABS(x) 返回x的绝对值 BIN(x) 返回x的二进制(OCT返回八进制,HEX返回十六进制) CEILING(x) 返回大于x的最小整数值 EXP ...

  8. JAVA之旅(二十九)——文件递归,File结束练习,Properties,Properties存取配置文件,load,Properties的小练习

    JAVA之旅(二十九)--文件递归,File结束练习,Properties,Properties存取配置文件,load,Properties的小练习 我们继续学习File 一.文件递归 我们可以来实现 ...

  9. 【黑金原创教程】【FPGA那些事儿-驱动篇I 】原创教程连载导读【连载完成,共二十九章】

    前言: 无数昼夜的来回轮替以后,这本<驱动篇I>终于编辑完毕了,笔者真的感动到连鼻涕也流下来.所谓驱动就是认识硬件,还有前期建模.虽然<驱动篇I>的硬件都是我们熟悉的老友记,例 ...

随机推荐

  1. SqlServer中的查询简单总结

    一.sql语句的执行顺序 查询时数据库中使用最多的操作,一条sql语句的查询顺序是 1.from Tb1 [ join on ]   得到查询的数据源 2.where    对数据过滤(单条数据上过滤 ...

  2. jquery :checked(过滤选择器) 和 空格:checked(后代选择器)【转】

    jquery 过滤选择器 和 后代选择器 <%@ page language="java" contentType="text/html; charset=UTF- ...

  3. 08-DML(插入、更新、删除)

    1. 插入 (1). 插入完整数据记录 (2). 插入数据记录的一部分 (3). 插入多条记录(MySQL特有的) INSERT INTO table_name (column1,column2,co ...

  4. awk词频统计功能

    [root@test88 ~]# vim word_freq.sh #!/bin/bash if [ $# -ne 1 ];then echo "Usage: $0 filename&quo ...

  5. Solr之.net操作

    http://www.cnblogs.com/zhangweizhong/category/771055.html 插入: SolrNet.Startup.Init<Movie>(&quo ...

  6. luogu 4158 粉刷匠 dp套dp

    dp套dp 每个木板是个递推的dp,外部是个分组背包 #include<bits/stdc++.h> #define rep(i,x,y) for(register int i=x;i&l ...

  7. JavaScript之事件绑定多个序列执行方法

    //一种事件绑定多个方法:以加载事件为例 function addEventLoad(func,isLog) { var oldOnLoad = window.onload; if (typeof w ...

  8. bzoj 4184: shallot (线段树维护线性基)

    题面 \(solution:\) 这一题绝对算的上是一道经典的例题,它向我们诠释了一种新的线段树维护方式(神犇可以跳过了).像这一类需要加入又需要维护删除的问题,我们曾经是遇到过的像莫对,线段树... ...

  9. Synchronized和lock的区别和用法

    一.synchronized和lock的用法区别 (1)synchronized(隐式锁):在需要同步的对象中加入此控制,synchronized可以加在方法上,也可以加在特定代码块中,括号中表示需要 ...

  10. 推荐系统之协同过滤的原理及C++实现

    1.引言 假如你经营着一家网店,里面卖各种商品(Items),有很多用户在你的店里面买过东西,并对买过的Items进行了评分,我们称之为历史信息,现在为了提高销售量,必须主动向用户推销产品,所以关键是 ...