source: FOIAVistA/tag/r/CMOP-PSX/PSXCOSTU.m@ 1540

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

initial load of FOIAVistA 6/30/08 version

File size: 3.5 KB
Line 
1PSXCOSTU ;BIR/BAB,WPB,HTW-Cost Update ; 26 Apr 2000 10:52 AM
2 ;;2.0;CMOP;**18,19,27**;11 Apr 97
3 ;Reference to ^PSDRUG( supported by DBIA #2367, #1983
4 ;
5 ;This routine will update the CMOP Master Database file with cost data from the drug file. Discrepancies will be reported via mail message.
6 Q
7BLANK S ^XMB(3.9,XMZ,2,MCT,0)="" S MCT=MCT+1
8 Q
9EN ;
10 W !! S DIR(0)="D^::EX",DIR("A")="Enter Begin Date ",DIR("?")="Enter the beginning date for the report" D ^DIR K DIR,DIR("?")
11 G:($D(DIRUT))!($D(DIROUT)) EXIT
12 S BB=Y,BEG=$$FMADD^XLFDT(BB,-1,0,0,0) K Y
13EDT W !! S DIR(0)="DO^::EX",DIR("A")="Enter End Date ",DIR("?")="Enter the ending date for the report" D ^DIR K DIR,DIR("?")
14 I $G(Y)']"" W !! G EN
15 G:($D(DIRUT))!($D(DIROUT)) EXIT
16 I Y<BB W !,"End Date must follow Begin Date!" K Y,DIR G EDT
17 S EE=Y,END=$$FMADD^XLFDT(EE,1,0,0,0) K Y,EE
18QUE S ZTRTN="GET^PSXCOSTU",ZTIO="",ZTSAVE("BEG")="",ZTSAVE("END")=""
19 S ZTDESC="CMOP Cost Update for Master Database",ZTSAVE("DUZ")=""
20 D ^%ZTLOAD
21 I $D(ZTSK)[0 W !!,"Job Cancelled"
22 E W !!,"Job Queued"
23 G EXIT
24 ; Called by Taskman to Build Cost Data
25GET S (C1,CNT)=1
26 F S BEG=$O(^PSX(552.4,"AD",BEG)) Q:BEG'>0!(BEG=END) S XX=0 F S XX=$O(^PSX(552.4,"AD",BEG,XX)) Q:XX'>0 S YY=0 F S YY=$O(^PSX(552.4,"AD",BEG,XX,YY)) Q:YY'>0 D
27 .I $P($G(^PSX(552.4,XX,1,YY,0)),U,2)'=1 Q
28 .I $P(^PSX(552.4,XX,1,YY,0),U,11)>0 Q
29 .S IDDRG=$P($G(^PSX(552.4,XX,1,YY,0)),U,4) Q:$G(IDDRG)=""
30 .S CDT=$P($G(^PSX(552.4,XX,1,YY,0)),U,9) I $G(CDT) S Y=$P(CDT,".") X ^DD("DD") S CDT=Y K Y
31 .S IEN50=$O(^PSDRUG("AQ1",IDDRG,""))
32 .I $G(IEN50)']"" S ^TMP($J,"PSX",CNT)=IDDRG_" "_$G(CDT) S CNT=CNT+1 Q
33 .S COST=$P($G(^PSDRUG(IEN50,660)),U,6)
34 .S Z1=$P($G(^PSDRUG(IEN50,"ND")),U),Z2=$P($G(^("ND")),U,3)
35 .I $G(Z1),($G(Z2)) S ZX=$$PROD2^PSNAPIS(Z1,Z2),TRUG=$P($G(ZX),"^")
36 .I $G(COST)']"" S ^TMP($J,"PSX1",C1)=IDDRG_" "_$G(CDT)_" "_$G(TRUG) S C1=C1+1 Q
37 .S DA(1)=XX,DA=YY,DIE="^PSX(552.4,"_XX_",1,",DR="10////"_$G(COST) D ^DIE
38 .K DA(1),DA,COST,IDDRG,IEN50,DIE,DR,Z1,Z2
39MSG ;
40 I '$D(^TMP($J,"PSX")),('$D(^TMP($J,"PSX1"))) G EXIT
41 S XMSUB="CMOP COST UPDATE",XMDUZ=.5
42XMZ D XMZ^XMA2
43 I XMZ'>0 G XMZ
44 S MCT=2
45 D NOW^%DTC S Y=% X ^DD("DD")
46 S ^XMB(3.9,XMZ,2,1,0)="CMOP Master Database Drug Cost Update "_Y K Y
47 F I=1:1:2 D BLANK
48 I '$D(^TMP($J,"PSX")) G PSX1
49 S ^XMB(3.9,XMZ,2,MCT,0)="The drug ID's listed below are missing a corresponding entry in Drug file 50, therefore, no cost information can be updated for any prescription written"
50 S MCT=MCT+1
51 S ^XMB(3.9,XMZ,2,MCT,0)="for this drug. When the drug file entry is available, the Cost Update option may be re-run for the dates indicated to enter the costs for these drugs."
52 S MCT=MCT+1
53 D BLANK
54 S ^XMB(3.9,XMZ,2,MCT,0)="DRUG ID COMPLETED D/T"
55 S MCT=MCT+1
56 D BLANK
57 F I=0:0 S I=$O(^TMP($J,"PSX",I)) Q:'I D
58 .S ^XMB(3.9,XMZ,2,MCT,0)=^TMP($J,"PSX",I) S MCT=MCT+1
59 F I=1:1:2 D BLANK
60PSX1 I '$D(^TMP($J,"PSX1")) G MSGEND
61 S ^XMB(3.9,XMZ,2,MCT,0)="The Drug File entries listed below do not contain cost data so prescriptions for these drugs have not been updated. When the cost data is entered, "
62 S MCT=MCT+1
63 S ^XMB(3.9,XMZ,2,MCT,0)="the Cost Update option may be re-run to update the prescription entries."
64 S MCT=MCT+1
65 D BLANK
66 S ^XMB(3.9,XMZ,2,MCT,0)="DRUG ID COMPLETED D/T DRUG NAME"
67 S MCT=MCT+1
68 D BLANK
69 F I=0:0 S I=$O(^TMP($J,"PSX1",I)) Q:'I D
70 .S ^XMB(3.9,XMZ,2,MCT,0)=^TMP($J,"PSX1",I) S MCT=MCT+1
71MSGEND S ^XMB(3.9,XMZ,2,0)="^3.92A^"_MCT_U_MCT_U_DT,XMDUN="CMOP Manager"
72 S XMDUZ=.5,XMY(DUZ)=""
73 D ENT1^XMD
74EXIT K ID,XX,YY,BEG,END,IDDRG,IEN50,CNT,COST,^TMP($J),CDT,BB
75 K XMSER,XQMSG,XMZ,XMSUB S ZTREQ="@"
76 Q
Note: See TracBrowser for help on using the repository browser.