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

ASURQ81P.m

Go to the documentation of this file.
ASURQ81P ; IHS/ITSC/LMH -RPT 81 LIST DROP SHIP ITEMS ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine formats and prints report 81, List of Drop Ship
 ;Items.
EN ;EP;PRIMARY ENTRY POINT FOR REPORT 81
 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
 S ZTRTN="PSER^ASURQ81P",ZTDESC="SAMS RPT 81" D O^ASUUZIS
 I POP S IOP=$I D ^%ZIS Q
 I ASUK(ASUK("PTR"),"Q") Q
PSER ;EP;FOR TASKMAN QUEUE OF PRINT
 S ASUF("HDR")=1
 S ASUX("ARST")=$O(^XTMP("ASUR","R81",0))
 I ASUX("ARST")']"" D
 .I ASUP("TYP")=0 Q
 .D ^ASURQ810
 D U^ASUUZIS
 S ASUX("ARST")=$O(^XTMP("ASUR","R81",0))
 I ASUX("ARST")']"" W !!,"No Data for Drop Ship Report for this quarter" G K
 S ASUV("ARST")=ASUX("ARST")
 D ARE^ASULARST($P(^ASUL(1,$E(ASUX("ARST"),1,2),0),U,2))
 S ASUQA("AR")=ASUL(1,"AR","AP")_" - "_ASUL(1,"AR","NM")
 D STA^ASULARST(ASUX("ARST"))
 S ASUQA("STA")=ASUL(2,"STA","CD")_" - "_ASUL(2,"STA","NM")
 S Y=$P(^XTMP("ASUR","R81",0),U) X ^DD("DD") S ASUV("DT")=Y
 S (ASUC("LN"),ASUC("PG"))=0
 S ASUP("YR")=$E($P(^XTMP("ASUR","R81",0),U,2),1,4),ASUT("QTR")=$E($P(^XTMP("ASUR","R81",0),U,2),5,6)
 S ASUQA("DIV")=$S(ASUT("QTR")="04":12,ASUT("QTR")="03":9,ASUT("QTR")="02":6,1:3)
 S ASUX("ACIX")="" K ASUL(9)
 F  S ASUX("ACIX")=$O(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"))) Q:ASUX("ACIX")=""  Q:$D(DTOUT)  Q:$D(DUOUT)  D
 .S ASUMX("ACC")=$E(ASUX("ACIX"))
 .I $G(ASUL(9,"ACC"))'=ASUMX("ACC") D
 ..I $G(ASUL(9,"ACC"))]"" S ASUV("LEV")=1 D PRTOTL
 ..D ACC^ASULDIRF(ASUMX("ACC"))
 ..S ASUQA("ACC")=ASUL(9,"ACC")_" - "_ASUL(9,"ACC","NM")
 .D P1
 I $D(DUOUT)!($D(DTOUT)) G K
 I ASUV("LEV")'=1 D
 .S ASUV("LEV")=1 D PRTOTL
 S ASUV("LEV")=2 D PRTOTL
 D CLS^ASUUHDG
K ;
 K ASUC,ASUF,ASUQA,ASUR,ASUT,ASUV,ASUX,ASURZ,ASURZX,ASUMS
 F X=3:1:22 K ASUL(X) ;Clear Table Lookup fields
 K DFOUT,DIR,DLOUT,DTOUT,DUOUT
 K X,X1,Y
 I ASUK("PTRSEL")]"" Q
 D C^ASUUZIS
 Q
NEWQTR ;EP ;
 ;GLOBAL ASURX IS A UTILITY REPORT EXTRACT GLOBAL
 K ^XTMP("ASUR","R81"),^XTMP("ASUR","R82")
 S ^XTMP("ASUR","R81",0)=ASUK("DT","FM")+10000_U_ASUK("DT","FM")
 S ^XTMP("ASUR","R82",0)=ASUK("DT","FM")+10000_U_ASUK("DT","FM") G EN
P1 ;
 S ASUMX("E#","IDX")=$E(ASUX("ACIX"),2,9) D READ^ASUMXDIO
 S ASUX("REQ")="",ASUF("IDX")=0
 F  S ASUX("REQ")=$O(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ"))) Q:ASUX("REQ")=""  Q:$D(DTOUT)  Q:$D(DUOUT)  D
 .S ASUQA=^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ"))
 .I $G(ASUX("SST"))'=$E(ASUX("REQ"),1,5) D
 ..K ASUL(18)
 ..S ASUX("SST")=$E(ASUX("REQ"),1,5)
 ..D SST^ASULDIRR(ASUX("SST"))
 ..S ASUQA("SST")=ASUL(18,"SST")_" - "_ASUL(18,"SST","NM")
 .S ASUV("SST")=ASUX("SST")
 .S $P(ASUQA(0,ASUX("SST")),U)=$P(ASUQA,U)
 .S $P(ASUQA(0,ASUX("SST")),U,2)=$P(ASUQA,U,2)
 .S $P(ASUQA(0,ASUX("SST")),U,3)=$FN(($P(ASUQA,U,2)/ASUQA("DIV")),"",2)
 .S $P(ASUQA(0,ASUX("SST")),U,4)=$P(ASUQA,U,3)
 .S $P(ASUQA(0,ASUX("SST")),U,5)=$P(ASUQA,U,4)
 .S $P(ASUQA(0,ASUX("SST")),U,6)=$FN(($P(ASUQA,U,3)/ASUQA("DIV")),"",2)
 .S ASUV("LEV")=0
 .D P3
 .F X=19,20,22 K ASUL(X)
 .S ASUX("USR")=ASUL(1,"AR","AP")_$E(ASUX("REQ"),6,9)
 .D USR^ASULDIRR(ASUX("USR"))
 .D REQ^ASULDIRR(ASUX("REQ"))
 .S ASUQA("USR")=ASUL(19,"USR")_" - "_ASUL(19,"USR","NM")
 .D:ASUF("HDR") HEADER Q:$D(DUOUT)
 .W ! S ASUC("LN")=ASUC("LN")+1
 .I ASUF("IDX")=1 D
 ..W ?10,ASUMX("DESC",2) S ASUF("IDX")=2
 .E  I ASUF("IDX")=0 D
 ..W ! S ASUC("LN")=ASUC("LN")+1
 ..W ?1,$E(ASUMX("IDX"),1,5)_"."_$E(ASUMX("IDX"),6,6)
 ..W ?10,ASUMX("DESC",1)
 ..W ?45,ASUMX("AR U/I")
 ..S ASUF("IDX")=1
 .D P2
 Q:$D(DTOUT)  Q:$D(DUOUT)
 I ASUF("IDX")=1 W !?10,ASUMX("DESC",2) S ASUC("LN")=ASUC("LN")+1
 I ASUF("IDX") S ASUV("SST")=0 D PRTOTL
 Q
P2 ;
 W ?50,ASUL(18,"SST"),?55,ASUL(19,"USR")
PRLQTY ;
 F ASUV("PIECE")=1:1:3 D
 .S ASURZX=((ASUV("PIECE")-1)*10)+60
 .S ASURZ=$J($FN($P(ASUQA(ASUV("LEV"),ASUV("SST")),U,ASUV("PIECE")),"+,T",0),10)
 .D PRCOLM
PRLVAL ;
 F ASUV("PIECE")=4:1:6 D
 .S ASURZX=((ASUV("PIECE")-4)*12)+90
 .S ASURZ=$J($FN($P(ASUQA(ASUV("LEV"),ASUV("SST")),U,ASUV("PIECE")),"+,T",2),12)
 .D PRCOLM
 I ASUC("LN")>(IOSL-2) S ASUF("HDR")=1
 Q
PRCOLM ;
 W ?ASURZX,ASURZ
 Q
PRTOTL ;
 I ASUC("LN")>(IOSL-ASUV("LEV")*3) S ASUF("HDR")=1
 D:ASUF("HDR") HEADER Q:$D(DUOUT)
 W !,$P($T(TOTNAM+ASUV("LEV")),";",4)
 S ASUC("LN")=ASUC("LN")+1
 S ASUV("SST")=0
 I ASUV("LEV")=0 D
 .D PRDASH
 .W !?35,$P($T(TOTNAM+ASUV("LEV")),";",3)
 .S ASUC("LN")=ASUC("LN")+1
 .D PRLQTY,PRDDSH
 E  D
 .D PRSST
 .S ASUF("HDR")=1
 .S ASUV("SST")=0
 .W !?55,$P($T(TOTNAM+ASUV("LEV")),";",3)
 .S ASUC("LN")=ASUC("LN")+1
 .D PRLVAL
 .W ! D PRDDSHV
 S ASUV("SST")=ASUL(18,"SST","E#")
 K ASUQA(ASUV("LEV"))
 Q
PRDASH ;
 F ASUC=0:1:2 S X=(ASUC*10)+60 W ?X," _________"
PRDASHV ;
 F ASUC=0:1:2 S X=(ASUC*12)+90 W ?X," ___________",?1,""
 S ASUC("LN")=ASUC("LN")+1
 Q
PRDDSH ;
 W !
 F ASUC=0:1:2 S X=(ASUC*10)+60 W ?X," ========="
PRDDSHV ;
 F ASUC=0:1:2 S X=(ASUC*12)+90 W ?X," ===========",?1,""
 S ASUC("LN")=ASUC("LN")+1
 Q
PRSST ;
 S ASUV("SST")=0
 F  S ASUV("SST")=$O(ASUQA(ASUV("LEV"),ASUV("SST"))) Q:ASUV("SST")=""  D
 .W !?50,$E(ASUV("SST"),4,5)
 .W ?55,$P($T(TOTNAM+ASUV("LEV")),";",3)
 .D PRLVAL
 W ! D PRDASHV
 Q
 S ASUC("PG")=ASUC("PG")+1
 D:ASUC("PG")>1 PAZ^ASUURHDR Q:$D(DUOUT)
 W @IOF,!,"REPORT #81 QUARTERLY LISTING OF ITEMS DROP SHIPPED",?70,"DATE : ",ASUV("DT"),?95,"PAGE :",$J(ASUC("PG"),3)
 W !,"AREA: ",ASUQA("AR"),?50,$S(ASUT("QTR")="04":"LAST",ASUT("QTR")="03":"THIRD",ASUT("QTR")="02":"SECOND",1:"1ST")," QUARTER OF FISCAL YEAR ",ASUP("YR")
 S:'$G(ASUQA("ACC")) ASUQA("ACC")=$G(ASUL(9,"ACC"))_"-"_$G(ASUL(9,"ACC","NM"))
 W !,"STAT: ",ASUQA("STA"),?53,"GL ACCOUNT : ",ASUQA("ACC")
 W !!?68,"QUANTITY ISSUED",?96,"ISSUE VALUE          ISSUE VALUE"
 W !?3,"INDEX  ITEM",?45,"U",?49,"SUB",?55,"USER",?64,"CURRENT",?83,"MONTHLY",?96,"CURRENT",?119,"MONTHLY"
 W !?2,"NUMBER  DESCRIPTION",?46,"I",?49,"STA",?55,"CODE",?64,"QUARTER",?76,"Y-T-D",?83,"AVERAGE",?96,"QUARTER",?110,"Y-T-D",?119,"AVERAGE"
 W ! F ASUC=1:1:132 W "_"
 W !!
 S ASUC("LN")=10,ASUF("HDR")=0
 Q
TOTNAM ;;ITEM TOTAL
 ;;GL ACCOUNT TOTAL VALUE;SUMMARY OF DROP SHIPPED BY ACCOUNT
 ;;TOTAL VALUE DROP SHIPPED;SUMMARY OF TOTAL VALUE DROP SHIPPED
P3 ;
 F ASUV("PIECE")=1:1:6 D
 .S ASUQA(0,0)=$G(ASUQA(0,0))
 .S $P(ASUQA(0,0),U,ASUV("PIECE"))=$P(ASUQA(0,0),U,ASUV("PIECE"))+$P(ASUQA(0,ASUX("SST")),U,ASUV("PIECE"))
 F ASUV("LEVA")=0:1:2 D ONE
 Q
ONE ;
 F ASUV("PIECE")=1:1:6 D
 .S ASUQA(ASUV("LEVA")+1,ASUX("SST"))=$G(ASUQA(ASUV("LEVA")+1,ASUX("SST")))
 .S $P(ASUQA(ASUV("LEVA")+1,ASUX("SST")),U,ASUV("PIECE"))=$P(ASUQA(ASUV("LEVA")+1,ASUX("SST")),U,ASUV("PIECE"))+$P(ASUQA(0,ASUX("SST")),U,ASUV("PIECE"))
 .S ASUQA(ASUV("LEVA")+1,0)=$G(ASUQA(ASUV("LEVA")+1,0))
 .S $P(ASUQA(ASUV("LEVA")+1,0),U,ASUV("PIECE"))=$P(ASUQA(ASUV("LEVA")+1,0),U,ASUV("PIECE"))+$P(ASUQA(0,ASUX("SST")),U,ASUV("PIECE"))
 Q