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

ACRFIRS7.m

Go to the documentation of this file.
ACRFIRS7 ;IHS/OIRM/DSD/AEF - PRINT VENDOR LABELS [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 ;
EN ;EP -- MAIN ENTRY POINT
 ;
 N ACRHOW,ACRVEN,ACRADD,ACRLPR,ACRROW,ACROUT
 D ^XBKVAR
 D HOME^%ZIS
 D HOW(.ACRHOW)
 Q:$G(ACRHOW)']""
 I ACRHOW="R" D RANGE(.ACRHOW,.ACROUT)
 Q:$G(ACROUT)
 I ACRHOW="I" D INDIV(.ACRVEN,.ACROUT)
 Q:$G(ACROUT)
 D ADD(.ACRADD)
 Q:$G(ACRADD)']""
 D LPR(.ACRLPR)
 Q:'$G(ACRLPR)
 D ROW(.ACRROW)
 Q:'$G(ACRROW)
 S ZTSAVE("ACRHOW")=""
 S ZTSAVE(".ACRVEN")=""
 S ZTSAVE("ACRADD")=""
 S ZTSAVE("ACRLPR")=""
 S ZTSAVE("ACRROW")=""
 D QUE^ACRFUTL("DQ^ACRFIRS7",.ZTSAVE,"PRINT VENDOR LABELS")
 Q
HOW(ACRHOW)        ;
 ;----- ASK INDIVIDUAL VENDORS OR RANGE OF VENDORS
 ;
 N DIR,DIRUT,DTOUT,DUOUT,X,Y
 S DIR(0)="S^I:INDIVIDUAL VENDORS;R:RANGE OF VENDORS"
 D ^DIR
 Q:$D(DTOUT)!($D(DIRUT))!($D(DUOUT))
 Q:Y']""
 S ACRHOW=Y
 Q
RANGE(ACRHOW,ACROUT)         ;
 ;----- ASK VENDOR RANGE
 ;
 N ACRF,ACRL,DIR,DIRUT,DTOUT,DUOUT,X,Y
 S DIR(0)="F^1:30"
 S DIR("A")="Start with Vendor"
 S DIR("B")="FIRST"
 D ^DIR
 I $D(DTOUT)!($D(DIRUT))!($D(DUOUT)) S ACROUT=1 Q
 I Y']"" S ACROUT=1 Q
 S ACRF=Y
 S DIR("A")="Go to Vendor"
 S DIR("B")="LAST"
 D ^DIR
 I $D(DTOUT)!($D(DIRUT))!($D(DUOUT)) S ACROUT=1 Q
 I Y']"" S ACROUT=1 Q
 S ACRL=Y
 S ACRHOW=ACRHOW_U_ACRF_U_ACRL
 Q
INDIV(ACRVEN,ACROUT)         ;
 ;----- ASK FOR INDIVIDUAL VENDORS
 ;
 ;      RETURNS SELECTED VENDORS IN ACRVEN(IEN) ARRAY
 ;
 N ACRQUIT,DIC,DTOUT,DUOUT,X,Y
 K ACRVEN
 S DIC("A")="Select VENDOR: "
 F  D  Q:$G(ACRQUIT)
 . S DIC="^AUTTVNDR("
 . S DIC(0)="AEMQ"
 . D ^DIC
 . I $D(DTOUT)!($D(DUOUT)) S ACRQUIT=1 Q
 . I +Y'>0 S ACRQUIT=1 Q
 . S ACRVEN($P(^AUTTVNDR(+Y,0),U))=+Y
 . S DIC("A")="Select another VENDOR: "
 I '$D(ACRVEN) S ACROUT=1
 Q
ADD(ACRADD)        ;
 ;----- ASK WHICH ADDRESS TO USE
 ;
 N DIR,DIRUT,DTOUT,DUOUT,X,Y
 S DIR(0)="S^M:MAILING ADDRESS;B:BILLING ADDRESS"
 S DIR("A")="Use MAILING ADDRESS or BILLING ADDRESS"
 S DIR("B")="M"
 D ^DIR
 Q:$D(DTOUT)!($D(DUOUT))!($D(DIRUT))
 Q:Y']""
 S ACRADD=Y
 Q
LPR(ACRLPR)        ;
 ;----- ASK HOW MANY LABELS PER ROW
 ;
 N DIR,DIRUT,DTOUT,DUOUT,X,Y
 S DIR(0)="S^1:ONE VENDOR/ROW, 1 LBL/ROW;2:ONE VENDOR/ROW, 2 LBLS/ROW;3:ONE VENDOR/ROW, 3 LBLS/ROW;4:ONE VENDOR/ROW, 4 LBLS/ROW"
 S DIR("A")="Print Quantity"
 S DIR("B")=1
 D ^DIR
 Q:$D(DTOUT)!($D(DUOUT))!($D(DIRUT))
 Q:'Y
 S ACRLPR=Y
 Q
ROW(ACRROW)        ;
 ;----- ASK HOW MANY ROWS PER VENDOR
 ;
 N DIR,DIRUT,DTOUT,DUOUT,X,Y
 S DIR(0)="N^1:999"
 S DIR("A")="How many ROWS (No matter how many labels per row)"
 D ^DIR
 Q:$D(DTOUT)!($D(DUOUT))!($D(DIRUT))
 Q:'Y
 S ACRROW=+Y
 Q
DQ ;EP -- QUEUED JOB STARTS HERE
 ;
 D PRT(ACRHOW,.ACRVEN,ACRADD,ACRLPR,ACRROW)
 K ACRHOW,ACRVEN,ACRADD,ACRLPR,ACRROW
 D ^%ZISC
 Q
PRT(ACRHOW,ACRVEN,ACRADD,ACRLPR,ACRROW)          ;
 ;----- PRINT THE LABELS
 ;
 I $E(ACRHOW)="R" D BLOCK(ACRHOW,ACRADD,ACRLPR,ACRROW)
 I $E(ACRHOW)="I" D EACH(.ACRVEN,ACRADD,ACRLPR,ACRROW)
 Q
BLOCK(ACRHOW,ACRADD,ACRLPR,ACRROW)     ;
 ;----- PRINTS RANGE (BLOCK) OF VENDORS
 ;
 N ACRF,ACRL
 S ACRF=$P(ACRHOW,U,2)
 I ACRF="FIRST" S ACRF=""
 I ACRF]"" S ACRF=$O(^AUTTVNDR("B",ACRF),-1)
 S ACRL=$P(ACRHOW,U,3)
 I ACRL="LAST" S ACRL=$O(^AUTTVNDR("B",""),-1)
 F  S ACRF=$O(^AUTTVNDR("B",ACRF)) Q:ACRF']""  Q:ACRF]ACRL  D
 . S ACRVEN=0
 . F  S ACRVEN=$O(^AUTTVNDR("B",ACRF,ACRVEN)) Q:'ACRVEN  D
 . . D ONE(ACRVEN,ACRLPR,ACRROW,ACRADD)
 Q
EACH(ACRVEN,ACRADD,ACRLPR,ACRROW)      ;
 ;----- PRINTS INDIVIDUAL VENDORS
 ;
 N X
 Q:'$D(ACRVEN)
 S X=""
 F  S X=$O(ACRVEN(X)) Q:X']""  D
 . S ACRVEN=ACRVEN(X)
 . D ONE(ACRVEN,ACRLPR,ACRROW,ACRADD)
 Q
ONE(ACRVEN,ACRLPR,ACRROW,ACRADD)       ;
 ;----- PRINT LABEL(S) FOR ONE VENDOR
 ;
 N I
 F I=1:1:ACRROW D  W !!!
 . D NAME(ACRVEN,ACRLPR)
 . D STR(ACRVEN,ACRLPR,ACRADD)
 . D CITY(ACRVEN,ACRLPR,ACRADD)
 Q
NAME(ACRVEN,ACRLPR)          ;
 ;----- PRINT VENDOR NAME
 ;
 N X
 S X=$P($G(^AUTTVNDR(ACRVEN,0)),U)
 W !,X
 I ACRLPR>1 W ?32,X
 I ACRLPR>2 W ?64,X
 I ACRLPR>3 W ?96,X
 Q
STR(ACRVEN,ACRLPR,ACRADD)    ;
 ;----- PRINT STREET ADDRESS
 ;
 N X
 S X=$G(^AUTTVNDR(ACRVEN,13))
 I ACRADD="M" S X=$P(X,U,1)
 I ACRADD="B" S X=$P(X,U,6)
 W !,X
 I ACRLPR>1 W ?32,X
 I ACRLPR>2 W ?65,X
 I ACRLPR>3 W ?96,X
 Q
CITY(ACRVEN,ACRLPR,ACRADD)   ;
 ;----- PRINT CITY, STATE, ZIP
 ;
 N X
 S X=$G(^AUTTVNDR(ACRVEN,13))
 I ACRADD="M" S X=$P(X,U,2)_", "_$$STATE($P(X,U,3))_"  "_$P(X,U,4)
 I ACRADD="B" S X=$P(X,U,7)_", "_$$STATE($P(X,U,8))_"  "_$P(X,U,9)
 W !,X
 I ACRLPR>1 W ?32,X
 I ACRLPR>2 W ?65,X
 I ACRLPR>3 W ?96,X
 Q
STATE(X) ;----- RETURNS STATE ABBREVIATION
 ;
 S Y=""
 I X']"" Q Y
 S Y=$P($G(^DIC(5,X,0)),U,2)
 Q Y