private void btnCommit_Click(object sender, EventArgs e) { SettlementAgrs agrs = new SettlementAgrs(); agrs.StoreID = (int)UserInfo.Instance.StoreID; agrs.CashierID = UserInfo.Instance.ID; agrs.CashierName = UserInfo.Instance.Account; agrs.OffDutyDateTime = dteOffDutyDate.DateTime; agrs.StartDutyDateTime = dteStartDutyDate.DateTime; agrs.SalesDiscountAmount = double.Parse(string.IsNullOrEmpty(txtDisMoney.Text) ? "0" : txtDisMoney.Text); agrs.SalesAmount = double.Parse(string.IsNullOrEmpty(txtTotalMoney.Text) ? "0" : txtTotalMoney.Text); agrs.SalesCount = int.Parse(string.IsNullOrEmpty(txtProductCount.Text) ? "0" : txtProductCount.Text); agrs.SalesTicketsCount = int.Parse(string.IsNullOrEmpty(txtOrderCount.Text) ? "0" : txtOrderCount.Text); agrs.SalesReturnCount = int.Parse(string.IsNullOrEmpty(txtReturnProductCount.Text) ? "0" : txtReturnProductCount.Text); agrs.SalesReturnAmount = double.Parse(string.IsNullOrEmpty(txtReturnMoney.Text) ? "0" : txtReturnMoney.Text); agrs.SalesReturnTickets = int.Parse(string.IsNullOrEmpty(txtReturnOrderCount.Text) ? "0" : txtReturnOrderCount.Text); agrs.StockInCount = 0; agrs.StockInAmount = 0; agrs.StockOutCount = 0; agrs.StockOutAmount = 0; agrs.Remarks = txtRemarks.Text.Trim(); agrs.OperationDate = DateTime.Now; agrs.PettyCash = double.Parse(string.IsNullOrEmpty(txtPettyCash.Text) ? "0" : txtPettyCash.Text); agrs.WeixinPayAmount = double.Parse(string.IsNullOrEmpty(txtSumWeixinPayMoney.Text) ? "0" : txtSumWeixinPayMoney.Text); agrs.AliPayAmount = double.Parse(string.IsNullOrEmpty(txtSumAlipayMoney.Text) ? "0" : txtSumAlipayMoney.Text); agrs.BankCardAmount = double.Parse(string.IsNullOrEmpty(txtSumBankMoney.Text) ? "0" : txtSumBankMoney.Text); agrs.MarketAmount = double.Parse(string.IsNullOrEmpty(txtSumMarketMoney.Text) ? "0" : txtSumMarketMoney.Text); agrs.CrashAmount = double.Parse(string.IsNullOrEmpty(txtSumCashMoney.Text) ? "0" : txtSumCashMoney.Text); bool result = PosBLL.instance.SubmitSettlement(agrs); if (result) { if (XtraMessageBox.Show("交班成功,您是否要退出系统?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { Application.Exit(); } else { this.btnSubmit.Enabled = false; this.btnCommit.Enabled = false; this.btnClose.Enabled = false; //Application.Exit(); //Process.Start(Application.ExecutablePath); } } }
/// <summary> /// 提交交班记录 /// </summary> /// <param name="agrs">交班记录信息</param> /// <returns></returns> public static bool SubmitSettlement(SettlementAgrs agrs) { IList <DbParameter> lstparam = new List <DbParameter>(); lstparam.Add(new SqlParameter("@StoreID", agrs.StoreID)); lstparam.Add(new SqlParameter("@CashierID", agrs.CashierID)); lstparam.Add(new SqlParameter("@CashierName", agrs.CashierName)); lstparam.Add(new SqlParameter("@OffDutyDateTime", agrs.OffDutyDateTime)); lstparam.Add(new SqlParameter("@StartDutyDateTime", agrs.StartDutyDateTime)); lstparam.Add(new SqlParameter("@SalesDiscountAmount", agrs.SalesDiscountAmount)); lstparam.Add(new SqlParameter("@SalesAmount", agrs.SalesAmount)); lstparam.Add(new SqlParameter("@SalesCount", agrs.SalesCount)); lstparam.Add(new SqlParameter("@SalesTicketsCount", agrs.SalesTicketsCount)); lstparam.Add(new SqlParameter("@SalesReturnCount", agrs.SalesReturnCount)); lstparam.Add(new SqlParameter("@SalesReturnAmount", agrs.SalesReturnAmount)); lstparam.Add(new SqlParameter("@SalesReturnTickets", agrs.SalesReturnTickets)); lstparam.Add(new SqlParameter("@StockInCount", agrs.StockInCount)); lstparam.Add(new SqlParameter("@StockInAmount", agrs.StockInAmount)); lstparam.Add(new SqlParameter("@StockOutCount", agrs.StockOutCount)); lstparam.Add(new SqlParameter("@StockOutAmount", agrs.StockOutAmount)); lstparam.Add(new SqlParameter("@Remarks", agrs.Remarks)); lstparam.Add(new SqlParameter("@OperationDate", agrs.OperationDate)); lstparam.Add(new SqlParameter("@PettyCash", agrs.PettyCash)); lstparam.Add(new SqlParameter("@WeixinPayAmount", agrs.WeixinPayAmount)); lstparam.Add(new SqlParameter("@AliPayAmount", agrs.AliPayAmount)); lstparam.Add(new SqlParameter("@BankCardAmount", agrs.BankCardAmount)); lstparam.Add(new SqlParameter("@MarketAmount", agrs.MarketAmount)); lstparam.Add(new SqlParameter("@CrashAmount", agrs.CrashAmount)); try { utity.ExecuteNonQuery(CommandType.StoredProcedure, "usp_InsertSettlement", lstparam.ToArray()); return(true); } catch (Exception exc) { string error = exc.Message; return(false); } }
/// <summary> /// 提交交班记录 /// </summary> /// <param name="agrs">交班记录信息</param> /// <returns></returns> public bool SubmitSettlement(SettlementAgrs agrs) { return(PosDAL.SubmitSettlement(agrs)); }