Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ACRFDEL

ACRFDEL.m

Go to the documentation of this file.
ACRFDEL ;IHS/OIRM/DSD/THL,AEF - CANCEL A REQUEST;  [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 ;;ROUTINE USED TO MANAGE TRANSFER OF REQUEST FROM ONE ACCOUNT TO
 ;;ANOTHER AND TO CANCEL OR DELETE A REQUEST
EN ;EP;TO CANCEL OR TRANSFER A REQUEST
 D EN1
EXIT K ACRDOCDA,ACRDOCDA,DA,ACRDOC,ACRID,ACRFDNO,ACRTDEL,ACRLBDA,ACRTREQ,ACRTOBL,ACRREQ,ACROBL
 Q
EN1 ;SELECT TO CANCEL OR TRANSFER REQUEST
 I $D(ACRJVOD) D JVOD Q
 S DIR(0)="SO^1:Delete "_ACRDOC_" ("_ACRID_")"_";2:Transfer "_ACRDOC_" ("_ACRID_")"
 D DIR^ACRFDIC
 I Y=1 D EN2 Q
 I Y=2 D T
 Q
EN2 ;EP;CANCEL A REQUEST
 S DIR(0)="YO"
 S DIR("A")="Are you certain you want to "_$S('$D(ACRCANCL):"delete",1:"cancel")_" "_ACRDOC_"  ("_ACRID_")"
 S DIR("B")="NO"
 W !
 D DIR^ACRFDIC
 I Y'=1 K ACGQUIT Q
 I ACRREF=103!(ACRREF=210&($P($G(^ACROBL(ACRDOCDA,"APV")),U,8)="A")) D CANPO
EN3 ;EP;
 D WAIT^DICD:$E($G(IOST),1,2)="C-"
 D DHR:$P($G(^ACROBL(ACRDOCDA,"APV")),U)="A"
 D SS
 D APPROVE
 D REQ
 D DOC
 W !!,*7,*7,$G(ACRDOC),"  (",$G(ACRID),")  has been "
 W $S($G(ACRAPDAS)="D":"disapproved.",'$D(ACRCANCL):"deleted.",1:"cancelled.")
 D PAUSE^ACRFWARN
 Q
SS ;ZERO OUT ALL ASSOCIATED ITEMS ON REQUEST
 N ACRDA
 S ACRDA=0
 F  S ACRDA=$O(^ACRSS("C",ACRDOCDA,ACRDA)) Q:'ACRDA  D
 .S DA=ACRDA
 .S DIE="^ACRSS("
 .S DR="13////0;16////0;16.1////0;18////0"
 .D DIE^ACRFDIC
 Q:'$D(^ACRAL("E",ACRDOCDA))
 N ACRALDA
 S ACRALDA=0
 F  S ACRALDA=$O(^ACRAL("E",ACRDOCDA,ACRALDA)) Q:'ACRALDA  D
 .S DA=ACRALDA
 .S DIE="^ACRAL("
 .S DR="9////0"
 .D DIE^ACRFDIC
 Q
APPROVE ;INVALIDATE ALL ASSOCIATED APPROVALS
 S ACRDA=0
 F  S ACRDA=$O(^ACRAPVS("AB",ACRDOCDA,ACRDA)) Q:'ACRDA  D
 .I $P(^ACRAPVS(ACRDA,0),U,3),$D(^("DT")),$P(^("DT"),U,2) K ^ACRAPVS("ANXT",$P(^(0),U,3),$P(^("DT"),U,2),ACRDA)
 .K ^ACRAPVS("AB",ACRDOCDA,ACRDA)
 .S ^ACRAPVS("D",ACRDOCDA,ACRDA)=""
 .S DA=ACRDA
 .S DIE="^ACRAPVS("
 .S DR=".07////"_ACRDOCDA_";.08////"_DT_";.09////"_DUZ
 .D DIE^ACRFDIC
 Q
REQ ;PUT REQUEST IN 'DISAPPROVED' STATUS
 S DA=ACRDOCDA
 S DIE="^ACROBL("
 S DR="903////"_$S('$D(ACRCANCL):"D",1:"C")
 D DIE^ACRFDIC
 Q
DOC ;PUT DOCUMENT IN DISAPPROVED STATUS
 I '$D(^ACRDOC(ACRDOCDA,0)) D
 .S X="CANCELLED"
 .S DIC="^ACRDOC("
 .S DIC(0)="L"
 .S DINUM=ACRDOCDA
 .D FILE^ACRFDIC
 S DA=ACRDOCDA
 S DIE="^ACRDOC("
 S DR=".2///@;.14////"_$S($P($G(^ACRDOC(ACRDOCDA,0)),U,14)'["CANCELLED":"CANCELLED ",1:"")_$P($G(^(0)),U,14)
 D DIE^ACRFDIC
 S ^ACRDOC(ACRDOCDA,"DT")=""
 Q
T ;EP;TO SELECT THE DOCUMENT TO TRANSFER
 K ACRFDNO
 S ACRTDEL=""
 D OBLAMT^ACRFDTPE
 Q
T1 ;EP;TO TRANSFER DOCUMENT FROM ONE FINANCIAL ACCOUNT TO ANOTHER
 I ACRLBDA=ACRFDNO D  Q
 .W !!,"Transfer to the same account is unnecessary."
 .H 2
 .K ACRTDEL,ACRFDNO
 .S ACRQUIT=""
 W !!,@ACRON,ACRDOC," (",ACRID,")",@ACROF," will be transferred to the"
 W !,@ACRON,$P(^ACRLOCB(ACRFDNO,0),U,12),@ACROF," account."
 S DIR(0)="YO"
 S DIR("A")="Sure this is what you want"
 S DIR("B")="NO"
 W !
 D DIR^ACRFDIC
 I Y'=1 S ACRQUIT="" Q
 W !
 D:$E($G(IOST),1,2)="C-" WAIT^DICD
 I $D(ACRJVOD) D DHR
 S ACRCANDA=$P(^ACRLOCB(ACRFDNO,"DT"),U,9)
 S DA=ACRDOCDA
 S DIE="^ACROBL("
 S DR=".03////"_ACRFDNO_";.04////"_ACRCANDA
 D DIE^ACRFDIC
 S DA=ACRDOCDA
 S DIE="^ACRDOC("
 S DR=".06////"_ACRFDNO_";113100////"_ACRCANDA
 D DIE^ACRFDIC
 S (ACRDA,ACRTREQ,ACRTOBL)=0
 F  S ACRDA=$O(^ACRSS("C",ACRDOCDA,ACRDA)) Q:'ACRDA  D
 .S DA=ACRDA
 .S DIE="^ACRSS("
 .S DR=".06////"_ACRFDNO_";.05////"_ACRCANDA
 .D DIE^ACRFDIC
 .N X
 .S X=$G(^ACRSS(ACRDA,"DT"))
 .S ACRTREQ=ACRTREQ+$P(X,U,4)
 .S ACRTOBL=ACRTOBL+$P(X,U,9)
 I ACRTREQ!ACRTOBL D
 .N X
 .S X=$G(^ACRLOCB(ACRFDNO,"BA"))
 .S ACRREQ=$P(X,U,2)+ACRTREQ
 .S ACROBL=$P(X,U,5)+ACRTOBL
 .S DA=ACRFDNO
 .S DIE="^ACRLOCB("
 .S DR="2////"_ACRREQ_";7////"_ACROBL
 .D DIE^ACRFDIC
 .S X=$G(^ACRLOCB(ACRLBDA,"BA"))
 .S ACRREQ=$P(X,U,2)-ACRTREQ
 .S ACROBL=$P(X,U,5)-ACRTOBL
 .S DA=ACRLBDA
 .S DIE="^ACRLOCB("
 .S DR="2////"_ACRREQ_";7////"_ACROBL
 .D DIE^ACRFDIC
 K DIE,DA,DR
 N X
 S X=^ACRDOC(ACRDOCDA,0)
 S ACRDOCX=$P(X,U)
 S ACRREFDA=$P(X,U,13)
 S ACRTXDA=$P(X,U,4)
 S (ACRREF,ACRREFX)=$P(^AUTTDOCR(ACRREFDA,0),U)
 I ACRREF'=130,ACRREF'=600 D  I 1
 .S ACRREFX=$S(ACRREF'=148:116,1:ACRREF)
 .S ACRREFDA=$O(^AUTTDOCR("B",ACRREFX,0))
 .D DOC^ACRFDOCN
 E  D TO^ACRFDOCN
 S DA=ACRDOCDA
 S DIE="^ACRDOC("
 S DR=".01///"_ACRDOC_";.17////"_ACRDOCX
 D DIE^ACRFDIC
 D:'$D(ACRJVOD) ^ACRFAPVS
 W !!,@ACRON,ACRDOCX," (",ACRID,")",@ACROF," has been transferred to the"
 W !,@ACRON,$P(^ACRLOCB(ACRFDNO,0),U,12),@ACROF," account (ID NO.: ",ACRFDNO,")."
 W !,"The new document number is ",@ACRON,ACRDOC,@ACROF," (ID NO.: ",ACRDOCDA,")."
 D PAUSE^ACRFWARN
 S ACRQUIT=""
 Q
JVOD ;EP;TO JOURNAL VOUCHER OBLIGATED DOCUMENT
 D T
 Q
CANYO ;EP;TO CANCEL/DELETE YOUR OWN REQUEST
 S DIC="^ACRDOC("
 S DIC(0)="QEALM"
 S DIC("A")="Requisition/Travel Order NO.: "
 S D="B^C^G^J"
 S DIC("S")="S ACRREFDA=$P(^ACRDOC(+Y,0),U,13),ACRREQ=$P(^(""REQ2""),U,8),ACRTO=$P($G(^(""TO"")),U,9),ACRAPV=$P($G(^ACROBL(+Y,""APV"")),U,8),ACRREF=$P(^AUTTDOCR(ACRREFDA,0),U),ACRYO=$S(""^116^204^103^210^""[(U_ACRREF_U):ACRREQ,1:ACRTO)"
 S DIC("S")=DIC("S")_" I ACRYO=DUZ,ACRREF'=103,ACRAPV'=""A"""
 W !,"Select the document you want to DELETE/CANCEL"
 W !!
 D MIX^ACRFDIC
 Q:+Y<1
 S ACRDOCDA=+Y
 D SETDOC^ACRFEA1
CANYO1 ;EP;AFTER DOCUMENT HAS BEEN SELECTED
 I ACRREF=600 S ACRCANCL=""
 D EN2
 K ACRCANCL
 Q
CANPO Q
 S DA=ACRDOCDA
 S DIE="^ACRDOC("
 S DR="1901T"
 W !
 D DIE^ACRFDIC
 S ACRFDNO=ACRLBDA
 S ACRCANDA=$P(^ACRLOCB(ACRLBDA,"DT"),U)
 S ACRAMEND=""
 D EN1^ACRFAUTO
 Q
DHR ;
 N X,Y
 S X=0
 F  S X=$O(^ACRDHR("E",ACRDOCDA,X)) Q:'X  S Y=$G(^ACRDHR(X,1)) I $P(Y,U,3,4)="050^1" S ACRQUIT="" Q
 Q:'$D(ACRQUIT)
 K ACRQUIT
 S ACRTCODE="050"
 S ACRRCODE=2
 S ACRMCODE=$S($G(ACRMCODE):ACRMCODE,1:5)
 D ^ACRFDHR
 K ACRTCODE,ACRRCODE,ACRMCODE
 Q