IAN0060MF.cpp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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 "IAN0060MF.h"
  9. #include "IAN00601F.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 "cxSplitter"
  28. #pragma link "cxTextEdit"
  29. #pragma link "cxTimeEdit"
  30. #pragma link "dxSkinBlack"
  31. #pragma link "dxSkinBlue"
  32. #pragma link "dxSkinsCore"
  33. #pragma link "dxSkinscxPCPainter"
  34. #pragma resource "*.dfm"
  35. TIAN0060M *IAN0060M = NULL;
  36. //---------------------------------------------------------------------------
  37. __fastcall TIAN0060M::TIAN0060M(TComponent* Owner)
  38. : TForm(Owner)
  39. {
  40. LangTrans->Translate(this, ITSDb_GetConnection());
  41. ITSSkin_Load(this);
  42. CMM_LoadForm(g_sFormsDir, this);
  43. FTitle = Caption;//"반복정체구간 분석";
  44. m_pFormList = new TList();
  45. TsList01->TabVisible = false;
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall TIAN0060M::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 TIAN0060M::FormShow(TObject *Sender)
  65. {
  66. Refresh();
  67. FormInit();
  68. TmrShow->Enabled = true;
  69. }
  70. //---------------------------------------------------------------------------
  71. void __fastcall TIAN0060M::FormInit()
  72. {
  73. TItsCode *pCode = ItsCodeManager->FLists.Find("DTW");
  74. CbPatternWeek->Properties->Items->Clear();
  75. CbPatternWeek->Properties->Items->Add("[ALL] 전체");
  76. if (pCode)
  77. {
  78. FOR_STL(TItsSubCode *, pSubCode, pCode->FSubLists)
  79. {
  80. CbPatternWeek->Properties->Items->Add("[" + pSubCode->CMMN_CD + "] " + pSubCode->CMMN_CD_KOR_NM);
  81. }
  82. }
  83. CbPatternWeek->ItemIndex = 0;
  84. DtBaseMon->Date = Now() - 30;
  85. }
  86. //---------------------------------------------------------------------------
  87. void __fastcall TIAN0060M::TmrShowTimer(TObject *Sender)
  88. {
  89. TmrShow->Enabled = false;
  90. }
  91. //---------------------------------------------------------------------------
  92. void __fastcall TIAN0060M::RefreshData()
  93. {
  94. // 검색조건에 의한 링크 데이터 조회
  95. try
  96. {
  97. //SelListData();
  98. }
  99. __finally
  100. {
  101. }
  102. }
  103. //---------------------------------------------------------------------------
  104. void __fastcall TIAN0060M::BtnSearchClick(TObject *Sender)
  105. {
  106. Application->ProcessMessages();
  107. TSqlCursor sqlCrs((TControl*)BtnSearch);
  108. FStDateTime = DtBaseMon->Date.FormatString("yyyymm");
  109. FEdDateTime = DtBaseMon->Date.FormatString("yyyymm");
  110. if (FStDateTime > FEdDateTime)
  111. {
  112. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  113. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  114. ActiveControl = DtBaseMon;
  115. return;
  116. }
  117. FIdList = ITSUtil_GetCode(CbPatternWeek->Text);;
  118. String sTitle = "[" + FStDateTime + ": " + CbPatternWeek->Text + "]";
  119. try
  120. {
  121. Application->ProcessMessages();
  122. LockWindowUpdate(Handle);
  123. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  124. if (!pSheet) return;
  125. IAN00601 = new TIAN00601(this, Handle, FStDateTime, FEdDateTime, FIdList);
  126. IAN00601->Parent = pSheet;
  127. IAN00601->Show();
  128. PgTab->ActivePage = pSheet;
  129. pSheet = PgTab->ActivePage;
  130. m_pFormList->Add(IAN00601);
  131. }
  132. __finally
  133. {
  134. LockWindowUpdate(0);
  135. }
  136. }
  137. //---------------------------------------------------------------------------
  138. void __fastcall TIAN0060M::BtnCloseClick(TObject *Sender)
  139. {
  140. Close();
  141. }
  142. //---------------------------------------------------------------------------
  143. void __fastcall TIAN0060M::OnSubFormClose(TMessage Msg)
  144. {
  145. int nActiveIdx = PgTab->ActivePageIndex;
  146. if (nActiveIdx <= 0) return;
  147. LockWindowUpdate(Handle);
  148. TcxTabSheet *pSheet = PgTab->ActivePage;
  149. if (pSheet)
  150. {
  151. delete pSheet;
  152. }
  153. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  154. m_pFormList->Delete(nActiveIdx);
  155. LockWindowUpdate(0);
  156. }
  157. //---------------------------------------------------------------------------
  158. void __fastcall TIAN0060M::PgTabDblClick(TObject *Sender)
  159. {
  160. TPoint APoint;
  161. APoint = PgTab->MouseDownPos;
  162. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  163. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  164. }
  165. //---------------------------------------------------------------------------
  166. void __fastcall TIAN0060M::FormClose(TObject *Sender, TCloseAction &Action)
  167. {
  168. CommClose();
  169. IAN0060M = NULL;
  170. Action = caFree;
  171. }
  172. //---------------------------------------------------------------------------
  173. void __fastcall TIAN0060M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  174. {
  175. int nActiveIdx = ATabIndex;
  176. if (nActiveIdx <= 0) return;
  177. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  178. m_pFormList->Delete(nActiveIdx);
  179. }
  180. //---------------------------------------------------------------------------