コード例 #1
0
ファイル: XCOMP_Rpt007_Data.cs プロジェクト: arocajorge/ERPFJ
        public List <XCOMP_Rpt007_Info> Get_Lista(int _IdEmpresa, int _IdSucursal, int _IdSucursalFin, DateTime FechaCorte, int _Alerta, int _AlertaFin)
        {
            try
            {
                List <XCOMP_Rpt007_Info> Lista = new List <XCOMP_Rpt007_Info>();
                using (EntitiesCompra_reporte_Ge DbContext = new EntitiesCompra_reporte_Ge())
                {
                    Lista = (from q in DbContext.spCOMP_Rpt007(_IdEmpresa, _IdSucursal, _IdSucursalFin, FechaCorte)
                             where _Alerta <= q.Alerta && q.Alerta <= _AlertaFin
                             select new XCOMP_Rpt007_Info
                    {
                        IdEmpresa = q.IdEmpresa,
                        Nom_Empresa = q.Nom_Empresa,
                        IdSucursal = q.IdSucursal,
                        Nom_Sucursal = q.Nom_Sucursal,
                        Fecha_Corte = q.Fecha_Corte,
                        IdMes1_anio = q.IdMes1_anio,
                        IdMes2_anio = q.IdMes2_anio,
                        IdMes3_anio = q.IdMes3_anio,
                        IdMes4_anio = q.IdMes4_anio,
                        Nom_Mes1_anio = q.Nom_Mes1_anio,
                        Nom_Mes2_anio = q.Nom_Mes2_anio,
                        Nom_Mes3_anio = q.Nom_Mes3_anio,
                        Nom_Mes4_anio = q.Nom_Mes4_anio,
                        Cant_Mes1_anio = q.Cant_Mes1_anio,
                        Cant_Mes2_anio = q.Cant_Mes2_anio,
                        Cant_Mes3_anio = q.Cant_Mes3_anio,
                        Cant_Mes4_anio = q.Cant_Mes4_anio,
                        Prom_cant_x_comp = q.Prom_cant_x_comp,
                        IdProducto = q.IdProducto,
                        Cod_Producto = q.Cod_Producto,
                        nom_producto = q.nom_producto,
                        stock_min = q.stock_min,
                        stock_a_la_fecha = q.stock_a_la_fecha,
                        Alerta = q.Alerta,
                        varianza = q.varianza
                    }).ToList();
                }
                return(Lista);
            }
            catch (Exception ex)
            {
                string MensajeError = "";
                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(), "", "", "", "", "", "", "", DateTime.Now);
                MensajeError = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);

                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Get_Data_Reporte", ex.Message), ex)
                      {
                          EntityType = typeof(XCOMP_Rpt007_Data)
                      };
            }
        }
コード例 #2
0
        public List <XCOMP_Rpt006_Info> get_Presupuesto_Solicitud(List <XCOMP_Rpt006_Info> lstIdPresupuestoCompra)
        {
            try
            {
                List <XCOMP_Rpt006_Info> lstInfo = new List <XCOMP_Rpt006_Info>();
                using (EntitiesCompra_reporte_Ge listado = new EntitiesCompra_reporte_Ge())
                {
                    var select = from q in lstIdPresupuestoCompra
                                 join c in listado.vwCOMP_Rpt006 on new { q.IdEmpresa, q.IdSucursal, q.IdSolicitudCompra, q.Secuencia_SC }
                    equals new { c.IdEmpresa, c.IdSucursal, c.IdSolicitudCompra, c.Secuencia_SC }
                    select c;

                    Cbt = empresaData.Get_Info_Empresa(lstIdPresupuestoCompra.First().IdEmpresa);

                    foreach (var item in select)
                    {
                        XCOMP_Rpt006_Info Info = new XCOMP_Rpt006_Info();
                        Info.IdEmpresa           = item.IdEmpresa;
                        Info.IdSucursal          = item.IdSucursal;
                        Info.IdSolicitudCompra   = item.IdSolicitudCompra;
                        Info.Secuencia_SC        = item.Secuencia_SC;
                        Info.IdProducto_SC       = item.IdProducto_SC;
                        Info.Su_Descripcion      = item.Su_Descripcion;
                        Info.NomProducto_SC      = item.NomProducto_SC;
                        Info.Cantidad_aprobada   = item.Cantidad_aprobada;
                        Info.IdUsuarioAprueba    = item.IdUsuarioAprueba;
                        Info.FechaHoraAprobacion = item.FechaHoraAprobacion;
                        Info.observacion         = item.observacion;
                        Info.IdUnidadMedida      = item.IdUnidadMedida;
                        Info.Descripcion         = item.Descripcion;
                        Info.do_precioCompra     = item.do_precioCompra;
                        Info.do_porc_des         = item.do_porc_des;
                        Info.do_subtotal         = item.do_subtotal;
                        Info.do_iva                        = item.do_iva;
                        Info.do_total                      = item.do_total;
                        Info.do_ManejaIva                  = item.do_ManejaIva;
                        Info.IdPunto_cargo                 = item.IdPunto_cargo;
                        Info.IdDepartamento                = item.IdDepartamento;
                        Info.de_descripcion                = item.de_descripcion;
                        Info.IdProveedor                   = item.IdProveedor;
                        Info.pr_nombre                     = item.pr_nombre;
                        Info.IdPersona                     = item.IdPersona;
                        Info.nomSolicitante                = item.nomSolicitante;
                        Info.IdEstadoAprobacion            = item.IdEstadoAprobacion;
                        Info.IdEstadoPreAprobacion         = item.IdEstadoPreAprobacion;
                        Info.DescrpcionEstadoAprobacion    = item.DescrpcionEstadoAprobacion;
                        Info.DescrpcionEstadoPreAprobacion = item.DescrpcionEstadoPreAprobacion;
                        Info.codPunto_cargo                = item.codPunto_cargo;
                        Info.nom_punto_cargo               = item.nom_punto_cargo;
                        Info.NomEmpresa                    = Cbt.em_nombre;
                        Info.Logo = Cbt.em_logo_Image;
                        lstInfo.Add(Info);
                    }
                }
                return(lstInfo);
            }
            catch (Exception ex)
            {
                string MensajeError = "";
                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(), "", "", "", "", "", "", "", DateTime.Now);
                MensajeError = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Get_Data_Reporte", ex.Message), ex)
                      {
                          EntityType = typeof(XCOMP_Rpt006_Data)
                      };
            }
        }
コード例 #3
0
        public List <XCOMP_Rpt008_Info> get_list(int IdEmpresa, int IdSucursal, decimal IdProducto, DateTime Fecha_ini, DateTime Fecha_fin, bool no_mostrar_promedio_0)
        {
            try
            {
                List <XCOMP_Rpt008_Info> Lista = new List <XCOMP_Rpt008_Info>();

                int IdSucursal_ini = IdSucursal;
                int IdSucursal_fin = IdSucursal == 0 ? 9999 : IdSucursal;

                decimal IdProducto_ini = IdProducto;
                decimal IdProducto_fin = IdProducto == 0 ? 99999 : IdProducto;

                Fecha_ini = Fecha_ini.Date;
                Fecha_fin = Fecha_fin.Date;

                using (EntitiesCompra_reporte_Ge Context = new EntitiesCompra_reporte_Ge())
                {
                    IQueryable <vwCOMP_Rpt008> lst;
                    if (no_mostrar_promedio_0)
                    {
                        lst = from q in Context.vwCOMP_Rpt008
                              where q.IdEmpresa == IdEmpresa &&
                              IdSucursal_ini <= q.IdSucursal && q.IdSucursal <= IdSucursal_fin &&
                              IdProducto_ini <= q.IdProducto && q.IdProducto <= IdProducto_fin &&
                              Fecha_ini <= q.oc_fecha && q.oc_fecha <= Fecha_fin &&
                              q.ult_costo > 0
                              select q;
                    }
                    else
                    {
                        lst = from q in Context.vwCOMP_Rpt008
                              where q.IdEmpresa == IdEmpresa &&
                              IdSucursal_ini <= q.IdSucursal && q.IdSucursal <= IdSucursal_fin &&
                              IdProducto_ini <= q.IdProducto && q.IdProducto <= IdProducto_fin &&
                              Fecha_ini <= q.oc_fecha && q.oc_fecha <= Fecha_fin
                              select q;
                    }

                    foreach (var item in lst)
                    {
                        XCOMP_Rpt008_Info info = new XCOMP_Rpt008_Info();
                        info.IdEmpresa       = item.IdEmpresa;
                        info.IdSucursal      = item.IdSucursal;
                        info.IdOrdenCompra   = item.IdOrdenCompra;
                        info.Secuencia       = item.Secuencia;
                        info.IdProducto      = item.IdProducto;
                        info.pr_codigo       = item.pr_codigo;
                        info.pr_descripcion  = item.pr_descripcion;
                        info.IdPunto_cargo   = item.IdPunto_cargo;
                        info.nom_punto_cargo = item.nom_punto_cargo;
                        info.oc_fecha        = item.oc_fecha;
                        info.do_Cantidad     = item.do_Cantidad;
                        info.do_precioCompra = item.do_precioCompra;
                        info.ult_costo       = item.ult_costo;
                        info.diferencia      = item.diferencia;
                        Lista.Add(info);
                    }
                }

                return(Lista);
            }
            catch (Exception ex)
            {
                string MensajeError = "";
                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(), "", "", "", "", "", "", "", DateTime.Now);
                MensajeError = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);

                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "get_list", ex.Message), ex)
                      {
                          EntityType = typeof(XCOMP_Rpt008_Data)
                      };
            }
        }
コード例 #4
0
        public List <XCOMP_Rpt004_Info> Cargar_data(int idempresa, DateTime FechaIni, DateTime FechaFin)
        {
            try
            {
                List <XCOMP_Rpt004_Info> listadedatos = new List <XCOMP_Rpt004_Info>();
                FechaIni = Convert.ToDateTime(FechaIni.ToShortDateString());
                FechaFin = Convert.ToDateTime(FechaFin.ToShortDateString());


                using (EntitiesCompra_reporte_Ge ListadoOrdenCompra = new EntitiesCompra_reporte_Ge())
                {
                    var select = from h in ListadoOrdenCompra.vwCOMP_Rpt004
                                 where h.IdEmpresa == idempresa &&
                                 h.oc_fecha >= FechaIni && h.oc_fecha <= FechaFin
                                 select h;

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


                        itemInfo.IdEmpresa       = item.IdEmpresa;
                        itemInfo.IdSucursal      = item.IdSucursal;
                        itemInfo.IdOrdenCompra   = item.IdOrdenCompra;
                        itemInfo.documento       = item.documento;
                        itemInfo.oc_fecha        = item.oc_fecha;
                        itemInfo.oc_observacion  = item.oc_observacion;
                        itemInfo.IdComprador     = item.IdComprador;
                        itemInfo.nom_comprador   = item.nom_comprador;
                        itemInfo.IdProveedor     = item.IdProveedor;
                        itemInfo.nom_proveedor   = item.nom_proveedor;
                        itemInfo.IdMotivo        = item.IdMotivo;
                        itemInfo.Nom_motivo_oc   = item.Nom_motivo_oc;
                        itemInfo.IdProducto      = item.IdProducto;
                        itemInfo.nom_producto    = item.nom_producto;
                        itemInfo.do_Cantidad     = item.do_Cantidad;
                        itemInfo.precio          = item.precio;
                        itemInfo.do_subtotal     = item.do_subtotal;
                        itemInfo.do_iva          = item.do_iva;
                        itemInfo.do_total        = item.do_total;
                        itemInfo.IdPunto_cargo   = item.IdPunto_cargo;
                        itemInfo.nom_punto_cargo = item.nom_punto_cargo;
                        itemInfo.IdCentroCosto   = item.IdCentroCosto;
                        itemInfo.Centro_costo    = item.Centro_costo;
                        itemInfo.IdCentroCosto_sub_centro_costo = item.IdCentroCosto_sub_centro_costo;
                        itemInfo.sub_centro_costo = item.sub_centro_costo;


                        listadedatos.Add(itemInfo);
                    }
                }
                return(listadedatos);
            }
            catch (Exception ex)
            {
                string MensajeError = "";
                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(), "", "", "", "", "", "", "", DateTime.Now);
                MensajeError = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);

                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Get_Data_Reporte", ex.Message), ex)
                      {
                          EntityType = typeof(XCOMP_Rpt004_Data)
                      };
            }
        }
コード例 #5
0
        public List <XCOMP_Rpt009_Info> get_list(int IdEmpresa, int IdSucursal, decimal IdSolicitante, DateTime Fecha_ini, DateTime Fecha_fin, decimal IdProducto)
        {
            try
            {
                int IdSucursal_ini = IdSucursal;
                int IdSucursal_fin = IdSucursal == 0 ? 9999 : IdSucursal;

                decimal IdSolicitante_ini = IdSolicitante;
                decimal IdSolicitante_fin = IdSolicitante == 0 ? 99999 : IdSolicitante;

                Fecha_ini = Fecha_ini.Date;
                Fecha_fin = Fecha_fin.Date;

                List <XCOMP_Rpt009_Info> Lista;

                using (EntitiesCompra_reporte_Ge Context = new EntitiesCompra_reporte_Ge())
                {
                    if (IdProducto == 0)
                    {
                        Lista = (from q in Context.vwCOMP_Rpt009
                                 where IdSucursal_ini <= q.IdSucursal && q.IdSucursal <= IdSucursal_fin &&
                                 IdSolicitante_ini <= q.IdSolicitante && q.IdSolicitante <= IdSolicitante_fin &&
                                 Fecha_ini <= q.fecha_sol && q.fecha_sol <= Fecha_fin
                                 select new XCOMP_Rpt009_Info
                        {
                            IdRow = q.IdRow,
                            IdEmpresa = q.IdEmpresa,
                            IdSucursal = q.IdSucursal,
                            IdSolicitudCompra = q.IdSolicitudCompra,
                            Secuencia = q.Secuencia,
                            fecha_sol = q.fecha_sol,
                            IdSolicitante = q.IdSolicitante,
                            nom_solicitante = q.nom_solicitante,
                            pr_codigo = q.pr_codigo,
                            IdProducto = q.IdProducto,
                            nom_producto = q.nom_producto,
                            cantidad_sol = q.cantidad_sol,
                            IdPunto_cargo = q.IdPunto_cargo,
                            nom_punto_cargo = q.nom_punto_cargo,
                            ocd_IdEmpresa = q.ocd_IdEmpresa,
                            ocd_IdSucursal = q.ocd_IdSucursal,
                            ocd_IdOrdenCompra = q.ocd_IdOrdenCompra,
                            ocd_Secuencia = q.ocd_Secuencia,
                            IdProveedor = q.IdProveedor,
                            pe_nombreCompleto = q.pe_nombreCompleto,
                            fecha_oc = q.fecha_oc,
                            cantidad_com = q.cantidad_com,
                            do_precioCompra = q.do_precioCompra,
                            fecha_inv = q.fecha_inv,
                            cantidad_inv = q.cantidad_inv,
                        }).ToList();
                    }
                    else
                    {
                        Lista = (from q in Context.vwCOMP_Rpt009
                                 where IdSucursal_ini <= q.IdSucursal && q.IdSucursal <= IdSucursal_fin &&
                                 IdSolicitante_ini <= q.IdSolicitante && q.IdSolicitante <= IdSolicitante_fin &&
                                 Fecha_ini <= q.fecha_sol && q.fecha_sol <= Fecha_fin &&
                                 q.IdProducto == IdProducto
                                 select new XCOMP_Rpt009_Info
                        {
                            IdRow = q.IdRow,
                            IdEmpresa = q.IdEmpresa,
                            IdSucursal = q.IdSucursal,
                            IdSolicitudCompra = q.IdSolicitudCompra,
                            Secuencia = q.Secuencia,
                            fecha_sol = q.fecha_sol,
                            IdSolicitante = q.IdSolicitante,
                            nom_solicitante = q.nom_solicitante,
                            pr_codigo = q.pr_codigo,
                            IdProducto = q.IdProducto,
                            nom_producto = q.nom_producto,
                            cantidad_sol = q.cantidad_sol,
                            IdPunto_cargo = q.IdPunto_cargo,
                            nom_punto_cargo = q.nom_punto_cargo,
                            ocd_IdEmpresa = q.ocd_IdEmpresa,
                            ocd_IdSucursal = q.ocd_IdSucursal,
                            ocd_IdOrdenCompra = q.ocd_IdOrdenCompra,
                            ocd_Secuencia = q.ocd_Secuencia,
                            IdProveedor = q.IdProveedor,
                            pe_nombreCompleto = q.pe_nombreCompleto,
                            fecha_oc = q.fecha_oc,
                            cantidad_com = q.cantidad_com,
                            do_precioCompra = q.do_precioCompra,
                            fecha_inv = q.fecha_inv,
                            cantidad_inv = q.cantidad_inv,
                        }).ToList();
                    }
                }

                return(Lista);
            }
            catch (Exception)
            {
                throw;
            }
        }