IFM0040MF.cpp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #include "ITSLangTransF.h"
  7. #pragma hdrstop
  8. #include "IFM0040MF.h"
  9. #include "IFM00401F.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "cxButtons"
  13. #pragma link "cxCalendar"
  14. #pragma link "cxContainer"
  15. #pragma link "cxControls"
  16. #pragma link "cxDropDownEdit"
  17. #pragma link "cxEdit"
  18. #pragma link "cxGraphics"
  19. #pragma link "cxGroupBox"
  20. #pragma link "cxLabel"
  21. #pragma link "cxLookAndFeelPainters"
  22. #pragma link "cxLookAndFeels"
  23. #pragma link "cxMaskEdit"
  24. #pragma link "cxPC"
  25. #pragma link "cxPCdxBarPopupMenu"
  26. #pragma link "cxSpinEdit"
  27. #pragma link "cxTextEdit"
  28. #pragma link "cxTimeEdit"
  29. #pragma link "dxSkinBlack"
  30. #pragma link "dxSkinBlue"
  31. #pragma link "dxSkinsCore"
  32. #pragma link "dxSkinscxPCPainter"
  33. #pragma resource "*.dfm"
  34. TIFM0040M *IFM0040M = NULL;
  35. //---------------------------------------------------------------------------
  36. __fastcall TIFM0040M::TIFM0040M(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;//"시설물장애 이력조회";
  43. m_pFormList = new TList();
  44. TsList01->TabVisible = false;
  45. }
  46. //---------------------------------------------------------------------------
  47. void __fastcall TIFM0040M::CommClose()
  48. {
  49. try
  50. {
  51. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  52. {
  53. m_pFormList->Delete(idx);
  54. }
  55. delete m_pFormList;
  56. CMM_SaveForm(g_sFormsDir, this);
  57. }
  58. catch(...)
  59. {
  60. }
  61. }
  62. //---------------------------------------------------------------------------
  63. void __fastcall TIFM0040M::FormShow(TObject *Sender)
  64. {
  65. Refresh();
  66. FormInit();
  67. TmrShow->Enabled = true;
  68. }
  69. //---------------------------------------------------------------------------
  70. void __fastcall TIFM0040M::FormInit()
  71. {
  72. DtStDate->Date = Now() - 1;
  73. DtEdDate->Date = Now();
  74. DtEdTime->EditValue = Now().FormatString("hh");
  75. }
  76. //---------------------------------------------------------------------------
  77. void __fastcall TIFM0040M::TmrShowTimer(TObject *Sender)
  78. {
  79. TmrShow->Enabled = false;
  80. }
  81. //---------------------------------------------------------------------------
  82. void __fastcall TIFM0040M::RefreshData()
  83. {
  84. // 검색조건에 의한 링크 데이터 조회
  85. try
  86. {
  87. //SelListData();
  88. }
  89. __finally
  90. {
  91. }
  92. }
  93. //---------------------------------------------------------------------------
  94. void __fastcall TIFM0040M::BtnSearchClick(TObject *Sender)
  95. {
  96. Application->ProcessMessages();
  97. TSqlCursor sqlCrs((TControl*)BtnSearch);
  98. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  99. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  100. if (FStDateTime > FEdDateTime)
  101. {
  102. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  103. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  104. ActiveControl = DtStDate;
  105. return;
  106. }
  107. FStDateTime = FStDateTime + "0000";
  108. FEdDateTime = FEdDateTime + "5959";
  109. FIdList = "";
  110. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  111. try
  112. {
  113. Application->ProcessMessages();
  114. LockWindowUpdate(Handle);
  115. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  116. if (!pSheet) return;
  117. IFM00401 = new TIFM00401(this, Handle, FStDateTime, FEdDateTime, FIdList);
  118. IFM00401->Parent = pSheet;
  119. IFM00401->Show();
  120. PgTab->ActivePage = pSheet;
  121. pSheet = PgTab->ActivePage;
  122. m_pFormList->Add(IFM00401);
  123. }
  124. __finally
  125. {
  126. LockWindowUpdate(0);
  127. }
  128. }
  129. //---------------------------------------------------------------------------
  130. void __fastcall TIFM0040M::BtnCloseClick(TObject *Sender)
  131. {
  132. Close();
  133. }
  134. //---------------------------------------------------------------------------
  135. void __fastcall TIFM0040M::OnSubFormClose(TMessage Msg)
  136. {
  137. int nActiveIdx = PgTab->ActivePageIndex;
  138. if (nActiveIdx <= 0) return;
  139. LockWindowUpdate(Handle);
  140. TcxTabSheet *pSheet = PgTab->ActivePage;
  141. if (pSheet)
  142. {
  143. delete pSheet;
  144. }
  145. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  146. m_pFormList->Delete(nActiveIdx);
  147. LockWindowUpdate(0);
  148. }
  149. //---------------------------------------------------------------------------
  150. void __fastcall TIFM0040M::PgTabDblClick(TObject *Sender)
  151. {
  152. TPoint APoint;
  153. APoint = PgTab->MouseDownPos;
  154. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  155. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  156. }
  157. //---------------------------------------------------------------------------
  158. void __fastcall TIFM0040M::FormClose(TObject *Sender, TCloseAction &Action)
  159. {
  160. CommClose();
  161. IFM0040M = NULL;
  162. Action = caFree;
  163. }
  164. //---------------------------------------------------------------------------
  165. void __fastcall TIFM0040M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  166. {
  167. int nActiveIdx = ATabIndex;
  168. if (nActiveIdx <= 0) return;
  169. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  170. m_pFormList->Delete(nActiveIdx);
  171. }
  172. //---------------------------------------------------------------------------