//---------------------------------------------------------------------------

#ifndef VDSS020MFH
#define VDSS020MFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <jpeg.hpp>
#include <Buttons.hpp>
#include <ImgList.hpp>
#include <Graphics.hpp>
#include <DB.hpp>
#include <DBClient.hpp>
#include <Provider.hpp>
#include <Menus.hpp>
#include <ComCtrls.hpp>
#include <ADODB.hpp>

//---------------------------------------------------------------------------
#include "DataTypesF.h"
#include "PlugInChartF.h"
#include "CDSAtrdF.h"
#include "cxButtons.hpp"
#include "cxClasses.hpp"
#include "cxContainer.hpp"
#include "cxControls.hpp"
#include "cxCustomData.hpp"
#include "cxData.hpp"
#include "cxDataStorage.hpp"
#include "cxDBData.hpp"
#include "cxEdit.hpp"
#include "cxFilter.hpp"
#include "cxGraphics.hpp"
#include "cxGrid.hpp"
#include "cxGridBandedTableView.hpp"
#include "cxGridCustomTableView.hpp"
#include "cxGridCustomView.hpp"
#include "cxGridDBBandedTableView.hpp"
#include "cxGridLevel.hpp"
#include "cxGridTableView.hpp"
#include "cxLabel.hpp"
#include "cxLookAndFeelPainters.hpp"
#include "cxLookAndFeels.hpp"
#include "cxPC.hpp"
#include "cxPCdxBarPopupMenu.hpp"
#include "cxSpinEdit.hpp"
#include "cxSplitter.hpp"
#include "cxStyles.hpp"
#include "cxTextEdit.hpp"
#include "dxSkinBlack.hpp"
#include "dxSkinBlue.hpp"
#include "dxSkinsCore.hpp"
#include "dxSkinscxPCPainter.hpp"
#include "cxCheckBox.hpp"
#include "dxSkinMcSkin.hpp"

//---------------------------------------------------------------------------
#define  MAX_CHART      3
//---------------------------------------------------------------------------
class TVDSS020M : public TForm
{
__published:	// IDE-managed Components
	TTimer *TmrRefresh;
	TShape *ShpList;
    TcxPageControl *PgQuery;
    TcxTabSheet *TsDay;
    TcxTabSheet *TsMon;
    TcxTabSheet *TsYear;
    TcxButton *BtnSearch;
    TcxButton *BtnGraph;
    TcxButton *BtnPrint;
    TcxButton *BtnExlSave;
    TcxPageControl *PgList;
    TcxTabSheet *TsListDay;
    TcxTabSheet *TsListMon;
    TcxTabSheet *TsListYear;
    TDateTimePicker *DtDay;
    TDateTimePicker *DtMon;
    TDateTimePicker *DtYear;
    TcxLabel *Lbl2;
    TcxLabel *cxLabel1;
    TcxLabel *cxLabel2;
    TPanel *PnlDayGraph;
    TPanel *PnlMonGraph;
    TPanel *PnlYearGraph;
    TcxSplitter *SplDay;
    TcxSplitter *SplMon;
    TcxSplitter *SplYear;
    TLabel *LblRptTitle;
    TLabel *LblQryTm;
    TLabel *LblQryDay;
    TLabel *LblQryYear;
    TShape *ShpTitle;
    TcxButton *BtnClose;
    TLabel *LblCaption;
    TImageList *LimgTmp;
    TADOQuery *ADOD;
    TDataSource *DSD;
    TADOQuery *ADOM;
    TDataSource *DSM;
    TADOQuery *ADOY;
    TDataSource *DSY;
    TcxGrid *CxMon;
    TcxGridDBBandedTableView *TvMon;
    TcxGridDBBandedColumn *vMonColumnNo;
    TcxGridDBBandedColumn *vMonColumnTot;
    TcxGridDBBandedColumn *vMonColumnLane;
    TcxGridDBBandedColumn *vMonColumn1;
    TcxGridDBBandedColumn *vMonColumn2;
    TcxGridDBBandedColumn *vMonColumn3;
    TcxGridDBBandedColumn *vMonColumn4;
    TcxGridDBBandedColumn *vMonColumn5;
    TcxGridDBBandedColumn *vMonColumn6;
    TcxGridDBBandedColumn *vMonColumn7;
    TcxGridDBBandedColumn *vMonColumn8;
    TcxGridDBBandedColumn *vMonColumn9;
    TcxGridDBBandedColumn *vMonColumn10;
    TcxGridDBBandedColumn *vMonColumn11;
    TcxGridDBBandedColumn *vMonColumn12;
    TcxGridDBBandedColumn *vMonColumn13;
    TcxGridDBBandedColumn *vMonColumn14;
    TcxGridDBBandedColumn *vMonColumn15;
    TcxGridDBBandedColumn *vMonColumn16;
    TcxGridDBBandedColumn *vMonColumn17;
    TcxGridDBBandedColumn *vMonColumn18;
    TcxGridDBBandedColumn *vMonColumn19;
    TcxGridDBBandedColumn *vMonColumn20;
    TcxGridDBBandedColumn *vMonColumn21;
    TcxGridDBBandedColumn *vMonColumn22;
    TcxGridDBBandedColumn *vMonColumn23;
    TcxGridDBBandedColumn *vMonColumn24;
    TcxGridDBBandedColumn *vMonColumn25;
    TcxGridDBBandedColumn *vMonColumn26;
    TcxGridDBBandedColumn *vMonColumn27;
    TcxGridDBBandedColumn *vMonColumn28;
    TcxGridDBBandedColumn *vMonColumn29;
    TcxGridDBBandedColumn *vMonColumn30;
    TcxGridDBBandedColumn *vMonColumn31;
    TcxGridDBBandedColumn *vMonColumnAvg;
    TcxGridLevel *GlMon;
    TcxGrid *CxDay;
    TcxGridDBBandedTableView *TvDay;
    TcxGridDBBandedColumn *vDayColumnNo;
    TcxGridDBBandedColumn *vDayColumnTot;
    TcxGridDBBandedColumn *vDayColumnLane;
    TcxGridDBBandedColumn *Col00;
    TcxGridDBBandedColumn *Col01;
    TcxGridDBBandedColumn *Col02;
    TcxGridDBBandedColumn *Col03;
    TcxGridDBBandedColumn *Col04;
    TcxGridDBBandedColumn *Col05;
    TcxGridDBBandedColumn *Col06;
    TcxGridDBBandedColumn *Col07;
    TcxGridDBBandedColumn *Col08;
    TcxGridDBBandedColumn *Col09;
    TcxGridDBBandedColumn *Col10;
    TcxGridDBBandedColumn *Col11;
    TcxGridDBBandedColumn *Col12;
    TcxGridDBBandedColumn *Col13;
    TcxGridDBBandedColumn *Col14;
    TcxGridDBBandedColumn *Col15;
    TcxGridDBBandedColumn *Col16;
    TcxGridDBBandedColumn *Col17;
    TcxGridDBBandedColumn *Col18;
    TcxGridDBBandedColumn *Col19;
    TcxGridDBBandedColumn *Col20;
    TcxGridDBBandedColumn *Col21;
    TcxGridDBBandedColumn *Col22;
    TcxGridDBBandedColumn *Col23;
    TcxGridDBBandedColumn *vDayColumnAvg;
    TcxGridLevel *GlDay;
    TComboBox *CbLinkLevel;
    TComboBox *CbStatCfg;
    TLabel *LblRecordsTm;
    TDateTimePicker *DtStTime;
    TDateTimePicker *DtEdTime;
    TcxLabel *cxLabel3;
    TLabel *LblRecordsDay;
    TLabel *LblRecordsYear;
    TcxGridDBBandedColumn *TvDayColumn4;
    TcxGridDBBandedColumn *TvMonColumn4;
    TcxStyleRepository *cxStyleRepository1;
    TcxStyle *cxStyle1;
    TcxStyle *cxStyle2;
    TcxCheckBox *ChkExpand;
    TcxCheckBox *ChkExpand2;
    TcxGrid *CxYear;
    TcxGridDBBandedTableView *TvYear;
    TcxGridDBBandedColumn *cxGridDBBandedColumn1;
    TcxGridDBBandedColumn *cxGridDBBandedColumn2;
    TcxGridDBBandedColumn *vYearColumnNo;
    TcxGridDBBandedColumn *cxGridDBBandedColumn4;
    TcxGridDBBandedColumn *vYearColumnLane;
    TcxGridDBBandedColumn *cxGridDBBandedColumn6;
    TcxGridDBBandedColumn *vYearColumnAvg;
    TcxGridDBBandedColumn *cxGridDBBandedColumn8;
    TcxGridDBBandedColumn *cxGridDBBandedColumn9;
    TcxGridDBBandedColumn *cxGridDBBandedColumn10;
    TcxGridDBBandedColumn *cxGridDBBandedColumn11;
    TcxGridDBBandedColumn *cxGridDBBandedColumn12;
    TcxGridDBBandedColumn *cxGridDBBandedColumn13;
    TcxGridDBBandedColumn *cxGridDBBandedColumn14;
    TcxGridDBBandedColumn *cxGridDBBandedColumn15;
    TcxGridDBBandedColumn *cxGridDBBandedColumn16;
    TcxGridDBBandedColumn *cxGridDBBandedColumn17;
    TcxGridDBBandedColumn *cxGridDBBandedColumn18;
    TcxGridDBBandedColumn *vYearColumn12;
    TcxGridDBBandedColumn *TvYearColumn1;
    TcxGridLevel *GlYear;
    TcxCheckBox *ChkExpand3;
	void __fastcall FormCreate(TObject *Sender);
	void __fastcall FormShow(TObject *Sender);
	void __fastcall TmrRefreshTimer(TObject *Sender);
	void __fastcall BtnSearchClick(TObject *Sender);
    void __fastcall BtnGraphClick(TObject *Sender);
    void __fastcall BtnPrintClick(TObject *Sender);
    void __fastcall BtnExlSaveClick(TObject *Sender);
    void __fastcall PgQueryChange(TObject *Sender);
    void __fastcall TvListDataControllerSummaryFooterSummaryItemsSummary(TcxDataSummaryItems *ASender, TcxSummaryEventArguments &Arguments,
          TcxSummaryEventOutArguments &OutArguments);
    void __fastcall TvListDataControllerSummaryDefaultGroupSummaryItemsSummary(TcxDataSummaryItems *ASender, TcxSummaryEventArguments &Arguments,
          TcxSummaryEventOutArguments &OutArguments);
    void __fastcall BtnCloseClick(TObject *Sender);
    void __fastcall vDayColumnCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
          bool &ADone);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall TvDayTcxGridDBDataControllerTcxDataSummaryFooterSummaryItems0GetText(TcxDataSummaryItem *Sender, const Variant &AValue,
          bool AIsFooter, UnicodeString &AText);
    void __fastcall TvDayDataControllerSummaryFooterSummaryItemsSummary(TcxDataSummaryItems *ASender, TcxSummaryEventArguments &Arguments,
          TcxSummaryEventOutArguments &OutArguments);
    void __fastcall TvDayDataControllerSummaryDefaultGroupSummaryItemsSummary(TcxDataSummaryItems *ASender, TcxSummaryEventArguments &Arguments,
          TcxSummaryEventOutArguments &OutArguments);
    void __fastcall TvDayTcxGridDBDataControllerTcxDataSummaryDefaultGroupSummaryItems0GetText(TcxDataSummaryItem *Sender,
          const Variant &AValue, bool AIsFooter, UnicodeString &AText);
    void __fastcall ChkExpandClick(TObject *Sender);
    void __fastcall ChkExpand2Click(TObject *Sender);
    void __fastcall TvMonTcxGridDBDataControllerTcxDataSummaryFooterSummaryItems0GetText(TcxDataSummaryItem *Sender, const Variant &AValue,
          bool AIsFooter, UnicodeString &AText);
    void __fastcall TvMonTcxGridDBDataControllerTcxDataSummaryDefaultGroupSummaryItems0GetText(TcxDataSummaryItem *Sender,
          const Variant &AValue, bool AIsFooter, UnicodeString &AText);
    void __fastcall ChkExpand3Click(TObject *Sender);
    void __fastcall TvYearTcxGridDBDataControllerTcxDataSummaryFooterSummaryItems0GetText(TcxDataSummaryItem *Sender, const Variant &AValue,
          bool AIsFooter, UnicodeString &AText);
    void __fastcall TvYearTcxGridDBDataControllerTcxDataSummaryDefaultGroupSummaryItems0GetText(TcxDataSummaryItem *Sender,
          const Variant &AValue, bool AIsFooter, UnicodeString &AText);
    void __fastcall TvMonDataControllerSummaryDefaultGroupSummaryItemsSummary(TcxDataSummaryItems *ASender, TcxSummaryEventArguments &Arguments,
          TcxSummaryEventOutArguments &OutArguments);
    void __fastcall TvYearDataControllerSummaryDefaultGroupSummaryItemsSummary(TcxDataSummaryItems *ASender, TcxSummaryEventArguments &Arguments,
          TcxSummaryEventOutArguments &OutArguments);
    void __fastcall TvMonDataControllerSummaryFooterSummaryItemsSummary(TcxDataSummaryItems *ASender, TcxSummaryEventArguments &Arguments,
          TcxSummaryEventOutArguments &OutArguments);
    void __fastcall TvYearDataControllerSummaryFooterSummaryItemsSummary(TcxDataSummaryItems *ASender, TcxSummaryEventArguments &Arguments,
          TcxSummaryEventOutArguments &OutArguments);
private:	// User declarations

    TPlugInChart    *m_pFrmChart[MAX_CHART];
    String          m_sFooterRight;
    String          m_sLinkLevel;
    String          FTitle;
	String          FStDateTime;
	String          FEdDateTime;

    TItsAtrdManager   *MyItsAtrdManager;

public:		// User declarations
	__fastcall TVDSS020M(TComponent* Owner);

    void __fastcall LoadLocalSkin();
    void __fastcall LoadConfig();
	void __fastcall CommClose();
    void __fastcall FormInit();

	void __fastcall RefreshData();

    void __fastcall DispDayStatistics();
    void __fastcall DispMonthStatistics();
    void __fastcall DispYearStatistics();
    void __fastcall ShowRecordCount(int nRecCnt);

    void __fastcall DrawChart(String sTitle);
};
//---------------------------------------------------------------------------
extern PACKAGE TVDSS020M *VDSS020M;
//---------------------------------------------------------------------------
#endif
