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

ENTIRRH.m

Go to the documentation of this file.
  1. ENTIRRH ;WOIFO/LKG - Print hand receipt ;3/19/08 15:48
  1. ;;7.0;ENGINEERING;**87,89**;Aug 17, 1993;Build 20
  1. ASK ;Main entry point
  1. N ENOPT D OP^XQCHK S ENOPT=$P(XQOPT,U)
  1. K DIR S DIR(0)="S^D:DATE OF SIGNATURE;S:SIGNED;U:UNSIGNED",DIR("A")="Print Hand Receipt for Unsigned or Signed IT assignments",DIR("B")="UNSIGNED"
  1. S DIR("?",1)="'D' selects assignments signed electronically or via wet signature on a"
  1. S DIR("?",2)=" given date, regardless of current status."
  1. S DIR("?",3)="'S' selects active assignments signed electronically or via wet signature."
  1. S DIR("?",4)="'U' selects active assignments not signed, either electronically or via wet"
  1. S DIR("?",5)=" signature or signed documents where the signature date is more than"
  1. S DIR("?")=" 359 days ago. Assignments must be re-signed annually."
  1. D ^DIR K DIR I $D(DIRUT) K DIRUT,DIROUT,DTOUT,DUOUT Q
  1. G:Y="D" USER^ENTIRRH1:ENOPT="ENIT PRINT HAND RCPT (COM)",ITST2^ENTIRRH1:ENOPT="ENIT PRINT HAND RCPT (IT)"
  1. G:Y="U" USTART:ENOPT="ENIT PRINT HAND RCPT (COM)",ITSTART:ENOPT="ENIT PRINT HAND RCPT (IT)"
  1. G:Y="S" USER:ENOPT="ENIT PRINT HAND RCPT (COM)",ITST2:ENOPT="ENIT PRINT HAND RCPT (IT)"
  1. W !,"UNKNOWN" Q
  1. ITSTART ;Entry point for IT
  1. N ENDA,ENVR S ENVR=$O(^ENG(6916.2,"@"),-1) I ENVR'>0 W !,"There are no hand receipt templates on file." K DIR S DIR(0)="E" D ^DIR K DIR Q
  1. N DIC,DTOUT,DUOUT S DIC=200,DIC(0)="AEMQ",DIC("A")="IT Responsible Person: ",DIC("S")="I $D(^ENG(6916.3,""AOA"",Y))"
  1. D ^DIC I Y<1!$D(DTOUT)!$D(DUOUT) Q
  1. S ENDA=+Y
  1. S %ZIS="Q" D ^%ZIS I POP K POP Q
  1. I $D(IO("Q")) S ZTRTN="IN^ENTIRRH",ZTDESC="IT Equipment Hand Receipt Print",ZTSAVE("ENDA")="",ZTSAVE("ENVR")="" D ^%ZTLOAD,HOME^%ZIS K ZTSK,IO("Q") Q
  1. G IN
  1. USTART ;User entry point
  1. N ENDA,ENVR S ENVR=$O(^ENG(6916.2,"@"),-1) I ENVR'>0 W !,"There are no hand receipt templates on file." K DIR S DIR(0)="E" D ^DIR K DIR Q
  1. I '$D(^ENG(6916.3,"AOA",DUZ)) W !,"You have no active IT assignments." K DIR S DIR(0)="E" D ^DIR K DIR Q
  1. S ENDA=DUZ
  1. S %ZIS="Q" D ^%ZIS I POP K POP Q
  1. I $D(IO("Q")) S ZTRTN="IN^ENTIRRH",ZTDESC="IT Equipment Hand Receipt Print",ZTSAVE("ENDA")="",ZTSAVE("ENVR")="" D ^%ZTLOAD,HOME^%ZIS K ZTSK,IO("Q") Q
  1. G IN
  1. IN ;
  1. U IO
  1. N DIR,DIRUT,DIROUT,DTOUT,DUOUT,END,ENDAC,ENERR,ENI,ENLNCNT,ENMFGN,ENMODEL,ENNOW,ENPG,ENEQPT,ENX,ENNBR,ENSERNBR,ENNAME,ENSTN,X,Y
  1. S ENNAME=$$GET1^DIQ(200,ENDA_",",.01),ENNOW=$$FMTE^XLFDT($$NOW^XLFDT(),"2M"),ENPG=0,ENEQPT=1 S:'$G(DT) DT=$$DT^XLFDT()
  1. S ENSTN=+$O(^DIC(6910,0)),ENSTN=$$GET1^DIQ(6910,ENSTN_",",1)
  1. D HDR1 G:$D(DIRUT) EX
  1. K ^TMP($J,"ENITRRH"),ENERR
  1. D FIND^DIC(6916.3,"","@;.01;1;20","PQX",ENDA,"","AOA2","I $P(^(0),U,8)="""",$S($P(^(0),U,5)="""":1,$$FMDIFF^XLFDT(DT,$P(^(0),U,5))>359:1,1:0)","","^TMP($J,""ENITRRH"")","ENERR")
  1. I $P($G(^TMP($J,"ENITRRH","DILIST",0)),U)'>0 W !,"The are no unsigned IT assignments." G EX
  1. I '$$CMP^XUSESIG1($P($G(^ENG(6916.2,ENVR,0)),U,3),$NAME(^ENG(6916.2,ENVR,1))) W !!!,"Hand receipt text is corrupted - Please contact EPS AEMS/MERS support" G EX
  1. S ENI=0
  1. F S ENI=$O(^TMP($J,"ENITRRH","DILIST",ENI)) Q:+ENI'=ENI D Q:$D(DIRUT)
  1. . S ENX=$G(^TMP($J,"ENITRRH","DILIST",ENI,0))
  1. . S ENDAC=$P(ENX,U,2)_"," D GETS^DIQ(6914,ENDAC,"3;4;5","E","END","ENERR")
  1. . S ENNBR=$P(ENX,U,2),ENMFGN=$G(END(6914,ENDAC,3,"E")),ENMODEL=$G(END(6914,ENDAC,4,"E")),ENSERNBR=$G(END(6914,ENDAC,5,"E"))
  1. . I IOSL-1'>ENLNCNT D HDR1 Q:$D(DIRUT)
  1. . W !,ENNBR,?11,$E(ENMFGN,1,20),?35,ENMODEL,?65,ENSERNBR S ENLNCNT=ENLNCNT+1
  1. G:$D(DIRUT) EX
  1. S ENEQPT=0
  1. I IOSL-1'>ENLNCNT D HDR1 G:$D(DIRUT) EX
  1. I ENLNCNT>3 W !! S ENLNCNT=ENLNCNT+2
  1. S ENI=0 F S ENI=$O(^ENG(6916.2,ENVR,1,ENI)) Q:+ENI'=ENI D Q:$D(DIRUT)
  1. . I IOSL-1'>ENLNCNT D HDR1 Q:$D(DIRUT)
  1. . W !,$G(^ENG(6916.2,ENVR,1,ENI,0)) S ENLNCNT=ENLNCNT+1
  1. G:$D(DIRUT) EX
  1. I IOSL-6'>ENLNCNT D HDR1 G:$D(DIRUT) EX
  1. W !!! S ENLNCNT=ENLNCNT+3
  1. W !,"Signature:______________________________ Date:________________"
  1. W !,?12,$P($$ESBLOCK^XUSESIG1(ENDA),U)
  1. I $E(IOST,1,2)="C-" K DIR S DIR(0)="E" D ^DIR K DIR
  1. EX S:$D(ZTQUEUED) ZTREQ="@" D ^%ZISC
  1. K ^TMP($J,"ENITRRH"),ENDA,ENVR
  1. Q
  1. HDR1 ;Logic to print report heading
  1. I $E(IOST,1,2)="C-",ENPG K DIR S DIR(0)="E" D ^DIR K DIR Q:$D(DIRUT)
  1. W:$E(IOST,1,2)="C-"!ENPG @IOF S ENPG=ENPG+1
  1. W $S($G(ENPRT)="SIGNED":"IT HAND RECEIPT/LOAN FORM FOR GOVERNMENT FURNISHED EQUIPMENT (GFE) Page ",1:"INFORMATION TECHNOLOGY HAND RECEIPT FOR GOVERNMENT FURNISHED EQUIPMENT Page "),ENPG
  1. W:$G(ENPRT)="SIGNED" !,"Electronic Accepted Substitute for VA Form 0887(a/b)"
  1. W !,"STATION: ",ENSTN,?14,"ASSIGNED TO: ",$E(ENNAME,1,30),?58,"Printed ",ENNOW,! S ENLNCNT=$S($G(ENPRT)="SIGNED":4,1:3)
  1. I ENEQPT W !,"ENTRY #",?11,"MFG EQUIP NAME",?35,"MODEL",?65,"SERIAL#",!,"---------",?11,"--------------------",?35,"--------------------------",?65,"----------" S ENLNCNT=ENLNCNT+2
  1. Q
  1. ;
  1. ITST2 ;IT personnel entry point for printing signed hand receipts
  1. N ENDA
  1. N DIC,DTOUT,DUOUT S DIC=200,DIC(0)="AEMQ",DIC("S")="I $D(^ENG(6916.3,""AOA"",Y))"
  1. D ^DIC I Y<1!$D(DTOUT)!$D(DUOUT) Q
  1. S ENDA=+Y
  1. I '$$SIGNED(ENDA) W !,"There are no active, Signed/Certified IT assignments for "_$$GET1^DIQ(200,ENDA_",",.01)_"." K DIR S DIR(0)="E" D ^DIR K DIR Q
  1. S %ZIS="Q" D ^%ZIS I POP K POP Q
  1. I $D(IO("Q")) S ZTRTN="IN2^ENTIRRH",ZTDESC="IT Equipment Hand Receipt Print",ZTSAVE("ENDA")="" D ^%ZTLOAD,HOME^%ZIS K ZTSK,IO("Q") Q
  1. G IN2
  1. USER ;User entry point for printing signed hand receipts
  1. I '$D(^ENG(6916.3,"AOA",DUZ)) W !,"You have no active IT assignments." K DIR S DIR(0)="E" D ^DIR K DIR Q
  1. N ENDA S ENDA=DUZ
  1. I '$$SIGNED(ENDA) W !,"You do not have any active, Signed/Certified IT assignments." K DIR S DIR(0)="E" D ^DIR K DIR Q
  1. S %ZIS="Q" D ^%ZIS I POP K POP Q
  1. I $D(IO("Q")) S ZTRTN="IN2^ENTIRRH",ZTDESC="IT Equipment Hand Receipt Print",ZTSAVE("ENDA")="" D ^%ZTLOAD,HOME^%ZIS K ZTSK,IO("Q") Q
  1. G IN2
  1. IN2 ;
  1. N DIR,DIRUT,DIROUT,DTOUT,DUOUT,ENVR,ENPRT S ENPRT="SIGNED"
  1. S ENVR=0 F S ENVR=$O(^ENG(6916.2,ENVR)) Q:+ENVR'=ENVR D PRT Q:$D(DIRUT)
  1. G EX2
  1. PRT U IO
  1. N END,ENDAC,ENERR,ENI,ENLNCNT,ENMFGN,ENMODEL,ENNOW,ENEQPT,ENPG,ENRDA,ENX,ENNBR,ENSERNBR,ENSIG,ENSIGNDT,ENNAME,ENSTN,ENVAL,X,Y S ENPG=0,ENEQPT=1
  1. S ENNAME=$$GET1^DIQ(200,ENDA_",",.01),ENNOW=$$FMTE^XLFDT($$NOW^XLFDT(),"2M")
  1. S ENSTN=+$O(^DIC(6910,0)),ENSTN=$$GET1^DIQ(6910,ENSTN_",",1)
  1. K ^TMP($J,"ENITRRH"),ENERR
  1. D FIND^DIC(6916.3,"","@;.01;1;20","PQX",ENDA,"","AOA2","I $P(^(0),U,6)=ENVR,"";SIGNED;CERTIFIED;""[("";""_$$GET1^DIQ(6916.3,Y_"","",20)_"";"")","","^TMP($J,""ENITRRH"")","ENERR")
  1. I $P($G(^TMP($J,"ENITRRH","DILIST",0)),U)'>0 K ^TMP($J,"ENITRRH") Q
  1. D HDR1 Q:$D(DIRUT)
  1. I '$$CMP^XUSESIG1($P($G(^ENG(6916.2,ENVR,0)),U,3),$NAME(^ENG(6916.2,ENVR,1))) W !!!,"Hand receipt v",$P($G(^ENG(6916.2,ENVR,0)),U)," text is corrupted.",!?5," - Please contact EPS AEMS/MERS support" Q
  1. S ENI=0
  1. F S ENI=$O(^TMP($J,"ENITRRH","DILIST",ENI)) Q:+ENI'=ENI D Q:$D(DIRUT)
  1. . N END,ENERR,ENERR1,ENERR2,ENERR3,ENERR4,X1,X2
  1. . S ENX=$G(^TMP($J,"ENITRRH","DILIST",ENI,0))
  1. . S ENDAC=$P(ENX,U,2)_"," D GETS^DIQ(6914,ENDAC,"3;4;5","E","END","ENERR")
  1. . S ENNBR=$P(ENX,U,2),ENMFGN=$G(END(6914,ENDAC,3,"E")),ENMODEL=$G(END(6914,ENDAC,4,"E")),ENSERNBR=$G(END(6914,ENDAC,5,"E"))
  1. . I IOSL-1'>ENLNCNT D HDR1 Q:$D(DIRUT)
  1. . W !,ENNBR,?11,$E(ENMFGN,1,20),?35,ENMODEL,?65,ENSERNBR S ENLNCNT=ENLNCNT+1
  1. . S ENRDA=$P(ENX,U) K ENERR,ENSIG,ENSIGNDT
  1. . S X=$G(^ENG(6916.3,ENRDA,1))
  1. . I X'="" D
  1. . . S X1=ENRDA,X2=1 D DE^XUSHSHP S ENSIG=$P(X,U),ENSIGNDT=$$FMTE^XLFDT($P(X,U,4))
  1. . . S:$P(X,U,8)'=$P($G(^ENG(6916.2,ENVR,0)),U,3) ENERR1=1
  1. . . S:$P(X,U,5)'=$P(ENX,U,2) ENERR2=1
  1. . . S:$P(X,U,6)'=$P($G(^ENG(6916.3,ENRDA,0)),U,2) ENERR3=1
  1. . . S:$P(X,U,4)'=$P($G(^ENG(6916.3,ENRDA,0)),U,5) ENERR4=1
  1. . I $D(ENSIGNDT) D:IOSL-1'>ENLNCNT HDR1 Q:$D(DIRUT) W !?4,"Signed: ",ENSIGNDT,?35,"Signature: /ES/",$G(ENSIG) S ENLNCNT=ENLNCNT+1
  1. . I '$D(ENSIGNDT) D:IOSL-1'>ENLNCNT HDR1 Q:$D(DIRUT) W !,?4,"Signed: "_$$GET1^DIQ(6916.3,ENRDA_",",4),?35,"Certified by: ",$$GET1^DIQ(6916.3,ENRDA_",",6) S ENLNCNT=ENLNCNT+1
  1. . S ENVAL=$$LOAN($P(ENDAC,","))
  1. . W !,?2,"Issued By: ",$$ISSUEDBY(ENRDA),?49,"Contact #: ",$P(ENVAL,U,2) S ENLNCNT=ENLNCNT+1
  1. . W !,?2,"Equipment Return Date: ",$$DATEDUE($P(ENDAC,","),$P(ENVAL,U)) S ENLNCNT=ENLNCNT+1
  1. . I $G(ENERR1) D:IOSL-1'>ENLNCNT HDR1 Q:$D(DIRUT) W !?19,"** Hand Receipt Text Altered **" S ENLNCNT=ENLNCNT+1
  1. . I $G(ENERR2) D:IOSL-1'>ENLNCNT HDR1 Q:$D(DIRUT) W !?19,"** Assigned Equipment Altered **" S ENLNCNT=ENLNCNT+1
  1. . I $G(ENERR3) D:IOSL-1'>ENLNCNT HDR1 Q:$D(DIRUT) W !?19,"** Assigned Person Altered **" S ENLNCNT=ENLNCNT+1
  1. . I $G(ENERR4) D:IOSL-1'>ENLNCNT HDR1 Q:$D(DIRUT) W !?19,"** Date Signed Altered **" S ENLNCNT=ENLNCNT+1
  1. Q:$D(DIRUT) S ENEQPT=0
  1. I IOSL-3'>ENLNCNT D HDR1 Q:$D(DIRUT)
  1. I ENLNCNT>3 W !! S ENLNCNT=ENLNCNT+2
  1. S ENI=0 F S ENI=$O(^ENG(6916.2,ENVR,1,ENI)) Q:+ENI'=ENI D Q:$D(DIRUT)
  1. . I IOSL-1'>ENLNCNT D HDR1 Q:$D(DIRUT)
  1. . W !,$G(^ENG(6916.2,ENVR,1,ENI,0)) S ENLNCNT=ENLNCNT+1
  1. Q:$D(DIRUT)
  1. I $E(IOST,1,2)="C-" K DIR S DIR(0)="E" D ^DIR K DIR
  1. Q
  1. EX2 S:$D(ZTQUEUED) ZTREQ="@" D ^%ZISC
  1. K ^TMP($J,"ENITRRH"),ENDA
  1. Q
  1. SIGNED(ENDA) ;Returns how many signed/certified, active assignments exist for this person
  1. N ENERR,ENCNT
  1. K ^TMP($J,"ENITRRH")
  1. D FIND^DIC(6916.3,"","@","PQX",ENDA,"","AOA2","I "";SIGNED;CERTIFIED;""[("";""_$$GET1^DIQ(6916.3,Y_"","",20)_"";"")","","^TMP($J,""ENITRRH"")","ENERR")
  1. S ENCNT=+$P($G(^TMP($J,"ENITRRH","DILIST",0)),U)
  1. K ^TMP($J,"ENITRRH")
  1. Q ENCNT
  1. ;
  1. ISSUEDBY(ENRDA) ;Name of person assigning responsibility
  1. N ENARR,ENDA,ENNAME S ENDA=$$GET1^DIQ(6916.3,ENRDA_",",3,"I")
  1. S ENARR("FILE")=200,ENARR("IENS")=ENDA_",",ENARR("FIELD")=".01"
  1. S ENNAME=$$NAMEFMT^XLFNAME(.ENARR,"G","L35")
  1. Q ENNAME
  1. ;
  1. DATEDUE(ENDA,ENADD) ;Returns Date Due for Return
  1. N ENINVDT,ENDT
  1. S ENINVDT=$$GET1^DIQ(6914,ENDA_",",23,"I") S:$G(ENADD)'>0 ENADD=90
  1. S ENDT=$S(ENINVDT="":DT,1:$$FMADD^XLFDT(ENINVDT,ENADD)),ENDT=$$FMTE^XLFDT(ENDT,"2M")
  1. Q ENDT
  1. ;
  1. LOAN(ENEQ) ;Loan Data for Equipment
  1. ;input ENDA (equipment ien file 6914)
  1. ;return value = number of days^loan form phone
  1. N ENCMR,ENRET,ENY1
  1. S ENRET="90^" ;default number of days is 90
  1. S ENCMR=$P($G(^ENG(6914,ENEQ,2)),U,9)
  1. S ENY1=$S(ENCMR:$G(^ENG(6914.1,ENCMR,1)),1:"")
  1. I $P(ENY1,U) S $P(ENRET,U)=$P(ENY1,U) ;days for CMR (if specified)
  1. I $P(ENY1,U,2)]"" S $P(ENRET,U,2)=$P(ENY1,U,2) ;loan form phone for CMR
  1. Q ENRET
  1. ;
  1. ;ENTIRRH