Commit 4ee28e36 by emsys

finished the cutting die page

parent 344aa169
......@@ -40,7 +40,7 @@
<input id="edtcompanyid" class="form-control input-sm"style="width: 100px" required/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quickbooks ID:</label>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QB ID:</label>
<input id="edtqbid" class="form-control input-sm"style="width: 200px" required/>
</div>
<div class="col-auto">
......
......@@ -135,6 +135,13 @@ end;
// if confirmed then DeleteOrder();
// end);
// function ShowConfirmationModal(msg, leftLabel, rightLabel: string;): Boolean;
// if ShowConfirmationModal then
// doThing()
// else
// doOtherThing();
procedure ShowConfirmationModal(msg, leftLabel, rightLabel: string; ConfirmProc: TProc<Boolean>);
begin
......
......@@ -119,20 +119,6 @@ object FViewMain: TFViewMain
WidthPercent = 100.000000000000000000
OnClick = lblCustomersClick
end
object lblQuickbooks: TWebLabel
Left = 546
Top = 125
Width = 57
Height = 14
Caption = 'QuickBooks'
ElementID = 'lblquickbooks'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblQuickbooksClick
end
object lblVersion: TWebLabel
Left = 358
Top = 209
......
......@@ -15,9 +15,6 @@
<li class="nav-item">
<a class="dropdown-item" id="dropdown.menu.itemlist" href="#"><i class="fa fa-cubes fa-fw"></i><span> Items</span></a>
</li>
<li class="nav-item">
<a class="dropdown-item" id="lblquickbooks" href="#"><i class="fa fa-tags fa-fw"></i><span> QuickBooks</span></a>
</li>
</ul>
<div class="collapse navbar-collapse show" id="navbarNavDropdown">
<ul class="navbar-nav ms-auto">
......
......@@ -23,7 +23,6 @@ type
lblUsers: TWebLinkLabel;
lblorders: TWebLabel;
lblCustomers: TWebLabel;
lblQuickbooks: TWebLabel;
lblVersion: TWebLabel;
procedure WebFormCreate(Sender: TObject);
procedure mnuLogoutClick(Sender: TObject);
......
......@@ -62,6 +62,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
AutoSize = True
ChildOrder = 79
ElementID = 'edtqbordernum'
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'QB_ORDER_NUM'
......@@ -148,7 +149,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
end
object edtJobName: TWebDBEdit
Left = 26
Top = 486
Top = 516
Width = 121
Height = 23
AutoSize = True
......@@ -156,6 +157,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
ElementID = 'edtjobname'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnExit = edtJobNameExit
DataField = 'staff_fields_job_name'
DataSource = wdsOrder
end
......@@ -210,12 +212,13 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
end
object wcbQBItem: TWebDBComboBox
Left = 26
Top = 515
Top = 487
Width = 145
Height = 23
ElementID = 'wcbqbitem'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = wcbQBItemChange
ItemIndex = -1
DataField = 'staff_fields_quickbooks_item'
DataSource = wdsOrder
......@@ -314,6 +317,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Caption = 'In Quickbooks?'
ChildOrder = 29
ElementID = 'wdbcbinqb'
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'IN_QB'
......@@ -391,6 +395,17 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
DataField = 'staff_fields_ship_date'
DataSource = wdsOrder
end
object edtQBItemDescription: TWebEdit
Left = 26
Top = 548
Width = 121
Height = 22
ChildOrder = 31
ElementID = 'edtitemdescription'
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object wdsOrder: TWebDataSource
AutoEdit = False
DataSet = xdwdsOrder
......@@ -471,6 +486,9 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
object xdwdsOrderIN_QB: TStringField
FieldName = 'IN_QB'
end
object xdwdsOrderQB_LIST_ID: TStringField
FieldName = 'QB_LIST_ID'
end
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
......@@ -500,6 +518,12 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
object xdwdsQBItemname: TStringField
FieldName = 'name'
end
object xdwdsQBItemQB_ID: TStringField
FieldName = 'QB_ID'
end
object xdwdsQBItemdescription: TStringField
FieldName = 'description'
end
end
object tmrReturn: TWebTimer
Enabled = False
......
......@@ -61,11 +61,11 @@
</div>
</div>
<div class="col-auto d-flex flex-column">
<label for="wdbcbinqb" class="form-label mt-2" style="font-weight: 700; font-size: 15px;">In Quickbooks?:</label>
<label for="wdbcbinqb" class="form-label mt-2" style="font-weight: 700; font-size: 15px;">In QB?:</label>
<input id="wdbcbinqb" type="checkbox" class="form-check-input mt-1">
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quickbooks Order Number:</label>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QB Order Number:</label>
<input id="edtqbordernum"type="text" class="form-control" style="width: 150px" required/>
</div>
</div>
......@@ -97,11 +97,17 @@
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quantity:</label>
<input id="edtquantity" class="form-control input-sm" style="width: 100px"/>
<input id="edtquantity" class="form-control input-sm" style="width: 100px" type="number" min="1" required/>
<div class="invalid-feedback" style="font-size: 15px;" required>
Please Provide a Quantity.
</div>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Price:</label>
<input id="edtprice" class="form-control input-sm" style="width: 100px" type="number" min="0"/>
<input id="edtprice" class="form-control input-sm" style="width: 100px" type="number" min="1" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Price.
</div>
</div>
<div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Invoice To:</label>
......@@ -125,12 +131,26 @@
<input id="edtponumber" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Job Name:</label>
<input id="edtjobname" class="form-control input-sm" style="width: 300px"/>
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QB Item:</label>
<select id="wcbqbitem" class='form-select' required></select>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a QB Item.
</div>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QuickBooks Item:</label>
<select id="wcbqbitem" class='form-select'></select>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Job Name:</label>
<input id="edtjobname" class="form-control input-sm" style="width: 600px"/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Job Name.
</div>
</div>
<div class="row">
<div class="col-12">
<label for="edtitemdescription" class="form-label mt-2" style="font-weight: 700; font-size: 15px;">
Item Description:
</label>
<input id="edtitemdescription" class="form-control" style="width: 100%;" />
</div>
</div>
</div>
<h4 class="custom-h4 mt-3">General</h4>
......
......@@ -75,6 +75,10 @@ type
dtpOrderDate: TWebDBDateTimePicker;
dtpProofDate: TWebDBDateTimePicker;
dtpShipDate: TWebDBDateTimePicker;
xdwdsQBItemQB_ID: TStringField;
xdwdsOrderQB_LIST_ID: TStringField;
xdwdsQBItemdescription: TStringField;
edtQBItemDescription: TWebEdit;
procedure btnSaveClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure WebFormCreate(Sender: TObject);
......@@ -98,12 +102,17 @@ type
[async] procedure SendAddressToServer(AddressJSON: TJSONObject);
procedure btnQBClick(Sender: TObject);
procedure xdwdsOrderCalcFields(DataSet: TDataSet);
[async] procedure AddEstimate(orderID: string);
function VerifyQBOrder(): boolean;
procedure wcbQBItemChange(Sender: TObject);
procedure edtJobNameExit(Sender: TObject);
private
FAgencyCode: string;
FCurrentReportType: string;
FSelectProc: TSelectProc;
orderID: string;
customerID: string;
customer_qb_id: string;
mode: string;
notification: string;
procedure EditMode;
......@@ -159,10 +168,46 @@ begin
ShowToast(notification);
end;
procedure TFOrderEntryCuttingDie.AddEstimate(orderID: string);
var
Response: TXDataClientResponse;
notification: TJSObject;
msg: string;
begin
try
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddEstimate',
[orderID]));
notification := TJSObject(Response.Result);
msg := string(notification['status']);
Utils.HideSpinner('spinner');
getCuttingDieOrder(orderID);
ShowToast(msg);
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end;
end;
procedure TFOrderEntryCuttingDie.btnQBClick(Sender: TObject);
begin
ShowToast('Sending Orders To QuickBooks is not yet Implemented', 'info');
//ShowToast('Sending Orders To QuickBooks is not yet Implemented', 'info');
console.log(customer_qb_id);
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
begin
if ( VerifyQBOrder() )then
begin
if wdbcbINQB.Checked = false then
begin
Utils.ShowSpinner('spinner');
addEstimate(xdwdsOrder.FieldByName('ORDER_ID').AsString);
end
else
ShowToast('Failure:Cannot submit orders already in QuickBooks', 'failure');
end;
end
else
ShowToast('Failure:User not authorized to add to QuickBooks', 'failure');
end;
procedure TFOrderEntryCuttingDie.WebButton2Click(Sender: TObject);
......@@ -178,7 +223,6 @@ var
begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddShippingAddress',
[AddressJSON.ToString]));
notification := TJSObject(Response.Result);
ShowToast(string(notification['status']));
xdwdsShipTo.Close;
......@@ -250,6 +294,15 @@ begin
else
input.classList.remove('is-invalid');
input := TJSHTMLInputElement(document.getElementById('edtjobname'));
if edtJobName.Text = '' then
begin
input.classList.add('is-invalid');
result := false;
end
else
input.classList.remove('is-invalid');
input := TJSHTMLInputElement(document.getElementById('edtaccountcompanyname'));
if edtCompanyAccountName.Text = '' then
......@@ -288,6 +341,36 @@ begin
end
else
input.classList.remove('is-invalid');
input := TJSHTMLInputElement(document.getElementById('edtprice'));
if edtPrice.Text = '' then
begin
input.classList.add('is-invalid');
result := false;
end
else
input.classList.remove('is-invalid');
input := TJSHTMLInputElement(document.getElementById('edtquantity'));
if edtQuantity.Text = '' then
begin
input.classList.add('is-invalid');
result := false;
end
else
input.classList.remove('is-invalid');
input := TJSHTMLInputElement(document.getElementById('wcbqbitem'));
if wcbQBItem.Text = '' then
begin
input.classList.add('is-invalid');
result := false;
end
else
input.classList.remove('is-invalid');
end;
......@@ -303,11 +386,6 @@ begin
orderJSON := TJSONObject.Create;
xdwdsOrder.Edit;
//Convert all dates to strings because I was having less issues with that data type.
{xdwdsOrderstaff_fields_proof_date.Value := DateTimeToStr(dtpProofDate.Date);
xdwdsOrderstaff_fields_ship_date.Value := DateTimeToStr(dtpShipDate.Date);
xdwdsOrderstaff_fields_order_date.Value := DateTimeToStr(dtpOrderDate.Date);}
xdwdsOrder.Post;
xdwdsOrder.First;
while not xdwdsOrder.Eof do
......@@ -335,7 +413,7 @@ begin
end;
orderJSON.AddPair('mode', mode);
console.log(orderJSON);
AddCuttingDieOrder(orderJSON);
end;
......@@ -416,7 +494,7 @@ var
begin
try
// Call the server method to generate the PDF
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderCuttingPDF', [orderID]));
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderCuttingPDF', [xdwdsOrder.FieldByName('ORDER_ID').AsString]));
jsObject := JS.TJSObject(xdcResponse.Result);
pdfURL := JS.toString(jsObject.Properties['value']);
......@@ -447,7 +525,7 @@ begin
xdwdsOrder.SetJsonData(jsObj);
xdwdsOrder.Open;
edtOrderNum.Text := OrderID;
edtOrderNum.Text := xdwdsOrder.FieldByName('ORDER_ID').AsString;
mode := 'EDIT';
ShowToast(String(jsObj.Properties['status']));
except
......@@ -542,7 +620,7 @@ var
orderList : TJSObject;
i: integer;
data: TJSArray;
order, items: TJSObject;
order, items, customer: TJSObject;
begin
Utils.ShowSpinner('spinner');
try
......@@ -555,16 +633,27 @@ begin
xdwdsOrder.SetJsonData(order);
xdwdsOrder.Open;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer',
[xdwdsOrder.FieldByName('COMPANY_ID').AsString]));
customer := TJSObject(xdcResponse.Result);
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(order['ADDRESS_LIST']);
xdwdsShipTo.SetJSONData(customer['SHIPPING_ADDRESS_LIST']);
xdwdsShipTo.Open;
customer_qb_id := string(customer['QB_LIST_ID']);
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems',
[]));
items := TJSObject(xdcResponse.Result);
xdwdsQBItem.Close;
items := TJSObject(order['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open;
edtQBItemDescription.text := xdwdsQBItem.FieldByName('description').AsString +
' - ' + xdwdsOrder.FieldByName('staff_fields_job_name').AsString;
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
......@@ -585,7 +674,7 @@ begin
[customerID]));
customer := TJSObject(xdcResponse.Result);
customer_qb_id := string(customer['QB_LIST_ID']);
xdwdsOrder.Close;
xdwdsOrder.Open;
......@@ -603,7 +692,7 @@ begin
xdwdsShipTo.Open;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems',
[customerID]));
[]));
items := TJSObject(xdcResponse.Result);
xdwdsQBItem.Close;
......@@ -640,6 +729,12 @@ begin
end;
procedure TFOrderEntryCuttingDie.edtJobNameExit(Sender: TObject);
begin
edtQBItemDescription.text := xdwdsQBItem.FieldByName('description').AsString +
' - ' + xdwdsOrder.FieldByName('staff_fields_job_name').AsString;
end;
procedure TFOrderEntryCuttingDie.ViewMode;
begin
btnPDF.Enabled := true;
......@@ -658,6 +753,91 @@ begin
lblFormState.ElementHandle.classList.add('text-danger');
end;
procedure TFOrderEntryCuttingDie.wcbQBItemChange(Sender: TObject);
begin
edtQBItemDescription.text := xdwdsQBItem.FieldByName('description').AsString +
' - ' + xdwdsOrder.FieldByName('staff_fields_job_name').AsString;
end;
function TFOrderEntryCuttingDie.VerifyQBOrder: Boolean;
var
msg, SQL: string;
begin
Result := True;
msg := 'To add an order to QuickBooks, the following must be present:' + sLineBreak;
if edtCompanyName.Text = '' then
begin
msg := msg + '- Company Name cannot be empty' + sLineBreak;
Result := False;
end;
if edtCompanyAccountName.Text = '' then
begin
msg := msg + '- Company ID cannot be empty' + sLineBreak;
Result := False;
end;
if edtInvoiceTo.Text = '' then
begin
msg := msg + '- Invoice To cannot be empty' + sLineBreak;
Result := False;
end;
if wdbcbShipTo.Text = '' then
begin
msg := msg + '- Ship To cannot be empty' + sLineBreak;
Result := False;
end;
if dtpOrderDate.Date = 0 then
begin
msg := msg + '- Order Date cannot be empty' + sLineBreak;
Result := False;
end;
if edtPrice.Text = '' then
begin
msg := msg + '- Price cannot be empty' + sLineBreak;
Result := False;
end;
if edtQuantity.Text = '' then
begin
msg := msg + '- Quantity cannot be empty' + sLineBreak;
Result := False;
end;
if wcbQBItem.Text = '' then
begin
msg := msg + '- Item cannot be empty' + sLineBreak;
Result := False;
end;
if edtJobName.Text = '' then
begin
msg := msg + '- Job Name Cannot be empty' + sLineBreak;
Result := False;
end;
xdwdsQBItem.Locate('name', xdwdsOrder.FieldByName('staff_fields_quickbooks_item').AsString, []);
if xdwdsQBItem.FieldByName('QB_ID').AsString = '' then
begin
msg := msg + '- Item Must be Linked to QuickBooks' + sLineBreak;
Result := False;
end;
if customer_qb_id = '' then
begin
msg := msg + '- Customer Must be Linked to QuickBooks' + sLineBreak;
Result := False;
end;
if not result then
asm
alert(msg);
end;
end;
initialization
RegisterClass(TFOrderEntryCuttingDie);
......
......@@ -128,6 +128,10 @@ object FViewOrders: TFViewOrders
Title = 'Order Num'
end
item
DataField = 'IN_QB'
Title = 'In QB'
end
item
DataField = 'ID'
Title = 'Customer ID'
end
......@@ -194,7 +198,7 @@ object FViewOrders: TFViewOrders
item
ElementClassName = 'text-nowrap'
DataField = 'qbRefNum'
Title = 'QB Ref Num'
Title = 'QB Order Num'
TitleElementClassName = 'min-w-80'
end
item
......@@ -369,12 +373,15 @@ object FViewOrders: TFViewOrders
object xdwdsOrdersprice: TStringField
FieldName = 'price'
end
object xdwdsOrdersqbRefNum: TStringField
FieldName = 'qbRefNum'
end
object xdwdsOrderscolors: TStringField
FieldName = 'colors'
end
object xdwdsOrdersIN_QB: TStringField
FieldName = 'IN_QB'
end
object xdwdsOrdersqbRefNum: TStringField
FieldName = 'qbRefNum'
end
end
object wdsOrders: TWebDataSource
DataSet = xdwdsOrders
......
......@@ -35,7 +35,6 @@ type
xdwdsOrdersshipDone: TStringField;
xdwdsOrdersprice: TStringField;
xdwdsOrdersID: TStringField;
xdwdsOrdersqbRefNum: TStringField;
xdwdsOrderscolors: TStringField;
btnAddOrder: TWebButton;
btnSearch: TWebButton;
......@@ -58,6 +57,8 @@ type
edtSearch: TWebEdit;
xdwdsOrdersDBID: TStringField;
tmrReturn: TWebTimer;
xdwdsOrdersIN_QB: TStringField;
xdwdsOrdersqbRefNum: TStringField;
procedure WebFormCreate(Sender: TObject);
procedure btnAddOrderClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
......
......@@ -5,7 +5,7 @@
<FrameworkType>VCL</FrameworkType>
<MainSource>webKGOrders.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Release</Config>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
......
......@@ -59,6 +59,7 @@ type
TOrderItem = class
public
DBID,
IN_QB,
ID,
companyName,
jobName,
......@@ -118,15 +119,6 @@ type
ship_id: string;
end;
TOrderCustomerInfoItem = class
public
NAME: string;
CUSTOMER_ID: integer;
SHORT_NAME: string;
staff_fields_invoice_to: string;
SHIPPING_ADDRESS_LIST: TList<TAddressItem>;
end;
TCustomerItem = class
Public
NAME: string;
......@@ -367,8 +359,6 @@ type
SHORT_NAME: string;
IN_QB: string;
QB_ORDER_NUM: string;
ADDRESS_LIST: TList<TAddressItem>;
ITEMS: TItemList;
// Staff Fields:
staff_fields_order_date: string;
......@@ -387,12 +377,6 @@ type
general_special_instructions: string;
end;
TEmptyOrderInfo = class
public
CustomerInfo: TOrderCustomerInfoItem;
ITEMS: TItemList;
end;
// These objects are only used for quickbooks estimates.
TRef = record
value: string;
......@@ -523,6 +507,7 @@ type
function SetStatus(statusOptions: string): string;
function AddCustomer(customerInfo: string): TJSONObject;
function ImportQBCustomer(CustomerInfo: string): TJSONObject;
function AddEstimate(orderInfo: string): TJSONObject;
end;
implementation
......
......@@ -162,9 +162,8 @@ type
procedure addEstimate(orderInfo: string);
procedure getQBCustomers();
procedure ShowDeleteConfirm(msg: string);
procedure ShowLinkConfirm(msg: string);
procedure DeleteCustomers();
procedure LinkCustomers();
procedure LinkCustomer();
end;
var
......@@ -221,37 +220,39 @@ begin
else
begin
msg := 'Are you sure you want to link QB ID: ' + QB_ID + ' with KG Orders ID: ' + ID;
ShowLinkConfirm(msg);
if MessageDlg(msg, mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
// User confirmed
LinkCustomer();
end
else
begin
// User canceled
ShowMessage('Cancelled.');
end;
end;
end;
procedure TfQB.LinkCustomers();
procedure TfQB.LinkCustomer();
var
sql: string;
begin
sql := 'select QB_LIST_ID from customers where CUSTOMER_ID = ' + ID;
sql := 'select * from customers where CUSTOMER_ID = ' + ID;
Memo1.Lines.Add('SQL: ' + SQL);
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Edit;
ordersDB.UniQuery1.FieldByName('QB_LIST_ID').AsString := QB_ID;
ordersDB.UniQuery1.Post;
getCustomers();
QB_ID := '';
ID := '';
end;
procedure TfQB.ShowLinkConfirm(msg: string);
begin
if MessageDlg(msg, mtConfirmation, [mbYes, mbNo], 0) = mrYes then
if ordersDB.UniQuery1.RecordCount = 1 then
begin
// User confirmed
LinkCustomers();
ordersDB.UniQuery1.Edit;
ordersDB.UniQuery1.FieldByName('QB_LIST_ID').AsString := QB_ID;
ordersDB.UniQuery1.Post;
getCustomers();
QB_ID := '';
ID := '';
end
else
begin
// User canceled
ShowMessage('Cancelled.');
end;
MessageDlg('Wrong # of records return', mtConfirmation, [mbOk], 0)
end;
procedure TfQB.Button11Click(Sender: TObject);
var
restClient: TRESTClient;
......@@ -550,7 +551,7 @@ var
orderJSON: TJSONObject;
begin
orderJSON := TJSONObject.Create;
orderJSON.AddPair('ORDER_ID', '19814');
orderJSON.AddPair('ORDER_ID', '19842');
addEstimate(orderJSON.ToString);
end;
......@@ -591,6 +592,7 @@ var
ORDER_ID: string;
table: string;
ShipMethodRef: TJSONObject;
unitPrice: double;
begin
BillAddrJSON := TJSONObject.Create;
ShipAddrJSON := TJSONObject.Create;
......@@ -637,15 +639,15 @@ begin
;
estimateJSON.AddPair('CustomerRef', CustomerRefJSON);
Lines := ordersDB.UniQuery1.FieldByName('staff_fields_invoice_to').AsString.Split([sLineBreak]);
Lines := ordersDB.UniQuery1.FieldByName('staff_fields_invoice_to').AsString.Split([#10]);
for i := 0 to Length(Lines) - 2 do
begin
case i of
0: BillAddrJSON.AddPair('Line1', Lines[0]);
1: BillAddrJSON.AddPair('Line2', Lines[1]);
2: BillAddrJSON.AddPair('Line3', Lines[2]);
3: BillAddrJSON.AddPair('Line4', Lines[3]);
4: BillAddrJSON.AddPair('Line5', Lines[4]);
0: BillAddrJSON.AddPair('Line1', Lines[i].Trim.Replace(#13, '').Replace(#10, ''));
1: BillAddrJSON.AddPair('Line2', Lines[i].Trim.Replace(#13, '').Replace(#10, ''));
2: BillAddrJSON.AddPair('Line3', Lines[i].Trim.Replace(#13, '').Replace(#10, ''));
3: BillAddrJSON.AddPair('Line4', Lines[i].Trim.Replace(#13, '').Replace(#10, ''));
4: BillAddrJSON.AddPair('Line5', Lines[i].Trim.Replace(#13, '').Replace(#10, ''));
end;
end;
......@@ -700,7 +702,10 @@ begin
DetailObj.AddPair('ItemRef', ItemRefObj);
DetailObj.AddPair('Qty', TJSONNumber.Create(ordersDB.UniQuery1.FieldByName('staff_fields_quantity').AsFloat));
DetailObj.AddPair('UnitPrice', TJSONNumber.Create(ordersDB.UniQuery1.FieldByName('staff_fields_price').AsFloat));
unitPrice := ordersDB.UniQuery1.FieldByName('staff_fields_price').AsFloat / ordersDB.UniQuery1.FieldByName('staff_fields_quantity').AsInteger;
DetailObj.AddPair('UnitPrice', TJSONNumber.Create(unitPrice));
LineObj.AddPair('SalesItemLineDetail', DetailObj);
LineArray.AddElement(LineObj);
......
......@@ -184,7 +184,6 @@ var
items: TJSObject;
begin
Logger.Log(3, 'Generated SQL for Prepare Report: ' + SQL);
//SQL := 'select * from corrugated_plate_orders where ORDER_ID = 18381';
doQuery(uqOrderCorrugated, SQL);
if ( string( uqOrderCorrugated.FieldByName('colors_colors').AsString ) ) <> '' then
......@@ -212,6 +211,7 @@ begin
ForceDirectories(ReportDir);
Logger.Log(5, 'Reports directory created: ' + ReportDir);
end;
reportURL := 'reports/' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf';
ReportFileName := reportDir + reportUrl;
......
......@@ -47,6 +47,75 @@ object rptOrderCutting: TrptOrderCutting
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 = '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_quantity'
FieldType = fftString
end
item
FieldName = 'staff_fields_price'
FieldType = fftString
end
item
FieldName = 'staff_fields_invoice_to'
FieldType = fftString
Size = 128
end
item
FieldName = 'staff_fields_ship_to'
FieldType = fftString
Size = 128
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_quickbooks_item'
FieldType = fftString
Size = 45
end
item
FieldName = 'general_special_instructions'
FieldType = fftString
Size = 2048
end>
end
object frxOrderCutting: TfrxReport
Version = '2025.1.4'
......
......@@ -2,10 +2,10 @@
MemoLogLevel=3
FileLogLevel=5
webClientVersion=0.9.7
LogFileNum=873
LogFileNum=926
[Database]
Server=192.168.159.158
Server=192.168.159.155
--Server=192.168.102.130
--Server=192.168.75.133
Database=kg_order_entry
......@@ -17,8 +17,8 @@ Password=emsys01
CompanyID=9341454272655710
ClientID=ABgO14uvjh8XqLud7spQ8lkb98AUpcdA7HbyMJfCAtl65sQ5yy
ClientSecret=bQ06TRemHeAGFzVHRaTUvUoBU9jpU9itK6MOMgqN
RefreshToken=RT1-119-H0-176089178955akizxqky85tnrj9nnl
AccessToken=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwieC5vcmciOiJIMCJ9..nC8S1UW9Us5C-eV2R-Pz3Q.VQrMSJBJ_25MmQ0tiuGnhYhzDRhQhIOkV92ScgMb4ikGyYq4Br3QFT4AYA73WMEzD3uFLxKiCYdJ7I-B2L2q4u1YCg2n5vWLfmljecOvN64DVQNTksUFC71_9pUFtHL0VlqmV-p2RN2QDhnFjnGFa8CXRGW9K8njUWBrZdeJs4M2NRfbIJWdC2JnY2Fq3X5W26xc9cLXpY5BmijXEu8I7AK25NH7r2ZLdGrrh0aGmOj3JgnW68fYLaGONfBSgRcLyW69jDjM21DP1ujflaf9O2BGDb5LctGv-KgyZ-j9OVCMp7otPevN-o3DGL-Bdawmy_ZDN9L2USSSIXal4S3a6Q25_sOkoI7mp4R_onrsProjids8hzsUTSg7bfWOTu7elG_Hjie2cuZvH3eBsYMd8a-sAOo6hZrECUhHFjpULsRiGRIMLCU3nAOHlGP_IFxgIczYGDx27i54CZhvYgLZR7XBnhlpWMLIntogrU50FSw.4pHLJDZLlpzFGjk-oRqTtQ
LastRefresh=7/11/2025 11:51:34 AM
RefreshToken=RT1-44-H0-1762010333a3v07cb5eb0luyn2rppm
AccessToken=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwieC5vcmciOiJIMCJ9..7T78YBCSmvuJPRsZ9lGwuQ.1VJssLuNBAPKI7RAJOPluhtlA8DYgNcmXebNkWSxrHJ1949vjY4SPt5JjruuLsNOV09i_xKrQ76w9Zhjom1MiQaSyNoZHU-CZLfOtWgr9r3-gLxizdTlrTs9cEZs__8ep4_oe2r3n2u34QlM0xdVdLWxQbKYjpCl0k_58XPbS5Z_Vo2Y5qqoAuGJIRxMaTueMOH1ut-bV4Em318Ca1jN2DFCh_NYjLwFQQenWxOrCRMBaj7ZgB2yjtS5mEUxhuxsB7FAeONYqBSJ0OAy1yzWE-Ycxzt4dcZBCTHxzUCTH0-P0Mb_M6ivfmiYyKctf2gsZD8Xw91MgnF9TPwG8yXdej05fWr94VWeC3tFp0V-RYYv3_XRuim6fCvxJjWzfVEZwv9jUiZ6WByNSzu1k1W5_rQuSG7_Hs8WiDC1sBChJLfDclLO8pMoznqpSrM8ZmiNoYm4aZPQrpO6rgY8NiTokZRyeTw2adtW1YgDJsZdoEw.i2MSpKztX0v6UN0vZz5gQg
LastRefresh=7/23/2025 11:18:54 AM
--RefreshToken=RT1-10-H0-1760618473k44t73jittvqlr4wynn6
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