IRP0010MF.cpp 6.2 KB

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