//---------------------------------------------------------------------------

#include <vcl.h>
#include "ITSSkinF.h"
#include "ITSUtilF.h"
#include "ITSDbF.h"
#include "AppGlobalF.h"
#include "WindowMsgF.h"
#include "ITSLangTransF.h"
#include "ITS_OPLibF.h"
#pragma hdrstop

#include "IST00702F.h"

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "FRAME_ChartF"
#pragma link "cxButtons"
#pragma link "cxCalc"
#pragma link "cxCheckBox"
#pragma link "cxClasses"
#pragma link "cxContainer"
#pragma link "cxControls"
#pragma link "cxCustomData"
#pragma link "cxData"
#pragma link "cxDataStorage"
#pragma link "cxEdit"
#pragma link "cxFilter"
#pragma link "cxGraphics"
#pragma link "cxGrid"
#pragma link "cxGridBandedTableView"
#pragma link "cxGridCustomTableView"
#pragma link "cxGridCustomView"
#pragma link "cxGridLevel"
#pragma link "cxGridTableView"
#pragma link "cxLookAndFeelPainters"
#pragma link "cxLookAndFeels"
#pragma link "cxSplitter"
#pragma link "cxStyles"
#pragma link "cxTextEdit"
#pragma link "dxSkinBlack"
#pragma link "dxSkinBlue"
#pragma link "dxSkinsCore"
#pragma link "dxSkinscxPCPainter"
#pragma link "dxSkinMcSkin"
#pragma resource "*.dfm"

TIST00702 *IST00702 = NULL;

//---------------------------------------------------------------------------
__fastcall TIST00702::TIST00702(TComponent* Owner, HWND hHandle,
                                String ALinkId, String AStTime, String AEdTime, int ALinkLevel, int AStatType, String AStTerm, String AEdTerm, bool AShowChart/*=false*/)
    : TForm(Owner)
{           
    LangTrans->Translate(this, ITSDb_GetConnection());
    ITSSkin_Load(this);
    CMM_LoadForm(g_sFormsDir, this);

    FParent      = hHandle;

    FLinkId    = ALinkId;
	FStTime    = AStTime;
    FEdTime    = AEdTime;
	FStTerm    = AStTerm;
    FEdTerm    = AEdTerm;
    FLinkLevel = ALinkLevel;
    FStatType  = AStatType;

    FShowChart = AShowChart;
    if (FShowChart)
    {
        ColSeq->Visible = false;
    }
    else
    {
        PnlChart->Visible = false;
        cxSplitter1->Visible = false;
        ColSeq->Visible = true;
    }
}
//---------------------------------------------------------------------------
__fastcall TIST00702::~TIST00702(void)
{
}
//--------------------------------------------------------------------------

void __fastcall TIST00702::FormInit()
{
    ADOQry->Connection = ITSDb_GetConnection();
    m_pGDC = TvList->DataController;

    TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<소통정보 통계 정보>";

    FRAMEChart1->FTitle = Caption;//"소통정보 통계";
    //FRAMEChart1->SetChartLegend(FrmLang->lblStatTm->Caption, FrmLang->lblSpd->Caption);//"통계시각", "속도(Km)");
    FRAMEChart1->SetChartLegend(FrmLang->lblStatTm->Caption, "");//"통계시각", "");
    FRAMEChart1->ChartValueDisplay(FRAMEChart1->ChkDisplayVal->Checked);
    FRAMEChart1->TvChart->ToolBox->CustomizeButton = true;
    FRAMEChart1->TvChart->Legend->Position = cppDefault;

    LblSearch->Caption = FrmLang->lblQryCond->Caption + FLinkId + " " + FStTime + "~" + FEdTime ;
}
//---------------------------------------------------------------------------

void __fastcall TIST00702::FormShow(TObject *Sender)
{
    FormInit();
    Refresh();
    TmrShow->Enabled = true;
}
//---------------------------------------------------------------------------

void __fastcall TIST00702::CommClose()
{
    CMM_SaveForm(g_sFormsDir, this);
    //IST00702 = NULL;
}
//---------------------------------------------------------------------------

void __fastcall TIST00702::TmrShowTimer(TObject *Sender)
{
    TmrShow->Enabled = false; 
    Application->ProcessMessages();
    SelHistory();
}
//---------------------------------------------------------------------------

void __fastcall TIST00702::ChkExpandClick(TObject *Sender)
{
    CMM_ExpandCollapseChk(TvList, ChkExpand->Checked);
}
//---------------------------------------------------------------------------

void __fastcall TIST00702::SelHistory()
{
    TSqlCursor sqlCrs;

    String sTemp;
    String sQry;
    TADOQuery *pADO = ADOQry;

    String sDateFormat;
    FDateFormat = STR_DATETIME;
    switch(FStatType)
    {
    case 0: //15분 통계
    case 1: //시간 통계(1시간)
        FDateFormat = STR_HHNN;
        sDateFormat = "SUBSTR(STAT_DT, 1, 12) DATES, TO_DATE(SUBSTR(STAT_DT, 1, 12), 'YYYY-MM-DD HH24:MI') AS DATENM, ";
        break;
    default: return;
    }

    String sStatTable;
	if (FLinkLevel == 0)
    {
        switch(FStatType)
        {
        case 0:  sStatTable = "TB_LINK_15M_STAT"; break;
        case 1:  sStatTable = "TB_LINK_HH_STAT";  break;
        case 2:  sStatTable = "TB_LINK_DD_STAT";  break;
        case 3:  sStatTable = "TB_LINK_MN_STAT";  break;
        case 4:  sStatTable = "TB_LINK_YY_STAT";  break;
        }

        if (FShowChart)
        {
            sQry = "SELECT A.LINK_ID ID, A.DATENM, 1 AS ORD,                                                      \r\n"
                   "       (NVL(TRIM(C.NODE_NAME), 'NoData')||' - '||NVL(TRIM(D.NODE_NAME), 'NoData')) SECT_NAME, \r\n"
                   "       B.LINK_LENG SECT_LNGT,                                                                 \r\n"
                   "       A.DATES, A.TFVL, A.SPED, A.OCPY_RATE, A.TRVL_HH                                        \r\n"
                   "  FROM (SELECT LINK_ID,                                                                       \r\n"
                   "               " + sDateFormat + "                                                            \r\n"
                   "               TFVL, SPED, OCPY_RATE, TRVL_HH                                                 \r\n"
                   "          FROM " + sStatTable + " A                                                           \r\n"
                   "         WHERE LINK_ID = :p01                                                                 \r\n"
                   "           AND STAT_DT BETWEEN :p02 AND :p03                                                  \r\n"
                   "           AND SUBSTR(STAT_DT, 9, 6) BETWEEN :p04 AND :p05                                    \r\n"
                   "       ) A,                                                                                   \r\n"
                   "       TB_LINK B, TB_NODE C, TB_NODE D                                                        \r\n"
                   " WHERE B.DEL_YN    = 'N'                                                                      \r\n"
                   "   AND A.LINK_ID   = B.LINK_ID                                                                \r\n"
                   "   AND B.F_NODE_ID = C.NODE_ID(+)                                                             \r\n"
                   "   AND B.T_NODE_ID = D.NODE_ID(+)                                                             \r\n"
                   " ORDER BY DATES                                                                               \r\n";
        }
        else
        {
            sQry = "SELECT A.LINK_ID ID, A.DATENM, A.ORD,                                                         \r\n"
                   "       (NVL(TRIM(C.NODE_NAME), 'NoData')||' - '||NVL(TRIM(D.NODE_NAME), 'NoData')) SECT_NAME, \r\n"
                   "       B.LINK_LENG SECT_LNGT,                                                                 \r\n"
                   "       A.DATES, A.TFVL, A.SPED, A.OCPY_RATE, A.TRVL_HH                                        \r\n"
                   "  FROM (SELECT A.LINK_ID, B.ORD,                                                              \r\n"
                   "               " + sDateFormat + "                                                            \r\n"
                   "               TFVL, SPED, OCPY_RATE, TRVL_HH                                                 \r\n"
                   "          FROM " + sStatTable + " A,                                                          \r\n"
                   "               (SELECT C.LINK_ID,                                                             \r\n"
                   "                       RANK() OVER(PARTITION BY A.ATRD_ID ORDER BY A.ORD, B.ORD, C.ORD) AS ORD\r\n"
//                   "                  FROM TB_ATRD_RLTN_ROAD A, TB_ROAD_RLTN_IFSC B, TB_IFSC_RLTN_LINK C          \r\n"
                   "                  FROM TB_ATRD_ROAD_RLTN A, TB_ROAD_IFSC_RLTN B, TB_IFSC_LINK_RLTN C          \r\n"
                   "                 WHERE A.ATRD_ID = :p01                                                       \r\n"
                   "                   AND A.ROAD_ID = B.ROAD_ID                                                  \r\n"
                   "                   AND B.IFSC_ID = C.IFSC_ID ) B                                              \r\n"
                   "         WHERE A.LINK_ID = B.LINK_ID                                                          \r\n"
                   "           AND STAT_DT BETWEEN :p02 AND :p03                                                  \r\n"
                   "           AND SUBSTR(STAT_DT, 9, 6) BETWEEN :p04 AND :p05                                    \r\n"
                   "       ) A,                                                                                   \r\n"
                   "       TB_LINK B, TB_NODE C, TB_NODE D                                                        \r\n"
                   " WHERE B.DEL_YN    = 'N'                                                                      \r\n"
                   "   AND A.LINK_ID   = B.LINK_ID                                                                \r\n"
                   "   AND B.F_NODE_ID = C.NODE_ID(+)                                                             \r\n"
                   "   AND B.T_NODE_ID = D.NODE_ID(+)                                                             \r\n"
                   " ORDER BY ORD, DATES                                                                          \r\n";
        }
    }
	else
    if (FLinkLevel == 1)
    {
        switch(FStatType)
        {
        case 0:  sStatTable = "TB_IFSC_15M_STAT"; break;
        case 1:  sStatTable = "TB_IFSC_HH_STAT";  break;
        case 2:  sStatTable = "TB_IFSC_DD_STAT";  break;
        case 3:  sStatTable = "TB_IFSC_MN_STAT";  break;
        case 4:  sStatTable = "TB_IFSC_YY_STAT";  break;
        }

        if (FShowChart)
        {
            sQry = "SELECT A.IFSC_ID ID, A.DATENM, 1 AS ORD,                                                      \r\n"
                   "       (NVL(TRIM(C.NODE_NAME), 'NoData')||' - '||NVL(TRIM(D.NODE_NAME), 'NoData')) SECT_NAME, \r\n"
                   "       B.SECT_LNGT SECT_LNGT,                                                                 \r\n"
                   "       A.DATES, A.TFVL, A.SPED, A.OCPY_RATE, A.TRVL_HH                                        \r\n"
                   "  FROM (SELECT IFSC_ID,                                                                       \r\n"
                   "               " + sDateFormat + "                                                            \r\n"
                   "               TFVL, SPED, OCPY_RATE, TRVL_HH                                                 \r\n"
                   "          FROM " + sStatTable + " A                                                           \r\n"
                   "         WHERE IFSC_ID = :p01                                                                 \r\n"
                   "           AND STAT_DT BETWEEN :p02 AND :p03                                                  \r\n"
                   "           AND SUBSTR(STAT_DT, 9, 6) BETWEEN :p04 AND :p05                                    \r\n"
                   "       ) A,                                                                                   \r\n"
                   "       TB_IFSC B, TB_NODE C, TB_NODE D                                                        \r\n"
                   "  WHERE B.DEL_YN = 'N'                                                                        \r\n"
                   "    AND A.IFSC_ID = B.IFSC_ID                                                                 \r\n"
                   "    AND B.F_NODE_ID = C.NODE_ID(+)                                                            \r\n"
                   "    AND B.T_NODE_ID = D.NODE_ID(+)                                                            \r\n"
                   " ORDER BY DATES                                                                               \r\n";
        }
        else
        {
            sQry = "SELECT A.IFSC_ID ID, A.DATENM, A.ORD,                                                         \r\n"
                   "       (NVL(TRIM(C.NODE_NAME), 'NoData')||' - '||NVL(TRIM(D.NODE_NAME), 'NoData')) SECT_NAME, \r\n"
                   "       B.SECT_LNGT SECT_LNGT,                                                                 \r\n"
                   "       A.DATES, A.TFVL, A.SPED, A.OCPY_RATE, A.TRVL_HH                                        \r\n"
                   "  FROM (SELECT A.IFSC_ID, B.ORD,                                                              \r\n"
                   "               " + sDateFormat + "                                                            \r\n"
                   "               TFVL, SPED, OCPY_RATE, TRVL_HH                                                 \r\n"
                   "          FROM " + sStatTable + " A,                                                          \r\n"
                   "               (SELECT B.IFSC_ID,                                                             \r\n"
                   "                       RANK() OVER(PARTITION BY A.ATRD_ID ORDER BY A.ORD, B.ORD) AS ORD       \r\n"
//                   "                  FROM TB_ATRD_RLTN_ROAD A, TB_ROAD_RLTN_IFSC B                               \r\n"
                   "                  FROM TB_ATRD_ROAD_RLTN A, TB_ROAD_IFSC_RLTN B                               \r\n"
                   "                 WHERE A.ATRD_ID = :p01                                                       \r\n"
                   "                   AND A.ROAD_ID = B.ROAD_ID ) B                                              \r\n"
                   "         WHERE A.IFSC_ID = B.IFSC_ID                                                          \r\n"
                   "           AND STAT_DT BETWEEN :p02 AND :p03                                                  \r\n"
                   "           AND SUBSTR(STAT_DT, 9, 6) BETWEEN :p04 AND :p05                                    \r\n"
                   "       ) A,                                                                                   \r\n"
                   "       TB_IFSC B, TB_NODE C, TB_NODE D                                                        \r\n"
                   "  WHERE B.DEL_YN = 'N'                                                                        \r\n"
                   "    AND A.IFSC_ID = B.IFSC_ID                                                                 \r\n"
                   "    AND B.F_NODE_ID = C.NODE_ID(+)                                                            \r\n"
                   "    AND B.T_NODE_ID = D.NODE_ID(+)                                                            \r\n"
                   " ORDER BY ORD, DATES                                                                          \r\n";
        }
    }
	else
    //if (FLinkLevel == 2)
    {
        switch(FStatType)
        {
        case 0:  sStatTable = "TB_ROAD_15M_STAT"; break;
        case 1:  sStatTable = "TB_ROAD_HH_STAT";  break;
        case 2:  sStatTable = "TB_ROAD_DD_STAT";  break;
        case 3:  sStatTable = "TB_ROAD_MN_STAT";  break;
        case 4:  sStatTable = "TB_ROAD_YY_STAT";  break;
        }

        if (FShowChart)
        {
            sQry = "SELECT A.ROAD_ID ID, A.DATENM, 1 AS ORD,                                                      \r\n"
                   "       (NVL(TRIM(C.NODE_NAME), 'NoData')||' - '||NVL(TRIM(D.NODE_NAME), 'NoData')) SECT_NAME, \r\n"
                   "       B.SECT_LNGT SECT_LNGT,                                                                 \r\n"
                   "       A.DATES, A.TFVL, A.SPED, A.OCPY_RATE, A.TRVL_HH                                        \r\n"
                   "  FROM (SELECT ROAD_ID,                                                                       \r\n"
                   "               " + sDateFormat + "                                                            \r\n"
                   "               TFVL, SPED, OCPY_RATE, TRVL_HH                                                 \r\n"
                   "          FROM " + sStatTable + " A                                                           \r\n"
                   "         WHERE ROAD_ID = :p01                                                                 \r\n"
                   "           AND STAT_DT BETWEEN :p02 AND :p03                                                  \r\n"
                   "           AND SUBSTR(STAT_DT, 9, 6) BETWEEN :p04 AND :p05                                    \r\n"
                   "       ) A,                                                                                   \r\n"
                   "       TB_ROAD B, TB_NODE C, TB_NODE D                                                        \r\n"
                   "  WHERE B.DEL_YN = 'N'                                                                        \r\n"
                   "    AND A.ROAD_ID = B.ROAD_ID                                                                 \r\n"
                   "    AND B.F_NODE_ID = C.NODE_ID(+)                                                            \r\n"
                   "    AND B.T_NODE_ID = D.NODE_ID(+)                                                            \r\n"
                   " ORDER BY DATES                                                                               \r\n";
        }
        else
        {
            sQry = "SELECT A.ROAD_ID ID, A.DATENM, A.ORD,                                                         \r\n"
                   "       (NVL(TRIM(C.NODE_NAME), 'NoData')||' - '||NVL(TRIM(D.NODE_NAME), 'NoData')) SECT_NAME, \r\n"
                   "       B.SECT_LNGT SECT_LNGT,                                                                 \r\n"
                   "       A.DATES, A.TFVL, A.SPED, A.OCPY_RATE, A.TRVL_HH                                        \r\n"
                   "  FROM (SELECT A.ROAD_ID, B.ORD,                                                              \r\n"
                   "               " + sDateFormat + "                                                            \r\n"
                   "               TFVL, SPED, OCPY_RATE, TRVL_HH                                                 \r\n"
                   "          FROM " + sStatTable + " A,                                                          \r\n"
                   "               (SELECT ROAD_ID, ORD                                                           \r\n"
//                   "                  FROM TB_ATRD_RLTN_ROAD                                                      \r\n"
                   "                  FROM TB_ATRD_ROAD_RLTN                                                      \r\n"
                   "                 WHERE ATRD_ID = :p01) B                                                      \r\n"
                   "         WHERE A.ROAD_ID = B.ROAD_ID                                                          \r\n"
                   "           AND A.STAT_DT BETWEEN :p02 AND :p03                                                \r\n"
                   "           AND SUBSTR(A.STAT_DT, 9, 6) BETWEEN :p04 AND :p05                                  \r\n"
                   "       ) A,                                                                                   \r\n"
                   "       TB_ROAD B, TB_NODE C, TB_NODE D                                                        \r\n"
                   "  WHERE B.DEL_YN = 'N'                                                                        \r\n"
                   "    AND A.ROAD_ID = B.ROAD_ID                                                                 \r\n"
                   "    AND B.F_NODE_ID = C.NODE_ID(+)                                                            \r\n"
                   "    AND B.T_NODE_ID = D.NODE_ID(+)                                                            \r\n"
                   " ORDER BY ORD, DATES                                                                          \r\n";
        }
    }


    try
    {
        ITSDb_SQLText(pADO, sQry);
        ITSDb_SQLBind(pADO, "p01", FLinkId);
        ITSDb_SQLBind(pADO, "p02", FStTime);
        ITSDb_SQLBind(pADO, "p03", FEdTime);
        ITSDb_SQLBind(pADO, "p04", FStTerm);
        ITSDb_SQLBind(pADO, "p05", FEdTerm);

        ITSDb_SQLOpen(pADO);

        DspHistory();
    }
    catch(EDatabaseError &E)
    {
        ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
        DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
        throw Exception(String(E.ClassName()) + E.Message);
    }
    catch(Exception &e)
    {
        ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
        DBERRORMSG(Caption, String(e.ClassName()), e.Message, sQry);
        throw Exception(String(e.ClassName()) + e.Message);
    }
}
//---------------------------------------------------------------------------

void __fastcall TIST00702::DspHistory()
{
    TADOQuery *pADO = ADOQry;
    TcxGridChartView *TvChart = FRAMEChart1->TvChart;

    try
    {
    	TcxGridChartSeries *pChart1 = NULL;
    	TcxGridChartSeries *pChart2 = NULL;

        TvChart->ClearSeries();
        FRAMEChart1->ChartValueDisplay(FRAMEChart1->ChkDisplayVal->Checked);

        CMM_ClearGridTableView(TvList);

        int nRow = 0;
        int nDataCnt = 0;
        try
        {
            TvList->BeginUpdate();
            TvChart->BeginUpdate();

            nDataCnt = pADO->RecordCount;
            m_pGDC->RecordCount = nDataCnt;

            if (FShowChart)
            {
                TvChart->DataController->RecordCount = nDataCnt;

                pChart1 = TvChart->CreateSeries();
                pChart1->DataBinding->ValueType = "Integer";
                pChart1->DisplayText = FrmLang->lblSpd->Caption;//"속도(km/h)";

                pChart2 = TvChart->CreateSeries();
                pChart2->DataBinding->ValueType = "Integer";
                pChart2->DisplayText = FrmLang->lblTrvTm->Caption;//"통행시간(초)";
            }

            for( ; !pADO->Eof; pADO->Next(), nRow++)
            {
#if 0
                String sDate = pADO->FieldByName("DATES")->AsString;

                if (sDate.Length() > 13) sDate.Insert( ":", 13);
                if (sDate.Length() > 11) sDate.Insert( ":", 11);
                if (sDate.Length() >  9) sDate.Insert( " ",  9);

                sDate.Insert("-", 7);
                sDate.Insert("-", 5);
#endif
                m_pGDC->Values[nRow][Column01->Index] = pADO->FieldByName("ID")->AsString;          //구간 ID
                m_pGDC->Values[nRow][Column02->Index] = pADO->FieldByName("SECT_NAME")->AsString;   //명칭
                m_pGDC->Values[nRow][Column03->Index] = pADO->FieldByName("SECT_LNGT")->AsString;   //길이
                String sDbDate = pADO->FieldByName("DATES")->AsString;
                m_pGDC->Values[nRow][Column04->Index] = APP_FormatStr(sDbDate, FDateFormat);      //통계시각

                m_pGDC->Values[nRow][Column05->Index] = pADO->FieldByName("TFVL")->AsString;        //교통량
                m_pGDC->Values[nRow][Column06->Index] = pADO->FieldByName("SPED")->AsInteger;       //속도
                m_pGDC->Values[nRow][Column07->Index] = pADO->FieldByName("OCPY_RATE")->AsFloat;    //점유율
                m_pGDC->Values[nRow][Column08->Index] = pADO->FieldByName("TRVL_HH")->AsInteger;    //통행시간

                if (FShowChart)
                {
                    pChart1->Values[nRow] = m_pGDC->Values[nRow][Column06->Index];
                    pChart2->Values[nRow] = m_pGDC->Values[nRow][Column08->Index];

                    TvChart->Categories->Values[nRow] = m_pGDC->Values[nRow][Column04->Index];
                }
                else
                {
                    m_pGDC->Values[nRow][ColSeq->Index] = pADO->FieldByName("ORD")->AsString;
                }
            }
        }
        __finally
        {
            if (pADO)
            {
                pADO->Close();
            }

    		TvChart->EndUpdate();
            TvList->EndUpdate();
            //CxList->SetFocus();
            LblRecords->Caption = FormatFloat("##,##0", m_pGDC->RecordCount) + FrmLang->lblEA->Caption;//" 건";

            String sEnd = FrmLang->lblQrySel->Caption + " [" + LblRecords->Caption + "]";//"데이터 " + LblRecords->Caption + " 이 조회 되었습니다.";
            Application->MessageBox(sEnd.c_str(),
                                    FrmLang->lblQryEnd->Caption.c_str(),//L"데이터 조회 완료",
                                    MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
        }
    }
    catch(EDatabaseError &E)
    {
        ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
        DBERRORMSG(Caption, String(E.ClassName()), E.Message, pADO->SQL->Text);
        throw Exception(String(E.ClassName()) + E.Message);
    }
    catch(Exception &e)
    {
        ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
        DBERRORMSG(Caption, String(e.ClassName()), e.Message, pADO->SQL->Text);
        throw Exception(String(e.ClassName()) + e.Message);
    }
}
//---------------------------------------------------------------------------

void __fastcall TIST00702::OnMessage(TMessage &Msg)
{
    switch (Msg.Msg)
    {
    case WM_PARAM_DATABASE:
        if (WP_DB_SELECT_OK == Msg.WParam)
        {
            //ShowMessage("Select Ok");
        }
        break;
    }
}
//---------------------------------------------------------------------------

void __fastcall TIST00702::BtnExlSaveClick(TObject *Sender)
{
    TcxGrid          *pGrid = CxList;
    TcxGridTableView *pView = TvList;
    String            sTitle= Caption;//"간선도로소통정보통계";

    CMM_ExportToExcelFile(sTitle, pGrid, pView, this);
}
//---------------------------------------------------------------------------

void __fastcall TIST00702::FormClose(TObject *Sender, TCloseAction &Action)
{
    POST_MSG(FParent, WM_SUBFORM_CLOSE, 0, 0);
    CommClose();
    //IST00702 = NULL;
}
//---------------------------------------------------------------------------

void __fastcall TIST00702::FormDestroy(TObject *Sender)
{
    CommClose();
}
//---------------------------------------------------------------------------

