3. Архангельский А.Я. - Программирование в C++ Builder, 7 изд,
4. Хелен Борри Firebird: руководство разработчика баз данных - БХВ-Петербург <http://www.ozon.ru/context/detail/id/1098685/>
5. М.П. Малыхина: Базы данных. Основы, проектирование,
использование - БХВ-Петербург
<http://www.ozon.ru/context/detail/id/1098685/>
Приложение А
Файл datamodule.h
//---------------------------------------------------------------------------
#ifndef datamoduleH
#define datamoduleH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <IBCustomDataSet.hpp>
#include <IBDatabase.hpp>
#include <IBTable.hpp>
#include <IBQuery.hpp>
//---------------------------------------------------------------------------TData : public TDataModule
{
__published: // IDE-managed Components*IBDatabase1;*IBTransaction1;*DISTRICTDATASOURCE;*DistrictTable;*DistrictTableIDDISTRICT;*DistrictTableNAMEDISTRICT;*ProgressTable;*ProgressTableIDPROGRESS;*ProgressTableIDCLIENT;*ProgressTableIDDECLARATION;*ProgressTableSENT;*ProgressTableRECEIVED;*ProgressTableIDFUND;*ProgressDataSource;*FundsTable;*FundsDataSource;*ClientTable;*ClientDataSource;*TaxationSystemTable;*TaxationSystemDataSource;*DeadlinesTable;*DeadlinesDataSource;
*ClientTableIDCLIENT;*ClientTableINN;*ClientTableADDRESS;*ClientTableIDTAXATIONSYSTEM;*ClientTableNAMECLIENT;*FundsTableNAMEFUND;*FundsTableINN;*FundsTableADDRESS;*DeadlinesTableIDDECLARATION;*DeadlinesTableIDTERM;*DeadlinesTableTERM;*DeadlinesTableQUARTER;*DeadlinesTableREPORTYEAR;*IBQuery1;*DataSource1;*DeclarationDataSource;*Declaration_table;*Declaration_tableIDDECLARATION;*Declaration_tableNAMEDECLARATION;*Declaration_tableIDFUND;*Declaration_tableID_DEADLINE;*Int_ReportsDataSource;*Int_Reports_Table;*Int_Reports_TableNAMEOPERATION;*Int_Reports_TableIDOPERATION;*Int_Reports_TableNAMEMONTH;*Int_Reports_TableREPORTYEAR;*Int_Reports_TableDONE;*Int_Reports_TableRESPONSIBLE;*ProgressTablelookup_client;*ProgressTableID_DISTRICT;*DistrictTableDIST_LINK_ID;*IBQuery2;*DataSource2;*ProgressTablelookup_decl;*IBQuery3;*DataSource3;*DeadlinesTableField1;*IBQuery4;*DataSource4;*ClientTableDISTRICT_ID;*ClientTableField1;*OperationDataSource;*Operation_Table;
*ResponsibleDataSource;*Responsible_Table;*Operation_TableID_OPERATION;*Operation_TableOPERATION_NAME;*Responsible_TableRESPONSIBLE_ID;*Responsible_TableRESPONSIBLE_NAME;*TaxationSystemTableIDTAXATIONSYSTEM;*TaxationSystemTableNAMETAXATIONSYSTEM;*IBQuery5;*DataSource5;*Int_Reports_TableLookup_operation;*Int_Reports_TableCLIENT_NAME;*Int_Reports_Tablelookup_client;*IBQuery6;*DataSource6;*Int_Reports_TableID_RESPONSIBLE;*Int_Reports_Tableloojup_responsible;*FundsTableID_DECL;*IBQuery7;*DataSource7;*ClientTableDISTRICT;*ProgressTableDONE;*IBQuery8;*DataSource8;*ProgressTableID_TAX_SYSTEM;*ProgressTablelookup_tax_system;*Int_Reports_TableOPERETION_DICT_ID;*Sub_Rep_Table;*Sub_RepDataSource;*Sub_Rep_TableIDSUBMISSIONREPORTS;*Sub_Rep_TableIDDECLARATION;*Sub_Rep_TableIDCLIENT;*Sub_Rep_TableIDFUND;*Sub_Rep_TableKINDSUBMISSIONREPORTS;*IBQuery9;*DataSource9;*IBQuery10;*DataSource10;*ProgressTableID_SUB_REP;*ProgressTablelookup_sub_rep;*ProgressTablelookup_fund;*ClientTableID_SUB_REP;: //
User declarations: // User declarations
__fastcall TData(TComponent* Owner);
};
//---------------------------------------------------------------------------PACKAGE TData *Data;
//---------------------------------------------------------------------------
#endif
Файл datamodule.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "datamodule.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"*Data;
//---------------------------------------------------------------------------
__fastcall TData::TData(TComponent* Owner)
: TDataModule(Owner)
{
}
//---------------------------------------------------------------------------
Файл Project1.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
//#pragma hdrstop
//---------------------------------------------------------------------------("Unit1.cpp", MainForm);("Unit2.cpp", Dictionaries);("Unit3.cpp", InternalReportsForm);("datamodule.cpp", Data); /* TDataModule: File Type */("Unit4.cpp", DeadlineDictionaryForm);("Unit5.cpp", FundsDeclForm);
//---------------------------------------------------------------------------WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
{
>Initialize();>CreateForm(__classid(TData), &Data);>CreateForm(__classid(TMainForm), &MainForm);>CreateForm(__classid(TDictionaries), &Dictionaries);>CreateForm(__classid(TInternalReportsForm), &InternalReportsForm);>CreateForm(__classid(TDeadlineDictionaryForm), &DeadlineDictionaryForm);>CreateForm(__classid(TFundsDeclForm), &FundsDeclForm);>Run();
}(Exception &exception)
{>ShowException(&exception);
}(...)
{
{Exception("");
}(Exception &exception)
{>ShowException(&exception);
}
}0;
}
//---------------------------------------------------------------------------
Файл Unit1.h
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBGrids.hpp>
#include <ExtCtrls.hpp>
#include <Grids.hpp>
#include <IBCustomDataSet.hpp>
#include <IBDatabase.hpp>
#include <IBTable.hpp>
#include <DBCtrls.hpp>
#include <Menus.hpp>
#include <IBQuery.hpp>
//---------------------------------------------------------------------------TMainForm : public TForm
{
__published: // IDE-managed Components*DBGrid1;*RadioGroup1;*DBGrid2;*DBNavigator1;*MainMenu2;*N1;*N3;*N4;*N6;*N8;*N2;*DBCheckBox4;*DBCheckBox1;*DBCheckBox2;*N9;*N10;*IBQuery1;*DataSource1;*Label1;*Label2;*DBGrid3;*Label3;*N11;*N5;*N7;__fastcall N2Click(TObject *Sender);__fastcall N3Click(TObject *Sender);__fastcall N8Click(TObject *Sender);__fastcall N4Click(TObject *Sender);__fastcall N5Click(TObject *Sender);__fastcall N6Click(TObject *Sender);
__fastcall N7Click(TObject *Sender);__fastcall Button1Click(TObject *Sender);
__fastcall FormCreate(TObject *Sender);__fastcall DBGrid2DrawColumnCell(TObject *Sender,TRect &Rect, int DataCol, TColumn *Column,State);__fastcall RadioGroup1Click(TObject *Sender);__fastcall N9Click(TObject *Sender);__fastcall N10Click(TObject *Sender);__fastcall N11Click(TObject *Sender);__fastcall DBGrid3DrawColumnCell(TObject *Sender,TRect &Rect, int DataCol, TColumn *Column,State);: // User declarations: // User declarations
__fastcall TMainForm(TComponent* Owner);
};
//---------------------------------------------------------------------------PACKAGE TMainForm *MainForm;
//---------------------------------------------------------------------------
#endif
Файл Unit1.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "Unit2.h"
#include "Unit3.h"
#include "datamodule.h"
#include "Unit4.h"
#include "Unit5.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"*MainForm;funds_mas[100] = {0};
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
__fastcall TMainForm::N2Click(TObject *Sender)
{>Show();
}
//---------------------------------------------------------------------------__fastcall TMainForm::N3Click(TObject *Sender)
{>DictionariesDataSource->DataSet=Data->ClientTable;>Label1->Caption="Клиенты";>Show();
}
//---------------------------------------------------------------------------
__fastcall TMainForm::N8Click(TObject *Sender)
{>DictionariesDataSource->DataSet=Data->DistrictTable ;>Label1->Caption="Районы";>Show();
}
//---------------------------------------------------------------------------
__fastcall TMainForm::N4Click(TObject *Sender)
{>DictionariesDataSource->DataSet=Data->TaxationSystemTable ;>Label1->Caption="Система налогообложения";>Show();
}
//---------------------------------------------------------------------------
__fastcall TMainForm::N5Click(TObject *Sender)
{>Close();
}
//---------------------------------------------------------------------------
__fastcall TMainForm::N6Click(TObject *Sender)
{>Show();
}
//---------------------------------------------------------------------------
__fastcall TMainForm::N7Click(TObject *Sender)
{>DictionariesDataSource->DataSet=Data->Sub_Rep_Table ;>Label1->Caption="Виды сдачи отчетности";>Show();
}
//---------------------------------------------------------------------------
__fastcall TMainForm::Button1Click(TObject *Sender)
{>Show();
}
//---------------------------------------------------------------------------
__fastcall TMainForm::FormCreate(TObject *Sender)
{CurrentDate;=Now();short Year;short Month;short Day;quarter=0;i=0;>FundsTable->First();->Items->Clear();(!Data->FundsTable->Eof)
{->Items->Add(Data->FundsTable->FieldByName("NAMEFUND")->AsString);_mas[i]=Data->FundsTable->FieldByName("ID_DECL")->AsInteger;++;>FundsTable->Next();
}.DecodeDate(&Year, &Month, &Day);(( Month>=1)&&(Month<=3))=1;(( Month>=4)&&(Month<=6))=2;(( Month>=7)&&(Month<=9))=3;(( Month>=10)&&(Month<=12))=4;
>Label2->Caption="Квартал: " +
IntToStr(quarter);>Label1->Caption="Год: " +
IntToStr(Year);>DeadlinesTable->First();term="";->SQL->Clear();->SQL->Add("SELECT
declaration.namedeclaration, deadlines.term from deadlines, declaration where
(deadlines.iddeclaration=declaration.id_deadline) \(reportyear= " +
IntToStr(Year) + ") \(quarter= " + IntToStr(quarter)+ ")")
;->Active=true;
}
//---------------------------------------------------------------------------
__fastcall TMainForm::DBGrid2DrawColumnCell(TObject *Sender,TRect &Rect, int DataCol, TColumn *Column,State)
{((Column->FieldName=="SENT")||(Column->FieldName=="DONE")||(Column->FieldName=="RECEIVED"))->Canvas->Font->Color= clWhite;
(Data->ProgressTable->FieldByName("DONE")->AsString == "1" && Column->FieldName=="DONE")
{->Canvas->Font->Color= clMoneyGreen;->Canvas->Brush->Color= clMoneyGreen;
}->DefaultDrawColumnCell(Rect, DataCol, Column, State);
(Data->ProgressTable->FieldByName("SENT")->AsString == "1" && Column->FieldName=="SENT")
{->Canvas->Font->Color= clGreen ;->Canvas->Brush->Color= clGreen;
}->DefaultDrawColumnCell(Rect, DataCol, Column, State);
(Data->ProgressTable->FieldByName("RECEIVED")->AsString == "1" && Column->FieldName=="RECEIVED")
{->Canvas->Font->Color= clLime
;->Canvas->Brush->Color= clLime;
}->DefaultDrawColumnCell(Rect, DataCol, Column, State);
}
//---------------------------------------------------------------------------
__fastcall TMainForm::RadioGroup1Click(TObject *Sender)
{
//if(RadioGroup1->ItemIndex==0)
{
>ProgressTable->Filter="";>ProgressTable->Filter="IDFUND = " + IntToStr(funds_mas[RadioGroup1->ItemIndex]);>ProgressTable->Filtered=true;
}
}
//---------------------------------------------------------------------------
__fastcall TMainForm::N9Click(TObject *Sender)
{>DictionariesDataSource->DataSet=Data->Responsible_Table ;>Label1->Caption="Исполнители";>Show();
}
//---------------------------------------------------------------------------
__fastcall TMainForm::N10Click(TObject *Sender)
{>DictionariesDataSource->DataSet=Data->Operation_Table ;>Label1->Caption="Операции";>Show();
}
//---------------------------------------------------------------------------
__fastcall TMainForm::N11Click(TObject *Sender)
{>Show();
}
//---------------------------------------------------------------------------
__fastcall TMainForm::DBGrid3DrawColumnCell(TObject *Sender,TRect &Rect, int DataCol, TColumn *Column,
State)
{CurrentDate;=Now();(IBQuery1->FieldByName("TERM")->AsDateTime <= (CurrentDate+10))
{->Canvas->Brush->Color= clRed;->DefaultDrawColumnCell(Rect, DataCol, Column, State);
}
}
//---------------------------------------------------------------------------
Файл Unit2.h
//---------------------------------------------------------------------------
#ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBCtrls.hpp>
#include <DBGrids.hpp>
#include <ExtCtrls.hpp>
#include <Grids.hpp>
#include <IBCustomDataSet.hpp>
#include <IBTable.hpp>
//---------------------------------------------------------------------------TDictionaries
: public TForm
{
__published: // IDE-managed Components*IBTable1;*DataSource1;*IBTable1IDCLIENT;
*IBTable1NAMECLIENT;*IBTable1INN;*IBTable1ADDRESS;*IBTable1IDTAXATIONSYSTEM;*DBNavigator1;
*DictionariesDataSource;*Label1;*DictGrid;: // User declarations
: // User declarations
__fastcall TDictionaries(TComponent* Owner);
};
//---------------------------------------------------------------------------PACKAGE TDictionaries *Dictionaries;
//---------------------------------------------------------------------------
#endif
Файл Unit2.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit2.h"
#include "Unit1.h"
#include "datamodule.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"*Dictionaries;
//---------------------------------------------------------------------------
__fastcall TDictionaries::TDictionaries(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
Файл Unit3.h
//---------------------------------------------------------------------------
#ifndef Unit3H
#define Unit3H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBGrids.hpp>
#include <Grids.hpp>
#include <IBCustomDataSet.hpp>
#include <IBTable.hpp>
#include <IBQuery.hpp>
#include <DBCtrls.hpp>
#include <ExtCtrls.hpp>
#include "sLabel.hpp"
//---------------------------------------------------------------------------TInternalReportsForm : public TForm
{
__published: // IDE-managed Components*InternalOperationGrid;*DBNavigator1;*DBCheckBox1;*ComboBox1;*ComboBox2;*ComboBox3;*sLabel1;*sLabel2;*sLabel3;*Button1;__fastcall InternalOperationGridDrawColumnCell(*Sender, const TRect &Rect, int DataCol, TColumn *Column,State);__fastcall ComboBox3Change(TObject *Sender);__fastcall FormCreate(TObject *Sender);__fastcall ComboBox1Change(TObject *Sender);__fastcall Button1Click(TObject *Sender);__fastcall ComboBox2Change(TObject *Sender);
: // User declarations: // User declarations
__fastcall TInternalReportsForm(TComponent* Owner);
};
//---------------------------------------------------------------------------PACKAGE
TInternalReportsForm *InternalReportsForm;
//---------------------------------------------------------------------------
#endif
Файл Unit3.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit3.h"
#include "datamodule.h"
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "sLabel"
#pragma resource "*.dfm"*InternalReportsForm;
//---------------------------------------------------------------------------
__fastcall TInternalReportsForm::TInternalReportsForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
__fastcall TInternalReportsForm::InternalOperationGridDrawColumnCell(*Sender, const TRect &Rect, int DataCol, TColumn *Column,State)
{( Data->Int_Reports_Table->FieldByName("DONE")->AsString == "1" )
{>InternalOperationGrid->Canvas->Brush->Color = clMoneyGreen ;>InternalOperationGrid->DefaultDrawColumnCell(Rect, DataCol, Column, State);
}
}
//---------------------------------------------------------------------------__fastcall TInternalReportsForm::ComboBox3Change(TObject *Sender)
{tlo;<< loPartialKey,loCaseInsensitive;>Int_Reports_Table->Filtered=false;>IBQuery1->Locate ("NAMECLIENT", ComboBox3->Text, tlo );n3=Data->IBQuery1->Fields->FieldByName("IDCLIENT")->AsInteger;>Int_Reports_Table->Filter="CLIENT_NAME = " + IntToStr(n3) ;
>Int_Reports_Table->Filtered=true;
}
//---------------------------------------------------------------------------
__fastcall TInternalReportsForm::FormCreate(TObject *Sender)
{->Clear();
>ClientTable->First();(!Data->ClientTable->Eof)
{->Items->Add(Data->ClientTable->Fields->FieldByName("NAMECLIENT")->AsString);>ClientTable->Next();
}->Clear();>Responsible_Table->First();(!Data->Responsible_Table->Eof)
{->Items->Add(Data->Responsible_Table->Fields->FieldByName("Responsible_NAME")->AsString);>Responsible_Table->Next();