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

ASUV5FS.m

Go to the documentation of this file.
ASUV5FS ; IHS/ITSC/LMH -RPT FACT SHEET ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine creates the Physical Inventory Fact Sheet Report
 D ASUV5FS0
PRINT ;
 D:'$D(DT) ^XBKVAR S %H=$H D YX^%DTC S ASUK("RUN","DT")=$P(Y,"@") K X,Y,%H
 D:'$D(IO(0)) HOME^%ZIS
 D CLS^ASUUHDG
 S %DT="T",X="NOW" D ^%DT S ASUV("DT")=Y
 I '$D(IO) D HOME^%ZIS
 I '$D(DUZ(2)) W !,"Report must be run from Kernel option" G XIT0
 I '$D(ASUL(1,"AR","AP")) D SETAREA^ASULARST
 S ZTRTN="ASUV5FS4^ASUV5FS",ZTDESC="SAMS INVENTORY FACT SHEET LIST" D O^ASUUZIS
 I POP S IOP=$I D ^%ZIS G XIT0
 I ASUK(ASUK("PTR"),"Q") G XIT0
 S ASUMV("E#","ASA")=ASUL(2,"STA","E#")
 F  S ASUMV("E#","ASA")=$O(^ASUV("FS",ASUMV("E#","ASA"))) Q:ASUMV("E#","ASA")']""  D ASUV5FS4
XIT0 ;
 K ASUC,ASUR,ASUMV,ASUV
 K DTOUT,DUOUT,DIR,DIC,X,Y,X1
 D XK^ASUMXDIO
 K IOP,POP,ZTDESC,ZTRTN,ZTSK
 ;I $D(ASUK("PTR")) K ASUK(ASUK("PTR")),ASUK("PTR"),ASUK("PTR-Q") ;CHG 3-15-95 CSC
 D C^ASUUZIS
 Q
ASUV5FS0 ;
 K ^ASUV("FS")
 S ASUMV("E#","ASA")=ASUL(2,"STA","E#")
 F  S ASUMV("E#","ASA")=$O(^ASUMV(ASUMV("E#","ASA"))) Q:ASUMV("E#","ASA")'?1N.N  D
 .D ACCOUNT^ASUV9IMR
 .Q:ASUMV("MODE")'=4
 .S ASUMV("E#","SLC")=0
 .F  S ASUMV("E#","SLC")=$O(^ASUMV(ASUMV("E#","ASA"),1,ASUMV("E#","SLC"))) Q:ASUMV("E#","SLC")'?1N.N  D
 ..D STORLOC^ASUV9IMR
 ..S ASUMV("E#","INDX")=0
 ..F  S ASUMV("E#","INDX")=$O(^ASUMV(ASUMV("E#","ASA"),1,ASUMV("E#","SLC"),1,ASUMV("E#","INDX"))) Q:ASUMV("E#","INDX")'?1N.N  D
 ...D INDEX^ASUV9IMR
 ...Q:ASUMV("IDX")["*"  ;MASTER HAS BEEN DELETED
 ...S ASUV("CNT","LST")=$S(ASUMV("CNT","2ND"):ASUMV("CNT","2ND"),1:ASUMV("CNT","1ST"))
 ...S ASUV("ADJUST VAL")=$FN((ASUMV("QTY","DIF")*ASUMV("U/C")),"",2)
 ...S ASUV("VALMST")=$FN((ASUMV("QTY","STAM")*ASUMV("U/C")),"",2)
 ...S ASUV("VAL","1ST")=$FN(((ASUMV("CNT","1ST")-ASUMV("QTY","STAM"))*ASUMV("U/C")),"",2)
 ...S ASUV("VAL","2ND")=$FN(((ASUMV("CNT","2ND")-ASUMV("QTY","STAM"))*ASUMV("U/C")),"",2)
 ...I '$D(ASUA(ASUMV("E#","ASA"),0)) D
 ....F ASUMV("E#","TYPE")=0:1:8 S ASUA(ASUMV("E#","ASA"),ASUMV("E#","TYPE"))="0^0^0^0" I ASUMV("E#","TYPE")>2 D
 .....F ASUU(12)=1:1:2 S ASUA(ASUMV("E#","ASA"),ASUMV("E#","TYPE"),ASUU(12))="0^0^0^0"
 ...S $P(ASUA(ASUMV("E#","ASA"),0),U)=$P(ASUA(ASUMV("E#","ASA"),0),U)+1
 ...S $P(ASUA(ASUMV("E#","ASA"),0),U,2)=$P(ASUA(ASUMV("E#","ASA"),0),U,2)+ASUV("VALMST")
 ...I ASUMV("QTY","STAM")=0,ASUMV("CNT","1ST")=0,ASUMV("CNT","2ND")>0 D ASUV5FS7 Q
 ...I ASUMV("CNT","1ST")=ASUMV("QTY","STAM") D
 ....S $P(ASUA(ASUMV("E#","ASA"),1),U)=$P(ASUA(ASUMV("E#","ASA"),1),U)+1
 ....S $P(ASUA(ASUMV("E#","ASA"),1),U,2)=$P(ASUA(ASUMV("E#","ASA"),1),U,2)+ASUV("VALMST")
 ...E  D
 ....D ASUV5FS7
 .D ASUV5FS6
 K ASUU(12),ASUMV,ASUV
 Q
ASUV5FS1 ;
HEADING ;
 D CLS^ASUUHDG S ASUC("PG")=ASUC("PG")+1,ASUC("LN")=6
 W "REPORT 37D INVENTORY FACT SHEET",?40,"DATE: ",ASUK("RUN","DT"),?70," PAGE: ",ASUC("PG")
 W !,"AREA: ",ASUL(1,"AR","NM")
 W !,"STAT: ",ASUL(2,"STA","NM")
 W !,"ACCOUNT : ",ASUMV("ACC")," ",ASUL(9,"ACC","NM"),?25,"VOUCHER NO: ",ASUV("VOU"),?50,"INV. DATE: ",ASUV("DTPRNT")
 D SEPERATE
 Q
SEPERATE ;
 W !,"_______________________________________________________________________________",!
 Q
FOOTING ;
 S ASUC("LN")=0
 Q
ASUV5FS2 ;
 S ASUV(ASUV("NOS"),"LI")=$P(ASUV(0),U)
 S ASUV(ASUV("NOS"),"VAL")=$P(ASUV(0),U,2)
 S ASUV(ASUV("NOS"),"LITM%")=$P(ASUV(0),U,3)
 S ASUV(ASUV("NOS"),"VAL%")=$P(ASUV(0),U,4)
 S ASUV(ASUV("NOS"),"VAL")=$FN(ASUV(ASUV("NOS"),"VAL"),"",2)
 Q
ASUV5FS4 ;
 D U^ASUUZIS
 S (ASUC("PG"),ASUC("LN"))=0
 D ACCOUNT^ASUV9IMR
 S ASUV("VOU")=$E(ASUMV("VOU"),1,2)_"-"_$E(ASUMV("VOU"),3,4)_"-"_$E(ASUMV("VOU"),5,8)
 S Y=ASUMV("INVBEG") X ^DD("DD") S ASUV("DTPRNT")=Y
 D:ASUC("LN")<1 ASUV5FS1
 F ASUMV("E#","TYPE")=0:1:8 D
 .D:ASUC("LN")>59 FOOTING,ASUV5FS1
 .S ASUV(0)=^ASUV("FS",ASUMV("E#","ASA"),ASUMV("E#","TYPE"))
 .S ASUV("NOS")="NET" D ASUV5FS2
 .S ASUV("LINE HEADING")=$P($T(TYPES+(ASUMV("E#","TYPE")+1)),";",3)
 .W !?5,ASUV("LINE HEADING")
 .S ASUC("LN")=ASUC("LN")+1
 .I ASUMV("E#","TYPE")>3 D
 ..S ASUV(0)=^ASUV("FS",ASUMV("E#","ASA"),ASUMV("E#","TYPE"),1)
 ..S ASUV("NOS")="OVR" D ASUV5FS2
 ..W !?10,"OVERAGES",?20,"NO. LI: ",?32,$J(ASUV("OVR","LI"),6),?40,"VALUE: ",?50,$J(ASUV("OVR","VAL"),10)
 ..S ASUC("LN")=ASUC("LN")+1 Q:ASUMV("E#","TYPE")=1
 ..W !?10,"PERCENT OF ",$S(ASUMV("E#","TYPE")=3:"RECOUNTS",1:"TOT"),": ",?31,$J(ASUV("OVR","LITM%"),8),?53,$J(ASUV("OVR","VAL%"),8)
 ..S ASUV(0)=^ASUV("FS",ASUMV("E#","ASA"),ASUMV("E#","TYPE"),2)
 ..S ASUV("NOS")="SHT" D ASUV5FS2
 ..W !?10,"SHORTAGES",?20,"NO. LI: ",?32,$J(ASUV("SHT","LI"),6),?40,"VALUE: ",?50,$J(ASUV("SHT","VAL"),10)
 ..W !?10,"PERCENT OF ",$S(ASUMV("E#","TYPE")=3:"RECOUNTS",1:"TOT"),": ",?31,$J(ASUV("SHT","LITM%"),8),?53,$J(ASUV("SHT","VAL%"),8)
 ..W !?10,"NET PERCENTAGE: ",?31,$J(ASUV("NET","LITM%"),8),?53,$J(ASUV("NET","VAL%"),8)
 ..S ASUC("LN")=ASUC("LN")+5
 .E  D
 ..W !?20,"NO. LI: ",?32,$J(ASUV("NET","LI"),6),?40,"VALUE: ",?50,$J($FN(ASUV("NET","VAL"),",",2),10)
 ..S ASUC("LN")=ASUC("LN")+1 Q:ASUMV("E#","TYPE")=0
 ..W !?10,"PERCENT OF ",$S(ASUMV("E#","TYPE")=3:"RECOUNTS",1:"TOT"),": ",?31,$J(ASUV("NET","LITM%"),8),?53,$J(ASUV("NET","VAL%"),8)
 ..S ASUC("LN")=ASUC("LN")+2
 .W !
 .S ASUC("LN")=ASUC("LN")+1
 D:ASUC("LN")>7 FOOTING
 D CLS^ASUUHDG
 Q
TYPES ;;COUNT TYPES
 ;;1. BEGINNING BALANCES
 ;;2. FIRST COUNT AGREEMENTS
 ;;3. INVENTORY RECOUNTS
 ;;4. SECOND COUNT AGREEMENTS WITH FIRST COUNT
 ;;5. ITEMS WITH QUANTITY DIFFERENCE OF ONE
 ;;6. ITEMS WITH ADJUSTMENT VALUE UNDER $25.00
 ;;7. INITIAL OVERAGES/SHORTAGES TO BE RESEARCHED
 ;;8. OVERAGES/SHORTAGES AFTER RESEARCH
 ;;9. TOTAL INVENTORY ADJUSTMENTS
ASUV5FS5 ;
 S ASUV("VAL")=ASUV("VAL","LST"),ASUU(11)=1
 I ASUV("DIFF")<0 S ASUV("VAL")=(ASUV("VAL")*-1),ASUU(11)=2
 S $P(ASUA(ASUMV("E#","ASA"),ASUV("TYP"),ASUU(11)),U)=$P(ASUA(ASUMV("E#","ASA"),ASUV("TYP"),ASUU(11)),U)+1
 S $P(ASUA(ASUMV("E#","ASA"),ASUV("TYP"),ASUU(11)),U,2)=$P(ASUA(ASUMV("E#","ASA"),ASUV("TYP"),ASUU(11)),U,2)+ASUV("VAL")
 S $P(ASUA(ASUMV("E#","ASA"),ASUV("TYP")),U)=$P(ASUA(ASUMV("E#","ASA"),ASUV("TYP")),U)+1
 S $P(ASUA(ASUMV("E#","ASA"),ASUV("TYP")),U,2)=$P(ASUA(ASUMV("E#","ASA"),ASUV("TYP")),U,2)+ASUV("VAL")
 Q
ASUV5FS6 ;SET % IN EXTRACT
 S ASUV("STA")=""
 F  S ASUV("STA")=$O(ASUA(ASUV("STA"))) Q:ASUV("STA")'?1N.N  D
 .D STA^ASULARST(ASUV("STA")) S ASUV("ASA")=""
 .F  S ASUV("ASA")=$O(ASUA(ASUV("ASA"))) Q:ASUV("ASA")'?1N.N  D
 ..S ASUV("TYP")=""
 ..F  S ASUV("TYP")=$O(ASUA(ASUV("ASA"),ASUV("TYP"))) Q:ASUV("TYP")'?1N.N  D WRITE
 K ASUV("TYS")
 Q
WRITE ;
 S ASUV("TYS")=$S(ASUV("TYP")=3:2,1:0)
 I $P(ASUA(ASUV("ASA"),ASUV("TYS")),U)=0 S X=0 G SET11
 I $P(ASUA(ASUV("ASA"),ASUV("TYP")),U)=0 S X=0 G SET11
 S X=$P(ASUA(ASUV("ASA"),ASUV("TYP")),U)/$P(ASUA(ASUV("ASA"),ASUV("TYS")),U)
SET11 ;
 S X=$FN((X*100),"",2)_"%"
 S $P(ASUA(ASUV("ASA"),ASUV("TYP")),U,3)=X
 I $P(ASUA(ASUV("ASA"),ASUV("TYS")),U,2)=0 S X=0 G SET12
 I $P(ASUA(ASUV("ASA"),ASUV("TYP")),U,2)=0 S X=0 G SET12
 S X=$P(ASUA(ASUV("ASA"),ASUV("TYP")),U,2)/$P(ASUA(ASUV("ASA"),ASUV("TYS")),U,2)
SET12 ;
 S X=$FN((X*100),"",2)_"%"
 S $P(ASUA(ASUV("ASA"),ASUV("TYP")),U,4)=X
 S ^ASUV("FS",ASUV("ASA"),ASUV("TYP"))=ASUA(ASUV("ASA"),ASUV("TYP"))
 Q:ASUV("TYP")<4
 I $P(ASUA(ASUV("ASA"),0),U)=0 S X=0 G SET21
 I $P(ASUA(ASUV("ASA"),ASUV("TYP"),1),U)=0 S X=0 G SET21
 S X=$P(ASUA(ASUV("ASA"),ASUV("TYP"),1),U)/$P(ASUA(ASUV("ASA"),0),U)
SET21 ;
 S X=$FN((X*100),"",2)_"%"
 S $P(ASUA(ASUV("ASA"),ASUV("TYP"),1),U,3)=X
 I $P(ASUA(ASUV("ASA"),0),U,2)=0 S X=0 G SET22
 I $P(ASUA(ASUV("ASA"),ASUV("TYP"),1),U,2)=0 S X=0 G SET22
 S X=$P(ASUA(ASUV("ASA"),ASUV("TYP"),1),U,2)/$P(ASUA(ASUV("ASA"),0),U,2)
SET22 ;
 S X=$FN((X*100),"",2)_"%"
 S $P(ASUA(ASUV("ASA"),ASUV("TYP"),1),U,4)=X
 S ^ASUV("FS",ASUV("ASA"),ASUV("TYP"),1)=ASUA(ASUV("ASA"),ASUV("TYP"),1)
 I $P(ASUA(ASUV("ASA"),0),U)=0 S X=0 G SET31
 I $P(ASUA(ASUV("ASA"),ASUV("TYP"),2),U)=0 S X=0 G SET31
 S X=$P(ASUA(ASUV("ASA"),ASUV("TYP"),2),U)/$P(ASUA(ASUV("ASA"),0),U)
SET31 ;
 S X=$FN((X*100),"",2)_"%"
 S $P(ASUA(ASUV("ASA"),ASUV("TYP"),2),U,3)=X
 I $P(ASUA(ASUV("ASA"),0),U,2)=0 S X=0 G SET32
 I $P(ASUA(ASUV("ASA"),ASUV("TYP"),2),U,2)=0 S X=0 G SET32
 S X=$P(ASUA(ASUV("ASA"),ASUV("TYP"),2),U,2)/$P(ASUA(ASUV("ASA"),0),U,2)
SET32 ;
 S X=$FN((X*100),"",2)_"%"
 S $P(ASUA(ASUV("ASA"),ASUV("TYP"),2),U,4)=X
 S ^ASUV("FS",ASUV("ASA"),ASUV("TYP"),2)=ASUA(ASUV("ASA"),ASUV("TYP"),2)
 Q
ASUV5FS7 ;
 S $P(ASUA(ASUMV("E#","ASA"),2),U)=$P(ASUA(ASUMV("E#","ASA"),2),U)+1
 S $P(ASUA(ASUMV("E#","ASA"),2),U,2)=$P(ASUA(ASUMV("E#","ASA"),2),U,2)+ASUV("VALMST")
 I ASUMV("CNT","1ST")=ASUMV("CNT","2ND") D
 .S $P(ASUA(ASUMV("E#","ASA"),3),U)=$P(ASUA(ASUMV("E#","ASA"),3),U)+1
 .S $P(ASUA(ASUMV("E#","ASA"),3),U,2)=$P(ASUA(ASUMV("E#","ASA"),3),U,2)+ASUV("VALMST")
 I ASUMV("CNT","2ND")'=ASUMV("QTY","STAM") D
 .S ASUV("VAL","LST")=$S(ASUMV("CNT","2ND")]"":ASUV("VAL","2ND"),1:ASUV("VAL","1ST"))
 .S ASUV("ADJQTY")=ASUMV("QTY","STAM")-ASUV("CNT","LST")
 .I ASUV("ADJQTY")=1!(ASUV("ADJQTY")=-1) D
 ..S ASUV("DIFF")=ASUMV("QTY","DIF"),ASUV("TYP")=4 D ASUV5FS5
 .E  D
 ..S X=ASUMV("U/C")*(ASUV("CNT","LST")-ASUMV("QTY","STAM")) S:X<0 X=X*-1
 ..I X>25 D
 ...S ASUV("DIFF")=ASUV("CNT","LST")-ASUMV("QTY","STAM"),ASUV("TYP")=6 D ASUV5FS5
 ...I ASUMV("QTY","DIF")'=0 S ASUV("DIFF")=ASUMV("QTY","DIF") F ASUV("TYP")=7,8 D ASUV5FS5
 ..E  D
 ...S ASUV("DIFF")=ASUMV("QTY","DIF"),ASUV("TYP")=5 D ASUV5FS5
 ..I ASUMV("QTY","DIF")'=0 S ASUV("DIFF")=ASUMV("QTY","DIF"),ASUV("TYP")=8 D ASUV5FS5
 Q