source: FOIAVistA/trunk/r/CMOP-PSX/PSXCSCMN.m@ 1722

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

initial load of FOIAVistA 6/30/08 version

File size: 3.6 KB
Line 
1PSXCSCMN ;BIR/JMB-Date Range Compile/Recompile Cost Data-Continued ;[ 04/08/97 2:06 PM ]
2 ;;2.0;CMOP;;11 Apr 97
3 ;Purges date range then compiles MONTHLY data entries.
4PRGDAYS ;Purges data from cost file.
5 S PSXBDT=$E(PSXBDT,1,5)_"00",PSXEDT=$E(PSXEDT,1,5)_"00" D RUN^PSXCSLG1 ;Updates task log
6 S PSXEDT=$E(PSXEDT,1,5)_$P("31^29^31^30^31^30^31^31^30^31^30^31","^",$E(PSXEDT,4,5))
7 K DA,DIK F DA=(PSXBDT-.1):0 S DA=$O(^PSX(552.5,"AD",DA)) Q:'DA!(DA>PSXEDT) F DA(2)=0:0 S DA(2)=$O(^PSX(552.5,"AD",DA,DA(2))) Q:'+DA(2) D
8 .F DA(1)=0:0 S DA(1)=$O(^PSX(552.5,"AD",DA,DA(2),DA(1))) Q:'+DA(1) S DIK="^PSX(552.5,"_DA(2)_",1,"_DA(1)_",1," D ^DIK
9 K ^TMP("PSXCOST",$J),DA,DIK
10COMPILE ;Compiles data into ^TMP global
11 F PSXCDT=(PSXBDT-.1):0 S PSXCDT=$O(^PSX(552.4,"AD",PSXCDT)) Q:'PSXCDT!(PSXCDT>PSXEDT) F PSXIEN=0:0 S PSXIEN=$O(^PSX(552.4,"AD",PSXCDT,PSXIEN)) Q:'PSXIEN F PSXSUB=0:0 S PSXSUB=$O(^PSX(552.4,"AD",PSXCDT,PSXIEN,PSXSUB)) Q:'PSXSUB D
12 .Q:'$D(^PSX(552.4,PSXIEN,1,PSXSUB,0))!('$D(^PSX(552.4,PSXIEN,0)))!($P($G(^PSX(552.4,PSXIEN,1,PSXSUB,0)),"^",2)=2)
13 .S PSXFAC=+$G(^PSX(552.1,+^PSX(552.4,PSXIEN,0),0)),PSXDV=$P($G(^PSX(552.1,+^PSX(552.4,PSXIEN,0),"P")),"^") Q:'PSXFAC!($G(PSXDV)="")
14 .S PSXNODE=^PSX(552.4,PSXIEN,1,PSXSUB,0),PSXCID=$S($P(PSXNODE,"^",4)'="":$P(PSXNODE,"^",4),1:""),PSXCST=$S(+$P(PSXNODE,"^",11):+$P(PSXNODE,"^",11),1:"")
15 .S PSXFL=$S($P(PSXNODE,"^",12)'="":$P(PSXNODE,"^",12),1:""),PSXQTY=$S(+$P(PSXNODE,"^",13):+$P(PSXNODE,"^",13),1:"")
16 .S PSXMCDT=$E($P(PSXCDT,"."),1,5)_"00" I PSXMCDT,PSXCID'="",$D(^TMP("PSXCOST",$J,PSXFAC,PSXDV,PSXMCDT,PSXCID)) S PSXTMP=^TMP("PSXCOST",$J,PSXFAC,PSXDV,PSXMCDT,PSXCID) D
17 ..S $P(^TMP("PSXCOST",$J,PSXFAC,PSXDV,PSXMCDT,PSXCID),"^")=$P(PSXTMP,"^")+$S('PSXFL:1,1:0),$P(^(PSXCID),"^",2)=$P(PSXTMP,"^",2)+$S(PSXFL:1,1:0),$P(^(PSXCID),"^",3)=$P(PSXTMP,"^",3)+(PSXCST*PSXQTY),$P(^(PSXCID),"^",4)=$P(PSXTMP,"^",4)+PSXQTY
18 .I PSXMCDT,PSXCID'="",'$D(^TMP("PSXCOST",$J,PSXFAC,PSXDV,PSXMCDT,PSXCID)) S ^TMP("PSXCOST",$J,PSXFAC,PSXDV,PSXMCDT,PSXCID)=$S('PSXFL:1,1:0)_"^"_$S(PSXFL:1,1:0)_"^"_(PSXCST*PSXQTY)_"^"_PSXQTY
19ADD ;Adds data to cost file using ^TMP global
20 S PSXLAYGO=1 F PSXFAC=0:0 S PSXFAC=$O(^TMP("PSXCOST",$J,PSXFAC)) Q:'PSXFAC D
21 .I '$D(^PSX(552.5,PSXFAC,0)) S DIC="^PSX(552.5,",DIC(0)="MLZ",(DINUM,X)=PSXFAC,DLAYGO=552 K DD,DO D FILE^DICN K DIC,X,Y
22 .S PSXDV="" F S PSXDV=$O(^TMP("PSXCOST",$J,PSXFAC,PSXDV)) Q:PSXDV="" D
23 ..S PSXDIV=+$O(^PSX(552.5,PSXFAC,1,"B",PSXDV,0)) I 'PSXDIV S:'$D(^PSX(552.5,PSXFAC,1,0)) ^(0)="^552.51A^^" S DA(1)=PSXFAC,X=PSXDV,DIC(0)="MLZ",DIC="^PSX(552.5,"_PSXFAC_",1,",DLAYGO=552.51 K DD,DO D FILE^DICN S PSXDIV=+Y K DIC,X,Y
24 ..F PSXMCDT=0:0 S PSXMCDT=$O(^TMP("PSXCOST",$J,PSXFAC,PSXDV,PSXMCDT)) Q:'PSXMCDT D CDT
25 D END^PSXCSLG1 ;Updates cost task log
26 G END^PSXCSUTL
27CDT ;Adds sub-file & data nodes to cost file.
28 S:'$D(^PSX(552.5,PSXFAC,1,PSXDIV,1,0)) ^(0)="^552.61DA^^"
29 I '$D(^PSX(552.5,PSXFAC,1,PSXDIV,1,PSXMCDT,0)) S DA(2)=PSXFAC,DA(1)=PSXDIV,(DINUM,X)=PSXMCDT,DIC(0)="MLZ",DIC="^PSX(552.5,"_PSXFAC_",1,"_PSXDIV_",1,",DLAYGO=552.61 K DD,DO D FILE^DICN K DIC,X,Y
30 S PSXCID="" F S PSXCID=$O(^TMP("PSXCOST",$J,PSXFAC,PSXDV,PSXMCDT,PSXCID)) Q:PSXCID="" S:'$D(^PSX(552.5,PSXFAC,1,PSXDIV,1,PSXMCDT,1,0)) ^(0)="^552.611A^^" S PSXFCID=+$O(^PSX(552.5,PSXFAC,1,PSXDIV,1,PSXMCDT,1,"B",PSXCID,0)) I 'PSXFCID D
31 .S DA(3)=PSXFAC,DA(2)=PSXDIV,DA(1)=PSXMCDT,X=PSXCID,DIC(0)="MLZ",DLAYGO=552.611
32 .S PSXNODE=^TMP("PSXCOST",$J,PSXFAC,PSXDV,PSXMCDT,PSXCID)
33 .S DIC="^PSX(552.5,"_DA(3)_",1,"_DA(2)_",1,"_DA(1)_",1,",DIC("DR")="1////"_$P(PSXNODE,"^")_";2////"_$P(PSXNODE,"^",2)_";3////"_$P(PSXNODE,"^",3)_";4////"_$P(PSXNODE,"^",4) K DD,DO D FILE^DICN K DIC,X,Y
34 Q
Note: See TracBrowser for help on using the repository browser.