Procedure

TfrmProblems.ApplyViewFilters

Module

fProbs

Last Modified

7/15/2014 3:26:38 PM

Comments

Procedure TfrmProblems.UMPLFilter(var Message:TMessage);

Visibility

Private

Owner

TfrmProblems

Declaration

procedure ApplyViewFilters;

Called-By Hierarchy


                  TfrmProblems.ApplyViewFilters
                  TfrmProblems.pnlRightResize┤ 
              TfrmProblems.lstProbActsClick┤ │ 
          TfrmProblems.wgProbDataDblClick┤ │ │ 
                TfrmProblems.lstViewClick┘ │ │ 
        TfrmProblems.HighlightDuplicate┘   │ │ 
              TfrmProblems.AddProblem┤     │ │ 
   TfrmProblems.lstProbActsClick...┤ │     │ │ 
      TfrmProblems.lstProbPickClick┤ │     │ │ 
   TfrmProblems.lstProbPickDblClick┤ │     │ │ 
   TfrmProblems.edProbEntKeyPress┘ │ │     │ │ 
           TfrmProblems.UMPLLexicon┘ │     │ │ 
        TfrmdlgProb.bbChangeProbClick┘     │ │ 
                TfrmProblems.LoadUserParams┤ │ 
                TfrmProblems.LoadProblems┘ │ │ 
               TfrmProblems.DisplayPage┤   │ │ 
TfrmProblems.mnuViewRestoreDefaultClick┤   │ │ 
                  TfrmProblems.FormShow┘   │ │ 
           TfrmProblems.LoadPatientProblems┘ │ 
         TfrmProblems.lstProbActsClick...┤   │ 
             TfrmProblems.LoadProblems...┤   │ 
              TfrmProblems.RestoreProblem┤   │ 
       TfrmProblems.lstProbActsClick...┘ │   │ 
                    TfrmdlgProb.FormClose┘   │ 
          TfrmProblems.LoadPatientProblems...┘ 

Called-By

Name Declaration Comments
TfrmProblems.LoadPatientProblems procedure LoadPatientProblems(AList:TstringList;const status:char;init:boolean); -
TfrmProblems.pnlRightResize procedure pnlRightResize(Sender:TObject); -


Source

788   procedure TfrmProblems.ApplyViewFilters;
789   var
790     i: integer;
791     wantnulls: boolean;
792   begin
793     {the following escape is necessitated by change in default row height which
794      corrupts display of hidden rows in wgProbData. Since the default rowheight
795      is changed with each change in screen size, this gets called once before
796      PLFilters is created}
797     if PLFilters = nil then exit; {not initialized}
798     {show all rows}
799     wantnulls := (PLFilters.ProviderList.indexof('-1') > -1);
800     for i := 0 to pred(FProblemsVisible.count) do FProblemsVisible[i] := 'Y';
801   
802     {filter for provider}
803     if PLFilters.ProviderList.Count > 0 then
804       if PLFilters.ProviderList[0] <> '0' then { 0 signifies all }
805         for i := 0 to pred(FAllProblems.count) do
806           if Piece(FAllProblems[i], U, 1) <> '' then {don't want to disappear empty rows}
807             if (PLFilters.ProviderList.indexof(Piece(FAllProblems[i], U, 10)) < 0) or
808                ((Piece(FAllProblems[i], U, 10) = '') and (not wantnulls)) then
809               FProblemsVisible[i] := 'N';
810   
811     if PLUser.usCurrentView = PL_UF_VIEW then exit; {Bail out - no filtering by Loc}
812   
813     {conditionally filter for clinic(s) - may be multiple selected}
814     if PLUser.usCurrentView = PL_OP_VIEW then
815       begin
816         wantnulls := (PLFilters.ClinicList.indexof('-1') > -1);
817         if PLFilters.ClinicList.Count = 0 then exit;
818         if PLFilters.ClinicList[0] <> '0' then { 0 signifies all }
819           for i := 0 to pred(FAllProblems.count) do
820             if (Piece(FAllProblems[i], U, 1) <> '') and          {don't want to disappear empty rows}
821                (FProblemsVisible[i] = 'Y') then                          {don't want if already filtered}
822               begin
823                 if (Piece(FAllProblems[i], U ,11) <> '') and       {clinic not on user list}
824                          (PLFilters.ClinicList.indexof(Piece(FAllProblems[i], U, 11)) < 0) then
825                   FProblemsVisible[i] := 'N'
826                 else if ((Piece(FAllProblems[i], U, 11) = '') and (not wantnulls)) then {no clinic recorded}
827                   FProblemsVisible[i] := 'N';
828               end;
829       end
830     else
831     {conditionally filter for service - may be multiple selected}
832       begin
833         wantnulls := (PLFilters.ServiceList.indexof('-1') > -1);
834         if PLFilters.ServiceList.Count = 0 then exit;
835         if PLFilters.ServiceList[0] <> '0' then { 0 signifies all }
836           for i := 0 to pred(FAllProblems.count) do
837             if (Piece(FAllProblems[i], U, 1) <> '') and        {don't want to disappear empty rows}
838               (FProblemsVisible[i] = 'Y') then                         {don't want if already filtered}
839               begin
840                 if (Piece(FAllProblems[i], U, 12) <> '') and              {Service not on user list}
841                         (PLFilters.ServiceList.indexof(Piece(FAllProblems[i], U, 12)) < 0) then
842                   FProblemsVisible[i] := 'N'
843                 else if (Piece(FAllProblems[i], U, 12) = '') and (not wantnulls) then               {no Service recorded}
844                   FProblemsVisible[i] := 'N';
845               end;
846       end;
847   end;