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

ACRFEVAL.m

Go to the documentation of this file.
ACRFEVAL ;IHS/OIRM/DSD/THL,AEF - EVALUATE QUOTES; [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 ;;EVALUATE QUOTES
EN D EN1
EXIT K ACR,ACRVND,ACRITEM,ACRTSIDA,ACR843DA,ACR843,ACRPO1,ACRAMT,ACRTOP,ACRTSI,ACRQUIT,ACROUT,ACRMODE,ACRJ,ACRN1,ACRPID,ACR843,ACRDETL,ACRXAMT,ACRIAMT,ACRSS,ACRVENDR
 Q
EN1 ;
 D COUNT^ACRFEVA1
 D MODE^ACRFEVA1
 Q:$D(ACRQUIT)!$D(ACROUT)
 D @ACRMODE
 Q
VENDOR ;ORDER QUOTES BY PRICE FOR EACH VENDOR
 K ACRVND
 S (ACRTSIDA,ACRJ)=0
 F  S ACRTSIDA=$O(^ACRI843I("AA",ACRDOCDA,ACRTSIDA)) Q:'ACRTSIDA!$D(ACRQUIT)!$D(ACROUT)  D
 .S ACRJ=ACRJ+1
 .S ACRN1=$G(^ACRI843(ACRTSIDA,"N1",1,"N1"))
 .S (ACR843DA,ACRAMT)=0
 .F  S ACR843DA=$O(^ACRI843I("AA",ACRDOCDA,ACRTSIDA,ACR843DA)) Q:'ACR843DA!$D(ACRQUIT)!$D(ACROUT)  D
 ..S ACR843=$G(^ACRI843I(ACR843DA,0))
 ..S ACRPO1=$G(^ACRI843I(ACR843DA,"PO1"))
 ..S ACRPID=$G(^ACRI843I(ACR843DA,"PID",1,"PID"))
 ..S ACRQUAN=$P(ACRPO1,U,2)
 ..S ACRCOST=$P(ACRPO1,U,4)
 ..S ACRUI=$P(ACRPO1,U,3)
 ..S ACRDESC=$P(ACRPID,U,5)
 ..S ACRAMT=ACRAMT+(ACRQUAN*ACRCOST)
 ..S ACRVENDR=$P(ACRN1,U,2)
 ..Q:'$D(ACRDETL)
 ..S ACRITEM(ACRVENDR,+ACRPO1,ACR843DA)=(ACRQUAN*ACRCOST)_U_ACRQUAN_U_ACRUI_U_ACRCOST_U_ACRDESC
 .S ACRVND(ACRAMT,ACRVENDR)=""
 .S ACRVEND(ACRJ,ACRVENDR)=ACRAMT
 Q:'$D(ACRVND)
 D TOP^ACRFEVA1
 Q:$D(ACRQUIT)!$D(ACROUT)
 D VDISPLAY
 Q
ITEM ;ORDER QUOTES BY PRICE FOR EACH ITEM
 K ACRITEM
 S (ACRTSIDA,ACRJ,ACRMAX)=0
 F  S ACRTSIDA=$O(^ACRI843I("AA",ACRDOCDA,ACRTSIDA)) Q:'ACRTSIDA!$D(ACRQUIT)!$D(ACROUT)  D
 .S ACRJ=ACRJ+1
 .S ACRN1=$G(^ACRI843(ACRTSIDA,"N1",1,"N1"))
 .S ACRVENDR=$P(ACRN1,U,2)
 .S ACR843DA=0
 .F  S ACR843DA=$O(^ACRI843I("AA",ACRDOCDA,ACRTSIDA,ACR843DA)) Q:'ACR843DA!$D(ACRQUIT)!$D(ACROUT)  D
 ..S ACR843=$G(^ACRI843I(ACR843DA,0))
 ..S ACRPO1=$G(^ACRI843I(ACR843DA,"PO1"))
 ..S ACRQUAN=$P(ACRPO1,U,2)
 ..S ACRCOST=$P(ACRPO1,U,4)
 ..S ACRUI=$P(ACRPO1,U,3)
 ..S ACRAMT=$P(ACRPO1,U,2)*$P(ACRPO1,U,4)
 ..S ACRPID=$G(^ACRI843I(ACR843DA,"PID",1,"PID"))
 ..S ACRDESC=$P(ACRPID,U,5)
 ..S ACRITEM(+ACRPO1,ACRAMT,ACR843DA)=ACRVENDR_U_ACRQUAN_U_ACRUI_U_ACRCOST_U_ACRDESC
 ..S:+ACRPO1>ACRMAX ACRMAX=+ACRPO1
 Q:'$D(ACRITEM)
 D TOP^ACRFEVA1
 Q:$D(ACRQUIT)!$D(ACROUT)
 D IDISPLAY
 Q
VDISPLAY ;DISPLAY VENDORS IN PRICE ORDER
 I $D(ACRDETL) D  I $D(ACROUT)!$D(ACRQUIT) K ACRQUIT Q
 .S DIR(0)="NO^1:"_ACRJ
 .S DIR("A")="Review selected Vendor"
 .W !
 .D DIR^ACRFDIC
 .K ACRQUIT
 .Q:$D(ACROUT)
 .I +Y S ACRI=+Y,ACRVND=$O(ACRVEND(ACRI,"")) I ACRVND]"" D
 ..S ACRAMT=ACRVEND(ACRI,ACRVND)
 ..D VD
 ..S ACRQUIT=""
 D VHEAD^ACRFEVA1
 S (ACRAMT,ACRI)=0
 F ACRJ=1:1 S ACRAMT=$O(ACRVND(ACRAMT)) Q:'ACRAMT!$D(ACRQUIT)!$D(ACROUT)!(ACRJ>ACRTOP)  D
 .S ACRVND=""
 .F  S ACRVND=$O(ACRVND(ACRAMT,ACRVND)) Q:ACRVND=""!$D(ACRQUIT)!$D(ACROUT)  D
 ..S ACRI=ACRI+1
 ..S:$D(ACRDETL) ACRVENDR=ACRVND
 ..D VD
 D PAUSE^ACRFWARN
 Q
VD D:$D(ACRDETL) VHEAD^ACRFEVA1
 W !?10,ACRI
 W ?13,$S(ACRCOUNT>ACRMAX:"**",1:"")
 W ?15,ACRVND
 W ?50,$J($FN(ACRAMT,"P",2),14)
 I $D(ACRDETL) D
 .S ACRXAMT=ACRAMT
 .S ACRSS=0
 .F ACRK=1:1 S ACRSS=$O(ACRITEM(ACRVENDR,ACRSS)) Q:'ACRSS!$D(ACRQUIT)  D
 ..S ACR843DA=0
 ..F  S ACR843DA=$O(ACRITEM(ACRVENDR,ACRSS,ACR843DA)) Q:'ACR843DA!$D(ACRQUIT)  D
 ...S X=ACRITEM(ACRVENDR,ACRSS,ACR843DA)
 ...S ACRAMT=+X
 ...D IDW
 ..I ACRK#10=0 D PAUSE^ACRFWARN
 .S ACRAMT=ACRXAMT
 .D PAUSE^ACRFWARN
 I '$D(ACRDETL),IOSL-4<$Y D PAUSE^ACRFWARN
 Q
IDISPLAY ;DISPLAY ITEMS IN PRICE ORDER
 S DIR(0)="NO^1:"_ACRMAX
 S DIR("A")="Review selected item"
 W !
 D DIR^ACRFDIC
 K ACRQUIT
 Q:$D(ACROUT)
 I +Y S ACRI=+Y D ID Q
 D IHEAD^ACRFEVA1
 S (ACRI,ACRX)=0
 F  S ACRI=$O(ACRITEM(ACRI)) Q:'ACRI!$D(ACRQUIT)!$D(ACROUT)  D ID
 Q
ID D IHEAD^ACRFEVA1
 S ACRAMT=0
 F ACRJ=1:1 S ACRAMT=$O(ACRITEM(ACRI,ACRAMT)) Q:'ACRAMT!$D(ACRQUIT)!$D(ACROUT)!(ACRJ>ACRTOP)  D
 .S ACR843DA=0
 .F  S ACR843DA=$O(ACRITEM(ACRI,ACRAMT,ACR843DA)) Q:'ACR843DA!$D(ACRQUIT)!$D(ACROUT)  D
 ..S X=ACRITEM(ACRI,ACRAMT,ACR843DA)
 ..S ACRQUAN=$P(X,U,2)
 ..S ACRUI=$P(X,U,3)
 ..S ACRCOST=$P(X,U,4)
 ..S ACRDESC=$E($P(X,U,5),1,75)
 ..D IDW
 ..I IOSL-4<$Y D PAUSE^ACRFWARN
 D PAUSE^ACRFWARN
 Q:$D(ACRQUIT)!$D(ACROUT)
 D IHEAD^ACRFEVA1
 Q
IDW ;WRITE ITEM
 S:'$D(ACRDETL) ACRVENDR=$E($P(X,U),1,30)
 S ACRQUAN=$P(X,U,2)
 S ACRUI=$P(X,U,3)
 S ACRCOST=$P(X,U,4)
 S ACRDESC=$E($P(X,U,5),1,75)
 W !,$S('$D(ACRDETL):ACRI,1:ACRSS)
 W ?4,ACRDESC
 W !?4,ACRVENDR
 W ?46,$J(ACRQUAN,7)
 W ?56,ACRUI
 W ?68,$J($FN(ACRAMT,"P",2),12)
 Q