Commit c4ce4a58 by cam

got autofill working properly and began work on Web Plate order entry

parent 0b8080eb
...@@ -175,6 +175,7 @@ type ...@@ -175,6 +175,7 @@ type
FAgencyCode: string; FAgencyCode: string;
FCurrentReportType: string; FCurrentReportType: string;
FSelectProc: TSelectProc; FSelectProc: TSelectProc;
orderID: string;
//FJSONProc1: TJSONProc1; //FJSONProc1: TJSONProc1;
public public
class function CreateForm(AElementID, orderInfo: string): TWebForm; class function CreateForm(AElementID, orderInfo: string): TWebForm;
...@@ -198,9 +199,11 @@ begin ...@@ -198,9 +199,11 @@ begin
with TFOrderEntry(AForm) do with TFOrderEntry(AForm) do
begin begin
HideNotification; HideNotification;
TFOrderEntry(AForm).orderID := orderInfo;
end; end;
end end
); );
end; end;
procedure TFOrderEntry.addColorRow(num: string; Color: string; LPI: string; Size: string); procedure TFOrderEntry.addColorRow(num: string; Color: string; LPI: string; Size: string);
...@@ -320,8 +323,7 @@ end; ...@@ -320,8 +323,7 @@ end;
procedure TFOrderEntry.WebFormShow(Sender: TObject); procedure TFOrderEntry.WebFormShow(Sender: TObject);
begin begin
getOrder('7394'); getOrder(orderID);
{}
end; end;
procedure TFOrderEntry.HideNotification; procedure TFOrderEntry.HideNotification;
......
...@@ -224,6 +224,9 @@ object FViewOrders: TFViewOrders ...@@ -224,6 +224,9 @@ object FViewOrders: TFViewOrders
object XDataWebDataSet1plateDone: TStringField object XDataWebDataSet1plateDone: TStringField
FieldName = 'plateDone' FieldName = 'plateDone'
end end
object XDataWebDataSet1orderType: TStringField
FieldName = 'orderType'
end
end end
object WebDataSource1: TWebDataSource object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1 DataSet = XDataWebDataSet1
......
...@@ -46,6 +46,7 @@ type ...@@ -46,6 +46,7 @@ type
lblEntries2: TWebLabel; lblEntries2: TWebLabel;
XDataWebDataSet1plateDue: TStringField; XDataWebDataSet1plateDue: TStringField;
XDataWebDataSet1plateDone: TStringField; XDataWebDataSet1plateDone: TStringField;
XDataWebDataSet1orderType: TStringField;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject); procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject); procedure btnSearchClick(Sender: TObject);
...@@ -57,7 +58,7 @@ type ...@@ -57,7 +58,7 @@ type
procedure ClearTable(); procedure ClearTable();
procedure GeneratePagination(TotalPages: Integer); procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string; function GenerateSearchOptions(): string;
procedure orderEntry(); procedure orderEntry(orderInfo: string);
[async] procedure Search(searchOptions: string); [async] procedure Search(searchOptions: string);
[async] procedure GetOrders(searchOptions: string); [async] procedure GetOrders(searchOptions: string);
[async] procedure getUser(); [async] procedure getUser();
...@@ -117,7 +118,6 @@ begin ...@@ -117,7 +118,6 @@ begin
user := TJSObject(data[0]); user := TJSObject(data[0]);
end; end;
procedure TFViewOrders.AddRowToTable(temp: string); procedure TFViewOrders.AddRowToTable(temp: string);
// Adds rows to the table // Adds rows to the table
// PhoneNumber: phone number of the location // PhoneNumber: phone number of the location
...@@ -130,10 +130,17 @@ var ...@@ -130,10 +130,17 @@ var
colorObject: TJSObject; colorObject: TJSObject;
colorList: TJSArray; colorList: TJSArray;
colors: integer; colors: integer;
ClickHandler: TJSFunction;
id: string;
begin begin
NewRow := TJSHTMLElement(document.createElement('tr')); NewRow := TJSHTMLElement(document.createElement('tr'));
NewRow.Attrs['orderType'] := XDataWebDataSet1orderType.Value;
NewRow.addEventListener('click', procedure
begin
orderEntry(NewRow.Attrs['id']);
end);
// Order ID Cell // Order ID Cell
NewRow.Attrs['id'] := XDataWebDataSet1ID.Value;
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order ID'); Cell.setAttribute('data-label', 'Order ID');
if XDataWebDataSet1ID.Value = '' then if XDataWebDataSet1ID.Value = '' then
...@@ -292,7 +299,6 @@ begin ...@@ -292,7 +299,6 @@ begin
end; end;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Appends new rows to the table body // Appends new rows to the table body
TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow); TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
end; end;
...@@ -561,12 +567,12 @@ end; ...@@ -561,12 +567,12 @@ end;
procedure TFViewOrders.btnaddOrderClick(Sender: TObject); procedure TFViewOrders.btnaddOrderClick(Sender: TObject);
begin begin
orderEntry(); orderEntry('');
end; end;
procedure TFViewOrders.orderEntry(); procedure TFViewOrders.orderEntry(orderInfo: string);
begin begin
FViewMain.ViewOrderEntry(''); FViewMain.ViewOrderEntry(orderInfo);
end; end;
procedure TFViewOrders.btnApplyClick(Sender: TObject); procedure TFViewOrders.btnApplyClick(Sender: TObject);
......
...@@ -74,6 +74,7 @@ type ...@@ -74,6 +74,7 @@ type
price: string; price: string;
qbRefNum: string; qbRefNum: string;
colors: string; colors: string;
orderType: string;
end; end;
TOrderList = class TOrderList = class
......
...@@ -145,209 +145,6 @@ begin ...@@ -145,209 +145,6 @@ begin
limit := IntToStr(PageSize); limit := IntToStr(PageSize);
whereSQL := 'WHERE '; whereSQL := 'WHERE ';
{SQL := 'SELECT o.ORDER_ID, o.LOCATION AS Loc, c.NAME AS COMPANY_NAME, o.JOB_NAME, o.ORDER_DATE, o.ORDER_TYPE, ' +
'(SELECT oss.STATUS_DATE ' +
' FROM orders_status_schedule oss ';
// if proof is chosen as the filter
if filterType = 'proof' then
begin
if startDate <> '' then
begin
whereSQL := 'WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PROOF'' AND ' +
quotedStr(startDate) +' <= oss.STATUS_DATE';
end;
if endDate <> '' then
begin
if whereSQL = 'WHERE ' then
begin
whereSQL := 'WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PROOF'' AND ' +
quotedStr(endDate) + ' >= oss.STATUS_DATE ) '
end
else
begin
whereSQL := whereSQL + ' AND ' +
quotedStr(endDate) + ' >= oss.STATUS_DATE ) ';
end;
end
else
begin
whereSQL := 'WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PROOF'') ';
end;
end
else
begin
whereSQL := 'WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PROOF'') '
end;
SQL := SQL + whereSQL + 'AS PROOF_DUE, ' +
'(SELECT os.STATUS_TIMESTAMP ' +
' FROM orders_status os ' +
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''PROOF'' ' +
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS PROOF_DONE, ' +
'(SELECT oss.STATUS_DATE ' +
' FROM orders_status_schedule oss ';
// if art is chosen as the filter
whereSQL := 'WHERE ';
if filterType = 'art' then
begin
if startDate <> '' then
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''ART'' AND oss.STATUS_DATE >= ' +
quotedStr(startDate);
end;
if endDate <> '' then
begin
if whereSQL = 'WHERE ' then
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''ART'' AND ' +
quotedStr(endDate) + ' >= oss.STATUS_DATE ) '
end
else
begin
whereSQL := whereSQL + ' AND oss.STATUS_DATE <= ' + quotedStr(endDate);
end;
end
else
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''ART'') ';
end;
end
else
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''ART'') '
end;
SQL := SQL + whereSQL + 'AS ART_DUE, ' +
'(SELECT os.STATUS_TIMESTAMP ' +
' FROM orders_status os ' +
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''ART'' ' +
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS ART_DONE, ' +
'(SELECT oss.STATUS_DATE ' +
' FROM orders_status_schedule oss ';
// if plate is chosen as the filter
whereSQL := 'WHERE ';
if filterType = 'plate' then
begin
if startDate <> '' then
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PLATE'' AND ' +
quotedStr(startDate) +' <= oss.STATUS_DATE';
end;
if endDate <> '' then
begin
if whereSQL = 'WHERE ' then
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PLATE'' AND ' +
quotedStr(endDate) + ' >= oss.STATUS_DATE ) '
end
else
begin
whereSQL := whereSQL + 'AND ' +
quotedStr(endDate) + ' >= oss.STATUS_DATE ) ';
end;
end
else
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PLATE'') ';
end;
end
else
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PLATE'') '
end;
SQL := SQL + whereSQL + 'AS PLATE_DUE, ' +
'(SELECT os.STATUS_TIMESTAMP ' +
' FROM orders_status os ' +
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''PLATE'' ' +
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS PLATE_DONE, ' +
'(SELECT oss.STATUS_DATE ' +
' FROM orders_status_schedule oss ';
// if mount is selected as the filter
whereSQL := 'WHERE ';
if filterType = 'mount' then
begin
if startDate <> '' then
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''MOUNT'' AND ' +
quotedStr(startDate) +' <= oss.STATUS_DATE';
end;
if endDate <> '' then
begin
if whereSQL = 'WHERE ' then
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''MOUNT'' AND ' +
quotedStr(endDate) + ' >= oss.STATUS_DATE ) '
end
else
begin
whereSQL := whereSQL + 'AND ' +
quotedStr(endDate) + ' >= oss.STATUS_DATE ) ';
end;
end
else
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''MOUNT'') ';
end;
end
else
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''MOUNT'') '
end;
SQL := SQL + whereSQL + 'AS MOUNT_DUE, ' +
'(SELECT os.STATUS_TIMESTAMP ' +
' FROM orders_status os ' +
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''MOUNT'' ' +
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS MOUNT_DONE, ' +
'(SELECT oss.STATUS_DATE ' +
' FROM orders_status_schedule oss ';
// if ship is chosen as the filter
whereSQL := 'WHERE ';
if filterType = 'mount' then
begin
if startDate <> '' then
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''SHIP'' AND ' +
quotedStr(startDate) +' <= oss.STATUS_DATE';
end;
if endDate <> '' then
begin
if whereSQL = 'WHERE ' then
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''SHIP'' AND ' +
quotedStr(endDate) + ' >= oss.STATUS_DATE ) '
end
else
begin
whereSQL := whereSQL + 'AND ' +
quotedStr(endDate) + ' >= oss.STATUS_DATE ) ';
end;
end
else
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''SHIP'') ';
end;
end
else
begin
whereSQL := ' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''SHIP'') '
end;
SQL := SQL + whereSQL + 'AS SHIP_DUE, ' +
'(SELECT os.STATUS_TIMESTAMP ' +
' FROM orders_status os ' +
' WHERE os.ORDER_ID = o.ORDER_ID AND os.ORDER_STATUS = ''SHIP'' ' +
' ORDER BY os.STATUS_TIMESTAMP DESC LIMIT 1) AS SHIP_DONE, ' +
'o.PRICE, qb.QB_REF_NUM ' +
'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 ' +
'ORDER BY o.ORDER_DATE DESC ' +
'LIMIT ' + limit + ' OFFSET ' + offset; }
if filterType <> '' then if filterType <> '' then
begin begin
SQL := 'SELECT o.ORDER_ID, oss.STATUS_DATE AS '+ filterType.ToUpper + '_DUE'+ SQL := 'SELECT o.ORDER_ID, oss.STATUS_DATE AS '+ filterType.ToUpper + '_DUE'+
...@@ -407,6 +204,7 @@ begin ...@@ -407,6 +204,7 @@ begin
order.shipDone := ordersDB.UniQuery1.FieldByName('SHIP_DONE').AsString; order.shipDone := ordersDB.UniQuery1.FieldByName('SHIP_DONE').AsString;
order.price := ordersDB.UniQuery1.FieldByName('PRICE').AsString; order.price := ordersDB.UniQuery1.FieldByName('PRICE').AsString;
order.qbRefNum := ordersDB.UniQuery1.FieldByName('QB_REF_NUM').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 if ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString = 'web_plate' then
begin begin
......
[Options] [Options]
LogFileNum=134 LogFileNum=137
UpdateTimerLength=0 UpdateTimerLength=0
......
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