source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCFACBT.m@ 1800

Last change on this file since 1800 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1PRCFACBT ;WISC/CTB/CLH-BACKGROUND RELEASE OF CODE SHEETS ;5/18/93 08:37
2V ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;PRCF("BTCH") - required and equal to batch number
5 ;PRCFASYS - required and equal to the system identifier
6 ;PRC(* - required and equal to standard system-wide variables returned
7 ; in ^PRCFSITE
8 N B,PBATN,PBAT,DIE,BY,FR,TO,FLDS,PRCFKEY,PRCFRT,X,DIC,%,PBAT,PTRN,PTR,ADD,%I,%Y,DA,ISYS,I,L,N,PRCOUT,PTYP,X9,XCNP,XMDUZ,XMHOLD,XMZ,Y,ZN,ZTREQ,ZTSK
9 D NOW^%DTC S PRCFKEY=%_"-"_DUZ
10 S PRCFRT=0,X=PRCF("BTCH")
11 S DIC=421.2,DIC(0)="XMN",DIC("S")="S XXX=^(0) I $P(XXX,U,4)="""",$P(XXX,U,3)=""B"",PRCFASYS[$P(XXX,""-"",2),+XXX=PRC(""SITE"")"
12 D ^DIC K DIC,XXX I Y<0 S PRCOUT=1 G OUT
13 S PBAT=$P(Y,U,2),PBATN=+Y S $P(^PRCF(421.2,PBATN,0),"^",15)=PRCFKEY,^PRCF(421.2,"AD",PRCFKEY,PBATN)=""
14 I '$D(^PRCF(421.2,"AD",PRCFKEY)) S PRCOUT=1 G OUT
15 ;
16 N PBATN,PBAT,DIE,BY,FR,TO,FLDS
17 K ^TMP("PRCFBTCH",$J)
18 D DT^DICRW
19 F S PBATN=$O(^PRCF(421.2,"AD",PRCFKEY,0)) Q:+PBATN=0 S PBAT=$P(^PRCF(421.2,PBATN,0),"^") D K ^PRCF(421.2,"AD",PRCFKEY,PBATN) S $P(^PRCF(421.2,PBATN,0),"^",15)="",I=1
20 .I $D(^PRCF(423,"AD",PBAT)) S N=0 F S N=$O(^PRCF(423,"AD",PBAT,N)) Q:N'=+N S ^PRCF(423,"AK",PRCFKEY,N)="",$P(^PRCF(423,N,"TRANS"),"^",11)=PRCFKEY D:"ISMPRC"[PRCFASYS ^PRCFAIS D:"FEEFENLOGCAPIRS"[PRCFASYS TX2^PRCFAIS Q
21 .I $G(PRCOUT)]"",PRCOUT=1 Q
22 .Q:+PBATN'>0
23 .S DA=PBATN
24 .S:$G(P)]"" PX=P
25 .D NOW^%DTC
26 .S XDT=%
27 .S X1=$P(PRC("PER"),"^",2)
28 .S $P(^PRCF(421.2,DA,0),"^",4+PRCFRT)=XDT
29 .K XDT
30 .S MESSAGE=""
31 .I PRCFRT=0 D ENCODE^PRCFAES1(DA,DUZ,.MESSAGE)
32 .I PRCFRT=3 D ENCODE^PRCFAES2(DA,DUZ,.MESSAGE)
33 .K MESSAGE
34 .K P I $D(PX) S P=PX K PX Q
35 .Q
36 G:$G(PRCOUT) OUT
37 K ^TMP("PRCFBTCH",$J)
38 S ZTIO=$O(^PRC(411,PRC("SITE"),2,"AC","S","")),ZTSAVE("*")="",ZTRTN="DQ^PRCFACBT",ZTDESC="Transmit Code sheets",ZTDTH=$H D ^%ZTLOAD K IO("Q")
39 Q
40DQ ;Entry point to transmit code sheets in background
41 S IOP=IO,DIC="^PRCF(423,",L=0,BY="[PRCFA BATCH TRANSMIT SORT]",FLDS="[PRCFA BACKGROUND TRANSMIT]",(FR,TO)=PRCFKEY,PRCFX="",DIOEND="W @IOF"
42 D EN1^DIP
43 ;this section will take the globals created during the print and
44 ;give them to mailman for transmission
45 S N=0 F S N=$O(^TMP("PRCFBTCH",$J,N)) Q:N'=+N S PTYP=$O(^PRCF(423.9,"AC",N,0)) Q:PTYP="" I $P(^PRCF(423.9,PTYP,0),"^",4)["Y" D
46 .S M=0 F S M=$O(^TMP("PRCFBTCH",$J,N,M)) Q:M="" D
47 ..Q:'$D(^PRCF(423.9,PTYP,0)) D:"3,1,4,2,9,10,12"[N
48 ...;TAKE 4th '-' PIECE OF BATCH NUMBER AND MAKE IT INTO MMCCC
49 ...; WHERE MM = MONTH
50 ...; CCC = LAST 3 DIGITS OF COUNTER VALUE
51 ...S SHRINK=$G(^TMP("PRCFBTCH",$J,N,M,1,0)) Q:SHRINK="" I $P(SHRINK,".",3)=999 S SHRINK1=$P(SHRINK,".",6),SHRINK2=$E(SHRINK1,1,2)_$E(SHRINK1,$L(SHRINK1)-2,99),$P(SHRINK,".",6)=SHRINK2,^TMP("PRCFBTCH",$J,N,M,1,0)=SHRINK
52 ...K SHRINK,SHRINK1,SHRINK2 Q
53 ..S M1=$P(M,"-",4),M2=$E(M1,1,2)_$E(M1,$L(M1)-2,99),MM=$P(M,"-",1,3)_"-"_M2 K M1,M2 D
54 ...K ADD S ADD=$P($G(^PRCF(423.9,PTYP,0)),U,2) S:ADD]"" XMY(ADD)="" S:$G(PRCFA("EDI"))]"" XMY(PRCFA("EDI"))="" S:$G(PRCFA("ISM"))]"" XMY(PRCFA("ISM"))="" K PRCFA("EDI"),PRCFA("ISM")
55 ...K ADD
56 ...I $D(^PRCF(423.9,PTYP,1,0)) D
57 ....S L=0 F S L=$O(^PRCF(423.9,PTYP,1,L)) Q:L'=+L I $D(^PRCF(423.9,PTYP,1,L,0)) S ADD=$P(^(0),"^",1) S XMY(ADD)=""
58 ....Q
59 ..S XMDUZ=DUZ,XMSUB="ISMS/EDI BATCH "_MM,XMTEXT="^TMP(""PRCFBTCH"","_$J_","_N_","""_M_""","
60 ..D XMD
61 ..I $D(M),M["" S X=$O(^PRCF(421.2,"B",M,0)) Q:X=""
62 ..S:$D(^PRCF(421.2,X,0)) $P(^(0),"^",12)=XMZ,^PRCF(421.2,"D",XMZ,X)=""
63 ..Q
64 .Q
65 S N=0 F S N=$O(^PRCF(423,"AK",PRCFKEY,N)) Q:'N S $P(^PRCF(423,N,"TRANS"),"^",11)=""
66 K %,%DT,%I,BATCH,BATTYPE,DP,I,J,K,L,M,N,PRCFX,PTYP,X,Y,Z1,Z2
67OUT S ZTREQ="@" K PRCF("BTCH"),^TMP("PRCFBTCH",$J),^PRCF(423,"AK",PRCFKEY),PRCFKEY
68 Q
69 ;
70XMD N I,J,K,L,M,N
71 D ^XMD
72 S:$D(PRCOPODA) $P(^PRC(442,PRCOPODA,12),U,10)=XMZ
73 Q
74 ;
Note: See TracBrowser for help on using the repository browser.