private void frmTesoreriaMov_FormClosing(object sender, FormClosingEventArgs e) { if (registroNuevo == lblClave.Text && txtDetalle.Text == string.Empty && txtImporte.Text == string.Empty) { bindingSource1.Remove(bindingSource1.Current); } bindingSource1.EndEdit(); if (tblTesoreriaMov.GetChanges() != null) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string formularioOrigen = "frmTesoreriaMov"; string accionProgress = "grabar"; frmProgress progreso = new frmProgress(dsTesoreriaMov, formularioOrigen, accionProgress); try { progreso.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnAceptar_Click(object sender, EventArgs e) { if(string.IsNullOrEmpty(cmbGenero.Text)){ MessageBox.Show("Debe indicar un género.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbGenero.Focus(); } if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { strFecha = dateTimeDesde.Value.ToString("yyyy-MM-dd"); string genero = cmbGenero.SelectedValue.ToString(); frmProgress frm = new frmProgress(strFecha, "frmArticulosBorradoMasivo", "cargar", genero); frm.ShowDialog(); } catch (NullReferenceException) { return; } }
private void btnAceptar_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cmbGenero.Text)) { MessageBox.Show("Debe indicar un género.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbGenero.Focus(); } if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { strFecha = dateTimeDesde.Value.ToString("yyyy-MM-dd"); string genero = cmbGenero.SelectedValue.ToString(); frmProgress frm = new frmProgress(strFecha, "frmArticulosBorradoMasivo", "cargar", genero); frm.ShowDialog(); } catch (NullReferenceException) { return; } }
private void btnAceptar_Click(object sender, EventArgs e) { string strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd"); string strFechaHasta = dateTimeHasta.Value.ToString("yyyy-MM-dd"); int idEmpleado; if (chkTodos.Checked != true) { idEmpleado = Convert.ToInt32(lstEmpleados.SelectedValue.ToString()); } else { idEmpleado = 0; } int liquidado; if (chkLiquidado.Checked) { liquidado = 1; } else { liquidado = 0; } frmProgress progreso = new frmProgress(strFechaDesde, strFechaHasta, idEmpleado, liquidado, "frmEmpleadosMovConsInter", "cargar"); progreso.ShowDialog(); DataTable tbl = frmProgress.tblEstatica; frmEmpleadosMovCons frmCons = new frmEmpleadosMovCons(tbl); frmCons.Show(); }
void dgvDatos_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (e.ColumnIndex == dgvDatos.Columns["Editar"].Index) { int PK = Convert.ToInt32(dgvDatos.CurrentRow.Cells["IdFondoFONP"].Value.ToString()); frmFondoCaja frm = new frmFondoCaja(dt.Tables[0], PK); frm.fecha = Convert.ToDateTime(dgvDatos.CurrentRow.Cells["FechaFONP"].Value.ToString()); frm.idPc = Convert.ToInt32(dgvDatos.CurrentRow.Cells["IdPcFONP"].Value.ToString()); frm.idLocal = Convert.ToInt32(dgvDatos.CurrentRow.Cells["IdLocalLOC"].Value.ToString()); frm.ShowDialog(); } if (e.ColumnIndex == dgvDatos.Columns["Borrar"].Index) { if (MessageBox.Show("¿Desea borrar este registro?", "Buscar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE BORRARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int PK = Convert.ToInt32(dgvDatos.CurrentRow.Cells["IdFondoFONP"].FormattedValue.ToString()); string formularioOrigen = "frmFondoCajaCons"; string accionProgress = "grabar"; frmProgress progreso = new frmProgress(PK, formularioOrigen, accionProgress, ref bindingSource1); progreso.ShowDialog(); } } }
private void frmFondoCaja_FormClosing(object sender, FormClosingEventArgs e) { if (txtImporte.Text == "") { return; } rowView.EndEdit(); if (tblFondoCaja.GetChanges() != null) { DialogResult respuesta = MessageBox.Show("¿Confirma la grabación de datos?", "Trend Gestión", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); switch (respuesta) { case DialogResult.Yes: if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); tblFondoCaja.RejectChanges(); return; } frmProgress progreso = new frmProgress(tblFondoCaja, "frmFondoCaja", "grabar"); progreso.ShowDialog(); break; case DialogResult.No: break; case DialogResult.Cancel: e.Cancel = true; break; } } }
void dgvDatos_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) return; if (e.ColumnIndex == dgvDatos.Columns["Editar"].Index) { int PK = Convert.ToInt32(dgvDatos.CurrentRow.Cells["IdFondoFONP"].Value.ToString()); frmFondoCaja frm = new frmFondoCaja(dt.Tables[0], PK); frm.fecha = Convert.ToDateTime(dgvDatos.CurrentRow.Cells["FechaFONP"].Value.ToString()); frm.idPc = Convert.ToInt32(dgvDatos.CurrentRow.Cells["IdPcFONP"].Value.ToString()); frm.idLocal = Convert.ToInt32(dgvDatos.CurrentRow.Cells["IdLocalLOC"].Value.ToString()); frm.ShowDialog(); } if (e.ColumnIndex == dgvDatos.Columns["Borrar"].Index) { if (MessageBox.Show("¿Desea borrar este registro?", "Buscar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE BORRARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int PK = Convert.ToInt32(dgvDatos.CurrentRow.Cells["IdFondoFONP"].FormattedValue.ToString()); string formularioOrigen = "frmFondoCajaCons"; string accionProgress = "grabar"; frmProgress progreso = new frmProgress(PK, formularioOrigen, accionProgress, ref bindingSource1); progreso.ShowDialog(); } } }
private void btnAceptar_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cmbGenero.Text)) { MessageBox.Show("Debe indicar un género.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbGenero.Focus(); } try { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } strFecha = dateTimeDesde.Value.ToString("yyyy-MM-dd"); string genero = cmbGenero.SelectedValue.ToString(); frmProgress frm = new frmProgress(strFecha, "frmPedido", "cargar", genero); frm.ShowDialog(); tblPedidos = frmProgress.dtEstatico.Tables[0]; tblPedidos.AcceptChanges(); PedidoRpt frmPedido = new PedidoRpt(tblPedidos); frmPedido.Show(); } catch (NullReferenceException) { return; } }
private void frmVentasPesosCons_Load(object sender, EventArgs e) { foreach (DataRowView filaLocal in lstLocales.SelectedItems) { idLocal = filaLocal.Row[0].ToString(); strLocales += "IdLocalLOC LIKE '" + idLocal + "' OR "; } strLocales = strLocales.Substring(0, strLocales.Length - 4); progreso = new frmProgress(forma, fechaDesde, fechaHasta, strLocales, formularioOrigen, accionProgress); progreso.ShowDialog(); try { dataGridView1.DataSource = frmProgress.dsVentasPesosCons.Tables[0]; } catch(Exception) { Close(); return; } dataGridView1.AutoGenerateColumns = true; dataGridView1.AllowUserToAddRows = false; dataGridView1.Columns["Venta"].DefaultCellStyle.Format = "C0"; dataGridView1.Columns["Costo"].DefaultCellStyle.Format = "C0"; dataGridView1.Columns["Utilidad bruta"].DefaultCellStyle.Format = "C0"; dataGridView1.Columns["Valor agregado"].DefaultCellStyle.Format = "0\\%"; }
private void btnAceptar_Click(object sender, EventArgs e) { if (lstPc.SelectedValue == null) { MessageBox.Show("Debe seleccionar un nro de caja.", "Trend Gestión"); return; } if (txtImporte.Text == "") return; rowView.EndEdit(); if (tblFondoCaja.GetChanges() != null) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); tblFondoCaja.RejectChanges(); return; } frmProgress progreso = new frmProgress(tblFondoCaja, "frmFondoCaja", "grabar"); progreso.ShowDialog(); tblFondoCaja.AcceptChanges(); Close(); } }
private void btnAceptar_Click(object sender, EventArgs e) { if(string.IsNullOrEmpty(cmbGenero.Text)){ MessageBox.Show("Debe indicar un género.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbGenero.Focus(); } try { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } strFecha = dateTimeDesde.Value.ToString("yyyy-MM-dd"); string genero = cmbGenero.SelectedValue.ToString(); frmProgress frm = new frmProgress(strFecha, "frmPedido", "cargar", genero); frm.ShowDialog(); tblPedidos = frmProgress.dtEstatico.Tables[0]; tblPedidos.AcceptChanges(); PedidoRpt frmPedido = new PedidoRpt(tblPedidos); frmPedido.Show(); } catch (NullReferenceException) { return; } }
private void btnAceptar_Click(object sender, EventArgs e) { if (lstPc.SelectedValue == null) { MessageBox.Show("Debe seleccionar un nro de caja.", "Trend Gestión"); return; } if (txtImporte.Text == "") { return; } rowView.EndEdit(); if (tblFondoCaja.GetChanges() != null) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); tblFondoCaja.RejectChanges(); return; } frmProgress progreso = new frmProgress(tblFondoCaja, "frmFondoCaja", "grabar"); progreso.ShowDialog(); tblFondoCaja.AcceptChanges(); Close(); } }
private void frmArticulosGenerar_FormClosing(object sender, FormClosingEventArgs e) { if (tblArticulos.GetChanges() != null) { frmProgress progreso = new frmProgress(tblArticulos, "frmArticulosGenerar", "grabar"); progreso.ShowDialog(); } }
private void btnAceptar_Click(object sender, EventArgs e) { string whereLocales = null; string articulo = ""; string descripcion = ""; Cursor.Current = Cursors.WaitCursor; string idLocal; foreach (DataRowView filaLocal in lstLocales.SelectedItems) { idLocal = filaLocal.Row[0].ToString(); whereLocales += "IdLocalSTK LIKE '" + idLocal + "' OR "; } whereLocales = whereLocales.Substring(0, whereLocales.Length - 4); if (rdArticulo.Checked == true) { articulo = txtParametros.Text; } else { descripcion = txtParametros.Text; } string origen = "frmStock"; string accion = "cargar"; frmProgress newMDIChild = new frmProgress(origen, accion, whereLocales, proveedor, articulo, descripcion); newMDIChild.ShowDialog(); tblStock = frmProgress.dtEstatico.Tables[0]; if (rdPantalla.Checked == true) { try { DataColumn columnaPivot = tblStock.Columns["NombreLOC"]; DataColumn valorPivot = tblStock.Columns["Cantidad"]; dtCruzada = BL.Utilitarios.Pivot(tblStock, columnaPivot, valorPivot); } catch { if (whereLocales == null) { MessageBox.Show("Debe seleccionar un local.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se encontraron artículos coincidentes", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); } return; } } else { } frmStockInforme stockInforme = new frmStockInforme(dtCruzada); stockInforme.ShowDialog(); Cursor.Current = Cursors.Arrow; }
private void btnGrabar_Click(object sender, EventArgs e) { bindingSource1.EndEdit(); if (tblEmpleadosMov.GetChanges() != null) { frmProgress progreso = new frmProgress(tblEmpleadosMov, "frmEmpleadosMov", "grabar"); progreso.ShowDialog(); } }
private void Grabar() { DataRow row = tblArticulos.Rows.Find(txtIdArticulo.Text); row["RazonSocialPRO"] = cmbProveedor.Text; frmProgress progreso = new frmProgress(tblArticulos, "frmArticulos", "grabar"); progreso.ShowDialog(); }
private void Grabar() { if (tblArticulos.GetChanges() != null) { // bindingSource1.MoveLast(); frmProgress progreso = new frmProgress(tblArticulos, "frmArticulos", "grabar"); progreso.ShowDialog(); btnGrabar.Enabled = false; } }
private void btnAceptar_Click(object sender, EventArgs e) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DataRow selectedDataRow = ((DataRowView)lstLocales.SelectedItem).Row; int idLocal = Convert.ToInt32(selectedDataRow["IdLocalLOC"]); string strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00"); string strFechaHasta = dateTimeHasta.Value.ToString("yyyy-MM-dd 00:00:00"); if (rdDetalle.Checked == true) //informe detalle { try { string tipoMov = "compensaciones"; string opcMov = "entradas"; string articulo = string.Empty; string descripcion = string.Empty; if (rdArticulo.Checked) articulo = txtParametros.Text; else descripcion = txtParametros.Text; string formularioOrigen = "frmStockMovInforme"; string accionProgress = "cargar"; frmProgress progreso = new frmProgress(strFechaDesde, strFechaHasta, idLocal, tipoMov, opcMov, formularioOrigen, accionProgress, articulo, descripcion); progreso.ShowDialog(); DataSet dsStockMov = frmProgress.dsStockMovCons; frmStockMovInforme frm = new frmStockMovInforme(dsStockMov, tipoMov, articulo, descripcion); frm.Show(); } catch (NullReferenceException) { return; } } else // informe en pesos { try { frmProgress frm = new frmProgress(strFechaDesde, strFechaHasta, idLocal, "frmStockCompPesos", "cargar"); frm.ShowDialog(); DataTable tblStockCompPesos = frmProgress.tblEstatica; strFechaDesde = dateTimeDesde.Value.ToShortDateString(); strFechaHasta = dateTimeHasta.Value.ToShortDateString(); StockCompPesosRpt frmStockComp = new StockCompPesosRpt(tblStockCompPesos, strFechaDesde, strFechaHasta); frmStockComp.Show(); } catch (NullReferenceException) { return; } } }
private void frmEmpleadosMov_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = false; // bindingSource1.EndEdit(); if (tblEmpleadosMov.GetChanges() != null) { frmProgress progreso = new frmProgress(tblEmpleadosMov, "frmEmpleadosMov", "grabar"); progreso.ShowDialog(); } bindingSource1.RemoveFilter(); }
void ActualizarArqueo() { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } frmProgress frm = new frmProgress(fecha, idLocal, nombreLocal, idPc, "frmArqueoInter", "cargar", frmInstanciaArqueo); frm.ShowDialog(); }
private void actualizarDatosToolStripMenuItem_Click(object sender, EventArgs e) { if (!BL.Utilitarios.ValidarServicioMysql()) { string mensaje = "No se pudo establecer la conexión con el servidor de base de datos." + '\r' + "No se actualizaron los datos."; MessageBox.Show(this, mensaje, "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } frmProgress frm = new frmProgress("ActualizarDatos", "grabar"); frm.ShowDialog(); }
private void btnAceptar_Click(object sender, EventArgs e) { if (lstLocales.SelectedIndex == -1) { MessageBox.Show("Debe seleccionar un local.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!BL.Utilitarios.ValidarServicioMysql()) { string mensaje = "No se pudo establecer la conexión con el servidor de base de datos."; MessageBox.Show(this, mensaje, "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (rdTotales.Checked) { strLocales = string.Empty; forma = Convert.ToInt32(cmbForma.SelectedValue.ToString()); strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00"); dtFechaHasta = dateTimeHasta.Value.AddDays(1); strFechaHasta = dtFechaHasta.ToString("yyyy-MM-dd 00:00:00"); foreach (DataRowView filaLocal in lstLocales.SelectedItems) { idLocal = filaLocal.Row[0].ToString(); strLocales += "IdLocalLOC LIKE '" + idLocal + "' OR "; } strLocales = strLocales.Substring(0, strLocales.Length - 4); progreso = new frmProgress(forma, strFechaDesde, strFechaHasta, strLocales, "frmVentasPesosCons", "cargar"); progreso.ShowDialog(); DataTable tblVentasPesos = frmProgress.dsVentasPesosCons.Tables[0]; frmVentasPesosCons frm = new frmVentasPesosCons(tblVentasPesos); frm.Show(); } else { string origen = "frmVentasPesosInter_diarias"; string accion = "cargar"; string fecha_desde = dateTimeDesde.Value.ToString("yyyy-MM-dd"); dtFechaHasta = dateTimeHasta.Value.AddDays(1); string fecha_hasta = dtFechaHasta.ToString("yyyy-MM-dd"); int local = Convert.ToInt32(lstLocales.SelectedValue.ToString()); string formaPago = cmbForma.Text; frmProgress newMDIChild = new frmProgress(fecha_desde, fecha_hasta, local, formaPago, origen, accion); newMDIChild.ShowDialog(); DataTable tblVentasDiarias = frmProgress.tblEstatica; fecha_desde = dateTimeDesde.Value.ToString("dd-MM-yyyy"); fecha_hasta = dateTimeHasta.Value.ToString("dd-MM-yyyy"); string nombreLocal = lstLocales.Text; frmVentasPesosDiarias frmDiarias = new frmVentasPesosDiarias(tblVentasDiarias, fecha_desde, fecha_hasta, nombreLocal); frmDiarias.Show(); } }
private void frmArticulosGenerarApartir_FormClosing(object sender, FormClosingEventArgs e) { if (tblArticulos.GetChanges() != null) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE CREARON LOS ARTICULOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); tblArticulos.RejectChanges(); return; } frmProgress progreso = new frmProgress(tblArticulos, "frmArticulosGenerar", "grabar"); progreso.ShowDialog(); } }
private void btnAceptar_Click(object sender, EventArgs e) { if(lstLocales.SelectedIndex == -1) { MessageBox.Show("Debe seleccionar un local.", "Trend",MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (rdTotales.Checked) { strLocales = string.Empty; forma = Convert.ToInt32(cmbForma.SelectedValue.ToString()); strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00"); dtFechaHasta = dateTimeHasta.Value.AddDays(1); strFechaHasta = dtFechaHasta.ToString("yyyy-MM-dd 00:00:00"); foreach (DataRowView filaLocal in lstLocales.SelectedItems) { idLocal = filaLocal.Row[0].ToString(); strLocales += "IdLocalLOC LIKE '" + idLocal + "' OR "; } strLocales = strLocales.Substring(0, strLocales.Length - 4); progreso = new frmProgress(forma, strFechaDesde, strFechaHasta, strLocales, "frmVentasPesosCons", "cargar"); progreso.ShowDialog(); DataTable tblVentasPesos = frmProgress.dsVentasPesosCons.Tables[0]; frmVentasPesosCons frm = new frmVentasPesosCons(tblVentasPesos); frm.Show(); } else { string origen = "frmVentasPesosInter_diarias"; string accion = "cargar"; string fecha_desde = dateTimeDesde.Value.ToString("yyyy-MM-dd"); dtFechaHasta = dateTimeHasta.Value.AddDays(1); string fecha_hasta = dtFechaHasta.ToString("yyyy-MM-dd"); int local = Convert.ToInt32(lstLocales.SelectedValue.ToString()); string formaPago = cmbForma.Text; frmProgress newMDIChild = new frmProgress(fecha_desde, fecha_hasta, local, formaPago, origen, accion); newMDIChild.ShowDialog(); DataTable tblVentasDiarias = frmProgress.tblEstatica; fecha_desde = dateTimeDesde.Value.ToString("dd-MM-yyyy"); fecha_hasta = dateTimeHasta.Value.ToString("dd-MM-yyyy"); string nombreLocal = lstLocales.Text; frmVentasPesosDiarias frmDiarias = new frmVentasPesosDiarias(tblVentasDiarias, fecha_desde, fecha_hasta, nombreLocal); frmDiarias.Show(); } }
private void button4_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; string Connection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Benja\\Desktop\\liquidacion.xlsx;Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\";"; OleDbConnection con = new OleDbConnection(Connection); System.Data.DataTable tblPrecioNuevos = new System.Data.DataTable(); OleDbDataAdapter myCommand = new OleDbDataAdapter("select * from [Hoja1$]", con); myCommand.Fill(tblPrecioNuevos); DataTable tblArticulos = BL.GetDataBLL.Articulos(); foreach (DataRow rowPreciosNuevos in tblPrecioNuevos.Rows) { string articulo = rowPreciosNuevos["Articulo"].ToString(); if (!string.IsNullOrEmpty(articulo)) { if (articulo.Length == 8) { articulo = "00" + articulo; } if (articulo.Length == 9) { articulo = "0" + articulo; } // articulo = rowPreciosNuevos["Articulo"].ToString().Substring(0, rowPreciosNuevos["Articulo"].ToString().Length - 4); articulo = articulo.Substring(0, articulo.Length - 4); DataRow[] foundRow = tblArticulos.Select("IdArticuloART LIKE '" + articulo + "*'"); foreach (DataRow rowArticulos in foundRow) { if (!string.IsNullOrEmpty(rowPreciosNuevos["Makro"].ToString()) && !string.IsNullOrEmpty(rowPreciosNuevos["Jesus"].ToString())) { rowArticulos["PrecioPublicoART"] = rowPreciosNuevos["Makro"]; rowArticulos["PrecioMayorART"] = rowPreciosNuevos["Jesus"]; } } } } if (tblArticulos.GetChanges() != null) { frmProgress progreso = new frmProgress(tblArticulos, "frmArticulosGenerar", "grabar"); progreso.ShowDialog(); } Cursor.Current = Cursors.Arrow; }
private void frmCondicionIva_FormClosing(object sender, FormClosingEventArgs e) { bindingSource1.EndEdit(); if (tblCondicionIva.GetChanges() != null) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); tblCondicionIva.RejectChanges(); return; } frmProgress progreso = new frmProgress(tblCondicionIva, "frmCondicionIva", "grabar"); progreso.ShowDialog(); } bindingSource1.RemoveFilter(); }
private void importarDatosActualesToolStripMenuItem_Click(object sender, EventArgs e) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } frmProgress frm = new frmProgress("ImportarDatos", "grabar", true); try { frm.ShowDialog(); } catch (WebException) { MessageBox.Show("No se pudo establecer conexión con el servidor remoto. No se actualizaron los datos.", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnBorrar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(articulo) || !string.IsNullOrEmpty(descripcion)) { MessageBox.Show("Las opciones 'Modificar' y/o 'Borrar' no están disponibles cuando se usaron criterios de búsqueda", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (dsStockMov.Tables[0].Rows.Count == 0) { return; } if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend Gestión", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE BORRARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Cursor.Current = Cursors.WaitCursor; PK = Convert.ToInt32(dgvStockMov.CurrentRow.Cells["IdMovMSTK"].Value.ToString()); progreso = new frmProgress(PK, "frmStockMov_borrar", "grabar"); progreso.ShowDialog(); if (codigoError != null) { Close(); return; } viewStockMov.RowFilter = "IdMovMSTK = '" + PK + "'"; foreach (DataRowView row in viewStockMov) { row.Delete(); } tblStockMov.AcceptChanges(); Cursor.Current = Cursors.Arrow; } }
private void Grabar() { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS PRECIOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); tblArticulos.RejectChanges(); return; } foreach (DataGridViewRow row in dgvDatos.Rows) { if (row.Cells["Actualizar"].Value != null) { if (row.Cells["Actualizar"].Value.ToString() == "1") { DataRowView[] foundRows = viewNuevos.FindRows(new object[] { row.Cells["IdArticuloART"].Value.ToString() }); foundRows[0].BeginEdit(); if (!String.IsNullOrEmpty(txtCosto.Text)) { foundRows[0]["PrecioCostoART"] = txtCosto.Text; } if (!String.IsNullOrEmpty(txtPublico.Text)) { foundRows[0]["PrecioPublicoART"] = txtPublico.Text; } if (!String.IsNullOrEmpty(txtMayor.Text)) { foundRows[0]["PrecioMayorART"] = txtMayor.Text; } foundRows[0].EndEdit(); } } } if (tblArticulos.GetChanges() != null) { frmProgress progreso = new frmProgress(tblArticulos, "frmArticulos", "grabar"); progreso.ShowDialog(); } }
private void btnAgrupar_Click(object sender, EventArgs e) { frmProgress frm = new frmProgress("frmArticulosAgrupar", "cargar"); try { frm.ShowDialog(); if (frm.servidorCaidoExcepcion != null) { MessageBox.Show(frm.servidorCaidoExcepcion.Message, "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { frm.Close(); } }
private void btnAceptar_Click(object sender, EventArgs e) { if (lstLocales.SelectedIndex == -1) { MessageBox.Show("Debe seleccionar un local.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(cmbForma.Text)) { MessageBox.Show("Debe seleccionar una forma de pago.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int forma = Convert.ToInt32(cmbForma.SelectedValue.ToString()); string strDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00"); DateTime hasta = dateTimeHasta.Value; string strHasta = hasta.AddDays(1).ToString("yyyy-MM-dd 00:00:00"); int idLocal = Convert.ToInt32(lstLocales.SelectedValue.ToString()); string parametros = txtParametros.Text; frmProgress frm = new frmProgress(forma, strDesde, strHasta, idLocal, "frmVentasDetalleInter", "cargar", parametros); frm.ShowDialog(); DataTable tblVentasDetalleCons = frmProgress.tblEstatica; string nombreLocal = lstLocales.Text; VentasDetalleRpt ventas = new VentasDetalleRpt(tblVentasDetalleCons, nombreLocal); ventas.Show(); } catch (NullReferenceException) { return; } }
private void btnAceptar_Click(object sender, EventArgs e) { string strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd"); string strFechaHasta = dateTimeHasta.Value.ToString("yyyy-MM-dd"); int idEmpleado; if (chkTodos.Checked != true) { idEmpleado = Convert.ToInt32(lstEmpleados.SelectedValue.ToString()); } else { idEmpleado = 0; } int liquidado; if (chkLiquidado.Checked) liquidado = 1; else liquidado = 0; frmProgress progreso = new frmProgress(strFechaDesde, strFechaHasta, idEmpleado, liquidado, "frmEmpleadosMovConsInter", "cargar"); progreso.ShowDialog(); DataTable tbl = frmProgress.tblEstatica; frmEmpleadosMovCons frmCons = new frmEmpleadosMovCons(tbl); frmCons.Show(); }
private void btnBorrar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(articulo) || !string.IsNullOrEmpty(descripcion)) { MessageBox.Show("Las opciones 'Modificar' y/o 'Borrar' no están disponibles cuando se usaron criterios de búsqueda", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (dsStockMov.Tables[0].Rows.Count == 0) return; if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend Gestión", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE BORRARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Cursor.Current = Cursors.WaitCursor; PK = Convert.ToInt32(dgvStockMov.CurrentRow.Cells["IdMovMSTK"].Value.ToString()); progreso = new frmProgress(PK, "frmStockMov_borrar", "grabar"); progreso.ShowDialog(); if (codigoError != null) { Close(); return; } viewStockMov.RowFilter = "IdMovMSTK = '" + PK + "'"; foreach (DataRowView row in viewStockMov) { row.Delete(); } tblStockMov.AcceptChanges(); Cursor.Current = Cursors.Arrow; } }
private void btnAceptar_Click(object sender, EventArgs e) { if (lstLocales.SelectedIndex == -1) { MessageBox.Show("Debe seleccionar un local.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string whereLocales = null; string articulo = ""; string descripcion = ""; int activoWeb = 0; Cursor.Current = Cursors.WaitCursor; string idLocal; foreach (DataRowView filaLocal in lstLocales.SelectedItems) { idLocal = filaLocal.Row[0].ToString(); whereLocales += "IdLocalSTK LIKE '" + idLocal + "' OR "; } whereLocales = whereLocales.Substring(0, whereLocales.Length - 4); string genero; if (!string.IsNullOrEmpty(cmbGenero.Text)) genero = cmbGenero.SelectedValue.ToString(); else genero = string.Empty; proveedor = Convert.ToInt32(cmbProveedor.SelectedValue); if (rdArticulo.Checked == true) { articulo = txtParametros.Text; } else { descripcion = txtParametros.Text; } if (chkActivo.Checked == true) { activoWeb = 1; } DataTable sortedDT; DataView dv; try { string origen = "frmStock"; string accion = "cargar"; frmProgress newMDIChild = new frmProgress(origen, accion, whereLocales, genero, proveedor, articulo, descripcion, activoWeb); newMDIChild.ShowDialog(); tblStock = frmProgress.dtEstatico.Tables[0]; // Ordeno por NombreLOC para que aparezcan ordenadas las columnas local en el informe de stock dv = tblStock.DefaultView; dv.Sort = "NombreLOC asc"; sortedDT = dv.ToTable(); } catch (NullReferenceException) { return; } DataColumn columnaPivot = tblStock.Columns["NombreLOC"]; DataColumn valorPivot = tblStock.Columns["Cantidad"]; dtCruzada = BL.Utilitarios.Pivot(sortedDT, columnaPivot, valorPivot); dv = dtCruzada.DefaultView; dv.Sort = "Descripcion asc"; if (rdPantalla.Checked == true) { try { frmStockInforme stockInforme = new frmStockInforme(dv); stockInforme.Show(); } catch { if (whereLocales == null) { MessageBox.Show("Debe seleccionar un local.", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se encontraron artículos coincidentes", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information); } return; } } else { StockRpt rpt = new StockRpt(tblStock); rpt.ShowDialog(); } Cursor.Current = Cursors.Arrow; }
private void importarDatosToolStripMenuItem_Click(object sender, EventArgs e) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } frmProgress frm = new frmProgress("ImportarDatos", "grabar", false); try { frm.ShowDialog(); } catch (WebException) { MessageBox.Show("No se pudo establecer conexión con el servidor remoto. No se actualizaron los datos.", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAgrupar_Click(object sender, EventArgs e) { if (dgvDatosOrigen.Rows.Count == 0) { MessageBox.Show("Debe indicar un artículo de origen", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); txtParametrosOrigen.Focus(); return; } if (dgvDatosDestino.Rows.Count == 0) { MessageBox.Show("Debe indicar un artículo de destino", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); txtParametrosDestino.Focus(); return; } if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); tblArticulos.RejectChanges(); return; } if (MessageBox.Show("La agrupación de artículos eliminará los artículos de origen. ¿Desea continuar?", "Trend", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) return; Cursor.Current = Cursors.WaitCursor; DataView viewStock = new DataView(tblStock); DataView viewArticulos = new DataView(tblArticulos); DataTable tblLocales = BL.GetDataBLL.Locales(); DataView viewLocales = new DataView(tblLocales); viewLocales.RowFilter = "IdLocalLOC <> 1 AND IdLocalLOC <> 2"; string articuloDestino = dgvDatosDestino.CurrentRow.Cells["IdArticuloART"].Value.ToString(); int cantidadArticulos = 0; int cantidadDestino = 0; ArrayList articulosBorrar = new ArrayList(); foreach (DataGridViewRow rowOrigen in dgvDatosOrigen.Rows) { if (rowOrigen.Cells["Agrupar"].Value != null) { if (rowOrigen.Cells["Agrupar"].Value.ToString() == "1") { string articuloOrigen = rowOrigen.Cells["IdArticuloART"].Value.ToString(); foreach (DataRowView rowLocales in viewLocales) { string local = rowLocales["IdLocalLOC"].ToString(); if (local != "1" && local != "2") { viewStock.RowFilter = "IdLocalSTK = '" + local + "' AND IdArticuloSTK = '" + articuloOrigen + "'"; int cantidadOrigen = Convert.ToInt32(viewStock[0]["CantidadSTK"].ToString()); viewStock.RowFilter = "IdLocalSTK = '" + local + "' AND IdArticuloSTK = '" + articuloDestino + "'"; if (viewStock.Count > 0) { cantidadDestino = Convert.ToInt32(viewStock[0]["CantidadSTK"].ToString()); viewStock[0]["CantidadSTK"] = cantidadOrigen + cantidadDestino; } else // no existe el registro en la tabla stock. Lo agrego { DataRowView rowView = viewStock.AddNew(); rowView["IdArticuloSTK"] = articuloDestino; rowView["IdLocalSTK"] = local; rowView["CantidadSTK"] = cantidadOrigen; rowView.EndEdit(); } } } articulosBorrar.Add(articuloOrigen); // agrego los articulos agrupados para luego borrarlos } cantidadArticulos++; } } if (cantidadArticulos == 0) { MessageBox.Show("Debe seleccionar un artículo de origen", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } // borro los articulos agrupados foreach (string borrado in articulosBorrar) { DataRow[] found = tblArticulos.Select("IdArticuloART = '" + borrado + "'"); found[0].Delete(); } //Actualizo el viewOrigen para reflejar los cambios en pantalla foreach (string borrado in articulosBorrar) { DataRow[] found = tblArticulosStock.Select("IdArticuloART = '" + borrado + "'"); found[0].Delete(); } Cursor.Current = Cursors.Arrow; if(tblArticulos.GetChanges() != null) { frmProgress frm = new frmProgress(tblArticulos, tblStock, "frmArticulosAgrupar", "grabar", instanciaArticulosAgrupar); frm.FormClosed += frmProgress_FormClosed; frm.ShowDialog(); } }
private void btnAceptar_Click(object sender, EventArgs e) { if (lstLocales.SelectedIndex == -1) { MessageBox.Show("Debe seleccionar un local.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string whereLocales = null; string articulo = ""; string descripcion = ""; int activoWeb = 0; Cursor.Current = Cursors.WaitCursor; string idLocal; foreach (DataRowView filaLocal in lstLocales.SelectedItems) { idLocal = filaLocal.Row[0].ToString(); whereLocales += "IdLocalSTK LIKE '" + idLocal + "' OR "; } whereLocales = whereLocales.Substring(0, whereLocales.Length - 4); string genero; if (!string.IsNullOrEmpty(cmbGenero.Text)) { genero = cmbGenero.SelectedValue.ToString(); } else { genero = string.Empty; } proveedor = Convert.ToInt32(cmbProveedor.SelectedValue); if (rdArticulo.Checked == true) { articulo = txtParametros.Text; } else { descripcion = txtParametros.Text; } if (chkActivo.Checked == true) { activoWeb = 1; } DataTable sortedDT; DataView dv; try { string origen = "frmStock"; string accion = "cargar"; frmProgress newMDIChild = new frmProgress(origen, accion, whereLocales, genero, proveedor, articulo, descripcion, activoWeb); newMDIChild.ShowDialog(); tblStock = frmProgress.dtEstatico.Tables[0]; // Ordeno por NombreLOC para que aparezcan ordenadas las columnas local en el informe de stock dv = tblStock.DefaultView; dv.Sort = "NombreLOC asc"; sortedDT = dv.ToTable(); } catch (NullReferenceException) { return; } DataColumn columnaPivot = tblStock.Columns["NombreLOC"]; DataColumn valorPivot = tblStock.Columns["Cantidad"]; dtCruzada = BL.Utilitarios.Pivot(sortedDT, columnaPivot, valorPivot); dv = dtCruzada.DefaultView; dv.Sort = "Descripcion asc"; if (rdPantalla.Checked == true) { try { frmStockInforme stockInforme = new frmStockInforme(dv); stockInforme.Show(); } catch { if (whereLocales == null) { MessageBox.Show("Debe seleccionar un local.", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se encontraron artículos coincidentes", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information); } return; } } else { StockRpt rpt = new StockRpt(tblStock); rpt.ShowDialog(); } Cursor.Current = Cursors.Arrow; }
private void btnAceptar_Click(object sender, EventArgs e) { if (lstLocales.SelectedIndex == -1) { MessageBox.Show("Debe seleccionar un local.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (rdTotales.Checked) { strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00"); dtFechaHasta = dateTimeHasta.Value.AddDays(1); strFechaHasta = dtFechaHasta.ToString("yyyy-MM-dd 00:00:00"); forma = Convert.ToInt32(cmbForma.SelectedValue.ToString()); string genero; if (!string.IsNullOrEmpty(cmbGenero.Text)) { genero = cmbGenero.SelectedValue.ToString(); } else { genero = string.Empty; } strLocales = string.Empty; foreach (DataRowView filaLocal in lstLocales.SelectedItems) { idLocal = filaLocal.Row[0].ToString(); strLocales += "IdLocalLOC LIKE '" + idLocal + "' OR "; } strLocales = strLocales.Substring(0, strLocales.Length - 4); progreso = new frmProgress(forma, strFechaDesde, strFechaHasta, strLocales, "frmVentasPesosCons", "cargar", genero); progreso.ShowDialog(); try { DataTable tblVentasPesos = frmProgress.dsVentasPesosCons.Tables[0]; frmVentasPesosCons frm = new frmVentasPesosCons(tblVentasPesos); frm.Show(); } catch (NullReferenceException) { MessageBox.Show("El servidor de base de datos no respondió a la solicitud. Intente nuevamente.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { string origen = "frmVentasPesosInter_diarias"; string accion = "cargar"; string fecha_desde = dateTimeDesde.Value.ToString("yyyy-MM-dd"); dtFechaHasta = dateTimeHasta.Value.AddDays(1); string fecha_hasta = dtFechaHasta.ToString("yyyy-MM-dd"); int local = Convert.ToInt32(lstLocales.SelectedValue.ToString()); string forma = cmbForma.Text; frmProgress newMDIChild = new frmProgress(fecha_desde, fecha_hasta, local, forma, origen, accion); newMDIChild.ShowDialog(); DataTable tblVentasDiarias = frmProgress.tblEstatica; fecha_desde = dateTimeDesde.Value.ToString("dd-MM-yyyy"); fecha_hasta = dateTimeHasta.Value.ToString("dd-MM-yyyy"); string nombreLocal = lstLocales.Text; frmVentasPesosDiarias frmDiarias = new frmVentasPesosDiarias(tblVentasDiarias, fecha_desde, fecha_hasta, nombreLocal); frmDiarias.Show(); } }
private void btnBorrar_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; ArrayList articulosBorrar = new ArrayList(); foreach (DataGridViewRow rowOrigen in dgvDatos.Rows) { if (rowOrigen.Cells["Borrar"].Value != null) { if (rowOrigen.Cells["Borrar"].Value.ToString() == "1") { string articuloOrigen = rowOrigen.Cells["IdArticuloART"].Value.ToString(); articulosBorrar.Add(articuloOrigen); // agrego los articulos agrupados para luego borrarlos } } } if (articulosBorrar.Count > 0) { if (MessageBox.Show( "Si elimina este artículo/s, se eliminarán las ventas, movimientos de stock y stock relacionados. ¿Desea continuar?", "Trend", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string oldBorrado = string.Empty; string imagenesBorrar = string.Empty; viewArticulos = new DataView(tblArticulos); foreach (string borrado in articulosBorrar) { viewArticulos.RowFilter = "IdArticuloART = '" + borrado + "'"; viewArticulos[0].Delete(); if (string.IsNullOrEmpty(oldBorrado)) { imagenesBorrar += borrado.Substring(0, borrado.Length - 2) + ";"; oldBorrado = borrado; } else { if (oldBorrado.Substring(0, oldBorrado.Length - 2) != borrado.Substring(0, borrado.Length - 2)) { imagenesBorrar += borrado.Substring(0, borrado.Length - 2) + ";"; oldBorrado = borrado; } } } foreach (string borrado in articulosBorrar) { viewArticulosBorrar.RowFilter = "IdArticuloART = '" + borrado + "'"; viewArticulosBorrar[0].Delete(); } if (rdArticulo.Checked == true) { viewArticulosBorrar.RowFilter = "IdArticuloART LIKE '" + txtParametros.Text + "*'"; } else { viewArticulosBorrar.RowFilter = "DescripcionART LIKE '*" + txtParametros.Text + "*'"; } if (tblArticulos.GetChanges() != null) { frmProgress frm = new frmProgress(tblArticulos, "frmArticulosBorrar", "grabar", imagenesBorrar); frm.ShowDialog(); } } } Cursor.Current = Cursors.Arrow; }
private void frmRazonSocial_FormClosing(object sender, FormClosingEventArgs e) { bindingSource1.EndEdit(); if (tblRazonSocial.GetChanges() != null) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); tblRazonSocial.RejectChanges(); return; } frmProgress progreso = new frmProgress(tblRazonSocial, "frmRazonSocial", "grabar"); progreso.ShowDialog(); } bindingSource1.RemoveFilter(); }
private void btnAgrupar_Click(object sender, EventArgs e) { if (dgvDatosOrigen.Rows.Count == 0) { MessageBox.Show("Debe indicar un artículo de origen", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); txtParametrosOrigen.Focus(); return; } if (dgvDatosDestino.Rows.Count == 0) { MessageBox.Show("Debe indicar un artículo de destino", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); txtParametrosDestino.Focus(); return; } if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); tblArticulos.RejectChanges(); return; } if (MessageBox.Show("La agrupación de artículos eliminará los artículos de origen. ¿Desea continuar?", "Trend", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } Cursor.Current = Cursors.WaitCursor; DataView viewStock = new DataView(tblStock); DataView viewArticulos = new DataView(tblArticulos); DataTable tblLocales = BL.GetDataBLL.Locales(); DataView viewLocales = new DataView(tblLocales); viewLocales.RowFilter = "IdLocalLOC <> 1 AND IdLocalLOC <> 2"; string articuloDestino = dgvDatosDestino.CurrentRow.Cells["IdArticuloART"].Value.ToString(); int cantidadArticulos = 0; int cantidadDestino = 0; ArrayList articulosBorrar = new ArrayList(); foreach (DataGridViewRow rowOrigen in dgvDatosOrigen.Rows) { if (rowOrigen.Cells["Agrupar"].Value != null) { if (rowOrigen.Cells["Agrupar"].Value.ToString() == "1") { string articuloOrigen = rowOrigen.Cells["IdArticuloART"].Value.ToString(); foreach (DataRowView rowLocales in viewLocales) { string local = rowLocales["IdLocalLOC"].ToString(); if (local != "1" && local != "2") { viewStock.RowFilter = "IdLocalSTK = '" + local + "' AND IdArticuloSTK = '" + articuloOrigen + "'"; int cantidadOrigen = Convert.ToInt32(viewStock[0]["CantidadSTK"].ToString()); viewStock.RowFilter = "IdLocalSTK = '" + local + "' AND IdArticuloSTK = '" + articuloDestino + "'"; if (viewStock.Count > 0) { cantidadDestino = Convert.ToInt32(viewStock[0]["CantidadSTK"].ToString()); viewStock[0]["CantidadSTK"] = cantidadOrigen + cantidadDestino; } else // no existe el registro en la tabla stock. Lo agrego { DataRowView rowView = viewStock.AddNew(); rowView["IdArticuloSTK"] = articuloDestino; rowView["IdLocalSTK"] = local; rowView["CantidadSTK"] = cantidadOrigen; rowView.EndEdit(); } } } articulosBorrar.Add(articuloOrigen); // agrego los articulos agrupados para luego borrarlos } cantidadArticulos++; } } if (cantidadArticulos == 0) { MessageBox.Show("Debe seleccionar un artículo de origen", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } // borro los articulos agrupados foreach (string borrado in articulosBorrar) { DataRow[] found = tblArticulos.Select("IdArticuloART = '" + borrado + "'"); found[0].Delete(); } //Actualizo el viewOrigen para reflejar los cambios en pantalla foreach (string borrado in articulosBorrar) { DataRow[] found = tblArticulosStock.Select("IdArticuloART = '" + borrado + "'"); found[0].Delete(); } Cursor.Current = Cursors.Arrow; if (tblArticulos.GetChanges() != null) { frmProgress frm = new frmProgress(tblArticulos, tblStock, "frmArticulosAgrupar", "grabar", instanciaArticulosAgrupar); frm.FormClosed += frmProgress_FormClosed; frm.ShowDialog(); } }
private void frmFondoCaja_FormClosing(object sender, FormClosingEventArgs e) { if (txtImporte.Text == "") return; rowView.EndEdit(); if (tblFondoCaja.GetChanges() != null) { DialogResult respuesta = MessageBox.Show("¿Confirma la grabación de datos?", "Trend Gestión", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); switch (respuesta) { case DialogResult.Yes: if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("NO SE ACTUALIZARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); tblFondoCaja.RejectChanges(); return; } frmProgress progreso = new frmProgress(tblFondoCaja, "frmFondoCaja", "grabar"); progreso.ShowDialog(); break; case DialogResult.No: break; case DialogResult.Cancel: e.Cancel = true; break; } } }
private void btnAceptar_Click(object sender, EventArgs e) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DataRow selectedDataRow = ((DataRowView)lstLocales.SelectedItem).Row; int idLocal = Convert.ToInt32(selectedDataRow["IdLocalLOC"]); string strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00"); string strFechaHasta = dateTimeHasta.Value.ToString("yyyy-MM-dd 00:00:00"); string tipoMov = "movimientos"; string opcMov; if (rdEntradas.Checked) { opcMov = "entradas"; } else if (rdSalidas.Checked) { opcMov = "salidas"; } else { opcMov = "todos"; } string articulo = string.Empty; string descripcion = string.Empty; if (rdArticulo.Checked) { articulo = txtParametros.Text; } else { descripcion = txtParametros.Text; } string formularioOrigen = "frmStockMovInforme"; string accionProgress = "cargar"; frmProgress progreso = new frmProgress(strFechaDesde, strFechaHasta, idLocal, tipoMov, opcMov, formularioOrigen, accionProgress, articulo, descripcion); progreso.ShowDialog(); DataSet dsStockMov = frmProgress.dsStockMovCons; if (rdPantalla.Checked) { try { frmStockMovInforme frm = new frmStockMovInforme(dsStockMov, tipoMov, articulo, descripcion); frm.Show(); } catch (NullReferenceException) { return; } } else // impresora { try { string opcOrden; if (rdOrdenEntrada.Checked) { opcOrden = "movimiento"; } else { opcOrden = "Descripcion"; } StockMovRpt rpt = new StockMovRpt(dsStockMov, opcOrden); rpt.Show(); } catch (NullReferenceException) { return; } } }
private void button4_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; string Connection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Benja\\Desktop\\liquidacion.xlsx;Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\";"; OleDbConnection con = new OleDbConnection(Connection); System.Data.DataTable tblPrecioNuevos = new System.Data.DataTable(); OleDbDataAdapter myCommand = new OleDbDataAdapter("select * from [Hoja1$]", con); myCommand.Fill(tblPrecioNuevos); DataTable tblArticulos = BL.GetDataBLL.Articulos(); foreach (DataRow rowPreciosNuevos in tblPrecioNuevos.Rows) { string articulo = rowPreciosNuevos["Articulo"].ToString(); if(!string.IsNullOrEmpty(articulo)) { if (articulo.Length == 8) articulo = "00" + articulo; if (articulo.Length == 9) articulo = "0" + articulo; // articulo = rowPreciosNuevos["Articulo"].ToString().Substring(0, rowPreciosNuevos["Articulo"].ToString().Length - 4); articulo = articulo.Substring(0, articulo.Length - 4); DataRow[] foundRow = tblArticulos.Select("IdArticuloART LIKE '" + articulo + "*'"); foreach (DataRow rowArticulos in foundRow) { if (!string.IsNullOrEmpty(rowPreciosNuevos["Makro"].ToString()) && !string.IsNullOrEmpty(rowPreciosNuevos["Jesus"].ToString())) { rowArticulos["PrecioPublicoART"] = rowPreciosNuevos["Makro"]; rowArticulos["PrecioMayorART"] = rowPreciosNuevos["Jesus"]; } } } } if (tblArticulos.GetChanges() != null) { frmProgress progreso = new frmProgress(tblArticulos, "frmArticulosGenerar", "grabar"); progreso.ShowDialog(); } Cursor.Current = Cursors.Arrow; }
private void btnAceptar_Click(object sender, EventArgs e) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DataRow selectedDataRow = ((DataRowView)lstLocales.SelectedItem).Row; int idLocal = Convert.ToInt32(selectedDataRow["IdLocalLOC"]); string strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00"); string strFechaHasta = dateTimeHasta.Value.ToString("yyyy-MM-dd 00:00:00"); if (rdDetalle.Checked == true) //informe detalle { try { string tipoMov = "compensaciones"; string opcMov = "entradas"; string articulo = string.Empty; string descripcion = string.Empty; if (rdArticulo.Checked) { articulo = txtParametros.Text; } else { descripcion = txtParametros.Text; } string formularioOrigen = "frmStockMovInforme"; string accionProgress = "cargar"; frmProgress progreso = new frmProgress(strFechaDesde, strFechaHasta, idLocal, tipoMov, opcMov, formularioOrigen, accionProgress, articulo, descripcion); progreso.ShowDialog(); DataSet dsStockMov = frmProgress.dsStockMovCons; frmStockMovInforme frm = new frmStockMovInforme(dsStockMov, tipoMov, articulo, descripcion); frm.Show(); } catch (NullReferenceException) { return; } } else // informe en pesos { try { frmProgress frm = new frmProgress(strFechaDesde, strFechaHasta, idLocal, "frmStockCompPesos", "cargar"); frm.ShowDialog(); DataTable tblStockCompPesos = frmProgress.tblEstatica; strFechaDesde = dateTimeDesde.Value.ToShortDateString(); strFechaHasta = dateTimeHasta.Value.ToShortDateString(); StockCompPesosRpt frmStockComp = new StockCompPesosRpt(tblStockCompPesos, strFechaDesde, strFechaHasta); frmStockComp.Show(); } catch (NullReferenceException) { return; } } }
private void btnAceptar_Click(object sender, EventArgs e) { if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DataRow selectedDataRow = ((DataRowView)lstLocales.SelectedItem).Row; int idLocal = Convert.ToInt32(selectedDataRow["IdLocalLOC"]); string strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00"); string strFechaHasta = dateTimeHasta.Value.ToString("yyyy-MM-dd 00:00:00"); string tipoMov = "movimientos"; string opcMov; if (rdEntradas.Checked) { opcMov = "entradas"; } else if (rdSalidas.Checked) { opcMov = "salidas"; } else { opcMov = "todos"; } string articulo = string.Empty; string descripcion = string.Empty; if (rdArticulo.Checked) articulo = txtParametros.Text; else descripcion = txtParametros.Text; string formularioOrigen = "frmStockMovInforme"; string accionProgress = "cargar"; frmProgress progreso = new frmProgress(strFechaDesde, strFechaHasta, idLocal, tipoMov, opcMov, formularioOrigen, accionProgress, articulo, descripcion); progreso.ShowDialog(); DataSet dsStockMov = frmProgress.dsStockMovCons; if (rdPantalla.Checked) { try { frmStockMovInforme frm = new frmStockMovInforme(dsStockMov, tipoMov, articulo, descripcion); frm.Show(); } catch (NullReferenceException) { return; } } else // impresora { try { string opcOrden; if (rdOrdenEntrada.Checked) opcOrden = "movimiento"; else opcOrden = "Descripcion"; StockMovRpt rpt = new StockMovRpt(dsStockMov, opcOrden); rpt.Show(); } catch (NullReferenceException) { return; } } }
private void btnAceptar_Click(object sender, EventArgs e) { if(lstLocales.SelectedIndex == -1) { MessageBox.Show("Debe seleccionar un local.", "Trend",MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!BL.UtilDB.ValidarServicioMysql()) { MessageBox.Show("No se pudo conectar con el servidor de base de datos." + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (rdTotales.Checked) { strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00"); dtFechaHasta = dateTimeHasta.Value.AddDays(1); strFechaHasta = dtFechaHasta.ToString("yyyy-MM-dd 00:00:00"); forma = Convert.ToInt32(cmbForma.SelectedValue.ToString()); string genero; if (!string.IsNullOrEmpty(cmbGenero.Text)) genero = cmbGenero.SelectedValue.ToString(); else genero = string.Empty; strLocales = string.Empty; foreach (DataRowView filaLocal in lstLocales.SelectedItems) { idLocal = filaLocal.Row[0].ToString(); strLocales += "IdLocalLOC LIKE '" + idLocal + "' OR "; } strLocales = strLocales.Substring(0, strLocales.Length - 4); progreso = new frmProgress(forma, strFechaDesde, strFechaHasta, strLocales, "frmVentasPesosCons", "cargar", genero); progreso.ShowDialog(); try { DataTable tblVentasPesos = frmProgress.dsVentasPesosCons.Tables[0]; frmVentasPesosCons frm = new frmVentasPesosCons(tblVentasPesos); frm.Show(); } catch(NullReferenceException) { MessageBox.Show("El servidor de base de datos no respondió a la solicitud. Intente nuevamente.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { string origen = "frmVentasPesosInter_diarias"; string accion = "cargar"; string fecha_desde = dateTimeDesde.Value.ToString("yyyy-MM-dd"); dtFechaHasta = dateTimeHasta.Value.AddDays(1); string fecha_hasta = dtFechaHasta.ToString("yyyy-MM-dd"); int local = Convert.ToInt32(lstLocales.SelectedValue.ToString()); string forma = cmbForma.Text; frmProgress newMDIChild = new frmProgress(fecha_desde, fecha_hasta, local, forma, origen, accion); newMDIChild.ShowDialog(); DataTable tblVentasDiarias = frmProgress.tblEstatica; fecha_desde = dateTimeDesde.Value.ToString("dd-MM-yyyy"); fecha_hasta = dateTimeHasta.Value.ToString("dd-MM-yyyy"); string nombreLocal = lstLocales.Text; frmVentasPesosDiarias frmDiarias = new frmVentasPesosDiarias(tblVentasDiarias, fecha_desde, fecha_hasta, nombreLocal); frmDiarias.Show(); } }
private void frmCondicionIva_FormClosing(object sender, FormClosingEventArgs e) { bindingSource1.EndEdit(); if (tblCondicionIva.GetChanges() != null) { frmProgress progreso = new frmProgress(tblCondicionIva, "frmCondicionIva", "grabar"); progreso.ShowDialog(); } bindingSource1.RemoveFilter(); }