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

IBJDE1.m

Go to the documentation of this file.
  1. IBJDE1 ;ALB/RB - DM DATA EXTRACTION (MENU OPTIONS/TRANSMIT E-MAIL) ;15-APR-99
  1. ;;2.0;INTEGRATED BILLING;**100,118,123,159,254,244**;21-MAR-94
  1. ;
  1. VPE ; - View/print entries in IB DM EXTRACT DATA file (#351.71).
  1. I '$O(^IBE(351.71,0)) W !!,"There are no entries available.",*7 G ENQ
  1. ;
  1. S DIC="^IBE(351.71,",DIC(0)="AEMQZ",DIC("A")="Enter MONTH/YEAR: "
  1. D ^DIC K DIC G:Y'>0 ENQ S IB0=+Y,IBS=$P(Y(0),U,2),IBDT=Y(0,0)
  1. ;
  1. S DIC="^IBE(351.71,",BY=.01,(FR,TO)=IB0,DHD="W ?0 D VPH^IBJDE1"
  1. S FLDS="[IBJD DM V/P EXTRACTS]",L=0 D EN1^DIP W ! G VPE
  1. ;
  1. VPH ; - Heading for View/Print option.
  1. W "DIAGNOSTIC MEASURES SUMMARY EXTRACTIONS-",IBDT
  1. W " (Status: ",$S(IBS=3:"COMPLETED",IBS=2:"STARTED",1:"ON STANDBY"),")"
  1. W !!,"Summary Line Item",?58,"Total",! F X=1:1:80 W "-"
  1. Q
  1. ;
  1. DER ; - Disable/enable report(s) or extraction process.
  1. W ! S DIR(0)="Y",DIR("B")="NO"
  1. I $D(^IBE(351.7,"DISABLE")) D
  1. .S DIR("A",1)="The DM extract background job has been disabled."
  1. .S DIR("A")=" Do you want to re-enable it"
  1. E S DIR("A")="Do you want to disable the DM extract background job"
  1. D ^DIR K DIR G:Y["^" ENQ I 'Y G DE1
  1. I $D(^IBE(351.7,"DISABLE")) K ^("DISABLE")
  1. E S ^IBE(351.7,"DISABLE")=""
  1. W " ...Done",*7
  1. ;
  1. DE1 ; - List disabled reports, if any.
  1. I $D(^IBE(351.7,"DISABLE")) G ENQ ; DM extract background job disabled.
  1. ;
  1. I $D(^IBE(351.7,"AC",1)) D
  1. .W !!,"These DM reports have been disabled:",!! S X=0
  1. .F S X=$O(^IBE(351.7,"AC",1,X)) Q:'X W ?3,$P($G(^IBE(351.7,X,0)),U),!
  1. E W !!,"There are no disabled DM reports.",!
  1. ;
  1. DE2 S DIR(0)="PO^351.7:AEMQZ",DIR("A")="Enter REPORT NAME"
  1. S DIR("?")="^D DEH^IBJDE1" D ^DIR K DIR I Y'>0 G ENQ
  1. S IB0=+Y,IBFL=$P(Y(0),U,2) W !!,Y(0,0),!
  1. ;
  1. S DIR("A")="Do you want to "_$S(IBFL:"re-en",1:"dis")_"able this report"
  1. S DIR(0)="Y",DIR("B")="NO" D ^DIR K DIR I Y["^"!('Y) W ! G DE2
  1. S DIE="^IBE(351.7,",DR=".02///"_$S('IBFL&(Y):1,1:"@"),DA=IB0
  1. D ^DIE K DA,DIE,DR W " ...Done",*7 G DE1
  1. ;
  1. DEH ; - Help message for disable/enable option.
  1. W !,"Enter the name of the report you want disabled or re-enabled."
  1. W !,"If the report you enter is disabled, the monthly DM extraction"
  1. W !,"process will not collect summary data from the report until you"
  1. W !,"re-enable it again."
  1. Q
  1. ;
  1. RTN ; - Help message for the field ROUTINE (entry point for the reprot)
  1. W !?9,"Enter the entry point for this report. You may enter a program"
  1. W !?9,"name (^ROUTINE), or a specific label of a program (TAG^ROUTINE)"
  1. W !?9,"or you may also leave it blank.",!
  1. W !?9,"Obs: If this field is left blank, it means that the code respon-"
  1. W !?9," sible for extracting the data will be invoked by another"
  1. W !?9," report.",!
  1. Q
  1. ;
  1. MAN1 ; - Manually start DM extraction process.
  1. I $D(^IBE(351.7,"DISABLE")) D G ENQ
  1. .W !!,"The DM extract process has been disabled.",!,*7
  1. S (IBX,X)=0
  1. F S X=$O(^IBE(351.71,X)) Q:'X I $P(^(X,0),U,2)'=3 S IBX=IBX+1
  1. I 'IBX W !,"All DM extracts on file have been transmitted.",!,*7 G ENQ
  1. ;
  1. M1A S DIC="^IBE(351.71,",DIC(0)="AEMQZ",DIC("A")="Enter DM extract date: "
  1. S DIC("S")="I $P(^(0),U,2)'=3" W ! D ^DIC K DIC I Y'>0 G ENQ
  1. S IBDT=+Y,IBN=Y(0),IBDT1=$$M1^IBJDE(IBDT,3),IBST=$P(IBN,U,2)
  1. S DIR("A")="Do you want to start the DM extract process for "_IBDT1
  1. S DIR(0)="Y",DIR("B")="NO" D ^DIR K DIR I 'Y G ENQ
  1. I IBST=2 D G:'Y ENQ
  1. .S DIR(0)="Y",DIR("B")="NO",IBS=$$M1^IBJDE($P(IBN,U,3),3)
  1. .S DIR("A",1)="The extract process for "_IBDT1_" began on "_IBS_"."
  1. .S DIR("A")="Do you want to restart it" W ! D ^DIR K DIR
  1. ;
  1. D BJ^IBJDE ; Start DM extraction background job.
  1. S IBS=$$M1^IBJDE($P($G(^IBE(351.71,IBDT,0)),U,3),3)
  1. W !!,"Extract process started on ",IBS,".",*7 S IBX=IBX-1
  1. I IBX D G:Y M1A
  1. .S DIR("A")="Do you want to start the process for another date"
  1. .S DIR(0)="Y",DIR("B")="NO" D ^DIR K DIR
  1. ;
  1. G ENQ
  1. ;
  1. MAN2 ; - Manually transmit DM extract file.
  1. I $D(^IBE(351.7,"DISABLE")) D G ENQ
  1. .W !!,"The DM extract process has been disabled.",!,*7
  1. S (IBX,X)=0
  1. F S X=$O(^IBE(351.71,X)) Q:'X I $P(^(X,0),U,2)=3 S IBX=IBX+1
  1. I 'IBX D G ENQ
  1. .W !,"All DM extracts on file have NOT been completed.",!,*7
  1. ;
  1. M2A S DIC="^IBE(351.71,",DIC(0)="AEMQZ",DIC("A")="Enter DM extract date: "
  1. S DIC("S")="I $P(^(0),U,2)=3" W ! D ^DIC K DIC I Y'>0 G ENQ
  1. S IBDT=+Y,IBN=Y(0),DIR(0)="Y",DIR("B")="NO"
  1. S DIR("A")="Are you sure you want to transmit for "_$$M1^IBJDE(IBDT,3)
  1. D ^DIR K DIR I 'Y G M2A
  1. M2B S $P(^IBE(351.71,IBDT,0),U,5)="" D XM(IBDT)
  1. I $G(XMZ) W " Done."
  1. E D G:Y M2B
  1. .S DIR(0)="Y",DIR("B")="NO"
  1. .S DIR("A")="The DM extract message failed to transmit...try again"
  1. .W !,*7 D ^DIR K DIR
  1. ;
  1. I IBX D G:Y M2A
  1. .S DIR("A")="Do you want to start the process for another date"
  1. .S DIR(0)="Y",DIR("B")="NO" D ^DIR K DIR I Y S IBX=IBX-1
  1. ;
  1. G ENQ
  1. ;
  1. MSG ; - DM extract reports message (shown when DM Menu is called up).
  1. S IBDT=$$M1^IBJDE(DT,1),IBDT1=$$M1^IBJDE(IBDT,3)
  1. I '$D(^IBE(351.71,IBDT,0)) G ENQ ; No extract data for this month yet.
  1. ;
  1. W @IOF S IBN=$G(^IBE(351.71,IBDT,0)),IBST=$P(IBN,U,2) I 'IBST G ENQ
  1. I IBST=1 D G MSQ
  1. .W !,"The DM extract process for ",IBDT1," was initiated on "
  1. .W $$M1^IBJDE($P(IBN,U,3),3),!,"but it hasn't run yet.",!
  1. ;
  1. I IBST=3 D G ENQ
  1. .W !,"The DM report data for ",IBDT1," has been successfully"
  1. .W !,"extracted on ",$$M1^IBJDE($P(IBN,U,4),3),". This data has been"
  1. .W !,"sent to the Central Collections mail group in FORUM.",*7
  1. ;
  1. S DIC="^IBE(351.71,",BY="[IBJD DM REPT SORT]",FR=IBDT_",1",TO=IBDT_",2"
  1. S DIOEND="I $Y'<(IOSL-14) R X:DTIME",(IOP,L)=0
  1. S DHD="W ?0 D MSH^IBJDE1",FLDS="[IBJD DM REPT PRINT]" D EN1^DIP
  1. ;
  1. MSQ W !,"If you want, you can restart the DM extract process"
  1. W !,"by using the ""Manually Start DM Extraction"" option in"
  1. W !,"the Diagnostic Measures Extract Menu."
  1. G ENQ
  1. ;
  1. MSH ; - DM extract reports message header.
  1. W !,"Data for the following DM reports have not been extracted"
  1. W !," for ",IBDT1,":",!!,*7
  1. Q
  1. ;
  1. CHK ; - Check file #351.71 for completed and/or transmitted DM extracts
  1. ; (shown when DM Extract Menu is called up).
  1. W @IOF,!,"Checking for completed and/or transmitted DM extracts"
  1. K IBX,IBX1 S (IBX,IBX1,IB0)=0
  1. S DT=$$DT^XLFDT
  1. F S IB0=$O(^IBE(351.71,IB0)) Q:'IB0 S IBN=$G(^(IB0,0)) D
  1. .; - Do not process for invalid (day not equal 00 or future) dates
  1. .; and remove data.
  1. .I (+$E(IB0,6,7)>0)!(IB0>DT) D Q
  1. ..W !,"** Invalid date entry found. Entry ("_IB0_") deleted.**",!
  1. ..S DIK="^IBE(351.71,",DA=IB0
  1. ..D ^DIK
  1. .; - Check for missing zero node.
  1. .I IBN="" W !,"Zero node data missing for "_IB0_" entry. Data corruption possible.",! Q
  1. .; - Check for past months missing from file, if any.
  1. .I $O(^IBE(351.71,IB0)) D
  1. ..S IB1=$P(^IBE(351.71,0),U,4),IB2=IB0+$S($E(IB0,4,5)=12:8900,1:100)
  1. ..I $D(^IBE(351.71,"B",IB2,IB2))!(IB2>DT) Q
  1. ..S DIC="^IBE(351.71,",DIC(0)="L",DIC("DR")=".02///1",(DINUM,X)=IB2
  1. ..K DD,DO D FILE^DICN S $P(^IBE(351.71,0),U,4)=IB1+1 K DIC,DINUM,DD,DO
  1. .;
  1. .I $P(IBN,U,2)'=3 S IBX(IB0)="" S:'IBX IBX=1 Q
  1. .E I '$P(IBN,U,5) S IBX1(IB0)="" S:'IBX1 IBX1=1 Q
  1. .W "."
  1. ;
  1. I 'IBX,'IBX1 W "Done" G ENQ
  1. I IBX D
  1. .W !!,"DM data has NOT been fully extracted for these months:",!,*7
  1. .S IB0=0 F S IB0=$O(IBX(IB0)) Q:'IB0 W " ",$$M1^IBJDE(IB0,3)
  1. .W !,"If you want, you can start the DM extract process for these"
  1. .W !,"months by using the ""Manually Start DM Extraction"" option."
  1. ;
  1. I IBX1 D
  1. .W !!,"DM data has NOT been transmitted for these months:",!,*7
  1. .S IB0=0 F S IB0=$O(IBX1(IB0)) Q:'IB0 W " ",$$M1^IBJDE(IB0,3)
  1. .W !,"If you want, you can transmit the DM extract data for these"
  1. .W !,"months by using the ""Manually Transmit DM Extract"" option."
  1. ;
  1. G ENQ
  1. ;
  1. XM(IBDT) ; - Create/transmit DM extract file message.
  1. ;
  1. N DA,DIE,DR,IB0,IB1,IBC,IBDT1,IBMG,IBSTE,X,XMDUZ,XMSUB,XMTEXT
  1. ;
  1. K ^TMP("DME",$J) S IBSTE=$$SITE^VASITE,X=$E(DT,4,7)_(1700+$E(DT,1,3))
  1. S ^TMP("DME",$J,1)="HDR^"_$P(IBSTE,U,3)_U_$P(IBSTE,U,2)_U_X
  1. S IBC=1,IB0=0
  1. F S IB0=$O(^IBE(351.71,IBDT,1,IB0)) Q:'IB0 D
  1. .Q:IB0=37 ; No unbilled report needed
  1. .S X=$S(IB0=8:$$M2^IBJDE(IBDT,5,3,1),1:$$M1^IBJDE(IBDT,2))
  1. .S IBC=IBC+1,^TMP("DME",$J,IBC)="DAT~"_IB0_"~"_$P(X,U)_"~"_$P(X,U,2)
  1. .S IB1=0 F S IB1=$O(^IBE(351.71,IBDT,1,IB0,1,IB1)) Q:'IB1 D
  1. ..S X=$P($G(^IBE(351.71,IBDT,1,IB0,1,IB1,0)),U,2)
  1. ..S ^TMP("DME",$J,IBC)=^TMP("DME",$J,IBC)_U_X
  1. ;
  1. S ^TMP("DME",$J,IBC+1)="END^"_$P(IBSTE,U,3),IBDT1=$$M1^IBJDE(IBDT,3)
  1. S XMSUB="DIAG. MEASURES EXTRACT FILE-"_IBDT1_" ("_$P(IBSTE,U,2)_")"
  1. ;
  1. S IBMG=$P($G(^IBE(350.9,1,4)),U,5) I IBMG="" G ENQ:'$G(IBX),ENQ1
  1. ;
  1. S XMDUZ="INTEGRATED BILLING PACKAGE"
  1. S XMTEXT="^TMP(""DME"",$J,",XMY(IBMG)=""
  1. D SEND
  1. I $G(XMZ) S DIE="^IBE(351.71,",DA=IBDT,DR=".05///1;.06///"_XMZ D ^DIE
  1. ;
  1. I $G(IBX) G ENQ1 ; Return to DME manual transmit option.
  1. ;
  1. ENQ K IB2,IBDT2,IBD1,IBD2,IBDT,IBFL,IBFR,IBN,IBS,IBST,IBST1,IBX,IBX1,BY,DHD
  1. K DIC,DIOEND,FLDS,FR,IOP,L,TO,X,XMZ,Y,%
  1. ENQ1 K IB0,IB1,IBC,IBDT1,IBMG,IBSTE,XMSUB,XMTEXT,XMY,^TMP("DME",$J)
  1. Q
  1. ;
  1. SEND ; Calls ^XMD to send the mail message with the data extracted
  1. ; Obs: By NEWing DUZ, ^XMD will assume DUZ=.5 (Sender=POSTMASTER)
  1. ;
  1. N DUZ D ^XMD
  1. Q