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

AFSLDRVE.m

Go to the documentation of this file.
AFSLDRVE ;IHS/OIRM/DSD/JDM - PRINT DUPLICATE VENDORS BY EIN.   [ 09/26/2005  12:53 PM ]
 ;;3.0t1;1166 APPROVALS FOR PAYMENT;**19**;AUG 31, 2005
 ;Print duplicate vendors by EIN - part 2
 ;K ^AFSLCTMP ; KILL OF SCRATCH WORK GLOBAL  ;ACR*2.1*19.05 IM16848
 N ACRTMP                                    ;ACR*2.1*19.05 IM16848
 S ACRTMP="^AFSLCTMP"                        ;ACR*2.1*19.05 IM16848
 K @ACRTMP                                   ;ACR*2.1*19.05 IM16848
 ;S AFSLUSR=$P(^VA(200,DUZ,0),U,1),AFSLFAC=$P(^AUTTLOC(DUZ(2),0),U,2)     ;ACR*2.1*19.02 IM16848
 S AFSLUSR=$$NAME2^ACRFUTL1(DUZ)        ;ACR*2.1*19.02 IM16848
 S AFSLFAC=$P(^AUTTLOC(DUZ(2),0),U,2)   ;ACR*2.1*19.02 IM16848
 W !!?18,"This report will generate a list of VENDORS whose" W !?18,"file contains either a DUPLICATE or MISSING EIN."
DIR ;
DEVICE ;Device Selection
 W *7,!!?18,"Since this report may take awhile to compile" W !?18,"it is recommended that you QUEUE to a PRINTER." S AFSLIOQ=""
 ;K DIR S %ZIS="PQ" W ! D ^%ZIS I POP W !,"NO DEVICE SELECTED - REQUEST ABORTED" S DIR(0)="E" U IO(0) D ^DIR S IOP=$I D ^%ZIS G END:Y=0,DEVICE:Y=1  ;ACR*2.1*19.05 IM16848
 K DIR S %ZIS="PQ" W ! D ^%ZIS                  ;ACR*2.1*19.05 IM16848
 I POP D  G END:Y=0,DEVICE:Y=1                  ;ACR*2.1*19.05 IM16848
 .W !,"NO DEVICE SELECTED - REQUEST ABORTED"    ;ACR*2.1*19.05 IM16848
 .S DIR(0)="E" U IO(0) D ^DIR                   ;ACR*2.1*19.05 IM16848
 .D ^%ZIS                                       ;ACR*2.1*19.05 IM16848
 S AFSLIO=IO I $D(IO("Q"))=1 S AFSLIOQ=IO("Q")
 I AFSLIOQ="" W ! D WAIT^DICD G CALC
 I $D(IO("S"))!($E(IOST)'="P") G DEVICE
ZTLOAD ;Loads Taskman
 S ZTRTN="CALC^AFSLDRVE",ZTIO="",ZTDESC="COMPILE DUPLICATE EIN REPORT"
 F AFSLSAVE="AFSLFAC(","AFSLIO","AFSLUSR","AFSLIOQ","AFSLFACP" S ZTSAVE(AFSLSAVE)=""
 ;D ^%ZTLOAD K IO("Q") S IOP=$I D HOME^%ZIS K IOP  ;ACR*2.1*19.05 IM16848
 D ^%ZTLOAD K IO("Q") D HOME^%ZIS K IOP            ;ACR*2.1*19.05 IM16848
END K AFSLUSR,DIR,DTOUT,DIROUT,DUOUT,DIRUT,AFSLFAC,AFSLBAD,AFSLVNDR,AFSLEIN,AFSLDAT,AFSLIO,AFSLIOQ,AFSLPAGE,AFSLSAVE,AFSLSKIP,AFSLTIM,C,I,POP,X,Y Q
CALC ;S AFSLVNDR=0 K ^AFSLCTMP ; KILL OF SCRATCH WORK GLOBAL  ;ACR*2.1*19.05 IM16848
 S AFSLVNDR=0                                      ;ACR*2.1*19.05 IM16848
 N ACRTMP                                          ;ACR*2.1*19.05 IM16848
 S ACRTMP="^AFSLCTMP"                              ;ACR*2.1*19.05 IM16848
 K @ACRTMP                                         ;ACR*2.1*19.05 IM16848
B S AFSLVNDR=$O(^AUTTVNDR(AFSLVNDR)) I 'AFSLVNDR S AFSLEIN=0 G CHECK
 I '$D(^AUTTVNDR(AFSLVNDR,11)) G B
 S AFSLEIN=$S($P(^AUTTVNDR(AFSLVNDR,11),U,1):$P(^AUTTVNDR(AFSLVNDR,11),U,1)_$P(^AUTTVNDR(AFSLVNDR,11),U,2),1:"NOT ON FILE")
 S ^AFSLCTMP("DUP",AFSLEIN,AFSLVNDR)=""
 I '$D(^AUTTVNDR(AFSLVNDR,13)) S AFSLADRN="^^^"
 I $D(^AUTTVNDR(AFSLVNDR,13)) S AFSLADRN=^AUTTVNDR(AFSLVNDR,13)
 G B
CHECK S AFSLEIN=$O(^AFSLCTMP("DUP",AFSLEIN)) G:AFSLEIN="" ZTLOAD1 S AFSLVNDR=""
VNDR S AFSLVNDR=$O(^AFSLCTMP("DUP",AFSLEIN,AFSLVNDR)) G:AFSLVNDR="" CHECK
 I '$O(^AFSLCTMP("DUP",AFSLEIN,AFSLVNDR)),'$D(^AFSLCTMP(AFSLEIN)) K ^AFSLCTMP("DUP",AFSLEIN) G VNDR
 S X="UNKNOWN" S:$D(^AUTTVNDR(AFSLVNDR,0)) X=$P(^(0),U,1)
 S AFSLADRN="^^^"
 I $D(^AUTTVNDR(AFSLVNDR,13)) S AFSLADRN=^AUTTVNDR(AFSLVNDR,13)
 S ^AFSLCTMP(AFSLEIN,AFSLVNDR)=X_"^"_AFSLADRN
 K ^AFSLCTMP("DUP",AFSLEIN,AFSLVNDR) G VNDR
ZTLOAD1 ;Loads Taskman
 I AFSLIOQ="" G PRINT
 S ZTRTN="PRINT^AFSLDRVE",ZTDESC="PRINT DUPLICATE EIN REPORT",ZTIO=AFSLIO,ZTSAVE("AFSLIO")="",ZTSAVE("AFSLIOQ")="",ZTSAVE("AFSLUSR")="",ZTSAVE("^AFSLCTMP(")="",ZTSAVE("AFSLFACP")=""
 K IOP
 ;D ^%ZTLOAD K IO("Q") S IOP=$I D HOME^%ZIS K IOP  ;ACR*2.1*19.05 IM16848
 D ^%ZTLOAD K IO("Q") D HOME^%ZIS K IOP            ;ACR*2.1*19.05 IM16848
 Q
PRINT S (AFSLEIN,AFSLPAGE,AFSLSKIP)=0 D HEADER S C=0
P1 S AFSLEIN=$O(^AFSLCTMP(AFSLEIN)) G TOTL:'AFSLEIN S AFSLVNDR="" I AFSLSKIP'=AFSLEIN W !
P2 S AFSLVNDR=$O(^AFSLCTMP(AFSLEIN,AFSLVNDR)) G:AFSLVNDR="" P1
 S AFSLSTE=$P(^AFSLCTMP(AFSLEIN,AFSLVNDR),U,4)
 I $P(^AFSLCTMP(AFSLEIN,AFSLVNDR),U,4)="" S AFSLSTAT=""
 I $P(^AFSLCTMP(AFSLEIN,AFSLVNDR),U,4)'="" S AFSLSTAT=$P(^DIC(5,AFSLSTE,0),U,2)
 W !?1,AFSLEIN,?16,$E($P(^AFSLCTMP(AFSLEIN,AFSLVNDR),U,1),1,30) S C=C+1 W ?63,$P(^AFSLCTMP(AFSLEIN,AFSLVNDR),U,2),?96,$P(^AFSLCTMP(AFSLEIN,AFSLVNDR),U,3),?116,AFSLSTAT,?120,$P(^AFSLCTMP(AFSLEIN,AFSLVNDR),U,5)
 D LSTUSED
 I IOST["P-"&($Y>56) D HEADER
 I IOST["C-"&($Y>24) K DIR S DIR(0)="E" W !! D ^DIR Q:Y=0  D HEADER
 S AFSLSKIP=AFSLEIN G P2
TOTL W !!?1,"TOTAL",?30,C
 K DIR S DIR(0)="E" W !! D ^DIR Q:Y=0
BADEIN ;PRINTS LIST OF VENDORS WITH NO EIN ON FILE
 S AFSLPAGE=0 D BADHEAD
 W !! S AFSLBAD="",C=0
BAD1 S AFSLBAD=$O(^AFSLCTMP("NOT ON FILE",AFSLBAD)) G BADTOTL:AFSLBAD=""
 W !?12,$P(^AUTTVNDR(AFSLBAD,0),U,1) S C=C+1
 I IOST["P-"&($Y>56) D BADHEAD
 I IOST["C-"&($Y>24) K DIR S DIR(0)="E" W !! D ^DIR Q:Y=0  D BADHEAD
 G BAD1
BADTOTL W !!?1,"TOTAL",?12,C
 K DIR S DIR(0)="E" W !! D ^DIR Q:Y=0
 Q
 U IO W @IOF S AFSLPAGE=AFSLPAGE+1
 D NOW^%DTC,YX^%DTC S AFSLDAT=$P(Y,"@",1),AFSLTIM=$P(Y,"@",2)
 W !,"*",AFSLDAT S X=$P(^DIC(4,DUZ(2),0),U,1) W ?((80/2)-($L(X)/2)),X
 ;W ?71,AFSLTIM,"*",!,"*User: ",AFSLUSR,?70,"Device:",$J(AFSLIO,2),"*"
 W !! S X="DUPLICATE VENDOR EIN Report - Page " W ?((80/2)-($L(X)/2)),X_AFSLPAGE
 ;W !! S X="For "_$P(^AUTTLOC(AFSLFACP,0),U,2) W ?((80/2)-($L(X)/2)),X
 W !! F I=1:1:80 W "*"
 W !!?12,"VENDOR EIN",?30,"VENDOR NAME",?66,"LAST USED"
 W ! F I=1:1:80 W "~"
 W !
 Q
BADHEAD ;Prints heading of missing EIN's
 W @IOF S AFSLPAGE=AFSLPAGE+1
 D NOW^%DTC,YX^%DTC S AFSLDAT=$P(Y,"@",1),AFSLTIM=$P(Y,"@",2)
 W !,"*",AFSLDAT S X=$P(^DIC(4,DUZ(2),0),U,1) W ?((80/2)-($L(X)/2)),X
 W ?71,AFSLTIM,"*",!,"*User: ",AFSLUSR,?70,"Device:",$J(AFSLIO,2),"*"
 W !! S X="VENDOR(s) MISSING EIN Report - Page " W ?((80/2)-($L(X)/2)),X_AFSLPAGE
 ;W !! S X="For "_$P(^AUTTLOC(AFSLFACP,0),U,2) W ?((80/2)-($L(X)/2)),X
 W !! F I=1:1:80 W "*"
 W !!?8,"The following do(es) not have an EIN entry in the VENDOR FILE." W !?25,"PLEASE validate and correct."
 W ! F I=1:1:80 W "~"
 W !
 Q
LSTUSED ;CHECKS LAST USED DATE IN ^AFSLF(DUZ(2),"VB"
 S AFSLNODE=0
 Q:'$D(^AFSLF(DUZ(2),"VB",AFSLVNDR))
LST2 S AFSLNODE=$O(^AFSLF(DUZ(2),"VB",AFSLVNDR,AFSLNODE)) G LSTEND:+AFSLNODE=0
 S AFSLDTSV=AFSLNODE
 G LST2
LSTEND S AFSLLUDT="" S:$D(AFSLDTSV) AFSLLUDT=$P(^AFSLF(DUZ(2),"D",AFSLDTSV,0),U,2)
 W ?65,$E(AFSLLUDT,4,5),"-",$E(AFSLLUDT,6,7),"-",$E(AFSLLUDT,2,3)
 Q