Файл: Международные и отечественные стандарты языков программирования. Сходство и отличия стандартов.pdf
Добавлен: 28.06.2023
Просмотров: 166
Скачиваний: 3
ProsmForm1->GroupBox7->Visible=true;
ProsmForm1->Top=150;
ProsmForm1->Height=1000;
ProsmForm1->Width=800;
mainclientsform->DataSource1->DataSet->Last();
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
Модуль addsource.cpp
//---------------------------------------------------------------------------
// подключение модулей и задания пространства имен
#include <vcl.h>
#pragma hdrstop
#include "main.h"
#include "add.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
// описание переменных
Taddforms *addforms;
String Fam, Name1, Sec_Name, Dep, Dolg, Tel, Adres;
String Naimen, Proekc, Inter, Comput, Notes,ruk;
String Ucast, Obesp, Razmesh, mob ;
int Mesto, Kodzaka;
String Technika, Organiz, Content, Target, Firma, regim, telotd;
TDateTime Date1, Date2, Date3, Date4, Date5, Date6, Date7, Date8, Cont, Vremya;
int kodzayav, koduch, kodvid, kodzal, kodob, kodsod, otvup, otgot;
//---------------------------------------------------------------------------
__fastcall Taddforms::Taddforms(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Taddforms::FormClose(TObject *Sender, TCloseAction &Action)
{
// закрытие формы
Action=caFree;
}
//---------------------------------------------------------------------------
void __fastcall Taddforms::Button1Click(TObject *Sender)
{
// добавление данных отдел
Fam = Edit1->Text;
Name1 = Edit2->Text;
Sec_Name= Edit3->Text;
Dep = Edit4->Text;
telotd = Edit5->Text;
Tel = Edit6->Text;
mob = Edit7->Text;
ruk = Edit89->Text;
regim =Edit90->Text;
mainclientsform->ADOTable2->Active=true;
mainclientsform->ADOTable2->Insert();
mainclientsform->ADOTable2->FieldByName("naimenovanie")->AsString= Dep ;
mainclientsform->ADOTable2->FieldByName("tel")->AsString = Tel;
mainclientsform->ADOTable2->FieldByName("ruk")->AsString = ruk;
mainclientsform->ADOTable2->FieldByName("regime")->AsString = regim;
mainclientsform->ADOTable2->Post();
int kodotd;
kodotd= mainclientsform->ADOTable2->FieldByName("kodotd")->AsInteger;
// добавление данных исполнитель
mainclientsform->ADOTable6->Active=true;
mainclientsform->ADOTable6->Insert();
mainclientsform->ADOTable6->FieldByName("fam")->AsString = Fam;
mainclientsform->ADOTable6->FieldByName("name")->AsString = Name1;
mainclientsform->ADOTable6->FieldByName("secname")->AsString = Sec_Name;
mainclientsform->ADOTable6->FieldByName("telefone")->AsString= Dolg;
mainclientsform->ADOTable6->FieldByName("mob")->AsString = Tel;
mainclientsform->ADOTable6->FieldByName("kodotd")->AsInteger= kodotd;
mainclientsform->ADOTable6->Post();
}
//---------------------------------------------------------------------------
void __fastcall Taddforms::Button2Click(TObject *Sender)
{
// добавление данных корреспондент
Naimen = Edit8->Text;
String station, block;
String korpus, etag, komnata, ip, shluse, hub;
int kodrazm;
korpus= Edit11->Text;
etag= Edit12->Text;
komnata = Edit13->Text;
ip = Edit91->Text;
shluse=Edit92->Text;
hub=Edit93->Text;
mainclientsform->ADOTable4->Active=true;
mainclientsform->ADOTable4->Insert();
mainclientsform->ADOTable4->FieldByName("korpus")->AsString = korpus;
mainclientsform->ADOTable4->FieldByName("etag")->AsString = etag;
mainclientsform->ADOTable4->FieldByName("komnata")->AsString = komnata;
mainclientsform->ADOTable4->FieldByName("ip")->AsString = ip;
mainclientsform->ADOTable4->FieldByName("shluse")->AsString = shluse;
mainclientsform->ADOTable4->FieldByName("hub")->AsString = hub;
mainclientsform->ADOTable4->Post();
kodrazm= mainclientsform->ADOTable4->FieldByName("kodrazm")->AsInteger;
// добавление данных
Naimen = Edit8->Text;
station = Edit9->Text;
block = Edit10->Text;
mainclientsform->ADOTable5->Active=true;
mainclientsform->ADOTable5->Insert();
mainclientsform->ADOTable5->FieldByName("naimenovanie")->AsString = Naimen;
mainclientsform->ADOTable5->FieldByName("station")->AsString = station;
mainclientsform->ADOTable5->FieldByName("block")->AsString = block;
mainclientsform->ADOTable5->FieldByName("kodrazm")->AsInteger = kodrazm;
mainclientsform->ADOTable5->Post();
}
//---------------------------------------------------------------------------
void __fastcall Taddforms::Button3Click(TObject *Sender)
{
String naimenovanie,kolvo;
// добавление данных резолюция
naimenovanie = Edit14->Text;
Date1=StrToDate(Edit15->Text);
Date2=StrToDate(Edit94->Text);
kolvo=Edit16->Text;;
mainclientsform->ADOTable7->Active=true;
mainclientsform->ADOTable7->Insert();
mainclientsform->ADOTable7->FieldByName("naimenovanie")->AsString = naimenovanie;
mainclientsform->ADOTable7->FieldByName("date")->AsDateTime=Date1;
mainclientsform->ADOTable7->FieldByName("srok")->AsDateTime=Date2;
mainclientsform->ADOTable7->FieldByName("kolvo")->AsString = kolvo;
mainclientsform->ADOTable7->Post();
}
//---------------------------------------------------------------------------
void __fastcall Taddforms::Button4Click(TObject *Sender)
{
String otchet,rabot;
Date1=StrToDate(Edit25->Text);
rabot=Edit26->Text;
otchet=Edit24->Text;
// добавление данных типы документов
// добавление данных
mainclientsform->ADOTable3->Active=true;
mainclientsform->ADOTable3->Insert();
mainclientsform->ADOTable3->FieldByName("otchet")->AsString = otchet;
mainclientsform->ADOTable3->FieldByName("rabot")->AsString = rabot;
mainclientsform->ADOTable3->FieldByName("dateispoln")->AsDateTime=Date1;
mainclientsform->ADOTable3->Post();
}
//---------------------------------------------------------------------------
void __fastcall Taddforms::Button5Click(TObject *Sender)
{
int kodzakazchik,kodispoln,kodsotr, kod_neispr,kodzakaz;
// добавление документа
String notes, status;
kodzakazchik=(Edit18->Text).ToInt();
kodispoln=(Edit34->Text).ToInt();
kodsotr=(Edit37->Text).ToInt();
kod_neispr =(Edit31->Text).ToInt();
kodzakaz =(Edit33->Text).ToInt();
status=Edit17->Text;
notes=Edit32->Text;
mainclientsform->ADOTable1->Active=true;
mainclientsform->ADOTable1->Insert();
mainclientsform->ADOTable1->FieldByName("kodzakazchik")->AsInteger = kodzakazchik;
mainclientsform->ADOTable1->FieldByName("notes")->AsString = notes;
mainclientsform->ADOTable1->FieldByName("otmetka")->AsString =status;
mainclientsform->ADOTable1->FieldByName("kodispoln")->AsInteger = kodispoln;
mainclientsform->ADOTable1->FieldByName("kodsotr")->AsString = kodsotr;
mainclientsform->ADOTable1->FieldByName("kod_neispr")->AsInteger =kod_neispr;
mainclientsform->ADOTable1->FieldByName("kodzakaz")->AsInteger =kodzakaz;
mainclientsform->ADOTable1->Post();
}
//---------------------------------------------------------------------------
Parampoisk.cpp
//---------------------------------------------------------------------------
// подключение модулей и задания пространства имен
#include <vcl.h>
#include "main.h"
#include "ChildTemlate.h"
#pragma hdrstop
#include "parampoisk.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
#include "main.h"
extern nomer_poisk;
extern Poisk;
Tparampoiskform *parampoiskform;
TParameter *P1;
String stroka_SQL,S;
TDateTime Data;
//---------------------------------------------------------------------------
__fastcall Tparampoiskform::Tparampoiskform(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tparampoiskform::FormClose(TObject *Sender,
TCloseAction &Action)
{
// закрытие формы
Action=caFree;
}
void BuildChildForms(String sCaption, TDataSource *ds,
TForm *AFormName,String AMDIChildName )
{ int i;
for ( int i = AFormName->MDIChildCount-1; i>=0; i--)
{
if (AFormName->MDIChildren[i]->Name == AMDIChildName)
{
AFormName->MDIChildren[i]->Free();
// Break;
} }
// создание формы для просмотров результатов поиска
ChildTemplateForm= new TChildTemplateForm(Application);
ChildTemplateForm->Top=230;
ChildTemplateForm->Left=0;
ChildTemplateForm->Width=1200;
ChildTemplateForm->Height=400;
ChildTemplateForm->Caption=sCaption;
}
//---------------------------------------------------------------------------
void __fastcall Tparampoiskform::Button1Click(TObject *Sender)
{
// выполнение поиска
BuildChildForms("Результаты_поиска", mainclientsform->DataSource1,mainclientsform,"ChildTemplateForm" );
ChildTemplateForm->Left=0;
ChildTemplateForm->Top=3;
mainclientsform->DataSource1->DataSet=mainclientsform->ADOQuery2;
mainclientsform->ADOQuery2->Active=false;
mainclientsform->ADOQuery2->SQL->Clear();
if (nomer_poisk ==1)
{
// поиск документа по номеру
P1=mainclientsform->ADOQuery2->Parameters->AddParameter();
S=Edit3->Text;
P1->Name="P1";
P1->DataType=ftString;
P1->Direction = ptInput;
P1->Value=S;
//P1->Size=Length(S);
P1->Value=S;
stroka_SQL="SELECT * FROM Zayavka,ispolnenie WHERE (((Zayavka.kodzayavka)=:P1) and (ispolnenie.kodispoln=Zayavka.kodispoln))";
if (stroka_SQL!="")
{
mainclientsform->ADOQuery2->SQL->Add(stroka_SQL);
mainclientsform->ADOQuery2->Active=true;
mainclientsform->ADOQuery2->ExecSQL();
}
}
if (nomer_poisk ==2)
{
// поиск документа по дате регистрации
Data=StrToDate(Edit2->Text);
P1=mainclientsform->ADOQuery2->Parameters->AddParameter();
P1->Name="P1";
P1->DataType=ftDate;
P1->Direction = ptInput;
P1->Value=Data;
stroka_SQL="select * from zayavka,ispolnenie where ispolnenie.dateispoln=:P1 " ;
if (stroka_SQL!="")
{
mainclientsform->ADOQuery2->SQL->Add(stroka_SQL);
mainclientsform->ADOQuery2->Active=true;
mainclientsform->ADOQuery2->ExecSQL();
}
}
if (nomer_poisk ==3)
{
// поиск документа поиск неотработанных документов
P1=mainclientsform->ADOQuery2->Parameters->AddParameter();
P1->Name="P1";
P1->DataType=ftInteger;
P1->Direction = ptInput;
P1->Value=1;
stroka_SQL="SELECT * FROM Zayavka,ispolnenie WHERE (((Zayavka.otmetka)<>'выполнено') and (ispolnenie.kodispoln=Zayavka.kodispoln))" ;
if (stroka_SQL!="")
{
mainclientsform->ADOQuery2->SQL->Add(stroka_SQL);
mainclientsform->ADOQuery2->Active=true;
mainclientsform->ADOQuery2->ExecSQL();
}
}
if (nomer_poisk ==4)
{
// поиск исполнителей по фамилии
P1=mainclientsform->ADOQuery2->Parameters->AddParameter();
S=Edit1->Text;