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

ACRFIV.m

Go to the documentation of this file.
ACRFIV ;IHS/OIRM/DSD/THL,AEF - INVOICE AUDIT;  [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 ;;ROUTINE CALLED DURING PROCESSING OF INVOICES
EN K ACRSST,ACRIVT,ACRSSTX,ACRIVTX,ACRIVPAY,^TMP("ACRRR",$J)
 Q:'+$G(ACRRRNOX)
 Q:'ACRVDA
 D GATHER
 D DISPLAY
 D SELECT:'$D(ACRQUIT)
EXIT K ACRSSDT,ACRSSNMS,ACRSSDSC,ACRNOTES,ACRSSUP,ACRSSACP,ACRSSACT,ACRIVACP,ACRSSIT,ACRIVIT,ACRSST,ACRIVT,ACRIVPAY,ACRSSTX,ACRIVTX,^TMP("ACRRR",$J)
 Q
SELECT ;
 K ACRFINAL
B11 S DIR(0)="LO^1:"_ACRSSNO
 S DIR("A")="Edit which item(s)"
 W !
 D DIR^ACRFDIC
 I $D(ACROUT) K ACRFINAL Q
 I 'Y D  Q
 .S ACRFINAL=0
 .S ACRXX=0
 .F  S ACRXX=$O(^TMP("ACRRR",$J,ACRXX)) Q:'ACRXX  I $D(^TMP("ACRRR",$J,ACRXX)) S Y=ACRXX D BYRR1
 .S ACRQUIT=""
 N ACRXX
 S ACRXX=Y
 F ACRI=1:1 S Y=$P(ACRXX,",",ACRI) Q:'Y  D:$D(^TMP("ACRRR",$J,Y)) BYRR1 Q:$D(ACROUT)
 K ACRQUIT,ACRFINAL
 Q
BYRR1 S (ACRRRDA,DA)=+^TMP("ACRRR",$J,Y)
 S DIE="^ACRRR("
 S DR="[ACR INVOICE AUDIT]"
 I '$D(ACRFINAL) D
 .W !!?22,"Item number ",Y
 .D DIE^ACRFDIC
 S ACRSSDA=+^ACRRR(ACRRRDA,0)
 D SYNC^ACRFRR32
 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O(^TMP("ACRRR",$J,ACRXX)) Q:'ACRXX!$D(ACRQUIT)  D DISP
 K ACRQUIT
 I '$G(ACRMAX) W !,"NO ITEMS ON FILE FOR THIS RECEIVING REPORT." D PAUSE^ACRFWARN S ACRQUIT="" Q
 W !?22,"Totals:"
 W ?41,"-------------"
 W ?55,"-------------"
 W !?41,$J($FN(ACRSSTX,"P",2),13)
 W ?55,$J($FN(ACRIVTX,"P",2),13)
 W:ACRIVTX>0 ?69,$J($P(ACRIVTX-ACRSSTX,"."),4)
 W:ACRSSTX>0 !?69,$J($P((ACRIVTX/ACRSSTX)*100-100,"."),4)
 S (ACRSSMAX,ACRSSNO)=ACRMAX
 Q
DISP S ACRJ=ACRJ+1
 D D1
 W !,$J(ACRJ,3)
 I $P(ACRSSNMS,U)]"" D
 .W ?4,"VON: ",$P(ACRSSNMS,U)
 .W !?3
 I $P(ACRSSNMS,U,3)]"" D
 .W ?4,"NDC: ",$P(ACRSSNMS,U,3)
 .W !?3
 I $P(ACRSSNMS,U,2)]"" D
 .W ?4,"NSN: ",$P(ACRSSNMS,U,2)
 .W !?3
 W ?4,$P(ACRSSDSC,U)
 N ACRJ,ACRI,ACRX
 F ACRJ=2:1:5 I $P(ACRSSDSC,U,ACRJ)]"" S ACRX=$P(ACRSSDSC,U,ACRJ) D
 .F ACRI=1:1 S ACRY=$P(ACRX," ",ACRI) Q:ACRY=""  D
 .W:$X+$L(ACRY)>79 !?3
 .W ?$X+1,ACRY
 W:ACRNOTES]"" !
 F ACRJ=1:1:5 I $P(ACRNOTES,U,ACRJ)]"" S ACRX=$P(ACRNOTES,U,ACRJ) D
 .F ACRI=1:1 S ACRY=$P(ACRX," ",ACRI) Q:ACRY=""  D
 .W:$X+$L(ACRY)>79 !?3
 .W ?$X+1,ACRY
 K ACRSSDSC,ACRNOTES
 W !?22,$J(ACRSSACP,6)
 W ?29,$J($FN(ACRSSUP,"P",2),12)
 W ?41,$J($FN(ACRSSIT,"P",2),13)
 W:ACRIVIT>0 ?69,$J($P(ACRIVIT-ACRSSIT,"."),4)
 I ACRIVACP]"" D
 .W !?13,"INVOICED:"
 .W ?22,$J(ACRIVACP,6)
 .W ?29,$J($FN(ACRIVUP,"P",2),12)
 .W ?55,$J($FN(ACRIVIT,"P",2),13)
 .I $P(^TMP("ACRRR",$J,ACRXX),U,10)="PAID" W !?13,"(PAYMENT MADE FOR THIS ITEM.)"
 I ACRIVIT,ACRSSIT>0 W ?69,$J($P((ACRIVIT/ACRSSIT)*100-100,"."),4)
 I IOSL-4<$Y D
 .S DIR(0)="YO"
 .S DIR("A")="Display Remaining Items"
 .S DIR("B")="YES"
 .W !
 .D DIR^ACRFDIC
 .I Y'=1 S ACRQUIT="" Q
 .D HEAD
 Q
 W !?10,@ACRON,"SERVICES/SUPPLIES",@ACROF," RECEIVED FOR"
 W !?10,"PURCHASE ORDER NO..: ",@ACRON,$P(ACRDOC0,U,2),@ACROF
 W !?10,"RECEIVING REPORT(S): ",@ACRON,$E(ACRRRNOX,1,$L(ACRRRNOX)-1),@ACROF
 W !?69,"VARI"
 W !?22,"ACC-"
 W ?41,"OBLIGATED"
 W ?55,"RECOMMENDED"
 W ?69,"ANCE"
 W !,"ITM"
 W ?4,"ORDER #/DESCRIPT"
 W ?22,"EPTED"
 W ?29,"UNIT PRICE"
 W ?41,"AMOUNT"
 W ?55,"PAYMENT"
 W ?69,"$$/%"
 W !,"---"
 W ?4,"-----------------"
 W ?22,"------"
 W ?29,"-----------"
 W ?41,"-------------"
 W ?55,"-------------"
 W ?69,"----"
 Q
D1 K ACRSSDT,ACRSSNMS,ACRSSDSC,ACRNOTES,ACRSSUP,ACRSSACP,ACRSSACT,ACRIVACP,ACRSSIT,ACRIVIT
 S ACRRRDA=+^TMP("ACRRR",$J,ACRXX)
 I 'ACRRRDA S ACRJ=ACRJ-1 Q
 S ACRSSDA=+^ACRRR(ACRRRDA,0)
 I '$D(^ACRSS(+ACRSSDA,0)) S ACRJ=ACRJ-1 Q
 S ACRSS0=^ACR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