Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
KGOrders
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cam Hayes
KGOrders
Commits
15d63c28
Commit
15d63c28
authored
Sep 17, 2024
by
cam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Starting point for filter finished in server
now starting on client end to test if the SQL works properly
parent
738e0705
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
192 additions
and
12 deletions
+192
-12
View.OrderEntry.dfm
kgOrdersClient/View.OrderEntry.dfm
+1
-1
View.OrderEntry.pas
kgOrdersClient/View.OrderEntry.pas
+14
-0
Lookup.ServiceImpl.pas
kgOrdersServer/Source/Lookup.ServiceImpl.pas
+176
-10
kgOrdersServer.ini
kgOrdersServer/kgOrdersServer.ini
+1
-1
No files found.
kgOrdersClient/View.OrderEntry.dfm
View file @
15d63c28
...
@@ -1200,7 +1200,7 @@ object FOrderEntry: TFOrderEntry
...
@@ -1200,7 +1200,7 @@ object FOrderEntry: TFOrderEntry
end
end
object WebDataSource1: TWebDataSource
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
DataSet = XDataWebDataSet1
Left = 2
4
6
Left = 2
1
6
Top = 104
Top = 104
end
end
end
end
kgOrdersClient/View.OrderEntry.pas
View file @
15d63c28
...
@@ -302,6 +302,20 @@ begin
...
@@ -302,6 +302,20 @@ begin
console
.
log
(
color
);
console
.
log
(
color
);
addColorRow
(
String
(
color
[
'#'
]),
string
(
color
[
'Color'
]),
string
(
color
[
'LPI'
]),
string
(
color
[
'Size'
]));
addColorRow
(
String
(
color
[
'#'
]),
string
(
color
[
'Color'
]),
string
(
color
[
'LPI'
]),
string
(
color
[
'Size'
]));
end
;
end
;
if
not
(
XDataWebDataSet1orderDate
.
AsString
=
''
)
then
dtpOrderDate
.
Date
:=
StrToDateTime
(
XDataWebDataSet1orderDate
.
Value
);
if
not
(
XDataWebDataSet1proofDate
.
AsString
=
''
)
then
dtpProofDate
.
Date
:=
StrToDateTime
(
XDataWebDataSet1proofDate
.
Value
);
if
not
(
XDataWebDataSet1shipDate
.
AsString
=
''
)
then
dtpShipDate
.
Date
:=
StrToDateTime
(
XDataWebDataSet1shipDate
.
Value
);
if
not
(
XDataWebDataSet1artDue
.
AsString
=
''
)
then
dtpArtDue
.
Date
:=
StrToDateTime
(
XDataWebDataSet1artDue
.
Value
);
if
not
(
XDataWebDataSet1plateDue
.
AsString
=
''
)
then
dtpPlateDue
.
Date
:=
StrToDateTime
(
XDataWebDataSet1plateDue
.
Value
);
if
not
(
XDataWebDataSet1mountDue
.
AsString
=
''
)
then
dtpMountDue
.
Date
:=
StrToDateTime
(
XDataWebDataSet1mountDue
.
Value
);
if
not
(
XDataWebDataSet1approvedDate
.
AsString
=
''
)
then
dtpApprovedDate
.
Date
:=
StrToDateTime
(
XDataWebDataSet1approvedDate
.
Value
);
end
;
end
;
procedure
TFOrderEntry
.
WebFormShow
(
Sender
:
TObject
);
procedure
TFOrderEntry
.
WebFormShow
(
Sender
:
TObject
);
...
...
kgOrdersServer/Source/Lookup.ServiceImpl.pas
View file @
15d63c28
...
@@ -98,10 +98,14 @@ var
...
@@ -98,10 +98,14 @@ var
OrderBy
:
string
;
OrderBy
:
string
;
offset
:
string
;
offset
:
string
;
limit
:
string
;
limit
:
string
;
startDate
:
string
;
endDate
:
string
;
filterType
:
string
;
SQL
:
string
;
SQL
:
string
;
Order
:
TOrderItem
;
Order
:
TOrderItem
;
colors
:
string
;
colors
:
string
;
ColorType
:
string
;
ColorType
:
string
;
whereSQL
:
string
;
begin
begin
params
:=
TStringList
.
Create
;
params
:=
TStringList
.
Create
;
params
.
StrictDelimiter
:=
true
;
params
.
StrictDelimiter
:=
true
;
...
@@ -115,39 +119,201 @@ begin
...
@@ -115,39 +119,201 @@ begin
offset
:=
IntToStr
((
PageNum
-
1
)
*
PageSize
);
offset
:=
IntToStr
((
PageNum
-
1
)
*
PageSize
);
limit
:=
IntToStr
(
PageSize
);
limit
:=
IntToStr
(
PageSize
);
whereSQL
:=
'WHERE '
;
SQL
:=
'SELECT o.ORDER_ID, o.LOCATION AS Loc, c.NAME AS COMPANY_NAME, o.JOB_NAME, o.ORDER_DATE, o.ORDER_TYPE, '
+
SQL
:=
'SELECT o.ORDER_ID, o.LOCATION AS Loc, c.NAME AS COMPANY_NAME, o.JOB_NAME, o.ORDER_DATE, o.ORDER_TYPE, '
+
'(SELECT oss.STATUS_DATE '
+
'(SELECT oss.STATUS_DATE '
+
' FROM orders_status_schedule oss '
+
' FROM orders_status_schedule oss '
;
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PROOF'') AS PROOF_DUE, '
+
// if proof is chosen as the filter
if
filterType
=
'proof'
then
begin
if
startDate
<>
''
then
begin
whereSQL
:=
'WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PROOF'' AND '
+
quotedStr
(
startDate
)
+
' <= oss.STATUS_DATE'
;
end
;
if
endDate
<>
''
then
begin
if
whereSQL
=
'WHERE '
then
begin
whereSQL
:=
'WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PROOF'' AND '
+
quotedStr
(
endDate
)
+
' >= oss.STATUS_DATE ) '
end
else
begin
whereSQL
:=
whereSQL
+
'AND '
+
quotedStr
(
endDate
)
+
' >= oss.STATUS_DATE ) '
;
end
;
end
else
begin
whereSQL
:=
'WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PROOF'') '
;
end
;
end
else
begin
whereSQL
:=
'WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PROOF'') '
end
;
SQL
:=
SQL
+
whereSQL
+
'AS PROOF_DUE, '
+
'(SELECT os.STATUS_TIMESTAMP '
+
'(SELECT os.STATUS_TIMESTAMP '
+
' FROM orders_status os '
+
' FROM orders_status os '
+
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''PROOF'' '
+
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''PROOF'' '
+
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS PROOF_DONE, '
+
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS PROOF_DONE, '
+
'(SELECT oss.STATUS_DATE '
+
'(SELECT oss.STATUS_DATE '
+
' FROM orders_status_schedule oss '
+
' FROM orders_status_schedule oss '
;
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''ART'') AS ART_DUE, '
+
// if art is chosen as the filter
whereSQL
:=
'WHERE '
;
if
filterType
=
'art'
then
begin
if
startDate
<>
''
then
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''ART'' AND '
+
quotedStr
(
startDate
)
+
' <= oss.STATUS_DATE'
;
end
;
if
endDate
<>
''
then
begin
if
whereSQL
=
'WHERE '
then
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''ART'' AND '
+
quotedStr
(
endDate
)
+
' >= oss.STATUS_DATE ) '
end
else
begin
whereSQL
:=
whereSQL
+
'AND '
+
quotedStr
(
endDate
)
+
' >= oss.STATUS_DATE ) '
;
end
;
end
else
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''ART'') '
;
end
;
end
else
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''ART'') '
end
;
SQL
:=
SQL
+
whereSQL
+
'AS ART_DUE, '
+
'(SELECT os.STATUS_TIMESTAMP '
+
'(SELECT os.STATUS_TIMESTAMP '
+
' FROM orders_status os '
+
' FROM orders_status os '
+
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''ART'' '
+
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''ART'' '
+
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS ART_DONE, '
+
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS ART_DONE, '
+
'(SELECT oss.STATUS_DATE '
+
'(SELECT oss.STATUS_DATE '
+
' FROM orders_status_schedule oss '
+
' FROM orders_status_schedule oss '
;
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PLATE'') AS PLATE_DUE, '
+
// if plate is chosen as the filter
whereSQL
:=
'WHERE '
;
if
filterType
=
'plate'
then
begin
if
startDate
<>
''
then
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PLATE'' AND '
+
quotedStr
(
startDate
)
+
' <= oss.STATUS_DATE'
;
end
;
if
endDate
<>
''
then
begin
if
whereSQL
=
'WHERE '
then
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PLATE'' AND '
+
quotedStr
(
endDate
)
+
' >= oss.STATUS_DATE ) '
end
else
begin
whereSQL
:=
whereSQL
+
'AND '
+
quotedStr
(
endDate
)
+
' >= oss.STATUS_DATE ) '
;
end
;
end
else
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PLATE'') '
;
end
;
end
else
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PLATE'') '
end
;
SQL
:=
SQL
+
whereSQL
+
'AS PLATE_DUE, '
+
'(SELECT os.STATUS_TIMESTAMP '
+
'(SELECT os.STATUS_TIMESTAMP '
+
' FROM orders_status os '
+
' FROM orders_status os '
+
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''PLATE'' '
+
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''PLATE'' '
+
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS PLATE_DONE, '
+
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS PLATE_DONE, '
+
'(SELECT oss.STATUS_DATE '
+
'(SELECT oss.STATUS_DATE '
+
' FROM orders_status_schedule oss '
+
' FROM orders_status_schedule oss '
;
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''MOUNT'') AS MOUNT_DUE, '
+
// if mount is selected as the filter
whereSQL
:=
'WHERE '
;
if
filterType
=
'mount'
then
begin
if
startDate
<>
''
then
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''MOUNT'' AND '
+
quotedStr
(
startDate
)
+
' <= oss.STATUS_DATE'
;
end
;
if
endDate
<>
''
then
begin
if
whereSQL
=
'WHERE '
then
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''MOUNT'' AND '
+
quotedStr
(
endDate
)
+
' >= oss.STATUS_DATE ) '
end
else
begin
whereSQL
:=
whereSQL
+
'AND '
+
quotedStr
(
endDate
)
+
' >= oss.STATUS_DATE ) '
;
end
;
end
else
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''MOUNT'') '
;
end
;
end
else
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''MOUNT'') '
end
;
SQL
:=
SQL
+
whereSQL
+
'AS MOUNT_DUE, '
+
'(SELECT os.STATUS_TIMESTAMP '
+
'(SELECT os.STATUS_TIMESTAMP '
+
' FROM orders_status os '
+
' FROM orders_status os '
+
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''MOUNT'' '
+
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''MOUNT'' '
+
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS MOUNT_DONE, '
+
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS MOUNT_DONE, '
+
'(SELECT oss.STATUS_DATE '
+
'(SELECT oss.STATUS_DATE '
+
' FROM orders_status_schedule oss '
+
' FROM orders_status_schedule oss '
;
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''SHIP'') AS SHIP_DUE, '
+
// if ship is chosen as the filter
whereSQL
:=
'WHERE '
;
if
filterType
=
'mount'
then
begin
if
startDate
<>
''
then
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''SHIP'' AND '
+
quotedStr
(
startDate
)
+
' <= oss.STATUS_DATE'
;
end
;
if
endDate
<>
''
then
begin
if
whereSQL
=
'WHERE '
then
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''SHIP'' AND '
+
quotedStr
(
endDate
)
+
' >= oss.STATUS_DATE ) '
end
else
begin
whereSQL
:=
whereSQL
+
'AND '
+
quotedStr
(
endDate
)
+
' >= oss.STATUS_DATE ) '
;
end
;
end
else
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''SHIP'') '
;
end
;
end
else
begin
whereSQL
:=
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''SHIP'') '
end
;
SQL
:=
SQL
+
whereSQL
+
'AS SHIP_DUE, '
+
'(SELECT os.STATUS_TIMESTAMP '
+
'(SELECT os.STATUS_TIMESTAMP '
+
' FROM orders_status os '
+
' FROM orders_status os '
+
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''SHIP'' '
+
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''SHIP'' '
+
...
...
kgOrdersServer/kgOrdersServer.ini
View file @
15d63c28
[Options]
[Options]
LogFileNum
=
1
09
LogFileNum
=
1
10
UpdateTimerLength
=
0
UpdateTimerLength
=
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment