Procedure

TPCEData.SetImmunizations

Module

uPCE

Last Modified

7/15/2014 3:26:36 PM

Comments

IMMcode^
load Immunizations for this encounter into TPCEImm records, assumes all Immunizations for the
  encounter will be listed in Src and marks those that are not in Src for deletion

Visibility

Public

Owner

TPCEData

Declaration

procedure SetImmunizations(Src: TStrings; FromForm: boolean = TRUE);   // IMMcode^

Calls Hierarchy


TPCEData.SetImmunizations
 ├TPCEData.MarkDeletions
 │ ├TPCEItem.Match
 │ └TPCEItem.MatchProvider
 ├TPCEData.MatchItem
 │ ├TPCEItem.Match
 │ └TPCEItem.MatchProvider
 ├TPCEItem.SetComment
 └TPCEImm.Assign
   └TPCEItem.Assign
     └TPCEItem.SetComment

Called-By Hierarchy


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

Calls

Name Declaration Comments
TPCEImm.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

2406  procedure TPCEData.SetImmunizations(Src: TStrings; FromForm: boolean = TRUE);
2407  { load Immunizations for this encounter into TPCEImm records, assumes all Immunizations for the
2408    encounter will be listed in Src and marks those that are not in Src for deletion }
2409  var
2410    i, MatchIndex: Integer;
2411    SrcImmunization, CurImmunization: TPCEImm;
2412  begin
2413    if FromForm then MarkDeletions(FImmunizations, Src);
2414    for i := 0 to Src.Count - 1 do
2415    begin
2416      SrcImmunization := TPCEImm(Src.Objects[i]);
2417      MatchIndex := MatchItem(FImmunizations, SrcImmunization);
2418      if MatchIndex > -1 then
2419      begin
2420        CurImmunization := TPCEImm(FImmunizations.Items[MatchIndex]);
2421  
2422        //set null strings to NoPCEValue
2423        if SrcImmunization.Series = '' then SrcImmunization.Series := NoPCEValue;
2424        if SrcImmunization.Reaction = '' then SrcImmunization.Reaction := NoPCEValue;
2425        if CurImmunization.Series = '' then CurImmunization.Series := NoPCEValue;
2426        if CurImmunization.Reaction = '' then CurImmunization.Reaction := NoPCEValue;
2427  
2428        if(SrcImmunization.Series <> CurImmunization.Series) or
2429          (SrcImmunization.Reaction <> CurImmunization.Reaction) or
2430          (SrcImmunization.Refused <> CurImmunization.Refused) or
2431          (SrcImmunization.Contraindicated <> CurImmunization.Contraindicated) or
2432          (CurImmunization.Comment <> SrcImmunization.Comment)then  
2433        begin
2434          CurImmunization.Series          := SrcImmunization.Series;
2435          CurImmunization.Reaction        := SrcImmunization.Reaction;
2436          CurImmunization.Refused         := SrcImmunization.Refused;
2437          CurImmunization.Contraindicated := SrcImmunization.Contraindicated;
2438          CurImmunization.Comment         := SrcImmunization.Comment;  
2439          CurImmunization.FSend := True;
2440        end;
2441      end else
2442      begin
2443        CurImmunization := TPCEImm.Create;
2444        CurImmunization.Assign(SrcImmunization);
2445        CurImmunization.FSend := True;
2446        FImmunizations.Add(CurImmunization);
2447      end; {if MatchIndex}
2448    end; {for}
2449  end;