Разработка автоматизированного рабочего места менеджера транспортного предприятия, страница 25

if Second='' then

second:='00';

if hors='' then

hors:='00';

if minute='' then

minute:='00';

Result:= hors+':'+minute+':'+second ;

end;

procedure file_creation (text, path:string);

var

f: TextFile;

begin

AssignFile (f,path);

Rewrite (f);

WriteLn (f,text);

CloseFile (f);

end;

function pathbd (path:string): string;

var

f:textFile;

path_out:string;

begin

AssignFile (f,path) ;

reset(f);          // Открываем файл.

readLn(f,path_out);   // В переменную str записываем информацию из файла

Result:=path_out;

CloseFile(f);

end;

end.


Исходный код программного модуля CarUnit

unit CarUnit;

interface

uses

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

Dialogs, StdCtrls, ComCtrls, Mask, DBCtrls,

DM_unit,Storage, Grids, DBGrids;

type

TCarForm = class(TForm)

CloseButton: TButton;

CarRepairDateTimePicker: TDateTimePicker;

CarBuyDateTimePicker: TDateTimePicker;

CarLToDateTimePicker: TDateTimePicker;

CarLTONumEdit: TEdit;

CarMarkButton: TButton;

FuelTypeButton: TButton;

SaveButton: TButton;

DTPInsurStartTime: TDateTimePicker;

DTPInsurStartDate: TDateTimePicker;

DTPInsurEndDate: TDateTimePicker;

DTPInsurEndTime: TDateTimePicker;

RegMarkCarEdit: TMaskEdit;

CarStatusBox: TComboBox;

CBFuelType: TComboBox;

CBMarkName: TComboBox;

Labe12: TLabel;

Labe2: TLabel;

Labe3: TLabel;

Labe4: TLabel;

Labe5: TLabel;

Labe6: TLabel;

Labe7: TLabel;

Labe8: TLabel;

Labe9: TLabel;

Labe10: TLabel;

Labe11: TLabel;

Labe13: TLabel;

Labe14: TLabel;

Labe15: TLabel;

Labe16: TLabel;

Labe17: TLabel;

Labe18: TLabel;

CarStatusButton: TButton;

CarFuelRestEdit: TMaskEdit;

CarExpSCityEdit: TMaskEdit;

CarExpSCountryEdit: TMaskEdit;

CarExpWCityEdit: TMaskEdit;

CarExpWCountryEdit: TMaskEdit;

CarRunEdit: TMaskEdit;

CarModelName: TComboBox;

procedure FormActivate(Sender: TObject);

procedure SaveButtonClick(Sender: TObject);

procedure CarStatusBoxSelect(Sender: TObject);

procedure CloseButtonClick(Sender: TObject);

procedure FuelTypeButtonClick(Sender: TObject);

procedure CarStatusButtonClick(Sender: TObject);

procedure CBMarkNameChange(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

IDM:string;

CarForm: TCarForm;

implementation

uses Directories_unit;

{$R *.dfm}

procedure TCarForm.FormActivate(Sender: TObject);

begin

CBFuelType.Clear;

DM.TableFuelType.First;

While not DM.TableFuelType.Eof do

begin

CBFuelType.Items.Add(DM.TableFuelType.FieldByName('FuelName').asstring);

DM.TableFuelType.Next;

end;

CBMarkName.Clear;

DM.TableMark.First;

While not DM.TableMark.Eof do

begin

CBMarkName.Items.Add(DM.TableMark.FieldByName('MarkName').asstring);

DM.TableMark.Next;

end;

CarStatusBox.Clear;

DM.CarStatusTable.First;

While not DM.CarStatusTable.Eof do

begin

CarStatusBox.Items.Add(DM.CarStatusTable.FieldByName('CarStatusName').asstring);

DM.CarStatusTable.Next;

end;

If Act = 'Edit' then

Begin

RegMarkCarEdit.Text := dm.Query_work.FieldByName('RegMarkCar').AsString;

CarRunEdit.Text := dm.Query_work.FieldByName('CarRun').AsString;

// CarModelEdit.Text := dm.Query_work.FieldByName('CarModel').AsString;

CarFuelRestEdit.Text := dm.Query_work.FieldByName('CarFuelRest').AsString;

CarExpSCityEdit.Text := dm.Query_work.FieldByName('CarExpSCity').AsString;

CarExpWCityEdit.Text := dm.Query_work.FieldByName('CarExpWCity').AsString;

CarExpSCountryEdit.Text := dm.Query_work.FieldByName('CarExpSCountry').AsString;

CarExpWCountryEdit.Text := dm.Query_work.FieldByName('CarExpWCountry').AsString;

CarLTONumEdit.Text := dm.Query_work.FieldByName('CarLTONum').AsString;

If dm.Query_work.FieldByName('CarBuyDate').AsString <> '' then

CarBuyDateTimePicker.Date := StrToDate ( ServicDate(dm.Query_work.FieldByName('CarBuyDate').AsString ));

If dm.Query_work.FieldByName('CarLToDate').AsString <> '' then

CarLToDateTimePicker.DateTime := StrToDate(ServicDate(dm.Query_work.FieldByName('CarLToDate').AsString));