CUX: Código fuente del informe del libro mayor de activos fijos (información más completa)

CUX: código fuente del informe del libro mayor de activos fijos

Información del encabezado del programa:

CREATE OR REPLACE PACKAGE CUX_FA_ASSET_ACCOUNT_RPT IS

  /*==================================================
  Copyright (C) Hand Enterprise Solutions Co.,Ltd.
             AllRights Reserved
             CUX:固定资产台账报表
  ==================================================*/
  /*==================================================
  Procedure Name :
      main
  Description:
      This procedure is concurrent entry
      并发程序入口
  Argument:
      errbuf          : concurrent return message buffer
      retcode         : concurrent return status code
                          0 success / 1 warning / 2 error 
  History: 
      1.00  2020/03/18   chenyang   Creation
  ==================================================*/
  PROCEDURE main(errbuf               OUT VARCHAR2
                            ,retcode              OUT VARCHAR2
                            ,p_book_type_code             IN VARCHAR2
                            ,p_period_name        IN VARCHAR2
                            ,p_asset_number_from          IN VARCHAR2
                            ,p_asset_number_to        IN VARCHAR2);

END CUX_FA_ASSET_ACCOUNT_RPT;

Cuerpo del paquete del programa:

CREATE OR REPLACE PACKAGE BODY CUX_FA_ASSET_ACCOUNT_RPT IS
  /*==================================================
  Copyright (C) Hand Enterprise Solutions Co.,Ltd.
             AllRights Reserved
  ==================================================*/
  --Global variables
  g_charset      CONSTANT VARCHAR2(30) := fnd_profile.value('ICX_CLIENT_IANA_ENCODING');
  g_report_title CONSTANT VARCHAR2(100) := 'CUX:固定资产台账报表';
  G_User_Id      Constant Number := Fnd_Global.User_Id;
  g_datetime_format  VARCHAR2(30) := 'YYYY-MM-DD HH24:MI:SS';

  
  --output
  PROCEDURE output(p_message VARCHAR2) IS
  BEGIN
    fnd_file.put_line(fnd_file.output, p_message);
  END output;
  --log
  PROCEDURE log(p_message VARCHAR2) IS
  BEGIN
    fnd_file.put_line(fnd_file.log, p_message);
  END log;
  /*==================================================
  Procedure Name :
      html_head
  Description:
      输出HTML头信息
  Argument:
  History: 
      1.00  2020/03/18   chenyang   Creation
  ==================================================*/
  PROCEDURE html_head(p_title VARCHAR2) IS
  BEGIN
    output('<html 
              xmlns:v="urn:schemas-microsoft-com:vml" 
              xmlns:o="urn:schemas-microsoft-com:office:office" 
              xmlns:x="urn:schemas-microsoft-com:office:excel">');
  
    output('<head> <meta http-equiv="Content-Type" content="text/html" charset="' ||
           g_charset || '">');
    output('<title>' || p_title || '</title>');
    output('<style type="text/css">
               body{background-color:#FFFFFF;font-family:Verdana;font-size:10pt;color:Black;}
               tr,td{font-family:Verdana;font-size:10pt;color:Black;white-space: nowrap;}
               .numberx{mso-number-format:"\@";text-decoration:none;}
            </style>');
    output('</head>');
  END html_head;
  /*==================================================
  Procedure Name :
      get_asset_residual_life
  Description:
      获取资产剩余寿命
  History: 
      1.00  2020/03/18   chenyang   Creation
  ==================================================*/
  FUNCTION get_asset_residual_life(p_asset_id IN NUMBER,
                                                  p_asset_number IN VARCHAR2,
                                                  p_book_type_code IN VARCHAR2) RETURN NUMBER IS
    
  l_error_msg VARCHAR2(500);
  l_prorate_date DATE;
  l_min_cpod     DATE;
  l_num_per_fiscal_year   NUMBER;
  l_dummy_num               NUMBER;
  l_remaining_life_years  NUMBER;
  l_remaining_life_months NUMBER;
  x_residual_life NUMBER DEFAULT 0;
  BEGIN
      --get prorate date
      SELECT /*adjusted_recoverable_cost, */
       prorate_date
        INTO /*:Inquiry_books.adjusted_recoverable_cost, */ l_prorate_date
        FROM fa_books
       WHERE book_type_code = p_book_type_code
         AND asset_id = p_asset_id
         AND date_ineffective IS NULL;
   
      SELECT MIN(calendar_period_open_date)
        INTO l_min_cpod
        FROM fa_deprn_periods
       WHERE book_type_code = p_book_type_code;
       
       --get fiscal year
      SELECT number_per_fiscal_year
        INTO l_num_per_fiscal_year
        FROM fa_calendar_types
       WHERE calendar_type = (SELECT decode(fab.conversion_date,
                                            NULL,
                                            fabc.deprn_calendar,
                                            fabc.prorate_calendar)
                                FROM fa_book_controls fabc,
                                     fa_books         fab
                               WHERE fabc.book_type_code = p_book_type_code
                                 AND fab.asset_id = p_asset_id
                                 AND fab.book_type_code = fabc.book_type_code
                                 AND fab.transaction_header_id_out IS NULL);
      
      IF (l_num_per_fiscal_year = 12) THEN
      
         IF l_prorate_date < l_min_cpod THEN
            SELECT decode(fab.conversion_date,
                          NULL,
                          fab.life_in_months - ((to_number(to_char(fcp1.end_date,
                                                                   'YYYY')) * 12 + fcp1.period_num) -
                          (to_number(to_char(fcp2.end_date,
                                                                   'YYYY')) * 12 + fcp2.period_num)),
                          fab.life_in_months - ((to_number(to_char(fcp1.end_date,
                                                                   'YYYY')) * 12 + fcp1.period_num) -
                          (to_number(to_char(fcp3.end_date,
                                                                   'YYYY')) * 12 + fcp3.period_num)))
              INTO l_dummy_num
              FROM fa_books            fab,
                   fa_calendar_periods fcp1, -- open
                   fa_calendar_periods fcp2, -- prorate
                   fa_calendar_periods fcp3, -- deprn_start
                   fa_book_controls    fabc,
                   fa_deprn_periods    fdp
             WHERE fab.asset_id = p_asset_id
               AND fab.book_type_code = p_book_type_code
               AND fab.transaction_header_id_out IS NULL
               AND fabc.book_type_code = fab.book_type_code
               AND fdp.period_counter = (SELECT MAX(dp.period_counter)
                                           FROM fa_deprn_periods dp
                                          WHERE dp.book_type_code = p_book_type_code)
               AND fdp.book_type_code = fab.book_type_code
               AND fcp1.calendar_type = decode(fab.conversion_date,
                                               NULL,
                                               fabc.prorate_calendar,
                                               fabc.deprn_calendar)
               AND fcp1.start_date = fdp.calendar_period_open_date
               AND fcp2.calendar_type = fabc.prorate_calendar
               AND fab.prorate_date BETWEEN fcp2.start_date AND fcp2.end_date
               AND fcp3.calendar_type = fabc.deprn_calendar
               AND fab.deprn_start_date BETWEEN fcp3.start_date AND fcp3.end_date;
         
         ELSE
         
            SELECT decode(fab.conversion_date,
                          NULL,
                          fab.life_in_months - (fdp1.period_counter - fdp2.period_counter),
                          fab.life_in_months - (fdp1.period_counter - fdp3.period_counter))
              INTO l_dummy_num
              FROM fa_books         fab,
                   fa_deprn_periods fdp1, -- open
                   fa_deprn_periods fdp2, -- prorate
                   fa_deprn_periods fdp3 -- deprn_start
             WHERE fab.asset_id = p_asset_id
               AND fab.book_type_code = p_book_type_code
               AND fab.transaction_header_id_out IS NULL
               AND fab.book_type_code = fdp1.book_type_code
               AND fdp1.period_counter = (SELECT MAX(dp.period_counter)
                                            FROM fa_deprn_periods dp
                                           WHERE dp.book_type_code = p_book_type_code)
               AND fab.book_type_code = fdp2.book_type_code
               AND (fab.prorate_date BETWEEN fdp2.calendar_period_open_date AND fdp2.calendar_period_close_date OR
                   (fab.prorate_date > fdp2.calendar_period_close_date AND fdp2.period_close_date IS NULL))
               AND fab.book_type_code = fdp3.book_type_code
               AND fab.deprn_start_date BETWEEN fdp3.calendar_period_open_date AND fdp3.calendar_period_close_date;
         END IF;
      
      ELSE
      
         SELECT decode(fab.conversion_date,
                       NULL,
                       fab.life_in_months - floor(months_between(fdp.calendar_period_close_date,
                                                                 fab.prorate_date)),
                       fab.life_in_months - floor(months_between(fdp.calendar_period_close_date,
                                                                 fab.deprn_start_date)))
           INTO l_dummy_num
           FROM fa_books         fab,
                fa_deprn_periods fdp
          WHERE fab.book_type_code = p_book_type_code
            AND fdp.book_type_code = p_book_type_code
            AND fab.asset_id = p_asset_id
            AND fab.date_ineffective IS NULL
            AND fdp.period_close_date IS NULL;
      END IF;
   
      IF (l_dummy_num < 1) THEN
         l_remaining_life_years  := 0;
         l_remaining_life_months := 0;
         --output
         /*dbms_output.put_line(p_asset_number || '(' || p_book_type_code || '):' ||
                              ' Remaining years:' ||
                              l_remaining_life_years ||
                              ' Remaining months:' ||
                              l_remaining_life_months);*/
        x_residual_life := l_remaining_life_years * 12 + l_remaining_life_months;
      ELSE
         l_remaining_life_years  := floor(l_dummy_num / 12);
         l_remaining_life_months := MOD(l_dummy_num, 12);
         --output
         /*dbms_output.put_line(p_asset_number || '-' || p_book_type_code || ':' ||
                              ' Remaining years:' ||
                              l_remaining_life_years ||
                              ' Remaining months:' ||
                              l_remaining_life_months);*/
         x_residual_life := l_remaining_life_years * 12 + l_remaining_life_months;
      END IF;
      RETURN x_residual_life; 
  EXCEPTION
     WHEN OTHERS THEN 
       RETURN x_residual_life;
  END get_asset_residual_life;
  /*==================================================
  Procedure Name :
      Get_Ap_Data
  Description:
      获取AP发票和付款的数据
  History: 
      1.00  2020/03/18   chenyang   Creation
  ==================================================*/
  PROCEDURE output_report(p_book_type_code             IN VARCHAR2
                                        ,p_period_name        IN VARCHAR2
                                        ,p_asset_number_from          IN VARCHAR2
                                        ,p_asset_number_to        IN VARCHAR2) IS
    CURSOR cur_data IS
    SELECT 
        fa.ASSET_ID,
        fb.BOOK_TYPE_CODE,
        fa.ASSET_NUMBER,--资产编号
        fa.tag_number,--标签号
        fa.serial_number,--序列号
        fa.description,--资产名称
        fa.attribute_category_code,--资产类别编码
        csha.Description fa_major_category,--资产大类
        cshi.Description fa_minor_category,--资产小类
        fak.SEGMENT4||'.'||fak.SEGMENT5 ASSET_KEY,--资产关键字
        decode(fa.ASSET_TYPE,'CAPITALIZED','资本化',fa.ASSET_TYPE) ASSET_TYPE,--资产类型
        fa.manufacturer_name,--制造商
        fa.model_number,--型号
        fa.CURRENT_UNITS,--数量
        cshd.Description Depreciation_Department,--折旧部门
        gcc.concatenated_segments,--费用账户
        cshav.Description account_Description,--账户(科目)说明
        cshd.Flex_Value,--地点编号
        cshd.Description Use_address,--使用地址
        fdh.UNITS_ASSIGNED,--分配数量
        fb.date_placed_in_service,--启用日期
        fb.original_cost,--原始成本
        fb.cost,--当前成本
        fb.cost - (SELECT MAX(u.deprn_reserve)
                            FROM fa_deprn_summary u
                           WHERE 1 = 1
                             AND u.asset_id = fa.asset_id) Residual_value,--残值
        nvl(fb.PERCENT_SALVAGE_VALUE,0) * 100||'%' PERCENT_SALVAGE_VALUE,--残值率
        fds.deprn_amount month_deprn_amount,--当月折旧金额,
        fds.ytd_deprn,--YTD折旧
        fds.ytd_deprn year_ytd_deprn,--当年折旧金额
        fds.deprn_reserve,--累计折旧金额,
        '' Impairment_of_assets,--资产减值
        fb.RECOVERABLE_COST,--可回收成本
        frs.NBV_RETIRED,--账面净值
        cshft.Description FA_STATE,--使用状况
        cshfs.Description FA_SOURCE,--资产来源
        '' project_num,--项目编号
        fb.LIFE_IN_MONTHS service_life,--使用寿命
        '' residual_life,--剩余寿命
        fb.DEPRN_METHOD_CODE,--折旧方法
        fb.DEPRECIATE_FLAG,--是否折旧
        (SELECT trunc(MIN(fddd.DEPRN_RUN_DATE))
        FROM fa_deprn_detail fddd 
        WHERE 1=1 
        AND fddd.ASSET_ID = fb.ASSET_ID 
        AND fddd.BOOK_TYPE_CODE = fb.BOOK_TYPE_CODE) DEPRN_RUN_DATE,--入账日期
        fb.PRORATE_DATE,--折旧日期
        '' Provision_for_impairment,--减值准备
        '' Impairment_date,--计提减值日期
        frs.RETIREMENT_TYPE_CODE,--报废类型
        frs.DATE_RETIRED,--报废日期
        frs.COST_RETIRED,--报废成本
        frs.UNITS,--报废数量
        '' Cost_of_sales,--销售成本
        '' Demolition_cost,--拆迁成本
        '' Profit_and_loss,--损益
        DECODE(frs.DATE_RETIRED,NULL,'N','Y') Scrap_flag,--完全报废标记
        '' Multi_source_flag,--多来源行标记
        '' Multi_distribution_flag,--多行分配标记
        fin.VENDOR_NUMBER,--供应商编号
        fin.VENDOR_NAME,--供应商名称
        fin.INVOICE_NUMBER,--发票编号
        fin.INVOICE_LINE_NUMBER,--AP发票分配行号
        fin.DESCRIPTION INVOICE_DESCRIPTION,--AP发票说明
        fin.FIXED_ASSETS_COST,--行金额
        fe.Employee_Number,--录入人员
        fb.BONUS_RULE,--附加规则
        fb.GLOBAL_ATTRIBUTE1,--附加规则起算日期
        fds.deprn_amount total_DEPRN_AMOUNT,--折旧总额
        fds.deprn_amount - (nvl(fds.deprn_adjustment_amount,
                                      0) - nvl(fds.bonus_deprn_adjustment_amount,
                                                                  0)) - nvl(fds.bonus_deprn_amount,
                                                                            0) DEPRN_AMOUNT,--折旧额
        /*nvl(fds.deprn_adjustment_amount,
                   0) - nvl(fds.bonus_deprn_adjustment_amount,
                            0) DEPRN_ADJUSTMENT_AMOUNT*/
        fdd.DEPRN_ADJUSTMENT_AMOUNT--调整额 
        FROM fa_books fb,
                 fa_additions  fa,
                 fa_categories_b fcb,
                 FA_RETIREMENTS frs,
                 fa_invoice_details_v fin,
                 FA_ASSET_KEYWORDS fak,
                 fa_deprn_detail fdd,
                 fa_deprn_summary fds,
                 FA_DEPRN_PERIODS fdp,
                 cux_sys_hd_fa_major_category_v  csha,
                 cux_sys_hd_fa_minor_category_v  cshi,
                 fa_distribution_history  fdh,
                 gl_code_combinations_kfv gcc,
                 cux_sys_hd_department_v cshd,
                 cux_sys_hd_account_v  cshav,
                 cux_sys_HD_FA_SOURCE_V cshfs,
                 CUX_SYS_HD_FA_STATE_V cshft,
                 fnd_user fu,
                 fa_employees fe
        WHERE 1=1
        AND fb.ASSET_ID = fa.ASSET_ID
        AND fa.ASSET_CATEGORY_ID = fcb.CATEGORY_ID
        AND fb.ASSET_ID = frs.ASSET_ID(+)
        AND fb.BOOK_TYPE_CODE = frs.BOOK_TYPE_CODE(+)
        AND fb.ASSET_ID = fin.ASSET_ID
        AND fin.CREATED_BY = fu.USER_ID
        AND fu.EMPLOYEE_ID = fe.Employee_ID
        AND fa.ASSET_KEY_CCID = fak.CODE_COMBINATION_ID
        AND fak.SEGMENT4 = cshft.Flex_Value
        AND fak.SEGMENT5 = cshfs.Flex_Value
        AND fb.ASSET_ID = fdd.ASSET_ID
        AND fb.BOOK_TYPE_CODE = fdd.BOOK_TYPE_CODE
        AND fdd.PERIOD_COUNTER = fdp.PERIOD_COUNTER
        AND fdd.BOOK_TYPE_CODE = fdp.BOOK_TYPE_CODE
        AND fb.ASSET_ID = fds.ASSET_ID
        AND fb.BOOK_TYPE_CODE = fds.BOOK_TYPE_CODE
        AND fds.PERIOD_COUNTER = fdp.PERIOD_COUNTER
        AND fds.BOOK_TYPE_CODE = fdp.BOOK_TYPE_CODE
        AND fcb.SEGMENT1 = csha.Flex_Value
        AND fcb.SEGMENT2 = cshi.Flex_Value
        AND csha.Flex_Value = cshi.PARENT_FLEX_VALUE_LOW
        AND fa.asset_id = fdh.asset_id 
        AND fb.book_type_code = fdh.book_type_code
        AND fdh.code_combination_id = gcc.code_combination_id 
        AND gcc.segment2 = cshd.Flex_Value
        AND gcc.segment3 = cshav.Flex_Value
        AND fdh.DATE_INEFFECTIVE IS NULL
        AND fb.DATE_INEFFECTIVE IS NULL
        --参数
        AND fb.BOOK_TYPE_CODE = p_book_type_code
        AND fdp.PERIOD_NAME = p_period_name
        AND fa.ASSET_NUMBER >= nvl(p_asset_number_from,fa.ASSET_NUMBER)
        AND fa.ASSET_NUMBER <= nvl(p_asset_number_to,fa.ASSET_NUMBER)
        ;
  l_error_msg VARCHAR2(500);
  l_residual_life NUMBER;
  BEGIN
    html_head(g_report_title);
    output('<body>');
    output('<H3 align=center><B>' || g_report_title || '</B></H3>');
    --
    output('<table width="100%" border="0" cellspacing="0" cellpadding="2"
                         style="BORDER-COLLAPSE:collapse" 
                         bordercolorlight="#000000" bordercolordark="#000000" 
                         id="table2">');
    output('<tr border="0" cellspacing="0" cellpadding="0"><td align="left">资产帐簿: ' || p_book_type_code || '</td></tr>');
    output('<tr><td align="left">会计期: ' || p_period_name ||  '</td></tr>');
    output('<tr><td align="left">打印日期: ' || to_char(SYSDATE,g_datetime_format)|| '</td></tr>');
    output('</table>');
    --报表列标题
    output('<table width="100%" border="1" cellspacing="0" cellpadding="2"
                  style="BORDER-COLLAPSE:collapse" 
                   bordercolorlight="#000000" bordercolordark="#000000" 
              id="table1">');
    output('<tr bgcolor="#BBBBBB"> 
               <td align="center">资产编号</td>
               <td align="center">标签号</td>
               <td align="center">序列号</td>
               <td align="center">资产名称</td>
               <td align="center">资产类别编码</td>
               <td align="center">资产大类</td>
               <td align="center">资产小类</td>
               <td align="center">资产关键字</td>
               <td align="center">资产类型</td>
               <td align="center">制造商</td>
               <td align="center">型号</td>
               <td align="center">数量</td>
               <td align="center">折旧部门</td>
               <td align="center">费用账户</td>
               <td align="center">账户(科目)说明</td>
               <td align="center">地点编号</td>
               <td align="center">使用地址</td>
               <td align="center">分配数量</td>
               <td align="center">启用日期</td>
               <td align="center">原始成本</td>
               <td align="center">当前成本</td>
               <td align="center">残值</td>
               <td align="center">残值率</td>
               <td align="center">当月折旧金额</td>
               <td align="center">YTD折旧</td>
               <td align="center">当年折旧金额</td>
               <td align="center">累计折旧金额</td>
               <td align="center">资产减值</td>
               <td align="center">可回收成本</td>
               <td align="center">账面净值</td>
               <td align="center">使用状况</td>
               <td align="center">资产来源</td>
               <td align="center">项目编号</td>
               <td align="center">使用寿命</td>
               <td align="center">剩余寿命</td>
               <td align="center">折旧方法</td>
               <td align="center">是否折旧</td>
               <td align="center">入账日期</td>
               <td align="center">折旧日期</td>
               <td align="center">减值准备</td>
               <td align="center">计提减值日期</td>
               <td align="center">报废类型</td>
               <td align="center">报废日期</td>
               <td align="center">报废成本</td>
               <td align="center">报废数量</td>
               <td align="center">销售成本</td>
               <td align="center">拆迁成本</td>
               <td align="center">损益</td>
               <td align="center">完全报废标记</td>
               <td align="center">多来源行标记</td>
               <td align="center">多行分配标记</td>
               <td align="center">供应商编号</td>
               <td align="center">供应商名称</td>
               <td align="center">发票编号</td>
               <td align="center">AP发票分配行号</td>
               <td align="center">AP发票说明</td>
               <td align="center">行金额</td>
               <td align="center">录入人员</td>
               <td align="center">附加规则</td>
               <td align="center">附加规则起算日期</td>
               <td align="center">折旧总额</td>
               <td align="center">折旧额</td>
               <td align="center">调整额</td>
             </tr>');
    FOR rec_data IN cur_data LOOP
      l_residual_life :=
      get_asset_residual_life(p_asset_id => rec_data.ASSET_ID,
                                         p_asset_number => rec_data.ASSET_NUMBER,
                                         p_book_type_code => rec_data.BOOK_TYPE_CODE);
                                         
      output('<tr onmouseover="this.bgColor=''#a0ffff''" onmouseout="this.bgColor=''''">');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.ASSET_NUMBER) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.tag_number) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.serial_number) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.description) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.attribute_category_code) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.fa_major_category) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.fa_minor_category) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.ASSET_KEY) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.ASSET_TYPE) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.manufacturer_name) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.model_number) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.CURRENT_UNITS) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Depreciation_Department) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.concatenated_segments) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.account_Description) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Flex_Value) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Use_address) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.UNITS_ASSIGNED) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.date_placed_in_service) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.original_cost) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.cost) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Residual_value) || '</td>');       
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.PERCENT_SALVAGE_VALUE) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.month_deprn_amount) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.ytd_deprn) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.year_ytd_deprn) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.deprn_reserve) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Impairment_of_assets) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.RECOVERABLE_COST) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.NBV_RETIRED) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.FA_STATE) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.FA_SOURCE) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.project_num) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.service_life) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(l_residual_life) ||
             --cux_html_report_utl.get_string(rec_data.residual_life) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.DEPRN_METHOD_CODE) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.DEPRECIATE_FLAG) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.DEPRN_RUN_DATE) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.PRORATE_DATE) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Provision_for_impairment) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Impairment_date) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.RETIREMENT_TYPE_CODE) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.DATE_RETIRED) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.COST_RETIRED) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.UNITS) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Cost_of_sales) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Demolition_cost) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Profit_and_loss) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Scrap_flag) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Multi_source_flag) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Multi_distribution_flag) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.VENDOR_NUMBER) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.VENDOR_NAME) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.INVOICE_NUMBER) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.INVOICE_LINE_NUMBER) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.INVOICE_DESCRIPTION) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.FIXED_ASSETS_COST) || '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.Employee_Number) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.BONUS_RULE) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.GLOBAL_ATTRIBUTE1) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.total_DEPRN_AMOUNT) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.DEPRN_AMOUNT) ||
             '</td>');
      output('<td align="left" nowwap x:str>' ||
             cux_html_report_utl.get_string(rec_data.DEPRN_ADJUSTMENT_AMOUNT) ||
             '</td>');
      output('</tr>');
    END LOOP;
    output('</table></body></html>');
  EXCEPTION
    WHEN OTHERS THEN
      l_error_msg := substr(SQLERRM,0,500);
      dbms_output.put_line(l_error_msg);
      log(l_error_msg);
  END output_report;
  /*==================================================
  Procedure Name :
      main
  Description:
      This procedure is concurrent entry
      并发程序入口
  Argument:
      errbuf          : concurrent return message buffer
      retcode         : concurrent return status code
                          0 success / 1 warning / 2 error 
  History: 
      1.00  2020/03/18   chenyang   Creation
  ==================================================*/
  PROCEDURE main(errbuf               OUT VARCHAR2
                            ,retcode              OUT VARCHAR2
                            ,p_book_type_code             IN VARCHAR2
                            ,p_period_name        IN VARCHAR2
                            ,p_asset_number_from          IN VARCHAR2
                            ,p_asset_number_to        IN VARCHAR2) IS

  BEGIN
    -- concurrent header log
    cux_conc_utl.log_header;

    log('p_book_type_code:' || p_book_type_code);
    log('p_period_name:' || p_period_name);
    log('p_asset_number_from:' || p_asset_number_from);
    log('p_asset_number_to:' || p_asset_number_to);
    
    --获取数据

    --打印报表            
    output_report(p_book_type_code => p_book_type_code
                        ,p_period_name => p_period_name
                        ,p_asset_number_from => p_asset_number_from
                        ,p_asset_number_to => p_asset_number_to);
    -- concurrent footer log
    cux_conc_utl.log_footer;
  EXCEPTION
    WHEN OTHERS THEN
      retcode := '2';
      errbuf  := TRIM(dbms_utility.format_error_stack) || SQLERRM;
      fnd_file.put_line(fnd_file.log, errbuf);
  END main;
END CUX_FA_ASSET_ACCOUNT_RPT;

Supongo que te gusta

Origin blog.csdn.net/qq_38696286/article/details/113945676
Recomendado
Clasificación