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

PSOSPMB3.m

Go to the documentation of this file.
  1. PSOSPMB3 ;BIRM/MFR - ASAP Definitions Listman Actions Handler (Cont.) ;11/11/15
  1. ;;7.0;OUTPATIENT PHARMACY;**451**;DEC 1997;Build 114
  1. ;
  1. DELCUS ; Handles the 'Delete Customizatoin' Action
  1. N CUSTYPE,DIR,DTOUT,DIRUT,VERLST,X,Y,STDASAP,CUSASAP,SEGID,ELMID,ELMPOS,SEG,ELM,DONE,STOP,I,J
  1. N CNT,CHILDREN,STDVDLMS,ALLVDLMS
  1. I PSOASVER="1995" S VALMSG="ASAP 1995 Version cannot be customized" W $C(7) G EXIT^PSOSPMA3
  1. I '$$SECKEY^PSOSPMA3() G EXIT^PSOSPMA3
  1. I '$$LOCK^PSOSPMA3() G EXIT^PSOSPMA3
  1. S CUSTYPE=0
  1. D FULL^VALM1
  1. K DIR S DIR("A")="Customization Selection",DIR(0)="SO^"
  1. S STDVDLMS=$$VERDATA^PSOSPMU0(PSOASVER,"S"),ALLVDLMS=$$VERDATA^PSOSPMU0(PSOASVER,"B")
  1. I STDVDLMS'="",STDVDLMS'=ALLVDLMS D
  1. . S DIR(0)=DIR(0)_"D:ASAP "_PSOASVER_" Delimiters (Restore);"
  1. S DIR(0)=DIR(0)_"V:ASAP "_PSOASVER_" Version;S:ASAP "_PSOASVER_" Segment;E:ASAP "_PSOASVER_" Data Element"
  1. S DIR("?")="Select the customization to be deleted."
  1. D ^DIR I (X="")!$D(DIRUT)!$D(DTOUT) G BACK^PSOSPMA3
  1. S CUSTYPE=Y
  1. ;
  1. ; Restore ASAP Version Delimiters
  1. I CUSTYPE="D" D G BACK^PSOSPMA3
  1. . W !!,"The customization for the ASAP Version '",PSOASVER,"' delimiters will be deleted and the"
  1. . W !,"standard delimiters will be restored to the following:",!
  1. . W:$P(STDVDLMS,"^",2)'=$P(ALLVDLMS,"^",2) !?3,"Element Delimiter ('",$P(STDVDLMS,"^",2),"')"
  1. . W:$P(STDVDLMS,"^",3)'=$P(ALLVDLMS,"^",3) !?3,"Segment Terminator ('",$P(STDVDLMS,"^",3),"')"
  1. . W:$P(STDVDLMS,"^",4)'=$P(ALLVDLMS,"^",4) !?3,"End Of Line Escape (",$S($P(STDVDLMS,"^",4)="":"<NULL>",1:"'"_$P(STDVDLMS,"^",4)_"'"),")"
  1. . W ! S X=$$ASKFLD^PSOSPMA3("Y","NO","Confirm Deletion") I X'=1 Q
  1. . W ?40,"Restoring..." D SAVEVER^PSOSPMU3(PSOASVER,$$VERDATA^PSOSPMU0(PSOASVER,"S")) H 1 W "OK",$C(7)
  1. ;
  1. ; Delete ASAP Version
  1. I CUSTYPE="V" D G BACK^PSOSPMA3
  1. . D LOADASAP^PSOSPMU0(PSOASVER,"S",.STDASAP) ; Standard ASAP Definition
  1. . D LOADASAP^PSOSPMU0(PSOASVER,"C",.CUSASAP) ; Custom ASAP Definition
  1. . I $G(STDASAP)="",$$VERINUSE(PSOASVER) D Q
  1. . . W !!,"ASAP Version ",PSOASVER," is being used by ",$$GET1^DIQ(5,$$VERINUSE(PSOASVER),.01)," and cannot be deleted.",$C(7)
  1. . . D PAUSE^PSOSPMU1
  1. . W !!," ASAP Version: ",PSOASVER
  1. . I $G(STDASAP)'="" D
  1. . . W !!,"The customization for the ASAP Version '",PSOASVER,"' and all of its custom Segments,"
  1. . . W !,"Data Elements and Delimiters will be deleted and the standard definition"
  1. . . W !,"will be restored.",!
  1. . E D
  1. . . W !!,"The custom ASAP Version '",PSOASVER,"' and all of its Segments and Data Elements"
  1. . . W !,"will be deleted.",!
  1. . I STDVDLMS'="" D
  1. . . W:$P(STDVDLMS,"^",2)'=$P(ALLVDLMS,"^",2) !?3,"Element Delimiter ('",$P(ALLVDLMS,"^",2),"')"
  1. . . W:$P(STDVDLMS,"^",3)'=$P(ALLVDLMS,"^",3) !?3,"Segment Terminator ('",$P(ALLVDLMS,"^",3),"')"
  1. . . W:$P(STDVDLMS,"^",4)'=$P(ALLVDLMS,"^",4) !?3,"End Of Line Escape (",$S($P(ALLVDLMS,"^",4)="":"<NULL>",1:"'"_$P(ALLVDLMS,"^",4)_"'"),")"
  1. . S (STOP,CNT)=3,SEG="999" F S SEG=$O(CUSASAP(SEG)) Q:SEG="" D I STOP="^" Q
  1. . . I $$CUSSEG^PSOSPMU3(PSOASVER,SEG) W !?3,$P(CUSASAP(SEG),"^",1),?12,$P(CUSASAP(SEG),"^",2) S CNT=CNT+1
  1. . . S ELM=0 F S ELM=$O(CUSASAP(SEG,ELM)) Q:'ELM D I STOP="^" Q
  1. . . . W !?3,$P(CUSASAP(SEG,ELM),"^",1),?12,$P(CUSASAP(SEG,ELM),"^",2) S CNT=CNT+1
  1. . . . I (CNT>22) S STOP=$$ASKFLD^PSOSPMA3("E",,"Enter <RET> to continue or '^' to STOP"),CNT=0
  1. . W ! S X=$$ASKFLD^PSOSPMA3("Y","NO","Confirm Deletion") I X'=1 Q
  1. . W ?40,"Deleting..." D DELCUS^PSOSPMU3(PSOASVER) H 1 W "OK",$C(7)
  1. ;
  1. ; Delete ASAP Segment
  1. I CUSTYPE="S" D G BACK^PSOSPMA3
  1. . D LOADASAP^PSOSPMU0(PSOASVER,"S",.STDASAP) ; Standard ASAP Definition
  1. . D LOADASAP^PSOSPMU0(PSOASVER,"C",.CUSASAP) ; Custom ASAP Definition
  1. . W !!,"ASAP Version ",PSOASVER
  1. . K DIR S DIR("?",1)="Enter the Custom ASAP Segment ID that you want to delete."
  1. . S DIR("?",2)=" ",DIR("?",3)=" Choose from:"
  1. . S (STOP,CNT)=0,SEG="999",CNT=4 F S SEG=$O(CUSASAP(SEG)) Q:SEG="" D
  1. . . S DIR("?",CNT)=" "_SEG_" "_$P(CUSASAP(SEG),"^",2),CNT=CNT+1
  1. . S DIR("?")=" ",DIR(0)="FO^1:5",DIR("A")="SEGMENT ID"
  1. . S SEGID="",DONE=0 F W ! D ^DIR Q:($D(DIRUT)!$D(DTOUT))!(X="") D I DONE Q
  1. . . S:'$D(CUSASAP(X)) X=$$UP^XLFSTR(X) I '$D(CUSASAP(X)) W !,"Custom Segment not found!",$C(7) Q
  1. . . K CHILDREN I '$D(STDASAP(X)) D I $O(CHILDREN(""))'="" Q
  1. . . . S SEG="999" F S SEG=$O(CUSASAP(SEG)) Q:SEG="" I $P(CUSASAP(SEG),"^",3)=X S CHILDREN(SEG)=""
  1. . . . I $O(CHILDREN(""))'="" D
  1. . . . . W !!,"The following custom children ASAP Segments must be deleted first:",!,$C(7)
  1. . . . . S SEG="" F S SEG=$O(CHILDREN(SEG)) Q:SEG="" W !?3,SEG,?12,$P(CUSASAP(SEG),"^",2)
  1. . . S SEGID=X W " ",$P(CUSASAP(SEGID),"^",2) S DONE=1
  1. . I 'DONE Q
  1. . I $D(STDASAP(SEGID)) D
  1. . . W !!,"The customization for the Segment '",SEGID,"' and all of its custom Data Elements"
  1. . . W !,"will be deleted and the standard definition will be restored.",!
  1. . E D
  1. . . W !!,"The custom Segment '",SEGID,"' and all of its Data Elements will be deleted.",!
  1. . S STOP="",(ELM,CNT)=0 F S ELM=$O(CUSASAP(SEGID,ELM)) Q:ELM="" D
  1. . . W !?3,$P(CUSASAP(SEGID,ELM),"^",1),?12,$P(CUSASAP(SEGID,ELM),"^",2) S CNT=CNT+1
  1. . . I (CNT>18) S STOP=$$ASKFLD^PSOSPMA3("E",,"Enter <RET> to continue or '^' to STOP"),CNT=0
  1. . W ! S X=$$ASKFLD^PSOSPMA3("Y","NO","Confirm Deletion") I X'=1 Q
  1. . W ?40,"Deleting..." D DELCUS^PSOSPMU3(PSOASVER,SEGID) H 1 W "OK",$C(7)
  1. ;
  1. ; Delete ASAP Data Element
  1. I CUSTYPE="E" D G BACK^PSOSPMA3
  1. . D LOADASAP^PSOSPMU0(PSOASVER,"S",.STDASAP) ; Standard ASAP Definition
  1. . D LOADASAP^PSOSPMU0(PSOASVER,"C",.CUSASAP) ; Custom ASAP Definition
  1. . W !!,"ASAP Version ",PSOASVER
  1. . K DIR S DIR("?",1)="Enter the Custom ASAP Data Element that you want to delete."
  1. . S DIR("?",2)=" ",DIR("?",3)=" Choose from:"
  1. . S SEG="999",CNT=4 F S SEG=$O(CUSASAP(SEG)) Q:SEG="" D
  1. . . S ELM=0 F S ELM=$O(CUSASAP(SEG,ELM)) Q:'ELM D
  1. . . . S DIR("?",CNT)=" "_$P(CUSASAP(SEG,ELM),"^")_" "_$P(CUSASAP(SEG,ELM),"^",2),CNT=CNT+1
  1. . S DIR("?")=" ",DIR(0)="FO^1:10",DIR("A")="DATA ELEMENT ID"
  1. . S DONE=0 F W ! D ^DIR Q:($D(DIRUT)!$D(DTOUT))!(X="") D I DONE Q
  1. . . I '$D(CUSASAP($$GETSEGID^PSOSPMU3(X))) S X=$$UP^XLFSTR(X)
  1. . . S SEGID=$$GETSEGID^PSOSPMU3(X),ELMPOS=+$P(X,SEGID,2)
  1. . . I '$D(CUSASAP(SEGID,ELMPOS)) W !,"Custom Data Element not found!",$C(7) Q
  1. . . I $D(CUSASAP(SEGID,ELMPOS+1)),'$D(STDASAP(SEGID,ELMPOS+1)) D Q
  1. . . . W !,"Only the last Custom Data Element in the Segment can be deleted.",$C(7)
  1. . . W " ",$P(CUSASAP(SEGID),"^",2) S DONE=1
  1. . I 'DONE Q
  1. . I $D(STDASAP(SEGID,ELMPOS)) D
  1. . . W !!,"The customization for the Data Element '",$P(STDASAP(SEGID,ELMPOS),"^"),"' will be deleted and the"
  1. . . W !,"standard definition will be restored.",!
  1. . E D
  1. . . W !!,"The custom Data Element '",$P(CUSASAP(SEGID,ELMPOS),"^",1),"' will be deleted.",!
  1. . S X=$$ASKFLD^PSOSPMA3("Y","NO","Confirm Deletion") I X'=1 Q
  1. . W ?40,"Deleting..." D DELCUS^PSOSPMU3(PSOASVER,SEGID,$P(CUSASAP(SEGID,ELMPOS),"^",1)) H 1 W "OK",$C(7)
  1. G BACK^PSOSPMA3
  1. ;
  1. VERINUSE(PSOASVER) ; Verify whether the ASAP Version is in use or not
  1. ; Input: (r) PSOASVER - Source ASAP Version to be cloned (3.0, 4.0, 4.1, 4.2)
  1. ;Output: $$VERINUSE - Pointer to first the STATE file (#5) that is using the ASAP Version
  1. N STATE,VERINUSE
  1. S (STATE,VERINUSE)=0 F S STATE=$O(^PS(58.41,STATE)) Q:'STATE D I VERINUSE Q
  1. . I $$GET1^DIQ(58.41,STATE,1,"I")=PSOASVER S VERINUSE=STATE
  1. Q VERINUSE