123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "AppGlobalF.h"
- #include "CDSCodeF.h"
- #pragma hdrstop
- #include "AVIS020MF.h"
- #include "AVIS0201F.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxButtons"
- #pragma link "cxContainer"
- #pragma link "cxControls"
- #pragma link "cxDropDownEdit"
- #pragma link "cxEdit"
- #pragma link "cxGraphics"
- #pragma link "cxGroupBox"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "cxMaskEdit"
- #pragma link "cxPC"
- #pragma link "cxPCdxBarPopupMenu"
- #pragma link "cxSplitter"
- #pragma link "cxTextEdit"
- #pragma link "dxSkinBlack"
- #pragma link "dxSkinBlue"
- #pragma link "dxSkinsCore"
- #pragma link "dxSkinscxPCPainter"
- #pragma link "FRAME_AviDtctListF"
- #pragma resource "*.dfm"
- TAVIS020M *AVIS020M = NULL;
- //---------------------------------------------------------------------------
- __fastcall TAVIS020M::TAVIS020M(TComponent* Owner)
- : TForm(Owner)
- {
- ITSSkin_Load(this);
- CMM_LoadForm(g_sFormsDir, this);
- FTitle = "AVI-검지기 소통정보 통계";
- m_pFormList = new TList();
- TsList01->TabVisible = false;
- FRAMEAviDtctList1->PnlTop->Visible = false;
- FRAMEAviDtctList1->PnlBottom->Visible = false;
- FRAMEAviDtctList1->ColumnSel->Visible = false;
- }
- //---------------------------------------------------------------------------
- /*
- * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
- * Form과 DataModule class를 delete시킨다.
- * arguments
- *
- * return
- * void
- */
- void __fastcall TAVIS020M::CommClose()
- {
- try
- {
- for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
- {
- m_pFormList->Delete(idx);
- }
- delete m_pFormList;
- CMM_SaveForm(g_sFormsDir, this);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- /*
- * Form을 보여줄때 호출되는 event 메서드이다.
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TAVIS020M::FormShow(TObject *Sender)
- {
- Refresh();
- FormInit();
- TmrShow->Enabled = true;
- }
- //---------------------------------------------------------------------------
- /*
- * form 초기화
- *
- * arguments
- *
- * return
- * void
- */
- void __fastcall TAVIS020M::FormInit()
- {
- CbStatType->ItemIndex = 0;
- TDateTime dtStart = Now()-1;
- TDateTime dtEnd = Now();
- DtStDate->Date = dtStart;
- DtEdDate->Date = dtEnd;
- DtStTime->Date = dtStart;
- DtEdTime->Date = dtEnd;
- //DtStTime->Time = StrToDateTime("00:00");
- //DtEdTime->Time = StrToDateTime("23:59");
- }
- //---------------------------------------------------------------------------
- /*
- * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TAVIS020M::TmrShowTimer(TObject *Sender)
- {
- TmrShow->Enabled = false;
- FRAMEAviDtctList1->UpdateList();
- }
- //---------------------------------------------------------------------------
- /*
- * Refresh Data Event Function
- * arguments
- *
- * return
- * void
- */
- void __fastcall TAVIS020M::RefreshData()
- {
- // 검색조건에 의한 링크 데이터 조회
- try
- {
- //SelListData();
- }
- __finally
- {
- }
- }
- //---------------------------------------------------------------------------
- /*
- * Search 버튼 클릭 이벤트 핸들러
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TAVIS020M::BtnSearchClick(TObject *Sender)
- {
- Application->ProcessMessages();
- TSqlCursor sqlCrs((TControl*)BtnSearch);
- TcxGrid *pCxList;
- TcxGridTableView *pTvList = NULL;
- int nIdCol = -1;
- pCxList = FRAMEAviDtctList1->CxList;
- pTvList = FRAMEAviDtctList1->TvList;
- nIdCol = FRAMEAviDtctList1->Column02->Index;
- if (!pTvList) return;
- TcxDataController *pGDC = pTvList->DataController;
- int nIndex = pGDC->FocusedRecordIndex;
- if( nIndex < 0 )
- {
- Application->MessageBox(FrmLang->lblSelErr->Caption.c_str(),//L"AVI-검지기를 먼저 선택 하세요.",
- FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
- ActiveControl = pCxList;
- return;
- }
- FSelId = VarToStr(pGDC->Values[nIndex][nIdCol]);
- String sStTime, sEdTime, sTemp;
- switch(CbStatType->ItemIndex)
- {
- case 0: //15분 통계
- case 1: //시간 통계(1시간)
- sStTime = DtStDate->Date.FormatString("yyyyMMdd") + DtStTime->Time.FormatString("hh");
- sEdTime = DtEdDate->Date.FormatString("yyyyMMdd") + DtEdTime->Time.FormatString("hh");
- FStTime = sStTime + "0000";
- FEdTime = sEdTime + "5959";
- break;
- case 2: //시간 통계(1시간)
- sStTime = DtStDate->Date.FormatString("yyyyMMdd");
- sEdTime = DtEdDate->Date.FormatString("yyyyMMdd");
- FStTime = sStTime + "000000";
- FEdTime = sEdTime + "235959";
- break;
- case 3: //일 통계(1일)
- sStTime = DtStDate->Date.FormatString("yyyyMM");
- sEdTime = DtEdDate->Date.FormatString("yyyyMM");
- sTemp.printf(L"%02d", ITSUtil_GetMonthLastDay(AnsiString(sEdTime).c_str()));
- FStTime = sStTime + "01000000";
- FEdTime = sEdTime + sTemp + "235959";
- break;
- }
- if (sStTime > sEdTime)
- {
- Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
- FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
- ActiveControl = DtStDate;
- return;
- }
- FStatType = CbStatType->ItemIndex;
- String sTitle;
- sTitle.printf(L"%s(%s~%s) %s ", CbStatType->Text.c_str(),
- sStTime.c_str(),
- sEdTime.c_str(),
- FSelId.c_str());
- String sCaption;
- #if 0
- sCaption.printf(L"%s [%s] ", CbStatType->Text.c_str(), FSelId.c_str());
- #else
- sTitle = VarToStr(pGDC->Values[nIndex][FRAMEAviDtctList1->Column02->Index]);
- sCaption.printf(L"%s [%s] ", CbStatType->Text.c_str(), sTitle.c_str());
- #endif
- try
- {
- Application->ProcessMessages();
- LockWindowUpdate(Handle);
- TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sCaption);
- if (!pSheet) return;
- AVIS0201 = new TAVIS0201(this, Handle, FSelId, sStTime, sEdTime, FStatType);
- AVIS0201->Parent = pSheet;
- AVIS0201->Show();
- PgTab->ActivePage = pSheet;
- pSheet = PgTab->ActivePage;
- m_pFormList->Add(AVIS0201);
- }
- __finally
- {
- LockWindowUpdate(0);
- }
- }
- //---------------------------------------------------------------------------
- /*
- * Close 버튼 클릭 이벤트 핸들러
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TAVIS020M::BtnCloseClick(TObject *Sender)
- {
- Close();
- }
- //---------------------------------------------------------------------------
- /*
- * 조회결과 폼이 닫힐때 메시지를 받아 처리한다.
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TAVIS020M::OnSubFormClose(TMessage Msg)
- {
- int nActiveIdx = PgTab->ActivePageIndex;
- if (nActiveIdx <= 0) return;
- LockWindowUpdate(Handle);
- TcxTabSheet *pSheet = PgTab->ActivePage;
- if (pSheet)
- {
- delete pSheet;
- }
- nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
- m_pFormList->Delete(nActiveIdx);
- LockWindowUpdate(0);
- }
- //---------------------------------------------------------------------------
- /*
- * Tab Control의 Tab을 더블클릭하여 닫는다.
- * arguments
- * Sender : event handler 객체
- * return
- * void
- */
- void __fastcall TAVIS020M::PgTabDblClick(TObject *Sender)
- {
- TPoint APoint;
- APoint = PgTab->MouseDownPos;
- if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
- POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
- }
- //---------------------------------------------------------------------------
- void __fastcall TAVIS020M::FormClose(TObject *Sender, TCloseAction &Action)
- {
- CommClose();
- AVIS020M = NULL;
- Action = caFree;
- }
- //---------------------------------------------------------------------------
- void __fastcall TAVIS020M::CbStatTypePropertiesChange(TObject *Sender)
- {
- switch(CbStatType->ItemIndex)
- {
- case 0: //15분 통계
- case 1: //시간 통계(1시간)
- DtStDate->Format = " yyyy년 MM월 dd일";
- DtEdDate->Format = " yyyy년 MM월 dd일";
- DtStTime->Visible = true;
- DtEdTime->Visible = true;
- break;
- case 2: //일 통계(1일)
- DtStDate->Format = " yyyy년 MM월 dd일";
- DtEdDate->Format = " yyyy년 MM월 dd일";
- DtStTime->Visible = false;
- DtEdTime->Visible = false;
- break;
- case 3: //월 통계(1개월)
- DtStDate->Format = " yyyy년 MM월";
- DtEdDate->Format = " yyyy년 MM월";
- DtStTime->Visible = false;
- DtEdTime->Visible = false;
- break;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TAVIS020M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
- {
- int nActiveIdx = ATabIndex;
- if (nActiveIdx <= 0) return;
- nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
- m_pFormList->Delete(nActiveIdx);
- }
- //---------------------------------------------------------------------------
|