private void totalFacturacion(ClaseSQL conexion) { String query = "SELECT SUM(Importe)" + this.fromFacturas(); Object resultado = conexion.scalarQuery(query); tTotalFacturacion.Text = resultado.ToString(); }
private void totalVentas(ClaseSQL conexion) { String query = "SELECT COUNT(1)" + this.fromFacturas(); Object resultado = conexion.scalarQuery(query); tTotalVentas.Text = resultado.ToString(); }
private void proporcionFormaDePago(ClaseSQL conexion) { String query = "SELECT COUNT(1)" + this.fromFacturas() + " AND Cuotas = 1"; int cantidadEfectivo = int.Parse(conexion.scalarQuery(query).ToString()); query = "SELECT COUNT(1)" + this.fromFacturas() + " AND Cuotas > 1"; int cantidadEnCuotas = int.Parse(conexion.scalarQuery(query).ToString()); if (cantidadEnCuotas + cantidadEfectivo > 0) { decimal proporcionEfectivo = cantidadEfectivo * 100 / (cantidadEfectivo + cantidadEnCuotas); decimal proporcionEnCuotas = 100 - proporcionEfectivo; tProporcionFormaPago.Text = proporcionEfectivo + "% - " + proporcionEnCuotas + "%"; } else { tProporcionFormaPago.Text = "No se facturo ese año"; } }
public int stock(Producto producto, Sucursal sucursal) { ClaseSQL conexion = ClaseSQL.getInstance(); String query = "SELECT Cantidad FROM " + ClaseSQL.tableName("Stocks") + " WHERE Producto = " + producto.codigo + " AND Sucursal = " + sucursal.provincia; conexion.Open(); int stock = (int)conexion.scalarQuery(query); conexion.Close(); return(stock); }
private void productoDelAnio(ClaseSQL conexion) { String query = "SELECT TOP 1 Producto FROM " + ClaseSQL.tableName("ProductosPorAnio") + " WHERE Sucursal = " + ((Provincia)cSucursal.SelectedItem).codigo + " AND Anio = " + cAnio.Value + " ORDER BY Vendidos DESC"; Object idObject = conexion.scalarQuery(query); if (idObject != null) { conexion.Close(); Producto productoDelAnio = Productos.getInstance().producto(int.Parse(idObject.ToString())); Categoria categoriaDelAnio = Categorias.getInstance().categoria(productoDelAnio.categoria); conexion.Open(); tProductoDelAnio.Text = productoDelAnio.codigo + " - " + productoDelAnio.nombre + " (" + categoriaDelAnio.nombre + " - " + categoriaDelAnio.codigo + ")"; } else { tVendedorDelAnio.Text = "No se efectuaron ventas"; } }
private void vendedorDelAnio(ClaseSQL conexion) { String query = "SELECT TOP 1 Vendedor FROM " + ClaseSQL.tableName("VendedoresPorAnio") + " WHERE Sucursal = " + ((Provincia)cSucursal.SelectedItem).codigo + " AND Anio = " + cAnio.Value + " ORDER BY VentaTotal DESC"; Object idObject = conexion.scalarQuery(query); if (idObject != null) { Decimal idVendedor = (Decimal)idObject; query = "SELECT Apellido, Nombre, DNI FROM " + ClaseSQL.tableName("Empleados") + " WHERE DNI = " + idVendedor; SqlDataReader reader = conexion.busquedaSQLDataReader(query); reader.Read(); tVendedorDelAnio.Text = ((String)reader[0]).ToUpper() + ", " + (String)reader[1] + " (DNI " + (decimal)reader[2] + ")"; reader.Close(); } else { tVendedorDelAnio.Text = "No se efectuaron ventas"; } }
private void mayorDeudor(ClaseSQL conexion) { String query = "SELECT TOP 1 Cliente FROM " + ClaseSQL.tableName("DeudasPorAnio") + " WHERE Sucursal = " + ((Provincia)cSucursal.SelectedItem).codigo + " AND Anio = " + cAnio.Value + " ORDER BY DeudaTotal DESC"; Object idObject = conexion.scalarQuery(query); if (idObject != null) { Decimal idCliente = (Decimal)idObject; query = "SELECT Apellido, Nombre, DNI FROM " + ClaseSQL.tableName("Clientes") + " WHERE DNI = " + idCliente; SqlDataReader reader = conexion.busquedaSQLDataReader(query); reader.Read(); tMayorDeudor.Text = ((String)reader[0]).ToUpper() + ", " + (String)reader[1] + " (DNI " + (decimal)reader[2] + ")"; reader.Close(); } else { tMayorDeudor.Text = "Ninguno"; } }
private void mayorFactura(ClaseSQL conexion) { String query = "SELECT MAX(Importe)" + this.fromFacturas(); tMayorFactura.Text = conexion.scalarQuery(query).ToString(); }