Проектирование CRM-системы ОАО "Орбита-Сервис"

Разработка информационной подсистемы автоматизации рабочего места менеджера салона по ремонту мобильных телефонов. Проблемы CRM-систем, необходимость их использования. Система управления базой данных как способ реализации информационной системы.

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

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

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

procedure DBGrid1DblClick (Sender: TObject);

procedure BeginDateChange (Sender: TObject);

procedure EndDateChange (Sender: TObject);

procedure ActPrintExecute (Sender: TObject);

procedure ActPreviewExecute (Sender: TObject);

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

procedure ActEndExecute (Sender: TObject);

procedure ActHomeExecute (Sender: TObject);

procedure CheckBox1Click (Sender: TObject);

procedure N27Click (Sender: TObject);

procedure FormCreate (Sender: TObject);

procedure N29Click (Sender: TObject);

procedure FSBClick (Sender: TObject);

procedure FEditKeyDown (Sender: TObject; var Key: Word;

Shift: TShiftState);

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

procedure DBGrid1MouseDown (Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure JanHDBGrid1DblClick (Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

procedure GridWidth;

procedure InitFormFAdd;

procedure InitFormFFind;

procedure SaveSettings;

procedure LoadSettings;

procedure LoadDate;

{ procedure IsReg;

procedure WriteEndUse; }

end;

var

FMain: TFMain;

SortAct: integer;

ConfFile: TIniFile;

implementation

uses Unit2, Unit3, Unit4, Unit5, Unit6, Unit7, Unit8;

{$R *. dfm}

{procedure TFMain. WriteEndUse;

var

RInf: TIniFile;

begin

RInf: =TIniFile. Create ('Rconf. ini');

RInf. WriteString ('SK','NSK','NR');

RInf. Free;

end; }

{procedure TFMain. IsReg;

var

p: string;

RInf: TIniFile;

begin

RInf: =TIniFile. Create ('Rconf. ini');

p: =RInf. ReadString ('SK','p',p);

if p='ljkkfh' then

exit

else

begin

ShowMessage ('Время использования пробной версии программы истекло'

+#13+'для получения полной версии обратитесь к разработчикам');

Application. Terminate;

end;

RInf. Free;

end; }

procedure TFMain. LoadDate;

begin

ConfFile: =TIniFile. Create (ExtractFilePath (Application. ExeName) +'DBconfig. ini');

BeginDate. Date: =ConfFile. ReadDate ('Date','BeginDate',BeginDate. Date);

EndDate. Date: =ConfFile. ReadDate ('Date','EndDate',EndDate. Date);

ConfFile. Free;

end;

procedure TFMain. LoadSettings;

begin

ConfFile: =TIniFile. Create (ExtractFilePath (Application. ExeName) +'DBconfig. ini');

DBGrid1. Columns [0]. Width: =ConfFile. ReadInteger ('GridColumns','Column0',DBGrid1. Columns [0]. Width);

DBGrid1. Columns [1]. Width: =ConfFile. ReadInteger ('GridColumns','Column1',DBGrid1. Columns [1]. Width);

DBGrid1. Columns [2]. Width: =ConfFile. ReadInteger ('GridColumns','Column2',DBGrid1. Columns [2]. Width);

DBGrid1. Columns [3]. Width: =ConfFile. ReadInteger ('GridColumns','Column3',DBGrid1. Columns [3]. Width);

DBGrid1. Columns [4]. Width: =ConfFile. ReadInteger ('GridColumns','Column4',DBGrid1. Columns [4]. Width);

DBGrid1. Columns [5]. Width: =ConfFile. ReadInteger ('GridColumns','Column5',DBGrid1. Columns [5]. Width);

DBGrid1. Columns [6]. Width: =ConfFile. ReadInteger ('GridColumns','Column6',DBGrid1. Columns [6]. Width);

DBGrid1. Columns [7]. Width: =ConfFile. ReadInteger ('GridColumns','Column7',DBGrid1. Columns [7]. Width);

DBGrid1. Columns [8]. Width: =ConfFile. ReadInteger ('GridColumns','Column8',DBGrid1. Columns [8]. Width);

DBGrid1. Columns [9]. Width: =ConfFile. ReadInteger ('GridColumns','Column9',DBGrid1. Columns [9]. Width);

DBGrid1. Columns [10]. Width: =ConfFile. ReadInteger ('GridColumns','Column10',DBGrid1. Columns [10]. Width);

DBGrid1. Columns [11]. Width: =ConfFile. ReadInteger ('GridColumns','Column11',DBGrid1. Columns [11]. Width);

DBGrid1. Columns [12]. Width: =ConfFile. ReadInteger ('GridColumns','Column12',DBGrid1. Columns [12]. Width);

DBGrid1. Columns [13]. Width: =ConfFile. ReadInteger ('GridColumns','Column13',DBGrid1. Columns [13]. Width);

DBGrid1. Columns [14]. Width: =ConfFile. ReadInteger ('GridColumns','Column14',DBGrid1. Columns [14]. Width);

DBGrid1. Columns [15]. Width: =ConfFile. ReadInteger ('GridColumns','Column15',DBGrid1. Columns [15]. Width);

DBGrid1. Columns [16]. Width: =ConfFile. ReadInteger ('GridColumns','Column19',DBGrid1. Columns [19]. Width);

DBGrid1. Columns [20]. Width: =ConfFile. ReadInteger ('GridColumns','Column20',DBGrid1. Columns [20]. Width);

ConfFile. Free;

end;

// ширина полей в DBGrid

procedure TFMain. GridWidth;

begin

DBGrid1. Columns [20]. Index: =2;

DBGrid1. Columns [20]. Index: =10;

DBGrid1. Columns [20]. Index: =3;

DBGrid1. Columns [7]. Index: =4;

DBGrid1. Columns [9]. Index: =5;

DBGrid1. Columns [14]. Index: =6;

{DBGrid1. Columns [0]. Width: =50;

DBGrid1. Columns [1]. Width: =60;

DBGrid1. Columns [2]. Width: =150;

DBGrid1. Columns [3]. Width: =180;

DBGrid1. Columns [4]. Width: =180;

DBGrid1. Columns [5]. Width: =70;

DBGrid1. Columns [6]. Width: =90;

DBGrid1. Columns [7]. Width: =100;

DBGrid1. Columns [8]. Width: =100;

DBGrid1. Columns [9]. Width: =100;

DBGrid1. Columns [10]. Width: =160;

DBGrid1. Columns [11]. Width: =50;

DBGrid1. Columns [12]. Width: =160;

DBGrid1. Columns [13]. Width: =150;

DBGrid1. Columns [14]. Width: =60;

DBGrid1. Columns [15]. Width: =60; }

DBGrid1. Columns [17]. Visible: =False;

DBGrid1. Columns [18]. Visible: =False;

DBGrid1. Columns [19]. Visible: =False;

// DBGrid1. Columns [19]. Width: =150;

LoadSettings;

DBGrid1. Columns [0]. Title. Caption: ='№ заказа';

DBGrid1. Columns [1]. Title. Caption: ='Дата приёма';

DBGrid1. Columns [2]. Title. Caption: ='Статус';

DBGrid1. Columns [7]. Title. Caption: ='Ф. И.О. ';

DBGrid1. Columns [8]. Title. Caption: ='Адрес';

DBGrid1. Columns [9]. Title. Caption: ='Телефон';

DBGrid1. Columns [4]. Title. Caption: ='Модель';

DBGrid1. Columns [10]. Title. Caption: ='S/N';

DBGrid1. Columns [5]. Title. Caption: ='IMEI';

DBGrid1. Columns [11]. Title. Caption: ='S/N Батареи';

DBGrid1. Columns [12]. Title. Caption: ='Комплектность';

DBGrid1. Columns [13]. Title. Caption: ='Стоимость';

DBGrid1. Columns [14]. Title. Caption: ='Замечания, внешний вид';

DBGrid1. Columns [6]. Title. Caption: ='Неисправность со слов клиента';

DBGrid1. Columns [15]. Title. Caption: ='Дата выдачи';

DBGrid1. Columns [16]. Title. Caption: ='Дата покупки';

DBGrid1. Columns [3]. Title. Caption: ='Инженер';

DBGrid1. Columns [20]. Title. Caption: ='Примечания';

end;

procedure TFMain. SaveSettings;

begin

ConfFile: =TIniFile. Create (ExtractFilePath (Application. ExeName) +'DBconfig. ini');

ConfFile. WriteInteger ('GridColumns','Column0',DBGrid1. Columns [0]. Width);

ConfFile. WriteInteger ('GridColumns','Column1',DBGrid1. Columns [1]. Width);

ConfFile. WriteInteger ('GridColumns','Column2',DBGrid1. Columns [2]. Width);

ConfFile. WriteInteger ('GridColumns','Column3',DBGrid1. Columns [3]. Width);

ConfFile. WriteInteger ('GridColumns','Column4',DBGrid1. Columns [4]. Width);

ConfFile. WriteInteger ('GridColumns','Column5',DBGrid1. Columns [5]. Width);

ConfFile. WriteInteger ('GridColumns','Column6',DBGrid1. Columns [6]. Width);

ConfFile. WriteInteger ('GridColumns','Column7',DBGrid1. Columns [7]. Width);

ConfFile. WriteInteger ('GridColumns','Column8',DBGrid1. Columns [8]. Width);

ConfFile. WriteInteger ('GridColumns','Column9',DBGrid1. Columns [9]. Width);

ConfFile. WriteInteger ('GridColumns','Column10',DBGrid1. Columns [10]. Width);

ConfFile. WriteInteger ('GridColumns','Column11',DBGrid1. Columns [11]. Width);

ConfFile. WriteInteger ('GridColumns','Column12',DBGrid1. Columns [12]. Width);

ConfFile. WriteInteger ('GridColumns','Column13',DBGrid1. Columns [13]. Width);

ConfFile. WriteInteger ('GridColumns','Column14',DBGrid1. Columns [14]. Width);

ConfFile. WriteInteger ('GridColumns','Column15',DBGrid1. Columns [15]. Width);

ConfFile. WriteInteger ('GridColumns','Column19',DBGrid1. Columns [16]. Width);

ConfFile. WriteInteger ('GridColumns','Column20',DBGrid1. Columns [20]. Width);

ConfFile. WriteDate ('Date','BeginDate',BeginDate. Date);

ConfFile. WriteDate ('Date','EndDate',EndDate. Date);

ConfFile. Free;

end;

procedure TFMain. InitFormFAdd;

var

quSelect: TADOQuery;

begin

FAdd. EFIO. Text: ='';

FAdd. Etel. Text: ='';

FAdd. EAdres. Text: ='';

FAdd. Emodel. Text: ='';

FAdd. ESN. Text: ='';

FAdd. EIMEI. Text: ='';

FAdd. ESNBat. Text: ='';

// FAdd. CKompl. Text: ='Телефон';

FAdd. CEngeneer. Text: ='';

FAdd. ENeisp. Text: ='';

FAdd. ECost. Text: ='';

FAdd. EZam. Text: ='';

FAdd. ENumberOrder. Text: ='';

FAdd. EPrim. Text: ='';

// FAdd. CStatus. Text: ='Принято в ремонт';

// Добавляем инженеров в список ComboBox из таблицы

quSelect: = TADOQuery. Create (Self);

quSelect. Connection: = Password;

quSelect. Close;

quSelect. SQL. Add ('select * from Engineer');

quSelect. Open;

LoadIDComboBox (FAdd. CEngeneer, quSelect, 'ID', 'FIO');

{quSelect. Close;

quSelect. Free;

// Добавляем статусы телефонов в список ComboBox из таблицы

quSelect: = TADOQuery. Create (Self);

quSelect. Connection: = Password; }

quSelect. SQL. Clear;

quSelect. Close;

quSelect. SQL. Add ('select * from STATUS');

quSelect. Open;

LoadIDComboBox (FAdd. CStatus, quSelect, 'ID', 'Status');

{quSelect. Close;

quSelect. Free;

// Добавляем комплектность телефонов в список ComboBox из таблицы

quSelect: = TADOQuery. Create (Self);

quSelect. Connection: = Password; }

quSelect. SQL. Clear;

quSelect. Close;

quSelect. SQL. Add ('select * from KOMPLEKTNOST');

quSelect. Open;

LoadIDComboBox (FAdd. CKompl, quSelect, 'ID', 'Komplektnost');

quSelect. SQL. Clear;

quSelect. Close;

quSelect. Free;

end;

procedure TFMain. ADDExecute (Sender: TObject);

var

quInsert: TADOQuery;

click,s: string;

begin

s: =ADOQuery1. Fields [0]. Text; // запоминание текущей записи

// Добавление записи

InitFormFAdd;

SaveSettings; // // // /****************

FAdd. CStatus. ItemIndex: =0;

FAdd. DateReception. Enabled: =True;

FAdd. DateReception. Date: =Date ();

FAdd. DatePokupki. Checked: =False;

FAdd. DateDelivery. Checked: = False;

FAdd. Caption: ='Добавление записи';

try

quInsert: = TADOQuery. Create (Self);

quInsert. Connection: = Password;

quInsert. Close;

// добавление автономера заказа

quInsert. SQL. Add ('SELECT (IDENT_CURRENT (''ORBITAS'') + 1) as Number');

quInsert. Open;

FAdd. ENumberOrder. Text: = quInsert. FieldByName ('Number'). AsString;

If FAdd. ShowModal = mrOk then

begin

click: ='ok';

quInsert. Close;

quInsert. SQL. Clear;

if FAdd. DatePokupki. Checked then begin // [datavidachi]

quInsert. SQL. Add ('insert into ORBITAS ([datapriema], [FIO], [Adres], [Tel], [Model], [SN], [IMEI], [SNbat], [Stoimost], [Zamechaniya], [Neispravnost], [datapokypki], [Primechaniya], R_Komplektnost, R_STATUS, R_ENGINEER) values ('''+

DateToStr (FAdd. DateReception. Date) +''','''+

Trim (FAdd. EFIO. Text) + ''','''+

Trim (FAdd. EAdres. Text) + ''','''+

Trim (FAdd. Etel. Text) + ''','''+

Trim (FAdd. Emodel. Text) + ''','''+

Trim (FAdd. ESN. Text) + ''','''+

Trim (FAdd. EIMEI. Text) + ''','''+

Trim (FAdd. ESNbat. Text) + ''','''+

Trim (FAdd. ECost. Text) + ''','''+

Trim (FAdd. EZam. Text) + ''','''+

Trim (FAdd. ENeisp. Text) + ''','''+

DateToStr (FAdd. DatePokupki. Date) +''','''+

Trim (FAdd. EPrim. Text) + ''','''+

IntToStr (GetIDComboBox (FAdd. CKompl)) + ''','''+

IntToStr (GetIDComboBox (FAdd. CStatus)) + ''','+

IntToStr (GetIDComboBox (FAdd. CEngeneer)) +') ');

end else begin

quInsert. SQL. Add ('insert into ORBITAS ([datapriema], [FIO], [Adres], [Tel], [Model], [SN], [IMEI], [SNbat], [Stoimost], [Zamechaniya], [Neispravnost], [Primechaniya], R_Komplektnost, R_STATUS, R_ENGINEER) values ('''+

DateToStr (FAdd. DateReception. Date) +''','''+

Trim (FAdd. EFIO. Text) + ''','''+

Trim (FAdd. EAdres. Text) + ''','''+

Trim (FAdd. Etel. Text) + ''','''+

Trim (FAdd. Emodel. Text) + ''','''+

Trim (FAdd. ESN. Text) + ''','''+

Trim (FAdd. EIMEI. Text) + ''','''+

Trim (FAdd. ESNbat. Text) + ''','''+

Trim (FAdd. ECost. Text) + ''','''+

Trim (FAdd. EZam. Text) + ''','''+

Trim (FAdd. ENeisp. Text) + ''','''+

Trim (FAdd. EPrim. Text) + ''','''+

IntToStr (GetIDComboBox (FAdd. CKompl)) + ''','''+

IntToStr (GetIDComboBox (FAdd. CStatus)) + ''','+

IntToStr (GetIDComboBox (FAdd. CEngeneer)) +') ');

end;

quInsert. ExecSQL;

end;

finally

quInsert. Close;

quInsert. Free;

ADOQuery1. Close;

ADOQuery1. Open;

end;

GridWidth;

if Unit3. PrintAct then

begin

RvSystem1. DefaultDest: =rdPrinter;

ADOQuery1. Last;

RvProject1. Execute;

PrintAct: =False;

end;

if click='ok' then ADOQuery1. Last else ADOQuery1. Locate ('ID',s, [loCaseInsensitive]);

end;

procedure TFMain. DELETEExecute (Sender: TObject);

var

quDelete: TADOQuery;

s: string;

begin

// Удаление записи

// MessageDLG ();

{ if ADOQuery1. Last then exit;

ADOQuery1. Next;

s: =ADOQuery1. Fields [0]. Text; // запоминание текущей записи

ADOQuery1. Prior; }

SaveSettings; // *******************

If Application. MessageBox ('Удалить выделенную запись? ','Удаление записи',MB_YESNO + MB_ICONQUESTION) <> mrYes then exit;

// If MessageDLG ('Удалить выделенную запись? ', mtConfirmation, [mbYes, mbNo], 1) <> mrYes then exit;

quDelete: = TADOQuery. Create (Self);

quDelete. Connection: = Password;

quDelete. Close;

quDelete. SQL. Add ('delete from ORBITAS where ID = ' + ADOQuery1. FieldByName ('ID'). AsString);

quDelete. ExecSQL;

quDelete. Close;

quDelete. Free;

ADOQuery1. Close;

ADOQuery1. Open;

GridWidth;

// ADOQuery1. Locate ('ID',s, [loCaseInsensitive]);

ADOQuery1. Last;

end;

procedure TFMain. EDITExecute (Sender: TObject);

var

quUpdate: TADOQuery;

s: string;

begin

// Изменение записи

s: =ADOQuery1. Fields [0]. Text; // запоминание текущей записи

InitFormFAdd;

SaveSettings; // *****************************

FAdd. DateReception. Enabled: =False;

FAdd. DateDelivery. Enabled: =True;

FAdd. Caption: = 'Изменение записи';

FAdd. ENumberOrder. Text: = ADOQuery1. FieldByName ('ID'). AsString;

FAdd. EFIO. Text: = ADOQuery1. FieldByName ('FIO'). AsString;

FAdd. Etel. Text: = ADOQuery1. FieldByName ('TEL'). AsString;

FAdd. EAdres. Text: = ADOQuery1. FieldByName ('ADRES'). AsString;

FAdd. Emodel. Text: = ADOQuery1. FieldByName ('Model'). AsString;

FAdd. ESN. Text: = ADOQuery1. FieldByName ('SN'). AsString;

FAdd. EIMEI. Text: = ADOQuery1. FieldByName ('IMEI'). AsString;

FAdd. ESNBat. Text: = ADOQuery1. FieldByName ('SNBat'). AsString;

FAdd. ECost. Text: = ADOQuery1. FieldByName ('Stoimost'). AsString;

FAdd. EZam. Text: = ADOQuery1. FieldByName ('Zamechaniya'). AsString;

FAdd. ENeisp. Text: = ADOQuery1. FieldByName ('Neispravnost'). AsString;

FAdd. EPrim. Text: = ADOQuery1. FieldByName ('Primechaniya'). AsString;

{ FAdd. DatePokupki. Checked: = False;

FAdd. DateDelivery. Checked: = False; }

FAdd. DateReception. Date: = StrToDateDef (ADOQuery1. FieldByName ('datapriema'). AsString,Date ());

FAdd. DateDelivery. Date: = StrToDateDef (ADOQuery1. FieldByName ('datavidachi'). AsString,Date ());

FAdd. DatePokupki. Date: = StrToDateDef (ADOQuery1. FieldByName ('datapokypki'). AsString,Date ());

if StrToDateDef (ADOQuery1. FieldByName ('datavidachi'). AsString,0) =0 then FAdd. DateDelivery. Checked: =False;

if StrToDateDef (ADOQuery1. FieldByName ('datapokypki'). AsString,0) =0 then FAdd. DatePokupki. Checked: =False;

FAdd. CStatus. ItemIndex: = FAdd. CStatus. Items. IndexOf (ADOQuery1. FieldByName ('STATUS'). AsString);

FAdd. CKompl. ItemIndex: = FAdd. CKompl. Items. IndexOf (ADOQuery1. FieldByName ('Komplektnost'). AsString);

FAdd. CEngeneer. ItemIndex: = FAdd. CEngeneer. Items. IndexOf (ADOQuery1. FieldByName ('ENG_FIO'). AsString);

If FAdd. ShowModal <> mrOk then exit;

quUpdate: = TADOQuery. Create (Self);

quUpdate. Connection: = Password;

quUpdate. Close;

if (FAdd. DateDelivery. Checked) and (FAdd. DatePokupki. Checked) then

begin

quUpdate. SQL. Add ('update ORBITAS set '+

'datapriema = ''' + DateToStr (FAdd. DateReception. Date) +

''', FIO = ''' + Trim (FAdd. EFIO. Text) +

''', ADRES = ''' + Trim (FAdd. EAdres. Text) +

''', TEL = ''' + Trim (FAdd. ETel. Text) +

''', Model = ''' + Trim (FAdd. Emodel. Text) +

''', SN = ''' + Trim (FAdd. ESN. Text) +

''', IMEI = ''' + Trim (FAdd. EIMEI. Text) +

''', SNbat = ''' + Trim (FAdd. ESNbat. Text) +

''', Stoimost = ''' + Trim (FAdd. ECost. Text) +

''', Zamechaniya = ''' + Trim (FAdd. EZam. Text) +

''', Neispravnost = ''' + Trim (FAdd. ENeisp. Text) +

''', datavidachi = ''' + DateToStr (FAdd. DateDelivery. Date) +

''', datapokypki = ''' + DateToStr (FAdd. DatePokupki. Date) +

''', Primechaniya = ''' + Trim (FAdd. EPrim. Text) +

''', R_STATUS = ''' + IntToStr (GetIDComboBox (FAdd. CStatus)) +

''', R_Komplektnost = ''' + IntToStr (GetIDComboBox (FAdd. CKompl)) +

''', R_ENGINEER = ' + IntToStr (GetIDComboBox (FAdd. CEngeneer)) + ' where ID = ' + ADOQuery1. FieldByName ('ID'). AsString);

end;

if (FAdd. DateDelivery. Checked=False) and (FAdd. DatePokupki. Checked=False) then

begin

quUpdate. SQL. Add ('update ORBITAS set '+

'datapriema = ''' + DateToStr (FAdd. DateReception. Date) +

''', FIO = ''' + Trim (FAdd. EFIO. Text) +

''', ADRES = ''' + Trim (FAdd. EAdres. Text) +

''', TEL = ''' + Trim (FAdd. ETel. Text) +

''', Model = ''' + Trim (FAdd. Emodel. Text) +

''', SN = ''' + Trim (FAdd. ESN. Text) +

''', IMEI = ''' + Trim (FAdd. EIMEI. Text) +

''', SNbat = ''' + Trim (FAdd. ESNbat. Text) +

''', Stoimost = ''' + Trim (FAdd. ECost. Text) +

''', Zamechaniya = ''' + Trim (FAdd. EZam. Text) +

''', Neispravnost = ''' + Trim (FAdd. ENeisp. Text) +

''', datavidachi = ''' + ''+

''', datapokypki = ''' + ''+

''', Primechaniya = ''' + Trim (FAdd. EPrim. Text) +

''', R_STATUS = ''' + IntToStr (GetIDComboBox (FAdd. CStatus)) +

''', R_Komplektnost = ''' + IntToStr (GetIDComboBox (FAdd. CKompl)) +

''', R_ENGINEER = ' + IntToStr (GetIDComboBox (FAdd. CEngeneer)) + ' where ID = ' + ADOQuery1. FieldByName ('ID'). AsString);

end;

if (FAdd. DateDelivery. Checked) and (FAdd. DatePokupki. Checked=False) then

begin

quUpdate. SQL. Add ('update ORBITAS set '+

'datapriema = ''' + DateToStr (FAdd. DateReception. Date) +

''', FIO = ''' + Trim (FAdd. EFIO. Text) +

''', ADRES = ''' + Trim (FAdd. EAdres. Text) +

''', TEL = ''' + Trim (FAdd. ETel. Text) +

''', Model = ''' + Trim (FAdd. Emodel. Text) +

''', SN = ''' + Trim (FAdd. ESN. Text) +

''', IMEI = ''' + Trim (FAdd. EIMEI. Text) +

''', SNbat = ''' + Trim (FAdd. ESNbat. Text) +

''', Stoimost = ''' + Trim (FAdd. ECost. Text) +

''', Zamechaniya = ''' + Trim (FAdd. EZam. Text) +

''', Neispravnost = ''' + Trim (FAdd. ENeisp. Text) +

''', datavidachi = ''' + DateToStr (FAdd. DateDelivery. Date) +

''', datapokypki = ''' + ''+

''', Primechaniya = ''' + Trim (FAdd. EPrim. Text) +

''', R_STATUS = ''' + IntToStr (GetIDComboBox (FAdd. CStatus)) +

''', R_Komplektnost = ''' + IntToStr (GetIDComboBox (FAdd. CKompl)) +

''', R_ENGINEER = ' + IntToStr (GetIDComboBox (FAdd. CEngeneer)) + ' where ID = ' + ADOQuery1. FieldByName ('ID'). AsString);

end;

if (FAdd. DateDelivery. Checked=False) and (FAdd. DatePokupki. Checked) then

begin

quUpdate. SQL. Add ('update ORBITAS set '+

'datapriema = ''' + DateToStr (FAdd. DateReception. Date) +

''', FIO = ''' + Trim (FAdd. EFIO. Text) +

''', ADRES = ''' + Trim (FAdd. EAdres. Text) +

''', TEL = ''' + Trim (FAdd. ETel. Text) +

''', Model = ''' + Trim (FAdd. Emodel. Text) +

''', SN = ''' + Trim (FAdd. ESN. Text) +

''', IMEI = ''' + Trim (FAdd. EIMEI. Text) +

''', SNbat = ''' + Trim (FAdd. ESNbat. Text) +

''', Stoimost = ''' + Trim (FAdd. ECost. Text) +

''', Zamechaniya = ''' + Trim (FAdd. EZam. Text) +

''', Neispravnost = ''' + Trim (FAdd. ENeisp. Text) +

''', datavidachi = ''' + ''+

''', datapokypki = ''' + DateToStr (FAdd. DatePokupki. Date) +

''', Primechaniya = ''' + Trim (FAdd. EPrim. Text) +

''', R_STATUS = ''' + IntToStr (GetIDComboBox (FAdd. CStatus)) +

''', R_Komplektnost = ''' + IntToStr (GetIDComboBox (FAdd. CKompl)) +

''', R_ENGINEER = ' + IntToStr (GetIDComboBox (FAdd. CEngeneer)) + ' where ID = ' + ADOQuery1. FieldByName ('ID'). AsString);

end;

quUpdate. ExecSQL;

quUpdate. Close;

quUpdate. Free;

ADOQuery1. Close;

ADOQuery1. Open;

GridWidth;

if Unit3. PrintAct then

begin

RvSystem1. DefaultDest: =rdPrinter;

ADOQuery1. Last;

RvProject1. Execute;

end;

ADOQuery1. Locate ('ID',s, [loCaseInsensitive]);

end;

procedure TFMain. FINDExecute (Sender: TObject);

begin

// Поиск

InitFormFFind;

SaveSettings; // *****************

If FFind. ShowModal <> mrOk then exit;

begin

Fmain. ADOQuery1. Close;

Fmain. ADOQuery1. SQL. Clear;

// Поиск по 4 полям

ADOQuery1. SQL. Add ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) WHERE (STATUS LIKE '''+FFind. CStatus. Text+'%'') and (Model LIKE '''+FFind. EMod. Text+'%'') and (IMEI LIKE '''+FFind. EIMEI. Text+'%'') and (orb. FIO LIKE '''+FFind. EFIO. Text+'%'') ');

ADOQuery1. Open;

GridWidth;

end;

end;

procedure TFMain. actEXITExecute (Sender: TObject);

begin

FMain. Close;

end;

procedure TFMain. INGENIRESExecute (Sender: TObject);

begin

// Редактор инженеров

FEngineer. ShowModal;

end;

procedure TFMain. PrintExecute (Sender: TObject);

begin

// предпросмотр и печать

if N13. Checked then RvSystem1. DefaultDest: =rdPrinter;

if N14. Checked then RvSystem1. DefaultDest: =rdPreview;

RvProject1. Execute;

end;

procedure TFMain. FormShow (Sender: TObject);

begin

{if FMain. Tag=0 then

begin

FPassword: =TFPassword. Create (self);

FPassword. ShowModal;

end; }

{EndDate. Date: =Date ();

BeginDate. Date: =Date (); }

SortAct: =1;

GridWidth;

FMAin. WindowState: =wsMaximized;

LoadDate;

BeginDate. Enabled: =False;

EndDate. Enabled: =False;

end;

procedure TFMain. InitFormFFind;

begin

FFind. EFIO. Text: ='';

FFind. EMod. Text: ='';

FFind. EIMEI. Text: ='';

FFind. CStatus. Text: ='';

end;

procedure TFMain. ActUpdateExecute (Sender: TObject);

var

s: string;

begin

s: =ADOQuery1. Fields [0]. Text; // запоминание текущей записи

SaveSettings; // // // // // // // // *************************

ADOQuery1. Close;

// ADOQuery1. Open;

ADOQuery1. SQL. Clear;

if CheckBox1. Checked then

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) WHERE %s BETWEEN ''%s'' AND ''%s''', ['orb. datapriema',DateToStr (BeginDate. Date),DateToStr (EndDate. Date)]))

else

ADOQuery1. SQL. Add ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) ');

// ADOQuery1. ExecSQL;

ADOQuery1. Open;

GridWidth;

// ADOQuery1. Locate ('S/N',Edit1. Text, [loCaseInsensitive, loPartialKey]);

ADOQuery1. Locate ('ID',s, [loCaseInsensitive]);

end;

procedure TFMain. SortExecute (Sender: TObject);

begin

// Сортировка

SaveSettings; // // // **********************

case SortAct of

1: ActionList1. Actions [11]. Execute;

2: ActionList1. Actions [9]. Execute;

3: ActionList1. Actions [10]. Execute;

4: ActionList1. Actions [12]. Execute;

5: ActionList1. Actions [14]. Execute;

6: ActionList1. Actions [13]. Execute;

end;

end;

procedure TFMain. SortDatePriemaExecute (Sender: TObject);

var

s: string;

begin

s: =ADOQuery1. Fields [0]. Text; // запоминание текущей записи

// Сортировка по дате приёма

ADOQuery1. Close;

ADOQuery1. SQL. Clear;

if CheckBox1. Checked then

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) '+'WHERE %s BETWEEN ''%s'' AND ''%s''', ['orb. datapriema',DateToStr (BeginDate. Date),DateToStr (EndDate. Date)]) +'ORDER BY datapriema')

else

ADOQuery1. SQL. Add ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) ORDER BY datapriema ');

ADOQuery1. Open;

GridWidth;

SortAct: =2;

PMFIO. Checked: =False;

PMENGFIO. Checked: =False;

PMNumber. Checked: =False;

PMStatus. Checked: =False;

PMModel. Checked: =False;

PMDate. Checked: =True;

ADOQuery1. Locate ('ID',s, [loCaseInsensitive]);

end;

procedure TFMain. SortStatusExecute (Sender: TObject);

var

s: string;

begin

s: =ADOQuery1. Fields [0]. Text; // запоминание текущей записи

// Сортировка по статусу

ADOQuery1. Close;

ADOQuery1. SQL. Clear;

if CheckBox1. Checked then

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) '+'WHERE %s BETWEEN ''%s'' AND ''%s''', ['orb. datapriema',DateToStr (BeginDate. Date),DateToStr (EndDate. Date)]) +'ORDER BY STATUS')

else

ADOQuery1. SQL. Add ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) ORDER BY STATUS ');

ADOQuery1. Open;

GridWidth;

SortAct: =3;

PMFIO. Checked: =False;

PMENGFIO. Checked: =False;

PMDate. Checked: =False;

PMNumber. Checked: =False;

PMModel. Checked: =False;

PMStatus. Checked: =True;

ADOQuery1. Locate ('ID',s, [loCaseInsensitive]);

end;

procedure TFMain. SortByIDExecute (Sender: TObject);

var

s: string;

begin

s: =ADOQuery1. Fields [0]. Text; // запоминание текущей записи

// Сортировать по номеру заказа

ADOQuery1. Close;

ADOQuery1. SQL. Clear;

if CheckBox1. Checked then

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) '+'WHERE %s BETWEEN ''%s'' AND ''%s''', ['orb. datapriema',DateToStr (BeginDate. Date),DateToStr (EndDate. Date)]) +'ORDER BY 1')

else

ADOQuery1. SQL. Add ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) ORDER BY 1 ');

ADOQuery1. Open;

GridWidth;

PMFIO. Checked: =False;

PMENGFIO. Checked: =False;

PMDate. Checked: =False;

PMStatus. Checked: =False;

PMModel. Checked: =False;

PMNumber. Checked: =True;

SortAct: =1;

ADOQuery1. Locate ('ID',s, [loCaseInsensitive]);

end;

procedure TFMain. SortByFIOExecute (Sender: TObject);

var

s: string;

begin

s: =ADOQuery1. Fields [0]. Text; // запоминание текущей записи

// Сортировать по фамилии клиента

ADOQuery1. Close;

ADOQuery1. SQL. Clear;

if CheckBox1. Checked then

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) '+'WHERE %s BETWEEN ''%s'' AND ''%s''', ['orb. datapriema',DateToStr (BeginDate. Date),DateToStr (EndDate. Date)]) +'ORDER BY 3')

else

ADOQuery1. SQL. Add ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) ORDER BY 3 ');

ADOQuery1. Open;

GridWidth;

SortAct: =4;

PMNumber. Checked: =False;

PMENGFIO. Checked: =False;

PMDate. Checked: =False;

PMStatus. Checked: =False;

PMModel. Checked: =False;

PMFIO. Checked: =True;

ADOQuery1. Locate ('ID',s, [loCaseInsensitive]);

end;

procedure TFMain. SortByENGFIOExecute (Sender: TObject);

var

s: string;

begin

s: =ADOQuery1. Fields [0]. Text; // запоминание текущей записи

// Сортировать по фамилии инженера

ADOQuery1. Close;

ADOQuery1. SQL. Clear;

if CheckBox1. Checked then

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) '+'WHERE %s BETWEEN ''%s'' AND ''%s''', ['orb. datapriema',DateToStr (BeginDate. Date),DateToStr (EndDate. Date)]) +'ORDER BY ENG_FIO')

else

ADOQuery1. SQL. Add ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) ORDER BY ENG_FIO ');

ADOQuery1. Open;

GridWidth;

SortAct: =6;

PMFIO. Checked: =False;

PMNumber. Checked: =False;

PMDate. Checked: =False;

PMStatus. Checked: =False;

PMModel. Checked: =False;

PMENGFIO. Checked: =True;

ADOQuery1. Locate ('ID',s, [loCaseInsensitive]);

end;

procedure TFMain. SortByModelExecute (Sender: TObject);

var

s: string;

begin

s: =ADOQuery1. Fields [0]. Text; // запоминание текущей записи

// Сортировать по модели телефона

ADOQuery1. Close;

ADOQuery1. SQL. Clear;

if CheckBox1. Checked then

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) '+'WHERE %s BETWEEN ''%s'' AND ''%s''', ['orb. datapriema',DateToStr (BeginDate. Date),DateToStr (EndDate. Date)]) +'ORDER BY Model')

else

ADOQuery1. SQL. Add ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) ORDER BY Model ');

ADOQuery1. Open;

GridWidth;

SortAct: =5;

PMFIO. Checked: =False;

PMENGFIO. Checked: =False;

PMDate. Checked: =False;

PMStatus. Checked: =False;

PMNumber. Checked: =False;

PMModel. Checked: =True;

ADOQuery1. Locate ('ID',s, [loCaseInsensitive]);

end;

procedure TFMain. ChooseExecute (Sender: TObject);

var

FieldName,FieldText: String;

begin

// Выбор

SaveSettings; // *****************

FieldName: =DBGrid1. SelectedField. FieldName;

FieldText: =DBGrid1. SelectedField. Text;

ADOQuery1. Close;

ADOQuery1. SQL. Clear;

if (FieldName='ID') or (FieldName='FIO') then

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) WHERE %s=''%s''', ['orb. '+FieldName,FieldText]));

if FieldName= ('ENG_FIO') then

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) WHERE %s=''%s''', ['ENG. FIO',FieldText]));

if (FieldName <>'ID') and (FieldName<>'ENG_FIO') and (FieldName<>'FIO') then

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) WHERE %s=''%s''', [FieldName,FieldText]));

ADOQuery1. Open;

GridWidth;

end;

procedure TFMain. DBGrid1DblClick (Sender: TObject);

begin

ActionList1. Actions [15]. Execute;

end;

procedure TFMain. BeginDateChange (Sender: TObject);

var

FieldName,FieldText: String;

begin

// Выбор

FieldName: =DBGrid1. SelectedField. FieldName;

FieldText: =DBGrid1. SelectedField. Text;

// ADOQuery1. Close;

ADOQuery1. SQL. Clear;

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) WHERE %s BETWEEN ''%s'' AND ''%s''', ['orb. datapriema',DateToStr (BeginDate. Date),DateToStr (EndDate. Date)]));

ADOQuery1. Open;

GridWidth;

ADOQuery1. Last;

end;

procedure TFMain. EndDateChange (Sender: TObject);

var

FieldName,FieldText: String;

begin

// Выбор

FieldName: =DBGrid1. SelectedField. FieldName;

FieldText: =DBGrid1. SelectedField. Text;

// ADOQuery1. Close;

ADOQuery1. SQL. Clear;

ADOQuery1. SQL. Add (Format ('SELECT orb. *, ENG. FIO as ENG_FIO, KOM. Komplektnost as Komplektnost, STA. STATUS as STATUS FROM ( (ORBITAS orb left join ENGINEER ENG on orb. R_ENGINEER = ENG. id) '+

' left join KOMPLEKTNOST KOM on orb. R_Komplektnost = KOM. id left join STATUS STA on orb. R_STATUS = STA. id) WHERE %s BETWEEN ''%s'' AND ''%s''', ['orb. datapriema',DateToStr (BeginDate. Date),DateToStr (EndDate. Date)]));

ADOQuery1. Open;

GridWidth;

ADOQuery1. Last;

end;

{var

f: TForm;

begin

f: = Dialogs. CreateMessageDialog ('Удалить выделенную запись? ', dialogs. mtConfirmation, [mbYes, mbNo]);

f. Caption: ='Удаление записи'; }

procedure TFMain. ActPrintExecute (Sender: TObject);

begin

TBPrint. ImageIndex: =4;

RvSystem1. DefaultDest: =rdPrinter;

RvProject1. Execute;

N13. Checked: =True;

N14. Checked: =False;

TBPrint. Hint: ='Печать';

end;

procedure TFMain. ActPreviewExecute (Sender: TObject);

begin

TBPrint. ImageIndex: =10;

RvSystem1. DefaultDest: =rdPreview;

RvProject1. Execute;

N14. Checked: =True;

N13. Checked: =False;

TBPrint. Hint: ='Предпросмотр';

end;

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

begin

SaveSettings;

end;

procedure TFMain. ActEndExecute (Sender: TObject);

begin

ADOQuery1. Last;

end;

procedure TFMain. ActHomeExecute (Sender: TObject);

begin

ADOQuery1. First;

end;

procedure TFMain. CheckBox1Click (Sender: TObject);

begin

if CheckBox1. Checked then

begin

BeginDate. Enabled: =True;

EndDate. Enabled: =True;

end else

begin

BeginDate. Enabled: =False;

EndDate. Enabled: =False;

end;

end;

procedure TFMain. N27Click (Sender: TObject);

begin

AboutBox. ShowModal;

end;

procedure TFMain. FormCreate (Sender: TObject);

{var

RInf: TIniFile;

NSK,p: string;

dt: TDate;

day: integer; }

begin

{ RInf: =TIniFile. Create ('Rconf. ini');

NSK: =RInf. ReadString ('SK','NSK',NSK);

p: =RInf. ReadString ('SK','p',p);

dt: =RInf. ReadDate ('SK','dt',dt);

day: =RInf. ReadInteger ('SK','day',day);

if Date>=StrToDate ('10.09.06') then

begin

if p='ljkkfh' then exit else

begin

WriteEndUse;

IsReg;

end;

end;

if NSK<>'Trial'then

begin

ShowMessage ('Время использования пробной версии программы истекло'

+#13+'для получения полной версии обратитесь к разработчикам');

Application. Terminate;

end;

if dt<>Date then

begin

day: =day+1;

RInf. WriteInteger ('SK','day',day);

RInf. WriteDate ('SK','dt',Date);

RInf. Free;

end;

if day>=23 then

begin

ShowMessage ('Время использования пробной версии программы истекло'

+#13+'для получения полной версии обратитесь к разработчикам');

Application. Terminate;

end; }

FSettings. ButtonsVisibleLoad;

end;

procedure TFMain. N29Click (Sender: TObject);

begin

FSettings. ShowModal;

end;

procedure TFMain. FSBClick (Sender: TObject);

begin

if ADOQuery1. Locate ('ID',FEdit. Text, [loCaseInsensitive])

then TBEdit. Click

else ShowMessage ('Запись не найдена');

end;

procedure TFMain. FEditKeyDown (Sender: TObject; var Key: Word;

Shift: TShiftState);

begin

if key=13 then FSB. Click;

end;

procedure TFMain. FEditKeyPress (Sender: TObject; var Key: Char);

begin

if (Key<>'0') and (Key<>'1') and (Key<>'2') and (Key<>'3')

and (Key<>'4') and (Key<>'5') and (Key<>'6') and (Key<>'7')

and (Key<>'8') and (Key<>'9') and (key<>#08) and (key<>'2E')

then key: =#0;

end;

procedure TFMain. DBGrid1MouseDown (Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

// if (Button = mbRight) then Showmessage ('! '); TBEdit. Click;

end;

procedure TFMain. JanHDBGrid1DblClick (Sender: TObject);

begin

ActionList1. Actions [15]. Execute;

end;

end.

unit Unit2;

interface

uses

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

Dialogs, StdCtrls, Buttons, ExtCtrls;

type

TFAddEngineer = class (TForm)

Panel1: TPanel;

EAddEngineer: TLabeledEdit;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

procedure BitBtn1Click (Sender: TObject);

procedure BitBtn2Click (Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

FAddEngineer: TFAddEngineer;

implementation

uses Unit5, Unit1;

{$R *. dfm}

procedure TFAddEngineer. BitBtn1Click (Sender: TObject);

begin

// FAddEngineer. Close;

end;

procedure TFAddEngineer. BitBtn2Click (Sender: TObject);

begin

// INSERT INTO Engineer VALUE ('1','Привет');

// Fmain. ADOQuery1. SQL. Add ('INSERT INTO Engineer VALUE (1, Привет') ');

// Insert (Engineer);

end;

end.

unit Unit3;

interface

uses

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

Dialogs, StdCtrls, ComCtrls, ExtCtrls, Buttons;

type

TFAdd = class (TForm)

Panel1: TPanel;

Status: TGroupBox;

LStatTel: TLabel;

ENumberOrder: TLabeledEdit;

CStatus: TComboBox;

Phone: TGroupBox;

LKompl: TLabel;

LDateR: TLabel;

LDateD: TLabel;

Label1: TLabel;

Label2: TLabel;

Emodel: TLabeledEdit;

ESN: TLabeledEdit;

EIMEI: TLabeledEdit;

ESNBat: TLabeledEdit;

CKompl: TComboBox;

DateDelivery: TDateTimePicker;

CEngeneer: TComboBox;

ENeisp: TLabeledEdit;

ECost: TLabeledEdit;

EZam: TLabeledEdit;

DateReception: TDateTimePicker;

DatePokupki: TDateTimePicker;

Klient: TGroupBox;

EFIO: TLabeledEdit;

Etel: TLabeledEdit;

EAdres: TLabeledEdit;

BitBtn3: TBitBtn;

BitBtn2: TBitBtn;

BitBtn1: TBitBtn;

EPrim: TLabeledEdit;

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

procedure BitBtn3Click (Sender: TObject);

procedure FormShow (Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

FAdd: TFAdd;

PrintAct: Boolean; // для печати

implementation

uses Unit1;

{$R *. dfm}

procedure TFAdd. EIMEIKeyPress (Sender: TObject; var Key: Char);

begin

if (Key<>'0') and (Key<>'1') and (Key<>'2') and (Key<>'3')

and (Key<>'4') and (Key<>'5') and (Key<>'6') and (Key<>'7')

and (Key<>'8') and (Key<>'9') and (key<>#08) and (key<>'2E')

then key: =#0;

if ( (Length (EIMEI. Text)) =15) and (key<>#08) and (key<>'2E') then Key: = #0;

end;

procedure TFAdd. BitBtn3Click (Sender: TObject);

begin

PrintAct: =True;

BitBtn1. Click;

end;

procedure TFAdd. FormShow (Sender: TObject);

begin

PrintAct: =False;

end;

end.

unit Unit4;

interface

uses

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

Dialogs, ExtCtrls, Buttons, StdCtrls, ADODB, UComboBox;

type

TFFind = class (TForm)

Panel1: TPanel;

CheckBox1: TCheckBox;

EFIO: TEdit;

CheckBox2: TCheckBox;

EMod: TEdit;

CheckBox3: TCheckBox;

EIMEI: TEdit;

CheckBox4: TCheckBox;

Label1: TLabel;

CStatus: TComboBox;

BtFind: TBitBtn;

BtCancel: TBitBtn;

procedure BtCancelClick (Sender: TObject);

procedure BtFindClick (Sender: TObject);

procedure FormCreate (Sender: TObject);

procedure CheckBox1Click (Sender: TObject);

procedure CheckBox2Click (Sender: TObject);

procedure CheckBox3Click (Sender: TObject);

procedure CheckBox4Click (Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

FFind: TFFind;

implementation

uses Unit1;

{$R *. dfm}

procedure TFFind. BtCancelClick (Sender: TObject);

begin

FFind. Close;

end;

procedure TFFind. BtFindClick (Sender: TObject);

begin

// Поиск

end;

procedure TFFind. FormCreate (Sender: TObject);

var

quSelect: TADOQuery;

begin

// загружаем статусы телефонов в комбо бокс для поиска

quSelect: = TADOQuery. Create (Self);

quSelect. Connection: = FMain. Password;

quSelect. SQL. Clear;

quSelect. Close;

quSelect. SQL. Add ('select * from STATUS');

quSelect. Open;

LoadIDComboBox (CStatus, quSelect, 'ID', 'Status');

quSelect. Close;

quSelect. Free;

end;

procedure TFFind. CheckBox1Click (Sender: TObject);

begin

if not CheckBox1. Checked then

begin

EFIO. Text: ='';

EFIO. Enabled: =False;

end else EFIO. Enabled: =True;

end;

procedure TFFind. CheckBox2Click (Sender: TObject);

begin

if not CheckBox2. Checked then

begin

EMod. Text: ='';

EMod. Enabled: =False;

end else EMod. Enabled: =True;

end;

procedure TFFind. CheckBox3Click (Sender: TObject);

begin

if not CheckBox3. Checked then

begin

EIMEI. Text: ='';

EIMEI. Enabled: =False;

end else EIMEI. Enabled: =True;

end;

procedure TFFind. CheckBox4Click (Sender: TObject);

begin

if not CheckBox4. Checked then

begin

CStatus. Text: ='';

CStatus. Enabled: =False;

end else CStatus. Enabled: =True;

end;

end.

unit Unit5;

interface

uses

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

Dialogs, Grids, DBGrids, Menus, ComCtrls, ToolWin, ExtCtrls, DB, ADODB,

ActnList, StdCtrls, Buttons, IniFiles, JanHDBGrid;

type

TFEngineer = class (TForm)

Panel2: TPanel;

MainMenu1: TMainMenu;

N1: TMenuItem;

N2: TMenuItem;

N3: TMenuItem;

N4: TMenuItem;

N5: TMenuItem;

ADOQuery1: TADOQuery;

DataSource1: TDataSource;

ActionList1: TActionList;

ADD: TAction;

EDIT: TAction;

DEL: TAction;

ActEXIT: TAction;

BitBtn1: TBitBtn;

Panel1: TPanel;

Panel3: TPanel;

ToolBar1: TToolBar;

TBAdd: TToolButton;

TBEdit: TToolButton;

TBDelete: TToolButton;

DataSource2: TDataSource;

ADOQuery2: TADOQuery;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

DBGrid1: TJanHDBGrid;

DBGrid2: TJanHDBGrid;

procedure FormShow (Sender: TObject);

procedure ADDExecute (Sender: TObject);

procedure EDITExecute (Sender: TObject);

procedure DELExecute (Sender: TObject);

procedure ActEXITExecute (Sender: TObject);

procedure DBGrid1DblClick (Sender: TObject);

procedure JanHDBGrid1DblClick (Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

procedure GridWidth;

procedure GridInfoWidth;

procedure SaveSettings;

procedure LoadSettings;

procedure LoadInfoSettings;

procedure SaveInfoSettings;

end;

var

FEngineer: TFEngineer;

ConfFile: TIniFile;

implementation

uses Unit1, Unit2;

{$R *. dfm}

procedure TFEngineer. SaveInfoSettings;

begin

ConfFile: =TIniFile. Create (ExtractFilePath (Application. ExeName) +'DBconfig. ini');

ConfFile. WriteInteger ('INFO_GridColumns','Column0',DBGrid2. Columns [0]. Width);

ConfFile. WriteInteger ('INFO_GridColumns','Column1',DBGrid2. Columns [1]. Width);

ConfFile. WriteInteger ('INFO_GridColumns','Column2',DBGrid2. Columns [2]. Width);

ConfFile. Free;

end;

procedure TFEngineer. LoadInfoSettings;

begin

ConfFile: =TIniFile. Create (ExtractFilePath (Application. ExeName) +'DBconfig. ini');

DBGrid2. Columns [0]. Width: =ConfFile. ReadInteger ('INFO_GridColumns','Column0',DBGrid2. Columns [0]. Width);

DBGrid2. Columns [1]. Width: =ConfFile. ReadInteger ('INFO_GridColumns','Column1',DBGrid2. Columns [1]. Width);

DBGrid2. Columns [2]. Width: =ConfFile. ReadInteger ('INFO_GridColumns','Column2',DBGrid2. Columns [2]. Width);

DBGrid2. Columns [0]. Title. Caption: ='Статус';

DBGrid2. Columns [1]. Title. Caption: ='Модель';

DBGrid2. Columns [2]. Title. Caption: ='IMEI';

ConfFile. Free;

end;

procedure TFEngineer. SaveSettings;

begin

ConfFile: =TIniFile. Create (ExtractFilePath (Application. ExeName) +'DBconfig. ini');

ConfFile. WriteInteger ('ENG_GridColumns','Column1',DBGrid1. Columns [1]. Width);

ConfFile. Free;

end;

procedure TFEngineer. LoadSettings;

begin

ConfFile: =TIniFile. Create (ExtractFilePath (Application. ExeName) +'DBconfig. ini');

DBGrid1. Columns [1]. Width: =ConfFile. ReadInteger ('ENG_GridColumns','Column1',DBGrid1. Columns [1]. Width);

ConfFile. Free;

end;

procedure TFEngineer. GridWidth;

begin

DBGrid1. Columns [0]. Visible: =False;

// DBGrid1. Columns [1]. Width: =280;

DBGrid1. Columns [1]. Title. Caption: ='Ф. И.О. ';

LoadSettings;

end;

procedure TFEngineer. FormShow (Sender: TObject);

var

quCount: TADOQuery;

begin

// Подсчет количества телефонов всёго

quCount: = TADOQuery. Create (Self);

quCount. Connection: = FMain. Password;

quCount. Close;

quCount. SQL. Text: = ('SELECT COUNT (R_STATUS) FROM ORBITAS WHERE ORBITAS. R_STATUS=4');

quCount. Open;

Label5. Caption: ='Всёго телефонов отремонтировано: '+quCount. Fields [0]. AsString;

quCount. ExecSQL;

quCount. Close;

quCount. Free;

GridWidth;

{DBGrid1. Columns [0]. Visible: =False;

DBGrid1. Columns [1]. Width: =280; }

end;

procedure TFEngineer. ADDExecute (Sender: TObject);

var

quInsert: TADOQuery;

begin

// Добавление инженера

SaveSettings; // // // ****************

FAddEngineer. Caption: ='Добавление инженера';

FAddEngineer. EAddEngineer. Text: ='';

try

quInsert: = TADOQuery. Create (Self);

quInsert. Connection: = FMain. Password;

quInsert. Close;

if FAddEngineer. ShowModal = mrOk then

begin

quInsert. Close;

quInsert. SQL. Clear; // [datavidachi]

quInsert. SQL. Add ('insert into ENGINEER ([FIO]) values ('''+

Trim (FAddEngineer. EAddEngineer. Text) +''') ');

quInsert. ExecSQL;

end;

finally

quInsert. Close;

quInsert. Free;

ADOQuery1. Close;

ADOQuery1. Open;

end;

GridWidth;

{DBGrid1. Columns [0]. Visible: =False;

DBGrid1. Columns [1]. Width: =280; }

end;

procedure TFEngineer. EDITExecute (Sender: TObject);

var

quUpdate: TADOQuery;

begin

// Изменение инженера

SaveSettings; // // // **********************

FAddEngineer. Caption: ='Изменение инженера';

FAddEngineer. EAddEngineer. Text: = ADOQuery1. FieldByName ('FIO'). AsString;

If FAddEngineer. ShowModal <> mrOk then exit;

quUpdate: = TADOQuery. Create (Self);

quUpdate. Connection: = FMain. Password;

quUpdate. Close;

quUpdate. SQL. Add ('update ENGINEER set FIO = ''' +Trim (FAddEngineer. EAddEngineer. Text) + ''' where ID = ' + ADOQuery1. FieldByName ('ID'). AsString);

quUpdate. ExecSQL;

quUpdate. Close;

quUpdate. Free;

ADOQuery1. Close;

ADOQuery1. Open;

GridWidth;

end;

procedure TFEngineer. DELExecute (Sender: TObject);

var

quDelete: TADOQuery;

begin

// Удаление иженера

SaveSettings; // // // ****************

If Application. MessageBox ('Удалить выделенную запись? ','Удаление записи',MB_YESNO + MB_ICONQUESTION) <> mrYes then exit;

quDelete: = TADOQuery. Create (Self);

quDelete. Connection: = FMain. Password;

quDelete. Close;

quDelete. SQL. Add ('delete from ENGINEER where ID = ' + ADOQuery1. FieldByName ('ID'). AsString);

quDelete. ExecSQL;

quDelete. Close;

quDelete. Free;

ADOQuery1. Close;

ADOQuery1. Open;

{DBGrid1. Columns [0]. Visible: =False;

DBGrid1. Columns [1]. Width: =280; }

GridWidth;

end;

procedure TFEngineer. ActEXITExecute (Sender: TObject);

begin

FEngineer. Close;

end;

procedure TFEngineer. DBGrid1DblClick (Sender: TObject);

var

ID: string;

quCount: TADOQuery;

begin

// SaveInfoSettings; // /*******************

// * ВЫВОД ТЕЛЕФОНОВ И СТАТУСОВ ДЛЯ КАЖДОГО ИНЖЕНЕРА

ID: =ADOQuery1. FieldByName ('ID'). AsString;

ADOQuery2. SQL. Clear;

ADOQuery2. Close;

ADOQuery2. SQL. Add ('SELECT STATUS. STATUS, ORBITAS. MODEL, ORBITAS. IMEI FROM ORBITAS, STATUS WHERE (ORBITAS. R_STATUS IN (1,2,3)) AND (STATUS. ID=ORBITAS. R_STATUS) ' +'AND'+' (ORBITAS. R_ENGINEER='+ID+') ');

// ADOQuery2. Active: =True;

// ADOQuery2. ExecSQL;

// ADOQuery2. Close;

ADOQuery2. Open;

// GridInfoWidth;

// Подсчет количества телефонов для каждого инженера и вывод в Label

// Подсчет количества телефонов всёго

quCount: = TADOQuery. Create (Self);

quCount. Connection: = FMain. Password;

quCount. Close;

quCount. SQL. Text: = ('SELECT COUNT (R_STATUS) FROM ORBITAS, STATUS WHERE ( (ORBITAS. R_STATUS=1) OR (ORBITAS. R_STATUS=2) OR (ORBITAS. R_STATUS=3)) AND (STATUS. ID=ORBITAS. R_STATUS) ' +'AND'+' (ORBITAS. R_ENGINEER='+ID+') ');

quCount. Open;

Label1. Caption: ='Всёго телефонов в ремонте: '+quCount. Fields [0]. AsString;

quCount. Close;

// Подсчет количества телефонов принятых в ремонт

quCount. SQL. Text: = ('SELECT COUNT (R_STATUS) FROM ORBITAS, STATUS WHERE (ORBITAS. R_STATUS=1) AND (STATUS. ID=ORBITAS. R_STATUS) ' +'AND'+' (ORBITAS. R_ENGINEER='+ID+') ');

quCount. Open;

Label2. Caption: ='Принято в ремонт: '+quCount. Fields [0]. AsString;

quCount. Close;

// Подсчет количества телефонов тестовый прогон

quCount. SQL. Text: = ('SELECT COUNT (R_STATUS) FROM ORBITAS, STATUS WHERE (ORBITAS. R_STATUS=2) AND (STATUS. ID=ORBITAS. R_STATUS) ' +'AND'+' (ORBITAS. R_ENGINEER='+ID+') ');

quCount. Open;

Label3. Caption: ='Тестовый прогон: '+quCount. Fields [0]. AsString;

quCount. Close;

// Подсчет количества телефонов ожидание деталеё

quCount. SQL. Text: = ('SELECT COUNT (R_STATUS) FROM ORBITAS, STATUS WHERE (ORBITAS. R_STATUS=3) AND (STATUS. ID=ORBITAS. R_STATUS) ' +'AND'+' (ORBITAS. R_ENGINEER='+ID+') ');

quCount. Open;

Label4. Caption: ='Ожидание деталей: '+quCount. Fields [0]. AsString;

// // // // // quCount. ExecSQL;

quCount. Close;

quCount. Free;

LoadInfoSettings;

// GridInfoWidth;

end;

procedure TFEngineer. GridInfoWidth;

begin

{DBGrid2. Columns [0]. Title. Caption: ='Статус';

DBGrid2. Columns [1]. Title. Caption: ='Модель';

DBGrid2. Columns [2]. Title. Caption: ='IMEI'; }

end;

procedure TFEngineer. JanHDBGrid1DblClick (Sender: TObject);

var

ID: string;

quCount: TADOQuery;

begin

// SaveInfoSettings; // /*******************

// * ВЫВОД ТЕЛЕФОНОВ И СТАТУСОВ ДЛЯ КАЖДОГО ИНЖЕНЕРА

ID: =ADOQuery1. FieldByName ('ID'). AsString;

ADOQuery2. SQL. Clear;

ADOQuery2. Close;

ADOQuery2. SQL. Add ('SELECT STATUS. STATUS, ORBITAS. MODEL, ORBITAS. IMEI FROM ORBITAS, STATUS WHERE (ORBITAS. R_STATUS IN (1,2,3)) AND (STATUS. ID=ORBITAS. R_STATUS) ' +'AND'+' (ORBITAS. R_ENGINEER='+ID+') ');

// ADOQuery2. Active: =True;

// ADOQuery2. ExecSQL;

// ADOQuery2. Close;

ADOQuery2. Open;

// GridInfoWidth;

// Подсчет количества телефонов для каждого инженера и вывод в Label

// Подсчет количества телефонов всёго

quCount: = TADOQuery. Create (Self);

quCount. Connection: = FMain. Password;

quCount. Close;

quCount. SQL. Text: = ('SELECT COUNT (R_STATUS) FROM ORBITAS, STATUS WHERE ( (ORBITAS. R_STATUS=1) OR (ORBITAS. R_STATUS=2) OR (ORBITAS. R_STATUS=3)) AND (STATUS. ID=ORBITAS. R_STATUS) ' +'AND'+' (ORBITAS. R_ENGINEER='+ID+') ');

quCount. Open;

Label1. Caption: ='Всёго телефонов в ремонте: '+quCount. Fields [0]. AsString;

quCount. Close;

// Подсчет количества телефонов принятых в ремонт

quCount. SQL. Text: = ('SELECT COUNT (R_STATUS) FROM ORBITAS, STATUS WHERE (ORBITAS. R_STATUS=1) AND (STATUS. ID=ORBITAS. R_STATUS) ' +'AND'+' (ORBITAS. R_ENGINEER='+ID+') ');

quCount. Open;

Label2. Caption: ='Принято в ремонт: '+quCount. Fields [0]. AsString;

quCount. Close;

// Подсчет количества телефонов тестовый прогон

quCount. SQL. Text: = ('SELECT COUNT (R_STATUS) FROM ORBITAS, STATUS WHERE (ORBITAS. R_STATUS=2) AND (STATUS. ID=ORBITAS. R_STATUS) ' +'AND'+' (ORBITAS. R_ENGINEER='+ID+') ');

quCount. Open;

Label3. Caption: ='Тестовый прогон: '+quCount. Fields [0]. AsString;


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

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