IST0030MF.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "CDSCodeF.h"
  7. #include "ITSLangTransF.h"
  8. #pragma hdrstop
  9. #include "IST0030MF.h"
  10. #include "IST00301F.h"
  11. #include "IST00302F.h"
  12. #include "IST00303F.h"
  13. //---------------------------------------------------------------------------
  14. #pragma package(smart_init)
  15. #pragma link "FRAME_LinkListF"
  16. #pragma link "FRAME_ServiceLinkListF"
  17. #pragma link "FRAME_RoadListF"
  18. #pragma link "cxButtons"
  19. #pragma link "cxCalendar"
  20. #pragma link "cxCheckBox"
  21. #pragma link "cxClasses"
  22. #pragma link "cxContainer"
  23. #pragma link "cxControls"
  24. #pragma link "cxCustomData"
  25. #pragma link "cxData"
  26. #pragma link "cxDataStorage"
  27. #pragma link "cxDropDownEdit"
  28. #pragma link "cxEdit"
  29. #pragma link "cxFilter"
  30. #pragma link "cxGraphics"
  31. #pragma link "cxGrid"
  32. #pragma link "cxGridCustomTableView"
  33. #pragma link "cxGridCustomView"
  34. #pragma link "cxGridLevel"
  35. #pragma link "cxGridTableView"
  36. #pragma link "cxGroupBox"
  37. #pragma link "cxLabel"
  38. #pragma link "cxLookAndFeelPainters"
  39. #pragma link "cxLookAndFeels"
  40. #pragma link "cxMaskEdit"
  41. #pragma link "cxPC"
  42. #pragma link "cxPCdxBarPopupMenu"
  43. #pragma link "cxSplitter"
  44. #pragma link "cxStyles"
  45. #pragma link "cxTextEdit"
  46. #pragma link "dxSkinBlack"
  47. #pragma link "dxSkinBlue"
  48. #pragma link "dxSkinsCore"
  49. #pragma link "dxSkinscxPCPainter"
  50. #pragma resource "*.dfm"
  51. TIST0030M *IST0030M = NULL;
  52. //---------------------------------------------------------------------------
  53. __fastcall TIST0030M::TIST0030M(TComponent* Owner)
  54. : TForm(Owner)
  55. {
  56. LangTrans->Translate(this, ITSDb_GetConnection());
  57. FTitle = Caption;//"소통정보 통계";
  58. ITSSkin_Load(this);
  59. CMM_LoadForm(g_sFormsDir, this);
  60. ColumnSel->Options->Filtering = false;
  61. m_pFormList = new TList();
  62. TsList01->TabVisible = false;
  63. FRAMELinkList1->PnlTop->Visible = false;
  64. FRAMELinkList1->PnlBottom->Visible = false;
  65. FRAMEServiceLinkList1->PnlTop->Visible = false;
  66. FRAMEServiceLinkList1->PnlBottom->Visible = false;
  67. FRAMERoadList1->PnlTop->Visible = false;
  68. FRAMERoadList1->PnlBottom->Visible = false;
  69. cxPageControl1->ActivePageIndex = 0;
  70. cxPageControl2->ActivePageIndex = 0;
  71. PnlQry->Height = 190;
  72. }
  73. //---------------------------------------------------------------------------
  74. /*
  75. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  76. * Form과 DataModule class를 delete시킨다.
  77. * arguments
  78. *
  79. * return
  80. * void
  81. */
  82. void __fastcall TIST0030M::CommClose()
  83. {
  84. try
  85. {
  86. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  87. {
  88. m_pFormList->Delete(idx);
  89. }
  90. delete m_pFormList;
  91. CMM_SaveForm(g_sFormsDir, this);
  92. }
  93. catch(...)
  94. {
  95. }
  96. }
  97. //---------------------------------------------------------------------------
  98. /*
  99. * Form을 보여줄때 호출되는 event 메서드이다.
  100. * arguments
  101. * Sender : event handler 객체
  102. * return
  103. * void
  104. */
  105. void __fastcall TIST0030M::FormShow(TObject *Sender)
  106. {
  107. Refresh();
  108. FormInit();
  109. TmrShow->Enabled = true;
  110. }
  111. //---------------------------------------------------------------------------
  112. /*
  113. * form 초기화
  114. *
  115. * arguments
  116. *
  117. * return
  118. * void
  119. */
  120. void __fastcall TIST0030M::FormInit()
  121. {
  122. CbStatType->ItemIndex = 0;
  123. TDateTime dtStart = Now()-1;
  124. TDateTime dtEnd = Now();
  125. DtStDate->Date = dtStart;
  126. DtEdDate->Date = dtEnd;
  127. DtStTime->Date = dtStart;
  128. DtEdTime->Date = dtEnd;
  129. //DtStTime->Time = StrToDateTime("00:00");
  130. //DtEdTime->Time = StrToDateTime("23:59");
  131. //시간대 검색
  132. CbStatType1->ItemIndex = 0;
  133. dtStrDate1->DateTime = Now()-1;
  134. dtEndDate1->DateTime = Now();//-1;
  135. CbStrTm1->ItemIndex = 7;
  136. CbEndTm1->ItemIndex = 7;
  137. //지정시각 검색
  138. CbStrTm2->ItemIndex = 7;
  139. CbEndTm2->ItemIndex = 7;
  140. InitQryList();
  141. }
  142. //---------------------------------------------------------------------------
  143. void __fastcall TIST0030M::InitQryList()
  144. {
  145. CMM_ClearGridTableView(TvList);
  146. int nRow = 0;
  147. try
  148. {
  149. TcxDataController *pGDC = TvList->DataController;;
  150. TvList->BeginUpdate();
  151. for (int ii = 0; ii < MAX_QRY_LIST; ii++)
  152. {
  153. nRow = pGDC->AppendRecord();
  154. pGDC->Values[nRow][ColumnSel->Index] = false; //선택
  155. pGDC->Values[nRow][Column00->Index] = "-"; //편집
  156. pGDC->Values[nRow][Column01->Index] = (Now() - (MAX_QRY_LIST-ii)).FormatString("yyyy-MM-dd");
  157. pGDC->Values[nRow][Column02->Index] = "07";
  158. pGDC->Values[nRow][Column03->Index] = "07";
  159. }
  160. }
  161. __finally
  162. {
  163. TvList->EndUpdate();
  164. }
  165. }
  166. //---------------------------------------------------------------------------
  167. /*
  168. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  169. * arguments
  170. * Sender : event handler 객체
  171. * return
  172. * void
  173. */
  174. void __fastcall TIST0030M::TmrShowTimer(TObject *Sender)
  175. {
  176. TmrShow->Enabled = false;
  177. FRAMELinkList1->UpdateList();
  178. FRAMEServiceLinkList1->UpdateList();
  179. FRAMERoadList1->UpdateList();
  180. }
  181. //---------------------------------------------------------------------------
  182. /*
  183. * Refresh Data Event Function
  184. * arguments
  185. *
  186. * return
  187. * void
  188. */
  189. void __fastcall TIST0030M::RefreshData()
  190. {
  191. // 검색조건에 의한 링크 데이터 조회
  192. try
  193. {
  194. //SelListData();
  195. }
  196. __finally
  197. {
  198. }
  199. }
  200. //---------------------------------------------------------------------------
  201. /*
  202. * Search 버튼 클릭 이벤트 핸들러
  203. * arguments
  204. * Sender : event handler 객체
  205. * return
  206. * void
  207. */
  208. void __fastcall TIST0030M::BtnSearchClick(TObject *Sender)
  209. {
  210. Application->ProcessMessages();
  211. TSqlCursor sqlCrs((TControl*)BtnSearch);
  212. TcxGrid *pCxList = NULL;
  213. TcxGridTableView *pTvList = NULL;
  214. int nIdCol = -1;
  215. if (cxPageControl1->Properties->ActivePage->PageIndex == 0)
  216. {
  217. pCxList = FRAMELinkList1->CxList;
  218. pTvList = FRAMELinkList1->TvList;
  219. nIdCol = FRAMELinkList1->Column01->Index;
  220. FLinkLevel = 0;
  221. }
  222. else
  223. if (cxPageControl1->Properties->ActivePage->PageIndex == 1)
  224. {
  225. pCxList = FRAMEServiceLinkList1->CxList;
  226. pTvList = FRAMEServiceLinkList1->TvList;
  227. nIdCol = FRAMEServiceLinkList1->Column01->Index;
  228. FLinkLevel = 1;
  229. }
  230. else
  231. if (cxPageControl1->Properties->ActivePage->PageIndex == 2)
  232. {
  233. pCxList = FRAMERoadList1->CxList;
  234. pTvList = FRAMERoadList1->TvList;
  235. nIdCol = FRAMERoadList1->Column01->Index;
  236. FLinkLevel = 2;
  237. }
  238. if (!pTvList) return;
  239. TcxDataController *pGDC = pTvList->DataController;
  240. int nIndex = pGDC->FocusedRecordIndex;
  241. if( nIndex < 0 )
  242. {
  243. Application->MessageBox(FrmLang->lblSelErr->Caption.c_str(),//L"링크를 먼저 선택 하세요.",
  244. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  245. ActiveControl = pCxList;
  246. return;
  247. }
  248. FLinkId = VarToStr(pGDC->Values[nIndex][nIdCol]);
  249. String sStTime, sEdTime, sTemp;
  250. switch(CbStatType->ItemIndex)
  251. {
  252. case 0: //15분 통계
  253. case 1: //시간 통계(1시간)
  254. sStTime = DtStDate->Date.FormatString("yyyyMMdd") + DtStTime->Time.FormatString("hh");
  255. sEdTime = DtEdDate->Date.FormatString("yyyyMMdd") + DtEdTime->Time.FormatString("hh");
  256. FStTime = sStTime + "0000";
  257. FEdTime = sEdTime + "5959";
  258. break;
  259. case 2: //일 통계(1일)
  260. sStTime = DtStDate->Date.FormatString("yyyyMMdd");
  261. sEdTime = DtEdDate->Date.FormatString("yyyyMMdd");
  262. FStTime = sStTime + "000000";
  263. FEdTime = sEdTime + "235959";
  264. break;
  265. case 3: //월 통계(1개월)
  266. sStTime = DtStDate->Date.FormatString("yyyyMM");
  267. sEdTime = DtEdDate->Date.FormatString("yyyyMM");
  268. sTemp.printf(L"%02d", ITSUtil_GetMonthLastDay(AnsiString(sEdTime).c_str()));
  269. FStTime = sStTime + "01000000";
  270. FEdTime = sEdTime + sTemp + "235959";
  271. break;
  272. case 4: //년 통계(1년)
  273. sStTime = DtStDate->Date.FormatString("yyyy");
  274. sEdTime = DtEdDate->Date.FormatString("yyyy");
  275. FStTime = sStTime + "0101000000";
  276. FEdTime = sEdTime + "1231235959";
  277. break;
  278. default:
  279. return;
  280. }
  281. if (sStTime > sEdTime)
  282. {
  283. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  284. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  285. ActiveControl = DtStDate;
  286. return;
  287. }
  288. FStatType = CbStatType->ItemIndex;
  289. String sTitle;
  290. sTitle.printf(L"%s - %s(%s~%s) %s ", cxPageControl1->Properties->ActivePage->Caption.c_str(),
  291. CbStatType->Text.c_str(),
  292. sStTime.c_str(),
  293. sEdTime.c_str(),
  294. FLinkId.c_str());
  295. try
  296. {
  297. Application->ProcessMessages();
  298. LockWindowUpdate(Handle);
  299. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  300. if (!pSheet) return;
  301. IST00301 = new TIST00301(this, Handle, FLinkId, sStTime, sEdTime, FLinkLevel, FStatType);
  302. IST00301->Parent = pSheet;
  303. IST00301->Show();
  304. PgTab->ActivePage = pSheet;
  305. pSheet = PgTab->ActivePage;
  306. m_pFormList->Add(IST00301);
  307. }
  308. __finally
  309. {
  310. LockWindowUpdate(0);
  311. }
  312. }
  313. //---------------------------------------------------------------------------
  314. /*
  315. * Close 버튼 클릭 이벤트 핸들러
  316. * arguments
  317. * Sender : event handler 객체
  318. * return
  319. * void
  320. */
  321. void __fastcall TIST0030M::BtnCloseClick(TObject *Sender)
  322. {
  323. Close();
  324. }
  325. //---------------------------------------------------------------------------
  326. /*
  327. * 조회결과 폼이 닫힐때 메시지를 받아 처리한다.
  328. * arguments
  329. * Sender : event handler 객체
  330. * return
  331. * void
  332. */
  333. void __fastcall TIST0030M::OnSubFormClose(TMessage Msg)
  334. {
  335. int nActiveIdx = PgTab->ActivePageIndex;
  336. if (nActiveIdx <= 0) return;
  337. LockWindowUpdate(Handle);
  338. TcxTabSheet *pSheet = PgTab->ActivePage;
  339. if (pSheet)
  340. {
  341. delete pSheet;
  342. }
  343. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  344. m_pFormList->Delete(nActiveIdx);
  345. LockWindowUpdate(0);
  346. }
  347. //---------------------------------------------------------------------------
  348. /*
  349. * Tab Control의 Tab을 더블클릭하여 닫는다.
  350. * arguments
  351. * Sender : event handler 객체
  352. * return
  353. * void
  354. */
  355. void __fastcall TIST0030M::PgTabDblClick(TObject *Sender)
  356. {
  357. TPoint APoint;
  358. APoint = PgTab->MouseDownPos;
  359. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  360. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  361. }
  362. //---------------------------------------------------------------------------
  363. void __fastcall TIST0030M::FormClose(TObject *Sender, TCloseAction &Action)
  364. {
  365. CommClose();
  366. IST0030M = NULL;
  367. Action = caFree;
  368. }
  369. //---------------------------------------------------------------------------
  370. void __fastcall TIST0030M::CbStatTypePropertiesChange(TObject *Sender)
  371. {
  372. switch(CbStatType->ItemIndex)
  373. {
  374. case 0: //15분 통계
  375. case 1: //시간 통계(1시간)
  376. DtStDate->Format = " yyyy년 MM월 dd일";
  377. DtEdDate->Format = " yyyy년 MM월 dd일";
  378. DtStTime->Visible = true;
  379. DtEdTime->Visible = true;
  380. break;
  381. case 2: //일 통계(1일)
  382. DtStDate->Format = " yyyy년 MM월 dd일";
  383. DtEdDate->Format = " yyyy년 MM월 dd일";
  384. DtStTime->Visible = false;
  385. DtEdTime->Visible = false;
  386. break;
  387. case 3: //월 통계(1개월)
  388. DtStDate->Format = " yyyy년 MM월";
  389. DtEdDate->Format = " yyyy년 MM월";
  390. DtStTime->Visible = false;
  391. DtEdTime->Visible = false;
  392. break;
  393. case 4: //년 통계(1년)
  394. DtStDate->Format = " yyyy년";
  395. DtEdDate->Format = " yyyy년";
  396. DtStTime->Visible = false;
  397. DtEdTime->Visible = false;
  398. break;
  399. }
  400. }
  401. //---------------------------------------------------------------------------
  402. void __fastcall TIST0030M::cxPageControl2PageChanging(TObject *Sender, TcxTabSheet *NewPage,
  403. bool &AllowChange)
  404. {
  405. switch(NewPage->PageIndex)
  406. {
  407. case 0 :
  408. PnlQry->Height = 190;
  409. break;
  410. case 1 :
  411. PnlQry->Height = 220;
  412. break;
  413. case 2 :
  414. PnlQry->Height = 300;
  415. break;
  416. }
  417. }
  418. //---------------------------------------------------------------------------
  419. void __fastcall TIST0030M::BtnSearch1Click(TObject *Sender)
  420. {
  421. Application->ProcessMessages();
  422. TSqlCursor sqlCrs((TControl*)BtnSearch);
  423. TcxGrid *pCxList = NULL;
  424. TcxGridTableView *pTvList = NULL;
  425. int nIdCol = -1;
  426. if (cxPageControl1->Properties->ActivePage->PageIndex == 0)
  427. {
  428. pCxList = FRAMELinkList1->CxList;
  429. pTvList = FRAMELinkList1->TvList;
  430. nIdCol = FRAMELinkList1->Column01->Index;
  431. FLinkLevel = 0;
  432. }
  433. else
  434. if (cxPageControl1->Properties->ActivePage->PageIndex == 1)
  435. {
  436. pCxList = FRAMEServiceLinkList1->CxList;
  437. pTvList = FRAMEServiceLinkList1->TvList;
  438. nIdCol = FRAMEServiceLinkList1->Column01->Index;
  439. FLinkLevel = 1;
  440. }
  441. else
  442. if (cxPageControl1->Properties->ActivePage->PageIndex == 2)
  443. {
  444. pCxList = FRAMERoadList1->CxList;
  445. pTvList = FRAMERoadList1->TvList;
  446. nIdCol = FRAMERoadList1->Column01->Index;
  447. FLinkLevel = 2;
  448. }
  449. if (!pTvList) return;
  450. TcxDataController *pGDC = pTvList->DataController;
  451. int nIndex = pGDC->FocusedRecordIndex;
  452. if( nIndex < 0 )
  453. {
  454. Application->MessageBox(FrmLang->lblSelErr->Caption.c_str(),//L"링크를 먼저 선택 하세요.",
  455. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  456. ActiveControl = pCxList;
  457. return;
  458. }
  459. FLinkId = VarToStr(pGDC->Values[nIndex][nIdCol]);
  460. String sStTime, sEdTime, sTemp;
  461. switch(CbStatType->ItemIndex)
  462. {
  463. case 0: //15분 통계
  464. case 1: //시간 통계(1시간)
  465. sStTime = dtStrDate1->DateTime.FormatString("yyyyMMdd");
  466. sEdTime = dtEndDate1->DateTime.FormatString("yyyyMMdd");
  467. FStTime = sStTime + "000000";
  468. FEdTime = sEdTime + "235959";
  469. break;
  470. default:
  471. return;
  472. }
  473. if (sStTime > sEdTime)
  474. {
  475. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작일이 검색 종료일 보다 큽니다.",
  476. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  477. ActiveControl = dtStrDate1;
  478. return;
  479. }
  480. if (CbStrTm1->ItemIndex > CbEndTm1->ItemIndex)
  481. {
  482. Application->MessageBox(FrmLang->lblQryHourErr->Caption.c_str(),//L"시간대 시작시각이 시간대 종료시각 보다 큽니다.",
  483. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  484. ActiveControl = CbStrTm1;
  485. return;
  486. }
  487. FStTerm.printf(L"%02d0000", CbStrTm1->ItemIndex);
  488. FEdTerm.printf(L"%02d5959", CbEndTm1->ItemIndex);
  489. FStatType = CbStatType1->ItemIndex;
  490. String sTitle;
  491. sTitle.printf(L"%s - %s(%s~%s) %s ", cxPageControl1->Properties->ActivePage->Caption.c_str(),
  492. CbStatType1->Text.c_str(),
  493. sStTime.c_str(),
  494. sEdTime.c_str(),
  495. FLinkId.c_str());
  496. try
  497. {
  498. Application->ProcessMessages();
  499. LockWindowUpdate(Handle);
  500. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  501. if (!pSheet) return;
  502. IST00302 = new TIST00302(this, Handle, FLinkId, FStTime, FEdTime, FLinkLevel, FStatType, FStTerm, FEdTerm);
  503. IST00302->Parent = pSheet;
  504. IST00302->Show();
  505. PgTab->ActivePage = pSheet;
  506. pSheet = PgTab->ActivePage;
  507. m_pFormList->Add(IST00302);
  508. }
  509. __finally
  510. {
  511. LockWindowUpdate(0);
  512. }
  513. }
  514. //---------------------------------------------------------------------------
  515. void __fastcall TIST0030M::BtnSearch2Click(TObject *Sender)
  516. {
  517. Application->ProcessMessages();
  518. TSqlCursor sqlCrs((TControl*)BtnSearch);
  519. TcxGrid *pCxList = NULL;
  520. TcxGridTableView *pTvList = NULL;
  521. int nIdCol = -1;
  522. if (cxPageControl1->Properties->ActivePage->PageIndex == 0)
  523. {
  524. pCxList = FRAMELinkList1->CxList;
  525. pTvList = FRAMELinkList1->TvList;
  526. nIdCol = FRAMELinkList1->Column01->Index;
  527. FLinkLevel = 0;
  528. }
  529. else
  530. if (cxPageControl1->Properties->ActivePage->PageIndex == 1)
  531. {
  532. pCxList = FRAMEServiceLinkList1->CxList;
  533. pTvList = FRAMEServiceLinkList1->TvList;
  534. nIdCol = FRAMEServiceLinkList1->Column01->Index;
  535. FLinkLevel = 1;
  536. }
  537. else
  538. if (cxPageControl1->Properties->ActivePage->PageIndex == 2)
  539. {
  540. pCxList = FRAMERoadList1->CxList;
  541. pTvList = FRAMERoadList1->TvList;
  542. nIdCol = FRAMERoadList1->Column01->Index;
  543. FLinkLevel = 2;
  544. }
  545. if (!pTvList) return;
  546. TcxDataController *pGDC = pTvList->DataController;
  547. int nIndex = pGDC->FocusedRecordIndex;
  548. if( nIndex < 0 )
  549. {
  550. Application->MessageBox(FrmLang->lblSelErr->Caption.c_str(),//L"링크를 먼저 선택 하세요.",
  551. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  552. ActiveControl = pCxList;
  553. return;
  554. }
  555. FLinkId = VarToStr(pGDC->Values[nIndex][nIdCol]);
  556. int nSelects = CMM_GetCheckCount(TvList, ColumnSel->Index);
  557. if (0 == nSelects)
  558. {
  559. Application->MessageBox(FrmLang->lblSelNoDate->Caption.c_str(),//L"검색 지정일을 선택하지 않았습니다.",
  560. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  561. ActiveControl = CxList;
  562. return;
  563. }
  564. bool bDateCheck = true;
  565. int nRowCnt = TvList->ViewData->RecordCount;
  566. for (int ii = 0; ii < nRowCnt; ii++)
  567. {
  568. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  569. if (((bool)ARow->Values[ColumnSel->Index]))
  570. {
  571. try
  572. {
  573. if (VarIsNull(ARow->Values[Column01->Index]))
  574. {
  575. bDateCheck = false;
  576. break;
  577. }
  578. String sSelDay = ARow->Values[Column01->Index];
  579. sSelDay = StringReplace(sSelDay, DateSeparator, "", TReplaceFlags() << rfReplaceAll);
  580. if (sSelDay.Length() != 8)
  581. {
  582. bDateCheck = false;
  583. break;
  584. }
  585. }
  586. catch(Exception &e)
  587. {
  588. }
  589. }
  590. }
  591. if (!bDateCheck)
  592. {
  593. Application->MessageBox(FrmLang->lblSelDtErr->Caption.c_str(),//L"검색 지정일의 일자가 올바르지 않았습니다.",
  594. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  595. ActiveControl = CxList;
  596. return;
  597. }
  598. if (CbStrTm2->ItemIndex > CbEndTm2->ItemIndex)
  599. {
  600. Application->MessageBox(FrmLang->lblSelHourOver->Caption.c_str(),//L"시간대 시작시각이 시간대 종료시각 보다 큽니다.",
  601. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  602. ActiveControl = CbStrTm1;
  603. return;
  604. }
  605. FStTerm.printf(L"%02d0000", CbStrTm2->ItemIndex);
  606. FEdTerm.printf(L"%02d5959", CbEndTm2->ItemIndex);
  607. FStatType = CbStatType2->ItemIndex;
  608. String sTitle;
  609. sTitle.printf(L"%s - %s %s ", cxPageControl1->Properties->ActivePage->Caption.c_str(),
  610. CbStatType2->Text.c_str(),
  611. FLinkId.c_str());
  612. try
  613. {
  614. Application->ProcessMessages();
  615. LockWindowUpdate(Handle);
  616. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  617. if (!pSheet) return;
  618. IST00303 = new TIST00303(this, Handle, FLinkId, FStTime, FEdTime, FLinkLevel, FStatType, FStTerm, FEdTerm);
  619. IST00303->FSelDayCnt = 0;
  620. int nRowCnt = TvList->ViewData->RecordCount;
  621. for (int ii = 0; ii < nRowCnt; ii++)
  622. {
  623. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  624. if (((bool)ARow->Values[ColumnSel->Index]))
  625. {
  626. try
  627. {
  628. TDateTime dt = VarToDateTime(ARow->Values[Column01->Index]);
  629. String sSelDay = dt.FormatString("yyyyMMdd");
  630. IST00303->FSelDay[IST00303->FSelDayCnt++] = sSelDay;
  631. }
  632. catch(Exception &e)
  633. {
  634. }
  635. }
  636. }
  637. IST00303->Parent = pSheet;
  638. IST00303->Show();
  639. PgTab->ActivePage = pSheet;
  640. pSheet = PgTab->ActivePage;
  641. m_pFormList->Add(IST00302);
  642. }
  643. __finally
  644. {
  645. LockWindowUpdate(0);
  646. }
  647. }
  648. //---------------------------------------------------------------------------
  649. void __fastcall TIST0030M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  650. {
  651. int nActiveIdx = ATabIndex;
  652. if (nActiveIdx <= 0) return;
  653. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  654. m_pFormList->Delete(nActiveIdx);
  655. }
  656. //---------------------------------------------------------------------------