source: FOIAVistA/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAVER.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: 9.1 KB
Line 
1PSAVER ;BIR/JMB-Verify Invoices ;9/6/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**60,65**; 10/24/97;Build 2
3 ;This routine allows the user to verify processed invoices. The entire
4 ;invoice may be verified with/without editing. After verification, the
5 ;pharmacy location or master vault balances are incremented during a
6 ;background job (PSAVER5).
7 ;
8 I '$D(^XUSEC("PSA ORDERS",DUZ)) W !,"You do not hold the key to enter the option." Q
9 I '$D(^PSD(58.811,"ASTAT","P")) W !!,"There are no invoices that need to be verified." H 1 Q
10 ;
11 ;Creates a list of invoices that can be verified by the user. If the
12 ;invoice contains at least one item marked as a controlled substance,
13 ;the user must have the pharmacist key before it can be verified.
14 S (PSACNT,PSAIEN,PSASUP)=0
15 F S PSAIEN=+$O(^PSD(58.811,"ASTAT","P",PSAIEN)) Q:'PSAIEN D
16 .Q:'$D(^PSD(58.811,PSAIEN,0))
17 .S PSAIEN1=0 F S PSAIEN1=+$O(^PSD(58.811,"ASTAT","P",PSAIEN,PSAIEN1)) Q:'PSAIEN1 D
18 ..Q:'$D(^PSD(58.811,PSAIEN,1,PSAIEN1,0))
19 ..I $P(^PSD(58.811,PSAIEN,1,PSAIEN1,0),"^",10)'=DUZ,$P(^(0),"^",8)="N"!(($P(^(0),"^",8)="S"!($P(^(0),"^",8)="A"))&($D(^XUSEC("PSJ RPHARM",DUZ)))) S PSACNT=PSACNT+1,PSAVER(PSACNT)=PSAIEN_"^"_PSAIEN1
20 I 'PSACNT D H 1 G EXIT
21 .W !!,"There is at least one invoice that needs to be verified. However, invoices",!,"cannot be verified by the same person who processed them and a pharmacist",!,"must verify invoices that contain a drug marked as a controlled substance."
22 .W !!,"There are no invoices you can verify because the invoice(s) meet one of the",!,"above conditions."
23 ;
24ESIG D SIG^XUSESIG G:X1="" EXIT S PSAOUT=0
25 ;
26PRINT ;Asks & prints all invoices the user can verify.
27 W ! S DIR(0)="Y",DIR("B")="N",DIR("A")="Print processed invoices",DIR("?",1)="Enter YES to print all invoices you can verify then begin verification.",DIR("?")="Enter NO to bypass printing the invoices and begin verification."
28 S DIR("??")="^D PRINTYN^PSAVER"
29 D ^DIR K DIR G:$G(DIRUT) EXIT G:'Y ENTIRE
30 W ! S %ZIS="Q" D ^%ZIS G:POP ENTIRE
31 I $D(IO("Q")) D G ENTIRE
32 .K ZTSAVE
33 .S ZTDESC="Drug Acct. - Print Prime Vendor Invoices",ZTDTH=$H,ZTRTN="PRTINV^PSAVER",ZTSAVE("PSAVER(")="" D ^%ZTLOAD
34 D PRTINV
35 ;
36ENTIRE ;Displays a list of all invoices the user can select to be verified.
37 S PSASLN="",$P(PSASLN,"-",80)="",PSADLN="",$P(PSADLN,"=",80)=""
38 W @IOF,!?21,"<<< VERIFY ENTIRE INVOICE SCREEN >>>"
39 W !!?2,"If there are no corrections, you can change the invoices' status",!?2,"to ""Verified"" by selecting them from the list. If you do have"
40 W !?2,"corrections, press the return key then a second list will be",!?2,"displayed. You will be able to choose the invoices from that list",!?2,"and enter corrections.",!!?2,"Choose the invoices from the list you want to verify.",!,PSADLN
41 S (PSA,PSACNT,PSASTOP)=0
42 F S PSA=+$O(PSAVER(PSA)) Q:'PSA D Q:PSASTOP
43 .I $Y+5>IOSL D HDR Q:PSASTOP
44 .S PSAIEN=$P(PSAVER(PSA),"^"),PSAIEN1=$P(PSAVER(PSA),"^",2),PSAORD=$P(^PSD(58.811,PSAIEN,0),"^"),PSAINV=$P(^PSD(58.811,PSAIEN,1,PSAIEN1,0),"^"),PSAINVDT=+$P(^(0),"^",2),PSACNT=PSACNT+1
45 .W !?(3-$L(PSA)),PSA_". Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(PSAINVDT)
46 K PSASTOP W !,PSADLN
47 S DIR(0)="LO^1:"_PSACNT,DIR("A")="Select invoices to verify",DIR("?",1)="Enter the number to the left of the invoice",DIR("?")="data to be verified or a range of numbers.",DIR("??")="^D SEL^PSAVER"
48 W ! D ^DIR K DIR G:$G(DTOUT)!($G(DUOUT)) EXIT
49 I Y="" D LOAD G EDIT
50 S PSASEL=Y
51 ;
52OKAY ;Verifies correct invoices were selected.
53 W @IOF,!?21,"<<< VERIFY ENTIRE INVOICE SCREEN >>>",!,PSADLN,!
54 S PSACNT=0,PSATMP="" F PSAPC=1:1 S PSA=+$P(PSASEL,",",PSAPC) Q:'PSA D
55 .S PSAIEN=$P(PSAVER(PSA),"^"),PSAIEN1=$P(PSAVER(PSA),"^",2)
56 .Q:'$D(^PSD(58.811,PSAIEN,1,PSAIEN1,0))
57 .S PSAIN=^PSD(58.811,PSAIEN,1,PSAIEN1,0)
58 .S PSAORD=$P(^PSD(58.811,PSAIEN,0),"^"),PSAINV=$P(PSAIN,"^"),PSAINVDT=+$P(PSAIN,"^",2),PSACNT=PSACNT+1
59 .W !?(3-$L(PSACNT)),PSACNT_". Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(PSAINVDT)
60 .I +$P(PSAIN,"^",5) D
61 ..S PSALOC=+$P(PSAIN,"^",5) D SITES^PSAUTL1 S PSALOCN=$P(^PSD(58.8,PSALOC,0),"^")_PSACOMB
62 ..W:$L(PSALOCN)>76 !?6,$P(PSALOCN,"(IP)",1)_"(IP)",!?23,$P(PSALOCN,"(IP)",2) W:$L(PSALOCN)<77 !?6,PSALOCN
63 .I +$P(PSAIN,"^",12) W !?6,"MASTER VAULT: "_$P(^PSD(58.8,+$P(PSAIN,"^",12),0),"^")
64 .W !
65 .S PSAMSG="" D VERLOCK^PSAVER4 ; <== PSA*3*60 (RJS-VMP)
66 .W:$L(PSAMSG) ?5,PSAMSG,!
67 I PSASEL'=PSATMP S PSASEL=PSATMP K PSATMP
68 I PSASEL="" S DIR(0)="E" D ^DIR G:$G(DIRUT) EXIT G ENTIRE
69 S DIR(0)="Y",DIR("B")="N",DIR("A")="Are you sure "_$S(PSACNT=1:"this invoice's",1:"these invoices'")_" status should be changed to Verified"
70 S DIR("?",1)="Enter YES if the list contains invoices with no corrections.",DIR("?",2)="Enter NO if the list contains at least one invoice you do not",DIR("?")="want to verify.",DIR("??")="^D VERIFY^PSAVER"
71 D ^DIR K DIR D:'Y VERUNLCK^PSAVER4 G:$G(DIRUT) EXIT G:'Y ENTIRE ; <== PSA*3*60 (RJS-VMP)
72 ;
73 ;Send entire invoices to be verified in background, delete these
74 ;invoices from the list, then create a new list of remaining invoices
75 ;to be verified.
76BKGJOB K PSAVBKG W ! F PSAPC=1:1 S PSA=+$P(PSASEL,",",PSAPC) Q:'PSA!(PSAOUT) D
77 .S PSAIEN=$P(PSAVER(PSA),"^"),PSAIEN1=$P(PSAVER(PSA),"^",2),PSASUP=0
78 .Q:'$D(^PSD(58.811,PSAIEN,1,PSAIEN1,0))!('$D(^PSD(58.811,PSAIEN,0)))
79 .S (PSACS,PSAERR,PSALINE,PSALNCNT,PSALNERR,PSALNSU)=0
80 .S PSAIN=^PSD(58.811,PSAIEN,1,PSAIEN1,0),PSAINV=$P(PSAIN,"^"),PSAORD=$P(^PSD(58.811,PSAIEN,0),"^")
81 .F S PSALINE=+$O(^PSD(58.811,PSAIEN,1,PSAIEN1,1,PSALINE)) Q:'PSALINE!(PSAOUT) D
82 ..Q:'$D(^PSD(58.811,PSAIEN,1,PSAIEN1,1,PSALINE,0))
83 ..S PSADATA=^PSD(58.811,PSAIEN,1,PSAIEN1,1,PSALINE,0),PSALNCNT=PSALNCNT+1
84 ..S PSALOC=$S(+$P(PSADATA,"^",10):$P(PSAIN,"^",12),1:$P(PSAIN,"^",5))
85 ..W "." D SETLINE^PSAVER3
86 .Q:PSAOUT
87 .I '$O(PSANOVER(PSAIEN,PSAIEN1,0)) D Q
88 ..S PSAVBKG(PSAIEN,PSAIEN1)="" K PSAVER(PSA) D STATUS^PSAVER3
89 ..I '+$P(^PSD(58.811,PSAIEN,1,PSAIEN1,0),"^",13),$P($G(^PSD(58.8,+$P(PSAIN,"^",5),0)),"^",14)!($P($G(^PSD(58.8,+$P(PSAIN,"^",12),0)),"^",14)) D NEWDRUG^PSAVER1 I 1 ;*50
90 ..W !," Order# "_PSAORD_" Invoice# "_PSAINV_"'s status has been changed to Verified!"
91 .H 1 I $O(PSANOVER(PSAIEN,PSAIEN1,0)) D
92 ..W !,"** Order# "_PSAORD_" Invoice# "_PSAINV_"'s status has not been changed to Verified."
93 ..S PSAERR=0,PSAVER(PSA)=PSAIEN_"^"_PSAIEN1
94 ..D PRINT^PSAVER3
95 ..N PSATMP S PSATMP=PSASEL ;;<*65 RJS
96 ..N PSASEL S PSASEL=PSA
97 ..D VERUNLCK^PSAVER4 ;;*65 RJS>
98 ;
99 ;If the invoices selected are error free, send them to the background
100 ;job to complete the invoice and increment inventory.
101 D LOAD
102 I $O(PSAVBKG(0)) D
103 . K ZTSAVE S ZTDESC="Drug Acct. - Verify Prime Vendor Invoices",ZTIO="",ZTDTH=$H,ZTRTN="^PSAVER6",ZTSAVE("PSASEL")="",ZTSAVE("PSAVBKG(")="" D ^%ZTLOAD Q:$G(POP)
104 K PSAVBKG G:'$O(PSAEDIT(0)) EXIT
105EDIT D EDIT^PSAVER1
106 ;
107EXIT I $O(PSANEWD(0)) D ^PSAVER4
108 K %ZIS,DA,DD,DIC,DIE,DIK,DIR,DIRUT,DO,DR,DTOUT,DUOUT,PSA,PSA10,PSAGAIN,PSA50IEN,PSAA,PSABEFOR,PSACHG,PSACHO,PSACNT,PSACOMB,PSACS,PSACSLN,PSACTRL
109 K PSADATA,PSADD,PSADJ,PSADJD,PSADJFLD,PSADJN,PSADJO,PSADJOP,PSADJOV,PSADJP,PSADJPP,PSADJPV,PSADJQ,PSADJQP,PSADJQV,PSADJSUP,PSADLN,PSADRG
110 K PSADRGN,PSADUOU,PSAEDIT,PSAERR,PSAFLD,PSAFLDS,PSAHOLD,PSAIEN,PSAIEN1,PSAIN,PSAINV,PSAINVDT,PSAISIT,PSAISITN,PSAKK,PSAL,PSALEN,PSALINE,PSALINEN
111 K PSALINES,PSALN,PSALN0,PSALNCNT,PSALND,PSALNERR,PSALNP,PSALNSU,PSALNV,PSALOAD,PSALOC,PSALOCA,PSALOCN,PSAMENU,PSAMV,PSAMVA,PSAMVIEN,PSAMVN,PSAN10,PSANAME,PSANDC,PSANEW,PSANEWD
112 K PSANO,PSANODE,PSANOVER,PSANUM,PSAONE,PSAONEMV,PSAORD,PSAORDU,PSAPHARM,PSAPRICE,PSAOSIT,PSAOSITN,PSAOU,PSAOUT,PSAPC,PSAPCF,PSAPCL,PSAPG,PSAPRINT,PSAQTY,PSALOCK,PSAMSG
113 K PSAREA,PSAREC,PSARECD,PSAREORD,PSASAVE,PSASEL,PSASET,PSASLN,PSASTOCK,PSASUB,PSASUP,PSASUPP,PSATAB,PSATEMP,PSAUPC,PSAVAULT,PSAVBKG,PSAVER,PSAVSN,PSAOU,PSATMP,PSALCK
114 K PSASS,X,X1,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
115 Q
116 ;
117HDR ;Header with screen hold
118 S PSASS=21-$Y F PSAKK=1:1:PSASS W !
119 S DIR(0)="E" D ^DIR K DIR I $G(DIRUT) S PSASTOP=1 Q
120 W @IOF,!?21,"<<< VERIFY ENTIRE INVOICE SCREEN >>>",!!,PSADLN
121 Q
122LOAD ;Loads invoices to be edited into an array
123 K PSAEDIT S (PSALOAD,PSACNT)=0
124 F S PSALOAD=+$O(PSAVER(PSALOAD)) Q:'PSALOAD S PSACNT=PSACNT+1,PSAEDIT(PSACNT)=PSAVER(PSALOAD)
125 K PSAVER
126 Q
127 ;
128PRTINV ;Sends invoices to printer
129 S (PSA,PSAOUT)=0 F S PSA=+$O(PSAVER(PSA)) Q:'PSA!(PSAOUT) D
130 .S PSAORD=$P(PSAVER(PSA),"^"),PSAINV=$P(PSAVER(PSA),"^",2) D ^PSAORDP1
131 D ^%ZISC
132 Q
133 ;
134SEL ;Extended help to 'Select invoices'
135 W !?5,"Enter the number to the left of the invoice data that you want to verify.",!?5,"The invoices' statuses will be changed to Verified."
136 Q
137SELHELP ;Extended help for 'Select invoices to verify'
138 W !?5,"Enter the number to the left of the invoice data you want to verify.",!?5,"The line items will be displayed for you to select the ones you want"
139 W !?5,"to correct."
140 Q
141PRINTYN ;Extended help for 'Print invoices?'
142 W !?5,"Enter YES to print all of the processed invoices you can verify.",!?5,"Enter NO to bypass printing the invoices and continue with verification."
143 Q
144VERIFY ;Extended help for 'Are you sure...'
145 W !!?5,"Enter YES if the list contains invoices to be verified.",!!?5,"Enter NO if the list contains at least one invoice that should not be"
146 W !?5,"verified. You will be returned to the original list so you can choose",!?5,"the invoices to be verified again."
147 Q
Note: See TracBrowser for help on using the repository browser.