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

ASURD70P.m

Go to the documentation of this file.
ASURD70P ; IHS/ITSC/LMH -RPT 70 ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine formats and prints report 70, Replenishment Pre Posted
 ;Issues Invoice/Shipping list.
 D:'$D(IO) 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^ASURD70P",ZTDESC="SAMS RPT 70" D O^ASUUZIS
 I POP S IOP=$I D ^%ZIS Q
 I ASUK(ASUK("PTR"),"Q") Q
PSER ;EP;FOR TASKMAN QUEUE OF PRINT
 D U^ASUUZIS,DATE^ASUUDATE S ASUX("RPT")="R70",ASUT="ISS",ASUP0="INVOICE^ASURD70P",ASUHD="HEADER^ASURD70P" D P7^ASURD70I
 S Y=$P(^XTMP("ASUR",ASUX("RPT"),0),U,2) X ^DD("DD") S ASUX("DT")=Y
 S X=$O(^XTMP("ASUR",ASUX("RPT"),0)) I X']"" D
 .W @IOF,!!,"NO DATA FOR REPORT 70"
 E  D READX
 K ASUU,ASUT,ASUC,ASUCL,ASUV,ASUF,ASUA,DIC,DA,X,Y F X=3:1:22 K ASUL(X)
 D PAZ^ASUURHDR Q:$D(DUOUT)  W @IOF
 D ^ASURD70I I $G(ASUK("PTRSEL"))]"" W @IOF Q
 D C^ASUUZIS
 Q
READX ;EP ;READ TMP GLOBAL
 S ASUX("STA")=0 F  S ASUX("STA")=$O(^XTMP("ASUR",ASUX("RPT"),$G(ASUX("STA")))) Q:ASUX("STA")=""  D
 .I ASUX("STA")'=$G(ASUV("STA")) D
 ..I $G(ASUV("STA"))="" S ASUV("STA")=ASUX("STA") D STA^ASULARST(ASUX("STA"))
 .S ASUX("SST")=0
 .F  S ASUX("SST")=$O(^XTMP("ASUR",ASUX("RPT"),ASUX("STA"),ASUX("SST"))) Q:ASUX("SST")=""  Q:$D(DUOUT)  D
 ..S ASUF("HDR")=0,ASUX("VOU")=""
 ..I $G(ASUV("SST"))'=ASUX("SST") D
 ...I $G(ASUV("SST"))="" S ASUV("SST")=ASUX("SST") D SST^ASULDIRR(ASUV("SST"))
 ..S ASUX("VOU")=""
 ..F  S ASUX("VOU")=$O(^XTMP("ASUR",ASUX("RPT"),ASUX("STA"),ASUX("SST"),ASUX("VOU"))) Q:ASUX("VOU")=""  Q:$D(DUOUT)  D
 ...I $G(ASUV("VOU"))'=ASUX("VOU") S ASUF("HDR")=1,ASUC("PG")=0,ASUV("VOU")=ASUX("VOU")
 ...S ASUX("SLC")="" F  S ASUX("SLC")=$O(^XTMP("ASUR",ASUX("RPT"),ASUX("STA"),ASUX("SST"),ASUX("VOU"),ASUX("SLC"))) Q:ASUX("SLC")=""  D
 ....D:$G(ASUL(10,"SLC"))'=ASUX("SLC") SLC^ASULDIRR(ASUX("SLC")) S ASUV("SLC")=ASUX("SLC")
 ....S ASUX("IDX")=0
 ....F  S ASUX("IDX")=$O(^XTMP("ASUR",ASUX("RPT"),ASUX("STA"),ASUX("SST"),ASUX("VOU"),ASUX("SLC"),ASUX("IDX"))) Q:ASUX("IDX")=""  D
 .....S ASUHDA="",ASUV("IDX")=ASUX("IDX")
 .....F  S ASUHDA=$O(^XTMP("ASUR",ASUX("RPT"),ASUX("STA"),ASUX("SST"),ASUX("VOU"),ASUX("SLC"),ASUX("IDX"),ASUHDA)) Q:ASUHDA=""  D
 ......D READ^ASU0TRRD(.ASUHDA,"H") Q:$G(ASUT)']""
 ......D @ASUP0
 ....S ASUX("IDX")=ASUV("IDX")
 ...D SLCBK K ASUC(1) S ASUF("BK")=1
 ...D LSTSLC S ASUX("SLC")=ASUV("SLC"),ASUF("BK")=2
 ..D SSTBK
 Q
SSTBK ;Sub Station Break
 I $G(ASUA("#"))>0 D
 .S ASUA("#")="",ASUC("LN")=ASUK(ASUK("PTR"),"IOSL")+1,ASUF("BK")=3
 .F  S ASUA("#")=$O(ASUAN($G(ASUA("#")))) Q:ASUA("#")=""  D
 ..S ASUV("#")=$G(ASUA("#")),ASUADA=$P(ASUAN(ASUA("#")),U) D READ^ASU0TRRD(.ASUADA,"H")
 ..S ASUV("RMK",0)=$P(ASUAN(ASUA("#")),U,2)
 ..S ASUV("RMK",1)=$P(ASUAN(ASUA("#")),U,3)
 ..S ASUC(0,"QTYREQ")=ASUT(ASUT,"QTY","REQ")
 ..S ASUC(0,"QTYISS")=$S(ASUV("RMK",0)="B/O O/F":0,1:ASUT(ASUT,"QTY","ISS"))
 ..S ASUC(0,"UCS")=$S(+ASUT(ASUT,"QTY","ISS")=0:"0.00",1:$FN(ASUT(ASUT,"VAL")/ASUT(ASUT,"QTY","ISS"),"",2))
 ..S ASUC(0,"VAL")=ASUT(ASUT,"VAL"),ASUC(0,"DIF")=ASUC(0,"QTYISS")-ASUC(0,"QTYREQ")
 ..S ASUX("IDX")=ASUT(ASUT,"PT","IDX") D IDXBK Q:$D(DUOUT)
 ..K ASUAN(ASUA("#")),ASUA("#")
 .W !!,"TOTAL LINE ITEMS : ",$J($FN(ASUV("#"),","),7),! S ASUC("LN")=ASUK(ASUK("PTR"),"IOSL")+3,ASUV("IDX")=ASUX("IDX")
 .K ASUC(0)
 .K ASUA,ASUQT(0) S ASUA("#")=0
 Q
INVOICE ;EP;INVOICE
 I ASUF("BK")=1 D HEADER S ASUF("BK")=0
 S ASUT(ASUT,"QTY","ISS")=$G(ASUT(ASUT,"QTY","ISS")) S:ASUT(ASUT,"QTY","ISS")']"" ASUT(ASUT,"QTY","ISS")=$G(ASUT(ASUT,"QTY"))
 S ASUC(0,"UCS")=$S(+ASUT(ASUT,"QTY","ISS")=0:"0.00",1:$FN(ASUT(ASUT,"VAL")/ASUT(ASUT,"QTY","ISS"),"",2))
 I ASUT(ASUT,"QTY","ISS")>0 D
 .S ASUC(0,"VAL")=$G(ASUC(0,"VAL"))+ASUT(ASUT,"VAL")
 .S ASUC(0,"QTYREQ")=$G(ASUC(0,"QTYREQ"))+ASUT(ASUT,"QTY","REQ")
 .S ASUC(0,"QTYISS")=$G(ASUC(0,"QTYISS"))+ASUT(ASUT,"QTY","ISS")
 I ($G(ASUT(ASUT,"QTY","REQ"))>0)&(ASUT(ASUT,"QTY","ISS")=0) S ASUC(0,"QTYREQ")=$G(ASUC(0,"QTYREQ"))+$G(ASUT(ASUT,"QTY","REQ"))
 I ASUT(ASUT,"QTY","ISS")'>0 S ASUT(ASUT,"QTY","ISS")=0,ASUV("RMK",0)="STK OUT"
 I ASUT(ASUT,"QTY","ISS")=0 S ASUC(0,"OUT")=$G(ASUC(0,"OUT"))+1
 S ASUC(0,"ITEM")=$G(ASUC(0,"ITEM"))+1
 I ASUT(ASUT,"FPN")="B" D
 .S ASUT(ASUT,"FPN")="N",ASUC(0,"QTYISS")=0,ASUC(0,"PART")=$G(ASUC(0,"PART"))+1
 .S ASUV("RMK",1)="B/O O/F",ASUS("QTYAJ")=0,ASUA("#")=$G(ASUA("#"))+1
 .S ASUAN(ASUA("#"))=ASUHDA_U_$G(ASUV("RMK",0))_U_$G(ASUV("RMK",1))_U_$G(ASUV("RMK",2))
 I ASUT(ASUT,"FPN")="P" D
 .I ASUX("RPT")="R7I" S ASUV("RMK",1)="PAR ISS"
 .E  S ASUV("RMK",1)="PAR B/0"
 .S ASUC(0,"PART")=$G(ASUC(0,"PART"))+1,ASUS("QTYAJ")=0,ASUA("#")=$G(ASUA("#"))+1
 .S ASUAN(ASUA("#"))=ASUHDA_U_$G(ASUV("RMK",0))_U_$G(ASUV("RMK",1))_U_$G(ASUV("RMK",2))
 I (ASUT(ASUT,"QTY","REQ")>0)&(ASUT(ASUT,"QTY","ISS")=0) D
 .S ASUV("RMK",1)="TOT B/O",ASUS("QTYAJ")=0,ASUA("#")=$G(ASUA("#"))+1
 .S ASUAN(ASUA("#"))=ASUHDA_U_$G(ASUV("RMK",0))_U_$G(ASUV("RMK",1))_U_$G(ASUV("RMK",2))
 I ASUT(ASUT,"QTY","ADJ")="A" D
 .S ASUS("QTYAJ")=1 I $G(ASUA("#"))>0 D
 ..I $P(ASUAN(ASUA("#")),U)=ASUHDA Q
 ..S ASUA("#")=$G(ASUA("#"))+1
 .S ASUV("RMK",2)="QTY ADJ" S:$G(ASUA("#"))']"" ASUA("#")=1
 .S ASUAN(ASUA("#"))=ASUHDA_U_$G(ASUV("RMK",0))_U_$G(ASUV("RMK",1))_U_$G(ASUV("RMK",2))
 S ASUF("BK")=0
 D IDXBK Q:$D(DUOUT)
 N X S X="" F  S X=$O(ASUC(0,X)) Q:X']""  S ASUC(1,X)=$G(ASUC(1,X))+ASUC(0,X)
 K ASUC(0)
 Q
IDXBK ;EP;INDEX
 I ASUC("LN")>ASUK(ASUK("PTR"),"IOSL") D @ASUHD Q:$D(DUOUT)
 I ASUX("RPT")'="R71" D
 .I $G(ASUV("RMK",1))=""&($G(ASUV("RMK",0))="") S ASUV("RMK",0)=$G(ASUV("RMK",2)) K ASUV("RMK",2)
 .I $G(ASUV("RMK",0))=""&($G(ASUV("RMK",1))]"") S ASUV("RMK",0)=$G(ASUV("RMK",1)) K ASUV("RMK",1)
 .I $G(ASUV("RMK",0))]""&($G(ASUV("RMK",1))]"") S ASUV("RMK",2)=$G(ASUV("RMK",1))
 E  S ASUV("RMK",0)=$G(ASUT(ASUT,"RMK"))
 W !!?1,$E($G(ASUX("IDX")),3,7),".",$E($G(ASUX("IDX")),8,8),?30,$G(ASUMX("AR U/I"))
 W ?34,$J($FN($G(ASUC(0,"QTYREQ")),",",0),6),?44,$J($FN($G(ASUC(0,"QTYISS")),",",0),6),"*",?52,$J($FN($G(ASUC(0,"UCS")),",",2),8),?62,$J($FN($G(ASUC(0,"VAL")),",",2),10),?73,$G(ASUV("RMK",0))
 W !?5,$S($G(ASUMX("DESC"))]"":ASUMX("DESC"),1:$G(ASUMX("DELDS"))),?73,$S($G(ASUC(0,"DIF"))]"":$J($G(ASUC(0,"DIF")),7),1:$G(ASUV("RMK",2)))
 W !,"________________________________________________________________________________"
 S ASUC("LN")=ASUC("LN")+6 K ASUV("RMK")
 Q
SLCBK ;EP; STORAGE LOCATION CODE BRK
 S ASUC("LN")=ASUC("LN")+2
 I ASUC("LN")>ASUK(ASUK("PTR"),"IOSL") D HEADER Q:$D(DUOUT)
 W !!?2,"TOTAL LINE ITEMS: ",?20,$J($FN($G(ASUC(1,"ITEM")),","),5),?26,"NO. OUTS: " W ?36,$J($FN($G(ASUC(1,"OUT")),","),5),?42,"NO. PARTIALS: ",?56,$J($FN($G(ASUC(1,"PART")),","),5)
 W ?62,$J($FN($G(ASUC(1,"VAL")),",",2),10)
 W !!?3,"ISSUED BY:",?42,"CHECKED BY:",!?5,"DATE:",?45,"DATE:",!?5,"TIME STARTED:",?45,"TIME STARTED:",!?5,"TIME FINISHED:",?45,"TIME FINISHED:",!
 S ASUC("LN")=ASUC("LN")+6
 N X S X="" F  S X=$O(ASUC(1,X)) Q:X']""  S ASUCL(ASUV("SLC"),X)=$G(ASUCL(ASUV("SLC"),X))+ASUC(1,X)
 Q
LSTSLC ;EP ;
 D @ASUHD S ASULR("SLC")=9
 S ASULR("SLC")=0 F  S ASULR("SLC")=$O(ASUCL(ASULR("SLC"))) Q:ASULR("SLC")']""  D
 .Q:ASULR("SLC")?1N
 .D SLC^ASULDIRR(ASULR("SLC")) W !!?2,$J(ASUL(10,"SLC","NM"),13)
 .W ?17,$J($FN($G(ASUCL(ASULR("SLC"),"ITEM")),",",0),6)
 .W ?24,$J($FN($G(ASUCL(ASULR("SLC"),"OUT")),",",0),6)
 .W ?35,$J($FN($G(ASUCL(ASULR("SLC"),"PART")),",",0),6)
 .W ?42,$J($FN($G(ASUCL(ASULR("SLC"),"VAL")),",",2),10)
 .N X S X="" F  S X=$O(ASUCL(ASULR("SLC"),X)) Q:X']""  S ASUC(2,X)=$G(ASUC(2,X))+ASUCL(ASULR("SLC"),X)
 .K ASUCL(ASULR("SLC"))
 S X2=0,X3=5
 W !!?2,"T O T A L",?17,$J($FN($G(ASUC(2,"ITEM")),",",0),6),?24,$J($FN($G(ASUC(2,"OUT")),",",0),6)
 W ?35,$J($FN($G(ASUC(2,"PART")),",",0),6),?42,$J($FN($G(ASUC(2,"VAL")),",",2),10),!
 S ASUF("BK")=0,ASUC("LN")=ASUK(ASUK("PTR"),"IOSL")+1,ASUV("VOU")=ASUX("VOU") K ASUC(2),ASUCL(0)
 Q
 S ASUC("PG")=$G(ASUC("PG"))+1,ASUC("LN")=0 D:ASUC("PG")>1 PAZ^ASUURHDR Q:$D(DUOUT)  W @IOF
 S ASUV("HEAD")=$S(ASUX("RPT")="R70":"70  ISSUE/SHIPPING/INVOICE DOCUMENT",1:"70I POST-POSTED ISSUE/INVOICE DOCUMENT")
 W !?1,"REPORT #",ASUV("HEAD") W ?55,ASUX("DT"),?73,"PAGE ",ASUC("PG")
 W !?3,"AREA ",ASUL(1,"AR","AP") W ?15,ASUL(1,"AR","NM")
 W ?40,"STATION ",ASUL(2,"STA","CD"),?51,ASUL(2,"STA","NM")
 W !?1,"REQUISITIONER: LOC  ",ASUL(18,"SST")," -",?26,ASUL(18,"SST","NM")
 W ?48,"DATE OF REQUEST: " S Y=ASUT(ASUT,"DTR") X ^DD("DD") W ?66,Y
 W !!?1,"CAN ",?6,ASUT(ASUT,"CAN"),?15,"USER ",?19,ASUL(19,"USR"),?24,"-",?26,ASUL(19,"USR","NM")
 W ?49,"REQUEST NO. ",?61,ASUT(ASUT,"RQN"),!!?1,"SSA ",?6,ASUT(ASUT,"SSA"),?10,"CONTRACT/GRANT NO: ",?30,ASUT(ASUT,"CTG")
 W ?48,"VOUCHER NO: ",?60,ASUV("VOU")
 I ASUF("BK")=2!(ASUF("END")=1) D
 .S ASUC("LN")=ASUC("LN")+7 W !!?27,"VOUCHER NUMBER CONTROL SHEET",!!?18,"NO LI     LI     NO LI       ISSUE  ISSUE DOC"
 .W !?1,"STORAGE LOC      ITEMS   OUTS  PARTIALS       VALUE  ASSIGNED TO   DATE" S ASUC("LN")=ASUC("LN")+5
 E  D
 .I ASUF("BK")=3 W !!?23,"LISTING OF ORDER QUANTITY CHANGES" S ASUC("LN")=ASUC("LN")+2
 .E  W !!?1,"STORAGE LOCATION:",?20,$G(ASUL(10,"SLC","NM"))
 .W !!!?3,"INDEX",?36,"QUANT",?46,"QUANT",?56,"UNIT",?66,"TOTAL"
 .W !?2,"NUMBER  DESCRIPTION",?30,"UI",?36,$S(ASUX("RPT")="R71":"B/O",1:"REQ'D"),?45,"ISSUED",?56,"COST",?67,"COST",?73,"REMARKS"
 .W !,"________________________________________________________________________________"
 .S ASUC("LN")=ASUC("LN")+14,ASUF("HDR")=0
 Q