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
aba393fe
Commit
aba393fe
authored
May 08, 2025
by
Cam Hayes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shipping Address Entry is working on the Add Customer Form
parent
2603867e
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
545 additions
and
116 deletions
+545
-116
AddCustomer.dfm
kgOrdersClient/AddCustomer.dfm
+113
-11
AddCustomer.html
kgOrdersClient/AddCustomer.html
+49
-24
AddCustomer.pas
kgOrdersClient/AddCustomer.pas
+187
-5
View.Customers.dfm
kgOrdersClient/View.Customers.dfm
+70
-59
View.Customers.html
kgOrdersClient/View.Customers.html
+12
-8
View.Customers.pas
kgOrdersClient/View.Customers.pas
+13
-4
View.Main.pas
kgOrdersClient/View.Main.pas
+6
-0
View.OrderEntryCuttingDie.pas
kgOrdersClient/View.OrderEntryCuttingDie.pas
+4
-0
Lookup.Service.pas
kgOrdersServer/Source/Lookup.Service.pas
+7
-0
Lookup.ServiceImpl.pas
kgOrdersServer/Source/Lookup.ServiceImpl.pas
+81
-3
kgOrdersServer.ini
kgOrdersServer/kgOrdersServer.ini
+1
-1
kgOrdersServer.json
kgOrdersServer/kgOrdersServer.json
+2
-1
No files found.
kgOrdersClient/AddCustomer.dfm
View file @
aba393fe
...
...
@@ -149,8 +149,8 @@ object FViewAddCustomer: TFViewAddCustomer
DataSource = WebDataSource1
end
object btnSave: TWebButton
Left =
88
Top =
525
Left =
19
Top =
402
Width = 96
Height = 25
Caption = 'Save'
...
...
@@ -163,8 +163,8 @@ object FViewAddCustomer: TFViewAddCustomer
OnClick = btnSaveClick
end
object btnCancel: TWebButton
Left =
88
Top = 4
85
Left =
19
Top = 4
73
Width = 96
Height = 25
Caption = 'Cancel'
...
...
@@ -174,10 +174,11 @@ object FViewAddCustomer: TFViewAddCustomer
HeightPercent = 100.000000000000000000
Role = 'null'
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object btnDelete: TWebButton
Left =
88
Top =
44
1
Left =
19
Top =
37
1
Width = 96
Height = 25
Caption = 'Delete'
...
...
@@ -187,8 +188,8 @@ object FViewAddCustomer: TFViewAddCustomer
WidthPercent = 100.000000000000000000
end
object btnClose: TWebButton
Left =
204
Top = 4
41
Left =
19
Top = 4
33
Width = 96
Height = 25
Caption = 'Close'
...
...
@@ -196,10 +197,11 @@ object FViewAddCustomer: TFViewAddCustomer
ElementID = 'btnclose'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseClick
end
object btnEdit: TWebButton
Left =
204
Top =
485
Left =
19
Top =
504
Width = 96
Height = 25
Caption = 'Edit'
...
...
@@ -207,6 +209,7 @@ object FViewAddCustomer: TFViewAddCustomer
ElementID = 'btnedit'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnEditClick
end
object pnlMessage: TWebPanel
Left = 324
...
...
@@ -304,13 +307,92 @@ object FViewAddCustomer: TFViewAddCustomer
Header.ListItemElementClassName = 'page-item'
Header.ListLinkElementClassName = 'page-link'
WordWrap = True
OnDblClickCell = wdbtcAddressesDblClickCell
Columns = <
item
DataField = 'ship_id'
Title = 'ID'
end
item
DataField = 'ADDRESS'
Title = 'A
DDRESS
'
Title = 'A
ddress
'
end>
DataSource = wdsShipTo
end
object btnAddAddress: TWebButton
Left = 190
Top = 420
Width = 96
Height = 25
Caption = 'Add Address'
ChildOrder = 21
ElementID = 'btnaddaddress'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnAddAddressClick
end
object edtShippingAddress: TWebEdit
Left = 190
Top = 460
Width = 121
Height = 22
ChildOrder = 22
ElementID = 'edtshippingaddress'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtShippingState: TWebEdit
Left = 190
Top = 516
Width = 121
Height = 22
ChildOrder = 22
ElementID = 'edtshippingstate'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtShippingContact: TWebEdit
Left = 190
Top = 578
Width = 121
Height = 22
ChildOrder = 22
ElementID = 'edtshippingcontact'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtShippingZip: TWebEdit
Left = 190
Top = 550
Width = 121
Height = 22
ChildOrder = 22
ElementID = 'edtshippingzip'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtShippingCity: TWebEdit
Left = 190
Top = 488
Width = 121
Height = 22
ChildOrder = 22
ElementID = 'edtshippingcity'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnClear: TWebButton
Left = 296
Top = 420
Width = 96
Height = 25
Caption = 'Clear'
ChildOrder = 27
ElementID = 'btnclear'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnClearClick
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 454
...
...
@@ -322,6 +404,7 @@ object FViewAddCustomer: TFViewAddCustomer
Top = 126
end
object XDataWebDataSet1: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Connection = DMConnection.ApiConnection
Left = 426
Top = 132
...
...
@@ -374,10 +457,29 @@ object FViewAddCustomer: TFViewAddCustomer
Top = 128
end
object xdwdsShipTo: TXDataWebDataSet
AfterEdit = xdwdsShipToAfterEdit
Left = 698
Top = 44
object xdwdsShipToADDRESS: TStringField
FieldName = 'ADDRESS'
end
object xdwdsShipToship_id: TStringField
FieldName = 'ship_id'
end
object xdwdsShipToshipping_address: TStringField
FieldName = 'shipping_address'
end
object xdwdsShipTocity: TStringField
FieldName = 'city'
end
object xdwdsShipTostate: TStringField
FieldName = 'state'
end
object xdwdsShipTozip: TStringField
FieldName = 'zip'
end
object xdwdsShipTocontact: TStringField
FieldName = 'contact'
end
end
end
kgOrdersClient/AddCustomer.html
View file @
aba393fe
...
...
@@ -25,9 +25,6 @@
</div>
</nav>
<div
class=
"row mx-5"
>
<div
class=
"col-12 col-md-8"
>
</div>
<h4
class=
"custom-h4 mt-3"
>
Company Information
</h4>
<hr
class=
"custom-hr"
>
<div
class=
"row"
>
...
...
@@ -40,16 +37,16 @@
<input
id=
"edtqbid"
class=
"form-control input-sm"
style=
"width: 200px"
required
/>
</div>
<div
class=
"col-auto"
>
<label
for=
"wdbe_first_name"
class=
"form-label mt-2"
>
Company Name:
</label>
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Company Name:
</label>
<input
id=
"edtcompanyname"
type=
"text"
class=
"form-control"
style=
"width: 300px;"
required
/>
<div
class=
"invalid-feedback"
style=
"font-size: 15px;"
>
Please Provide a Company Name.
</div>
</div>
<div
class=
"col-auto"
>
<label
for=
"wdbe_first_name"
class=
"form-label mt-2"
>
Company Account Name:
</label>
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Company Account Name:
</label>
<input
id=
"edtcompanyaccountname"
type=
"text"
class=
"form-control"
style=
"width: 150px"
required
/>
<div
class=
"invalid-feedback"
style=
"font-size: 15px;"
>
<div
class=
"invalid-feedback"
id=
"shortnamefeedback"
style=
"font-size: 15px;"
>
Please Provide a Company Account Name.
</div>
</div>
...
...
@@ -67,17 +64,11 @@
</div>
<div
class=
"col-auto"
>
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Fax:
</label>
<input
id=
"edtfax"
class=
"form-control input-sm"
style=
"width: 200px"
required
/>
<div
class=
"invalid-feedback"
style=
"font-size: 15px;"
>
Please Provide an Invoice Address.
</div>
<input
id=
"edtfax"
class=
"form-control input-sm"
style=
"width: 200px"
/>
</div>
<div
class=
"col-auto"
>
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Representative ID:
</label>
<input
id=
"edtrepid"
class=
"form-control input-sm"
style=
"width: 200px"
required
/>
<div
class=
"invalid-feedback"
style=
"font-size: 15px"
;
>
Please Provide a Ship To Address.
</div>
<input
id=
"edtrepid"
class=
"form-control input-sm"
style=
"width: 200px"
/>
</div>
</div>
<h4
class=
"custom-h4 mt-3"
>
Billing Information
</h4>
...
...
@@ -113,16 +104,50 @@
<h4
class=
"custom-h4 mt-3"
>
Shipping Addresses
</h4>
<hr
class=
"custom-hr"
>
<div
class=
"row"
>
<table
id=
"tblPhoneGrid"
class=
"table table-striped table-bordered"
style=
"width: 100%;"
>
<thead
class=
"sticky-top thead-light"
>
<tr
style=
"font-size: 0.875rem;"
>
<!-- Table headers are dynamically generated -->
</tr>
</thead>
<tbody
id=
"orderTableBody"
class=
"align-middle"
>
<!-- Table rows are dynamically generated -->
</tbody>
</table>
<table
id=
"tblPhoneGrid"
class=
"table table-striped table-bordered"
style=
"width: 100%;"
>
<thead
class=
"sticky-top thead-light"
>
<tr
style=
"font-size: 0.875rem;"
>
<!-- Table headers are dynamically generated -->
</tr>
</thead>
<tbody
id=
"orderTableBody"
class=
"align-middle"
>
<!-- Table rows are dynamically generated -->
</tbody>
</table>
</div>
<div
class=
"row mt-3"
>
<div
class=
"col-12"
>
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Shipping Address:
</label>
<input
id=
"edtshippingaddress"
class=
"form-control input-sm"
required
/>
</div>
<div
class=
"col-auto"
>
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Shipping City
</label>
<input
id=
"edtshippingcity"
class=
"form-control input-sm"
style=
"width: 250px"
/>
</div>
<div
class=
"col-auto"
>
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Shipping State:
</label>
<input
id=
"edtshippingstate"
class=
"form-control input-sm"
style=
"width: 100px"
/>
<div
class=
"invalid-feedback"
style=
"font-size: 15px;"
>
Please Provide an Order Date.
</div>
</div>
<div
class=
"col-auto"
>
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Shipping Zip Code:
</label>
<input
id=
"edtshippingzip"
class=
"form-control input-sm"
style=
"width: 200px"
/>
</div>
<div
class=
"col-auto"
>
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Shipping Contact:
</label>
<input
id=
"edtshippingcontact"
class=
"form-control input-sm"
style=
"width: 250px"
/>
</div>
</div>
<div
class=
"row mt-3"
>
<div
class=
"col-auto"
>
<button
id=
"btnaddaddress"
class=
"btn btn-danger btn-sm"
>
Add Address
</button>
\
</div>
<div
class=
"col-auto"
>
<button
id=
"btnclear"
class=
"btn btn-primary btn-sm"
>
Clear
</button>
</div>
</div>
</div>
...
...
kgOrdersClient/AddCustomer.pas
View file @
aba393fe
...
...
@@ -43,7 +43,6 @@ type
wdbtcAddresses
:
TWebDBTableControl
;
wdsShipTo
:
TWebDataSource
;
xdwdsShipTo
:
TXDataWebDataSet
;
xdwdsShipToADDRESS
:
TStringField
;
XDataWebDataSet1BILL_STATE
:
TStringField
;
XDataWebDataSet1BILL_CONTACT
:
TStringField
;
XDataWebDataSet1BILL_ZIP
:
TStringField
;
...
...
@@ -54,16 +53,42 @@ type
XDataWebDataSet1PHONE
:
TStringField
;
XDataWebDataSet1REP_USER_ID
:
TIntegerField
;
XDataWebDataSet1CUSTOMER_ID
:
TIntegerField
;
btnAddAddress
:
TWebButton
;
edtShippingAddress
:
TWebEdit
;
edtShippingState
:
TWebEdit
;
edtShippingContact
:
TWebEdit
;
edtShippingZip
:
TWebEdit
;
edtShippingCity
:
TWebEdit
;
btnClear
:
TWebButton
;
xdwdsShipToADDRESS
:
TStringField
;
xdwdsShipToship_id
:
TStringField
;
xdwdsShipToshipping_address
:
TStringField
;
xdwdsShipTocity
:
TStringField
;
xdwdsShipTostate
:
TStringField
;
xdwdsShipTozip
:
TStringField
;
xdwdsShipTocontact
:
TStringField
;
procedure
WebFormShow
(
Sender
:
TObject
);
procedure
btnCloseNotificationClick
(
Sender
:
TObject
);
procedure
btnSaveClick
(
Sender
:
TObject
);
procedure
btnCancelClick
(
Sender
:
TObject
);
procedure
xdwdsShipToAfterEdit
(
DataSet
:
TDataSet
);
procedure
XDataWebDataSet1AfterEdit
(
DataSet
:
TDataSet
);
procedure
btnCloseClick
(
Sender
:
TObject
);
procedure
btnEditClick
(
Sender
:
TObject
);
procedure
wdbtcAddressesDblClickCell
(
Sender
:
TObject
;
ACol
,
ARow
:
Integer
);
procedure
btnAddAddressClick
(
Sender
:
TObject
);
procedure
btnClearClick
(
Sender
:
TObject
);
private
{ Private declarations }
procedure
HideNotification
();
procedure
ShowNotification
(
Notification
:
string
);
procedure
ViewMode
();
procedure
EditMode
();
[
async
]
procedure
GetCustomer
();
[
async
]
procedure
SendCustomerToServer
();
[
async
]
procedure
SendAddressToServer
();
function
Verify
():
boolean
;
var
customerID
:
string
;
notification
:
string
;
...
...
@@ -80,19 +105,123 @@ implementation
{$R *.dfm}
uses
View
.
Main
;
uses
View
.
Main
,
View
.
Customers
;
procedure
TFViewAddCustomer
.
SendAddressToServer
;
var
Field
:
TField
;
AddressJSON
:
TJSONObject
;
Response
:
TXDataClientResponse
;
notification
:
TJSObject
;
begin
AddressJSON
:=
TJSONObject
.
Create
;
XDataWebDataSet1
.
First
;
AddressJSON
.
AddPair
(
'address'
,
edtShippingAddress
.
Text
);
AddressJSON
.
AddPair
(
'city'
,
edtShippingcity
.
Text
);
AddressJSON
.
AddPair
(
'state'
,
edtShippingstate
.
Text
);
AddressJSON
.
AddPair
(
'zip'
,
edtShippingzip
.
Text
);
AddressJSON
.
AddPair
(
'contact'
,
edtShippingContact
.
Text
);
AddressJSON
.
AddPair
(
'customer_id'
,
customerID
);
if
btnAddAddress
.
Caption
=
'Add Address'
then
AddressJSON
.
AddPair
(
'mode'
,
'ADD'
)
else
begin
AddressJSON
.
AddPair
(
'mode'
,
'EDIT'
);
AddressJSON
.
AddPair
(
'customer_ship_id'
,
xdwdsShipTo
.
FieldByName
(
'ship_id'
).
AsString
);
end
;
Response
:=
await
(
XDataWebClient1
.
RawInvokeAsync
(
'ILookupService.AddShippingAddress'
,
[
AddressJSON
.
ToString
]));
notification
:=
TJSObject
(
Response
.
Result
);
ShowNotification
(
string
(
notification
[
'status'
]));
end
;
procedure
TFViewAddCustomer
.
btnAddAddressClick
(
Sender
:
TObject
);
begin
if
btnAddAddress
.
Caption
=
'Save'
then
btnAddAddress
.
Caption
:=
'Add Address'
;
SendAddressToServer
();
end
;
procedure
TFViewAddCustomer
.
btnCancelClick
(
Sender
:
TObject
);
begin
FViewMain
.
change
:=
false
;
if
CustomerID
<>
''
then
begin
FViewMain
.
ViewAddCustomer
(
CustomerID
,
'Failure:Changes Discarded'
);
end
else
FViewMain
.
ShowForm
(
TFViewCustomers
);
end
;
procedure
TFViewAddCustomer
.
btnClearClick
(
Sender
:
TObject
);
begin
edtShippingAddress
.
Text
:=
''
;
edtShippingCity
.
Text
:=
''
;
edtShippingState
.
Text
:=
''
;
edtShippingZip
.
Text
:=
''
;
edtShippingContact
.
Text
:=
''
;
btnAddAddress
.
Caption
:=
'Add Address'
;
end
;
procedure
TFViewAddCustomer
.
btnCloseClick
(
Sender
:
TObject
);
begin
FViewMain
.
ShowForm
(
TFViewCustomers
)
end
;
procedure
TFViewAddCustomer
.
btnCloseNotificationClick
(
Sender
:
TObject
);
begin
HideNotification
();
end
;
procedure
TFViewAddCustomer
.
btnEditClick
(
Sender
:
TObject
);
begin
EditMode
();
end
;
procedure
TFViewAddCustomer
.
EditMode
;
begin
FViewMain
.
change
:=
true
;
btnDelete
.
Enabled
:=
false
;
btnClose
.
Enabled
:=
false
;
btnSave
.
Enabled
:=
true
;
btnCancel
.
Enabled
:=
True
;
btnEdit
.
Enabled
:=
false
;
end
;
procedure
TFViewAddCustomer
.
ViewMode
;
begin
btnDelete
.
Enabled
:=
true
;
btnClose
.
Enabled
:=
true
;
btnSave
.
Enabled
:=
false
;
btnCancel
.
Enabled
:=
false
;
btnEdit
.
Enabled
:=
true
;
FViewMain
.
change
:=
false
;
end
;
procedure
TFViewAddCustomer
.
wdbtcAddressesDblClickCell
(
Sender
:
TObject
;
ACol
,
ARow
:
Integer
);
begin
xdwdsShipTo
.
Locate
(
'ship_id'
,
wdbtcAddresses
.
Cells
[
0
,
ARow
],
[]);
edtShippingAddress
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'shipping_address'
).
AsString
;
edtShippingCity
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'city'
).
AsString
;
edtShippingState
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'state'
).
AsString
;
edtShippingZip
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'zip'
).
AsString
;
edtShippingContact
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'contact'
).
AsString
;
btnAddAddress
.
Caption
:=
'Save'
;
end
;
procedure
TFViewAddCustomer
.
SendCustomerToServer
();
var
customerJSON
:
TJSONObject
;
Field
:
TField
;
Response
:
TXDataClientResponse
;
notification
:
TJSObject
;
input
:
TJSHTMLElement
;
msg
:
string
;
begin
customerJSON
:=
TJSONObject
.
Create
;
...
...
@@ -132,14 +261,50 @@ begin
[
customerJSON
.
ToString
]));
notification
:=
TJSObject
(
Response
.
Result
);
ShowNotification
(
string
(
notification
[
'status'
]));
console
.
log
(
notification
[
'status'
]);
msg
:=
string
(
notification
[
'status'
]);
ShowNotification
(
msg
);
if
msg
.
Contains
(
'Failure'
)
then
begin
input
:=
TJSHTMLInputElement
(
document
.
getElementById
(
'edtcompanyaccountname'
));
input
.
classList
.
add
(
'is-invalid'
);
end
;
end
;
function
TFViewAddCustomer
.
Verify
():
boolean
;
var
input
:
TJSHTMLElement
;
begin
result
:=
true
;
input
:=
TJSHTMLInputElement
(
document
.
getElementById
(
'edtcompanyname'
));
if
edtName
.
Text
=
''
then
begin
input
.
classList
.
add
(
'is-invalid'
);
result
:=
false
;
end
else
input
.
classList
.
remove
(
'is-invalid'
);
input
:=
TJSHTMLInputElement
(
document
.
getElementById
(
'edtcompanyaccountname'
));
if
edtShortName
.
Text
=
''
then
begin
input
.
classList
.
add
(
'is-invalid'
);
result
:=
false
;
end
else
input
.
classList
.
remove
(
'is-invalid'
);
end
;
procedure
TFViewAddCustomer
.
btnSaveClick
(
Sender
:
TObject
);
begin
sendCustomerToServer
();
if
verify
then
begin
sendCustomerToServer
();
ViewMode
();
end
;
end
;
class
function
TFViewAddCustomer
.
CreateForm
(
AElementID
:
string
;
customerInfo
:
string
;
info
:
string
):
TWebForm
;
...
...
@@ -179,6 +344,8 @@ begin
XDataWebDataSet1
.
SetJsonData
(
customer
);
XDataWebDataSet1
.
Open
;
console
.
log
(
customer
[
'ADDRESS_LIST'
]);
if
CustomerID
=
'-1'
then
begin
edtCustomerID
.
Text
:=
''
;
...
...
@@ -208,12 +375,27 @@ begin
if
notification
=
''
then
hideNotification
();
if
mode
=
'ADD'
then
EditMode
()
else
ViewMode
();
getCustomer
();
dtpStartDate
.
Date
:=
0
;
dtpEndDate
.
Date
:=
0
;
end
;
procedure
TFViewAddCustomer
.
XDataWebDataSet1AfterEdit
(
DataSet
:
TDataSet
);
begin
EditMode
();
end
;
procedure
TFViewAddCustomer
.
xdwdsShipToAfterEdit
(
DataSet
:
TDataSet
);
begin
EditMode
();
end
;
procedure
TFViewAddCustomer
.
HideNotification
;
begin
pnlMessage
.
ElementHandle
.
hidden
:=
True
;
...
...
kgOrdersClient/View.Customers.dfm
View file @
aba393fe
...
...
@@ -30,58 +30,6 @@ object FViewCustomers: TFViewCustomers
WidthPercent = 100.000000000000000000
OnClick = btnAddCustomerClick
end
object wdbtcCustomers: TWebDBTableControl
Left = 9
Top = 138
Width = 631
Height = 200
ElementClassName = 'table'
ElementId = 'tblPhoneGrid'
BorderColor = clSilver
ChildOrder = 11
ElementFont = efCSS
ElementHeaderClassName = 'thead-light sticky-top bg-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
OnDblClickCell = wdbtcCustomersDblClickCell
Columns = <
item
DataField = 'CUSTOMER_ID'
Title = 'ID'
end
item
DataField = 'SHORT_NAME'
Title = 'SHORT_NAME'
end
item
DataField = 'START_DATE'
Title = 'Start Date'
end
item
DataField = 'NAME'
Title = 'Name'
end>
DataSource = wdsCustomers
end
object wcbPageSize: TWebComboBox
Left = 22
Top = 52
...
...
@@ -108,7 +56,7 @@ object FViewCustomers: TFViewCustomers
Height = 33
ElementID = 'view.login.message'
ChildOrder = 17
TabOrder =
3
TabOrder =
2
object lblMessage: TWebLabel
Left = 16
Top = 11
...
...
@@ -130,20 +78,83 @@ object FViewCustomers: TFViewCustomers
WidthPercent = 100.000000000000000000
end
end
object wdbtcCustomers: TWebDBTableControl
Left = 8
Top = 202
Width = 631
Height = 200
ElementClassName = 'table'
ElementId = 'tblPhoneGrid'
BorderColor = clSilver
ChildOrder = 11
ElementFont = efCSS
ElementHeaderClassName = 'thead-light sticky-top bg-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
OnDblClickCell = wdbtcCustomersDblClickCell
Columns = <
item
DataField = 'CUSTOMER_ID'
Title = 'Customer ID'
end
item
DataField = 'SHORT_NAME'
Title = 'Account Name'
end
item
DataField = 'NAME'
Title = 'Name'
end
item
DataField = 'START_DATE'
Title = 'Start Date'
end>
DataSource = wdsCustomers
end
object edtFilter: TWebEdit
Left = 246
Top = 20
Width = 121
Height = 22
ChildOrder = 5
ElementID = 'edtfilter'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = edtFilterChange
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left =
2
8
Top =
41
0
Left =
15
8
Top =
9
0
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 2
24
Top =
414
Left = 2
62
Top =
116
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left =
130
Top =
410
Left =
346
Top =
92
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
Size = 0
...
...
kgOrdersClient/View.Customers.html
View file @
aba393fe
...
...
@@ -10,17 +10,21 @@
</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;font-size: 1.10rem;"
>
Show
<select
class=
"custom-select"
id=
"wcbpagesize"
style=
"font-size: 1.00rem;"
></select>
entries
</label>
<div
class=
"row mt-3 justify-content-center align-items-end"
>
<div
class=
"col-auto"
>
<label
for=
"wcbpagesize"
class=
"form-label fw-bold"
style=
"font-size: 1.1rem;"
>
Show
<select
class=
"form-select d-inline-block w-auto"
id=
"wcbpagesize"
style=
"font-size: 1rem;"
></select>
entries
</label>
</div>
<div
class=
"col-auto"
>
<button
id=
"btnaddcustomer"
class=
"btn btn-secondary"
>
Add Customer
</button>
</div>
<div
class=
"col-auto"
>
<button
id=
"btnaddcustomer"
class=
"btn btn-secondary mt-3"
>
Add Customer
</button>
<label
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Company Account Name:
</label>
<input
id=
"edtfilter"
type=
"text"
class=
"form-control"
style=
"width: 200px;"
/>
</div>
<div
class=
"col-auto"
>
<label
for=
"wdbe_first_name"
class=
"form-label mt-2"
>
Quickbooks ID:
</label>
<input
id=
"edtinquickbooks"
type=
"text"
class=
"form-control"
style=
"width: 150px"
/>
</div>
</div>
<!-- Entries Label Section d-flex justify-content-between w-100 mt-2-->
...
...
kgOrdersClient/View.Customers.pas
View file @
aba393fe
...
...
@@ -8,13 +8,15 @@ uses
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
,
WEBLib
.
Grids
;
WEBLib
.
Grids
,
VCL
.
TMSFNCTypes
,
VCL
.
TMSFNCUtils
,
VCL
.
TMSFNCGraphics
,
VCL
.
TMSFNCGraphicsTypes
,
VCL
.
TMSFNCGridCell
,
VCL
.
TMSFNCGridOptions
,
VCL
.
TMSFNCCustomControl
,
VCL
.
TMSFNCCustomScrollControl
,
VCL
.
TMSFNCGridData
,
VCL
.
TMSFNCCustomGrid
,
VCL
.
TMSFNCGrid
;
type
TFViewCustomers
=
class
(
TWebForm
)
lblEntries
:
TWebLabel
;
btnAddCustomer
:
TWebButton
;
wdbtcCustomers
:
TWebDBTableControl
;
wcbPageSize
:
TWebComboBox
;
pnlMessage
:
TWebPanel
;
lblMessage
:
TWebLabel
;
...
...
@@ -26,9 +28,12 @@ type
xdwdsCustomersSTART_DATE
:
TStringField
;
xdwdsCustomersSHORT_NAME
:
TStringField
;
xdwdsCustomersCUSTOMER_ID
:
TIntegerField
;
wdbtcCustomers
:
TWebDBTableControl
;
edtFilter
:
TWebEdit
;
procedure
WebFormCreate
(
Sender
:
TObject
);
procedure
btnAddCustomerClick
(
Sender
:
TObject
);
procedure
wdbtcCustomersDblClickCell
(
Sender
:
TObject
;
ACol
,
ARow
:
Integer
);
procedure
edtFilterChange
(
Sender
:
TObject
);
private
{ Private declarations }
procedure
GeneratePagination
(
TotalPages
:
Integer
);
...
...
@@ -120,8 +125,6 @@ begin
' of '
+
IntToStr
(
customerListLength
);
end
;
// Optional: Continue using pagination if needed
GeneratePagination
(
TotalPages
);
end
;
end
;
...
...
@@ -184,6 +187,12 @@ begin
FViewMain
.
ViewAddCustomer
(
''
,
''
);
end
;
procedure
TFViewCustomers
.
edtFilterChange
(
Sender
:
TObject
);
begin
xdwdsCustomers
.
Filter
:=
'SHORT_NAME LIKE '
+
quotedStr
(
'%'
+
edtFilter
.
Text
+
'%'
);
xdwdsCustomers
.
Filtered
:=
true
;
end
;
procedure
TFViewCustomers
.
GeneratePagination
(
TotalPages
:
Integer
);
// Generates pagination for the table.
// TotalPages: Total amount of pages generated by the search
...
...
kgOrdersClient/View.Main.pas
View file @
aba393fe
...
...
@@ -56,6 +56,7 @@ type
procedure
ViewOrderEntryWeb
(
orderInfo
,
customerInfo
,
mode
,
info
:
string
);
procedure
ViewOrderEntryCuttingDie
(
orderInfo
,
customerInfo
,
mode
,
info
:
string
);
procedure
ViewOrders
(
info
:
string
);
procedure
ViewCustomerList
(
info
:
string
);
procedure
ShowUserForm
(
Info
:
string
);
procedure
ViewAddCustomer
(
customerInfo
,
info
:
string
);
var
...
...
@@ -254,6 +255,11 @@ begin
Application
.
CreateForm
(
AFormClass
,
WebPanel1
.
ElementID
,
FChildForm
);
end
;
procedure
TFViewMain
.
ViewCustomerList
(
info
:
string
);
begin
end
;
procedure
TFViewMain
.
EditUser
(
Mode
,
Username
,
Password
,
Name
,
Status
,
Email
,
Access
,
Rights
,
Perspective
,
QB
:
string
);
begin
...
...
kgOrdersClient/View.OrderEntryCuttingDie.pas
View file @
aba393fe
...
...
@@ -495,6 +495,10 @@ begin
XDataWebDataSet1
.
Open
;
console
.
log
(
XDataWebDataSet1NAME
.
AsString
);
dtpOrderDate
.
Date
:=
0
;
dtpProofDate
.
Date
:=
0
;
dtpShipDate
.
Date
:=
0
;
xdwdsShipTo
.
Close
;
xdwdsShipTo
.
SetJSONData
(
customer
[
'ADDRESS_LIST'
]);
xdwdsShipTo
.
Open
;
...
...
kgOrdersServer/Source/Lookup.Service.pas
View file @
aba393fe
...
...
@@ -109,6 +109,12 @@ type
TAddressItem
=
class
Public
ADDRESS
:
string
;
shipping_address
:
string
;
city
:
string
;
state
:
string
;
contact
:
string
;
zip
:
string
;
ship_id
:
string
;
end
;
TCustomerItem
=
class
...
...
@@ -390,6 +396,7 @@ type
function
AddUser
(
userInfo
:
string
):
string
;
function
AddItem
(
itemInfo
:
string
):
string
;
function
AddShippingAddress
(
Addressinfo
:
string
):
TJSONObject
;
function
DelUser
(
username
:
string
):
string
;
function
DelOrder
(
orderID
,
orderType
,
UserID
:
string
):
TJSONObject
;
function
EditUser
(
const
editOptions
:
string
):
string
;
...
...
kgOrdersServer/Source/Lookup.ServiceImpl.pas
View file @
aba393fe
...
...
@@ -53,6 +53,7 @@ type
function
AddCorrugatedOrder
(
orderInfo
:
string
):
TJSONObject
;
function
AddWebOrder
(
orderInfo
:
string
):
TJSONObject
;
function
AddCuttingDieOrder
(
orderInfo
:
string
):
TJSONObject
;
function
AddShippingAddress
(
AddressInfo
:
string
):
TJSONObject
;
function
delOrder
(
OrderID
,
OrderType
,
UserID
:
string
):
TJSONObject
;
function
GenerateSubQuery
(
currStatus
:
string
):
string
;
...
...
@@ -132,7 +133,7 @@ var
SQL
:
string
;
ADDRESS
:
TAddressItem
;
begin
SQL
:=
'select *
FROM customers c LEFT JOIN customers_ship s ON c.CUSTOMER_ID = s.customer_id WHERE c.CUSTOMER_ID = '
+
ID
;
SQL
:=
'select * FROM customers c LEFT JOIN customers_ship s ON c.CUSTOMER_ID = s.customer_id WHERE c.CUSTOMER_ID = '
+
ID
;
doQuery
(
ordersDB
.
UniQuery1
,
SQL
);
result
:=
TCustomerItem
.
Create
;
result
.
ADDRESS_LIST
:=
TList
<
TAddressItem
>.
Create
;
...
...
@@ -163,6 +164,12 @@ begin
ADDRESS
:=
TAddressItem
.
Create
;
TXDataOperationContext
.
Current
.
Handler
.
ManagedObjects
.
Add
(
ADDRESS
);
ADDRESS
.
ADDRESS
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'ship_block'
).
AsString
;
ADDRESS
.
shipping_address
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'address'
).
AsString
;
ADDRESS
.
city
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'city'
).
AsString
;
ADDRESS
.
state
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'state'
).
AsString
;
ADDRESS
.
zip
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'zip'
).
AsString
;
ADDRESS
.
contact
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'contact'
).
AsString
;
ADDRESS
.
ship_id
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'customer_ship_id'
).
AsString
;
result
.
ADDRESS_LIST
.
Add
(
ADDRESS
);
ordersDB
.
UniQuery1
.
Next
;
end
;
...
...
@@ -210,6 +217,79 @@ begin
end
;
end
;
function
TLookupService
.
AddShippingAddress
(
AddressInfo
:
string
):
TJSONObject
;
var
JSONData
:
TJSONObject
;
SQL
:
string
;
Pair
:
TJSONPair
;
Field
:
TField
;
ShipID
:
integer
;
mode
:
string
;
temp
:
string
;
msg
:
string
;
ship_block
:
string
;
begin
JSONData
:=
TJSONObject
.
ParseJSONValue
(
AddressInfo
)
as
TJSONObject
;
if
JSONData
=
nil
then
raise
Exception
.
Create
(
'Invalid JSON format'
);
// If parsing fails, raise an exception
mode
:=
JSONData
.
GetValue
<
string
>(
'mode'
);
if
mode
=
'EDIT'
then
ShipID
:=
JSONData
.
GetValue
<
integer
>(
'customer_ship_id'
);
if
mode
=
'ADD'
then
SQL
:=
'select * from customers_ship where customer_id = 0 and customer_id <> 0'
else
begin
SQL
:=
'select * from customers_ship where customer_ship_id = '
+
IntToStr
(
ShipID
);
end
;
doQuery
(
ordersDB
.
UniQuery1
,
SQL
);
try
if
mode
=
'ADD'
then
ordersDB
.
UniQuery1
.
Insert
else
ordersDB
.
UniQuery1
.
Edit
;
for
Pair
in
JSONData
do
begin
Field
:=
ordersDB
.
UniQuery1
.
FindField
(
Pair
.
JsonString
.
Value
);
// Checks if the field exists in the dataset
if
Assigned
(
Field
)
then
begin
if
(
Field
is
TDateTimeField
)
then
begin
if
(
Pair
.
JsonValue
.
Value
=
''
)
or
(
Pair
.
JsonValue
.
Value
=
'null'
)
or
(
Pair
.
JsonValue
.
Value
=
'12/30/1899'
)
then
Field
.
Clear
// This sets the field to NULL (empty)
else
TDateTimeField
(
Field
).
AsDateTime
:=
StrToDate
(
Pair
.
JsonValue
.
Value
);
end
else
if
Pair
.
JsonValue
.
Value
<>
''
then
Field
.
AsString
:=
Pair
.
JsonValue
.
Value
;
end
;
end
;
//OrdersDB.UniQuery1.FieldByName('address').AsString := JSONData.GetValue<string>('shipping_address');
//TODO Ask about shipping block & link to quickbooks
// OrdersDB.UniQuery1.FieldByName('ship_block') := ship_block;
// Post the record to the database
ordersDB
.
UniQuery1
.
Post
;
if
mode
=
'ADD'
then
msg
:=
'Success:Shipping Address Successfully Added'
else
msg
:=
'Success:Shipping Address Successfully Edited'
;
Result
:=
TJSONObject
.
Create
.
AddPair
(
'status'
,
msg
);
TXDataOperationContext
.
Current
.
Handler
.
ManagedObjects
.
Add
(
Result
);
except
on
E
:
Exception
do
begin
Result
:=
TJSONObject
.
Create
.
AddPair
(
'error'
,
E
.
Message
);
end
end
;
end
;
function
TLookupService
.
AddCustomer
(
customerInfo
:
string
):
TJSONObject
;
var
...
...
@@ -232,8 +312,6 @@ begin
raise
Exception
.
Create
(
'Invalid JSON format'
);
// If parsing fails, raise an exception
mode
:=
JSONData
.
GetValue
<
string
>(
'mode'
);
if
mode
=
'ADD'
then
begin
// Update RevisionID
...
...
kgOrdersServer/kgOrdersServer.ini
View file @
aba393fe
...
...
@@ -2,7 +2,7 @@
MemoLogLevel
=
3
FileLogLevel
=
5
webClientVersion
=
0.9.2
LogFileNum
=
5
03
LogFileNum
=
5
18
[Database]
Server
=
192.168.159.131
...
...
kgOrdersServer/kgOrdersServer.json
View file @
aba393fe
...
...
@@ -3,5 +3,5 @@
"jwtTokenSecret"
:
"super_secret0123super_secret4567"
,
"adminPassword"
:
"whatisthisusedfor"
,
"webAppFolder"
:
"static"
,
"reportsFolder"
:
"
reports/
"
"reportsFolder"
:
"
..
\\
kgOrdersClient
\\
TMSWeb
\\
Debug
\\
"
}
\ No newline at end of file
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