コード例 #1
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            if (dataGridView1.Rows[e.RowIndex].Cells[1].Value == DBNull.Value)
            {
                return;
            }
            int rowIndex = e.RowIndex;

            int idOSA = Convert.ToInt32(dataGridView1.Rows[rowIndex].Cells[0].Value);


            OSAseleccionada = new osa_gral(idOSA);

            FormOSA_INDIVIDUAL fosaI = new FormOSA_INDIVIDUAL();

            fosaI.osaSeleccionada = OSAseleccionada;
            fosaI.nombreCliente   = clienteSeleccionado.RAZON_SOCIAL;
            fosaI.nombreVendedor  = labelGerente.Text;

            fosaI.ShowDialog();
        }
コード例 #2
0
 private void OENGRALnextId()//siguiente id
 {
     if (idosa == 0)
     {
         OSAGralSeleccionada    = new osa_gral();
         OSAGralSeleccionada.Id = OSAGralSeleccionada.NextID();
         textBoxOENid.Text      = OSAGralSeleccionada.Id.ToString();
     }
 }
コード例 #3
0
 private void resetOSA()//reset
 {
     OENGRALnextId();
     PartidaNextId();
     FACTURA.Text = "";
     comboBoxClientes.SelectedIndex = -1;
     comboVendedor.SelectedIndex    = -1;
     //REMISION.Text = "";
     COTIZACION.Text      = "";
     textBoxProducto.Text = "";
     textBoxCantidad.Text = "1";
     PartidasOSA.Clear();
     OSAGralSeleccionada   = null;
     ProductoSeleccionado2 = null;
     ClienteSeleccionado   = null;
     EmpleadoSeleccionado  = null;
 }
コード例 #4
0
        private void FormOSA_INDIVIDUAL_Load(object sender, EventArgs e)
        {
            if (AccesoInternet() == false)
            {
                MessageBox.Show("No hay internet, intente en un momento"); return;
            }
            if (osaSeleccionada == null)
            {
                osaSeleccionada = new osa_gral();
            }
            osaSeleccionada.MostrarValores(this, false);
            textBoxCliente.Text  = nombreCliente;
            textBoxVendedor.Text = nombreVendedor;

            VerDGV(osaSeleccionada.Id);

            dataGridView1.CellClick += new DataGridViewCellEventHandler(dataGridView1_CellClick);
            if (dataGridView1.RowCount > 0)
            {
                double    sumatoria = 0;
                DataTable sal;
                sumatoria = 0;
                for (int jj = 0; jj < dataGridView1.RowCount - 1; jj++)
                {
                    string a = dataGridView1.Rows[jj].Cells[1].Value.ToString();
                    sal = productos.sumas(dataGridView1.Rows[jj].Cells[1].Value.ToString());
                    string w = dataGridView1.Rows[jj].Cells[3].Value.ToString();
                    try
                    {
                        Convert.ToDouble(sal.Rows[0][0]);
                        sumatoria += Convert.ToDouble(sal.Rows[0][0]) * Convert.ToInt32(dataGridView1.Rows[jj].Cells[3].Value);
                    }
                    catch { }
                }
                txttotal.Text = sumatoria.ToString("#,##0.00");
            }
        }
コード例 #5
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            if (dataGridView1.Rows[e.RowIndex].Cells[1].Value == DBNull.Value)
            {
                return;
            }
            int rowIndex = e.RowIndex;

            int idOSA = Convert.ToInt32(dataGridView1.Rows[rowIndex].Cells[0].Value);

            string nombreCliente  = dataGridView1.Rows[rowIndex].Cells["RAZON_SOCIAL"].Value.ToString();
            string nombreVendedor = dataGridView1.Rows[rowIndex].Cells["VENDEDOR"].Value.ToString();

            OSAseleccionada = new osa_gral(idOSA);

            FormOSA_INDIVIDUAL fosaI = new FormOSA_INDIVIDUAL();

            fosaI.osaSeleccionada = OSAseleccionada;
            fosaI.lista           = lista;
            fosaI.tc             = tc;
            fosaI.nombreCliente  = nombreCliente;
            fosaI.nombreVendedor = nombreVendedor;


            this.Hide();
            fosaI.ShowDialog();
            if (fosaI.DialogResult == DialogResult.OK)
            {
                buttonBuscar.PerformClick();
            }
            this.Show();
        }
コード例 #6
0
        private void ajustarEntradasYsalidas(int ajuste)
        {
            if (AccesoInternet() == false)
            {
                MessageBox.Show("No hay internet, intente en un momento"); return;
            }
            int stockActual = productoSeleccionadoi.STOCK;

            if (stockActual != ajuste)
            {
                if (stockActual > ajuste)
                {
                    int       diferencia = stockActual - ajuste;
                    osa_gral  og         = new osa_gral();
                    osa_indiv oi         = new osa_indiv();
                    og.Id            = og.NextID();
                    og.ID_CLIENTE    = 0;
                    og.FECHA         = DateTime.Now.Date;
                    oi.Id            = oi.NextID();
                    oi.ID_OSAGRAL    = og.Id;
                    oi.ID_PRODUCTO2  = productoSeleccionadoi.Id;
                    oi.QTY2          = diferencia;
                    oi.precioAlmacen = productoSeleccionadoi.PrecioAlmacen;
                    oi.totalItem     = oi.precioAlmacen * oi.QTY2;
                    #region LOOP SALIDAS INVETNARIOCOSTOS
                    inventariocostos invCost = new inventariocostos(oi.ID_PRODUCTO2, "Salida");
                    if (invCost.Id > 0)
                    {
                        if (oi.QTY2 <= invCost.cantidad_actual)
                        {
                            invCost.cantidad_actual -= oi.QTY2;
                            invCost.Update("Id");
                        }
                        else
                        {
                            int Qty = oi.QTY2;
                            Qty -= invCost.cantidad_actual;
                            invCost.cantidad_actual = 0;
                            invCost.Update("Id");
                            while (Qty > 0)
                            {
                                inventariocostos invCost2 = new inventariocostos(oi.ID_PRODUCTO2, "Salida2");
                                if (invCost2.Id > 0)
                                {
                                    if (Qty <= invCost2.cantidad_actual)
                                    {
                                        invCost2.cantidad_actual -= Qty;
                                        invCost2.Update("Id");
                                        Qty = 0;
                                    }
                                    else
                                    {
                                        Qty -= invCost2.cantidad_actual;
                                        invCost2.cantidad_actual = 0;
                                        invCost2.Update("Id");
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("No hay entradas registradas para esta salida");
                                    Qty = 0;
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Este producto no tiene Facturas de compra, Favor de ingresarlas antes de Sacar el Producto");
                    }
                    #endregion LOOP SALIDAS INVETNARIOCOSTOS
generalok:
                    og.Id = og.NextID();
                    og.Insert();
                    if (og.Error != "")
                    {
                        goto generalok;
                    }
individualok:
                    oi.Id         = oi.NextID();
                    oi.ID_OSAGRAL = og.Id;
                    oi.Insert();
                    if (oi.Error != "")
                    {
                        goto individualok;
                    }
                }
                else
                {
                    int diferencia = ajuste - stockActual;

                    oen_gral  og = new oen_gral();
                    oen_indiv oi = new oen_indiv();
                    og.Id           = og.NextID();
                    og.ID_PROVEEDOR = 0;
                    og.FECHA        = DateTime.Now;
                    oi.Id           = oi.NextID();
                    oi.ID_OENGRAL   = og.Id;
                    oi.ID_PRODUCTO  = productoSeleccionadoi.Id;
                    oi.QTY          = diferencia;

generalok:
                    og.Id = og.NextID();
                    og.Insert();
                    if (og.Error != "")
                    {
                        goto generalok;
                    }
individualok:
                    oi.Id         = oi.NextID();
                    oi.ID_OENGRAL = og.Id;
                    oi.Insert();
                    if (oi.Error != "")
                    {
                        goto individualok;
                    }
                }
            }
        }