IRP0010MF.cpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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 "IRP0010MF.h"
  9. #include "IRP00101F.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. TIRP0010M *IRP0010M = NULL;
  36. //---------------------------------------------------------------------------
  37. __fastcall TIRP0010M::TIRP0010M(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 TIRP0010M::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 TIRP0010M::FormShow(TObject *Sender)
  65. {
  66. Refresh();
  67. FormInit();
  68. TmrShow->Enabled = true;
  69. }
  70. //---------------------------------------------------------------------------
  71. void __fastcall TIRP0010M::FormInit()
  72. {
  73. DtStDate->Date = Now() - 1;
  74. DtEdDate->Date = Now() - 1;
  75. #if 0
  76. DtStTime->EditValue = "00";//Now().FormatString("hh");
  77. DtEdTime->EditValue = "23";//Now().FormatString("hh");
  78. #else
  79. DtStTime->Time = StrToDateTime("00:00");
  80. DtEdTime->Time = StrToDateTime("23:59");
  81. #endif
  82. }
  83. //---------------------------------------------------------------------------
  84. void __fastcall TIRP0010M::TmrShowTimer(TObject *Sender)
  85. {
  86. TmrShow->Enabled = false;
  87. }
  88. //---------------------------------------------------------------------------
  89. void __fastcall TIRP0010M::RefreshData()
  90. {
  91. // 검색조건에 의한 링크 데이터 조회
  92. try
  93. {
  94. //SelListData();
  95. }
  96. __finally
  97. {
  98. }
  99. }
  100. //---------------------------------------------------------------------------
  101. void __fastcall TIRP0010M::BtnSearchClick(TObject *Sender)
  102. {
  103. Application->ProcessMessages();
  104. TSqlCursor sqlCrs((TControl*)BtnSearch);
  105. #if 0
  106. String sStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  107. String sEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  108. #else
  109. String sStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  110. String sEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  111. #endif
  112. if (sStDateTime > sEdDateTime)
  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 = sStDateTime + "0000";
  121. FEdDateTime = sEdDateTime + "5959";
  122. #else
  123. FStDateTime = sStDateTime + "00";
  124. FEdDateTime = sEdDateTime + "59";
  125. #endif
  126. FIdList = "";
  127. int FRptType = CbType->ItemIndex;
  128. String sTitle;
  129. if (FRptType == 0)
  130. sTitle = lblType2->Caption + " [" + sStDateTime + "~" + sEdDateTime + "]";//"시설물보고서 [" + sStDateTime + "~" + sEdDateTime + "]";
  131. else
  132. sTitle = lblType1->Caption + " [" + sStDateTime + "~" + sEdDateTime + "]";//"교통보고서 [" + sStDateTime + "~" + sEdDateTime + "]";
  133. try
  134. {
  135. Application->ProcessMessages();
  136. LockWindowUpdate(Handle);
  137. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  138. if (!pSheet) return;
  139. IRP00101 = new TIRP00101(this, Handle, FRptType, FStDateTime, FEdDateTime, sTitle);
  140. IRP00101->Parent = pSheet;
  141. IRP00101->Show();
  142. PgTab->ActivePage = pSheet;
  143. pSheet = PgTab->ActivePage;
  144. m_pFormList->Add(IRP00101);
  145. }
  146. __finally
  147. {
  148. LockWindowUpdate(0);
  149. }
  150. }
  151. //---------------------------------------------------------------------------
  152. void __fastcall TIRP0010M::BtnCloseClick(TObject *Sender)
  153. {
  154. Close();
  155. }
  156. //---------------------------------------------------------------------------
  157. void __fastcall TIRP0010M::OnSubFormClose(TMessage Msg)
  158. {
  159. int nActiveIdx = PgTab->ActivePageIndex;
  160. if (nActiveIdx <= 0) return;
  161. LockWindowUpdate(Handle);
  162. TcxTabSheet *pSheet = PgTab->ActivePage;
  163. if (pSheet)
  164. {
  165. delete pSheet;
  166. }
  167. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  168. m_pFormList->Delete(nActiveIdx);
  169. LockWindowUpdate(0);
  170. }
  171. //---------------------------------------------------------------------------
  172. void __fastcall TIRP0010M::PgTabDblClick(TObject *Sender)
  173. {
  174. TPoint APoint;
  175. APoint = PgTab->MouseDownPos;
  176. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  177. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  178. }
  179. //---------------------------------------------------------------------------
  180. void __fastcall TIRP0010M::FormClose(TObject *Sender, TCloseAction &Action)
  181. {
  182. CommClose();
  183. IRP0010M = NULL;
  184. Action = caFree;
  185. }
  186. //---------------------------------------------------------------------------
  187. void __fastcall TIRP0010M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  188. {
  189. int nActiveIdx = ATabIndex;
  190. if (nActiveIdx <= 0) return;
  191. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  192. m_pFormList->Delete(nActiveIdx);
  193. }
  194. //---------------------------------------------------------------------------