Beispiel #1
0
        public SellDialog()
        {
            InitializeComponent();
            data.Columns.Add("id", "Id");
            data.Columns.Add("cant", "Cant");
            data.Columns.Add("producto", "Producto");
            data.Columns.Add("unidad", "Unidad");
            data.Columns.Add("pu", "Precio Unitario");
            data.Columns.Add("total", "Total");
            data.Columns[0].Width = 50;
            data.Columns[1].Width = 50;
            data.Columns[2].Width = 200;
            data.Columns[3].Width = 100;
            data.Columns[4].Width = 100;
            data.Columns[5].Width = 100;

            lp = PersonObj.getAllByKindId(1);
            foreach (PersonObj p in lp)
            {
                client_.Items.Add(p.name + " " + p.lastname);
            }


            List <SellObj> sell  = SellObj.sell;
            float          total = 0;

            for (int i = 0; i < sell.Count; i++)
            {
                ProductObj product = ProductObj.getById(sell[i].product_id);
                data.Rows.Add(product.id, sell[i].q, product.name, product.unit, product.price_out, sell[i].q * product.price_out);
                total += sell[i].q * product.price_out;
            }
            data.Rows.Add("", "", "Total", "", "", total);
        }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (thelist.SelectedIndex != -1)
     {
         data.Rows.Clear();
         List <OperationObj> ops = OperationObj.getAllBySellId(sells[thelist.SelectedIndex].id);
         float total             = 0;
         foreach (OperationObj op in ops)
         {
             ProductObj p     = ProductObj.getById(op.product_id);
             float      price = 0;
             if (operation_type == 1)
             {
                 price = p.price_in;
             }
             else if (operation_type == 2)
             {
                 price = p.price_out;
             }
             data.Rows.Add(p.id, p.unit, p.name, op.q, price, op.q * price);
             total += op.q * price;
         }
         data.Rows.Add("", "", "Total", "", "", total);
     }
 }
 public ProductObj getProduct()
 {
     return(ProductObj.getById(this.product_id));
 }