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

ASURO76P.m

Go to the documentation of this file.
ASURO76P ; IHS/ITSC/LMH -PRINT RPT 76 DATA FROM ASURX(76 ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine formats and prints report 76, Analysis of Stock Issues
 ; Report.
PRINT ;EP;PRIMARY ENTRY POINT FOR REPORT 76
 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^ASURO76P",ZTDESC="SAMS RPT 76" 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
 S ASUV("RPT")="R76",ASUC("PG")=""
 I ($D(ASUK("DT"))#10)'=1 D DATE^ASUUDATE
 D P1 S (ASUX("SST"),ASUX("USR"),ASUX("ACC"))=""
 F  S ASUX("SST")=$O(^XTMP("ASUR","R76",ASUX("SST"))) Q:ASUX("SST")=""  D
 .F  S ASUX("USR")=$O(^XTMP("ASUR","R76",ASUX("SST"),ASUX("USR"))) Q:'ASUX("USR")  D
 ..S ASUX("REQ")=ASUX("SST")_$E(ASUX("USR"),3,6)
 ..F  S ASUX("ACC")=$O(^XTMP("ASUR","R76",ASUX("SST"),ASUX("USR"),ASUX("ACC"))) Q:'ASUX("ACC")  S ASUC("TR")=^(ASUX("ACC")) D
 ...F ASUV("FIELD")=1:1:22 D
 ....S ASUC(ASUV("FIELD"),0,ASUX("ACC"))=+$P(ASUC("TR"),U,ASUV("FIELD"))
 ..D P3,HEADER,P1
 D ZAP0
 I ASUK("PTRSEL")]"" Q
 D C^ASUUZIS
 Q
P1 ;EP ;
 F ASUV("ACC")=1,2,3,4,5,9 D
 .F ASUV("FIELD")=1:1:26 D
 ..S ASUC(ASUV("FIELD"),0,ASUV("ACC"))=0
 .F ASUV("FIELD")=15:1:18 D
 ..S ASUC(ASUV("FIELD"),"%",ASUV("ACC"))=0
PTOT ;
 F ASUV("ACC")=1,2,3,4,5,9 D
 .S (ASUC(8,"%",ASUV("ACC")),ASUC(10,"%",ASUV("ACC")),ASUC(12,"%",ASUV("ACC")),ASUC(14,"%",ASUV("ACC")))=0
 .;FIELDS 1,23,24,25 AND 26 ARE COMPUTED RATHER THAN BEING IN THE DATABASE
 .S (ASUC(1,0,ASUV("ACC")),ASUC(23,0,ASUV("ACC")),ASUC(24,0,ASUV("ACC")),ASUC(25,0,ASUV("ACC")),ASUC(26,0,ASUV("ACC")))=0
 F ASUV("FIELD")=1:1:26 D
 .S ASUC(ASUV("FIELD"))=0
 Q
ZAP0 ;EP; -CLEAN UP VARIABLES
 K ASUR,ASUC,ASUV,ASURZX
 Q
 Q:$G(ASUX("REQ"))']""
 S ASUV("SST")="",ASUV("USR")="",ASUC("PG")=ASUC("PG")+1
 D:ASUC("PG")>1 PAZ^ASUURHDR
 W @IOF,!?1,"REPORT #",ASUV("RPT")," ANALYSIS OF ISSUES BY ",$S(ASUV("RPT")=76:"USER",ASUV("RPT")=77:"SUB STATION",ASUV("RPT")=78:"AREA",1:"")
 W ?75,"DATE: ",ASUK("DT"),?104,"PAGE: ",ASUC("PG")
 W !?1,"AREA: ",ASUL(1,"AR","AP")," -",?10,ASUL(1,"AR","NM")
 D SST^ASULDIRR(ASUX("SST")) ;,USR^ASULDIRR(ASUX("USR"))
 I ASUV("RPT")'=78 W !?1,"SUBSTAT: ",ASUL(18,"SST")," - ",ASUL(18,"SST","NM")
 D REQ^ASULDIRR(ASUX("REQ"))
 I ASUV("RPT")=76 W !?1,"USER: ",ASUL(20,"REQ")," - ",ASUL(19,"USR","NM")
 W !!?51,"DRUGS    MEDICAL     SUBSIST   LABORATORY    OFF/ADMIN     ALL OTHER      TOTAL"
 F ASUV("FIELD")=7,8,"P8",9,10,"P10",11,12,"P12",13,14,"P14",1,25,23,24,15,"P15",16,"P16",17,"P17",18,"P18",19,20,21,22 D PRLINE
 F ASUV("FIELD")=5,6,2,3 D PRVALUE
 Q
PRLINE ;
 I ASUV("FIELD")["P" D
 .S ASUV("%")=1,ASUV("FIELD")=$P(ASUV("FIELD"),"P",2),ASUV("ROUT")="PCT"
 E  D
 .S ASUV("ROUT")="PR"_ASUV("FIELD"),ASUV("%")=0
 D @ASUV("ROUT")
 F ASUV("ACC")=1:1:5,9,10 D
 .S ASUV("POS")=$S(ASUV("ACC")=1:45,ASUV("ACC")=2:57,ASUV("ACC")=3:69,ASUV("ACC")=4:81,ASUV("ACC")=5:93,1:105)
 .I ASUV("ACC")=10 D
 ..I ASUV("%") D
 ...W ?117,$J($FN(ASUC(ASUV("FIELD"),"%"),",",1),10)_" %"
 ..E  D
 ...W ?117,$J(ASUC(ASUV("FIELD")),10)
 .E  D
 ..I ASUV("%") D
 ...W ?ASUV("POS"),$J($FN(ASUC(ASUV("FIELD"),"%",ASUV("ACC")),",",1),10)_" %"
 ..E  D
 ...W ?ASUV("POS"),$J(ASUC(ASUV("FIELD"),0,ASUV("ACC")),10)
 Q
PRVALUE ;
 S ASUV("ROUT")="PR"_ASUV("FIELD"),ASUV("%")=0
 D @ASUV("ROUT")
 F ASUV("ACC")=1:1:5,9,10 D
 .S ASUV("POS")=$S(ASUV("ACC")=1:45,ASUV("ACC")=2:57,ASUV("ACC")=3:69,ASUV("ACC")=4:81,ASUV("ACC")=5:93,1:105)
 .I ASUV("ACC")=10 D
 ..W ?117,$J($FN(ASUC(ASUV("FIELD")),",",0),10)
 .E  D
 ..W ?ASUV("POS"),$J($FN(ASUC(ASUV("FIELD"),0,ASUV("ACC")),",",0),10)
 Q
PR3 ;
PR6 ;
PR8 ;
PR10 ;
PR12 ;
PR14 ;
PR20 ;
PR22 ;
PR25 ;
PR24 ;
 W !?31,"YEAR-TO-DATE" Q
PR7 ;
 W !!?1,"SCHEDULED STOCK ISSUE REQUEST" G PR0
PR11 ;
 W !!?1,"UNSCHEDULED STOCK ISSUE REQUEST" G PR0
PR1 ;
 W !!?1,"TOTAL STOCK ISSUE REQUEST" G PR0
PR19 ;
 W !!?1,"DIRECT ISSUE"
PR0 ;
 W !?11,"NUMBER LINE ITEMS -CURRENT MONTH" Q
PR9 ;
PR13 ;
PR21 ;
PR23 ;
 W !!?11,"NUMBER DOCUMENTS  -CURRENT MONTH" Q
PR15 ;
 W !!?1,"NUMBER LINE ITEMS WITH ZERO ISSUE YTD" Q
PR16 ;
 W !!?1,"NUMBER LINE ITEMS WITH PARTIAL ISSUE YTD" Q
PR17 ;
 W !!?1,"NUMBER LINE ITEMS BACK ORDERED YTD" Q
PR18 ;
 W !!?1,"NUMBER LINE ITEMS WITH QUANTITY ADJUSTED YTD" Q
PR26 ;
 W !!?1,"NUMBER LINE ITEMS PENDING B/O RELEASE" Q
PR5 ;
 W !!?1,"VALUE OF DIRECT ISSUES      -CURRENT MONTH" Q
PR2 ;
 W !!?1,"VALUE OF STOCK ISSUES       -CURRENT MONTH" Q
PCT ;
 W !?31,"PERCENT" Q
P3 ;EP ;
 F ASUV("ACC")=1:1:5,9 D
 .S ASUC(1,0,ASUV("ACC"))=ASUC(7,0,ASUV("ACC"))+ASUC(11,0,ASUV("ACC"))
 .S ASUC(23,0,ASUV("ACC"))=ASUC(9,0,ASUV("ACC"))+ASUC(13,0,ASUV("ACC"))
 .S ASUC(24,0,ASUV("ACC"))=ASUC(10,0,ASUV("ACC"))+ASUC(14,0,ASUV("ACC"))
 .S ASUC(24)=ASUC(24)+ASUC(24,0,ASUV("ACC"))
 .S ASURZX(1)=ASUC(24,0,ASUV("ACC")),ASURZX(2)=ASUC(10,0,ASUV("ACC")) D CALC S ASUC(10,"%",ASUV("ACC"))=ASURZX(3)
 .S ASURZX(1)=ASUC(24,0,ASUV("ACC")),ASURZX(2)=ASUC(14,0,ASUV("ACC")) D CALC S ASUC(14,"%",ASUV("ACC"))=ASURZX(3)
 .S ASUC(25,0,ASUV("ACC"))=ASUC(8,0,ASUV("ACC"))+ASUC(12,0,ASUV("ACC"))
 .S ASUC(25)=ASUC(25)+ASUC(25,0,ASUV("ACC"))
 .S ASURZX(1)=ASUC(25,0,ASUV("ACC")),ASURZX(2)=ASUC(8,0,ASUV("ACC")) D CALC S ASUC(8,"%",ASUV("ACC"))=ASURZX(3)
 .S ASURZX(1)=ASUC(25,0,ASUV("ACC")),ASURZX(2)=ASUC(12,0,ASUV("ACC")) D CALC S ASUC(12,"%",ASUV("ACC"))=ASURZX(3)
 .S ASURZX(1)=ASUC(25,0,ASUV("ACC")),ASURZX(2)=ASUC(15,0,ASUV("ACC")) D CALC S ASUC(15,"%",ASUV("ACC"))=ASURZX(3)
 .S ASURZX(1)=ASUC(25,0,ASUV("ACC")),ASURZX(2)=ASUC(16,0,ASUV("ACC")) D CALC S ASUC(16,"%",ASUV("ACC"))=ASURZX(3)
 .S ASURZX(1)=ASUC(25,0,ASUV("ACC")),ASURZX(2)=ASUC(17,0,ASUV("ACC")) D CALC S ASUC(17,"%",ASUV("ACC"))=ASURZX(3)
 .S ASURZX(1)=ASUC(25,0,ASUV("ACC")),ASURZX(2)=ASUC(18,0,ASUV("ACC")) D CALC S ASUC(18,"%",ASUV("ACC"))=ASURZX(3)
 F ASUV("FIELD")=1:1:3,5:1:23 D
 .F ASUV("ACC")=1:1:5,9 D
 ..S ASUC(ASUV("FIELD"))=ASUC(ASUV("FIELD"))+ASUC(ASUV("FIELD"),0,ASUV("ACC"))
 S ASURZX(1)=ASUC(24),ASURZX(2)=ASUC(10) D CALC S ASUC(10,"%")=ASURZX(3)
 S ASURZX(1)=ASUC(24),ASURZX(2)=ASUC(14) D CALC S ASUC(14,"%")=ASURZX(3)
 S ASURZX(1)=ASUC(25),ASURZX(2)=ASUC(16) D CALC S ASUC(16,"%")=ASURZX(3)
 S ASURZX(1)=ASUC(25),ASURZX(2)=ASUC(18) D CALC S ASUC(18,"%")=ASURZX(3)
 S ASURZX(1)=ASUC(25),ASURZX(2)=ASUC(8) D CALC S ASUC(8,"%")=ASURZX(3)
 S ASURZX(1)=ASUC(25),ASURZX(2)=ASUC(12) D CALC S ASUC(12,"%")=ASURZX(3)
 S ASURZX(1)=ASUC(25),ASURZX(2)=ASUC(15) D CALC S ASUC(15,"%")=ASURZX(3)
 S ASURZX(1)=ASUC(25),ASURZX(2)=ASUC(17) D CALC S ASUC(17,"%")=ASURZX(3)
 Q
CALC ;
 I ASURZX(1)'>0 S ASURZX(3)=0 Q
 S ASURZX(3)=(ASURZX(2)/ASURZX(1))*100
 Q