Commit d4ed3814 by Elias Sarraf

Merge remote-tracking branch 'origin/cam'

parents b2f7a7bc 7068c939
...@@ -122,6 +122,7 @@ object FViewAddAddress: TFViewAddAddress ...@@ -122,6 +122,7 @@ object FViewAddAddress: TFViewAddAddress
ChildOrder = 12 ChildOrder = 12
Enabled = False Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object btnSave: TWebButton object btnSave: TWebButton
...@@ -132,6 +133,7 @@ object FViewAddAddress: TFViewAddAddress ...@@ -132,6 +133,7 @@ object FViewAddAddress: TFViewAddAddress
Caption = 'Save' Caption = 'Save'
ChildOrder = 13 ChildOrder = 13
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnSaveClick OnClick = btnSaveClick
end end
...@@ -143,6 +145,7 @@ object FViewAddAddress: TFViewAddAddress ...@@ -143,6 +145,7 @@ object FViewAddAddress: TFViewAddAddress
Caption = 'Cancel' Caption = 'Cancel'
ChildOrder = 13 ChildOrder = 13
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCancelClick OnClick = btnCancelClick
end end
......
// Small Pop-Up page when adding orders if you want to quickly add an address // Small Pop-Up page when adding orders if you want to quickly add an address
unit View.AddAddress; unit View.Address.Add;
interface interface
......
// Add Customer page for KGOrders. Handles Adding and Editting Customers and // Add Customer page for KGOrders. Handles Adding and Editting Customers and
// Their shipping addresses. // Their shipping addresses.
unit AddCustomer; unit View.Customer.Add;
interface interface
...@@ -127,7 +127,7 @@ implementation ...@@ -127,7 +127,7 @@ implementation
{$R *.dfm} {$R *.dfm}
uses View.Main, View.Customers, View.SelectCustomer, Utils; uses View.Main, View.Customers, View.Customer.Select, Utils;
class function TFViewAddCustomer.CreateForm(AElementID, customerInfo, info: string): TWebForm; class function TFViewAddCustomer.CreateForm(AElementID, customerInfo, info: string): TWebForm;
...@@ -223,7 +223,6 @@ procedure TFViewAddCustomer.SendAddressToServer; ...@@ -223,7 +223,6 @@ procedure TFViewAddCustomer.SendAddressToServer;
// Creates an Address JSON and then sends it to the server for the address to be // Creates an Address JSON and then sends it to the server for the address to be
// Added or edited. // Added or edited.
var var
Field: TField;
AddressJSON: TJSONObject; AddressJSON: TJSONObject;
Response: TXDataClientResponse; Response: TXDataClientResponse;
notification: TJSObject; notification: TJSObject;
...@@ -516,8 +515,6 @@ procedure TFViewAddCustomer.GetCustomer; ...@@ -516,8 +515,6 @@ procedure TFViewAddCustomer.GetCustomer;
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
customer, RepUsers : TJSObject; customer, RepUsers : TJSObject;
items: TJSObject;
ship_block: TStringList;
begin begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer', [customerID])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer', [customerID]));
customer := TJSObject(xdcResponse.Result); customer := TJSObject(xdcResponse.Result);
......
unit View.SelectCustomer; unit View.Customer.Select;
interface interface
...@@ -109,7 +109,6 @@ procedure TFSelectCustomer.getCustomers(); ...@@ -109,7 +109,6 @@ procedure TFSelectCustomer.getCustomers();
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
customerList: TJSObject; customerList: TJSObject;
i: integer;
begin begin
try try
Utils.ShowSpinner('spinner'); Utils.ShowSpinner('spinner');
......
...@@ -49,8 +49,6 @@ type ...@@ -49,8 +49,6 @@ type
PageNumber: integer; PageNumber: integer;
PageSize: integer; PageSize: integer;
TotalPages: integer; TotalPages: integer;
info: string;
public public
{ Public declarations } { Public declarations }
end; end;
...@@ -61,7 +59,7 @@ var ...@@ -61,7 +59,7 @@ var
implementation implementation
uses uses
XData.Model.Classes, View.Main, View.SelectCustomer, Utils; XData.Model.Classes, View.Main, View.Customer.Select, Utils;
{$R *.dfm} {$R *.dfm}
...@@ -93,8 +91,6 @@ Procedure TFViewCustomers.WebFormCreate(Sender: TObject); ...@@ -93,8 +91,6 @@ Procedure TFViewCustomers.WebFormCreate(Sender: TObject);
// PageNumber: What page number the user is on IE 1: 1-10, 2: 11-20 etc // PageNumber: What page number the user is on IE 1: 1-10, 2: 11-20 etc
// TotalPages: Total number of pages returned from the search. // TotalPages: Total number of pages returned from the search.
// PageSize: Number of entries per page. // PageSize: Number of entries per page.
var
today: TDateTime;
begin begin
DMConnection.ApiConnection.Connected := True; DMConnection.ApiConnection.Connected := True;
PageNumber := 1; PageNumber := 1;
...@@ -163,7 +159,6 @@ end; ...@@ -163,7 +159,6 @@ end;
procedure TFViewCustomers.HideNotification; procedure TFViewCustomers.HideNotification;
begin begin
pnlMessage.ElementHandle.hidden := True; pnlMessage.ElementHandle.hidden := True;
info := '';
end; end;
......
object FViewHome: TFViewHome object FViewHome: TFViewHome
Width = 640 Width = 640
Height = 480 Height = 480
OnCreate = WebFormCreate
object WebLabel1: TWebLabel object WebLabel1: TWebLabel
Left = 24 Left = 24
Top = 43 Top = 43
...@@ -12,7 +13,7 @@ object FViewHome: TFViewHome ...@@ -12,7 +13,7 @@ object FViewHome: TFViewHome
Transparent = False Transparent = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebMemo1: TWebMemo object mmoNotes: TWebMemo
Left = 24 Left = 24
Top = 62 Top = 62
Width = 471 Width = 471
...@@ -20,10 +21,19 @@ object FViewHome: TFViewHome ...@@ -20,10 +21,19 @@ object FViewHome: TFViewHome
ElementID = 'view.home.notesmemo' ElementID = 'view.home.notesmemo'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Lines.Strings = ( Lines.Strings = (
'KG Orders Alpha Version') 'Change Log:'
'1) Setting a status now autofills due dates.'
'2) Fixed order dates displaying on 3 lines rather than 2.'
'3) Adjusted pdfs so that special instructions would have enough ' +
'space.'
'4) Fixed issue with PDF generation.'
'5) Removed ability to put 0 or a negative number for price and q' +
'uantity on order entry fields.')
ReadOnly = True ReadOnly = True
SelLength = 0 SelLength = 0
SelStart = 25 SelStart = 323
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
end end
...@@ -5,12 +5,12 @@ interface ...@@ -5,12 +5,12 @@ interface
uses uses
System.SysUtils, System.Classes, WEBLib.Graphics, WEBLib.Forms, WEBLib.Dialogs, System.SysUtils, System.Classes, WEBLib.Graphics, WEBLib.Forms, WEBLib.Dialogs,
Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.Controls, WEBLib.Grids, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.Controls, WEBLib.Grids,
XData.Web.Client, WEBLib.ExtCtrls, DB; XData.Web.Client, WEBLib.ExtCtrls, DB, JS;
type type
TFViewHome = class(TWebForm) TFViewHome = class(TWebForm)
WebLabel1: TWebLabel; WebLabel1: TWebLabel;
WebMemo1: TWebMemo; mmoNotes: TWebMemo;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
end; end;
...@@ -20,7 +20,7 @@ var ...@@ -20,7 +20,7 @@ var
implementation implementation
uses uses
JS, XData.Model.Classes, XData.Model.Classes,
ConnectionModule; ConnectionModule;
{$R *.dfm} {$R *.dfm}
...@@ -28,7 +28,7 @@ uses ...@@ -28,7 +28,7 @@ uses
procedure TFViewHome.WebFormCreate(Sender: TObject); procedure TFViewHome.WebFormCreate(Sender: TObject);
begin begin
WebLabel1.Caption := 'Please select a menu option to continue!'; mmoNotes.Lines.Insert(0, 'Welcome to KG Orders Version ' + TDMConnection.clientVersion);
end; end;
end. end.
unit View.AddItem; unit View.Item.Add;
interface interface
......
...@@ -78,7 +78,7 @@ implementation ...@@ -78,7 +78,7 @@ implementation
uses uses
XData.Model.Classes, XData.Model.Classes,
ConnectionModule, Auth.Service, Utils, View.AddItem, View.Main; ConnectionModule, Auth.Service, Utils, View.Item.Add, View.Main;
{$R *.dfm} {$R *.dfm}
......
...@@ -46533,7 +46533,7 @@ object FViewLogin: TFViewLogin ...@@ -46533,7 +46533,7 @@ object FViewLogin: TFViewLogin
Width = 72 Width = 72
Height = 13 Height = 13
Caption = 'lblClientVersion' Caption = 'lblClientVersion'
ElementID = 'lbl_client_version' ElementID = 'view.login.version'
ElementFont = efCSS ElementFont = efCSS
ElementPosition = epRelative ElementPosition = epRelative
HeightStyle = ssAuto HeightStyle = ssAuto
<nav class="navbar navbar-light bg-light login-navbar"> <nav class="navbar navbar-light bg-light login-navbar">
<div class="container-fluid"> <div class="d-flex align-items-center">
<a class="navbar-brand" href="#">Koehler-Gibson Orders</a> <a id="view.login.apptitle" class="navbar-brand ps-2" href="index.html"> Koehler-Gibson Orders</a>
<span id="view.login.version" class="small text-muted ms-2"></span>
</div> </div>
</nav> </nav>
<div class="container mt-5"> <div class="container mt-5">
......
...@@ -5,8 +5,9 @@ interface ...@@ -5,8 +5,9 @@ interface
uses uses
System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Controls, WEBLib.Forms, WEBLib.Dialogs, System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Controls, WEBLib.Forms, WEBLib.Dialogs,
Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.JSON, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.JSON,
JS, XData.Web.Connection, WEBLib.ExtCtrls, XData.Web.Client, WEBLib.ExtCtrls, Vcl.Imaging.pngimage,
App.Types, ConnectionModule, XData.Web.Client, Vcl.Imaging.pngimage; JS, XData.Web.Connection,
App.Types, ConnectionModule;
type type
TFViewLogin = class(TWebForm) TFViewLogin = class(TWebForm)
...@@ -55,7 +56,8 @@ procedure TFViewLogin.btnLoginClick(Sender: TObject); ...@@ -55,7 +56,8 @@ procedure TFViewLogin.btnLoginClick(Sender: TObject);
begin begin
ShowNotification('Login Error: ' + AMsg); ShowNotification('Login Error: ' + AMsg);
end; end;
var
hashPW: string;
begin begin
AuthService.Login( AuthService.Login(
edtUsername.Text, edtPassword.Text, edtUsername.Text, edtPassword.Text,
......
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content shadow-lg"> <div class="modal-content shadow-lg">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="main_notification_modal">Error</h5> <h5 class="modal-title" id="main_notification_modal">Info</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> </div>
<div class="modal-body fs-6 fw-bold" id="main_notification_modal_body"> <div class="modal-body fs-6 fw-bold" id="main_notification_modal_body">
......
...@@ -33,7 +33,6 @@ type ...@@ -33,7 +33,6 @@ type
procedure lblUsersClick(Sender: TObject); procedure lblUsersClick(Sender: TObject);
procedure lblordersClick(Sender: TObject); procedure lblordersClick(Sender: TObject);
procedure lblCustomersClick(Sender: TObject); procedure lblCustomersClick(Sender: TObject);
procedure lblQuickbooksClick(Sender: TObject);
private private
{ Private declarations } { Private declarations }
FUserInfo: string; FUserInfo: string;
...@@ -75,12 +74,12 @@ uses ...@@ -75,12 +74,12 @@ uses
View.Home, View.Home,
View.Items, View.Items,
View.Users, View.Users,
View.EditUser, View.User.Add,
View.Orders, View.Orders,
View.OrderEntryCorrugated, View.OrderEntryCorrugated,
View.OrderEntryCuttingDie, View.OrderEntryCuttingDie,
View.OrderEntryWeb, View.OrderEntryWeb,
View.Customers, AddCustomer; View.Customers, View.Customer.Add;
{$R *.dfm} {$R *.dfm}
...@@ -101,10 +100,9 @@ begin ...@@ -101,10 +100,9 @@ begin
lblCustomers.Enabled := false; lblCustomers.Enabled := false;
end; end;
ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders'; lblAppTitle.Caption := 'Koehler-Gibson Orders';
lblVersion.Caption := 'v' + DMConnection.clientVersion; lblVersion.Caption := 'v' + DMConnection.clientVersion;
ShowForm(TFViewOrders);
setActive('Orders'); setActive('Orders');
end; end;
...@@ -129,7 +127,7 @@ begin ...@@ -129,7 +127,7 @@ begin
begin begin
ShowForm(TFViewHome); ShowForm(TFViewHome);
lblAppTitle.Caption := 'Koehler-Gibson Home'; lblAppTitle.Caption := 'Koehler-Gibson Home';
//setActive('Home'); setActive('Home');
end end
else else
ShowToast('Please Save or Cancel your changes', 'danger'); ShowToast('Please Save or Cancel your changes', 'danger');
...@@ -147,24 +145,13 @@ begin ...@@ -147,24 +145,13 @@ begin
ShowToast('Please Save or Cancel your changes', 'danger'); ShowToast('Please Save or Cancel your changes', 'danger');
end; end;
procedure TFViewMain.lblQuickbooksClick(Sender: TObject);
begin
if ( not ( change ) ) then
begin
//ShowForm(TFViewQuickbooks);
lblAppTitle.Caption := 'Koehler-Gibson QuickBooks';
setActive('QuickBooks');
end
else
ShowToast('Please Save or Cancel your changes', 'danger');
end;
procedure TFViewMain.lblUsersClick(Sender: TObject); procedure TFViewMain.lblUsersClick(Sender: TObject);
begin begin
if ( not ( change ) ) then if ( not ( change ) ) then
begin begin
ShowForm(TFViewUsers); ShowForm(TFViewUsers);
lblAppTitle.Caption := 'Koehler-Gibson Users'; lblAppTitle.Caption := 'Koehler-Gibson Users';
setActive('Users');
end end
else else
ShowToast('Please Save or Cancel your changes', 'danger'); ShowToast('Please Save or Cancel your changes', 'danger');
...@@ -233,6 +220,7 @@ procedure TFViewMain.wllblUserProfileClick(Sender: TObject); ...@@ -233,6 +220,7 @@ procedure TFViewMain.wllblUserProfileClick(Sender: TObject);
begin begin
ShowCrudForm(TFViewUserProfile); ShowCrudForm(TFViewUserProfile);
lblAppTitle.Caption := 'Koehler-Gibson User Profile'; lblAppTitle.Caption := 'Koehler-Gibson User Profile';
setActive('User Profile');
end; end;
//needs to be changed //needs to be changed
......
// Pop-Up menu that appears when Add Order button is clicked on orders page. // Pop-Up menu that appears when Add Order button is clicked on orders page.
// Used to select customer before entering an order. // Used to select customer before entering an order.
unit View.AddOrder; unit View.Order.Add;
interface interface
......
...@@ -669,7 +669,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -669,7 +669,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 480 Top = 480
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Art Approved As Is' Caption = 'Art Approved As Is'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbartapprovedasis' ElementID = 'cbartapprovedasis'
...@@ -677,6 +676,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -677,6 +676,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_art_approved_as_is' DataField = 'proofing_art_approved_as_is'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -688,7 +688,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -688,7 +688,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 430 Top = 430
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'PDF File' Caption = 'PDF File'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbpdffile' ElementID = 'cbpdffile'
...@@ -696,6 +695,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -696,6 +695,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_pdf_file' DataField = 'proofing_pdf_file'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -707,7 +707,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -707,7 +707,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 406 Top = 406
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Wide Format' Caption = 'Wide Format'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbwideformat' ElementID = 'cbwideformat'
...@@ -715,6 +714,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -715,6 +714,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_wide_format' DataField = 'proofing_wide_format'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -726,7 +726,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -726,7 +726,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 382 Top = 382
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Print Card' Caption = 'Print Card'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbprintcard' ElementID = 'cbprintcard'
...@@ -734,6 +733,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -734,6 +733,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_print_card' DataField = 'proofing_print_card'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -745,7 +745,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -745,7 +745,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 356 Top = 356
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Full Size Panel' Caption = 'Full Size Panel'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbfullsizepanel' ElementID = 'cbfullsizepanel'
...@@ -753,6 +752,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -753,6 +752,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_full_size_panel' DataField = 'proofing_full_size_panel'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -799,6 +799,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -799,6 +799,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
DataField = 'staff_fields_ship_to' DataField = 'staff_fields_ship_to'
...@@ -829,6 +830,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -829,6 +830,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = wdbcbQuickbooksItemChange OnChange = wdbcbQuickbooksItemChange
ItemIndex = -1 ItemIndex = -1
...@@ -1023,7 +1025,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1023,7 +1025,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Role = '' Role = ''
ShowFocus = False ShowFocus = False
ShowSeconds = False ShowSeconds = False
TabStop = False
Text = '' Text = ''
DataField = 'proofing_approved_date' DataField = 'proofing_approved_date'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1082,6 +1083,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1082,6 +1083,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85 ChildOrder = 85
ElementID = 'cbplates' ElementID = 'cbplates'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_plates' DataField = 'supplied_by_customer_plates'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1097,6 +1099,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1097,6 +1099,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85 ChildOrder = 85
ElementID = 'cbsampleCarton' ElementID = 'cbsampleCarton'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_sample_ca' DataField = 'supplied_by_customer_sample_ca'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1112,6 +1115,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1112,6 +1115,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85 ChildOrder = 85
ElementID = 'cbftp' ElementID = 'cbftp'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_ftp' DataField = 'supplied_by_customer_ftp'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1127,6 +1131,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1127,6 +1131,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85 ChildOrder = 85
ElementID = 'cbcolorcopy' ElementID = 'cbcolorcopy'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_color_copy' DataField = 'supplied_by_customer_color_copy'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1142,6 +1147,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1142,6 +1147,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85 ChildOrder = 85
ElementID = 'edtemail' ElementID = 'edtemail'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_e_mail' DataField = 'supplied_by_customer_e_mail'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1157,6 +1163,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1157,6 +1163,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85 ChildOrder = 85
ElementID = 'edtexistingcuttingdie' ElementID = 'edtexistingcuttingdie'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_existing_' DataField = 'supplied_by_customer_existing_'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1172,6 +1179,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1172,6 +1179,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85 ChildOrder = 85
ElementID = 'edtrefartapdf' ElementID = 'edtrefartapdf'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_ref_art_a' DataField = 'supplied_by_customer_ref_art_a'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1187,6 +1195,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1187,6 +1195,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85 ChildOrder = 85
ElementID = 'edtrefartprintcard' ElementID = 'edtrefartprintcard'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_ref_art_p' DataField = 'supplied_by_customer_ref_art_p'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1198,12 +1207,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1198,12 +1207,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 378 Top = 378
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Full Mount' Caption = 'Full Mount'
ChildOrder = 85 ChildOrder = 85
ElementID = 'cbfullmount' ElementID = 'cbfullmount'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'mounting_full_mount' DataField = 'mounting_full_mount'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1215,12 +1224,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1215,12 +1224,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 356 Top = 356
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Sticky Bak' Caption = 'Sticky Bak'
ChildOrder = 85 ChildOrder = 85
ElementID = 'cbstickybak' ElementID = 'cbstickybak'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'mounting_sticky_bak' DataField = 'mounting_sticky_bak'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1232,12 +1241,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1232,12 +1241,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 235 Top = 235
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Excalibur Die' Caption = 'Excalibur Die'
ChildOrder = 85 ChildOrder = 85
ElementID = 'cbexcaliburdie' ElementID = 'cbexcaliburdie'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_excalibur_die' DataField = 'layout_excalibur_die'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -1249,12 +1258,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1249,12 +1258,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 309 Top = 309
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Loose' Caption = 'Loose'
ChildOrder = 84 ChildOrder = 84
ElementID = 'cbloose' ElementID = 'cbloose'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbStripMount: TWebCheckBox object cbStripMount: TWebCheckBox
...@@ -1262,12 +1271,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1262,12 +1271,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 402 Top = 402
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Strip Mount' Caption = 'Strip Mount'
ChildOrder = 84 ChildOrder = 84
ElementID = 'cbstripmount' ElementID = 'cbstripmount'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object edtQBItemDescription: TWebEdit object edtQBItemDescription: TWebEdit
...@@ -1275,6 +1284,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1275,6 +1284,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 551 Top = 551
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 31 ChildOrder = 31
ElementID = 'edtitemdescription' ElementID = 'edtitemdescription'
Enabled = False Enabled = False
...@@ -1286,6 +1296,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1286,6 +1296,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 149 Top = 149
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoCompletion = acNope AutoCompletion = acNope
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
...@@ -1301,6 +1312,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1301,6 +1312,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 149 Top = 149
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'In Quickbooks?' Caption = 'In Quickbooks?'
ChildOrder = 29 ChildOrder = 29
ElementID = 'wdbcbinqb' ElementID = 'wdbcbinqb'
...@@ -1317,6 +1329,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1317,6 +1329,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 185 Top = 185
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 30 ChildOrder = 30
ElementID = 'edtordernum' ElementID = 'edtordernum'
Enabled = False Enabled = False
......
...@@ -97,14 +97,14 @@ ...@@ -97,14 +97,14 @@
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quantity:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quantity:</label>
<input id="edtquantity" class="form-control input-sm" style="width: 100px" type="number" min="1" required/> <input id="edtquantity" class="form-control input-sm" style="width: 100px" type="number" min="1" required/>
<div class="invalid-feedback" style="font-size: 15px;" required> <div class="invalid-feedback" style="font-size: 15px;" required>
Please Provide a Quantity. Please Provide a Valid Quantity.
</div> </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">Price:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Price:</label>
<input id="edtprice" class="form-control input-sm" style="width: 100px" type="number" min="1" required/> <input id="edtprice" class="form-control input-sm" style="width: 100px" type="number" min="1" required/>
<div class="invalid-feedback" style="font-size: 15px;"> <div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Price. Please Provide a Valid Price.
</div> </div>
</div> </div>
<div> <div>
...@@ -167,40 +167,40 @@ ...@@ -167,40 +167,40 @@
<hr class="custom-hr"> <hr class="custom-hr">
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Color Copy:</label>
<input type="checkbox" id="cbcolorcopy"> <input type="checkbox" id="cbcolorcopy">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Color Copy?</label>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Plates:</label>
<input type="checkbox" id="cbplates"> <input type="checkbox" id="cbplates">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Plates?</label>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Sample Carton:</label>
<input type="checkbox" id="cbsampleCarton"> <input type="checkbox" id="cbsampleCarton">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Sample Carton?</label>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Email:</label>
<input type="checkbox" id="edtemail"/> <input type="checkbox" id="edtemail"/>
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Email?</label>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">FTP:</label>
<input type="checkbox" id="cbftp"/> <input type="checkbox" id="cbftp"/>
<label class='pe-2' style="font-weight: 700; font-size: 15px;">FTP?</label>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Other:</label> <label class='pe-2' style="font-weight: 700; font-size: 15px;">Other:</label>
<input class="form-control input-sm" id="edtother" style="width: 150px"/> <input class="form-control input-sm" id="edtother" style="width: 150px"/>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Existing Cutting Die:</label>
<input type="checkbox" id="edtexistingcuttingdie"/> <input type="checkbox" id="edtexistingcuttingdie"/>
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Existing Cutting Die?</label>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Ref Art Print Card:</label>
<input type="checkbox" id="edtrefartprintcard"/> <input type="checkbox" id="edtrefartprintcard"/>
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Ref Art Print Card?</label>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Ref Art A PDF:</label>
<input type="checkbox" id="edtrefartapdf"/> <input type="checkbox" id="edtrefartapdf"/>
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Ref Art A PDF?</label>
</div> </div>
</div> </div>
<h4 class="custom-h4 mt-3">Layout</h4> <h4 class="custom-h4 mt-3">Layout</h4>
...@@ -235,8 +235,8 @@ ...@@ -235,8 +235,8 @@
<input id="edtcadfile" class="form-control input-sm" style="width: 150px"/> <input id="edtcadfile" class="form-control input-sm" style="width: 150px"/>
</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">Excalibur Die:</label>
<input type="checkbox" id="cbexcaliburdie"> <input type="checkbox" id="cbexcaliburdie">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Excalibur Die?</label>
</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">RSC Style:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">RSC Style:</label>
...@@ -247,21 +247,21 @@ ...@@ -247,21 +247,21 @@
<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">Loose:</label>
<input type="checkbox" id="cbloose"> <input type="checkbox" id="cbloose">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Loose:</label>
<input id="edtloose" class="form-control input-sm" style="width: 150px"/> <input id="edtloose" class="form-control input-sm" style="width: 150px"/>
</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">Sticky Bak:</label>
<input type="checkbox" id="cbstickybak"> <input type="checkbox" id="cbstickybak">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Sticky Bak?</label>
</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">Full Mount:</label>
<input type="checkbox" id="cbfullmount"> <input type="checkbox" id="cbfullmount">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Full Mount?</label>
</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">Strip Mount:</label>
<input type="checkbox" id="cbstripmount"> <input type="checkbox" id="cbstripmount">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Strip Mount:</label>
<input id="edtstripmount" class="form-control input-sm" style="width: 150px"/> <input id="edtstripmount" class="form-control input-sm" style="width: 150px"/>
</div> </div>
<div class="col-auto"> <div class="col-auto">
...@@ -337,28 +337,28 @@ ...@@ -337,28 +337,28 @@
<input id="edtproofshipto" class="form-control input-sm" style="width: 150px"/> <input id="edtproofshipto" class="form-control input-sm" style="width: 150px"/>
</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">Full Size Panel:</label>
<input type="checkbox" id="cbfullsizepanel"> <input type="checkbox" id="cbfullsizepanel">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Full Size Panel?</label>
</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">Print Card:</label>
<input type="checkbox" id="cbprintcard"> <input type="checkbox" id="cbprintcard">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Print Card?</label>
</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">Wide Format:</label>
<input type="checkbox" id="cbwideformat"> <input type="checkbox" id="cbwideformat">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Wide Format?</label>
</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">PDF File:</label>
<input type="checkbox" id="cbpdffile"> <input type="checkbox" id="cbpdffile">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF File?</label>
</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">Other:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Other:</label>
<input id="edtproofother" class="form-control input-sm" style="width: 150px"/> <input id="edtproofother" class="form-control input-sm" style="width: 150px"/>
</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">Art Approved As Is:</label>
<input type="checkbox" id="cbartapprovedasis"> <input type="checkbox" id="cbartapprovedasis">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Art Approved As Is?</label>
</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">Approved Date:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Approved Date:</label>
...@@ -386,7 +386,7 @@ ...@@ -386,7 +386,7 @@
<div class="row pb-3"> <div class="row pb-3">
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label">Special Instructions</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label">Special Instructions</label>
<textarea id="edtspecialinstructions" class="form-control" style=" width: 500px; height: 150px;"></textarea> <textarea id="edtspecialinstructions" class="form-control mb-3" style=" width: 800px; height: 150px;"></textarea>
</div> </div>
</div> </div>
</div> </div>
...@@ -259,7 +259,7 @@ implementation ...@@ -259,7 +259,7 @@ implementation
{$R *.dfm} {$R *.dfm}
uses uses
View.Home, View.Main, View.AddOrder, View.AddAddress, Utils; View.Home, View.Main, View.Order.Add, View.Address.Add, Utils;
class function TFOrderEntryCorrugated.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm; class function TFOrderEntryCorrugated.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm;
begin begin
...@@ -354,8 +354,8 @@ procedure TFOrderEntryCorrugated.btnDeleteClick(Sender: TObject); ...@@ -354,8 +354,8 @@ procedure TFOrderEntryCorrugated.btnDeleteClick(Sender: TObject);
begin begin
ShowConfirmationModal( ShowConfirmationModal(
'Are you sure you want to delete this order?', 'Are you sure you want to delete this order?',
'Delete', 'Yes',
'Cancel', 'No',
procedure(confirmed: Boolean) procedure(confirmed: Boolean)
begin begin
if confirmed then if confirmed then
...@@ -388,10 +388,16 @@ end; ...@@ -388,10 +388,16 @@ end;
procedure TFOrderEntryCorrugated.btnQBClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnQBClick(Sender: TObject);
var var
orderJSON: TJSONObject; orderJSON: TJSONObject;
qbEnabled: boolean;
begin begin
if AuthService.TokenPayload.Properties['qb_enabled'] then qbEnabled := boolean(AuthService.TokenPayload.Properties['qb_enabled']);
begin
if not qbEnabled then
begin begin
ShowToast('QB interface not currently active', 'info');
Exit;
end;
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
begin begin
if ( VerifyQBOrder() )then if ( VerifyQBOrder() )then
...@@ -410,10 +416,6 @@ begin ...@@ -410,10 +416,6 @@ begin
end end
else else
ShowToast('Failure:User not authorized to add to QuickBooks', 'failure'); ShowToast('Failure:User not authorized to add to QuickBooks', 'failure');
end
end
else
ShowToast('QB interface not currently active', 'info');
end; end;
[async] procedure TFOrderEntryCorrugated.GenerateReportPDF; [async] procedure TFOrderEntryCorrugated.GenerateReportPDF;
...@@ -1143,7 +1145,7 @@ begin ...@@ -1143,7 +1145,7 @@ begin
input.classList.remove('is-invalid'); input.classList.remove('is-invalid');
input := TJSHTMLInputElement(document.getElementById('edtprice')); input := TJSHTMLInputElement(document.getElementById('edtprice'));
if edtPrice.Text = '' then if ( ( edtPrice.Text = '' ) or ( StrToFloat(edtPrice.Text) <= 0 ) )then
begin begin
input.classList.add('is-invalid'); input.classList.add('is-invalid');
...@@ -1153,7 +1155,7 @@ begin ...@@ -1153,7 +1155,7 @@ begin
input.classList.remove('is-invalid'); input.classList.remove('is-invalid');
input := TJSHTMLInputElement(document.getElementById('edtquantity')); input := TJSHTMLInputElement(document.getElementById('edtquantity'));
if edtQuantity.Text = '' then if ( ( edtQuantity.Text = '' ) or ( StrToFloat(edtQuantity.Text) <= 0 ) ) then
begin begin
input.classList.add('is-invalid'); input.classList.add('is-invalid');
......
...@@ -100,14 +100,14 @@ ...@@ -100,14 +100,14 @@
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quantity:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quantity:</label>
<input id="edtquantity" class="form-control input-sm" style="width: 100px" type="number" min="1" required/> <input id="edtquantity" class="form-control input-sm" style="width: 100px" type="number" min="1" required/>
<div class="invalid-feedback" style="font-size: 15px;" required> <div class="invalid-feedback" style="font-size: 15px;" required>
Please Provide a Quantity. Please Provide a Valid Quantity.
</div> </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">Price:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Price:</label>
<input id="edtprice" class="form-control input-sm" style="width: 100px" type="number" min="1" required/> <input id="edtprice" class="form-control input-sm" style="width: 100px" type="number" min="1" required/>
<div class="invalid-feedback" style="font-size: 15px;"> <div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Price. Please Provide a Valid Price.
</div> </div>
</div> </div>
<div> <div>
...@@ -154,12 +154,12 @@ ...@@ -154,12 +154,12 @@
</div> </div>
</div> </div>
</div> </div>
<h4 class="custom-h4 mt-3">General</h4> <h4 class="custom-h4 mt-3 mt-3">General</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" style="font-weight: 700; font-size: 15px;" class="form-label">Special Instructions</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label">Special Instructions</label>
<textarea id="edtspecialinstructions" class="form-control" style=" width: 500px; height: 150px;"></textarea> <textarea id="edtspecialinstructions" class="form-control mb-3" style=" width: 800px; height: 150px;"></textarea>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -129,7 +129,7 @@ implementation ...@@ -129,7 +129,7 @@ implementation
{$R *.dfm} {$R *.dfm}
uses uses
View.Home, View.Main, View.AddOrder, View.AddAddress, Utils; View.Home, View.Main, View.Order.Add, View.Address.Add, Utils;
class function TFOrderEntryCuttingDie.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm; class function TFOrderEntryCuttingDie.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm;
...@@ -192,9 +192,16 @@ end; ...@@ -192,9 +192,16 @@ end;
procedure TFOrderEntryCuttingDie.btnQBClick(Sender: TObject); procedure TFOrderEntryCuttingDie.btnQBClick(Sender: TObject);
var var
orderJSON: TJSONObject; orderJSON: TJSONObject;
qbEnabled: boolean;
begin begin
if AuthService.TokenPayload.Properties['qb_enabled'] then qbEnabled := boolean(AuthService.TokenPayload.Properties['qb_enabled']);
if not qbEnabled then
begin begin
ShowToast('QB interface not currently active', 'info');
Exit;
end;
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
begin begin
if ( VerifyQBOrder() )then if ( VerifyQBOrder() )then
...@@ -213,9 +220,6 @@ begin ...@@ -213,9 +220,6 @@ begin
end end
else else
ShowToast('Failure:User not authorized to add to QuickBooks', 'failure'); ShowToast('Failure:User not authorized to add to QuickBooks', 'failure');
end
else
ShowToast('QB interface not currently active', 'info');
end; end;
procedure TFOrderEntryCuttingDie.WebButton2Click(Sender: TObject); procedure TFOrderEntryCuttingDie.WebButton2Click(Sender: TObject);
...@@ -320,8 +324,8 @@ end; ...@@ -320,8 +324,8 @@ end;
begin begin
ShowConfirmationModal( ShowConfirmationModal(
'Are you sure you want to delete this order?', 'Are you sure you want to delete this order?',
'Delete', 'Yes',
'Cancel', 'No',
procedure(confirmed: Boolean) procedure(confirmed: Boolean)
begin begin
if confirmed then if confirmed then
......
...@@ -414,13 +414,13 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -414,13 +414,13 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 96 Top = 96
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'PDF' Caption = 'PDF'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbpdf' ElementID = 'cbpdf'
Enabled = False Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_pdf' DataField = 'proofing_pdf'
DataSource = wdsOrder DataSource = wdsOrder
...@@ -446,13 +446,13 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -446,13 +446,13 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 238 Top = 238
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Full Size Ink Jet For Layout Content Only' Caption = 'Full Size Ink Jet For Layout Content Only'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbfullsizeinkjet' ElementID = 'cbfullsizeinkjet'
Enabled = False Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_full_size_ink_jet_for' DataField = 'proofing_full_size_ink_jet_for'
DataSource = wdsOrder DataSource = wdsOrder
......
...@@ -97,14 +97,14 @@ ...@@ -97,14 +97,14 @@
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quantity:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quantity:</label>
<input id="edtquantity" class="form-control input-sm" style="width: 100px" type="number" min="1" required/> <input id="edtquantity" class="form-control input-sm" style="width: 100px" type="number" min="1" required/>
<div class="invalid-feedback" style="font-size: 15px;" required> <div class="invalid-feedback" style="font-size: 15px;" required>
Please Provide a Quantity. Please Provide a Valid Quantity.
</div> </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">Price:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Price:</label>
<input id="edtprice" class="form-control input-sm" style="width: 100px" type="number" min="1" required/> <input id="edtprice" class="form-control input-sm" style="width: 100px" type="number" min="1" required/>
<div class="invalid-feedback" style="font-size: 15px;"> <div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Price. Please Provide a Valid Price.
</div> </div>
</div> </div>
<div> <div>
...@@ -207,8 +207,8 @@ ...@@ -207,8 +207,8 @@
<hr class="custom-hr"> <hr class="custom-hr">
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF:</label>
<input type="checkbox" id="cbpdf"> <input type="checkbox" id="cbpdf">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF?</label>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF To:</label> <label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF To:</label>
...@@ -227,8 +227,8 @@ ...@@ -227,8 +227,8 @@
<input class="form-control input-sm" id="dtppdfdate3" type="date"> <input class="form-control input-sm" id="dtppdfdate3" type="date">
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Full Size Ink Jet For Layout Content Only:</label>
<input type="checkbox" id="cbfullsizeinkjet"> <input type="checkbox" id="cbfullsizeinkjet">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Full Size Ink Jet For Layout Content Only?</label>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ink Jet To:</label> <label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ink Jet To:</label>
...@@ -450,7 +450,7 @@ ...@@ -450,7 +450,7 @@
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label">Comments</label> <label style="font-weight: 700; font-size: 15px;" class="form-label">Comments</label>
<textarea id="edtcomments" class="form-control" style=" width: 500px; height: 150px;"></textarea> <textarea id="edtcomments" class="form-control mb-3" style=" width: 800px; height: 150px;"></textarea>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -265,7 +265,7 @@ implementation ...@@ -265,7 +265,7 @@ implementation
{$R *.dfm} {$R *.dfm}
uses uses
View.Home, View.Main, View.AddOrder, View.AddAddress, Utils; View.Home, View.Main, View.Order.Add, View.Address.Add, Utils;
class function TFOrderEntryWeb.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm; class function TFOrderEntryWeb.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm;
...@@ -418,8 +418,8 @@ procedure TFOrderEntryWeb.btnDeleteClick(Sender: TObject); ...@@ -418,8 +418,8 @@ procedure TFOrderEntryWeb.btnDeleteClick(Sender: TObject);
begin begin
ShowConfirmationModal( ShowConfirmationModal(
'Are you sure you want to delete this order?', 'Are you sure you want to delete this order?',
'Delete', 'Yes',
'Cancel', 'No',
procedure(confirmed: Boolean) procedure(confirmed: Boolean)
begin begin
if confirmed then if confirmed then
...@@ -453,9 +453,16 @@ end; ...@@ -453,9 +453,16 @@ end;
procedure TFOrderEntryWeb.btnQBClick(Sender: TObject); procedure TFOrderEntryWeb.btnQBClick(Sender: TObject);
var var
orderJSON: TJSONObject; orderJSON: TJSONObject;
qbEnabled: boolean;
begin begin
if AuthService.TokenPayload.Properties['qb_enabled'] then qbEnabled := boolean(AuthService.TokenPayload.Properties['qb_enabled']);
if not qbEnabled then
begin begin
ShowToast('QB interface not currently active', 'info');
Exit;
end;
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
begin begin
if ( VerifyQBOrder() )then if ( VerifyQBOrder() )then
...@@ -474,9 +481,6 @@ begin ...@@ -474,9 +481,6 @@ begin
end end
else else
ShowToast('Failure:User not authorized to add to QuickBooks', 'failure'); ShowToast('Failure:User not authorized to add to QuickBooks', 'failure');
end
else
ShowToast('QB interface not currently active', 'info');
end; end;
procedure TFOrderEntryWeb.AddEstimate(orderID: string); procedure TFOrderEntryWeb.AddEstimate(orderID: string);
...@@ -773,10 +777,7 @@ var ...@@ -773,10 +777,7 @@ var
tempString, strColorList: string; tempString, strColorList: string;
colorObject: TJSObject; colorObject: TJSObject;
colorList: TJSArray; colorList: TJSArray;
colorLength: integer;
color: TJSObject; color: TJSObject;
colorJSON: TJSONObject;
colorListJSON: TJSONArray;
items: TJSObject; items: TJSObject;
begin begin
Utils.ShowSpinner('spinner'); Utils.ShowSpinner('spinner');
...@@ -836,7 +837,6 @@ procedure TFOrderEntryWeb.SetNewOrderInfo(customerID: string); ...@@ -836,7 +837,6 @@ procedure TFOrderEntryWeb.SetNewOrderInfo(customerID: string);
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
customer : TJSObject; customer : TJSObject;
address: string;
items: TJSObject; items: TJSObject;
begin begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer', xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer',
...@@ -1027,7 +1027,7 @@ end; ...@@ -1027,7 +1027,7 @@ end;
function TFOrderEntryWeb.VerifyQBOrder: Boolean; function TFOrderEntryWeb.VerifyQBOrder: Boolean;
var var
msg, SQL: string; msg: string;
begin begin
Result := True; Result := True;
msg := 'To add an order to QuickBooks, the following must be present:' + sLineBreak; msg := 'To add an order to QuickBooks, the following must be present:' + sLineBreak;
......
...@@ -156,40 +156,50 @@ object FViewOrders: TFViewOrders ...@@ -156,40 +156,50 @@ object FViewOrders: TFViewOrders
Title = 'Proof Due' Title = 'Proof Due'
end end
item item
ElementClassName = 'tbl-min-120'
DataField = 'proofDone' DataField = 'proofDone'
Title = 'Proof Done' Title = 'Proof Done'
TitleElementClassName = 'tbl-min-120'
end end
item item
DataField = 'artDue' DataField = 'artDue'
Title = 'Art Due' Title = 'Art Due'
end end
item item
ElementClassName = 'tbl-min-120'
DataField = 'artDone' DataField = 'artDone'
Title = 'Art Done' Title = 'Art Done'
TitleElementClassName = 'tbl-min-120'
end end
item item
DataField = 'plateDue' DataField = 'plateDue'
Title = 'Plate Due' Title = 'Plate Due'
end end
item item
ElementClassName = 'tbl-min-120'
DataField = 'plateDone' DataField = 'plateDone'
Title = 'Plate Done' Title = 'Plate Done'
TitleElementClassName = 'tbl-min-120'
end end
item item
DataField = 'mountDue' DataField = 'mountDue'
Title = 'Mount Due' Title = 'Mount Due'
end end
item item
ElementClassName = 'tbl-min-120'
DataField = 'mountDone' DataField = 'mountDone'
Title = 'Mount Done' Title = 'Mount Done'
TitleElementClassName = 'tbl-min-120'
end end
item item
DataField = 'shipDue' DataField = 'shipDue'
Title = 'Ship Due' Title = 'Ship Due'
end end
item item
ElementClassName = 'tbl-min-120'
DataField = 'shipDone' DataField = 'shipDone'
Title = 'Ship Done' Title = 'Ship Done'
TitleElementClassName = 'tbl-min-120'
end end
item item
DataField = 'price' DataField = 'price'
...@@ -360,6 +370,7 @@ object FViewOrders: TFViewOrders ...@@ -360,6 +370,7 @@ object FViewOrders: TFViewOrders
FieldName = 'proofDue' FieldName = 'proofDue'
end end
object xdwdsOrdersproofDone: TStringField object xdwdsOrdersproofDone: TStringField
DisplayWidth = 40
FieldName = 'proofDone' FieldName = 'proofDone'
end end
object xdwdsOrdersartDue: TStringField object xdwdsOrdersartDue: TStringField
......
...@@ -125,7 +125,7 @@ var ...@@ -125,7 +125,7 @@ var
implementation implementation
uses uses
XData.Model.Classes, View.Main, View.AddOrder, View.Search, View.SetStatus, Utils; XData.Model.Classes, View.Main, View.Order.Add, View.Search, View.SetStatus, Utils;
{$R *.dfm} {$R *.dfm}
...@@ -175,7 +175,7 @@ begin ...@@ -175,7 +175,7 @@ begin
ShowConfirmationModal( ShowConfirmationModal(
'You are about to generate a PDF for over 100 orders. This may take some time. Continue?', 'You are about to generate a PDF for over 100 orders. This may take some time. Continue?',
'Yes', 'Yes',
'Cancel', 'No',
procedure(confirmed: Boolean) procedure(confirmed: Boolean)
begin begin
if confirmed then if confirmed then
...@@ -285,6 +285,7 @@ procedure TFViewOrders.WebFormCreate(Sender: TObject); ...@@ -285,6 +285,7 @@ procedure TFViewOrders.WebFormCreate(Sender: TObject);
var var
today: TDateTime; today: TDateTime;
params: TStringList; params: TStringList;
btn: TJSHTMLElement;
begin begin
Utils.ShowSpinner('spinner'); Utils.ShowSpinner('spinner');
DMConnection.ApiConnection.Connected := True; DMConnection.ApiConnection.Connected := True;
...@@ -331,6 +332,22 @@ begin ...@@ -331,6 +332,22 @@ begin
statusOrderID := params.Values['orderID']; statusOrderID := params.Values['orderID'];
companyID := params.Values['companyID']; companyID := params.Values['companyID'];
jobName := params.Values['jobName']; jobName := params.Values['jobName'];
wlcbOrderBy.Value := OrderBy;
btn := document.getElementById('btnorderby') as TJSHTMLElement;
if direction = 'DESC' then
begin
btnOrderBy.Caption := 'Descending';
btn.innerHTML := 'Descending <i class="fa fa-arrow-down"></i>';
direction := 'DESC';
end
else
begin
btnOrderBy.Caption := 'Ascending';
btn.innerHTML := 'Ascending <i class="fa fa-arrow-up"></i>';
direction := 'ASC';
end;
// Status1 // Status1
startDate1 := params.Values['startDate1']; startDate1 := params.Values['startDate1'];
...@@ -350,7 +367,7 @@ begin ...@@ -350,7 +367,7 @@ begin
else else
null2 := StrToBool(params.Values['null2']); null2 := StrToBool(params.Values['null2']);
end; end;
FViewMain.search := GenerateSearchOptions(); GenerateSearchOptions();
getOrders(FViewMain.search); getOrders(FViewMain.search);
end; end;
...@@ -443,7 +460,7 @@ begin ...@@ -443,7 +460,7 @@ begin
companyID := newform.DBID; companyID := newform.DBID;
orderType := newform.wcbOrderType.Text; orderType := newform.wcbOrderType.Text;
FViewMain.search := generateSearchOptions(); generateSearchOptions();
//searchOptions := generateSearchOptions(); //searchOptions := generateSearchOptions();
edtSearch.Text := FViewMain.search; edtSearch.Text := FViewMain.search;
getOrders(FViewMain.search); getOrders(FViewMain.search);
...@@ -459,12 +476,12 @@ var ...@@ -459,12 +476,12 @@ var
begin begin
newform := TFSetStatus.CreateNew; newform := TFSetStatus.CreateNew;
newform.Caption := 'Input Search Options'; newform.Caption := 'Set Status';
newForm.Popup := True; newForm.Popup := True;
newForm.Border := fbDialog; newForm.Border := fbDialog;
newForm.Position := poScreenCenter; newForm.Position := poScreenCenter;
newForm.OrderID := statusOrderID; newForm.OrderID := statusOrderID;
newForm.JobName := wdbtcOrders.Cells[3, row]; newForm.JobName := wdbtcOrders.Cells[4, row];
if wdbtcOrders.Cells[15, row] <> '' then if wdbtcOrders.Cells[15, row] <> '' then
newForm.ShipDue := StrToDateTime(wdbtcOrders.Cells[15, row]) newForm.ShipDue := StrToDateTime(wdbtcOrders.Cells[15, row])
else else
...@@ -893,6 +910,7 @@ begin ...@@ -893,6 +910,7 @@ begin
if orderID <> '' then if orderID <> '' then
searchOptions := searchOptions + '&orderID=' + orderID; searchOptions := searchOptions + '&orderID=' + orderID;
edtSearch.text := searchOptions; edtSearch.text := searchOptions;
FViewMain.search := searchOptions;
Result := searchOptions; Result := searchOptions;
end; end;
......
...@@ -48,7 +48,7 @@ object FSetStatus: TFSetStatus ...@@ -48,7 +48,7 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel3: TWebLabel object WebLabel3: TWebLabel
Left = 174 Left = 90
Top = 14 Top = 14
Width = 57 Width = 57
Height = 14 Height = 14
...@@ -184,7 +184,7 @@ object FSetStatus: TFSetStatus ...@@ -184,7 +184,7 @@ object FSetStatus: TFSetStatus
object edtOrderID: TWebEdit object edtOrderID: TWebEdit
Left = 16 Left = 16
Top = 34 Top = 34
Width = 145 Width = 63
Height = 22 Height = 22
HelpType = htKeyword HelpType = htKeyword
TabStop = False TabStop = False
...@@ -204,9 +204,9 @@ object FSetStatus: TFSetStatus ...@@ -204,9 +204,9 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object edtJobName: TWebEdit object edtJobName: TWebEdit
Left = 174 Left = 90
Top = 34 Top = 34
Width = 145 Width = 229
Height = 22 Height = 22
HelpType = htKeyword HelpType = htKeyword
TabStop = False TabStop = False
......
...@@ -170,7 +170,13 @@ procedure TFSetStatus.SetDueDates(); ...@@ -170,7 +170,13 @@ procedure TFSetStatus.SetDueDates();
begin begin
if OrderType = 'corrugated plate' then if OrderType = 'corrugated plate' then
begin begin
if wlcbStatus.DisplayText = 'Art Done' then if wlcbStatus.DisplayText = 'Proof Done' then
begin
dtpPlateDue.Date := plateDue;
dtpMountDue.Date := mountDue;
dtpShipDue.Date := shipDue;
end
else if wlcbStatus.DisplayText = 'Art Done' then
begin begin
dtpPlateDue.Date := getNextDate(dtpDate.Date); dtpPlateDue.Date := getNextDate(dtpDate.Date);
dtpMountDue.Date := getNextDate(dtpPlateDue.Date); dtpMountDue.Date := getNextDate(dtpPlateDue.Date);
...@@ -178,29 +184,60 @@ begin ...@@ -178,29 +184,60 @@ begin
end end
else if wlcbStatus.DisplayText = 'Plate Done' then else if wlcbStatus.DisplayText = 'Plate Done' then
begin begin
dtpPlateDue.Date := plateDue;
dtpMountDue.Date := getNextDate(dtpDate.Date); dtpMountDue.Date := getNextDate(dtpDate.Date);
dtpShipDue.Date := getNextDate(dtpMountDue.Date); dtpShipDue.Date := getNextDate(dtpMountDue.Date);
end end
else if wlcbStatus.DisplayText = 'Mount Done' then else if wlcbStatus.DisplayText = 'Mount Done' then
begin
dtpPlateDue.Date := plateDue;
dtpMountDue.Date := mountDue;
dtpShipDue.Date := getNextDate(dtpDate.Date); dtpShipDue.Date := getNextDate(dtpDate.Date);
end end
else if wlcbStatus.DisplayText = 'Ship Done' then
begin
dtpPlateDue.Date := plateDue;
dtpMountDue.Date := mountDue;
dtpShipDue.Date := shipDue;
end;
end
else if OrderType = 'web plate' then else if OrderType = 'web plate' then
begin begin
if wlcbStatus.DisplayText = 'Art Done' then if wlcbStatus.DisplayText = 'Proof Done' then
begin
dtpPlateDue.Date := plateDue;
dtpShipDue.Date := shipDue;
end
else if wlcbStatus.DisplayText = 'Art Done' then
begin begin
dtpPlateDue.Date := getNextDate(dtpDate.Date); dtpPlateDue.Date := getNextDate(dtpDate.Date);
dtpShipDue.Date := getNextDate(dtpMountDue.Date); dtpShipDue.Date := getNextDate(dtpPlateDue.Date);
end end
else if wlcbStatus.DisplayText = 'Plate Done' then else if wlcbStatus.DisplayText = 'Plate Done' then
begin begin
dtpShipDue.Date := getNextDate(dtpMountDue.Date); dtpPlateDue.Date := plateDue;
dtpShipDue.Date := getNextDate(dtpDate.Date);
end end
else if wlcbStatus.DisplayText = 'Ship Done' then
begin
dtpPlateDue.Date := plateDue;
dtpShipDue.Date := shipDue;
end;
end end
else else
begin begin
if wlcbStatus.DisplayText = 'Art Done' then if wlcbStatus.DisplayText = 'Proof Done' then
begin
dtpShipDue.Date := shipDue;
end
else if wlcbStatus.DisplayText = 'Art Done' then
begin begin
dtpShipDue.Date := getNextDate(dtpDate.Date); dtpShipDue.Date := getNextDate(dtpDate.Date);
end
else if wlcbStatus.DisplayText = 'Ship Done' then
begin
dtpShipDue.Date := shipDue;
end; end;
end; end;
end; end;
......
...@@ -93,6 +93,7 @@ object FViewEditUser: TFViewEditUser ...@@ -93,6 +93,7 @@ object FViewEditUser: TFViewEditUser
Top = 62 Top = 62
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 7 ChildOrder = 7
ElementID = 'edtemail' ElementID = 'edtemail'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -103,6 +104,7 @@ object FViewEditUser: TFViewEditUser ...@@ -103,6 +104,7 @@ object FViewEditUser: TFViewEditUser
Top = 34 Top = 34
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 13 ChildOrder = 13
ElementID = 'edtpassword' ElementID = 'edtpassword'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -131,6 +133,7 @@ object FViewEditUser: TFViewEditUser ...@@ -131,6 +133,7 @@ object FViewEditUser: TFViewEditUser
Top = 5 Top = 5
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 14 ChildOrder = 14
ElementID = 'edtfullname' ElementID = 'edtfullname'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -141,6 +144,7 @@ object FViewEditUser: TFViewEditUser ...@@ -141,6 +144,7 @@ object FViewEditUser: TFViewEditUser
Top = 6 Top = 6
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 14 ChildOrder = 14
ElementID = 'edtusername' ElementID = 'edtusername'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -179,6 +183,7 @@ object FViewEditUser: TFViewEditUser ...@@ -179,6 +183,7 @@ object FViewEditUser: TFViewEditUser
Font.Style = [fsBold] Font.Style = [fsBold]
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ParentFont = False ParentFont = False
TabOrder = -1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object edtRights: TWebEdit object edtRights: TWebEdit
...@@ -186,6 +191,7 @@ object FViewEditUser: TFViewEditUser ...@@ -186,6 +191,7 @@ object FViewEditUser: TFViewEditUser
Top = 93 Top = 93
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 19 ChildOrder = 19
ElementID = 'edtrights' ElementID = 'edtrights'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -198,6 +204,7 @@ object FViewEditUser: TFViewEditUser ...@@ -198,6 +204,7 @@ object FViewEditUser: TFViewEditUser
Height = 23 Height = 23
ElementID = 'cbaccess' ElementID = 'cbaccess'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
...@@ -210,6 +217,7 @@ object FViewEditUser: TFViewEditUser ...@@ -210,6 +217,7 @@ object FViewEditUser: TFViewEditUser
Top = 62 Top = 62
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 7 ChildOrder = 7
ElementID = 'edtQB' ElementID = 'edtQB'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
......
// Form that functions as both a way to edit or add users to the database // Form that functions as both a way to edit or add users to the database
// Author: Cameron Hayes // Author: Cameron Hayes
unit View.EditUser; unit View.User.Add;
interface interface
...@@ -99,6 +99,7 @@ begin ...@@ -99,6 +99,7 @@ begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser', [userInfo])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser', [userInfo]));
responseString := TJSObject(xdcResponse.Result); responseString := TJSObject(xdcResponse.Result);
Info := string(responseString['value']); Info := string(responseString['value']);
FViewMain.ShowUserForm(Info);
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
...@@ -123,14 +124,16 @@ begin ...@@ -123,14 +124,16 @@ begin
'&newuser=' + edtUsername.Text + '&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text + '&rights=' + edtRights.Text +
'&QB=' + edtQB.Text; '&QB=' + edtQB.Text;
try
console.log(editOptions);
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.EditUser', xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.EditUser',
[editOptions])); [editOptions]));
responseString := TJSObject(xdcResponse.Result); responseString := TJSObject(xdcResponse.Result);
Info := string(responseString['value']); Info := string(responseString['value']);
FViewMain.ShowUserForm(Info);
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end;
end; end;
class function TFViewEditUser.CreateForm(AElementID, Mode, Username, Password, Name, Status, Email, class function TFViewEditUser.CreateForm(AElementID, Mode, Username, Password, Name, Status, Email,
...@@ -162,7 +165,7 @@ begin ...@@ -162,7 +165,7 @@ begin
ShowToast(FMessage); ShowToast(FMessage);
edtUsername.Text := Username; edtUsername.Text := Username;
edtFullName.Text := FullName; edtFullName.Text := FullName;
if Mode = 'Edit' then if Mode = 'EDIT' then
begin begin
edtPassword.Text := 'hidden'; edtPassword.Text := 'hidden';
end; end;
...@@ -193,6 +196,7 @@ var ...@@ -193,6 +196,7 @@ var
FormEl: TJSHTMLFormElement; FormEl: TJSHTMLFormElement;
AllValid: Boolean; AllValid: Boolean;
begin begin
console.log(mode);
FormEl := TJSHTMLFormElement(document.getElementById('userprofileform')); FormEl := TJSHTMLFormElement(document.getElementById('userprofileform'));
// Clear previous invalid state // Clear previous invalid state
...@@ -227,12 +231,15 @@ begin ...@@ -227,12 +231,15 @@ begin
ShowConfirmationModal( ShowConfirmationModal(
'Are you sure you want to save changes?', 'Are you sure you want to save changes?',
'Save', 'Yes',
'Cancel', 'No',
procedure(confirmed: Boolean) procedure(confirmed: Boolean)
begin begin
if confirmed then if confirmed then
EditUser; if mode = 'ADD' then
AddUser()
else
EditUser();
end end
); );
end; end;
......
...@@ -28,8 +28,8 @@ object FViewUserProfile: TFViewUserProfile ...@@ -28,8 +28,8 @@ object FViewUserProfile: TFViewUserProfile
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel3: TWebLabel object WebLabel3: TWebLabel
Left = 39 Left = 41
Top = 59 Top = 60
Width = 38 Width = 38
Height = 14 Height = 14
Caption = 'User ID:' Caption = 'User ID:'
...@@ -45,8 +45,8 @@ object FViewUserProfile: TFViewUserProfile ...@@ -45,8 +45,8 @@ object FViewUserProfile: TFViewUserProfile
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
Left = 13 Left = 8
Top = 131 Top = 143
Width = 71 Width = 71
Height = 14 Height = 14
Caption = 'Email Address:' Caption = 'Email Address:'
...@@ -62,8 +62,8 @@ object FViewUserProfile: TFViewUserProfile ...@@ -62,8 +62,8 @@ object FViewUserProfile: TFViewUserProfile
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel4: TWebLabel object WebLabel4: TWebLabel
Left = 29 Left = 27
Top = 83 Top = 84
Width = 52 Width = 52
Height = 14 Height = 14
Caption = 'Username:' Caption = 'Username:'
...@@ -79,8 +79,8 @@ object FViewUserProfile: TFViewUserProfile ...@@ -79,8 +79,8 @@ object FViewUserProfile: TFViewUserProfile
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel5: TWebLabel object WebLabel5: TWebLabel
Left = 29 Left = 30
Top = 107 Top = 117
Width = 49 Width = 49
Height = 14 Height = 14
Caption = 'Full Name:' Caption = 'Full Name:'
...@@ -95,160 +95,157 @@ object FViewUserProfile: TFViewUserProfile ...@@ -95,160 +95,157 @@ object FViewUserProfile: TFViewUserProfile
ParentFont = False ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblResult: TWebLabel object WebLabel6: TWebLabel
Left = 85 Left = 15
Top = 246 Top = 171
Width = 3 Width = 64
Height = 14 Height = 13
ElementID = 'view.userprofile.form.lblresult' Caption = 'Access Type:'
ElementPosition = epRelative ElementID = 'view.userprofile.form.lblAccessType'
Font.Charset = ANSI_CHARSET ElementFont = efCSS
Font.Color = clBlack HeightStyle = ssAuto
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object edtUsername: TWebEdit object WebLabel7: TWebLabel
Left = 85 Left = 47
Top = 80 Top = 196
Width = 121 Width = 32
Height = 21 Height = 13
ElementID = 'view.userprofile.form.edtUsername' Caption = 'QB ID:'
ElementPosition = epRelative ElementID = 'view.userprofile.form.lblQBID'
Enabled = False ElementFont = efCSS
Font.Charset = ANSI_CHARSET HeightStyle = ssAuto
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
ReadOnly = True
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object edtUserId: TWebEdit object WebDBEdit1: TWebDBEdit
Left = 85 Left = 90
Top = 56 Top = 168
Width = 121 Width = 121
Height = 21 Height = 22
ElementID = 'view.userprofile.form.edtUserID' ChildOrder = 13
ElementPosition = epRelative ElementClassName = 'form-control'
Enabled = False ElementID = 'view.userprofile.form.edtAccessType'
Font.Charset = ANSI_CHARSET ElementFont = efCSS
Font.Color = clBlack HeightStyle = ssAuto
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False Text = 'WebDBEdit1'
ParentFont = False
ReadOnly = True
TabOrder = 1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'AType'
DataSource = wdsUser
end end
object edtFullName: TWebEdit object WebDBEdit2: TWebDBEdit
Left = 85 Left = 90
Top = 104 Top = 140
Width = 121 Width = 121
Height = 21 Height = 22
ChildOrder = 5 ChildOrder = 13
ElementID = 'view.userprofile.form.edtFullName' ElementClassName = 'form-control'
ElementPosition = epRelative ElementID = 'view.userprofile.form.edtEmail'
Font.Charset = ANSI_CHARSET ElementFont = efCSS
Font.Color = clBlack HeightStyle = ssAuto
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False Text = 'WebDBEdit1'
ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'email_address'
DataSource = wdsUser
end end
object chkAdminUser: TWebCheckBox object WebDBEdit3: TWebDBEdit
Left = 85 Left = 90
Top = 179 Top = 114
Width = 113 Width = 121
Height = 22 Height = 22
Caption = 'chkAdminUser' ChildOrder = 13
ChildOrder = 9 ElementClassName = 'form-control'
ElementID = 'view.userprofile.form.chkAdminUser' ElementID = 'view.userprofile.form.edtFullName'
ElementPosition = epRelative ElementFont = efCSS
Enabled = False HeightStyle = ssAuto
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ParentFont = False Text = 'WebDBEdit1'
Role = 'null'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'full_name'
DataSource = wdsUser
end end
object edtEmail: TWebEdit object WebDBEdit4: TWebDBEdit
Left = 85 Left = 85
Top = 126 Top = 81
Width = 121 Width = 121
Height = 21 Height = 22
ChildOrder = 7 ChildOrder = 13
ElementID = 'view.userprofile.form.edtEmail' ElementClassName = 'form-control'
ElementPosition = epRelative ElementID = 'view.userprofile.form.edtUsername'
Font.Charset = ANSI_CHARSET ElementFont = efCSS
Font.Color = clBlack HeightStyle = ssAuto
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False Text = 'WebDBEdit1'
ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'username'
DataSource = wdsUser
end end
object btnConfirm: TWebButton object WebDBEdit5: TWebDBEdit
Left = 85 Left = 85
Top = 207 Top = 57
Width = 96 Width = 121
Height = 25 Height = 22
Caption = 'Confirm Changes' ChildOrder = 13
ChildOrder = 12 ElementClassName = 'form-control'
ElementID = 'view.userprofile.form.btnconfirm' ElementID = 'view.userprofile.form.edtUserID'
ElementPosition = epRelative ElementFont = efCSS
Font.Charset = ANSI_CHARSET HeightStyle = ssAuto
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ParentFont = False Text = 'WebDBEdit1'
Role = 'button'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick DataField = 'userID'
end DataSource = wdsUser
object btnCancel: TWebButton end
Left = 208 object WebDBEdit6: TWebDBEdit
Top = 210 Left = 90
Width = 96 Top = 196
Height = 25 Width = 121
Caption = 'Cancel Changes' Height = 22
ChildOrder = 14 ChildOrder = 13
ElementID = 'view.userprofile.form.btncancel' ElementClassName = 'form-control'
ElementPosition = epRelative ElementID = 'view.userprofile.form.edtQBID'
Font.Charset = ANSI_CHARSET ElementFont = efCSS
Font.Color = clBlack HeightStyle = ssAuto
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ParentFont = False Text = 'WebDBEdit1'
Role = 'button'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCancelClick DataField = 'QBID'
DataSource = wdsUser
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 359 Left = 359
Top = 52 Top = 52
end end
object xdwdsUser: TXDataWebDataSet
Left = 314
Top = 216
object xdwdsUseruserID: TStringField
FieldName = 'userID'
end
object xdwdsUserusername: TStringField
FieldName = 'username'
end
object xdwdsUseremail_address: TStringField
FieldName = 'email_address'
end
object xdwdsUserQBID: TStringField
FieldName = 'QBID'
end
object xdwdsUserAType: TStringField
FieldName = 'Atype'
end
object xdwdsUserfull_name: TStringField
FieldName = 'full_name'
end
end
object wdsUser: TWebDataSource
AutoEdit = False
DataSet = xdwdsUser
Left = 422
Top = 262
end
end end
...@@ -18,9 +18,7 @@ ...@@ -18,9 +18,7 @@
for="view.userprofile.form.edtUsername" for="view.userprofile.form.edtUsername"
class="form-label">Username</label> class="form-label">Username</label>
<input id="view.userprofile.form.edtUsername" <input id="view.userprofile.form.edtUsername"
class="form-control" class="form-control">
required>
<div class="invalid-feedback">Username is required.</div>
</div> </div>
<div class="mb-3"> <div class="mb-3">
...@@ -28,9 +26,7 @@ ...@@ -28,9 +26,7 @@
for="view.userprofile.form.edtFullName" for="view.userprofile.form.edtFullName"
class="form-label">Full&nbsp;Name</label> class="form-label">Full&nbsp;Name</label>
<input id="view.userprofile.form.edtFullName" <input id="view.userprofile.form.edtFullName"
class="form-control" class="form-control">
required>
<div class="invalid-feedback">Full Name is required.</div>
</div> </div>
<div class="mb-3"> <div class="mb-3">
...@@ -39,36 +35,26 @@ ...@@ -39,36 +35,26 @@
class="form-label">Email&nbsp;Address</label> class="form-label">Email&nbsp;Address</label>
<input id="view.userprofile.form.edtEmail" <input id="view.userprofile.form.edtEmail"
type="email" type="email"
class="form-control" class="form-control">
required>
<div class="invalid-feedback">Valid email is required.</div>
</div> </div>
<div class="form-check mb-4"> <div class="mb-3">
<input type="checkbox" <label id="view.userprofile.form.lblAccessType"
id="view.userprofile.form.chkAdminUser" for="view.userprofile.form.edtAccessType"
class="form-check-input"> class="form-label">Email&nbsp;Address</label>
<label for="view.userprofile.form.chkAdminUser" <input id="view.userprofile.form.edtAccessType"
class="form-check-label"> type="email"
Admin&nbsp;User class="form-control">
</label>
</div> </div>
<div class="d-flex gap-2 mb-4"> <div class="mb-3">
<button id="view.userprofile.form.btnconfirm" <label id="view.userprofile.form.lblQBID"
class="btn btn-primary flex-grow-1" for="view.userprofile.form.edtQBID"
type="button"> class="form-label">Email&nbsp;Address</label>
Confirm&nbsp;Changes <input id="view.userprofile.form.edtQBID"
</button> type="email"
<button id="view.userprofile.form.btncancel" class="form-control">
class="btn btn-danger flex-grow-1"
type="button">
Cancel&nbsp;Changes
</button>
</div> </div>
<label id="view.userprofile.form.lblresult" class="form-text"></label>
</form> </form>
</div> </div>
</div> </div>
......
...@@ -7,29 +7,34 @@ uses ...@@ -7,29 +7,34 @@ uses
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, ConnectionModule, XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, ConnectionModule,
WEBLib.Toast; WEBLib.Toast, WEBLib.DBCtrls;
type type
TFViewUserProfile = class(TWebForm) TFViewUserProfile = class(TWebForm)
WebLabel1: TWebLabel; WebLabel1: TWebLabel;
WebLabel3: TWebLabel; WebLabel3: TWebLabel;
edtUsername: TWebEdit;
WebLabel2: TWebLabel; WebLabel2: TWebLabel;
edtUserId: TWebEdit;
edtFullName: TWebEdit;
WebLabel4: TWebLabel; WebLabel4: TWebLabel;
WebLabel5: TWebLabel; WebLabel5: TWebLabel;
chkAdminUser: TWebCheckBox;
edtEmail: TWebEdit;
btnConfirm: TWebButton;
lblResult: TWebLabel;
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
btnCancel: TWebButton; WebDBEdit1: TWebDBEdit;
WebDBEdit2: TWebDBEdit;
WebDBEdit3: TWebDBEdit;
WebDBEdit4: TWebDBEdit;
WebDBEdit5: TWebDBEdit;
WebDBEdit6: TWebDBEdit;
WebLabel6: TWebLabel;
WebLabel7: TWebLabel;
xdwdsUser: TXDataWebDataSet;
wdsUser: TWebDataSource;
xdwdsUseruserID: TStringField;
xdwdsUserusername: TStringField;
xdwdsUseremail_address: TStringField;
xdwdsUserQBID: TStringField;
xdwdsUserAType: TStringField;
xdwdsUserfull_name: TStringField;
procedure WebFormShow(Sender: TObject); procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
[async] procedure EditUser();
[async] procedure GetUser(); [async] procedure GetUser();
procedure btnCancelClick(Sender: TObject);
end; end;
var var
...@@ -46,77 +51,9 @@ uses ...@@ -46,77 +51,9 @@ uses
{$R *.dfm} {$R *.dfm}
procedure TFViewUserProfile.btnConfirmClick(Sender: TObject);
var
FormEl: TJSHTMLFormElement;
begin
FormEl := TJSHTMLFormElement(document.querySelector('form'));
ShowConfirmationModal(
'Are you sure you want to save changes to your profile?',
'Save',
'Cancel',
procedure(confirmed: Boolean)
begin
if confirmed then
EditUser;
end
);
end;
[async] procedure TFViewUserProfile.EditUser;
var
xdcResponse: TXDataClientResponse;
responseString: TJSObject;
editOptions, resultMsg: string;
begin
try
editOptions := '&username=' + edtUsername.Text +
'&fullname=' + edtFullName.Text +
'&email=' + edtEmail.Text;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.EditUser', [editOptions]));
responseString := TJSObject(xdcResponse.Result);
resultMsg := string(responseString['value']);
Utils.ShowToast(resultMsg);
if resultMsg.ToLower.StartsWith('success:') then
FViewMain.ViewOrders('');
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
on E: Exception do
Utils.ShowErrorModal('Unexpected error: ' + E.Message);
end;
end;
procedure TFViewUserProfile.btnCancelClick(Sender: TObject);
begin
ShowConfirmationModal(
'Are you sure you want to cancel all your changes?',
'Yes',
'No',
procedure(confirmed: Boolean)
begin
if confirmed then
begin
GetUser();
ShowToast('Changes discarded', 'danger');
end;
end
);
end;
procedure TFViewUserProfile.WebFormShow(Sender: TObject); procedure TFViewUserProfile.WebFormShow(Sender: TObject);
begin begin
GetUser(); GetUser();
//edtJwt.Text := TJSJSON.stringify(AuthService.TokenPayload);
// View.UserProfile.WebFormShow
chkAdminUser.Checked := SameText(string(AuthService.TokenPayload.Properties['user_admin']), 'true');
end; end;
...@@ -133,11 +70,9 @@ begin ...@@ -133,11 +70,9 @@ begin
userList := TJSObject(xdcResponse.Result); userList := TJSObject(xdcResponse.Result);
data := TJSArray(userList['data']); data := TJSArray(userList['data']);
user := TJSObject(data[0]); user := TJSObject(data[0]);
edtUsername.Text := string(user['username']); console.log(user);
edtFullName.Text := string(user['full_name']); xdwdsUser.SetJsonData(user);
edtEmail.Text := string(user['email_address']); xdwdsUser.Open;
edtUserId.Text := string(user['userID']);
chkAdminUser.Checked := boolean(user['admin']);
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
......
...@@ -140,7 +140,7 @@ begin ...@@ -140,7 +140,7 @@ begin
Rights := cells[7]; Rights := cells[7];
QB := cells[8]; QB := cells[8];
FViewMain.EditUser('Edit', Username.innerText, Password.innerText, FullName.innerText, FViewMain.EditUser('EDIT', Username.innerText, Password.innerText, FullName.innerText,
Status.innerText, Email.innerText, Access.innerText, Status.innerText, Email.innerText, Access.innerText,
Rights.innerText, QB.innerText); Rights.innerText, QB.innerText);
...@@ -343,20 +343,9 @@ begin ...@@ -343,20 +343,9 @@ begin
XDataWebDataSet1QBID.AsString, XDataWebDataSet1rights.AsInteger); XDataWebDataSet1QBID.AsString, XDataWebDataSet1rights.AsInteger);
XDataWebDataSet1.Next; XDataWebDataSet1.Next;
end; end;
TotalPages := (userListLength + PageSize - 1) div PageSize;
if (PageNumber * PageSize) < userListLength then
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(userListLength);
end
else
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(userListLength) + ' - ' + IntToStr(userListLength) +
' of ' + IntToStr(userListLength); ' of ' + IntToStr(userListLength);
end;
GeneratePagination(TotalPages);
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
...@@ -453,7 +442,7 @@ end; ...@@ -453,7 +442,7 @@ end;
procedure TFViewUsers.btnAddUserClick(Sender: TObject); procedure TFViewUsers.btnAddUserClick(Sender: TObject);
begin begin
//Info := ''; //Info := '';
FViewMain.EditUser('Add', '', '', '', '', '', '', '', ''); FViewMain.EditUser('ADD', '', '', '', '', '', '', '', '');
end; end;
......
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
background-color: #fff; background-color: #fff;
} }
.tbl-min-120 {
min-width: 120px;
}
input[type="text"] { input[type="text"] {
min-width: 50px; min-width: 50px;
max-width: 100%; max-width: 100%;
......
...@@ -16,20 +16,20 @@ uses ...@@ -16,20 +16,20 @@ uses
View.Main in 'View.Main.pas' {FViewMain: TWebForm} {*.html}, View.Main in 'View.Main.pas' {FViewMain: TWebForm} {*.html},
View.Home in 'View.Home.pas' {FViewHome: TWebForm} {*.html}, View.Home in 'View.Home.pas' {FViewHome: TWebForm} {*.html},
View.Users in 'View.Users.pas' {FViewUsers: TWebForm} {*.html}, View.Users in 'View.Users.pas' {FViewUsers: TWebForm} {*.html},
View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html}, View.User.Add in 'View.User.Add.pas' {FViewEditUser: TWebForm} {*.html},
View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html}, View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html},
View.OrderEntryCorrugated in 'View.OrderEntryCorrugated.pas' {FOrderEntryCorrugated: TWebForm} {*.html}, View.OrderEntryCorrugated in 'View.OrderEntryCorrugated.pas' {FOrderEntryCorrugated: TWebForm} {*.html},
View.AddOrder in 'View.AddOrder.pas' {FAddOrder: TWebForm} {*.html}, View.Order.Add in 'View.Order.Add.pas' {FAddOrder: TWebForm} {*.html},
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}, View.Customers in 'View.Customers.pas' {FViewCustomers: TWebForm} {*.html},
AddCustomer in 'AddCustomer.pas' {FViewAddCustomer: TWebForm} {*.html}, View.Customer.Add in 'View.Customer.Add.pas' {FViewAddCustomer: TWebForm} {*.html},
View.AddAddress in 'View.AddAddress.pas' {FViewAddAddress: TWebForm} {*.html}, View.Address.Add in 'View.Address.Add.pas' {FViewAddAddress: TWebForm} {*.html},
View.SelectCustomer in 'View.SelectCustomer.pas' {FSelectCustomer: TWebForm} {*.html}, View.Customer.Select in 'View.Customer.Select.pas' {FSelectCustomer: TWebForm} {*.html},
Utils in 'Utils.pas', Utils in 'Utils.pas',
View.AddItem in 'View.AddItem.pas' {fViewAddItem: TWebForm} {*.html}; View.Item.Add in 'View.Item.Add.pas' {fViewAddItem: TWebForm} {*.html};
{$R *.res} {$R *.res}
......
...@@ -159,7 +159,7 @@ ...@@ -159,7 +159,7 @@
<Form>FViewUsers</Form> <Form>FViewUsers</Form>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="View.EditUser.pas"> <DCCReference Include="View.User.Add.pas">
<Form>FViewEditUser</Form> <Form>FViewEditUser</Form>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
<Form>FOrderEntryCorrugated</Form> <Form>FOrderEntryCorrugated</Form>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="View.AddOrder.pas"> <DCCReference Include="View.Order.Add.pas">
<Form>FAddOrder</Form> <Form>FAddOrder</Form>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
...@@ -196,23 +196,23 @@ ...@@ -196,23 +196,23 @@
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="AddCustomer.pas"> <DCCReference Include="View.Customer.Add.pas">
<Form>FViewAddCustomer</Form> <Form>FViewAddCustomer</Form>
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="View.AddAddress.pas"> <DCCReference Include="View.Address.Add.pas">
<Form>FViewAddAddress</Form> <Form>FViewAddAddress</Form>
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="View.SelectCustomer.pas"> <DCCReference Include="View.Customer.Select.pas">
<Form>FSelectCustomer</Form> <Form>FSelectCustomer</Form>
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="Utils.pas"/> <DCCReference Include="Utils.pas"/>
<DCCReference Include="View.AddItem.pas"> <DCCReference Include="View.Item.Add.pas">
<Form>fViewAddItem</Form> <Form>fViewAddItem</Form>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
......
...@@ -10,6 +10,45 @@ object AuthDatabase: TAuthDatabase ...@@ -10,6 +10,45 @@ object AuthDatabase: TAuthDatabase
FetchRows = 100 FetchRows = 100
Left = 162 Left = 162
Top = 45 Top = 45
object uqUSER_ID: TIntegerField
FieldName = 'USER_ID'
end
object uqUSER_NAME: TStringField
FieldName = 'USER_NAME'
Required = True
Size = 56
end
object uqPASSWORD: TStringField
FieldName = 'PASSWORD'
Size = 128
end
object uqNAME: TStringField
FieldName = 'NAME'
Size = 40
end
object uqSTATUS: TStringField
FieldName = 'STATUS'
Size = 7
end
object uqEMAIL: TStringField
FieldName = 'EMAIL'
Size = 50
end
object uqACCESS_TYPE: TStringField
FieldName = 'ACCESS_TYPE'
Size = 5
end
object uqSYSTEM_RIGHTS: TIntegerField
FieldName = 'SYSTEM_RIGHTS'
end
object uqPERSPECTIVE_ID: TStringField
FieldName = 'PERSPECTIVE_ID'
Size = 128
end
object uqQB_ID: TStringField
FieldName = 'QB_ID'
Size = 45
end
end end
object uqMisc: TUniQuery object uqMisc: TUniQuery
FetchRows = 100 FetchRows = 100
...@@ -18,6 +57,7 @@ object AuthDatabase: TAuthDatabase ...@@ -18,6 +57,7 @@ object AuthDatabase: TAuthDatabase
end end
object ucKG: TUniConnection object ucKG: TUniConnection
ProviderName = 'MySQL' ProviderName = 'MySQL'
Database = 'kg_order_entry'
LoginPrompt = False LoginPrompt = False
Left = 67 Left = 67
Top = 131 Top = 131
......
...@@ -14,6 +14,16 @@ type ...@@ -14,6 +14,16 @@ type
uqMisc: TUniQuery; uqMisc: TUniQuery;
ucKG: TUniConnection; ucKG: TUniConnection;
MySQLUniProvider1: TMySQLUniProvider; MySQLUniProvider1: TMySQLUniProvider;
uqUSER_ID: TIntegerField;
uqUSER_NAME: TStringField;
uqPASSWORD: TStringField;
uqNAME: TStringField;
uqSTATUS: TStringField;
uqEMAIL: TStringField;
uqACCESS_TYPE: TStringField;
uqSYSTEM_RIGHTS: TIntegerField;
uqPERSPECTIVE_ID: TStringField;
uqQB_ID: TStringField;
procedure DataModuleCreate(Sender: TObject); procedure DataModuleCreate(Sender: TObject);
procedure DataModuleDestroy(Sender: TObject); procedure DataModuleDestroy(Sender: TObject);
private private
......
...@@ -17,23 +17,13 @@ type ...@@ -17,23 +17,13 @@ type
TAuthService = class(TInterfacedObject, IAuthService) TAuthService = class(TInterfacedObject, IAuthService)
strict private strict private
authDB: TAuthDatabase; authDB: TAuthDatabase;
function GetQuery: TUniQuery;
private private
userName: string;
userFullName: string;
userId: string;
userPerspectiveID: string;
userQBID: string;
userAccessType: string;
userEmail: string;
userStatus: string;
qbEnabled: boolean;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
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(ClientVersion: string): TJSONObject; function VerifyVersion(ClientVersion: string): TJSONObject;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
end; end;
implementation implementation
...@@ -72,11 +62,6 @@ begin ...@@ -72,11 +62,6 @@ begin
inherited; inherited;
end; end;
function TAuthService.GetQuery: TUniQuery;
begin
Result := authDB.uq;
end;
function TAuthService.VerifyVersion(ClientVersion: string): TJSONObject; function TAuthService.VerifyVersion(ClientVersion: string): TJSONObject;
var var
iniFile: TIniFile; iniFile: TIniFile;
...@@ -89,7 +74,6 @@ begin ...@@ -89,7 +74,6 @@ begin
try try
webClientVersion := iniFile.ReadString('Settings', 'webClientVersion', ''); webClientVersion := iniFile.ReadString('Settings', 'webClientVersion', '');
Result.AddPair('webClientVersion', webClientVersion); Result.AddPair('webClientVersion', webClientVersion);
qbEnabled := iniFile.ReadBool('Quickbooks', 'Enabled', false);
if webClientVersion = '' then if webClientVersion = '' then
begin begin
...@@ -98,9 +82,13 @@ begin ...@@ -98,9 +82,13 @@ begin
end; end;
if clientVersion <> webClientVersion then if clientVersion <> webClientVersion then
begin begin
//Result.AddPair('error',
//'Your browser is running version' + webClientVersion + ' when it should be running ' +
//clientVersion + sLineBreak + 'Please click below to reload.');
Result.AddPair('error', Result.AddPair('error',
'Your browser is running an old version of the app.' + sLineBreak + 'Version mismatch' + sLineBreak + ' Client version: ' + clientVersion +
'Please click below to reload.'); sLineBreak + ' Server version: ' + webClientVersion +
sLineBreak + 'Please click button to clear cache and reload.');
end; end;
finally finally
iniFile.Free; iniFile.Free;
...@@ -113,10 +101,9 @@ var ...@@ -113,10 +101,9 @@ var
userState: Integer; userState: Integer;
iniFile: TIniFile; iniFile: TIniFile;
JWT: TJWT; JWT: TJWT;
qbEnabled: boolean;
begin begin
Logger.Log(3, Format( 'AuthService.Login - User: "%s"', [User])); Logger.Log(3, Format( 'AuthService.Login - User: "%s"', [User]));
userState := CheckUser( user, password );
try try
userState := CheckUser(user, password); userState := CheckUser(user, password);
except except
...@@ -129,18 +116,18 @@ begin ...@@ -129,18 +116,18 @@ begin
if userState = 0 then if userState = 0 then
begin begin
raise EXDataHttpUnauthorized.Create('Invalid username or password');
logger.Log(2, 'Login Error: Invalid username or password'); logger.Log(2, 'Login Error: Invalid username or password');
raise EXDataHttpUnauthorized.Create('Invalid username or password');
end end
else if userState = 1 then else if userState = 1 then
begin begin
raise EXDataHttpUnauthorized.Create('User does not exist!');
logger.Log(2, 'Login Error: User does not exist!'); logger.Log(2, 'Login Error: User does not exist!');
raise EXDataHttpUnauthorized.Create('User does not exist!');
end end
else if userState = 2 then else if userState = 2 then
begin begin
raise EXDataHttpUnauthorized.Create('User not active!');
logger.Log(2, 'Login Error: User not active!'); logger.Log(2, 'Login Error: User not active!');
raise EXDataHttpUnauthorized.Create('User not active!');
end; end;
...@@ -156,14 +143,13 @@ begin ...@@ -156,14 +143,13 @@ begin
JWT.Claims.JWTId := LowerCase(Copy(TUtils.GuidToVariant(TUtils.NewGuid), 2, 36)); JWT.Claims.JWTId := LowerCase(Copy(TUtils.GuidToVariant(TUtils.NewGuid), 2, 36));
JWT.Claims.IssuedAt := Now; JWT.Claims.IssuedAt := Now;
JWT.Claims.Expiration := IncHour(Now, 24); JWT.Claims.Expiration := IncHour(Now, 24);
JWT.Claims.SetClaimOfType<string>('user_name', userName); JWT.Claims.SetClaimOfType<string>('user_name', authDB.uq.FieldByName('USER_NAME').AsString);
JWT.Claims.SetClaimOfType<string>('user_fullname', userFullName); JWT.Claims.SetClaimOfType<string>('user_fullname', authDB.uq.FieldByName('NAME').AsString);
JWT.Claims.SetClaimOfType<string>('user_id', userId); JWT.Claims.SetClaimOfType<string>('user_id', authDB.uq.FieldByName('USER_ID').AsString);
JWT.Claims.SetClaimOfType<string>('user_perspective_id', userPerspectiveID); JWT.Claims.SetClaimOfType<string>('user_status', authDB.uq.FieldByName('STATUS').AsString);
JWT.Claims.SetClaimOfType<string>('user_status', userStatus); JWT.Claims.SetClaimOfType<string>('user_email', authDB.uq.FieldByName('EMAIL').AsString);
JWT.Claims.SetClaimOfType<string>('user_email', userEmail); JWT.Claims.SetClaimOfType<string>('user_qb_id', authDB.uq.FieldByName('QB_ID').AsString);
JWT.Claims.SetClaimOfType<string>('user_qb_id', userQBID); JWT.Claims.SetClaimOfType<string>('user_access_type', authDB.uq.FieldByName('ACCESS_TYPE').AsString);
JWT.Claims.SetClaimOfType<string>('user_access_type', userAccessType);
JWT.Claims.SetClaimOfType<boolean>('qb_enabled', qbEnabled); JWT.Claims.SetClaimOfType<boolean>('qb_enabled', qbEnabled);
Result := TJOSE.SHA256CompactToken(serverConfig.jwtTokenSecret, JWT); Result := TJOSE.SHA256CompactToken(serverConfig.jwtTokenSecret, JWT);
...@@ -174,12 +160,10 @@ end; ...@@ -174,12 +160,10 @@ end;
function TAuthService.CheckUser(const user, password: string): Integer; function TAuthService.CheckUser(const user, password: string): Integer;
var var
userStr: string;
SQL: string; SQL: string;
name: string; name: string;
checkString: string; checkString: string;
begin begin
Result := 0;
Logger.Log(1, Format('AuthService.CheckUser - User: "%s"', [user]) ); Logger.Log(1, Format('AuthService.CheckUser - User: "%s"', [user]) );
SQL := 'select * from users where USER_NAME = ' + QuotedStr(user); SQL := 'select * from users where USER_NAME = ' + QuotedStr(user);
DoQuery(authDB.uq, SQL); DoQuery(authDB.uq, SQL);
...@@ -193,22 +177,13 @@ begin ...@@ -193,22 +177,13 @@ begin
begin begin
name := authDB.uq.FieldByName('NAME').AsString; name := authDB.uq.FieldByName('NAME').AsString;
checkString := THashSHA2.GetHashString(name + password, THashSHA2.TSHA2Version.SHA512).ToUpper; checkString := THashSHA2.GetHashString(name + password, THashSHA2.TSHA2Version.SHA512).ToUpper;
if authDB.uq.FieldByName('PASSWORD').AsString = checkString then if authDB.uq.FieldByName('PASSWORD').AsString = checkstring then
begin begin
userName := user;
userFullName:= authDB.uq.FieldByName('NAME').AsString;;
userId := authDB.uq.FieldByName('USER_ID').AsString;
userStatus := authDB.uq.FieldByName('STATUS').AsString;
userPerspectiveID := authDB.uq.FieldByName('PERSPECTIVE_ID').AsString;
userEmail := authDB.uq.FieldByName('EMAIL').AsString;
userQBID := authDB.uq.FieldByName('QB_ID').AsString;
userAccessType := authDB.uq.FieldByName('ACCESS_TYPE').AsString;
Logger.Log(1, Format('AuthDB.SetLoginAuditEntry: "%s"', [user]) ); Logger.Log(1, Format('AuthDB.SetLoginAuditEntry: "%s"', [user]) );
Result := 3; // Succcess Result := 3; // Succcess
end end
else else
Result := 0; // invalid password Result := 0; // invalid user or password
end; end;
end; end;
......
...@@ -64,6 +64,13 @@ begin ...@@ -64,6 +64,13 @@ begin
Logger.Log(1, '-- jwtTokenSecret: ' + serverConfig.jwtTokenSecret + IfThen(serverConfig.jwtTokenSecret = 'super_secret0123super_secret4567', ' [default]', ' [from config]')); Logger.Log(1, '-- jwtTokenSecret: ' + serverConfig.jwtTokenSecret + IfThen(serverConfig.jwtTokenSecret = 'super_secret0123super_secret4567', ' [default]', ' [from config]'));
Logger.Log(1, '-- webAppFolder: ' + serverConfig.webAppFolder + IfThen(serverConfig.webAppFolder = 'static', ' [default]', ' [from config]')); Logger.Log(1, '-- webAppFolder: ' + serverConfig.webAppFolder + IfThen(serverConfig.webAppFolder = 'static', ' [default]', ' [from config]'));
Logger.Log(1, '-- serverConfig.reportsFolder: ' + serverConfig.reportsFolder); Logger.Log(1, '-- serverConfig.reportsFolder: ' + serverConfig.reportsFolder);
if not DirectoryExists(serverConfig.reportsFolder + 'reports\') then
begin
ForceDirectories(serverConfig.reportsFolder + 'reports\');
Logger.Log(1, '-- Reports directory created: ' + serverConfig.reportsFolder + 'reports\');
end;
Logger.Log(1, '--LoadServerConfig - end'); Logger.Log(1, '--LoadServerConfig - end');
end; end;
...@@ -78,7 +85,8 @@ begin ...@@ -78,7 +85,8 @@ begin
adminPassword := 'whatisthisusedfor'; adminPassword := 'whatisthisusedfor';
jwtTokenSecret := 'super_secret0123super_secret4567'; jwtTokenSecret := 'super_secret0123super_secret4567';
webAppFolder := 'static'; webAppFolder := 'static';
reportsFolder := 'static/'; reportsFolder := 'static\';
ServerConfigStr := Bcl.Json.TJson.Serialize(ServerConfig); ServerConfigStr := Bcl.Json.TJson.Serialize(ServerConfig);
Logger.Log(1, '--ServerConfigSerialize: ' + ServerConfigStr); Logger.Log(1, '--ServerConfigSerialize: ' + ServerConfigStr);
Logger.Log(1, '--TServerConfig.Create - end'); Logger.Log(1, '--TServerConfig.Create - end');
......
...@@ -43,8 +43,6 @@ object FData: TFData ...@@ -43,8 +43,6 @@ object FData: TFData
Lines.Strings = ( Lines.Strings = (
'Memo1') 'Memo1')
TabOrder = 1 TabOrder = 1
ExplicitLeft = -2
ExplicitTop = 435
end end
object DBAdvGrid1: TDBAdvGrid object DBAdvGrid1: TDBAdvGrid
Left = 6 Left = 6
...@@ -174,7 +172,7 @@ object FData: TFData ...@@ -174,7 +172,7 @@ object FData: TFData
SortSettings.HeaderColorTo = clWhite SortSettings.HeaderColorTo = clWhite
SortSettings.HeaderMirrorColor = clWhite SortSettings.HeaderMirrorColor = clWhite
SortSettings.HeaderMirrorColorTo = clWhite SortSettings.HeaderMirrorColorTo = clWhite
Version = '2.8.3.3' Version = '2.8.3.8'
AutoCreateColumns = True AutoCreateColumns = True
AutoRemoveColumns = True AutoRemoveColumns = True
Columns = < Columns = <
...@@ -755,7 +753,7 @@ object FData: TFData ...@@ -755,7 +753,7 @@ object FData: TFData
SortSettings.HeaderColorTo = clWhite SortSettings.HeaderColorTo = clWhite
SortSettings.HeaderMirrorColor = clWhite SortSettings.HeaderMirrorColor = clWhite
SortSettings.HeaderMirrorColorTo = clWhite SortSettings.HeaderMirrorColorTo = clWhite
Version = '2.8.3.3' Version = '2.8.3.8'
AutoCreateColumns = True AutoCreateColumns = True
AutoRemoveColumns = True AutoRemoveColumns = True
Columns = < Columns = <
......
...@@ -130,8 +130,6 @@ type ...@@ -130,8 +130,6 @@ type
procedure Button1Click(Sender: TObject); procedure Button1Click(Sender: TObject);
private private
kgDB: TApiDatabase; kgDB: TApiDatabase;
accountSID: string;
authHeader: string;
public public
procedure RunOrdersReport(searchOptions: string); procedure RunOrdersReport(searchOptions: string);
end; end;
...@@ -190,7 +188,6 @@ procedure TFData.btnFindClick(Sender: TObject); ...@@ -190,7 +188,6 @@ procedure TFData.btnFindClick(Sender: TObject);
// whereSQL: where section of the SQL that is built in the function // whereSQL: where section of the SQL that is built in the function
var var
SQL: string; SQL: string;
whereSQL: string;
begin begin
Memo1.Lines.Add(uqUsers.Connection.Server); Memo1.Lines.Add(uqUsers.Connection.Server);
SQL := 'select * from users'; SQL := 'select * from users';
......
...@@ -127,15 +127,15 @@ begin ...@@ -127,15 +127,15 @@ begin
Logger.Log(1, '--- Settings ---'); Logger.Log(1, '--- Settings ---');
iniStr := iniFile.ReadString( 'Settings', 'MemoLogLevel', '' ); iniStr := iniFile.ReadString( 'Settings', 'MemoLogLevel', '' );
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, '--Settings->memoLogLevel: Entry not found - default: 3' ) Logger.Log( 1, '--Settings->MemoLogLevel: Entry not found - default: 3' )
else else
Logger.Log( 1, '--Settings->memoLogLevel: ' + iniStr ); Logger.Log( 1, '--Settings->MemoLogLevel: ' + iniStr );
iniStr := iniFile.ReadString( 'Settings', 'FileLogLevel', '' ); iniStr := iniFile.ReadString( 'Settings', 'FileLogLevel', '' );
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, '--Settings->fileLogLevel: Entry not found - default: 4' ) Logger.Log( 1, '--Settings->FileLogLevel: Entry not found - default: 4' )
else else
Logger.Log( 1, '--Settings->fileLogLevel: ' + iniStr ); Logger.Log( 1, '--Settings->FileLogLevel: ' + iniStr );
Logger.Log( 1, '' ); Logger.Log( 1, '' );
iniStr := iniFile.ReadString( 'Settings', 'LogFileNum', '' ); iniStr := iniFile.ReadString( 'Settings', 'LogFileNum', '' );
...@@ -144,6 +144,12 @@ begin ...@@ -144,6 +144,12 @@ begin
else else
Logger.Log( 1, '--Settings->LogFileNum: ' + IntToStr(StrToInt(iniStr) - 1) ); Logger.Log( 1, '--Settings->LogFileNum: ' + IntToStr(StrToInt(iniStr) - 1) );
iniStr := iniFile.ReadString( 'Settings', 'WebClientVersion', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Settings->WebClientVersion: Entry not found - ERROR: ini entry required!!!')
else
Logger.Log( 1, '--Settings->WebClientVersion: ' + iniStr );
Logger.Log(1, '--- Database ---'); Logger.Log(1, '--- Database ---');
iniStr := IniFile.ReadString( 'Database', 'Server', '' ); iniStr := IniFile.ReadString( 'Database', 'Server', '' );
if iniStr.IsEmpty then if iniStr.IsEmpty then
...@@ -180,37 +186,37 @@ begin ...@@ -180,37 +186,37 @@ begin
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->CompanyID: Entry not found' ) Logger.Log( 1, '--Quickbooks->CompanyID: Entry not found' )
else else
Logger.Log( 1, '--Quickbooks->CompanyID: ' + 'Entry found' ); Logger.Log( 1, '--Quickbooks->CompanyID: Entry found' );
iniStr := IniFile.ReadString( 'Quickbooks', 'ClientID', '' ); iniStr := IniFile.ReadString( 'Quickbooks', 'ClientID', '' );
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->ClientID: Entry not found' ) Logger.Log( 1, '--Quickbooks->ClientID: Entry not found' )
else else
Logger.Log( 1, '--Quickbooks->ClientID: ' + 'Entry found' ); Logger.Log( 1, '--Quickbooks->ClientID: Entry found' );
iniStr := IniFile.ReadString( 'Quickbooks', 'ClientSecret', '' ); iniStr := IniFile.ReadString( 'Quickbooks', 'ClientSecret', '' );
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->ClientSecret: Entry not found' ) Logger.Log( 1, '--Quickbooks->ClientSecret: Entry not found' )
else else
Logger.Log( 1, '--Quickbooks->ClientSecret: ' + 'Entry found' ); Logger.Log( 1, '--Quickbooks->ClientSecret: Entry found' );
iniStr := IniFile.ReadString( 'Quickbooks', 'RefreshToken', '' ); iniStr := IniFile.ReadString( 'Quickbooks', 'RefreshToken', '' );
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->RefreshToken: Entry not found' ) Logger.Log( 1, '--Quickbooks->RefreshToken: Entry not found' )
else else
Logger.Log( 1, '--Quickbooks->RefreshToken: ' + 'Entry found' ); Logger.Log( 1, '--Quickbooks->RefreshToken: Entry found' );
iniStr := IniFile.ReadString( 'Quickbooks', 'AccessToken', '' ); iniStr := IniFile.ReadString( 'Quickbooks', 'AccessToken', '' );
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->AccessToken: Entry not found' ) Logger.Log( 1, '--Quickbooks->AccessToken: Entry not found' )
else else
Logger.Log( 1, '--Quickbooks->AccessToken: ' + 'Entry found' ); Logger.Log( 1, '--Quickbooks->AccessToken: Entry found' );
iniStr := IniFile.ReadString( 'Quickbooks', 'LastRefresh', '' ); iniStr := IniFile.ReadString( 'Quickbooks', 'LastRefresh', '' );
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->LastRefresh: Entry not found' ) Logger.Log( 1, '--Quickbooks->LastRefresh: Entry not found' )
else else
Logger.Log( 1, '--Quickbooks->LastRefresh: ' + iniStr ); Logger.Log( 1, '--Quickbooks->LastRefresh: Entry Found' );
Logger.Log( 1, '' ); Logger.Log( 1, '' );
finally finally
......
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;
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
Exit();
end;
EncodedAuth := Encoder.Encode(Client + ':' + Secret);
if RefreshToken = '' then
begin
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
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;
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;
iniFile: TIniFile;
begin
iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
try
iniFile.WriteString('Quickbooks', 'RefreshToken', RefreshToken);
LastRefresh := Now;
finally
IniFile.Free;
end;
f := TStringList.Create;
// Save to file (overwrites existing file)
f.SaveToFile('QB.txt');
f.Free;
end;
initialization
RegisterServiceType(TQBService);
end.
...@@ -5,7 +5,7 @@ interface ...@@ -5,7 +5,7 @@ interface
uses uses
System.SysUtils, System.Classes, Data.DB, MemDS, DBAccess, Uni, Common.Logging, System.SysUtils, System.Classes, Data.DB, MemDS, DBAccess, Uni, Common.Logging,
frxClass, frxExportBaseDialog, frxExportPDF, frCoreClasses, frxDBSet, JS, JSON, frxClass, frxExportBaseDialog, frxExportPDF, frCoreClasses, frxDBSet, JS, JSON,
frxTableObject, frxUtils; frxTableObject, frxUtils, System.Generics.Collections;
type type
TrptOrderCorrugated = class(TDataModule) TrptOrderCorrugated = class(TDataModule)
...@@ -133,7 +133,7 @@ implementation ...@@ -133,7 +133,7 @@ implementation
{$R *.dfm} {$R *.dfm}
uses uses
uLibrary, Common.Config; uLibrary, Common.Config, XData.Sys.Exceptions;
procedure TrptOrderCorrugated.DataModuleCreate(Sender: TObject); procedure TrptOrderCorrugated.DataModuleCreate(Sender: TObject);
begin begin
...@@ -156,8 +156,7 @@ var ...@@ -156,8 +156,7 @@ var
colorArray: TJSONArray; colorArray: TJSONArray;
colorsObject, colorObject: TJSONObject; colorsObject, colorObject: TJSONObject;
colorsString: string; colorsString: string;
i, rowIndex: Integer; i: Integer;
temp: TObject;
begin begin
logger.Log(5, 'Adding Color Rows'); logger.Log(5, 'Adding Color Rows');
...@@ -181,31 +180,13 @@ end; ...@@ -181,31 +180,13 @@ end;
function TrptOrderCorrugated.PrepareReport(SQL: string): string; function TrptOrderCorrugated.PrepareReport(SQL: string): string;
var
orderList : TJSObject;
i: integer;
data: TJSArray;
order: TJSObject;
callListLength: integer;
tempString, strColorList: string;
colorObject: TJSONObject;
colorList: TJSArray;
colorLength: integer;
color: TJSObject;
colorJSON: TJSONObject;
colorListJSON: TJSONArray;
items: TJSObject;
begin begin
Logger.Log(5, 'Generated SQL for Prepare Report: ' + SQL); Logger.Log(5, 'Generated SQL for Prepare Report: ' + SQL);
doQuery(uqOrderCorrugated, SQL); doQuery(uqOrderCorrugated, SQL);
if ( string( uqOrderCorrugated.FieldByName('colors_colors').AsString ) ) <> '' then if ( string( uqOrderCorrugated.FieldByName('colors_colors').AsString ) ) <> '' then
begin begin
PopulateColorTable(); PopulateColorTable();
end; end;
result := GeneratePDF; result := GeneratePDF;
Logger.Log(5, 'Report preparation complete.'); Logger.Log(5, 'Report preparation complete.');
...@@ -219,12 +200,6 @@ var ...@@ -219,12 +200,6 @@ var
begin begin
ReportDir := ServerConfig.reportsFolder; ReportDir := ServerConfig.reportsFolder;
if not DirectoryExists(ReportDir) then
begin
ForceDirectories(ReportDir);
Logger.Log(1, 'Reports directory created: ' + ReportDir);
end;
reportURL := 'reports/' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf'; reportURL := 'reports/' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf';
ReportFileName := reportDir + reportUrl; ReportFileName := reportDir + reportUrl;
...@@ -235,10 +210,13 @@ begin ...@@ -235,10 +210,13 @@ begin
frxOrderCorrugated.PrepareReport; frxOrderCorrugated.PrepareReport;
frxOrderCorrugated.Export(frxPDFExport1); frxOrderCorrugated.Export(frxPDFExport1);
//frxOrders.ShowPreparedReport; //frxOrders.ShowPreparedReport;
finally finally
frxOrderCorrugated.Clear; // Clears the report to avoid memory bloat frxOrderCorrugated.Clear; // Clears the report to avoid memory bloat
end; end;
Logger.Log(5, 'PDF saved to: ' + ReportFileName); Logger.Log(5, 'PDF saved to: ' + ReportFileName);
result := reportURL; result := reportURL;
end; end;
......
...@@ -60,7 +60,7 @@ var ...@@ -60,7 +60,7 @@ var
implementation implementation
uses uses
uLibrary, Common.Config; uLibrary, Common.Config, XData.Sys.Exceptions;
{%CLASSGROUP 'Vcl.Controls.TControl'} {%CLASSGROUP 'Vcl.Controls.TControl'}
...@@ -82,29 +82,11 @@ end; ...@@ -82,29 +82,11 @@ end;
function TrptOrderCutting.PrepareReport(SQL: string): string; function TrptOrderCutting.PrepareReport(SQL: string): string;
var
orderList : TJSObject;
i: integer;
data: TJSArray;
order: TJSObject;
callListLength: integer;
tempString, strColorList: string;
colorObject: TJSONObject;
colorList: TJSArray;
colorLength: integer;
color: TJSObject;
colorJSON: TJSONObject;
colorListJSON: TJSONArray;
items: TJSObject;
begin begin
Logger.Log(3, 'Generated SQL for Prepare Report: ' + SQL); Logger.Log(3, 'Generated SQL for Prepare Report: ' + SQL);
//SQL := 'select * from corrugated_plate_orders where ORDER_ID = 18381';
doQuery(uqOrderCutting, SQL); doQuery(uqOrderCutting, SQL);
result := GeneratePDF; result := GeneratePDF;
Logger.Log(5, 'Report preparation complete.'); Logger.Log(5, 'Report preparation complete.');
end; end;
...@@ -116,11 +98,6 @@ var ...@@ -116,11 +98,6 @@ var
begin begin
ReportDir := ServerConfig.reportsFolder; ReportDir := ServerConfig.reportsFolder;
if not DirectoryExists(ReportDir) then
begin
ForceDirectories(ReportDir);
Logger.Log(1, 'Reports directory created: ' + ReportDir);
end;
reportURL := 'reports\' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf'; reportURL := 'reports\' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf';
ReportFileName := reportDir + reportUrl; ReportFileName := reportDir + reportUrl;
......
...@@ -3,7 +3,7 @@ object rptOrderList: TrptOrderList ...@@ -3,7 +3,7 @@ object rptOrderList: TrptOrderList
Height = 480 Height = 480
Width = 640 Width = 640
object frxOrderList: TfrxReport object frxOrderList: TfrxReport
Version = '2025.1.4' Version = '2025.2.4'
DotMatrixReport = False DotMatrixReport = False
IniFile = '\Software\Fast Reports' IniFile = '\Software\Fast Reports'
PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick, pbCopy, pbSelection] PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick, pbCopy, pbSelection]
...@@ -26,6 +26,7 @@ object rptOrderList: TrptOrderList ...@@ -26,6 +26,7 @@ object rptOrderList: TrptOrderList
end> end>
Variables = <> Variables = <>
Style = <> Style = <>
Watermarks = <>
object Data: TfrxDataPage object Data: TfrxDataPage
Height = 1000.000000000000000000 Height = 1000.000000000000000000
Width = 1000.000000000000000000 Width = 1000.000000000000000000
...@@ -1065,6 +1066,7 @@ object rptOrderList: TrptOrderList ...@@ -1065,6 +1066,7 @@ object rptOrderList: TrptOrderList
PdfA = False PdfA = False
PDFStandard = psNone PDFStandard = psNone
PDFVersion = pv17 PDFVersion = pv17
PDFColorSpace = csDeviceRGB
Left = 288 Left = 288
Top = 166 Top = 166
end end
......
...@@ -59,7 +59,7 @@ var ...@@ -59,7 +59,7 @@ var
implementation implementation
uses uses
uLibrary, Common.Config; uLibrary, Common.Config, XData.Sys.Exceptions;
{%CLASSGROUP 'Vcl.Controls.TControl'} {%CLASSGROUP 'Vcl.Controls.TControl'}
...@@ -83,9 +83,7 @@ end; ...@@ -83,9 +83,7 @@ end;
function TrptOrderList.PrepareReport(SQL, CompanyName: string): string; function TrptOrderList.PrepareReport(SQL, CompanyName: string): string;
var var
memo: TFrxMemoView; memo: TFrxMemoView;
temp: TDateTime;
DateFormat: TFormatSettings; DateFormat: TFormatSettings;
tempStr: string;
begin begin
Logger.Log(5, 'Generated SQL for Prepare Report: ' + SQL); Logger.Log(5, 'Generated SQL for Prepare Report: ' + SQL);
...@@ -103,9 +101,6 @@ begin ...@@ -103,9 +101,6 @@ begin
DateFormat.TimeSeparator := ':'; DateFormat.TimeSeparator := ':';
DateFormat.ShortTimeFormat := 'HH:nn'; DateFormat.ShortTimeFormat := 'HH:nn';
tempStr := FormatDateTime('m/d/yyyy HH:nn', uqOrdersORDER_DATE.AsDateTime);
temp := StrToDateTime(FormatDateTime('m/d/yyyy HH:nn', uqOrdersORDER_DATE.AsDateTime), DateFormat);
uqOrdersORDER_DATE.AsDateTime := RecodeSecond(uqOrdersORDER_DATE.AsDateTime, 0); uqOrdersORDER_DATE.AsDateTime := RecodeSecond(uqOrdersORDER_DATE.AsDateTime, 0);
uqOrders.Post; uqOrders.Post;
...@@ -206,11 +201,6 @@ var ...@@ -206,11 +201,6 @@ var
begin begin
ReportDir := ServerConfig.reportsFolder; ReportDir := ServerConfig.reportsFolder;
if not DirectoryExists(ReportDir) then
begin
ForceDirectories(ReportDir);
Logger.Log(1, 'Reports directory created: ' + ReportDir);
end;
reportURL := 'reports/' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf'; reportURL := 'reports/' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf';
ReportFileName := reportDir + reportUrl; ReportFileName := reportDir + reportUrl;
......
...@@ -5,7 +5,7 @@ interface ...@@ -5,7 +5,7 @@ interface
uses uses
System.SysUtils, System.Classes, Data.DB, MemDS, DBAccess, Uni, Common.Logging, System.SysUtils, System.Classes, Data.DB, MemDS, DBAccess, Uni, Common.Logging,
frxClass, frxExportBaseDialog, frxExportPDF, frCoreClasses, frxDBSet, JS, JSON, frxClass, frxExportBaseDialog, frxExportPDF, frCoreClasses, frxDBSet, JS, JSON,
frxTableObject, frxUtils; frxTableObject, frxUtils, System.Generics.Collections;
type type
TrptOrderWeb = class(TDataModule) TrptOrderWeb = class(TDataModule)
...@@ -132,7 +132,7 @@ implementation ...@@ -132,7 +132,7 @@ implementation
{$R *.dfm} {$R *.dfm}
uses uses
uLibrary, Common.Config; uLibrary, Common.Config, XData.Sys.Exceptions;
procedure TrptOrderWeb.DataModuleCreate(Sender: TObject); procedure TrptOrderWeb.DataModuleCreate(Sender: TObject);
begin begin
...@@ -155,8 +155,7 @@ var ...@@ -155,8 +155,7 @@ var
colorArray: TJSONArray; colorArray: TJSONArray;
colorsObject, colorObject: TJSONObject; colorsObject, colorObject: TJSONObject;
colorsString: string; colorsString: string;
i, rowIndex: Integer; i: Integer;
temp: TObject;
begin begin
logger.Log(5, 'Adding Color Rows'); logger.Log(5, 'Adding Color Rows');
...@@ -180,32 +179,14 @@ end; ...@@ -180,32 +179,14 @@ end;
function TrptOrderWeb.PrepareReport(SQL: string): string; function TrptOrderWeb.PrepareReport(SQL: string): string;
var
orderList : TJSObject;
i: integer;
data: TJSArray;
order: TJSObject;
callListLength: integer;
tempString, strColorList: string;
colorObject: TJSONObject;
colorList: TJSArray;
colorLength: integer;
color: TJSObject;
colorJSON: TJSONObject;
colorListJSON: TJSONArray;
items: TJSObject;
begin begin
Logger.Log(3, 'Generated SQL for Prepare Report: ' + SQL); Logger.Log(3, 'Generated SQL for Prepare Report: ' + SQL);
//SQL := 'select * from corrugated_plate_orders where ORDER_ID = 18381';
doQuery(uqOrderWeb, SQL); doQuery(uqOrderWeb, SQL);
if ( string( uqOrderWeb.FieldByName('quantity_and_colors_qty_colors').AsString ) ) <> '' then if ( string( uqOrderWeb.FieldByName('quantity_and_colors_qty_colors').AsString ) ) <> '' then
begin begin
PopulateColorTable(); PopulateColorTable();
end; end;
result := GeneratePDF; result := GeneratePDF;
Logger.Log(3, 'Report preparation complete.'); Logger.Log(3, 'Report preparation complete.');
...@@ -219,11 +200,6 @@ var ...@@ -219,11 +200,6 @@ var
begin begin
ReportDir := ServerConfig.reportsFolder; ReportDir := ServerConfig.reportsFolder;
if not DirectoryExists(ReportDir) then
begin
ForceDirectories(ReportDir);
Logger.Log(1, 'Reports directory created: ' + ReportDir);
end;
reportURL := 'reports\' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf'; reportURL := 'reports\' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf';
ReportFileName := reportDir + reportUrl; ReportFileName := reportDir + reportUrl;
...@@ -233,7 +209,6 @@ begin ...@@ -233,7 +209,6 @@ begin
try try
frxOrderWeb.PrepareReport; frxOrderWeb.PrepareReport;
frxOrderWeb.Export(frxPDFExport1); frxOrderWeb.Export(frxPDFExport1);
//frxOrderWeb.ShowPreparedReport;
finally finally
frxOrderWeb.Clear; // Clears the report to avoid memory bloat frxOrderWeb.Clear; // Clears the report to avoid memory bloat
end; end;
......
[Settings] [Settings]
MemoLogLevel=4 MemoLogLevel=5
FileLogLevel=4 FileLogLevel=5
webClientVersion=0.9.11 webClientVersion=0.9.11
LogFileNum=164 LogFileNum=205
[Database] [Database]
Server=192.168.116.132 --Server=192.168.116.132
--Server=192.168.102.129 --Server=192.168.102.129
--Server=192.168.75.133 --Server=192.168.75.133
--Server=192.168.159.10 Server=192.168.159.10
--Database=kg_order_entry --Database=kg_order_entry
--Username=root --Username=root
--Password=emsys01 --Password=emsys01
--Password=emsys!012 --Password=emsys!012
[Quickbooks] [Quickbooks]
Enabled=0 --Enabled=1
CompanyID=9341454336461805 CompanyID=9341454336461805
ClientID=ABYqlDx1EsacZYXvHIJ7RDB7zmnQdwABU3fwQLIZPmBgU0VW1P ClientID=ABYqlDx1EsacZYXvHIJ7RDB7zmnQdwABU3fwQLIZPmBgU0VW1P
ClientSecret=PM7OnvQWsgOqjWfDpZAnyRttDN9446Am6d85pDxr ClientSecret=PM7OnvQWsgOqjWfDpZAnyRttDN9446Am6d85pDxr
......
...@@ -26,9 +26,7 @@ uses ...@@ -26,9 +26,7 @@ uses
rOrderCorrugated in 'Source\rOrderCorrugated.pas' {rptOrderCorrugated: TDataModule}, rOrderCorrugated in 'Source\rOrderCorrugated.pas' {rptOrderCorrugated: TDataModule},
rOrderWeb in 'Source\rOrderWeb.pas' {rptOrderWeb: TDataModule}, rOrderWeb in 'Source\rOrderWeb.pas' {rptOrderWeb: TDataModule},
rOrderCutting in 'Source\rOrderCutting.pas' {rptOrderCutting: TDataModule}, rOrderCutting in 'Source\rOrderCutting.pas' {rptOrderCutting: TDataModule},
qbAPI in 'Source\qbAPI.pas' {fQB}, qbAPI in 'Source\qbAPI.pas' {fQB};
QBService in 'Source\QBService.pas',
QBServiceImplementation in 'Source\QBServiceImplementation.pas';
type type
TMemoLogAppender = class( TInterfacedObject, ILogAppender ) TMemoLogAppender = class( TInterfacedObject, ILogAppender )
...@@ -160,8 +158,8 @@ end; ...@@ -160,8 +158,8 @@ end;
var var
iniFile: TIniFile; iniFile: TIniFile;
memoLogLevel: Integer; MemoLogLevel: Integer;
fileLogLevel: Integer; FileLogLevel: Integer;
begin begin
ReportMemoryLeaksOnShutdown := True; ReportMemoryLeaksOnShutdown := True;
...@@ -170,12 +168,12 @@ begin ...@@ -170,12 +168,12 @@ begin
Application.CreateForm(TFMain, FMain); Application.CreateForm(TFMain, FMain);
iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' ); iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
try try
memoLogLevel := iniFile.ReadInteger( 'Settings', 'memoLogLevel', 3 ); MemoLogLevel := iniFile.ReadInteger( 'Settings', 'MemoLogLevel', 3 );
fileLogLevel := iniFile.ReadInteger( 'Settings', 'memoLogLevel', 4 ); FileLogLevel := iniFile.ReadInteger( 'Settings', 'FileLogLevel', 4 );
finally finally
iniFile.Free; iniFile.Free;
end; end;
Logger.AddAppender(TMemoLogAppender.Create( memoLogLevel, FMain.memoinfo )); Logger.AddAppender(TMemoLogAppender.Create( MemoLogLevel, FMain.memoinfo ));
Logger.AddAppender(TFileLogAppender.Create( fileLogLevel, 'kgOrdersServer' )); Logger.AddAppender(TFileLogAppender.Create( FileLogLevel, 'kgOrdersServer' ));
Application.Run; Application.Run;
end. end.
...@@ -208,8 +208,6 @@ ...@@ -208,8 +208,6 @@
<Form>fQB</Form> <Form>fQB</Form>
<FormType>dfm</FormType> <FormType>dfm</FormType>
</DCCReference> </DCCReference>
<DCCReference Include="Source\QBService.pas"/>
<DCCReference Include="Source\QBServiceImplementation.pas"/>
<BuildConfiguration Include="Base"> <BuildConfiguration Include="Base">
<Key>Base</Key> <Key>Base</Key>
</BuildConfiguration> </BuildConfiguration>
...@@ -238,13 +236,13 @@ ...@@ -238,13 +236,13 @@
</Excluded_Packages> </Excluded_Packages>
</Delphi.Personality> </Delphi.Personality>
<Deployment Version="5"> <Deployment Version="5">
<DeployFile LocalName="kgOrdersServer.exe" Configuration="Debug" Class="ProjectOutput"/> <DeployFile LocalName="bin\kgOrdersServer.exe" Configuration="Debug" Class="ProjectOutput">
<DeployFile LocalName="kgOrdersServer.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32"> <Platform Name="Win32">
<RemoteName>kgOrdersServer.exe</RemoteName> <RemoteName>kgOrdersServer.exe</RemoteName>
<Overwrite>true</Overwrite> <Overwrite>true</Overwrite>
</Platform> </Platform>
</DeployFile> </DeployFile>
<DeployFile LocalName="kgOrdersServer.exe" Configuration="Debug" Class="ProjectOutput"/>
<DeployClass Name="AdditionalDebugSymbols"> <DeployClass Name="AdditionalDebugSymbols">
<Platform Name="iOSSimulator"> <Platform Name="iOSSimulator">
<Operation>1</Operation> <Operation>1</Operation>
......
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