Commit 2412e6a9 by emsys

Finished Item Page Changes. Cannot test one feature due to deployed version

cant interfere with deployed version's access token so this cannot be tested right now
parent 36545ef4
...@@ -9,10 +9,9 @@ object FViewItems: TFViewItems ...@@ -9,10 +9,9 @@ object FViewItems: TFViewItems
Font.Name = 'Tahoma' Font.Name = 'Tahoma'
Font.Style = [] Font.Style = []
ParentFont = False ParentFont = False
OnCreate = WebFormCreate
object lblEntries: TWebLabel object lblEntries: TWebLabel
Left = 0 Left = 16
Top = 336 Top = 292
Width = 77 Width = 77
Height = 13 Height = 13
Caption = 'Showing 0 of ...' Caption = 'Showing 0 of ...'
...@@ -42,8 +41,8 @@ object FViewItems: TFViewItems ...@@ -42,8 +41,8 @@ object FViewItems: TFViewItems
'50') '50')
end end
object btnAdd: TWebButton object btnAdd: TWebButton
Left = 565 Left = 567
Top = 318 Top = 442
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Add' Caption = 'Add'
...@@ -55,50 +54,9 @@ object FViewItems: TFViewItems ...@@ -55,50 +54,9 @@ object FViewItems: TFViewItems
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnAddClick OnClick = btnAddClick
end end
object edtName: TWebEdit
Left = 342
Top = 0
Width = 121
Height = 22
ChildOrder = 10
ElementClassName = 'form-control'
ElementID = 'edtname'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtDescription: TWebEdit
Left = 478
Top = 0
Width = 121
Height = 22
ChildOrder = 10
ElementClassName = 'form-control'
ElementID = 'edtdescription'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbStatus: TWebCheckBox
Left = 354
Top = 52
Width = 113
Height = 22
ChildOrder = 5
ElementClassName = 'custom-control custom-checkbox'
ElementButtonClassName = 'custom-control-input'
ElementLabelClassName = 'custom-control-label'
ElementID = 'cbstatus'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnSave: TWebButton object btnSave: TWebButton
Left = 565 Left = 567
Top = 228 Top = 352
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Save' Caption = 'Save'
...@@ -114,8 +72,8 @@ object FViewItems: TFViewItems ...@@ -114,8 +72,8 @@ object FViewItems: TFViewItems
OnClick = btnSaveClick OnClick = btnSaveClick
end end
object btnCancel: TWebButton object btnCancel: TWebButton
Left = 565 Left = 567
Top = 256 Top = 380
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Cancel' Caption = 'Cancel'
...@@ -131,8 +89,8 @@ object FViewItems: TFViewItems ...@@ -131,8 +89,8 @@ object FViewItems: TFViewItems
OnClick = btnCancelClick OnClick = btnCancelClick
end end
object btnDelete: TWebButton object btnDelete: TWebButton
Left = 565 Left = 567
Top = 197 Top = 321
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Delete' Caption = 'Delete'
...@@ -146,8 +104,8 @@ object FViewItems: TFViewItems ...@@ -146,8 +104,8 @@ object FViewItems: TFViewItems
OnClick = btnDeleteClick OnClick = btnDeleteClick
end end
object btnEdit: TWebButton object btnEdit: TWebButton
Left = 565 Left = 567
Top = 287 Top = 411
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Edit' Caption = 'Edit'
...@@ -160,13 +118,131 @@ object FViewItems: TFViewItems ...@@ -160,13 +118,131 @@ object FViewItems: TFViewItems
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnEditClick OnClick = btnEditClick
end end
object wdbtcItems: TWebDBTableControl
Left = 16
Top = 86
Width = 631
Height = 200
ElementClassName = 'table'
ElementId = 'tblPhoneGrid'
BorderColor = clSilver
ChildOrder = 11
ElementFont = efCSS
ElementHeaderClassName = 'thead-light sticky-top bg-light border-light'
ElementPosition = epRelative
ElementTableClassName = 'table table-striped table-hover table-bordered text-sm'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
Footer.ButtonElementClassName = 'btn btn-light'
Footer.DropDownElementClassName = 'form-control'
Footer.InputElementClassName = 'form-control'
Footer.LinkActiveElementClassName = 'link-primary'
Footer.LinkElementClassName = 'link-secondary'
Footer.ListElementClassName = 'pagination'
Footer.ListItemElementClassName = 'page-item'
Footer.ListLinkElementClassName = 'page-link'
Header.ButtonActiveElementClassName = 'btn btn-primary'
Header.ButtonElementClassName = 'btn btn-light'
Header.DropDownElementClassName = 'form-control'
Header.InputElementClassName = 'form-control'
Header.LinkActiveElementClassName = 'link-primary'
Header.LinkElementClassName = 'link-secondary'
Header.ListElementClassName = 'pagination'
Header.ListItemElementClassName = 'page-item'
Header.ListLinkElementClassName = 'page-link'
WordWrap = True
Columns = <
item
DataField = 'ID'
Title = 'KG Orders ID'
end
item
DataField = 'name'
Title = 'Name'
end
item
DataField = 'description'
Title = 'Description'
end
item
DataField = 'status'
Title = 'Status'
end>
DataSource = wdsItems
end
object edtName: TWebDBEdit
Left = 352
Top = 0
Width = 121
Height = 22
ChildOrder = 8
ElementClassName = 'form-control'
ElementID = 'edtname'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'name'
DataSource = wdsItems
end
object edtDescription: TWebDBEdit
Left = 488
Top = 0
Width = 121
Height = 22
ChildOrder = 8
ElementClassName = 'form-control'
ElementID = 'edtdescription'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'description'
DataSource = wdsItems
end
object cbStatus: TWebCheckBox
Left = 352
Top = 36
Width = 113
Height = 22
Caption = 'Active?'
ChildOrder = 10
ElementClassName = 'custom-control custom-checkbox'
ElementButtonClassName = 'custom-control-input'
ElementLabelClassName = 'custom-control-label'
ElementID = 'cbstatus'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 426 Left = 294
Top = 240 Top = 356
end end
object XDataWebDataSet1: TXDataWebDataSet object xdwdsItems: TXDataWebDataSet
Left = 440 Left = 440
Top = 300 Top = 300
object xdwdsItemsstatus: TStringField
FieldName = 'status'
end
object xdwdsItemsqb_items_qb_id: TStringField
FieldName = 'qb_items_qb_id'
Size = 0
end
object xdwdsItemsID: TStringField
FieldName = 'ID'
end
object xdwdsItemsname: TStringField
FieldName = 'name'
end
object xdwdsItemsdescription: TStringField
FieldName = 'description'
end
end
object wdsItems: TWebDataSource
DataSet = xdwdsItems
Left = 268
Top = 300
end end
end end
...@@ -54,20 +54,22 @@ ...@@ -54,20 +54,22 @@
</div> </div>
</form> </form>
<table class="table table-responsive table-striped table-hover table-bordered" id="tblPhoneGrid"> <!-- Table Section -->
<thead class="thead-dark"> <div id="order_table_section" class="overflow-auto mt-2"
<tr> style="max-height: calc(100vh - 250px); padding-bottom: 0; width: 100%;">
<th scope="col">ID</th> <table id="tblPhoneGrid" class="table table-striped table-bordered border-light" style="width: 100%;">
<th scope="col">Name</th> <thead class="sticky-top thead-light">
<th scope="col">Description</th> <tr style="font-size: 0.875rem;">
<th scope="col">Status</th> <!-- Table headers are dynamically generated -->
</tr> </tr>
</thead> </thead>
<tbody> <tbody id="orderTableBody" class="align-middle">
<!-- Rows will be added dynamically via Delphi code --> <!-- Table rows are dynamically generated -->
</tbody> </tbody>
</table> </table>
</div>
<label id="lblentries"></label> <label id="lblentries"></label>
<nav aria-label="Page navigation"> <nav aria-label="Page navigation">
<ul class="pagination justify-content-center" id="pagination"> <ul class="pagination justify-content-center" id="pagination">
<!-- Pagination items will be added dynamically via Delphi code --> <!-- Pagination items will be added dynamically via Delphi code -->
......
...@@ -12,23 +12,29 @@ uses ...@@ -12,23 +12,29 @@ uses
System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Forms, WEBLib.Dialogs, System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Forms, WEBLib.Dialogs,
Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.Controls, WEBLib.Grids, WebLib.Lists, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.Controls, WEBLib.Grids, WebLib.Lists,
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, DateUtils; XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, DateUtils, WEBLib.DBCtrls;
type type
TFViewItems = class(TWebForm) TFViewItems = class(TWebForm)
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
XDataWebDataSet1: TXDataWebDataSet; xdwdsItems: TXDataWebDataSet;
lblEntries: TWebLabel; lblEntries: TWebLabel;
wcbPageSize: TWebComboBox; wcbPageSize: TWebComboBox;
btnAdd: TWebButton; btnAdd: TWebButton;
edtName: TWebEdit;
edtDescription: TWebEdit;
cbStatus: TWebCheckBox;
btnSave: TWebButton; btnSave: TWebButton;
btnCancel: TWebButton; btnCancel: TWebButton;
btnDelete: TWebButton; btnDelete: TWebButton;
btnEdit: TWebButton; btnEdit: TWebButton;
procedure WebFormCreate(Sender: TObject); wdbtcItems: TWebDBTableControl;
wdsItems: TWebDataSource;
xdwdsItemsstatus: TStringField;
xdwdsItemsqb_items_qb_id: TStringField;
xdwdsItemsID: TStringField;
xdwdsItemsname: TStringField;
xdwdsItemsdescription: TStringField;
edtName: TWebDBEdit;
edtDescription: TWebDBEdit;
cbStatus: TWebCheckBox;
procedure btnAddClick(Sender: TObject); procedure btnAddClick(Sender: TObject);
procedure wcbPageSizeChange(Sender: TObject); procedure wcbPageSizeChange(Sender: TObject);
procedure btnEditClick(Sender: TObject); procedure btnEditClick(Sender: TObject);
...@@ -45,6 +51,7 @@ type ...@@ -45,6 +51,7 @@ type
procedure EditMode(); procedure EditMode();
[async] procedure GetItems(searchOptions: string); [async] procedure GetItems(searchOptions: string);
[async] procedure AddItem(itemOptions: string); [async] procedure AddItem(itemOptions: string);
[async] procedure InitializeForm;
var var
PageNumber: integer; PageNumber: integer;
PageSize: integer; PageSize: integer;
...@@ -53,7 +60,9 @@ type ...@@ -53,7 +60,9 @@ type
EndDate: string; EndDate: string;
OrderBy: string; OrderBy: string;
Caller: string; Caller: string;
public notification: string;
public
class function CreateForm(AElementID: string): TWebForm;
end; end;
...@@ -68,7 +77,20 @@ uses ...@@ -68,7 +77,20 @@ uses
{$R *.dfm} {$R *.dfm}
procedure TFViewItems.WebFormCreate(Sender: TObject); class function TFViewItems.CreateForm(AElementID: string): TWebForm;
begin
Application.CreateForm(TFViewItems, AElementID, Result,
procedure(AForm: TObject)
begin
with TFViewItems(AForm) do
begin
InitializeForm;
end;
end
);
end;
[async] procedure TFViewItems.InitializeForm;
// Initializes important values: // Initializes important values:
// 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.
...@@ -78,7 +100,7 @@ begin ...@@ -78,7 +100,7 @@ begin
PageNumber := 1; PageNumber := 1;
TotalPages := 1; // Initial total pages TotalPages := 1; // Initial total pages
wcbPageSize.Text := '10'; wcbPageSize.Text := '10';
getItems(GenerateSearchOptions()); await(getItems(GenerateSearchOptions()));
end; end;
procedure TFViewItems.ViewMode(); procedure TFViewItems.ViewMode();
...@@ -367,13 +389,12 @@ begin ...@@ -367,13 +389,12 @@ begin
itemList := TJSObject(xdcResponse.Result); itemList := TJSObject(xdcResponse.Result);
data := TJSArray(itemList['data']); data := TJSArray(itemList['data']);
itemListLength := integer(itemList['count']); itemListLength := integer(itemList['count']);
ClearTable(); console.log(data);
for i := 0 to data.Length - 1 do xdwdsItems.Close;
begin xdwdsItems.SetJsonData(data);
item := TJSObject(data[i]); xdwdsItems.Open;
AddRowToTable(string(item['ID']), string(item['name']), string(item['description']),
string(item['status']));
end;
TotalPages := (itemListLength + PageSize - 1) div PageSize; TotalPages := (itemListLength + PageSize - 1) div PageSize;
if (PageNumber * PageSize) < itemListLength then if (PageNumber * PageSize) < itemListLength then
begin begin
...@@ -449,10 +470,19 @@ procedure TFViewItems.AddItem(itemOptions: string); ...@@ -449,10 +470,19 @@ procedure TFViewItems.AddItem(itemOptions: string);
// adds an item to the database. // adds an item to the database.
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
item: TJSObject;
begin begin
try try
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddItem', [itemOptions])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddItem', [itemOptions]));
getItems(GenerateSearchOptions()); getItems(GenerateSearchOptions());
item := TJSObject(xdcResponse.Result);
edtName.Text := string(item['name']);
edtDescription.Text := string(item['description']);
if item['status'] = 'ACTIVE' then
cbStatus.Checked := true
else
cbStatus.Checked := false;
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not add item: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal('Could not add item: ' + E.ErrorResult.ErrorMessage);
......
...@@ -171,7 +171,9 @@ procedure TFViewMain.lblItemsListClick(Sender: TObject); ...@@ -171,7 +171,9 @@ procedure TFViewMain.lblItemsListClick(Sender: TObject);
begin begin
if ( not ( change ) ) then if ( not ( change ) ) then
begin begin
ShowForm(TFViewItems); if Assigned(FChildForm) then
FChildForm.Free;
TFViewItems.CreateForm(WebPanel1.ElementID);
lblAppTitle.Caption := 'Koehler-Gibson Items'; lblAppTitle.Caption := 'Koehler-Gibson Items';
setActive('Items'); setActive('Items');
end end
......
...@@ -227,6 +227,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -227,6 +227,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 92 Top = 92
Width = 300 Width = 300
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcompanyname' ElementID = 'edtcompanyname'
...@@ -244,6 +245,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -244,6 +245,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 120 Top = 120
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtaccountcompanyname' ElementID = 'edtaccountcompanyname'
...@@ -259,6 +261,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -259,6 +261,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 148 Top = 148
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtinquickbooks' ElementID = 'edtinquickbooks'
...@@ -274,6 +277,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -274,6 +277,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 314 Top = 314
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtshipvia' ElementID = 'edtshipvia'
...@@ -289,6 +293,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -289,6 +293,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 346 Top = 346
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtquantity' ElementID = 'edtquantity'
...@@ -304,6 +309,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -304,6 +309,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 374 Top = 374
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtprice' ElementID = 'edtprice'
ElementPosition = epRelative ElementPosition = epRelative
...@@ -318,6 +324,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -318,6 +324,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 402 Top = 402
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtinvoiceto' ElementID = 'edtinvoiceto'
...@@ -333,6 +340,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -333,6 +340,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 458 Top = 458
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtponumber' ElementID = 'edtponumber'
...@@ -348,6 +356,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -348,6 +356,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 486 Top = 486
Width = 200 Width = 200
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtjobname' ElementID = 'edtjobname'
...@@ -363,6 +372,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -363,6 +372,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 348 Top = 348
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtother' ElementID = 'edtother'
...@@ -378,6 +388,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -378,6 +388,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 207 Top = 207
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcadfile' ElementID = 'edtcadfile'
...@@ -393,6 +404,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -393,6 +404,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 179 Top = 179
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtaroundno' ElementID = 'edtaroundno'
...@@ -408,6 +420,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -408,6 +420,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 151 Top = 151
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtacrossno' ElementID = 'edtacrossno'
...@@ -423,6 +436,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -423,6 +436,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 123 Top = 123
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtdiecutno' ElementID = 'edtdiecutno'
...@@ -438,6 +452,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -438,6 +452,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 95 Top = 95
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtrscd' ElementID = 'edtrscd'
...@@ -453,6 +468,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -453,6 +468,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 64 Top = 64
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtrscw' ElementID = 'edtrscw'
...@@ -468,6 +484,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -468,6 +484,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 39 Top = 39
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtrscl' ElementID = 'edtrscl'
...@@ -483,6 +500,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -483,6 +500,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 506 Top = 506
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcustomadhesive' ElementID = 'edtcustomadhesive'
...@@ -499,6 +517,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -499,6 +517,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 478 Top = 478
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcustombacking' ElementID = 'edtcustombacking'
...@@ -514,6 +533,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -514,6 +533,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 450 Top = 450
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtstandardsetup' ElementID = 'edtstandardsetup'
...@@ -529,6 +549,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -529,6 +549,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 430 Top = 430
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtstripmount' ElementID = 'edtstripmount'
...@@ -544,6 +565,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -544,6 +565,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 334 Top = 334
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtloose' ElementID = 'edtloose'
...@@ -559,6 +581,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -559,6 +581,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 261 Top = 261
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtrscstyle' ElementID = 'edtrscstyle'
...@@ -676,6 +699,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -676,6 +699,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 117 Top = 117
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtclemson' ElementID = 'edtclemson'
...@@ -692,6 +716,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -692,6 +716,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 89 Top = 89
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcrosshairs' ElementID = 'edtcrosshairs'
...@@ -708,6 +733,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -708,6 +733,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 64 Top = 64
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtmachineindent' ElementID = 'edtmachineindent'
...@@ -724,6 +750,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -724,6 +750,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 39 Top = 39
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcylindersize' ElementID = 'edtcylindersize'
...@@ -1220,6 +1247,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1220,6 +1247,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 194 Top = 194
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 81 ChildOrder = 81
ElementID = 'edtordernum' ElementID = 'edtordernum'
Enabled = False Enabled = False
...@@ -1269,7 +1297,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1269,7 +1297,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 44 Top = 44
end end
object XDataWebDataSet1: TXDataWebDataSet object XDataWebDataSet1: TXDataWebDataSet
BeforePost = XDataWebDataSet1BeforePost
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 1060 Left = 1060
Top = 182 Top = 182
......
...@@ -1122,3 +1122,4 @@ initialization ...@@ -1122,3 +1122,4 @@ initialization
end. end.
...@@ -1985,40 +1985,49 @@ var ...@@ -1985,40 +1985,49 @@ var
SQL: string; SQL: string;
begin begin
result := TJSONObject.Create; try
JSONData := TJSONObject.ParseJSONValue(itemInfo) as TJSONObject; logger.Log(1, 'Add Item Hit');
if JSONData = nil then result := TJSONObject.Create;
raise Exception.Create('Invalid JSON format'); // If parsing fails, raise an exception JSONData := TJSONObject.ParseJSONValue(itemInfo) as TJSONObject;
mode := JSONData.GetValue<string>('mode'); if JSONData = nil then
raise Exception.Create('Invalid JSON format'); // If parsing fails, raise an exception
mode := JSONData.GetValue<string>('mode');
Name := JSONData.GetValue<string>('qb_item_name'); Name := JSONData.GetValue<string>('qb_item_name');
Description := JSONData.GetValue<string>('item_desc'); Description := JSONData.GetValue<string>('item_desc');
Status := StrToBool(JSONData.GetValue<string>('status')); Status := StrToBool(JSONData.GetValue<string>('status'));
SQL := 'select * from qb_items where qb_item_name = ' + QuotedStr(Name); SQL := 'select * from qb_items where qb_item_name = ' + QuotedStr(Name);
if mode = 'ADD' then if mode = 'ADD' then
begin
doQuery(ordersDB.UniQuery1, SQL);
if true then //ordersDB.UniQuery1.IsEmpty then
begin begin
ordersDB.UniQuery1.Insert; doQuery(ordersDB.UniQuery1, SQL);
if true then //ordersDB.UniQuery1.IsEmpty then
begin
ordersDB.UniQuery1.Insert;
ordersDB.UniQuery1.FieldByName('qb_item_name').AsString := Name; ordersDB.UniQuery1.FieldByName('qb_item_name').AsString := Name;
ordersDB.UniQuery1.FieldByName('item_desc').AsString := Description; ordersDB.UniQuery1.FieldByName('item_desc').AsString := Description;
if status then if status then
ordersDB.UniQuery1.FieldByName('status').AsString := 'ACTIVE' ordersDB.UniQuery1.FieldByName('status').AsString := 'ACTIVE'
else else
ordersDB.UniQuery1.FieldByName('status').AsString := 'INACTIVE'; ordersDB.UniQuery1.FieldByName('status').AsString := 'INACTIVE';
ordersDB.UniQuery1.FieldByName('qb_items_qb_id').AsString := JSONData.GetValue<string>('qb_items_qb_id'); ordersDB.UniQuery1.FieldByName('qb_items_qb_id').AsString := JSONData.GetValue<string>('qb_items_qb_id');
ordersDB.UniQuery1.Post; ordersDB.UniQuery1.Post;
Result.AddPair('msg', 'Success: Item successfully added'); Result.AddPair('msg', 'Success: Item successfully added');
end Result.AddPair('description', ordersDB.UniQuery1.FieldByName('item_desc').AsString);
else Result.AddPair('name', ordersDB.UniQuery1.FieldByName('qb_item_name').AsString);
Result.AddPair('msg', 'Failure: Item already exists'); Result.AddPair('status', ordersDB.UniQuery1.FieldByName('status').AsString);
end; end
else
Result.AddPair('msg', 'Failure: Item already exists');
end;
except
on E: Exception do
logger.Log(5, 'An error occurred when adding an item: ' + E.Message);
end;
end; end;
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
MemoLogLevel=3 MemoLogLevel=3
FileLogLevel=5 FileLogLevel=5
webClientVersion=0.9.6 webClientVersion=0.9.6
LogFileNum=819 LogFileNum=826
[Database] [Database]
--Server=192.168.159.153 Server=192.168.159.144
Server=192.168.102.130 --Server=192.168.102.130
--Server=192.168.75.133 --Server=192.168.75.133
Database=kg_order_entry Database=kg_order_entry
Username=root Username=root
......
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