Commit 86de47e4 by cam

Made some changes discussed earlier

removed none from database, AddOrder table no longer changes on scroll, and hide filters now removes filters( we may want to add a seperate clear filters button instead )
parent 7b98cc6e
......@@ -9,13 +9,13 @@ uses
VCL.TMSFNCGridOptions, Vcl.Controls, VCL.TMSFNCCustomControl,
VCL.TMSFNCCustomScrollControl, VCL.TMSFNCGridData, VCL.TMSFNCCustomGrid,
VCL.TMSFNCGrid, Vcl.StdCtrls, WEBLib.StdCtrls, XData.Web.Client, Data.DB,
XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, ConnectionModule;
XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, ConnectionModule,
WEBLib.ExtCtrls;
type
TFAddOrder = class(TWebForm)
edtSearch: TWebEdit;
edtID: TWebEdit;
TMSFNCGrid1: TTMSFNCGrid;
cbCorrugatedPlate: TWebCheckBox;
cbWebPlate: TWebCheckBox;
btnCancel: TWebButton;
......@@ -29,13 +29,15 @@ type
xdwdsCustomersSHORT_NAME: TStringField;
wdsCustomers: TWebDataSource;
xdwdsCustomersADDRESS: TStringField;
WebPanel1: TWebPanel;
TMSFNCGrid1: TTMSFNCGrid;
procedure WebFormShow(Sender: TObject);
procedure TMSFNCGrid1SelectedCell(Sender: TObject; ACol, ARow: Integer);
procedure edtSearchChange(Sender: TObject);
procedure cbCorrugatedPlateClick(Sender: TObject);
procedure cbWebPlateClick(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
private
[async] procedure getCustomers;
procedure PopulateGridManually;
......@@ -43,6 +45,8 @@ type
{ Private declarations }
public
{ Public declarations }
var
confirm: boolean;
end;
var
......@@ -61,10 +65,13 @@ end;
procedure TFAddOrder.btnConfirmClick(Sender: TObject);
begin
Close;
confirm := true;
console.log(edtID.Text);
end;
procedure TFAddOrder.WebFormShow(Sender: TObject);
begin
confirm := false;
getCustomers();
end;
......@@ -146,8 +153,7 @@ end;
procedure TFAddOrder.TMSFNCGrid1SelectedCell(Sender: TObject; ACol,
ARow: Integer);
procedure TFAddOrder.TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
begin
edtID.Text := TMSFNCGrid1.Cells[0, ARow];
end;
......
......@@ -205,9 +205,11 @@ end;
procedure TFViewMain.ShowForm(AFormClass: TWebFormClass);
begin
console.log('ShowForm' + AFormClass.ClassName);
if Assigned(FChildForm) then
FChildForm.Free;
Application.CreateForm(AFormClass, WebPanel1.ElementID, FChildForm);
console.log(WebPanel1.ElementID);
end;
procedure TFViewMain.EditUser(Mode, Username, Password, Name, Status, Email,
......@@ -232,6 +234,7 @@ begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then
FChildForm.Free;
console.log('hit');
FChildForm := TFOrderEntry.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode);
end;
......
......@@ -370,11 +370,13 @@ var
localMode: string;
begin
localMode := mode;
console.log('') ;
Application.CreateForm(TFOrderEntry, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderEntry(AForm) do
begin
console.log('');
HideNotification;
TFOrderEntry(AForm).customerID := customerInfo;
TFOrderEntry(AForm).orderID := orderInfo;
......@@ -382,7 +384,7 @@ begin
end;
end
);
console.log('')
end;
procedure TFOrderEntry.addColorRow(num: string; Color: string; LPI: string; Size: string);
......
......@@ -148,50 +148,6 @@ object FViewOrders: TFViewOrders
TabStop = False
Text = ''
end
object pnlMessage: TWebPanel
Left = 82
Top = 352
Width = 125
Height = 33
ElementClassName = 'card'
ElementID = 'pnl_message'
ChildOrder = 5
ElementBodyClassName = 'card-body'
ElementFont = efCSS
ElementPosition = epRelative
Role = 'alert'
TabOrder = 7
object lblMessage: TWebLabel
Left = 32
Top = 11
Width = 42
Height = 13
Caption = 'Message'
ElementID = 'pnl_message'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementClassName = 'btn btn-light'
ElementID = 'view.login.message.button'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end
object WebButton1: TWebButton
Left = 188
Top = 79
......@@ -222,6 +178,44 @@ object FViewOrders: TFViewOrders
TabStop = False
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 52
Top = 248
Width = 121
Height = 33
ElementClassName = 'card'
ElementID = 'view.login.message'
ChildOrder = 17
ElementBodyClassName = 'card-body'
ElementFont = efCSS
TabOrder = 9
object lblMessage: TWebLabel
Left = 16
Top = 11
Width = 42
Height = 13
Caption = 'Message'
ElementID = 'view.login.message.label'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementClassName = 'btn btn-light'
ElementID = 'view.login.message.button'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 28
......@@ -285,6 +279,9 @@ object FViewOrders: TFViewOrders
object XDataWebDataSet1orderType: TStringField
FieldName = 'orderType'
end
object XDataWebDataSet1SQL: TStringField
FieldName = 'SQL'
end
end
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
......
<div class="container vh-100 d-flex flex-column pb-5" style="max-width: 80%;">
<!-- <div class="container vh-100 d-flex flex-column pb-5" style="max-width: 80%;"> -->
<!-- Alert Section -->
<div class="row">
<div class="col-sm">
<div id="pnl_message" class="alert alert-danger">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
</div>
<div class="row justify-content-center">
<div class="col-12 col-md-8">
<div class="row">
<div class=col-sm>
<div id="view.login.message" class="alert alert-danger">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
</div>
</div>
</div>
</div>
<!-- Filters Section -->
......@@ -125,5 +129,4 @@
</div>
</div>
</div>
</div>
......@@ -13,7 +13,7 @@ uses
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
XData.Web.JsonDataset, WEBLib.DB, Data.DB, XData.Web.Dataset, View.AddOrder;
XData.Web.JsonDataset, WEBLib.DB, Data.DB, XData.Web.Dataset;
type
TFViewOrders = class(TWebForm)
......@@ -46,9 +46,6 @@ type
XDataWebDataSet1plateDue: TStringField;
XDataWebDataSet1plateDone: TStringField;
XDataWebDataSet1orderType: TStringField;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
WebButton1: TWebButton;
WebButton2: TWebButton;
wdsCustomers: TWebDataSource;
......@@ -59,6 +56,10 @@ type
xdwdsSave: TXDataWebDataSet;
wdsSave: TWebDataSource;
xdwdsSaveCURR_ID: TIntegerField;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
XDataWebDataSet1SQL: TStringField;
procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
......@@ -101,7 +102,7 @@ var
implementation
uses
XData.Model.Classes, View.Main;
XData.Model.Classes, View.Main, View.AddOrder;
{$R *.dfm}
......@@ -179,8 +180,12 @@ begin
newform.ShowModal(
procedure(AValue: TModalResult)
begin
if newform.edtID.Text <> '' then
orderEntry('', newForm.edtID.Text, 'ADD');
console.log(newForm.edtID.Text);
if newform.confirm then
begin
if newform.edtID.Text <> '' then
orderEntry('', newForm.edtID.Text, 'ADD');
end;
end
);
end;
......@@ -214,7 +219,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order ID');
if XDataWebDataSet1ID.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1ID.Value;
NewRow.appendChild(Cell);
......@@ -223,7 +228,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Company Name');
if XDataWebDataSet1companyName.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1companyName.Value;
NewRow.appendChild(Cell);
......@@ -232,7 +237,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Job Name');
if XDataWebDataSet1jobName.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1jobName.Value;
NewRow.appendChild(Cell);
......@@ -241,7 +246,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order Date');
if XDataWebDataSet1orderDate.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1orderDate.Value;
NewRow.appendChild(Cell);
......@@ -250,7 +255,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Proof Due');
if XDataWebDataSet1proofDue.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1proofDue.Value;
NewRow.appendChild(Cell);
......@@ -259,7 +264,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Proof Done');
if XDataWebDataSet1proofDone.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1proofDone.Value;
NewRow.appendChild(Cell);
......@@ -268,7 +273,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Art Due');
if XDataWebDataSet1artDue.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1artDue.Value;
NewRow.appendChild(Cell);
......@@ -277,7 +282,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Art Done');
if XDataWebDataSet1artDone.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1artDone.Value;
NewRow.appendChild(Cell);
......@@ -286,7 +291,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Plate Due');
if XDataWebDataSet1plateDue.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1plateDue.Value;
NewRow.appendChild(Cell);
......@@ -295,7 +300,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Plate Done');
if XDataWebDataSet1plateDone.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1plateDone.Value;
NewRow.appendChild(Cell);
......@@ -304,7 +309,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Mount Due');
if XDataWebDataSet1mountDue.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1mountDue.Value;
NewRow.appendChild(Cell);
......@@ -313,7 +318,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Mount Done');
if XDataWebDataSet1mountDone.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1mountDone.Value;
NewRow.appendChild(Cell);
......@@ -322,7 +327,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Ship Due');
if XDataWebDataSet1shipDue.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1shipDue.Value;
NewRow.appendChild(Cell);
......@@ -340,7 +345,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Price');
if XDataWebDataSet1price.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1price.Value;
NewRow.appendChild(Cell);
......@@ -349,7 +354,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Quickbooks Reference Number');
if XDataWebDataSet1qbRefNum.Value = '' then
Cell.innerText := 'None'
//Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1qbRefNum.Value;
NewRow.appendChild(Cell);
......@@ -599,6 +604,7 @@ begin
XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(orderList['data']);
XDataWebDataSet1.Open;
console.log(XDataWebDataSet1SQL.AsString);
asm
setTimeout(endSpinner, 2000);
end;
......@@ -644,20 +650,26 @@ procedure TFViewOrders.btnApplyClick(Sender: TObject);
var
searchOptions: string;
begin
PageNumber := 1;
PageSize := 50;
OrderBy := wcbSortBy.Text;
searchOptions := '&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) +
'&orderby=' + OrderBy +
'&startDate=' + FormatDateTime('yyyy/mm/dd', dtpStartDate.Date) +
'&endDate=' + FormatDateTime('yyyy/mm/dd', dtpEndDate.Date) +
'&filterType=' + wcbSortBy.Text;
GetOrders(searchOptions);
if wcbSortBy.Text <> '' then
begin
PageNumber := 1;
PageSize := 50;
OrderBy := wcbSortBy.Text;
searchOptions := '&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) +
'&orderby=' + OrderBy +
'&startDate=' + FormatDateTime('yyyy/mm/dd', dtpStartDate.Date) +
'&endDate=' + FormatDateTime('yyyy/mm/dd', dtpEndDate.Date) +
'&filterType=' + wcbSortBy.Text;
GetOrders(searchOptions);
end
else
ShowNotification('Failure: Please Select a Status Type');
end;
procedure TFViewOrders.btnCloseNotificationClick(Sender: TObject);
begin
console.log('hit');
HideNotification();
end;
......@@ -681,6 +693,10 @@ begin
begin
btnFilters.Caption := 'Show Filters';
filterSection := TJSHTMLElement(document.getElementById('filter_info'));
{edtSearch.Text := '';
dtpStartDate.Date := 0;
dtpEndDate.Date := 0; }
getOrders(generateSearchOptions());
if Assigned(filterSection) then
filterSection.style.setProperty('display', 'none');
end;
......@@ -754,16 +770,35 @@ end;
procedure TFViewOrders.HideNotification;
begin
console.log('hit');
pnlMessage.ElementHandle.hidden := True;
info := '';
end;
procedure TFViewOrders.ShowNotification(Notification: string);
var
splitNotification: TArray<string>;
begin
if Notification <> '' then
begin
console.log('hit');
lblMessage.Caption := Notification;
splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False;
end;
end;
......
......@@ -67,5 +67,5 @@ begin
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDMConnection, DMConnection);
DMConnection.InitApp(@StartApplication, @UnauthorizedAccessProc);
//Application.Run;
Application.Run;
end.
......@@ -94,7 +94,6 @@
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
<TMSUseJSDebugger>2</TMSUseJSDebugger>
<TMSWebSingleInstance>1</TMSWebSingleInstance>
<TMSWebBrowser>5</TMSWebBrowser>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
......
......@@ -259,11 +259,13 @@ begin
begin
SQL := 'SELECT o.ORDER_ID, o.LOCATION AS Loc, c.NAME AS COMPANY_NAME, o.JOB_NAME, o.ORDER_DATE, o.ORDER_TYPE, '
end;
SQL := SQL + generateSubquery(filterType, statusType, 'PROOF');
SQL := SQL + generateSubquery(filterType, statusType, 'ART');
SQL := SQL + generateSubquery(filterType, statusType, 'PLATE');
SQL := SQL + generateSubquery(filterType, statusType, 'MOUNT');
SQL := SQL + generateSubquery(filterType, statusType, 'SHIP');
if filterType <> '' then
begin
whereSQL := 'FROM orders o join ' + statusTableLong + ' ' + statusTableShort +
......@@ -272,8 +274,12 @@ begin
'qb_sales_orders qb on qb.ORDER_ID = o.ORDER_ID ' +
'WHERE ' + statusTableShort + '.ORDER_ID = o.ORDER_ID AND + ' +
statusTableShort + '.ORDER_STATUS = '+ quotedStr(statusType) +
' AND ' + quotedStr(startDate) + ' <= '+ statusTableShort + '.STATUS_DATE AND ' +
quotedStr(endDate) + ' >= ' + statusTableShort + '.STATUS_DATE';
' AND ' + quotedStr(startDate) + ' <= '+ statusTableShort + '.STATUS_DATE ';
if endDate <> '1899/12/30' then
begin
whereSQL := whereSQL + 'AND ' + quotedStr(endDate) + ' >= ' + statusTableShort + '.STATUS_DATE';
end;
SQL := SQL + 'o.PRICE, qb.QB_REF_NUM ' + whereSQL + ' ORDER BY ' + filterType + ' DESC LIMIT ' + limit + ' OFFSET ' + offset;
end
......@@ -312,6 +318,7 @@ begin
order.price := ordersDB.UniQuery1.FieldByName('PRICE').AsString;
order.qbRefNum := ordersDB.UniQuery1.FieldByName('QB_REF_NUM').AsString;
order.orderType := ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString;
if ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString = 'web_plate' then
begin
......
[Settings]
MemoLogLevel=4
FileLogLevel=5
LogFileNum=24
LogFileNum=36
webClientVersion=1.0.0
[Database]
--Server=192.168.159.132
Server=192.168.198.131
Server=192.168.159.132
--Server=192.168.198.131
--Server=192.168.75.133
--Database=
--Username=
......
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