public OOB.Resultado.Lista <OOB.Reportes.VentaPorProducto.Ficha> Reportes_VentaPorProducto(OOB.Reportes.VentaPorProducto.Filtro filtro) { var rt = new OOB.Resultado.Lista <OOB.Reportes.VentaPorProducto.Ficha>(); var filtroDTO = new DtoLibPos.Reportes.VentaAdministrativa.VentaPorProducto.Filtro() { codigoSucursal = filtro.codigoSucursal, desdeFecha = filtro.desde, hastaFecha = filtro.hasta, }; var r01 = MyData.ReportesAdm_VentaPorProducto(filtroDTO); if (r01.Result == DtoLib.Enumerados.EnumResult.isError) { rt.Mensaje = r01.Mensaje; rt.Result = OOB.Resultado.Enumerados.EnumResult.isError; return(rt); } var list = new List <OOB.Reportes.VentaPorProducto.Ficha>(); if (r01.Lista != null) { if (r01.Lista.Count > 0) { list = r01.Lista.Select(s => { var nr = new OOB.Reportes.VentaPorProducto.Ficha() { cantidad = s.cantidad, codigoPrd = s.codigoPrd, nombreDocumento = s.nombreDocumento, nombrePrd = s.nombrePrd, signo = s.signo, totalMonto = s.totalMonto, totalMontoDivisa = s.totalMontoDivisa, }; return(nr); }).ToList(); } } rt.ListaD = list; return(rt); }
public DtoLib.ResultadoLista <DtoLibPos.Reportes.VentaAdministrativa.VentaPorProducto.Ficha> ReportesAdm_VentaPorProducto(DtoLibPos.Reportes.VentaAdministrativa.VentaPorProducto.Filtro filtro) { var rt = new DtoLib.ResultadoLista <DtoLibPos.Reportes.VentaAdministrativa.VentaPorProducto.Ficha>(); try { using (var cnn = new PosEntities(_cnPos.ConnectionString)) { var sql_1 = "SELECT vd.codigo as codigoPrd, vd.nombre as nombrePrd, sum(vd.cantidad_und) as cantidad, " + "sum(vd.total) as totalMonto, v.documento_nombre as nombreDocumento, v.signo, " + "sum(vd.total/v.factor_cambio) as totalMontoDivisa "; var sql_2 = " FROM ventas_detalle as vd " + "join ventas as v on vd.auto_documento=v.auto "; var sql_3 = " where v.fecha>=@desde and v.fecha<=@hasta and v.estatus_anulado='0' "; var sql_4 = " group by vd.auto_producto, vd.codigo, vd.nombre, v.documento_nombre, v.signo "; var p1 = new MySql.Data.MySqlClient.MySqlParameter(); var p2 = new MySql.Data.MySqlClient.MySqlParameter(); var p3 = new MySql.Data.MySqlClient.MySqlParameter(); p1.ParameterName = "@desde"; p1.Value = filtro.desdeFecha; p2.ParameterName = "@hasta"; p2.Value = filtro.hastaFecha; if (filtro.codigoSucursal != "") { sql_3 += " and v.codigo_sucursal=@codigoSucursal "; p3.ParameterName = "@codigoSucursal"; p3.Value = filtro.codigoSucursal; } var sql = sql_1 + sql_2 + sql_3 + sql_4; var list = cnn.Database.SqlQuery <DtoLibPos.Reportes.VentaAdministrativa.VentaPorProducto.Ficha>(sql, p1, p2, p3).ToList(); rt.Lista = list; } } catch (Exception e) { rt.Mensaje = e.Message; rt.Result = DtoLib.Enumerados.EnumResult.isError; } return(rt); }
public DtoLib.ResultadoLista <DtoLibPos.Reportes.VentaAdministrativa.VentaPorProducto.Ficha> ReportesAdm_VentaPorProducto(DtoLibPos.Reportes.VentaAdministrativa.VentaPorProducto.Filtro filtro) { return(ServiceProv.ReportesAdm_VentaPorProducto(filtro)); }