<QUICK_REPORT_LIST><QUICK_REPORT state="queried" OBJ_ID="AAASXSAASAAAefoAAD" OBJ_VERSION="2025-07-25">
  <QUICK_REPORT_ID datatype="Number">568995</QUICK_REPORT_ID>
  <DESCRIPTION datatype="Text">Project Balance Report</DESCRIPTION>
  <SQL_EXPRESSION datatype="Text">SELECT  C.COMPANY||SUBSTR( &apos;&amp;[-C--L]Company&apos;,1,0)                &quot;COMPANY&quot;,
            C.PROJECT_GROUP  &quot;PROJECT GROUP&quot;  ,
            B.PROJECT_ID     &quot;PROJECT ID&quot;    ,
            ifsapp.ACCOUNT_API.Get_Logical_Account_Type_Db( b.company, b.account) accnt_type,
            B.ACCOUNT  &quot;ACCOUNT&quot;         ,
            C.PROJECT_STATUS     ,
           to_char(MAX( C.READY_DATE) ,&apos;YYYY-MM-DD&apos;)    &quot;COMPLETION DATE&quot;,
            D.PROJECT_TYPE    &quot;PROJECT TYPE&quot;     ,
            C.PROJECT_LEADER     &quot;PROJECT LEADER&quot;   ,
            SUM( amount_balance)   &quot;total_amount&quot; ,
            SUM( DECODE( SIGN( TO_NUMBER(B.ACCOUNTING_YEAR||DECODE(SIGN(10-B.ACCOUNTING_PERIOD),1,&apos;0&apos;||B.ACCOUNTING_PERIOD,B.ACCOUNTING_PERIOD)) - TO_NUMBER(&apos;&amp;[M-S--]Until_year&apos;||DECODE(SIGN(10-&apos;&amp;[M-S--]From_period&apos;),1,&apos;0&apos;||  &apos;&amp;[M-S--]From_period&apos;,&apos;&amp;[M-S--]From_period&apos;))),-1,0,1,b.amount_balance,0,b.amount_balance))  +  DECODE(&apos;&amp;[M-S--]until_period&apos;,1,0,0)  amount_balance,

            SUM( DECODE( SIGN( TO_NUMBER(B.ACCOUNTING_YEAR||DECODE(SIGN(10-B.ACCOUNTING_PERIOD),1,&apos;0&apos;||B.ACCOUNTING_PERIOD,B.ACCOUNTING_PERIOD)) - TO_NUMBER(&apos;&amp;[M-S--]Until_year&apos;||&apos;01&apos;)),-1,0,1,b.amount_balance,0,b.amount_balance)) until_amount_balance,
            SUM( DECODE(B.BUDGET_VERSION, &apos;&amp;Budget_version&apos;,B.BUDGET_AMOUNT,0)) total_budget_amount,             
            SUM( DECODE( SIGN( TO_NUMBER(B.ACCOUNTING_YEAR||DECODE(SIGN(10-B.ACCOUNTING_PERIOD),1,&apos;0&apos;||B.ACCOUNTING_PERIOD,B.ACCOUNTING_PERIOD)) - TO_NUMBER( &apos;&amp;[M-S--]Until_year&apos;||DECODE(SIGN(10-&apos;&amp;[M-S--]From_period&apos;),1,&apos;0&apos;||&apos;&amp;[M-S--]From_period&apos;,&apos;&amp;[M-S--]From_period&apos;))),-1,0,1,DECODE(B.BUDGET_VERSION, &apos;&amp;Budget_version&apos;,B.BUDGET_AMOUNT, 0),0,DECODE(B.BUDGET_VERSION, &apos;&amp;Budget_version&apos;,B.BUDGET_AMOUNT, 0))) budget_amount,
            SUM( DECODE( SIGN( TO_NUMBER(B.ACCOUNTING_YEAR||DECODE(SIGN(10-B.ACCOUNTING_PERIOD),1,&apos;0&apos;||B.ACCOUNTING_PERIOD,B.ACCOUNTING_PERIOD)) - TO_NUMBER(&apos;&amp;[M-S--]Until_year&apos;||&apos;01&apos;)),-1,0,0,DECODE(B.BUDGET_VERSION, &apos;&amp;Budget_version&apos;, B.BUDGET_AMOUNT),1,DECODE(B.BUDGET_VERSION, &apos;&amp;Budget_version&apos;,B.BUDGET_AMOUNT))) until_budget_amount
      FROM  ifsapp.PROJECT_BALANCE_BUDGET B
          inner join   ifsapp.ACCOUNTING_PROJECT   C    on B.PROJECT_ID= C.PROJECT_ID       and B.COMPANY  = C.COMPANY
           inner join   ifsapp.ACCOUNTING_PROJECT_LEDGER D    on   C.PROJECT_ID= D.PROJECT_ID  and    C.COMPANY  = D.COMPANY
   
   WHERE 
    (   C.COMPANY   LIKE   NVL( &apos;&amp;[-C--L]Company&apos; ,&apos;%&apos;)  OR C.Company     in (SELECT REGEXP_SUBSTR(d__.str, &apos;[^;]+&apos;, 1, LEVEL) AS val_            FROM (SELECT &apos;&amp;[-C--L]Company&apos; AS str FROM DUAL) d__     CONNECT BY LEVEL &lt;= REGEXP_COUNT(d__.str, &apos;;&apos;) + 1)   )
   AND      D.ledger_id              IN (&apos;*&apos;, &apos;00&apos;) 
AND   B.ACTIVATE_CODE          = &apos;COST/REV&apos;
 AND D.project_type != &apos;P&apos; AND Account_API.Get_Logical_Account_Type_Db(b.company , b.account)  IN (&apos;R&apos;,&apos;C&apos;)
AND   (TO_NUMBER(B.ACCOUNTING_YEAR||DECODE(SIGN(10-B.ACCOUNTING_PERIOD),1,&apos;0&apos;||B.ACCOUNTING_PERIOD,B.ACCOUNTING_PERIOD)) &lt;= TO_NUMBER(&apos;&amp;[M-S--]Until_year&apos;||DECODE(SIGN(10-&apos;&amp;[M-S--]until_period&apos;),1,&apos;0&apos;||&apos;&amp;[M-S--]until_period&apos;,&apos;&amp;[M-S--]until_period&apos;)))
AND   (&apos;&amp;Project_status&apos;  = &apos;%&apos;            OR   C.PROJECT_STATUS LIKE  NVL( &apos;&amp;Project_status&apos;,&apos;%&apos; )         OR C.PROJECT_STATUS IS NULL) 


       GROUP BY C.COMPANY,C.PROJECT_GROUP, B.PROJECT_ID,
               ifsapp.ACCOUNT_API.Get_Logical_Account_Type_Db( b.company, b.account),
               B.ACCOUNT, D.PROJECT_TYPE, C.PROJECT_LEADER, C.PROJECT_STATUS
      ORDER BY  C.COMPANY,C.PROJECT_GROUP, B.PROJECT_ID, accnt_type DESC, B.ACCOUNT ASC</SQL_EXPRESSION>
  <COMMENTS datatype="Text">IPNA-103935
Source code from IFS Report : Project Balance Peport
Date : 2024-12-09   Isabelle Guillement , Hamid Azzoune
Parameter : 
Company                   : Single or Multi, Example : 1000;2100  or Blank  (for all sites)
Until_year                  : YYYY
From_period              : Month, example : 1 
Until_period               : Month, example : 12
Budget_version         :  Default  blank  
Project_status           : Blank or % for all status  (Active;Completed)
</COMMENTS>
  <CATEGORY_ID datatype="Number">29</CATEGORY_ID>
  <CATEGORY_DESCRIPTION datatype="Text">Project Reporting</CATEGORY_DESCRIPTION>
  <DOMAIN_ID datatype="Number">21</DOMAIN_ID>
  <DOMAIN_DESCRIPTION datatype="Text">Procurement</DOMAIN_DESCRIPTION>
  <FILE_NAME datatype="Text"/>
  <QR_TYPE datatype="Enum">SQL</QR_TYPE>
  <PO_ID datatype="Text"/>
  <QUERY datatype="Text"/>
  <ROW_TYPE datatype="Text"/>
  <APP_CONFIG_PACKAGE datatype="Text"/>
  <QUICK_REPORT_CATEGORY datatype="Aggregate">
    <REPORT_CATEGORY state="queried" OBJ_ID="AAARH8AAaAAAAFrABA" OBJ_VERSION="2020-10-27">
      <CATEGORY_ID datatype="Number">29</CATEGORY_ID>
      <DESCRIPTION datatype="Text">Project Reporting</DESCRIPTION>
    </REPORT_CATEGORY>
  </QUICK_REPORT_CATEGORY>
  <QUICK_REPORT_DOMAIN datatype="Aggregate">
    <REPORT_DOMAIN state="queried" OBJ_ID="AAARciAAWAAAAHjAAF" OBJ_VERSION="2020-10-27">
      <DOMAIN_ID datatype="Number">21</DOMAIN_ID>
      <DESCRIPTION datatype="Text">Procurement</DESCRIPTION>
    </REPORT_DOMAIN>
  </QUICK_REPORT_DOMAIN>
</QUICK_REPORT>
</QUICK_REPORT_LIST>