Hello Community,
I'm using Oracle APEX version 5.1.0.0045 , Google Chrome, and PL/SQL Developer
--------------------------------------------------------------------------------------------------------------------
What I'm trying to accomplish working on a Refund Page for an Application:
When a Receipt is Fully Refunded I want to Hide / Disable the 'Refund' Button
and
When a Receipt is Partially Refunded I want to Show / Enable the 'Refund' Button
Also
Can I utilize these in PL/SQL Function Body in APEX
apex.item( "refundButton" ).disable();
apex.item( "refundButton" ).enable(); (Seen in Code Below)
--------------------------------------------------------------------------------------------------------------------
I have the following PL/SQL Code which tells me if a Refund is Fully Refunded or Partially Refunded; (which is Correct based on some Test Fields I used in APEX)
Declare
v_RecptAmt receiptdetail.receipt_amount%type;
v_refunded_receipt_amount receiptdetail.receipt_amount%type;
Begin
select nvl(rl.receipt_amount,0) - nvl(rd.postage,0) as "Receipt Amount",
(select abs(nvl(sum(rdd.receipt\_amount),0))
from receiptdetail rdd
where refunded\_recpt\_nmbr = (select rd.receiptnumber
from receiptdetail rd
inner join
receipt\_log rl
on rd.receipt\_log\_id = rl.receipt\_log\_id
where rd.receipt\_log\_id = :P64\_RECEIPT\_LOG\_ID)) as "Sum of Refunded Receipt Number"
into v_RecptAmt,
v\_refunded\_receipt\_amount
from receiptdetail rd
inner join
receipt\_log rl
on rd.receipt_log_id = rl.receipt_log_id
where rl.receipt_log_id = :P64_RECEIPT_LOG_ID;
if v\_refunded\_receipt\_amount >= v\_recptAmt
then :P64\_DISABLE\_REFUNDBTN := 'Y';
if :P64\_DISABLE\_REFUNDBTN = 'Y'
then apex.item( "refundButton" ).disable();
end if;
else :P64\_DISABLE\_REFUNDBTN := 'N';
apex.item( "refundButton" ).disable();
end if;
:P64_SUM_REFUNDED_RECEIPT_TEST := v_refunded_receipt_amount;
:P64_RECEIPT_AMOUNT_TEST := v_RecptAmt;
end;
-------------------------------------------------------------------------------------------------------------------------------------
ScreenShots of Example
------------------------------------------------------------------------------------------------------------------------------------
I want to Hide or Disable 'Refund Button in this Case

-------------------------------------------------------------------------------------------------------------------------------------
I want to Show or Enable 'Refund' Button in this Case which is Correct

------------------------------------------------------------------------------------------------------------------------------------------
I have Tried the following Dynamic Action and Javascript
------------------------------------------------------------------------------------------------------------------------------------------

alert("Disable Refund Button " + $s("P64_DISABLE_REFUNDBTN"));
if ( $v("P64_DISABLE_REFUNDBTN") == 'Y' || $v("P64_DISABLE_REFUNDBTN") == 'N' ) {
if ( $v("P64\_DISABLE\_REFUNDBTN") == 'Y') {
apex.item( "refundButton" ).disable();
}
if ( $v("P64\_DISABLE\_REFUNDBTN") == 'N') {
apex.item( "refundButton" ).enable();
}
}
---------------------------------------------------------------------------------------------------------------------------
I have also Tried the following Dynamic Actions with the following Server Side Conditions on them
---------------------------------------------------------------------------------------------------------------------------



Thanks in Advance
DSteele41