Example #1
0
        public frmPayMent(OrderDateModel _OrderMain, int AnimationTime, int Flags)
        {
            //animationTime = AnimationTime;
            //flags = Flags;
            animationTime = AnimationTime;
            flags = Flags;

            InitializeComponent();
            OrderMain = _OrderMain;
            txtTender.Focus();
            ucKeyPadOrder1.txtResult = txtTender;
            this.Location = new Point(0, 100);
        }
Example #2
0
        public int CancelOrder(OrderDateModel Order)
        {
            int Result = 0;
            try
            {
                using (var tran = _context.Database.BeginTransaction())
                {
                    _context.Database.ExecuteSqlCommand("update ORDER_DATE set Status=4 where OrderID='" + Order.OrderID + "'");
                    tran.Commit();
                    Result = 1;
                }
            }
            catch (Exception ex)
            {

            }
            return Result;
        }
Example #3
0
        public bool checkOrderChange(OrderDateModel order)
        {
            bool flag = false;
               for (int i = 0; i < order.ListOrderDetail.Count; i++)
               {
               if (order.ListOrderDetail[i].ChangeStatus == 1)
                   flag = true;
               if (order.ListOrderDetail[i].ListOrderDetailModifire.Count > 0)
               {
                   for (int j = 0; j < order.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                   {
                       if (order.ListOrderDetail[i].ListOrderDetailModifire[j].ChangeStatus == 1)
                           flag = true;
                   }
               }

               }
               if (order.HaveNote == 1)
               flag = true;

               return flag;
        }
Example #4
0
        private List<PAYMENT_INVOICE_HISTORY> CopyListPayment(OrderDateModel Order)
        {
            List<PAYMENT_INVOICE_HISTORY> lst = new List<PAYMENT_INVOICE_HISTORY>();
            lst.Clear();
            for (int i = 0; i < Order.ListPayment.Count; i++)
            {
                PAYMENT_INVOICE_HISTORY item = new PAYMENT_INVOICE_HISTORY();
                item.PaymentTypeID = Order.ListPayment[i].PaymentTypeID;

                item.Status = 1;
                item.Total = Order.ListPayment[i].Total*1000;
                item.CreateBy = Order.ListPayment[i].CreateBy ?? 0;
                item.CreateDate = DateTime.Now;
                item.UpdateBy = Order.ListPayment[i].UpdateBy ?? 0;
                item.UpdateDate = DateTime.Now;
                item.Note = Order.ListPayment[i].Note ?? "";
                lst.Add(item);
            }
            return lst;
        }
Example #5
0
        private List<INVOICE_DETAIL> CopyInvoicedetail(OrderDateModel itemOrder)
        {
            List<INVOICE_DETAIL> lstorderDetailDate = new List<INVOICE_DETAIL>();
            lstorderDetailDate.Clear();
            try
            {

                for (int i = 0; i < itemOrder.ListOrderDetail.Count; i++)
                {

                        INVOICE_DETAIL orderDetaiDate = new INVOICE_DETAIL();

                        orderDetaiDate.OrderDetailID = itemOrder.ListOrderDetail[i].OrderDetailID;
                        orderDetaiDate.ProductID = itemOrder.ListOrderDetail[i].ProductID;
                        orderDetaiDate.DynId = itemOrder.ListOrderDetail[i].DynID;
                        orderDetaiDate.Seat = itemOrder.ListOrderDetail[i].Seat;
                        orderDetaiDate.Qty = itemOrder.ListOrderDetail[i].Qty;
                        orderDetaiDate.KeyItem = itemOrder.ListOrderDetail[i].KeyItem;
                        orderDetaiDate.Total = itemOrder.ListOrderDetail[i].Total;
                        orderDetaiDate.Price = itemOrder.ListOrderDetail[i].Price;
                        orderDetaiDate.Status = itemOrder.ListOrderDetail[i].Satust;
                        orderDetaiDate.Note = itemOrder.ListOrderDetail[i].Note;
                        orderDetaiDate.CreateBy = itemOrder.ListOrderDetail[i].CreateBy ?? 0;
                        orderDetaiDate.CreateDate = itemOrder.ListOrderDetail[i].CreateDate ?? DateTime.Now;
                        orderDetaiDate.UpdateBy = itemOrder.ListOrderDetail[i].UpdateBy ?? 0;
                        orderDetaiDate.UpdateDate = itemOrder.ListOrderDetail[i].UpdateDate ?? DateTime.Now;
                        lstorderDetailDate.Add(orderDetaiDate);

                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("CopyOrderDetailDate:::::::::::::::::::::::::" + ex.Message);
            }
            return lstorderDetailDate;
        }
Example #6
0
 private INVOICE CopyInvoice(OrderDateModel itemOrder)
 {
     INVOICE invoice = new INVOICE();
     invoice.InvoiceNumber = itemOrder.InvoiceNumber;
     invoice.OrderID = itemOrder.OrderID;
     invoice.OrderNumber = itemOrder.OrderNumber;
     invoice.Total = Convert.ToInt32(itemOrder.TotalAmount);
     invoice.Status = 1;
     invoice.DiscountType = itemOrder.DiscountType;
     invoice.Discount =(itemOrder.Discount);
     invoice.Payment = itemOrder.Payment;
     invoice.Change = itemOrder.Change;
     invoice.CashOut =Convert.ToInt32(itemOrder.CashOut);
     if (itemOrder.ListInvoiceByCard.Count > 0)
         invoice.InvoiceByCardID =Convert.ToInt32(CustomerInvoiceByCardID());
     else
         invoice.InvoiceByCardID = 0;
     invoice.CreateBy = itemOrder.CreateBy ?? 0;
     invoice.CreateDate = DateTime.Now;
     invoice.UpdateBy = itemOrder.UpdateBy ?? 0;
     invoice.UpdateDate = DateTime.Now;
     invoice.Note = itemOrder.Note ?? "";
     invoice.ShiftID = itemOrder.ShiftID;
     return invoice;
 }
Example #7
0
        public void BindOrder(OrderDateModel OrderMain)
        {
            try
            {
                detailScreen();
                if (OrderMain.ListSeatOfOrder.Count > 0)
                {
                    OrderMain.IsLoadFromData = true;

                    Boolean addSet;
                    foreach (SeatModel seat in OrderMain.ListSeatOfOrder)
                    {
                        addSet = true;
                        if (OrderMain.ListOrderDetail.Count > 0)
                        {
                            for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                            {
                                if (OrderMain.ListOrderDetail[i].Seat == seat.Seat)
                                {
                                    if (addSet)
                                    {
                                        UCSeat ucSeat = new UCSeat();
                                        ucSeat.lblSeat.Text = "Seat " + seat.Seat.ToString();
                                        ucSeat.Tag = seat.Seat;

                                        flowLayoutPanel1.Controls.Add(ucSeat);
                                        indexControl = flowLayoutPanel1.Controls.Count;
                                        addSet = false;
                                    }
                                    addOrder(OrderMain.ListOrderDetail[i]);
                                    indexControl++;
                                    for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                                    {
                                        UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                        uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];

                                        addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j]);
                                        indexControl++;
                                    }
                                }
                                else
                                {
                                    if (OrderMain.ListOrderDetail[i].Seat == 0)
                                    {
                                        addOrder(OrderMain.ListOrderDetail[i]);
                                        indexControl++;
                                        for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                                        {
                                            UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                            uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];

                                            addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j]);
                                            indexControl++;
                                        }
                                    }
                                }

                            }
                        }

                    }
                }
                else
                {
                    if (OrderMain.ListOrderDetail.Count > 0)
                    {
                        OrderMain.IsLoadFromData = true;

                        for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                        {
                            addOrder(OrderMain.ListOrderDetail[i]);

                            for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                            {
                                UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];

                                addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j]);

                            }
                        }
                    }

                }
                this.lblSubtotal.Text = money.Format2(OrderMain.SubTotal());
                this.lblTax.Text = "N/A";
                this.lblTotal.Text = money.Format2(OrderMain.SubTotal());
            }
            catch (Exception ex)
            {
                SystemLog.LogPOS.WriteLog("POS::frmCustomerDisplay:::::::::::::::::::" + ex.Message);
            }
        }
Example #8
0
        private void RefeshOrderMain(OrderDateModel OrderRefesh,FlowLayoutPanel flp)
        {
            flp.Controls.Clear();
            if (OrderRefesh.ListOrderDetail.Count > 0)
            {
                for (int i = 0; i < OrderRefesh.ListOrderDetail.Count; i++)
                {

                    addOrder(OrderRefesh.ListOrderDetail[i], flp);

                        for (int j = 0; j < OrderRefesh.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                        {
                            UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                            uc.Tag = OrderRefesh.ListOrderDetail[i].ListOrderDetailModifire[j];
                            //uc.Click += ucItemModifierOfMenu_Click;
                            addModifreToOrder(uc, OrderRefesh.ListOrderDetail[i].ListOrderDetailModifire[j],flp);

                        }

                }
            }
        }
Example #9
0
        public float printnTransferTableNotAll(OrderDateModel Order, PrintPageEventArgs e)
        {
            float l_y = 0;
               l_y = posPrinter.DrawString(Header, e, new Font("Arial", 14, FontStyle.Italic), l_y, 2);
               l_y += posPrinter.GetHeightPrinterLine() / 10;
               l_y=posPrinter.DrawLine("", new Font("Arial", 14), e, System.Drawing.Drawing2D.DashStyle.Dot, l_y, 1);
               l_y = posPrinter.DrawString(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), e, new Font("Arial", 14, FontStyle.Italic), l_y, 1);
               l_y += posPrinter.GetHeightPrinterLine() / 10;
               l_y = posPrinter.DrawString("OPERATOR#MANAGER", e, new Font("Arial", 14, FontStyle.Italic), l_y, 1);
               posPrinter.DrawString("Table# " + Order.FloorID, e, new Font("Arial", 14, FontStyle.Italic), l_y, 1);
               l_y = posPrinter.DrawString("Order#" + Order.OrderID, e, new Font("Arial", 14), l_y, 3);
               posPrinter.DrawLine("", new Font("Arial", 14), e, System.Drawing.Drawing2D.DashStyle.Dot, l_y, 1);
               l_y += posPrinter.GetHeightPrinterLine() / 10;
               int countItem =0;
               for (int i = 0; i < Order.ListOrderDetail.Count; i++)
               {
               float yStart  = l_y;

               if (Order.ListOrderDetail[i].ChangeStatus == 2)
               {
                   l_y = posPrinter.DrawString(Order.ListOrderDetail[i].ProductName, e, new Font("Arial", 14), l_y, 1);
                   posPrinter.DrawCancelLine(e, yStart, l_y);
               }
               else
               {
                   if (Order.ListOrderDetail[i].ChangeStatus == 1)
                   {
                       l_y = posPrinter.DrawString("--Add  " + Order.ListOrderDetail[i].ProductName, e, new Font("Arial", 14), l_y, 1);
                   }
                   else
                   {
                       countItem++;
                       l_y = posPrinter.DrawString(Order.ListOrderDetail[i].Qty.ToString() + " " + Order.ListOrderDetail[i].ProductName, e, new Font("Arial", 14), l_y, 1);
                   }
               }
               //l_y = posPrinter.DrawString(OrderMain.ListOrderDetail[i].Qty.ToString(), e, new Font("Arial", 14), l_y, 2);
               //posPrinter.DrawString("$" + money.Format2(OrderMain.ListOrderDetail[i].Price.ToString()), e, new Font("Arial", 14), yStart, 3);

               if (Order.ListOrderDetail[i].ListOrderDetailModifire.Count > 0)
               {
                   for (int j = 0; j < Order.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                   {
                       if (Order.ListOrderDetail[i].ListOrderDetailModifire[j].ChangeStatus == 2)
                       {
                           l_y = posPrinter.DrawString(Order.ListOrderDetail[i].ListOrderDetailModifire[j].ModifireName, e, new Font("Arial", 10), l_y, 1);
                           posPrinter.DrawCancelLine(e, yStart, l_y);
                       }
                       else
                       {
                           if (Order.ListOrderDetail[i].ListOrderDetailModifire[j].ChangeStatus == 1)
                           {
                               l_y = posPrinter.DrawString("--Add" + Order.ListOrderDetail[i].ListOrderDetailModifire[j].ModifireName, e, new Font("Arial", 10, FontStyle.Italic), l_y, 1);
                           }
                           else
                           {
                               if(!OrderMain.IsLoadFromData)
                                    l_y = posPrinter.DrawString("--" + Order.ListOrderDetail[i].ListOrderDetailModifire[j].ModifireName, e, new Font("Arial", 10, FontStyle.Italic), l_y, 1);
                           }
                       }
                       //l_y = posPrinter.DrawString("$" + money.Format2(OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j].Price.ToString()), e, new Font("Arial", 14), l_y, 3);
                   }
               }
               }
               l_y += posPrinter.GetHeightPrinterLine() / 10;

               posPrinter.DrawLine("", new Font("Arial", 14), e, System.Drawing.Drawing2D.DashStyle.Dot, l_y, 1);
               l_y = posPrinter.DrawString("", e, new Font("Arial", 14), l_y, 1);
               l_y += posPrinter.GetHeightPrinterLine() / 10;
               posPrinter.DrawString("Total item: "+countItem, e, new Font("Arial", 14, FontStyle.Bold), l_y, 1);
               //l_y = posPrinter.DrawString("$" + money.Format2(OrderMain.SubTotal()), e, new Font("Arial", 14, FontStyle.Bold), l_y, 3);
               l_y += posPrinter.GetHeightPrinterLine()/2;
               return l_y;
        }
Example #10
0
 public IEnumerable<OrderDateModel> LoadOrder(OrderDateModel idOrder)
 {
     throw new NotImplementedException();
 }
Example #11
0
        public int DeleteJoinTableAll(OrderDateModel itemOrder)
        {
            int result = 0;
            try
            {
                ORDER_DATE orderDateTemp = new ORDER_DATE();
                List<ORDER_DETAIL_DATE> lstOrderDetaiDate = new List<ORDER_DETAIL_DATE>();
                List<ORDER_DETAIL_MODIFIRE_DATE> lstOrderDetailModifire = new List<ORDER_DETAIL_MODIFIRE_DATE>();

                OrderDateModel orderDateMoldeTemp = new OrderDateModel();
                orderDateMoldeTemp = GetOrderByTable(itemOrder.FloorID, 0);

                if (itemOrder.ListOrderDetail.Count > 0)
                {
                    using (var transaciton = _context.Database.BeginTransaction())
                    {
                        orderDateTemp = CopyOrder(itemOrder);
                        //_context.Entry(orderDateTemp).State = System.Data.Entity.EntityState.Modified;
                        _context.Database.ExecuteSqlCommand("delete from ORDER_DATE  where OrderID='" + itemOrder.OrderID + "'");
                        lstOrderDetaiDate = CopyOrderDetailDate(itemOrder);
                        foreach (ORDER_DETAIL_DATE item in lstOrderDetaiDate)
                        {

                            _context.Database.ExecuteSqlCommand("delete from ORDER_DETAIL_DATE where OrderDetailID='" + item.OrderDetailID + "'");

                        }

                        lstOrderDetailModifire = CopyOrderMidifireDate(itemOrder);
                        foreach (ORDER_DETAIL_MODIFIRE_DATE item in lstOrderDetailModifire)
                        {
                            //_context.Entry(item).State = System.Data.Entity.EntityState.Deleted;
                            // _context.ORDER_DETAIL_MODIFIRE_DATE.Remove(item);
                            _context.Database.ExecuteSqlCommand("delete ORDER_DETAIL_MODIFIRE_DATE where OrderModifireID='" + item.OrderModifireID + "'");
                        }
                        _context.SaveChanges();
                        transaciton.Commit();
                        result = 1;
                    }

                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("OrderService::::::::::::::::::::DeleteJoinTableAll::::::::::::::" + ex.Message);
            }
            return result;
        }
Example #12
0
        public int InsertOrder(OrderDateModel itemOrder)
        {
            int flag = 0;
            try
            {
                ORDER_DATE orderDateTemp = new ORDER_DATE();
                List<ORDER_DETAIL_DATE> lstOrderDetaiDate = new List<ORDER_DETAIL_DATE>();
                List<ORDER_DETAIL_MODIFIRE_DATE> lstOrderDetailModifire = new List<ORDER_DETAIL_MODIFIRE_DATE>();
                List<SEAT> lstSeat = new List<SEAT>();
               // ORDER_DETAIL_DATE orderDetailTemp = new ORDER_DETAIL_DATE();
                //ORDER_DETAIL_MODIFIRE_DATE orderDetailModofireDate = new ORDER_DETAIL_MODIFIRE_DATE();
                OrderDateModel orderDateMoldeTemp = new OrderDateModel();
                orderDateMoldeTemp= GetOrderByTable(itemOrder.FloorID,0);

                if (orderDateMoldeTemp.ListOrderDetail.Count > 0)
                {
                    using (var transaciton = _context.Database.BeginTransaction())
                    {
                        orderDateTemp = CopyOrder(itemOrder);
                        //_context.Entry(orderDateTemp).State = System.Data.Entity.EntityState.Modified;
                        _context.Database.ExecuteSqlCommand("update ORDER_DATE set TotalAmount='" + orderDateTemp.TotalAmount + "',Seat='"+ itemOrder.Seat+"' where OrderID='"+ orderDateTemp.OrderID+"'");

                        lstSeat = CopySeat(orderDateMoldeTemp);
                        foreach (SEAT item in lstSeat)
                        {
                            _context.Database.ExecuteSqlCommand("delete from SEAT where ID='" + item.ID + "'");
                        }
                        lstSeat = CopySeat(itemOrder);

                        foreach (SEAT item in lstSeat)
                        {
                            item.OrderNumber = itemOrder.OrderNumber;
                            _context.Entry(item).State = System.Data.Entity.EntityState.Added;
                            _context.SaveChanges();
                        }
                        lstOrderDetaiDate = CopyOrderDetailDate(orderDateMoldeTemp);
                        foreach (ORDER_DETAIL_DATE item in lstOrderDetaiDate)
                        {

                            _context.Database.ExecuteSqlCommand("delete from ORDER_DETAIL_DATE where OrderDetailID='" + item.OrderDetailID + "'");

                        }
                        lstOrderDetaiDate = CopyOrderDetailDate(itemOrder);
                        foreach (ORDER_DETAIL_DATE item in lstOrderDetaiDate)
                        {
                            // _context.Entry(item).State = System.Data.Entity.EntityState.Added;;

                            _context.Database.ExecuteSqlCommand("insert into ORDER_DETAIL_DATE(OrderID,OrderNumber,ProductID,KeyItem,Status,Price,Qty,Total,Seat,DynId,PrintType)values" +
                                "('" + item.OrderID + "', '"+ item.OrderNumber+"', '" + item.ProductID + "','" + item.KeyItem + "','" + item.Status + "','" + item.Price + "','" + item.Qty + "','" + item.Total + "','" + item.Seat + "','"+item.DynId+"','"+ item.PrintType+"')");

                        }
                        lstOrderDetailModifire = CopyOrderMidifireDate(orderDateMoldeTemp);
                        foreach (ORDER_DETAIL_MODIFIRE_DATE item in lstOrderDetailModifire)
                        {
                            //_context.Entry(item).State = System.Data.Entity.EntityState.Deleted;
                            // _context.ORDER_DETAIL_MODIFIRE_DATE.Remove(item);
                            _context.Database.ExecuteSqlCommand("delete ORDER_DETAIL_MODIFIRE_DATE where OrderModifireID='" + item.OrderModifireID + "'");
                        }
                        lstOrderDetailModifire = CopyOrderMidifireDate(itemOrder);
                        foreach (ORDER_DETAIL_MODIFIRE_DATE item in lstOrderDetailModifire)
                        {
                            // _context.Entry(item).State = System.Data.Entity.EntityState.Added;
                            _context.Database.ExecuteSqlCommand("insert into ORDER_DETAIL_MODIFIRE_DATE (OrderDetailID,OrderID,OrderNumber,ProductID,KeyModi,ModifireID,Status,Price,Qty,Total,Seat,DynID)values" +
                                "('" + item.OrderDetailID + "','" + item.OrderID + "','" + item.OrderNumber + "', '" + item.ProductID + "','" + item.KeyModi + "','" + item.ModifireID + "','" + item.Status + "','" + item.Price + "','" + item.Qty + "','" + item.Total + "','" + item.Seat + "','" + item.DynId + "')");

                        }
                        transaciton.Commit();
                        flag = 1;
                    }

                }
                else
                {
                    using (var Tranx = _context.Database.BeginTransaction())
                    {
                        orderDateTemp = CopyOrder(itemOrder);
                        _context.Entry(orderDateTemp).State = System.Data.Entity.EntityState.Added;
                        _context.SaveChanges();
                        int i = orderDateTemp.OrderID;
                        string OrderNum = i + "" + DateTime.Now.Date.Year + "" + DateTime.Now.Date.Month + "" + DateTime.Now.Date.Day;
                        _context.Database.ExecuteSqlCommand("update ORDER_DATE set OrderNumber='" + OrderNum + "' where OrderID='"+ i+"'");
                        lstSeat = CopySeat(itemOrder);
                        foreach (SEAT item in lstSeat)
                        {
                            item.OrderNumber = Convert.ToInt32(OrderNum);
                            _context.Entry(item).State = System.Data.Entity.EntityState.Added;
                        }
                        lstOrderDetaiDate = CopyOrderDetailDate(itemOrder);
                        foreach (ORDER_DETAIL_DATE item in lstOrderDetaiDate)
                        {
                            item.OrderID = i;
                            item.OrderNumber = Convert.ToInt32(OrderNum);
                            _context.Entry(item).State = System.Data.Entity.EntityState.Added;

                        }

                        lstOrderDetailModifire = CopyOrderMidifireDate(itemOrder);
                        foreach (ORDER_DETAIL_MODIFIRE_DATE item in lstOrderDetailModifire)
                        {
                            item.OrderID = i;
                            item.OrderNumber = Convert.ToInt32(OrderNum);
                            _context.Entry(item).State = System.Data.Entity.EntityState.Added;

                        }
                        _context.SaveChanges();
                        flag = 1;
                        Tranx.Commit();
                    }
                }
            }
            catch (Exception ex)
            {

                LogPOS.WriteLog("InsertOrder::::::::::::::::::::::::::::::::::" + ex.Message);
            }
            return flag;
        }
Example #13
0
 public int CheckOrderComplete(OrderDateModel idOrder)
 {
     throw new NotImplementedException();
 }
Example #14
0
        public OrderDateModel GetOrderByTKA(string tkaID, string ClientID)
        {
            OrderDateModel OrderTKA = new OrderDateModel();
            try
            {
                var dataOrder = _context.ORDER_DATE.Where(x => x.FloorID == tkaID && x.Status != 1 && x.CreateDate.Year == DateTime.Now.Year && x.CreateDate.Month == DateTime.Now.Month && x.CreateDate.Day == DateTime.Now.Day).SingleOrDefault();

                if (dataOrder != null)
                {
                    OrderTKA.Seat = dataOrder.Seat ?? 0;
                    OrderTKA.FloorID = dataOrder.FloorID;
                    OrderTKA.OrderID = dataOrder.OrderID;
                    OrderTKA.TotalAmount = dataOrder.TotalAmount;
                    OrderTKA.ShiftID = dataOrder.ShiftID ?? 0;
                    OrderTKA.CreateBy = dataOrder.CreateBy;
                    OrderTKA.UpdateBy = dataOrder.UpdateBy;
                    var data = _context.ORDER_DATE.Join(_context.ORDER_DETAIL_DATE, order => order.OrderID,
                     item => item.OrderID, (order, item) => new { order, item })
                     .Join(_context.PRODUCTs, pro => pro.item.ProductID, c => c.ProductID, (pro, c) => new { pro, c })
                     .Where(x => x.pro.order.FloorID == dataOrder.FloorID && x.pro.order.OrderID == x.pro.item.OrderID && x.pro.order.OrderID == dataOrder.OrderID && x.pro.item.OrderID == dataOrder.OrderID && x.pro.item.ProductID == x.c.ProductID)
                     .Select(x => new OrderDetailModel()
                     {
                         ProductID = x.pro.item.ProductID,
                         Price = x.pro.item.Price,
                         Qty = x.pro.item.Qty,
                         Total = x.pro.item.Qty * x.pro.item.Price,
                         OrderID = x.pro.item.OrderID,
                         Satust = x.pro.item.Status,
                         ProductName = x.c.ProductNameSort,
                         KeyItem = x.pro.item.KeyItem ?? 0,
                         Seat = x.pro.item.Seat ?? 0,
                         DynID = x.pro.item.DynId ?? 0,
                         OrderDetailID = x.pro.item.OrderDetailID,

                     });
                    var openitems = _context.ORDER_DETAIL_DATE.Join(_context.ORDER_OPEN_ITEM, x => x.DynId, openitem => openitem.dynID, (x, openitem) => new { x, openitem })
                                .Where(a => a.x.DynId == a.openitem.dynID && a.x.OrderID == dataOrder.OrderID)
                                .Select(a => new OrderDetailModel()
                                {
                                    ProductName = a.openitem.ItemNameShort,
                                    Qty = a.x.Qty,
                                    Price = a.openitem.UnitPrice,
                                    ProductID = a.x.ProductID,
                                    Total = a.x.Qty * a.x.Price,
                                    OrderID = a.x.OrderID,
                                    Satust = a.x.Status,
                                    KeyItem = a.x.KeyItem ?? 0,
                                    Seat = a.x.Seat ?? 0,
                                    DynID = a.x.DynId ?? 0,
                                    OrderDetailID = a.x.OrderDetailID
                                });
                    foreach (OrderDetailModel openItem in openitems)
                    {
                        OrderTKA.addItemToList(openItem);
                    }
                    foreach (OrderDetailModel item in data)
                    {
                        int keyItemOld = item.KeyItem;

                        var dataOrderModifire = _context.ORDER_DETAIL_DATE.Join(_context.ORDER_DETAIL_MODIFIRE_DATE, pro => pro.ProductID,
                           modifire => modifire.ProductID, (pro, modifire) => new { pro, modifire })
                           .Join(_context.MODIFIREs, modi => modi.modifire.ModifireID, c => c.ModifireID, (modi, c) => new { modi, c })
                           .Where(x => x.modi.pro.OrderID == item.OrderID && x.modi.modifire.OrderID == item.OrderID && x.modi.pro.ProductID == item.ProductID && x.modi.modifire.ProductID == item.ProductID && x.modi.modifire.ModifireID == x.c.ModifireID && x.modi.modifire.KeyModi == keyItemOld && x.modi.pro.KeyItem == keyItemOld)
                           .Select(x => new OrderDetailModifireModel()
                           {
                               ModifireID = x.modi.modifire.ModifireID,
                               Price = x.modi.modifire.Price,
                               Qty = x.modi.modifire.Qty,
                               ModifireName = x.c.ModifireName,
                               Total = x.modi.modifire.Price * x.modi.modifire.Qty,
                               Seat = x.modi.modifire.Seat ?? 0,
                               OrderModifireID = x.modi.modifire.OrderModifireID,
                               OrderID = x.modi.pro.OrderID,
                               DynID = x.modi.modifire.DynId ?? 0
                           });
                        var print = _context.PRINTE_JOB_DETAIL.Where(x => x.ProductID == item.ProductID)
                              .Select(x => new PrinteJobDetailModel
                              {
                                  ProductID = x.ProductID,
                                  PrinterID = x.PrinterID
                              }
                              );
                        foreach (PrinteJobDetailModel p in print)
                        {
                            item.ListPrintJob.Add(p);
                        }
                        OrderTKA.addItemToList(item);
                        foreach (OrderDetailModifireModel itemmodifire in dataOrderModifire)
                        {
                            OrderTKA.addModifierToList(itemmodifire, item.KeyItem);
                        }
                        var openItemModiier = _context.ORDER_DETAIL_MODIFIRE_DATE.Join(_context.ORDER_OPEN_ITEM, modi => modi.DynId, open => open.dynID, (modi, open) => new { modi, open })
                            .Where(x => x.modi.DynId == x.open.dynID && x.modi.ProductID == item.ProductID && x.modi.OrderID == item.OrderID && x.modi.KeyModi == keyItemOld)
                            .Select(x => new OrderDetailModifireModel()
                            {
                                ModifireID = x.modi.ModifireID,
                                Price = x.modi.Price,
                                Qty = x.modi.Qty,
                                ModifireName = x.open.ItemNameShort,
                                Total = x.modi.Price * x.modi.Qty,
                                Seat = x.modi.Seat ?? 0,
                                OrderModifireID = x.modi.OrderModifireID,
                                OrderID = x.modi.OrderID ?? 0,
                                DynID = x.modi.DynId ?? 0
                            });
                        foreach (OrderDetailModifireModel Openitem in openItemModiier)
                        {
                            OrderTKA.addModifierToList(Openitem, item.KeyItem);
                        }

                    }
                }
            }
            catch (Exception ex)
            {

            }
            return OrderTKA;
        }
Example #15
0
        public OrderDateModel GetOrderByTable(string idTable, int idOrder)
        {
            OrderDateModel OrderMain = new OrderDateModel();
            var dataOrder = _context.ORDER_DATE.Where(x => x.FloorID == idTable && x.Status != 1 && x.Status != 4 && x.CreateDate.Year == DateTime.Now.Year && x.CreateDate.Month == DateTime.Now.Month && x.CreateDate.Day == DateTime.Now.Day).SingleOrDefault();
            if (dataOrder != null)
            {
                OrderMain.Seat = dataOrder.Seat ?? 0;
                OrderMain.FloorID = dataOrder.FloorID;
                OrderMain.OrderID = dataOrder.OrderID;
                OrderMain.TotalAmount = dataOrder.TotalAmount;
                OrderMain.ShiftID = dataOrder.ShiftID ?? 0;
                OrderMain.CreateBy = dataOrder.CreateBy;
                OrderMain.UpdateBy = dataOrder.UpdateBy;
                OrderMain.Status = dataOrder.Status;
                OrderMain.OrderNumber = dataOrder.OrderNumber??0;
                OrderMain.CreateDate = dataOrder.CreateDate;
                OrderMain.Note = dataOrder.Note;
                OrderMain.PrinterNote = dataOrder.PrinterNote ?? 0;
                var seat = _context.ORDER_DATE.Join(_context.SEATs, order => order.OrderNumber, seatmap => seatmap.OrderNumber, (order, seatmap) => new { order, seatmap })
                    .Where(x => x.order.OrderNumber == dataOrder.OrderNumber && x.seatmap.OrderNumber == dataOrder.OrderNumber && x.order.OrderNumber == x.seatmap.OrderNumber)
                    .Select(x => new SeatModel {
                        Seat = x.seatmap.Seat1,
                        OrderNumber = x.seatmap.OrderNumber,
                        ID = x.seatmap.ID
                    }
                    );
                foreach(SeatModel item in seat)
                {
                    OrderMain.ListSeatOfOrder.Add(item);
                }

                var data = _context.ORDER_DATE.Join(_context.ORDER_DETAIL_DATE, order => order.OrderID,
                 item => item.OrderID, (order, item) => new { order, item })
                 .Join(_context.PRODUCTs, pro => pro.item.ProductID, c => c.ProductID, (pro, c) => new { pro, c })
                 .Where(x => x.pro.order.FloorID == dataOrder.FloorID && x.pro.order.OrderID == x.pro.item.OrderID && x.pro.order.OrderID == dataOrder.OrderID && x.pro.item.OrderID == dataOrder.OrderID && x.pro.item.ProductID==x.c.ProductID)
                 .OrderBy(x=>x.pro.item.OrderDetailID)
                 .Select(x => new OrderDetailModel()
                 {
                     ProductID = x.pro.item.ProductID,
                     Price = x.pro.item.Price,
                     Qty = x.pro.item.Qty,
                     Total = x.pro.item.Qty * x.pro.item.Price,
                     OrderID = x.pro.item.OrderID,
                     Satust = x.pro.item.Status,
                     ProductName = x.c.ProductNameSort,
                     KeyItem =x.pro.item.KeyItem??0,
                     Seat=x.pro.item.Seat??0,
                     DynID=x.pro.item.DynId??0,
                     OrderDetailID =x.pro.item.OrderDetailID,
                     Printer = x.pro.item.PrintType??0,
                     OrderNumber =x.pro.item.OrderNumber??0
                 });
                var openitems = _context.ORDER_DETAIL_DATE.Join(_context.ORDER_OPEN_ITEM, x => x.DynId, openitem => openitem.dynID, (x, openitem) => new { x, openitem })
                            .Where(a => a.x.DynId == a.openitem.dynID && a.x.OrderID==dataOrder.OrderID)
                            .Select(a => new OrderDetailModel()
                            {
                                ProductName = a.openitem.ItemNameShort,
                                Qty = a.x.Qty,
                                Price = a.openitem.UnitPrice,
                                ProductID = a.x.ProductID,
                                Total = a.x.Qty * a.x.Price,
                                OrderID = a.x.OrderID,
                                Satust = a.x.Status,
                                KeyItem = a.x.KeyItem ?? 0,
                                Seat = a.x.Seat ?? 0,
                                DynID = a.x.DynId ?? 0,
                                OrderDetailID = a.x.OrderDetailID,
                                OrderNumber = a.x.OrderNumber??0,
                                Printer = a.openitem.PrinterID??0
                            });
                foreach (OrderDetailModel openItem in openitems)
                {
                    PrinteJobDetailModel pritn = new PrinteJobDetailModel();
                    pritn.PrinterID = openItem.Printer;
                    openItem.ListPrintJob.Add(pritn);
                    OrderMain.addItemToList(openItem);
                }
                foreach(OrderDetailModel item in data)
                {
                    int keyItemOld = item.KeyItem;
                    var print = _context.PRINTE_JOB_DETAIL.Where(x => x.ProductID == item.ProductID)
                       .Select(x => new PrinteJobDetailModel
                       {
                           ProductID = x.ProductID,
                           PrinterID  = x.PrinterID
                       }
                       );
                    foreach (PrinteJobDetailModel p in print)
                    {
                        item.ListPrintJob.Add(p);
                    }

                    OrderMain.addItemToList(item);
                    var dataOrderModifire = _context.ORDER_DETAIL_DATE.Join(_context.ORDER_DETAIL_MODIFIRE_DATE, pro => pro.ProductID,
                       modifire => modifire.ProductID, (pro, modifire) => new { pro, modifire })
                       .Join(_context.MODIFIREs, modi => modi.modifire.ModifireID, c => c.ModifireID, (modi, c) => new { modi, c })
                       .Where(x => x.modi.pro.OrderID == item.OrderID && x.modi.modifire.OrderID == item.OrderID && x.modi.pro.ProductID == item.ProductID && x.modi.modifire.ProductID == item.ProductID && x.modi.modifire.ModifireID == x.c.ModifireID && x.modi.modifire.KeyModi == keyItemOld && x.modi.pro.KeyItem ==keyItemOld)
                       .Select(x => new OrderDetailModifireModel()
                       {
                           ModifireID = x.modi.modifire.ModifireID,
                           Price = x.modi.modifire.Price,
                           Qty = x.modi.modifire.Qty,
                           ModifireName = x.c.ModifireName,
                           Total = x.modi.modifire.Price * x.modi.modifire.Qty,
                           Seat = x.modi.modifire.Seat ?? 0,
                           OrderModifireID = x.modi.modifire.OrderModifireID,
                           OrderID = x.modi.pro.OrderID,
                           DynID = x.modi.modifire.DynId ?? 0,
                           OrderNumber = x.modi.modifire.OrderNumber??0
                       });
                    foreach (OrderDetailModifireModel itemmodifire in dataOrderModifire)
                    {
                        OrderMain.addModifierToList(itemmodifire, item.KeyItem);
                    }
                    var openItemModiier = _context.ORDER_DETAIL_MODIFIRE_DATE.Join(_context.ORDER_OPEN_ITEM,modi=>modi.DynId,open=>open.dynID,(modi,open)=>new{modi,open})
                        .Where(x => x.modi.DynId == x.open.dynID && x.modi.ProductID == item.ProductID && x.modi.OrderID == item.OrderID && x.modi.KeyModi == keyItemOld )
                        .Select(x=>new OrderDetailModifireModel()
                        {
                            ModifireID = x.modi.ModifireID,
                            Price = x.modi.Price,
                            Qty = x.modi.Qty,
                            ModifireName = x.open.ItemNameShort,
                            Total = x.modi.Price * x.modi.Qty,
                            Seat = x.modi.Seat ?? 0,
                            OrderModifireID = x.modi.OrderModifireID,
                            OrderID = x.modi.OrderID??0,
                            DynID = x.modi.DynId??0,
                            OrderNumber = x.modi.OrderNumber??0
                        });
                    foreach (OrderDetailModifireModel Openitem in openItemModiier)
                    {
                        OrderMain.addModifierToList(Openitem, item.KeyItem);
                    }

                }
            }
            return OrderMain;
        }
Example #16
0
        public void LoadOrderTKA(string TableID, int ClientID)
        {
            indexControl = 1;
            try
            {
                OrderMain = new OrderDateModel();
                OrderMain = OrderService.GetOrderByTKA(TableID, "");
                OrderMain.isTKA = 1;
                lblSubtotal.Text = money.Format2(Convert.ToDouble(OrderMain.TotalAmount));
                if (OrderMain.Seat > 0)
                {
                    OrderMain.IsLoadFromData = true;
                    lblSeat.Text = OrderMain.Seat.ToString();
                    for (int seat = 1; seat <= OrderMain.Seat; seat++)
                    {
                        UCSeat ucSeat = new UCSeat();
                        ucSeat.lblSeat.Text = "Seat " + seat.ToString();
                        ucSeat.Click += ucSeat_Click;
                        flpOrder.Controls.Add(ucSeat);
                        indexControl = flpOrder.Controls.Count;
                        if (OrderMain.ListOrderDetail.Count > 0)
                        {
                            for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                            {
                                if (OrderMain.ListOrderDetail[i].Seat == seat)
                                {
                                    addOrder(OrderMain.ListOrderDetail[i]);
                                    indexControl++;
                                    for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                                    {
                                        UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                        uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];
                                        uc.Click += ucItemModifierOfMenu_Click;
                                        addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j]);
                                        indexControl++;
                                    }
                                }
                            }
                        }
                        else
                        {
                            OrderMain.FloorID = TableID + "" + (OrderService.CountOrder() + 1);
                            if (ClientID > 0)
                                OrderMain.ClientID = ClientID;
                            else
                                OrderMain.ClientID = 0;
                            OrderMain.ShiftID = UserLoginModel.ShiffID;
                            OrderMain.CreateBy = UserLoginModel.UserLoginInfo.StaffID;
                            OrderMain.UpdateBy = UserLoginModel.UserLoginInfo.StaffID;
                            int OrderID = OrderService.CountOrder() + 1;
                            OrderMain.OrderID = OrderID;
                        }
                    }
                }
                else
                {
                    if (OrderMain.ListOrderDetail.Count > 0)
                    {
                        OrderMain.IsLoadFromData = true;
                        for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                        {
                            addOrder(OrderMain.ListOrderDetail[i]);
                            indexControl++;
                            for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                            {
                                UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];
                                uc.Click += ucItemModifierOfMenu_Click;
                                addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j]);
                                indexControl++;
                            }
                        }
                    }
                    else
                    {
                        OrderMain.FloorID = TableID + "" + (OrderService.CountOrder() + 1);
                        OrderMain.ClientID = ClientID;
                        OrderMain.ShiftID = UserLoginModel.ShiffID;
                        OrderMain.CreateBy = UserLoginModel.UserLoginInfo.StaffID;
                        OrderMain.UpdateBy = UserLoginModel.UserLoginInfo.StaffID;
                        int OrderID = OrderService.CountOrder() + 1;
                        OrderMain.OrderID = OrderID;
                    }
                }

            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("LoadOrder:::::::::::::::::::::::::::::::::" + ex.Message);
            }
        }
Example #17
0
        private void btnPayMent_Click(object sender, EventArgs e)
        {
            //flags = WinAPI.AW_ACTIVATE | WinAPI.AW_HOR_POSITIVE;
            try
            {
                if (OrderMain.Status == 1)
                    OrderCompleted();
                else
                {
                    if (OrderMain.ListOrderDetail.Count > 0)
                    {
                        frmse.BindOrder(OrderMain);
                        frmPayMent frm = new frmPayMent(OrderMain, 1000, 131073);
                        if (frmOpacity.ShowDialog(this, frm) == System.Windows.Forms.DialogResult.OK)
                        {
                            GetListPaymentPrinter();
                            int result = 0;
                            OrderMain = frm.OrderMain;
                            OrderMain.PrintType = 2;
                            result = InvoiceService.InsertInvoice(OrderMain);

                            if (result == 1)
                            {
                                if (OrderMain.isNoPrintBill == 1)
                                {
                                    if (OrderMain.isTKA == 1)
                                    {
                                        this.Close();
                                        frmTakeAway frmTKA = new frmTakeAway();
                                        frmTKA.Show();

                                    }
                                    else
                                    {
                                        CallBackStatusOrderCancel();
                                        this.Close();
                                    }
                                }
                                else
                                {
                                    PrinterServer printServer = new PrinterServer();
                                    printServer.PrintData(OrderMain, PrintData);
                                    if (OrderMain.isTKA == 1)
                                    {
                                        this.Close();
                                        frmTakeAway frmTKA = new frmTakeAway();
                                        frmTKA.Show();

                                    }
                                    else
                                    {
                                        frmse.fullScreen();
                                        CallBackStatusOrderCancel();
                                        this.Close();
                                    }
                                }
                                foreach(PrinterModel item in PrintData)
                                {
                                    if (item.PrinterType == 4)
                                        Class.RawPrinterHelper.openCashDrawer(item.PrinterName);
                                }

                            }

                        }
                    }
                    else
                    {
                        frmMessager frm = new frmMessager("PayMent", "Order empty");
                        frmOpacity.ShowDialog(this, frm);
                    }
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmOrder:::::::::::::::::::::::btnPayMent_Click::::::::::::::::;" + ex.Message);
            }
        }
Example #18
0
 public int VoidItemHistory(OrderDateModel OrderVoid)
 {
     int result = 0;
     try
     {
         foreach (OrderDetailModel item in OrderVoid.ListOrderDetail)
         {
             if (item.ChangeStatus == 2)
             {
                 VOID_ITEM_HISTORY voidItem = new VOID_ITEM_HISTORY();
                 voidItem.OrderID = OrderVoid.OrderID;
                 voidItem.OrderNumber = OrderVoid.OrderNumber;
                 voidItem.FloorID = OrderVoid.FloorID;
                 voidItem.ShiftID = OrderVoid.ShiftID;
                 voidItem.ProductID = item.ProductID;
                 voidItem.Total =Convert.ToInt32(item.Total);
                 voidItem.Qty = Convert.ToInt32(item.Qty);
                 voidItem.CreateBy = 0;
                 voidItem.CreateDate = DateTime.Now;
                 voidItem.UpdateBy = 0;
                 voidItem.UpdateDate = DateTime.Now;
                 _context.Entry(voidItem).State = System.Data.Entity.EntityState.Added;
                 _context.SaveChanges();
                 result = 1;
             }
         }
     }
     catch (Exception ex)
     {
         LogPOS.WriteLog("OrderService::::::::::::::::::::VoidItemHistory::::::::::::::" + ex.Message);
     }
     return result;
 }
Example #19
0
 private void btnLeftAll_Click(object sender, EventArgs e)
 {
     try
     {
         flpOldTable.Controls.Clear();
         LoadOrder(lblNoTable.Text, 0,flpNewTable);
         OrderSlpitNew = OrderMain;
         OrderSlpitNew.FloorID = lblNewTable.Text;
         OrderMain.isTransferTableAll = 1;
         tableOld = this.lblNoTable.Text;
     }
     catch (Exception ex)
     {
         LogPOS.WriteLog("frmTransferTable:::::::::::::::::::::::::ebtnLeftAll_Click:::::::::::::::" + ex.Message);
     }
 }
Example #20
0
 private void CallBackOrder(OrderDateModel orderCallBack)
 {
     //UCTable uctable = (UCTable)flowLayoutPanel1.Controls[Convert.ToInt32(orderCallBack.FloorID)-1];
     //uctable.BackColor = Color.FromArgb(0, 102, 204);
     //uctable.ForeColor = Color.White;
     //uctable.lbTime.Text = orderCallBack.CreateDate.ToString();
     //uctable.Tag = orderCallBack;
     //SetText("$" + monetFormat.Format(Convert.ToDouble(orderCallBack.SubTotal())), uctable.lbSubTotal);
     CheckStatusTable();
 }
Example #21
0
        public void LoadOrder(string TableID, int orderID,FlowLayoutPanel flp)
        {
            int indexControl = 1;
            try
            {

                OrderMain = OrderService.GetOrderByTable(TableID, 0);

                if (OrderMain.ListSeatOfOrder.Count>0)
                {
                    OrderMain.IsLoadFromData = true;
                    //lblSeat.Text = OrderMain.Seat.ToString();
                    foreach (SeatModel seat in OrderMain.ListSeatOfOrder)
                    {
                        UCSeat ucSeat = new UCSeat();
                        ucSeat.lblSeat.Text = "Seat " + seat.Seat.ToString();
                       // ucSeat.Click += ucSeat_Click;
                        flpOldTable.Controls.Add(ucSeat);
                        indexControl = flpOldTable.Controls.Count;
                        if (OrderMain.ListOrderDetail.Count > 0)
                        {
                            for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                            {
                                if (OrderMain.ListOrderDetail[i].Seat == seat.Seat)
                                {
                                    addOrder(OrderMain.ListOrderDetail[i],flp);
                                    indexControl++;
                                    for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                                    {
                                        UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                        uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];
                                        //uc.Click += ucItemModifierOfMenu_Click;
                                        addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j],flp);
                                        indexControl++;
                                    }
                                }
                            }
                        }
                        else
                        {
                            OrderMain.FloorID = TableID;
                            int OrderID = OrderService.CountOrder() + 1;
                            OrderMain.OrderID = OrderID;
                        }
                    }
                }
                else
                {
                    if (OrderMain.ListOrderDetail.Count > 0)
                    {
                        OrderMain.IsLoadFromData = true;
                        for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                        {
                            addOrder(OrderMain.ListOrderDetail[i],flp);
                            indexControl++;
                            for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                            {
                                UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];
                                //uc.Click += ucItemModifierOfMenu_Click;
                                addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j],flp);
                                indexControl++;
                            }
                        }
                    }
                    else
                    {
                        OrderMain.FloorID = TableID;
                        int OrderID = OrderService.CountOrder() + 1;
                        OrderMain.OrderID = OrderID;
                    }
                }

            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmTranferTable:::::::::::::::::::LoadOrder:::::::::::::::::::::::::::::::::" + ex.Message);
            }
        }
Example #22
0
 private void CallBackOrderCancel(OrderDateModel orderCallBack)
 {
     CheckStatusTable();
 }
Example #23
0
 private ACC_PAYMENT CopyAcc(OrderDateModel Order)
 {
     ACC_PAYMENT acc = new ACC_PAYMENT();
     acc.SubTotal = Convert.ToInt32(Order.TotalAmount);
     acc.CusNo = Order.CusItem.ClientID;
     acc.InvoiceID = Order.InvoiceID;
     acc.InvoiceNumber = Order.InvoiceNumber;
     acc.Cash = 0;
     acc.Card = 0;
     acc.IsCredit = 1;
     acc.IsDebit = 0;
     acc.CreateBy = Order.CreateBy ?? 0;
     acc.CreateDate = DateTime.Now;
     acc.UpdateBy = Order.UpdateBy ?? 0;
     acc.UpdateDate = DateTime.Now;
     return acc;
 }
Example #24
0
 public frmFloor(OrderDateModel _orderMain)
 {
     InitializeComponent();
     orderMain = _orderMain;
 }
Example #25
0
        private List<INVOICE_BY_CARD> CopyInvoiceByCard(OrderDateModel Order)
        {
            List<INVOICE_BY_CARD> lst = new List<INVOICE_BY_CARD>();
            lst.Clear();
            for (int i = 0; i < Order.ListInvoiceByCard.Count; i++)
            {
                INVOICE_BY_CARD item = new INVOICE_BY_CARD();
                item.InvoiceByCardID =Convert.ToInt32(CustomerInvoiceByCardID());

                item.CardID = Order.ListInvoiceByCard[i].CardID;
                item.Total = Order.ListInvoiceByCard[i].Total;
                item.CreateBy = Order.ListInvoiceByCard[i].CreateBy ?? 0;
                item.CreateDate = DateTime.Now;
                item.UpdateBy = Order.ListInvoiceByCard[i].UpdateBy ?? 0;
                item.UpdateDate = DateTime.Now;
                item.Note = Order.ListInvoiceByCard[i].Note ?? "";
                lst.Add(item);
            }
            return lst;
        }
Example #26
0
        public void LoadOrder(string TableID, int orderID)
        {
            indexControl = 1;
            try
            {
                OrderMain = new OrderDateModel();
                OrderMain = OrderService.GetOrderByTable(TableID, 0);
                OrderMain.ListOrderDetail = OrderMain.ListOrderDetail.OrderBy(x => x.OrderDetailID).ToList();
                if (OrderMain.TotalAmount > 0)
                {
                    lblSubtotal.Text = money.Format2(Convert.ToDouble(OrderMain.TotalAmount));
                }
                else
                {
                    lblSubtotal.Text = "0.0";
                }
                if (OrderMain.ListSeatOfOrder.Count > 0)
                {
                    OrderMain.IsLoadFromData = true;
                    lblSeat.Text = OrderMain.Seat.ToString();
                    lblStatus.Text = "OLD";
                    Boolean addSet;
                    foreach (SeatModel seat in OrderMain.ListSeatOfOrder)
                    {
                        addSet = true;
                        if (OrderMain.ListOrderDetail.Count > 0)
                        {
                            for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                            {
                                if (OrderMain.ListOrderDetail[i].Seat == seat.Seat)
                                {
                                    if (addSet)
                                    {
                                        UCSeat ucSeat = new UCSeat();
                                        ucSeat.lblSeat.Text = "Seat " + seat.Seat.ToString();
                                        ucSeat.Tag = seat.Seat;
                                        ucSeat.Click += ucSeat_Click;
                                        flpOrder.Controls.Add(ucSeat);
                                        indexControl = flpOrder.Controls.Count;
                                        addSet = false;
                                    }
                                    addOrder(OrderMain.ListOrderDetail[i]);
                                    indexControl++;
                                    for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                                    {
                                        UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                        uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];
                                        uc.Click += ucItemModifierOfMenu_Click;
                                        addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j]);
                                        indexControl++;
                                    }
                                }
                                else
                                {
                                    if (OrderMain.ListOrderDetail[i].Seat == 0)
                                    {
                                        addOrder(OrderMain.ListOrderDetail[i]);
                                        indexControl++;
                                        for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                                        {
                                            UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                            uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];
                                            uc.Click += ucItemModifierOfMenu_Click;
                                            addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j]);
                                            indexControl++;
                                        }
                                    }
                                }

                            }
                        }
                        else
                        {
                            OrderMain.FloorID = TableID;
                            OrderMain.ShiftID = UserLoginModel.ShiffID;
                            OrderMain.CreateBy = UserLoginModel.UserLoginInfo.StaffID;
                            OrderMain.UpdateBy = UserLoginModel.UserLoginInfo.StaffID;
                            int OrderID = OrderService.CountOrder() + 1;
                            OrderMain.OrderID = OrderID;
                            lblStatus.Text = "NEW";
                        }
                    }
                }
                else
                {
                    if (OrderMain.ListOrderDetail.Count > 0)
                    {
                        OrderMain.IsLoadFromData = true;
                        lblStatus.Text = "OLD";
                        for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                        {
                            addOrder(OrderMain.ListOrderDetail[i]);
                            indexControl++;
                            for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                            {
                                UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];
                                uc.Click += ucItemModifierOfMenu_Click;
                                addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j]);
                                indexControl++;
                            }
                        }
                    }
                    else
                    {
                        OrderMain.FloorID = TableID;
                        OrderMain.ShiftID = UserLoginModel.ShiffID;
                        OrderMain.CreateBy = UserLoginModel.UserLoginInfo.StaffID;
                        OrderMain.UpdateBy = UserLoginModel.UserLoginInfo.StaffID;
                        int OrderID = OrderService.CountOrder() + 1;
                        OrderMain.OrderID = OrderID;
                        lblStatus.Text = "NEW";
                    }
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmOrder:::::::::::::::::::::::LoadOrder:::::::::::::::::::::::::::::::::" + ex.Message);
            }
        }
Example #27
0
        private List<INVOICE_DETAIL_MODIFIRE> CopyInvoiceMidifire(OrderDateModel itemOrder)
        {
            List<INVOICE_DETAIL_MODIFIRE> lstOrderModifreDate = new List<INVOICE_DETAIL_MODIFIRE>();
            lstOrderModifreDate.Clear();
            try
            {
                for (int i = 0; i < itemOrder.ListOrderDetail.Count; i++)
                {
                    for (int j = 0; j < itemOrder.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                    {

                            INVOICE_DETAIL_MODIFIRE orderDetailModifire = new INVOICE_DETAIL_MODIFIRE();
                            orderDetailModifire.ModifireID = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].ModifireID;

                            orderDetailModifire.OrderModifireID = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].OrderModifireID;
                            orderDetailModifire.ProductID = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].ProductID;
                            orderDetailModifire.KeyModi = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].KeyModi;
                            orderDetailModifire.Price = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].Price;
                            orderDetailModifire.Qty = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].Qty;
                            orderDetailModifire.Total = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].Total;
                            orderDetailModifire.Status = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].Satust;
                            orderDetailModifire.Seat = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].Seat;
                            orderDetailModifire.DynId = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].DynID;
                            orderDetailModifire.CreateBy = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].CreateBy ?? 0;
                            orderDetailModifire.CreateDate = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].CreateDate ?? DateTime.Now;
                            orderDetailModifire.UpdateBy = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].UpdateBy ?? 0;
                            orderDetailModifire.UpdateDate = itemOrder.ListOrderDetail[i].ListOrderDetailModifire[j].UpdateDate ?? DateTime.Now;
                            lstOrderModifreDate.Add(orderDetailModifire);

                    }

                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("CopyOrderMidifireDate:::::::::::::::::::::::::::::::::" + ex.Message);
            }
            return lstOrderModifreDate;
        }
Example #28
0
 private void ModifireItemInOrder(OrderDateModel Order, OrderDetailModel Item)
 {
     for (int i = 0; i < Order.ListOrderDetail.Count; i++)
     {
         if (Order.ListOrderDetail[i].KeyItem == Item.KeyItem)
         {
             Order.ListOrderDetail[i].Price = Item.Price;
         }
     }
 }
Example #29
0
        public int InsertInvoice(OrderDateModel Order)
        {
            int result = 0;
            int InvoiceID;
            INVOICE invoice = new INVOICE();
            List<INVOICE_DETAIL> invoiceDEtail = new List<INVOICE_DETAIL>();
            List<INVOICE_DETAIL_MODIFIRE> invoiceDetailModifier = new List<INVOICE_DETAIL_MODIFIRE>();
            List<PAYMENT_INVOICE_HISTORY> PaymentHistory = new List<PAYMENT_INVOICE_HISTORY>();
            List<INVOICE_BY_CARD> InvoiceByCard = new List<INVOICE_BY_CARD>();
            ACC_PAYMENT Acc = new ACC_PAYMENT();
            using (var trans = _context.Database.BeginTransaction())
            {
                _context.Database.ExecuteSqlCommand("update ORDER_DATE set Status=1 where OrderID='" + Order.OrderID + "'");
                invoice = CopyInvoice(Order);
                _context.Entry(invoice).State = System.Data.Entity.EntityState.Added;
                _context.SaveChanges();
                InvoiceID = invoice.InvoiceID;
                string InvNum = InvoiceID + "" + DateTime.Now.Date.Year + "" + DateTime.Now.Date.Month + "" + DateTime.Now.Date.Day;
                _context.Database.ExecuteSqlCommand("update invoice set InvoiceNumber='" + InvNum + "'where InvoiceID='" + InvoiceID + "'");

                //Update balance for customer
                _context.Database.ExecuteSqlCommand("update client set balance=balance+'" + -Convert.ToInt32(Order.Payment) + "' where ClientID='" + Order.CusItem.ClientID + "'");
                Acc = CopyAcc(Order);
                Acc.InvoiceID = InvoiceID;
                Acc.InvoiceNumber =Convert.ToInt32(InvNum);
                //_context.Entry(Acc).State = System.Data.Entity.EntityState.Added;
                string sql = "insert into acc_payment(CusNo,SubTotal,InvoiceID,InvoiceNumber,Cash,Card,IsCredit,IsDebit,CreateDate,CreateBy,UpdateDate,UpdateBy)values(" +
                    "'" + Order.CusItem.ClientID + "','" + Convert.ToInt32(Order.Payment) + "','" + InvoiceID + "','" + Convert.ToInt32(InvNum) + "',0,0,1,0,'" + DateTime.Now + "','" + Order.ShiftID + "','" + DateTime.Now + "','" + Order.ShiftID + "')";
                _context.Database.ExecuteSqlCommand("insert into acc_payment(CusNo,SubTotal,InvoiceID,InvoiceNumber,Cash,Card,IsCredit,IsDebit,CreateDate,CreateBy,UpdateDate,UpdateBy)values(" +
                    "'" + Order.CusItem.ClientID + "','" +Convert.ToInt32(Order.Payment) + "','" + InvoiceID + "','" +Convert.ToInt32(InvNum) + "',0,0,1,0,'" + DateTime.Now + "','" + Order.ShiftID + "','" + DateTime.Now + "','" + Order.ShiftID + "')");
                //
                invoiceDEtail = CopyInvoicedetail(Order);
                foreach (INVOICE_DETAIL item in invoiceDEtail)
                {
                    item.InvoiceID = InvoiceID;
                    item.InvoiceNumber = Convert.ToInt32(InvNum);
                    _context.Entry(item).State = System.Data.Entity.EntityState.Added;
                }
                invoiceDetailModifier = CopyInvoiceMidifire(Order);

                foreach (INVOICE_DETAIL_MODIFIRE item in invoiceDetailModifier)
                {
                    item.InvoiceID = InvoiceID;
                    item.InvoiceNumber = Convert.ToInt32(InvNum);

                    _context.Entry(item).State = System.Data.Entity.EntityState.Added;
                }

                PaymentHistory = CopyListPayment(Order);
                foreach (PAYMENT_INVOICE_HISTORY item in PaymentHistory)
                {
                    item.InvoiceID = InvoiceID;
                    item.InvoiceNumber = Convert.ToInt32(InvNum);
                    _context.Entry(item).State = System.Data.Entity.EntityState.Added;
                }

                InvoiceByCard = CopyInvoiceByCard(Order);
                foreach(INVOICE_BY_CARD item in InvoiceByCard)
                {
                    item.InvoiceID = InvoiceID;
                    _context.Entry(item).State = System.Data.Entity.EntityState.Added;
                }

                _context.SaveChanges();
                trans.Commit();
                result = 1;
            }
            return result;
        }
Example #30
0
        public void LoadOrderPrev(int orderID)
        {
            indexControl = 1;
            try
            {
                OrderMain = new OrderDateModel();
                OrderMain = OrderService.GetListOrderPrevOrder("", orderID, DateTime.Now.Date);
                lblSubtotal.Text = money.Format2(Convert.ToDouble(OrderMain.TotalAmount));
                if (OrderMain.Seat > 0)
                {
                    OrderMain.IsLoadFromData = true;
                    lblSeat.Text = OrderMain.Seat.ToString();
                    lblStatus.Text = "OLD";
                    for (int seat = 1; seat <= OrderMain.Seat; seat++)
                    {
                        UCSeat ucSeat = new UCSeat();
                        ucSeat.lblSeat.Text = "Seat " + seat.ToString();
                        ucSeat.Click += ucSeat_Click;
                        flpOrder.Controls.Add(ucSeat);
                        indexControl = flpOrder.Controls.Count;
                        if (OrderMain.ListOrderDetail.Count > 0)
                        {
                            for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                            {
                                if (OrderMain.ListOrderDetail[i].Seat == seat)
                                {
                                    addOrder(OrderMain.ListOrderDetail[i]);
                                    indexControl++;
                                    for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                                    {
                                        UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                        uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];
                                        uc.Click += ucItemModifierOfMenu_Click;
                                        addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j]);
                                        indexControl++;
                                    }
                                }
                            }
                        }

                    }
                }
                else
                {
                    if (OrderMain.ListOrderDetail.Count > 0)
                    {
                        OrderMain.IsLoadFromData = true;
                        lblStatus.Text = "OLD";
                        for (int i = 0; i < OrderMain.ListOrderDetail.Count; i++)
                        {
                            addOrder(OrderMain.ListOrderDetail[i]);
                            indexControl++;
                            for (int j = 0; j < OrderMain.ListOrderDetail[i].ListOrderDetailModifire.Count; j++)
                            {
                                UCItemModifierOfMenu uc = new UCItemModifierOfMenu();
                                uc.Tag = OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j];
                                uc.Click += ucItemModifierOfMenu_Click;
                                addModifreToOrder(uc, OrderMain.ListOrderDetail[i].ListOrderDetailModifire[j]);
                                indexControl++;
                            }
                        }
                    }

                }

            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("LoadOrder:::::::::::::::::::::::::::::::::" + ex.Message);
            }
        }