private void btnDriver_Click(object sender, EventArgs e) { string sSysKey = dgvPendOrder.CurrentRow.Cells[0].Value.ToString(); string sOrderType = dgvPendOrder.CurrentRow.Cells[6].Value.ToString(); if (!sOrderType.Equals(CommonBase.ORDER_TYPE_DELIVERY)) { return; } var lst = CommonData.TAPaymentList.Where(s => s.SystemKey.ToString().Equals(sSysKey)); TAPaymentInfo taPaymentInfo = new TAPaymentInfo(); if (lst.Any()) { taPaymentInfo = lst.FirstOrDefault(); taPaymentInfo.DriverName = cmbDriver.Text; _control.UpdateEntity(taPaymentInfo); } GetDB(1, "ALL"); }
private void FrmTAPay_Load(object sender, EventArgs e) { OnLoadSystemCommonData onLoadSystemCommonData = new OnLoadSystemCommonData(); onLoadSystemCommonData.GetTAPayType(); onLoadSystemCommonData.GetTAOrderItem(); onLoadSystemCommonData.GetTAPaymentList(); if (string.IsNullOrEmpty(strMenuID)) { strMenuID = CommonData.TaMenuSetList.FirstOrDefault().SystemKey.ToString(); } strCtlName = "txtPay1"; #region 各种附件事件 btn0.Click += BtnNum_Click; btn1.Click += BtnNum_Click; btn2.Click += BtnNum_Click; btn3.Click += BtnNum_Click; btn4.Click += BtnNum_Click; btn5.Click += BtnNum_Click; btn6.Click += BtnNum_Click; btn7.Click += BtnNum_Click; btn8.Click += BtnNum_Click; btn9.Click += BtnNum_Click; btnPoint.Click += BtnNum_Click; txtPay1.MouseDown += txtPay_Click; txtPay2.MouseDown += txtPay_Click; txtPay3.MouseDown += txtPay_Click; txtPay4.MouseDown += txtPay_Click; btnDriver1.Click += BtnDriver_Click; btnDriver2.Click += BtnDriver_Click; btnDriver3.Click += BtnDriver_Click; btnDriver4.Click += BtnDriver_Click; btnDriver5.Click += BtnDriver_Click; btnDriver6.Click += BtnDriver_Click; #endregion #region 查询会员 //查询会员 new OnLoadSystemCommonData().GetTACust(); var custList = CommonData.TaCustList.Where(s => s.SystemKey.ToString().Equals(CustNum)); if (custList.Any()) { TACustInfo taCustInfo = custList.FirstOrDefault(); txtPhone.Text = taCustInfo.Phone1; txtName.Text = taCustInfo.Name; txtHouseNo.Text = taCustInfo.HouseNo; txtAddress.Text = taCustInfo.Address1; txtPostcode.Text = taCustInfo.Postcode1; txtDistance.Text = taCustInfo.Distance; txtPCZone.Text = taCustInfo.PcZone; txtDelCharge.Text = taCustInfo.DelCharge; txtReadyTime.Text = taCustInfo.ReadyTime; txtIntNotes.Text = taCustInfo.IntNotes; txtNotes.Text = taCustInfo.NotesOnBill; chkBlackListed.Checked = taCustInfo.IsBlackListed.Equals("Y"); } #endregion #region Delivery / Collection Note new OnLoadSystemCommonData().GetTAPreDefined(); var cmbList = CommonData.TaPreDefinedList.Select(lstPD => new { Prevalue = lstPD.PreTxtValue }); cmbNote.DataSource = cmbList.ToList(); cmbNote.ValueMember = "Prevalue"; cmbNote.DisplayMember = "Prevalue"; #endregion #region 控件数组 lblPayType[0] = lblPayType1; lblPayType[1] = lblPayType2; lblPayType[2] = lblPayType3; lblPayType[3] = lblPayType4; txtPay[0] = txtPay1; txtPay[1] = txtPay2; txtPay[2] = txtPay3; txtPay[3] = txtPay4; lblPaySurcharge[0] = lblSurcharge1; lblPaySurcharge[1] = lblSurcharge2; lblPaySurcharge[2] = lblSurcharge3; lblPaySurcharge[3] = lblSurcharge4; btnDriver[0] = btnDriver1; btnDriver[1] = btnDriver2; btnDriver[2] = btnDriver3; btnDriver[3] = btnDriver4; btnDriver[4] = btnDriver5; btnDriver[5] = btnDriver6; lblSCharge[0] = lblSCharge1; lblSCharge[1] = lblSCharge2; lblSCharge[2] = lblSCharge3; lblSCharge[3] = lblSCharge4; //付款 int i = 0; foreach (var taPayTypeInfo in CommonData.TaPayTypeList) { if (i >= 4) { break; } lblSCharge[i].Visible = true; lblPaySurcharge[i].Visible = true; lblPaySurcharge[i].Text = "0.00"; txtPay[i].Visible = true; lblPayType[i].Visible = true; lblPayType[i].Text = taPayTypeInfo.PaymentType; i++; } for (int j = i + 1; j <= 3; j++) { lblSCharge[j].Visible = false; lblPaySurcharge[j].Visible = false; txtPay[j].Visible = false; lblPayType[j].Visible = false; } #region 司机清单 //司机清单 if (!string.IsNullOrEmpty(GetWeek(DateTime.Today.DayOfWeek.ToString()))) { i = 0; foreach ( var driverSet in CommonData.TaDriverSetUpList.Where( s => s.DriverWorkDay.Contains(GetWeek(DateTime.Today.DayOfWeek.ToString()))) .TakeWhile(driverSet => i < 6)) { btnDriver[i].Text = driverSet.DriverName; } for (int j = i + 1; j < btnDriver.Length; j++) { btnDriver[j].Visible = false; } } #endregion #endregion #region 查询账单 if (CommonData.TAPaymentList.Any(s => s.ChkNum.Equals(chkNum) && s.IsPaid.Equals("N"))) { var payList = CommonData.TAPaymentList.Where(s => s.ChkNum.Equals(chkNum) && s.IsPaid.Equals("N")); TAPaymentInfo taPaymentInfo = payList.FirstOrDefault(); txtDiscount.Text = taPaymentInfo.Discount; txtSurcharge.Text = taPaymentInfo.Surcharge; txtTotal.Text = taPaymentInfo.Total; txtNotPaid.Text = taPaymentInfo.NotPaid; txtDelivery.Text = taPaymentInfo.Delivery; txtTendered.Text = taPaymentInfo.Tendered; txtToPay.Text = Convert.ToDecimal(taPaymentInfo.Total) > Convert.ToDecimal(taPaymentInfo.Tendered) ? (Convert.ToDecimal(taPaymentInfo.Total) - Convert.ToDecimal(taPaymentInfo.Tendered)).ToString() : "0.00"; AcctPay = Convert.ToDecimal(taPaymentInfo.AcctPay); if (lblSCharge[0].Visible) { txtPay[0].Text = taPaymentInfo.PayType1; lblPaySurcharge[0].Text = taPaymentInfo.PayTypeSurCharge1; } if (lblSCharge[1].Visible) { txtPay[1].Text = taPaymentInfo.PayType2; lblPaySurcharge[1].Text = taPaymentInfo.PayTypeSurCharge2; } if (lblSCharge[2].Visible) { txtPay[2].Text = taPaymentInfo.PayType3; lblPaySurcharge[2].Text = taPaymentInfo.PayTypeSurCharge3; } if (lblSCharge[3].Visible) { txtPay[3].Text = taPaymentInfo.PayType4; lblPaySurcharge[3].Text = taPaymentInfo.PayTypeSurCharge4; } GetAmount(); } else { return; } #endregion }
private void btnSave_Click(object sender, EventArgs e) { new OnLoadSystemCommonData().GetTAPaymentList(); if (CommonData.TAPaymentList.Any(s => s.ChkNum.Equals(chkNum) && s.IsPaid.Equals("N"))) { var payList = CommonData.TAPaymentList.Where(s => s.ChkNum.Equals(chkNum) && s.IsPaid.Equals("N")); TAPaymentInfo taPaymentInfo = payList.FirstOrDefault(); taPaymentInfo.Discount = txtDiscount.Text; taPaymentInfo.DiscountValue = DisValue.ToString(); taPaymentInfo.Surcharge = txtSurcharge.Text; taPaymentInfo.Total = txtTotal.Text; taPaymentInfo.NotPaid = txtNotPaid.Text; taPaymentInfo.Delivery = txtDelivery.Text; taPaymentInfo.Tendered = txtTendered.Text; taPaymentInfo.ForChange = txtChange.Text; taPaymentInfo.DCNote = cmbNote.Text; taPaymentInfo.PayTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); taPaymentInfo.OpUsr = userInfo.SystemKey.ToString(); taPaymentInfo.OrderType = sOrderType; taPaymentInfo.DriverName = strDriverName; if (lblSCharge[0].Visible) { taPaymentInfo.PayType1 = txtPay[0].Text; taPaymentInfo.PayTypeSurCharge1 = lblPaySurcharge[0].Text; } else { taPaymentInfo.PayType1 = "0.00"; taPaymentInfo.PayTypeSurCharge1 = "0.00"; } if (lblSCharge[1].Visible) { taPaymentInfo.PayType2 = txtPay[1].Text; taPaymentInfo.PayTypeSurCharge2 = lblPaySurcharge[1].Text; } else { taPaymentInfo.PayType2 = "0.00"; taPaymentInfo.PayTypeSurCharge2 = "0.00"; } if (lblSCharge[2].Visible) { taPaymentInfo.PayType3 = txtPay[2].Text; taPaymentInfo.PayTypeSurCharge3 = lblPaySurcharge[2].Text; } else { taPaymentInfo.PayType3 = "0.00"; taPaymentInfo.PayTypeSurCharge3 = "0.00"; } if (lblSCharge[3].Visible) { taPaymentInfo.PayType4 = txtPay[3].Text; taPaymentInfo.PayTypeSurCharge4 = lblPaySurcharge[3].Text; } else { taPaymentInfo.PayType4 = "0.00"; taPaymentInfo.PayTypeSurCharge4 = "0.00"; } //if (taPaymentInfo.NotPaid.Equals("0.00")) //{ // taPaymentInfo.IsPaid = "Y"; // IsPaid = true; // this.DialogResult = DialogResult.OK; // Hide(); //} if (Convert.ToDecimal(txtTendered.Text) >= Convert.ToDecimal(txtTotal.Text)) { IsPaid = true; taPaymentInfo.IsPaid = "Y"; _control.UpdateEntity(taPaymentInfo); this.DialogResult = DialogResult.OK; Hide(); } else { _control.UpdateEntity(taPaymentInfo); } } }
private void FrmTAPayShop_Load(object sender, EventArgs e) { OnLoadSystemCommonData onLoadSystemCommonData = new OnLoadSystemCommonData(); onLoadSystemCommonData.GetTAPayType(); onLoadSystemCommonData.GetTAOrderItem(); onLoadSystemCommonData.GetTAPaymentList(); if (string.IsNullOrEmpty(strMenuID)) { strMenuID = CommonData.TaMenuSetList.FirstOrDefault().SystemKey.ToString(); } strCtlName = "txtPay1"; #region 各种附件事件 btn0.Click += BtnNum_Click; btn1.Click += BtnNum_Click; btn2.Click += BtnNum_Click; btn3.Click += BtnNum_Click; btn4.Click += BtnNum_Click; btn5.Click += BtnNum_Click; btn6.Click += BtnNum_Click; btn7.Click += BtnNum_Click; btn8.Click += BtnNum_Click; btn9.Click += BtnNum_Click; btnPoint.Click += BtnNum_Click; txtPay1.MouseDown += txtPay_Click; txtPay2.MouseDown += txtPay_Click; txtPay3.MouseDown += txtPay_Click; txtPay4.MouseDown += txtPay_Click; #endregion #region 控件数组 lblPayType[0] = lblPayType1; lblPayType[1] = lblPayType2; lblPayType[2] = lblPayType3; lblPayType[3] = lblPayType4; txtPay[0] = txtPay1; txtPay[1] = txtPay2; txtPay[2] = txtPay3; txtPay[3] = txtPay4; lblPaySurcharge[0] = lblSurcharge1; lblPaySurcharge[1] = lblSurcharge2; lblPaySurcharge[2] = lblSurcharge3; lblPaySurcharge[3] = lblSurcharge4; lblSCharge[0] = lblSCharge1; lblSCharge[1] = lblSCharge2; lblSCharge[2] = lblSCharge3; lblSCharge[3] = lblSCharge4; //付款 int i = 0; foreach (var taPayTypeInfo in CommonData.TaPayTypeList) { if (i >= 4) { break; } lblSCharge[i].Visible = true; lblPaySurcharge[i].Visible = true; lblPaySurcharge[i].Text = "0.00"; txtPay[i].Visible = true; lblPayType[i].Visible = true; lblPayType[i].Text = taPayTypeInfo.PaymentType; i++; } for (int j = i + 1; j <= 3; j++) { lblSCharge[j].Visible = false; lblPaySurcharge[j].Visible = false; txtPay[j].Visible = false; lblPayType[j].Visible = false; } #endregion #region 查询账单 if (CommonData.TAPaymentList.Any(s => s.ChkNum.Equals(chkNum) && s.IsPaid.Equals("N"))) { var payList = CommonData.TAPaymentList.Where(s => s.ChkNum.Equals(chkNum) && s.IsPaid.Equals("N")); TAPaymentInfo taPaymentInfo = payList.FirstOrDefault(); txtDiscount.Text = taPaymentInfo.Discount; txtSurcharge.Text = taPaymentInfo.Surcharge; txtTotal.Text = taPaymentInfo.Total; txtNotPaid.Text = taPaymentInfo.NotPaid; txtDelivery.Text = taPaymentInfo.Delivery; txtTendered.Text = taPaymentInfo.Tendered; txtToPay.Text = Convert.ToDecimal(taPaymentInfo.Total) > Convert.ToDecimal(taPaymentInfo.Tendered) ? (Convert.ToDecimal(taPaymentInfo.Total) - Convert.ToDecimal(taPaymentInfo.Tendered)).ToString() : "0.00"; AcctPay = Convert.ToDecimal(taPaymentInfo.AcctPay); if (lblSCharge[0].Visible) { txtPay[0].Text = taPaymentInfo.PayType1; lblPaySurcharge[0].Text = taPaymentInfo.PayTypeSurCharge1; } if (lblSCharge[1].Visible) { txtPay[1].Text = taPaymentInfo.PayType2; lblPaySurcharge[1].Text = taPaymentInfo.PayTypeSurCharge2; } if (lblSCharge[2].Visible) { txtPay[2].Text = taPaymentInfo.PayType3; lblPaySurcharge[2].Text = taPaymentInfo.PayTypeSurCharge3; } if (lblSCharge[3].Visible) { txtPay[3].Text = taPaymentInfo.PayType4; lblPaySurcharge[3].Text = taPaymentInfo.PayTypeSurCharge4; } GetAmount(); } else { return; } #endregion }