IBAERR2 ;ALB/AAS - RX COPAY EXEMPTION ERROR PROCESSOR ; 15-JAN-93
 ;;Version 2.0 ; INTEGRATED BILLING ;**26,34**; 21-MAR-94
 ;;Per VHA Directive 10-93-142, this routine should not be modified.
 ;
% ; -- medication copayment exemtpion errors
 Q:'$G(IBEXERR)!('$G(IBWHER))!('$G(IBJOB))
 ;
 N IBP,IBALERT
 S IBP=$$PT^IBEFUNC(DFN)
 I $$ALERT^IBAUTL7 S IBALERT=IBEXERR+10 D SEND^IBAERR3 G BQ
 D BULL
BQ Q
 ;
BULL ; -- send bulletin
 ;
 S XMSUB="Medication Copayment Exemption Error"
 S IBT(1)="The following Medication Copayment Exemption error occured"
 S IBT(2)="during the "_$P($T(JOB+(IBJOB-10)),";;",2)
 S IBT(3)=$P($T(WHERE+(IBWHER-10)),";;",2)
 S IBT(4)=""
 ;
 S IBT(5)="       Patient: "_$E($P(IBP,"^")_"               ",1,25)_"  PT. ID: "_$P(IBP,"^",2)
 I '$D(IBEVTP) N IBEVTP S IBEVTP=$$LST^IBARXEU0(DFN,DT)
 S IBT(6)="Current Status: "_$E($$TEXT^IBARXEU0($P(IBEVTP,"^",4))_"    ",1,10)_" - "_$P($G(^IBE(354.2,+$P(IBEVTP,"^",5),0)),"^")
 S IBT(7)=""
 S IBT(8)="    by: "_$P($G(^VA(200,DUZ,0)),"^")
 S Y=DT D D^DIQ S IBT(9)="    on: "_$P(Y,"@")
 S IBT(10)=""
 S IBT(11)="The following error occured:"
 S IBT(12)=$P($T(ERR+IBEXERR),";;",2)
 I IBEXERR=3 S IBT(12)=IBT(12)_"  (actual format was "_$S($G(IBDT)="":"<null>",1:IBDT)_")"
 S IBT(13)=""
 S IBT(14)="Use option Manually Change Copay Exemption (Hardships)"
 S IBT(15)="to verify exemption status."
 D SEND
BULLQ Q
 ;
SEND S XMDUZ="INTEGRATED BILLING PACKAGE",XMTEXT="IBT("
 K XMY S XMN=0
 S XMY(DUZ)=""
 S IBGRP=$P(^IBE(350.9,1,0),"^",9)
 F IBI=0:0 S IBI=$O(^XMB(3.8,+IBGRP,1,"B",IBI)) Q:'IBI  S XMY(IBI)=""
 D ^XMD
 K X,Y,IBI,IBT,IBGRP,XMDUZ,XMTEXT,XMY,XMSUB,XMZ
 Q
 ;
JOB ;;
 ;;Medication Copayment Installation/Conversion Process
 ;;Automated Exemption Link to Income Tests
 ;;Manual Update/Hardship exemption option
 ;;Automated Exemption Creation during Copay Billing
 ;;Print/Verify Medication Copayment Exemption Option
 ;;Automated Exemption Link to Patient Eligibility data
 ;;Update of Exemptions based on Prior Year Income
 ;;
WHERE ;;
 ;;while attempting to add a patient to the Billing Patient File.
 ;;while attempting to add a Billing Exemption.
 ;;from the automated exemption link to the Income tests.
 ;;while updating the current exemption status.
 ;;while inactivating an exemption record.
 ;;while looping thorough entries.
 ;;while processing in Accounts Receivable.
 ;;
ERR ;;
 ;;Entry locked by another user.
 ;;Failed to add patient to Billing Patient file.
 ;;Date in incorrect format.
 ;;Failed to add exemption record to Billing Exemptions file.
 ;;Failed while updating exemption record.
 ;;Failed while updating current exemption status
 ;;Failed while inactivating old exemption status
 ;;Failed to add exemption.  User not defined
 ;;Failed to add Patient to Billing Patient file, entry locked.
 ;;Failed during processing of decrease adjustment or refund.
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBAERR2   2923     printed  Sep 23, 2025@19:42:28                                                                                                                                                                                                     Page 2
IBAERR2   ;ALB/AAS - RX COPAY EXEMPTION ERROR PROCESSOR ; 15-JAN-93
 +1       ;;Version 2.0 ; INTEGRATED BILLING ;**26,34**; 21-MAR-94
 +2       ;;Per VHA Directive 10-93-142, this routine should not be modified.
 +3       ;
%         ; -- medication copayment exemtpion errors
 +1        if '$GET(IBEXERR)!('$GET(IBWHER))!('$GET(IBJOB))
               QUIT 
 +2       ;
 +3        NEW IBP,IBALERT
 +4        SET IBP=$$PT^IBEFUNC(DFN)
 +5        IF $$ALERT^IBAUTL7
               SET IBALERT=IBEXERR+10
               DO SEND^IBAERR3
               GOTO BQ
 +6        DO BULL
BQ         QUIT 
 +1       ;
BULL      ; -- send bulletin
 +1       ;
 +2        SET XMSUB="Medication Copayment Exemption Error"
 +3        SET IBT(1)="The following Medication Copayment Exemption error occured"
 +4        SET IBT(2)="during the "_$PIECE($TEXT(JOB+(IBJOB-10)),";;",2)
 +5        SET IBT(3)=$PIECE($TEXT(WHERE+(IBWHER-10)),";;",2)
 +6        SET IBT(4)=""
 +7       ;
 +8        SET IBT(5)="       Patient: "_$EXTRACT($PIECE(IBP,"^")_"               ",1,25)_"  PT. ID: "_$PIECE(IBP,"^",2)
 +9        IF '$DATA(IBEVTP)
               NEW IBEVTP
               SET IBEVTP=$$LST^IBARXEU0(DFN,DT)
 +10       SET IBT(6)="Current Status: "_$EXTRACT($$TEXT^IBARXEU0($PIECE(IBEVTP,"^",4))_"    ",1,10)_" - "_$PIECE($GET(^IBE(354.2,+$PIECE(IBEVTP,"^",5),0)),"^")
 +11       SET IBT(7)=""
 +12       SET IBT(8)="    by: "_$PIECE($GET(^VA(200,DUZ,0)),"^")
 +13       SET Y=DT
           DO D^DIQ
           SET IBT(9)="    on: "_$PIECE(Y,"@")
 +14       SET IBT(10)=""
 +15       SET IBT(11)="The following error occured:"
 +16       SET IBT(12)=$PIECE($TEXT(ERR+IBEXERR),";;",2)
 +17       IF IBEXERR=3
               SET IBT(12)=IBT(12)_"  (actual format was "_$SELECT($GET(IBDT)="":"<null>",1:IBDT)_")"
 +18       SET IBT(13)=""
 +19       SET IBT(14)="Use option Manually Change Copay Exemption (Hardships)"
 +20       SET IBT(15)="to verify exemption status."
 +21       DO SEND
BULLQ      QUIT 
 +1       ;
SEND       SET XMDUZ="INTEGRATED BILLING PACKAGE"
           SET XMTEXT="IBT("
 +1        KILL XMY
           SET XMN=0
 +2        SET XMY(DUZ)=""
 +3        SET IBGRP=$PIECE(^IBE(350.9,1,0),"^",9)
 +4        FOR IBI=0:0
               SET IBI=$ORDER(^XMB(3.8,+IBGRP,1,"B",IBI))
               if 'IBI
                   QUIT 
               SET XMY(IBI)=""
 +5        DO ^XMD
 +6        KILL X,Y,IBI,IBT,IBGRP,XMDUZ,XMTEXT,XMY,XMSUB,XMZ
 +7        QUIT 
 +8       ;
JOB       ;;
 +1       ;;Medication Copayment Installation/Conversion Process
 +2       ;;Automated Exemption Link to Income Tests
 +3       ;;Manual Update/Hardship exemption option
 +4       ;;Automated Exemption Creation during Copay Billing
 +5       ;;Print/Verify Medication Copayment Exemption Option
 +6       ;;Automated Exemption Link to Patient Eligibility data
 +7       ;;Update of Exemptions based on Prior Year Income
 +8       ;;
WHERE     ;;
 +1       ;;while attempting to add a patient to the Billing Patient File.
 +2       ;;while attempting to add a Billing Exemption.
 +3       ;;from the automated exemption link to the Income tests.
 +4       ;;while updating the current exemption status.
 +5       ;;while inactivating an exemption record.
 +6       ;;while looping thorough entries.
 +7       ;;while processing in Accounts Receivable.
 +8       ;;
ERR       ;;
 +1       ;;Entry locked by another user.
 +2       ;;Failed to add patient to Billing Patient file.
 +3       ;;Date in incorrect format.
 +4       ;;Failed to add exemption record to Billing Exemptions file.
 +5       ;;Failed while updating exemption record.
 +6       ;;Failed while updating current exemption status
 +7       ;;Failed while inactivating old exemption status
 +8       ;;Failed to add exemption.  User not defined
 +9       ;;Failed to add Patient to Billing Patient file, entry locked.
 +10      ;;Failed during processing of decrease adjustment or refund.