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

ASURO80P.m

Go to the documentation of this file.
ASURO80P ; IHS/ITSC/LMH -RPT 80 ISS-ANAL STATION DRIVER ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine formats and prints report 80, Analysis of Stock Issues
 ;by selected criteria Report.
EN ;EP;PRIMARY ENTRY POINT FOR REPORT 80
 Q  ;WAR 5/21/99
 I '$D(IO) D HOME^%ZIS
 I '$D(DUZ(2)) W !,"Report must be run from Kernel option" Q
 I '$D(ASUL(1,"AR","AP")) D SETAREA^ASULARST
 S ASUK("PTRSEL")=$G(ASUK("PTRSEL")) I ASUK("PTRSEL")]"" G PSER
 D ^ASURO800
 Q:$D(DTOUT)  Q:$D(DUOUT)  ;DFM P1 9/15/98
 S ZTRTN="PSER^ASURO80P",ZTDESC="SAMS RPT 80" D O^ASUUZIS
 I POP S IOP=$I D ^%ZIS Q
 I ASUK(ASUK("PTR"),"Q") Q
PSER ;EP;FOR TASKMAN QUEUE OF PRINT
 G:$D(DTOUT) K G:$D(DUOUT) K
 D U^ASUUZIS
 S ASUF("HDR")=1
 S ASUX("STA")=$O(^XTMP("ASUR","R80",2,"")) I ASUX("STA")']"" W !,"NO DATA FOR REPORT 80" Q
 S Y=$P(^XTMP("ASUR","R80",2),U),ASUV("FY")=$S($E(Y,4,5)>9:$E(Y,1,3)+1,1:$E(Y,1,3))
 X ^DD("DD") S ASUV("DT")=Y,ASUC("PG")=0
 ;S ASUX("STA")=""
 ;F  S ASUX("STA")=$O(^XTMP("ASUR","R80",2,ASUX("STA"))) Q:ASUX("STA")=""  D
 S ASUX("STA")=$G(ASUL(2,"STA","E#")) I ASUX("STA")']"" D  Q
 .W !,"Station not selected at logon - can't determine Station to print"
 E  D
 .S ASUA("AR")=$E(ASUX("STA"),1,2),ASUV("ARE")=ASUA("AR")
 .I ASUA("AR")'=ASUL(1,"AR","AP") D ARE^ASULARST(ASUV("ARE"))
 .S ASUA("STA")=$P(^XTMP("ASUR","R80",2,ASUX("STA")),U)
 .;S ASUL(2,"E#","STA")=ASUX("STA") D STA^ASULARST(ASUL(2,"E#","STA"))
 .S ASUX("ACC")=""
 .F  S ASUX("ACC")=$O(^XTMP("ASUR","R80",2,ASUX("STA"),ASUX("ACC"))) Q:ASUX("ACC")'?1N  D P1
 I $D(DUOUT)!($D(DTOUT)) G K
 I ('$D(ASUV("ACC")))!('$D(ASUV("OBJ")))!('$D(ASUV("CAT"))) G K
 S ASUV("LEV")=5 D PRTOTL
 D CLS^ASUUHDG
K ;
 K ASUC,ASUF,ASUT,ASUV,ASUP,ASUS,ASUX,ASUT
 F X=3:1:22 K ASUL(X) ;Clear Table Lookup fields
 K DFOUT,DIR,DLOUT,DTOUT,DUOUT
 K X,X1,X2,X3,X4,Y
 I ASUK("PTRSEL")]"" Q
 D C^ASUUZIS
 Q
P1 ;
 S ASUA("ACC")=^XTMP("ASUR","R80",0,ASUX("ACC")),ASUV("ACC")=ASUX("ACC")
 S ASUX("OBJ")=""
 F  S ASUX("OBJ")=$O(^XTMP("ASUR","R80",2,ASUX("STA"),ASUX("ACC"),ASUX("OBJ"))) Q:ASUX("OBJ")=""  Q:$D(DTOUT)  Q:$D(DUOUT)  D
 .S ASUA("OBJ")=^XTMP("ASUR","R80",0,ASUX("ACC"),ASUX("OBJ")),ASUV("OBJ")=ASUX("OBJ")
 .S ASUX("CAT")=""
 .F  S ASUX("CAT")=$O(^XTMP("ASUR","R80",2,ASUX("STA"),ASUX("ACC"),ASUX("OBJ"),ASUX("CAT"))) Q:ASUX("CAT")=""  Q:$D(DTOUT)  Q:$D(DUOUT)  D
 ..S ASUA("CAT")=^XTMP("ASUR","R80",0,ASUX("ACC"),ASUX("OBJ"),ASUX("CAT")),ASUV("CAT")=ASUX("CAT")
 ..D P4
 .Q:$D(DTOUT)  Q:$D(DUOUT)
 .S ASUV("LEV")=3 D PRTOTL
 Q:$D(DTOUT)  Q:$D(DUOUT)
 S ASUV("LEV")=4 D PRTOTL
 Q
P2 ;
PRLINE ;PRINT LINE
 W !?5,$P(ASUA(ASUV("LEV"),ASUV("SST")),U)
 S ASUC("LN")=ASUC("LN")+1
 D PRLIN2,PRLIN3,P3
 Q
PRLI2 ;
 S:ASUC("LN")>ASUK(ASUK("PTR"),"IOSL") ASUF("HDR")=1
PRLIN2 ;
 F ASUV("PIECE")=2:1:4 D
 .W ?30+((ASUV("PIECE")-2)*9),$J($FN($P(ASUA(ASUV("LEV"),ASUV("SST")),U,ASUV("PIECE")),"+T",0),9) D:ASUV("SST")>0
 ..S ASUV("%TOT")=$P(ASUA(ASUV("LEV"),0),U,ASUV("PIECE"))
 ..I ASUV("%TOT")<1 D
 ...S ASUV("%")="0.0"
 ..E  D
 ...S ASUV("%SST")=$P(ASUA(ASUV("LEV"),ASUV("SST")),U,ASUV("PIECE"))*100
 ...S ASUV("%")=ASUV("%SST")/ASUV("%TOT")
 ..S $P(ASUA(ASUV("LEV"),ASUV("SST")),U,ASUV("PIECE")+3)=$FN(ASUV("%"),"-",1)_"%"
 Q
PRLIN3 ;
 F ASUV("PIECE")=5:1:7 W ?55+((ASUV("PIECE")-5)*7),$J($P(ASUA(ASUV("LEV"),ASUV("SST")),U,ASUV("PIECE")),7)
 Q
PRTOTL ;EP; -PRINT TOTALS
 D:ASUF("HDR") HEADER
 W !,$P($T(TOTNAM+ASUV("LEV")),";",4)
 S ASUC("LN")=ASUC("LN")+1
 D:ASUV("LEV")<5 ROLLTOT
 I ASUV("LEV")=1 D
 .D PRDASH
 .W !?7,$P($T(TOTNAM+ASUV("LEV")),";",3)
 .S ASUU(2)=ASUV("SST"),ASUV("SST")=0
 .D PRLI2 D:ASUF("HDR") HEADER
 .F  S ASUV("SST")=$O(ASUA(ASUV("LEV"),ASUV("SST"))) Q:ASUV("SST")'?1N.N  D P3
 .S ASUV("SST")=ASUU(2)
 E  D
 .S ASUF("HDR")=1
 .S ASUU(2)=ASUV("SST"),ASUV("SST")=0
 .W ! S ASUC("LN")=ASUC("LN")+1
 .F  S ASUV("SST")=$O(ASUA(ASUV("LEV"),ASUV("SST"))) Q:ASUV("SST")'?1N.N  D
 ..W !?5,$P(ASUA(ASUV("LEV"),ASUV("SST")),U)
 ..S ASUC("LN")=ASUC("LN")+1
 ..D PRLIN2,PRLIN3
 ..D P3
 .W ! D PRDASH
 .S ASUC("LN")=ASUC("LN")+1
 .W !!?12,$P($T(TOTNAM+ASUV("LEV")),";",3)
 .S ASUC("LN")=ASUC("LN")+1
 .S ASUV("SST")=0
 .D PRLI2
 .S ASUV("SST")=ASUU(2)
 S ASUC("LN")=ASUC("LN")+1
 W !
 S ASUC("LN")=ASUC("LN")+1
 F ASUU(4)=0:1:2 S X=(ASUU(4)*9)+30 W ?X," ========"
 S ASUC("LN")=ASUC("LN")+1
 K ASUA(ASUV("LEV"))
 Q
PRDASH ;
 F ASUU(4)=0:1:2 S X=(ASUU(4)*9)+30 W ?X," ________"
 W ! S ASUC("LN")=ASUC("LN")+1
 Q
 S ASUC("PG")=ASUC("PG")+1
 D:ASUC("PG")>1 PAZ^ASUURHDR
 W @IOF,!,"REPORT #80 ANALYSIS OF ISSUE VALUES BY ITEM/LOCATION/CATEGORY",?71,"PAGE :",$J(ASUC("PG"),3)
 W !,"AREA: ",ASUL(1,"AR","AP")," -",ASUL(1,"AR","NM"),?35,"DATE : ",ASUV("DT")
 W !,"STAT: ",ASUL(2,"STA","CD")," -",ASUL(2,"STA","NM")
 W ?40,"GL ACCOUNT : ",ASUV("ACC")," ",$P(ASUA("ACC"),U,2)
 W !,"OBJECT/SUBOBJECT CODE: ",$E(ASUV("OBJ"),1,2),".",$E(ASUV("OBJ"),3,4)," -",$P(ASUA("OBJ"),U,2),!
 W !,"CATEGORY: ",ASUV("CAT")," -",$P(ASUA("CAT"),U,2),!
 W !?3,"INDEX  ITEM                                               PERCENT OF TOTAL"
 W !?2,"NUMBER  DESCRIPTION            STORES STOCK ISSUE VALUES     ISSUE VALUE",?78,"U"
 W !?6,"USING LOCATION",?32,"FY-",$E(ASUV("FY"),2,3),?42,"FY-",$E((ASUV("FY")-1),2,3),?52,"FY-",$E((ASUV("FY")-2),2,3)
 W ?59,"FY-",$E(ASUV("FY"),2,3),?66,"FY-",$E((ASUV("FY")-1),2,3),?73,"FY-",$E((ASUV("FY")-2),2,3)
 W ! F ASUU(3)=1:1:80 W "_"
 W !!
 S ASUC("LN")=13,ASUF("HDR")=0
 Q
TOTNAM ;;
 ;;ITEM TOTAL
 ;;CATEGORY TOTAL;SUMMARY BY CATEGORY
 ;;OBJ/SUB OBJ TOTAL;SUMMARY BY OBJ/SUB OBJ
 ;;ACCOUNT TOTAL;SUMMARY BY ACCOUNT
 ;;AREA TOTAL;SUMMARY BY AREA
P3 ;
 S $P(ASUA(ASUV("LEV")+1,ASUV("SST")),U)=$P(ASUA(ASUV("LEV"),ASUV("SST")),U)
 F ASUU(1)=2:1:4 D
 .S $P(ASUA(ASUV("LEV")+1,ASUV("SST")),U,ASUU(1))=$P(ASUA(ASUV("LEV")+1,ASUV("SST")),U,ASUU(1))+$P(ASUA(ASUV("LEV"),ASUV("SST")),U,ASUU(1))
 K ASUA(ASUV("LEV"),ASUV("SST"))
 Q
ROLLTOT ;EP ;ACCUMULATE TOTALS
 S ASUA(ASUV("LEV")+1,0)=$G(ASUA(ASUV("LEV")+1,0))
 F ASUU(1)=2:1:4 D
 .S $P(ASUA(ASUV("LEV")+1,0),U,ASUU(1))=$P(ASUA(ASUV("LEV")+1,0),U,ASUU(1))+$P(ASUA(ASUV("LEV"),0),U,ASUU(1))
 Q
ZEROTOT ;
 K ASUA(ASUV("LEV"))
 Q
P4 ;
 S ASUX("DSC")=""
 F  S ASUX("DSC")=$O(^XTMP("ASUR","R80",2,ASUX("STA"),ASUX("ACC"),ASUX("OBJ"),ASUX("CAT"),ASUX("DSC"))) Q:ASUX("DSC")=""  Q:$D(DTOUT)  Q:$D(DUOUT)  D
 .S ASUX(0,"DSC")=^XTMP("ASUR","R80",2,ASUX("STA"),ASUX("ACC"),ASUX("OBJ"),ASUX("CAT"),ASUX("DSC"))
 .S ASUA(0,0)=""
 .F ASUU(1)=1:1:3 S ASUA(0,0)=ASUA(0,0)_U_$P(ASUX(0,"DSC"),U,ASUU(1))
 .S ASUA("IDX")=$P(ASUX(0,"DSC"),U,5)
 .S ASUA("DS2")=$P(ASUX(0,"DSC"),U,6)
 .D:ASUF("HDR") HEADER
 .W !!,$E(ASUA("IDX"),1,5),".",$E(ASUA("IDX"),6,6),?8,ASUX("DSC")," ",ASUA("DS2"),!
 .S ASUC("LN")=ASUC("LN")+3
 .D P5 ;SUBSTATION
 Q:$D(DTOUT)  Q:$D(DUOUT)
 S ASUV("LEV")=2 D PRTOTL
 Q
P5 ;
 S ASUX("SST")=""
 F  S ASUX("SST")=$O(^XTMP("ASUR","R80",2,ASUX("STA"),ASUX("ACC"),ASUX("OBJ"),ASUX("CAT"),ASUX("DSC"),ASUX("SST"))) Q:ASUX("SST")=""  Q:$D(DTOUT)  Q:$D(DUOUT)  D
 .S ASUV("LEV")=0
 .S ASUV("SST")=ASUX("SST")
 .S ASUA(0,ASUV("SST"))=^XTMP("ASUR","R80",2,ASUX("STA"),ASUX("ACC"),ASUX("OBJ"),ASUX("CAT"),ASUX("DSC"),ASUX("SST"))
 .D ACC^ASULDIRF(ASUX("ACC"))
 .S:ASUC("LN")>ASUK(ASUK("PTR"),"IOSL") ASUF("HDR")=1
 .D:ASUF("HDR") HEADER
 .D PRLINE
 D ROLLTOT
 S ASUV("LEV")=1 D PRTOTL
 Q