VDSS010MF.cpp 8.9 KB

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