Esempio n. 1
0
        public void CreateOrder()
        {
            POSOrder order = new POSOrder();

            order.ID     = "" + (++orderNumber);
            CurrentOrder = order;
            Orders.Add(order);
        }
Esempio n. 2
0
        public void CreateOrder()
        {
            //Get rid of any prior pending orders, before creating a new one
            DeletePendingOrder();
            POSOrder order = new POSOrder();

            order.ID     = "" + (++orderNumber);
            CurrentOrder = order;
            AddOrder(order);
        }
Esempio n. 3
0
        private void OrdersListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            OrderDetailsListView.Items.Clear();
            if (OrdersListView.SelectedIndices.Count == 1)
            {
                ListViewItem lvi = OrdersListView.SelectedItems[0];

                POSOrder selOrder = (POSOrder)lvi.Tag;

                OrderDetailsListView.Items.Clear();

                // update order items table
                foreach (POSLineItem lineItem in selOrder.Items)
                {
                    lvi     = new ListViewItem();
                    lvi.Tag = lineItem;
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());

                    lvi.SubItems[0].Text = lineItem.Quantity + "";
                    lvi.SubItems[1].Text = lineItem.Item.Name;
                    lvi.SubItems[2].Text = (lineItem.Item.Price / 100.0).ToString("C2");

                    OrderDetailsListView.Items.Add(lvi);
                }

                // update order payments table
                OrderPaymentsView.Items.Clear();
                foreach (var Exchange in selOrder.Payments)
                {
                    lvi     = new ListViewItem();
                    lvi.Tag = Exchange;
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem());

                    if (Exchange is POSPayment)
                    {
                        lvi.SubItems[0].Text = (Exchange is POSPayment) ? ((POSPayment)Exchange).PaymentStatus.ToString() : "";
                        lvi.SubItems[1].Text = (Exchange.Amount / 100.0).ToString("C2");
                        lvi.SubItems[2].Text = (Exchange is POSPayment) ? (((POSPayment)Exchange).TipAmount / 100.0).ToString("C2") : "";
                        lvi.SubItems[3].Text = (Exchange is POSPayment) ? ((((POSPayment)Exchange).TipAmount + Exchange.Amount) / 100.0).ToString("C2") : (Exchange.Amount / 100.0).ToString("C2");
                    }
                    else if (Exchange is POSRefund)
                    {
                        lvi.SubItems[0].Text = "REFUND";
                        lvi.SubItems[3].Text = (Exchange.Amount / 100.0).ToString("C2");
                    }

                    OrderPaymentsView.Items.Add(lvi);
                }
            }
        }
Esempio n. 4
0
 public long Value(POSOrder order)
 {
     if (AmountOff > 0)
     {
         return(AmountOff);
     }
     else
     {
         return((int)(order.PreTaxSubTotal * PercentageOff));
     }
 }
Esempio n. 5
0
 protected void onOrderChange(POSOrder order, OrderChangeTarget target)
 {
     if (order.status == OrderStatus.PENDING &&
         order.Items.Count > 0)
     {
         order.status = OrderStatus.OPEN;
     }
     if (OrderChange != null)
     {
         OrderChange(order, target);
     }
 }
Esempio n. 6
0
        //////////////// Payment Refund methods /////////////
        private void PaymentRefundButton_Click(object sender, EventArgs e)
        {
            RefundPaymentRequest request = new RefundPaymentRequest();

            if (OrderPaymentsView.SelectedItems.Count == 1)
            {
                POSPayment payment = ((POSPayment)OrderPaymentsView.SelectedItems[0].Tag);
                request.PaymentId = payment.PaymentID;
                POSOrder order = (POSOrder)OrdersListView.SelectedItems[0].Tag;
                request.OrderId = payment.OrderID;
                TempObjectMap.Add(payment.OrderID, order);
                cloverConnector.RefundPayment(request);
            }
        }
Esempio n. 7
0
        /*  This will remove any other PENDING order before creating a new one. */
        private void DeletePendingOrder()
        {
            POSOrder delOrder = null;

            foreach (POSOrder order in Orders)
            {
                if (order.Status == POSOrder.OrderStatus.PENDING)
                {
                    delOrder = order;
                    break;
                }
            }
            if (delOrder != null)
            {
                Orders.Remove(delOrder); //This shouldn't trigger a onOrderListChange, as PENDING orders aren't displayed
                delOrder = null;
            }
        }
Esempio n. 8
0
 public void CreateOrder()
 {
     POSOrder order = new POSOrder();
     order.ID = "" + (++orderNumber);
     CurrentOrder = order;
     Orders.Add(order);
 }
Esempio n. 9
0
 public void AddOrder(POSOrder order)
 {
     Orders.Add(order);
     onOrderListChange(this, OrderListAction.ADDED);
 }
 public void UnsubscribeToOrderChanges(POSOrder order)
 {
     order.OrderChange -= new POSOrder.OrderDataChangeHandler(OrderChanged);
 }
 public void OrderChanged(POSOrder order, POSOrder.OrderChangeTarget target)
 {
     switch (target)
     {
         case POSOrder.OrderChangeTarget.ORDER:
             {
                 switch (GetCurrentTab())
                 {
                     case ClientTab.ORDER:
                         {
                             if (order.ID == Store.CurrentOrder.ID)
                             {
                                 uiThread.Send(delegate (object state)
                                 {
                                     UpdateOrderUI();
                                 }, null);
                             }
                             break;
                         }
                     case ClientTab.ORDERLIST:
                         {
                             uiThread.Send(delegate (object state)
                             {
                                 UpdateOrdersListView();
                             }, null);
                             break;
                         }
                 }
                 break;
             }
         case POSOrder.OrderChangeTarget.ITEM:
             {
                 switch (GetCurrentTab())
                 {
                     case ClientTab.ORDER:
                         {
                             if (order.ID == Store.CurrentOrder.ID)
                             {
                                 uiThread.Send(delegate (object state)
                                 {
                                     UpdateOrderUI();
                                 }, null);
                             }
                             break;
                         }
                     case ClientTab.ORDERLIST:
                         {
                             uiThread.Send(delegate (object state)
                             {
                                 UpdateOrdersListView();
                             }, null);
                             break;
                         }
                 }
                 break;
             }
         case POSOrder.OrderChangeTarget.PAYMENT:
             {
                 if (GetCurrentTab() == ClientTab.ORDERLIST)
                 {
                     uiThread.Send(delegate (object state)
                     {
                         UpdateOrdersListView();
                     }, null);
                 }
                 break;
             }
     }
 }
Esempio n. 12
0
 public long Value(POSOrder order)
 {
     if (AmountOff > 0)
     {
         return AmountOff;
     }
     else
     {
         return (int)(order.PreTaxSubTotal * PercentageOff);
     }
 }
Esempio n. 13
0
 public void CreateOrder()
 {
     //Get rid of any prior pending orders, before creating a new one
     DeletePendingOrder();
     POSOrder order = new POSOrder();
     order.ID = "" + (++orderNumber);
     CurrentOrder = order;
     AddOrder(order);
 }
Esempio n. 14
0
 public void AddOrder(POSOrder order)
 {
     Orders.Add(order);
     onOrderListChange(this, OrderListAction.ADDED);
 }
Esempio n. 15
0
 protected void onOrderChange(POSOrder order, OrderChangeTarget target)
 {
     if (order.status == OrderStatus.PENDING &&
         order.Items.Count > 0)
     {
         order.status = OrderStatus.OPEN;
     }
     if (OrderChange != null)
     {
         OrderChange(order, target);
     }
 }