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

PRCSC1.m

Go to the documentation of this file.
  1. PRCSC1 ;WISC/LEM-ESIG MAINTENANCE ROUTINE ;4/23/97 8:55 AM
  1. V ;;5.1;IFCAP;**120**;Oct 20, 2000;Build 27
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;ROUTINE FOR MAINTAINING FIELD 44.5 (ELECTRONIC SIGNATURE), FILE 410
  1. DECODE(LEVEL0) ;Extrinsic Function to return hashed electronic sig to readable form.
  1. ;returns "" if unsuccessful
  1. NEW RECORD7,RECORD71,VERSION,PERSON,SIG,CHECKSUM
  1. ;get record and check version
  1. S RECORD7=$G(^PRCS(410,LEVEL0,7)) I RECORD7="" QUIT ""
  1. S RECORD71=$G(^PRCS(410,LEVEL0,7.1))
  1. S VERSION=$P(RECORD71,"^",3)
  1. S PERSON=+$P(RECORD7,"^",3)
  1. I VERSION'="",VERSION'=1 Q ""
  1. S SIG=$P(RECORD7,"^",6)
  1. I VERSION=1 G D1
  1. D ;decode e signature less than version 1
  1. S X=$$DECODE^PRCUESIG(SIG,LEVEL0,PERSON)
  1. QUIT X
  1. D1 ;decode e signature for version 1
  1. S RECORD=$G(^PRCS(410,LEVEL0,0))
  1. S RECORD1=$G(^PRCS(410,LEVEL0,1))
  1. S RECORD2=$G(^PRCS(410,LEVEL0,2))
  1. S RECORD3=$G(^PRCS(410,LEVEL0,3))
  1. S RECORD4=$G(^PRCS(410,LEVEL0,4))
  1. S RECORD10=$G(^PRCS(410,LEVEL0,10))
  1. S CHECKSUM=$$SUM^PRCUESIG(LEVEL0_"^"_$$STRING(RECORD,RECORD1,RECORD2,RECORD3,RECORD4,RECORD7,RECORD10))
  1. QUIT $$DECODE^PRCUESIG(SIG,PERSON,CHECKSUM)
  1. ENCODE(LEVEL0,USERNUM,Y) ;Encode e signature for version 1 only
  1. ;Parameter passing entry point
  1. NEW RECORD,RECORD7,RECORD71,SIGBLOCK,CHECKSUM,OLDUSER
  1. ;get record
  1. S USERNUM=+USERNUM
  1. I USERNUM=0 S Y=-3 QUIT ;-3 no user num available
  1. S SIGBLOCK=$P($G(^VA(200,USERNUM,20)),"^",2)
  1. I SIGBLOCK="" S Y=-2 QUIT ;-2 no sigblock in file 200
  1. S RECORD=$G(^PRCS(410,LEVEL0,0))
  1. S RECORD1=$G(^PRCS(410,LEVEL0,1))
  1. S RECORD2=$G(^PRCS(410,LEVEL0,2))
  1. S RECORD3=$G(^PRCS(410,LEVEL0,3))
  1. S RECORD4=$G(^PRCS(410,LEVEL0,4))
  1. S RECORD7=$G(^PRCS(410,LEVEL0,7))
  1. S RECORD71=$G(^PRCS(410,LEVEL0,7.1))
  1. S RECORD10=$G(^PRCS(410,LEVEL0,10))
  1. I RECORD="" S Y=-1 QUIT ;-1 no transaction record
  1. I $P(RECORD7,"^",6)'="" S Y=-4 QUIT ;-4 cannot re-sign record
  1. S OLDUSER=+$P(RECORD7,"^",3)
  1. I OLDUSER=0 S $P(RECORD7,"^",3)=USERNUM
  1. I OLDUSER>0 S USERNUM=OLDUSER
  1. ;PRC*5.1*120 will check FCP EDI switch and ALL/DELIVERY ORDER switch to recode record due to auto obligation
  1. I $P($G(XQY0),"^")'="PRCSENRB",$P($G(XQY0),"^")'="PRCSANTN",$P($G(XQY0),"^")'="PRCSRI GENERATE",$P($G(XQY0),"^")'="PRCSEDTD",$P($G(XQY0),"^")'="PRCSAPP" D
  1. . I $G(PRCHDELV),'$G(AUTOOBLG) Q
  1. . I $P(RECORD4,"^",4)="" S $P(RECORD4,"^",4)=$P($$NOW^PRCUESIG,".",1),^PRCS(410,LEVEL0,4)=RECORD4
  1. . I '$D(PRC("CP")),$D(PRCB("CP")) S CPSW=1,PRC("CP")=PRCB("CP")
  1. . I $D(PRC("CP")) I ($P($G(^PRC(420,+PRC("SITE"),1,+PRC("CP"),6)),U)="Y")!($P($G(^PRC(420,+PRC("SITE"),3)),U)="Y")!($P($G(^PRC(420,+PRC("SITE"),3)),U,2)'="")!($P($G(^PRC(420,+PRC("SITE"),1,+PRC("CP"),6)),U,2)'="") D
  1. .. Q:$G(PRCHAMDA)=32
  1. .. D ENCODE^PRCSC2(LEVEL0,USERNUM)
  1. . I $G(CPSW)=1 K PRC("CP"),CPSW
  1. S:$P(RECORD7,"^",7)="" $P(RECORD7,"^",7)=$$NOW^PRCUESIG
  1. S:$P(RECORD7,"^",5)="" $P(RECORD7,"^",5)=$P($$NOW^PRCUESIG,".",1)
  1. S CHECKSUM=$$SUM^PRCUESIG(LEVEL0_"^"_$$STRING(RECORD,RECORD1,RECORD2,RECORD3,RECORD4,RECORD7,RECORD10))
  1. S $P(RECORD7,"^",6)=$$ENCODE^PRCUESIG(SIGBLOCK,USERNUM,CHECKSUM)
  1. S $P(RECORD7,"^",4)=$P($G(^VA(200,USERNUM,20)),"^",3)
  1. S $P(RECORD71,"^",3,4)="1^"_$$SUM^PRCUESIG(SIGBLOCK)
  1. S ^PRCS(410,LEVEL0,7)=RECORD7
  1. S ^PRCS(410,LEVEL0,7.1)=RECORD71
  1. S Y=1 QUIT
  1. RECODE(LEVEL0,Y) ;Recode esig for version 1 only
  1. NEW RECORD,RECORD7,RECORD71,SIGBLOCK,CHECKSUM
  1. NEW DA,DIC,RECORD1,RECORD10,RECORD2,RECORD3,RECORD4,USERNUM
  1. S RECORD=$G(^PRCS(410,LEVEL0,0))
  1. S RECORD1=$G(^PRCS(410,LEVEL0,1))
  1. S RECORD2=$G(^PRCS(410,LEVEL0,2))
  1. S RECORD3=$G(^PRCS(410,LEVEL0,3))
  1. S RECORD4=$G(^PRCS(410,LEVEL0,4))
  1. S RECORD7=$G(^PRCS(410,LEVEL0,7))
  1. S RECORD71=$G(^PRCS(410,LEVEL0,7.1))
  1. S RECORD10=$G(^PRCS(410,LEVEL0,10))
  1. I RECORD="" S Y=-1 QUIT ;-1 no transaction record
  1. S USERNUM=+$P(RECORD7,"^",3)
  1. I $P(RECORD7,"^",6)=""!(USERNUM=0) S Y=-4 QUIT ;-4 cannot re-sign record
  1. S SIGBLOCK=$P($G(^VA(200,USERNUM,20)),"^",2)
  1. S CHECKSUM=$$SUM^PRCUESIG(LEVEL0_"^"_$$STRING(RECORD,RECORD1,RECORD2,RECORD3,RECORD4,RECORD7,RECORD10))
  1. S $P(RECORD7,"^",6)=$$ENCODE^PRCUESIG(SIGBLOCK,USERNUM,CHECKSUM)
  1. S $P(RECORD7,"^",4)=$P($G(^VA(200,USERNUM,20)),"^",3)
  1. S $P(RECORD71,"^",3,4)="1^"_$$SUM^PRCUESIG(SIGBLOCK)
  1. S ^PRCS(410,LEVEL0,7)=RECORD7
  1. S ^PRCS(410,LEVEL0,7.1)=RECORD71
  1. S Y=1 QUIT
  1. REMOVE(LEVEL0) ;Entry point to remove e signature from record
  1. ;NOT an extrinsic function
  1. NEW RECORD7,RECORD71
  1. S RECORD7=$G(^PRCS(410,LEVEL0,7))
  1. S RECORD71=$G(^PRCS(410,LEVEL0,7.1))
  1. S $P(RECORD7,"^",3,7)="^^^^"
  1. S $P(RECORD71,"^",4)=""
  1. S ^PRCS(410,LEVEL0,7)=RECORD7
  1. S ^PRCS(410,LEVEL0,7.1)=RECORD71
  1. QUIT
  1. VERIFY(LEVEL0) ;extrinsic function to verify version 1 signature. Returns 1 if valid, 0 if not valid
  1. NEW RECORD71,VERSION,SIGBLOCK
  1. ;get record variables
  1. S RECORD71=$G(^PRCS(410,LEVEL0,7.1))
  1. S VERSION=$P(RECORD71,"^",3),SIGBLOCK=$P(RECORD71,"^",4)
  1. I VERSION_SIGBLOCK="" QUIT 1
  1. QUIT ($$SUM^PRCUESIG($$DECODE(LEVEL0))=SIGBLOCK)
  1. STRING(X,X1,X2,X3,X4,X7,X10) ;Build String of critical fields
  1. Q $P(X,"^",1)_"^"_$P(X1,"^",1)_"^"_$P(X2,"^",1)_"^"_$P(X3,"^",1)_"^"_$P(X3,"^",3)_"^"_$P(X4,"^",1)_"^"_$P(X7,"^",7)_"^"_$P(X10,"^",1)