Procedure

TfrmBALocalDiagnoses.BuildTempDxList

Module

fBALocalDiagnoses

Last Modified

7/15/2014 3:26:34 PM

Visibility

Private

Owner

TfrmBALocalDiagnoses

Declaration

procedure BuildTempDxList;

Called-By Hierarchy


TfrmBALocalDiagnoses.BuildTempDxList
    TfrmBALocalDiagnoses.buOKClick┘ 

Called-By

Name Declaration Comments
TfrmBALocalDiagnoses.buOKClick procedure buOKClick(Sender: TObject); -


Source

855   procedure TfrmBALocalDiagnoses.BuildTempDxList;
856   var
857      i : integer;
858      tempStr1,tempStr2, tempStr3: string;
859      tempFactor1: string;
860      tempStrList: TStringList;
861   begin
862      tempStrList := TStringList.Create;
863      if Assigned(tempStrList) then tempStrList.Clear;
864   
865      UBAGlobals.Dx1 := '';
866      UBAGlobals.Dx2 := '';
867      UBAGlobals.Dx3 := '';
868      UBAGlobals.Dx4 := '';
869      UBAGlobals.TFactors := '';
870      tempstr1 := '';
871      tempstr2 := '';
872      tempstr3 := '';
873      tempFactor1 := '';
874   
875      if frmBALocalDiagnoses.lvDxGrid.Items.Count > 0 then
876      with frmBALocalDiagnoses.lvDxGrid do
877      begin
878         for i := 0 to Items.Count-1 do
879         begin
880        //    x := lvDxGrid.Items[i].Subitems[0];
881        //    x := lvDxGrid.Items[i].Subitems[1];
882        //    x:= lvDxGrid.Items[i].Subitems[0] + '^' + lvDxGrid.Items[i].Subitems[1];
883            tempStrList.Add(lvDxGrid.Items[i].Subitems[0] + '^' + lvDxGrid.Items[i].Subitems[1]);
884         end;
885         if tempStrList.Count > 0 then
886            tempStrList.Sort;  //**  Sort list Ascending order.
887         with  tempStrList do
888         begin
889            tempFactor1 := (Piece(tempStrList.Strings[0],'(',2)); //** 0 = Primary
890            tempFactor1 := (Piece(tempFactor1,')',1) );
891            if (Length(tempFactor1) > 0) then
892               UBAGlobals.TFactors := tempFactor1;
893            for i := 0 to  tempStrList.Count-1 do
894            begin
895               tempstr1 := (Piece(tempStrList.Strings[i],U,2));
896               tempstr2 := (Piece(tempstr1,':',1) + '^'+ Piece(tempstr1,':',2));
897               if i = 0 then //** has primary dx changed
898               begin
899                  if tempStr2 <> uPrimaryDxHold then
900                  begin
901                     if tempStr2 <> '' then
902                        PrimaryChanged := True;
903                  end;
904               end;
905               if tempstr2 = U then
906                  tempstr2 := DXREC_INIT_FIELD_VAL;
907               case i of
908                  0: UBAGlobals.Dx1 := tempStr2;
909                  1: UBAGlobals.Dx2 := tempStr2;
910                  2: UBAGlobals.Dx3 := tempStr2;
911                  3: UBAGlobals.Dx4 := tempStr2;
912               else
913                  Exit;
914               end;
915            end;
916      end;
917     end
918      else
919         if lvDxGrid.Items.Count = 0 then
920         begin
921            UBAGlobals.Dx1 := DXREC_INIT_FIELD_VAL;
922            UBAGlobals.Dx2 := DXREC_INIT_FIELD_VAL;
923            UBAGlobals.Dx3 := DXREC_INIT_FIELD_VAL;
924            UBAGlobals.Dx4 := DXREC_INIT_FIELD_VAL;
925         end;
926   end;