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

ACRFPOL.m

Go to the documentation of this file.
ACRFPOL ;IHS/OIRM/DSD/THL,AEF - PURCHASE ORDER LOG; [ 09/23/2005   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**19**;NOV 05, 2001
EN D EXIT
 D EN1
EXIT K ACROUT,ACRQUIT,ACRDA,ACRPODA,ACRFY,^TMP("ACRPOL",$J),ACRPA,ACRPAX,ACRBEG,ACRBEGIN,ACREND,ACRDOCDA,ACRDOC0,ACRDOC,ACRSORT,ACRSSTOT,ACRTOT,ACRRTN,ACRV,ACRDOCX,ACRCANCL
 Q
EN1 ;
 D OFFICE^ACRFPA
 Q:'+$G(ACRDA)
 S ACRPODA=ACRDA
 W !
 D DATES^ACRFDATE
 Q:'$D(ACRBEGIN)
 D PA
 Q:$D(ACRQUIT)!$D(ACROUT)
 D SORT
 Q:$D(ACRQUIT)!$D(ACROUT)
 D CANCEL
 Q:$D(ACRQUIT)!$D(ACROUT)
 D ZIS
 Q
ZIS S ACRRTN="LOG^ACRFPOL"
 S ZTDESC="PURCHASE ORDER LOG"
 D ^ACRFZIS
 Q
LOG ;EP;TO PRINT PURCHASE ORDER LOG
 S ACRBEG=ACRBEGIN
 F  S ACRBEG=$O(^ACRDOC("S",ACRBEG)) Q:'ACRBEG!(ACRBEG>ACREND)  D
 .S ACRDOCDA=0
 .F  S ACRDOCDA=$O(^ACRDOC("S",ACRBEG,ACRDOCDA)) Q:'ACRDOCDA  D
 ..S ACRDOC0=^ACRDOC(ACRDOCDA,0)
 ..Q:$E($P(ACRDOC0,U,2),1,8)'?8N
 ..Q:ACRPODA'=$P(ACRDOC0,U,8)
 ..I $D(ACRCANCL),$P(ACRDOC0,U,14)'["CANCEL" Q
 ..I ACRPA(1),ACRPA(1)'=+$G(^ACRDOC(ACRDOCDA,"PA")) Q
 ..I ACRPA(1)="EACH" D
 ...S ACRPA=+$G(^ACRDOC(ACRDOCDA,"PA"))
 ...;S:ACRPA ACRPA=$P(^VA(200,ACRPA,0),U)  ;ACR*2.1*19.02 IM16848
 ...S:ACRPA ACRPA=$$NAME2^ACRFUTL1(ACRPA)  ;ACR*2.1*19.02 IM16848
 ..S ACRDOC=$S(ACRSORT=1:$P(ACRDOC0,U,2),ACRSORT=2:$P(ACRDOC0,U),1:+$P($G(^ACRDOC(ACRDOCDA,"PO")),U,5))
 ..I ACRSORT=3 D
 ...S ACRDOC=$P($G(^AUTTVNDR(+ACRDOC,0)),U)
 ...S:ACRDOC="" ACRDOC="NOT STATED"
 ..I ACRPA]"",ACRDOC]"",ACRDOCDA]"" S ^TMP("ACRPOL",$J,ACRPA,ACRDOC,ACRDOCDA)=""
 Q:'$D(^TMP("ACRPOL",$J))
 D HEAD
 S (ACRPAX,ACRPA)=""
 F  S ACRPA=$O(^TMP("ACRPOL",$J,ACRPA)) Q:ACRPA=""!$D(ACROUT)!$D(ACRQUIT)  D
 .I ACRPAX'=ACRPA D
 ..W !?10,"PURCHASING AGENT: ",$S($L(ACRPA)>1:ACRPA,1:"NOT STATED")
 ..S ACRPAX=ACRPA
 ..S ACRJ=0
 .S (ACRDOCX,ACRDOC)=""
 .F  S ACRDOC=$O(^TMP("ACRPOL",$J,ACRPA,ACRDOC)) Q:ACRDOC=""!$D(ACROUT)!$D(ACRQUIT)  D DISPLAY
 .W !?15,"Total PURCHASE ORDERS: ",ACRJ
 D PAUSE^ACRFWARN
 Q
DISPLAY ;DIPLAY EACH PO
 I ACRSORT=3 D
 .I ACRDOCX]"",ACRDOCX'=ACRDOC D  I 1
 ..W !?66,"-------------"
 ..W !?50,"VENDOR TOTAL: ",?66,$J($FN(ACRV(ACRDOCX),"P,",2),13)
 ..W $$DASH^ACRFMENU
 ..K ACRV(ACRDOC)
 ..S ACRDOCX=ACRDOC
 .E  S ACRDOCX=ACRDOC
 S ACRJ=ACRJ+1
 S ACRDOCDA=0
 F  S ACRDOCDA=$O(^TMP("ACRPOL",$J,ACRPA,ACRDOC,ACRDOCDA)) Q:'ACRDOCDA!$D(ACROUT)!$D(ACRQUIT)  D
 .K DXS,DIP,DC,DN,D0
 .S D0=ACRDOCDA
 .S N(1)=""
 .D ^ACRPOL
 .I $Y+4>IOSL D
 ..D PAUSE^ACRFWARN
 ..D:'$D(ACRQUIT) HEAD
 Q
PA ;EP;
 S DIR(0)="SO^1:DO NOT Print by Purchasing Agent;2:Print for ALL Purchasing Agents;3:Print for ONE Purchasing Agent"
 W !
 D DIR^ACRFDIC
 Q:$D(ACRQUIT)!$D(ACROUT)
 I Y=1 D  Q
 .S ACRPA(1)="ALL"
 .S ACRPA="ALL"
 I Y=2 S ACRPA(1)="EACH" Q
 S DIC="^ACRPA("
 S DIC("A")="Which PURCHASING AGENT: "
 S DIC(0)="AEMQZ"
 W !
 D DIC^ACRFDIC
 Q:$D(ACRQUIT)!$D(ACROUT)
 S (ACRPA,ACRPA(1))=+Y
 ;S:$D(^VA(200,+ACRPA,0)) ACRPA=$P(^(0),U)  ;ACR*2.1*19.02 IM16848
 S:$D(^VA(200,+ACRPA,0)) ACRPA=$$NAME2^ACRFUTL1(+ACRPA)  ;ACR*2.1*19.02 IM16848
 Q
SORT ;SET THE LIST SEQUENCE BY PO OR REQ NUMBER
 S DIR(0)="SO^1:List by PO Number;2:List by Requisition Number;3:List by Vendor"
 S DIR("A")="Which sequence"
 S DIR("B")=1
 W !
 D DIR^ACRFDIC
 Q:$D(ACROUT)!$D(ACRQUIT)!($G(Y)<1)
 S ACRSORT=+Y
 Q
 W @IOF
 W !?10,"PURCHASE ORDER LOG"
 W ?55,"REPORT DATE: "
 S Y=DT
 X ^DD("DD")
 W Y
 W !?10,"ORDERS FROM: "
 S Y=ACRBEGIN
 X ^DD("DD")
 W Y
 S ACRI=$G(ACRI)+1
 W ?55,"PAGE.......: ",ACRI
 W !?10,"ORDERS TO..: "
 S Y=ACREND
 X ^DD("DD")
 W Y
 W:ACRI=1 !?10,"('*' indicates CANCELLED Purchase Orders)"
 W !?34,"DATE OF"
 W !,"PO NUMBER"
 W ?15,"REQUISITION NO."
 W ?34,"ORDER"
 W ?44,"CONTRACTOR"
 W ?66,"AMOUNT"
 W !,"-------------"
 W ?15,"---------------"
 W ?34,"--------"
 W ?44,"--------------------"
 W ?66,"-------------"
 Q
SSTOT ;EP;TO CALCULATE AND PRINT THE PO TOTAL ON THE PO LOG LISTING
 N ACR
 S ACRSSTOT=0
 S ACR=ACRDOCDA
 D SSTOT^ACRFWARN
 W:$G(ACRSSTOT) $J($FN(ACRSSTOT,"P,",2),13)
 I ACRSORT=3 S ACRV(ACRDOC)=$G(ACRV(ACRDOC))+ACRSSTOT
 Q
CANCEL ;PRINT CANCELLED PO'S ONLY
 K ACRCANCL
 S DIR(0)="YO"
 S DIR("A")="Print CANCELLED PO's only"
 S DIR("B")="NO"
 W !
 D DIR^ACRFDIC
 I +Y=1 S ACRCANCL=""
 Q