123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.MembershipManage.SetSmallForm
- {
- public partial class DataSetServiceBoxSetSmallForm : LYFZ.Software.UI.MembershipManage.SetSmallForm.DataSetServiceBoxSetSmallForm
- {
- public DataSetServiceBoxSetSmallForm()
- {
- this.cmbtreevClass.ComboBoxTree_NodeMouseClick += cmbtreevClass_ComboBoxTree_NodeMouseClick;
- }
- LYFZ.BLL.BLL_ErpMemberCard mcbll = new BLL.BLL_ErpMemberCard();
- LYFZ.BLL.BLL_ErpSMSRecord rbll = new LYFZ.BLL.BLL_ErpSMSRecord();
- LYFZ.BLL.BLL_SMSTemplates smsTemplates = new BLL.BLL_SMSTemplates();
- LYFZ.BLL.BLL_ErpSystemCategory scbll = new BLL.BLL_ErpSystemCategory();
- LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
- LYFZ.BLL.BLL_ErpMemberCardPoints mcptsbll = new BLL.BLL_ErpMemberCardPoints();
- LYFZ.BLL.BLL_ErpMemberCardPayment mcptbll = new BLL.BLL_ErpMemberCardPayment();
- LYFZ.BLL.BLL_ErpMemberCardPointsLOG mcpslogbll = new BLL.BLL_ErpMemberCardPointsLOG();
- LYFZ.BLL.BLL_ErpMemberCardPaymentOrder mcpobll = new BLL.BLL_ErpMemberCardPaymentOrder();
- LYFZ.BLL.BLL_ErpMemberCardServiceContent mcscbll = new BLL.BLL_ErpMemberCardServiceContent();
- LYFZ.BLL.BLL_ErpMemberCardAmountChangeLOG mcclogbll = new BLL.BLL_ErpMemberCardAmountChangeLOG();
- LYFZ.BLL.BLL_ErpMemberCardServicePackageSet mcpsbll = new BLL.BLL_ErpMemberCardServicePackageSet();
- LYFZ.BLL.BLL_ErpMemberCardPaymentContentDetail mcpcdbll = new BLL.BLL_ErpMemberCardPaymentContentDetail();
- LYFZ.BLL.BLL_ErpMemberCardServicePackageContent mcpcbll = new BLL.BLL_ErpMemberCardServicePackageContent();
- List<LYFZ.Model.Model_ErpMemberCardServiceContent> mlist = null;
- DataTable tblMc = new DataTable();
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- /// 会员编号
- /// </summary>
- public string StrNumber = "";
- /// <summary>
- /// 客户编号
- /// </summary>
- public string StrClientNumber = "";
- /// <summary>
- /// 本地分店ID
- /// </summary>
- string strInfoID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void DataSetServiceBoxSetSmallForm_Shown(object sender, EventArgs e)
- {
- this.txtCount.Visible = false;
- this.PackageData();
- this.tblMc = mcbll.GetView_Custom("BView_MemberMain_GoldMember", StrWhere: "Mc_Number = '" + this.StrNumber + "'").Tables[0];
- this.mlist = mcscbll.GetModelList("Mcse_Number = '" + this.StrNumber + "'");
- if (tblMc.Rows.Count > 0)
- { this.StrClientNumber = mcbll.GetView_Custom("tb_ErpCustomer", StrWhere: "ID = '" + tblMc.Rows[0]["Cus_ID"].ToString().Trim() + "'", ShowColumnName: "Cus_CustomerNumber").Tables[0].Rows[0]["Cus_CustomerNumber"].ToString().Trim(); }
- }
- /// <summary>
- /// 绑定下拉树数据
- /// </summary>
- private void PackageData()
- {
- //套系大类
- DataTable dt = new DataTable();
- DataTable tbl = scbll.GetCategory("ID", "Sc_ClassCode = 'BFAFADBEEJBAADDFE'").Tables[0];
- if (tbl.Rows.Count <= 0)
- { MessageBoxCustom.Show("系统类别数据库数据未升级"); return; }
- tbl = scbll.GetCategory("ID,Sc_ClassCode,Sc_ClassName", "Sc_ClassParentID = '" + tbl.Rows[0]["ID"].ToString().Trim() + "'").Tables[0];
- TreeNode root = null;
- this.cmbtreevClass.Nodes.Clear();
- for (int i = 0; i < tbl.Rows.Count; i++)
- {
- dt = scbll.GetCategory("Sc_ClassCode,Sc_ClassName", "Sc_ClassParentID=" + tbl.Rows[i]["ID"].ToString() + "").Tables[0];
- if (dt.Rows.Count > 0)
- {
- for (int j = 0; j < dt.Rows.Count; j++)
- {
- root = new TreeNode();
- root.Text = dt.Rows[j]["Sc_ClassName"].ToString();
- root.Tag = dt.Rows[j]["Sc_ClassCode"].ToString();
- root.Name = "Parent";
- this.CreateTreeViewDepartmentUser(root.Nodes, dt.Rows[j]["Sc_ClassCode"].ToString());
- }
- }
- else
- {
- root = new TreeNode();
- root.Text = tbl.Rows[i]["Sc_ClassName"].ToString();
- root.Tag = tbl.Rows[i]["Sc_ClassCode"].ToString();
- root.Name = "Parent";
- this.CreateTreeViewDepartmentUser(root.Nodes, tbl.Rows[i]["Sc_ClassCode"].ToString());
- this.cmbtreevClass.TreeView.Nodes.Add(root);
- }
- }
- }
- DataTable ustbl = new DataTable();
- /// <summary>
- /// 绑定第二级人员
- /// </summary>
- /// <param name="nodes">TreeView的节点集合</param>
- /// <param name="dataSource">数据源</param>
- /// <param name="parentid"></param>
- private void CreateTreeViewDepartmentUser(TreeNodeCollection nodes, string ClassCode)
- {
- if (ClassCode != "")
- {
- if (ustbl.Rows.Count <= 0)
- { ustbl = mcpsbll.GetList("MscPs_PackageStatus = '上架'").Tables[0]; }
- DataRow[] dtRow = ustbl.Select("MscPs_PackageClass='" + ClassCode + "'");
- if (dtRow.Length > 0)
- {
- TreeNode node;
- for (int i = 0; i < dtRow.Length; i++)
- {
- node = new TreeNode();
- node.Text = dtRow[i]["MscPs_PackageName"].ToString();
- node.Tag = dtRow[i]["MscPs_PackagePrice"].ToString();
- node.Name = dtRow[i]["MscPs_PackageNumber"].ToString();
- nodes.Add(node);
- }
- }
- }
- }
- private int cellValue = 0;
- /// <summary>
- /// 数据列表双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void dgvData_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- if (e.RowIndex != -1 && e.ColumnIndex != -1)
- {
- this.txtCount.Visible = false;
- if (this.dgvData.Columns[e.ColumnIndex].Name == "Column3")
- {
- DataGridViewCell cell = this.dgvData.Rows[e.RowIndex].Cells[e.ColumnIndex];
- Rectangle rect = this.dgvData.GetCellDisplayRectangle(cell.ColumnIndex, cell.RowIndex, true);
- this.txtCount.Location = new Point(rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y);
- this.txtCount.Size = rect.Size;
- this.txtCount.Text = cell.Value.ToString().Trim();
- this.cellValue = Convert.ToInt32(cell.Value);
- this.txtCount.Tag = "A";
- this.txtCount.Visible = true;
- this.txtCount.Focus();
- }
- }
- }
- /// <summary>
- /// 数据列表单击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void dgvData_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
- { this.txtCount.Visible = false; }
- /// <summary>
- /// 服务次数离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtCount_Leave(object sender, EventArgs e)
- {
- if (this.txtCount.Tag != null)
- {
- if (this.txtCount.Tag.ToString().Trim() == "A")
- {
- if (this.txtCount.Text.Trim() == "0")
- { MessageBoxCustom.Show("新加服务项次数不能为 0 !"); return; }
- if (this.txtCount.Text.Trim() != "")
- { this.dgvData.CurrentRow.Cells["Column3"].Value = this.txtCount.Text.Trim(); }
- else
- { this.dgvData.CurrentRow.Cells["Column3"].Value = "1"; }
- this.dgvData.CurrentRow.Tag = "1";
- if (Convert.ToInt32(this.txtCount.Text.Trim()) != this.cellValue)
- {
- this.cmbtreevClass.Tag = null;
- this.cmbtreevClass.Text = "";
- this.cmbtreevClass.Enabled = false;
- }
- this.dgvData.CurrentRow.DefaultCellStyle.ForeColor = Color.Red;
- this.GetdgvDataStatistic();
- this.txtCount.Tag = null;
- this.txtCount.Text = "";
- }
- this.txtCount.Visible = false;
- }
- }
- /// <summary>
- /// 统计
- /// </summary>
- private void GetdgvDataStatistic()
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (this.cmbtreevClass.Tag != null)
- {
- this.txtStatistic.Text = "统计:总价格(" + Convert.ToDecimal(this.cmbtreevClass.Tag).ToString("#.00") + "元)";
- }
- else
- {
- decimal dec_TotalPrice = 0;
- for (int i = 0; i < this.dgvData.Rows.Count; i++)
- { dec_TotalPrice += Convert.ToInt32(this.dgvData.Rows[i].Cells["Column3"].Value) * Convert.ToDecimal(this.dgvData.Rows[i].Cells["Column4"].Value); }
- if (Convert.ToDecimal(tblMc.Rows[0]["折扣"]) > 0)
- {
- string dec_Preferential = (dec_TotalPrice - (dec_TotalPrice * (Convert.ToDecimal(tblMc.Rows[0]["折扣"]) / 10))).ToString().Trim();
- this.txtStatistic.Text = "统计:总价格(" + dec_TotalPrice.ToString("#.00") + "元) 当前会员折扣(" + Convert.ToDecimal(tblMc.Rows[0]["折扣"]).ToString("#.0") + ") 可优惠(" + dec_Preferential.Substring(0, dec_Preferential.IndexOf('.') + 2) + "元) 只须支付(" + (dec_TotalPrice - Convert.ToDecimal(dec_Preferential)).ToString("#.0") + ")";
- }
- else
- { this.txtStatistic.Text = "统计:总价格(" + dec_TotalPrice.ToString("#.0") + "元)"; }
- }
- }
- else { this.txtStatistic.Text = "统计:总价格(0元)"; }
- }
- /// <summary>
- /// 服务次数输入限制
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtCount_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (Convert.ToString(e.KeyChar) == "0")
- {
- if (this.txtCount.Text.Trim() == "")
- { e.Handled = true; }
- }
- else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 服务套系选择变化事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevClass_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- if (this.cmbtreevClass.Text.Trim() != "")
- {
- DataTable tbl = mcpcbll.GetPackageContent_Left_ContentSet("MscPc_PackageNumber = '" + this.cmbtreevClass.StrGetName.ToString().Trim() + "'").Tables[0];
- if (tbl.Rows.Count == 0)
- { MessageBoxCustom.Show("套系未设置服务项!"); this.cmbtreevClass.Text = ""; this.cmbtreevClass.Tag = ""; }
- this.dgvData.Rows.Clear();
- for (int i = 0; i < tbl.Rows.Count; i++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.DefaultCellStyle.ForeColor = Color.Red;
- DataGridViewCell cell = null;
- cell = new DataGridViewTextBoxCell();
- cell.Value = tbl.Rows[i]["MscPc_MemberServiceNumber"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = tbl.Rows[i]["MscPc_MemberServiceContent"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = tbl.Rows[i]["MscPc_MemberServiceCount"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = tbl.Rows[i]["Msc_SalePrice"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = "";
- dgvr.Cells.Add(cell);
- this.dgvData.Rows.Add(dgvr);
- }
- GetdgvDataStatistic();
- }
- }
- /// <summary>
- /// 支付
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnPayment_Click(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- DateTime strTime = SDateTime.Now;
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- LYFZ.Model.Model_ErpMemberCardServiceContent model = null;
- LYFZ.Model.Model_ErpMemberCardPaymentContentDetail modeldetail = null;
- string strPaymentNumber = "PN" + LYFZ.Command.Command_Validate.DateTimeToString(strTime, "yyyyMMddHHmmssfff");
- decimal PaymentAmount = 0;
- string StrContentText = "";
- for (int i = 0; i < this.dgvData.Rows.Count; i++)
- {
- if (this.dgvData.Rows[i].Cells["Column3"].Value.ToString().Trim() == "")
- { MessageBoxCustom.Show("有服务项次数为空,请输入次数后再支付!"); return; }
- if (Convert.ToInt32(this.dgvData.Rows[i].Cells["Column3"].Value) <= 0)
- { MessageBoxCustom.Show("有服务项次数为0,请输入次数后再支付!"); return; }
- bool Isbl = true;
- for (int j = 0; j < this.mlist.Count; j++)
- {
- if (mlist[j].Mcse_MemberServiceNumber.Trim() == this.dgvData.Rows[i].Cells["Column1"].Value.ToString().Trim())
- {
- model = mlist[j];
- model.Mcse_ServiceTotalCount = model.Mcse_ServiceTotalCount + Convert.ToInt32(this.dgvData.Rows[i].Cells["Column3"].Value);
- model.Mcse_ServiceCount = model.Mcse_ServiceCount + Convert.ToInt32(this.dgvData.Rows[i].Cells["Column3"].Value);
- model.Mcse_UpdateDateTime = strTime;
- model.Mcse_UpdateName = strUserID;
- clist.Add(mcscbll.GetUpdateCommandInfo(model));
- //服务内容详情
- modeldetail = new Model.Model_ErpMemberCardPaymentContentDetail();
- modeldetail.Mcpcd_PaymentNumber = strPaymentNumber;
- modeldetail.Mcpcd_ServiceNumber = this.dgvData.Rows[i].Cells["Column1"].Value.ToString().Trim();
- modeldetail.Mcpcd_ServiceContent = this.dgvData.Rows[i].Cells["Column2"].Value.ToString().Trim();
- modeldetail.Mcpcd_Count = Convert.ToInt32(this.dgvData.Rows[i].Cells["Column3"].Value);
- modeldetail.Mcpcd_SalePrice = Convert.ToDecimal(this.dgvData.Rows[i].Cells["Column4"].Value);
- modeldetail.Mcpcd_CreateDatetime = strTime;
- modeldetail.Mcpcd_CreateName = strUserID;
- clist.Add(mcpcdbll.GetAddCommandInfo(modeldetail));
- StrContentText += modeldetail.Mcpcd_ServiceContent + "(充值" + modeldetail.Mcpcd_Count + "次,可使用次数为" + model.Mcse_ServiceCount + "次);";
- PaymentAmount += modeldetail.Mcpcd_Count * modeldetail.Mcpcd_SalePrice;
- Isbl = false;
- continue;
- }
- }
- if (Isbl)
- {
- model = new Model.Model_ErpMemberCardServiceContent();
- model.Mcse_Number = this.StrNumber;
- model.Mcse_MemberServiceNumber = this.dgvData.Rows[i].Cells["Column1"].Value.ToString().Trim();
- model.Mcse_ServiceContent = this.dgvData.Rows[i].Cells["Column2"].Value.ToString().Trim();
- model.Mcse_ServiceTotalCount = Convert.ToInt32(this.dgvData.Rows[i].Cells["Column3"].Value);
- model.Mcse_ServiceCount = Convert.ToInt32(this.dgvData.Rows[i].Cells["Column3"].Value);
- model.Mcse_UpdateDateTime = strTime;
- model.Mcse_UpdateName = strUserID;
- clist.Add(mcscbll.GetAddCommandInfo(model));
- //服务内容详情
- modeldetail = new Model.Model_ErpMemberCardPaymentContentDetail();
- modeldetail.Mcpcd_PaymentNumber = strPaymentNumber;
- modeldetail.Mcpcd_ServiceNumber = this.dgvData.Rows[i].Cells["Column1"].Value.ToString().Trim();
- modeldetail.Mcpcd_ServiceContent = this.dgvData.Rows[i].Cells["Column2"].Value.ToString().Trim();
- modeldetail.Mcpcd_Count = Convert.ToInt32(this.dgvData.Rows[i].Cells["Column3"].Value);
- modeldetail.Mcpcd_SalePrice = Convert.ToDecimal(this.dgvData.Rows[i].Cells["Column4"].Value);
- modeldetail.Mcpcd_CreateDatetime = strTime;
- modeldetail.Mcpcd_CreateName = strUserID;
- clist.Add(mcpcdbll.GetAddCommandInfo(modeldetail));
- StrContentText += modeldetail.Mcpcd_ServiceContent + "(充值" + modeldetail.Mcpcd_Count + "次,可使用次数为" + model.Mcse_ServiceCount + "次);";
- PaymentAmount += modeldetail.Mcpcd_Count * modeldetail.Mcpcd_SalePrice;
- }
- }
- if (clist.Count == 0)
- { MessageBoxCustom.Show("没有添加服务项"); return; }
- Hashtable htData = new Hashtable();
- htData["PackageClass"] = "";
- if (this.cmbtreevClass.Text.Trim() != "")
- {
- PaymentAmount = Convert.ToDecimal(this.cmbtreevClass.Tag);
- htData["PackageClass"] = this.cmbtreevClass.StrGetName.Trim();
- }
- htData["PaymentAmount"] = PaymentAmount;
- htData["decCopeAmount"] = PaymentAmount;
- htData["StrNumber"] = this.StrNumber;
- LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.MemberPaymentSuperSmallForm frm = new SuperSmallForm.MemberPaymentSuperSmallForm();
- frm.htData = htData;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.MemberPaymentModel modelPm = frm.model;
- LYFZ.Model.Model_ErpMemberCard modelcard = mcbll.GetModel("Mc_Number", this.StrNumber);
- //如果是储值卡扣款,则减会员可用金额
- if (modelPm.StrPaymentMethod.Trim() == "BEBACCAFEGECFBJFD")
- {
- //会员金额变更
- LYFZ.Model.Model_ErpMemberCardAmountChangeLOG modelchangelog = new Model.Model_ErpMemberCardAmountChangeLOG();
- modelchangelog.Mcacl_OriginalAmount = modelcard.Mc_Money;
- modelcard.Mc_Money = modelcard.Mc_Money - modelPm.DelConfirmAmount;
- modelcard.Mc_UpdateDateTime = strTime;
- modelcard.Mc_UpdateName = strUserID;
- //clist.Add(mcbll.GetUpdateCommandInfo(modelcard));
- //会员卡金额变更记录表
- modelchangelog.Mcacl_Number = this.StrNumber;
- modelchangelog.Mcacl_Type = "5";
- modelchangelog.Mcacl_ExistingAmount = modelcard.Mc_Money;
- modelchangelog.Mcacl_UseAmount = modelPm.DelConfirmAmount;
- modelchangelog.Mcacl_GiveAmount = 0;
- modelchangelog.Mcacl_PaymentMethod = modelPm.StrPaymentMethod;
- modelchangelog.Mcacl_PaymentBank = "";
- modelchangelog.Mcacl_OrderNumber = "";
- modelchangelog.Mcacl_Remark = "购买服务,应付:" + PaymentAmount + ",会员折扣:" + modelPm.DelMemberDiscount.ToString("0.00") + ",支付:" + modelPm.DelConfirmAmount.ToString("0.00") + "元;具体详情请查询:(tb_ErpMemberCardPaymentContentDetail|会员收款内容详情)表,收款编号:" + strPaymentNumber;
- modelchangelog.Mcacl_CreateDatetime = strTime;
- modelchangelog.Mcacl_CreateName = strUserID;
- modelchangelog.Mcacl_Guid = Guid.NewGuid().ToString().Replace("-", "").ToUpper();
- clist.Add(mcclogbll.GetAddCommandInfo(modelchangelog));
- }
- //会员充值 服务消费 收款表
- LYFZ.Model.Model_ErpMemberCardPaymentOrder modelOrder = new Model.Model_ErpMemberCardPaymentOrder();
- modelOrder.Mcpo_Number = this.StrNumber;
- modelOrder.Mcpo_OrderNumber = strPaymentNumber;
- modelOrder.Mcpo_OrderAmount = PaymentAmount;
- modelOrder.Mcpo_OrderType = "服务消费";
- modelOrder.Mcpo_OrderPerson = modelPm.StrOrderPerson;
- modelOrder.Mcpo_PackageClass = htData["PackageClass"].ToString().Trim();
- if (this.cmbtreevClass.Text.Trim() != "")
- {
- modelOrder.Mcpo_PackagePrice = Convert.ToDecimal(this.cmbtreevClass.Tag);
- modelOrder.Mcpo_OrderDiscount = 0;
- }
- else
- { modelOrder.Mcpo_OrderDiscount = modelPm.DelMemberDiscount; }
- modelOrder.Mcpo_CreateDatetime = strTime;
- modelOrder.Mcpo_CreateName = strUserID;
- clist.Add(mcpobll.GetAddCommandInfo(modelOrder));
- LYFZ.Model.Model_ErpMemberCardPayment modelpayment = new Model.Model_ErpMemberCardPayment();
- modelpayment.Mcpt_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- modelpayment.Mcpt_PaymentNumber = strPaymentNumber;
- modelpayment.Mcpt_Number = this.StrNumber;
- modelpayment.Mcpt_PaymentType = "服务消费";
- modelpayment.Mcpt_PaymentAmount = modelPm.DelConfirmAmount;
- modelpayment.Mcpt_PaymentMethod = modelPm.StrPaymentMethod;
- modelpayment.Mcpt_PaymentBank = "";
- modelpayment.Mcpt_PackageClass = htData["PackageClass"].ToString().Trim();
- if (this.cmbtreevClass.Text.Trim() != "")
- { modelpayment.Mcpt_PackagePrice = Convert.ToDecimal(this.cmbtreevClass.Tag); }
- else
- { modelpayment.Mcpt_PackagePrice = 0; }
- modelpayment.Mcpt_Discount = modelPm.DelMemberDiscount;
- modelpayment.Mcpt_DiscountAmount = modelPm.DelMemberDiscountAmount;
- modelpayment.Mcpt_OrderPerson = modelPm.StrOrderPerson;
- modelpayment.Mcpt_PaymentRemark = modelPm.StrRemark;
- modelpayment.Mcpt_FinancialAudit = "";
- modelpayment.Mcpt_FinancialAuditName = "";
- modelpayment.Mcpt_FinancialAuditRemark = "";
- modelpayment.Mcpt_CreateDatetime = strTime;
- modelpayment.Mcpt_CreateName = strUserID;
- modelpayment.Mcpt_CommissionRatio = modelPm.CommissionRatio;
- clist.Add(mcptbll.GetAddCommandInfo(modelpayment));
- //积分
- int IntGetPoints = LYFZ.BLL.BLL_ErpMemberCard.GetPoints_AgoPeriod(LYFZ.EnumPublic.MemberPointsType.LatePeriod_RMB, modelPm.DelConfirmAmount, strInfoID, StrClientNumber);
- LYFZ.Model.Model_ErpMemberCardPoints modelps = mcptsbll.GetModel("Mcps_Number", this.StrNumber);
- LYFZ.Model.Model_ErpMemberCardPointsLOG modelpslog = new Model.Model_ErpMemberCardPointsLOG();
- modelpslog.MPlg_DividedShop = LYFZ.BLL.OrderPayment_Member.StrInfoID;
- modelpslog.MPlg_Number = this.StrNumber;
- modelpslog.MPlg_Type = "1";
- modelpslog.MPlg_OriginalPoints = 0;
- modelpslog.MPlg_ExistingPoints = IntGetPoints;
- modelpslog.MPlg_UsePoints = IntGetPoints;
- modelpslog.MPlg_RedeemArticle = "";
- modelpslog.MPlg_RedeemAmount = 0;
- modelpslog.MPlg_OrderNumber = "";
- modelpslog.MPlg_ViceCardNumber = "";
- modelpslog.MPlg_Remark = "";
- modelpslog.MPlg_CreateDatetime = strTime;
- modelpslog.MPlg_CreateName = strUserID;
- if (modelps.ID <= 0)
- {
- modelps = new Model.Model_ErpMemberCardPoints();
- modelps.Mcps_Number = this.StrNumber;
- modelps.Mcps_TotalPoints = IntGetPoints;
- modelps.Mcps_AvailablePoints = IntGetPoints;
- modelps.Mcps_OpenCardSource = "服务箱付款办理积分," + new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(true)).ToString();
- modelps.Mcps_UpdateDateTime = strTime;
- modelps.Mcps_UpdateName = strUserID;
- clist.Add(mcptsbll.GetAddCommandInfo(modelps));
- }
- else
- {
- modelpslog.MPlg_OriginalPoints = modelps.Mcps_AvailablePoints;
- modelpslog.MPlg_ExistingPoints = modelpslog.MPlg_ExistingPoints + modelps.Mcps_AvailablePoints;
- modelpslog.MPlg_UsePoints = modelpslog.MPlg_ExistingPoints + IntGetPoints;
- modelps.Mcps_TotalPoints = modelps.Mcps_TotalPoints + IntGetPoints;
- modelps.Mcps_AvailablePoints = modelps.Mcps_AvailablePoints + IntGetPoints;
- modelps.Mcps_UpdateDateTime = strTime;
- modelps.Mcps_UpdateName = strUserID;
- clist.Add(mcptsbll.GetUpdateCommandInfo(modelps));
- }
- clist.Add(mcpslogbll.GetAddCommandInfo(modelpslog));
- //会员服务卡使用给持卡人发短信
- LYFZ.BLL.OrderPayment_Member.MemberServiceCardUse(modelcard.Mc_CustomerNumber, modelcard.Mc_CradNumber, StrContentText: StrContentText);
- //积分有效期
- clist.AddRange(LYFZ.BLL.OrderPayment_Member.PointsChangeAutoValidity(modelcard.Mc_Number, modelcard.Mc_CradNumber));
-
- string StrGradeName = LYFZ.BLL.OrderPayment_Member.GetMemberUpgradeData(modelcard.Mc_Number, IntGetPoints);
- if (StrGradeName != "")
- { modelcard.Mc_CardType = StrGradeName; }
- clist.Add(mcbll.GetUpdateCommandInfo(modelcard));
- if (frm.clist.Count > 0)
- { clist.AddRange(frm.clist); }
- if (clist.Count > 0)
- {
- if (MessageBoxCustom.Show("确定要保存吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0)
- { MessageBoxCustom.Show("保存失败"); return; }
- this.IsSaveed = true;
- #region 流程短信
- System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
- {
- Model.SMSParameters sparameters = null;
- if (modelPm.StrPaymentMethod.Trim() == "BEBACCAFEGECFBJFD")
- {
- sparameters = new Model.SMSParameters();
- sparameters.CardNumber = modelcard.Mc_CradNumber;
- sparameters.CurrentSpendingMemberID = modelcard.Mc_CustomerNumber;
- sparameters.CurrentSpendingAmount = modelPm.DelConfirmAmount;
- sparameters.AvailableBalance = modelcard.Mc_Money;
- try { smsTemplates.GenerateEventSMS(EnumPublic.SmsSendEvent.现金卡消费后X分钟后发提醒短信, sparameters); }
- catch { }
- }
- sparameters = new Model.SMSParameters();
- sparameters.CurrentSpendingMemberID = modelcard.Mc_CustomerNumber;
- sparameters.AvailablePoints = modelps.Mcps_AvailablePoints;
- try
- { smsTemplates.GenerateEventSMS(EnumPublic.SmsSendEvent.当积分接近X的百分之80时, sparameters); }
- catch { }
- try
- { smsTemplates.GenerateEventSMS(EnumPublic.SmsSendEvent.当积分达到或超过X分时, sparameters); }
- catch { }
- }));
- t.Start();
- #endregion
- if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.MemberManage, LYFZ.CustomAttributes.OperatingAuthority.Print))
- {
- LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.RechargePrintMessageSuperSmallForm frmMesg = new SuperSmallForm.RechargePrintMessageSuperSmallForm();
- frmMesg.ShowDialog();
- if (frmMesg.IsSaveed)
- {
- Hashtable htDataX = new Hashtable();
- htDataX["strNumber"] = strPaymentNumber;
- htDataX["strMcNumber"] = this.StrNumber;
- htDataX["strDate"] = strTime.ToString("yyyy-MM-dd HH:mm");
- LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.会员服务收款, htDataX);
- }
- }
- this.Close();
- }
- }
- }
- }
- /// <summary>
- /// 服务工具箱
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnToolbox_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.MembershipManage.SetSmallForm.DataSetServiceToolboxSetSmallForm frm = new DataSetServiceToolboxSetSmallForm();
- frm.ShowDialog();
- if (frm.IsSave)
- {
- ListBox listData = frm.listbox;
- DataTable tbl = new DataTable();
- //this.dgvData.Rows.Clear();
- for (int i = 0; i < listData.Items.Count; i++)
- {
- if (tbl.Rows.Count <= 0)
- { tbl = mcbll.GetView_Custom("tb_ErpMemberCardServiceContentSet", StrWhere: "Msc_Status = '上架'", ShowColumnName: "ID,Msc_MemberServiceNumber,Msc_MemberServiceContent,Msc_Type,Msc_CostPrice,Msc_SalePrice,Msc_Status,Msc_ServiceRemark,Msc_CreateDatetime,Msc_CreateName,Msc_UpdateDateTime,Msc_UpdateName").Tables[0]; }
- DataRow[] dtRow = tbl.Select("Msc_MemberServiceNumber = '" + listData.Items[i].ToString().Trim() + "'");
- if (dtRow.Length > 0)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (this.cmbtreevClass.Text.Trim() != "")
- {
- this.cmbtreevClass.Text = "";
- this.cmbtreevClass.Tag = null;
- this.cmbtreevClass.Enabled = false;
- }
- bool Isbl = true;
- for (int j = 0; j < this.dgvData.Rows.Count; j++)
- {
- if (this.dgvData.Rows[j].Cells["Column1"].Value.ToString().Trim() == dtRow[0]["Msc_MemberServiceNumber"].ToString().Trim())
- {
- Isbl = false;
- this.dgvData.Rows[j].Cells["Column3"].Value = (Convert.ToInt32(this.dgvData.Rows[j].Cells["Column3"].Value) + 1).ToString();
- this.dgvData.Rows[j].DefaultCellStyle.ForeColor = Color.Blue;
- break;
- }
- }
- if (Isbl)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.DefaultCellStyle.ForeColor = Color.Red;
- DataGridViewCell cell = null;
- cell = new DataGridViewTextBoxCell();
- cell.Value = dtRow[0]["Msc_MemberServiceNumber"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dtRow[0]["Msc_MemberServiceContent"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = "1";
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dtRow[0]["Msc_SalePrice"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = "";
- dgvr.Cells.Add(cell);
- this.dgvData.Rows.Add(dgvr);
- }
- }
- else
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.DefaultCellStyle.ForeColor = Color.Red;
- DataGridViewCell cell = null;
- cell = new DataGridViewTextBoxCell();
- cell.Value = dtRow[0]["Msc_MemberServiceNumber"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dtRow[0]["Msc_MemberServiceContent"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = "1";
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dtRow[0]["Msc_SalePrice"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = "1";
- dgvr.Cells.Add(cell);
- this.dgvData.Rows.Add(dgvr);
- }
- }
- }
- GetdgvDataStatistic();
- }
- }
- /// <summary>
- /// 移除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnRemove_Click(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (this.cmbtreevClass.Text.Trim() != "")
- {
- if (MessageBoxCustom.Show("移除将失去套系!\r\n您确定要移除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- }
- for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
- { this.dgvData.Rows.RemoveAt(this.dgvData.SelectedRows[i].Index); }
- if (this.dgvData.Rows.Count > 0)
- { this.cmbtreevClass.Text = ""; this.cmbtreevClass.Name = null; this.cmbtreevClass.Enabled = false; }
- else { this.cmbtreevClass.Enabled = true; }
- for (int i = 0; i < this.dgvData.Rows.Count; i++)
- { this.dgvData.Rows[i].DefaultCellStyle.ForeColor = Color.Red; }
- GetdgvDataStatistic();
- }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void DataSetServiceBoxSetSmallForm_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (!IsSaveed)
- {
- if (MessageBoxCustom.Show("确定要关闭吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { e.Cancel = true; }
- }
- }
- }
- }
- }
|