//--------------------------------------------------------------------------- #include #include "ITSSkinF.h" #include "ITSUtilF.h" #include "ITSDbF.h" #include "AppGlobalF.h" #include "WindowMsgF.h" #include "ITSLangTransF.h" #pragma hdrstop #include "IHS0010MF.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "cxButtons" #pragma link "cxCalendar" #pragma link "cxClasses" #pragma link "cxContainer" #pragma link "cxControls" #pragma link "cxCustomData" #pragma link "cxData" #pragma link "cxDataStorage" #pragma link "cxDropDownEdit" #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 "cxMaskEdit" #pragma link "cxPC" #pragma link "cxPCdxBarPopupMenu" #pragma link "cxSpinEdit" #pragma link "cxStyles" #pragma link "cxTextEdit" #pragma link "cxTimeEdit" #pragma link "dxSkinBlack" #pragma link "dxSkinBlue" #pragma link "dxSkinsCore" #pragma link "dxSkinscxPCPainter" #pragma resource "*.dfm" TIHS0010M *IHS0010M = NULL; //--------------------------------------------------------------------------- __fastcall TIHS0010M::TIHS0010M(TComponent* Owner) : TForm(Owner) { LangTrans->Translate(this, ITSDb_GetConnection()); ITSSkin_Load(this); CMM_LoadForm(g_sFormsDir, this); FTitle = Caption;//"¿î¿µÀÚ Á¢¼Ó ÀÌ·ÂÁ¶È¸"; } //--------------------------------------------------------------------------- /* * formÀ» º¸¿©ÁÙ¶§ È£ÃâµÇ´Â event ¸Þ¼­µåÀÌ´Ù. * arguments * Sender : event handler °´Ã¼ * return * void */ void __fastcall TIHS0010M::FormShow(TObject *Sender) { PgList->ActivePageIndex = 0; // form ÃʱâÈ­ FormInit(); } //--------------------------------------------------------------------------- /* * form ÃʱâÈ­ * arguments * * return * void */ void __fastcall TIHS0010M::FormInit() { ADOQry->Connection = ITSDb_GetConnection(); m_pGDC = TvList->DataController; TvList->OptionsView->NoDataToDisplayInfoText = FrmLang->lblNoInfo->Caption;//"<¿î¿µÀÚ Á¢¼Ó ÀÌ·Â Á¤º¸>"; DtStDate->Date = Now() - 30; DtEdDate->Date = Now() - 1; //DtEdTime->EditValue = Now().FormatString("hh"); DtStTime->Time = StrToDateTime("00:00"); DtEdTime->Time = StrToDateTime("23:59"); if (BtnSearch->Enabled) BtnSearch->SetFocus(); } //--------------------------------------------------------------------------- /* * ´Ý±â¹öư À̳ª x¹öư Ŭ¸¯½Ã °øÅëÀ¸·Î ó¸®ÇÏ´Â ·ÎÁ÷À̵é¾î°£´Ù.. * Form°ú DataModule class¸¦ delete½ÃŲ´Ù. * arguments * * return * void */ void __fastcall TIHS0010M::CommClose() { try { CMM_SaveForm(g_sFormsDir, this); } catch(...) { } } //--------------------------------------------------------------------------- /* * È­¸éÀÌ ·ÎµùµÈ ÈÄ ¸®½ºÆ® ¸ñ·ÏÀ» Á¶È¸Çϵµ·Ï ÇÑ´Ù. * arguments * * return * void */ void __fastcall TIHS0010M::TmrRefreshTimer(TObject *Sender) { TmrRefresh->Enabled = false; } //--------------------------------------------------------------------------- /* * Excel Button Click Event Handler * arguments * Sender : event handler °´Ã¼ * return * void */ void __fastcall TIHS0010M::BtnExlSaveClick(TObject *Sender) { TcxGrid *pGrid = CxList; TcxGridTableView *pView = TvList; String sTitle= Caption;//"¿î¿µÀÚ Á¢¼ÓÀÌ·Â"; CMM_ExportToExcelFile(sTitle, pGrid, pView, this); } //--------------------------------------------------------------------------- /* * Refresh Button Click Event Handler * arguments * Sender : event handler °´Ã¼ * return * void */ void __fastcall TIHS0010M::BtnSearchClick(TObject *Sender) { Application->ProcessMessages(); TSqlCursor sqlCrs((TControl*)BtnSearch); RefreshData(); } //--------------------------------------------------------------------------- /* * Refresh Data Event Function * arguments * * return * void */ void __fastcall TIHS0010M::RefreshData() { #if 0 FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hh"); FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hh"); #else FStDateTime = DtStDate->Date.FormatString("yyyymmdd") + DtStTime->Time.FormatString("hhnn"); FEdDateTime = DtEdDate->Date.FormatString("yyyymmdd") + DtEdTime->Time.FormatString("hhnn"); #endif if (wcscmp(FStDateTime.c_str(), FEdDateTime.c_str()) >= 0) { Application->MessageBox(FrmLang->lblQryDtErr->Caption.c_str(),//L"½ÃÀÛ ½Ã°¢ÀÌ Á¾·á ½Ã°¢ º¸´Ù À۰ųª °°½À´Ï´Ù.", FTitle.c_str(), MB_OK|MB_ICONWARNING|MB_APPLMODAL); ActiveControl = DtStDate; return; } #if 0 FStDateTime = FStDateTime + "0000"; FEdDateTime = FEdDateTime + "5959"; #else FStDateTime = FStDateTime + "00"; FEdDateTime = FEdDateTime + "59"; #endif SelHistory(); } //--------------------------------------------------------------------------- /* * ÀÌ·Â µ¥ÀÌÅÍ Á¶È¸/Ãâ·Â * arguments * * return * void */ void __fastcall TIHS0010M::SelHistory() { String sQry; TADOQuery *pADO = ADOQry; sQry = "SELECT USER_ID, LOGIN_HMS, LOGOUT_HMS \r\n" " FROM TB_USERCNNC_HS \r\n" " WHERE LOGIN_HMS BETWEEN :p01 \r\n" " AND :p02 \r\n" " ORDER BY USER_ID, LOGIN_HMS \r\n"; try { //pADO->Connection = ITSDb_GetConnection(); 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 TIHS0010M::DspHistory() { TADOQuery *pADO = ADOQry; try { CMM_ClearGridTableView(TvList); int nRow = 0; try { TvList->BeginUpdate(); m_pGDC->RecordCount = pADO->RecordCount; for( ; !pADO->Eof; pADO->Next(), nRow++) { String sUsId = pADO->FieldByName("USER_ID")->AsString; String sInDt = pADO->FieldByName("LOGIN_HMS")->AsString; String sOuDt = pADO->FieldByName("LOGOUT_HMS")->AsString; m_pGDC->Values[nRow][Column01->Index] = sUsId; if (sInDt.IsEmpty()) m_pGDC->Values[nRow][Column02->Index] = "-"; else m_pGDC->Values[nRow][Column02->Index] = sInDt.SubString( 1, 4) + "-" + sInDt.SubString( 5, 2) + "-" + sInDt.SubString( 7, 2) + " " + sInDt.SubString( 9, 2) + ":" + sInDt.SubString(11, 2) + ":" + sInDt.SubString(13, 2); if (sOuDt.IsEmpty()) m_pGDC->Values[nRow][Column03->Index] = "-"; else m_pGDC->Values[nRow][Column03->Index] = sOuDt.SubString( 1, 4) + "-" + sOuDt.SubString( 5, 2) + "-" + sOuDt.SubString( 7, 2) + " " + sOuDt.SubString( 9, 2) + ":" + sOuDt.SubString(11, 2) + ":" + sOuDt.SubString(13, 2); } } __finally { if (pADO) { pADO->Close(); } TvList->EndUpdate(); CxList->SetFocus(); LblRecords->Caption = FormatFloat("##,##0", m_pGDC->RecordCount) + FrmLang->lblEA->Caption;//" °Ç"; String sEnd = FrmLang->lblQrySel->Caption + " [" + LblRecords->Caption + "]";//"µ¥ÀÌÅÍ " + LblRecords->Caption + " ÀÌ Á¶È¸ µÇ¾ú½À´Ï´Ù."; Application->MessageBox(sEnd.c_str(), FrmLang->lblQryEnd->Caption.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);//"¾Ë¼ö¾ø´Â ¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù."); } } //--------------------------------------------------------------------------- /* * Close ¹öư Ŭ¸¯ À̺¥Æ® Çڵ鷯 * arguments * Sender : event handler °´Ã¼ * return * void */ void __fastcall TIHS0010M::BtnCloseClick(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TIHS0010M::FormClose(TObject *Sender, TCloseAction &Action) { CommClose(); IHS0010M = NULL; Action = caFree; } //--------------------------------------------------------------------------- void __fastcall TIHS0010M::OnMessage(TMessage &Msg) { switch (Msg.Msg) { case WM_PARAM_DATABASE: if (WP_DB_SELECT_OK == Msg.WParam) { //ShowMessage("Select Ok"); } break; } } //--------------------------------------------------------------------------- void __fastcall TIHS0010M::TvListDataControllerFilterChanged(TObject *Sender) { CMM_SetFilterLike(TvList); } //---------------------------------------------------------------------------