Skip to content

Commit

Permalink
80% is done
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzSeMzzz committed Jul 5, 2018
0 parents commit 6ec0a84
Show file tree
Hide file tree
Showing 34 changed files with 7,036 additions and 0 deletions.
40 changes: 40 additions & 0 deletions ClientsCrm.dpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
program ClientsCrm;

uses
Vcl.Forms,
UfrLogin in 'UfrLogin.pas' {frLogin},
DataUnit in 'DataUnit.pas' {dm: TDataModule},
EncryptUnit in 'EncryptUnit.pas',
UfrSett in 'UfrSett.pas' {frSett},
MainUnit in 'MainUnit.pas' {frMain},
UserModel in 'UserModel.pas',
UfrManageUsers in 'UfrManageUsers.pas' {frManageUsers},
UfrEditUser in 'UfrEditUser.pas' {frEditUser},
UfrHandbook in 'UfrHandbook.pas' {frHandbook},
UtilsUnit in 'UtilsUnit.pas',
UfrEditTask in 'UfrEditTask.pas' {frEditTask},
TaskUnit in 'TaskUnit.pas',
UfrReportClient in 'UfrReportClient.pas' {frReportClient},
UfrReportClientR in 'UfrReportClientR.pas' {frReportClientR},
UfrClientWorkReport in 'UfrClientWorkReport.pas' {frClientWorkReport},
UfrClientWorkReportR in 'UfrClientWorkReportR.pas' {frClientWorkReportR};

{$R *.res}

begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(Tdm, dm);
Application.CreateForm(TfrLogin, frLogin);
//Application.CreateForm(TfrClientWorkReportR, frClientWorkReportR);
//Application.CreateForm(TfrClientWorkReport, frClientWorkReport);
//Application.CreateForm(TfrReportClientR, frReportClientR);
//Application.CreateForm(TfrReportClient, frReportClient);
//Application.CreateForm(TfrEditTask, frEditTask);
//Application.CreateForm(TfrHandbook, frHandbook);
//Application.CreateForm(TfrEditUser, frEditUser);
//Application.CreateForm(TfrManageUsers, frManageUsers);
//Application.CreateForm(TfrSett, frSett);
//Application.CreateForm(TForm1, Form1);
Application.Run;
end.
615 changes: 615 additions & 0 deletions ClientsCrm.dproj

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions ClientsCrm.dproj.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>1899.12.30 00:00:00.000.072,D:\projects\ClientsCrm\Unit1.pas=D:\projects\ClientsCrm\UfrManageUsers.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.070,=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.901,=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.713,=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.687,D:\projects\ClientsCrm\Unit1.pas=D:\projects\ClientsCrm\UfrHandbook.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.364,=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.960,=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.253,=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.798,=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.642,=C:\Users\admin\Documents\Embarcadero\Studio\Projects\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.432,=D:\projects\ClientsCrm\UserModel.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.610,C:\Users\admin\Documents\Embarcadero\Studio\Projects\Unit1.pas=D:\projects\ClientsCrm\LoginUnit.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.685,=C:\Users\admin\Documents\Embarcadero\Studio\Projects\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.507,D:\projects\ClientsCrm\Unit1.pas=D:\projects\ClientsCrm\MainUnit.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.791,D:\projects\ClientsCrm\Unit1.pas=D:\projects\ClientsCrm\TaskUnit.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.236,D:\projects\ClientsCrm\Unit1.pas=D:\projects\ClientsCrm\UfrEditUser.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.102,D:\projects\ClientsCrm\Unit1.pas=D:\projects\ClientsCrm\UtilsUnit.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.696,D:\projects\ClientsCrm\Unit1.pas=D:\projects\ClientsCrm\UfrEditTask.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.696,D:\projects\ClientsCrm\Unit1.dfm=D:\projects\ClientsCrm\UfrEditTask.dfm</Transaction>
<Transaction>1899.12.30 00:00:00.000.666,=D:\projects\ClientsCrm\DataUnit.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.671,=D:\projects\ClientsCrm\EncryptUnit.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.428,D:\projects\ClientsCrm\LoginUnit.pas=</Transaction>
<Transaction>1899.12.30 00:00:00.000.539,C:\Users\admin\Documents\Embarcadero\Studio\Projects\Project1.dproj=D:\projects\ClientsCrm\ClientsCrm.dproj</Transaction>
<Transaction>1899.12.30 00:00:00.000.250,=D:\projects\ClientsCrm\UfrSett.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.610,C:\Users\admin\Documents\Embarcadero\Studio\Projects\Unit1.dfm=D:\projects\ClientsCrm\LoginUnit.dfm</Transaction>
<Transaction>1899.12.30 00:00:00.000.072,D:\projects\ClientsCrm\Unit1.dfm=D:\projects\ClientsCrm\UfrManageUsers.dfm</Transaction>
<Transaction>1899.12.30 00:00:00.000.507,D:\projects\ClientsCrm\Unit1.dfm=D:\projects\ClientsCrm\MainUnit.dfm</Transaction>
<Transaction>1899.12.30 00:00:00.000.236,D:\projects\ClientsCrm\Unit1.dfm=D:\projects\ClientsCrm\UfrEditUser.dfm</Transaction>
<Transaction>1899.12.30 00:00:00.000.710,=D:\projects\ClientsCrm\UfrLogin.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.687,D:\projects\ClientsCrm\Unit1.dfm=D:\projects\ClientsCrm\UfrHandbook.dfm</Transaction>
<Transaction>2018.07.05 07:47:19.963,=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>2018.07.05 07:48:11.431,D:\projects\ClientsCrm\UfrReportClient.pas=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>2018.07.05 07:48:11.431,D:\projects\ClientsCrm\UfrReportClient.dfm=D:\projects\ClientsCrm\Unit1.dfm</Transaction>
<Transaction>2018.07.05 08:05:35.871,=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>2018.07.05 08:07:00.876,D:\projects\ClientsCrm\UfrReportClientR.pas=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>2018.07.05 08:07:00.876,D:\projects\ClientsCrm\UfrReportClientR.dfm=D:\projects\ClientsCrm\Unit1.dfm</Transaction>
<Transaction>2018.07.05 11:21:22.030,=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>2018.07.05 11:22:31.257,D:\projects\ClientsCrm\UfrClientWorkReport.pas=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>2018.07.05 11:22:31.257,D:\projects\ClientsCrm\UfrClientWorkReport.dfm=D:\projects\ClientsCrm\Unit1.dfm</Transaction>
<Transaction>2018.07.05 12:06:34.803,=D:\projects\ClientsCrm\Unit1.pas</Transaction>
<Transaction>2018.07.05 12:07:25.191,D:\projects\ClientsCrm\UfrClientWorkReportR.dfm=D:\projects\ClientsCrm\Unit1.dfm</Transaction>
<Transaction>2018.07.05 12:07:25.191,D:\projects\ClientsCrm\UfrClientWorkReportR.pas=D:\projects\ClientsCrm\Unit1.pas</Transaction>
</Transactions>
</BorlandProject>
Binary file added ClientsCrm.identcache
Binary file not shown.
Binary file added ClientsCrm.res
Binary file not shown.
10 changes: 10 additions & 0 deletions ClientsCrm.stat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Stats]
EditorSecs=1651
DesignerSecs=256
InspectorSecs=518
CompileSecs=84832
OtherSecs=694
StartTime=28.06.2018 13:46:55
RealKeys=0
EffectiveKeys=0
DebugSecs=319
168 changes: 168 additions & 0 deletions DataUnit.dfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
object dm: Tdm
OldCreateOrder = False
OnCreate = DataModuleCreate
Height = 363
Width = 406
object cn: TMyConnection
Database = 'clientscrm'
Options.Charset = 'cp1251'
Username = 'root'
Server = 'localhost'
LoginPrompt = False
Left = 8
EncryptedPassword = '8DFF90FF90FF8BFF'
end
object usersQ: TMyQuery
Connection = cn
SQL.Strings = (
'select users.*, '
'department.`name` as `dname`'
', user_roles.`name` as `role`'
'from users '
'LEFT JOIN department ON (department.`id`=users.`id_dep`)'
'LEFT JOIN user_roles ON (user_roles.`id`=users.`id_role`)'
'GROUP BY users.id')
Left = 8
Top = 48
end
object usersDS: TDataSource
DataSet = usersQ
Left = 88
Top = 48
end
object departmentsQ: TMyQuery
SQLInsert.Strings = (
'INSERT INTO department'
' (id, name)'
'VALUES'
' (:id, :name)')
SQLDelete.Strings = (
'DELETE FROM department'
'WHERE'
' id = :Old_id')
SQLUpdate.Strings = (
'UPDATE department'
'SET'
' id = :id, name = :name'
'WHERE'
' id = :Old_id')
SQLRefresh.Strings = (
'SELECT id, name FROM department'
'WHERE'
' id = :id')
SQLLock.Strings = (
'SELECT * FROM department'
'WHERE'
' id = :Old_id'
'FOR UPDATE')
SQLRecCount.Strings = (
'SELECT COUNT(*) FROM department')
Connection = cn
SQL.Strings = (
'select * from department order by name asc')
Left = 16
Top = 104
end
object handbookDS: TDataSource
Left = 232
Top = 104
end
object clientsQ: TMyQuery
SQLInsert.Strings = (
'INSERT INTO clients'
' (id, name)'
'VALUES'
' (:id, :name)')
SQLDelete.Strings = (
'DELETE FROM clients'
'WHERE'
' id = :Old_id')
SQLUpdate.Strings = (
'UPDATE clients'
'SET'
' id = :id, name = :name'
'WHERE'
' id = :Old_id')
SQLRefresh.Strings = (
'SELECT id, name FROM clients'
'WHERE'
' id = :id')
SQLLock.Strings = (
'SELECT * FROM clients'
'WHERE'
' id = :Old_id'
'FOR UPDATE')
SQLRecCount.Strings = (
'SELECT COUNT(*) FROM clients')
Connection = cn
SQL.Strings = (
'select * from clients order by name asc')
Left = 88
Top = 104
end
object worksQ: TMyQuery
SQLInsert.Strings = (
'INSERT INTO works'
' (id, name)'
'VALUES'
' (:id, :name)')
SQLDelete.Strings = (
'DELETE FROM works'
'WHERE'
' id = :Old_id')
SQLUpdate.Strings = (
'UPDATE works'
'SET'
' id = :id, name = :name'
'WHERE'
' id = :Old_id')
SQLRefresh.Strings = (
'SELECT id, name FROM works'
'WHERE'
' id = :id')
SQLLock.Strings = (
'SELECT * FROM works'
'WHERE'
' id = :Old_id'
'FOR UPDATE')
SQLRecCount.Strings = (
'SELECT COUNT(*) FROM works')
Connection = cn
SQL.Strings = (
'select * from works order by name asc')
Left = 152
Top = 104
end
object taskQ: TMyQuery
Connection = cn
SQL.Strings = (
'select tasks.*, '
'clients.`name` as `client`,'
'works.`name` as `work`,'
'users.`user_name` as `fio`,'
'department.`name` as `dep`'
'from tasks '
'LEFT JOIN works ON (works.`id`=tasks.`id_work`)'
'LEFT JOIN clients ON (clients.`id`=tasks.`id_client`)'
'LEFT JOIN users ON (users.`id`=tasks.`user_id`)'
'LEFT JOIN department ON (department.`id`=users.`id_dep`)'
'GROUP BY tasks.id')
Left = 8
Top = 176
end
object taskDS: TDataSource
DataSet = taskQ
Left = 56
Top = 176
end
object tasksFilter: TMyQuery
Connection = cn
Left = 112
Top = 176
end
object taskFDS: TDataSource
DataSet = tasksFilter
Left = 168
Top = 176
end
end
93 changes: 93 additions & 0 deletions DataUnit.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
unit DataUnit;

interface

uses
System.SysUtils, System.Classes, Data.DB, MemDS, DBAccess, MyAccess, dialogs,
ShFolder, IniFiles;

function GetMyS:string;

type
Tdm = class(TDataModule)
cn: TMyConnection;
usersQ: TMyQuery;
usersDS: TDataSource;
departmentsQ: TMyQuery;
handbookDS: TDataSource;
clientsQ: TMyQuery;
worksQ: TMyQuery;
taskQ: TMyQuery;
taskDS: TDataSource;
tasksFilter: TMyQuery;
taskFDS: TDataSource;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
pk:TLocateOption;
dstate, dstate_ins:TDATAsetState;
end;

const
taskSql:string=' select tasks.*,' +chr(13)+
'clients.`name` as `client`,' +chr(13)+
'works.`name` as `work`,' +chr(13)+
'users.`user_name` as `fio`,' +chr(13)+
'department.`name` as `dep`'+chr(13)+
'from tasks' +chr(13)+
'LEFT JOIN works ON (works.`id`=tasks.`id_work`)' +chr(13)+
'LEFT JOIN clients ON (clients.`id`=tasks.`id_client`)'+chr(13)+
'LEFT JOIN users ON (users.`id`=tasks.`user_id`)'+chr(13)+
'LEFT JOIN department ON (department.`id`=users.`id_dep`)';
taskSqlGrop:String='GROUP BY tasks.id';

var
dm: Tdm;
ini:TIniFile;

implementation

{%CLASSGROUP 'System.Classes.TPersistent'}

{$R *.dfm}

uses ufrsett;

function GetMyS:string;
var
Buf:array[0..255] of Char;
s:string;
begin
Result:='';
if SHGetFolderPath(0, CSIDL_APPDATA, 0, 0, Buf) = 0 then s:=Buf;
if s[length(s)]<>'\' then s:=s+'\';
result:=s;
end;

procedure Tdm.DataModuleCreate(Sender: TObject);
var fn:string;
begin
cn.Connected:=false;
fn:=getmys+settFolder+'\';
//ShowMessage(fn);
createdir(fn);
ini:=TIniFile.Create(fn+'sett.ini');

cn.Server:=ini.ReadString('connection', 'host', cn.Server);
cn.Username:=ini.ReadString('connection', 'user', cn.Username);
cn.password:=ini.ReadString('connection', 'password', cn.Password);
cn.Database:=ini.ReadString('connection', 'db', cn.Database);
cn.Port:=ini.ReadInteger('connection', 'port', cn.Port);
ini.Free;

//showmessage(cn.Password);

cn.Connected:=false;
pk:=loPartialKey;
dstate:=dsEdit ;
dstate_ins:=dsInsert;
end;

end.
Loading

0 comments on commit 6ec0a84

Please sign in to comment.