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

BPCNOTEC.m

Go to the documentation of this file.
BPCNOTEC ; IHS/OIT/MJL - FHL-6/14/96 - ADD,DELETE OR EDIT PROBLEM NOTE ;
 ;;1.5;BPC;;MAY 26, 2005
 ;
NOTEDIT(RESULT,BPCFLAG,BPCPARAM) ;EP CALL FROM REMOTE PROC: BPC EDITNOTE
EN ;
 S U="^",XWBWRAP=1 K RESULT
 S BPCFLAG=$G(BPCFLAG),BPCPARAM=$G(BPCPARAM)
 I BPCFLAG="" S RESULT(1)=-1,RESULT(2)="NO EDIT FLAG RECEIVED!" D KILL Q
 I BPCPARAM="" S RESULT(1)=-1,RESULT(2)="NO PARAMETERS RECEIVED!" D KILL Q
 I $L(BPCPARAM,";")'=8 S RESULT(1)=-1,RESULT(2)="WRONG NUMBER OF DATA ITEMS SENT ("_$L(BPCPARAM,";")_"). 8 ITEMS EXPECTED!" D KILL Q
 I "AED"'[BPCFLAG S RESULT(1)=-1,RESULT(2)="PROPER EDIT FLAG NOT SENT!" D KILL Q
 D:BPCFLAG="A" ADD D:BPCFLAG="E" EDIT D:BPCFLAG="D" DELETE D KILL
 Q
KILL ;
 K BPCPRIEN,BPCLOCN,BPCNARR,BPCSTAT,BPCDENT,BPCLIEN,BPCNIEN,BPCCTR,BPCERR,BPCIENS,BPCX,BPCPLIEN,BPCNBR,BPCPRID,BPCNOTID,BPCNOTN
 Q
ADD ;
 S BPCPRIEN=$P(BPCPARAM,";",1,1),BPCLOCN=$P(BPCPARAM,";",3,3),BPCNARR=$P(BPCPARAM,";",5,5),BPCSTAT=$P(BPCPARAM,";",6,6)
 I BPCLOCN="" S RESULT(1)=-1,RESULT(2)="NO LOCATION SENT!" Q
 S BPCDENT=DT,BPCLIEN=$O(^DIC(4,"B",BPCLOCN,"")),BPCNIEN=""
 I BPCPRIEN="" S RESULT(1)=-1,RESULT(2)="NO PROBLEM IEN SENT!" Q
 I '$D(^AUPNPROB(BPCPRIEN,0)) S RESULT(1)=-1,RESULT(2)="PROBLEM IEN SENT IS NOT DEFINED!" Q
 I BPCLIEN="" S RESULT(1)=-1,RESULT(2)="UNKNOWN LOCATION SENT!" Q
 I $D(^AUPNPROB(BPCPRIEN,11,"B",BPCLIEN)) S BPCNIEN=$O(^AUPNPROB(BPCPRIEN,11,"B",BPCLIEN,""))
 E  D GETNIEN
 I BPCNIEN="" S RESULT(1)=-1,RESULT(2)="UNABLE TO GET NOTE IEN!" Q
 S BPCCTR=$P($G(^AUPNPROB(BPCPRIEN,11,BPCNIEN,11,0)),U,3)+1
 S BPCERR=0 D ADDNOTE
 I BPCERR S RESULT(1)=-1,RESULT(2)="UNABLE TO ADD NOTE!" Q
 D SETRES
 Q
ADDNOTE ;
 L +^AUPNPROB(BPCPRIEN,0):10 I '$T Q
 K BPCFDA,BPCEMSG S BPCFDR="BPCFDA(1)"
 S BPCFDA(1,"9000011.11","?1,"_BPCPRIEN_",",.01)=BPCLIEN
 S BPCIENS="+2,?1,"_BPCPRIEN_","
 S BPCFDA(1,"9000011.1111",BPCIENS,.01)=BPCCTR
 S BPCFDA(1,"9000011.1111",BPCIENS,.03)=BPCNARR
 S BPCFDA(1,"9000011.1111",BPCIENS,.04)=BPCSTAT
 S BPCFDA(1,"9000011.1111",BPCIENS,.05)=BPCDENT
 S BPCFDA(1,"9000011.1111",BPCIENS,.06)=DUZ
 D UPDATE^DIE("",BPCFDR,"","BPCEMSG")
 I $D(BPCEMSG("DIERR")) S BPCERR=1
 L -^AUPNPROB(BPCPRIEN,0)
 Q
EDNOTE ;
 L +^AUPNPROB(BPCPRIEN,0):10 I '$T Q
 K BPCFDA,BPCEMSG S BPCFDR="BPCFDA(1)"
 S BPCIENS=BPCNOTN_","_BPCNIEN_","_BPCPRIEN_","
 S BPCFDA(1,"9000011.1111",BPCIENS,.01)=BPCNOTN
 S BPCFDA(1,"9000011.1111",BPCIENS,.03)=BPCNARR
 S BPCFDA(1,"9000011.1111",BPCIENS,.04)=BPCSTAT
 ;S BPCFDA(1,"9000011.1111",BPCIENS,.05)=BPCDENT
 S BPCFDA(1,"9000011.1111",BPCIENS,.06)=DUZ
 D FILE^DIE("",BPCFDR,"BPCEMSG")
 I $D(BPCEMSG("DIERR")) S BPCERR=1
 S BPCCTR=BPCNOTN
 L -^AUPNPROB(BPCPRIEN,0)
 Q
SETRES ;
 S BPCX=^AUPNPROB(BPCPRIEN,0),BPCPLIEN=$P(BPCX,U,6),BPCNBR=$P(BPCX,U,7)
 S BPCPRID=$P(^AUTTLOC(BPCPLIEN,0),U,7),BPCPRID=$S(BPCPRID="":"UK",1:BPCPRID)_BPCNBR
 S BPCNOTID=$P(^AUTTLOC(BPCLIEN,0),U,7)_BPCCTR
 S BPCX=BPCNIEN_U_BPCNOTID_U_BPCLIEN_U_BPCCTR_U_U_BPCNARR_U_BPCSTAT_U_BPCDENT_U_DUZ
 S RESULT(1)=1,RESULT(2)=BPCX
 Q
GETNIEN ;GET NOTE IEN
 L +^AUPNPROB(BPCPRIEN,0):10 I '$T Q
 K BPCFDA,BPCEMSG S BPCFDR="BPCFDA(1)"
 S BPCIENS="+1,"_BPCPRIEN_","
 S BPCFDA(1,"9000011.11",BPCIENS,.01)=BPCLIEN
 D UPDATE^DIE("",BPCFDR,"","BPCEMSG")
 I '$D(BPCEMSG("DIERR")) D GNIEN1
 L -^AUPNPROB(BPCPRIEN,0)
 Q
GNIEN1 ;
 S BPCNIEN=$P(^AUPNPROB(BPCPRIEN,11,0),U,3)
 Q
EDIT ;
 S BPCPRIEN=$P(BPCPARAM,";",1),BPCNIEN=$P(BPCPARAM,";",2),BPCNOTN=$P(BPCPARAM,";",4),BPCNARR=$P(BPCPARAM,";",5),BPCSTAT=$P(BPCPARAM,";",6)
 S BPCLOCN=$P(BPCPARAM,";",3)
 S BPCLIEN=$S(BPCLOCN'="":$O(^DIC(4,"B",BPCLOCN,"")),1:DUZ(2))
 I BPCPRIEN="" S RESULT(1)=-1,RESULT(2)="NO PROBLEM IEN SENT!" Q
 I BPCNIEN="" S RESULT(1)=-1,RESULT(2)="NO NOTE IEN SENT!" Q
 I BPCNOTN="" S RESULT(1)=-1,RESULT(2)="NO NOTE NUMBER SENT!" Q
 I '$D(^AUPNPROB(BPCPRIEN,11,BPCNIEN,11,BPCNOTN,0)) S RESULT(1)=-1,RESULT(2)="NOTE DOES NOT EXIST!" Q
 S BPCDENT=$P(^AUPNPROB(BPCPRIEN,11,BPCNIEN,11,BPCNOTN,0),U,5)
 S BPCERR=0 D EDNOTE
 I BPCERR S RESULT(1)=-1,RESULT(2)="NOTE UNABLE TO BE EDITED!" Q
 D SETRES
 Q
DELETE ;
 S BPCPRIEN=$P(BPCPARAM,";",1,1),BPCNIEN=$P(BPCPARAM,";",2,2),BPCNOTN=$P(BPCPARAM,";",4,4),BPCNOTID=$P(BPCPARAM,";",8,8)
 I BPCPRIEN="" S RESULT(1)=-1,RESULT(2)="NO PROBLEM IEN SENT!" Q
 I BPCNIEN="" S RESULT(1)=-1,RESULT(2)="NO NOTE IEN SENT!" Q
 I BPCNOTN="" S RESULT(1)=-1,RESULT(2)="NO NOTE NUMBER SENT!" Q
 I BPCNOTID="" S RESULT(1)=-1,RESULT(2)="NO NOTE ID SENT!" Q
 S DA=BPCNOTN,DA(1)=BPCNIEN,DA(2)=BPCPRIEN,DIK="^AUPNPROB("_DA(2)_",11,"_DA(1)_",11,"
 D ^DIK S RESULT(1)=1,RESULT(2)="NOTE "_BPCNOTID_" DELETED!"
 Q