/// <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> /// <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> /// 根据单据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; } }
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(); }
/// <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); } }
/// <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> /// 添加收款数据 /// </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); } }