Commit 7e3b07ca by Cam Hayes

kgOrdersTest v0.9.15.3 deployed

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