//--------------------------------------------------------------------------- #include #include "ITSSkinF.h" #include "ITSUtilF.h" #include "ITSDbF.h" #include "AppGlobalF.h" #include "WindowMsgF.h" #pragma hdrstop #include "AVIH0201F.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "cxButtons" #pragma link "cxCheckBox" #pragma link "cxClasses" #pragma link "cxContainer" #pragma link "cxControls" #pragma link "cxCustomData" #pragma link "cxData" #pragma link "cxDataStorage" #pragma link "cxEdit" #pragma link "cxFilter" #pragma link "cxGraphics" #pragma link "cxGrid" #pragma link "cxGridCustomTableView" #pragma link "cxGridCustomView" #pragma link "cxGridLevel" #pragma link "cxGridTableView" #pragma link "cxLabel" #pragma link "cxLookAndFeelPainters" #pragma link "cxLookAndFeels" #pragma link "cxStyles" #pragma link "cxTextEdit" #pragma link "dxSkinBlack" #pragma link "dxSkinBlue" #pragma link "dxSkinsCore" #pragma link "dxSkinscxPCPainter" #pragma resource "*.dfm" TAVIH0201 *AVIH0201 = NULL; //--------------------------------------------------------------------------- __fastcall TAVIH0201::TAVIH0201(TComponent* Owner, HWND hHandle, String sFrom, String sTo, String sIdList) : TForm(Owner) { ITSSkin_Load(this); CMM_LoadForm(g_sFormsDir, this); FParent = hHandle; FStDateTime = sFrom; FEdDateTime = sTo; FIdList = sIdList; Caption = "AVI-Á¦¾î±â Â÷·®ÀÎ½Ä ÀÌ·Â"; } //--------------------------------------------------------------------------- __fastcall TAVIH0201::~TAVIH0201(void) { } //-------------------------------------------------------------------------- /* * form ÃʱâÈ­ * * arguments * * return * void */ void __fastcall TAVIH0201::FormInit() { ADOQry->Connection = ITSDb_GetConnection(); m_pGDC = TvList->DataController; TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//""; //TvList->ViewInfo->GroupByBoxViewInfo->Text = "±×·ìÇÎÇÒ ÇʵåÀÇ Çì´õ¸¦ À̰÷À¸·Î µå·¡±× Çϼ¼¿ä"; LblSearch->Caption = "°Ë»öÁ¶°Ç: " + FStDateTime.SubString(1, 12) + " ~ " + FEdDateTime.SubString(1, 12); } //--------------------------------------------------------------------------- /* * formÀ» º¸¿©ÁÙ¶§ È£ÃâµÇ´Â event ¸Þ¼­µåÀÌ´Ù. * arguments * Sender : event handler °´Ã¼ * return * void */ void __fastcall TAVIH0201::FormShow(TObject *Sender) { FormInit(); Refresh(); TmrShow->Enabled = true; } //--------------------------------------------------------------------------- /* * ´Ý±â¹öư À̳ª x¹öư Ŭ¸¯½Ã °øÅëÀ¸·Î ó¸®ÇÏ´Â ·ÎÁ÷À̵é¾î°£´Ù.. * Form°ú DataModule class¸¦ delete½ÃŲ´Ù. * arguments * * return * void */ void __fastcall TAVIH0201::CommClose() { CMM_SaveForm(g_sFormsDir, this); //AVIH0201 = NULL; } //--------------------------------------------------------------------------- /* * ÃÖÃÊ 1ȸ ¼öÇàµÇ´Â ŸÀÌ¸Ó À̺¥Æ® * arguments * Sender : event handler °´Ã¼ * return * void */ void __fastcall TAVIH0201::TmrShowTimer(TObject *Sender) { TmrShow->Enabled = false; Application->ProcessMessages(); SelHistory(); } //--------------------------------------------------------------------------- void __fastcall TAVIH0201::ChkExpandClick(TObject *Sender) { CMM_ExpandCollapseChk(TvList, ChkExpand->Checked); } //--------------------------------------------------------------------------- /* * Refresh Data Event Function * arguments * * return * void */ void __fastcall TAVIH0201::SelHistory() { TSqlCursor sqlCrs; String sQry; TADOQuery *pADO = ADOQry; sQry = "SELECT AVI_CTLR_MNGM_NMBR, AVI_DTCT_NMBR, CRTN_DT, CRTN_YMD, CRTN_HMS, \r\n" " TOT_DATA_NUM, IDNT_DATA_NUM, NIDN_DATA_NUM, IDNT_RATE \r\n" " FROM TB_AVI_CTLR_IDNT \r\n" " WHERE CRTN_DT BETWEEN :p01 AND :p02 \r\n" " AND AVI_CTLR_MNGM_NMBR IN(" + FIdList + ") \r\n" " ORDER BY AVI_CTLR_MNGM_NMBR, AVI_DTCT_NMBR, CRTN_DT \r\n"; try { ITSDb_SQLText(pADO, sQry); ITSDb_SQLBind(pADO, "p01", FStDateTime); ITSDb_SQLBind(pADO, "p02", FEdDateTime); ITSDb_SQLOpen(pADO); DspHistory(); } catch(EDatabaseError &E) { ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(E.ClassName()), E.Message, sQry); throw Exception(String(E.ClassName()) + E.Message); } catch(Exception &exception) { ::PostMessage(Application->MainForm->Handle, (UINT)(WM_USER+0xF4), (WPARAM)0xB2, (LPARAM)0xB2); DBERRORMSG(Caption, String(exception.ClassName()), exception.Message, sQry); throw Exception(String(exception.ClassName()) + exception.Message); } } //--------------------------------------------------------------------------- void __fastcall TAVIH0201::DspHistory() { TADOQuery *pADO = ADOQry; try { TcxGridChartSeries *pChart = NULL; CMM_ClearGridTableView(TvList); int nRow = 0; int nDataCnt = 0; try { TvList->BeginUpdate(); nDataCnt = pADO->RecordCount; m_pGDC->RecordCount = nDataCnt; for( ; !pADO->Eof; pADO->Next(), nRow++) { m_pGDC->Values[nRow][Column00->Index] = pADO->FieldByName("AVI_CTLR_MNGM_NMBR")->AsString; m_pGDC->Values[nRow][Column01->Index] = pADO->FieldByName("AVI_DTCT_NMBR")->AsString; m_pGDC->Values[nRow][Column02->Index] = ITSUtil_StrToDateTime(pADO->FieldByName("CRTN_DT")->AsString).FormatString(STR_DATETIME); //TODO m_pGDC->Values[nRow][Column03->Index] = pADO->FieldByName("CRTN_YMD")->AsString; m_pGDC->Values[nRow][Column04->Index] = pADO->FieldByName("CRTN_HMS")->AsString; m_pGDC->Values[nRow][Column05->Index] = FormatFloat("##,##0", pADO->FieldByName("TOT_DATA_NUM")->AsInteger); m_pGDC->Values[nRow][Column06->Index] = FormatFloat("##,##0", pADO->FieldByName("IDNT_DATA_NUM")->AsInteger); m_pGDC->Values[nRow][Column07->Index] = FormatFloat("##,##0", pADO->FieldByName("NIDN_DATA_NUM")->AsInteger); m_pGDC->Values[nRow][Column08->Index] = FormatFloat("##,##0", pADO->FieldByName("IDNT_RATE")->AsInteger); } } __finally { if (pADO) { pADO->Close(); } TvList->EndUpdate(); //CxList->SetFocus(); LblRecords->Caption = FormatFloat("##,##0", m_pGDC->RecordCount) + " °Ç"; String sEnd = "µ¥ÀÌÅÍ " + LblRecords->Caption + " ÀÌ Á¶È¸ µÇ¾ú½À´Ï´Ù."; Application->MessageBox(sEnd.c_str(), L"µ¥ÀÌÅÍ Á¶È¸ ¿Ï·á", MB_OK|MB_ICONINFORMATION|MB_APPLMODAL); } } catch(EDatabaseError &E) { throw Exception(String(E.ClassName()) + E.Message); } catch(...) { throw Exception(FrmLang->lblDbErr->Caption);//"¾Ë¼ö¾ø´Â ¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù."); } } //--------------------------------------------------------------------------- void __fastcall TAVIH0201::OnMessage(TMessage &Msg) { switch (Msg.Msg) { case WM_PARAM_DATABASE: if (WP_DB_SELECT_OK == Msg.WParam) { //ShowMessage("Select Ok"); } break; } } //--------------------------------------------------------------------------- void __fastcall TAVIH0201::BtnExlSaveClick(TObject *Sender) { TcxGrid *pGrid = CxList; TcxGridTableView *pView = TvList; String sTitle = "AVI-Á¦¾î±â Â÷·®ÀνÄÀÌ·Â"; CMM_ExportToExcelFile(sTitle, pGrid, pView, this); } //--------------------------------------------------------------------------- void __fastcall TAVIH0201::FormClose(TObject *Sender, TCloseAction &Action) { POST_MSG(FParent, WM_SUBFORM_CLOSE, 0, 0); CommClose(); //AVIH0201 = NULL; } //---------------------------------------------------------------------------