private void button4_Click(object sender, EventArgs e) { if (listametodoPago.Count == 0) { MessageBox.Show("Debe ingresar un pago"); return; } if (listaFacturaslocal.Count == 0) { MessageBox.Show("Debe ingresar una factura"); return; } if (cboCliente.Text.Trim() == "") { MessageBox.Show("Debes completar todos los campos"); return; } facturaventaNegocio facturanegocio = new facturaventaNegocio(); pagoNegocio pagoNegocio = new pagoNegocio(); if (sumaTotal == sumaFacturas & sumaTotal != 0) { pagoNegocio.agregarPago((Cliente)cboCliente.SelectedItem, dtpFecha.Value); foreach (facturaVenta item in listaFacturaslocal) { facturanegocio.modificarFactura(item, "Pago"); pagoNegocio.agregarfacturaxpago(item, idPago); } if (listaEfectivo.Any()) { foreach (Efectivo item in listaEfectivo) { pagoNegocio.agregarEfectivo(item, (Cliente)cboCliente.SelectedItem, idPago); } } if (listaCheques.Any()) { foreach (Cheque item in listaCheques) { pagoNegocio.agregarCheque(item, (Cliente)cboCliente.SelectedItem, idPago); } } if (listaTransferencias.Any()) { foreach (Transferencia item in listaTransferencias) { pagoNegocio.agregarTransferencia(item, (Cliente)cboCliente.SelectedItem, idPago); } } this.Close(); } else { MessageBox.Show("No coinciden el monto del pago con el monto de las facturas", "ERROR"); } }
private void button3_Click(object sender, EventArgs e) { pagoNegocio negocio = new pagoNegocio(); facturaventaNegocio negocio2 = new facturaventaNegocio(); negocio.eliminarPago((Pago)dgvPagos.CurrentRow.DataBoundItem); negocio2.modificarPagoFactura((Pago)dgvPagos.CurrentRow.DataBoundItem); cargarGrilla(); }
private void button1_Click(object sender, EventArgs e) { if (listaRemitos.Count == 0) { MessageBox.Show("Debes ingresar al menos un remito"); return; } facturaventaNegocio negocio = new facturaventaNegocio(); remitoNegocio negocio2 = new remitoNegocio(); try { if (facturaLocal == null) { facturaLocal = new facturaVenta(); facturaLocal.fechaFactura = dtpFactura.Value; facturaLocal.numeroFactura = txtnumeroFactura.Text; facturaLocal.cliente = (Cliente)cboCliente.SelectedItem; facturaLocal.importeBruto = decimal.Parse(txtimporteGravado.Text); facturaLocal.importeIVA = decimal.Parse(txtIVA21.Text); facturaLocal.importenoGravado = decimal.Parse(txtimportenoGravado.Text); facturaLocal.importeNeto = decimal.Parse(txttotalFactura.Text); facturaLocal.tipoComprobante = "Factura A"; facturaLocal.estado = "Impago"; facturaLocal.activo = true; facturaLocal.condicionPago = int.Parse(cboCondicion.Text); } negocio.agregarFactura(facturaLocal); //foreach(Remito item in listaRemitos) //{ negocio2.modificarRemitos(listaRemitos[0], facturaLocal.numeroFactura, "Facturado"); //} this.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void cargarGrilla() { facturaventaNegocio negocio = new facturaventaNegocio(); try { listafacturaslocal = negocio.listarFacturas(); dgvFacturas.DataSource = listafacturaslocal; dgvFacturas.Columns[0].Visible = false; dgvFacturas.Columns[6].Visible = false; dgvFacturas.Columns[9].Visible = false; colorearGrilla(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void cargarGrilla(int opc) { facturaventaNegocio negocio = new facturaventaNegocio(); try { if (opc == 1) { listaFacturasLocal = negocio.listarFacturas(cliente); dgvFacturas.DataSource = listaFacturasLocal; } else if (opc == 2) { listaFacturasLocal = negocio.listarFacturas(pago); dgvFacturas.DataSource = listaFacturasLocal; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }