示例#1
0
        public static void CompleteOrder(
            int orderID
            , string orderType
            , ref List <int> listOfBagsCounted
            , ref List <int> listOfBagsNotCounted
            )
        {
            if (listOfBagsNotCounted.Count < 1)
            {
                return;
            }

            //set the status of the rest of the bags to MISSING
            Qds_Drop_Sp qds_Drop_Sp = new Qds_Drop_Sp(Properties.Settings.Default.WsirDbConnectionString);

            List <Qds_Drop> dl         = qds_Drop_Sp._SelectAllByOrderID_OrderType(orderID, orderType);
            Qds_Drop        qds_Drop   = dl[0];
            Qds_Bag_Sp      qds_Bag_Sp = new Qds_Bag_Sp(Properties.Settings.Default.WsirDbConnectionString);

            List <Qds_Bag> bl = qds_Bag_Sp._SelectAllByDropID(qds_Drop.DropID);
            //create new drop for missing bags
            Qds_Drop nd = new Qds_Drop();

            //nd.DropID = 0;
            nd.CustomerID      = qds_Drop.CustomerID;
            nd.NumberOfBags    = listOfBagsNotCounted.Count; // od.NumberOfBags;
            nd.PaymentMethodID = qds_Drop.PaymentMethodID;
            nd.DepotID         = qds_Drop.DepotID;
            nd.OrderID         = 0;
            nd.OrderType       = "M"; //missing
            qds_Drop_Sp.Insert(nd);

            //move missing bags to new drop
            //foreach(ComboBoxItem i in comboBoxBagId.Items)

            foreach (int id in listOfBagsNotCounted)
            {
                //move missing bag
                Qds_Bag mb = qds_Bag_Sp.Select(id); //bagIdFromComboBox);
                mb.DropID = nd.DropID;
                qds_Bag_Sp.Update(mb);
            }

            //change numer of bags of the original drop
            qds_Drop.NumberOfBags -= listOfBagsNotCounted.Count();
            qds_Drop_Sp.Update(qds_Drop);

            //close order
            Sol_Order_Sp sol_Order_Sp = new Sol_Order_Sp(Properties.Settings.Default.WsirDbConnectionString);
            Sol_Order    sol_Order    = sol_Order_Sp.Select(orderID, orderType);

            sol_Order_Sp.UpdateDates(sol_Order.OrderID, sol_Order.OrderType, "", "DateClosed");

            //is drop ready for payment?
            if (qds_Drop_Sp.IsReady(qds_Drop.DropID))
            {
                string status = String.Empty;
                if (qds_Drop.PaymentMethodID == 1)
                {
                    status = "A";
                }
                else
                {
                    status = "O";
                }
                sol_Order_Sp.UpdateStatus(sol_Order.OrderID, sol_Order.OrderType, status);
            }

            //update customerID
            //sol_Order_Sp._UpdateCustomerID(sol_Order.OrderID, sol_Order.OrderType, qds_Drop.CustomerID);
        }
示例#2
0
        private void QdBags_Load(object sender, EventArgs e)
        {
            panelDrops.Dock    = DockStyle.Fill;
            panelDrops.Visible = true;

            //disable form resizing
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            if (Properties.Settings.Default.TouchOriented)
            {
                this.Height                      = this.Height + (OK.Height) + 150;
                OK.Height                        = OK.Height * 2;
                buttonBags.Height                = buttonBags.Height * 2;
                buttonRefresh.Height             = buttonRefresh.Height * 2;
                Cancel.Height                    = Cancel.Height * 2;
                toolStripButtonVirtualKb.Visible = true;
                this.radioButtonShowAll.Font     = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.radioButtonMineOnly.Font    = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.CenterToParent();

                //bags
                buttonBagsSelect.Height          = buttonBagsSelect.Height * 2;
                buttonBagsRefresh.Height         = buttonBagsRefresh.Height * 2;
                buttonBagsClose.Height           = buttonBagsClose.Height * 2;
                this.radioButtonBagsShowAll.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.radioButtonBagsUnused.Font  = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            }

            //drops
            //listview with headers
            listViewDrops.View = View.Details;
            listViewDrops.Columns.Add("Drop #", 120, HorizontalAlignment.Right);
            listViewDrops.Columns.Add("Customer", 230, HorizontalAlignment.Left);
            listViewDrops.Columns.Add("Bags", 110, HorizontalAlignment.Right);
            listViewDrops.Columns.Add("Payment Method", 230, HorizontalAlignment.Left);
//            listViewDrop.Columns.Add("DepotID", 120, HorizontalAlignment.Left);
            listViewDrops.Columns.Add("Order #", 120, HorizontalAlignment.Right);
            listViewDrops.Columns.Add("Type", 75, HorizontalAlignment.Center);

            listViewDrops.FullRowSelect = true;
            listViewDrops.CheckBoxes    = true;
            listViewDrops.GridLines     = true;
            //listViewDrops.Activation = ItemActivation.OneClick;
            listViewDrops.MultiSelect = true;


            //bags
            //listview with headers
            listViewBags.View = View.Details;
            listViewBags.Columns.Add("Bag #", 120, HorizontalAlignment.Right);
            listViewBags.Columns.Add("Date Entered", 230, HorizontalAlignment.Center);
            listViewBags.Columns.Add("Date Counted", 230, HorizontalAlignment.Center);
            listViewBags.Columns.Add("Date Printed", 230, HorizontalAlignment.Center);
            //            listViewDrop.Columns.Add("DepotID", 120, HorizontalAlignment.Left);
            listViewBags.Columns.Add("Order #", 120, HorizontalAlignment.Right);

            listViewBags.FullRowSelect = true;
            listViewBags.CheckBoxes    = true;
            listViewBags.GridLines     = true;
            //listViewBags.Activation = ItemActivation.OneClick;


            if (qds_Drop_Sp == null)
            {
                qds_Drop_Sp = new Qds_Drop_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }

            if (qds_Bag_Sp == null)
            {
                qds_Bag_Sp = new Qds_Bag_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }

            if (qds_PaymentMethod_Sp == null)
            {
                qds_PaymentMethod_Sp = new Qds_PaymentMethod_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }

            if (sol_Customer_Sp == null)
            {
                sol_Customer_Sp = new Sol_Customer_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }


            radioButtonMineOnly.Checked = true;

            ReadDrops(radioButtonMineOnly.Checked);
        }