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

#ifndef dbDmH
#define dbDmH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>


//USER INCLUDES
#include "Connection.h"
#include <Data.DB.hpp>
#include <Data.FMTBcd.hpp>
#include <Data.SqlExpr.hpp>
#include <Datasnap.DBClient.hpp>
#include <Datasnap.Provider.hpp>
#include <Vcl.ExtCtrls.hpp>


//---------------------------------------------------------------------------
class Tdb : public TDataModule
{
__published:	// IDE-managed Components
	TSQLDataSet *sdsMlekara;
	TDataSetProvider *dspMlekara;
	TClientDataSet *cdsMlekara;
	TDataSource *dsMlekara;
	TIntegerField *sdsMlekaraid;
	TIntegerField *sdsMlekaratemperatura;
	TStringField *sdsMlekaravreme;
	TIntegerField *cdsMlekaraid;
	TIntegerField *cdsMlekaratemperatura;
	TStringField *cdsMlekaravreme;
	TTimer *Timer1;
	TSQLDataSet *SQLDataSet1;
	TIntegerField *IntegerField1;
	TStringField *StringField1;
	TDataSetProvider *DataSetProvider1;
	TClientDataSet *ClientDataSet1;
	TIntegerField *IntegerField3;
	TStringField *StringField2;
	TDataSource *DataSource1;
	TSQLDataSet *SQLDataSet2;
	TIntegerField *IntegerField5;
	TStringField *StringField3;
	TDataSetProvider *DataSetProvider2;
	TClientDataSet *ClientDataSet2;
	TIntegerField *IntegerField7;
	TStringField *StringField4;
	TDataSource *DataSource2;
	TSQLDataSet *SQLDataSet3;
	TIntegerField *IntegerField9;
	TStringField *StringField5;
	TDataSetProvider *DataSetProvider3;
	TClientDataSet *ClientDataSet3;
	TIntegerField *IntegerField11;
	TStringField *StringField6;
	TDataSource *DataSource3;
	TSQLDataSet *SQLDataSet4;
	TIntegerField *IntegerField13;
	TStringField *StringField7;
	TDataSetProvider *DataSetProvider4;
	TClientDataSet *ClientDataSet4;
	TIntegerField *IntegerField15;
	TStringField *StringField8;
	TDataSource *DataSource4;
	TTimer *Timer2;
	TIntegerField *SQLDataSet1C;
	TIntegerField *ClientDataSet1C;
	TIntegerField *SQLDataSet2C;
	TIntegerField *ClientDataSet2C;
	TIntegerField *SQLDataSet3C;
	TIntegerField *ClientDataSet3C;
	TIntegerField *SQLDataSet4C;
	TIntegerField *ClientDataSet4C;
	TFMTBCDField *sdsMlekaratemper;
	TFMTBCDField *cdsMlekaratemper;
	TSQLDataSet *sdsArtikli;
	TDataSetProvider *dspArtikli;
	TClientDataSet *cdsArtikli;
	TDataSource *dsArtikli;
	TIntegerField *sdsArtikliidArtikli;
	TStringField *sdsArtikliArtikal;
	TSingleField *sdsArtikliKolicina;
	TSQLTimeStampField *sdsArtikliod;
	TSQLTimeStampField *sdsArtiklido;
	TIntegerField *cdsArtikliidArtikli;
	TStringField *cdsArtikliArtikal;
	TSingleField *cdsArtikliKolicina;
	TSQLTimeStampField *cdsArtikliod;
	TSQLTimeStampField *cdsArtiklido;
	TSQLDataSet *sdsUredjaj;
	TDataSetProvider *dspUredjaj;
	TClientDataSet *cdsUredjaj;
	TDataSource *dsUredjaj;
	TIntegerField *sdsUredjajid;
	TIntegerField *cdsUredjajid;
	TIntegerField *sdsArtikliid_uredjaja;
	TIntegerField *cdsArtikliid_uredjaja;
	TSQLDataSet *sdsStampa;
	TDataSetProvider *dspStampa;
	TClientDataSet *cdsStampa;
	TDataSource *dsStampa;
	TStringField *sdsStampavreme;
	TStringField *cdsStampavreme;
	TIntegerField *sdsStampat;
	TIntegerField *cdsStampat;
	TSingleField *sdsArtiklizadata_temperatura;
	TSingleField *cdsArtiklizadata_temperatura;
	TSQLQuery *SQLQuery1;
	void __fastcall Timer1Timer(TObject *Sender);
	void __fastcall Timer2Timer(TObject *Sender);
	void __fastcall cdsArtikliAfterPost(TDataSet *DataSet);
	void __fastcall dspArtikliGetTableName(TObject *Sender, TDataSet *DataSet,
          UnicodeString &TableName);
private:	// User declarations
public:		// User declarations
	__fastcall Tdb(TComponent* Owner);
	void __fastcall openMlekaraCds();
	void __fastcall UpisiULogFile(AnsiString filename, AnsiString text, int pocetak);
	void __fastcall LogError(TCustomClientDataSet* DataSet, AnsiString poruka, int posalji_poruku);
	void __fastcall PosaljiPoruku(AnsiString poruka);
	int __fastcall SnimiCDS(TClientDataSet* cds, TSQLConnection* sc);
	void __fastcall NamestiInsert( TCustomClientDataSet *DataSet, AnsiString imeTabele);
	void __fastcall openArtikliCds();
};
//---------------------------------------------------------------------------
extern PACKAGE Tdb *db;
//---------------------------------------------------------------------------
#endif
