source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCHDSP8.m@ 810

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

initial load of WorldVistAEHR

File size: 4.8 KB
Line 
1PRCHDSP8 ;WISC/DJM-PRINT AMENDMENT,ROUTINE #5 ;12/12/95 8:55 AM
2V ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5E34 ;AUTHORITY Edit PRINT
6 ;N CHANGE,CHANGES,OLD,NEW,LCNT,DATA,DT2,I
7 S CHANGE=0 D LCNT^PRCHPAM5(.LCNT)
8 F S CHANGE=$O(^PRC(442,PRCHPO,6,PRCHAM,3,"AC",AMEND,3,CHANGE)) Q:CHANGE'>0 D
9 .S CHANGES=$G(^PRC(442,PRCHPO,6,PRCHAM,3,CHANGE,0)),OLD=$G(^PRC(442,PRCHPO,6,PRCHAM,3,CHANGE,1,1,0))
10 .S NEW=$P($G(^PRC(442,PRCHPO,6,PRCHAM,0)),U,4)
11 .D LINE^PRCHPAM5(.LCNT,2)
12 .I OLD=0 S DATA=" *ADDED THROUGH AMENDMENT*" D DATA^PRCHPAM5(.LCNT,DATA) D
13 ..S DATA="Authority Edit is",DT2=$P(^PRCD(442.2,NEW,0),U,2) D D DATA^PRCHPAM5(.LCNT,DATA) Q
14 ...I $L(DATA)+$L(DT2)>239 S DATA=DATE_":" D DATA^PRCHPAM5(.LCNT,DATA) S DATA=DT2 Q
15 ...S DATA=DATA_" "_DT2
16 .I OLD>0 S DATA="Authority Edit " D D DATA^PRCHPAM5(.LCNT,DATA)
17 ..F I=1:1:3 S DT2=$S(I=1:$P(^PRCD(442.2,OLD,0),U,2),I=2:" has been changed to ",I=3:$P(^PRCD(442.2,NEW,0),U,2)) D CHK(.DATA,DT2)
18 .D LCNT1^PRCHPAM5(LCNT)
19 .Q
20 Q
21 ;
22CHK(DATA,DT2) ;
23 I $L(DATA)+$L(DT2)<241 S DATA=DATA_DT2 Q
24 D DATA^PRCHPAM5(.LCNT,DATA) S DATA=DT2
25 Q
26E35 ;F.O.B. Point PRINT
27 Q
28 ;N CHANGE,OLD,NEW
29 S CHANGE=0 D LCNT^PRCHPAM5(.LCNT)
30 F S CHANGE=$O(^PRC(442,PRCHPO,6,PRCHAM,3,"AC",AMEND,6.4,CHANGE)) Q:CHANGE'>0 D
31 .S OLD=$G(^PRC(442,PRCHPO,6,PRCHAM,3,CHANGE,1,1,0)),NEW=$P($G(^PRC(442,PRCHPO,1)),U,6)
32 .D LINE^PRCHPAM5(.LCNT,2)
33 .S DATA="F.O.B. Point "_OLD_" has been changed to "_NEW D DATA^PRCHPAM5(.LCNT,DATA)
34 .D LCNT1^PRCHPAM5(LCNT)
35 .Q
36 Q
37 ;
38E36 ;ITEM DISCOUNT Add/Edit PRINT
39 N CHANGE,CHANGES,FIELD,OLD,NEW,ITEMD,ITEMD0,NEWI,NEWP,LCNT,DATA,DIS,DIS1,DIS2,PCT,PCT1,PCT2,FLAGDISC
40 S FIELD=0 K ITEMD D LCNT^PRCHPAM5(.LCNT)
41 F S FIELD=$O(^PRC(442,PRCHPO,6,PRCHAM,3,"AC",AMEND,FIELD)) Q:FIELD'>0 D
42 .S CHANGE=0 F S CHANGE=$O(^PRC(442,PRCHPO,6,PRCHAM,3,"AC",AMEND,FIELD,CHANGE)) Q:CHANGE'>0 D
43 ..S CHANGES=$G(^PRC(442,PRCHPO,6,PRCHAM,3,CHANGE,0))
44 ..S OLD=$G(^PRC(442,PRCHPO,6,PRCHAM,3,CHANGE,1,1,0))
45 ..K DIS2,PCT2 ;Remove old values before they get reset in the loop.
46 ..S:FIELD=.01 DIS2=OLD
47 ..S:FIELD=1 PCT2=OLD
48 ..S FLAGDISC=$S(OLD=0:0,1:1) ;FLAGDISC=0 means a new entry, FLAGDISC=1 means a change to an existing entry.
49 ..S ITEMD=$P(CHANGES,U,4) Q:$D(ITEMD(ITEMD)) S ITEMD(ITEMD)=1
50 ..S ITEMD0=$G(^PRC(442,PRCHPO,3,ITEMD,0)) I ITEMD0="" Q
51 ..;If an entry is found in 'AC' x-ref for PERCENT/DOLLAR AMOUNT field #1,then lookup for the ITEM field #.01 and for same item define var DIS2
52 ..;I FIELD=1 S DIS=0 F S DIS=$O(^PRC(442,PRCHPO,6,PRCHAM,3,"AC",36,.01,DIS)) Q:DIS'>0 S DIS1=$P($G(^PRC(442,PRCHPO,6,PRCHAM,3,DIS,0)),U,4) I DIS1=ITEMD D Q
53 ..;.S DIS2=$G(^PRC(442,PRCHPO,6,PRCHAM,3,DIS,1,1,0)) Q
54 ..;If an entry is found in 'AC' x-ref for ITEM field #.01,then lookup for the PERCENT/DOLLAR AMOUNT field #1 and for same item define var PCT2
55 ..I FIELD=.01 S PCT=0 F S PCT=$O(^PRC(442,PRCHPO,6,PRCHAM,3,"AC",36,1,PCT)) Q:PCT'>0 S PCT1=$P($G(^PRC(442,PRCHPO,6,PRCHAM,3,PCT,0)),U,4) I PCT1=ITEMD D Q
56 ...S PCT2=$G(^PRC(442,PRCHPO,6,PRCHAM,3,PCT,1,1,0)) Q
57 ..S NEW=$G(^PRC(442,PRCHPO,3,ITEMD,0)),NEWP=$P(NEW,U,2),NEWI=$P(NEW,U)
58 ..D LINE^PRCHPAM5(.LCNT,2)
59 ..S DIS2=$G(DIS2),PCT2=$G(PCT2)
60 ..I FLAGDISC=0 S DATA=" *ADDED THROUGH AMENDMENT*" D DATA^PRCHPAM5(.LCNT,DATA) D Q
61 ...S DATA=$S(NEWP["$":NEWP,1:NEWP_"%")_" Discount For Item(s): "_NEWI D DATA^PRCHPAM5(.LCNT,DATA) Q
62 ..;The new entry is completed with FLAGDISC=0, the existing entries will be dealt with the follwing conditional code.
63 ..;If both fields ITEM #.01 and PERCENT/DOLLAR AMOUNT #1 are changed.
64 ..I DIS2]"",PCT2]"" S DATA=$S(PCT2["$":PCT2,1:PCT2_"%")_" Discount For Item(s): "_DIS2 D DATA^PRCHPAM5(.LCNT,DATA) D Q
65 ...S DATA=" Will now be AMENDED to read "_$S(NEWP["$":NEWP,1:NEWP_"%")_" discount for an item(s): "_NEWI D DATA^PRCHPAM5(.LCNT,DATA) Q
66 ..;If only field PERCENT/DOLLAR AMOUNT #1 is changed.
67 ..I PCT2]"" S DATA=" The discount on item(s) "_NEWI_" will now be AMENDED to read "_$S(NEWP["$":NEWP,1:NEWP_"%") D DATA^PRCHPAM5(.LCNT,DATA) Q
68 ..;If only field ITEM #.01 is changed.
69 ..I DIS2]"" S DATA=" The item(s) "_DIS2_" will now be AMENDED to read "_NEWI D DATA^PRCHPAM5(.LCNT,DATA) Q
70 .Q
71 D LCNT1^PRCHPAM5(LCNT)
72 Q
73 ;
74E37 ;ITEM DISCOUNT Delete PRINT
75 ;N CHANGE,CHANGES,OLD,LCNT,DATA,DIS,ITEMD,ITEMD0
76 S FIELD=0 K ITEMD D LCNT^PRCHPAM5(.LCNT)
77 F S FIELD=$O(^PRC(442,PRCHPO,6,PRCHAM,3,"AC",AMEND,FIELD)) Q:FIELD'>0 D
78 .S CHANGE=0 F S CHANGE=$O(^PRC(442,PRCHPO,6,PRCHAM,3,"AC",AMEND,FIELD,CHANGE)) Q:CHANGE'>0 D
79 ..S CHANGES=$G(^PRC(442,PRCHPO,6,PRCHAM,3,CHANGE,0)),OLD=$G(^PRC(442,PRCHPO,6,PRCHAM,3,CHANGE,1,1,0))
80 ..S ITEMD=$P(CHANGES,U,4)
81 ..S ITEMD0=$G(^PRC(442,PRCHPO,3,ITEMD,0)) I ITEMD="" Q
82 ..S DIS=$P($G(^PRC(442,PRCHPO,3,ITEMD,0)),U)
83 ..D LINE^PRCHPAM5(.LCNT,2)
84 ..S DATA=" *DELETED THROUGH AMENDMENT*" D DATA^PRCHPAM5(.LCNT,DATA)
85 ..S DATA=$S(OLD["$":OLD,1:OLD_"%")_" Discount For Items: "_DIS_" is DELETED" D DATA^PRCHPAM5(.LCNT,DATA),LCNT1^PRCHPAM5(LCNT)
86 ..Q
87 .Q
88 Q
Note: See TracBrowser for help on using the repository browser.