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
39bcaa4d
Commit
39bcaa4d
authored
Dec 13, 2024
by
Mac Stephens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed table to twebdbtablecontrol, still working on styling
parent
38b88255
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
436 additions
and
317 deletions
+436
-317
View.AddOrder.dfm
kgOrdersClient/View.AddOrder.dfm
+8
-9
View.Orders.dfm
kgOrdersClient/View.Orders.dfm
+132
-24
View.Orders.html
kgOrdersClient/View.Orders.html
+14
-26
View.Orders.pas
kgOrdersClient/View.Orders.pas
+93
-251
config.json
kgOrdersClient/config/config.json
+1
-1
app.css
kgOrdersClient/css/app.css
+14
-0
Lookup.Service.pas
kgOrdersServer/Source/Lookup.Service.pas
+1
-0
Lookup.ServiceImpl.pas
kgOrdersServer/Source/Lookup.ServiceImpl.pas
+35
-1
rOrders.dfm
kgOrdersServer/Source/rOrders.dfm
+64
-0
rOrders.pas
kgOrdersServer/Source/rOrders.pas
+64
-0
kgOrdersServer.dpr
kgOrdersServer/kgOrdersServer.dpr
+2
-1
kgOrdersServer.dproj
kgOrdersServer/kgOrdersServer.dproj
+4
-0
kgOrdersServer.ini
kgOrdersServer/kgOrdersServer.ini
+4
-4
No files found.
kgOrdersClient/View.AddOrder.dfm
View file @
39bcaa4d
...
...
@@ -26,7 +26,6 @@ object FAddOrder: TFAddOrder
Width = 121
Height = 22
HeightPercent = 100.000000000000000000
Text = 'edtSearch'
WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end
...
...
@@ -37,14 +36,14 @@ object FAddOrder: TFAddOrder
Height = 22
ChildOrder = 1
HeightPercent = 100.000000000000000000
Text = 'WebEdit1'
WidthPercent = 100.000000000000000000
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 0
Top = 1
6
6
Top = 1
4
6
Width = 871
Height = 303
Height = 331
Align = alBottom
ParentDoubleBuffered = False
DoubleBuffered = True
TabOrder = 2
...
...
@@ -242,13 +241,13 @@ object FAddOrder: TFAddOrder
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 7
28
Top =
109
Left = 7
30
Top =
93
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 600
Top =
109
Top =
95
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
...
...
@@ -265,7 +264,7 @@ object FAddOrder: TFAddOrder
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 4
70
Top =
109
Left = 4
68
Top =
93
end
end
kgOrdersClient/View.Orders.dfm
View file @
39bcaa4d
...
...
@@ -12,8 +12,8 @@ object FViewOrders: TFViewOrders
OnCreate = WebFormCreate
OnShow = WebFormShow
object lblEntries: TWebLabel
Left =
68
Top =
33
3
Left =
59
Top =
11
3
Width = 77
Height = 13
Caption = 'Showing 0 of ...'
...
...
@@ -207,7 +207,7 @@ object FViewOrders: TFViewOrders
TabStop = False
WidthPercent = 100.000000000000000000
end
object
WebButton2
: TWebButton
object
btnPDF
: TWebButton
Left = 328
Top = 79
Width = 96
...
...
@@ -221,73 +221,181 @@ object FViewOrders: TFViewOrders
TabOrder = 8
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnPDFClick
end
object wdbtcOrders: TWebDBTableControl
Left = 26
Top = 132
Width = 631
Height = 200
ElementClassName = 'table'
ElementId = 'tblPhoneGrid'
BorderColor = clSilver
ChildOrder = 11
ElementFont = efCSS
ElementHeaderClassName = 'thead-light'
ElementPosition = epRelative
ElementTableClassName = 'table table-striped table-hover table-bordered text-sm'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
Footer.ButtonElementClassName = 'btn btn-light'
Footer.DropDownElementClassName = 'form-control'
Footer.InputElementClassName = 'form-control'
Footer.LinkActiveElementClassName = 'link-primary'
Footer.LinkElementClassName = 'link-secondary'
Footer.ListElementClassName = 'pagination'
Footer.ListItemElementClassName = 'page-item'
Footer.ListLinkElementClassName = 'page-link'
Header.ButtonActiveElementClassName = 'btn btn-primary'
Header.ButtonElementClassName = 'btn btn-light'
Header.DropDownElementClassName = 'form-control'
Header.InputElementClassName = 'form-control'
Header.LinkActiveElementClassName = 'link-primary'
Header.LinkElementClassName = 'link-secondary'
Header.ListElementClassName = 'pagination'
Header.ListItemElementClassName = 'page-item'
Header.ListLinkElementClassName = 'page-link'
WordWrap = True
Columns = <
item
DataField = 'ID'
Title = 'ID'
end
item
DataField = 'companyName'
Title = 'Company Name'
end
item
DataField = 'jobName'
Title = 'Job Name'
end
item
DataField = 'orderDate'
Title = 'Order Date'
end
item
DataField = 'proofDue'
Title = 'Proof Due'
end
item
DataField = 'proofDone'
Title = 'Proof Done'
end
item
DataField = 'artDue'
Title = 'Art Due'
end
item
DataField = 'artDone'
Title = 'Art Done'
end
item
DataField = 'mountDue'
Title = 'Mount Due'
end
item
DataField = 'mountDone'
Title = 'Mount Done'
end
item
DataField = 'shipDue'
Title = 'Ship Due'
end
item
DataField = 'shipDone'
Title = 'Ship Done'
end
item
DataField = 'price'
Title = 'Price'
end
item
DataField = 'qbRefNum'
Title = 'Quickbooks Reference Number'
end
item
DataField = 'colors'
Title = 'Colors'
end
item
DataField = 'plateDue'
Title = 'Plate Due'
end
item
DataField = 'plateDone'
Title = 'Plate Done'
end
item
DataField = 'orderType'
Title = 'Order Type'
end>
DataSource = wdsOrders
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 28
Top = 410
end
object
XDataWebDataSet1
: TXDataWebDataSet
object
xdwdsOrders
: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 70
Top = 410
object
XDataWebDataSet1
ID: TStringField
object
xdwdsOrders
ID: TStringField
FieldName = 'ID'
end
object
XDataWebDataSet1
companyName: TStringField
object
xdwdsOrders
companyName: TStringField
FieldName = 'companyName'
end
object
XDataWebDataSet1
jobName: TStringField
object
xdwdsOrders
jobName: TStringField
FieldName = 'jobName'
end
object
XDataWebDataSet1
orderDate: TStringField
object
xdwdsOrders
orderDate: TStringField
FieldName = 'orderDate'
end
object
XDataWebDataSet1
proofDue: TStringField
object
xdwdsOrders
proofDue: TStringField
FieldName = 'proofDue'
end
object
XDataWebDataSet1
proofDone: TStringField
object
xdwdsOrders
proofDone: TStringField
FieldName = 'proofDone'
end
object
XDataWebDataSet1
artDue: TStringField
object
xdwdsOrders
artDue: TStringField
FieldName = 'artDue'
end
object
XDataWebDataSet1
artDone: TStringField
object
xdwdsOrders
artDone: TStringField
FieldName = 'artDone'
end
object
XDataWebDataSet1
mountDue: TStringField
object
xdwdsOrders
mountDue: TStringField
FieldName = 'mountDue'
end
object
XDataWebDataSet1
mountDone: TStringField
object
xdwdsOrders
mountDone: TStringField
FieldName = 'mountDone'
end
object
XDataWebDataSet1
shipDue: TStringField
object
xdwdsOrders
shipDue: TStringField
FieldName = 'shipDue'
end
object
XDataWebDataSet1
shipDone: TStringField
object
xdwdsOrders
shipDone: TStringField
FieldName = 'shipDone'
end
object
XDataWebDataSet1
price: TStringField
object
xdwdsOrders
price: TStringField
FieldName = 'price'
end
object
XDataWebDataSet1
qbRefNum: TStringField
object
xdwdsOrders
qbRefNum: TStringField
FieldName = 'qbRefNum'
end
object
XDataWebDataSet1
colors: TStringField
object
xdwdsOrders
colors: TStringField
FieldName = 'colors'
end
object
XDataWebDataSet1
plateDue: TStringField
object
xdwdsOrders
plateDue: TStringField
FieldName = 'plateDue'
end
object
XDataWebDataSet1
plateDone: TStringField
object
xdwdsOrders
plateDone: TStringField
FieldName = 'plateDone'
end
object
XDataWebDataSet1
orderType: TStringField
object
xdwdsOrders
orderType: TStringField
FieldName = 'orderType'
end
end
object
WebDataSource1
: TWebDataSource
DataSet =
XDataWebDataSet1
object
wdsOrders
: TWebDataSource
DataSet =
xdwdsOrders
Left = 120
Top = 410
end
...
...
kgOrdersClient/View.Orders.html
View file @
39bcaa4d
<div
class=
"container vh-100 d-flex flex-column pb-5"
style=
"max-width: 80%;"
>
<div
class=
"container h-100 d-flex flex-column mt-0"
style=
"max-width: 85%;"
>
<!-- Alert Section -->
<div
class=
"row"
>
<div
class=
"col-sm"
>
...
...
@@ -46,7 +45,10 @@
<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"
>
Generate PDF
</button>
<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>
...
...
@@ -67,34 +69,20 @@
</div>
<!-- Table Section -->
<div
id=
"order_table_section"
class=
"overflow-auto mt-2 flex-grow-1"
>
<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"
>
<thead
style=
"position: sticky; top: 0; z-index: 1; background-color: white; border-bottom: 2px solid #dee2e6;"
>
<tr>
<th>
Order ID
</th>
<th>
Company Name
</th>
<th>
Job Name
</th>
<th>
Order Date
</th>
<th>
Proof Due
</th>
<th>
Proof Date
</th>
<th>
Art Due
</th>
<th>
Art Done
</th>
<th>
Plate Due
</th>
<th>
Plate Done
</th>
<th>
Mount Due
</th>
<th>
Mount Done
</th>
<th>
Ship Due
</th>
<th>
Ship Done
</th>
<th>
Price
</th>
<th>
QuickBooks Ref Number
</th>
<th>
Colors
</th>
<thead
class=
"sticky-top bg-light"
>
<tr
style=
"font-size: 0.875rem;"
>
<!-- Table headers are dynamically generated -->
</tr>
</thead>
<tbody>
<!--
Rows will be dynamically add
ed -->
<tbody
id=
"orderTableBody"
class=
"align-middle"
>
<!--
Table rows are dynamically generat
ed -->
</tbody>
</table>
</div>
</div>
<!-- Pagination Section -->
<div
class=
"container mt-4"
>
...
...
kgOrdersClient/View.Orders.pas
View file @
39bcaa4d
...
...
@@ -2,7 +2,7 @@
// to sort the entries, filter their search, and search for a specific person.
// Authors:
// Cameron Hayes
// Mac
...
// Mac
Stephens
unit
View
.
Orders
;
...
...
@@ -13,44 +13,45 @@ 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
,
View
.
AddOrder
,
WEBLib
.
Grids
;
type
TFViewOrders
=
class
(
TWebForm
)
XDataWebClient1
:
TXDataWebClient
;
XDataWebDataSet1
:
TXDataWebDataSet
;
xdwdsOrders
:
TXDataWebDataSet
;
lblEntries
:
TWebLabel
;
wcbSortBy
:
TWebComboBox
;
btnApply
:
TWebButton
;
edtSearch
:
TWebEdit
;
WebDataSource1
:
TWebDataSource
;
XDataWebDataSet1
companyName
:
TStringField
;
XDataWebDataSet1
jobName
:
TStringField
;
XDataWebDataSet1
orderDate
:
TStringField
;
XDataWebDataSet1
proofDue
:
TStringField
;
XDataWebDataSet1
proofDone
:
TStringField
;
XDataWebDataSet1
artDue
:
TStringField
;
XDataWebDataSet1
artDone
:
TStringField
;
XDataWebDataSet1
mountDue
:
TStringField
;
XDataWebDataSet1
mountDone
:
TStringField
;
XDataWebDataSet1
shipDue
:
TStringField
;
XDataWebDataSet1
shipDone
:
TStringField
;
XDataWebDataSet1
price
:
TStringField
;
XDataWebDataSet1
ID
:
TStringField
;
XDataWebDataSet1
qbRefNum
:
TStringField
;
XDataWebDataSet1
colors
:
TStringField
;
wdsOrders
:
TWebDataSource
;
xdwdsOrders
companyName
:
TStringField
;
xdwdsOrders
jobName
:
TStringField
;
xdwdsOrders
orderDate
:
TStringField
;
xdwdsOrders
proofDue
:
TStringField
;
xdwdsOrders
proofDone
:
TStringField
;
xdwdsOrders
artDue
:
TStringField
;
xdwdsOrders
artDone
:
TStringField
;
xdwdsOrders
mountDue
:
TStringField
;
xdwdsOrders
mountDone
:
TStringField
;
xdwdsOrders
shipDue
:
TStringField
;
xdwdsOrders
shipDone
:
TStringField
;
xdwdsOrders
price
:
TStringField
;
xdwdsOrders
ID
:
TStringField
;
xdwdsOrders
qbRefNum
:
TStringField
;
xdwdsOrders
colors
:
TStringField
;
btnAddOrder
:
TWebButton
;
btnFilters
:
TWebButton
;
dtpStartDate
:
TWebDateTimePicker
;
dtpEndDate
:
TWebDateTimePicker
;
XDataWebDataSet1
plateDue
:
TStringField
;
XDataWebDataSet1
plateDone
:
TStringField
;
XDataWebDataSet1
orderType
:
TStringField
;
xdwdsOrders
plateDue
:
TStringField
;
xdwdsOrders
plateDone
:
TStringField
;
xdwdsOrders
orderType
:
TStringField
;
pnlMessage
:
TWebPanel
;
lblMessage
:
TWebLabel
;
btnCloseNotification
:
TWebButton
;
WebButton1
:
TWebButton
;
WebButton2
:
TWebButton
;
btnPDF
:
TWebButton
;
wdsCustomers
:
TWebDataSource
;
xdwdsCustomers
:
TXDataWebDataSet
;
xdwdsCustomersNAME
:
TStringField
;
...
...
@@ -59,6 +60,7 @@ type
xdwdsSave
:
TXDataWebDataSet
;
wdsSave
:
TWebDataSource
;
xdwdsSaveCURR_ID
:
TIntegerField
;
wdbtcOrders
:
TWebDBTableControl
;
procedure
WebFormCreate
(
Sender
:
TObject
);
procedure
btnApplyClick
(
Sender
:
TObject
);
procedure
btnSearchClick
(
Sender
:
TObject
);
...
...
@@ -67,9 +69,9 @@ type
procedure
btnCloseNotificationClick
(
Sender
:
TObject
);
procedure
WebFormShow
(
Sender
:
TObject
);
procedure
btnConfirmClick
(
Sender
:
TObject
);
procedure
btnPDFClick
(
Sender
:
TObject
);
private
FChildForm
:
TWebForm
;
procedure
AddRowToTable
(
temp
:
string
);
procedure
ClearTable
();
procedure
GeneratePagination
(
TotalPages
:
Integer
);
function
GenerateSearchOptions
():
string
;
...
...
@@ -80,6 +82,7 @@ type
[
async
]
procedure
Search
(
searchOptions
:
string
);
[
async
]
procedure
GetOrders
(
searchOptions
:
string
);
[
async
]
procedure
getUser
();
procedure
GeneratePDF
(
OrderID
:
string
);
var
PageNumber
:
integer
;
PageSize
:
integer
;
...
...
@@ -105,6 +108,38 @@ uses
{$R *.dfm}
procedure
TFViewOrders
.
btnPDFClick
(
Sender
:
TObject
);
var
SelectedOrderID
:
string
;
PDFButton
:
TJSHTMLElement
;
begin
PDFButton
:=
TJSHTMLElement
(
document
.
getElementById
(
'btngeneratepdf'
));
// Check if an order is selected
if
not
xdwdsOrders
.
IsEmpty
then
begin
SelectedOrderID
:=
xdwdsOrdersID
.
Value
;
if
SelectedOrderID
<>
''
then
begin
GeneratePDF
(
SelectedOrderID
);
// Remove invalid state if it exists
PDFButton
.
classList
.
remove
(
'is-invalid'
);
end
else
begin
// Add the 'is-invalid' class to trigger Bootstrap validation styling
PDFButton
.
classList
.
add
(
'is-invalid'
);
end
;
end
else
begin
// Add the 'is-invalid' class to trigger Bootstrap validation styling
PDFButton
.
classList
.
add
(
'is-invalid'
);
end
;
end
;
procedure
TFViewOrders
.
WebFormCreate
(
Sender
:
TObject
);
// Initializes important values:
// PageNumber: What page number the user is on IE 1: 1-10, 2: 11-20 etc
...
...
@@ -186,191 +221,7 @@ begin
end
;
procedure
TFViewOrders
.
AddRowToTable
(
temp
:
string
);
// Adds rows to the table
// PhoneNumber: phone number of the location
// Caller: phone number of the caller
// Duration: duration of the call
// Transcript: transcription of the recording
// MediaUrl: Link to the recording
var
NewRow
,
Cell
,
P
,
Button
,
Audio
:
TJSHTMLElement
;
colorObject
:
TJSObject
;
colorList
:
TJSArray
;
colorListJSON
:
TJSONArray
;
colors
:
integer
;
ClickHandler
:
TJSFunction
;
id
,
strColorList
:
string
;
begin
NewRow
:=
TJSHTMLElement
(
document
.
createElement
(
'tr'
));
NewRow
.
Attrs
[
'orderType'
]
:=
XDataWebDataSet1orderType
.
Value
;
NewRow
.
addEventListener
(
'click'
,
procedure
begin
orderEntry
(
NewRow
.
Attrs
[
'id'
],
''
,
'EDIT'
);
end
);
// Order ID Cell
NewRow
.
Attrs
[
'id'
]
:=
XDataWebDataSet1ID
.
Value
;
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Order ID'
);
if
XDataWebDataSet1ID
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1ID
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Company Name Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Company Name'
);
if
XDataWebDataSet1companyName
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1companyName
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Job Name Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Job Name'
);
if
XDataWebDataSet1jobName
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1jobName
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Order Date Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Order Date'
);
if
XDataWebDataSet1orderDate
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1orderDate
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Proof Due Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Proof Due'
);
if
XDataWebDataSet1proofDue
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1proofDue
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Proof Done Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Proof Done'
);
if
XDataWebDataSet1proofDone
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1proofDone
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Art Due Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Art Due'
);
if
XDataWebDataSet1artDue
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1artDue
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Art Done Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Art Done'
);
if
XDataWebDataSet1artDone
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1artDone
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Plate Due Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Plate Due'
);
if
XDataWebDataSet1plateDue
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1plateDue
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Plate Done Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Plate Done'
);
if
XDataWebDataSet1plateDone
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1plateDone
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Mount Due Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Mount Due'
);
if
XDataWebDataSet1mountDue
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1mountDue
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Mount Done Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Mount Done'
);
if
XDataWebDataSet1mountDone
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1mountDone
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Ship Due Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Ship Due'
);
if
XDataWebDataSet1shipDue
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1shipDue
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Ship Done Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Ship Done'
);
if
XDataWebDataSet1shipDone
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1shipDone
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Price Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Price'
);
if
XDataWebDataSet1price
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1price
.
Value
;
NewRow
.
appendChild
(
Cell
);
// QuickBooks Reference Number Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Quickbooks Reference Number'
);
if
XDataWebDataSet1qbRefNum
.
Value
=
''
then
Cell
.
innerText
:=
'None'
else
Cell
.
innerText
:=
XDataWebDataSet1qbRefNum
.
Value
;
NewRow
.
appendChild
(
Cell
);
// Colors Cell
Cell
:=
TJSHTMLElement
(
document
.
createElement
(
'td'
));
Cell
.
setAttribute
(
'data-label'
,
'Colors'
);
if
XDataWebDataSet1colors
.
Value
=
''
then
Cell
.
innerText
:=
'0'
else
begin
colorObject
:=
TJSObject
(
TJSJSON
.
parse
(
XDataWebDataSet1colors
.
Value
));
colorList
:=
TJSArray
(
colorObject
[
'items'
]);
colors
:=
colorList
.
flength
;
Cell
.
innerText
:=
IntToStr
(
colors
);
end
;
NewRow
.
appendChild
(
Cell
);
// Appends new rows to the table body
TJSHTMLElement
(
document
.
getElementById
(
'tblPhoneGrid'
).
getElementsByTagName
(
'tbody'
)[
0
]).
appendChild
(
NewRow
);
end
;
procedure
TFViewOrders
.
GeneratePagination
(
TotalPages
:
Integer
);
// Generates pagination for the table.
...
...
@@ -572,63 +423,34 @@ end;
procedure
TFViewOrders
.
GetOrders
(
searchOptions
:
string
);
// Retrieves list of orders from the server that meet the criteria searchOptions
// searchOptions: information about how to generate the SQL statement based on
// user input.
var
xdcResponse
:
TXDataClientResponse
;
orderList
:
TJSObject
;
i
:
integer
;
data
:
TJSArray
;
order
:
TJSObject
;
callListLength
:
integer
;
tempString
:
string
;
orderList
:
TJSObject
;
begin
if
PageNumber
>
0
then
begin
asm
startSpinner
();
end
;
xdcResponse
:=
await
(
XDataWebClient1
.
RawInvokeAsync
(
'ILookupService.GetOrders'
,
[
searchOptions
]));
orderList
:=
TJSObject
(
xdcResponse
.
Result
);
data
:=
TJSArray
(
orderList
[
'data'
]);
callListLength
:=
integer
(
orderList
[
'count'
]);
ClearTable
();
XDataWebDataSet1
.
Close
;
XDataWebDataSet1
.
SetJsonData
(
orderList
[
'data'
]);
XDataWebDataSet1
.
Open
;
xdcResponse
:=
await
(
XDataWebClient1
.
RawInvokeAsync
(
'ILookupService.GetOrders'
,
[
searchOptions
]));
orderList
:=
TJSObject
(
xdcResponse
.
Result
);
// Load data into the dataset
xdwdsOrders
.
Close
;
xdwdsOrders
.
SetJsonData
(
orderList
[
'data'
]);
xdwdsOrders
.
Open
;
asm
setTimeout
(
endSpinner
,
2000
);
end
;
for
i
:=
0
to
data
.
Length
-
1
do
begin
order
:=
TJSObject
(
data
[
i
]);
AddRowToTable
(
tempString
);
XDataWebDataSet1
.
Next
;
end
;
TotalPages
:=
(
callListLength
+
PageSize
-
1
)
div
PageSize
;
if
callListLength
=
0
then
begin
lblEntries
.
Caption
:=
'No entries found'
;
end
else
if
(
PageNumber
*
PageSize
)
<
callListLength
then
begin
lblEntries
.
Caption
:=
'Showing entries '
+
IntToStr
((
PageNumber
-
1
)
*
PageSize
+
1
)
+
' - '
+
IntToStr
(
PageNumber
*
PageSize
)
+
' of '
+
IntToStr
(
callListLength
);
end
else
if
(
PageNumber
*
PageSize
)
>=
callListLength
then
begin
lblEntries
.
Caption
:=
'Showing entries '
+
IntToStr
((
PageNumber
-
1
)
*
PageSize
+
1
)
+
' - '
+
IntToStr
(
callListLength
)
+
' of '
+
IntToStr
(
callListLength
);
end
;
GeneratePagination
(
TotalPages
);
lblEntries
.
Caption
:=
'Total entries: '
+
IntToStr
(
integer
(
orderList
[
'count'
]));
// Optional: Continue using pagination if needed
GeneratePagination
((
integer
(
orderList
[
'count'
])
+
PageSize
-
1
)
div
PageSize
);
end
;
end
;
procedure
TFViewOrders
.
btnAddOrderClick
(
Sender
:
TObject
);
begin
ShowOrderListForm
();
...
...
@@ -769,4 +591,24 @@ begin
end
;
procedure
TFViewOrders
.
GeneratePDF
(
OrderID
:
string
);
var
XDCResponse
:
TXDataClientResponse
;
PDFBase64
:
string
;
PDFBlob
:
TJSUint8Array
;
PDFLink
:
TJSHTMLElement
;
begin
// XDCResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderPDF', [OrderID]));
// PDFBase64 := string(XDCResponse.Result);
//
// // Convert Base64 to binary and create a link to download it
// PDFBlob := TJSUint8Array.new(TJSBase64.decodeBase64(PDFBase64));
// PDFLink := TJSHTMLElement(document.createElement('a'));
// PDFLink.setAttribute('href', 'data:application/pdf;base64,' + PDFBase64);
// PDFLink.setAttribute('download', 'Order_' + OrderID + '.pdf');
// PDFLink.click;
end
;
end
.
kgOrdersClient/config/config.json
View file @
39bcaa4d
{
"AuthUrl"
:
"http://localhost:2004/emsys/kgOrders/auth/"
,
"ApiUrl"
:
"http://localhost:2004/emsys/kgOrders/api/"
,
"ApiUrl"
:
"http://localhost:2004/emsys/kgOrders/api/"
}
kgOrdersClient/css/app.css
View file @
39bcaa4d
...
...
@@ -279,6 +279,20 @@ input[type="text"] {
color
:
#fff
!important
;
}
.card
{
border
:
none
!important
;
box-shadow
:
none
!important
;
/* If shadow is causing the issue */
}
.color-column
{
width
:
200px
;
/* Fixed width for the column */
overflow
:
hidden
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
/* Adds ellipsis */
}
.grid-container
{
position
:
relative
;
/* Ensure the container is the reference for child positioning */
...
...
kgOrdersServer/Source/Lookup.Service.pas
View file @
39bcaa4d
...
...
@@ -216,6 +216,7 @@ type
function
EditUser
(
const
editOptions
:
string
):
string
;
function
AddCorrugatedOrder
(
orderInfo
:
string
):
TJSONObject
;
function
AddStatusSchedule
(
StatusType
:
string
;
order
:
TJSONObject
;
ORDER_ID
:
integer
):
string
;
function
GenerateOrderPDF
(
OrderID
:
string
):
string
;
end
;
implementation
...
...
kgOrdersServer/Source/Lookup.ServiceImpl.pas
View file @
39bcaa4d
...
...
@@ -11,7 +11,7 @@ interface
uses
XData
.
Server
.
Module
,
XData
.
Service
.
Common
,
KGOrders
.
Database
,
Data
.
DB
,
KGOrders
.
Database
,
Data
.
DB
,
rOrders
,
frxClass
,
frxExportPDF
,
Lookup
.
Service
,
System
.
Hash
,
System
.
Classes
,
System
.
JSON
;
...
...
@@ -39,6 +39,7 @@ type
function
EditStatusSchedule
(
StatusType
:
string
;
order
:
TJSONObject
;
ORDER_ID
:
string
):
string
;
procedure
AfterConstruction
;
override
;
procedure
BeforeDestruction
;
override
;
function
GenerateOrderPDF
(
OrderID
:
string
):
string
;
end
;
implementation
...
...
@@ -988,6 +989,39 @@ begin
end
;
end
;
function
TLookupService
.
GenerateOrderPDF
(
OrderID
:
string
):
string
;
var
ReportFileName
:
string
;
Stream
:
TMemoryStream
;
Base64PDF
:
string
;
begin
// try
// // Create an instance of the rptOrders DataModule
// rptOrders := TrptOrders.Create(nil);
// Stream := TMemoryStream.Create;
//
// // Prepare the report using the rptOrders DataModule
// rptOrders.PrepareReport(OrderID);
//
// // Export the report to a PDF file in memory
// rptOrders.frxReport.Export(rptOrders.frxReport.FindComponent('frxPDFExport') as TfrxPDFExport, Stream);
//
// // Optionally save PDF to a file (optional)
// ReportFileName := TPath.Combine('C:\Reports\', 'Order_' + OrderID + '.pdf');
// Stream.SaveToFile(ReportFileName);
//
// // Convert to Base64 if you want to send it back as a string
// Stream.Position := 0;
// Base64PDF := TNetEncoding.Base64.EncodeBytesToString(Stream.Memory, Stream.Size);
// Result := Base64PDF;
// finally
// rptOrders.Free;
// Stream.Free;
// end;
end
;
initialization
RegisterServiceType
(
TLookupService
);
...
...
kgOrdersServer/Source/rOrders.dfm
0 → 100644
View file @
39bcaa4d
object rptOrders: TrptOrders
Left = 0
Top = 0
Caption = 'rptOrders'
ClientHeight = 441
ClientWidth = 624
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
TextHeight = 15
object frxReport1: TfrxReport
Version = '2024.2.1'
DotMatrixReport = False
IniFile = '\Software\Fast Reports'
PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick, pbCopy, pbSelection]
PreviewOptions.Zoom = 1.000000000000000000
PrintOptions.Printer = 'Default'
PrintOptions.PrintOnSheet = 0
ReportOptions.CreateDate = 45639.622835810190000000
ReportOptions.LastChange = 45639.622835810190000000
ScriptLanguage = 'PascalScript'
ScriptText.Strings = (
'begin'
''
'end.')
Left = 282
Top = 158
Datasets = <>
Variables = <>
Style = <>
end
object frxPDFExport1: TfrxPDFExport
UseFileCache = True
ShowProgress = True
OverwritePrompt = False
DataOnly = False
EmbedFontsIfProtected = False
InteractiveFormsFontSubset = 'A-Z,a-z,0-9,#43-#47 '
OpenAfterExport = False
PrintOptimized = False
Outline = False
Background = False
HTMLTags = True
Quality = 95
Author = 'FastReport'
Subject = 'FastReport PDF export'
Creator = 'FastReport'
ProtectionFlags = [ePrint, eModify, eCopy, eAnnot]
HideToolbar = False
HideMenubar = False
HideWindowUI = False
FitWindow = False
CenterWindow = False
PrintScaling = False
PdfA = False
PDFStandard = psNone
PDFVersion = pv17
Left = 282
Top = 106
end
end
kgOrdersServer/Source/rOrders.pas
0 → 100644
View file @
39bcaa4d
unit
rOrders
;
interface
uses
System
.
SysUtils
,
System
.
Classes
,
frxClass
,
frxDBSet
,
frxExportBaseDialog
,
frxExportPDF
,
frCoreClasses
,
Uni
,
Data
.
DB
,
XData
.
Service
.
Common
,
Aurelius
.
Mapping
.
Attributes
,
System
.
JSON
,
System
.
Generics
.
Collections
;
type
TrptOrders
=
class
(
TDataModule
)
frxReport
:
TfrxReport
;
frxPDFExport
:
TfrxPDFExport
;
frxDBDataset
:
TfrxDBDataset
;
DataSource
:
TDataSource
;
UniQuery
:
TUniQuery
;
frxReport1
:
TfrxReport
;
frxPDFExport1
:
TfrxPDFExport
;
private
{ Private declarations }
public
{ Public declarations }
procedure
PrepareReport
(
OrderID
:
string
);
end
;
var
rptOrders
:
TrptOrders
;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
{ TrptOrders }
procedure
TrptOrders
.
PrepareReport
(
OrderID
:
string
);
var
SQL
:
string
;
begin
try
// 1. **Prepare the Query**
SQL
:=
'SELECT * FROM orders WHERE ORDER_ID = :OrderID'
;
UniQuery
.
Close
;
UniQuery
.
SQL
.
Text
:=
SQL
;
UniQuery
.
ParamByName
(
'OrderID'
).
AsString
:=
OrderID
;
UniQuery
.
Open
;
// 2. **Connect the Query to the Report**
frxDBDataset
.
DataSet
:=
UniQuery
;
// 3. **Set Report Variables (if needed)**
frxReport
.
Variables
[
'OrderID'
]
:=
QuotedStr
(
OrderID
);
// 4. **Prepare the Report**
frxReport
.
PrepareReport
(
True
);
except
on
E
:
Exception
do
raise
Exception
.
Create
(
'Error preparing the report: '
+
E
.
Message
);
end
;
end
;
end
.
kgOrdersServer/kgOrdersServer.dpr
View file @
39bcaa4d
...
...
@@ -20,7 +20,8 @@ uses
Auth.ServiceImpl in 'Source\Auth.ServiceImpl.pas',
Lookup.ServiceImpl in 'Source\Lookup.ServiceImpl.pas',
App.Server.Module in 'Source\App.Server.Module.pas' {AppServerModule: TDataModule},
Data in 'Source\Data.pas' {FData};
Data in 'Source\Data.pas' {FData},
rOrders in 'Source\rOrders.pas' {rptOrders};
type
TMemoLogAppender = class( TInterfacedObject, ILogAppender )
...
...
kgOrdersServer/kgOrdersServer.dproj
View file @
39bcaa4d
...
...
@@ -164,6 +164,10 @@
<Form>FData</Form>
<FormType>dfm</FormType>
</DCCReference>
<DCCReference Include="Source\rOrders.pas">
<Form>rptOrders</Form>
<FormType>dfm</FormType>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
...
...
kgOrdersServer/kgOrdersServer.ini
View file @
39bcaa4d
[Settings]
MemoLogLevel
=
5
FileLogLevel
=
5
LogFileNum
=
2
1
LogFileNum
=
2
5
webClientVersion
=
1.0.0
[Database]
--Server
=
192.168.159.132
Server
=
192.168.198.131
--Server
=
192.168.75.133
Password
=
emsys!012
--
Server
=
192.168.198.131
Server
=
192.168.102.130
--
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