DSRH020MF.cpp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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 "DSRH020MF.h"
  9. #include "DSRH0201F.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "FRAME_DsrcListF"
  13. #pragma link "cxButtons"
  14. #pragma link "cxCalendar"
  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 "cxLabel"
  22. #pragma link "cxLookAndFeelPainters"
  23. #pragma link "cxLookAndFeels"
  24. #pragma link "cxMaskEdit"
  25. #pragma link "cxPC"
  26. #pragma link "cxPCdxBarPopupMenu"
  27. #pragma link "cxSpinEdit"
  28. #pragma link "cxSplitter"
  29. #pragma link "cxTextEdit"
  30. #pragma link "cxTimeEdit"
  31. #pragma link "dxSkinBlack"
  32. #pragma link "dxSkinBlue"
  33. #pragma link "dxSkinsCore"
  34. #pragma link "dxSkinscxPCPainter"
  35. #pragma link "dxSkinMcSkin"
  36. #pragma resource "*.dfm"
  37. TDSRH020M *DSRH020M = NULL;
  38. //---------------------------------------------------------------------------
  39. __fastcall TDSRH020M::TDSRH020M(TComponent* Owner)
  40. : TForm(Owner)
  41. {
  42. LangTrans->Translate(this, ITSDb_GetConnection());
  43. ITSSkin_Load(this);
  44. CMM_LoadForm(g_sFormsDir, this);
  45. FTitle = Caption;
  46. m_pFormList = new TList();
  47. TsList01->TabVisible = false;
  48. FRAMEDsrcList1->PnlBottom->Visible = false;
  49. }
  50. //---------------------------------------------------------------------------
  51. void __fastcall TDSRH020M::CommClose()
  52. {
  53. try
  54. {
  55. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  56. {
  57. m_pFormList->Delete(idx);
  58. }
  59. delete m_pFormList;
  60. CMM_SaveForm(g_sFormsDir, this);
  61. }
  62. catch(...)
  63. {
  64. }
  65. }
  66. //---------------------------------------------------------------------------
  67. void __fastcall TDSRH020M::FormShow(TObject *Sender)
  68. {
  69. Refresh();
  70. FormInit();
  71. TmrShow->Enabled = true;
  72. }
  73. //---------------------------------------------------------------------------
  74. void __fastcall TDSRH020M::FormInit()
  75. {
  76. DtStDate->Date = Now() - 1;
  77. DtEdDate->Date = Now() - 1;
  78. //DtEdTime->EditValue = Now().FormatString("hh");
  79. DtStTime->Time = StrToDateTime("00:00");
  80. DtEdTime->Time = StrToDateTime("23:59");
  81. }
  82. //---------------------------------------------------------------------------
  83. void __fastcall TDSRH020M::TmrShowTimer(TObject *Sender)
  84. {
  85. TmrShow->Enabled = false;
  86. FRAMEDsrcList1->UpdateList();
  87. }
  88. //---------------------------------------------------------------------------
  89. void __fastcall TDSRH020M::RefreshData()
  90. {
  91. // 검색조건에 의한 링크 데이터 조회
  92. try
  93. {
  94. //SelListData();
  95. }
  96. __finally
  97. {
  98. }
  99. }
  100. //---------------------------------------------------------------------------
  101. void __fastcall TDSRH020M::BtnSearchClick(TObject *Sender)
  102. {
  103. Application->ProcessMessages();
  104. TSqlCursor sqlCrs((TControl*)BtnSearch);
  105. #if 0
  106. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  107. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  108. #else
  109. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  110. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  111. #endif
  112. if (FStDateTime > FEdDateTime)
  113. {
  114. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  115. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  116. ActiveControl = DtStDate;
  117. return;
  118. }
  119. #if 0
  120. FStDateTime = FStDateTime + "0000";
  121. FEdDateTime = FEdDateTime + "5959";
  122. #else
  123. FStDateTime = FStDateTime + "00";
  124. FEdDateTime = FEdDateTime + "59";
  125. #endif
  126. FIdList = "";
  127. int nSelects = CMM_GetSelectCount(FRAMEDsrcList1->TvList, FRAMEDsrcList1->ColumnSel->Index, FRAMEDsrcList1->Column01->Index, FIdList);
  128. if (0 == nSelects)
  129. {
  130. Application->MessageBox(FrmLang->lblSelLstErr->Caption.c_str(),//L"검색 목록을 선택하지 않았습니다.",
  131. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  132. FRAMEDsrcList1->CxList->SetFocus();
  133. return;
  134. }
  135. String sTitle = "[" + FStDateTime.SubString(1, 12) + "-" + FEdDateTime.SubString(1, 12) + "]";
  136. try
  137. {
  138. Application->ProcessMessages();
  139. LockWindowUpdate(Handle);
  140. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  141. if (!pSheet) return;
  142. DSRH0201 = new TDSRH0201(this, Handle, FStDateTime, FEdDateTime, FIdList);
  143. DSRH0201->Parent = pSheet;
  144. DSRH0201->Show();
  145. PgTab->ActivePage = pSheet;
  146. pSheet = PgTab->ActivePage;
  147. m_pFormList->Add(DSRH0201);
  148. }
  149. __finally
  150. {
  151. LockWindowUpdate(0);
  152. }
  153. }
  154. //---------------------------------------------------------------------------
  155. void __fastcall TDSRH020M::BtnCloseClick(TObject *Sender)
  156. {
  157. Close();
  158. }
  159. //---------------------------------------------------------------------------
  160. void __fastcall TDSRH020M::OnSubFormClose(TMessage Msg)
  161. {
  162. int nActiveIdx = PgTab->ActivePageIndex;
  163. if (nActiveIdx <= 0) return;
  164. LockWindowUpdate(Handle);
  165. TcxTabSheet *pSheet = PgTab->ActivePage;
  166. if (pSheet)
  167. {
  168. delete pSheet;
  169. }
  170. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  171. m_pFormList->Delete(nActiveIdx);
  172. LockWindowUpdate(0);
  173. }
  174. //---------------------------------------------------------------------------
  175. void __fastcall TDSRH020M::PgTabDblClick(TObject *Sender)
  176. {
  177. TPoint APoint;
  178. APoint = PgTab->MouseDownPos;
  179. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  180. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  181. }
  182. //---------------------------------------------------------------------------
  183. void __fastcall TDSRH020M::FormClose(TObject *Sender, TCloseAction &Action)
  184. {
  185. CommClose();
  186. DSRH020M = NULL;
  187. Action = caFree;
  188. }
  189. //---------------------------------------------------------------------------
  190. void __fastcall TDSRH020M::FormCloseQuery(TObject *Sender, bool &CanClose)
  191. {
  192. FRAMEDsrcList1->OnCloseQuery(CanClose);
  193. }
  194. //---------------------------------------------------------------------------
  195. void __fastcall TDSRH020M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  196. {
  197. int nActiveIdx = ATabIndex;
  198. if (nActiveIdx <= 0) return;
  199. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  200. m_pFormList->Delete(nActiveIdx);
  201. }
  202. //---------------------------------------------------------------------------