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

ENXIP60.m

Go to the documentation of this file.
ENXIP60 ;WCIOFO/SAB- PATCH INSTALL ROUTINE ;12/17/1998
 ;;7.0;ENGINEERING;**60**;Aug 17, 1993
 Q
 ;
PS ;Post Install Entry Point
 N ENX
 ;
 ; only perform during 1st install
 I $$PATCH^XPDUTL("EN*7.0*60") D BMES^XPDUTL("  Skipping post install since patch was previously installed.") Q
 ;
 ; create KIDS checkpoints with call backs
 F ENX="FRDOC" D
 . S Y=$$NEWCP^XPDUTL(ENX,ENX_"^ENXIP60")
 . I 'Y D BMES^XPDUTL("ERROR Creating "_ENX_" Checkpoint.")
 Q
 ;
FRDOC ; Transmit FR Documents for all assets currently reported to FAP
 ;   so XAREA (CMR) value will be populated in FAP
 N ENAMT,ENC,ENDA,ENFUND,ENSGL,ENSTA,ENT,ENX
 ;
 D BMES^XPDUTL("  Generating FR Documents to update FAP with CMR values...")
 ;
 ; estimate count of equipment to examine
 S ENC("TOT")=$P($G(^ENG(6915.2,0)),U,4)-$P($G(^ENG(6915.5,0)),U,4)
 I ENC("TOT")<1 S ENC("TOT")=1
 S ENC("EQ")=0 ; count of evaluated equipment
 S XPDIDTOT=ENC("TOT") ; set total for status bar
 S ENC("UPD")=5  ; initial % required to update status bar
 ;
 ; loop thru equipment in FA DOCUMENT LOG file
 S ENDA=0 F  S ENDA=$O(^ENG(6915.2,"B",ENDA)) Q:'ENDA  D
 . Q:+$$CHKFA^ENFAUTL(ENDA)'>0  ; not currently reported to FAP
 . ;
 . S ENC("EQ")=ENC("EQ")+1
 . S ENC("%")=ENC("EQ")*100/ENC("TOT") ; calculate % complete
 . ; check if status bar should be updated
 . I ENC("%")>ENC("UPD"),ENC("%")<100 D
 . . D UPDATE^XPDID(ENC("EQ")) ; update status bar
 . . S ENC("UPD")=ENC("UPD")+5 ; increase update criteria by 5%
 . ;
 . ; generate an FR Document
 . S ENX=$$XFR(ENDA)
 . I 'ENX D  Q
 . . N ENI,ENX
 . . D MES^XPDUTL("ERROR: Couldn't create FR Doc. for ENTRY # "_ENDA)
 . . Q:'$D(^TMP($J,"BAD",ENDA))  ; don't know reasons
 . . ; List Problems with Equipment/Document
 . . ; Input
 . . ;   ENDA - equipment entry #
 . . ;   ^TMP($J,"BAD",ENDA) - number of problems
 . . ;   ^TMP($J,"BAD",ENDA,seqn #) - description of a problem
 . . F ENI=1:1:^TMP($J,"BAD",ENDA) D
 . . . D MES^XPDUTL("    "_^TMP($J,"BAD",ENDA,ENI))
 . . K ^TMP($J,"BAD",ENDA)
 . ;
 . ; update FR Document counter (append space to force alpha sort)
 . S ENSTA=$$GET1^DIQ(6914,ENDA_",",60)_" " S:ENSTA=" " ENSTA="UNK"
 . S ENT(ENSTA)=$G(ENT(ENSTA))+1
 ;
 ; report results
 S ENX="  Summary report of FR Documents generated by the patch:"
 D BMES^XPDUTL(ENX)
 S ENX="    Station   Count"
 D BMES^XPDUTL(ENX)
 S ENX="    -------   -----"
 D MES^XPDUTL(ENX)
 S ENT=0
 S ENSTA="" F  S ENSTA=$O(ENT(ENSTA)) Q:ENSTA=""  D
 . S ENX="    "_$$LJ^XLFSTR(ENSTA,10)_$J(ENT(ENSTA),5)
 . D MES^XPDUTL(ENX)
 . S ENT=ENT+ENT(ENSTA)
 S ENX="    =======   ====="
 D MES^XPDUTL(ENX)
 S ENX="    "_$$LJ^XLFSTR("total",10)_$J(ENT,5)
 D MES^XPDUTL(ENX)
 Q
 ;
XFR(ENDA) ; Transmit FR Document
 ; input   ENDA    - equipment entry
 ; returns 1 if success or if failed
 ; output  ^TMP($J,"BAD",equipment entry
 ;           will be defined if the document failed validation
 ;
 N DA,ENBAT,ENDO,ENEQ,ENFA,ENFAP,ENFR,ENX,I
 S ENEQ("DA")=ENDA
 S ENBAT("SILENT")=1
 S ENX=$$CHKFA^ENFAUTL(ENEQ("DA"))
 S ENFA("DA")=$P(ENX,U,4)
 F I=1,2,3,8,9 S ENEQ(I)=$G(^ENG(6914,ENEQ("DA"),I))
 ; create FR document
 S ENDO=1,ENFR("DA")=""
 D ADDFR^ENFAXFR
 D:ENDO
 . ; populate FR Document with existing data from equipment file
 . S ENFAP(100)=$G(^ENG(6915.6,ENFR("DA"),100))
 . S $P(ENFAP(100),U,2)=$P(ENEQ(9),U,7) ; fund (required)
 . S $P(ENFAP(100),U,3)=$P(ENEQ(9),U,8) ; a/o (required)
 . S $P(ENFAP(100),U,5)=$P(ENEQ(9),U,6) ; boc (deleted when blank sent)
 . S $P(ENFAP(100),U,6)=$P(ENEQ(2),U,9) ; cmr (determines cost cr, xarea)
 . S ^ENG(6915.6,ENFR("DA"),100)=ENFAP(100)
 D:ENDO CVTDATA^ENFAXFR
 D:ENDO
 . S ENFAP("DOC")="FR" D ^ENFAVAL
 . I $D(^TMP($J,"BAD",ENEQ("DA"))) S ENDO=0
 I 'ENDO,$G(ENFR("DA"))]"" D
 . S DA=ENFR("DA"),DIK="^ENG(6915.6," D ^DIK K DIK
 D:ENDO UPDATE^ENFAXFR
 I $G(ENFR("DA"))]"" L -^ENG(6915.6,ENFR("DA"))
 Q ENDO
 ;
 ;ENXIP57