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

ASURQ490.m

Go to the documentation of this file.
ASURQ490 ; IHS/ITSC/LMH -RPT 49 R & N ITEMS ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine formats and prints report 49, List R & N Items
 ;from sorted extracts.
 K ^XTMP("ASUR","R49")
 S ^XTMP("ASUR","R49",0)=ASUK("DT","FM")+10000_U_ASUK("DT","FM")
 S ASUMS("E#","STA")=0,^XTMP("ASUR","R49",0)=ASUK("DT","FM")
 S (ASUC("TVAL","TOT"),ASUC("TVAL","TPA"),ASUC("TVAL","13IS"),ASUC("TVAL","XS"),ASUC("TVAL","AIV"))=0
 S (ASUC("TLI","TOT"),ASUC("TLI","13IS"),ASUC("TLI","XS"),ASUC("TLI","ZBAL"),ASUC("TLI","PSTDU"),ASUC("TLI","MOD"),ASUC("TLI","NOIS"),ASUC("TLI","NSN"),ASUC("TLI","R13"),ASUC("TLI","RPQ"),ASUC("TLI","LPP"))=0
 F  S ASUMS("E#","STA")=$O(^ASUMS(ASUMS("E#","STA"))) Q:ASUMS("E#","STA")'?1N.N  D
 .F ASUMS("E#","IDX")=0:0 S ASUMS("E#","IDX")=$O(^ASUMS(ASUMS("E#","STA"),1,ASUMS("E#","IDX"))) Q:ASUMS("E#","IDX")'?1N.N  D
 ..D ^ASUMSTRD
 ..S X=$L(ASUMS("PMIQ")) I $E(ASUMS("PMIQ"),X)=0 D
 ...S ASUMS("PMIQ")=$FN((ASUMS("PMIQ")*.1),"",0)
 ..S ASUMX("E#","IDX")=ASUMS("E#","IDX") D READ^ASUMXDIO,ACC^ASULDIRF(ASUMX("ACC"))
 ..Q:$G(ASUF("DLIDX"))=1  Q:ASUMX("ACC")'?1N
 ..S ASUC("VAL","TOT")=$G(ASUC("VAL","TOT"))+ASUMS("VAL","O/H"),ASUC("LI","TOT")=$G(ASUC("LI","TOT"))+1
 ..I ASUMS("EOQ","TP")="A" D
 ...S ASUC("VAL","TPA")=$G(ASUC("VAL","TPA"))+ASUMS("VAL","O/H")
 ...S ASUC("VAL","AIV")=$G(ASUC("VAL","AIV"))+((ASUMS("PMIV")*ASUMS("EOQ","MO")/2))+ASUMS("PMIV")
 ..I ASUMS("SRC")?1N,ASUMS("SRC")>0,ASUMS("SRC")<4 D
 ...I ASUMS("ORD#")']"",$L(ASUMX("NSN"))'>4 D ERR0,SRTXTR Q
 ...I ASUMS("ORD#")'?4N.N S ASUX("ERR")=1 D ERR0,SRTXTR S ASUC("LI","NSN")=$G(ASUC("LI","NSN"))+1
 ..I ASUMS("LSTISS")']"" D
 ...S ASUC("LI","NOIS")=$G(ASUC("LI","NOIS"))+1
 ...I ASUMS("QTY","O/H")>0 D
 ....S ASUX("ERR")=3 D ERR0,SRTXTR
 ...E  D
 ....I ASUMS("D/I","QTY-TOT")'>0 S ASUX("ERR")=2 D ERR0,SRTXTR S ASUC("LI","ZBAL")=$G(ASUC("LI","ZBAL"))+1
 ..S X1=ASUMS("LSTISS"),X2=ASUK("DT","FM") D ^%DTC S ASUMS("MOSIS")=$FN((X/30),"",0)
 ..S ASUMS("MOSUP")=$S(+ASUMS("QTY","O/H")<1:0,+ASUMS("PMIQ")<1:0,1:$FN((ASUMS("QTY","O/H")/ASUMS("PMIQ")),"",0))
 ..I ASUMS("D/I","QTY-TOT")>0 D
 ...I ASUMS("EOQ","TP")="R" S ASUX("ERR")=6 D ERR0,SRTXTR
 ...I ASUMS("QTY","O/H")>0 D
 ....I ASUMS("MOSUP")>6 S ASUX("ERR")=4 D ERR1(ASUMS("MOSUP")),SRTXTR
 ....I ASUMS("MOSIS")>13 S ASUX("ERR")=8 D ERR1(ASUMS("MOSIS")),SRTXTR S ASUC("LI","13IS")=$G(ASUC("LI","13IS"))+1,ASUC("VAL","13IS")=$G(ASUC("VAL","13IS"))+ASUMS("VAL","O/H") Q
 ....S ASUMS("QTY","NED")=(ASUMS("PMIQ")*12)+ASUMS("RPQ") S ASUMS("QTY","XS")=ASUMS("QTY","O/H")-ASUMS("QTY","NED")
 ....I ASUMS("QTY","XS")>0 S ASUX("ERR")=9 D ERR1(ASUMS("QTY","XS")),SRTXTR S ASUC("VAL","XS")=$G(ASUC("VAL","XS"))+ASUMS("VAL","O/H"),ASUC("LI","XS")=$G(ASUC("LI","XS"))+1
 ...E  D
 ....I ASUMS("MOSIS")>1 S ASUX("ERR")=7 D ERR1(ASUMS("MOSIS")),SRTXTR S ASUC("LI","ZBAL")=$G(ASUC("LI","ZBAL"))+1 Q
 ..I ASUMS("MOSIS")>7 S ASUX("ERR")=5 D ERR1(ASUMS("MOSIS")),SRTXTR Q
 ..I ASUMS("EOQ","TP")="P",ASUMS("DMD","CALL")>4 S ASUX("ERR")=10 D ERR0,SRTXTR S ASUC("LI","MOD")=$G(ASUC("LI","MOD"))+1
 ..I ASUMS("EOQ","TP")="B",ASUMS("QTY","O/H")>ASUMS("EOQ","QM") S ASUX("ERR")=11 D ERR2(ASUMS("EOQ","QM"),ASUMS("QTY","O/H")),SRTXTR S ASUC("LI","MOD")=$G(ASUC("LI","MOD"))+1
 ..I ASUMS("EOQ","TP")="C",ASUMS("MOSUP")>ASUMS("EOQ","MM") S ASUX("ERR")=12 D ERR2(ASUMS("EOQ","MM"),ASUMS("MOSUP")),SRTXTR S ASUC("LI","MOD")=$G(ASUC("LI","MOD"))+1
 ..I ASUMS("R13","TIMES")>2 D
 ...I ASUMS("EOQ","MO")>1.5 S ASUX("ERR")=13 D ERR1(ASUMS("R13","TIMES")),SRTXTR S ASUC("LI","R13")=$G(ASUC("LI","R13"))+1
 ..F Y=1:1:3 S X1=ASUMS("D/I","DT",Y),X2=ASUK("DT","FM") D ^%DTC S ASUV("PSTDU")=X I ASUV("PSTDU")>60 S ASUX("ERR")=14 D ERR0,SRTXTR S ASUC("LI","PSTDU")=$G(ASUC("LI","PSTDU"))+1
 ..I ASUMS("PMIQ")>1 D
 ...Q:ASUMS("AMIQ")=0  Q:ASUMS("AMIQ")=ASUMS("PMIQ")
 ...I ASUMS("PMIQ")>ASUMS("AMIQ") D
 ....S ASUV("%")=$FN(((ASUMS("PMIQ")-ASUMS("AMIQ")*100))/ASUMS("PMIQ"),"",0)
 ...E  D
 ....S ASUV("%")=$FN(((ASUMS("AMIQ")-ASUMS("PMIQ")*100))/ASUMS("AMIQ"),"",0)
 ...I ASUV("%")>25 S ASUX("ERR")=15 D ERR2(ASUMS("PMIQ"),ASUMS("AMIQ")),SRTXTR S ASUC("LI","RPQ")=$G(ASUC("LI","RPQ"))+1
 ..I ASUMS("CST/U")>1 D
 ...Q:ASUMS("LPP")=0  Q:ASUMS("CST/U")=ASUMS("LPP")
 ...I ASUMS("LPP")>ASUMS("CST/U") D
 ....S ASUV("%")=$FN(((ASUMS("LPP")-ASUMS("CST/U")*100))/ASUMS("LPP"),"",0)
 ...E  D
 ....S ASUV("%")=$FN(((ASUMS("CST/U")-ASUMS("LPP")*100))/ASUMS("CST/U"),"",0)
 ...I ASUV("%")>25 S ASUX("ERR")=16 D ERR2(ASUMS("LPP"),ASUMS("CST/U")),SRTXTR S ASUC("LI","LPP")=$G(ASUC("LI","LPP"))+1
 .S ASUX("MSG")=""
 .F X="TOT","TPA","13IS","XS","AIV" S ASUC("TVAL",X)=$G(ASUC("TVAL",X))+$G(ASUC("VAL",X)) S ASUX("MSG")=$G(ASUX("MSG"))_$G(ASUC("VAL",X))_U
 .F X="TOT","13IS","XS","ZBAL","PSTDU","MOD","NOIS","NSN","R13","RPQ","LPP" S ASUC("TLI",X)=$G(ASUC("TLI",X))+$G(ASUC("LI",X)) S ASUX("MSG")=$G(ASUX("MSG"))_$G(ASUC("LI",X))_U
 .S ^XTMP("ASUR","R49",ASUMS("E#","STA"),0)=ASUX("MSG") K ASUC("VAL"),ASUC("LI")
 S ASUX("MSG")=""
 F X="TOT","TPA","13IS","XS","AIV" S ASUX("MSG")=$G(ASUX("MSG"))_$G(ASUC("TVAL",X))_U
 F X="TOT","13IS","XS","ZBAL","PSTDU","MOD","NOIS","NSN","R13","RPQ","LPP" S ASUX("MSG")=$G(ASUX("MSG"))_$G(ASUC("TLI",X))_U
 S ^XTMP("ASUR","R49",0)=^XTMP("ASUR","R49",0)_U_ASUX("MSG")
 Q
ERR0 ;
 S ASUX("MSG")=$P($T(ERRMSG+ASUX("ERR")),";",3)_" "_$P($T(ERRMSG+ASUX("ERR")),";",4) Q
ERR1(X) ;
 S ASUX("MSG")=$P($T(ERRMSG+ASUX("ERR")),";",3)_" "_$P($T(ERRMSG+ASUX("ERR")),";",4)_X_" "_$P($T(ERRMSG+ASUX("ERR")),";",5) Q
ERR2(X,Y) ;
 S ASUX("MSG")=$P($T(ERRMSG+ASUX("ERR")),";",3)_" "_$P($T(ERRMSG+ASUX("ERR")),";",4)_X_" "_$P($T(ERRMSG+ASUX("ERR")),";",5)_Y_$P($T(ERRMSG+ASUX("ERR")),";",6) Q
SRTXTR ;
 S ^XTMP("ASUR","R49",ASUMS("E#","STA"),ASUL(9,"ACG"),ASUMS("E#","IDX"),ASUX("ERR"))=ASUX("MSG")
 Q
ERRMSG ;;MSG TO WRITE WHEN ERR FLAG IS SET TO DISPLACEMENT
 ;;01;SOURCE CODE IS 1, 3, OR 4 - NEED TO ENTER VALID STOCK NUMBER OR CHANGE SOURCE CODE
 ;;02;NEW ITEM - NONE ON HAND - NONE DUE IN - SHOULD THE ITEM BE ORDERED OR DELETED
 ;;03;NEW ITEM - NO ISSUES - DOES THE ORDERING ACTIVITY KNOW THE ITEM IS AVAILABLE
 ;;04;WHY ON ORDER - ; MONTH SUPPLY CURRENTLY ON HAND
 ;;05;WHY ON ORDER - ITEM HAS HAD NO ISSUES IN ; MONTHS
 ;;06;WHY ON ORDER - EOQ TYPE CODE IS R - OBSOLETE - DO NOT REORDER
 ;;07;NO ISSUES IN ; MONTHS - ZERO BALANCE - SHOULD THE ITEM BE DELETED OR REORDERED
 ;;08;NO ISSUES IN ; MONTHS - SHOULD THE QUANTITY ON HAND BE REPORTED TO A-PM AS UNREQUIRED TO YOUR NEEDS
 ;;09;EXCESSIVE QUANTITY ON HAND IS ;. THIS SHOULD BE REPORTED TO AREA PROPERTY MANAGEMENT
 ;;10;EOQ TYPE CODE IS P-STANDBY - ITEM HAS HAD 4 OR MORE ISSUE REQUESTS - TYPE CODE NEEDS TO BE UPDATED
 ;;11;EOQ QUANTITY MODIFIER IS ; - QUANTITY ON HAND IS ; - IS THE TYPE CODE AND/OR MODIFIER VALID
 ;;12;EOQ MONTHS OF SUPPLY MODIFIER IS ; MONTHS SUPPLY ON HAND IS ; IS THE TYPE CODE AND/OR THE MODIFIER VALID
 ;;13;;CONSECUTIVE MONTH ITEM HAS BEEN ON REQUIREMENTS REPORT - WHY -DO YOU USE REPORT #13 WHEN ORDERING
 ;;14;DUE IN IS 60 OR MORE DAYS PAST DILIVERY DATE - IS THE DUE IN VALID - DO YOU CHECK REPORT #14 EACH MONTH
 ;;15;PAMIQ IS ; - AMIQ IS ; - DOES THE PAMIQ NEED TO BE UPDATED BY CHANGING THE RPQ
 ;;16;LAST PURCHASE PRICE IS $; - AVERAGE UNIT COST IS $; - DOES THE LAST PURCHACE PRICE NEED TO BE UPDATED