VMSM520MF.cpp 8.3 KB

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