protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-6")) { CertificateID = HTTPRequest.GetInt("cid", 0); if (CertificateID > 0) { ci = Certificates.GetCertificateInfoModel(CertificateID); if (ci != null) { CertificateDataList = Certificates.GetCertificateDataInfoList(" cd.CertificateID = " + CertificateID + " order by cd.CertificateDataID asc").Tables[0]; //凭证行数 if (CertificateDataList != null) { CertificateRow = CertificateDataList.Rows.Count; CertificateMAXRow = config.CertificateRow; //超过最大显示行数,进行数据拆分 //if (CertificateRow > CertificateMAXRow) { int i = 0; DataTable dt = CertificateDataList.Clone(); foreach (DataRow dr in CertificateDataList.Rows) { dt.ImportRow(dr); i++; if (i % CertificateMAXRow == 0) { CertificateDataSet.Tables.Add(dt); dt = CertificateDataList.Clone(); dt.TableName = "t_" + i; } } if (dt.Rows.Count > 0) { //剩下的行数 CertificateDataSet.Tables.Add(dt); dt = CertificateDataList.Clone(); dt.TableName = "t_" + (i + 1); } } } //制单人 print_ui = tbUserInfo.GetUserInfoModel(ci.UserID); //审核人 CertificateWorkingLogInfo owil = Certificates.GetCertificateWorkingLogUserID(ci.CertificateID, 2); if (owil != null) { print_v_ui = tbUserInfo.GetUserInfoModel(owil.UserID); } else { print_v_ui = null; } CertificateWorkingLogInfo co = new CertificateWorkingLogInfo(); co.CertificateID = CertificateID; co.UserID = this.userid; co.cType = 3; co.cAppendTime = DateTime.Now; Certificates.AddCertificateWorkingLog(co); } else { AddErrLine("凭证不存在!"); } } else { AddErrLine("参数错误!"); } } else { AddErrLine("权限不足!"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
protected virtual void Page_Load(object sender, EventArgs e) { pagesize = 20; PageBarHTML = ""; if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-1")) { if (HTTPRequest.GetString("page").Trim() != "" && Utils.IsInt(HTTPRequest.GetString("page").Trim())) { pageindex = int.Parse(HTTPRequest.GetString("page").Trim()); } else { pageindex = 1; } string tSQL = " tbCertificateDataInfo.CertificateID in (select CertificateID from tbCertificateInfo where cState=0) "; Act = HTTPRequest.GetString("Act"); S_key = HTTPRequest.GetString("S_key"); ShowType = HTTPRequest.GetInt("ShowType", 0); cObjectName = HTTPRequest.GetString("cObjectName"); cObjectType = HTTPRequest.GetInt("cObjectType", -1); cObjectID = HTTPRequest.GetInt("cObjectID", -1); cObjectIsRoot = HTTPRequest.GetInt("cObjectIsRoot", -1); FeesSubject = HTTPRequest.GetString("FeesSubject"); FeesSubjectID = HTTPRequest.GetInt("FeesSubjectID", -1); StaffID = HTTPRequest.GetInt("StaffID", -1); StaffName = HTTPRequest.GetString("StaffName"); TimeB = HTTPRequest.GetString("TimeB"); TimeE = HTTPRequest.GetString("TimeE"); cSteps = HTTPRequest.GetInt("cSteps", -1); #region 单位 if (cObjectID > 0) { string cObjectIDStr = ""; if (cObjectIsRoot == 1)//非叶节点 { switch (cObjectType) { case 0: //客户 cObjectIDStr = DataClass.GetCustomersClassChildStr(cObjectID); if (cObjectIDStr.Trim() != "") { cObjectIDStr = "select StoresID from tbStoresInfo where CustomersClassID in(" + cObjectIDStr + "," + cObjectID + ")"; } break; case 1: //供应商 cObjectIDStr = DataClass.GetSupplierClassChildStr(cObjectID); if (cObjectIDStr.Trim() != "") { cObjectIDStr = "select SupplierID from tbSupplierInfo where SupplierClassID in(" + cObjectIDStr + "," + cObjectID + ")"; } break; case 2: //人员 cObjectIDStr = DataClass.GetDepartmentsClassChildStr(cObjectID); if (cObjectIDStr.Trim() != "") { cObjectIDStr = "select StaffID from tbStaffInfo where DepartmentsClassID in(" + cObjectIDStr + "," + cObjectID + ")"; } break; } } else { cObjectIDStr = cObjectID.ToString(); } tSQL += " and tbCertificateDataInfo.toObject=" + cObjectType + " and tbCertificateDataInfo.toObjectID in(" + cObjectIDStr + ")"; } #endregion #region 科目 if (FeesSubjectID > 0) { string FeesSubjectIDStr = DataClass.GetFeesSubjectClassChildStr(FeesSubjectID); if (FeesSubjectIDStr.Trim() != "") { tSQL += " and tbCertificateDataInfo.FeesSubjectID in(" + FeesSubjectIDStr + "," + FeesSubjectID + ")"; } else { tSQL += " and tbCertificateDataInfo.FeesSubjectID in(" + FeesSubjectID + ")"; } } #endregion #region 经办人 if (StaffID > 0) { tSQL += " and tbCertificateDataInfo.CertificateID in (select CertificateID from tbCertificateInfo where StaffID=" + StaffID + ") "; } #endregion #region 时间 if (TimeB.Trim() != "" && Utils.IsDateString(TimeB.Trim())) { tSQL += " and tbCertificateDataInfo.CertificateID in (select CertificateID from tbCertificateInfo where cDateTime>='" + Convert.ToDateTime(TimeB.Trim()).ToShortDateString() + " 00:00:00 ') "; } if (TimeE.Trim() != "" && Utils.IsDateString(TimeE.Trim())) { tSQL += " and tbCertificateDataInfo.CertificateID in (select CertificateID from tbCertificateInfo where cDateTime<='" + Convert.ToDateTime(TimeE.Trim()).ToShortDateString() + " 23:59:59 ') "; } #endregion if (cSteps > -1) { tSQL += " and tbCertificateDataInfo.CertificateID in (select CertificateID from tbCertificateInfo where cSteps=" + cSteps + ")"; } if (!IsErr()) { if (Act.IndexOf("Export") > -1)//导出 { tSQL = Utils.ReplaceString(tSQL, "tbCertificateDataInfo.", "cd.", false); DataSet _exDs = Certificates.GetCertificateDataInfoListB(tSQL + " order by cd.CertificateDataID desc"); _exDs.Tables[0].Columns[0].ColumnName = "凭证编号"; _exDs.Tables[0].Columns[1].ColumnName = "凭证类型"; _exDs.Tables[0].Columns[2].ColumnName = "发生时间"; _exDs.Tables[0].Columns[3].ColumnName = "摘要"; _exDs.Tables[0].Columns[4].ColumnName = "金额"; _exDs.Tables[0].Columns[5].ColumnName = "科目"; _exDs.Tables[0].Columns[6].ColumnName = "单位类型"; _exDs.Tables[0].Columns[7].ColumnName = "单位"; _exDs.Tables[0].Columns[8].ColumnName = "经办人"; _exDs.Tables[0].Columns[9].ColumnName = "说明"; _exDs.Tables[0].Columns[10].ColumnName = "创建时间"; CreateExcel(_exDs.Tables[0], "Data_" + DateTime.Now.ToShortDateString() + ".xls"); } else { decimal[] SumMoney = Certificates.GetCertificateDataSumMoney(tSQL); SumMoneyA = SumMoney[0]; SumMoneyB = SumMoney[1]; dList = Certificates.GetCertificateDataInfoList(pagesize, pageindex, tSQL, out pagetotal, 1, "*"); PageBarHTML = Utils.TenPage(pageindex, pagetotal, 0, "&Act=" + Act + "&S_key=" + S_key + "&ShowType=" + ShowType + "&cObjectName=" + cObjectName + "&cObjectType=" + cObjectType + "&cObjectID=" + cObjectID + "&cObjectIsRoot=" + cObjectIsRoot + "&FeesSubject=" + FeesSubject + "&FeesSubjectID=" + FeesSubjectID + "&StaffName=" + StaffName + "&StaffID=" + StaffID + "&TimeB=" + TimeB + "&TimeE=" + TimeE + "&cSteps=" + cSteps); } } } else { AddErrLine("权限不足!"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
//public DataTable BankList = new DataTable();//银行列表 protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { /* * CertificateDataJson cdj = new CertificateDataJson(); * CertificateDataInfo[] cdi = new CertificateDataInfo[1] ; * cdi[0] = new CertificateDataInfo(); * cdi[0].cdAppendTime = DateTime.Now; * * cdj.CertificateDataInfoJson = cdi; * CertificateDataJsonStr = JavaScriptConvert.SerializeObject(cdi); */ if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-1") || CheckUserPopedoms("6-5-2") || CheckUserPopedoms("6-5-3") || CheckUserPopedoms("6-5-4")) { Act = HTTPRequest.GetString("Act"); OrderType = HTTPRequest.GetInt("OrderType", 0); OrderID = HTTPRequest.GetInt("OrderID", 0); string NewPIC = Utils.ChkSQL(HTTPRequest.GetString("NewPIC")); cCode = Utils.ChkSQL(HTTPRequest.GetString("cCode")); format = HTTPRequest.GetString("format"); #region 鉴权 if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-1") || CheckUserPopedoms("6-5-2") || CheckUserPopedoms("6-5-3") || CheckUserPopedoms("6-5-4") || CheckUserPopedoms("6-5-5") || CheckUserPopedoms("6-5-6")) { if (Act == "Add") { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-1")) { } else { AddErrLine("权限不足,无法新建 凭证 列表!"); } } if (Act == "Edit" || Act == "View") { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-2") || CheckUserPopedoms("6-5-3")) { } else { AddErrLine("权限不足,无法新建 凭证 列表!"); } } //作废 if (Act == "i") { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-4")) { } else { AddErrLine("权限不足,无法新建 凭证 列表!"); } } //审核 if (Act == "s") { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-5")) { } else { AddErrLine("权限不足,无法新建 凭证 列表!"); } } } #endregion if (!IsErr()) { if (Act == "Edit") { CertificateID = Utils.StrToInt(HTTPRequest.GetString("cid"), 0); ci = Certificates.GetCertificateInfoModel(CertificateID); cCode = ci.cCode; cDateTime = ci.cDateTime; cNumber = ci.cNumber; IsVerify = ci.cSteps == 1; if (IsVerify) { TimeSpan ts1 = new TimeSpan(DateTime.Now.Ticks); TimeSpan ts2 = new TimeSpan(Certificates.GetLastVerifyTime(CertificateID).Ticks); TimeSpan ts = ts1.Subtract(ts2).Duration(); IsVerifyLongTime = ts.TotalHours > 48; IsVerifyLongTimeB = ts.TotalHours > 6; } DataTable cdList = Certificates.GetCertificateDataInfoList(" cd.CertificateID = " + CertificateID + " order by cd.CertificateDataID asc").Tables[0]; if (cdList != null) { foreach (DataRow dr in cdList.Rows) { CertificateDataJsonStr += "{\"CertificateDataID\":\"" + dr["CertificateDataID"].ToString() + "\",\"CertificateID\":\"" + dr["CertificateID"].ToString() + "\",\"FeesSubjectName\":\"" + dr["FeesSubjectName"].ToString() + "\",\"FeesSubjectID\":\"" + dr["FeesSubjectID"].ToString() + "\",\"cdName\":\"" + dr["cdName"].ToString() + "\",\"cdMoney\":\"" + dr["cdMoney"].ToString() + "\",\"cdMoneyB\":\"" + dr["cdMoneyB"].ToString() + "\",\"cdRemake\":\"" + dr["cdRemake"].ToString() + "\",\"cdAppendTime\":\"" + dr["cdAppendTime"].ToString() + "\",\"toObject\":\"" + dr["toObject"].ToString() + "\",\"toObjectID\":\"" + dr["toObjectID"].ToString() + "\",\"ObjectName\":\"" + dr["ObjectName"].ToString() + "\"},"; } } if (CertificateDataJsonStr.Trim() != "") { CertificateDataJsonStr = "{\"CertificateDataInfoJson\":[" + Utils.ReSQLSetTxt(CertificateDataJsonStr.Trim()) + "]}"; } PicList = Certificates.GetCertificatePicInfoList(" CertificateID=" + CertificateID + " order by cAppendTime desc").Tables[0]; } if (ispost) { //string cCode = Utils.ChkSQL(HTTPRequest.GetString("cCode")); decimal cMoney = (HTTPRequest.GetString("cMoney").Trim() != "") ? Convert.ToDecimal(HTTPRequest.GetString("cMoney")) : 0; int cType = HTTPRequest.GetInt("cType", 0); int UserID = this.userid; int StaffID = HTTPRequest.GetInt("StaffID", 0); string cRemake = HTTPRequest.GetString("cRemake"); int toObject = HTTPRequest.GetInt("toObject", 0); int toObjectID = HTTPRequest.GetInt("toObjectID", 0); int cObject = HTTPRequest.GetInt("cObject", 0); int cObjectID = HTTPRequest.GetInt("cObjectID", 0); int cState = HTTPRequest.GetInt("cState", 0); int BankID = HTTPRequest.GetInt("BankID", 0); cNumber = HTTPRequest.GetInt("cNumber", 0); cDateTime = (HTTPRequest.GetString("cDateTime").Trim() != "") ? Convert.ToDateTime(HTTPRequest.GetString("cDateTime")) : DateTime.Now; string CertificateDataStr = Utils.ChkSQL(HTTPRequest.GetString("CertificateDataStr")); ci.cMoney = cMoney; ci.cType = cType; ci.StaffID = StaffID; ci.cRemake = cRemake; ci.toObject = toObject; ci.toObjectID = toObjectID; ci.cObject = cObject; ci.cObjectID = cObjectID; ci.cState = cState; ci.cDateTime = cDateTime; ci.BankID = BankID; ci.CertificateDataJson = (CertificateDataJson)JavaScriptConvert.DeserializeObject(CertificateDataStr, typeof(CertificateDataJson)); if (Act == "Add") { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-1")) { ci.cSteps = 0; ci.UserID = UserID; ci.cAppendTime = DateTime.Now; ci.cCode = Certificates.GetNewNum(); //cCode;// ci.cNumber = cNumber; if (!Certificates.CheckCertificateNumber(ci.cDateTime, ci.cNumber)) { if (!Certificates.ExistsCertificateInfo(ci.cCode)) { CertificateID = Certificates.AddCertificateInfo(ci); //添加凭证照片 AddPic(NewPIC, CertificateID); CertificateWorkingLogInfo co = new CertificateWorkingLogInfo(); co.CertificateID = CertificateID; co.UserID = this.userid; co.cType = 0; co.cAppendTime = DateTime.Now; Certificates.AddCertificateWorkingLog(co); AddMsgLine("凭证录入成功!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } else { AddErrLine("凭证编号重复,系统已存在该编号(" + ci.cCode + ")!"); } } else { AddErrLine("凭证序号重复,系统已存在该序号(" + ci.cDateTime.ToString("yyyyMMdd") + "-" + (ci.cNumber.ToString()).PadLeft(config.CertificateCodeLen, '0') + ")!"); } } else { AddErrLine("权限不足!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } } if (Act == "Edit") { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-3")) { if (ci.cNumber != cNumber) { if (!Certificates.CheckCertificateNumber(ci.cDateTime, cNumber)) { ci.cNumber = cNumber; } else { AddErrLine("凭证序号重复,系统已存在该序号(" + ci.cDateTime.ToString("yyyyMMdd") + "-" + (cNumber.ToString()).PadLeft(config.CertificateCodeLen, '0') + ")!"); } } if (!IsErr()) { Certificates.UpdateCertificateInfo(ci); //添加凭证照片 AddPic(NewPIC, CertificateID); CertificateWorkingLogInfo co = new CertificateWorkingLogInfo(); co.CertificateID = CertificateID; co.UserID = this.userid; co.cType = 1; co.cAppendTime = DateTime.Now; Certificates.AddCertificateWorkingLog(co); AddMsgLine("凭证 " + ci.cDateTime.ToString("yyyyMMdd") + "-" + (ci.cNumber.ToString()).PadLeft(config.CertificateCodeLen, '0') + " 修改成功!"); AddScript("window.setTimeout('location=\"/certificate_do-Edit-" + OrderType + "-" + OrderID + "-" + CertificateID + ".aspx\";',1000);"); } } else { AddErrLine("权限不足!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } } } else { if (format != "json") { //BankList = tbBankInfo.GetBankList("").Tables[0]; StaffList = Caches.GetDepartmentsClassInfoAndStaffListToHTML(); //FeesSubjectClassList = Caches.GetFeesSubjectClassInfoToHTML(); //string CustomersList = Caches.GetCustomersClassInfoAndDataToHTML();//客户 //string SupplierList = Caches.GetSupplierClassInfoAndDataToHTML();//供应商 //ToObjectList = "<ul><li rel=\"cus\">客户" + CustomersList + "</li>"+ // "<li rel=\"sup\">供应商" + SupplierList + "</li>" + // "<li rel=\"sta\">人员" + StaffList + "</li>" + // "</ul>"; DepartmentsJson = Caches.GetDepartmentsClassInfoToJson(-1, true, true); SupplierJson = Caches.GetSupplierClassInfoToJson(-1, true, true); CustomersJson = Caches.GetCustomersClassInfoToJson(-1, true, true); FeesSubjectJson = Caches.GetFeesSubjectClassInfoToJson(-1, false, true); PaymentSystemJson = Caches.GetPaymentSystemJson(); } if (Act == "Add") { cCode = "";// Certificates.GetNewNum(); cNumber = Certificates.GetCertificateNewNumber(cDateTime); } if (Act == "GetNum") { CertificateID = Utils.StrToInt(HTTPRequest.GetString("cid"), 0); cDateTime = (HTTPRequest.GetString("cDateTime").Trim() != "") ? Convert.ToDateTime(HTTPRequest.GetString("cDateTime")) : DateTime.Now; cNumber = Certificates.GetCertificateNewNumber(cDateTime); tJson = ",\"MaxOrderDate\":\"" + Certificates.GetMaxCertificateData(CertificateID) + "\",\"Num\":" + cNumber; } //作废 if (Act == "i") { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-4")) { CertificateID = Utils.StrToInt(HTTPRequest.GetString("cid"), 0); if (CertificateID > 0) { ci = Certificates.GetCertificateInfoModel(CertificateID); if (ci != null) { ci.cState = 1; Certificates.UpdateCertificateInfo(ci); CertificateWorkingLogInfo co = new CertificateWorkingLogInfo(); co.CertificateID = CertificateID; co.UserID = this.userid; co.cType = -1; co.cAppendTime = DateTime.Now; Certificates.AddCertificateWorkingLog(co); AddMsgLine("凭证 " + ci.cDateTime.ToString("yyyyMMdd") + "-" + (ci.cNumber.ToString()).PadLeft(config.CertificateCodeLen, '0') + " 作废成功!"); } else { AddErrLine("凭证不存在!"); } } else { AddErrLine("参数错误!"); } } else { AddErrLine("权限不足!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } } //审核 if (Act == "s") { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-5")) { CertificateID = Utils.StrToInt(HTTPRequest.GetString("cid"), 0); if (CertificateID > 0) { ci = Certificates.GetCertificateInfoModel(CertificateID); if (ci != null) { Certificates.SetCertificateSteps(CertificateID, 1); CertificateWorkingLogInfo co = new CertificateWorkingLogInfo(); co.CertificateID = CertificateID; co.UserID = this.userid; co.cType = 2; co.cAppendTime = DateTime.Now; Certificates.AddCertificateWorkingLog(co); AddMsgLine("凭证 " + ci.cDateTime.ToString("yyyyMMdd") + "-" + (ci.cNumber.ToString()).PadLeft(config.CertificateCodeLen, '0') + " 审核成功!"); } else { AddErrLine("凭证不存在!"); } } else { AddErrLine("参数错误!"); } } else { AddErrLine("权限不足!"); } } //撤回重审 if (Act == "rs") { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-7") || CheckUserPopedoms("6-5-8")) { CertificateID = Utils.StrToInt(HTTPRequest.GetString("cid"), 0); if (CertificateID > 0) { ci = Certificates.GetCertificateInfoModel(CertificateID); if (ci != null) { Certificates.SetCertificateSteps(CertificateID, 0); CertificateWorkingLogInfo co = new CertificateWorkingLogInfo(); co.CertificateID = CertificateID; co.UserID = this.userid; co.cType = 4; co.cAppendTime = DateTime.Now; Certificates.AddCertificateWorkingLog(co); AddMsgLine("凭证 " + ci.cDateTime.ToString("yyyyMMdd") + "-" + (ci.cNumber.ToString()).PadLeft(config.CertificateCodeLen, '0') + " 撤回成功!"); } else { AddErrLine("凭证不存在!"); } } else { AddErrLine("参数错误!"); } } else { AddErrLine("权限不足!"); } } //获取指定凭证前后两个凭证信息 if (Act == "p") { if (CheckUserPopedoms("X") || CheckUserPopedoms("6-5-2")) { CertificateID = Utils.StrToInt(HTTPRequest.GetString("cid"), 0); if (CertificateID > 0) { long[] UpDownID = Certificates.GetCertificateUpDownID(CertificateID); tJson = ",\"UpDownID\":{\"UpID\":\"" + UpDownID[0] + "\",\"DownID\":\"" + UpDownID[1] + "\"}"; } else { AddErrLine("参数错误!"); } } else { AddErrLine("权限不足!"); } } } } } else { AddErrLine("权限不足!"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } if (format == "json") { Response.ClearContent(); Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1); Response.Expires = 0; Response.Charset = "utf-8"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.ContentType = "application/json"; string Json_Str = "{\"results\": {\"msg\":\"" + this.msgbox_text + "\",\"state\":\"" + (!IsErr()).ToString() + "\"" + tJson + "}}"; Response.Write(Json_Str); Response.End(); } }