Signed-off-by: Dalibor Marković <dalibor31@gmail.com>

This commit is contained in:
Dalibor Marković 2024-06-11 22:59:07 +02:00
commit d85e1f2521
23 changed files with 24907 additions and 0 deletions

61
.gitignore vendored Normal file
View File

@ -0,0 +1,61 @@
# ---> Delphi
# Uncomment these types if you want even more clean repository. But be careful.
# It can make harm to an existing project source. Read explanations below.
#
# Resource files are binaries containing manifest, project icon and version info.
# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
#*.res
#
# Type library file (binary). In old Delphi versions it should be stored.
# Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
#*.tlb
#
# Diagram Portfolio file. Used by the diagram editor up to Delphi 7.
# Uncomment this if you are not using diagrams or use newer Delphi version.
#*.ddp
#
# Visual LiveBindings file. Added in Delphi XE2.
# Uncomment this if you are not using LiveBindings Designer.
#*.vlb
#
# Deployment Manager configuration file for your project. Added in Delphi XE2.
# Uncomment this if it is not mobile development and you do not use remote debug feature.
#*.deployproj
#
# C++ object files produced when C/C++ Output file generation is configured.
# Uncomment this if you are not using external objects (zlib library for example).
#*.obj
#
#Ignore thumbnails created by Windows
Thumbs.db
#Ignore files built by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
.vs/
#Nuget packages folder
packages/

73
LICENSE Normal file
View File

@ -0,0 +1,73 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright 2024 Dasko
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

2
NTech.dproj.local Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject/>

BIN
NTech.identcache Normal file

Binary file not shown.

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# NTech
NTech software za vođenje servisa
----
Test programa

20
Release.md Normal file
View File

@ -0,0 +1,20 @@
### Release of NTech
--------------------
+ Pre-alpha
Dizajn softvera, izrada baze podataka, izrada interfejsa
+ Alpha
Testiranje softvera
+ Beta
Testiranje i dodavanje funkcionalnosti
+ RC
Otklanjanje grešaka, izrada dokumentacije za krajne korisnike
+ Production
Krajni softver koji se koristi u produkciji
Test program

17
Tabela.inc Normal file
View File

@ -0,0 +1,17 @@
//SQL DDL - tblKlijent
Lista.Add ('CREATE TABLE IF NOT EXISTS tblKlijent (' +
'id INTEGER PRIMARY KEY,' +
'Ime TEXT NOT NULL,' +
'Prezime TEXT NOT NULL,' +
'Adresa TEXT,' +
'Email TEXT,' +
'Datum DATETIME,' +
'Napomena TEXT);');
//SQL DDL - tblTelefon
Lista.Add ('CREATE TABLE tblTelefon (' +
'id INTEGER REFERENCES tblKlijent (id) ON DELETE CASCADE ' +
'ON UPDATE NO ACTION MATCH SIMPLE DEFERRABLE INITIALLY DEFERRED, ' +
'Telefon TEXT);');

57
src/NTech.dpr Normal file
View File

@ -0,0 +1,57 @@
(*******************************************************************************
Projekt: NTech
Unit: NTech
Datum: 27.1.2018. 10:56:32
Opis: NTech glavni Unit
Copyright (C) 2018 Dalibor Marković
*******************************************************************************)
program NTech;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
uses
System.SysUtils,
Vcl.Forms,
uSplash in 'uSplash.pas' {frmSplash} ,
uPrijem in 'uPrijem.pas' {frmPrijem} ,
uMain in 'uMain.pas' {frmMain} ,
uKlijenti in 'uKlijenti.pas' {frmKlijenti} ,
Vcl.Themes,
Vcl.Styles,
udmConn in 'udmConn.pas' {dmConn: TDataModule} ,
uFirma in 'uFirma.pas' {frmFirma} ,
uNtechFunctions in 'uNtechFunctions.pas';
{$R *.res}
var
frmSplash: TfrmSplash;
begin
// ---------------------------------------------------------------------------
// Prikazuje izveštaj o curenju memorije - Memori leaks ako postoji
// ---------------------------------------------------------------------------
System.ReportMemoryLeaksOnShutdown := True;
Application.Initialize;
Application.MainFormOnTaskbar := True;
// --------------------- ------------------------------------------------------
// Kreiranje frmSplash forme i njeno pozivanje
// ---------------------------------------------------------------------------
frmSplash := TfrmSplash.Create(Nil);
Try
frmSplash.ShowModal;
Finally
frmSplash.Free;
End;
Application.CreateForm(TfrmMain, frmMain);
Application.CreateForm(TdmConn, dmConn);
Application.CreateForm(TfrmFirma, frmFirma);
Application.Run;
end.

1161
src/NTech.dproj Normal file

File diff suppressed because it is too large Load Diff

BIN
src/NTech.res Normal file

Binary file not shown.

78
src/uFirma.dfm Normal file
View File

@ -0,0 +1,78 @@
object frmFirma: TfrmFirma
Left = 0
Top = 0
ActiveControl = TitleBarPanel1
Caption = 'frmFirma'
ClientHeight = 360
ClientWidth = 569
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Menu = MainMenu1
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object edtPIB: TEdit
Left = 128
Top = 24
Width = 121
Height = 21
MaxLength = 9
TabOrder = 0
Text = 'edtPIB'
OnChange = edtPIBChange
end
object edt1: TEdit
Left = 128
Top = 56
Width = 121
Height = 21
TabOrder = 1
Text = 'edt1'
end
object TitleBarPanel1: TTitleBarPanel
Left = 0
Top = 0
Width = 569
Height = 22
CustomButtons = <
item
ButtonType = sbMinimize
Enabled = True
Width = 23
Visible = True
end
item
ButtonType = sbRestore
Enabled = True
Width = 23
Visible = True
end
item
ButtonType = sbClose
Enabled = True
Width = 23
Visible = True
end
item
ButtonType = sbSpacer
Enabled = True
Width = 23
Visible = True
end
item
ButtonType = sbCustom
Enabled = True
Width = 23
Visible = True
end>
ExplicitTop = -4
end
object MainMenu1: TMainMenu
Left = 336
Top = 56
end
end

62
src/uFirma.pas Normal file
View File

@ -0,0 +1,62 @@
// Copyright 2020 dalib
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
unit uFirma;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.StdCtrls, Vcl.TitleBarCtrls, Vcl.Menus;
type
TfrmFirma = class(TForm)
edtPIB: TEdit;
edt1: TEdit;
TitleBarPanel1: TTitleBarPanel;
MainMenu1: TMainMenu;
procedure edtPIBChange(Sender: TObject);
procedure edtPIBKeyPress(Sender: TObject; var Key: AnsiChar);
private
{Private declarations}
public
{Public declarations}
end;
var
frmFirma: TfrmFirma;
implementation
uses
uNtechFunctions;
{$R *.dfm}
{TfrmFirma}
procedure TfrmFirma.edtPIBChange(Sender: TObject);
begin
edt1.Text := CheckPIB(edtPIB.Text).ToString;
end;
procedure TfrmFirma.edtPIBKeyPress(Sender: TObject; var Key: AnsiChar);
begin
if not(Key in [#8, '0' .. '9']) then
Key := #0;
end;
end.

15
src/uKlijenti.dfm Normal file
View File

@ -0,0 +1,15 @@
object frmKlijenti: TfrmKlijenti
Left = 0
Top = 0
Caption = 'Klijenti'
ClientHeight = 288
ClientWidth = 346
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Position = poDesigned
TextHeight = 13
end

27
src/uKlijenti.pas Normal file
View File

@ -0,0 +1,27 @@
Unit uKlijenti;
Interface
Uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.ComCtrls, Vcl.ExtCtrls, Vcl.WinXPanels, Vcl.StdCtrls,
Vcl.ToolWin;
Type
TfrmKlijenti = Class(TForm)
Private
{Private declarations}
Public
{Public declarations}
End;
Var
frmKlijenti: TfrmKlijenti;
Implementation
{$R *.dfm}
End.

15
src/uMain.dfm Normal file
View File

@ -0,0 +1,15 @@
object frmMain: TfrmMain
Left = 0
Top = 0
Caption = 'frmMain'
ClientHeight = 514
ClientWidth = 792
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Position = poDesigned
TextHeight = 13
end

55
src/uMain.pas Normal file
View File

@ -0,0 +1,55 @@
(******************************************************************************
Projekt: NTech
Unit: uMain
Datum: 4.2.2018. 00:35:12
Opis: Glavni modul
Copyright (C) 2018-2024 Dalibor
*****************************************************************************)
Unit uMain;
Interface
Uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Menus,
Vcl.ExtCtrls, Vcl.ComCtrls, Vcl.ToolWin, Vcl.StdCtrls,
Vcl.WinXCalendars, Vcl.CategoryButtons, Vcl.WinXCtrls, Vcl.Buttons;
Type
TfrmMain = Class(TForm)
Procedure mnuKlijentiClick(Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
End;
Var
frmMain: TfrmMain;
Implementation
{$R *.dfm}
Uses
uKlijenti, uFirma;
Procedure TfrmMain.mnuKlijentiClick(Sender: TObject);
var
frmKlijenti: TfrmKlijenti;
Begin
frmKlijenti := TfrmKlijenti.Create(Nil);
frmKlijenti.Visible := False;
Try
frmKlijenti.ShowModal;
Finally
frmKlijenti.Free;
End;
End;
End.

117
src/uNtechFunctions.pas Normal file
View File

@ -0,0 +1,117 @@
(*******************************************************************************
Projekt: NTech
Unit: uNtechFunctions.pas
Datum: 28.10.2018. 22:05:51
Opis: Neke funkcije
Copyright (C) 2018 Dalibor
*******************************************************************************)
unit uNtechFunctions;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
interface
uses
System.SysUtils, System.StrUtils;
type
Version = record
Major, Minor, Release, Build: Cardinal;
end;
//Provera ispravnosti PIB-a
function CheckPIB(PIB: string): Boolean;
//Vraća verziju programa (Major, Minor, Release, Build)
function EXEVersion: Version;
implementation
uses
Winapi.Windows;
{===============================================================================
Procedure: CheckPIB DateTime: 18.11.2018
Arguments: PIB: string
Result: Boolean
Description: // Provera kontrolnog broja PIB-a po ISO 7064, MODUL (11,10).
Pib se sastoji od 9 cifara. Prvih 8 je PIB a poslednj je kontrolni.
Funkcija prihvata PIB u obliku stringa i proverava da li je PIB
prazan, ima manje ili više od 9 cifara i da li je veći ili
jednako 100000001.
Koristimo (i) za for petlju, PozPIB je pozicija cifre PIB-a,
BackUp služi za među memoriju.
-------------------------------------------------------------------------------}
function CheckPIB(PIB: string): Boolean;
var
Zadnji: string;
i, PozPIB, BackUp: Integer;
begin
if PIB = '' then
Exit(False);
if Length(PIB) <> 9 then
Exit(False);
if Leftstr(PIB, 8).ToInteger >= 10000001 then
begin
Zadnji := RightStr(PIB, 1);
PIB := Leftstr(PIB, 8);
BackUp := 10;
for i := 1 to 8 do
begin
PozPIB := StrToInt(Copy(PIB, i, 1));
PozPIB := (PozPIB + BackUp) mod 10;
if PozPIB = 0 then
PozPIB := 10;
PozPIB := (PozPIB * 2) mod 11;
BackUp := PozPIB;
end;
PozPIB := (11 - BackUp) mod 10;
if PozPIB = StrToInt(Zadnji) then
result := True
else
result := False;
end
else
result := False;
end;
{===============================================================================
Procedure: EXEVersion DateTime: 18.11.2018
Arguments: None
Result: Version (Type - Major, Minor, Release, Build)
Description: Vraća verziju programa (Major, Minor, Release, Build)
-------------------------------------------------------------------------------}
function EXEVersion: Version;
var
EXE: string;
Size, Handle: DWORD;
Buffer: TBytes;
FixedPtr: PVSFixedFileInfo;
begin
EXE := ParamStr(0);
Size := GetFileVersionInfoSize(PChar(EXE), Handle);
if Size = 0 then
RaiseLastOSError;
SetLength(Buffer, Size);
if not GetFileVersionInfo(PChar(EXE), Handle, Size, Buffer) then
RaiseLastOSError;
if not VerQueryValue(Buffer, '\', Pointer(FixedPtr), Size) then
RaiseLastOSError;
//Prikaz verzije
result.Major := LongRec(FixedPtr.dwFileVersionMS).Hi; //Major
result.Minor := LongRec(FixedPtr.dwFileVersionMS).Lo; //Minor
result.Release := LongRec(FixedPtr.dwFileVersionLS).Hi; //Release
result.Build := LongRec(FixedPtr.dwFileVersionLS).Lo; //Build
end;
end.

16
src/uPrijem.dfm Normal file
View File

@ -0,0 +1,16 @@
object frmPrijem: TfrmPrijem
Left = 0
Top = 0
Caption = 'Prijem ure'#273'aja na servis'
ClientHeight = 364
ClientWidth = 578
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
end

26
src/uPrijem.pas Normal file
View File

@ -0,0 +1,26 @@
Unit uPrijem;
Interface
Uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.StdCtrls, Vcl.WinXPanels, Vcl.ExtCtrls;
Type
TfrmPrijem = Class(TForm)
Private
{Private declarations}
Public
{Public declarations}
End;
Var
frmPrijem: TfrmPrijem;
Implementation
{$R *.dfm}
End.

22853
src/uSplash.dfm Normal file

File diff suppressed because it is too large Load Diff

186
src/uSplash.pas Normal file
View File

@ -0,0 +1,186 @@
(*******************************************************************************
Projekt: NTech
Unit: uSplash.pas
Datum: 25.12.2017.
Opis: Splash forma inicijalizuje bazu i podešavanja
Copyright (C) 2017 Dalibor Marković
*******************************************************************************
Po pokretanju forme poziva se procedura TfrmSplash.tmrSplashShowTimer koja
prikazije FADE IN efekat forme a iz te procedure pozva se procedura ReadConfig
koja traži fajl NTech.sdb i ako ga nema poziva proceduru CreateDB koja kreira
NTech.sdb bazu.*)
Unit uSplash;
Interface
Uses
winapi.Windows, winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.Imaging.pngimage, Vcl.ExtCtrls, Vcl.StdCtrls, inifiles, FireDAC.Stan.Intf,
FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Stan.Def,
FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.VCLUI.Wait,
Data.DB, FireDAC.Comp.Client, FireDAC.Stan.ExprFuncs, FireDAC.Phys.SQLite,
FireDAC.Phys.SQLiteVDataSet, Vcl.Imaging.jpeg, Vcl.ComCtrls,
FireDAC.Stan.Param, FireDAC.Comp.ScriptCommands, FireDAC.Stan.Util,
FireDAC.Comp.Script, FireDAC.VCLUI.Script, FireDAC.Phys.Intf;
Type
TfrmSplash = Class(TForm)
pnl2: TPanel;
tmrSplashShow: TTimer;
tmrSplashHide: TTimer;
lblVerzija: TLabel;
FDConn: TFDConnection;
lblStatus: TLabel;
FDScript: TFDScript;
pnl1: TPanel;
img1: TImage;
Procedure FormCreate(Sender: TObject);
Procedure tmrSplashShowTimer(Sender: TObject);
Procedure tmrSplashHideTimer(Sender: TObject);
Procedure FDScriptProgress(Sender: TObject);
Private
{Private declarations}
Procedure ReadConfig;
Procedure CreateDB;
Public
{Public declarations}
End;
Var
frmSplash: TfrmSplash;
Implementation
uses
udmConn, uNtechFunctions;
{$R *.dfm}
{==============================================================================}
//Procedura CreateDB: Postavke i kreiranje baze NTech.sdb
{------------------------------------------------------------------------------}
Procedure TfrmSplash.CreateDB;
Var
Lista: TStringList; //SQL DDL lista za kreiranje tabela
I: Integer;
Begin
With FDConn Do
Begin
LoginPrompt := False;
With Params Do
Begin
Clear;
DriverID := 'SQLite';
Database := 'NTech.sdb';
LoginPrompt := False;
End;
Lista := TStringList.Create;
Lista.Clear;
Try
{$I Tabela.inc} //Dodaje SQL DDL listu u objekat Lista
lblStatus.Caption := 'Učitavanje podataka...';
lblStatus.Update;
//Postavljamo ProgressBar na maksimalan broj tabela
FDScript.ValidateAll;
lblStatus.Caption := 'Kreiranje baze... Unos podataka';
lblStatus.Update;
FDScript.ExecuteAll;
lblStatus.Caption := 'Kreiranje baze... Kreiranje tabela';
lblStatus.Update;
For I := 0 To Lista.Count - 1 Do
Begin
ExecSQL(Lista[I]); //Kreiramo tabelu pod indexom I
End;
Finally
Lista.Free; //Oslobađamo objekat Lista - TListString
End;
End;
End;
{==============================================================================}
//Procedura FDScriptProgress: Prikaz ProgressBar-a pri upisu Naselja.sql u bazu
{------------------------------------------------------------------------------}
Procedure TfrmSplash.FDScriptProgress(Sender: TObject);
Begin
End;
{==============================================================================}
//Procedura ReadConfig: Provera da li postoji fajl "NTech.sdb"
{------------------------------------------------------------------------------}
Procedure TfrmSplash.ReadConfig;
Begin
If FileExists('NTech.sdb') Then
Begin
End
Else
//U slučaju da fajl NTech.sdb ne postoji pozivamo proceduru
//CreateDB za kreiranje baze
CreateDB;
End;
{==============================================================================}
//Procedura FormCreate: Postavke vrednosti tajmera tmrSplashShow i
//tmrSplashHide i upis verzije programa u polje lblVerzija
{------------------------------------------------------------------------------}
Procedure TfrmSplash.FormCreate(Sender: TObject);
var
Verzija: string;
Begin
Verzija := 'Verzija: ' + EXEVersion.Major.ToString + '.' +
EXEVersion.Minor.ToString + '.' + EXEVersion.Release.ToString + '.' +
EXEVersion.Build.ToString;
lblVerzija.Caption := Verzija;
End;
{==============================================================================}
//Procedura tmrSplashHideTimer: Pri zatvaranju forme koristi FadeOut efekat
{------------------------------------------------------------------------------}
Procedure TfrmSplash.tmrSplashHideTimer(Sender: TObject);
Begin
If AlphaBlendValue <= 10 Then
Begin
tmrSplashShow.Enabled := False;
AlphaBlendValue := 0;
Self.Close;
End
Else
AlphaBlendValue := AlphaBlendValue - 5;
End;
{==============================================================================}
//Procedura tmrSplashShowTimer: Pri prikazu forme koristi FadeIn efekat
{------------------------------------------------------------------------------}
Procedure TfrmSplash.tmrSplashShowTimer(Sender: TObject);
Begin
If AlphaBlendValue >= 250 Then
Begin
tmrSplashShow.Enabled := False;
AlphaBlendValue := 255;
ReadConfig; //Učitavanje konfiguracije programa (UNIT uConfig)
//tmrSplashHide.Enabled := True;
End
Else
AlphaBlendValue := AlphaBlendValue + 5;
End;
End.

22
src/udmConn.dfm Normal file
View File

@ -0,0 +1,22 @@
object dmConn: TdmConn
OldCreateOrder = False
Height = 358
Width = 395
object Config: TFDConnection
Params.Strings = (
'DriverID=SQLite')
Left = 40
Top = 24
end
object NTech: TFDConnection
Params.Strings = (
'DriverID=SQLite')
Left = 104
Top = 24
end
object fdwtcrsr: TFDGUIxWaitCursor
Provider = 'Forms'
Left = 296
Top = 32
end
end

39
src/udmConn.pas Normal file
View File

@ -0,0 +1,39 @@
(*******************************************************************************
Projekt: NTech
Unit: udmConn
Datum: 18.11.2018. 19:56:19
Opis: Postavke baze Config i NTech
Copyright (C) 2018 Dalibor
******************************************************************************)
unit udmConn;
interface
uses
System.SysUtils, System.Classes, FireDAC.Stan.Intf, FireDAC.Stan.Option,
FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.VCLUI.Wait,
Data.DB, FireDAC.Comp.Client, FireDAC.Comp.UI, FireDAC.Phys.SQLite,
FireDAC.Phys.SQLiteDef, FireDAC.Stan.ExprFuncs;
type
TdmConn = class(TDataModule)
Config: TFDConnection;
NTech: TFDConnection;
fdwtcrsr: TFDGUIxWaitCursor;
private
{Private declarations}
public
{Public declarations}
end;
var
dmConn: TdmConn;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
end.