Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="IdEmpresa"></param>
        /// <param name="IdSucursal">  si IdSucursal=0 extrae todos las susucursales</param>
        /// <param name="FechaIni"></param>
        /// <param name="FechaFin"></param>
        /// <returns></returns>
        public List <XFAC_Rpt013_Info> Get_List_Data_Reporte(int IdEmpresa, decimal IdCliente, DateTime FechaIni, DateTime FechaFin, ref string MensajeError)
        {
            List <XFAC_Rpt013_Info> lista = new List <XFAC_Rpt013_Info>();

            try
            {
                using (EntitiesFacturacion_Reportes listado = new EntitiesFacturacion_Reportes())
                {
                    FechaIni = Convert.ToDateTime(FechaIni.ToShortDateString());
                    FechaFin = Convert.ToDateTime(FechaFin.ToShortDateString());

                    var select = listado.spFAC_Rpt013(IdEmpresa, IdCliente, FechaIni, FechaFin);

                    double?Saldo = 0;

                    foreach (var item in select)
                    {
                        XFAC_Rpt013_Info infoRpt = new XFAC_Rpt013_Info();

                        infoRpt.IdEmpresa    = item.IdEmpresa;
                        infoRpt.nom_empresa  = item.nom_empresa;
                        infoRpt.IdSucursal   = item.IdSucursal;
                        infoRpt.nom_sucursal = item.nom_sucursal;
                        infoRpt.IdCliente    = item.IdCliente;
                        infoRpt.nom_cliente  = item.nom_cliente;
                        infoRpt.Cedula_Ruc   = item.Cedula_Ruc;
                        infoRpt.fecha        = item.fecha;
                        infoRpt.Documento    = item.Documento;
                        infoRpt.Debito       = item.Debito;
                        infoRpt.Credito      = item.Credito;

                        infoRpt.SaldoInicial = item.SaldoInicial;
                        infoRpt.SaldoFinal   = item.SaldoFinal;


                        Saldo         = Saldo + ((item.Debito > 0) ? item.Debito : item.Credito * -1);
                        infoRpt.Saldo = Saldo;


                        infoRpt.vt_Observacion = item.vt_Observacion;



                        lista.Add(infoRpt);
                    }
                }



                return(lista);
            }
            catch (Exception ex)
            {
                MensajeError = ex.InnerException.ToString();
                return(lista);
            }
        }
Пример #2
0
        public List <XFAC_Rpt002_Info> getDatosReporteVentas(int IdEmpresa, int IdSucursalIni, int IdSucursalFin, decimal IdClienteIni, decimal IdClienteFin, DateTime FechaIni, DateTime FechaHasta, string TipoPago)
        {
            try
            {
                List <XFAC_Rpt002_Info> lstReport = new List <XFAC_Rpt002_Info>();
                FechaIni   = Convert.ToDateTime(FechaIni.ToShortDateString());
                FechaHasta = Convert.ToDateTime(FechaHasta.ToShortDateString());

                using (EntitiesFacturacion_Reportes ListadoDocu = new EntitiesFacturacion_Reportes())
                {
                    var select = from q in ListadoDocu.vwFAC_Rpt002
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdSucursal >= IdSucursalIni && q.IdSucursal <= IdSucursalFin &&
                                 q.vt_fecha >= FechaIni && q.vt_fecha <= FechaHasta &&
                                 q.IdCliente >= IdClienteIni && q.IdCliente <= IdClienteFin
                                 select q;

                    if (TipoPago == "PENDI")
                    {
                        select = select.Where(q => q.Saldo > 0);
                    }
                    else
                    {
                        if (TipoPago == "PAGAD")
                        {
                            select = select.Where(q => q.Saldo <= 0);
                        }
                    }

                    Cbt = empresaData.Get_Info_Empresa(IdEmpresa);

                    foreach (var item in select)
                    {
                        XFAC_Rpt002_Info itemInfo = new XFAC_Rpt002_Info();

                        itemInfo.IdEmpresa       = item.IdEmpresa;
                        itemInfo.IdSucursal      = item.IdSucursal;
                        itemInfo.IdBodega        = Convert.ToInt32(item.IdBodega);
                        itemInfo.vt_tipoDoc      = item.vt_tipoDoc;
                        itemInfo.vt_NunDocumento = item.vt_NunDocumento;
                        itemInfo.Referencia      = item.Referencia;
                        itemInfo.IdComprobante   = item.IdComprobante;
                        itemInfo.CodComprobante  = item.CodComprobante;
                        itemInfo.Su_Descripcion  = item.Su_Descripcion;
                        itemInfo.IdCliente       = item.IdCliente;
                        itemInfo.nombreCliente   = item.nombreCliente.Trim();
                        itemInfo.pe_cedulaRuc    = item.pe_cedulaRuc;
                        itemInfo.vt_fecha        = item.vt_fecha;
                        itemInfo.vt_total        = Convert.ToDouble(item.vt_total);
                        itemInfo.Saldo           = Convert.ToDouble(item.Saldo);
                        itemInfo.TotalCobrado    = item.TotalCobrado;
                        itemInfo.vt_Subtotal     = Convert.ToDouble(item.vt_Subtotal);
                        itemInfo.vt_iva          = Convert.ToDouble(item.vt_iva);
                        itemInfo.vt_fech_venc    = item.vt_fech_venc;
                        itemInfo.dc_ValorRetFu   = item.dc_ValorRetFu;
                        itemInfo.dc_ValorRetIva  = item.dc_ValorRetIva;
                        itemInfo.Logo            = Cbt.em_logo_Image;
                        itemInfo.vt_plazo        = item.vt_plazo;
                        itemInfo.IdUsuario       = item.IdUsuario;
                        itemInfo.SubTotal_0      = item.SubTotal_0;
                        itemInfo.SubTotal_Iva    = item.SubTotal_Iva;
                        itemInfo.IdFormaPago     = item.IdFormaPago;
                        itemInfo.nom_FormaPago   = item.IdFormaPago == null ? "" : "[" + item.IdFormaPago.ToString() + "] " + item.nom_FormaPago;
                        lstReport.Add(itemInfo);
                    }
                }
                return(lstReport);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                return(new List <XFAC_Rpt002_Info>());
            }
        }
Пример #3
0
        public List <XFAC_Rpt010_Info> get_Impresion_NC_ND(int IdEmpresa, int IdSucursal, int IdBodega, decimal IdNota)
        {
            try
            {
                List <XFAC_Rpt010_Info> lstRpt = new List <XFAC_Rpt010_Info>();

                using (EntitiesFacturacion_Reportes listado = new EntitiesFacturacion_Reportes())
                {
                    var select = from q in listado.vwFAC_Rpt010
                                 where q.IdEmpresa == IdEmpresa && q.IdSucursal == IdSucursal &&
                                 q.IdBodega == IdBodega && q.IdNota == IdNota
                                 select q;

                    foreach (var item in select)
                    {
                        XFAC_Rpt010_Info infoRpt = new XFAC_Rpt010_Info();

                        infoRpt.IdEmpresa         = item.IdEmpresa;
                        infoRpt.IdSucursal        = item.IdSucursal;
                        infoRpt.IdBodega          = item.IdBodega;
                        infoRpt.IdNota            = item.IdNota;
                        infoRpt.Secuencia         = item.Secuencia;
                        infoRpt.CodTipoNota       = item.CodTipoNota;
                        infoRpt.IdTipoDocumento   = item.IdTipoDocumento;
                        infoRpt.numDocumento      = item.numDocumento;
                        infoRpt.IdCliente         = item.IdCliente;
                        infoRpt.IdVendedor        = item.IdVendedor;
                        infoRpt.pe_nombreCompleto = item.pe_nombreCompleto;
                        infoRpt.pe_cedulaRuc      = item.pe_cedulaRuc;
                        infoRpt.pe_direccion      = item.pe_direccion;
                        infoRpt.Ve_Vendedor       = item.Ve_Vendedor;
                        infoRpt.no_fecha          = item.no_fecha;
                        infoRpt.no_fecha_venc     = Convert.ToDateTime(item.no_fecha_venc);
                        infoRpt.Plazo             = Convert.ToInt32(item.Plazo);
                        infoRpt.IdTipoNota        = item.IdTipoNota;
                        infoRpt.sc_observacion    = item.sc_observacion;
                        infoRpt.IdDevolucion      = Convert.ToDecimal(item.IdDevolucion);
                        infoRpt.interes           = Convert.ToDouble(item.interes);
                        infoRpt.sc_cantidad       = item.sc_cantidad;
                        infoRpt.sc_Precio         = item.sc_Precio;
                        infoRpt.sc_subtotal       = item.sc_subtotal;
                        infoRpt.sc_iva            = item.sc_iva;
                        infoRpt.sc_total          = item.sc_total;
                        infoRpt.IdProducto        = item.IdProducto;
                        infoRpt.bo_Descripcion    = item.bo_Descripcion;
                        infoRpt.IdUsuario         = item.IdUsuario;
                        infoRpt.Su_Descripcion    = item.Su_Descripcion;
                        infoRpt.valorFlete        = Convert.ToDouble(item.valorFlete);
                        infoRpt.IdCaja            = item.IdCaja;
                        infoRpt.Caja           = item.Caja;
                        infoRpt.nombreProducto = item.nombreProducto;

                        lstRpt.Add(infoRpt);
                    }
                }


                return(lstRpt);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                return(new List <XFAC_Rpt010_Info>());
            }
        }
Пример #4
0
        public List <XFAC_Rpt007_Info> get_SoporteFactura(int IdEmpresa, int IdSucursal, int IdBodega, decimal IdCbteVta)
        {
            try
            {
                List <XFAC_Rpt007_Info> lstRpt = new List <XFAC_Rpt007_Info>();

                using (EntitiesFacturacion_Reportes ListadoDocu = new EntitiesFacturacion_Reportes())
                {
                    var select = from q in ListadoDocu.vwFAC_Rpt007
                                 where q.IdEmpresa == IdEmpresa && q.IdSucursal == IdSucursal &&
                                 q.IdBodega == IdBodega && q.IdCbteVta == IdCbteVta
                                 select q;

                    Cbt = empresaData.Get_Info_Empresa(IdEmpresa);

                    foreach (var item in select)
                    {
                        XFAC_Rpt007_Info infoRpt = new XFAC_Rpt007_Info();

                        infoRpt.IdEmpresa         = item.IdEmpresa;
                        infoRpt.IdSucursal        = item.IdSucursal;
                        infoRpt.IdBodega          = item.IdBodega;
                        infoRpt.IdCbteVta         = item.IdCbteVta;
                        infoRpt.CodCbteVta        = item.CodCbteVta;
                        infoRpt.vt_tipoDoc        = item.vt_tipoDoc;
                        infoRpt.numComprobante    = item.numComprobante;
                        infoRpt.IdCliente         = item.IdCliente;
                        infoRpt.IdVendedor        = item.IdVendedor;
                        infoRpt.pe_nombreCompleto = item.pe_nombreCompleto;
                        infoRpt.pe_cedulaRuc      = item.pe_cedulaRuc;
                        infoRpt.pe_direccion      = item.pe_direccion;
                        infoRpt.Ve_Vendedor       = item.Ve_Vendedor;
                        infoRpt.vt_fecha          = item.vt_fecha;
                        infoRpt.vt_fech_venc      = item.vt_fech_venc;
                        infoRpt.vt_plazo          = item.vt_plazo;
                        infoRpt.vt_tipo_venta     = item.vt_tipo_venta;
                        infoRpt.vt_Observacion    = item.vt_Observacion;
                        infoRpt.IdPeriodo         = item.IdPeriodo;
                        infoRpt.vt_anio           = item.vt_anio;
                        infoRpt.vt_mes            = item.vt_mes;
                        infoRpt.vt_cantidad       = item.vt_cantidad;
                        infoRpt.vt_Precio         = item.vt_Precio;
                        infoRpt.vt_Subtotal       = item.vt_Subtotal;
                        infoRpt.vt_iva            = item.vt_iva;
                        infoRpt.vt_total          = item.vt_total;
                        infoRpt.IdProducto        = item.IdProducto;
                        infoRpt.nombreProducto    = item.nombreProducto;
                        infoRpt.vt_autorizacion   = item.vt_autorizacion;
                        infoRpt.IdUsuario         = item.IdUsuario;
                        infoRpt.Su_Descripcion    = item.Su_Descripcion;
                        infoRpt.bo_Descripcion    = item.bo_Descripcion;
                        infoRpt.Logo = Cbt.em_logo_Image;

                        lstRpt.Add(infoRpt);
                    }
                }


                return(lstRpt);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                return(new List <XFAC_Rpt007_Info>());
            }
        }
Пример #5
0
        public List <XFAC_Rpt001_Info> getDatosDocumentos(int IdEmpresa, int IdSucursalIni, int IdSucursalFin, string IdTipoDocumento, DateTime fechaIni, DateTime fechaFin)
        {
            try
            {
                List <XFAC_Rpt001_Info> lstReport = new List <XFAC_Rpt001_Info>();
                fechaIni = Convert.ToDateTime(fechaIni.ToShortDateString());
                fechaFin = Convert.ToDateTime(fechaFin.ToShortDateString());

                using (EntitiesFacturacion_Reportes ListadoDocu = new EntitiesFacturacion_Reportes())
                {
                    var select = from q in ListadoDocu.vwFAC_Rpt001
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdSucursal >= IdSucursalIni && q.IdSucursal <= IdSucursalFin &&
                                 q.vt_fecha >= fechaIni && q.vt_fecha <= fechaFin

                                 select q;

                    if (IdTipoDocumento != "0")
                    {
                        select = from q in ListadoDocu.vwFAC_Rpt001
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdSucursal >= IdSucursalIni && q.IdSucursal <= IdSucursalFin &&
                                 q.vt_fecha >= fechaIni && q.vt_fecha <= fechaFin &&
                                 q.IdTipoDocumento == IdTipoDocumento
                                 select q;
                    }


                    foreach (var item in select)
                    {
                        XFAC_Rpt001_Info itemInfo = new XFAC_Rpt001_Info();

                        itemInfo.IdEmpresa        = item.IdEmpresa;
                        itemInfo.IdSucursal       = item.IdSucursal;
                        itemInfo.IdBodega         = Convert.ToInt32(item.IdBodega);
                        itemInfo.IdTipoDocumento  = item.IdTipoDocumento;
                        itemInfo.numDocumento     = item.numDocumento;
                        itemInfo.IdCliente        = item.IdCliente;
                        itemInfo.nombreCliente    = item.nombreCliente;
                        itemInfo.vt_fecha         = item.vt_fecha;
                        itemInfo.IdCalendario     = item.IdCalendario;
                        itemInfo.AnioFiscal       = Convert.ToInt32(item.AnioFiscal);
                        itemInfo.IdProducto       = item.IdProducto;
                        itemInfo.NombreMes        = item.NombreMes;
                        itemInfo.NombreCortoFecha = item.NombreCortoFecha;
                        itemInfo.vt_cantidad      = item.vt_cantidad;
                        itemInfo.vt_PrecioFinal   = item.vt_PrecioFinal;
                        itemInfo.vt_Subtotal      = item.vt_Subtotal;
                        itemInfo.vt_iva           = item.vt_iva;
                        itemInfo.vt_total         = item.vt_total;

                        itemInfo.IdProducto              = item.IdProducto;
                        itemInfo.nombreProducto          = item.nombreProducto;
                        itemInfo.IdCategoria             = item.IdCategoria;
                        itemInfo.IdLinea                 = item.IdLinea;
                        itemInfo.IdGrupo                 = item.IdGrupo;
                        itemInfo.IdSubgrupo              = item.IdSubgrupo;
                        itemInfo.ca_Categoria            = item.ca_Categoria;
                        itemInfo.nom_linea               = item.nom_linea;
                        itemInfo.nom_grupo               = item.nom_grupo;
                        itemInfo.nom_subgrupo            = item.nom_subgrupo;
                        itemInfo.Idtipo_cliente          = item.Idtipo_cliente;
                        itemInfo.Descripcion_tip_cliente = item.Descripcion_tip_cliente;
                        itemInfo.vt_Observacion          = item.vt_Observacion;
                        itemInfo.IdVendedor              = item.IdVendedor;
                        itemInfo.Vendedor                = item.Vendedor;


                        lstReport.Add(itemInfo);
                    }
                }
                return(lstReport);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                return(new List <XFAC_Rpt001_Info>());
            }
        }
Пример #6
0
        public List <XFAC_Rpt011_Info> get_ImpresionDevolucion(int IdEmpresa, int IdSucursal, int IdBodega, decimal IdDevolucion)
        {
            try
            {
                List <XFAC_Rpt011_Info> lstRpt = new List <XFAC_Rpt011_Info>();

                using (EntitiesFacturacion_Reportes listado = new EntitiesFacturacion_Reportes())
                {
                    var select = from q in listado.vwFAC_Rpt011
                                 where q.IdEmpresa == IdEmpresa && q.IdSucursal == IdSucursal &&
                                 q.IdBodega == IdBodega && q.IdDevolucion == IdDevolucion
                                 select q;

                    Cbt = empresaData.Get_Info_Empresa(IdEmpresa);

                    foreach (var item in select)
                    {
                        XFAC_Rpt011_Info infoRpt = new XFAC_Rpt011_Info();

                        infoRpt.IdEmpresa         = item.IdEmpresa;
                        infoRpt.IdSucursal        = item.IdSucursal;
                        infoRpt.IdBodega          = item.IdBodega;
                        infoRpt.IdDevolucion      = item.IdDevolucion;
                        infoRpt.CodDevolucion     = item.CodDevolucion;
                        infoRpt.IdNota            = item.IdNota;
                        infoRpt.IdCbteVta         = item.IdCbteVta;
                        infoRpt.numDocumento      = item.numDocumento;
                        infoRpt.IdCliente         = item.IdCliente;
                        infoRpt.IdVendedor        = item.IdVendedor;
                        infoRpt.pe_nombreCompleto = item.pe_nombreCompleto;
                        infoRpt.pe_cedulaRuc      = item.pe_cedulaRuc;
                        infoRpt.pe_telefonoCasa   = item.pe_telefonoCasa;
                        infoRpt.pe_direccion      = item.pe_direccion;
                        infoRpt.Ve_Vendedor       = item.Ve_Vendedor;
                        infoRpt.dv_fecha          = item.dv_fecha;
                        infoRpt.dv_Observacion    = item.dv_Observacion;
                        infoRpt.dv_interes        = Convert.ToDouble(item.dv_interes);
                        infoRpt.dv_cantidad       = item.dv_cantidad;
                        infoRpt.dv_valor          = item.dv_valor;
                        infoRpt.dv_subtotal       = item.dv_subtotal;
                        infoRpt.dv_iva            = item.dv_iva;
                        infoRpt.dv_total          = item.dv_total;
                        infoRpt.IdProducto        = item.IdProducto;
                        infoRpt.nombreProducto    = item.nombreProducto;
                        infoRpt.bo_Descripcion    = item.bo_Descripcion;
                        infoRpt.IdUsuario         = item.IdUsuario;
                        infoRpt.Su_Descripcion    = item.Su_Descripcion;
                        infoRpt.valorFlete        = Convert.ToDouble(item.valorFlete);
                        infoRpt.Logo = Cbt.em_logo_Image;

                        lstRpt.Add(infoRpt);
                    }
                }

                return(lstRpt);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                return(new List <XFAC_Rpt011_Info>());
            }
        }
Пример #7
0
        public List <XFAC_Rpt008_Info> get_ImpresionFactura(int IdEmpresa, int IdSucursal, int IdBodega, decimal IdCbteVta, bool mostrar_cuotas)
        {
            try
            {
                List <XFAC_Rpt008_Info> lstRpt = new List <XFAC_Rpt008_Info>();

                using (EntitiesFacturacion_Reportes ListadoDocu = new EntitiesFacturacion_Reportes())
                {
                    if (!mostrar_cuotas)
                    {
                        lstRpt = (from q in ListadoDocu.vwFAC_Rpt008
                                  where q.IdEmpresa == IdEmpresa && q.IdSucursal == IdSucursal &&
                                  q.IdBodega == IdBodega && q.IdCbteVta == IdCbteVta
                                  select new XFAC_Rpt008_Info
                        {
                            IdEmpresa = q.IdEmpresa,
                            IdSucursal = q.IdSucursal,
                            IdBodega = q.IdBodega,
                            IdCbteVta = q.IdCbteVta,
                            Secuencia = q.Secuencia,
                            vt_tipoDoc = q.vt_tipoDoc,
                            vt_serie1 = q.vt_serie1,
                            vt_serie2 = q.vt_serie2,
                            vt_PorDescUnitario = q.vt_PorDescUnitario,
                            vt_NumFactura = q.vt_NumFactura,
                            vt_fecha = q.vt_fecha,
                            Estado = q.Estado,
                            IdProducto = q.IdProducto,
                            pr_descripcion = q.pr_descripcion,
                            pr_descripcion_2 = q.pr_descripcion_2,
                            vt_fech_venc = q.vt_fech_venc,
                            vt_cantidad = q.vt_cantidad,
                            vt_PrecioFinal = q.vt_PrecioFinal,
                            vt_Subtotal = q.vt_Subtotal,
                            Observacion_x_item = q.Observacion_x_item,
                            IdCliente = q.IdCliente,
                            pe_nombreCompleto = q.pe_nombreCompleto,
                            pe_cedulaRuc = q.pe_cedulaRuc,
                            pe_direccion = q.pe_direccion,
                            Observacion_central = q.Observacion_central,
                            dia = q.dia,
                            mes = q.mes,
                            anio = q.anio,
                            vt_iva = q.vt_iva,
                            subtotal_0 = q.subtotal_0,
                            subtotal_iva = q.subtotal_iva,
                            vt_total = q.vt_total,
                            forma_pago_CHEQUE_TRANSFERENCIA = q.forma_pago_CHEQUE_TRANSFERENCIA,
                            forma_pago_DINERO_ELECTRONICO = q.forma_pago_DINERO_ELECTRONICO,
                            forma_pago_EFECTIVO = q.forma_pago_EFECTIVO,
                            forma_pago_TARJETA_CRE_DEB = q.forma_pago_TARJETA_CRE_DEB,
                            descto = q.descto,
                            vt_por_iva = q.vt_por_iva,
                            Descripcion_Ciudad = q.Descripcion_Ciudad,
                            ve_Vendedor = q.Ve_Vendedor,
                            lote_fecha_fab = q.lote_fecha_fab,
                            lote_fecha_vcto = q.lote_fecha_vcto,
                            lote_num_lote = q.lote_num_lote,
                            pe_razonSocial = q.pe_razonSocial,
                            vt_Precio = q.vt_Precio,
                            vt_DescUnitario = q.vt_DescUnitario
                        }).ToList();
                    }
                    else
                    {
                        lstRpt = (from q in ListadoDocu.vwFAC_Rpt008_cuotas
                                  where q.IdEmpresa == IdEmpresa && q.IdSucursal == IdSucursal &&
                                  q.IdBodega == IdBodega && q.IdCbteVta == IdCbteVta
                                  select new XFAC_Rpt008_Info
                        {
                            IdEmpresa = q.IdEmpresa,
                            IdSucursal = q.IdSucursal,
                            IdBodega = q.IdBodega,
                            IdCbteVta = q.IdCbteVta,
                            Secuencia = q.Secuencia,
                            vt_tipoDoc = q.vt_tipoDoc,
                            vt_serie1 = q.vt_serie1,
                            vt_serie2 = q.vt_serie2,
                            vt_PorDescUnitario = q.vt_PorDescUnitario,
                            vt_NumFactura = q.vt_NumFactura,
                            vt_fecha = q.vt_fecha,
                            Estado = q.Estado,
                            IdProducto = q.IdProducto,
                            pr_descripcion = q.pr_descripcion,
                            pr_descripcion_2 = q.pr_descripcion_2,
                            vt_fech_venc = q.vt_fech_venc,
                            vt_cantidad = q.vt_cantidad,
                            vt_PrecioFinal = q.vt_PrecioFinal,
                            vt_Subtotal = q.vt_Subtotal,
                            Observacion_x_item = q.Observacion_x_item,
                            IdCliente = q.IdCliente,
                            pe_nombreCompleto = q.pe_nombreCompleto,
                            pe_cedulaRuc = q.pe_cedulaRuc,
                            pe_direccion = q.pe_direccion,
                            Observacion_central = q.Observacion_central,
                            dia = q.dia,
                            mes = q.mes,
                            anio = q.anio,
                            vt_iva = q.vt_iva,
                            subtotal_0 = q.subtotal_0,
                            subtotal_iva = q.subtotal_iva,
                            vt_total = q.vt_total,
                            forma_pago_CHEQUE_TRANSFERENCIA = q.forma_pago_CHEQUE_TRANSFERENCIA,
                            forma_pago_DINERO_ELECTRONICO = q.forma_pago_DINERO_ELECTRONICO,
                            forma_pago_EFECTIVO = q.forma_pago_EFECTIVO,
                            forma_pago_TARJETA_CRE_DEB = q.forma_pago_TARJETA_CRE_DEB,
                            descto = q.descto,
                            vt_por_iva = q.vt_por_iva,
                            Descripcion_Ciudad = q.Descripcion_Ciudad,
                            ve_Vendedor = q.Ve_Vendedor,
                            lote_fecha_fab = q.lote_fecha_fab,
                            lote_fecha_vcto = q.lote_fecha_vcto,
                            lote_num_lote = q.lote_num_lote,
                            pe_razonSocial = q.pe_razonSocial,
                            vt_Precio = q.vt_Precio,
                            vt_DescUnitario = q.vt_DescUnitario,
                            orden = q.orden
                        }).ToList();
                    }
                }

                lstRpt.ForEach(q =>
                {
                    q.vt_DescUnitario = q.vt_DescUnitario * q.vt_cantidad;
                    q.subtotal_iva    = q.subtotal_iva > 0 ? (q.subtotal_iva + q.vt_DescUnitario) : 0;
                    q.subtotal_0      = q.subtotal_0 > 0 ? (q.subtotal_0 + q.vt_DescUnitario) : 0;
                });
                return(lstRpt.OrderBy(q => q.Secuencia).ThenBy(q => q.orden).ToList());
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                return(new List <XFAC_Rpt008_Info>());
            }
        }
Пример #8
0
        public List <XFAC_Rpt006_Info> getDevolucionVentas(int IdEmpresa, int IdSucursalIni, int IdSucursalFin, decimal IdClienteIni, decimal IdClienteFin, DateTime FechaIni, DateTime FechaHasta)
        {
            try
            {
                List <XFAC_Rpt006_Info> lstReport = new List <XFAC_Rpt006_Info>();
                FechaIni   = Convert.ToDateTime(FechaIni.ToShortDateString());
                FechaHasta = Convert.ToDateTime(FechaHasta.ToShortDateString());

                using (EntitiesFacturacion_Reportes ListadoDocu = new EntitiesFacturacion_Reportes())
                {
                    var select = from q in ListadoDocu.vwFAC_Rpt006
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdSucursal >= IdSucursalIni && q.IdSucursal <= IdSucursalFin &&
                                 q.dv_fecha >= FechaIni && q.dv_fecha <= FechaHasta &&
                                 q.IdCliente >= IdClienteIni && q.IdCliente <= IdClienteFin
                                 select q;

                    Cbt = empresaData.Get_Info_Empresa(IdEmpresa);

                    foreach (var item in select)
                    {
                        XFAC_Rpt006_Info itemInfo = new XFAC_Rpt006_Info();

                        itemInfo.IdEmpresa         = item.IdEmpresa;
                        itemInfo.IdSucursal        = item.IdSucursal;
                        itemInfo.IdBodega          = Convert.ToInt32(item.IdBodega);
                        itemInfo.pe_nombreCompleto = item.pe_nombreCompleto;
                        itemInfo.IdDevolucion      = item.IdDevolucion;
                        itemInfo.CodDevolucion     = item.CodDevolucion;
                        itemInfo.IdNota            = item.IdNota;
                        itemInfo.IdCliente         = item.IdCliente;
                        itemInfo.IdVendedor        = item.IdVendedor;
                        itemInfo.IdCbteVta         = item.IdCbteVta;
                        itemInfo.dv_fecha          = item.dv_fecha;
                        itemInfo.Estado            = item.Estado;
                        itemInfo.dv_Observacion    = item.dv_Observacion;
                        itemInfo.IdUsuario         = item.IdUsuario;
                        itemInfo.Su_Descripcion    = item.Su_Descripcion;
                        itemInfo.bo_Descripcion    = item.bo_Descripcion;
                        itemInfo.dv_total          = Convert.ToDouble(item.dv_total);
                        itemInfo.dv_iva            = Convert.ToDouble(item.dv_iva);
                        itemInfo.dv_subtotal       = Convert.ToDouble(item.dv_subtotal);
                        itemInfo.Ve_Vendedor       = item.Ve_Vendedor;
                        itemInfo.vt_NumFactura     = item.vt_NumFactura;
                        itemInfo.Logo = Cbt.em_logo_Image;

                        lstReport.Add(itemInfo);
                    }
                }
                return(lstReport);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                return(new List <XFAC_Rpt006_Info>());
            }
        }
Пример #9
0
        public List <XFAC_Rpt005_Info> getDatosRpt_NDC_NDB_Producto(int IdEmpresa, int IdSucursalIni, int IdSucursalFin, decimal IdClienteIni, decimal IdClienteFin, DateTime FechaIni, DateTime FechaHasta, string TipoPago, string IdTipoDoc, int IdTipoNotaIni, int IdTipoNotaFin)
        {
            try
            {
                List <XFAC_Rpt005_Info> lstReport = new List <XFAC_Rpt005_Info>();
                FechaIni   = Convert.ToDateTime(FechaIni.ToShortDateString());
                FechaHasta = Convert.ToDateTime(FechaHasta.ToShortDateString());

                using (EntitiesFacturacion_Reportes ListadoDocu = new EntitiesFacturacion_Reportes())
                {
                    var select = from q in ListadoDocu.vwFAC_Rpt005
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdSucursal >= IdSucursalIni && q.IdSucursal <= IdSucursalFin &&
                                 q.no_fecha >= FechaIni && q.no_fecha <= FechaHasta &&
                                 q.IdCliente >= IdClienteIni && q.IdCliente <= IdClienteFin &&
                                 q.IdTipoDocumento == IdTipoDoc &&
                                 q.IdTipoNota >= IdTipoNotaIni && q.IdTipoNota <= IdTipoNotaFin
                                 select q;

                    if (TipoPago == "PENDI")
                    {
                        select = select.Where(q => q.Saldo > 0);
                    }
                    else
                    {
                        if (TipoPago == "PAGAD")
                        {
                            select = select.Where(q => q.Saldo <= 0);
                        }
                    }

                    Cbt = empresaData.Get_Info_Empresa(IdEmpresa);

                    foreach (var item in select)
                    {
                        XFAC_Rpt005_Info itemInfo = new XFAC_Rpt005_Info();

                        itemInfo.IdEmpresa       = item.IdEmpresa;
                        itemInfo.IdSucursal      = item.IdSucursal;
                        itemInfo.IdBodega        = Convert.ToInt32(item.IdBodega);
                        itemInfo.IdTipoDocumento = item.IdTipoDocumento;
                        itemInfo.numDocumento    = item.numDocumento;
                        itemInfo.Referencia      = item.Referencia;
                        itemInfo.IdComprobante   = item.IdComprobante;
                        itemInfo.CodComprobante  = item.CodComprobante;
                        itemInfo.Su_Descripcion  = item.Su_Descripcion;
                        itemInfo.IdCliente       = item.IdCliente;
                        itemInfo.nombreCliente   = item.nombreCliente;
                        itemInfo.no_fecha        = item.no_fecha;
                        itemInfo.vt_total        = Convert.ToDouble(item.vt_total);
                        itemInfo.Saldo           = Convert.ToDouble(item.Saldo);
                        itemInfo.TotalCobrado    = Convert.ToDouble(item.TotalCobrado);
                        itemInfo.vt_Subtotal     = Convert.ToDouble(item.vt_Subtotal);
                        itemInfo.vt_iva          = Convert.ToDouble(item.vt_iva);
                        itemInfo.no_fecha_venc   = Convert.ToDateTime(item.no_fecha_venc);
                        itemInfo.IdProducto      = item.IdProducto;
                        itemInfo.nombreProducto  = item.nombreProducto;
                        itemInfo.Logo            = Cbt.em_logo_Image;
                        itemInfo.sc_cantidad     = Convert.ToDouble(item.sc_cantidad);
                        itemInfo.sc_precioFinal  = Convert.ToDouble(item.sc_precioFinal);
                        itemInfo.CodTipoNota     = item.CodTipoNota;
                        itemInfo.IdTipoNota      = item.IdTipoNota;
                        itemInfo.Plazo           = Convert.ToInt32(item.Plazo);
                        itemInfo.IdUsuario       = item.IdUsuario;
                        lstReport.Add(itemInfo);
                    }
                }
                return(lstReport);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                return(new List <XFAC_Rpt005_Info>());
            }
        }
Пример #10
0
        public List <XFAC_Rpt012_Info> get_list(int IdEmpresa, int IdSucursal, decimal IdProforma, bool buscar_imagen)
        {
            try
            {
                List <XFAC_Rpt012_Info> Lista;

                using (EntitiesFacturacion_Reportes Context = new EntitiesFacturacion_Reportes())
                {
                    Lista = (from q in Context.vwFAC_Rpt012
                             where q.IdEmpresa == IdEmpresa &&
                             q.IdSucursal == IdSucursal &&
                             q.IdProforma == IdProforma
                             select new XFAC_Rpt012_Info
                    {
                        IdRow = q.IdRow,
                        IdEmpresa = q.IdEmpresa,
                        IdSucursal = q.IdSucursal,
                        IdProforma = q.IdProforma,
                        Secuencia = q.Secuencia,
                        nom_TerminoPago = q.nom_TerminoPago,
                        pf_plazo = q.pf_plazo,
                        pf_codigo = q.pf_codigo,
                        pf_fecha = q.pf_fecha,
                        estado = q.estado,
                        pf_atencion_a = q.pf_atencion_a,
                        Codigo = q.Codigo,
                        Ve_Vendedor = q.Ve_Vendedor,
                        pr_descripcion = q.pr_descripcion,
                        pd_cantidad = q.pd_cantidad,
                        pd_precio = q.pd_precio,
                        pd_por_descuento_uni = q.pd_por_descuento_uni,
                        pd_descuento_uni = q.pd_descuento_uni,
                        pd_precio_final = q.pd_precio_final,
                        pd_subtotal = q.pd_subtotal,
                        pd_por_iva = q.pd_por_iva,
                        pd_iva = q.pd_iva,
                        pd_total = q.pd_total,
                        nom_marca = q.nom_marca,
                        nom_modelo = q.nom_modelo,
                        IdProducto = q.IdProducto,
                        observacion = q.pr_observacion,
                        pf_dias_entrega = q.pr_dias_entrega,
                    }).ToList();
                }
                if (buscar_imagen)
                {
                    using (EntitiesInventario Context = new EntitiesInventario())
                    {
                        foreach (var item in Lista)
                        {
                            var lst = from q in Context.in_Producto_imagenes
                                      where q.IdEmpresa == item.IdEmpresa &&
                                      q.IdProducto == item.IdProducto &&
                                      q.Secuencia == 1
                                      select q;

                            if (lst.Count() > 0)
                            {
                                if (lst.FirstOrDefault().Imagen != null)
                                {
                                    MemoryStream ms = new MemoryStream(lst.FirstOrDefault().Imagen);
                                    item.Imagen_image = System.Drawing.Bitmap.FromStream(ms);
                                }
                            }
                        }
                    }
                }

                return(Lista);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #11
0
        public List <XFAC_Rpt014_Info> Get_List_Data_Reporte(int IdEmpresa, decimal IdCliente, int Numguia, ref string MensajeError)
        {
            List <XFAC_Rpt014_Info> lista = new List <XFAC_Rpt014_Info>();

            try
            {
                using (EntitiesFacturacion_Reportes listado = new EntitiesFacturacion_Reportes())
                {
                    var select = from q in listado.vwFAC_Rpt014
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdCliente == IdCliente
                                 select q;
                    ;

                    foreach (var item in select)
                    {
                        XFAC_Rpt014_Info infoRpt = new XFAC_Rpt014_Info();

                        infoRpt.IdEmpresa              = item.IdEmpresa;
                        infoRpt.IdSucursal             = item.IdSucursal;
                        infoRpt.IdBodega               = item.IdBodega;
                        infoRpt.IdGuiaRemision         = item.IdGuiaRemision;
                        infoRpt.CodGuiaRemision        = item.CodGuiaRemision;
                        infoRpt.CodDocumentoTipo       = item.CodDocumentoTipo;
                        infoRpt.Serie1                 = item.Serie1;
                        infoRpt.Serie2                 = item.Serie2;
                        infoRpt.NumGuia_Preimpresa     = item.NumGuia_Preimpresa;
                        infoRpt.Fecha_Autorizacion     = item.Fecha_Autorizacion;
                        infoRpt.NUAutorizacion         = item.NUAutorizacion;
                        infoRpt.gi_fecha               = item.gi_fecha;
                        infoRpt.gi_fech_venc           = item.gi_fech_venc;
                        infoRpt.gi_Observacion         = item.gi_Observacion;
                        infoRpt.gi_FechaInicioTraslado = item.gi_FechaInicioTraslado;
                        infoRpt.gi_FechaFinTraslado    = item.gi_FechaFinTraslado;
                        infoRpt.placa            = item.placa;
                        infoRpt.ruta             = item.ruta;
                        infoRpt.Direccion_Origen = item.Direccion_Origen;
                        infoRpt.pe_apellido      = item.pe_apellido;
                        infoRpt.pe_nombre        = item.pe_nombre;
                        infoRpt.pe_cedulaRuc     = item.pe_cedulaRuc;
                        infoRpt.vt_serie1        = item.vt_serie1;
                        infoRpt.vt_serie2        = item.vt_serie2;
                        infoRpt.vt_NumFactura    = item.vt_NumFactura;
                        infoRpt.Nombre           = item.Nombre;
                        infoRpt.Cedula           = item.Cedula;
                        infoRpt.gi_cantidad      = item.gi_cantidad;
                        infoRpt.pr_descripcion   = item.pr_descripcion;
                        infoRpt.gi_detallexItems = item.gi_detallexItems;
                        infoRpt.pr_codigo        = item.pr_codigo;
                        lista.Add(infoRpt);
                    }
                }



                return(lista);
            }
            catch (Exception ex)
            {
                MensajeError = ex.InnerException.ToString();
                return(lista);
            }
        }
Пример #12
0
        public List <XFAC_Rpt004_Info> getDatosRpt_NDC_NDB(int IdEmpresa, int IdSucursalIni, int IdSucursalFin, decimal IdClienteIni, decimal IdClienteFin, DateTime FechaIni, DateTime FechaHasta, string TipoPago, string IdTipoDoc, List <int> IdTipoNota, string TipoNota)
        {
            try
            {
                FechaIni   = Convert.ToDateTime(FechaIni.ToShortDateString());
                FechaHasta = Convert.ToDateTime(FechaHasta.ToShortDateString());

                #region Optengo el resumen

                List <XFAC_Rpt004_Info> lstDetalle = new List <XFAC_Rpt004_Info>();

                using (EntitiesFacturacion_Reportes ListadoDocu = new EntitiesFacturacion_Reportes())
                {
                    var select_detalle = from q in ListadoDocu.vwFAC_Rpt004_Detalle
                                         where q.IdEmpresa == IdEmpresa &&
                                         q.IdSucursal >= IdSucursalIni && q.IdSucursal <= IdSucursalFin &&
                                         q.no_fecha >= FechaIni && q.no_fecha <= FechaHasta &&
                                         q.IdCliente >= IdClienteIni && q.IdCliente <= IdClienteFin &&
                                         q.IdTipoDocumento == IdTipoDoc &&
                                         IdTipoNota.Contains(q.IdTipoNota) &&
                                         q.NaturalezaNota.Contains(TipoNota)

                                         select q;

                    if (TipoPago == "PENDI")
                    {
                        select_detalle = select_detalle.Where(q => q.Saldo > 0);
                    }
                    else
                    {
                        if (TipoPago == "PAGAD")
                        {
                            select_detalle = select_detalle.Where(q => q.Saldo <= 0);
                        }
                    }

                    foreach (var item_detalle in select_detalle)
                    {
                        XFAC_Rpt004_Info itemInfo_detalle = new XFAC_Rpt004_Info();

                        itemInfo_detalle.IdEmpresa          = item_detalle.IdEmpresa;
                        itemInfo_detalle.IdSucursal         = item_detalle.IdSucursal;
                        itemInfo_detalle.IdTipoDocumento    = item_detalle.IdTipoDocumento;
                        itemInfo_detalle.IdComprobante      = item_detalle.IdNota.ToString();
                        itemInfo_detalle.IdCliente          = item_detalle.IdCliente;
                        itemInfo_detalle.no_fecha           = item_detalle.no_fecha;
                        itemInfo_detalle.SubTotal           = item_detalle.sc_subtotal;
                        itemInfo_detalle.vt_iva             = item_detalle.sc_iva;
                        itemInfo_detalle.total              = item_detalle.sc_total;
                        itemInfo_detalle.vt_total           = item_detalle.sc_total;
                        itemInfo_detalle.IdCod_Impuesto_Iva = item_detalle.IdCod_Impuesto_Iva;

                        itemInfo_detalle.Saldo        = item_detalle.Saldo;
                        itemInfo_detalle.TotalCobrado = item_detalle.TotalCobrado;

                        itemInfo_detalle.IdTipoNota = item_detalle.IdTipoNota;


                        itemInfo_detalle.NaturalezaNota = item_detalle.NaturalezaNota;
                        lstDetalle.Add(itemInfo_detalle);
                    }
                }

                //agrupando para encontrar el resumen



                //var TdebitosxCta = from Cb in lmcbi
                //                   where Cb._cbteCble_det_info.dc_Valor > 0
                //                   orderby Cb._cbteCble_det_info.IdCtaCble
                //                   group Cb by new { Cb.IdEmpresa, Cb._cbteCble_det_info.IdCtaCble }
                //                       into grouping
                //                       select new { grouping.Key, totaldebidoxCta = grouping.Sum(p => p._cbteCble_det_info.dc_Valor) };


                var Resume_x_NC = from G in lstDetalle
                                  group G by new { G.IdCod_Impuesto_Iva }
                into grouping
                    select new { grouping.Key, SubTotal = grouping.Sum(p => p.SubTotal), Iva = grouping.Sum(p => p.vt_iva), Total = grouping.Sum(p => p.total) };

                List <XFAC_Rpt004_Resumen_x_Subtotal_x_Iva_Info> listResumen_x_NC = new List <XFAC_Rpt004_Resumen_x_Subtotal_x_Iva_Info>();


                foreach (var item_res_x_NC in Resume_x_NC)
                {
                    XFAC_Rpt004_Resumen_x_Subtotal_x_Iva_Info Info_res_x_NC = new XFAC_Rpt004_Resumen_x_Subtotal_x_Iva_Info();

                    Info_res_x_NC.Detalle            = "Totales Notas x ";
                    Info_res_x_NC.sc_subtotal        = item_res_x_NC.SubTotal;
                    Info_res_x_NC.sc_iva             = (item_res_x_NC.Iva == null)?0:Convert.ToDouble(item_res_x_NC.Iva);
                    Info_res_x_NC.sc_total           = (item_res_x_NC.Total == null)?0:Convert.ToDouble(item_res_x_NC.Total);
                    Info_res_x_NC.IdCod_Impuesto_Iva = item_res_x_NC.Key.IdCod_Impuesto_Iva;
                    listResumen_x_NC.Add(Info_res_x_NC);
                }

                #endregion


                List <XFAC_Rpt004_Info> lstReport = new List <XFAC_Rpt004_Info>();

                using (EntitiesFacturacion_Reportes ListadoDocu = new EntitiesFacturacion_Reportes())
                {
                    var select = from q in ListadoDocu.vwFAC_Rpt004
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdSucursal >= IdSucursalIni && q.IdSucursal <= IdSucursalFin &&
                                 q.no_fecha >= FechaIni && q.no_fecha <= FechaHasta &&
                                 q.IdCliente >= IdClienteIni && q.IdCliente <= IdClienteFin &&
                                 q.IdTipoDocumento == IdTipoDoc &&
                                 IdTipoNota.Contains(q.IdTipoNota) &&
                                 q.NaturalezaNota.Contains(TipoNota)
                                 select q;

                    if (TipoPago == "PENDI")
                    {
                        select = select.Where(q => q.Saldo > 0);
                    }
                    else
                    {
                        if (TipoPago == "PAGAD")
                        {
                            select = select.Where(q => q.Saldo <= 0);
                        }
                    }

                    Cbt = empresaData.Get_Info_Empresa(IdEmpresa);

                    foreach (var item in select)
                    {
                        XFAC_Rpt004_Info itemInfo = new XFAC_Rpt004_Info();

                        itemInfo.IdEmpresa       = item.IdEmpresa;
                        itemInfo.IdSucursal      = item.IdSucursal;
                        itemInfo.IdBodega        = item.IdBodega;
                        itemInfo.IdTipoDocumento = item.IdTipoDocumento;
                        itemInfo.numDocumento    = item.numDocumento;
                        itemInfo.Referencia      = item.Referencia;
                        itemInfo.IdComprobante   = item.IdComprobante;
                        itemInfo.CodComprobante  = item.CodComprobante;
                        itemInfo.Su_Descripcion  = item.Su_Descripcion;
                        itemInfo.IdCliente       = item.IdCliente;
                        itemInfo.nombreCliente   = item.nombreCliente;
                        itemInfo.pe_cedulaRuc    = item.pe_cedulaRuc;
                        itemInfo.no_fecha        = item.no_fecha;
                        itemInfo.vt_total        = item.vt_total;
                        itemInfo.Saldo           = item.Saldo;
                        itemInfo.TotalCobrado    = item.TotalCobrado;
                        itemInfo.SubTotal_0      = item.SubTotal_0;
                        itemInfo.SubTotal_Iva    = item.SubTotal_Iva;
                        itemInfo.vt_iva          = item.vt_iva;
                        itemInfo.total           = item.total;
                        itemInfo.no_fecha_venc   = item.no_fecha_venc;
                        itemInfo.IdTipoNota      = item.IdTipoNota;
                        itemInfo.CodTipoNota     = item.CodTipoNota;
                        itemInfo.No_Descripcion  = item.No_Descripcion;
                        itemInfo.Plazo           = item.Plazo;
                        itemInfo.IdUsuario       = item.IdUsuario;
                        itemInfo.em_nombre       = item.em_nombre;
                        itemInfo.NaturalezaNota  = item.NaturalezaNota;

                        itemInfo.list_resumen_x_Subtotal = listResumen_x_NC;



                        lstReport.Add(itemInfo);
                    }
                }

                return(lstReport);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                return(new List <XFAC_Rpt004_Info>());
            }
        }