AHHFIS1 ;NCH/RLP   Complete Bills Pending Bill                05-Sep-01
        ;v1.0
        ;;
EN      S TITLE="Approve Bill of Collections - VISN 12"
        D TITLE^RGUT(TITLE)
        ;
        ; --- If extra security is warranted, uncomment tag EXTRA and enter
        ; --- the DUZ at the end of the routine following the example.
        ;
EXTRA   ;I '+$$USER(DUZ) D  G EXIT
        . S TITLE="Not authorized to use this option.  Contact Fiscal Service."
        . D EN^DDIOL(TITLE,,"!?5")
        ;
SIG     S DA=1 D SIG^PRCASIG I '$D(PRCANM) G EXIT
        ;
        ; --- Just for fun, here is a list of bills Pending Approval
        ;
LST     D EN^DDIOL(,,"!")
        K DIR
        S DIR(0)="Y"
        S DIR("A")="List 'Pending Approval' Bills"
        S DIR("B")="YES"
        D ^DIR K DIR
        ;
LSTY    I Y=1 D  ;
        . K OUT D FIND^DIC(430,,"@;.01",,"PENDING APPROVAL",,"AC",,,"OUT")
        . S LOOP="",EXIT=0
        . F  S LOOP=$O(OUT("DILIST","ID",LOOP)) Q:LOOP=""!(EXIT)  D  ;
        . . D EN^DDIOL(OUT("DILIST","ID",LOOP,.01),"","!?5")
        . . I $Y+6>IOSL D  ;
        . . . S DIR(0)="E"
        . . . D ^DIR K DIR
        . . . I Y'=1 S EXIT=1 Q
        . . . D TITLE^RGUT(TITLE)
        . K OUT
        ;
        ; --- The following code form tag SVC to SVCQ is the same code from
        ; --- routine PRCABIL3 tag APPRV to A1+3 with slight modifications.
        ; --- Routine will call YN1^PRCABIL3 routine.
        ;
SVC     D SVC^PRCABIL I '$D(PRCAP("S")) G EXIT
        ;
        ; verify: status is pending approval and
        ;         node PRCA(430,Y,100) is defined
        ;
        S DIC("S")="I $P(^PRCA(430,Y,0),U,8)=20,$D(^PRCA(430,Y,100))"
        S PRCATIME=DTIME
        S DTIME=60
        D BILLN^PRCAUTL
        S DTIME=PRCATIME
CHK     I '$D(PRCABN) G EXIT
        L +^PRCA(430,PRCABN,0):0 I '$T D  G LST
        . S TITLE1="Another user is editing bill: "_$P(^PRCA(430,PRCABN,0),U)
        . D TITLE^RGUT(TITLE,,TITLE1)
        . D KILLV^PRCABIL3
        S PRCABT=+^PRCA(430,PRCABN,100)
        I 'PRCABT!(PRCABT>3) G EXIT
SVCQ    D YN1^PRCABIL3
        ;
        ; --- Everyone exits here.
        ;
EXIT    D KILLV^PRCABIL3
        K EXIT,LOOP,OK,PRCA,TITLE,TITLE1,USERDUZ
        Q
        ;
USER(DUZ)       ;
        N OK,LOOP,USERDUZ
        S OK=0
        F LOOP=1:1 S USERDUZ=$P($E($T(EMP+LOOP),4,99),U) Q:USERDUZ=""!(OK)  D  ;
        . I USERDUZ=DUZ S OK=1
        Q OK
        ;
        ; --- Optional: Enter user DUZs if extra security is needed.
        ; --- Example: ;;DUZ^Employee Name (optional)
EMP     ;
        ;;.5^Postmaster