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

BARUFVF.m

Go to the documentation of this file.
BARUFVF ; IHS/SD/TPF - UFMS VIEW UFMS FILE REPORT ; 10/20/2008
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**3,4,8,23**;OCT 26, 2005
 Q
 ;
ASKFILE ;EP -  CHOOSE UFMS FILE TO VIEW
 N DIREC,DESTIP,ARGS,BARUFMS
 S $P(DASH,"-",81)=""
 S DIREC=$P($G(^BAR(90052.06,DUZ(2),DUZ(2),15)),U)  ;A/R PARAMETER FILE, UFMS DIRECTORY
 I DIREC="" D  Q
 .W !!,"Before UFMS files can be created a non-public directory must be created"
 .W !,"on the Host File System. This directory must be entered in to A/R Site Parameter"
 .W !,"field UFMS DIRECTORY using the 'SPE    Site Parameter Edit' option"
 .D ASKFORRT^BARUFUT
 W !!,"CURRENT UFMS DIRECTORY IS ",DIREC
 K DIR
 S DIR(0)="FO"
 S DIR("?",1)="Enter a file name e.g. IHS_AR_RPMS_RCV_398_113510_20070806_0847.DAT,"
 S DIR("?",2)="or a partial filename IHS_AR_RPMS_RCV_398*, the * is a wildcard,"
 S DIR("?")="or * to list all UFMS files in the UFMS directory."
 S DIR("A")="Enter filename "
 D ^DIR
 Q:$D(DTOUT)!$D(DIROUT)!$D(DUOUT)!(Y="")!(Y=" ")
 S FILENM=Y
 I $E(FILENM,1,16)="IHS_TPB_RPMS_INV" W "   ??" H 1 G ASKFILE
 I $E(FILENM)="*" S FILENM="*"
 I FILENM="*" S FILENM="IHS_AR_RPMS_RCV*"
 K FARRAY
 D LIST^%ZISH(DIREC,FILENM,.FARRAY)
 I '$D(FARRAY) W "    ??" H 1 G ASKFILE
 W @IOF
 W !!!,"FILES FOUND: "
 S (KEY,LN,CHOICE)=""
 S FIRST=1
 F CNT=1:1 S LN=$O(FARRAY(LN)) Q:KEY!(LN="")!$G(CHOICE)  D
 .W !,LN_"."
 .W ?5,FARRAY(LN)
 .I '(CNT#10) D
 ..K DIR
 ..S DIR(0)="NO^1:"_CNT
 ..S DIR("A")="Enter item number: "
 ..D ^DIR
 ..;I Y="" S FIRST=CNT+1 Q
 ..S CHOICE=Y
 ..S KEY=$D(DUOUT)!($D(DTOUT))
 Q:KEY
 I '$G(CHOICE),LN="" D  Q:KEY
 .K DIR
 .S DIR(0)="NO^1:"_(CNT-1)
 .S DIR("A")="Enter item number: "
 .D ^DIR
 .S CHOICE=Y
 .S KEY=$D(DUOUT)!($D(DTOUT))!(Y="")
 ;
 S ITEM=CHOICE
 ;
ASKTYP ;EP - ASK FOR TYPE OF REPORT FILE LAYOUT OR CAPTIONED
 K DIR
 S DIR(0)="SO^F:FILE LAYOUT;C:CAPTIONED"
 D ^DIR
 G:$D(DUOUT)!$D(DTOUT)!(Y="") ASKFILE
 S RPTTYP=Y
 ;NEW BAR*1.8*4 SCR56,SCR58 ADD SEARCH FOR DEBUGGING
 S TARSTRG=$$ASKTAR()
 ;END
 ;D FILE(DIREC,FARRAY(ITEM),RPTTYP)
 D FILE(DIREC,FARRAY(ITEM),RPTTYP,TARSTRG)  ;BAR*1.8*4 SCR56,SCR58
 G ASKFILE
 Q
 ;
 ;NEW BAR*1.8*4
ASKTAR() ;EP - ASK IF A SEARCH IS NEEDED
 W !
 K DIR
 S DIR(0)="Y"
 S DIR("A")="WOULD YOU LIKE TO SEARCH FOR A STRING?"
 S DIR("B")="N"
 D ^DIR
 Q:$D(DUOUT)!$D(DTOUT)!('Y) ""
 W !
 K DIR
 S DIR(0)="FO"
 S DIR("A")="ENTER TARGET STRING"
 D ^DIR
 Q:$D(DUOUT)!$D(DTOUT)!(Y="") ""
 Q Y
 ;
 ;FILE(BARDIR,BARFN,RPTTYP) ; EP
FILE(BARDIR,BARFN,RPTTYP,TARSTRG) ;EP - DISPLAY FILE ;BAR*1.8*4 SCR56,SCR58
 ; Pull up a file into the TMP global for display
 N Y,X,I,BARRNAM
 S Y=$$OPEN^%ZISH(BARDIR,BARFN,"R")
 I Y W !,"CAN'T OPEN FILE" H 3 Q
 S BARRNAM=$P($T(+1)," ")
 K ^TMP(BARRNAM,$J)
 ;F I=1:1 U IO R X:1 Q:$$STATUS^%ZISH=-1  S ^TMP(BARRNAM,$J,I,0)=X
 F I=1:1 U IO R X:1 Q:$$STATUS^%ZISH=-1  D     ;DIRECT READ OF FLAT FILE
 .Q:TARSTRG'=""&(X'[(TARSTRG))  ;SCREEN FOR SEARCH STRING ONLY
 .S ^TMP(BARRNAM,$J,I,0)=X
 D ^%ZISC
 I $D(^TMP(BARRNAM,$J)) D DISPLAY(BARFN,RPTTYP)
 K ^TMP(BARRNAM,$J)
 Q
 ;
DISPLAY(FILENAME,RPTTYP) ;EP - DISPLAY UFMS FILE
 S (ESC,PAGE)=0
 D FNHDR(FILENAME,RPTTYP)
 S RECNUM=0
 F  S RECNUM=$O(^TMP(BARRNAM,$J,RECNUM)) Q:'RECNUM!(ESC)  D
 .I $Y>(IOSL-4) W ! K DIR S DIR(0)="E" D:'$D(ZTQUEUED) ^DIR S ESC=X=U Q:ESC  D FNHDR(FILENAME,RPTTYP)
 .S RECORD=$G(^TMP(BARRNAM,$J,RECNUM,0))
 .I RPTTYP="C" D CAPTIONS(FILENAME,RECORD,RECNUM) Q
 .W !,RECNUM
 .W ?6,RECORD
 Q:ESC
 I '$D(ZTQUEUED) D
 .K DIR
 .S DIR(0)="E"
 .D ^DIR
 Q
 ;
FNHDR(FILENAME,RPTTYP) ;EP - DISPLAY DISPLAY HEADER
 I IOM=80 D FNHDR80 Q
 I IOM=132 D FNHDR132 Q
 Q
FNHDR132 ;EP - HEADER FOR 132 COL
 W !,"NOT YET IMPLEMENTED" H 3
 Q
FNHDR80 ;EP - HEADER FOR 80 COL
 S PAGE=$G(PAGE)+1
 W @IOF
 S X="UFMS FILE VIEW"
 S X=$J("",IOM-$L(X)\2-$X)_X
 W !,X
 W ?70,"PAGE ",PAGE
 W !,$$CJ^XLFSTR("FILE: "_FILENAME,IOM)
 I RPTTYP="C" W !,$$CJ^XLFSTR("CAPTIONED LAYOUT",IOM),DASH Q
 W !!,"REC"
 W ?5,"RECORD"
 W ?35,"BATCH"
 W ?72,"TR DATE"
 ;SECOND LINE 
 W !,"#"
 W ?5,"TYPE"
 W ?16,"AMOUNT"
 W ?35,"APPLY TO"
 W ?50,"SCHED #"
 W !,DASH
 Q
 ;
CAPTIONS(FILENAME,RECORD,RECNUM) ;EP - DO A CAPTION OUTPUT OF THE FILE RECORD
 S RECTYP=$TR($E(RECORD,1,1)," ")
 S BATCH=$$LEADSP($E(RECORD,2,150))
 S TRDATE=$TR($E(RECORD,151,160)," ")
 S AMTSIGN=$TR($E(RECORD,161,161)," ")
 S AMOUNT=+$TR($E(RECORD,162,181)," ")
 S AMOUNT=$E(AMOUNT,1,$L(AMOUNT)-2)_"."_$E(AMOUNT,$L(AMOUNT)-1,$L(AMOUNT))
 ;Begin changes to length of invoice number;MRS:BAR*1.8*8 HEAT529
 S APPLYTO=$TR($E(RECORD,182,221)," ")
 S SCHEDNUM=$TR($E(RECORD,222,241)," ")
 S UNIQUEID=$TR($E(RECORD,242,391)," ")
 N BARP1,BARP2
 S BARP1=$P(FILENAME,"_",9)                    ;PATCH FIELD
 S BARP2=$TR($P(BARP1,".",1,3),".")
 I BARP2<10808 D
 .S APPLYTO=$TR($E(RECORD,182,201)," ")
 .S SCHEDNUM=$TR($E(RECORD,202,221)," ")
 .S UNIQUEID=$TR($E(RECORD,301,336)," ")
 ;End changes;MRS:BAR*1.8*8 HEAT529
 ;
 I $Y>(IOSL-8) W ! K DIR S DIR(0)="E" D:'$D(ZTQUEUED) ^DIR S ESC=X=U Q:ESC  D FNHDR(FILENAME,RPTTYP)
 I RECTYP'="T" D  Q
 .W !!,"RECORD #: ",RECNUM
 .W !,"RECORD TYPE: ",RECTYP
 .W !,"BATCH: ",BATCH
 .W !,"TRANSACTION DATE: ",TRDATE
 .W !,"AMOUNT SIGN: ",AMTSIGN
 .W !,"AMOUNT: ",AMOUNT
 .W !,"APPLY TO: ",APPLYTO
 .W !,"SCHEDULE #: ",SCHEDNUM
 .W !,"UNIQUE ID: ",UNIQUEID     ;BAR*1.8*4 ITEM 3 SCR58
 S TOTREC=$E(RECORD,2,11)
 S TOTAMT=$E(RECORD,12,31)
 I TOTAMT[("-") D
 .S TOTAMT="-"_$P(TOTAMT,"-",2)
 S TOTAMT=$E(TOTAMT,1,$L(TOTAMT)-2)_"."_$E(TOTAMT,$L(TOTAMT)-1,$L(TOTAMT))
 W !,"RECORD TYPE: ",RECTYP
 W !,"TOTAL RECORDS: ",+TOTREC
 W !,"TOTAL AMOUNT: ",TOTAMT
 Q
 ;
LEADSP(STR) ;EP - STRIP LEADING SPACES
 N CHAR,TARGET
 Q:$E(STR)'=" " STR
 F CHAR=1:1:$L(STR) Q:$E(STR,CHAR,CHAR)'=" "
 S STR=$E(STR,CHAR,$L(STR))
 Q STR