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

BNIG.m

Go to the documentation of this file.
  1. BNIG ; IHS/CMI/LAB - group entry for bni ;
  1. ;;1.0;BNI CPHD ACTIVITY DATASYSTEM;;DEC 20, 2006
  1. ;; ;
  1. START ; Write Header
  1. D EOJ ; -- kill all vars before starting
  1. W:$D(IOF) @IOF
  1. F J=1:1:13 S X=$P($T(TEXT+J),";;",2) W !?80-$L(X)\2,X
  1. K X,J
  1. START1 ;
  1. I '$O(^BNISITE(0)) W !!,"Site parameters have not been set up. Please see the system manager." D PAUSE,EOJ Q
  1. W !!
  1. D GETSITE
  1. I BNISITE="" D EOJ Q
  1. D ADDQ
  1. I BNIADDQ="" G START1
  1. AGR ;
  1. D FULL^VALM1
  1. W !!
  1. MNTH ;
  1. S (BNIMNTH,BNIDATE,BNIYR)="" ;,DIR(0)="DO^:"_DT_":EPTX",DIR("A")="Enter Date of Activity" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. S DIR(0)="S^1:JANUARY;2:FEBRUARY;3:MARCH;4:APRIL;5:MAY;6:JUNE;7:JULY;8:AUGUST;9:SEPTEMBER;10:OCTOBER;11:NOVEMBER;12:DECEMBER",DIR("A")="Enter the MONTH the activity took place" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) D PAUSE G EOJ
  1. S BNIMNTH=Y I $L(BNIMNTH)=1 S BNIMNTH="0"_BNIMNTH
  1. YR ;
  1. S BNIYR=""
  1. S (BNIPER,BNIVDT)=""
  1. K DIR S DIR(0)="D^::EP",DIR("B")=$$FMTE^XLFDT(($E(DT,1,3)_"0000"))
  1. S DIR("A")="Enter Year"
  1. S DIR("?")="Enter the year the activity took place. E.g. 2006 or 06"
  1. D ^DIR KILL DIR
  1. I $D(DIRUT) D PAUSE G MNTH
  1. I $E(Y,4,7)'="0000" W !!,"Please enter a year only!",! G YR
  1. S BNIYR=Y
  1. S BNIDATE=BNIYR,$E(BNIDATE,4,5)=BNIMNTH
  1. I BNIDATE>DT W !!,"Future dates are not allowed!",! G MNTH
  1. ;
  1. ADDR ;
  1. K DIC S DIC(0)="EL",DIC="^BNIGROUP(",DLAYGO=90510.5,DIADD=1,X=BNIDATE
  1. S DIC("DR")=".02////"_DT_";.03////"_DUZ_";.06////"_DUZ(2)_";.07////"_DUZ(2)
  1. K DD,DO,D0 D FILE^DICN K DIC,DR,DIE,DIADD,DLAYGO,X,D0
  1. I Y=-1 W !!,$C(7),$C(7),"CPHAD Group Record is NOT complete!! Deleting Record.",! D PAUSE,EOJ Q
  1. ;update multiple of user last update/date edited
  1. S BNIGR=+Y
  1. ADDR1 ;
  1. S DA=BNIGR,DDSFILE=90510.5,DR=$S($G(BNIADDQ):"[BNIA GROUP ENTRY]",1:"[BNI GROUP ENTRY]") D ^DDS
  1. I $D(DIMSG) W !!,"ERROR IN SCREENMAN FORM!! ***NOTIFY PROGRAMMER***" D PAUSE,EOJ Q
  1. ;check record for completeness
  1. D CHECKREC
  1. I Q D G:BNIA="E" ADDR1 D DELR,PAUSE,EOJ Q
  1. .S BNIA="" K DIR
  1. .S DIR(0)="S^E:Edit and complete the Group Record;D:Delete the Incomplete Group Record",DIR("A")="Do you wish to",DIR("B")="E" KILL DA D ^DIR KILL DIR
  1. .I $D(DIRUT) S BNIA="D"
  1. .S BNIA=Y
  1. GROUP ;
  1. W !!,"I will now create an individual activity record for the following:"
  1. S X=0 F S X=$O(^BNIGROUP(BNIGR,16,X)) Q:X'=+X W !?5,$P(^VA(200,$P(^BNIGROUP(BNIGR,16,X,0),U),0),U)
  1. S DIR(0)="Y",DIR("A")="Do you wish to continue",DIR("B")="Y" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) W !!,"No records created." D PAUSE,EOJ Q
  1. S BNIX=0 F S BNIX=$O(^BNIGROUP(BNIGR,16,BNIX)) Q:BNIX'=+BNIX D
  1. .S BNIPRV=$P(^BNIGROUP(BNIGR,16,BNIX,0),U)
  1. .W !,"Creating record for ",$P(^VA(200,BNIPRV,0),U)
  1. .K DIC S DIC(0)="EL",DIC="^BNIREC(",DLAYGO=90510,DIADD=1,X=BNIDATE
  1. .S DIC("DR")=".02////"_DT_";.03////"_DUZ_";.06////"_DUZ(2)_";.08////"_BNIPRV
  1. .K DD,DO,D0 D FILE^DICN K DIC,DR,DIE,DIADD,DLAYGO,X,D0
  1. .I Y=-1 W !!,$C(7),$C(7),"Creating record for ",$P(^VA(200,BNIPRV,0),U)," failed!! Deleting Record.",! D PAUSE,EOJ Q
  1. .;update multiple of user last update/date edited
  1. .S BNIR=+Y
  1. .S DIE="^BNIREC(",DA=BNIR,DR="1500///NOW",DR(2,90510.0115)=".02////^S X=DUZ" D ^DIE K DIE,DA,DR
  1. .F BNIZ=7,9,11:1:18 S $P(^BNIREC(BNIR,0),U,BNIZ)=$P(^BNIGROUP(BNIGR,0),U,BNIZ)
  1. .F BNIZ=1,2 I $P($G(^BNIGROUP(BNIGR,11)),U,BNIZ)]"" S $P(^BNIREC(BNIR,11),U,BNIZ)=$P(^BNIGROUP(BNIGR,0),U,BNIZ)
  1. .F BNIZ=1 I $P($G(^BNIGROUP(BNIGR,12)),U,BNIZ)]"" S $P(^BNIREC(BNIR,12),U,BNIZ)=$P(^BNIGROUP(BNIGR,12),U,BNIZ)
  1. .S BNIW=0 F S BNIW=$O(^BNIGROUP(BNIGR,14,BNIW)) Q:BNIW'=+BNIW D
  1. ..S ^BNIREC(BNIR,14,BNIW,0)=^BNIGROUP(BNIGR,14,BNIW,0)
  1. ..S ^BNIREC(BNIR,14,0)="^^"_BNIW_"^"_BNIW_"^"_DT_"^"
  1. .S DA=BNIR,DIK="^BNIREC(" D IX1^DIK
  1. W !,"Records created."
  1. D PAUSE
  1. D EOJ
  1. Q
  1. ;
  1. EOJ ;EOJ CLEANUP
  1. D CLEAR^VALM1
  1. D EN^XBVK("BNI")
  1. Q
  1. GETSITE ;
  1. S BNISITE=""
  1. W ! K DIC S DIC="^BNISITE(",DIC("A")="Enter your Site: ",DIC("B")=$P(^DIC(4,DUZ(2),0),U),DIC(0)="AEMQ" D ^DIC K DIC
  1. I Y=-1 Q
  1. S BNISITE=+Y
  1. Q
  1. ADDQ ;
  1. S BNIADDQ=""
  1. W !
  1. K DIR
  1. S DIR(0)="Y",DIR("A")="Do you want to be prompted for Travel Time and Number Served",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) Q
  1. S BNIADDQ=Y
  1. Q
  1. DATE(D) ;
  1. Q $E(D,4,5)_"/"_$E(D,6,7)_"/"_$E(D,2,3)
  1. ;
  1. ;
  1. TEXT ;
  1. ;;Computerized Public Health Activity (CPHAD) Group Data Entry
  1. ;;
  1. ;;***************************************
  1. ;;* Update CPHAD Group Activity Records *
  1. ;;***************************************
  1. ;;
  1. ;;This option is used to enter a GROUP Activity Record.
  1. ;;You will be asked to enter all information about the activity
  1. ;;including all persons who participated in the activity.
  1. ;;When all information is entered a public health activity record
  1. ;;will be generated for each person who participated in the
  1. ;;group activity.
  1. ;;
  1. Q
  1. SHT(G) ;EP - called from screenman screen
  1. I $G(G)="" Q ""
  1. NEW X
  1. S X=$O(^BNISHT("AA",G,1,0))
  1. I X,$D(^BNISHT(X,0)) Q $P(^BNISHT(X,0),U,1)
  1. Q ""
  1. GHCPOST ;EP - called from screenman
  1. D REQ^DDSUTL(4,2,1,$S('$G(X):0,$P(^BNIGHC(X,0),U,3)=1:1,1:0)) ;require other if Other
  1. I 'X D PUT^DDSVAL(DIE,.DA,1101,"") ;empty out 1101 if not Other
  1. I X,'$P(^BNIGHC(X,0),U,3) D PUT^DDSVAL(DIE,.DA,1101,"")
  1. D UNED^DDSUTL(4,2,1,$S('$G(X):1,$P(^BNIGHC(X,0),U,3)=1:0,1:1)) ;don't allow field 7 if not other
  1. S BNISMGNC=X
  1. NEW Z
  1. S Z=$$GET^DDSVAL(DIE,.DA,.12)
  1. I Z="" D PUT^DDSVAL(DIE,.DA,.12,$$SHT(BNISMGNC))
  1. I Z]"" D
  1. .Q:$P(^BNISHT(Z,0),U,3)=BNISMGNC
  1. .D PUT^DDSVAL(DIE,.DA,.12,$$SHT(BNISMGNC))
  1. .Q
  1. D REFRESH^DDSUTL
  1. Q
  1. SHTPOST ;EP - called from screenman
  1. D REQ^DDSUTL(6,2,1,$S('$G(X):0,$P(^BNISHT(X,0),U,5)=1:1,1:0)) ;require other if Other
  1. I 'X D PUT^DDSVAL(DIE,.DA,1102,"") ;empty out 1101 if not Other
  1. I X,'$P(^BNISHT(X,0),U,5) D PUT^DDSVAL(DIE,.DA,1102,"")
  1. D UNED^DDSUTL(6,2,1,$S('$G(X):1,$P(^BNISHT(X,0),U,5)=1:0,1:1)) ;don't allow field 8 if not other
  1. D REFRESH^DDSUTL
  1. Q
  1. TOAPOST ;EP - called from screenman
  1. D REQ^DDSUTL(8,2,1,$S('$G(X):0,$P(^BNITOA(X,0),U,3)=1:1,1:0)) ;require other if Other
  1. I 'X D PUT^DDSVAL(DIE,.DA,1103,"") ;empty out 1101 if not Other
  1. I X,'$P(^BNITOA(X,0),U,3) D PUT^DDSVAL(DIE,.DA,1103,"")
  1. D UNED^DDSUTL(8,2,1,$S('$G(X):1,$P(^BNITOA(X,0),U,3)=1:0,1:1)) ;don't allow field 8 if not other
  1. D REFRESH^DDSUTL
  1. Q
  1. GSPOST ;EP - called from screenman
  1. D REQ^DDSUTL(10,2,1,$S('$G(X):0,$P(^BNIGS(X,0),U,3)=1:1,1:0)) ;require other if Other
  1. I 'X D PUT^DDSVAL(DIE,.DA,1104,"") ;empty out 1101 if not Other
  1. I X,'$P(^BNIGS(X,0),U,3) D PUT^DDSVAL(DIE,.DA,1104,"")
  1. D UNED^DDSUTL(10,2,1,$S('$G(X):1,$P(^BNIGS(X,0),U,3)=1:0,1:1)) ;don't allow field 10 if not other
  1. D REFRESH^DDSUTL
  1. Q
  1. ASPOST ;EP - called from screenman
  1. D REQ^DDSUTL(12,2,1,$S('$G(X):0,$P(^BNIAS(X,0),U,3)=1:1,1:0)) ;require other if Other
  1. I 'X D PUT^DDSVAL(DIE,.DA,.16,"") ;empty out 1101 if not Other
  1. I X,'$P(^BNIAS(X,0),U,3) D PUT^DDSVAL(DIE,.DA,.16,"")
  1. D UNED^DDSUTL(12,2,1,$S('$G(X):1,$P(^BNIAS(X,0),U,3)=1:0,1:1)) ;don't allow field 12 if not other
  1. D REFRESH^DDSUTL
  1. Q
  1. SHTSCR(I) ;EP - called from screen on dd 90510 FIELD .12
  1. I '$G(BNISMGNC) Q 1
  1. I $P(^BNISHT(I,0),U,3)'=BNISMGNC Q 0
  1. Q 1
  1. COMM(I) ;EP - called from screen on dd 90510 field .16
  1. I '$G(BNISITE) Q 1
  1. NEW Z,C
  1. S Z=$P($G(^BNISITE(BNISITE,0)),U,3)
  1. I 'Z Q 1
  1. S C=$P(^AUTTCOM(Y,0),U)
  1. I '$D(^ATXAX(Z,0)) Q 1
  1. I '$D(^ATXAX(Z,21,"B",C)) Q 0
  1. Q 1
  1. CHECKREC ;
  1. S Q="" F F=.07,.09,.11,.12,.13 I $P(^BNIGROUP(BNIGR,0),U,+$P(F,".",2))="" D
  1. .W !,$P(^DD(90510,F,0),U)," is a required field and is missing." S Q=1
  1. I $P($G(^BNISITE(BNISITE,0)),U,2),$P(^BNIGROUP(BNIGR,0),U,15)="" D
  1. .W !,"ACTIVITY SETTING is required and is missing." S Q=1
  1. S X=$P(^BNIGROUP(BNIGR,0),U,11) I X,$P(^BNIGHC(X,0),U,3),$P($G(^BNIGROUP(BNIGR,11)),U,1)="" D
  1. .W !,"GENERAL HEALTH CONCERN is ",$P(^BNIGHC(X,0),U),!," and the text of GENERAL HEALTH CONCERN (OTHER) is missing." S Q=1
  1. S X=$P(^BNIGROUP(BNIGR,0),U,12) I X,$P(^BNISHT(X,0),U,5),$P($G(^BNIGROUP(BNIGR,11)),U,2)="" D
  1. .W !,"SPECIFIC HEALTH TOPIC is ",$P(^BNISHT(X,0),U),!," and the text of SPECIFIC HEALTH TOPIC (OTHER) is missing." S Q=1
  1. S X=$P(^BNIGROUP(BNIGR,0),U,13) I X,$P(^BNITOA(X,0),U,3),$P($G(^BNIGROUP(BNIGR,11)),U,3)="" D
  1. .W !,"TYPE OF ACTIVITY is ",$P(^BNITOA(X,0),U),!," and the text of TYPE OF ACTIVITY (OTHER) is missing." S Q=1
  1. S X=$P(^BNIGROUP(BNIGR,0),U,14) I X,$P(^BNIGS(X,0),U,3),$P($G(^BNIGROUP(BNIGR,12)),U,1)="" D
  1. .W !,"GROUP SERVED is ",$P(^BNIGS(X,0),U),!," and the text of GROUP SERVED (OTHER) is missing." S Q=1
  1. S X=$P(^BNIGROUP(BNIGR,0),U,15) I X,$P(^BNIAS(X,0),U,3),$P($G(^BNIGROUP(BNIGR,0)),U,16)="" D
  1. .W !,"ACTIVITY SETTING is ",$P(^BNIAS(X,0),U),!," and the COMMUNITY is missing." S Q=1
  1. I '$O(^BNIGROUP(BNIGR,16,0)) W !!,"You must enter at least one participating individual." S Q=1
  1. Q
  1. DELR ;
  1. S DA=BNIGR,DIK="^BNIGROUP(" D ^DIK K DIK,DA
  1. Q
  1. PAUSE ;EP
  1. S DIR(0)="EO",DIR("A")="Press enter to continue...." D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. Q