IST00401F.cpp 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITSSkinF.h"
  4. #include "ITSUtilF.h"
  5. #include "ITSDbF.h"
  6. #include "AppGlobalF.h"
  7. #include "WindowMsgF.h"
  8. #include "CDSNodeF.h"
  9. #include "CDSLinkF.h"
  10. #include "ITSLangTransF.h"
  11. #pragma hdrstop
  12. #include "IST00401F.h"
  13. //---------------------------------------------------------------------------
  14. #pragma package(smart_init)
  15. #pragma link "cxButtons"
  16. #pragma link "cxCalc"
  17. #pragma link "cxCheckBox"
  18. #pragma link "cxClasses"
  19. #pragma link "cxContainer"
  20. #pragma link "cxControls"
  21. #pragma link "cxCustomData"
  22. #pragma link "cxData"
  23. #pragma link "cxDataStorage"
  24. #pragma link "cxEdit"
  25. #pragma link "cxFilter"
  26. #pragma link "cxGraphics"
  27. #pragma link "cxGrid"
  28. #pragma link "cxGridChartView"
  29. #pragma link "cxGridCustomTableView"
  30. #pragma link "cxGridCustomView"
  31. #pragma link "cxGridLevel"
  32. #pragma link "cxGridTableView"
  33. #pragma link "cxLabel"
  34. #pragma link "cxLookAndFeelPainters"
  35. #pragma link "cxLookAndFeels"
  36. #pragma link "cxPC"
  37. #pragma link "cxPCdxBarPopupMenu"
  38. #pragma link "cxSplitter"
  39. #pragma link "cxStyles"
  40. #pragma link "cxTextEdit"
  41. #pragma link "cxTrackBar"
  42. #pragma link "dxSkinBlack"
  43. #pragma link "dxSkinBlue"
  44. #pragma link "dxSkinsCore"
  45. #pragma link "dxSkinscxPCPainter"
  46. #pragma resource "*.dfm"
  47. TIST00401 *IST00401 = NULL;
  48. //---------------------------------------------------------------------------
  49. __fastcall TIST00401::TIST00401(TComponent* Owner, HWND hHandle,
  50. int AStatType, int ATermType, String AStTime, String AEdTime, bool AChkInciType, String AIncidentType, String ATitle)
  51. : TForm(Owner)
  52. {
  53. LangTrans->Translate(this, ITSDb_GetConnection());
  54. ITSSkin_Load(this);
  55. CMM_LoadForm(g_sFormsDir, this);
  56. FParent = hHandle;
  57. FStatType = AStatType;
  58. FTermType = ATermType;
  59. FStTime = AStTime;
  60. FEdTime = AEdTime;
  61. FChkInciType = AChkInciType;
  62. FIncidentType = AIncidentType;
  63. FTitle = ATitle;
  64. FCodeIDTU = ItsCodeManager->FLists.Find("IDTU");
  65. pMngrInci = new TItsStaIncidentManager();
  66. }
  67. //---------------------------------------------------------------------------
  68. __fastcall TIST00401::~TIST00401(void)
  69. {
  70. }
  71. //--------------------------------------------------------------------------
  72. /*
  73. * form 초기화
  74. *
  75. * arguments
  76. *
  77. * return
  78. * void
  79. */
  80. void __fastcall TIST00401::FormInit()
  81. {
  82. ADOQry->Connection = ITSDb_GetConnection();
  83. m_pGDC = TvList->DataController;
  84. TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<돌발 통계 정보>";
  85. LblSearch->Caption = FTitle;
  86. if (FStatType == 0)
  87. {
  88. //유형별
  89. cxTabSheet1->Caption = lblDesc1->Caption;//"기간별 돌발발생 건수별 ";
  90. cxTabSheet2->Caption = lblDesc2->Caption;//"기간별 돌발발생 유형별 ";
  91. Column02->Visible = false;
  92. Column03->Visible = false;
  93. Column11->Visible = false;
  94. //Column04->Visible = true;
  95. Column05->Visible = false;
  96. SetChartLegend(TvChart1, FrmLang->lblStatTm->Caption, lblCnt->Caption);//"통계시각", "발생건수(량)");
  97. SetChartLegend(TvChart2, FrmLang->lblStatTm->Caption, lblCnt->Caption);//"통계시각", "발생건수(량)");
  98. ChartValueDisplay(TvChart1, ChkDisplayVal1->Checked);
  99. ChartValueDisplay(TvChart2, ChkDisplayVal2->Checked);
  100. TvChart1->ToolBox->CustomizeButton = true;
  101. TvChart2->ToolBox->CustomizeButton = true;
  102. TvChart1->Legend->Position = cppDefault;
  103. TvChart2->Legend->Position = cppDefault;
  104. }
  105. else
  106. {
  107. //구간별
  108. cxTabSheet2->TabVisible = false;
  109. cxTabSheet1->Caption = lblDesc1->Caption;//"구간별 돌발발생 건수별 ";
  110. cxTabSheet2->Caption = lblDesc2->Caption;//"구간별 돌발발생 유형별 ";
  111. //Column02->Visible = true;
  112. //Column03->Visible = true;
  113. Column04->Visible = false;
  114. Column05->Visible = false;
  115. SetChartLegend(TvChart1, lblSect->Caption, lblCnt->Caption);//"구간", "발생건수(량)");
  116. SetChartLegend(TvChart2, lblSect->Caption, lblCnt->Caption);//"구간", "발생건수(량)");
  117. ChartValueDisplay(TvChart1, ChkDisplayVal1->Checked);
  118. ChartValueDisplay(TvChart2, ChkDisplayVal2->Checked);
  119. TvChart1->ToolBox->CustomizeButton = true;
  120. TvChart2->ToolBox->CustomizeButton = true;
  121. TvChart1->Legend->Position = cppDefault;
  122. TvChart2->Legend->Position = cppDefault;
  123. }
  124. }
  125. //---------------------------------------------------------------------------
  126. void __fastcall TIST00401::SetChartLegend(TcxGridChartView *ATvChart, String ACategory, String AValue)
  127. {
  128. try {
  129. ATvChart->DiagramArea->AxisCategory->Title->Text = ACategory;
  130. ATvChart->DiagramArea->AxisValue->Title->Text = AValue;
  131. ATvChart->DiagramBar->AxisCategory->Title->Text = ACategory;
  132. ATvChart->DiagramBar->AxisValue->Title->Text = AValue;
  133. ATvChart->DiagramColumn->AxisCategory->Title->Text = ACategory;
  134. ATvChart->DiagramColumn->AxisValue->Title->Text = AValue;
  135. ATvChart->DiagramLine->AxisCategory->Title->Text = ACategory;
  136. ATvChart->DiagramLine->AxisValue->Title->Text = AValue;
  137. ATvChart->DiagramStackedArea->AxisCategory->Title->Text = ACategory;
  138. ATvChart->DiagramStackedArea->AxisValue->Title->Text = AValue;
  139. ATvChart->DiagramStackedBar->AxisCategory->Title->Text = ACategory;
  140. ATvChart->DiagramStackedBar->AxisValue->Title->Text = AValue;
  141. ATvChart->DiagramStackedColumn->AxisCategory->Title->Text = ACategory;
  142. ATvChart->DiagramStackedColumn->AxisValue->Title->Text = AValue;
  143. } catch(...) {}
  144. }
  145. //---------------------------------------------------------------------------
  146. void __fastcall TIST00401::ChartValueDisplay(TcxGridChartView *ATvChart, bool FDisplayValue)
  147. {
  148. try {
  149. ATvChart->DiagramArea->Values->CaptionPosition = FDisplayValue ? ldvcpAbove : ldvcpNone;
  150. ATvChart->DiagramBar->Values->CaptionPosition = FDisplayValue ? cdvcpOutsideEnd : cdvcpNone;
  151. ATvChart->DiagramColumn->Values->CaptionPosition = FDisplayValue ? cdvcpOutsideEnd : cdvcpNone;
  152. ATvChart->DiagramLine->Values->CaptionPosition = FDisplayValue ? ldvcpAbove : ldvcpNone;
  153. ATvChart->DiagramPie->Values->CaptionPosition = FDisplayValue ? pdvcpOutsideEndWithLeaderLines : pdvcpNone;
  154. ATvChart->DiagramStackedArea->Values->CaptionPosition = FDisplayValue ? ldvcpRight : ldvcpNone;
  155. ATvChart->DiagramStackedBar->Values->CaptionPosition = FDisplayValue ? cdvcpCenter : cdvcpNone;
  156. ATvChart->DiagramStackedColumn->Values->CaptionPosition = FDisplayValue ? cdvcpCenter : cdvcpNone;
  157. } catch(...) {}
  158. }
  159. //---------------------------------------------------------------------------
  160. /*
  161. * form을 보여줄때 호출되는 event 메서드이다.
  162. * arguments
  163. * Sender : event handler 객체
  164. * return
  165. * void
  166. */
  167. void __fastcall TIST00401::FormShow(TObject *Sender)
  168. {
  169. FormInit();
  170. Refresh();
  171. TmrShow->Enabled = true;
  172. }
  173. //---------------------------------------------------------------------------
  174. /*
  175. * 최초 1회 수행되는 타이머 이벤트
  176. * arguments
  177. * Sender : event handler 객체
  178. * return
  179. * void
  180. */
  181. void __fastcall TIST00401::TmrShowTimer(TObject *Sender)
  182. {
  183. TmrShow->Enabled = false;
  184. TvChart1->ClearSeries();
  185. TvChart2->ClearSeries();
  186. pMngrInci->FLists.RemoveAll();
  187. Application->ProcessMessages();
  188. if (FStatType == 0)
  189. {
  190. SelIncidentType();
  191. }
  192. else
  193. {
  194. SelIncidentSect();
  195. }
  196. }
  197. //---------------------------------------------------------------------------
  198. void __fastcall TIST00401::ChkExpandClick(TObject *Sender)
  199. {
  200. CMM_ExpandCollapseChk(TvList, ChkExpand->Checked);
  201. }
  202. //---------------------------------------------------------------------------
  203. /*
  204. * Refresh Data Event Function
  205. * arguments
  206. *
  207. * return
  208. * void
  209. */
  210. void __fastcall TIST00401::SelIncidentType()
  211. {
  212. TSqlCursor sqlCrs;
  213. String sQry;
  214. TADOQuery *pADO = ADOQry;
  215. switch(FTermType)
  216. {
  217. case 0:
  218. sQry = "SELECT SUBSTR(STAT_DT, 1, 8) AS STAT_DT, COUNT(1) DATA_CNT, \r\n"
  219. " TO_CHAR(TO_DATE(SUBSTR(STAT_DT, 1, 8), 'YYYYMMDD'), 'YYYY-MM-DD') AS STAT_DTNM, \r\n"
  220. " INCD_TYPE_CD AS INCD_TYPE_CD, \r\n"
  221. " SUM(INCD_OCRR_NUM) INCD_OCRR_NUM, \r\n"
  222. " SUM(FTLT_PNUM) FTLT_PNUM, \r\n"
  223. " SUM(INJR_PNUM) INJR_PNUM, \r\n"
  224. " SUM(PRPR_DMGE_AMT) PRPR_DMGE_AMT \r\n"
  225. " FROM TB_INCD_TYPE_DD_STAT \r\n"
  226. " WHERE STAT_DT BETWEEN :p01 AND :p02 \r\n"
  227. // " AND INCD_TYPE_CD IN (SELECT CMMN_CD \r\n"
  228. // " FROM TB_CMMN_CD a \r\n"
  229. // " WHERE CMMN_CLSF_CD = 'IDTU') \r\n"
  230. " GROUP BY ROLLUP(SUBSTR(STAT_DT, 1, 8), INCD_TYPE_CD) \r\n"
  231. " ORDER BY STAT_DT \r\n";
  232. break;
  233. case 1:
  234. sQry = "SELECT SUBSTR(STAT_DT, 1, 6) AS STAT_DT, COUNT(1) DATA_CNT, \r\n"
  235. " TO_CHAR(TO_DATE(SUBSTR(STAT_DT, 1, 6), 'YYYYMM'), 'YYYY-MM') AS STAT_DTNM, \r\n"
  236. " INCD_TYPE_CD AS INCD_TYPE_CD, \r\n"
  237. " SUM(INCD_OCRR_NUM) INCD_OCRR_NUM, \r\n"
  238. " SUM(FTLT_PNUM) FTLT_PNUM, \r\n"
  239. " SUM(INJR_PNUM) INJR_PNUM, \r\n"
  240. " SUM(PRPR_DMGE_AMT) PRPR_DMGE_AMT \r\n"
  241. " FROM TB_INCD_TYPE_MN_STAT \r\n"
  242. " WHERE STAT_DT BETWEEN :p01 AND :p02 \r\n"
  243. // " AND INCD_TYPE_CD IN (SELECT CMMN_CD \r\n"
  244. // " FROM TB_CMMN_CD a \r\n"
  245. // " WHERE CMMN_CLSF_CD = 'IDTU') \r\n"
  246. " GROUP BY ROLLUP(SUBSTR(STAT_DT, 1, 6), INCD_TYPE_CD) \r\n"
  247. " ORDER BY STAT_DT \r\n";
  248. break;
  249. case 2:
  250. sQry = "SELECT SUBSTR(STAT_DT, 1, 4) AS STAT_DT, COUNT(1) DATA_CNT, \r\n"
  251. " SUBSTR(STAT_DT, 1, 4) AS STAT_DTNM, \r\n"
  252. " INCD_TYPE_CD AS INCD_TYPE_CD, \r\n"
  253. " SUM(INCD_OCRR_NUM) INCD_OCRR_NUM, \r\n"
  254. " SUM(FTLT_PNUM) FTLT_PNUM, \r\n"
  255. " SUM(INJR_PNUM) INJR_PNUM, \r\n"
  256. " SUM(PRPR_DMGE_AMT) PRPR_DMGE_AMT \r\n"
  257. " FROM TB_INCD_TYPE_MN_STAT \r\n"
  258. " WHERE STAT_DT BETWEEN :p01 AND :p02 \r\n"
  259. // " AND INCD_TYPE_CD IN (SELECT CMMN_CD \r\n"
  260. // " FROM TB_CMMN_CD a \r\n"
  261. // " WHERE CMMN_CLSF_CD = 'IDTU') \r\n"
  262. " GROUP BY ROLLUP(SUBSTR(STAT_DT, 1, 4), INCD_TYPE_CD) \r\n"
  263. " ORDER BY STAT_DT \r\n";
  264. break;
  265. default: return;
  266. }
  267. sQry = "SELECT NVL(STAT_DT, 'X') AS STAT_DT, \r\n"
  268. " NVL(DATA_CNT, 0) AS DATA_CNT, \r\n"
  269. " NVL(STAT_DTNM, 'X') AS STAT_DTNM, \r\n"
  270. " NVL(INCD_TYPE_CD, '-') AS INCD_TYPE_CD, \r\n"
  271. " NVL(INCD_OCRR_NUM, 0) AS INCD_OCRR_NUM, \r\n"
  272. " NVL(FTLT_PNUM, 0) AS FTLT_PNUM, \r\n"
  273. " NVL(INJR_PNUM, 0) AS INJR_PNUM, \r\n"
  274. " NVL(PRPR_DMGE_AMT, 0) AS PRPR_DMGE_AMT \r\n"
  275. " FROM (" + sQry + ")";
  276. try
  277. {
  278. ITSDb_SQLClose(pADO);
  279. ITSDb_SQLText(pADO, sQry);
  280. ITSDb_SQLBind(pADO, "p01", FStTime);
  281. ITSDb_SQLBind(pADO, "p02", FEdTime);
  282. ITSDb_SQLOpen(pADO);
  283. DspIncidentTypeList();
  284. }
  285. catch(EDatabaseError &E)
  286. {
  287. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  288. DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry);
  289. throw Exception(String(E.ClassName()) + E.Message);
  290. }
  291. catch(Exception &exception)
  292. {
  293. ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2);
  294. DBERRORMSG(Caption, String(exception.ClassName()), exception.Message, sQry);
  295. throw Exception(String(exception.ClassName()) + exception.Message);
  296. }
  297. }
  298. //---------------------------------------------------------------------------
  299. void __fastcall TIST00401::DspIncidentTypeList()
  300. {
  301. TADOQuery *pADO = ADOQry;
  302. try
  303. {
  304. CMM_ClearGridTableView(TvList);
  305. int nRow = 0;
  306. int nDataCnt = 0;
  307. try
  308. {
  309. TvList->BeginUpdate();
  310. nDataCnt = pADO->RecordCount;
  311. m_pGDC->RecordCount = nDataCnt;
  312. String sRowType = "";
  313. String sTypeNm = "";
  314. int nIncd, nFtlt, nInjr, nPrpr;
  315. for( ; !pADO->Eof; pADO->Next(), nRow++)
  316. {
  317. String sDate = pADO->FieldByName("STAT_DTNM")->AsString;
  318. String sType = pADO->FieldByName("INCD_TYPE_CD")->AsString;
  319. nIncd = pADO->FieldByName("INCD_OCRR_NUM")->AsInteger; //발생건수
  320. nFtlt = pADO->FieldByName("FTLT_PNUM")->AsInteger; //사망자수
  321. nInjr = pADO->FieldByName("INJR_PNUM")->AsInteger; //부상자수
  322. nPrpr = pADO->FieldByName("PRPR_DMGE_AMT")->AsInteger; //피해금액
  323. sRowType = "0";
  324. if (sDate == "X")
  325. {
  326. sRowType = "2";
  327. sDate = FrmLang->lblChartTotal->Caption;//"전체";
  328. sType = "-";
  329. sTypeNm = "-";
  330. }
  331. else
  332. {
  333. TItsStaIncident *pInci = pMngrInci->FLists.Find(sDate);
  334. if (!pInci)
  335. {
  336. pInci = new TItsStaIncident();
  337. pMngrInci->FLists.Push(sDate, pInci);
  338. pInci->FDate = sDate;
  339. }
  340. if (sType == "-")
  341. {
  342. sRowType = "1";
  343. sType = "+";
  344. sTypeNm = FrmLang->lblChartSoge->Caption;//"소계";
  345. pInci->FIncid[0][0] = nIncd;
  346. pInci->FIncid[0][1] = nFtlt;
  347. pInci->FIncid[0][2] = nInjr;
  348. pInci->FIncid[0][3] = nPrpr;
  349. }
  350. else
  351. {
  352. if (sType == "1")
  353. {
  354. sTypeNm = FrmLang->lblInc1->Caption;//"사고";
  355. pInci->FIncid[1][0] += nIncd;
  356. pInci->FIncid[1][1] += nFtlt;
  357. pInci->FIncid[1][2] += nInjr;
  358. pInci->FIncid[1][3] += nPrpr;
  359. }
  360. else if (sType == "2")
  361. {
  362. sTypeNm = FrmLang->lblInc2->Caption;//"공사";
  363. pInci->FIncid[2][0] += nIncd;
  364. pInci->FIncid[2][1] += nFtlt;
  365. pInci->FIncid[2][2] += nInjr;
  366. pInci->FIncid[2][3] += nPrpr;
  367. }
  368. else if (sType == "3")
  369. {
  370. sTypeNm = FrmLang->lblInc3->Caption;//"행사";
  371. pInci->FIncid[3][0] += nIncd;
  372. pInci->FIncid[3][1] += nFtlt;
  373. pInci->FIncid[3][2] += nInjr;
  374. pInci->FIncid[3][3] += nPrpr;
  375. }
  376. else if (sType == "4")
  377. {
  378. sTypeNm = FrmLang->lblInc4->Caption;//"기상";
  379. pInci->FIncid[4][0] += nIncd;
  380. pInci->FIncid[4][1] += nFtlt;
  381. pInci->FIncid[4][2] += nInjr;
  382. pInci->FIncid[4][3] += nPrpr;
  383. }
  384. else
  385. {
  386. sTypeNm = FrmLang->lblInc0->Caption;//"기타";
  387. pInci->FIncid[5][0] += nIncd;
  388. pInci->FIncid[5][1] += nFtlt;
  389. pInci->FIncid[5][2] += nInjr;
  390. pInci->FIncid[5][3] += nPrpr;
  391. }
  392. sTypeNm = "[" + sType + "] " + sTypeNm;
  393. }
  394. }
  395. m_pGDC->Values[nRow][Column01->Index] = sDate;
  396. m_pGDC->Values[nRow][Column02->Index] = "";
  397. m_pGDC->Values[nRow][Column03->Index] = "";
  398. m_pGDC->Values[nRow][Column04->Index] = sTypeNm;
  399. m_pGDC->Values[nRow][Column05->Index] = sType;
  400. m_pGDC->Values[nRow][Column06->Index] = nIncd;
  401. m_pGDC->Values[nRow][Column07->Index] = nFtlt;
  402. m_pGDC->Values[nRow][Column08->Index] = nInjr;
  403. m_pGDC->Values[nRow][Column09->Index] = nPrpr;
  404. m_pGDC->Values[nRow][Column10->Index] = sRowType;
  405. }
  406. }
  407. __finally
  408. {
  409. if (pADO)
  410. {
  411. pADO->Close();
  412. }
  413. TvList->EndUpdate();
  414. //CxList->SetFocus();
  415. LblRecords->Caption = FormatFloat("##,##0", m_pGDC->RecordCount) + FrmLang->lblEA->Caption;//" 건";
  416. }
  417. }
  418. catch(EDatabaseError &E)
  419. {
  420. throw Exception(String(E.ClassName()) + E.Message);
  421. }
  422. catch(...)
  423. {
  424. throw Exception(FrmLang->lblDbErr->Caption);//"알수없는 오류가 발생하였습니다.");
  425. }
  426. DspIncidentTypeChart();
  427. String sEnd = FrmLang->lblQrySel->Caption + " [" + LblRecords->Caption + "]";//"데이터 " + LblRecords->Caption + " 이 조회 되었습니다.";
  428. Application->MessageBox(sEnd.c_str(),
  429. FrmLang->lblQryEnd->Caption.c_str(),//L"데이터 조회 완료",
  430. MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  431. }
  432. //---------------------------------------------------------------------------
  433. void __fastcall TIST00401::DspIncidentTypeChart()
  434. {
  435. try
  436. {
  437. TcxGridChartSeries *pChart11 = NULL;
  438. TcxGridChartSeries *pChart12 = NULL;
  439. TcxGridChartSeries *pChart13 = NULL;
  440. TcxGridChartSeries *pChart14 = NULL;
  441. TcxGridChartSeries *pChart21 = NULL;
  442. TcxGridChartSeries *pChart22 = NULL;
  443. TcxGridChartSeries *pChart23 = NULL;
  444. TcxGridChartSeries *pChart24 = NULL;
  445. TcxGridChartSeries *pChart25 = NULL;
  446. TvChart1->ClearSeries();
  447. TvChart2->ClearSeries();
  448. int nRow = 0;
  449. int nDataCnt = 0;
  450. try
  451. {
  452. TvChart1->BeginUpdate();
  453. TvChart2->BeginUpdate();
  454. nDataCnt = pMngrInci->FLists.Size();
  455. TvChart1->DataController->RecordCount = nDataCnt;
  456. TvChart2->DataController->RecordCount = nDataCnt;
  457. pChart11 = TvChart1->CreateSeries();
  458. pChart11->DataBinding->ValueType = "Integer";
  459. pChart11->DisplayText = Column06->Caption;//"돌발발생건수";
  460. pChart12 = TvChart1->CreateSeries();
  461. pChart12->DataBinding->ValueType = "Integer";
  462. pChart12->DisplayText = Column07->Caption;//"사망자수";
  463. pChart13 = TvChart1->CreateSeries();
  464. pChart13->DataBinding->ValueType = "Integer";
  465. pChart13->DisplayText = Column08->Caption;//"부상자수";
  466. #if 0
  467. pChart14 = TvChart1->CreateSeries();
  468. pChart14->DataBinding->ValueType = "Integer";
  469. pChart14->DisplayText = Column09->Caption;//"재산피해금액";
  470. #endif
  471. pChart21 = TvChart2->CreateSeries();
  472. pChart21->DataBinding->ValueType = "Integer";
  473. pChart21->DisplayText = FrmLang->lblInc1->Caption;//"사고";
  474. pChart22 = TvChart2->CreateSeries();
  475. pChart22->DataBinding->ValueType = "Integer";
  476. pChart22->DisplayText = FrmLang->lblInc2->Caption;//"공사";
  477. pChart23 = TvChart2->CreateSeries();
  478. pChart23->DataBinding->ValueType = "Integer";
  479. pChart23->DisplayText = FrmLang->lblInc3->Caption;//"행사";
  480. pChart24 = TvChart2->CreateSeries();
  481. pChart24->DataBinding->ValueType = "Integer";
  482. pChart24->DisplayText = FrmLang->lblInc4->Caption;//"기상";
  483. pChart25 = TvChart2->CreateSeries();
  484. pChart25->DataBinding->ValueType = "Integer";
  485. pChart25->DisplayText = FrmLang->lblInc0->Caption;//"기타";
  486. FOR_STL(TItsStaIncident*, pInci, pMngrInci->FLists)
  487. {
  488. pChart11->Values[nRow] = pInci->FIncid[0][0];
  489. pChart12->Values[nRow] = pInci->FIncid[0][1];
  490. pChart13->Values[nRow] = pInci->FIncid[0][2];
  491. //pChart14->Values[nRow] = pInci->FIncid[0][3];
  492. TvChart1->Categories->Values[nRow] = pInci->FDate;
  493. pChart21->Values[nRow] = pInci->FIncid[1][0];
  494. pChart22->Values[nRow] = pInci->FIncid[2][0];
  495. pChart23->Values[nRow] = pInci->FIncid[3][0];
  496. pChart24->Values[nRow] = pInci->FIncid[4][0];
  497. pChart25->Values[nRow] = pInci->FIncid[5][0];
  498. TvChart2->Categories->Values[nRow] = pInci->FDate;
  499. nRow++;
  500. }
  501. }
  502. __finally
  503. {
  504. TvChart1->EndUpdate();
  505. TvChart2->EndUpdate();
  506. pMngrInci->FLists.RemoveAll();
  507. }
  508. }
  509. catch(...)
  510. {
  511. throw Exception(FrmLang->lblDbErr->Caption);//"[DspIncidentTypeChart]알수없는 오류가 발생하였습니다.");
  512. }
  513. }
  514. //---------------------------------------------------------------------------
  515. void __fastcall TIST00401::SelIncidentSect()
  516. {
  517. TSqlCursor sqlCrs;
  518. String sQry;
  519. TADOQuery *pADO = ADOQry;
  520. switch(FTermType)
  521. {
  522. case 0:
  523. sQry = "SELECT SUBSTR(STAT_DT, 1, 8) AS STAT_DT, COUNT(1) DATA_CNT, \r\n"
  524. " TO_CHAR(TO_DATE(SUBSTR(STAT_DT, 1, 8), 'YYYYMMDD'), 'YYYY-MM-DD') AS STAT_DTNM, \r\n"
  525. " LINK_ID AS LINK_ID, \r\n"
  526. " SUM(INCD_OCRR_NUM) INCD_OCRR_NUM, \r\n"
  527. " SUM(FTLT_PNUM) FTLT_PNUM, \r\n"
  528. " SUM(INJR_PNUM) INJR_PNUM, \r\n"
  529. " SUM(PRPR_DMGE_AMT) PRPR_DMGE_AMT \r\n"
  530. " FROM TB_INCD_SECT_DD_STAT \r\n"
  531. " WHERE STAT_DT BETWEEN :p01 AND :p02 \r\n"
  532. " GROUP BY ROLLUP(SUBSTR(STAT_DT, 1, 8), LINK_ID) \r\n"
  533. " ORDER BY STAT_DT \r\n";
  534. break;
  535. case 1:
  536. sQry = "SELECT SUBSTR(STAT_DT, 1, 6) AS STAT_DT, COUNT(1) DATA_CNT, \r\n"
  537. " TO_CHAR(TO_DATE(SUBSTR(STAT_DT, 1, 6), 'YYYYMM'), 'YYYY-MM') AS STAT_DTNM, \r\n"
  538. " LINK_ID AS LINK_ID, \r\n"
  539. " SUM(INCD_OCRR_NUM) INCD_OCRR_NUM, \r\n"
  540. " SUM(FTLT_PNUM) FTLT_PNUM, \r\n"
  541. " SUM(INJR_PNUM) INJR_PNUM, \r\n"
  542. " SUM(PRPR_DMGE_AMT) PRPR_DMGE_AMT \r\n"
  543. " FROM TB_INCD_SECT_MN_STAT \r\n"
  544. " WHERE STAT_DT BETWEEN :p01 AND :p02 \r\n"
  545. " GROUP BY ROLLUP(SUBSTR(STAT_DT, 1, 6), LINK_ID) \r\n"
  546. " ORDER BY STAT_DT \r\n";
  547. break;
  548. case 2:
  549. sQry = "SELECT SUBSTR(STAT_DT, 1, 4) AS STAT_DT, COUNT(1) DATA_CNT, \r\n"
  550. " SUBSTR(STAT_DT, 1, 4) AS STAT_DTNM, \r\n"
  551. " LINK_ID AS LINK_ID, \r\n"
  552. " SUM(INCD_OCRR_NUM) INCD_OCRR_NUM, \r\n"
  553. " SUM(FTLT_PNUM) FTLT_PNUM, \r\n"
  554. " SUM(INJR_PNUM) INJR_PNUM, \r\n"
  555. " SUM(PRPR_DMGE_AMT) PRPR_DMGE_AMT \r\n"
  556. " FROM TB_INCD_SECT_MN_STAT \r\n"
  557. " WHERE STAT_DT BETWEEN :p01 AND :p02 \r\n"
  558. " GROUP BY ROLLUP(SUBSTR(STAT_DT, 1, 4), LINK_ID) \r\n"
  559. " ORDER BY STAT_DT \r\n";
  560. break;
  561. default: return;
  562. }
  563. sQry = "SELECT NVL(STAT_DT, 'X') AS STAT_DT, \r\n"
  564. " NVL(DATA_CNT, 0) AS DATA_CNT, \r\n"
  565. " NVL(STAT_DTNM, 'X') AS STAT_DTNM, \r\n"
  566. " NVL(LINK_ID, 0) AS LINK_ID, \r\n"
  567. " NVL(INCD_OCRR_NUM, 0) AS INCD_OCRR_NUM, \r\n"
  568. " NVL(FTLT_PNUM, 0) AS FTLT_PNUM, \r\n"
  569. " NVL(INJR_PNUM, 0) AS INJR_PNUM, \r\n"
  570. " NVL(PRPR_DMGE_AMT, 0) AS PRPR_DMGE_AMT \r\n"
  571. " FROM (" + sQry + ")";
  572. try
  573. {
  574. ITSDb_SQLText(pADO, sQry);
  575. ITSDb_SQLBind(pADO, "p01", FStTime);
  576. ITSDb_SQLBind(pADO, "p02", FEdTime);
  577. ITSDb_SQLOpen(pADO);
  578. DspIncidentSectList();
  579. }
  580. catch(EDatabaseError &E)
  581. {
  582. throw Exception(String(E.ClassName()) + E.Message);
  583. }
  584. catch(...)
  585. {
  586. throw Exception(FrmLang->lblDbErr->Caption);//"알수없는 오류가 발생하였습니다.");
  587. }
  588. }
  589. //---------------------------------------------------------------------------
  590. void __fastcall TIST00401::DspIncidentSectList()
  591. {
  592. TADOQuery *pADO = ADOQry;
  593. try
  594. {
  595. CMM_ClearGridTableView(TvList);
  596. int nRow = 0;
  597. int nDataCnt = 0;
  598. try
  599. {
  600. TvList->BeginUpdate();
  601. nDataCnt = pADO->RecordCount;
  602. m_pGDC->RecordCount = nDataCnt;
  603. String sRowType = "";
  604. int nIncd, nFtlt, nInjr, nPrpr;
  605. TItsNode *pNode;
  606. TItsLink *pLink;
  607. String sFNode, sTNode;
  608. for( ; !pADO->Eof; pADO->Next(), nRow++)
  609. {
  610. sFNode = sTNode = "";
  611. String sDate = pADO->FieldByName("STAT_DTNM")->AsString; //통계시각
  612. String sLink = pADO->FieldByName("LINK_ID")->AsString; //구간ID
  613. nIncd = pADO->FieldByName("INCD_OCRR_NUM")->AsInteger; //발생건수
  614. nFtlt = pADO->FieldByName("FTLT_PNUM")->AsInteger; //사망자수
  615. nInjr = pADO->FieldByName("INJR_PNUM")->AsInteger; //부상자수
  616. nPrpr = pADO->FieldByName("PRPR_DMGE_AMT")->AsInteger; //피해금액
  617. sRowType = "0";
  618. if (sDate == "X")
  619. {
  620. sRowType = "2";
  621. sDate = FrmLang->lblChartTotal->Caption;//"전체";
  622. sLink = "-";
  623. sFNode = sTNode = "-";
  624. }
  625. else
  626. {
  627. if (sLink == "0")
  628. {
  629. sRowType = "1";
  630. sLink = FrmLang->lblChartSoge->Caption;//"소계";
  631. sFNode = sTNode = "-";
  632. }
  633. else
  634. {
  635. sFNode = sTNode = "";
  636. pLink = ItsLinkManager->FLists.Find(sLink);
  637. if (pLink)
  638. {
  639. sFNode = "[" + pLink->F_NODEID + "] ";
  640. pNode = ItsNodeManager->FLists.Find(pLink->F_NODEID);
  641. if (pNode) sFNode = sFNode + pNode->NODE_NAME;
  642. sTNode = "[" + pLink->T_NODEID + "] ";
  643. pNode = ItsNodeManager->FLists.Find(pLink->T_NODEID);
  644. if (pNode) sTNode = sTNode + pNode->NODE_NAME;
  645. }
  646. TItsStaIncident *pInci = pMngrInci->FLists.Find(sLink);
  647. if (!pInci)
  648. {
  649. pInci = new TItsStaIncident();
  650. pMngrInci->FLists.Push(sLink, pInci);
  651. pInci->FDate = sLink;
  652. }
  653. pInci->FIncid[0][0] += nIncd;
  654. pInci->FIncid[0][1] += nFtlt;
  655. pInci->FIncid[0][2] += nInjr;
  656. pInci->FIncid[0][3] += nPrpr;
  657. }
  658. }
  659. m_pGDC->Values[nRow][Column01->Index] = sDate;
  660. m_pGDC->Values[nRow][Column02->Index] = sLink;
  661. m_pGDC->Values[nRow][Column03->Index] = sFNode;
  662. m_pGDC->Values[nRow][Column11->Index] = sTNode;
  663. m_pGDC->Values[nRow][Column06->Index] = nIncd;
  664. m_pGDC->Values[nRow][Column07->Index] = nFtlt;
  665. m_pGDC->Values[nRow][Column08->Index] = nInjr;
  666. m_pGDC->Values[nRow][Column09->Index] = nPrpr;
  667. m_pGDC->Values[nRow][Column10->Index] = sRowType;
  668. }
  669. }
  670. __finally
  671. {
  672. if (pADO)
  673. {
  674. pADO->Close();
  675. }
  676. TvList->EndUpdate();
  677. //CxList->SetFocus();
  678. LblRecords->Caption = FormatFloat("##,##0", m_pGDC->RecordCount) + FrmLang->lblEA->Caption;//" 건";
  679. }
  680. }
  681. catch(EDatabaseError &E)
  682. {
  683. throw Exception(String(E.ClassName()) + E.Message);
  684. }
  685. catch(...)
  686. {
  687. throw Exception(FrmLang->lblDbErr->Caption);//"알수없는 오류가 발생하였습니다.");
  688. }
  689. DspIncidentSectChart();
  690. String sEnd = FrmLang->lblQrySel->Caption + " [" + LblRecords->Caption + "]";//"데이터 " + LblRecords->Caption + " 이 조회 되었습니다.";
  691. Application->MessageBox(sEnd.c_str(),
  692. FrmLang->lblQryEnd->Caption.c_str(),//L"데이터 조회 완료",
  693. MB_OK|MB_ICONINFORMATION|MB_APPLMODAL);
  694. }
  695. //---------------------------------------------------------------------------
  696. void __fastcall TIST00401::DspIncidentSectChart()
  697. {
  698. try
  699. {
  700. TcxGridChartSeries *pChart11 = NULL;
  701. TcxGridChartSeries *pChart12 = NULL;
  702. TcxGridChartSeries *pChart13 = NULL;
  703. TcxGridChartSeries *pChart14 = NULL;
  704. TvChart1->ClearSeries();
  705. int nRow = 0;
  706. int nDataCnt = 0;
  707. try
  708. {
  709. TvChart1->BeginUpdate();
  710. nDataCnt = pMngrInci->FLists.Size();
  711. TvChart1->DataController->RecordCount = nDataCnt;
  712. pChart11 = TvChart1->CreateSeries();
  713. pChart11->DataBinding->ValueType = "Integer";
  714. pChart11->DisplayText = Column06->Caption;//"돌발발생건수";
  715. pChart12 = TvChart1->CreateSeries();
  716. pChart12->DataBinding->ValueType = "Integer";
  717. pChart12->DisplayText = Column07->Caption;//"사망자수";
  718. pChart13 = TvChart1->CreateSeries();
  719. pChart13->DataBinding->ValueType = "Integer";
  720. pChart13->DisplayText = Column08->Caption;//"부상자수";
  721. #if 0
  722. pChart14 = TvChart1->CreateSeries();
  723. pChart14->DataBinding->ValueType = "Integer";
  724. pChart14->DisplayText = Column09->Caption;//"재산피해금액";
  725. #endif
  726. FOR_STL(TItsStaIncident*, pInci, pMngrInci->FLists)
  727. {
  728. pChart11->Values[nRow] = pInci->FIncid[0][0];
  729. pChart12->Values[nRow] = pInci->FIncid[0][1];
  730. pChart13->Values[nRow] = pInci->FIncid[0][2];
  731. //pChart14->Values[nRow] = pInci->FIncid[0][3];
  732. TvChart1->Categories->Values[nRow] = pInci->FDate;
  733. nRow++;
  734. }
  735. }
  736. __finally
  737. {
  738. TvChart1->EndUpdate();
  739. pMngrInci->FLists.RemoveAll();
  740. }
  741. }
  742. catch(...)
  743. {
  744. throw Exception(FrmLang->lblDbErr->Caption);//"[DspIncidentTypeChart]알수없는 오류가 발생하였습니다.");
  745. }
  746. }
  747. //---------------------------------------------------------------------------
  748. void __fastcall TIST00401::OnMessage(TMessage &Msg)
  749. {
  750. switch (Msg.Msg)
  751. {
  752. case WM_PARAM_DATABASE:
  753. if (WP_DB_SELECT_OK == Msg.WParam)
  754. {
  755. //ShowMessage("Select Ok");
  756. }
  757. break;
  758. }
  759. }
  760. //---------------------------------------------------------------------------
  761. void __fastcall TIST00401::BtnExlSaveClick(TObject *Sender)
  762. {
  763. TcxGrid *pGrid = CxList;
  764. TcxGridTableView *pView = TvList;
  765. String sTitle= Caption;//"돌발상황통계";
  766. CMM_ExportToExcelFile(sTitle, pGrid, pView, this);
  767. }
  768. //---------------------------------------------------------------------------
  769. void __fastcall TIST00401::FormClose(TObject *Sender, TCloseAction &Action)
  770. {
  771. POST_MSG(FParent, WM_SUBFORM_CLOSE, 0, 0);
  772. CommClose();
  773. //IST00401 = NULL;
  774. }
  775. //---------------------------------------------------------------------------
  776. void __fastcall TIST00401::FormDestroy(TObject *Sender)
  777. {
  778. if (pMngrInci)
  779. {
  780. delete pMngrInci;
  781. pMngrInci = NULL;
  782. }
  783. CommClose();
  784. }
  785. //---------------------------------------------------------------------------
  786. /*
  787. * 닫기버튼 이나 x버튼 클릭시 공통으로 처리하는 로직이들어간다..
  788. * Form과 DataModule class를 delete시킨다.
  789. * arguments
  790. *
  791. * return
  792. * void
  793. */
  794. void __fastcall TIST00401::CommClose()
  795. {
  796. if (pMngrInci)
  797. {
  798. delete pMngrInci;
  799. pMngrInci = NULL;
  800. }
  801. CMM_SaveForm(g_sFormsDir, this);
  802. //IST00401 = NULL;
  803. }
  804. //---------------------------------------------------------------------------
  805. void __fastcall TIST00401::cxTrackBarMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
  806. {
  807. try {
  808. TcxTrackBar *pTrack = (TcxTrackBar*)Sender;
  809. TcxLabel *pLabel = LblPage1;
  810. TcxGridChartView *pChart = TvChart1;
  811. if (pTrack->Tag == 2)
  812. {
  813. pLabel = LblPage2;
  814. pChart = TvChart2;
  815. }
  816. if (pTrack->Position == pTrack->Properties->Max)
  817. {
  818. pChart->OptionsView->CategoriesPerPage = 0;
  819. pLabel->Caption = lblAll->Caption;//"All ";
  820. }
  821. else
  822. {
  823. pChart->OptionsView->CategoriesPerPage = pTrack->Position;
  824. pLabel->Caption = String(pTrack->Position) + " ";
  825. }
  826. } catch(...) {}
  827. }
  828. //---------------------------------------------------------------------------
  829. void __fastcall TIST00401::cxTrackBarPropertiesChange(TObject *Sender)
  830. {
  831. try {
  832. TcxTrackBar *pTrack = (TcxTrackBar*)Sender;
  833. TcxLabel *pLabel = LblPage1;
  834. if (pTrack->Tag == 2)
  835. {
  836. pLabel = LblPage2;
  837. }
  838. if (pTrack->Position == pTrack->Properties->Max)
  839. {
  840. pLabel->Caption = lblAll->Caption;//"전체 ";
  841. }
  842. else
  843. {
  844. pLabel->Caption = String(pTrack->Position) + " ";
  845. }
  846. } catch(...) {}
  847. }
  848. //---------------------------------------------------------------------------
  849. void __fastcall TIST00401::BtnGraphSaveClick(TObject *Sender)
  850. {
  851. String sTitle;
  852. TcxButton *pBtn = (TcxButton*)Sender;
  853. TcxGridChartView *pChart = TvChart1;
  854. if (pBtn->Tag == 2)
  855. {
  856. pChart = TvChart2;
  857. }
  858. TSaveDialog *SaveDialog1 = NULL;
  859. String sNewFile, sDate;
  860. sTitle = cxPageControl1->Properties->ActivePage->Caption;
  861. sDate = Now().FormatString("YYYYMMDDhhnn");
  862. sNewFile = FTitle + "_" + sDate;
  863. int nFilterIndex = 0;
  864. try
  865. {
  866. SaveDialog1 = new TSaveDialog(Application);
  867. SaveDialog1->Title = sTitle + lblImgSave->Caption;//" 차트 이미지 저장";
  868. //SaveDialog1->InitialDir = ExtractFilePath(Application->ExeName);
  869. SaveDialog1->Filter = "BMP (*.bmp)|*.bmp|"
  870. "JPG (*.jpg)|*.jpg|"
  871. //"PNG (*.png)|*.png|"
  872. "WMF (*.wmf)|*.wmf|"
  873. "EMF (*.emf)|*.emf";
  874. SaveDialog1->FileName = sNewFile;
  875. if (SaveDialog1->Execute() == false)
  876. {
  877. return ;
  878. }
  879. sNewFile = SaveDialog1->FileName;
  880. if (sNewFile == "")
  881. {
  882. return ;
  883. }
  884. nFilterIndex = SaveDialog1->FilterIndex;
  885. }
  886. __finally
  887. {
  888. if (SaveDialog1) delete SaveDialog1;
  889. ChDir(ExtractFilePath(Application->ExeName));
  890. }
  891. TWaitCursor waitCsr;
  892. #include <jpeg.hpp>
  893. TGraphic *pGraphic = NULL;
  894. TGraphic *pTmpImage = NULL;
  895. try
  896. {
  897. Application->ProcessMessages();
  898. try
  899. {
  900. bool bMetafile = false;
  901. switch (nFilterIndex)
  902. {
  903. case 1: sNewFile = ChangeFileExt(sNewFile, ".bmp"); bMetafile = false; break;
  904. case 2: sNewFile = ChangeFileExt(sNewFile, ".jpg"); bMetafile = false; break;
  905. //case 3: sNewFile = ChangeFileExt(sNewFile, ".png"); bMetafile = false; break;
  906. case 3: sNewFile = ChangeFileExt(sNewFile, ".wmf"); bMetafile = true; break;
  907. case 4: sNewFile = ChangeFileExt(sNewFile, ".emf"); bMetafile = true; break;
  908. default: sNewFile = ChangeFileExt(sNewFile, ".bmp"); bMetafile = false; break;
  909. }
  910. // (TdxPNGImage)
  911. if (nFilterIndex == 3 || nFilterIndex == 4)
  912. {
  913. pGraphic = pChart->CreateImage(__classid(Graphics::TMetafile));
  914. ((Graphics::TMetafile*)pGraphic)->Enhanced = nFilterIndex == 4 ? true : false;
  915. }
  916. else
  917. {
  918. pGraphic = pChart->CreateImage(__classid(Graphics::TBitmap));
  919. }
  920. //TPNGImage *pPng = new TPNGImage();
  921. switch (nFilterIndex)
  922. {
  923. case 2: pTmpImage = new TJPEGImage(); break;
  924. //case 3: pTmpImage = new TdxPNGImage(); break;
  925. }
  926. if (pTmpImage)
  927. {
  928. pTmpImage->Assign(pGraphic);
  929. pTmpImage->SaveToFile(sNewFile);
  930. }
  931. else
  932. {
  933. pGraphic->SaveToFile(sNewFile);
  934. }
  935. }
  936. catch(Exception & E)
  937. {
  938. String strMsg = lblSaveErr->Caption + "\r\n";//"파일로 저장하는 중에 에러가 발생했습니다.\r\n";
  939. strMsg += "[" + E.Message + "]\r\n";
  940. ShowMessage(strMsg);
  941. return ;
  942. }
  943. }
  944. __finally
  945. {
  946. if (pGraphic)
  947. {
  948. delete pGraphic;
  949. }
  950. if (pTmpImage)
  951. {
  952. delete pTmpImage;
  953. }
  954. }
  955. String sMsg = "";
  956. //sMsg = "[차트 이미지를\r\n" + sNewFile + "\r\n 로 생성 하였습니다.";
  957. sMsg = lblSaveOk->Caption + "\r\n[" + sNewFile + "]";
  958. MessageDlg(sMsg, mtInformation, TMsgDlgButtons() << mbOK, 0);
  959. }
  960. //---------------------------------------------------------------------------
  961. void __fastcall TIST00401::ChkDisplayValPropertiesChange(TObject *Sender)
  962. {
  963. TcxCheckBox *pChkBox = (TcxCheckBox*)Sender;
  964. if (pChkBox->Tag == 1)
  965. ChartValueDisplay(TvChart1, pChkBox->Checked);
  966. else
  967. ChartValueDisplay(TvChart2, pChkBox->Checked);
  968. }
  969. //---------------------------------------------------------------------------
  970. void __fastcall TIST00401::TvListCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  971. bool &ADone)
  972. {
  973. if (AViewInfo)
  974. {
  975. String sType = AViewInfo->GridRecord->DisplayTexts[Column10->Index];
  976. if (sType == "1")
  977. ACanvas->Brush->Color = clOlive; //소계
  978. else if (sType == "2")
  979. ACanvas->Brush->Color = clLime; //전체
  980. }
  981. }
  982. //---------------------------------------------------------------------------