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

ENX1IPS.m

Go to the documentation of this file.
  1. ENX1IPS ;WIRMFO/SAB- POST-INIT ;10/29/97
  1. ;;7.0;ENGINEERING;**46**;Aug 17, 1993
  1. ;
  1. ; only do remaining steps during 1st install
  1. I $$PATCH^XPDUTL("EN*7.0*46") D BMES^XPDUTL(" Skipping Equipment updates step since patch was previously installed.") Q
  1. ;
  1. N ENAMT,ENDA,ENC,ENCSN,ENFUND,ENFUNDN,ENFUNDNI,ENGRP,ENSGL,ENSTA,ENT,ENX
  1. ;
  1. D BMES^XPDUTL(" Examining Equipment Inventory file...")
  1. K ^TMP($J)
  1. S ENDA=0 F S ENDA=$O(^ENG(6914,ENDA)) Q:'ENDA D
  1. . Q:+$$CHKFA^ENFAUTL(ENDA)'>0 ; ignore equipment not report to FAP
  1. . S ENSTA=$$GET1^DIQ(6914,ENDA_",",60)
  1. . S ENSGL=$$GET1^DIQ(6914,ENDA_",",38)
  1. . S ENFUND=$$GET1^DIQ(6914,ENDA_",",62)
  1. . I ENSTA=""!(ENSGL="")!(ENFUND="") D Q
  1. . . S ENX=" ERROR: EQUIP. # "_ENDA_" is missing data (station, fund, or SGL)."
  1. . . D MES^XPDUTL(ENX)
  1. . I "1754"=ENSGL S ^TMP($J,"EN1754",ENSTA,ENFUND,ENDA)="" D
  1. . . ; check if ADPE
  1. . . S ENCSN=$$GET1^DIQ(6914,ENDA_",",18) Q:ENCSN=""
  1. . . S ENGRP=$$GROUP^ENFAVAL(ENCSN)
  1. . . S:"^7000^7020^7021^7025^7435^"[(U_ENGRP_U) ^TMP($J,"ENADP",ENDA)=""
  1. . I "^8129G^4138^6019^5014A1^"[(U_ENFUND_U) S:ENSGL="1754" ENSGL="1750" S ^TMP($J,"ENDF",ENSTA,ENFUND,ENSGL,ENDA)=""
  1. ;
  1. D BMES^XPDUTL(" Moving Trust Equipment from SGL 1754 to SGL 1750...")
  1. D:'$D(^TMP($J,"EN1754")) MES^XPDUTL(" None found. No action taken.")
  1. ; init grand totals
  1. K ENC,ENT S (ENC,ENT)=0
  1. ; loop thru stations in TMP
  1. S ENSTA="" F S ENSTA=$O(^TMP($J,"EN1754",ENSTA)) Q:ENSTA="" D
  1. . D MES^XPDUTL(" For Station "_ENSTA)
  1. . ; init station subtotals
  1. . S (ENC(ENSTA),ENT(ENSTA))=0
  1. . ; loop thru funds in station
  1. . S ENFUND="" F S ENFUND=$O(^TMP($J,"EN1754",ENSTA,ENFUND)) Q:ENFUND="" D
  1. . . ; init fund subtotals
  1. . . S (ENC(ENSTA,ENFUND),ENT(ENSTA,ENFUND))=0
  1. . . ; loop thru equipment in fund
  1. . . S ENDA=0 F S ENDA=$O(^TMP($J,"EN1754",ENSTA,ENFUND,ENDA)) Q:'ENDA D
  1. . . . ; move equipment
  1. . . . S ENX=$$XSGL^ENX1IPS1(ENDA)
  1. . . . I 'ENX D MES^XPDUTL("ERROR: Couldn't create the FAP Documents.")
  1. . . . S ENAMT=$P($G(^ENG(6914,ENDA,2)),U,3)
  1. . . . ; update fund totals
  1. . . . S ENC(ENSTA,ENFUND)=ENC(ENSTA,ENFUND)+1
  1. . . . S ENT(ENSTA,ENFUND)=ENT(ENSTA,ENFUND)+ENAMT
  1. . . . ; report action
  1. . . . S ENX=" Equip #: "_$$LJ^XLFSTR(ENDA,10)
  1. . . . S ENX=ENX_" Fund: "_$$LJ^XLFSTR(ENFUND,6)
  1. . . . S ENX=ENX_" Value: "_$J("$"_$FN(ENAMT,",",2),16)
  1. . . . D MES^XPDUTL(ENX)
  1. . . ; report fund subtotal
  1. . . S ENX=" Fund "_$$CJ^XLFSTR(ENFUND,6)_" Subtotal "
  1. . . S ENX=ENX_" Count: "_$J(ENC(ENSTA,ENFUND),3,0)
  1. . . S ENX=ENX_" Value: "_$J("$"_$FN(ENT(ENSTA,ENFUND),",",2),16)
  1. . . D MES^XPDUTL(ENX)
  1. . . ; update station subtotals
  1. . . S ENC(ENSTA)=ENC(ENSTA)+ENC(ENSTA,ENFUND)
  1. . . S ENT(ENSTA)=ENT(ENSTA)+ENT(ENSTA,ENFUND)
  1. . ; report station subtotal
  1. . S ENX=" Station "_$$CJ^XLFSTR(ENSTA,5)_" Subtotal "
  1. . S ENX=ENX_" Count: "_$J(ENC(ENSTA),3,0)
  1. . S ENX=ENX_" Value: "_$J("$"_$FN(ENT(ENSTA),",",2),16)
  1. . D MES^XPDUTL(ENX)
  1. . ; update grand totals
  1. . S ENC=ENC+ENC(ENSTA)
  1. . S ENT=ENT+ENT(ENSTA)
  1. ; report grand totals
  1. I ENC>0 D
  1. . S ENX=" Grand Total (All Stations) "
  1. . S ENX=ENX_" Count: "_$J(ENC,3,0)
  1. . S ENX=ENX_" Value: "_$J("$"_$FN(ENT,",",2),16)
  1. . D MES^XPDUTL(ENX)
  1. ;
  1. D BMES^XPDUTL(" Changing FUND of Equipment in Deactivated FUNDs...")
  1. D:'$D(^TMP($J,"ENDF")) MES^XPDUTL(" None found. No action taken.")
  1. ; init grand totals
  1. K ENC,ENT S (ENC,ENT)=0
  1. ; loop thru stations in TMP
  1. S ENSTA="" F S ENSTA=$O(^TMP($J,"ENDF",ENSTA)) Q:ENSTA="" D
  1. . D MES^XPDUTL(" For Station "_ENSTA)
  1. . ; init station subtotals
  1. . S (ENC(ENSTA),ENT(ENSTA))=0
  1. . ; loop thru funds in station
  1. . S ENFUND=""
  1. . F S ENFUND=$O(^TMP($J,"ENDF",ENSTA,ENFUND)) Q:ENFUND="" D
  1. . . ; init fund subtotals
  1. . . S (ENC(ENSTA,ENFUND),ENT(ENSTA,ENFUND))=0
  1. . . ; determine new fund
  1. . . S ENFUNDN=$S(ENFUND="8129G":"8129S",1:"AMAF")
  1. . . S ENFUNDNI=$O(^ENG(6914.6,"B",ENFUNDN,0))
  1. . . S ENX=" Moving equipment from "_ENFUND_" to "_ENFUNDN_" via FR"
  1. . . D MES^XPDUTL(ENX)
  1. . . I 'ENFUNDNI D MES^XPDUTL("ERROR: FUND "_ENFUNDN_" not in 6914.6!") Q
  1. . . ; loop thru SGLs in Fund
  1. . . S ENSGL=""
  1. . . F S ENSGL=$O(^TMP($J,"ENDF",ENSTA,ENFUND,ENSGL)) Q:ENSGL="" D
  1. . . . ; init sgl subtotal
  1. . . . S (ENC(ENSTA,ENFUND,ENSGL),ENT(ENSTA,ENFUND,ENSGL))=0
  1. . . . ; loop thru equipment in SGL
  1. . . . S ENDA=0
  1. . . . F S ENDA=$O(^TMP($J,"ENDF",ENSTA,ENFUND,ENSGL,ENDA)) Q:'ENDA D
  1. . . . . ; move equipment
  1. . . . . S ENX=$$XFUND^ENX1IPS1(ENDA,ENFUNDNI)
  1. . . . . I 'ENX D MES^XPDUTL("ERROR: Couldn't create the FR Document.")
  1. . . . . S ENAMT=$P($G(^ENG(6914,ENDA,2)),U,3)
  1. . . . . ; update SGL subtotals
  1. . . . . S ENC(ENSTA,ENFUND,ENSGL)=ENC(ENSTA,ENFUND,ENSGL)+1
  1. . . . . S ENT(ENSTA,ENFUND,ENSGL)=ENT(ENSTA,ENFUND,ENSGL)+ENAMT
  1. . . . . ; report action
  1. . . . . S ENX=" Equip #: "_$$LJ^XLFSTR(ENDA,10)
  1. . . . . S ENX=ENX_" Fund: "_$$LJ^XLFSTR(ENFUND,6)
  1. . . . . S ENX=ENX_" SGL: "_$$LJ^XLFSTR(ENSGL,4)
  1. . . . . S ENX=ENX_" Value: "_$J("$"_$FN(ENAMT,",",2),16)
  1. . . . . D MES^XPDUTL(ENX)
  1. . . . ; report SGL subtotals
  1. . . . S ENX=" SGL "_ENSGL_" Subtotal "
  1. . . . S ENX=ENX_" Count: "_$J(ENC(ENSTA,ENFUND,ENSGL),3,0)_" Value: "
  1. . . . S ENX=ENX_$J("$"_$FN(ENT(ENSTA,ENFUND,ENSGL),",",2),16)
  1. . . . D MES^XPDUTL(ENX)
  1. . . . ; update fund subtotals
  1. . . . S ENC(ENSTA,ENFUND)=ENC(ENSTA,ENFUND)+ENC(ENSTA,ENFUND,ENSGL)
  1. . . . S ENT(ENSTA,ENFUND)=ENT(ENSTA,ENFUND)+ENT(ENSTA,ENFUND,ENSGL)
  1. . . ; report fund subtotal
  1. . . S ENX=" Fund "_$$CJ^XLFSTR(ENFUND,6)
  1. . . S ENX=ENX_" Subtotal "
  1. . . S ENX=ENX_" Count: "_$J(ENC(ENSTA,ENFUND),3,0)
  1. . . S ENX=ENX_" Value: "_$J("$"_$FN(ENT(ENSTA,ENFUND),",",2),16)
  1. . . D MES^XPDUTL(ENX)
  1. . . ; update station totals
  1. . . S ENC(ENSTA)=ENC(ENSTA)+ENC(ENSTA,ENFUND)
  1. . . S ENT(ENSTA)=ENT(ENSTA)+ENT(ENSTA,ENFUND)
  1. . ; report station subtotals
  1. . S ENX=" Station "_$$CJ^XLFSTR(ENSTA,5)_" Subtotal "
  1. . S ENX=ENX_" Count: "_$J(ENC(ENSTA),3,0)
  1. . S ENX=ENX_" Value: "_$J("$"_$FN(ENT(ENSTA),",",2),16)
  1. . D MES^XPDUTL(ENX)
  1. . ; update grand totals
  1. . S ENC=ENC+ENC(ENSTA),ENT=ENT+ENT(ENSTA)
  1. ; report grand totals
  1. I ENC>0 D
  1. . S ENX=" Grand Total (All Stations) "
  1. . S ENX=ENX_" Count: "_$J(ENC,3,0)
  1. . S ENX=ENX_" Value: "_$J("$"_$FN(ENT,",",2),16)
  1. . D MES^XPDUTL(ENX)
  1. ;
  1. I '$D(^TMP($J,"ENADP")) D
  1. . D BMES^XPDUTL(" None of the Trust equipment that was moved from SGL 1754 to SGL 1750")
  1. . D MES^XPDUTL(" appears to be ADPE. No user action is required.")
  1. I $D(^TMP($J,"ENADP")) D
  1. . D BMES^XPDUTL(" Some of the Trust equipment that was moved from SGL 1754 to SGL 1750")
  1. . D MES^XPDUTL(" appears to be ADP equipment based on its category stock number (CSN).")
  1. . D MES^XPDUTL(" ADP equipment should be in SGL 1751 instead of 1750.")
  1. . D MES^XPDUTL(" You will need to manually update the SGL of this equipment using FD and")
  1. . D MES^XPDUTL(" FA Documents so that your local system, Fixed Assets, and FMS are updated.")
  1. . D MES^XPDUTL(" ADP Trust Equipment Currently in SGL 1750:")
  1. . S ENDA=0 F S ENDA=$O(^TMP($J,"ENADP",ENDA)) Q:'ENDA D
  1. . . S ENCSN=$$GET1^DIQ(6914,ENDA_",",18)
  1. . . S ENCSN("D")=$$GET1^DIQ(6914,ENDA_",","18:2")
  1. . . S ENX=" Equip #: "_ENDA_" CSN: "_ENCSN_" ("_ENCSN("D")_")"
  1. . . D MES^XPDUTL(ENX)
  1. ;
  1. K ^TMP($J)
  1. Q
  1. ;
  1. ;ENX1IPS