Разработка автоматизированной системы контроля и управления автопарком такси

Обоснование решений по автоматизированному решению информационных задач. Реализация расширения схем данных. Используемые классификаторы и системы кодирования. Структурные единицы сообщений. Нормативно–справочная информация. Описание программных модулей.

Рубрика Программирование, компьютеры и кибернетика
Вид курсовая работа
Язык русский
Дата добавления 11.06.2014
Размер файла 1,9 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

'time_send','place','time_out');

var

MainForm1: TMainForm1;

i: Integer;

implementation

uses WelcomeF1, SendDriver, RegionsForm1, EditDriver, ChangeStateForm1, ReportsForm1;

{$R *.dfm}

procedure TMainForm1.UpdateGrids;

begin

end;

procedure TMainForm1.BitBtn1Click(Sender: TObject);

var i: byte;

begin

TelEdit.Text := '';

SrcHouseEdit.Text := 'Дом';

DestHouseEdit.Text := 'Дом';

AnyComboBox := SrcStreetComboBox;

for i := 0 to 1 do

begin

AnyComboBox.Text := 'Улица';

AnyComboBox.Items.Clear;

AnyComboBox.Font.Color := clGray;

AnyComboBox := DestStreetComboBox;

end;

DestRegComboBox.Text := 'Район';

SrcHouseEdit.Font.Color := clGray;

DestHouseEdit.Font.Color := clGray;

DestRegComboBox.Font.Color := clGray;

TelEdit.OnExit(Sender);

TelEdit.SetFocus;

end;

procedure TMainForm1.BitBtn2Click(Sender: TObject);

begin

ReportsForm.ShowModal;

end;

procedure TMainForm1.Button1Click(Sender: TObject);

begin

RegionsForm.ShowModal;

end;

procedure TMainForm1.Button2Click(Sender: TObject);

begin

DriverForm.ShowModal;

end;

procedure TMainForm1.D1Click(Sender: TObject);

begin

DriverForm.ShowModal;

end;

procedure TMainForm1.DestHouseEditEnter(Sender: TObject);

begin

DestHouseEdit.Text := '';

DestHouseEdit.Font.Color := clBlack;

end;

procedure TMainForm1.DestRegComboBoxEnter(Sender: TObject);

begin

DestRegComboBox.Text := '';

DestRegComboBox.Font.Color := clBlack;

q1.SQL.Clear;

q1.Close;

q1.SQL.Add('SELECT region_name FROM regions ORDER BY region_name ');

q1.Open;

DestRegComboBox.Items.Clear;

while not q1.Eof do

begin

DestRegComboBox.Items.Add(q1['region_name']);

q1.Next;

end;

DestRegComboBox.DroppedDown := true;

end;

procedure TMainForm1.DestStreetComboBoxChange(Sender: TObject);

var s: String;

begin

if DestStreetComboBox.Text <> '' then

begin

q1.SQL.Clear;

q1.Close;

q1.SQL.Add('SELECT tel_code FROM ulicy WHERE street_name = ' +

QuotedStr(DestStreetComboBox.Text));

q1.Open;

if not q1.Eof then

begin

s := q1['tel_code'];

q1.Close;

q1.SQL.Clear;

q1.SQL.Add('SELECT region_name FROM regions WHERE tel_code = ' + s);

q1.Open;

if q1['region_name'] <> Null then

DestRegComboBox.Text := q1['region_name'];

end;

end;

end;

procedure TMainForm1.DestStreetComboBoxEnter(Sender: TObject);

begin

DestStreetComboBox.Text := '';

q1.SQL.Clear;

q1.Close;

q1.SQL.Add('SELECT street_name FROM ulicy ORDER BY street_name');

q1.Open;

DestStreetComboBox.Items.Clear;

while not q1.Eof do

begin

DestStreetComboBox.Items.Add(q1['street_name']);

q1.Next;

end;

DestStreetComboBox.DroppedDown := true;

end;

procedure TMainForm1.DestStreetComboBoxKeyPress(Sender: TObject; var Key: Char);

begin

AnyComboBox := DestStreetComboBox;

AnyComboBoxKeyPress(Key);

end;

procedure TMainForm1.DriverListBoxClick(Sender: TObject);

begin

DriverListBox.Repaint;

end;

procedure TMainForm1.DriverListBoxDblClick(Sender: TObject);

begin

SendDriverForm.ShowModal;

end;

procedure TMainForm1.DriverListBoxDrawItem(Control: TWinControl;

Index: Integer; Rect: TRect; State: TOwnerDrawState);

var TextWidth, TextHeight: Integer;

i, x, y: integer;

s: String;

begin

s := DriverListBox.Items[Index];

RowColor := clLtGray;

for i := 0 to LocationGrid.RowCount - 1 do

begin

if LocationGrid.Cells[2,i] = s then

begin

case StrToInt(LocationGrid.Cells[0, i]) of

0,1:

RowColor := clLime;

2:

RowColor := clYellow;

3:

RowColor := clRed;

end;

break;

end;

end;

DriverListBox.Canvas.Brush.Color := RowColor;

DriverListBox.Canvas.Font.Color := clBlack;

if DriverListBox.ItemIndex = Index then

begin

DriverListBox.Canvas.Font.Color := clBlue;

DriverListBox.Canvas.Font.Style := [fsBold];

end;

//Закрашиваем текст (Text). Также здесь можно добавить выравнивание

DriverListBox.Canvas.FillRect(Rect);

TextWidth := DriverListBox.Canvas.TextWidth(s);

TextHeight := DriverListBox.Canvas.TextHeight(s);

x := Rect.Left + (Rect.Right - Rect.Left) div 2 - TextWidth div 2;

y := Rect.Top + (Rect.Bottom - Rect.Top) div 2 - TextHeight div 2;

DriverListBox.Canvas.TextOut(x, y, s);

end;

procedure TMainForm1.DriverListBoxEnter(Sender: TObject);

var s: String;

oldIndex: Integer;

label L_next_while;

begin

oldIndex := DriverListBox.ItemIndex;

q1.SQL.Clear;

q1.Close;

q1.SQL.Add('SELECT cars.voditel FROM travels, cars WHERE cars.id=voditel_id ORDER BY cars.voditel ASC');

q1.Open;

DriverListBox.Items.Clear;

while not q1.Eof do

begin

s := q1['voditel'];

for I := 0 to DriverListBox.Items.Count - 1 do

if DriverListBox.Items[i] = s then

goto L_next_while;

DriverListBox.Items.Add(s);

L_next_while:

q1.Next;

end;

q1.SQL.Clear;

q1.Close;

q1.SQL.Add('SELECT voditel, cars.id FROM cars WHERE cars.id NOT IN (SELECT travels.voditel_id FROM travels)');

q1.Open;

while not q1.Eof do

begin

s := q1['voditel'];

DriverListBox.Items.Add(s);

//L_next_while:

q1.Next;

end;

//DriverListBox.DroppedDown := true;

if oldIndex < DriverListBox.Items.Count then DriverListBox.ItemIndex := oldIndex;

DriverListBox.Repaint;

end;

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

begin

WelcomeForm.Close;

end;

procedure TMainForm1.FormCreate(Sender: TObject);

begin

LocationGrid.ColWidths[0] := 0;

LocationGrid.ColWidths[1] := 0;

LocationGrid.ColWidths[8] := 0;

TitleGrid.ColWidths[0] := 0;

TitleGrid.ColWidths[1] := 0;

TitleGrid.ColWidths[8] := 0;

end;

procedure TMainForm1.FormKeyPress(Sender: TObject; var Key: Char);

begin

if Key = #27 then Close;

end;

procedure TMainForm1.FormShow(Sender: TObject);

var State, Row, oldRow, oldCol: Integer;

StateStr: String;

Changed: Boolean;

label L_next;

begin

oldRow := LocationGrid.Row;

oldCol := LocationGrid.Col;

{for I := 0 to LocationGrid.RowCount - 1 do

LocationGrid.Rows[i].Clear;

LocationGrid.RowCount := 0;

}

q1.Close;

q1.SQL.Clear;

q1.SQL.Add('SELECT cars.voditel, voditel_id, place, from_region, to_region, state, time_send, ' +

'state_id, state_name, time_out ' +

' FROM travels, states, cars WHERE (state=state_id) AND (voditel_id=cars.id) ' +

'ORDER BY time_send DESC ' );

//LocationGrid.Font.Style := [fsBold];

TitleGrid.Rows[0].Add('');

TitleGrid.Rows[0].Add('');

TitleGrid.Rows[0].Add('Водитель');

TitleGrid.Rows[0].Add('Статус');

TitleGrid.Rows[0].Add('Едет из');

TitleGrid.Rows[0].Add('Едет в');

TitleGrid.Rows[0].Add('Отправлен');

TitleGrid.Rows[0].Add('Сейчас в');

q1.Open;

Row := 0;

if LocationGrid.RowCount <> q1.RecordCount then

begin

LocationGrid.RowCount := q1.RecordCount;

for I := 0 to LocationGrid.RowCount - 1 do

LocationGrid.Rows[i].Clear;

end;

Changed := false;

for I := 0 to LocationGrid.RowCount - 1 do

LocationGrid.Cells[1,i] := '';

while not q1.Eof do

begin

if q1['voditel_id'] <> NULL then // исключить повторяющихся водителей

for I := 0 to LocationGrid.RowCount - 1 do

if LocationGrid.Cells[1,i] = String(q1['voditel_id']) then

goto L_next;

// LocationGrid.RowCount := LocationGrid.RowCount + 1;

for I := 0 to 8 do

if q1[Fields[i]] <> NULL then

begin

if LocationGrid.Cells[i, Row] <> String(q1[Fields[i]]) then

begin

LocationGrid.Cells[i, Row] := String(q1[Fields[i]]);

Changed := true;

end;

end

Размещено на Allbest.ru

автоматизированная система информация


Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.