Procedure

TPCEData.SetProcedures

Module

uPCE

Last Modified

7/15/2014 3:26:36 PM

Comments

CPTcode^Qty^Category^Narrative^Qty Text
load Procedures for this encounter into TPCEProc records, assumes all Procedures for the
  encounter will be listed in Src and marks those that are not in Src for deletion

Visibility

Public

Owner

TPCEData

Declaration

procedure SetProcedures(Src: TStrings; FromForm: boolean = TRUE);      // CPTcode^Qty^Category^Narrative^Qty Text

Calls Hierarchy


TPCEData.SetProcedures
 ├TPCEData.MarkDeletions
 │ ├TPCEItem.Match
 │ └TPCEItem.MatchProvider
 ├TPCEData.MatchItem
 │ ├TPCEItem.Match
 │ └TPCEItem.MatchProvider
 ├TPCEProc.Assign
 │ └TPCEItem.Assign
 │   └TPCEItem.SetComment
 └TPCEItem.SetComment

Called-By Hierarchy


                 TPCEData.SetProcedures
                                  Add┤ 
          TfrmRemDlg.btnFinishClick┘ │ 
   TfrmEncounterFrame.UpdateEncounter┘ 
        TfrmEncounterFrame.SendData┤   
TfrmEncounterFrame.FormCloseQuery┘ │   
  TfrmEncounterFrame.FormCloseQuery┘   

Calls

Name Declaration Comments
TPCEProc.Assign procedure Assign(Src: TPCEItem); override; -
TPCEData.MarkDeletions procedure MarkDeletions(PreList: TList; PostList: TStrings); -
TPCEData.MatchItem function MatchItem(AList: TList; AnItem: TPCEItem): Integer; -
TPCEItem.SetComment procedure SetComment(const Value: String); -

Called-By

Name Declaration Comments
Add procedure Add(PCEItemClass: TPCEItemClass); -
TfrmEncounterFrame.UpdateEncounter procedure UpdateEncounter(PCE: TPCEData); -


Source

2355  procedure TPCEData.SetProcedures(Src: TStrings; FromForm: boolean = TRUE);
2356  { load Procedures for this encounter into TPCEProc records, assumes all Procedures for the
2357    encounter will be listed in Src and marks those that are not in Src for deletion }
2358  var
2359    i, MatchIndex: Integer;
2360    SrcProcedure, CurProcedure, OldProcedure: TPCEProc;
2361  begin
2362    if FromForm then MarkDeletions(FProcedures, Src);
2363    for i := 0 to Src.Count - 1 do
2364    begin
2365      SrcProcedure := TPCEProc(Src.Objects[i]);
2366      MatchIndex := MatchItem(FProcedures, SrcProcedure);
2367      if MatchIndex > -1 then
2368      begin
2369        CurProcedure := TPCEProc(FProcedures.Items[MatchIndex]);
2370  (*      if (SrcProcedure.Provider <> CurProcedure.Provider) then
2371        begin
2372          OldProcedure := TPCEProc.Create;
2373          OldProcedure.Assign(CurProcedure);
2374          OldProcedure.FDelete := TRUE;
2375          OldProcedure.FSend := TRUE;
2376          FProcedures.Add(OldProcedure);
2377        end;*)
2378        if (SrcProcedure.Quantity <> CurProcedure.Quantity) or
2379           (SrcProcedure.Provider <> CurProcedure.Provider) or
2380           (Curprocedure.Comment <> SrcProcedure.Comment) or
2381           (Curprocedure.Modifiers <> SrcProcedure.Modifiers)then
2382        begin
2383          OldProcedure := TPCEProc.Create;
2384          OldProcedure.Assign(CurProcedure);
2385          OldProcedure.FDelete := TRUE;
2386          OldProcedure.FSend := TRUE;
2387          FProcedures.Add(OldProcedure);
2388          CurProcedure.Quantity := SrcProcedure.Quantity;
2389          CurProcedure.Provider := SrcProcedure.Provider;
2390          CurProcedure.Comment := SrcProcedure.Comment;
2391          CurProcedure.Modifiers := SrcProcedure.Modifiers;
2392          CurProcedure.FSend := True;
2393        end;
2394      end else
2395      begin
2396        CurProcedure := TPCEProc.Create;
2397        CurProcedure.Assign(SrcProcedure);
2398        CurProcedure.FSend := True;
2399        FProcedures.Add(CurProcedure);
2400      end; {if MatchIndex}
2401    end; {for}
2402  end;