ERP合同管理二(二十七)

未审核表单列表显示:

1.用户登录后,根据登录用户加载审核流程表中属于当前登录用户的未审核表单。
2.点击选中未审核表单跳转到指定审核流程页面

  if (Request.QueryString["taskid"] != null && Request.QueryString["listid"] != null)
            {
                contractid = Request.QueryString["taskid"].ToString();
                tasklistid = Request.QueryString["listid"].ToString();
            }
            else
            {
                Response.Write("<script>window.history(-1)</script>");
            }

防止匿名登录:
登录后将基本信息保存至Session["Userid"],
如果每个页面加载时候判断Session["Userid"],如果为空则跳转至指定登录页面。

   public BasePage()
        {
            this.Load += new EventHandler(BasePage_Load);
        }

        void BasePage_Load(object sender, EventArgs e)
        {
            Session["Userid"] = "29";
            if (Session["Userid"] == null)
            {
                Response.Redirect("~/Web/UserLogin.aspx");
            }
        }

用法:

 public partial class CRMContractEidt:BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.txtCreatTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
            if (!IsPostBack)
            {
                pageinfo();
            }
        }
}

合同基础信息表:

 /// <summary>
      /// 合同基础信息表
      /// </summary>
      /// <param name="id">编号</param>
      /// <returns>ViewContactInfo</returns>
      public ViewContactInfo getViewContactInfoByContactID2(string contactid,string listid)
      {

          SqlDataReader reader = SqlComm.GetDataReaderByCondition("BioCRMContract", "*", " ContractID=" + contactid);
          ViewContactInfo contactinfo= new ViewContactInfo();
          if (reader.Read()==true)
          {

                contactinfo.UserID = Convert.ToInt32(reader["UserID"].ToString());
                contactinfo. AssessorAuditing = Convert.ToBoolean(reader["AssessorAuditing"].ToString());
                contactinfo.ContractDesc = reader["ContractDesc"].ToString();
                contactinfo.ContractID = Convert.ToInt32(reader["ContractID"].ToString());
                contactinfo.ContractName = reader["ContractName"].ToString();
                contactinfo.ContractNumber = reader["ContractNumber"].ToString();
                contactinfo.ContractSum = Decimal.Parse(reader["ContractSum"].ToString());
                contactinfo.ContractType = reader["ContractType"].ToString();
                contactinfo.CreateTime = Convert.ToDateTime(reader["CreateTime"].ToString());
                contactinfo.CustomerID = Convert.ToInt32(reader["CustomerID"].ToString());
                contactinfo.DeleteState = Convert.ToBoolean(reader["DeleteState"].ToString());
                contactinfo.EndTime = Convert.ToDateTime(reader["EndTime"].ToString());
                contactinfo. EffectiveTime = Convert.ToDateTime(reader["EffectiveTime"].ToString());
                contactinfo. ExecutiveState = reader["ExecutiveState"].ToString();
                contactinfo.SignTime = Convert.ToDateTime(reader["SignTime"].ToString());

          }
          reader.Close();
          return contactinfo;

      }

显示的前端代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CRMContractShow.aspx.cs" Inherits="BioErpWeb.CRMSystem.CRMContract.CRMContractShow" %>

<!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>
              </td>
            <td class="style7">合同负责人</td><td class="style6"><asp:TextBox ID="txtUser2" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox>
              </td>
            <td>所属部门</td><td>
              <asp:TextBox ID="txtDepartMentID" CssClass="{required:true,digits:true, min:1}" runat="server"></asp:TextBox>
              </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>
              </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: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>

后端的代码:

  public partial class CRMContractShow : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.txtCreatTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
            if (!IsPostBack)
            {
                pageinfo();

                //遍历页面所有TextBox控件,设置为只读
                TextBox txt = null;
                foreach (Control c in Page.Controls)
                {
                    if (c.GetType().Name == "HtmlForm")
                    {
                        foreach (Control c1 in c.Controls)
                        {
                            if (c1.GetType().Name == "TextBox")
                            {
                                txt = ((TextBox)c1);
                                txt.ReadOnly = true;
                            }
                        }
                    }
                }
            }
        }
       static  byte[] filecontent = null;

       static string contractid = "";
       static string tasklistid = "";
       static string documentsid = "";
        /// <summary>
        /// 绑定页面信息
        /// </summary>
        protected void pageinfo()
        {
            contractid ="8";
            tasklistid ="7";

            #region 从合同信息表中绑定数据
            CrmContractBLL cbll = new CrmContractBLL();
            ViewContactInfo contactinfo = new ViewContactInfo();
            contactinfo = cbll.getViewContactInfoByContactID2(contractid, tasklistid);
            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);

            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;

            }
        }

        /// <summary>
        /// 下载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (filecontent == null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "test", "alert(‘没有要下载的文档‘)", true);
                return;
            }

            //创建弹出式Windows下载窗体
            Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(this.txtName.Text));
            //把二进制数组写入Http输出流
            Response.BinaryWrite(filecontent);
            //想当前客户端缓冲区输出
            Response.Flush();
            //停止执行
            Response.End();
        }
    }

合同审单执行:

业务逻辑代码:

  //判断当前登录用户是否是被提交人
            if (dr0[0].ItemArray[5].ToString() == Session["Userid"].ToString())
            {
                //45法律资质审核权限
                if (SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("45"))
                {
                    this.lbIsCheck.Visible = true;
                    this.cbIsCheck.Visible = true;
                    this.btnRun.Visible = true;
                }
                else
                {
                    this.lbIsCheck.Visible = false;
                    this.cbIsCheck.Visible = false;
                    this.btnRun.Visible = false;

                }

            }
            //如果当前登录用户是合同负责人(第一次提交合同申请的用户)
            if (dr0[0].ItemArray[10].ToString() == Session["Userid"].ToString())
            {
                this.FileUpload1.Visible = true;
            }else
            {
                this.FileUpload1.Visible = false;
            }
 /// <summary>
        /// 下载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (filecontent == null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "test", "alert(‘没有要下载的文档‘)", true);
                return;
            }
            //创建弹出式Windows下载窗体
            Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(this.txtName.Text));
            //把二进制数组写入Http输出流
            Response.BinaryWrite(filecontent);
            //想当前客户端缓冲区输出
            Response.Flush();
            //停止执行
            Response.End();
        }

        protected void btnRun_Click(object sender, EventArgs e)
        {
            CrmContractBLL conbll = new CrmContractBLL();
            BioCRMContract contract = new BioCRMContract();
            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.txtUser2.Text),
                Transmitter = int.Parse(Session["Userid"].ToString()),
                AuditingSate =2,
                DepartMentId = int.Parse(this.txtDepartMentID.Text),
                FirstAccepter = int.Parse(this.hf_FirstAccepter.Value),
                FirstSumitTime = Convert.ToDateTime(this.hf_FirstDateTime.Value),
                FirstTransmitter = int.Parse(this.hf_FirstTransmitter.Value),
                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);
            }
        }
时间: 2024-10-21 01:57:45

ERP合同管理二(二十七)的相关文章

ERP合同管理(二十六)

需要实现的基本业务: 相关的用例图: 相关业务的封装: 相关的约定: 合同信息添加业务流程: 添加的存储过程 SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON GO ------------------------------------ --用途:增加一条记录 --项目名称: --说明: --时间:2011/11/11 22:07:38 ------------------------------------ CREATE PROCEDURE [dbo].[

ERP合同管理流程查询(三)

根据任务表编号,及相关表单编号获取当前流程表的编号: CREATE FUNCTION [dbo].[FN_GetDynamicId] ( @tasktableid INT, @taskid INT ) RETURNS INT AS BEGIN DECLARE @listid INT SELECT TOP 1 @listid=ListID FROM TaskListRecord WHERE [email protected] AND [email protected] ORDER BY ListI

ERP完善合同起草(二十七)

前端的代码: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CRMContractNew.aspx.cs" Inherits="BioErpWeb.CRMSystem.CRMContract.CRMContractNew" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transi

abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理四 (二十二)

abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+easyui+efcore实现仓储管理系统——解决方案介绍(二) abp(net core)+easyui+efcore实现仓储管理系统——领域层创建实体(三) abp(net core)+easyui+efcore实现仓储管理系统——定义仓储并实现 (四) abp(net core)+easyui

黑马程序员----内存管理之二《多对象的内存管理》

内存管理之二——<多对象的内存管理> 1.多对象的内存管理方式: 只要有人使用了这个对象,这个对象就不能被销毁: 只要你想使用这个对象,就让这个对象的引用计数器的值+1(让对象做一次retain操作): 当你不再使用这个对象,就让这个的对象的引用计数器的值-1(让对象做一次release操作): 谁alloc,谁就release: 谁retain,谁就release: 2.内存管理的代码规范: 只要调用了alloc必须有release/autorelease set方法的代码规范: 1.基本数

【操作系统】进程管理(二)

一.前言 之前已经介绍了操作系统的各个模块,现在来具体深入学习操作系统中的进程管理. 二.进程的基本概念 在未配置OS的系统中,程序的执行方式是顺序执行,即必须在一个程序执行完成后,才允许另外一个程序执行:在多道程序环境下,则允许多个程序并发执行.也正是程序的并发执行,才导致引入进程. 2.1 程序的顺序执行 通常可以把一个应用程序分成若干个程序段,在各程序段之间,必须按照某种先后次序顺序执行,仅当前一操作(程序段)执行完后,才能执行后继操作.如典型的输入->计算->打印任务就是顺序执行. 程

服务器远程监控管理(二)-系统安装报错0xc0000001

故障现象:新购的DELL服务器,新的光驱,新刻录的光盘.安装操作系统,报0xc0000001错误,如下图:  (这么多年的老IT竟被安装系统给绊住了,真想骂娘) 故障测试:更换光驱.光盘,反复重起安装,问题依旧. 故障处理: 1. 经和DELL厂商沟通,产生此错误的原因就是光驱或光盘原因导致读盘有问题,因而无法继续安装. 2. 厂商建议1)更换光盘光驱再试    2)采用远程管理卡(IDRAC卡)网络安装操作系统. 解决方法: 1. 对于厂商给的建议1,因为已试过多次,没有再试. 2. 采用厂商

.NET组件程序设计之线程、并发管理(二)

.Net组件程序设计之线程.并发管理(二) 2.同步线程 手动同步 监视器 互斥 可等待事件 同步线程 所有的.NET组件都支持在多线程的环境中运行,可以被多个线程并发访问,如果没有线程同步,这样的后果是当多个线程同时访问 对象状态时,对象的状态可能被破坏,造成不一致性..NET提供了两种方法来避免这样的问题,使得我们设计的组件更加健壮. 第一种是自动同步,让你使用一个属性来修饰组件,这样就可以把组件交给.NET了,同步的事情也就交给了.NET. 第二种是手动同步,这是让你使用.NET提供的同步

Spring事务管理(二)

声明式事务管理方式一:基于TransactionProxyFactoryBean的方式(不常用,需要对每个要进行增强的类进行配置TransactionProxyFactoryBean) 1.引入xml配置约束 2. 声明式事务管理方式二:基于AspectJ的XML方式的配置:(经常使用,一旦配置好,类上不需要添加任何东西) 1.引入xml配置约束 2.  声明式事务管理方式三:基于注解的方式(经常使用,配置简单,但是需要在业务层类上添加@Transactional的注解) 1. 2.只要在需要进