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

AQAOEDTS.m

Go to the documentation of this file.
  1. AQAOEDTS ; IHS/ORDC/LJF - MULTIPLE FIELDS EDITS ;
  1. ;;1.01;QAI MANAGEMENT;;OCT 05, 1995
  1. ;
  1. ;This rtn is called by various data entry rtns to handle file-driven
  1. ;user interface for the section defined before this call.
  1. ;
  1. OPT ; >>> get data entry option from review type
  1. Q:'$D(^AQAQX(AQAOPT,0)) ;bad pointer in review type file
  1. ;
  1. ; >>> for each review, choose multiples to enter/edit
  1. LOOP ; >>> find all screens available to work on & put in proper order
  1. S AQAOSC=0 ;screen's entry # in multiple
  1. F S AQAOSC=$O(^AQAQX(AQAOPT,"PG","B",AQAOSC)) Q:AQAOSC="" D
  1. .S AQAOSN=0 ;screen's order #
  1. .F S AQAOSN=$O(^AQAQX(AQAOPT,"PG","B",AQAOSC,AQAOSN)) Q:AQAOSN="" D
  1. ..Q:'$D(^AQAQX(AQAOPT,"PG",AQAOSN,0))
  1. ..S AQAOPTL=$P(^AQAQX(AQAOPT,"PG",AQAOSN,0),U,3) ;screen title
  1. ..S AQAOP(AQAOSC)=AQAOPTL_U_AQAOSN ;array with screens in order
  1. ..Q
  1. ;
  1. ; >>> loop thru array for each screen and allow user to edit
  1. S AQAOSC=0,X="" K DUOUT ;PATCH 3
  1. F S AQAOSC=$O(AQAOP(AQAOSC)) Q:AQAOSC="" Q:$D(DUOUT) Q:X=U D
  1. .S AQAOPTL=$P(AQAOP(AQAOSC),U),AQAOSN=$P(AQAOP(AQAOSC),U,2)
  1. .K DIR S Y=$P(^AQAQX(AQAOPT,"PG",AQAOSN,0),U,2)
  1. .S C=$P(^DD(9002166.11,.02,0),U,2) D Y^DIQ S DIR("A")=Y
  1. .;
  1. .; >>> display items and ask user for choice, and then edit via ^die
  1. .S AQAOSTR=$G(^AQAQX(AQAOPT,"PG",AQAOSN,1))
  1. .I ($P(AQAOSTR,U)'="") D MULTFIND Q ;multiple entries in linked file
  1. .D ITEMFIND Q ;multiple fields in occ file
  1. ;
  1. END Q
  1. ;
  1. ;
  1. ITEMFIND ; >> SUBRTN to find each items on screen and display them by number<<
  1. ;
  1. ; >>> find items for this screen
  1. K AQAOA S AQAOTM=0 W !!!,"<<",AQAOPTL,">>",!
  1. F S AQAOTM=$O(^AQAQX(AQAOPT,"PG",AQAOSN,"IT","B",AQAOTM)) Q:AQAOTM'=+AQAOTM D
  1. .S AQAOTMN=0
  1. .F S AQAOTMN=$O(^AQAQX(AQAOPT,"PG",AQAOSN,"IT","B",AQAOTM,AQAOTMN)) Q:AQAOTMN="" D
  1. ..Q:'$D(^AQAQX(AQAOPT,"PG",AQAOSN,"IT",AQAOTMN,0)) S AQAOMFL=^(0)
  1. ..;
  1. ..; >>> print items in order with contents and save field # in array
  1. ..S AQAOFLD=$P(AQAOMFL,U,2)
  1. ..W !,$J(+AQAOMFL,2),") ",$P(^DD(9002167,AQAOFLD,0),U) ;# & descrpt
  1. ..K ^UTILITY("DIQ1",$J) K DIQ,DR
  1. ..S (DIC,AQAOFL)=9002167,DA=AQAOIFN,DR=AQAOFLD D EN^DIQ1
  1. ..I $D(^UTILITY("DIQ1",$J,AQAOFL,DA,AQAOFLD)) W ?45,^(AQAOFLD)
  1. ..K ^UTILITY("DIQ1",$J)
  1. ..S AQAOA(+AQAOMFL)=AQAOFLD ;set array with # and field
  1. ;
  1. ; >>> choose items to edit and edit via ^die
  1. S (AQAOTM,AQAOXX)=0 W !
  1. F S AQAOXX=$O(AQAOA(AQAOXX)) Q:AQAOXX="" S AQAOTM=AQAOXX
  1. S DIR("?")="Choose option from list above"
  1. S DIR(0)="LO^0:"_AQAOTM_"^K:X#1 X" D ^DIR Q:$D(DIRUT) Q:Y=-1 S DR=""
  1. I +Y=0 F S X=$O(AQAOA(X)) Q:X="" D ;user chose all
  1. .I AQAOA(X)[U S DR(2,$P(AQAOA(X),U,2))=$P(AQAOA(X),U,3)
  1. .S DR=DR_";"_$P(AQAOA(X),U)
  1. E F S X=$P(Y,",") Q:X="" D ;user chose range by number
  1. .I AQAOA(X)[U S DR(2,$P(AQAOA(X),U,3))=$P(AQAOA(X),U,2)
  1. .S X=$P(AQAOA(X),U),DR=DR_";"_X
  1. .S Y=$P(Y,",",2,99)
  1. I DR?1";".E S DR=$E(DR,2,99)
  1. K DIE S DIE=9002167,DA=AQAOIFN D ^DIE
  1. ;
  1. S AQAODIR=DIR("A") K DIR S DIR(0)="Y",DIR("B")="NO"
  1. S DIR("A")="Do you wish to EDIT this category again" D ^DIR K DIR
  1. I Y=1 S AQAOTM=0,DIR("A")=AQAODIR K AQAODIR W !! G ITEMFIND
  1. Q
  1. ; >>end of ITEMFIND subrtn<<
  1. ;
  1. ;
  1. ;
  1. MULTFIND ; >>SUBRTN to display multiple entries in linked files<<
  1. ; >>> set variables about linked file
  1. S AQAOFL=$P(AQAOSTR,U),AQAOFLD=$P(AQAOSTR,U,2) ;file#, fields to edit
  1. S AQAOGBL=^DIC(AQAOFL,0,"GL") ;global node for file
  1. S AQAOXX=0,AQAOXY=AQAOGBL_"""AB"",AQAOIFN,AQAOXX)" ;set global xref
  1. ;
  1. S AQAOQUIT=0 W !!!,"<<",AQAOPTL,">>",! ;print screen heading
  1. S X=$G(^AQAQX(AQAOPT,"PG",AQAOSN,2)) I X]"" X X ;special rtn for screen
  1. I AQAOQUIT=1 Q ;special rtn found cause to quit edit of this screen
  1. ;
  1. ; >>> loop thru entries in linked file and display them by #
  1. S (AQAOXX,AQAOCNT)=0
  1. F S AQAOXX=$O(@AQAOXY) Q:AQAOXX'=+AQAOXX D
  1. .S AQAOTM=$P(@(AQAOGBL_"AQAOXX,0)"),U) ;.01 field of linked file
  1. .S AQAOCNT=AQAOCNT+1,AQAOA(AQAOCNT)=AQAOXX
  1. .S Y=AQAOTM,C=$P(^DD(AQAOFL,.01,0),U,2) D Y^DIQ
  1. .W !,AQAOCNT,") ",Y
  1. .S X=$G(^AQAQX(AQAOPT,"PG",AQAOSN,4)) I X["" X X ;identifier code
  1. .Q
  1. ;
  1. ; >>> last number is choice to add new entry
  1. I AQAOCNT=0 D ADD G MULTFIND:$O(@AQAOXY) Q
  1. S AQAOCNT=AQAOCNT+1 W !,AQAOCNT,") ADD NEW ENTRY"
  1. ;
  1. CHOOSE ; >>> choose item(s) to edit
  1. W ! S DIR(0)="NO^1:"_AQAOCNT,DIR("?")="Choose from list above"
  1. D ^DIR Q:X="" Q:$D(DIRUT) G CHOOSE:Y=-1
  1. I (+Y=AQAOCNT) D ADD G MULTFIND
  1. E S DA=AQAOA(+Y) D EDIT G MULTFIND
  1. ;
  1. ADD ;add new entry to subfile or edit entries already there
  1. K DIC S DIE="^AQAOC(",DLAYGO=AQAOFL,DA=AQAOIFN
  1. S DR=AQAOFLD_" ADD]" D ^DIE W ! Q
  1. ;
  1. EDIT ; >>> edit entries
  1. K DIC,DIE S DIE=AQAOGBL,DIDEL=AQAOFL
  1. S DR=AQAOFLD_" EDIT]" D ^DIE W ! Q
  1. ;
  1. ; >>end of MULTFIND subrtn<<