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

PRCHITX1.m

Go to the documentation of this file.
  1. PRCHITX1 ;WOIFO/LKG-WRITING ITEM DATA FOR NIF TO DAT FILES ;12/27/04 17:58
  1. ;;5.1;IFCAP;**75**;OCT 20, 2000
  1. ;Per VHA Directive 10-93-142, this routine should not be modified.
  1. START ;Writes .dat file of vendor and item information to host file
  1. D EN^DDIOL("This option writes item information to the .dat file.")
  1. D EN^DDIOL("It is recommended to queue this extract for a time of low user activity.",,"!!")
  1. N %ZIS,ZTRTN,ZTDESC,PRCPHYS
  1. K Y,DIR S DIR(0)="Y",DIR("A")="Include physical inventory count transactions in the analysis",DIR("B")="NO"
  1. S DIR("?",1)="Answer 'YES' if you have a large number of items that have recently been"
  1. S DIR("?",2)="added to your GIP inventory, but have not yet been received or issued."
  1. S DIR("?")="Answer 'NO' to exclude slow moving stock from NIF processing."
  1. D ^DIR K DIR I $D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT) G ITX
  1. S PRCPHYS=$S(Y=1:"Y",1:"N") K Y
  1. S %ZIS="Q",%ZIS("A")="Host File Device: ",%ZIS("B")="PRC_WIDE_HOST_FILE"
  1. D ^%ZIS G:POP ITX
  1. I $D(IO("Q")) D Q
  1. . S ZTRTN="COMPILE^PRCHITX1",ZTDESC="Item Extraction for NIF",ZTSAVE("PRCPHYS")=""
  1. . D ^%ZTLOAD,HOME^%ZIS
  1. . D EN^DDIOL("Task #"_ZTSK) K IO("Q"),ZTSK
  1. COMPILE ;invoke the item and vendor compile
  1. N X,Y,PRCSTA,PRCV,PRCW,PRCX,PRCY,PRCZ
  1. D IN^PRCHITX
  1. S PRCSTA=$$GETSTATN^PRCHITX
  1. U IO
  1. VENDOR ;Write vendor data
  1. S PRCX=""
  1. F S PRCX=$O(^TMP($J,"V",PRCX)) Q:PRCX="" D
  1. . S PRCY=$G(^TMP($J,"V",PRCX)) Q:PRCY=""
  1. . S PRCZ="6^9^"_PRCSTA_"^"_PRCX_"^"_$P(PRCY,"^")_"^"_$P(PRCY,"^",4)_"^"_$P(PRCY,"^",3)_"^"_$P(PRCY,"^",2)_"^"_$P(PRCY,"^",5)
  1. . W PRCZ,!
  1. ITEM ;Write item data
  1. S PRCX=""
  1. F S PRCX=$O(^TMP($J,"I",PRCX)) Q:PRCX="" D
  1. . S PRCY=$G(^TMP($J,"I",PRCX,0)) Q:PRCY=""
  1. . S PRCZ="6^0^"_PRCSTA_"^"_$P(PRCY,"^",8)_"^"_PRCX_"^"_$$GETSDESC^PRCHITX(PRCX)_"^"
  1. . W PRCZ
  1. . S X=0,Y=1
  1. . F S X=$O(^PRC(441,PRCX,1,X)) Q:X="" D
  1. . . S PRCZ=$G(^PRC(441,PRCX,1,X,0)),PRCZ=$TR(PRCZ,"^") Q:PRCZ=""
  1. . . W:Y>1 " " W PRCZ S Y=Y+1
  1. . S PRCZ="^^"_$P(PRCY,"^",6)_"^"_$P(PRCY,"^",4)_"^" W PRCZ
  1. . S PRCW=$G(^TMP($J,"I",PRCX,1)),PRCV=$P(PRCW,"^")
  1. . S PRCZ=$P(PRCY,"^",5)_"^^"_PRCV_"^^^^"_$P(PRCW,"^",4)_"^0^"_$P(PRCW,"^",2)_"^"_$P(PRCW,"^",3)_"^"
  1. . W PRCZ
  1. . S PRCZ=$P(PRCY,"^",3)_"^"_$P(PRCW,"^",6)_"^^"_$P(PRCW,"^",5)
  1. . W PRCZ,!
  1. D ^%ZISC
  1. S:$D(ZTQUEUED) ZTREQ="@"
  1. D:'$D(ZTQUEUED) EN^DDIOL("<DONE>")
  1. K PRCW,PRCX,PRCY,PRCZ S PRCW=$$KSP^XUPARAM("WHERE")
  1. K XMZ,XMMG,XMDUZ,XMY,XMSUB,XMTEXT
  1. S PRCX(1)="Record counts for NIF Item Extract File from Station "_PRCSTA
  1. S PRCX(2)=" "
  1. S PRCX(3)=" Number of items: "_$G(^TMP($J,"I"),0)
  1. S PRCX(4)=" Number of vendors: "_$G(^TMP($J,"V"),0)
  1. S PRCX(5)=" ",PRCX(6)="Physical count transactions were "_$S(PRCPHYS="Y":"",1:"not ")_"included in the analysis."
  1. X ^%ZOSF("UCI") S PRCY=^%ZOSF("PROD") S:PRCY'["," Y=$P(Y,",")
  1. I Y=PRCY,PRCW'["FO-",PRCW'["ISC-" S XMY("prchitem@domain.ext")=""
  1. I $G(DUZ)>0,$D(^VA(200,DUZ)) D
  1. . N PRCNAME
  1. . S XMY(DUZ)=""
  1. . S PRCNAME("FILE")=200,PRCNAME("IENS")=DUZ_",",PRCNAME("FIELD")=.01
  1. . S PRCX(7)=" ",PRCX(8)="The extraction process was run by "_$$NAMEFMT^XLFNAME(.PRCNAME,"G","M")_"."
  1. S XMSUB="NIF Item Extract Statistics for Station "_PRCSTA
  1. S XMDUZ="NIF ITEM EXTRACTOR"
  1. S XMTEXT="PRCX(" D ^XMD
  1. I $G(XMZ),'$D(ZTQUEUED) D EN^DDIOL("MailMan message #"_$G(XMZ)_" with extract statistics was sent.")
  1. K XMZ,XMMG,XMDUZ,XMY,XMSUB,XMTEXT,PRCPHYS
  1. ITX ;EXIT
  1. K POP,^TMP($J),DTOUT,DUOUT,DIRUT,DIROUT,Y
  1. Q