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

PRCHAAC3.m

Go to the documentation of this file.
  1. PRCHAAC3 ;WIFO/TN/CR-CONT. OF IFCAP HL7 MESSAGE TO AUSTIN ;4/28/05 2:43 PM
  1. ;;5.1;IFCAP;**79**;Oct 20, 2000
  1. ;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;This function is called from the routine PRCHAAC.
  1. ;
  1. LIDT(PRCPO) ;This function goes through all the line items on a PO
  1. ; to get information on the item with the highest dollar amount.
  1. ; If there is a problem with the PO, the function will return
  1. ; a zero
  1. ;
  1. ; 1 2 3 4 5 6
  1. ; PO Number^PO Total^Description^item amount^contract number^FSC
  1. ; FSC - FEDERAL SUPPLY CLASSIFICATION
  1. ;
  1. N AMT,AMT1,CNT,DESC,ITEM,ITEM1,PO,REC,REC1,REC2,TOTAL
  1. I '$D(^PRC(442,PRCPO,2,0)) QUIT 0 ;No line items
  1. ;
  1. ;Get line item with the highest cost
  1. S AMT="",ITEM1=0
  1. F S ITEM1=$O(^PRC(442,PRCPO,2,ITEM1)) Q:'ITEM1 D
  1. . S REC=$G(^PRC(442,PRCPO,2,ITEM1,2)) ;Get item record
  1. . QUIT:REC=""
  1. . S REC=$P(REC,U,1,3) ;Get the 1st 3 fields
  1. . S AMT1=+REC ;Cost of the item
  1. . I AMT1<AMT QUIT ;Get the next record
  1. . S AMT=AMT1
  1. . S ITEM=ITEM1
  1. . S REC2=REC ;Save record with highest dollar amount
  1. ;
  1. I 'AMT QUIT 0 ;No dollar amount
  1. S REC1=^PRC(442,PRCPO,0)
  1. S PO=$P(REC1,U) ;Get PO number
  1. S TOTAL=$P(REC1,U,15) ;Get PO total
  1. S DESC=^PRC(442,PRCPO,2,ITEM,1,1,0) ;Get item description
  1. ; Clean the HL7 message of any '^,~,&,\, or |'.
  1. T I DESC["^"!(DESC["|")!(DESC["~")!(DESC["&")!(DESC["\") S DESC=$$STRIP^XLFSTR(DESC,"^~|&\")
  1. S PO=PO_"^"_TOTAL_"^"_$E(DESC,1,50)_"^"_REC2 ;Setup return data
  1. ;
  1. QUIT PO