Commit e7324517 by cam

Orders display is working properly without the colors

parent 8419ad94
...@@ -5,30 +5,6 @@ ...@@ -5,30 +5,6 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-12 col-md-8"> <div class="col-12 col-md-8">
<form class="form-inline"> <form class="form-inline">
<div class="col-sm py-2">
<label class='pe-2'style="font-weight: 700;">Location:</label>
<select class="custom-select" id="wcblocation" style="font-size: 1.00rem;"></select>
</div>
<div class="row">
<div class="col-sm-6">
<label class='pe-2'style="font-weight: 700;">Phone Number:</label>
<input class="form-control input-sm" id="edtsearch">
</div>
</div>
</form>
<form class="form-inline">
<div class="row">
<div class="col-sm-6">
<label style="font-weight: 700;">Start Date:</label>
<input class="form-control input-sm" id="dtpstartdate" type="date">
</div>
<div class="col-sm-6">
<label class= 'pe-2'style="font-weight: 700;">End Date:</label>
<input class="form-control input-sm" id="dtpenddate" type="date">
</div>
</div>
</form>
<form class="form-inline">
<div class= "row"> <div class= "row">
<div class="col-sm-5"> <div class="col-sm-5">
<label class="py-2" style="font-weight: 700;">Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries</label> <label class="py-2" style="font-weight: 700;">Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries</label>
...@@ -42,7 +18,7 @@ ...@@ -42,7 +18,7 @@
</div> </div>
</div> </div>
</form> </form>
</div>
<table class="table table-responsive table-striped table-bordered" id="tblPhoneGrid"> <table class="table table-responsive table-striped table-bordered" id="tblPhoneGrid">
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <tr>
...@@ -77,7 +53,6 @@ ...@@ -77,7 +53,6 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- Modal --> <!-- Modal -->
<div class="modal fade" id="audioModal" tabindex="-1" aria-labelledby="audioModalLabel" aria-hidden="true"> <div class="modal fade" id="audioModal" tabindex="-1" aria-labelledby="audioModalLabel" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
......
...@@ -51,9 +51,9 @@ object FViewMain: TFViewMain ...@@ -51,9 +51,9 @@ object FViewMain: TFViewMain
object lblAppTitle: TWebLabel object lblAppTitle: TWebLabel
Left = 57 Left = 57
Top = 31 Top = 31
Width = 60 Width = 74
Height = 15 Height = 15
Caption = 'Envoy Calls' Caption = 'Kohler Gibson'
ElementID = 'view.main.apptitle' ElementID = 'view.main.apptitle'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Transparent = False Transparent = False
......
...@@ -62,7 +62,7 @@ uses ...@@ -62,7 +62,7 @@ uses
View.Items, View.Items,
View.Users, View.Users,
View.EditUser, View.EditUser,
View.Calls; View.Orders;
{$R *.dfm} {$R *.dfm}
...@@ -92,7 +92,7 @@ end; ...@@ -92,7 +92,7 @@ end;
procedure TFViewMain.lblordersClick(Sender: TObject); procedure TFViewMain.lblordersClick(Sender: TObject);
begin begin
ShowForm(TFViewCalls); ShowForm(TFViewOrders);
end; end;
procedure TFViewMain.lblUsersClick(Sender: TObject); procedure TFViewMain.lblUsersClick(Sender: TObject);
......
object FViewCalls: TFViewCalls object FViewOrders: TFViewOrders
Width = 676 Width = 676
Height = 480 Height = 480
CSSLibrary = cssBootstrap CSSLibrary = cssBootstrap
...@@ -85,7 +85,6 @@ object FViewCalls: TFViewCalls ...@@ -85,7 +85,6 @@ object FViewCalls: TFViewCalls
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
TextHint = 'Format: (XXX) XXX-XXXX'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
...@@ -97,6 +96,9 @@ object FViewCalls: TFViewCalls ...@@ -97,6 +96,9 @@ object FViewCalls: TFViewCalls
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 440 Left = 440
Top = 300 Top = 300
object XDataWebDataSet1ID: TStringField
FieldName = 'ID'
end
object XDataWebDataSet1companyName: TStringField object XDataWebDataSet1companyName: TStringField
FieldName = 'companyName' FieldName = 'companyName'
end end
...@@ -133,15 +135,12 @@ object FViewCalls: TFViewCalls ...@@ -133,15 +135,12 @@ object FViewCalls: TFViewCalls
object XDataWebDataSet1price: TStringField object XDataWebDataSet1price: TStringField
FieldName = 'price' FieldName = 'price'
end end
object XDataWebDataSet1qbRefNum: TIntegerField object XDataWebDataSet1qbRefNum: TStringField
FieldName = 'qbRefNum' FieldName = 'qbRefNum'
end end
object XDataWebDataSet1colors: TIntegerField object XDataWebDataSet1colors: TStringField
FieldName = 'colors' FieldName = 'colors'
end end
object XDataWebDataSet1ID: TIntegerField
FieldName = 'ID'
end
end end
object WebDataSource1: TWebDataSource object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1 DataSet = XDataWebDataSet1
......
<div class="row">
<div class="col-12">
<h1 class="page-header pt-3" id="view.calls.title" style="font-size: 24px;">Orders</h1>
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
<form class="form-inline">
<div class="row">
<div class="col-sm-6">
<label class='pe-2'style="font-weight: 700;">Search:</label>
<input class="form-control input-sm" id="edtsearch">
</div>
</div>
</form>
<form class="form-inline">
<div class= "row">
<div class="col-sm-5">
<label class="py-2" style="font-weight: 700;">Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries</label>
</div>
<div class="col-sm-5">
<label class="py-2" style="font-weight: 700;">Sorted by:</label>
<select class="custom-select" id="wcbsortby" style="font-size: 1.00rem;"></select>
</div>
<div class="col-sm-2">
<button class= "ps-3" id="btnapply"></button>
</div>
</div>
</form>
</div>
<table class="table table-responsive table-striped table-bordered" id="tblPhoneGrid">
<thead class="thead-dark">
<tr>
<th scope="col">Order ID</th>
<th scope="col">Company Name</th>
<th scope="col">Job Name</th>
<th scope="col">Order Date</th>
<th scope="col">Proof Due</th>
<th scope="col">Proof Date</th>
<th scope="col">Art Due</th>
<th scope="col">Art Done</th>
<th scope="col">Mount Due</th>
<th scope="col">Mount Done</th>
<th scope="col">Ship Due</th>
<th scope="col">Ship Done</th>
<th scope="col">Price</th>
<th scope="col">Quickbooks Reference Number</th>
<th scope="col">Colors</th>
</tr>
</thead>
<tbody>
<!-- Rows will be added dynamically via Delphi code -->
</tbody>
</table>
<label id="lblentries"></label>
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center" id="pagination">
<!-- Pagination items will be added dynamically via Delphi code -->
</ul>
</nav>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="audioModal" tabindex="-1" aria-labelledby="audioModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="audioModalLabel">Audio Player</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" onclick="stopAudio()"></button>
</div>
<div class="modal-body">
<audio controls id="audioPlayer">
<source src="" type="audio/mp3" id="audioSource">
Your browser does not support the audio element.
</audio>
</div>
</div>
</div>
</div>
<script>
// JavaScript function to stop audio
function stopAudio() {
var audioPlayer = document.getElementById('audioPlayer');
audioPlayer.pause(); // Pause the audio
audioPlayer.currentTime = 0; // Reset audio to beginning
}
</script>
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Cameron Hayes // Cameron Hayes
// Mac ... // Mac ...
unit View.Calls; unit View.Orders;
interface interface
...@@ -15,7 +15,7 @@ uses ...@@ -15,7 +15,7 @@ uses
XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, DateUtils, WebAudio; XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, DateUtils, WebAudio;
type type
TFViewCalls = class(TWebForm) TFViewOrders = class(TWebForm)
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
XDataWebDataSet1: TXDataWebDataSet; XDataWebDataSet1: TXDataWebDataSet;
lblEntries: TWebLabel; lblEntries: TWebLabel;
...@@ -36,9 +36,9 @@ type ...@@ -36,9 +36,9 @@ type
XDataWebDataSet1shipDue: TStringField; XDataWebDataSet1shipDue: TStringField;
XDataWebDataSet1shipDone: TStringField; XDataWebDataSet1shipDone: TStringField;
XDataWebDataSet1price: TStringField; XDataWebDataSet1price: TStringField;
XDataWebDataSet1qbRefNum: TIntegerField; XDataWebDataSet1ID: TStringField;
XDataWebDataSet1colors: TIntegerField; XDataWebDataSet1qbRefNum: TStringField;
XDataWebDataSet1ID: TIntegerField; XDataWebDataSet1colors: 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);
...@@ -64,7 +64,7 @@ type ...@@ -64,7 +64,7 @@ type
end; end;
var var
FViewCalls: TFViewCalls; FViewOrders: TFViewOrders;
implementation implementation
...@@ -74,7 +74,7 @@ uses ...@@ -74,7 +74,7 @@ uses
{$R *.dfm} {$R *.dfm}
procedure TFViewCalls.WebFormCreate(Sender: TObject); procedure TFViewOrders.WebFormCreate(Sender: TObject);
// Initializes important values: // Initializes important values:
// PageNumber: What page number the user is on IE 1: 1-10, 2: 11-20 etc // PageNumber: What page number the user is on IE 1: 1-10, 2: 11-20 etc
// TotalPages: Total number of pages returned from the search. // TotalPages: Total number of pages returned from the search.
...@@ -87,7 +87,7 @@ begin ...@@ -87,7 +87,7 @@ begin
getCalls(GenerateSearchOptions()); getCalls(GenerateSearchOptions());
end; end;
procedure TFViewCalls.getUser(); procedure TFViewOrders.getUser();
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
userList, user: TJSObject; userList, user: TJSObject;
...@@ -101,7 +101,7 @@ begin ...@@ -101,7 +101,7 @@ begin
end; end;
procedure TFViewCalls.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
// Caller: phone number of the caller // Caller: phone number of the caller
...@@ -116,91 +116,136 @@ begin ...@@ -116,91 +116,136 @@ begin
// Order ID Cell // Order ID Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order ID'); Cell.setAttribute('data-label', 'Order ID');
Cell.innerText := XDataWebDataSet1ID.AsString; if XDataWebDataSet1ID.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1ID.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Company Name Cell // Company Name Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Company Name'); Cell.setAttribute('data-label', 'Company Name');
Cell.innerText := XDataWebDataSet1companyName.Value; if XDataWebDataSet1companyName.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1companyName.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Job Name Cell // Job Name Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Job Name'); Cell.setAttribute('data-label', 'Job Name');
Cell.innerText := XDataWebDataSet1jobName.Value; if XDataWebDataSet1jobName.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1jobName.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Order Date Cell // Order Date Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order Date'); Cell.setAttribute('data-label', 'Order Date');
Cell.innerText := XDataWebDataSet1orderDate.Value; if XDataWebDataSet1orderDate.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1orderDate.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Proof Due Cell // Proof Due Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Proof Due'); Cell.setAttribute('data-label', 'Proof Due');
Cell.innerText := XDataWebDataSet1proofDue.Value; if XDataWebDataSet1proofDue.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1proofDue.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Proof Done Cell // Proof Done Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Proof Done'); Cell.setAttribute('data-label', 'Proof Done');
Cell.innerText := XDataWebDataSet1proofDone.Value; if XDataWebDataSet1proofDone.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1proofDone.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Art Due Cell // Art Due Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Art Due'); Cell.setAttribute('data-label', 'Art Due');
Cell.innerText := XDataWebDataSet1artDue.Value; if XDataWebDataSet1artDone.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1artDue.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Art Done Cell // Art Done Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Art Done'); Cell.setAttribute('data-label', 'Art Done');
Cell.innerText := XDataWebDataSet1artDone.Value; if XDataWebDataSet1artDone.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1artDone.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Mount Due Cell // Mount Due Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Mount Due'); Cell.setAttribute('data-label', 'Mount Due');
Cell.innerText := XDataWebDataSet1mountDue.Value; if XDataWebDataSet1mountDue.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1mountDue.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Mount Done Cell // Mount Done Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Mount Done'); Cell.setAttribute('data-label', 'Mount Done');
Cell.innerText := XDataWebDataSet1mountDone.Value; if XDataWebDataSet1mountDone.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1mountDone.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Ship Due Cell // Ship Due Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Ship Due'); Cell.setAttribute('data-label', 'Ship Due');
Cell.innerText := XDataWebDataSet1shipDue.Value; if XDataWebDataSet1shipDue.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1shipDue.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Ship Done Cell // Ship Done Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Ship Done'); Cell.setAttribute('data-label', 'Ship Done');
Cell.innerText := XDataWebDataSet1shipDone.Value; if XDataWebDataSet1shipDone.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1shipDone.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Price Cell // Price Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Price'); Cell.setAttribute('data-label', 'Price');
Cell.innerText := XDataWebDataSet1jobName.Value; if XDataWebDataSet1price.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1price.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// QuickBooks Reference Number Cell // QuickBooks Reference Number Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Quickbooks Reference Number'); Cell.setAttribute('data-label', 'Quickbooks Reference Number');
Cell.innerText := XDataWebDataSet1qbRefNum.AsString; if XDataWebDataSet1qbRefNum.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1qbRefNum.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Colors Cell // Colors Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Colors'); Cell.setAttribute('data-label', 'Colors');
Cell.innerText := XDataWebDataSet1colors.AsString; if XDataWebDataSet1colors.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := XDataWebDataSet1colors.Value;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
...@@ -208,7 +253,7 @@ begin ...@@ -208,7 +253,7 @@ begin
TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow); TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
end; end;
procedure TFViewCalls.GeneratePagination(TotalPages: Integer); procedure TFViewOrders.GeneratePagination(TotalPages: Integer);
// Generates pagination for the table. // Generates pagination for the table.
// TotalPages: Total amount of pages generated by the search // TotalPages: Total amount of pages generated by the search
var var
...@@ -377,7 +422,7 @@ begin ...@@ -377,7 +422,7 @@ begin
end; end;
procedure TFViewCalls.GetCalls(searchOptions: string); procedure TFViewOrders.GetCalls(searchOptions: string);
// Retrieves list of calls from the server that meet the criteria searchOptions // Retrieves list of calls from the server that meet the criteria searchOptions
// searchOptions: information about how to generate the SQL statement based on // searchOptions: information about how to generate the SQL statement based on
// user input. // user input.
...@@ -413,9 +458,6 @@ begin ...@@ -413,9 +458,6 @@ begin
for i := 0 to data.Length - 1 do for i := 0 to data.Length - 1 do
begin begin
order := TJSObject(data[i]); order := TJSObject(data[i]);
{console.log(order);
console.log(XDataWebDataSet1proofDue.Value);
console.log(XDataWebDataSet1ID.Value);}
AddRowToTable(tempString); AddRowToTable(tempString);
XDataWebDataSet1.Next; XDataWebDataSet1.Next;
end; end;
...@@ -436,7 +478,7 @@ begin ...@@ -436,7 +478,7 @@ begin
end; end;
end; end;
procedure TFViewCalls.btnApplyClick(Sender: TObject); procedure TFViewOrders.btnApplyClick(Sender: TObject);
// Button that effectively functions as a GetCalls() button // Button that effectively functions as a GetCalls() button
var var
searchOptions: string; searchOptions: string;
...@@ -450,7 +492,7 @@ begin ...@@ -450,7 +492,7 @@ begin
GetCalls(searchOptions); GetCalls(searchOptions);
end; end;
procedure TFViewCalls.Search(searchOptions: string); procedure TFViewOrders.Search(searchOptions: string);
// Search method that searches the database for a specific phone number // Search method that searches the database for a specific phone number
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
...@@ -480,13 +522,13 @@ begin ...@@ -480,13 +522,13 @@ begin
end; end;
end; end;
procedure TFViewCalls.btnSearchClick(Sender: TObject); procedure TFViewOrders.btnSearchClick(Sender: TObject);
// calls Search method // calls Search method
begin begin
Search(edtSearch.Text); Search(edtSearch.Text);
end; end;
procedure TFViewCalls.ClearTable(); procedure TFViewOrders.ClearTable();
// clears the table // clears the table
var var
tbody: TJSHTMLElement; tbody: TJSHTMLElement;
...@@ -495,7 +537,7 @@ begin ...@@ -495,7 +537,7 @@ begin
tbody.innerHTML := ''; tbody.innerHTML := '';
end; end;
function TFViewCalls.GenerateSearchOptions(): string; function TFViewOrders.GenerateSearchOptions(): string;
// Generates searchOptions for get calls. // Generates searchOptions for get calls.
var var
searchOptions: string; searchOptions: string;
......
...@@ -18,7 +18,7 @@ uses ...@@ -18,7 +18,7 @@ uses
View.Home in 'View.Home.pas' {FViewHome: TWebForm} {*.html}, View.Home in 'View.Home.pas' {FViewHome: TWebForm} {*.html},
View.Users in 'View.Users.pas' {FViewUsers: TWebForm} {*.html}, View.Users in 'View.Users.pas' {FViewUsers: TWebForm} {*.html},
View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html}, View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html},
View.Calls in 'View.Calls.pas' {FViewCalls: TWebForm} {*.html}; View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html};
{$R *.res} {$R *.res}
......
...@@ -161,8 +161,8 @@ ...@@ -161,8 +161,8 @@
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="View.Calls.pas"> <DCCReference Include="View.Orders.pas">
<Form>FViewCalls</Form> <Form>FViewOrders</Form>
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
......
...@@ -26,4 +26,11 @@ object FDatabaseModule: TFDatabaseModule ...@@ -26,4 +26,11 @@ object FDatabaseModule: TFDatabaseModule
Left = 220 Left = 220
Top = 134 Top = 134
end end
object UniQuery2: TUniQuery
Connection = ucKG
SQL.Strings = (
'')
Left = 433
Top = 144
end
end end
...@@ -15,6 +15,7 @@ type ...@@ -15,6 +15,7 @@ type
ucKG: TUniConnection; ucKG: TUniConnection;
UniQuery1: TUniQuery; UniQuery1: TUniQuery;
MySQLUniProvider1: TMySQLUniProvider; MySQLUniProvider1: TMySQLUniProvider;
UniQuery2: TUniQuery;
procedure DataModuleCreate(Sender: TObject); procedure DataModuleCreate(Sender: TObject);
private private
{ Private declarations } { Private declarations }
......
...@@ -85,7 +85,7 @@ type ...@@ -85,7 +85,7 @@ type
TOrderItem = class TOrderItem = class
public public
ID: integer; ID: string;
companyName: string; companyName: string;
jobName: string; jobName: string;
orderDate: string; orderDate: string;
...@@ -98,8 +98,8 @@ type ...@@ -98,8 +98,8 @@ type
shipDue: string; shipDue: string;
shipDone: string; shipDone: string;
price: string; price: string;
qbRefNum: integer; qbRefNum: string;
colors: integer; colors: string;
end; end;
TOrderList = class TOrderList = class
......
...@@ -226,7 +226,48 @@ begin ...@@ -226,7 +226,48 @@ begin
offset := IntToStr((PageNum - 1) * PageSize); offset := IntToStr((PageNum - 1) * PageSize);
limit := IntToStr(PageSize); limit := IntToStr(PageSize);
SQL := 'select * from web_plate_orders inner join customers on web_plate_orders.COMPANY_ID = customers.CUSTOMER_ID ' + 'limit ' + limit + ' offset ' + offset; SQL := 'SELECT o.ORDER_ID, o.LOCATION AS Loc, c.NAME AS COMPANY_NAME, o.JOB_NAME, o.ORDER_DATE, ' +
'(SELECT oss.STATUS_DATE ' +
' FROM orders_status_schedule oss ' +
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PROOF'') 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 ' +
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''ART'') 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 ' +
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''PLATE'') 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 ' +
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''MOUNT'') 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 ' +
' WHERE oss.ORDER_ID = o.ORDER_ID AND oss.ORDER_STATUS = ''SHIP'') 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;
doQuery(callsDB.UniQuery1, SQL); doQuery(callsDB.UniQuery1, SQL);
...@@ -239,11 +280,31 @@ begin ...@@ -239,11 +280,31 @@ begin
Order := TOrderItem.Create; Order := TOrderItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Order ); TXDataOperationContext.Current.Handler.ManagedObjects.Add( Order );
Result.data.Add( Order ); Result.data.Add( Order );
order.ID := callsDB.UniQuery1.FieldByName('ORDER_ID').AsInteger; order.ID := callsDB.UniQuery1.FieldByName('ORDER_ID').AsString;
order.companyName := callsDB.UniQuery1.FieldByName('NAME').AsString; order.companyName := callsDB.UniQuery1.FieldByName('COMPANY_NAME').AsString;
order.jobName := callsDB.UniQuery1.FieldByName('staff_fields_job_name').AsString; order.jobName := callsDB.UniQuery1.FieldByName('JOB_NAME').AsString;
order.orderDate := callsDB.UniQuery1.FieldByName('ORDER_DATE').AsString; order.orderDate := callsDB.UniQuery1.FieldByName('ORDER_DATE').AsString;
order.proofDue := callsDB.UniQuery1.FieldByName('staff_fields_proof_date').AsString; order.proofDue := callsDB.UniQuery1.FieldByName('PROOF_DUE').AsString;
order.proofDone := callsDB.UniQuery1.FieldByName('PROOF_DONE').AsString;
order.artDue := callsDB.UniQuery1.FieldByName('ART_DUE').AsString;
order.artDone := callsDB.UniQuery1.FieldByName('ART_DONE').AsString;
order.mountDue := callsDB.UniQuery1.FieldByName('MOUNT_DUE').AsString;
order.mountDone := callsDB.UniQuery1.FieldByName('MOUNT_DONE').AsString;
order.shipDue := callsDB.UniQuery1.FieldByName('SHIP_DUE').AsString;
order.shipDone := callsDB.UniQuery1.FieldByName('SHIP_DONE').AsString;
order.price := callsDB.UniQuery1.FieldByName('PRICE').AsString;
order.qbRefNum := callsDB.UniQuery1.FieldByName('QB_REF_NUM').AsString;
{SQL := 'SELECT oss.STATUS_DATE ' +
'FROM orders_status_schedule oss ' +
'WHERE oss.ORDER_ID = ' + IntToStr(order.ID) + ' ' +
'AND oss.ORDER_STATUS = ' + QuotedStr('PROOF');
//select oss.STATUS_DATE from orders_status_schedule oss JOIN orders o where oss.ORDER_ID = o.ORDER_ID and oss.ORDER_STATUS = 'PROOF';
SQL := 'select oss.STATUS_DATE from orders_status_schedule oss where oss.ORDER_ID = ' + IntToStr(order.ID) + ' and oss.ORDER_STATUS = ' + quotedStr('PROOF');
doQuery(callsDB.UniQuery2, SQL);
order.proofDue := callsDB.UniQuery2.FieldByName('STATUS_DATE').AsString;
SQL := '(select os.STATUS_TIMESTAMP from orders_status os where os.ORDER_ID = ' + IntToStr(order.ID) + ' and os.ORDER_STATUS = ' + quotedStr('PROOF') + ' order by os.STATUS_TIMESTAMP desc LIMIT 1) AS PROOF_DONE';
doQuery(callsDB.UniQuery2, SQL);
order.proofDone := '???'; order.proofDone := '???';
order.artDue := callsDB.UniQuery1.FieldByName('staff_fields_art_due').AsString; order.artDue := callsDB.UniQuery1.FieldByName('staff_fields_art_due').AsString;
order.artDone := '???'; order.artDone := '???';
...@@ -251,9 +312,9 @@ begin ...@@ -251,9 +312,9 @@ begin
order.mountDone := '???'; order.mountDone := '???';
order.shipDue := callsDB.UniQuery1.FieldByName('staff_fields_ship_date').AsString; order.shipDue := callsDB.UniQuery1.FieldByName('staff_fields_ship_date').AsString;
order.shipDone := '???'; order.shipDone := '???';
order.price := callsDB.UniQuery1.FieldByName('staff_fields_price').AsString;
order.qbRefNum := -1; order.qbRefNum := -1; }
order.colors := -1; order.colors := '-1';
callsDB.UniQuery1.Next; callsDB.UniQuery1.Next;
end; end;
......
[Options] [Options]
LogFileNum=51 LogFileNum=82
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