martes, 13 de mayo de 2014

query depreciacion de activos

Query para obtener la depreciación de activos durante su tiempo en alta en el     sistema hasta su baja

       select FAV.asset_id as id_activo,
                FAV.asset_number as activo,
                FDS.book_type_code as activo_libro,
                fdp.period_counter as id_periodo,
                fdp.period_name as periodo,
                FBV.date_placed_in_service as fecha_servicio,
                FDS.deprn_amount as importe_depreciacion,
                fbv.original_cost as costo_adquisicion,
                decode(fbv.book_type_code,
                       FDS.book_type_code,
                       fbv.life_in_months,
                       0) vida_util_meses,
                fbv.cost as costo,
                fbv.salvage_value as valor_residual,
                decode(FDS.deprn_reserve,
                       0,
                       abs(FDS.YTD_DEPRN),
                       FDS.deprn_reserve) depreciacion_acumulada,
                (FDS.adjusted_COST - FDS.deprn_reserve) valor_neto_libro
        
           from fa_additions_v   FAV,
                FA_DEPRN_SUMMARY fds,
                fa_books_v       fbv,
                fa_deprn_periods fdp
          where fav.ASSET_ID = fds.asset_id
            and fds.book_type_code = fbv.book_type_code
            and fdp.book_type_code = fbv.book_type_code
            and fds.period_counter = fdp.period_counter
            and fds.asset_id = fbv.asset_id

            and FAV.asset_number = '&activo'

No hay comentarios:

Publicar un comentario