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

ACHSSVRQ.m

Go to the documentation of this file.
ACHSSVRQ ; IHS/ITSC/PMF - SELECT AND PRINT AO SPECIAL VENDOR REPORT ;  [ 10/16/2001   8:16 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
 ;
A2 ;
 I '$D(^ACHSAOP(DUZ(2),21)) W *7,!,"No Special Vendors have been identified",!,"in the CHS AREA OFFICE PARAMETERS file." G ZEND
 W !
 S DIC="^ACHSAOP("_DUZ(2)_",21,",DIC(0)="QAZEM"
 D ^DIC
 G ZEND:$D(DUOUT)!($D(DTOUT))!(+Y<1)
 S ACHSEINP=$P(Y,U,2),ACHSEIN=$P(^AUTTVNDR(ACHSEINP,11),U,13)
B0 ;
 G NOREPORT:'$D(^ACHSSVR(ACHSEIN))
B1A ;
 S ACHSFAX=$$DIR^XBDIR("Y","Do you want a FAX Cover Sheet Generated for This Vendor (Y/N) ","Y","","","",1)
 G A2:$D(DIRUT)!($D(DTOUT))!($D(DUOUT))
B0C ;
 S %=$$PB^ACHS
 I %=U!$D(DTOUT)!$D(DUOUT) Q
 I %="B" D VIEWR^XBLM("PRINT^ACHSSVRQ"),EN^XBVK("VALM") Q
 S ACHSIOQ="",%ZIS="PQ"
 D ^%ZIS
 S ACHSIO=IO
 I $D(IO("Q"))=1 S ACHSIOQ=IO("Q")
 I ACHSIOQ="" G PRINT
 I $D(IO("S"))!($E(IOST)'="P") G B0C
ZTLOAD ;
 S ZTRTN="PRINT^ACHSSVRQ",ZTDESC="PRINT SPECIAL AO VENDOR REPORTS",ZTIO=ION
 F %="ACHSEIN","ACHSFAX","ACHSEINP" S ZTSAVE(%)=""
 D ^%ZTLOAD
 K IO("Q")
 D HOME^%ZIS
 K IOP
 D KILL^%ZTLOAD
 G A2
 ;
PRINT ;EP - From TaskMan. 
 S (ACHSFAC,ACHSNMS,ACHSSEQ)="",(ACHSDCNT,ACHSPGNO)=0
 I ACHSFAX=1 D FAX
 S ACHSDATE=$$HTE^XLFDT($H)
 I '$D(^ACHSSVR(ACHSEIN,"N")) D INDEX
 D PGHDR
B2 ;
 S ACHSFAC=$O(^ACHSSVR(ACHSEIN,"N",ACHSFAC))
 G PRTEND:+ACHSFAC=0
B3 ;
 S ACHSNMS=$O(^ACHSSVR(ACHSEIN,"N",ACHSFAC,ACHSNMS))
 G B2:ACHSNMS=""
B4 ;
 S ACHSSEQ=$O(^ACHSSVR(ACHSEIN,"N",ACHSFAC,ACHSNMS,ACHSSEQ))
 G B3:+ACHSSEQ=0
 S ACHSX=$G(^ACHSSVR(ACHSEIN,ACHSFAC,ACHSSEQ))
 K DIC
 S DIC="^AUTTLOC(",D="C",DIC(0)="",X=ACHSFAC
 D IX^DIC
 I +Y<1 U IO(0) W "INVALID FACILITY CODE" H 3 G A2
 S ACHSFACN=$E($P($G(^DIC(4,+Y,0)),U),1,12)
 I $Y>55 D PGHDR
 S X=ACHSX
 W ACHSFACN,?14,$E($E(X,103,118),1,16),?32,$E(X,4,4),"-",$E(X,5,7),"-",$E(X,8,12),?45,$E(X,13,14),"-",$E(X,67,67),?51,$E(X,34,39),?59
 S ACHSDCNT=ACHSDCNT+1
 W $E(X,63,64),"/",$E(X,65,66),"/",$E(X,61,62),?70
 S V=$E(X,69,76)/100
 W $J(V,9,2),!," (",ACHSFAC,")",?14,"TRIBE-CD=",$E(X,151,153),"  COMM-CD=",$E(X,154,160),!
 I $E(X,119,119)=" "!($E(X,119,119)="") W ! G B4
 W ?14,"<",$E(X,119,134),">",!
 I $E(X,135,136)="  " W !! G B4
 W ?14,"<",$E(X,135,150),">",!!
 G B4
 ;
PRTEND ; End printing, print totals.
 U IO
 W !,$$REPEAT^XLFSTR("-",70),!!?10,"TOTAL DOCUMENTS LISTED = ",ACHSDCNT
 Q:ACHSIOQ'=""
 U IO(0)
 S Y=$$DIR^XBDIR("Y","Do You want to Select Another Vendor ","N","","","",1)
 G ZEND:+Y=0,A2
 ;
ZEND ; Close device, kill vars, quit.
 I $$DIR^XBDIR("E","Press RETURN...")
 I $G(IO) D ^%ZISC
 K ACHSEIN,ACHSFAX
 Q
 ;
NOREPORT ; No information in ACHSAOP(DUZ(2),"SVR",ACHSEIN
 U IO(0)
 W !,"No Report available for this Vendor"
 S Y=$$DIR^XBDIR("E","Enter <RETURN> to select another Vendor or '^' to Exit")
 G A2:Y=1,ZEND:Y=0
PGHDR ; Print report header.
 U IO
 S ACHSPGNO=ACHSPGNO+1
 W @IOF,$$C^XBFUNC("CHS AUTHORIZATIONS FROM "_$$LOC^ACHS_" FACILITIES",80)
 W !,$$C^XBFUNC("FOR "_$P($G(^AUTTVNDR(ACHSEINP,0)),U),80)
 S Z=^ACHSSVR(ACHSEIN,0),A=$P(Z,U,1),A=$E(A,3,4)_"/"_$E(A,5,6)_"/"_$E(A,1,2),B=$P(Z,U,2),B=$E(B,3,4)_"/"_$E(B,5,6)_"/"_$E(B,1,2)
 W !,$$C^XBFUNC("FOR AUTHORIZATIONS ISSUED BETWEEN "_A_" AND "_B,80)
 W !!,ACHSDATE,?70,"PAGE ",ACHSPGNO,!!,$$REPEAT^XLFSTR("-",80),!,"LOCATION",?14,"PATIENT NAME",?32,"DOCUMENT #",?45,"TYPE",?51,"IHS #",?59,"AUTH DTE",?70,"$$ AMOUNT",!,$$REPEAT^XLFSTR("-",80),!
 Q
 ;
FAX ;EP - Print FAX cover sheet for vendor.
 U IO
 W @IOF,!!!!!,$$C^XBFUNC("INDIAN HEALTH SERVICE",80),!,$$C^XBFUNC($$LOC^ACHS,80)
 W !,$$C^XBFUNC($P(^AUTTLOC(DUZ(2),0),U,12),80)
 S X=$P(^AUTTLOC(DUZ(2),0),U,13),Y=$P(^AUTTLOC(DUZ(2),0),U,14),Z=$P(^DIC(5,+Y,0),U,2)
 W !,$$C^XBFUNC(X_", "_Z_"  "_$P(^AUTTLOC(DUZ(2),0),U,15),80)
 W !!!!!!?10,"DATE:   ",$$FMTE^XLFDT(DT)
 W !!!!?10,"DELIVER TO:",?25,$E($P(^AUTTVNDR(ACHSEINP,0),U,1),1,30)
 W !?25,$P(^AUTTVNDR(ACHSEINP,13),U,1)
 W !?25,$P(^AUTTVNDR(ACHSEINP,13),U,2)," "
 S Y=$P(^AUTTVNDR(ACHSEINP,13),U,3),Z=$P(^DIC(5,+Y,0),U,2)
 W Z,"  ",$P(^AUTTVNDR(ACHSEINP,13),U,4)
 W !!!!?10,"FAX #: ",?25,$P(^AUTTVNDR(ACHSEINP,11),U,14)
 W !!!!!!!?10,"FROM:  ",?25,"Contract Health Services"
 W !?25,$E($$LOC^ACHS,1,30)
 W !!!!!!?10,"SUBJECT:  ",?25,"CHS PURCHASE ORDERS"
 W !!
 Q
 ;
INDEX ;EP - Create print index for ^ACHSSVR & begin & end dates.
 S ACHSI="",ACHSJ=1,ACHSK=""
 S:'$D(^ACHSSVR(ACHSEIN,0)) ^ACHSSVR(ACHSEIN,0)="999999^0"
INDEXB ;
 S ACHSJ=$O(^ACHSSVR(ACHSEIN,ACHSJ))
 G INDEXZ:ACHSJ=""!(+ACHSJ=0)
INDEXC ;
 ;BEGIN Y2K BLOCK
 S ACHSK=$O(^ACHSSVR(ACHSEIN,ACHSJ,ACHSK))
 G INDEXB:ACHSK=""!(+ACHSK=0)
 S ACHSX=$G(^ACHSSVR(ACHSEIN,ACHSJ,ACHSK))
 S ACHSPNAM=$E(ACHSX,103,118)
 S:ACHSPNAM="" ACHSPNAM=" "
 S ^ACHSSVR(ACHSEIN,"N",ACHSJ,ACHSPNAM,ACHSK)="",ACHSADT=$E(ACHSX,61,66)
 S ACHSADT=$S($E(ACHSADT,1,2)<84:20000000,1:19000000)
 S X=$P($G(^ACHSSVR(ACHSEIN,0)),U) ; XXX-0999-200030
 S X=$S($E(X,1,2)<84:20000000,1:19000000)+X
 S:ACHSADT<X $P(^ACHSSVR(ACHSEIN,0),U,1)=$E(ACHSADT,3,8) ; XXX-0999-200030
 S X=$P($G(^ACHSSVR(ACHSEIN,0)),U,2) ; XXX-0999-200030
 S X=$S($E(X,1,2)<84:20000000,1:19000000)+X
 S:ACHSADT>X $P(^ACHSSVR(ACHSEIN,0),U,2)=$E(ACHSADT,3,8) ; XXX-0999-200030
 ;END Y2K BLOCK
 G INDEXC
 ;
INDEXZ ;
 Q
 ;