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

BARUFUT3.m

Go to the documentation of this file.
BARUFUT3 ; IHS/SD/TPF - UTILITY FOR DETERMINING MISSING RECORDS ON THE HUB ;
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**4**;OCT 26, 2005
 ;NEW ROUTINE ;BAR*1.8*4
 Q
 ;
ASKFROM ;EP - ASK FROM DATE
 S BARJOB=$J
 K %DT
 S %DT="AET"
 S %DT("A")="Enter beginning transmission date: "
 W !
 D ^%DT
 Q:X=""!(X[U)
 I Y<0 W !,"INVALID DATE. TRY AGAIN!" H 2 G ASKFROM
 S BARFROM=Y
ASKTO ;EP - ASK TO DATE
 K %DT
 S %DT="AET"
 S %DT("A")="Enter ending transmission date: "
 W !
 D ^%DT
 G:X=""!(X[U) ASKFROM
 I Y<0 W !,"INVALID DATE. TRY AGAIN!" H 2 G ASKTO
 S BARTO=Y
 I BARTO<BARFROM W !!,"END DATE MUST BE GREATER THAN BEGINING DATE" H 2 G ASKFROM
 ;
ASKDEV ;EP - ASK DEVICE 
 S %ZIS="MQ"
 W !
 D ^%ZIS
 Q:POP
 I $D(IO("Q")) D QUE Q
 U IO
 D PRINT
 D ^%ZISC
 Q
QUE ; EP - QUE COUNT OF RECEIPTS TRANSMITTED REPORT
 S ZTRTN="PRINT^BARUFUT3"
 S ZTDESC="COUNT OF RECEIPTS TRANSMITTED IN A GIVEN DATE RANGE"
 S ZTSAVE("BARJOB")=""
 S ZTSAVE("BARTO")=""
 S ZTSAVE("BARFROM")=""
 D ^%ZTLOAD
 I $D(ZTSK)[0 W !!?5,"Report Cancelled!"
 E  W !!?5,"Report task #: ",$G(ZTSK)
 D HOME^%ZIS
 Q
 ;
PRINT ;EP - COUNT OF RECEIPTS TRANSMITTED IN A GIVEN DATE RANGE
 N TRANSDT,SESSID,DUZ2,CASHIER,BARTRAN,ROUTINE,EXFROM,EXTO
 S ROUTINE=$P($T(+1)," ")
 S Y=BARFROM X ^DD("DD") S EXFROM=Y
 S Y=BARTO X ^DD("DD") S EXTO=Y
 K ^XTMP(ROUTINE,$J)
 S ^XTMP(ROUTINE,0)=DT
 S BARTO=BARTO_".999999"
 S DUZ2=0
 F  S DUZ2=$O(^BARSESS(DUZ2)) Q:'DUZ2  D
 .S TRANSDT=BARFROM-.000001
 .F  S TRANSDT=$O(^BARSESS(DUZ2,"F",TRANSDT)) Q:'TRANSDT!(TRANSDT>BARTO)  D
 ..S SORTDT=$P(TRANSDT,".")
 ..S CASHIER=""
 ..F  S CASHIER=$O(^BARSESS(DUZ2,"F",TRANSDT,CASHIER)) Q:'CASHIER  D
 ...S SESSID=""
 ...F  S SESSID=$O(^BARSESS(DUZ2,"F",TRANSDT,CASHIER,SESSID)) Q:'SESSID  D
 ....S TRANSREC=""
 ....F  S TRANSREC=$O(^BARSESS(DUZ2,"F",TRANSDT,CASHIER,SESSID,TRANSREC)) Q:'TRANSREC  D
 .....S FILENAME=$$GET1^DIQ(90057.210101,TRANSREC_","_SESSID_","_CASHIER_",",.02)
 .....S:FILENAME="" FILENAME="UNDEFINED"
 .....D COUNTS(DUZ2,CASHIER,SESSID,SORTDT)     ;COUNT TOTAL FOR THE SESSIONS
 .....D FILETOT(DUZ2,FILENAME,CASHIER,SORTDT)  ;COUNT TOTALS FOR EACH FILE TRANSMITTED
 D DISPLAY
 ;K ^XTMP(ROUTINE,$J)
 Q
 ;
COUNTS(DUZ2,CASHIER,SESSID,SORTDT) ;EP - COUNT RECEIPTS FOR THE DAY
 S ESC=0
 S BARTRAN=0
 F  S BARTRAN=$O(^BARSESS(DUZ2,CASHIER,11,SESSID,2,BARTRAN)) Q:'BARTRAN  D
 .S ^XTMP(ROUTINE,BARJOB,DUZ2)=$G(^XTMP(ROUTINE,BARJOB,DUZ2))+1
 .S ^XTMP(ROUTINE,BARJOB,DUZ2,SORTDT)=$G(^XTMP(ROUTINE,BARJOB,DUZ2,SORTDT))+1
 Q
 ;
FILETOT(DUZ2,FILENAME,CASHIER,SORTDT) ;EP - RECEIPT TOTALS FOR THIS FILE NAME
 N SESSID,BARTRAN
 I FILENAME="UNDEFINED" D  Q
 .S ^XTMP(ROUTINE,BARJOB,DUZ2,SORTDT,FILENAME)=0
 S FILENAME=$P($P(FILENAME,"_",5,8),".")
 S SESSID=0
 F  S SESSID=$O(^BARSESS(DUZ2,"FN",FILENAME,SESSID)) Q:'SESSID  D
 .S BARTRAN=0
 .F  S BARTRAN=$O(^BARSESS(DUZ2,CASHIER,11,SESSID,2,BARTRAN)) Q:'BARTRAN  D
 ..S ^XTMP(ROUTINE,BARJOB,DUZ2,SORTDT,FILENAME)=$G(^XTMP(ROUTINE,BARJOB,DUZ2,SORTDT,FILENAME))+1
 Q
 ;
DISPLAY ;EP - DISPLAY REPORT
 I '$O(^XTMP(ROUTINE,BARJOB,"")) W !,"NO COUNTS FOR THIS DATE RANGE!!" H 2 Q
 S $P(LINE,"-",81)=""
 D NOW^%DTC
 S Y=% X ^DD("DD") S NOW=Y
 S NOW=Y
 ;S FACILITY=$O(^XTMP(ROUTINE,BARJOB,""))
 ;D HDR(NOW,FACILITY)
 ;D DET
 S DUZ2=""
 F  S DUZ2=$O(^XTMP(ROUTINE,BARJOB,DUZ2)) Q:'DUZ2  D  Q:ESC
 .D HDR(NOW,DUZ2),DET
 .S CNT=0
 .S SORTDT=""
 .F  S SORTDT=$O(^XTMP(ROUTINE,BARJOB,DUZ2,SORTDT)) Q:SORTDT=""  D  Q:ESC
 ..S FILENAME=""
 ..F  S FILENAME=$O(^XTMP(ROUTINE,BARJOB,DUZ2,SORTDT,FILENAME)) Q:'FILENAME  D  Q:ESC
 ...S CNT=CNT+1
 ...I $Y>(IOSL-4),$D(ZTQUEUED) D HDR(NOW,DUZ2),DET
 ...I $Y>(IOSL-4),(IO=IO(0)),'$D(IO("S")) K DIR S DIR(0)="E" D:'$D(ZTQUEUED) ^DIR S ESC=$G(X)=U Q:ESC  D HDR(NOW,DUZ2),DET
 ...W !,CNT_". "
 ...W FILENAME
 ...S Y=SORTDT X ^DD("DD") S EXDATE=Y
 ...W ?53,EXDATE
 ...W ?68,$J(^XTMP(ROUTINE,BARJOB,DUZ2,SORTDT,FILENAME),5)
 ...W ?76,"[ ]"
 ..W !?66,"------"
 ..W !?68,$J(^XTMP(ROUTINE,BARJOB,DUZ2,SORTDT),5)
 ..W !,LINE
 .Q:ESC
 .W !,LINE
 .W !?18,"GRAND TOTAL: ",$J($G(^XTMP(ROUTINE,BARJOB,DUZ2)),10)
 .I IO=IO(0),'$D(IO("S")) K DIR S DIR(0)="E" D:'$D(ZTQUEUED) ^DIR S ESC=$G(X)=U
 Q
 ;
DET ;EP - DETAIL
 W !,"FILE"
 W ?56,"DATE"
 W ?66,"RECEIPTS"
 W ?77,"AT"
 W !,"NAME"
 W ?52,"TRANSMITTED"
 W ?67,"TRANS"
 W ?76,"HUB?"
 W !,LINE
 Q
 ;
HDR(DATE,FACILITY) ;EP - HEADER
 W @IOF
 W !,$$CJ^XLFSTR("COUNT OF RECEIPTS TRANSMITTED IN A GIVEN DATE RANGE",IOM)
 W !,$$CJ^XLFSTR("REPORT DATE: "_DATE,IOM)
 W !,$$CJ^XLFSTR("PRINTED BY : "_$$GET1^DIQ(200,DUZ_",",.01),IOM)
 W !,$$CJ^XLFSTR("TRANSMISSIONS FROM "_EXFROM_" TO "_EXTO,IOM)
 W !,$$CJ^XLFSTR("FOR FACILITY: "_$$GET1^DIQ(9999999.06,DUZ2_",",.01,"E"),IOM)
 W !
 Q