Commit f47d5190 by cam

Orders Page is now properly displaying orders

parent c99d264d
...@@ -40,6 +40,23 @@ object FViewCalls: TFViewCalls ...@@ -40,6 +40,23 @@ object FViewCalls: TFViewCalls
'25' '25'
'50') '50')
end end
object wcbSortBy: TWebComboBox
Left = 442
Top = 52
Width = 145
Height = 21
ElementClassName = 'custom-select'
ElementID = 'wcbsortby'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Text = 'Date'
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'Date'
'Phone Number')
end
object btnApply: TWebButton object btnApply: TWebButton
Left = 478 Left = 478
Top = 128 Top = 128
...@@ -55,30 +72,20 @@ object FViewCalls: TFViewCalls ...@@ -55,30 +72,20 @@ object FViewCalls: TFViewCalls
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnApplyClick OnClick = btnApplyClick
end end
object edtName: TWebEdit object edtSearch: TWebEdit
Left = 342 Left = 48
Top = 0 Top = 382
Width = 121 Width = 121
Height = 22 Height = 22
ChildOrder = 10 HelpType = htKeyword
ChildOrder = 8
ElementClassName = 'form-control' ElementClassName = 'form-control'
ElementID = 'edtname' ElementID = 'edtsearch'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtDescription: TWebEdit
Left = 478
Top = 0
Width = 121
Height = 22
ChildOrder = 10
ElementClassName = 'form-control'
ElementID = 'edtdescription'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False
TextHint = 'Format: (XXX) XXX-XXXX'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
...@@ -87,7 +94,58 @@ object FViewCalls: TFViewCalls ...@@ -87,7 +94,58 @@ object FViewCalls: TFViewCalls
Top = 240 Top = 240
end end
object XDataWebDataSet1: TXDataWebDataSet object XDataWebDataSet1: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 440 Left = 440
Top = 300 Top = 300
object XDataWebDataSet1companyName: TStringField
FieldName = 'companyName'
end
object XDataWebDataSet1jobName: TStringField
FieldName = 'jobName'
end
object XDataWebDataSet1orderDate: TStringField
FieldName = 'orderDate'
end
object XDataWebDataSet1proofDue: TStringField
FieldName = 'proofDue'
end
object XDataWebDataSet1proofDone: TStringField
FieldName = 'proofDone'
end
object XDataWebDataSet1artDue: TStringField
FieldName = 'artDue'
end
object XDataWebDataSet1artDone: TStringField
FieldName = 'artDone'
end
object XDataWebDataSet1mountDue: TStringField
FieldName = 'mountDue'
end
object XDataWebDataSet1mountDone: TStringField
FieldName = 'mountDone'
end
object XDataWebDataSet1shipDue: TStringField
FieldName = 'shipDue'
end
object XDataWebDataSet1shipDone: TStringField
FieldName = 'shipDone'
end
object XDataWebDataSet1price: TStringField
FieldName = 'price'
end
object XDataWebDataSet1qbRefNum: TIntegerField
FieldName = 'qbRefNum'
end
object XDataWebDataSet1colors: TIntegerField
FieldName = 'colors'
end
object XDataWebDataSet1ID: TIntegerField
FieldName = 'ID'
end
end
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
Left = 450
Top = 388
end end
end end
...@@ -5,33 +5,39 @@ ...@@ -5,33 +5,39 @@
<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="row">
<div class="col-sm-6"> <div class="col-sm-6">
<label style="font-weight: 700;">Name:</label> <label style="font-weight: 700;">Start Date:</label>
<input class="form-control input-sm" id="edtname"> <input class="form-control input-sm" id="dtpstartdate" type="date">
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<label class= 'pe-2'style="font-weight: 700;">Description:</label> <label class= 'pe-2'style="font-weight: 700;">End Date:</label>
<input class="form-control input-sm" id="edtdescription"> <input class="form-control input-sm" id="dtpenddate" type="date">
</div> </div>
</div> </div>
</form> </form>
<div class="row">
<div class="col-sm">
<form class='form-inline'>
<div class="col-sm">
<div class="form-cells"><input type="checkbox" id="cbstatus"></div>
<div class="form-cells ps-1 py-2"><label style="font-weight: 700;font-size: 15px" id="lblactive">Active?</label></div>
</div>
</form>
</div>
</div>
<form class="form-inline"> <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>
</div> </div>
<div class="col-sm-5"> <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> <button class= "ps-3" id="btnapply"></button>
</div> </div>
</div> </div>
...@@ -40,10 +46,21 @@ ...@@ -40,10 +46,21 @@
<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>
<th scope="col">ID</th> <th scope="col">Order ID</th>
<th scope="col">Name</th> <th scope="col">Company Name</th>
<th scope="col">Description</th> <th scope="col">Job Name</th>
<th scope="col">Status</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> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -80,27 +97,10 @@ ...@@ -80,27 +97,10 @@
</div> </div>
<script> <script>
document.getElementById('tblPhoneGrid').addEventListener('click', function(event) { // JavaScript function to stop audio
// Check if the clicked element is a table cell (td) function stopAudio() {
if (event.target.tagName === 'TD') { var audioPlayer = document.getElementById('audioPlayer');
const row = event.target.parentNode; audioPlayer.pause(); // Pause the audio
const cells = row.getElementsByTagName('td'); audioPlayer.currentTime = 0; // Reset audio to beginning
}
// Extract data from the row
const id = cells[0].textContent;
const name = cells[1].textContent;
const description = cells[2].textContent;
const status = cells[3].textContent.trim().toLowerCase();
// Populate form fields
document.getElementById('edtname').value = name;
document.getElementById('edtdescription').value = description;
// Set the checkbox based on the status
const isActive = status === 'active';
document.getElementById('cbstatus').checked = isActive;
console.log(`Row clicked! ID: ${id}, Name: ${name}, Description: ${description}, Status: ${status}`);
}
});
</script> </script>
object FViewItems: TFViewItems
Width = 676
Height = 480
CSSLibrary = cssBootstrap
ElementFont = efCSS
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
OnCreate = WebFormCreate
object lblEntries: TWebLabel
Left = 0
Top = 336
Width = 77
Height = 13
Caption = 'Showing 0 of ...'
ElementID = 'lblentries'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object wcbPageSize: TWebComboBox
Left = 0
Top = 0
Width = 145
Height = 21
ElementClassName = 'custom-select'
ElementID = 'wcbpagesize'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Text = '10'
WidthPercent = 100.000000000000000000
OnChange = wcbPageSizeChange
ItemIndex = -1
Items.Strings = (
'10'
'25'
'50')
end
object btnApply: TWebButton
Left = 478
Top = 128
Width = 96
Height = 25
Caption = 'Apply'
ChildOrder = 7
ElementClassName = 'btn btn-light'
ElementID = 'btnapply'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnApplyClick
end
object edtName: TWebEdit
Left = 342
Top = 0
Width = 121
Height = 22
ChildOrder = 10
ElementClassName = 'form-control'
ElementID = 'edtname'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtDescription: TWebEdit
Left = 478
Top = 0
Width = 121
Height = 22
ChildOrder = 10
ElementClassName = 'form-control'
ElementID = 'edtdescription'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbStatus: TWebCheckBox
Left = 354
Top = 52
Width = 113
Height = 22
ChildOrder = 5
ElementClassName = 'custom-control custom-checkbox'
ElementButtonClassName = 'custom-control-input'
ElementLabelClassName = 'custom-control-label'
ElementID = 'cbstatus'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 426
Top = 240
end
object XDataWebDataSet1: TXDataWebDataSet
Left = 440
Top = 300
end
end
<div class="row">
<div class="col-12">
<h1 class="page-header pt-3" id="view.calls.title" style="font-size: 24px;">Calls</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 style="font-weight: 700;">Name:</label>
<input class="form-control input-sm" id="edtname">
</div>
<div class="col-sm-6">
<label class= 'pe-2'style="font-weight: 700;">Description:</label>
<input class="form-control input-sm" id="edtdescription">
</div>
</div>
</form>
<div class="row">
<div class="col-sm">
<form class='form-inline'>
<div class="col-sm">
<div class="form-cells"><input type="checkbox" id="cbstatus"></div>
<div class="form-cells ps-1 py-2"><label style="font-weight: 700;font-size: 15px" id="lblactive">Active?</label></div>
</div>
</form>
</div>
</div>
<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">
<button class= "ps-3" id="btnapply"></button>
</div>
</div>
</form>
<table class="table table-responsive table-striped table-bordered" id="tblPhoneGrid">
<thead class="thead-dark">
<tr>
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col">Description</th>
<th scope="col">Status</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>
</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>
document.getElementById('tblPhoneGrid').addEventListener('click', function(event) {
// Check if the clicked element is a table cell (td)
if (event.target.tagName === 'TD') {
const row = event.target.parentNode;
const cells = row.getElementsByTagName('td');
// Extract data from the row
const id = cells[0].textContent;
const name = cells[1].textContent;
const description = cells[2].textContent;
const status = cells[3].textContent.trim().toLowerCase();
// Populate form fields
document.getElementById('edtname').value = name;
document.getElementById('edtdescription').value = description;
// Set the checkbox based on the status
const isActive = status === 'active';
document.getElementById('cbstatus').checked = isActive;
console.log(`Row clicked! ID: ${id}, Name: ${name}, Description: ${description}, Status: ${status}`);
}
});
</script>
...@@ -27,8 +27,8 @@ object FViewMain: TFViewMain ...@@ -27,8 +27,8 @@ object FViewMain: TFViewMain
Caption = ' User Profile' Caption = ' User Profile'
end end
object wllblLogout: TWebLinkLabel object wllblLogout: TWebLinkLabel
Left = 551 Left = 548
Top = 85 Top = 103
Width = 41 Width = 41
Height = 15 Height = 15
ElementID = 'dropdown.menu.logout' ElementID = 'dropdown.menu.logout'
...@@ -60,8 +60,8 @@ object FViewMain: TFViewMain ...@@ -60,8 +60,8 @@ object FViewMain: TFViewMain
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblCallsList: TWebLinkLabel object lblCallsList: TWebLinkLabel
Left = 564 Left = 560
Top = 56 Top = 69
Width = 29 Width = 29
Height = 15 Height = 15
ElementID = 'dropdown.menu.itemlist' ElementID = 'dropdown.menu.itemlist'
...@@ -73,7 +73,7 @@ object FViewMain: TFViewMain ...@@ -73,7 +73,7 @@ object FViewMain: TFViewMain
end end
object lblUsers: TWebLinkLabel object lblUsers: TWebLinkLabel
Left = 561 Left = 561
Top = 70 Top = 86
Width = 28 Width = 28
Height = 15 Height = 15
ElementID = 'dropdown.menu.users' ElementID = 'dropdown.menu.users'
...@@ -83,6 +83,19 @@ object FViewMain: TFViewMain ...@@ -83,6 +83,19 @@ object FViewMain: TFViewMain
OnClick = lblUsersClick OnClick = lblUsersClick
Caption = 'Users' Caption = 'Users'
end end
object lblorders: TWebLabel
Left = 556
Top = 52
Width = 35
Height = 15
Caption = 'Orders'
ElementID = 'lblorders'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblordersClick
end
object WebPanel1: TWebPanel object WebPanel1: TWebPanel
Left = 77 Left = 77
Top = 112 Top = 112
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
<a class="dropdown-item" id="dropdown.menu.userprofile" href="#"><i class="fa fa-user fa-fw"></i><span> User Profile</span></a> <a class="dropdown-item" id="dropdown.menu.userprofile" href="#"><i class="fa fa-user fa-fw"></i><span> User Profile</span></a>
</li> </li>
<li> <li>
<a class="dropdown-item" id="lblorders" href="#"><i class="fa fa-home fa-fw"></i><span> Orders</span></a>
</li>
<li>
<a class="dropdown-item" id="dropdown.menu.itemlist" href="#"><i class="fa fa-phone fa-fw"></i><span> Items</span></a> <a class="dropdown-item" id="dropdown.menu.itemlist" href="#"><i class="fa fa-phone fa-fw"></i><span> Items</span></a>
</li> </li>
<li> <li>
......
...@@ -21,6 +21,7 @@ type ...@@ -21,6 +21,7 @@ type
XDataWebClient: TXDataWebClient; XDataWebClient: TXDataWebClient;
lblCallsList: TWebLinkLabel; lblCallsList: TWebLinkLabel;
lblUsers: TWebLinkLabel; lblUsers: TWebLinkLabel;
lblorders: TWebLabel;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure mnuLogoutClick(Sender: TObject); procedure mnuLogoutClick(Sender: TObject);
procedure wllblUserProfileClick(Sender: TObject); procedure wllblUserProfileClick(Sender: TObject);
...@@ -28,6 +29,7 @@ type ...@@ -28,6 +29,7 @@ type
procedure lblHomeClick(Sender: TObject); procedure lblHomeClick(Sender: TObject);
procedure lblCallsListClick(Sender: TObject); procedure lblCallsListClick(Sender: TObject);
procedure lblUsersClick(Sender: TObject); procedure lblUsersClick(Sender: TObject);
procedure lblordersClick(Sender: TObject);
private private
{ Private declarations } { Private declarations }
FUserInfo: string; FUserInfo: string;
...@@ -57,9 +59,10 @@ uses ...@@ -57,9 +59,10 @@ uses
View.Login, View.Login,
View.UserProfile, View.UserProfile,
View.Home, View.Home,
View.Calls, View.Items,
View.Users, View.Users,
View.EditUser; View.EditUser,
View.Calls;
{$R *.dfm} {$R *.dfm}
...@@ -87,6 +90,11 @@ begin ...@@ -87,6 +90,11 @@ begin
ShowForm(TFViewHome); ShowForm(TFViewHome);
end; end;
procedure TFViewMain.lblordersClick(Sender: TObject);
begin
ShowForm(TFViewCalls);
end;
procedure TFViewMain.lblUsersClick(Sender: TObject); procedure TFViewMain.lblUsersClick(Sender: TObject);
begin begin
ShowForm(TFViewUsers); ShowForm(TFViewUsers);
...@@ -94,7 +102,7 @@ end; ...@@ -94,7 +102,7 @@ end;
procedure TFViewMain.lblCallsListClick(Sender: TObject); procedure TFViewMain.lblCallsListClick(Sender: TObject);
begin begin
ShowForm(TFViewCalls); ShowForm(TFViewItems);
end; end;
procedure TFViewMain.mnuLogoutClick(Sender: TObject); procedure TFViewMain.mnuLogoutClick(Sender: TObject);
......
...@@ -13,11 +13,12 @@ uses ...@@ -13,11 +13,12 @@ uses
View.ErrorPage in 'View.ErrorPage.pas' {FViewErrorPage: TWebForm} {*.html}, View.ErrorPage in 'View.ErrorPage.pas' {FViewErrorPage: TWebForm} {*.html},
App.Config in 'App.Config.pas', App.Config in 'App.Config.pas',
Paginator.Plugins in 'Paginator.Plugins.pas', Paginator.Plugins in 'Paginator.Plugins.pas',
View.Calls in 'View.Calls.pas' {FViewCalls: TWebForm} {*.html}, View.Items in 'View.Items.pas' {FViewItems: TWebForm} {*.html},
View.Main in 'View.Main.pas' {FViewMain: TWebForm} {*.html}, View.Main in 'View.Main.pas' {FViewMain: TWebForm} {*.html},
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};
{$R *.res} {$R *.res}
......
...@@ -136,8 +136,8 @@ ...@@ -136,8 +136,8 @@
</DCCReference> </DCCReference>
<DCCReference Include="App.Config.pas"/> <DCCReference Include="App.Config.pas"/>
<DCCReference Include="Paginator.Plugins.pas"/> <DCCReference Include="Paginator.Plugins.pas"/>
<DCCReference Include="View.Calls.pas"> <DCCReference Include="View.Items.pas">
<Form>FViewCalls</Form> <Form>FViewItems</Form>
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
...@@ -161,6 +161,11 @@ ...@@ -161,6 +161,11 @@
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="View.Calls.pas">
<Form>FViewCalls</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<None Include="index.html"/> <None Include="index.html"/>
<None Include="template\css\app.css"/> <None Include="template\css\app.css"/>
<BuildConfiguration Include="Base"> <BuildConfiguration Include="Base">
......
...@@ -83,6 +83,32 @@ type ...@@ -83,6 +83,32 @@ type
data: TList<TItemItem>; data: TList<TItemItem>;
end; end;
TOrderItem = class
public
ID: integer;
companyName: string;
jobName: string;
orderDate: string;
proofDue: string;
proofDone: string;
artDue: string;
artDone: string;
mountDue: string;
mountDone: string;
shipDue: string;
shipDone: string;
price: string;
qbRefNum: integer;
colors: integer;
end;
TOrderList = class
Public
count: integer;
data: TList<TOrderItem>
end;
type type
[ServiceContract] [ServiceContract]
...@@ -92,6 +118,7 @@ type ...@@ -92,6 +118,7 @@ type
[HttpGet] function Search(phoneNum: string): TCallList; [HttpGet] function Search(phoneNum: string): TCallList;
[HttpGet] function GetUsers(searchOptions: string): TUserList; [HttpGet] function GetUsers(searchOptions: string): TUserList;
[HttpGet] function GetItems(searchOptions: string): TItemList; [HttpGet] function GetItems(searchOptions: string): TItemList;
[HttpGet] function GetOrders(searchOptions: string): TOrderList;
function AddUser(userInfo: string): string; function AddUser(userInfo: string): string;
function AddItem(itemInfo: string): string; function AddItem(itemInfo: string): string;
function DelUser(username: string): string; function DelUser(username: string): string;
......
...@@ -24,6 +24,7 @@ type ...@@ -24,6 +24,7 @@ type
function GetItems(searchOptions: string): TItemList; function GetItems(searchOptions: string): TItemList;
function GetUsers(searchOptions: string): TUserList; function GetUsers(searchOptions: string): TUserList;
function GetCalls(searchOptions: string): TCallList; function GetCalls(searchOptions: string): TCallList;
function GetOrders(searchOptions: string): TOrderList;
function EditUser(const editOptions: string): string; function EditUser(const editOptions: string): string;
function Search(phoneNum: string): TCallList; function Search(phoneNum: string): TCallList;
function AddUser(userInfo: string): string; function AddUser(userInfo: string): string;
...@@ -201,6 +202,68 @@ begin ...@@ -201,6 +202,68 @@ begin
callsDB.UniQuery1.Close; callsDB.UniQuery1.Close;
end; end;
function TLookupService.GetOrders(searchOptions: string): TOrderList;
var
params: TStringList;
PageNum: integer;
PageSize: integer;
OrderBy: string;
offset: string;
limit: string;
SQL: string;
Order: TOrderItem;
begin
params := TStringList.Create;
params.StrictDelimiter := true;
// parse the searchOptions
params.Delimiter := '&';
params.DelimitedText := searchOptions;
PageNum := StrToInt(params.Values['pagenumber']);
PageSize := StrToInt(params.Values['pagesize']);
OrderBy := params.Values['orderby'];
offset := IntToStr((PageNum - 1) * PageSize);
limit := IntToStr(PageSize);
SQL := 'select * from web_plate_orders ' + 'limit ' + limit + ' offset ' + offset;
doQuery(callsDB.UniQuery1, SQL);
Result:= TOrderList.Create;
Result.data := TList<TOrderItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
while not callsDB.UniQuery1.Eof do
begin
Order := TOrderItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Order );
Result.data.Add( Order );
order.ID := callsDB.UniQuery1.FieldByName('ORDER_ID').AsInteger;
order.companyName := '???';
order.jobName := callsDB.UniQuery1.FieldByName('staff_fields_job_name').AsString;
order.orderDate := callsDB.UniQuery1.FieldByName('ORDER_DATE').AsString;
order.proofDue := callsDB.UniQuery1.FieldByName('staff_fields_proof_date').AsString;
order.proofDone := '???';
order.artDue := callsDB.UniQuery1.FieldByName('staff_fields_art_due').AsString;
order.artDone := '???';
order.mountDue := '???';
order.mountDone := '???';
order.shipDue := callsDB.UniQuery1.FieldByName('staff_fields_ship_date').AsString;
order.shipDone := '???';
order.price := callsDB.UniQuery1.FieldByName('staff_fields_price').AsString;
order.qbRefNum := -1;
order.colors := -1;
callsDB.UniQuery1.Next;
end;
callsDB.UniQuery1.Close;
SQL:= 'select count(*) as total_count from web_plate_orders';
doQuery(callsDB.UniQuery1, SQL);
Result.count := callsDB.UniQuery1.FieldByName('total_count').AsInteger;
callsDB.UniQuery1.Close;
end;
function TLookupService.GetItems(searchOptions: string): TItemList; function TLookupService.GetItems(searchOptions: string): TItemList;
var var
params: TStringList; params: TStringList;
...@@ -471,6 +534,8 @@ begin ...@@ -471,6 +534,8 @@ begin
doQuery(callsDB.UniQuery1, SQL); doQuery(callsDB.UniQuery1, SQL);
if callsDB.UniQuery1.IsEmpty then if callsDB.UniQuery1.IsEmpty then
begin begin
callsDB.UniQuery1.Insert;
callsDB.UniQuery1.FieldByName('qb_item_name').AsString := Name; callsDB.UniQuery1.FieldByName('qb_item_name').AsString := Name;
callsDB.UniQuery1.FieldByName('item_desc').AsString := Description; callsDB.UniQuery1.FieldByName('item_desc').AsString := Description;
if Status then if Status then
......
object FMain: TFMain object FMain: TFMain
Left = 0 Left = 0
Top = 0 Top = 0
Caption = 'envoy Calls Server 2' Caption = 'KG Orders Server'
ClientHeight = 597 ClientHeight = 597
ClientWidth = 764 ClientWidth = 764
Color = clBtnFace Color = clBtnFace
......
[Options] [Options]
LogFileNum=32 LogFileNum=46
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