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
951448d9
Commit
951448d9
authored
Dec 26, 2024
by
Elias Sarraf
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cam2'
parents
d2ea84ea
afced290
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1580 additions
and
356 deletions
+1580
-356
View.AddOrder.pas
kgOrdersClient/View.AddOrder.pas
+4
-0
View.Orders.dfm
kgOrdersClient/View.Orders.dfm
+121
-109
View.Orders.html
kgOrdersClient/View.Orders.html
+31
-67
View.Orders.pas
kgOrdersClient/View.Orders.pas
+155
-65
View.Search.dfm
kgOrdersClient/View.Search.dfm
+734
-0
View.Search.html
kgOrdersClient/View.Search.html
+10
-0
View.Search.pas
kgOrdersClient/View.Search.pas
+292
-0
app.css
kgOrdersClient/css/app.css
+10
-0
webKGOrders.dpr
kgOrdersClient/webKGOrders.dpr
+2
-1
webKGOrders.dproj
kgOrdersClient/webKGOrders.dproj
+5
-1
Lookup.Service.pas
kgOrdersServer/Source/Lookup.Service.pas
+21
-0
Lookup.ServiceImpl.pas
kgOrdersServer/Source/Lookup.ServiceImpl.pas
+187
-93
uLibrary.pas
kgOrdersServer/Source/uLibrary.pas
+4
-16
kgOrdersServer.ini
kgOrdersServer/kgOrdersServer.ini
+4
-4
No files found.
kgOrdersClient/View.AddOrder.pas
View file @
951448d9
...
...
@@ -43,6 +43,8 @@ type
{ Private declarations }
public
{ Public declarations }
var
confirm
:
boolean
;
end
;
var
...
...
@@ -60,11 +62,13 @@ end;
procedure
TFAddOrder
.
btnConfirmClick
(
Sender
:
TObject
);
begin
confirm
:=
true
;
Close
;
end
;
procedure
TFAddOrder
.
WebFormShow
(
Sender
:
TObject
);
begin
confirm
:=
false
;
getCustomers
();
end
;
...
...
kgOrdersClient/View.Orders.dfm
View file @
951448d9
object FViewOrders: TFViewOrders
Width = 676
Height = 480
Caption = 'edtorderid'
CSSLibrary = cssBootstrap
ElementFont = efCSS
Font.Charset = DEFAULT_CHARSET
...
...
@@ -9,6 +10,7 @@ object FViewOrders: TFViewOrders
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
Visible = True
OnCreate = WebFormCreate
OnShow = WebFormShow
object lblEntries: TWebLabel
...
...
@@ -23,63 +25,16 @@ object FViewOrders: TFViewOrders
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object wcbSortBy: TWebComboBox
Left = 368
Top = 16
Width = 145
Height = 21
ElementID = 'wcbsortby'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 4
TabStop = False
Text = 'PROOF DONE'
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'PROOF DUE'
'PROOF DONE'
'ART DUE'
'ART DONE'
'PLATE DUE'
'PLATE DONE'
'MOUNT DUE'
'MOUNT DONE'
'SHIP DUE'
'SHIP DONE')
end
object btnApply: TWebButton
Left = 542
Top = 16
Width = 96
Height = 25
Caption = 'Apply'
ChildOrder = 7
ElementID = 'btnapply'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 5
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnApplyClick
end
object edtSearch: TWebEdit
Left = 35
Top = 16
Width = 121
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementID = 'edtsearch'
object lblSearch: TWebLabel
Left = 594
Top = 116
Width = 47
Height = 13
Caption = 'Search = '
ElementID = 'lblsearch'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
HideSelection = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object btnAddOrder: TWebButton
...
...
@@ -98,12 +53,12 @@ object FViewOrders: TFViewOrders
WidthPercent = 100.000000000000000000
OnClick = btnAddOrderClick
end
object btn
Filters
: TWebButton
object btn
Search
: TWebButton
Left = 462
Top = 79
Width = 96
Height = 25
Caption = 'S
how Filters
'
Caption = 'S
earch
'
ChildOrder = 6
ElementID = 'btnfilters'
ElementFont = efCSS
...
...
@@ -112,41 +67,7 @@ object FViewOrders: TFViewOrders
TabOrder = 9
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnFiltersClick
end
object dtpStartDate: TWebDateTimePicker
Left = 168
Top = 16
Width = 85
Height = 22
ElementID = 'dtpstartdate'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
Color = clWhite
Date = 45553.505972858790000000
ElementFont = efCSS
Role = ''
TabOrder = 2
TabStop = False
Text = ''
end
object dtpEndDate: TWebDateTimePicker
Left = 266
Top = 16
Width = 87
Height = 22
ElementID = 'dtpenddate'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
Color = clWhite
Date = 45553.505972858790000000
ElementFont = efCSS
Role = ''
TabOrder = 3
TabStop = False
Text = ''
OnClick = btnSearchClick
end
object pnlMessage: TWebPanel
Left = 82
...
...
@@ -160,7 +81,7 @@ object FViewOrders: TFViewOrders
ElementFont = efCSS
ElementPosition = epRelative
Role = 'alert'
TabOrder =
7
TabOrder =
2
object lblMessage: TWebLabel
Left = 32
Top = 11
...
...
@@ -269,6 +190,11 @@ object FViewOrders: TFViewOrders
Title = 'Job Name'
end
item
DataField = 'orderType'
Title = 'Order Type'
end
item
ElementClassName = 'text-nowrap'
DataField = 'orderDate'
Title = 'Order Date'
end
...
...
@@ -289,6 +215,14 @@ object FViewOrders: TFViewOrders
Title = 'Art Done'
end
item
DataField = 'plateDue'
Title = 'Plate Due'
end
item
DataField = 'plateDone'
Title = 'Plate Done'
end
item
DataField = 'mountDue'
Title = 'Mount Due'
end
...
...
@@ -310,25 +244,103 @@ object FViewOrders: TFViewOrders
end
item
DataField = 'qbRefNum'
Title = 'Q
uickbooks Reference Number
'
Title = 'Q
B Ref Num
'
end
item
DataField = 'colors'
Title = 'Colors'
end>
DataSource = wdsOrders
end
object wcbPageSize: TWebComboBox
Left = 22
Top = 52
Width = 145
Height = 21
ElementClassName = 'custom-select'
ElementID = 'wcbpagesize'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Text = '500'
WidthPercent = 100.000000000000000000
OnChange = wcbPageSizeChange
ItemIndex = -1
Items.Strings = (
'100'
'250'
'500'
'1000')
end
object wlcbOrderBy: TWebLookupComboBox
Left = 188
Top = 52
Width = 145
Height = 22
ElementClassName = 'custom-select'
ElementID = 'wlcborderby'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = wlcbOrderByChange
ItemIndex = -1
LookupValues = <
item
Value = 'o.ORDER_ID DESC'
DisplayText = 'ID'
end
item
DataField = 'plateDue
'
Title = 'Plate Du
e'
Value = 'c.NAME ASC
'
DisplayText = 'Company Nam
e'
end
item
DataField = 'plateDone
'
Title = 'Plate Don
e'
Value = 'o.JOB_NAME ASC
'
DisplayText = 'Job Nam
e'
end
item
DataField = 'orderType'
Title = 'Order Type'
Value = 'o.ORDER_DATE DESC'
DisplayText = 'Order Date'
end
item
Value = 'PROOF_DUE DESC'
DisplayText = 'Proof Due'
end
item
Value = 'PROOF_DONE DESC'
DisplayText = 'Proof Done'
end
item
Value = 'ART_DUE DESC'
DisplayText = 'Art Due'
end
item
Value = 'ART_DONE DESC'
DisplayText = 'Art Done'
end
item
Value = 'PLATE_DUE DESC'
DisplayText = 'Plate Due'
end
item
Value = 'PLATE_DONE DESC'
DisplayText = 'Plate Done'
end
item
Value = 'MOUNT_DUE DESC'
DisplayText = 'Mount Due'
end
item
Value = 'MOUNT_DONE DESC'
DisplayText = 'Mount Done'
end
item
Value = 'SHIP_DUE DESC'
DisplayText = 'Ship Due'
end
item
Value = 'SHIP_DONE DESC'
DisplayText = 'Ship Done'
end>
DataSource = wdsOrders
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
...
...
@@ -348,6 +360,9 @@ object FViewOrders: TFViewOrders
object xdwdsOrdersjobName: TStringField
FieldName = 'jobName'
end
object xdwdsOrdersorderType: TStringField
FieldName = 'orderType'
end
object xdwdsOrdersorderDate: TStringField
FieldName = 'orderDate'
end
...
...
@@ -363,6 +378,12 @@ object FViewOrders: TFViewOrders
object xdwdsOrdersartDone: TStringField
FieldName = 'artDone'
end
object xdwdsOrdersplateDue: TStringField
FieldName = 'plateDue'
end
object xdwdsOrdersplateDone: TStringField
FieldName = 'plateDone'
end
object xdwdsOrdersmountDue: TStringField
FieldName = 'mountDue'
end
...
...
@@ -384,15 +405,6 @@ object FViewOrders: TFViewOrders
object xdwdsOrderscolors: TStringField
FieldName = 'colors'
end
object xdwdsOrdersplateDue: TStringField
FieldName = 'plateDue'
end
object xdwdsOrdersplateDone: TStringField
FieldName = 'plateDone'
end
object xdwdsOrdersorderType: TStringField
FieldName = 'orderType'
end
end
object wdsOrders: TWebDataSource
DataSet = xdwdsOrders
...
...
kgOrdersClient/View.Orders.html
View file @
951448d9
<div
class=
"container h-100 d-flex flex-column mt-0"
style=
"max-width:
95%
;"
>
<div
class=
"container h-100 d-flex flex-column mt-0"
style=
"max-width:
100%; padding-bottom: 0
;"
>
<!-- Alert Section -->
<div
class=
"row"
>
<div
class=
"col-sm"
>
...
...
@@ -9,62 +9,45 @@
</div>
</div>
<!-- Filters Section -->
<div
class=
"container mb-3"
>
<!-- Filters Row (Hidden Initially) -->
<div
id=
"filter_info"
style=
"display: none;"
>
<div
class=
"row justify-content-center"
>
<div
class=
"col-auto"
>
<label
for=
"edtsearch"
class=
"fw-bold"
>
Search:
</label>
<input
type=
"text"
id=
"edtsearch"
class=
"form-control"
>
</div>
<div
class=
"col-auto"
>
<label
for=
"dtpstartdate"
class=
"fw-bold"
>
Start Date:
</label>
<input
type=
"date"
id=
"dtpstartdate"
class=
"form-control"
>
</div>
<div
class=
"col-auto"
>
<label
for=
"dtpenddate"
class=
"fw-bold"
>
End Date:
</label>
<input
type=
"date"
id=
"dtpenddate"
class=
"form-control"
>
</div>
<div
class=
"col-auto"
>
<label
for=
"wcbsortby"
class=
"fw-bold"
>
Property Type*
</label>
<select
class=
"form-select"
id=
"wcbsortby"
></select>
</div>
<div
class=
"col-auto d-flex align-items-end"
>
<button
id=
"btnapply"
class=
"btn btn-primary"
>
Apply
</button>
</div>
</div>
<!-- Actions Row -->
<div
class=
"row mt-3 justify-content-center"
>
<div
class=
"col-auto d-flex align-items-center"
>
<label
class=
"mt-3"
style=
"font-weight: 700;"
>
Show
<select
class=
"custom-select"
id=
"wcbpagesize"
style=
"font-size: 1.00rem;"
></select>
entries
</label>
</div>
<!-- Actions Row -->
<div
class=
"row mt-3 justify-content-center"
>
<div
class=
"col-auto"
>
<button
id=
"btnaddorder"
class=
"btn btn-secondary mt-3"
>
Add Order
</button>
</div>
<div
class=
"col-auto"
>
<button
id=
"btnsetstatus"
class=
"btn btn-secondary mt-3"
>
Set Status
</button>
</div>
<div
class=
"col-auto"
>
<button
id=
"btngeneratepdf"
class=
"btn btn-secondary mt-3"
type=
"button"
>
Generate PDF
</button>
<div
class=
"invalid-feedback"
>
No order selected. Please select an order to generate a PDF.
</div>
</div>
<div
class=
"col-auto"
>
<button
id=
"btnfilters"
class=
"btn btn-secondary mt-3"
>
Filters
</button>
<div
class=
"col-auto d-flex align-items-center"
>
<label
class=
"mt-3"
style=
"font-weight: 700;"
>
Order By:
<select
class=
"custom-select"
id=
"wlcborderby"
style=
"font-size: 1.00rem;"
></select></label>
</div>
<div
class=
"col-auto"
>
<button
id=
"btnaddorder"
class=
"btn btn-secondary mt-3"
>
Add Order
</button>
</div>
<div
class=
"col-auto"
>
<button
id=
"btnsetstatus"
class=
"btn btn-secondary mt-3"
>
Set Status
</button>
</div>
<div
class=
"col-auto"
>
<button
id=
"btngeneratepdf"
class=
"btn btn-secondary mt-3"
type=
"button"
>
Generate PDF
</button>
<div
class=
"invalid-feedback"
>
No order selected. Please select an order to generate a PDF.
</div>
</div>
<div
class=
"col-auto"
>
<button
id=
"btnfilters"
class=
"btn btn-secondary mt-3"
>
Filters
</button>
</div>
</div>
<!-- Entries Label Section -->
<div
class=
"d-flex justify-content-between w-100 mt-2"
>
<label
id=
"lblentries"
></label>
<!-- Entries Label Section d-flex justify-content-between w-100 mt-2-->
<div
class=
"row"
>
<div
class=
"col text-start"
>
<label
id=
"lblentries"
></label>
</div>
<div
class=
"col text-end"
>
<label
id=
"lblsearch"
></label>
</div>
</div>
<!-- Table Section -->
<div
id=
"order_table_section"
class=
"overflow-auto mt-2"
style=
"max-height: calc(100vh -
380px); border-bottom: none; padding-bottom: 0
;"
>
<table
id=
"tblPhoneGrid"
class=
"table table-striped table-bordered"
>
style=
"max-height: calc(100vh -
250px); padding-bottom: 0; width: 100%
;"
>
<table
id=
"tblPhoneGrid"
class=
"table table-striped table-bordered"
style=
"width: 100%;"
>
<thead
class=
"sticky-top bg-light"
>
<tr
style=
"font-size: 0.875rem;"
>
<!-- Table headers are dynamically generated -->
...
...
@@ -86,22 +69,3 @@
</div>
</div>
<!-- Confirmation Modal -->
<div
id=
"confirmation_modal"
class=
"modal fade"
tabindex=
"-1"
aria-labelledby=
"confirmation_modal_label"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h5
id=
"confirmation_modal_label"
class=
"modal-title"
>
Select Customer
</h5>
<button
type=
"button"
class=
"btn-close"
data-bs-dismiss=
"modal"
aria-label=
"Close"
></button>
</div>
<div
class=
"modal-body"
>
<select
id=
"wcbcustomer"
class=
"form-control input-sm"
></select>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-secondary"
data-bs-dismiss=
"modal"
>
Cancel
</button>
<button
type=
"button"
class=
"btn btn-primary"
data-bs-dismiss=
"modal"
id=
"btn_confirm_order"
>
Confirm
</button>
</div>
</div>
</div>
</div>
kgOrdersClient/View.Orders.pas
View file @
951448d9
...
...
@@ -13,7 +13,7 @@ uses
WEBLib
.
Forms
,
WEBLib
.
Dialogs
,
WEBLib
.
Menus
,
WEBLib
.
ExtCtrls
,
WEBLib
.
StdCtrls
,
WEBLib
.
JSON
,
Auth
.
Service
,
XData
.
Web
.
Client
,
WebLib
.
Storage
,
ConnectionModule
,
App
.
Types
,
Vcl
.
StdCtrls
,
Vcl
.
Controls
,
WEBLib
.
DBCtrls
,
XData
.
Web
.
JsonDataset
,
WEBLib
.
DB
,
Data
.
DB
,
XData
.
Web
.
Dataset
,
View
.
AddOrder
,
XData
.
Web
.
JsonDataset
,
WEBLib
.
DB
,
Data
.
DB
,
XData
.
Web
.
Dataset
,
WEBLib
.
Grids
;
type
...
...
@@ -21,9 +21,6 @@ type
XDataWebClient1
:
TXDataWebClient
;
xdwdsOrders
:
TXDataWebDataSet
;
lblEntries
:
TWebLabel
;
wcbSortBy
:
TWebComboBox
;
btnApply
:
TWebButton
;
edtSearch
:
TWebEdit
;
wdsOrders
:
TWebDataSource
;
xdwdsOrderscompanyName
:
TStringField
;
xdwdsOrdersjobName
:
TStringField
;
...
...
@@ -41,9 +38,7 @@ type
xdwdsOrdersqbRefNum
:
TStringField
;
xdwdsOrderscolors
:
TStringField
;
btnAddOrder
:
TWebButton
;
btnFilters
:
TWebButton
;
dtpStartDate
:
TWebDateTimePicker
;
dtpEndDate
:
TWebDateTimePicker
;
btnSearch
:
TWebButton
;
xdwdsOrdersplateDue
:
TStringField
;
xdwdsOrdersplateDone
:
TStringField
;
xdwdsOrdersorderType
:
TStringField
;
...
...
@@ -61,15 +56,18 @@ type
wdsSave
:
TWebDataSource
;
xdwdsSaveCURR_ID
:
TIntegerField
;
wdbtcOrders
:
TWebDBTableControl
;
wcbPageSize
:
TWebComboBox
;
wlcbOrderBy
:
TWebLookupComboBox
;
lblSearch
:
TWebLabel
;
procedure
WebFormCreate
(
Sender
:
TObject
);
procedure
btnApplyClick
(
Sender
:
TObject
);
procedure
btnSearchClick
(
Sender
:
TObject
);
procedure
btnAddOrderClick
(
Sender
:
TObject
);
procedure
btn
Filters
Click
(
Sender
:
TObject
);
procedure
btn
Search
Click
(
Sender
:
TObject
);
procedure
btnCloseNotificationClick
(
Sender
:
TObject
);
procedure
WebFormShow
(
Sender
:
TObject
);
procedure
btnConfirmClick
(
Sender
:
TObject
);
procedure
btnPDFClick
(
Sender
:
TObject
);
procedure
wcbPageSizeChange
(
Sender
:
TObject
);
procedure
wlcbOrderByChange
(
Sender
:
TObject
);
private
FChildForm
:
TWebForm
;
procedure
ClearTable
();
...
...
@@ -79,6 +77,7 @@ type
procedure
HideNotification
();
procedure
ShowNotification
(
Notification
:
string
);
procedure
ShowAddOrderForm
();
procedure
ShowSearchForm
();
[
async
]
procedure
Search
(
searchOptions
:
string
);
[
async
]
procedure
GetOrders
(
searchOptions
:
string
);
[
async
]
procedure
getUser
();
...
...
@@ -88,10 +87,24 @@ type
PageNumber
:
integer
;
PageSize
:
integer
;
TotalPages
:
integer
;
StartDate
:
string
;
EndDate
:
string
;
OrderID
:
string
;
CompanyID
:
string
;
JobName
:
string
;
orderType
:
string
;
//Status 1
StartDate1
:
string
;
EndDate1
:
string
;
filterType1
:
string
;
null1
:
boolean
;
//Status 2
StartDate2
:
string
;
EndDate2
:
string
;
filterType2
:
string
;
null2
:
boolean
;
OrderBy
:
string
;
Caller
:
string
;
filters
:
boolean
;
info
:
string
;
public
...
...
@@ -105,7 +118,7 @@ var
implementation
uses
XData
.
Model
.
Classes
,
View
.
Main
;
XData
.
Model
.
Classes
,
View
.
Main
,
View
.
AddOrder
,
View
.
Search
;
{$R *.dfm}
...
...
@@ -137,17 +150,32 @@ begin
DMConnection
.
ApiConnection
.
Connected
:=
True
;
PageNumber
:=
1
;
TotalPages
:=
1
;
// Initial total pages
wcbSortBy
.
Text
:=
'PROOF'
;
//Status 1
startDate1
:=
FormatDateTime
(
'yyyy/mm/dd'
,
0
);
endDate1
:=
FormatDateTime
(
'yyyy/mm/dd'
,
0
);
filterType1
:=
''
;
null1
:=
false
;
//Status 2
startDate2
:=
FormatDateTime
(
'yyyy/mm/dd'
,
0
);
endDate2
:=
FormatDateTime
(
'yyyy/mm/dd'
,
0
);
filterType2
:=
''
;
null2
:=
false
;
orderType
:=
''
;
//today := TDateTime.Today;
dtpStartDate
.
Date
:=
0
;
dtpEndDate
.
Date
:=
0
;
wcbPageSize
.
Text
:=
'500'
;
PageSize
:=
500
;
wlcbOrderBy
.
DisplayText
:=
'Order Date'
;
OrderBy
:=
'o.ORDER_DATE DESC'
;
getOrders
(
GenerateSearchOptions
());
end
;
procedure
TFViewOrders
.
WebFormShow
(
Sender
:
TObject
);
begin
console
.
log
(
info
);
if
info
<>
''
then
ShowNotification
(
info
)
else
...
...
@@ -155,6 +183,12 @@ begin
end
;
procedure
TFViewOrders
.
wlcbOrderByChange
(
Sender
:
TObject
);
begin
OrderBy
:=
wlcbOrderBy
.
Value
;
getOrders
(
generateSearchOptions
());
end
;
procedure
TFViewOrders
.
getUser
();
var
xdcResponse
:
TXDataClientResponse
;
...
...
@@ -195,7 +229,6 @@ begin
newform
.
Caption
:=
'Select Customer and Order Type'
;
newForm
.
Popup
:=
True
;
newForm
.
Border
:=
fbDialog
;
console
.
log
(
newForm
.
GetElementHandle
);
// used to manage Back button handling to close subform
window
.
location
.
hash
:=
'subform'
;
...
...
@@ -203,12 +236,66 @@ begin
newform
.
ShowModal
(
procedure
(
AValue
:
TModalResult
)
begin
if
newform
.
edtID
.
Text
<>
''
then
if
newform
.
confirm
then
orderEntry
(
''
,
newForm
.
edtID
.
Text
,
'ADD'
);
end
);
end
;
procedure
TFViewOrders
.
ShowSearchForm
();
var
newform
:
TFSearch
;
begin
newform
:=
TFSearch
.
CreateNew
;
newform
.
Caption
:=
'Input Search Options'
;
newForm
.
Popup
:=
True
;
newForm
.
Border
:=
fbDialog
;
newForm
.
searchOptions
:=
generateSearchOptions
();
// used to manage Back button handling to close subform
window
.
location
.
hash
:=
'subform'
;
newform
.
ShowModal
(
procedure
(
AValue
:
TModalResult
)
var
searchOptions
:
string
;
begin
if
newform
.
confirm
then
begin
pageNumber
:=
1
;
// Status 1
startDate1
:=
FormatDateTime
(
'yyyy/mm/dd'
,
newform
.
dtpStartDate1
.
Date
);
endDate1
:=
FormatDateTime
(
'yyyy/mm/dd'
,
newform
.
dtpEndDate1
.
Date
);
filterType1
:=
newform
.
wcbFilterType1
.
Text
;
null1
:=
newform
.
cbNull1
.
Checked
;
// Status 2
startDate2
:=
FormatDateTime
(
'yyyy/mm/dd'
,
newform
.
dtpStartDate2
.
Date
);
endDate2
:=
FormatDateTime
(
'yyyy/mm/dd'
,
newform
.
dtpEndDate2
.
Date
);
filterType2
:=
newform
.
wcbFilterType2
.
Text
;
null2
:=
newform
.
cbNull2
.
Checked
;
jobName
:=
newform
.
edtJobName
.
Text
;
orderID
:=
newform
.
edtOrderID
.
Text
;
companyID
:=
newform
.
edtCompanyID
.
Text
;
orderType
:=
newform
.
wcbOrderType
.
Text
;
searchOptions
:=
generateSearchOptions
();
lblSearch
.
Caption
:=
searchOptions
;
getOrders
(
searchOptions
);
end
;
end
);
end
;
procedure
TFViewOrders
.
wcbPageSizeChange
(
Sender
:
TObject
);
begin
PageSize
:=
StrToInt
(
wcbPageSize
.
Text
);
getOrders
(
generateSearchOptions
());
end
;
procedure
TFViewOrders
.
GeneratePagination
(
TotalPages
:
Integer
);
// Generates pagination for the table.
...
...
@@ -413,6 +500,8 @@ procedure TFViewOrders.GetOrders(searchOptions: string);
var
xdcResponse
:
TXDataClientResponse
;
orderList
:
TJSObject
;
orderListLength
:
integer
;
TotalPages
:
integer
;
begin
if
PageNumber
>
0
then
begin
...
...
@@ -428,12 +517,31 @@ begin
xdwdsOrders
.
Open
;
asm
setTimeout
(
endSpinner
,
2000
);
endSpinner
();
end
;
orderListLength
:=
integer
(
orderList
[
'count'
]);
TotalPages
:=
(
(
orderListLength
+
PageSize
-
1
)
div
PageSize
);
if
orderListLength
=
0
then
begin
lblEntries
.
Caption
:=
'No entries found'
;
end
else
if
(
PageNumber
*
PageSize
)
<
orderListLength
then
begin
lblEntries
.
Caption
:=
'Showing entries '
+
IntToStr
((
PageNumber
-
1
)
*
PageSize
+
1
)
+
' - '
+
IntToStr
(
PageNumber
*
PageSize
)
+
' of '
+
IntToStr
(
orderListLength
);
end
else
if
(
PageNumber
*
PageSize
)
>=
orderListLength
then
begin
lblEntries
.
Caption
:=
'Showing entries '
+
IntToStr
((
PageNumber
-
1
)
*
PageSize
+
1
)
+
' - '
+
IntToStr
(
orderListLength
)
+
' of '
+
IntToStr
(
orderListLength
);
end
;
lblEntries
.
Caption
:=
'Total entries: '
+
IntToStr
(
integer
(
orderList
[
'count'
]));
// Optional: Continue using pagination if needed
GeneratePagination
(
(
integer
(
orderList
[
'count'
])
+
PageSize
-
1
)
div
PageSize
);
GeneratePagination
(
TotalPages
);
end
;
end
;
...
...
@@ -449,25 +557,6 @@ begin
FViewMain
.
ViewOrderEntry
(
orderInfo
,
customerInfo
,
mode
);
end
;
procedure
TFViewOrders
.
btnApplyClick
(
Sender
:
TObject
);
// Button that effectively functions as a GetOrders() button
var
searchOptions
:
string
;
begin
PageNumber
:=
1
;
PageSize
:=
50
;
OrderBy
:=
wcbSortBy
.
Text
;
searchOptions
:=
'&pagenumber='
+
IntToStr
(
PageNumber
)
+
'&pagesize='
+
IntToStr
(
PageSize
)
+
'&orderby='
+
OrderBy
+
'&startDate='
+
FormatDateTime
(
'yyyy/mm/dd'
,
dtpStartDate
.
Date
)
+
'&endDate='
+
FormatDateTime
(
'yyyy/mm/dd'
,
dtpEndDate
.
Date
)
+
'&filterType='
+
wcbSortBy
.
Text
;
GetOrders
(
searchOptions
);
end
;
procedure
TFViewOrders
.
btnCloseNotificationClick
(
Sender
:
TObject
);
begin
HideNotification
();
...
...
@@ -480,11 +569,11 @@ begin
end
;
procedure
TFViewOrders
.
btn
Filters
Click
(
Sender
:
TObject
);
procedure
TFViewOrders
.
btn
Search
Click
(
Sender
:
TObject
);
var
filterSection
:
TJSHTMLElement
;
begin
if
btnFilters
.
Caption
=
'Show Filters'
then
{
if btnFilters.Caption = 'Show Filters' then
begin
btnFilters.Caption := 'Hide Filters';
filterSection := TJSHTMLElement(document.getElementById('filter_info'));
...
...
@@ -497,7 +586,8 @@ begin
filterSection := TJSHTMLElement(document.getElementById('filter_info'));
if Assigned(filterSection) then
filterSection.style.setProperty('display', 'none');
end
;
end;}
ShowSearchForm
();
end
;
...
...
@@ -531,14 +621,6 @@ begin
end
;
end
;
procedure
TFViewOrders
.
btnSearchClick
(
Sender
:
TObject
);
// orders Search method
begin
Search
(
edtSearch
.
Text
);
end
;
procedure
TFViewOrders
.
ClearTable
();
// clears the table
var
...
...
@@ -554,19 +636,28 @@ function TFViewOrders.GenerateSearchOptions(): string;
var
searchOptions
:
string
;
begin
//PageNumber := 1;
PageSize
:=
50
;
OrderBy
:=
wcbSortBy
.
Text
;
searchOptions
:=
'&pagenumber='
+
IntToStr
(
PageNumber
)
+
'&pagesize='
+
IntToStr
(
PageSize
)
+
'&orderby='
+
OrderBy
;
if
btnFilters
.
Caption
=
'Hide Filters'
then
begin
searchOptions
:=
searchOptions
+
'&startDate='
+
FormatDateTime
(
'yyyy/mm/dd'
,
dtpStartDate
.
Date
)
+
'&endDate='
+
FormatDateTime
(
'yyyy/mm/dd'
,
dtpEndDate
.
Date
)
+
'&filterType='
+
wcbSortBy
.
Text
;
end
;
'&orderby='
+
OrderBy
+
//Status 1
'&startDate1='
+
startDate1
+
'&endDate1='
+
endDate1
+
'&filterType1='
+
filterType1
+
'&null1='
+
BoolToStr
(
null1
)
+
// Status2
'&startDate2='
+
startDate2
+
'&endDate2='
+
endDate2
+
'&filterType2='
+
filterType2
+
'&null2='
+
BoolToStr
(
null2
)
+
'&orderType='
+
orderType
+
'&jobName='
+
jobName
+
'&companyID='
+
companyID
+
'&orderID='
+
orderID
;
Result
:=
searchOptions
;
end
;
...
...
@@ -582,7 +673,6 @@ procedure TFViewOrders.ShowNotification(Notification: string);
begin
if
Notification
<>
''
then
begin
console
.
log
(
'hit'
);
lblMessage
.
Caption
:=
Notification
;
pnlMessage
.
ElementHandle
.
hidden
:=
False
;
end
;
...
...
kgOrdersClient/View.Search.dfm
0 → 100644
View file @
951448d9
object FSearch: TFSearch
Width = 1016
Height = 683
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Visible = True
OnShow = WebFormShow
object lblStatus1: TWebLabel
Left = 8
Top = 422
Width = 47
Height = 14
Caption = 'Status 1:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblType1: TWebLabel
Left = 8
Top = 442
Width = 29
Height = 14
Caption = 'Type:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblStartDate1: TWebLabel
Left = 200
Top = 442
Width = 56
Height = 14
Caption = 'Start Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblEndDate1: TWebLabel
Left = 384
Top = 442
Width = 47
Height = 14
Caption = 'End Date'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblStatus2: TWebLabel
Left = 8
Top = 496
Width = 47
Height = 14
Caption = 'Status 2:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblType2: TWebLabel
Left = 10
Top = 516
Width = 29
Height = 14
Caption = 'Type:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblStartDate2: TWebLabel
Left = 200
Top = 516
Width = 56
Height = 14
Caption = 'Start Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblEndDate2: TWebLabel
Left = 384
Top = 516
Width = 47
Height = 14
Caption = 'End Date'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel1: TWebLabel
Left = 20
Top = 8
Width = 48
Height = 14
Caption = 'Order ID:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 20
Top = 56
Width = 107
Height = 14
Caption = 'Search Companies:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblCompanyID: TWebLabel
Left = 174
Top = 56
Width = 68
Height = 14
Caption = 'Company ID:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 8
Top = 368
Width = 57
Height = 14
Caption = 'Job Name:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel4: TWebLabel
Left = 174
Top = 368
Width = 64
Height = 14
Caption = 'Order Type:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 92
Top = 637
Width = 121
Height = 33
ElementClassName = 'card'
ElementID = 'pnl_message'
ChildOrder = 5
ElementBodyClassName = 'card-body'
ElementFont = efCSS
ElementPosition = epRelative
Role = 'alert'
TabOrder = 0
object lblMessage: TWebLabel
Left = 26
Top = 11
Width = 44
Height = 14
Caption = 'Message'
ElementID = 'pnl_message'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementClassName = 'btn btn-light'
ElementID = 'view.login.message.button'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
end
end
object wcbFilterType1: TWebComboBox
Left = 8
Top = 462
Width = 145
Height = 22
ElementClassName = 'custom-select'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
TabOrder = 4
TabStop = False
Text = 'PROOF DONE'
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'NONE'
'PROOF DUE'
'PROOF DONE'
'ART DUE'
'ART DONE'
'PLATE DUE'
'PLATE DONE'
'MOUNT DUE'
'MOUNT DONE'
'SHIP DUE'
'SHIP DONE')
end
object btnConfirm: TWebButton
Left = 65
Top = 579
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 5
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object edtOrderID: TWebEdit
Left = 20
Top = 28
Width = 145
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object dtpStartDate1: TWebDateTimePicker
Left = 200
Top = 462
Width = 127
Height = 22
ElementClassName = 'custom-select'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
Color = clWhite
Date = 45553.505972858790000000
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Role = ''
TabOrder = 2
TabStop = False
Text = ''
end
object dtpEndDate1: TWebDateTimePicker
Left = 384
Top = 462
Width = 135
Height = 22
ElementClassName = 'custom-select'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
Color = clWhite
Date = 45553.505972858790000000
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Role = ''
TabOrder = 3
TabStop = False
Text = ''
end
object cbNull1: TWebCheckBox
Left = 566
Top = 462
Width = 185
Height = 22
Caption = 'Only Show Empty'
ChildOrder = 6
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object wcbOrderType: TWebComboBox
Left = 174
Top = 388
Width = 145
Height = 22
ElementClassName = 'custom-select'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'Corrugated'
'Web'
'Any')
end
object wcbFilterType2: TWebComboBox
Left = 10
Top = 536
Width = 145
Height = 22
ElementClassName = 'custom-select'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
TabOrder = 4
TabStop = False
Text = 'PROOF DONE'
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'NONE'
'PROOF DUE'
'PROOF DONE'
'ART DUE'
'ART DONE'
'PLATE DUE'
'PLATE DONE'
'MOUNT DUE'
'MOUNT DONE'
'SHIP DUE'
'SHIP DONE')
end
object dtpStartDate2: TWebDateTimePicker
Left = 200
Top = 536
Width = 127
Height = 22
ElementClassName = 'custom-select'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
Color = clWhite
Date = 45553.505972858790000000
ElementFont = efCSS
Role = ''
TabOrder = 2
TabStop = False
Text = ''
end
object dtpEndDate2: TWebDateTimePicker
Left = 384
Top = 536
Width = 135
Height = 22
ElementClassName = 'custom-select'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
Color = clWhite
Date = 45553.505972858790000000
ElementFont = efCSS
Role = ''
TabOrder = 3
TabStop = False
Text = ''
end
object cbNull2: TWebCheckBox
Left = 566
Top = 536
Width = 185
Height = 22
Caption = 'Only Show Empty'
ChildOrder = 6
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 20
Top = 112
Width = 865
Height = 233
ParentDoubleBuffered = False
DoubleBuffered = True
TabOrder = 12
DefaultRowHeight = 40.000000000000000000
FixedColumns = 0
ColumnCount = 4
Options.Bands.Enabled = True
Options.ColumnSize.Stretch = True
Options.Editing.CalcFormat = '%g'
Options.Grouping.CalcFormat = '%g'
Options.Grouping.GroupCountFormat = '(%d)'
Options.IO.XMLEncoding = 'ISO-8859-1'
Options.Mouse.ClickMargin = 0
Options.Mouse.ColumnSizeMargin = 6
Options.Mouse.RowSizeMargin = 6
Columns = <
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 70.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 250.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 100.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 426.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 90.000000000000000000
end>
DefaultFont.Charset = DEFAULT_CHARSET
DefaultFont.Color = clWindowText
DefaultFont.Height = -11
DefaultFont.Name = 'Segoe UI'
DefaultFont.Style = []
TopRow = 1
Appearance.FixedLayout.Fill.Color = 16380654
Appearance.FixedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FixedLayout.Font.Color = 4539717
Appearance.FixedLayout.Font.Height = -13
Appearance.FixedLayout.Font.Name = 'Segoe UI'
Appearance.FixedLayout.Font.Style = [fsBold]
Appearance.NormalLayout.Fill.Color = 16578806
Appearance.NormalLayout.Font.Charset = DEFAULT_CHARSET
Appearance.NormalLayout.Font.Color = 8026746
Appearance.NormalLayout.Font.Height = -11
Appearance.NormalLayout.Font.Name = 'Segoe UI'
Appearance.NormalLayout.Font.Style = []
Appearance.GroupLayout.Fill.Color = 12817262
Appearance.GroupLayout.Font.Charset = DEFAULT_CHARSET
Appearance.GroupLayout.Font.Color = clBlack
Appearance.GroupLayout.Font.Height = -11
Appearance.GroupLayout.Font.Name = 'Segoe UI'
Appearance.GroupLayout.Font.Style = []
Appearance.SummaryLayout.Fill.Color = 14009785
Appearance.SummaryLayout.Font.Charset = DEFAULT_CHARSET
Appearance.SummaryLayout.Font.Color = clBlack
Appearance.SummaryLayout.Font.Height = -11
Appearance.SummaryLayout.Font.Name = 'Segoe UI'
Appearance.SummaryLayout.Font.Style = []
Appearance.SelectedLayout.Fill.Color = 16441019
Appearance.SelectedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.SelectedLayout.Font.Color = 4539717
Appearance.SelectedLayout.Font.Height = -11
Appearance.SelectedLayout.Font.Name = 'Segoe UI'
Appearance.SelectedLayout.Font.Style = []
Appearance.FocusedLayout.Fill.Color = 16039284
Appearance.FocusedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FocusedLayout.Font.Color = 4539717
Appearance.FocusedLayout.Font.Height = -11
Appearance.FocusedLayout.Font.Name = 'Segoe UI'
Appearance.FocusedLayout.Font.Style = []
Appearance.FixedSelectedLayout.Fill.Color = clLightsteelblue
Appearance.FixedSelectedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FixedSelectedLayout.Font.Color = clBlack
Appearance.FixedSelectedLayout.Font.Height = -11
Appearance.FixedSelectedLayout.Font.Name = 'Segoe UI'
Appearance.FixedSelectedLayout.Font.Style = []
Appearance.BandLayout.Fill.Color = 16711679
Appearance.BandLayout.Font.Charset = DEFAULT_CHARSET
Appearance.BandLayout.Font.Color = 8026746
Appearance.BandLayout.Font.Height = -11
Appearance.BandLayout.Font.Name = 'Segoe UI'
Appearance.BandLayout.Font.Style = []
Appearance.ProgressLayout.Format = '%.0f%%'
LeftCol = 0
ScrollMode = scmItemScrolling
DesignTimeSampleData = True
OnCellClick = TMSFNCGrid1CellClick
end
object edtSearch: TWebEdit
Left = 20
Top = 76
Width = 145
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end
object edtCompanyID: TWebEdit
Left = 174
Top = 76
Width = 145
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtJobName: TWebEdit
Left = 8
Top = 388
Width = 145
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end
object btnCancel: TWebButton
Left = 171
Top = 579
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 5
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object btnClear: TWebButton
Left = 279
Top = 579
Width = 96
Height = 25
Caption = 'Clear'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 5
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnClearClick
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 738
Top = 61
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 608
Top = 63
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object xdwdsCustomersADDRESS: TStringField
FieldName = 'ADDRESS'
Size = 100
end
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 476
Top = 61
end
end
kgOrdersClient/View.Search.html
0 → 100644
View file @
951448d9
<html>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<title>
TMS Web Project
</title>
<style>
</style>
</head>
<body>
</body>
</html>
kgOrdersClient/View.Search.pas
0 → 100644
View file @
951448d9
unit
View
.
Search
;
interface
uses
System
.
SysUtils
,
System
.
Generics
.
Collections
,
System
.
Classes
,
JS
,
Web
,
WEBLib
.
Graphics
,
WEBLib
.
Controls
,
WEBLib
.
Forms
,
WEBLib
.
Dialogs
,
WEBLib
.
Menus
,
WEBLib
.
ExtCtrls
,
WEBLib
.
StdCtrls
,
WEBLib
.
JSON
,
Auth
.
Service
,
XData
.
Web
.
Client
,
WebLib
.
Storage
,
ConnectionModule
,
App
.
Types
,
Vcl
.
StdCtrls
,
Vcl
.
Controls
,
WEBLib
.
DBCtrls
,
Data
.
DB
,
XData
.
Web
.
JsonDataset
,
XData
.
Web
.
Dataset
,
WEBLib
.
DB
,
WEBLib
.
Grids
,
Vcl
.
Grids
,
VCL
.
TMSFNCTypes
,
VCL
.
TMSFNCUtils
,
VCL
.
TMSFNCGraphics
,
VCL
.
TMSFNCGraphicsTypes
,
VCL
.
TMSFNCGridCell
,
VCL
.
TMSFNCGridOptions
,
VCL
.
TMSFNCCustomControl
,
VCL
.
TMSFNCCustomScrollControl
,
VCL
.
TMSFNCGridData
,
VCL
.
TMSFNCCustomGrid
,
VCL
.
TMSFNCGrid
;
type
TFSearch
=
class
(
TWebForm
)
pnlMessage
:
TWebPanel
;
lblMessage
:
TWebLabel
;
btnCloseNotification
:
TWebButton
;
wcbFilterType1
:
TWebComboBox
;
btnConfirm
:
TWebButton
;
edtOrderID
:
TWebEdit
;
dtpStartDate1
:
TWebDateTimePicker
;
dtpEndDate1
:
TWebDateTimePicker
;
cbNull1
:
TWebCheckBox
;
wcbOrderType
:
TWebComboBox
;
lblStatus1
:
TWebLabel
;
lblType1
:
TWebLabel
;
lblStartDate1
:
TWebLabel
;
lblEndDate1
:
TWebLabel
;
wcbFilterType2
:
TWebComboBox
;
dtpStartDate2
:
TWebDateTimePicker
;
dtpEndDate2
:
TWebDateTimePicker
;
cbNull2
:
TWebCheckBox
;
lblStatus2
:
TWebLabel
;
lblType2
:
TWebLabel
;
lblStartDate2
:
TWebLabel
;
lblEndDate2
:
TWebLabel
;
WebLabel1
:
TWebLabel
;
WebLabel2
:
TWebLabel
;
TMSFNCGrid1
:
TTMSFNCGrid
;
edtSearch
:
TWebEdit
;
edtCompanyID
:
TWebEdit
;
lblCompanyID
:
TWebLabel
;
XDataWebClient1
:
TXDataWebClient
;
xdwdsCustomers
:
TXDataWebDataSet
;
xdwdsCustomersID
:
TIntegerField
;
xdwdsCustomersNAME
:
TStringField
;
xdwdsCustomersSHORT_NAME
:
TStringField
;
xdwdsCustomersADDRESS
:
TStringField
;
wdsCustomers
:
TWebDataSource
;
WebLabel3
:
TWebLabel
;
edtJobName
:
TWebEdit
;
WebLabel4
:
TWebLabel
;
btnCancel
:
TWebButton
;
btnClear
:
TWebButton
;
procedure
btnConfirmClick
(
Sender
:
TObject
);
procedure
WebFormShow
(
Sender
:
TObject
);
procedure
btnCancelClick
(
Sender
:
TObject
);
procedure
edtSearchChange
(
Sender
:
TObject
);
procedure
TMSFNCGrid1CellClick
(
Sender
:
TObject
;
ACol
,
ARow
:
Integer
);
procedure
btnClearClick
(
Sender
:
TObject
);
private
//FJSONProc: TJSONProc;
[
async
]
procedure
getCustomers
;
procedure
PopulateGridManually
;
procedure
ApplyFilter
;
var
temp
:
string
;
public
class
function
CreateForm
(
AElementID
:
string
):
TWebForm
;
var
confirm
:
boolean
;
searchOptions
:
string
;
end
;
var
FSearch
:
TFSearch
;
implementation
{$R *.dfm}
class
function
TFSearch
.
CreateForm
(
AElementID
:
string
):
TWebForm
;
begin
Application
.
CreateForm
(
TFSearch
,
AElementID
,
Result
,
procedure
(
AForm
:
TObject
)
begin
with
TFSearch
(
AForm
)
do
begin
end
;
end
);
end
;
procedure
TFSearch
.
edtSearchChange
(
Sender
:
TObject
);
begin
ApplyFilter
;
end
;
procedure
TFSearch
.
WebFormShow
(
Sender
:
TObject
);
var
params
:
TStringList
;
DateFormatSettings
:
TFormatSettings
;
begin
params
:=
TStringList
.
Create
;
params
.
StrictDelimiter
:=
true
;
params
.
Delimiter
:=
'&'
;
params
.
DelimitedText
:=
searchOptions
;
confirm
:=
false
;
DateFormatSettings
:=
TFormatSettings
.
Create
;
DateFormatSettings
.
ShortDateFormat
:=
'yyyy/mm/dd'
;
wcbOrderType
.
Text
:=
UpperCase
(
Copy
(
params
.
Values
[
'orderType'
],
1
,
1
))
+
LowerCase
(
Copy
(
params
.
Values
[
'orderType'
],
2
,
MaxInt
));
edtOrderID
.
Text
:=
params
.
Values
[
'orderID'
];
edtCompanyID
.
Text
:=
params
.
Values
[
'companyID'
];
edtJobName
.
Text
:=
params
.
Values
[
'jobName'
];
// Status 1
if
params
.
Values
[
'filterType1'
]
<>
''
then
wcbFilterType1
.
Text
:=
params
.
Values
[
'filterType1'
]
else
wcbFilterType1
.
Text
:=
'NONE'
;
console
.
log
(
params
.
Values
[
'startDate1'
]);
if
params
.
Values
[
'startDate1'
]
=
''
then
dtpStartDate1
.
Date
:=
0
else
begin
dtpStartDate1
.
Date
:=
StrToDateTime
(
params
.
Values
[
'startDate1'
],
DateFormatSettings
);
end
;
if
params
.
Values
[
'endDate1'
]
=
''
then
dtpEndDate1
.
Date
:=
0
else
dtpEndDate1
.
Date
:=
StrToDateTime
(
params
.
Values
[
'endDate1'
],
DateFormatSettings
);
if
params
.
values
[
'null1'
]
<>
''
then
cbNull1
.
Checked
:=
StrToBool
(
params
.
Values
[
'null1'
]);
// Status 2
if
params
.
Values
[
'filterType2'
]
<>
''
then
wcbFilterType2
.
Text
:=
params
.
Values
[
'filterType2'
]
else
wcbFilterType2
.
Text
:=
'NONE'
;
if
params
.
Values
[
'startDate2'
]
=
'1899/12/30'
then
dtpStartDate2
.
Date
:=
0
else
dtpStartDate2
.
Date
:=
StrToDateTime
(
params
.
Values
[
'startDate2'
],
DateFormatSettings
);
if
params
.
Values
[
'endDate2'
]
=
'1899/12/30'
then
dtpEndDate2
.
Date
:=
0
else
dtpEndDate2
.
Date
:=
StrToDateTime
(
params
.
Values
[
'endDate2'
],
DateFormatSettings
);
if
params
.
values
[
'null2'
]
<>
''
then
cbNull1
.
Checked
:=
StrToBool
(
params
.
Values
[
'null2'
]);
params
.
Free
;
getCustomers
();
end
;
procedure
TFSearch
.
btnCancelClick
(
Sender
:
TObject
);
begin
Close
;
end
;
procedure
TFSearch
.
btnClearClick
(
Sender
:
TObject
);
begin
edtOrderID
.
Text
:=
''
;
edtCompanyID
.
Text
:=
''
;
edtSearch
.
Text
:=
''
;
edtJobName
.
Text
:=
''
;
wcbOrderType
.
Text
:=
'Any'
;
wcbFilterType1
.
Text
:=
'NONE'
;
dtpStartDate1
.
Date
:=
0
;
dtpEndDate1
.
Date
:=
0
;
cbNull1
.
Checked
:=
False
;
wcbFilterType2
.
Text
:=
'NONE'
;
dtpStartDate2
.
Date
:=
0
;
dtpEndDate2
.
Date
:=
0
;
cbNull2
.
Checked
:=
false
;
end
;
procedure
TFSearch
.
btnConfirmClick
(
Sender
:
TObject
);
begin
confirm
:=
true
;
Close
;
end
;
[
async
]
procedure
TFSearch
.
getCustomers
();
var
xdcResponse
:
TXDataClientResponse
;
customerList
:
TJSObject
;
begin
// Fetch data from XData service
xdcResponse
:=
await
(
XDataWebClient1
.
RawInvokeAsync
(
'ILookupService.GetCustomers'
,
[]));
customerList
:=
TJSObject
(
xdcResponse
.
Result
);
// Load data into TXDataWebDataset
xdwdsCustomers
.
Close
;
xdwdsCustomers
.
SetJsonData
(
customerList
[
'data'
]);
xdwdsCustomers
.
Open
;
// Manually populate the grid
PopulateGridManually
;
end
;
procedure
TFSearch
.
TMSFNCGrid1CellClick
(
Sender
:
TObject
;
ACol
,
ARow
:
Integer
);
begin
edtCompanyID
.
Text
:=
TMSFNCGrid1
.
Cells
[
0
,
ARow
];
end
;
procedure
TFSearch
.
PopulateGridManually
;
var
RowIndex
:
Integer
;
begin
TMSFNCGrid1
.
BeginUpdate
;
try
TMSFNCGrid1
.
Clear
;
// Clear any existing data
// Set up column headers
TMSFNCGrid1
.
ColumnCount
:=
4
;
TMSFNCGrid1
.
RowCount
:=
1
;
TMSFNCGrid1
.
Cells
[
0
,
0
]
:=
'ID'
;
TMSFNCGrid1
.
Cells
[
1
,
0
]
:=
'Short Name'
;
TMSFNCGrid1
.
Cells
[
2
,
0
]
:=
'Name'
;
TMSFNCGrid1
.
Cells
[
3
,
0
]
:=
'Address'
;
// TMSFNCGrid1.ColumnWidths[0] := 40;
// TMSFNCGrid1.ColumnWidths[1] := 80;
// TMSFNCGrid1.ColumnWidths[2] := 250;
// Populate the grid with data from the dataset
xdwdsCustomers
.
First
;
RowIndex
:=
1
;
while
not
xdwdsCustomers
.
EOF
do
begin
TMSFNCGrid1
.
RowCount
:=
RowIndex
+
1
;
TMSFNCGrid1
.
Cells
[
0
,
RowIndex
]
:=
xdwdsCustomers
.
FieldByName
(
'ID'
).
AsString
;
TMSFNCGrid1
.
Cells
[
1
,
RowIndex
]
:=
xdwdsCustomers
.
FieldByName
(
'SHORT_NAME'
).
AsString
;
TMSFNCGrid1
.
Cells
[
2
,
RowIndex
]
:=
xdwdsCustomers
.
FieldByName
(
'NAME'
).
AsString
;
TMSFNCGrid1
.
Cells
[
3
,
RowIndex
]
:=
xdwdsCustomers
.
FieldByName
(
'ADDRESS'
).
AsString
;
Inc
(
RowIndex
);
xdwdsCustomers
.
Next
;
end
;
finally
TMSFNCGrid1
.
EndUpdate
;
end
;
end
;
procedure
TFSearch
.
ApplyFilter
;
var
fd
:
TTMSFNCGridFilterData
;
i
:
Integer
;
SearchText
:
string
;
begin
SearchText
:=
Trim
(
edtSearch
.
Text
);
TMSFNCGrid1
.
RemoveFilter
;
TMSFNCGrid1
.
Filter
.
Clear
;
// match on first 3 columns
for
i
:=
0
to
2
do
begin
fd
:=
TMSFNCGrid1
.
Filter
.
Add
;
fd
.
Column
:=
i
;
fd
.
Condition
:=
'*'
+
SearchText
+
'*'
;
// Match text anywhere in the cell
fd
.
CaseSensitive
:=
False
;
// Make the filter case-insensitive
// Use foOR for "match any column" logic
if
i
>
0
then
fd
.
Operation
:=
foOR
else
fd
.
Operation
:=
foNONE
;
// First filter has no logical operation
end
;
// Apply the filters to the grid
TMSFNCGrid1
.
ApplyFilter
;
end
;
end
.
kgOrdersClient/css/app.css
View file @
951448d9
...
...
@@ -14,6 +14,16 @@ input[type="text"] {
padding-left
:
5px
;
}
.input-search
input
{
width
:
100px
;
/* Adjust the width of the input */
height
:
35px
;
/* Set the height to match label height */
padding
:
5px
;
/* Padding for input text */
font-size
:
14px
;
/* Font size for input text */
border
:
1px
solid
#ced4da
;
/* Border style */
border-radius
:
5px
;
/* Rounded corners for the input */
box-sizing
:
border-box
;
/* Ensures padding and border are included in the element's total width and height */
}
.card-header
{
width
:
100%
;
text-align
:
left
;
/* Align text to the left */
...
...
kgOrdersClient/webKGOrders.dpr
View file @
951448d9
...
...
@@ -18,7 +18,8 @@ uses
View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html},
View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html},
View.OrderEntryCorrugated in 'View.OrderEntryCorrugated.pas' {FOrderEntry: TWebForm} {*.html},
View.AddOrder in 'View.AddOrder.pas' {FAddOrder: TWebForm} {*.html};
View.AddOrder in 'View.AddOrder.pas' {FAddOrder: TWebForm} {*.html},
View.Search in 'View.Search.pas' {FSearch: TWebForm} {*.html};
{$R *.res}
...
...
kgOrdersClient/webKGOrders.dproj
View file @
951448d9
...
...
@@ -94,7 +94,6 @@
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
<TMSUseJSDebugger>2</TMSUseJSDebugger>
<TMSWebSingleInstance>1</TMSWebSingleInstance>
<TMSWebBrowser>5</TMSWebBrowser>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
...
...
@@ -176,6 +175,11 @@
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.Search.pas">
<Form>FSearch</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<None Include="index.html"/>
<None Include="css\app.css"/>
<None Include="config\config.json"/>
...
...
kgOrdersServer/Source/Lookup.Service.pas
View file @
951448d9
...
...
@@ -78,6 +78,27 @@ type
end
;
TStatusSearchInfo
=
class
Public
startDate
,
endDate
,
filterType
,
statusType
,
statusSuffix
,
statusTableShort
,
statusTableLong
,
altStatusTableShort
,
altStatusTableLong
:
string
;
null
:
boolean
;
end
;
TSQLQuery
=
class
Public
SQL
,
whereSQL
:
string
;
end
;
TOrderList
=
class
Public
count
:
integer
;
...
...
kgOrdersServer/Source/Lookup.ServiceImpl.pas
View file @
951448d9
...
...
@@ -11,7 +11,7 @@ interface
uses
XData
.
Server
.
Module
,
XData
.
Service
.
Common
,
Api
.
Database
,
Data
.
DB
,
frxClass
,
frxExportPDF
,
Api
.
Database
,
Data
.
DB
,
frxClass
,
frxExportPDF
,
JS
,
Lookup
.
Service
,
System
.
Hash
,
System
.
JSON
,
Winapi
.
Windows
,
Winapi
.
Messages
,
System
.
SysUtils
,
System
.
Variants
,
System
.
Classes
,
Vcl
.
Graphics
,
Vcl
.
Controls
,
Vcl
.
Forms
,
Vcl
.
Dialogs
,
MemDS
,
DBAccess
,
Uni
,
hyiedefs
,
hyieutils
,
iexBitmaps
,
iesettings
,
iexLayers
,
iexRulers
,
...
...
@@ -40,10 +40,15 @@ type
function
AddItem
(
itemInfo
:
string
):
string
;
function
DelUser
(
username
:
string
):
string
;
function
generateSelectSQL
(
filterType
,
startDate
,
endDate
:
string
):
string
;
function
generateSubQuery
(
filterType
,
statusType
,
currStatus
:
string
):
string
;
function
generateSubQuery
(
currStatus
:
string
):
string
;
function
AddCorrugatedOrder
(
orderInfo
:
string
):
TJSONObject
;
function
AddStatusSchedule
(
StatusType
:
string
;
order
:
TJSONObject
;
ORDER_ID
:
integer
):
string
;
function
EditStatusSchedule
(
StatusType
:
string
;
order
:
TJSONObject
;
ORDER_ID
:
string
):
string
;
function
generateOrdersSQL
(
searchOptions
:
string
):
TSQLQuery
;
function
getColorCount
(
colors
:
string
):
string
;
function
generateStatusSelectSQL
(
statusTableShort
,
statusTableLong
,
startDate
,
endDate
,
statusType
:
string
):
string
;
function
generateStatusWhereSQL
(
status
:
TStatusSearchInfo
):
string
;
function
createStatusSearchInfo
(
params
:
TStringList
;
statusNum
:
string
):
TStatusSearchInfo
;
procedure
AfterConstruction
;
override
;
procedure
BeforeDestruction
;
override
;
end
;
...
...
@@ -171,7 +176,16 @@ begin
// Create instance of rptOrders
rptOrders
:=
TrptOrders
.
Create
(
nil
);
try
rptOrders
.
PrepareReport
(
searchOptions
);
// Generate SQL dynamically using the existing GetOrders logic
SQL
:=
GenerateOrdersSQL
(
searchOptions
).
SQL
;
// Prepare the report dataset
rptOrders
.
PrepareReport
(
SQL
);
// Generate the PDF report
rptOrders
.
GeneratePDF
;
// Optionally, log success
Logger
.
log
(
5
,
'PDF Report successfully generated for searchOptions: '
+
searchOptions
);
finally
rptOrders
.
Free
;
...
...
@@ -185,130 +199,210 @@ begin
end
;
function
TLookupService
.
generateSubQuery
(
filterType
,
statusType
,
currStatus
:
string
):
string
;
function
TLookupService
.
generateSubQuery
(
currStatus
:
string
):
string
;
begin
result
:=
'(select oss.STATUS_DATE from orders_status_schedule oss '
+
'where oss.ORDER_ID = o.ORDER_ID and oss.ORDER_STATUS = '
+
quotedStr
(
currStatus
)
+
') AS '
+
currStatus
+
'_DUE,'
;
result
:=
result
+
'(select os.STATUS_TIMESTAMP from orders_status os where os.ORDER_ID = o.ORDER_ID and os.ORDER_STATUS = '
+
quotedStr
(
currStatus
)
+
' order by os.STATUS_TIMESTAMP desc LIMIT 1) AS '
+
currStatus
+
'_DONE, '
;
end
;
function
TLookupService
.
generateStatusSelectSQL
(
statusTableShort
:
string
;
statusTableLong
:
string
;
startDate
:
string
;
endDate
:
string
;
statusType
:
string
):
string
;
begin
result
:=
'exists ( select 1 from '
+
statusTableLong
+
' '
+
statusTableShort
+
' where '
+
statusTableShort
+
'.ORDER_ID = '
+
'o.ORDER_ID AND '
+
statusTableShort
+
'.ORDER_STATUS = '
+
quotedStr
(
statusType
)
+
' AND '
+
quotedStr
(
startDate
)
+
' <= STATUS_DATE'
;
if
endDate
<>
'1899/12/30'
then
begin
result
:=
result
+
' AND '
+
quotedStr
(
endDate
)
+
' >= STATUS_DATE'
;
end
;
result
:=
result
+
' AND STATUS_DATE IS NOT NULL)'
;
end
;
function
TLookupService
.
createStatusSearchInfo
(
params
:
TStringList
;
statusNum
:
string
):
TStatusSearchInfo
;
var
status
Suffix
:
string
;
status
Type
:
string
;
begin
result
:=
''
;
statusSuffix
:=
''
;
if
filterType
<>
''
then
statusSuffix
:=
filterType
.
Split
([
'_'
])[
1
];
if
statusType
<>
currStatus
then
result
:=
TStatusSearchInfo
.
Create
;
result
.
startDate
:=
params
.
Values
[
'startDate'
+
statusNum
];
result
.
endDate
:=
params
.
Values
[
'endDate'
+
statusNum
];
result
.
null
:=
StrToBool
(
params
.
Values
[
'null'
+
statusNum
]);
result
.
statusType
:=
''
;
result
.
filterType
:=
''
;
result
.
statusSuffix
:=
''
;
if
(
(
params
.
Values
[
'filterType'
+
statusNum
]
<>
''
)
and
(
params
.
Values
[
'filterType'
+
statusNum
]
<>
'NONE'
)
)
then
begin
if
(
statusSuffix
=
'DUE'
)
or
(
statusSuffix
=
''
)
then
begin
result
:=
result
+
'(select oss.STATUS_DATE from orders_status_schedule oss '
+
'where oss.ORDER_ID = o.ORDER_ID and oss.ORDER_STATUS = '
+
quotedStr
(
currStatus
)
+
') AS '
+
currStatus
+
'_DUE,'
;
end
else
result
:=
result
+
'(select os.STATUS_TIMESTAMP from orders_status os where os.ORDER_ID = o.ORDER_ID and os.ORDER_STATUS = '
+
quotedStr
(
currStatus
)
+
' order by os.STATUS_TIMESTAMP desc LIMIT 1) AS '
+
currStatus
+
'_DONE, '
;
result
.
statusType
:=
params
.
Values
[
'filterType'
+
statusNum
].
Split
([
' '
])[
0
];
result
.
statusSuffix
:=
params
.
Values
[
'filterType'
+
statusNum
].
Split
([
' '
])[
1
];
result
.
filterType
:=
result
.
statusType
+
'_'
+
result
.
statusSuffix
;
end
;
if
(
statusSuffix
=
'DUE'
)
or
(
statusSuffix
=
''
)
then
// Figure out what table the status belongs to
if
result
.
statusSuffix
=
'DUE'
then
begin
result
:=
result
+
'(select os.STATUS_TIMESTAMP from orders_status os where os.ORDER_ID = o.ORDER_ID and os.ORDER_STATUS = '
+
quotedStr
(
currStatus
)
+
' order by os.STATUS_TIMESTAMP desc LIMIT 1) AS '
+
currStatus
+
'_DONE, '
;
result
.
statusTableShort
:=
'oss'
;
result
.
statusTableLong
:=
'orders_status_schedule'
;
result
.
altStatusTableShort
:=
'os'
;
result
.
altStatusTableLong
:=
'orders_status'
;
end
else
result
:=
result
+
'(select oss.STATUS_DATE from orders_status_schedule oss '
+
'where oss.ORDER_ID = o.ORDER_ID and oss.ORDER_STATUS = '
+
quotedStr
(
currStatus
)
+
') AS '
+
currStatus
+
'_DUE,'
;
begin
result
.
statusTableShort
:=
'os'
;
result
.
statusTableLong
:=
'orders_status'
;
result
.
altStatusTableShort
:=
'oss'
;
result
.
altStatusTableLong
:=
'orders_status_schedule'
;
end
;
end
;
function
TLookupService
.
GetOrders
(
searchOptions
:
string
):
TOrderList
;
function
TLookupService
.
generateStatusWhereSQL
(
status
:
TStatusSearchInfo
):
string
;
begin
result
:=
' AND '
;
if
status
.
null
then
begin
result
:=
result
+
'not exists (select 1 from '
+
status
.
statusTableLong
+
' '
+
status
.
statusTableShort
+
' where '
+
status
.
statusTableShort
+
'.ORDER_ID = o.ORDER_ID '
+
'AND '
+
status
.
statusTableShort
+
'.ORDER_STATUS = '
+
quotedStr
(
status
.
statusType
)
+
') AND '
+
generateStatusSelectSQL
(
status
.
altStatusTableShort
,
status
.
altStatusTableLong
,
status
.
startDate
,
status
.
endDate
,
status
.
statusType
);
end
else
result
:=
result
+
generateStatusSelectSQL
(
status
.
statusTableShort
,
status
.
statusTableLong
,
status
.
startDate
,
status
.
endDate
,
status
.
statusType
);
end
;
function
TLookupService
.
generateOrdersSQL
(
searchOptions
:
string
):
TSQLQuery
;
var
params
:
TStringList
;
params
:
TStringList
;
PageNum
:
integer
;
PageSize
:
integer
;
OrderBy
:
string
;
offset
:
string
;
limit
:
string
;
startDate
:
string
;
endDate
:
string
;
filterType
:
string
;
statusType
:
string
;
statusSuffix
:
string
;
SQL
:
string
;
Order
:
TOrderItem
;
colors
:
string
;
ColorType
:
string
;
whereSQL
:
string
;
fromSQL
:
string
;
statusTableShort
:
string
;
statusTableLong
:
string
;
orderBySQL
:
string
;
OrderID
:
string
;
CompanyID
:
string
;
JobName
:
string
;
orderType
:
string
;
// These variables apply to the first status sent from the client
status1
:
TStatusSearchInfo
;
// These variables apply to the second status sent from the client
status2
:
TStatusSearchInfo
;
begin
logger
.
log
(
4
,
'Get Orders SearchOptions Str: '
+
searchOptions
)
;
result
:=
TSQLQuery
.
Create
;
params
:=
TStringList
.
Create
;
params
.
StrictDelimiter
:=
true
;
// parse the searchOptions
params
.
Delimiter
:=
'&'
;
params
.
DelimitedText
:=
searchOptions
;
orderBySQL
:=
''
;
PageNum
:=
StrToInt
(
params
.
Values
[
'pagenumber'
]);
PageSize
:=
StrToInt
(
params
.
Values
[
'pagesize'
]);
OrderBy
:=
params
.
Values
[
'orderby'
];
startDate
:=
params
.
Values
[
'startDate'
];
endDate
:=
params
.
Values
[
'endDate'
];
statusType
:=
''
;
filterType
:=
''
;
statusSuffix
:=
''
;
if
params
.
Values
[
'filterType'
]
<>
''
then
begin
statusType
:=
params
.
Values
[
'filterType'
].
Split
([
' '
])[
0
];
statusSuffix
:=
params
.
Values
[
'filterType'
].
Split
([
' '
])[
1
];
filterType
:=
params
.
Values
[
'filterType'
].
Split
([
' '
])[
0
]
+
'_'
+
params
.
Values
[
'filterType'
].
Split
([
' '
])[
1
];
end
;
if
statusSuffix
=
'DUE'
then
begin
statusTableShort
:=
'oss'
;
statusTableLong
:=
'orders_status_schedule'
;
end
else
begin
statusTableShort
:=
'os'
;
statusTableLong
:=
'orders_status'
;
end
;
orderType
:=
params
.
Values
[
'orderType'
].
ToLower
();
OrderID
:=
params
.
Values
[
'orderID'
];
companyID
:=
params
.
Values
[
'companyID'
];
jobName
:=
params
.
Values
[
'jobName'
];
// Search infomation for first status type
status1
:=
createStatusSearchInfo
(
params
,
'1'
);
// Search Information for second status type
status2
:=
createStatusSearchInfo
(
params
,
'2'
);
offset
:=
IntToStr
((
PageNum
-
1
)
*
PageSize
);
limit
:=
IntToStr
(
PageSize
);
whereSQL
:=
'WHERE '
;
if
filterType
<>
''
then
begin
SQL
:=
'SELECT o.ORDER_ID, '
+
statusTableShort
+
'.STATUS_DATE AS '
+
filterType
.
ToUpper
+
', o.LOCATION AS Loc, c.NAME AS COMPANY_NAME, o.JOB_NAME, o.ORDER_DATE, o.ORDER_TYPE, '
;
end
else
begin
SQL
:=
'SELECT o.ORDER_ID, o.LOCATION AS Loc, c.NAME AS COMPANY_NAME, o.JOB_NAME, o.ORDER_DATE, o.ORDER_TYPE, '
end
;
SQL
:=
SQL
+
generateSubquery
(
filterType
,
statusType
,
'PROOF'
);
SQL
:=
SQL
+
generateSubquery
(
filterType
,
statusType
,
'ART'
);
SQL
:=
SQL
+
generateSubquery
(
filterType
,
statusType
,
'PLATE'
);
SQL
:=
SQL
+
generateSubquery
(
filterType
,
statusType
,
'MOUNT'
);
SQL
:=
SQL
+
generateSubquery
(
filterType
,
statusType
,
'SHIP'
);
if
filterType
<>
''
then
begin
whereSQL
:=
'FROM orders o join '
+
statusTableLong
+
' '
+
statusTableShort
+
' on '
+
statusTableShort
+
'.ORDER_ID = o.ORDER_ID join '
+
'customers c on c.CUSTOMER_ID = o.COMPANY_ID left join '
+
'qb_sales_orders qb on qb.ORDER_ID = o.ORDER_ID '
+
'WHERE '
+
statusTableShort
+
'.ORDER_ID = o.ORDER_ID AND + '
+
statusTableShort
+
'.ORDER_STATUS = '
+
quotedStr
(
statusType
)
+
' AND '
+
quotedStr
(
startDate
)
+
' <= '
+
statusTableShort
+
'.STATUS_DATE AND '
+
quotedStr
(
endDate
)
+
' >= '
+
statusTableShort
+
'.STATUS_DATE'
;
SQL
:=
SQL
+
'o.PRICE, qb.QB_REF_NUM '
+
whereSQL
+
' ORDER BY '
+
filterType
+
' DESC LIMIT '
+
limit
+
' OFFSET '
+
offset
;
end
SQL
:=
'SELECT o.ORDER_ID, o.LOCATION AS Loc, c.NAME AS COMPANY_NAME, o.JOB_NAME, o.ORDER_DATE, o.ORDER_TYPE, '
;
// Generate the subqueries that get the Status Dates(Due and Done)
SQL
:=
SQL
+
generateSubquery
(
'PROOF'
);
SQL
:=
SQL
+
generateSubquery
(
'ART'
);
SQL
:=
SQL
+
generateSubquery
(
'PLATE'
);
SQL
:=
SQL
+
generateSubquery
(
'MOUNT'
);
SQL
:=
SQL
+
generateSubquery
(
'SHIP'
);
// Generate the Where SQL based on if there is a status filter applied or not
whereSQL
:=
'from orders o join customers c on '
+
'c.CUSTOMER_ID = o.COMPANY_ID left join qb_sales_orders qb on qb.ORDER_ID = o.ORDER_ID where 0 = 0'
;
if
(
(
status1
.
filterType
<>
''
)
and
(
status1
.
filterType
<>
'NONE'
)
)
then
whereSQL
:=
whereSQL
+
generateStatusWhereSQL
(
status1
);
if
(
(
status2
.
filterType
<>
''
)
and
(
status2
.
filterType
<>
'NONE'
)
)
then
whereSQL
:=
whereSQL
+
generateStatusWhereSQL
(
status2
);
if
(
(
orderType
<>
''
)
and
(
orderType
<>
'any'
)
)
then
whereSQL
:=
whereSQL
+
' AND o.ORDER_TYPE = '
+
quotedStr
(
orderType
+
'_plate'
);
if
orderID
<>
''
then
whereSQL
:=
whereSQL
+
' AND o.ORDER_ID = '
+
orderID
;
if
companyID
<>
''
then
whereSQL
:=
whereSQL
+
' AND c.CUSTOMER_ID = '
+
companyID
;
if
jobName
<>
''
then
whereSQL
:=
whereSQL
+
' AND o.JOB_NAME = '
+
quotedStr
(
jobName
);
orderBySQL
:=
'ORDER BY '
+
OrderBy
;
SQL
:=
SQL
+
'o.PRICE, qb.QB_REF_NUM '
+
whereSQL
+
' '
+
orderBySQL
+
' LIMIT '
+
limit
+
' OFFSET '
+
offset
;
// send the SQL and whereSQL back. whereSQL is needed to get the total count.
// probably a way to getthe TotalCount in original SQL but it was giving me issues
result
.
SQL
:=
SQL
;
result
.
whereSQL
:=
whereSQL
;
end
;
function
TLookupService
.
getColorCount
(
colors
:
string
):
string
;
var
colorObject
:
TJSONObject
;
colorList
:
TJSONArray
;
temp
:
string
;
temp2
:
string
;
begin
if
colors
=
''
then
result
:=
'0'
else
begin
whereSQL
:=
'from orders o join customers c on '
+
'c.CUSTOMER_ID = o.COMPANY_ID left join qb_sales_orders qb on qb.ORDER_ID = o.ORDER_ID '
+
'ORDER BY o.ORDER_DATE DESC'
;
SQL
:=
SQL
+
'o.PRICE, qb.QB_REF_NUM '
+
whereSQL
+
' LIMIT '
+
limit
+
' OFFSET '
+
offset
;
colorObject
:=
TJSONObject
.
ParseJSONValue
(
colors
)
as
TJSONObject
;
colorList
:=
TJSONArray
(
colorObject
.
GetValue
(
'items'
));
//temp := colorList.toString
;
result
:=
IntToStr
(
colorList
.
Count
)
;
end
;
logger
.
log
(
4
,
'Get Orders SQL: '
+
SQL
);
end
;
function
TLookupService
.
GetOrders
(
searchOptions
:
string
):
TOrderList
;
var
SQL
:
string
;
whereSQL
:
string
;
Order
:
TOrderItem
;
colors
:
string
;
ColorType
:
string
;
SQLArray
:
TArray
<
string
>;
SQLQuery
:
TSQLQuery
;
begin
SQLQuery
:=
generateOrdersSQL
(
searchOptions
);
SQL
:=
SQLQuery
.
SQL
;
whereSQL
:=
SQLQuery
.
whereSQL
;
doQuery
(
ordersDB
.
UniQuery1
,
SQL
);
Result
:=
TOrderList
.
Create
;
...
...
@@ -335,7 +429,7 @@ begin
order
.
shipDone
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'SHIP_DONE'
).
AsString
;
order
.
price
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'PRICE'
).
AsString
;
order
.
qbRefNum
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'QB_REF_NUM'
).
AsString
;
order
.
orderType
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'ORDER_TYPE'
).
AsString
;
order
.
orderType
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'ORDER_TYPE'
).
AsString
.
Replace
(
'_'
,
' '
)
;
if
ordersDB
.
UniQuery1
.
FieldByName
(
'ORDER_TYPE'
).
AsString
=
'web_plate'
then
begin
...
...
@@ -350,7 +444,7 @@ begin
doQuery
(
ordersDB
.
UniQuery2
,
SQL
);
colors
:=
ordersDB
.
UniQuery2
.
FieldByName
(
ColorType
).
AsString
;
order
.
colors
:=
colors
;
order
.
colors
:=
getColorCount
(
colors
)
;
ordersDB
.
UniQuery1
.
Next
;
end
;
...
...
kgOrdersServer/Source/uLibrary.pas
View file @
951448d9
...
...
@@ -20,25 +20,13 @@ uses
procedure
LoadDatabaseSettings
(
uc
:
TUniConnection
;
iniFilename
:
string
);
var
iniFile
:
TIniFile
;
iniStr
:
string
;
begin
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
iniFilename
);
try
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Server'
,
''
);
if
not
iniStr
.
IsEmpty
then
uc
.
Server
:=
iniStr
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Database'
,
''
);
if
not
iniStr
.
IsEmpty
then
uc
.
Database
:=
iniStr
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Username'
,
''
);
if
not
iniStr
.
IsEmpty
then
uc
.
Username
:=
iniStr
;
iniStr
:=
iniFile
.
ReadString
(
'Database'
,
'Password'
,
''
);
if
not
iniStr
.
IsEmpty
then
uc
.
Password
:=
iniStr
;
uc
.
Server
:=
iniFile
.
ReadString
(
'Database'
,
'Server'
,
uc
.
Server
);
uc
.
Database
:=
iniFile
.
ReadString
(
'Database'
,
'Database'
,
uc
.
Database
);
uc
.
Username
:=
iniFile
.
ReadString
(
'Database'
,
'Username'
,
uc
.
Username
);
uc
.
Password
:=
iniFile
.
ReadString
(
'Database'
,
'Password'
,
uc
.
Password
);
finally
iniFile
.
Free
;
end
;
...
...
kgOrdersServer/kgOrdersServer.ini
View file @
951448d9
[Settings]
MemoLogLevel
=
5
MemoLogLevel
=
4
FileLogLevel
=
5
LogFileNum
=
34
webClientVersion
=
1.0.0
[Database]
--
Server
=
192.168.159.132
Server
=
192.168.60.129
Server
=
192.168.159.132
--
Server
=
192.168.60.129
--Server
=
192.168.75.133
--Database
=
--Username
=
Password
=
emsys!012
--
Password
=
emsys!012
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