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

ASURD13P.m

Go to the documentation of this file.
ASURD13P ; IHS/ITSC/LMH -RPT 13 REQM-ANAL ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine formats and prints report 13, Requirements Analysis
 ;Report.
 D:'$D(IO) HOME^%ZIS I '$D(DUZ(2)) W !,"Report must be run from Kernel option" Q
 D:'$D(ASUL(1,"AR","AP")) SETAREA^ASULARST
 S ASUD("R13","SEL")=$G(ASUD("R13","SEL")) D P0 I ASUD("R13","SEL")="" D MENU Q:$D(DUOUT)
 S ASUK("PTRSEL")=$G(ASUK("PTRSEL")) I ASUK("PTRSEL")]"" G PSER
 S ZTRTN="PSER^ASURD13P",ZTDESC="SAMS RPT 13" D O^ASUUZIS I POP S IOP=$I D ^%ZIS Q
 I ASUK(ASUK("PTR"),"Q") Q
PSER ;EP;FOR TASKMAN QUEUE OF PRINT
 K ^XTMP("ASUR","R13") S ^XTMP("ASUR","R13",0)=ASUK("DT","FM")+10000_U_ASUK("DT","FM")
 I ($D(ASUK("DT"))#10)'=1 D DATE^ASUUDATE
 S (ASUC("VENITM"),ASUC("VENITM",2),ASUC("VENITM",1),ASUC("VENS"),ASUC("EOQVAL"),ASUL("EOQVAL"),ASUC("EOQVAL",4),ASUC("EOQVAL",5),ASUC("EOQVAL","TOT"))=0
 I $E(ASUD("R13","MOAC"))=0 S ASUD("R13","MOAC")=$E(ASUD("R13","MOAC"),2,2)
 S ASUV("HEADER")=" ("_ASUV("PRV MO")
 I $G(ASUD("R13","RNG"))>1 S ASUV("M")=ASUD("R13","MOAC")+ASUD("R13","RNG")-1 S:ASUV("M")>12 ASUV("M")=ASUV("M")-12 S ASUV("HEADER")=ASUV("HEADER")_"-"_ASUD("R13","MO",ASUV("M"))
 S ASUV("HEADER")=ASUV("HEADER")_" REQUSITION FOR SUPPLIES)"
 S X=0,X=$O(^ASUMX(X)) Q:X=""  D CMPT,U^ASUUZIS
 S (ASUT("STA"),ASUT("ACC"),ASUT("SLC"),ASUT("VNDR"))="",(ASUC("LN"),ASUC("PG"),ASUC("TOT"))=0,ASUV("ACC")="BEGIN"
 S ASUT("AR")=$O(^XTMP("ASUR","R13",0))
 I ASUT("AR")="" D CLS^ASUUHDG W !!,"NO REPORT 13 DATA FOR SELECTED PARAMETERS" G END
 F  S ASUT("STA")=$O(^XTMP("ASUR","R13",ASUT("AR"),ASUT("STA"))) Q:ASUT("STA")=""  D
 .S ASUMS("E#","STA")=$O(^ASUMS("B",ASUT("STA"),""))
 .S X=ASUT("AR") D AREA^ASULARST S X1=ASUT("STA") D STAT^ASULARST
 .F  S ASUT("ACC")=$O(^XTMP("ASUR","R13",ASUT("AR"),ASUT("STA"),ASUT("ACC"))) Q:ASUT("ACC")=""  D
 ..S ASUV("ACC")=ASUT("ACC"),(ASUV("SLC"),ASUV("VEN NM"),ASUF("PR"))=""
 ..F  S ASUT("SLC")=$O(^XTMP("ASUR","R13",ASUT("AR"),ASUT("STA"),ASUT("ACC"),ASUT("SLC"))) Q:ASUT("SLC")=""  D  Q:$D(DUOUT)
 ...D:ASUV("SLC")'=ASUT("SLC")
 ....I ASUV("SLC")="" S ASUV("SLC")=ASUT("SLC") Q
 ....I ASUF("PR")="Y" S ASUF("PR")="" Q
 ....D PACT Q:$D(DUOUT)  S ASUF("PR")="Y"
 ...F  S ASUT("VNDR")=$O(^XTMP("ASUR","R13",ASUT("AR"),ASUT("STA"),ASUT("ACC"),ASUT("SLC"),ASUT("VNDR"))) Q:ASUT("VNDR")=""  D  Q:$D(DUOUT)
 ....S ASUT("IDX")="" F  S ASUT("IDX")=$O(^XTMP("ASUR","R13",ASUT("AR"),ASUT("STA"),ASUT("ACC"),ASUT("SLC"),ASUT("VNDR"),ASUT("IDX"))) Q:ASUT("IDX")=""  D  Q:$D(DUOUT)
 .....S ASUT("SEQ")="" F  S ASUT("SEQ")=$O(^XTMP("ASUR","R13",ASUT("AR"),ASUT("STA"),ASUT("ACC"),ASUT("SLC"),ASUT("VNDR"),ASUT("IDX"),ASUT("SEQ"))) Q:ASUT("SEQ")=""  Q:$D(DUOUT)  D  Q:$D(DUOUT)
 ......S ASUX(0)=^XTMP("ASUR","R13",ASUT("AR"),ASUT("STA"),ASUT("ACC"),ASUT("SLC"),ASUT("VNDR"),ASUT("IDX"),ASUT("SEQ"))
 ......S ASUMS("E#","IDX")=$P(ASUX(0),U,2),ASUMS("E#","STA")=$P(ASUX(0),U)
 ......D M^ASUMSTRD
 ......S ASUV("EOQTB")=ASUL(2,"STA","EOQTB") S:ASUV("EOQTB")=""!(ASUV("EOQTB")=$C(32)) ASUV("EOQTB")=ASUMS("EOQ","TB")
 ......D NEWVNDR:ASUV("VEN NM")'=ASUMS("VENAM")
 ......D:ASUC("LN")>45 HEADER Q:$D(DUOUT)  D P5
 ..D PACT Q:$D(DUOUT)
 ..W !!?16,"CATEGORY TOTAL NO ITEMS",?40,ASUC("VENITM",2),?46,"EOQ VAL",?50,$J($FN(ASUC("EOQVAL","TOT"),",",2),12)
 ..S (ASUC("VENITM",2),ASUC("EOQVAL","TOT"))=0,ASUC("LN")=ASUC("LN")+2
 ..K ASUMS("DMD","CALL"),ASUMS("DMD","QTY")
 W !!?14,"STATION TOTAL NO ITEMS",?38,ASUC("VENITM",1),?44,"EOV",?48,$J($FN(ASUC("EOQVAL",4),",",2),12)
 S ASUC("EOQVAL",5)=0
END ;
 K %DT,ASUU,ASUD,ASUMS,ASUC,ASUV,ASUS,ASUMX,ASUF,ASUT,X,X1,X2,X3,X4,Y,ZTRTN,ZTDESC
 F X=3:1:22 K ASUL(X) ;Clear Table Lookup fields
 D PAZ^ASUURHDR I ASUK("PTRSEL")]"" W @IOF Q
 D C^ASUUZIS Q
CMPT ;EP ;CREATE EXTRACTS
 D ^ASURD130 Q
P0 ;EP ;SELECTION
 I '$D(ASUD("R13","MO")) D
 .S ASUD("R13","ASOF")=$S($D(ASUK("DT","YRMO")):ASUK("DT","YRMO"),1:$E(DT,2,7))
 .S (ASUD("R13","MOAC"),ASUD("R13","MOBG"))=$E(ASUD("R13","ASOF"),3,4)
 .S ASUD("R13","MO")=0
 .F ASUD("R13","MONM")="JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC" D
 ..S ASUD("R13","MO")=ASUD("R13","MO")+1,ASUD("R13","MO",ASUD("R13","MO"))=ASUD("R13","MONM")
 S ASUV("PRV MO")=ASUD("R13","MO",+ASUD("R13","MOAC"))
 Q
 I IO'=IO(0) U IO(0) S ASUF("IO")=1
 D:$G(ASUD("R13","SEL"))']""  Q:$D(DUOUT)
 .D CLS^ASUUHDG W !?18,"REQUIREMENTS ANALYSIS REPORT",!?26,"ITEM SELECTION",!!
 .S DIR("A")="ENTER YOUR SELECTION"
 .S DIR(0)="SR^1:PERRY POINT ITEMS;3:GSA ITEMS;4:VA ITEMS;5:MILITARY (DOD/DPSC/DSLA) ITEMS;6:OTHER GOVERNMENT SOURCE ITEMS;0:ALL OTHER SOURCE ITEMS;A:ALL ITEMS;S:DROP SHIP ITEMS;Y:YEARLY QTY MOD ITEMS"
 .D ^DIR
 .Q:$D(DTOUT)  Q:$D(DUOUT)
 .S ASUD("R13","SEL")=Y
 D:$G(ASUD("R13","RNG"))']""  Q:$D(DUOUT)
 .D CLS^ASUUHDG W ?26,"PERIOD SELECTION"
 .S DIR(0)="SR^1:CURRENT MONTH ONLY;2:CURRENT AND NEXT MONTHS;3:CURRENT AND NEXT 2 MONTHS",DIR("B")=1 D ^DIR
 .Q:$D(DTOUT)  Q:$D(DUOUT)
 .S ASUD("R13","RNG")=Y K DIR D CLS^ASUUHDG
 I $G(ASUF("IO"))=1 U IO K ASUF("IO")
 Q
 S ASUU(1)=$O(^XTMP("ASUR","R13",ASUT("AR"),ASUT("STA"),ASUT("ACC"),"")),ASUU(2)=$O(^(ASUU(1),"")),ASUC("PG")=$G(ASUC("PG"))+1,ASUC("LN")=0
 D:ASUC("PG")>1 PAZ^ASUURHDR Q:$D(DUOUT)  W @IOF
 W !?1,"REPORT #13 REQUIREMENTS ANALYSIS",ASUV("HEADER")
 D P0
 W ?80,$E(ASUK("DT","FM"),4,5),"/",$E(ASUK("DT","FM"),6,7),"/",$E(ASUK("DT","FM"),2,3),?120,"PAGE: ",ASUC("PG")
 W !?3,"AREA: ",ASUL(1,"AR","AP"),?15,ASUL(1,"AR","NM")
 W !?3,"STAT: ",ASUL(2,"STA","CD"),?15,ASUL(2,"STA","NM"),?41,"ACCOUNT: ",$S(ASUT("ACC")=1:"PHARMACY",ASUT("ACC")=3:"SUBSISTENCE",1:"GENERAL SUPPLIES")
 W ?74,"VENDOR: ",$S(ASUV("VEN NM")=" ":ASUT("VNDR"),1:ASUV("VEN NM")),?100,"EOQ TABLE: ",ASUV("EOQTB")
 W !!?3,"INDEX  SLC",?32,"USAGE BY MONTH -CURRENT TO OLDEST",!?2,"NUMBER",?16,"ORDER",?35,"ISSUED    NO.   ISSUED NO.",?65,"ISSUED NO."
 W !?1,"DESCRIPTION",?16,"NUMBER",?34,"MO",?37,"QUANT",?44,"REQ",?48,"MO",?51,"QUANT",?58,"REQ",?62,"MO",?65,"QUANT",?72,"REQ"
 W !,"------------------------------------------------------------------------------------------------------------------------------------",!!
 S ASUC("LN")=ASUC("LN")+8
 Q
P5 ;VEND & ACCT
 S ASUMX(0)=^ASUMX(ASUMS("E#","IDX"),0)
 S ASUC("VENS")=ASUC("VENS")+1,ASUMX("IDX")=$P(ASUMX(0),U)
 W !!?3,$E(ASUMX("IDX"),1,5),".",$E(ASUMX("IDX"),6,6),?12,$P(ASUMS(2),U)
 S ASUC("LN")=ASUC("LN")+2
 I ASUMS("ORD#")'=$C(32),ASUMS("ORD#")]"" D
 .S ASUV("ORD#")=ASUMS("ORD#")
 .I $E(ASUV("ORD#"))="M" D
 ..W ?16,ASUV("ORD#")
 .E  D
 ..W ?16,$E(ASUV("ORD#"),1,4)_"-"_$E(ASUV("ORD#"),5,6)_"-"_$E(ASUV("ORD#"),7,9)_"-"_$E(ASUV("ORD#"),10,14)
 E  D
 .S ASUV("ORD#")=ASUMX("NSN")
 .I $E(ASUV("ORD#"))="M" D
 ..W ?16,ASUV("ORD#")
 .E  D
 ..W ?16,$E(ASUV("ORD#"),1,4)_"-"_$E(ASUV("ORD#"),5,6)_"-"_$E(ASUV("ORD#"),7,9)_"-"_$E(ASUV("ORD#"),10,14)
 K ASUV("ORD#") D ADDMNT D ^ASURD132
 S ASUC("VENITM")=ASUC("VENITM")+1
 Q
PACT ;EP; -PRINT ACCOUNT TOTALS
 D:ASUC("LN")>45 HEADER Q:$D(DUOUT)
 W !!?16,"VENDOR TOTAL NO ITEMS",?38,ASUC("VENITM"),?44,"EOV",?48,$J($FN(ASUC("EOQVAL",5),",",2),12)
 W !!?16,"REQUISITIONED BY:",!?35,"SIGNATURE/TITLE",?58,"DATE:"
 W !!?21,"APPROVED BY:",!?35,"SIGNATURE/TITLE",?58,"DATE"
 W !!?16,"FUNDS AVAILABLE :",!?35,"SIGNATURE/TITLE",?58,"DATE",!
 S ASUC("LN")=ASUC("LN")+8,ASUC("VENITM",1)=ASUC("VENITM",1)+ASUC("VENITM"),ASUC("VENITM",2)=ASUC("VENITM",2)+ASUC("VENITM")
 S ASUC("EOQVAL")=ASUC("EOQVAL")+ASUL("EOQVAL"),ASUC("EOQVAL","TOT")=ASUC("EOQVAL","TOT")+ASUC("EOQVAL",5),ASUC("EOQVAL",4)=ASUC("EOQVAL",4)+ASUC("EOQVAL",5)
 S (ASUC("VENITM"),ASUC("EOQVAL",5))=0
 Q
PRTVNDOR ;PRINT VENDOR TOTALS AND HEADERS
 I ASUV("ACC")="BEGIN" D HEADER Q
 Q:ASUT("ACC")=""  D HEADER Q:$D(DUOUT)  S ASUC("VENS")=0
 Q
ADDMNT ;ADD MONTHS FROM ASUMS FOR INDEX. CHECK EACH USER
 D MICK^ASUMSTRD,MIC^ASUMSTRD Q
NEWVNDR ;EP; -SET VENDOR NAME
 I ASUV("VEN NM")="" S ASUV("VEN NM")=ASUMS("VENAM") D HEADER Q
 I ASUF("PR")'="Y" D PACT Q:$D(DUOUT)
 S ASUF("PR")="",ASUV("VEN NM")=ASUMS("VENAM") D HEADER Q