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

ACRFSPL3.m

Go to the documentation of this file.
ACRFSPL3 ;IHS/OIRM/DSD/AEF - DHR SPLITOUT [ 10/27/2004   4:18 PM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**13**;NOV 05, 2001
 ;
EN(ACRD0)          ;EP
 ;----- MAIN ENTRY POINT
 ;
 ;      REQUIRES ACRD0 = IEN OF DHR DATA RECORDS FILE
 ;
 N X,Y,ACRJOB,ZTDESC,ZTRTN,ZTSAVE
 D ^XBKVAR,HOME^%ZIS
 S ACRJOB=$J
 S ZTSAVE("ACRJOB")=""
 S ZTSAVE("ACRD0")=""
 D QUE^ACRFUTL("DQ^ACRFSPL3",.ZTSAVE,"BATCH SPLIT-OUT REPORT") ;ACR*2.1*13.06 IM14144
 D ^%ZISC
 Q
DQ ;----- QUEUED JOB STARTS HERE
 ;
 D PRT
 ;K ^TMP("ACRDHR",ACRJOB)
 D ^%ZISC
 Q
PRT ;----- PRINT REPORT
 ;
 N ACRD1,ACRD2,ACRD2X,ACRD3,ACROUT,CNT,BATCH,BATCHID,BATCHIDX,DIR,PAGE,X,Y
 S BATCH=$S(ACRD0=1:"PCC-BLUE",ACRD0=2:"PCC-RED",ACRD0=3:"CHS-BLUE",ACRD0=4:"CHS-RED",ACRD0=5:"ARM-BLUE",ACRD0=6:"ARM-RED",1:"")
 I '$D(^TMP("ACRDHR",ACRJOB)) D HDR W !!,"No records to print" Q
 S ACRD1=0,BATCHIDX=""
 F  S ACRD1=$O(^TMP("ACRDHR",ACRJOB,ACRD0,ACRD1)) Q:'ACRD1  D  Q:$G(ACROUT)
 . S ACRD2=""
 . F  S ACRD2=$O(^TMP("ACRDHR",ACRJOB,ACRD0,ACRD1,ACRD2)) Q:ACRD2']""  D  Q:$G(ACROUT)
 . . S BATCHID=ACRD1_"-"_ACRD2
 . . I BATCHIDX'="",BATCHID'=BATCHIDX D
 . . . W !!,"BATCH: ",BATCHIDX
 . . . S DATA=^TMP("ACRDHR",ACRJOB,ACRD0,$P(BATCHIDX,"-"),$P(BATCHIDX,"-",2),0)
 . . . W ?20,"BATCH RECORD COUNT: ",$J($P(DATA,U),4)
 . . . W ?46,"BATCH AMOUNT: ",$J($P(DATA,U,2),12,2)
 . . S BATCHIDX=BATCHID
 . . S (ACRD3,CNT)=0
 . . F  S ACRD3=$O(^TMP("ACRDHR",ACRJOB,ACRD0,ACRD1,ACRD2,ACRD3)) Q:'ACRD3  D  Q:$G(ACROUT)
 . . . I 'CNT D HDR W !,"BATCH: ",ACRD1,"-",ACRD2
 . . . I $E(IOST)="C",CNT>1 D HDR S CNT=0
 . . . I $E(IOST)'="C",CNT>5 D HDR S CNT=0
 . . . S CNT=CNT+1
 . . . W !
 . . . F I=1:1:5 W ^TMP("ACRDHR",ACRJOB,ACRD0,ACRD1,ACRD2,ACRD3,I)
 S DATA=^TMP("ACRDHR",ACRJOB,ACRD0,$P(BATCHIDX,"-"),$P(BATCHIDX,"-",2),0)
 W !!,"BATCH: ",BATCHIDX
 W ?20,"BATCH RECORD COUNT: ",$J($P(DATA,U),4)
 W ?46,"BATCH AMOUNT: ",$J($P(DATA,U,2),12,2)
 S DATA=^TMP("ACRDHR",ACRJOB,ACRD0,0)
 W !!?20,"TOTAL RECORD COUNT: ",$J($P(DATA,U),4)
 W ?46,"TOTAL AMOUNT: ",$J($P(DATA,U,2),12,2)
 I $E(IOST)="C" S DIR(0)="E" D ^DIR K DIR
 Q
HDR ;----- WRITE REPORT  HEADER
 ;
 N DIR
 I $E(IOST)="C",$G(PAGE) S DIR(0)="E" D ^DIR K DIR I 'Y S ACROUT=1 Q
 S PAGE=$G(PAGE)+1
 W @IOF
 W !,"D H R   S P L I T - O U T   P R O G R A M"
 W ?62,$$NOW
 W !,$G(BATCH)," Listing of Individual Records"
 W ?62,"PAGE ",$J(PAGE,3)
 W !!,?9,1,?19,2,?29,3,?39,4,?49,5,?59,6,?69,7,?79,8
 W !
 F I=1:1:8 W "1234567890"
 W !
 Q
NOW() ;----- RETURNS CURRENT DATE/TIME   
 ;
 N %,%H,%I,X
 D NOW^%DTC
 S Y=DT
 X ^DD("DD")
 Q Y_"  "_$E($P(%,".",2),1,2)_":"_$E($P(%,".",2),3,4)