source: FOIAVistA/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAPROC2.m@ 1203

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

initial load of FOIAVistA 6/30/08 version

File size: 8.1 KB
Line 
1PSAPROC2 ;BIR/JMB-Process Uploaded Prime Vendor Invoice Data - CONT'D ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**34,50**; 10/24/97
3 ;This routine allows the user to edit invoices with errors or missing
4 ;data.
5 ;
6CHK S PSA=+$O(PSAERR(0))
7 I 'PSA W @IOF,!!,"There are no invoices that need to be processed." D END^PSAPROC Q
8 ;
9INV D HDR W !," More data is needed on the following invoices. Choose the invoices from",!," the list you want to edit.",!,PSASLN
10 S (PSACNT,PSAMENU,PSASTOP)=0
11 F S PSAMENU=+$O(PSAERR(PSAMENU)) Q:'PSAMENU!(PSAOUT) D Q:PSASTOP
12 .I $Y+4>IOSL D HEADER Q:PSASTOP
13 .S PSAORD=$P(PSAERR(PSAMENU),"^"),PSAINV=$P(PSAERR(PSAMENU),"^",2),PSACTRL=$P(PSAERR(PSAMENU),"^",3),PSACNT=PSACNT+1
14 .W !?2,PSAMENU_". ",?6,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+^XTMP("PSAPV",PSACTRL,"IN"))
15 W !,PSASLN K DIR,PSASTOP
16 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 !
17 S DIR("??")="^D SELHELP^PSAPROC2" D ^DIR K DIR I $G(DIRUT) S PSAOUT=1 Q
18 S PSASEL=Y
19 ;
20PROC 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"
21 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."
22 D ^DIR K DIR I $G(DIRUT) S PSAOUT=1 Q
23 G:Y="S" SEL^PSAPROC6
24 ;
25AUTO ;Process line items
26 F PSAPC=1:1 S PSAMENU=$P(PSASEL,",",PSAPC) Q:'PSAMENU!(PSAOUT) D Q:PSAOUT
27 .Q:'$D(PSAERR(PSAMENU))
28 .S PSACTRL=$P(PSAERR(PSAMENU),"^",3),(PSALNCNT,PSALINES,PSACS,PSALLSUP)=0
29 .Q:'$D(^XTMP("PSAPV",PSACTRL,"IN"))!('$D(^XTMP("PSAPV",PSACTRL,"IT")))
30 .S PSAIN=^XTMP("PSAPV",PSACTRL,"IN"),PSALOC=+$P(PSAIN,"^",7),PSAMV=+$P(PSAIN,"^",12)
31 .D HDR W !,"Order#: "_$P(PSAIN,"^",4)_" Invoice#: "_$P(PSAIN,"^",2)_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN),!,PSASLN
32 .W:$P(PSAIN,"^",9)="CS" !!,"MASTER VAULT: "_$S(PSAMV:$P($G(^PSD(58.8,PSAMV,0)),"^"),1:"Blank")
33 .I $P(PSAIN,"^",10)="" D
34 ..D SITES^PSAUTL1 S PSALOCN=$S($D(^PSD(58.8,PSALOC,0)):$P($G(^PSD(58.8,PSALOC,0)),"^"),1:"UNKNOWN")_PSACOMB
35 ..W !!,"PHARMACY LOCATION: " I 'PSALOC W "Blank" Q
36 ..W:$L(PSALOCN)>76 !,$P(PSALOCN,"(IP)",1)_"(IP)",!?17,$P(PSALOCN,"(IP)",2) W:$L(PSALOCN)<77 !,PSALOCN
37 .W ! S PSARECD=$S(+$P(PSAIN,"^",11):+$P(PSAIN,"^",11),+$P(PSAIN,"^",6):+$P(PSAIN,"^",6),1:"") D RECD^PSAPROC3 Q:PSAOUT
38 .;
39 .;Gets & processes the line items
40 .S PSALINE="" F S PSALINE=$O(^XTMP("PSAPV",PSACTRL,"IT",PSALINE)) Q:PSALINE=""!(PSAOUT) D Q:PSAOUT
41 ..S PSALNCNT=PSALNCNT+1,(PSAPASS,PSASUPP)=0,PSADATA=^XTMP("PSAPV",PSACTRL,"IT",PSALINE)
42 ..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
43 ..S PSADATA=^XTMP("PSAPV",PSACTRL,"IT",PSALINE)
44 ..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),"~")
45 ..D EDITDISP^PSAUTL1 D ^PSAPROC9
46 .D:'PSAOUT SETINV
47 Q:PSAOUT
48 I '$O(PSAERR(0)) Q ;*50 rid select (1-0)
49 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."
50 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,"
51 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"
52 W !,"master vault is set up to track the reorder levels.",!
53 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."
54 S DIR("??")="^D EDIT^PSAPROC2" D ^DIR K DIR I $G(DIRUT)!('Y) S PSAOUT=1 Q
55 ;
56EDITINV ;Edits the invoice before placing in Processed status.
57 K PSAERR S (PSACTRL,PSAERR,PSAOUT)=0
58 F S PSACTRL=$O(^XTMP("PSAPV",PSACTRL)) Q:PSACTRL="" D
59 .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)
60 ;
61 W @IOF,!?26,"<<< EDIT INVOICE SCREEN >>>"
62 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"
63 W !,"stock levels can be edited if the pharmacy location or master vault is set",!,"up to maintain the reorder levels.",!,PSASLN,!
64 S (PSACNT,PSAMENU,PSASTOP)=0
65 F S PSAMENU=+$O(PSAERR(PSAMENU)) Q:'PSAMENU!(PSAOUT) D Q:PSASTOP
66 .I $Y+4>IOSL D HDR1 Q:PSASTOP
67 .S PSAORD=$P(PSAERR(PSAMENU),"^"),PSAINV=$P(PSAERR(PSAMENU),"^",2),PSACTRL=$P(PSAERR(PSAMENU),"^",3),PSACNT=PSACNT+1
68 .W !?1,PSACNT_".",?4,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+^XTMP("PSAPV",PSACTRL,"IN"))
69 K PSASTOP
70 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 !
71 S DIR("??")="^D SEL^PSAPROC2" D ^DIR K DIR S:Y="" DUOUT=1 I $G(DTOUT)!($G(DUOUT)) S PSAOUT=1 Q ;*50
72 S PSASEL=Y D ^PSAPROC6
73 Q
74HDR ;Screen header
75 W @IOF,!?19,"<<< EDIT INVOICES TO BE PROCESSED SCREEN >>>",!
76 Q
77 ;
78HDR1 ;Screen header with hold
79 S PSASS=21-$Y F PSAKK=1:1:PSASS W !
80 S DIR(0)="E" D ^DIR K DIR I $G(DIRUT) S PSASTOP=1 Q
81 W @IOF,!?26,"<<< EDIT INVOICE SCREEN >>>",!!,PSASLN
82 Q
83 ;
84HEADER ;Screen hold with header
85 S PSASS=21-$Y F PSAKK=1:1:PSASS W !
86 S DIR(0)="E" D ^DIR K DIR I $G(DIRUT) S PSASTOP=1 Q
87 W @IOF,!?19,"<<< EDIT INVOICES TO BE PROCESSED SCREEN >>>",!!,PSASLN
88 Q
89 ;
90SETINV ;Sets invoice to processed if okay.
91 S PSAOK=1
92 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
93 E S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",13)=""
94 I PSACS D Q:PSAOUT
95 .S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",9)="CS"
96 .I $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",12)="" S PSACS(PSACTRL)="" D MASTER^PSAPROC9 Q:PSAOUT S:$P(^XTMP("PSAPV",PSACTRL,"IN"),"^",12)="" PSAOK=0
97 .I PSACS=PSALNCNT S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",10)="ALL CS" Q
98 .I PSACS'=PSALNCNT S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",10)=""
99 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
100 ;
101STATUS I PSALNCNT=PSALINES!(PSALNCNT=PSALLSUP),PSAOK D CHG^PSAPROC6,END^PSAPROC Q
102 E W !!,"** The invoice has not been placed in a Processed status!"
103 D END^PSAPROC
104 Q
105EDIT ;Extended help for 'edit any invoices'
106 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"
107 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."
108 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."
109 Q
110SEL ;Extended help to 'Select invoices to process'
111 W !?5,"Enter the number to the left of the invoice data that you want to process."
112 Q
113SELHELP ;Extended help to 'Select invoices to edit'
114 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"
115 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."
116 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"
117 W !?5,"realize as being incorrect. By answering Yes, you will be allowed to change",!?5,"the quantity to 5."
118 Q
Note: See TracBrowser for help on using the repository browser.