Procedure

TfrmLabs.WorksheetChart

Module

fLabs

Last Modified

7/15/2014 3:26:38 PM

Visibility

Private

Owner

TfrmLabs

Declaration

procedure WorksheetChart(test: string; aitems: TStrings);

Calls Hierarchy


TfrmLabs.WorksheetChart
 ├TfrmLabs.GetStartStop
 ├OkFloatValue
 └TfrmLabs.FMToDateTime

Called-By Hierarchy


                                    TfrmLabs.WorksheetChart
                               TfrmLabs.lstTestGraphClick┘ 
                                  TfrmLabs.ragCorGClick┘   
                           TfrmLabs.lstQualifierClick┤     
                            TfrmLabs.tvReportsClick┘ │     
                             TfrmLabs.DisplayPage┤   │     
                            TfrmLabs.LoadTreeView┤   │     
                           TfrmLabs.DisplayPage┤ │   │     
         TfrmOptionsReportsCustom.btnApplyClick┘ │   │     
          TfrmOptionsReportsCustom.btnOKClick┘   │   │     
                      TfrmLabs.cmdOtherTestsClick┤   │     
                         TfrmLabs.chkMaxFreqClick┤   │     
                    TfrmLabs.ProcessNotifications┤   │     
                           TfrmLabs.DisplayPage┘ │   │     
                                        ..(rec)..┤   │     
                        TfrmLabs.tvReportsKeyDown┤   │     
                  TfrmFrame.lstCIRNLocationsClick┘   │     
                            TfrmFrame.SetUpCIRN┘     │     
                       TfrmFrame.SetupPatient┘       │     
                  UpdatePatientInfoForAlert┤         │     
               TfrmFrame.mnuFileNextClick┘ │         │     
             TfrmFrame.mnuFileOpenClick┤   │         │     
                 TfrmFrame.UMInitiate┤ │   │         │     
        TfrmFrame.mnuFileNextClick...┤ │   │         │     
        TfrmFrame.mnuFileRefreshClick┤ │   │         │     
        TfrmOrders.CheckOrderStatus┤ │ │   │         │     
    TfrmOrders.mnuActChgEvntClick┤ │ │ │   │         │     
       TfrmOrders.mnuActHoldClick┤ │ │ │   │         │     
     TfrmOrders.mnuActUnholdClick┤ │ │ │   │         │     
      TfrmOrders.mnuActRenewClick┤ │ │ │   │         │     
     TfrmOrders.mnuActChangeClick┤ │ │ │   │         │     
       TfrmOrders.mnuActCopyClick┘ │ │ │   │         │     
             TfrmMeds.mnuActDCClick┤ │ │   │         │     
            TfrmMeds.CheckMedStatus┘ │ │   │         │     
         TfrmMeds.mnuActHoldClick┤   │ │   │         │     
        TfrmMeds.mnuActRenewClick┤   │ │   │         │     
       TfrmMeds.mnuActUnholdClick┤   │ │   │         │     
       TfrmMeds.mnuActChangeClick┤   │ │   │         │     
         TfrmMeds.mnuActCopyClick┤   │ │   │         │     
       TfrmMeds.mnuActRefillClick┘   │ │   │         │     
                   TfrmFrame.ViewInfo┘ │   │         │     
                TfrmDCSumm.ViewInfo┤   │   │         │     
              TfrmConsults.ViewInfo┤   │   │         │     
      TfrmFrame.pnlRemindersMouseUp┤   │   │         │     
       TfrmFrame.RemindersChanged┘ │   │   │         │     
           TfrmFrame.FormCreate┘   │   │   │         │     
             TfrmFrame.pnlCIRNClick┤   │   │         │     
       TfrmFrame.pnlVistaWebClick┤ │   │   │         │     
            TfrmFrame.FormKeyDown┘ │   │   │         │     
          TfrmFrame.pnlPatientClick┤   │   │         │     
            TfrmFrame.pnlVisitClick┤   │   │         │     
      TfrmFrame.pnlPrimaryCareClick┤   │   │         │     
        TfrmFrame.pnlRemindersClick┤   │   │         │     
         TfrmFrame.pnlPostingsClick┤   │   │         │     
             TfrmFrame.pnlFlagClick┤   │   │         │     
               TfrmFrame.laMHVClick┤   │   │         │     
              TfrmFrame.laVAA2Click┤   │   │         │     
                TfrmOrders.ViewInfo┤   │   │         │     
                  TfrmMeds.ViewInfo┤   │   │         │     
               TfrmSurgery.ViewInfo┤   │   │         │     
                 TfrmNotes.ViewInfo┤   │   │         │     
              TfrmProblems.ViewInfo┘   │   │         │     
      TfrmFrame.mnuFileNotifRemoveClick┤   │         │     
              TfrmFrame.NextButtonClick┘   │         │     
            TfrmFrame.SetUpNextButton┘     │         │     
      TfrmFrame.mnuFileOpenClick...┤       │         │     
               TfrmFrame.FormResize┘       │         │     
             TfrmFrame.ChangeFont┘         │         │     
     TfrmFrame.LoadSizesForUser┤           │         │     
TfrmFrame.LoadUserPreferences┘ │           │         │     
       TfrmFrame.UMInitiate┘   │           │         │     
     TfrmFrame.mnuFontSizeClick┘           │         │     
              TfrmFrame.mnuFileOpenClick...┤         │     
           TfrmFrame.AllowCCOWContextChange┤         │     
            TfrmFrame.mnuFileNextClick...┤ │         │     
            TfrmFrame.mnuFileOpenClick...┤ │         │     
   TfrmFrame.mnuFileResumeContextSetClick┘ │         │     
                TfrmFrame.UpdateCCOWContext┤         │     
            TfrmFrame.mnuFileOpenClick...┤ │         │     
          TfrmFrame.ctxContextorCommitted┤ │         │     
           TfrmFrame.StartCCOWContextor┘ │ │         │     
                 TfrmFrame.FormCreate┘   │ │         │     
   TfrmFrame.mnuFileResumeContextGetClick┘ │         │     
     TfrmFrame.mnuFileResumeContextSetClick┘         │     
                               TfrmLabs.lstDatesClick┘     
                         TfrmLabs.tvReportsClick...┘       

Calls

Name Declaration Comments
TfrmLabs.FMToDateTime function FMToDateTime(FMDateTime: string): TDateTime; -
TfrmLabs.GetStartStop procedure GetStartStop(var start, stop: string; aitems: TStrings); -
OkFloatValue function OkFloatValue(value: string): boolean; -

Called-By

Name Declaration Comments
TfrmLabs.lstTestGraphClick procedure lstTestGraphClick(Sender: TObject); -


Source

2226  procedure TfrmLabs.WorksheetChart(test: string; aitems: TStrings);
2227  
2228  function OkFloatValue(value: string): boolean;
2229  var
2230    i, j: integer;
2231    first, second: string;
2232  begin
2233    Result := false;
2234    i := strtointdef(value, -99999);
2235    if i <> -99999 then Result := true
2236    else if pos('.', Copy(Value, Pos('.', Value) + 1, Length(Value))) > 0 then Result := false
2237    else
2238    begin
2239      first := Piece(value, '.', 1);
2240      second := Piece(value, '.', 2);
2241      if length(second) > 0 then
2242      begin
2243        i := strtointdef(first, -99999);
2244        j := strtointdef(second, -99999);
2245        if (i <> -99999) and (j <> -99999) then Result := true;
2246      end
2247      else
2248      begin
2249        i :=strtointdef(first, -99999);
2250        if i <> -99999 then Result := true;
2251      end;
2252    end;
2253  end;
2254  
2255  var
2256    datevalue, oldstart, oldend: TDateTime;
2257    labvalue: double;
2258    i, numtest, numcol, numvalues, valuecount: integer;
2259    high, low, start, stop, numspec, value, testcheck, units, specimen, testnum, testorder: string;
2260  begin
2261    if chkZoom.Checked and chtChart.Visible then
2262    begin
2263      oldstart := chtChart.BottomAxis.Minimum;
2264      oldend := chtChart.BottomAxis.Maximum;
2265      chtChart.UndoZoom;
2266      chtChart.BottomAxis.Automatic := false;
2267      chtChart.BottomAxis.Minimum := oldstart;
2268      chtChart.BottomAxis.Maximum := oldend;
2269    end
2270    else
2271    begin
2272      chtChart.BottomAxis.Automatic := true;
2273    end;
2274    chtChart.Visible := true;
2275    valuecount := 0;
2276    testnum := Piece(test, '^', 1);
2277    specimen := Piece(test, '^', 3);
2278    units := Piece(test, '^', 4);
2279    low := Piece(test, '^', 5);
2280    high := Piece(test, '^', 6);
2281    numtest := strtoint(Piece(aitems[0], '^', 1));
2282    numcol := strtoint(Piece(aitems[0], '^', 2));
2283    numvalues := strtoint(Piece(aitems[0], '^', 3));
2284    serHigh.Clear;  serLow.Clear;  serTest.Clear;
2285    if numtest > 0 then
2286    begin
2287      for i := 1 to numtest do
2288        if testnum = Piece(aitems[i], '^', 2) then
2289        begin
2290          testorder := inttostr(i);
2291          break;
2292        end;
2293      GetStartStop(start, stop, aitems);
2294      if OKFloatValue(high) then
2295      begin
2296        serHigh.AddXY(FMToDateTime(start), strtofloat(high), '',clTeeColor);
2297        serHigh.AddXY(FMToDateTime(stop), strtofloat(high), '',clTeeColor);
2298      end;
2299      if OKFloatValue(low) then
2300      begin
2301        serLow.AddXY(FMToDateTime(start), strtofloat(low), '',clTeeColor);
2302        serLow.AddXY(FMToDateTime(stop), strtofloat(low), '',clTeeColor);
2303      end;
2304      numspec := Piece(specimen, '^', 1);
2305      chtChart.Legend.Color := grdLab.Color;
2306      chtChart.Title.Font.Size := MainFontSize;
2307      chtChart.LeftAxis.Title.Caption := units;
2308      serTest.Title := Piece(test, '^', 2);
2309      serHigh.Title := 'Ref High ' + high;
2310      serLow.Title := 'Ref Low ' + low;
2311      testcheck := testorder;
2312      for i := numtest + numcol + 1 to numtest + numcol + numvalues do
2313        if Piece(aitems[i], '^', 2) = testcheck then
2314          if Piece(aitems[numtest + strtoint(Piece(aitems[i], '^', 1))], '^', 3) = numspec then
2315          begin
2316            value := Piece(aitems[i], '^', 3);
2317            if OkFloatValue(value) then
2318            begin
2319              labvalue := strtofloat(value);
2320              datevalue := FMToDateTime(Piece(aitems[numtest + strtoint(Piece(aitems[i], '^', 1))], '^', 2));
2321              serTest.AddXY(datevalue, labvalue, '', clTeeColor);
2322              inc(valuecount);
2323            end;
2324          end;
2325    end;
2326    if valuecount = 0 then
2327    begin
2328      lblGraph.Left := chtChart.Left + ((chtChart.Width - lblGraph.Width) div 2);
2329      lblGraph.Top := 2;
2330      lblGraph.Visible := true;
2331      if length(Piece(specimen, '^', 2)) > 0 then
2332        pnlChart.Caption := '<No results can be graphed for ' + serTest.Title + ' in this date range.> '
2333      else
2334        pnlChart.Caption := '<No results can be graphed for ' + Piece(test, '^', 2) + ' in this date range.>';
2335      chtChart.Visible := false;
2336    end
2337    else
2338      lblGraph.Visible := false;
2339    if not chkZoom.Checked then
2340    begin
2341      chtChart.UndoZoom;
2342      chtChart.ZoomPercent(ZOOM_PERCENT);
2343    end;
2344  end;