Exemplo n.º 1
0
        private void UpdateOrders()
        {
            //bool firstTime = true;
            int    orderId   = 0;
            string orderType = "";

            totalPaidOrders = 0;

            Sol_Order_Sp            sol_Order_Sp         = new Sol_Order_Sp(Properties.Settings.Default.WsirDbConnectionString);
            Sol_OrdersDetail        sol_OrdersDetail     = new Sol_OrdersDetail();
            Sol_OrdersDetail_Sp     sol_OrdersDetail_Sp  = new Sol_OrdersDetail_Sp(Properties.Settings.Default.WsirDbConnectionString);
            List <Sol_OrdersDetail> sol_OrdersDetailList = new List <Sol_OrdersDetail>();

            //items
            ListView.ListViewItemCollection Items = listView1.Items;
            foreach (ListViewItem item in Items)
            {
                if (!Int32.TryParse(item.SubItems[0].Text, out orderId))
                {
                    MessageBox.Show("We couldn't parse Order " + item.SubItems[0].Text);
                    continue;
                }

                orderType = item.SubItems[4].Text;


                //read order
                Sol_Order sol_Order = sol_Order_Sp.Select(orderId, orderType);

                //not found?
                if (sol_Order == null)
                {
                    MessageBox.Show(String.Format("Order #{0} not found!", orderId));
                    continue;
                }


                //marked as paid
                if (onAccount)
                {
                    //search for customer data if its on account
                    Sol_Customer    sol_Customer    = new Sol_Customer();
                    Sol_Customer_Sp sol_Customer_Sp = new Sol_Customer_Sp(Properties.Settings.Default.WsirDbConnectionString);
                    sol_Customer         = sol_Customer_Sp.Select(customerId);
                    sol_Order.CustomerID = customerId;
                    //sol_Order.Name = sol_Customer.Name;
                    //sol_Order.Address1 = sol_Customer.Address1;
                    //sol_Order.Address2 = sol_Customer.Address2;
                    //sol_Order.City = sol_Customer.City;
                    //sol_Order.Province = sol_Customer.Province;
                    //sol_Order.Country = sol_Customer.Country;
                    //sol_Order.PostalCode = sol_Customer.PostalCode;

                    sol_Order.Status = "O"; //O = On account
                    //sol_Order_Sp.Update(sol_Order);
                }
                else
                {
                    sol_Order.DatePaid = Main.rc.FechaActual;
                    sol_Order.Status   = "P"; //paid, processed
                }

                //close order if it is not
                if (sol_Order.DateClosed < sol_Order.Date)
                {
                    sol_Order.DateClosed = Main.rc.FechaActual;
                }


                sol_Order_Sp.Update(sol_Order);

                totalPaidOrders = totalPaidOrders + sol_Order.TotalAmount - sol_Order.FeeAmount;

                //close order if it is not
                if (sol_Order.DateClosed < sol_Order.Date)
                {
                    sol_Order_Sp.UpdateDates(sol_Order.OrderID, sol_Order.OrderType, "", "DateClosed");
                }

                //paid
                if (!onAccount)
                {
                    sol_Order_Sp.UpdateDates(sol_Order.OrderID, sol_Order.OrderType, "", "DatePaid");
                }


                //mark details
                sol_OrdersDetailList = sol_OrdersDetail_Sp._SelectAllByOrderID_OrderType(orderId, orderType);
                foreach (Sol_OrdersDetail od in sol_OrdersDetailList)
                {
                    sol_OrdersDetail        = sol_OrdersDetail_Sp.Select(od.DetailID);
                    sol_OrdersDetail.Status = sol_Order.Status;
                    sol_OrdersDetail_Sp.Update(sol_OrdersDetail);
                }


                if (Main.CardReader_Enabled)
                {
                    UpdateOrderCardLink(orderId);
                }
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (b_Accion == "agregar")
            {
                if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolAddCatalogues", true))
                {
                    return;
                }
            }
            else
            {
                if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolEditCatalogues", true))
                {
                    return;
                }
            }

            //check data
            //name
            fieldNameTextBox.Text = fieldNameTextBox.Text.Trim();
            if (!Funciones.ValidateText(fieldNameTextBox, ref errorProvider1))
            {
                fieldNameTextBox.Focus();
                return;
            }

            //quickdrop
            if (quickDropCustomerCheckBox.Checked)
            {
                //this.Validate();
                //this.BindingSource1.EndEdit();


                //cardNumberTextBox
                if (String.IsNullOrEmpty(cardNumberTextBox.Text))
                {
                    MessageBox.Show("Enter a card number please!");
                    cardNumberTextBox.Focus();
                    return;
                }


                //aqui
                if (formerCardNumber != cardNumberTextBox.Text)
                {
                    if (sol_Customer_Sp == null)
                    {
                        sol_Customer_Sp = new Sol_Customer_Sp(Properties.Settings.Default.WsirDbConnectionString);
                    }

                    sol_Customer = sol_Customer_Sp.SelectByCardNumber(cardNumberTextBox.Text);
                    if (sol_Customer != null)
                    {
                        MessageBox.Show("Card number already used, try another please!");
                        cardNumberTextBox.Focus();
                        return;
                    }
                }
            }


            this.Validate();
            this.BindingSource1.EndEdit();

            this.TableAdapterManager.UpdateAll(this.DataSet1);

            //goto last row
            try
            {
                if (b_Accion == "agregar")
                {
                    this.TableAdapter1.Fill(this.DataSet1.sol_Customers, customerType, textBoxName.Text, activeType);
                    this.BindingSource1.MoveLast();
                }
            }
            catch
            {
                //
            }

            b_Accion    = "";
            OK.Text     = "&Select";
            Cancel.Text = "&Close";

            cambiarVista();
        }