Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ACRFBPA

ACRFBPA.m

Go to the documentation of this file.
ACRFBPA ;IHS/OIRM/DSD/THL,AEF - BPA MANAGEMENT; [ 10/27/2004   4:15 PM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**14**;NOV 05, 2001
 ;;MANAGE VARIOUS ASPECTS OF BLANKET PURCHASE AGREEMENTS
CHOOSE ;EP;
 K ACRBPA,DIC,ACRDOC
 S DIC="^ACRDOC("
 S DIC(0)="AENMQZ"
 S DIC("A")="Which BLANKET PURCHASE AGREEMENT: "
 S DIC("S")="S ACRDOC0=$G(^ACRDOC(+Y,0)),ACRCDATE=$P($G(^(15)),U,11),ACRAPV=$G(^ACROBL(+Y,""APV""))"
 S DIC("S")=DIC("S")_" I '$P(ACRDOC0,U,15),$S($D(ACRBPASM):1,1:($D(^ACRDOC(+Y,6,""B"",DUZ))!$D(^ACRDOC(+Y,50,""B"",DUZ)))&$P(ACRDOC0,U,23)),$S(ACRCDATE&$D(ACRNEWOB):ACRCDATE>DT,1:1),$P(ACRDOC0,U,18)>0,$P(ACRDOC0,U,16),$P(ACRAPV,U,8)=""A"""
 S D="T"
 W !
 D DIC^ACRFDIC
 I +Y'>0 S ACRQUIT="" Q
 I $$LASTBPA^ACRFNEW1(+Y) D  Q              ; ACR*2.1*14.03 IM13538
 . W *7,*7,!!?10,"ALL CALL NUMBERS FOR THIS BPA HAVE BEEN USED!"
 . D PAUSE^ACRFWARN
 . S ACRQUIT=""
 S ACRBPA=+Y
 S ACRBPA0=^ACRDOC(+Y,0)
 S ACRBPAPO=^ACRDOC(+Y,"PO")
 S ACRBPAPA=^ACRDOC(+Y,"PA")
 S ACRBPAV=$P(ACRBPAPO,U,5)
 S ACRBPATX=$P(ACRBPA0,U,4)
 S ACRBPAPS=$P(ACRBPAPA,U,3)
 S ACRBPASP=$P(ACRBPA0,U,16)
 S ACRBPATO=$P(ACRBPAPO,U,6)
 S ACRBPAFO=$P(ACRBPAPO,U,9)
 S ACRPONUM=$P(ACRBPA0,U,2)
 I '$D(^ACRDOC(ACRBPA,3))!'$P($G(^ACRDOC(ACRBPA,3)),U,10) D  Q
 .W !!,*7,*7,"BPA Call Limit not set for this BPA.  Call Procurement for assistance."
 .D PAUSE^ACRFWARN
 .S ACRQUIT=""
 K ACRBPA0,ACRBPAPO,ACRBPAPA
 Q:$D(ACRBPASM)
 W !!,"Please hold for a moment while I determine the"
 W !,"total amount charged against this BPA to date."
 D BS
 S DIR(0)="DOA"
 S DIR("A")="ORDER DATE..........: "
 S DIR("B")="TODAY"
 D DIR^ACRFDIC
 I 'Y!$D(ACRQUIT)!$D(ACROUT) S ACRQUIT="" Q
 S (X1,ACROD)=Y
 S X2=45
 D C^%DTC
 S Y=X
 X ^DD("DD")
 S DIR("B")=Y
 S DIR(0)="DOA"
 S DIR("A")="DATE REQUIRED.......: "
 D DIR^ACRFDIC
 I 'Y!$D(ACRQUIT)!$D(ACROUT) S ACRQUIT="" Q
 S ACRRQDD=Y
 Q
BPASUM ;EP;TO SUMMARIZE TOTAL DOLLARS OBLIGATED AGAINST A BPA
 D ^XBKVAR
 S ACRBPASM=""
 D CHOOSE
 Q:'$D(ACRBPA)
 Q:'ACRBPA
 S ACRDOCDA=ACRBPA
 S DIR(0)="YO"
 S DIR("A")="Print list of all Calls"
 S DIR("B")="NO"
 S DIR("?")="Enter 'Y' if you want a list of all calls against this BPA"
 W !
 D DIR^ACRFDIC
 Q:$D(ACRQUIT)!$D(ACROUT)
 S ACRDOC=$S(Y=1:"YES",1:"")
 S ACRRTN="BS^ACRFBPA"
 S ZTDESC="BPA SUMMARY"
 D ^ACRFZIS
 Q
BS ;EP;TO PRINT BPA SUMMARY
 N DATA
 K ^TMP("ACRF",$J,"ACRDOC")
 S (ACRDOCDA,ACRREQ,ACROBL,ACRSPT,ACRJ)=0
 K ACRBPASM
 F  S ACRDOCDA=$O(^ACRDOC("BPA",ACRBPA,ACRDOCDA)) Q:'ACRDOCDA  I $D(^ACRSS("J",ACRDOCDA)) D
 .S ACRJ=ACRJ+1
 .S ACRSPT=ACRSPT+$P(^ACROBL(ACRDOCDA,"DT"),U,2)
 .S ACRSSDA=0
 .F  S ACRSSDA=$O(^ACRSS("J",ACRDOCDA,ACRSSDA)) Q:'ACRSSDA  I $D(^ACRSS(ACRSSDA,0)),$D(^("DT")) S ACRSSDT=^("DT") D
 ..S ACRREQ=ACRREQ+$P(ACRSSDT,U,4)
 ..S ACROBL=ACROBL+$P(ACRSSDT,U,9)
 ..I $D(ACRDOC)#2,ACRDOC="YES" D
 ...S DATA=$G(^ACRDOC(ACRDOCDA,0))
 ...Q:'$P(DATA,U,2)
 ...S ^TMP("ACRF",$J,"ACRDOC"," "_$E($P(DATA,U,2),9,10),ACRJ)=$P(DATA,U)_U_ACRDOCDA_U_$P(DATA,U,2)
 S ACRBPAA=$P(^ACRDOC(ACRBPA,0),U,18)
 S ACRDOC=$P(^ACRDOC(ACRBPA,0),U,2)
 W:$E($G(IOST),1,2)="C-" @IOF
 W !!?10,"TOTAL DOLLARS COMMITTED AND OBLIGATED AGAINST BPA: ",ACRDOC
 W !?10,"------------------------------------------------------------------"
 W !?10,"TOTAL SET ASIDE:"
 W ?27,"TOTAL COMMITTED:"
 W ?44,"TOTAL OBLIGATED:"
 W ?62,"TOTAL SPENT"
 W !?10,"---------------"
 W ?27,"---------------"
 W ?44,"---------------"
 W ?62,"--------------"
 W !?10,$J($FN(ACRBPAA,"P,",2),14)
 W ?27,$J($FN(ACRREQ,"P,",2),14)
 W ?44,$J($FN(ACROBL,"P,",2),14)
 W ?62,$J($FN(ACRSPT,"P,",2),14)
 D PAUSE^ACRFWARN
 I $D(^TMP("ACRF",$J,"ACRDOC")) D
 .D PH
 .S ACR=""
 .F  S ACR=$O(^TMP("ACRF",$J,"ACRDOC",ACR)) Q:ACR=""!$D(ACRQUIT)  D
 ..S ACRJ=0
 ..F  S ACRJ=$O(^TMP("ACRF",$J,"ACRDOC",ACR,ACRJ)) Q:'ACRJ!$D(ACRQUIT)  D
 ...S DATA=^TMP("ACRF",$J,"ACRDOC",ACR,ACRJ)
 ...S ACRDOCDA=$P(DATA,U,2)
 ...S ACRDOCX=$O(^ACRDHR("E",ACRDOCDA,0))
 ...I ACRDOCX S ACRDOCX=$P($G(^ACRDHR(ACRDOCX,0)),U)
 ...W !?4,$P(DATA,U,2)
 ...W ?10,ACR
 ...W ?15,$P(DATA,U)
 ...W ?35,$P(DATA,U,3)
 ...I ACRDOCX'=$P(DATA,U,3) W ?55,ACRDOCX
 ...D P
 D PAUSE^ACRFWARN
 W @IOF
 K ^TMP("ACRF",$J,"ACRDOC")
 Q
P ;
 I IOSL-4<$Y,$O(^TMP("ACRF",$J,"ACRDOC",ACR,ACRJ))]"" D
 .D PAUSE^ACRFWARN
 .W @IOF
 .D PH
 Q
PH W !!?4,"ID.",?10,"CALL"
 W !?4,"NO."
 W ?10,"NO."
 W ?15,"REQUISITION NO."
 W ?35,"PURCHASE ORDER #"
 W ?55,"OBLIGATION DOC #"
 W !?4,"----- ---- ------------------"
 W ?35,"----------------"
 W ?55,"----------------"
 Q
CALLIM ;EP;TO DETERMINE IF CALL AMOUNT EXCEEDS BPA PER CALL LIMIT
 S ACRBPA=$P(^ACRDOC(ACRDOCDA,0),U,19)
 S ACRBPA=$P(^ACRDOC(ACRBPA,3),U,10)
 K ACRQUIT
 N ACR,ACRSUM
 S (ACR,ACRSUM)=0
 F  S ACR=$O(^ACRSS("J",ACRDOCDA,ACR)) Q:'ACR  I $D(^ACRSS(ACR,"DT")) S ACRSUM=ACRSUM+$P(^("DT"),U,4)
 I ACRSUM>ACRBPA S ACRQUIT=""
 Q