source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAOP4.m@ 1240

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

initial load of WorldVistAEHR

File size: 1.5 KB
Line 
1PSAOP4 ;BIR/LTL-Outpatient Dispensing (Single Drug) & (All Drugs) - CONT'D ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**3**; 10/24/97
3 ;This routine gathers outpatient dispensing and is called by PSAOP2.
4 ;
5 N PSADRUGN S PSADRUGN=0
6 F S PSADRUGN=$O(^TMP("PSA",$J,PSADRUGN)),PSADRUG=$O(^PSDRUG("B",PSADRUGN,0)) Q:'PSADRUGN D
7 .S PSA(2)=0 F S PSA(2)=$O(^TMP("PSA",$J,PSADRUGN,PSA(2))) Q:'PSA(2) D
8 ..S PSA(3)=+^TMP("PSA",$J,PSADRUGN,PSA(2)) D TMP^PSAOP1
9 ..K:$D(^XTMP("PSA",PSAS,PSADRUGN)) ^XTMP("PSA",PSAS,PSADRUGN)
10QUIT K ^TMP("PSA",$J) S:$D(ZTQUEUED) ZTREQ="@"
11 Q
12 ;
13AM ;Collects partial fills released & returned to stock.
14 F S PSAP=$O(^PSRX("AM",PSAP)) Q:'PSAP F S PSAP(1)=$O(^PSRX("AM",+PSAP,PSAP(1))) Q:'PSAP(1) D:$P($G(^PSRX(+PSAP(1),0)),U,6)=PSADRUG&($P($G(^PSRX(+PSAP(1),2)),U,9)=PSAS)
15 .S PSAP(2)="" F S PSAP(2)=$O(^PSRX("AM",+PSAP,+PSAP(1),PSAP(2))) Q:'PSAP(2) S $P(^TMP("PSA",$J,+PSADRUG,$E(PSAP,1,7)),U)=$P($G(^TMP("PSA",$J,+PSADRUG,$E(PSAP,1,7))),U)+$P($G(^PSRX(+PSAP(1),"P",+PSAP(2),0)),U,4) D
16 ..S $P(^TMP("PSA",$J,+PSADRUG,$E(PSAP,1,7)),U,6)=PSAP,$P(^($E(PSAP,1,7)),U,7)=PSAP(1)
17 F S PSAN=$O(^PSRX("AN",PSAN)) Q:'PSAN F S PSAN(1)=$O(^PSRX("AN",+PSAN,PSAN(1))) Q:'PSAN(1) D:$P($G(^PSRX(+PSAN(1),0)),U,6)=PSADRUG&($P($G(^PSRX(+PSAN(1),2)),U,0)=PSAS)
18 .S PSAN(2)="" F S PSAN(2)=$O(^PSRX("AN",+PSAN,+PSAN(1),PSAN(2))) Q:'PSAN(2) S $P(^TMP("PSA",$J,+PSADRUG,$E(PSAN,1,7)),U)=$P($G(^($E(PSAN,1,7))),U)-$P($G(^PSRX(+PSAN(1),"P",+PSAN(2),0)),U,4) D
19 ..S $P(^TMP("PSA",$J,+PSADRUG,$E(PSAN,1,7)),U,8)=PSAN,$P(^($E(PSAN,1,7)),U,9)=PSAN(1)
20 Q
Note: See TracBrowser for help on using the repository browser.