public void agregarfacturaxpago(facturaVenta factura, int idpago) { SqlConnection conexion = new SqlConnection(); SqlCommand comando = new SqlCommand(); try { conexion.ConnectionString = AccesoDatosManager.cadenaConexion; comando.CommandType = System.Data.CommandType.Text; //MSF-20190420: le agregué todas las columnas. Teniendo en cuenta inclusive lo que elegimos en el combo de selección.. comando.CommandText = "insert into FACTURASXPAGO (numeroFactura,idPago,activo) values"; comando.CommandText += "('" + factura.numeroFactura + "','" + idpago + "', '" + "1" + "')"; comando.Connection = conexion; conexion.Open(); comando.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { conexion.Close(); } }
public void agregarFactura(facturaVenta nuevo) { SqlConnection conexion = new SqlConnection(); SqlCommand comando = new SqlCommand(); try { conexion.ConnectionString = AccesoDatosManager.cadenaConexion; comando.CommandType = System.Data.CommandType.Text; //MSF-20190420: le agregué todas las columnas. Teniendo en cuenta inclusive lo que elegimos en el combo de selección.. comando.CommandText = "insert into facturaVenta (idCliente,numeroFactura , fechaFactura,importeTotal,IVA21,importeNeto,importenoGravado,activo,tipoComprobante,estado,condicionPago) values"; comando.CommandText += "('" + nuevo.cliente.id + "', '" + nuevo.numeroFactura + "', '" + nuevo.fechaFactura.ToString("MM-dd-yyyy") + "', '" + nuevo.importeBruto.ToString().Replace(",", ".") + "', '" + nuevo.importeIVA.ToString().Replace(",", ".") + "', '" + nuevo.importeNeto.ToString().Replace(",", ".") + "', '" + nuevo.importenoGravado.ToString().Replace(",", ".") + "', '" + nuevo.activo + "', '" + nuevo.tipoComprobante + "', '" + nuevo.estado + "', '" + nuevo.condicionPago + "')"; comando.Connection = conexion; conexion.Open(); comando.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { conexion.Close(); } }
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()); } }
public List <facturaVenta> listarFacturas(Cliente cliente) { List <facturaVenta> listado = new List <facturaVenta>(); AccesoDatosManager accesoDatos = new AccesoDatosManager(); facturaVenta factura; try { accesoDatos.setearConsulta("select f.numeroFactura,f.fechaFactura,f.idCliente,f.condicionPago,f.tipoComprobante,f.importeNeto,f.IVA21,f.importenoGravado,c.nombre,f.importeTotal,f.estado from facturaVenta as f inner join clientes as c on c.id = f.idcliente where f.estado='Impago' and f.activo=1 and f.idcliente=" + cliente.id); accesoDatos.abrirConexion(); accesoDatos.ejecutarConsulta(); while (accesoDatos.Lector.Read()) { factura = new facturaVenta(); factura.cliente = new Cliente(); factura.cliente.nombre = accesoDatos.Lector["nombre"].ToString(); factura.numeroFactura = accesoDatos.Lector["numeroFactura"].ToString(); factura.estado = accesoDatos.Lector["estado"].ToString(); factura.fechaFactura = (DateTime)accesoDatos.Lector["fechaFactura"]; factura.tipoComprobante = accesoDatos.Lector["tipoComprobante"].ToString(); factura.importeBruto = (decimal)accesoDatos.Lector["importeTotal"]; factura.importeNeto = (decimal)accesoDatos.Lector["importeNeto"]; factura.importeIVA = (decimal)accesoDatos.Lector["IVA21"]; factura.importenoGravado = (decimal)accesoDatos.Lector["importenoGravado"]; factura.condicionPago = (int)accesoDatos.Lector["condicionPago"]; listado.Add(factura); } return(listado); } catch (Exception ex) { throw ex; } finally { accesoDatos.cerrarConexion(); } }
private void button1_Click(object sender, EventArgs e) { factura = (facturaVenta)dgvFacturas.CurrentRow.DataBoundItem; this.Close(); }