бесплатные рефераты

АРМ мененджер автосалона "А-моторс"

if pic1<>'' then Image4.Picture.LoadFromFile(pic1)

else begin

MessageBox(Handle,'Фотография кузова не выбрана!','',MB_OK);

exit;

end;

end;

procedure TFadd.LMDSpeedButton5Click(Sender: TObject);

begin

OpenPictureDialog1.Execute;

pic2:=OpenPictureDialog1.FileName;

if pic2<>'' then Image5.Picture.LoadFromFile(pic2)

else begin

MessageBox(Handle,'Фотография салона не выбрана!','',MB_OK);

exit;

end;

end;

procedure TFadd.LMDSpeedButton2Click(Sender: TObject);

begin

edit1.Text:='';

edit2.Text:='';

edit3.Text:='';

edit4.Text:='';

edit5.Text:='';

edit6.Text:='';

edit7.Text:='';

edit8.Text:='';

edit9.Text:='';

edit10.Text:='';

edit11.Text:='';

edit12.Text:='';

edit13.Text:='';

edit14.Text:='';

CheckBox1.Checked:=false;

CheckBox2.Checked:=false;

CheckBox3.Checked:=false;

CheckBox4.Checked:=false;

CheckBox5.Checked:=false;

CheckBox6.Checked:=false;

CheckBox7.Checked:=false;

CheckBox8.Checked:=false;

Memo1.Clear;

Memo2.Clear;

end;

procedure TFadd.FormCreate(Sender: TObject);

begin

// dm1.vlad.Close;

// dm1.vlad.Open;

Memo1.Clear;

Memo2.Clear;

end;

procedure TFadd.LMDSpeedButton3Click(Sender: TObject);

begin

close;

end;

Продолжение приложения А

procedure TFadd.FormClose(Sender: TObject; var Action: TCloseAction);

begin

edit1.Text:='';

edit2.Text:='';

edit3.Text:='';

edit4.Text:='';

edit5.Text:='';

edit6.Text:='';

edit7.Text:='';

edit8.Text:='';

edit9.Text:='';

edit10.Text:='';

edit11.Text:='';

edit12.Text:='';

edit13.Text:='';

edit14.Text:='';

CheckBox1.Checked:=false;

CheckBox2.Checked:=false;

CheckBox3.Checked:=false;

CheckBox4.Checked:=false;

CheckBox5.Checked:=false;

CheckBox6.Checked:=false;

CheckBox7.Checked:=false;

CheckBox8.Checked:=false;

Memo1.Clear;

Memo2.Clear;

end;

procedure TFadd.LMDSpeedButton1Click(Sender: TObject);

var k1,k2,k3:integer;

st1,q1,st2,q2,v,a,a_i:string;

i,u:integer;

begin

if (edit1.Text='') or (edit2.Text='') or (edit3.Text='') or (edit4.Text='')

or (DBLookupComboBox2.KeyValue=Null) or (edit9.Text='') or (edit10.Text='') or (edit11.Text='')

or (edit12.Text='') or (edit13.Text='') or (edit14.Text='') or (pic1='')

or (pic2='') then begin

MessageBox(Handle,'Возможно некоторые поля не заполнены!','Внимание',MB_OK);

exit;

end

else begin

dm1.komplect.Append;

dm1.avto_in.Append;

v:='KOD_vlad';

k1:=gen_id(dm1.vlad,v);

dm1.vlad.Append;

dm1.vlad.FieldByName('KOD_vlad').Value:=k1;

dm1.vlad.FieldByName('FAM').Value:=edit1.text;

dm1.vlad.FieldByName('NAME').value:=edit2.Text;

dm1.vlad.FieldByName('OTH').value:=edit3.text;

dm1.vlad.FieldByName('adres').value:=edit4.text;

dm1.vlad.fieldByName('mail').value:=edit5.Text;

dm1.vlad.FieldByName('tel').value:=edit6.text;

dm1.vlad.FieldByName('sot').value:=edit7.text;

Продолжение приложения А

a:='KOD_avto';

k2:=gen_id(dm1.avto,a);

dm1.avto.Append;

dm1.avto.FieldByName('KOD_avto').Value:=k2;

dm1.avto.FieldByName('KOD_vlad').Value:=k1;

dm1.avto.FieldByName('marka').Value:=DBLookupComboBox2.KeyValue;

dm1.avto.FieldByName('model').value:=edit9.Text ;

dm1.avto.FieldByName('cvet').value:=edit11.text;

dm1.avto.FieldByName('gos_nom').value:=edit10.text ;

dm1.avto.fieldByName('tip_kuz').value:=ComboBox1.Text;

dm1.avto.FieldByName('v').value:=edit12.text;

dm1.avto.FieldByName('cena').value:=edit13.text;

st1:='';

q1:='';

for i:=length(pic1) downto 1 do

if pic1[i]<>'.' then insert(pic1[i],q1,0) else break;

st1:=ExtractFilePath(Application.Exename);

ForceDirectories(st1+'FOTO');

if dm1.avto.FieldByName('foto_1').AsString<>'' then

DeleteFile(st1+'FOTO\'+dm1.avto.FieldByName('foto_1').AsString);

if copyfileto(pchar(pic1),pchar(st1+'FOTO\'+inttostr(k2)+'kuz' + '.'+q1)) then

else begin

MessageBox(Handle,'Невозможно скопировать файл!','Внимание',MB_OK);

exit;

end;

dm1.avto.FieldByName('foto_1').AsString:=inttostr(k2)+'kuz' + '.'+q1;

st2:='';

q2:='';

for u:=length(pic2) downto 1 do

if pic2[u]<>'.' then insert(pic2[u],q2,0) else break;

st2:=ExtractFilePath(Application.Exename);

ForceDirectories(st2+'FOTO');

if dm1.avto.FieldByName('foto_2').AsString<>'' then

DeleteFile(st2+'FOTO\'+dm1.avto.FieldByName('foto_2').AsString);

if copyfileto(pchar(pic2),pchar(st2+'FOTO\'+inttostr(k2)+'sal' + '.'+q2)) then

else begin

MessageBox(Handle,'Невозможно скопировать файл!','Внимание',MB_OK);

exit;

end;

dm1.avto.FieldByName('foto_2').AsString:=inttostr(k2)+'sal' + '.'+q2;

dm1.komplect.FieldByName('KOD_avto').Value:=k2;

if CheckBox1.Checked=true then dm1.komplect.FieldByName('zapaska').Value:='true'

else dm1.komplect.FieldByName('zapaska').Value:='false';

if CheckBox2.Checked=true then dm1.komplect.FieldByName('instrument').Value:='true'

else dm1.komplect.FieldByName('instrument').Value:='false';

Продолжение приложения А

if CheckBox3.Checked=true then dm1.komplect.FieldByName('music').Value:='true'

else dm1.komplect.FieldByName('music').Value:='false';

if CheckBox4.Checked=true then dm1.komplect.FieldByName('medic').Value:='true'

else dm1.komplect.FieldByName('medic').Value:='false';

if CheckBox5.Checked=true then dm1.komplect.FieldByName('elect_pak').Value:='true'

else dm1.komplect.FieldByName('elect_pak').Value:='false';

if CheckBox6.Checked=true then dm1.komplect.FieldByName('abs').Value:='true'

else dm1.komplect.FieldByName('abs').Value:='false';

if CheckBox7.Checked=true then dm1.komplect.FieldByName('gur').Value:='true'

else dm1.komplect.FieldByName('gur').Value:='false';

if CheckBox8.Checked=true then dm1.komplect.FieldByName('kondic').Value:='true'

else dm1.komplect.FieldByName('kondic').Value:='false';

dm1.komplect.FieldByName('koleso').Value:=ComboBox2.Text;

dm1.komplect.FieldByName('korobka').Value:=ComboBox3.Text;

dm1.komplect.FieldByName('privod').Value:=ComboBox4.Text;

dm1.komplect.FieldByName('info').Value:=Memo1.Text;

dm1.komplect.FieldByName('defekt').Value:=Memo2.Text;

a_i:='KOD_avto';

k3:=gen_id(dm1.avto,a_i);

dm1.avto_in.FieldByName('KOD_in').Value:=k3;

dm1.avto_in.FieldByName('akt_nom').Value:=Edit14.Text;

dm1.avto_in.FieldByName('KOD_avto').Value:=k2;

dm1.avto_in.FieldByName('KOD_vlad').Value:=k1;

dm1.avto_in.FieldByName('KOD_sot').Value:=DBLookupComboBox1.KeyValue;

dm1.avto_in.FieldByName('data').Value:=DateEdit1.Date;

// dm1.vlad.Post;

// dm1.avto.Post;

dm1.komplect.Post;

dm1.avto_in.Post;

edit1.Text:='';

edit2.Text:='';

edit3.Text:='';

edit4.Text:='';

edit5.Text:='';

edit6.Text:='';

edit7.Text:='';

edit8.Text:='';

edit9.Text:='';

edit10.Text:='';

edit11.Text:='';

edit12.Text:='';

edit13.Text:='';

Продолжение приложения А

edit14.Text:='';

CheckBox1.Checked:=false;

CheckBox2.Checked:=false;

CheckBox3.Checked:=false;

CheckBox4.Checked:=false;

CheckBox5.Checked:=false;

CheckBox6.Checked:=false;

CheckBox7.Checked:=false;

CheckBox8.Checked:=false;

Memo1.Clear;

Memo2.Clear;

end;

end;

procedure TFadd.OpenPictureDialog1CanClose(Sender: TObject;

var CanClose: Boolean);

begin

MessageBox(Handle,'Вы не выбрали машину!','Внимание',MB_OK);

end;

procedure TFadd.Edit6KeyPress(Sender: TObject; var Key: Char);

begin

case key of

'0'..'9',#8: key:=key

else key:=#0;

end;

end;

procedure TFadd.Edit7KeyPress(Sender: TObject; var Key: Char);

begin

case key of

'0'..'9',#8: key:=key

else key:=#0;

end;

end;

procedure TFadd.Edit13KeyPress(Sender: TObject; var Key: Char);

begin

case key of

'0'..'9',#8: key:=key

else key:=#0;

end;

end;

procedure TFadd.Edit14KeyPress(Sender: TObject; var Key: Char);

begin

case key of

'0'..'9',#8: key:=key

else key:=#0;

end;

end;

procedure TFadd.DBLookupComboBox2Click(Sender: TObject);

begin

// Edit8.Text:=DBLookupComboBox2.KeyValue;

end;

Продолжение приложения А

end.

А.3 Модуль формы «Удалить автомобиль»

unit del;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Grids, DBGrids, ExtCtrls, StdCtrls, LMDControl, LMDBaseControl,

LMDBaseGraphicButton,ActiveX,ComObj, ComCtrls, LMDCustomSpeedButton, LMDSpeedButton,DB;

type

TFdel = class(TForm)

Panel1: TPanel;

DBGrid1: TDBGrid;

Panel5: TPanel;

Panel2: TPanel;

Image1: TImage;

LMDSpeedButton1: TLMDSpeedButton;

Edit1: TEdit;

RadioGroup1: TRadioGroup;

Panel3: TPanel;

LMDSpeedButton2: TLMDSpeedButton;

Image2: TImage;

RadioGroup2: TRadioGroup;

Panel4: TPanel;

Image3: TImage;

LMDSpeedButton3: TLMDSpeedButton;

LMDSpeedButton4: TLMDSpeedButton;

procedure LMDSpeedButton1Click(Sender: TObject);

procedure LMDSpeedButton2Click(Sender: TObject);

procedure LMDSpeedButton4Click(Sender: TObject);

procedure LMDSpeedButton3Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Fdel: TFdel;

App, Ke, Abc : Variant;

ExelOtch : String;

Result : HResult;

AppProgID : string;

ServerIsRunning :boolean;

Unknown :IUnknown;

i:integer;

implementation

uses dm;

{$R *.dfm}

Продолжение приложения А

procedure TFdel.LMDSpeedButton1Click(Sender: TObject);

begin

if edit1.Text<>'' then begin

if RadioGroup1.ItemIndex=0 then

if dm1.avto_out.Locate('marka_out',edit1.Text,[loCaseInsensitive]) then

else MessageBox(Handle,'Нет автомобиля такой марки...','',MB_OK);

if RadioGroup1.ItemIndex=1 then

if dm1.avto_out.Locate('model_out',edit1.Text,[loCaseInsensitive]) then

else MessageBox(Handle,'Нет автомобиля такой модели...','',MB_OK);

end

else MessageBox(Handle,'Введите значение для поиска!','',MB_OK);

end;

procedure TFdel.LMDSpeedButton2Click(Sender: TObject);

begin

if RadioGroup2.ItemIndex=0 then

dm1.avto_out.IndexName:='marka_out';

if RadioGroup2.ItemIndex=1 then

dm1.avto_out.IndexName:='V_out';

if RadioGroup2.ItemIndex=2 then

dm1.avto_out.IndexName:='tipkuz_out';

end;

procedure TFdel.LMDSpeedButton4Click(Sender: TObject);

begin

close;

end;

procedure TFdel.LMDSpeedButton3Click(Sender: TObject);

begin

AppProgID := 'Excel.Application';

ServerIsRunning := False;

Result:=GetActiveObject(ProgIDToClassID(AppProgID),nil,Unknown);

try

if (Result = MK_E_UNAVAILABLE) then

App := CreateOleObject(AppProgID)

else

begin

App := GetActiveOleObject(AppProgID);

ServerIsRunning := True;

end;

ExelOtch:=ExtractFilePath(Application.EXEName)+'Проданные автомобили на '+DateToStr(Date)+'.xls';

App.WorkBooks.Add;

Ke:=App.WorkBooks[1];

Abc:=Ke.WorkSheets[1];

Abc.Name:='Проданные авто('+DateToStr(Date)+').xls';

except on EinOutError do begin

messageBox(handle,'Не удаётся создать файл!','Ошибка',MB_ICONERROR);

exit;

end;

end;

App.DisplayAlerts:=False;

Abc.Cells[1,3]:='Проданные авто('+DateToStr(Date)+').xls';

Продолжение приложения А

Abc.Cells[1,3].Font.Bold:=True;

Abc.Cells[1,3].Font.Size:=11;

dm1.avto_out.first;

i:=3;

while not dm1.avto_out.eof do begin

i:=i+1;

app.cells[i,1]:=vartostr(dm1.avto_out['Marka_out']);

Abc.Cells[i,1].ColumnWidth:=15;

app.cells[i,2]:=vartostr(dm1.avto_out['Model_out']);

Abc.Cells[i,2].ColumnWidth:=15;

app.cells[i,3]:=vartostr(dm1.avto_out['v_out']);

Abc.Cells[i,3].ColumnWidth:=5;

app.cells[i,4]:=vartostr(dm1.avto_out['cvet_out']);

Abc.Cells[i,4].ColumnWidth:=15;

app.cells[i,5]:=vartostr(dm1.avto_out['tipkuz_out']);

Abc.Cells[i,5].ColumnWidth:=15;

app.cells[i,6]:=vartostr(dm1.avto_out['cena_out']);

Abc.Cells[i,6].ColumnWidth:=10;

app.cells[i,7]:=vartostr(dm1.avto_out['date']);

Abc.Cells[i,7].ColumnWidth:=8;

dm1.avto_out.next;

end;

App.ActiveWorkBook.SaveAs(ExelOtch);

App.Quit;

App:=Unassigned;

AppProgID := 'Excel.Application';

App := CreateOleObject(AppProgID);

App.Visible := True;

ExelOtch:=ExtractFilePath(Application.EXEName)+'Проданные автомобили на '+DateToStr(Date)+'.xls';

App.WorkBooks.Open(ExelOtch);

end;

end.

А.4 Модуль данных

unit dm;

interface

uses

SysUtils, Classes, DB, DBTables;

type

Tdm1 = class(TDataModule)

dsvlad: TDataSource;

dsavto: TDataSource;

dssot: TDataSource;

dskomplect: TDataSource;

dsavto_in: TDataSource;

dsavto_out: TDataSource;

Продолжение приложения А

sot: TTable;

komplect: TTable;

avto_in: TTable;

avto_out: TTable;

sotKOD_SOT: TSmallintField;

sotFAM: TStringField;

sotNAME: TStringField;

sotOTH: TStringField;

avto_inKOD_IN: TFloatField;

avto_inAKT_NOM: TFloatField;

avto_inKOD_AVTO: TFloatField;

avto_inKOD_VLAD: TFloatField;

avto_inKOD_SOT: TFloatField;

avto_inDATA: TDateField;

komplectKOD_AVTO: TFloatField;

komplectKOLESO: TStringField;

komplectZAPASKA: TBooleanField;

komplectINSTRUMENT: TBooleanField;

komplectMUSIC: TBooleanField;

komplectMEDIC: TBooleanField;

komplectELECT_PAK: TBooleanField;

komplectABS: TBooleanField;

komplectGUR: TBooleanField;

komplectKONDIC: TBooleanField;

komplectINFO: TMemoField;

komplectDEFEKT: TMemoField;

komplectKOROBKA: TStringField;

komplectPRIVOD: TStringField;

avto_outKOD_OUT: TFloatField;

avto_outDATE: TDateField;

avto_outMARKA_OUT: TStringField;

avto_outMODEL_OUT: TStringField;

avto_outV_OUT: TStringField;

avto_outCVET_OUT: TStringField;

avto_outTIPKUZ_OUT: TStringField;

avto_outCENA_OUT: TFloatField;

dsmarka: TDataSource;

marka: TTable;

markaID_MARKA: TSmallintField;

markaMARKA: TStringField;

vlad: TTable;

vladKOD_VLAD: TFloatField;

vladFAM: TStringField;

vladNAME: TStringField;

vladOTH: TStringField;

vladADRES: TStringField;

vladMAIL: TStringField;

vladTEL: TFloatField;

vladSOT: TFloatField;

t1: TTable;

t1KOD_AVTO: TFloatField;

t1KOD_VLAD: TFloatField;

t1MARKA: TSmallintField;

t1MODEL: TStringField;

t1GOS_NOM: TStringField;

t1CVET: TStringField;

t1TIP_KUZ: TStringField;

t1FOTO_1: TStringField;

t1FOTO_2: TStringField;

Продолжение приложения А

t1CENA: TFloatField;

t1hoz: TStringField;

t1V: TStringField;

t1MMarka: TStringField;

avto: TTable;

avtoKOD_AVTO: TFloatField;

avtoKOD_VLAD: TFloatField;

avtoMARKA: TSmallintField;

avtoMODEL: TStringField;

avtoGOS_NOM: TStringField;

avtoCVET: TStringField;

avtoTIP_KUZ: TStringField;

avtoFOTO_1: TStringField;

avtoFOTO_2: TStringField;

avtoCENA: TFloatField;

avtoV: TFloatField;

avtohoz: TStringField;

avtoMMarka: TStringField;

procedure DataModuleCreate(Sender: TObject);

procedure avtoAfterScroll(DataSet: TDataSet);

procedure markaBeforeInsert(DataSet: TDataSet);

procedure markaAfterInsert(DataSet: TDataSet);

private

{ Private declarations }

public

{ Public declarations }

end;

var

dm1: Tdm1;

id : integer;

implementation

uses main;

{$R *.dfm}

procedure Tdm1.DataModuleCreate(Sender: TObject);

begin

avto.Close;

avto.Open;

komplect.Close;

komplect.Open;

avto_in.Close;

avto_in.Open;

avto_out.Close;

avto_out.Open;

vlad.Close;

vlad.Open;

sot.Close;

sot.Open;

end;

procedure Tdm1.avtoAfterScroll(DataSet: TDataSet);

begin

try

Fmain.Image3.Picture.LoadFromFile(ExtractFilePath(path)+'FOTO\'+dm1.avto.fieldbyname('FOTO_1').AsString);

Продолжение приложения А

except

Fmain.Image3.picture:=nil;

end;

try

Fmain.Image4.Picture.LoadFromFile(ExtractFilePath(path)+'FOTO\'+dm1.avto.fieldbyname('FOTO_2').AsString);

except

Fmain.Image4.picture:=nil;

end;

end;

procedure Tdm1.markaBeforeInsert(DataSet: TDataSet);

begin

id:=0;

Marka.First;

while not Marka.Eof do begin

if Marka.FieldByName('Id_marka').asinteger > id

then id := Marka.FieldByName('Id_marka').asinteger;

Marka.Next;

end;

id:=id+1;

end;

procedure Tdm1.markaAfterInsert(DataSet: TDataSet);

begin

Marka.FieldByName('id_marka').asinteger:=id;

end;

end.

А.5 Модуль формы «Редактирование данных»

unit edit;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, LMDControl, LMDBaseControl, LMDBaseGraphicButton,

LMDCustomSpeedButton, LMDSpeedButton, StdCtrls, RxGIF, glLabel, Mask,

ToolEdit, DBCtrls,IDGlobal, ExtDlgs, Grids, DBGrids;

type

TFedit = class(TForm)

Panel3: TPanel;

glLabel2: TglLabel;

Label8: TLabel;

Label9: TLabel;

Label10: TLabel;

Label11: TLabel;

Label12: TLabel;

Label13: TLabel;

Label14: TLabel;

Image1: TImage;

ComboBox1: TComboBox;

Panel4: TPanel;

glLabel3: TglLabel;

Label15: TLabel;

Продолжение приложения А

Label16: TLabel;

Label17: TLabel;

Label18: TLabel;

Label19: TLabel;

ComboBox2: TComboBox;

ComboBox3: TComboBox;

ComboBox4: TComboBox;

Panel1: TPanel;

glLabel4: TglLabel;

LMDSpeedButton8: TLMDSpeedButton;

LMDSpeedButton9: TLMDSpeedButton;

Image4: TImage;

Image5: TImage;

Panel5: TPanel;

LMDSpeedButton10: TLMDSpeedButton;

LMDSpeedButton12: TLMDSpeedButton;

DBEdit2: TDBEdit;

DBEdit3: TDBEdit;

DBEdit4: TDBEdit;

DBEdit5: TDBEdit;

DBEdit6: TDBEdit;

DBMemo1: TDBMemo;

DBMemo2: TDBMemo;

DBCheckBox1: TDBCheckBox;

DBCheckBox2: TDBCheckBox;

DBCheckBox3: TDBCheckBox;

DBCheckBox4: TDBCheckBox;

DBCheckBox5: TDBCheckBox;

DBCheckBox6: TDBCheckBox;

DBCheckBox7: TDBCheckBox;

DBCheckBox8: TDBCheckBox;

OpenPictureDialog1: TOpenPictureDialog;

OpenPictureDialog2: TOpenPictureDialog;

Image3: TImage;

DBLookupComboBox1: TDBLookupComboBox;

procedure LMDSpeedButton12Click(Sender: TObject);

procedure LMDSpeedButton10Click(Sender: TObject);

procedure LMDSpeedButton8Click(Sender: TObject);

procedure LMDSpeedButton9Click(Sender: TObject);

procedure FormActivate(Sender: TObject);

procedure DBEdit6KeyPress(Sender: TObject; var Key: Char);

procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);

procedure DBEdit3KeyPress(Sender: TObject; var Key: Char);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Fedit: TFedit;

pic1,pic2:string;

pole1,pole2,pole1_1,pole2_2:string;

y,t:integer;

implementation

uses dm, DB;

{$R *.dfm}

Продолжение приложения А

procedure TFedit.LMDSpeedButton12Click(Sender: TObject);

begin

close;

end;

procedure TFedit.LMDSpeedButton10Click(Sender: TObject);

var st1,q1,st2,q2:string;

i,u,k2:integer;

begin

dm1.avto.Edit;

dm1.komplect.Edit;

dm1.avto.FieldByName('TIP_KUZ').Value:=ComboBox1.text;

dm1.komplect.FieldByName('KOLESO').value:=ComboBox2.text;

dm1.komplect.FieldByName('KOROBKA').value:=ComboBox3.text;

dm1.komplect.FieldByName('PRIVOD').value:=ComboBox4.text;

k2:=dm1.avto.fieldbyname('KOD_avto').Value;

if (pic1<>'') then begin

pole1_1:='';

pole1:='';

pole1:=dm1.avto.fieldbyname('FOTO_1').AsString;

for y:=1 to length(pole1) do

if pole1[y]='.' then pole1_1:=copy(pole1,1,y-1);

st1:='';

q1:='';

for i:=length(pic1) downto 1 do

if pic1[i]<>'.' then insert(pic1[i],q1,0) else break;

st1:=ExtractFilePath(Application.Exename);

ForceDirectories(st1+'FOTO');

if dm1.avto.FieldByName('foto_1').AsString<>'' then

DeleteFile(st1+'FOTO\'+dm1.avto.FieldByName('foto_1').AsString);

if copyfileto(pchar(pic1),pchar(st1+'FOTO\'+pole1_1+ '.'+q1)) then

else begin

MessageBox(Handle,'Невозможно скопировать файл!','Внимание',MB_OK);

exit;

end;

dm1.avto.FieldByName('foto_1').AsString:=pole1_1 + '.'+q1;

end;

if (pic2<>'') then begin

pole2_2:='';

pole2:='';

pole2:=dm1.avto.fieldbyname('FOTO_2').AsString;

for t:=1 to length(pole2) do

if pole2[t]='.' then pole2_2:=copy(pole2,1,t-1);

st2:='';

q2:='';

for u:=length(pic2) downto 1 do

if pic2[u]<>'.' then insert(pic2[u],q2,0) else break;

st2:=ExtractFilePath(Application.Exename);

ForceDirectories(st2+'FOTO');

if dm1.avto.FieldByName('foto_2').AsString<>'' then

DeleteFile(st2+'FOTO\'+dm1.avto.FieldByName('foto_2').AsString);

Продолжение приложения А

if copyfileto(pchar(pic2),pchar(st2+'FOTO\'+pole2_2+ '.'+q2)) then

else begin

MessageBox(Handle,'Невозможно скопировать файл!','Внимание',MB_OK);

exit;

end;

dm1.avto.FieldByName('foto_2').AsString:=pole2_2 + '.'+q2;

end;

dm1.avto.Post;

// dm1.komplect.Post;

end;

procedure TFedit.LMDSpeedButton8Click(Sender: TObject);

begin

OpenPictureDialog1.Execute;

pic1:=OpenPictureDialog1.FileName;

if pic1<>'' then Image4.Picture.LoadFromFile(pic1)

else begin

MessageBox(Handle,'Фотография кузова не выбрана!','',MB_OK);

exit;

end;

end;

procedure TFedit.LMDSpeedButton9Click(Sender: TObject);

begin

OpenPictureDialog2.Execute;

pic2:=OpenPictureDialog2.FileName;

if pic2<>'' then Image5.Picture.LoadFromFile(pic2)

else begin

MessageBox(Handle,'Фотография салона не выбрана!','',MB_OK);

exit;

end;

end;

procedure TFedit.FormActivate(Sender: TObject);

begin

if (dm1.avto.fieldbyname('FOTO_1').Value<>'') then

Image4.Picture.LoadFromFile(ExtractFilePath(Application.Exename)+'FOTO\'+dm1.avto.fieldbyname('FOTO_1').AsString)

else MessageBox(Handle,'Фотографии кузова НЕТ!','',MB_OK);

if (dm1.avto.fieldbyname('FOTO_2').Value<>'') then

Image5.Picture.LoadFromFile(ExtractFilePath(Application.Exename)+'FOTO\'+dm1.avto.fieldbyname('FOTO_2').AsString)

else MessageBox(Handle,'Фотографии салона НЕТ!','',MB_OK);

end;

procedure TFedit.DBEdit6KeyPress(Sender: TObject; var Key: Char);

begin

case key of

'0'..'9',#8: key:=key

else key:=#0;

end;

end;

procedure TFedit.DBEdit1KeyPress(Sender: TObject; var Key: Char);

begin

Продолжение приложения А

case key of

'A'..'Z','a'..'z','а'..'я','А'..'Я',#8: key:=key

else key:=#0;

end;

end;

procedure TFedit.DBEdit3KeyPress(Sender: TObject; var Key: Char);

begin

case key of

'A'..'Z','a'..'z','а'..'я','А'..'Я',#8: key:=key

else key:=#0;

end;

end;

end.

А.6 Модуль заставки

unit logo;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, StdCtrls, ComCtrls, RxGIF;

type

TFlogo = class(TForm)

Timer1: TTimer;

Image1: TImage;

ProgressBar1: TProgressBar;

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure Timer1Timer(Sender: TObject);

procedure FormActivate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Flogo: TFlogo;

i : integer;

implementation

{$R *.dfm}

procedure TFlogo.FormClose(Sender: TObject; var Action: TCloseAction);

begin

if i=100 then

Action:=caFree

else

Action := caNone;

end;

procedure TFlogo.Timer1Timer(Sender: TObject);

begin

i:=i+1;

Продолжение приложения А

ProgressBar1.Position:=i;

if i=100 then begin

Timer1.Enabled:=false;

close;

end;

end;

procedure TFlogo.FormActivate(Sender: TObject);

begin

i:=0;

end;

end.

А.7 Модуль главной формы

unit main;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ComCtrls, Menus, Grids, DBGrids, Buttons, LMDSpeedButton,

StdCtrls, XPMan, LMDBaseGraphicButton, LMDCustomSpeedButton, LMDControl,

LMDBaseControl, DBCtrls, ImgList, LMDBaseGraphicControl,

LMDGraphicControl, LMDBaseMeter, LMDCustomProgress,

ExtCtrls, DBTables, DB, LMDLEDCustomLabel, LMDLEDLabel,IDGlobal;

type

TFmain = class(TForm)

MainMenu1: TMainMenu;

N1: TMenuItem;

N2: TMenuItem;

N3: TMenuItem;

N4: TMenuItem;

N5: TMenuItem;

N6: TMenuItem;

N8: TMenuItem;

N9: TMenuItem;

N11: TMenuItem;

N10: TMenuItem;

N12: TMenuItem;

Страницы: 1, 2, 3, 4, 5


© 2010 РЕФЕРАТЫ