Procedure

TfrmLabs.lstDatesClick

Module

fLabs

Last Modified

7/15/2014 3:26:38 PM

Visibility

Public/Published

Owner

TfrmLabs

Declaration

procedure lstDatesClick(Sender: TObject);

Calls Hierarchy


TfrmLabs.lstDatesClick
 ├TfrmLabs.DisplayHeading
 │ └ValidDateTimeStr
 ├TfrmLabs.ChkBrowser
 │ └TfrmLabs.BlankWeb
 ├TfrmLabs.FMToDateTime
 ├FMToday
 │ └FMNow
 ├TfrmLabs.BeginEndDates
 │ ├TfrmLabs.FMToDateTime
 │ └FMToday...
 ├TfrmLabs.BlankWeb
 ├TfrmLabs.GoRemoteOld
 │ ├TRemoteSite.LabClear
 │ ├TfrmLabs.UpdateRemoteStatus
 │ ├GetRemoteData
 │ ├RemoteLabReports
 │ ├RemoteLabCumulative
 │ ├RemoteLabInterim
 │ ├RemoteLabMicro
 │ └RemoteLab
 ├Cumulative
 ├Interim
 ├InterimSelect
 ├Worksheet
 ├TfrmLabs.HGrid
 │ └LabPatchInstalled
 │   └ServerHasPatch
 ├TfrmLabs.VGrid
 │ └LabPatchInstalled...
 ├TfrmLabs.GraphList
 ├TfrmLabs.GridComments
 ├TfrmLabs.ragCorGClick
 │ ├TfrmLabs.chk3DClick
 │ ├TfrmLabs.chkValuesClick
 │ └TfrmLabs.lstTestGraphClick
 │   └TfrmLabs.WorksheetChart
 │     ├TfrmLabs.GetStartStop
 │     ├OkFloatValue
 │     └TfrmLabs.FMToDateTime
 ├TfrmLabs.chkGraphZoomClick
 ├GetChart
 ├TfrmLabs.GraphChart
 │ └TfrmLabs.FMToDateTime
 ├Micro
 └Reports

Called-By Hierarchy


                               TfrmLabs.lstDatesClick
                            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┘         

Calls

Name Declaration Comments
TfrmLabs.BeginEndDates procedure BeginEndDates(var ADate1, ADate2: TFMDateTime; var ADaysBack: integer); -
TfrmLabs.BlankWeb procedure BlankWeb; -
TfrmLabs.ChkBrowser procedure ChkBrowser; -
TfrmLabs.chkGraphZoomClick procedure chkGraphZoomClick(Sender: TObject); -
Cumulative procedure Cumulative(Dest: TStrings; const PatientDFN: string; daysback: integer; ADate1, ADate2: TFMDateTime; ARpc: string); -
TfrmLabs.DisplayHeading procedure DisplayHeading(aRanges: string); -
TfrmLabs.FMToDateTime function FMToDateTime(FMDateTime: string): TDateTime; -
FMToday function FMToday: TFMDateTime; -
GetChart function GetChart(const PatientDFN: string; ADate1, ADate2: TFMDateTime; spec, test: string): TStrings; -
TfrmLabs.GoRemoteOld procedure GoRemoteOld(Dest: TStringList; AItem, AReportID: Int64; AQualifier, ARpc, AHSType, ADaysBack, ASection: string; ADate1, ADate2: TFMDateTime); -
TfrmLabs.GraphChart procedure GraphChart(test: string; aitems: TStrings); -
TfrmLabs.GraphList procedure GraphList(griddata: TStrings); -
TfrmLabs.GridComments procedure GridComments(aitems: TStrings); -
TfrmLabs.HGrid procedure HGrid(griddata: TStrings); -
Interim procedure Interim(Dest: TStrings; const PatientDFN: string; ADate1, ADate2: TFMDateTime; ARpc: string); -
InterimSelect function InterimSelect(const PatientDFN: string; ADate1, ADate2: TFMDateTime; tests: TStrings): TStrings; -
Micro procedure Micro(Dest: TStrings; const PatientDFN: string; ADate1, ADate2: TFMDateTime; ARpc: string); -
TfrmLabs.ragCorGClick procedure ragCorGClick(Sender: TObject); -
Reports procedure Reports(Dest: TStrings; const PatientDFN: string; reportid, hstype, ADate, section: string; Adate1, Adate2: TFMDateTime; ARpc: string); -
TfrmLabs.VGrid procedure VGrid(griddata: TStrings); -
Worksheet function Worksheet(const PatientDFN: string; ADate1, ADate2: TFMDateTime; spec: string; tests: TStrings): TStrings; -

Called-By

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


Source

1457  procedure TfrmLabs.lstDatesClick(Sender: TObject);
1458  var
1459    tmpList: TStringList;
1460    daysback: integer;
1461    date1, date2: TFMDateTime;
1462    today: TDateTime;
1463    i: integer;
1464    x,x1,x2,aID: string;
1465  begin
1466    inherited;
1467    uRemoteCount := 0;
1468    Timer1.Interval := 3000;
1469    if uFrozen = True then memo1.visible := False;
1470    Screen.Cursor := crHourGlass;
1471    DisplayHeading('');
1472    uHTMLDoc := '';
1473    ChkBrowser;
1474    if (lstDates.ItemID = 'S') then
1475    begin
1476      with calLabRange do
1477      begin
1478        if Execute then
1479          if Length(TextOfStart) > 0 then
1480            if Length(TextOfStop) > 0 then
1481              begin
1482                lstDates.ItemIndex := lstDates.Items.Add(RelativeStart + ';' +
1483                  RelativeStop + U + TextOfStart + ' to ' + TextOfStop);
1484                  DisplayHeading('');
1485              end
1486            else
1487              lstDates.ItemIndex := -1
1488          else
1489            lstDates.ItemIndex := -1
1490        else
1491          lstDates.ItemIndex := -1;
1492      end;
1493    end;
1494    today := FMToDateTime(floattostr(FMToday));
1495    if lstDates.ItemIEN > 0 then
1496      begin
1497        daysback := lstDates.ItemIEN;
1498        date1 := FMToday;
1499        If daysback = 1 then
1500          date2 := DateTimeToFMDateTime(today)
1501        Else
1502          date2 := DateTimeToFMDateTime(today - daysback);
1503      end
1504    else
1505      BeginEndDates(date1,date2,daysback);
1506    date1 := date1 + 0.2359;
1507    uHTMLDoc := '';
1508    BlankWeb;
1509    aID := piece(uRptID,':',1);
1510    if aID = '21' then
1511      begin                // Cumulative
1512        lstHeaders.Clear;
1513        memLab.Clear;
1514        uLabLocalReportData.Clear;
1515        uLabRemoteReportData.Clear;
1516        StatusText('Retrieving data for cumulative report...');
1517        GoRemoteOld(uLabRemoteReportData,21,2,'',uReportRPC,'',IntToStr(daysback),'',date1,date2);
1518        TabControl1.OnChange(nil);
1519        Cumulative(uLabLocalReportData, Patient.DFN, daysback, date1, date2, uReportRPC);
1520        if uLabLocalReportData.Count > 0 then
1521         begin
1522           TabControl1.OnChange(nil);
1523           if lstHeaders.Items.Count > 0 then lstHeaders.ItemIndex := 0;
1524         end;
1525        memLab.Lines.Insert(0,' ');
1526        memLab.Lines.Delete(0);
1527      end
1528    else if aID = '3' then
1529      begin            // Interim
1530        memLab.Clear;
1531        uLabLocalReportData.Clear;
1532        uLabRemoteReportData.Clear;
1533        StatusText('Retrieving data for interim report...');
1534        GoRemoteOld(uLabRemoteReportData,3,3,'',uReportRPC,'','','',date1,date2);
1535        TabControl1.OnChange(nil);
1536        Interim(uLabLocalReportData, Patient.DFN, date1, date2, uReportRPC);
1537        if uLabLocalReportData.Count < 1 then
1538         uLabLocalReportData.Add('<No results for this date range.>');
1539        if TabControl1.TabIndex < 1 then
1540         QuickCopy(uLabLocalReportData,memLab);
1541        memLab.Lines.Insert(0,' ');
1542        memLab.Lines.Delete(0);
1543        memLab.SelStart := 0;
1544      end
1545    else if aID = '4' then
1546      begin            // Interim for Selected Tests
1547        memLab.Clear;
1548        uLabLocalReportData.Clear;
1549        uLabRemoteReportData.Clear;
1550        try
1551         StatusText('Retrieving data for selected tests...');
1552         FastAssign(InterimSelect(Patient.DFN, date1, date2, lstTests.Items), uLabLocalReportData);
1553         if uLabLocalReportData.Count > 0 then
1554           QuickCopy(uLabLocalReportData,memLab)
1555         else
1556           memLab.Lines.Add('<No results for selected tests in this date range.>');
1557         memLab.SelStart := 0;
1558        finally
1559         //tmpList.Free;
1560        end;
1561     end
1562    else if aID = '5' then
1563      begin            // Worksheet
1564        chtChart.BottomAxis.Automatic := true;
1565        chkZoom.Checked := false;
1566        chkAbnormals.Checked := false;
1567        memLab.Clear;
1568        uLabLocalReportData.Clear;
1569        uLabRemoteReportData.Clear;
1570        grdLab.Align := alClient;
1571        StatusText('Retrieving data for worksheet...');
1572        FastAssign(Worksheet(Patient.DFN, date1, date2,
1573         Piece(lblSpecimen.Caption, '^', 1), lstTests.Items), tmpGrid);
1574        if ragHorV.ItemIndex = 0 then
1575         HGrid(tmpGrid)
1576        else
1577         VGrid(tmpGrid);
1578        GraphList(tmpGrid);
1579        GridComments(tmpGrid);
1580        ragCorGClick(self);
1581     end
1582    else if aID = '6' then
1583      begin            // Graph
1584       if not uGraphingActivated then
1585         begin
1586           chtChart.BottomAxis.Automatic := true;
1587           chkGraphZoom.Checked := false;
1588           chkGraphZoomClick(self);
1589           memLab.Clear;
1590           uLabLocalReportData.Clear;
1591           uLabRemoteReportData.Clear;
1592           tmpList := TStringList.Create;
1593           try
1594             StatusText('Retrieving data for graph...');
1595             FastAssign(GetChart(Patient.DFN, date1, date2,
1596               Piece(lblSpecimen.Caption, '^', 1),
1597               Piece(lblSingleTest.Caption, '^', 1)), tmpList);
1598             if tmpList.Count > 1 then
1599             begin
1600               chtChart.Visible := true;
1601               GraphChart(lblSingleTest.Caption, tmpList);
1602               chtChart.ZoomPercent(ZOOM_PERCENT);
1603               for i := strtoint(Piece(tmpList[0], '^', 1)) + 1 to tmpList.Count - 1
1604                 do memLab.Lines.Add(tmpList[i]);
1605               if memLab.Lines.Count < 2 then
1606                 memLab.Lines.Add('<No comments on specimens.>');
1607               memLab.SelStart := 0;
1608               lblGraph.Visible := false;
1609             end
1610             else
1611             begin
1612               lblGraph.Left := chtChart.Left + ((chtChart.Width - lblGraph.Width) div 2);
1613               lblGraph.Top := 2;
1614               lblGraph.Visible := true;
1615               if Piece(lblSpecimen.Caption, '^', 1) = '0' then
1616                 pnlChart.Caption := '<No results can be graphed for ' +
1617                   Piece(lblSingleTest.Caption, '^', 2) + ' in this date range.> '
1618                   + 'Results may be available, but cannot be graphed. Please try an alternate view.'
1619               else
1620                 pnlChart.Caption := '<No results can be graphed for ' +
1621                   Piece(lblSingleTest.Caption, '^', 2)
1622                   + ' (' + Piece(lblSpecimen.Caption, '^', 2) +
1623                     ') in this date range.> '
1624                   + 'Results may be available, but cannot be graphed. Please try an alternate view.';
1625               chtChart.Visible := false;
1626             end;
1627           finally
1628             tmpList.Free;
1629           end;
1630         end;
1631      end
1632    else if aID = '9' then
1633      begin            // Micro
1634        memLab.Clear;
1635        uLabLocalReportData.Clear;
1636        uLabRemoteReportData.Clear;
1637        StatusText('Retrieving microbiology data...');
1638        GoRemoteOld(uLabRemoteReportData,4,4,'',uReportRPC,'','','',date1,date2);
1639        TabControl1.OnChange(nil);
1640        Micro(uLabLocalReportData, Patient.DFN, date1, date2, uReportRPC);
1641        if uLabLocalReportData.Count < 1 then
1642         uLabLocalReportData.Add('<No microbiology results for this date range.>');
1643        if TabControl1.TabIndex < 1 then
1644         QuickCopy(uLabLocalReportData,memLab);
1645        memLab.Lines.Insert(0,' ');
1646        memLab.Lines.Delete(0);
1647        memLab.SelStart := 0;
1648      end
1649    else if aID = '10' then
1650      begin           // Lab Status
1651        memLab.Clear;
1652        uLabLocalReportData.Clear;
1653        uLabRemoteReportData.Clear;
1654        StatusText('Retrieving lab status data...');
1655        GoRemoteOld(uLabRemoteReportData,10,1,'',uReportRPC,'',IntToStr(daysback),'',date1,date2);
1656        TabControl1.OnChange(nil);
1657        Reports(uLabLocalReportData,Patient.DFN, 'L:10', '', IntToStr(daysback),'',
1658         date1, date2, uReportRPC);
1659        if uLabLocalReportData.Count < 1 then
1660          uLabLocalReportData.Add('<No laboratory orders for this date range.>');
1661        if TabControl1.TabIndex < 1 then
1662          QuickCopy(uLabLocalReportData,memLab);
1663        memLab.Lines.Insert(0,' ');
1664        memLab.Lines.Delete(0);
1665        memLab.SelStart := 0;
1666      end
1667    else begin          //Anything Else
1668           lstHeaders.Clear;
1669           memLab.Clear;
1670           uLabLocalReportData.Clear;
1671           uLabRemoteReportData.Clear;
1672           StatusText('Retrieving lab data...');
1673           GoRemoteOld(uLabRemoteReportData, 1, 1, '', uReportRPC, '', IntToStr(daysback), '', date1, date2);
1674           TabControl1.OnChange(nil);
1675           Reports(uLabLocalReportData,Patient.DFN, 'L:' + Piece(uRptID,'^',1), '',
1676             IntToStr(daysback), '', date1, date2, uReportRPC);
1677           if uLabLocalReportData.Count < 1 then
1678             uLabLocalReportData.Add('<No data for this date range.>');
1679           if TabControl1.TabIndex < 1 then
1680             QuickCopy(uLabLocalReportData,memLab);
1681           memLab.Lines.Insert(0,' ');
1682           memLab.Lines.Delete(0);
1683           memLab.SelStart := 0;
1684         end;
1685    if uReportType = 'R' then
1686      uHTMLDoc := HTML_PRE + uLabLocalReportData.Text + HTML_POST
1687    else
1688      uHTMLDoc := uHTMLPatient + uLabLocalReportData.Text;
1689    Screen.Cursor := crDefault;
1690    x := lstDates.DisplayText[lstDates.ItemIndex];
1691    x1 := piece(x,' ',1);
1692    x2 := piece(x,' ',2);
1693    if not(uRptID = '1:MOST RECENT') and (Uppercase(Copy(x1,1,1)) = 'T') and (Uppercase(Copy(x2,1,1)) = 'T') then
1694      DisplayHeading(piece(x,' ',1) + ';' + piece(x,' ',2))
1695    else
1696      DisplayHeading('d' + lstDates.ItemID);
1697    StatusText('');
1698  end;