RCDPUDEP ;WISC/RFJ - Deposit Utilities ;29/MAY/2008
;;4.5;Accounts Receivable;**114,173,257,283,297,304,380**;Mar 20, 1995;Build 14
;;Per VA Directive 6402, this routine should not be modified.
Q
;
;
ADDDEPT(DEPOSIT,DEPDATE) ; if the deposit is not entered, add it
;
; if deposit date is missing, do not add the deposit
I 'DEPDATE Q 0
;
; PRCA *4.5*380 - No longer limiting to one record for deposit number/date
; already in file, deposit number and deposit date match
;N DA,RCDPFLAG
;S DA=0 F S DA=$O(^RCY(344.1,"B",DEPOSIT,DA)) Q:'DA I $P($G(^RCY(344.1,DA,0)),"^",3)=DEPDATE S RCDPFLAG=1 Q
;I $G(RCDPFLAG) Q DA
;
; add it
N %,%DT,D0,DA,DD,DI,DIC,DIE,DLAYGO,DO,DQ,DR,X,Y
S DIC="^RCY(344.1,",DIC(0)="L",DLAYGO=344.1
; .03 = deposit date .06 = opened by
; .07 = date/time opened .12 = status (set to 1:open)
S DIC("DR")=".03////"_DEPDATE_";.06////"_DUZ_";.07///NOW;.12////1;"
S X=DEPOSIT
D FILE^DICN
I Y>0 Q +Y
Q 0
;
;
SELDEPT(ADDNEW) ; select a deposit
; if $g(addnew) allow adding a new deposit
; returns -1 for timeout or ^, 0 for no selection, or ien of deposit
N %,%T,%Y,C,D0,DA,DIC,DIE,DLAYGO,DQ,DR,DTOUT,DUOUT,RCDEFLUP,X,Y
S DIC="^RCY(344.1,",DIC(0)="QEAM",DIC("A")="Select DEPOSIT: "
S DIC("W")="D DICW^RCDPUDEP"
; use special lookup on input
S RCDEFLUP=1
I $G(ADDNEW) S DIC(0)="QEALM",DLAYGO=344.1,DIC("DR")=".03///TODAY;.06////"_DUZ_";.07///NOW;.12////1;"
D ^DIC
I Y<0,'$G(DUOUT),'$G(DTOUT) S Y=0
Q +Y
;
;
DICW ; write identifier code for receipt lookup
N DATA
S DATA=$G(^RCY(344.1,Y,0)) I DATA="" Q
; opened by
W ?13,"by: ",$E($P($G(^VA(200,+$P(DATA,"^",6),0)),"^"),1,15)
; date opened
I '$P(DATA,"^",7) S $P(DATA,"^",7)="???????"
W ?35," on: ",$E($P(DATA,"^",7),4,5),"/",$E($P(DATA,"^",7),6,7),"/",$E($P(DATA,"^",7),2,3)
; total dollars
W ?50," amt: $",$J($P(DATA,"^",4),9,2)
; status
W ?69," ",$P("N/A^OPEN^DEPOSITED^CONFIRMED^PROCESSED^VOID","^",+$P(DATA,"^",12)+1)
Q
;
;
LOOKUP ; special lookup on deposits, called from ^dd(344.1,.01,7.5)
; if rcdeflup flag not set, do not use special lookup
I '$D(RCDEFLUP) Q
; 1:OPEN;3:CONFIRMED
; user entered O.? for lookup on open deposits
I X["O."!(X["o.") S DIC("S")="I $P(^(0),U,12)=1" S X="?" Q
; user entered C.? for lookup on confirmed deposits
I X["C."!(X["c.") S DIC("S")="I $P(^(0),U,12)=3" S X="?" Q
; deposit ticket # manually added is for electronic ticket only
; PRCA*283 - remove the restriction.
;I $G(DIC(0))["L",$$AUTODEP(X) D EN^DDIOL(" ** Deposit #'s starting with "_$E(X,1,3)_" can only be used by automatic deposits",,"!") S X="" Q
; PRCA*297 - change format of ticket #.
I $G(DIC(0))["L",'$D(^RCY(344.1,"B",X)),X'?1A6N D MSG,EN^DDIOL(.MSG) S X="" Q
K DIC("S"),MSG(1),MSG(2),MSG(3),MSG
Q
;
;
EDITDEP(DA,ASKDATE) ; edit the deposit
; if $g(askdate) ask only the deposit date
N %,D,D0,DI,DIC,DIE,DQ,DR,J,X,Y
S (DIC,DIE)="^RCY(344.1,",DR=""
; deposit date(.03), do not allow edit if closed or either lockbox
I $$CHECKDEP^RCDPDPLU(DA) S DR=".03BANK DEPOSIT DATE//TODAY;"
; bank(.13)
S DR=DR_".13//"_$P($G(^RC(342.1,+$O(^RC(342.1,"AC",9,0)),0)),"^")_";"
; bank trace(.05)
S DR=DR_".05;"
; agency title(.17)
S DR=DR_".17//"_$P($G(^RC(342.1,+$O(^RC(342.1,"AC",10,0)),0)),"^")_";"
; agency location code(.14), comments(1)
S DR=DR_".14//"_$P(^RC(342,1,0),"^",7)_";1;"
;
; only ask deposit date
I $G(ASKDATE) S DR=".03BANK DEPOSIT DATE//TODAY;"
D ^DIE
Q
;
;
CONFIRM(DA) ; confirm the deposit
N %DT,D,D0,DI,DIC,DIE,DQ,DR,X,Y
S (DIC,DIE)="^RCY(344.1,"
S DR=".04///"_$$TOTAL(DA)_";.12////3;.1////"_DUZ_";.11///NOW;"
D ^DIE
Q
;
;
TOTAL(RCDEPTDA) ; compute total dollars for all receipts on the deposit
N RCRECTDA,RCTRANDA,TOTAL
S RCRECTDA=0
F S RCRECTDA=$O(^RCY(344,"AD",RCDEPTDA,RCRECTDA)) Q:'RCRECTDA D
. S RCTRANDA=0
. F S RCTRANDA=$O(^RCY(344,RCRECTDA,1,RCTRANDA)) Q:'RCTRANDA D
. . S TOTAL=$G(TOTAL)+$P($G(^RCY(344,RCRECTDA,1,RCTRANDA,0)),"^",4)
Q +$G(TOTAL)
;
AUTODEP(X) ; Function returns 1 if the deposit ticket # in X is in the auto
; deposit number space 269xxx, 369xxx, 469xxx, 569xxx, or 669xxx
; and hasn't been previously entered via lockbox interface.
;
N Y
S Y=0
I $L(X)=6,$E(X,2,3)="69","23456"[$E(X),'$D(^RCY(344.1,"B",X)) S Y=1
Q Y
;
CHK ; Check if a valid input
D MSG
I '$D(X) D EN^DDIOL(.MSG) Q
I X?6N!(X?9N) Q
I X?1A6N Q
D EN^DDIOL(.MSG)
K X,MSG(1),MSG(2),MSG(3),MSG
Q
;
MSG ;
S MSG(1)=" * Ticket numbers must have one alpha character followed by six digits or"
S MSG(2)=" any 6 or 9 digits existing deposit ticket #."
S MSG(3,"F")="!"
Q
;
;PRCA*4.5*304
PREPDEPT() ;Check to see if Deposit number is currently in use.
;
N RCARRAY,RCDEP,RCNOW,RCOPT,RCRESULT,RCDA,RCTODAY,RCVALID,RCANS,MSG
;
; Ask for the deposit number, checking for the lookup
; continue until the user wishes to quit.
;
; Exist Deposit retrieval loop if the user wishes to exit or the user selects a deposit
F D Q:RCOPT="" Q:RCANS
. N DA,DIR,X,Y,DTOUT,DIROUT,DUOUT,DIRUT ;define ^DIR variables
. S (RCOPT,Y,X)="",RCANS=0
. S DIR(0)="FO"
. S DIR("?")="^D ARYLST^RCDPUDEP"
. S DIR("??")="^D ARYPRNT^RCDPUDEP"
. S DIR("A")="Select Deposit"
. D ^DIR
. ;
. ; Exit if user wishes to abort
. I $G(DTOUT)!($G(DUOUT))!($G(DIROUT))!(Y="") Q
. S RCDEP=Y
. ;
. K DA,DIR,X,Y,DTOUT,DIROUT,DUOUT,DIRUT ; clean up ^DIR variables
. ;
. S RCVALID=0
. ; quit if input is invalid,
. S:(RCDEP?6N)!(RCDEP?9N) RCVALID=1
. S:(RCDEP?1A6N) RCVALID=1
. I 'RCVALID D Q
. . S RCOPT="X" ; Allow the user to retry
. . D MSG
. . D EN^DDIOL(.MSG)
. . K MSG
. ;
. ; if it exists, display and ask for a deposit date with today as the default
. ; Parameters - File,,Field(s),Look Up flags,deposit #,,,,,result array
. ;
. ; Valid Deposit, re-init exit flag
. S RCOPT=0 ;
. ;
. D FIND^DIC(344.1,"","@;.01;.03I;.12I","M",RCDEP,"","","","","RCARRAY")
. ;
. ; Numeric deposit ticket numbers can only be edited, not created.
. I (+$G(RCARRAY("DILIST",0))=0),(RCDEP?9N) D MSG,EN^DDIOL(.MSG) K MSG Q
. ;
. ;if the deposit number has been used before, then check with user to see if a new
. ; one should be created. If not, then and "x" is returned. Otherwise, the new
. ; the user's selection is returned.
. I +$G(RCARRAY("DILIST",0))>0 S RCOPT=$$DISPOPT(.RCARRAY)
. ;
. Q:(RCOPT="u")!(RCOPT="x")!(RCOPT="")
. ;
. ; If user selected a deposit, return the deposit #
. I +RCOPT S RCDA=$G(RCARRAY("DILIST",2,RCOPT)),RCANS=RCOPT Q
. ;
. ; Confirm with user to add new deposit number
. ; Reset ^DIR input and output variables
. N DA,DIR,X,Y,DTOUT,DIROUT,DUOUT,DIRUT ; define ^DIR variables
. S DIR(0)="YO",DIR("B")="NO"
. S DIR("A")=" Are you adding "_RCDEP_" as a new Deposit ticket (Y/N) "
. D ^DIR
. ;
. ; Exit if user wishes to abort
. ;I $G(DTOUT)!($G(DUOUT))!($G(DIROUT)) S RCOPT="" Q
. I $G(DTOUT)!($G(DUOUT))!($G(DIROUT)) Q
. ;
. S RCANS=+Y
. K DA,DIR,X,Y,DTOUT,DIROUT,DUOUT,DIRUT ;clean up ^DIR variables
;
; Exit if user wishes to quit (RCOPT="").
Q:RCOPT="" ""
Q:+RCOPT RCDA
;
; add it
N %,%DT,D0,DA,DD,DI,DIC,DIE,DLAYGO,DO,DQ,DR,X,Y
S DIC="^RCY(344.1,",DIC(0)="L",DLAYGO=344.1
;
;Init local versions of NOW and TODAY
S RCNOW=$$NOW^XLFDT,RCTODAY=$P(RCNOW,".")
;
; .03 = deposit date .06 = opened by
; .07 = date/time opened .12 = status (set to 1:open)
S DIC("DR")=".03////"_RCTODAY_";.06////"_DUZ_";.07///"_RCNOW_";.12////1"
S X=RCDEP
D FILE^DICN
I Y>0 Q +Y
Q 0
;
;PRCA*4.5*304
DISPOPT(RCARRAY) ; display the deposits to select from
;
N RCARYCT,RCCT,RCDATA,RCDPDT,RCIEN,RCNOW,RCTODAY
N DA,DIR,MSG,X,Y,DTOUT,DIROUT,DUOUT,DIRUT
;
;Init local versions of NOW and TODAY
S RCNOW=$$NOW^XLFDT,RCTODAY=$P(RCNOW,".")
;
;Get the number of entries in the array
S RCARYCT=+RCARRAY("DILIST",0)
;
; Loop to retrieve user's desired version of the Deposit.
F D Q:Y'=""
. ;Create some separation from the last item printed
. W !! ; Create some separation
. ;
. ;Display options to user
. F RCCT=1:1:RCARYCT D
. . S RCIEN=$G(RCARRAY("DILIST",2,RCCT))
. . S RCDATA=$G(^RCY(344.1,RCIEN,0)) I RCDATA="" Q
. . W RCCT,?3,$P(RCDATA,U)
. . W ?13,"by: ",$E($P($G(^VA(200,+$P(RCDATA,"^",6),0)),"^"),1,15)
. . I '$P(RCDATA,"^",7) S $P(RCDATA,"^",7)="???????"
. . W ?35," on: ",$E($P(RCDATA,"^",7),4,5),"/",$E($P(RCDATA,"^",7),6,7),"/",$E($P(RCDATA,"^",7),2,3)
. . W ?50," amt: $",$J($P(RCDATA,"^",4),9,2)
. . W ?69," ",$P("N/A^OPEN^DEPOSITED^CONFIRMED^PROCESSED^VOID","^",+$P(RCDATA,"^",12)+1),!
. ;
. ; ask user which deposit to edit or select the default which is NEW
. ;
. S DIR(0)="FO" ;,DIR("B")="NEW"
. S DIR("A",1)=" Enter the line# to view an existing deposit or (N) to create a NEW deposit"
. S DIR("A")=" or e(X)it"
. D ^DIR
. W ! ;spacing after DIR call.
. ;
. ; Exit if user wishes to abort
. I $G(DTOUT)!($G(DUOUT))!($G(DIROUT)) S Y="^" Q
. ;
. ;The user entered an incorrect deposit # so exit.
. S Y=$$UP^XLFSTR(Y)
. I (Y'?1N.N),(Y'="N") S Y="x" Q
. ;
. ; If New, double-check to see if deposit hasn't been created for today already. If so, clear the user response
. ; and ask them to try again.
. I Y="N" D
. . ; Double-check to ensure a current one for today is not open already.
. . F RCCT=1:1:RCARYCT D Q:Y=""
. . . S RCDPDT=$G(RCARRAY("DILIST","ID",RCCT,".03"))
. . . I RCDPDT=RCTODAY D
. . . . S Y="" ;Invalid response. Re-init and force the user to retry
. . . . S MSG(1)="ERROR: Entered Deposit Ticket# already exists for today - Please"
. . . . S MSG(2)=" select the appropriate line # to modify the existing"
. . . . S MSG(3)=" deposit or e(X)it to enter a different Deposit Ticket#."
. . . . D EN^DDIOL(.MSG)
. . . . K MSG
. . . S RCSTAT=$G(RCARRAY("DILIST","ID",RCCT,".12"))
. . . I RCSTAT'=3 D ; If the deposit is not confirmed, error out
. . . . S Y="" ;Invalid response. Re-init and force the user to retry
. . . . S MSG(1)="ERROR: Cannot create new deposit ticket- there is an existing"
. . . . S MSG(2)=" deposit with the same # that is not in CONFIRMED status"
. . . . D EN^DDIOL(.MSG)
. . . . K MSG
. I (Y?1N.N),(Y<1)!(Y>RCARYCT) S Y="u"
;
Q:Y="^" "" ; send a "t" to indicate a user requested exit to force a reprompt of the Select Deposit Prompt.
Q Y
;
; Mimic ? and ?? functionality in DIC calls
;PRCA*4.5*304
ARYLST ;
;
N X,Y,DIROUT,DIRUT,DUOUT,DTOUT,DIR
S DIR("A",1)="Answer with AR DEPOSIT TICKET #"
S DIR("A")="Do you want the entire "_$P($G(^RCY(344.1,0)),U,4)_"-Entry AR DEPOSIT List? "
S DIR(0)="Y",DIR("B")="N"
D ^DIR
;
;User answered Yes (value 1), so print the list as if doing a ??
I Y=1 D ARYPRNT ;print the list
Q
;
;Print the list of deposits (mimicking a ^DIC or pointer type DIR call)
;PRCA*4.5*304
ARYPRNT ;
;
N I,Y,ENDFLG,RCCT
;
W !!,?3,"Choose from:",!
S I="",(ENDFLG,RCCT)=0
F S I=$O(^RCY(344.1,"B",I)) Q:I="" D Q:ENDFLG
. S Y=""
. F S Y=$O(^RCY(344.1,"B",I,Y)) Q:Y="" D Q:ENDFLG
. . S RCCT=RCCT+1
. . W ?3,I
. . D DICW
. . W ! ;Write the end
. . I RCCT>(IOSL-3) D
. . . ;ask if user wishes to continue, reset line counter
. . . S ENDFLG=$$PROMPT(),RCCT=0
;
;Print the list
;
;End of list printout
W !!,?5,"You may enter a new AR DEPOSIT, if you wish",!
W ?5,"Answer must be 7 characters in length. 9 digits can only be entered",!
W ?5,"by automated payments.",!!
Q
;
;PRCA*4.5*304
;Prompt user to continue
PROMPT() ;
;
N X,Y,DIROUT,DIRUT,DUOUT,DTOUT,DIR
S DIR("A")="'^' to stop"
S DIR(0)="FO"
D ^DIR
;
;If time out or user ^ then send exit flag, otherwise, continue
I $D(DTOUT)!$D(DUOUT) Q 1
Q 0
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCDPUDEP 12016 printed Nov 22, 2024@16:56:46 Page 2
RCDPUDEP ;WISC/RFJ - Deposit Utilities ;29/MAY/2008
+1 ;;4.5;Accounts Receivable;**114,173,257,283,297,304,380**;Mar 20, 1995;Build 14
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 QUIT
+4 ;
+5 ;
ADDDEPT(DEPOSIT,DEPDATE) ; if the deposit is not entered, add it
+1 ;
+2 ; if deposit date is missing, do not add the deposit
+3 IF 'DEPDATE
QUIT 0
+4 ;
+5 ; PRCA *4.5*380 - No longer limiting to one record for deposit number/date
+6 ; already in file, deposit number and deposit date match
+7 ;N DA,RCDPFLAG
+8 ;S DA=0 F S DA=$O(^RCY(344.1,"B",DEPOSIT,DA)) Q:'DA I $P($G(^RCY(344.1,DA,0)),"^",3)=DEPDATE S RCDPFLAG=1 Q
+9 ;I $G(RCDPFLAG) Q DA
+10 ;
+11 ; add it
+12 NEW %,%DT,D0,DA,DD,DI,DIC,DIE,DLAYGO,DO,DQ,DR,X,Y
+13 SET DIC="^RCY(344.1,"
SET DIC(0)="L"
SET DLAYGO=344.1
+14 ; .03 = deposit date .06 = opened by
+15 ; .07 = date/time opened .12 = status (set to 1:open)
+16 SET DIC("DR")=".03////"_DEPDATE_";.06////"_DUZ_";.07///NOW;.12////1;"
+17 SET X=DEPOSIT
+18 DO FILE^DICN
+19 IF Y>0
QUIT +Y
+20 QUIT 0
+21 ;
+22 ;
SELDEPT(ADDNEW) ; select a deposit
+1 ; if $g(addnew) allow adding a new deposit
+2 ; returns -1 for timeout or ^, 0 for no selection, or ien of deposit
+3 NEW %,%T,%Y,C,D0,DA,DIC,DIE,DLAYGO,DQ,DR,DTOUT,DUOUT,RCDEFLUP,X,Y
+4 SET DIC="^RCY(344.1,"
SET DIC(0)="QEAM"
SET DIC("A")="Select DEPOSIT: "
+5 SET DIC("W")="D DICW^RCDPUDEP"
+6 ; use special lookup on input
+7 SET RCDEFLUP=1
+8 IF $GET(ADDNEW)
SET DIC(0)="QEALM"
SET DLAYGO=344.1
SET DIC("DR")=".03///TODAY;.06////"_DUZ_";.07///NOW;.12////1;"
+9 DO ^DIC
+10 IF Y<0
IF '$GET(DUOUT)
IF '$GET(DTOUT)
SET Y=0
+11 QUIT +Y
+12 ;
+13 ;
DICW ; write identifier code for receipt lookup
+1 NEW DATA
+2 SET DATA=$GET(^RCY(344.1,Y,0))
IF DATA=""
QUIT
+3 ; opened by
+4 WRITE ?13,"by: ",$EXTRACT($PIECE($GET(^VA(200,+$PIECE(DATA,"^",6),0)),"^"),1,15)
+5 ; date opened
+6 IF '$PIECE(DATA,"^",7)
SET $PIECE(DATA,"^",7)="???????"
+7 WRITE ?35," on: ",$EXTRACT($PIECE(DATA,"^",7),4,5),"/",$EXTRACT($PIECE(DATA,"^",7),6,7),"/",$EXTRACT($PIECE(DATA,"^",7),2,3)
+8 ; total dollars
+9 WRITE ?50," amt: $",$JUSTIFY($PIECE(DATA,"^",4),9,2)
+10 ; status
+11 WRITE ?69," ",$PIECE("N/A^OPEN^DEPOSITED^CONFIRMED^PROCESSED^VOID","^",+$PIECE(DATA,"^",12)+1)
+12 QUIT
+13 ;
+14 ;
LOOKUP ; special lookup on deposits, called from ^dd(344.1,.01,7.5)
+1 ; if rcdeflup flag not set, do not use special lookup
+2 IF '$DATA(RCDEFLUP)
QUIT
+3 ; 1:OPEN;3:CONFIRMED
+4 ; user entered O.? for lookup on open deposits
+5 IF X["O."!(X["o.")
SET DIC("S")="I $P(^(0),U,12)=1"
SET X="?"
QUIT
+6 ; user entered C.? for lookup on confirmed deposits
+7 IF X["C."!(X["c.")
SET DIC("S")="I $P(^(0),U,12)=3"
SET X="?"
QUIT
+8 ; deposit ticket # manually added is for electronic ticket only
+9 ; PRCA*283 - remove the restriction.
+10 ;I $G(DIC(0))["L",$$AUTODEP(X) D EN^DDIOL(" ** Deposit #'s starting with "_$E(X,1,3)_" can only be used by automatic deposits",,"!") S X="" Q
+11 ; PRCA*297 - change format of ticket #.
+12 IF $GET(DIC(0))["L"
IF '$DATA(^RCY(344.1,"B",X))
IF X'?1A6N
DO MSG
DO EN^DDIOL(.MSG)
SET X=""
QUIT
+13 KILL DIC("S"),MSG(1),MSG(2),MSG(3),MSG
+14 QUIT
+15 ;
+16 ;
EDITDEP(DA,ASKDATE) ; edit the deposit
+1 ; if $g(askdate) ask only the deposit date
+2 NEW %,D,D0,DI,DIC,DIE,DQ,DR,J,X,Y
+3 SET (DIC,DIE)="^RCY(344.1,"
SET DR=""
+4 ; deposit date(.03), do not allow edit if closed or either lockbox
+5 IF $$CHECKDEP^RCDPDPLU(DA)
SET DR=".03BANK DEPOSIT DATE//TODAY;"
+6 ; bank(.13)
+7 SET DR=DR_".13//"_$PIECE($GET(^RC(342.1,+$ORDER(^RC(342.1,"AC",9,0)),0)),"^")_";"
+8 ; bank trace(.05)
+9 SET DR=DR_".05;"
+10 ; agency title(.17)
+11 SET DR=DR_".17//"_$PIECE($GET(^RC(342.1,+$ORDER(^RC(342.1,"AC",10,0)),0)),"^")_";"
+12 ; agency location code(.14), comments(1)
+13 SET DR=DR_".14//"_$PIECE(^RC(342,1,0),"^",7)_";1;"
+14 ;
+15 ; only ask deposit date
+16 IF $GET(ASKDATE)
SET DR=".03BANK DEPOSIT DATE//TODAY;"
+17 DO ^DIE
+18 QUIT
+19 ;
+20 ;
CONFIRM(DA) ; confirm the deposit
+1 NEW %DT,D,D0,DI,DIC,DIE,DQ,DR,X,Y
+2 SET (DIC,DIE)="^RCY(344.1,"
+3 SET DR=".04///"_$$TOTAL(DA)_";.12////3;.1////"_DUZ_";.11///NOW;"
+4 DO ^DIE
+5 QUIT
+6 ;
+7 ;
TOTAL(RCDEPTDA) ; compute total dollars for all receipts on the deposit
+1 NEW RCRECTDA,RCTRANDA,TOTAL
+2 SET RCRECTDA=0
+3 FOR
SET RCRECTDA=$ORDER(^RCY(344,"AD",RCDEPTDA,RCRECTDA))
if 'RCRECTDA
QUIT
Begin DoDot:1
+4 SET RCTRANDA=0
+5 FOR
SET RCTRANDA=$ORDER(^RCY(344,RCRECTDA,1,RCTRANDA))
if 'RCTRANDA
QUIT
Begin DoDot:2
+6 SET TOTAL=$GET(TOTAL)+$PIECE($GET(^RCY(344,RCRECTDA,1,RCTRANDA,0)),"^",4)
End DoDot:2
End DoDot:1
+7 QUIT +$GET(TOTAL)
+8 ;
AUTODEP(X) ; Function returns 1 if the deposit ticket # in X is in the auto
+1 ; deposit number space 269xxx, 369xxx, 469xxx, 569xxx, or 669xxx
+2 ; and hasn't been previously entered via lockbox interface.
+3 ;
+4 NEW Y
+5 SET Y=0
+6 IF $LENGTH(X)=6
IF $EXTRACT(X,2,3)="69"
IF "23456"[$EXTRACT(X)
IF '$DATA(^RCY(344.1,"B",X))
SET Y=1
+7 QUIT Y
+8 ;
CHK ; Check if a valid input
+1 DO MSG
+2 IF '$DATA(X)
DO EN^DDIOL(.MSG)
QUIT
+3 IF X?6N!(X?9N)
QUIT
+4 IF X?1A6N
QUIT
+5 DO EN^DDIOL(.MSG)
+6 KILL X,MSG(1),MSG(2),MSG(3),MSG
+7 QUIT
+8 ;
MSG ;
+1 SET MSG(1)=" * Ticket numbers must have one alpha character followed by six digits or"
+2 SET MSG(2)=" any 6 or 9 digits existing deposit ticket #."
+3 SET MSG(3,"F")="!"
+4 QUIT
+5 ;
+6 ;PRCA*4.5*304
PREPDEPT() ;Check to see if Deposit number is currently in use.
+1 ;
+2 NEW RCARRAY,RCDEP,RCNOW,RCOPT,RCRESULT,RCDA,RCTODAY,RCVALID,RCANS,MSG
+3 ;
+4 ; Ask for the deposit number, checking for the lookup
+5 ; continue until the user wishes to quit.
+6 ;
+7 ; Exist Deposit retrieval loop if the user wishes to exit or the user selects a deposit
+8 FOR
Begin DoDot:1
+9 ;define ^DIR variables
NEW DA,DIR,X,Y,DTOUT,DIROUT,DUOUT,DIRUT
+10 SET (RCOPT,Y,X)=""
SET RCANS=0
+11 SET DIR(0)="FO"
+12 SET DIR("?")="^D ARYLST^RCDPUDEP"
+13 SET DIR("??")="^D ARYPRNT^RCDPUDEP"
+14 SET DIR("A")="Select Deposit"
+15 DO ^DIR
+16 ;
+17 ; Exit if user wishes to abort
+18 IF $GET(DTOUT)!($GET(DUOUT))!($GET(DIROUT))!(Y="")
QUIT
+19 SET RCDEP=Y
+20 ;
+21 ; clean up ^DIR variables
KILL DA,DIR,X,Y,DTOUT,DIROUT,DUOUT,DIRUT
+22 ;
+23 SET RCVALID=0
+24 ; quit if input is invalid,
+25 if (RCDEP?6N)!(RCDEP?9N)
SET RCVALID=1
+26 if (RCDEP?1A6N)
SET RCVALID=1
+27 IF 'RCVALID
Begin DoDot:2
+28 ; Allow the user to retry
SET RCOPT="X"
+29 DO MSG
+30 DO EN^DDIOL(.MSG)
+31 KILL MSG
End DoDot:2
QUIT
+32 ;
+33 ; if it exists, display and ask for a deposit date with today as the default
+34 ; Parameters - File,,Field(s),Look Up flags,deposit #,,,,,result array
+35 ;
+36 ; Valid Deposit, re-init exit flag
+37 ;
SET RCOPT=0
+38 ;
+39 DO FIND^DIC(344.1,"","@;.01;.03I;.12I","M",RCDEP,"","","","","RCARRAY")
+40 ;
+41 ; Numeric deposit ticket numbers can only be edited, not created.
+42 IF (+$GET(RCARRAY("DILIST",0))=0)
IF (RCDEP?9N)
DO MSG
DO EN^DDIOL(.MSG)
KILL MSG
QUIT
+43 ;
+44 ;if the deposit number has been used before, then check with user to see if a new
+45 ; one should be created. If not, then and "x" is returned. Otherwise, the new
+46 ; the user's selection is returned.
+47 IF +$GET(RCARRAY("DILIST",0))>0
SET RCOPT=$$DISPOPT(.RCARRAY)
+48 ;
+49 if (RCOPT="u")!(RCOPT="x")!(RCOPT="")
QUIT
+50 ;
+51 ; If user selected a deposit, return the deposit #
+52 IF +RCOPT
SET RCDA=$GET(RCARRAY("DILIST",2,RCOPT))
SET RCANS=RCOPT
QUIT
+53 ;
+54 ; Confirm with user to add new deposit number
+55 ; Reset ^DIR input and output variables
+56 ; define ^DIR variables
NEW DA,DIR,X,Y,DTOUT,DIROUT,DUOUT,DIRUT
+57 SET DIR(0)="YO"
SET DIR("B")="NO"
+58 SET DIR("A")=" Are you adding "_RCDEP_" as a new Deposit ticket (Y/N) "
+59 DO ^DIR
+60 ;
+61 ; Exit if user wishes to abort
+62 ;I $G(DTOUT)!($G(DUOUT))!($G(DIROUT)) S RCOPT="" Q
+63 IF $GET(DTOUT)!($GET(DUOUT))!($GET(DIROUT))
QUIT
+64 ;
+65 SET RCANS=+Y
+66 ;clean up ^DIR variables
KILL DA,DIR,X,Y,DTOUT,DIROUT,DUOUT,DIRUT
End DoDot:1
if RCOPT=""
QUIT
if RCANS
QUIT
+67 ;
+68 ; Exit if user wishes to quit (RCOPT="").
+69 if RCOPT=""
QUIT ""
+70 if +RCOPT
QUIT RCDA
+71 ;
+72 ; add it
+73 NEW %,%DT,D0,DA,DD,DI,DIC,DIE,DLAYGO,DO,DQ,DR,X,Y
+74 SET DIC="^RCY(344.1,"
SET DIC(0)="L"
SET DLAYGO=344.1
+75 ;
+76 ;Init local versions of NOW and TODAY
+77 SET RCNOW=$$NOW^XLFDT
SET RCTODAY=$PIECE(RCNOW,".")
+78 ;
+79 ; .03 = deposit date .06 = opened by
+80 ; .07 = date/time opened .12 = status (set to 1:open)
+81 SET DIC("DR")=".03////"_RCTODAY_";.06////"_DUZ_";.07///"_RCNOW_";.12////1"
+82 SET X=RCDEP
+83 DO FILE^DICN
+84 IF Y>0
QUIT +Y
+85 QUIT 0
+86 ;
+87 ;PRCA*4.5*304
DISPOPT(RCARRAY) ; display the deposits to select from
+1 ;
+2 NEW RCARYCT,RCCT,RCDATA,RCDPDT,RCIEN,RCNOW,RCTODAY
+3 NEW DA,DIR,MSG,X,Y,DTOUT,DIROUT,DUOUT,DIRUT
+4 ;
+5 ;Init local versions of NOW and TODAY
+6 SET RCNOW=$$NOW^XLFDT
SET RCTODAY=$PIECE(RCNOW,".")
+7 ;
+8 ;Get the number of entries in the array
+9 SET RCARYCT=+RCARRAY("DILIST",0)
+10 ;
+11 ; Loop to retrieve user's desired version of the Deposit.
+12 FOR
Begin DoDot:1
+13 ;Create some separation from the last item printed
+14 ; Create some separation
WRITE !!
+15 ;
+16 ;Display options to user
+17 FOR RCCT=1:1:RCARYCT
Begin DoDot:2
+18 SET RCIEN=$GET(RCARRAY("DILIST",2,RCCT))
+19 SET RCDATA=$GET(^RCY(344.1,RCIEN,0))
IF RCDATA=""
QUIT
+20 WRITE RCCT,?3,$PIECE(RCDATA,U)
+21 WRITE ?13,"by: ",$EXTRACT($PIECE($GET(^VA(200,+$PIECE(RCDATA,"^",6),0)),"^"),1,15)
+22 IF '$PIECE(RCDATA,"^",7)
SET $PIECE(RCDATA,"^",7)="???????"
+23 WRITE ?35," on: ",$EXTRACT($PIECE(RCDATA,"^",7),4,5),"/",$EXTRACT($PIECE(RCDATA,"^",7),6,7),"/",$EXTRACT($PIECE(RCDATA,"^",7),2,3)
+24 WRITE ?50," amt: $",$JUSTIFY($PIECE(RCDATA,"^",4),9,2)
+25 WRITE ?69," ",$PIECE("N/A^OPEN^DEPOSITED^CONFIRMED^PROCESSED^VOID","^",+$PIECE(RCDATA,"^",12)+1),!
End DoDot:2
+26 ;
+27 ; ask user which deposit to edit or select the default which is NEW
+28 ;
+29 ;,DIR("B")="NEW"
SET DIR(0)="FO"
+30 SET DIR("A",1)=" Enter the line# to view an existing deposit or (N) to create a NEW deposit"
+31 SET DIR("A")=" or e(X)it"
+32 DO ^DIR
+33 ;spacing after DIR call.
WRITE !
+34 ;
+35 ; Exit if user wishes to abort
+36 IF $GET(DTOUT)!($GET(DUOUT))!($GET(DIROUT))
SET Y="^"
QUIT
+37 ;
+38 ;The user entered an incorrect deposit # so exit.
+39 SET Y=$$UP^XLFSTR(Y)
+40 IF (Y'?1N.N)
IF (Y'="N")
SET Y="x"
QUIT
+41 ;
+42 ; If New, double-check to see if deposit hasn't been created for today already. If so, clear the user response
+43 ; and ask them to try again.
+44 IF Y="N"
Begin DoDot:2
+45 ; Double-check to ensure a current one for today is not open already.
+46 FOR RCCT=1:1:RCARYCT
Begin DoDot:3
+47 SET RCDPDT=$GET(RCARRAY("DILIST","ID",RCCT,".03"))
+48 IF RCDPDT=RCTODAY
Begin DoDot:4
+49 ;Invalid response. Re-init and force the user to retry
SET Y=""
+50 SET MSG(1)="ERROR: Entered Deposit Ticket# already exists for today - Please"
+51 SET MSG(2)=" select the appropriate line # to modify the existing"
+52 SET MSG(3)=" deposit or e(X)it to enter a different Deposit Ticket#."
+53 DO EN^DDIOL(.MSG)
+54 KILL MSG
End DoDot:4
+55 SET RCSTAT=$GET(RCARRAY("DILIST","ID",RCCT,".12"))
+56 ; If the deposit is not confirmed, error out
IF RCSTAT'=3
Begin DoDot:4
+57 ;Invalid response. Re-init and force the user to retry
SET Y=""
+58 SET MSG(1)="ERROR: Cannot create new deposit ticket- there is an existing"
+59 SET MSG(2)=" deposit with the same # that is not in CONFIRMED status"
+60 DO EN^DDIOL(.MSG)
+61 KILL MSG
End DoDot:4
End DoDot:3
if Y=""
QUIT
End DoDot:2
+62 IF (Y?1N.N)
IF (Y<1)!(Y>RCARYCT)
SET Y="u"
End DoDot:1
if Y'=""
QUIT
+63 ;
+64 ; send a "t" to indicate a user requested exit to force a reprompt of the Select Deposit Prompt.
if Y="^"
QUIT ""
+65 QUIT Y
+66 ;
+67 ; Mimic ? and ?? functionality in DIC calls
+68 ;PRCA*4.5*304
ARYLST ;
+1 ;
+2 NEW X,Y,DIROUT,DIRUT,DUOUT,DTOUT,DIR
+3 SET DIR("A",1)="Answer with AR DEPOSIT TICKET #"
+4 SET DIR("A")="Do you want the entire "_$PIECE($GET(^RCY(344.1,0)),U,4)_"-Entry AR DEPOSIT List? "
+5 SET DIR(0)="Y"
SET DIR("B")="N"
+6 DO ^DIR
+7 ;
+8 ;User answered Yes (value 1), so print the list as if doing a ??
+9 ;print the list
IF Y=1
DO ARYPRNT
+10 QUIT
+11 ;
+12 ;Print the list of deposits (mimicking a ^DIC or pointer type DIR call)
+13 ;PRCA*4.5*304
ARYPRNT ;
+1 ;
+2 NEW I,Y,ENDFLG,RCCT
+3 ;
+4 WRITE !!,?3,"Choose from:",!
+5 SET I=""
SET (ENDFLG,RCCT)=0
+6 FOR
SET I=$ORDER(^RCY(344.1,"B",I))
if I=""
QUIT
Begin DoDot:1
+7 SET Y=""
+8 FOR
SET Y=$ORDER(^RCY(344.1,"B",I,Y))
if Y=""
QUIT
Begin DoDot:2
+9 SET RCCT=RCCT+1
+10 WRITE ?3,I
+11 DO DICW
+12 ;Write the end
WRITE !
+13 IF RCCT>(IOSL-3)
Begin DoDot:3
+14 ;ask if user wishes to continue, reset line counter
+15 SET ENDFLG=$$PROMPT()
SET RCCT=0
End DoDot:3
End DoDot:2
if ENDFLG
QUIT
End DoDot:1
if ENDFLG
QUIT
+16 ;
+17 ;Print the list
+18 ;
+19 ;End of list printout
+20 WRITE !!,?5,"You may enter a new AR DEPOSIT, if you wish",!
+21 WRITE ?5,"Answer must be 7 characters in length. 9 digits can only be entered",!
+22 WRITE ?5,"by automated payments.",!!
+23 QUIT
+24 ;
+25 ;PRCA*4.5*304
+26 ;Prompt user to continue
PROMPT() ;
+1 ;
+2 NEW X,Y,DIROUT,DIRUT,DUOUT,DTOUT,DIR
+3 SET DIR("A")="'^' to stop"
+4 SET DIR(0)="FO"
+5 DO ^DIR
+6 ;
+7 ;If time out or user ^ then send exit flag, otherwise, continue
+8 IF $DATA(DTOUT)!$DATA(DUOUT)
QUIT 1
+9 QUIT 0