Commit 15329f55 by emsys

Fixed issue with customer SQL

parent a143692e
......@@ -1090,7 +1090,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ShowFocus = False
WidthPercent = 100.000000000000000000
end
object WebDBComboBox1: TWebDBComboBox
object wdbcbShipTo: TWebDBComboBox
Left = 26
Top = 430
Width = 145
......@@ -1100,6 +1100,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000
Role = 'null'
WidthPercent = 100.000000000000000000
OnChange = wdbcbShipToChange
ItemIndex = -1
DataField = 'staff_fields_ship_to'
DataSource = WebDataSource1
......@@ -1135,7 +1136,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object WebDBComboBox2: TWebDBComboBox
object wdbcbQuickbooksItem: TWebDBComboBox
Left = 26
Top = 515
Width = 145
......
......@@ -179,11 +179,11 @@ type
wdsShipTo: TWebDataSource;
xdwdsShipTo: TXDataWebDataSet;
xdwdsShipToADDRESS: TStringField;
WebDBComboBox1: TWebDBComboBox;
wdbcbShipTo: TWebDBComboBox;
cbEmail: TWebCheckBox;
XDataWebDataSet1supplied_by_customer_order_date: TStringField;
btnCancel: TWebButton;
WebDBComboBox2: TWebDBComboBox;
wdbcbQuickbooksItem: TWebDBComboBox;
wdsQBItem: TWebDataSource;
xdwdsQBItem: TXDataWebDataSet;
xdwdsQBItemname: TStringField;
......@@ -224,6 +224,7 @@ type
procedure WebButton2Click(Sender: TObject);
procedure ShowAddAddressForm();
[async] procedure SendAddressToServer(AddressJSON: TJSONObject);
procedure wdbcbShipToChange(Sender: TObject);
private
FAgencyCode: string;
FCurrentReportType: string;
......@@ -261,7 +262,6 @@ begin
orderID := orderInfo;
mode := modeParam;
notification := info;
console.log('Mode in createform: ' + modeParam);
InitializeForm;
end;
......@@ -398,6 +398,9 @@ begin
XDataWebDataSet1mounting_full_mount.AsString := '';
XDataWebDataSet1.Post;
//xdwdsShipTo.Post;
//xdwdsQBItem.Post;
XDataWebDataSet1.First;
while not XDataWebDataSet1.Eof do
begin
......@@ -408,8 +411,6 @@ begin
if Field.AsString = '' then
begin
orderJSON.AddPair(Field.FieldName, '');
console.log(Field.FieldName);
console.log(Field.AsString);
end
else
orderJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields
......@@ -430,6 +431,7 @@ begin
if mode = 'EDIT' then
orderJSON.AddPair('ORDER_ID', orderID);
console.log(orderJSON);
AddCorrugatedOrder(orderJSON);
end;
......@@ -480,7 +482,7 @@ begin
input := TJSHTMLInputElement(document.getElementById('wcbshipto'));
if WebDBComboBox1.Text = '' then
if wdbcbShipTo.Text = '' then
begin
input.classList.add('is-invalid');
result := false;
......@@ -580,7 +582,6 @@ var
Response: TXDataClientResponse;
jsObj: TJSObject;
begin
console.log(orderJSON);
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCorrugatedOrder',
[orderJSON.ToString]));
jsObj := JS.TJSObject(Response.Result);
......@@ -1043,7 +1044,10 @@ end;
procedure TFOrderEntryCorrugated.EditMode();
begin
xdwdsShipTo.Edit;
xdwdsQBItem.Edit;
XDataWebDataSet1.Edit;
FViewMain.change := true;
btnCopy.Enabled := false;
btnPDF.Enabled := false;
......@@ -1073,6 +1077,8 @@ begin
cbWideFormat.Enabled := True;
cbPrintCard.Enabled := True;
cbFullSizePanel.Enabled := True;
wdbcbQuickbooksItem.Enabled := true;
wdbcbShipTo.Enabled := true;
lblFormState.Caption := 'Edit Mode';
lblFormState.ElementHandle.classList.remove('text-danger');
......@@ -1111,6 +1117,8 @@ begin
cbWideFormat.Enabled := False;
cbPrintCard.Enabled := False;
cbFullSizePanel.Enabled := False;
wdbcbQuickbooksItem.Enabled := false;
wdbcbShipTo.Enabled := false;
lblFormState.Caption := 'View Mode';
lblFormState.ElementHandle.classList.remove('text-success');
......@@ -1118,6 +1126,12 @@ begin
end;
procedure TFOrderEntryCorrugated.wdbcbShipToChange(Sender: TObject);
begin
console.log(XDataWebDataSet1.FieldByName('staff_fields_ship_to').AsString);
console.log(xdwdsShipTo.FieldByName('ADDRESS').AsString);
end;
initialization
RegisterClass(TFOrderEntryCorrugated);
......
......@@ -1675,14 +1675,13 @@ object FOrderEntryWeb: TFOrderEntryWeb
object WebDataSource1: TWebDataSource
AutoEdit = False
DataSet = XDataWebDataSet1
Left = 406
Top = 38
Left = 398
Top = 56
end
object wdsShipTo: TWebDataSource
AutoEdit = False
DataSet = xdwdsShipTo
Left = 320
Top = 38
Left = 318
Top = 54
end
object xdwdsShipTo: TXDataWebDataSet
Left = 322
......@@ -1692,10 +1691,9 @@ object FOrderEntryWeb: TFOrderEntryWeb
end
end
object wdsQBItem: TWebDataSource
AutoEdit = False
DataSet = xdwdsQBItem
Left = 244
Top = 34
Left = 240
Top = 52
end
object xdwdsQBItem: TXDataWebDataSet
Left = 246
......
......@@ -944,6 +944,7 @@ end;
procedure TFOrderEntryWeb.EditMode;
begin
XDataWebDataSet1.Edit;
FViewMain.change := true;
btnCopy.Enabled := false;
btnPDF.Enabled := false;
......
......@@ -140,7 +140,7 @@ function TLookupService.GetCustomers(customerInfo: string): TCustomerList;
// 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.
var
SQL: string;
SQL, limitSQL: string;
customer: TCustomerItem;
params: TStringList;
PageNum, PageSize: integer;
......@@ -150,13 +150,24 @@ begin
params.StrictDelimiter := true;
params.Delimiter := '&';
params.DelimitedText := customerInfo;
PageSize := 0;
PageNum := 0;
if (params.Values['pagenumber'] <> '') then
PageNum := StrToInt(params.Values['pagenumber']);
if params.Values['pagesize'] <> '' then
PageSize := StrToInt(params.Values['pagesize']);
if ( ( PageSize <> 0 ) and (PageNum <> 0 ) ) then
begin
offset := IntToStr((PageNum - 1) * PageSize);
limit := IntToStr(PageSize);
limitSQL := ' limit ' + limit + ' offset ' + offset;
end;
PageNum := StrToInt(params.Values['pagenumber']);
PageSize := StrToInt(params.Values['pagesize']);
offset := IntToStr((PageNum - 1) * PageSize);
limit := IntToStr(PageSize);
try
SQL := 'select * from customers limit ' + limit + ' offset ' + offset;;
SQL := 'select * from customers' + limitSQL;
doQuery(ordersDB.UniQuery1, SQL);
result := TCustomerList.Create;
......
......@@ -2,7 +2,7 @@
MemoLogLevel=3
FileLogLevel=5
webClientVersion=0.9.7
LogFileNum=844
LogFileNum=849
[Database]
Server=192.168.159.144
......
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