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
151f60b4
Commit
151f60b4
authored
Mar 27, 2026
by
Cam Hayes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redesigned how GetQBCustomers worked
parent
4700fcf0
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
684 additions
and
453 deletions
+684
-453
Utils.pas
kgOrdersClient/Utils.pas
+0
-2
View.Customer.Add.dfm
kgOrdersClient/View.Customer.Add.dfm
+24
-32
View.Customer.Add.html
kgOrdersClient/View.Customer.Add.html
+6
-3
View.Customer.Add.pas
kgOrdersClient/View.Customer.Add.pas
+82
-45
View.Customer.Select.dfm
kgOrdersClient/View.Customer.Select.dfm
+24
-59
View.Customer.Select.pas
kgOrdersClient/View.Customer.Select.pas
+10
-89
View.Customers.dfm
kgOrdersClient/View.Customers.dfm
+12
-16
View.Main.dfm
kgOrdersClient/View.Main.dfm
+25
-25
View.Main.pas
kgOrdersClient/View.Main.pas
+3
-3
View.QBInfo.dfm
kgOrdersClient/View.QBInfo.dfm
+12
-12
View.QBInfo.pas
kgOrdersClient/View.QBInfo.pas
+26
-15
TMSWebRunner.ini
kgOrdersClient/Win64/Debug/TMSWebRunner.ini
+16
-0
Api.Database.dfm
kgOrdersServer/Source/Api.Database.dfm
+2
-17
Api.Database.pas
kgOrdersServer/Source/Api.Database.pas
+1
-11
Lookup.Service.pas
kgOrdersServer/Source/Lookup.Service.pas
+39
-5
Lookup.ServiceImpl.pas
kgOrdersServer/Source/Lookup.ServiceImpl.pas
+349
-93
qbAPI.dfm
kgOrdersServer/Source/qbAPI.dfm
+33
-15
kgOrdersServer - Copy.ini
kgOrdersServer/bin/kgOrdersServer - Copy.ini
+20
-11
No files found.
kgOrdersClient/Utils.pas
View file @
151f60b4
...
...
@@ -89,7 +89,6 @@ begin
end
;
end
;
procedure
ShowErrorModal
(
msg
:
string
);
begin
asm
...
...
@@ -117,7 +116,6 @@ begin
end
;
end
;
procedure
ShowNotificationModal
(
msg
:
string
);
begin
asm
...
...
kgOrdersClient/View.Customer.Add.dfm
View file @
151f60b4
...
...
@@ -221,7 +221,7 @@ object FViewAddCustomer: TFViewAddCustomer
Title = 'ID'
end
item
DataField = '
ADDRESS
'
DataField = '
ship_block
'
Title = 'Address'
end>
DataSource = wdsShipTo
...
...
@@ -399,22 +399,6 @@ object FViewAddCustomer: TFViewAddCustomer
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object wdblcbRep: TWebDBLookupComboBox
Left = 19
Top = 216
Width = 145
Height = 22
ElementID = 'wdblcbrep'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = wdblcbRepChange
OnEnter = wdblcbRepChange
DataField = 'REP_USER_ID'
DataSource = WebDataSource1
KeyField = 'userID'
ListField = 'representative'
ListSource = wdsUsers
end
object btnLink: TWebButton
Left = 19
Top = 566
...
...
@@ -441,6 +425,22 @@ object FViewAddCustomer: TFViewAddCustomer
WidthPercent = 100.000000000000000000
OnClick = btnUpdateClick
end
object edtRepUser: TWebDBEdit
Left = 19
Top = 216
Width = 121
Height = 22
ChildOrder = 12
ElementClassName = 'form-control'
ElementID = 'edtrepuser'
ElementFont = efCSS
Enabled = False
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'QB_TYPE'
DataSource = WebDataSource1
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 454
...
...
@@ -495,8 +495,8 @@ object FViewAddCustomer: TFViewAddCustomer
object XDataWebDataSet1CUSTOMER_ID: TIntegerField
FieldName = 'CUSTOMER_ID'
end
object XDataWebDataSet1
REP_USER_ID
: TStringField
FieldName = '
REP_USER_ID
'
object XDataWebDataSet1
QB_TYPE
: TStringField
FieldName = '
QB_TYPE
'
end
end
object wdsShipTo: TWebDataSource
...
...
@@ -508,9 +508,6 @@ object FViewAddCustomer: TFViewAddCustomer
object xdwdsShipTo: TXDataWebDataSet
Left = 698
Top = 44
object xdwdsShipToADDRESS: TStringField
FieldName = 'ADDRESS'
end
object xdwdsShipToship_id: TStringField
FieldName = 'ship_id'
end
...
...
@@ -529,6 +526,9 @@ object FViewAddCustomer: TFViewAddCustomer
object xdwdsShipTocontact: TStringField
FieldName = 'contact'
end
object xdwdsShipToship_block: TStringField
FieldName = 'ship_block'
end
end
object tmrReturn: TWebTimer
Enabled = False
...
...
@@ -545,16 +545,8 @@ object FViewAddCustomer: TFViewAddCustomer
object xdwdsUsers: TXDataWebDataSet
Left = 776
Top = 54
object xdwdsUsersuserID: TStringField
FieldName = 'userID'
end
object xdwdsUsersfull_name: TStringField
FieldName = 'full_name'
Size = 0
end
object xdwdsUsersrepresentative: TStringField
FieldName = 'representative'
Size = 0
object xdwdsUsersQBID: TStringField
FieldName = 'QBID'
end
end
end
kgOrdersClient/View.Customer.Add.html
View file @
151f60b4
...
...
@@ -57,12 +57,15 @@
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Customer ID:
</label>
<input
id=
"edtcompanyaccountname"
type=
"text"
class=
"form-control"
style=
"width: 150px"
required
/>
<div
class=
"invalid-feedback"
id=
"shortnamefeedback"
style=
"font-size: 15px;"
>
Please Provide a Company
Account Name
.
Please Provide a Company
ID
.
</div>
</div>
<div
class=
"col-auto"
>
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Representative:
</label>
<select
id=
"wdblcbrep"
class=
'form-select'
></select>
<label
for=
"wdbe_first_name"
style=
"font-weight: 700; font-size: 15px;"
class=
"form-label mt-2"
>
Territory:
</label>
<input
id=
"edtrepuser"
type=
"text"
class=
"form-control"
style=
"width: 150px"
/>
<div
class=
"invalid-feedback"
id=
"territorywarning"
style=
"font-size: 15px;"
>
Territory not found in kgOrders
</div>
</div>
</div>
<h4
class=
"custom-h4 mt-3"
>
Billing Information
</h4>
...
...
kgOrdersClient/View.Customer.Add.pas
View file @
151f60b4
...
...
@@ -50,7 +50,6 @@ type
edtShippingContact
:
TWebEdit
;
edtShippingZip
:
TWebEdit
;
edtShippingCity
:
TWebEdit
;
xdwdsShipToADDRESS
:
TStringField
;
xdwdsShipToship_id
:
TStringField
;
xdwdsShipToshipping_address
:
TStringField
;
xdwdsShipTocity
:
TStringField
;
...
...
@@ -69,15 +68,14 @@ type
edtFirstLine
:
TWebEdit
;
wdsUsers
:
TWebDataSource
;
xdwdsUsers
:
TXDataWebDataSet
;
wdblcbRep
:
TWebDBLookupComboBox
;
xdwdsUsersuserID
:
TStringField
;
XDataWebDataSet1REP_USER_ID
:
TStringField
;
xdwdsUsersfull_name
:
TStringField
;
lblFormState
:
TWebLabel
;
[
async
]
xdwdsUsersrepresentative
:
TStringField
;
btnLink
:
TWebButton
;
btnUpdate
:
TWebButton
;
procedure
btnSaveClick
(
Sender
:
TObject
);
btnUpdate
:
TWebButton
;
edtRepUser
:
TWebDBEdit
;
xdwdsUsersQBID
:
TStringField
;
xdwdsShipToship_block
:
TStringField
;
XDataWebDataSet1QB_TYPE
:
TStringField
;
procedure
btnSaveClick
(
Sender
:
TObject
);
procedure
btnCancelClick
(
Sender
:
TObject
);
procedure
btnCloseClick
(
Sender
:
TObject
);
procedure
btnEditClick
(
Sender
:
TObject
);
...
...
@@ -114,12 +112,12 @@ type
[
async
]
procedure
InitializeForm
;
var
customerID
:
string
;
qbCustJSON
:
string
;
QB_ID
,
qbCustJSON
:
string
;
mode
:
string
;
shipmode
:
string
;
public
{ Public declarations }
class
function
CreateForm
(
AElementID
,
custID
,
cust
JSON
:
string
):
TWebForm
;
class
function
CreateForm
(
AElementID
,
custID
,
cust
QB_ID
:
string
):
TWebForm
;
end
;
var
...
...
@@ -132,7 +130,7 @@ implementation
uses
View
.
Main
,
View
.
Customers
,
View
.
Customer
.
Select
,
Utils
;
class
function
TFViewAddCustomer
.
CreateForm
(
AElementID
,
custID
,
cust
JSON
:
string
):
TWebForm
;
class
function
TFViewAddCustomer
.
CreateForm
(
AElementID
,
custID
,
cust
QB_ID
:
string
):
TWebForm
;
begin
Application
.
CreateForm
(
TFViewAddCustomer
,
AElementID
,
Result
,
procedure
(
AForm
:
TObject
)
...
...
@@ -140,7 +138,7 @@ begin
with
TFViewAddCustomer
(
AForm
)
do
begin
customerID
:=
custID
;
qbCustJSON
:=
custJSON
;
QB_ID
:=
custQB_ID
;
InitializeForm
;
end
;
...
...
@@ -153,37 +151,70 @@ end;
var
JSONObj
,
obj
:
TJSONObject
;
arr
:
TJSONArray
;
xdcResponse
:
TXDataClientResponse
;
RepUsers
,
QBCustomer
:
TJSObject
;
JSONStr
:
string
;
input
:
TJSHTMLInputElement
;
begin
if
customerID
=
''
then
begin
mode
:=
'ADD'
;
JSONObj
:=
TJSONObject
.
ParseJSONValue
(
qbCustJSON
)
as
TJSONObject
;
try
XDataWebDataSet1
.
Open
;
XDataWebDataSet1
.
Append
;
XDataWebDataSet1
.
FieldByName
(
'NAME'
).
AsString
:=
JSONObj
.
GetValue
(
'NAME'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'QB_LIST_ID'
).
AsString
:=
JSONObj
.
GetValue
(
'QB_LIST_ID'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'BILL_ADDRESS'
).
AsString
:=
JSONObj
.
GetValue
(
'BILL_ADDRESS'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'BILL_CITY'
).
AsString
:=
JSONObj
.
GetValue
(
'BILL_CITY'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'BILL_STATE'
).
AsString
:=
JSONObj
.
GetValue
(
'BILL_STATE'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'BILL_ZIP'
).
AsString
:=
JSONObj
.
GetValue
(
'BILL_ZIP'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'BILL_CONTACT'
).
AsString
:=
JSONObj
.
GetValue
(
'BILL_CONTACT'
).
Value
;
//XDataWebDataSet1.FieldByName('BILL_ADDRESS_BLOCK').AsString := JSONObj.GetValue('BILL_ADDRESS_BLOCK').Value;
XDataWebDataSet1
.
Post
;
xdwdsShipTo
.
Open
;
xdwdsShipTo
.
Append
;
xdwdsShipTo
.
FieldByName
(
'shipping_address'
).
AsString
:=
JSONObj
.
GetValue
(
'address'
).
Value
;
xdwdsShipTo
.
FieldByName
(
'city'
).
AsString
:=
JSONObj
.
GetValue
(
'city'
).
Value
;
xdwdsShipTo
.
FieldByName
(
'state'
).
AsString
:=
JSONObj
.
GetValue
(
'state'
).
Value
;
xdwdsShipTo
.
FieldByName
(
'zip'
).
AsString
:=
JSONObj
.
GetValue
(
'zip'
).
Value
;
xdwdsShipTo
.
FieldByName
(
'ADDRESS'
).
AsString
:=
JSONObj
.
GetValue
(
'ship_block'
).
Value
;
xdwdsShipTo
.
FieldByName
(
'contact'
).
AsString
:=
JSONObj
.
GetValue
(
'contact'
).
Value
;
xdwdsShipTo
.
Post
;
xdwdsShipTo
.
First
;
EditMode
();
try
xdcResponse
:=
await
(
XDataWebClient1
.
RawInvokeAsync
(
'ILookupService.GetQBCustomer'
,
[
QB_ID
]));
qbCustJSON
:=
string
(
TJSJSON
.
stringify
(
xdcResponse
.
Result
));
console
.
log
(
qbCustJSON
);
JSONObj
:=
TJSONObject
.
ParseJSONValue
(
qbCustJSON
)
as
TJSONObject
;
//JSONObj := TJSONObject.ParseJSONValue(qbCustJSON) as TJSONObject;
XDataWebDataSet1
.
Open
;
XDataWebDataSet1
.
Append
;
XDataWebDataSet1
.
FieldByName
(
'NAME'
).
AsString
:=
JSONObj
.
GetValue
(
'NAME'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'QB_LIST_ID'
).
AsString
:=
JSONObj
.
GetValue
(
'QB_LIST_ID'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'BILL_ADDRESS'
).
AsString
:=
JSONObj
.
GetValue
(
'BILL_ADDRESS'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'BILL_CITY'
).
AsString
:=
JSONObj
.
GetValue
(
'BILL_CITY'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'BILL_STATE'
).
AsString
:=
JSONObj
.
GetValue
(
'BILL_STATE'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'BILL_ZIP'
).
AsString
:=
JSONObj
.
GetValue
(
'BILL_ZIP'
).
Value
;
XDataWebDataSet1
.
FieldByName
(
'BILL_CONTACT'
).
AsString
:=
JSONObj
.
GetValue
(
'BILL_CONTACT'
).
Value
;
XDataWebDataSet1QB_TYPE
.
AsString
:=
JSONObj
.
GetValue
(
'RepUser'
).
Value
;
//XDataWebDataSet1.FieldByName('BILL_ADDRESS_BLOCK').AsString := JSONObj.GetValue('BILL_ADDRESS_BLOCK').Value;
XDataWebDataSet1
.
Post
;
xdwdsShipTo
.
Open
;
xdwdsShipTo
.
Append
;
xdwdsShipTo
.
FieldByName
(
'shipping_address'
).
AsString
:=
JSONObj
.
GetValue
(
'shipping_address'
).
Value
;
xdwdsShipTo
.
FieldByName
(
'city'
).
AsString
:=
JSONObj
.
GetValue
(
'city'
).
Value
;
xdwdsShipTo
.
FieldByName
(
'state'
).
AsString
:=
JSONObj
.
GetValue
(
'state'
).
Value
;
xdwdsShipTo
.
FieldByName
(
'zip'
).
AsString
:=
JSONObj
.
GetValue
(
'zip'
).
Value
;
xdwdsShipTo
.
FieldByName
(
'ship_block'
).
AsString
:=
JSONObj
.
GetValue
(
'ship_block'
).
Value
;
xdwdsShipTo
.
FieldByName
(
'contact'
).
AsString
:=
JSONObj
.
GetValue
(
'contact'
).
Value
;
xdwdsShipTo
.
Post
;
xdwdsShipTo
.
First
;
xdcResponse
:=
await
(
XDataWebClient1
.
RawInvokeAsync
(
'ILookupService.GetRepUsers'
,
[]));
RepUsers
:=
TJSObject
(
xdcResponse
.
Result
);
xdwdsUsers
.
Close
;
xdwdsUsers
.
SetJSONData
(
RepUsers
[
'value'
]);
xdwdsUsers
.
Open
;
CustomerID
:=
''
;
input
:=
TJSHTMLInputElement
(
document
.
getElementById
(
'edtrepuser'
));
if
not
xdwdsUsers
.
Locate
(
'QBID'
,
XDataWebDataSet1QB_TYPE
.
AsString
,
[])
then
begin
input
.
classList
.
add
(
'changed-field'
);
input
.
classList
.
add
(
'is-invalid'
);
end
else
input
.
classList
.
remove
(
'changed-field'
);
EditMode
();
except
on
E
:
EXDataClientRequestException
do
Utils
.
ShowErrorModal
(
E
.
ErrorResult
.
ErrorMessage
);
end
;
finally
JSONObj
.
Free
;
end
;
...
...
@@ -405,7 +436,7 @@ begin
edtShippingState
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'state'
).
AsString
;
edtShippingZip
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'zip'
).
AsString
;
edtShippingContact
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'contact'
).
AsString
;
memoShipBlock
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'
ADDRESS
'
).
AsString
;
memoShipBlock
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'
ship_block
'
).
AsString
;
if
memoShipBlock
.
Lines
.
Count
>
0
then
edtFirstLine
.
Text
:=
memoShipBlock
.
Lines
[
0
]
...
...
@@ -507,6 +538,7 @@ var
Response
:
TXDataClientResponse
;
notification
:
TJSObject
;
input
:
TJSHTMLElement
;
jsonObj
:
TJSONObject
;
msg
:
string
;
BILL_ADDRESS_BLOCK
:
string
;
begin
...
...
@@ -547,17 +579,19 @@ begin
Response
:=
await
(
XDataWebClient1
.
RawInvokeAsync
(
'ILookupService.AddCustomer'
,
[
customerJSON
.
ToJSON
]));
notification
:=
TJSObject
(
Response
.
Result
);
end
else
begin
JSONObj
:=
TJSONObject
.
ParseJSONValue
(
qbCustJSON
)
as
TJSONObject
;
JSONObj
.
AddPair
(
'SHORT_NAME'
,
XDataWebDataSet1SHORT_NAME
.
AsString
);
Response
:=
await
(
XDataWebClient1
.
RawInvokeAsync
(
'ILookupService.ImportQBCustomer'
,
[
qbCustJSON
]));
mode
:=
'EDIT'
;
[
JSONObj
.
ToString
]));
XDataWebDataSet1
.
Edit
;
notification
:=
TJSObject
(
Response
.
Result
);
XDataWebDataSet1Customer_ID
.
AsInteger
:=
integer
(
notification
[
'CustomerID'
]);
XDataWebDataSet1
.
Post
;
end
;
notification
:=
TJSObject
(
Response
.
Result
);
msg
:=
string
(
notification
[
'status'
]);
if
CustomerID
=
''
then
CustomerID
:=
string
(
notification
[
'CustomerID'
]);
...
...
@@ -579,6 +613,7 @@ begin
TJSHTMLInputElement
(
document
.
getElementById
(
'edtbillingcity'
)).
classList
.
remove
(
'changed-field'
);
TJSHTMLInputElement
(
document
.
getElementById
(
'edtbillingstate'
)).
classList
.
remove
(
'changed-field'
);
TJSHTMLInputElement
(
document
.
getElementById
(
'edtbillingzip'
)).
classList
.
remove
(
'changed-field'
);
mode
:=
'EDIT'
;
end
;
end
;
...
...
@@ -592,9 +627,14 @@ begin
end
;
procedure
TFViewAddCustomer
.
Save
;
var
input
:
TJSHTMLInputElement
;
begin
await
(
sendCustomerToServer
());
await
(
GetCustomer
());
input
:=
TJSHTMLInputElement
(
document
.
getElementById
(
'edtrepuser'
));
input
.
classList
.
remove
(
'changed-field'
);
input
.
classList
.
remove
(
'is-invalid'
);
ViewMode
();
end
;
...
...
@@ -691,13 +731,13 @@ begin
xdwdsShipTo
.
Open
;
memoAddressBlock
.
Text
:=
string
(
customer
[
'staff_fields_invoice_to'
]);
console
.
log
(
customer
[
'SHIPPING_ADDRESS_LIST'
]);
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
;
memoShipBlock
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'
ADDRESS
'
).
AsString
;
memoShipBlock
.
Text
:=
xdwdsShipTo
.
FieldByName
(
'
ship_block
'
).
AsString
;
if
memoShipBlock
.
Lines
.
Count
>
0
then
edtFirstLine
.
Text
:=
memoShipBlock
.
Lines
[
0
]
else
...
...
@@ -914,8 +954,6 @@ begin
edtShippingContact
.
Enabled
:=
true
;
edtFirstLine
.
Enabled
:=
true
;
wdblcbRep
.
Enabled
:=
false
;
lblFormState
.
Caption
:=
'Edit Address'
;
lblFormState
.
ElementHandle
.
classList
.
remove
(
'text-danger'
);
lblFormState
.
ElementHandle
.
classList
.
add
(
'text-success'
);
...
...
@@ -949,7 +987,6 @@ begin
btnShipSave
.
Enabled
:=
false
;
btnShipCancel
.
Enabled
:=
false
;
wdblcbRep
.
Enabled
:=
true
;
lblFormState
.
Caption
:=
'View Mode'
;
lblFormState
.
ElementHandle
.
classList
.
remove
(
'text-success'
);
...
...
kgOrdersClient/View.Customer.Select.dfm
View file @
151f60b4
...
...
@@ -9,8 +9,8 @@ object FSelectCustomer: TFSelectCustomer
Width = 95
Height = 15
Caption = 'Search Customers'
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
end
object WebLabel2: TWebLabel
Left = 279
...
...
@@ -18,8 +18,8 @@ object FSelectCustomer: TFSelectCustomer
Width = 134
Height = 15
Caption = 'Selected Customer Name'
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
end
object WebLabel3: TWebLabel
Left = 131
...
...
@@ -27,8 +27,8 @@ object FSelectCustomer: TFSelectCustomer
Width = 113
Height = 15
Caption = 'Selected Customer ID'
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
end
object edtSearch: TWebEdit
Left = 4
...
...
@@ -36,8 +36,8 @@ object FSelectCustomer: TFSelectCustomer
Width = 121
Height = 22
ChildOrder = 2
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnChange = edtSearchChange
end
object edtName: TWebEdit
...
...
@@ -47,8 +47,8 @@ object FSelectCustomer: TFSelectCustomer
Height = 22
ChildOrder = 1
Enabled = False
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 0
...
...
@@ -59,7 +59,7 @@ object FSelectCustomer: TFSelectCustomer
ParentDoubleBuffered = False
DoubleBuffered = True
TabOrder = 2
DefaultRowHeight = 40.00000000000000000
0
DefaultRowHeight = 40.00000000000000000
FixedColumns = 0
ColumnCount = 4
Options.Bands.Enabled = True
...
...
@@ -85,7 +85,7 @@ object FSelectCustomer: TFSelectCustomer
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 90.00000000000000000
0
Width = 90.00000000000000000
end
item
BorderWidth = 1
...
...
@@ -100,7 +100,7 @@ object FSelectCustomer: TFSelectCustomer
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 150.00000000000000000
0
Width = 150.00000000000000000
end
item
BorderWidth = 1
...
...
@@ -115,7 +115,7 @@ object FSelectCustomer: TFSelectCustomer
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width =
200.0
00000000000000000
Width =
400.
00000000000000000
end
item
BorderWidth = 1
...
...
@@ -130,7 +130,7 @@ object FSelectCustomer: TFSelectCustomer
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width =
306.0
00000000000000000
Width =
106.
00000000000000000
end
item
BorderWidth = 1
...
...
@@ -145,7 +145,7 @@ object FSelectCustomer: TFSelectCustomer
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width =
90.0
00000000000000000
Width =
1.
00000000000000000
end>
DefaultFont.Charset = DEFAULT_CHARSET
DefaultFont.Color = clWindowText
...
...
@@ -206,6 +206,7 @@ object FSelectCustomer: TFSelectCustomer
ScrollMode = scmItemScrolling
DesignTimeSampleData = True
OnCellClick = TMSFNCGrid1CellClick
ExplicitLeft = 4
end
object btnCancel: TWebButton
Left = 556
...
...
@@ -214,8 +215,8 @@ object FSelectCustomer: TFSelectCustomer
Height = 25
Caption = 'Cancel'
ChildOrder = 5
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = btnCancelClick
end
object btnConfirm: TWebButton
...
...
@@ -225,8 +226,8 @@ object FSelectCustomer: TFSelectCustomer
Height = 25
Caption = 'Select'
ChildOrder = 5
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = btnConfirmClick
end
object edtID: TWebEdit
...
...
@@ -236,8 +237,8 @@ object FSelectCustomer: TFSelectCustomer
Height = 22
ChildOrder = 1
Enabled = False
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
...
...
@@ -257,44 +258,8 @@ object FSelectCustomer: TFSelectCustomer
object xdwdsCustomersId: TStringField
FieldName = 'Id'
end
object xdwdsCustomersPrimaryPhone: TStringField
FieldName = 'PrimaryPhone'
end
object xdwdsCustomersShipAddr: TStringField
FieldName = 'ShipAddr'
end
object xdwdsCustomersShipAddrLine1: TStringField
FieldName = 'ShipAddrLine1'
end
object xdwdsCustomersShipAddrCity: TStringField
FieldName = 'ShipAddrCity'
end
object xdwdsCustomersShipAddrState: TStringField
FieldName = 'ShipAddrState'
end
object xdwdsCustomersShipAddrZip: TStringField
FieldName = 'ShipAddrZip'
end
object xdwdsCustomersBillAddrLine1: TStringField
FieldName = 'BillAddrLine1'
end
object xdwdsCustomersBillAddrCity: TStringField
FieldName = 'BillAddrCity'
end
object xdwdsCustomersBillAddrState: TStringField
FieldName = 'BillAddrState'
end
object xdwdsCustomersBillAddrZip: TStringField
FieldName = 'BillAddrZip'
end
object xdwdsCustomersInKGOrders: TBooleanField
FieldName = 'In KGOrders'
end
object xdwdsCustomersBillAddrContact: TStringField
FieldName = 'BillAddrContact'
end
object xdwdsCustomersShipAddrContact: TStringField
FieldName = 'ShipAddrContact'
FieldName = 'InKGOrders'
end
end
object wdsCustomers: TWebDataSource
...
...
kgOrdersClient/View.Customer.Select.pas
View file @
151f60b4
...
...
@@ -27,21 +27,9 @@ type
xdwdsCustomersBillAddr
:
TStringField
;
xdwdsCustomersCompanyName
:
TStringField
;
xdwdsCustomersId
:
TStringField
;
xdwdsCustomersPrimaryPhone
:
TStringField
;
xdwdsCustomersShipAddr
:
TStringField
;
xdwdsCustomersShipAddrLine1
:
TStringField
;
xdwdsCustomersShipAddrCity
:
TStringField
;
xdwdsCustomersShipAddrState
:
TStringField
;
xdwdsCustomersShipAddrZip
:
TStringField
;
xdwdsCustomersBillAddrLine1
:
TStringField
;
xdwdsCustomersBillAddrCity
:
TStringField
;
xdwdsCustomersBillAddrState
:
TStringField
;
xdwdsCustomersBillAddrZip
:
TStringField
;
WebLabel3
:
TWebLabel
;
edtID
:
TWebEdit
;
xdwdsCustomersInKGOrders
:
TBooleanField
;
xdwdsCustomersBillAddrContact
:
TStringField
;
xdwdsCustomersShipAddrContact
:
TStringField
;
procedure
WebFormCreate
(
Sender
:
TObject
);
procedure
WebFormShow
(
Sender
:
TObject
);
procedure
btnConfirmClick
(
Sender
:
TObject
);
...
...
@@ -51,7 +39,6 @@ type
private
{ Private declarations }
[
Async
]
procedure
GetCustomers
();
[
Async
]
procedure
SendCustomerToServer
();
procedure
PopulateGridManually
();
procedure
ApplyFilter
();
var
...
...
@@ -99,41 +86,13 @@ begin
ShowToast
(
'Please Select a Customer'
,
'danger'
)
else
begin
if
(
string
(
self
.
Caption
).
ToLower
.
Contains
(
'add'
)
and
xdwdsCustomers
.
FieldByName
(
'In
KGOrders'
).
AsBoolean
)
then
if
(
string
(
self
.
Caption
).
ToLower
.
Contains
(
'add'
)
and
xdwdsCustomers
.
FieldByName
(
'InKGOrders'
).
AsBoolean
)
then
ShowToast
(
'failure:Customer Already in Database'
)
else
begin
if
string
(
self
.
Caption
).
ToLower
.
Contains
(
'link'
)
then
begin
confirm
:=
true
;
QB_ID
:=
xdwdsCustomers
.
FieldByName
(
'Id'
).
AsString
;
end
else
begin
xdwdsCustomers
.
Locate
(
'Id'
,
edtID
.
Text
,
[]);
CustomerJSON
:=
TJSONObject
.
Create
;
CustomerJSON
.
AddPair
(
'NAME'
,
xdwdsCustomers
.
FieldByName
(
'CompanyName'
).
AsString
);
CustomerJSON
.
AddPair
(
'QB_LIST_ID'
,
xdwdsCustomers
.
FieldByName
(
'Id'
).
AsString
);
CustomerJSON
.
AddPair
(
'PHONE'
,
xdwdsCustomers
.
FieldByName
(
'PrimaryPhone'
).
AsString
);
CustomerJSON
.
AddPair
(
'BILL_ADDRESS'
,
xdwdsCustomers
.
FieldByName
(
'BillAddrLine1'
).
AsString
);
CustomerJSON
.
AddPair
(
'BILL_CITY'
,
xdwdsCustomers
.
FieldByName
(
'BillAddrCity'
).
AsString
);
CustomerJSON
.
AddPair
(
'BILL_STATE'
,
xdwdsCustomers
.
FieldByName
(
'BillAddrState'
).
AsString
);
CustomerJSON
.
AddPair
(
'BILL_ZIP'
,
xdwdsCustomers
.
FieldByName
(
'BillAddrZip'
).
AsString
);
CustomerJSON
.
AddPair
(
'BILL_ADDRESS_BLOCK'
,
xdwdsCustomers
.
FieldByName
(
'BillAddr'
).
AsString
);
CustomerJSON
.
AddPair
(
'BILL_CONTACT'
,
xdwdsCustomers
.
FieldByName
(
'BillAddrContact'
).
AsString
);
CustomerJSON
.
AddPair
(
'address'
,
xdwdsCustomers
.
FieldByName
(
'ShipAddrLine1'
).
AsString
);
CustomerJSON
.
AddPair
(
'city'
,
xdwdsCustomers
.
FieldByName
(
'ShipAddrCity'
).
AsString
);
CustomerJSON
.
AddPair
(
'state'
,
xdwdsCustomers
.
FieldByName
(
'ShipAddrState'
).
AsString
);
CustomerJSON
.
AddPair
(
'zip'
,
xdwdsCustomers
.
FieldByName
(
'ShipAddrZip'
).
AsString
);
CustomerJSON
.
AddPair
(
'ship_block'
,
xdwdsCustomers
.
FieldByName
(
'ShipAddr'
).
AsString
);
CustomerJSON
.
AddPair
(
'contact'
,
xdwdsCustomers
.
FieldByName
(
'ShipAddrContact'
).
AsString
);
CustomerJSON
.
AddPair
(
'name'
,
xdwdsCustomers
.
FieldByName
(
'CompanyName'
).
AsString
);
CustomerJSON
.
AddPair
(
'mode'
,
'ADD'
);
FViewMain
.
ViewAddCustomer
(
''
,
CustomerJSON
.
ToString
);
end
;
confirm
:=
true
;
QB_ID
:=
xdwdsCustomers
.
FieldByName
(
'Id'
).
AsString
;
FViewMain
.
ViewAddCustomer
(
''
,
QB_ID
);
Close
();
end
;
end
;
...
...
@@ -155,10 +114,11 @@ begin
// Fetch data from XData service
xdcResponse
:=
await
(
XDataWebClient1
.
RawInvokeAsync
(
'ILookupService.getQBCustomers'
,
[]));
customerList
:=
TJSObject
(
xdcResponse
.
Result
);
console
.
log
(
customerList
);
// Load data into TXDataWebDataset
xdwdsCustomers
.
Close
;
xdwdsCustomers
.
SetJsonData
(
customerList
);
xdwdsCustomers
.
SetJsonData
(
customerList
[
'data'
]
);
xdwdsCustomers
.
Open
;
// Manually populate the grid
...
...
@@ -194,10 +154,10 @@ begin
while
not
xdwdsCustomers
.
EOF
do
begin
TMSFNCGrid1
.
RowCount
:=
RowIndex
+
1
;
TMSFNCGrid1
.
Cells
[
0
,
RowIndex
]
:=
xdwdsCustomers
.
FieldByName
(
'Id'
)
.
AsString
;
TMSFNCGrid1
.
Cells
[
1
,
RowIndex
]
:=
xdwdsCustomers
.
FieldByName
(
'CompanyName'
)
.
AsString
;
TMSFNCGrid1
.
Cells
[
2
,
RowIndex
]
:=
xdwdsCustomers
.
FieldByName
(
'BillAddr'
)
.
AsString
;
TMSFNCGrid1
.
Cells
[
3
,
RowIndex
]
:=
xdwdsCustomers
.
FieldByName
(
'In KGOrders'
)
.
AsString
;
TMSFNCGrid1
.
Cells
[
0
,
RowIndex
]
:=
xdwdsCustomers
Id
.
AsString
;
TMSFNCGrid1
.
Cells
[
1
,
RowIndex
]
:=
xdwdsCustomers
CompanyName
.
AsString
;
TMSFNCGrid1
.
Cells
[
2
,
RowIndex
]
:=
xdwdsCustomers
BillAddr
.
AsString
;
TMSFNCGrid1
.
Cells
[
3
,
RowIndex
]
:=
xdwdsCustomers
InKGOrders
.
AsString
;
Inc
(
RowIndex
);
xdwdsCustomers
.
Next
;
end
;
...
...
@@ -216,45 +176,6 @@ begin
edtName
.
Text
:=
TMSFNCGrid1
.
Cells
[
1
,
ARow
];
end
;
procedure
TFSelectCustomer
.
SendCustomerToServer
;
var
CustomerJSON
:
TJSONObject
;
Response
:
TXDataClientResponse
;
notification
:
TJSObject
;
begin
CustomerJSON
:=
TJSONObject
.
Create
;
CustomerJSON
.
AddPair
(
'NAME'
,
xdwdsCustomers
.
FieldByName
(
'CompanyName'
).
AsString
);
CustomerJSON
.
AddPair
(
'QB_LIST_ID'
,
xdwdsCustomers
.
FieldByName
(
'Id'
).
AsString
);
CustomerJSON
.
AddPair
(
'PHONE'
,
xdwdsCustomers
.
FieldByName
(
'PrimaryPhone'
).
AsString
);
CustomerJSON
.
AddPair
(
'BILL_ADDRESS'
,
xdwdsCustomers
.
FieldByName
(
'BillAddrLine1'
).
AsString
);
CustomerJSON
.
AddPair
(
'BILL_CITY'
,
xdwdsCustomers
.
FieldByName
(
'BillAddrCity'
).
AsString
);
CustomerJSON
.
AddPair
(
'BILL_STATE'
,
xdwdsCustomers
.
FieldByName
(
'BillAddrState'
).
AsString
);
CustomerJSON
.
AddPair
(
'BILL_ZIP'
,
xdwdsCustomers
.
FieldByName
(
'BillAddrZip'
).
AsString
);
CustomerJSON
.
AddPair
(
'BILL_ADDRESS_BLOCK'
,
xdwdsCustomers
.
FieldByName
(
'BillAddr'
).
AsString
);
CustomerJSON
.
AddPair
(
'address'
,
xdwdsCustomers
.
FieldByName
(
'ShipAddrLine1'
).
AsString
);
CustomerJSON
.
AddPair
(
'city'
,
xdwdsCustomers
.
FieldByName
(
'ShipAddrCity'
).
AsString
);
CustomerJSON
.
AddPair
(
'state'
,
xdwdsCustomers
.
FieldByName
(
'ShipAddrState'
).
AsString
);
CustomerJSON
.
AddPair
(
'zip'
,
xdwdsCustomers
.
FieldByName
(
'ShipAddrZip'
).
AsString
);
CustomerJSON
.
AddPair
(
'ship_block'
,
xdwdsCustomers
.
FieldByName
(
'ShipAddr'
).
AsString
);
CustomerJSON
.
AddPair
(
'name'
,
xdwdsCustomers
.
FieldByName
(
'CompanyName'
).
AsString
);
CustomerJSON
.
AddPair
(
'mode'
,
'ADD'
);
Utils
.
ShowSpinner
(
'spinner'
);
Response
:=
await
(
XDataWebClient1
.
RawInvokeAsync
(
'ILookupService.ImportQBCustomer'
,
[
customerJSON
.
ToString
]));
notification
:=
TJSObject
(
Response
.
Result
);
customerID
:=
string
(
notification
[
'CustomerID'
]);
msg
:=
string
(
notification
[
'status'
]);
Utils
.
HideSpinner
(
'spinner'
);
FViewMain
.
ViewAddCustomer
(
customerID
,
msg
);
Close
();
end
;
procedure
TFSelectCustomer
.
ApplyFilter
;
// filters the grid based on search textbox contents.
var
...
...
kgOrdersClient/View.Customers.dfm
View file @
151f60b4
...
...
@@ -13,8 +13,8 @@ object FViewCustomers: TFViewCustomers
ElementID = 'lblentries'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
end
object btnAddCustomer: TWebButton
Left = 12
...
...
@@ -26,10 +26,10 @@ object FViewCustomers: TFViewCustomers
ElementID = 'btnaddcustomer'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
TabOrder = 6
TabStop = False
WidthPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
OnClick = btnAddCustomerClick
end
object wcbPageSize: TWebComboBox
...
...
@@ -41,9 +41,9 @@ object FViewCustomers: TFViewCustomers
ElementID = 'wcbpagesize'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
Text = '50'
WidthPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
OnChange = wcbPageSizeChange
ItemIndex = -1
Items.Strings = (
...
...
@@ -66,8 +66,8 @@ object FViewCustomers: TFViewCustomers
Height = 15
Caption = 'Message'
ElementID = 'view.login.message.label'
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
...
...
@@ -76,8 +76,8 @@ object FViewCustomers: TFViewCustomers
Height = 25
ChildOrder = 1
ElementID = 'view.login.message.button'
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
end
end
object wdbtcCustomers: TWebDBTableControl
...
...
@@ -129,10 +129,6 @@ object FViewCustomers: TFViewCustomers
item
DataField = 'NAME'
Title = 'Customer Name'
end
item
DataField = 'START_DATE'
Title = 'Start Date'
end>
DataSource = wdsCustomers
end
...
...
@@ -143,8 +139,8 @@ object FViewCustomers: TFViewCustomers
Height = 22
ChildOrder = 5
ElementID = 'edtfilter'
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnChange = edtFilterChange
end
object XDataWebClient1: TXDataWebClient
...
...
kgOrdersClient/View.Main.dfm
View file @
151f60b4
...
...
@@ -18,9 +18,9 @@ object FViewMain: TFViewMain
Caption = 'lblUsername'
ElementID = 'view.main.username'
ElementPosition = epRelative
HeightPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
Transparent = False
WidthPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
end
object wllblUserProfile: TWebLinkLabel
Left = 529
...
...
@@ -28,8 +28,8 @@ object FViewMain: TFViewMain
Width = 59
Height = 14
ElementID = 'dropdown.menu.userprofile'
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = wllblUserProfileClick
Caption = ' User Profile'
end
...
...
@@ -39,8 +39,8 @@ object FViewMain: TFViewMain
Width = 36
Height = 14
ElementID = 'dropdown.menu.logout'
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = wllblLogoutClick
Caption = ' Logout'
end
...
...
@@ -50,8 +50,8 @@ object FViewMain: TFViewMain
Width = 27
Height = 14
ElementID = 'dropdown.menu.home'
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = lblHomeClick
Caption = 'Home'
end
...
...
@@ -63,9 +63,9 @@ object FViewMain: TFViewMain
Caption = 'Koehler-Gibson'
ElementID = 'view.main.apptitle'
ElementPosition = epRelative
HeightPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
Transparent = False
WidthPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
end
object lblItemsList: TWebLinkLabel
Left = 560
...
...
@@ -74,8 +74,8 @@ object FViewMain: TFViewMain
Height = 14
ElementID = 'dropdown.menu.itemlist'
ElementFont = efCSS
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = lblItemsListClick
Caption = 'Items'
end
...
...
@@ -86,8 +86,8 @@ object FViewMain: TFViewMain
Height = 14
ElementID = 'dropdown.menu.users'
ElementFont = efCSS
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = lblUsersClick
Caption = 'Users'
end
...
...
@@ -101,8 +101,8 @@ object FViewMain: TFViewMain
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = lblordersClick
end
object lblCustomers: TWebLabel
...
...
@@ -115,8 +115,8 @@ object FViewMain: TFViewMain
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = lblCustomersClick
end
object lblVersion: TWebLabel
...
...
@@ -129,8 +129,8 @@ object FViewMain: TFViewMain
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
end
object lblQBInfo: TWebLabel
Left = 552
...
...
@@ -141,8 +141,8 @@ object FViewMain: TFViewMain
ElementID = 'dropdown.menu.linktoqb'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = lblQBInfoClick
end
object WebPanel1: TWebPanel
...
...
@@ -173,7 +173,7 @@ object FViewMain: TFViewMain
ElementID = 'main.debugmemo'
ElementPosition = epRelative
Enabled = False
HeightPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
Lines.Strings = (
'WebMemo1')
Role = 'null'
...
...
@@ -181,7 +181,7 @@ object FViewMain: TFViewMain
SelStart = 0
ShowFocus = False
Visible = False
WidthPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
end
object WebMessageDlg1: TWebMessageDlg
Left = 47
...
...
@@ -208,7 +208,7 @@ object FViewMain: TFViewMain
'No to all'
'Help'
'Close')
Opacity = 0.20000000000000000
0
Opacity = 0.20000000000000000
end
object XDataWebClient: TXDataWebClient
Connection = DMConnection.ApiConnection
...
...
kgOrdersClient/View.Main.pas
View file @
151f60b4
...
...
@@ -60,7 +60,7 @@ type
procedure
ViewOrders
(
info
:
string
);
procedure
ViewCustomerList
(
info
:
string
);
procedure
ShowUserForm
(
Info
:
string
);
procedure
ViewAddCustomer
(
cust
omerInfo
,
info
:
string
);
procedure
ViewAddCustomer
(
cust
ID
,
custQB_ID
:
string
);
var
search
:
string
;
change
:
boolean
;
...
...
@@ -361,12 +361,12 @@ begin
end
;
procedure
TFViewMain
.
ViewAddCustomer
(
cust
omerInfo
:
string
;
info
:
string
);
procedure
TFViewMain
.
ViewAddCustomer
(
cust
ID
:
string
;
custQB_ID
:
string
);
begin
lblAppTitle
.
Caption
:=
'Koehler-Gibson Add Customer'
;
if
Assigned
(
FChildForm
)
then
FChildForm
.
Free
;
FChildForm
:=
TFViewAddCustomer
.
CreateForm
(
WebPanel1
.
ElementID
,
cust
omerInfo
,
info
);
FChildForm
:=
TFViewAddCustomer
.
CreateForm
(
WebPanel1
.
ElementID
,
cust
ID
,
custQB_ID
);
end
;
...
...
kgOrdersClient/View.QBInfo.dfm
View file @
151f60b4
...
...
@@ -13,9 +13,9 @@ object FQBInfo: TFQBInfo
Font.Height = -24
Font.Name = 'Segoe UI'
Font.Style = []
HeightPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
ParentFont = False
WidthPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
end
object lblCompanyName: TWebLabel
Left = 16
...
...
@@ -28,9 +28,9 @@ object FQBInfo: TFQBInfo
Font.Height = -16
Font.Name = 'Segoe UI'
Font.Style = []
HeightPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
ParentFont = False
WidthPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
end
object lblCompanyID: TWebLabel
Left = 15
...
...
@@ -43,9 +43,9 @@ object FQBInfo: TFQBInfo
Font.Height = -16
Font.Name = 'Segoe UI'
Font.Style = []
HeightPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
ParentFont = False
WidthPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
end
object lblLastRefresh: TWebLabel
Left = 16
...
...
@@ -58,9 +58,9 @@ object FQBInfo: TFQBInfo
Font.Height = -16
Font.Name = 'Segoe UI'
Font.Style = []
HeightPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
ParentFont = False
WidthPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
end
object btnLinkToQB: TWebButton
Left = 235
...
...
@@ -69,8 +69,8 @@ object FQBInfo: TFQBInfo
Height = 25
Caption = 'Link to QB'
ChildOrder = 3
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = btnLinkToQBClick
end
object btnClose: TWebButton
...
...
@@ -80,8 +80,8 @@ object FQBInfo: TFQBInfo
Height = 25
Caption = 'Close'
ChildOrder = 3
HeightPercent = 100.00000000000000000
0
WidthPercent = 100.00000000000000000
0
HeightPercent = 100.00000000000000000
WidthPercent = 100.00000000000000000
OnClick = btnCloseClick
end
object XDataWebClient1: TXDataWebClient
...
...
kgOrdersClient/View.QBInfo.pas
View file @
151f60b4
...
...
@@ -24,6 +24,7 @@ type
{ Private declarations }
ClientID
:
string
;
[
async
]
procedure
GetQBInfo
();
[
async
]
procedure
GetQBLink
();
public
{ Public declarations }
end
;
...
...
@@ -38,22 +39,8 @@ implementation
uses
View
.
Main
,
Utils
;
procedure
TFQBInfo
.
btnLinkToQBClick
(
Sender
:
TObject
);
var
qblink
,
redirectUri
:
string
;
qbWindow
:
TJSWindow
;
begin
qblink
:=
'https://appcenter.intuit.com/connect/oauth2'
;
qblink
:=
qblink
+
'?client_id='
+
ClientID
;
qblink
:=
qblink
+
'&response_type=code'
;
qblink
:=
qblink
+
'&scope=com.intuit.quickbooks.accounting'
;
qblink
:=
qblink
+
'&state=7'
;
redirectUri
:=
DMConnection
.
AuthConnection
.
URL
+
'AuthService/QBAuthorize'
;
qblink
:=
qblink
+
'&redirect_uri='
+
RedirectUri
;
qbWindow
:=
window
.
open
(
''
,
'_blank'
);
if
Assigned
(
qbWindow
)
then
qbWindow
.
location
.
href
:=
qbLink
;
Close
();
GetQBLink
();
end
;
procedure
TFQBInfo
.
WebFormCreate
(
Sender
:
TObject
);
...
...
@@ -103,5 +90,29 @@ begin
end
;
end
;
procedure
TFQBInfo
.
GetQBLink
();
var
xdcResponse
:
TXDataClientResponse
;
QBLinkObj
:
TJSObject
;
QBLink
:
String
;
qbWindow
:
TJSWindow
;
begin
try
xdcResponse
:=
await
(
XDataWebClient1
.
RawInvokeAsync
(
'ILookupService.getQBLink'
,
[]));
QBLinkObj
:=
TJSObject
(
xdcResponse
.
Result
);
QBLink
:=
String
(
QBLinkObj
[
'value'
]);
console
.
log
(
QBLinkObj
);
console
.
log
(
QBLink
);
qbWindow
:=
window
.
open
(
''
,
'_blank'
);
if
Assigned
(
qbWindow
)
then
qbWindow
.
location
.
href
:=
QBLink
;
Close
();
except
on
E
:
EXDataClientRequestException
do
Utils
.
ShowErrorModal
(
E
.
ErrorResult
.
ErrorMessage
);
end
;
end
;
end
.
kgOrdersClient/Win64/Debug/TMSWebRunner.ini
0 → 100644
View file @
151f60b4
[Paths]
HtmlPath
=
C:
\P
rojects
\k
gOrders
\k
gOrders
\k
gOrdersClient
\T
MSWeb
\D
ebug
HtmlFile
=
index.html
DefaultURL
=
http://127.0.0.1:8000/webKGOrders
SingleInstance
=
0
Debug
=
0
DebugManager
=
C:
\R
ADTools
\T
MS
\P
roducts
\t
ms.webcore
\B
in
\W
in32
\T
MSDBGManager.exe
URL
=
http://127.0.0.1:8000/$(ProjectName)
URLParams
=
Browser
=
1
BrowserBin
=
BrowserParams
=
Electron
=
0
ElectronBuild
=
0
JSDebugger
=
0
kgOrdersServer/Source/Api.Database.dfm
View file @
151f60b4
...
...
@@ -411,25 +411,10 @@ object ApiDatabase: TApiDatabase
Connection = ucKG
SQL.Strings = (
'SELECT USER_ID, NAME, STATUS from users ORDER BY NAME')
OnCalcFields = uqUsersCalcFields
Left = 318
Top = 252
object uqUsersUSER_ID: TIntegerField
FieldName = 'USER_ID'
Required = True
end
object uqUsersNAME: TStringField
FieldName = 'NAME'
Size = 40
end
object uqUsersSTATUS: TStringField
FieldName = 'STATUS'
Size = 7
end
object uqUsersREPRESENTATIVE: TStringField
FieldKind = fkCalculated
FieldName = 'REPRESENTATIVE'
Calculated = True
object uqUsersQB_ID: TStringField
FieldName = 'QB_ID'
end
end
end
kgOrdersServer/Source/Api.Database.pas
View file @
151f60b4
...
...
@@ -113,12 +113,8 @@ type
uqOrdersStatusScheduleUSER_ID
:
TLongWordField
;
uqOrdersStatusScheduleORDER_REVISION
:
TLongWordField
;
uqUsers
:
TUniQuery
;
uqUsersUSER_ID
:
TIntegerField
;
uqUsersNAME
:
TStringField
;
uqUsersSTATUS
:
TStringField
;
uqUsersREPRESENTATIVE
:
TStringField
;
uqUsersQB_ID
:
TStringField
;
procedure
DataModuleCreate
(
Sender
:
TObject
);
procedure
uqUsersCalcFields
(
DataSet
:
TDataSet
);
private
{ Private declarations }
public
...
...
@@ -166,10 +162,4 @@ begin
end
;
procedure
TApiDatabase
.
uqUsersCalcFields
(
DataSet
:
TDataSet
);
begin
uqUsersREPRESENTATIVE
.
AsString
:=
uqUsersNAME
.
AsString
+
'('
+
uqUsersSTATUS
.
AsString
+
')'
;
end
;
end
.
kgOrdersServer/Source/Lookup.Service.pas
View file @
151f60b4
...
...
@@ -20,9 +20,42 @@ const
API_MODEL
=
'Api'
;
type
TQBCustomer
=
class
public
CUSTOMER_ID
:
string
;
NAME
:
string
;
BILL_ADDRESS
:
string
;
BILL_CITY
:
string
;
BILL_STATE
:
string
;
BILL_ZIP
:
string
;
BILL_CONTACT
:
string
;
BILL_ADDRESS_BLOCK
:
string
;
QB_LIST_ID
:
string
;
RepUser
:
string
;
ship_block
:
string
;
shipping_address
:
string
;
city
:
string
;
state
:
string
;
zip
:
string
;
contact
:
string
;
end
;
TQBCustomerItem
=
class
public
Id
:
string
;
CompanyName
:
string
;
BillAddr
:
string
;
InKGOrders
:
boolean
;
end
;
TQBCustomerList
=
class
public
count
:
integer
;
data
:
TList
<
TQBCustomerItem
>;
end
;
TQBInfo
=
class
public
clientID
:
string
;
CompanyName
:
string
;
CompanyID
:
string
;
connected
:
boolean
;
...
...
@@ -120,7 +153,7 @@ type
TAddressItem
=
class
Public
ADDRESS
:
string
;
ship_block
:
string
;
shipping_address
:
string
;
city
:
string
;
state
:
string
;
...
...
@@ -145,9 +178,8 @@ type
END_DATE
:
string
;
QB_LIST_ID
:
string
;
FFAX
:
string
;
REP_USER_ID
:
string
;
QB_TYPE
:
string
;
SHIPPING_ADDRESS_LIST
:
TList
<
TAddressItem
>;
REP_USERS
:
TList
<
TUserItem
>;
end
;
TCustomerList
=
class
...
...
@@ -492,12 +524,14 @@ type
[
HttpGet
]
function
GenerateOrderCorrugatedPDF
(
orderID
:
string
):
string
;
[
HttpGet
]
function
GenerateOrderWebPDF
(
orderID
:
string
):
string
;
[
HttpGet
]
function
GenerateOrderCuttingPDF
(
orderID
:
string
):
string
;
[
HttpGet
]
function
getQBCustomers
():
T
JSONArray
;
[
HttpGet
]
function
getQBCustomers
():
T
QBCustomerList
;
[
HttpGet
]
function
getQBItems
():
TJSONArray
;
[
HttpGet
]
function
GetRepUsers
():
TList
<
TUserItem
>;
[
HttpGet
]
function
UpdateCustomer
(
QB_ID
:
string
):
TCustomerItem
;
[
HttpGet
]
function
UpdateItem
(
itemName
:
string
):
TItemItem
;
[
HttpGet
]
function
GetQBInfo
():
TQBInfo
;
[
HttpGet
]
function
GetQBLink
():
string
;
[
HttpGet
]
function
GetQBCustomer
(
QB_ID
:
string
):
TQBCustomer
;
function
AddUser
(
userInfo
:
string
):
string
;
...
...
kgOrdersServer/Source/Lookup.ServiceImpl.pas
View file @
151f60b4
...
...
@@ -36,12 +36,15 @@ type
function
GetCustomer
(
ID
:
string
):
TCustomerItem
;
function
GetWebOrder
(
orderInfo
:
string
):
TWebOrder
;
function
GetCuttingDieOrder
(
orderInfo
:
string
):
TCuttingDie
;
function
GetQBCustomers
:
T
JSONArray
;
function
GetQBCustomers
:
T
QBCustomerList
;
function
GetQBItems
:
TJSONArray
;
function
GetRepUsers
():
TList
<
TUserItem
>;
function
UpdateCustomer
(
QB_ID
:
string
):
TCustomerItem
;
function
UpdateItem
(
itemName
:
string
):
TItemItem
;
function
GetQBInfo
():
TQBInfo
;
function
GetQBLink
():
string
;
function
GetQBCustomer
(
QB_ID
:
string
):
TQBCustomer
;
function
GetCustomerType
(
CustomerTypeId
:
string
):
string
;
function
EditUser
(
const
editOptions
:
string
):
string
;
...
...
@@ -104,19 +107,15 @@ var
LastRefresh
:
TDateTime
;
iniFile
:
TIniFile
;
begin
logger
.
Log
(
3
,
'TLookupService.GetQBI
tems
'
);
iniFile
:=
nil
;
restClient
:=
nil
;
restRequest
:=
nil
;
restResponse
:=
nil
;
logger
.
Log
(
3
,
'TLookupService.GetQBI
nfo - start
'
);
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
)
;
restClient
:=
TRESTClient
.
Create
(
nil
)
;
restRequest
:=
TRESTRequest
.
Create
(
nil
)
;
restResponse
:=
TRESTResponse
.
Create
(
nil
)
;
try
try
result
:=
TQBInfo
.
Create
;
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
restClient
:=
TRESTClient
.
Create
(
nil
);
restRequest
:=
TRESTRequest
.
Create
(
nil
);
restResponse
:=
TRESTResponse
.
Create
(
nil
);
result
.
clientID
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'ClientID'
,
''
);
if
iniFile
.
ReadString
(
'Quickbooks'
,
'CompanyID'
,
''
)
=
''
then
begin
result
.
connected
:=
false
;
...
...
@@ -167,8 +166,8 @@ begin
except
on
E
:
Exception
do
begin
Logger
.
Log
(
1
,
'Error in getQBI
tems
: '
+
E
.
Message
);
raise
EXDataHttpException
.
Create
(
500
,
'Unable to retrieve QuickBooks I
tems
: A QuickBooks interface error has occurred!'
);
Logger
.
Log
(
1
,
'Error in getQBI
nfo
: '
+
E
.
Message
);
raise
EXDataHttpException
.
Create
(
500
,
'Unable to retrieve QuickBooks I
nfo
: A QuickBooks interface error has occurred!'
);
end
;
end
;
finally
...
...
@@ -179,6 +178,29 @@ begin
end
;
end
;
function
TLookupService
.
GetQBLink
():
string
;
var
iniFile
:
TIniFile
;
qbLink
,
ClientID
,
RedirectUri
:
string
;
begin
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
try
ClientID
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'ClientID'
,
''
);
RedirectUri
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'RedirectUri'
,
''
);
qblink
:=
'https://appcenter.intuit.com/connect/oauth2'
+
'?client_id='
+
ClientID
+
'&response_type=code'
+
'&scope=com.intuit.quickbooks.accounting'
+
'&state=7'
+
'&redirect_uri='
+
RedirectUri
;
result
:=
qbLink
;
finally
iniFile
.
Free
;
end
;
end
;
function
TLookupService
.
addEstimate
(
orderInfo
:
string
):
TJSONObject
;
var
iniFile
:
TIniFile
;
...
...
@@ -612,7 +634,7 @@ begin
result
.
END_DATE
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'END_DATE'
).
AsString
;
result
.
QB_LIST_ID
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'QB_LIST_ID'
).
AsString
;
result
.
FFAX
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'FAX'
).
AsString
;
result
.
REP_USER_ID
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'REP_USER_ID
'
).
AsString
;
result
.
QB_TYPE
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'QB_TYPE
'
).
AsString
;
result
.
SHIPPING_ADDRESS_LIST
:=
TList
<
TAddressItem
>.
Create
;
TXDataOperationContext
.
Current
.
Handler
.
ManagedObjects
.
Add
(
Result
.
SHIPPING_ADDRESS_LIST
);
...
...
@@ -620,7 +642,7 @@ begin
begin
ADDRESS
:=
TAddressItem
.
Create
;
TXDataOperationContext
.
Current
.
Handler
.
ManagedObjects
.
Add
(
ADDRESS
);
ADDRESS
.
ADDRESS
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'ship_block'
).
AsString
;
ADDRESS
.
ship_block
:=
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
;
...
...
@@ -649,7 +671,7 @@ var
SQL
:
string
;
begin
Logger
.
Log
(
3
,
'TLookupService.GetRepUsers - start'
);
SQL
:=
'SELECT
USER_ID, NAME, STATUS from users
ORDER BY NAME'
;
SQL
:=
'SELECT
QB_ID from users WHERE STATUS = '
+
quotedStr
(
'ACTIVE'
)
+
'
ORDER BY NAME'
;
result
:=
TList
<
TUserItem
>.
Create
;
logger
.
Log
(
5
,
'Retrieving Rep Users with SQL: '
+
SQL
);
doQuery
(
ordersDB
.
uqUsers
,
SQL
);
...
...
@@ -657,9 +679,7 @@ begin
begin
USER
:=
TUserItem
.
Create
;
TXDataOperationContext
.
Current
.
Handler
.
ManagedObjects
.
Add
(
USER
);
USER
.
userID
:=
ordersDB
.
uqUsersUSER_ID
.
AsString
;
USER
.
full_name
:=
ordersDB
.
uqUsersNAME
.
AsString
;
USER
.
representative
:=
ordersDB
.
uqUsersREPRESENTATIVE
.
AsString
;
USER
.
QBID
:=
ordersDB
.
uqUsersQB_ID
.
AsString
;
result
.
Add
(
USER
);
ordersDB
.
uqUsers
.
Next
;
end
;
...
...
@@ -2798,7 +2818,7 @@ begin
ordersDB
.
UniQuery1
.
Post
;
end
;
function
TLookupService
.
getQBCustomers
:
TJSONArray
;
function
TLookupService
.
getQBCustomers
():
TQBCustomerList
;
var
iniFile
:
TIniFile
;
restClient
:
TRESTClient
;
...
...
@@ -2807,7 +2827,8 @@ var
param
:
TRESTRequestParameter
;
res
:
string
;
jsValue
:
TJSONValue
;
ParsedCustomer
,
Customer
,
BillAddr
:
TJSONObject
;
Customer
,
BillAddr
:
TJSONObject
;
ParsedCustomer
:
TQBCustomerItem
;
jsObj
:
TJSONObject
;
PhoneObj
:
TJSONObject
;
CustomerList
:
TJSONArray
;
...
...
@@ -2817,7 +2838,7 @@ var
SQL
:
string
;
begin
logger
.
Log
(
3
,
'TLookupService.GetQBCustomers'
);
Result
:=
T
JSONArray
.
Create
;
Result
:=
T
QBCustomerList
.
Create
;
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
restClient
:=
TRESTClient
.
Create
(
nil
);
restRequest
:=
TRESTRequest
.
Create
(
nil
);
...
...
@@ -2856,6 +2877,15 @@ begin
restRequest
.
Execute
;
if
restResponse
.
StatusCode
<>
200
then
begin
Logger
.
Log
(
1
,
'QBO Error: '
+
restResponse
.
StatusText
+
' - '
+
restResponse
.
Content
);
raise
EXDataHttpException
.
Create
(
restResponse
.
StatusCode
,
'QuickBooks API Error: '
+
restResponse
.
StatusText
);
end
;
jsValue
:=
restResponse
.
JSONValue
;
if
not
Assigned
(
jsValue
)
then
Exit
;
...
...
@@ -2868,118 +2898,338 @@ begin
if
not
Assigned
(
CustomerList
)
then
Exit
;
Result
.
data
:=
TList
<
TQBCustomerItem
>.
Create
;
TXDataOperationContext
.
Current
.
Handler
.
ManagedObjects
.
Add
(
Result
.
data
);
for
I
:=
0
to
CustomerList
.
Count
-
1
do
begin
Customer
:=
CustomerList
.
Items
[
I
]
as
TJSONObject
;
ParsedCustomer
:=
TJSONObject
.
Create
;
ParsedCustomer
:=
TQBCustomerItem
.
Create
;
TXDataOperationContext
.
Current
.
Handler
.
ManagedObjects
.
Add
(
ParsedCustomer
);
sql
:=
'select CUSTOMER_ID from customers where QB_LIST_ID = '
+
Customer
.
GetValue
<
string
>(
'Id'
);
doQuery
(
ordersDB
.
UniQuery1
,
SQL
);
try
ParsedCustomer
.
AddPair
(
'In KGOrders'
,
not
(
ordersDB
.
UniQuery1
.
IsEmpty
));
ParsedCustomer
.
AddPair
(
'Id'
,
Customer
.
GetValue
<
string
>(
'Id'
));
ParsedCustomer
.
AddPair
(
'CompanyName'
,
Customer
.
GetValue
<
string
>(
'DisplayName'
));
if
Customer
.
TryGetValue
<
TJSONObject
>(
'PrimaryPhone'
,
PhoneObj
)
then
ParsedCustomer
.
AddPair
(
'PrimaryPhone'
,
PhoneObj
.
GetValue
<
string
>(
'FreeFormNumber'
));
ParsedCustomer
.
InKGOrders
:=
not
(
ordersDB
.
UniQuery1
.
IsEmpty
);
ParsedCustomer
.
Id
:=
Customer
.
GetValue
<
string
>(
'Id'
);
ParsedCustomer
.
CompanyName
:=
Customer
.
GetValue
<
string
>(
'DisplayName'
);
// Handle Bill Address
if
Customer
.
GetValue
(
'BillAddr'
)
is
TJSONObject
then
begin
BillAddr
:=
Customer
.
GetValue
(
'BillAddr'
)
as
TJSONObject
;
Line1
:=
BillAddr
.
GetValue
<
string
>(
'Line1'
,
''
);
Line2
:=
BillAddr
.
GetValue
<
string
>(
'Line2'
,
''
);
ParsedCustomer
.
AddPair
(
'BillAddrLine1'
,
TJSONString
.
Create
(
BillAddr
.
GetValue
<
string
>(
'Line1'
,
''
)));
ParsedCustomer
.
AddPair
(
'BillAddrCity'
,
TJSONString
.
Create
(
BillAddr
.
GetValue
<
string
>(
'City'
,
''
)));
ParsedCustomer
.
AddPair
(
'BillAddrState'
,
TJSONString
.
Create
(
BillAddr
.
GetValue
<
string
>(
'CountrySubDivisionCode'
,
''
)));
ParsedCustomer
.
AddPair
(
'BillAddrZip'
,
TJSONString
.
Create
(
BillAddr
.
GetValue
<
string
>(
'PostalCode'
,
''
)));
if
Line2
<>
''
then
begin
ParsedCustomer
.
AddPair
(
'BillAddrLine1'
,
TJSONString
.
Create
(
Line2
));
ParsedCustomer
.
AddPair
(
'BillAddrContact'
,
TJSONString
.
Create
(
Line1
));
ParsedCustomer
.
AddPair
(
'BillAddr'
,
TJSONString
.
Create
(
Customer
.
GetValue
<
string
>(
'DisplayName'
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'Line1'
,
''
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'Line2'
,
''
)
+
sLineBreak
+
ParsedCustomer
.
BillAddr
:=
Customer
.
GetValue
<
string
>(
'DisplayName'
)
+
' '
+
BillAddr
.
GetValue
(
'Line1'
,
''
)
+
' '
+
BillAddr
.
GetValue
(
'Line2'
,
''
)
+
' '
+
BillAddr
.
GetValue
(
'City'
,
''
)
+
', '
+
BillAddr
.
GetValue
(
'CountrySubDivisionCode'
,
''
)
+
' '
+
BillAddr
.
GetValue
(
'PostalCode'
,
''
)
)
);
BillAddr
.
GetValue
(
'PostalCode'
,
''
);
end
else
begin
ParsedCustomer
.
AddPair
(
'BillAddrLine1'
,
TJSONString
.
Create
(
Line1
));
ParsedCustomer
.
AddPair
(
'BillAddrContact'
,
''
);
ParsedCustomer
.
AddPair
(
'BillAddr'
,
TJSONString
.
Create
(
Customer
.
GetValue
<
string
>(
'DisplayName'
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'Line1'
,
''
)
+
sLineBreak
+
ParsedCustomer
.
BillAddr
:=
Customer
.
GetValue
<
string
>(
'DisplayName'
)
+
' '
+
BillAddr
.
GetValue
(
'Line1'
,
''
)
+
' '
+
BillAddr
.
GetValue
(
'City'
,
''
)
+
', '
+
BillAddr
.
GetValue
(
'CountrySubDivisionCode'
,
''
)
+
' '
+
BillAddr
.
GetValue
(
'PostalCode'
,
''
)
)
);
BillAddr
.
GetValue
(
'PostalCode'
,
''
);
end
;
end
;
Result
.
data
.
Add
(
ParsedCustomer
);
except
ParsedCustomer
.
Free
;
raise
;
end
;
end
;
except
on
E
:
Exception
do
begin
Logger
.
Log
(
2
,
'Error in getQBCustomers: '
+
E
.
Message
);
raise
EXDataHttpException
.
Create
(
500
,
'Unable to retrieve QuickBooks Customers: A QuickBooks interface error has occurred!'
);
end
;
end
;
finally
iniFile
.
Free
;
restClient
.
Free
;
restRequest
.
Free
;
restResponse
.
Free
;
end
;
end
;
function
TLookupService
.
GetQBCustomer
(
QB_ID
:
string
):
TQBCustomer
;
var
iniFile
:
TIniFile
;
restClient
:
TRESTClient
;
restRequest
:
TRESTRequest
;
restResponse
:
TRESTResponse
;
param
:
TRESTRequestParameter
;
res
:
string
;
jsValue
:
TJSONValue
;
Customer
,
BillAddr
,
ShipAddr
,
CustomerTypeRef
:
TJSONObject
;
ParsedCustomer
:
TQBCustomer
;
jsObj
:
TJSONObject
;
PhoneObj
:
TJSONObject
;
CustomerList
:
TJSONArray
;
AccessToken
,
RefreshToken
,
CompanyID
,
Client
,
Secret
,
BaseUrl
,
Line1
,
Line2
:
string
;
LastRefresh
:
TDateTime
;
I
:
integer
;
SQL
,
CustomerTypeID
:
string
;
begin
logger
.
Log
(
3
,
'TLookupService.GetQBCustomer - start'
);
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
restClient
:=
TRESTClient
.
Create
(
nil
);
restRequest
:=
TRESTRequest
.
Create
(
nil
);
restResponse
:=
TRESTResponse
.
Create
(
nil
);
try
try
restRequest
.
Client
:=
restClient
;
restRequest
.
Response
:=
restResponse
;
if
iniFile
.
ReadString
(
'Quickbooks'
,
'LastRefresh'
,
''
)
=
''
then
LastRefresh
:=
0
else
LastRefresh
:=
StrToDateTime
(
iniFile
.
ReadString
(
'Quickbooks'
,
'LastRefresh'
,
''
));
if
MinutesBetween
(
Now
,
LastRefresh
)
>
58
then
RefreshAccessToken
();
Client
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'ClientID'
,
''
);
Secret
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'ClientSecret'
,
''
);
CompanyID
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'CompanyID'
,
''
);
RefreshToken
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'RefreshToken'
,
''
);
AccessToken
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'AccessToken'
,
''
);
BaseUrl
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'BaseUrl'
,
''
);
restClient
.
BaseURL
:=
BaseUrl
;
restRequest
.
Method
:=
rmGET
;
res
:=
'/v3/company/'
+
CompanyID
+
'/query?query=select * from Customer where Id = '
+
quotedStr
(
QB_ID
)
+
'&minorversion=75'
;
restRequest
.
Resource
:=
res
;
param
:=
restRequest
.
Params
.
AddItem
;
param
.
Name
:=
'Authorization'
;
param
.
Kind
:=
pkHTTPHEADER
;
param
.
Options
:=
param
.
Options
+
[
TRESTRequestParameterOption
.
poDoNotEncode
];
param
.
Value
:=
'Bearer '
+
AccessToken
;
restRequest
.
Execute
;
if
restResponse
.
StatusCode
<>
200
then
begin
Logger
.
Log
(
1
,
'QBO Error: '
+
restResponse
.
StatusText
+
' - '
+
restResponse
.
Content
);
raise
EXDataHttpException
.
Create
(
restResponse
.
StatusCode
,
'QuickBooks API Error: '
+
restResponse
.
StatusText
);
end
;
jsValue
:=
restResponse
.
JSONValue
;
if
not
Assigned
(
jsValue
)
then
Exit
;
jsObj
:=
jsValue
as
TJSONObject
;
if
not
Assigned
(
jsObj
)
then
Exit
;
CustomerList
:=
jsObj
.
GetValue
<
TJSONArray
>(
'QueryResponse.Customer'
);
if
not
Assigned
(
CustomerList
)
then
Exit
;
for
I
:=
0
to
CustomerList
.
Count
-
1
do
begin
Customer
:=
CustomerList
.
Items
[
I
]
as
TJSONObject
;
logger
.
Log
(
5
,
Customer
.
ToJSON
());
ParsedCustomer
:=
TQBCustomer
.
Create
;
TXDataOperationContext
.
Current
.
Handler
.
ManagedObjects
.
Add
(
ParsedCustomer
);
try
ParsedCustomer
.
QB_LIST_ID
:=
Customer
.
GetValue
<
string
>(
'Id'
);
ParsedCustomer
.
NAME
:=
Customer
.
GetValue
<
string
>(
'DisplayName'
);
// Handle Bill Address
if
Customer
.
GetValue
(
'BillAddr'
)
is
TJSONObject
then
begin
BillAddr
:=
Customer
.
GetValue
(
'BillAddr'
)
as
TJSONObject
;
ParsedCustomer
.
BILL_CITY
:=
BillAddr
.
GetValue
<
string
>(
'City'
,
''
);
ParsedCustomer
.
BILL_STATE
:=
BillAddr
.
GetValue
<
string
>(
'CountrySubDivisionCode'
,
''
);
ParsedCustomer
.
BILL_ZIP
:=
BillAddr
.
GetValue
<
string
>(
'PostalCode'
,
''
);
Line1
:=
BillAddr
.
GetValue
<
string
>(
'Line1'
,
''
);
Line2
:=
BillAddr
.
GetValue
<
string
>(
'Line2'
,
''
);
if
Line2
<>
''
then
begin
ParsedCustomer
.
BILL_ADDRESS
:=
Line2
;
ParsedCustomer
.
BILL_CONTACT
:=
Line1
;
ParsedCustomer
.
BILL_ADDRESS_BLOCK
:=
Customer
.
GetValue
<
string
>(
'DisplayName'
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'Line1'
,
''
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'Line2'
,
''
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'City'
,
''
)
+
', '
+
BillAddr
.
GetValue
(
'CountrySubDivisionCode'
,
''
)
+
' '
+
BillAddr
.
GetValue
(
'PostalCode'
,
''
)
end
else
begin
ParsedCustomer
.
BILL_ADDRESS
:=
Line1
;
ParsedCustomer
.
BILL_CONTACT
:=
''
;
ParsedCustomer
.
BILL_ADDRESS_BLOCK
:=
Customer
.
GetValue
<
string
>(
'DisplayName'
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'Line1'
,
''
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'City'
,
''
)
+
', '
+
BillAddr
.
GetValue
(
'CountrySubDivisionCode'
,
''
)
+
' '
+
BillAddr
.
GetValue
(
'PostalCode'
,
''
)
end
;
end
;
// Handle Ship Address
if
Customer
.
GetValue
(
'ShipAddr'
)
is
TJSONObject
then
begin
BillAddr
:=
Customer
.
GetValue
(
'ShipAddr'
)
as
TJSONObject
;
Line1
:=
BillAddr
.
GetValue
<
string
>(
'Line1'
,
''
);
Line2
:=
BillAddr
.
GetValue
<
string
>(
'Line2'
,
''
);
ShipAddr
:=
Customer
.
GetValue
(
'ShipAddr'
)
as
TJSONObject
;
ParsedCustomer
.
AddPair
(
'ShipAddrLine1'
,
TJSONString
.
Create
(
BillAddr
.
GetValue
<
string
>(
'Line1'
,
''
)));
ParsedCustomer
.
AddPair
(
'ShipAddrCity'
,
TJSONString
.
Create
(
BillAddr
.
GetValue
<
string
>(
'City'
,
''
)));
ParsedCustomer
.
AddPair
(
'ShipAddrState'
,
TJSONString
.
Create
(
BillAddr
.
GetValue
<
string
>(
'CountrySubDivisionCode'
,
''
)));
ParsedCustomer
.
AddPair
(
'ShipAddrZip'
,
TJSONString
.
Create
(
BillAddr
.
GetValue
<
string
>(
'PostalCode'
,
''
)));
ParsedCustomer
.
city
:=
ShipAddr
.
GetValue
<
string
>(
'City'
,
''
);
ParsedCustomer
.
state
:=
ShipAddr
.
GetValue
<
string
>(
'CountrySubDivisionCode'
,
''
);
ParsedCustomer
.
zip
:=
ShipAddr
.
GetValue
<
string
>(
'PostalCode'
,
''
);
Line1
:=
ShipAddr
.
GetValue
<
string
>(
'Line1'
,
''
);
Line2
:=
ShipAddr
.
GetValue
<
string
>(
'Line2'
,
''
);
if
Line2
<>
''
then
begin
ParsedCustomer
.
AddPair
(
'ShipAddrLine1'
,
TJSONString
.
Create
(
Line2
));
ParsedCustomer
.
AddPair
(
'ShipAddrContact'
,
TJSONString
.
Create
(
Line1
));
ParsedCustomer
.
AddPair
(
'ShipAddr'
,
TJSONString
.
Create
(
Customer
.
GetValue
<
string
>(
'DisplayName'
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'Line1'
,
''
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'Line2'
,
''
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'City'
,
''
)
+
', '
+
BillAddr
.
GetValue
(
'CountrySubDivisionCode'
,
''
)
+
' '
+
BillAddr
.
GetValue
(
'PostalCode'
,
''
)
)
);
ParsedCustomer
.
shipping_address
:=
Line2
;
ParsedCustomer
.
contact
:=
Line1
;
ParsedCustomer
.
ship_block
:=
Customer
.
GetValue
<
string
>(
'DisplayName'
)
+
sLineBreak
+
ShipAddr
.
GetValue
(
'Line1'
,
''
)
+
sLineBreak
+
ShipAddr
.
GetValue
(
'Line2'
,
''
)
+
sLineBreak
+
ShipAddr
.
GetValue
(
'City'
,
''
)
+
', '
+
ShipAddr
.
GetValue
(
'CountrySubDivisionCode'
,
''
)
+
' '
+
ShipAddr
.
GetValue
(
'PostalCode'
,
''
)
end
else
begin
ParsedCustomer
.
AddPair
(
'ShipAddrLine1'
,
TJSONString
.
Create
(
Line1
));
ParsedCustomer
.
AddPair
(
'ShipAddrContact'
,
''
);
ParsedCustomer
.
AddPair
(
'ShipAddr'
,
TJSONString
.
Create
(
Customer
.
GetValue
<
string
>(
'DisplayName'
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'Line1'
,
''
)
+
sLineBreak
+
BillAddr
.
GetValue
(
'City'
,
''
)
+
', '
+
BillAddr
.
GetValue
(
'CountrySubDivisionCode'
,
''
)
+
' '
+
BillAddr
.
GetValue
(
'PostalCode'
,
''
)
)
);
ParsedCustomer
.
shipping_address
:=
Line1
;
ParsedCustomer
.
contact
:=
''
;
ParsedCustomer
.
ship_block
:=
Customer
.
GetValue
<
string
>(
'DisplayName'
)
+
sLineBreak
+
ShipAddr
.
GetValue
(
'Line1'
,
''
)
+
sLineBreak
+
ShipAddr
.
GetValue
(
'City'
,
''
)
+
', '
+
ShipAddr
.
GetValue
(
'CountrySubDivisionCode'
,
''
)
+
' '
+
ShipAddr
.
GetValue
(
'PostalCode'
,
''
)
end
;
end
;
Result
.
AddElement
(
ParsedCustomer
);
if
Customer
.
GetValue
(
'CustomerTypeRef'
)
is
TJSONObject
then
begin
CustomerTypeRef
:=
Customer
.
GetValue
(
'CustomerTypeRef'
)
as
TJSONObject
;
logger
.
Log
(
5
,
CustomerTypeRef
.
ToJSON
);
ParsedCustomer
.
RepUser
:=
GetCustomerType
(
CustomerTypeRef
.
GetValue
<
string
>(
'value'
));
end
;
result
:=
ParsedCustomer
;
except
ParsedCustomer
.
Free
;
raise
;
end
;
end
;
except
on
E
:
Exception
do
begin
Logger
.
Log
(
2
,
'Error in getQBCustomers: '
+
E
.
Message
);
Logger
.
Log
(
2
,
'Error in getQBCustomer: '
+
E
.
Message
);
raise
EXDataHttpException
.
Create
(
500
,
'Unable to retrieve QuickBooks Customers: A QuickBooks interface error has occurred!'
);
end
;
end
;
finally
iniFile
.
Free
;
restClient
.
Free
;
restRequest
.
Free
;
restResponse
.
Free
;
logger
.
Log
(
3
,
'TLookupService.GetQBCustomer - end'
);
end
;
end
;
function
TLookupService
.
GetCustomerType
(
CustomerTypeId
:
string
):
string
;
var
iniFile
:
TIniFile
;
restClient
:
TRESTClient
;
restRequest
:
TRESTRequest
;
restResponse
:
TRESTResponse
;
param
:
TRESTRequestParameter
;
res
:
string
;
jsValue
:
TJSONValue
;
CustomerType
:
TJSONObject
;
jsObj
:
TJSONObject
;
CustomerTypeList
:
TJSONArray
;
AccessToken
,
RefreshToken
,
CompanyID
,
Client
,
Secret
,
BaseUrl
,
Line1
,
Line2
:
string
;
LastRefresh
:
TDateTime
;
begin
logger
.
Log
(
3
,
'TLookupService.GetQBCustomer - start'
);
iniFile
:=
TIniFile
.
Create
(
ExtractFilePath
(
Application
.
ExeName
)
+
'kgOrdersServer.ini'
);
restClient
:=
TRESTClient
.
Create
(
nil
);
restRequest
:=
TRESTRequest
.
Create
(
nil
);
restResponse
:=
TRESTResponse
.
Create
(
nil
);
try
try
restRequest
.
Client
:=
restClient
;
restRequest
.
Response
:=
restResponse
;
if
iniFile
.
ReadString
(
'Quickbooks'
,
'LastRefresh'
,
''
)
=
''
then
LastRefresh
:=
0
else
LastRefresh
:=
StrToDateTime
(
iniFile
.
ReadString
(
'Quickbooks'
,
'LastRefresh'
,
''
));
if
MinutesBetween
(
Now
,
LastRefresh
)
>
58
then
RefreshAccessToken
();
Client
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'ClientID'
,
''
);
Secret
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'ClientSecret'
,
''
);
CompanyID
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'CompanyID'
,
''
);
RefreshToken
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'RefreshToken'
,
''
);
AccessToken
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'AccessToken'
,
''
);
BaseUrl
:=
iniFile
.
ReadString
(
'Quickbooks'
,
'BaseUrl'
,
''
);
restClient
.
BaseURL
:=
BaseUrl
;
restRequest
.
Method
:=
rmGET
;
res
:=
'/v3/company/'
+
CompanyID
+
'/query?query=select * from CustomerType where Id = '
+
quotedStr
(
CustomerTypeID
)
+
'&minorversion=75'
;
restRequest
.
Resource
:=
res
;
param
:=
restRequest
.
Params
.
AddItem
;
param
.
Name
:=
'Authorization'
;
param
.
Kind
:=
pkHTTPHEADER
;
param
.
Options
:=
param
.
Options
+
[
TRESTRequestParameterOption
.
poDoNotEncode
];
param
.
Value
:=
'Bearer '
+
AccessToken
;
restRequest
.
Execute
;
if
restResponse
.
StatusCode
<>
200
then
begin
Logger
.
Log
(
1
,
'QBO Error: '
+
restResponse
.
StatusText
+
' - '
+
restResponse
.
Content
);
raise
EXDataHttpException
.
Create
(
restResponse
.
StatusCode
,
'QuickBooks API Error: '
+
restResponse
.
StatusText
);
end
;
jsValue
:=
restResponse
.
JSONValue
;
if
not
Assigned
(
jsValue
)
then
Exit
;
jsObj
:=
jsValue
as
TJSONObject
;
if
not
Assigned
(
jsObj
)
then
Exit
;
CustomerTypeList
:=
jsObj
.
GetValue
<
TJSONArray
>(
'QueryResponse.CustomerType'
);
if
not
Assigned
(
CustomerTypeList
)
then
Exit
;
CustomerType
:=
CustomerTypeList
.
Items
[
0
]
as
TJSONObject
;
logger
.
Log
(
5
,
CustomerType
.
ToJSON
());
result
:=
CustomerType
.
GetValue
<
string
>(
'Name'
);
except
on
E
:
Exception
do
begin
Logger
.
Log
(
2
,
'Error in getQBCustomer: '
+
E
.
Message
);
raise
EXDataHttpException
.
Create
(
500
,
'Unable to retrieve QuickBooks Customers: A QuickBooks interface error has occurred!'
);
end
;
end
;
...
...
@@ -2988,6 +3238,7 @@ begin
restClient
.
Free
;
restRequest
.
Free
;
restResponse
.
Free
;
logger
.
Log
(
3
,
'TLookupService.GetQBCustomer - end'
);
end
;
end
;
...
...
@@ -3207,7 +3458,7 @@ var
param
:
TRESTRequestParameter
;
res
:
string
;
jsValue
:
TJSONValue
;
ParsedCustomer
,
Customer
,
BillAddr
:
TJSONObject
;
ParsedCustomer
,
Customer
,
BillAddr
,
CustomerTypeRef
:
TJSONObject
;
jsObj
:
TJSONObject
;
PhoneObj
:
TJSONObject
;
CustomerList
:
TJSONArray
;
...
...
@@ -3281,7 +3532,6 @@ begin
custItem
.
NAME
:=
Customer
.
GetValue
<
string
>(
'DisplayName'
);
custItem
.
CUSTOMER_ID
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'CUSTOMER_ID'
).
AsInteger
;
custItem
.
SHORT_NAME
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'SHORT_NAME'
).
AsString
;
custItem
.
REP_USER_ID
:=
ordersDB
.
UniQuery1
.
FieldByName
(
'REP_USER_ID'
).
AsString
;
// Handle Bill Address
if
Customer
.
GetValue
(
'BillAddr'
)
is
TJSONObject
then
begin
...
...
@@ -3313,8 +3563,15 @@ begin
BillAddr
.
GetValue
(
'CountrySubDivisionCode'
,
''
)
+
' '
+
BillAddr
.
GetValue
(
'PostalCode'
,
''
)
end
;
end
;
if
Customer
.
GetValue
(
'CustomerTypeRef'
)
is
TJSONObject
then
begin
CustomerTypeRef
:=
Customer
.
GetValue
(
'CustomerTypeRef'
)
as
TJSONObject
;
logger
.
Log
(
5
,
CustomerTypeRef
.
ToJSON
);
custItem
.
QB_TYPE
:=
GetCustomerType
(
CustomerTypeRef
.
GetValue
<
string
>(
'value'
));
end
;
Result
:=
custItem
;
except
ParsedCustomer
.
Free
;
...
...
@@ -3452,7 +3709,6 @@ begin
if
JSONData
=
nil
then
raise
Exception
.
Create
(
'Invalid JSON format'
);
mode
:=
JSONData
.
GetValue
<
string
>(
'mode'
);
QB_LIST_ID
:=
JSONData
.
GetValue
<
string
>(
'QB_LIST_ID'
);
// Update RevisionID
...
...
@@ -3491,14 +3747,13 @@ begin
end
;
OrdersDB
.
UniQuery1
.
FieldByName
(
'CUSTOMER_ID'
).
AsInteger
:=
CustomerID
;
OrdersDB
.
UniQuery1
.
FieldByName
(
'QB_TYPE'
).
AsString
:=
JSONData
.
GetValue
<
string
>(
'RepUser'
);
JSONData
.
AddPair
(
'customer_id'
,
TJSONNumber
.
Create
(
CustomerID
));
OrdersDB
.
UniQuery1
.
Post
;
if
mode
=
'ADD'
then
msg
:=
'Success: Customer Successfully Added'
else
msg
:=
'Success: Customer Successfully Edited'
;
msg
:=
'Success: Customer Successfully Added'
;
Result
:=
TJSONObject
.
Create
;
Result
.
AddPair
(
'status'
,
msg
);
...
...
@@ -3529,6 +3784,7 @@ begin
Field
.
AsString
:=
Pair
.
JsonValue
.
Value
;
end
;
end
;
OrdersDB
.
UniQuery1
.
FieldByName
(
'address'
).
AsString
:=
JSONData
.
GetValue
<
string
>(
'shipping_address'
);
OrdersDB
.
UniQuery1
.
Post
;
end
;
...
...
kgOrdersServer/Source/qbAPI.dfm
View file @
151f60b4
...
...
@@ -201,11 +201,19 @@ object fQB: TfQB
Width = 982
Height = 153
Align = alClient
Color = clWhite
DrawingStyle = gdsClassic
FixedColor = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Options = [goVertLine, goHorzLine, goRangeSelect, goFixedRowDefAlign]
ParentFont = False
TabOrder = 0
GridLineColor = 1
3948116
GridFixedLineColor = 1
1250603
GridLineColor = 1
5987699
GridFixedLineColor = 1
5987699
OnClickCell = asgData2ClickCell
ActiveCellFont.Charset = DEFAULT_CHARSET
ActiveCellFont.Color = 4474440
...
...
@@ -271,7 +279,7 @@ object fQB: TfQB
FixedRowHeight = 22
FixedRowAlways = True
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color =
3881787
FixedFont.Color =
clBlack
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
...
...
@@ -302,7 +310,7 @@ object fQB: TfQB
PrintSettings.FooterFont.Name = 'Segoe UI'
PrintSettings.FooterFont.Style = []
PrintSettings.PageNumSep = '/'
SearchFooter.ColorTo = cl
Non
e
SearchFooter.ColorTo = cl
Whit
e
SearchFooter.FindNextCaption = 'Find &next'
SearchFooter.FindPrevCaption = 'Find &previous'
SearchFooter.Font.Charset = DEFAULT_CHARSET
...
...
@@ -322,7 +330,7 @@ object fQB: TfQB
SortSettings.HeaderColorTo = clWhite
SortSettings.HeaderMirrorColor = clWhite
SortSettings.HeaderMirrorColorTo = clWhite
Version = '9.
1.6.4
'
Version = '9.
2.2.0
'
ColWidths = (
64
64
...
...
@@ -648,7 +656,7 @@ object fQB: TfQB
Left = 1
Top = 26
Width = 980
Height = 17
0
Height = 17
1
Caption = 'Memo1'
DoubleBuffered = False
PageAppearance.BorderColor = clNone
...
...
@@ -713,12 +721,13 @@ object fQB: TfQB
Left = 2
Top = 35
Width = 976
Height = 13
3
Height = 13
4
Align = alClient
Lines.Strings = (
'')
ScrollBars = ssVertical
TabOrder = 0
ExplicitHeight = 133
end
object Panel2: TPanel
Left = 2
...
...
@@ -742,7 +751,7 @@ object fQB: TfQB
Left = 1
Top = 26
Width = 980
Height = 17
0
Height = 17
1
Caption = 'QB API Memo'
DoubleBuffered = False
PageAppearance.BorderColor = clNone
...
...
@@ -807,13 +816,14 @@ object fQB: TfQB
Left = 2
Top = 35
Width = 976
Height = 13
3
Height = 13
4
Align = alClient
Lines.Strings = (
'Memo2')
ScrollBars = ssVertical
TabOrder = 0
WordWrap = False
ExplicitHeight = 133
end
object Panel3: TPanel
Left = 2
...
...
@@ -837,7 +847,7 @@ object fQB: TfQB
Left = 1
Top = 26
Width = 980
Height = 17
0
Height = 17
1
Caption = 'AdvOfficePager13'
DoubleBuffered = False
PageAppearance.BorderColor = clNone
...
...
@@ -945,11 +955,19 @@ object fQB: TfQB
Width = 982
Height = 205
Align = alClient
Color = clWhite
DrawingStyle = gdsClassic
FixedColor = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Options = [goVertLine, goHorzLine, goRangeSelect, goFixedRowDefAlign]
ParentFont = False
TabOrder = 0
GridLineColor = 1
3948116
GridFixedLineColor = 1
1250603
GridLineColor = 1
5987699
GridFixedLineColor = 1
5987699
OnClickCell = asgDataClickCell
ActiveCellFont.Charset = DEFAULT_CHARSET
ActiveCellFont.Color = 4474440
...
...
@@ -1015,7 +1033,7 @@ object fQB: TfQB
FixedRowHeight = 22
FixedRowAlways = True
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color =
3881787
FixedFont.Color =
clBlack
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
...
...
@@ -1046,7 +1064,7 @@ object fQB: TfQB
PrintSettings.FooterFont.Name = 'Segoe UI'
PrintSettings.FooterFont.Style = []
PrintSettings.PageNumSep = '/'
SearchFooter.ColorTo = cl
Non
e
SearchFooter.ColorTo = cl
Whit
e
SearchFooter.FindNextCaption = 'Find &next'
SearchFooter.FindPrevCaption = 'Find &previous'
SearchFooter.Font.Charset = DEFAULT_CHARSET
...
...
@@ -1066,7 +1084,7 @@ object fQB: TfQB
SortSettings.HeaderColorTo = clWhite
SortSettings.HeaderMirrorColor = clWhite
SortSettings.HeaderMirrorColorTo = clWhite
Version = '9.
1.6.4
'
Version = '9.
2.2.0
'
ColWidths = (
64
64
...
...
kgOrdersServer/bin/kgOrdersServer - Copy.ini
View file @
151f60b4
[Settings]
MemoLogLevel
=
3
FileLogLevel
=
4
webClientVersion
=
0.9.1
3
LogFileNum
=
10
0
webClientVersion
=
0.9.1
4.1
LogFileNum
=
10
5
[Database]
Server
=
192.168.116.132
--
Server
=
192.168.116.132
--Server
=
192.168.102.129
--Server
=
192.168.75.133
--
Server
=
192.168.159.10
Server
=
192.168.159.10
--Database
=
kg_order_entry
--Username
=
root
--Password
=
emsys01
--Password
=
emsys!012
[Quickbooks]
Enabled
=
1
CompanyID
=
9341454336461805
ClientID
=
ABYqlDx1EsacZYXvHIJ7RDB7zmnQdwABU3fwQLIZPmBgU0VW1P
ClientSecret
=
PM7OnvQWsgOqjWfDpZAnyRttDN9446Am6d85pDxr
RefreshToken
=
RT1-246-H0-1774553264l4plin9y3f32d4cm7ncw
AccessToken
=
eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwieC5vcmciOiJIMCJ9..HDUyB-xbInAP_lJcZiix5w.REb-0D5HZfvm8UE7cWifSiXZTJK0_3Bpp44ybTT6-9h7fT1zA0-oMzxUHO-bL4tTWuVnJODgRHfHAadOml13dMTKOQ4msyW3Y5g-BF91aoQZi-HKw35w_gClKJ6zSn99AIwnffo_IhkotW8FY1wC7gRkDzHsFMajOWQWmji_EsDblGQW97_eW8Z6rwUCbsoWpankR5JOcZtvD5j9dmzQdaPkKJXqlB_6kLC-WXEpySA7heWsNfA1iq3Bn56J4C6_HxvpFZ8i-gWUE42-Ls1uhGG6EQw9vjDFRojG6Fvv0oK_bbKSZ24NqerGoeFmlWTHoCl6pQXX12DZgmJp3vwCLyAzw8dTFzRH4QKoN7D5NAQ3rp2LtzpIBjiuBxJIvr20GSDO6lgNzXGusNffmkJC5cPxh7NmwzbubFw6yL8P7ZGKIdviIaHPS0u5pGc3Bw_qJ0bKaRXTxMmyIAUR3BtExZMzHLN6pVij8R9rpEtGvPo.tA4XoJdViQb1JKoL9eDevw
LastRefresh
=
12/15/2025
Enabled
=
1
CompanyID
=
9341454336461805
--BaseUrl
=
https://sandbox-quickbooks.api.intuit.com
--ClientID
=
ABYqlDx1EsacZYXvHIJ7RDB7zmnQdwABU3fwQLIZPmBgU0VW1P
--ClientSecret
=
PM7OnvQWsgOqjWfDpZAnyRttDN9446Am6d85pDxr
--RedirectUri
=
http://localhost:2004/kgOrders/auth/AuthService/QBAuthorize
BaseUrl
=
https://quickbooks.api.intuit.com/v3
ClientID
=
ABXLUuBrwvodIZMtaPcBg9acYBPafUxP80qk5aQ9HOAw1i2W3s
ClientSecret
=
a0DSQZdXH1FRTAFhpp2igeNFKxu7kPlzt0az7nbQ
RedirectUri
=
https://webapps.em-sys.net/kgOrdersTest/auth/AuthService/QBAuthorize
RefreshToken
=
RT1-143-H0-1783193667426ef30b5u81echlyi4h
AccessToken
=
eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwieC5vcmciOiJIMCJ9..aoofv422rMR8s5qxVjkk0A.n0SzfMojJdSwS6plIGJO3gT2gM2_xEGEFr1ZDBqFWA40XoHTixNhZ0HvndlcyDiaofP8WBDH7GIG2zAjVK67winsZ02b9ylTE9PnMWCgl2rskMccDeP9yDabJjgM7113cCoMHj6m93g1sQu2tKH5zV_5wjj6Q1KwcJgs8fmutdWkpsYD-DIn46ySVDjPaDa9EN4lLMPD5ip20rF0p_Mol-Fh4zRRhMF0BImRxtgHGfFBHAtntd0wBQ35vYlyfnG-FnK25NFxVhNQchA3JpYaLIw_qLaZ7LjHIlOhX0S64ROUq80LLwjCpctHFX-YYFUAL4G0DSe22cz9RgJmxLy-PvUAnpCia3NPeft0Vtg2Ysg1-WH8mEJb3tQWZOLaEKecNO7_SsA4Xdfk5pl0y0ukk8KQHQmPwsaYP1OAd9C6LFDqyyIXY6ULZigPUiiHRHc0-pcvFLuz_kaovO9-kapokXO6WhL9Fc9GUgn1Sn6PhT4.6r8dJQ6gVezO3SLIssoNBw
LastRefresh
=
3/26/2026 11:28:04 AM
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