Wednesday, 3 January 2018

Drill Down Query From GL into Project Accounting subledger

The below query will  provide the complete breakup of posted Journals with transaction distribution wise breakup details of Project Accounting sub-ledger modules.

SELECT      GLCC.concatenated_segments segments
                    ,GJL.period_name
                    ,GJH.name journal_name
                    ,GJB.name batch_name
                    ,GJH.je_source journal_source
                    ,GJH.je_category journal_category
                    ,GLCC.segment1 entity_segment
                    ,GLCC.segment2 project_segment
                    ,FFV.attribute1 project_vertical_dff
                    ,GLCC.segment3
                    ,GLCC.segment4
                    ,GLCC.segment5
                    ,GLCC.segment6
                    ,GLCC.segment7
                    ,TO_CHAR (GJH.doc_sequence_value) gl_doc_no
                    ,TO_CHAR (GJH.default_effective_date, 'DD-MON-YYYY') gl_date
                    ,TO_CHAR (GJH.posted_date, 'DD-MON-YYYY') posted_date
                    ,PE.expenditure_group document_number
                    ,PE.expenditure_group document_description
                    ,TO_CHAR (PEI.expenditure_item_date, 'DD-MON-YYYY')  document_date
--                  ,PPA.project_status_code document_status     
                    ,PPA.segment1 project_code 
                    ,PT.task_number task_code        
                    ,PEI.expenditure_type  
                    ,PEI.raw_cost transaction_cur_amount
                    ,PPA.project_currency_code entered_currency_code
                    ,PPA.project_rate_type exchange_rate_type
                    ,PEI.project_exchange_rate exchange_rat
   FROM       gl_je_batches GJB
                    ,gl_je_headers GJH
                    ,gl_je_lines   GJL
                    ,gl_code_combinations_kfv GLCC
                    ,gl_import_references GIR
                    ,xla_ae_headers  XAH
                    ,xla_ae_lines    XAL
                    ,xla_events      XE
                    ,xla_distribution_links XDL
                    ,pa_cost_distribution_lines_all PDL
                    ,pa_expenditure_items_all PEI
                    ,pa_expenditures_all PE
                    ,pa_tasks PT
                    ,pa_projects_all PPA
                    ,fnd_flex_value_sets FVS
                    ,fnd_flex_values FFV
         WHERE  GJB.je_batch_id         = GJH.je_batch_id          
         AND    GJH.je_header_id        = GJL.je_header_id
         AND    GJL.code_combination_id = GLCC.code_combination_id
         AND    GJL.je_header_id        = GIR.je_header_id
         AND    GJH.je_batch_id         = GIR.je_batch_id
         AND    GJL.je_line_num         = GIR.je_line_num
         AND    GIR.gl_sl_link_id       = XAL.gl_sl_link_id
         AND    GIR.gl_sl_link_table    = XAL.gl_sl_link_table
         AND    XAH.ae_header_id        = XAL.ae_header_id
         AND    XAH.application_id      = XAL.application_id
         AND    XAH.event_id            = XE.event_id
         AND    XAL.ae_header_id        = XDL.ae_header_id
         AND    XAL.ae_line_num         = XDL.ae_line_num
         AND    XDL.source_distribution_id_num_1 = PDL.expenditure_item_id 
         AND    PDL.expenditure_item_id  = PEI.expenditure_item_id
         AND    PEI.expenditure_id       = PE.expenditure_id
         AND    PEI.task_id              = PT.task_id
         AND    PT.project_id            = PPA.project_id
         AND    FFV.flex_value_set_id    = FVS.flex_value_set_id(+)
         AND    GLCC.segment2            = FFV.flex_value(+) 
         AND UPPER (FVS.flex_value_set_name) = UPPER ('PLL_Project')
    --  AND    XAH.entity_id        = XTE.entity_id
    --  AND xte.application_id = 275
        AND    GJH.je_source               = 'Project Accounting'
        AND    GJH.je_category             = 'Miscellaneous Transaction'
        AND    GJH.status                  = 'P' 
        AND    GJH.default_effective_date >= lc_gl_date_from
        AND    GJH.default_effective_date <= lc_gl_date_to
        AND    TRUNC (GJH.posted_date) BETWEEN NVL (lc_gl_posted_from,TRUNC (GJH.posted_date))AND NVL (lc_gl_posted_to ,TRUNC (GJH.posted_date))
        AND    GJH.je_source               = NVL (p_gl_source, GJH.je_source)
        AND    GJH.je_category             = NVL (p_gl_category, GJH.je_category)
        --        AND    GLCC.concatenated_segments BETWEEN (p_account_from) AND (p_account_to)
        AND    GLCC.segment1 BETWEEN  lc_segment_from(1) AND  lc_segment_to(1)
        AND    GLCC.segment2 BETWEEN  lc_segment_from(2) AND  lc_segment_to(2)
        AND    GLCC.segment3 BETWEEN  lc_segment_from(3) AND  lc_segment_to(3)
        AND    GLCC.segment4 BETWEEN  lc_segment_from(4) AND  lc_segment_to(4)
        AND    GLCC.segment5 BETWEEN  lc_segment_from(5) AND  lc_segment_to(5)
        AND    GLCC.segment6 BETWEEN  lc_segment_from(6) AND  lc_segment_to(6)
        AND    GLCC.segment7 BETWEEN  lc_segment_from(7) AND  lc_segment_to(7)

        AND    NVL (FFV.attribute1, '-1')      = NVL (p_proj_vertical_dff, NVL (FFV.attribute1, '-1'))

Tuesday, 2 January 2018

Mass Update For Supplier Invoice Match

Update the match_option column in AP_SUPPLIERS table.

No Oracle API is available to change the Invoice Match Option from one value to another. 
This has to be manually done from the form.

Lockbox – Error Handling

Submit postQuickcash for records struck in the interface.

Query with Transmission Name & check Submit postQuickcash then submit.

Receivables -> Lockbox Interface
For any other issues that needs reprocessing, delete transmission Name and Interface records.

Use the below provided queries.

Delete from apps.ar_transmissions_all where transmission_name =Name;

Delete from apps.AR_PAYMENTS_INTERFACE_all where transmission_id=ID;  

Query to find Suppliers/ Sites with 'Receipt' match option.

SELECT
    aps.vendor_id,
    aps.vendor_name,
    DECODE(aps.match_option,'P','Purchase Order','R','Receipt') match_option_suppiers,
    apssa.vendor_site_id,
    DECODE(apssa.match_option,'P','Purchase Order','R','Receipt') match_option_suppier_sites
FROM
    apps.ap_suppliers aps,
    apps.ap_supplier_sites_all apssa
WHERE    aps.vendor_id = apssa.vendor_id
     AND    aps.match_option = 'R'
     AND    apssa.match_option = 'R'
     AND    purchasing_site_flag IS NOT NULL;

Thursday, 28 December 2017

Highlight Data in different colors Using CSS

Use the below code in report query to highlight data with different colors based on conditions

CASE
            WHEN (TRUNC(SYSDATE) > date_down AND date_down IS NOT NULL)
            AND date_out IS NULL
               THEN 'Y'                               ---------------RED COLOR
            WHEN (TRUNC(SYSDATE) > date_out AND date_out IS NOT NULL)
            AND complete_date IS NULL
               THEN 'Z'                               -----------GREEN COLOR
            WHEN (TRUNC(SYSDATE) > complete_date AND complete_date IS NOT NULL)
            AND date_start IS NULL
               THEN 'X'                               --------ORANGE COLOR

            WHEN (    TRUNC(SYSDATE) > date_start
                  AND date_start IS NOT NULL
                  AND ship_date IS NULL
                 )
            AND date_complete IS NULL
               THEN 'P'                               --------YELLOW COLOR
            WHEN ((ship_date - TRUNC (SYSDATE) <= 2) AND ship_date IS NOT NULL
                 )
            AND date_complete IS NULL
               THEN 'Q'                               ---------BLUE COLOR

           

ELSE 'N'                                 ---------GREY COLOR


         END css_style

Use the below Javascript code for coloring.

//function to set css-bg color
function fn_css()
{
var i = 1;
var b,a,c,f;
while (i != 0) {
b = "000" + i;
b = pad(i, 4);
a = $('#f20_'+b).val(); //ID of CSS_STYLE column
c = "#f08_"+b; //ID of column to be highlighted
f = "f08_"+b;//date_out
g = "f10_"+b;//complete
h= "f12_"+b;//date_start
k= "f13_"+b;//date_complete
if (typeof a === "undefined") {
i=0;
}
else
{
//alert(g);
if (a == 'Y') {
/*Appying bg color to the closest row with ID f05_0001(first row, if 2nd row - f05_0002 and so on ) */
$(c).closest("tr").find('input[id="'+f+'"]').css("background-color","red");
}
else if(a == 'Z') {
$(c).closest("tr").find('input[id="'+g+'"]').css("background-color","green");
}
else if(a == 'X') {
$(c).closest("tr").find('input[id="'+h+'"]').css("background-color","orange");
}
else if(a == 'P') {
$(c).closest("tr").find('input[id="'+k+'"]').css("background-color","yellow");
}
else if(a == 'Q') {
$(c).closest("tr").children("td").css("background-color","blue");
}
i= i+1;
}
}
}

Check Data type using JavaScript

Use the below script to perform duplicate data validation along with numeric data type validation in Javascript.

<!--duplicate checking for lpn -->
<script>
function check_lpn(pThis)
{
var j_item_id=pThis.id;
var k_item_id='#f02'+j_item_id.substr(3);
//alert(j_item_id);
//alert(k_item_id);
var h='#'+j_item_id;
//alert(h);
var a= $(h).val();
var g=$(k_item_id).val();
//alert(a);
//alert(g);
if(isNaN(a)){
alert('The LPN is not numeric.Kindly enter numeric values');
$(h).focus();
}
else{
if (g)
{
var get = new htmldb_Get(null, $v('pFlowId'),'APPLICATION_PROCESS=Duplicate_LPN_check',$v('pFlowStepId'));
get.add('AI_LPN',a);
//get.add('AI_SHIPPING_ID',g);
ret = get.get();
//alert(ret);
if (ret != 0)
{
var get = new htmldb_Get(null, $v('pFlowId'),'APPLICATION_PROCESS=Duplicate_LPN_Shipping_id',$v('pFlowStepId'));
get.add('AI_LPN',a);
ret = get.get();
if(ret != g)
{
alert('The LPN is already present.Kindly select another LPN');
$(h).val(null);
$(h).focus();
}
}
}
else
{
var i = 1;
var j=0;
var b,a,c,f;
while (i != 0) {
b = "000" + i;
b = pad(i, 4);
d = $('#f05_'+b).val();
//alert(d);
//alert(typeof d);
if (typeof d === "undefined") {
i=0;
}
else
{
if(a == d)
{j= j+1;
}
if(j>1)
{
alert('The LPN is already present.Kindly select another LPN');
$(h).val(null);
$(h).focus();
break;
}
i= i+1;
}
}
}
}
}
</script>


Check duplicate data using Javascript

Use the below Javascript to identify duplicate data - In this sample code, when user enters order number in the tabular form, an error will be thrown if the order number already exists.

<!--duplicate checking for order no -->
<script>
function check_order_no(pThis)
{
var j_item_id=pThis.id;
var k_item_id='#f02'+j_item_id.substr(3);
//alert(j_item_id);
//alert(k_item_id);
var h='#'+j_item_id;
//alert(h);
var a= $(h).val();
var g=$(k_item_id).val();
//alert(a);
//alert(g);

if (g)
{
var get = new htmldb_Get(null, $v('pFlowId'),'APPLICATION_PROCESS=Duplicate_Order_no_check',$v('pFlowStepId'));
get.add('AI_ORDER_NO',a);
//get.add('AI_SHIPPING_ID',g);
ret = get.get();
//alert(ret);
if (ret != 0)
{
var get = new htmldb_Get(null, $v('pFlowId'),'APPLICATION_PROCESS=Duplicate_Order_no_shipping_id',$v('pFlowStepId'));
get.add('AI_ORDER_NO',a);
ret = get.get();
if(ret != g)
{
alert('The Order No is already present.Kindly select another Order No');
$(h).val(null);
$(h).focus();
}
}
}
else
{
var i = 1;
var j=0;
var b,a,c,f;
while (i != 0) {
b = "000" + i;
b = pad(i, 4);
d = $('#f03_'+b).val();
//alert(typeof d);
if (typeof d === "undefined") {
i=0;
}
else
{
if(a == d)
{j= j+1;
}
if(j>1)
{
alert('The Order No is already present.Kindly select another Order No');
$(h).val(null);
$(h).focus();
break;
}
i= i+1;
}
}
}
}
</script>