source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWRP4P.m@ 731

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

revised back to 6/30/08 version

File size: 2.0 KB
Line 
1ORWRP4P ; slc/dcm - OE/RR HDR Report Extract RPC's Outpatient Pharmacy ;9/21/05 13:21
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**215**;Dec 17, 1997
3PSO ;Outpatient RX for HDR
4 N IFN,IFN1,IFN2,X,X1,X2,X3,X10,X16,X17,XIFN,ORX,COL,CODE,I1,CNT,%DT,Y,FAC,FACU
5 K ^TMP("ORXS",$J)
6 S IFN=""
7 F S IFN=$O(^XTMP(HANDLE,"D",IFN)) Q:IFN="" S XIFN=^(IFN) D
8 . S X16=$P(XIFN,"^",16),X17=$P(XIFN,"^",17),X2=$P(XIFN,"^",2),FACU=X17
9 . I X17="",X16,X16'=200 S FACU=$O(^DIC(4,"D",X16,0)) I FACU S FACU=$P(^DIC(4,FACU,0),"^")
10 . I '$L(FACU) S FACU=$S($L($P(XIFN,"^",2)):$P(XIFN,"^",2),1:"Unknown")
11 . S $P(XIFN,"^",2)=FACU,X10=$P($P(XIFN,"^",10),":",1,2),X3=$P($P(XIFN,"^",3),"~",2)
12 . I X3="" S X3=$P($P(XIFN,"^",4),"~",2) ;Get NDC name if Drug name not sent
13 . I $L(X10),$L(X3) D
14 .. S X10=9999999-$$SETDATE^ORWRP4(X10),^TMP("ORXS",$J,FACU,X10,X3,IFN)=XIFN
15 K ^TMP("ORXS1",$J)
16 S FAC="",CNT=-1
17 F S FAC=$O(^TMP("ORXS",$J,FAC)) Q:FAC="" S IFN="" F S IFN=$O(^TMP("ORXS",$J,FAC,IFN)) Q:IFN="" D
18 . S IFN1=""
19 . F S IFN1=$O(^TMP("ORXS",$J,FAC,IFN,IFN1)) Q:IFN1="" S IFN2="" F S IFN2=$O(^TMP("ORXS",$J,FAC,IFN,IFN1,IFN2)) Q:IFN2="" S X=^(IFN2) D
20 .. D XSET^ORWRP4("1^"_$P(X,"^",2)) ; Facility
21 .. D XSET^ORWRP4("2^"_IFN1) ; Drug Name
22 .. D XSET^ORWRP4("3^"_$P($P(X,"^",3),"~")) ; Drug IEN
23 .. D XSET^ORWRP4("4^"_$P(X,"^",5)) ; RX #
24 .. D XSET^ORWRP4("5^"_$P($P(X,"^",6),"~",2)) ; Status
25 .. D XSET^ORWRP4("6^"_$P(X,"^",7)) ; Qty
26 .. S Y=$$SETDATE^ORWRP4($P(X,"^",9)) D XSET^ORWRP4("7^"_$$DATE^ORDVU(Y)) ; Exp/Canc Date
27 .. S Y=$$SETDATE^ORWRP4($P(X,"^",10)) D XSET^ORWRP4("8^"_$$DATE^ORDVU(Y)) ; Issue Date
28 .. S Y=$$SETDATE^ORWRP4($P(X,"^",11)) D XSET^ORWRP4("9^"_$$DATE^ORDVU(Y)) ; Last Fill Date
29 .. D XSET^ORWRP4("10^"_$P(X,"^",12)) ; Refills
30 .. D XSET^ORWRP4("11^"_$P(X,"^",13)) ; Provider
31 .. D XSET^ORWRP4("12^"_$P(X,"^",14)) ; Cost/Fill
32 .. D XSET^ORWRP4("13^") ; [+]
33 .. D XSET^ORWRP4("14^"_$P(X,"^",15)) ; SIG
34 K ^XTMP(HANDLE,"D") M ^XTMP(HANDLE,"D")=^TMP("ORXS1",$J) K ^TMP("ORXS",$J),^TMP("ORXS1",$J)
35 Q
Note: See TracBrowser for help on using the repository browser.