Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSSPRICE

PSSPRICE.m

Go to the documentation of this file.
PSSPRICE ;EPIP/WC - PHARMACY PRICE TRACKER FILE 50;1/13/20 3:31pm
 ;;1.0;PHARMACY DATA MANAGEMENT;**227,236,241**;2/28/17;Build 2
 Q  ; call by line tag
 ; UDPATE^DIE supported by ICR #2053
 ; ^XMD supported by ICR #10113
ST(PSSIEN,PSSDUZ,PSSFLD) ;
 ;  PSSIEN=DRUG IEN
 ;  PSSNEW=NEW PRICE
 ;  PSSDUZ=USER CHANGING PRICE
 ;  PSSFLD=13-PRICE PER ORDER UNIT, 15-DISPENSE UNITS PER ORDER UNIT ;p236
 ; CLASS 3 CROSS REFER ON FILE 50 FIELD #16 
 N DA,DIE,X,Y,DIC
 N PSSNEW
 ;LEAST GET THE TIME THE CHANGE WAS MADE
 D NOW^%DTC S PSSTIME=%
 S PSSNEW=$P($G(^PSDRUG(PSSIEN,660)),"^",6)
 ;
QUE ;ENTER THE DATA IN FILE 50 MULTIPLE FIELD 950 
 S ZTRTN="HIS^PSSPRICE"
 S ZTDESC="PHARMACY PRICE TRACKER "
 S ZTSAVE("PSSIEN")=""
 S ZTSAVE("PSSNEW")=""
 S ZTSAVE("PSSDUZ")=""
 S ZTSAVE("PSSTIME")=""
 S ZTSAVE("PSSFLD")=""
 S ZTIO=""
 D NOW^%DTC S ZTDTH=%
 D ^%ZTLOAD
 D HOME^%ZIS
 Q
HIS ;LOGS CHANGES IN FILE 50 HISTORY PRICE DISPENSE #950
 ; first delete any price updates prior to the retention limit set up in the paramater PSS DRUG AUDIT RETENTION MOS 
 N DEFDT,PSIEN2 S DEFDT=+$$GET^XPAR("ALL","PSS DRUG AUDIT RETENTION MOS")
 S DEFMOS=$S(DEFDT>0:DEFDT,1:999999999)
 S X1=$$NOW^XLFDT,X2=DEFMOS*30 D C^%DTC S ENDDT=X
 S X1=$P($$NOW^XLFDT,".",1)
 S ENDDT=$$FMADD^XLFDT(DT,"-"_(DEFMOS*30))
 I $O(^PSDRUG(PSSIEN,950,0)) D
 . F  S PSIEN2=$O(^PSDRUG(PSSIEN,950,0)) Q:'PSIEN2  Q:^(PSIEN2,0)>ENDDT  D  ;p236
 . . N DIK,DA
 . . S DIK="^PSDRUG(PSSIEN,950,",DA(1)=PSSIEN,DA=PSIEN2 D ^DIK  ; Delete old data
 N PSSPDU S PSSPDU=99999,PSSPDU=$O(^PSDRUG(PSSIEN,950,PSSPDU),-1) ; p236
 I PSSPDU>0,PSSNEW=$P($G(^PSDRUG(PSSIEN,950,PSSPDU,0)),"^",3) Q  ; p236 Quit if no changes to PRICE PER DISPENSE UNIT
 N FDA
 S FDA(50.095,"?+1,"_PSSIEN_",",.01)=PSSTIME
 S FDA(50.095,"?+1,"_PSSIEN_",",1)=PSSDUZ
 S FDA(50.095,"?+1,"_PSSIEN_",",3)=PSSNEW
 D UPDATE^DIE("","FDA")
 S PSSNAME=$$GET1^DIQ(200,PSSDUZ_",",.01)
BULL ;Generate the bulletin.
 S XMY("G.PSS DEE AUDIT")=""
 S XMSUB="Pharmacy Price Tracker",XMDUZ=.5
 S ^UTILITY($J,"PHARM TRACK",1)=PSSNAME_" has changed the "_$S(PSSFLD=13:"PRICE PER ORDER UNIT",1:"DISPENSE UNITS PER ORDER UNIT") ;p236
 S ^UTILITY($J,"PHARM TRACK",2)="The PRICE PER DISPENSE UNIT of:"
 S ^UTILITY($J,"PHARM TRACK",3)=$P($G(^PSDRUG(PSSIEN,0)),"^",1)_" is: "_PSSNEW
 S ^UTILITY($J,"PHARM TRACK",4)="" ;p236
 S ^UTILITY($J,"PHARM TRACK",5)="Date/Time changed: "_$$FMTE^XLFDT(PSSTIME) ;p236
 S XMTEXT="^UTILITY($J,""PHARM TRACK""," D ^XMD
 K %,PSSTIME,PSSIEN,PSSNAME,PSSOLD,PSSNEW,PSSDUZ,PSSFLD,^UTILITY($J),XMSUB,XMTEXT,XMDUZ
 Q
 ;