IRP0010MF.cpp 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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. /*
  49. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  50. * Form과 DataModule class를 delete시킨다.
  51. * arguments
  52. *
  53. * return
  54. * void
  55. */
  56. void __fastcall TIRP0010M::CommClose()
  57. {
  58. try
  59. {
  60. for (int idx = m_pFormList->Count-1; idx >= 0; idx--)
  61. {
  62. m_pFormList->Delete(idx);
  63. }
  64. delete m_pFormList;
  65. CMM_SaveForm(g_sFormsDir, this);
  66. }
  67. catch(...)
  68. {
  69. }
  70. }
  71. //---------------------------------------------------------------------------
  72. /*
  73. * Form을 보여줄때 호출되는 event 메서드이다.
  74. * arguments
  75. * Sender : event handler 객체
  76. * return
  77. * void
  78. */
  79. void __fastcall TIRP0010M::FormShow(TObject *Sender)
  80. {
  81. Refresh();
  82. FormInit();
  83. TmrShow->Enabled = true;
  84. }
  85. //---------------------------------------------------------------------------
  86. /*
  87. * form 초기화
  88. *
  89. * arguments
  90. *
  91. * return
  92. * void
  93. */
  94. void __fastcall TIRP0010M::FormInit()
  95. {
  96. DtStDate->Date = Now() - 1;
  97. DtEdDate->Date = Now() - 1;
  98. #if 0
  99. DtStTime->EditValue = "00";//Now().FormatString("hh");
  100. DtEdTime->EditValue = "23";//Now().FormatString("hh");
  101. #else
  102. DtStTime->Time = StrToDateTime("00:00");
  103. DtEdTime->Time = StrToDateTime("23:59");
  104. #endif
  105. }
  106. //---------------------------------------------------------------------------
  107. /*
  108. * Form이 Show되고 난 후 최초 1회 수행되는 타이머 이벤트
  109. * arguments
  110. * Sender : event handler 객체
  111. * return
  112. * void
  113. */
  114. void __fastcall TIRP0010M::TmrShowTimer(TObject *Sender)
  115. {
  116. TmrShow->Enabled = false;
  117. }
  118. //---------------------------------------------------------------------------
  119. /*
  120. * Refresh Data Event Function
  121. * arguments
  122. *
  123. * return
  124. * void
  125. */
  126. void __fastcall TIRP0010M::RefreshData()
  127. {
  128. // 검색조건에 의한 링크 데이터 조회
  129. try
  130. {
  131. //SelListData();
  132. }
  133. __finally
  134. {
  135. }
  136. }
  137. //---------------------------------------------------------------------------
  138. /*
  139. * Search 버튼 클릭 이벤트 핸들러
  140. * arguments
  141. * Sender : event handler 객체
  142. * return
  143. * void
  144. */
  145. void __fastcall TIRP0010M::BtnSearchClick(TObject *Sender)
  146. {
  147. Application->ProcessMessages();
  148. TSqlCursor sqlCrs((TControl*)BtnSearch);
  149. #if 0
  150. String sStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh");
  151. String sEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh");
  152. #else
  153. String sStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn");
  154. String sEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn");
  155. #endif
  156. if (sStDateTime > sEdDateTime)
  157. {
  158. Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"검색 시작시각이 검색 종료시각 보다 큽니다.",
  159. FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL);
  160. ActiveControl = DtStDate;
  161. return;
  162. }
  163. #if 0
  164. FStDateTime = sStDateTime + "0000";
  165. FEdDateTime = sEdDateTime + "5959";
  166. #else
  167. FStDateTime = sStDateTime + "00";
  168. FEdDateTime = sEdDateTime + "59";
  169. #endif
  170. FIdList = "";
  171. int FRptType = CbType->ItemIndex;
  172. String sTitle;
  173. if (FRptType == 0)
  174. sTitle = lblType2->Caption + " [" + sStDateTime + "~" + sEdDateTime + "]";//"시설물보고서 [" + sStDateTime + "~" + sEdDateTime + "]";
  175. else
  176. sTitle = lblType1->Caption + " [" + sStDateTime + "~" + sEdDateTime + "]";//"교통보고서 [" + sStDateTime + "~" + sEdDateTime + "]";
  177. try
  178. {
  179. Application->ProcessMessages();
  180. LockWindowUpdate(Handle);
  181. TcxTabSheet *pSheet = CMM_AddTabSheet(PgTab, sTitle);
  182. if (!pSheet) return;
  183. IRP00101 = new TIRP00101(this, Handle, FRptType, FStDateTime, FEdDateTime, sTitle);
  184. IRP00101->Parent = pSheet;
  185. IRP00101->Show();
  186. PgTab->ActivePage = pSheet;
  187. pSheet = PgTab->ActivePage;
  188. m_pFormList->Add(IRP00101);
  189. }
  190. __finally
  191. {
  192. LockWindowUpdate(0);
  193. }
  194. }
  195. //---------------------------------------------------------------------------
  196. /*
  197. * Close 버튼 클릭 이벤트 핸들러
  198. * arguments
  199. * Sender : event handler 객체
  200. * return
  201. * void
  202. */
  203. void __fastcall TIRP0010M::BtnCloseClick(TObject *Sender)
  204. {
  205. Close();
  206. }
  207. //---------------------------------------------------------------------------
  208. /*
  209. * 조회결과 폼이 닫힐때 메시지를 받아 처리한다.
  210. * arguments
  211. * Sender : event handler 객체
  212. * return
  213. * void
  214. */
  215. void __fastcall TIRP0010M::OnSubFormClose(TMessage Msg)
  216. {
  217. int nActiveIdx = PgTab->ActivePageIndex;
  218. if (nActiveIdx <= 0) return;
  219. LockWindowUpdate(Handle);
  220. TcxTabSheet *pSheet = PgTab->ActivePage;
  221. if (pSheet)
  222. {
  223. delete pSheet;
  224. }
  225. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  226. m_pFormList->Delete(nActiveIdx);
  227. LockWindowUpdate(0);
  228. }
  229. //---------------------------------------------------------------------------
  230. /*
  231. * Tab Control의 Tab을 더블클릭하여 닫는다.
  232. * arguments
  233. * Sender : event handler 객체
  234. * return
  235. * void
  236. */
  237. void __fastcall TIRP0010M::PgTabDblClick(TObject *Sender)
  238. {
  239. TPoint APoint;
  240. APoint = PgTab->MouseDownPos;
  241. if (PgTab->IndexOfTabAt(APoint.x, APoint.y) != -1)
  242. POST_MSG(Handle, WM_SUBFORM_CLOSE, 0, 0);
  243. }
  244. //---------------------------------------------------------------------------
  245. void __fastcall TIRP0010M::FormClose(TObject *Sender, TCloseAction &Action)
  246. {
  247. CommClose();
  248. IRP0010M = NULL;
  249. Action = caFree;
  250. }
  251. //---------------------------------------------------------------------------
  252. void __fastcall TIRP0010M::PgTabCanCloseEx(TObject *Sender, int ATabIndex, bool &ACanClose)
  253. {
  254. int nActiveIdx = ATabIndex;
  255. if (nActiveIdx <= 0) return;
  256. nActiveIdx--; // 첫번째 탭은 화면에 숨겨져 있다.
  257. m_pFormList->Delete(nActiveIdx);
  258. }
  259. //---------------------------------------------------------------------------