private void ModifDebeFacturaButton_Click(object sender, EventArgs e) { if (IsGridEmpty(DgvFacturas, "facturas")) { return; } try { var debe = (decimal)DgvCuentas.SelectedRows[0].Cells[2].Value; cuentaCorriente = new DCuentaCorriente(); dFacturas = new DFacturasProv(); cuentaCorriente.UpdateDebeCuenta(debe, codCuentaCorriente); dFacturas.RegistrarFactura((int)DgvFacturas.SelectedRows[0].Cells[0].Value, codCuentaCorriente); } catch (Exception ex) { MessageBox.Show($"ERROR: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("Cuenta modificada y factura registrada con éxito", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); VaciarGrids(); }
private void ModifHaberNotaButton_Click(object sender, EventArgs e) { if (IsGridEmpty(DgvNotas, "notas")) { return; } try { var haber = (decimal)DgvCuentas.SelectedRows[0].Cells[3].Value; cuentaCorriente = new DCuentaCorriente(); dNotaCredito = new DNotaCredito(); cuentaCorriente.UpdateHaberCuenta(haber, codCuentaCorriente); dNotaCredito.RegistrarNotaCredito((int)DgvNotas.SelectedRows[0].Cells[0].Value, codCuentaCorriente); } catch (Exception ex) { MessageBox.Show($"ERROR: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("Cuenta modificada y nota de crédito registrada con éxito", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); VaciarGrids(); }
private void CargarCuentas() { cuentaCorriente = new CapaDatos.DCuentaCorriente(); DgvCuentas.DataSource = cuentaCorriente.SelectCuentasCorriente(); DgvCuentas.Refresh(); }
private void GuardarDatosButton_Click(object sender, EventArgs e) { if (!modifSaldos) { if (ProveedorComboBox.SelectedIndex == -1) { MessageBox.Show("Seleccione un proveedor", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } var rta = MessageBox.Show("¿Guardar datos?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (rta == DialogResult.No) { return; } cuentaCorriente = new DCuentaCorriente(); if (!modifSaldos) { var codProv = (int)ProveedorComboBox.SelectedValue; if (nueva) { var msg = cuentaCorriente.InsertCuentaProveedor(codProv, 0, 0); var popup1 = new PopupNotifier() { Image = msg == "Se ingresó la cuenta correctamente" ? Properties.Resources.sql_success1 : Properties.Resources.sql_error, TitleText = "Mensaje", ContentText = msg, ContentFont = new Font("Segoe UI Bold", 11F), TitleFont = new Font("Segoe UI Bold", 10F), ImagePadding = new Padding(10) }; popup1.Popup(); } else { var msg = cuentaCorriente.UpdateCuentaProveedor(codProv); var popup1 = new PopupNotifier() { Image = msg == "Se actualizó la cuenta correctamente" ? Properties.Resources.info100 : Properties.Resources.sql_error, TitleText = "Mensaje", ContentText = msg, ContentFont = new Font("Segoe UI Bold", 11F), TitleFont = new Font("Segoe UI Bold", 10F), ImagePadding = new Padding(0) }; popup1.Popup(); } } else { var debe = decimal.Parse(DebeTextBox.Text); var haber = decimal.Parse(HaberTextBox.Text); var msg = cuentaCorriente.UpdateDebeHaberCuentaProveedor(codCuentaCorriente, debe, haber); var popup1 = new PopupNotifier() { Image = msg == "Se actualizó la cuenta correctamente" ? Properties.Resources.info100 : Properties.Resources.sql_error, TitleText = "Mensaje", ContentText = msg, ContentFont = new Font("Segoe UI Bold", 11F), TitleFont = new Font("Segoe UI Bold", 10F), ImagePadding = new Padding(0) }; popup1.Popup(); } VaciarGrids(); LimpiarCampos(); DeshabilitarCampos(); CargarCuentas(); }