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

PRCOE3.m

Go to the documentation of this file.
  1. PRCOE3 ;WISC/DJM-IFCAP SEGMENTS HE,MI,CO ;6/18/97 16:29
  1. V ;;5.1;IFCAP;;Oct 20, 2000
  1. ;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. HE(VAR1,VAR2) ;PO HEADER INFORMATION SEGMENT
  1. ; uses PRCHPC variable to determine if document is a purchase card
  1. ; PRCHPC should not exist & should not be used in non-Purchase Card options
  1. ;
  1. ; VAR1 = string of up to 4 pieces -- (last 3 pieces are optional)
  1. ; ('^' piece 1) ==> ien to file 442
  1. ; ('^' piece 2) ==> amendment flag (1 for PHM, 2 for PHA)
  1. ; ('^' piece 3) ==> amendment number
  1. ; ('^' piece 4) ==> 442 ien of amended order if PO number
  1. ; was changed
  1. ;
  1. ; VAR2 is used to pass error conditions to the calling routine
  1. ;
  1. N A,A1,AFLG,ANO,B,DA,DD,NM,P,PHN,PM,PNM,PO,POD,PPM,RFQ,SC,MOP,X,Y
  1. S PO=$P(VAR1,"^",1)
  1. S A=$G(^PRC(442,PO,0))
  1. S A1=$G(^PRC(442,PO,1))
  1. I $G(^PRC(442,PO,12))="" S VAR2="NP12" Q ; exit if no info in node 12
  1. ;
  1. S X=$P(A1,U,15)
  1. I X="" S VAR2="NPOD" Q ; exit if no PO Date
  1. D JD^PRCFDLN ; puts julian date for X in Y
  1. S POD=$E(X,1,3)+1700_$E(Y,1,3)
  1. ;
  1. S X=$P(A,U,10)
  1. I X="" S VAR2="NDD" Q ; exit if no delivery date
  1. D JD^PRCFDLN ; Puts julian date for X in Y
  1. S DD=$E(X,1,3)+1700_$E(Y,1,3)
  1. ;
  1. S AFLG=$P(VAR1,"^",2) I AFLG="" S AFLG=0
  1. S DA=PO
  1. I AFLG=2 S DA=$P(VAR1,"^",4) ; use old PO's ien if PO number was changed
  1. ;
  1. I 'AFLG S P=$P(A1,U,10)
  1. I AFLG D
  1. . S ANO=$P(VAR1,"^",3) ; amendment number
  1. . S P=$P(^PRC(442,DA,6,ANO,1),"^",1)
  1. I P="" S VAR2="NPPM" Q ; exit if no PA/PPM (or Authorized buyer)
  1. ;
  1. S PHN=$P($G(^VA(200,P,.13)),"^",5)
  1. I '$G(PRCHPC) D Q:PHN=""
  1. . I PHN="" S VAR2="NPHN" Q ;exit if no commercial phone# for PA/PPM
  1. . S PHN=$P(PHN,U)
  1. . I PHN="" S VAR2="NPH" Q ; exit (but when would there be an '^'???)
  1. ;
  1. I 'AFLG S PPM=$E("ES/"_$$DECODE^PRCHES5(DA),1,30)
  1. I AFLG S PPM=$E("ES/"_$$DECODE^PRCHES6(DA,ANO),1,30)
  1. I PPM="ES/" S VAR2="ESBD" Q ; exit if no name found
  1. ;
  1. S PO=$P(VAR1,"^",1)
  1. S MOP=$P(A,U,2) ; method of processing
  1. S MOP=$S(MOP=1:"A",MOP=2:"B",MOP=3:"C",MOP=4:"D",MOP=7:"E",MOP=8:"F",MOP=9:"G",MOP=21:"H",MOP=22:"I",MOP=23:"J",MOP=24:"K",MOP=25:"L",MOP=26:"M",1:"")
  1. S:MOP="" MOP="A"
  1. ;
  1. S SC=$P(A1,U,7) ; source code
  1. S:SC>0 SC=$P($G(^PRCD(420.8,SC,0)),U)
  1. S RFQ=$P($G(^PRC(442,PO,21)),U,8)
  1. S PM=0
  1. S PM=$O(^PRC(442,PO,14,PM)) ; purchase method
  1. D:PM>0
  1. . S PM=$P($G(^PRC(442,PO,14,PM,0)),U) Q:PM'>0
  1. . S PM=$P($G(^PRC(442.4,PM,0)),U)
  1. . Q
  1. ;
  1. S B="HE^^"_POD_"^"_SC_"^"_DD_"^^^"_PPM_"^"_PHN_"^"_PM_"^"_MOP_"^^0^^^^"_RFQ_"^1^|"
  1. S ^TMP($J,"STRING",1)=B
  1. Q
  1. ;
  1. MI(VAR1,VAR2) ;MISCELLANEOUS INFORMATION SEGMENT
  1. N B,F1,F2,I2,ITEM,M0,M1,M12,M23,PR
  1. S M0=$G(^PRC(442,VAR1,0))
  1. S M1=$G(^PRC(442,VAR1,1))
  1. S M12=$G(^PRC(442,VAR1,12))
  1. S M23=$G(^PRC(442,VAR1,23))
  1. S B="MI^^"_$P(M12,U,7)_"^" ; FIELDS 1, 2, 3
  1. I $P(M23,U,11)="P" S F1="" G MI1
  1. S F1=$P(M1,U,7)
  1. S:F1="" VAR2="NSC"
  1. Q:F1=""
  1. S F1=$S(F1=9:"B","2,3,5,8"[F1:"P",1:"D")
  1. MI1 S B=B_F1_"^^^" ; FIELDS 4, 5, 6
  1. S PR=$P(M1,U,8)
  1. I $P(M0,U,19)=2,PR="" S PR="N/A"
  1. S:PR="" VAR2="NOPR"
  1. Q:PR=""
  1. S B=B_PR_"^^^^|" ; FIELDS 7, 8, 9, 10, 11
  1. S ^TMP($J,"STRING",5)=B
  1. Q
  1. ;
  1. CO(VAR1,VAR2,TOTAL) ;COMMENT INFORMATION SEGMENT
  1. N B,TOSH
  1. S TOSH=$P($G(^PRC(442,VAR1,12)),U,14)
  1. Q:TOSH=""
  1. S TOSH=$E($P(^PRC(443.4,TOSH,0),U,3),1,59)
  1. S B="CO^1^"_TOSH_"^|"
  1. S ^TMP($J,"STRING",TOTAL)=B
  1. S TOTAL=TOTAL+1
  1. S B=^TMP($J,"STRING",1)
  1. S $P(B,U,13)=$P(B,U,13)+1
  1. S ^TMP($J,"STRING",1)=B
  1. Q