123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644 |
- using LYFZ.ComponentLibrary;
- 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.FinancialManagement.TwoSalesOrder
- {
- public partial class FrmTwoSalesOrderPayment : LYFZ.Software.UI.FinancialManagement.TwoSalesOrder.FrmTwoSalesOrderPayment
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpPayment ptbll = new BLL.BLL_ErpPayment();
- LYFZ.BLL.BLL_ErpSystemLogs slogbll = new BLL.BLL_ErpSystemLogs();
- LYFZ.BLL.BLL_ErpTwoSalesOrder torbll = new BLL.BLL_ErpTwoSalesOrder();
- LYFZ.BLL.BLL_ErpTwoPinsProjectCommissionProportion tppcpbll = new BLL.BLL_ErpTwoPinsProjectCommissionProportion();
- public FrmTwoSalesOrderPayment()
- {
- this.cmbPay_PaymentMethod.ComboBoxTree_NodeMouseClick += cmbPay_PaymentMethod_ComboBoxTree_NodeMouseClick;
- this.btnPaymentNot.Click += btnPaymentNot_Click;
- this.btnPerformance.Click += BtnPerformance_Click;
- this.btnDelPerformance.Click += BtnDelPerformance_Click;
- this.dgv.CellDoubleClick += Dgv2_CellDoubleClick;
- }
- private void Dgv2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
- {
- if (e.ColumnIndex == 4)
- {
- DataGridViewRow gridViewRow = this.dgv.Rows[e.RowIndex];
- if (gridViewRow.Tag != null)
- {
- DataRow dataRow = (DataRow)gridViewRow.Tag;
- decimal Pay_AmountOf = Convert.ToDecimal(dataRow["Pay_AmountOf"].ToString());
- string commissionRatioJsonData = "";
- if (dataRow["Pay_CommissionRatio"] != null)
- {
- commissionRatioJsonData = dataRow["Pay_CommissionRatio"].ToString();
- }
- if (String.IsNullOrWhiteSpace(commissionRatioJsonData))
- {
- MessageBoxCustom.Show("当前这笔收款项未做自定义业绩分配");
- return;
- }
- else
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.frmCustomPerformance customPerformance = new MainBusiness.DoorCityProcess.frmCustomPerformance();
- try
- {
- customPerformance.CollectionAmount = Pay_AmountOf;
- customPerformance.IsReadOnly = true;
- customPerformance.PersonCommissionRatioJsonDataInitialization(commissionRatioJsonData);
- customPerformance.BindPerformancePersonControls();
- customPerformance.ShowDialog();
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("收款金额输入格式不正确:{0}", ex.Message));
- return;
- }
- }
- }
- else
- {
- MessageBoxCustom.Show("当前收款记录异常");
- return;
- }
- }
- }
- }
- private void BtnDelPerformance_Click(object sender, EventArgs e)
- {
- this.ClearPerformance();
- }
- /// <summary>
- /// 清除业绩分配
- /// </summary>
- void ClearPerformance()
- {
- this.listBoxPerformance.Items.Clear();
- this.listBoxPerformance.Tag = null;
- this.currentPersonCommissionRatio = null;
- }
- LYFZ.BLL.OrderPersonCommissionRatio currentPersonCommissionRatio = null;
- LYFZ.Model.Model_ErpTwoSalesOrder erpOrderModel = null;
- private void BtnPerformance_Click(object sender, EventArgs e)
- {
- if (this.erpOrderModel != null)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.frmCustomPerformance customPerformance = new MainBusiness.DoorCityProcess.frmCustomPerformance();
- try
- {
- customPerformance.CollectionAmount = Convert.ToDecimal(this.txtPay_AmountOf.Text.Trim());
- if (this.listBoxPerformance.Items.Count > 0 && this.currentPersonCommissionRatio != null)
- {
- customPerformance.PersonCommissionRatio = this.currentPersonCommissionRatio;
- }
- else
- {
- customPerformance.OrderPersonInitialization(this.erpOrderModel.Tsorder_OpenSingle);
- }
- customPerformance.BindPerformancePersonControls();
- if (customPerformance.ShowDialog() == DialogResult.OK)
- {
- this.listBoxPerformance.Items.Clear();
- this.currentPersonCommissionRatio = customPerformance.PersonCommissionRatio;
- customPerformance.BindListBoxPerformance(this.listBoxPerformance);
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("收款金额输入格式不正确:{0}", ex.Message));
- }
- }
- }
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- /// 应收款
- /// </summary>
- public decimal StrCope;
- /// <summary>
- /// 已收款
- /// </summary>
- public decimal StrPaid;
- /// <summary>
- /// 欠款
- /// </summary>
- public decimal StrArrears;
- /// <summary>
- /// 订单号
- /// </summary>
- public string StrOrdNumber;
- /// <summary>
- /// 客户编号
- /// </summary>
- public string StrClientNumber;
- /// <summary>
- /// 是否显示不收款按钮
- /// </summary>
- public bool IsShownPaymentNot = false;
- string Tsorder_Category = "";
- public string guid = "";
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void FrmTwoSalesOrderPayment_Shown(object sender, EventArgs e)
- {
- try
- {
- this.btnPaymentNot.Visible = this.IsShownPaymentNot;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.HidePhoneControls(this.txtTsorder_Telephone);
- this.btnDelete.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.TwoSalesOrderCompetence, CustomAttributes.OperatingAuthority.Delete);
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_PaymentMethod(this.cmbPay_PaymentMethod);
- // 获取 金额,客户,收款详情数据
- if (!string.IsNullOrEmpty(this.StrOrdNumber))
- {
-
- DataTable dt = torbll.GetView_TwoSalesOrder(" Tsorder_Number = '" + this.StrOrdNumber + "'").Tables[0];
- if (dt.Rows.Count > 0)
- {
- this.erpOrderModel = torbll.DataRowToModel(dt.Rows[0]);
- // 获取金额
- this.txtCope.Text = StrCope.ToString();//应收款
- this.txtPaid.Text = StrPaid.ToString();//已付款
- this.txtArrears.Text = StrArrears.ToString();//欠款
- // 获取客户资料
- this.txtTsorder_Number.Text = dt.Rows[0]["Tsorder_Number"].ToString(); ;
- this.txtTsorder_Name.Text = dt.Rows[0]["Tsorder_Name"].ToString();
- this.txtTsorder_CustomerName.Text = dt.Rows[0]["Tsorder_CustomerName"].ToString();
- this.txtTsorder_Telephone.Text = dt.Rows[0]["Tsorder_Telephone"].ToString();
- this.StrClientNumber = dt.Rows[0]["Tsorder_CustomerNumber"].ToString();
- // 获取收款详情
- this.txtPay_ThePayee.Text = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
- this.txtPay_CreateDatetime.Text = SDateTime.Now.ToString("yyyy-MM-dd");
- this.Tsorder_Category = dt.Rows[0]["Tsorder_Category"].ToString();
- }
- else {
- erpOrderModel = null;
- MessageBoxCustom.Show("订单数据加载失败,或订单已被删除");
- }
- }
- else
- {
- MessageBoxCustom.Show("缺少收款订单号参数");
- return;
- }
- // 获取全部历史收款
- this.PublicFunctionRows();
- ///控制财务管理扫码支付的版本权
- List<Control> hideControl = new List<Control>();
- hideControl.Add(cmbPay_PaymentMethod);
- LYFZ.Software.MainBusiness.VersionControl.StaticVersion.BindVersionShowHideControl(VersionControl.VersionFunctionEnum.财务管理扫码支付, hideControl, null, null);
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message); }
- }
- /// <summary>
- /// 全部历史收款
- /// </summary>
- void PublicFunctionRows()
- {
- this.dgv.Rows.Clear();
- DataTable dt = ptbll.View_ErpPayment("Pay_OrdNumber='" + this.StrOrdNumber + "'").Tables[0];
- if (dt.Rows.Count > 0)
- {
- for (int t = 0; t < dt.Rows.Count; t++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewCell cell = null;
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["ID"].ToString();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N2");
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Pay_ReceivableProject"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[t]["Pay_CreateDatetime"], "yyyy-MM-dd HH:mm");
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Pay_UserName"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Pay_ThePayeeName"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim(); ;
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Pay_PaymentDiscount"].ToString().Trim(); ;
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Pay_DiscountAmount"].ToString().Trim(); ;
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Pay_Remark"].ToString().Trim();
- dgvr.Cells.Add(cell);
- dgvr.Tag = dt.Rows[t];
- this.dgv.Rows.Add(dgvr);
- }
- this.dgv.ClearSelection();
- }
- }
- /// <summary>
- /// 时间控件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtPay_CreateDatetime_Enter(object sender, EventArgs e)
- {
- if (this.txtPay_CreateDatetime.Text == "")
- { this.txtPay_CreateDatetime.Text = SDateTime.Now.ToString("yyyy-MM-dd"); }
- }
- /// <summary>
- /// 时间控件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtPay_CreateDatetime_Leave(object sender, EventArgs e)
- {
- if (this.txtPay_CreateDatetime.Text.Trim() != "")
- {
- if (LYFZ.Command.Command_Validate.IsDateTime(this.txtPay_CreateDatetime.Text.Trim()) == false)
- { this.txtPay_CreateDatetime.Text = ""; MessageBoxCustom.Show("收款时间格式输入错误"); }
- }
- }
- /// <summary>
- /// 输入框设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtPay_AmountOf_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- else if (Char.IsPunctuation(e.KeyChar))
- {
- if (e.KeyChar == '.')
- {
- if (((System.Windows.Forms.TextBox)sender).Text.LastIndexOf('.') != -1)
- { e.Handled = true; }
- }
- else if (e.KeyChar == '-')
- {
- if (((System.Windows.Forms.TextBox)sender).Text.LastIndexOf('-') != -1)
- { e.Handled = true; }
- }
- else
- { e.Handled = true; }
- }
- }
- /// <summary>
- /// 支付方式设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnSet_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
- frm.TypeName = "BEBACCAFCCEAGAIHH";
- frm.Version = "Version";
- if (frm.ShowDialog() == DialogResult.OK)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_PaymentMethod(this.cmbPay_PaymentMethod);
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnDelete_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgv.SelectedRows.Count == 0)
- {
- MessageBoxCustom.Show("请选中你要删除的数据!");
- return;
- }
- if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- int id = Convert.ToInt32(this.dgv.CurrentRow.Cells["ID"].Value);
- DataTable dt = ptbll.GetList("Id=" + id + "").Tables[0];
- if (dt.Rows.Count > 0)
- {
- if (dt.Rows[0]["Pay_FinancialAudit"].ToString().Trim() == "已审核")
- { MessageBoxCustom.Show("收款已审核,不能删除!"); return; }
- clist.Add(ptbll.GetDeleteCommandInfo("ID", "=", id));
- // 写入操作日志
- string logsContent = "删除其他消费订单号为:" + this.StrOrdNumber + " 金额为:" + this.dgv.CurrentRow.Cells["Pay_AmountOf"].Value.ToString().Trim();
- clist.Add(slogbll.GetAddCommandInfo(LYFZ.BLL.BLL_ErpSystemLogs.GetWriteLogModel(LYFZ.EnumPublic.SystemLogsType.删除收款记录, logsContent, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name, StrInfoID: LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID())));
- // 删除二销(后期)项目提成比例设置
- DataTable tbl = orbll.GetView_Custom("tb_ErpTwoPinsProjectCommissionProportion", StrWhere: "Tpc_CustomNumber='" + dt.Rows[0]["Pay_CustomNumber"].ToString().Trim() + "'", ShowColumnName: "ID").Tables[0];
- for (int i = 0; i < tbl.Rows.Count; i++)
- { clist.Add(tppcpbll.GetDeleteCommandInfo("ID", "=", tbl.Rows[0]["ID"].ToString().Trim())); }
- decimal RefundAmount = Convert.ToDecimal(this.dgv.CurrentRow.Cells["Pay_AmountOf"].Value) - Convert.ToDecimal(this.dgv.CurrentRow.Cells["DiscountAmount"].Value);
- clist.AddRange(LYFZ.BLL.OrderPayment_Member.LaterPeriodPayment_DeleteRefund(this.StrOrdNumber, dt.Rows[0]["Pay_McNumber"].ToString().Trim(), StrClientNumber, RefundAmount, StrStoreNumber: LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID()));
- if (clist.Count > 0)
- {
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- {
- MessageBoxCustom.Show("删除成功!");
- // 获取金额
- this.txtCope.Text = StrCope.ToString();//应收款
- DataTable DaPayment = ptbll.GetSum(" Pay_OrdNumber='" + this.StrOrdNumber + "'").Tables[0];
- decimal Paid = 0;//已付款
- if (!string.IsNullOrEmpty(DaPayment.Rows[0]["Pay_AmountOf"].ToString().Trim()))
- { Paid = Convert.ToDecimal(DaPayment.Rows[0]["Pay_AmountOf"]); }
- this.txtPaid.Text = Paid.ToString();
- //欠款
- this.txtArrears.Text = (StrCope - Paid).ToString();
- this.dgv.Rows.Remove(this.dgv.CurrentRow);
- this.IsSaveed = true;
- }
- else
- { MessageBoxCustom.Show("删除失败!"); return; }
- }
- }
- }
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message); }
- }
- /// <summary>
- /// 打印收据
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnHitSingle_Click(object sender, EventArgs e)
- {
- try
- {
- if (dgv.SelectedRows.Count == 0)
- {
- MessageBoxCustom.Show("请选择你要打印的数据!");
- return;
- }
- object objStr = this.txtTsorder_Number.Text.Trim() + "|" + this.txtCope.Text.Trim() + "|" + this.txtPaid.Text.Trim() + "|" + this.txtArrears.Text.Trim();
- Hashtable htData = new Hashtable();
- htData["dgvData"] = this.dgv;
- htData["strText"] = objStr;
- LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.其它消费收款, htData);
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message); }
- }
- /// <summary>
- /// 修改时间
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnUpdateTime_Click(object sender, EventArgs e)
- {
- if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.TwoSalesOrderCompetence, CustomAttributes.OperatingAuthority.UpdatePaymentTime))
- { txtPay_CreateDatetime.Enabled = true; }
- else
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.AuthorizeLoginSuperSmallForm frm = new DoorCityProcess.SuperSmallForm.AuthorizeLoginSuperSmallForm("TwoSalesOrderCompetence", CustomAttributes.OperatingAuthority.UpdatePaymentTime);
- if (frm.ShowDialog() == DialogResult.OK)
- {
- if (LYFZ.BLL.BLL_ErpUser.GetRights(frm.CurrentAuthorizeUserRights.TwoSalesOrderCompetence, CustomAttributes.OperatingAuthority.UpdatePaymentTime, frm.User_BelongRoles))
- {
- frm.SetAuthorizationResult();
- txtPay_CreateDatetime.Enabled = true; }
- else {
- frm.SetAuthorizationResult(String.Format("授权失败,授权人没有'{0}'权限", LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.AuthorizeLoginSuperSmallForm.ConvertEnumToDescription(CustomAttributes.OperatingAuthority.UpdatePaymentTime).ToString()));
- }
- }
- }
- }
- /// <summary>
- /// 不收款
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnPaymentNot_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- #region 判断不能为空
- if (string.IsNullOrEmpty(this.txtTsorder_Number.Text))
- {
- MessageBoxCustom.Show("订单单号不能为空!");
- return;
- }
- if (string.IsNullOrEmpty(this.txtPay_AmountOf.Text))
- {
- MessageBoxCustom.Show("收款金额不能为空!");
- return;
- }
- if (string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text))
- {
- MessageBoxCustom.Show("支付方式不能为空!");
- return;
- }
- if (string.IsNullOrEmpty(this.txtPay_ThePayee.Text))
- {
- MessageBoxCustom.Show("收款人不能为空!");
- return;
- }
- if (string.IsNullOrEmpty(this.txtPay_CreateDatetime.DateValue))
- {
- MessageBoxCustom.Show("收款时间不能为空!");
- return;
- }
- #endregion
- DataTable dt = torbll.GetView_TwoSalesOrder(" Tsorder_Number='" + this.StrOrdNumber + "'").Tables[0];
- #region 2017-03-24 杨云奕 添加 判断是否接入微信支付宝的接口
- FinancialPayApiControl PayApi = new FinancialPayApiControl();
- int intCode = PayApi.PayApiControl(StrOrdNumber, this.cmbPay_PaymentMethod.Text.Trim(), Convert.ToDecimal(this.txtPay_AmountOf.Text));
- string serialnumber = "";
- if (intCode == 1)
- {
- serialnumber = PayApi.SerialNumber;
- }
- else if (intCode == -1)
- {
- //MessageBoxCustom.Show("取消微信刷卡支付,保存取消");
- return;
- }
- #endregion
- #region 保存
- #region 增加二销(后期)项目提成比例设置
- //LYFZ.Model.Model_ErpTwoPinsProjectCommissionProportion TwoPinsProjectCommissionProportionModel = new Model.Model_ErpTwoPinsProjectCommissionProportion();
- //LYFZ.BLL.BLL_ErpTwoPinsProjectCommissionProportion TwoPinsProjectCommissionProportionBll = new BLL.BLL_ErpTwoPinsProjectCommissionProportion();
- //string[] UserNumber =dt.Rows[0]["Tsorder_UserProportionOne"].ToString().Trim().Split(',');
- //for (int i = 0; i < UserNumber.Length; i++)
- //{
- // TwoPinsProjectCommissionProportionModel.Tpc_OrdNumber = txtTsorder_Number.Text.Trim();
- // TwoPinsProjectCommissionProportionModel.Tpc_AmountOf = Convert.ToDecimal(txtPay_AmountOf.Text);
- // TwoPinsProjectCommissionProportionModel.Tpc_ProjectName = txtTsorder_Name.Text.Trim();
- // TwoPinsProjectCommissionProportionModel.Tpc_OpenSingle = UserNumber[i].Split('|')[0];
- // TwoPinsProjectCommissionProportionModel.Tpc_TwoPinsCategory = Tsorder_Category;
- // TwoPinsProjectCommissionProportionModel.Tpc_CommissionPercentage = Convert.ToDecimal(UserNumber[i].Split('|')[1]);
- // TwoPinsProjectCommissionProportionModel.Tpc_CustomNumber = model.Pay_CustomNumber;
- // TwoPinsProjectCommissionProportionModel.Tpc_CreateDatetime = model.Pay_CreateDatetime;
- // TwoPinsProjectCommissionProportionModel.Tpc_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- // TwoPinsProjectCommissionProportionBll.Add(TwoPinsProjectCommissionProportionModel);
- //}
- #endregion
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- if (modelpm == null)
- {
- modelpm = new BLL.MemberCardPaymentModel();
- modelpm.PaymentAmount = Convert.ToDecimal(txtPay_AmountOf.Text);
- modelpm.RechargeDiscount = 0;
- modelpm.DiscountAmount = 0;
- modelpm.StrOrdNumber = this.StrOrdNumber;
- modelpm.StrPaymentMethod = "其他";
- modelpm.StrReturnType = "clist";
- }
- clist.AddRange(LYFZ.BLL.OrderPayment_Member.LaterPeriodPayment(StrClientNumber, modelpm, StrSource: "其他消费",strGuid:guid));
- LYFZ.Model.Model_ErpPayment model = new Model.Model_ErpPayment();
- model.Pay_OrdNumber = this.StrOrdNumber.Trim();
- model.Pay_ViceNumber = "";
- model.Pay_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.pay_SerialNumber = serialnumber;
- model.Pay_AmountOf = Convert.ToDecimal(this.txtPay_AmountOf.Text);
- model.Pay_PaymentDiscount = modelpm.RechargeDiscount;
- model.Pay_DiscountAmount = modelpm.DiscountAmount;
- model.Pay_OpenSingle = dt.Rows[0]["Tsorder_OpenSingle"].ToString();
- model.Pay_ThePayee = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- model.Pay_PaymentMethod = this.cmbPay_PaymentMethod.Tag.ToString();
- model.Pay_OrdersLocation = "";
- model.Pay_ReceivableProject = this.txtTsorder_Name.Text;
- model.Pay_Remark = this.txtPay_Remark.Text;
- model.Pay_CreateDatetime = Convert.ToDateTime(this.txtPay_CreateDatetime.DateTimeValue.Trim());
- model.Pay_Category = "后期收款";
- model.Pay_TwoPinsCategory = Tsorder_Category;
- model.Pay_CommissionRatio = "";
- if (this.listBoxPerformance.Items.Count > 0 && this.currentPersonCommissionRatio != null)
- {
- model.Pay_OpenSingle = this.currentPersonCommissionRatio.ToOrderPersons();
- model.Pay_CommissionRatio = this.currentPersonCommissionRatio.ToString();
- }
- model.Pay_Type = 1;
- model.Pay_McNumber = modelpm.StrCardNumber;
- clist.Add(ptbll.GetAddCommandInfo(model));
- if (clist.Count > 0)
- {
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0)
- { MessageBoxCustom.Show("支付失败!"); return; }
- }
- this.cmbPay_PaymentMethod.SetTextAndTag_ValueNull();
- this.ClearPerformance();
- MessageBoxCustom.Show("保存成功!");
- // 获取金额
- this.txtCope.Text = StrCope.ToString();//应收款
- DataTable DaPayment = ptbll.GetSum(" Pay_OrdNumber = '" + StrOrdNumber + "'").Tables[0];
- decimal Paid = 0;//已付款
- if (!string.IsNullOrEmpty(DaPayment.Rows[0]["Pay_AmountOf"].ToString().Trim()))
- { Paid = Convert.ToDecimal(DaPayment.Rows[0]["Pay_AmountOf"]); }
- this.txtPaid.Text = Paid.ToString();
- this.txtArrears.Text = (StrCope - Paid).ToString();//欠款
- this.PublicFunctionRows();
- this.txtPay_AmountOf.Text = "";
- this.cmbPay_PaymentMethod.Text = "";
- this.txtPay_Remark.Text = "";
- this.IsSaveed = true;
- this.txtPay_CreateDatetime.Enabled = false;
- #endregion
- /////付款后短信提醒
- //LYFZ.BLL.BLL_ErpSMSRecord.SendMsgByPayment(
- // dt.Rows[0]["Tsorder_Number"].ToString(),
- // dt.Rows[0]["Tsorder_Number"].ToString(),
- // Convert.ToDecimal(this.txtPay_AmountOf.Text).ToString("0.00"),
- // this.cmbPay_PaymentMethod.Text,
- // SDateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
- // );
- }
- catch (Exception ex)
- { MessageBoxCustom.Show(ex.Message); }
- }
- LYFZ.BLL.MemberCardPaymentModel modelpm = null;
- /// <summary>
- /// 选择支付方式事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbPay_PaymentMethod_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- guid = Guid.NewGuid().ToString().Replace("-", "").ToUpper();
- if (this.cmbPay_PaymentMethod.Text != "")
- {
- if (this.cmbPay_PaymentMethod.Tag.ToString() == "BEBACCAFEGECFBJFD")
- {
- if (!string.IsNullOrEmpty(this.txtPay_AmountOf.Text))
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.MemberCardDeductAmountSuperSmallForm frm = new DoorCityProcess.SuperSmallForm.MemberCardDeductAmountSuperSmallForm();
- frm.strOrdNumber = this.StrOrdNumber;//订单编号
- frm.PaymentAmount = Convert.ToDecimal(txtPay_AmountOf.Text);//支付金额
- frm.StrReturnType = "clist";
- frm.panelPerformance.Show();
- frm.btnDelPerformance.Click += BtnDelPerformance_Click;
- frm.btnPerformance.Click += BtnPerformance_Click;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- modelpm = frm.model;
- this.btnSave_Click(this, null);
- }
- else
- { this.cmbPay_PaymentMethod.SetTextAndTag_ValueNull(); }
- }
- else
- { this.cmbPay_PaymentMethod.SetTextAndTag_ValueNull(); MessageBoxCustom.Show("请输入金额!"); }
- }
- else
- { modelpm = null; }
- }
- }
- }
- }
|