private void BtnFacturar_Click(object sender, EventArgs e) { facturaservice = new FacturaService(ConfigConnection.ConnectionString); if (Factura.VerListaCursos().Count == 0 && Factura.VerListaProductos().Count == 0) { MessageBox.Show("Por favor Compre algo antes de facturar. "); } else { if (Factura.Cliente == null) { MessageBox.Show("Por favor Registre al cliente antes de facturar."); } else { Factura.Estado = "Activo"; Factura.CalcularFactura(); Factura.Fecha = DateTime.Now; Lugar lugar = new Lugar(); lugar.Codigo = ConfigConnection.Codigo; lugar.Ciudad = ConfigConnection.CiudadConectada; Factura.AgregarLugar(lugar); MessageBox.Show(facturaservice.GuardarFactura(Factura, ConfigConnection.Direccion, ConfigConnection.Codigo.ToString())); Factura = new Factura(); Label15.Text = "0"; CBCurso.SelectedIndex = 1; MapearTabla(DtgFactura); MapearTablaCurso(DtgCursos); LabelIVA.Text = "0"; LabelSubTotal.Text = "0"; labelTotal.Text = "0"; } } }
private void btnGuardar_Click(object sender, EventArgs e) { CalcularTotalToPagar(); Factura factur = MapearFactura(); string mensaje = facturaService.GuardarFactura(factur); MessageBox.Show(mensaje, "Mensaje de Guardado", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); Limpiar(); DetalleFactura.DataSource = null; }
private void Imprimir_Click(object sender, EventArgs e) { RespuestaTransaccion respuestaTransaccion = new RespuestaTransaccion(); respuestaTransaccion = facturaService.GuardarFactura(factura); MessageBox.Show(respuestaTransaccion.Mensaje, "Busqueda", MessageBoxButtons.OK, MessageBoxIcon.Information); LimpiarCamposDetalle(); LimpiarCamposFactura(); DetalleDtG.Rows.Clear(); }
private void BtnAgregarProducto_Click(object sender, EventArgs e) { try { int unidades = Convert.ToInt32(TxtUnidad.Text); // string nombre = TxtNombre.Text; string codigo = Txtcodigo.Text; string detalle = TxtDetalle.Text; int cantidad = Convert.ToInt32(TxtCantidad.Text); decimal precioventa = Convert.ToDecimal(TxtPrecioVenta.Text); decimal valor = Convert.ToDecimal(TxtValor.Text); string proveedor = CboxProveedores.Text; decimal impuesto = Convert.ToDecimal(TxtImpuesto.Text); decimal iva = Convert.ToDecimal(TxtIva.Text); // decimal calculo = (unidades * precioventa); Txttota.Text = Convert.ToString(calculo); decimal parcial = Convert.ToDecimal(Txttota.Text); string fecha = LbelFechaderealizacion.Text; string codigofactura = TxtCodigoFactura.Text; int nuevacantidad = cantidad - unidades; Factura factura = new Factura(codigofactura, codigo, nombre, unidades, iva, parcial, fecha); Medicamentos medicamento = new Medicamentos(codigo, nombre, nuevacantidad, valor, detalle, proveedor, impuesto); string res = servicios.ModificarMedicamentos(medicamento); MessageBox.Show("Stock actualizado", "Resultado de Modificar", MessageBoxButtons.OK, MessageBoxIcon.Information); string respuesta = serviciosFactura.GuardarFactura(factura); MessageBox.Show(respuesta); DtgElementosFactura.DataSource = serviciosFactura.ConsultarFacturacodigo(codigofactura); TxtTotalFactura.Text = Convert.ToString(serviciosFactura.Calcular(codigofactura).TotalCodigo); } catch (Exception E) { MessageBox.Show("Error !! " + E.ToString()); } }