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

ASURQ810.m

Go to the documentation of this file.
ASURQ810 ; IHS/ITSC/LMH -RPT 81 DROP SHIP LIST SORT ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine sorts report 81 extracts into proper sequence so that
 ;the report can be formatted and printed.
 I '$D(ASUP("QTR")) D SETQTR^ASUUDATE Q:$D(DUOUT)
 S ASUT="ISS",ASUT("TRCD")=""
 S ^XTMP("ASUR","R81",0)=ASUK("DT","FM")_U_ASUP("QTR")
 S ^XTMP("ASUR","R82",0)=ASUK("DT","FM")_U_ASUP("QTR")
 S ASUX("ARST")=ASUL(1,"AR","AP")_"000"
 F  S ASUX("ARST")=$O(^ASUMS(ASUX("ARST"))) Q:$E(ASUX("ARST"),1,2)'=ASUL(1,"AR","AP")  D
 .S ASUMX("E#","IDX")=0
 .F  S ASUMX("E#","IDX")=$O(^ASUMS(ASUX("ARST"),1,ASUMX("E#","IDX")))  Q:$E(ASUMX("E#","IDX"),1,2)'=ASUL(1,"AR","AP")  D
 ..Q:$P(^ASUMS(ASUX("ARST"),1,ASUMX("E#","IDX"),0),U)["999999"
 ..S ^XTMP("ASUR","R81",0,ASUX("ARST"))=$P(^ASUL(2,ASUX("ARST"),0),U)
 ..S ^XTMP("ASUR","R82",0,ASUX("ARST"))=^XTMP("ASUR","R81",0,ASUX("ARST"))
 ..S ASUMS("EOQ","TP")=$P(^ASUMS(ASUX("ARST"),1,ASUMX("E#","IDX"),2),U,5)
 ..S ASUMX("ACC")=$P(^ASUMX(ASUMX("E#","IDX"),0),U,6)
 ..S ASUX("ACIX")=ASUMX("ACC")_ASUMX("E#","IDX")
 ..I ASUMS("EOQ","TP")="S" D  Q
 ...S ^XTMP("ASUR","R81",0,"IDX",ASUMX("E#","IDX"))=ASUMX("ACC")
 ...S ^XTMP("ASUR","R81",0,ASUX("ARST"),ASUX("ACIX"))=$P(^ASUL(9,ASUMX("ACC"),0),U)
 ..I ASUMS("EOQ","TP")="Y" D
 ...S ^XTMP("ASUR","R82",0,"IDX",ASUMX("E#","IDX"))=ASUMX("ACC")
 ...S ^XTMP("ASUR","R82",0,ASUX("ARST"),ASUX("ACIX"))=$P(^ASUL(9,ASUMX("ACC"),0),U)
 S ASUX("QTR")=$E(ASUP("QTR"),5,6)
 S ASUX("QTRF")=$E(ASUP("QTR"),1,4)_"00"
 S ASUV("YR")=ASUP("YR") S:$L(ASUV("YR"))=4 ASUV("YR")=$E(ASUV("YR"),3,4)
 F  S ASUX("QTRF")=$O(^ASUML("C",ASUX("QTRF"))) Q:ASUX("QTRF")']""  Q:$E(ASUX("QTRF"),3,4)'=ASUV("YR")  D
 .S ASUV("CQTR")=$E(ASUX("QTRF"),5,6) Q:ASUV("CQTR")>ASUX("QTR")
 .S ASUX("XTRQTR")=""
 .F  S ASUX("XTRQTR")=$O(^ASUML("C",ASUX("QTRF"),ASUX("XTRQTR"))) Q:ASUX("XTRQTR")'?1N.N  D
 ..S ASUX("XTRDT")=""
 ..F  S ASUX("XTRDT")=$O(^ASUML(ASUX("XTRQTR"),"B",ASUX("XTRDT"))) Q:ASUX("XTRDT")=""  D
 ...S ASUHDA=""
 ...F  S ASUHDA=$O(^ASUH("AX",ASUX("XTRDT"),ASUHDA)) Q:ASUHDA=""  D ASURQ811
END ;
 K ASUT,ASUR,ASUMS,ASUV,ASUX
 Q
ASURQ811 ;DROP SHIP LIST SORT
 D READ^ASU0TRRD(.ASUHDA,"H") Q:$G(ASUT)']""
 Q:ASUT("TYPE")'=3
 S ASUMX("E#","IDX")=ASUL(1,"AR","AP")_ASUT(ASUT,"IDX")
 S ASUX("ARST")=ASUL(1,"AR","AP")_0_ASUT(ASUT,"STA")
 S ASUX("SST")=ASUL(1,"AR","AP")_0_ASUT(ASUT,"SST")
 Q:$G(^ASUMS(ASUX("ARST"),1,ASUMX("E#","IDX"),0))'[""
 Q:$P(^ASUMS(ASUX("ARST"),1,ASUMX("E#","IDX"),0),U)["999999"
 S ASUMX("ACC")=ASUT(ASUT,"ACC")
 S ASUX("QTY")=ASUT(ASUT,"QTY","ISS")
 S:ASUX("QTY")']"" ASUX("QTY")=ASUT(ASUT,"QTY","REQ")
 I ASUT("TRCD")="3K" D  Q
 .I ASUT(ASUT,"EOQ TYP")="S" D XTR Q
 .I $D(^XTMP("ASUR","R81",0,"IDX",ASUMX("E#","IDX"))) D XTR Q
 I ASUT("TRCD")'=32 Q
 I ASUT(ASUT,"EOQ TYP")="S" D XTR Q
 I $D(^XTMP("ASUR","R81",0,"IDX",ASUMX("E#","IDX"))) D XTR Q
 I ASUT(ASUT,"EOQ TYP")="Y" D ASURQ821 Q
 I $D(^XTMP("ASUR","R82",0,"IDX",ASUMX("E#","IDX"))) D ASURQ821
XTR ;
 I ASUT("TRCD")="3K" D
 .S ASUT(ASUT,"VAL")=ASUT(ASUT,"VAL")*-1
 .S ASUX("QTY")=ASUX("QTY")*-1
 I ASUMX("ACC")']"" D SETACC Q:ASUMX("ACC")']""
 S ASUX("ACIX")=ASUMX("ACC")_ASUMX("E#","IDX")
 I '$D(^XTMP("ASUR","R81",ASUX("ARST"))) D
 .S ^XTMP("ASUR","R81",ASUX("ARST"))=$G(^XTMP("ASUR","R81",0,ASUX("ARST")))
 I '$D(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"))) D
 .S ^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"))=$G(^XTMP("ASUR","R81",0,ASUX("ARST"),ASUX("ACIX")))
 K ASUL(18)
 D SST^ASULDIRR(ASUX("SST"))
 I '$D(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"))) D
 .S ^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"))=$G(^XTMP("ASUR","R81",0,ASUX("ARST"),ASUX("ACIX")))
 F X=19,20,22 K ASUL(X)
 D REQ^ASULDIRR(ASUT(ASUT,"USR"))
 S ASUX("REQ")=$G(ASUL(20,"REQ","E#")) Q:ASUX("REQ")']""
 I '$D(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ"))) D
 .S ^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ"))="0^0^0^0"
 S $P(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ")),U,2)=$P(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ")),U,2)+ASUX("QTY")
 S $P(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ")),U,4)=$P(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ")),U,4)+ASUT(ASUT,"VAL")
 I ASUX("QTR")'=ASUV("CQTR") Q
 S $P(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ")),U)=$P(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ")),U)+ASUX("QTY")
 S $P(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ")),U,3)=$P(^XTMP("ASUR","R81",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ")),U,3)+ASUT(ASUT,"VAL")
 Q
ASURQ821 ;YEARLY ITEM LIST SORT
 I ASUT("TRCD")="3K" D
 .S ASUT(ASUT,"VAL")=ASUT(ASUT,"VAL")*-1
 .S ASUX("QTY")=ASUX("QTY")*-1
 I '$D(^XTMP("ASUR","R82",ASUX("ARST"))),$D(^XTMP("ASUR","R81",ASUX("ARST"))) D
 .S ^XTMP("ASUR","R82",ASUX("ARST"))=^XTMP("ASUR","R81",ASUX("ARST"))
 I '$G(^XTMP("ASUR","R82",ASUX("ARST")))']"" D
 .S ^XTMP("ASUR","R82",ASUX("ARST"))=$G(^XTMP("ASUR","R81",0,ASUX("ARST")))
 I '$D(^XTMP("ASUR","R82",ASUX("ARST"),ASUX("ACIX"))) D
 .S ^XTMP("ASUR","R82",ASUX("ARST"),ASUX("ACIX"))=$G(^XTMP("ASUR","R82",0,ASUX("ARST"),ASUX("ACIX")))
 D SST^ASULDIRR(ASUX("SST"))
 D REQ^ASULDIRR(ASUT(ASUT,"USR"))
 S ASUX("REQ")=$G(ASUL(20,"REQ","E#")) Q:ASUX("REQ")']""
 I '$D(^XTMP("ASUR","R82",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ"))) D
 .S ^XTMP("ASUR","R82",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ"))="0^0^0^0"
 S ASUX=^XTMP("ASUR","R82",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ"))
 S $P(ASUX,U,2)=$P(ASUX,U,2)+ASUX("QTY")
 S $P(ASUX,U,4)=$P(ASUX,U,4)+ASUT(ASUT,"VAL")
 I ASUX("QTR")=ASUV("CQTR") D
 .S $P(ASUX,U)=$P(ASUX,U)+ASUX("QTY")
 .S $P(ASUX,U,3)=$P(ASUX,U,3)+ASUT(ASUT,"VAL")
 S ^XTMP("ASUR","R82",ASUX("ARST"),ASUX("ACIX"),ASUX("REQ"))=ASUX
SETACC ;EP; SET ACCOUNT
 S ASUMX("ACC")=$P(^ASUMX(ASUMX("E#","IDX"),0),U,6)
 Q