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

IBCOMD.m

Go to the documentation of this file.
  1. IBCOMD ;ALB/CMS - GENERATE INSURANCE COMPANY LISTINGS ;03-AUG-98
  1. ;;2.0;INTEGRATED BILLING;**103,528,732,743**;21-MAR-94;Build 18
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ; Reference to D EN^XUTMDEVQ in ICR #1519
  1. Q
  1. EN ; Entry point from option
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT
  1. ;IB*732/CKB - added IBDEF and STOP
  1. N IBAIB,IBCASE,IBDEF,IBF,IBFLD,IBOUT,IBQ,IBQUIT,IBTY,STOP,X,Y
  1. S STOP=0
  1. W !!,?10,"Generate Insurance Company Listings",!
  1. S DIR("A",1)="Sort report by"
  1. S DIR("A",2)="1 - Active Insurance Companies"
  1. S DIR("A",3)="2 - Inactive Insurance Companies"
  1. S DIR("A",4)="3 - Both"
  1. S DIR("A",5)=" "
  1. ;IB*732/CKB - allow selection to be case insensitive. If user enters
  1. ; '^', set STOP=1 to exit
  1. ;S DIR(0)="SAXB^1:Active;2:Inactive;3:Both"
  1. S DIR(0)="SA^1:Active;2:Inactive;3:Both"
  1. S DIR("A")=" Select Number: "
  1. S DIR("B")="1"
  1. S DIR("??")="^D ENH^IBCOMD"
  1. D ^DIR
  1. I $D(DIROUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT)!(+Y'>0) S STOP=1
  1. I Y="^" S STOP=1
  1. K DIR,DIROUT,DIRUT,DTOUT,DUOUT
  1. I STOP G EXIT
  1. S IBAIB=+Y
  1. ;
  1. W !!,"You may search for specific companies to be included in this report by"
  1. W !,"'screening' companies based on the company name, street, city, or state."
  1. W !,"You may select any combination of these fields and specify a 'range' of"
  1. W !,"values that the field must fall between, or a specific value that the"
  1. W !,"field must 'contain.'",!
  1. ;
  1. K IBFLD
  1. S STOP=0
  1. S IBFLD(1)="NAME",IBFLD(2)="STREET",IBFLD(3)="CITY",IBFLD(4)="STATE"
  1. K IBCASE S IBQ=0 F D Q:(IBQ)!(STOP=1) W !
  1. .;
  1. .; - ask for the field
  1. .S DIR("A",1)=" Select a"_$S($D(IBCASE):"nother",1:"")_" field to screen Insurance Companies"
  1. .S DIR("A",2)=" "
  1. .S DIR("A",3)=" 1 - NAME"
  1. .S DIR("A",4)=" 2 - STREET"
  1. .S DIR("A",5)=" 3 - CITY"
  1. .S DIR("A",6)=" 4 - STATE"
  1. .S DIR("A",7)=" "
  1. .;IB*732/CKB - allow selection to be case insensitive. If user enters
  1. .; '^', set STOP=1 to exit
  1. .;S DIR(0)="SAOXB^1:NAME;2:STREET;3:CITY;4:STATE"
  1. .S DIR(0)="SAO^1:NAME;2:STREET;3:CITY;4:STATE"
  1. .S DIR("A")=" Select a field by Number: "
  1. .S DIR("??")="^D FLD^IBCOMD"
  1. .D ^DIR
  1. .I $D(DIROUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT)!(+Y'>0) S IBQ=1
  1. .I Y="^" S STOP=1
  1. .K DIR,DIROUT,DIRUT,DTOUT,DUOUT
  1. .I IBQ Q
  1. .S IBF=+Y
  1. .;
  1. .; - if state was chosen, select a state and quit
  1. .I IBF=4 D Q
  1. ..S DIC="^DIC(5,",DIC(0)="QEAMZ",DIC("A")="Select STATE: "
  1. ..I $P($G(IBCASE(4)),"^",2) S DIC("B")=$P($G(^DIC(5,$P($G(IBCASE(4)),"^",2),0)),"^")
  1. ..;IB*732/CKB - if user enters '^', set STOP to exit
  1. ..D ^DIC K DIC
  1. ..I X="^" S STOP=1
  1. ..I (Y'>0)!(STOP=1) K IBCASE(4) Q
  1. ..S IBCASE(4)="^"_+Y
  1. .;
  1. .; - ask user to select values by 'range' or 'contains'
  1. .S DIR("A")="Allow a (R)ange of values or a value that (C)ontains a specific string: "
  1. .;IB*732/CKB - allow selection to case insensitive, properly display previous value
  1. .; and if user enters '^' set STOP to exit
  1. .;S DIR(0)="SAXB^R:RANGE;C:CONTAINS",DIR("??")="^D RAN^IBCOMD"
  1. .S DIR(0)="SA^R:RANGE;C:CONTAINS"
  1. .S DIR("?")="This response can be free text."
  1. .S DIR("??")="^D RAN^IBCOMD"
  1. .I $P($G(IBCASE(IBF)),"^")'="" S DIR("B")=$P($G(IBCASE(IBF)),"^")
  1. .D ^DIR
  1. .I $D(DIROUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT)!(Y="^") S STOP=1
  1. .K DIR,DIROUT,DTOUT,DUOUT,DIRUT
  1. .I Y'="R",Y'="C"!(STOP) K IBCASE(IBF) Q
  1. .S IBTY=Y
  1. .;
  1. .; - ask user to select value that 'contains'
  1. .;IB*732/CKB - allow selection to case insensitive and properly display previous
  1. .;value. If user enters '^' set STOP to exit
  1. .I IBTY="C" D Q
  1. ..S IBDEF=$P($G(IBCASE(IBF)),"^",2)
  1. ..S DIR(0)="FAO"
  1. ..S DIR("A")=IBFLD(IBF)_" contains the value: "
  1. ..I $P($G(IBCASE(IBF)),"^",2)'="" S DIR("B")=$P($G(IBCASE(IBF)),"^",2)
  1. ..S DIR("?")="This response can be free text."
  1. ..S DIR("??")="^D CON^IBCOMD"
  1. ..D ^DIR K DIR
  1. ..I Y="^" S STOP=1
  1. ..I $D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT)!(STOP) K IBCASE(IBF),DIROUT,DTOUT,DUOUT,DIRUT Q
  1. ..I Y="" W !!,?5,"Note: Companies will be selected where ",IBFLD(IBF)," is null."
  1. ..S IBCASE(IBF)=IBTY_"^"_Y
  1. .;
  1. .; - ask user to select a range of values
  1. .D SELR
  1. ;
  1. ;IB*732/CKB - user entered '^', go to exit and quit
  1. I (Y="^")!(STOP=1) G EXIT
  1. ;
  1. I '$D(IBCASE) W !!,"Please note that no screening fields were selected!",!
  1. ;IB*732/CKB - call DISPLAY tag to display the selected screening fields
  1. I $D(IBCASE) D DISPLAY W !
  1. ;E D W !
  1. ;.N I,H
  1. ;.W !!,"The following conditions were selected:"
  1. ;.S (H,I)=0 F S I=$O(IBCASE(I)) Q:'I D
  1. ;..W ! I H W ?3,"and"
  1. ;..S H=1 W ?8,IBFLD(I)
  1. ;..W ?18,$S(I=4:"Equals ",$P(IBCASE(I),"^")="C":"Contains ",1:"Between ")
  1. ;..W $S(I=4:$P($G(^DIC(5,+$P(IBCASE(I),"^",2),0)),"^"),$P(IBCASE(I),"^",2)="":"'FIRST'",1:$P(IBCASE(I),"^",2))
  1. ;..I $P(IBCASE(I),"^")="R" W " and ",$S($P(IBCASE(I),"^",3)="zzzzzz":"'LAST'",1:$P(IBCASE(I),"^",3))
  1. ;
  1. S IBOUT=$$OUT G:IBOUT="" EXIT
  1. ;
  1. D QUE
  1. ;
  1. EXIT ;
  1. Q
  1. ;
  1. ;
  1. SELR ; Select a range of values
  1. ;IB*732/CKB - made code easier to read and if user enters '^', set STOP to exit
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,IBRF,IBRL,X,Y
  1. SELRR ;
  1. ;IB*743/TAZ - Updated code to accept NULL to mean beginning of list.
  1. W !!,"Enter Start With value or Press <ENTER> to start at the beginning of the list.",!
  1. S DIR(0)="FO"
  1. S DIR("A")="START WITH '"_IBFLD(IBF)_"' VALUE"
  1. I $P($G(IBCASE(IBF)),"^",2)'="" S DIR("B")=$P($G(IBCASE(IBF)),"^",2)
  1. S DIR("?")="^D RANGE^IBCOMD(""BEGIN"")"
  1. D ^DIR K DIR
  1. I $D(DTOUT)!$D(DUOUT)!$D(DIROUT)!(Y="^") S STOP=1 K IBCASE(IBF) Q
  1. S IBRF=Y
  1. ;
  1. ;IB*743/TAZ - Updated code to accept NULL to mean end of list.
  1. W !!,"Enter Go To value or Press <ENTER> to finish at the end of the list.",!
  1. S DIR(0)="FO"
  1. S DIR("A")="GO TO '"_IBFLD(IBF)_"' VALUE"
  1. ; IB*743/DTG do not dispay 'zzzzzz' on edit
  1. I ($P($G(IBCASE(IBF)),"^",3)'="")&($P($G(IBCASE(IBF)),"^",3)'="zzzzzz") S DIR("B")=$P($G(IBCASE(IBF)),"^",3)
  1. S DIR("?")="^D RANGE^IBCOMD(""END"")"
  1. D ^DIR K DIR
  1. I $D(DTOUT)!$D(DUOUT)!$D(DIROUT)!(Y="^") S STOP=1 K IBCASE(IBF) Q
  1. S IBRL=$S(Y="":"zzzzzz",1:Y)
  1. ;
  1. ; - the 'go to' value must follow the 'start with' value
  1. ;IB*732/CKB - make selection case insensitive
  1. I $$UP^XLFSTR($G(IBRL))']$$UP^XLFSTR($G(IBRF)) D G SELRR
  1. . W !!,?5,">>>>> The 'Go To' value must follow after the 'Start With' value. <<<<<",!
  1. S IBCASE(IBF)="R^"_IBRF_"^"_IBRL
  1. Q
  1. ;
  1. DISPLAY ;IB*732/CKB - Display the selected screening conditions
  1. N I,H
  1. W !!,"The following conditions were selected:"
  1. S (H,I)=0 F S I=$O(IBCASE(I)) Q:'I D
  1. .W ! I H W ?3,"and"
  1. .S H=1 W ?8,IBFLD(I)
  1. .W ?18,$S(I=4:"Equals ",$P(IBCASE(I),"^")="C":"Contains ",1:"Between ")
  1. .W $S(I=4:$P($G(^DIC(5,+$P(IBCASE(I),"^",2),0)),"^"),$P(IBCASE(I),"^",2)="":"'FIRST'",1:$P(IBCASE(I),"^",2))
  1. .I $P(IBCASE(I),"^")="R" W " and ",$S($P(IBCASE(I),"^",3)="zzzzzz":"'LAST'",1:$P(IBCASE(I),"^",3))
  1. Q
  1. ;
  1. ENH ; Active, Inactive or Both help Text
  1. W !!,?5,"Enter 1 to search Active Insurance Companies"
  1. W !,?5,"Enter 2 to search Inactive Insurance Companies"
  1. W !,?5,"Enter 3 to include Active and Inactive Insurance Companies in Report",!
  1. Q
  1. ;
  1. FLD ;Field selection help text
  1. W !!,?5,"Enter 1 to screen insurance company by Name"
  1. W !,?5,"Enter 2 to screen insurance company by Street"
  1. W !,?5,"Enter 3 to screen insurance company by City"
  1. W !,?5,"Enter 4 to screen insurance company by State"
  1. Q
  1. ;
  1. RAN ; Help for the Range/Contains prompt.
  1. W !!,?5,"Enter 'R' to enter a 'Start From' and 'Go To' range, or 'C' to enter"
  1. W !,?5,"a specific string that the field value must contain. Enter '^' to"
  1. W !,?5,"eliminate this screen field and select another field."
  1. Q
  1. ;
  1. CON ; Help for the 'Contains' prompt.
  1. W !!,?5,"Enter a string that the field value should contain. Enter a <CR> to"
  1. W !,?5,"find entries where the field value is null. Enter '^' to eliminate"
  1. W !,?5,"this screen field and select another field."
  1. Q
  1. ;
  1. ;IB*743/TAZ - Help for the Range Prompt
  1. RANGE(LEVEL) ; ?? Help for the Range Prompt
  1. W !!,?5,"Enter a value the entries in the list should ",LEVEL," with."
  1. I LEVEL="BEGIN" W !,?5,"Press <ENTER> to start at the beginning of the list."
  1. I LEVEL="END" W !,?5,"Press <ENTER> to finish at the end of the list."
  1. Q
  1. ;
  1. QUE ; Ask Device
  1. ;IB*732/CKB - Modified to allow Queuing of the report, and added Excel
  1. ; warning to prevent wrapping
  1. N ZTDESC,ZTRTN,ZTSAVE
  1. ;
  1. I IBOUT="E" D
  1. . W !!,"For CSV output, turn logging or capture on now. To avoid undesired wrapping"
  1. . W !,"of the data saved to the file, please enter ""0;256;99999"" at the ""DEVICE:"""
  1. . W !,"prompt.",!
  1. ;
  1. S ZTRTN="BEG^IBCOMD1"
  1. S ZTSAVE("IBAIB")="",ZTSAVE("IBFLD(")="",ZTSAVE("IBOUT")=""
  1. I $D(IBCASE) S ZTSAVE("IBCASE(")=""
  1. S ZTDESC="IB - Identify Dup Insurance Companies"
  1. D EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE,"Q") ; ICR #1519
  1. QUEQ ;
  1. Q
  1. ;
  1. OUT() ;
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !
  1. S DIR(0)="SA^E:Excel;R:Report"
  1. S DIR("A")="(E)xcel Format or (R)eport Format: "
  1. S DIR("B")="Report"
  1. D ^DIR I $D(DIRUT) Q ""
  1. Q Y