Example #1
0
 public OperationWindow()
 {
     InitializeComponent();
     if (operation_type == 1)
     {
         Text = "Abastecimiento de Inventario";
     }
     else if (operation_type == 2)
     {
         Text = "Ventas";
     }
     sells = SellObj.getAllByOperationTypeId(operation_type);
     foreach (SellObj s in sells)
     {
         thelist.Items.Add("#" + s.id + " - " + s.created_at);
     }
     data.Columns.Add("id", "Id");
     data.Columns.Add("unidad", "Unidad");
     data.Columns.Add("nombre", "Nombre");
     data.Columns.Add("cantidad", "Cantidad");
     data.Columns.Add("precio", "Precio");
     data.Columns.Add("Total", "Total");
     data.Columns[0].Width = 50;
     data.Columns[1].Width = 100;
     data.Columns[2].Width = 350;
     data.Columns[3].Width = 80;
     data.Columns[4].Width = 80;
     data.Columns[5].Width = 80;
 }
 private void button1_Click(object sender, EventArgs e)
 {
     SellObj so = new SellObj();
     so.product_id = int.Parse(id);
     so.q = int.Parse(q.Text);
     SellObj.sell.Add(so);
     Dispose();
 }
        private void button1_Click(object sender, EventArgs e)
        {
            SellObj so = new SellObj();

            so.product_id = int.Parse(id);
            so.q          = int.Parse(q.Text);
            SellObj.sell.Add(so);
            Dispose();
        }
Example #4
0
        public static List<SellObj> getAllByOperationTypeId(int kind)
        {
            List<SellObj> list = new List<SellObj>();
            try
            {
                Connection c = new Connection();
                MySqlCommand cmd = c.con.CreateCommand();
                cmd.CommandText = "select * from sell where operation_type_id=" + kind+" order by created_at desc";
                c.con.Open();
                MySqlDataReader r = cmd.ExecuteReader();
                while (r.Read())
                {
                    SellObj product = new SellObj();
                    product.id = r.GetInt32("id");
                    if (!r.IsDBNull(1))
                    {
                        product.person_id = r.GetInt32("person_id");
                    }
                    else {
                        product.person_id = 0;
                    }

                    if (!r.IsDBNull(4))
                    {
                        product.box_id = r.GetInt32("box_id");
                    }
                    else
                    {
                        product.box_id = 0;
                    }
                    product.operation_type_id = r.GetInt32("operation_type_id");
                    product.created_at = r.GetDateTime("created_at");
                    list.Add(product);
                }
            }
            catch (MySqlException me)
            {

                MessageBox.Show(me.Message);

            }
            return list;
        }
Example #5
0
        public static List <SellObj> getAllByOperationTypeId(int kind)
        {
            List <SellObj> list = new List <SellObj>();

            try
            {
                Connection   c   = new Connection();
                MySqlCommand cmd = c.con.CreateCommand();
                cmd.CommandText = "select * from sell where operation_type_id=" + kind + " order by created_at desc";
                c.con.Open();
                MySqlDataReader r = cmd.ExecuteReader();
                while (r.Read())
                {
                    SellObj product = new SellObj();
                    product.id = r.GetInt32("id");
                    if (!r.IsDBNull(1))
                    {
                        product.person_id = r.GetInt32("person_id");
                    }
                    else
                    {
                        product.person_id = 0;
                    }

                    if (!r.IsDBNull(4))
                    {
                        product.box_id = r.GetInt32("box_id");
                    }
                    else
                    {
                        product.box_id = 0;
                    }
                    product.operation_type_id = r.GetInt32("operation_type_id");
                    product.created_at        = r.GetDateTime("created_at");
                    list.Add(product);
                }
            }
            catch (MySqlException me)
            {
                MessageBox.Show(me.Message);
            }
            return(list);
        }
Example #6
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (product.SelectedIndex ==-1)
     {
         MessageBox.Show("Debes seleccionar un producto");
     }
     else if (q.Text == "")
     {
         MessageBox.Show("Debes introducir una cantidad");
     }
     else {
         int index = product.SelectedIndex;
         data.Rows.Add(prods[index].id, prods[index].unit, prods[index].name,q.Text, prods[index].price_in);
         SellObj s = new SellObj();
         s.product_id = prods[index].id;
         s.q = int.Parse(q.Text);
         SellObj.re.Add(s);
         product.SelectedIndex = -1;
         q.Text = "";
     }
 }
Example #7
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (product.SelectedIndex == -1)
     {
         MessageBox.Show("Debes seleccionar un producto");
     }
     else if (q.Text == "")
     {
         MessageBox.Show("Debes introducir una cantidad");
     }
     else
     {
         int index = product.SelectedIndex;
         data.Rows.Add(prods[index].id, prods[index].unit, prods[index].name, q.Text, prods[index].price_in);
         SellObj s = new SellObj();
         s.product_id = prods[index].id;
         s.q          = int.Parse(q.Text);
         SellObj.re.Add(s);
         product.SelectedIndex = -1;
         q.Text = "";
     }
 }