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

A1VSLPD1.m

Go to the documentation of this file.
A1VSLPD1 ;Albany FO/GTS - VistA Package Sizing Manager - Caption display APIs; 12-JUL-2016
 ;;1.0;VistA Package Sizing;;Oct 10, 2016;Build 25
 ;
 ;APIs
EDITPRFX(DATELEMT,LISTDATA,UPDATLST) ; Update Prefix list
 NEW DIR,DIRUT,DTOUT,DUOUT,X,Y,EDTELEMT,PCE
 SET PCE=0
 IF (LISTDATA["|"_DATELEMT_"|")!($P(LISTDATA,"|")=DATELEMT) SET PCE=$$PCEPOS(LISTDATA,DATELEMT)
 SET DIR("A")=" Prefix: "
 SET DIR("B")=DATELEMT
 SET DIR("?")=" Enter/Edit a Prefix."
 SET DIR(0)="FAO^2:6^K:(X'?1U1.5NU) X"
 DO ^DIR
 DO LSTEDT(X,PCE,DATELEMT,.LISTDATA,.UPDATLST)
 QUIT
 ;
EDITFNUM(DATELEMT,LISTDATA,UPDATLST) ; Update File list
 NEW DIR,DIRUT,DTOUT,DUOUT,EDTELEMT,PCE
 SET PCE=0
 IF (LISTDATA["|"_DATELEMT_"|")!($P(LISTDATA,"|")=DATELEMT) SET PCE=$$PCEPOS(LISTDATA,DATELEMT)
 SET DIR("A")=" File Number: "
 SET DIR("B")=DATELEMT
 SET DIR("?")=" Enter/Edit a File Number."
 SET DIR(0)="NAO^1.9999:99999999.999999:6"
 DO ^DIR
 DO LSTEDT(X,PCE,DATELEMT,.LISTDATA,.UPDATLST)
 QUIT
 ;
EDITFRNG(DATELEMT,LISTDATA,UPDATLST) ; Update File Range
 NEW DIR,DIRUT,DTOUT,DUOUT,EDTELEMT,PCE
 SET PCE=0
 IF (LISTDATA["|"_DATELEMT_"|")!($P(LISTDATA,"|")=DATELEMT) SET PCE=$$PCEPOS(LISTDATA,DATELEMT)
 SET DIR("A")=" File Number Range: "
 SET DIR("B")=DATELEMT
 SET DIR("?",1)=" Enter a new File Number Range or one from the list."
 SET DIR("?")="New file number ranges only between 1.9999 and 99999999.999999"
 SET DIR(0)="FAO^3:31^K:$$BADRNG^A1VSLPD1(X) X"
 DO ^DIR
 DO LSTEDT(X,PCE,DATELEMT,.LISTDATA,.UPDATLST)
 QUIT
 ;
LSTEDT(EDTELEMT,PCE,DATELEMT,LISTDATA,UPDATLST) ;Edit List dialog
 IF (PCE>0),(EDTELEMT'="@") SET $P(LISTDATA,"|",PCE)=EDTELEMT SET UPDATLST=1 ;EDIT ENTRY
 IF (PCE>0),(EDTELEMT="@") DO
 . IF +$$YNCHK^A1VSLAPI("DELETE ENTRY") SET LISTDATA=$P(LISTDATA,DATELEMT_"|",1)_$P(LISTDATA,DATELEMT_"|",2) SET UPDATLST=1
 IF PCE'>0 DO
 . IF EDTELEMT="@" W !,"?? ...Element not in list, cannot delete!" SET EDTELEMT=DATELEMT
 . SET:+$$YNCHK^A1VSLAPI("ADD ENTRY") LISTDATA=LISTDATA_EDTELEMT_"|" SET UPDATLST=1
 QUIT
 ;
UPDTNODE(UPDIRUT,EDITARY,DATANUM,DATANAME,UPDX,CHNGMADE) ;Update ^TMP("A1VS-PARAM-EDIT") array node
 IF ('$D(UPDIRUT)) SET @EDITARY@(DATANUM,DATANAME)=UPDX SET CHNGMADE=1
 IF $D(UPDIRUT) DO
 . IF (UPDX="@"),(@EDITARY@(DATANUM,DATANAME)'="") DO
 .. IF +$$YNCHK^A1VSLAPI("DELETE ENTRY") SET @EDITARY@(DATANUM,DATANAME)="" SET CHNGMADE=1
 . IF (UPDX'="@"),(@EDITARY@(DATANUM,DATANAME)'=UPDX) SET @EDITARY@(DATANUM,DATANAME)=UPDX SET CHNGMADE=1
 QUIT
 ;
SPLITOUT(DATANAME,LISTDATA) ; -- Split list data to separate lines as needed and output
 ; DATANAME  - Data element name
 ; LISTDATA  - Data element list
 ;
 NEW LINE,PCENUM,LISTPCE,NXSTPCE
 WRITE !!!,DATANAME_":"
 IF LISTDATA']"" W !,"{no data list}"
 IF LISTDATA]"" DO
 . IF $L(LISTDATA)'>79 W !,LISTDATA
 . IF $L(LISTDATA)>79 DO
 .. SET LINE=""
 .. SET NXSTPCE=1
 .. FOR PCENUM=1:1 SET LISTPCE=$P(LISTDATA,"|",PCENUM)  Q:LISTPCE=""  DO
 ... IF $L($P(LISTDATA,"|",NXSTPCE,PCENUM))>79 W !,$P(LISTDATA,"|",NXSTPCE,PCENUM-1) SET NXSTPCE=PCENUM
 .. W !,$P(LISTDATA,"|",NXSTPCE,999)
 WRITE !
 QUIT
 ;
BADRNG(X) ;Checks user entered File Range (used by DIR call)
 SET RESULT=0
 IF ((X'?1.N."."0.6N1"-"1.N."."0.6N)!($P(X,"-",2)<$P(X,"-"))) SET RESULT=1
 QUIT RESULT
 ;
SETSTR(PKGARY) ;Return a string of Package File Lineitem (Concatonate fields to 1 HDR line)
 NEW LINEITM,LPCNT,FLD
 SET LINEITM=""
 SET LPCNT=0
 FOR  SET LPCNT=$O(@CAPARY@(LPCNT)) Q:LPCNT=""  DO
 . SET FLD=$O(@CAPARY@(LPCNT,""))
 . SET LINEITM=LINEITM_@CAPARY@(LPCNT,FLD)_$S(LPCNT<9:"^",1:"")
 QUIT LINEITM
 ;
PCEPOS(LISTDATA,DATELEMT) ; Return the piece position number of DATELEMT in LISTDATA
 NEW PCE,DELIMPOS,ITEM
 FOR PCE=1:1 SET ITEM=$P(LISTDATA,"|",PCE) Q:ITEM=DATELEMT  IF ITEM="" SET PCE=0 QUIT
 QUIT PCE