/// <summary> /// 保存收款认领方法 /// </summary> private void SaveClaim() { To_Claim claimModel = new To_Claim(); claimModel.collectingID = int.Parse(Request.QueryString["id"]); //收款id claimModel.collectingNum = LblNumber.Text; //收款单号 claimModel.makerman = LblMaker.Text; //认领人员 claimModel.MakerID = int.Parse(HidMaker.Value); //认领人员id claimModel.payer = txtUnit.Text; //付款单位 claimModel.payerID = int.Parse(hidComID.Value); //付款单位id claimModel.collectAmount = double.Parse(HidReceiptAmount.Value); //收款金额 To_Collecting collectModel = To_CollectingManager.getTo_CollectingById(claimModel.collectingID); collectModel.PaymentUnit = txtUnit.Text; int comid = 0; int.TryParse(hidComID.Value, out comid); collectModel.PaymentUnitID = comid; To_CollectingManager.updateTo_CollectPaymentUnit(collectModel); To_ClaimManager claimManager = new To_ClaimManager(); int result = claimManager.Add(claimModel); if (result > 0) { SaveClaimDetail(result, claimModel.collectingID); ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('认领成功');self.location.href='ClaimList.aspx';", true); } }
/// <summary> /// 加载收款信息 /// </summary> private void LoadClaimInfo() { string collectId = Request.QueryString["collectId"]; string claimId = Request.QueryString["claimId"]; if (collectId == "" || claimId == "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "error", "alert('参数错误');self.location.href='ClaimList.aspx';", true); } To_Collecting collecting = To_CollectingManager.getTo_CollectingById(int.Parse(collectId)); LblNumber.Text = collecting.ReceiptNum; //收款单号 txtUnit.Text = collecting.PaymentUnit; //付款单位 hidComID.Value = collecting.PaymentUnitID.ToString(); //付款单位id LoginInfo login = (LoginInfo)Session["login"]; LblMaker.Text = login.Cname; //登记人员 HidMaker.Value = login.Id.ToString(); //登记人员id LtrAmount.Text = collecting.ReceiptAmount.ToString("N2"); //收款金额 this.HidReceiptAmount.Value = collecting.ReceiptAmount.ToString(); LoadClaimDetail(claimId); }
/// <summary> /// 添加收款数据 /// </summary> /// <returns>添加成功返回true</returns> private int AddCollecting() { string number = ""; //单号 string codeFormart = ""; //自动编码规则 string orderNum = ""; //流水号 if (StrNumbers(txtNumber.Text.Trim(), out number, out codeFormart, out orderNum)) { LoginInfo currentUser = Session["login"] as LoginInfo; To_Collecting collectingModel = new To_Collecting(); collectingModel.ReceiptNum = number; //收款单号 collectingModel.codeFormat = codeFormart; //编码规则 collectingModel.orderNum = orderNum; collectingModel.ReceiptDate = DateTime.Parse(txtDate.Text.Trim()); //收款时间 collectingModel.ReceiptAmount = double.Parse(txtMoney.Text.Trim()); // 收款金额 collectingModel.BusinessUnit = ddlUnit.SelectedItem.Text; //经营单位 collectingModel.BusinessUnitID = int.Parse(ddlUnit.SelectedValue); collectingModel.PaymentUnit = txtUnit.Text; //付款单位 collectingModel.PaymentUnitID = int.Parse(hidComID.Value.Trim() == string.Empty ? "0" : hidComID.Value.Trim()); //付款单位id collectingModel.PaymentMode = 1; /* int.Parse(ddlWay.SelectedValue.Trim()); //入账方式*/ collectingModel.ReceiptMark = txtMark.Value; //备注 collectingModel.Marker = currentUser.Cname; collectingModel.MarkerID = currentUser.Id; collectingModel.MarkerDepartment = lblMarkerDepartment.Text; collectingModel.MarkerDepartmentID = currentUser.Departid; collectingModel.MarkDate = DateTime.Parse(txtMarkDate.Text); collectingModel.ConfirmReceipt = ChkConfirm.Checked ? 1 : 0; collectingModel.receiptStatusCode = 0; collectingModel.payBankId = int.Parse(DdlBank.SelectedValue); collectingModel.PayBank = DdlBank.SelectedItem.Text;//txtBank.Text; collectingModel.PayBankAcount = txtBankAccount.Text; //if (int.Parse(ddlWay.SelectedValue.Trim()) != 0) //{ // collectingModel.payBankId = int.Parse(DdlBank.SelectedValue); // collectingModel.PayBank = DdlBank.SelectedItem.Text;//txtBank.Text; // collectingModel.PayBankAcount = txtBankAccount.Text; //} //else //{ // collectingModel.payBankId = 0; // collectingModel.PayBank = "";//txtBank.Text; // collectingModel.PayBankAcount = ""; //} int id = To_CollectingManager.addTo_Collecting(collectingModel); if (ChkConfirm.Checked) //如果确认登记了。那么需要登记确认人和确认日期 { To_CollectingManager.updateConfirm(id.ToString(), currentUser.Cname, DateTime.Now.ToString()); } AddLimit(id); return(id); } else { return(0); } }
/// <summary> /// 检验是否能成功产生单据名称 /// </summary> /// <param name="cuscode">输入的单号</param> /// <param name="cname">单号全称</param> /// <param name="attachment">>单号代码不包含流水号</param> /// <param name="txt">流水号</param> private bool StrNumbers(string strcuscode, out string serialNum, out string codeformat, out string ordernum) { bool result = true; serialNum = ""; //客户代码全称 codeformat = ""; //名称,不包含流水号 ordernum = ""; //流水号 DataTable tbl = GetModuleCoding(); //自动编码 string txtformat = tbl.Rows[0]["txtformat"].ToString(); //名称的格式 string usecode = tbl.Rows[0]["usecode"].ToString(); //流水号 int len = int.Parse(tbl.Rows[0]["orderlen"].ToString()); //流水号长度 DataTable custbl = null; string strsql = ""; //查询字符窜 if (usecode == "0") { if (strcuscode.Trim() != "") { serialNum = strcuscode; //客户代码全称 } else { result = false; Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "test", "<script>alert('保存失败,业务编号不能为空!')</script>"); } } else { int num = 1; //默认流水号 codeformat = Numbers(txtformat); //名称 strsql = " codeFormat= '" + codeformat + "' AND LEN(orderNum) =" + len.ToString(); custbl = To_CollectingManager.GetList(1, strsql, "markDate desc"); if (custbl.Rows.Count >= 1) { if (custbl.Rows[0]["orderNum"].ToString() != "") { num = int.Parse(custbl.Rows[0]["orderNum"].ToString()) + 1; //流水号 if (num.ToString().Length > len) { result = false; Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "test", "<script>alert('保存失败,业务编号长度不够!')</script>"); } } } ordernum = num.ToString().PadLeft(len, '0'); //流水号 serialNum = codeformat + ordernum; //客户代码全称 } return(result); }
/// <summary> /// 取消认领 /// </summary> /// <param name="id"></param> private void CancelClaim(int id) { To_ClaimManager b_claim = new To_ClaimManager(); To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager(); string claimID = b_claim.GetID(id); if (claimID != "" && b_claim.Delete(int.Parse(claimID))) { b_claimDetail.DeleteByClaim(claimID); } To_CollectingManager.ChangeClaim(id, 0); }
/// <summary> /// 发消息给用户 /// </summary> /// <param name="falg">0:取消确认,1:取消认领</param> private void SendMessage(int collectingID, int falg) { To_Collecting collecting = To_CollectingManager.getTo_CollectingById(collectingID); if (collecting == null) { return; } EtNet_Models.Information messageEntity = new EtNet_Models.Information(); To_ClaimManager claimBLL = new To_ClaimManager(); string salesman = claimBLL.GetFiledValue(collectingID, "salesman"); string msg = ""; if (falg == 0) { msg = string.Format("收款编号:{0},被业务员:{1},取消认领,取消时间:{2}", collecting.ReceiptNum, salesman, DateTime.Now.ToShortDateString()); } else { msg = string.Format("业务员:{0},对收款编号:{1},进行收款认定修改!", salesman, collecting.ReceiptNum); } messageEntity.associationid = 0;//此处不需要,默认给一个值 messageEntity.contents = msg; messageEntity.createtime = DateTime.Now; messageEntity.founderid = (Session["login"] as LoginInfo).Id; messageEntity.sendtime = DateTime.Now; messageEntity.sortid = 1;//消息分类:个人消息 if (InformationManager.Add(messageEntity)) { int messageID = InformationManager.GetMaxId(); EtNet_Models.InformationNotice messageNoticeEntity = new InformationNotice(); messageNoticeEntity.informationid = messageID; messageNoticeEntity.recipientid = collecting.MarkerID; messageNoticeEntity.remind = "是";//默认未阅读; InformationNoticeManager.Add(messageNoticeEntity); } }
/// <summary> /// 绑定收款单据列表数据 /// </summary> private void BindRpList() { double zje = 0; if (Session["login"] == null) { Response.Redirect("~/Login.aspx", true); } else { LoginInfo login = Session["login"] as LoginInfo; AspNetPager1.RecordCount = To_CollectingManager.GetTotalCount(FilterSql, login.Id); SearchPageSet sps = SearchPageSetManager.getSearchPageSetByLoginId(login.Id, 019); if (sps == null) { AspNetPager1.NumericButtonCount = 5; AspNetPager1.PageSize = 5; } else { AspNetPager1.NumericButtonCount = sps.Pagecount; AspNetPager1.PageSize = sps.Pageitem; } if (HttpContext.Current.Request.QueryString["page"] != null) { AspNetPager1.CurrentPageIndex = int.Parse(HttpContext.Current.Request.QueryString["page"]); } collectingList = To_CollectingManager.GetListByPage(FilterSql, login.Id, AspNetPager1.StartRecordIndex, AspNetPager1.EndRecordIndex); //5.31 增加总计的计算 if (collectingList.Count > 0 && collectingList != null) { foreach (To_Collecting cl in collectingList) { zje += cl.ReceiptAmount.ToString() == "" ? 0.00 : Convert.ToDouble(cl.ReceiptAmount.ToString()); } } RpList.DataSource = collectingList; RpList.DataBind(); this.zje.Text = "¥" + zje.ToString("0.00"); } }
/// <summary> /// 根据单据ID加载收款单据数据 /// </summary> /// <param name="id"></param> private void LoadCollecting(int id) { To_Collecting collectingModel = To_CollectingManager.getTo_CollectingById(id); if (collectingModel == null) { form1.InnerHtml = "<p style='font-size:14px;'>单据不存在,可能已被删除!<br /><a href='CollectingList.aspx'>返回单据列表</a></p>"; return; } txtMarkDate.Text = collectingModel.MarkDate.ToShortDateString(); lblMarkerDepartment.Text = collectingModel.MarkerDepartment; //txtBank.Text = collectingModel.PayBank; txtBankAccount.Text = collectingModel.PayBankAcount.Trim(); txtUnit.Text = collectingModel.PaymentUnit; txtMoney.Text = collectingModel.ReceiptAmount.ToString("F2"); txtDate.Text = collectingModel.ReceiptDate.ToShortDateString(); txtMark.Value = collectingModel.ReceiptMark; lblMarker.Text = collectingModel.Marker; hidComID.Value = collectingModel.PaymentUnitID.ToString() == "0" ? string.Empty : collectingModel.PaymentUnitID.ToString(); //ddlWay.SelectedValue = collectingModel.PaymentMode.ToString(); LoginInfo userInfo = LoginInfoManager.getLoginInfoById(collectingModel.MarkerID); if (userInfo != null) { LoadUnit(userInfo, collectingModel.BusinessUnitID); } if (collectingModel.PaymentMode == 0) { paymentInfo.Style.Add("display", "none"); } LoadBank(collectingModel.PayBank); if (Request.QueryString["action"] == null) { txtNumber.Text = collectingModel.ReceiptNum; txtNumber.ReadOnly = true; txtMarkDate.Text = collectingModel.MarkDate.ToShortDateString(); ChkConfirm.Checked = collectingModel.ConfirmReceipt == 1; } }
/// <summary> /// 取消认领 /// </summary> /// <param name="id"></param> private void CancelClaim(int id) { To_ClaimManager b_claim = new To_ClaimManager(); To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager(); string claimID = b_claim.GetID(id); DataTable dt = b_claimDetail.GetHasDetail(" claimID=" + claimID); if (claimID != "" && b_claim.Delete(int.Parse(claimID))) { b_claimDetail.DeleteByClaim(claimID); } To_CollectingManager.ChangeClaim(id, 0); UpdateOrderColect(dt); }
protected void ibtnDeleteAll_Click(object sender, ImageClickEventArgs e) { string delId = ""; //先遍历取得选中项 for (int i = 0; i < this.rpCollecting.Items.Count; i++) { CheckBox cbx = (CheckBox)(rpCollecting.Items[i].FindControl("cbx")); Label lbl = (Label)rpCollecting.Items[i].FindControl("lbl"); if (cbx != null || cbx.Text != "") { if (cbx.Checked) { delId += lbl.Text + ","; } } } //去掉最后一个, delId = (delId + ")").Replace(",)", ""); IList check = delId.Split(','); To_ClaimManager b_claim = new To_ClaimManager(); To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager(); for (int i = 0; i < check.Count; i++) { To_Collecting to_Collecting = To_CollectingManager.getTo_CollectingById(Convert.ToInt32(check[i])); if (to_Collecting != null) { To_CollectingManager.deleteTo_Collecting(Convert.ToInt32(check[i])); } string claimID = b_claim.GetID(Convert.ToInt32(check[i])); if (claimID != "" && b_claim.Delete(int.Parse(claimID))) { b_claimDetail.DeleteByClaim(claimID); } } dataBind(); }
protected void rpCollecting_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Delete") { int id = Convert.ToInt32(e.CommandArgument); int count = To_CollectingManager.deleteTo_Collecting(id); To_ClaimManager b_claim = new To_ClaimManager(); To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager(); if (count <= 0) { ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('删除失败')", true); return; } string claimID = b_claim.GetID(id); if (claimID != "" && b_claim.Delete(int.Parse(claimID))) { b_claimDetail.DeleteByClaim(claimID); } } dataBind(); }
protected void RpList_ItemCommand(object source, RepeaterCommandEventArgs e) { int collectId = int.Parse(e.CommandArgument.ToString().Trim()); To_ClaimManager b_claim = new To_ClaimManager(); DataTable claim = b_claim.GetList(1, " collectingID=" + collectId.ToString() + " ", "id"); int makerID = Convert.ToInt32(claim.Rows[0]["makerID"]); if (!GetVisible(makerID)) { ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('您不是认领人,无权执行此操作');", true); return; } switch (e.CommandName) { //取消认领 case "CANCEL": CancelClaim(collectId); SendMessage(collectId, 0); ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('您已成功取消认领');", true); BindRpList(); break; case "CONFIRM": To_CollectingManager.ChangeClaim(collectId, 1); SendMessage(collectId, 1); ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('您已成功取消确认');", true); BindRpList(); break; case "EDIT": Response.Redirect("ClaimEdit.aspx?collectId=" + collectId.ToString() + "&&claimId=" + claim.Rows[0]["id"].ToString()); break; default: break; } }
/// <summary> /// 保存收款认领的方法 /// </summary> private void SaveClaim() { string claimId = Request.QueryString["claimId"]; To_ClaimManager claimManager = new To_ClaimManager(); To_Claim claimModel = claimManager.GetModel(int.Parse(claimId)); //更新收款单的单位信息 To_Collecting collectModel = To_CollectingManager.getTo_CollectingById(claimModel.collectingID); collectModel.PaymentUnit = txtUnit.Text; int comid = 0; int.TryParse(hidComID.Value, out comid); collectModel.PaymentUnitID = comid; To_CollectingManager.updateTo_CollectPaymentUnit(collectModel); //认领主表的数据没有什么需要修改,故没有写,只修改认领明细中的数据 int result = SaveClaimDetail(claimModel.ID, claimModel.collectingID); if (result == 1) { ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('修改成功');self.location.href='ClaimList.aspx';", true); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { object objReceiptID = Request.QueryString["id"]; int receiptID; if (objReceiptID == null || !int.TryParse(objReceiptID.ToString(), out receiptID)) { ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('参数错误');self.location.href='../FundsAllocation.aspx';", true); return; } string strAmount = To_CollectingManager.GetAmount(receiptID); if (strAmount != string.Empty) { LtrAmount.Text = double.Parse(strAmount).ToString("C2"); HidReceiptAmount.Value = strAmount; } LoadStep1Info(); } }
/// <summary> /// 绑定收款单据列表数据 /// </summary> private void BindRpList() { LoginInfo login = Session["login"] as LoginInfo; AspNetPager1.RecordCount = To_CollectingManager.GetTotalCountByLimit(FilterSql + " AND confirmReceipt=1 ", login.Id); SearchPageSet sps = SearchPageSetManager.getSearchPageSetByLoginId(login.Id, 018); if (sps == null) { AspNetPager1.NumericButtonCount = 5; AspNetPager1.PageSize = 5; } else { AspNetPager1.NumericButtonCount = sps.Pagecount; AspNetPager1.PageSize = sps.Pageitem; } DataTable data = To_CollectingManager.GetListByLimit(FilterSql + " AND confirmReceipt=1 ", login.Id, AspNetPager1.StartRecordIndex, AspNetPager1.EndRecordIndex); RpList.DataSource = data; RpList.DataBind(); }
/// <summary> /// 提示清空 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ibtnDeleteAll_Click(object sender, ImageClickEventArgs e) { string str = ""; if (cbAnnouncement.Checked == true) { AnnouncementInfoManager.Clear(); ClearAuditAndJobflow("04"); str += "公告管理清空完成;\\n"; } if (cbCalendar.Checked == true) { CalendarsManager.Clear(); str += "日程管理清空完成;\\n"; } if (cbCompany.Checked == true) { FactoryManager.Clear(); str += "付款单位清空完成;\\n"; } if (cbCustomer.Checked == true) { CustomerManager.Clear(); ClearAuditAndJobflow("03"); str += "收款单位清空完成;\\n"; } if (cbFinancial.Checked == true) { To_CollectingManager.Clear(); str += "收款管理清空完成;\\n"; } if (cbInfomation.Checked == true) { InformationManager.Clear(); str += "消息管理清空完成;\\n"; } if (cbInvocie.Checked == true) { To_InvoiceManager.Clear(); str += "发票管理清空完成;\\n"; } if (cbLinkInfo.Checked == true) { AddressListInfoManager.Clear(); str += "通讯录清空完成;\\n"; } if (cbPicture.Checked == true) { PictureInfoManager.Clear(); str += "图片管理清空完成;\\n"; } if (cbPolicy.Checked == true) { To_OrderInfoManager.Clear(); // ClearAuditAndJobflow("02"); str += "保单管理清空完成;\\n"; } if (cbReimbursed.Checked == true) { ClearAuditAndJobflow("01"); AusRottenInfoManager.Clear(); str += "报销管理清空完成;\\n"; } // ClientScript.RegisterStartupScript(this.GetType(), "", " <script lanuage=javascript> alert('"+ str +"');</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "page", string.Format("alert('{0}');", str), true); }
/// <summary> /// 根据单据ID加载收款单据数据 /// </summary> /// <param name="id"></param> private void LoadCollecting(int id) { To_Collecting collectingModel = To_CollectingManager.getTo_CollectingById(id); if (collectingModel == null) { form1.InnerHtml = "<p style='font-size:14px;'>单据不存在,可能已被删除!<br /><a href='CollectingList.aspx'>返回单据列表</a></p>"; return; } LblMakeDate.Text = collectingModel.MarkDate.ToShortDateString(); LblMakeDepartment.Text = collectingModel.MarkerDepartment; LblPayBank.Text = collectingModel.PayBank; LblPayBankAcount.Text = collectingModel.PayBankAcount; LblPaymentUnit.Text = collectingModel.PaymentUnit; LblReceiptAmount.Text = collectingModel.ReceiptAmount.ToString("N2"); LblReceiptDate.Text = collectingModel.ReceiptDate.ToShortDateString(); LtrMark.Text = collectingModel.ReceiptMark; LblReceiptNum.Text = collectingModel.ReceiptNum; LtrConfirm.Text = collectingModel.ConfirmReceipt == 1 ? "已确认" : "<font color='red'>未确认</font>"; LblMaker.Text = collectingModel.Marker; //如果已经确认那么显示确认信息 if (collectingModel.ConfirmReceipt == 1) { confirm.Visible = true; DataTable dt = To_CollectingManager.getConfirmInfo(id.ToString()); if (dt.Rows.Count > 0) { this.lblConfirmMan.Text = dt.Rows[0]["confirmMan"].ToString(); this.lblConfirmDate.Text = dt.Rows[0]["confirmDate"].ToString(); } } switch (collectingModel.PaymentMode) { case 0: LblPaymentMode.Text = "现金"; break; case 1: LblPaymentMode.Text = "转账"; break; case 2: LblPaymentMode.Text = "网银"; break; default: LblPaymentMode.Text = "未知"; break; } LblBusinessUnit.Text = collectingModel.BusinessUnit; if (collectingModel.PaymentMode != 0) { paymentInfo.Visible = true; } else { paymentInfo.Visible = false; } LoadClaimDetail(id); }
/// <summary> /// 根据单据ID删除收款数据 /// </summary> /// <param name="id">要删除的单据ID</param> private void DeleteCollecting(int id) { To_CollectingManager.deleteTo_Collecting(id); BindRpList(); }
/// <summary> /// 根据收款单据ID查询认领明细 /// </summary> /// <param name="collcetingID"></param> /// <returns></returns> private void LoadClaimDetail(int collcetingID) { RpPolicyList.DataSource = To_CollectingManager.GetClaimDetail(collcetingID); RpPolicyList.DataBind(); }
protected void RpList_ItemCommand(object source, RepeaterCommandEventArgs e) { //参数数组,0:单据ID,1:是否确认,2:制单员 string[] cmdArgs = e.CommandArgument.ToString().Split(','); string cmdName = e.CommandName; //表示单据是否已确认 bool confirmReceipt = false; bool ismaker = false; LoginInfo login = Session["login"] as LoginInfo; if (cmdArgs.Length > 1) { confirmReceipt = cmdArgs[1] == "1"; ismaker = cmdArgs[2] == login.Cname; } string msg = ""; switch (cmdName) { case "EDIT": if (confirmReceipt) { msg = "已确认单据不能修改"; break; } if (!ismaker) { msg = "不是本人所做的收款单不能修改"; break; } if (HttpContext.Current.Request.QueryString["page"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["page"]); Server.Transfer(string.Format("CollectingEdit.aspx?pageindex=" + page + "&id={0}", cmdArgs[0])); } else { Server.Transfer(string.Format("CollectingEdit.aspx?id={0}", cmdArgs[0])); } break; case "search": if (AspNetPager1.CurrentPageIndex > 1) { int page = AspNetPager1.CurrentPageIndex; Response.Redirect("Collecting.aspx?pageindex=" + page + "&id=" + e.CommandArgument.ToString()); //参数sqsh判断当前所跳转到预览界面的是申请还是审核 } else { Response.Redirect("Collecting.aspx?id=" + e.CommandArgument.ToString()); } break; case "DELETE": if (confirmReceipt) { msg = "已确认单据不能删除"; break; } if (!ismaker) { msg = "不是本人所做的收款单不能删除"; break; } DeleteCollecting(int.Parse(cmdArgs[0])); break; case "CANCEL": To_ClaimManager claimBLL = new To_ClaimManager(); if (claimBLL.ExitsCollecting(int.Parse(cmdArgs[0]))) { msg = "该条收款记录已被认领,不能取消确认"; break; } To_CollectingManager.CancelConfirm(int.Parse(cmdArgs[0])); BindRpList(); break; case "confirm": To_CollectingManager.updateConfirm(cmdArgs[0], login.Cname, DateTime.Now.ToString()); BindRpList(); break; case "CHANGE": To_Income income = new To_Income(); DataTable mytable = To_CollectingManager.GetList(1, "id=" + cmdArgs[0], "id desc"); if (mytable != null) { income.ComeBankAccount = mytable.Rows[0]["payBankAcount"].ToString(); income.ComeBankId = int.Parse(mytable.Rows[0]["payBankId"].ToString()); income.ComeBankName = mytable.Rows[0]["payBank"].ToString(); income.ComeDate = DateTime.Parse(mytable.Rows[0]["receiptDate"].ToString()); income.ComeDepart = mytable.Rows[0]["markerDepartment"].ToString(); income.ComeDepartId = int.Parse(mytable.Rows[0]["markerDepartmentID"].ToString()); income.ComeMoney = double.Parse(mytable.Rows[0]["receiptAmount"].ToString()); income.ComeUnit = mytable.Rows[0]["paymentUnit"].ToString(); income.MakeDate = DateTime.Parse(mytable.Rows[0]["markDate"].ToString()); income.MakeId = int.Parse(mytable.Rows[0]["markerID"].ToString()); income.MakeName = mytable.Rows[0]["marker"].ToString(); income.Remark = mytable.Rows[0]["receiptMark"].ToString() + " 由原收款单号为" + mytable.Rows[0]["receiptNum"].ToString() + "转化而来"; income.SKType = ""; income.SKTypeId = 0; if (To_IncomeManager.Add(income) > 0) { msg = "该条收款记录已成功转化为其他收款"; To_CollectingManager.deleteTo_Collecting(int.Parse(cmdArgs[0])); //转化完成之后对起进行删除 } } BindRpList(); break; default: break; } if (msg != string.Empty) { ClientScript.RegisterClientScriptBlock(this.GetType(), "page", string.Format("alert('{0}');", msg), true); } }
/// <summary> /// 保存收款认领明细数据的方法 /// </summary> /// <param name="claimId">收款认领单id</param> /// <param name="collectId">收款单id</param> private void SaveClaimDetail(int claimId, int collectId) { IList <string> orderColectIDs = new List <string>(); To_CollectingManager.ChangeClaim(Convert.ToInt32(Request.QueryString["id"]), chkFinish.Checked ? 2 : 1); if (chkFinish.Checked) { SendMessage(collectId, LblMaker.Text, 1); } else { SendMessage(collectId, LblMaker.Text, 0); } if (HidClaimDetail.Value.Trim() != string.Empty) { To_ClaimDetailManager claimDetailManager = new To_ClaimDetailManager(); string[] items = HidClaimDetail.Value.Trim().TrimEnd('@').Split('@'); if (items.Length > 0) { To_ClaimDetail claimDetail = new To_ClaimDetail(); foreach (string item in items) { string[] detail = item.Trim().Split('$'); if (detail.Length > 0) { claimDetail.claimID = claimId; //收款单id claimDetail.orderCollectId = int.Parse(detail[0]); //订单表收款信息明细表id if (!orderColectIDs.Contains(detail[0])) { orderColectIDs.Add(detail[0]); } claimDetail.orderCusId = int.Parse(hidComID.Value); //付款单位id claimDetail.orderNum = detail[1]; //订单编号 claimDetail.receiptAmount = decimal.Parse(detail[2]); //应收金额(在编辑的时候还是要去该订单表收款明细的应收金额,因为这个应收金额可能会变) claimDetail.realAmount = decimal.Parse(detail[3]); //本次收款金额 claimDetail.mark = detail[4]; //备注 claimDetailManager.Add(claimDetail); } } } //更新收款信息明细表的收款状态和实际收款金额 for (int i = 0; i < orderColectIDs.Count; i++) { if (orderColectIDs[i] != "") { double hasAmount = claimDetailManager.GetHasAmount(orderColectIDs[i]); //得到该收款信息明细表关联的所有认领过的金额 double shouldAmount = To_OrderCollectDetialManager.getTo_OrderCollectDetialById(int.Parse(orderColectIDs[i])).Money; //得到应收金额 string getstatus = ""; if (hasAmount == 0) { getstatus = "未收款"; } else if (shouldAmount > hasAmount) { getstatus = "部分收款"; } else { getstatus = "完成收款"; } To_OrderCollectDetialManager.updateDetialStatusAndMoney(orderColectIDs[i], getstatus, hasAmount.ToString()); } } } }
protected void BtnSubmit_Click(object sender, ImageClickEventArgs e) { To_ClaimManager b_claim = new To_ClaimManager(); To_Claim m_claim = new To_Claim(); Step1 step1 = Context.Handler as Step1; m_claim.collectingID = Convert.ToInt32(Request.QueryString["id"]); m_claim.costType = HidReceiptType.Value; m_claim.payer = HidPayer.Value; m_claim.payerID = int.Parse(HidPayerID.Value); m_claim.payerType = int.Parse(HidPayerType.Value); m_claim.salesman = HidSalesman.Value; m_claim.salesmanID = int.Parse(HidSalesmanID.Value); m_claim.makerID = (Session["login"] as LoginInfo).Id; int claimID = b_claim.Add(m_claim); if (claimID != 0) { To_CollectingManager.ChangeClaim(Convert.ToInt32(Request.QueryString["id"]), chkFinish.Checked ? 2 : 1); if (chkFinish.Checked) { SendMessage(m_claim.collectingID, HidSalesman.Value, 1); } else { SendMessage(m_claim.collectingID, HidSalesman.Value, 0); } if (HidClaimDetail.Value.Trim() != string.Empty) { string[] items = HidClaimDetail.Value.Trim().TrimEnd('@').Split('@'); if (items.Length > 0) { To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager(); To_ClaimDetail m_claimDetail = new To_ClaimDetail(); foreach (string item in items) { string[] detail = item.Trim().Split('$'); if (detail.Length > 0) { int policyID = int.Parse(detail[0].Trim()); decimal amount = decimal.Parse(detail[1].Trim().TrimStart('¥').TrimStart('¥')); decimal realAmount = decimal.Parse(detail[2].Trim()); m_claimDetail.claimID = claimID; m_claimDetail.mark = ""; m_claimDetail.policyID = policyID; m_claimDetail.realAmount = realAmount; m_claimDetail.receiptAmount = amount; m_claimDetail.receiptStatusCode = 0; b_claimDetail.Add(m_claimDetail); } } } } ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('认领成功');self.location.href='../FundsAllocation.aspx';", true); } }
/// <summary> /// 添加收款数据 /// </summary> /// <returns>添加成功返回true</returns> private bool EditCollecting() { LoginInfo currentUser = Session["login"] as LoginInfo; To_Collecting collectingModel = new To_Collecting(); int ID = Convert.ToInt32(Request.QueryString["id"]); collectingModel = To_CollectingManager.getTo_CollectingById(ID); collectingModel.BusinessUnit = ddlUnit.SelectedItem.Text; collectingModel.BusinessUnitID = int.Parse(ddlUnit.SelectedValue); collectingModel.MarkDate = DateTime.Parse(txtMarkDate.Text); collectingModel.Marker = currentUser.Cname; collectingModel.MarkerID = currentUser.Id; collectingModel.MarkerDepartment = lblMarkerDepartment.Text; collectingModel.MarkerDepartmentID = currentUser.Departid; collectingModel.payBankId = int.Parse(DdlBank.SelectedValue); collectingModel.PayBank = DdlBank.SelectedItem.Text;//txtBank.Text; collectingModel.PayBankAcount = txtBankAccount.Text; //collectingModel.PaymentMode = int.Parse(ddlWay.SelectedValue.Trim()); //if (int.Parse(ddlWay.SelectedValue.Trim()) != 0) //{ // if (DdlBank.SelectedIndex < 0) // { // return false; // } // collectingModel.payBankId = int.Parse(DdlBank.SelectedValue); // collectingModel.PayBank = DdlBank.SelectedItem.Text;//txtBank.Text; // collectingModel.PayBankAcount = txtBankAccount.Text; //} //else //{ // collectingModel.payBankId = 0; // collectingModel.PayBank = "";//txtBank.Text; // collectingModel.PayBankAcount = ""; //} collectingModel.PaymentUnit = txtUnit.Text; collectingModel.PaymentUnitID = int.Parse(hidComID.Value.Trim() == string.Empty ? "0" : hidComID.Value.Trim()); collectingModel.ReceiptAmount = float.Parse(txtMoney.Text); collectingModel.ReceiptDate = DateTime.Parse(txtDate.Text); collectingModel.ReceiptMark = txtMark.Value; collectingModel.ReceiptNum = txtNumber.Text; collectingModel.ConfirmReceipt = ChkConfirm.Checked ? 1 : 0; AddLimit(ID); if (ChkConfirm.Checked) //如果确认登记了。那么需要登记确认人和确认日期 { To_CollectingManager.updateConfirm(ID.ToString(), currentUser.Cname, DateTime.Now.ToString()); } if (Request.QueryString["action"] == null) { collectingModel.ID = Convert.ToInt32(Request.QueryString["id"]); return(To_CollectingManager.updateTo_Collecting(collectingModel) > 0); } else { return(To_CollectingManager.addTo_Collecting(collectingModel) > 0); } }