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

#ifndef FRAME_FacilityFailFH
#define FRAME_FacilityFailFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Menus.hpp>
#include <ADODB.hpp>
#include <DB.hpp>
#include "CDSCodeF.h"
#include "CDSFacilityCodeF.h"
#include "CDSFacilityF.h"
#include "CDSFacilityFailF.h"
#include "cxButtons.hpp"
#include "cxCalc.hpp"
#include "cxCalendar.hpp"
#include "cxCheckBox.hpp"
#include "cxClasses.hpp"
#include "cxContainer.hpp"
#include "cxControls.hpp"
#include "cxCustomData.hpp"
#include "cxData.hpp"
#include "cxDataStorage.hpp"
#include "cxEdit.hpp"
#include "cxFilter.hpp"
#include "cxGraphics.hpp"
#include "cxGrid.hpp"
#include "cxGridCustomTableView.hpp"
#include "cxGridCustomView.hpp"
#include "cxGridLevel.hpp"
#include "cxGridTableView.hpp"
#include "cxLabel.hpp"
#include "cxLookAndFeelPainters.hpp"
#include "cxLookAndFeels.hpp"
#include "cxStyles.hpp"
#include "cxTextEdit.hpp"
#include "dxSkinBlack.hpp"
#include "dxSkinBlue.hpp"
#include "dxSkinCaramel.hpp"
#include "dxSkinCoffee.hpp"
#include "dxSkinDarkRoom.hpp"
#include "dxSkinDarkSide.hpp"
#include "dxSkinFoggy.hpp"
#include "dxSkinGlassOceans.hpp"
#include "dxSkiniMaginary.hpp"
#include "dxSkinLilian.hpp"
#include "dxSkinLiquidSky.hpp"
#include "dxSkinLondonLiquidSky.hpp"
#include "dxSkinMcSkin.hpp"
#include "dxSkinMoneyTwins.hpp"
#include "dxSkinOffice2007Black.hpp"
#include "dxSkinOffice2007Blue.hpp"
#include "dxSkinOffice2007Green.hpp"
#include "dxSkinOffice2007Pink.hpp"
#include "dxSkinOffice2007Silver.hpp"
#include "dxSkinOffice2010Black.hpp"
#include "dxSkinOffice2010Blue.hpp"
#include "dxSkinOffice2010Silver.hpp"
#include "dxSkinsCore.hpp"
#include "dxSkinscxPCPainter.hpp"
#include "dxSkinSeven.hpp"
#include "dxSkinSharp.hpp"
#include "dxSkinSilver.hpp"
#include "dxSkinStardust.hpp"
#include "cxDropDownEdit.hpp"
#include "cxEditRepositoryItems.hpp"
//---------------------------------------------------------------------------
class TFRAMEFacilityFail : public TFrame
{
__published:	// IDE-managed Components
    TPanel *PnlTop;
    TPanel *PnlBottom;
    TcxButton *BtnExlSave;
    TLabel *LblRecords;
    TcxGrid *CxList;
    TcxGridTableView *TvList;
    TcxGridColumn *Column00;
    TcxGridColumn *Column01;
    TcxGridColumn *Column02;
    TcxGridColumn *Column03;
    TcxGridColumn *Column04;
    TcxGridColumn *Column05;
    TcxGridColumn *Column06;
    TcxGridColumn *Column07;
    TcxGridColumn *Column08;
    TcxGridColumn *Column09;
    TcxGridColumn *Column10;
    TcxGridColumn *Column11;
    TcxGridColumn *Column12;
    TcxGridColumn *Column99;
    TcxGridLevel *GlList;
    TcxButton *BtnEdit;
    TcxButton *BtnInsert;
    TcxButton *BtnDelete;
    TcxButton *BtnApply;
    TcxCheckBox *ChkAutoWidth;
    TcxButton *BtnBestFit;
    TcxLabel *LblFacility;
    TImage *ImgDesc01;
    TcxButton *BtnSearch;
    TcxEditRepository *cxEditRepository1;
    TcxEditRepositoryComboBoxItem *cxEditRepositoryFailOccr;
    TcxEditRepositoryComboBoxItem *cxEditRepositoryFailType;
    void __fastcall TvListDataControllerFilterChanged(TObject *Sender);
    void __fastcall BtnExlSaveClick(TObject *Sender);
    void __fastcall BtnEditClick(TObject *Sender);
    void __fastcall BtnInsertClick(TObject *Sender);
    void __fastcall BtnDeleteClick(TObject *Sender);
    void __fastcall BtnApplyClick(TObject *Sender);
    void __fastcall ChkAutoWidthPropertiesChange(TObject *Sender);
    void __fastcall BtnBestFitClick(TObject *Sender);
    void __fastcall TvListKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
    void __fastcall TvListCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
          bool &ADone);
    void __fastcall ColumnPropertiesValidate(TObject *Sender, Variant &DisplayValue, TCaption &ErrorText, bool &Error);
    void __fastcall Column10GetPropertiesForEdit(TcxCustomGridTableItem *Sender,
          TcxCustomGridRecord *ARecord, TcxCustomEditProperties *&AProperties);
    void __fastcall Column11GetPropertiesForEdit(TcxCustomGridTableItem *Sender,
          TcxCustomGridRecord *ARecord, TcxCustomEditProperties *&AProperties);
    void __fastcall Column10PropertiesChange(TObject *Sender);




private:	// User declarations
    TcxDataController *m_pGDC;
    String             FTitle;
    String             FDefFFA;
    TItsFacility      *FFacility;
    bool               FUpdate;
    int                FKeySeq;
    TItsCode          *FCodeFFA;

    TFacilityCodeManager  *FCode;
    TcxComboBoxProperties *pcxEqpm;
    TcxComboBoxProperties *pcxOccr;
    TcxComboBoxProperties *pcxFail;

    String                 FDefEqpm, FDefEqpmName;
    String                 FEqpmCd, FFailOccr, FFailType;

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

    void __fastcall UpdateCheck();
    void __fastcall UpdateList(TItsFacility *AFacility);
    void __fastcall ChangeEditMode(bool AEdit);

    bool __fastcall GetNewId(String &ANewId);
    bool __fastcall AddObjectItem(TItsFacilityFail *pObj, String AMode);
    bool __fastcall IsUpdate();
    void __fastcall SaveData();

    void __fastcall SetDefaultCodeValue();

	void __fastcall OnCloseQuery(bool &CanClose);
};
//---------------------------------------------------------------------------
//extern PACKAGE TFRAMEFacilityList *FRAMEFacilityList;
//---------------------------------------------------------------------------
#endif

