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

#include <vcl.h>
#include <jpeg.hpp>
#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 "PRK0040MF.h"

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "cxButtons"
#pragma link "cxCalendar"
#pragma link "cxContainer"
#pragma link "cxControls"
#pragma link "cxDropDownEdit"
#pragma link "cxEdit"
#pragma link "cxGraphics"
#pragma link "cxGroupBox"
#pragma link "cxLabel"
#pragma link "cxLookAndFeelPainters"
#pragma link "cxLookAndFeels"
#pragma link "cxMaskEdit"
#pragma link "cxPC"
#pragma link "cxPCdxBarPopupMenu"
#pragma link "cxSpinEdit"
#pragma link "cxSplitter"
#pragma link "cxTextEdit"
#pragma link "cxTimeEdit"
#pragma link "dxSkinBlack"
#pragma link "dxSkinBlue"
#pragma link "dxSkinCaramel"
#pragma link "dxSkinCoffee"
#pragma link "dxSkinDarkRoom"
#pragma link "dxSkinDarkSide"
#pragma link "dxSkinFoggy"
#pragma link "dxSkinGlassOceans"
#pragma link "dxSkiniMaginary"
#pragma link "dxSkinLilian"
#pragma link "dxSkinLiquidSky"
#pragma link "dxSkinLondonLiquidSky"
#pragma link "dxSkinMcSkin"
#pragma link "dxSkinMoneyTwins"
#pragma link "dxSkinOffice2007Black"
#pragma link "dxSkinOffice2007Blue"
#pragma link "dxSkinOffice2007Green"
#pragma link "dxSkinOffice2007Pink"
#pragma link "dxSkinOffice2007Silver"
#pragma link "dxSkinOffice2010Black"
#pragma link "dxSkinOffice2010Blue"
#pragma link "dxSkinOffice2010Silver"
#pragma link "dxSkinsCore"
#pragma link "dxSkinscxPCPainter"
#pragma link "dxSkinSeven"
#pragma link "dxSkinSharp"
#pragma link "dxSkinSilver"
#pragma link "dxSkinStardust"
#pragma link "cxRadioGroup"
#pragma link "cxClasses"
#pragma link "cxCustomData"
#pragma link "cxData"
#pragma link "cxDataStorage"
#pragma link "cxDBData"
#pragma link "cxFilter"
#pragma link "cxGrid"
#pragma link "cxGridCustomTableView"
#pragma link "cxGridCustomView"
#pragma link "cxGridDBTableView"
#pragma link "cxGridLevel"
#pragma link "cxGridTableView"
#pragma link "cxStyles"
#pragma link "cxCheckBox"
#pragma link "cxImage"
#pragma link "cxButtonEdit"
#pragma link "cxBlobEdit"
#pragma resource "*.dfm"

TPRK0040M *PRK0040M = NULL;
//---------------------------------------------------------------------------

__fastcall TPRK0040M::TPRK0040M(TComponent* Owner)
    : TForm(Owner)
{
    LangTrans->Translate(this, ITSDb_GetConnection());
    ITSSkin_Load(this);
    CMM_LoadForm(g_sFormsDir, this);

    FUpdate= false;
    FTitle = Caption;//"VMS 소통정보 배경이미지관리";

	FListSymb = new TList;

    EditMode = false;

#if 0
    TvList->OptionsView->DataRowHeight  = 0;
    TvList->OptionsView->CellAutoHeight = true;
    TvList->OptionsView->Indicator      = false;

    TvList->OptionsCustomize->ColumnMoving  = false;
    TvList->OptionsCustomize->ColumnSorting = false;

    TvList->Columns[0]->Width = 60;
    TvList->Columns[0]->Options->HorzSizing = false;
#endif

    //http://docwiki.embarcadero.com/RADStudio/Rio/en/Colors_in_the_VCL
    m_Color[ 0] = Graphics::clLime;
    m_Color[ 1] = (TColor)RGB(0xFF, 0x00, 0x00);
    m_Color[ 2] = (TColor)RGB(0x00, 0x00, 0xFF);
    m_Color[ 3] = (TColor)RGB(0xFF, 0x82, 0x00);
    m_Color[ 4] = (TColor)RGB(0x94, 0x00, 0xD3);
    m_Color[ 5] = Graphics::clPurple;//(TColor)RGB(0x00, 0x00, 0x00);
    m_Color[ 6] = (TColor)RGB(0x82, 0x82, 0x82);
    m_Color[ 7] = (TColor)RGB(0x1E, 0x90, 0xFF);
    m_Color[ 8] = (TColor)RGB(0xB9, 0x06, 0x2F);
    m_Color[ 9] = (TColor)RGB(0x8c, 0x00, 0x8c);
    m_Color[10] = (TColor)RGB(0xFF, 0x82, 0x00);
    m_Color[11] = (TColor)RGB(0x94, 0x00, 0xD3);
    m_Color[12] = (TColor)RGB(0xB0, 0xC4, 0xDE);
    m_Color[13] = (TColor)RGB(0x00, 0xBF, 0xFF);
    m_Color[14] = (TColor)RGB(0x87, 0xCE, 0xEB);
    m_Color[15] = (TColor)RGB(0x87, 0xCE, 0xFA);
    m_Color[16] = (TColor)RGB(0xAD, 0xD8, 0xE6);
    m_Color[17] = (TColor)RGB(0xB0, 0xE0, 0xE6);
    m_Color[18] = (TColor)RGB(0xE6, 0xE6, 0xFA);
    m_Color[19] = (TColor)RGB(0xF0, 0xF8, 0xFF);

    ScrollBox1->Color = Color;
    cxLabel2->Style->LookAndFeel->NativeStyle = true;
    cxLabel2->Style->Font->Color = clWhite;
}
//---------------------------------------------------------------------------
TColor TPRK0040M::GetDisplayColor(int ASeq)
{
    //return g_DispColor[ASeq % MAX_DISPCOLOR];
    return m_Color[ASeq % MAX_PARK_CELL_COLOR];
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::CommClose()
{
    try
    {
        CMM_SaveForm(g_sFormsDir, this);
    }
    catch(...)
    {
    }
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::FormShow(TObject *Sender)
{
    FormInit();
    Refresh();

    LoadPrkPlce();

    //FormInit();
    TmrShow->Enabled = true;
}
//---------------------------------------------------------------------------
void __fastcall TPRK0040M::LoadPrkPlce()
{
    CbPrk->Properties->Items->Clear();

    FOR_STL(TPrkPlce*, pObj, PrkPlceManager->FLists)
    {
        if (pObj->DEL_YN != "N") continue;

        CbPrk->Properties->Items->AddObject(" [" + pObj->CTLR_NMBR + "] " + pObj->NAME, (TObject*)pObj);
    }
    CbPrk->ItemIndex = 0;

    //LoadPrkFlr();
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::CbPrkPropertiesChange(TObject *Sender)
{
    TmrQry->Enabled = false;
    TmrQry->Enabled = true;
    Application->ProcessMessages();
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::LoadPrkFlr()
{
    TSqlCursor sqlCrs;
    Application->ProcessMessages();
    try {
        CbFlr->Properties->OnChange = NULL;
        CbFlr->Properties->Items->Clear();
        FormInit();

        TPrkPlce *pObj = (TPrkPlce*)CbPrk->Properties->Items->Objects[CbPrk->ItemIndex];
        if (pObj == NULL) {
            return;
        }

        if (pObj->FDevs.Size() == 0) {
            PrkPlceManager->LoadFromDbDev(pObj);
        }
        if (pObj->FFlrs.Size() == 0) {
            PrkPlceManager->LoadFromDbFlr(pObj);
            PrkPlceManager->LoadFromDbFlrDev(pObj);
        }

        FOR_STL(TPrkPlceFlr*, pFlr, pObj->FFlrs)
        {
            CbFlr->Properties->Items->AddObject(" " + pFlr->FLR_NO + " ", (TObject*)pFlr);
        }
        CbFlr->ItemIndex = -1;
    Application->ProcessMessages();
    }
    __finally {
        CbFlr->Properties->OnChange = CbFlrPropertiesChange;
        Application->ProcessMessages();
        CbFlr->ItemIndex = 0;
        Application->ProcessMessages();
    }
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::CbFlrPropertiesChange(TObject *Sender)
{
    Application->ProcessMessages();
    LoadPrkDetailInfo();
    Application->ProcessMessages();
    EdFocus->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TPRK0040M::LoadPrkDetailInfo()
{
    TSqlCursor sqlCrs;
    FormInit();

    TPrkPlce *pObj = (TPrkPlce*)CbPrk->Properties->Items->Objects[CbPrk->ItemIndex];
    if (pObj == NULL) {
        return;
    }
    TPrkPlceFlr *pFlr = (TPrkPlceFlr*)CbFlr->Properties->Items->Objects[CbFlr->ItemIndex];
    if (pFlr == NULL) {
        return;
    }
    SeCmprtCo->Value = pFlr->FLR_PRK_CMPRT_CO;

    LoadPrkFlrImage(pObj->CTLR_NMBR, pFlr->FLR_NO);
    BtnSearchClick(NULL);
    //LoadPrkFlrDevInfo();
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::FormInit()
{
    SeCmprtCo->Value = 0;
    SeRemain->Value = 0;

    ImgPreView->Picture->Bitmap->FreeImage();
    ImgPreView->Picture->Bitmap = NULL;

    ImgTemp->Picture->Bitmap->FreeImage();
    ImgTemp->Picture->Bitmap = NULL;

    CMM_ClearGridTableView(TvImageCell);

    FNewDb = false;
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::TmrShowTimer(TObject *Sender)
{
    TmrShow->Enabled = false;
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::BtnCloseClick(TObject *Sender)
{
    Close();
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::FormClose(TObject *Sender, TCloseAction &Action)
{
    CommClose();
    PRK0040M = NULL;
    Action = caFree;
}
//---------------------------------------------------------------------------

bool __fastcall TPRK0040M::UpdatePrkFlrInfo(String APrkNmbr, String AFlrNo)
{
    if (!FImageUpdate) {
        return true;
    }

    String sQry;
    TADOQuery *pADO = NULL;

	TMemoryStream *dataStream = new TMemoryStream();
   	ImgTemp->Picture->Bitmap->SaveToStream(dataStream);

    sQry = "UPDATE TB_PRK_PLCE_FLR          \r\n"
           "   SET FLR_IMAGE_TYPE = :p03    \r\n"
           "      ,FLR_IMAGE_DATA = :p04    \r\n"
           " WHERE PRK_PLCE_NMBR  = :p01    \r\n"
           "   AND FLR_NO         = :p02    \r\n";

    try
    {
        try
        {
            pADO = new TADOQuery(NULL);
			pADO->Close();
            pADO->Connection = ITSDb_GetConnection();

            ITSDb_SQLText(pADO, sQry);
            ITSDb_SQLBind(pADO, "p01", APrkNmbr);
            ITSDb_SQLBind(pADO, "p02", AFlrNo);
            ITSDb_SQLBind(pADO, "p03", FImageExt);
    		pADO->Parameters->ParamByName("p04")->LoadFromStream(dataStream, ftBlob);
			pADO->ExecSQL();
        }
        catch(EDatabaseError &E)
        {
            DBERRORMSG("TPRK0040M::UpdatePrkFlrInfo", String(E.ClassName()), E.Message, sQry);
            throw Exception(String(E.ClassName()) + E.Message);
        }
        catch(Exception &e)
        {
            DBERRORMSG("TPRK0040M::UpdatePrkFlrInfo", String(e.ClassName()), e.Message, sQry);
            throw Exception(String(e.ClassName()) + e.Message);
        }
    }
    __finally
    {
        if (pADO)
        {
            pADO->Close();
            delete pADO;
        }
        if (dataStream) delete dataStream;
        dataStream = NULL;
    }
    FImageUpdate = false;
    return true;
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::ClearImage() {
    try {
        ImgPreView->Picture->Bitmap->FreeImage();
        ImgPreView->Picture->Bitmap = NULL;
    } catch(Exception &e) {}
    try {
        ImgTemp->Picture->Bitmap->FreeImage();
        ImgTemp->Picture->Bitmap = NULL;
    } catch(Exception &e) {}
}
//---------------------------------------------------------------------------
bool __fastcall TPRK0040M::AssignPrkFlrImage(String AExt, TMemoryStream *AImgStream)
{
    AExt = AExt.UpperCase();
    FImageExt = AExt;
    try {
        try {
            if (AExt == "PNG") {
                TdxPNGImage *img = new TdxPNGImage;
                img->LoadFromStream(AImgStream);

                ImgPreView->Picture->Bitmap->Assign(img);
                ImgPreView->Picture->Bitmap->PixelFormat = pf24bit;

                ImgTemp->Picture->Bitmap->Assign(img);
                ImgTemp->Picture->Bitmap->PixelFormat = pf24bit;

                SAFE_DELETE(img);
            }
            else
            if (AExt == "JPG" || AExt == "JPEG") {
                TJPEGImage *img = new TJPEGImage();
                img->LoadFromStream(AImgStream);

                ImgPreView->Picture->Bitmap->Assign(img);
                ImgPreView->Picture->Bitmap->PixelFormat = pf24bit;

                ImgTemp->Picture->Bitmap->Assign(img);
                ImgTemp->Picture->Bitmap->PixelFormat = pf24bit;

                SAFE_DELETE(img);
            }
            else
            if (AExt == "BMP") {
                Graphics::TBitmap *img = new Graphics::TBitmap;
                img->LoadFromStream(AImgStream);

                ImgPreView->Picture->Bitmap->Assign(img);
                ImgTemp->Picture->Bitmap->Assign(img);

                SAFE_DELETE(img);
            }
            else {
                return false;
            }
        } catch(Exception &e) {
            return false;
        }
    } __finally {
        SAFE_DELETE(AImgStream);
    }
    return true;
}
//---------------------------------------------------------------------------
void __fastcall TPRK0040M::LoadPrkFlrDevInfo()
{
    CMM_ClearGridTableView(TvImageCell);

    TPrkPlceFlr *pFlr = (TPrkPlceFlr*)CbFlr->Properties->Items->Objects[CbFlr->ItemIndex];
    if (pFlr == NULL) {
        return;
    }

    try
    {
        int nRow;
        TcxDataController *pGDC = TvImageCell->DataController;
        TvImageCell->BeginUpdate();
        FOR_STL(TPrkPlceFlrDev*, pDev, pFlr->FFlrDevs)
        {
            nRow = pGDC->AppendRecord();
            pGDC->Values[nRow][ColDevId->Index]    = pDev->DEVICE_ID;
            //pGDC->Values[nRow][ColCellPosX->Index] = pDev->X_POS;
            //pGDC->Values[nRow][ColCellPosY->Index] = pDev->Y_POS;
        }
    }
    __finally
    {
        TvImageCell->EndUpdate();
        TvImageCell->DataController->GotoFirst();
        TvImageCell->DataController->FocusedRecordIndex = 0;
    }
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::LoadPrkFlrImage(String APrkNmbr, String AFlrNo)
{
    TSqlCursor sqlCrs;
    String sQry;
    TADOQuery *pADO = NULL;

    ClearImage();

    sQry = "SELECT FLR_NM,                  \r\n"
           "       FLR_IMAGE_TYPE,          \r\n"
           "       FLR_IMAGE_DATA           \r\n"
           "  FROM TB_PRK_PLCE_FLR          \r\n"
           " WHERE PRK_PLCE_NMBR = :p01     \r\n"
           "   AND FLR_NO        = :p02     \r\n";

    try
    {
        try
        {
            pADO = new TADOQuery(NULL);
			pADO->Close();
            pADO->Connection = ITSDb_GetConnection();

            ITSDb_SQLText(pADO, sQry);
            ITSDb_SQLBind(pADO, "p01", APrkNmbr);
            ITSDb_SQLBind(pADO, "p02", AFlrNo);
            ITSDb_SQLOpen(pADO);

            for( ; !pADO->Eof; pADO->Next())
            {
                String FLR_NM = pADO->FieldByName("FLR_NM")->AsString;
                String FLR_IMAGE_TYPE = pADO->FieldByName("FLR_IMAGE_TYPE")->AsString;
                //Variant varImage = pADO->FieldByName("FLR_IMAGE_DATA")->AsVariant;
                if (FLR_IMAGE_TYPE.Trim() != "") {
                    TMemoryStream *pImgStream = new TMemoryStream();
                    pImgStream->LoadFromStream(pADO->CreateBlobStream(pADO->FieldByName("FLR_IMAGE_DATA"), bmRead));

				    AssignPrkFlrImage(FLR_IMAGE_TYPE, pImgStream);
                }
            }
        }
        catch(EDatabaseError &E)
        {
            DBERRORMSG("TPRK0040M::LoadPrkFlrImage", String(E.ClassName()), E.Message, sQry);
            throw Exception(String(E.ClassName()) + E.Message);
        }
        catch(Exception &e)
        {
            DBERRORMSG("TPRK0040M::LoadPrkFlrImage", String(e.ClassName()), e.Message, sQry);
            throw Exception(String(e.ClassName()) + e.Message);
        }
    }
    __finally
    {
        if (pADO)
        {
            pADO->Close();
            delete pADO;
        }
    }
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::ColLink2CustomDrawCell(TcxCustomGridTableView *Sender,
          TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
          bool &ADone)
{
#if 0
    int nRow = AViewInfo->GridRecord->RecordIndex;
    if (nRow < 0) return;

    if (nRow >= FListSymb->Count)
    {
        return;
    }
    try
    {
        Graphics::TBitmap *pBmp = (Graphics::TBitmap*)FListSymb->Items[nRow];

        TRect rc;
        TRect rcOrg = AViewInfo->Bounds;
        int nH = ( (rcOrg.Bottom - rcOrg.Top) - pBmp->Height ) / 2;

        rc.Top    = rcOrg.Top    + nH+1;
        rc.Bottom = rcOrg.Bottom - nH+1;
        rc.Left   = rcOrg.Left + 1;
        rc.Right  = rc.Left + pBmp->Width;

        ACanvas->Canvas->StretchDraw(rc, pBmp);
        ADone = true;
    }
    catch(Exception &e)
    {
    }
#endif
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::ColAreaCustomDrawCell(TcxCustomGridTableView *Sender,
          TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
          bool &ADone)
{
    int nIdx = AViewInfo->GridRecord->RecordIndex;
    if (nIdx < 0)
        return;

    try
    {
        String sDevId = VarToStr(TvImageCell->DataController->Values[nIdx][ColDevId->Index]);
        nIdx = sDevId.ToIntDef(0);
        ACanvas->Brush->Color = GetDisplayColor(nIdx-1);
        ACanvas->Font->Color = ACanvas->Brush->Color;
    }
    catch(...)
    {
    }
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::UpdateCellColor()
{
#if 0
    ImgPreView->Picture->Bitmap->FreeImage();
    ImgPreView->Picture->Bitmap = NULL;
    ImgPreView->Picture->Bitmap->Assign(ImgTemp->Picture->Bitmap);
    ImgPreView->Width  = ImgPreView->Picture->Bitmap->Width;
    ImgPreView->Height = ImgPreView->Picture->Bitmap->Height;

    TcxGridDataController *pGDC = TvImageCell->DataController;
    int nRows = pGDC->RecordCount;
    try
    {
        TvImageCell->BeginUpdate();
        pGDC->BeginUpdate();
        for (int ii = 0; ii < nRows; ii++)
        {
            String sDevId = VarToStr(pGDC->Values[ii][ColDevId->Index]);
            String sPosX  = VarToStr(pGDC->Values[ii][ColCellPosX->Index]);
            String sPosY  = VarToStr(pGDC->Values[ii][ColCellPosY->Index]);

            int X = sPosX.ToIntDef(0);
            int Y = sPosY.ToIntDef(0);
            if (X == 0 || Y == 0) {
                continue;
            }

            TColor FOldColor = ImgPreView->Picture->Bitmap->Canvas->Pixels[X][Y];

            int nIdx = sDevId.ToIntDef(0);
            ImgPreView->Picture->Bitmap->Canvas->Brush->Style = bsSolid;
            ImgPreView->Picture->Bitmap->Canvas->Brush->Color = GetDisplayColor(nIdx-1);
            ImgPreView->Picture->Bitmap->Canvas->FloodFill(X, Y, FOldColor, fsSurface);
        }
    }
    __finally
    {
        pGDC->EndUpdate();
        TvImageCell->EndUpdate();
    }
#endif
}
//---------------------------------------------------------------------------

void __fastcall TPRK0040M::BtnSearchClick(TObject *Sender)
{
    TSqlCursor sqlCrs;
    TPrkPlce *pObj = (TPrkPlce*)CbPrk->Properties->Items->Objects[CbPrk->ItemIndex];
    if (pObj == NULL) {
        return;
    }
    TPrkPlceFlr *pFlr = (TPrkPlceFlr*)CbFlr->Properties->Items->Objects[CbFlr->ItemIndex];
    if (pFlr == NULL) {
        return;
    }

    SeRemain->Value = pFlr->FLR_REMNDR_PRK_CMPRT_CO;

    PrkPlceManager->LoadFromDbFlrDev(pObj);
    PrkPlceManager->LoadFromDbFlr(pObj);
    PrkPlceManager->LoadFromDbDev(pObj);

    ImgPreView->Picture->Bitmap->Assign(ImgTemp->Picture->Bitmap);

    CMM_ClearGridTableView(TvImageCell);

    try
    {
        int nRow;
        TcxDataController *pGDC = TvImageCell->DataController;
        TvImageCell->BeginUpdate();
        FOR_STL(TPrkPlceFlrDev*, pDev, pFlr->FFlrDevs)
        {
            nRow = pGDC->AppendRecord();
            pGDC->Values[nRow][ColDevId->Index] = pDev->DEVICE_ID;

            TPrkPlceDev *pRun = pObj->FDevs.Find(pDev->DEVICE_ID);
            if (pRun == NULL) {
                continue;
            }
            if (pRun->OCCUPATION == 1) {
                pGDC->Values[nRow][ColOccu->Index] = "점유";

                if (pDev->X_POS != 0 && pDev->Y_POS != 0) {
                    TColor FOldColor = ImgPreView->Picture->Bitmap->Canvas->Pixels[pDev->X_POS][pDev->Y_POS];
                    ImgPreView->Picture->Bitmap->Canvas->Brush->Style = bsSolid;
                    ImgPreView->Picture->Bitmap->Canvas->Brush->Color = clRed;//clWhite;
                    ImgPreView->Picture->Bitmap->Canvas->FloodFill(pDev->X_POS, pDev->Y_POS, FOldColor, fsSurface);
                }
            }
            else {
                pGDC->Values[nRow][ColOccu->Index] = "비점유";
            }

            if (pRun->CONNECTED == 0) {
                pGDC->Values[nRow][ColComm->Index] = "*이상*";
                if (pDev->X_POS != 0 && pDev->Y_POS != 0) {
                    TColor FOldColor = ImgPreView->Picture->Bitmap->Canvas->Pixels[pDev->X_POS][pDev->Y_POS];
                    ImgPreView->Picture->Bitmap->Canvas->Brush->Style = bsSolid;
                    ImgPreView->Picture->Bitmap->Canvas->Brush->Color = clYellow;
                    ImgPreView->Picture->Bitmap->Canvas->FloodFill(pDev->X_POS, pDev->Y_POS, FOldColor, fsSurface);
                }
            }
            else {
                pGDC->Values[nRow][ColComm->Index] = "정상";
            }
        }
    }
    __finally
    {
        TvImageCell->EndUpdate();
    }
}
//---------------------------------------------------------------------------



void __fastcall TPRK0040M::TmrQryTimer(TObject *Sender)
{
    TSqlCursor sqlCrs;
    TmrQry->Enabled = false;
    Application->ProcessMessages();
    LoadPrkFlr();

}
//---------------------------------------------------------------------------

