IST00401F.cpp 41 KB

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