public void Inventario() { string consulta = "SELECT Id_prod, Nombre,Descripcion,Marca,PRecio_c,cantidad FROM producto ORDER BY nombre"; DataTable datos = new DataTable(); datos = buscar(consulta); Reportes.DiarioEnc enca = new Reportes.DiarioEnc(); int cant = datos.Rows.Count, cont; for (cont = 0; cont < cant; cont++) { Reportes.DiarioDet Deta = new Reportes.DiarioDet(); Deta.orden = cont + 1; Deta.codigo = datos.Rows[cont][0].ToString(); Deta.producto = datos.Rows[cont][1].ToString(); Deta.desc = datos.Rows[cont][2].ToString(); Deta.marca = datos.Rows[cont][3].ToString(); Deta.precio = decimal.Parse(datos.Rows[cont][4].ToString()); Deta.cantidad = int.Parse(datos.Rows[cont][5].ToString()); Deta.subtotal = decimal.Parse(datos.Rows[cont][4].ToString()) * int.Parse(datos.Rows[cont][5].ToString()); enca.Detalle.Add(Deta); } Reportes.Inventario inve = new Reportes.Inventario(); inve.Detalle = enca.Detalle; inve.Show(); }
public void Vendidos(string fechai, string fechaf) { DataTable datos = new DataTable(); fechai = fechai + " 00:00:00"; fechaf = fechaf + " 23:59:59"; int cant, cont; string consulta = "SELECT v.ID_VENTA ,Date_format(v.FECHA_H,'%d/%m/%y') as fecha,SUM(vd.TOTAL) AS Total " + "FROM venta v " + "INNER JOIN detalle vd ON vd.ID_VENTA = v.ID_VENTA " + "WHERE v.FECHA_H >= '" + fechai + "' AND v.FECHA_H <= '" + fechaf + "' " + "GROUP BY CAST(v.FECHA_H AS DATE)"; datos = buscar(consulta); cant = datos.Rows.Count; Reportes.DiarioEnc titulo = new Reportes.DiarioEnc(); titulo.fecha = fechai; titulo.F2 = fechaf; for (cont = 0; cont < cant; cont++) { //DateTime fecha= DateTime.Parse(datos.Rows[cont][1].ToString()); Reportes.DiarioDet Detalle = new Reportes.DiarioDet(); Detalle.orden = cont + 1; Detalle.venta = int.Parse(datos.Rows[cont][0].ToString()); Detalle.desc = datos.Rows[cont][1].ToString(); Detalle.subtotal = decimal.Parse(datos.Rows[cont][2].ToString()); titulo.Detalle.Add(Detalle); } Reportes.Vendidos vende = new Reportes.Vendidos(); vende.Encabezado.Add(titulo); vende.Detalle = titulo.Detalle; vende.Show(); }
public void MasVen(string fechai, string fechaf) { fechai += " 00:00:00"; fechaf += " 23:59:59"; DataTable datos = new DataTable(); int cant, cont; string consulta = "SELECT p.ID_PROD,p.NOMBRE,p.MARCA,p.DESCRIPCION, COUNT(vd.ID_PROD) AS Total from producto p " + "INNER JOIN detalle vd ON vd.ID_PROD = p.ID_PROD " + "INNER JOIN venta v ON v.ID_VENTA = vd.ID_VENTA " + "WHERE v.FECHA_H >= '" + fechai + "' AND v.FECHA_H <= '" + fechaf + "'" + "GROUP BY p.ID_PROD " + "ORDER BY Total desc"; datos = buscar(consulta); cant = datos.Rows.Count; Reportes.DiarioEnc titulo = new Reportes.DiarioEnc(); titulo.fecha = fechai; titulo.F2 = fechaf; if (cant > 0) { for (cont = 0; cont <= 9; cont++) { Reportes.Diezmas Grafi = new Reportes.Diezmas(); Grafi.cantidad = int.Parse(datos.Rows[cont][4].ToString()); Grafi.Producto = char.ConvertFromUtf32(cont + 65) + ") " + datos.Rows[cont][1].ToString() + " " + datos.Rows[cont][2].ToString() + " " + datos.Rows[cont][3].ToString(); titulo.Diez.Add(Grafi); } } for (cont = 0; cont < cant; cont++) { Reportes.DiarioDet detall = new Reportes.DiarioDet(); detall.codigo = datos.Rows[cont][0].ToString(); detall.producto = datos.Rows[cont][1].ToString(); detall.marca = datos.Rows[cont][2].ToString(); detall.desc = datos.Rows[cont][3].ToString(); detall.cantidad = int.Parse(datos.Rows[cont][4].ToString()); titulo.Detalle.Add(detall); } Reportes.Masven Mas = new Reportes.Masven(); Mas.Titu.Add(titulo); Mas.Gra = titulo.Diez; Mas.Detalle = titulo.Detalle; Mas.Show(); }
public void RepD(string fecha) { Reportes.DiarioEnc enc = new Reportes.DiarioEnc(); int cant, cont; string FechI, FechaF, consulta; DataTable datos = new DataTable(); FechI = fecha + " 00:00:00"; FechaF = fecha + " 23:59:59"; consulta = "SELECT v.ID_VENTA AS venta , p.id_prod AS idP, p.nombre AS nombre,p.descripcion as descr, d.cantidad, d.precio, (d.cantidad*d.precio), SUM((d.cantidad*d.precio)),v.descu FROM producto p " + "INNER JOIN detalle d ON d.ID_PROD = p.id_prod " + "INNER JOIN venta v ON v.ID_VENTA = d.ID_VENTA " + "WHERE v.FECHA_H >= '" + FechI + "' AND v.FECHA_H <= '" + FechaF + "' " + "GROUP BY d.ID_DETALLE,v.ID_VENTA " + "ORDER BY v.ID_VENTA"; datos = buscar(consulta); cant = datos.Rows.Count; if (cant > 0) { enc.fecha = fecha; enc.descuento = decimal.Parse(datos.Rows[0][8].ToString()); for (cont = 0; cont < cant; cont++) { Reportes.DiarioDet Det = new Reportes.DiarioDet(); Det.orden = cont + 1; Det.venta = Int32.Parse(datos.Rows[cont][0].ToString()); Det.codigo = datos.Rows[cont][1].ToString(); Det.producto = datos.Rows[cont][2].ToString(); Det.desc = datos.Rows[cont][3].ToString(); Det.cantidad = Int32.Parse(datos.Rows[cont][4].ToString()); Det.precio = decimal.Parse(datos.Rows[cont][5].ToString()); Det.subtotal = decimal.Parse(datos.Rows[cont][6].ToString()); enc.Detalle.Add(Det); } Reportes.Diario repo = new Reportes.Diario(); repo.Enca.Add(enc); repo.Deta = enc.Detalle; repo.Show(); } else { MessageBox.Show("No exiten ventas registradas", "No hay ventas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public void Totales(string fechai, string fechaf) { DataTable datos = new DataTable(); fechai = fechai + " 00:00:00"; fechaf = fechaf + " 23:59:59"; int cant, cont; string consulta = "SELECT Date_format(v.FECHA_H,'%d/%m/%y') as fecha,(SUM((vd.cantidad*vd.precio))-v.Descu),v.Descu, (SUM(((vd.cantidad*vd.precio)-(vd.cantidad*p.precio_c)))-v.descu) AS ganancia " + "FROM venta v " + "INNER JOIN detalle vd ON vd.ID_VENTA = v.ID_VENTA " + "INNER JOIN producto p on vd.ID_PROD = p.ID_PROD " + "WHERE v.FECHA_H >= '" + fechai + "' AND v.FECHA_H <= '" + fechaf + "' " + "GROUP BY CAST(v.FECHA_H AS DATE)"; datos = buscar(consulta); cant = datos.Rows.Count; Reportes.DiarioEnc titulo = new Reportes.DiarioEnc(); titulo.fecha = fechai; titulo.F2 = fechaf; for (cont = 0; cont < cant; cont++) { //DateTime fechas = DateTime.Parse(datos.Rows[cont][0].ToString()); Reportes.DiarioDet Detalle = new Reportes.DiarioDet(); Detalle.orden = cont + 1; //Marca = fecha Detalle.marca = datos.Rows[cont][0].ToString();//fechas.ToString("dd/MM/yyyy"); //Vendido = Subtotal Detalle.subtotal = decimal.Parse(datos.Rows[cont][1].ToString()); //Ganacia= precio Detalle.precio = decimal.Parse(datos.Rows[cont][3].ToString()); //sin ganacia= desc Detalle.desc = (Detalle.subtotal - Detalle.precio).ToString(); titulo.Detalle.Add(Detalle); } Reportes.Totales Total = new Reportes.Totales(); Total.Encabezado.Add(titulo); Total.Detalle = titulo.Detalle; Total.Show(); }
public void Ganacia(string fechai, string fechaf) { Reportes.DiarioEnc enc = new Reportes.DiarioEnc(); enc.fecha = fechai; enc.F2 = fechaf; fechai += " 00:00:00"; fechaf += " 23:59:59"; string consulta = "SELECT v.id_venta, vd.id_detalle,Date_format(v.FECHA_H,'%d/%m/%Y') ,COUNT(vd.ID_DETALLE ),SUM((vd.cantidad*vd.precio)),v.Descu, (SUM(((vd.cantidad*vd.precio)-(vd.cantidad*p.precio_c)))-v.descu) AS ganancia FROM venta v " + "INNER JOIN detalle vd ON vd.ID_VENTA = v.ID_VENTA " + "INNER JOIN producto p on vd.ID_PROD = p.ID_PROD " + "WHERE v.FECHA_H >= '" + fechai + "' AND v.FECHA_H <= '" + fechaf + "' " + "GROUP BY v.ID_VENTA"; DataTable datos = new DataTable(); datos = buscar(consulta); int cont, cant = datos.Rows.Count; for (cont = 0; cont < cant; cont++) { Reportes.DiarioDet detalle = new Reportes.DiarioDet(); detalle.orden = int.Parse(datos.Rows[cont][0].ToString()); //Productos vendidos detalle.cantidad = int.Parse(datos.Rows[cont][3].ToString()); //total Vendido detalle.precio = decimal.Parse(datos.Rows[cont][4].ToString()) - decimal.Parse(datos.Rows[cont][5].ToString()); //Ganacia detalle.subtotal = decimal.Parse(datos.Rows[cont][6].ToString()); string f = datos.Rows[cont][2].ToString(); //DateTime fecha = DateTime.Parse(datos.Rows[cont][2].ToString()); detalle.marca = f; enc.Detalle.Add(detalle); } Reportes.Ganancia gan = new Reportes.Ganancia(); gan.Encabezado.Add(enc); gan.Detalle = enc.Detalle; gan.Show(); }
public void imprimircod(string texto, int cant) { Reportes.DiarioEnc enca = new Reportes.DiarioEnc(); int cantfil, ultcol; cantfil = (cant - (cant % 5)) / 5; if ((cant % 5) > 0) { cantfil += 1; ultcol = cant % 5; } else { ultcol = 5; } int fila, columna; string[,] titulo = new string[cantfil, 5]; string[,] imgcod = new string[cantfil, 5]; for (fila = 0; fila <= (cantfil - 1); fila++) { for (columna = 0; columna <= 4; columna++) { titulo[fila, columna] = ""; imgcod[fila, columna] = ""; } } for (fila = 0; fila <= (cantfil - 1); fila++) { if (fila == (cantfil - 1)) { for (columna = 0; columna <= (ultcol - 1); columna++) { titulo[fila, columna] = ""; imgcod[fila, columna] = @"D:\C.jpg";//direccion donde se ecnutra la imagen guardada } } else { for (columna = 0; columna <= 4; columna++) { titulo[fila, columna] = ""; imgcod[fila, columna] = @"D:\C.jpg";//direccion donde se ecnutra la imagen guardada } } } for (fila = 0; fila <= (cantfil - 1); fila++) { } for (fila = 0; fila <= (cantfil - 1); fila++) { Reportes.EtiquetaImp etiq = new Reportes.EtiquetaImp(); etiq.etiqueta1 = ""; etiq.codigo1 = imgcod[fila, 0]; etiq.etiqueta2 = ""; etiq.codigo2 = imgcod[fila, 1]; etiq.etiqueta3 = ""; etiq.codigo3 = imgcod[fila, 2]; etiq.etiqueta4 = ""; etiq.codigo4 = imgcod[fila, 3]; etiq.etiqueta5 = ""; etiq.codigo5 = imgcod[fila, 4]; enca.Etiqueta.Add(etiq); } Reportes.ImpCodigo ventana = new Reportes.ImpCodigo(); ventana.detalle = enca.Etiqueta; ventana.Show(); /* For fila = 0 To cantfil - 1 * * Dim etiq As New EtiquetaClase * etiq.Etiqueta1 = titulo(fila, 0) * etiq.Codigo1 = imgcod(fila, 0) * etiq.Etiqueta2 = titulo(fila, 1) * etiq.Codigo2 = imgcod(fila, 1) * etiq.Etiqueta3 = titulo(fila, 2) * etiq.Codigo3 = imgcod(fila, 2) * etiq.Etiqueta4 = titulo(fila, 3) * etiq.Codigo4 = imgcod(fila, 3) * etiq.Etiqueta5 = titulo(fila, 4) * etiq.Codigo5 = imgcod(fila, 4) * enca.Etiqueta.Add(etiq) * * Next * * Dim ventana As New ImpCodigoB * ventana.encabezado.Add(enca) * ventana.code = enca.Etiqueta * ventana.Show() */ }