- ORSNAST ;SLC/RAF - Policy order search ;06/25/2007
- ;;3.0;ORDER ENTRY/RESULTS REPORTING;**50,263**;Dec 17, 1997;Build 9
- ;;Per VHA Directive 2004-038, this routine should not be modified.
- ;
- ;this utility will allow the user to enter a date range to search
- ;the orders file, 100, looking for orders with a specific nature
- ;of order or status
- ;
- ;
- EN ;
- S U="^" K ^TMP("ORNS",$J),^TMP("ORSERV",$J)
- W @IOF,!!?18,"Nature of Order or Order Status Search.",!?15,"This report is formatted for 132 column output."
- N DASH,DATE,DFN,DIR,DTOUT,DUOUT,EDATE,FORMAT,HDR,HDR1,IEN
- N LOC,LONER,ORIGVIEW,PAGE,PNM,PROV,QUIT,REF,RPDT,SDATE,SER,SERVICE,STOP,TEXT,TEXTSUB
- N SINGLE,SIGNED,SNAME,SSN,STATUS,SORT,SEARCH,SUB
- N VA,VADM,WHEN,WHO,Y
- SORT S DIR(0)="SX^1:Nature of order;2:Order Status"
- S DIR("A")="Enter the search criteria"
- S DIR("?")="Enter a 1 to search orders by the Nature of order or a 2 to search orders by the Order Status. Enter an ^ to exit the option."
- D ^DIR S:+Y>0 SORT=+Y K DIR I $D(DTOUT)!($D(DUOUT)) G EXIT
- S DIR(0)=$S(SORT=1:"PA^100.02:AEMQ",SORT=2:"PA^100.01:AEMQ")
- S DIR("A")="Select "_$S(SORT=1:"Nature of order: ",1:"Order Status: ")
- D ^DIR S:+Y>0 SEARCH=+Y,SNAME=$P(Y,U,2) K DIR I $D(DTOUT)!($D(DUOUT)) G EXIT
- D SDATE I $D(DTOUT)!$D(DUOUT) G EXIT
- D EDATE I $D(DTOUT)!$D(DUOUT) G EXIT
- D CKDATE I $D(DTOUT)!$D(DUOUT) G EXIT
- FORMAT ;allows choice of formats for evaluation purpose
- S DIR(0)="SX^1:Detailed format;2:Columnar format"
- S DIR("A")="Select output format"
- S DIR("?")="Enter a 1 for a Detailed format and a 2 for a Columnar format. Enter an ^ to exit the option."
- D ^DIR S:+Y>0 FORMAT=+Y K DIR I $D(DTOUT)!$D(DUOUT) G EXIT
- SERV ;sets the variable SERVICE equal to 1 if the user wants to sort by
- ;service, or sets it to 0 if not
- I FORMAT=2 D I $D(DTOUT)!($D(DUOUT)) G EXIT
- .S DIR(0)="Y"
- .S DIR("A")="Would you like to sort the output by service"
- .S DIR("?")="If you answer yes, the output will be sorted by service. Enter an ^ to exit the option."
- .S DIR("B")="NO"
- .D ^DIR S SERVICE=+Y K DIR
- SINGLE ;sets variable SINGLE to set up a search of a single service
- I FORMAT=2&($G(SERVICE)) D I $D(DTOUT)!($D(DUOUT)) G EXIT
- .S DIR(0)="Y",DIR("B")="NO"
- .S DIR("A")="Would you like to search for specific SERVICE/SECTIONS"
- .S DIR("?")="Enter a YES to search by a single SERVICE/SECTION. You may either press enter without selecting a SERVICE/SECTION or enter an ^ to exit the option,"
- .D ^DIR S:+Y>0 SINGLE=+Y K DIR
- LONER ;sets DIR call to allow the user to select a single service/section
- I FORMAT=2&($G(SERVICE))&($G(SINGLE)) D I $D(QUIT)!('$D(LONER)) G EXIT
- .F D I $D(QUIT)!(Y=-1) Q
- ..S DIR(0)="PAO^49:AEQM"
- ..S DIR("A")="Select Service/Section: "
- ..D ^DIR S:+Y>0 LONER($P(Y,U,2))=+Y K DIR I $D(DTOUT)!($D(DUOUT)) S QUIT=1
- TASK ;
- S %ZIS="Q" D ^%ZIS I POP Q
- I $D(IO("Q")) D K IO("Q") Q
- .S ZTIO=ION,ZTDESC="File 100 order status search"
- .S ZTRTN="EN^ORSNAST1",ZTSAVE("SORT")="",ZTSAVE("FORMAT")=""
- .S ZTSAVE("SDATE")="",ZTSAVE("EDATE")="",ZTSAVE("SEARCH")=""
- .S ZTSAVE("SNAME")="",ZTSAVE("SERVICE")="",ZTSAVE("SD1")=""
- .S ZTSAVE("ED1")="",ZTSAVE("LONER*")="",ZTSAVE("SINGLE")=""
- .D ^%ZTLOAD I $D(ZTSK) W !,?32,"REQUEST QUEUED"
- U IO D EN^ORSNAST1
- G EXIT
- ;
- SDATE ;sets DIR call to ask the user for a starting date
- S DIR(0)="DA^::ETX"
- S DIR("A")="Enter a starting date: "
- S DIR("?")="Enter the date that you wish to start searching with. This date needs to be older than the ending date. For example: If you enter a start date of T-3, the Stop date should be T-2 or less. Enter an ^ to exit the option."
- D ^DIR S:+Y>0 SDATE=+Y K DIR I $D(DTOUT)!($D(DUOUT)) Q
- I SDATE'["." S SDATE=SDATE_.0001
- Q
- EDATE ;sets DIR call to ask the user for an ending date (optional)
- S DIR(0)="DA^::ETX"
- S DIR("A")="Enter a ending date: "
- S DIR("?")="Enter the date that you would like the search to end with. This date needs to be more recent than the start date. For example: If you entered a T-3 for the start date, enter a T-2 or less here. Enter an ^ to exit the option."
- D ^DIR S:+Y>0 EDATE=+Y K DIR I $D(DTOUT)!($D(DUOUT)) Q
- I EDATE'["." S EDATE=EDATE_.2359
- Q
- CKDATE ; Make sure the end date is not older than the start date.
- I EDATE>SDATE Q
- W !!,?10,"The starting date must be older than the ending date.",!,?10,"Please re-enter start and end dates.",!!
- D SDATE I $D(DTOUT)!$D(DUOUT) Q
- D EDATE I $D(DTOUT)!$D(DUOUT) Q
- G CKDATE
- EXIT ;
- K ^TMP("ORNS",$J),^TMP("ORSERV",$J)
- D ^%ZISC
- Q
- ORSNAST ;SLC/RAF - Policy order search ;06/25/2007
- +1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**50,263**;Dec 17, 1997;Build 9
- +2 ;;Per VHA Directive 2004-038, this routine should not be modified.
- +3 ;
- +4 ;this utility will allow the user to enter a date range to search
- +5 ;the orders file, 100, looking for orders with a specific nature
- +6 ;of order or status
- +7 ;
- +8 ;
- EN ;
- +1 SET U="^"
- KILL ^TMP("ORNS",$JOB),^TMP("ORSERV",$JOB)
- +2 WRITE @IOF,!!?18,"Nature of Order or Order Status Search.",!?15,"This report is formatted for 132 column output."
- +3 NEW DASH,DATE,DFN,DIR,DTOUT,DUOUT,EDATE,FORMAT,HDR,HDR1,IEN
- +4 NEW LOC,LONER,ORIGVIEW,PAGE,PNM,PROV,QUIT,REF,RPDT,SDATE,SER,SERVICE,STOP,TEXT,TEXTSUB
- +5 NEW SINGLE,SIGNED,SNAME,SSN,STATUS,SORT,SEARCH,SUB
- +6 NEW VA,VADM,WHEN,WHO,Y
- SORT SET DIR(0)="SX^1:Nature of order;2:Order Status"
- +1 SET DIR("A")="Enter the search criteria"
- +2 SET DIR("?")="Enter a 1 to search orders by the Nature of order or a 2 to search orders by the Order Status. Enter an ^ to exit the option."
- +3 DO ^DIR
- IF +Y>0
- SET SORT=+Y
- KILL DIR
- IF $DATA(DTOUT)!($DATA(DUOUT))
- GOTO EXIT
- +4 SET DIR(0)=$SELECT(SORT=1:"PA^100.02:AEMQ",SORT=2:"PA^100.01:AEMQ")
- +5 SET DIR("A")="Select "_$SELECT(SORT=1:"Nature of order: ",1:"Order Status: ")
- +6 DO ^DIR
- IF +Y>0
- SET SEARCH=+Y
- SET SNAME=$PIECE(Y,U,2)
- KILL DIR
- IF $DATA(DTOUT)!($DATA(DUOUT))
- GOTO EXIT
- +7 DO SDATE
- IF $DATA(DTOUT)!$DATA(DUOUT)
- GOTO EXIT
- +8 DO EDATE
- IF $DATA(DTOUT)!$DATA(DUOUT)
- GOTO EXIT
- +9 DO CKDATE
- IF $DATA(DTOUT)!$DATA(DUOUT)
- GOTO EXIT
- FORMAT ;allows choice of formats for evaluation purpose
- +1 SET DIR(0)="SX^1:Detailed format;2:Columnar format"
- +2 SET DIR("A")="Select output format"
- +3 SET DIR("?")="Enter a 1 for a Detailed format and a 2 for a Columnar format. Enter an ^ to exit the option."
- +4 DO ^DIR
- IF +Y>0
- SET FORMAT=+Y
- KILL DIR
- IF $DATA(DTOUT)!$DATA(DUOUT)
- GOTO EXIT
- SERV ;sets the variable SERVICE equal to 1 if the user wants to sort by
- +1 ;service, or sets it to 0 if not
- +2 IF FORMAT=2
- Begin DoDot:1
- +3 SET DIR(0)="Y"
- +4 SET DIR("A")="Would you like to sort the output by service"
- +5 SET DIR("?")="If you answer yes, the output will be sorted by service. Enter an ^ to exit the option."
- +6 SET DIR("B")="NO"
- +7 DO ^DIR
- SET SERVICE=+Y
- KILL DIR
- End DoDot:1
- IF $DATA(DTOUT)!($DATA(DUOUT))
- GOTO EXIT
- SINGLE ;sets variable SINGLE to set up a search of a single service
- +1 IF FORMAT=2&($GET(SERVICE))
- Begin DoDot:1
- +2 SET DIR(0)="Y"
- SET DIR("B")="NO"
- +3 SET DIR("A")="Would you like to search for specific SERVICE/SECTIONS"
- +4 SET DIR("?")="Enter a YES to search by a single SERVICE/SECTION. You may either press enter without selecting a SERVICE/SECTION or enter an ^ to exit the option,"
- +5 DO ^DIR
- IF +Y>0
- SET SINGLE=+Y
- KILL DIR
- End DoDot:1
- IF $DATA(DTOUT)!($DATA(DUOUT))
- GOTO EXIT
- LONER ;sets DIR call to allow the user to select a single service/section
- +1 IF FORMAT=2&($GET(SERVICE))&($GET(SINGLE))
- Begin DoDot:1
- +2 FOR
- Begin DoDot:2
- +3 SET DIR(0)="PAO^49:AEQM"
- +4 SET DIR("A")="Select Service/Section: "
- +5 DO ^DIR
- IF +Y>0
- SET LONER($PIECE(Y,U,2))=+Y
- KILL DIR
- IF $DATA(DTOUT)!($DATA(DUOUT))
- SET QUIT=1
- End DoDot:2
- IF $DATA(QUIT)!(Y=-1)
- QUIT
- End DoDot:1
- IF $DATA(QUIT)!('$DATA(LONER))
- GOTO EXIT
- TASK ;
- +1 SET %ZIS="Q"
- DO ^%ZIS
- IF POP
- QUIT
- +2 IF $DATA(IO("Q"))
- Begin DoDot:1
- +3 SET ZTIO=ION
- SET ZTDESC="File 100 order status search"
- +4 SET ZTRTN="EN^ORSNAST1"
- SET ZTSAVE("SORT")=""
- SET ZTSAVE("FORMAT")=""
- +5 SET ZTSAVE("SDATE")=""
- SET ZTSAVE("EDATE")=""
- SET ZTSAVE("SEARCH")=""
- +6 SET ZTSAVE("SNAME")=""
- SET ZTSAVE("SERVICE")=""
- SET ZTSAVE("SD1")=""
- +7 SET ZTSAVE("ED1")=""
- SET ZTSAVE("LONER*")=""
- SET ZTSAVE("SINGLE")=""
- +8 DO ^%ZTLOAD
- IF $DATA(ZTSK)
- WRITE !,?32,"REQUEST QUEUED"
- End DoDot:1
- KILL IO("Q")
- QUIT
- +9 USE IO
- DO EN^ORSNAST1
- +10 GOTO EXIT
- +11 ;
- SDATE ;sets DIR call to ask the user for a starting date
- +1 SET DIR(0)="DA^::ETX"
- +2 SET DIR("A")="Enter a starting date: "
- +3 SET DIR("?")="Enter the date that you wish to start searching with. This date needs to be older than the ending date. For example: If you enter a start date of T-3, the Stop date should be T-2 or less. Enter an ^ to exit the option."
- +4 DO ^DIR
- IF +Y>0
- SET SDATE=+Y
- KILL DIR
- IF $DATA(DTOUT)!($DATA(DUOUT))
- QUIT
- +5 IF SDATE'["."
- SET SDATE=SDATE_.0001
- +6 QUIT
- EDATE ;sets DIR call to ask the user for an ending date (optional)
- +1 SET DIR(0)="DA^::ETX"
- +2 SET DIR("A")="Enter a ending date: "
- +3 SET DIR("?")="Enter the date that you would like the search to end with. This date needs to be more recent than the start date. For example: If you entered a T-3 for the start date, enter a T-2 or less here. Enter an ^ to exit the option."
- +4 DO ^DIR
- IF +Y>0
- SET EDATE=+Y
- KILL DIR
- IF $DATA(DTOUT)!($DATA(DUOUT))
- QUIT
- +5 IF EDATE'["."
- SET EDATE=EDATE_.2359
- +6 QUIT
- CKDATE ; Make sure the end date is not older than the start date.
- +1 IF EDATE>SDATE
- QUIT
- +2 WRITE !!,?10,"The starting date must be older than the ending date.",!,?10,"Please re-enter start and end dates.",!!
- +3 DO SDATE
- IF $DATA(DTOUT)!$DATA(DUOUT)
- QUIT
- +4 DO EDATE
- IF $DATA(DTOUT)!$DATA(DUOUT)
- QUIT
- +5 GOTO CKDATE
- EXIT ;
- +1 KILL ^TMP("ORNS",$JOB),^TMP("ORSERV",$JOB)
- +2 DO ^%ZISC
- +3 QUIT