AMQQQ2 ; IHS/CMI/THL - COMPILES SCRIPT QUERIES ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
;-----
RUN D SUBJ
EN1 ; ENTRY POINT FROM NATURAL LANGUAGE INTERFACE
F AMQQYYAT=0:0 S AMQQYYAT=$O(AMQQXX(AMQQYYAT)) Q:'AMQQYYAT D ATT
EXIT K X,AMQQYYYY,AMQQYYCC,AMQQYYAA,AMQQNSUB,%
Q
;
SUBJ S Y=AMQQXX(0)
I Y?1"`"1.N S Y="^DPT(^"_$E(Y,2,9)_U_$P(^DPT($E(Y,2,9),0),U) D PERSON^AMQQ1
Q
;
ATT I $D(AMQQXX(AMQQYYAT,2)) D OR Q
S (%,AMQQYYYY)=AMQQXX(AMQQYYAT,1)
I $E($P(%,";",2))="M" S AMQQCTXS=1,AMQQXXND="AMQQXX("_AMQQYYAT_",1)" D MULT G ASET
A1 S (Y,AMQQYYAA)=$P(%,";")
S AMQQYYCC=$P(%,";",2)
S AMQQCOMP=$P(%,";",3,4)
I AMQQYYCC="TAX" D TAX G ASET
D EN1^AMQQATA
I $D(AMQQONE) D ^AMQQAC Q
I AMQQYYCC'="" S Y=AMQQYYCC D EN1^AMQQAC
I +$G(AMQQYYAA)=112 D ^AMQQAC,^AMQQAV
ASET D SET^AMQQAT
D EXIT^AMQQAT
D ^AMQQATR
D ^AMQQATS
S AMQQUATN=AMQQUATN+1
S:'$D(AMQQNULL) AMQQUNBC=AMQQUNBC+1
K AMQQNULL
Q
;
TAX S %=^AMQQ(5,+Y,0)
S AMQQATNM=$P(Y,U,2)
S AMQQLINK=$P(%,U,5)
S AMQQATN=+Y
S AMQQSBCT=$P(%,U,20)
I $G(AMQQSBCT)="" S AMQQSBCT=$P(^AMQQ(1,AMQQLINK,0),U,5)
S %=^AMQQ(1,AMQQLINK,0)
S AMQQCTXS=$P(%,U,7)
S AMQQVCL=$P(%,U,6)
S AMQQFTYP=$P(^AMQQ(4,$P(%,U,5),0),U)
S AMQQTAX=AMQQCOMP
S AMQQCOMP=";;;"_AMQQCOMP
K AMQQCOND
Q
;
OR S AMQQCOND=265
S AMQQSYMB="="
S AMQQKGNO=$G(AMQQKGNO)+1
S AMQQKONG=""
F AMQQYYON=0:0 S AMQQYYON=$O(AMQQXX(AMQQYYAT,AMQQYYON)) Q:'AMQQYYON S (AMQQYYYY,%)=AMQQXX(AMQQYYAT,AMQQYYON) D A1
K AMQQYYON,AMQQKONG
Q
;
MULT ; ENTRY POINT FROM AMQQSQ
S AMQQSQAA=AMQQUATN
S %=$P(AMQQYYYY,";")
S (AMQQSQAN,AMQQATNM)=$P(%,U,2)
S AMQQSQSN=+%
S %=$P(^AMQQ(5,+%,0),U,5)
S:%=9 %=AMQQATN+($J/100000)
S AMQQLINK=%
S %=$P(^AMQQ(1,%,0),U,5)
S (AMQQSQST,AMQQFTYP)=$P(^AMQQ(4,%,0),U)
S AMQQYYMI=0
I $P(AMQQYYYY,";",2)="MTAX" S %=$P(AMQQYYYY,";",3),AMQQCOMP=";;;"_%,AMQQTAX=% I $D(AMQQONE),$D(^UTILITY("AMQQ TAX",$J,$P(AMQQYYYY,";",3),"*")) S $P(AMQQCOMP,";",5)="ALL",AMQQSER="-.1"
D EN1^AMQQSQ
K AMQQYYMI,AMQQYYCC,AMQQMMMM,AMQQMMVV
Q
;
AMQQQ2 ; IHS/CMI/THL - COMPILES SCRIPT QUERIES ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 ;-----
RUN DO SUBJ
EN1 ; ENTRY POINT FROM NATURAL LANGUAGE INTERFACE
+1 FOR AMQQYYAT=0:0
SET AMQQYYAT=$ORDER(AMQQXX(AMQQYYAT))
IF 'AMQQYYAT
QUIT
DO ATT
EXIT KILL X,AMQQYYYY,AMQQYYCC,AMQQYYAA,AMQQNSUB,%
+1 QUIT
+2 ;
SUBJ SET Y=AMQQXX(0)
+1 IF Y?1"`"1.N
SET Y="^DPT(^"_$EXTRACT(Y,2,9)_U_$PIECE(^DPT($EXTRACT(Y,2,9),0),U)
DO PERSON^AMQQ1
+2 QUIT
+3 ;
ATT IF $DATA(AMQQXX(AMQQYYAT,2))
DO OR
QUIT
+1 SET (%,AMQQYYYY)=AMQQXX(AMQQYYAT,1)
+2 IF $EXTRACT($PIECE(%,";",2))="M"
SET AMQQCTXS=1
SET AMQQXXND="AMQQXX("_AMQQYYAT_",1)"
DO MULT
GOTO ASET
A1 SET (Y,AMQQYYAA)=$PIECE(%,";")
+1 SET AMQQYYCC=$PIECE(%,";",2)
+2 SET AMQQCOMP=$PIECE(%,";",3,4)
+3 IF AMQQYYCC="TAX"
DO TAX
GOTO ASET
+4 DO EN1^AMQQATA
+5 IF $DATA(AMQQONE)
DO ^AMQQAC
QUIT
+6 IF AMQQYYCC'=""
SET Y=AMQQYYCC
DO EN1^AMQQAC
+7 IF +$GET(AMQQYYAA)=112
DO ^AMQQAC
DO ^AMQQAV
ASET DO SET^AMQQAT
+1 DO EXIT^AMQQAT
+2 DO ^AMQQATR
+3 DO ^AMQQATS
+4 SET AMQQUATN=AMQQUATN+1
+5 IF '$DATA(AMQQNULL)
SET AMQQUNBC=AMQQUNBC+1
+6 KILL AMQQNULL
+7 QUIT
+8 ;
TAX SET %=^AMQQ(5,+Y,0)
+1 SET AMQQATNM=$PIECE(Y,U,2)
+2 SET AMQQLINK=$PIECE(%,U,5)
+3 SET AMQQATN=+Y
+4 SET AMQQSBCT=$PIECE(%,U,20)
+5 IF $GET(AMQQSBCT)=""
SET AMQQSBCT=$PIECE(^AMQQ(1,AMQQLINK,0),U,5)
+6 SET %=^AMQQ(1,AMQQLINK,0)
+7 SET AMQQCTXS=$PIECE(%,U,7)
+8 SET AMQQVCL=$PIECE(%,U,6)
+9 SET AMQQFTYP=$PIECE(^AMQQ(4,$PIECE(%,U,5),0),U)
+10 SET AMQQTAX=AMQQCOMP
+11 SET AMQQCOMP=";;;"_AMQQCOMP
+12 KILL AMQQCOND
+13 QUIT
+14 ;
OR SET AMQQCOND=265
+1 SET AMQQSYMB="="
+2 SET AMQQKGNO=$GET(AMQQKGNO)+1
+3 SET AMQQKONG=""
+4 FOR AMQQYYON=0:0
SET AMQQYYON=$ORDER(AMQQXX(AMQQYYAT,AMQQYYON))
IF 'AMQQYYON
QUIT
SET (AMQQYYYY,%)=AMQQXX(AMQQYYAT,AMQQYYON)
DO A1
+5 KILL AMQQYYON,AMQQKONG
+6 QUIT
+7 ;
MULT ; ENTRY POINT FROM AMQQSQ
+1 SET AMQQSQAA=AMQQUATN
+2 SET %=$PIECE(AMQQYYYY,";")
+3 SET (AMQQSQAN,AMQQATNM)=$PIECE(%,U,2)
+4 SET AMQQSQSN=+%
+5 SET %=$PIECE(^AMQQ(5,+%,0),U,5)
+6 IF %=9
SET %=AMQQATN+($JOB/100000)
+7 SET AMQQLINK=%
+8 SET %=$PIECE(^AMQQ(1,%,0),U,5)
+9 SET (AMQQSQST,AMQQFTYP)=$PIECE(^AMQQ(4,%,0),U)
+10 SET AMQQYYMI=0
+11 IF $PIECE(AMQQYYYY,";",2)="MTAX"
SET %=$PIECE(AMQQYYYY,";",3)
SET AMQQCOMP=";;;"_%
SET AMQQTAX=%
IF $DATA(AMQQONE)
IF $DATA(^UTILITY("AMQQ TAX",$JOB,$PIECE(AMQQYYYY,";",3),"*"))
SET $PIECE(AMQQCOMP,";",5)="ALL"
SET AMQQSER="-.1"
+12 DO EN1^AMQQSQ
+13 KILL AMQQYYMI,AMQQYYCC,AMQQMMMM,AMQQMMVV
+14 QUIT
+15 ;