Commit cb3f2055 by Cam Hayes

Fixed issue where after setting a status the search string would be incorrect.…

Fixed issue where after setting a status the search string would be incorrect. Also finished setting up SetStatus automatically scheduling the next due date.
parent ab14864b
......@@ -439,4 +439,10 @@ object FViewOrders: TFViewOrders
Left = 346
Top = 412
end
object tmrReturn: TWebTimer
Enabled = False
OnTimer = tmrReturnTimer
Left = 294
Top = 362
end
end
......@@ -60,6 +60,7 @@ type
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
xdwdsOrdersDBID: TStringField;
tmrReturn: TWebTimer;
procedure WebFormCreate(Sender: TObject);
procedure btnAddOrderClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
......@@ -71,6 +72,7 @@ type
procedure wdbtcOrdersDblClickCell(Sender: TObject; ACol, ARow: Integer);
procedure wdbtcOrdersClickCell(Sender: TObject; ACol, ARow: Integer);
procedure WebButton1Click(Sender: TObject);
procedure tmrReturnTimer(Sender: TObject);
private
FChildForm: TWebForm;
procedure ClearTable();
......@@ -177,7 +179,7 @@ begin
DMConnection.ApiConnection.Connected := True;
PageNumber := 1;
TotalPages := 1; // Initial total pages
console.log(FViewMain.search = '');
if FViewMain.search = '' then
begin
//Status 1
......@@ -236,7 +238,8 @@ begin
else
null2 := StrToBool(params.Values['null2']);
end;
getOrders(GenerateSearchOptions());
FViewMain.search := GenerateSearchOptions();
getOrders(FViewMain.search);
end;
......@@ -394,6 +397,9 @@ begin
begin
if newform.confirm then
begin
asm
startSpinner();
end;
StatusJSON := TJSONObject.Create;
StatusJSON.AddPair('ORDER_ID', OrderID);
StatusJSON.AddPair('date', DateTimeToStr(newform.dtpDate.Date));
......@@ -404,16 +410,26 @@ begin
StatusJSON.AddPair('staff_fields_mount_due', DateToStr(newForm.dtpNewMountDue.Date));
StatusJSON.AddPair('staff_fields_plate_due', DateToStr(newForm.dtpNewPlateDue.Date));
StatusJSON.AddPair('staff_fields_art_due', DateToStr(newForm.dtpNewArtDue.Date));
StatusJSON.AddPair('OrderType', NewForm.OrderType);
SetStatus(StatusJSON.ToString);
OrderID := '';
getOrders(GenerateSearchOptions());
tmrReturn.Enabled := true;
end;
end
);
end;
procedure TFViewOrders.tmrReturnTimer(Sender: TObject);
begin
asm
endSpinner();
end;
tmrReturn.Enabled := false;
getOrders(fViewMain.search);
end;
procedure TFViewOrders.SetStatus(statusInfo: string);
var
xdcResponse: TXDataClientResponse;
......
......@@ -191,27 +191,7 @@ object FSetStatus: TFSetStatus
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
LookupValues = <
item
Value = 'PROOF'
DisplayText = 'Proof Done'
end
item
Value = 'ART'
DisplayText = 'Art Done'
end
item
Value = 'PLATE'
DisplayText = 'Plate Done'
end
item
Value = 'MOUNT'
DisplayText = 'Mount Done'
end
item
Value = 'SHIP'
DisplayText = 'Ship Done'
end>
LookupValues = <>
end
object dtpDate: TWebDateTimePicker
Left = 484
......
......@@ -78,6 +78,10 @@ begin
end;
procedure TFSetStatus.WebFormShow(Sender: TObject);
var
ItemsToRemove: TStringList;
i: integer;
filteredItems: TJSArray;
begin
HideNotification();
edtOrderID.Text := OrderID;
......@@ -91,14 +95,17 @@ begin
dtpNewMountDue.Date := 0;
dtpNewPlateDue.Date := 0;
dtpNewArtDue.Date := 0;
ItemsToRemove := TStringList.Create;
if orderType = 'web plate' then
begin
dtpNewMountDue.Visible := false;
dtpMountDue.Visible := false;
lblMount.Visible := false;
lblMountNew.Visible := false;
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('Art', 'Art Done');
wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end
else if orderType = 'cutting die' then
begin
......@@ -116,9 +123,18 @@ begin
dtpNewArtDue.Visible := false;
lblArt.Visible := false;
lblArtNew.Visible := false;
end;
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end
else
begin
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('Art', 'Art Done');
wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done');
wlcbStatus.LookupValues.AddPair('MOUNT', 'Mount Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end;
end;
procedure TFSetStatus.HideNotification;
......
......@@ -1645,7 +1645,10 @@ var
Status: string;
UserID: string;
SQL: string;
temp: string;
NextStatus: string;
StatusField: string;
OrderType: string;
order: TJSONObject;
begin
try
logger.Log(1, 'Set Status Hit');
......@@ -1659,6 +1662,50 @@ begin
Date := StatusInfo.GetValue<string>('date');
Status := StatusInfo.GetValue<string>('status');
UserID := StatusInfo.GetValue<string>('USER_ID');
OrderType := StatusInfo.GetValue<string>('OrderType');
if ( (Status = 'PROOF') and (OrderType <> 'cutting die') ) then
begin
NextStatus := 'ART';
StatusField := 'staff_fields_art_due';
end
else if Status = 'ART' then
begin
NextStatus := 'PLATE';
StatusField := 'staff_fields_plate_due';
end
else if ( (Status = 'PLATE') and (OrderType <> 'web plate') ) then
begin
NextStatus := 'MOUNT';
StatusField := 'staff_fields_mount_due';
end
else
begin
NextStatus := 'SHIP';
StatusField := 'staff_fields_ship_date';
end;
Date := DateToStr(StrToDate(Date) + 1);
if Status <> 'SHIP' then
begin
order := TJSONObject.Create;
SQL := 'select * from orders_status_schedule where ORDER_ID = ' + IntToStr(ORDER_ID) + ' AND ' +
'ORDER_STATUS = ' + quotedStr(NextStatus);
doQuery(ordersDB.UniQuery1, SQL);
if ordersDB.UniQuery1.IsEmpty then
order.AddPair('mode', 'ADD')
else
order.AddPair('mode', 'EDIT');
order.AddPair(StatusField, Date);
order.AddPair('USER_ID', UserID);
AddStatusSchedule(NextStatus, order, ORDER_ID);
end;
SQL := 'select * from orders_status where ORDER_ID = ' + IntToStr(ORDER_ID) + ' AND ' +
'ORDER_STATUS = ' + quotedStr(Status);
......@@ -1697,7 +1744,6 @@ begin
if StatusInfo.GetValue<string>('staff_fields_mount_due') <> '12/30/1899' then
AddStatusSchedule('MOUNT', StatusInfo, ORDER_ID);
logger.Log(1, 'Status Successfully set');
result := 'success';
except
on E: Exception do
......
......@@ -2,7 +2,7 @@
MemoLogLevel=3
FileLogLevel=5
webClientVersion=0.9.2
LogFileNum=537
LogFileNum=552
[Database]
Server=192.168.159.131
......
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