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

ACRFAPVS.m

Go to the documentation of this file.
ACRFAPVS ;IHS/OIRM/DSD/THL,AEF - SET APPROVAL SEQUENCE FOR EACH DOC;  [ 10/4/2005   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**19**;NOV 05, 2001
 ;;ROUTINE CONTROLS CREATION OF ALL APPROVAL SEQUENCES FOR DOCUMENTS
 ;;WHICH ARE SENT FOR APPROVAL
EN ;EP;TO KILL,CREATE AND UPDATE DOCUMENTS IN THE APPROVAL SEQUENCE
 I $E($G(IOST),1,2)="C-",$D(^ACRAPVS("AB",ACRDOCDA)),'$D(ACRSCHK),"^103^210^349^326^"'[(U_ACRREF_U),'$D(ACRCHANG) D DISPLAY Q:$D(ACRQUIT)
 I $P(^ACRDOC(ACRDOCDA,0),U,4)=35,$P($G(ACRDOC0),U,13) S ACRREFDA=$P(ACRDOC0,U,13)
 E  S ACRREFDA=$P(^ACRDOC(ACRDOCDA,0),U,13)
 S ACRCANDA=$P(^ACRDOC(ACRDOCDA,"REQ"),U,10)
 S ACRREF=$P(^AUTTDOCR(ACRREFDA,0),U)
 D KILL:$D(^ACRAPVS("AB",ACRDOCDA))
 D CREATE
 D UP^ACRFPRC3
EXIT K ACRORDER,ACRAPDA,ACRTYPDA,ACRTX,ACRFINAL,ACRGLB,ACRPC,ACRSDBUS
 Q
CREATE ;CREATES NEW APPROVALS FOR A DOCUMENT
 S ACRDOC0=^ACRDOC(ACRDOCDA,0)
 S ACRLBDA=$P(ACRDOC0,U,6)
 I ACRREFX=130,$E(^ACROBL(ACRDOCDA,"APV"))="A",$P(^("APV"),U)="A" S ACRREFX=600
 I ACRREFX=103!(ACRREFX=349)!(ACRREFX=326)!(ACRREFX=600) S ACRTX=$S(ACRREFX=600:19,1:11)
 E  D
 .S ACRTX=$P(ACRDOC0,U,4)
 .S ACRTX=$S($P(ACRDOC0,U,19):31,1:ACRTX)
 I '$G(ACRADA) D  Q:'$G(ACRADA)
 .I $G(ACRPODA) S ACRADA=$P(^ACRPO(ACRPODA,0),U,19)
 .I '$G(ACRPODA) D
 ..S ACRPODA=$P(ACRDOC0,U,8)
 ..S:ACRPODA ACRADA=$P(^ACRPO(ACRPODA,0),U,19)
 ..S:'ACRADA ACRADA=1
 S ACRAPVT=0
 F  S ACRAPVT=$O(^ACRDOCA("AC",ACRADA,ACRTX,ACRAPVT)) Q:'ACRAPVT  D
 .I ACRAPVT=46!(ACRAPVT=1) D SADBUS I '$D(ACRSDBUS),ACRAPVT=46 Q
 .I ACRAPVT=33!(ACRAPVT=34),$P(^AUTTCAN(ACRCANDA,0),U,3)'=1 Q
 .S ACRORDER=$O(^ACRDOCA("AC",ACRADA,ACRTX,ACRAPVT,""))
 .S ACRTYPDA=$O(^ACRDOCA("AC",ACRADA,ACRTX,ACRAPVT,ACRORDER,""))
 .S ACRFINAL=$P(^ACRDOCA(ACRTYPDA,0),U,4)
 .S ACRGLB=$P(^ACRAPVT(ACRAPVT,"DT"),U)
 .S ACRPC=$P(^ACRAPVT(ACRAPVT,"DT"),U,2)
 .S ACRUSER=$P($G(^ACRDOC(ACRDOCDA,ACRGLB)),U,ACRPC)
 .I ACRAPVT=1,'$D(ACRSDBUS) S ACRORDER=1
 .I ACRTX=35,ACRFINAL="Y" D
 ..D PROP
 ..S:$D(ACRPROP) ACRPROP=ACRORDER,ACRORDER=ACRORDER+2
 .D SETAPP
 ; Hardcode approval signature sequence for Property Clearance and Local Property Manager on 3100 CC requests
 I $D(ACRPROP) D
 .F ACRORDER=ACRPROP
 .; Property Clearance
 .S ACRAPVT=31
 .S ACRFINAL=""
 .S ACRGLB=$P(^ACRAPVT(ACRAPVT,"DT"),U)
 .S ACRPC=$P(^ACRAPVT(ACRAPVT,"DT"),U,2)
 .S ACRUSER=$P($G(^ACRDOC(ACRDOCDA,ACRGLB)),U,ACRPC)
 .D SETAPP
 .K ACRPROP                            ; ACR*2.1*19.06  IM18610
 .Q                                    ; ACR*2.1*19.06  IM18610
 .S ACRORDER=ACRPROP+1
 .; Local Property Manager
 .S ACRAPVT=6
 .S ACRFINAL=""
 .S ACRGLB=$P(^ACRAPVT(ACRAPVT,"DT"),U)
 .S ACRPC=$P(^ACRAPVT(ACRAPVT,"DT"),U,2)
 .S ACRUSER=$P($G(^ACRDOC(ACRDOCDA,ACRGLB)),U,ACRPC)
 .D SETAPP
 .K ACRPROP
 Q
SETAPP ;EP;TO CREATE APPROVAL ENTRY
 S X=ACRDOCDA
 S DIC="^ACRAPVS("
 S DIC(0)="L"
 S DIC("DR")="5////"_ACRFINAL_";.03////"_ACRAPVT_";.04////"_ACRORDER_";.05////"_ACRLBDA_";.06////"_ACRREFDA_";2////"_$S(ACRUSER:ACRUSER,1:"")_";.08////"_DUZ
 S:$D(ACRDATE) DIC("DR")=DIC("DR")_";3////"_ACRDATE
 S:$D(ACRRDATE) DIC("DR")=DIC("DR")_";8////"_ACRRDATE
 S:$D(ACRRRNO) DIC("DR")=DIC("DR")_";9////"_ACRRRNO
 K ACRORDER,ACRTYPDA,ACRGLB,ACRPC
 I ACRAPVT=41 D  I $D(ACRQUIT)!$D(ACROUT) K ACRQUIT Q
 .N ACRAPDA
 .S ACRAPDA=0
 .F  S ACRAPDA=$O(^ACRAPVS("ANXT",ACRAPVT,ACRUSER,ACRAPDA)) Q:'ACRAPDA  I ^(ACRAPDA)=ACRDOCDA S ACRQUIT="" Q
 D FILE^ACRFDIC
 Q
KILL ;EP;TO KILL EXISTING APPROVALS FOR A DOCUMENT
 N ACRAPVT,ACRINDV,ACRAPDA,X,Y
 S ACRAPDA=0
 S DIK="^ACRAPVS("
 F  S ACRAPDA=$O(^ACRAPVS("AB",ACRDOCDA,ACRAPDA)) Q:'ACRAPDA  D
 .I '$D(^ACRAPVS(ACRAPDA,0))!'$D(^ACRAPVS(ACRAPDA,"DT")) D  Q
 ..K ^ACRAPVS(ACRAPDA,"DT")
 ..K ^ACRAPVS(ACRAPDA,0),^ACRAPVS("AB",ACRDOCDA,ACRAPDA)
 .S X=^ACRAPVS(ACRAPDA,0)
 .S Y=^ACRAPVS(ACRAPDA,"DT")
 .Q:ACRREFDA'=$P(X,U,6)
 .S ACRAPVT=$P(X,U,3)
 .S ACRORD=$P(X,U,4)
 .S ACRINDV=$P(Y,U,2)
 .K ^ACRAPVS("ANXT",+ACRAPVT,+ACRINDV,+ACRAPDA)
 .D NOW^%DTC
 .S DA=ACRAPDA
 .S DIE="^ACRAPVS("
 .S DR=".07////"_ACRDOCDA_";.1////"_%_";.09////"_DUZ
 .D DIE^ACRFDIC
 .K ^ACRAPVS("AB",ACRDOCDA,+ACRAPDA)
 .K ^ACRAPVS("AORDR",ACRDOCDA,+ACRORD,+ACRAPDA)
 .K ^ACRAPVS("AC",ACRDOCDA,+ACRINDV,+ACRAPDA)
 .K ACRAPVT,ACRORD
 K ^ACRAPVS("AORDR",ACRDOCDA)
 I $D(^ACRTVAL(ACRDOCDA)) D
 . S DA=ACRDOCDA
 . S DIE="^ACRTVAL("
 . S DR=".04///^S X=""@"""
 . D ^DIE
 Q
SADBUS ;EP;TO DETERMIN IF SADBUS SIGNATURE IS REQUIRED
 N X
 S X=$E($P(^ACRDOC(ACRDOCDA,"PO"),U,2))
 Q:X="G"!(X="V")
 I $P($G(^ACRDOC(ACRDOCDA,"PO")),U,5),$D(^AUTTVNDR($P(^("PO"),U,5),11)),$P(^(11),U,27)="A1" Q
 N X,Y
 S (X,Y)=0
 F  S X=$O(^ACRSS("J",ACRDOCDA,X)) Q:'X  S Y=Y+$P($G(^ACRSS(X,"DT")),U,4)
 S:Y>2499.9999 ACRSDBUS=""
 Q
DISPLAY ;DISPLAY APPROVALS PRIOR TO KILLING AND RECREATING APPROVALS
 K ACRQUIT
 N X
 S X=0
 F  S X=$O(^ACRAPVS("AB",ACRDOCDA,X)) Q:'X  I $G(ACRREFDA)=$P($G(^ACRAPVS(X,0)),U,6) S ACRQUIT="" Q
 Q:'$D(ACRQUIT)
 K ACRQUIT
 D ^ACRFPAPV
 S DIR(0)="YO"
 S DIR("A",1)="Are you certain you want to send"
 S DIR("A")="this document for approval"
 S DIR("B")="NO"
 W !!,"Sending this document for approval will delete any approvals currently listed."
 W !
 D DIR^ACRFDIC
 I $G(Y)'=1 S ACRQUIT=""
 Q
PROP ;DETERMINE IF CREDIT CARD ITEMS INCLUDE EQUIPMENT AND INCLUDE
 ;PROPERTY MGT SIGNATURE IF SO
 K ACRPROP
 N X,Y
 S X=0
 F  S X=$O(^ACRSS($S(ACRREFX=116&($P(^ACRDOC(ACRDOCDA,0),U,4)'=35):"C",ACRREFX=116&($P(^ACRDOC(ACRDOCDA,0),U,4)=35&($P($G(^ACROBL(ACRDOCDA,"APV")),U)'="A")):"C",1:"J"),ACRDOCDA,X)) Q:'X  D
 .S Y=$P($G(^ACRSS(X,0)),U,4)
 .S Y=$P($G(^AUTTOBJC(+Y,0)),U)
 .I $E(Y,1,2)=31 S ACRPROP=""
 Q