Смекни!
smekni.com

Разработка статистической отчетности в системе АСУ ГГУ (стр. 3 из 3)

TButton *SearchButton;

AsuButtonExit *AsuButtonExit1;

StatProvodkiTable *StatProvodkiTable1;

AsuQuery *AsuQuery1;

void __fastcall SearchButtonClick (TObject *Sender);

void __fastcall AsuButtonExit1Click (TObject *Sender);

private: // User declarations

public: // User declarations

__fastcall TFSStatProvodki (TComponent* Owner);

};

// –

extern PACKAGE TFSStatProvodki *FSStatProvodki;

// –

#endif

Программа USStatProvodkiForm.cpp

// –

#include <vcl.h>

#pragma hdrstop

#include «AsuObj.h»

#include «USStatProvodkiForm.h»

// –

#pragma package (smart_init)

#pragma link «ASUBUTEX»

#pragma link «AsuDBGrd»

#pragma link «AsuTable»

#pragma link «StatProvodkiTable»

#include «SearchWn.h»

#pragma link «ASUQUERY»

#pragma resource «*.dfm»

TFSStatRashod *FSStatProvodki;

// –

__fastcall TFSStatProvodki:TFSStatProvodki (TComponent* Owner)

: AsuForm(Owner)

{

}

// –

void __fastcall TFSStatProvodki: SearchButtonClick (TObject *Sender)

{

SearchForm->searchList = NULL;

SearchForm->gridSearch = StatProvodkiDBGrid;

SearchForm->ShowModal();

}

// –

void __fastcall TFSStatProvodki: AsuButtonExit1Click (TObject *Sender)

{

((AsuForm *) Owner)->Close();

}

// –

Программа USStatProvodkiForm.dfm

object FSStatProvodki: TFSStatProvodki

Left = 194

Top = 9

Width = 544

Height = 501

Caption = 'Проводки'

Color = clBtnFace

Font. Charset = DEFAULT_CHARSET

Font. Color = clWindowText

Font. Height = -11

Font. Name = 'MS Sans Serif'

Font. Style = []

OldCreateOrder = False

PixelsPerInch = 96

TextHeight = 13

object StatProvodkiDBGrid: AsuDBGrid

Tag = 4

Left = 0

Top = 0

Width = 536

Height = 417

Align = alTop

TabOrder = 0

TitleFont. Charset = DEFAULT_CHARSET

TitleFont. Color = clWindowText

TitleFont. Height = -11

TitleFont. Name = 'MS Sans Serif'

TitleFont. Style = []

AsuDataSet = StatProvodkiTable1

Update = True

end

object SearchButton: TButton

Left = 16

Top = 432

Width = 75

Height = 25

Caption = '&Найти'

TabOrder = 1

OnClick = SearchButtonClick

end

object AsuButtonExit1: AsuButtonExit

Left = 144

Top = 432

Width = 75

Height = 25

Cancel = True

Caption = 'Выход'

TabOrder = 2

OnClick = AsuButtonExit1Click

end

object StatProvodkiTable1: StatProvodkiTable

Exclusive = True

TableName = 'StatProvodki'

Left = 232

Top = 72

end

object AsuQuery1: AsuQuery

SQL. Strings = (

'Select CodeProvodki, IdDsf, IdCsf from'

' StatProvodki'

'Order by CodeProvodki')

Left = 184

Top = 104

end

end

Программа StatProvodki.h

// –

#ifndef StatProvodkiTableH

#define StatProvodkiTableH

// –

#include <SysUtils.hpp>

#include <Controls.hpp>

#include <Classes.hpp>

#include <Forms.hpp>

#include «AsuTable.h»

#include <Db.hpp>

#include <DBTables.hpp>

// –

class PACKAGE StatProvodkiTable: public AsuTable

{

private:

char *getNameColumn (AnsiString nameField);

TFieldType getFieldType(AnsiString);

protected:

public:

__fastcall StatProvodkiTable (TComponent* Owner);

__published:

};

// –

#endif

Программа StatProvodki.h

// –

#include <vcl.h>

#pragma hdrstop

#include «AsuObj.h»

#include «StatProvodkiTable.h»

#include «OValKursTp.h»

#pragma link «AsuTable»

#pragma package (smart_init)

// –

// ValidCtrCheck is used to assure that the components created do not have

// any pure virtual functions.

static inline void ValidCtrCheck (StatProvodkiTable *)

{

new StatProvodkiTable(NULL);

}

// –

__fastcall StatProvodkiTable: StatProvodkiTable (TComponent* Owner)

: AsuTable(Owner)

{

TableName = «StatProvodki»;

}

// –

char *StatProvodkiTable:getNameColumn (AnsiString nameField)

{

if (! nameField. AnsiCompareIC («CodeProvodki»)) return «Код проводки»;

if (! nameField. AnsiCompareIC («IdDsf»)) return «Номер дебита»;

if (! nameField. AnsiCompareIC («IdСsf»)) return «Номер кредита»;

return 0;

}

// –

TFieldType StatProvodkiTable:getFieldType (AnsiString nameField)

{

return ftString;

}

namespace StatProvodkiTable

{

void __fastcall PACKAGE Register()

{

TComponentClass classes[1] = {__classid(StatProvodkiTable)};

RegisterComponents («АСУ-таблицы», classes, 0);

}}