diff --git a/LegalProgram.lps b/LegalProgram.lps index ec3df28..25ffffb 100644 --- a/LegalProgram.lps +++ b/LegalProgram.lps @@ -19,8 +19,9 @@ - - + + + @@ -34,7 +35,7 @@ - + @@ -82,9 +83,9 @@ - + - + @@ -95,7 +96,7 @@ - + @@ -103,11 +104,10 @@ - - - - + + + @@ -121,7 +121,7 @@ - + @@ -443,123 +443,123 @@ - + - + - - + + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - + - + - + - - + + diff --git a/Lpro.db b/Lpro.db index 027d12e..260f28e 100644 Binary files a/Lpro.db and b/Lpro.db differ diff --git a/Lpro.exe b/Lpro.exe index 55bf0af..cc71af1 100644 Binary files a/Lpro.exe and b/Lpro.exe differ diff --git a/Setup.iss b/Setup.iss index f9d376e..2928b9f 100644 --- a/Setup.iss +++ b/Setup.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "Lpro" -#define MyAppVersion "1.4.4" +#define MyAppVersion "1.4.5" #define MyAppPublisher "." #define MyAppURL "https://./" #define MyAppExeName "Lpro.exe" @@ -21,10 +21,10 @@ AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={pf}\{#MyAppName} DisableProgramGroupPage=yes -LicenseFile=D:\Public\lpro\Lpro 1.4.4\GPL.txt +LicenseFile=D:\Public\lpro\Lpro 1.4.5\GPL.txt OutputDir=C:\Users\MrKaban\Desktop OutputBaseFilename=Lpro -SetupIconFile=D:\Public\lpro\Lpro 1.4.4\Lpro.ico +SetupIconFile=D:\Public\lpro\Lpro 1.4.5\Lpro.ico Compression=lzma SolidCompression=yes @@ -36,19 +36,19 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{ Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1 [Files] -Source: "D:\Public\lpro\Lpro 1.4.4\Lpro.exe"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\base.txt"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\GPL.txt"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\libeay32.dll"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\Lpro.db"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\Lpro.exe"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\Lpro.ico"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\prog.txt"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\sqlite3.def"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\sqlite3.dll"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\ssleay32.dll"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\update.exe"; DestDir: "{app}"; Flags: ignoreversion -Source: "D:\Public\lpro\Lpro 1.4.4\help\*"; DestDir: "{app}/help"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "D:\Public\lpro\Lpro 1.4.5\Lpro.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\base.txt"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\GPL.txt"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\libeay32.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\Lpro.db"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\Lpro.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\Lpro.ico"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\prog.txt"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\sqlite3.def"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\sqlite3.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\ssleay32.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\update.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\Public\lpro\Lpro 1.4.5\help\*"; DestDir: "{app}/help"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] diff --git a/base.txt b/base.txt index 1b4ac95..14a86e1 100644 --- a/base.txt +++ b/base.txt @@ -1 +1 @@ -20170623 \ No newline at end of file +20170919 \ No newline at end of file diff --git a/main.lfm b/main.lfm index dc2fa9e..ca9e78f 100644 --- a/main.lfm +++ b/main.lfm @@ -65,7 +65,7 @@ object fMian: TfMian Style = tbsSeparator end object ToolButton2: TToolButton - Left = 103 + Left = 126 Height = 22 Top = 2 Width = 8 @@ -73,7 +73,7 @@ object fMian: TfMian Style = tbsSeparator end object panBeginSerch: TToolButton - Left = 111 + Left = 134 Hint = 'Начать поиск' Top = 2 Caption = 'Начать поиск' @@ -81,7 +81,7 @@ object fMian: TfMian MenuItem = mBeginSerch end object panOchistit: TToolButton - Left = 134 + Left = 157 Hint = 'Очистить таблицу' Top = 2 Caption = 'Очистить' @@ -89,7 +89,7 @@ object fMian: TfMian MenuItem = mOchistit end object panPoiskVBaze: TToolButton - Left = 157 + Left = 180 Hint = 'Поиск в базе' Top = 2 Caption = 'Поиск в базе' @@ -97,7 +97,7 @@ object fMian: TfMian MenuItem = mPoiskVBaze end object panPodborZameni: TToolButton - Left = 180 + Left = 203 Hint = 'Подобрать замену' Top = 2 Caption = 'Подобрать замену' @@ -105,7 +105,7 @@ object fMian: TfMian MenuItem = mPodborZameni end object ToolButton3: TToolButton - Left = 226 + Left = 249 Height = 22 Top = 2 Width = 8 @@ -113,7 +113,7 @@ object fMian: TfMian Style = tbsSeparator end object panSort00: TToolButton - Left = 234 + Left = 257 Hint = 'Сортировать по названию' Top = 2 Caption = 'Сортировать по названию' @@ -121,7 +121,7 @@ object fMian: TfMian MenuItem = mSort00 end object panSort01: TToolButton - Left = 257 + Left = 280 Hint = 'Сортировать по типу' Top = 2 Caption = 'Сортировать по типу' @@ -129,7 +129,7 @@ object fMian: TfMian MenuItem = mSort01 end object panSort02: TToolButton - Left = 280 + Left = 303 Hint = 'Сортировать по лицензии' Top = 2 Caption = 'Сортировать по лицензии' @@ -137,7 +137,7 @@ object fMian: TfMian MenuItem = mSort02 end object panSort03: TToolButton - Left = 303 + Left = 326 Hint = 'Сортировать по стоимости' Top = 2 Caption = 'Сортировать по стоимости' @@ -145,7 +145,7 @@ object fMian: TfMian MenuItem = mSort03 end object panSort04: TToolButton - Left = 326 + Left = 349 Hint = 'Сортировать по замене' Top = 2 Caption = 'Сортировать по замене' @@ -153,7 +153,7 @@ object fMian: TfMian MenuItem = mSort04 end object ToolButton4: TToolButton - Left = 349 + Left = 372 Height = 22 Top = 2 Width = 8 @@ -161,7 +161,7 @@ object fMian: TfMian Style = tbsSeparator end object panAbout: TToolButton - Left = 380 + Left = 403 Hint = 'О программе' Top = 2 Caption = 'О программе' @@ -169,7 +169,7 @@ object fMian: TfMian MenuItem = mAbout end object panUpdateCheck: TToolButton - Left = 403 + Left = 426 Hint = 'Проверить обновление' Top = 2 Caption = 'Проверить обновление' @@ -177,7 +177,7 @@ object fMian: TfMian MenuItem = mUpdateCheck end object panHelp: TToolButton - Left = 357 + Left = 380 Hint = 'Справка' Top = 2 Caption = 'Справка' @@ -185,12 +185,20 @@ object fMian: TfMian MenuItem = mHelp end object ToolButton5: TToolButton - Left = 203 + Left = 226 Top = 2 Caption = 'Настройки' ImageIndex = 27 MenuItem = mSettings end + object ToolButton6: TToolButton + Left = 103 + Hint = 'Передача в LibreOffice' + Top = 2 + Caption = 'Передача в LibreOffice' + ImageIndex = 28 + MenuItem = mPeredatLibreOffice + end end object PageControl1: TPageControl Left = 0 @@ -225,6 +233,7 @@ object fMian: TfMian TabOrder = 0 OnCellClick = DBGrid1CellClick OnDrawColumnCell = DBGrid1DrawColumnCell + OnTitleClick = DBGrid1TitleClick end object Memo1: TMemo Left = 200 @@ -567,6 +576,7 @@ object fMian: TfMian Scrollbars = ssAutoBoth TabOrder = 0 OnDrawColumnCell = DBGrid2DrawColumnCell + OnTitleClick = DBGrid2TitleClick end object Panel1: TPanel Left = 0 @@ -846,6 +856,15 @@ object fMian: TfMian OnClick = bInstViewZamClick TabOrder = 12 end + object bInstpoSokrtiZapros: TButton + Left = 416 + Height = 25 + Top = 8 + Width = 120 + Caption = 'Сократить запрос' + OnClick = bInstpoSokrtiZaprosClick + TabOrder = 13 + end end object DBGrid3: TDBGrid Left = 232 @@ -1099,6 +1118,44 @@ object fMian: TfMian end object mPeredatLibreOffice: TMenuItem Caption = 'Передача в LibreOffice' + Bitmap.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000D4550000D455 + 00FFD45500FFD45500FFD45500FFD45500FFD45500FFD45500FFD45500FFD455 + 00FFD45500FFD45500FFD45500DD000000000000000000000000D35805FABC88 + 64FFBF8A67FFBF8A67FFBF8A67FFBF8A67FFBF8A67FFBF8A67FFBF8A67FFBF8A + 67FFBE8966FFC17847FFD45500E0000000000000000000000000D25907FAC3A3 + 8EFFDEAA87FFDEAA87FFDEAA87FFDEAA87FFDEAA87FFDEAA87FFDEAA87FFDEAA + 87FFD9A988FFB68A6BFFD45500E3000000000000000000000000D25907FAC3A3 + 8EFFDEAA87FFDEAA87FFDCA986FFC7AE95FFCCB49DFFCCB49DFFCCB49DFFCCB4 + 9DFFC8A88DFFB68B6EFFD45500E6000000000000000000000000D25907FAC3A3 + 8EFFDEAA87FFDEAA87FFD9A886FFF0F074FFEAE979FFA59B92FFD05586FFC074 + 41FFC6AF96FFB68C6FFFD55500EA000000000000000000000000D25907FAC3A3 + 8EFFF5C4AFFFFD8A80FFF68A7FFFECEB94FFE1E091FF999386FFF1CBDAFFB964 + 2CFFC6AD95FFB58D71FFD45500ED000000000000000000000000D25907FAC3A3 + 8EFFF8C1AEFFFF6560FFF86861FFE3E2DBFFDFDEDAFFB0ADA3FFFFFFFFFFEFDB + CEFFCBBEADFFB58E73FFD55500F0000000000000000000000000D25907FAC3A3 + 8EFFF8BFADFFFF4340FFFC4541FFD4978AFFD8988DFFD8AA9EFFD8988DFFD8A5 + 99FFCDB299FFB48E74FFD45500F3000000000000000000000000D25907FAC3A3 + 8EFFF8BDABFFFF3635FFFF3635FFFF4D4AFFFF2A2AFFFF726CFFFF2A2AFFFF57 + 53FFE5B99AFFB48F76FFD55500F6000000000000000000000000D25907FAC3A3 + 8EFFF8C1AEFFFF5955FFFF5955FFFF6C66FFFF504DFFFF857EFFFF504DFFFF74 + 6EFFDEB79CFFB88868FFD55500F6000000000000000000000000D25907FAC3A3 + 8EFFEEBBA3FFF69787FFF69787FFF5AA98FFF5A190FFF4AD9BFFF5A190FFF1AB + 9BFFC39A7EFFD25908F9D5540055000000000000000000000000D25907FAC3A3 + 8EFFDEAA87FFDEAA87FFDEAA87FFDEAA87FFDEAA87FFDEAA87FFD4A789FFBA8B + 6AFFD35805F4D4560047FF000001000000000000000000000000D25907FAC3A3 + 8EFFDEAA87FFDEAA87FFDEAA87FFDEAA87FFDEAA87FFD4A789FFBD8762FFD356 + 03EFD354003ACC55000FD35500B5000000000000000000000000D25907FAC3A3 + 8EFFDEAA87FFDEAA87FFDEAA87FFDEAA87FFD4A789FFBE8259FFD35501E7D457 + 002FD3590017D45500CED55500F6000000000000000000000000D35805FABC88 + 64FFBF8A67FFBF8A67FFBF8A67FFBF8A67FFC37947FFD45500DFD6530025D155 + 0021D45500DAD45500FFD45500F5000000000000000000000000D4550000D455 + 00FFD45500FFD45500FFD45500FFD45500FFD45500D6D152001CD1550021D455 + 00D7D45500EED45500E1D35500D3000000000000000000000000 + } + Hint = 'Передача в LibreOffice' + ImageIndex = 28 OnClick = mPeredatLibreOfficeClick end object mExit: TMenuItem @@ -2563,7 +2620,7 @@ object fMian: TfMian left = 80 top = 168 Bitmap = { - 4C691C000000100000001000000000000000000000000000000000000000A064 + 4C691D000000100000001000000000000000000000000000000000000000A064 3F5990664ACE7A6658F66C6662FE6A6562FE78675AF88E664CD49F633E620000 000000000000000000000000000000000000000000009D623B1A89664EDF6666 66FF666666FF666666FF666666FF666666FF666666FF666666FF666666FF8767 @@ -3459,7 +3516,39 @@ object fMian: TfMian 10FFF80404FF8F4B4B8B0000000066666605C12A2AE5FF0000FFBF2B2BFE6B6B 6B130000000000000000000000000000000000000000000000006262621A6964 64A5815454C38080800200000000000000007C5D5D297B5757DD666666827171 - 7109000000000000000000000000 + 7109000000000000000000000000D4550000D45500FFD45500FFD45500FFD455 + 00FFD45500FFD45500D6D152001CD1550021D45500D7D45500EED45500E1D355 + 00D3000000000000000000000000D35805FABC8864FFBF8A67FFBF8A67FFBF8A + 67FFBF8A67FFC37947FFD45500DFD6530025D1550021D45500DAD45500FFD455 + 00F5000000000000000000000000D25907FAC3A38EFFDEAA87FFDEAA87FFDEAA + 87FFDEAA87FFD4A789FFBE8259FFD35501E7D457002FD3590017D45500CED555 + 00F6000000000000000000000000D25907FAC3A38EFFDEAA87FFDEAA87FFDEAA + 87FFDEAA87FFDEAA87FFD4A789FFBD8762FFD35603EFD354003ACC55000FD355 + 00B5000000000000000000000000D25907FAC3A38EFFDEAA87FFDEAA87FFDEAA + 87FFDEAA87FFDEAA87FFDEAA87FFD4A789FFBA8B6AFFD35805F4D4560047FF00 + 0001000000000000000000000000D25907FAC3A38EFFEEBBA3FFF69787FFF697 + 87FFF5AA98FFF5A190FFF4AD9BFFF5A190FFF1AB9BFFC39A7EFFD25908F9D554 + 0055000000000000000000000000D25907FAC3A38EFFF8C1AEFFFF5955FFFF59 + 55FFFF6C66FFFF504DFFFF857EFFFF504DFFFF746EFFDEB79CFFB88868FFD555 + 00F6000000000000000000000000D25907FAC3A38EFFF8BDABFFFF3635FFFF36 + 35FFFF4D4AFFFF2A2AFFFF726CFFFF2A2AFFFF5753FFE5B99AFFB48F76FFD555 + 00F6000000000000000000000000D25907FAC3A38EFFF8BFADFFFF4340FFFC45 + 41FFD4978AFFD8988DFFD8AA9EFFD8988DFFD8A599FFCDB299FFB48E74FFD455 + 00F3000000000000000000000000D25907FAC3A38EFFF8C1AEFFFF6560FFF868 + 61FFE3E2DBFFDFDEDAFFB0ADA3FFFFFFFFFFEFDBCEFFCBBEADFFB58E73FFD555 + 00F0000000000000000000000000D25907FAC3A38EFFF5C4AFFFFD8A80FFF68A + 7FFFECEB94FFE1E091FF999386FFF1CBDAFFB9642CFFC6AD95FFB58D71FFD455 + 00ED000000000000000000000000D25907FAC3A38EFFDEAA87FFDEAA87FFD9A8 + 86FFF0F074FFEAE979FFA59B92FFD05586FFC07441FFC6AF96FFB68C6FFFD555 + 00EA000000000000000000000000D25907FAC3A38EFFDEAA87FFDEAA87FFDCA9 + 86FFC7AE95FFCCB49DFFCCB49DFFCCB49DFFCCB49DFFC8A88DFFB68B6EFFD455 + 00E6000000000000000000000000D25907FAC3A38EFFDEAA87FFDEAA87FFDEAA + 87FFDEAA87FFDEAA87FFDEAA87FFDEAA87FFDEAA87FFD9A988FFB68A6BFFD455 + 00E3000000000000000000000000D35805FABC8864FFBF8A67FFBF8A67FFBF8A + 67FFBF8A67FFBF8A67FFBF8A67FFBF8A67FFBF8A67FFBE8966FFC17847FFD455 + 00E0000000000000000000000000D4550000D45500FFD45500FFD45500FFD455 + 00FFD45500FFD45500FFD45500FFD45500FFD45500FFD45500FFD45500FFD455 + 00DD000000000000000000000000 } end object SD: TSaveDialog diff --git a/main.pas b/main.pas index 0f2b716..68b0aa7 100644 --- a/main.pas +++ b/main.pas @@ -25,6 +25,7 @@ TfMian = class(TForm) bUkazKatalog: TButton; bOpenKatPodrob: TButton; bInstViewZam: TButton; + bInstpoSokrtiZapros: TButton; bViewZamPodrob: TButton; cbZamenaPodrob: TComboBox; ComboBox1: TComboBox; @@ -131,6 +132,7 @@ TfMian = class(TForm) InstallPoPage: TTabSheet; SQLTransaction4: TSQLTransaction; ToolButton5: TToolButton; + ToolButton6: TToolButton; tsLicenseSogl: TTabSheet; tsVseVarianti: TTabSheet; tsPodrobnosti: TTabSheet; @@ -159,6 +161,7 @@ TfMian = class(TForm) var Handled: Boolean); procedure bDeinstrallClick(Sender: TObject); procedure bExplorerClick(Sender: TObject); + procedure bInstpoSokrtiZaprosClick(Sender: TObject); procedure bInstViewZamClick(Sender: TObject); procedure bOpenKatPodrobClick(Sender: TObject); procedure bRegeditClick(Sender: TObject); @@ -169,8 +172,10 @@ TfMian = class(TForm) procedure DBGrid1CellClick(Column: TColumn); procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); + procedure DBGrid1TitleClick(Column: TColumn); procedure DBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); + procedure DBGrid2TitleClick(Column: TColumn); procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure FormCreate(Sender: TObject); procedure leKatalogSearchChange(Sender: TObject); @@ -320,10 +325,33 @@ procedure TfMian.mExportHTMLClick(Sender: TObject); //Для имени пк i1: DWORD; p1: PChar; + Nst7:Word; + Nst1:Word; + Nst2:Word; + Nst3:Word; + Nst4:Word; + Nst5:Word; + Nst6:Word; begin i1:=255; GetMem(p1, i1); GetComputerName(p1, i1); + + + //подгружаем настройки для определения заголовков колонок + SQLQuery4.Close; + SQLQuery4.Active:=false; + SQLQuery4.SQL.Clear; + s := 'select * from setting'; + SQLQuery4.SQL.Add(s); + SQLQuery4.Active:=true; + + { SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Text:='select * from setting'; + SQLQuery1.Open; + SQLQuery1.First; } + + // если открыт авто поиск if PageControl1.ActivePageindex=0 then begin @@ -341,13 +369,28 @@ procedure TfMian.mExportHTMLClick(Sender: TObject); t.add('

Имя компьютера: ' + p1 + '

'); t.add(''); t.add(''); +// подружаю из базы 1 или 0 для колонок + +Nst7:=SQLQuery4.FieldByName('AvtoSt7').AsInteger; +Nst2:=SQLQuery4.FieldByName('AvtoSt2').AsInteger; +Nst3:=SQLQuery4.FieldByName('AvtoSt3').AsInteger; +Nst4:=SQLQuery4.FieldByName('AvtoSt4').AsInteger; +Nst5:=SQLQuery4.FieldByName('AvtoSt5').AsInteger; +Nst6:=SQLQuery4.FieldByName('AvtoSt6').AsInteger; + // t.add(''); + if Nst7 = 1 then t.add(''); // @@ -391,17 +434,33 @@ procedure TfMian.mExportHTMLClick(Sender: TObject); t.add(''); t.add('
Исходное название'); + if Nst2 = 1 then t.add(' Название в БД'); + if Nst3 = 1 then t.add(' Тип ПО'); + if Nst4 = 1 then t.add(' Лицензия'); + if Nst5 = 1 then t.add(' Стоимость'); + if Nst6 = 1 then t.add(' Замена'); t.add('
'); // +Nst7:=SQLQuery4.FieldByName('RuchSt7').AsInteger; +Nst2:=SQLQuery4.FieldByName('RuchSt2').AsInteger; +Nst1:=SQLQuery4.FieldByName('RuchSt1').AsInteger; +Nst3:=SQLQuery4.FieldByName('RuchSt3').AsInteger; +Nst4:=SQLQuery4.FieldByName('RuchSt4').AsInteger; +Nst5:=SQLQuery4.FieldByName('RuchSt5').AsInteger; +Nst6:=SQLQuery4.FieldByName('RuchSt6').AsInteger; + t.add(''); -t.add(''); // t.add(''); -for i:=6 to DBGrid2.DataSource.DataSet.Fields.Count-1 do +for i:=7 to DBGrid2.DataSource.DataSet.Fields.Count-1 do t.add(''); while not DBGrid2.DataSource.DataSet.eof do @@ -459,6 +518,21 @@ procedure TfMian.mPeredatLibreOfficeClick(Sender: TObject); //экспорт в s: string; ds : TDataSet; Zagolovki: array of array of string; + //для подгрузки из настроек включенных колонок + Nst7:Word; + Nst2:Word; // для загрузки из базы настроек + Nst3:Word; // какие нужно загружать столбцы в автопоиске + Nst4:Word; + Nst5:Word; + Nst6:Word; + Nst1:Word; + Nst7Pos:Word; // переменные для определения позиций колонок + Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины + Nst3Pos:Word; + Nst4Pos:Word; + Nst5Pos:Word; + Nst6Pos:Word; + Nst1Pos:Word; begin OO := CreateOleObject('com.sun.star.ServiceManager'); Desktop := OO.createInstance('com.sun.star.frame.Desktop'); @@ -466,814 +540,1828 @@ procedure TfMian.mPeredatLibreOfficeClick(Sender: TObject); //экспорт в Sheet := Doc.getSheets.GetByIndex(0); Sheet.Name := 'Lpro'; - //теперь заполняем заголовки Zagolovki - SetLength(Zagolovki, 1, 6); - Zagolovki[0][0] := 'Исходное название'; - Cell := Sheet.getCellByPosition(0, 0); - Cell.SetString(WideString(UTF8Decode(Zagolovki[0][0]))); - Zagolovki[0][1] := 'Название в БД'; - Cell := Sheet.getCellByPosition(1, 0); - Cell.SetString(WideString(UTF8Decode(Zagolovki[0][1]))); - Zagolovki[0][2] := 'Тип ПО'; - Cell := Sheet.getCellByPosition(2, 0); - Cell.SetString(WideString(UTF8Decode(Zagolovki[0][2]))); - Zagolovki[0][3] := 'Лицензия'; - Cell := Sheet.getCellByPosition(3, 0); - Cell.SetString(WideString(UTF8Decode(Zagolovki[0][3]))); - Zagolovki[0][4] := 'Стоимость'; - Cell := Sheet.getCellByPosition(4, 0); - Cell.SetString(WideString(UTF8Decode(Zagolovki[0][4]))); - Zagolovki[0][5] := 'Замена'; - Cell := Sheet.getCellByPosition(5, 0); - Cell.SetString(WideString(UTF8Decode(Zagolovki[0][5]))); - //конец заполнения заголовков - - ds := DBGrid1.DataSource.DataSet; - ds.First; j := 1; // с какой строки начинать вставлять в CALC - while not ds.EOF do - begin - for i := 0 to ds.FieldCount do - begin - Cell := Sheet.getCellByPosition(i, j); - if i = 0 then - Cell.SetString(WideString(UTF8Decode(ds.Fields.Fields[i].AsString))); - if i > 0 then - Cell.SetString(WideString(UTF8Decode(ds.Fields.Fields[i - 1].AsString))); - end; - ds.Next; inc(j); - end; - -end; + // получаем настройки из таблицы + SQLQuery2.Close; + SQLQuery2.Active:=false; + SQLQuery2.SQL.Clear; + s := 'select * from setting'; + SQLQuery2.SQL.Add(s); + SQLQuery2.Active:=true; -procedure TfMian.mPeredatExcelClick(Sender: TObject); -var - i,j,index: Integer; - ExcelApp,sheet: Variant; - ClassID: TCLSID; - Rez : HRESULT; - //экспорт в эксель -begin -// если открыт авто поиск + // если открыт авто поиск if PageControl1.ActivePageindex=0 then begin -Rez := CLSIDFromProgID(PWideChar(WideString('Excel.Application')), ClassID); -if Rez <> S_OK then begin - MessageDlg('EXCEL не установлен. Поддерживается передача только в EXCEL.',mtERROR,[mbok],0); - Exit; + // получаю включенные колонки + Nst7:=SQLQuery2.FieldByName('AvtoSt7').AsInteger; + Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; + Nst3:=SQLQuery2.FieldByName('AvtoSt3').AsInteger; + Nst4:=SQLQuery2.FieldByName('AvtoSt4').AsInteger; + Nst5:=SQLQuery2.FieldByName('AvtoSt5').AsInteger; + Nst6:=SQLQuery2.FieldByName('AvtoSt6').AsInteger; + // начало определения позиций + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; end; -ExcelApp := CreateOleObject('Excel.Application'); -ExcelApp.Visible := False; -ExcelApp.WorkBooks.Add(-4167); -ExcelApp.WorkBooks[1].WorkSheets[1].name := 'Export'; -sheet:=ExcelApp.WorkBooks[1].WorkSheets['Export']; -index:=1; //Загоняем с первой строки -DBGrid1.DataSource.DataSet.First; -for i:=1 to DBGrid1.DataSource.DataSet.RecordCount do -begin -for j:=1 to DBGrid1.DataSource.DataSet.FieldCount do -sheet.cells[index,j]:=DBGrid1.DataSource.DataSet.fields[j-1].AsWideString; -inc(index); -DBGrid1.DataSource.DataSet.Next; -end; -ExcelApp.Visible := true; - end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //23456 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; - // если открыт ручной поиск - if PageControl1.ActivePageindex=1 then - begin -Rez := CLSIDFromProgID(PWideChar(WideString('Excel.Application')), ClassID); -if Rez <> S_OK then begin - MessageDlg('EXCEL не установлен. Поддерживается передача только в EXCEL.',mtERROR,[mbok],0); - Exit; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2456 + Nst4Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; end; -ExcelApp := CreateOleObject('Excel.Application'); -ExcelApp.Visible := False; -ExcelApp.WorkBooks.Add(-4167); -ExcelApp.WorkBooks[1].WorkSheets[1].name := 'Export'; -sheet:=ExcelApp.WorkBooks[1].WorkSheets['Export']; -index:=1; //Загоняем с первой строки -DBGrid2.DataSource.DataSet.First; -for i:=1 to DBGrid2.DataSource.DataSet.RecordCount do -begin -for j:=1 to DBGrid2.DataSource.DataSet.FieldCount do -sheet.cells[index,j]:=DBGrid2.DataSource.DataSet.fields[j-1].AsWideString; -inc(index); -DBGrid2.DataSource.DataSet.Next; -end; -ExcelApp.Visible := true; - end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2356 + Nst3Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; -end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2346 + Nst3Pos := 1; + Nst4Pos := 2; + Nst6Pos := 3; + end; -procedure TfMian.mPodborZameniClick(Sender: TObject); -begin - fPodborZameni.ShowModal; -end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; //2345 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + end; -procedure TfMian.mPoiskVBazeClick(Sender: TObject); -begin - fPoiskVBaze.ShowModal; -end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; -procedure TfMian.mShriftClick(Sender: TObject); -begin - //сначала диалогу присваиваем шрифт: - FD.Font:= DBGrid1.Font; - //если диалог прошел успешно, меняем шрифт: - if FD.Execute then DBGrid1.Font:= FD.Font; -end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; + end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + end; -procedure TfMian.mWebStranicaClick(Sender: TObject); -begin - OpenURL('http://xn--90abhbolvbbfgb9aje4m.xn--p1ai/%D1%83%D1%82%D0%B8%D0%BB%D0%B8%D1%82%D1%8B/%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0/lpro-%D0%BF%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0-%D0%BB%D0%B8%D1%86%D0%B5%D0%BD%D0%B7%D0%B8%D0%B9-%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC.html'); -end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7256 + Nst5Pos := 2; + Nst6Pos := 3; + end; -procedure TfMian.PageControl1Change(Sender: TObject); -begin -if PageControl1.ActivePageindex=1 then - begin - mBeginSerch.Enabled := False; - mOchistit.Enabled := False; - panBeginSerch.Enabled := False; - panOchistit.Enabled := False; - panSort00.Enabled := True; - panSort01.Enabled := True; - panSort02.Enabled := True; - panSort03.Enabled := True; - panSort04.Enabled := True; - mSort00.Enabled := True; - mSort01.Enabled := True; - mSort02.Enabled := True; - mSort03.Enabled := True; - mSort04.Enabled := True; - mExport.Enabled := True; - mExportHTML.Enabled := True; - mPeredatExcel.Enabled := True; - panExportCSV.Enabled := True; - panExportHTML.Enabled := True; - panPeredatExcel.Enabled := True; - end; -if PageControl1.ActivePageindex=2 then - begin - mBeginSerch.Enabled := False; - mOchistit.Enabled := False; - panBeginSerch.Enabled := False; - panOchistit.Enabled := False; - panSort00.Enabled := False; - panSort01.Enabled := False; - panSort02.Enabled := False; - panSort03.Enabled := False; - panSort04.Enabled := False; - mSort00.Enabled := False; - mSort01.Enabled := False; - mSort02.Enabled := False; - mSort03.Enabled := False; - mSort04.Enabled := False; - mExport.Enabled := False; - mExportHTML.Enabled := False; - mPeredatExcel.Enabled := False; - panExportCSV.Enabled := False; - panExportHTML.Enabled := False; - panPeredatExcel.Enabled := False; - end; -if PageControl1.ActivePageindex=0 then - begin - mBeginSerch.Enabled := True; - mOchistit.Enabled := True; - panBeginSerch.Enabled := True; - panOchistit.Enabled := True; - panSort00.Enabled := True; - panSort01.Enabled := True; - panSort02.Enabled := True; - panSort03.Enabled := True; - panSort04.Enabled := True; - mSort00.Enabled := True; - mSort01.Enabled := True; - mSort02.Enabled := True; - mSort03.Enabled := True; - mSort04.Enabled := True; - mExport.Enabled := True; - mExportHTML.Enabled := True; - mPeredatExcel.Enabled := True; - panExportCSV.Enabled := True; - panExportHTML.Enabled := True; - panPeredatExcel.Enabled := True; - end; -end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7246 + Nst4Pos := 2; + Nst6Pos := 3; + end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7234 + Nst3Pos := 2; + Nst4Pos := 3; + end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7235 + Nst3Pos := 2; + Nst5Pos := 3; + end; -procedure TfMian.pCopyClick(Sender: TObject); -//var -// bm: TBookMark; - // pch, pch1: PChar; - // s, s2: string; - // i, j: integer; // Копирование выделения - Const - //Tab character // НАВЕРНОЕ СТОИТ УБРАТЬ, не требуется - Delim = CHR(9); -var // отключил пункт в меню !!!!!!!!!!! - i: Integer; - x: Integer; - S: String; - Y: String; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7236 + Nst3Pos := 2; + Nst6Pos := 3; + end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; + end; - //Copy Fieldnames First - Y := ''; - for x := 0 to DBGrid1.Columns.Count - 1 do - Y := Y + (format('%s',[DBGrid1.columns[x].title.caption]))+ Delim; - Memo1.Lines.Add(Y); + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; + end; - //Copy Field contents - if DBGrid1.SelectedRows.Count > 0 then + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then begin - with DBGrid1.DataSource.DataSet do - begin - for i := 0 to DBGrid1.SelectedRows.Count-1 do - begin - //Bookmark sets the position of the selection - S := ''; - GotoBookmark(Tbookmark(DBGrid1.SelectedRows[i])); - for x := 0 to DBGrid1.Columns.Count - 1 do - Begin - S := S + (format('%s',[DbGrid1.columns[x].field.asString]))+ Delim; - end; - Memo1.Lines.Add(S); - end; - end; - end; - //Copy to a memo field, then to the clipboard - Memo1.SelectAll; - Memo1.CopyToClipboard; + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; + end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; + end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; + end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; + end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; + end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; + end; - {* - s := ''; - for j := 0 to DBGrid1.Columns.Count - 1 do - s := s + DBGrid1.Columns.Items[j].Title.Caption + #9; - s := s + #13 + #10; - if not DBGrid1.DataSource.DataSet.active then - begin - ShowMessage('Нет выборки!!!'); - Exit; - end; - try - DBGrid1.Visible := False; //Делаем грид невидимым, чтобы не тратилось время - //на его перерисовку при прокрутке DataSet - просто и - //эффективно - bm := DBGrid1.DataSource.DataSet.GetBookmark; // для того чтобы не - // потерять текущую запись - DBGrid1.DataSource.DataSet.First; - while not DBGrid1.DataSource.DataSet.EOF do - begin - s2 := ''; - for j := 0 to DBGrid1.Columns.Count - 1 do - begin - s2 := s2 + DBGrid1.Columns.Items[j].Field.AsString + #9; - end; - s := s + s2 + #13 + #10; - DBGrid1.DataSource.DataSet.Next; - end; - //Переключаем клавиатуру "в русский режим", - //иначе - проблемы с кодировкой - GetMem(pch, 100); - GetMem(pch1, 100); - GetKeyboardLayoutName(pch); - StrCopy(pch1, pch); - while pch <> '00000419' do - begin - ActivateKeyboardLayout(HKL_NEXT, 0); - GetKeyboardLayoutName(pch); - if strComp(pch, pch1) = 0 then - //Круг замкнулся - нет такого языка '00000419' - StrCopy(pch, '00000419'); - end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; + end; - clipboard.AsText := s; //Данные - в буфер!!! + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; + end; - //Возвращаем режим клавиатуры - while strComp(pch, pch1) <> 0 do - begin - ActivateKeyboardLayout(HKL_NEXT, 0); - GetKeyboardLayoutName(pch); - end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72 + end; - FreeMem(pch); - FreeMem(pch1); + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //23 + end; - DBGrid1.DataSource.DataSet.GotoBookmark(bm); - //ShowMessage('Данные успешно скопированы в буфер обмена.'); - finally - DBGrid1.Visible := True; - end; - *} -end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //24 + end; -procedure TfMian.JumpToKey(Key: string); -var - i, n: Integer; - hWin: HWND; - ExecInfo: ShellExecuteInfoA; - begin - hWin := FindWindowA(PChar('RegEdit_RegEdit'), nil); - if hWin = 0 then - {if Regedit doesn't run then we launch it} - begin - FillChar(ExecInfo, 60, #0); - with ExecInfo do - begin - cbSize := 60; - fMask := SEE_MASK_NOCLOSEPROCESS; - lpVerb := PChar('open'); - lpFile := PChar('regedit.exe'); - nShow := 1; - end; - ShellExecuteExA(@ExecInfo); - WaitForInputIdle(ExecInfo.hProcess, 200); - hWin := FindWindowA(PChar('RegEdit_RegEdit'), nil); - end; - ShowWindow(hWin, SW_SHOWNORMAL); - hWin := FindWindowExA(hWin, 0, PChar('SysTreeView32'), nil); - SetForegroundWindow(hWin); - i := 30; - repeat - SendMessageA(hWin, WM_KEYDOWN, VK_LEFT, 0); - Dec(i); - until i = 0; - Sleep(500); - SendMessageA(hWin, WM_KEYDOWN, VK_RIGHT, 0); - Sleep(500); - i := 1; - n := Length(Key); - repeat - if Key[i] = '\' then - begin - SendMessageA(hWin, WM_KEYDOWN, VK_RIGHT, 0); - Sleep(500); - end - else - SendMessageA(hWin, WM_CHAR, Integer(Key[i]), 0); - i := i + 1; - until i = n; -end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //25 + end; -procedure TfMian.rVetkaReestraSelectionChanged(Sender: TObject); -var - // MyList3: TStringListUTF8; // для хранения названий ключей реестра - i : Integer; - Str: string; - NameKey: string; - FullKey: String; - bitnost: String; -begin - if rVetkaReestra.ItemIndex = 0 then - begin - // MyRegistry:=TRegistry.Create; - FullKey:= 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' - end - else if rVetkaReestra.ItemIndex = 1 then - begin - // MyRegistry:=TRegistry.Create(KEY_WOW64_64KEY); - FullKey:= 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'; - end; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst6Pos := 1; //26 + end; - //начало нового варианта + // конец определения позиций - bitnost:=GetEnvironmentVariableUTF8('ProgramFiles(x86)'); - if bitnost <> '' then - begin - MyRegistry2:=TRegistry.Create(KEY_WOW64_64KEY); - end - else - begin - MyRegistry2:=TRegistry.Create; - end; + //теперь заполняем заголовки Zagolovki + SetLength(Zagolovki, 1, 7); - ListBox1.Items.Clear; - MyList3:=TStringListUTF8.Create; -//MyRegistry:=TRegistry.Create(KEY_WOW64_32KEY); - with MyRegistry2 do - begin - RootKey:=HKEY_LOCAL_MACHINE; - OpenKeyReadOnly(FullKey); - GetKeyNames(MyList3); - CloseKey; - for i:=0 to MyList3.Count-1 do + if Nst7 = 1 then + begin + Zagolovki[0][Nst7Pos + 1] := 'Исходное название'; + Cell := Sheet.getCellByPosition(Nst7Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst7Pos + 1]))); + end; + if Nst2 = 1 then + begin + Zagolovki[0][Nst2Pos + 1] := 'Название в БД'; + Cell := Sheet.getCellByPosition(Nst2Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst2Pos + 1]))); + end; + if Nst3 = 1 then + begin + Zagolovki[0][Nst3Pos + 1] := 'Тип ПО'; + Cell := Sheet.getCellByPosition(Nst3Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst3Pos + 1]))); + end; + if Nst4 = 1 then + begin + Zagolovki[0][Nst4Pos + 1] := 'Лицензия'; + Cell := Sheet.getCellByPosition(Nst4Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst4Pos + 1]))); + end; + if Nst5 = 1 then + begin + Zagolovki[0][Nst5Pos + 1] := 'Стоимость'; + Cell := Sheet.getCellByPosition(Nst5Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst5Pos + 1]))); + end; + if Nst6 = 1 then + begin + Zagolovki[0][Nst6Pos + 1] := 'Замена'; + Cell := Sheet.getCellByPosition(Nst6Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst6Pos + 1]))); + end; + + // Zagolovki[0][0] := 'Исходное название'; + // Cell := Sheet.getCellByPosition(0, 0); + // Cell.SetString(WideString(UTF8Decode(Zagolovki[0][0]))); + //конец заполнения заголовков + + ds := DBGrid1.DataSource.DataSet; + ds.First; + j := 1; // с какой строки начинать вставлять в CALC + while not ds.EOF do + begin + for i := 1 to ds.FieldCount do begin - RootKey:=HKEY_LOCAL_MACHINE; - OpenKeyReadOnly(FullKey+ - MyList3[i]); - Str:=ReadString('DisplayName'); - if Str<>'' then - NameKey:=MyList3.Strings[i]; - ListBox1.Items.Add(CP1251ToUTF8(NameKey)); - CloseKey; + Cell := Sheet.getCellByPosition(i, j); + if i = 0 then + Cell.SetString(WideString(UTF8Decode(ds.Fields.Fields[i].AsString))); + if i > 0 then + Cell.SetString(WideString(UTF8Decode(ds.Fields.Fields[i - 1].AsString))); end; - end; - MyList3.Free; -end; + ds.Next; + inc(j); + end; -procedure TfMian.mBeginSerchClick(Sender: TObject); -var - MyList: TStringListUTF8; // для хранения названий ключей реестра - MyList2: TStringListUTF8; - MyList4: TStringListUTF8; - MyRegistry: TRegistry; - MassivAvtoStr: array of array of string; - s: string; - i :Integer; - p1:Integer; - p2:Integer; - p3:String; - FiltrStr: string; - Str: string; - N:Word; // было Integer // для записи в базу списка - Nst7:Word; - Nst2:Word; // для загрузки из базы настроек - Nst3:Word; // какие нужно загружать столбцы в автопоиске - Nst4:Word; - Nst5:Word; - Nst6:Word; - Nst7Pos:Word; // переменные для определения позиций колонок - Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины - Nst3Pos:Word; - Nst4Pos:Word; - Nst5Pos:Word; - Nst6Pos:Word; - bitnost:String; -begin -lProgress.Caption:='Пожалуйста, подождите'; -ProgressBar1.Position:=0; -ProgressBar1.Min := 0; -ProgressBar1.Max := 10; -Cursor:= crHourGlass; -bOpenKatPodrob.Enabled:=True; -cbZamenaPodrob.Enabled:=True; -bViewZamPodrob.Enabled:=True; - bSearch.Visible:=False; //скрываем кнопку начать поиск - // {* // очищаем старое содержимое - SQLQuery1.Close; // очиска таблицы в базе, в которую - SQLQuery1.SQL.Text := 'delete from install'; // записывается список программ - SQLQuery1.ExecSQL; - SQLTransaction1.CommitRetaining; -// *} - MyList2:=TStringListUTF8.Create; -// MyRegistry:=TRegistry.Create; + end; - bitnost:=GetEnvironmentVariableUTF8('ProgramFiles(x86)'); - if bitnost <> '' then - begin - MyRegistry:=TRegistry.Create(KEY_WOW64_64KEY); - end - else - begin - MyRegistry:=TRegistry.Create; - end; + // если открыт ручной поиск + if PageControl1.ActivePageindex=1 then + begin - ProgressBar1.StepBy(1); - MyList4:=TStringListUTF8.Create; - MyList:=TStringListUTF8.Create; + Nst7:=SQLQuery1.FieldByName('RuchSt7').AsInteger; + Nst2:=SQLQuery1.FieldByName('RuchSt2').AsInteger; + Nst1:=SQLQuery1.FieldByName('RuchSt1').AsInteger; + Nst3:=SQLQuery1.FieldByName('RuchSt3').AsInteger; + Nst4:=SQLQuery1.FieldByName('RuchSt4').AsInteger; + Nst5:=SQLQuery1.FieldByName('RuchSt5').AsInteger; + Nst6:=SQLQuery1.FieldByName('RuchSt6').AsInteger; - //Reg.KeyExists('\Software\key') - //if MyRegistry.KeyExists('SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall') then begin //IsWow64 - // showmessage('ключ существует'); - with MyRegistry do - begin - RootKey:=HKEY_LOCAL_MACHINE; - OpenKeyReadOnly('Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'); - GetKeyNames(MyList); - CloseKey; - for i:=0 to MyList.Count-1 do - begin - RootKey:=HKEY_LOCAL_MACHINE; - OpenKeyReadOnly('Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'+ - MyList[i]); - Str:=ReadString('DisplayName'); - if (Str<>'') AND (UTF8Pos('Microsoft Visual C++', Str)<1) AND (UTF8Pos('Visual C++', Str)<1) then - begin - { if UTF8Pos('Microsoft Visual C++', Str)=1 then - begin - continue; - end; } - // Memo1.Lines.Add(SysToUTF8(ReadString('DisplayName'))); - MyList2.Add(CP1251ToUTF8(ReadString('DisplayName'))); - MyList4.Add('Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'+MyList[i]); - end; - CloseKey; - end; + //заполняем заголовки колонок и меняем ширину колонок - RootKey:=HKEY_LOCAL_MACHINE; - OpenKeyReadOnly('Software\Microsoft\Windows\CurrentVersion\Uninstall\'); - GetKeyNames(MyList); - CloseKey; - for i:=0 to MyList.Count-1 do - begin - RootKey:=HKEY_LOCAL_MACHINE; - OpenKeyReadOnly('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+ - MyList[i]); - Str:=ReadString('DisplayName'); - if (Str<>'') AND (UTF8Pos('Microsoft Visual C++', Str)<1) AND (UTF8Pos('Visual C++', Str)<1) then - begin - { if UTF8Pos('Microsoft Visual C++', Str)=1 then - begin - continue; - end; } - // Memo1.Lines.Add(SysToUTF8(ReadString('DisplayName'))); - MyList2.Add(CP1251ToUTF8(ReadString('DisplayName'))); - MyList4.Add('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+MyList[i]); - end; - CloseKey; - end; - end; - ProgressBar1.StepBy(1); - // end + if (Nst7 = 1) and (Nst2 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; + Nst1Pos := 2; //7213456 + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; + Nst6Pos := 6; +// showmessage('Сработал вариант 7213456'); + end; - // {* - SQLQuery1.Close; - SQLQuery1.SQL.Clear; - SQLQuery1.SQL.Add('insert into install(text)'); // Запись полученного списка прог в базу - SQLQuery1.SQL.Add('Values (:pText)'); - for N := 0 to MyList2.Count - 1 do + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) then begin - SQLQuery1.ParamByName('pText').AsString := MyList2[N]; - SQLQuery1.ExecSQL; + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 723456'); end; - SQLTransaction1.CommitRetaining; - ProgressBar1.StepBy(1); - //новый вариант - SQLQuery1.SQL.Clear; -SQLQuery1.SQL.Text:='select text from install'; -SQLQuery1.Open; -SQLQuery1.First; -MyList2.clear; // пытался из базы получать список прог -while not SQLQuery1.Eof do -begin - MyList2.Add(SQLQuery1.FieldByName('text').AsString); - SQLQuery1.Next; -end; -SQLQuery1.Close; -ProgressBar1.StepBy(1); -//Пытаюсь фильтровать названия программ от версий -MyFiltrList:=TStringListUTF8.Create; -for N := 0 to MyList2.Count - 1 do + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) then begin - FiltrStr:=MyList2[N]; - UTF8Delete(FiltrStr, UTF8Pos(' CC', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' CS', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' cc', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' cs', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' CC 2015', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' CC 2016', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' CC 2017', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2015.1', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2015.2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2015.3', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2015.4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2015.5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2016.1', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2016.2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2016.3', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2016.4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2016.5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2017.1', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2017.2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2017.3', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2017.4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2017.5', FiltrStr), UTF8Length(FiltrStr)); - if (UTF8Pos('Microsoft Visual Studio', FiltrStr)=0) then - begin - UTF8Delete(FiltrStr, UTF8Pos(' 2015', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2016', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2017', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2007', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2008', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2009', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2010', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2011', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2012', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2013', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2014', FiltrStr), UTF8Length(FiltrStr)); - end; + Nst7Pos := 0; + Nst1Pos := 1; //713456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 713456'); + end; - if (UTF8Pos('Microsoft Visual Studio', FiltrStr)>=1) then - begin - UTF8Delete(FiltrStr, UTF8Pos(' 2015', FiltrStr), 5); - UTF8Delete(FiltrStr, UTF8Pos(' 2016', FiltrStr), 5); - UTF8Delete(FiltrStr, UTF8Pos(' 2017', FiltrStr), 5); - UTF8Delete(FiltrStr, UTF8Pos(' 2007', FiltrStr), 5); - UTF8Delete(FiltrStr, UTF8Pos(' 2008', FiltrStr), 5); - UTF8Delete(FiltrStr, UTF8Pos(' 2009', FiltrStr), 5); - UTF8Delete(FiltrStr, UTF8Pos(' 2010', FiltrStr), 5); - UTF8Delete(FiltrStr, UTF8Pos(' 2011', FiltrStr), 5); - UTF8Delete(FiltrStr, UTF8Pos(' 2012', FiltrStr), 5); - UTF8Delete(FiltrStr, UTF8Pos(' 2013', FiltrStr), 5); - UTF8Delete(FiltrStr, UTF8Pos(' 2014', FiltrStr), 5); - end; + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712456 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712456'); + end; - UTF8Delete(FiltrStr, UTF8Pos(' (2015', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (2016', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (2017', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (2007', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (2008', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (2009', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (2010', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (2011', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (2012', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (2013', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (2014', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (v0', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (v1', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (v2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (v3', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (v4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (v5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (v6', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (v7', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (v8', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (v9', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v0', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v1', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v3', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v6', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v7', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v8', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v9', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v 0.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v 1.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v 2.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v 3.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v 4.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v 5.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v 6.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v 7.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v 8.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v 9.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v.0', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v.1', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v.2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v.3', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v.4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v.5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v.6', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v.7', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v.8', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v.9', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v. 0', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v. 1', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v. 2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v. 3', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v. 4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v. 5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v. 6', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v. 7', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v. 8', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' v. 9', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(', версия', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (версия', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (Версия', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(', version', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (version', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (Version', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' версия', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' version', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' Версия', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' Version', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' Ver.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' ver.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (Version', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (x64', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' x64', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (x86', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' x86', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos('-x64', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' - 64 bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (32-разрядная', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (32-Bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (32-bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (32 bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (64-разрядная', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (64-Bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (64-bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (64 bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 64-bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 32-bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos('64-bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos('32-bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 64 bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 32 bit', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (V0', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (V1', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (V2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (V3', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (V4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (V5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (V6', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (V7', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (V8', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (V9', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V0', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V1', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V3', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V6', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V7', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V8', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V9', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V.0', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V.1', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V.2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V.3', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V.4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V.5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V.6', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V.7', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V.8', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V.9', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V. 0', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V. 1', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V. 2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V. 3', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V. 4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V. 5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V. 6', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V. 7', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V. 8', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' V. 9', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos('_64b', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 64b', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' Trial', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' trial', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' demo', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' Demo', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (Trial', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (trial', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (demo', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (Demo', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' with update', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' with Update', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' With Update', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' With update', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (build', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (Build', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (0.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (1.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (2.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (3.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (4.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (5.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (6.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (7.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (8.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (9.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (10.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' -0.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' -1.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' -2.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' -3.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' -4.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' -5.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' -6.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' -7.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' -8.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' -9.', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' XE8', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' XE2', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' XE4', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' XE6', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos('™', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos('-64', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' X5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' X6', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' x5', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' x6', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (remove', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' (Remove', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' [rev', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' - English', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 0-', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 1-', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 2-', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 3-', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 4-', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 5-', FiltrStr), UTF8Length(FiltrStr)); - UTF8Delete(FiltrStr, UTF8Pos(' 6-', FiltrStr), UTF8Length(FiltrStr)); + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712356 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712356'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712346 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712346'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712345 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; +// showmessage('Сработал вариант 712345'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 123456'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //13456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 13456'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12456'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12356'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12346'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 12345'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //73456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 73456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72356'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72346'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 72345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71356'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71346'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71256 + Nst2Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71256'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71246 + Nst2Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71246'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71245 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71245'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71236 + Nst2Pos := 2; + Nst3Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71236'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71235 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71235'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71234 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; +// showmessage('Сработал вариант 71234'); + end; + + if (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst7 = 0) then + begin + Nst3Pos := 0; + Nst4Pos := 1; //3456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 3456'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst3 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //2456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2456'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2356'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2346'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2345 + Nst4Pos := 2; + Nst5Pos := 3; + // showmessage('Сработал вариант 2345'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //7456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7456'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7356'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7346'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7345 + Nst4Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7156 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7156'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7146 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7146'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7145 + Nst4Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7145'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7126 + Nst2Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7126'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7125 + Nst2Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7125'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7123 + Nst2Pos := 2; + Nst3Pos := 3; + // showmessage('Сработал вариант 7123'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712 + Nst2Pos := 2; + // showmessage('Сработал вариант 712'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //713 + Nst3Pos := 2; +// showmessage('Сработал вариант 713'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //714 + Nst4Pos := 2; +// showmessage('Сработал вариант 714'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //715 + Nst5Pos := 2; +// showmessage('Сработал вариант 715'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //716 + Nst6Pos := 2; +// showmessage('Сработал вариант 716'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; +// showmessage('Сработал вариант 723'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; +// showmessage('Сработал вариант 724'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; +// showmessage('Сработал вариант 725'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; +// showmessage('Сработал вариант 726'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //734 + Nst4Pos := 2; +// showmessage('Сработал вариант 734'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //735 + Nst5Pos := 2; +// showmessage('Сработал вариант 735'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //736 + Nst6Pos := 2; +// showmessage('Сработал вариант 736'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //745 + Nst5Pos := 2; +// showmessage('Сработал вариант 745'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst1 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //746 + Nst6Pos := 2; +// showmessage('Сработал вариант 746'); + end; + + if (Nst7 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //756 + Nst2Pos := 2; +// showmessage('Сработал вариант 756'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst7 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123 + Nst3Pos := 2; +// showmessage('Сработал вариант 123'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //124 + Nst4Pos := 2; +// showmessage('Сработал вариант 124'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //125 + Nst5Pos := 2; +// showmessage('Сработал вариант 125'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //136 + Nst6Pos := 2; +// showmessage('Сработал вариант 136'); + end; + + if (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst4Pos := 1; //145 + Nst5Pos := 2; +// showmessage('Сработал вариант 145'); + end; + + if (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst4Pos := 1; //146 + Nst6Pos := 2; +// showmessage('Сработал вариант 146'); + end; + + if (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst1Pos := 0; + Nst5Pos := 1; //156 + Nst6Pos := 2; +// showmessage('Сработал вариант 156'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst5 = 0) and (Nst6 = 0) and (Nst7 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; +// showmessage('Сработал вариант 234'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; +// showmessage('Сработал вариант 235'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; +// showmessage('Сработал вариант 236'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; +// showmessage('Сработал вариант 245'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; +// showmessage('Сработал вариант 246'); + end; + + if (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; +// showmessage('Сработал вариант 256'); + end; + + // showmessage('Nst7Pos' + IntToStr(Nst7Pos) + #13 + ' Nst2Pos' + IntToStr(Nst2Pos) + #13 + 'Nst1Pos' + IntToStr(Nst1Pos) + #13 + ' Nst3Pos' + IntToStr(Nst3Pos) + #13 + ' Nst4Pos' + IntToStr(Nst4Pos) + #13 + ' Nst5Pos' + IntToStr(Nst5Pos) + #13 + ' Nst6Pos' + IntToStr(Nst6Pos)); + + SetLength(Zagolovki, 1, 8); + if Nst7 = 1 then + begin + Zagolovki[0][Nst7Pos + 1] := 'Путь'; + Cell := Sheet.getCellByPosition(Nst7Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst7Pos + 1]))); + end; + if Nst2 = 1 then + begin + Zagolovki[0][Nst2Pos + 1] := 'Название'; + Cell := Sheet.getCellByPosition(Nst2Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst2Pos + 1]))); + end; + + if Nst1 = 1 then + begin + Zagolovki[0][Nst1Pos + 1] := 'Исходный запрос'; + Cell := Sheet.getCellByPosition(Nst1Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst1Pos + 1]))); + end; + + if Nst3 = 1 then + begin + Zagolovki[0][Nst3Pos + 1] := 'Тип ПО'; + Cell := Sheet.getCellByPosition(Nst3Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst3Pos + 1]))); + end; + if Nst4 = 1 then + begin + Zagolovki[0][Nst4Pos + 1] := 'Лицензия'; + Cell := Sheet.getCellByPosition(Nst4Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst4Pos + 1]))); + end; + if Nst5 = 1 then + begin + Zagolovki[0][Nst5Pos + 1] := 'Стоимость'; + Cell := Sheet.getCellByPosition(Nst5Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst5Pos + 1]))); + end; + if Nst6 = 1 then + begin + Zagolovki[0][Nst6Pos + 1] := 'Замена'; + Cell := Sheet.getCellByPosition(Nst6Pos + 1, 0); + Cell.SetString(WideString(UTF8Decode(Zagolovki[0][Nst6Pos + 1]))); + end; + + // Zagolovki[0][0] := 'Путь'; + // Cell := Sheet.getCellByPosition(0, 0); + // Cell.SetString(WideString(UTF8Decode(Zagolovki[0][0]))); + + + ds := DBGrid2.DataSource.DataSet; + ds.First; j := 1; // с какой строки начинать вставлять в CALC + while not ds.EOF do + begin + for i := 1 to ds.FieldCount do + begin + Cell := Sheet.getCellByPosition(i, j); + if i = 0 then + Cell.SetString(WideString(UTF8Decode(ds.Fields.Fields[i].AsString))); + if i > 0 then + Cell.SetString(WideString(UTF8Decode(ds.Fields.Fields[i - 1].AsString))); + end; + ds.Next; inc(j); + end; + + end; + + + + +end; + +procedure TfMian.mPeredatExcelClick(Sender: TObject); +var + i,j,index: Integer; + ExcelApp,sheet: Variant; + ClassID: TCLSID; + Rez : HRESULT; + //экспорт в эксель +begin + +// если открыт авто поиск + if PageControl1.ActivePageindex=0 then + begin + + +Rez := CLSIDFromProgID(PWideChar(WideString('Excel.Application')), ClassID); +if Rez <> S_OK then begin + MessageDlg('EXCEL не установлен. Поддерживается передача только в EXCEL.',mtERROR,[mbok],0); + Exit; + end; +ExcelApp := CreateOleObject('Excel.Application'); +ExcelApp.Visible := False; +ExcelApp.WorkBooks.Add(-4167); +ExcelApp.WorkBooks[1].WorkSheets[1].name := 'Export'; +sheet:=ExcelApp.WorkBooks[1].WorkSheets['Export']; +index:=1; //Загоняем с первой строки +DBGrid1.DataSource.DataSet.First; +for i:=1 to DBGrid1.DataSource.DataSet.RecordCount do +begin +for j:=1 to DBGrid1.DataSource.DataSet.FieldCount do +sheet.cells[index,j]:=DBGrid1.DataSource.DataSet.fields[j-1].AsWideString; +inc(index); +DBGrid1.DataSource.DataSet.Next; +end; +ExcelApp.Visible := true; + + end; + + // если открыт ручной поиск + if PageControl1.ActivePageindex=1 then + begin +Rez := CLSIDFromProgID(PWideChar(WideString('Excel.Application')), ClassID); +if Rez <> S_OK then begin + MessageDlg('EXCEL не установлен. Поддерживается передача только в EXCEL.',mtERROR,[mbok],0); + Exit; + end; +ExcelApp := CreateOleObject('Excel.Application'); +ExcelApp.Visible := False; +ExcelApp.WorkBooks.Add(-4167); +ExcelApp.WorkBooks[1].WorkSheets[1].name := 'Export'; +sheet:=ExcelApp.WorkBooks[1].WorkSheets['Export']; +index:=1; //Загоняем с первой строки +DBGrid2.DataSource.DataSet.First; +for i:=1 to DBGrid2.DataSource.DataSet.RecordCount do +begin +for j:=1 to DBGrid2.DataSource.DataSet.FieldCount do +sheet.cells[index,j]:=DBGrid2.DataSource.DataSet.fields[j-1].AsWideString; +inc(index); +DBGrid2.DataSource.DataSet.Next; +end; +ExcelApp.Visible := true; + + end; + +end; + +procedure TfMian.mPodborZameniClick(Sender: TObject); +begin + fPodborZameni.ShowModal; +end; + +procedure TfMian.mPoiskVBazeClick(Sender: TObject); +begin + fPoiskVBaze.ShowModal; +end; + + +procedure TfMian.mShriftClick(Sender: TObject); +begin + //сначала диалогу присваиваем шрифт: + FD.Font:= DBGrid1.Font; + //если диалог прошел успешно, меняем шрифт: + if FD.Execute then DBGrid1.Font:= FD.Font; +end; + + +procedure TfMian.mWebStranicaClick(Sender: TObject); +begin + OpenURL('http://xn--90abhbolvbbfgb9aje4m.xn--p1ai/%D1%83%D1%82%D0%B8%D0%BB%D0%B8%D1%82%D1%8B/%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0/lpro-%D0%BF%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0-%D0%BB%D0%B8%D1%86%D0%B5%D0%BD%D0%B7%D0%B8%D0%B9-%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC.html'); +end; + +procedure TfMian.PageControl1Change(Sender: TObject); +begin +if PageControl1.ActivePageindex=1 then + begin + mBeginSerch.Enabled := False; + mOchistit.Enabled := False; + panBeginSerch.Enabled := False; + panOchistit.Enabled := False; + panSort00.Enabled := True; + panSort01.Enabled := True; + panSort02.Enabled := True; + panSort03.Enabled := True; + panSort04.Enabled := True; + mSort00.Enabled := True; + mSort01.Enabled := True; + mSort02.Enabled := True; + mSort03.Enabled := True; + mSort04.Enabled := True; + mExport.Enabled := True; + mExportHTML.Enabled := True; + mPeredatExcel.Enabled := True; + panExportCSV.Enabled := True; + panExportHTML.Enabled := True; + panPeredatExcel.Enabled := True; + end; +if PageControl1.ActivePageindex=2 then + begin + mBeginSerch.Enabled := False; + mOchistit.Enabled := False; + panBeginSerch.Enabled := False; + panOchistit.Enabled := False; + panSort00.Enabled := False; + panSort01.Enabled := False; + panSort02.Enabled := False; + panSort03.Enabled := False; + panSort04.Enabled := False; + mSort00.Enabled := False; + mSort01.Enabled := False; + mSort02.Enabled := False; + mSort03.Enabled := False; + mSort04.Enabled := False; + mExport.Enabled := False; + mExportHTML.Enabled := False; + mPeredatExcel.Enabled := False; + panExportCSV.Enabled := False; + panExportHTML.Enabled := False; + panPeredatExcel.Enabled := False; + end; +if PageControl1.ActivePageindex=0 then + begin + mBeginSerch.Enabled := True; + mOchistit.Enabled := True; + panBeginSerch.Enabled := True; + panOchistit.Enabled := True; + panSort00.Enabled := True; + panSort01.Enabled := True; + panSort02.Enabled := True; + panSort03.Enabled := True; + panSort04.Enabled := True; + mSort00.Enabled := True; + mSort01.Enabled := True; + mSort02.Enabled := True; + mSort03.Enabled := True; + mSort04.Enabled := True; + mExport.Enabled := True; + mExportHTML.Enabled := True; + mPeredatExcel.Enabled := True; + panExportCSV.Enabled := True; + panExportHTML.Enabled := True; + panPeredatExcel.Enabled := True; + end; +end; + + + +procedure TfMian.pCopyClick(Sender: TObject); +//var +// bm: TBookMark; + // pch, pch1: PChar; + // s, s2: string; + // i, j: integer; // Копирование выделения + Const + //Tab character // НАВЕРНОЕ СТОИТ УБРАТЬ, не требуется + Delim = CHR(9); +var // отключил пункт в меню !!!!!!!!!!! + i: Integer; + x: Integer; + S: String; + Y: String; + + begin + + //Copy Fieldnames First + Y := ''; + for x := 0 to DBGrid1.Columns.Count - 1 do + Y := Y + (format('%s',[DBGrid1.columns[x].title.caption]))+ Delim; + Memo1.Lines.Add(Y); + + //Copy Field contents + if DBGrid1.SelectedRows.Count > 0 then + begin + with DBGrid1.DataSource.DataSet do + begin + for i := 0 to DBGrid1.SelectedRows.Count-1 do + begin + //Bookmark sets the position of the selection + S := ''; + GotoBookmark(Tbookmark(DBGrid1.SelectedRows[i])); + for x := 0 to DBGrid1.Columns.Count - 1 do + Begin + S := S + (format('%s',[DbGrid1.columns[x].field.asString]))+ Delim; + end; + Memo1.Lines.Add(S); + end; + end; + end; + //Copy to a memo field, then to the clipboard + Memo1.SelectAll; + Memo1.CopyToClipboard; + + + + + + + {* + s := ''; + for j := 0 to DBGrid1.Columns.Count - 1 do + s := s + DBGrid1.Columns.Items[j].Title.Caption + #9; + s := s + #13 + #10; + if not DBGrid1.DataSource.DataSet.active then + begin + ShowMessage('Нет выборки!!!'); + Exit; + end; + try + DBGrid1.Visible := False; //Делаем грид невидимым, чтобы не тратилось время + //на его перерисовку при прокрутке DataSet - просто и + //эффективно + bm := DBGrid1.DataSource.DataSet.GetBookmark; // для того чтобы не + // потерять текущую запись + DBGrid1.DataSource.DataSet.First; + while not DBGrid1.DataSource.DataSet.EOF do + begin + s2 := ''; + for j := 0 to DBGrid1.Columns.Count - 1 do + begin + s2 := s2 + DBGrid1.Columns.Items[j].Field.AsString + #9; + end; + s := s + s2 + #13 + #10; + DBGrid1.DataSource.DataSet.Next; + end; + //Переключаем клавиатуру "в русский режим", + //иначе - проблемы с кодировкой + GetMem(pch, 100); + GetMem(pch1, 100); + GetKeyboardLayoutName(pch); + StrCopy(pch1, pch); + while pch <> '00000419' do + begin + ActivateKeyboardLayout(HKL_NEXT, 0); + GetKeyboardLayoutName(pch); + if strComp(pch, pch1) = 0 then + //Круг замкнулся - нет такого языка '00000419' + StrCopy(pch, '00000419'); + end; + + clipboard.AsText := s; //Данные - в буфер!!! + + //Возвращаем режим клавиатуры + while strComp(pch, pch1) <> 0 do + begin + ActivateKeyboardLayout(HKL_NEXT, 0); + GetKeyboardLayoutName(pch); + end; + + FreeMem(pch); + FreeMem(pch1); + + DBGrid1.DataSource.DataSet.GotoBookmark(bm); + //ShowMessage('Данные успешно скопированы в буфер обмена.'); + finally + DBGrid1.Visible := True; + end; + *} +end; + +procedure TfMian.JumpToKey(Key: string); +var + i, n: Integer; + hWin: HWND; + ExecInfo: ShellExecuteInfoA; + begin + hWin := FindWindowA(PChar('RegEdit_RegEdit'), nil); + if hWin = 0 then + {if Regedit doesn't run then we launch it} + begin + FillChar(ExecInfo, 60, #0); + with ExecInfo do + begin + cbSize := 60; + fMask := SEE_MASK_NOCLOSEPROCESS; + lpVerb := PChar('open'); + lpFile := PChar('regedit.exe'); + nShow := 1; + end; + ShellExecuteExA(@ExecInfo); + WaitForInputIdle(ExecInfo.hProcess, 200); + hWin := FindWindowA(PChar('RegEdit_RegEdit'), nil); + end; + ShowWindow(hWin, SW_SHOWNORMAL); + hWin := FindWindowExA(hWin, 0, PChar('SysTreeView32'), nil); + SetForegroundWindow(hWin); + i := 30; + repeat + SendMessageA(hWin, WM_KEYDOWN, VK_LEFT, 0); + Dec(i); + until i = 0; + Sleep(500); + SendMessageA(hWin, WM_KEYDOWN, VK_RIGHT, 0); + Sleep(500); + i := 1; + n := Length(Key); + repeat + if Key[i] = '\' then + begin + SendMessageA(hWin, WM_KEYDOWN, VK_RIGHT, 0); + Sleep(500); + end + else + SendMessageA(hWin, WM_CHAR, Integer(Key[i]), 0); + i := i + 1; + until i = n; +end; + +procedure TfMian.rVetkaReestraSelectionChanged(Sender: TObject); +var + // MyList3: TStringListUTF8; // для хранения названий ключей реестра + i : Integer; + Str: string; + NameKey: string; + FullKey: String; + bitnost: String; +begin + if rVetkaReestra.ItemIndex = 0 then + begin + // MyRegistry:=TRegistry.Create; + FullKey:= 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' + end + else if rVetkaReestra.ItemIndex = 1 then + begin + // MyRegistry:=TRegistry.Create(KEY_WOW64_64KEY); + FullKey:= 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'; + end; + + //начало нового варианта + + bitnost:=GetEnvironmentVariableUTF8('ProgramFiles(x86)'); + if bitnost <> '' then + begin + MyRegistry2:=TRegistry.Create(KEY_WOW64_64KEY); + end + else + begin + MyRegistry2:=TRegistry.Create; + end; + + ListBox1.Items.Clear; + MyList3:=TStringListUTF8.Create; +//MyRegistry:=TRegistry.Create(KEY_WOW64_32KEY); + with MyRegistry2 do + begin + RootKey:=HKEY_LOCAL_MACHINE; + OpenKeyReadOnly(FullKey); + GetKeyNames(MyList3); + CloseKey; + for i:=0 to MyList3.Count-1 do + begin + RootKey:=HKEY_LOCAL_MACHINE; + OpenKeyReadOnly(FullKey+ + MyList3[i]); + Str:=ReadString('DisplayName'); + if Str<>'' then + NameKey:=MyList3.Strings[i]; + ListBox1.Items.Add(CP1251ToUTF8(NameKey)); + CloseKey; + end; + end; + MyList3.Free; +end; + +procedure TfMian.mBeginSerchClick(Sender: TObject); +var + MyList: TStringListUTF8; // для хранения названий ключей реестра + MyList2: TStringListUTF8; + MyList4: TStringListUTF8; + MyRegistry: TRegistry; + MassivAvtoStr: array of array of string; + s: string; + i :Integer; + p1:Integer; + p2:Integer; + p3:String; + FiltrStr: string; + Str: string; + N:Word; // было Integer // для записи в базу списка + Nst7:Word; + Nst2:Word; // для загрузки из базы настроек + Nst3:Word; // какие нужно загружать столбцы в автопоиске + Nst4:Word; + Nst5:Word; + Nst6:Word; + Nst7Pos:Word; // переменные для определения позиций колонок + Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины + Nst3Pos:Word; + Nst4Pos:Word; + Nst5Pos:Word; + Nst6Pos:Word; + bitnost:String; +begin +lProgress.Caption:='Пожалуйста, подождите'; +ProgressBar1.Position:=0; +ProgressBar1.Min := 0; +ProgressBar1.Max := 10; +Cursor:= crHourGlass; +bOpenKatPodrob.Enabled:=True; +cbZamenaPodrob.Enabled:=True; +bViewZamPodrob.Enabled:=True; + bSearch.Visible:=False; //скрываем кнопку начать поиск + // {* // очищаем старое содержимое + SQLQuery1.Close; // очиска таблицы в базе, в которую + SQLQuery1.SQL.Text := 'delete from install'; // записывается список программ + SQLQuery1.ExecSQL; + SQLTransaction1.CommitRetaining; +// *} + MyList2:=TStringListUTF8.Create; +// MyRegistry:=TRegistry.Create; + + bitnost:=GetEnvironmentVariableUTF8('ProgramFiles(x86)'); + if bitnost <> '' then + begin + MyRegistry:=TRegistry.Create(KEY_WOW64_64KEY); + end + else + begin + MyRegistry:=TRegistry.Create; + end; + + ProgressBar1.StepBy(1); + MyList4:=TStringListUTF8.Create; + MyList:=TStringListUTF8.Create; + + //Reg.KeyExists('\Software\key') + //if MyRegistry.KeyExists('SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall') then begin //IsWow64 + // showmessage('ключ существует'); + with MyRegistry do + begin + RootKey:=HKEY_LOCAL_MACHINE; + OpenKeyReadOnly('Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'); + GetKeyNames(MyList); + CloseKey; + for i:=0 to MyList.Count-1 do + begin + RootKey:=HKEY_LOCAL_MACHINE; + OpenKeyReadOnly('Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'+ + MyList[i]); + Str:=ReadString('DisplayName'); + if (Str<>'') AND (UTF8Pos('Microsoft Visual C++', Str)<1) AND (UTF8Pos('Visual C++', Str)<1) then + begin + { if UTF8Pos('Microsoft Visual C++', Str)=1 then + begin + continue; + end; } + // Memo1.Lines.Add(SysToUTF8(ReadString('DisplayName'))); + MyList2.Add(CP1251ToUTF8(ReadString('DisplayName'))); + MyList4.Add('Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'+MyList[i]); + end; + CloseKey; + end; + + RootKey:=HKEY_LOCAL_MACHINE; + OpenKeyReadOnly('Software\Microsoft\Windows\CurrentVersion\Uninstall\'); + GetKeyNames(MyList); + CloseKey; + for i:=0 to MyList.Count-1 do + begin + RootKey:=HKEY_LOCAL_MACHINE; + OpenKeyReadOnly('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+ + MyList[i]); + Str:=ReadString('DisplayName'); + if (Str<>'') AND (UTF8Pos('Microsoft Visual C++', Str)<1) AND (UTF8Pos('Visual C++', Str)<1) then + begin + { if UTF8Pos('Microsoft Visual C++', Str)=1 then + begin + continue; + end; } + // Memo1.Lines.Add(SysToUTF8(ReadString('DisplayName'))); + MyList2.Add(CP1251ToUTF8(ReadString('DisplayName'))); + MyList4.Add('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+MyList[i]); + end; + CloseKey; + end; + end; + ProgressBar1.StepBy(1); + // end + + // {* + SQLQuery1.Close; + SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Add('insert into install(text)'); // Запись полученного списка прог в базу + SQLQuery1.SQL.Add('Values (:pText)'); + for N := 0 to MyList2.Count - 1 do + begin + SQLQuery1.ParamByName('pText').AsString := MyList2[N]; + SQLQuery1.ExecSQL; + end; + SQLTransaction1.CommitRetaining; + ProgressBar1.StepBy(1); + //новый вариант + SQLQuery1.SQL.Clear; +SQLQuery1.SQL.Text:='select text from install'; +SQLQuery1.Open; +SQLQuery1.First; +MyList2.clear; // пытался из базы получать список прог +while not SQLQuery1.Eof do +begin + MyList2.Add(SQLQuery1.FieldByName('text').AsString); + SQLQuery1.Next; +end; +SQLQuery1.Close; +ProgressBar1.StepBy(1); + +//Пытаюсь фильтровать названия программ от версий +MyFiltrList:=TStringListUTF8.Create; +for N := 0 to MyList2.Count - 1 do + begin + FiltrStr:=MyList2[N]; + UTF8Delete(FiltrStr, UTF8Pos(' CC', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' CS', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' cc', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' cs', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' CC 2015', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' CC 2016', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' CC 2017', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2015.1', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2015.2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2015.3', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2015.4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2015.5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2016.1', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2016.2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2016.3', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2016.4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2016.5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2017.1', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2017.2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2017.3', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2017.4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2017.5', FiltrStr), UTF8Length(FiltrStr)); + if (UTF8Pos('Microsoft Visual Studio', FiltrStr)=0) then + begin + UTF8Delete(FiltrStr, UTF8Pos(' 2015', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2016', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2017', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2007', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2008', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2009', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2010', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2011', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2012', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2013', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2014', FiltrStr), UTF8Length(FiltrStr)); + end; + + if (UTF8Pos('Microsoft Visual Studio', FiltrStr)>=1) then + begin + UTF8Delete(FiltrStr, UTF8Pos(' 2015', FiltrStr), 5); + UTF8Delete(FiltrStr, UTF8Pos(' 2016', FiltrStr), 5); + UTF8Delete(FiltrStr, UTF8Pos(' 2017', FiltrStr), 5); + UTF8Delete(FiltrStr, UTF8Pos(' 2007', FiltrStr), 5); + UTF8Delete(FiltrStr, UTF8Pos(' 2008', FiltrStr), 5); + UTF8Delete(FiltrStr, UTF8Pos(' 2009', FiltrStr), 5); + UTF8Delete(FiltrStr, UTF8Pos(' 2010', FiltrStr), 5); + UTF8Delete(FiltrStr, UTF8Pos(' 2011', FiltrStr), 5); + UTF8Delete(FiltrStr, UTF8Pos(' 2012', FiltrStr), 5); + UTF8Delete(FiltrStr, UTF8Pos(' 2013', FiltrStr), 5); + UTF8Delete(FiltrStr, UTF8Pos(' 2014', FiltrStr), 5); + end; + + UTF8Delete(FiltrStr, UTF8Pos(' (2015', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (2016', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (2017', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (2007', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (2008', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (2009', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (2010', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (2011', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (2012', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (2013', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (2014', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (v0', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (v1', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (v2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (v3', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (v4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (v5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (v6', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (v7', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (v8', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (v9', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v0', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v1', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v3', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v6', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v7', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v8', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v9', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v 0.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v 1.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v 2.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v 3.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v 4.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v 5.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v 6.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v 7.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v 8.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v 9.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v.0', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v.1', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v.2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v.3', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v.4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v.5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v.6', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v.7', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v.8', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v.9', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v. 0', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v. 1', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v. 2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v. 3', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v. 4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v. 5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v. 6', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v. 7', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v. 8', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' v. 9', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(', версия', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (версия', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (Версия', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(', version', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (version', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (Version', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' версия', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' version', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' Версия', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' Version', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' Ver.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' ver.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (Version', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (x64', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' x64', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (x86', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' x86', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos('-x64', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' - 64 bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (32-разрядная', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (32-Bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (32-bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (32 bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (64-разрядная', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (64-Bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (64-bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (64 bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 64-bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 32-bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos('64-bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos('32-bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 64 bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 32 bit', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (V0', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (V1', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (V2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (V3', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (V4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (V5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (V6', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (V7', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (V8', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (V9', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V0', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V1', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V3', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V6', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V7', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V8', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V9', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V.0', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V.1', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V.2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V.3', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V.4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V.5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V.6', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V.7', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V.8', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V.9', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V. 0', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V. 1', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V. 2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V. 3', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V. 4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V. 5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V. 6', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V. 7', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V. 8', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' V. 9', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos('_64b', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 64b', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' Trial', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' trial', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' demo', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' Demo', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (Trial', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (trial', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (demo', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (Demo', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' with update', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' with Update', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' With Update', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' With update', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (build', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (Build', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (0.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (1.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (2.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (3.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (4.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (5.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (6.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (7.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (8.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (9.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (10.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' -0.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' -1.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' -2.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' -3.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' -4.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' -5.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' -6.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' -7.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' -8.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' -9.', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' XE8', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' XE2', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' XE4', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' XE6', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos('™', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos('-64', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' X5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' X6', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' x5', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' x6', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (remove', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' (Remove', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' [rev', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' - English', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 0-', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 1-', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 2-', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 3-', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 4-', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 5-', FiltrStr), UTF8Length(FiltrStr)); + UTF8Delete(FiltrStr, UTF8Pos(' 6-', FiltrStr), UTF8Length(FiltrStr)); UTF8Delete(FiltrStr, UTF8Pos(' 7-', FiltrStr), UTF8Length(FiltrStr)); UTF8Delete(FiltrStr, UTF8Pos(' 8-', FiltrStr), UTF8Length(FiltrStr)); UTF8Delete(FiltrStr, UTF8Pos(' 9-', FiltrStr), UTF8Length(FiltrStr)); @@ -1281,151 +2369,5451 @@ procedure TfMian.mBeginSerchClick(Sender: TObject); // 11.11 if UTF8Pos('.', FiltrStr)<>0 then begin - for p1 := 0 to 100 do + for p1 := 0 to 100 do + begin + for p2 := 0 to 100 do + begin + p3:=' ' + IntToStr(p1) + '.' + IntToStr(p2); + UTF8Delete(FiltrStr, UTF8Pos(p3, FiltrStr), UTF8Length(FiltrStr)); + end; + end; + end; + //11.11 + if UTF8Pos('.', FiltrStr)<>0 then + begin + for p1 := 0 to 100 do + begin + for p2 := 0 to 100 do + begin + p3:=IntToStr(p1) + '.' + IntToStr(p2); + UTF8Delete(FiltrStr, UTF8Pos(p3, FiltrStr), UTF8Length(FiltrStr)); + end; + end; + end; + //-11.11 + if UTF8Pos('.', FiltrStr)<>0 then + begin + for p1 := 0 to 100 do + begin + for p2 := 0 to 100 do + begin + p3:='-' + IntToStr(p1) + '.' + IntToStr(p2); + UTF8Delete(FiltrStr, UTF8Pos(p3, FiltrStr), UTF8Length(FiltrStr)); + end; + end; + end; + // -11. + if UTF8Pos('.', FiltrStr)<>0 then + begin + for p1 := 0 to 100 do + begin + for p2 := 0 to 100 do + begin + p3:='-' + IntToStr(p1) + '.'; + UTF8Delete(FiltrStr, UTF8Pos(p3, FiltrStr), UTF8Length(FiltrStr)); + end; + end; + end; + // (11. + if UTF8Pos('.', FiltrStr)<>0 then + begin + for p1 := 0 to 100 do + begin + for p2 := 0 to 100 do + begin + p3:='(' + IntToStr(p1) + '.'; + UTF8Delete(FiltrStr, UTF8Pos(p3, FiltrStr), UTF8Length(FiltrStr)); + end; + end; + end; + { if UTF8Pos('Microsoft Visual C++', FiltrStr)=1 then + begin + showmessage(FiltrStr); + //FiltrStr:='Delete'; + end + else + begin + MyFiltrList.Add(FiltrStr); + end; } + MyFiltrList.Add(FiltrStr); + end; +ProgressBar1.StepBy(1); +//конец фильтра + + //пробую удалить кавычки + MyFiltrList.Text := StringReplace(MyFiltrList.Text, '"', '', [rfReplaceAll, rfIgnoreCase]); + + //showmessage('MyList2' + (IntToStr(MyList2.Count - 1)) + #13 + 'MyList3' + (IntToStr(MyList3.Count - 1)) + #13 + 'MyFiltrList' + (IntToStr(MyFiltrList.Count - 1))); + + //начало обработки массива + SQLQuery1.Close; // очиска таблицы в базе, в которую + SQLQuery1.SQL.Text := 'delete from test'; // записывается список программ + SQLQuery1.ExecSQL; + SQLTransaction1.CommitRetaining; + + SetLength(MassivAvtoStr, MyFiltrList.Count, 9); + + for N := 0 to MyList2.Count - 1 do + begin + MassivAvtoStr[N][1] := MyFiltrList[N]; + MassivAvtoStr[N][0] := MyList2[N]; + MassivAvtoStr[N][7] := MyList4[N]; + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + s := 'SELECT * FROM program WHERE (name LIKE "' + MyFiltrList[N] + '%%")'; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + MassivAvtoStr[N][8]:= SQLQuery1.FieldByName('id').AsString; + MassivAvtoStr[N][2]:= SQLQuery1.FieldByName('name').AsString; + MassivAvtoStr[N][3]:= SQLQuery1.FieldByName('type').AsString; + MassivAvtoStr[N][4]:= SQLQuery1.FieldByName('license').AsString; + MassivAvtoStr[N][5]:= SQLQuery1.FieldByName('cena').AsString; + MassivAvtoStr[N][6]:= SQLQuery1.FieldByName('zamena').AsString; + end; + // + + + ProgressBar1.StepBy(1); + SQLQuery1.Close; + SQLQuery1.SQL.Clear; + // Запись полученного списка прог в базу + SQLQuery1.SQL.Add('insert into test(st1, st2, st7, st3, st4, st5, st6, st8, st9)'); + SQLQuery1.SQL.Add('Values (:pText, :pText2, :pText7, :pText3, :pText4, :pText5, :pText6, :pText8, :pText9)'); + for N := 0 to High(MassivAvtoStr) do + begin + SQLQuery1.ParamByName('pText').AsString := MassivAvtoStr[N][1]; //st1 + SQLQuery1.ParamByName('pText2').AsString := MassivAvtoStr[N][2]; //st2 name + SQLQuery1.ParamByName('pText7').AsString := MassivAvtoStr[N][0]; //st7 + SQLQuery1.ParamByName('pText3').AsString := MassivAvtoStr[N][3]; //st3 type + SQLQuery1.ParamByName('pText4').AsString := MassivAvtoStr[N][4]; //st4 license + SQLQuery1.ParamByName('pText5').AsString := MassivAvtoStr[N][5]; //st5 cena + SQLQuery1.ParamByName('pText6').AsString := MassivAvtoStr[N][6]; //st6 zamena + SQLQuery1.ParamByName('pText8').AsString := MassivAvtoStr[N][7]; //st8 + SQLQuery1.ParamByName('pText9').AsString := MassivAvtoStr[N][8]; //st9 + SQLQuery1.ExecSQL; + end; + + + //пробую удалять пустые строки из таблицы тест + +SQLQuery1.SQL.Clear; +SQLQuery1.SQL.Text:='select * from setting'; +SQLQuery1.Open; +SQLQuery1.First; + + N:=SQLQuery1.FieldByName('AvtoUnkProg').AsInteger; + if N = 1 then + begin + s := 'delete from test where st3='''''; + SQLQuery1.Close; + SQLQuery1.SQL.Text := s; + SQLQuery1.ExecSQL; + SQLTransaction1.CommitRetaining; + end; + // конец удаления пустых строк + + //начало постройки запроса согласно настройкам программы + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + s := 'select * from setting'; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + + {SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Text:='select * from setting'; + SQLQuery1.Open; + SQLQuery1.First; } + + s := ''; + s := 'SELECT '; + + Nst7:=SQLQuery1.FieldByName('AvtoSt7').AsInteger; + if Nst7 = 1 then + s := s + 'st7'; // исходное название + + Nst2:=SQLQuery1.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 1) then + s := s + ', st2'; // название в бд + + Nst2:=SQLQuery1.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 0) then + s := s + ' st2'; + + Nst3:=SQLQuery1.FieldByName('AvtoSt3').AsInteger; + Nst4:=SQLQuery1.FieldByName('AvtoSt4').AsInteger; + Nst5:=SQLQuery1.FieldByName('AvtoSt5').AsInteger; + Nst6:=SQLQuery1.FieldByName('AvtoSt6').AsInteger; + + if Nst3 = 1 then + s := s + ', st3'; // тип по + + if Nst4 = 1 then + s := s + ', st4'; // лицензия + + if Nst5 = 1 then + s := s + ', st5'; // стоимость + + if Nst6 = 1 then + s := s + ', st6'; // замена + + s := s + ' FROM test'; + //конец постройки запроса + + // s := ''; оригинал запроса + // s := 'SELECT st7, st2, st3, st4, st5, st6 FROM test'; + //конец обработки массива + ProgressBar1.StepBy(1); + + MyList.Free; + MyList2.Free; + MyList4.Free; +SQLQuery1.Close; +SQLQuery1.Active:=false; +SQLQuery1.SQL.Clear; +SQLQuery1.SQL.Add(s); +SQLQuery1.Active:=true; +SQLQuery1.Open; +if nilAvtoSearch<>1 then nilAvtoSearch:=1; +ProgressBar1.StepBy(1); + //заполняем заголовки колонок и меняем ширину колонок + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //23456 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2456 + Nst4Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2356 + Nst3Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2346 + Nst3Pos := 1; + Nst4Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; //2345 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7256 + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7246 + Nst4Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7234 + Nst3Pos := 2; + Nst4Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7235 + Nst3Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7236 + Nst3Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //23 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //24 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //25 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst6Pos := 1; //26 + end; + +if Nst7 = 1 then +begin +DBGrid1.Columns[Nst7Pos].Title.Caption:='Исходное название'; +DBGrid1.Columns[Nst7Pos].Width:= 200; +end; +if Nst2 = 1 then +begin +DBGrid1.Columns[Nst2Pos].Title.Caption:='Название в БД'; +DBGrid1.Columns[Nst2Pos].Width:= 110; +end; +if Nst3 = 1 then +begin +DBGrid1.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid1.Columns[Nst3Pos].Width:= 150; +end; +if Nst4 = 1 then +begin +DBGrid1.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid1.Columns[Nst4Pos].Width:= 110; +end; +if Nst5 = 1 then +begin +DBGrid1.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid1.Columns[Nst5Pos].Width:= 90; +end; +if Nst6 = 1 then +begin +DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid1.Columns[Nst6Pos].Width:= 150; +end; +ProgressBar1.StepBy(1); +lProgress.Caption:='Готово'; +MyFiltrList.free; +end; + +procedure TfMian.mSettingsClick(Sender: TObject); +begin + fSettings.ShowModal; +end; + + +procedure TfMian.mSort00Click(Sender: TObject); +var + s:string; + Nst7:Word; + Nst2:Word; // для загрузки из базы настроек + Nst3:Word; // какие нужно загружать столбцы в автопоиске + Nst4:Word; + Nst5:Word; + Nst6:Word; + Nst1:Word; + Nst7Pos:Word; // переменные для определения позиций колонок + Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины + Nst3Pos:Word; + Nst4Pos:Word; + Nst5Pos:Word; + Nst6Pos:Word; + Nst1Pos:Word; +begin + //если автопоиск + if PageControl1.ActivePageindex=0 then + begin + + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + s := 'select * from setting'; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + + s := ''; + s := 'SELECT '; + + Nst7:=SQLQuery1.FieldByName('AvtoSt7').AsInteger; + if Nst7 = 1 then + s := s + 'st7'; // исходное название + + Nst2:=SQLQuery1.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 1) then + s := s + ', st2'; // название в бд + + Nst2:=SQLQuery1.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 0) then + s := s + ' st2'; + + Nst3:=SQLQuery1.FieldByName('AvtoSt3').AsInteger; + Nst4:=SQLQuery1.FieldByName('AvtoSt4').AsInteger; + Nst5:=SQLQuery1.FieldByName('AvtoSt5').AsInteger; + Nst6:=SQLQuery1.FieldByName('AvtoSt6').AsInteger; + + if Nst3 = 1 then + s := s + ', st3'; // тип по + + if Nst4 = 1 then + s := s + ', st4'; // лицензия + + if Nst5 = 1 then + s := s + ', st5'; // стоимость + + if Nst6 = 1 then + s := s + ', st6'; // замена + + s := s + ' FROM test order by st1'; + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + SQLQuery1.Open; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //23456 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2456 + Nst4Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2356 + Nst3Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2346 + Nst3Pos := 1; + Nst4Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; //2345 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7256 + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7246 + Nst4Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7234 + Nst3Pos := 2; + Nst4Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7235 + Nst3Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7236 + Nst3Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //23 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //24 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //25 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst6Pos := 1; //26 + end; + +if Nst7 = 1 then +begin +DBGrid1.Columns[Nst7Pos].Title.Caption:='Исходное название'; +DBGrid1.Columns[Nst7Pos].Width:= 200; +end; +if Nst2 = 1 then +begin +DBGrid1.Columns[Nst2Pos].Title.Caption:='Название в БД'; +DBGrid1.Columns[Nst2Pos].Width:= 110; +end; +if Nst3 = 1 then +begin +DBGrid1.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid1.Columns[Nst3Pos].Width:= 150; +end; +if Nst4 = 1 then +begin +DBGrid1.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid1.Columns[Nst4Pos].Width:= 110; +end; +if Nst5 = 1 then +begin +DBGrid1.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid1.Columns[Nst5Pos].Width:= 90; +end; +if Nst6 = 1 then +begin +DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid1.Columns[Nst6Pos].Width:= 150; +end; + + end; + // если ручной поиск + if PageControl1.ActivePageindex=1 then + begin + { s := ''; + s := 'SELECT st7, st2, st3, st4, st5, st6 FROM ruch order by st1'; + + SQLQuery3.Close; + SQLQuery3.Active:=false; + SQLQuery3.SQL.Clear; + SQLQuery3.SQL.Add(s); + SQLQuery3.Active:=true; + SQLQuery3.Open; + //заполняем заголовки колонок и меняем ширину колонок + DBGrid2.Columns[0].Title.Caption:='Исходное название'; + DBGrid2.Columns[1].Title.Caption:='Название в БД'; + DBGrid2.Columns[2].Title.Caption:='Тип ПО'; + DBGrid2.Columns[3].Title.Caption:='Лицензия'; + DBGrid2.Columns[4].Title.Caption:='Стоимость'; + DBGrid2.Columns[5].Title.Caption:='Замена'; + DBGrid2.Columns[0].Width:= 200; + DBGrid2.Columns[1].Width:= 110; + DBGrid2.Columns[2].Width:= 150; + DBGrid2.Columns[3].Width:= 110; + DBGrid2.Columns[4].Width:= 90; + DBGrid2.Columns[5].Width:= 150; } + + //начало постройки запроса согласно настройкам программы + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + s := 'select * from setting'; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + + {SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Text:='select * from setting'; + SQLQuery1.Open; + SQLQuery1.First; } + + s := ''; + s := 'SELECT '; + + Nst7:=SQLQuery1.FieldByName('RuchSt7').AsInteger; + if Nst7 = 1 then + s := s + 'st7'; // путь + + Nst2:=SQLQuery1.FieldByName('RuchSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 1) then + s := s + ', st2'; // название + + if (Nst2 = 1) and (Nst7 = 0) then + s := s + ' st2'; + + if Nst2=0 then + begin + showmessage('Поле "Название" отключено, поэтому данный вид сортировки недоступен.'); + exit; + end; + + Nst1:=SQLQuery1.FieldByName('RuchSt1').AsInteger; + Nst3:=SQLQuery1.FieldByName('RuchSt3').AsInteger; + Nst4:=SQLQuery1.FieldByName('RuchSt4').AsInteger; + Nst5:=SQLQuery1.FieldByName('RuchSt5').AsInteger; + Nst6:=SQLQuery1.FieldByName('RuchSt6').AsInteger; + + if Nst1 = 1 then + begin + if (Nst2 = 0) and (Nst7 = 0) and (Nst1 = 1) then + s := s + ' st1' + else + s := s + ', st1'; + end; + //if Nst1 = 1 then + //s := s + ', st1'; // исходный запрос + + if Nst3 = 1 then + s := s + ', st3'; // тип по + + if Nst4 = 1 then + s := s + ', st4'; // лицензия + + if Nst5 = 1 then + s := s + ', st5'; // стоимость + + if Nst6 = 1 then + s := s + ', st6'; // замена + + if Nst2 = 1 then + s := s + ' FROM ruch ORDER BY st2 DESC' + else + s := s + ' FROM ruch'; + //showmessage(s); + //конец постройки запроса + + +SQLQuery3.Close; +SQLQuery3.Active:=false; +SQLQuery3.SQL.Clear; +SQLQuery3.SQL.Add(s); +SQLQuery3.Active:=true; +SQLQuery3.Open; + + //заполняем заголовки колонок и меняем ширину колонок + + if (Nst7 = 1) and (Nst2 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; + Nst1Pos := 2; //7213456 + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; + Nst6Pos := 6; +// showmessage('Сработал вариант 7213456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 723456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //713456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 713456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712456 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712356 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712356'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712346 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712346'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712345 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; +// showmessage('Сработал вариант 712345'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 123456'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //13456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 13456'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12456'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12356'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12346'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 12345'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //73456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 73456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72356'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72346'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 72345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71356'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71346'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71256 + Nst2Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71256'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71246 + Nst2Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71246'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71245 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71245'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71236 + Nst2Pos := 2; + Nst3Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71236'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71235 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71235'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71234 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; +// showmessage('Сработал вариант 71234'); + end; + + if (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst7 = 0) then + begin + Nst3Pos := 0; + Nst4Pos := 1; //3456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 3456'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst3 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //2456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2456'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2356'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2346'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2345 + Nst4Pos := 2; + Nst5Pos := 3; + // showmessage('Сработал вариант 2345'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //7456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7456'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7356'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7346'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7345 + Nst4Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7156 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7156'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7146 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7146'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7145 + Nst4Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7145'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7126 + Nst2Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7126'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7125 + Nst2Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7125'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7123 + Nst2Pos := 2; + Nst3Pos := 3; + // showmessage('Сработал вариант 7123'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712 + Nst2Pos := 2; + // showmessage('Сработал вариант 712'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //713 + Nst3Pos := 2; +// showmessage('Сработал вариант 713'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //714 + Nst4Pos := 2; +// showmessage('Сработал вариант 714'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //715 + Nst5Pos := 2; +// showmessage('Сработал вариант 715'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //716 + Nst6Pos := 2; +// showmessage('Сработал вариант 716'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; +// showmessage('Сработал вариант 723'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; +// showmessage('Сработал вариант 724'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; +// showmessage('Сработал вариант 725'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; +// showmessage('Сработал вариант 726'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //734 + Nst4Pos := 2; +// showmessage('Сработал вариант 734'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //735 + Nst5Pos := 2; +// showmessage('Сработал вариант 735'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //736 + Nst6Pos := 2; +// showmessage('Сработал вариант 736'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //745 + Nst5Pos := 2; +// showmessage('Сработал вариант 745'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst1 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //746 + Nst6Pos := 2; +// showmessage('Сработал вариант 746'); + end; + + if (Nst7 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //756 + Nst2Pos := 2; +// showmessage('Сработал вариант 756'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst7 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123 + Nst3Pos := 2; +// showmessage('Сработал вариант 123'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //124 + Nst4Pos := 2; +// showmessage('Сработал вариант 124'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //125 + Nst5Pos := 2; +// showmessage('Сработал вариант 125'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //136 + Nst6Pos := 2; +// showmessage('Сработал вариант 136'); + end; + + if (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst4Pos := 1; //145 + Nst5Pos := 2; +// showmessage('Сработал вариант 145'); + end; + + if (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst4Pos := 1; //146 + Nst6Pos := 2; +// showmessage('Сработал вариант 146'); + end; + + if (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst1Pos := 0; + Nst5Pos := 1; //156 + Nst6Pos := 2; +// showmessage('Сработал вариант 156'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst5 = 0) and (Nst6 = 0) and (Nst7 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; +// showmessage('Сработал вариант 234'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; +// showmessage('Сработал вариант 235'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; +// showmessage('Сработал вариант 236'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; +// showmessage('Сработал вариант 245'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; +// showmessage('Сработал вариант 246'); + end; + + if (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; +// showmessage('Сработал вариант 256'); + end; + + // showmessage('Nst7Pos' + IntToStr(Nst7Pos) + #13 + ' Nst2Pos' + IntToStr(Nst2Pos) + #13 + 'Nst1Pos' + IntToStr(Nst1Pos) + #13 + ' Nst3Pos' + IntToStr(Nst3Pos) + #13 + ' Nst4Pos' + IntToStr(Nst4Pos) + #13 + ' Nst5Pos' + IntToStr(Nst5Pos) + #13 + ' Nst6Pos' + IntToStr(Nst6Pos)); + + +if Nst7 = 1 then +begin +DBGrid2.Columns[Nst7Pos].Title.Caption:='Путь'; +DBGrid2.Columns[Nst7Pos].Width:= 200; +end; +if Nst2 = 1 then +begin +DBGrid2.Columns[Nst2Pos].Title.Caption:='Название'; +DBGrid2.Columns[Nst2Pos].Width:= 110; +end; + +if Nst1 = 1 then +begin +DBGrid2.Columns[Nst1Pos].Title.Caption:='Исходный запрос'; +DBGrid2.Columns[Nst1Pos].Width:= 80; +end; + +if Nst3 = 1 then +begin +DBGrid2.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid2.Columns[Nst3Pos].Width:= 130; +end; +if Nst4 = 1 then +begin +DBGrid2.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid2.Columns[Nst4Pos].Width:= 90; +end; +if Nst5 = 1 then +begin +DBGrid2.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid2.Columns[Nst5Pos].Width:= 80; +end; +if Nst6 = 1 then +begin +DBGrid2.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid2.Columns[Nst6Pos].Width:= 130; +end; + + end; +end; + +procedure TfMian.mSort01Click(Sender: TObject); +var + s:string; + Nst7:Word; + Nst2:Word; // для загрузки из базы настроек + Nst3:Word; // какие нужно загружать столбцы в автопоиске + Nst4:Word; + Nst5:Word; + Nst6:Word; + Nst1:Word; + Nst7Pos:Word; // переменные для определения позиций колонок + Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины + Nst3Pos:Word; + Nst4Pos:Word; + Nst5Pos:Word; + Nst6Pos:Word; + Nst1Pos:Word; +begin + //если автопоиск + if PageControl1.ActivePageindex=0 then + begin + {s := ''; + s := 'SELECT st7, st2, st3, st4, st5, st6 FROM test order by st3 DESC'; + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + SQLQuery1.Open; + //заполняем заголовки колонок и меняем ширину колонок + DBGrid1.Columns[0].Title.Caption:='Исходное название'; + DBGrid1.Columns[1].Title.Caption:='Название в БД'; + DBGrid1.Columns[2].Title.Caption:='Тип ПО'; + DBGrid1.Columns[3].Title.Caption:='Лицензия'; + DBGrid1.Columns[4].Title.Caption:='Стоимость'; + DBGrid1.Columns[5].Title.Caption:='Замена'; + DBGrid1.Columns[0].Width:= 200; + DBGrid1.Columns[1].Width:= 110; + DBGrid1.Columns[2].Width:= 150; + DBGrid1.Columns[3].Width:= 110; + DBGrid1.Columns[4].Width:= 90; + DBGrid1.Columns[5].Width:= 150;} + + SQLQuery2.Close; + SQLQuery2.Active:=false; + SQLQuery2.SQL.Clear; + s := 'select * from setting'; + SQLQuery2.SQL.Add(s); + SQLQuery2.Active:=true; + + Nst3:=SQLQuery2.FieldByName('AvtoSt3').AsInteger; + if Nst3=0 then + begin + showmessage('Поле "Тип ПО" отключено, поэтому данный вид сортировки недоступен.'); + exit; + end; + + s := ''; + s := 'SELECT '; + + Nst7:=SQLQuery2.FieldByName('AvtoSt7').AsInteger; + if Nst7 = 1 then + s := s + 'st7'; // исходное название + + Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 1) then + s := s + ', st2'; // название в бд + + Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 0) then + s := s + ' st2'; + + Nst4:=SQLQuery2.FieldByName('AvtoSt4').AsInteger; + Nst5:=SQLQuery2.FieldByName('AvtoSt5').AsInteger; + Nst6:=SQLQuery2.FieldByName('AvtoSt6').AsInteger; + + if Nst3 = 1 then + s := s + ', st3'; // тип по + + if Nst4 = 1 then + s := s + ', st4'; // лицензия + + if Nst5 = 1 then + s := s + ', st5'; // стоимость + + if Nst6 = 1 then + s := s + ', st6'; // замена + + s := s + ' FROM test order by st3 DESC'; + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + SQLQuery1.Open; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //23456 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2456 + Nst4Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2356 + Nst3Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2346 + Nst3Pos := 1; + Nst4Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; //2345 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7256 + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7246 + Nst4Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7234 + Nst3Pos := 2; + Nst4Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7235 + Nst3Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7236 + Nst3Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //23 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //24 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //25 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst6Pos := 1; //26 + end; + +if Nst7 = 1 then +begin +DBGrid1.Columns[Nst7Pos].Title.Caption:='Исходное название'; +DBGrid1.Columns[Nst7Pos].Width:= 200; +end; +if Nst2 = 1 then +begin +DBGrid1.Columns[Nst2Pos].Title.Caption:='Название в БД'; +DBGrid1.Columns[Nst2Pos].Width:= 110; +end; +if Nst3 = 1 then +begin +DBGrid1.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid1.Columns[Nst3Pos].Width:= 150; +end; +if Nst4 = 1 then +begin +DBGrid1.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid1.Columns[Nst4Pos].Width:= 110; +end; +if Nst5 = 1 then +begin +DBGrid1.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid1.Columns[Nst5Pos].Width:= 90; +end; +if Nst6 = 1 then +begin +DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid1.Columns[Nst6Pos].Width:= 150; +end; + end; + + //если ручной поиск + if PageControl1.ActivePageindex=1 then + begin + { s := ''; + s := 'SELECT st7, st2, st3, st4, st5, st6 FROM ruch order by st3 DESC'; + + SQLQuery3.Close; + SQLQuery3.Active:=false; + SQLQuery3.SQL.Clear; + SQLQuery3.SQL.Add(s); + SQLQuery3.Active:=true; + SQLQuery3.Open; + //заполняем заголовки колонок и меняем ширину колонок + DBGrid2.Columns[0].Title.Caption:='Исходное название'; + DBGrid2.Columns[1].Title.Caption:='Название в БД'; + DBGrid2.Columns[2].Title.Caption:='Тип ПО'; + DBGrid2.Columns[3].Title.Caption:='Лицензия'; + DBGrid2.Columns[4].Title.Caption:='Стоимость'; + DBGrid2.Columns[5].Title.Caption:='Замена'; + DBGrid2.Columns[0].Width:= 200; + DBGrid2.Columns[1].Width:= 110; + DBGrid2.Columns[2].Width:= 150; + DBGrid2.Columns[3].Width:= 110; + DBGrid2.Columns[4].Width:= 90; + DBGrid2.Columns[5].Width:= 150; } + + //начало постройки запроса согласно настройкам программы + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + s := 'select * from setting'; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + + {SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Text:='select * from setting'; + SQLQuery1.Open; + SQLQuery1.First; } + + s := ''; + s := 'SELECT '; + + Nst7:=SQLQuery1.FieldByName('RuchSt7').AsInteger; + if Nst7 = 1 then + s := s + 'st7'; // путь + + Nst2:=SQLQuery1.FieldByName('RuchSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 1) then + s := s + ', st2'; // название + + if (Nst2 = 1) and (Nst7 = 0) then + s := s + ' st2'; + + Nst1:=SQLQuery1.FieldByName('RuchSt1').AsInteger; + Nst3:=SQLQuery1.FieldByName('RuchSt3').AsInteger; + if Nst3=0 then begin - for p2 := 0 to 100 do + showmessage('Поле "Тип ПО" отключено, поэтому данный вид сортировки недоступен.'); + exit; + end; + Nst4:=SQLQuery1.FieldByName('RuchSt4').AsInteger; + Nst5:=SQLQuery1.FieldByName('RuchSt5').AsInteger; + Nst6:=SQLQuery1.FieldByName('RuchSt6').AsInteger; + + if Nst1 = 1 then + begin + if (Nst2 = 0) and (Nst7 = 0) and (Nst1 = 1) then + s := s + ' st1' + else + s := s + ', st1'; + end; + //if Nst1 = 1 then + //s := s + ', st1'; // исходный запрос + + if Nst3 = 1 then + s := s + ', st3'; // тип по + + if Nst4 = 1 then + s := s + ', st4'; // лицензия + + if Nst5 = 1 then + s := s + ', st5'; // стоимость + + if Nst6 = 1 then + s := s + ', st6'; // замена + + if Nst2 = 1 then + s := s + ' FROM ruch ORDER BY st3 DESC' + else + s := s + ' FROM ruch'; + //showmessage(s); + //конец постройки запроса + + +SQLQuery3.Close; +SQLQuery3.Active:=false; +SQLQuery3.SQL.Clear; +SQLQuery3.SQL.Add(s); +SQLQuery3.Active:=true; +SQLQuery3.Open; + + //заполняем заголовки колонок и меняем ширину колонок + + if (Nst7 = 1) and (Nst2 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; + Nst1Pos := 2; //7213456 + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; + Nst6Pos := 6; +// showmessage('Сработал вариант 7213456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 723456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //713456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 713456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712456 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712356 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712356'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712346 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712346'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712345 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; +// showmessage('Сработал вариант 712345'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 123456'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //13456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 13456'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12456'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12356'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12346'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 12345'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //73456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 73456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72356'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72346'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 72345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71356'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71346'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71256 + Nst2Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71256'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71246 + Nst2Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71246'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71245 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71245'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71236 + Nst2Pos := 2; + Nst3Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71236'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71235 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71235'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71234 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; +// showmessage('Сработал вариант 71234'); + end; + + if (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst7 = 0) then + begin + Nst3Pos := 0; + Nst4Pos := 1; //3456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 3456'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst3 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //2456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2456'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2356'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2346'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2345 + Nst4Pos := 2; + Nst5Pos := 3; + // showmessage('Сработал вариант 2345'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //7456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7456'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7356'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7346'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7345 + Nst4Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7156 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7156'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7146 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7146'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7145 + Nst4Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7145'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7126 + Nst2Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7126'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7125 + Nst2Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7125'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7123 + Nst2Pos := 2; + Nst3Pos := 3; + // showmessage('Сработал вариант 7123'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712 + Nst2Pos := 2; + // showmessage('Сработал вариант 712'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //713 + Nst3Pos := 2; +// showmessage('Сработал вариант 713'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //714 + Nst4Pos := 2; +// showmessage('Сработал вариант 714'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //715 + Nst5Pos := 2; +// showmessage('Сработал вариант 715'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //716 + Nst6Pos := 2; +// showmessage('Сработал вариант 716'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; +// showmessage('Сработал вариант 723'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; +// showmessage('Сработал вариант 724'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; +// showmessage('Сработал вариант 725'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; +// showmessage('Сработал вариант 726'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //734 + Nst4Pos := 2; +// showmessage('Сработал вариант 734'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //735 + Nst5Pos := 2; +// showmessage('Сработал вариант 735'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //736 + Nst6Pos := 2; +// showmessage('Сработал вариант 736'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //745 + Nst5Pos := 2; +// showmessage('Сработал вариант 745'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst1 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //746 + Nst6Pos := 2; +// showmessage('Сработал вариант 746'); + end; + + if (Nst7 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //756 + Nst2Pos := 2; +// showmessage('Сработал вариант 756'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst7 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123 + Nst3Pos := 2; +// showmessage('Сработал вариант 123'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //124 + Nst4Pos := 2; +// showmessage('Сработал вариант 124'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //125 + Nst5Pos := 2; +// showmessage('Сработал вариант 125'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //136 + Nst6Pos := 2; +// showmessage('Сработал вариант 136'); + end; + + if (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst4Pos := 1; //145 + Nst5Pos := 2; +// showmessage('Сработал вариант 145'); + end; + + if (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst4Pos := 1; //146 + Nst6Pos := 2; +// showmessage('Сработал вариант 146'); + end; + + if (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst1Pos := 0; + Nst5Pos := 1; //156 + Nst6Pos := 2; +// showmessage('Сработал вариант 156'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst5 = 0) and (Nst6 = 0) and (Nst7 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; +// showmessage('Сработал вариант 234'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; +// showmessage('Сработал вариант 235'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; +// showmessage('Сработал вариант 236'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; +// showmessage('Сработал вариант 245'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; +// showmessage('Сработал вариант 246'); + end; + + if (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; +// showmessage('Сработал вариант 256'); + end; + + // showmessage('Nst7Pos' + IntToStr(Nst7Pos) + #13 + ' Nst2Pos' + IntToStr(Nst2Pos) + #13 + 'Nst1Pos' + IntToStr(Nst1Pos) + #13 + ' Nst3Pos' + IntToStr(Nst3Pos) + #13 + ' Nst4Pos' + IntToStr(Nst4Pos) + #13 + ' Nst5Pos' + IntToStr(Nst5Pos) + #13 + ' Nst6Pos' + IntToStr(Nst6Pos)); + + +if Nst7 = 1 then +begin +DBGrid2.Columns[Nst7Pos].Title.Caption:='Путь'; +DBGrid2.Columns[Nst7Pos].Width:= 200; +end; +if Nst2 = 1 then +begin +DBGrid2.Columns[Nst2Pos].Title.Caption:='Название'; +DBGrid2.Columns[Nst2Pos].Width:= 110; +end; + +if Nst1 = 1 then +begin +DBGrid2.Columns[Nst1Pos].Title.Caption:='Исходный запрос'; +DBGrid2.Columns[Nst1Pos].Width:= 80; +end; + +if Nst3 = 1 then +begin +DBGrid2.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid2.Columns[Nst3Pos].Width:= 130; +end; +if Nst4 = 1 then +begin +DBGrid2.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid2.Columns[Nst4Pos].Width:= 90; +end; +if Nst5 = 1 then +begin +DBGrid2.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid2.Columns[Nst5Pos].Width:= 80; +end; +if Nst6 = 1 then +begin +DBGrid2.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid2.Columns[Nst6Pos].Width:= 130; +end; + end; +end; + +procedure TfMian.mSort02Click(Sender: TObject); + +var + s:string; + Nst7:Word; + Nst2:Word; // для загрузки из базы настроек + Nst3:Word; // какие нужно загружать столбцы в автопоиске + Nst4:Word; + Nst5:Word; + Nst6:Word; + Nst1:Word; + Nst7Pos:Word; // переменные для определения позиций колонок + Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины + Nst3Pos:Word; + Nst4Pos:Word; + Nst5Pos:Word; + Nst6Pos:Word; + Nst1Pos:Word; +begin + //если автопоиск + if PageControl1.ActivePageindex=0 then + begin + {s := ''; + s := 'SELECT st7, st2, st3, st4, st5, st6 FROM test order by st4 DESC'; + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + SQLQuery1.Open; + //заполняем заголовки колонок и меняем ширину колонок + DBGrid1.Columns[0].Title.Caption:='Исходное название'; + DBGrid1.Columns[1].Title.Caption:='Название в БД'; + DBGrid1.Columns[2].Title.Caption:='Тип ПО'; + DBGrid1.Columns[3].Title.Caption:='Лицензия'; + DBGrid1.Columns[4].Title.Caption:='Стоимость'; + DBGrid1.Columns[5].Title.Caption:='Замена'; + DBGrid1.Columns[0].Width:= 200; + DBGrid1.Columns[1].Width:= 110; + DBGrid1.Columns[2].Width:= 150; + DBGrid1.Columns[3].Width:= 110; + DBGrid1.Columns[4].Width:= 90; + DBGrid1.Columns[5].Width:= 150; } + + SQLQuery2.Close; + SQLQuery2.Active:=false; + SQLQuery2.SQL.Clear; + s := 'select * from setting'; + SQLQuery2.SQL.Add(s); + SQLQuery2.Active:=true; + + Nst4:=SQLQuery2.FieldByName('AvtoSt4').AsInteger; + if Nst4=0 then begin - p3:=' ' + IntToStr(p1) + '.' + IntToStr(p2); - UTF8Delete(FiltrStr, UTF8Pos(p3, FiltrStr), UTF8Length(FiltrStr)); - end; - end; + showmessage('Поле "Лицензия" отключено, поэтому данный вид сортировки недоступен.'); + exit; end; - //11.11 - if UTF8Pos('.', FiltrStr)<>0 then - begin - for p1 := 0 to 100 do - begin - for p2 := 0 to 100 do + + s := ''; + s := 'SELECT '; + + Nst7:=SQLQuery2.FieldByName('AvtoSt7').AsInteger; + if Nst7 = 1 then + s := s + 'st7'; // исходное название + + Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 1) then + s := s + ', st2'; // название в бд + + Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 0) then + s := s + ' st2'; + + Nst3:=SQLQuery2.FieldByName('AvtoSt3').AsInteger; + Nst5:=SQLQuery2.FieldByName('AvtoSt5').AsInteger; + Nst6:=SQLQuery2.FieldByName('AvtoSt6').AsInteger; + + if Nst3 = 1 then + s := s + ', st3'; // тип по + + if Nst4 = 1 then + s := s + ', st4'; // лицензия + + if Nst5 = 1 then + s := s + ', st5'; // стоимость + + if Nst6 = 1 then + s := s + ', st6'; // замена + + s := s + ' FROM test order by st4 DESC'; + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + SQLQuery1.Open; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //23456 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2456 + Nst4Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2356 + Nst3Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2346 + Nst3Pos := 1; + Nst4Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; //2345 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7256 + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7246 + Nst4Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7234 + Nst3Pos := 2; + Nst4Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7235 + Nst3Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7236 + Nst3Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //23 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //24 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //25 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst6Pos := 1; //26 + end; + +if Nst7 = 1 then +begin +DBGrid1.Columns[Nst7Pos].Title.Caption:='Исходное название'; +DBGrid1.Columns[Nst7Pos].Width:= 200; +end; +if Nst2 = 1 then +begin +DBGrid1.Columns[Nst2Pos].Title.Caption:='Название в БД'; +DBGrid1.Columns[Nst2Pos].Width:= 110; +end; +if Nst3 = 1 then +begin +DBGrid1.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid1.Columns[Nst3Pos].Width:= 150; +end; +if Nst4 = 1 then +begin +DBGrid1.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid1.Columns[Nst4Pos].Width:= 110; +end; +if Nst5 = 1 then +begin +DBGrid1.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid1.Columns[Nst5Pos].Width:= 90; +end; +if Nst6 = 1 then +begin +DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid1.Columns[Nst6Pos].Width:= 150; +end; + end; + //если ручной + if PageControl1.ActivePageindex=1 then + begin + { s := ''; + s := 'SELECT st7, st2, st3, st4, st5, st6 FROM ruch order by st4 DESC'; + + SQLQuery3.Close; + SQLQuery3.Active:=false; + SQLQuery3.SQL.Clear; + SQLQuery3.SQL.Add(s); + SQLQuery3.Active:=true; + SQLQuery3.Open; + //заполняем заголовки колонок и меняем ширину колонок + DBGrid2.Columns[0].Title.Caption:='Исходное название'; + DBGrid2.Columns[1].Title.Caption:='Название в БД'; + DBGrid2.Columns[2].Title.Caption:='Тип ПО'; + DBGrid2.Columns[3].Title.Caption:='Лицензия'; + DBGrid2.Columns[4].Title.Caption:='Стоимость'; + DBGrid2.Columns[5].Title.Caption:='Замена'; + DBGrid2.Columns[0].Width:= 200; + DBGrid2.Columns[1].Width:= 110; + DBGrid2.Columns[2].Width:= 150; + DBGrid2.Columns[3].Width:= 110; + DBGrid2.Columns[4].Width:= 90; + DBGrid2.Columns[5].Width:= 150; } + //начало постройки запроса согласно настройкам программы + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + s := 'select * from setting'; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + + {SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Text:='select * from setting'; + SQLQuery1.Open; + SQLQuery1.First; } + + s := ''; + s := 'SELECT '; + + Nst7:=SQLQuery1.FieldByName('RuchSt7').AsInteger; + if Nst7 = 1 then + s := s + 'st7'; // путь + + Nst2:=SQLQuery1.FieldByName('RuchSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 1) then + s := s + ', st2'; // название + + if (Nst2 = 1) and (Nst7 = 0) then + s := s + ' st2'; + + Nst1:=SQLQuery1.FieldByName('RuchSt1').AsInteger; + Nst3:=SQLQuery1.FieldByName('RuchSt3').AsInteger; + Nst4:=SQLQuery1.FieldByName('RuchSt4').AsInteger; + if Nst4=0 then begin - p3:=IntToStr(p1) + '.' + IntToStr(p2); - UTF8Delete(FiltrStr, UTF8Pos(p3, FiltrStr), UTF8Length(FiltrStr)); - end; - end; + showmessage('Поле "Лицензия" отключено, поэтому данный вид сортировки недоступен.'); + exit; end; - //-11.11 - if UTF8Pos('.', FiltrStr)<>0 then - begin - for p1 := 0 to 100 do - begin - for p2 := 0 to 100 do + Nst5:=SQLQuery1.FieldByName('RuchSt5').AsInteger; + Nst6:=SQLQuery1.FieldByName('RuchSt6').AsInteger; + + if Nst1 = 1 then + begin + if (Nst2 = 0) and (Nst7 = 0) and (Nst1 = 1) then + s := s + ' st1' + else + s := s + ', st1'; + end; + //if Nst1 = 1 then + //s := s + ', st1'; // исходный запрос + + if Nst3 = 1 then + s := s + ', st3'; // тип по + + if Nst4 = 1 then + s := s + ', st4'; // лицензия + + if Nst5 = 1 then + s := s + ', st5'; // стоимость + + if Nst6 = 1 then + s := s + ', st6'; // замена + + if Nst2 = 1 then + s := s + ' FROM ruch ORDER BY st4 DESC' + else + s := s + ' FROM ruch'; + //showmessage(s); + //конец постройки запроса + + +SQLQuery3.Close; +SQLQuery3.Active:=false; +SQLQuery3.SQL.Clear; +SQLQuery3.SQL.Add(s); +SQLQuery3.Active:=true; +SQLQuery3.Open; + + //заполняем заголовки колонок и меняем ширину колонок + + if (Nst7 = 1) and (Nst2 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; + Nst1Pos := 2; //7213456 + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; + Nst6Pos := 6; +// showmessage('Сработал вариант 7213456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 723456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //713456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 713456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712456 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712356 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712356'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712346 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712346'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712345 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; +// showmessage('Сработал вариант 712345'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 123456'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //13456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 13456'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12456'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12356'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12346'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 12345'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //73456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 73456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72356'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72346'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 72345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71356'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71346'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71256 + Nst2Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71256'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71246 + Nst2Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71246'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71245 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71245'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71236 + Nst2Pos := 2; + Nst3Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71236'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71235 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71235'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71234 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; +// showmessage('Сработал вариант 71234'); + end; + + if (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst7 = 0) then + begin + Nst3Pos := 0; + Nst4Pos := 1; //3456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 3456'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst3 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //2456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2456'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2356'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2346'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2345 + Nst4Pos := 2; + Nst5Pos := 3; + // showmessage('Сработал вариант 2345'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //7456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7456'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7356'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7346'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7345 + Nst4Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7156 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7156'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7146 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7146'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7145 + Nst4Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7145'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7126 + Nst2Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7126'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7125 + Nst2Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7125'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7123 + Nst2Pos := 2; + Nst3Pos := 3; + // showmessage('Сработал вариант 7123'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712 + Nst2Pos := 2; + // showmessage('Сработал вариант 712'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //713 + Nst3Pos := 2; +// showmessage('Сработал вариант 713'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //714 + Nst4Pos := 2; +// showmessage('Сработал вариант 714'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //715 + Nst5Pos := 2; +// showmessage('Сработал вариант 715'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //716 + Nst6Pos := 2; +// showmessage('Сработал вариант 716'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; +// showmessage('Сработал вариант 723'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; +// showmessage('Сработал вариант 724'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; +// showmessage('Сработал вариант 725'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; +// showmessage('Сработал вариант 726'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //734 + Nst4Pos := 2; +// showmessage('Сработал вариант 734'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //735 + Nst5Pos := 2; +// showmessage('Сработал вариант 735'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //736 + Nst6Pos := 2; +// showmessage('Сработал вариант 736'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //745 + Nst5Pos := 2; +// showmessage('Сработал вариант 745'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst1 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //746 + Nst6Pos := 2; +// showmessage('Сработал вариант 746'); + end; + + if (Nst7 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //756 + Nst2Pos := 2; +// showmessage('Сработал вариант 756'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst7 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123 + Nst3Pos := 2; +// showmessage('Сработал вариант 123'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //124 + Nst4Pos := 2; +// showmessage('Сработал вариант 124'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //125 + Nst5Pos := 2; +// showmessage('Сработал вариант 125'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //136 + Nst6Pos := 2; +// showmessage('Сработал вариант 136'); + end; + + if (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst4Pos := 1; //145 + Nst5Pos := 2; +// showmessage('Сработал вариант 145'); + end; + + if (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst4Pos := 1; //146 + Nst6Pos := 2; +// showmessage('Сработал вариант 146'); + end; + + if (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst1Pos := 0; + Nst5Pos := 1; //156 + Nst6Pos := 2; +// showmessage('Сработал вариант 156'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst5 = 0) and (Nst6 = 0) and (Nst7 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; +// showmessage('Сработал вариант 234'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; +// showmessage('Сработал вариант 235'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; +// showmessage('Сработал вариант 236'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; +// showmessage('Сработал вариант 245'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; +// showmessage('Сработал вариант 246'); + end; + + if (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; +// showmessage('Сработал вариант 256'); + end; + + // showmessage('Nst7Pos' + IntToStr(Nst7Pos) + #13 + ' Nst2Pos' + IntToStr(Nst2Pos) + #13 + 'Nst1Pos' + IntToStr(Nst1Pos) + #13 + ' Nst3Pos' + IntToStr(Nst3Pos) + #13 + ' Nst4Pos' + IntToStr(Nst4Pos) + #13 + ' Nst5Pos' + IntToStr(Nst5Pos) + #13 + ' Nst6Pos' + IntToStr(Nst6Pos)); + + +if Nst7 = 1 then +begin +DBGrid2.Columns[Nst7Pos].Title.Caption:='Путь'; +DBGrid2.Columns[Nst7Pos].Width:= 200; +end; +if Nst2 = 1 then +begin +DBGrid2.Columns[Nst2Pos].Title.Caption:='Название'; +DBGrid2.Columns[Nst2Pos].Width:= 110; +end; + +if Nst1 = 1 then +begin +DBGrid2.Columns[Nst1Pos].Title.Caption:='Исходный запрос'; +DBGrid2.Columns[Nst1Pos].Width:= 80; +end; + +if Nst3 = 1 then +begin +DBGrid2.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid2.Columns[Nst3Pos].Width:= 130; +end; +if Nst4 = 1 then +begin +DBGrid2.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid2.Columns[Nst4Pos].Width:= 90; +end; +if Nst5 = 1 then +begin +DBGrid2.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid2.Columns[Nst5Pos].Width:= 80; +end; +if Nst6 = 1 then +begin +DBGrid2.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid2.Columns[Nst6Pos].Width:= 130; +end; + end; +end; + + +procedure TfMian.mSort03Click(Sender: TObject); +var + s:string; + Nst7:Word; + Nst2:Word; // для загрузки из базы настроек + Nst3:Word; // какие нужно загружать столбцы в автопоиске + Nst4:Word; + Nst5:Word; + Nst6:Word; + Nst1:Word; + Nst7Pos:Word; // переменные для определения позиций колонок + Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины + Nst3Pos:Word; + Nst4Pos:Word; + Nst5Pos:Word; + Nst6Pos:Word; + Nst1Pos:Word; +begin + //если автопоиск + if PageControl1.ActivePageindex=0 then + begin + { s := ''; + s := 'SELECT st7, st2, st3, st4, st5, st6 FROM test order by st5 DESC'; + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + SQLQuery1.Open; + //заполняем заголовки колонок и меняем ширину колонок + DBGrid1.Columns[0].Title.Caption:='Исходное название'; + DBGrid1.Columns[1].Title.Caption:='Название в БД'; + DBGrid1.Columns[2].Title.Caption:='Тип ПО'; + DBGrid1.Columns[3].Title.Caption:='Лицензия'; + DBGrid1.Columns[4].Title.Caption:='Стоимость'; + DBGrid1.Columns[5].Title.Caption:='Замена'; + DBGrid1.Columns[0].Width:= 200; + DBGrid1.Columns[1].Width:= 110; + DBGrid1.Columns[2].Width:= 150; + DBGrid1.Columns[3].Width:= 110; + DBGrid1.Columns[4].Width:= 90; + DBGrid1.Columns[5].Width:= 150; } + + SQLQuery2.Close; + SQLQuery2.Active:=false; + SQLQuery2.SQL.Clear; + s := 'select * from setting'; + SQLQuery2.SQL.Add(s); + SQLQuery2.Active:=true; + + Nst5:=SQLQuery2.FieldByName('AvtoSt5').AsInteger; + if Nst5=0 then begin - p3:='-' + IntToStr(p1) + '.' + IntToStr(p2); - UTF8Delete(FiltrStr, UTF8Pos(p3, FiltrStr), UTF8Length(FiltrStr)); - end; - end; + showmessage('Поле "Стоимость" отключено, поэтому данный вид сортировки недоступен.'); + exit; end; - // -11. - if UTF8Pos('.', FiltrStr)<>0 then - begin - for p1 := 0 to 100 do - begin - for p2 := 0 to 100 do + + s := ''; + s := 'SELECT '; + + Nst7:=SQLQuery2.FieldByName('AvtoSt7').AsInteger; + if Nst7 = 1 then + s := s + 'st7'; // исходное название + + Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 1) then + s := s + ', st2'; // название в бд + + Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 0) then + s := s + ' st2'; + + Nst3:=SQLQuery2.FieldByName('AvtoSt3').AsInteger; + Nst4:=SQLQuery2.FieldByName('AvtoSt4').AsInteger; + Nst6:=SQLQuery2.FieldByName('AvtoSt6').AsInteger; + + if Nst3 = 1 then + s := s + ', st3'; // тип по + + if Nst4 = 1 then + s := s + ', st4'; // лицензия + + if Nst5 = 1 then + s := s + ', st5'; // стоимость + + if Nst6 = 1 then + s := s + ', st6'; // замена + + s := s + ' FROM test order by st5 DESC'; + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + SQLQuery1.Open; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //23456 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2456 + Nst4Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2356 + Nst3Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2346 + Nst3Pos := 1; + Nst4Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; //2345 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7256 + Nst5Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7246 + Nst4Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7234 + Nst3Pos := 2; + Nst4Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7235 + Nst3Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7236 + Nst3Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //23 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //24 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //25 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst6Pos := 1; //26 + end; + +if Nst7 = 1 then +begin +DBGrid1.Columns[Nst7Pos].Title.Caption:='Исходное название'; +DBGrid1.Columns[Nst7Pos].Width:= 200; +end; +if Nst2 = 1 then +begin +DBGrid1.Columns[Nst2Pos].Title.Caption:='Название в БД'; +DBGrid1.Columns[Nst2Pos].Width:= 110; +end; +if Nst3 = 1 then +begin +DBGrid1.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid1.Columns[Nst3Pos].Width:= 150; +end; +if Nst4 = 1 then +begin +DBGrid1.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid1.Columns[Nst4Pos].Width:= 110; +end; +if Nst5 = 1 then +begin +DBGrid1.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid1.Columns[Nst5Pos].Width:= 90; +end; +if Nst6 = 1 then +begin +DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid1.Columns[Nst6Pos].Width:= 150; +end; + end; + //если ручной + if PageControl1.ActivePageindex=1 then + begin + { s := ''; + s := 'SELECT st7, st2, st3, st4, st5, st6 FROM ruch order by st5 DESC'; + + SQLQuery3.Close; + SQLQuery3.Active:=false; + SQLQuery3.SQL.Clear; + SQLQuery3.SQL.Add(s); + SQLQuery3.Active:=true; + SQLQuery3.Open; + //заполняем заголовки колонок и меняем ширину колонок + DBGrid2.Columns[0].Title.Caption:='Исходное название'; + DBGrid2.Columns[1].Title.Caption:='Название в БД'; + DBGrid2.Columns[2].Title.Caption:='Тип ПО'; + DBGrid2.Columns[3].Title.Caption:='Лицензия'; + DBGrid2.Columns[4].Title.Caption:='Стоимость'; + DBGrid2.Columns[5].Title.Caption:='Замена'; + DBGrid2.Columns[0].Width:= 200; + DBGrid2.Columns[1].Width:= 110; + DBGrid2.Columns[2].Width:= 150; + DBGrid2.Columns[3].Width:= 110; + DBGrid2.Columns[4].Width:= 90; + DBGrid2.Columns[5].Width:= 150; } + + //начало постройки запроса согласно настройкам программы + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + s := 'select * from setting'; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + + {SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Text:='select * from setting'; + SQLQuery1.Open; + SQLQuery1.First; } + + s := ''; + s := 'SELECT '; + + Nst7:=SQLQuery1.FieldByName('RuchSt7').AsInteger; + if Nst7 = 1 then + s := s + 'st7'; // путь + + Nst2:=SQLQuery1.FieldByName('RuchSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 1) then + s := s + ', st2'; // название + + if (Nst2 = 1) and (Nst7 = 0) then + s := s + ' st2'; + + Nst1:=SQLQuery1.FieldByName('RuchSt1').AsInteger; + Nst3:=SQLQuery1.FieldByName('RuchSt3').AsInteger; + Nst4:=SQLQuery1.FieldByName('RuchSt4').AsInteger; + Nst5:=SQLQuery1.FieldByName('RuchSt5').AsInteger; + if Nst5=0 then begin - p3:='-' + IntToStr(p1) + '.'; - UTF8Delete(FiltrStr, UTF8Pos(p3, FiltrStr), UTF8Length(FiltrStr)); - end; - end; + showmessage('Поле "Стоимость" отключено, поэтому данный вид сортировки недоступен.'); + exit; end; - // (11. - if UTF8Pos('.', FiltrStr)<>0 then - begin - for p1 := 0 to 100 do - begin - for p2 := 0 to 100 do + Nst6:=SQLQuery1.FieldByName('RuchSt6').AsInteger; + + if Nst1 = 1 then + begin + if (Nst2 = 0) and (Nst7 = 0) and (Nst1 = 1) then + s := s + ' st1' + else + s := s + ', st1'; + end; + //if Nst1 = 1 then + //s := s + ', st1'; // исходный запрос + + if Nst3 = 1 then + s := s + ', st3'; // тип по + + if Nst4 = 1 then + s := s + ', st4'; // лицензия + + if Nst5 = 1 then + s := s + ', st5'; // стоимость + + if Nst6 = 1 then + s := s + ', st6'; // замена + + if Nst2 = 1 then + s := s + ' FROM ruch ORDER BY st5 DESC' + else + s := s + ' FROM ruch'; + //showmessage(s); + //конец постройки запроса + + +SQLQuery3.Close; +SQLQuery3.Active:=false; +SQLQuery3.SQL.Clear; +SQLQuery3.SQL.Add(s); +SQLQuery3.Active:=true; +SQLQuery3.Open; + + //заполняем заголовки колонок и меняем ширину колонок + + if (Nst7 = 1) and (Nst2 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; + Nst1Pos := 2; //7213456 + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; + Nst6Pos := 6; +// showmessage('Сработал вариант 7213456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 723456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //713456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 713456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712456 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712356 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712356'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712346 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712346'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712345 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; +// showmessage('Сработал вариант 712345'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 123456'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //13456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 13456'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12456'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12356'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12346'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //12345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 12345'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //73456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 73456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72356'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72346'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 72345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71456'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71356'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71346'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71256 + Nst2Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71256'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71246 + Nst2Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71246'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71245 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71245'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71236 + Nst2Pos := 2; + Nst3Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71236'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71235 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71235'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71234 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; +// showmessage('Сработал вариант 71234'); + end; + + if (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst7 = 0) then + begin + Nst3Pos := 0; + Nst4Pos := 1; //3456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 3456'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst3 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //2456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2456'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2356'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2346'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2345 + Nst4Pos := 2; + Nst5Pos := 3; + // showmessage('Сработал вариант 2345'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //7456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7456'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7356'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7346'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //7345 + Nst4Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7345'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7156 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7156'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7146 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7146'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7145 + Nst4Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7145'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7126 + Nst2Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7126'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7125 + Nst2Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7125'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7123 + Nst2Pos := 2; + Nst3Pos := 3; + // showmessage('Сработал вариант 7123'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //712 + Nst2Pos := 2; + // showmessage('Сработал вариант 712'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //713 + Nst3Pos := 2; +// showmessage('Сработал вариант 713'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //714 + Nst4Pos := 2; +// showmessage('Сработал вариант 714'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //715 + Nst5Pos := 2; +// showmessage('Сработал вариант 715'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //716 + Nst6Pos := 2; +// showmessage('Сработал вариант 716'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; +// showmessage('Сработал вариант 723'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; +// showmessage('Сработал вариант 724'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; +// showmessage('Сработал вариант 725'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; +// showmessage('Сработал вариант 726'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //734 + Nst4Pos := 2; +// showmessage('Сработал вариант 734'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //735 + Nst5Pos := 2; +// showmessage('Сработал вариант 735'); + end; + + if (Nst7 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //736 + Nst6Pos := 2; +// showmessage('Сработал вариант 736'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //745 + Nst5Pos := 2; +// showmessage('Сработал вариант 745'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst1 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //746 + Nst6Pos := 2; +// showmessage('Сработал вариант 746'); + end; + + if (Nst7 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //756 + Nst2Pos := 2; +// showmessage('Сработал вариант 756'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst7 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123 + Nst3Pos := 2; +// showmessage('Сработал вариант 123'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //124 + Nst4Pos := 2; +// showmessage('Сработал вариант 124'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //125 + Nst5Pos := 2; +// showmessage('Сработал вариант 125'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //136 + Nst6Pos := 2; +// showmessage('Сработал вариант 136'); + end; + + if (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst4Pos := 1; //145 + Nst5Pos := 2; +// showmessage('Сработал вариант 145'); + end; + + if (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst4Pos := 1; //146 + Nst6Pos := 2; +// showmessage('Сработал вариант 146'); + end; + + if (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst1Pos := 0; + Nst5Pos := 1; //156 + Nst6Pos := 2; +// showmessage('Сработал вариант 156'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst5 = 0) and (Nst6 = 0) and (Nst7 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; +// showmessage('Сработал вариант 234'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; +// showmessage('Сработал вариант 235'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; +// showmessage('Сработал вариант 236'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; +// showmessage('Сработал вариант 245'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; +// showmessage('Сработал вариант 246'); + end; + + if (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; +// showmessage('Сработал вариант 256'); + end; + + // showmessage('Nst7Pos' + IntToStr(Nst7Pos) + #13 + ' Nst2Pos' + IntToStr(Nst2Pos) + #13 + 'Nst1Pos' + IntToStr(Nst1Pos) + #13 + ' Nst3Pos' + IntToStr(Nst3Pos) + #13 + ' Nst4Pos' + IntToStr(Nst4Pos) + #13 + ' Nst5Pos' + IntToStr(Nst5Pos) + #13 + ' Nst6Pos' + IntToStr(Nst6Pos)); + + +if Nst7 = 1 then +begin +DBGrid2.Columns[Nst7Pos].Title.Caption:='Путь'; +DBGrid2.Columns[Nst7Pos].Width:= 200; +end; +if Nst2 = 1 then +begin +DBGrid2.Columns[Nst2Pos].Title.Caption:='Название'; +DBGrid2.Columns[Nst2Pos].Width:= 110; +end; + +if Nst1 = 1 then +begin +DBGrid2.Columns[Nst1Pos].Title.Caption:='Исходный запрос'; +DBGrid2.Columns[Nst1Pos].Width:= 80; +end; + +if Nst3 = 1 then +begin +DBGrid2.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid2.Columns[Nst3Pos].Width:= 130; +end; +if Nst4 = 1 then +begin +DBGrid2.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid2.Columns[Nst4Pos].Width:= 90; +end; +if Nst5 = 1 then +begin +DBGrid2.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid2.Columns[Nst5Pos].Width:= 80; +end; +if Nst6 = 1 then +begin +DBGrid2.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid2.Columns[Nst6Pos].Width:= 130; +end; + end; +end; + +procedure TfMian.mSort04Click(Sender: TObject); +var + s:string; + Nst7:Word; + Nst2:Word; // для загрузки из базы настроек + Nst3:Word; // какие нужно загружать столбцы в автопоиске + Nst4:Word; + Nst5:Word; + Nst6:Word; + Nst1:Word; + Nst7Pos:Word; // переменные для определения позиций колонок + Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины + Nst3Pos:Word; + Nst4Pos:Word; + Nst5Pos:Word; + Nst6Pos:Word; + Nst1Pos:Word; +begin +//если автопоиск + if PageControl1.ActivePageindex=0 then + begin + { s := ''; + s := 'SELECT st7, st2, st3, st4, st5, st6 FROM test order by st6 DESC'; + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + SQLQuery1.Open; + //заполняем заголовки колонок и меняем ширину колонок + DBGrid1.Columns[0].Title.Caption:='Исходное название'; + DBGrid1.Columns[1].Title.Caption:='Название в БД'; + DBGrid1.Columns[2].Title.Caption:='Тип ПО'; + DBGrid1.Columns[3].Title.Caption:='Лицензия'; + DBGrid1.Columns[4].Title.Caption:='Стоимость'; + DBGrid1.Columns[5].Title.Caption:='Замена'; + DBGrid1.Columns[0].Width:= 200; + DBGrid1.Columns[1].Width:= 110; + DBGrid1.Columns[2].Width:= 150; + DBGrid1.Columns[3].Width:= 110; + DBGrid1.Columns[4].Width:= 90; + DBGrid1.Columns[5].Width:= 150; } + + SQLQuery2.Close; + SQLQuery2.Active:=false; + SQLQuery2.SQL.Clear; + s := 'select * from setting'; + SQLQuery2.SQL.Add(s); + SQLQuery2.Active:=true; + + Nst6:=SQLQuery2.FieldByName('AvtoSt6').AsInteger; + if Nst6=0 then begin - p3:='(' + IntToStr(p1) + '.'; - UTF8Delete(FiltrStr, UTF8Pos(p3, FiltrStr), UTF8Length(FiltrStr)); - end; - end; + showmessage('Поле "Замена" отключено, поэтому данный вид сортировки недоступен.'); + exit; end; - { if UTF8Pos('Microsoft Visual C++', FiltrStr)=1 then - begin - showmessage(FiltrStr); - //FiltrStr:='Delete'; - end - else - begin - MyFiltrList.Add(FiltrStr); - end; } - MyFiltrList.Add(FiltrStr); + + s := ''; + s := 'SELECT '; + + Nst7:=SQLQuery2.FieldByName('AvtoSt7').AsInteger; + if Nst7 = 1 then + s := s + 'st7'; // исходное название + + Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 1) then + s := s + ', st2'; // название в бд + + Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 0) then + s := s + 'st2'; + + Nst3:=SQLQuery2.FieldByName('AvtoSt3').AsInteger; + Nst4:=SQLQuery2.FieldByName('AvtoSt4').AsInteger; + Nst5:=SQLQuery2.FieldByName('AvtoSt5').AsInteger; + + + if Nst3 = 1 then + s := s + ', st3'; // тип по + + if Nst4 = 1 then + s := s + ', st4'; // лицензия + + if Nst5 = 1 then + s := s + ', st5'; // стоимость + + if Nst6 = 1 then + s := s + ', st6'; // замена + + s := s + ' FROM test order by st6 DESC'; + + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; + SQLQuery1.Open; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; end; -ProgressBar1.StepBy(1); -//конец фильтра - //пробую удалить кавычки - MyFiltrList.Text := StringReplace(MyFiltrList.Text, '"', '', [rfReplaceAll, rfIgnoreCase]); + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //23456 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; - //showmessage('MyList2' + (IntToStr(MyList2.Count - 1)) + #13 + 'MyList3' + (IntToStr(MyList3.Count - 1)) + #13 + 'MyFiltrList' + (IntToStr(MyFiltrList.Count - 1))); + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2456 + Nst4Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; - //начало обработки массива - SQLQuery1.Close; // очиска таблицы в базе, в которую - SQLQuery1.SQL.Text := 'delete from test'; // записывается список программ - SQLQuery1.ExecSQL; - SQLTransaction1.CommitRetaining; + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2356 + Nst3Pos := 1; + Nst5Pos := 2; + Nst6Pos := 3; + end; - SetLength(MassivAvtoStr, MyFiltrList.Count, 9); + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; //2346 + Nst3Pos := 1; + Nst4Pos := 2; + Nst6Pos := 3; + end; - for N := 0 to MyList2.Count - 1 do + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then begin - MassivAvtoStr[N][1] := MyFiltrList[N]; - MassivAvtoStr[N][0] := MyList2[N]; - MassivAvtoStr[N][7] := MyList4[N]; - SQLQuery1.Close; - SQLQuery1.Active:=false; - SQLQuery1.SQL.Clear; - s := 'SELECT * FROM program WHERE (name LIKE "' + MyFiltrList[N] + '%%")'; - SQLQuery1.SQL.Add(s); - SQLQuery1.Active:=true; - MassivAvtoStr[N][8]:= SQLQuery1.FieldByName('id').AsString; - MassivAvtoStr[N][2]:= SQLQuery1.FieldByName('name').AsString; - MassivAvtoStr[N][3]:= SQLQuery1.FieldByName('type').AsString; - MassivAvtoStr[N][4]:= SQLQuery1.FieldByName('license').AsString; - MassivAvtoStr[N][5]:= SQLQuery1.FieldByName('cena').AsString; - MassivAvtoStr[N][6]:= SQLQuery1.FieldByName('zamena').AsString; + Nst2Pos := 0; //2345 + Nst3Pos := 1; + Nst4Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; end; - // + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; + end; - ProgressBar1.StepBy(1); - SQLQuery1.Close; - SQLQuery1.SQL.Clear; - // Запись полученного списка прог в базу - SQLQuery1.SQL.Add('insert into test(st1, st2, st7, st3, st4, st5, st6, st8, st9)'); - SQLQuery1.SQL.Add('Values (:pText, :pText2, :pText7, :pText3, :pText4, :pText5, :pText6, :pText8, :pText9)'); - for N := 0 to High(MassivAvtoStr) do + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then begin - SQLQuery1.ParamByName('pText').AsString := MassivAvtoStr[N][1]; //st1 - SQLQuery1.ParamByName('pText2').AsString := MassivAvtoStr[N][2]; //st2 name - SQLQuery1.ParamByName('pText7').AsString := MassivAvtoStr[N][0]; //st7 - SQLQuery1.ParamByName('pText3').AsString := MassivAvtoStr[N][3]; //st3 type - SQLQuery1.ParamByName('pText4').AsString := MassivAvtoStr[N][4]; //st4 license - SQLQuery1.ParamByName('pText5').AsString := MassivAvtoStr[N][5]; //st5 cena - SQLQuery1.ParamByName('pText6').AsString := MassivAvtoStr[N][6]; //st6 zamena - SQLQuery1.ParamByName('pText8').AsString := MassivAvtoStr[N][7]; //st8 - SQLQuery1.ParamByName('pText9').AsString := MassivAvtoStr[N][8]; //st9 - SQLQuery1.ExecSQL; + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; end; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + end; - //пробую удалять пустые строки из таблицы тест + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7256 + Nst5Pos := 2; + Nst6Pos := 3; + end; -SQLQuery1.SQL.Clear; -SQLQuery1.SQL.Text:='select * from setting'; -SQLQuery1.Open; -SQLQuery1.First; + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7246 + Nst4Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7234 + Nst3Pos := 2; + Nst4Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7235 + Nst3Pos := 2; + Nst5Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //7236 + Nst3Pos := 2; + Nst6Pos := 3; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //723 + Nst3Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //724 + Nst4Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //725 + Nst5Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //726 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //234 + Nst4Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //235 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst2Pos := 1; //72 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //23 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //24 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //25 + end; + + if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + begin + Nst2Pos := 0; + Nst6Pos := 1; //26 + end; + +if Nst7 = 1 then +begin +DBGrid1.Columns[Nst7Pos].Title.Caption:='Исходное название'; +DBGrid1.Columns[Nst7Pos].Width:= 200; +end; +if Nst2 = 1 then +begin +DBGrid1.Columns[Nst2Pos].Title.Caption:='Название в БД'; +DBGrid1.Columns[Nst2Pos].Width:= 110; +end; +if Nst3 = 1 then +begin +DBGrid1.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid1.Columns[Nst3Pos].Width:= 150; +end; +if Nst4 = 1 then +begin +DBGrid1.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid1.Columns[Nst4Pos].Width:= 110; +end; +if Nst5 = 1 then +begin +DBGrid1.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid1.Columns[Nst5Pos].Width:= 90; +end; +if Nst6 = 1 then +begin +DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid1.Columns[Nst6Pos].Width:= 150; +end; + end; + //если ручной + if PageControl1.ActivePageindex=1 then + begin + { s := ''; + s := 'SELECT st7, st2, st3, st4, st5, st6 FROM ruch order by st6 DESC'; - N:=SQLQuery1.FieldByName('AvtoUnkProg').AsInteger; - if N = 1 then - begin - s := 'delete from test where st3='''''; - SQLQuery1.Close; - SQLQuery1.SQL.Text := s; - SQLQuery1.ExecSQL; - SQLTransaction1.CommitRetaining; - end; - // конец удаления пустых строк + SQLQuery3.Close; + SQLQuery3.Active:=false; + SQLQuery3.SQL.Clear; + SQLQuery3.SQL.Add(s); + SQLQuery3.Active:=true; + SQLQuery3.Open; + //заполняем заголовки колонок и меняем ширину колонок + DBGrid2.Columns[0].Title.Caption:='Исходное название'; + DBGrid2.Columns[1].Title.Caption:='Название в БД'; + DBGrid2.Columns[2].Title.Caption:='Тип ПО'; + DBGrid2.Columns[3].Title.Caption:='Лицензия'; + DBGrid2.Columns[4].Title.Caption:='Стоимость'; + DBGrid2.Columns[5].Title.Caption:='Замена'; + DBGrid2.Columns[0].Width:= 200; + DBGrid2.Columns[1].Width:= 110; + DBGrid2.Columns[2].Width:= 150; + DBGrid2.Columns[3].Width:= 110; + DBGrid2.Columns[4].Width:= 90; + DBGrid2.Columns[5].Width:= 150; } - //начало постройки запроса согласно настройкам программы + //начало постройки запроса согласно настройкам программы SQLQuery1.Close; SQLQuery1.Active:=false; @@ -1442,22 +7830,38 @@ procedure TfMian.mBeginSerchClick(Sender: TObject); s := ''; s := 'SELECT '; - Nst7:=SQLQuery1.FieldByName('AvtoSt7').AsInteger; + Nst7:=SQLQuery1.FieldByName('RuchSt7').AsInteger; if Nst7 = 1 then - s := s + 'st7'; // исходное название + s := s + 'st7'; // путь - Nst2:=SQLQuery1.FieldByName('AvtoSt2').AsInteger; + Nst2:=SQLQuery1.FieldByName('RuchSt2').AsInteger; if (Nst2 = 1) and (Nst7 = 1) then - s := s + ', st2'; // название в бд + s := s + ', st2'; // название - Nst2:=SQLQuery1.FieldByName('AvtoSt2').AsInteger; if (Nst2 = 1) and (Nst7 = 0) then s := s + ' st2'; - Nst3:=SQLQuery1.FieldByName('AvtoSt3').AsInteger; - Nst4:=SQLQuery1.FieldByName('AvtoSt4').AsInteger; - Nst5:=SQLQuery1.FieldByName('AvtoSt5').AsInteger; - Nst6:=SQLQuery1.FieldByName('AvtoSt6').AsInteger; + Nst1:=SQLQuery1.FieldByName('RuchSt1').AsInteger; + Nst3:=SQLQuery1.FieldByName('RuchSt3').AsInteger; + Nst4:=SQLQuery1.FieldByName('RuchSt4').AsInteger; + Nst5:=SQLQuery1.FieldByName('RuchSt5').AsInteger; + Nst6:=SQLQuery1.FieldByName('RuchSt6').AsInteger; + + if Nst6=0 then + begin + showmessage('Поле "Замена" отключено, поэтому данный вид сортировки недоступен.'); + exit; + end; + + if Nst1 = 1 then + begin + if (Nst2 = 0) and (Nst7 = 0) and (Nst1 = 1) then + s := s + ' st1' + else + s := s + ', st1'; + end; + //if Nst1 = 1 then + //s := s + ', st1'; // исходный запрос if Nst3 = 1 then s := s + ', st3'; // тип по @@ -1471,28 +7875,36 @@ procedure TfMian.mBeginSerchClick(Sender: TObject); if Nst6 = 1 then s := s + ', st6'; // замена - s := s + ' FROM test'; + if Nst2 = 1 then + s := s + ' FROM ruch ORDER BY st6 DESC' + else + s := s + ' FROM ruch'; + //showmessage(s); //конец постройки запроса - // s := ''; оригинал запроса - // s := 'SELECT st7, st2, st3, st4, st5, st6 FROM test'; - //конец обработки массива - ProgressBar1.StepBy(1); - MyList.Free; - MyList2.Free; - MyList4.Free; -SQLQuery1.Close; -SQLQuery1.Active:=false; -SQLQuery1.SQL.Clear; -SQLQuery1.SQL.Add(s); -SQLQuery1.Active:=true; -SQLQuery1.Open; -if nilAvtoSearch<>1 then nilAvtoSearch:=1; -ProgressBar1.StepBy(1); - //заполняем заголовки колонок и меняем ширину колонок +SQLQuery3.Close; +SQLQuery3.Active:=false; +SQLQuery3.SQL.Clear; +SQLQuery3.SQL.Add(s); +SQLQuery3.Active:=true; +SQLQuery3.Open; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + //заполняем заголовки колонок и меняем ширину колонок + + if (Nst7 = 1) and (Nst2 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + begin + Nst7Pos := 0; + Nst2Pos := 1; + Nst1Pos := 2; //7213456 + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; + Nst6Pos := 6; +// showmessage('Сработал вариант 7213456'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) then begin Nst7Pos := 0; Nst2Pos := 1; //723456 @@ -1500,1028 +7912,1188 @@ procedure TfMian.mBeginSerchClick(Sender: TObject); Nst4Pos := 3; Nst5Pos := 4; Nst6Pos := 5; +// showmessage('Сработал вариант 723456'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) then begin - Nst2Pos := 0; //23456 - Nst3Pos := 1; - Nst4Pos := 2; - Nst5Pos := 3; - Nst6Pos := 4; + Nst7Pos := 0; + Nst1Pos := 1; //713456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 713456'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) then begin - Nst2Pos := 0; //2456 - Nst4Pos := 1; - Nst5Pos := 2; - Nst6Pos := 3; + Nst7Pos := 0; + Nst1Pos := 1; //712456 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712456'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) then begin - Nst2Pos := 0; //2356 - Nst3Pos := 1; - Nst5Pos := 2; - Nst6Pos := 3; + Nst7Pos := 0; + Nst1Pos := 1; //712356 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712356'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) then begin - Nst2Pos := 0; //2346 - Nst3Pos := 1; - Nst4Pos := 2; - Nst6Pos := 3; + Nst7Pos := 0; + Nst1Pos := 1; //712346 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712346'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then begin - Nst2Pos := 0; //2345 - Nst3Pos := 1; + Nst7Pos := 0; + Nst1Pos := 1; //712345 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; +// showmessage('Сработал вариант 712345'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123456 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 123456'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //13456 Nst4Pos := 2; Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 13456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst7 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //72456 + Nst1Pos := 0; + Nst2Pos := 1; //12456 Nst4Pos := 2; Nst5Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 12456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst7 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //72356 + Nst1Pos := 0; + Nst2Pos := 1; //12356 Nst3Pos := 2; Nst5Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 12356'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) and (Nst7 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //72346 + Nst1Pos := 0; + Nst2Pos := 1; //12346 Nst3Pos := 2; Nst4Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 12346'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) and (Nst7 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //72345 + Nst1Pos := 0; + Nst2Pos := 1; //12345 Nst3Pos := 2; Nst4Pos := 3; Nst5Pos := 4; +// showmessage('Сработал вариант 12345'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //7256 - Nst5Pos := 2; - Nst6Pos := 3; - end; - - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7246 + Nst3Pos := 1; //73456 Nst4Pos := 2; - Nst6Pos := 3; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 73456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7234 - Nst3Pos := 2; - Nst4Pos := 3; + Nst2Pos := 1; //72456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst4 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7235 + Nst2Pos := 1; //72356 Nst3Pos := 2; Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72356'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst5 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7236 + Nst2Pos := 1; //72346 Nst3Pos := 2; - Nst6Pos := 3; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72346'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //723 + Nst2Pos := 1; //72345 Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 72345'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //724 + Nst1Pos := 1; //71456 Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst4 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //725 - Nst5Pos := 2; + Nst1Pos := 1; //71356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71356'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst5 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //726 - Nst6Pos := 2; - end; - - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then - begin - Nst2Pos := 0; - Nst3Pos := 1; //234 - Nst4Pos := 2; - end; - - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then - begin - Nst2Pos := 0; - Nst3Pos := 1; //235 - Nst5Pos := 2; + Nst1Pos := 1; //71346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71346'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //236 - Nst6Pos := 2; + Nst7Pos := 0; + Nst1Pos := 1; //71345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71345'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) then begin - Nst2Pos := 0; - Nst4Pos := 1; //245 - Nst5Pos := 2; + Nst7Pos := 0; + Nst1Pos := 1; //71256 + Nst2Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71256'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst5 = 0) then begin - Nst2Pos := 0; - Nst4Pos := 1; //246 - Nst6Pos := 2; + Nst7Pos := 0; + Nst1Pos := 1; //71246 + Nst2Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71246'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst5Pos := 1; //256 - Nst6Pos := 2; + Nst7Pos := 0; + Nst1Pos := 1; //71245 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71245'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst5 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72 + Nst1Pos := 1; //71236 + Nst2Pos := 2; + Nst3Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71236'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst4 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //23 + Nst7Pos := 0; + Nst1Pos := 1; //71235 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71235'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst4Pos := 1; //24 + Nst7Pos := 0; + Nst1Pos := 1; //71234 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; +// showmessage('Сработал вариант 71234'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst7 = 0) then begin - Nst2Pos := 0; - Nst5Pos := 1; //25 + Nst3Pos := 0; + Nst4Pos := 1; //3456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 3456'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst3 = 0) then begin Nst2Pos := 0; - Nst6Pos := 1; //26 - end; - -if Nst7 = 1 then -begin -DBGrid1.Columns[Nst7Pos].Title.Caption:='Исходное название'; -DBGrid1.Columns[Nst7Pos].Width:= 200; -end; -if Nst2 = 1 then -begin -DBGrid1.Columns[Nst2Pos].Title.Caption:='Название в БД'; -DBGrid1.Columns[Nst2Pos].Width:= 110; -end; -if Nst3 = 1 then -begin -DBGrid1.Columns[Nst3Pos].Title.Caption:='Тип ПО'; -DBGrid1.Columns[Nst3Pos].Width:= 150; -end; -if Nst4 = 1 then -begin -DBGrid1.Columns[Nst4Pos].Title.Caption:='Лицензия'; -DBGrid1.Columns[Nst4Pos].Width:= 110; -end; -if Nst5 = 1 then -begin -DBGrid1.Columns[Nst5Pos].Title.Caption:='Стоимость'; -DBGrid1.Columns[Nst5Pos].Width:= 90; -end; -if Nst6 = 1 then -begin -DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; -DBGrid1.Columns[Nst6Pos].Width:= 150; -end; -ProgressBar1.StepBy(1); -lProgress.Caption:='Готово'; -MyFiltrList.free; -end; - -procedure TfMian.mSettingsClick(Sender: TObject); -begin - fSettings.ShowModal; -end; - - -procedure TfMian.mSort00Click(Sender: TObject); -var - s:string; - Nst7:Word; - Nst2:Word; // для загрузки из базы настроек - Nst3:Word; // какие нужно загружать столбцы в автопоиске - Nst4:Word; - Nst5:Word; - Nst6:Word; - Nst7Pos:Word; // переменные для определения позиций колонок - Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины - Nst3Pos:Word; - Nst4Pos:Word; - Nst5Pos:Word; - Nst6Pos:Word; -begin - //если автопоиск - if PageControl1.ActivePageindex=0 then - begin - { s := ''; - s := 'SELECT st7, st2, st3, st4, st5, st6 FROM test order by st1'; - - SQLQuery1.Close; - SQLQuery1.Active:=false; - SQLQuery1.SQL.Clear; - SQLQuery1.SQL.Add(s); - SQLQuery1.Active:=true; - SQLQuery1.Open; - //заполняем заголовки колонок и меняем ширину колонок - DBGrid1.Columns[0].Title.Caption:='Исходное название'; - DBGrid1.Columns[1].Title.Caption:='Название в БД'; - DBGrid1.Columns[2].Title.Caption:='Тип ПО'; - DBGrid1.Columns[3].Title.Caption:='Лицензия'; - DBGrid1.Columns[4].Title.Caption:='Стоимость'; - DBGrid1.Columns[5].Title.Caption:='Замена'; - DBGrid1.Columns[0].Width:= 200; - DBGrid1.Columns[1].Width:= 110; - DBGrid1.Columns[2].Width:= 150; - DBGrid1.Columns[3].Width:= 110; - DBGrid1.Columns[4].Width:= 90; - DBGrid1.Columns[5].Width:= 150; } - - SQLQuery1.Close; - SQLQuery1.Active:=false; - SQLQuery1.SQL.Clear; - s := 'select * from setting'; - SQLQuery1.SQL.Add(s); - SQLQuery1.Active:=true; - - s := ''; - s := 'SELECT '; - - Nst7:=SQLQuery1.FieldByName('AvtoSt7').AsInteger; - if Nst7 = 1 then - s := s + 'st7'; // исходное название - - Nst2:=SQLQuery1.FieldByName('AvtoSt2').AsInteger; - if (Nst2 = 1) and (Nst7 = 1) then - s := s + ', st2'; // название в бд - - Nst2:=SQLQuery1.FieldByName('AvtoSt2').AsInteger; - if (Nst2 = 1) and (Nst7 = 0) then - s := s + ' st2'; - - Nst3:=SQLQuery1.FieldByName('AvtoSt3').AsInteger; - Nst4:=SQLQuery1.FieldByName('AvtoSt4').AsInteger; - Nst5:=SQLQuery1.FieldByName('AvtoSt5').AsInteger; - Nst6:=SQLQuery1.FieldByName('AvtoSt6').AsInteger; - - if Nst3 = 1 then - s := s + ', st3'; // тип по - - if Nst4 = 1 then - s := s + ', st4'; // лицензия - - if Nst5 = 1 then - s := s + ', st5'; // стоимость - - if Nst6 = 1 then - s := s + ', st6'; // замена - - s := s + ' FROM test order by st1'; + Nst4Pos := 1; //2456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2456'); + end; - SQLQuery1.Close; - SQLQuery1.Active:=false; - SQLQuery1.SQL.Clear; - SQLQuery1.SQL.Add(s); - SQLQuery1.Active:=true; - SQLQuery1.Open; + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2356'); + end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst5 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //723456 - Nst3Pos := 2; - Nst4Pos := 3; - Nst5Pos := 4; - Nst6Pos := 5; + Nst2Pos := 0; + Nst3Pos := 1; //2346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2346'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; //23456 - Nst3Pos := 1; + Nst2Pos := 0; + Nst3Pos := 1; //2345 Nst4Pos := 2; Nst5Pos := 3; - Nst6Pos := 4; + // showmessage('Сработал вариант 2345'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) then begin - Nst2Pos := 0; //2456 - Nst4Pos := 1; + Nst7Pos := 0; + Nst4Pos := 1; //7456 Nst5Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7456'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) then begin - Nst2Pos := 0; //2356 - Nst3Pos := 1; + Nst7Pos := 0; + Nst3Pos := 1; //7356 Nst5Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7356'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) then begin - Nst2Pos := 0; //2346 - Nst3Pos := 1; + Nst7Pos := 0; + Nst3Pos := 1; //7346 Nst4Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7346'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; //2345 - Nst3Pos := 1; + Nst7Pos := 0; + Nst3Pos := 1; //7345 Nst4Pos := 2; Nst5Pos := 3; +// showmessage('Сработал вариант 7345'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72456 + Nst1Pos := 1; //7156 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7156'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7146 Nst4Pos := 2; - Nst5Pos := 3; - Nst6Pos := 4; + Nst6Pos := 3; +// showmessage('Сработал вариант 7146'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72356 - Nst3Pos := 2; + Nst1Pos := 1; //7145 + Nst4Pos := 2; Nst5Pos := 3; - Nst6Pos := 4; +// showmessage('Сработал вариант 7145'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72346 - Nst3Pos := 2; - Nst4Pos := 3; - Nst6Pos := 4; + Nst1Pos := 1; //7126 + Nst2Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7126'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72345 - Nst3Pos := 2; - Nst4Pos := 3; - Nst5Pos := 4; + Nst1Pos := 1; //7125 + Nst2Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7125'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7256 - Nst5Pos := 2; - Nst6Pos := 3; + Nst1Pos := 1; //7123 + Nst2Pos := 2; + Nst3Pos := 3; + // showmessage('Сработал вариант 7123'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7246 - Nst4Pos := 2; - Nst6Pos := 3; + Nst1Pos := 1; //712 + Nst2Pos := 2; + // showmessage('Сработал вариант 712'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7234 + Nst1Pos := 1; //713 Nst3Pos := 2; - Nst4Pos := 3; +// showmessage('Сработал вариант 713'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7235 - Nst3Pos := 2; - Nst5Pos := 3; + Nst1Pos := 1; //714 + Nst4Pos := 2; +// showmessage('Сработал вариант 714'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7236 - Nst3Pos := 2; - Nst6Pos := 3; + Nst1Pos := 1; //715 + Nst5Pos := 2; +// showmessage('Сработал вариант 715'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //716 + Nst6Pos := 2; +// showmessage('Сработал вариант 716'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; Nst2Pos := 1; //723 Nst3Pos := 2; +// showmessage('Сработал вариант 723'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; Nst2Pos := 1; //724 Nst4Pos := 2; +// showmessage('Сработал вариант 724'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; Nst2Pos := 1; //725 Nst5Pos := 2; +// showmessage('Сработал вариант 725'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then begin Nst7Pos := 0; Nst2Pos := 1; //726 Nst6Pos := 2; +// showmessage('Сработал вариант 726'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //234 + Nst7Pos := 0; + Nst3Pos := 1; //734 Nst4Pos := 2; +// showmessage('Сработал вариант 734'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //235 + Nst7Pos := 0; + Nst3Pos := 1; //735 Nst5Pos := 2; +// showmessage('Сработал вариант 735'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //236 + Nst7Pos := 0; + Nst3Pos := 1; //736 Nst6Pos := 2; +// showmessage('Сработал вариант 736'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst4Pos := 1; //245 + Nst7Pos := 0; + Nst4Pos := 1; //745 Nst5Pos := 2; +// showmessage('Сработал вариант 745'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst1 = 0) then begin - Nst2Pos := 0; - Nst4Pos := 1; //246 + Nst7Pos := 0; + Nst4Pos := 1; //746 Nst6Pos := 2; +// showmessage('Сработал вариант 746'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then begin - Nst2Pos := 0; - Nst5Pos := 1; //256 + Nst7Pos := 0; + Nst1Pos := 1; //756 + Nst2Pos := 2; +// showmessage('Сработал вариант 756'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst7 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123 + Nst3Pos := 2; +// showmessage('Сработал вариант 123'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //124 + Nst4Pos := 2; +// showmessage('Сработал вариант 124'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //125 + Nst5Pos := 2; +// showmessage('Сработал вариант 125'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst3Pos := 1; //136 Nst6Pos := 2; +// showmessage('Сработал вариант 136'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //72 + Nst1Pos := 0; + Nst4Pos := 1; //145 + Nst5Pos := 2; +// showmessage('Сработал вариант 145'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst1Pos := 0; + Nst4Pos := 1; //146 + Nst6Pos := 2; +// showmessage('Сработал вариант 146'); + end; + + if (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst1Pos := 0; + Nst5Pos := 1; //156 + Nst6Pos := 2; +// showmessage('Сработал вариант 156'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst5 = 0) and (Nst6 = 0) and (Nst7 = 0) then begin Nst2Pos := 0; - Nst3Pos := 1; //23 + Nst3Pos := 1; //234 + Nst4Pos := 2; +// showmessage('Сработал вариант 234'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst6 = 0) then begin Nst2Pos := 0; - Nst4Pos := 1; //24 + Nst3Pos := 1; //235 + Nst5Pos := 2; +// showmessage('Сработал вариант 235'); + end; + + if (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //236 + Nst6Pos := 2; +// showmessage('Сработал вариант 236'); + end; + + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //245 + Nst5Pos := 2; +// showmessage('Сработал вариант 245'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) then begin Nst2Pos := 0; - Nst5Pos := 1; //25 + Nst4Pos := 1; //246 + Nst6Pos := 2; +// showmessage('Сработал вариант 246'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) then begin Nst2Pos := 0; - Nst6Pos := 1; //26 + Nst5Pos := 1; //256 + Nst6Pos := 2; +// showmessage('Сработал вариант 256'); end; + // showmessage('Nst7Pos' + IntToStr(Nst7Pos) + #13 + ' Nst2Pos' + IntToStr(Nst2Pos) + #13 + 'Nst1Pos' + IntToStr(Nst1Pos) + #13 + ' Nst3Pos' + IntToStr(Nst3Pos) + #13 + ' Nst4Pos' + IntToStr(Nst4Pos) + #13 + ' Nst5Pos' + IntToStr(Nst5Pos) + #13 + ' Nst6Pos' + IntToStr(Nst6Pos)); + + if Nst7 = 1 then begin -DBGrid1.Columns[Nst7Pos].Title.Caption:='Исходное название'; -DBGrid1.Columns[Nst7Pos].Width:= 200; +DBGrid2.Columns[Nst7Pos].Title.Caption:='Путь'; +DBGrid2.Columns[Nst7Pos].Width:= 200; end; if Nst2 = 1 then begin -DBGrid1.Columns[Nst2Pos].Title.Caption:='Название в БД'; -DBGrid1.Columns[Nst2Pos].Width:= 110; +DBGrid2.Columns[Nst2Pos].Title.Caption:='Название'; +DBGrid2.Columns[Nst2Pos].Width:= 110; +end; + +if Nst1 = 1 then +begin +DBGrid2.Columns[Nst1Pos].Title.Caption:='Исходный запрос'; +DBGrid2.Columns[Nst1Pos].Width:= 80; end; + if Nst3 = 1 then begin -DBGrid1.Columns[Nst3Pos].Title.Caption:='Тип ПО'; -DBGrid1.Columns[Nst3Pos].Width:= 150; +DBGrid2.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid2.Columns[Nst3Pos].Width:= 130; end; if Nst4 = 1 then begin -DBGrid1.Columns[Nst4Pos].Title.Caption:='Лицензия'; -DBGrid1.Columns[Nst4Pos].Width:= 110; +DBGrid2.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid2.Columns[Nst4Pos].Width:= 90; end; if Nst5 = 1 then begin -DBGrid1.Columns[Nst5Pos].Title.Caption:='Стоимость'; -DBGrid1.Columns[Nst5Pos].Width:= 90; +DBGrid2.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid2.Columns[Nst5Pos].Width:= 80; end; if Nst6 = 1 then begin -DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; -DBGrid1.Columns[Nst6Pos].Width:= 150; +DBGrid2.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid2.Columns[Nst6Pos].Width:= 130; end; - - end; - // если ручной поиск - if PageControl1.ActivePageindex=1 then - begin - s := ''; - s := 'SELECT st7, st2, st3, st4, st5, st6 FROM ruch order by st1'; - - SQLQuery3.Close; - SQLQuery3.Active:=false; - SQLQuery3.SQL.Clear; - SQLQuery3.SQL.Add(s); - SQLQuery3.Active:=true; - SQLQuery3.Open; - //заполняем заголовки колонок и меняем ширину колонок - DBGrid2.Columns[0].Title.Caption:='Исходное название'; - DBGrid2.Columns[1].Title.Caption:='Название в БД'; - DBGrid2.Columns[2].Title.Caption:='Тип ПО'; - DBGrid2.Columns[3].Title.Caption:='Лицензия'; - DBGrid2.Columns[4].Title.Caption:='Стоимость'; - DBGrid2.Columns[5].Title.Caption:='Замена'; - DBGrid2.Columns[0].Width:= 200; - DBGrid2.Columns[1].Width:= 110; - DBGrid2.Columns[2].Width:= 150; - DBGrid2.Columns[3].Width:= 110; - DBGrid2.Columns[4].Width:= 90; - DBGrid2.Columns[5].Width:= 150; end; end; -procedure TfMian.mSort01Click(Sender: TObject); -var - s:string; - Nst7:Word; - Nst2:Word; // для загрузки из базы настроек - Nst3:Word; // какие нужно загружать столбцы в автопоиске - Nst4:Word; - Nst5:Word; - Nst6:Word; - Nst7Pos:Word; // переменные для определения позиций колонок - Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины - Nst3Pos:Word; - Nst4Pos:Word; - Nst5Pos:Word; - Nst6Pos:Word; +procedure TfMian.mSupportClick(Sender: TObject); begin - //если автопоиск - if PageControl1.ActivePageindex=0 then - begin - {s := ''; - s := 'SELECT st7, st2, st3, st4, st5, st6 FROM test order by st3 DESC'; - - SQLQuery1.Close; - SQLQuery1.Active:=false; - SQLQuery1.SQL.Clear; - SQLQuery1.SQL.Add(s); - SQLQuery1.Active:=true; - SQLQuery1.Open; - //заполняем заголовки колонок и меняем ширину колонок - DBGrid1.Columns[0].Title.Caption:='Исходное название'; - DBGrid1.Columns[1].Title.Caption:='Название в БД'; - DBGrid1.Columns[2].Title.Caption:='Тип ПО'; - DBGrid1.Columns[3].Title.Caption:='Лицензия'; - DBGrid1.Columns[4].Title.Caption:='Стоимость'; - DBGrid1.Columns[5].Title.Caption:='Замена'; - DBGrid1.Columns[0].Width:= 200; - DBGrid1.Columns[1].Width:= 110; - DBGrid1.Columns[2].Width:= 150; - DBGrid1.Columns[3].Width:= 110; - DBGrid1.Columns[4].Width:= 90; - DBGrid1.Columns[5].Width:= 150;} - - SQLQuery2.Close; - SQLQuery2.Active:=false; - SQLQuery2.SQL.Clear; - s := 'select * from setting'; - SQLQuery2.SQL.Add(s); - SQLQuery2.Active:=true; - - Nst3:=SQLQuery2.FieldByName('AvtoSt3').AsInteger; - if Nst3=0 then - begin - showmessage('Поле "Тип ПО" отключено, поэтому данный вид сортировки недоступен.'); - exit; - end; - - s := ''; - s := 'SELECT '; - - Nst7:=SQLQuery2.FieldByName('AvtoSt7').AsInteger; - if Nst7 = 1 then - s := s + 'st7'; // исходное название - - Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; - if (Nst2 = 1) and (Nst7 = 1) then - s := s + ', st2'; // название в бд - - Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; - if (Nst2 = 1) and (Nst7 = 0) then - s := s + ' st2'; - - Nst4:=SQLQuery2.FieldByName('AvtoSt4').AsInteger; - Nst5:=SQLQuery2.FieldByName('AvtoSt5').AsInteger; - Nst6:=SQLQuery2.FieldByName('AvtoSt6').AsInteger; - - if Nst3 = 1 then - s := s + ', st3'; // тип по - - if Nst4 = 1 then - s := s + ', st4'; // лицензия + OpenURL('https://sourceforge.net/p/lpro/tickets/'); + end; - if Nst5 = 1 then - s := s + ', st5'; // стоимость +procedure TfMian.mUpdateCheckClick(Sender: TObject); +var + ename:string; +begin + ename:= Extractfilepath(paramstr(0)); + ename:=ename + '\update.exe'; + ShellExecute(0, 'open', PChar(ename), nil, nil, SW_SHOWNORMAL); + // showmessage(ename); + Close; +end; - if Nst6 = 1 then - s := s + ', st6'; // замена - s := s + ' FROM test order by st3 DESC'; +procedure TfMian.FormCreate(Sender: TObject); +var + // attr: Integer; + // s: string; + // MyList3: TStringListUTF8; // для хранения названий ключей реестра глобальная + i : Integer; + Str: string; + NameKey: string; + FullKey: String; + bitnost: String; +begin + //attr := FileGetAttr('c:\Autoexec.bat'); + //if (attr and faReadOnly) <> 0 then s := s + 'Read-Only'; + FileSetAttr('Lpro.db',128); - SQLQuery1.Close; - SQLQuery1.Active:=false; - SQLQuery1.SQL.Clear; - SQLQuery1.SQL.Add(s); - SQLQuery1.Active:=true; - SQLQuery1.Open; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + bitnost:=GetEnvironmentVariableUTF8('ProgramFiles(x86)'); + if bitnost <> '' then begin - Nst7Pos := 0; - Nst2Pos := 1; //723456 - Nst3Pos := 2; - Nst4Pos := 3; - Nst5Pos := 4; - Nst6Pos := 5; - end; + MyRegistry2:=TRegistry.Create(KEY_WOW64_64KEY); + end + else + begin + MyRegistry2:=TRegistry.Create; + rVetkaReestra.Enabled:=False; + end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst2Pos := 0; //23456 - Nst3Pos := 1; - Nst4Pos := 2; - Nst5Pos := 3; - Nst6Pos := 4; - end; + if rVetkaReestra.ItemIndex = 0 then + FullKey:= 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' + else if rVetkaReestra.ItemIndex = 1 then + FullKey:= 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst2Pos := 0; //2456 - Nst4Pos := 1; - Nst5Pos := 2; - Nst6Pos := 3; - end; + ListBox1.Items.Clear; + MyList3:=TStringListUTF8.Create; + //MyRegistry:=TRegistry.Create(KEY_WOW64_32KEY); + with MyRegistry2 do + begin + RootKey:=HKEY_LOCAL_MACHINE; + OpenKeyReadOnly(FullKey); + GetKeyNames(MyList3); + CloseKey; + for i:=0 to MyList3.Count-1 do + begin + RootKey:=HKEY_LOCAL_MACHINE; + OpenKeyReadOnly(FullKey+ + MyList3[i]); + Str:=ReadString('DisplayName'); + if Str<>'' then + NameKey:=MyList3.Strings[i]; + ListBox1.Items.Add(CP1251ToUTF8(NameKey)); + CloseKey; + end; + end; + // MyList3.Free; + // MyRegistry.CloseKey; +// MyRegistry.Free; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst2Pos := 0; //2356 - Nst3Pos := 1; - Nst5Pos := 2; - Nst6Pos := 3; - end; +end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then - begin - Nst2Pos := 0; //2346 - Nst3Pos := 1; - Nst4Pos := 2; - Nst6Pos := 3; - end; +procedure TfMian.leKatalogSearchChange(Sender: TObject); +begin + put:=leKatalogSearch.Text; +end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then - begin - Nst2Pos := 0; //2345 - Nst3Pos := 1; - Nst4Pos := 2; - Nst5Pos := 3; - end; +procedure TfMian.leKluchPodrobChange(Sender: TObject); +begin - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //72456 - Nst4Pos := 2; - Nst5Pos := 3; - Nst6Pos := 4; - end; +end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //72356 - Nst3Pos := 2; - Nst5Pos := 3; - Nst6Pos := 4; - end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then +procedure TfMian.ListBox1SelectionChange(Sender: TObject; User: boolean); +var + i: Integer; //счетчик + FullKey: String; + FiltrNameProg: String; + s: String; + p1: Integer; + p2: Integer; + p3:String; + //для замен + FiltrInstZamena:String; + Poz2InstZam:Byte; + Poz3InstZam:Byte; +begin + if rVetkaReestra.ItemIndex = 0 then + begin + MyRegistry2:=TRegistry.Create; + FullKey:= 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' + end + else if rVetkaReestra.ItemIndex = 1 then begin - Nst7Pos := 0; - Nst2Pos := 1; //72346 - Nst3Pos := 2; - Nst4Pos := 3; - Nst6Pos := 4; + MyRegistry2:=TRegistry.Create(KEY_WOW64_64KEY); + FullKey:= 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'; end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //72345 - Nst3Pos := 2; - Nst4Pos := 3; - Nst5Pos := 4; - end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //7256 - Nst5Pos := 2; - Nst6Pos := 3; + // MyRegistry:=TRegistry.Create(KEY_WOW64_64KEY); + for i:= 0 to ListBox1.Count -1 do + if ListBox1.Selected[i] then + begin + leKeyName.Text:=ListBox1.Items.Strings[i]; + // leFullPathKey.Text:=FullKey + leKeyName.Text + '\'; + // end + // else begin + // Exit end; + leFullPathKey.Text:=FullKey + leKeyName.Text + '\'; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //7246 - Nst4Pos := 2; - Nst6Pos := 3; - end; + { + MyRegistry:=TRegistry.Create; + MyRegistry.RootKey:=HKEY_LOCAL_MACHINE; // lKeyName.Caption + If MyRegistry.OpenKey(PChar(FullKey + leKeyName.Text + '\'), False) Then + Begin + leDisplayName.Text:=CP1251ToUTF8(MyRegistry.ReadString('DisplayName')); + leVersionProg.Text:=CP1251ToUTF8(MyRegistry.ReadString('DisplayVersion')); + leKatalog.Text:=CP1251ToUTF8(MyRegistry.ReadString('InstallLocation')); + leRazrab.Text:=CP1251ToUTF8(MyRegistry.ReadString('Publisher')); + UninstallKey:=CP1251ToUTF8(MyRegistry.ReadString('UninstallString')); + End; + // MyRegistry.CloseKey; + //MyRegistry.Free; + } + //начало другого реестра + MyRegistry2.RootKey:=HKEY_LOCAL_MACHINE; + MyRegistry2.OpenKeyReadOnly(PChar(FullKey + leKeyName.Text + '\')); + leDisplayName.Text:=CP1251ToUTF8(MyRegistry2.ReadString('DisplayName')); + leVersionProg.Text:=CP1251ToUTF8(MyRegistry2.ReadString('DisplayVersion')); + leKatalog.Text:=CP1251ToUTF8(MyRegistry2.ReadString('InstallLocation')); + leRazrab.Text:=CP1251ToUTF8(MyRegistry2.ReadString('Publisher')); + UninstallKey:=CP1251ToUTF8(MyRegistry2.ReadString('UninstallString')); + leInstallDate.Text:=CP1251ToUTF8(MyRegistry2.ReadString('InstallDate')); + //конец другого реестра - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //7234 - Nst3Pos := 2; - Nst4Pos := 3; - end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //7235 - Nst3Pos := 2; - Nst5Pos := 3; - end; + // Теперь начинается поиск в базе + + if leDisplayName.Text = '' then + begin + FiltrNameProg:=leKeyName.Text; + end + else begin + FiltrNameProg:=leDisplayName.Text; + end; + //Showmessage(FiltrNameProg); + UTF8Delete(FiltrNameProg, UTF8Pos('"', FiltrNameProg), 1); + UTF8Delete(FiltrNameProg, UTF8Pos('-2_is1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos('_is1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos('_x64', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' CC', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' CS', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' cc', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' cs', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' CC 2015', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' CC 2016', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' CC 2017', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2015.1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2015.2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2015.3', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2015.4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2015.5', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2016.1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2016.2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2016.3', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2016.4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2016.5', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2017.1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2017.2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2017.3', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2017.4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2017.5', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2015', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2016', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2017', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2007', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2008', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2009', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2010', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2011', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2012', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2013', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 2014', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (v0', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (v1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (v2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (v3', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (v4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (v5', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (v6', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (v7', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (v8', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (v9', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v0', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v3', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v5', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v6', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v7', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v8', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v9', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v 0.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v 1.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v 2.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v 3.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v 4.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v 5.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v 6.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v 7.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v 8.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v 9.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v.0', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v.1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v.2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v.3', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v.4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v.5', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v.6', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v.7', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v.8', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v.9', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v. 0', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v. 1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v. 2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v. 3', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v. 4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v. 5', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v. 6', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v. 7', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v. 8', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' v. 9', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(', версия', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (версия', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (Версия', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(', version', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (version', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (Version', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' версия', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' version', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' Версия', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' Version', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' Ver.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' ver.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (Version', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (x64', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' x64', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (x86', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' x86', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos('-x64', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' - 64 bit', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (32-разрядная', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (32-Bit', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (32-bit', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (32 bit', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (64-разрядная', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (64-Bit', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (64-bit', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (64 bit', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 64-bit', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 32-bit', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 64 bit', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 32 bit', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (V0', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (V1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (V2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (V3', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (V4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (V5', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (V6', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (V7', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (V8', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (V9', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V0', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V3', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V5', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V6', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V7', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V8', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V9', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V.0', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V.1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V.2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V.3', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V.4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V.5', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V.6', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V.7', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V.8', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V.9', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V. 0', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V. 1', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V. 2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V. 3', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V. 4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V. 5', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V. 6', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V. 7', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V. 8', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' V. 9', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos('_64b', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' 64b', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' Trial', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' trial', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' demo', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' Demo', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (Trial', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (trial', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (demo', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (Demo', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' with update', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' with Update', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' With Update', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' With update', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (build', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (Build', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (0.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (1.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (2.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (3.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (4.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (5.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (6.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (7.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (8.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' (9.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' -0.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' -1.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' -2.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' -3.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' -4.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' -5.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' -6.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' -7.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' -8.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' -9.', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' XE8', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' XE2', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' XE4', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos(' XE6', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos('™', FiltrNameProg), UTF8Length(FiltrNameProg)); + UTF8Delete(FiltrNameProg, UTF8Pos('-64', FiltrNameProg), UTF8Length(FiltrNameProg)); + // 11.11 + for p1 := 0 to 100 do + begin + for p2 := 0 to 100 do + begin + p3:=' ' + IntToStr(p1) + '.' + IntToStr(p2); + UTF8Delete(FiltrNameProg, UTF8Pos(p3, FiltrNameProg), UTF8Length(FiltrNameProg)); + end; + end; + //11.11 + for p1 := 0 to 100 do + begin + for p2 := 0 to 100 do + begin + p3:=IntToStr(p1) + '.' + IntToStr(p2); + UTF8Delete(FiltrNameProg, UTF8Pos(p3, FiltrNameProg), UTF8Length(FiltrNameProg)); + end; + end; + //-11.11 + for p1 := 0 to 100 do + begin + for p2 := 0 to 100 do + begin + p3:='-' + IntToStr(p1) + '.' + IntToStr(p2); + UTF8Delete(FiltrNameProg, UTF8Pos(p3, FiltrNameProg), UTF8Length(FiltrNameProg)); + end; + end; + // -11. + for p1 := 0 to 100 do + begin + for p2 := 0 to 100 do + begin + p3:='-' + IntToStr(p1) + '.'; + UTF8Delete(FiltrNameProg, UTF8Pos(p3, FiltrNameProg), UTF8Length(FiltrNameProg)); + end; + end; + // (11. + for p1 := 0 to 100 do + begin + for p2 := 0 to 100 do + begin + p3:='(' + IntToStr(p1) + '.'; + UTF8Delete(FiltrNameProg, UTF8Pos(p3, FiltrNameProg), UTF8Length(FiltrNameProg)); + end; + end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //7236 - Nst3Pos := 2; - Nst6Pos := 3; - end; + // s := 'SELECT name, type, license FROM program WHERE (name LIKE "%%%' + FiltrNameProg + '%%")'; + s := 'SELECT name, type, license, zamena FROM program WHERE (name LIKE "' + FiltrNameProg + '%%")'; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //723 - Nst3Pos := 2; - end; + // всё, в s хранится запрос, его и используй для получения данных из БД + //Showmessage(s); - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //724 - Nst4Pos := 2; - end; +SQLQuery4.Close; +SQLQuery4.Active:=false; +SQLQuery4.SQL.Clear; +SQLQuery4.SQL.Add(s); +SQLQuery4.Active:=true; +SQLQuery4.Open; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //725 - Nst5Pos := 2; - end; +//заполняем заголовки колонок и меняем ширину колонок - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //726 - Nst6Pos := 2; - end; +DBGrid3.Columns[0].Title.Caption:='Название'; +DBGrid3.Columns[1].Title.Caption:='Тип ПО'; +DBGrid3.Columns[2].Title.Caption:='Лицензия'; +DBGrid3.Columns[3].Title.Caption:='Замена'; +DBGrid3.Columns[0].Width:= 200; +DBGrid3.Columns[1].Width:= 140; +DBGrid3.Columns[2].Width:= 110; +DBGrid3.Columns[3].Width:= 130; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then - begin - Nst2Pos := 0; - Nst3Pos := 1; //234 - Nst4Pos := 2; - end; +// заполняем combobox с заменами + cbInstallZam.Clear; + FiltrInstZamena:=SQLQuery4.FieldByName('zamena').AsString; + Poz2InstZam:=(UTF8Pos(',', FiltrInstZamena)) + 1; + UTF8Delete(FiltrInstZamena, UTF8Pos(',', FiltrInstZamena), UTF8Length(FiltrInstZamena)); + cbInstallZam.Items.Add(FiltrInstZamena); + cbInstallZam.ItemIndex:= 0; + FiltrInstZamena:=SQLQuery4.FieldByName('zamena').AsString; + // UTF8Delete(FiltrStr, UTF8Pos('\', FiltrStr), UTF8Pos('\', FiltrStr)); + Poz3InstZam:=UTF8Pos(',', FiltrInstZamena); + if (UTF8Pos(',', FiltrInstZamena)<>0) then + begin + UTF8Delete(FiltrInstZamena, 1, Poz2InstZam); + UTF8Delete(FiltrInstZamena, UTF8Pos(',', FiltrInstZamena), UTF8Length(FiltrInstZamena)); + cbInstallZam.Items.Add(FiltrInstZamena); + end; + FiltrInstZamena:=SQLQuery4.FieldByName('zamena').AsString; + UTF8Delete(FiltrInstZamena, 1, Poz3InstZam); + Poz3InstZam:=UTF8Pos(',', FiltrInstZamena) + 1; + if (UTF8Pos(',', FiltrInstZamena)<>0) then + begin + UTF8Delete(FiltrInstZamena, 1, Poz3InstZam); + cbInstallZam.Items.Add(FiltrInstZamena); + end; + //конец заполнения замен - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then - begin - Nst2Pos := 0; - Nst3Pos := 1; //235 - Nst5Pos := 2; - end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then - begin - Nst2Pos := 0; - Nst3Pos := 1; //236 - Nst6Pos := 2; - end; +end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then - begin - Nst2Pos := 0; - Nst4Pos := 1; //245 - Nst5Pos := 2; - end; +procedure TfMian.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; + DataCol: Integer; Column: TColumn; State: TGridDrawState); +var + Nst3:Word; + s:string; +begin - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then - begin - Nst2Pos := 0; - Nst4Pos := 1; //246 - Nst6Pos := 2; - end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst2Pos := 0; - Nst5Pos := 1; //256 - Nst6Pos := 2; - end; + // проверяем настройки столбцов + SQLQuery2.Close; + SQLQuery2.Active:=false; + SQLQuery2.SQL.Clear; + s := 'select * from setting'; + SQLQuery2.SQL.Add(s); + SQLQuery2.Active:=true; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //72 - end; + Nst3:=SQLQuery2.FieldByName('AvtoSt3').AsInteger; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then - begin - Nst2Pos := 0; - Nst3Pos := 1; //23 - end; + // - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if Nst3 = 1 then + begin + + // меняем цвет шрифта в зависимости от типа ПО +if DBGrid1.DataSource.DataSet.FieldByName('st3').AsString = 'Свободная программа' then begin - Nst2Pos := 0; - Nst4Pos := 1; //24 + DBGrid1.Canvas.Brush.Color := clGreen; + DBGrid1.Canvas.Font.Style := []; + DBGrid1.Canvas.Font.Color := clGreen; + DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then +if DBGrid1.DataSource.DataSet.FieldByName('st3').AsString = 'Условно-бесплатное ПО' then begin - Nst2Pos := 0; - Nst5Pos := 1; //25 + DBGrid1.Canvas.Brush.Color := RGB(200, 68, 7); + DBGrid1.Canvas.Font.Style := []; + DBGrid1.Canvas.Font.Color := RGB(200, 68, 7); + DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then +if DBGrid1.DataSource.DataSet.FieldByName('st3').AsString = 'Платное ПО' then begin - Nst2Pos := 0; - Nst6Pos := 1; //26 + DBGrid1.Canvas.Brush.Color := RGB(255, 0, 0); + DBGrid1.Canvas.Font.Style := []; + DBGrid1.Canvas.Font.Color := RGB(255, 0, 0); + DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end; - -if Nst7 = 1 then -begin -DBGrid1.Columns[Nst7Pos].Title.Caption:='Исходное название'; -DBGrid1.Columns[Nst7Pos].Width:= 200; -end; -if Nst2 = 1 then -begin -DBGrid1.Columns[Nst2Pos].Title.Caption:='Название в БД'; -DBGrid1.Columns[Nst2Pos].Width:= 110; -end; -if Nst3 = 1 then -begin -DBGrid1.Columns[Nst3Pos].Title.Caption:='Тип ПО'; -DBGrid1.Columns[Nst3Pos].Width:= 150; -end; -if Nst4 = 1 then -begin -DBGrid1.Columns[Nst4Pos].Title.Caption:='Лицензия'; -DBGrid1.Columns[Nst4Pos].Width:= 110; -end; -if Nst5 = 1 then -begin -DBGrid1.Columns[Nst5Pos].Title.Caption:='Стоимость'; -DBGrid1.Columns[Nst5Pos].Width:= 90; -end; -if Nst6 = 1 then -begin -DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; -DBGrid1.Columns[Nst6Pos].Width:= 150; -end; - end; - - //если ручной поиск - if PageControl1.ActivePageindex=1 then - begin - s := ''; - s := 'SELECT st7, st2, st3, st4, st5, st6 FROM ruch order by st3 DESC'; - - SQLQuery3.Close; - SQLQuery3.Active:=false; - SQLQuery3.SQL.Clear; - SQLQuery3.SQL.Add(s); - SQLQuery3.Active:=true; - SQLQuery3.Open; - //заполняем заголовки колонок и меняем ширину колонок - DBGrid2.Columns[0].Title.Caption:='Исходное название'; - DBGrid2.Columns[1].Title.Caption:='Название в БД'; - DBGrid2.Columns[2].Title.Caption:='Тип ПО'; - DBGrid2.Columns[3].Title.Caption:='Лицензия'; - DBGrid2.Columns[4].Title.Caption:='Стоимость'; - DBGrid2.Columns[5].Title.Caption:='Замена'; - DBGrid2.Columns[0].Width:= 200; - DBGrid2.Columns[1].Width:= 110; - DBGrid2.Columns[2].Width:= 150; - DBGrid2.Columns[3].Width:= 110; - DBGrid2.Columns[4].Width:= 90; - DBGrid2.Columns[5].Width:= 150; - end; + end; end; -procedure TfMian.mSort02Click(Sender: TObject); - +procedure TfMian.DBGrid1TitleClick(Column: TColumn); var s:string; Nst7:Word; @@ -2535,66 +9107,36 @@ procedure TfMian.mSort02Click(Sender: TObject); Nst3Pos:Word; Nst4Pos:Word; Nst5Pos:Word; - Nst6Pos:Word; + Nst6Pos:Word; // Column.FieldName - получить столбец + stCol:string; begin - //если автопоиск - if PageControl1.ActivePageindex=0 then - begin - {s := ''; - s := 'SELECT st7, st2, st3, st4, st5, st6 FROM test order by st4 DESC'; - - SQLQuery1.Close; - SQLQuery1.Active:=false; - SQLQuery1.SQL.Clear; - SQLQuery1.SQL.Add(s); - SQLQuery1.Active:=true; - SQLQuery1.Open; - //заполняем заголовки колонок и меняем ширину колонок - DBGrid1.Columns[0].Title.Caption:='Исходное название'; - DBGrid1.Columns[1].Title.Caption:='Название в БД'; - DBGrid1.Columns[2].Title.Caption:='Тип ПО'; - DBGrid1.Columns[3].Title.Caption:='Лицензия'; - DBGrid1.Columns[4].Title.Caption:='Стоимость'; - DBGrid1.Columns[5].Title.Caption:='Замена'; - DBGrid1.Columns[0].Width:= 200; - DBGrid1.Columns[1].Width:= 110; - DBGrid1.Columns[2].Width:= 150; - DBGrid1.Columns[3].Width:= 110; - DBGrid1.Columns[4].Width:= 90; - DBGrid1.Columns[5].Width:= 150; } - - SQLQuery2.Close; - SQLQuery2.Active:=false; - SQLQuery2.SQL.Clear; + stCol := Column.FieldName; + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; s := 'select * from setting'; - SQLQuery2.SQL.Add(s); - SQLQuery2.Active:=true; - - Nst4:=SQLQuery2.FieldByName('AvtoSt4').AsInteger; - if Nst4=0 then - begin - showmessage('Поле "Лицензия" отключено, поэтому данный вид сортировки недоступен.'); - exit; - end; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; s := ''; s := 'SELECT '; - Nst7:=SQLQuery2.FieldByName('AvtoSt7').AsInteger; + Nst7:=SQLQuery1.FieldByName('AvtoSt7').AsInteger; if Nst7 = 1 then s := s + 'st7'; // исходное название - Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; + Nst2:=SQLQuery1.FieldByName('AvtoSt2').AsInteger; if (Nst2 = 1) and (Nst7 = 1) then s := s + ', st2'; // название в бд - Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; + Nst2:=SQLQuery1.FieldByName('AvtoSt2').AsInteger; if (Nst2 = 1) and (Nst7 = 0) then s := s + ' st2'; - Nst3:=SQLQuery2.FieldByName('AvtoSt3').AsInteger; - Nst5:=SQLQuery2.FieldByName('AvtoSt5').AsInteger; - Nst6:=SQLQuery2.FieldByName('AvtoSt6').AsInteger; + Nst3:=SQLQuery1.FieldByName('AvtoSt3').AsInteger; + Nst4:=SQLQuery1.FieldByName('AvtoSt4').AsInteger; + Nst5:=SQLQuery1.FieldByName('AvtoSt5').AsInteger; + Nst6:=SQLQuery1.FieldByName('AvtoSt6').AsInteger; if Nst3 = 1 then s := s + ', st3'; // тип по @@ -2606,9 +9148,28 @@ procedure TfMian.mSort02Click(Sender: TObject); s := s + ', st5'; // стоимость if Nst6 = 1 then - s := s + ', st6'; // замена + s := s + ', st6'; // замена //Column.FieldName - s := s + ' FROM test order by st4 DESC'; + if stCol = 'st1' then + s := s + ' FROM test order by st1 '; + + if stCol = 'st2' then + s := s + ' FROM test order by st2 '; + + if stCol = 'st3' then + s := s + ' FROM test order by st3 '; + + if stCol = 'st4' then + s := s + ' FROM test order by st4 '; + + if stCol = 'st5' then + s := s + ' FROM test order by st5 '; + + if stCol = 'st6' then + s := s + ' FROM test order by st6 '; + + if stCol = 'st7' then + s := s + ' FROM test order by st7 '; SQLQuery1.Close; SQLQuery1.Active:=false; @@ -2874,1208 +9435,943 @@ procedure TfMian.mSort02Click(Sender: TObject); DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; DBGrid1.Columns[Nst6Pos].Width:= 150; end; - end; - //если ручной - if PageControl1.ActivePageindex=1 then - begin - s := ''; - s := 'SELECT st7, st2, st3, st4, st5, st6 FROM ruch order by st4 DESC'; - SQLQuery3.Close; - SQLQuery3.Active:=false; - SQLQuery3.SQL.Clear; - SQLQuery3.SQL.Add(s); - SQLQuery3.Active:=true; - SQLQuery3.Open; - //заполняем заголовки колонок и меняем ширину колонок - DBGrid2.Columns[0].Title.Caption:='Исходное название'; - DBGrid2.Columns[1].Title.Caption:='Название в БД'; - DBGrid2.Columns[2].Title.Caption:='Тип ПО'; - DBGrid2.Columns[3].Title.Caption:='Лицензия'; - DBGrid2.Columns[4].Title.Caption:='Стоимость'; - DBGrid2.Columns[5].Title.Caption:='Замена'; - DBGrid2.Columns[0].Width:= 200; - DBGrid2.Columns[1].Width:= 110; - DBGrid2.Columns[2].Width:= 150; - DBGrid2.Columns[3].Width:= 110; - DBGrid2.Columns[4].Width:= 90; - DBGrid2.Columns[5].Width:= 150; - end; end; +procedure TfMian.DBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect; + DataCol: Integer; Column: TColumn; State: TGridDrawState); +begin // меняем цвет шрифта в зависимости от типа ПО +if DBGrid2.DataSource.DataSet.FieldByName('st3').AsString = 'Свободная программа' then + begin + DBGrid2.Canvas.Brush.Color := clGreen; + DBGrid2.Canvas.Font.Style := []; + DBGrid2.Canvas.Font.Color := clGreen; + DBGrid2.DefaultDrawColumnCell(Rect, DataCol, Column, State); + end; -procedure TfMian.mSort03Click(Sender: TObject); +if DBGrid2.DataSource.DataSet.FieldByName('st3').AsString = 'Условно-бесплатное ПО' then + begin + DBGrid2.Canvas.Brush.Color := RGB(200, 68, 7); + DBGrid2.Canvas.Font.Style := []; + DBGrid2.Canvas.Font.Color := RGB(200, 68, 7); + DBGrid2.DefaultDrawColumnCell(Rect, DataCol, Column, State); + end; + +if DBGrid2.DataSource.DataSet.FieldByName('st3').AsString = 'Платное ПО' then + begin + DBGrid2.Canvas.Brush.Color := RGB(255, 0, 0); + DBGrid2.Canvas.Font.Style := []; + DBGrid2.Canvas.Font.Color := RGB(255, 0, 0); + DBGrid2.DefaultDrawColumnCell(Rect, DataCol, Column, State); + end; +end; + +procedure TfMian.DBGrid2TitleClick(Column: TColumn); var - s:string; - Nst7:Word; - Nst2:Word; // для загрузки из базы настроек - Nst3:Word; // какие нужно загружать столбцы в автопоиске - Nst4:Word; - Nst5:Word; - Nst6:Word; - Nst7Pos:Word; // переменные для определения позиций колонок - Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины - Nst3Pos:Word; - Nst4Pos:Word; - Nst5Pos:Word; - Nst6Pos:Word; + s:string; + Nst7:Word; + Nst2:Word; // для загрузки из базы настроек + Nst3:Word; // какие нужно загружать столбцы в автопоиске + Nst4:Word; + Nst5:Word; + Nst6:Word; + Nst1:Word; + Nst7Pos:Word; // переменные для определения позиций колонок + Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины + Nst3Pos:Word; + Nst4Pos:Word; + Nst5Pos:Word; + Nst6Pos:Word; + Nst1Pos:Word; + stCol:string; begin - //если автопоиск - if PageControl1.ActivePageindex=0 then - begin - { s := ''; - s := 'SELECT st7, st2, st3, st4, st5, st6 FROM test order by st5 DESC'; +stCol := Column.FieldName; + SQLQuery1.Close; + SQLQuery1.Active:=false; + SQLQuery1.SQL.Clear; + s := 'select * from setting'; + SQLQuery1.SQL.Add(s); + SQLQuery1.Active:=true; - SQLQuery1.Close; - SQLQuery1.Active:=false; - SQLQuery1.SQL.Clear; - SQLQuery1.SQL.Add(s); - SQLQuery1.Active:=true; - SQLQuery1.Open; - //заполняем заголовки колонок и меняем ширину колонок - DBGrid1.Columns[0].Title.Caption:='Исходное название'; - DBGrid1.Columns[1].Title.Caption:='Название в БД'; - DBGrid1.Columns[2].Title.Caption:='Тип ПО'; - DBGrid1.Columns[3].Title.Caption:='Лицензия'; - DBGrid1.Columns[4].Title.Caption:='Стоимость'; - DBGrid1.Columns[5].Title.Caption:='Замена'; - DBGrid1.Columns[0].Width:= 200; - DBGrid1.Columns[1].Width:= 110; - DBGrid1.Columns[2].Width:= 150; - DBGrid1.Columns[3].Width:= 110; - DBGrid1.Columns[4].Width:= 90; - DBGrid1.Columns[5].Width:= 150; } + {SQLQuery1.SQL.Clear; + SQLQuery1.SQL.Text:='select * from setting'; + SQLQuery1.Open; + SQLQuery1.First; } - SQLQuery2.Close; - SQLQuery2.Active:=false; - SQLQuery2.SQL.Clear; - s := 'select * from setting'; - SQLQuery2.SQL.Add(s); - SQLQuery2.Active:=true; + s := ''; + s := 'SELECT '; - Nst5:=SQLQuery2.FieldByName('AvtoSt5').AsInteger; - if Nst5=0 then + Nst7:=SQLQuery1.FieldByName('RuchSt7').AsInteger; + if Nst7 = 1 then + s := s + 'st7'; // путь + + Nst2:=SQLQuery1.FieldByName('RuchSt2').AsInteger; + if (Nst2 = 1) and (Nst7 = 1) then + s := s + ', st2'; // название + + if (Nst2 = 1) and (Nst7 = 0) then + s := s + ' st2'; + + if Nst2=0 then begin - showmessage('Поле "Стоимость" отключено, поэтому данный вид сортировки недоступен.'); + showmessage('Поле "Название" отключено, поэтому данный вид сортировки недоступен.'); exit; end; - s := ''; - s := 'SELECT '; + Nst1:=SQLQuery1.FieldByName('RuchSt1').AsInteger; + Nst3:=SQLQuery1.FieldByName('RuchSt3').AsInteger; + Nst4:=SQLQuery1.FieldByName('RuchSt4').AsInteger; + Nst5:=SQLQuery1.FieldByName('RuchSt5').AsInteger; + Nst6:=SQLQuery1.FieldByName('RuchSt6').AsInteger; - Nst7:=SQLQuery2.FieldByName('AvtoSt7').AsInteger; - if Nst7 = 1 then - s := s + 'st7'; // исходное название + if Nst1 = 1 then + begin + if (Nst2 = 0) and (Nst7 = 0) and (Nst1 = 1) then + s := s + ' st1' + else + s := s + ', st1'; + end; + //if Nst1 = 1 then + //s := s + ', st1'; // исходный запрос - Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; - if (Nst2 = 1) and (Nst7 = 1) then - s := s + ', st2'; // название в бд + if Nst3 = 1 then + s := s + ', st3'; // тип по - Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; - if (Nst2 = 1) and (Nst7 = 0) then - s := s + ' st2'; + if Nst4 = 1 then + s := s + ', st4'; // лицензия - Nst3:=SQLQuery2.FieldByName('AvtoSt3').AsInteger; - Nst4:=SQLQuery2.FieldByName('AvtoSt4').AsInteger; - Nst6:=SQLQuery2.FieldByName('AvtoSt6').AsInteger; + if Nst5 = 1 then + s := s + ', st5'; // стоимость - if Nst3 = 1 then - s := s + ', st3'; // тип по + if Nst6 = 1 then + s := s + ', st6'; // замена - if Nst4 = 1 then - s := s + ', st4'; // лицензия - if Nst5 = 1 then - s := s + ', st5'; // стоимость + if stCol = 'st1' then + s := s + ' FROM ruch order by st1 DESC'; - if Nst6 = 1 then - s := s + ', st6'; // замена + if stCol = 'st2' then + s := s + ' FROM ruch order by st2 DESC'; - s := s + ' FROM test order by st5 DESC'; + if stCol = 'st3' then + s := s + ' FROM ruch order by st3 DESC'; - SQLQuery1.Close; - SQLQuery1.Active:=false; - SQLQuery1.SQL.Clear; - SQLQuery1.SQL.Add(s); - SQLQuery1.Active:=true; - SQLQuery1.Open; + if stCol = 'st4' then + s := s + ' FROM ruch order by st4 DESC'; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //723456 - Nst3Pos := 2; - Nst4Pos := 3; - Nst5Pos := 4; - Nst6Pos := 5; - end; + if stCol = 'st5' then + s := s + ' FROM ruch order by st5 DESC'; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst2Pos := 0; //23456 - Nst3Pos := 1; - Nst4Pos := 2; - Nst5Pos := 3; - Nst6Pos := 4; - end; + if stCol = 'st6' then + s := s + ' FROM ruch order by st6 DESC'; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst2Pos := 0; //2456 - Nst4Pos := 1; - Nst5Pos := 2; - Nst6Pos := 3; - end; + if stCol = 'st7' then + s := s + ' FROM ruch order by st7 DESC'; + //конец постройки запроса - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then - begin - Nst2Pos := 0; //2356 - Nst3Pos := 1; - Nst5Pos := 2; - Nst6Pos := 3; - end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then - begin - Nst2Pos := 0; //2346 - Nst3Pos := 1; - Nst4Pos := 2; - Nst6Pos := 3; - end; +SQLQuery3.Close; +SQLQuery3.Active:=false; +SQLQuery3.SQL.Clear; +SQLQuery3.SQL.Add(s); +SQLQuery3.Active:=true; +SQLQuery3.Open; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then - begin - Nst2Pos := 0; //2345 - Nst3Pos := 1; - Nst4Pos := 2; - Nst5Pos := 3; - end; + //заполняем заголовки колонок и меняем ширину колонок - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then begin Nst7Pos := 0; - Nst2Pos := 1; //72456 - Nst4Pos := 2; - Nst5Pos := 3; - Nst6Pos := 4; + Nst2Pos := 1; + Nst1Pos := 2; //7213456 + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; + Nst6Pos := 6; +// showmessage('Сработал вариант 7213456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72356 + Nst2Pos := 1; //723456 Nst3Pos := 2; - Nst5Pos := 3; - Nst6Pos := 4; + Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 723456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72346 + Nst1Pos := 1; //713456 Nst3Pos := 2; Nst4Pos := 3; - Nst6Pos := 4; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 713456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72345 - Nst3Pos := 2; + Nst1Pos := 1; //712456 + Nst2Pos := 2; Nst4Pos := 3; Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7256 - Nst5Pos := 2; - Nst6Pos := 3; + Nst1Pos := 1; //712356 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712356'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7246 - Nst4Pos := 2; - Nst6Pos := 3; + Nst1Pos := 1; //712346 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 712346'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7234 + Nst1Pos := 1; //712345 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; + Nst5Pos := 5; +// showmessage('Сработал вариант 712345'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123456 Nst3Pos := 2; Nst4Pos := 3; + Nst5Pos := 4; + Nst6Pos := 5; +// showmessage('Сработал вариант 123456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //7235 - Nst3Pos := 2; + Nst1Pos := 0; + Nst3Pos := 1; //13456 + Nst4Pos := 2; Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 13456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst7 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //7236 - Nst3Pos := 2; - Nst6Pos := 3; + Nst1Pos := 0; + Nst2Pos := 1; //12456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12456'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst7 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //723 + Nst1Pos := 0; + Nst2Pos := 1; //12356 Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12356'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) and (Nst7 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //724 - Nst4Pos := 2; + Nst1Pos := 0; + Nst2Pos := 1; //12346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 12346'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) and (Nst7 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //725 - Nst5Pos := 2; + Nst1Pos := 0; + Nst2Pos := 1; //12345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 12345'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //726 - Nst6Pos := 2; + Nst3Pos := 1; //73456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 73456'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //234 + Nst7Pos := 0; + Nst2Pos := 1; //72456 Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72456'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst4 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //235 - Nst5Pos := 2; + Nst7Pos := 0; + Nst2Pos := 1; //72356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72356'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst5 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //236 - Nst6Pos := 2; + Nst7Pos := 0; + Nst2Pos := 1; //72346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 72346'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst4Pos := 1; //245 - Nst5Pos := 2; + Nst7Pos := 0; + Nst2Pos := 1; //72345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 72345'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) then begin - Nst2Pos := 0; - Nst4Pos := 1; //246 - Nst6Pos := 2; + Nst7Pos := 0; + Nst1Pos := 1; //71456 + Nst4Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71456'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst4 = 0) then begin - Nst2Pos := 0; - Nst5Pos := 1; //256 - Nst6Pos := 2; + Nst7Pos := 0; + Nst1Pos := 1; //71356 + Nst3Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71356'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst5 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72 + Nst1Pos := 1; //71346 + Nst3Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71346'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //23 + Nst7Pos := 0; + Nst1Pos := 1; //71345 + Nst3Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71345'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) then begin - Nst2Pos := 0; - Nst4Pos := 1; //24 + Nst7Pos := 0; + Nst1Pos := 1; //71256 + Nst2Pos := 2; + Nst5Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71256'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst5 = 0) then begin - Nst2Pos := 0; - Nst5Pos := 1; //25 + Nst7Pos := 0; + Nst1Pos := 1; //71246 + Nst2Pos := 2; + Nst4Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71246'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst6Pos := 1; //26 - end; - -if Nst7 = 1 then -begin -DBGrid1.Columns[Nst7Pos].Title.Caption:='Исходное название'; -DBGrid1.Columns[Nst7Pos].Width:= 200; -end; -if Nst2 = 1 then -begin -DBGrid1.Columns[Nst2Pos].Title.Caption:='Название в БД'; -DBGrid1.Columns[Nst2Pos].Width:= 110; -end; -if Nst3 = 1 then -begin -DBGrid1.Columns[Nst3Pos].Title.Caption:='Тип ПО'; -DBGrid1.Columns[Nst3Pos].Width:= 150; -end; -if Nst4 = 1 then -begin -DBGrid1.Columns[Nst4Pos].Title.Caption:='Лицензия'; -DBGrid1.Columns[Nst4Pos].Width:= 110; -end; -if Nst5 = 1 then -begin -DBGrid1.Columns[Nst5Pos].Title.Caption:='Стоимость'; -DBGrid1.Columns[Nst5Pos].Width:= 90; -end; -if Nst6 = 1 then -begin -DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; -DBGrid1.Columns[Nst6Pos].Width:= 150; -end; - end; - //если ручной - if PageControl1.ActivePageindex=1 then - begin - s := ''; - s := 'SELECT st7, st2, st3, st4, st5, st6 FROM ruch order by st5 DESC'; - - SQLQuery3.Close; - SQLQuery3.Active:=false; - SQLQuery3.SQL.Clear; - SQLQuery3.SQL.Add(s); - SQLQuery3.Active:=true; - SQLQuery3.Open; - //заполняем заголовки колонок и меняем ширину колонок - DBGrid2.Columns[0].Title.Caption:='Исходное название'; - DBGrid2.Columns[1].Title.Caption:='Название в БД'; - DBGrid2.Columns[2].Title.Caption:='Тип ПО'; - DBGrid2.Columns[3].Title.Caption:='Лицензия'; - DBGrid2.Columns[4].Title.Caption:='Стоимость'; - DBGrid2.Columns[5].Title.Caption:='Замена'; - DBGrid2.Columns[0].Width:= 200; - DBGrid2.Columns[1].Width:= 110; - DBGrid2.Columns[2].Width:= 150; - DBGrid2.Columns[3].Width:= 110; - DBGrid2.Columns[4].Width:= 90; - DBGrid2.Columns[5].Width:= 150; - end; -end; - -procedure TfMian.mSort04Click(Sender: TObject); -var - s:string; - Nst7:Word; - Nst2:Word; // для загрузки из базы настроек - Nst3:Word; // какие нужно загружать столбцы в автопоиске - Nst4:Word; - Nst5:Word; - Nst6:Word; - Nst7Pos:Word; // переменные для определения позиций колонок - Nst2Pos:Word; // необходимо для заполнения заголовков и изменения ширины - Nst3Pos:Word; - Nst4Pos:Word; - Nst5Pos:Word; - Nst6Pos:Word; -begin -//если автопоиск - if PageControl1.ActivePageindex=0 then - begin - { s := ''; - s := 'SELECT st7, st2, st3, st4, st5, st6 FROM test order by st6 DESC'; - - SQLQuery1.Close; - SQLQuery1.Active:=false; - SQLQuery1.SQL.Clear; - SQLQuery1.SQL.Add(s); - SQLQuery1.Active:=true; - SQLQuery1.Open; - //заполняем заголовки колонок и меняем ширину колонок - DBGrid1.Columns[0].Title.Caption:='Исходное название'; - DBGrid1.Columns[1].Title.Caption:='Название в БД'; - DBGrid1.Columns[2].Title.Caption:='Тип ПО'; - DBGrid1.Columns[3].Title.Caption:='Лицензия'; - DBGrid1.Columns[4].Title.Caption:='Стоимость'; - DBGrid1.Columns[5].Title.Caption:='Замена'; - DBGrid1.Columns[0].Width:= 200; - DBGrid1.Columns[1].Width:= 110; - DBGrid1.Columns[2].Width:= 150; - DBGrid1.Columns[3].Width:= 110; - DBGrid1.Columns[4].Width:= 90; - DBGrid1.Columns[5].Width:= 150; } - - SQLQuery2.Close; - SQLQuery2.Active:=false; - SQLQuery2.SQL.Clear; - s := 'select * from setting'; - SQLQuery2.SQL.Add(s); - SQLQuery2.Active:=true; - - Nst6:=SQLQuery2.FieldByName('AvtoSt6').AsInteger; - if Nst6=0 then - begin - showmessage('Поле "Замена" отключено, поэтому данный вид сортировки недоступен.'); - exit; - end; - - s := ''; - s := 'SELECT '; - - Nst7:=SQLQuery2.FieldByName('AvtoSt7').AsInteger; - if Nst7 = 1 then - s := s + 'st7'; // исходное название - - Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; - if (Nst2 = 1) and (Nst7 = 1) then - s := s + ', st2'; // название в бд - - Nst2:=SQLQuery2.FieldByName('AvtoSt2').AsInteger; - if (Nst2 = 1) and (Nst7 = 0) then - s := s + 'st2'; - - Nst3:=SQLQuery2.FieldByName('AvtoSt3').AsInteger; - Nst4:=SQLQuery2.FieldByName('AvtoSt4').AsInteger; - Nst5:=SQLQuery2.FieldByName('AvtoSt5').AsInteger; - + Nst7Pos := 0; + Nst1Pos := 1; //71245 + Nst2Pos := 2; + Nst4Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71245'); + end; - if Nst3 = 1 then - s := s + ', st3'; // тип по + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71236 + Nst2Pos := 2; + Nst3Pos := 3; + Nst6Pos := 4; +// showmessage('Сработал вариант 71236'); + end; - if Nst4 = 1 then - s := s + ', st4'; // лицензия + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71235 + Nst2Pos := 2; + Nst3Pos := 3; + Nst5Pos := 4; +// showmessage('Сработал вариант 71235'); + end; - if Nst5 = 1 then - s := s + ', st5'; // стоимость + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //71234 + Nst2Pos := 2; + Nst3Pos := 3; + Nst4Pos := 4; +// showmessage('Сработал вариант 71234'); + end; - if Nst6 = 1 then - s := s + ', st6'; // замена + if (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst7 = 0) then + begin + Nst3Pos := 0; + Nst4Pos := 1; //3456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 3456'); + end; - s := s + ' FROM test order by st6 DESC'; + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst3 = 0) then + begin + Nst2Pos := 0; + Nst4Pos := 1; //2456 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2456'); + end; - SQLQuery1.Close; - SQLQuery1.Active:=false; - SQLQuery1.SQL.Clear; - SQLQuery1.SQL.Add(s); - SQLQuery1.Active:=true; - SQLQuery1.Open; + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst3Pos := 1; //2356 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2356'); + end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst5 = 0) then begin - Nst7Pos := 0; - Nst2Pos := 1; //723456 - Nst3Pos := 2; - Nst4Pos := 3; - Nst5Pos := 4; - Nst6Pos := 5; + Nst2Pos := 0; + Nst3Pos := 1; //2346 + Nst4Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 2346'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; //23456 - Nst3Pos := 1; + Nst2Pos := 0; + Nst3Pos := 1; //2345 Nst4Pos := 2; Nst5Pos := 3; - Nst6Pos := 4; + // showmessage('Сработал вариант 2345'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) then begin - Nst2Pos := 0; //2456 - Nst4Pos := 1; + Nst7Pos := 0; + Nst4Pos := 1; //7456 Nst5Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7456'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) then begin - Nst2Pos := 0; //2356 - Nst3Pos := 1; + Nst7Pos := 0; + Nst3Pos := 1; //7356 Nst5Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7356'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) then begin - Nst2Pos := 0; //2346 - Nst3Pos := 1; + Nst7Pos := 0; + Nst3Pos := 1; //7346 Nst4Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7346'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; //2345 - Nst3Pos := 1; + Nst7Pos := 0; + Nst3Pos := 1; //7345 Nst4Pos := 2; Nst5Pos := 3; +// showmessage('Сработал вариант 7345'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72456 + Nst1Pos := 1; //7156 + Nst5Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7156'); + end; + + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //7146 Nst4Pos := 2; - Nst5Pos := 3; - Nst6Pos := 4; + Nst6Pos := 3; +// showmessage('Сработал вариант 7146'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72356 - Nst3Pos := 2; + Nst1Pos := 1; //7145 + Nst4Pos := 2; Nst5Pos := 3; - Nst6Pos := 4; +// showmessage('Сработал вариант 7145'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72346 - Nst3Pos := 2; - Nst4Pos := 3; - Nst6Pos := 4; + Nst1Pos := 1; //7126 + Nst2Pos := 2; + Nst6Pos := 3; +// showmessage('Сработал вариант 7126'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //72345 - Nst3Pos := 2; - Nst4Pos := 3; - Nst5Pos := 4; + Nst1Pos := 1; //7125 + Nst2Pos := 2; + Nst5Pos := 3; +// showmessage('Сработал вариант 7125'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7256 - Nst5Pos := 2; - Nst6Pos := 3; + Nst1Pos := 1; //7123 + Nst2Pos := 2; + Nst3Pos := 3; + // showmessage('Сработал вариант 7123'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7246 - Nst4Pos := 2; - Nst6Pos := 3; + Nst1Pos := 1; //712 + Nst2Pos := 2; + // showmessage('Сработал вариант 712'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7234 + Nst1Pos := 1; //713 Nst3Pos := 2; - Nst4Pos := 3; +// showmessage('Сработал вариант 713'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7235 - Nst3Pos := 2; - Nst5Pos := 3; + Nst1Pos := 1; //714 + Nst4Pos := 2; +// showmessage('Сработал вариант 714'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; - Nst2Pos := 1; //7236 - Nst3Pos := 2; - Nst6Pos := 3; + Nst1Pos := 1; //715 + Nst5Pos := 2; +// showmessage('Сработал вариант 715'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst1 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //716 + Nst6Pos := 2; +// showmessage('Сработал вариант 716'); + end; + + if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; Nst2Pos := 1; //723 Nst3Pos := 2; +// showmessage('Сработал вариант 723'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; Nst2Pos := 1; //724 Nst4Pos := 2; +// showmessage('Сработал вариант 724'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then begin Nst7Pos := 0; Nst2Pos := 1; //725 Nst5Pos := 2; +// showmessage('Сработал вариант 725'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then begin Nst7Pos := 0; Nst2Pos := 1; //726 Nst6Pos := 2; +// showmessage('Сработал вариант 726'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //234 + Nst7Pos := 0; + Nst3Pos := 1; //734 Nst4Pos := 2; +// showmessage('Сработал вариант 734'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //235 + Nst7Pos := 0; + Nst3Pos := 1; //735 Nst5Pos := 2; +// showmessage('Сработал вариант 735'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst7 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then + begin + Nst7Pos := 0; + Nst3Pos := 1; //736 + Nst6Pos := 2; +// showmessage('Сработал вариант 736'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //745 + Nst5Pos := 2; +// showmessage('Сработал вариант 745'); + end; + + if (Nst7 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst1 = 0) then + begin + Nst7Pos := 0; + Nst4Pos := 1; //746 + Nst6Pos := 2; +// showmessage('Сработал вариант 746'); + end; + + if (Nst7 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst7Pos := 0; + Nst1Pos := 1; //756 + Nst2Pos := 2; +// showmessage('Сработал вариант 756'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst7 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //123 + Nst3Pos := 2; +// showmessage('Сработал вариант 123'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //124 + Nst4Pos := 2; +// showmessage('Сработал вариант 124'); + end; + + if (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then + begin + Nst1Pos := 0; + Nst2Pos := 1; //125 + Nst5Pos := 2; +// showmessage('Сработал вариант 125'); + end; + + if (Nst1 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then begin - Nst2Pos := 0; - Nst3Pos := 1; //236 + Nst1Pos := 0; + Nst3Pos := 1; //136 Nst6Pos := 2; +// showmessage('Сработал вариант 136'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then begin - Nst2Pos := 0; - Nst4Pos := 1; //245 + Nst1Pos := 0; + Nst4Pos := 1; //145 Nst5Pos := 2; +// showmessage('Сработал вариант 145'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then begin - Nst2Pos := 0; - Nst4Pos := 1; //246 + Nst1Pos := 0; + Nst4Pos := 1; //146 Nst6Pos := 2; +// showmessage('Сработал вариант 146'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 1) then + if (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then begin - Nst2Pos := 0; - Nst5Pos := 1; //256 + Nst1Pos := 0; + Nst5Pos := 1; //156 Nst6Pos := 2; +// showmessage('Сработал вариант 156'); end; - if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then - begin - Nst7Pos := 0; - Nst2Pos := 1; //72 - end; - - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst5 = 0) and (Nst6 = 0) and (Nst7 = 0) then begin Nst2Pos := 0; - Nst3Pos := 1; //23 + Nst3Pos := 1; //234 + Nst4Pos := 2; +// showmessage('Сработал вариант 234'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then + if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst6 = 0) then begin Nst2Pos := 0; - Nst4Pos := 1; //24 + Nst3Pos := 1; //235 + Nst5Pos := 2; +// showmessage('Сработал вариант 235'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 1) and (Nst6 = 0) then + if (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) then begin Nst2Pos := 0; - Nst5Pos := 1; //25 + Nst3Pos := 1; //236 + Nst6Pos := 2; +// showmessage('Сработал вариант 236'); end; - if (Nst7 = 0) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 1) then + if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst6 = 0) then begin Nst2Pos := 0; - Nst6Pos := 1; //26 - end; - -if Nst7 = 1 then -begin -DBGrid1.Columns[Nst7Pos].Title.Caption:='Исходное название'; -DBGrid1.Columns[Nst7Pos].Width:= 200; -end; -if Nst2 = 1 then -begin -DBGrid1.Columns[Nst2Pos].Title.Caption:='Название в БД'; -DBGrid1.Columns[Nst2Pos].Width:= 110; -end; -if Nst3 = 1 then -begin -DBGrid1.Columns[Nst3Pos].Title.Caption:='Тип ПО'; -DBGrid1.Columns[Nst3Pos].Width:= 150; -end; -if Nst4 = 1 then -begin -DBGrid1.Columns[Nst4Pos].Title.Caption:='Лицензия'; -DBGrid1.Columns[Nst4Pos].Width:= 110; -end; -if Nst5 = 1 then -begin -DBGrid1.Columns[Nst5Pos].Title.Caption:='Стоимость'; -DBGrid1.Columns[Nst5Pos].Width:= 90; -end; -if Nst6 = 1 then -begin -DBGrid1.Columns[Nst6Pos].Title.Caption:='Замена'; -DBGrid1.Columns[Nst6Pos].Width:= 150; -end; - end; - //если ручной - if PageControl1.ActivePageindex=1 then - begin - s := ''; - s := 'SELECT st7, st2, st3, st4, st5, st6 FROM ruch order by st6 DESC'; - - SQLQuery3.Close; - SQLQuery3.Active:=false; - SQLQuery3.SQL.Clear; - SQLQuery3.SQL.Add(s); - SQLQuery3.Active:=true; - SQLQuery3.Open; - //заполняем заголовки колонок и меняем ширину колонок - DBGrid2.Columns[0].Title.Caption:='Исходное название'; - DBGrid2.Columns[1].Title.Caption:='Название в БД'; - DBGrid2.Columns[2].Title.Caption:='Тип ПО'; - DBGrid2.Columns[3].Title.Caption:='Лицензия'; - DBGrid2.Columns[4].Title.Caption:='Стоимость'; - DBGrid2.Columns[5].Title.Caption:='Замена'; - DBGrid2.Columns[0].Width:= 200; - DBGrid2.Columns[1].Width:= 110; - DBGrid2.Columns[2].Width:= 150; - DBGrid2.Columns[3].Width:= 110; - DBGrid2.Columns[4].Width:= 90; - DBGrid2.Columns[5].Width:= 150; - end; -end; - -procedure TfMian.mSupportClick(Sender: TObject); -begin - OpenURL('https://sourceforge.net/p/lpro/tickets/'); + Nst4Pos := 1; //245 + Nst5Pos := 2; +// showmessage('Сработал вариант 245'); end; -procedure TfMian.mUpdateCheckClick(Sender: TObject); -var - ename:string; -begin - ename:= Extractfilepath(paramstr(0)); - ename:=ename + '\update.exe'; - ShellExecute(0, 'open', PChar(ename), nil, nil, SW_SHOWNORMAL); - // showmessage(ename); - Close; -end; - - -procedure TfMian.FormCreate(Sender: TObject); -var - // attr: Integer; - // s: string; - // MyList3: TStringListUTF8; // для хранения названий ключей реестра глобальная - i : Integer; - Str: string; - NameKey: string; - FullKey: String; - bitnost: String; -begin - //attr := FileGetAttr('c:\Autoexec.bat'); - //if (attr and faReadOnly) <> 0 then s := s + 'Read-Only'; - FileSetAttr('Lpro.db',128); - - - bitnost:=GetEnvironmentVariableUTF8('ProgramFiles(x86)'); - if bitnost <> '' then - begin - MyRegistry2:=TRegistry.Create(KEY_WOW64_64KEY); - end - else - begin - MyRegistry2:=TRegistry.Create; - rVetkaReestra.Enabled:=False; - end; - - if rVetkaReestra.ItemIndex = 0 then - FullKey:= 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' - else if rVetkaReestra.ItemIndex = 1 then - FullKey:= 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'; - - ListBox1.Items.Clear; - MyList3:=TStringListUTF8.Create; - //MyRegistry:=TRegistry.Create(KEY_WOW64_32KEY); - with MyRegistry2 do - begin - RootKey:=HKEY_LOCAL_MACHINE; - OpenKeyReadOnly(FullKey); - GetKeyNames(MyList3); - CloseKey; - for i:=0 to MyList3.Count-1 do - begin - RootKey:=HKEY_LOCAL_MACHINE; - OpenKeyReadOnly(FullKey+ - MyList3[i]); - Str:=ReadString('DisplayName'); - if Str<>'' then - NameKey:=MyList3.Strings[i]; - ListBox1.Items.Add(CP1251ToUTF8(NameKey)); - CloseKey; - end; - end; - // MyList3.Free; - // MyRegistry.CloseKey; -// MyRegistry.Free; - -end; - -procedure TfMian.leKatalogSearchChange(Sender: TObject); -begin - put:=leKatalogSearch.Text; -end; - -procedure TfMian.leKluchPodrobChange(Sender: TObject); -begin - -end; - - -procedure TfMian.ListBox1SelectionChange(Sender: TObject; User: boolean); -var - i: Integer; //счетчик - FullKey: String; - FiltrNameProg: String; - s: String; - p1: Integer; - p2: Integer; - p3:String; - //для замен - FiltrInstZamena:String; - Poz2InstZam:Byte; - Poz3InstZam:Byte; -begin - if rVetkaReestra.ItemIndex = 0 then - begin - MyRegistry2:=TRegistry.Create; - FullKey:= 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' - end - else if rVetkaReestra.ItemIndex = 1 then + if (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) then begin - MyRegistry2:=TRegistry.Create(KEY_WOW64_64KEY); - FullKey:= 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'; - end; - - - // MyRegistry:=TRegistry.Create(KEY_WOW64_64KEY); - for i:= 0 to ListBox1.Count -1 do - if ListBox1.Selected[i] then - begin - leKeyName.Text:=ListBox1.Items.Strings[i]; - // leFullPathKey.Text:=FullKey + leKeyName.Text + '\'; - // end - // else begin - // Exit + Nst2Pos := 0; + Nst4Pos := 1; //246 + Nst6Pos := 2; +// showmessage('Сработал вариант 246'); end; - leFullPathKey.Text:=FullKey + leKeyName.Text + '\'; - { - MyRegistry:=TRegistry.Create; - MyRegistry.RootKey:=HKEY_LOCAL_MACHINE; // lKeyName.Caption - If MyRegistry.OpenKey(PChar(FullKey + leKeyName.Text + '\'), False) Then - Begin - leDisplayName.Text:=CP1251ToUTF8(MyRegistry.ReadString('DisplayName')); - leVersionProg.Text:=CP1251ToUTF8(MyRegistry.ReadString('DisplayVersion')); - leKatalog.Text:=CP1251ToUTF8(MyRegistry.ReadString('InstallLocation')); - leRazrab.Text:=CP1251ToUTF8(MyRegistry.ReadString('Publisher')); - UninstallKey:=CP1251ToUTF8(MyRegistry.ReadString('UninstallString')); - End; - // MyRegistry.CloseKey; - //MyRegistry.Free; - } - //начало другого реестра - MyRegistry2.RootKey:=HKEY_LOCAL_MACHINE; - MyRegistry2.OpenKeyReadOnly(PChar(FullKey + leKeyName.Text + '\')); - leDisplayName.Text:=CP1251ToUTF8(MyRegistry2.ReadString('DisplayName')); - leVersionProg.Text:=CP1251ToUTF8(MyRegistry2.ReadString('DisplayVersion')); - leKatalog.Text:=CP1251ToUTF8(MyRegistry2.ReadString('InstallLocation')); - leRazrab.Text:=CP1251ToUTF8(MyRegistry2.ReadString('Publisher')); - UninstallKey:=CP1251ToUTF8(MyRegistry2.ReadString('UninstallString')); - leInstallDate.Text:=CP1251ToUTF8(MyRegistry2.ReadString('InstallDate')); - //конец другого реестра + if (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) then + begin + Nst2Pos := 0; + Nst5Pos := 1; //256 + Nst6Pos := 2; +// showmessage('Сработал вариант 256'); + end; + // showmessage('Nst7Pos' + IntToStr(Nst7Pos) + #13 + ' Nst2Pos' + IntToStr(Nst2Pos) + #13 + 'Nst1Pos' + IntToStr(Nst1Pos) + #13 + ' Nst3Pos' + IntToStr(Nst3Pos) + #13 + ' Nst4Pos' + IntToStr(Nst4Pos) + #13 + ' Nst5Pos' + IntToStr(Nst5Pos) + #13 + ' Nst6Pos' + IntToStr(Nst6Pos)); - // Теперь начинается поиск в базе - if leDisplayName.Text = '' then - begin - FiltrNameProg:=leKeyName.Text; - end - else begin - FiltrNameProg:=leDisplayName.Text; - end; - //Showmessage(FiltrNameProg); - UTF8Delete(FiltrNameProg, UTF8Pos('"', FiltrNameProg), 1); - UTF8Delete(FiltrNameProg, UTF8Pos('-2_is1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos('_is1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos('_x64', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' CC', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' CS', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' cc', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' cs', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' CC 2015', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' CC 2016', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' CC 2017', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2015.1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2015.2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2015.3', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2015.4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2015.5', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2016.1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2016.2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2016.3', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2016.4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2016.5', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2017.1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2017.2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2017.3', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2017.4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2017.5', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2015', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2016', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2017', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2007', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2008', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2009', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2010', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2011', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2012', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2013', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 2014', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (v0', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (v1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (v2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (v3', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (v4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (v5', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (v6', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (v7', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (v8', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (v9', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v0', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v3', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v5', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v6', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v7', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v8', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v9', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v 0.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v 1.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v 2.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v 3.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v 4.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v 5.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v 6.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v 7.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v 8.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v 9.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v.0', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v.1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v.2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v.3', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v.4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v.5', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v.6', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v.7', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v.8', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v.9', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v. 0', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v. 1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v. 2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v. 3', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v. 4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v. 5', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v. 6', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v. 7', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v. 8', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' v. 9', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(', версия', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (версия', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (Версия', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(', version', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (version', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (Version', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' версия', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' version', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' Версия', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' Version', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' Ver.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' ver.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (Version', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (x64', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' x64', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (x86', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' x86', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos('-x64', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' - 64 bit', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (32-разрядная', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (32-Bit', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (32-bit', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (32 bit', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (64-разрядная', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (64-Bit', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (64-bit', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (64 bit', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 64-bit', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 32-bit', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 64 bit', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 32 bit', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (V0', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (V1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (V2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (V3', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (V4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (V5', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (V6', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (V7', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (V8', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (V9', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V0', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V3', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V5', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V6', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V7', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V8', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V9', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V.0', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V.1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V.2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V.3', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V.4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V.5', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V.6', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V.7', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V.8', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V.9', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V. 0', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V. 1', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V. 2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V. 3', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V. 4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V. 5', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V. 6', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V. 7', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V. 8', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' V. 9', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos('_64b', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' 64b', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' Trial', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' trial', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' demo', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' Demo', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (Trial', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (trial', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (demo', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (Demo', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' with update', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' with Update', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' With Update', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' With update', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (build', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (Build', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (0.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (1.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (2.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (3.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (4.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (5.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (6.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (7.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (8.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' (9.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' -0.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' -1.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' -2.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' -3.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' -4.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' -5.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' -6.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' -7.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' -8.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' -9.', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' XE8', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' XE2', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' XE4', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos(' XE6', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos('™', FiltrNameProg), UTF8Length(FiltrNameProg)); - UTF8Delete(FiltrNameProg, UTF8Pos('-64', FiltrNameProg), UTF8Length(FiltrNameProg)); - // 11.11 - for p1 := 0 to 100 do - begin - for p2 := 0 to 100 do - begin - p3:=' ' + IntToStr(p1) + '.' + IntToStr(p2); - UTF8Delete(FiltrNameProg, UTF8Pos(p3, FiltrNameProg), UTF8Length(FiltrNameProg)); - end; - end; - //11.11 - for p1 := 0 to 100 do - begin - for p2 := 0 to 100 do - begin - p3:=IntToStr(p1) + '.' + IntToStr(p2); - UTF8Delete(FiltrNameProg, UTF8Pos(p3, FiltrNameProg), UTF8Length(FiltrNameProg)); - end; - end; - //-11.11 - for p1 := 0 to 100 do - begin - for p2 := 0 to 100 do - begin - p3:='-' + IntToStr(p1) + '.' + IntToStr(p2); - UTF8Delete(FiltrNameProg, UTF8Pos(p3, FiltrNameProg), UTF8Length(FiltrNameProg)); - end; - end; - // -11. - for p1 := 0 to 100 do - begin - for p2 := 0 to 100 do - begin - p3:='-' + IntToStr(p1) + '.'; - UTF8Delete(FiltrNameProg, UTF8Pos(p3, FiltrNameProg), UTF8Length(FiltrNameProg)); - end; - end; - // (11. - for p1 := 0 to 100 do - begin - for p2 := 0 to 100 do +if Nst7 = 1 then +begin +DBGrid2.Columns[Nst7Pos].Title.Caption:='Путь'; +DBGrid2.Columns[Nst7Pos].Width:= 200; +end; +if Nst2 = 1 then +begin +DBGrid2.Columns[Nst2Pos].Title.Caption:='Название'; +DBGrid2.Columns[Nst2Pos].Width:= 110; +end; + +if Nst1 = 1 then +begin +DBGrid2.Columns[Nst1Pos].Title.Caption:='Исходный запрос'; +DBGrid2.Columns[Nst1Pos].Width:= 80; +end; + +if Nst3 = 1 then +begin +DBGrid2.Columns[Nst3Pos].Title.Caption:='Тип ПО'; +DBGrid2.Columns[Nst3Pos].Width:= 130; +end; +if Nst4 = 1 then +begin +DBGrid2.Columns[Nst4Pos].Title.Caption:='Лицензия'; +DBGrid2.Columns[Nst4Pos].Width:= 90; +end; +if Nst5 = 1 then +begin +DBGrid2.Columns[Nst5Pos].Title.Caption:='Стоимость'; +DBGrid2.Columns[Nst5Pos].Width:= 80; +end; +if Nst6 = 1 then +begin +DBGrid2.Columns[Nst6Pos].Title.Caption:='Замена'; +DBGrid2.Columns[Nst6Pos].Width:= 130; +end; +end; + +procedure TfMian.AvtoPoiskPageContextPopup(Sender: TObject; MousePos: TPoint; + var Handled: Boolean); + +begin + +end; + +procedure TfMian.bDeinstrallClick(Sender: TObject); +begin + if UninstallKey = '' then +begin + Application.MessageBox('Не найден путь к деинсталлятору! Возможно, не выбран ключ реестра. В противном случае, не удалось подгрузить эти данные из реестра.', + 'Не найден путь к деинсталлятору', MB_ICONERROR + MB_OK); + Exit; +end; +if ShellExecute(0,nil, PChar(UninstallKey),nil,nil,1) = 0 then; +end; + +procedure TfMian.bExplorerClick(Sender: TObject); +begin + if leKatalog.Text = '' then + begin + Application.MessageBox('Каталог не указан!!! Возможно, не выбран ключ реестра. В противном случае, не удалось подгрузить каталог программы из реестра.', + 'Каталог не указан!!!', MB_ICONERROR + MB_OK); + Exit; + end; + if ShellExecute(0,nil, PChar('Explorer.exe'),PChar(leKatalog.Text),nil,1) = 0 then; +end; + +procedure TfMian.bInstpoSokrtiZaprosClick(Sender: TObject); +var + i: Integer; //счетчик + FullKey: String; + FiltrNameProg: String; + s: String; + p1: Integer; + p2: Integer; + p3:String; + //для замен + FiltrInstZamena:String; + Poz2InstZam:Byte; + Poz3InstZam:Byte; +begin + if rVetkaReestra.ItemIndex = 0 then + begin + MyRegistry2:=TRegistry.Create; + FullKey:= 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' + end + else if rVetkaReestra.ItemIndex = 1 then + begin + MyRegistry2:=TRegistry.Create(KEY_WOW64_64KEY); + FullKey:= 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'; + end; + + + // MyRegistry:=TRegistry.Create(KEY_WOW64_64KEY); + for i:= 0 to ListBox1.Count -1 do + if ListBox1.Selected[i] then begin - p3:='(' + IntToStr(p1) + '.'; - UTF8Delete(FiltrNameProg, UTF8Pos(p3, FiltrNameProg), UTF8Length(FiltrNameProg)); - end; - end; + leKeyName.Text:=ListBox1.Items.Strings[i]; + // leFullPathKey.Text:=FullKey + leKeyName.Text + '\'; + // end + // else begin + // Exit + end; + leFullPathKey.Text:=FullKey + leKeyName.Text + '\'; + + { + MyRegistry:=TRegistry.Create; + MyRegistry.RootKey:=HKEY_LOCAL_MACHINE; // lKeyName.Caption + If MyRegistry.OpenKey(PChar(FullKey + leKeyName.Text + '\'), False) Then + Begin + leDisplayName.Text:=CP1251ToUTF8(MyRegistry.ReadString('DisplayName')); + leVersionProg.Text:=CP1251ToUTF8(MyRegistry.ReadString('DisplayVersion')); + leKatalog.Text:=CP1251ToUTF8(MyRegistry.ReadString('InstallLocation')); + leRazrab.Text:=CP1251ToUTF8(MyRegistry.ReadString('Publisher')); + UninstallKey:=CP1251ToUTF8(MyRegistry.ReadString('UninstallString')); + End; + // MyRegistry.CloseKey; + //MyRegistry.Free; + } + //начало другого реестра + MyRegistry2.RootKey:=HKEY_LOCAL_MACHINE; + MyRegistry2.OpenKeyReadOnly(PChar(FullKey + leKeyName.Text + '\')); + leDisplayName.Text:=CP1251ToUTF8(MyRegistry2.ReadString('DisplayName')); + leVersionProg.Text:=CP1251ToUTF8(MyRegistry2.ReadString('DisplayVersion')); + leKatalog.Text:=CP1251ToUTF8(MyRegistry2.ReadString('InstallLocation')); + leRazrab.Text:=CP1251ToUTF8(MyRegistry2.ReadString('Publisher')); + UninstallKey:=CP1251ToUTF8(MyRegistry2.ReadString('UninstallString')); + leInstallDate.Text:=CP1251ToUTF8(MyRegistry2.ReadString('InstallDate')); + //конец другого реестра + + // Теперь начинается поиск в базе + + if leDisplayName.Text = '' then + begin + FiltrNameProg:=leKeyName.Text; + end + else begin + FiltrNameProg:=leDisplayName.Text; + end; + FiltrNameProg:= InputBox('Сократите запрос в базу', 'Подсказка: сократите название, чтобы программу было проще найти в базе данных', FiltrNameProg); // s := 'SELECT name, type, license FROM program WHERE (name LIKE "%%%' + FiltrNameProg + '%%")'; s := 'SELECT name, type, license, zamena FROM program WHERE (name LIKE "' + FiltrNameProg + '%%")'; @@ -4125,115 +10421,6 @@ procedure TfMian.ListBox1SelectionChange(Sender: TObject; User: boolean); cbInstallZam.Items.Add(FiltrInstZamena); end; //конец заполнения замен - - -end; - -procedure TfMian.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; - DataCol: Integer; Column: TColumn; State: TGridDrawState); -var - Nst3:Word; - s:string; -begin - - - // проверяем настройки столбцов - SQLQuery2.Close; - SQLQuery2.Active:=false; - SQLQuery2.SQL.Clear; - s := 'select * from setting'; - SQLQuery2.SQL.Add(s); - SQLQuery2.Active:=true; - - Nst3:=SQLQuery2.FieldByName('AvtoSt3').AsInteger; - - // - - if Nst3 = 1 then - begin - - // меняем цвет шрифта в зависимости от типа ПО -if DBGrid1.DataSource.DataSet.FieldByName('st3').AsString = 'Свободная программа' then - begin - DBGrid1.Canvas.Brush.Color := clGreen; - DBGrid1.Canvas.Font.Style := []; - DBGrid1.Canvas.Font.Color := clGreen; - DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); - end; - -if DBGrid1.DataSource.DataSet.FieldByName('st3').AsString = 'Условно-бесплатное ПО' then - begin - DBGrid1.Canvas.Brush.Color := RGB(200, 68, 7); - DBGrid1.Canvas.Font.Style := []; - DBGrid1.Canvas.Font.Color := RGB(200, 68, 7); - DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); - end; - -if DBGrid1.DataSource.DataSet.FieldByName('st3').AsString = 'Платное ПО' then - begin - DBGrid1.Canvas.Brush.Color := RGB(255, 0, 0); - DBGrid1.Canvas.Font.Style := []; - DBGrid1.Canvas.Font.Color := RGB(255, 0, 0); - DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); - end; - end; -end; - -procedure TfMian.DBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect; - DataCol: Integer; Column: TColumn; State: TGridDrawState); -begin // меняем цвет шрифта в зависимости от типа ПО -if DBGrid2.DataSource.DataSet.FieldByName('st3').AsString = 'Свободная программа' then - begin - DBGrid2.Canvas.Brush.Color := clGreen; - DBGrid2.Canvas.Font.Style := []; - DBGrid2.Canvas.Font.Color := clGreen; - DBGrid2.DefaultDrawColumnCell(Rect, DataCol, Column, State); - end; - -if DBGrid2.DataSource.DataSet.FieldByName('st3').AsString = 'Условно-бесплатное ПО' then - begin - DBGrid2.Canvas.Brush.Color := RGB(200, 68, 7); - DBGrid2.Canvas.Font.Style := []; - DBGrid2.Canvas.Font.Color := RGB(200, 68, 7); - DBGrid2.DefaultDrawColumnCell(Rect, DataCol, Column, State); - end; - -if DBGrid2.DataSource.DataSet.FieldByName('st3').AsString = 'Платное ПО' then - begin - DBGrid2.Canvas.Brush.Color := RGB(255, 0, 0); - DBGrid2.Canvas.Font.Style := []; - DBGrid2.Canvas.Font.Color := RGB(255, 0, 0); - DBGrid2.DefaultDrawColumnCell(Rect, DataCol, Column, State); - end; -end; - -procedure TfMian.AvtoPoiskPageContextPopup(Sender: TObject; MousePos: TPoint; - var Handled: Boolean); - -begin - -end; - -procedure TfMian.bDeinstrallClick(Sender: TObject); -begin - if UninstallKey = '' then -begin - Application.MessageBox('Не найден путь к деинсталлятору! Возможно, не выбран ключ реестра. В противном случае, не удалось подгрузить эти данные из реестра.', - 'Не найден путь к деинсталлятору', MB_ICONERROR + MB_OK); - Exit; -end; -if ShellExecute(0,nil, PChar(UninstallKey),nil,nil,1) = 0 then; -end; - -procedure TfMian.bExplorerClick(Sender: TObject); -begin - if leKatalog.Text = '' then - begin - Application.MessageBox('Каталог не указан!!! Возможно, не выбран ключ реестра. В противном случае, не удалось подгрузить каталог программы из реестра.', - 'Каталог не указан!!!', MB_ICONERROR + MB_OK); - Exit; - end; - if ShellExecute(0,nil, PChar('Explorer.exe'),PChar(leKatalog.Text),nil,1) = 0 then; end; procedure TfMian.bInstViewZamClick(Sender: TObject); @@ -4476,6 +10663,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск MassivRuchStr[N][4]:= SQLQuery3.FieldByName('license').AsString; MassivRuchStr[N][5]:= SQLQuery3.FieldByName('cena').AsString; MassivRuchStr[N][6]:= SQLQuery3.FieldByName('zamena').AsString; + end; // @@ -4539,10 +10727,13 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst5:=SQLQuery1.FieldByName('RuchSt5').AsInteger; Nst6:=SQLQuery1.FieldByName('RuchSt6').AsInteger; + if Nst1 = 1 then + begin if (Nst2 = 0) and (Nst7 = 0) and (Nst1 = 1) then s := s + ' st1' else s := s + ', st1'; + end; //if Nst1 = 1 then //s := s + ', st1'; // исходный запрос @@ -4562,14 +10753,15 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск s := s + ' FROM ruch ORDER BY st2 DESC' else s := s + ' FROM ruch'; + //showmessage(s); //конец постройки запроса MyListRuch.Free; MyFiltrList2.Free; - ProgressBar1.Position:=4; + SQLQuery3.Close; SQLQuery3.Active:=false; SQLQuery3.SQL.Clear; @@ -4588,6 +10780,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 4; Nst5Pos := 5; Nst6Pos := 6; +// showmessage('Сработал вариант 7213456'); end; if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) then @@ -4598,6 +10791,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 3; Nst5Pos := 4; Nst6Pos := 5; +// showmessage('Сработал вариант 723456'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) then @@ -4608,6 +10802,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 3; Nst5Pos := 4; Nst6Pos := 5; +// showmessage('Сработал вариант 713456'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) then @@ -4618,6 +10813,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 3; Nst5Pos := 4; Nst6Pos := 5; +// showmessage('Сработал вариант 712456'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) then @@ -4628,6 +10824,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 3; Nst5Pos := 4; Nst6Pos := 5; +// showmessage('Сработал вариант 712356'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) then @@ -4638,6 +10835,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 3; Nst4Pos := 4; Nst6Pos := 5; +// showmessage('Сработал вариант 712346'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) then @@ -4648,6 +10846,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 3; Nst4Pos := 4; Nst5Pos := 5; +// showmessage('Сработал вариант 712345'); end; if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) then @@ -4658,6 +10857,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 3; Nst5Pos := 4; Nst6Pos := 5; +// showmessage('Сработал вариант 123456'); end; if (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) then @@ -4667,6 +10867,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 2; Nst5Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 13456'); end; if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst7 = 0) then @@ -4676,6 +10877,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 2; Nst5Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 12456'); end; if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst7 = 0) then @@ -4685,6 +10887,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 2; Nst5Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 12356'); end; if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst5 = 0) and (Nst7 = 0) then @@ -4694,6 +10897,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 2; Nst4Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 12346'); end; if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 0) and (Nst7 = 0) then @@ -4703,6 +10907,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 2; Nst4Pos := 3; Nst5Pos := 4; +// showmessage('Сработал вариант 12345'); end; if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) then @@ -4712,6 +10917,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 2; Nst5Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 73456'); end; if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) then @@ -4721,6 +10927,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 2; Nst5Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 72456'); end; if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst4 = 0) then @@ -4730,6 +10937,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 2; Nst5Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 72356'); end; if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst5 = 0) then @@ -4739,6 +10947,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 2; Nst4Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 72346'); end; if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst6 = 0) then @@ -4748,6 +10957,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 2; Nst4Pos := 3; Nst5Pos := 4; +// showmessage('Сработал вариант 72345'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) then @@ -4757,6 +10967,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 2; Nst5Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 71456'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst4 = 0) then @@ -4766,6 +10977,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 2; Nst5Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 71356'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst5 = 0) then @@ -4775,6 +10987,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 2; Nst4Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 71346'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst6 = 0) then @@ -4784,6 +10997,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 2; Nst4Pos := 3; Nst5Pos := 4; +// showmessage('Сработал вариант 71345'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) then @@ -4793,6 +11007,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 2; Nst5Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 71256'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst5 = 0) then @@ -4802,6 +11017,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 2; Nst4Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 71246'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst6 = 0) then @@ -4811,6 +11027,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 2; Nst4Pos := 3; Nst5Pos := 4; +// showmessage('Сработал вариант 71245'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst4 = 0) and (Nst5 = 0) then @@ -4820,6 +11037,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 2; Nst3Pos := 3; Nst6Pos := 4; +// showmessage('Сработал вариант 71236'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst4 = 0) and (Nst6 = 0) then @@ -4829,6 +11047,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 2; Nst3Pos := 3; Nst5Pos := 4; +// showmessage('Сработал вариант 71235'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 0) and (Nst6 = 0) then @@ -4838,6 +11057,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 2; Nst3Pos := 3; Nst4Pos := 4; +// showmessage('Сработал вариант 71234'); end; if (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst7 = 0) then @@ -4846,6 +11066,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 1; //3456 Nst5Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 3456'); end; if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst3 = 0) then @@ -4854,6 +11075,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 1; //2456 Nst5Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 2456'); end; if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) then @@ -4862,6 +11084,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 1; //2356 Nst5Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 2356'); end; if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst5 = 0) then @@ -4870,6 +11093,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 1; //2346 Nst4Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 2346'); end; if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst7 = 0) and (Nst6 = 0) then @@ -4878,6 +11102,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 1; //2345 Nst4Pos := 2; Nst5Pos := 3; + // showmessage('Сработал вариант 2345'); end; if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) then @@ -4886,6 +11111,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst4Pos := 1; //7456 Nst5Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7456'); end; if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) then @@ -4894,6 +11120,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 1; //7356 Nst5Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7356'); end; if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) then @@ -4902,6 +11129,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 1; //7346 Nst4Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7346'); end; if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst6 = 0) then @@ -4910,6 +11138,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst3Pos := 1; //7345 Nst4Pos := 2; Nst5Pos := 3; +// showmessage('Сработал вариант 7345'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then @@ -4918,6 +11147,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 1; //7156 Nst5Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7156'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then @@ -4926,6 +11156,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 1; //7146 Nst4Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7146'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then @@ -4934,6 +11165,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 1; //7145 Nst4Pos := 2; Nst5Pos := 3; +// showmessage('Сработал вариант 7145'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then @@ -4942,6 +11174,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 1; //7126 Nst2Pos := 2; Nst6Pos := 3; +// showmessage('Сработал вариант 7126'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then @@ -4950,6 +11183,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 1; //7125 Nst2Pos := 2; Nst5Pos := 3; +// showmessage('Сработал вариант 7125'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then @@ -4958,6 +11192,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 1; //7123 Nst2Pos := 2; Nst3Pos := 3; + // showmessage('Сработал вариант 7123'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then @@ -4965,6 +11200,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst1Pos := 1; //712 Nst2Pos := 2; + // showmessage('Сработал вариант 712'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst3 = 1) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then @@ -4972,6 +11208,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst1Pos := 1; //713 Nst3Pos := 2; +// showmessage('Сработал вариант 713'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst4 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then @@ -4979,6 +11216,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst1Pos := 1; //714 Nst4Pos := 2; +// showmessage('Сработал вариант 714'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst5 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then @@ -4986,6 +11224,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst1Pos := 1; //715 Nst5Pos := 2; +// showmessage('Сработал вариант 715'); end; if (Nst7 = 1) and (Nst1 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then @@ -4993,6 +11232,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst1Pos := 1; //716 Nst6Pos := 2; +// showmessage('Сработал вариант 716'); end; if (Nst7 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then @@ -5000,6 +11240,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst2Pos := 1; //723 Nst3Pos := 2; +// showmessage('Сработал вариант 723'); end; if (Nst7 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then @@ -5007,6 +11248,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst2Pos := 1; //724 Nst4Pos := 2; +// showmessage('Сработал вариант 724'); end; if (Nst7 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then @@ -5014,6 +11256,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst2Pos := 1; //725 Nst5Pos := 2; +// showmessage('Сработал вариант 725'); end; if (Nst7 = 1) and (Nst2 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst5 = 0) then @@ -5021,6 +11264,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst2Pos := 1; //726 Nst6Pos := 2; +// showmessage('Сработал вариант 726'); end; if (Nst7 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst5 = 0) and (Nst6 = 0) then @@ -5028,6 +11272,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst3Pos := 1; //734 Nst4Pos := 2; +// showmessage('Сработал вариант 734'); end; if (Nst7 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst6 = 0) then @@ -5035,6 +11280,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst3Pos := 1; //735 Nst5Pos := 2; +// showmessage('Сработал вариант 735'); end; if (Nst7 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then @@ -5042,6 +11288,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst3Pos := 1; //736 Nst6Pos := 2; +// showmessage('Сработал вариант 736'); end; if (Nst7 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then @@ -5049,6 +11296,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst4Pos := 1; //745 Nst5Pos := 2; +// showmessage('Сработал вариант 745'); end; if (Nst7 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst1 = 0) then @@ -5056,6 +11304,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst4Pos := 1; //746 Nst6Pos := 2; +// showmessage('Сработал вариант 746'); end; if (Nst7 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst1 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then @@ -5063,6 +11312,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst7Pos := 0; Nst1Pos := 1; //756 Nst2Pos := 2; +// showmessage('Сработал вариант 756'); end; if (Nst1 = 1) and (Nst2 = 1) and (Nst3 = 1) and (Nst7 = 0) and (Nst4 = 0) and (Nst5 = 0) and (Nst6 = 0) then @@ -5070,6 +11320,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 0; Nst2Pos := 1; //123 Nst3Pos := 2; +// showmessage('Сработал вариант 123'); end; if (Nst1 = 1) and (Nst2 = 1) and (Nst4 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst5 = 0) and (Nst6 = 0) then @@ -5077,6 +11328,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 0; Nst2Pos := 1; //124 Nst4Pos := 2; +// showmessage('Сработал вариант 124'); end; if (Nst1 = 1) and (Nst2 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst3 = 0) and (Nst4 = 0) and (Nst6 = 0) then @@ -5084,6 +11336,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 0; Nst2Pos := 1; //125 Nst5Pos := 2; +// showmessage('Сработал вариант 125'); end; if (Nst1 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst4 = 0) and (Nst5 = 0) then @@ -5091,6 +11344,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 0; Nst3Pos := 1; //136 Nst6Pos := 2; +// showmessage('Сработал вариант 136'); end; if (Nst1 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst6 = 0) then @@ -5098,6 +11352,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 0; Nst4Pos := 1; //145 Nst5Pos := 2; +// showmessage('Сработал вариант 145'); end; if (Nst1 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst5 = 0) then @@ -5105,6 +11360,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 0; Nst4Pos := 1; //146 Nst6Pos := 2; +// showmessage('Сработал вариант 146'); end; if (Nst1 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst2 = 0) and (Nst3 = 0) and (Nst4 = 0) then @@ -5112,6 +11368,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst1Pos := 0; Nst5Pos := 1; //156 Nst6Pos := 2; +// showmessage('Сработал вариант 156'); end; if (Nst2 = 1) and (Nst3 = 1) and (Nst4 = 1) and (Nst1 = 0) and (Nst5 = 0) and (Nst6 = 0) and (Nst7 = 0) then @@ -5119,6 +11376,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 0; Nst3Pos := 1; //234 Nst4Pos := 2; +// showmessage('Сработал вариант 234'); end; if (Nst2 = 1) and (Nst3 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst6 = 0) then @@ -5126,6 +11384,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 0; Nst3Pos := 1; //235 Nst5Pos := 2; +// showmessage('Сработал вариант 235'); end; if (Nst2 = 1) and (Nst3 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst4 = 0) and (Nst5 = 0) then @@ -5133,6 +11392,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 0; Nst3Pos := 1; //236 Nst6Pos := 2; +// showmessage('Сработал вариант 236'); end; if (Nst2 = 1) and (Nst4 = 1) and (Nst5 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst6 = 0) then @@ -5140,6 +11400,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 0; Nst4Pos := 1; //245 Nst5Pos := 2; +// showmessage('Сработал вариант 245'); end; if (Nst2 = 1) and (Nst4 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst5 = 0) then @@ -5147,6 +11408,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 0; Nst4Pos := 1; //246 Nst6Pos := 2; +// showmessage('Сработал вариант 246'); end; if (Nst2 = 1) and (Nst5 = 1) and (Nst6 = 1) and (Nst7 = 0) and (Nst1 = 0) and (Nst3 = 0) and (Nst4 = 0) then @@ -5154,6 +11416,7 @@ procedure TfMian.bRuchPoiskClick(Sender: TObject); // Ручной поиск Nst2Pos := 0; Nst5Pos := 1; //256 Nst6Pos := 2; +// showmessage('Сработал вариант 256'); end; // showmessage('Nst7Pos' + IntToStr(Nst7Pos) + #13 + ' Nst2Pos' + IntToStr(Nst2Pos) + #13 + 'Nst1Pos' + IntToStr(Nst1Pos) + #13 + ' Nst3Pos' + IntToStr(Nst3Pos) + #13 + ' Nst4Pos' + IntToStr(Nst4Pos) + #13 + ' Nst5Pos' + IntToStr(Nst5Pos) + #13 + ' Nst6Pos' + IntToStr(Nst6Pos)); diff --git a/prog.txt b/prog.txt index e1df5de..03e5161 100644 --- a/prog.txt +++ b/prog.txt @@ -1 +1 @@ -1.4.4 \ No newline at end of file +1.4.5 \ No newline at end of file diff --git a/settings.lfm b/settings.lfm index 6fb9f58..0a71c2a 100644 --- a/settings.lfm +++ b/settings.lfm @@ -1,7 +1,7 @@ object fSettings: TfSettings - Left = 417 + Left = 353 Height = 330 - Top = 137 + Top = 130 Width = 447 Caption = 'Настройки' ClientHeight = 330 @@ -13,13 +13,13 @@ object fSettings: TfSettings Height = 280 Top = 0 Width = 447 - ActivePage = TabSheet1 + ActivePage = SettingsAvtopoisk Align = alClient - TabIndex = 1 + TabIndex = 0 TabOrder = 0 object SettingsAvtopoisk: TTabSheet Caption = 'Автопоиск' - ClientHeight = 246 + ClientHeight = 252 ClientWidth = 439 object cbAvtoUnkProg: TCheckBox Left = 16 @@ -109,16 +109,25 @@ object fSettings: TfSettings 'Путь' 'Название ' 'Исходный запрос' - 'Тип ПО' + 'Тип ПО*' 'Лицензия' 'Стоимость' 'Замена' ) + OnItemClick = cgRuchKolItemClick TabOrder = 0 Data = { 0700000002020202020202 } end + object Label4: TLabel + Left = 14 + Height = 15 + Top = 192 + Width = 146 + Caption = '* - Обязательные столбцы' + ParentColor = False + end end end object Panel1: TPanel diff --git a/settings.pas b/settings.pas index d6021e9..1e82021 100644 --- a/settings.pas +++ b/settings.pas @@ -23,6 +23,7 @@ TfSettings = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; + Label4: TLabel; PageControl1: TPageControl; Panel1: TPanel; SettingsAvtopoisk: TTabSheet; @@ -34,6 +35,7 @@ TfSettings = class(TForm) procedure bAvtoCancelClick(Sender: TObject); procedure bAvtoOkClick(Sender: TObject); procedure cgAvtoKolItemClick(Sender: TObject; Index: integer); + procedure cgRuchKolItemClick(Sender: TObject; Index: integer); procedure FormActivate(Sender: TObject); private { private declarations } @@ -247,11 +249,11 @@ procedure TfSettings.bAvtoOkClick(Sender: TObject); SQLQuery1.ParamByName('pText8').AsInteger := AvtoKol5; SQLQuery1.ParamByName('pText9').AsInteger := RuchKol0; SQLQuery1.ParamByName('pText10').AsInteger := RuchKol1; - SQLQuery1.ParamByName('pText11').AsInteger := RuchKol6; - SQLQuery1.ParamByName('pText12').AsInteger := RuchKol2; - SQLQuery1.ParamByName('pText13').AsInteger := RuchKol3; - SQLQuery1.ParamByName('pText14').AsInteger := RuchKol4; - SQLQuery1.ParamByName('pText15').AsInteger := RuchKol5; + SQLQuery1.ParamByName('pText11').AsInteger := RuchKol2; + SQLQuery1.ParamByName('pText12').AsInteger := RuchKol3; + SQLQuery1.ParamByName('pText13').AsInteger := RuchKol4; + SQLQuery1.ParamByName('pText14').AsInteger := RuchKol5; + SQLQuery1.ParamByName('pText15').AsInteger := RuchKol6; SQLQuery1.ExecSQL; Close; end; @@ -286,6 +288,24 @@ procedure TfSettings.cgAvtoKolItemClick(Sender: TObject; Index: integer); end; +procedure TfSettings.cgRuchKolItemClick(Sender: TObject; Index: integer); +var + n2:integer; +begin + + if cgRuchKol.Checked[3] = True then + n2 := 1; + if cgRuchKol.Checked[3] = False then + n2 := 0; + + if n2 = 0 then + begin + showmessage('"Тип ПО" является обязательным столбцом! Сейчас он будет включен.'); + cgRuchKol.Checked[3] := True; + end; + +end; + procedure TfSettings.FormActivate(Sender: TObject); var N:Integer; @@ -621,11 +641,11 @@ procedure TfSettings.bAvtoAppleClick(Sender: TObject); SQLQuery1.ParamByName('pText8').AsInteger := AvtoKol5; SQLQuery1.ParamByName('pText9').AsInteger := RuchKol0; SQLQuery1.ParamByName('pText10').AsInteger := RuchKol1; - SQLQuery1.ParamByName('pText11').AsInteger := RuchKol6; - SQLQuery1.ParamByName('pText12').AsInteger := RuchKol2; - SQLQuery1.ParamByName('pText13').AsInteger := RuchKol3; - SQLQuery1.ParamByName('pText14').AsInteger := RuchKol4; - SQLQuery1.ParamByName('pText15').AsInteger := RuchKol5; + SQLQuery1.ParamByName('pText11').AsInteger := RuchKol2; + SQLQuery1.ParamByName('pText12').AsInteger := RuchKol3; + SQLQuery1.ParamByName('pText13').AsInteger := RuchKol4; + SQLQuery1.ParamByName('pText14').AsInteger := RuchKol5; + SQLQuery1.ParamByName('pText15').AsInteger := RuchKol6; SQLQuery1.ExecSQL; end;
ID'); + if Nst7 = 1 then +t.add(' Путь'); + if Nst2 = 1 then t.add(' Название'); + if Nst1 = 1 then + t.add(' Исходный запрос'); + if Nst3 = 1 then t.add(' Тип ПО'); + if Nst4 = 1 then t.add(' Лицензия'); + if Nst5 = 1 then t.add(' Стоимость'); + if Nst6 = 1 then t.add(' Замена'); t.add('
'+DBGrid2.DataSource.DataSet.fields[i].fieldname); t.add('