private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (AccesoInternet() == false) { MessageBox.Show("No hay internet, intente en un momento"); return; } if (e.RowIndex < 0) { return; } if (dataGridView1.Rows[e.RowIndex].Cells[1].Value == DBNull.Value) { return; } int rowIndex = e.RowIndex; int idOEN = Convert.ToInt32(dataGridView1.Rows[rowIndex].Cells[0].Value); string nombreProveedor = dataGridView1.Rows[rowIndex].Cells["PROVEEDOR"].Value.ToString(); OENseleccionada = new oen_gral(idOEN); FormOEN_INDIVIDUAL foenI = new FormOEN_INDIVIDUAL(); foenI.oenSeleccionada = OENseleccionada; foenI.nombreProvedor = nombreProveedor; this.Hide(); foenI.ShowDialog(); this.Show(); }
// DataTable PartidasOEN = OEN_INDIV.TablaOEN_INDIV().Clone(); private void FormOEN_INDIVIDUAL_Load(object sender, EventArgs e) { if (oenSeleccionada == null) { oenSeleccionada = new oen_gral(); } textBoxFecha.Text = oenSeleccionada.FECHA.ToString("dd/MMMM/yyyy"); textBoxOREP.Text = oenSeleccionada.ID_OREP.ToString(); textBoxOEN.Text = oenSeleccionada.Id.ToString(); textBoxProveedor.Text = nombreProvedor; VerDGV(oenSeleccionada.Id); }
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; } } } }
private void OENGRALnextId()//obtiene el siguiente id { OENGralSeleccionada = new oen_gral(); OENGralSeleccionada.Id = OENGralSeleccionada.NextID(); textBoxOENid.Text = OENGralSeleccionada.Id.ToString(); }