source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAPROC1.m@ 701

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

initial load of WorldVistAEHR

File size: 6.1 KB
Line 
1PSAPROC1 ;BIR/JMB-Process Uploaded Prime Vendor Invoice Data - CONT'D ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**12,21,50,60**; 10/24/97;Build 4
3 ;
4 ;This routine processes uploaded invoices.
5 ;
6 ;;References to ^PSDRUG( are covered by IA #2095
7 ;
8CHK ;Check for invoices with a status of "OK" (uploaded & error free)
9 ;& status of "" (uploaded & errors).
10 K PSA,PSAOK S (PSACNTOK,PSACNTER,PSACTRL)=0
11 F S PSACTRL=$O(^XTMP("PSAPV",PSACTRL)) Q:PSACTRL="" D
12 .;DAVE B (PSA*3*12 13MAY99) Restrict to appropriate division
13 .I $G(PSASORT)'=0,$G(PSASORT)'="",$D(^XTMP("PSAPV",PSACTRL,"ST")),$P(^XTMP("PSAPV",PSACTRL,"ST"),"^",1)'=PSASORT Q
14 .Q:'$D(^XTMP("PSAPV",PSACTRL,"IN")) S PSAIN=^XTMP("PSAPV",PSACTRL,"IN")
15 .I $P(PSAIN,"^",8)="OK"!($P(PSAIN,"^",13)="SUP") D Q
16 ..I $P(PSAIN,"^",10)="ALL CS",$P(PSAIN,"^",12)'="" D OK Q
17 ..I $P(PSAIN,"^",10)'="ALL CS",$P(PSAIN,"^",9)="CS",$P(PSAIN,"^",12)'="",$P(PSAIN,"^",7)'="" D OK Q
18 ..I $P(PSAIN,"^",10)'="ALL CS",$P(PSAIN,"^",9)'="CS",$P(PSAIN,"^",7)'="" D OK Q
19 ..S PSACNTER=PSACNTER+1,PSAERR(PSACNTER)=$P(PSAIN,"^",4)_"^"_$P(PSAIN,"^",2)_"^"_PSACTRL_"^"_$P(PSAIN,"^",7)
20 .I $P(PSAIN,"^",8)="" S PSACNTER=PSACNTER+1,PSAERR(PSACNTER)=$P(PSAIN,"^",4)_"^"_$P(PSAIN,"^",2)_"^"_PSACTRL_"^"_$P(PSAIN,"^",7)
21 S PSA=+$O(PSAOK(0))
22 G:'PSA ^PSAPROC2
23 ;
24NOERROR ;Display list of invoices that can be processed by selecting
25 ;invoice number.
26 W @IOF,!?21,"<<< PROCESS ENTIRE INVOICE SCREEN >>>"
27 W !!?2,"No errors have been detected on the following invoices. If there are no",!?2,"corrections, you can change the invoices' status to ""Processed"" by"
28 W !?2,"selecting them from the list. If you do have corrections, press the return",!?2,"key then a second list will be displayed. You will be able to choose the",!?2,"invoices from that list and enter corrections."
29 W !!?2,"Choose the invoices from the list you want to process.",!,PSADLN
30 S (PSACNT,PSASTOP)=0,PSAMENU=""
31 F S PSAMENU=$O(PSAOK(PSAMENU)) Q:PSAMENU=""!(PSAOUT) D Q:PSASTOP
32 .I $Y+4>IOSL D HEADER Q:PSASTOP
33 .S PSAORD=$P(PSAOK(PSAMENU),"^"),PSAINV=$P(PSAOK(PSAMENU),"^",2),PSACTRL=$P(PSAOK(PSAMENU),"^",3),PSACNT=PSACNT+1
34 .W !?2,PSAMENU_". ",?4,"Order#: "_PSAORD_" Invoice#: "_PSAINV_" Invoice Date: "_$$FMTE^XLFDT(+^XTMP("PSAPV",PSACTRL,"IN"))
35 K PSASTOP W !,PSADLN
36 S DIR(0)="LO^1:"_PSACNT,DIR("A")="Select invoices to process",DIR("?",1)="Enter the number to the left of the invoice",DIR("?")="data to be processed or a range of numbers." W !
37 S DIR("??")="^D SEL^PSAPROC1" D ^DIR K DIR G:Y="" EDIT I $G(DIRUT) S PSAOUT=1 Q
38 S PSASEL=Y
39INVSEL F PSAPC=1:1 S PSA=+$P(PSASEL,",",PSAPC) Q:'PSA D Q:PSAOUT
40 .I '$D(PSAOK(PSA)) Q ;*50
41 .S PSACTRL=$P(PSAOK(PSA),"^",3) Q:'$D(^XTMP("PSAPV",PSACTRL,"IN"))
42 .S PSAIN=^XTMP("PSAPV",PSACTRL,"IN"),PSARECD=+$P(PSAIN,"^",6),PSALINES=0
43 .D PROCESS
44 Q:PSAOUT G:'+$O(PSAOK(0)) PROC2
45EDIT ;Edit error free invoices
46 S PSA=0 F S PSA=$O(PSAOK(PSA)) Q:'PSA D
47 .I $P($G(^XTMP("PSAPV",$P(PSAOK(PSA),"^",3),"IN")),"^",8)="OK"!($P($G(^("IN")),"^",13)="SUP") D
48 ..S PSACNTER=PSACNTER+1,PSAERR(PSACNTER)=$P(^XTMP("PSAPV",$P(PSAOK(PSA),"^",3),"IN"),"^",4)_"^"_$P(^("IN"),"^",2)_"^"_$P(PSAOK(PSA),"^",3)_"^"_$P(^("IN"),"^",7)
49 ;
50PROC2 I +$O(PSAERR(0)) D ^PSAPROC2
51 Q
52 ;
53HEADER S PSASS=21-$Y F PSAKK=1:1:PSASS W !
54 S DIR(0)="E" D ^DIR K DIR I $G(DIRUT) S PSASTOP=1 Q
55 W @IOF,!?21,"<<< PROCESS ENTIRE INVOICE SCREEN >>>",!!,PSADLN
56 Q
57 ;
58PROCESS ;Get date recd & line item data
59 I $P(PSAIN,"^",13)="SUP" D HDR,SUPPLY^PSAPROC6 Q
60 D HDR,RECD^PSAPROC3 Q:PSAOUT S (PSACS,PSALNCNT)=0,PSALINE=""
61 F S PSALINE=$O(^XTMP("PSAPV",PSACTRL,"IT",PSALINE)) Q:PSALINE="" D Q:PSAOUT
62 .K PSAPHARM,PSAMV
63 .S PSALNCNT=PSALNCNT+1,(PSADISP,PSADU,PSAHDR)=0
64 .S PSADATA=^XTMP("PSAPV",PSACTRL,"IT",PSALINE),PSAIEN=$S(+$P(PSADATA,"^",15):+$P(PSADATA,"^",15),+$P(PSADATA,"^",6):+$P(PSADATA,"^",6),1:0),PSASUB=+$P(PSADATA,"^",7)
65 .S:$P(PSADATA,"^",19)="CS" PSAMV=+$P(PSAIN,"^",12) S:$P(PSADATA,"^",19)'="CS" PSAPHARM=+$P(PSAIN,"^",7)
66 .S PSALOC=+$S($P(PSADATA,"^",19)="CS":PSAMV,1:PSAPHARM)
67 .I $P($G(^PSDRUG(PSAIEN,660)),"^",8)="" D:'PSAHDR HDR D:'PSADISP DISPLAY^PSAUTL1 D DU^PSAPROC8 Q:PSAOUT
68 .I '+$P($G(^PSDRUG(PSAIEN,1,PSASUB,0)),"^",7),$P($G(^PSDRUG(PSAIEN,660)),"^",8)'="" D:'PSAHDR HDR D:'PSADISP DISPLAY^PSAUTL1 D:PSASUB DUOU^PSAPROC8 D:'PSASUB DUOU^PSAPROC3 Q:PSAOUT
69 .I +$P($G(^PSDRUG(PSAIEN,1,PSASUB,0)),"^",6)'=+$P(PSADATA,"^",3) D:'PSAHDR HDR D:'PSADISP DISPLAY^PSAUTL1 D PRICE^PSAPROC8 Q:PSAOUT
70 .I +$P($G(^PSD(58.8,PSALOC,0)),"^",14) D Q:PSAOUT
71 ..I '+$P($G(^PSD(58.8,PSALOC,1,PSAIEN,0)),"^",3),'+$P(PSADATA,"^",27) D:'PSAHDR HDR D:'PSADISP DISPLAY^PSAUTL1 D STOCK^PSAPROC8 Q:PSAOUT
72 ..I '+$P($G(^PSD(58.8,PSALOC,1,PSAIEN,0)),"^",5),'+$P(PSADATA,"^",21) D:'PSAHDR HDR D:'PSADISP DISPLAY^PSAUTL1 D REORDER^PSAPROC8
73 .D SETLINE^PSAPROC3 S:$P(^XTMP("PSAPV",PSACTRL,"IT",PSALINE),"^",19)="CS" PSACS=PSACS+1
74 S PSAOK=0
75CS I PSACS D Q:PSAOUT
76 .S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",9)="CS"
77 .I $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",12)="" S PSACS(PSACTRL)="" D MASTER^PSAPROC9 Q:PSAOUT S:$P(^XTMP("PSAPV",PSACTRL,"IN"),"^",12)'="" PSAOK=1 ;PSA*60
78 .I PSACS=PSALNCNT S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",10)="ALL CS" Q
79 .I PSACS'=PSALNCNT S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",10)=""
80NCS 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=1
81 ;
82 I PSALNCNT=PSALINES S $P(^XTMP("PSAPV",PSACTRL,"IN"),"^",8)="P" K PSAOK(PSA) W !!,"The invoice status has been changed to Processed!" D ^PSAPROC7 I 1 ;PSA*3*21 (1/3/01- file immediately);*50
83 E W !!,"** The invoice has not been placed in a Processed status!"
84 D END^PSAPROC
85 Q
86 ;
87HDR ;Header for editing line items with missing data
88 S PSAHDR=1
89 W @IOF,!?21,"<<< PROCESS ENTIRE INVOICE SCREEN >>>",!,"Order#: "_$P(PSAIN,"^",4)_" Invoice#: "_$P(PSAIN,"^",2)_" Invoice Date: "_$$FMTE^XLFDT(+PSAIN),!,PSADLN
90 Q
91OK ;Sets okay array
92 S PSACNTOK=PSACNTOK+1,PSAOK(PSACNTOK)=$P(^XTMP("PSAPV",PSACTRL,"IN"),"^",4)_"^"_$P(^("IN"),"^",2)_"^"_PSACTRL_"^"_$P(^("IN"),"^",7)
93 Q
94 ;
95SEL ;Extended help to 'Select invoices'
96 W !?5,"Enter the number to the left of the invoice data that you want to process."
97 Q
Note: See TracBrowser for help on using the repository browser.