197 lines
		
	
	
		
			7.5 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			197 lines
		
	
	
		
			7.5 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Diagnostics;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using System.Runtime.CompilerServices;
							 | 
						|||
| 
								 | 
							
								using System.Web;
							 | 
						|||
| 
								 | 
							
								using System.Web.UI;
							 | 
						|||
| 
								 | 
							
								using System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								using AspNet = System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.CQMS.Information
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class CostReportView : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 定义变量
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 方案审查主键
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public string CostReportId
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return (string)ViewState["CostReportId"];
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["CostReportId"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 定义集合
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 定义会签意见集合
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public static List<Model.CQMS_CostReportApprove> approves = new List<Model.CQMS_CostReportApprove>();
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public int ContactImg
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return Convert.ToInt32(ViewState["ContactImg"]);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["ContactImg"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                BLL.SecretLevelService.InitSecretLevelDropDownList(drpSecretLevel, true);
							 | 
						|||
| 
								 | 
							
								                UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
							 | 
						|||
| 
								 | 
							
								                ContactImg = 0;
							 | 
						|||
| 
								 | 
							
								                //CommonService.GetAllButtonList(CurrUser.LoginProjectId, CurrUser.UserId, Const.CostReportMenuId);
							 | 
						|||
| 
								 | 
							
								                txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
							 | 
						|||
| 
								 | 
							
								                CostReportId = Request.Params["costReportId"];
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrWhiteSpace(CostReportId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    HFCostReportId.Text = CostReportId;
							 | 
						|||
| 
								 | 
							
								                    Model.CQMS_CostReport costReport = CostReportService.GetCostReportByCostReportId(CostReportId);
							 | 
						|||
| 
								 | 
							
								                    txtCostReportCode.Text = costReport.CostReportCode;
							 | 
						|||
| 
								 | 
							
								                    if (!string.IsNullOrEmpty(costReport.SecretLevelId))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        drpSecretLevel.SelectedValue = costReport.SecretLevelId;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (!string.IsNullOrEmpty(costReport.UnitId))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        drpUnit.SelectedValue = costReport.UnitId;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    this.txtContractNo.Text = costReport.ContractNo;
							 | 
						|||
| 
								 | 
							
								                    this.txtContractContent.Text = costReport.ContractContent;
							 | 
						|||
| 
								 | 
							
								                    if (!string.IsNullOrEmpty(costReport.ConfirmFormIds))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        string[] strs = costReport.ConfirmFormIds.Split(',');
							 | 
						|||
| 
								 | 
							
								                        List<Model.CQMS_ConfirmForm> list = new List<Model.CQMS_ConfirmForm>();
							 | 
						|||
| 
								 | 
							
								                        foreach (var item in strs)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            Model.CQMS_ConfirmForm confirmForm = BLL.ConfirmFormService.GetConfirmFormByConfirmFormId(item);
							 | 
						|||
| 
								 | 
							
								                            if (confirmForm != null)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                list.Add(confirmForm);
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        drpConfirmFormIds.DataValueField = "ConfirmFormId";
							 | 
						|||
| 
								 | 
							
								                        drpConfirmFormIds.DataTextField = "ConfirmFormCode";
							 | 
						|||
| 
								 | 
							
								                        drpConfirmFormIds.DataSource = list;
							 | 
						|||
| 
								 | 
							
								                        drpConfirmFormIds.DataBind();
							 | 
						|||
| 
								 | 
							
								                        this.drpConfirmFormIds.SelectedValueArray = strs;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (costReport.CompileDate != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", costReport.CompileDate);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (costReport.Edition != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        txtEdition.Text = costReport.Edition.ToString();
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    this.Grid1.DataSource = BLL.CostReportDetailService.GetViewLists(CostReportId);
							 | 
						|||
| 
								 | 
							
								                    this.Grid1.DataBind();
							 | 
						|||
| 
								 | 
							
								                    bindApprove();
							 | 
						|||
| 
								 | 
							
								                    if (costReport.PlanCost != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.txtPlanCost.Text = costReport.PlanCost.ToString();
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (costReport.AuditCost != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.txtAuditCost.Text = costReport.AuditCost.ToString();
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (costReport.RealCost != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.txtRealCost.Text = costReport.RealCost.ToString();
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        private void NoEdit()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            txtCostReportCode.Enabled = false;
							 | 
						|||
| 
								 | 
							
								            drpSecretLevel.Enabled = false;
							 | 
						|||
| 
								 | 
							
								            drpUnit.Enabled = false;
							 | 
						|||
| 
								 | 
							
								            txtContractNo.Enabled = false;
							 | 
						|||
| 
								 | 
							
								            txtContractContent.Enabled = false;
							 | 
						|||
| 
								 | 
							
								            txtCompileDate.Enabled = false;
							 | 
						|||
| 
								 | 
							
								            txtEdition.Enabled = false;
							 | 
						|||
| 
								 | 
							
								            ContactImg = -1;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 审批列表
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void bindApprove()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var list = CostReportApproveService.getListData(CostReportId);
							 | 
						|||
| 
								 | 
							
								            gvApprove.DataSource = list;
							 | 
						|||
| 
								 | 
							
								            gvApprove.DataBind();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        public string man(Object man)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string appman = string.Empty;
							 | 
						|||
| 
								 | 
							
								            if (UserService.GetUserByUserId(man.ToString()) != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                appman = UserService.GetUserByUserId(man.ToString()).UserName;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return appman;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void imgBtnFile_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (string.IsNullOrEmpty(HFCostReportId.Text))   //新增记录
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                HFCostReportId.Text = SQLHelper.GetNewID(typeof(Model.CQMS_CostReport));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
							 | 
						|||
| 
								 | 
							
								            String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CostReport&menuId={2}",
							 | 
						|||
| 
								 | 
							
								            -1, HFCostReportId.Text, Const.CostReportMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void btnapprove_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            //HFCostReportId.Text
							 | 
						|||
| 
								 | 
							
								            var approve = CostReportApproveService.GetCostReportApproveByApproveMan(HFCostReportId.Text, CurrUser.UserId);
							 | 
						|||
| 
								 | 
							
								            if (approve != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var approveId = approve.CostReportApproveId;
							 | 
						|||
| 
								 | 
							
								                PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
							 | 
						|||
| 
								 | 
							
								                String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CostReport&menuId={2}",
							 | 
						|||
| 
								 | 
							
								                -1, approveId, Const.CostReportMenuId)));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void gvApprove_RowCommand(object sender, GridCommandEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            object[] keys = gvApprove.DataKeys[e.RowIndex];
							 | 
						|||
| 
								 | 
							
								            string fileId = string.Empty;
							 | 
						|||
| 
								 | 
							
								            if (keys == null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                fileId = keys[0].ToString();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
							 | 
						|||
| 
								 | 
							
								                 String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CostReport&menuId={2}",
							 | 
						|||
| 
								 | 
							
								                 -1, fileId, Const.CostReportMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |