source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCHCD0.m@ 724

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

initial load of WorldVistAEHR

File size: 2.3 KB
Line 
1PRCHCD0 ;WISC/AKS-Taskman job to zero out 'Monthly Purchase Limit' each month ; 7/12/01 5:03pm
2 ;;5.1;IFCAP;**36**;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 QUIT
6ZERO ; To zero out the monthly purchases at the beginning of every month.
7 ;
8 N N
9 S N=0 F S N=$O(^PRC(440.5,N)) Q:'N S $P(^PRC(440.5,N,2),U)=0
10 QUIT
11 ;
12ADJ1 ; Deduct amount from monthly purchases before amendment for new amount
13 ; is approved if PO is from the current month and year only.
14 ; PRCMCP is monthly card purchases, PRCHTAMT is original order amount
15 ; PRCOLD is card balance after deducting the original order's amount
16 ; DT is the current date, system-supplied.
17 ;
18 Q:FILE'=443.6
19 S X1=$P(^PRC(442,PRCHPO,1),U,15),X2=DT
20 S PRCHCD=$P(^PRC(442,PRCHPO,23),U,8)
21 I $E(X1,1,5)=$E(X2,1,5) D
22 . S PRCHTAMT=$P($G(^PRC(FILE,PRCHPO,0)),U,16)
23 . I PRCHTAMT<0 S PRCHTAMT=0
24 . S PRCMCP=$P($G(^PRC(440.5,PRCHCD,2)),U,1)
25 . S PRCOLD=PRCMCP-PRCHTAMT I PRCOLD<0 S PRCOLD=0
26 . S ^TMP("PRCHCD0",$J,PRCHPO)=PRCOLD K PRCHTAMT,PRCMCP,PRCOLD
27 K X1,X2
28 Q
29 ;
30LIMIT ; Check purchase card limits and add new purchase if limit is ok.
31 ; Deduct discounts and add shipping charges if any is applicable.
32 ;
33 N PRCHCD,PRCHCD0,PRCHDLMT,PRCHMLMT,PRCHPURS,PRCHTAMT
34 I FILE'=442&(FILE'=443.6) W !,"Improper file." Q
35 S (PRCHTAMT,N)=0
36 S PRCHCD=$P(^PRC(442,PRCHPO,23),U,8)
37 S PRCHCD0=$G(^PRC(440.5,PRCHCD,0))
38 I $D(^PRC(FILE,PRCHPO,2)) F S N=$O(^PRC(FILE,PRCHPO,2,N)) Q:'N S PRCHTAMT=PRCHTAMT+$P($G(^PRC(FILE,PRCHPO,2,N,2)),U)-$P($G(^PRC(FILE,PRCHPO,2,N,2)),U,6)
39 ;
40 S:$P($G(^PRC(FILE,PRCHPO,0)),U,13)]"" PRCHTAMT=PRCHTAMT+$P(^(0),U,13)
41 I PRCHTAMT<0 D S ERROR=1 K PRCHTAMT Q
42 . W !!!,?5,"The total amount of this order cannot be negative.",!
43 ;
44 S PRCHDLMT=$P(PRCHCD0,U,5),PRCHMLMT=$P(PRCHCD0,U,6)
45 S:$D(^TMP("PRCHCD0",$J,PRCHPO)) PRCHPURS=$P($G(^TMP("PRCHCD0",$J,PRCHPO)),U)+PRCHTAMT
46 S:'$D(^TMP("PRCHCD0",$J,PRCHPO)) PRCHPURS=$P($G(^PRC(440.5,PRCHCD,2)),U)+PRCHTAMT
47 I $G(PRCHTAMT)>PRCHDLMT D S ERROR=1
48 . W !!!,?5,"The total amount of this order is more than the Single Purchase limit",!,?5,"for the purchase card.",!
49 I $G(PRCHPURS)>PRCHMLMT D S ERROR=1
50 . W !!!,?5,"The total amount of this order and the previous purchases on this",!,?5,"purchase card is more than the monthly purchase limit.",!
51 I $D(^TMP("PRCHCD0",$J,PRCHPO)) K ^TMP("PRCHCD0",$J,PRCHPO)
52 QUIT
Note: See TracBrowser for help on using the repository browser.