Commit f5f1995d by Mac Stephens

Merge branch 'cam3'

parents e42020d5 ee8abbae
...@@ -4,8 +4,8 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -4,8 +4,8 @@ object FViewAddCustomer: TFViewAddCustomer
CSSLibrary = cssBootstrap CSSLibrary = cssBootstrap
ElementFont = efCSS ElementFont = efCSS
object lblFormState: TWebLabel object lblFormState: TWebLabel
Left = 18 Left = 19
Top = 16 Top = 578
Width = 3 Width = 3
Height = 15 Height = 15
ElementID = 'lbl_form_state' ElementID = 'lbl_form_state'
...@@ -39,7 +39,7 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -39,7 +39,7 @@ object FViewAddCustomer: TFViewAddCustomer
Text = '' Text = ''
end end
object edtShortName: TWebDBEdit object edtShortName: TWebDBEdit
Left = 19 Left = 24
Top = 12 Top = 12
Width = 121 Width = 121
Height = 22 Height = 22
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<input id="edtcompanyid" class="form-control input-sm"style="width: 100px" required/> <input id="edtcompanyid" class="form-control input-sm"style="width: 100px" required/>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quickbooks ID:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QB ID:</label>
<input id="edtqbid" class="form-control input-sm"style="width: 200px" required/> <input id="edtqbid" class="form-control input-sm"style="width: 200px" required/>
</div> </div>
<div class="col-auto"> <div class="col-auto">
......
...@@ -79,7 +79,7 @@ type ...@@ -79,7 +79,7 @@ type
XDataWebDataSet1REP_USER_ID: TStringField; XDataWebDataSet1REP_USER_ID: TStringField;
xdwdsUsersfull_name: TStringField; xdwdsUsersfull_name: TStringField;
lblFormState: TWebLabel; lblFormState: TWebLabel;
procedure btnSaveClick(Sender: TObject); [async] procedure btnSaveClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
procedure btnCloseClick(Sender: TObject); procedure btnCloseClick(Sender: TObject);
procedure btnEditClick(Sender: TObject); procedure btnEditClick(Sender: TObject);
...@@ -424,8 +424,8 @@ procedure TFViewAddCustomer.btnSaveClick(Sender: TObject); ...@@ -424,8 +424,8 @@ procedure TFViewAddCustomer.btnSaveClick(Sender: TObject);
begin begin
if VerifyCustomer() then if VerifyCustomer() then
begin begin
sendCustomerToServer(); await(sendCustomerToServer());
GetCustomer(); await(GetCustomer());
ViewMode(); ViewMode();
end; end;
end; end;
...@@ -505,16 +505,14 @@ procedure TFViewAddCustomer.GetCustomer; ...@@ -505,16 +505,14 @@ procedure TFViewAddCustomer.GetCustomer;
// Retrieves a customer for a given CustomerID. // Retrieves a customer for a given CustomerID.
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
customer : TJSObject; customer, RepUsers : TJSObject;
items: TJSObject; items: TJSObject;
ship_block: TStringList; 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);
xdwdsUsers.Close;
xdwdsUsers.SetJSONData(customer['USERS']);
xdwdsUsers.Open;
XDataWebDataSet1.Close; XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(customer); XDataWebDataSet1.SetJsonData(customer);
...@@ -530,7 +528,7 @@ begin ...@@ -530,7 +528,7 @@ begin
dtpEndDate.Date := XDataWebDataSet1.FieldByName('End_DATE').AsDateTime; dtpEndDate.Date := XDataWebDataSet1.FieldByName('End_DATE').AsDateTime;
xdwdsShipTo.Close; xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(customer['ADDRESS_LIST']); xdwdsShipTo.SetJSONData(customer['SHIPPING_ADDRESS_LIST']);
xdwdsShipTo.Open; xdwdsShipTo.Open;
memoAddressBlock.Text := string(customer['staff_fields_invoice_to']); memoAddressBlock.Text := string(customer['staff_fields_invoice_to']);
...@@ -545,6 +543,14 @@ begin ...@@ -545,6 +543,14 @@ begin
edtFirstLine.Text := memoShipBlock.Lines[0] edtFirstLine.Text := memoShipBlock.Lines[0]
else else
edtFirstLine.Text := ''; edtFirstLine.Text := '';
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetRepUsers', []));
RepUsers := TJSObject(xdcResponse.Result);
console.log(RepUsers);
xdwdsUsers.Close;
xdwdsUsers.SetJSONData(RepUsers['value']);
xdwdsUsers.Open;
end; end;
procedure TFViewAddCustomer.tmrReturnTimer(Sender: TObject); procedure TFViewAddCustomer.tmrReturnTimer(Sender: TObject);
......
...@@ -135,6 +135,13 @@ end; ...@@ -135,6 +135,13 @@ end;
// if confirmed then DeleteOrder(); // if confirmed then DeleteOrder();
// end); // end);
// function ShowConfirmationModal(msg, leftLabel, rightLabel: string;): Boolean;
// if ShowConfirmationModal then
// doThing()
// else
// doOtherThing();
procedure ShowConfirmationModal(msg, leftLabel, rightLabel: string; ConfirmProc: TProc<Boolean>); procedure ShowConfirmationModal(msg, leftLabel, rightLabel: string; ConfirmProc: TProc<Boolean>);
begin begin
......
...@@ -43,6 +43,8 @@ type ...@@ -43,6 +43,8 @@ type
public public
{ Public declarations } { Public declarations }
notification: string; notification: string;
confirm: Boolean;
QB_ID, name, description, status: string;
end; end;
var var
...@@ -80,7 +82,18 @@ begin ...@@ -80,7 +82,18 @@ begin
else if xdwdsCustomers.FieldByName('qb_items_id').AsString <> '' then else if xdwdsCustomers.FieldByName('qb_items_id').AsString <> '' then
edtNotification.Text := 'Item Already In Database' edtNotification.Text := 'Item Already In Database'
else else
SendItemToServer(); begin
QB_ID := xdwdsCustomers.FieldByName('qb_items_qb_id').AsString;
name := xdwdsCustomers.FieldByName('qb_item_name').AsString;
description := xdwdsCustomers.FieldByName('item_desc').AsString;
if xdwdsCustomers.FieldByName('status').AsBoolean then
status := 'ACTIVE'
else
status := 'INACTIVE';
confirm := true;
Close;
end;
//SendItemToServer();
end; end;
procedure TfViewAddItem.getItems; procedure TfViewAddItem.getItems;
...@@ -90,18 +103,25 @@ var ...@@ -90,18 +103,25 @@ var
i: integer; i: integer;
begin begin
// Fetch data from XData service // Fetch data from XData service
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.getQBItems', [])); Utils.ShowSpinner('spinner');
customerList := TJSObject(xdcResponse.Result); try
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.getQBItems', []));
customerList := TJSObject(xdcResponse.Result);
// Load data into TXDataWebDataset // Load data into TXDataWebDataset
xdwdsCustomers.Close; xdwdsCustomers.Close;
xdwdsCustomers.SetJsonData(customerList); xdwdsCustomers.SetJsonData(customerList);
xdwdsCustomers.Open; xdwdsCustomers.Open;
// Manually populate the grid // Manually populate the grid
PopulateGridManually; PopulateGridManually;
//Utils.HideSpinner('spinner'); //Utils.HideSpinner('spinner');
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end;
Utils.HideSpinner('spinner');
end; end;
procedure TFViewAddItem.PopulateGridManually; procedure TFViewAddItem.PopulateGridManually;
......
...@@ -42,15 +42,14 @@ object FViewCustomers: TFViewCustomers ...@@ -42,15 +42,14 @@ object FViewCustomers: TFViewCustomers
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Text = '500' Text = '50'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = wcbPageSizeChange OnChange = wcbPageSizeChange
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
'100' '10'
'250' '25'
'500' '50')
'1000')
end end
object pnlMessage: TWebPanel object pnlMessage: TWebPanel
Left = 12 Left = 12
......
...@@ -83,16 +83,7 @@ begin ...@@ -83,16 +83,7 @@ begin
newform.ShowModal( newform.ShowModal(
procedure(AValue: TModalResult) procedure(AValue: TModalResult)
begin begin
{if newform.confirm then
begin
if newform.cbCorrugatedPlate.Checked then
orderType := 'corrugated'
else if newform.cbWebPlate.Checked then
orderType := 'web'
else
orderType := 'cutting';
orderEntry('', newForm.DBID, 'ADD', orderType);
end; }
end end
); );
end; end;
...@@ -108,8 +99,8 @@ begin ...@@ -108,8 +99,8 @@ begin
DMConnection.ApiConnection.Connected := True; DMConnection.ApiConnection.Connected := True;
PageNumber := 1; PageNumber := 1;
TotalPages := 1; // Initial total pages TotalPages := 1; // Initial total pages
wcbPageSize.Text := '500'; wcbPageSize.Text := '50';
PageSize := 500; PageSize := 50;
HideNotification(); HideNotification();
getCustomers(GenerateSearchOptions()); getCustomers(GenerateSearchOptions());
end; end;
...@@ -135,21 +126,23 @@ begin ...@@ -135,21 +126,23 @@ begin
xdwdsCustomers.Open; xdwdsCustomers.Open;
customerListLength := integer(customerList['count']); customerListLength := integer(customerList['count']);
TotalPages := ( (customerListLength + PageSize - 1) div PageSize); TotalPages := (customerListLength + PageSize - 1) div PageSize;
generatePagination(TotalPages);
if customerListLength = 0 then if customerListLength = 0 then
lblEntries.Caption := 'No entries found' begin
else if (PageNumber * PageSize) < customerListLength then lblEntries.Caption := 'No entries found';
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + ShowToast('No entries found', 'danger');
' - ' + IntToStr(customerListLength) + end
' of ' + IntToStr(customerListLength) else if (PageNumber * PageSize) < customerListLength then
else lblEntries.Caption := Format('Showing entries %d - %d of %d',
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + [(PageNumber - 1) * PageSize + 1, PageNumber * PageSize, customerListLength])
' - ' + IntToStr(customerListLength) + else
' of ' + IntToStr(customerListLength); lblEntries.Caption := Format('Showing entries %d - %d of %d',
[(PageNumber - 1) * PageSize + 1, customerListLength, customerListLength]);
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve customers: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
end; end;
...@@ -180,7 +173,6 @@ begin ...@@ -180,7 +173,6 @@ begin
getCustomers(GenerateSearchOptions()); getCustomers(GenerateSearchOptions());
end; end;
procedure TFViewCustomers.wdbtcCustomersDblClickCell(Sender: TObject; ACol, procedure TFViewCustomers.wdbtcCustomersDblClickCell(Sender: TObject; ACol,
ARow: Integer); ARow: Integer);
begin begin
......
...@@ -107,7 +107,7 @@ begin ...@@ -107,7 +107,7 @@ begin
Info := string(responseString['value']); Info := string(responseString['value']);
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not add user: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
end; end;
......
...@@ -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 ...'
...@@ -22,6 +21,17 @@ object FViewItems: TFViewItems ...@@ -22,6 +21,17 @@ object FViewItems: TFViewItems
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblFormState: TWebLabel
Left = 380
Top = 422
Width = 3
Height = 13
ElementID = 'lbl_form_state'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object wcbPageSize: TWebComboBox object wcbPageSize: TWebComboBox
Left = 0 Left = 0
Top = 0 Top = 0
...@@ -42,8 +52,8 @@ object FViewItems: TFViewItems ...@@ -42,8 +52,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 +65,9 @@ object FViewItems: TFViewItems ...@@ -55,50 +65,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 +83,8 @@ object FViewItems: TFViewItems ...@@ -114,8 +83,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 +100,8 @@ object FViewItems: TFViewItems ...@@ -131,8 +100,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 +115,8 @@ object FViewItems: TFViewItems ...@@ -146,8 +115,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 +129,138 @@ object FViewItems: TFViewItems ...@@ -160,13 +129,138 @@ 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
OnClickCell = wdbtcItemsClickCell
Columns = <
item
DataField = 'ID'
Title = 'Item ID'
end
item
DataField = 'name'
Title = 'Name'
end
item
DataField = 'description'
Title = 'Description'
end
item
DataField = 'status'
Title = 'Status'
end
item
DataField = 'QB_ID'
Title = 'QB ID'
end>
DataSource = wdsItems
end
object edtName: TWebDBEdit
Left = 352
Top = 0
Width = 121
Height = 22
ChildOrder = 8
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
ElementID = 'edtdescription'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'description'
DataSource = wdsItems
end
object CBStatus: TWebDBCheckBox
Left = 352
Top = 34
Width = 113
Height = 22
Caption = 'Active?'
ChildOrder = 11
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
DataField = 'status'
DataSource = wdsItems
ValueChecked = 'ACTIVE'
ValueUnChecked = 'INACTIVE'
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 xdwdsItemsID: TStringField
FieldName = 'ID'
end
object xdwdsItemsname: TStringField
FieldName = 'name'
end
object xdwdsItemsdescription: TStringField
FieldName = 'description'
end
object xdwdsItemsQB_ID: TStringField
FieldName = 'QB_ID'
end
end
object wdsItems: TWebDataSource
AutoEdit = False
DataSet = xdwdsItems
Left = 268
Top = 300
end end
end end
<nav class="navbar navbar-expand navbar-light bg-light sticky-top" style="z-index: 100;"> <nav class="navbar navbar-expand navbar-light bg-light sticky-top border-light" style="z-index: 100;">
<div class="container-fluid ps-0"> <div class="container-fluid d-flex align-items-center ps-0 pe-0">
<ul class="navbar-nav me-auto ps-2">
<li class="nav-item pe-2"> <!-- Left-aligned form state label -->
<button id="btnadd" class="btn btn-primary btn-sm">Add</button> <div class="me-auto ps-3">
</li> <label id="lbl_form_state" class="form-label mb-0 fw-bold text-uppercase text-nowrap text-danger" style="font-size: 16px;">View Mode</label>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
</ul>
</div> </div>
<!-- Right-aligned buttons -->
<ul class="navbar-nav ms-auto pe-2 mb-0">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
</ul>
</div>
</nav> </nav>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="container mt-4"> <div class="container mt-4">
...@@ -54,20 +63,22 @@ ...@@ -54,20 +63,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 -->
...@@ -78,46 +89,4 @@ ...@@ -78,46 +89,4 @@
</div> </div>
</div> </div>
</div> </div>
<!-- Modal -->
<div class="modal fade" id="audioModal" tabindex="-1" aria-labelledby="audioModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="audioModalLabel">Audio Player</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" onclick="stopAudio()"></button>
</div>
<div class="modal-body">
<audio controls id="audioPlayer">
<source src="" type="audio/mp3" id="audioSource">
Your browser does not support the audio element.
</audio>
</div>
</div>
</div>
</div> </div>
<script>
document.getElementById('tblPhoneGrid').addEventListener('click', function(event) {
// Check if the clicked element is a table cell (td)
if (event.target.tagName === 'TD') {
const row = event.target.parentNode;
const cells = row.getElementsByTagName('td');
// Extract data from the row
const id = cells[0].textContent;
const name = cells[1].textContent;
const description = cells[2].textContent;
const status = cells[3].textContent.trim().toLowerCase();
// Populate form fields
document.getElementById('edtname').value = name;
document.getElementById('edtdescription').value = description;
// Set the checkbox based on the status
const isActive = status === 'active';
document.getElementById('cbstatus').checked = isActive;
console.log(`Row clicked! ID: ${id}, Name: ${name}, Description: ${description}, Status: ${status}`);
}
});
</script>
...@@ -119,20 +119,6 @@ object FViewMain: TFViewMain ...@@ -119,20 +119,6 @@ object FViewMain: TFViewMain
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = lblCustomersClick OnClick = lblCustomersClick
end end
object lblQuickbooks: TWebLabel
Left = 546
Top = 125
Width = 57
Height = 14
Caption = 'QuickBooks'
ElementID = 'lblquickbooks'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblQuickbooksClick
end
object lblVersion: TWebLabel object lblVersion: TWebLabel
Left = 358 Left = 358
Top = 209 Top = 209
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
<li class="nav-item"> <li class="nav-item">
<a class="dropdown-item" id="dropdown.menu.itemlist" href="#"><i class="fa fa-cubes fa-fw"></i><span> Items</span></a> <a class="dropdown-item" id="dropdown.menu.itemlist" href="#"><i class="fa fa-cubes fa-fw"></i><span> Items</span></a>
</li> </li>
<li class="nav-item">
<a class="dropdown-item" id="lblquickbooks" href="#"><i class="fa fa-tags fa-fw"></i><span> QuickBooks</span></a>
</li>
</ul> </ul>
<div class="collapse navbar-collapse show" id="navbarNavDropdown"> <div class="collapse navbar-collapse show" id="navbarNavDropdown">
<ul class="navbar-nav ms-auto"> <ul class="navbar-nav ms-auto">
......
...@@ -23,7 +23,6 @@ type ...@@ -23,7 +23,6 @@ type
lblUsers: TWebLinkLabel; lblUsers: TWebLinkLabel;
lblorders: TWebLabel; lblorders: TWebLabel;
lblCustomers: TWebLabel; lblCustomers: TWebLabel;
lblQuickbooks: TWebLabel;
lblVersion: TWebLabel; lblVersion: TWebLabel;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure mnuLogoutClick(Sender: TObject); procedure mnuLogoutClick(Sender: TObject);
...@@ -171,7 +170,9 @@ procedure TFViewMain.lblItemsListClick(Sender: TObject); ...@@ -171,7 +170,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'
...@@ -1063,7 +1090,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1063,7 +1090,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ShowFocus = False ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebDBComboBox1: TWebDBComboBox object wdbcbShipTo: TWebDBComboBox
Left = 26 Left = 26
Top = 430 Top = 430
Width = 145 Width = 145
...@@ -1073,6 +1100,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1073,6 +1100,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = wdbcbShipToChange
ItemIndex = -1 ItemIndex = -1
DataField = 'staff_fields_ship_to' DataField = 'staff_fields_ship_to'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -1108,7 +1136,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1108,7 +1136,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCancelClick OnClick = btnCancelClick
end end
object WebDBComboBox2: TWebDBComboBox object wdbcbQuickbooksItem: TWebDBComboBox
Left = 26 Left = 26
Top = 515 Top = 515
Width = 145 Width = 145
...@@ -1220,6 +1248,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1220,6 +1248,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
...@@ -1561,6 +1590,9 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1561,6 +1590,9 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
object XDataWebDataSet1supplied_by_customer_order_date: TStringField object XDataWebDataSet1supplied_by_customer_order_date: TStringField
FieldName = 'supplied_by_customer_order_date' FieldName = 'supplied_by_customer_order_date'
end end
object XDataWebDataSet1inQuickBooks: TStringField
FieldName = 'inQuickBooks'
end
end end
object WebDataSource1: TWebDataSource object WebDataSource1: TWebDataSource
AutoEdit = False AutoEdit = False
......
...@@ -179,11 +179,11 @@ type ...@@ -179,11 +179,11 @@ type
wdsShipTo: TWebDataSource; wdsShipTo: TWebDataSource;
xdwdsShipTo: TXDataWebDataSet; xdwdsShipTo: TXDataWebDataSet;
xdwdsShipToADDRESS: TStringField; xdwdsShipToADDRESS: TStringField;
WebDBComboBox1: TWebDBComboBox; wdbcbShipTo: TWebDBComboBox;
cbEmail: TWebCheckBox; cbEmail: TWebCheckBox;
XDataWebDataSet1supplied_by_customer_order_date: TStringField; XDataWebDataSet1supplied_by_customer_order_date: TStringField;
btnCancel: TWebButton; btnCancel: TWebButton;
WebDBComboBox2: TWebDBComboBox; wdbcbQuickbooksItem: TWebDBComboBox;
wdsQBItem: TWebDataSource; wdsQBItem: TWebDataSource;
xdwdsQBItem: TXDataWebDataSet; xdwdsQBItem: TXDataWebDataSet;
xdwdsQBItemname: TStringField; xdwdsQBItemname: TStringField;
...@@ -224,6 +224,7 @@ type ...@@ -224,6 +224,7 @@ type
procedure WebButton2Click(Sender: TObject); procedure WebButton2Click(Sender: TObject);
procedure ShowAddAddressForm(); procedure ShowAddAddressForm();
[async] procedure SendAddressToServer(AddressJSON: TJSONObject); [async] procedure SendAddressToServer(AddressJSON: TJSONObject);
procedure wdbcbShipToChange(Sender: TObject);
private private
FAgencyCode: string; FAgencyCode: string;
FCurrentReportType: string; FCurrentReportType: string;
...@@ -261,8 +262,6 @@ begin ...@@ -261,8 +262,6 @@ begin
orderID := orderInfo; orderID := orderInfo;
mode := modeParam; mode := modeParam;
notification := info; notification := info;
console.log('Mode in createform: ' + modeParam);
InitializeForm; InitializeForm;
end; end;
end end
...@@ -398,6 +397,9 @@ begin ...@@ -398,6 +397,9 @@ begin
XDataWebDataSet1mounting_full_mount.AsString := ''; XDataWebDataSet1mounting_full_mount.AsString := '';
XDataWebDataSet1.Post; XDataWebDataSet1.Post;
//xdwdsShipTo.Post;
//xdwdsQBItem.Post;
XDataWebDataSet1.First; XDataWebDataSet1.First;
while not XDataWebDataSet1.Eof do while not XDataWebDataSet1.Eof do
begin begin
...@@ -408,8 +410,6 @@ begin ...@@ -408,8 +410,6 @@ begin
if Field.AsString = '' then if Field.AsString = '' then
begin begin
orderJSON.AddPair(Field.FieldName, ''); orderJSON.AddPair(Field.FieldName, '');
console.log(Field.FieldName);
console.log(Field.AsString);
end end
else else
orderJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields orderJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields
...@@ -480,7 +480,7 @@ begin ...@@ -480,7 +480,7 @@ begin
input := TJSHTMLInputElement(document.getElementById('wcbshipto')); input := TJSHTMLInputElement(document.getElementById('wcbshipto'));
if WebDBComboBox1.Text = '' then if wdbcbShipTo.Text = '' then
begin begin
input.classList.add('is-invalid'); input.classList.add('is-invalid');
result := false; result := false;
...@@ -569,7 +569,7 @@ begin ...@@ -569,7 +569,7 @@ begin
window.open(pdfURL, '_blank'); window.open(pdfURL, '_blank');
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not generate corrugated PDF: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
end; end;
...@@ -580,7 +580,6 @@ var ...@@ -580,7 +580,6 @@ var
Response: TXDataClientResponse; Response: TXDataClientResponse;
jsObj: TJSObject; jsObj: TJSObject;
begin begin
console.log(orderJSON);
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCorrugatedOrder', Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCorrugatedOrder',
[orderJSON.ToString])); [orderJSON.ToString]));
jsObj := JS.TJSObject(Response.Result); jsObj := JS.TJSObject(Response.Result);
...@@ -601,7 +600,7 @@ begin ...@@ -601,7 +600,7 @@ begin
[OrderID, 'corrugated', JS.toString(AuthService.TokenPayload.Properties['user_id'])])); [OrderID, 'corrugated', JS.toString(AuthService.TokenPayload.Properties['user_id'])]));
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not delete order: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
end; end;
...@@ -840,7 +839,7 @@ var ...@@ -840,7 +839,7 @@ var
orderList : TJSObject; orderList : TJSObject;
i: integer; i: integer;
data: TJSArray; data: TJSArray;
order: TJSObject; order, customer, items: TJSObject;
callListLength: integer; callListLength: integer;
tempString, strColorList: string; tempString, strColorList: string;
colorObject: TJSObject; colorObject: TJSObject;
...@@ -849,7 +848,6 @@ var ...@@ -849,7 +848,6 @@ var
color: TJSObject; color: TJSObject;
colorJSON: TJSONObject; colorJSON: TJSONObject;
colorListJSON: TJSONArray; colorListJSON: TJSONArray;
items: TJSObject;
begin begin
try try
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetOrder', [Order_ID])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetOrder', [Order_ID]));
...@@ -973,21 +971,23 @@ begin ...@@ -973,21 +971,23 @@ begin
else else
cbStripMount.Checked := false; cbStripMount.Checked := false;
if mode = 'EDIT' then xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer', [XDataWebDataSet1.FieldByName('COMPANY_ID').AsString]));
begin customer := TJSObject(xdcResponse.Result);
CustomerID := XDataWebDataSet1COMPANY_ID.AsString;
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(order['ADDRESS_LIST']);
xdwdsShipTo.Open;
end;
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(customer['SHIPPING_ADDRESS_LIST']);
xdwdsShipTo.Open;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems', []));
items := TJSObject(xdcResponse.Result);
xdwdsQBItem.Close; xdwdsQBItem.Close;
items := TJSObject(order['ITEMS']); items := TJSObject(order['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']); xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open; xdwdsQBITEM.Open;
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve order: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
end; end;
...@@ -1009,11 +1009,13 @@ begin ...@@ -1009,11 +1009,13 @@ begin
XDataWebDataSet1.Edit; XDataWebDataSet1.Edit;
xdwdsShipTo.Close; xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(customer['ADDRESS_LIST']); xdwdsShipTo.SetJSONData(customer['SHIPPING_ADDRESS_LIST']);
xdwdsShipTo.Open; xdwdsShipTo.Open;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems', []));
items := TJSObject(xdcResponse.Result);
xdwdsQBItem.Close; xdwdsQBItem.Close;
items := TJSObject(customer['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']); xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open; xdwdsQBITEM.Open;
...@@ -1026,7 +1028,7 @@ begin ...@@ -1026,7 +1028,7 @@ begin
dtpApprovedDate.Date := 0; dtpApprovedDate.Date := 0;
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve customer: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
end; end;
...@@ -1043,7 +1045,10 @@ end; ...@@ -1043,7 +1045,10 @@ end;
procedure TFOrderEntryCorrugated.EditMode(); procedure TFOrderEntryCorrugated.EditMode();
begin begin
xdwdsShipTo.Edit;
xdwdsQBItem.Edit;
XDataWebDataSet1.Edit; XDataWebDataSet1.Edit;
FViewMain.change := true; FViewMain.change := true;
btnCopy.Enabled := false; btnCopy.Enabled := false;
btnPDF.Enabled := false; btnPDF.Enabled := false;
...@@ -1073,6 +1078,8 @@ begin ...@@ -1073,6 +1078,8 @@ begin
cbWideFormat.Enabled := True; cbWideFormat.Enabled := True;
cbPrintCard.Enabled := True; cbPrintCard.Enabled := True;
cbFullSizePanel.Enabled := True; cbFullSizePanel.Enabled := True;
wdbcbQuickbooksItem.Enabled := true;
wdbcbShipTo.Enabled := true;
lblFormState.Caption := 'Edit Mode'; lblFormState.Caption := 'Edit Mode';
lblFormState.ElementHandle.classList.remove('text-danger'); lblFormState.ElementHandle.classList.remove('text-danger');
...@@ -1111,6 +1118,8 @@ begin ...@@ -1111,6 +1118,8 @@ begin
cbWideFormat.Enabled := False; cbWideFormat.Enabled := False;
cbPrintCard.Enabled := False; cbPrintCard.Enabled := False;
cbFullSizePanel.Enabled := False; cbFullSizePanel.Enabled := False;
wdbcbQuickbooksItem.Enabled := false;
wdbcbShipTo.Enabled := false;
lblFormState.Caption := 'View Mode'; lblFormState.Caption := 'View Mode';
lblFormState.ElementHandle.classList.remove('text-success'); lblFormState.ElementHandle.classList.remove('text-success');
...@@ -1118,6 +1127,12 @@ begin ...@@ -1118,6 +1127,12 @@ begin
end; end;
procedure TFOrderEntryCorrugated.wdbcbShipToChange(Sender: TObject);
begin
console.log(XDataWebDataSet1.FieldByName('staff_fields_ship_to').AsString);
console.log(xdwdsShipTo.FieldByName('ADDRESS').AsString);
end;
initialization initialization
RegisterClass(TFOrderEntryCorrugated); RegisterClass(TFOrderEntryCorrugated);
......
...@@ -3,7 +3,10 @@ ...@@ -3,7 +3,10 @@
<!-- Left-aligned label --> <!-- Left-aligned label -->
<div class="me-auto ps-3"> <div class="me-auto ps-3">
<label id="lbl_form_state" class="form-label mb-0 fw-bold text-uppercase text-nowrap text-danger" style="font-size: 16px;">View Mode</label> <label id="lbl_order_type" class="form-label mb-0 fw-bold text-uppercase text-nowrap" style="font-size: 16px;">Cutting Die -</label>
</div>
<div class="me-auto ps-2">
<label id="lbl_form_state" class="form-label mb-0 fw-bold text-uppercase text-nowrap text-danger" style="font-size: 16px;"> View Mode</label>
</div> </div>
<!-- Right-aligned buttons --> <!-- Right-aligned buttons -->
...@@ -21,14 +24,17 @@ ...@@ -21,14 +24,17 @@
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button> <button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li> </li>
<li class="nav-item pe-2"> <li class="nav-item pe-2">
<button id="btnpdf" class="btn btn-primary btn-sm">PDF</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button> <button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li> </li>
<li class="nav-item pe-2"> <li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button> <button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li> </li>
<li class="nav-item pe-2">
<button id="btnpdf" class="btn btn-primary btn-sm">PDF</button>
</li>
<li class="nav-item pe-2">
<button id="btnsendtoqb" class="btn btn-primary btn-sm">Send To QB</button>
</li>
<li class="nav-item"> <li class="nav-item">
<button id="btnclose" class="btn btn-primary btn-sm">Close</button> <button id="btnclose" class="btn btn-primary btn-sm">Close</button>
</li> </li>
...@@ -54,9 +60,13 @@ ...@@ -54,9 +60,13 @@
Please Provide a Customer ID. Please Provide a Customer ID.
</div> </div>
</div> </div>
<div class="col-auto d-flex flex-column">
<label for="wdbcbinqb" class="form-label mt-2" style="font-weight: 700; font-size: 15px;">In QB?:</label>
<input id="wdbcbinqb" type="checkbox" class="form-check-input mt-1">
</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">In Quickbooks?:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QB Order Number:</label>
<input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/> <input id="edtqbordernum"type="text" class="form-control" style="width: 150px" required/>
</div> </div>
</div> </div>
<h4 class="custom-h4 mt-3">Staff Fields</h4> <h4 class="custom-h4 mt-3">Staff Fields</h4>
...@@ -87,11 +97,17 @@ ...@@ -87,11 +97,17 @@
</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">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"/> <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>
Please Provide a Quantity.
</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="0"/> <input id="edtprice" class="form-control input-sm" style="width: 100px" type="number" min="1" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Price.
</div>
</div> </div>
<div> <div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Invoice To:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Invoice To:</label>
...@@ -115,12 +131,26 @@ ...@@ -115,12 +131,26 @@
<input id="edtponumber" class="form-control input-sm" width='50%'/> <input id="edtponumber" class="form-control input-sm" width='50%'/>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Job Name:</label> <label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QB Item:</label>
<input id="edtjobname" class="form-control input-sm" style="width: 300px"/> <select id="wcbqbitem" class='form-select' required></select>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a QB Item.
</div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QuickBooks Item:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Job Name:</label>
<select id="wcbqbitem" class='form-select'></select> <input id="edtjobname" class="form-control input-sm" style="width: 600px"/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Job Name.
</div>
</div>
<div class="row">
<div class="col-12">
<label for="edtitemdescription" class="form-label mt-2" style="font-weight: 700; font-size: 15px;">
Item Description:
</label>
<input id="edtitemdescription" class="form-control" style="width: 100%;" />
</div>
</div> </div>
</div> </div>
<h4 class="custom-h4 mt-3">General</h4> <h4 class="custom-h4 mt-3">General</h4>
......
...@@ -513,6 +513,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -513,6 +513,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_pdf' DataField = 'proofing_pdf'
DataSource = WebDataSource1 DataSource = WebDataSource1
ValueChecked = 'T'
end end
object edtPDFTo: TWebDBEdit object edtPDFTo: TWebDBEdit
Left = 444 Left = 444
...@@ -1311,7 +1312,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1311,7 +1312,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Items.Strings = ( Items.Strings = (
'Cromapro Ink Jet' 'Cromapro Ink Jet'
'Kodak Approval') 'Kodak Approval')
DataField = 'print_orientation_print_orient' DataField = 'proofing_color_contract'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object btnCopy: TWebButton object btnCopy: TWebButton
...@@ -1412,7 +1413,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1412,7 +1413,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
end end
object XDataWebDataSet1: TXDataWebDataSet object XDataWebDataSet1: TXDataWebDataSet
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 408 Left = 434
Top = 4 Top = 4
object XDataWebDataSet1inQuickBooks: TStringField object XDataWebDataSet1inQuickBooks: TStringField
FieldName = 'inQuickBooks' FieldName = 'inQuickBooks'
...@@ -1671,18 +1672,20 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1671,18 +1672,20 @@ object FOrderEntryWeb: TFOrderEntryWeb
object XDataWebDataSet1supplied_by_customer_b_w_or_co: TStringField object XDataWebDataSet1supplied_by_customer_b_w_or_co: TStringField
FieldName = 'supplied_by_customer_b_w_or_co' FieldName = 'supplied_by_customer_b_w_or_co'
end end
object XDataWebDataSet1InQuickbooks: TStringField
FieldName = 'InQuickbooks'
end
end end
object WebDataSource1: TWebDataSource object WebDataSource1: TWebDataSource
AutoEdit = False AutoEdit = False
DataSet = XDataWebDataSet1 DataSet = XDataWebDataSet1
Left = 406 Left = 398
Top = 38 Top = 56
end end
object wdsShipTo: TWebDataSource object wdsShipTo: TWebDataSource
AutoEdit = False
DataSet = xdwdsShipTo DataSet = xdwdsShipTo
Left = 320 Left = 318
Top = 38 Top = 54
end end
object xdwdsShipTo: TXDataWebDataSet object xdwdsShipTo: TXDataWebDataSet
Left = 322 Left = 322
...@@ -1692,10 +1695,9 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1692,10 +1695,9 @@ object FOrderEntryWeb: TFOrderEntryWeb
end end
end end
object wdsQBItem: TWebDataSource object wdsQBItem: TWebDataSource
AutoEdit = False
DataSet = xdwdsQBItem DataSet = xdwdsQBItem
Left = 244 Left = 240
Top = 34 Top = 52
end end
object xdwdsQBItem: TXDataWebDataSet object xdwdsQBItem: TXDataWebDataSet
Left = 246 Left = 246
......
...@@ -203,7 +203,7 @@ type ...@@ -203,7 +203,7 @@ type
btnAdd: TWebButton; btnAdd: TWebButton;
WebButton2: TWebButton; WebButton2: TWebButton;
lblFormState: TWebLabel; lblFormState: TWebLabel;
XDataWebDataSet1inQuickBooks: TStringField; XDataWebDataSet1InQuickbooks: TStringField;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
[async] procedure getOrder(Order_ID: string); [async] procedure getOrder(Order_ID: string);
[async] procedure getCustomer(customerID: string); [async] procedure getCustomer(customerID: string);
...@@ -560,6 +560,7 @@ begin ...@@ -560,6 +560,7 @@ begin
orderJSON.AddPair('COMPANY_ID', customerID); orderJSON.AddPair('COMPANY_ID', customerID);
orderJSON.AddPair('USER_ID', JS.toString(AuthService.TokenPayload.Properties['user_id'])); orderJSON.AddPair('USER_ID', JS.toString(AuthService.TokenPayload.Properties['user_id']));
orderJSON.AddPair('mode', mode); orderJSON.AddPair('mode', mode);
console.log(orderJSON);
if mode = 'EDIT' then if mode = 'EDIT' then
begin begin
orderJSON.AddPair('ORDER_ID', orderID); orderJSON.AddPair('ORDER_ID', orderID);
...@@ -594,7 +595,7 @@ begin ...@@ -594,7 +595,7 @@ begin
window.open(pdfURL, '_blank'); window.open(pdfURL, '_blank');
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not generate web order PDF: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
end; end;
...@@ -614,7 +615,7 @@ begin ...@@ -614,7 +615,7 @@ begin
mode := 'EDIT'; mode := 'EDIT';
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not save web order: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
end; end;
...@@ -776,7 +777,7 @@ var ...@@ -776,7 +777,7 @@ var
orderList : TJSObject; orderList : TJSObject;
i: integer; i: integer;
data: TJSArray; data: TJSArray;
order: TJSObject; order, customer: TJSObject;
callListLength: integer; callListLength: integer;
tempString, strColorList: string; tempString, strColorList: string;
colorObject: TJSObject; colorObject: TJSObject;
...@@ -869,21 +870,24 @@ begin ...@@ -869,21 +870,24 @@ begin
else else
dtpDigitalColorDate.Date := 0; dtpDigitalColorDate.Date := 0;
if mode = 'EDIT' then xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer',
begin [XDataWebDataSet1.FieldByName('COMPANY_ID').AsString]));
CustomerID := XDataWebDataSet1COMPANY_ID.AsString; customer := TJSObject(xdcResponse.Result);
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(order['ADDRESS_LIST']); xdwdsShipTo.Close;
xdwdsShipTo.Open; xdwdsShipTo.SetJSONData(customer['SHIPPING_ADDRESS_LIST']);
end; xdwdsShipTo.Open;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems',
[]));
items := TJSObject(xdcResponse.Result);
xdwdsQBItem.Close; xdwdsQBItem.Close;
items := TJSObject(order['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']); xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open; xdwdsQBITEM.Open;
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve order: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
end; end;
...@@ -908,11 +912,13 @@ begin ...@@ -908,11 +912,13 @@ begin
xdwdsShipTo.Close; xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(customer['ADDRESS_LIST']); xdwdsShipTo.SetJSONData(customer['SHIPPING_ADDRESS_LIST']);
xdwdsShipTo.Open; xdwdsShipTo.Open;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems',
[]));
items := TJSObject(xdcResponse.Result);
xdwdsQBItem.Close; xdwdsQBItem.Close;
items := TJSObject(customer['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']); xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open; xdwdsQBITEM.Open;
...@@ -943,6 +949,7 @@ end; ...@@ -943,6 +949,7 @@ end;
procedure TFOrderEntryWeb.EditMode; procedure TFOrderEntryWeb.EditMode;
begin begin
XDataWebDataSet1.Edit; XDataWebDataSet1.Edit;
FViewMain.change := true; FViewMain.change := true;
btnCopy.Enabled := false; btnCopy.Enabled := false;
btnPDF.Enabled := false; btnPDF.Enabled := false;
......
...@@ -128,6 +128,10 @@ object FViewOrders: TFViewOrders ...@@ -128,6 +128,10 @@ object FViewOrders: TFViewOrders
Title = 'Order Num' Title = 'Order Num'
end end
item item
DataField = 'IN_QB'
Title = 'In QB'
end
item
DataField = 'ID' DataField = 'ID'
Title = 'Customer ID' Title = 'Customer ID'
end end
...@@ -194,7 +198,7 @@ object FViewOrders: TFViewOrders ...@@ -194,7 +198,7 @@ object FViewOrders: TFViewOrders
item item
ElementClassName = 'text-nowrap' ElementClassName = 'text-nowrap'
DataField = 'qbRefNum' DataField = 'qbRefNum'
Title = 'QB Ref Num' Title = 'QB Order Num'
TitleElementClassName = 'min-w-80' TitleElementClassName = 'min-w-80'
end end
item item
...@@ -369,12 +373,15 @@ object FViewOrders: TFViewOrders ...@@ -369,12 +373,15 @@ object FViewOrders: TFViewOrders
object xdwdsOrdersprice: TStringField object xdwdsOrdersprice: TStringField
FieldName = 'price' FieldName = 'price'
end end
object xdwdsOrdersqbRefNum: TStringField
FieldName = 'qbRefNum'
end
object xdwdsOrderscolors: TStringField object xdwdsOrderscolors: TStringField
FieldName = 'colors' FieldName = 'colors'
end end
object xdwdsOrdersIN_QB: TStringField
FieldName = 'IN_QB'
end
object xdwdsOrdersqbRefNum: TStringField
FieldName = 'qbRefNum'
end
end end
object wdsOrders: TWebDataSource object wdsOrders: TWebDataSource
DataSet = xdwdsOrders DataSet = xdwdsOrders
...@@ -416,7 +423,7 @@ object FViewOrders: TFViewOrders ...@@ -416,7 +423,7 @@ object FViewOrders: TFViewOrders
object tmrReturn: TWebTimer object tmrReturn: TWebTimer
Enabled = False Enabled = False
OnTimer = tmrReturnTimer OnTimer = tmrReturnTimer
Left = 294 Left = 292
Top = 362 Top = 414
end end
end end
// Displays orders in the grid. Allows the user // Displays orders in the grid. Allows the user
// to sort the entries, filter their search, and search for a specific person. // to sort the entries, filter their search, and search for a specific person.
// Authors: // Authors:
// Cameron Hayes // Cameron Hayes
...@@ -35,7 +35,6 @@ type ...@@ -35,7 +35,6 @@ type
xdwdsOrdersshipDone: TStringField; xdwdsOrdersshipDone: TStringField;
xdwdsOrdersprice: TStringField; xdwdsOrdersprice: TStringField;
xdwdsOrdersID: TStringField; xdwdsOrdersID: TStringField;
xdwdsOrdersqbRefNum: TStringField;
xdwdsOrderscolors: TStringField; xdwdsOrderscolors: TStringField;
btnAddOrder: TWebButton; btnAddOrder: TWebButton;
btnSearch: TWebButton; btnSearch: TWebButton;
...@@ -58,6 +57,8 @@ type ...@@ -58,6 +57,8 @@ type
edtSearch: TWebEdit; edtSearch: TWebEdit;
xdwdsOrdersDBID: TStringField; xdwdsOrdersDBID: TStringField;
tmrReturn: TWebTimer; tmrReturn: TWebTimer;
xdwdsOrdersIN_QB: TStringField;
xdwdsOrdersqbRefNum: TStringField;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure btnAddOrderClick(Sender: TObject); procedure btnAddOrderClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject); procedure btnSearchClick(Sender: TObject);
...@@ -87,10 +88,12 @@ type ...@@ -87,10 +88,12 @@ type
PageNumber: integer; PageNumber: integer;
PageSize: integer; PageSize: integer;
TotalPages: integer; TotalPages: integer;
OrderID: string; statusOrderID: string; // used strictly for setting status.
OrderID: string; // used strictly for search string.
CompanyID: string; CompanyID: string;
JobName: string; JobName: string;
orderType: string; statusOrderType: string; // used strictly for setting status.
orderType: string; // used strictly for search string.on
//Status 1 //Status 1
StartDate1: string; StartDate1: string;
...@@ -174,7 +177,7 @@ begin ...@@ -174,7 +177,7 @@ begin
'</head>' + '</head>' +
'<body class="d-flex flex-column justify-content-center align-items-center vh-100 bg-light">' + '<body class="d-flex flex-column justify-content-center align-items-center vh-100 bg-light">' +
'<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"></div>' + '<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"></div>' +
'<div class="mt-3 fs-5 text-muted">Generating PDF, please wait</div>' + '<div class="mt-3 fs-5 text-muted">Generating PDF, please wait</div>' +
'</body>' + '</body>' +
'</html>' '</html>'
); );
...@@ -202,7 +205,7 @@ begin ...@@ -202,7 +205,7 @@ begin
'</head>' + '</head>' +
'<body class="d-flex flex-column justify-content-center align-items-center vh-100 bg-light">' + '<body class="d-flex flex-column justify-content-center align-items-center vh-100 bg-light">' +
'<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"></div>' + '<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"></div>' +
'<div class="mt-3 fs-5 text-muted">Generating PDF, please wait</div>' + '<div class="mt-3 fs-5 text-muted">Generating PDF, please wait</div>' +
'</body>' + '</body>' +
'</html>' '</html>'
); );
...@@ -233,8 +236,7 @@ begin ...@@ -233,8 +236,7 @@ begin
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
begin begin
Utils.ShowErrorModal('Could not generate report PDF: ' + Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
E.ErrorResult.ErrorMessage);
if Assigned(APdfTab) then if Assigned(APdfTab) then
APdfTab.close; // close the blank tab on failure APdfTab.close; // close the blank tab on failure
end; end;
...@@ -305,8 +307,8 @@ begin ...@@ -305,8 +307,8 @@ begin
wcbPageSize.Text := IntToStr(PageSize); wcbPageSize.Text := IntToStr(PageSize);
OrderBy := params.Values['orderby']; OrderBy := params.Values['orderby'];
wlcbOrderBy.DisplayText := OrderBy; wlcbOrderBy.DisplayText := OrderBy;
orderType := params.Values['orderType'].ToLower(); statusOrderType := params.Values['orderType'].ToLower();
OrderID := params.Values['orderID']; statusOrderID := params.Values['orderID'];
companyID := params.Values['companyID']; companyID := params.Values['companyID'];
jobName := params.Values['jobName']; jobName := params.Values['jobName'];
...@@ -442,7 +444,7 @@ begin ...@@ -442,7 +444,7 @@ begin
newForm.Popup := True; newForm.Popup := True;
newForm.Border := fbDialog; newForm.Border := fbDialog;
newForm.Position := poScreenCenter; newForm.Position := poScreenCenter;
newForm.OrderID := OrderID; newForm.OrderID := statusOrderID;
newForm.JobName := wdbtcOrders.Cells[3, row]; newForm.JobName := wdbtcOrders.Cells[3, row];
if wdbtcOrders.Cells[14, row] <> '' then if wdbtcOrders.Cells[14, row] <> '' then
newForm.ShipDue := StrToDateTime(wdbtcOrders.Cells[14, row]) newForm.ShipDue := StrToDateTime(wdbtcOrders.Cells[14, row])
...@@ -460,7 +462,7 @@ begin ...@@ -460,7 +462,7 @@ begin
newForm.ArtDue := StrToDateTime(wdbtcOrders.Cells[8, row]) newForm.ArtDue := StrToDateTime(wdbtcOrders.Cells[8, row])
else else
newForm.ArtDue := 0 ; newForm.ArtDue := 0 ;
newForm.OrderType := OrderType; newForm.OrderType := statusOrderType;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
window.location.hash := 'subform'; window.location.hash := 'subform';
...@@ -475,7 +477,7 @@ begin ...@@ -475,7 +477,7 @@ begin
begin begin
Utils.ShowSpinner('spinner'); Utils.ShowSpinner('spinner');
StatusJSON := TJSONObject.Create; StatusJSON := TJSONObject.Create;
StatusJSON.AddPair('ORDER_ID', OrderID); StatusJSON.AddPair('ORDER_ID', StatusOrderID);
StatusJSON.AddPair('date', DateTimeToStr(newform.dtpDate.Date)); StatusJSON.AddPair('date', DateTimeToStr(newform.dtpDate.Date));
StatusJSON.AddPair('status', newform.wlcbStatus.Value); StatusJSON.AddPair('status', newform.wlcbStatus.Value);
StatusJSON.AddPair('USER_ID', 1011); StatusJSON.AddPair('USER_ID', 1011);
...@@ -520,8 +522,8 @@ end; ...@@ -520,8 +522,8 @@ end;
procedure TFViewOrders.wdbtcOrdersClickCell(Sender: TObject; ACol, procedure TFViewOrders.wdbtcOrdersClickCell(Sender: TObject; ACol,
ARow: Integer); ARow: Integer);
begin begin
OrderID := wdbtcOrders.Cells[0, ARow]; statusOrderID := wdbtcOrders.Cells[0, ARow];
OrderType := wdbtcOrders.Cells[4, ARow]; statusOrderType := wdbtcOrders.Cells[5, ARow];
row := ARow; row := ARow;
end; end;
...@@ -529,7 +531,13 @@ procedure TFViewOrders.wdbtcOrdersDblClickCell(Sender: TObject; ACol, ...@@ -529,7 +531,13 @@ procedure TFViewOrders.wdbtcOrdersDblClickCell(Sender: TObject; ACol,
ARow: Integer); ARow: Integer);
begin begin
OrderID := wdbtcOrders.Cells[0, ARow]; OrderID := wdbtcOrders.Cells[0, ARow];
orderType := wdbtcOrders.Cells[4, ARow].Split([' '])[0]; orderType := wdbtcOrders.Cells[5, ARow].Split([' '])[0];
// Parameter 1: OrderID: The ID of the order, used when editting an existing order.
// Parameter 2: CustomerID: The ID of the customer, used when adding a new order. Blank when editting an existing order because the customer id is already attached to the order.
// Parameter 3: Mode: EDIT if editting an existing order, ADD if adding a new order.
// Parameter 4: orderType: Type of order so we go to the correct order entry page.
orderEntry(OrderID, '', 'EDIT', orderType); orderEntry(OrderID, '', 'EDIT', orderType);
end; end;
...@@ -771,7 +779,7 @@ begin ...@@ -771,7 +779,7 @@ begin
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve orders: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
finally finally
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
...@@ -788,9 +796,7 @@ end; ...@@ -788,9 +796,7 @@ end;
procedure TFViewOrders.OrderEntry(orderInfo, customerInfo, mode, orderType: string); procedure TFViewOrders.OrderEntry(orderInfo, customerInfo, mode, orderType: string);
begin begin
if orderType = 'corrugated' then if orderType = 'corrugated' then
begin FViewMain.ViewOrderEntryCorrugated(orderInfo, customerInfo, mode, '')
FViewMain.ViewOrderEntryCorrugated(orderInfo, customerInfo, mode, '');
end
else if orderType = 'web' then else if orderType = 'web' then
FViewMain.ViewOrderEntryWeb(orderInfo, customerInfo, mode, '') FViewMain.ViewOrderEntryWeb(orderInfo, customerInfo, mode, '')
else else
......
...@@ -53,6 +53,9 @@ type ...@@ -53,6 +53,9 @@ type
[Async] procedure SendCustomerToServer(); [Async] procedure SendCustomerToServer();
procedure PopulateGridManually(); procedure PopulateGridManually();
procedure ApplyFilter(); procedure ApplyFilter();
var
customerID: string;
msg: string;
public public
{ Public declarations } { Public declarations }
end; end;
...@@ -123,7 +126,7 @@ begin ...@@ -123,7 +126,7 @@ begin
PopulateGridManually; PopulateGridManually;
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve QuickBooks customers: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
end; end;
...@@ -211,9 +214,10 @@ begin ...@@ -211,9 +214,10 @@ begin
notification := TJSObject(Response.Result); notification := TJSObject(Response.Result);
customerID := string(notification['CustomerID']);
msg := string(notification['status']);
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
FViewMain.ViewAddCustomer(customerID, msg);
FViewMain.ViewAddCustomer(string(notification['CustomerID']), string(notification['status']));
Close(); Close();
end; end;
......
...@@ -65,7 +65,7 @@ begin ...@@ -65,7 +65,7 @@ begin
ShowToast('Failure: Please fill in all information') ShowToast('Failure: Please fill in all information')
else if ( ( OrderType = 'web plate' ) and ( wlcbStatus.Value = 'MOUNT' ) ) then else if ( ( OrderType = 'web plate' ) and ( wlcbStatus.Value = 'MOUNT' ) ) then
ShowToast('Failure: Web Plate Orders do not have Mount Due/Done dates') ShowToast('Failure: Web Plate Orders do not have Mount Due/Done dates')
else if ( ( OrderType = 'cutting die' ) and ( wlcbStatus.Value = 'MOUNT' ) or ( wlcbStatus.Value = 'ART' ) or (wlcbStatus.Value = 'PLATE') ) then else if ( ( OrderType = 'cutting die' ) and ( ( wlcbStatus.Value = 'MOUNT' ) or ( wlcbStatus.Value = 'ART' ) or (wlcbStatus.Value = 'PLATE') ) ) then
ShowToast('Failure: Cutting Die Orders do not have Art/Plate/Mount Due or Done Dates') ShowToast('Failure: Cutting Die Orders do not have Art/Plate/Mount Due or Done Dates')
else else
begin begin
...@@ -93,6 +93,7 @@ begin ...@@ -93,6 +93,7 @@ begin
dtpNewPlateDue.Date := 0; dtpNewPlateDue.Date := 0;
dtpNewArtDue.Date := 0; dtpNewArtDue.Date := 0;
ItemsToRemove := TStringList.Create; ItemsToRemove := TStringList.Create;
console.log(orderType);
if orderType = 'web plate' then if orderType = 'web plate' then
begin begin
dtpNewMountDue.Visible := false; dtpNewMountDue.Visible := false;
...@@ -100,7 +101,7 @@ begin ...@@ -100,7 +101,7 @@ begin
lblMount.Visible := false; lblMount.Visible := false;
lblMountNew.Visible := false; lblMountNew.Visible := false;
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done'); wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('Art', 'Art Done'); wlcbStatus.LookupValues.AddPair('ART', 'Art Done');
wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done'); wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done'); wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end end
...@@ -127,7 +128,7 @@ begin ...@@ -127,7 +128,7 @@ begin
else else
begin begin
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done'); wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('Art', 'Art Done'); wlcbStatus.LookupValues.AddPair('ART', 'Art Done');
wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done'); wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done');
wlcbStatus.LookupValues.AddPair('MOUNT', 'Mount Done'); wlcbStatus.LookupValues.AddPair('MOUNT', 'Mount Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done'); wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
......
...@@ -91,7 +91,7 @@ begin ...@@ -91,7 +91,7 @@ begin
FViewMain.ViewOrders(''); FViewMain.ViewOrders('');
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Error editing user: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
on E: Exception do on E: Exception do
Utils.ShowErrorModal('Unexpected error: ' + E.Message); Utils.ShowErrorModal('Unexpected error: ' + E.Message);
end; end;
...@@ -145,7 +145,7 @@ begin ...@@ -145,7 +145,7 @@ begin
chkAdminUser.Checked := boolean(user['admin']); chkAdminUser.Checked := boolean(user['admin']);
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve users: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
end; end;
......
...@@ -362,7 +362,7 @@ begin ...@@ -362,7 +362,7 @@ begin
GeneratePagination(TotalPages); GeneratePagination(TotalPages);
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve users: ' + E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
end; end;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<FrameworkType>VCL</FrameworkType> <FrameworkType>VCL</FrameworkType>
<MainSource>webKGOrders.dpr</MainSource> <MainSource>webKGOrders.dpr</MainSource>
<Base>True</Base> <Base>True</Base>
<Config Condition="'$(Config)'==''">Release</Config> <Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform> <Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms> <TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType> <AppType>Application</AppType>
......
...@@ -47,6 +47,7 @@ type ...@@ -47,6 +47,7 @@ type
name: string; name: string;
description: string; description: string;
status: string; status: string;
QB_ID: string;
end; end;
TItemList = class TItemList = class
...@@ -58,6 +59,7 @@ type ...@@ -58,6 +59,7 @@ type
TOrderItem = class TOrderItem = class
public public
DBID, DBID,
IN_QB,
ID, ID,
companyName, companyName,
jobName, jobName,
...@@ -134,9 +136,8 @@ type ...@@ -134,9 +136,8 @@ type
QB_LIST_ID: string; QB_LIST_ID: string;
FFAX: string; FFAX: string;
REP_USER_ID: string; REP_USER_ID: string;
ADDRESS_LIST: TList<TAddressItem>; SHIPPING_ADDRESS_LIST: TList<TAddressItem>;
ITEMS: TItemList; REP_USERS: TList<TUserItem>;
USERS: TList<TUserItem>
end; end;
TCustomerList = class TCustomerList = class
...@@ -352,12 +353,12 @@ type ...@@ -352,12 +353,12 @@ type
// Company // Company
COMPANY_ID: integer; ORDER_ID: integer;
COMPANY_ID: integer;
NAME: string; NAME: string;
SHORT_NAME: string; SHORT_NAME: string;
inQuickBooks: string; IN_QB: string;
ADDRESS_LIST: TList<TAddressItem>; QB_ORDER_NUM: string;
ITEMS: TItemList;
// Staff Fields: // Staff Fields:
staff_fields_order_date: string; staff_fields_order_date: string;
...@@ -481,7 +482,7 @@ type ...@@ -481,7 +482,7 @@ type
[HttpGet] function GetOrder(orderInfo: string): TFullOrder; [HttpGet] function GetOrder(orderInfo: string): TFullOrder;
[HttpGet] function GetWebOrder(orderInfo: string): TWebOrder; [HttpGet] function GetWebOrder(orderInfo: string): TWebOrder;
[HttpGet] function GetCuttingDieOrder(orderInfo: string): TCuttingDie; [HttpGet] function GetCuttingDieOrder(orderInfo: string): TCuttingDie;
[HttpGet] function GetCustomers(): TCustomerList; [HttpGet] function GetCustomers(customerInfo: string): TCustomerList;
[HttpGet] function GetCustomer(ID: string): TCustomerItem; [HttpGet] function GetCustomer(ID: string): TCustomerItem;
[HttpGet] function GenerateOrderListPDF(searchOptions: string): string; [HttpGet] function GenerateOrderListPDF(searchOptions: string): string;
[HttpGet] function GenerateOrderCorrugatedPDF(orderID: string): string; [HttpGet] function GenerateOrderCorrugatedPDF(orderID: string): string;
...@@ -489,6 +490,7 @@ type ...@@ -489,6 +490,7 @@ type
[HttpGet] function GenerateOrderCuttingPDF(orderID: string): string; [HttpGet] function GenerateOrderCuttingPDF(orderID: string): string;
[HttpGet] function getQBCustomers(): TJSONArray; [HttpGet] function getQBCustomers(): TJSONArray;
[HttpGet] function getQBItems(): TJSONArray; [HttpGet] function getQBItems(): TJSONArray;
[HttpGet] function GetRepUsers(): TList<TUserItem>;
function AddUser(userInfo: string): string; function AddUser(userInfo: string): string;
...@@ -505,6 +507,7 @@ type ...@@ -505,6 +507,7 @@ type
function SetStatus(statusOptions: string): string; function SetStatus(statusOptions: string): string;
function AddCustomer(customerInfo: string): TJSONObject; function AddCustomer(customerInfo: string): TJSONObject;
function ImportQBCustomer(CustomerInfo: string): TJSONObject; function ImportQBCustomer(CustomerInfo: string): TJSONObject;
function AddEstimate(orderInfo: string): TJSONObject;
end; end;
implementation implementation
......
...@@ -162,9 +162,8 @@ type ...@@ -162,9 +162,8 @@ type
procedure addEstimate(orderInfo: string); procedure addEstimate(orderInfo: string);
procedure getQBCustomers(); procedure getQBCustomers();
procedure ShowDeleteConfirm(msg: string); procedure ShowDeleteConfirm(msg: string);
procedure ShowLinkConfirm(msg: string);
procedure DeleteCustomers(); procedure DeleteCustomers();
procedure LinkCustomers(); procedure LinkCustomer();
end; end;
var var
...@@ -221,37 +220,39 @@ begin ...@@ -221,37 +220,39 @@ begin
else else
begin begin
msg := 'Are you sure you want to link QB ID: ' + QB_ID + ' with KG Orders ID: ' + ID; msg := 'Are you sure you want to link QB ID: ' + QB_ID + ' with KG Orders ID: ' + ID;
ShowLinkConfirm(msg); if MessageDlg(msg, mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
// User confirmed
LinkCustomer();
end
else
begin
// User canceled
ShowMessage('Cancelled.');
end;
end; end;
end; end;
procedure TfQB.LinkCustomers(); procedure TfQB.LinkCustomer();
var var
sql: string; sql: string;
begin begin
sql := 'select QB_LIST_ID from customers where CUSTOMER_ID = ' + ID; sql := 'select * from customers where CUSTOMER_ID = ' + ID;
Memo1.Lines.Add('SQL: ' + SQL);
doQuery(ordersDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Edit; if ordersDB.UniQuery1.RecordCount = 1 then
ordersDB.UniQuery1.FieldByName('QB_LIST_ID').AsString := QB_ID;
ordersDB.UniQuery1.Post;
getCustomers();
QB_ID := '';
ID := '';
end;
procedure TfQB.ShowLinkConfirm(msg: string);
begin
if MessageDlg(msg, mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin begin
// User confirmed ordersDB.UniQuery1.Edit;
LinkCustomers(); ordersDB.UniQuery1.FieldByName('QB_LIST_ID').AsString := QB_ID;
ordersDB.UniQuery1.Post;
getCustomers();
QB_ID := '';
ID := '';
end end
else else
begin MessageDlg('Wrong # of records return', mtConfirmation, [mbOk], 0)
// User canceled
ShowMessage('Cancelled.');
end;
end; end;
procedure TfQB.Button11Click(Sender: TObject); procedure TfQB.Button11Click(Sender: TObject);
var var
restClient: TRESTClient; restClient: TRESTClient;
...@@ -550,7 +551,7 @@ var ...@@ -550,7 +551,7 @@ var
orderJSON: TJSONObject; orderJSON: TJSONObject;
begin begin
orderJSON := TJSONObject.Create; orderJSON := TJSONObject.Create;
orderJSON.AddPair('ORDER_ID', '19814'); orderJSON.AddPair('ORDER_ID', '19842');
addEstimate(orderJSON.ToString); addEstimate(orderJSON.ToString);
end; end;
...@@ -591,6 +592,7 @@ var ...@@ -591,6 +592,7 @@ var
ORDER_ID: string; ORDER_ID: string;
table: string; table: string;
ShipMethodRef: TJSONObject; ShipMethodRef: TJSONObject;
unitPrice: double;
begin begin
BillAddrJSON := TJSONObject.Create; BillAddrJSON := TJSONObject.Create;
ShipAddrJSON := TJSONObject.Create; ShipAddrJSON := TJSONObject.Create;
...@@ -637,15 +639,15 @@ begin ...@@ -637,15 +639,15 @@ begin
; ;
estimateJSON.AddPair('CustomerRef', CustomerRefJSON); estimateJSON.AddPair('CustomerRef', CustomerRefJSON);
Lines := ordersDB.UniQuery1.FieldByName('staff_fields_invoice_to').AsString.Split([sLineBreak]); Lines := ordersDB.UniQuery1.FieldByName('staff_fields_invoice_to').AsString.Split([#10]);
for i := 0 to Length(Lines) - 2 do for i := 0 to Length(Lines) - 2 do
begin begin
case i of case i of
0: BillAddrJSON.AddPair('Line1', Lines[0]); 0: BillAddrJSON.AddPair('Line1', Lines[i].Trim.Replace(#13, '').Replace(#10, ''));
1: BillAddrJSON.AddPair('Line2', Lines[1]); 1: BillAddrJSON.AddPair('Line2', Lines[i].Trim.Replace(#13, '').Replace(#10, ''));
2: BillAddrJSON.AddPair('Line3', Lines[2]); 2: BillAddrJSON.AddPair('Line3', Lines[i].Trim.Replace(#13, '').Replace(#10, ''));
3: BillAddrJSON.AddPair('Line4', Lines[3]); 3: BillAddrJSON.AddPair('Line4', Lines[i].Trim.Replace(#13, '').Replace(#10, ''));
4: BillAddrJSON.AddPair('Line5', Lines[4]); 4: BillAddrJSON.AddPair('Line5', Lines[i].Trim.Replace(#13, '').Replace(#10, ''));
end; end;
end; end;
...@@ -700,7 +702,10 @@ begin ...@@ -700,7 +702,10 @@ begin
DetailObj.AddPair('ItemRef', ItemRefObj); DetailObj.AddPair('ItemRef', ItemRefObj);
DetailObj.AddPair('Qty', TJSONNumber.Create(ordersDB.UniQuery1.FieldByName('staff_fields_quantity').AsFloat)); DetailObj.AddPair('Qty', TJSONNumber.Create(ordersDB.UniQuery1.FieldByName('staff_fields_quantity').AsFloat));
DetailObj.AddPair('UnitPrice', TJSONNumber.Create(ordersDB.UniQuery1.FieldByName('staff_fields_price').AsFloat));
unitPrice := ordersDB.UniQuery1.FieldByName('staff_fields_price').AsFloat / ordersDB.UniQuery1.FieldByName('staff_fields_quantity').AsInteger;
DetailObj.AddPair('UnitPrice', TJSONNumber.Create(unitPrice));
LineObj.AddPair('SalesItemLineDetail', DetailObj); LineObj.AddPair('SalesItemLineDetail', DetailObj);
LineArray.AddElement(LineObj); LineArray.AddElement(LineObj);
......
...@@ -184,7 +184,6 @@ var ...@@ -184,7 +184,6 @@ var
items: TJSObject; 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(uqOrderCorrugated, SQL); doQuery(uqOrderCorrugated, SQL);
if ( string( uqOrderCorrugated.FieldByName('colors_colors').AsString ) ) <> '' then if ( string( uqOrderCorrugated.FieldByName('colors_colors').AsString ) ) <> '' then
...@@ -212,6 +211,7 @@ begin ...@@ -212,6 +211,7 @@ begin
ForceDirectories(ReportDir); ForceDirectories(ReportDir);
Logger.Log(5, 'Reports directory created: ' + ReportDir); Logger.Log(5, 'Reports directory created: ' + ReportDir);
end; end;
reportURL := 'reports/' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf'; reportURL := 'reports/' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf';
ReportFileName := reportDir + reportUrl; ReportFileName := reportDir + reportUrl;
......
...@@ -47,6 +47,75 @@ object rptOrderCutting: TrptOrderCutting ...@@ -47,6 +47,75 @@ object rptOrderCutting: TrptOrderCutting
DataSetOptions = [] DataSetOptions = []
Left = 444 Left = 444
Top = 206 Top = 206
FieldDefs = <
item
FieldName = 'ORDER_ID'
end
item
FieldName = 'COMPANY_ID'
end
item
FieldName = 'USER_ID'
end
item
FieldName = 'ORDER_DATE'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_order_date'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_proof_date'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_ship_date'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_ship_via'
FieldType = fftString
Size = 45
end
item
FieldName = 'staff_fields_quantity'
FieldType = fftString
end
item
FieldName = 'staff_fields_price'
FieldType = fftString
end
item
FieldName = 'staff_fields_invoice_to'
FieldType = fftString
Size = 128
end
item
FieldName = 'staff_fields_ship_to'
FieldType = fftString
Size = 128
end
item
FieldName = 'staff_fields_po_number'
FieldType = fftString
Size = 16
end
item
FieldName = 'staff_fields_job_name'
FieldType = fftString
Size = 45
end
item
FieldName = 'staff_fields_quickbooks_item'
FieldType = fftString
Size = 45
end
item
FieldName = 'general_special_instructions'
FieldType = fftString
Size = 2048
end>
end end
object frxOrderCutting: TfrxReport object frxOrderCutting: TfrxReport
Version = '2025.1.4' Version = '2025.1.4'
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
MemoLogLevel=3 MemoLogLevel=3
FileLogLevel=5 FileLogLevel=5
webClientVersion=0.9.7 webClientVersion=0.9.7
LogFileNum=821 LogFileNum=927
[Database] [Database]
--Server=192.168.159.153 Server=192.168.159.155
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
...@@ -17,6 +17,8 @@ Password=emsys01 ...@@ -17,6 +17,8 @@ Password=emsys01
CompanyID=9341454272655710 CompanyID=9341454272655710
ClientID=ABgO14uvjh8XqLud7spQ8lkb98AUpcdA7HbyMJfCAtl65sQ5yy ClientID=ABgO14uvjh8XqLud7spQ8lkb98AUpcdA7HbyMJfCAtl65sQ5yy
ClientSecret=bQ06TRemHeAGFzVHRaTUvUoBU9jpU9itK6MOMgqN ClientSecret=bQ06TRemHeAGFzVHRaTUvUoBU9jpU9itK6MOMgqN
RefreshToken=RT1-10-H0-1760618473k44t73jittvqlr4wynn6 RefreshToken=RT1-44-H0-1762010333a3v07cb5eb0luyn2rppm
AccessToken=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwieC5vcmciOiJIMCJ9..IwosInYT2Am8LdNGXuY-zQ._QdW6AZ0up2uAna580wQy7qAZPo3nkfHo0eeSpKllcJ_s69nh33Ld41MnTkxeAv1v1bxhvkDxEvkevfNGnggNHU3XSqIqb6tTKcAqR4zPf14JYgOkn82tw_q2VXWLgboMMpP6CfcBHeZPIbJcEOkmX5g4CY0NOum1-_beYmDHE2sxAxnKxcg3rhjBo33BTFjXSg1xknvkTO_GVbyAWdyZmQOpFRfdXAeUDnPAEZhYNVfACFkEDubdK7PyfcAs_7un_E0NZf270tMc2W0HTyk24wCSLbfeeH2Su-G2wi21JszcNsXSNt9ayGtHEXNcWG6A54k1M8U7o_mvpCXLPEXDtJkx8HnBvTz_ZXrFaztQf0_c8DLld5zW8FC1wn-SzHyoCbYbR2M6tBjVLiK80_FlAal_YjBI8fk9BX7nBab6LbCBIcunt7hRsLWCPiRI8_fwM_Nj8rlvxtIoClcyV7_VpIpxCVUgmxKmgf7zuWD3fYc3i8Bg-DpgGgWPVATXSlfNKhOWIDZfyy0YOlkreXPlNdQwCJ1Su3_3yzu_DioV76C5orqoeWk25NiopiAqJ7cBMj15EiuFx-w3jaqCv6ovzEc5r3by510TNu6msjUh2RQ-nxVqLjyLt6VIp3O00e_.2itJJ0rFwI-foW2v1hDSrw AccessToken=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwieC5vcmciOiJIMCJ9..7T78YBCSmvuJPRsZ9lGwuQ.1VJssLuNBAPKI7RAJOPluhtlA8DYgNcmXebNkWSxrHJ1949vjY4SPt5JjruuLsNOV09i_xKrQ76w9Zhjom1MiQaSyNoZHU-CZLfOtWgr9r3-gLxizdTlrTs9cEZs__8ep4_oe2r3n2u34QlM0xdVdLWxQbKYjpCl0k_58XPbS5Z_Vo2Y5qqoAuGJIRxMaTueMOH1ut-bV4Em318Ca1jN2DFCh_NYjLwFQQenWxOrCRMBaj7ZgB2yjtS5mEUxhuxsB7FAeONYqBSJ0OAy1yzWE-Ycxzt4dcZBCTHxzUCTH0-P0Mb_M6ivfmiYyKctf2gsZD8Xw91MgnF9TPwG8yXdej05fWr94VWeC3tFp0V-RYYv3_XRuim6fCvxJjWzfVEZwv9jUiZ6WByNSzu1k1W5_rQuSG7_Hs8WiDC1sBChJLfDclLO8pMoznqpSrM8ZmiNoYm4aZPQrpO6rgY8NiTokZRyeTw2adtW1YgDJsZdoEw.i2MSpKztX0v6UN0vZz5gQg
LastRefresh=7/7/2025 1:49:30 PM LastRefresh=7/23/2025 11:18:54 AM
--RefreshToken=RT1-10-H0-1760618473k44t73jittvqlr4wynn6
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