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

ACRFRR32.m

Go to the documentation of this file.
ACRFRR32 ;IHS/OIRM/DSD/THL,AEF - RECEIVING REPORT/INVOICE AUDIT CONTINUED;  [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 ;;CONTINUATION OF ACRFRR
DISPLAY ;EP;DISPLAY ALL RECEIPTS FOR SPECIFIED ITEM
 N ACRXX,ACRYY
 F  D D1 Q:$D(ACRQUIT)!$D(ACROUT)
 K ACRRRDA,ACRQUIT,^TMP("ACRRR",$J),ACRSSDAX
 Q
D1 K ^TMP("ACRRR",$J)
 D DHEAD
 K ACRRR
 S ACRSSDAX=ACRSSDA
 S (ACRYY,ACRMAX)=0
 F  S ACRYY=$O(^ACRRR("B",ACRSSDAX,ACRYY)) Q:'ACRYY!$D(ACRQUIT)  D
 .Q:'$D(^ACRRR(ACRYY,0))!'$D(^ACRRR(ACRYY,"DT"))
 .S ACRRR0=^ACRRR(ACRYY,0)
 .S ACRRRDT=^ACRRR(ACRYY,"DT")
 .Q:'$D(^ACRSS(+ACRRR0,0))
 .S ACRMAX=ACRMAX+1
 .S ^TMP("ACRRR",$J,ACRMAX)=ACRYY_"&&"_ACRRRDT
 S (ACRYY,Z,ACRRCDX,ACRACPX,ACRIVDX)=0
 F  S ACRYY=$O(^ACRRR("B",ACRSSDAX,ACRYY)) Q:'ACRYY!$D(ACRQUIT)  D
 .D DISP
 .I $Y+4>IOSL D PAUSE^ACRFWARN,DHEAD:'$D(ACRQUIT)
 I Z>1 D
 .W !?38,"-------"
 .W ?46,"-------"
 .W ?54,"-------"
 .W ?62,"-------"
 .W !?38,$J(ACRRQD,6)
 .W ?46,$J(ACRRCDX,6)
 .W ?54,$J(ACRACPX,6)
 .W ?62,$J(ACRIVDX,6)
 K ACRQUIT,ACROUT
 S:'$D(ACRIV)#2 ACRRR=""
 I Z=0 D  Q
 .W !?10,"No receiving actions on file for this item."
 .D PAUSE^ACRFWARN
 .S ACRQUIT=""
 S DIR(0)="NO^1:"_ACRMAX
 S DIR("A")="Which one"
 W !
 I ACRMAX=1 S Y=1
 E  D DIR^ACRFDIC
 Q:+Y<1
 Q:'$D(^TMP("ACRRR",$J,+Y))
D11 D BYRR1
 I ACRMAX=1 S ACRQUIT=""
 Q
DISP Q:'$D(^ACRRR(ACRYY,0))!'$D(^ACRRR(ACRYY,"DT"))
 S ACRRR0=^ACRRR(ACRYY,0)
 S ACRRRDT=^ACRRR(ACRYY,"DT")
 Q:'$D(^ACRSS(+ACRRR0,0))
 S Z=Z+1
 S ACRSSNO=+^ACRSS(+ACRRR0,0)
 S ^TMP("ACRRR",$J,Z)=ACRYY_"&&"_ACRRRDT
 S ACRRRCD=$P(ACRRRDT,U,2)
 S ACRRACP=$P(ACRRRDT,U,3)
 S ACRRCDX=ACRRCDX+ACRRRCD
 S ACRACPX=ACRACPX+ACRRACP
 S ACRRRUC=$P(^ACRSS(+ACRRR0,"DT"),U,3)
 S ACRIVUC=$P(ACRRRDT,U,5)
 S ACRIVD=$P(ACRRRDT,U,6)
 S ACRIVDX=ACRIVDX+ACRIVD
 S ACRSSDA=+ACRRR0
 Q:'$D(^ACRSS(ACRSSDA,0))
 D SETSS^ACRFSSA
 W !,Z," (",ACRSSNO,")"
 W ?6,$P(ACRSSDSC,U)
 W ?38,$J(ACRRQD,6)
 W ?46,$J(ACRRRCD,6)
 W ?54,$J(ACRRACP,6)
 W ?62,$J(ACRIVD,6)
 W ?70,$J($FN(ACRRRUC,"P",2),10)
 W:$P(ACRRR0,U,7) ?$X+1,"**"
 I ACRIVUC,ACRIVUC'=ACRRRUC D
 .W !?28,"INVOICED UNIT COST:"
 .W ?70,$J($FN(ACRIVUC,"P",2),10)
 Q
BYRR ;EP;
 F  D B1 Q:$D(ACRQUIT)!$D(ACROUT)
 Q
B1 D BYRRDISP
 K ACRQUIT
 S DIR(0)="SO^1:Add Additional Items to this RR;2:Edit an Item"
 S DIR("A")="Which one"
 I $D(ACRIV)#2 D
 .S DIR(0)="SO^1:Invoice Quantities/Costs identical to RR Items;2:Edit an Item"
 .S DIR("A")="Which one"
 W !
 D DIR^ACRFDIC
 I $D(ACRQUIT)!$D(ACROUT)!'Y S ACRQUIT="" Q
 I Y=1,'$D(ACRIV)#2 S ACRRRADD="" D ADD1^ACRFRR33 Q
 I Y=1,$D(ACRIV)#2 S ACRRRADD="" D ALL^ACRFIV31 Q
B11 S DIR(0)="LO^1:"_ACRSSNO
 S DIR("A")="Edit which item(s)"
 W !
 I ACRSSNO=1 S Y=1
 E  D DIR^ACRFDIC
 I $D(ACRQUIT)!$D(ACROUT)!'Y K:'$D(ACRIVDX) ACRQUIT Q
 N ACRYY
 S ACRYY=Y
 I $G(Y(1))]"" S %X="Y(",%Y="ACRYY(" D %XY^%RCR
 D B111
 N ACRJJ
 S ACRJJ=0
 F  S ACRJJ=$O(ACRYY(ACRJJ)) Q:'ACRJJ  S ACRYY=ACRYY(ACRJJ) D B111
 Q
B111 F ACRI=1:1 S Y=$P(ACRYY,",",ACRI) Q:'Y  D:$D(^TMP("ACRRR",$J,Y)) BYRR1 Q:$D(ACROUT)
 K ACRQUIT
 Q
BYRR1 S ACRRRDA=+^TMP("ACRRR",$J,Y)
 S ACRXX=Y
 S ACRRR0=^ACRRR(ACRRRDA,0)
 S ACRRRDT=^ACRRR(ACRRRDA,"DT")
 S ACRSSDA=+ACRRR0
 S DIE="^ACRRR("
 S DR=$S($D(ACRRR)#2:"[ACR RECEIVING REPORT]",1:"[ACR INVOICE AUDIT]")
 I $D(ACRRR)#2,$P(ACRRR0,U,7) D  Q
 .W *7,*7
 .W !!,"This data has been exported to PHS/FMS.  You must add or edit another"
 .W !,"receiving report for this item to make any further adjustment."
 .D PAUSE^ACRFWARN
 W !
 I $D(ACRIV)#2,$P(ACRRRDT,U,5)="" D ADD^ACRFIV31
 S DA=ACRRRDA
 S DIE="^ACRRR("
 S DR=$S($D(ACRRR)#2:"[ACR RECEIVING REPORT]",1:"[ACR INVOICE AUDIT]")
 D DIE^ACRFDIC
 S ACRUCX=+^ACRRR(ACRRRDA,"DT")
 I $P(ACRRRDT,U,$S($D(ACRRR)#2:3,1:6))'=$P(^ACRRR(ACRRRDA,"DT"),U,$S($D(ACRRR)#2:3,1:6)) D
 .D NOW^%DTC
 .S (X,ACRDATE)=%
 .S DA(1)=ACRRRDA
 .S DIC(0)="L"
 .S DIC="^ACRRR("_ACRRRDA_","_$S($D(ACRRR)#2:11,1:12)_","
 .S DIC("DR")=".02////"_DUZ_";.03////2"
 .S:'$D(@(DIC_"0)")) ^ACRRR(ACRRRDA,"_$S($D(ACRRR)#2:11,1:12)_",0)="^9002193.2"_$S($D(ACRRR)#2:1,1:2)_"101D"
 .D FILE^ACRFDIC
SYNC ;EP;TO SYNCRONIZE WITH SUPPLY/SERVICES FILE
 S (X,ACRRCD,ACRACP,ACRIVD)=0
 F  S X=$O(^ACRRR("B",ACRSSDA,X)) Q:'X  D
 .S ACRRRDT=$G(^ACRRR(X,"DT"))
 .S ACRRCD=ACRRCD+$P(ACRRRDT,U,2)
 .S ACRACP=ACRACP+$P(ACRRRDT,U,3)
 .S ACRIVD=ACRIVD+$P(ACRRRDT,U,6)
 D C1^ACRFRR31:$D(ACRRR)#2
 D C1^ACRFIV31:$D(ACRIV)#2
 D NECOP:'$D(ACRIV)#2
 Q
BYRRDISP ;EP;
 N ACRXX,ACRYY
 W @IOF
 W !,"Receiving Report No. ",ACRRRNO," for PO No. ",ACRDOC
 W !!,"NO."
 D DH1
 K ACRRR
 S (ACRXX,Z)=0
 F  S ACRXX=$O(^ACRRR("AC",ACRDOCDA,ACRRRNO,ACRXX)) Q:'ACRXX!$D(ACRQUIT)  D
 .S (ACRYY,ACRRCDX,ACRACPX,ACRIVDX)=0
 .F  S ACRYY=$O(^ACRRR("AC",ACRDOCDA,ACRRRNO,ACRXX,ACRYY)) Q:'ACRYY!$D(ACRQUIT)!$D(ACROUT)  D
 ..D DISP
 ..I $Y+4>IOSL D PAUSE^ACRFWARN,DHEAD:'$D(ACRQUIT)
 S:'$D(ACRIV)#2 ACRRR=""
 K ACRQUIT,ACROUT
 Q
NECOP ;
 Q:'$G(ACRSSDA)
 N ACROBJDA,ACROBJ
 S ACROBJDA=$P($G(^ACRSS(ACRSSDA,0)),U,4)
 Q:'$D(^AUTTOBJC(+ACROBJDA,0))
 S ACROBJ=$P(^AUTTOBJC(ACROBJDA,0),U)
 Q:$E(ACROBJ,1,2)'=31
 S:'$D(^ACRSS(ACRSSDA,11,0)) ^ACRSS(ACRSSDA,11,0)="^9002193.01101"
 S (DA,DA(1))=ACRSSDA
 S DIE="^ACRSS("
 S DR="[ACR NEW EQUIPMENT]"
 D DDS^ACRFDIC
 Q:'$D(ACRSCREN)
 K ACRSCREN
 D DIE^ACRFDIC
 Q
DHEAD W @IOF
 W !,"Receiving history for Item No. ",ACRSSNO," PO No. ",ACRDOC
 W !!,"NO."
DH1 W ?6,"Description"
 W ?38,"Ordered"
 W ?46,"Recv'd"
 W ?54,"Acceptd"
 W ?62,"Invc'd"
 W ?70,"Unit Cost"
 W !,"----"
 W ?6,"------------------------------"
 W ?38,"-------"
 W ?46,"-------"
 W ?54,"-------"
 W ?62,"-------"
 W ?70,"----------"
 Q