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

PRCHJRP6.m

Go to the documentation of this file.
PRCHJRP6 ;OI&T/DDA - Transaction Report from 414.06 [CONT.] ;5/21/13 13:48
V ;;5.1;IFCAP;**174**;Oct 20,2000;Build 23
 ;Per VHA Directive 2004-38, this routine should not be modified.
 ;
 Q
GATHER ;
 K ^TMP("PRCHJRP6",$J)
 N CHECKED,NODE0,NODE1,NODE2,NODEHALF,DIR,Y
 N PRC2237,PRCACKER,PRCEDT,PRCEDTX,PRCEVENT,PRCEVTX,PRCEXIT,PRCI,PRCPAGE,PRCRUNDT,PRCSTN
 N PRCH37,PRCHAND,PRCHCNT,PRCHCTYP,PRCHEDT,PRCHEIEN,PRCHERCT,PRCHERR,PRCHESTN,PRCHEVNT,PRCHEVT,PRCHIEN,PRCHKFCP,PRCHKSTN,PRCHLPDT,PRCHSDT,PRCHSDTX,PRCHSHKE,PRCHSEI,PRCHSI,PRCHSNGL
 S PRCHSNGL=0,PRCH37=PRCH2237
 ; Build the handshake events for those primary events selected.
 I PRCH2237="ALL" D
 . I $G(PRCHTYPE)'="ALL" D
 ..;   Include RESENT (4) to be equal to SEND (1) event
 .. S PRCHAND=",",PRCHTYPE=","_PRCHTYPE
 .. S:PRCHTYPE[",1," PRCHAND=PRCHAND_"2,",PRCHTYPE=",1,4,"_$P(PRCHTYPE,",1,",2)
 .. S:PRCHTYPE[",6," PRCHAND=PRCHAND_"7,"
 .. S:PRCHTYPE[",8," PRCHAND=PRCHAND_"9,"
 .. S:PRCHTYPE[",10," PRCHAND=PRCHAND_"11,"
 ..Q
 . I PRCHTYPE="ALL" S PRCHTYPE=",1,4,6,8,10,",PRCHAND=",2,7,9,11,"
 ; if single GRABIT, SORTIT and DISPLAY it; then exit.
 I +PRCH2237 D  G EXITD
 . S PRCHIEN=""
 . S PRCHTYPE=",1,4,6,8,10,",PRCHAND=",2,7,9,11,",PRCHSNGL=1
 . S PRCHIEN=$O(^PRCV(414.06,"B",PRCH2237,PRCHIEN))
 . S (PRCHCNT,PRCHEIEN)=0
 . F  S PRCHEIEN=$O(^PRCV(414.06,PRCHIEN,1,PRCHEIEN)) Q:+PRCHEIEN'>0  D GRABIT D
 .. I PRCHDATA=0 K PRCHDATA Q
 .. S PRCHEDT=$P(PRCHDATA(PRCHEIEN,0),"^"),PRCHEVNT=$P(PRCHDATA(PRCHEIEN,0),"^",2),PRCHESTN=$P(PRCH2237,"-")
 .. D SORTIT
 .. K PRCHDATA
 ..Q
 . D DISPLAY
 .Q
 ; loop on event date; GRABIT, CHECKS, SORTIT, new loop to add ACK Handshake data outside the date range, DISPLAY.
 S PRCHLPDT=PRCHSTDT
 F  S PRCHLPDT=$O(^PRCV(414.06,"AED",PRCHLPDT)) Q:(+PRCHLPDT'>0)!($P(PRCHLPDT,".")>PRCHENDT)  S PRCHAKLP=PRCHLPDT D
 . S PRCHIEN=0
 . F  S PRCHIEN=$O(^PRCV(414.06,"AED",PRCHLPDT,PRCHIEN)) Q:+PRCHIEN'>0  D
 .. S PRCHEIEN=0
 .. F  S PRCHEIEN=$O(^PRCV(414.06,"AED",PRCHLPDT,PRCHIEN,PRCHEIEN))  Q:+PRCHEIEN'>0  S PRCH2237=$P(^PRCV(414.06,PRCHIEN,0),"^") D GRABIT D
 ... I PRCHDATA=0 K PRCHDATA Q
 ... D CHECKS
 ... S PRCHEDT=$P(PRCHDATA(PRCHEIEN,0),"^"),PRCHEVNT=$P(PRCHDATA(PRCHEIEN,0),"^",2),PRCHESTN=$P(PRCH2237,"-")
 ... S:+PRCHEVNT=0 CHECKED=0
 ... D:CHECKED SORTIT
 ... K PRCH2237,PRCHDATA
 ...Q
 ..Q
 .Q
 ; Grab any remaining ACK Handshake data, if any. By skipping CHECKS and SORTIT, only ACK handshake data is selected via GRABIT.
 G:PRCHLPDT'>0 D1
 S PRCHLPDT=PRCHAKLP
 F  S PRCHLPDT=$O(^PRCV(414.06,"AED",PRCHLPDT)) Q:(+PRCHLPDT'>0)  D
 . S PRCHIEN=0
 . F  S PRCHIEN=$O(^PRCV(414.06,"AED",PRCHLPDT,PRCHIEN)) Q:+PRCHIEN'>0  D
 .. S PRCHEIEN=0
 .. F  S PRCHEIEN=$O(^PRCV(414.06,"AED",PRCHLPDT,PRCHIEN,PRCHEIEN))  Q:+PRCHEIEN'>0  S PRCH2237=$P(^PRCV(414.06,PRCHIEN,0),"^") D GRABIT D
 ... I PRCHDATA=0 K PRCHDATA Q
 ... K PRCH2237,PRCHDATA
 ...Q
 ..Q
 .Q
D1 D DISPLAY
 D EXITD
 Q
CHECKS ; SCREENS - DATE RANGE AND TYPE HAVE ALREADY BEEN SCREENED
 S CHECKED=0
 S PRCHEDT=PRCHLPDT
 S PRCH2237=$P(PRCHDATA(PRCHIEN,"IEN",0),"^")
 ; exit if FCP does not pass USER screen
 S PRCHKSTN=$P(PRCH2237,"-"),PRCHKFCP=$P(PRCH2237,"-",4)
 Q:$D(PRCHURCP(PRCHKFCP,PRCHKSTN))'=1
 G:PRCHFUND="ALL" CHKECMS
 ; exit if FCP does not pass SELECTION screen 
 Q:PRCHKFCP'=PRCHFUND
CHKECMS ; if ecms contact = ALL continue, else exit if it does not pass the SELECTION screen
 G:PRCHECMS="ALL" CHKSTN
 Q:$P($G(PRCHDATA(PRCHEIEN,1)),"^",6)'=PRCHEML
CHKSTN ; screen station and substation
 ; if station = ALL and substation = ALL, continue
 G:(PRCHSTN="ALL")&(PRCHSUB="ALL") CHKDONE
 ; if substation selected; i.e. - station = SUB and substation = substation ID, screen to continue
 I PRCHSTN="SUB" Q:$P($G(PRCHDATA(PRCHEIEN,1)),"^",2)'=PRCHSUB
 ; if station selected and substation = ALL; screen to continue
 I (+PRCHSTN)&(PRCHSUB="ALL") Q:+PRCHSTN'=PRCHKSTN
 ; if station selected and substation = NONE, screen to continue
 I (+PRCHSTN)&(PRCHSUB="NONE") Q:+PRCHSTN'=PRCHKSTN  G:($P($G(PRCHDATA(PRCHEIEN,1)),"^",2)="")!($P($G(PRCHDATA(PRCHEIEN,1)),"^",2)=PRCHKSTN) CHKDONE Q
CHKDONE ;    still with me?  set the flag! all checks successfull!
 S CHECKED=1
 Q
GRABIT ; pull data from global
 S PRCHDATA=0
 S PRCHDATA(PRCHIEN,"IEN",0)=^PRCV(414.06,PRCHIEN,0)
 S PRCHDATA(PRCHEIEN,0)=^PRCV(414.06,PRCHIEN,1,PRCHEIEN,0)
 ;Build a list of handshake events.  Needed to display "ack dates", etc.
 S PRCHCTYP=","_$P(PRCHDATA(PRCHEIEN,0),"^",2)_","
 I PRCHAND[PRCHCTYP S ^TMP("PRCHJRP6",$J,"PRCHAND",PRCH2237,$P(PRCHDATA(PRCHEIEN,0),"^",2),$P(^PRCV(414.06,PRCHIEN,1,PRCHEIEN,0),"^"),.5)=PRCHIEN_"^"_PRCHEIEN Q
 Q:PRCHTYPE'[PRCHCTYP
 S PRCHDATA(PRCHEIEN,1)=$G(^PRCV(414.06,PRCHIEN,1,PRCHEIEN,1))
 S PRCHDATA(PRCHEIEN,2)=$G(^PRCV(414.06,PRCHIEN,1,PRCHEIEN,2))
 S PRCHERR=0
 F  S PRCHERR=$O(^PRCV(414.06,PRCHIEN,1,PRCHEIEN,3,PRCHERR)) Q:+PRCHERR'>0  S PRCHDATA(PRCHEIEN,3,PRCHERR)=^PRCV(414.06,PRCHIEN,1,PRCHEIEN,3,PRCHERR,0)
 S PRCHDATA=1
 Q
SORTIT ; Drop data into TMP to sort it.
 S ^TMP("PRCHJRP6",$J,PRCH2237,PRCHEDT,PRCHESTN,PRCHEVNT,.5)=PRCHDATA(PRCHIEN,"IEN",0)_"^"_PRCHIEN_"^"_PRCHEIEN
 S ^TMP("PRCHJRP6",$J,PRCH2237,PRCHEDT,PRCHESTN,PRCHEVNT,0)=PRCHDATA(PRCHEIEN,0)
 S ^TMP("PRCHJRP6",$J,PRCH2237,PRCHEDT,PRCHESTN,PRCHEVNT,1)=$G(PRCHDATA(PRCHEIEN,1))
 S ^TMP("PRCHJRP6",$J,PRCH2237,PRCHEDT,PRCHESTN,PRCHEVNT,2)=$G(PRCHDATA(PRCHEIEN,2))
 S ^TMP("PRCHJRP6",$J,PRCH2237,PRCHEDT,PRCHESTN,PRCHEVNT,3)=0
 I $D(PRCHDATA(PRCHEIEN,3))=10 D
 . S (PRCHERCT,PRCHERR)=0
 . F  S PRCHERR=$O(PRCHDATA(PRCHEIEN,3,PRCHERR)) Q:+PRCHERR'>0  S ^TMP("PRCHJRP6",$J,PRCH2237,PRCHEDT,PRCHESTN,PRCHEVNT,3,PRCHERR)=PRCHDATA(PRCHEIEN,3,PRCHERR),PRCHERCT=PRCHERCT+1
 . S ^TMP("PRCHJRP6",$J,PRCH2237,PRCHEDT,PRCHESTN,PRCHEVNT,3)=PRCHERCT
 .Q
 Q
DISPLAY ; Selection and sort criteria have already been obtained.
 U IO
 D NOW^%DTC S Y=$J(%,7,4) D DD^%DT S PRCRUNDT=Y
 S (PRCEXIT,PRCPAGE)=0,PRCHSHKE="2^^^2^^7^^9^^11"
 D HEADER
 S PRC2237="",PRCHNO=0
 G:$D(^TMP("PRCHJRP6",$J))=0 DX
 F  S PRC2237=$O(^TMP("PRCHJRP6",$J,PRC2237)) Q:(PRC2237="PRCHAND")!(PRCEXIT)!(PRC2237="")  D
 . S PRCEDT=0,PRCHNO=1
 . F  S PRCEDT=$O(^TMP("PRCHJRP6",$J,PRC2237,PRCEDT)) Q:(+PRCEDT'>0)!(PRCEXIT)  D
 .. S PRCSTN=0
 .. F PRCSTN=$O(^TMP("PRCHJRP6",$J,PRC2237,PRCEDT,PRCSTN)) Q:(+PRCSTN'>0)!(PRCEXIT)  D
 ... S PRCEVENT=0
 ... F PRCEVENT=$O(^TMP("PRCHJRP6",$J,PRC2237,PRCEDT,PRCSTN,PRCEVENT)) Q:(+PRCEVENT'>0)!(PRCEXIT)  D
 ... S NODEHALF=^TMP("PRCHJRP6",$J,PRC2237,PRCEDT,PRCSTN,PRCEVENT,.5)
 ... S NODE0=^TMP("PRCHJRP6",$J,PRC2237,PRCEDT,PRCSTN,PRCEVENT,0)
 ... S NODE1=^TMP("PRCHJRP6",$J,PRC2237,PRCEDT,PRCSTN,PRCEVENT,1)
 ... S NODE2=^TMP("PRCHJRP6",$J,PRC2237,PRCEDT,PRCSTN,PRCEVENT,2)
 ... S PRCACKER=^TMP("PRCHJRP6",$J,PRC2237,PRCEDT,PRCSTN,PRCEVENT,3)
 ... ; PRC2237 - EVENT TEXT - EVENT DATE
 ... S PRCEVTX=$P(^PRCV(414.07,PRCEVENT,0),"^")
 ... S Y=PRCEDT D DD^%DT S PRCEDTX=Y
 ... W !,PRC2237,?21,PRCEVTX,?58,PRCEDTX
 ... ; SUBSTATION (PRIMARY) - HANDSHAKE EVENT DATE - (set handshake event iens for future use)
 ... S PRCHSDT=PRCEDT,PRCHEVT=$P(PRCHSHKE,"^",PRCEVENT)
 ... F  S PRCHSDT=$O(^TMP("PRCHJRP6",$J,"PRCHAND",PRC2237,PRCHEVT,PRCHSDT)) S:PRCHSDT'="" PRCHSI=$P(^TMP("PRCHJRP6",$J,"PRCHAND",PRC2237,PRCHEVT,PRCHSDT,.5),"^"),PRCHSEI=$P(^TMP("PRCHJRP6",$J,"PRCHAND",PRC2237,PRCHEVT,PRCHSDT,.5),"^",2) Q
 ... S:PRCHSDT'="" Y=PRCHSDT D DD^%DT S PRCHSDTX=Y
 ... S:PRCHSDT="" PRCHSDTX="(Pending)"
 ... W !
 ... W:$P(NODE1,"^",2)'="" "SUBSTATION: "_$P(NODE1,"^",2)
 ... W ?44,"ACKNOWLEDGED: "_PRCHSDTX
 ... ; eCMS CONTACT - eCMS PHONE
 ... W:(PRCEVENT'=1)&(PRCEVENT'=4) !,"eCMS CONTACT: "_$P(NODE1,"^",6),?44,"PHONE: "_$P(NODE1,"^",5)
 ... ; RETURN/CANCEL DATE and COMMENT or REASON TEXT
 ... I $P(NODE1,"^",7)'="" S Y=$P(NODE1,"^",7) D DD^%DT W !,"RETURN/CANCEL DATE: "_Y
 ... W:(NODE2'="")&(NODE2'="^")&(PRCEVENT'=1) !,"REASON/COMMENT: "_$S($P(NODE2,"^",2)'="":$P(NODE2,"^",2),1:$P(NODE2,"^"))
 ... ; ERROR TEXT IF ANY, BOTH MAIN AND HANDSHAKE
 ... I PRCACKER>0 D
 .... I 'PRCHERTX W !,"This "_PRCEVTX_" has ERROR TEXT." Q
 .... W !,"ERROR TEXT FOR "_PRCEVTX_":"
 .... S PRCI=0
 .... F  S PRCI=$O(^TMP("PRCHJRP6",$J,PRC2237,PRCEDT,PRCSTN,PRCEVENT,3,PRCI)) Q:(+PRCI'>0)!(PRCEXIT)  D:(IOSL-$Y)<4 HEADER Q:PRCEXIT  W !,"   ",^TMP("PRCHJRP6",$J,PRC2237,PRCEDT,PRCSTN,PRCEVENT,3,PRCI)
 ....Q
 ... I PRCHSDT'="" D
 .... I $D(^PRCV(414.06,PRCHSI,1,PRCHSEI,3))>0 D
 ..... I 'PRCHERTX W !,"This "_PRCEVTX_" has ACKNOWLEDGMENT ERROR TEXT." Q
 ..... W !,"ACKNOWLEDGMENT ERROR TEXT FOR "_PRCEVTX_":"
 ..... S PRCI=0
 ..... F  S PRCI=$O(^PRCV(414.06,PRCHSI,1,PRCHSEI,3,PRCI)) Q:(+PRCI'>0)!(PRCEXIT)  D:(IOSL-$Y)<4 HEADER Q:PRCEXIT  W !,"   ",^PRCV(414.06,PRCHSI,1,PRCHSEI,3,PRCI,0)
 .....Q
 ....Q
 ... W !
 ... ; PAGE BREAK CHECK
 ... D:((IOSL-$Y)<4)&(PRCEXIT'=1) HEADER
 ... Q:PRCEXIT
 ...Q
 ..Q
 .Q
DX W !,?25,$S(PRCEXIT:"USER ABORTED REPORT",PRCHNO=1:"END OF REPORT",PRCHNO=0:"NO DATA TO REPORT!",1:""),!
 G:PRCEXIT EXITD
 I $E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR
 S:$D(ZTQUEUED) ZTREQ="@"
 D EXITZT^PRCHJRP5
 D EXITD
 Q
 I PRCPAGE>0 W ! I $E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR S:+$G(DUOUT)!$G(DTOUT) PRCEXIT=1
 Q:PRCEXIT
 S PRCPAGE=PRCPAGE+1
 W:PRCPAGE>1 @IOF
 W !,PRCRUNDT,?25,"eCMS/IFCAP TRANSACTION LOG REPORT",?74,"p. "_PRCPAGE
 I PRCHSNGL W !!,"eCMS 2237: ",PRCH2237 G TABLE
 W !!,"eCMS 2237: ",PRCH37,?17,"eCMS Contact: ",PRCHEML,?65,"Station: ",$S(PRCHSTN="SUB":+PRCHSUB,1:PRCHSTN)
 W !,"Report Date Range: "_PRCHSTAR_" - "_PRCHEND,?59,"Control Point: ",PRCHFUND
 W !,"Events: ",PRCHTYTX
TABLE W !!,"IFCAP Reference",?21,"Message Event",?58,"Event Date"
 W ! S L="",$P(L,"_",IOM)="_" W L S L=""
 Q
EXITD ; Exit display portion
 K ^TMP("PRCHJRP6",$J)
 K %,DTOUT,DUOUT,I,L,POP,PRCETMP0,PRCETMP1,PRCETMP3,PRCH411,PRCHAKLP,PRCHI,PRCHINIC,PRCHINSN,PRCHJ,PRCHNO,PRCHSLTY,PRCHTT,XQOPT,ZTQUEUED,ZTREQ
 K PRCH2237,PRCHDATA,PRCHECMS,PRCHEML,PRCHEND,PRCHENDT,PRCHERTX,PRCHFUND,PRCHSNGL,PRCHSTAR,PRCHSTDT,PRCHSTN,PRCHSUB,PRCHTYPE,PRCHTYTX,PRCHURCP
 Q