VMSM520MF.cpp 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "AppGlobalF.h"
  6. #pragma hdrstop
  7. #include "VMSM520MF.h"
  8. //---------------------------------------------------------------------------
  9. #pragma package(smart_init)
  10. #pragma link "cxButtons"
  11. #pragma link "cxCalendar"
  12. #pragma link "cxContainer"
  13. #pragma link "cxControls"
  14. #pragma link "cxDropDownEdit"
  15. #pragma link "cxEdit"
  16. #pragma link "cxGraphics"
  17. #pragma link "cxGroupBox"
  18. #pragma link "cxLabel"
  19. #pragma link "cxLookAndFeelPainters"
  20. #pragma link "cxLookAndFeels"
  21. #pragma link "cxMaskEdit"
  22. #pragma link "cxPC"
  23. #pragma link "cxPCdxBarPopupMenu"
  24. #pragma link "cxSpinEdit"
  25. #pragma link "cxSplitter"
  26. #pragma link "cxTextEdit"
  27. #pragma link "cxTimeEdit"
  28. #pragma link "dxSkinBlack"
  29. #pragma link "dxSkinBlue"
  30. #pragma link "dxSkinCaramel"
  31. #pragma link "dxSkinCoffee"
  32. #pragma link "dxSkinDarkRoom"
  33. #pragma link "dxSkinDarkSide"
  34. #pragma link "dxSkinFoggy"
  35. #pragma link "dxSkinGlassOceans"
  36. #pragma link "dxSkiniMaginary"
  37. #pragma link "dxSkinLilian"
  38. #pragma link "dxSkinLiquidSky"
  39. #pragma link "dxSkinLondonLiquidSky"
  40. #pragma link "dxSkinMcSkin"
  41. #pragma link "dxSkinMoneyTwins"
  42. #pragma link "dxSkinOffice2007Black"
  43. #pragma link "dxSkinOffice2007Blue"
  44. #pragma link "dxSkinOffice2007Green"
  45. #pragma link "dxSkinOffice2007Pink"
  46. #pragma link "dxSkinOffice2007Silver"
  47. #pragma link "dxSkinOffice2010Black"
  48. #pragma link "dxSkinOffice2010Blue"
  49. #pragma link "dxSkinOffice2010Silver"
  50. #pragma link "dxSkinsCore"
  51. #pragma link "dxSkinscxPCPainter"
  52. #pragma link "dxSkinSeven"
  53. #pragma link "dxSkinSharp"
  54. #pragma link "dxSkinSilver"
  55. #pragma link "dxSkinStardust"
  56. #pragma link "cxRadioGroup"
  57. #pragma link "cxClasses"
  58. #pragma link "cxCustomData"
  59. #pragma link "cxData"
  60. #pragma link "cxDataStorage"
  61. #pragma link "cxDBData"
  62. #pragma link "cxFilter"
  63. #pragma link "cxGrid"
  64. #pragma link "cxGridCustomTableView"
  65. #pragma link "cxGridCustomView"
  66. #pragma link "cxGridDBTableView"
  67. #pragma link "cxGridLevel"
  68. #pragma link "cxGridTableView"
  69. #pragma link "cxStyles"
  70. #pragma link "cxCheckBox"
  71. #pragma link "cxImage"
  72. #pragma link "cxButtonEdit"
  73. #pragma link "cxBlobEdit"
  74. #pragma resource "*.dfm"
  75. TVMSM520M *VMSM520M = NULL;
  76. //---------------------------------------------------------------------------
  77. __fastcall TVMSM520M::TVMSM520M(TComponent* Owner)
  78. : TForm(Owner)
  79. {
  80. ITSSkin_Load(this);
  81. ////CMM_LoadForm(g_sFormsDir, this);
  82. FUpdate= false;
  83. FTitle = Caption;//"VMS 폼 유형 선택";
  84. EdNmbr->Text = "";
  85. EditMode = false;
  86. m_bSelected = false;
  87. TvList->OptionsView->DataRowHeight = 0;
  88. TvList->OptionsView->CellAutoHeight = true;
  89. TvList->OptionsView->Indicator = true;
  90. TvList->OptionsCustomize->ColumnMoving = false;
  91. TvList->OptionsCustomize->ColumnSorting = false;
  92. TvList->Columns[0]->Width = 60;
  93. TvList->Columns[0]->Options->HorzSizing = false;
  94. }
  95. //---------------------------------------------------------------------------
  96. void __fastcall TVMSM520M::CommClose()
  97. {
  98. try
  99. {
  100. ////CMM_SaveForm(g_sFormsDir, this);
  101. }
  102. catch(...)
  103. {
  104. }
  105. }
  106. //---------------------------------------------------------------------------
  107. void __fastcall TVMSM520M::FormShow(TObject *Sender)
  108. {
  109. Refresh();
  110. FormInit();
  111. TmrShow->Enabled = true;
  112. }
  113. //---------------------------------------------------------------------------
  114. void __fastcall TVMSM520M::FormInit()
  115. {
  116. EdNmbr->Text = "";
  117. FillVmsFormType();
  118. FNewDb = false;
  119. }
  120. //---------------------------------------------------------------------------
  121. void __fastcall TVMSM520M::FillVmsFormType()
  122. {
  123. String sQry;
  124. TADOQuery *pADO = NULL;
  125. CMM_ClearGridTableView(TvList);
  126. sQry = "SELECT T.CODE_NO AS CODE_NO, \r\n"
  127. " T.CD_NM AS CD_NM, \r\n"
  128. " T.USE_YN AS USE_YN \r\n"
  129. " FROM TB_SYS_CD T \r\n"
  130. " WHERE 1=1 \r\n"
  131. " AND T.USE_YN = 'Y' \r\n"
  132. " AND T.CLSS_CD = 'VMS_FORM_TYPE_CD' \r\n"
  133. " ORDER BY T.CODE_NO \r\n";
  134. try
  135. {
  136. int nRow;
  137. TcxDataController *pGDC = TvList->DataController;
  138. TvList->BeginUpdate();
  139. try
  140. {
  141. pADO = new TADOQuery(NULL);
  142. pADO->Close();
  143. pADO->Connection = ITSDb_GetConnection();
  144. ITSDb_SQLText(pADO, sQry);
  145. ITSDb_SQLOpen(pADO);
  146. for( ; !pADO->Eof; pADO->Next())
  147. {
  148. String sUse = pADO->FieldByName("USE_YN")->AsString;
  149. if (sUse != "Y") continue;
  150. String sCd = pADO->FieldByName("CODE_NO")->AsString;
  151. String sNm = pADO->FieldByName("CD_NM")->AsString;
  152. nRow = pGDC->AppendRecord();
  153. pGDC->Values[nRow][ColLink1->Index] = sCd;
  154. pGDC->Values[nRow][ColLink3->Index] = sNm;
  155. }
  156. }
  157. catch(EDatabaseError &E)
  158. {
  159. DBERRORMSG("TVMSM520M::FillVmsFormType", String(E.ClassName()), E.Message, sQry);
  160. throw Exception(String(E.ClassName()) + E.Message);
  161. }
  162. catch(Exception &exception)
  163. {
  164. DBERRORMSG("TVMSM520M::FillVmsFormType", String(exception.ClassName()), exception.Message, sQry);
  165. throw Exception(String(exception.ClassName()) + exception.Message);
  166. }
  167. }
  168. __finally
  169. {
  170. if (pADO)
  171. {
  172. pADO->Close();
  173. delete pADO;
  174. }
  175. TvList->EndUpdate();
  176. }
  177. }
  178. //---------------------------------------------------------------------------
  179. void __fastcall TVMSM520M::TmrShowTimer(TObject *Sender)
  180. {
  181. TmrShow->Enabled = false;
  182. }
  183. //---------------------------------------------------------------------------
  184. void __fastcall TVMSM520M::BtnCloseClick(TObject *Sender)
  185. {
  186. Close();
  187. }
  188. //---------------------------------------------------------------------------
  189. void __fastcall TVMSM520M::FormClose(TObject *Sender, TCloseAction &Action)
  190. {
  191. CommClose();
  192. VMSM520M = NULL;
  193. Action = caFree;
  194. }
  195. //---------------------------------------------------------------------------
  196. void __fastcall TVMSM520M::FormCloseQuery(TObject *Sender, bool &CanClose)
  197. {
  198. //
  199. }
  200. //---------------------------------------------------------------------------
  201. void __fastcall TVMSM520M::DisplayInfo()
  202. {
  203. //FormInit();
  204. int nRow = TvList->DataController->FocusedRecordIndex;
  205. if( nRow <= -1 )
  206. return;
  207. TcxGridDataController *pDc = TvList->DataController;
  208. nRow = pDc->FocusedRecordIndex;
  209. EdNmbr->Text = VarToStr(pDc->Values[nRow][ColLink1->Index]);
  210. }
  211. //---------------------------------------------------------------------------
  212. void __fastcall TVMSM520M::TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
  213. TMouseButton AButton, TShiftState AShift,
  214. bool &AHandled)
  215. {
  216. if (!ACellViewInfo) return;
  217. DisplayInfo();
  218. Sleep(200);
  219. BtnSelImageClick((TObject*)BtnSelImage);
  220. }
  221. //---------------------------------------------------------------------------
  222. void __fastcall TVMSM520M::TvListFocusedRecordChanged(TcxCustomGridTableView *Sender,
  223. TcxCustomGridRecord *APrevFocusedRecord, TcxCustomGridRecord *AFocusedRecord,
  224. bool ANewItemRecordFocusingChanged)
  225. {
  226. if (!AFocusedRecord) return;
  227. DisplayInfo();
  228. }
  229. //---------------------------------------------------------------------------
  230. void __fastcall TVMSM520M::BtnSelImageClick(TObject *Sender)
  231. {
  232. if (EdNmbr->Text == "")
  233. {
  234. Application->MessageBox(lblText1->Caption.c_str(),//L"VMS 폼 유형 선택\r\nVMS 폼 유형 목록에서 선택하세요.",
  235. FTitle.c_str(),
  236. MB_OK|MB_ICONERROR|MB_APPLMODAL);
  237. return;
  238. }
  239. m_bSelected = true;
  240. Close();
  241. }
  242. //---------------------------------------------------------------------------