예제 #1
0
 private void btnRefundPay_Click(object sender, EventArgs e)
 {
     bool hasChecked = false;
     foreach (DataGridViewRow row in this.dataGirdViewExt1.Rows)
     {
         hasChecked = Convert.ToBoolean(row.Cells["colCheck"].Value);
         if (hasChecked)
         {
             break;
         }
     }
     if (!hasChecked)
     {
         MessageBox.Show("请选择需要进行支付退款操作的卡号!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     bool result = true;
     CardRefundPayService refundPayService = new CardRefundPayService();
     foreach (DataGridViewRow row in this.dataGirdViewExt1.Rows)
     {
         bool isCheck = Convert.ToBoolean(row.Cells["colCheck"].Value);
         if (isCheck)
         {
             string cardNo = row.Cells["colCardNo"].Value.ToString();
             string tradePayNo = row.Cells["colTradePayNo"].Value.ToString();
             string cardPassword;
             //获取卡密码
             Feature.FormNumericKeypad keyForm = new Feature.FormNumericKeypad(false);
             keyForm.DisplayText = string.Format("请输入卡号'{0}'的密码", cardNo);
             keyForm.IsPassword = true;
             keyForm.ShowDialog();
             if (!string.IsNullOrEmpty(keyForm.KeypadValue))
             {
                 cardPassword = keyForm.KeypadValue;
             }
             else
             {
                 continue;
             }
             int returnValue = VIPCardTradeService.GetInstance().RefundVipCardPayment(cardNo, cardPassword, tradePayNo);
             if (returnValue == 0)
             {
                 result = false;
                 break;
             }
             int storeValueId = int.Parse(row.Cells["colStoreValueID"].Value.ToString());
             refundPayService.UpdateFixedPayInfo(storeValueId, true);
         }
     }
     if (result)
     {
         List<CardRefundPay> cardRefundPayList = refundPayService.GetCardRefundPayList();
         if(cardRefundPayList == null || cardRefundPayList.Count == 0)
         {
             this.Close();
         }
         else
         {
             BindCardRefundPay(cardRefundPayList);
         }
     }
     else
     {
         List<CardRefundPay> cardRefundPayList = refundPayService.GetCardRefundPayList();
         BindCardRefundPay(cardRefundPayList);
         MessageBox.Show("退款过程出现错误,请重新操作!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
        private void btnSalesReport_Click(object sender, EventArgs e)
        {
            if (bizReport != null && bizReport.BillTotalQty > 0)
            {
                if (m_ModelType == 1)
                {
                    //判断是否存在退款失败的账单
                    CardRefundPayService refundPayService = new CardRefundPayService();
                    List<CardRefundPay> cardRefundPayList = refundPayService.GetCardRefundPayList();
                    if (cardRefundPayList != null && cardRefundPayList.Count > 0)
                    {
                        FormVIPCardRefundPay refundPayForm = new FormVIPCardRefundPay(cardRefundPayList);
                        refundPayForm.ShowDialog();
                    }
                    Guid handoverRecordId = Guid.NewGuid();
                    HandoverRecord handoverRecord = new HandoverRecord();
                    handoverRecord.HandoverRecordID = handoverRecordId;
                    handoverRecord.DeviceNo = ConstantValuePool.BizSettingConfig.DeviceNo;
                    handoverRecord.EmployeeID = ConstantValuePool.CurrentEmployee.EmployeeID;
                    IList<HandoverTurnover> handoverTurnoverList = new List<HandoverTurnover>();
                    foreach (OrderPayoffSum item in bizReport.orderPayoffSumList)
                    {
                        HandoverTurnover handoverTurnover = new HandoverTurnover();
                        handoverTurnover.HandoverRecordID = handoverRecordId;
                        handoverTurnover.PayoffID = item.PayoffID;
                        handoverTurnover.SalesTurnover = item.PayoffMoney;
                        handoverTurnoverList.Add(handoverTurnover);
                    }

                    HandoverInfo handover = new HandoverInfo();
                    handover.handoverRecord = handoverRecord;
                    handover.handoverTurnoverList = handoverTurnoverList;
                    bool result = HandoverService.GetInstance().CreateHandover(handover);
                    if (result)
                    {
                        MessageBox.Show("交班成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        m_HandleSuccess = true;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("出现异常错误,请重新交班!");
                    }
                }
                else if (m_ModelType == 2)
                {
                    //判断是否存在退款失败的账单
                    CardRefundPayService refundPayService = new CardRefundPayService();
                    List<CardRefundPay> cardRefundPayList = refundPayService.GetCardRefundPayList();
                    if (cardRefundPayList != null && cardRefundPayList.Count > 0)
                    {
                        FormVIPCardRefundPay refundPayForm = new FormVIPCardRefundPay(cardRefundPayList);
                        refundPayForm.ShowDialog();
                    }
                    FormChooseDate form = new FormChooseDate(bizReport.LastDailyStatementTime);
                    form.ShowDialog();
                    if (form.DailyStatementDate != null)
                    {
                        string weather = this.cmbWeather.Text;
                        if (string.IsNullOrEmpty(weather))
                        {
                            MessageBox.Show("请先选择当天天气情况!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                        DateTime belongToDate = (DateTime)form.DailyStatementDate;
                        DailyStatement dailyStatement = new DailyStatement();
                        dailyStatement.DeviceNo = ConstantValuePool.BizSettingConfig.DeviceNo;
                        dailyStatement.BelongToDate = belongToDate;
                        dailyStatement.Weather = weather;
                        dailyStatement.EmployeeID = ConstantValuePool.CurrentEmployee.EmployeeID;
                        DailyTurnover dailyTurnover = new DailyTurnover();
                        dailyTurnover.TotalRevenue = bizReport.TotalRevenue;
                        dailyTurnover.CutOffTotalPrice = bizReport.CutOffTotalPrice;
                        dailyTurnover.DiscountTotalPrice = bizReport.DiscountTotalPrice;
                        dailyTurnover.ActualTotalIncome = bizReport.ActualTotalIncome;
                        dailyTurnover.TotalServiceFee = bizReport.TotalServiceFee;
                        dailyTurnover.StoredTotalPrice = 0;

                        DailyBalance dailyBalance = new DailyBalance();
                        dailyBalance.dailyStatement = dailyStatement;
                        dailyBalance.dailyTurnover = dailyTurnover;
                        string unCheckDeviceNo;  //未结账的设备号
                        int result = DailyBalanceService.GetInstance().CreateDailyBalance(dailyBalance, out unCheckDeviceNo);
                        if (result == 1)
                        {
                            MessageBox.Show("日结成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            m_HandleSuccess = true; 
                            this.Close();
                        }
                        else if (result == 2)
                        {
                            MessageBox.Show("存在未结账单据,请先结完账!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else if (result == 3)
                        {
                            if (string.IsNullOrEmpty(unCheckDeviceNo))
                            {
                                MessageBox.Show("存在未交班的POS,请先交班!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            else
                            {
                                if (unCheckDeviceNo.IndexOf(',') == -1 && unCheckDeviceNo.IndexOf(ConstantValuePool.BizSettingConfig.DeviceNo) >= 0)
                                {
                                    MessageBox.Show("当前设备未交班,请交班后进行日结!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                                else
                                {
                                    MessageBox.Show(string.Format("设备【{0}】未交班,请先交班!",unCheckDeviceNo), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("出现异常错误,请重新日结!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }