estadisticas del mes
This commit is contained in:
+63
-2
@@ -283,7 +283,7 @@ namespace compabetov2.database
|
||||
return DAO.saldarCuentaDAO(cuenta, detallesCuentas);
|
||||
}
|
||||
|
||||
public static Dictionary<string, dynamic> filtrarVentaFechaMes(DateTime fecha)
|
||||
/*public static Dictionary<string, dynamic> filtrarVentaFechaMes(DateTime fecha)
|
||||
{
|
||||
Dictionary<string, dynamic> estadisticas = new Dictionary<string, dynamic>();
|
||||
SQLiteDataReader reader = DAO.filtrarVentaFechaMesDAO(fecha);
|
||||
@@ -312,7 +312,7 @@ namespace compabetov2.database
|
||||
MessageBox.Show($"{totalDia} -- {totalMes}");
|
||||
|
||||
return estadisticas;
|
||||
}
|
||||
}*/
|
||||
|
||||
public static bool crearEnvio(Envio envio, List<DetalleEnvioModel> detallesEnvio)
|
||||
{
|
||||
@@ -378,5 +378,66 @@ namespace compabetov2.database
|
||||
{
|
||||
return DAO.concluirEnvioDAO(envio, detallesEnvio);
|
||||
}
|
||||
|
||||
public static Dictionary<string, List<Dictionary<string,dynamic>>> estadisticas(DateTime fecha)
|
||||
{
|
||||
Dictionary<string, List<Dictionary<string, dynamic>>> resumen = new Dictionary<string, List<Dictionary<string, dynamic>>>();
|
||||
List<Dictionary<string, dynamic>> listMes = new List<Dictionary<string, dynamic>>();
|
||||
List<Dictionary<string, dynamic>> listDia = new List<Dictionary<string, dynamic>>();
|
||||
SQLiteDataReader readerVentas = DAO.conseguirVentasMesDAO(fecha);
|
||||
string formato = "dd/MM/yyyy";
|
||||
|
||||
while (readerVentas.Read())
|
||||
{
|
||||
Dictionary<string,dynamic> dicVenta = new Dictionary<string,dynamic>();
|
||||
|
||||
VentaModel venta = new VentaModel(
|
||||
readerVentas.GetDecimal(2),
|
||||
(int)readerVentas.GetInt64(0),
|
||||
readerVentas.GetString(1),
|
||||
readerVentas.GetString(3)
|
||||
);
|
||||
|
||||
List<DetalleVentaModel> detallesVenta = new List<DetalleVentaModel>();
|
||||
SQLiteDataReader readerDetalleVenta = DAO.conseguirDetalleVenta(venta);
|
||||
while (readerDetalleVenta.Read())
|
||||
{
|
||||
DetalleVentaModel detalleVenta = new DetalleVentaModel(
|
||||
(int)readerDetalleVenta.GetInt64(2),
|
||||
new Producto(
|
||||
(int)readerDetalleVenta.GetInt64(1),
|
||||
readerDetalleVenta["nombre"].ToString(),
|
||||
readerDetalleVenta["descripcion"].ToString(),
|
||||
readerDetalleVenta.GetDecimal(6),
|
||||
readerDetalleVenta["img"].ToString(),
|
||||
(int)readerDetalleVenta.GetInt64(8)
|
||||
),
|
||||
(int)readerDetalleVenta.GetInt64(0)
|
||||
) ;
|
||||
detallesVenta.Add( detalleVenta );
|
||||
}
|
||||
|
||||
dicVenta.Add("venta", venta);
|
||||
dicVenta.Add("detalles", detallesVenta as List<DetalleVentaModel>);
|
||||
|
||||
string[] fecha_hora = venta.fecha.Split(' ');
|
||||
string fechaVentaStr = fecha_hora[0];
|
||||
|
||||
DateTime.TryParseExact(fechaVentaStr, formato, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime fechaVenta);
|
||||
if (fecha.Day == fechaVenta.Day)
|
||||
{
|
||||
listDia.Add(dicVenta);
|
||||
}
|
||||
|
||||
listMes.Add(dicVenta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
resumen.Add("mes", listMes);
|
||||
resumen.Add("dia", listDia);
|
||||
|
||||
return resumen;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user