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

ACRFRR11.m

Go to the documentation of this file.
ACRFRR11 ;IHS/OIRM/DSD/THL,AEF - DISPLAY AND EDIT RECEIVING REPORT/INVOICE AUDIT - CON'T;  [ 09/23/2005  10:57 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**3,19**;NOV 05, 2001
 ;;CONTINUATION OF ACRFRR
FP ;EP;INDICATE WHETHER FINAL OR PARTIAL RECEIVING REPORT
 I $D(ACRIV)#2 D FP1 Q
 I '$D(ACRRRDA)#2 D RRNO^ACRFRRPT
 Q:'$D(ACRRRDA)#2
 Q:'ACRRRDA
 S ACRRRNO=$P(^ACRRR(ACRRRDA,0),U,4)
 I $P(^ACRRR(ACRRRDA,0),U,13)]"" S ACRPVN=$P(^(0),U,13)
 I $D(ACRRR)#2 D
 .D INVOICE
 S DA=ACRRRDA
 S DIE="^ACRRR("
 S DR=1301
 D DIE^ACRFDIC
 D RRR(ACRDOCDA,ACRRRNO,ACRRRDA)
FP1 S ACRP=$S($D(ACRRR)#2:"Receiving Report",1:"Invoice Audit")
 S:$D(ACRRR)#2 DIR(0)="SO^1:Final "_ACRP_";2:Partial "_ACRP_";3:Discontinue "_ACRP
 S:$D(ACRIV)#2 DIR(0)="SO^1:Final "_ACRP_" (191/192-1-4);2:Partial "_ACRP_" (181/182-1-4);3:Discontinue "_ACRP
 D DIR^ACRFDIC
 I 'Y S (ACRFINAL,ACRQUIT)="" Q
 S ACRFINAL=Y
 S:$D(ACRIV)#2 ACRTCODE=$S(ACRFINAL=1:19114,1:18114)
 Q:Y=3
 D ^ACRFIV4:$D(ACRIV)#2
 Q:$D(ACRQUIT)!$D(ACROUT)
 I $D(ACRIV)#2,'$D(ACRPAYME) Q
 D ^ACRFESIG:'$D(ACRIV)#2
 I $D(ACRQUIT)!$D(ACROUT) S ACRFINAL=0 Q
 N ACRRRZDA S ACRRRZDA=$G(ACRRRNO) ;ACR*2.1*3.31
 S:ACRRRZDA="" ACRRRZDA=$P($G(ACRRR0),U) ;ACR*2.1*3.31
 I $D(ACRRR)#2 D DHR:$P($G(^ACRSYS(1,"DT1")),U,5)=1
 I $D(ACRIV)#2 D
 .S ACRBTYP="V"
 .S ACRVDA=$S($P($G(^ACRDOC(ACRDOCDA,5)),U,5):$P(^(5),U,5),1:$P(^ACRDOC(ACRDOCDA,"PO"),U,5))
 .D SYNC^ACRFIV5
 .D ^ACRFIV11
 D NOW^%DTC
 S ACRDATE=%
 S DIE="^ACRDOC(",DA=ACRDOCDA,DR="113210////"_%_";113200////"_DUZ
 D DIE^ACRFDIC:$D(ACRRR)#2
 S ACRFINX=ACRFINAL
 I $D(ACRRR)#2,$G(ACRPVN)="" D PVN^ACRFRR12
 I $L($G(ACRPVN)) D
 .W !!,"PROPERTY VOUCHER NO. ",@ACRON,ACRPVN,@ACROF," has been assigned to"
 .W !,"RECEIVING REPORT NO. ",ACRRRNO
 I $D(ACRRR)#2,$D(ACRFINAL),ACRFINAL=1 W !!,"Final ",ACRP," completed." H 2 K:ACRRDATE ^ACRDOC("DI",ACRRDATE,ACRDOCDA)
 K ACRP
 D:'ACRRRNO&'+$G(ACRRRNOX) RRNO^ACRFRR31
 S ACRRRNOX=$S($D(ACRRRNOX):ACRRRNOX,1:ACRRRNO)
 N ACRJ
 F ACRJ=1:1 S ACRRRNO=$P(ACRRRNOX,",",ACRJ) Q:'ACRRRNO  D FINAL
 Q
FINAL S ACRSSNO=0
 F  S ACRSSNO=$O(^ACRRR("AC",ACRDOCDA,ACRRRNO,ACRSSNO)) Q:'ACRSSNO  D
 .S ACRRRDA=0
 .F  S ACRRRDA=$O(^ACRRR("AC",ACRDOCDA,ACRRRNO,ACRSSNO,ACRRRDA)) Q:'ACRRRDA  D
 ..S ACRFINAL=ACRFINX
 ..S DA=ACRRRDA
 ..S DIE="^ACRRR("
 ..S:$D(ACRRR)#2 DR=".08////"_ACRFINAL_";.13////"_$G(ACRPVN)_";.06////"_ACRDATE_";.05////"_DUZ
 ..S:$D(ACRIV)#2 DR=".11"_"////"_ACRFINAL_";.09////"_DUZ_";.1////"_ACRDATE
 ..D DIE^ACRFDIC
 S ACRFINAL=ACRFINX,DA=ACRDOCDA,DIE="^ACROBL(",DR=$S($D(ACRRR)#2:909,1:912)_"////"_ACRFINAL D DIE^ACRFDIC
 I $D(ACRRR)#2 D
 .I ACRFINAL=1 S ACRDIDAT=$P(^ACRDOC(ACRDOCDA,"PO"),U,12),ACRRL=+^ACRDOC(ACRDOCDA,"POST") I ACRRL,ACRDIDAT,ACRDOCDA K ^ACRDOC("DI",ACRRL,ACRDIDAT,ACRDOCDA)
 .D RNOTE,RRPT^ACRFRRPT
 W !
 Q:$D(ACRIV)#2
 S DIR(0)="YO",DIR("A")="Print copy of Receiving Report now",DIR("B")="NO"
 D DIR^ACRFDIC
 Q:Y'=1
 D SETDOC^ACRFEA1,P11^ACRFPO1
 Q
RNOTE ;NOTIFY REQUEST INITIATOR AND REQUESTOR OF RECEIPT OF GOODS
 N W,X,Y,Z,ACRREFDA
 S ACRFINX=ACRFINAL,ACRAPVT=41,ACRORDER=1,ACRFINAL="N",ACRREFDA=$O(^AUTTDOCR("B",499,0))
 S X=0
 F  S X=$O(^ACRSS("J",ACRDOCDA,X)) Q:'X  I $D(^ACRSS(X,0)) S Y=$P(^(0),U,3) I Y,$D(^ACRDOC(Y,"REQ2")) S Z=$P(^("REQ2"),U,8) S:Z (XMY(Z),ACRXMY(Z))="I"
 S ACRUSER=0
 F  S ACRUSER=$O(ACRXMY(ACRUSER)) Q:'ACRUSER  D
 .K Y
 .S ACRFINX=ACRFINAL
 .S ACRAPVT=41
 .S ACRFINAL="N"
 .S ACRREFDA=$O(^AUTTDOCR("B",499,0))
 .S ACRORDER=1
 .D SETAPP^ACRFAPVS
 .I $G(Y)>0 D
 ..S ACRAPDA=+Y
 ..S ^ACRAPVS("ANXT",ACRAPVT,ACRUSER,+Y)=ACRDOCDA
 ..D APPS
 S XMDT=DT
 S XMDUZ=DUZ
 S XMSUB="RECIEVING REPORT # "_ACRRRNO_" FOR "_ACRDOC
 ;S X=$P(^VA(200,DUZ,0),U)  ;ACR*2.1*19.02 IM16848
 S X=$$NAME2^ACRFUTL1(DUZ)  ;ACR*2.1*19.02 IM16848
 S ACRRCVR=$P($P(X,",",2)," ")_" "_$P(X,",")
 D NOW^%DTC
 S Y=%
 X ^DD("DD")
 S ACRDATE=Y
 S XMTEXT="ACRTEXT("
 S ACRTEXT(1)="Receiving Report number "_ACRRRNO_" was completed by"
 S ACRTEXT(2)=ACRRCVR_" on "_ACRDATE
 S ACRTEXT(3)="For items received from "_$P($G(^AUTTVNDR(+$P($G(^ACRDOC(ACRDOCDA,"PO")),U,5),0)),U)
 S ACRTEXT(4)="If items from this order are not delivered to your office in the next 24 hours,"
 S ACRTEXT(5)="pleae contact the receiving agent."
 N W,X,Y,Z
 S X=$P(^ACRDOC(ACRDOCDA,"REQ2"),U,8)
 S:X (XMY(X),ACRXMY(X))="I"
 S W=0
 F  S W=$O(^ACRSS("J",ACRDOCDA,W)) Q:'W  D
 .S X=0
 .F  S X=$O(^ACRSS("J",ACRDOCDA,W,X)) Q:'X  D
 ..I $D(^ACRSS(X,0)) S Y=$P(^(0),U,3) D
 ...I Y,$D(^ACRDOC(Y,"REQ2")) S Z=$P(^("REQ2"),U,8) S:Z (XMY(Z),ACRXMY(Z))="I"
 D ^XMD
 W !!,"MESSAGE(S) SENT TO THE FOLLOWING REQUEST INITIATORS THAT THEIR REQUESTED"
 W !,"ITEMS WERE RECEIVED."
 W !
 S X=0
 ;F  S X=$O(ACRXMY(X)) Q:'X  I $D(^VA(200,X,0)) S Y=$P(^(0),U) W !?10,$P($P(Y,",",2)," ")," ",$P(Y,",")  ; ACR*2.1*19.02 IM16848
 F  S X=$O(ACRXMY(X)) Q:'X  I $D(^VA(200,X,0)) S Y=$$NAME3^ACRFUTL1(X) W !?10,Y  ; ACR*2.1*19.02 IM16848
 K ACRXMY,ACRTEXT,XMTEXT,XMY
 D PAUSE^ACRFWARN
 Q
INVOICE ;EP;TO RECORD THE INVOICE NUMBER FOR A RECEIVING REPORT
 Q:'$D(ACRRRNO)
 D IADD^ACRFRR3
 S:'$D(^ACRDOC(ACRDOCDA,20,0)) ^ACRDOC(ACRDOCDA,20,0)="^9002196.2001"
 S DA=ACRRRNO
 S DA(1)=ACRDOCDA
 S DIE="^ACRDOC("_ACRDOCDA_",20,"
 S DR=".01T;.02T;.03T"
 W !
 D DIE^ACRFDIC
 Q
DHR ;CREATE ACCRUAL DHR
 N ACRREFX,ACRRR,ACRTCODE,ACRRCODE,ACRMCODE
 S ACRREFX=499
 S ACRRR=""
 S ACRTCODE="081"
 S ACRRCODE="1"
 S ACRMCODE="4"
 D ^ACRFDHR
 Q
APPS ;SET SIGNATURE APPROVAL LINK
 S ACRSSNO=0
 F  S ACRSSNO=$O(^ACRRR("AC",ACRDOCDA,ACRRRNO,ACRSSNO)) Q:'ACRSSNO  D
 .S ACRRRDA=0
 .F  S ACRRRDA=$O(^ACRRR("AC",ACRDOCDA,ACRRRNO,ACRSSNO,ACRRRDA)) Q:'ACRRRDA  D
 ..S (DA(1),DA)=ACRRRDA
 ..S X=ACRAPDA
 ..S DIC="^ACRRR("_DA_",10,"
 ..S DIC(0)="L"
 ..S:'$D(^ACRRR(DA,10,0)) ^ACRRR(DA,10,0)="^9002193.2101"
 ..D FILE^ACRFDIC
 Q
RRR(ACRDOCDA,ACRRRNO,ACRRRDA)          ;
 ;----- STUFF REMARKS INTO ALL ITEMS ON RECEIVING REPORT
 ;
 N ACR
 S ACR=0
 F  S ACR=$O(^ACRRR("AD",ACRDOCDA,ACRRRNO,ACR)) Q:'ACR  D
 . Q:ACR=ACRRRDA
 . S %X="^ACRRR("_ACRRRDA_",13,"
 . S %Y="^ACRRR("_ACR_",13,"
 . D %XY^%RCR
 Q