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

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

#include "FRAME_IncidentEndF.h"
#include "FrmIncidVmsInfoF.h"
#include "ITS0000MF.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "cxButtons"
#pragma link "cxCalc"
#pragma link "cxCalendar"
#pragma link "cxCheckBox"
#pragma link "cxClasses"
#pragma link "cxContainer"
#pragma link "cxControls"
#pragma link "cxCustomData"
#pragma link "cxData"
#pragma link "cxDataStorage"
#pragma link "cxDropDownEdit"
#pragma link "cxEdit"
#pragma link "cxFilter"
#pragma link "cxGraphics"
#pragma link "cxGrid"
#pragma link "cxGridCustomTableView"
#pragma link "cxGridCustomView"
#pragma link "cxGridLevel"
#pragma link "cxGridTableView"
#pragma link "cxGroupBox"
#pragma link "cxLabel"
#pragma link "cxLookAndFeelPainters"
#pragma link "cxLookAndFeels"
#pragma link "cxMaskEdit"
#pragma link "cxSpinEdit"
#pragma link "cxSplitter"
#pragma link "cxStyles"
#pragma link "cxTextEdit"
#pragma link "cxTimeEdit"
#pragma link "dxGDIPlusClasses"
#pragma link "dxSkinBlack"
#pragma link "dxSkinBlue"
#pragma link "dxSkinsCore"
#pragma link "dxSkinscxPCPainter"
#pragma link "dxSkinMcSkin"
#pragma resource "*.dfm"
TFRAMEIncidentEnd *FRAMEIncidentEnd;
//---------------------------------------------------------------------------
__fastcall TFRAMEIncidentEnd::TFRAMEIncidentEnd(TComponent* Owner)
    : TFrame(Owner)
{
    GrpIncid->Visible = false;

    LangTrans->Translate(this, ITSDb_GetConnection());
    ITSSkin_Load((TForm*)this);

    FTitle = Caption;//"돌발 종료 처리";

    FLinkId = "";

    //m_pGDC = TvList->DataController;
    TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<등록된 돌발정보가 없습니다>";

    FCodeIST  = ItsCodeManager->FLists.Find("IST");  //돌발상황 원본 코드 : IST
    FCodeLTCU = ItsCodeManager->FLists.Find("LTCU");//LTCU"); //소통 등급 코드 : LTCU
    FCodeICM  = ItsCodeManager->FLists.Find("ICM");  //돌발상황 확인 방법 코드 : ICM
    FCodeIDTU = ItsCodeManager->FLists.Find("IDTU"); //돌발상황 유형 분류 코드 : IDTU

    FCodeACTU = ItsCodeManager->FLists.Find("ACTU"); //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
    FCodeCRTU = ItsCodeManager->FLists.Find("CRTU"); //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
    FCodeEVTU = ItsCodeManager->FLists.Find("EVTU"); //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
    FCodeWETU = ItsCodeManager->FLists.Find("WETU"); //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
    FCodeCNTU = ItsCodeManager->FLists.Find("CNTU"); //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
    FCodeCATU = ItsCodeManager->FLists.Find("CATU"); //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나
    FCodeAETC = ItsCodeManager->FLists.Find("AETC");

    FCodeSRLU = ItsCodeManager->FLists.Find("SRLU"); //돌발상황 심각도 코드 : SRLU
    FCodePRTU = ItsCodeManager->FLists.Find("PRTU"); //통행 제한 유형 코드 : PRTU
    FCodeRSL  = ItsCodeManager->FLists.Find("RSL");  //대응 수준 코드 : RSL
    FCodeISS  = ItsCodeManager->FLists.Find("ISS");  //돌발상황 진행 단계 코드 : ISS
    //FCodeICM  = ItsCodeManager->FLists.Find("ICM");  //돌발상황 종료 확인 방법 코드 : ICM
    FCodeDFW  = ItsCodeManager->FLists.Find("DFW");  //기상 코드 : DFW
    FCodeVIT  = ItsCodeManager->FLists.Find("VIT");  //VMS 돌발 유형 코드 : VIT
    FCodeIDT  = ItsCodeManager->FLists.Find("IDT");  //VMS 돌발 유형 세부 코드 : IDT
    FCodeEDT  = ItsCodeManager->FLists.Find("EDT");  //VMS 돌발 유형 세부 코드 : EDT

    InitForm();
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::InitForm()
{
    DtStDate->Date = Now() - 30;
    DtEdDate->Date = Now();
    DtEdTime->EditValue = Now().FormatString("hh");

	//DtINCD_STRT_DT->Date = Now();
	//DtINCD_END_PRAR_DT->Date = Now() + ( 1 / 24 );
	DtINCD_END_DT->Date				= Now();

    CbINCD_ORGN_CD->Properties->Items->Clear();
	if (FCodeIST)
	{
		FOR_STL(TItsSubCode *, pSubCode, FCodeIST->FSubLists)
		{
			if (pSubCode->USE_YN == "N") continue;
			CbINCD_ORGN_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
		}
	}
    CbINCD_ORGN_CD->ItemIndex = 0;

    CbCMTR_GRAD_CD->Properties->Items->Clear();
	if (FCodeLTCU)
	{
		FOR_STL(TItsSubCode *, pSubCode, FCodeLTCU->FSubLists)
		{
			if (pSubCode->USE_YN == "N") continue;
		    CbCMTR_GRAD_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
		}
	}
    CbCMTR_GRAD_CD->ItemIndex = 0;

    CbINCD_END_CNFM_MTHD_CD->Properties->Items->Clear();
    CbINCD_CNFM_MTHD_CD->Properties->Items->Clear();
	if (FCodeICM)
	{
		FOR_STL(TItsSubCode *, pSubCode, FCodeICM->FSubLists)
		{
			if (pSubCode->USE_YN == "N") continue;
		    CbINCD_CNFM_MTHD_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
		    CbINCD_END_CNFM_MTHD_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
		}
	}
    CbINCD_CNFM_MTHD_CD->ItemIndex = 0;
    CbINCD_END_CNFM_MTHD_CD->ItemIndex = 0;

    CbINCD_SERN_CD->Properties->Items->Clear();
	if (FCodeSRLU)
	{
		FOR_STL(TItsSubCode *, pSubCode, FCodeSRLU->FSubLists)
		{
			if (pSubCode->USE_YN == "N") continue;
		    CbINCD_SERN_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
		}
	}
    CbINCD_SERN_CD->ItemIndex = 0;

    CbINCD_TYPE_CLSF_CD->Properties->Items->Clear();
	if (FCodeIDTU)
	{
		FOR_STL(TItsSubCode *, pSubCode, FCodeIDTU->FSubLists)
		{
			if (pSubCode->USE_YN == "N") continue;
		    CbINCD_TYPE_CLSF_CD->Properties->Items->Add(" [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
		}
	}
    CbINCD_TYPE_CLSF_CD->ItemIndex = 0;

#if 1
	if (FCodeACTU)
	{
		FOR_STL(TItsSubCode *, pSubCode , FCodeACTU->FSubLists)
		{
			if (pSubCode->USE_YN == "N") continue;
            CbINCD_TYPE_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
		}
	}
	if (FCodeCRTU)
	{
		FOR_STL(TItsSubCode *, pSubCode , FCodeCRTU->FSubLists)
		{
			if (pSubCode->USE_YN == "N") continue;
			CbINCD_TYPE_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
		}
	}
	if (FCodeEVTU)
	{
		FOR_STL(TItsSubCode *, pSubCode , FCodeEVTU->FSubLists)
		{
			if (pSubCode->USE_YN == "N") continue;
			CbINCD_TYPE_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
		}
	}
	if (FCodeWETU)
	{
		FOR_STL(TItsSubCode *, pSubCode , FCodeWETU->FSubLists)
		{
			if (pSubCode->USE_YN == "N") continue;
			CbINCD_TYPE_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
		}
	}
#endif
	//대응 수준 코드 : RSL
	if (FCodeRSL)
	{
		FOR_STL(TItsSubCode *, pSubCode , FCodeRSL->FSubLists)
		{
			if (pSubCode->USE_YN == "N") continue;
			CbRESP_LVL_CD->Properties->Items->Add( " [" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
		}
	}
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::InitScreen()
{
    EdRegDt->Text				  = "";
    EdLINK_ID->Text				  = "";
    EdLinkId->Text                = "";
    SePosX->Value				  = 0;
    SePosY->Value				  = 0;
    EdINCD_EXPL->Text			  = "";
    EdIFMR_NM->Text				  = "";
    DtINCD_STRT_DT->Date		  = Now();
    CbRESP_LVL_CD->Text			  = "";
    ChkUTIS_CNCT_YN->Checked	  = false;
    ChkVMS_DSPL_YN->Checked		  = false;
    EdSTRT_LCTN_NM->Text		  = "";
    EdEND_LCTN_NM->Text			  = "";
    CbVMS_INCD_TYPE_CD->Text	  = "";
    CbVMS_INCD_DETL_TYPE_CD->Text = "";

	EdINCD_OCRR_ID->Text		  = "";
	EdRGST_DT->Text				  = "";
	CbINCD_ORGN_CD->Text		  = "";
	EdOCRR_LCTN_NM->Text		  = "";
	CbCMTR_GRAD_CD->Text		  = "";
	CbINCD_CNFM_MTHD_CD->Text	  = "";
	CbINCD_SERN_CD->Text		  = "";
	CbRESP_LVL_CD->Text			  = "";
	EdINCD_TITL->Text			  = "";
	CbINCD_TYPE_CLSF_CD->Text	  = "";
	CbINCD_TYPE_CD->Text		  = "";
	DtINCD_END_PRAR_DT->Date	  = Now();
	CbINCD_END_CNFM_MTHD_CD->Text = "";
	DtINCD_END_DT->Date			  = Now();
	EdMBLZ_EQPM_CONT->Text		  = "";
	SeMBLZ_PNUM->Value			  = 0;
	EdRECR_CONT->Text			  = "";
	SeRECR_PERD->Value			  = 0;
	ChkUTIS_CNCT_YN->Checked	  = false;
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::UpdateList()
{
    InitScreen();

    TItsSubCode *pSubCode;

    CMM_ClearGridTableView(TvList);

    TcxDataController *pGDC = TvList->DataController;
    int nRow = 0;
    try
    {
        TvList->BeginUpdate();

        try
        {
            ItsIncidentManager->FLists.Lock();
            FOR_STL(TItsIncident *, pObj, ItsIncidentManager->FLists)
            {
#if 0
                if (pObj->INCD_PRGR_STEP_CD == "ISS2" ||
                    (ChkViewEnded->Checked && pObj->INCD_PRGR_STEP_CD == "ISS3"))
                {
                    nRow = pGDC->AppendRecord();
                }
                else
                {
                    continue;
                }
#else
                if (ChkViewEnded->Checked)
                {
                    if (pObj->INCD_PRGR_STEP_CD != "ISS2" && pObj->INCD_PRGR_STEP_CD != "ISS3") continue;

                    if (wcscmp(pObj->RGST_DT.c_str(), FEdDateTime.c_str())   > 0) continue;
                    if (wcscmp(FStDateTime.c_str(),   pObj->RGST_DT.c_str()) > 0) continue;
                }
                else
                {
                    if (pObj->INCD_PRGR_STEP_CD != "ISS2") continue;
                }

                nRow = pGDC->AppendRecord();
#endif

                String sIST  = "";
                String sLTCU = "";
                String sICM  = "";
                String sEndICM = "";
                String sSRLU = "";
                String sIDTU = "";
                String sACTU = "";
                String sISS  = "";
                String sDFW  = "";
                String sRSL  = "";
                String sPRTU = "";

                if (pObj->INCD_ORGN_CD      != "") sIST  = " [" + pObj->INCD_ORGN_CD + "] ";
                if (pObj->CMTR_GRAD_CD      != "") sLTCU = " [" + pObj->CMTR_GRAD_CD + "] ";
                if (pObj->INCD_CNFM_MTHD_CD != "") sICM  = " [" + pObj->INCD_CNFM_MTHD_CD + "] ";

                if (pObj->INCD_END_CNFM_MTHD_CD != "") sEndICM  = " [" + pObj->INCD_END_CNFM_MTHD_CD + "] ";

                if (pObj->INCD_SERN_CD      != "") sSRLU = " [" + pObj->INCD_SERN_CD + "] ";
                if (pObj->INCD_TYPE_CLSF_CD != "") sIDTU = " [" + pObj->INCD_TYPE_CLSF_CD + "] ";
                if (pObj->INCD_TYPE_CD      != "") sACTU = " [" + pObj->INCD_TYPE_CD + "] ";
                if (pObj->INCD_PRGR_STEP_CD != "") sISS  = " [" + pObj->INCD_PRGR_STEP_CD + "] ";
                if (pObj->WTHR_CD           != "") sDFW  = " [" + pObj->WTHR_CD + "] ";
                if (pObj->RESP_LVL_CD       != "") sRSL  = " [" + pObj->RESP_LVL_CD + "] ";
                if (pObj->TRVL_LMNT_TYPE_CD != "") sPRTU = " [" + pObj->TRVL_LMNT_TYPE_CD + "] ";

                if (FCodeIST)
                {
                    pSubCode = FCodeIST->FSubLists.Find(pObj->INCD_ORGN_CD);
                    if (pSubCode) sIST = sIST + pSubCode->CMMN_CD_KOR_NM;
                }
                if (FCodeLTCU)
                {
                    pSubCode = FCodeLTCU->FSubLists.Find(pObj->CMTR_GRAD_CD);
                    if (pSubCode) sLTCU = sLTCU + pSubCode->CMMN_CD_KOR_NM;
                }
                if (FCodeICM)
                {
                    pSubCode = FCodeICM->FSubLists.Find(pObj->INCD_CNFM_MTHD_CD);
                    if (pSubCode) sICM = sICM + pSubCode->CMMN_CD_KOR_NM;

                    pSubCode = FCodeICM->FSubLists.Find(pObj->INCD_END_CNFM_MTHD_CD);
                    if (pSubCode) sEndICM = sEndICM + pSubCode->CMMN_CD_KOR_NM;
                }
                if (FCodeSRLU)
                {
                    pSubCode = FCodeSRLU->FSubLists.Find(pObj->INCD_SERN_CD);
                    if (pSubCode) sSRLU = sSRLU + pSubCode->CMMN_CD_KOR_NM;
                }
                if (FCodeIDTU)
                {
                    pSubCode = FCodeIDTU->FSubLists.Find(pObj->INCD_TYPE_CLSF_CD);
                    if (pSubCode) sIDTU = sIDTU + pSubCode->CMMN_CD_KOR_NM;
                }

                if (!pObj->INCD_TYPE_CLSF_CD.IsEmpty() && !pObj->INCD_TYPE_CD.IsEmpty())
                {
                    if (pObj->INCD_TYPE_CLSF_CD == "1")
                    {
                        if (FCodeACTU)
                        {
                            pSubCode = FCodeACTU->FSubLists.Find(pObj->INCD_TYPE_CD);
                            if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                        }
                    }
                    else if (pObj->INCD_TYPE_CLSF_CD == "2")
                    {
                        if (FCodeCRTU)
                        {
                            pSubCode = FCodeCRTU->FSubLists.Find(pObj->INCD_TYPE_CD);
                            if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                        }
                    }
                    else if (pObj->INCD_TYPE_CLSF_CD == "3")
                    {
                        if (FCodeEVTU)
                        {
                            pSubCode = FCodeEVTU->FSubLists.Find(pObj->INCD_TYPE_CD);
                            if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                        }
                    }
                    else if (pObj->INCD_TYPE_CLSF_CD == "4")
                    {
                        if (FCodeWETU)
                        {
                            pSubCode = FCodeWETU->FSubLists.Find(pObj->INCD_TYPE_CD);
                            if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                        }
                    }
                    else if (pObj->INCD_TYPE_CLSF_CD == "5")
                    {
                        if (FCodeCNTU)
                        {
                            pSubCode = FCodeCNTU->FSubLists.Find(pObj->INCD_TYPE_CD);
                            if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                        }
                    }
                    else if (pObj->INCD_TYPE_CLSF_CD == "6")
                    {
                        if (FCodeCATU)
                        {
                            pSubCode = FCodeCATU->FSubLists.Find(pObj->INCD_TYPE_CD);
                            if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                        }
                    }
                    else if (pObj->INCD_TYPE_CLSF_CD == "9")
                    {
                        if (FCodeAETC)
                        {
                            pSubCode = FCodeAETC->FSubLists.Find(pObj->INCD_TYPE_CD);
                            if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                        }
                    }
                }

                if (FCodeISS)
                {
                    pSubCode = FCodeISS->FSubLists.Find(pObj->INCD_PRGR_STEP_CD);
                    if (pSubCode) sISS = sISS + pSubCode->CMMN_CD_KOR_NM;
                }

                if (FCodeDFW)
                {
                    pSubCode = FCodeDFW->FSubLists.Find(pObj->WTHR_CD);
                    if (pSubCode) sDFW = sDFW + pSubCode->CMMN_CD_KOR_NM;
                }

                if (FCodeRSL)
                {
                    pSubCode = FCodeRSL->FSubLists.Find(pObj->RESP_LVL_CD);
                    if (pSubCode) sRSL = sRSL + pSubCode->CMMN_CD_KOR_NM;
                }

                if (FCodePRTU)
                {
                    pSubCode = FCodePRTU->FSubLists.Find(pObj->TRVL_LMNT_TYPE_CD);
                    if (pSubCode) sPRTU = sPRTU + pSubCode->CMMN_CD_KOR_NM;
                }

                pGDC->Values[nRow][Column01->Index] = pObj->INCD_OCRR_ID;                //돌발상황 발생 ID

                pGDC->Values[nRow][Column02->Index] = ITSUtil_StrToTime(pObj->RGST_DT);                     //등록 일시

                pGDC->Values[nRow][Column03->Index] = sISS;//pObj->INCD_PRGR_STEP_CD;    //돌발상황 진행 단계 코드 : ISS
                pGDC->Values[nRow][Column04->Index] = sIST;//pObj->INCD_ORGN_CD;         //돌발상황 원본 코드 : IST
                pGDC->Values[nRow][Column05->Index] = pObj->OCRR_LCTN_NM;                //발생 위치 명
                pGDC->Values[nRow][Column06->Index] = pObj->LINK_ID;                     //돌발발생 LINK ID
                pGDC->Values[nRow][Column07->Index] = pObj->X_CRDN;                      //X 좌표
                pGDC->Values[nRow][Column08->Index] = pObj->Y_CRDN;                      //Y 좌표
                pGDC->Values[nRow][Column09->Index] = pObj->INCD_EXPL;                   //돌발상황 설명
                pGDC->Values[nRow][Column10->Index] = sLTCU;//pObj->CMTR_GRAD_CD;        //소통 등급 코드 : LTCU
                pGDC->Values[nRow][Column11->Index] = pObj->IFMR_NM;                     //제보자 명
                pGDC->Values[nRow][Column12->Index] = sICM;//pObj->INCD_CNFM_MTHD_CD;    //돌발상황 확인 방법 코드 : ICM
                pGDC->Values[nRow][Column13->Index] = sSRLU;//pObj->INCD_SERN_CD;        //돌발상황 심각도 코드 : SRLU
                pGDC->Values[nRow][Column14->Index] = pObj->INCD_TITL;                   //돌발상황 제목
                pGDC->Values[nRow][Column15->Index] = sIDTU;//pObj->INCD_TYPE_CLSF_CD;   //돌발상황 유형 분류 코드 : IDTU
                pGDC->Values[nRow][Column16->Index] = sACTU;//pObj->INCD_TYPE_CD;        //돌발상황 유형 코드 : ACTU, CRTU, EVTU, WETU 중 하나

                pGDC->Values[nRow][Column17->Index] = ITSUtil_StrToTime(pObj->INCD_STRT_DT);                //돌발상황 시작 일시
                pGDC->Values[nRow][Column18->Index] = ITSUtil_StrToTime(pObj->INCD_END_PRAR_DT);            //돌발상황 종료 예정 일시

                pGDC->Values[nRow][Column19->Index] = pObj->INCD_OCRR_LANE;              //돌발상황 발생 차로
                pGDC->Values[nRow][Column20->Index] = pObj->INCD_CLSR_LANE;              //돌발상황 차단 차로
                pGDC->Values[nRow][Column21->Index] = pObj->DELY_LNGT;                   //지체 길이
                pGDC->Values[nRow][Column22->Index] = pObj->INCD_LNGT;                   //돌발상황 길이
                pGDC->Values[nRow][Column23->Index] = pObj->SMLT_VHCL_UNUM;              //소형 차량 대수
                pGDC->Values[nRow][Column24->Index] = pObj->MDLT_VHCL_UNUM;              //중대형 차량 대수
                pGDC->Values[nRow][Column25->Index] = pObj->INJR_PNUM;                   //부상자 인원수
                pGDC->Values[nRow][Column26->Index] = pObj->FTLT_PNUM;                   //사망자 인원수
                pGDC->Values[nRow][Column27->Index] = sDFW;//pObj->WTHR_CD;              //기상 코드 : DFW
                pGDC->Values[nRow][Column28->Index] = sRSL;//pObj->RESP_LVL_CD;          //대응 수준 코드 : RSL
                pGDC->Values[nRow][Column29->Index] = pObj->UTIS_CNCT_YN;                //UTIS 연계 여부
                pGDC->Values[nRow][Column30->Index] = pObj->TRUB_VHCL_YN;                //고장 차량 여부
                pGDC->Values[nRow][Column31->Index] = pObj->FALT_YN;                     //낙하물 여부
                pGDC->Values[nRow][Column32->Index] = pObj->FRWT_YN;                     //화재위험물 여부
                pGDC->Values[nRow][Column33->Index] = sPRTU;//pObj->TRVL_LMNT_TYPE_CD;   //통행 제한 유형 코드 : PRTU
                pGDC->Values[nRow][Column34->Index] = pObj->VMS_DSPL_YN;                 //VMS 표출 여부
                pGDC->Values[nRow][Column35->Index] = ITSUtil_StrToTime(pObj->INCD_CNFM_DT);

                pGDC->Values[nRow][Column36->Index] = sEndICM;                           //돌발상황 종료 확인 방법 코드 : ICM
                pGDC->Values[nRow][Column37->Index] = ITSUtil_StrToTime(pObj->INCD_END_DT); //돌발상황 종료 일시
                pGDC->Values[nRow][Column38->Index] = pObj->MBLZ_EQPM_CONT;        //출동 장비 내용
                pGDC->Values[nRow][Column39->Index] = pObj->MBLZ_PNUM;             //출동 인원수
                pGDC->Values[nRow][Column40->Index] = pObj->RECR_CONT;             //복구 내용
                pGDC->Values[nRow][Column41->Index] = pObj->RECR_PERD;             //복구 기간

                pGDC->Values[nRow][Column99->Index] = (int)pObj;
            }
        }
        __finally
        {
            ItsIncidentManager->FLists.UnLock();
        }
    }
    __finally
    {
        LblRecords->Caption = "("+FormatFloat("##,##0", pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", pGDC->RecordCount) + ")";
        TvList->EndUpdate();
        TvList->DataController->GotoFirst();
        TvList->DataController->FocusedRecordIndex = 0;
    }
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::TvListDataControllerFilterChanged(TObject *Sender)
{
    CMM_SetFilterLike(TvList);
    TcxDataController *pGDC = TvList->DataController;
    LblRecords->Caption = "("+FormatFloat("##,##0", pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", pGDC->RecordCount) + ")";
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::BtnExlSaveClick(TObject *Sender)
{
    TcxGrid          *pGrid = CxList;
    TcxGridTableView *pView = TvList;
    String            sTitle= lblFileName->Caption;//"돌발정보";

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

void __fastcall TFRAMEIncidentEnd::TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift, bool &AHandled)
{
    DisplayIncidentInfo();
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::DisplayIncidentInfo()
{
    FLinkId = "";
    //BtnVmsTarget->Enabled = false;

    TcxDataController *pGDC = TvList->DataController;
	int nRow = pGDC->FocusedRecordIndex;
	if( nRow <= -1 )
		return;

    TItsSubCode *pSubCode;

    //int nMemPtr = pGDC->Values[nRow][Column99->Index];
    //TItsIncident *pObj = (TItsIncident *)nMemPtr;

    try
    {
        String sINCD_OCRR_ID = pGDC->Values[nRow][Column01->Index];

        TItsIncident *pObj = ItsIncidentManager->FLists.Find(sINCD_OCRR_ID);
        if (!pObj) return;

//InitScreen();
        String sIST  = "";
        if (pObj->INCD_ORGN_CD != "") sIST = " [" + pObj->INCD_ORGN_CD + "] ";
        String sLTCU= "";
        if (pObj->CMTR_GRAD_CD != "") sLTCU = " [" + pObj->CMTR_GRAD_CD + "] ";
        String sICM = "";
        if (pObj->INCD_CNFM_MTHD_CD != "") sICM  = " [" + pObj->INCD_CNFM_MTHD_CD + "] ";
        String sSRLU= "";
        if (pObj->INCD_SERN_CD != "") sSRLU = " [" + pObj->INCD_SERN_CD + "] ";
        String sIDTU = "";
        if (pObj->INCD_TYPE_CLSF_CD != "") sIDTU = " [" + pObj->INCD_TYPE_CLSF_CD + "] ";
        String sACTU = "";
        if (pObj->INCD_TYPE_CD != "") sACTU = " [" + pObj->INCD_TYPE_CD + "] ";
        String sISS  = "";
        if (pObj->INCD_PRGR_STEP_CD != "") sISS = " [" + pObj->INCD_PRGR_STEP_CD + "] ";
        String sDFW  = "";
        if (pObj->WTHR_CD != "") sDFW = " [" + pObj->WTHR_CD + "] ";
        String sRSL  = "";
        if (pObj->RESP_LVL_CD != "") sRSL = " [" + pObj->RESP_LVL_CD + "] ";
        String sPRTU = "";
        if (pObj->TRVL_LMNT_TYPE_CD != "") sPRTU = " [" + pObj->TRVL_LMNT_TYPE_CD + "] ";

        String sEndICM = "";
        if (pObj->INCD_END_CNFM_MTHD_CD != "") sEndICM  = " [" + pObj->INCD_END_CNFM_MTHD_CD + "] ";

        if (FCodeIST)
        {
            pSubCode = FCodeIST->FSubLists.Find(pObj->INCD_ORGN_CD);
            if (pSubCode) sIST = sIST + pSubCode->CMMN_CD_KOR_NM;
        }
        if (FCodeLTCU)
        {
            pSubCode = FCodeLTCU->FSubLists.Find(pObj->CMTR_GRAD_CD);
            if (pSubCode) sLTCU = sLTCU + pSubCode->CMMN_CD_KOR_NM;
        }
        if (FCodeICM)
        {
            pSubCode = FCodeICM->FSubLists.Find(pObj->INCD_CNFM_MTHD_CD);
            if (pSubCode) sICM = sICM + pSubCode->CMMN_CD_KOR_NM;

            pSubCode = FCodeICM->FSubLists.Find(pObj->INCD_END_CNFM_MTHD_CD);
            if (pSubCode) sEndICM = sEndICM + pSubCode->CMMN_CD_KOR_NM;
        }
        if (FCodeSRLU)
        {
            pSubCode = FCodeSRLU->FSubLists.Find(pObj->INCD_SERN_CD);
            if (pSubCode) sSRLU = sSRLU + pSubCode->CMMN_CD_KOR_NM;
        }
        if (FCodeIDTU)
        {
            pSubCode = FCodeIDTU->FSubLists.Find(pObj->INCD_TYPE_CLSF_CD);
            if (pSubCode) sIDTU = sIDTU + pSubCode->CMMN_CD_KOR_NM;
        }

        if (!pObj->INCD_TYPE_CLSF_CD.IsEmpty() && !pObj->INCD_TYPE_CD.IsEmpty())
        {
            if (pObj->INCD_TYPE_CLSF_CD == "1")
            {
                if (FCodeACTU)
                {
                    pSubCode = FCodeACTU->FSubLists.Find(pObj->INCD_TYPE_CD);
                    if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                }
            }
            else if (pObj->INCD_TYPE_CLSF_CD == "2")
            {
                if (FCodeCRTU)
                {
                    pSubCode = FCodeCRTU->FSubLists.Find(pObj->INCD_TYPE_CD);
                    if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                }
            }
            else if (pObj->INCD_TYPE_CLSF_CD == "3")
            {
                if (FCodeEVTU)
                {
                    pSubCode = FCodeEVTU->FSubLists.Find(pObj->INCD_TYPE_CD);
                    if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                }
            }
            else if (pObj->INCD_TYPE_CLSF_CD == "4")
            {
                if (FCodeWETU)
                {
                    pSubCode = FCodeWETU->FSubLists.Find(pObj->INCD_TYPE_CD);
                    if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                }
            }
            else if (pObj->INCD_TYPE_CLSF_CD == "5")
            {
                if (FCodeCNTU)
                {
                    pSubCode = FCodeCNTU->FSubLists.Find(pObj->INCD_TYPE_CD);
                    if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                }
            }
            else if (pObj->INCD_TYPE_CLSF_CD == "6")
            {
                if (FCodeCATU)
                {
                    pSubCode = FCodeCATU->FSubLists.Find(pObj->INCD_TYPE_CD);
                    if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                }
            }
            else if (pObj->INCD_TYPE_CLSF_CD == "9")
            {
                if (FCodeAETC)
                {
                    pSubCode = FCodeAETC->FSubLists.Find(pObj->INCD_TYPE_CD);
                    if (pSubCode) sACTU = sACTU + pSubCode->CMMN_CD_KOR_NM;
                }
            }
        }

        if (FCodeISS)
        {
            pSubCode = FCodeISS->FSubLists.Find(pObj->INCD_PRGR_STEP_CD);
            if (pSubCode) sISS = sISS + pSubCode->CMMN_CD_KOR_NM;
        }

        if (FCodeDFW)
        {
            pSubCode = FCodeISS->FSubLists.Find(pObj->WTHR_CD);
            if (pSubCode) sDFW = sDFW + pSubCode->CMMN_CD_KOR_NM;
        }

        if (FCodeRSL)
        {
            pSubCode = FCodeRSL->FSubLists.Find(pObj->RESP_LVL_CD);
            if (pSubCode) sRSL = sRSL + pSubCode->CMMN_CD_KOR_NM;
        }

        if (FCodePRTU)
        {
            pSubCode = FCodePRTU->FSubLists.Find(pObj->TRVL_LMNT_TYPE_CD);
            if (pSubCode) sPRTU = sPRTU + pSubCode->CMMN_CD_KOR_NM;
        }

        EdINCD_OCRR_ID->Text        = pObj->INCD_OCRR_ID;
        EdRGST_DT->Text             = ITSUtil_StrToTime(pObj->RGST_DT);
        EdRegDt->Text               = pObj->RGST_DT;
        CbINCD_ORGN_CD->Text        = sIST;
        EdOCRR_LCTN_NM->Text        = pObj->OCRR_LCTN_NM;
        EdLINK_ID->Text             = pObj->LINK_ID;
        EdLinkId->Text              = pObj->LINK_ID;
        FLinkId = pObj->LINK_ID;
        if (pObj->X_CRDN.IsEmpty()) pObj->X_CRDN = "0.0";
        SePosX->Value               = StrToFloat(pObj->X_CRDN);
        if (pObj->Y_CRDN.IsEmpty()) pObj->Y_CRDN = "0.0";
        SePosY->Value               = StrToFloat(pObj->Y_CRDN);
        EdINCD_EXPL->Text           = pObj->INCD_EXPL;
        CbCMTR_GRAD_CD->Text        = sLTCU;
        EdIFMR_NM->Text             = pObj->IFMR_NM;

        CbINCD_CNFM_MTHD_CD->Text	= sICM;
        CbINCD_SERN_CD->Text		= sSRLU;
        CbINCD_TYPE_CLSF_CD->Text	= sIDTU;
        CbINCD_TYPE_CD->Text		= sACTU;

        EdINCD_TITL->Text           = pObj->INCD_TITL;

        DtINCD_STRT_DT->Date        = ITSUtil_StrToDateTime(pObj->INCD_STRT_DT);
        DtINCD_END_PRAR_DT->Date    = ITSUtil_StrToDateTime(pObj->INCD_END_PRAR_DT);

        CbRESP_LVL_CD->Text         = sRSL;

        //공단에서 넘어온 돌발은 공단연계가 표출안되게
        if (pObj->INCD_ORGN_CD == "IST5")
        {
            ChkUTIS_CNCT_YN->Checked    = false;
            //ChkUTIS_CNCT_YN->Enabled    = false;
        }
        else
        {
            //ChkUTIS_CNCT_YN->Enabled    = true;
            ChkUTIS_CNCT_YN->Checked    = pObj->UTIS_CNCT_YN == "Y" ? true : false;
        }

        CbINCD_END_CNFM_MTHD_CD->Text = sEndICM;

        if (pObj->INCD_END_DT.IsEmpty())
        {
            DtINCD_END_DT->Date = Now();
        }
        else
        {
            DtINCD_END_DT->Date = ITSUtil_StrToDateTime(pObj->INCD_END_DT);
        }
        EdMBLZ_EQPM_CONT->Text = pObj->MBLZ_EQPM_CONT;
        SeMBLZ_PNUM->Value = pObj->MBLZ_PNUM.ToIntDef(0);
        EdRECR_CONT->Text  = pObj->RECR_CONT;
        SeRECR_PERD->Value					= pObj->RECR_PERD.ToIntDef(0);

        if (FLinkId != "")
        {
            //BtnVmsTarget->Enabled = true;
        }
    }
    catch(...)
    {
    }
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::BtnInfoCancelClick(TObject *Sender)
{
	InitScreen();
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::BtnSaveClick(TObject *Sender)
{
#define USE_INC_PROGRESS    1
//외부돌발(도로교통공단 UTIS)인 경우 진행상황을 입력하지 않으면 진행상황에서 입력해야할 정보가
//입력되지 않는 경우가 발생함...
//이때 진행상황의 필수입력항목을 체크할 것인지에 따라 위의 define을 설정하면 됨
//1인경우 진행상황을 입력해야 종료처리가 되도록 하는 것이고 0인 경우 종료처리 필수항목만 체크하는 것임

    //입력
    if (EdINCD_OCRR_ID->Text.Trim().IsEmpty())
    {
        Application->MessageBox(L"돌발종료확인\r\n목록에서 돌발정보를 선택하신 후에 작업을 진행하세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        return;
    }

	if (CbINCD_ORGN_CD->Text.IsEmpty())
	{
        Application->MessageBox(L"★[돌발구분] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (CbINCD_ORGN_CD->CanFocus()) CbINCD_ORGN_CD->SetFocus();
		return;
	}

	if (CbINCD_END_CNFM_MTHD_CD->Text.IsEmpty())
	{
        Application->MessageBox(L"★[종료확인방법] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (CbINCD_END_CNFM_MTHD_CD->CanFocus()) CbINCD_END_CNFM_MTHD_CD->SetFocus();
		return;
	}
#if USE_INC_PROGRESS
	if (CbINCD_TYPE_CLSF_CD->Text.IsEmpty())
	{
        Application->MessageBox(L"★[돌발유형] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (CbINCD_TYPE_CLSF_CD->CanFocus()) CbINCD_TYPE_CLSF_CD->SetFocus();
		return;
	}
	if (CbINCD_TYPE_CD->Text.IsEmpty())
	{
        Application->MessageBox(L"★[돌발세부유형] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (CbINCD_TYPE_CD->CanFocus()) CbINCD_TYPE_CD->SetFocus();
		return;
	}
	if (CbINCD_CNFM_MTHD_CD->Text.IsEmpty())
	{
        Application->MessageBox(L"★[확인방법] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (CbINCD_CNFM_MTHD_CD->CanFocus()) CbINCD_CNFM_MTHD_CD->SetFocus();
		return;
	}
	if (CbINCD_SERN_CD->Text.IsEmpty())
	{
        Application->MessageBox(L"★[심각도] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (CbINCD_SERN_CD->CanFocus()) CbINCD_SERN_CD->SetFocus();
		return;
	}
	if (DtINCD_STRT_DT->EditValue.IsEmpty())
	{
        Application->MessageBox(L"★[돌발시작시각] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (DtINCD_STRT_DT->CanFocus()) DtINCD_STRT_DT->SetFocus();
		return;
	}
	if (DtINCD_END_PRAR_DT->EditValue.IsEmpty())
	{
        Application->MessageBox(L"★[종료예정시각] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (DtINCD_END_PRAR_DT->CanFocus()) DtINCD_END_PRAR_DT->SetFocus();
		return;
	}
	if (EdLinkId->Text.Trim().IsEmpty())
	{
        Application->MessageBox(L"★[발생구간(링크)] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (EdLinkId->CanFocus()) EdLinkId->SetFocus();
		return;
	}
	if (SePosX->Value == 0 ||
        SePosY->Value == 0)
	{
        Application->MessageBox(L"★발생구간(링크) 좌표값은 0이 될수 없습니다.] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (SePosX->CanFocus()) SePosX->SetFocus();
		return;
	}

	if (EdINCD_EXPL->Text.Trim().IsEmpty())
	{
        Application->MessageBox(L"★[돌발상황설명] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (EdINCD_EXPL->CanFocus()) EdINCD_EXPL->SetFocus();
		return;
	}
	if (EdINCD_TITL->Text.Trim().IsEmpty())
	{
        Application->MessageBox(L"★[돌발제목] 항목은 필수 입력 항목입니다.\r\n입력후 진행해 주세요.",
                                FTitle.c_str(), MB_OK|MB_ICONERROR|MB_APPLMODAL);
        if (EdINCD_TITL->CanFocus()) EdINCD_TITL->SetFocus();
		return;
	}
#endif

    if (Application->MessageBox(L"돌발종료확인\r\n현재 입력 정보를 저장 하시겠습니까?",
                                FTitle.c_str(), MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) return;

    String sIncidentId = EdINCD_OCRR_ID->Text;
    TItsIncident *pObj = ItsIncidentManager->FLists.Find(sIncidentId);

    pObj->INCD_END_CNFM_MTHD_CD	= ITSUtil_GetCode(CbINCD_END_CNFM_MTHD_CD->Text);
    pObj->INCD_END_DT			= DtINCD_END_DT->Date.FormatString("YYYYMMDDHHNNSS");
    pObj->MBLZ_EQPM_CONT		= EdMBLZ_EQPM_CONT->Text.Trim();
    pObj->MBLZ_PNUM				= SeMBLZ_PNUM->Value;
    pObj->RECR_CONT				= EdRECR_CONT->Text.Trim();
    pObj->RECR_PERD				= SeRECR_PERD->Value;
    pObj->INCD_PRGR_STEP_CD		= "ISS3";	// 현재는 종료단계이다.

	if (!ItsIncidentManager->UpdateIncidentInfo(pObj))
    {
        return;
    }

	ItsIncidentManager->UpdateVmsIncidentInfo(pObj->INCD_OCRR_ID, pObj->INCD_PRGR_STEP_CD);

    Application->MessageBox(FrmLang->lblDbSave->Caption.c_str(),//L"입력하신 돌발종료정보를 저장 하였습니다.",
                            FTitle.c_str(), MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);

	ItsIncidentManager->LoadFromDb();
	ItsIncidentManager->LoadFromVmsIncident();

	UpdateList();

	InitScreen();

    Application->ProcessMessages();
    POST_MSG(Application->MainForm->Handle, WM_DATABASE_REFRESH, WP_MSG_02, 0);

    CMM_SetGridFocusRow(CxList, TvList, sIncidentId, Column01->Index);
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::ChkViewEndedClick(TObject *Sender)
{
    bool bEnabled = ChkViewEnded->Checked;
    DtStDate->Enabled  = bEnabled;
    DtEdDate->Enabled  = bEnabled;
    DtStTime->Enabled  = bEnabled;
    DtEdTime->Enabled  = bEnabled;
    BtnSearch->Enabled = bEnabled;
    Label1->Enabled    = bEnabled;

    if (false == ChkViewEnded->Checked)
    {
        UpdateList();
    }
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::BtnMoveGisClick(TObject *Sender)
{
#if 0
    if (EdLinkId->Text.IsEmpty()) return;
    g_SelLink.pForm = NULL;
    g_SelLink.Level = 1;
    g_SelLink.Id    = EdLinkId->Text;
    POST_MSG(Application->MainForm->Handle, WM_PLUGINFORM, WP_MSG_15, LP_MSG_15);
#else
    float sDx = SePosX->Value;
    float sDy = SePosY->Value;
    if (sDx != 0 && sDy != 0)
    {
        if (ITS0000M) ITS0000M->SelectObjectByPos(sDx, sDy, true);
    }
    else
    {
        if (EdLinkId->Text.IsEmpty()) return;
        if (ITS0000M) ITS0000M->SelectLinkById(1, EdLinkId->Text, true);
#if 0
        g_SelLink.pForm = NULL;
        g_SelLink.Level = 1;
        g_SelLink.Id    = EdLinkId->Text;
        POST_MSG(Application->MainForm->Handle, WM_PLUGINFORM, WP_MSG_15, LP_MSG_15);
#endif
    }
#endif
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::BtnSearchClick(TObject *Sender)
{
    Application->ProcessMessages();
    TSqlCursor sqlCrs((TControl*)BtnSearch);

	FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
	FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
	if (wcscmp(FStDateTime.c_str(), FEdDateTime.c_str()) >= 0)
	{
        Application->MessageBox(L"시작 시각이 종료 시각 보다 작거나 같습니다.", FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
        //ActiveControl = DtStDate;
        return;
    }
    FStDateTime = FStDateTime + "0000";
    FEdDateTime = FEdDateTime + "5959";

    UpdateList();
}
//---------------------------------------------------------------------------

void __fastcall TFRAMEIncidentEnd::BtnVmsTargetClick(TObject *Sender)
{
    if (!ChkVMS_DSPL_YN->Checked) return;
    if (FLinkId == "") return;
    try
    {
        if (FrmIncidVmsInfo == NULL)
        {
            FrmIncidVmsInfo = new TFrmIncidVmsInfo(Application);
        }
        FrmIncidVmsInfo->Show();
        FrmIncidVmsInfo->ShowIncidVmsInfo(FLinkId);
    }
    catch(...)
    {
    }
}
//---------------------------------------------------------------------------

