[613] | 1 | PSDFIL3 ;BIR/JPW,BJW-File TRAKKER Info - Insp Inv Adj ; 24 Mar 98
|
---|
| 2 | ;;3.0; CONTROLLED SUBSTANCES ;**8,3,66**;13 Feb 97;Build 3
|
---|
| 3 | ;Y2K compliance**after FM patch DI*21*44 installed
|
---|
| 4 | EN1 ;entry for filing vault inventory adjustments trakker info
|
---|
| 5 | K CNT,DA,DATA,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,PSDS,PSDSN,X,X1,Y
|
---|
| 6 | LOOP ;loop thru ^tmp
|
---|
| 7 | K CNT S CNT=1
|
---|
| 8 | W !!,"Updating DHCP now..."
|
---|
| 9 | F PSD=0:0 S PSD=$O(^TMP("PSDWN3",$J,PSD)) Q:'PSD S NODE=^TMP("PSDWN3",$J,PSD,0) D
|
---|
| 10 | .I $L(NODE)<32,NODE'["*" S PHARM=$P(NODE,"^") S:$E(PHARM)="I" PHARM=$P(PHARM,"I",2) S PHARM=$P(PHARM,"-")_$P(PHARM,"-",2)_$P(PHARM,"-",3) D Q
|
---|
| 11 | ..S PHARM=$S(PHARM]"":+$O(^VA(200,"SSN",PHARM,0)),1:"")
|
---|
| 12 | ..S PSDTS=$P(NODE,"^",2),X=$E(PSDTS,2,3) D ^%DT S PSDTS=$E(Y,1,3)_$E(PSDTS,5,6)_$E(PSDTS,8,9)_"."_$E(PSDTS,11,12)_$E(PSDTS,14,15)_$E(PSDTS,17,18),PSDTS=+PSDTS
|
---|
| 13 | .I $L(NODE)<32,NODE["*" S PSDS=+$P(NODE,"*",2),PSDSN=$S($P($G(^PSD(58.8,PSDS,0)),"^")]"":$P($G(^(0)),"^"),1:"UNKNOWN") Q
|
---|
| 14 | .S PHARM1=$P(NODE,"^"),PSDRN=$P(NODE,"^",3),OQTY=+$P(NODE,"^",4),QTY=+$P(NODE,"^",6),PHARM2=$P(NODE,"^",7)
|
---|
| 15 | .S CQTY=+$P(NODE,"^",8),PSDTA=$P(NODE,"^",12)
|
---|
| 16 | .S:$E(PHARM1)="I" PHARM1=$P(PHARM1,"I",2) S PHARM1=$P(PHARM1,"-")_$P(PHARM1,"-",2)_$P(PHARM1,"-",3),PHARM1=$S(PHARM1]"":+$O(^VA(200,"SSN",PHARM1,0)),1:"")
|
---|
| 17 | .I PHARM2]"" S:$E(PHARM2)="P" PHARM2=$P(PHARM2,"P",2) S PHARM2=$P(PHARM2,"-")_$P(PHARM2,"-",2)_$P(PHARM2,"-",3),PHARM2=$S(PHARM2]"":+$O(^VA(200,"SSN",PHARM2,0)),1:"")
|
---|
| 18 | .S PSDR=+$P(NODE,"^",2)
|
---|
| 19 | .S X=$E(PSDTA,2,3) D ^%DT S PSDTA=$E(Y,1,3)_$E(PSDTA,5,6)_$E(PSDTA,8,9)_"."_$E(PSDTA,11,12)_$E(PSDTA,14,15)_$E(PSDTA,17,18),PSDTA=+PSDTA
|
---|
| 20 | .S PSDTYP=$S('CQTY:22,1:9)
|
---|
| 21 | .;I PSDTYP=9,CQTY=OQTY Q
|
---|
| 22 | .I '$D(^TMP("PSDOK3",$J,21,+PSDR)) S ^TMP("PSDOK3",$J,21,+PSDR,+PSDTS,1)=21_"^"_PHARM_"^^^"
|
---|
| 23 | .S ^TMP("PSDOK3",$J,+PSDTYP,+PSDR,+PSDTA,CNT)=PSDTYP_"^"_PHARM1_"^"_PHARM2_"^"_OQTY_"^"_CQTY
|
---|
| 24 | .S CNT=CNT+1
|
---|
| 25 | FIL ;file data
|
---|
| 26 | S PSD="" F PSD=21,9,22 D
|
---|
| 27 | .S PSDR="" F S PSDR=$O(^TMP("PSDOK3",$J,PSD,PSDR)) Q:PSDR="" S PSDTA="" F S PSDTA=$O(^TMP("PSDOK3",$J,PSD,PSDR,PSDTA)) Q:PSDTA="" S CNT="" F S CNT=$O(^TMP("PSDOK3",$J,PSD,PSDR,PSDTA,CNT)) Q:CNT="" D
|
---|
| 28 | ..S NODE=^TMP("PSDOK3",$J,PSD,+PSDR,+PSDTA,CNT),PSDTYP=+$P(NODE,"^"),PHARM1=$P(NODE,"^",2),PHARM2=$P(NODE,"^",3),OQTY=$P(NODE,"^",4),CQTY=$P(NODE,"^",5),QTY=$S(PSDTYP=9:CQTY-OQTY,1:0)
|
---|
| 29 | ..S PHARMN1=$S($P($G(^VA(200,+PHARM1,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN")
|
---|
| 30 | ..D UPDATE
|
---|
| 31 | W "done.",!
|
---|
| 32 | END ;kill variables
|
---|
| 33 | K %,%DT,%H,%I,BAL,CQTY,DA,DIC,DIE,DIK,DINUM,DLAYGO,DR,JJ,NAOU,NODE,OK,OQTY
|
---|
| 34 | K PHARM,PHARM1,PHARM2,PHARMN1,PAT,PSD,PSDER,PSDR,PSDREC,PSDRN,PSDS,PSDSN,PSDT,PSDTA,PSDTS,PSDTYP,QTY,X,Y
|
---|
| 35 | K ^TMP("PSDWN3",$J)
|
---|
| 36 | K ^TMP("PSDOK3",$J)
|
---|
| 37 | Q
|
---|
| 38 | UPDATE ;update 58.8 and 58.81
|
---|
| 39 | ;vault balance
|
---|
| 40 | F L +^PSD(58.8,+PSDS,1,+PSDR,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I Q
|
---|
| 41 | D NOW^%DTC S PSDT=+%
|
---|
| 42 | S BAL=$P(^PSD(58.8,+PSDS,1,+PSDR,0),"^",4),$P(^(0),"^",4)=$P(^(0),"^",4)+QTY
|
---|
| 43 | L -^PSD(58.8,+PSDS,1,+PSDR,0)
|
---|
| 44 | F L +^PSD(58.81,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I Q
|
---|
| 45 | FIND S PSDREC=$P(^PSD(58.81,0),"^",3)+1 I $D(^PSD(58.81,PSDREC)) S $P(^PSD(58.81,0),"^",3)=PSDREC G FIND
|
---|
| 46 | K DIC,DLAYGO S DIC(0)="L",(DIC,DLAYGO)=58.81,(X,DINUM)=PSDREC D ^DIC K DIC,DLAYGO
|
---|
| 47 | L -^PSD(58.81,0)
|
---|
| 48 | EDIT ;edit new transaction in 58.81
|
---|
| 49 | S ^PSD(58.81,PSDREC,0)=PSDREC_"^"_PSDTYP_"^"_+PSDS_"^"_$S(PSDTYP=21:PSDTS,1:PSDT)_"^"_PSDR_"^"_QTY_"^"_$S(PSDTYP=9:PHARM1,1:PHARM)_"^^^"_BAL_"^^^^^^"_$S(PSDTYP=9:"TRAKKER ADJUSTMENT",1:"TRAKKER INVENTORY")
|
---|
| 50 | S:PSDTYP=9 ^PSD(58.81,PSDREC,9)="^^"_$S(PSDTYP=21:BAL,1:OQTY)_"^^^^"_CQTY_"^^^"_"^"_PSDTA_"^"_PHARM1_"^"_PHARM2
|
---|
| 51 | S ^PSD(58.81,PSDREC,"CS")=1
|
---|
| 52 | K DA,DIK S DA=PSDREC,DIK="^PSD(58.81," D IX^DIK K DA,DIK
|
---|
| 53 | ;update vault
|
---|
| 54 | I '$D(^PSD(58.8,+PSDS,1,+PSDR,4,0)) S ^(0)="^58.800119PA^^"
|
---|
| 55 | I '$D(^PSD(58.8,+PSDS,1,+PSDR,4,+PSDREC,0)) K DA,DIC,DD,DO S DIC(0)="L",DIC="^PSD(58.8,"_+PSDS_",1,"_+PSDR_",4,",DA(2)=+PSDS,DA(1)=+PSDR,(X,DINUM)=PSDREC D FILE^DICN K DA,DIC
|
---|
| 56 | I PSDTYP'=9 W "." Q
|
---|
| 57 | ERR ;err log update
|
---|
| 58 | F L +^PSD(58.89,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I Q
|
---|
| 59 | FIND9 S PSDER=$P(^PSD(58.89,0),"^",3)+1 I $D(^PSD(58.89,PSDER)) S $P(^PSD(58.89,0),"^",3)=PSDER G FIND9
|
---|
| 60 | K DIC,DLAYGO S DIC(0)="L",(DIC,DLAYGO)=58.89,(X,DINUM)=PSDER D ^DIC K DIC,DLAYGO
|
---|
| 61 | L -^PSD(58.89,0)
|
---|
| 62 | EDIT9 ;edit error log
|
---|
| 63 | K DA,DIE,DR S DA=PSDER,DIE=58.89,DR="1////"_PSDREC_";2////"_PSDT_";6////"_+PSDS D ^DIE K DA,DIE,DR
|
---|
| 64 | D ^PSDFILM
|
---|
| 65 | W "."
|
---|
| 66 | Q
|
---|