Commit ab14864b by Cam Hayes

Finished the changes discussed with Dave and Elias

parent aba393fe
...@@ -186,6 +186,7 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -186,6 +186,7 @@ object FViewAddCustomer: TFViewAddCustomer
ElementID = 'btndelete' ElementID = 'btndelete'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnDeleteClick
end end
object btnClose: TWebButton object btnClose: TWebButton
Left = 19 Left = 19
...@@ -319,18 +320,6 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -319,18 +320,6 @@ object FViewAddCustomer: TFViewAddCustomer
end> end>
DataSource = wdsShipTo DataSource = wdsShipTo
end end
object btnAddAddress: TWebButton
Left = 190
Top = 420
Width = 96
Height = 25
Caption = 'Add Address'
ChildOrder = 21
ElementID = 'btnaddaddress'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnAddAddressClick
end
object edtShippingAddress: TWebEdit object edtShippingAddress: TWebEdit
Left = 190 Left = 190
Top = 460 Top = 460
...@@ -338,8 +327,10 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -338,8 +327,10 @@ object FViewAddCustomer: TFViewAddCustomer
Height = 22 Height = 22
ChildOrder = 22 ChildOrder = 22
ElementID = 'edtshippingaddress' ElementID = 'edtshippingaddress'
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = edtShippingAddressChange
end end
object edtShippingState: TWebEdit object edtShippingState: TWebEdit
Left = 190 Left = 190
...@@ -348,8 +339,10 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -348,8 +339,10 @@ object FViewAddCustomer: TFViewAddCustomer
Height = 22 Height = 22
ChildOrder = 22 ChildOrder = 22
ElementID = 'edtshippingstate' ElementID = 'edtshippingstate'
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = edtShippingAddressChange
end end
object edtShippingContact: TWebEdit object edtShippingContact: TWebEdit
Left = 190 Left = 190
...@@ -358,8 +351,10 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -358,8 +351,10 @@ object FViewAddCustomer: TFViewAddCustomer
Height = 22 Height = 22
ChildOrder = 22 ChildOrder = 22
ElementID = 'edtshippingcontact' ElementID = 'edtshippingcontact'
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = edtShippingAddressChange
end end
object edtShippingZip: TWebEdit object edtShippingZip: TWebEdit
Left = 190 Left = 190
...@@ -368,8 +363,10 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -368,8 +363,10 @@ object FViewAddCustomer: TFViewAddCustomer
Height = 22 Height = 22
ChildOrder = 22 ChildOrder = 22
ElementID = 'edtshippingzip' ElementID = 'edtshippingzip'
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = edtShippingAddressChange
end end
object edtShippingCity: TWebEdit object edtShippingCity: TWebEdit
Left = 190 Left = 190
...@@ -378,20 +375,135 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -378,20 +375,135 @@ object FViewAddCustomer: TFViewAddCustomer
Height = 22 Height = 22
ChildOrder = 22 ChildOrder = 22
ElementID = 'edtshippingcity' ElementID = 'edtshippingcity'
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = edtShippingAddressChange
end
object memoShipBlock: TWebMemo
Left = 508
Top = 460
Width = 185
Height = 89
ElementID = 'memoshipblock'
Enabled = False
HeightPercent = 100.000000000000000000
SelLength = 0
SelStart = 0
WidthPercent = 100.000000000000000000
OnChange = edtShippingAddressChange
end
object memoAddressBlock: TWebMemo
Left = 162
Top = 86
Width = 185
Height = 89
ElementID = 'memoaddressblock'
Enabled = False
HeightPercent = 100.000000000000000000
SelLength = 0
SelStart = 0
WidthPercent = 100.000000000000000000
OnChange = memoAddressBlockChange
end
object btnAdd: TWebButton
Left = 19
Top = 535
Width = 96
Height = 25
Caption = 'Add'
ChildOrder = 84
ElementID = 'btnadd'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnAddClick
end
object btnShipSave: TWebButton
Left = 339
Top = 441
Width = 96
Height = 25
Caption = 'Save'
ChildOrder = 79
ElementID = 'btnshipconfirm'
ElementPosition = epRelative
HeightPercent = 100.000000000000000000
Role = 'null'
WidthPercent = 100.000000000000000000
OnClick = btnShipSaveClick
end
object btnShipCancel: TWebButton
Left = 339
Top = 480
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 79
ElementID = 'btnshipcancel'
ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end end
object btnClear: TWebButton object btnShipDelete: TWebButton
Left = 296 Left = 339
Top = 420 Top = 410
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Clear' Caption = 'Delete'
ChildOrder = 27 ChildOrder = 79
ElementID = 'btnclear' ElementID = 'btnshipdelete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnShipDeleteClick
end
object btnShipEdit: TWebButton
Left = 339
Top = 511
Width = 96
Height = 25
Caption = 'Edit'
ChildOrder = 83
ElementID = 'btnshipedit'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnShipEditClick
end
object btnShipAdd: TWebButton
Left = 339
Top = 549
Width = 96
Height = 25
Caption = 'Add'
ChildOrder = 84
ElementID = 'btnshipadd'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnShipAddClick
end
object btn_confirm_delete: TWebButton
Left = 725
Top = 433
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 82
ElementID = 'btn_confirm_delete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btn_confirm_deleteClick
end
object edtFirstLine: TWebEdit
Left = 190
Top = 430
Width = 121
Height = 22
ChildOrder = 35
ElementID = 'edtfirstline'
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnClearClick
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
...@@ -482,4 +594,10 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -482,4 +594,10 @@ object FViewAddCustomer: TFViewAddCustomer
FieldName = 'contact' FieldName = 'contact'
end end
end end
object tmrReturn: TWebTimer
Enabled = False
OnTimer = tmrReturnTimer
Left = 542
Top = 42
end
end end
...@@ -5,9 +5,9 @@ object FAddOrder: TFAddOrder ...@@ -5,9 +5,9 @@ object FAddOrder: TFAddOrder
object WebLabel1: TWebLabel object WebLabel1: TWebLabel
Left = 4 Left = 4
Top = 81 Top = 81
Width = 35 Width = 95
Height = 15 Height = 15
Caption = 'Search' Caption = 'Search Customers'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
...@@ -16,7 +16,7 @@ object FAddOrder: TFAddOrder ...@@ -16,7 +16,7 @@ object FAddOrder: TFAddOrder
Top = 81 Top = 81
Width = 113 Width = 113
Height = 15 Height = 15
Caption = 'Selected Company ID' Caption = 'Selected Customer ID'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
...@@ -74,7 +74,7 @@ object FAddOrder: TFAddOrder ...@@ -74,7 +74,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 70.000000000000000000 Width = 90.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -119,7 +119,7 @@ object FAddOrder: TFAddOrder ...@@ -119,7 +119,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 382.000000000000000000 Width = 362.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
......
...@@ -154,9 +154,9 @@ begin ...@@ -154,9 +154,9 @@ begin
// Set up column headers // Set up column headers
TMSFNCGrid1.ColumnCount := 4; TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1; TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'DBID'; TMSFNCGrid1.Cells[0, 0] := 'Customer Num';
TMSFNCGrid1.Cells[1, 0] := 'ID'; TMSFNCGrid1.Cells[1, 0] := 'Customer ID';
TMSFNCGrid1.Cells[2, 0] := 'Name'; TMSFNCGrid1.Cells[2, 0] := 'Customer Name';
TMSFNCGrid1.Cells[3, 0] := 'Address'; TMSFNCGrid1.Cells[3, 0] := 'Address';
// Populate the grid with data from the dataset // Populate the grid with data from the dataset
......
...@@ -114,15 +114,15 @@ object FViewCustomers: TFViewCustomers ...@@ -114,15 +114,15 @@ object FViewCustomers: TFViewCustomers
Columns = < Columns = <
item item
DataField = 'CUSTOMER_ID' DataField = 'CUSTOMER_ID'
Title = 'Customer ID' Title = 'Customer Num'
end end
item item
DataField = 'SHORT_NAME' DataField = 'SHORT_NAME'
Title = 'Account Name' Title = 'Customer ID'
end end
item item
DataField = 'NAME' DataField = 'NAME'
Title = 'Name' Title = 'Customer Name'
end end
item item
DataField = 'START_DATE' DataField = 'START_DATE'
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<button id="btnaddcustomer" class="btn btn-secondary">Add Customer</button> <button id="btnaddcustomer" class="btn btn-secondary">Add Customer</button>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Company Account Name:</label> <label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer ID:</label>
<input id="edtfilter" type="text" class="form-control" style="width: 200px;" /> <input id="edtfilter" type="text" class="form-control" style="width: 200px;" />
</div> </div>
</div> </div>
......
...@@ -15,7 +15,6 @@ uses ...@@ -15,7 +15,6 @@ uses
type type
TFViewCustomers = class(TWebForm) TFViewCustomers = class(TWebForm)
lblEntries: TWebLabel;
btnAddCustomer: TWebButton; btnAddCustomer: TWebButton;
wcbPageSize: TWebComboBox; wcbPageSize: TWebComboBox;
pnlMessage: TWebPanel; pnlMessage: TWebPanel;
...@@ -30,6 +29,7 @@ type ...@@ -30,6 +29,7 @@ type
xdwdsCustomersCUSTOMER_ID: TIntegerField; xdwdsCustomersCUSTOMER_ID: TIntegerField;
wdbtcCustomers: TWebDBTableControl; wdbtcCustomers: TWebDBTableControl;
edtFilter: TWebEdit; edtFilter: TWebEdit;
lblEntries: TWebLabel;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure btnAddCustomerClick(Sender: TObject); procedure btnAddCustomerClick(Sender: TObject);
procedure wdbtcCustomersDblClickCell(Sender: TObject; ACol, ARow: Integer); procedure wdbtcCustomersDblClickCell(Sender: TObject; ACol, ARow: Integer);
...@@ -115,7 +115,7 @@ begin ...@@ -115,7 +115,7 @@ begin
else if (PageNumber * PageSize) < customerListLength then else if (PageNumber * PageSize) < customerListLength then
begin begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) + ' - ' + IntToStr(customerListLength) +
' of ' + IntToStr(customerListLength); ' of ' + IntToStr(customerListLength);
end end
else if (PageNumber * PageSize) >= customerListLength then else if (PageNumber * PageSize) >= customerListLength then
......
...@@ -38,25 +38,25 @@ ...@@ -38,25 +38,25 @@
<div class="col-12 col-md-8"> <div class="col-12 col-md-8">
</div> </div>
<h4 class="custom-h4 mt-3">Company</h4> <h4 class="custom-h4 mt-3">Customer</h4>
<hr class="custom-hr"> <hr class="custom-hr">
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Company Name:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer Name:</label>
<input id="edtcompanyname" type="text" class="form-control" style="width: 300px;" required/> <input id="edtcompanyname" type="text" class="form-control" style="width: 300px;" required/>
<div class="invalid-feedback" style="font-size: 15px;"> <div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Company Name. Please Provide a Customer Name.
</div> </div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Account Company Name:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer ID:</label>
<input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px" required/> <input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px" required/>
<div class="invalid-feedback" style="font-size: 15px;"> <div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Company Account Name. Please Provide a Customer ID Name.
</div> </div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">In Quickbooks?:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">In Quickbooks?:</label>
<input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/> <input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/>
</div> </div>
</div> </div>
......
...@@ -34,25 +34,25 @@ ...@@ -34,25 +34,25 @@
</div> </div>
</nav> </nav>
<div class="row mx-5"> <div class="row mx-5">
<h4 class="custom-h4 mt-3">Company</h4> <h4 class="custom-h4 mt-3">Customer</h4>
<hr class="custom-hr"> <hr class="custom-hr">
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Company Name:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer Name:</label>
<input id="edtcompanyname" type="text" class="form-control" style="width: 300px;" required/> <input id="edtcompanyname" type="text" class="form-control" style="width: 300px;" required/>
<div class="invalid-feedback" style="font-size: 15px;"> <div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Company Name. Please Provide a Customer Name.
</div> </div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Account Company Name:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer ID:</label>
<input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px" required/> <input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px" required/>
<div class="invalid-feedback" style="font-size: 15px;"> <div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Company Account Name. Please Provide a Customer ID.
</div> </div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">In Quickbooks?:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">>In Quickbooks?:</label>
<input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/> <input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/>
</div> </div>
</div> </div>
......
...@@ -34,25 +34,25 @@ ...@@ -34,25 +34,25 @@
</div> </div>
</nav> </nav>
<div class="row mx-5"> <div class="row mx-5">
<h4 class="custom-h4 mt-3">Company</h4> <h4 class="custom-h4 mt-3">Customer</h4>
<hr class="custom-hr"> <hr class="custom-hr">
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Company Name:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer Name:</label>
<input id="edtcompanyname" type="text" class="form-control" style="width: 300px;" required/> <input id="edtcompanyname" type="text" class="form-control" style="width: 300px;" required/>
<div class="invalid-feedback" style="font-size: 15px;"> <div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Company Name. Please Provide a Customer Name.
</div> </div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Account Company Name:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer ID:</label>
<input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px" required/> <input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px" required/>
<div class="invalid-feedback" style="font-size: 15px;"> <div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Company Account Name. Please Provide a Customer ID.
</div> </div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">In Quickbooks?:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">In Quickbooks?:</label>
<input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/> <input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/>
</div> </div>
</div> </div>
......
...@@ -129,11 +129,11 @@ object FViewOrders: TFViewOrders ...@@ -129,11 +129,11 @@ object FViewOrders: TFViewOrders
end end
item item
DataField = 'ID' DataField = 'ID'
Title = 'ID' Title = 'Customer ID'
end end
item item
DataField = 'companyName' DataField = 'companyName'
Title = 'Company Name' Title = 'Customer Name'
end end
item item
DataField = 'jobName' DataField = 'jobName'
......
...@@ -149,7 +149,7 @@ object FSearch: TFSearch ...@@ -149,7 +149,7 @@ object FSearch: TFSearch
Top = 56 Top = 56
Width = 107 Width = 107
Height = 14 Height = 14
Caption = 'Search Companies:' Caption = 'Search Customers:'
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
...@@ -162,9 +162,9 @@ object FSearch: TFSearch ...@@ -162,9 +162,9 @@ object FSearch: TFSearch
object lblCompanyID: TWebLabel object lblCompanyID: TWebLabel
Left = 174 Left = 174
Top = 56 Top = 56
Width = 68 Width = 72
Height = 14 Height = 14
Caption = 'Company ID:' Caption = 'Customer ID:'
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
...@@ -207,9 +207,9 @@ object FSearch: TFSearch ...@@ -207,9 +207,9 @@ object FSearch: TFSearch
object WebLabel5: TWebLabel object WebLabel5: TWebLabel
Left = 338 Left = 338
Top = 56 Top = 56
Width = 89 Width = 93
Height = 14 Height = 14
Caption = 'Company Name:' Caption = 'Customer Name:'
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
...@@ -457,7 +457,7 @@ object FSearch: TFSearch ...@@ -457,7 +457,7 @@ object FSearch: TFSearch
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 40.000000000000000000 Width = 80.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -502,7 +502,7 @@ object FSearch: TFSearch ...@@ -502,7 +502,7 @@ object FSearch: TFSearch
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 320.000000000000000000 Width = 280.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
......
...@@ -274,9 +274,9 @@ begin ...@@ -274,9 +274,9 @@ begin
// Set up column headers // Set up column headers
TMSFNCGrid1.ColumnCount := 4; TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1; TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'DBID'; TMSFNCGrid1.Cells[0, 0] := 'Customer Num';
TMSFNCGrid1.Cells[1, 0] := 'ID'; TMSFNCGrid1.Cells[1, 0] := 'Customer ID';
TMSFNCGrid1.Cells[2, 0] := 'Name'; TMSFNCGrid1.Cells[2, 0] := 'Customer Name';
TMSFNCGrid1.Cells[3, 0] := 'Address'; TMSFNCGrid1.Cells[3, 0] := 'Address';
// Populate the grid with data from the dataset // Populate the grid with data from the dataset
......
...@@ -397,6 +397,7 @@ type ...@@ -397,6 +397,7 @@ type
function AddUser(userInfo: string): string; function AddUser(userInfo: string): string;
function AddItem(itemInfo: string): string; function AddItem(itemInfo: string): string;
function AddShippingAddress(Addressinfo: string): TJSONObject; function AddShippingAddress(Addressinfo: string): TJSONObject;
function DelShippingAddress(AddressID, CustomerID: string): TJSONObject;
function DelUser(username: string): string; function DelUser(username: string): string;
function DelOrder(orderID, orderType, UserID: string): TJSONObject; function DelOrder(orderID, orderType, UserID: string): TJSONObject;
function EditUser(const editOptions: string): string; function EditUser(const editOptions: string): string;
......
...@@ -55,6 +55,7 @@ type ...@@ -55,6 +55,7 @@ type
function AddCuttingDieOrder(orderInfo: string): TJSONObject; function AddCuttingDieOrder(orderInfo: string): TJSONObject;
function AddShippingAddress(AddressInfo: string): TJSONObject; function AddShippingAddress(AddressInfo: string): TJSONObject;
function delOrder(OrderID, OrderType, UserID: string): TJSONObject; function delOrder(OrderID, OrderType, UserID: string): TJSONObject;
function DelShippingAddress(AddressID, CustomerID: string): TJSONObject;
function GenerateSubQuery(currStatus: string): string; function GenerateSubQuery(currStatus: string): string;
...@@ -90,6 +91,38 @@ begin ...@@ -90,6 +91,38 @@ begin
inherited; inherited;
end; end;
function TLookupService.DelShippingAddress(AddressID, CustomerID: string): TJSONObject;
var
SQL: string;
ADDRESS_LIST: TJSONArray;
ADDRESS: TJSONObject;
begin
SQL := 'DELETE FROM customers_ship WHERE customer_ship_id = ' + AddressID;
OrdersDB.UniQuery1.SQL.Text := SQL;
OrdersDB.UniQuery1.ExecSQL;
result := TJSONObject.Create;
result.AddPair('status', 'Success:Address Successfully Deleted');
SQL := 'select * FROM customers c LEFT JOIN customers_ship s ON c.CUSTOMER_ID = s.customer_id WHERE c.CUSTOMER_ID = ' + CustomerID;
doQuery(ordersDB.UniQuery1, SQL);
ADDRESS_LIST := TJSONArray.Create;
while not ordersDB.UniQuery1.Eof do
begin
ADDRESS := TJSONObject.Create;
ADDRESS.AddPair('ADDRESS', ordersDB.UniQuery1.FieldByName('ship_block').AsString);
ADDRESS.AddPair('shipping_address', ordersDB.UniQuery1.FieldByName('address').AsString);
ADDRESS.AddPair('city', ordersDB.UniQuery1.FieldByName('city').AsString);
ADDRESS.AddPair('state', ordersDB.UniQuery1.FieldByName('state').AsString);
ADDRESS.AddPair('zip', ordersDB.UniQuery1.FieldByName('zip').AsString);
ADDRESS.AddPair('contact', ordersDB.UniQuery1.FieldByName('contact').AsString);
ADDRESS.AddPair('ship_id', ordersDB.UniQuery1.FieldByName('customer_ship_id').AsString);
ADDRESS_LIST.Add(ADDRESS);
ordersDB.UniQuery1.Next;
end;
Result.AddPair('ADDRESS', ADDRESS_LIST);
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
end;
function TLookupService.GetCustomers: TCustomerList; function TLookupService.GetCustomers: TCustomerList;
// Retrieves a list of customers and sends it to the client in object form. // Retrieves a list of customers and sends it to the client in object form.
// The object contains the ID, Name, Short Name, and the shipping address. // The object contains the ID, Name, Short Name, and the shipping address.
...@@ -142,10 +175,7 @@ begin ...@@ -142,10 +175,7 @@ begin
result.NAME := ordersDB.UniQuery1.FieldByName('NAME').AsString; result.NAME := ordersDB.UniQuery1.FieldByName('NAME').AsString;
result.CUSTOMER_ID := ordersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsInteger; result.CUSTOMER_ID := ordersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsInteger;
result.SHORT_NAME := ordersDB.UniQuery1.FieldByName('SHORT_NAME').AsString; result.SHORT_NAME := ordersDB.UniQuery1.FieldByName('SHORT_NAME').AsString;
result.staff_fields_invoice_to := ordersDB.UniQuery1.FieldByName('BILL_ADDRESS').AsString + result.staff_fields_invoice_to := ordersDB.UniQuery1.FieldByName('BILL_ADDRESS_BLOCK').AsString;
', ' + ordersDB.UniQuery1.FieldByName('BILL_CITY').AsString +
', ' + ordersDB.UniQuery1.FieldByName('BILL_STATE').AsString +
' ' + ordersDB.UniQuery1.FieldByName('BILL_ZIP').AsString;
result.START_DATE := ordersDB.UniQuery1.FieldByName('START_DATE').AsString; result.START_DATE := ordersDB.UniQuery1.FieldByName('START_DATE').AsString;
result.BILL_ADDRESS := ordersDB.UniQuery1.FieldByName('BILL_ADDRESS').AsString; result.BILL_ADDRESS := ordersDB.UniQuery1.FieldByName('BILL_ADDRESS').AsString;
result.BILL_CITY := ordersDB.UniQuery1.FieldByName('BILL_CITY').AsString; result.BILL_CITY := ordersDB.UniQuery1.FieldByName('BILL_CITY').AsString;
...@@ -228,11 +258,18 @@ var ...@@ -228,11 +258,18 @@ var
temp: string; temp: string;
msg: string; msg: string;
ship_block: string; ship_block: string;
ADDRESS: TJSONObject;
ADDRESS_LIST:TJSONArray;
CustomerID: string;
JSONArray: TJSONArray;
Item: TAddressItem;
begin begin
result := TJSONObject.Create;
JSONData := TJSONObject.ParseJSONValue(AddressInfo) as TJSONObject; JSONData := TJSONObject.ParseJSONValue(AddressInfo) as TJSONObject;
if JSONData = nil then if JSONData = nil then
raise Exception.Create('Invalid JSON format'); // If parsing fails, raise an exception raise Exception.Create('Invalid JSON format'); // If parsing fails, raise an exception
mode := JSONData.GetValue<string>('mode'); mode := JSONData.GetValue<string>('mode');
CustomerID := JSONData.GetValue<string>('customer_id');
if mode = 'EDIT' then if mode = 'EDIT' then
ShipID := JSONData.GetValue<integer>('customer_ship_id'); ShipID := JSONData.GetValue<integer>('customer_ship_id');
...@@ -267,26 +304,39 @@ begin ...@@ -267,26 +304,39 @@ begin
Field.AsString := Pair.JsonValue.Value; Field.AsString := Pair.JsonValue.Value;
end; end;
end; end;
//OrdersDB.UniQuery1.FieldByName('address').AsString := JSONData.GetValue<string>('shipping_address');
//TODO Ask about shipping block & link to quickbooks
// OrdersDB.UniQuery1.FieldByName('ship_block') := ship_block;
// Post the record to the database
ordersDB.UniQuery1.Post; ordersDB.UniQuery1.Post;
if mode = 'ADD' then if mode = 'ADD' then
msg := 'Success:Shipping Address Successfully Added' begin
msg := 'Success:Shipping Address Successfully Added';
end
else else
msg := 'Success:Shipping Address Successfully Edited'; msg := 'Success:Shipping Address Successfully Edited';
Result := TJSONObject.Create.AddPair('status', msg); SQL := 'select * FROM customers c LEFT JOIN customers_ship s ON c.CUSTOMER_ID = s.customer_id WHERE c.CUSTOMER_ID = ' + CustomerID;
doQuery(ordersDB.UniQuery1, SQL);
ADDRESS_LIST := TJSONArray.Create;
while not ordersDB.UniQuery1.Eof do
begin
ADDRESS := TJSONObject.Create;
ADDRESS.AddPair('ADDRESS', ordersDB.UniQuery1.FieldByName('ship_block').AsString);
ADDRESS.AddPair('shipping_address', ordersDB.UniQuery1.FieldByName('address').AsString);
ADDRESS.AddPair('city', ordersDB.UniQuery1.FieldByName('city').AsString);
ADDRESS.AddPair('state', ordersDB.UniQuery1.FieldByName('state').AsString);
ADDRESS.AddPair('zip', ordersDB.UniQuery1.FieldByName('zip').AsString);
ADDRESS.AddPair('contact', ordersDB.UniQuery1.FieldByName('contact').AsString);
ADDRESS.AddPair('ship_id', ordersDB.UniQuery1.FieldByName('customer_ship_id').AsString);
ADDRESS_LIST.Add(ADDRESS);
ordersDB.UniQuery1.Next;
end;
Result.AddPair('status', msg);
Result.AddPair('ADDRESS', ADDRESS_LIST);
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result); TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
except except
on E: Exception do on E: Exception do
begin begin
Result := TJSONObject.Create.AddPair('error', E.Message); Result.AddPair('error', E.Message);
end end
end; end;
end; end;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
MemoLogLevel=3 MemoLogLevel=3
FileLogLevel=5 FileLogLevel=5
webClientVersion=0.9.2 webClientVersion=0.9.2
LogFileNum=518 LogFileNum=537
[Database] [Database]
Server=192.168.159.131 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