VDSS010MF.cpp 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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 "VDSS010MF.h"
  10. #include "VDSS0101F.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13. #pragma link "FRAME_VdsDtctListF"
  14. #pragma link "cxButtons"
  15. #pragma link "cxContainer"
  16. #pragma link "cxControls"
  17. #pragma link "cxDropDownEdit"
  18. #pragma link "cxEdit"
  19. #pragma link "cxGraphics"
  20. #pragma link "cxGroupBox"
  21. #pragma link "cxLookAndFeelPainters"
  22. #pragma link "cxLookAndFeels"
  23. #pragma link "cxMaskEdit"
  24. #pragma link "cxPC"
  25. #pragma link "cxPCdxBarPopupMenu"
  26. #pragma link "cxSplitter"
  27. #pragma link "cxTextEdit"
  28. #pragma link "dxSkinBlack"
  29. #pragma link "dxSkinBlue"
  30. #pragma link "dxSkinsCore"
  31. #pragma link "dxSkinscxPCPainter"
  32. #pragma resource "*.dfm"
  33. TVDSS010M *VDSS010M = NULL;
  34. //---------------------------------------------------------------------------
  35. __fastcall TVDSS010M::TVDSS010M(TComponent* Owner)
  36. : TForm(Owner)
  37. {
  38. LangTrans->Translate(this, ITSDb_GetConnection());
  39. ITSSkin_Load(this);
  40. CMM_LoadForm(g_sFormsDir, this);
  41. FTitle = Caption;//"VDS-검지기 소통정보 통계";
  42. m_pFormList = new TList();
  43. TsList01->TabVisible = false;
  44. FRAMEVdsDtctList1->PnlBottom->Visible = false;
  45. //FRAMEVdsDtctList1->ColumnSel->Visible = false;
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall TVDSS010M::CommClose()
  49. {
  50. try
  51. {
  52. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  53. {
  54. m_pFormList->Delete(idx);
  55. }
  56. delete m_pFormList;
  57. CMM_SaveForm(g_sFormsDir, this);
  58. }
  59. catch(...)
  60. {
  61. }
  62. }
  63. //---------------------------------------------------------------------------
  64. void __fastcall TVDSS010M::FormShow(TObject *Sender)
  65. {
  66. Refresh();
  67. FormInit();
  68. TmrShow->Enabled = true;
  69. }
  70. //---------------------------------------------------------------------------
  71. void __fastcall TVDSS010M::FormInit()
  72. {
  73. CbStatType->ItemIndex = 0;
  74. TDateTime dtStart = Now()-1;
  75. TDateTime dtEnd = Now();
  76. DtStDate->Date = dtStart;
  77. DtEdDate->Date = dtEnd;
  78. DtStTime->Date = dtStart;
  79. DtEdTime->Date = dtEnd;
  80. //DtStTime->Time = StrToDateTime("00:00");
  81. //DtEdTime->Time = StrToDateTime("23:59");
  82. }
  83. //---------------------------------------------------------------------------
  84. void __fastcall TVDSS010M::TmrShowTimer(TObject *Sender)
  85. {
  86. TmrShow->Enabled = false;
  87. FRAMEVdsDtctList1->UpdateList();
  88. }
  89. //---------------------------------------------------------------------------
  90. void __fastcall TVDSS010M::RefreshData()
  91. {
  92. // 검색조건에 의한 링크 데이터 조회
  93. try
  94. {
  95. //SelListData();
  96. }
  97. __finally
  98. {
  99. }
  100. }
  101. //---------------------------------------------------------------------------
  102. void __fastcall TVDSS010M::BtnSearchClick(TObject *Sender)
  103. {
  104. Application->ProcessMessages();
  105. TSqlCursor sqlCrs((TControl*)BtnSearch);
  106. TcxGrid *pCxList;
  107. TcxGridTableView *pTvList = NULL;
  108. int nIdCol = -1;
  109. pCxList = FRAMEVdsDtctList1->CxList;
  110. pTvList = FRAMEVdsDtctList1->TvList;
  111. nIdCol = FRAMEVdsDtctList1->Column02->Index;
  112. if (!pTvList) return;
  113. TcxDataController *pGDC = pTvList->DataController;
  114. #if 0
  115. int nIndex = pGDC->FocusedRecordIndex;
  116. if( nIndex < 0 )
  117. {
  118. Application->MessageBox(FrmLang->lblSelErr->Caption.c_str(),//L"VDS-검지기를 먼저 선택 하세요.",
  119. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  120. ActiveControl = pCxList;
  121. return;
  122. }
  123. FSelId = VarToStr(pGDC->Values[nIndex][nIdCol]);
  124. #else
  125. int nSelects = CMM_GetSelectCount(FRAMEVdsDtctList1->TvList, FRAMEVdsDtctList1->ColumnSel->Index, FRAMEVdsDtctList1->Column02->Index, FSelId);
  126. if (0 == nSelects)
  127. {
  128. Application->MessageBox(FrmLang->lblSelLstErr->Caption.c_str(),//L"검색 목록을 선택하지 않았습니다.",
  129. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  130. FRAMEVdsDtctList1->CxList->SetFocus();
  131. return;
  132. }
  133. #endif
  134. String sStTime, sEdTime, sTemp;
  135. switch(CbStatType->ItemIndex)
  136. {
  137. case 0: //15분 통계
  138. case 1: //시간 통계(1시간)
  139. sStTime = DtStDate->Date.FormatString("yyyyMMdd") + DtStTime->Time.FormatString("hh");
  140. sEdTime = DtEdDate->Date.FormatString("yyyyMMdd") + DtEdTime->Time.FormatString("hh");
  141. FStTime = sStTime + "0000";
  142. FEdTime = sEdTime + "5959";
  143. break;
  144. case 2: //일 통계(1일)
  145. sStTime = DtStDate->Date.FormatString("yyyyMMdd");
  146. sEdTime = DtEdDate->Date.FormatString("yyyyMMdd");
  147. FStTime = sStTime + "000000";
  148. FEdTime = sEdTime + "235959";
  149. break;
  150. case 3: //월 통계(1개월)
  151. sStTime = DtStDate->Date.FormatString("yyyyMM");
  152. sEdTime = DtEdDate->Date.FormatString("yyyyMM");
  153. sTemp.printf(L"%02d", ITSUtil_GetMonthLastDay(AnsiString(sEdTime).c_str()));
  154. //FStTime = sStTime + "01000000";
  155. FStTime = sStTime + "00000000";
  156. FEdTime = sEdTime + sTemp + "235959";
  157. break;
  158. }
  159. if (sStTime > sEdTime)
  160. {
  161. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  162. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  163. ActiveControl = DtStDate;
  164. return;
  165. }
  166. FStatType = CbStatType->ItemIndex;
  167. String sTitle;
  168. sTitle.printf(L"%s(%s~%s) %s ", CbStatType->Text.c_str(),
  169. sStTime.c_str(),
  170. sEdTime.c_str(),
  171. FSelId.c_str());
  172. String sCaption;
  173. #if 0
  174. sCaption.printf(L"%s [%s] ", CbStatType->Text.c_str(), FSelId.c_str());
  175. #else
  176. //sCaption.printf(L"%s [%s] ", CbStatType->Text.c_str(), FSelId.c_str());
  177. //sCaption = CMM_GetSelectTitle(FRAMEVdsDtctList1->TvList, FRAMEVdsDtctList1->ColumnSel->Index, FRAMEVdsDtctList1->Column02->Index);
  178. sCaption.printf(L" %s ", CbStatType->Text.c_str());
  179. #endif
  180. try
  181. {
  182. Application->ProcessMessages();
  183. LockWindowUpdate(Handle);
  184. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sCaption);
  185. if (!pSheet) return;
  186. VDSS0101 = new TVDSS0101(this, Handle, FSelId, sStTime, sEdTime, FStatType);
  187. VDSS0101->Parent = pSheet;
  188. VDSS0101->Show();
  189. PgTab->ActivePage = pSheet;
  190. pSheet = PgTab->ActivePage;
  191. m_pFormList->Add(VDSS0101);
  192. }
  193. __finally
  194. {
  195. LockWindowUpdate(0);
  196. }
  197. }
  198. //---------------------------------------------------------------------------
  199. void __fastcall TVDSS010M::BtnCloseClick(TObject *Sender)
  200. {
  201. Close();
  202. }
  203. //---------------------------------------------------------------------------
  204. void __fastcall TVDSS010M::OnSubFormClose(TMessage Msg)
  205. {
  206. int nActiveIdx = PgTab->ActivePageIndex;
  207. if (nActiveIdx <= 0) return;
  208. LockWindowUpdate(Handle);
  209. TcxTabSheet *pSheet = PgTab->ActivePage;
  210. if (pSheet)
  211. {
  212. delete pSheet;
  213. }
  214. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  215. m_pFormList->Delete(nActiveIdx);
  216. LockWindowUpdate(0);
  217. }
  218. //---------------------------------------------------------------------------
  219. void __fastcall TVDSS010M::PgTabDblClick(TObject *Sender)
  220. {
  221. TPoint APoint;
  222. APoint = PgTab->MouseDownPos;
  223. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  224. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  225. }
  226. //---------------------------------------------------------------------------
  227. void __fastcall TVDSS010M::FormClose(TObject *Sender, TCloseAction &Action)
  228. {
  229. CommClose();
  230. VDSS010M = NULL;
  231. Action = caFree;
  232. }
  233. //---------------------------------------------------------------------------
  234. void __fastcall TVDSS010M::CbStatTypePropertiesChange(TObject *Sender)
  235. {
  236. switch(CbStatType->ItemIndex)
  237. {
  238. case 0: //15분 통계
  239. case 1: //시간 통계(1시간)
  240. DtStDate->Format = " yyyy년 MM월 dd일";
  241. DtEdDate->Format = " yyyy년 MM월 dd일";
  242. DtStTime->Visible = true;
  243. DtEdTime->Visible = true;
  244. break;
  245. case 2: //일 통계(1일)
  246. DtStDate->Format = " yyyy년 MM월 dd일";
  247. DtEdDate->Format = " yyyy년 MM월 dd일";
  248. DtStTime->Visible = false;
  249. DtEdTime->Visible = false;
  250. break;
  251. case 3: //월 통계(1개월)
  252. DtStDate->Format = " yyyy년 MM월";
  253. DtEdDate->Format = " yyyy년 MM월";
  254. DtStTime->Visible = false;
  255. DtEdTime->Visible = false;
  256. break;
  257. }
  258. }
  259. //---------------------------------------------------------------------------
  260. void __fastcall TVDSS010M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  261. {
  262. int nActiveIdx = ATabIndex;
  263. if (nActiveIdx <= 0) return;
  264. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  265. m_pFormList->Delete(nActiveIdx);
  266. }
  267. //---------------------------------------------------------------------------