private bool GuardarOrdenCompraDetalle(int accion) { C_OrdenCompraDetalle objetoOrdenCompraDetalle = new C_OrdenCompraDetalle(); C_OrdenCompra objetoOrdenCompra = new C_OrdenCompra(); objetoOrdenCompra.CodigoProveedor = Int32.Parse(Cmb_I_Ruc.SelectedValue.ToString()); objetoOrdenCompra.NumeroDocumento = Txt_I_NDocumento.Text; objetoOrdenCompraDetalle.CodigoOrdenCompra = _shalong.OrdenCompraCodigo(objetoOrdenCompra); if (accion == 2) { if (!_shalong.OrdenCompraDetalle(2, objetoOrdenCompraDetalle)) { MessageBox.Show("Error al modificar", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Error); } } foreach (DataGridViewRow row in dtg_I_Productos.Rows) { if (row.Cells["Codigo"].Value != null) { objetoOrdenCompraDetalle.CodigoBarras = row.Cells["Codigo"].Value.ToString(); objetoOrdenCompraDetalle.Cantidad = row.Cells["Cantidad"].Value.ToString(); if (_shalong.OrdenCompraDetalle(1, objetoOrdenCompraDetalle)) { MessageBox.Show("Ingreso Detalle Correctamente", "Gestion Ventas", MessageBoxButtons.OK); CargarComboBox(); } else { MessageBox.Show("No Ingreso Detalle Correctamente", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } return(true); }
private void Cmb_EliminarO_SelectionChangeCommitted_1(object sender, EventArgs e) { C_OrdenCompra obj = _shalong.OrdenCompraDocumento1(Int32.Parse(Cmb_EliminarO.SelectedValue.ToString())); textBox3.Text = "" + obj.ReferenciaOrdenCompra; Txt_I_NDocumento.Text = "" + obj.NumeroDocumento; Cmb_I_Ruc.SelectedValue = obj.CodigoProveedor; Txt_I_Observacion.Text = "" + obj.ReferenciaOrdenCompra; dtg_I_Productos.DataSource = _shalong.OrdenCompraProducto(Int32.Parse(Cmb_EliminarO.SelectedValue.ToString())); }
private void Cmb_Documento_SelectionChangeCommitted_1(object sender, EventArgs e) { C_OrdenCompra obj = _shalong.OrdenDocumentoPorFecha1(Int32.Parse(Cmb_Documento.SelectedValue.ToString())); textBox3.Text = "" + obj.ReferenciaOrdenCompra; Txt_I_NDocumento.Text = "" + obj.NumeroDocumento; Cmb_I_Ruc.SelectedValue = obj.CodigoProveedor; Txt_I_Observacion.Text = "" + obj.ReferenciaOrdenCompra; CargarDataGridViewProductosDetalle(); dtg_I_Productos.CommitEdit(DataGridViewDataErrorContexts.Commit); }
private void Cmb_Documentos_SelectionChangeCommitted_1(object sender, EventArgs e) { C_OrdenCompra obj = _shalong.OrdenCompraDocumento1(Int32.Parse(Cmb_Documentos.SelectedValue.ToString())); Cmb_I_Proveedor.SelectedValue = obj.CodigoProveedor; dtg_SG_Compras.AutoGenerateColumns = false; var yourList = _shalong.OrdenCompraProducto(Int32.Parse(Cmb_Documentos.SelectedValue.ToString())); var listBinding = new BindingList <C_OrdenCompraDetalle>(yourList); dtg_SG_Compras.DataSource = listBinding; LimpiarCompras(); dtg_SG_Compras.CommitEdit(DataGridViewDataErrorContexts.Commit); }
//FUNCION GUARDAR private void GuardarOrdenDeCompra() { C_OrdenCompra objetoOrdenCompra = new C_OrdenCompra(); objetoOrdenCompra.CodigoDniUsuario = _codigoUsuario; objetoOrdenCompra.CodigoProveedor = 0; objetoOrdenCompra.ReferenciaOrdenCompra = ""; objetoOrdenCompra.NumeroDocumento = Txt_I_NroDocumento.Text; objetoOrdenCompra.Codigo = Int32.Parse(Cmb_Documentos.SelectedValue.ToString()); if (_shalong.OrdenCompra(3, objetoOrdenCompra)) { MessageBox.Show("La orden de compra se cancelo correctamente", "Gestion Ventas", MessageBoxButtons.OK); CargarComboboxOrdendeCompra(); } else { MessageBox.Show("No se pudo completar la Orden de Compra", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void EliminarOrdenDeCompra() { C_OrdenCompra objetoOrdenCompra = new C_OrdenCompra(); objetoOrdenCompra.Codigo = Int32.Parse(Cmb_EliminarO.SelectedValue.ToString()); objetoOrdenCompra.CodigoProveedor = Int32.Parse(Cmb_I_Ruc.SelectedValue.ToString()); objetoOrdenCompra.NumeroDocumento = Txt_I_NDocumento.Text; objetoOrdenCompra.ReferenciaOrdenCompra = Txt_I_Observacion.Text; if (_shalong.OrdenCompra(3, objetoOrdenCompra)) { MessageBox.Show("Se elimino la orden de compra", "Gestion Ventas", MessageBoxButtons.OK); } else { MessageBox.Show("Error al eliminar", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Error); } CargarComboboxEliminar(); CargarDataGridviewEliminar(); }
private void GuardarOrdenCompra() { int accion = 1; C_OrdenCompra objetoOrdenCompra = new C_OrdenCompra(); objetoOrdenCompra.Codigo = 1; objetoOrdenCompra.CodigoDniUsuario = _codigoDniUsuario; if (Cmb_I_Ruc.SelectedIndex == -1) { MessageBox.Show("Seleccione un Proveedor", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { objetoOrdenCompra.CodigoProveedor = Int32.Parse(Cmb_I_Ruc.SelectedValue.ToString()); } if (date_I_Fecha.Value == null) { MessageBox.Show("Ingrese una fecha", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { objetoOrdenCompra.Fecha = date_I_Fecha.Value; } if (Txt_I_NDocumento.Text == String.Empty) { MessageBox.Show("Ingrese un Numero de Documento", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { objetoOrdenCompra.NumeroDocumento = Txt_I_NDocumento.Text; } if (Txt_I_Observacion.Text == String.Empty) { Txt_I_Observacion.Text = "N/E"; objetoOrdenCompra.ReferenciaOrdenCompra = Txt_I_Observacion.Text; } else { objetoOrdenCompra.ReferenciaOrdenCompra = Txt_I_Observacion.Text; } if (Txt_I_NDocumento.Text == Cmb_Documento.Text) { accion = 2; objetoOrdenCompra.Codigo = Int32.Parse(Cmb_Documento.SelectedValue.ToString()); } if (_shalong.OrdenCompra(accion, objetoOrdenCompra)) { if (GuardarOrdenCompraDetalle(accion)) { MessageBox.Show("Se Ingreso la orden de compra correctamente", "Gestion Ventas", MessageBoxButtons.OK); dtg_I_Productos.DataSource = null; dtg_I_Productos.Refresh(); } else { MessageBox.Show("Revise los Datos del del detalle de la orden de compra", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } else { MessageBox.Show("Revise los Datos", "Gestion Ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } }