Commit 7e3b07ca by Cam Hayes

kgOrdersTest v0.9.15.3 deployed

parent 526d09d9
......@@ -19,7 +19,7 @@ type
FUnauthorizedAccessProc: TUnauthorizedAccessProc;
public
const clientVersion = '0.9.15.1';
const clientVersion = '0.9.15.3';
procedure InitApp(SuccessProc: TSuccessProc;
UnauthorizedAccessProc: TUnauthorizedAccessProc);
procedure SetClientConfig(Callback: TVersionCheckCallback);
......
......@@ -92,6 +92,12 @@ end;
procedure ShowErrorModal(msg: string);
begin
HideSpinner('spinner');
if msg = '' then
begin
msg := 'Error connecting to EM Sytems Server.' + slinebreak +
'Please contact EM Systems Support.'
end;
asm
var modal = document.getElementById('main_errormodal');
var label = document.getElementById('main_lblmodal_body');
......
......@@ -23,7 +23,7 @@ object FViewAddCustomer: TFViewAddCustomer
WidthPercent = 100.000000000000000000
OnChange = edtShortNameChange
DataField = 'SHORT_NAME'
DataSource = WebDataSource1
DataSource = wdsCustomer
end
object edtName: TWebDBEdit
Left = 19
......@@ -36,7 +36,7 @@ object FViewAddCustomer: TFViewAddCustomer
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'NAME'
DataSource = WebDataSource1
DataSource = wdsCustomer
end
object edtBillAddress: TWebDBEdit
Left = 19
......@@ -49,7 +49,7 @@ object FViewAddCustomer: TFViewAddCustomer
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'BILL_ADDRESS'
DataSource = WebDataSource1
DataSource = wdsCustomer
end
object edtBillCity: TWebDBEdit
Left = 19
......@@ -62,7 +62,7 @@ object FViewAddCustomer: TFViewAddCustomer
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'BILL_CITY'
DataSource = WebDataSource1
DataSource = wdsCustomer
end
object edtBillState: TWebDBEdit
Left = 19
......@@ -75,7 +75,7 @@ object FViewAddCustomer: TFViewAddCustomer
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'BILL_STATE'
DataSource = WebDataSource1
DataSource = wdsCustomer
end
object edtBillZip: TWebDBEdit
Left = 19
......@@ -88,7 +88,7 @@ object FViewAddCustomer: TFViewAddCustomer
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'BILL_ZIP'
DataSource = WebDataSource1
DataSource = wdsCustomer
end
object edtBillContact: TWebDBEdit
Left = 19
......@@ -101,7 +101,7 @@ object FViewAddCustomer: TFViewAddCustomer
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'BILL_CONTACT'
DataSource = WebDataSource1
DataSource = wdsCustomer
end
object btnSave: TWebButton
Left = 19
......@@ -165,8 +165,9 @@ object FViewAddCustomer: TFViewAddCustomer
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = edtCustomerIDChange
DataField = 'CUSTOMER_ID'
DataSource = WebDataSource1
DataSource = wdsCustomer
end
object edtQBID: TWebDBEdit
Left = 151
......@@ -179,7 +180,7 @@ object FViewAddCustomer: TFViewAddCustomer
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'QB_LIST_ID'
DataSource = WebDataSource1
DataSource = wdsCustomer
end
object memoAddressBlock: TWebMemo
Left = 162
......@@ -309,7 +310,7 @@ object FViewAddCustomer: TFViewAddCustomer
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'QB_TYPE'
DataSource = WebDataSource1
DataSource = wdsCustomer
end
object wdbtcAddresses: TWebDBTableControl
Left = 310
......@@ -465,56 +466,55 @@ object FViewAddCustomer: TFViewAddCustomer
Left = 454
Top = 72
end
object WebDataSource1: TWebDataSource
AutoEdit = False
DataSet = XDataWebDataSet1
object wdsCustomer: TWebDataSource
DataSet = xdwdsCustomer
Left = 532
Top = 126
end
object XDataWebDataSet1: TXDataWebDataSet
object xdwdsCustomer: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 426
Top = 132
object XDataWebDataSet1SHORT_NAME: TStringField
object xdwdsCustomerSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object XDataWebDataSet1NAME: TStringField
object xdwdsCustomerNAME: TStringField
FieldName = 'NAME'
end
object XDataWebDataSet1BILL_ADDRESS: TStringField
object xdwdsCustomerBILL_ADDRESS: TStringField
FieldName = 'BILL_ADDRESS'
end
object XDataWebDataSet1BILL_CITY: TStringField
object xdwdsCustomerBILL_CITY: TStringField
FieldName = 'BILL_CITY'
end
object XDataWebDataSet1BILL_STATE: TStringField
object xdwdsCustomerBILL_STATE: TStringField
FieldName = 'BILL_STATE'
end
object XDataWebDataSet1BILL_CONTACT: TStringField
object xdwdsCustomerBILL_CONTACT: TStringField
FieldName = 'BILL_CONTACT'
end
object XDataWebDataSet1BILL_ZIP: TStringField
object xdwdsCustomerBILL_ZIP: TStringField
FieldName = 'BILL_ZIP'
end
object XDataWebDataSet1START_DATE: TStringField
object xdwdsCustomerSTART_DATE: TStringField
FieldName = 'START_DATE'
end
object XDataWebDataSet1QB_LIST_ID: TStringField
object xdwdsCustomerQB_LIST_ID: TStringField
FieldName = 'QB_LIST_ID'
end
object XDataWebDataSet1END_DATE: TStringField
object xdwdsCustomerEND_DATE: TStringField
FieldName = 'END_DATE'
end
object XDataWebDataSet1FAX: TStringField
object xdwdsCustomerFAX: TStringField
FieldName = 'FAX'
end
object XDataWebDataSet1PHONE: TStringField
object xdwdsCustomerPHONE: TStringField
FieldName = 'PHONE'
end
object XDataWebDataSet1CUSTOMER_ID: TIntegerField
object xdwdsCustomerCUSTOMER_ID: TIntegerField
FieldName = 'CUSTOMER_ID'
end
object XDataWebDataSet1QB_TYPE: TStringField
object xdwdsCustomerQB_TYPE: TStringField
FieldName = 'QB_TYPE'
end
end
......
......@@ -25,25 +25,25 @@ type
btnDelete: TWebButton;
btnClose: TWebButton;
XDataWebClient1: TXDataWebClient;
WebDataSource1: TWebDataSource;
XDataWebDataSet1: TXDataWebDataSet;
XDataWebDataSet1SHORT_NAME: TStringField;
XDataWebDataSet1NAME: TStringField;
XDataWebDataSet1BILL_ADDRESS: TStringField;
XDataWebDataSet1BILL_CITY: TStringField;
wdsCustomer: TWebDataSource;
xdwdsCustomer: TXDataWebDataSet;
xdwdsCustomerSHORT_NAME: TStringField;
xdwdsCustomerNAME: TStringField;
xdwdsCustomerBILL_ADDRESS: TStringField;
xdwdsCustomerBILL_CITY: TStringField;
edtCustomerID: TWebDBEdit;
edtQBID: TWebDBEdit;
wdsShipTo: TWebDataSource;
xdwdsShipTo: TXDataWebDataSet;
XDataWebDataSet1BILL_STATE: TStringField;
XDataWebDataSet1BILL_CONTACT: TStringField;
XDataWebDataSet1BILL_ZIP: TStringField;
XDataWebDataSet1START_DATE: TStringField;
XDataWebDataSet1END_DATE: TStringField;
XDataWebDataSet1QB_LIST_ID: TStringField;
XDataWebDataSet1FAX: TStringField;
XDataWebDataSet1PHONE: TStringField;
XDataWebDataSet1CUSTOMER_ID: TIntegerField;
xdwdsCustomerBILL_STATE: TStringField;
xdwdsCustomerBILL_CONTACT: TStringField;
xdwdsCustomerBILL_ZIP: TStringField;
xdwdsCustomerSTART_DATE: TStringField;
xdwdsCustomerEND_DATE: TStringField;
xdwdsCustomerQB_LIST_ID: TStringField;
xdwdsCustomerFAX: TStringField;
xdwdsCustomerPHONE: TStringField;
xdwdsCustomerCUSTOMER_ID: TIntegerField;
xdwdsShipToship_id: TStringField;
xdwdsShipToshipping_address: TStringField;
xdwdsShipTocity: TStringField;
......@@ -66,7 +66,7 @@ type
btnUpdate: TWebButton;
edtRepUser: TWebDBEdit;
xdwdsUsersQBID: TStringField;
XDataWebDataSet1QB_TYPE: TStringField;
xdwdsCustomerQB_TYPE: TStringField;
wdbtcAddresses: TWebDBTableControl;
edtFirstLine: TWebDBEdit;
xdwdsShipTofirst_line: TStringField;
......@@ -96,6 +96,7 @@ type
procedure wdblcbRepChange(Sender: TObject);
procedure edtShortNameChange(Sender: TObject);
procedure wdbtcAddressesClickCell(Sender: TObject; ACol, ARow: Integer);
procedure edtCustomerIDChange(Sender: TObject);
private
{ Private declarations }
procedure ViewMode();
......@@ -166,23 +167,23 @@ begin
qbCustJSON := string(TJSJSON.stringify(xdcResponse.Result));
JSONObj := TJSONObject.ParseJSONValue(qbCustJSON) as TJSONObject;
//JSONObj := TJSONObject.ParseJSONValue(qbCustJSON) as TJSONObject;
XDataWebDataSet1.Open;
XDataWebDataSet1.Append;
XDataWebDataSet1.FieldByName('NAME').AsString := JSONObj.GetValue('NAME').Value;
XDataWebDataSet1.FieldByName('QB_LIST_ID').AsString := JSONObj.GetValue('QB_LIST_ID').Value;
XDataWebDataSet1.FieldByName('BILL_ADDRESS').AsString := JSONObj.GetValue('BILL_ADDRESS').Value;
XDataWebDataSet1.FieldByName('BILL_CITY').AsString := JSONObj.GetValue('BILL_CITY').Value;
XDataWebDataSet1.FieldByName('BILL_STATE').AsString := JSONObj.GetValue('BILL_STATE').Value;
XDataWebDataSet1.FieldByName('BILL_ZIP').AsString := JSONObj.GetValue('BILL_ZIP').Value;
XDataWebDataSet1.FieldByName('BILL_CONTACT').AsString := JSONObj.GetValue('BILL_CONTACT').Value;
XDataWebDataSet1QB_TYPE.AsString := JSONObj.GetValue('RepUser').Value;
xdwdsCustomer.Open;
xdwdsCustomer.Append;
xdwdsCustomer.FieldByName('NAME').AsString := JSONObj.GetValue('NAME').Value;
xdwdsCustomer.FieldByName('QB_LIST_ID').AsString := JSONObj.GetValue('QB_LIST_ID').Value;
xdwdsCustomer.FieldByName('BILL_ADDRESS').AsString := JSONObj.GetValue('BILL_ADDRESS').Value;
xdwdsCustomer.FieldByName('BILL_CITY').AsString := JSONObj.GetValue('BILL_CITY').Value;
xdwdsCustomer.FieldByName('BILL_STATE').AsString := JSONObj.GetValue('BILL_STATE').Value;
xdwdsCustomer.FieldByName('BILL_ZIP').AsString := JSONObj.GetValue('BILL_ZIP').Value;
xdwdsCustomer.FieldByName('BILL_CONTACT').AsString := JSONObj.GetValue('BILL_CONTACT').Value;
xdwdsCustomerQB_TYPE.AsString := JSONObj.GetValue('RepUser').Value;
memoAddressBlock.Text := JSONObj.GetValue('BILL_ADDRESS_BLOCK').Value;
//XDataWebDataSet1.FieldByName('BILL_ADDRESS_BLOCK').AsString := JSONObj.GetValue('BILL_ADDRESS_BLOCK').Value;
XDataWebDataSet1.Post;
//xdwdsCustomer.FieldByName('BILL_ADDRESS_BLOCK').AsString := JSONObj.GetValue('BILL_ADDRESS_BLOCK').Value;
xdwdsCustomer.Post;
xdwdsShipTo.Open;
xdwdsShipTo.Append;
......@@ -204,7 +205,7 @@ begin
CustomerID := '';
input := TJSHTMLInputElement(document.getElementById('edtrepuser'));
if not xdwdsUsers.Locate('QBID', XDataWebDataSet1QB_TYPE.AsString, []) then
if not xdwdsUsers.Locate('QBID', xdwdsCustomerQB_TYPE.AsString, []) then
begin
input.classList.add('changed-field');
input.classList.add('is-invalid');
......@@ -259,7 +260,8 @@ begin
newform.ShowModal(
procedure(AValue: TModalResult)
begin
if newform.confirm then
FViewMain.ViewAddCustomer('', newform.QB_ID);
end
);
end;
......@@ -314,7 +316,7 @@ begin
AddressJSON.AddPair('customer_ship_id', xdwdsShipTo.FieldByName('ship_id').AsString);
AddressJSON.AddPair('mode', shipmode);
XDataWebDataSet1.Close;
xdwdsCustomer.Close;
xdwdsShipTo.Close;
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddShippingAddress',
[AddressJSON.ToString]));
......@@ -324,9 +326,9 @@ begin
ShowToast(string(notification['status']));
customer := TJSObject(notification['customer']);
XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(customer);
XDataWebDataSet1.Open;
xdwdsCustomer.Close;
xdwdsCustomer.SetJsonData(customer);
xdwdsCustomer.Open;
edtCustomerID.Text := CustomerID;
......@@ -357,8 +359,6 @@ begin
end;
xdwdsShipTo.First;
console.log(xdwdsShipToship_block.AsString);
memoAddressBlock.Text := string(customer['staff_fields_invoice_to']);
end;
......@@ -385,7 +385,6 @@ begin
TJSHTMLInputElement(document.getElementById('edtbillingcity')).classList.remove('changed-field');
TJSHTMLInputElement(document.getElementById('edtbillingstate')).classList.remove('changed-field');
TJSHTMLInputElement(document.getElementById('edtbillingzip')).classList.remove('changed-field');
console.log(CustomerID);
if CustomerID <> '' then
FViewMain.ViewAddCustomer(CustomerID, 'Failure: Changes Discarded')
else
......@@ -426,10 +425,11 @@ end;
procedure TFViewAddCustomer.btnLinkClic(Sender: TObject);
var
newform: TFSelectCustomer;
AccessType: string;
begin
if JS.toString(AuthService.TokenPayload.Properties['user_access_type']) = 'ADMIN' then
AccessType := JS.toString(AuthService.TokenPayload.Properties['user_access_type']);
if( ( AccessType = 'ADMIN' ) or ( AccessType = 'QBUSR' ) ) then
begin
console.log(CustomerID);
newform := TFSelectCustomer.CreateNew;
newform.Caption := 'Select Customer to Link';
......@@ -446,11 +446,10 @@ begin
if newform.confirm then
begin
EditMode();
XDataWebDataSet1.Edit;
XDataWebDataSet1QB_LIST_ID.AsString := newform.QB_ID;
XDataWebDataSet1.Post;
xdwdsCustomer.Edit;
xdwdsCustomerQB_LIST_ID.AsString := newform.QB_ID;
xdwdsCustomer.Post;
UpdateCustomer();
console.log(CustomerID);
end;
end
);
......@@ -461,6 +460,11 @@ begin
end;
procedure TFViewAddCustomer.edtCustomerIDChange(Sender: TObject);
begin
EditMode();
end;
procedure TFViewAddCustomer.edtShippingAddressChange(Sender: TObject);
// Puts the form into Address Edit Mode
begin
......@@ -502,12 +506,15 @@ end;
procedure TFViewAddCustomer.btnUpdateClick(Sender: TObject);
var
AccessType: string;
begin
if XDataWebDataSet1QB_LIST_ID.AsString = '' then
if xdwdsCustomerQB_LIST_ID.AsString = '' then
ShowToast('Failure:Company must be linked to quickbooks to update!')
else
begin
if JS.toString(AuthService.TokenPayload.Properties['user_access_type']) = 'ADMIN' then
AccessType := JS.toString(AuthService.TokenPayload.Properties['user_access_type']);
if( ( AccessType = 'ADMIN' ) or ( AccessType = 'QBUSR' ) ) then
begin
UpdateCustomer();
end
......@@ -527,13 +534,13 @@ var
begin
try
Utils.ShowSpinner('spinner');
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.UpdateCustomer', [XDataWebDataSet1QB_LIST_ID.AsString]));
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.UpdateCustomer', [xdwdsCustomerQB_LIST_ID.AsString]));
customer := TJSObject(xdcResponse.Result);
change := false;
short_name := edtShortName.Text;
input := TJSHTMLInputElement(document.getElementById('edtcompanyname'));
if string(customer['NAME']) <> XDataWebDataSet1NAME.AsString then
if string(customer['NAME']) <> xdwdsCustomerNAME.AsString then
begin
input.classList.add('changed-field');
change := true;
......@@ -542,7 +549,7 @@ begin
input.classList.remove('changed-field');
input := TJSHTMLInputElement(document.getElementById('edtbillingaddress'));
if string(customer['BILL_ADDRESS']) <> XDataWebDataSet1BILL_ADDRESS.AsString then
if string(customer['BILL_ADDRESS']) <> xdwdsCustomerBILL_ADDRESS.AsString then
begin
input.classList.add('changed-field');
change := true;
......@@ -551,7 +558,7 @@ begin
input.classList.remove('changed-field');
input := TJSHTMLInputElement(document.getElementById('edtbillingcity'));
if string(customer['BILL_CITY']) <> XDataWebDataSet1BILL_CITY.AsString then
if string(customer['BILL_CITY']) <> xdwdsCustomerBILL_CITY.AsString then
begin
input.classList.add('changed-field');
change := true;
......@@ -560,7 +567,7 @@ begin
input.classList.remove('changed-field');
input := TJSHTMLInputElement(document.getElementById('edtbillingstate'));
if string(customer['BILL_STATE']) <> XDataWebDataSet1BILL_STATE.AsString then
if string(customer['BILL_STATE']) <> xdwdsCustomerBILL_STATE.AsString then
begin
input.classList.add('changed-field');
change := true;
......@@ -569,7 +576,16 @@ begin
input.classList.remove('changed-field');
input := TJSHTMLInputElement(document.getElementById('edtbillingzip'));
if string(customer['BILL_ZIP']) <> XDataWebDataSet1BILL_ZIP.AsString then
if string(customer['BILL_ZIP']) <> xdwdsCustomerBILL_ZIP.AsString then
begin
input.classList.add('changed-field');
change := true;
end
else
input.classList.remove('changed-field');
input := TJSHTMLInputElement(document.getElementById('edtrepuser'));
if string(customer['QB_TYPE']) <> xdwdsCustomerQB_TYPE.AsString then
begin
input.classList.add('changed-field');
change := true;
......@@ -577,12 +593,21 @@ begin
else
input.classList.remove('changed-field');
XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(customer);
XDataWebDataSet1.Open;
XDataWebDataSet1.Edit;
XDataWebDataSet1CUSTOMER_ID.AsString := CustomerID;
XDataWebDataSet1SHORT_NAME.AsString := short_name;
if not xdwdsUsers.Locate('QBID', string(customer['QB_TYPE']), []) then
begin
input.classList.add('is-invalid');
end
else
input.classList.remove('is-invalid');
xdwdsCustomer.Close;
xdwdsCustomer.SetJsonData(customer);
xdwdsCustomer.Open;
xdwdsCustomer.Edit;
xdwdsCustomerCUSTOMER_ID.AsString := CustomerID;
xdwdsCustomerSHORT_NAME.AsString := short_name;
;
memoAddressBlock.Text := string(customer['staff_fields_invoice_to']);
Utils.HideSpinner('spinner');
......@@ -615,79 +640,85 @@ var
msg: string;
BILL_ADDRESS_BLOCK: string;
begin
if mode = 'EDIT' then
begin
customerJSON := TJSONObject.Create;
XDataWebDataSet1.First;
while not XDataWebDataSet1.Eof do
try
if mode = 'EDIT' then
begin
for Field in XDataWebDataSet1.Fields do
customerJSON := TJSONObject.Create;
xdwdsCustomer.First;
while not xdwdsCustomer.Eof do
begin
if Field is TStringField then
for Field in xdwdsCustomer.Fields do
begin
if Field.AsString = '' then
customerJSON.AddPair(Field.FieldName, '')
else
customerJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields
end
else if Field is TIntegerField then
begin
customerJSON.AddPair(Field.FieldName, Field.AsString);
if Field is TStringField then
begin
if Field.AsString = '' then
customerJSON.AddPair(Field.FieldName, '')
else
customerJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields
end
else if Field is TIntegerField then
begin
customerJSON.AddPair(Field.FieldName, Field.AsString);
end;
end;
xdwdsCustomer.Next;
end;
XDataWebDataSet1.Next;
end;
BILL_ADDRESS_BLOCK := edtName.Text + slinebreak +
edtBillContact.Text + slinebreak +
edtBillAddress.Text + slinebreak +
edtBillCity.Text + ', ' + edtBillState.Text + ' ' + edtBillZip.Text;
CustomerJSON.AddPair('BILL_ADDRESS_BLOCK', BILL_ADDRESS_BLOCK);
BILL_ADDRESS_BLOCK := memoAddressBlock.Text;
customerJSON.AddPair('mode', mode);
if mode = 'EDIT' then
customerJSON.AddPair('CUSTOMER_ID', customerID);
CustomerJSON.AddPair('BILL_ADDRESS_BLOCK', BILL_ADDRESS_BLOCK);
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCustomer',
[customerJSON.ToJSON]));
notification := TJSObject(Response.Result);
end
else
begin
JSONObj := TJSONObject.ParseJSONValue(qbCustJSON) as TJSONObject;
JSONObj.AddPair('SHORT_NAME', XDataWebDataSet1SHORT_NAME.AsString);
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.ImportQBCustomer',
[JSONObj.ToString]));
XDataWebDataSet1.Edit;
notification := TJSObject(Response.Result);
XDataWebDataSet1Customer_ID.AsInteger := integer(notification['CustomerID']);
XDataWebDataSet1.Post;
end;
msg := string(notification['status']);
if CustomerID = '' then
CustomerID := string(notification['CustomerID']);
customerJSON.AddPair('mode', mode);
if mode = 'EDIT' then
customerJSON.AddPair('CUSTOMER_ID', customerID);
edtCustomerID.Text := CustomerID;
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCustomer',
[customerJSON.ToJSON]));
notification := TJSObject(Response.Result);
end
else
begin
JSONObj := TJSONObject.ParseJSONValue(qbCustJSON) as TJSONObject;
JSONObj.AddPair('SHORT_NAME', xdwdsCustomerSHORT_NAME.AsString);
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.ImportQBCustomer',
[JSONObj.ToString]));
notification := TJSObject(Response.Result);
end;
msg := string(notification['status']);
ShowToast(msg);
if msg.Contains('Failure') then
begin
input := TJSHTMLInputElement(document.getElementById('edtcompanyaccountname'));
input.classList.add('is-invalid');
input := TJSHTMLInputElement(document.getElementById('shortnamefeedback'));
input.innerHTML := 'Company Account Name must be Unique.' ;
end
else
begin
TJSHTMLInputElement(document.getElementById('edtcompanyname')).classList.remove('changed-field');
TJSHTMLInputElement(document.getElementById('edtbillingaddress')).classList.remove('changed-field');
TJSHTMLInputElement(document.getElementById('edtbillingcity')).classList.remove('changed-field');
TJSHTMLInputElement(document.getElementById('edtbillingstate')).classList.remove('changed-field');
TJSHTMLInputElement(document.getElementById('edtbillingzip')).classList.remove('changed-field');
mode := 'EDIT';
end;
ShowToast(msg);
if msg.Contains('Failure') then
begin
input := TJSHTMLInputElement(document.getElementById('edtcompanyaccountname'));
input.classList.add('is-invalid');
input := TJSHTMLInputElement(document.getElementById('shortnamefeedback'));
input.innerHTML := 'Customer ID must be unique.' ;
end
else
begin
if CustomerID = '' then
CustomerID := string(notification['CustomerID']);
xdwdsCustomer.Edit;
edtCustomerID.Text := CustomerID;
xdwdsCustomerCustomer_ID.AsInteger := integer(notification['CustomerID']);
xdwdsCustomer.Post;
TJSHTMLInputElement(document.getElementById('edtcompanyname')).classList.remove('changed-field');
TJSHTMLInputElement(document.getElementById('edtbillingaddress')).classList.remove('changed-field');
TJSHTMLInputElement(document.getElementById('edtbillingcity')).classList.remove('changed-field');
TJSHTMLInputElement(document.getElementById('edtbillingstate')).classList.remove('changed-field');
TJSHTMLInputElement(document.getElementById('edtbillingzip')).classList.remove('changed-field');
mode := 'EDIT';
await(GetCustomer());
input := TJSHTMLInputElement(document.getElementById('edtrepuser'));
input.classList.remove('changed-field');
input.classList.remove('is-invalid');
ViewMode();
end;
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end;
end;
......@@ -706,11 +737,6 @@ var
input: TJSHTMLInputElement;
begin
await(sendCustomerToServer());
await(GetCustomer());
input := TJSHTMLInputElement(document.getElementById('edtrepuser'));
input.classList.remove('changed-field');
input.classList.remove('is-invalid');
ViewMode();
end;
......@@ -743,7 +769,7 @@ end;
procedure TFViewAddCustomer.btnShipDeleteClick(Sender: TObject);
begin
ShowToast('Deleting Shipping Addresses is not yet implemented.', 'info');
ShowToast('Deleting shipping addresses is not yet implemented.', 'info');
{ShowConfirmationModal(
'Are you sure you want to delete this address?',
'Delete',
......@@ -795,9 +821,9 @@ begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer', [customerID]));
customer := TJSObject(xdcResponse.Result);
XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(customer);
XDataWebDataSet1.Open;
xdwdsCustomer.Close;
xdwdsCustomer.SetJsonData(customer);
xdwdsCustomer.Open;
edtCustomerID.Text := CustomerID;
......@@ -858,6 +884,8 @@ begin
begin
input.classList.add('is-invalid');
result := false;
input := TJSHTMLInputElement(document.getElementById('shortnamefeedback'));
input.innerHTML := 'Please Provide a Customer ID.' ;
end
else
input.classList.remove('is-invalid');
......@@ -899,14 +927,6 @@ begin
else
input.classList.remove('is-invalid');
// input := TJSHTMLInputElement(document.getElementById('edtbillingcontact'));
// if edtBillContact.Text = '' then
// begin
// input.classList.add('is-invalid');
// result := false;
// end
// else
// input.classList.remove('is-invalid');
end;
......@@ -976,7 +996,7 @@ end;
procedure TFViewAddCustomer.EditMode;
// Enables Customer Fields while disabling shipping address fields.
begin
XDataWebDataSet1.Edit;
xdwdsCustomer.Edit;
FViewMain.change := true;
btnAdd.Enabled := false;
btnDelete.Enabled := false;
......
......@@ -506,15 +506,16 @@ end;
procedure TFViewItems.btnDeleteClick(Sender: TObject);
begin
ShowNotificationModal('Deleting items is not yet implemented.');
ShowToast('Deleting items is not yet implemented.', 'info');
end;
procedure TFViewItems.btnUpdateClick(Sender: TObject);
var
itemOptions: string;
itemOptions, AccessType: string;
newform: TFViewAddItem;
begin
if JS.toString(AuthService.TokenPayload.Properties['user_access_type']) = 'ADMIN' then
AccessType := JS.toString(AuthService.TokenPayload.Properties['user_access_type']);
if( ( AccessType = 'ADMIN' ) or ( AccessType = 'QBUSR' ) ) then
begin
UpdateItem();
end
......
......@@ -54,7 +54,7 @@ procedure TFViewLogin.btnLoginClick(Sender: TObject);
procedure LoginError(AMsg: string);
begin
ShowNotification('Login Error: ' + AMsg);
ShowNotification(AMsg);
end;
var
hashPW: string;
......
......@@ -74,6 +74,7 @@ object FViewMain: TFViewMain
Height = 14
ElementID = 'dropdown.menu.itemlist'
ElementFont = efCSS
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblItemsListClick
......@@ -86,6 +87,7 @@ object FViewMain: TFViewMain
Height = 14
ElementID = 'dropdown.menu.users'
ElementFont = efCSS
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblUsersClick
......@@ -114,6 +116,7 @@ object FViewMain: TFViewMain
ElementID = 'lblcustomers'
ElementFont = efCSS
ElementPosition = epRelative
Enabled = False
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
......@@ -140,6 +143,7 @@ object FViewMain: TFViewMain
Caption = 'QB Info'
ElementID = 'dropdown.menu.linktoqb'
ElementFont = efCSS
Enabled = False
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
......
......@@ -92,7 +92,7 @@ uses
procedure TFViewMain.WebFormCreate(Sender: TObject);
var
userName: string;
userName, AccessType: string;
test: boolean;
begin
FUserInfo := GetUserInfo;
......@@ -100,14 +100,20 @@ begin
lblUsername.Caption := ' ' + userName.ToLower + ' ';
FChildForm := nil;
change := false;
AccessType := JS.toString(AuthService.TokenPayload.Properties['user_access_type']);
if (not (JS.toString(AuthService.TokenPayload.Properties['user_access_type']) = 'ADMIN')) then
if ( AccessType = 'ADMIN' ) then
begin
lblUsers.enabled := false;
lblQBInfo.Enabled := false;
lblCustomers.Enabled := false;
lblItemsList.Enabled := false;
lblUsers.enabled := true;
lblCustomers.Enabled := true;
lblItemsList.Enabled := true;
end;
if( ( AccessType = 'ADMIN' ) or ( AccessType = 'QBUSR' ) ) then
begin
lblQBInfo.Enabled := true;
end;
lblAppTitle.Caption := 'Koehler-Gibson Orders';
lblVersion.Caption := 'v' + DMConnection.clientVersion;
ShowForm(TFViewOrders);
......
......@@ -390,8 +390,10 @@ procedure TFOrderEntryCorrugated.btnQBClick(Sender: TObject);
var
orderJSON: TJSONObject;
qbEnabled: boolean;
AccessType: string;
begin
if JS.toString(AuthService.TokenPayload.Properties['user_access_type']) = 'ADMIN' then
AccessType := JS.toString(AuthService.TokenPayload.Properties['user_access_type']);
if( ( AccessType = 'ADMIN' ) or ( AccessType = 'QBUSR' ) ) then
begin
if ( VerifyQBOrder() )then
begin
......@@ -513,6 +515,10 @@ begin
xdwdsOrder.Close;
xdwdsOrder.SetJsonData(jsObj);
xdwdsOrder.Open;
cbLoose.Checked := ( xdwdsOrder.FieldByName('mounting_loose').AsString <> '' );
cbStripMount.Checked := ( xdwdsOrder.FieldByName('mounting_strip_mount').AsString <> '' );
OrderID := xdwdsOrderORDER_ID.AsString;
mode := 'EDIT';
ShowToast(string(jsObj.Properties['status']));
......@@ -788,7 +794,7 @@ begin
container := TJSHTMLElement(document.getElementById('additionalFields'));
if Assigned(container) then
container.innerHTML := ''; // Wipe previous content
container.innerHTML := ''; // Wipe previous colors
if xdwdsOrdercolors_colors.Value <> '' then
begin
......@@ -801,6 +807,7 @@ begin
end;
end;
if xdwdsOrder.FieldByName('mounting_loose').AsString <> '' then
cbLoose.Checked := true;
......
......@@ -194,8 +194,10 @@ procedure TFOrderEntryCuttingDie.btnQBClick(Sender: TObject);
var
orderJSON: TJSONObject;
qbEnabled: boolean;
AccessType: string;
begin
if JS.toString(AuthService.TokenPayload.Properties['user_access_type']) = 'ADMIN' then
AccessType := JS.toString(AuthService.TokenPayload.Properties['user_access_type']);
if( ( AccessType = 'ADMIN' ) or ( AccessType = 'QBUSR' ) ) then
begin
if ( VerifyQBOrder() )then
begin
......@@ -428,6 +430,7 @@ begin
xdwdsOrder.Close;
xdwdsOrder.SetJsonData(jsObj);
xdwdsOrder.Open;
OrderID := xdwdsOrderORDER_ID.AsString;
mode := 'EDIT';
ShowToast(String(jsObj.Properties['status']));
......@@ -488,8 +491,8 @@ begin
if confirmed then
begin
FViewMain.change := false;
if xdwdsOrder.FieldByName('ORDER_ID').AsString <> '' then
FViewMain.ViewOrderEntryCuttingDie(xdwdsOrder.FieldByName('ORDER_ID').AsString, '', 'EDIT', 'Failure: Changes Discarded')
if orderID <> '' then
FViewMain.ViewOrderEntryCuttingDie(orderID, '', 'EDIT', 'Failure: Changes Discarded')
else
FViewMain.ViewOrders('');
end;
......
......@@ -454,8 +454,10 @@ procedure TFOrderEntryWeb.btnQBClick(Sender: TObject);
var
orderJSON: TJSONObject;
qbEnabled: boolean;
AccessType: string;
begin
if JS.toString(AuthService.TokenPayload.Properties['user_access_type']) = 'ADMIN' then
AccessType := JS.toString(AuthService.TokenPayload.Properties['user_access_type']);
if( ( AccessType = 'ADMIN' ) or ( AccessType = 'QBUSR' ) ) then
begin
if ( VerifyQBOrder() )then
begin
......@@ -597,6 +599,7 @@ begin
xdwdsOrder.Open;
mode := 'EDIT';
OrderID := xdwdsOrderORDER_ID.AsString;
ShowToast(String(jsObj.Properties['status']));
except
on E: EXDataClientRequestException do
......@@ -768,6 +771,7 @@ var
colorList: TJSArray;
color: TJSObject;
items: TJSObject;
container: TJSHTMLElement;
begin
Utils.ShowSpinner('spinner');
try
......@@ -779,6 +783,10 @@ begin
xdwdsOrder.SetJsonData(order);
xdwdsOrder.Open;
container := TJSHTMLElement(document.getElementById('additionalFields'));
if Assigned(container) then
container.innerHTML := ''; // Wipe previous colors
if xdwdsOrderquantity_and_colors_qty_colors.Value <> '' then
begin
colorObject := TJSObject(TJSJSON.parse(xdwdsOrderquantity_and_colors_qty_colors.Value));
......@@ -875,6 +883,7 @@ begin
btnCancel.Enabled := True;
btnEdit.Enabled := false;
btnAdd.Enabled := false;
btnQB.Enabled := false;
cbPdf.Enabled := True;
cbInkJet.Enabled := True;
......@@ -912,6 +921,7 @@ begin
btnCancel.Enabled := false;
btnEdit.Enabled := true;
btnAdd.Enabled := true;
btnQB.Enabled := true;
FViewMain.change := false;
cbPdf.Enabled := False;
......
......@@ -14,7 +14,7 @@ uses
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
XData.Web.JsonDataset, WEBLib.DB, Data.DB, XData.Web.Dataset, XData.Web.DatasetCommon,
WEBLib.Grids, VCL.Forms;
WEBLib.Grids, VCL.Forms, Math;
type
TFViewOrders = class(TWebForm)
......@@ -552,8 +552,15 @@ end;
procedure TFViewOrders.wcbPageSizeChange(Sender: TObject);
var
ratio: double;
begin
ratio := PageSize/StrToInt(wcbPageSize.Text);
PageSize := StrToInt(wcbPageSize.Text);
if ratio < 1 then
PageNumber := Ceil(PageNumber * ratio)
else
PageNumber := Ceil(PageNumber * ratio) - Trunc(ratio) + 1;
getOrders(generateSearchOptions());
end;
......
......@@ -220,7 +220,7 @@ begin
else if wlcbStatus.DisplayText = 'Plate Done' then
begin
dtpPlateDue.Date := plateDue;
dtpShipDue.Date := plateDue;
dtpShipDue.Date := dtpDate.Date;
end
else if wlcbStatus.DisplayText = 'Ship Done' then
begin
......@@ -235,10 +235,6 @@ begin
begin
dtpShipDue.Date := shipDue;
end
else if wlcbStatus.DisplayText = 'Art Done' then
begin
dtpShipDue.Date := dtpDate.Date;
end
else if wlcbStatus.DisplayText = 'Ship Done' then
begin
dtpShipDue.Date := shipDue;
......
......@@ -195,23 +195,9 @@ object FViewEditUser: TFViewEditUser
ChildOrder = 19
ElementID = 'edtrights'
HeightPercent = 100.000000000000000000
MaxLength = 11
WidthPercent = 100.000000000000000000
end
object cbAccess: TWebComboBox
Left = 346
Top = 90
Width = 145
Height = 23
ElementID = 'cbaccess'
HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'SALES'
'USER'
'ADMIN')
end
object edtQB: TWebEdit
Left = 346
Top = 62
......@@ -223,6 +209,33 @@ object FViewEditUser: TFViewEditUser
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbAccess: TWebLookupComboBox
Left = 346
Top = 93
Width = 145
Height = 22
ElementID = 'cbaccess'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
LookupValues = <
item
Value = 'ADMIN'
DisplayText = 'Admin'
end
item
Value = 'USER'
DisplayText = 'User'
end
item
Value = 'SALES'
DisplayText = 'Sales User'
end
item
Value = 'QBUSR'
DisplayText = 'QB User'
end>
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 514
......
......@@ -29,9 +29,9 @@ type
lblRights: TWebLabel;
edtRights: TWebEdit;
lblAccess: TWebLabel;
cbAccess: TWebComboBox;
lblQB: TWebLabel;
edtQB: TWebEdit;
cbAccess: TWebLookupComboBox;
procedure WebFormCreate(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
......@@ -90,7 +90,7 @@ begin
'&password=' + edtPassword.Text +
'&status=' + BoolToStr(cbStatus.Checked) +
'&email=' + edtEmail.Text +
'&access=' + cbAccess.Text +
'&access=' + cbAccess.Value +
'&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text +
'&QB=' + edtQB.Text;
......@@ -123,7 +123,7 @@ begin
'&password=' + edtPassword.Text +
'&status=' + BoolToStr(cbStatus.Checked) +
'&email=' + edtEmail.Text +
'&access=' + cbAccess.Text +
'&access=' + cbAccess.Value +
'&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text +
'&QB=' + edtQB.Text;
......@@ -176,7 +176,10 @@ begin
edtPassword.Text := 'hidden';
end;
edtEmail.Text := Email;
cbAccess.Text := Access;
if Access = '' then
cbAccess.Value := 'USER'
else
cbAccess.Value := Access;
edtRights.Text := Rights;
edtQB.Text := QB;
if Status = 'ACTIVE' then
......
......@@ -65,7 +65,10 @@ end;
procedure UnauthorizedAccessProc(AMessage: string);
begin
DisplayLoginView(AMessage);
if Pos('JWT', AMessage) > 0 then
DisplayLoginView('Login token expired! Please login again')
else
DisplayLoginView(AMessage);
end;
......@@ -110,7 +113,10 @@ begin
// location.replace(base + "?ver=" + ClientVer + "&r=" + Date.now() + location.hash);
// });
// end;
ShowMessage( 'Error connecting to kgOrdersServer' + sLineBreak + 'Please contact EM Systems support' );
if Pos('version', ErrorMessage) > 0 then
ShowMessage( ErrorMessage )
else
ShowMessage( 'Error connecting to kgOrdersServer' + sLineBreak + 'Please contact EM Systems support' );
end;
end);
end,
......
......@@ -48,14 +48,13 @@ uses
procedure TAuthDatabase.DataModuleCreate(Sender: TObject);
begin
Logger.Log( 5, 'TAuthDatabase.DataModuleCreate' );
LoadDatabaseSettings( ucKG );
try
LoadDatabaseSettings( ucKG );
ucKG.Connect;
except
on E: Exception do
begin
Logger.Log( 1, '--TAuthDatabase.DataModuleCreate -Error connecting to database: ' + E.Message );
raise; //EXDataHttpException.Create(500, 'Error Connecting to database! Please try again later or contact a system admin!');
end;
end;
end;
......
......@@ -54,7 +54,7 @@ begin
if not authDB.ucKG.Connected then
begin
Logger.Log(1, 'Unable to connect to the database: A KGOrders Server Error has occured!');
raise EXDataHttpException.Create(500, 'Unable to create Auth database: A KGOrders Server Error has occured!');
raise EXDataHttpException.Create(500, 'Unable to connect to the database: A KGOrders Server Error has occured!');
end;
except
on E: Exception do
......@@ -63,6 +63,9 @@ begin
raise; //EXDataHttpException.Create(500, 'Unable to create Auth database: A KGOrders Server Error has occured!');
end;
end;
end;
......@@ -93,7 +96,7 @@ begin
Result.AddPair('error',
'webApp version mismatch' + sLineBreak + ' Client version: ' + clientVersion +
sLineBreak + ' Server version: ' + webClientVersion +
sLineBreak + 'Please click button to clear cache and reload.');
sLineBreak + 'Please clear cache and reload.');
end;
finally
iniFile.Free;
......
......@@ -614,7 +614,7 @@ begin
if ID = '' then
SQL := 'select * FROM customers c LEFT JOIN customers_ship s ON c.CUSTOMER_ID = s.customer_id WHERE c.CUSTOMER_ID = -1'
else
SQL := 'select * FROM customers c LEFT JOIN customers_ship s ON c.CUSTOMER_ID = s.customer_id WHERE c.CUSTOMER_ID = ' + ID;
SQL := 'select * FROM customers c WHERE c.CUSTOMER_ID = ' + ID;
logger.Log(5, 'Getting customer with SQL: ' + SQL);
doQuery(ordersDB.UniQuery1, SQL);
result := TCustomerItem.Create;
......@@ -639,20 +639,23 @@ begin
result.SHIPPING_ADDRESS_LIST := TList<TAddressItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.SHIPPING_ADDRESS_LIST );
while not ordersDB.UniQuery1.Eof do
SQL := 'SELECT * from customers_ship cs where cs.CUSTOMER_ID = ' + ID;
logger.Log(5, 'Getting customer shipping addresses with SQL: ' + SQL);
doQuery(ordersDB.UniQuery2, SQL);
while not ordersDB.UniQuery2.Eof do
begin
ADDRESS := TAddressItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( ADDRESS );
ADDRESS.ship_block := ordersDB.UniQuery1.FieldByName('ship_block').AsString;
ADDRESS.shipping_address := ordersDB.UniQuery1.FieldByName('address').AsString;
ADDRESS.city := ordersDB.UniQuery1.FieldByName('city').AsString;
ADDRESS.state := ordersDB.UniQuery1.FieldByName('state').AsString;
ADDRESS.zip := ordersDB.UniQuery1.FieldByName('zip').AsString;
ADDRESS.contact := ordersDB.UniQuery1.FieldByName('contact').AsString;
ADDRESS.ship_id := ordersDB.UniQuery1.FieldByName('customer_ship_id').AsString;
ADDRESS.first_line := ordersDB.UniQuery1.FieldByName('first_line').AsString;
ADDRESS.ship_block := ordersDB.UniQuery2.FieldByName('ship_block').AsString;
ADDRESS.shipping_address := ordersDB.UniQuery2.FieldByName('address').AsString;
ADDRESS.city := ordersDB.UniQuery2.FieldByName('city').AsString;
ADDRESS.state := ordersDB.UniQuery2.FieldByName('state').AsString;
ADDRESS.zip := ordersDB.UniQuery2.FieldByName('zip').AsString;
ADDRESS.contact := ordersDB.UniQuery2.FieldByName('contact').AsString;
ADDRESS.ship_id := ordersDB.UniQuery2.FieldByName('customer_ship_id').AsString;
ADDRESS.first_line := ordersDB.UniQuery2.FieldByName('first_line').AsString;
result.SHIPPING_ADDRESS_LIST.Add(ADDRESS);
ordersDB.UniQuery1.Next;
ordersDB.UniQuery2.Next;
end;
logger.Log(3, 'TLookupService.GetCustomer - end');
......@@ -1061,7 +1064,10 @@ begin
if startDate <> '' then
begin
result := result + ' AND ' + quotedStr(startDate) + ' <= STATUS_DATE';
if startDate = '1899/12/30' then
result := result + ' AND ' + quotedStr(startDate) + ' < STATUS_DATE'
else
result := result + ' AND ' + quotedStr(startDate) + ' <= STATUS_DATE';
end;
if ( ( endDate <> '1899/12/30' ) AND ( endDate <> '' ) ) then
......@@ -1160,7 +1166,7 @@ begin
begin
if status.startDate <> '' then
begin
result := result + ' AND ' + quotedStr(status.startDate) + ' <= COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_date, cdo.staff_fields_order_date)';
result := result + ' AND ' + quotedStr(status.startDate) + ' <= COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_date, cdo.staff_fields_order_date';
end;
if ( ( status.endDate <> '1899/12/30' ) AND ( status.endDate <> '' ) ) then
......@@ -1361,20 +1367,40 @@ begin
Order.companyName := FieldByName('COMPANY_NAME').AsString;
Order.jobName := FieldByName('JOB_NAME').AsString;
Order.orderDate := FieldByName('ORDER_DATE').AsString;
Order.proofDue := FieldByName('PROOF_DUE').AsString;
Order.proofDone := FieldByName('PROOF_DONE').AsString;
Order.artDue := FieldByName('ART_DUE').AsString;
Order.artDone := FieldByName('ART_DONE').AsString;
Order.plateDue := FieldByName('PLATE_DUE').AsString;
Order.plateDone := FieldByName('PLATE_DONE').AsString;
Order.mountDue := FieldByName('MOUNT_DUE').AsString;
Order.mountDone := FieldByName('MOUNT_DONE').AsString;
Order.shipDue := FieldByName('SHIP_DUE').AsString;
Order.shipDone := FieldByName('SHIP_DONE').AsString;
Order.price := FieldByName('PRICE').AsString;
Order.qbRefNum := FieldByName('QB_ORDER_NUM').AsString;
Order.orderType := FieldByName('ORDER_TYPE').AsString.Replace('_', ' ');
Order.cadFile := FieldByName('layout_cad_file').AsString;
if FieldByName('PROOF_DUE').AsDateTime = 0 then
Order.proofDue := ''
else
Order.proofDue := FieldByName('PROOF_DUE').AsString;
if FieldByName('ART_DUE').AsDateTime = 0 then
Order.artDue := ''
else
Order.artDue := FieldByName('ART_DUE').AsString;
if FieldByName('PLATE_DUE').AsDateTime = 0 then
Order.plateDue := ''
else
Order.plateDue := FieldByName('PLATE_DUE').AsString;
if FieldByName('MOUNT_DUE').AsDateTime = 0 then
Order.mountDue := ''
else
Order.mountDue := FieldByName('MOUNT_DUE').AsString;
if FieldByName('SHIP_DUE').AsDateTime = 0 then
Order.shipDue := ''
else
Order.shipDue := FieldByName('SHIP_DUE').AsString;
end;
if ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString = 'web_plate' then
......@@ -1864,6 +1890,7 @@ var
hashString: string;
hashPW: string;
unique: boolean;
rightsInt: integer;
begin
logger.log(3, 'TLookupService.EditUser');
params := TStringList.Create;
......@@ -1886,7 +1913,7 @@ begin
logger.Log(5, 'Retrieving customer with SQL: ' + SQL);
doQuery(OrdersDB.UniQuery1, SQL);
if ( (OrdersDB.UniQuery1.IsEmpty) or (OrdersDB.UniQuery1.FieldByName('USER_NAME').AsString = user) ) then
if ( (OrdersDB.UniQuery1.IsEmpty) or (OrdersDB.UniQuery1.FieldByName('USER_NAME').AsString = user) or ( QB = '' ) ) then
unique := true
else
unique := false;
......@@ -1921,8 +1948,9 @@ begin
if not access.IsEmpty then
ordersDB.UniQuery1.FieldByName('ACCESS_TYPE').AsString := Access;
if not rights.IsEmpty then
ordersDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger := StrToInt(rights);
if not TryStrToInt(rights, rightsInt) then
rightsInt := 0;
ordersDB.UniQuery1.FieldByName('SYSTEM_RIGHTS').AsInteger := rightsInt;
if not perspective.IsEmpty then
ordersDB.UniQuery1.FieldByName('PERSPECTIVE_ID').AsString := perspective;
......@@ -2059,16 +2087,11 @@ begin
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsInteger := ORDER_ID;
ordersDB.UniQuery1.Post;
if ( JSONData.GetValue<string>('staff_fields_proof_date') <> '' ) and ( JSONData.GetValue<string>('staff_fields_proof_date') <> '12/30/1899' ) then
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
if ( JSONData.GetValue<string>('staff_fields_ship_date') <> '' ) and ( JSONData.GetValue<string>('staff_fields_ship_date') <> '12/30/1899' ) then
AddStatusSchedule('SHIP', JSONData, ORDER_ID);
if ( JSONData.GetValue<string>('staff_fields_art_due') <> '' ) and ( JSONData.GetValue<string>('staff_fields_art_due') <> '12/30/1899' ) then
AddStatusSchedule('ART', JSONData, ORDER_ID);
if ( JSONData.GetValue<string>('staff_fields_plate_due') <> '' ) and ( JSONData.GetValue<string>('staff_fields_plate_due') <> '12/30/1899' ) then
AddStatusSchedule('PLATE', JSONData, ORDER_ID);
if ( JSONData.GetValue<string>('staff_fields_mount_due') <> '' ) and ( JSONData.GetValue<string>('staff_fields_mount_due') <> '12/30/1899' ) then
AddStatusSchedule('MOUNT', JSONData, ORDER_ID);
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
AddStatusSchedule('ART', JSONData, ORDER_ID);
AddStatusSchedule('SHIP', JSONData, ORDER_ID);
AddStatusSchedule('PLATE', JSONData, ORDER_ID);
AddStatusSchedule('MOUNT', JSONData, ORDER_ID);
AddToRevisionsTable(intToStr(ORDER_ID), 'corrugated_plate_orders_revisions', JSONData);
......@@ -2114,6 +2137,10 @@ begin
else
date := order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_due');
if date = '' then
date := '12/30/1899';
if ordersDB.uqOrdersStatusSchedule.IsEmpty then
begin
ordersDB.uqOrdersStatusSchedule.Insert;
......@@ -2124,6 +2151,7 @@ begin
else
begin
ordersDB.uqOrdersStatusSchedule.Edit;
change := ordersDB.uqOrdersStatusScheduleSTATUS_DATE.AsDateTime <> StrToDateTime(date);
if change then
begin
......@@ -2131,6 +2159,7 @@ begin
ordersDB.uqOrdersStatusScheduleUSER_ID.AsString := order.GetValue<string>('USER_ID');
end;
end;
ordersDB.uqOrdersStatusScheduleSTATUS_DATE.AsDateTime := StrToDateTime(date);
ordersDB.uqOrdersStatusScheduleORDER_ID.AsInteger := ORDER_ID;
ordersDB.uqOrdersStatusScheduleORDER_STATUS.AsString := StatusType;
......@@ -2293,11 +2322,13 @@ begin
logger.Log(5, 'Retrieving customer with SQL: ' + SQL);
doQuery(OrdersDB.UniQuery1, SQL);
if ( (OrdersDB.UniQuery1.IsEmpty) or (OrdersDB.UniQuery1.FieldByName('USER_NAME').AsString = user) ) then
if ( (OrdersDB.UniQuery1.IsEmpty) or (OrdersDB.UniQuery1.FieldByName('USER_NAME').AsString = user) or ( QB = '' ) ) then
unique := true
else
unique := false;
if unique then
begin
SQL := 'SELECT * FROM users WHERE USER_NAME = ' + QuotedStr(user.ToLower);
......@@ -2525,14 +2556,10 @@ begin
ordersDB.UniQuery1.Post;
if ( JSONData.GetValue<string>('staff_fields_proof_date') <> '' ) and ( JSONData.GetValue<string>('staff_fields_proof_date') <> '12/30/1899' ) then
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
if ( JSONData.GetValue<string>('staff_fields_ship_date') <> '' ) and ( JSONData.GetValue<string>('staff_fields_ship_date') <> '12/30/1899' ) then
AddStatusSchedule('SHIP', JSONData, ORDER_ID);
if ( JSONData.GetValue<string>('staff_fields_art_due') <> '' ) and ( JSONData.GetValue<string>('staff_fields_art_due') <> '12/30/1899' ) then
AddStatusSchedule('ART', JSONData, ORDER_ID);
if ( JSONData.GetValue<string>('staff_fields_plate_due') <> '' ) and ( JSONData.GetValue<string>('staff_fields_plate_due') <> '12/30/1899' ) then
AddStatusSchedule('PLATE', JSONData, ORDER_ID);
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
AddStatusSchedule('SHIP', JSONData, ORDER_ID);
AddStatusSchedule('ART', JSONData, ORDER_ID);
AddStatusSchedule('PLATE', JSONData, ORDER_ID);
AddToRevisionsTable(IntToStr(ORDER_ID), 'web_plate_orders_revisions', JSONData);
......@@ -2624,10 +2651,8 @@ begin
// Post the record to the database
ordersDB.UniQuery1.Post;
if ( JSONData.GetValue<string>('staff_fields_proof_date') <> '' ) and ( JSONData.GetValue<string>('staff_fields_proof_date') <> '12/30/1899' ) then
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
if ( JSONData.GetValue<string>('staff_fields_ship_date') <> '' ) and ( JSONData.GetValue<string>('staff_fields_ship_date') <> '12/30/1899' ) then
AddStatusSchedule('SHIP', JSONData, ORDER_ID);
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
AddStatusSchedule('SHIP', JSONData, ORDER_ID);
AddToRevisionsTable(IntToStr(ORDER_ID), 'cutting_die_orders_revisions', JSONData);
......@@ -3642,12 +3667,14 @@ begin
end;
end;
if Customer.GetValue('CustomerTypeRef') is TJSONObject then
if Customer.GetValue('CustomerTypeRef') is TJSONObject then
begin
CustomerTypeRef := Customer.GetValue('CustomerTypeRef') as TJSONObject;
logger.Log(5, CustomerTypeRef.ToJSON);
custItem.QB_TYPE := GetCustomerType(CustomerTypeRef.GetValue<string>('value'));
end;
end
else
custItem.QB_TYPE := '';
Result := custItem;
except
......@@ -3777,7 +3804,8 @@ var
CustomerID: Integer;
mode: string;
msg: string;
QB_LIST_ID, BaseUrl: string;
QB_LIST_ID, BaseUrl, SHORT_NAME: string;
unique: boolean;
begin
logger.Log(3, 'TLookupService.ImportQBCustomer');
DateFormat := TFormatSettings.Create;
......@@ -3788,63 +3816,35 @@ begin
if JSONData = nil then
raise Exception.Create('Invalid JSON format');
QB_LIST_ID := JSONData.GetValue<string>('QB_LIST_ID');
// Update RevisionID
SQL := 'UPDATE idfield SET KEYVALUE = KEYVALUE + 1 WHERE KEYNAME = ' + QuotedStr('GEN_CUSTOMER_ID');
OrdersDB.UniQuery1.SQL.Text := SQL;
OrdersDB.UniQuery1.ExecSQL;
// Retrieve updated RevisionID
SQL := 'SELECT KEYVALUE FROM idfield WHERE KEYNAME = ' + QuotedStr('GEN_CUSTOMER_ID');
doQuery(OrdersDB.UniQuery1, SQL);
CustomerID := OrdersDB.UniQuery1.FieldByName('KEYVALUE').AsInteger;
SQL := 'SELECT * FROM customers WHERE QB_LIST_ID = ' + QuotedStr(QB_LIST_ID);
SHORT_NAME := JSONData.GetValue<string>('SHORT_NAME');
SQL := 'select CUSTOMER_ID from customers where SHORT_NAME = ' + quotedStr(SHORT_NAME);
logger.Log(5, 'Retrieving customer with SQL: ' + SQL);
doQuery(OrdersDB.UniQuery1, SQL);
try
if OrdersDB.UniQuery1.IsEmpty then
begin
OrdersDB.UniQuery1.Insert;
for Pair in JSONData do
begin
Field := OrdersDB.UniQuery1.FindField(Pair.JsonString.Value);
if Assigned(Field) then
begin
if Field is TDateTimeField then
begin
if (Pair.JsonValue.Value = '') or (Pair.JsonValue.Value = 'null') or (Pair.JsonValue.Value = '12/30/1899') then
Field.Clear
else
TDateTimeField(Field).AsDateTime := StrToDate(Pair.JsonValue.Value, DateFormat);
end
else if Pair.JsonValue.Value <> '' then
Field.AsString := Pair.JsonValue.Value;
end;
end;
OrdersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsInteger := CustomerID;
OrdersDB.UniQuery1.FieldByName('QB_TYPE').AsString := JSONData.GetValue<string>('RepUser');
JSONData.AddPair('customer_id', TJSONNumber.Create(CustomerID));
OrdersDB.UniQuery1.Post;
if ordersDB.UniQuery1.IsEmpty then
unique := true
else
unique := false;
msg := 'Success: Customer Successfully Added';
if unique then
begin
// Update RevisionID
QB_LIST_ID := JSONData.GetValue<string>('QB_LIST_ID');
SQL := 'UPDATE idfield SET KEYVALUE = KEYVALUE + 1 WHERE KEYNAME = ' + QuotedStr('GEN_CUSTOMER_ID');
OrdersDB.UniQuery1.SQL.Text := SQL;
OrdersDB.UniQuery1.ExecSQL;
Result := TJSONObject.Create;
Result.AddPair('status', msg);
Result.AddPair('CustomerID', CustomerID);
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
// Retrieve updated RevisionID
SQL := 'SELECT KEYVALUE FROM idfield WHERE KEYNAME = ' + QuotedStr('GEN_CUSTOMER_ID');
doQuery(OrdersDB.UniQuery1, SQL);
CustomerID := OrdersDB.UniQuery1.FieldByName('KEYVALUE').AsInteger;
// Add Shipping Information
SQL := 'SELECT * FROM customers WHERE QB_LIST_ID = ' + QuotedStr(QB_LIST_ID);
doQuery(OrdersDB.UniQuery1, SQL);
if JSONData.GetValue<string>('ship_block') <> '' then
try
if OrdersDB.UniQuery1.IsEmpty then
begin
SQL := 'SELECT * FROM customers_ship WHERE customer_id = 0 AND customer_id <> 0';
doQuery(OrdersDB.UniQuery1, SQL);
OrdersDB.UniQuery1.Insert;
for Pair in JSONData do
......@@ -3863,27 +3863,71 @@ begin
Field.AsString := Pair.JsonValue.Value;
end;
end;
OrdersDB.UniQuery1.FieldByName('address').AsString := JSONData.GetValue<string>('shipping_address');
OrdersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsInteger := CustomerID;
OrdersDB.UniQuery1.FieldByName('QB_TYPE').AsString := JSONData.GetValue<string>('RepUser');
JSONData.AddPair('customer_id', TJSONNumber.Create(CustomerID));
OrdersDB.UniQuery1.Post;
end;
end
else
begin
msg := 'Failure:Customer Already in Database';
CustomerID := OrdersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsInteger;
Result := TJSONObject.Create;
Result.AddPair('status', msg);
Result.AddPair('CustomerID', CustomerID);
end;
msg := 'Success: Customer Successfully Added';
Result := TJSONObject.Create;
Result.AddPair('status', msg);
Result.AddPair('CustomerID', CustomerID);
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
// Add Shipping Information
if JSONData.GetValue<string>('ship_block') <> '' then
begin
SQL := 'SELECT * FROM customers_ship WHERE customer_id = 0 AND customer_id <> 0';
doQuery(OrdersDB.UniQuery1, SQL);
OrdersDB.UniQuery1.Insert;
for Pair in JSONData do
begin
Field := OrdersDB.UniQuery1.FindField(Pair.JsonString.Value);
if Assigned(Field) then
begin
if Field is TDateTimeField then
begin
if (Pair.JsonValue.Value = '') or (Pair.JsonValue.Value = 'null') or (Pair.JsonValue.Value = '12/30/1899') then
Field.Clear
else
TDateTimeField(Field).AsDateTime := StrToDate(Pair.JsonValue.Value, DateFormat);
end
else if Pair.JsonValue.Value <> '' then
Field.AsString := Pair.JsonValue.Value;
end;
end;
OrdersDB.UniQuery1.FieldByName('address').AsString := JSONData.GetValue<string>('shipping_address');
OrdersDB.UniQuery1.Post;
end;
end
else
begin
msg := 'Failure:Customer Already in Database';
CustomerID := OrdersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsInteger;
Result := TJSONObject.Create;
Result.AddPair('status', msg);
Result.AddPair('CustomerID', CustomerID);
end;
except
on E: Exception do
begin
logger.Log(1, 'Error in Import QBCustomer: ' + E.Message);
Result := TJSONObject.Create;
Result.AddPair('error', 'Error importing QB Customer! A QuickBooks interface error has occured!');
raise EXDataHttpException.Create(500, 'Unable to retrieve QuickBooks Items: A QuickBooks interface error has occurred!');
end;
end;
end
else
begin
Result := TJSONObject.Create;
Result.AddPair('status', 'Failure:Customer ID must be unique');
end;
end;
......
......@@ -50,6 +50,442 @@ object rptOrderCorrugated: TrptOrderCorrugated
DataSetOptions = []
Left = 444
Top = 206
FieldDefs = <
item
FieldName = 'ORDER_ID'
end
item
FieldName = 'COMPANY_ID'
end
item
FieldName = 'USER_ID'
end
item
FieldName = 'ORDER_DATE'
FieldType = fftDateTime
end
item
FieldName = 'START_DATE'
FieldType = fftDateTime
end
item
FieldName = 'END_DATE'
FieldType = fftDateTime
end
item
FieldName = 'ORDER_STATUS'
FieldType = fftString
end
item
FieldName = 'SCHED_JSON'
FieldType = fftString
Size = 4096
end
item
FieldName = 'staff_fields_order_date'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_proof_date'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_ship_date'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_ship_via'
FieldType = fftString
Size = 45
end
item
FieldName = 'staff_fields_price'
FieldType = fftString
end
item
FieldName = 'staff_fields_invoice_to'
FieldType = fftString
Size = 128
end
item
FieldName = 'staff_fields_invoice_attention'
FieldType = fftString
Size = 256
end
item
FieldName = 'staff_fields_ship_to'
FieldType = fftString
Size = 128
end
item
FieldName = 'staff_fields_ship_attention'
FieldType = fftString
Size = 256
end
item
FieldName = 'staff_fields_po_number'
FieldType = fftString
Size = 16
end
item
FieldName = 'staff_fields_job_name'
FieldType = fftString
Size = 45
end
item
FieldName = 'staff_fields_art_due'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_plate_due'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_mount_due'
FieldType = fftDateTime
end
item
FieldName = 'plates_job_number'
FieldType = fftString
Size = 16
end
item
FieldName = 'supplied_by_customer_b_w_copy'
FieldType = fftString
end
item
FieldName = 'supplied_by_customer_color_copy'
FieldType = fftString
end
item
FieldName = 'supplied_by_customer_plates'
FieldType = fftString
end
item
FieldName = 'supplied_by_customer_sample_ca'
FieldType = fftString
end
item
FieldName = 'supplied_by_customer_dimension'
FieldType = fftString
Size = 64
end
item
FieldName = 'supplied_by_customer_disk_or_cd'
FieldType = fftString
end
item
FieldName = 'supplied_by_customer_e_mail'
FieldType = fftString
Size = 256
end
item
FieldName = 'supplied_by_customer_ftp'
FieldType = fftString
Size = 256
end
item
FieldName = 'supplied_by_customer_other'
FieldType = fftString
Size = 96
end
item
FieldName = 'supplied_by_customer_existing_'
FieldType = fftString
Size = 16
end
item
FieldName = 'supplied_by_customer_ref_art_p'
FieldType = fftString
Size = 256
end
item
FieldName = 'supplied_by_customer_ref_art_a'
FieldType = fftString
Size = 256
end
item
FieldName = 'cut_die_cutdier'
FieldType = fftString
end
item
FieldName = 'cut_die_cutdieb'
FieldType = fftString
end
item
FieldName = 'cut_die_cutdief'
FieldType = fftString
end
item
FieldName = 'cut_die_cutdierkr'
FieldType = fftString
end
item
FieldName = 'cut_die_cutdiefkr'
FieldType = fftString
end
item
FieldName = 'cut_die_cad_file'
FieldType = fftString
Size = 128
end
item
FieldName = 'cut_die_attached'
FieldType = fftString
end
item
FieldName = 'cut_die_boxpol250'
FieldType = fftString
end
item
FieldName = 'cut_die_boxpol155'
FieldType = fftString
end
item
FieldName = 'cut_die_boxpol125'
FieldType = fftString
end
item
FieldName = 'cut_die_brub'
FieldType = fftString
end
item
FieldName = 'proofing_fax'
FieldType = fftString
Size = 16
end
item
FieldName = 'proofing_fax_attn'
FieldType = fftString
Size = 256
end
item
FieldName = 'proofing_e_mail'
FieldType = fftString
Size = 256
end
item
FieldName = 'proofing_e_mail_attn'
FieldType = fftString
Size = 256
end
item
FieldName = 'proofing_ship_to'
FieldType = fftString
Size = 1024
end
item
FieldName = 'proofing_full_size_panel'
FieldType = fftString
end
item
FieldName = 'proofing_print_card'
FieldType = fftString
end
item
FieldName = 'proofing_wide_format'
FieldType = fftString
end
item
FieldName = 'proofing_pdf_file'
FieldType = fftString
end
item
FieldName = 'proofing_other'
FieldType = fftString
Size = 64
end
item
FieldName = 'proofing_art_approved_as_is'
FieldType = fftString
end
item
FieldName = 'proofing_approved_date'
FieldType = fftDateTime
end
item
FieldName = 'proofing_changes_required'
FieldType = fftString
end
item
FieldName = 'proofing_changes_date'
FieldType = fftDateTime
end
item
FieldName = 'layout_rsc_l'
FieldType = fftString
end
item
FieldName = 'layout_rcs_w'
FieldType = fftString
end
item
FieldName = 'layout_rcs_d'
FieldType = fftString
end
item
FieldName = 'layout_die_cut_no'
FieldType = fftString
Size = 45
end
item
FieldName = 'layout_accross_no'
FieldType = fftString
end
item
FieldName = 'layout_around_no'
FieldType = fftString
end
item
FieldName = 'layout_cad_file'
FieldType = fftString
Size = 45
end
item
FieldName = 'layout_excalibur_die'
FieldType = fftString
end
item
FieldName = 'mounting_loose'
FieldType = fftString
end
item
FieldName = 'mounting_sticky_bak'
FieldType = fftString
end
item
FieldName = 'mounting_full_mount'
FieldType = fftString
end
item
FieldName = 'mounting_strip_mount'
FieldType = fftString
end
item
FieldName = 'colors_cylinder_size'
FieldType = fftString
Size = 45
end
item
FieldName = 'colors_machine_ident'
FieldType = fftString
Size = 45
end
item
FieldName = 'mounting_standard_setup'
FieldType = fftString
Size = 45
end
item
FieldName = 'mounting_custom_backing'
FieldType = fftString
Size = 96
end
item
FieldName = 'mounting_custom_adhesive'
FieldType = fftString
Size = 45
end
item
FieldName = 'colors_cross_hairs'
FieldType = fftString
end
item
FieldName = 'colors_clemson'
FieldType = fftString
end
item
FieldName = 'plates_thickness'
FieldType = fftString
end
item
FieldName = 'plates_plate_material'
FieldType = fftString
Size = 16
end
item
FieldName = 'general_special_instructions'
FieldType = fftString
Size = 2048
end
item
FieldName = 'colors_colors'
FieldType = fftString
Size = 4096
end
item
FieldName = 'staff_fields_quickbooks_item'
FieldType = fftString
Size = 45
end
item
FieldName = 'staff_fields_quantity'
FieldType = fftString
end
item
FieldName = 'layout_rsc_style'
FieldType = fftString
Size = 32
end
item
FieldName = 'staff_fields_art_location'
FieldType = fftString
Size = 16
end
item
FieldName = 'ORDER_ID_1'
end
item
FieldName = 'COMPANY_ID_1'
end
item
FieldName = 'ORDER_TYPE'
FieldType = fftString
Size = 45
end
item
FieldName = 'ORDER_DATE_1'
FieldType = fftDateTime
end
item
FieldName = 'PRICE'
end
item
FieldName = 'JOB_NAME'
FieldType = fftString
Size = 128
end
item
FieldName = 'USER_ID_1'
end
item
FieldName = 'LOCATION'
FieldType = fftString
Size = 16
end
item
FieldName = 'IN_QB'
FieldType = fftString
end
item
FieldName = 'QB_ORDER_NUM'
FieldType = fftString
Size = 30
end
item
FieldName = 'QB_ESTIMATE_ID'
FieldType = fftString
Size = 30
end
item
FieldName = 'QB_ORDER_USER'
FieldType = fftString
Size = 60
end
item
FieldName = 'QB_CREATE_DATE'
FieldType = fftDateTime
end>
end
object frxOrderCorrugated: TfrxReport
Version = '2026.1.7'
......
......@@ -156,15 +156,15 @@ var
colorArray: TJSONArray;
colorsObject, colorObject: TJSONObject;
colorsString: string;
i: Integer;
i, maxColors: Integer;
begin
logger.Log( 5, 'TrptOrderCorrugated.PopulateColorTable' );
maxColors := 13;
colorsString := uqOrderCorrugated.FieldByName('colors_colors').AsString;
colorsObject := TJSONObject.ParseJSONValue(colorsString) as TJSONObject;
colorArray := TJSONArray(colorsObject.GetValue<TJSONArray>('items'));
for i := 0 to colorArray.Count - 1 do
for i := 0 to maxColors - 1 do
begin
row := frxOrderCorrugated.FindObject('ColorRow' + IntToStr(i + 1)) as TfrxCustomTableRow;
colorObject := colorArray.Items[i] as TJSONObject;
......
......@@ -401,11 +401,10 @@ object rptOrderList: TrptOrderList
Left = 941.480349130000000000
Top = 7.559060000000000000
Width = 45.354330710000000000
Height = 30.236220472440900000
Height = 30.236220470000000000
StretchMode = smActualHeight
ContentScaleOptions.Constraints.MaxIterationValue = 0
ContentScaleOptions.Constraints.MinIterationValue = 0
DataField = 'QB_REF_NUM'
DataSet = frxDBOrders
DataSetName = 'frxDBOrders'
Font.Charset = DEFAULT_CHARSET
......@@ -415,7 +414,7 @@ object rptOrderList: TrptOrderList
Font.Style = []
Frame.Typ = []
Memo.UTF8W = (
'[frxDBOrders."QB_REF_NUM"]')
'[frxDBOrders."QB_ORDER_NUM"]')
ParentFont = False
end
object Memo56: TfrxMemoView
......@@ -1217,11 +1216,6 @@ object rptOrderList: TrptOrderList
FieldName = 'PRICE'
Required = True
end
object uqOrdersQB_REF_NUM: TStringField
FieldName = 'QB_REF_NUM'
ReadOnly = True
Size = 24
end
object uqOrdersCOLORS: TStringField
FieldKind = fkCalculated
FieldName = 'COLORS'
......@@ -1271,6 +1265,10 @@ object rptOrderList: TrptOrderList
object uqOrdersORDER_DATE: TDateField
FieldName = 'ORDER_DATE'
end
object uqOrdersQB_ORDER_NUM: TStringField
FieldName = 'QB_ORDER_NUM'
Size = 50
end
end
object frxDBOrders: TfrxDBDataset
UserName = 'frxDBOrders'
......@@ -1280,6 +1278,126 @@ object rptOrderList: TrptOrderList
DataSetOptions = []
Left = 444
Top = 232
FieldDefs = <
item
FieldName = 'ORDER_ID'
end
item
FieldName = 'Loc'
FieldType = fftString
Size = 16
end
item
FieldName = 'COMPANY_NAME'
FieldType = fftString
Size = 90
end
item
FieldName = 'JOB_NAME'
FieldType = fftString
Size = 128
end
item
FieldName = 'ORDER_TYPE'
FieldType = fftString
Size = 45
end
item
FieldName = 'PROOF_DUE'
FieldType = fftDateTime
end
item
FieldName = 'PROOF_DONE'
FieldType = fftDateTime
end
item
FieldName = 'ART_DUE'
FieldType = fftDateTime
end
item
FieldName = 'ART_DONE'
FieldType = fftDateTime
end
item
FieldName = 'PLATE_DUE'
FieldType = fftDateTime
end
item
FieldName = 'PLATE_DONE'
FieldType = fftDateTime
end
item
FieldName = 'MOUNT_DUE'
FieldType = fftDateTime
end
item
FieldName = 'MOUNT_DONE'
FieldType = fftDateTime
end
item
FieldName = 'SHIP_DUE'
FieldType = fftDateTime
end
item
FieldName = 'SHIP_DONE'
FieldType = fftDateTime
end
item
FieldName = 'PRICE'
end
item
FieldName = 'COLORS'
FieldType = fftString
end
item
FieldName = 'po_number'
FieldType = fftString
Size = 16
end
item
FieldName = 'quickbooks_item'
FieldType = fftString
Size = 45
end
item
FieldName = 'NEW_ORDER_DATE'
FieldType = fftString
Size = 20
end
item
FieldName = 'NEW_PROOF_DONE'
FieldType = fftString
Size = 20
end
item
FieldName = 'NEW_ART_DONE'
FieldType = fftString
Size = 20
end
item
FieldName = 'NEW_PLATE_DONE'
FieldType = fftString
Size = 20
end
item
FieldName = 'NEW_MOUNT_DONE'
FieldType = fftString
Size = 20
end
item
FieldName = 'NEW_SHIP_DONE'
FieldType = fftString
Size = 20
end
item
FieldName = 'ORDER_DATE'
FieldType = fftDateTime
end
item
FieldName = 'QB_ORDER_NUM'
FieldType = fftString
Size = 50
end>
end
object uqColors: TUniQuery
Connection = ucKG
......
......@@ -30,7 +30,6 @@ type
uqOrdersSHIP_DUE: TDateField;
uqOrdersSHIP_DONE: TDateTimeField;
uqOrdersPRICE: TFloatField;
uqOrdersQB_REF_NUM: TStringField;
uqOrdersCOLORS: TStringField;
uqColors: TUniQuery;
uqOrderspo_number: TStringField;
......@@ -42,6 +41,7 @@ type
uqOrdersNEW_MOUNT_DONE: TStringField;
uqOrdersNEW_SHIP_DONE: TStringField;
uqOrdersORDER_DATE: TDateField;
uqOrdersQB_ORDER_NUM: TStringField;
procedure DataModuleCreate(Sender: TObject);
procedure uqOrdersCalcFields(DataSet: TDataSet);
......
......@@ -4,13 +4,9 @@ object rptOrderWeb: TrptOrderWeb
Width = 640
object ucKG: TUniConnection
ProviderName = 'MySQL'
Database = 'kg_order_entry'
Username = 'root'
Server = '192.168.159.10'
LoginPrompt = False
Left = 289
Top = 119
EncryptedPassword = '9AFF92FF8CFF86FF8CFFCFFFCEFF'
end
object frxPDFExport1: TfrxPDFExport
UseFileCache = True
......@@ -48,6 +44,442 @@ object rptOrderWeb: TrptOrderWeb
DataSetOptions = []
Left = 444
Top = 206
FieldDefs = <
item
FieldName = 'ORDER_ID'
end
item
FieldName = 'COMPANY_ID'
end
item
FieldName = 'USER_ID'
end
item
FieldName = 'ORDER_DATE'
FieldType = fftDateTime
end
item
FieldName = 'START_DATE'
FieldType = fftDateTime
end
item
FieldName = 'END_DATE'
FieldType = fftDateTime
end
item
FieldName = 'ORDER_STATUS'
FieldType = fftString
end
item
FieldName = 'SCHED_JSON'
FieldType = fftString
Size = 4096
end
item
FieldName = 'staff_fields_order_date'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_proof_date'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_ship_date'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_ship_via'
FieldType = fftString
Size = 45
end
item
FieldName = 'staff_fields_price'
FieldType = fftString
end
item
FieldName = 'staff_fields_invoice_to'
FieldType = fftString
Size = 128
end
item
FieldName = 'staff_fields_invoice_attention'
FieldType = fftString
Size = 256
end
item
FieldName = 'staff_fields_ship_to'
FieldType = fftString
Size = 128
end
item
FieldName = 'staff_fields_ship_attention'
FieldType = fftString
Size = 256
end
item
FieldName = 'staff_fields_po_number'
FieldType = fftString
Size = 16
end
item
FieldName = 'staff_fields_job_name'
FieldType = fftString
Size = 45
end
item
FieldName = 'staff_fields_art_due'
FieldType = fftDateTime
end
item
FieldName = 'staff_fields_plate_due'
FieldType = fftDateTime
end
item
FieldName = 'plates_job_number'
FieldType = fftString
Size = 16
end
item
FieldName = 'supplied_by_customer_b_w_or_co'
FieldType = fftString
end
item
FieldName = 'supplied_by_customer_plates'
FieldType = fftString
end
item
FieldName = 'supplied_by_customer_sample'
FieldType = fftString
Size = 45
end
item
FieldName = 'supplied_by_customer_dimension'
FieldType = fftString
end
item
FieldName = 'supplied_by_customer_other'
FieldType = fftString
Size = 45
end
item
FieldName = 'supplied_by_customer_disk'
FieldType = fftString
end
item
FieldName = 'supplied_by_customer_e_mail'
FieldType = fftString
Size = 128
end
item
FieldName = 'supplied_by_customer_ftp'
FieldType = fftString
Size = 128
end
item
FieldName = 'plates_plate_material'
FieldType = fftString
Size = 16
end
item
FieldName = 'plates_thickness'
FieldType = fftString
end
item
FieldName = 'supplied_by_customer_total_inc'
FieldType = fftString
Size = 32
end
item
FieldName = 'supplied_by_customer_sheets_us'
FieldType = fftString
Size = 32
end
item
FieldName = 'supplied_by_customer_initials'
FieldType = fftString
Size = 16
end
item
FieldName = 'proofing_pdf'
FieldType = fftString
end
item
FieldName = 'proofing_pdf_to'
FieldType = fftString
Size = 256
end
item
FieldName = 'proofing_pdf_date_1'
FieldType = fftDateTime
end
item
FieldName = 'proofing_pdf_date_2'
FieldType = fftDateTime
end
item
FieldName = 'proofing_pdf_date_3'
FieldType = fftDateTime
end
item
FieldName = 'proofing_full_size_ink_jet_for'
FieldType = fftString
end
item
FieldName = 'proofing_ink_jet_to'
FieldType = fftString
Size = 256
end
item
FieldName = 'proofing_ink_jet_to_2'
FieldType = fftString
Size = 256
end
item
FieldName = 'proofing_ink_jet_date_1'
FieldType = fftDateTime
end
item
FieldName = 'proofing_ink_jet_date_2'
FieldType = fftDateTime
end
item
FieldName = 'proofing_ink_jet_date_3'
FieldType = fftDateTime
end
item
FieldName = 'proofing_color_contract'
FieldType = fftString
Size = 17
end
item
FieldName = 'proofing_color_contrac_to'
FieldType = fftString
Size = 256
end
item
FieldName = 'proofing_color_contrac_date_1'
FieldType = fftDateTime
end
item
FieldName = 'proofing_color_contrac_date_2'
FieldType = fftDateTime
end
item
FieldName = 'proofing_digital_color_key'
FieldType = fftString
end
item
FieldName = 'proofing_digital_color_to'
FieldType = fftString
Size = 256
end
item
FieldName = 'proofing_digital_color_date_1'
FieldType = fftDateTime
end
item
FieldName = 'quantity_and_colors_press_name'
FieldType = fftString
Size = 64
end
item
FieldName = 'quantity_and_colors_anilox_info'
FieldType = fftString
Size = 64
end
item
FieldName = 'plate_marks_microdots'
FieldType = fftString
end
item
FieldName = 'plate_marks_microdots_comments'
FieldType = fftString
Size = 128
end
item
FieldName = 'plate_marks_crosshairs'
FieldType = fftString
end
item
FieldName = 'plate_marks_crosshairs_comments'
FieldType = fftString
Size = 128
end
item
FieldName = 'plate_marks_color_bars'
FieldType = fftString
end
item
FieldName = 'plate_marks_color_bars_comments'
FieldType = fftString
Size = 128
end
item
FieldName = 'plate_marks_other'
FieldType = fftString
Size = 16
end
item
FieldName = 'plate_marks_other_comments'
FieldType = fftString
Size = 128
end
item
FieldName = 'print_orientation_print_orient'
FieldType = fftString
end
item
FieldName = 'layout_around'
FieldType = fftString
end
item
FieldName = 'layout_accross'
FieldType = fftString
end
item
FieldName = 'layout_surface_print'
FieldType = fftString
end
item
FieldName = 'layout_reverse_print'
FieldType = fftString
end
item
FieldName = 'layout_cylinder_repeat'
FieldType = fftString
Size = 16
end
item
FieldName = 'layout_cutoff_dimension'
FieldType = fftString
Size = 16
end
item
FieldName = 'layout_pitch'
FieldType = fftString
Size = 16
end
item
FieldName = 'layout_teeth'
FieldType = fftString
Size = 16
end
item
FieldName = 'layout_bleed'
FieldType = fftString
Size = 16
end
item
FieldName = 'layout_cutback'
FieldType = fftString
Size = 16
end
item
FieldName = 'layout_minimum_trap_dim'
FieldType = fftString
end
item
FieldName = 'layout_maximum_trap_dim'
FieldType = fftString
end
item
FieldName = 'upc_size'
FieldType = fftString
Size = 16
end
item
FieldName = 'upc_bar_width_reduction'
FieldType = fftString
Size = 16
end
item
FieldName = 'quantity_and_colors_qty_colors'
FieldType = fftString
Size = 4096
end
item
FieldName = 'general_comments'
FieldType = fftString
Size = 4096
end
item
FieldName = 'staff_fields_quickbooks_item'
FieldType = fftString
Size = 45
end
item
FieldName = 'staff_fields_quantity'
FieldType = fftString
end
item
FieldName = 'upc_distortion_percent'
FieldType = fftString
Size = 16
end
item
FieldName = 'upc_distortion_amount'
FieldType = fftString
Size = 16
end
item
FieldName = 'staff_fields_art_location'
FieldType = fftString
Size = 16
end
item
FieldName = 'ORDER_ID_1'
end
item
FieldName = 'COMPANY_ID_1'
end
item
FieldName = 'ORDER_TYPE'
FieldType = fftString
Size = 45
end
item
FieldName = 'ORDER_DATE_1'
FieldType = fftDateTime
end
item
FieldName = 'PRICE'
end
item
FieldName = 'JOB_NAME'
FieldType = fftString
Size = 128
end
item
FieldName = 'USER_ID_1'
end
item
FieldName = 'LOCATION'
FieldType = fftString
Size = 16
end
item
FieldName = 'IN_QB'
FieldType = fftString
end
item
FieldName = 'QB_ORDER_NUM'
FieldType = fftString
Size = 30
end
item
FieldName = 'QB_ESTIMATE_ID'
FieldType = fftString
Size = 30
end
item
FieldName = 'QB_ORDER_USER'
FieldType = fftString
Size = 60
end
item
FieldName = 'QB_CREATE_DATE'
FieldType = fftDateTime
end>
end
object frxOrderWeb: TfrxReport
Version = '2026.1.7'
......@@ -1134,7 +1566,7 @@ object rptOrderWeb: TrptOrderWeb
DataSetName = 'frxDBOrderWeb'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -12
Font.Height = -9
Font.Name = 'Arial'
Font.Style = []
Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
......@@ -4644,7 +5076,6 @@ object rptOrderWeb: TrptOrderWeb
'SELECT * FROM web_plate_orders w JOIN orders o ON w.ORDER_ID = o' +
'.ORDER_ID WHERE w.ORDER_ID = 1568')
Active = True
Left = 457
Top = 106
object uqOrderWebORDER_ID: TIntegerField
......
......@@ -155,15 +155,16 @@ var
colorArray: TJSONArray;
colorsObject, colorObject: TJSONObject;
colorsString: string;
i: Integer;
i, maxColors: Integer;
begin
maxColors := 10;
logger.Log( 5, 'TrptOrderWeb.PopulateColorTable' );
colorsString := uqOrderWeb.FieldByName('quantity_and_colors_qty_colors').AsString;
colorsObject := TJSONObject.ParseJSONValue(colorsString) as TJSONObject;
colorArray := TJSONArray(colorsObject.GetValue<TJSONArray>('items'));
for i := 0 to colorArray.Count - 1 do
for i := 0 to maxColors - 1 do
begin
row := frxOrderWeb.FindObject('ColorRow' + IntToStr(i + 1)) as TfrxCustomTableRow;
colorObject := colorArray.Items[i] as TJSONObject;
......
......@@ -114,11 +114,11 @@
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_ExeOutput>.\bin</DCC_ExeOutput>
<DCC_UnitSearchPath>C:\RADTOOLS\FastMM4;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<VerInfo_Keys>CompanyName=EM Systems;FileDescription=$(MSBuildProjectName);FileVersion=0.9.15.1;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.11;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=EM Systems;FileDescription=$(MSBuildProjectName);FileVersion=0.9.15.3;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.11;Comments=</VerInfo_Keys>
<VerInfo_MajorVer>0</VerInfo_MajorVer>
<VerInfo_MinorVer>9</VerInfo_MinorVer>
<VerInfo_Release>15</VerInfo_Release>
<VerInfo_Build>1</VerInfo_Build>
<VerInfo_Build>3</VerInfo_Build>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
......
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