ACRFPCC ;IHS/OIRM/DSD/THL,AEF - DISPLAY COST COMPARISON; [ 11/01/2001 9:44 AM ]
;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
;;ROUTINE TO DISPLAY VENDORS FOR A STOCK ITEM
EN ;EP
D SET,DISPLAY
EXIT K ACRVDA,ACRVCON,ACRVON,ACRVUI,ACRVUC,ACRVSP,ACRVNAM,ACRVEIN,ACRVCIT,ACRVPHN,ACRVA1,ACRVA2,ACRVA3,ACRVZIP,ACR11,ACR13,ACRDT1,ACRFOB,ACRBR,ACRCT,ACRDT,ACRMAN,ACRVNDC,ACRP1,ACRP2,ACRP3
Q
ZIS ;EP;TO PRINT COST COMPARISON
S (ACRRTN,ZTRTN)="EN^ACRFPCC"
S ZTDESC="PRINT COST COMPARISON FOR DOCUMENT "_$P(^ACRDOC(ACRDOCDA,0),U)
D ^ACRFZIS
Q
SET W:$E(IOST,1,2)="C-" @IOF
W !?12,@ACRON,"COST COMPARISON",@ACROF
W !,"--------------------------------------------------------------------------------"
W !?11,"| VENDOR 1"
W ?34,"| VENDOR 2"
W ?57,"| VENDOR 3"
W !,"--------------------------------------------------------------------------------"
S ACR=0
D SET1
Q
SET1 ;SET VENDOR INFO FOR COST COMPARISON
N X,Y
S ACRV(1)=$P(^ACRDOC(ACRDOCDA,"PO"),U,5)
S Y=$G(^ACRDOC(ACRDOCDA,13))
S ACRV(2)=$P(Y,U,5)
S ACRV(3)=$P(Y,U,6)
F ACRI=1:1:3 D S1
Q
S1 S Z=ACRV(ACRI)
I Z,$D(^AUTTVNDR(Z,0)) D I 1
.S ACR0=$P(^AUTTVNDR(Z,0),U)
.S X=$G(^AUTTVNDR(Z,11))
.S Y=$G(^AUTTVNDR(Z,13))
.S ACRVDA=Z
.S Z="*"_$E(ACR0,1,20)_U_$P(Y,U)_U_$P(Y,U,10)_U_$P(Y,U,2)_U_$P(Y,U,3)_U_$P(Y,U,4)_U_$P(Y,U,5)_U_$P(X,U,9)_U_$P(X,U,14)_U_$P(X,U,13)_U_$P(X,U,27)_U_$P(X,U,15)_U_$P(X,U,28)_U_$P(X,U,17)
.S $P(Z,U,30)=ACRVDA
E S Z=$G(^ACRDOC(ACRDOCDA,$S(ACRI=1:3,ACRI=2:14,1:15)))
S $P(Z,U)=$E($P(Z,U),1,21)
S $P(Z,U,6)=$E($P(Z,U,6),1,5)
S $P(Z,U,4)=$E($P(Z,U,4),1,13)
S $P(Z,U,12)="WO: "_$S($P(Z,U,12)=1:"YES",1:"NO")
S $P(Z,U,13)="BI: "_$S($P(Z,U,13)=6:"YES",1:"NO")
S $P(Z,U,14)=$S($P(Z,U,14)=1:"YES",1:"NO")
I $P(Z,U,5),$D(^DIC(5,$P(Z,U,5),0)) S $P(Z,U,5)=$P(^(0),U,2)
I $P(Z,U,11)]"" D I 1
.S $P(Z,U,11)=$E($P($P(^DD(9999999.11,1127,0),($P(Z,U,11)_":"),2),";"),1,21)
E S $P(Z,U,11)="NOT STATED"
S ACRV(ACRI)=Z
Q
DISPLAY W !,"VENDOR"
W ?11,"|"
S ACRP=1
D W
W !,"CONTACT"
W ?11,"|"
S ACRP=7
D W
W !,"STREET 1"
W ?11,"|"
S ACRP=2
D W
W !,"STREET 2"
W ?11,"|"
S ACRP=3
D W
W !,"CITY/ST/ZIP"
W ?11,"|"
S ACRP="4"
D W
W !,"PHONE"
W ?11,"|"
S ACRP=8
D W
W !,"FAX"
W ?11,"|"
S ACRP=9
D W
W !,"EIN NO."
W ?11,"|"
S ACRP=10
D W
W !,"BUS SIZE"
W ?11,"|"
S ACRP=11
D W
W !,"WOMAN/IND"
W ?11,"|"
S ACRP=12
D W
W !,"LABOR SURP"
W ?11,"|"
S ACRP=14
D W
W !,"FOB POINT"
W ?11,"|"
S ACRP=15
D W
W !,"DELIVRY/ARO"
W ?11,"|"
S ACRP=16
D W
W !,"PAYMENT TRM"
W ?11,"|"
S ACRP=17
D W
W !,"MULTI-AWARD"
W ?11,"|"
S ACRP=18
D W
W !,"CONFIRM ORD"
W ?11,"|"
S ACRP=19
D W
W !,"MAIL INSTR"
W ?11,"|"
S ACRP=20
D W
W $$DASH^ACRFMENU
D SS
Q
W W ?12,$E($P(ACRV(1),U,ACRP),1,22)
I ACRP=4 D S ACRP=4
.F ACRP=5,6 W:$P(ACRV(1),U,ACRP)]"" ",",$P(ACRV(1),U,ACRP)
W:ACRP=12 ?25,$P(ACRV(1),U,13)
W ?34,"|"
W ?35,$E($P(ACRV(2),U,ACRP),1,22)
I ACRP=4 D S ACRP=4
.F ACRP=5,6 W:$P(ACRV(2),U,ACRP)]"" ",",$P(ACRV(2),U,ACRP)
W:ACRP=12 ?48,$P(ACRV(2),U,13)
W ?57,"|"
W ?58,$E($P(ACRV(3),U,ACRP),1,22)
I ACRP=4 D S ACRP=4
.F ACRP=5,6 W:$P(ACRV(3),U,ACRP)]"" ",",$P(ACRV(3),U,ACRP)
W:ACRP=12 ?71,$P(ACRV(3),U,13)
Q
SS ;DISPLAY COST DATA FOR EACH ITEM FOR EACH VENDOR
D SSH
N X,Y
S ACRXREF=$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")
S (ACRSSDA,ACRTT1,ACRTT2,ACRTT3)=0
F S ACRSSDA=$O(^ACRSS(ACRXREF,ACRDOCDA,ACRSSDA)) Q:'ACRSSDA D
.S X=^ACRSS(ACRSSDA,"DT"),Y=$G(^ACRSS(ACRSSDA,2)),Z=+^ACRSS(ACRSSDA,0)
.S ACRQUAN=$P(X,U)
.S ACRUI=$P(X,U,2)
.S ACRP1=$P(X,U,3)
.S ACRT1=$P(X,U,4)
.S ACRP2=$P(Y,U,4)
.S ACRT2=ACRQUAN*ACRP2
.S ACRP3=$P(Y,U,6)
.S ACRT3=ACRQUAN*ACRP3
.S ACRTT1=ACRTT1+ACRT1
.S ACRTT2=ACRTT2+ACRT2
.S ACRTT3=ACRTT3+ACRT3
.W !,Z
.W ?2,"|",$J(ACRQUAN,5)
.W ?7,"|",$S($D(^ACRUI(+ACRUI,0)):$P(^(0),U),1:"**")
.W ?11,"|",$J($FN(ACRP1,"P",2),10)
.W ?22,"|",$J($FN(ACRT1,"P",2),11)
.W ?34,"|",$J($FN(ACRP2,"P",2),10)
.W ?45,"|",$J($FN(ACRT2,"P",2),11)
.W ?57,"|",$J($FN(ACRP3,"P",2),10)
.W ?68,"|",$J($FN(ACRT3,"P",2),11)
W $$DASH^ACRFMENU
W !,"ORDER AMT"
W ?11,"|"
W ?23,$J($FN(ACRTT1,"P",2),11)
W ?34,"|"
W ?46,$J($FN(ACRTT2,"P",2),11)
W ?57,"|"
W ?69,$J($FN(ACRTT3,"P",2),11)
D PAUSE^ACRFWARN
W @IOF
K ACRT1,ACRT2,ACRT3,ACRTT1,ACRTT2,ACRTT3
Q
SSH I IOSL-4<$Y D PAUSE^ACRFWARN W @IOF
W !,"# | QTY |UI|UNIT COST | TOTAL |UNIT COST | TOTAL |UNIT COST | TOTAL"
W !,"--------------------------------------------------------------------------------"
Q
ACRFPCC ;IHS/OIRM/DSD/THL,AEF - DISPLAY COST COMPARISON; [ 11/01/2001 9:44 AM ]
+1 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
+2 ;;ROUTINE TO DISPLAY VENDORS FOR A STOCK ITEM
EN ;EP
+1 DO SET
DO DISPLAY
EXIT KILL ACRVDA,ACRVCON,ACRVON,ACRVUI,ACRVUC,ACRVSP,ACRVNAM,ACRVEIN,ACRVCIT,ACRVPHN,ACRVA1,ACRVA2,ACRVA3,ACRVZIP,ACR11,ACR13,ACRDT1,ACRFOB,ACRBR,ACRCT,ACRDT,ACRMAN,ACRVNDC,ACRP1,ACRP2,ACRP3
+1 QUIT
ZIS ;EP;TO PRINT COST COMPARISON
+1 SET (ACRRTN,ZTRTN)="EN^ACRFPCC"
+2 SET ZTDESC="PRINT COST COMPARISON FOR DOCUMENT "_$PIECE(^ACRDOC(ACRDOCDA,0),U)
+3 DO ^ACRFZIS
+4 QUIT
SET IF $EXTRACT(IOST,1,2)="C-"
WRITE @IOF
+1 WRITE !?12,@ACRON,"COST COMPARISON",@ACROF
+2 WRITE !,"--------------------------------------------------------------------------------"
+3 WRITE !?11,"| VENDOR 1"
+4 WRITE ?34,"| VENDOR 2"
+5 WRITE ?57,"| VENDOR 3"
+6 WRITE !,"--------------------------------------------------------------------------------"
+7 SET ACR=0
+8 DO SET1
+9 QUIT
SET1 ;SET VENDOR INFO FOR COST COMPARISON
+1 NEW X,Y
+2 SET ACRV(1)=$PIECE(^ACRDOC(ACRDOCDA,"PO"),U,5)
+3 SET Y=$GET(^ACRDOC(ACRDOCDA,13))
+4 SET ACRV(2)=$PIECE(Y,U,5)
+5 SET ACRV(3)=$PIECE(Y,U,6)
+6 FOR ACRI=1:1:3
DO S1
+7 QUIT
S1 SET Z=ACRV(ACRI)
+1 IF Z
IF $DATA(^AUTTVNDR(Z,0))
Begin DoDot:1
+2 SET ACR0=$PIECE(^AUTTVNDR(Z,0),U)
+3 SET X=$GET(^AUTTVNDR(Z,11))
+4 SET Y=$GET(^AUTTVNDR(Z,13))
+5 SET ACRVDA=Z
+6 SET Z="*"_$EXTRACT(ACR0,1,20)_U_$PIECE(Y,U)_U_$PIECE(Y,U,10)_U_$PIECE(Y,U,2)_U_$PIECE(Y,U,3)_U_$PIECE(Y,U,4)_U_$PIECE(Y,U,5)_U_$PIECE(X,U,9)_U_$PIECE(X,U,14)_U_$PIECE(X,U,13)_U_$PIECE(X,U,27)_U_$PIECE(X,U,15)_U_$PIECE(X,U,28)_U_$PIE
CE(X,U,17)
+7 SET $PIECE(Z,U,30)=ACRVDA
End DoDot:1
IF 1
+8 IF '$TEST
SET Z=$GET(^ACRDOC(ACRDOCDA,$SELECT(ACRI=1:3,ACRI=2:14,1:15)))
+9 SET $PIECE(Z,U)=$EXTRACT($PIECE(Z,U),1,21)
+10 SET $PIECE(Z,U,6)=$EXTRACT($PIECE(Z,U,6),1,5)
+11 SET $PIECE(Z,U,4)=$EXTRACT($PIECE(Z,U,4),1,13)
+12 SET $PIECE(Z,U,12)="WO: "_$SELECT($PIECE(Z,U,12)=1:"YES",1:"NO")
+13 SET $PIECE(Z,U,13)="BI: "_$SELECT($PIECE(Z,U,13)=6:"YES",1:"NO")
+14 SET $PIECE(Z,U,14)=$SELECT($PIECE(Z,U,14)=1:"YES",1:"NO")
+15 IF $PIECE(Z,U,5)
IF $DATA(^DIC(5,$PIECE(Z,U,5),0))
SET $PIECE(Z,U,5)=$PIECE(^(0),U,2)
+16 IF $PIECE(Z,U,11)]""
Begin DoDot:1
+17 SET $PIECE(Z,U,11)=$EXTRACT($PIECE($PIECE(^DD(9999999.11,1127,0),($PIECE(Z,U,11)_":"),2),";"),1,21)
End DoDot:1
IF 1
+18 IF '$TEST
SET $PIECE(Z,U,11)="NOT STATED"
+19 SET ACRV(ACRI)=Z
+20 QUIT
DISPLAY WRITE !,"VENDOR"
+1 WRITE ?11,"|"
+2 SET ACRP=1
+3 DO W
+4 WRITE !,"CONTACT"
+5 WRITE ?11,"|"
+6 SET ACRP=7
+7 DO W
+8 WRITE !,"STREET 1"
+9 WRITE ?11,"|"
+10 SET ACRP=2
+11 DO W
+12 WRITE !,"STREET 2"
+13 WRITE ?11,"|"
+14 SET ACRP=3
+15 DO W
+16 WRITE !,"CITY/ST/ZIP"
+17 WRITE ?11,"|"
+18 SET ACRP="4"
+19 DO W
+20 WRITE !,"PHONE"
+21 WRITE ?11,"|"
+22 SET ACRP=8
+23 DO W
+24 WRITE !,"FAX"
+25 WRITE ?11,"|"
+26 SET ACRP=9
+27 DO W
+28 WRITE !,"EIN NO."
+29 WRITE ?11,"|"
+30 SET ACRP=10
+31 DO W
+32 WRITE !,"BUS SIZE"
+33 WRITE ?11,"|"
+34 SET ACRP=11
+35 DO W
+36 WRITE !,"WOMAN/IND"
+37 WRITE ?11,"|"
+38 SET ACRP=12
+39 DO W
+40 WRITE !,"LABOR SURP"
+41 WRITE ?11,"|"
+42 SET ACRP=14
+43 DO W
+44 WRITE !,"FOB POINT"
+45 WRITE ?11,"|"
+46 SET ACRP=15
+47 DO W
+48 WRITE !,"DELIVRY/ARO"
+49 WRITE ?11,"|"
+50 SET ACRP=16
+51 DO W
+52 WRITE !,"PAYMENT TRM"
+53 WRITE ?11,"|"
+54 SET ACRP=17
+55 DO W
+56 WRITE !,"MULTI-AWARD"
+57 WRITE ?11,"|"
+58 SET ACRP=18
+59 DO W
+60 WRITE !,"CONFIRM ORD"
+61 WRITE ?11,"|"
+62 SET ACRP=19
+63 DO W
+64 WRITE !,"MAIL INSTR"
+65 WRITE ?11,"|"
+66 SET ACRP=20
+67 DO W
+68 WRITE $$DASH^ACRFMENU
+69 DO SS
+70 QUIT
W WRITE ?12,$EXTRACT($PIECE(ACRV(1),U,ACRP),1,22)
+1 IF ACRP=4
Begin DoDot:1
+2 FOR ACRP=5,6
IF $PIECE(ACRV(1),U,ACRP)]""
WRITE ",",$PIECE(ACRV(1),U,ACRP)
End DoDot:1
SET ACRP=4
+3 IF ACRP=12
WRITE ?25,$PIECE(ACRV(1),U,13)
+4 WRITE ?34,"|"
+5 WRITE ?35,$EXTRACT($PIECE(ACRV(2),U,ACRP),1,22)
+6 IF ACRP=4
Begin DoDot:1
+7 FOR ACRP=5,6
IF $PIECE(ACRV(2),U,ACRP)]""
WRITE ",",$PIECE(ACRV(2),U,ACRP)
End DoDot:1
SET ACRP=4
+8 IF ACRP=12
WRITE ?48,$PIECE(ACRV(2),U,13)
+9 WRITE ?57,"|"
+10 WRITE ?58,$EXTRACT($PIECE(ACRV(3),U,ACRP),1,22)
+11 IF ACRP=4
Begin DoDot:1
+12 FOR ACRP=5,6
IF $PIECE(ACRV(3),U,ACRP)]""
WRITE ",",$PIECE(ACRV(3),U,ACRP)
End DoDot:1
SET ACRP=4
+13 IF ACRP=12
WRITE ?71,$PIECE(ACRV(3),U,13)
+14 QUIT
SS ;DISPLAY COST DATA FOR EACH ITEM FOR EACH VENDOR
+1 DO SSH
+2 NEW X,Y
+3 SET ACRXREF=$SELECT(ACRREFX=116&($PIECE(^ACRDOC(ACRDOCDA,0),U,4)'=35):"C",ACRREFX=116&($PIECE(^ACRDOC(ACRDOCDA,0),U,4)=35&($PIECE($GET(^ACROBL(ACRDOCDA,"APV")),U)'="A")):"C",1:"J")
+4 SET (ACRSSDA,ACRTT1,ACRTT2,ACRTT3)=0
+5 FOR
SET ACRSSDA=$ORDER(^ACRSS(ACRXREF,ACRDOCDA,ACRSSDA))
IF 'ACRSSDA
QUIT
Begin DoDot:1
+6 SET X=^ACRSS(ACRSSDA,"DT")
SET Y=$GET(^ACRSS(ACRSSDA,2))
SET Z=+^ACRSS(ACRSSDA,0)
+7 SET ACRQUAN=$PIECE(X,U)
+8 SET ACRUI=$PIECE(X,U,2)
+9 SET ACRP1=$PIECE(X,U,3)
+10 SET ACRT1=$PIECE(X,U,4)
+11 SET ACRP2=$PIECE(Y,U,4)
+12 SET ACRT2=ACRQUAN*ACRP2
+13 SET ACRP3=$PIECE(Y,U,6)
+14 SET ACRT3=ACRQUAN*ACRP3
+15 SET ACRTT1=ACRTT1+ACRT1
+16 SET ACRTT2=ACRTT2+ACRT2
+17 SET ACRTT3=ACRTT3+ACRT3
+18 WRITE !,Z
+19 WRITE ?2,"|",$JUSTIFY(ACRQUAN,5)
+20 WRITE ?7,"|",$SELECT($DATA(^ACRUI(+ACRUI,0)):$PIECE(^(0),U),1:"**")
+21 WRITE ?11,"|",$JUSTIFY($FNUMBER(ACRP1,"P",2),10)
+22 WRITE ?22,"|",$JUSTIFY($FNUMBER(ACRT1,"P",2),11)
+23 WRITE ?34,"|",$JUSTIFY($FNUMBER(ACRP2,"P",2),10)
+24 WRITE ?45,"|",$JUSTIFY($FNUMBER(ACRT2,"P",2),11)
+25 WRITE ?57,"|",$JUSTIFY($FNUMBER(ACRP3,"P",2),10)
+26 WRITE ?68,"|",$JUSTIFY($FNUMBER(ACRT3,"P",2),11)
End DoDot:1
+27 WRITE $$DASH^ACRFMENU
+28 WRITE !,"ORDER AMT"
+29 WRITE ?11,"|"
+30 WRITE ?23,$JUSTIFY($FNUMBER(ACRTT1,"P",2),11)
+31 WRITE ?34,"|"
+32 WRITE ?46,$JUSTIFY($FNUMBER(ACRTT2,"P",2),11)
+33 WRITE ?57,"|"
+34 WRITE ?69,$JUSTIFY($FNUMBER(ACRTT3,"P",2),11)
+35 DO PAUSE^ACRFWARN
+36 WRITE @IOF
+37 KILL ACRT1,ACRT2,ACRT3,ACRTT1,ACRTT2,ACRTT3
+38 QUIT
SSH IF IOSL-4<$Y
DO PAUSE^ACRFWARN
WRITE @IOF
+1 WRITE !,"# | QTY |UI|UNIT COST | TOTAL |UNIT COST | TOTAL |UNIT COST | TOTAL"
+2 WRITE !,"--------------------------------------------------------------------------------"
+3 QUIT