Commit afced290 by cam

Redisigned the search page

parent 9ddc1084
......@@ -43,6 +43,8 @@ type
{ Private declarations }
public
{ Public declarations }
var
confirm: boolean;
end;
var
......@@ -60,11 +62,13 @@ end;
procedure TFAddOrder.btnConfirmClick(Sender: TObject);
begin
confirm := true;
Close;
end;
procedure TFAddOrder.WebFormShow(Sender: TObject);
begin
confirm := false;
getCustomers();
end;
......
object FViewOrders: TFViewOrders
Width = 676
Height = 480
Caption = 'edtorderid'
CSSLibrary = cssBootstrap
ElementFont = efCSS
Font.Charset = DEFAULT_CHARSET
......@@ -9,6 +10,7 @@ object FViewOrders: TFViewOrders
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
Visible = True
OnCreate = WebFormCreate
OnShow = WebFormShow
object lblEntries: TWebLabel
......@@ -23,6 +25,18 @@ object FViewOrders: TFViewOrders
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblSearch: TWebLabel
Left = 594
Top = 116
Width = 47
Height = 13
Caption = 'Search = '
ElementID = 'lblsearch'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnAddOrder: TWebButton
Left = 59
Top = 79
......
......@@ -34,9 +34,14 @@
</div>
</div>
<!-- Entries Label Section -->
<div class="d-flex justify-content-between w-100 mt-2">
<label id="lblentries"></label>
<!-- Entries Label Section d-flex justify-content-between w-100 mt-2-->
<div class="row">
<div class="col text-start">
<label id="lblentries"></label>
</div>
<div class="col text-end">
<label id="lblsearch"></label>
</div>
</div>
<!-- Table Section -->
......
......@@ -58,6 +58,7 @@ type
wdbtcOrders: TWebDBTableControl;
wcbPageSize: TWebComboBox;
wlcbOrderBy: TWebLookupComboBox;
lblSearch: TWebLabel;
procedure WebFormCreate(Sender: TObject);
procedure btnAddOrderClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
......@@ -86,6 +87,10 @@ type
PageNumber: integer;
PageSize: integer;
TotalPages: integer;
OrderID: string;
CompanyID: string;
JobName: string;
orderType: string;
//Status 1
StartDate1: string;
......@@ -100,10 +105,6 @@ type
null2: boolean;
OrderBy: string;
fieldType: string;
searchString: string;
orderType: string;
filters: boolean;
info: string;
public
......@@ -162,8 +163,6 @@ begin
filterType2 := '';
null2 := false;
fieldType := '';
searchString := '';
orderType := '';
//today := TDateTime.Today;
......@@ -237,7 +236,7 @@ begin
newform.ShowModal(
procedure(AValue: TModalResult)
begin
if newform.edtID.Text <> '' then
if newform.confirm then
orderEntry('', newForm.edtID.Text, 'ADD');
end
);
......@@ -252,6 +251,7 @@ begin
newform.Caption := 'Input Search Options';
newForm.Popup := True;
newForm.Border := fbDialog;
newForm.searchOptions := generateSearchOptions();
// used to manage Back button handling to close subform
window.location.hash := 'subform';
......@@ -277,11 +277,14 @@ begin
filterType2 := newform.wcbFilterType2.Text;
null2 := newform.cbNull2.Checked;
fieldType := newform.wcbFieldType.Text;
searchString := newform.edtSearch.Text;
jobName := newform.edtJobName.Text;
orderID := newform.edtOrderID.Text;
companyID := newform.edtCompanyID.Text;
orderType := newform.wcbOrderType.Text;
getOrders(GenerateSearchOptions());
searchOptions := generateSearchOptions();
lblSearch.Caption := searchOptions;
getOrders(searchOptions);
end;
end
);
......@@ -650,9 +653,11 @@ begin
'&filterType2=' + filterType2 +
'&null2=' + BoolToStr(null2) +
'&fieldType=' + fieldType +
'&search=' + searchString +
'&orderType=' + orderType;
'&orderType=' + orderType +
'&jobName=' + jobName +
'&companyID=' + companyID +
'&orderID=' + orderID;
Result := searchOptions;
end;
......
......@@ -7,82 +7,206 @@ object FSearch: TFSearch
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Visible = True
OnShow = WebFormShow
object lblStatus1: TWebLabel
Left = 18
Top = 44
Width = 43
Left = 8
Top = 422
Width = 47
Height = 14
Caption = 'Status 1:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblType1: TWebLabel
Left = 18
Top = 64
Width = 26
Left = 8
Top = 442
Width = 29
Height = 14
Caption = 'Type:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblStartDate1: TWebLabel
Left = 178
Top = 64
Width = 51
Left = 200
Top = 442
Width = 56
Height = 14
Caption = 'Start Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblEndDate1: TWebLabel
Left = 276
Top = 64
Width = 43
Left = 384
Top = 442
Width = 47
Height = 14
Caption = 'End Date'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblStatus2: TWebLabel
Left = 18
Top = 132
Width = 43
Left = 8
Top = 496
Width = 47
Height = 14
Caption = 'Status 2:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblType2: TWebLabel
Left = 18
Top = 158
Width = 26
Left = 10
Top = 516
Width = 29
Height = 14
Caption = 'Type:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblStartDate2: TWebLabel
Left = 178
Top = 158
Width = 51
Left = 200
Top = 516
Width = 56
Height = 14
Caption = 'Start Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblEndDate2: TWebLabel
Left = 276
Top = 158
Width = 43
Left = 384
Top = 516
Width = 47
Height = 14
Caption = 'End Date'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel1: TWebLabel
Left = 20
Top = 8
Width = 48
Height = 14
Caption = 'Order ID:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 20
Top = 56
Width = 107
Height = 14
Caption = 'Search Companies:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblCompanyID: TWebLabel
Left = 174
Top = 56
Width = 68
Height = 14
Caption = 'Company ID:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 8
Top = 368
Width = 57
Height = 14
Caption = 'Job Name:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel4: TWebLabel
Left = 174
Top = 368
Width = 64
Height = 14
Caption = 'Order Type:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 102
Top = 515
Left = 92
Top = 637
Width = 121
Height = 33
ElementClassName = 'card'
......@@ -94,7 +218,7 @@ object FSearch: TFSearch
Role = 'alert'
TabOrder = 0
object lblMessage: TWebLabel
Left = 22
Left = 26
Top = 11
Width = 44
Height = 14
......@@ -124,12 +248,12 @@ object FSearch: TFSearch
end
end
object wcbFilterType1: TWebComboBox
Left = 18
Top = 88
Left = 8
Top = 462
Width = 145
Height = 22
ElementClassName = 'custom-select'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 4
TabStop = False
......@@ -137,6 +261,7 @@ object FSearch: TFSearch
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'NONE'
'PROOF DUE'
'PROOF DONE'
'ART DUE'
......@@ -149,12 +274,13 @@ object FSearch: TFSearch
'SHIP DONE')
end
object btnConfirm: TWebButton
Left = 18
Top = 307
Left = 65
Top = 579
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
......@@ -163,57 +289,76 @@ object FSearch: TFSearch
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object edtSearch: TWebEdit
Left = 180
Top = 264
Width = 121
object edtOrderID: TWebEdit
Left = 20
Top = 28
Width = 145
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
HeightStyle = ssAuto
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object dtpStartDate1: TWebDateTimePicker
Left = 178
Top = 88
Width = 85
Left = 200
Top = 462
Width = 127
Height = 22
ElementClassName = 'custom-select'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
Color = clWhite
Date = 45553.505972858790000000
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Role = ''
TabOrder = 2
TabStop = False
Text = ''
end
object dtpEndDate1: TWebDateTimePicker
Left = 276
Top = 88
Width = 87
Left = 384
Top = 462
Width = 135
Height = 22
ElementClassName = 'custom-select'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
Color = clWhite
Date = 45553.505972858790000000
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Role = ''
TabOrder = 3
TabStop = False
Text = ''
end
object cbNull1: TWebCheckBox
Left = 384
Top = 88
Left = 566
Top = 462
Width = 185
Height = 22
Caption = 'Only Show Empty'
......@@ -221,50 +366,27 @@ object FSearch: TFSearch
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object wcbFieldType: TWebComboBox
Left = 18
Top = 264
Width = 145
Height = 22
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'Order ID'
'Company Name'
'Company Short Name'
'Job Name')
end
object wcbOrderType: TWebComboBox
Left = 320
Top = 264
Left = 174
Top = 388
Width = 145
Height = 22
ElementClassName = 'custom-select'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'Corrugated'
'Web')
end
object btnCancel: TWebButton
Left = 144
Top = 307
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
'Web'
'Any')
end
object wcbFilterType2: TWebComboBox
Left = 18
Top = 194
Left = 10
Top = 536
Width = 145
Height = 22
ElementClassName = 'custom-select'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 4
TabStop = False
......@@ -272,6 +394,7 @@ object FSearch: TFSearch
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'NONE'
'PROOF DUE'
'PROOF DONE'
'ART DUE'
......@@ -284,10 +407,11 @@ object FSearch: TFSearch
'SHIP DONE')
end
object dtpStartDate2: TWebDateTimePicker
Left = 178
Top = 194
Width = 85
Left = 200
Top = 536
Width = 127
Height = 22
ElementClassName = 'custom-select'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
......@@ -300,10 +424,11 @@ object FSearch: TFSearch
Text = ''
end
object dtpEndDate2: TWebDateTimePicker
Left = 276
Top = 194
Width = 87
Left = 384
Top = 536
Width = 135
Height = 22
ElementClassName = 'custom-select'
HeightStyle = ssAuto
BorderStyle = bsSingle
ChildOrder = 7
......@@ -316,8 +441,8 @@ object FSearch: TFSearch
Text = ''
end
object cbNull2: TWebCheckBox
Left = 384
Top = 194
Left = 566
Top = 536
Width = 185
Height = 22
Caption = 'Only Show Empty'
......@@ -325,4 +450,285 @@ object FSearch: TFSearch
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 20
Top = 112
Width = 865
Height = 233
ParentDoubleBuffered = False
DoubleBuffered = True
TabOrder = 12
DefaultRowHeight = 40.000000000000000000
FixedColumns = 0
ColumnCount = 4
Options.Bands.Enabled = True
Options.ColumnSize.Stretch = True
Options.Editing.CalcFormat = '%g'
Options.Grouping.CalcFormat = '%g'
Options.Grouping.GroupCountFormat = '(%d)'
Options.IO.XMLEncoding = 'ISO-8859-1'
Options.Mouse.ClickMargin = 0
Options.Mouse.ColumnSizeMargin = 6
Options.Mouse.RowSizeMargin = 6
Columns = <
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 70.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 250.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 100.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 426.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 90.000000000000000000
end>
DefaultFont.Charset = DEFAULT_CHARSET
DefaultFont.Color = clWindowText
DefaultFont.Height = -11
DefaultFont.Name = 'Segoe UI'
DefaultFont.Style = []
TopRow = 1
Appearance.FixedLayout.Fill.Color = 16380654
Appearance.FixedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FixedLayout.Font.Color = 4539717
Appearance.FixedLayout.Font.Height = -13
Appearance.FixedLayout.Font.Name = 'Segoe UI'
Appearance.FixedLayout.Font.Style = [fsBold]
Appearance.NormalLayout.Fill.Color = 16578806
Appearance.NormalLayout.Font.Charset = DEFAULT_CHARSET
Appearance.NormalLayout.Font.Color = 8026746
Appearance.NormalLayout.Font.Height = -11
Appearance.NormalLayout.Font.Name = 'Segoe UI'
Appearance.NormalLayout.Font.Style = []
Appearance.GroupLayout.Fill.Color = 12817262
Appearance.GroupLayout.Font.Charset = DEFAULT_CHARSET
Appearance.GroupLayout.Font.Color = clBlack
Appearance.GroupLayout.Font.Height = -11
Appearance.GroupLayout.Font.Name = 'Segoe UI'
Appearance.GroupLayout.Font.Style = []
Appearance.SummaryLayout.Fill.Color = 14009785
Appearance.SummaryLayout.Font.Charset = DEFAULT_CHARSET
Appearance.SummaryLayout.Font.Color = clBlack
Appearance.SummaryLayout.Font.Height = -11
Appearance.SummaryLayout.Font.Name = 'Segoe UI'
Appearance.SummaryLayout.Font.Style = []
Appearance.SelectedLayout.Fill.Color = 16441019
Appearance.SelectedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.SelectedLayout.Font.Color = 4539717
Appearance.SelectedLayout.Font.Height = -11
Appearance.SelectedLayout.Font.Name = 'Segoe UI'
Appearance.SelectedLayout.Font.Style = []
Appearance.FocusedLayout.Fill.Color = 16039284
Appearance.FocusedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FocusedLayout.Font.Color = 4539717
Appearance.FocusedLayout.Font.Height = -11
Appearance.FocusedLayout.Font.Name = 'Segoe UI'
Appearance.FocusedLayout.Font.Style = []
Appearance.FixedSelectedLayout.Fill.Color = clLightsteelblue
Appearance.FixedSelectedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FixedSelectedLayout.Font.Color = clBlack
Appearance.FixedSelectedLayout.Font.Height = -11
Appearance.FixedSelectedLayout.Font.Name = 'Segoe UI'
Appearance.FixedSelectedLayout.Font.Style = []
Appearance.BandLayout.Fill.Color = 16711679
Appearance.BandLayout.Font.Charset = DEFAULT_CHARSET
Appearance.BandLayout.Font.Color = 8026746
Appearance.BandLayout.Font.Height = -11
Appearance.BandLayout.Font.Name = 'Segoe UI'
Appearance.BandLayout.Font.Style = []
Appearance.ProgressLayout.Format = '%.0f%%'
LeftCol = 0
ScrollMode = scmItemScrolling
DesignTimeSampleData = True
OnCellClick = TMSFNCGrid1CellClick
end
object edtSearch: TWebEdit
Left = 20
Top = 76
Width = 145
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end
object edtCompanyID: TWebEdit
Left = 174
Top = 76
Width = 145
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtJobName: TWebEdit
Left = 8
Top = 388
Width = 145
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end
object btnCancel: TWebButton
Left = 171
Top = 579
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 5
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object btnClear: TWebButton
Left = 279
Top = 579
Width = 96
Height = 25
Caption = 'Clear'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 5
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnClearClick
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 738
Top = 61
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 608
Top = 63
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object xdwdsCustomersADDRESS: TStringField
FieldName = 'ADDRESS'
Size = 100
end
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 476
Top = 61
end
end
......@@ -8,7 +8,10 @@ uses
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, WEBLib.Grids,
Vcl.Grids;
Vcl.Grids, VCL.TMSFNCTypes, VCL.TMSFNCUtils, VCL.TMSFNCGraphics,
VCL.TMSFNCGraphicsTypes, VCL.TMSFNCGridCell, VCL.TMSFNCGridOptions,
VCL.TMSFNCCustomControl, VCL.TMSFNCCustomScrollControl, VCL.TMSFNCGridData,
VCL.TMSFNCCustomGrid, VCL.TMSFNCGrid;
type
TFSearch = class(TWebForm)
......@@ -17,13 +20,11 @@ type
btnCloseNotification: TWebButton;
wcbFilterType1: TWebComboBox;
btnConfirm: TWebButton;
edtSearch: TWebEdit;
edtOrderID: TWebEdit;
dtpStartDate1: TWebDateTimePicker;
dtpEndDate1: TWebDateTimePicker;
cbNull1: TWebCheckBox;
wcbFieldType: TWebComboBox;
wcbOrderType: TWebComboBox;
btnCancel: TWebButton;
lblStatus1: TWebLabel;
lblType1: TWebLabel;
lblStartDate1: TWebLabel;
......@@ -36,15 +37,42 @@ type
lblType2: TWebLabel;
lblStartDate2: TWebLabel;
lblEndDate2: TWebLabel;
WebLabel1: TWebLabel;
WebLabel2: TWebLabel;
TMSFNCGrid1: TTMSFNCGrid;
edtSearch: TWebEdit;
edtCompanyID: TWebEdit;
lblCompanyID: TWebLabel;
XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet;
xdwdsCustomersID: TIntegerField;
xdwdsCustomersNAME: TStringField;
xdwdsCustomersSHORT_NAME: TStringField;
xdwdsCustomersADDRESS: TStringField;
wdsCustomers: TWebDataSource;
WebLabel3: TWebLabel;
edtJobName: TWebEdit;
WebLabel4: TWebLabel;
btnCancel: TWebButton;
btnClear: TWebButton;
procedure btnConfirmClick(Sender: TObject);
procedure WebFormShow(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure edtSearchChange(Sender: TObject);
procedure TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
procedure btnClearClick(Sender: TObject);
private
//FJSONProc: TJSONProc;
[async] procedure getCustomers;
procedure PopulateGridManually;
procedure ApplyFilter;
var
temp: string;
public
class function CreateForm(AElementID: string): TWebForm;
var
confirm: boolean;
searchOptions: string;
end;
var
......@@ -67,13 +95,74 @@ begin
);
end;
procedure TFSearch.edtSearchChange(Sender: TObject);
begin
ApplyFilter;
end;
procedure TFSearch.WebFormShow(Sender: TObject);
var
params: TStringList;
DateFormatSettings: TFormatSettings;
begin
dtpStartDate1.Date := 0;
dtpEndDate1.Date := 0;
dtpStartDate1.Date := 0;
dtpEndDate1.Date := 0;
params := TStringList.Create;
params.StrictDelimiter := true;
params.Delimiter := '&';
params.DelimitedText := searchOptions;
confirm := false;
DateFormatSettings := TFormatSettings.Create;
DateFormatSettings.ShortDateFormat := 'yyyy/mm/dd';
wcbOrderType.Text := UpperCase(Copy(params.Values['orderType'], 1, 1)) + LowerCase(Copy(params.Values['orderType'], 2, MaxInt));
edtOrderID.Text := params.Values['orderID'];
edtCompanyID.Text := params.Values['companyID'];
edtJobName.Text := params.Values['jobName'];
// Status 1
if params.Values['filterType1'] <> '' then
wcbFilterType1.Text := params.Values['filterType1']
else
wcbFilterType1.Text := 'NONE';
console.log(params.Values['startDate1']);
if params.Values['startDate1'] = '' then
dtpStartDate1.Date := 0
else
begin
dtpStartDate1.Date := StrToDateTime(params.Values['startDate1'], DateFormatSettings);
end;
if params.Values['endDate1'] = '' then
dtpEndDate1.Date := 0
else
dtpEndDate1.Date := StrToDateTime(params.Values['endDate1'], DateFormatSettings);
if params.values['null1'] <> '' then
cbNull1.Checked := StrToBool(params.Values['null1']);
// Status 2
if params.Values['filterType2'] <> '' then
wcbFilterType2.Text := params.Values['filterType2']
else
wcbFilterType2.Text := 'NONE';
if params.Values['startDate2'] = '1899/12/30' then
dtpStartDate2.Date := 0
else
dtpStartDate2.Date := StrToDateTime(params.Values['startDate2'], DateFormatSettings);
if params.Values['endDate2'] = '1899/12/30' then
dtpEndDate2.Date := 0
else
dtpEndDate2.Date := StrToDateTime(params.Values['endDate2'], DateFormatSettings);
if params.values['null2'] <> '' then
cbNull1.Checked := StrToBool(params.Values['null2']);
params.Free;
getCustomers();
end;
procedure TFSearch.btnCancelClick(Sender: TObject);
......@@ -81,11 +170,123 @@ begin
Close;
end;
procedure TFSearch.btnClearClick(Sender: TObject);
begin
edtOrderID.Text := '';
edtCompanyID.Text := '';
edtSearch.Text := '';
edtJobName.Text := '';
wcbOrderType.Text := 'Any';
wcbFilterType1.Text := 'NONE';
dtpStartDate1.Date := 0;
dtpEndDate1.Date := 0;
cbNull1.Checked := False;
wcbFilterType2.Text := 'NONE';
dtpStartDate2.Date := 0;
dtpEndDate2.Date := 0;
cbNull2.Checked := false;
end;
procedure TFSearch.btnConfirmClick(Sender: TObject);
begin
confirm := true;
Close;
end;
[async] procedure TFSearch.getCustomers();
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
begin
// Fetch data from XData service
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomers', []));
customerList := TJSObject(xdcResponse.Result);
// Load data into TXDataWebDataset
xdwdsCustomers.Close;
xdwdsCustomers.SetJsonData(customerList['data']);
xdwdsCustomers.Open;
// Manually populate the grid
PopulateGridManually;
end;
procedure TFSearch.TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
begin
edtCompanyID.Text := TMSFNCGrid1.Cells[0, ARow];
end;
procedure TFSearch.PopulateGridManually;
var
RowIndex: Integer;
begin
TMSFNCGrid1.BeginUpdate;
try
TMSFNCGrid1.Clear; // Clear any existing data
// Set up column headers
TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'ID';
TMSFNCGrid1.Cells[1, 0] := 'Short Name';
TMSFNCGrid1.Cells[2, 0] := 'Name';
TMSFNCGrid1.Cells[3, 0] := 'Address';
// TMSFNCGrid1.ColumnWidths[0] := 40;
// TMSFNCGrid1.ColumnWidths[1] := 80;
// TMSFNCGrid1.ColumnWidths[2] := 250;
// Populate the grid with data from the dataset
xdwdsCustomers.First;
RowIndex := 1;
while not xdwdsCustomers.EOF do
begin
TMSFNCGrid1.RowCount := RowIndex + 1;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('ID').AsString;
TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('SHORT_NAME').AsString;
TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('NAME').AsString;
TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('ADDRESS').AsString;
Inc(RowIndex);
xdwdsCustomers.Next;
end;
finally
TMSFNCGrid1.EndUpdate;
end;
end;
procedure TFSearch.ApplyFilter;
var
fd: TTMSFNCGridFilterData;
i: Integer;
SearchText: string;
begin
SearchText := Trim(edtSearch.Text);
TMSFNCGrid1.RemoveFilter;
TMSFNCGrid1.Filter.Clear;
// match on first 3 columns
for i := 0 to 2 do
begin
fd := TMSFNCGrid1.Filter.Add;
fd.Column := i;
fd.Condition := '*' + SearchText + '*'; // Match text anywhere in the cell
fd.CaseSensitive := False; // Make the filter case-insensitive
// Use foOR for "match any column" logic
if i > 0 then
fd.Operation := foOR
else
fd.Operation := foNONE; // First filter has no logical operation
end;
// Apply the filters to the grid
TMSFNCGrid1.ApplyFilter;
end;
end.
......@@ -14,6 +14,16 @@ input[type="text"] {
padding-left: 5px;
}
.input-search input {
width: 100px; /* Adjust the width of the input */
height: 35px; /* Set the height to match label height */
padding: 5px; /* Padding for input text */
font-size: 14px; /* Font size for input text */
border: 1px solid #ced4da; /* Border style */
border-radius: 5px; /* Rounded corners for the input */
box-sizing: border-box; /* Ensures padding and border are included in the element's total width and height */
}
.card-header {
width: 100%;
text-align: left; /* Align text to the left */
......
......@@ -46,7 +46,6 @@ type
function EditStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: string): string;
function generateOrdersSQL(searchOptions: string): TSQLQuery;
function getColorCount(colors: string): string;
function generateSearchSQL(FieldType, search: string): string;
function generateStatusSelectSQL(statusTableShort, statusTableLong, startDate, endDate, statusType: string): string;
function generateStatusWhereSQL(status: TStatusSearchInfo): string;
function createStatusSearchInfo(params: TStringList; statusNum: string): TStatusSearchInfo;
......@@ -209,34 +208,6 @@ begin
quotedStr(currStatus) + ' order by os.STATUS_TIMESTAMP desc LIMIT 1) AS ' + currStatus + '_DONE, ';
end;
function TLookupService.generateSearchSQL(FieldType: string; search: string): string;
var
shortTable: string;
fieldName: string;
SQL: string;
comparison: string;
begin
if FieldType = 'Company Name' then
begin
SQL := 'c.NAME LIKE ' + quotedStr('%' + search + '%');
end
else if FieldType = 'Company Short Name' then
begin
SQL := 'c.SHORT_NAME LIKE ' + quotedStr('%' + search + '%');
end
else if FieldType = 'Order ID' then
begin
SQL := 'o.ORDER_ID = ' + search;
end
else if FieldType = 'Job Name' then
begin
SQL := 'o.JOB_NAME LIKE ' + quotedStr('%' + search + '%');
end;
result := SQL;
end;
function TLookupService.generateStatusSelectSQL(statusTableShort: string; statusTableLong: string; startDate: string; endDate: string; statusType: string): string;
begin
result := 'exists ( select 1 from ' + statusTableLong + ' ' +
......@@ -265,7 +236,7 @@ begin
result.statusType := '';
result.filterType := '';
result.statusSuffix := '';
if params.Values['filterType' + statusNum] <> '' then
if ( ( params.Values['filterType' + statusNum] <> '' ) and ( params.Values['filterType' + statusNum] <> 'NONE' ) ) then
begin
result.statusType := params.Values['filterType' + statusNum].Split([' '])[0];
result.statusSuffix := params.Values['filterType' + statusNum].Split([' '])[1];
......@@ -318,15 +289,17 @@ var
whereSQL: string;
orderBySQL: string;
OrderID: string;
CompanyID: string;
JobName: string;
orderType: string;
// These variables apply to the first status sent from the client
status1: TStatusSearchInfo;
// These variables apply to the second status sent from the client
status2: TStatusSearchInfo;
fieldType: string;
search: string;
orderType: string;
begin
result := TSQLQuery.Create;
params := TStringList.Create;
......@@ -339,9 +312,10 @@ begin
PageNum := StrToInt(params.Values['pagenumber']);
PageSize := StrToInt(params.Values['pagesize']);
OrderBy := params.Values['orderby'];
fieldType := params.Values['fieldType'];
search := params.Values['search'];
orderType := params.Values['orderType'].ToLower();
OrderID := params.Values['orderID'];
companyID := params.Values['companyID'];
jobName := params.Values['jobName'];
// Search infomation for first status type
status1 := createStatusSearchInfo(params, '1');
......@@ -365,18 +339,26 @@ begin
whereSQL := 'from orders o join customers c on ' +
'c.CUSTOMER_ID = o.COMPANY_ID left join qb_sales_orders qb on qb.ORDER_ID = o.ORDER_ID where 0 = 0';
if status1.filterType <> '' then
if ( ( status1.filterType <> '' ) and ( status1.filterType <> 'NONE' ) ) then
whereSQL := whereSQL + generateStatusWhereSQL(status1);
if status2.filterType <> '' then
if ( (status2.filterType <> '' ) and ( status2.filterType <> 'NONE' ) ) then
whereSQL := whereSQL + generateStatusWhereSQL(status2);
if ( (fieldType <> '') and (search <> '') ) then
whereSQL := whereSQL + ' AND ' + generateSearchSQL(fieldType, search);
if orderType <> '' then
if ( ( orderType <> '' ) and ( orderType <> 'any' ) ) then
whereSQL := whereSQL + ' AND o.ORDER_TYPE = ' + quotedStr(orderType + '_plate');
if orderID <> '' then
whereSQL := whereSQL + ' AND o.ORDER_ID = ' + orderID;
if companyID <> '' then
whereSQL := whereSQL + ' AND c.CUSTOMER_ID = ' + companyID;
if jobName <> '' then
whereSQL := whereSQL + ' AND o.JOB_NAME = ' + quotedStr(jobName);
orderBySQL := 'ORDER BY ' + OrderBy;
SQL := SQL + 'o.PRICE, qb.QB_REF_NUM ' + whereSQL + ' ' + orderBySQL + ' LIMIT ' + limit + ' OFFSET ' + offset;
......
[Settings]
MemoLogLevel=4
FileLogLevel=5
LogFileNum=145
LogFileNum=155
webClientVersion=1.0.0
[Database]
......
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