VDSH070MF.cpp 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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 "VDSH070MF.h"
  9. #include "VDSH0701F.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 "dxSkinBlue"
  31. #pragma link "dxSkinsCore"
  32. #pragma link "dxSkinscxPCPainter"
  33. #pragma link "FRAME_VdsDtctListF"
  34. #pragma resource "*.dfm"
  35. TVDSH070M *VDSH070M = NULL;
  36. //---------------------------------------------------------------------------
  37. __fastcall TVDSH070M::TVDSH070M(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;//"VDS-검지기 보정 이력조회";
  44. m_pFormList = new TList();
  45. TsList01->TabVisible = false;
  46. FRAMEVdsDtctList1->PnlBottom->Visible = false;
  47. }
  48. //---------------------------------------------------------------------------
  49. void __fastcall TVDSH070M::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 TVDSH070M::FormShow(TObject *Sender)
  66. {
  67. Refresh();
  68. FormInit();
  69. TmrShow->Enabled = true;
  70. }
  71. //---------------------------------------------------------------------------
  72. void __fastcall TVDSH070M::FormInit()
  73. {
  74. DtStDate->Date = Now() - 1;
  75. DtEdDate->Date = Now() - 1;
  76. //DtEdTime->EditValue = Now().FormatString("hh");
  77. DtStTime->Time = StrToDateTime("00:00");
  78. DtEdTime->Time = StrToDateTime("23:59");
  79. }
  80. //---------------------------------------------------------------------------
  81. void __fastcall TVDSH070M::TmrShowTimer(TObject *Sender)
  82. {
  83. TmrShow->Enabled = false;
  84. FRAMEVdsDtctList1->UpdateList();
  85. }
  86. //---------------------------------------------------------------------------
  87. void __fastcall TVDSH070M::RefreshData()
  88. {
  89. // 검색조건에 의한 링크 데이터 조회
  90. try
  91. {
  92. //SelListData();
  93. }
  94. __finally
  95. {
  96. }
  97. }
  98. //---------------------------------------------------------------------------
  99. void __fastcall TVDSH070M::BtnSearchClick(TObject *Sender)
  100. {
  101. Application->ProcessMessages();
  102. TSqlCursor sqlCrs((TControl*)BtnSearch);
  103. #if 0
  104. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  105. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  106. #else
  107. FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  108. FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  109. #endif
  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 = DtStDate;
  115. return;
  116. }
  117. #if 0
  118. FStDateTime = FStDateTime + "0000";
  119. FEdDateTime = FEdDateTime + "5959";
  120. #else
  121. FStDateTime = FStDateTime + "00";
  122. FEdDateTime = FEdDateTime + "59";
  123. #endif
  124. FIdList = "";
  125. int nSelects = CMM_GetSelectCount(FRAMEVdsDtctList1->TvList, FRAMEVdsDtctList1->ColumnSel->Index, FRAMEVdsDtctList1->Column02->Index, FIdList);
  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. #if 0
  134. String sTitle = "[" + FStDateTime + "-" + FEdDateTime + "]";
  135. #else
  136. String sTitle = CMM_GetSelectTitle(FRAMEVdsDtctList1->TvList, FRAMEVdsDtctList1->ColumnSel->Index, FRAMEVdsDtctList1->Column02->Index);
  137. #endif
  138. try
  139. {
  140. Application->ProcessMessages();
  141. LockWindowUpdate(Handle);
  142. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  143. if (!pSheet) return;
  144. VDSH0701 = new TVDSH0701(this, Handle, FStDateTime, FEdDateTime, FIdList);
  145. VDSH0701->Parent = pSheet;
  146. VDSH0701->Show();
  147. PgTab->ActivePage = pSheet;
  148. pSheet = PgTab->ActivePage;
  149. m_pFormList->Add(VDSH0701);
  150. }
  151. __finally
  152. {
  153. LockWindowUpdate(0);
  154. }
  155. }
  156. //---------------------------------------------------------------------------
  157. void __fastcall TVDSH070M::BtnCloseClick(TObject *Sender)
  158. {
  159. Close();
  160. }
  161. //---------------------------------------------------------------------------
  162. void __fastcall TVDSH070M::OnSubFormClose(TMessage Msg)
  163. {
  164. int nActiveIdx = PgTab->ActivePageIndex;
  165. if (nActiveIdx <= 0) return;
  166. LockWindowUpdate(Handle);
  167. TcxTabSheet *pSheet = PgTab->ActivePage;
  168. if (pSheet)
  169. {
  170. delete pSheet;
  171. }
  172. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  173. m_pFormList->Delete(nActiveIdx);
  174. LockWindowUpdate(0);
  175. }
  176. //---------------------------------------------------------------------------
  177. void __fastcall TVDSH070M::PgTabDblClick(TObject *Sender)
  178. {
  179. TPoint APoint;
  180. APoint = PgTab->MouseDownPos;
  181. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  182. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  183. }
  184. //---------------------------------------------------------------------------
  185. void __fastcall TVDSH070M::FormClose(TObject *Sender, TCloseAction &Action)
  186. {
  187. CommClose();
  188. VDSH070M = NULL;
  189. Action = caFree;
  190. }
  191. //---------------------------------------------------------------------------
  192. void __fastcall TVDSH070M::FormCloseQuery(TObject *Sender, bool &CanClose)
  193. {
  194. FRAMEVdsDtctList1->OnCloseQuery(CanClose);
  195. }
  196. //---------------------------------------------------------------------------
  197. void __fastcall TVDSH070M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  198. {
  199. int nActiveIdx = ATabIndex;
  200. if (nActiveIdx <= 0) return;
  201. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  202. m_pFormList->Delete(nActiveIdx);
  203. }
  204. //---------------------------------------------------------------------------