//--------------------------------------------------------------------------- #include #include "ITSSkinF.h" #include "ITSUtilF.h" #include "FrmResourceF.h" #include "ITSLangTransF.h" #pragma hdrstop #include "FRAME_UtisStatusListF.h" #include "CDSUtisF.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "cxClasses" #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 "cxLookAndFeelPainters" #pragma link "cxLookAndFeels" #pragma link "cxPC" #pragma link "cxPCdxBarPopupMenu" #pragma link "cxStyles" #pragma link "cxTextEdit" #pragma link "dxSkinBlack" #pragma link "dxSkinBlue" #pragma link "dxSkinsCore" #pragma link "dxSkinscxPCPainter" #pragma resource "*.dfm" //TFRAMEUtisStatusList *FRAMEUtisStatusList; //--------------------------------------------------------------------------- __fastcall TFRAMEUtisStatusList::TFRAMEUtisStatusList(TComponent* Owner) : TFrame(Owner) { FCodeCMS = ItsCodeManager->FLists.Find("CMS"); FCodeCDS = ItsCodeManager->FLists.Find("CDS"); InitList(); } //--------------------------------------------------------------------------- void __fastcall TFRAMEUtisStatusList::InitList() { InitUtisRun(); InitRseRun(); } //--------------------------------------------------------------------------- void __fastcall TFRAMEUtisStatusList::InitUtisRun() { TcxGridTableView *pView= (TcxGridTableView *)TvUtisRun; TcxGridDataController *pGDC = (TcxGridDataController *)pView->DataController; CMM_ClearGridTableView(TvUtisRun); try { int nRow; pView->BeginUpdate(); pGDC->BeginUpdate(); nRow = pGDC->AppendRecord(); pGDC->Values[nRow][ColUtisRunName->Index] = "Á¤Áö¿µ»ó"; pGDC->Values[nRow][ColUtisRunCnt->Index] = FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[0]); pGDC->Values[nRow][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[0]; nRow = pGDC->AppendRecord(); pGDC->Values[nRow][ColUtisRunName->Index] = "5ºÐ±³ÅëÁ¤º¸"; pGDC->Values[nRow][ColUtisRunCnt->Index] = FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[1]); pGDC->Values[nRow][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[1]; nRow = pGDC->AppendRecord(); pGDC->Values[nRow][ColUtisRunName->Index] = "5ºÐ±³ÅëÁ¤º¸(¹æÇâ)"; pGDC->Values[nRow][ColUtisRunCnt->Index] = "-";//FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[2]); pGDC->Values[nRow][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[2]; } __finally { pGDC->EndUpdate(); pView->EndUpdate(); } } //--------------------------------------------------------------------------- void __fastcall TFRAMEUtisStatusList::InitRseRun() { TcxGridTableView *pView= (TcxGridTableView *)TvUtisRse; TcxGridDataController *pGDC = (TcxGridDataController *)pView->DataController; CMM_ClearGridTableView(TvUtisRse); try { int nRow; pView->BeginUpdate(); pGDC->BeginUpdate(); nRow = pGDC->AppendRecord(); pGDC->Values[nRow][ColRseType->Index] = "Àüü"; pGDC->Values[nRow][ColRseKind->Index] = "(´ë)"; pGDC->Values[nRow][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[0]); nRow = pGDC->AppendRecord(); pGDC->Values[nRow][ColRseType->Index] = "Á¤º¸"; pGDC->Values[nRow][ColRseKind->Index] = "¾÷·Îµå"; pGDC->Values[nRow][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[1]); nRow = pGDC->AppendRecord(); pGDC->Values[nRow][ColRseType->Index] = "Á¤º¸"; pGDC->Values[nRow][ColRseKind->Index] = "ºñ¾÷·Îµå"; pGDC->Values[nRow][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[0] - ItsUtisManager->RseRun[1]); } __finally { pGDC->EndUpdate(); pView->EndUpdate(); } } //--------------------------------------------------------------------------- void __fastcall TFRAMEUtisStatusList::UpdateList() { RefreshList(); } //--------------------------------------------------------------------------- void __fastcall TFRAMEUtisStatusList::RefreshList() { TcxGridTableView *pView; TcxGridDataController *pGDC; pView= (TcxGridTableView *)TvUtisRun; pGDC = (TcxGridDataController *)pView->DataController; try { pView->BeginUpdate(); pGDC->BeginUpdate(); if (pGDC->RecordCount == 3) { pGDC->Values[0][ColUtisRunCnt->Index] = FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[0]); pGDC->Values[0][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[0]; pGDC->Values[1][ColUtisRunCnt->Index] = FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[1]); pGDC->Values[1][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[1]; pGDC->Values[2][ColUtisRunCnt->Index] = "-";//FormatFloat("##,##0", ItsUtisManager->UtisRun.RunCnt[2]); pGDC->Values[2][ColUtisRunStatusCd->Index] = ItsUtisManager->UtisRun.Status[2]; } } __finally { pGDC->EndUpdate(); pView->EndUpdate(); } pView= (TcxGridTableView *)TvUtisRse; pGDC = (TcxGridDataController *)pView->DataController; try { pView->BeginUpdate(); pGDC->BeginUpdate(); if (pGDC->RecordCount == 3) { pGDC->Values[0][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[0]); pGDC->Values[1][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[1]); pGDC->Values[2][ColRseCnt->Index] = FormatFloat("##,##0 ", ItsUtisManager->RseRun[0] - ItsUtisManager->RseRun[1]); } } __finally { pGDC->EndUpdate(); pView->EndUpdate(); } } //--------------------------------------------------------------------------- void __fastcall TFRAMEUtisStatusList::TvUtisRunCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone) { //OptionsSelection.InvertSelect = False //OptionsView.FocusRect = False if (AViewInfo->GridRecord->Selected) { //ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentColor(); //ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor(); if (AViewInfo->GridRecord->Index % 2 == 0) { ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentEvenColor(); ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor(); } else { ACanvas->Brush->Color = Sender->LookAndFeelPainter->DefaultContentOddColor(); ACanvas->Font->Color = Sender->LookAndFeelPainter->DefaultContentTextColor(); } } else { } } //--------------------------------------------------------------------------- void __fastcall TFRAMEUtisStatusList::ColUtisRunStatusCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone) { if (AViewInfo->GridRecord->RecordIndex < 0) return; Graphics::TBitmap *pBmp = NULL; pBmp = ImgStop->Picture->Bitmap; if (!VarIsNull(AViewInfo->GridRecord->DisplayTexts[ColUtisRunStatusCd->Index])) { String sCode = AViewInfo->GridRecord->DisplayTexts[ColUtisRunStatusCd->Index]; if (sCode == "0") pBmp = ImgStop->Picture->Bitmap; else if (sCode == "1") pBmp = ImgRun->Picture->Bitmap; else if (sCode == "2") pBmp = ImgModule->Picture->Bitmap; } if (!pBmp) return; pBmp->Transparent = true; int nW, nH; nW = nH = 21; try { TColor bBrush = ACanvas->Brush->Color; if (AViewInfo->GridRecord->Selected) { if (AViewInfo->GridRecord->Index % 2 == 0) { bBrush = Sender->LookAndFeelPainter->DefaultContentEvenColor(); } else { bBrush = Sender->LookAndFeelPainter->DefaultContentOddColor(); } } ACanvas->Brush->Color = bBrush; TRect rc; TRect rcOrg = AViewInfo->Bounds; ACanvas->FillRect(rcOrg); nW = rcOrg.Bottom - rcOrg.Top - 2; rc.Top = rcOrg.Top+1; rc.Bottom = rcOrg.Bottom - 1; rc.Left = rcOrg.Left + (rcOrg.Width() - nW) / 2; rc.Right = rc.Left + nW; ACanvas->Canvas->StretchDraw(rc, pBmp); //ACanvas->Draw(AViewInfo->ContentBounds.Left, AViewInfo->ContentBounds.Top, pBmp); ADone = true; } catch(...) {} } //--------------------------------------------------------------------------- void __fastcall TFRAMEUtisStatusList::ColRseCntCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone) { if (AViewInfo->GridRecord->RecordIndex < 0) return; if (VarIsNull(AViewInfo->Value)) return; try { int nIdx = AViewInfo->GridRecord->RecordIndex; if (nIdx == 2 || nIdx == 4) { ACanvas->Font->Color = clRed; } else { ACanvas->Font->Color = clBlue; } } catch(...) {} } //---------------------------------------------------------------------------