Пример #1
0
        public FrmTaPaymentCollection(List <TaOrderItemInfo> lsOi, int id, string chkId, string type, string caller, Hashtable ht, string sBusDate, TaCheckOrderInfo taCheckOrder, string sReadyTime)
        {
            InitializeComponent();

            usrID                = id;
            checkID              = chkId;
            orderType            = type;
            callerID             = caller;
            htDetail             = ht;
            strBusDate           = sBusDate;
            saveTaCheckOrderInfo = taCheckOrder;
            strReadyTime         = sReadyTime;
            lstOrderItemInfos    = lsOi;
        }
Пример #2
0
        private void SaveOrderAndPrint(string strPrintType)
        {
            if (txtReadyTime.Text.Length > 0)
            {
                if (txtReadyTime.Text.Length != 5)
                {
                    MessageBox.Show("Ready Time INPUT Error", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            if (saveTaCheckOrderInfo != null)
            {
                TaCheckOrderInfo taCheckOrder = saveTaCheckOrderInfo;

                taCheckOrder.PayTime         = DateTime.Now.ToString();
                taCheckOrder.PayPerDiscount  = txtPercentDiscount.Text;
                taCheckOrder.PayDiscount     = Math.Round(Convert.ToDecimal(txtDiscount.Text), 2).ToString(@"0.00");
                taCheckOrder.PayPerSurcharge = txtPercentSurcharge.Text;
                taCheckOrder.PaySurcharge    = Math.Round(Convert.ToDecimal(txtSurcharge.Text), 2).ToString(@"0.00");
                taCheckOrder.PayType1        = lblPayType1.Text;
                taCheckOrder.PayTypePay1     = Math.Round(Convert.ToDecimal(txtPayTypePay1.Text), 2).ToString(@"0.00");
                taCheckOrder.PayType2        = lblPayType2.Text;
                taCheckOrder.PayTypePay2     = Math.Round(Convert.ToDecimal(txtPayTypePay2.Text), 2).ToString(@"0.00");
                taCheckOrder.PayType3        = lblPayType3.Text;
                taCheckOrder.PayTypePay3     = Math.Round(Convert.ToDecimal(txtPayTypePay3.Text), 2).ToString(@"0.00");
                taCheckOrder.PayType4        = lblPayType4.Text;
                taCheckOrder.PayTypePay4     = Math.Round(Convert.ToDecimal(txtPayTypePay4.Text), 2).ToString(@"0.00");
                taCheckOrder.PayType5        = lblPayType5.Text;
                taCheckOrder.PayTypePay5     = Math.Round(Convert.ToDecimal(txtPayTypePay5.Text), 2).ToString(@"0.00");
                taCheckOrder.TotalAmount     = Math.Round(Convert.ToDecimal(txtToPay.Text), 2).ToString(@"0.00");
                taCheckOrder.Paid            = Math.Round(Convert.ToDecimal(txtTendered.Text), 2).ToString(@"0.00");
                taCheckOrder.IsPaid          = IsPaid ? @"Y" : @"N";

                taCheckOrder.BusDate = strBusDate;

                taCheckOrder.RefNum = "";

                taCheckOrder.DeliveryFee = @"0.00";

                WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa();

                if (lstOrderItemInfos.Count < 1)
                {
                    lstOrderItemInfos = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(checkID) && s.BusDate.Equals(strBusDate)).ToList();
                }

                wbPrtTemplataTa = GetAllPrtInfo(strPrintType);

                //_control.UpdateEntity(taCheckOrder);
                DelegateSaveCheckOrderAndPrint handler = DelegateMy.CheckOrderSaveAndPrint;
                IAsyncResult result = handler.BeginInvoke(taCheckOrder, strPrintType, lstOrderItemInfos,
                                                          wbPrtTemplataTa, taCheckOrder.PayOrderType, null, null);
            }

            bool isOpenCashDrawSuccess = CommonDAL.OpenCashDraw(false, "");

            if (!isOpenCashDrawSuccess)
            {
                MessageBox.Show(PubComm.CASH_DRAW_INFO, PubComm.CASH_DRAW_TEXT_TITLE, MessageBoxButtons.OK);
            }

            if (IsPaid)
            {
                returnPaid = true;

                this.DialogResult = DialogResult.OK;

                Hide();
            }
            else
            {
                if (IsNotPaid)
                {
                    returnPaid = true;

                    this.DialogResult = DialogResult.OK;

                    Hide();
                }
            }
        }
Пример #3
0
        private void btnPay_Click(object sender, EventArgs e)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();

            string            strSqlWhere   = "";
            DynamicParameters dynamicParams = new DynamicParameters();

            strSqlWhere = "CheckCode=@CheckCode AND BusDate=@BusDate";

            dynamicParams.Add("BusDate", checkBusDate);
            dynamicParams.Add("CheckCode", checkCode);

            List <TaOrderItemInfo> lstOi = new SQLiteDbHelper().QueryMultiByWhere <TaOrderItemInfo>("Ta_OrderItem", strSqlWhere, dynamicParams);

            sw.Stop();
            TimeSpan ts = sw.Elapsed;

            Console.WriteLine("Time {0}", ts.TotalMilliseconds);

            //SystemData systemData = new SystemData();
            //systemData.GetTaCheckOrder();
            TaCheckOrderInfo taCheckOrderInfo = CommonData.TaCheckOrder.FirstOrDefault(s => s.CheckCode.Equals(checkCode) && s.BusDate.Equals(checkBusDate));

            strSqlWhere   = "";
            dynamicParams = new DynamicParameters();

            strSqlWhere = "BusDate=@BusDate";

            dynamicParams.Add("BusDate", checkBusDate);

            if (checkOrderType.Equals(PubComm.ORDER_TYPE_SHOP))
            {
                FrmTaPaymentShop frmTaPaymentShop = new FrmTaPaymentShop(lstOi, usrID, checkCode, checkOrderType, checkCustID.ToString(), SetPrtInfo(), checkBusDate, taCheckOrderInfo, "");

                if (frmTaPaymentShop.ShowDialog() == DialogResult.OK)
                {
                    if (frmTaPaymentShop.returnPaid)
                    {
                        //new SystemData().GetShowAndPendOrderData("", strBusDate);
                        //GetBindData("", 0, false);
                        List <ShowAndPendOrderDataInfo> lstTmp = new SQLiteDbHelper().QueryMultiByWhere <ShowAndPendOrderDataInfo>("VIEW_ShowAndPendOrder", strSqlWhere, dynamicParams);

                        GetBindData(lstTmp, "", 0, false);
                    }
                }
            }
            else if (checkOrderType.Equals(PubComm.ORDER_TYPE_DELIVERY))
            {
                FrmTaPaymentDelivery frmTaPaymentDelivery = new FrmTaPaymentDelivery(lstOi, usrID, checkCode, checkOrderType, checkCustID.ToString(), SetPrtInfo(), checkBusDate, taCheckOrderInfo, "");

                if (frmTaPaymentDelivery.ShowDialog() == DialogResult.OK)
                {
                    if (frmTaPaymentDelivery.returnPaid)
                    {
                        //new SystemData().GetShowAndPendOrderData("", strBusDate);
                        //GetBindData("", 0, false);

                        List <ShowAndPendOrderDataInfo> lstTmp = new SQLiteDbHelper().QueryMultiByWhere <ShowAndPendOrderDataInfo>("VIEW_ShowAndPendOrder", strSqlWhere, dynamicParams);

                        GetBindData(lstTmp, "", 0, false);
                    }
                }
            }
            else if (checkOrderType.Equals(PubComm.ORDER_TYPE_COLLECTION))
            {
                FrmTaPaymentCollection frmTaPaymentCollection = new FrmTaPaymentCollection(lstOi, usrID, checkCode, checkOrderType, checkCustID.ToString(), SetPrtInfo(), checkBusDate, taCheckOrderInfo, "");

                if (frmTaPaymentCollection.ShowDialog() == DialogResult.OK)
                {
                    if (frmTaPaymentCollection.returnPaid)
                    {
                        //new SystemData().GetShowAndPendOrderData("", strBusDate);
                        //GetBindData("", 0, false);

                        List <ShowAndPendOrderDataInfo> lstTmp = new SQLiteDbHelper().QueryMultiByWhere <ShowAndPendOrderDataInfo>("VIEW_ShowAndPendOrder", strSqlWhere, dynamicParams);

                        GetBindData(lstTmp, "", 0, false);
                    }
                }
            }
        }