Commit 7a8ad9bf by Mac Stephens

Merge remote-tracking branch 'origin/cam3' into mac3

parents b43edfc2 342290a5
...@@ -4,6 +4,7 @@ kgOrdersClient/__recovery/ ...@@ -4,6 +4,7 @@ kgOrdersClient/__recovery/
kgOrdersClient/TMSWeb/ kgOrdersClient/TMSWeb/
kgOrdersClient/Win32/ kgOrdersClient/Win32/
kgOrdersClient/css/__history/ kgOrdersClient/css/__history/
kgOrdersClient/css/__recovery/
kgOrdersClient/config/__history/ kgOrdersClient/config/__history/
kgOrdersServer/__history kgOrdersServer/__history
kgOrdersServer/__recovery kgOrdersServer/__recovery
......
...@@ -11,6 +11,7 @@ type ...@@ -11,6 +11,7 @@ type
TSuccessProc = reference to procedure; TSuccessProc = reference to procedure;
TLogoutProc = reference to procedure(AMessage: string = ''); TLogoutProc = reference to procedure(AMessage: string = '');
TUnauthorizedAccessProc = reference to procedure(AMessage: string); TUnauthorizedAccessProc = reference to procedure(AMessage: string);
TVersionCheckCallback = reference to procedure(Success: Boolean; ErrorMessage: string);
TListProc = reference to procedure; TListProc = reference to procedure;
TSelectProc = reference to procedure(AParam: string); TSelectProc = reference to procedure(AParam: string);
......
...@@ -2,7 +2,6 @@ object DMConnection: TDMConnection ...@@ -2,7 +2,6 @@ object DMConnection: TDMConnection
Height = 264 Height = 264
Width = 395 Width = 395
object ApiConnection: TXDataWebConnection object ApiConnection: TXDataWebConnection
URL = 'http://localhost:2004/emsys/kgOrders/api/'
OnError = ApiConnectionError OnError = ApiConnectionError
OnRequest = ApiConnectionRequest OnRequest = ApiConnectionRequest
OnResponse = ApiConnectionResponse OnResponse = ApiConnectionResponse
...@@ -10,9 +9,13 @@ object DMConnection: TDMConnection ...@@ -10,9 +9,13 @@ object DMConnection: TDMConnection
Top = 80 Top = 80
end end
object AuthConnection: TXDataWebConnection object AuthConnection: TXDataWebConnection
URL = 'http://localhost:2004/emsys/kgOrders/auth/'
OnError = AuthConnectionError OnError = AuthConnectionError
Left = 48 Left = 48
Top = 16 Top = 16
end end
object XDataWebClient1: TXDataWebClient
Connection = AuthConnection
Left = 269
Top = 164
end
end end
...@@ -4,21 +4,25 @@ interface ...@@ -4,21 +4,25 @@ interface
uses uses
System.SysUtils, System.Classes, WEBLib.Modules, XData.Web.Connection, System.SysUtils, System.Classes, WEBLib.Modules, XData.Web.Connection,
App.Types, App.Config; App.Types, App.Config, XData.Web.Client;
type type
TDMConnection = class(TWebDataModule) TDMConnection = class(TWebDataModule)
ApiConnection: TXDataWebConnection; ApiConnection: TXDataWebConnection;
AuthConnection: TXDataWebConnection; AuthConnection: TXDataWebConnection;
XDataWebClient1: TXDataWebClient;
procedure ApiConnectionError(Error: TXDataWebConnectionError); procedure ApiConnectionError(Error: TXDataWebConnectionError);
procedure ApiConnectionRequest(Args: TXDataWebConnectionRequest); procedure ApiConnectionRequest(Args: TXDataWebConnectionRequest);
procedure ApiConnectionResponse(Args: TXDataWebConnectionResponse); procedure ApiConnectionResponse(Args: TXDataWebConnectionResponse);
procedure AuthConnectionError(Error: TXDataWebConnectionError); procedure AuthConnectionError(Error: TXDataWebConnectionError);
private private
FUnauthorizedAccessProc: TUnauthorizedAccessProc; FUnauthorizedAccessProc: TUnauthorizedAccessProc;
public public
const clientVersion = '0.9.4';
procedure InitApp(SuccessProc: TSuccessProc; procedure InitApp(SuccessProc: TSuccessProc;
UnauthorizedAccessProc: TUnauthorizedAccessProc); UnauthorizedAccessProc: TUnauthorizedAccessProc);
procedure SetClientConfig(Callback: TVersionCheckCallback);
end; end;
var var
...@@ -79,4 +83,31 @@ begin ...@@ -79,4 +83,31 @@ begin
LoadConfig(@ConfigLoaded); LoadConfig(@ConfigLoaded);
end; end;
procedure TDMConnection.SetClientConfig(Callback: TVersionCheckCallback);
begin
XDataWebClient1.Connection := AuthConnection;
XDataWebClient1.RawInvoke('IAuthService.VerifyVersion', [clientVersion],
procedure(Response: TXDataClientResponse)
var
jsonResult: TJSObject;
error: string;
begin
jsonResult := TJSObject(Response.Result);
if jsonResult.HasOwnProperty('error') then
error := string(jsonResult['error'])
else
error := '';
if error <> '' then
Callback(False, error)
else
Callback(True, '');
end);
end;
end. end.
unit Utils;
interface
uses
System.Classes, SysUtils, JS, Web, WEBLib.Forms, WEBLib.Toast, DateUtils;
procedure ShowStatusMessage(const AMessage, AClass: string; const AElementId: string);
procedure HideStatusMessage(const AElementId: string);
procedure ShowSpinner(SpinnerID: string);
procedure HideSpinner(SpinnerID: string);
function CalculateAge(DateOfBirth: TDateTime): Integer;
function FormatPhoneNumber(PhoneNumber: string): string;
procedure ApplyReportTitle(CurrentReportType: string);
// function FormatDollarValue(ValueStr: string): string;
implementation
procedure ShowStatusMessage(const AMessage, AClass: string; const AElementId: string);
var
StatusMessage: TJSHTMLElement;
begin
StatusMessage := TJSHTMLElement(document.getElementById(AElementId));
if Assigned(StatusMessage) then
begin
if AMessage = '' then
begin
StatusMessage.style.setProperty('display', 'none');
StatusMessage.className := '';
StatusMessage.innerHTML := '';
end
else
begin
StatusMessage.innerHTML := AMessage;
StatusMessage.className := 'alert ' + AClass;
StatusMessage.style.setProperty('display', 'block');
end
end
else
console.log('Error: Status message element not found');
end;
procedure HideStatusMessage(const AElementId: string);
var
StatusMessage: TJSHTMLElement;
begin
StatusMessage := TJSHTMLElement(document.getElementById(AElementId));
if Assigned(StatusMessage) then
begin
StatusMessage.style.setProperty('display', 'none');
StatusMessage.className := '';
StatusMessage.innerHTML := '';
end
else
console.log('Error: Status message element not found');
end;
procedure ShowSpinner(SpinnerID: string);
var
SpinnerElement: TJSHTMLElement;
begin
SpinnerElement := TJSHTMLElement(document.getElementById(SpinnerID));
if Assigned(SpinnerElement) then
begin
SpinnerElement.classList.remove('d-none');
SpinnerElement.classList.add('d-block');
end;
end;
procedure HideSpinner(SpinnerID: string);
var
SpinnerElement: TJSHTMLElement;
begin
SpinnerElement := TJSHTMLElement(document.getElementById(SpinnerID));
if Assigned(SpinnerElement) then
begin
SpinnerElement.classList.remove('d-block');
SpinnerElement.classList.add('d-none');
end;
end;
function CalculateAge(DateOfBirth: TDateTime): Integer;
var
Today, BirthDate: TJSDate;
Year, Month, Day, BirthYear, BirthMonth, BirthDay: NativeInt;
DOBString: string;
begin
Today := TJSDate.New;
Year := Today.FullYear;
Month := Today.Month + 1;
Day := Today.Date;
// Formats the DateOfBirth as an ISO 8601 date string
DOBString := FormatDateTime('yyyy-mm-dd', DateOfBirth);
BirthDate := TJSDate.New(DOBString);
if BirthDate = nil then
begin
Exit(0); // Exit the function with an age of 0 if the date creation fails
end;
BirthYear := BirthDate.FullYear;
BirthMonth := BirthDate.Month + 1;
BirthDay := BirthDate.Date;
Result := Year - BirthYear;
if (Month < BirthMonth) or ((Month = BirthMonth) and (Day < BirthDay)) then
Dec(Result);
end;
function FormatPhoneNumber(PhoneNumber: string): string;
var
Digits: string;
begin
Digits := PhoneNumber.Replace('(', '').Replace(')', '').Replace('-', '').Replace(' ', '');
case Length(Digits) of
7: Result := Format('%s-%s', [Copy(Digits, 1, 3), Copy(Digits, 4, 4)]);
10: Result := Format('(%s) %s-%s', [Copy(Digits, 1, 3), Copy(Digits, 4, 3), Copy(Digits, 7, 4)]);
else
// If the number does not have 7 or 10 digits, whatever they typed is returned
Result := PhoneNumber;
end;
end;
procedure ApplyReportTitle(CurrentReportType: string);
var
CrimeTitleElement: TJSHTMLElement;
begin
CrimeTitleElement := TJSHTMLElement(document.getElementById('crime_title'));
if Assigned(CrimeTitleElement) then
CrimeTitleElement.innerText := CurrentReportType
else
Console.Log('Element with ID "crime_title" not found.');
end;
// Used html number input type to restrict the input instead of this function
// function FormatDollarValue(ValueStr: string): string;
// var
// i: Integer;
// begin
// Result := ''; // Initialize the result
// // Filter out any characters that are not digits or decimal point
// for i := 1 to Length(ValueStr) do
// begin
// if (Pos(ValueStr[i], '0123456789.') > 0) then
// begin
// Result := Result + ValueStr[i];
// end;
// end;
// end;
end.
object FViewAddAddress: TFViewAddAddress
Width = 281
Height = 402
object WebLabel1: TWebLabel
Left = 8
Top = 283
Width = 92
Height = 15
Caption = 'Shipping Contact'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 8
Top = 234
Width = 67
Height = 15
Caption = 'Shipping Zip'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 8
Top = 136
Width = 71
Height = 15
Caption = 'Shipping City'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel4: TWebLabel
Left = 8
Top = 185
Width = 76
Height = 15
Caption = 'Shipping State'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel5: TWebLabel
Left = 8
Top = 87
Width = 92
Height = 15
Caption = 'Shipping Address'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel6: TWebLabel
Left = 8
Top = 36
Width = 47
Height = 15
Caption = 'First Line'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtState: TWebEdit
Left = 8
Top = 206
Width = 78
Height = 22
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtFirstLine: TWebEdit
Left = 8
Top = 59
Width = 198
Height = 22
ChildOrder = 1
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtCity: TWebEdit
Left = 8
Top = 157
Width = 149
Height = 22
ChildOrder = 2
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtZip: TWebEdit
Left = 8
Top = 255
Width = 121
Height = 22
ChildOrder = 3
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtContact: TWebEdit
Left = 8
Top = 304
Width = 198
Height = 22
ChildOrder = 4
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtAddress: TWebEdit
Left = 8
Top = 108
Width = 198
Height = 22
ChildOrder = 1
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtNotification: TWebEdit
Left = 8
Top = 8
Width = 198
Height = 22
ChildOrder = 12
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnSave: TWebButton
Left = 8
Top = 340
Width = 96
Height = 25
Caption = 'Save'
ChildOrder = 13
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnSaveClick
end
object btnCancel: TWebButton
Left = 110
Top = 340
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 13
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
end
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>TMS Web Project</title>
<style>
</style>
</head>
<body>
</body>
</html>
\ No newline at end of file
// Small Pop-Up page when adding orders if you want to quickly add an address
unit View.AddAddress;
interface
uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls;
type
TFViewAddAddress = class(TWebForm)
edtState: TWebEdit;
edtFirstLine: TWebEdit;
edtCity: TWebEdit;
edtZip: TWebEdit;
edtContact: TWebEdit;
edtAddress: TWebEdit;
WebLabel1: TWebLabel;
WebLabel2: TWebLabel;
WebLabel3: TWebLabel;
WebLabel4: TWebLabel;
WebLabel5: TWebLabel;
WebLabel6: TWebLabel;
edtNotification: TWebEdit;
btnSave: TWebButton;
btnCancel: TWebButton;
procedure btnCancelClick(Sender: TObject);
procedure btnSaveClick(Sender: TObject);
private
{ Private declarations }
function Verify(): boolean;
public
{ Public declarations }
var
confirm: boolean;
end;
var
FViewAddAddress: TFViewAddAddress;
implementation
{$R *.dfm}
procedure TFViewAddAddress.btnSaveClick(Sender: TObject);
begin
if Verify() then
begin
confirm := true;
Close;
end;
end;
function TFViewAddAddress.Verify(): boolean;
// Makes sure the address is filled in.
begin
result := true;
if edtFirstLine.Text = '' then
begin
edtNotification.Text := 'Please Fill in the First Line';
result := false;
end
else if edtAddress.Text = '' then
begin
edtNotification.Text := 'Please Fill in the Address';
result := false;
end
else if edtCity.Text = '' then
begin
edtNotification.Text := 'Please Fill in the City';
result := false;
end
else
if edtState.Text = '' then
begin
edtNotification.Text := 'Please Fill in the State';
result := false;
end
else if edtZip.Text = '' then
begin
edtNotification.Text := 'Please Fill in the Zip Code';
result := false;
end
else if edtContact.Text = '' then
begin
edtNotification.Text := 'Please Fill in the Contact';
result := false;
end
end;
procedure TFViewAddAddress.btnCancelClick(Sender: TObject);
begin
Close;
end;
end.
\ No newline at end of file
...@@ -3,26 +3,35 @@ object FAddOrder: TFAddOrder ...@@ -3,26 +3,35 @@ object FAddOrder: TFAddOrder
Height = 477 Height = 477
OnShow = WebFormShow OnShow = WebFormShow
object WebLabel1: TWebLabel object WebLabel1: TWebLabel
Left = 334 Left = 4
Top = 56 Top = 81
Width = 35 Width = 95
Height = 15 Height = 15
Caption = 'Search' Caption = 'Search Customers'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
Left = 482 Left = 135
Top = 56 Top = 81
Width = 58 Width = 113
Height = 15 Height = 15
Caption = 'Selected ID' Caption = 'Selected Customer ID'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 283
Top = 81
Width = 134
Height = 15
Caption = 'Selected Customer Name'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object edtSearch: TWebEdit object edtSearch: TWebEdit
Left = 334 Left = 4
Top = 82 Top = 102
Width = 121 Width = 121
Height = 22 Height = 22
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -30,19 +39,20 @@ object FAddOrder: TFAddOrder ...@@ -30,19 +39,20 @@ object FAddOrder: TFAddOrder
OnChange = edtSearchChange OnChange = edtSearchChange
end end
object edtID: TWebEdit object edtID: TWebEdit
Left = 482 Left = 135
Top = 82 Top = 102
Width = 69 Width = 142
Height = 22 Height = 22
ChildOrder = 1 ChildOrder = 1
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object TMSFNCGrid1: TTMSFNCGrid object TMSFNCGrid1: TTMSFNCGrid
Left = 0 Left = 0
Top = 146 Top = 160
Width = 871 Width = 871
Height = 331 Height = 317
Align = alBottom Align = alBottom
ParentDoubleBuffered = False ParentDoubleBuffered = False
DoubleBuffered = True DoubleBuffered = True
...@@ -59,7 +69,6 @@ object FAddOrder: TFAddOrder ...@@ -59,7 +69,6 @@ object FAddOrder: TFAddOrder
Options.Mouse.ClickMargin = 0 Options.Mouse.ClickMargin = 0
Options.Mouse.ColumnSizeMargin = 6 Options.Mouse.ColumnSizeMargin = 6
Options.Mouse.RowSizeMargin = 6 Options.Mouse.RowSizeMargin = 6
OnSelectedCell = TMSFNCGrid1SelectedCell
Columns = < Columns = <
item item
BorderWidth = 1 BorderWidth = 1
...@@ -74,7 +83,7 @@ object FAddOrder: TFAddOrder ...@@ -74,7 +83,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 70.000000000000000000 Width = 90.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -89,7 +98,7 @@ object FAddOrder: TFAddOrder ...@@ -89,7 +98,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 250.000000000000000000 Width = 200.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -104,7 +113,7 @@ object FAddOrder: TFAddOrder ...@@ -104,7 +113,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 100.000000000000000000 Width = 200.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -119,7 +128,7 @@ object FAddOrder: TFAddOrder ...@@ -119,7 +128,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 432.000000000000000000 Width = 362.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -194,21 +203,23 @@ object FAddOrder: TFAddOrder ...@@ -194,21 +203,23 @@ object FAddOrder: TFAddOrder
LeftCol = 0 LeftCol = 0
ScrollMode = scmItemScrolling ScrollMode = scmItemScrolling
DesignTimeSampleData = True DesignTimeSampleData = True
OnCellClick = TMSFNCGrid1CellClick
end end
object cbCorrugatedPlate: TWebCheckBox object cbCorrugatedPlate: TWebCheckBox
Left = 4 Left = 4
Top = 83 Top = 49
Width = 113 Width = 113
Height = 22 Height = 22
Caption = 'Corrugated Plate' Caption = 'Corrugated Plate'
ChildOrder = 3 ChildOrder = 3
ElementID = 'cbcorrugatedplate'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = cbCorrugatedPlateClick OnClick = cbCorrugatedPlateClick
end end
object cbWebPlate: TWebCheckBox object cbWebPlate: TWebCheckBox
Left = 128 Left = 134
Top = 83 Top = 49
Width = 83 Width = 83
Height = 22 Height = 22
Caption = 'Web Plate' Caption = 'Web Plate'
...@@ -218,8 +229,8 @@ object FAddOrder: TFAddOrder ...@@ -218,8 +229,8 @@ object FAddOrder: TFAddOrder
OnClick = cbWebPlateClick OnClick = cbWebPlateClick
end end
object btnCancel: TWebButton object btnCancel: TWebButton
Left = 680 Left = 542
Top = 81 Top = 101
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Cancel' Caption = 'Cancel'
...@@ -229,19 +240,19 @@ object FAddOrder: TFAddOrder ...@@ -229,19 +240,19 @@ object FAddOrder: TFAddOrder
OnClick = btnCancelClick OnClick = btnCancelClick
end end
object btnConfirm: TWebButton object btnConfirm: TWebButton
Left = 564 Left = 436
Top = 81 Top = 101
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Confirm' Caption = 'Select'
ChildOrder = 5 ChildOrder = 5
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick OnClick = btnConfirmClick
end end
object cbCuttingDie: TWebCheckBox object cbCuttingDie: TWebCheckBox
Left = 231 Left = 239
Top = 83 Top = 49
Width = 83 Width = 83
Height = 22 Height = 22
Caption = 'Cutting Die' Caption = 'Cutting Die'
...@@ -258,12 +269,11 @@ object FAddOrder: TFAddOrder ...@@ -258,12 +269,11 @@ object FAddOrder: TFAddOrder
HelpType = htKeyword HelpType = htKeyword
TabStop = False TabStop = False
ChildOrder = 8 ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS ElementFont = efCSS
Enabled = False Enabled = False
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clRed
Font.Height = -8 Font.Height = -13
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Style = [] Font.Style = []
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -272,6 +282,16 @@ object FAddOrder: TFAddOrder ...@@ -272,6 +282,16 @@ object FAddOrder: TFAddOrder
TabOrder = 1 TabOrder = 1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object edtName: TWebEdit
Left = 283
Top = 102
Width = 142
Height = 22
ChildOrder = 1
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 780 Left = 780
...@@ -281,18 +301,17 @@ object FAddOrder: TFAddOrder ...@@ -281,18 +301,17 @@ object FAddOrder: TFAddOrder
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 726 Left = 726
Top = 7 Top = 7
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
object xdwdsCustomersNAME: TStringField object xdwdsCustomersNAME: TStringField
FieldName = 'NAME' FieldName = 'NAME'
end end
object xdwdsCustomersSHORT_NAME: TStringField object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME' FieldName = 'SHORT_NAME'
end end
object xdwdsCustomersADDRESS: TStringField object xdwdsCustomersstaff_fields_invoice_to: TStringField
FieldName = 'ADDRESS' FieldName = 'staff_fields_invoice_to'
Size = 100 end
object xdwdsCustomersCUSTOMER_ID: TIntegerField
FieldName = 'CUSTOMER_ID'
end end
end end
object wdsCustomers: TWebDataSource object wdsCustomers: TWebDataSource
......
...@@ -26,21 +26,23 @@ type ...@@ -26,21 +26,23 @@ type
WebLabel2: TWebLabel; WebLabel2: TWebLabel;
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet; xdwdsCustomers: TXDataWebDataSet;
xdwdsCustomersID: TIntegerField;
xdwdsCustomersNAME: TStringField; xdwdsCustomersNAME: TStringField;
xdwdsCustomersSHORT_NAME: TStringField; xdwdsCustomersSHORT_NAME: TStringField;
wdsCustomers: TWebDataSource; wdsCustomers: TWebDataSource;
xdwdsCustomersADDRESS: TStringField;
cbCuttingDie: TWebCheckBox; cbCuttingDie: TWebCheckBox;
edtNotification: TWebEdit; edtNotification: TWebEdit;
xdwdsCustomersstaff_fields_invoice_to: TStringField;
xdwdsCustomersCUSTOMER_ID: TIntegerField;
WebLabel3: TWebLabel;
edtName: TWebEdit;
procedure WebFormShow(Sender: TObject); procedure WebFormShow(Sender: TObject);
procedure TMSFNCGrid1SelectedCell(Sender: TObject; ACol, ARow: Integer);
procedure edtSearchChange(Sender: TObject); procedure edtSearchChange(Sender: TObject);
procedure cbCorrugatedPlateClick(Sender: TObject); procedure cbCorrugatedPlateClick(Sender: TObject);
procedure cbWebPlateClick(Sender: TObject); procedure cbWebPlateClick(Sender: TObject);
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
procedure cbCuttingDieClick(Sender: TObject); procedure cbCuttingDieClick(Sender: TObject);
procedure TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
private private
[async] procedure getCustomers; [async] procedure getCustomers;
procedure PopulateGridManually; procedure PopulateGridManually;
...@@ -50,6 +52,7 @@ type ...@@ -50,6 +52,7 @@ type
{ Public declarations } { Public declarations }
var var
confirm: boolean; confirm: boolean;
DBID: string;
end; end;
var var
...@@ -66,13 +69,28 @@ end; ...@@ -66,13 +69,28 @@ end;
procedure TFAddOrder.btnConfirmClick(Sender: TObject); procedure TFAddOrder.btnConfirmClick(Sender: TObject);
begin begin
confirm := true;
edtNotification.ElementHandle.style.setProperty('color', '#8B0000', 'important');
if ( ( not cbCorrugatedPlate.Checked ) and ( not cbWebPlate.Checked ) and ( not cbCuttingDie.Checked ) ) then if ( ( not cbCorrugatedPlate.Checked ) and ( not cbWebPlate.Checked ) and ( not cbCuttingDie.Checked ) ) then
edtNotification.Text := 'Please Select an Order Type'
else if edtID.Text = '' then
edtNotification.Text := 'Please Select a Customer'
else
begin begin
confirm := true; edtNotification.Text := 'Please Select an Order Type';
confirm := false;
end;
if edtID.Text = '' then
begin
edtNotification.Text := 'Please Select a Customer';
confirm := false;
end;
if ( ( not cbCorrugatedPlate.Checked ) and ( not cbWebPlate.Checked ) and ( not cbCuttingDie.Checked ) and (edtID.Text = '' )) then
begin
edtNotification.Text := 'Please Select an Order Type and a Customer';
confirm := false;
end;
if confirm = true then
begin
Close; Close;
end; end;
end; end;
...@@ -138,9 +156,9 @@ begin ...@@ -138,9 +156,9 @@ begin
// Set up column headers // Set up column headers
TMSFNCGrid1.ColumnCount := 4; TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1; TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'ID'; TMSFNCGrid1.Cells[0, 0] := 'Customer Num';
TMSFNCGrid1.Cells[1, 0] := 'Short Name'; TMSFNCGrid1.Cells[1, 0] := 'Customer ID';
TMSFNCGrid1.Cells[2, 0] := 'Name'; TMSFNCGrid1.Cells[2, 0] := 'Customer Name';
TMSFNCGrid1.Cells[3, 0] := 'Address'; TMSFNCGrid1.Cells[3, 0] := 'Address';
// Populate the grid with data from the dataset // Populate the grid with data from the dataset
...@@ -150,11 +168,10 @@ begin ...@@ -150,11 +168,10 @@ begin
while not xdwdsCustomers.EOF do while not xdwdsCustomers.EOF do
begin begin
TMSFNCGrid1.RowCount := RowIndex + 1; TMSFNCGrid1.RowCount := RowIndex + 1;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('CUSTOMER_ID').AsString;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('ID').AsString;
TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('SHORT_NAME').AsString; TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('SHORT_NAME').AsString;
TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('NAME').AsString; TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('NAME').AsString;
TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('ADDRESS').AsString; TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('staff_fields_invoice_to').AsString;
Inc(RowIndex); Inc(RowIndex);
xdwdsCustomers.Next; xdwdsCustomers.Next;
...@@ -167,11 +184,11 @@ end; ...@@ -167,11 +184,11 @@ end;
procedure TFAddOrder.TMSFNCGrid1SelectedCell(Sender: TObject; ACol, procedure TFAddOrder.TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
ARow: Integer);
// When a cell is clicked it puts the ID in the text box
begin begin
edtID.Text := TMSFNCGrid1.Cells[0, ARow]; edtID.Text := TMSFNCGrid1.Cells[1, ARow];
edtName.Text := TMSFNCGrid1.Cells[2, ARow];
DBID := TMSFNCGrid1.Cells[0, ARow];
end; end;
procedure TFAddOrder.ApplyFilter; procedure TFAddOrder.ApplyFilter;
......
object FViewCustomers: TFViewCustomers
Width = 640
Height = 480
OnCreate = WebFormCreate
object lblEntries: TWebLabel
Left = 12
Top = 117
Width = 81
Height = 15
Caption = 'Showing 0 of ...'
ElementID = 'lblentries'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnAddCustomer: TWebButton
Left = 12
Top = 81
Width = 96
Height = 25
Caption = 'Add Customer'
ChildOrder = 5
ElementID = 'btnaddcustomer'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 6
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnAddCustomerClick
end
object wcbPageSize: TWebComboBox
Left = 22
Top = 52
Width = 145
Height = 23
ElementClassName = 'custom-select'
ElementID = 'wcbpagesize'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Text = '500'
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'100'
'250'
'500'
'1000')
end
object pnlMessage: TWebPanel
Left = 12
Top = 16
Width = 121
Height = 33
ElementID = 'view.login.message'
ChildOrder = 17
TabOrder = 2
object lblMessage: TWebLabel
Left = 16
Top = 11
Width = 46
Height = 15
Caption = 'Message'
ElementID = 'view.login.message.label'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementID = 'view.login.message.button'
HeightPercent = 100.000000000000000000
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 Num'
end
item
DataField = 'SHORT_NAME'
Title = 'Customer ID'
end
item
DataField = 'NAME'
Title = 'Customer 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 = 158
Top = 90
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 262
Top = 116
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 346
Top = 92
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
Size = 0
end
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersSTART_DATE: TStringField
FieldName = 'START_DATE'
end
object xdwdsCustomersCUSTOMER_ID: TIntegerField
FieldName = 'CUSTOMER_ID'
end
end
end
<div class="container h-100 d-flex flex-column mt-0" style="max-width: 100%; padding-bottom: 0;">
<!-- Alert Section -->
<div class="row">
<div class=col-sm>
<div id="view.login.message" class="alert alert-danger">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
</div>
</div>
<!-- Actions Row -->
<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">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer ID:</label>
<input id="edtfilter" type="text" class="form-control" style="width: 200px;" />
</div>
</div>
<!-- Entries Label Section d-flex justify-content-between w-100 mt-2-->
<div class="row">
<div class="col-auto">
<label id="lblentries" style="font-size: 1.10rem;"></label>
</div>
</div>
<!-- Table Section -->
<div id="order_table_section" class="overflow-auto mt-2"
style="max-height: calc(100vh - 250px); padding-bottom: 0; width: 100%;">
<table id="tblPhoneGrid" class="table table-striped table-bordered" style="width: 100%;">
<thead class="sticky-top 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>
<!-- Pagination Section -->
<div class="d-flex justify-content-center w-100 mt-4">
<nav aria-label="Page navigation">
<ul id="pagination" class="pagination">
<!-- Pagination items added dynamically -->
</ul>
</nav>
</div>
</div>
...@@ -24,17 +24,6 @@ object FViewEditUser: TFViewEditUser ...@@ -24,17 +24,6 @@ object FViewEditUser: TFViewEditUser
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblQB: TWebLabel
Left = 256
Top = 65
Width = 80
Height = 15
Caption = 'Quickbooks ID:'
Color = clBtnFace
ElementID = 'lblQB'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel5: TWebLabel object WebLabel5: TWebLabel
Left = 284 Left = 284
Top = 8 Top = 8
...@@ -92,20 +81,21 @@ object FViewEditUser: TFViewEditUser ...@@ -92,20 +81,21 @@ object FViewEditUser: TFViewEditUser
object lblAccess: TWebLabel object lblAccess: TWebLabel
Left = 272 Left = 272
Top = 96 Top = 96
Width = 66 Width = 67
Height = 15 Height = 15
Caption = 'Access Type:' Caption = 'Access Type:'
ElementID = 'lblaccess' ElementID = 'lblaccess'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblPerspective: TWebLabel object lblQB: TWebLabel
Left = 3 Left = 256
Top = 132 Top = 65
Width = 77 Width = 80
Height = 15 Height = 15
Caption = 'Perspective ID:' Caption = 'Quickbooks ID:'
ElementID = 'lblperspective' Color = clBtnFace
ElementID = 'lblQB'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
...@@ -256,16 +246,6 @@ object FViewEditUser: TFViewEditUser ...@@ -256,16 +246,6 @@ object FViewEditUser: TFViewEditUser
ParentFont = False ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object edtQB: TWebEdit
Left = 348
Top = 62
Width = 121
Height = 22
ChildOrder = 7
ElementID = 'edtQB'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtRights: TWebEdit object edtRights: TWebEdit
Left = 96 Left = 96
Top = 93 Top = 93
...@@ -293,13 +273,13 @@ object FViewEditUser: TFViewEditUser ...@@ -293,13 +273,13 @@ object FViewEditUser: TFViewEditUser
'ALL' 'ALL'
'ACTIVE') 'ACTIVE')
end end
object edtPerspective: TWebEdit object edtQB: TWebEdit
Left = 96 Left = 346
Top = 129 Top = 62
Width = 121 Width = 121
Height = 22 Height = 22
ChildOrder = 23 ChildOrder = 7
ElementID = 'edtperspective' ElementID = 'edtQB'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
......
...@@ -48,15 +48,10 @@ ...@@ -48,15 +48,10 @@
</div> </div>
</form> </form>
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-6">
<label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblrights">System Rights:</label> <label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblrights">System Rights:</label>
<input id="edtrights" class= "form-control input-sm" width='50%'/> <input id="edtrights" class= "form-control input-sm" width='50%'/>
</div> </div>
<div class="col-sm-6">
<label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblperspective">Perspective ID:</label>
<input id="edtperspective" class= "form-control input-sm" width='50%'/>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm py-3"> <div class="col-sm py-3">
......
...@@ -14,7 +14,6 @@ type ...@@ -14,7 +14,6 @@ type
TFViewEditUser = class(TWebForm) TFViewEditUser = class(TWebForm)
WebLabel2: TWebLabel; WebLabel2: TWebLabel;
WebLabel3: TWebLabel; WebLabel3: TWebLabel;
lblQB: TWebLabel;
WebLabel5: TWebLabel; WebLabel5: TWebLabel;
WebLabel6: TWebLabel; WebLabel6: TWebLabel;
WebLabel7: TWebLabel; WebLabel7: TWebLabel;
...@@ -34,12 +33,11 @@ type ...@@ -34,12 +33,11 @@ type
lblactive: TWebLabel; lblactive: TWebLabel;
cbStatus: TWebCheckBox; cbStatus: TWebCheckBox;
lblRights: TWebLabel; lblRights: TWebLabel;
edtQB: TWebEdit;
edtRights: TWebEdit; edtRights: TWebEdit;
lblAccess: TWebLabel; lblAccess: TWebLabel;
cbAccess: TWebComboBox; cbAccess: TWebComboBox;
lblPerspective: TWebLabel; lblQB: TWebLabel;
edtPerspective: TWebEdit; edtQB: TWebEdit;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
...@@ -80,7 +78,8 @@ Windows, ...@@ -80,7 +78,8 @@ Windows,
View.Main, View.Main,
View.Users, View.Users,
VCL.Dialogs, VCL.Dialogs,
ConnectionModule; ConnectionModule,
Utils;
procedure TFViewEditUser.btnCancelClick(Sender: TObject); procedure TFViewEditUser.btnCancelClick(Sender: TObject);
// Cancels the edit or addition // Cancels the edit or addition
...@@ -101,9 +100,7 @@ begin ...@@ -101,9 +100,7 @@ begin
else else
AddUser(); AddUser();
WebTimer1.Enabled := true; WebTimer1.Enabled := true;
asm Utils.ShowSpinner('spinner');
startSpinner();
end;
end; end;
function TFViewEditUser.AddUser(): string; function TFViewEditUser.AddUser(): string;
...@@ -121,7 +118,6 @@ begin ...@@ -121,7 +118,6 @@ begin
'&access=' + cbAccess.Text + '&access=' + cbAccess.Text +
'&newuser=' + edtUsername.Text + '&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text + '&rights=' + edtRights.Text +
'&perspective=' + edtPerspective.Text +
'&QB=' + edtQB.Text; '&QB=' + edtQB.Text;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser', xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser',
...@@ -160,7 +156,6 @@ begin ...@@ -160,7 +156,6 @@ begin
'&access=' + cbAccess.Text + '&access=' + cbAccess.Text +
'&newuser=' + edtUsername.Text + '&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text + '&rights=' + edtRights.Text +
'&perspective=' + edtPerspective.Text +
'&QB=' + edtQB.Text; '&QB=' + edtQB.Text;
console.log(editOptions); console.log(editOptions);
...@@ -215,15 +210,12 @@ begin ...@@ -215,15 +210,12 @@ begin
edtQB.Text := QB; edtQB.Text := QB;
if Status = 'ACTIVE' then if Status = 'ACTIVE' then
cbStatus.checked := true; cbStatus.checked := true;
edtPerspective.Text := Perspective
end; end;
procedure TFViewEditUser.WebTimer1Timer(Sender: TObject); procedure TFViewEditUser.WebTimer1Timer(Sender: TObject);
begin begin
WebTimer1.Enabled := False; WebTimer1.Enabled := False;
asm Utils.HideSpinner('spinner');
endSpinner();
end;
if (not Info.Contains('Failure')) then if (not Info.Contains('Failure')) then
begin begin
FViewMain.ShowUserForm(Info); FViewMain.ShowUserForm(Info);
...@@ -344,9 +336,16 @@ begin ...@@ -344,9 +336,16 @@ begin
end; end;
} }
asm asm
var confirmationModal = new bootstrap.Modal(document.getElementById('confirmation_modal'), { var modal = document.getElementById('confirmation_modal');
keyboard: false }); // ensure the modal is directly under <body>
confirmationModal.show(); if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
var bsModal = new bootstrap.Modal(modal, {
keyboard: false
});
bsModal.show();
end; end;
end; end;
......
...@@ -55,7 +55,7 @@ implementation ...@@ -55,7 +55,7 @@ implementation
uses uses
JS, XData.Model.Classes, JS, XData.Model.Classes,
ConnectionModule, Auth.Service; ConnectionModule, Auth.Service, Utils;
{$R *.dfm} {$R *.dfm}
...@@ -119,6 +119,7 @@ begin ...@@ -119,6 +119,7 @@ begin
// Appends new rows to the table body // Appends new rows to the table body
TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow); TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
Utils.HideSpinner('spinner');
end; end;
procedure TFViewItems.GeneratePagination(TotalPages: Integer); procedure TFViewItems.GeneratePagination(TotalPages: Integer);
...@@ -304,18 +305,14 @@ begin ...@@ -304,18 +305,14 @@ begin
console.log('correct'); console.log('correct');
if PageNumber > 0 then if PageNumber > 0 then
begin begin
asm Utils.ShowSpinner('spinner');
startSpinner();
end;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems', xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems',
[searchOptions])); [searchOptions]));
itemList := TJSObject(xdcResponse.Result); itemList := TJSObject(xdcResponse.Result);
data := TJSArray(itemList['data']); data := TJSArray(itemList['data']);
itemListLength := integer(itemList['count']); itemListLength := integer(itemList['count']);
ClearTable(); ClearTable();
asm Utils.HideSpinner('Spinner');
setTimeout(endSpinner, 2000);
end;
for i := 0 to data.Length - 1 do for i := 0 to data.Length - 1 do
begin begin
item := TJSObject(data[i]); item := TJSObject(data[i]);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -27,7 +27,6 @@ type ...@@ -27,7 +27,6 @@ type
FMessage: string; FMessage: string;
procedure ShowNotification(Notification: string); procedure ShowNotification(Notification: string);
procedure HideNotification; procedure HideNotification;
[async] procedure VerifyVersion();
public public
class procedure Display(LoginProc: TSuccessProc); overload; class procedure Display(LoginProc: TSuccessProc); overload;
class procedure Display(LoginProc: TSuccessProc; AMsg: string); overload; class procedure Display(LoginProc: TSuccessProc; AMsg: string); overload;
...@@ -85,7 +84,8 @@ end; ...@@ -85,7 +84,8 @@ end;
procedure TFViewLogin.HideNotification; procedure TFViewLogin.HideNotification;
begin begin
pnlMessage.ElementHandle.hidden := True; pnlMessage.ElementHandle.classList.add('d-none');
pnlMessage.Visible := False;
end; end;
procedure TFViewLogin.ShowNotification(Notification: string); procedure TFViewLogin.ShowNotification(Notification: string);
...@@ -93,32 +93,23 @@ begin ...@@ -93,32 +93,23 @@ begin
if Notification <> '' then if Notification <> '' then
begin begin
lblMessage.Caption := Notification; lblMessage.Caption := Notification;
pnlMessage.ElementHandle.hidden := False; pnlMessage.ElementHandle.classList.remove('d-none');
pnlMessage.Visible := True;
end; end;
end; end;
procedure TFViewLogin.btnCloseNotificationClick(Sender: TObject);
begin
HideNotification;
end;
procedure TFViewLogin.VerifyVersion();
var
xdcResponse: TXDataClientResponse;
begin
xdcResponse := await(XDataWebClient.RawInvokeAsync('IAuthService.VerifyVersion',
['1.0.0']));
ShowNotification(string(TJSObject(xdcResponse.Result)['value']));
end;
procedure TFViewLogin.WebFormCreate(Sender: TObject); procedure TFViewLogin.WebFormCreate(Sender: TObject);
begin begin
// lblAppTitle.Caption := 'EM Systems - webCharms App ver 0.9.2.22';
VerifyVersion();
if FMessage <> '' then if FMessage <> '' then
ShowNotification(FMessage) ShowNotification(FMessage)
else else
HideNotification; HideNotification;
end; end;
procedure TFViewLogin.btnCloseNotificationClick(Sender: TObject);
begin
HideNotification;
end;
end. end.
object FViewMain: TFViewMain object FViewMain: TFViewMain
Width = 640 Width = 1322
Height = 586 Height = 764
CSSLibrary = cssBootstrap CSSLibrary = cssBootstrap
ElementFont = efCSS ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
OnCreate = WebFormCreate OnCreate = WebFormCreate
object lblUsername: TWebLabel object lblUsername: TWebLabel
Left = 529 Left = 529
Top = 4 Top = 4
Width = 66 Width = 59
Height = 15 Height = 14
Caption = 'lblUsername' Caption = 'lblUsername'
ElementID = 'view.main.username' ElementID = 'view.main.username'
ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Transparent = False Transparent = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
...@@ -18,8 +25,8 @@ object FViewMain: TFViewMain ...@@ -18,8 +25,8 @@ object FViewMain: TFViewMain
object wllblUserProfile: TWebLinkLabel object wllblUserProfile: TWebLinkLabel
Left = 529 Left = 529
Top = 21 Top = 21
Width = 63 Width = 59
Height = 15 Height = 14
ElementID = 'dropdown.menu.userprofile' ElementID = 'dropdown.menu.userprofile'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
...@@ -29,8 +36,8 @@ object FViewMain: TFViewMain ...@@ -29,8 +36,8 @@ object FViewMain: TFViewMain
object wllblLogout: TWebLinkLabel object wllblLogout: TWebLinkLabel
Left = 551 Left = 551
Top = 143 Top = 143
Width = 41 Width = 36
Height = 15 Height = 14
ElementID = 'dropdown.menu.logout' ElementID = 'dropdown.menu.logout'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
...@@ -40,8 +47,8 @@ object FViewMain: TFViewMain ...@@ -40,8 +47,8 @@ object FViewMain: TFViewMain
object lblHome: TWebLinkLabel object lblHome: TWebLinkLabel
Left = 556 Left = 556
Top = 38 Top = 38
Width = 33 Width = 27
Height = 15 Height = 14
ElementID = 'dropdown.menu.home' ElementID = 'dropdown.menu.home'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
...@@ -51,10 +58,11 @@ object FViewMain: TFViewMain ...@@ -51,10 +58,11 @@ object FViewMain: TFViewMain
object lblAppTitle: TWebLabel object lblAppTitle: TWebLabel
Left = 57 Left = 57
Top = 31 Top = 31
Width = 82 Width = 75
Height = 15 Height = 14
Caption = 'Koehler-Gibson' Caption = 'Koehler-Gibson'
ElementID = 'view.main.apptitle' ElementID = 'view.main.apptitle'
ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Transparent = False Transparent = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
...@@ -62,8 +70,8 @@ object FViewMain: TFViewMain ...@@ -62,8 +70,8 @@ object FViewMain: TFViewMain
object lblItemsList: TWebLinkLabel object lblItemsList: TWebLinkLabel
Left = 560 Left = 560
Top = 85 Top = 85
Width = 29 Width = 25
Height = 15 Height = 14
ElementID = 'dropdown.menu.itemlist' ElementID = 'dropdown.menu.itemlist'
ElementFont = efCSS ElementFont = efCSS
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -74,8 +82,8 @@ object FViewMain: TFViewMain ...@@ -74,8 +82,8 @@ object FViewMain: TFViewMain
object lblUsers: TWebLinkLabel object lblUsers: TWebLinkLabel
Left = 561 Left = 561
Top = 108 Top = 108
Width = 28 Width = 29
Height = 15 Height = 14
ElementID = 'dropdown.menu.users' ElementID = 'dropdown.menu.users'
ElementFont = efCSS ElementFont = efCSS
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -86,11 +94,12 @@ object FViewMain: TFViewMain ...@@ -86,11 +94,12 @@ object FViewMain: TFViewMain
object lblorders: TWebLabel object lblorders: TWebLabel
Left = 556 Left = 556
Top = 52 Top = 52
Width = 35 Width = 34
Height = 15 Height = 14
Caption = 'Orders' Caption = 'Orders'
ElementID = 'lblorders' ElementID = 'lblorders'
ElementFont = efCSS ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
...@@ -99,11 +108,12 @@ object FViewMain: TFViewMain ...@@ -99,11 +108,12 @@ object FViewMain: TFViewMain
object lblCustomers: TWebLabel object lblCustomers: TWebLabel
Left = 540 Left = 540
Top = 69 Top = 69
Width = 57 Width = 52
Height = 15 Height = 14
Caption = 'Customers' Caption = 'Customers'
ElementID = 'lblcustomers' ElementID = 'lblcustomers'
ElementFont = efCSS ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
...@@ -112,52 +122,87 @@ object FViewMain: TFViewMain ...@@ -112,52 +122,87 @@ object FViewMain: TFViewMain
object lblQuickbooks: TWebLabel object lblQuickbooks: TWebLabel
Left = 546 Left = 546
Top = 125 Top = 125
Width = 63 Width = 57
Height = 15 Height = 14
Caption = 'QuickBooks' Caption = 'QuickBooks'
ElementID = 'lblquickbooks' ElementID = 'lblquickbooks'
ElementFont = efCSS ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = lblQuickbooksClick OnClick = lblQuickbooksClick
end end
object lblVersion: TWebLabel
Left = 358
Top = 209
Width = 47
Height = 14
Caption = 'lblVersion'
ElementID = 'view.main.version'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebPanel1: TWebPanel object WebPanel1: TWebPanel
Left = 77 Left = 77
Top = 112 Top = 112
Width = 471 Width = 1322
Height = 369 Height = 0
ElementID = 'main.webpanel' ElementID = 'main.webpanel'
HeightStyle = ssAuto HeightStyle = ssAuto
WidthStyle = ssAuto WidthStyle = ssAuto
ChildOrder = 3 ChildOrder = 3
ElementFont = efCSS ElementFont = efCSS
ElementPosition = epIgnore ElementPosition = epIgnore
Role = 'null'
TabOrder = 0 TabOrder = 0
end end
object WebMessageDlg1: TWebMessageDlg
Left = 47
Top = 232
Width = 24
Height = 24
Buttons = []
CustomButtons = <>
Opacity = 0.200000000000000000
end
object WebMemo1: TWebMemo object WebMemo1: TWebMemo
Left = 77 Left = 77
Top = 479 Top = 479
Width = 471 Width = 471
Height = 83 Height = 83
ElementID = 'main.debugmemo' ElementID = 'main.debugmemo'
ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Lines.Strings = ( Lines.Strings = (
'WebMemo1') 'WebMemo1')
Role = 'null'
SelLength = 0 SelLength = 0
SelStart = 0 SelStart = 0
Visible = False Visible = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebMessageDlg1: TWebMessageDlg
Left = 47
Top = 232
Width = 24
Height = 24
Buttons = []
CustomButtons = <>
DialogText.Strings = (
'Warning'
'Error'
'Information'
'Confirm'
'Custom'
'OK'
'Cancel'
'Yes'
'No'
'Abort'
'Retry'
'Ignore'
'All'
'Yes to all'
'No to all'
'Help'
'Close')
Opacity = 0.200000000000000000
end
object XDataWebClient: TXDataWebClient object XDataWebClient: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 44 Left = 44
......
<div id="wrapper"> <div id="wrapper">
<nav class="navbar navbar-expand navbar-light bg-light" style="margin-bottom: 0px;"> <nav class="navbar navbar-expand navbar-light bg-light" style="margin-bottom: 0px;">
<div class="container-fluid"> <div class="container-fluid">
<a id="view.main.apptitle" class="navbar-brand" href="index.html">Koehler-Gibson Orders</a> <div class="d-flex align-items-center">
<a id="view.main.apptitle" class="navbar-brand" href="index.html">Koehler-Gibson Orders</a>
<span id="view.main.version" class="small text-muted ms-2"></span>
</div>
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<li class="nav-item"> <li class="nav-item">
<a class="dropdown-item" id="lblorders" href="#"><i class="fa fa-tags fa-fw"></i><span> Orders</span></a> <a class="dropdown-item" id="lblorders" href="#"><i class="fa fa-tags fa-fw"></i><span> Orders</span></a>
...@@ -59,3 +62,13 @@ ...@@ -59,3 +62,13 @@
</div> </div>
</div> </div>
<div id="spinner" class="position-absolute top-50 start-50 translate-middle d-none">
<div class="lds-roller">
<div></div><div></div><div></div><div></div>
<div></div><div></div><div></div><div></div>
</div>
</div>
...@@ -6,7 +6,7 @@ uses ...@@ -6,7 +6,7 @@ uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls, System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.ExtCtrls, Vcl.Controls, Vcl.StdCtrls, WEBLib.Forms, WEBLib.Dialogs, WEBLib.ExtCtrls, Vcl.Controls, Vcl.StdCtrls,
WEBLib.StdCtrls, Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.StdCtrls, Data.DB, XData.Web.JsonDataset, XData.Web.Dataset,
App.Types, ConnectionModule, XData.Web.Client; App.Types, ConnectionModule, XData.Web.Client, WEBLib.Menus;
type type
TFViewMain = class(TWebForm) TFViewMain = class(TWebForm)
...@@ -24,6 +24,7 @@ type ...@@ -24,6 +24,7 @@ type
lblorders: TWebLabel; lblorders: TWebLabel;
lblCustomers: TWebLabel; lblCustomers: TWebLabel;
lblQuickbooks: TWebLabel; lblQuickbooks: TWebLabel;
lblVersion: TWebLabel;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure mnuLogoutClick(Sender: TObject); procedure mnuLogoutClick(Sender: TObject);
procedure wllblUserProfileClick(Sender: TObject); procedure wllblUserProfileClick(Sender: TObject);
...@@ -49,13 +50,17 @@ type ...@@ -49,13 +50,17 @@ type
{ Public declarations } { Public declarations }
class procedure Display(LogoutProc: TLogoutProc); class procedure Display(LogoutProc: TLogoutProc);
procedure ShowForm( AFormClass: TWebFormClass ); procedure ShowForm( AFormClass: TWebFormClass );
procedure EditUser( Mode, Username, Password, Name, Status, Email, procedure EditUser( Mode, Username, Password, Name, Status, Email, Access, Rights, Perspective, QB: string);
Access, Rights, Perspective, QB: string); procedure ViewOrderEntryCorrugated(orderInfo, customerInfo, mode, info: string);
procedure ViewOrderEntryCorrugated(orderInfo, customerInfo, mode: string); procedure ViewOrderEntryWeb(orderInfo, customerInfo, mode, info: string);
procedure ViewOrderEntryWeb(orderInfo, customerInfo, mode: string); procedure ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode, info: string);
procedure ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode: string);
procedure ViewOrders(info: string); procedure ViewOrders(info: string);
procedure ViewCustomerList(info: string);
procedure ShowUserForm(Info: string); procedure ShowUserForm(Info: string);
procedure ViewAddCustomer(customerInfo, info: string);
var
search: string;
change: boolean;
end; end;
var var
...@@ -74,7 +79,8 @@ uses ...@@ -74,7 +79,8 @@ uses
View.Orders, View.Orders,
View.OrderEntryCorrugated, View.OrderEntryCorrugated,
View.OrderEntryCuttingDie, View.OrderEntryCuttingDie,
View.OrderEntryWeb; View.OrderEntryWeb,
View.Customers, AddCustomer;
{$R *.dfm} {$R *.dfm}
...@@ -86,6 +92,7 @@ begin ...@@ -86,6 +92,7 @@ begin
userName := JS.toString(AuthService.TokenPayload.Properties['user_name']); userName := JS.toString(AuthService.TokenPayload.Properties['user_name']);
lblUsername.Caption := ' ' + userName.ToLower + ' '; lblUsername.Caption := ' ' + userName.ToLower + ' ';
FChildForm := nil; FChildForm := nil;
change := false;
if (not (JS.toBoolean(AuthService.TokenPayload.Properties['user_admin']))) then if (not (JS.toBoolean(AuthService.TokenPayload.Properties['user_admin']))) then
lblUsers.Visible := false; lblUsers.Visible := false;
...@@ -93,6 +100,8 @@ begin ...@@ -93,6 +100,8 @@ begin
lblUsers.Visible := true; lblUsers.Visible := true;
ShowForm(TFViewOrders); ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders'; lblAppTitle.Caption := 'Koehler-Gibson Orders';
lblVersion.Caption := 'v' + DMConnection.clientVersion;
setActive('Orders'); setActive('Orders');
end; end;
...@@ -101,43 +110,74 @@ end; ...@@ -101,43 +110,74 @@ end;
procedure TFViewMain.lblCustomersClick(Sender: TObject); procedure TFViewMain.lblCustomersClick(Sender: TObject);
begin begin
//ShowForm(TFViewCustomers); if ( not ( change ) ) then
lblAppTitle.Caption := 'Koehler-Gibson Customers'; begin
setActive('Customers'); ShowForm(TFViewCustomers);
lblAppTitle.Caption := 'Koehler-Gibson Customers';
setActive('Customers');
end
else
ShowMessage('Please Save or Cancel your changes');
end; end;
procedure TFViewMain.lblHomeClick(Sender: TObject); procedure TFViewMain.lblHomeClick(Sender: TObject);
begin begin
ShowForm(TFViewHome); if ( not ( change ) ) then
lblAppTitle.Caption := 'Koehler-Gibson Home'; begin
//setActive('Home'); ShowForm(TFViewHome);
lblAppTitle.Caption := 'Koehler-Gibson Home';
//setActive('Home');
end
else
ShowMessage('Please Save or Cancel your changes');
end; end;
procedure TFViewMain.lblordersClick(Sender: TObject); procedure TFViewMain.lblordersClick(Sender: TObject);
begin begin
ShowForm(TFViewOrders); console.log(change);
lblAppTitle.Caption := 'Koehler-Gibson Orders'; if ( not ( change ) ) then
setActive('Orders'); begin
ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders';
setActive('Orders');
end
else
ShowMessage('Please Save or Cancel your changes');
end; end;
procedure TFViewMain.lblQuickbooksClick(Sender: TObject); procedure TFViewMain.lblQuickbooksClick(Sender: TObject);
begin begin
//ShowForm(TFViewQuickbooks); if ( not ( change ) ) then
lblAppTitle.Caption := 'Koehler-Gibson QuickBooks'; begin
setActive('QuickBooks'); //ShowForm(TFViewQuickbooks);
lblAppTitle.Caption := 'Koehler-Gibson QuickBooks';
setActive('QuickBooks');
end
else
ShowMessage('Please Save or Cancel your changes');
end; end;
procedure TFViewMain.lblUsersClick(Sender: TObject); procedure TFViewMain.lblUsersClick(Sender: TObject);
begin begin
ShowForm(TFViewUsers); if ( not ( change ) ) then
lblAppTitle.Caption := 'Koehler-Gibson Users'; begin
ShowForm(TFViewUsers);
lblAppTitle.Caption := 'Koehler-Gibson Users';
end
else
ShowMessage('Please Save or Cancel your changes');
end; end;
procedure TFViewMain.lblItemsListClick(Sender: TObject); procedure TFViewMain.lblItemsListClick(Sender: TObject);
begin begin
ShowForm(TFViewItems); if ( not ( change ) ) then
lblAppTitle.Caption := 'Koehler-Gibson Items'; begin
setActive('Items'); ShowForm(TFViewItems);
lblAppTitle.Caption := 'Koehler-Gibson Items';
setActive('Items');
end
else
ShowMessage('Please Save or Cancel your changes');
end; end;
procedure TFViewMain.setActive(page: string); procedure TFViewMain.setActive(page: string);
...@@ -176,7 +216,7 @@ begin ...@@ -176,7 +216,7 @@ begin
lblAppTitle.Caption := 'Koehler-Gibson User Profile'; lblAppTitle.Caption := 'Koehler-Gibson User Profile';
end; end;
//needs to be changed
function TFViewMain.GetUserInfo: string; function TFViewMain.GetUserInfo: string;
var var
userStr: string; userStr: string;
...@@ -214,6 +254,11 @@ begin ...@@ -214,6 +254,11 @@ begin
Application.CreateForm(AFormClass, WebPanel1.ElementID, FChildForm); Application.CreateForm(AFormClass, WebPanel1.ElementID, FChildForm);
end; end;
procedure TFViewMain.ViewCustomerList(info: string);
begin
end;
procedure TFViewMain.EditUser(Mode, Username, Password, Name, Status, Email, procedure TFViewMain.EditUser(Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string); Access, Rights, Perspective, QB: string);
begin begin
...@@ -231,28 +276,36 @@ begin ...@@ -231,28 +276,36 @@ begin
end; end;
procedure TFViewMain.ViewOrderEntryCorrugated(orderInfo, customerInfo, mode: string); procedure TFViewMain.ViewOrderEntryCorrugated(orderInfo, customerInfo, mode, info: string);
begin begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry'; lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then if Assigned(FChildForm) then
FChildForm.Free; FChildForm.Free;
FChildForm := TFOrderEntryCorrugated.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode); FChildForm := TFOrderEntryCorrugated.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode, info);
end; end;
procedure TFViewMain.ViewOrderEntryWeb(orderInfo, customerInfo, mode: string); procedure TFViewMain.ViewOrderEntryWeb(orderInfo, customerInfo, mode, info: string);
begin begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry'; lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then if Assigned(FChildForm) then
FChildForm.Free; FChildForm.Free;
FChildForm := TFOrderEntryWeb.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode); FChildForm := TFOrderEntryWeb.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode, info);
end; end;
procedure TFViewMain.ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode: string); procedure TFViewMain.ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode, info: string);
begin begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry'; lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then if Assigned(FChildForm) then
FChildForm.Free; FChildForm.Free;
FChildForm := TFOrderEntryCuttingDie.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode); FChildForm := TFOrderEntryCuttingDie.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode, info);
end;
procedure TFViewMain.ViewAddCustomer(customerInfo: string; info: string);
begin
lblAppTitle.Caption := 'Koehler-Gibson Add Customer';
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFViewAddCustomer.CreateForm(WebPanel1.ElementID, customerInfo, info);
end; end;
procedure TFViewMain.ShowUserForm(Info: string); procedure TFViewMain.ShowUserForm(Info: string);
......
...@@ -70,6 +70,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -70,6 +70,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpProofDate: TWebDateTimePicker object dtpProofDate: TWebDateTimePicker
Left = 22 Left = 22
...@@ -83,6 +84,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -83,6 +84,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpShipDate: TWebDateTimePicker object dtpShipDate: TWebDateTimePicker
Left = 22 Left = 22
...@@ -96,6 +98,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -96,6 +98,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object edtShipVia: TWebDBEdit object edtShipVia: TWebDBEdit
Left = 24 Left = 24
...@@ -188,19 +191,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -188,19 +191,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
DataField = 'staff_fields_job_name' DataField = 'staff_fields_job_name'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object edtQuickBooksItem: TWebDBEdit
Left = 26
Top = 514
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtquickbooksitem'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_quickbooks_item'
DataSource = WebDataSource1
end
object edtSpecialInstructions: TWebDBEdit object edtSpecialInstructions: TWebDBEdit
Left = 835 Left = 835
Top = 185 Top = 185
...@@ -214,21 +204,21 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -214,21 +204,21 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
DataField = 'general_special_instructions' DataField = 'general_special_instructions'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object btnConfirm: TWebButton object btnSave: TWebButton
Left = 652 Left = 526
Top = 560 Top = 418
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Confirm' Caption = 'Save'
ChildOrder = 79 ChildOrder = 79
ElementID = 'btnconfirm' ElementID = 'btnconfirm'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick OnClick = btnSaveClick
end end
object btnCancel: TWebButton object btnCancel: TWebButton
Left = 764 Left = 640
Top = 560 Top = 418
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Cancel' Caption = 'Cancel'
...@@ -243,11 +233,11 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -243,11 +233,11 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Top = 19 Top = 19
Width = 121 Width = 121
Height = 33 Height = 33
ElementID = 'pnl_message' ElementID = 'view.login.message'
ChildOrder = 5 ChildOrder = 5
ElementPosition = epRelative ElementPosition = epRelative
Role = 'alert' Role = 'alert'
TabOrder = 16 TabOrder = 15
object lblMessage: TWebLabel object lblMessage: TWebLabel
Left = 28 Left = 28
Top = 9 Top = 9
...@@ -287,12 +277,134 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -287,12 +277,134 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
DataField = 'NAME' DataField = 'NAME'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object wcbQBItem: TWebDBComboBox
Left = 26
Top = 515
Width = 145
Height = 23
ElementID = 'wcbqbitem'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
DataField = 'staff_fields_quickbooks_item'
DataSource = WebDataSource1
ListField = 'name'
ListSource = wdsQBItem
end
object btnPDF: TWebButton
Left = 742
Top = 417
Width = 96
Height = 25
Caption = 'PDF'
ChildOrder = 77
ElementID = 'btnpdf'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnPDFClick
end
object edtOrderNum: TWebEdit
Left = 126
Top = 194
Width = 121
Height = 22
ChildOrder = 81
ElementID = 'edtordernum'
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnDelete: TWebButton
Left = 534
Top = 458
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 79
ElementID = 'btndelete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnDeleteClick
end
object btnClose: TWebButton
Left = 644
Top = 453
Width = 96
Height = 25
Caption = 'Close'
ChildOrder = 80
ElementID = 'btnclose'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseClick
end
object btn_confirm_delete: TWebButton
Left = 776
Top = 279
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 82
ElementID = 'btn_confirm_delete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btn_confirm_deleteClick
end
object btnCopy: TWebButton
Left = 746
Top = 453
Width = 96
Height = 25
Caption = 'Copy'
ChildOrder = 78
ElementID = 'btncopy'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCopyClick
end
object btnEdit: TWebButton
Left = 644
Top = 495
Width = 96
Height = 25
Caption = 'Edit'
ChildOrder = 78
ElementID = 'btnedit'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnEditClick
end
object btnAdd: TWebButton
Left = 532
Top = 495
Width = 96
Height = 25
Caption = 'Add'
ChildOrder = 78
ElementID = 'btnadd'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnAddClick
end
object WebButton2: TWebButton
Left = 186
Top = 429
Width = 96
Height = 25
Caption = 'Add Address'
ChildOrder = 85
ElementID = 'btnaddaddress'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = WebButton2Click
end
object WebDataSource1: TWebDataSource object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1 DataSet = XDataWebDataSet1
Left = 22 Left = 22
Top = 10 Top = 10
end end
object XDataWebDataSet1: TXDataWebDataSet object XDataWebDataSet1: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 90 Left = 90
Top = 20 Top = 20
...@@ -344,17 +456,23 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -344,17 +456,23 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
object XDataWebDataSet1staff_fields_ship_date: TStringField object XDataWebDataSet1staff_fields_ship_date: TStringField
FieldName = 'staff_fields_ship_date' FieldName = 'staff_fields_ship_date'
end end
object XDataWebDataSet1ORDER_ID: TStringField
FieldName = 'ORDER_ID'
end
object XDataWebDataSet1NAME: TStringField object XDataWebDataSet1NAME: TStringField
FieldName = 'NAME' FieldName = 'NAME'
end end
object XDataWebDataSet1staff_fields_quickbooks_item: TStringField
FieldName = 'staff_fields_quickbooks_item'
end
object XDataWebDataSet1general_special_instructions: TStringField
FieldName = 'general_special_instructions'
end
object XDataWebDataSet1staff_fields_quantity: TStringField
FieldName = 'staff_fields_quantity'
end
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 160 Left = 192
Top = 18 Top = 92
end end
object tmrScrollTop: TWebTimer object tmrScrollTop: TWebTimer
Interval = 100 Interval = 100
...@@ -364,14 +482,34 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -364,14 +482,34 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
end end
object wdsShipTo: TWebDataSource object wdsShipTo: TWebDataSource
DataSet = xdwdsShipTo DataSet = xdwdsShipTo
Left = 212 Left = 302
Top = 436 Top = 418
end end
object xdwdsShipTo: TXDataWebDataSet object xdwdsShipTo: TXDataWebDataSet
Left = 192 AfterEdit = xdwdsShipToAfterEdit
Top = 486 Left = 288
Top = 370
object xdwdsShipToADDRESS: TStringField object xdwdsShipToADDRESS: TStringField
FieldName = 'ADDRESS' FieldName = 'ADDRESS'
end end
end end
object wdsQBItem: TWebDataSource
DataSet = xdwdsQBItem
Left = 230
Top = 554
end
object xdwdsQBItem: TXDataWebDataSet
AfterEdit = xdwdsQBItemAfterEdit
Left = 190
Top = 548
object xdwdsQBItemname: TStringField
FieldName = 'name'
end
end
object tmrReturn: TWebTimer
Enabled = False
OnTimer = tmrReturnTimer
Left = 306
Top = 62
end
end end
<div class="col-12 col-md-8"> <nav class="navbar navbar-expand navbar-light bg-light sticky-top" style="z-index: 100;">
<div class="row"> <div class="container-fluid ps-0">
<div class=col-sm> <div id="view.login.message" class="alert alert-danger"
<div id="pnl_message" class="alert alert-danger"> style="padding: 0.25rem 0.5rem; font-size: 0.875rem; line-height: 1.5; display: flex; align-items: center; margin: 0 0 0 60px; height: 32px; width: 400px;">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button> <button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span> <span id="view.login.message.label"></span>
</div> </div>
</div> <ul class="navbar-nav me-auto ps-2">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btncopy" class="btn btn-primary btn-sm">Copy</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnpdf" class="btn btn-primary btn-sm">PDF</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
<li class="nav-item">
<button id="btnclose" class="btn btn-secondary btn-sm">Close</button>
</li>
</ul>
</div> </div>
<h4 class="custom-h4 mt-3">Company</h4> </nav>
<div class="row mx-5">
<h4 class="custom-h4 mt-3">Customer</h4>
<hr class="custom-hr"> <hr class="custom-hr">
<div class="row"> <div class="row">
<div class="col-auto"> <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">Customer Name:</label>
<input id="edtcompanyname" type="text" class="form-control" style="width: 300px;"/> <input id="edtcompanyname" type="text" class="form-control" style="width: 300px;" required/>
</div> <div class="invalid-feedback" style="font-size: 15px;">
<div class="col-auto"> Please Provide a Customer Name.
<label for="wdbe_first_name" class="form-label mt-2">Account Company Name:</label> </div>
<input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px"/> </div>
</div> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer ID:</label>
<input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Customer ID.
</div>
</div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">In Quickbooks?:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">In Quickbooks?:</label>
<input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/> <input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/>
</div> </div>
</div> </div>
...@@ -27,10 +60,17 @@ ...@@ -27,10 +60,17 @@
<hr class="custom-hr"> <hr class="custom-hr">
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Order Date:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Order Num:</label>
<input class="form-control input-sm" id="dtporderdate" type="date"> <input id="edtordernum" class="form-control input-sm" style="width: 100px"/>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Order Date:</label>
<input class="form-control input-sm" id="dtporderdate" type="date" required>
<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">Proof Date:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Proof Date:</label>
<input class="form-control input-sm" id="dtpproofdate" type="date"> <input class="form-control input-sm" id="dtpproofdate" type="date">
</div> </div>
...@@ -52,11 +92,20 @@ ...@@ -52,11 +92,20 @@
</div> </div>
<div> <div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Invoice To:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Invoice To:</label>
<input id="edtinvoiceto" class="form-control input-sm"/> <input id="edtinvoiceto" class="form-control input-sm" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide an Invoice Address.
</div>
</div> </div>
<div> <div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ship To:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ship To:</label>
<select id="wcbshipto" class='form-select'></select> <select id="wcbshipto" class='form-select' required></select>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Ship To Address.
</div>
<div class="mt-2">
<button id="btnaddaddress" class="btn btn-primary btn-sm">Add Address</button>
</div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PO Number:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PO Number:</label>
...@@ -64,11 +113,11 @@ ...@@ -64,11 +113,11 @@
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Job Name:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Job Name:</label>
<input id="edtjobname" class="form-control input-sm" width='50%'/> <input id="edtjobname" class="form-control input-sm" style="width: 300px"/>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QuickBooks Item:</label> <label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QuickBooks Item:</label>
<input id="edtquickbooksitem" class="form-control input-sm" width='50%'/> <select id="wcbqbitem" class='form-select'></select>
</div> </div>
</div> </div>
<h4 class="custom-h4 mt-3">General</h4> <h4 class="custom-h4 mt-3">General</h4>
...@@ -79,12 +128,27 @@ ...@@ -79,12 +128,27 @@
<textarea id="edtspecialinstructions" class="form-control" style=" width: 500px; height: 150px;"></textarea> <textarea id="edtspecialinstructions" class="form-control" style=" width: 500px; height: 150px;"></textarea>
</div> </div>
</div> </div>
<div class="row"> </div>
<div class="col-auto"> <div class="modal fade" id="confirmation_modal" tabindex="-1" aria-labelledby="confirmation_modal_label" aria-hidden="true">
<button id="btnconfirm" class="btn btn-primary btn-sm float-end my-2">Confirm</button> <div class="modal-dialog">
</div> <div class="modal-content">
<div class="col-auto"> <div class="modal-header">
<button id="btncancel" class="btn btn-primary btn-sm float-end my-2">Cancel</button> <h5 class="modal-title" id="confirmation_modal_label">Confirm</h5>
</div> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="modal_body">
Are you sure you want to delete this order?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id=btn_confirm_cancel>Cancel</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" id="btn_confirm_delete">Delete</button>
</div>
</div> </div>
</div>
</div>
</div> </div>
<style>
.modal-backdrop {
opacity: 0 !important;
}
</style>
object FOrderEntryWeb: TFOrderEntryWeb object FOrderEntryWeb: TFOrderEntryWeb
Width = 1015 Width = 1261
Height = 628 Height = 628
OnShow = WebFormShow OnShow = WebFormShow
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
...@@ -117,7 +117,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -117,7 +117,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 19 Top = 19
Width = 121 Width = 121
Height = 33 Height = 33
ElementID = 'pnl_message' ElementID = 'view.login.message'
ChildOrder = 5 ChildOrder = 5
ElementPosition = epRelative ElementPosition = epRelative
Role = 'alert' Role = 'alert'
...@@ -147,6 +147,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -147,6 +147,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Role = 'button' Role = 'button'
WidthStyle = ssAuto WidthStyle = ssAuto
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end end
end end
object edtCompanyName: TWebDBEdit object edtCompanyName: TWebDBEdit
...@@ -202,6 +203,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -202,6 +203,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpProofDate: TWebDateTimePicker object dtpProofDate: TWebDateTimePicker
Left = 22 Left = 22
...@@ -215,6 +217,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -215,6 +217,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpShipDate: TWebDateTimePicker object dtpShipDate: TWebDateTimePicker
Left = 22 Left = 22
...@@ -228,6 +231,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -228,6 +231,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpArtDue: TWebDateTimePicker object dtpArtDue: TWebDateTimePicker
Left = 24 Left = 24
...@@ -241,6 +245,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -241,6 +245,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpPlateDue: TWebDateTimePicker object dtpPlateDue: TWebDateTimePicker
Left = 24 Left = 24
...@@ -254,6 +259,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -254,6 +259,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object edtShipVia: TWebDBEdit object edtShipVia: TWebDBEdit
Left = 24 Left = 24
...@@ -514,6 +520,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -514,6 +520,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpPDFDate3: TWebDateTimePicker object dtpPDFDate3: TWebDateTimePicker
Left = 444 Left = 444
...@@ -527,6 +534,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -527,6 +534,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpPDFDate2: TWebDateTimePicker object dtpPDFDate2: TWebDateTimePicker
Left = 444 Left = 444
...@@ -540,6 +548,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -540,6 +548,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object cbInkJet: TWebDBCheckBox object cbInkJet: TWebDBCheckBox
Left = 444 Left = 444
...@@ -592,6 +601,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -592,6 +601,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpInkJetDate3: TWebDateTimePicker object dtpInkJetDate3: TWebDateTimePicker
Left = 444 Left = 444
...@@ -605,6 +615,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -605,6 +615,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpInkJetDate2: TWebDateTimePicker object dtpInkJetDate2: TWebDateTimePicker
Left = 444 Left = 444
...@@ -618,6 +629,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -618,6 +629,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object edtColorContrastTo: TWebDBEdit object edtColorContrastTo: TWebDBEdit
Left = 444 Left = 444
...@@ -644,6 +656,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -644,6 +656,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpColorContractDate2: TWebDateTimePicker object dtpColorContractDate2: TWebDateTimePicker
Left = 444 Left = 444
...@@ -657,6 +670,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -657,6 +670,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object edtDigitalColorTo: TWebDBEdit object edtDigitalColorTo: TWebDBEdit
Left = 444 Left = 444
...@@ -696,6 +710,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -696,6 +710,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object edtAniloxInfo: TWebDBEdit object edtAniloxInfo: TWebDBEdit
Left = 634 Left = 634
...@@ -1073,31 +1088,32 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1073,31 +1088,32 @@ object FOrderEntryWeb: TFOrderEntryWeb
DataField = 'general_comments' DataField = 'general_comments'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object btnConfirm: TWebButton object btnSave: TWebButton
Left = 649 Left = 649
Top = 568 Top = 568
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Confirm' Caption = 'Save'
ChildOrder = 79 ChildOrder = 79
ElementID = 'btnconfirm' ElementID = 'btnconfirm'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick OnClick = btnSaveClick
end end
object btnEdit: TWebButton object btnPDF: TWebButton
Left = 867 Left = 963
Top = 568 Top = 568
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Edit' Caption = 'PDF'
ChildOrder = 79 ChildOrder = 79
ElementID = 'btnedit' ElementID = 'btnpdf'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnPDFClick
end end
object btnCancel: TWebButton object btnCancel: TWebButton
Left = 761 Left = 853
Top = 568 Top = 568
Width = 96 Width = 96
Height = 25 Height = 25
...@@ -1106,6 +1122,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1106,6 +1122,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
ElementID = 'btncancel' ElementID = 'btncancel'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end end
object wcbQBItem: TWebDBComboBox object wcbQBItem: TWebDBComboBox
Left = 26 Left = 26
...@@ -1184,6 +1201,101 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1184,6 +1201,101 @@ object FOrderEntryWeb: TFOrderEntryWeb
DataField = 'print_orientation_print_orient' DataField = 'print_orientation_print_orient'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object btnCopy: TWebButton
Left = 751
Top = 568
Width = 96
Height = 25
Caption = 'Copy'
ChildOrder = 91
ElementID = 'btncopy'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCopyClick
end
object btnDelete: TWebButton
Left = 1065
Top = 568
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 79
ElementID = 'btndelete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnDeleteClick
end
object btnClose: TWebButton
Left = 1063
Top = 523
Width = 96
Height = 25
Caption = 'Close'
ChildOrder = 80
ElementID = 'btnclose'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseClick
end
object edtOrderNum: TWebEdit
Left = 126
Top = 194
Width = 121
Height = 22
ChildOrder = 81
ElementID = 'edtordernum'
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btn_confirm_delete: TWebButton
Left = 1094
Top = 414
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 82
ElementID = 'btn_confirm_delete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btn_confirm_deleteClick
end
object btnEdit: TWebButton
Left = 1165
Top = 560
Width = 96
Height = 25
Caption = 'Edit'
ChildOrder = 83
ElementID = 'btnedit'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnEditClick
end
object btnAdd: TWebButton
Left = 1165
Top = 520
Width = 96
Height = 25
Caption = 'Add'
ChildOrder = 84
ElementID = 'btnadd'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnAddClick
end
object WebButton2: TWebButton
Left = 174
Top = 372
Width = 96
Height = 25
Caption = 'Add Address'
ChildOrder = 85
ElementID = 'btnaddaddress'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = WebButton2Click
end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 160 Left = 160
...@@ -1196,6 +1308,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1196,6 +1308,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 8 Top = 8
end end
object XDataWebDataSet1: TXDataWebDataSet object XDataWebDataSet1: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 90 Left = 90
Top = 20 Top = 20
...@@ -1465,6 +1578,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1465,6 +1578,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 436 Top = 436
end end
object xdwdsShipTo: TXDataWebDataSet object xdwdsShipTo: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Left = 208 Left = 208
Top = 398 Top = 398
object xdwdsShipToADDRESS: TStringField object xdwdsShipToADDRESS: TStringField
...@@ -1477,10 +1591,17 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1477,10 +1591,17 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 518 Top = 518
end end
object xdwdsQBItem: TXDataWebDataSet object xdwdsQBItem: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Left = 200 Left = 200
Top = 512 Top = 512
object xdwdsQBItemname: TStringField object xdwdsQBItemname: TStringField
FieldName = 'name' FieldName = 'name'
end end
end end
object tmrReturn: TWebTimer
Enabled = False
OnTimer = tmrReturnTimer
Left = 306
Top = 62
end
end end
...@@ -98,7 +98,7 @@ object FViewOrders: TFViewOrders ...@@ -98,7 +98,7 @@ object FViewOrders: TFViewOrders
BorderColor = clSilver BorderColor = clSilver
ChildOrder = 11 ChildOrder = 11
ElementFont = efCSS ElementFont = efCSS
ElementHeaderClassName = 'thead-light sticky-top bg-light' ElementHeaderClassName = 'thead-light sticky-top bg-light border-light'
ElementPosition = epRelative ElementPosition = epRelative
ElementTableClassName = 'table table-striped table-hover table-bordered text-sm' ElementTableClassName = 'table table-striped table-hover table-bordered text-sm'
Footer.ButtonActiveElementClassName = 'btn btn-primary' Footer.ButtonActiveElementClassName = 'btn btn-primary'
...@@ -124,12 +124,16 @@ object FViewOrders: TFViewOrders ...@@ -124,12 +124,16 @@ object FViewOrders: TFViewOrders
OnDblClickCell = wdbtcOrdersDblClickCell OnDblClickCell = wdbtcOrdersDblClickCell
Columns = < Columns = <
item item
DataField = 'DBID'
Title = 'Order Num'
end
item
DataField = 'ID' DataField = 'ID'
Title = 'ID' Title = 'Customer ID'
end end
item item
DataField = 'companyName' DataField = 'companyName'
Title = 'Company Name' Title = 'Customer Name'
end end
item item
DataField = 'jobName' DataField = 'jobName'
...@@ -188,8 +192,10 @@ object FViewOrders: TFViewOrders ...@@ -188,8 +192,10 @@ object FViewOrders: TFViewOrders
Title = 'Price' Title = 'Price'
end end
item item
ElementClassName = 'text-nowrap'
DataField = 'qbRefNum' DataField = 'qbRefNum'
Title = 'QB Ref Num' Title = 'QB Ref Num'
TitleElementClassName = 'min-w-80'
end end
item item
DataField = 'colors' DataField = 'colors'
...@@ -231,7 +237,9 @@ object FViewOrders: TFViewOrders ...@@ -231,7 +237,9 @@ object FViewOrders: TFViewOrders
ItemIndex = -1 ItemIndex = -1
LookupValues = < LookupValues = <
item item
Value = 'o.ORDER_ID DESC' Value =
'COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_dat' +
'e, cdo.staff_fields_order_date) DESC'
DisplayText = 'ID' DisplayText = 'ID'
end end
item item
...@@ -340,6 +348,9 @@ object FViewOrders: TFViewOrders ...@@ -340,6 +348,9 @@ object FViewOrders: TFViewOrders
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 70 Left = 70
Top = 410 Top = 410
object xdwdsOrdersDBID: TStringField
FieldName = 'DBID'
end
object xdwdsOrdersID: TStringField object xdwdsOrdersID: TStringField
FieldName = 'ID' FieldName = 'ID'
end end
...@@ -432,4 +443,10 @@ object FViewOrders: TFViewOrders ...@@ -432,4 +443,10 @@ object FViewOrders: TFViewOrders
Left = 346 Left = 346
Top = 412 Top = 412
end end
object tmrReturn: TWebTimer
Enabled = False
OnTimer = tmrReturnTimer
Left = 294
Top = 362
end
end end
<div class="container h-100 d-flex flex-column mt-0" style="max-width: 100%; padding-bottom: 0;"> <div class="container h-100 d-flex flex-column mt-0 py-0" style="max-width: 100%;">
<!-- Alert Section --> <!-- Alert Section -->
<div class="row"> <div class="row">
<div class=col-sm> <div class=col-sm>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</div> </div>
<!-- Actions Row --> <!-- Actions Row -->
<div class="row mt-3 justify-content-center"> <div class="row mt-2 justify-content-center">
<div class="col-auto d-flex align-items-center"> <div class="col-auto d-flex align-items-center">
<label class="mt-3" style="font-weight: 700;">Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries</label> <label class="mt-3" style="font-weight: 700;">Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries</label>
</div> </div>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<!-- Table Section --> <!-- Table Section -->
<div id="order_table_section" class="overflow-auto mt-2" <div id="order_table_section" class="overflow-auto mt-2"
style="max-height: calc(100vh - 250px); padding-bottom: 0; width: 100%;"> style="max-height: calc(100vh - 250px); padding-bottom: 0; width: 100%;">
<table id="tblPhoneGrid" class="table table-striped table-bordered" style="width: 100%;"> <table id="tblPhoneGrid" class="table table-striped table-bordered border-light" style="width: 100%;">
<thead class="sticky-top thead-light"> <thead class="sticky-top thead-light">
<tr style="font-size: 0.875rem;"> <tr style="font-size: 0.875rem;">
<!-- Table headers are dynamically generated --> <!-- Table headers are dynamically generated -->
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</div> </div>
<!-- Pagination Section --> <!-- Pagination Section -->
<div class="d-flex justify-content-center w-100 mt-4"> <div class="d-flex justify-content-center w-100 mt-2">
<nav aria-label="Page navigation"> <nav aria-label="Page navigation">
<ul id="pagination" class="pagination"> <ul id="pagination" class="pagination">
<!-- Pagination items added dynamically --> <!-- Pagination items added dynamically -->
...@@ -71,3 +71,6 @@ ...@@ -71,3 +71,6 @@
</div> </div>
</div> </div>
...@@ -132,9 +132,9 @@ object FSearch: TFSearch ...@@ -132,9 +132,9 @@ object FSearch: TFSearch
object WebLabel1: TWebLabel object WebLabel1: TWebLabel
Left = 20 Left = 20
Top = 8 Top = 8
Width = 48 Width = 63
Height = 14 Height = 14
Caption = 'Order ID:' Caption = 'Order Num:'
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
...@@ -149,7 +149,7 @@ object FSearch: TFSearch ...@@ -149,7 +149,7 @@ object FSearch: TFSearch
Top = 56 Top = 56
Width = 107 Width = 107
Height = 14 Height = 14
Caption = 'Search Companies:' Caption = 'Search Customers:'
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
...@@ -162,9 +162,9 @@ object FSearch: TFSearch ...@@ -162,9 +162,9 @@ object FSearch: TFSearch
object lblCompanyID: TWebLabel object lblCompanyID: TWebLabel
Left = 174 Left = 174
Top = 56 Top = 56
Width = 68 Width = 72
Height = 14 Height = 14
Caption = 'Company ID:' Caption = 'Customer ID:'
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
...@@ -207,9 +207,9 @@ object FSearch: TFSearch ...@@ -207,9 +207,9 @@ object FSearch: TFSearch
object WebLabel5: TWebLabel object WebLabel5: TWebLabel
Left = 338 Left = 338
Top = 56 Top = 56
Width = 89 Width = 93
Height = 14 Height = 14
Caption = 'Company Name:' Caption = 'Customer Name:'
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
...@@ -219,49 +219,6 @@ object FSearch: TFSearch ...@@ -219,49 +219,6 @@ object FSearch: TFSearch
ParentFont = False ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object pnlMessage: TWebPanel
Left = 92
Top = 637
Width = 121
Height = 33
ElementClassName = 'card'
ElementID = 'pnl_message'
ChildOrder = 5
ElementBodyClassName = 'card-body'
ElementFont = efCSS
ElementPosition = epRelative
Role = 'alert'
TabOrder = 0
object lblMessage: TWebLabel
Left = 26
Top = 11
Width = 44
Height = 14
Caption = 'Message'
ElementID = 'pnl_message'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementClassName = 'btn btn-light'
ElementID = 'view.login.message.button'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
end
end
object wcbFilterType1: TWebComboBox object wcbFilterType1: TWebComboBox
Left = 8 Left = 8
Top = 462 Top = 462
...@@ -294,7 +251,7 @@ object FSearch: TFSearch ...@@ -294,7 +251,7 @@ object FSearch: TFSearch
Top = 579 Top = 579
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Confirm' Caption = 'Search'
ChildOrder = 7 ChildOrder = 7
ElementClassName = 'btn btn-secondary' ElementClassName = 'btn btn-secondary'
ElementFont = efCSS ElementFont = efCSS
...@@ -393,6 +350,7 @@ object FSearch: TFSearch ...@@ -393,6 +350,7 @@ object FSearch: TFSearch
Items.Strings = ( Items.Strings = (
'Corrugated' 'Corrugated'
'Web' 'Web'
'Cutting die'
'Any') 'Any')
end end
object wcbFilterType2: TWebComboBox object wcbFilterType2: TWebComboBox
...@@ -472,7 +430,7 @@ object FSearch: TFSearch ...@@ -472,7 +430,7 @@ object FSearch: TFSearch
Height = 233 Height = 233
ParentDoubleBuffered = False ParentDoubleBuffered = False
DoubleBuffered = True DoubleBuffered = True
TabOrder = 12 TabOrder = 11
DefaultRowHeight = 40.000000000000000000 DefaultRowHeight = 40.000000000000000000
FixedColumns = 0 FixedColumns = 0
ColumnCount = 4 ColumnCount = 4
...@@ -499,7 +457,7 @@ object FSearch: TFSearch ...@@ -499,7 +457,7 @@ object FSearch: TFSearch
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 40.000000000000000000 Width = 80.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -544,7 +502,7 @@ object FSearch: TFSearch ...@@ -544,7 +502,7 @@ object FSearch: TFSearch
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 320.000000000000000000 Width = 280.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -653,6 +611,7 @@ object FSearch: TFSearch ...@@ -653,6 +611,7 @@ object FSearch: TFSearch
ChildOrder = 8 ChildOrder = 8
ElementClassName = 'form-control' ElementClassName = 'form-control'
ElementFont = efCSS ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -8 Font.Height = -8
...@@ -721,7 +680,7 @@ object FSearch: TFSearch ...@@ -721,7 +680,7 @@ object FSearch: TFSearch
object edtCompanyName: TWebEdit object edtCompanyName: TWebEdit
Left = 338 Left = 338
Top = 76 Top = 76
Width = 239 Width = 377
Height = 22 Height = 22
HelpType = htKeyword HelpType = htKeyword
TabStop = False TabStop = False
...@@ -749,18 +708,18 @@ object FSearch: TFSearch ...@@ -749,18 +708,18 @@ object FSearch: TFSearch
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 418 Left = 418
Top = 393 Top = 393
object xdwdsCustomersID: TIntegerField object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'ID' FieldName = 'SHORT_NAME'
end end
object xdwdsCustomersNAME: TStringField object xdwdsCustomersNAME: TStringField
FieldName = 'NAME' FieldName = 'NAME'
end end
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object xdwdsCustomersstaff_fields_invoice_to: TStringField object xdwdsCustomersstaff_fields_invoice_to: TStringField
FieldName = 'staff_fields_invoice_to' FieldName = 'staff_fields_invoice_to'
end end
object xdwdsCustomersCUSTOMER_ID: TIntegerField
FieldName = 'CUSTOMER_ID'
end
end end
object wdsCustomers: TWebDataSource object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers DataSet = xdwdsCustomers
......
...@@ -17,9 +17,6 @@ uses ...@@ -17,9 +17,6 @@ uses
type type
TFSearch = class(TWebForm) TFSearch = class(TWebForm)
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
wcbFilterType1: TWebComboBox; wcbFilterType1: TWebComboBox;
btnConfirm: TWebButton; btnConfirm: TWebButton;
edtOrderID: TWebEdit; edtOrderID: TWebEdit;
...@@ -47,9 +44,7 @@ type ...@@ -47,9 +44,7 @@ type
lblCompanyID: TWebLabel; lblCompanyID: TWebLabel;
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet; xdwdsCustomers: TXDataWebDataSet;
xdwdsCustomersID: TIntegerField;
xdwdsCustomersNAME: TStringField; xdwdsCustomersNAME: TStringField;
xdwdsCustomersSHORT_NAME: TStringField;
wdsCustomers: TWebDataSource; wdsCustomers: TWebDataSource;
WebLabel3: TWebLabel; WebLabel3: TWebLabel;
edtJobName: TWebEdit; edtJobName: TWebEdit;
...@@ -59,6 +54,8 @@ type ...@@ -59,6 +54,8 @@ type
xdwdsCustomersstaff_fields_invoice_to: TStringField; xdwdsCustomersstaff_fields_invoice_to: TStringField;
WebLabel5: TWebLabel; WebLabel5: TWebLabel;
edtCompanyName: TWebEdit; edtCompanyName: TWebEdit;
xdwdsCustomersSHORT_NAME: TStringField;
xdwdsCustomersCUSTOMER_ID: TIntegerField;
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
procedure WebFormShow(Sender: TObject); procedure WebFormShow(Sender: TObject);
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
...@@ -72,13 +69,12 @@ type ...@@ -72,13 +69,12 @@ type
[async] procedure getCustomers; [async] procedure getCustomers;
procedure PopulateGridManually; procedure PopulateGridManually;
procedure ApplyFilter; procedure ApplyFilter;
var
temp: string;
public public
class function CreateForm(AElementID: string): TWebForm; class function CreateForm(AElementID: string): TWebForm;
var var
confirm: boolean; confirm: boolean;
searchOptions: string; searchOptions: string;
DBID: string;
end; end;
var var
...@@ -120,7 +116,6 @@ begin ...@@ -120,7 +116,6 @@ begin
DateFormatSettings := TFormatSettings.Create; DateFormatSettings := TFormatSettings.Create;
DateFormatSettings.ShortDateFormat := 'yyyy/mm/dd'; DateFormatSettings.ShortDateFormat := 'yyyy/mm/dd';
wcbOrderType.Text := UpperCase(Copy(params.Values['orderType'], 1, 1)) + LowerCase(Copy(params.Values['orderType'], 2, MaxInt)); wcbOrderType.Text := UpperCase(Copy(params.Values['orderType'], 1, 1)) + LowerCase(Copy(params.Values['orderType'], 2, MaxInt));
edtOrderID.Text := params.Values['orderID']; edtOrderID.Text := params.Values['orderID'];
edtCompanyID.Text := params.Values['companyID']; edtCompanyID.Text := params.Values['companyID'];
...@@ -131,7 +126,6 @@ begin ...@@ -131,7 +126,6 @@ begin
wcbFilterType1.Text := params.Values['filterType1'] wcbFilterType1.Text := params.Values['filterType1']
else else
wcbFilterType1.Text := 'NONE'; wcbFilterType1.Text := 'NONE';
console.log(params.Values['startDate1']);
if params.Values['startDate1'] = '' then if params.Values['startDate1'] = '' then
dtpStartDate1.Date := 0 dtpStartDate1.Date := 0
...@@ -161,7 +155,6 @@ begin ...@@ -161,7 +155,6 @@ begin
else else
wcbFilterType2.Text := 'NONE'; wcbFilterType2.Text := 'NONE';
console.log(params.Values['startDate2']);
if params.Values['startDate2'] = '' then if params.Values['startDate2'] = '' then
dtpStartDate2.Date := 0 dtpStartDate2.Date := 0
else else
...@@ -174,7 +167,7 @@ begin ...@@ -174,7 +167,7 @@ begin
if params.values['null2'] <> '' then if params.values['null2'] <> '' then
begin begin
cbNull1.Checked := StrToBool(params.Values['null2']); cbNull2.Checked := StrToBool(params.Values['null2']);
if StrToBool(params.Values['null2']) then if StrToBool(params.Values['null2']) then
begin begin
dtpStartDate2.Visible := false; dtpStartDate2.Visible := false;
...@@ -207,6 +200,10 @@ begin ...@@ -207,6 +200,10 @@ begin
dtpStartDate2.Date := 0; dtpStartDate2.Date := 0;
dtpEndDate2.Date := 0; dtpEndDate2.Date := 0;
cbNull2.Checked := false; cbNull2.Checked := false;
dtpStartDate1.Visible := true;
dtpStartDate2.Visible := true;
dtpEndDate1.Visible := true;
dtpEndDate2.Visible := true;
end; end;
procedure TFSearch.btnConfirmClick(Sender: TObject); procedure TFSearch.btnConfirmClick(Sender: TObject);
...@@ -264,8 +261,10 @@ end; ...@@ -264,8 +261,10 @@ end;
procedure TFSearch.TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer); procedure TFSearch.TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
begin begin
edtCompanyID.Text := TMSFNCGrid1.Cells[0, ARow]; edtCompanyID.Text := TMSFNCGrid1.Cells[1, ARow];
edtCompanyName.Text := TMSFNCGrid1.Cells[2, ARow]; edtCompanyName.Text := TMSFNCGrid1.Cells[2, ARow];
DBID := TMSFNCGrid1.Cells[0, ARow];
end; end;
procedure TFSearch.PopulateGridManually; procedure TFSearch.PopulateGridManually;
...@@ -279,15 +278,11 @@ begin ...@@ -279,15 +278,11 @@ begin
// Set up column headers // Set up column headers
TMSFNCGrid1.ColumnCount := 4; TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1; TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'ID'; TMSFNCGrid1.Cells[0, 0] := 'Customer Num';
TMSFNCGrid1.Cells[1, 0] := 'Short Name'; TMSFNCGrid1.Cells[1, 0] := 'Customer ID';
TMSFNCGrid1.Cells[2, 0] := 'Name'; TMSFNCGrid1.Cells[2, 0] := 'Customer Name';
TMSFNCGrid1.Cells[3, 0] := 'Address'; TMSFNCGrid1.Cells[3, 0] := 'Address';
// TMSFNCGrid1.ColumnWidths[0] := 40;
// TMSFNCGrid1.ColumnWidths[1] := 80;
// TMSFNCGrid1.ColumnWidths[2] := 250;
// Populate the grid with data from the dataset // Populate the grid with data from the dataset
xdwdsCustomers.First; xdwdsCustomers.First;
RowIndex := 1; RowIndex := 1;
...@@ -295,8 +290,7 @@ begin ...@@ -295,8 +290,7 @@ begin
while not xdwdsCustomers.EOF do while not xdwdsCustomers.EOF do
begin begin
TMSFNCGrid1.RowCount := RowIndex + 1; TMSFNCGrid1.RowCount := RowIndex + 1;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('CUSTOMER_ID').AsString;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('ID').AsString;
TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('SHORT_NAME').AsString; TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('SHORT_NAME').AsString;
TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('NAME').AsString; TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('NAME').AsString;
TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('staff_fields_invoice_to').AsString; TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('staff_fields_invoice_to').AsString;
......
object FAddOrder: TFAddOrder object FSelectCustomer: TFSelectCustomer
Width = 894 Width = 765
Height = 633 Height = 480
Align = alClient OnCreate = WebFormCreate
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
OnShow = WebFormShow OnShow = WebFormShow
object cbWebPlate: TWebCheckBox object WebLabel1: TWebLabel
Left = 172 Left = 8
Top = 55 Top = 81
Width = 113 Width = 95
Height = 22 Height = 15
Caption = 'Web Plate' Caption = 'Search Customers'
ChildOrder = 5
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = cbWebPlateClick
end end
object cbCorrugatedPlate: TWebCheckBox object WebLabel2: TWebLabel
Left = 40 Left = 279
Top = 55 Top = 81
Width = 113 Width = 134
Height = 22 Height = 15
Caption = 'Corrugated Plate' Caption = 'Selected Customer Name'
Checked = True
ChildOrder = 5
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
State = cbChecked
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = cbCorrugatedPlateClick
end end
object edtSearch: TWebEdit object WebLabel3: TWebLabel
Left = 306 Left = 131
Top = 55 Top = 81
Width = 146 Width = 113
Height = 22 Height = 15
ChildOrder = 8 Caption = 'Selected Customer ID'
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end end
object edtID: TWebEdit object edtSearch: TWebEdit
Left = 475 Left = 4
Top = 55 Top = 102
Width = 121 Width = 121
Height = 22 Height = 22
ChildOrder = 8 ChildOrder = 2
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object btnConfirm: TWebButton object edtName: TWebEdit
Left = 612 Left = 279
Top = 52 Top = 102
Width = 96 Width = 142
Height = 25 Height = 22
Caption = 'Confirm' ChildOrder = 1
ChildOrder = 9 Enabled = False
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object btnCancel: TWebButton
Left = 730
Top = 52
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 9
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end end
object TMSFNCGrid1: TTMSFNCGrid object TMSFNCGrid1: TTMSFNCGrid
Left = 0 Left = 0
Top = 220 Top = 163
Width = 894 Width = 765
Height = 413 Height = 317
Align = alBottom Align = alBottom
ParentDoubleBuffered = False ParentDoubleBuffered = False
DoubleBuffered = True DoubleBuffered = True
TabOrder = 6 TabOrder = 2
DefaultRowHeight = 40.000000000000000000 DefaultRowHeight = 40.000000000000000000
FixedColumns = 0 FixedColumns = 0
ColumnCount = 3 ColumnCount = 4
Options.Bands.Enabled = True Options.Bands.Enabled = True
Options.ColumnSize.Stretch = True Options.ColumnSize.Stretch = True
Options.Editing.CalcFormat = '%g' Options.Editing.CalcFormat = '%g'
...@@ -121,7 +84,37 @@ object FAddOrder: TFAddOrder ...@@ -121,7 +84,37 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 327.000000000000000000 Width = 90.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 150.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 200.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -136,7 +129,7 @@ object FAddOrder: TFAddOrder ...@@ -136,7 +129,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 327.000000000000000000 Width = 306.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -151,7 +144,7 @@ object FAddOrder: TFAddOrder ...@@ -151,7 +144,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 239.000000000000000000 Width = 90.000000000000000000
end> end>
DefaultFont.Charset = DEFAULT_CHARSET DefaultFont.Charset = DEFAULT_CHARSET
DefaultFont.Color = clWindowText DefaultFont.Color = clWindowText
...@@ -211,30 +204,115 @@ object FAddOrder: TFAddOrder ...@@ -211,30 +204,115 @@ object FAddOrder: TFAddOrder
LeftCol = 0 LeftCol = 0
ScrollMode = scmItemScrolling ScrollMode = scmItemScrolling
DesignTimeSampleData = True DesignTimeSampleData = True
ExplicitWidth = 982 OnCellClick = TMSFNCGrid1CellClick
end
object btnCancel: TWebButton
Left = 556
Top = 101
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnConfirm: TWebButton
Left = 440
Top = 101
Width = 96
Height = 25
Caption = 'Select'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object edtNotification: TWebEdit
Left = 4
Top = 16
Width = 510
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clRed
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtID: TWebEdit
Left = 131
Top = 102
Width = 142
Height = 22
ChildOrder = 1
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 370 Left = 630
Top = 562 Top = 47
end end
object xdwdsCustomers: TXDataWebDataSet object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 206 Left = 166
Top = 564 Top = 129
object xdwdsCustomersID: TIntegerField object xdwdsCustomersBillAddr: TStringField
FieldName = 'ID' FieldName = 'BillAddr'
end
object xdwdsCustomersCompanyName: TStringField
FieldName = 'CompanyName'
end
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 end
object xdwdsCustomersNAME: TStringField object xdwdsCustomersBillAddrZip: TStringField
FieldName = 'NAME' FieldName = 'BillAddrZip'
end end
object xdwdsCustomersSHORT_NAME: TStringField object xdwdsCustomersInKGOrders: TBooleanField
FieldName = 'SHORT_NAME' FieldName = 'In KGOrders'
end end
end end
object wdsCustomers: TWebDataSource object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers DataSet = xdwdsCustomers
Left = 38 Left = 104
Top = 562 Top = 135
end end
end end
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>TMS Web Project</title>
<style>
</style>
</head>
<body>
</body>
</html>
\ No newline at end of file
unit View.SelectCustomer;
interface
uses
System.SysUtils, System.Generics.Collections, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, VCL.TMSFNCTypes, VCL.TMSFNCUtils,
VCL.TMSFNCGraphics, VCL.TMSFNCGraphicsTypes, VCL.TMSFNCGridCell,
VCL.TMSFNCGridOptions, VCL.TMSFNCCustomControl, VCL.TMSFNCCustomScrollControl,
VCL.TMSFNCGridData, VCL.TMSFNCCustomGrid, VCL.TMSFNCGrid;
type
TFSelectCustomer = class(TWebForm)
WebLabel1: TWebLabel;
WebLabel2: TWebLabel;
edtSearch: TWebEdit;
edtName: TWebEdit;
TMSFNCGrid1: TTMSFNCGrid;
btnCancel: TWebButton;
btnConfirm: TWebButton;
edtNotification: TWebEdit;
XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet;
wdsCustomers: TWebDataSource;
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;
procedure WebFormCreate(Sender: TObject);
procedure WebFormShow(Sender: TObject);
procedure TMSFNCGrid1CellDblClick(Sender: TObject; ACol, ARow: Integer);
procedure btnConfirmClick(Sender: TObject);
procedure TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
private
{ Private declarations }
[Async] procedure GetCustomers();
[Async] procedure SendCustomerToServer();
procedure PopulateGridManually();
public
{ Public declarations }
end;
var
FSelectCustomer: TFSelectCustomer;
implementation
{$R *.dfm}
uses View.Main, Utils;
procedure TFSelectCustomer.WebFormCreate(Sender: TObject);
begin
if not DMConnection.ApiConnection.Connected then
begin
DMConnection.ApiConnection.OpenAsync;
console.log('report requirements connection open')
end;
end;
procedure TFSelectCustomer.WebFormShow(Sender: TObject);
begin
Utils.ShowSpinner('spinner');
getCustomers();
end;
procedure TFSelectCustomer.btnConfirmClick(Sender: TObject);
begin
if edtID.Text = '' then
edtNotification.Text := 'Please Select a Customer'
else
begin
xdwdsCustomers.Locate('Id', edtID.Text, []);
SendCustomerToServer();
end;
end;
[async] procedure TFSelectCustomer.getCustomers();
// retrieves customer list from server
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
i: integer;
begin
// Fetch data from XData service
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.getQBCustomers', []));
customerList := TJSObject(xdcResponse.Result);
// Load data into TXDataWebDataset
xdwdsCustomers.Close;
xdwdsCustomers.SetJsonData(customerList);
xdwdsCustomers.Open;
// Manually populate the grid
PopulateGridManually;
Utils.HideSpinner('spinner');
end;
procedure TFSelectCustomer.PopulateGridManually;
// populates the grid with customers manually.
var
RowIndex: Integer;
begin
TMSFNCGrid1.BeginUpdate;
try
TMSFNCGrid1.Clear; // Clear any existing data
// Set up column headers
TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'Quickbooks ID';
TMSFNCGrid1.Cells[1, 0] := 'Customer Name';
TMSFNCGrid1.Cells[2, 0] := 'Address';
TMSFNCGrid1.Cells[3, 0] := 'In KGOrders';
// Populate the grid with data from the dataset
xdwdsCustomers.First;
RowIndex := 1;
while not xdwdsCustomers.EOF do
begin
TMSFNCGrid1.RowCount := RowIndex + 1;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('Id').AsString;
TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('CompanyName').AsString;
TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('BillAddr').AsString;
TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('In KGOrders').AsString;
Inc(RowIndex);
xdwdsCustomers.Next;
end;
finally
TMSFNCGrid1.EndUpdate;
end;
end;
procedure TFSelectCustomer.TMSFNCGrid1CellClick(Sender: TObject; ACol,
ARow: Integer);
begin
edtID.Text := TMSFNCGrid1.Cells[0, ARow];
edtName.Text := TMSFNCGrid1.Cells[1, ARow];
end;
procedure TFSelectCustomer.TMSFNCGrid1CellDblClick(Sender: TObject; ACol,
ARow: Integer);
begin
edtID.Text := TMSFNCGrid1.Cells[2, ARow];
xdwdsCustomers.Locate('Id', TMSFNCGrid1.Cells[0, 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);
Utils.HideSpinner('spinner');
FViewMain.ViewAddCustomer(string(notification['CustomerID']), string(notification['status']));
Close();
end;
end.
\ No newline at end of file
...@@ -92,9 +92,9 @@ object FSetStatus: TFSetStatus ...@@ -92,9 +92,9 @@ object FSetStatus: TFSetStatus
ParentFont = False ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel6: TWebLabel object lblMount: TWebLabel
Left = 326 Left = 324
Top = 140 Top = 200
Width = 62 Width = 62
Height = 14 Height = 14
Caption = 'Mount Due:' Caption = 'Mount Due:'
...@@ -107,9 +107,9 @@ object FSetStatus: TFSetStatus ...@@ -107,9 +107,9 @@ object FSetStatus: TFSetStatus
ParentFont = False ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel7: TWebLabel object lblMountNew: TWebLabel
Left = 484 Left = 482
Top = 140 Top = 200
Width = 78 Width = 78
Height = 14 Height = 14
Caption = 'New Due Date:' Caption = 'New Due Date:'
...@@ -122,7 +122,7 @@ object FSetStatus: TFSetStatus ...@@ -122,7 +122,7 @@ object FSetStatus: TFSetStatus
ParentFont = False ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel8: TWebLabel object lblPlate: TWebLabel
Left = 11 Left = 11
Top = 200 Top = 200
Width = 54 Width = 54
...@@ -137,7 +137,7 @@ object FSetStatus: TFSetStatus ...@@ -137,7 +137,7 @@ object FSetStatus: TFSetStatus
ParentFont = False ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel9: TWebLabel object lblPlateNew: TWebLabel
Left = 169 Left = 169
Top = 200 Top = 200
Width = 78 Width = 78
...@@ -152,9 +152,9 @@ object FSetStatus: TFSetStatus ...@@ -152,9 +152,9 @@ object FSetStatus: TFSetStatus
ParentFont = False ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel10: TWebLabel object lblArt: TWebLabel
Left = 324 Left = 324
Top = 200 Top = 142
Width = 44 Width = 44
Height = 14 Height = 14
Caption = 'Art Due:' Caption = 'Art Due:'
...@@ -167,9 +167,9 @@ object FSetStatus: TFSetStatus ...@@ -167,9 +167,9 @@ object FSetStatus: TFSetStatus
ParentFont = False ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel11: TWebLabel object lblArtNew: TWebLabel
Left = 482 Left = 482
Top = 200 Top = 142
Width = 78 Width = 78
Height = 14 Height = 14
Caption = 'New Due Date:' Caption = 'New Due Date:'
...@@ -191,27 +191,7 @@ object FSetStatus: TFSetStatus ...@@ -191,27 +191,7 @@ object FSetStatus: TFSetStatus
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
LookupValues = < LookupValues = <>
item
Value = 'PROOF'
DisplayText = 'Proof Done'
end
item
Value = 'ART'
DisplayText = 'Art Done'
end
item
Value = 'PLATE'
DisplayText = 'Plate Done'
end
item
Value = 'MOUNT'
DisplayText = 'Mount Done'
end
item
Value = 'SHIP'
DisplayText = 'Ship Done'
end>
end end
object dtpDate: TWebDateTimePicker object dtpDate: TWebDateTimePicker
Left = 484 Left = 484
...@@ -226,8 +206,8 @@ object FSetStatus: TFSetStatus ...@@ -226,8 +206,8 @@ object FSetStatus: TFSetStatus
Text = '' Text = ''
end end
object btnConfirm: TWebButton object btnConfirm: TWebButton
Left = 11 Left = 14
Top = 271 Top = 273
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Confirm' Caption = 'Confirm'
...@@ -242,8 +222,8 @@ object FSetStatus: TFSetStatus ...@@ -242,8 +222,8 @@ object FSetStatus: TFSetStatus
OnClick = btnConfirmClick OnClick = btnConfirmClick
end end
object btnCancel: TWebButton object btnCancel: TWebButton
Left = 133 Left = 125
Top = 271 Top = 273
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Cancel' Caption = 'Cancel'
...@@ -349,8 +329,8 @@ object FSetStatus: TFSetStatus ...@@ -349,8 +329,8 @@ object FSetStatus: TFSetStatus
Text = '' Text = ''
end end
object dtpMountDue: TWebDateTimePicker object dtpMountDue: TWebDateTimePicker
Left = 326 Left = 324
Top = 160 Top = 220
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -362,8 +342,8 @@ object FSetStatus: TFSetStatus ...@@ -362,8 +342,8 @@ object FSetStatus: TFSetStatus
Text = '' Text = ''
end end
object dtpNewMountDue: TWebDateTimePicker object dtpNewMountDue: TWebDateTimePicker
Left = 484 Left = 482
Top = 160 Top = 220
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -400,7 +380,7 @@ object FSetStatus: TFSetStatus ...@@ -400,7 +380,7 @@ object FSetStatus: TFSetStatus
end end
object dtpArtDue: TWebDateTimePicker object dtpArtDue: TWebDateTimePicker
Left = 324 Left = 324
Top = 220 Top = 162
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -413,7 +393,7 @@ object FSetStatus: TFSetStatus ...@@ -413,7 +393,7 @@ object FSetStatus: TFSetStatus
end end
object dtpNewArtDue: TWebDateTimePicker object dtpNewArtDue: TWebDateTimePicker
Left = 482 Left = 482
Top = 220 Top = 162
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
......
...@@ -24,17 +24,17 @@ type ...@@ -24,17 +24,17 @@ type
dtpShipDue: TWebDateTimePicker; dtpShipDue: TWebDateTimePicker;
WebLabel5: TWebLabel; WebLabel5: TWebLabel;
dtpNewShipDue: TWebDateTimePicker; dtpNewShipDue: TWebDateTimePicker;
WebLabel6: TWebLabel; lblMount: TWebLabel;
dtpMountDue: TWebDateTimePicker; dtpMountDue: TWebDateTimePicker;
WebLabel7: TWebLabel; lblMountNew: TWebLabel;
dtpNewMountDue: TWebDateTimePicker; dtpNewMountDue: TWebDateTimePicker;
WebLabel8: TWebLabel; lblPlate: TWebLabel;
dtpPlateDue: TWebDateTimePicker; dtpPlateDue: TWebDateTimePicker;
WebLabel9: TWebLabel; lblPlateNew: TWebLabel;
dtpNewPlateDue: TWebDateTimePicker; dtpNewPlateDue: TWebDateTimePicker;
WebLabel10: TWebLabel; lblArt: TWebLabel;
dtpArtDue: TWebDateTimePicker; dtpArtDue: TWebDateTimePicker;
WebLabel11: TWebLabel; lblArtNew: TWebLabel;
dtpNewArtDue: TWebDateTimePicker; dtpNewArtDue: TWebDateTimePicker;
procedure WebFormShow(Sender: TObject); procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
...@@ -46,7 +46,7 @@ type ...@@ -46,7 +46,7 @@ type
public public
{ Public declarations } { Public declarations }
confirm: boolean; confirm: boolean;
OrderID, JobName: string; OrderID, JobName, OrderType: string;
ShipDue, MountDue, PlateDue, ArtDue: TDateTime; ShipDue, MountDue, PlateDue, ArtDue: TDateTime;
end; end;
...@@ -66,6 +66,10 @@ procedure TFSetStatus.btnConfirmClick(Sender: TObject); ...@@ -66,6 +66,10 @@ procedure TFSetStatus.btnConfirmClick(Sender: TObject);
begin begin
if ( (dtpDate.Date = 0 ) or ( wlcbStatus.value = '' ) ) then if ( (dtpDate.Date = 0 ) or ( wlcbStatus.value = '' ) ) then
ShowNotification('Failure:Please fill in all information') ShowNotification('Failure:Please fill in all information')
else if ( ( OrderType = 'web plate' ) and ( wlcbStatus.Value = 'MOUNT' ) ) then
ShowNotification('Failure:Web Plate Orders do not have Mount Due/Done dates')
else if ( ( OrderType = 'cutting die' ) and ( wlcbStatus.Value = 'MOUNT' ) or ( wlcbStatus.Value = 'ART' ) or (wlcbStatus.Value = 'PLATE') ) then
ShowNotification('Failure:Cutting Die Orders do not have Art/Plate/Mount Due or Done Dates')
else else
begin begin
confirm := true; confirm := true;
...@@ -74,6 +78,10 @@ begin ...@@ -74,6 +78,10 @@ begin
end; end;
procedure TFSetStatus.WebFormShow(Sender: TObject); procedure TFSetStatus.WebFormShow(Sender: TObject);
var
ItemsToRemove: TStringList;
i: integer;
filteredItems: TJSArray;
begin begin
HideNotification(); HideNotification();
edtOrderID.Text := OrderID; edtOrderID.Text := OrderID;
...@@ -87,6 +95,46 @@ begin ...@@ -87,6 +95,46 @@ begin
dtpNewMountDue.Date := 0; dtpNewMountDue.Date := 0;
dtpNewPlateDue.Date := 0; dtpNewPlateDue.Date := 0;
dtpNewArtDue.Date := 0; dtpNewArtDue.Date := 0;
ItemsToRemove := TStringList.Create;
if orderType = 'web plate' then
begin
dtpNewMountDue.Visible := false;
dtpMountDue.Visible := false;
lblMount.Visible := false;
lblMountNew.Visible := false;
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('Art', 'Art Done');
wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end
else if orderType = 'cutting die' then
begin
dtpNewMountDue.Visible := false;
dtpMountDue.Visible := false;
lblMount.Visible := false;
lblMountNew.Visible := false;
dtpPlateDue.Visible := false;
dtpNewPlateDue.Visible := false;
lblPlate.Visible := false;
lblPlateNew.Visible := false;
dtpArtDue.Visible := false;
dtpNewArtDue.Visible := false;
lblArt.Visible := false;
lblArtNew.Visible := false;
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end
else
begin
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('Art', 'Art Done');
wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done');
wlcbStatus.LookupValues.AddPair('MOUNT', 'Mount Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end;
end; end;
procedure TFSetStatus.HideNotification; procedure TFSetStatus.HideNotification;
......
...@@ -6,7 +6,7 @@ uses ...@@ -6,7 +6,7 @@ uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls, System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls,
XData.Web.Client, WEBLib.ExtCtrls, DB, XData.Web.JsonDataset, XData.Web.Client, WEBLib.ExtCtrls, DB, XData.Web.JsonDataset,
XData.Web.Dataset, XData.Web.Connection, Vcl.Forms; XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, ConnectionModule;
type type
TFViewUserProfile = class(TWebForm) TFViewUserProfile = class(TWebForm)
...@@ -47,8 +47,7 @@ implementation ...@@ -47,8 +47,7 @@ implementation
uses uses
Auth.Service, Auth.Service,
XData.Model.Classes, XData.Model.Classes;
ConnectionModule;
{$R *.dfm} {$R *.dfm}
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
<th scope="col">Email Address</th> <th scope="col">Email Address</th>
<th scope="col">Access Type</th> <th scope="col">Access Type</th>
<th scope="col">System Rights</th> <th scope="col">System Rights</th>
<th scope="col">Perspective ID</th>
<th scope="col">QB ID</th> <th scope="col">QB ID</th>
<th scope="col">Edit</th> <th scope="col">Edit</th>
</tr> </tr>
......
...@@ -433,12 +433,6 @@ begin ...@@ -433,12 +433,6 @@ begin
Cell.innerText := IntToStr(Rights); Cell.innerText := IntToStr(Rights);
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Perspective ID Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Perspective ID');
Cell.innerText := PID;
NewRow.appendChild(Cell);
// QB ID Cell // QB ID Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'QB ID'); Cell.setAttribute('data-label', 'QB ID');
......
{ {
"AuthUrl" : "http://localhost:2004/emsys/kgOrders/auth/", "AuthUrl" : "http://localhost:2004/kgOrders/auth/",
"ApiUrl" : "http://localhost:2004/emsys/kgOrders/api/" "ApiUrl" : "http://localhost:2004/kgOrders/api/"
} }
...@@ -14,6 +14,14 @@ input[type="text"] { ...@@ -14,6 +14,14 @@ input[type="text"] {
padding-left: 5px; padding-left: 5px;
} }
is-invalid .form-check-input {
border: 1px solid #dc3545 !important;
}
.is-invalid .form-check-label {
color: #dc3545 !important;
}
.input-search input { .input-search input {
width: 100px; /* Adjust the width of the input */ width: 100px; /* Adjust the width of the input */
height: 35px; /* Set the height to match label height */ height: 35px; /* Set the height to match label height */
...@@ -157,6 +165,7 @@ input[type="text"] { ...@@ -157,6 +165,7 @@ input[type="text"] {
.table tbody tr:hover { .table tbody tr:hover {
background-color: #d1e7fd; /* Light blue color for hover effect */ background-color: #d1e7fd; /* Light blue color for hover effect */
cursor: pointer; cursor: pointer;
margin-top: 5px;
} }
.form-input{ .form-input{
...@@ -171,6 +180,19 @@ input[type="text"] { ...@@ -171,6 +180,19 @@ input[type="text"] {
transition: background-color 0.3s ease; transition: background-color 0.3s ease;
} }
.table thead th{
border: 2px;
background-color: #e6e6e6;
}
.table thead {
border-color: #e6e6e6;
}
.min-w-80 {
min-width: 80px;
}
.table { .table {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 5px; border-radius: 5px;
...@@ -333,6 +355,18 @@ input[type="text"] { ...@@ -333,6 +355,18 @@ input[type="text"] {
box-sizing: border-box !important; /* Prevent borders from affecting dimensions */ box-sizing: border-box !important; /* Prevent borders from affecting dimensions */
} }
#tblPhoneGrid {
--bs-table-bg: #fff;
--bs-table-border-color: #dee2e6; /* or whatever border tone you like */
}
/* and make sure the table collapses borders so there are no gaps */
#tblPhoneGrid {
border-collapse: collapse !important;
}
......
.lds-roller {
display: inline-block;
position: relative;
width: 80px;
height: 80px;
}
.lds-roller div {
animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
transform-origin: 40px 40px;
}
.lds-roller div:after {
content: " ";
display: block;
position: absolute;
width: 10px;
height: 10px;
border-radius: 50%;
background: #204d74;
margin: -5px 0 0 -5px;
}
.lds-roller div:nth-child(1) {
animation-delay: -0.036s;
}
.lds-roller div:nth-child(1):after {
top: 63px;
left: 63px;
}
.lds-roller div:nth-child(2) {
animation-delay: -0.072s;
}
.lds-roller div:nth-child(2):after {
top: 68px;
left: 56px;
}
.lds-roller div:nth-child(3) {
animation-delay: -0.108s;
}
.lds-roller div:nth-child(3):after {
top: 71px;
left: 48px;
}
.lds-roller div:nth-child(4) {
animation-delay: -0.144s;
}
.lds-roller div:nth-child(4):after {
top: 72px;
left: 40px;
}
.lds-roller div:nth-child(5) {
animation-delay: -0.18s;
}
.lds-roller div:nth-child(5):after {
top: 71px;
left: 32px;
}
.lds-roller div:nth-child(6) {
animation-delay: -0.216s;
}
.lds-roller div:nth-child(6):after {
top: 68px;
left: 24px;
}
.lds-roller div:nth-child(7) {
animation-delay: -0.252s;
}
.lds-roller div:nth-child(7):after {
top: 63px;
left: 17px;
}
.lds-roller div:nth-child(8) {
animation-delay: -0.288s;
}
.lds-roller div:nth-child(8):after {
top: 56px;
left: 12px;
}
@keyframes lds-roller {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
<html><head> <html><head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta content="width=device-width, initial-scale=1" name="viewport"/>
<noscript>Your browser does not support JavaScript!</noscript> <noscript>Your browser does not support JavaScript!</noscript>
<link rel="icon" href="data:;base64,="> <link href="data:;base64,=" rel="icon"/>
<title>Web KG Orders</title> <title>Web KG Orders</title>
<link href="css/app.css" rel="stylesheet" type="text/css"> <link href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.3.1/css/flag-icon.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.3.1/css/flag-icon.min.css" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet"> <link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" type="text/javascript"></script> <script crossorigin="anonymous" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script> <script src="$(ProjectName).js" type="text/javascript"></script>
<script type="text/javascript" src="$(ProjectName).js"></script> <title>EM Systems webKGOrders App</title>
<script> <link href="css/app.css" rel="stylesheet" type="text/css"/>
function startSpinner() { <link href="css/spinner.css" rel="stylesheet" type="text/css">
//window.scrollTo(0, 0); <script src="$(ProjectName).js" type="text/javascript"></script>
document.body.style.setProperty('--spinner-top', window.scrollY+'px'); <body>
$(".hide-scene").addClass("scene"); </body>
} <script type="text/javascript">rtl.run();</script>
</html>
function endSpinner() {
$(".hide-scene").removeClass("scene");
}
</script>
<title>EM Systems webKGOrders App</title>
<script type="text/javascript" src="$(ProjectName).js"></script>
<style>
/*-----svg loader styles-------*/
:root {
--spinner-top: 0px; }
.hide-scene {
display:none;
}
.scene {
position: absolute;
z-index: 9999999;
top: var(--spinner-top);
width: 100%;
height: 100%;
perspective: 600;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
align-items: center;
justify-content: center;
}
.scene svg {
width: 165px;
height: 165px;
/* background-color: lavender; */
}
@keyframes arrow-spin {
50% {
transform: rotateY(360deg);
}
}
/*-------------------------------------------*/
</style>
</head>
<body>
</body>
<script type="text/javascript">
rtl.run();
</script>
<div class="hide-scene">
<svg
version="1.1"
id="dc-spinner"
xmlns="http://www.w3.org/2000/svg"
x="0px" y="0px"
width:"38"
height:"38"
viewBox="0 0 38 38"
preserveAspectRatio="xMinYMin meet">
<circle cx="20" cy="20" r="16" fill="#D3D3D3"></circle>
<text x="55%" y="54%" font-family="Monaco" font-size="2px" text-anchor="middle" dy=".3em" style="letter-spacing:0.6">PROCESSING
<animate
attributeName="opacity"
values="0;1;0" dur="1.8s"
repeatCount="indefinite"/>
</text>
<path fill="#373a42" d="M20,35c-8.271,0-15-6.729-15-15S11.729,5,20,5s15,6.729,15,15S28.271,35,20,35z M20,5.203
C11.841,5.203,5.203,11.841,5.203,20c0,8.159,6.638,14.797,14.797,14.797S34.797,28.159,34.797,20
C34.797,11.841,28.159,5.203,20,5.203z">
</path>
<path fill="#373a42" d="M20,33.125c-7.237,0-13.125-5.888-13.125-13.125S12.763,6.875,20,6.875S33.125,12.763,33.125,20
S27.237,33.125,20,33.125z M20,7.078C12.875,7.078,7.078,12.875,7.078,20c0,7.125,5.797,12.922,12.922,12.922
S32.922,27.125,32.922,20C32.922,12.875,27.125,7.078,20,7.078z">
</path>
<path fill="#2AA198" stroke="#2AA198" stroke-width="0.6027" stroke-miterlimit="10" d="M5.203,20
c0-8.159,6.638-14.797,14.797-14.797V5C11.729,5,5,11.729,5,20s6.729,15,15,15v-0.203C11.841,34.797,5.203,28.159,5.203,20z">
<animateTransform
attributeName="transform"
type="rotate"
from="0 20 20"
to="360 20 20"
calcMode="spline"
keySplines="0.4, 0, 0.2, 1"
keyTimes="0;1"
dur="2s"
repeatCount="indefinite" />
</path>
<path fill="#859900" stroke="#859900" stroke-width="0.2027" stroke-miterlimit="10" d="M7.078,20
c0-7.125,5.797-12.922,12.922-12.922V6.875C12.763,6.875,6.875,12.763,6.875,20S12.763,33.125,20,33.125v-0.203
C12.875,32.922,7.078,27.125,7.078,20z">
<animateTransform
attributeName="transform"
type="rotate"
from="0 20 20"
to="360 20 20"
dur="1.8s"
repeatCount="indefinite" />
</path>
</svg>
</div>
</html>
program webKGOrders; program webKGOrders;
uses uses
Vcl.Forms, Vcl.Forms,
XData.Web.Connection, XData.Web.Connection,
WEBLib.Dialogs,
Auth.Service in 'Auth.Service.pas', Auth.Service in 'Auth.Service.pas',
App.Types in 'App.Types.pas', App.Types in 'App.Types.pas',
ConnectionModule in 'ConnectionModule.pas' {DMConnection: TWebDataModule}, ConnectionModule in 'ConnectionModule.pas' {DMConnection: TWebDataModule},
...@@ -22,7 +24,12 @@ uses ...@@ -22,7 +24,12 @@ uses
View.Search in 'View.Search.pas' {FSearch: TWebForm} {*.html}, View.Search in 'View.Search.pas' {FSearch: TWebForm} {*.html},
View.SetStatus in 'View.SetStatus.pas' {FSetStatus: TWebForm} {*.html}, View.SetStatus in 'View.SetStatus.pas' {FSetStatus: TWebForm} {*.html},
View.OrderEntryCuttingDie in 'View.OrderEntryCuttingDie.pas' {FOrderEntryCuttingDie: TWebForm} {*.html}, View.OrderEntryCuttingDie in 'View.OrderEntryCuttingDie.pas' {FOrderEntryCuttingDie: TWebForm} {*.html},
View.OrderEntryWeb in 'View.OrderEntryWeb.pas' {FOrderEntryWeb: TWebForm} {*.html}; View.OrderEntryWeb in 'View.OrderEntryWeb.pas' {FOrderEntryWeb: TWebForm} {*.html},
View.Customers in 'View.Customers.pas' {FViewCustomers: TWebForm} {*.html},
AddCustomer in 'AddCustomer.pas' {FViewAddCustomer: TWebForm} {*.html},
View.AddAddress in 'View.AddAddress.pas' {FViewAddAddress: TWebForm} {*.html},
View.SelectCustomer in 'View.SelectCustomer.pas' {FSelectCustomer: TWebForm} {*.html},
Utils in 'Utils.pas';
{$R *.res} {$R *.res}
...@@ -44,6 +51,7 @@ begin ...@@ -44,6 +51,7 @@ begin
ConnectProc; ConnectProc;
end; end;
procedure DisplayLoginView(AMessage: string); procedure DisplayLoginView(AMessage: string);
begin begin
AuthService.Logout; AuthService.Logout;
...@@ -53,23 +61,64 @@ begin ...@@ -53,23 +61,64 @@ begin
TFViewLogin.Display(@DisplayMainView, AMessage); TFViewLogin.Display(@DisplayMainView, AMessage);
end; end;
procedure UnauthorizedAccessProc(AMessage: string); procedure UnauthorizedAccessProc(AMessage: string);
begin begin
DisplayLoginView(AMessage); DisplayLoginView(AMessage);
end; end;
procedure StartApplication; procedure StartApplication;
begin begin
if (not AuthService.Authenticated) or AuthService.TokenExpired then DMConnection.InitApp(
DisplayLoginView procedure
else begin
DisplayMainView; DMConnection.SetClientConfig(
procedure(Success: Boolean; ErrorMessage: string)
begin
if Success then
begin
if (not AuthService.Authenticated) or AuthService.TokenExpired then
DisplayLoginView
else
DisplayMainView;
end
else
begin
asm
var dlg = document.createElement("dialog");
dlg.classList.add("shadow", "rounded", "border", "p-4");
dlg.style.maxWidth = "500px";
dlg.style.width = "90%";
dlg.style.fontFamily = "system-ui, sans-serif";
dlg.innerHTML =
"<h5 class='fw-bold mb-3 text-danger'>kgOrders web app</h5>" +
"<p class='mb-3' style='white-space: pre-wrap;'>" + ErrorMessage + "</p>" +
"<div class='text-end'>" +
"<button id='refreshBtn' class='btn btn-primary'>Reload</button></div>";
document.body.appendChild(dlg);
dlg.showModal();
document.getElementById("refreshBtn").addEventListener("click", function () {
location.reload(true); // Hard refresh
});
end;
end;
end);
end,
@UnauthorizedAccessProc
);
end; end;
begin begin
Application.Initialize; Application.Initialize;
Application.MainFormOnTaskbar := True; Application.MainFormOnTaskbar := True;
Application.CreateForm(TDMConnection, DMConnection); Application.CreateForm(TDMConnection, DMConnection);
DMConnection.InitApp(@StartApplication, @UnauthorizedAccessProc); StartApplication;
Application.Run; Application.Run;
end. end.
unit QBService;
interface
uses
XData.Service.Common,
Aurelius.Mapping.Attributes,
System.JSON,
System.Generics.Collections,
System.Classes;
type
[ServiceContract]
IQBService = interface(IInvokable)
['{D119A273-0644-484B-B75E-B6FE57BB422C}']
[HttpGet] function getCustomers(): TJSONArray;
end;
implementation
initialization
RegisterServiceType(TypeInfo(IQBService));
end.
unit QBServiceImplementation;
interface
uses
XData.Server.Module,
XData.Service.Common,
Api.Database, Data.DB, frxClass, frxExportPDF, JS, System.Hash, System.JSON,
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, MemDS, DBAccess, Uni,
hyiedefs, hyieutils, iexBitmaps, iesettings, iexLayers, iexRulers,
iexToolbars, iexUserInteractions, imageenio, imageenproc, QuickRpt, QRCtrls,
dbimageen, Vcl.ExtCtrls, ieview, imageenview, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdFTP,
iexProcEffects, frCoreClasses, Common.Logging,
DateUtils, QBService, WEBLib.REST, WEBLib.WebTools,System.Net.HttpClient,
System.Net.URLClient, System.Net.HttpClientComponent, System.netencoding,
IdHTTP, IdSSLOpenSSL, IdSSLOpenSSLHeaders, System.IniFiles, REST.Client, REST.Types;
type
[ServiceImplementation]
TQBService = class(TInterfacedObject, IQBService)
private
procedure SaveTokens(AccessToken, RefreshToken: string);
function getCustomers(): TJSONArray;
function refreshAccessToken(): string;
var
AccessToken,RefreshToken,CompanyID,Client,Secret: string;
LastRefresh: TDateTime;
end;
implementation
function TQBService.getCustomers: TJSONArray;
var
restClient: TRESTClient;
restRequest: TRESTRequest;
restResponse: TRESTResponse;
param: TRESTRequestParameter;
res: string;
jsValue: TJSONValue;
Customer: TJSONValue;
jsObj: TJSONObject;
CustomerList: TJSONArray;
pair: TJSONPair;
begin
restClient := TRESTClient.Create(nil);
restClient.BaseURL := 'https://sandbox-quickbooks.api.intuit.com';
restRequest := TRESTRequest.Create(nil);
restRequest.Client := restClient;
restResponse := TRESTResponse.Create(nil);
restRequest.Response := restResponse;
if MinutesBetween(Now, LastRefresh) > 58 then
begin
RefreshAccessToken();
end;
restRequest.Method := rmGET;
//GET /v3/company/<realmId>/customer/<customerId>
res := '/v3/company/' + companyid + '/customer/58';
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;
jsValue := restResponse.JSONValue;
jsObj := TJSONObject(jsValue);
CustomerList := TJSONArray( TJSONObject( jsObj.GetValue('QueryResponse') ).GetValue('Customer')) ;
result := CustomerList;
// LoadJSONArray( CustomerList );
restClient.Free;
restRequest.Free;
restResponse.Free;
end;
function TQBService.RefreshAccessToken: string;
// Refresh Token changes so make sure to save refresh token.
var
IdHTTP: TIdHTTP;
SSLIO: TIdSSLIOHandlerSocketOpenSSL;
RequestStream: TStringStream;
EncodedAuth, EncodedAuth2, PostData, response: string;
f: TStringList;
fi: string;
JSObj: TJSONObject;
iniFile: TIniFile;
Encoder: TBase64Encoding;
begin
// 1. Encode credentials (same as working Postman request)
// TNetEncoding.Base64.Encode adds a new line every 72 chars, this stops that
Encoder := TBase64Encoding.Create(0);
if( (Client = '') or (Secret = '') ) then
begin
Logger.Log(1, 'Missing Client ID or Client Secret in INI File');
Exit();
end;
EncodedAuth := Encoder.Encode(Client + ':' + Secret);
if RefreshToken = '' then
begin
Logger.Log(3, 'Missing Refresh Token, Please Manually Get a New One and Store in INI File');
Exit();
end;
// 2. Prepare POST data (EXACTLY as in Postman)
PostData := 'grant_type=refresh_token&refresh_token=' + RefreshToken;
// 3. Configure HTTP client
IdHTTP := TIdHTTP.Create(nil);
SSLIO := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
try
// Force TLS 1.2
SSLIO.SSLOptions.Method := sslvTLSv1_2;
SSLIO.SSLOptions.SSLVersions := [sslvTLSv1_2];
IdHTTP.IOHandler := SSLIO;
// Set headers (EXACT match with Postman)
IdHTTP.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP.Request.Accept := 'application/json';
IdHTTP.Request.CustomHeaders.AddValue('Authorization', 'Basic ' + EncodedAuth);
// 4. Create and send request
RequestStream := TStringStream.Create(PostData, TEncoding.UTF8);
try
// Execute POST
try
response := IdHTTP.Post('https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer', RequestStream);
JSObj := TJSONObject.ParseJSONValue(response) as TJSONObject;
RefreshToken := JSObj.GetValue('refresh_token').ToString.Trim(['"']);
AccessToken := JSObj.GetValue('access_token').ToString.Trim(['"']);
SaveTokens(AccessToken, RefreshToken);
Result := AccessToken;
Logger.Log(1, 'qbAPI - Tokens Successfully Saved');
except
on E: EIdHTTPProtocolException do
// Memo2.Lines.Add('Error: ' + E.Message + #13#10 + 'Response: ' + E.ErrorMessage);
end;
finally
RequestStream.Free;
end;
finally
SSLIO.Free;
IdHTTP.Free;
end;
end;
procedure TQBService.SaveTokens(AccessToken, RefreshToken: string);
var
f: TStringList;
iniStr, line: string;
iniFile: TIniFile;
begin
iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
try
iniFile.WriteString('Quickbooks', 'RefreshToken', RefreshToken);
LastRefresh := Now;
Logger.Log(1, 'Tokens Successfully Saved');
finally
IniFile.Free;
end;
f := TStringList.Create;
// Save to file (overwrites existing file)
f.SaveToFile('QB.txt');
f.Free;
end;
initialization
RegisterServiceType(TQBService);
end.
...@@ -4,12 +4,9 @@ object ApiDatabase: TApiDatabase ...@@ -4,12 +4,9 @@ object ApiDatabase: TApiDatabase
Width = 519 Width = 519
object ucKG: TUniConnection object ucKG: TUniConnection
ProviderName = 'MySQL' ProviderName = 'MySQL'
Database = 'kg_order_entry'
Username = 'root'
LoginPrompt = False LoginPrompt = False
Left = 75 Left = 75
Top = 65 Top = 65
EncryptedPassword = '9AFF92FF8CFF86FF8CFFCFFFCEFF'
end end
object UniQuery1: TUniQuery object UniQuery1: TUniQuery
Connection = ucKG Connection = ucKG
...@@ -33,8 +30,8 @@ object ApiDatabase: TApiDatabase ...@@ -33,8 +30,8 @@ object ApiDatabase: TApiDatabase
Connection = ucKG Connection = ucKG
SQL.Strings = ( SQL.Strings = (
'select * from corrugated_plate_orders') 'select * from corrugated_plate_orders')
Left = 263 Left = 257
Top = 156 Top = 148
object uqOrdersORDER_ID: TIntegerField object uqOrdersORDER_ID: TIntegerField
FieldName = 'ORDER_ID' FieldName = 'ORDER_ID'
end end
......
...@@ -18,12 +18,9 @@ object AuthDatabase: TAuthDatabase ...@@ -18,12 +18,9 @@ object AuthDatabase: TAuthDatabase
end end
object ucKG: TUniConnection object ucKG: TUniConnection
ProviderName = 'MySQL' ProviderName = 'MySQL'
Database = 'kg_order_entry'
Username = 'root'
LoginPrompt = False LoginPrompt = False
Left = 67 Left = 67
Top = 131 Top = 131
EncryptedPassword = '9AFF92FF8CFF86FF8CFFCFFFCEFF'
end end
object MySQLUniProvider1: TMySQLUniProvider object MySQLUniProvider1: TMySQLUniProvider
Left = 230 Left = 230
......
...@@ -7,7 +7,8 @@ interface ...@@ -7,7 +7,8 @@ interface
uses uses
XData.Service.Common, XData.Service.Common,
Aurelius.Mapping.Attributes, Aurelius.Mapping.Attributes,
System.Generics.Collections; System.Generics.Collections,
System.JSON;
const const
AUTH_MODEL = 'Auth'; AUTH_MODEL = 'Auth';
...@@ -18,7 +19,7 @@ type ...@@ -18,7 +19,7 @@ type
IAuthService = interface(IInvokable) IAuthService = interface(IInvokable)
['{9CFD59B2-A832-4F82-82BB-9A25FC93F305}'] ['{9CFD59B2-A832-4F82-82BB-9A25FC93F305}']
function Login(const user, password: string): string; function Login(const user, password: string): string;
function VerifyVersion(version: string): string; function VerifyVersion(ClientVersion: string): TJSONObject;
end; end;
implementation implementation
......
...@@ -10,7 +10,7 @@ uses ...@@ -10,7 +10,7 @@ uses
XData.Server.Module, XData.Server.Module,
Auth.Service, Auth.Service,
Auth.Database, Auth.Database,
Uni, Data.DB, System.Hash; Uni, Data.DB, System.Hash, System.IniFiles, System.JSON;
type type
[ServiceImplementation] [ServiceImplementation]
...@@ -33,7 +33,7 @@ type ...@@ -33,7 +33,7 @@ type
function CheckUser(const user, password: string): Integer; function CheckUser(const user, password: string): Integer;
public public
function Login(const user, password: string): string; function Login(const user, password: string): string;
function VerifyVersion(version: string): string; function VerifyVersion(ClientVersion: string): TJSONObject;
end; end;
implementation implementation
...@@ -69,17 +69,36 @@ begin ...@@ -69,17 +69,36 @@ begin
Result := authDB.uq; Result := authDB.uq;
end; end;
function TAuthService.VerifyVersion(version: string): string; function TAuthService.VerifyVersion(ClientVersion: string): TJSONObject;
var
iniFile: TIniFile;
webClientVersion: string;
begin begin
if( version <> '1.0.0' ) then Result := TJSONObject.Create;
begin TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
Logger.Log( 2, 'TLoginService.GetAgenciesConfigList - Error: wrong ver!' );
result := 'Error - You have the wrong version! Please clear your cache and refresh!'; iniFile := TIniFile.Create(ChangeFileExt(ParamStr(0), '.ini'));
Exit; try
webClientVersion := iniFile.ReadString('Settings', 'webClientVersion', '');
Result.AddPair('webClientVersion', webClientVersion);
if webClientVersion = '' then
begin
Result.AddPair('error', 'webClientVersion is not configured.');
Exit;
end;
if clientVersion <> webClientVersion then
begin
Result.AddPair('error',
'Your browser is running an old version of the app.' + sLineBreak +
'Please click below to reload.');
end;
finally
iniFile.Free;
end; end;
result := '';
end; end;
function TAuthService.Login(const user, password: string): string; function TAuthService.Login(const user, password: string): string;
// Login verification: currently checks if logins are the same or if the user // Login verification: currently checks if logins are the same or if the user
// is admin, checks for admin password. Eventually will do a database lookup // is admin, checks for admin password. Eventually will do a database lookup
......
// The configuartion file for the program. Contains important info like the admin
// password and the secret token. Should likely move this to the ini file..
unit Common.Config; unit Common.Config;
interface interface
const const
defaultServerUrl = 'http://localhost:2004/emsys/kgOrders/'; defaultServerUrl = 'http://localhost:2004/kgOrders/';
type type
TServerConfig = class TServerConfig = class
private private
Furl: string; Furl: string;
FJWTTokenSecret: string; FjwtTokenSecret: string;
FAdminPassword: string; FadminPassword: string;
FWebAppFolder: string; FwebAppFolder: string;
FReportsFolder: string; FreportsFolder: string;
public public
property url: string read Furl write Furl;
property jwtTokenSecret: string read FjwtTokenSecret write FjwtTokenSecret;
property adminPassword: string read FadminPassword write FadminPassword;
property webAppFolder: string read FwebAppFolder write FwebAppFolder;
property reportsFolder: string read FreportsFolder write FreportsFolder;
constructor Create; constructor Create;
property url: string read FUrl write FUrl;
property jwtTokenSecret: string read FJWTTokenSecret write FJWTTokenSecret;
property adminPassword: string read FAdminPassword write FAdminPassword;
property webAppFolder: string read FWebAppFolder write FWebAppFolder;
property reportsFolder: string read FReportsFolder write FReportsFolder;
end; end;
procedure LoadServerConfig; procedure LoadServerConfig;
...@@ -33,59 +31,57 @@ var ...@@ -33,59 +31,57 @@ var
implementation implementation
uses uses
Bcl.Json, System.SysUtils, System.IOUtils, Bcl.Json, System.SysUtils, System.IOUtils, Common.Logging;
Common.Logging;
procedure LoadServerConfig; procedure LoadServerConfig;
var var
configFile: string; configFile: string;
localConfig: TServerConfig; localConfig: TServerConfig;
begin begin
Logger.Log( 1, '--LoadServerConfig - start' ); Logger.Log(1, '--LoadServerConfig - start');
configFile := TPath.ChangeExtension( ParamStr(0), '.json' ); configFile := TPath.ChangeExtension(ParamStr(0), '.json');
Logger.Log( 1, '-- Config file: ' + ConfigFile ); Logger.Log(1, '-- Config file: ' + ConfigFile);
if TFile.Exists(ConfigFile) then
if TFile.Exists(configFile) then
begin begin
Logger.Log( 1, '-- Config file found.' ); Logger.Log(1, '-- Config file found.');
localConfig := TJson.Deserialize<TServerConfig>(TFile.ReadAllText(configFile)); localConfig := TJson.Deserialize<TServerConfig>(TFile.ReadAllText(configFile));
Logger.Log( 1, '-- localConfig loaded from config file' ); Logger.Log(1, '-- localConfig loaded from config file');
serverConfig.Free; serverConfig.Free;
Logger.Log( 1, '-- serverConfig.Free - called' ); Logger.Log(1, '-- serverConfig.Free - called');
serverConfig := localConfig; serverConfig := localConfig;
Logger.Log( 1, '-- serverConfig := localConfig - called' ); Logger.Log(1, '-- serverConfig := localConfig - called');
end end
else else
begin begin
Logger.Log( 1, '-- Config file not found.' ); Logger.Log(1, '-- Config file not found.');
end; end;
Logger.Log( 1, '-------------------------------------------------------------' );
Logger.Log( 1, '-- serverConfig.Server url: ' + serverConfig.url ); Logger.Log(1, '-------------------------------------------------------------');
Logger.Log( 1, '-- serverConfig.adminPassword: ' + serverConfig.adminPassword ); Logger.Log(1, '-- serverConfig.url: ' + serverConfig.url);
Logger.Log( 1, '-- serverConfig.jwtTokenSecret: ' + serverConfig.jwtTokenSecret ); Logger.Log(1, '-- serverConfig.adminPassword: ' + serverConfig.adminPassword);
Logger.Log( 1, '-- serverConfig.webAppFolder: ' + serverConfig.webAppFolder ); Logger.Log(1, '-- serverConfig.jwtTokenSecret: ' + serverConfig.jwtTokenSecret);
Logger.Log( 1, '-- serverConfig.reportsFolder: ' + serverConfig.reportsFolder ); Logger.Log(1, '-- serverConfig.webAppFolder: ' + serverConfig.webAppFolder);
Logger.Log( 1, '--LoadServerConfig - end' ); Logger.Log(1, '-- serverConfig.reportsFolder: ' + serverConfig.reportsFolder);
Logger.Log(1, '--LoadServerConfig - end');
end; end;
{ TServerConfig } { TServerConfig }
constructor TServerConfig.Create; constructor TServerConfig.Create;
//var var
// ConfigFile: string; ServerConfigStr: string;
// ServerConfigStr: string;
begin begin
Logger.Log( 1, '--TServerConfig.Create - start' ); Logger.Log(1, '--TServerConfig.Create - start');
url := defaultServerUrl; url := defaultServerUrl;
adminPassword := 'whatisthisusedfor'; adminPassword := 'whatisthisusedfor';
jwtTokenSecret := 'super_secret0123super_secret4567'; jwtTokenSecret := 'super_secret0123super_secret4567';
webAppFolder := 'static'; webAppFolder := 'static';
reportsFolder := '..\kgOrdersClient\TMSWeb\Debug\'; reportsFolder := 'static/';
// ServerConfigStr := Bcl.Json.TJson.Serialize( ServerConfig ); ServerConfigStr := Bcl.Json.TJson.Serialize(ServerConfig);
// ConfigFile := 'serverconfig.json'; Logger.Log(1, '--ServerConfigSerialize: ' + ServerConfigStr);
// TFile.WriteAllText( ConfigFile, ServerConfigStr ); Logger.Log(1, '--TServerConfig.Create - end');
// Logger.Log( 1, 'ServerConfig saved to file: ' + ConfigFile );
Logger.Log( 1, '--TServerConfig.Create - end' );
end; end;
end. end.
...@@ -36,10 +36,98 @@ type ...@@ -36,10 +36,98 @@ type
edtEmailAddress: TEdit; edtEmailAddress: TEdit;
btnPDF: TButton; btnPDF: TButton;
Timer1: TTimer; Timer1: TTimer;
Button1: TButton;
uqWeb: TUniQuery;
uqWebORDER_ID: TIntegerField;
uqWebCOMPANY_ID: TIntegerField;
uqWebUSER_ID: TIntegerField;
uqWebORDER_DATE: TDateTimeField;
uqWebSTART_DATE: TDateField;
uqWebEND_DATE: TDateField;
uqWebORDER_STATUS: TStringField;
uqWebSCHED_JSON: TStringField;
uqWebstaff_fields_order_date: TDateField;
uqWebstaff_fields_proof_date: TDateField;
uqWebstaff_fields_ship_date: TDateField;
uqWebstaff_fields_ship_via: TStringField;
uqWebstaff_fields_price: TStringField;
uqWebstaff_fields_invoice_to: TStringField;
uqWebstaff_fields_invoice_attention: TStringField;
uqWebstaff_fields_ship_to: TStringField;
uqWebstaff_fields_ship_attention: TStringField;
uqWebstaff_fields_po_number: TStringField;
uqWebstaff_fields_job_name: TStringField;
uqWebstaff_fields_art_due: TDateField;
uqWebstaff_fields_plate_due: TDateField;
uqWebplates_job_number: TStringField;
uqWebsupplied_by_customer_b_w_or_co: TStringField;
uqWebsupplied_by_customer_plates: TStringField;
uqWebsupplied_by_customer_sample: TStringField;
uqWebsupplied_by_customer_dimension: TStringField;
uqWebsupplied_by_customer_other: TStringField;
uqWebsupplied_by_customer_disk: TStringField;
uqWebsupplied_by_customer_e_mail: TStringField;
uqWebsupplied_by_customer_ftp: TStringField;
uqWebplates_plate_material: TStringField;
uqWebplates_thickness: TStringField;
uqWebsupplied_by_customer_total_inc: TStringField;
uqWebsupplied_by_customer_sheets_us: TStringField;
uqWebsupplied_by_customer_initials: TStringField;
uqWebproofing_pdf: TStringField;
uqWebproofing_pdf_to: TStringField;
uqWebproofing_pdf_date_1: TDateField;
uqWebproofing_pdf_date_2: TDateField;
uqWebproofing_pdf_date_3: TDateField;
uqWebproofing_full_size_ink_jet_for: TStringField;
uqWebproofing_ink_jet_to: TStringField;
uqWebproofing_ink_jet_to_2: TStringField;
uqWebproofing_ink_jet_date_1: TDateField;
uqWebproofing_ink_jet_date_2: TDateField;
uqWebproofing_ink_jet_date_3: TDateField;
uqWebproofing_color_contract: TStringField;
uqWebproofing_color_contrac_to: TStringField;
uqWebproofing_color_contrac_date_1: TDateField;
uqWebproofing_color_contrac_date_2: TDateField;
uqWebproofing_digital_color_key: TStringField;
uqWebproofing_digital_color_to: TStringField;
uqWebproofing_digital_color_date_1: TDateField;
uqWebquantity_and_colors_press_name: TStringField;
uqWebquantity_and_colors_anilox_info: TStringField;
uqWebplate_marks_microdots: TStringField;
uqWebplate_marks_microdots_comments: TStringField;
uqWebplate_marks_crosshairs: TStringField;
uqWebplate_marks_crosshairs_comments: TStringField;
uqWebplate_marks_color_bars: TStringField;
uqWebplate_marks_color_bars_comments: TStringField;
uqWebplate_marks_other: TStringField;
uqWebplate_marks_other_comments: TStringField;
uqWebprint_orientation_print_orient: TStringField;
uqWeblayout_around: TStringField;
uqWeblayout_accross: TStringField;
uqWeblayout_surface_print: TStringField;
uqWeblayout_reverse_print: TStringField;
uqWeblayout_cylinder_repeat: TStringField;
uqWeblayout_cutoff_dimension: TStringField;
uqWeblayout_pitch: TStringField;
uqWeblayout_teeth: TStringField;
uqWeblayout_bleed: TStringField;
uqWeblayout_cutback: TStringField;
uqWeblayout_minimum_trap_dim: TStringField;
uqWeblayout_maximum_trap_dim: TStringField;
uqWebupc_size: TStringField;
uqWebupc_bar_width_reduction: TStringField;
uqWebquantity_and_colors_qty_colors: TStringField;
uqWebgeneral_comments: TStringField;
uqWebstaff_fields_quickbooks_item: TStringField;
uqWebstaff_fields_quantity: TStringField;
uqWebupc_distortion_percent: TStringField;
uqWebupc_distortion_amount: TStringField;
uqWebstaff_fields_art_location: TStringField;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure btnFindClick(Sender: TObject); procedure btnFindClick(Sender: TObject);
procedure btnPDFClick(Sender: TObject); procedure btnPDFClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject); procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private private
kgDB: TApiDatabase; kgDB: TApiDatabase;
accountSID: string; accountSID: string;
...@@ -55,7 +143,7 @@ implementation ...@@ -55,7 +143,7 @@ implementation
{$R *.dfm} {$R *.dfm}
uses uLibrary, rOrderList; uses uLibrary, rOrderList, rOrderWeb, rOrderCorrugated;
procedure TFData.FormCreate(Sender: TObject); procedure TFData.FormCreate(Sender: TObject);
begin begin
...@@ -80,6 +168,22 @@ begin ...@@ -80,6 +168,22 @@ begin
end; end;
procedure TFData.Button1Click(Sender: TObject);
var
Field: TField;
SQL: string;
begin
for Field in uqWeb.Fields do
begin
SQL := 'SELECT ORDER_ID, ORDER_DATE, ' + Field.FieldName + ', LENGTH( ' + Field.FieldName +
') AS max_length FROM web_plate_orders ORDER BY max_length DESC LIMIT 1';
doQuery(uqUsers, SQL);
memo1.Lines.Add(Field.FieldName + ', ' + uqUsers.FieldByName('ORDER_ID').AsString +
', ' + uqUsers.FieldByName('max_length').AsString + ', ' + uqUsers.FieldByName('ORDER_DATE').AsString);
end;
end;
procedure TFData.btnFindClick(Sender: TObject); procedure TFData.btnFindClick(Sender: TObject);
// Retrieves calls from a specific number from the database. // Retrieves calls from a specific number from the database.
// SQL: SQL statement to retrieve calls from the database // SQL: SQL statement to retrieve calls from the database
...@@ -104,7 +208,7 @@ var ...@@ -104,7 +208,7 @@ var
begin begin
rptOrderList := TrptOrderList.Create(nil); rptOrderList := TrptOrderList.Create(nil);
try try
rptOrderList.PrepareReport(searchOptions); rptOrderList.PrepareReport(searchOptions, '');
dsGrid2.DataSet := rptOrderList.uqOrders; dsGrid2.DataSet := rptOrderList.uqOrders;
finally finally
rptOrderList.Free; rptOrderList.Free;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment