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

APCLPRT.m

Go to the documentation of this file.
  1. APCLPRT ; IHS/CMI/LAB - PRINTS REPORTS USING REPORT TEMPLATE FILE ;
  1. ;;2.0;IHS PCC SUITE;;MAY 14, 2009
  1. ;
  1. ;CMI/TUCSON/LAB - patch 3 - 10/26/1998 - Y2K fixes
  1. EN(APCLDFN,APCLROOT,APCLPD) ;PEP - create report
  1. I '$D(APCLROOT) W !,*7,"Global root not indicated!" Q
  1. I '$D(ZTQUEUED),$P(IOST,"-")="C" S APCLBRK="" W @IOF
  1. S APCLENDR=$E(APCLROOT,$L(APCLROOT)) I "(,"[APCLENDR S APCLROOT=$E(APCLROOT,1,($L(APCLROOT)-1))
  1. S APCLENDR=$E(APCLROOT,$L(APCLROOT)) I APCLENDR'=")",APCLROOT["(" S APCLROOT=APCLROOT_")"
  1. S (APCLOOP,APCLCNT,APCLSTP)=0 F S APCLOOP=$O(^APCLRPT(APCLDFN,21,APCLOOP)) Q:'APCLOOP!APCLSTP S APCLL=0 S APCLLINE=^(APCLOOP,0) D D APCLWRTE
  1. . F I=1:1 Q:$P(APCLLINE,"|",2,99)="" S APCLN=+$P(APCLLINE,"|",2),APCLTMP=$P(APCLLINE,"|") S APCLV=$S($D(@APCLROOT@(APCLN)):@APCLROOT@(APCLN),1:"") D:APCLV="" CODE D:APCLV]""&($P($G(^APCLRPT(APCLDFN,31,APCLN,0)),U,2)="p") PCT D K APCLCODE
  1. .. I ($L(APCLTMP)+$L(APCLV))>$S($D(APCLCODE):250,1:IOM) S APCLL=APCLL+1 S APCLWRTE(APCLL)=APCLTMP S APCLLINE=APCLV_$P(APCLLINE,"|",3,999) Q
  1. .. S APCLTMP=APCLTMP_APCLV
  1. .. I ($L(APCLTMP)+$L($P(APCLLINE,"|",3,999)))>IOM S APCLL=APCLL+1 S APCLWRTE(APCLL)=APCLTMP S APCLLINE=$P(APCLLINE,"|",3,999) Q
  1. .. S APCLLINE=APCLTMP_$P(APCLLINE,"|",3,999)
  1. . S APCLL=APCLL+1 S APCLWRTE(APCLL)=APCLLINE
  1. I $D(APCLBRK),'APCLSTP D PAGE I 1
  1. E W @IOF
  1. K APCLOOP,APCLBRK,APCLCNT,APCLI,APCLTMP,APCLL,APCLLINE,APCLN,APCLV,APCLWRTE,APCLX,APCLENDR
  1. I '$D(APCLASK) K APCLSTP
  1. Q
  1. ;
  1. CODE ; Get date or value from data fetcher
  1. NEW APCLDIS,APCLI,APCLSTP
  1. K APCLER
  1. I $G(APCLPD),$G(^APCLRPT(APCLDFN,31,APCLN,21))]"" S APCLCODE=^(21) D
  1. . I APCLCODE["*" S APCLV="Script error - '*' entered as a value!" Q
  1. . I $G(APCLDATE)]"",$P(APCLCODE,";",2)]"" S APCLV="Script error - date information entered!" Q
  1. . S APCLDIS=$S($P(APCLCODE," ")="DATE":"DATE",$P(APCLCODE," ")="VALUE"!("PATPT"[$P(APCLCODE," ")):"VALUE",1:"BOTH")
  1. . I $E($P(APCLCODE," "),1,3)["PAT"!($E($P(APCLCODE," "),1,2)["PT")
  1. . E I APCLDIS="DATE"!(APCLDIS="VALUE") S APCLCODE=$P(APCLCODE," ",2,99)
  1. . I $E($P(APCLCODE," "),1,3)'="PAT",$E($P(APCLCODE," "),1,2)'="PT" S APCLCODE=APCLCODE_$G(APCLDATE)
  1. . S APCLX=APCLPD_"^"_APCLCODE,APCLY="APCLDF(" S APCLER=$$START1^APCLDF(APCLX,APCLY) K APCLX,APCLY
  1. . I APCLER S APCLV="Data Retrieval Error!" K APCLER Q
  1. . K APCLER
  1. . I '$D(APCLDF) S APCLV="None Found" K APCLDF Q
  1. . I APCLDIS="BOTH"!(APCLDIS="DATE") F APCLI=1:1 Q:'$D(APCLDF(APCLI)) D Q:$G(APCLSTP) D SET
  1. .. I ($L(APCLV)+6)>246 S APCLSTP=1,APCLV=APCLV_" ...etc."
  1. . I APCLDIS'="VALUE" K APCLDF Q
  1. . F APCLI=1:1 Q:'$D(APCLDF(APCLI)) D Q:$G(APCLSTP) S APCLV=$S(APCLI>1:APCLV_", ",1:$G(APCLV))_$P(APCLDF(APCLI),U,2)
  1. .. I ($L(APCLV)+6)>246 S APCLSTP=1,APCLV=APCLV_" ...etc."
  1. . K APCLDF,APCLPCE
  1. Q
  1. ;
  1. SET ; Set Value and or Date from PCC SCRIPT
  1. ;beginning Y2K fix. Modified line to use a 4 digit year rather than a 2 digit year. Not sure is this was necessary but it will work either way.
  1. ;S Y=$P(APCLDF(APCLI),U),Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3) S APCLV=$S(APCLI>1:APCLV_", ",1:$G(APCLV))_$S(APCLDIS="BOTH":$P(APCLDF(APCLI),U,2)_" - "_Y,1:Y)
  1. S Y=$P(APCLDF(APCLI),U),Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_(1700+$E(Y,1,3)) S APCLV=$S(APCLI>1:APCLV_", ",1:$G(APCLV))_$S(APCLDIS="BOTH":$P(APCLDF(APCLI),U,2)_" - "_Y,1:Y) ;Y2000
  1. ;end Y2K fix
  1. Q
  1. ;
  1. APCLWRTE ; Write line
  1. I APCLWRTE(1)="@",$D(APCLBRK) D PAGE G X1
  1. I APCLWRTE(1)="@" W @IOF S APCLCNT=0 G X1
  1. F APCLX=1:1:APCLL Q:APCLSTP W !,APCLWRTE(APCLX) S APCLCNT=APCLCNT+1 I $D(APCLBRK),(IOSL-3)<APCLCNT D PAGE
  1. X2 K APCLWRTE
  1. Q
  1. ;
  1. PAGE ; Page Control
  1. W !
  1. S DIR(0)="E" D ^DIR K DIR
  1. I Y S APCLCNT=0
  1. E S APCLSTP=1
  1. W @IOF
  1. Q
  1. ;
  1. PCT ; Determine APCL
  1. S @("APCLV="_APCLV)
  1. S APCLV=APCLV*100,APCLV=$J(APCLV,3,0)_"%"
  1. X1 Q
  1. ;