Commit 35e846f1 by Cam Hayes

Fixed 4 bugs in search

1: Made it so that order date in all instances was changed to staff_fields_order_date to reflect the change we made on the orders list. 2: Made it so that show only empty worked with order date. 3: Fixed issue where clear button wasn't showing the start date and end date if clear button was pressed when they were hidden. 4: fixed issue where null2 checkbox was not being properly set when loading the search page. This should fix bugs we encountered
parent 44d31ae4
...@@ -237,7 +237,9 @@ object FViewOrders: TFViewOrders ...@@ -237,7 +237,9 @@ object FViewOrders: TFViewOrders
ItemIndex = -1 ItemIndex = -1
LookupValues = < LookupValues = <
item item
Value = 'o.ORDER_ID DESC' Value =
'COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_dat' +
'e, cdo.staff_fields_order_date) DESC'
DisplayText = 'ID' DisplayText = 'ID'
end end
item item
......
...@@ -198,7 +198,7 @@ begin ...@@ -198,7 +198,7 @@ begin
wcbPageSize.Text := '500'; wcbPageSize.Text := '500';
PageSize := 500; PageSize := 500;
wlcbOrderBy.DisplayText := 'Order Date'; wlcbOrderBy.DisplayText := 'Order Date';
OrderBy := 'o.ORDER_DATE DESC'; OrderBy := 'COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_date, cdo.staff_fields_order_date) DESC';
end end
else else
begin begin
......
...@@ -168,7 +168,7 @@ begin ...@@ -168,7 +168,7 @@ begin
if params.values['null2'] <> '' then if params.values['null2'] <> '' then
begin begin
cbNull1.Checked := StrToBool(params.Values['null2']); cbNull2.Checked := StrToBool(params.Values['null2']);
if StrToBool(params.Values['null2']) then if StrToBool(params.Values['null2']) then
begin begin
dtpStartDate2.Visible := false; dtpStartDate2.Visible := false;
...@@ -201,6 +201,10 @@ begin ...@@ -201,6 +201,10 @@ begin
dtpStartDate2.Date := 0; dtpStartDate2.Date := 0;
dtpEndDate2.Date := 0; dtpEndDate2.Date := 0;
cbNull2.Checked := false; cbNull2.Checked := false;
dtpStartDate1.Visible := true;
dtpStartDate2.Visible := true;
dtpEndDate1.Visible := true;
dtpEndDate2.Visible := true;
end; end;
procedure TFSearch.btnConfirmClick(Sender: TObject); procedure TFSearch.btnConfirmClick(Sender: TObject);
......
...@@ -358,14 +358,37 @@ begin ...@@ -358,14 +358,37 @@ begin
end end
else else
begin begin
if status.startDate <> '' then if status.filterType <> 'ORDER_DATE' then
begin begin
result := result + ' AND ' + quotedStr(status.startDate) + ' <= o.ORDER_DATE'; if status.null then
end; begin
result := result + ' AND not exists (select 1 from ' + status.statusTableLong +
if ( ( status.endDate <> '1899/12/30' ) AND ( status.endDate <> '' ) ) then ' ' + status.statusTableShort + ' where '
+ status.statusTableShort +'.ORDER_ID = o.ORDER_ID ' +
'AND ' + status.statusTableShort + '.ORDER_STATUS = ' +
quotedStr(status.statusType) + ')';
end
else
result := result + ' AND ' + generateStatusSelectSQL(status.statusTableShort, status.statusTableLong, status.startDate, status.endDate, status.statusType);
end
else
begin begin
result := result + ' AND ' + quotedStr(status.endDate) + ' >= o.ORDER_DATE'; if status.null then
begin
result := result + ' AND ' + quotedStr(status.startDate) + ' IS NULL';
end
else
begin
if status.startDate <> '' then
begin
result := result + ' AND ' + quotedStr(status.startDate) + ' <= COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_date, cdo.staff_fields_order_date)';
end;
if ( ( status.endDate <> '1899/12/30' ) AND ( status.endDate <> '' ) ) then
begin
result := result + ' AND ' + quotedStr(status.endDate) + ' >= COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_date, cdo.staff_fields_order_date)';
end;
end;
end; end;
end; end;
end; end;
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
MemoLogLevel=3 MemoLogLevel=3
FileLogLevel=5 FileLogLevel=5
webClientVersion=0.9.3 webClientVersion=0.9.3
LogFileNum=444 LogFileNum=446
[Database] [Database]
--Server=192.168.159.131 Server=192.168.159.131
Server=192.168.102.130 --Server=192.168.102.130
--Server=192.168.75.133 --Server=192.168.75.133
Database=kg_order_entry Database=kg_order_entry
Username=root Username=root
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment