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

PSAVER5.m

Go to the documentation of this file.
  1. PSAVER5 ;BIR/JMB-Verify Invoices - CONT'D ;10/6/97
  1. ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;;**1**; 10/24/97
  1. ;This routine assigns an invoice to a pharmacy location or master vault
  1. ;if the location changes during verification.
  1. ;
  1. MASTER ;Assigns invoice to Master Vault
  1. S (PSAMVN,PSAMV)=0 F S PSAMV=+$O(^PSD(58.8,"ADISP","M",PSAMV)) Q:'PSAMV D
  1. .S PSAMVN=PSAMVN+1,PSAONEMV=PSAMV,PSAMV($P(^PSD(58.8,PSAMV,0),"^"),PSAMV)=""
  1. I 'PSAMVN W !!,"No master vaults are set up. You must set up a master vault then",!,"select the Process Uploaded Prime Vendor Invoices Data option." S PSAOUT=1 Q
  1. I PSAMVN=1 D Q
  1. .W !!,"Controlled substances on the invoice has been",!,"automatically assigned to the Master Vault."
  1. .W !,$P(^PSD(58.8,PSAONEMV,0),"^")
  1. .W !!,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN)
  1. .S DR="13///^S X="_PSAONEMV D PHARM^PSAVER2
  1. I PSAMVN>1 D DISPMV W !,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN) D SELMV
  1. Q
  1. ;
  1. DISPMV ;Displays active master vaults
  1. W @IOF,!?22,"<<< ASSIGN A MASTER VAULT SCREEN >>>",!,PSASLN
  1. S PSA=0,PSAMVA="" F S PSAMVA=$O(PSAMV(PSAMVA)) Q:PSAMVA="" D
  1. .S PSAMVIEN=0 F S PSAMVIEN=$O(PSAMV(PSAMVA,PSAMVIEN)) Q:'PSAMVIEN D
  1. ..S PSA=PSA+1,PSAVAULT(PSA,PSAMVA,PSAMVIEN)=""
  1. ..W !,$J(PSA,2)_".",?4,PSAMVA
  1. W !
  1. Q
  1. ;
  1. SELMV ;Select displayed master vaults
  1. W ! S DIR(0)="NO^1:"_PSA,DIR("A")="Select Master Vault",DIR("?")="Select the Master Vault that received the invoice's drugs"
  1. S DIR("??")="^D MV^PSAPROC" D ^DIR K DIR Q:Y="" I $G(DIRUT) S PSAOUT=1 Q
  1. S PSASEL=Y
  1. S PSAMVA=$O(PSAVAULT(PSASEL,"")) Q:PSAMVA="" S PSAMVIEN=+$O(PSAVAULT(PSASEL,PSAMVA,0)) Q:'PSAMVIEN S DR="13///^S X="_PSAMVIEN D PHARM^PSAVER2
  1. Q
  1. ;
  1. GETLOC ;Gets pharmacy locations
  1. S (PSALOC,PSANUM)=0 F S PSALOC=+$O(^PSD(58.8,"ADISP","P",PSALOC)) Q:'PSALOC D
  1. .Q:'$D(^PSD(58.8,PSALOC,0))!($P($G(^PSD(58.8,PSALOC,0)),"^")="")
  1. .I +$G(^PSD(58.8,PSALOC,"I")),+^PSD(58.8,PSALOC,"I")'>DT Q
  1. .S PSANUM=PSANUM+1,PSAONE=PSALOC,PSAISIT=+$P(^PSD(58.8,PSALOC,0),"^",3),PSAOSIT=+$P(^(0),"^",10)
  1. .D SITES^PSAUTL1 S PSALOCA($P(^PSD(58.8,PSALOC,0),"^")_PSACOMB,PSALOC)=PSAISIT_"^"_PSAOSIT
  1. G:'PSANUM NONE G:PSANUM=1 ONE G:PSANUM>1 MANY
  1. ;
  1. NONE ;No DA pharmacy locations
  1. W !!,"There are no Drug Accountability pharmacy locations.",!!,"Use the Set Up/Edit a Pharmacy Location option on Pharmacy Location menu"
  1. W !,"to setup one or more pharmacy locations. Then select the Process Uploaded",!,"Prime Vendor Invoice Data option to process the invoices."
  1. Q
  1. ;
  1. ONE ;Only one location
  1. S PSACNT=0,PSALOC=PSAONE,PSALOCN=$O(PSALOCA(""))
  1. W !!,"The non-controlled substance items on the invoice have",!,"been automatically assigned to the Pharmacy Location."
  1. W:$L(PSALOCN)>76 !,$P(PSALOCN,"(IP)",1)_"(IP)",!?17,$P(PSALOCN,"(IP)",2) W:$L(PSALOCN)<77 PSALOCN
  1. W !!,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN)
  1. S DR="4///^S X="_PSAONE D PHARM^PSAVER2
  1. Q
  1. ;
  1. MANY ;If more than one pharmacy location, display invoices.
  1. D DISPLOC W !,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN) D SELLOC
  1. Q
  1. ;
  1. DISPLOC ;Displays the active pharmacy locations.
  1. W @IOF,!?19,"<<< ASSIGN A PHARMACY LOCATION SCREEN >>>",!,PSASLN
  1. S PSACNT=0,PSALOCN="" F S PSALOCN=$O(PSALOCA(PSALOCN)) Q:PSALOCN="" D
  1. .S PSALOC=0 F S PSALOC=$O(PSALOCA(PSALOCN,PSALOC)) Q:'PSALOC D
  1. ..S PSACNT=PSACNT+1,PSAMENU(PSACNT,PSALOCN,PSALOC)=PSALOC
  1. ..W !,$J(PSACNT,2)_"." W:$L(PSALOCN)>72 ?4,$P(PSALOCN,"(IP)",1)_"(IP)",!?21,$P(PSALOCN,"(IP)",2) W:$L(PSALOCN)<73 ?4,PSALOCN
  1. W !
  1. Q
  1. ;
  1. SELLOC ;Select the Pharmacy Location to be assigned to the order.
  1. W ! K DIR S DIR(0)="NO^1:"_PSACNT,DIR("A")="Pharmacy Location",DIR("?")="Select the pharmacy location that received the invoice's drugs"
  1. S DIR("??")="^D LOCHELP^PSAVER5" D ^DIR K DIR Q:Y="" I $G(DIRUT) S PSAOUT=1 Q
  1. S PSASEL=Y
  1. S PSALOCN=$O(PSAMENU(PSASEL,"")) Q:PSALOCN="" S PSALOC=$O(PSAMENU(PSASEL,PSALOCN,0)) Q:'PSALOC S DR="4///^S X="_PSALOC D PHARM^PSAVER2
  1. Q
  1. ;
  1. CS ;Sets invoice's CONTROLLED SUBSTANCES field if a drug changed from CS to
  1. ;non-CS or vice-versa.
  1. S (PSA10,PSAL,PSAN10)=0 F S PSAL=+$O(^PSD(58.811,PSAIEN,1,PSAIEN1,1,PSAL)) Q:'PSAL D
  1. .I +$P($G(^PSD(58.811,PSAIEN,1,PSAIEN1,1,PSAL,0)),"^",10) S PSA10=PSA10+1 Q
  1. .S PSAN10=PSA10+1
  1. S $P(^PSD(58.811,PSAIEN,1,PSAIEN1,0),"^",8)=$S(PSA10&(PSAN10):"S",PSA10&('PSAN10):"A",1:"N")
  1. S PSAIN=^PSD(58.811,PSAIEN,1,PSAIEN1,0)
  1. Q
  1. ;
  1. LOCHELP ;Extended help for the select "Pharmacy Location" prompt
  1. W !?5,"Enter the number of the pharmacy location for which you want to assign",!?5,"the order. The invoiced drugs in the assigned pharmacy location will be"
  1. W !?5,"incremented with the quantity received after the order is verified."
  1. Q