Commit c4ce4a58 by cam

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

parent 0b8080eb
......@@ -175,6 +175,7 @@ type
FAgencyCode: string;
FCurrentReportType: string;
FSelectProc: TSelectProc;
orderID: string;
//FJSONProc1: TJSONProc1;
public
class function CreateForm(AElementID, orderInfo: string): TWebForm;
......@@ -198,9 +199,11 @@ begin
with TFOrderEntry(AForm) do
begin
HideNotification;
TFOrderEntry(AForm).orderID := orderInfo;
end;
end
);
end;
procedure TFOrderEntry.addColorRow(num: string; Color: string; LPI: string; Size: string);
......@@ -320,8 +323,7 @@ end;
procedure TFOrderEntry.WebFormShow(Sender: TObject);
begin
getOrder('7394');
{}
getOrder(orderID);
end;
procedure TFOrderEntry.HideNotification;
......
......@@ -224,6 +224,9 @@ object FViewOrders: TFViewOrders
object XDataWebDataSet1plateDone: TStringField
FieldName = 'plateDone'
end
object XDataWebDataSet1orderType: TStringField
FieldName = 'orderType'
end
end
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
......
......@@ -46,6 +46,7 @@ type
lblEntries2: TWebLabel;
XDataWebDataSet1plateDue: TStringField;
XDataWebDataSet1plateDone: TStringField;
XDataWebDataSet1orderType: TStringField;
procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
......@@ -57,7 +58,7 @@ type
procedure ClearTable();
procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string;
procedure orderEntry();
procedure orderEntry(orderInfo: string);
[async] procedure Search(searchOptions: string);
[async] procedure GetOrders(searchOptions: string);
[async] procedure getUser();
......@@ -117,7 +118,6 @@ begin
user := TJSObject(data[0]);
end;
procedure TFViewOrders.AddRowToTable(temp: string);
// Adds rows to the table
// PhoneNumber: phone number of the location
......@@ -130,10 +130,17 @@ var
colorObject: TJSObject;
colorList: TJSArray;
colors: integer;
ClickHandler: TJSFunction;
id: string;
begin
NewRow := TJSHTMLElement(document.createElement('tr'));
NewRow.Attrs['orderType'] := XDataWebDataSet1orderType.Value;
NewRow.addEventListener('click', procedure
begin
orderEntry(NewRow.Attrs['id']);
end);
// Order ID Cell
NewRow.Attrs['id'] := XDataWebDataSet1ID.Value;
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order ID');
if XDataWebDataSet1ID.Value = '' then
......@@ -292,7 +299,6 @@ begin
end;
NewRow.appendChild(Cell);
// Appends new rows to the table body
TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
end;
......@@ -561,12 +567,12 @@ end;
procedure TFViewOrders.btnaddOrderClick(Sender: TObject);
begin
orderEntry();
orderEntry('');
end;
procedure TFViewOrders.orderEntry();
procedure TFViewOrders.orderEntry(orderInfo: string);
begin
FViewMain.ViewOrderEntry('');
FViewMain.ViewOrderEntry(orderInfo);
end;
procedure TFViewOrders.btnApplyClick(Sender: TObject);
......
......@@ -74,6 +74,7 @@ type
price: string;
qbRefNum: string;
colors: string;
orderType: string;
end;
TOrderList = class
......
......@@ -145,209 +145,6 @@ begin
limit := IntToStr(PageSize);
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
begin
SQL := 'SELECT o.ORDER_ID, oss.STATUS_DATE AS '+ filterType.ToUpper + '_DUE'+
......@@ -407,6 +204,7 @@ begin
order.shipDone := ordersDB.UniQuery1.FieldByName('SHIP_DONE').AsString;
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
......
[Options]
LogFileNum=134
LogFileNum=137
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