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

PSAPROC2.m

Go to the documentation of this file.
  1. PSAPROC2 ;BIR/JMB-Process Uploaded Prime Vendor Invoice Data - CONT'D ;7/23/97
  1. ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**34**; 10/24/97
  1. ;This routine allows the user to edit invoices with errors or missing
  1. ;data.
  1. ;
  1. CHK S PSA=+$O(PSAERR(0))
  1. I 'PSA W @IOF,!!,"There are no invoices that need to be processed." D END^PSAPROC Q
  1. ;
  1. INV D HDR W !," More data is needed on the following invoices. Choose the invoices from",!," the list you want to edit.",!,PSASLN
  1. S (PSACNT,PSAMENU,PSASTOP)=0
  1. F S PSAMENU=+$O(PSAERR(PSAMENU)) Q:'PSAMENU!(PSAOUT) D Q:PSASTOP
  1. .I $Y+4>IOSL D HEADER Q:PSASTOP
  1. .S PSAORD=$P(PSAERR(PSAMENU),"^"),PSAINV=$P(PSAERR(PSAMENU),"^",2),PSACTRL=$P(PSAERR(PSAMENU),"^",3),PSACNT=PSACNT+1
  1. .W !?2,PSAMENU_". ",?6,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+^XTMP("PSAPV",PSACTRL,"IN"))
  1. W !,PSASLN K DIR,PSASTOP
  1. S DIR(0)="LO^1:"_PSACNT,DIR("A")="Select invoices to edit",DIR("?",1)="Enter the number to the left of the invoice",DIR("?")="data to be processed or a range of numbers." W !
  1. S DIR("??")="^D SELHELP^PSAPROC2" D ^DIR K DIR I $G(DIRUT) S PSAOUT=1 Q
  1. S PSASEL=Y
  1. ;
  1. PROC W ! S DIR("A",1)="Do you want to select the line items to be edited (S) or",DIR("A")="have them automatically (A) displayed for you?",DIR("B")="A",DIR(0)="SB^S:Select;A:Automatically displayed"
  1. S DIR("?",1)="Enter ""S"" to allow you to select the line items to be edited.",DIR("?",2)="Enter ""A"" to automatically receive prompts for the line items",DIR("?")="that need editing."
  1. D ^DIR K DIR I $G(DIRUT) S PSAOUT=1 Q
  1. G:Y="S" SEL^PSAPROC6
  1. ;
  1. AUTO ;Process line items
  1. F PSAPC=1:1 S PSAMENU=$P(PSASEL,",",PSAPC) Q:'PSAMENU!(PSAOUT) S PSACTRL=$P(PSAERR(PSAMENU),"^",3),(PSALNCNT,PSALINES,PSACS,PSALLSUP)=0 D Q:PSAOUT
  1. .Q:'$D(^XTMP("PSAPV",PSACTRL,"IN"))!('$D(^XTMP("PSAPV",PSACTRL,"IT")))
  1. .S PSAIN=^XTMP("PSAPV",PSACTRL,"IN"),PSALOC=+$P(PSAIN,"^",7),PSAMV=+$P(PSAIN,"^",12)
  1. .D HDR W !,"Order#: "_$P(PSAIN,"^",4)_" Invoice#: "_$P(PSAIN,"^",2)_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN),!,PSASLN
  1. .W:$P(PSAIN,"^",9)="CS" !!,"MASTER VAULT: "_$S(PSAMV:$P($G(^PSD(58.8,PSAMV,0)),"^"),1:"Blank")
  1. .I $P(PSAIN,"^",10)="" D
  1. ..D SITES^PSAUTL1 S PSALOCN=$S($D(^PSD(58.8,PSALOC,0)):$P($G(^PSD(58.8,PSALOC,0)),"^"),1:"UNKNOWN")_PSACOMB
  1. ..W !!,"PHARMACY LOCATION: " I 'PSALOC W "Blank" Q
  1. ..W:$L(PSALOCN)>76 !,$P(PSALOCN,"(IP)",1)_"(IP)",!?17,$P(PSALOCN,"(IP)",2) W:$L(PSALOCN)<77 !,PSALOCN
  1. .W ! S PSARECD=$S(+$P(PSAIN,"^",11):+$P(PSAIN,"^",11),+$P(PSAIN,"^",6):+$P(PSAIN,"^",6),1:"") D RECD^PSAPROC3 Q:PSAOUT
  1. .;
  1. .;Gets & processes the line items
  1. .S PSALINE="" F S PSALINE=$O(^XTMP("PSAPV",PSACTRL,"IT",PSALINE)) Q:PSALINE=""!(PSAOUT) D Q:PSAOUT
  1. ..S PSALNCNT=PSALNCNT+1,(PSAPASS,PSASUPP)=0,PSADATA=^XTMP("PSAPV",PSACTRL,"IT",PSALINE)
  1. ..I $P(PSADATA,"^",18)="OK"!($P(PSADATA,"^",18)="P") S:$P(PSADATA,"^",18)="OK" $P(^XTMP("PSAPV",PSACTRL,"IT",PSALINE),"^",18)="P" S PSALINES=PSALINES+1 S:$P(PSADATA,"^",19)="CS" PSACS=PSACS+1 Q
  1. ..S PSADATA=^XTMP("PSAPV",PSACTRL,"IT",PSALINE)
  1. ..S PSAIEN=$S(+$P(PSADATA,"^",15):+$P(PSADATA,"^",15),1:+$P(PSADATA,"^",6)),PSASUB=+$P(PSADATA,"^",7),PSANDC=$P($P(PSADATA,"^",4),"~"),PSAVSN=$P($P(PSADATA,"^",5),"~")
  1. ..D EDITDISP^PSAUTL1 D ^PSAPROC9
  1. .D:'PSAOUT SETINV
  1. Q:PSAOUT
  1. W @IOF,!,"If you are changing the status of an invoice to Processed, this is the",!,"last time you will be allowed to edit it before it goes to the verifier."
  1. W !,"If you are not changing the status of an invoice to Processed, you can",!,"edit it now.",!!,"You can edit the invoice's delivery date, pharmacy location, master vault,"
  1. W !,"and the line item's drug, quantity received, order unit, and dispense units",!,"per order unit. The reorder level can be edited if the pharmacy location or"
  1. W !,"master vault is set up to track the reorder levels.",!
  1. S DIR(0)="Y",DIR("A")="Edit invoices",DIR("B")="N",DIR("?",1)="Enter Yes to edit the invoices you just processed.",DIR("?",1)="Enter No to accept the invoices as they are now."
  1. S DIR("??")="^D EDIT^PSAPROC2" D ^DIR K DIR I $G(DIRUT)!('Y) S PSAOUT=1 Q
  1. ;
  1. EDITINV ;Edits the invoice before placing in Processed status.
  1. K PSAERR S (PSACTRL,PSAERR,PSAOUT)=0
  1. F S PSACTRL=$O(^XTMP("PSAPV",PSACTRL)) Q:PSACTRL="" D
  1. .S:$D(^XTMP("PSAPV",PSACTRL,"IN")) PSAERR=PSAERR+1,PSAERR(PSAERR)=$P(^XTMP("PSAPV",PSACTRL,"IN"),"^",4)_"^"_$P(^("IN"),"^",2)_"^"_PSACTRL_"^"_$P(^("IN"),"^",7)_"^"_$P(^("IN"),"^",12)
  1. ;
  1. W @IOF,!?26,"<<< EDIT INVOICE SCREEN >>>"
  1. W !!,"Choose the invoices to be edited. You can edit the invoice's date received and",!,"the line item's drug, quantity received, and order unit. The reorder and"
  1. W !,"stock levels can be edited if the pharmacy location or master vault is set",!,"up to maintain the reorder levels.",!,PSASLN,!
  1. S (PSACNT,PSAMENU,PSASTOP)=0
  1. F S PSAMENU=+$O(PSAERR(PSAMENU)) Q:'PSAMENU!(PSAOUT) D Q:PSASTOP
  1. .I $Y+4>IOSL D HDR1 Q:PSASTOP
  1. .S PSAORD=$P(PSAERR(PSAMENU),"^"),PSAINV=$P(PSAERR(PSAMENU),"^",2),PSACTRL=$P(PSAERR(PSAMENU),"^",3),PSACNT=PSACNT+1
  1. .W !?1,PSACNT_".",?4,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+^XTMP("PSAPV",PSACTRL,"IN"))
  1. K PSASTOP
  1. S DIR(0)="LO^1:"_PSACNT,DIR("A")="Select invoices",DIR("?",1)="Enter the number to the left of the invoice",DIR("?")="data to be edited or a range of numbers." W !
  1. S DIR("??")="^D SEL^PSAPROC2" D ^DIR K DIR G:Y="" SETINV I $G(DTOUT)!($G(DUOUT)) S PSAOUT=1 Q
  1. S PSASEL=Y D ^PSAPROC6
  1. Q
  1. HDR ;Screen header
  1. W @IOF,!?19,"<<< EDIT INVOICES TO BE PROCESSED SCREEN >>>",!
  1. Q
  1. ;
  1. HDR1 ;Screen header with hold
  1. S PSASS=21-$Y F PSAKK=1:1:PSASS W !
  1. S DIR(0)="E" D ^DIR K DIR I $G(DIRUT) S PSASTOP=1 Q
  1. W @IOF,!?26,"<<< EDIT INVOICE SCREEN >>>",!!,PSASLN
  1. Q
  1. ;
  1. S PSASS=21-$Y F PSAKK=1:1:PSASS W !
  1. S DIR(0)="E" D ^DIR K DIR I $G(DIRUT) S PSASTOP=1 Q
  1. W @IOF,!?19,"<<< EDIT INVOICES TO BE PROCESSED SCREEN >>>",!!,PSASLN
  1. Q
  1. ;
  1. SETINV ;Sets invoice to processed if okay.
  1. S PSAOK=1
  1. I PSALLSUP=PSALNCNT S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",7)="",$P(^("IN"),"^",9)="",$P(^("IN"),"^",10)="",$P(^("IN"),"^",12)="",$P(^("IN"),"^",13)="SUP",PSAOK=1 G STATUS
  1. E S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",13)=""
  1. I PSACS D Q:PSAOUT
  1. .S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",9)="CS"
  1. .I $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",12)="" S PSACS(PSACTRL)="" D MASTER^PSAPROC9 Q:PSAOUT S:$P(^XTMP("PSAPV",PSACTRL,"IN"),"^",12)="" PSAOK=0
  1. .I PSACS=PSALNCNT S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",10)="ALL CS" Q
  1. .I PSACS'=PSALNCNT S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",10)=""
  1. I 'PSACS S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",9)="",$P(^("IN"),"^",10)="",$P(^("IN"),"^",12)="" D:$P(^("IN"),"^",7)="" GETLOC^PSAPROC9 Q:PSAOUT S:$P(^XTMP("PSAPV",PSACTRL,"IN"),"^",7)="" PSAOK=0
  1. ;
  1. STATUS I PSALNCNT=PSALINES!(PSALNCNT=PSALLSUP),PSAOK D CHG^PSAPROC6,END^PSAPROC Q
  1. E W !!,"** The invoice has not been placed in a Processed status!"
  1. D END^PSAPROC
  1. Q
  1. EDIT ;Extended help for 'edit any invoices'
  1. W !?5,"If you answer Yes, a list of the invoices you were able to process will",!?5,"be displayed. You will be able to select the invoices to be edited then"
  1. W !?5,"the line item numbers. You will be able to edit the date the invoice was",!?5,"received, drug, quantity, order unit, and dispense units per order unit."
  1. W !?5,"If the drugs are assigned to a pharmacy location or master vault that",!?5,"maintains reorder levels, you will also be able to edit the reorder and",!?5,"stock levels.",!!?5,"Enter No if the invoice are correct."
  1. Q
  1. SEL ;Extended help to 'Select invoices to process'
  1. W !?5,"Enter the number to the left of the invoice data that you want to process."
  1. Q
  1. SELHELP ;Extended help to 'Select invoices to edit'
  1. W !?5,"Enter the number to the left of the invoice data that you want to",!?5,"edit. The line items will be displayed for you to select the ones"
  1. W !?5,"you want to edit. You are given this opportunity to edit the invoice",!?5,"because the automatic display may not catch all the needed corrections."
  1. W !!?5,"For example, the quantity on the invoice may be 6, but one bottle may",!?5,"be broken. Six is a valid quantity that the automatic display will not"
  1. W !?5,"realize as being incorrect. By answering Yes, you will be allowed to change",!?5,"the quantity to 5."
  1. Q