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

ACHSSIG1.m

Go to the documentation of this file.
ACHSSIG1 ;IHS/ITSC/JVK -STAMP ELECTRONIC SIGNATURE OF ORDERING OFC. ON PO [ 02/15/2005  7:59 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**7,8,12,19**;JUNE 11,2001 
 ;;ACHS*3.1*7- E-SIG ORDERING OFFICIAL
 ;;ACHS*3.1*8- FIX LIST LABEL FOR SUPPLEMENTS
 ;CALLED FROM ACHS E-SIG OPTION
 ;;3.1 8.23.04 IHS/ITSC/FCJ LOOP WAS NOT PICKING UP DOCUMENTS IF TYPE 1 
 ;     DID NOT EXIST
 ;;10/1/04 ITSC/SET/JVK FIX ACHSGO VALUE
 ;
LOOK ;EP
 S ACHSANS=""
 I '$D(^ACHSF("EQ",DUZ(2))) D  Q
 . W !,"There are no documents in the Queue!"
 . D RTRN^ACHS
 S ACHSIO=IO
 K X2,X3
 ;
START ;
 D BM^ACHS
 S ACHSFC=$$FC^ACHS(DUZ(2))
 S COUNT=0
 S ACHSQUIT=0
 D CHECK
 I ACHSQUIT G END
 ;
LOOP1 ;--LOOP THRU QUEUE ARRAY FOR DOCUMENTS WAITING TO BE PRINTED--
 ;ITSC/SET/JVK LINE BELOW -ACHS*3.1*12
 S ACHSGO=0
 F ACHSTYPV=1,3,2  D LOOP2 Q:$D(DUOUT)!ACHSQUIT
 ;
 I ACHSGO>0,ACHSSIG'=""  G A
 ;
 ;ITSC/SET/JVK LINE BELOW -ACHS**
 ;I 'ACHSGO W !,?5,"No Documents Pending for Signature.",! H 2 G END
 I ACHSGO'>0 W !,?5,"No Documents Pending for Signature.",! H 2 G END
 ;
 I $D(DUOUT)!$D(DTOUT) D END Q
 ;
LOOP2 ;--SECOND LEVEL OF QUEUE ARRAY SET UP ACHSTMP ARRAY--
 Q:'$D(^ACHSF("EQ",DUZ(2),ACHSTYPV))  ;8.23.04 IHS/ITSC/FCJ TEST FOR DOCTYPE
 S ACHSDIEN=""
 S ACHSFLG=""
 F  S ACHSDIEN=$O(^ACHSF("EQ",DUZ(2),ACHSTYPV,ACHSDIEN)) Q:+ACHSDIEN=0!$D(DUOUT)  D
 .S ACHSDOC=^ACHSF(DUZ(2),"D",ACHSDIEN,0)
 .S ACHSTST=$P(ACHSDOC,U,24)
 .S ACHSAMT=$P(ACHSDOC,U,9)
 .I ACHSAMT>ACHSDAMT Q
 .I ACHSTST="" S COUNT=COUNT+1,ACHSTMP(DUZ(2),COUNT)=ACHSDIEN_U_ACHSAMT,ACHSFLG=1
 .S ACHSGO=COUNT
 Q
 ;
A ;--SET UP LIST MANAGER--
 D VIEWR^XBLM("PRINT^ACHSSIG1")
 D STAMP
 Q
 ;
PRINT ;
 D FC^ACHSUF
 D BRPT^ACHSFU
 S ACHST1=$$C^XBFUNC("Purchase Orders to be Approved",80)
 D HDR
 S X3=0
 S COUNT=""
 F  S COUNT=$O(ACHSTMP(DUZ(2),COUNT)) Q:COUNT'?1N.N  D
 .S ACHSDOC=^ACHSF(DUZ(2),"D",$P(ACHSTMP(DUZ(2),COUNT),U),0)
 .S ACHSTYP=$P(ACHSDOC,U,4)
 .S ACHSLST=$S(ACHSTYP=1:"Hospital",ACHSTYP=3:"Outpatient",ACHSTYP=2:"Dental",1:"")
 .D LIST
 Q
 ; 
CHECK ;--IS THE USER AUTHORIZED IN THE CHS E-SIG FILE--
 S ACHSAU=""
 S ACHSAU=$O(^ACHSESIG(DUZ(2),1,"B",DUZ,ACHSAU))
 I ACHSAU D
 .K DIC,DIQ
 .S DIC=9002080.1,DR=".01;1",DA=DUZ(2)
 .S DR(9002080.11)="1:5",DA(9002080.11)=ACHSAU,DIQ="ACHSVAL" D EN^DIQ1
 .S ACHSDAMT=$P($G(ACHSVAL(9002080.11,ACHSAU,1)),U)
 .S ACHSADT=$P($G(ACHSVAL(9002080.11,ACHSAU,2)),U)
 .S ACHSIADT=$P($G(ACHSVAL(9002080.11,ACHSAU,3)),U)
 .S ACHSIGO=$P($G(ACHSVAL(9002080.11,ACHSAU,4)),U)
 .S ACHSIGA=$P($G(ACHSVAL(9002080.11,ACHSAU,5)),U)
 .Q
 D SIG^XUSESIG
 S ACHSSIG=X1
 I 'ACHSAU W !,"You are not authorized in the CHS E-SIG file.",! H 2 S ACHSQUIT=1 Q
 I ACHSIADT'="" W !,"You are currently not authorized in the CHS E-SIG file.",! H 2 S ACHSQUIT=1 Q
 I ACHSIGO["NO",ACHSIGO="" W !,"You are not an authorized Ordering Official.",! H 2 S ACHSQUIT=1
 Q
STAMP ;--ASK IF YOU WANT ALL OR REMOVE ITEMS FROM LIST OF SET--
 I ACHSSIG'="" S ACHSANS=$$DIR^XBDIR("Y","Do you want ALL documents stamped with your Electronic signature ","N","","","",1)
 I $D(DUOUT)!$D(DTOUT) D END Q
 I ACHSANS D LOOP3,END Q
 I 'ACHSANS D RMITMS,ASK
 Q
LIST ;--LIST ONLY THOSE PO W/OUT SIG IN FILE--
 W !,COUNT,?9,$P(ACHSDOC,U,14)_"-"_ACHSFC_"-"_$P(ACHSDOC,U,1) ;Order No
 W ?25,$P(^AUTTVNDR($P(ACHSDOC,U,8),0),U) ;Vendor
 W ?55,$FN($P(ACHSDOC,U,9),",",2) ;Total Amount Obligated
 ;ACHS*3.1*19 ADDED $G TO NEXT LINE
 W !,?9,"CAN-OCC-SCC: ",$P(^ACHS(2,$P(ACHSDOC,U,6),0),U),"-",$P($G(^ACHSOCC($P(ACHSDOC,U,10),0)),U),"-",$P(^ACHS(3,DUZ(2),1,$P(ACHSDOC,U,7),0),U),?50,ACHSLST ;CAN & Obj Class
 ;ITSC/SET/JVK 1/20/04 ACHS*3.1*8
 ;W:$P(ACHSDOC,U,3)'=1 !,?9,$P(^DPT($P(ACHSDOC,U,22),0),U),! ;Patient
 I $P(ACHSDOC,U,3)=0 W !,?9,$P(^DPT($P(ACHSDOC,U,22),0),U),! ;Patient
 I $P(ACHSDOC,U,3) W !,?9,"--Blanket Order/Special Local--",!
 Q
RMITMS ;--REMOVE THE ITEM FROM THE SET--
 S ACHSQUE=$$DIR^XBDIR("L^1:1000","Select the ITEM NO. that you DO NOT want your Electronic signature applied to ","","Enter zero for none.","","",2)
 I ACHSQUE["^" G END Q
 I $D(DUOUT)!$D(DTOUT) G ASK
 ;I Y'=0,'$D(ACHSTMP(DUZ(2),Y)) D RMITMS         ;TEST FOR NUMBERS ALREADY GONE
 ;I Y=0 Q
 S ACHSITM=0
 F ACHSI=1:1 Q:ACHSITM=""  D
 .S ACHSITM=$P(Y,",",ACHSI)
 .Q:ACHSITM=""
 .Q:ACHSITM=0
 .Q:'$D(ACHSTMP(DUZ(2),ACHSITM))
 .K ACHSTMP(DUZ(2),ACHSITM)
 .Q
 Q
LOOP3 ;--STUFF THE USER AND DATE OF ALL AUTHORIZED--
 S COUNT=""
 S ACHSSUM=0
 F  S COUNT=$O(ACHSTMP(DUZ(2),COUNT)) Q:COUNT'?1N.N  D
 .S ACHSDOC=^ACHSF(DUZ(2),"D",$P(ACHSTMP(DUZ(2),COUNT),U),0)
 .S ACHSDIEN=$P(ACHSTMP(DUZ(2),COUNT),U)
 .S ACHSAMT=$P(ACHSTMP(DUZ(2),COUNT),U,2) ;DOCUMENT AMOUNT
 .S ACHSTYPV=$P(ACHSDOC,U,4)
 .I ACHSAMT>ACHSDAMT W !,?5,$P(ACHSDOC,U,14)_"-"_ACHSFC_"-"_$P(ACHSDOC,U,1)," Sorry this document exceeds your delegation of authority",!
 .;ITSC/SET/JVK ADD THE +1 FOR LIMIT LEVEL INCLUSIVE OF VALUE
 .I ACHSAMT<ACHSDAMT+1,'ACHSIADT,'$$DIE^ACHS("13.69////"_DUZ)
 .I ACHSAMT<ACHSDAMT+1,'ACHSIADT,'$$DIE^ACHS("13.7////"_DT)
 .S ACHSSUM=ACHSSUM+1
 .;IF THIS IS MULTI SIG PUT THE VALUE IN THE ACHSF("EAQ" GLOBAL
 .I $P(^ACHSESIG(DUZ(2),0),U,2)=1 S ^ACHSF("EAQ",DUZ(2),ACHSTYPV,ACHSDIEN)=""
 .;ITSC/SET/JVK 11-18-04 IF LOCK FAILED 
 .;K ^ACHSF("EQ",DUZ(2),ACHSTYPV,ACHSDIEN)
 .I $P(^ACHSF(DUZ(2),"D",ACHSDIEN,0),U,24)?1N.N,$P(^(0),U,28)?1N.N K ^ACHSF("EQ",DUZ(2),ACHSTYPV,ACHSDIEN)
 .Q
 W !,?5,ACHSSUM," DOCUMENTS APPROVED",! H 2
 G END
 ;
ASK ;
 S ACHSDONE=""
 W !!?10,"Answering YES will remove items you do not want approved"
 W !?10,"from the viewing list and approve all others.",!
 W !?10,"Answering NO will remove the items you already selected",!
 W ?10,"from the viewing list and allow you to remove additioanl items.",!
 W !?10,"If you do not want to approve anything select all the items or ",!
 W ?10,"enter ^.  This approves nothing.",!!
 S ACHSDONE=$$DIR^XBDIR("Y","ARE YOU DONE"," N","","Enter Y or N.",1)
 I $D(DUOUT)!$D(DTOUT) D END Q
 I 'ACHSDONE D VIEWR^XBLM("PRINT^ACHSSIG1"),RMITMS,ASK Q
 I ACHSDONE D VIEWR^XBLM("LOOP3^ACHSSIG1") Q
HDR ;
 S ACHSPG=ACHSPG+1
 W @IOF,!!,ACHSUSR,?71,"Page",$J(ACHSPG,3),!,$$C^XBFUNC("***  CONTRACT HEALTH MANAGEMENT SYSTEM   ***",80),!!,ACHSLOC,!
 W ACHSTIME,!,ACHST1
 W !!,"ITEM NO.",?9,"PO No.",?25,"Vendor",?50,"Obligation Amt",!,$$REPEAT^XLFSTR("=",79),!
 Q
END ;
 D EN^XBVK("VALM")
 K DIC,DIQ,X1,ACHSDIEN,ACHSAU,ACHSANS,ACHSVAL,ACHSDOC,ACHSTMP(DUZ(2)),ACHSLST,ACHSTYPV,ACHSADT,ACHSTST,COUNT,ACHSSIG,ACHSTYP
 D ^%ZISC
 Q