Commit a72bb77e by Mac Stephens

Merge remote-tracking branch 'origin/cam2'

main code merged in lookupimpl in get corrugated orders
parents 37788721 5b01b1ab
......@@ -3,8 +3,8 @@ object FAddOrder: TFAddOrder
Height = 477
OnShow = WebFormShow
object WebLabel1: TWebLabel
Left = 278
Top = 44
Left = 334
Top = 56
Width = 35
Height = 15
Caption = 'Search'
......@@ -12,8 +12,8 @@ object FAddOrder: TFAddOrder
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 414
Top = 44
Left = 482
Top = 56
Width = 58
Height = 15
Caption = 'Selected ID'
......@@ -21,8 +21,8 @@ object FAddOrder: TFAddOrder
WidthPercent = 100.000000000000000000
end
object edtSearch: TWebEdit
Left = 278
Top = 62
Left = 334
Top = 82
Width = 121
Height = 22
HeightPercent = 100.000000000000000000
......@@ -30,8 +30,8 @@ object FAddOrder: TFAddOrder
OnChange = edtSearchChange
end
object edtID: TWebEdit
Left = 414
Top = 62
Left = 482
Top = 82
Width = 69
Height = 22
ChildOrder = 1
......@@ -196,8 +196,8 @@ object FAddOrder: TFAddOrder
DesignTimeSampleData = True
end
object cbCorrugatedPlate: TWebCheckBox
Left = 26
Top = 63
Left = 4
Top = 83
Width = 113
Height = 22
Caption = 'Corrugated Plate'
......@@ -207,8 +207,8 @@ object FAddOrder: TFAddOrder
OnClick = cbCorrugatedPlateClick
end
object cbWebPlate: TWebCheckBox
Left = 152
Top = 64
Left = 128
Top = 83
Width = 83
Height = 22
Caption = 'Web Plate'
......@@ -218,8 +218,8 @@ object FAddOrder: TFAddOrder
OnClick = cbWebPlateClick
end
object btnCancel: TWebButton
Left = 674
Top = 61
Left = 680
Top = 81
Width = 96
Height = 25
Caption = 'Cancel'
......@@ -229,8 +229,8 @@ object FAddOrder: TFAddOrder
OnClick = btnCancelClick
end
object btnConfirm: TWebButton
Left = 554
Top = 61
Left = 564
Top = 81
Width = 96
Height = 25
Caption = 'Confirm'
......@@ -239,15 +239,48 @@ object FAddOrder: TFAddOrder
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object cbCuttingDie: TWebCheckBox
Left = 231
Top = 83
Width = 83
Height = 22
Caption = 'Cutting Die'
ChildOrder = 3
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = cbCuttingDieClick
end
object edtNotification: TWebEdit
Left = 4
Top = 16
Width = 510
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 730
Top = 93
Left = 780
Top = 21
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 600
Top = 95
Left = 726
Top = 7
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
......@@ -264,7 +297,7 @@ object FAddOrder: TFAddOrder
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 468
Top = 93
Left = 660
Top = 1
end
end
// Pop-Up menu that appears when Add Order button is clicked on orders page.
// Used to select customer before entering an order.
unit View.AddOrder;
interface
......@@ -29,6 +31,8 @@ type
xdwdsCustomersSHORT_NAME: TStringField;
wdsCustomers: TWebDataSource;
xdwdsCustomersADDRESS: TStringField;
cbCuttingDie: TWebCheckBox;
edtNotification: TWebEdit;
procedure WebFormShow(Sender: TObject);
procedure TMSFNCGrid1SelectedCell(Sender: TObject; ACol, ARow: Integer);
procedure edtSearchChange(Sender: TObject);
......@@ -36,6 +40,7 @@ type
procedure cbWebPlateClick(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure cbCuttingDieClick(Sender: TObject);
private
[async] procedure getCustomers;
procedure PopulateGridManually;
......@@ -56,14 +61,20 @@ implementation
procedure TFAddOrder.btnCancelClick(Sender: TObject);
begin
edtID.Text := '';
Close;
end;
procedure TFAddOrder.btnConfirmClick(Sender: TObject);
begin
confirm := true;
Close;
if ( ( not cbCorrugatedPlate.Checked ) and ( not cbWebPlate.Checked ) and ( not cbCuttingDie.Checked ) ) then
edtNotification.Text := 'Please Select an Order Type'
else if edtID.Text = '' then
edtNotification.Text := 'Please Select a Customer'
else
begin
confirm := true;
Close;
end;
end;
procedure TFAddOrder.WebFormShow(Sender: TObject);
......@@ -75,12 +86,20 @@ end;
procedure TFAddOrder.cbCorrugatedPlateClick(Sender: TObject);
begin
cbWebPlate.Checked := False;
cbWebPlate.Checked := False;
cbCuttingDie.Checked := False;
end;
procedure TFAddOrder.cbCuttingDieClick(Sender: TObject);
begin
cbCorrugatedPlate.Checked := False;
cbWebPlate.Checked := False;
end;
procedure TFAddOrder.cbWebPlateClick(Sender: TObject);
begin
cbCorrugatedPlate.Checked := False;
cbCuttingDie.Checked := False;
end;
procedure TFAddOrder.edtSearchChange(Sender: TObject);
......@@ -89,6 +108,7 @@ begin
end;
[async] procedure TFAddOrder.getCustomers();
// retrieves customer list from server
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
......@@ -107,6 +127,7 @@ begin
end;
procedure TFAddOrder.PopulateGridManually;
// populates the grid with customers manually.
var
RowIndex: Integer;
begin
......@@ -122,10 +143,6 @@ begin
TMSFNCGrid1.Cells[2, 0] := 'Name';
TMSFNCGrid1.Cells[3, 0] := 'Address';
// TMSFNCGrid1.ColumnWidths[0] := 40;
// TMSFNCGrid1.ColumnWidths[1] := 80;
// TMSFNCGrid1.ColumnWidths[2] := 250;
// Populate the grid with data from the dataset
xdwdsCustomers.First;
RowIndex := 1;
......@@ -152,11 +169,13 @@ end;
procedure TFAddOrder.TMSFNCGrid1SelectedCell(Sender: TObject; ACol,
ARow: Integer);
// When a cell is clicked it puts the ID in the text box
begin
edtID.Text := TMSFNCGrid1.Cells[0, ARow];
end;
procedure TFAddOrder.ApplyFilter;
// filters the grid based on search textbox contents.
var
fd: TTMSFNCGridFilterData;
i: Integer;
......
......@@ -26,7 +26,6 @@ type
cbStatus: TWebCheckBox;
procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
procedure wcbPageSizeChange(Sender: TObject);
private
FChildForm: TWebForm;
......@@ -34,7 +33,6 @@ type
procedure ClearTable();
procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string;
[async] procedure Search(searchOptions: string);
[async] procedure GetItems(searchOptions: string);
[async] procedure getUser();
[async] procedure AddItem(itemOptions: string);
......@@ -86,11 +84,10 @@ end;
procedure TFViewItems.AddRowToTable(ID, Name, Description, Status: string);
// Adds rows to the table
// PhoneNumber: phone number of the location
// Caller: phone number of the caller
// Duration: duration of the call
// Transcript: transcription of the recording
// MediaUrl: Link to the recording
// ID: item ID
// Name: item name
// Description: item description
// Status: inactive or active
var
NewRow, Cell, P, Button, Audio: TJSHTMLElement;
begin
......@@ -293,6 +290,9 @@ begin
end;
procedure TFViewItems.GetItems(searchOptions: string);
// retrieves items from the server.
// searchOptions: info to limit how many items we retrieve from the server.
// probably not needed due to database size.
var
xdcResponse: TXDataClientResponse;
itemList : TJSObject;
......@@ -355,6 +355,7 @@ begin
end;
procedure TFViewItems.AddItem(itemOptions: string);
// adds an item to the database.
var
xdcResponse: TXDataClientResponse;
begin
......@@ -363,48 +364,13 @@ begin
getItems(GenerateSearchOptions());
end;
procedure TFViewItems.Search(searchOptions: string);
// Search method that searches the database for a specific phone number
var
xdcResponse: TXDataClientResponse;
callList : TJSObject;
i: integer;
data: TJSArray;
call: TJSObject;
callListLength: integer;
begin
{if PageNumber > 0 then
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.Search',
[searchOptions]));
callList := TJSObject(xdcResponse.Result);
data := TJSArray(callList['data']);
callListLength := integer(callList['count']);
ClearTable();
for i := 0 to data.Length - 1 do
begin
call := TJSObject(data[i]);
AddRowToTable(string(call['toNumber']), string(call['fromNumber']), string(call['dateCreated']),
string(call['duration']), string(call['transcription']), string(call['mediaUrl']));
end;
TotalPages := (callListLength + PageSize - 1) div PageSize;
lblEntries.Caption := 'Showing entries for phone number: ' + searchOptions;
end; }
end;
procedure TFViewItems.wcbPageSizeChange(Sender: TObject);
// gets a new amount of items based when the page size is changed
begin
PageNumber := 1;
getItems(GenerateSearchOptions());
end;
procedure TFViewItems.btnSearchClick(Sender: TObject);
// item Search method
begin
//Search(edtSearch.Text);
end;
procedure TFViewItems.ClearTable();
// clears the table
var
......
......@@ -51,7 +51,9 @@ type
procedure ShowForm( AFormClass: TWebFormClass );
procedure EditUser( Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string);
procedure ViewOrderEntry(orderInfo, customerInfo, mode: string);
procedure ViewOrderEntryCorrugated(orderInfo, customerInfo, mode: string);
procedure ViewOrderEntryWeb(orderInfo, customerInfo, mode: string);
procedure ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode: string);
procedure ViewOrders(info: string);
procedure ShowUserForm(Info: string);
end;
......@@ -70,7 +72,9 @@ uses
View.Users,
View.EditUser,
View.Orders,
View.OrderEntryCorrugated;
View.OrderEntryCorrugated,
View.OrderEntryCuttingDie,
View.OrderEntryWeb;
{$R *.dfm}
......@@ -227,12 +231,28 @@ begin
end;
procedure TFViewMain.ViewOrderEntry(orderInfo, customerInfo, mode: string);
procedure TFViewMain.ViewOrderEntryCorrugated(orderInfo, customerInfo, mode: string);
begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFOrderEntry.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode);
FChildForm := TFOrderEntryCorrugated.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode);
end;
procedure TFViewMain.ViewOrderEntryWeb(orderInfo, customerInfo, mode: string);
begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFOrderEntryWeb.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode);
end;
procedure TFViewMain.ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode: string);
begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFOrderEntryCuttingDie.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode);
end;
procedure TFViewMain.ShowUserForm(Info: string);
......
object FOrderEntry: TFOrderEntry
object FOrderEntryCorrugated: TFOrderEntryCorrugated
Width = 1018
Height = 764
Font.Charset = ANSI_CHARSET
......@@ -354,19 +354,6 @@ object FOrderEntry: TFOrderEntry
DataField = 'staff_fields_job_name'
DataSource = WebDataSource1
end
object edtQuickBooksItem: TWebDBEdit
Left = 26
Top = 514
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtquickbooksitem'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_quickbooks_item'
DataSource = WebDataSource1
end
object edtOther: TWebDBEdit
Left = 316
Top = 348
......@@ -692,32 +679,6 @@ object FOrderEntry: TFOrderEntry
DataField = 'plates_job_number'
DataSource = WebDataSource1
end
object edtPlateMaterial: TWebDBEdit
Left = 852
Top = 72
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtplatematerial'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plates_plate_material'
DataSource = WebDataSource1
end
object edtThickness: TWebDBEdit
Left = 852
Top = 39
Width = 121
Height = 22
AutoSize = True
ChildOrder = 79
ElementID = 'edtThickness'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plates_thickness'
DataSource = WebDataSource1
end
object cbArtApprovedAsIs: TWebDBCheckBox
Left = 662
Top = 480
......@@ -797,8 +758,8 @@ object FOrderEntry: TFOrderEntry
DataSource = WebDataSource1
end
object btnConfirm: TWebButton
Left = 752
Top = 558
Left = 652
Top = 560
Width = 96
Height = 25
Caption = 'Confirm'
......@@ -965,10 +926,80 @@ object FOrderEntry: TFOrderEntry
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnEdit: TWebButton
Left = 870
Top = 560
Width = 96
Height = 25
Caption = 'Edit'
ChildOrder = 79
ElementID = 'btnedit'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCancel: TWebButton
Left = 764
Top = 560
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 79
ElementID = 'btncancel'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object WebDBComboBox2: TWebDBComboBox
Left = 26
Top = 515
Width = 145
Height = 22
ElementID = 'wcbqbitem'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
DataField = 'staff_fields_quickbooks_item'
DataSource = WebDataSource1
ListField = 'name'
ListSource = wdsQBItem
end
object WebDBComboBox3: TWebDBComboBox
Left = 833
Top = 77
Width = 145
Height = 22
ElementID = 'wcbmaterial'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'PhotoPolymer'
'Rubber')
DataField = 'plates_plate_material'
DataSource = WebDataSource1
end
object WebDBComboBox4: TWebDBComboBox
Left = 833
Top = 48
Width = 145
Height = 22
ElementID = 'wcbthickness'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'.250'
'.155'
'.107'
'.067'
'.045')
DataField = 'plates_thickness'
DataSource = WebDataSource1
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 244
Top = 44
Left = 160
Top = 18
end
object tmrScrollTop: TWebTimer
Interval = 100
......@@ -978,8 +1009,8 @@ object FOrderEntry: TFOrderEntry
end
object XDataWebDataSet1: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 324
Top = 104
Left = 90
Top = 20
object XDataWebDataSet1ORDER_ID: TIntegerField
FieldName = 'ORDER_ID'
end
......@@ -1256,8 +1287,8 @@ object FOrderEntry: TFOrderEntry
end
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
Left = 216
Top = 104
Left = 22
Top = 10
end
object wdsShipTo: TWebDataSource
DataSet = xdwdsShipTo
......@@ -1265,10 +1296,22 @@ object FOrderEntry: TFOrderEntry
Top = 436
end
object xdwdsShipTo: TXDataWebDataSet
Left = 192
Top = 486
Left = 202
Top = 416
object xdwdsShipToADDRESS: TStringField
FieldName = 'ADDRESS'
end
end
object wdsQBItem: TWebDataSource
DataSet = xdwdsQBItem
Left = 240
Top = 518
end
object xdwdsQBItem: TXDataWebDataSet
Left = 200
Top = 512
object xdwdsQBItemname: TStringField
FieldName = 'name'
end
end
end
......@@ -68,7 +68,7 @@
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QuickBooks Item:</label>
<input id="edtquickbooksitem" class="form-control input-sm" width='50%'/>
<select id="wcbqbitem" class='form-select'></select>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Art Due:</label>
......@@ -278,15 +278,15 @@
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;" id="lblthickness">Thickness:</label>
<input id="edtThickness" class="form-control input-sm" style="width: 150px"/>
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Thickness:</label>
<select id="wcbthickness" class='form-select'></select>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;" id="lblplatematerial">Plate Material:</label>
<input id="edtplatematerial" class="form-control input-sm" style="width: 150px"/>
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Plate Material:</label>
<select id="wcbmaterial" class='form-select'></select>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;" id="lbljobnumber">Job Number:</label>
<label class="form-label mt-2" style="font-weight: 700; font-size: 15px;" id="lbljobnumber">Job Number:</label>
<input id="edtjobnumber" class="form-control input-sm" style="width: 150px"/>
</div>
</div>
......@@ -300,7 +300,13 @@
</div>
<div class="row">
<div class="col-auto">
<button id="btnconfirm" class="btn btn-primary btn-sm float-end">Confirm</button>
<button id="btnconfirm" class="btn btn-primary btn-sm float-end my-2">Confirm</button>
</div>
<div class="col-auto">
<button id="btncancel" class="btn btn-primary btn-sm float-end my-2">Cancel</button>
</div>
<div class="col-auto">
<button id="btnedit" class="btn btn-primary btn-sm float-end my-2">Edit</button>
</div>
</div>
</div>
......
// Order Entry page of Corruguated Orders. Used for both editting and adding
// orders.
unit View.OrderEntryCorrugated;
interface
......@@ -10,7 +12,7 @@ uses
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB;
type
TFOrderEntry = class(TWebForm)
TFOrderEntryCorrugated = class(TWebForm)
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
......@@ -40,7 +42,6 @@ type
edtInvoiceTo: TWebDBEdit;
edtPONumber: TWebDBEdit;
edtJobName: TWebDBEdit;
edtQuickBooksItem: TWebDBEdit;
edtOther: TWebDBEdit;
edtCADFile: TWebDBEdit;
edtAroundNo: TWebDBEdit;
......@@ -66,8 +67,6 @@ type
edtMachineIndent: TWebDBEdit;
edtCylinderSize: TWebDBEdit;
edtJobNumber: TWebDBEdit;
edtPlateMaterial: TWebDBEdit;
edtThickness: TWebDBEdit;
cbArtApprovedAsIs: TWebDBCheckBox;
cbPDFFile: TWebDBCheckBox;
cbWideFormat: TWebDBCheckBox;
......@@ -187,6 +186,14 @@ type
WebDBComboBox1: TWebDBComboBox;
cbEmail: TWebCheckBox;
XDataWebDataSet1supplied_by_customer_order_date: TStringField;
btnEdit: TWebButton;
btnCancel: TWebButton;
WebDBComboBox2: TWebDBComboBox;
wdsQBItem: TWebDataSource;
xdwdsQBItem: TXDataWebDataSet;
xdwdsQBItemname: TStringField;
WebDBComboBox3: TWebDBComboBox;
WebDBComboBox4: TWebDBComboBox;
procedure WebFormCreate(Sender: TObject);
procedure HideNotification();
procedure ShowNotification(Notification: string);
......@@ -198,6 +205,7 @@ type
procedure addColorRow(num, Color, LPI, Size: string);
procedure btnConfirmClick(Sender: TObject);
[async] procedure AddCorrugatedOrder(orderJSON: TJSONObject);
procedure btnCancelClick(Sender: TObject);
private
FAgencyCode: string;
FCurrentReportType: string;
......@@ -211,7 +219,7 @@ type
end;
var
FOrderEntry: TFOrderEntry;
FOrderEntryCorrugated: TFOrderEntryCorrugated;
implementation
......@@ -220,7 +228,8 @@ implementation
uses
View.Home, View.Main;
procedure TFOrderEntry.btnConfirmClick(Sender: TObject);
procedure TFOrderEntryCorrugated.btnConfirmClick(Sender: TObject);
// Converts all the information on the page into a JSON to then send to the server
var
colorList: TJSONArray;
container: TJSElement;
......@@ -263,8 +272,8 @@ begin
XDataWebDataSet1staff_fields_art_due.Value := DateTimeToStr(dtpArtDue.Date);
XDataWebDataSet1staff_fields_mount_due.Value := DateTimeToStr(dtpMountDue.Date);
XDataWebDataSet1staff_fields_plate_due.Value := DateTimeToStr(dtpPlateDue.Date);
XDataWebDataSet1supplied_by_customer_order_date.Value := DateTimeToStr(dtpOrderDate.Date);
XDataWebDataSet1proofing_approved_date.Value := DateTimeToStr(dtpOrderDate.Date);
XDataWebDataSet1staff_fields_order_date.Value := DateTimeToStr(dtpOrderDate.Date);
XDataWebDataSet1proofing_approved_date.Value := DateTimeToStr(dtpApprovedDate.Date);
// Convert all check boxes to strings because the database stores them as strings
if cbFTP.Checked then
......@@ -349,15 +358,16 @@ begin
XDataWebDataSet1.Next;
end;
orderJSON.AddPair('COMPANY_ID', customerID);
orderJSON.AddPair('USER_ID', '1011');
orderJSON.AddPair('USER_ID', JS.toString(AuthService.TokenPayload.Properties['user_id']));
orderJSON.AddPair('mode', mode);
if mode = 'EDIT' then
orderJSON.AddPair('ORDER_ID', orderID);
AddCorrugatedOrder(orderJSON);
FViewMain.ViewOrders('Success');
FViewMain.ViewOrders('Success:Order Successfully Added');
end;
procedure TFOrderEntry.AddCorrugatedOrder(orderJSON: TJSONObject);
procedure TFOrderEntryCorrugated.AddCorrugatedOrder(orderJSON: TJSONObject);
// sends the order JSON object to the server
var
Response: TXDataClientResponse;
begin
......@@ -365,27 +375,30 @@ begin
[orderJSON.ToString]));
end;
class function TFOrderEntry.CreateForm(AElementID, orderInfo, customerInfo, mode: string): TWebForm;
class function TFOrderEntryCorrugated.CreateForm(AElementID, orderInfo, customerInfo, mode: string): TWebForm;
var
localMode: string;
begin
localMode := mode;
Application.CreateForm(TFOrderEntry, AElementID, Result,
Application.CreateForm(TFOrderEntryCorrugated, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderEntry(AForm) do
with TFOrderEntryCorrugated(AForm) do
begin
HideNotification;
TFOrderEntry(AForm).customerID := customerInfo;
TFOrderEntry(AForm).orderID := orderInfo;
TFOrderEntry(AForm).mode := localMode;
TFOrderEntryCorrugated(AForm).customerID := customerInfo;
TFOrderEntryCorrugated(AForm).orderID := orderInfo;
TFOrderEntryCorrugated(AForm).mode := localMode;
end;
end
);
end;
procedure TFOrderEntry.addColorRow(num: string; Color: string; LPI: string; Size: string);
procedure TFOrderEntryCorrugated.addColorRow(num: string; Color: string; LPI: string; Size: string);
// Java script code to add a row of colors when a button is clicked
// all variables are information to be placed in the boxes when loading an order.
// TODO: convert to Delphi
begin
asm
const container = document.getElementById('additionalFields');
......@@ -435,12 +448,17 @@ begin
end;
end;
procedure TFOrderEntry.WebButton1Click(Sender: TObject);
procedure TFOrderEntryCorrugated.WebButton1Click(Sender: TObject);
begin
addColorRow('','','','');
end;
procedure TFOrderEntry.WebFormCreate(Sender: TObject);
procedure TFOrderEntryCorrugated.btnCancelClick(Sender: TObject);
begin
FViewMain.ViewOrders('');
end;
procedure TFOrderEntryCorrugated.WebFormCreate(Sender: TObject);
begin
if not DMConnection.ApiConnection.Connected then
begin
......@@ -449,7 +467,8 @@ begin
end;
end;
procedure TFOrderEntry.getOrder(Order_ID: string);
procedure TFOrderEntryCorrugated.getOrder(Order_ID: string);
// retrieves an order from the server then loads the info into the page
var
xdcResponse: TXDataClientResponse;
orderList : TJSObject;
......@@ -464,6 +483,7 @@ var
color: TJSObject;
colorJSON: TJSONObject;
colorListJSON: TJSONArray;
items: TJSObject;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetOrder',
[Order_ID]));
......@@ -534,13 +554,9 @@ begin
else
cbColorCopy.checked := false;
console.log(XDataWebDataSet1supplied_by_customer_ftp.AsString);
if XDataWebDataSet1supplied_by_customer_ftp.AsString <> '' then
begin
console.log('hit');
cbFTP.Checked := true;
console.log(cbFTP.Checked);
end
else
cbFTP.Checked := false;
......@@ -589,11 +605,23 @@ begin
else
cbStripMount.Checked := false;
if mode = 'EDIT' then
begin
CustomerID := XDataWebDataSet1COMPANY_ID.AsString;
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(order['ADDRESS_LIST']);
xdwdsShipTo.Open;
end;
xdwdsQBItem.Close;
items := TJSObject(order['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open;
end;
procedure TFOrderEntry.getCustomer(customerID: string);
procedure TFOrderEntryCorrugated.getCustomer(customerID: string);
// gets a customer from the database then loads the appropiate fields
var
xdcResponse: TXDataClientResponse;
customer : TJSObject;
......@@ -606,13 +634,15 @@ begin
XDataWebDataSet1.SetJsonData(customer);
XDataWebDataSet1.Open;
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(customer['ADDRESS_LIST']);
xdwdsShipTo.Open;
end;
procedure TFOrderEntry.WebFormShow(Sender: TObject);
procedure TFOrderEntryCorrugated.WebFormShow(Sender: TObject);
begin
if mode <> 'ADD' then
getOrder(orderID)
......@@ -621,12 +651,12 @@ begin
HideNotification();
end;
procedure TFOrderEntry.HideNotification;
procedure TFOrderEntryCorrugated.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFOrderEntry.ShowNotification(Notification: string);
procedure TFOrderEntryCorrugated.ShowNotification(Notification: string);
begin
if Notification <> '' then
begin
......@@ -636,14 +666,14 @@ begin
end;
procedure TFOrderEntry.tmrScrollTopTimer(Sender: TObject);
procedure TFOrderEntryCorrugated.tmrScrollTopTimer(Sender: TObject);
begin
tmrScrollTop.Enabled := False;
window.scrollTo(0, 0);
end;
initialization
RegisterClass(TFOrderEntry);
RegisterClass(TFOrderEntryCorrugated);
end.
object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Width = 956
Height = 728
OnShow = WebFormShow
object WebLabel2: TWebLabel
Left = 26
Top = 72
Width = 52
Height = 15
Caption = 'Company'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel1: TWebLabel
Left = 34
Top = 188
Width = 57
Height = 15
Caption = 'Staff Fields'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel9: TWebLabel
Left = 862
Top = 147
Width = 40
Height = 15
Caption = 'General'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object edtCompanyAccountName: TWebDBEdit
Left = 24
Top = 120
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtaccountcompanyname'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'SHORT_NAME'
DataSource = WebDataSource1
end
object edtInQuickBooks: TWebDBEdit
Left = 26
Top = 148
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtinquickbooks'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'inQuickBooks'
DataSource = WebDataSource1
end
object dtpOrderDate: TWebDateTimePicker
Left = 22
Top = 218
Width = 170
Height = 22
ElementID = 'dtporderdate'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object dtpProofDate: TWebDateTimePicker
Left = 22
Top = 250
Width = 170
Height = 22
ElementID = 'dtpproofdate'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object dtpShipDate: TWebDateTimePicker
Left = 22
Top = 282
Width = 170
Height = 22
ElementID = 'dtpshipdate'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object edtShipVia: TWebDBEdit
Left = 24
Top = 314
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtshipvia'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_ship_via'
DataSource = WebDataSource1
end
object edtQuantity: TWebDBEdit
Left = 24
Top = 346
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtquantity'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_quantity'
DataSource = WebDataSource1
end
object edtPrice: TWebDBEdit
Left = 24
Top = 374
Width = 121
Height = 22
ChildOrder = 79
ElementID = 'edtprice'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_price'
DataSource = WebDataSource1
end
object edtInvoiceTo: TWebDBEdit
Left = 26
Top = 402
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtinvoiceto'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_invoice_to'
DataSource = WebDataSource1
end
object wdbcbShipTo: TWebDBComboBox
Left = 26
Top = 430
Width = 145
Height = 23
ElementID = 'wcbshipto'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
DataField = 'staff_fields_ship_to'
DataSource = WebDataSource1
ListField = 'ADDRESS'
ListSource = wdsShipTo
end
object edtPONumber: TWebDBEdit
Left = 26
Top = 458
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtponumber'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_po_number'
DataSource = WebDataSource1
end
object edtJobName: TWebDBEdit
Left = 26
Top = 486
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtjobname'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_job_name'
DataSource = WebDataSource1
end
object edtQuickBooksItem: TWebDBEdit
Left = 26
Top = 514
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtquickbooksitem'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_quickbooks_item'
DataSource = WebDataSource1
end
object edtSpecialInstructions: TWebDBEdit
Left = 835
Top = 185
Width = 121
Height = 23
AutoSize = True
ChildOrder = 78
ElementID = 'edtspecialinstructions'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'general_special_instructions'
DataSource = WebDataSource1
end
object btnConfirm: TWebButton
Left = 652
Top = 560
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 79
ElementID = 'btnconfirm'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object btnCancel: TWebButton
Left = 764
Top = 560
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 79
ElementID = 'btncancel'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object pnlMessage: TWebPanel
Left = 324
Top = 19
Width = 121
Height = 33
ElementID = 'pnl_message'
ChildOrder = 5
ElementPosition = epRelative
Role = 'alert'
TabOrder = 16
object lblMessage: TWebLabel
Left = 28
Top = 9
Width = 46
Height = 15
Caption = 'Message'
ElementID = 'view.login.message.label'
ElementPosition = epRelative
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementID = 'view.login.message.button'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
end
end
object edtCompanyName: TWebDBEdit
Left = 26
Top = 92
Width = 121
Height = 22
ChildOrder = 20
ElementID = 'edtcompanyname'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'NAME'
DataSource = WebDataSource1
end
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
Left = 22
Top = 10
end
object XDataWebDataSet1: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 90
Top = 20
object XDataWebDataSet1COMPANY_ID: TIntegerField
FieldName = 'COMPANY_ID'
end
object XDataWebDataSet1USER_ID: TIntegerField
FieldName = 'USER_ID'
end
object XDataWebDataSet1ORDER_DATE: TDateField
FieldName = 'ORDER_DATE'
end
object XDataWebDataSet1ORDER_STATUS: TStringField
FieldName = 'ORDER_STATUS'
end
object XDataWebDataSet1SHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object XDataWebDataSet1staff_fields_ship_via: TStringField
FieldName = 'staff_fields_ship_via'
end
object XDataWebDataSet1staff_fields_price: TStringField
FieldName = 'staff_fields_price'
end
object XDataWebDataSet1staff_fields_invoice_to: TStringField
FieldName = 'staff_fields_invoice_to'
end
object XDataWebDataSet1staff_fields_invoice_attention: TStringField
FieldName = 'staff_fields_invoice_attention'
end
object XDataWebDataSet1staff_fields_ship_to: TStringField
FieldName = 'staff_fields_ship_to'
end
object XDataWebDataSet1staff_fields_ship_attention: TStringField
FieldName = 'staff_fields_ship_attention'
end
object XDataWebDataSet1staff_fields_po_number: TStringField
FieldName = 'staff_fields_po_number'
end
object XDataWebDataSet1staff_fields_job_name: TStringField
FieldName = 'staff_fields_job_name'
end
object XDataWebDataSet1staff_fields_order_date: TStringField
FieldName = 'staff_fields_order_date'
end
object XDataWebDataSet1staff_fields_proof_date: TStringField
FieldName = 'staff_fields_proof_date'
end
object XDataWebDataSet1staff_fields_ship_date: TStringField
FieldName = 'staff_fields_ship_date'
end
object XDataWebDataSet1ORDER_ID: TStringField
FieldName = 'ORDER_ID'
end
object XDataWebDataSet1NAME: TStringField
FieldName = 'NAME'
end
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 160
Top = 18
end
object tmrScrollTop: TWebTimer
Interval = 100
OnTimer = tmrScrollTopTimer
Left = 240
Top = 8
end
object wdsShipTo: TWebDataSource
DataSet = xdwdsShipTo
Left = 212
Top = 436
end
object xdwdsShipTo: TXDataWebDataSet
Left = 192
Top = 486
object xdwdsShipToADDRESS: TStringField
FieldName = 'ADDRESS'
end
end
end
<div class="col-12 col-md-8">
<div class="row">
<div class=col-sm>
<div id="pnl_message" class="alert alert-danger">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
</div>
</div>
<h4 class="custom-h4 mt-3">Company</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Company Name:</label>
<input id="edtcompanyname" type="text" class="form-control" style="width: 300px;"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Account Company Name:</label>
<input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">In Quickbooks?:</label>
<input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/>
</div>
</div>
<h4 class="custom-h4 mt-3">Staff Fields</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Order Date:</label>
<input class="form-control input-sm" id="dtporderdate" type="date">
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Proof Date:</label>
<input class="form-control input-sm" id="dtpproofdate" type="date">
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ship Date:</label>
<input class="form-control input-sm" id="dtpshipdate" type="date">
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ship Via:</label>
<input id="edtshipvia" type="text" class="form-control"/>
</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"/>
</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"/>
</div>
<div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Invoice To:</label>
<input id="edtinvoiceto" class="form-control input-sm"/>
</div>
<div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ship To:</label>
<select id="wcbshipto" class='form-select'></select>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PO Number:</label>
<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" width='50%'/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QuickBooks Item:</label>
<input id="edtquickbooksitem" class="form-control input-sm" width='50%'/>
</div>
</div>
<h4 class="custom-h4 mt-3">General</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label">Special Instructions</label>
<textarea id="edtspecialinstructions" class="form-control" style=" width: 500px; height: 150px;"></textarea>
</div>
</div>
<div class="row">
<div class="col-auto">
<button id="btnconfirm" class="btn btn-primary btn-sm float-end my-2">Confirm</button>
</div>
<div class="col-auto">
<button id="btncancel" class="btn btn-primary btn-sm float-end my-2">Cancel</button>
</div>
</div>
</div>
unit View.OrderEntryCuttingDie;
interface
uses
System.SysUtils, System.Generics.Collections, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB;
type
TFOrderEntryCuttingDie = class(TWebForm)
WebDataSource1: TWebDataSource;
XDataWebDataSet1: TXDataWebDataSet;
XDataWebDataSet1COMPANY_ID: TIntegerField;
XDataWebDataSet1USER_ID: TIntegerField;
XDataWebDataSet1ORDER_DATE: TDateField;
XDataWebDataSet1ORDER_STATUS: TStringField;
XDataWebDataSet1SHORT_NAME: TStringField;
XDataWebDataSet1staff_fields_ship_via: TStringField;
XDataWebDataSet1staff_fields_price: TStringField;
XDataWebDataSet1staff_fields_invoice_to: TStringField;
XDataWebDataSet1staff_fields_invoice_attention: TStringField;
XDataWebDataSet1staff_fields_ship_to: TStringField;
XDataWebDataSet1staff_fields_ship_attention: TStringField;
XDataWebDataSet1staff_fields_po_number: TStringField;
XDataWebDataSet1staff_fields_job_name: TStringField;
XDataWebDataSet1staff_fields_order_date: TStringField;
XDataWebDataSet1staff_fields_proof_date: TStringField;
XDataWebDataSet1staff_fields_ship_date: TStringField;
XDataWebClient1: TXDataWebClient;
tmrScrollTop: TWebTimer;
WebLabel2: TWebLabel;
edtCompanyAccountName: TWebDBEdit;
edtInQuickBooks: TWebDBEdit;
WebLabel1: TWebLabel;
dtpOrderDate: TWebDateTimePicker;
dtpProofDate: TWebDateTimePicker;
dtpShipDate: TWebDateTimePicker;
edtShipVia: TWebDBEdit;
edtQuantity: TWebDBEdit;
edtPrice: TWebDBEdit;
edtInvoiceTo: TWebDBEdit;
wdbcbShipTo: TWebDBComboBox;
edtPONumber: TWebDBEdit;
edtJobName: TWebDBEdit;
edtQuickBooksItem: TWebDBEdit;
wdsShipTo: TWebDataSource;
xdwdsShipTo: TXDataWebDataSet;
xdwdsShipToADDRESS: TStringField;
WebLabel9: TWebLabel;
edtSpecialInstructions: TWebDBEdit;
btnConfirm: TWebButton;
btnCancel: TWebButton;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
edtCompanyName: TWebDBEdit;
XDataWebDataSet1ORDER_ID: TStringField;
XDataWebDataSet1NAME: TStringField;
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure WebFormCreate(Sender: TObject);
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure WebFormShow(Sender: TObject);
[async] procedure GetCuttingDieOrder(Order_ID: string);
[async] procedure GetCustomer(customerID: string);
procedure tmrScrollTopTimer(Sender: TObject);
[async] procedure AddCuttingDieOrder(orderJSON: TJSONObject);
private
FAgencyCode: string;
FCurrentReportType: string;
FSelectProc: TSelectProc;
orderID: string;
customerID: string;
mode: string;
public
class function CreateForm(AElementID, orderInfo, customerInfo, mode: string): TWebForm;
end;
var
FOrderEntryCuttingDie: TFOrderEntryCuttingDie;
implementation
{$R *.dfm}
uses
View.Home, View.Main;
procedure TFOrderEntryCuttingDie.btnConfirmClick(Sender: TObject);
// Converts all the information on the page into a JSON to then send to the server
var
I, J: integer;
orderJSON: TJSONObject;
fieldNames: TStringList;
itemList: TJSNodeList;
header, value: string;
Field: TField;
Response: TXDataClientResponse;
begin
orderJSON := TJSONObject.Create;
XDataWebDataSet1.Edit;
//Convert all dates to strings because I was having less issues with that data type.
XDataWebDataSet1staff_fields_proof_date.Value := DateTimeToStr(dtpProofDate.Date);
XDataWebDataSet1staff_fields_ship_date.Value := DateTimeToStr(dtpShipDate.Date);
XDataWebDataSet1staff_fields_order_date.Value := DateTimeToStr(dtpOrderDate.Date);
XDataWebDataSet1.Post;
XDataWebDataSet1.First;
while not XDataWebDataSet1.Eof do
begin
for Field in XDataWebDataSet1.Fields do
begin
if Field is TStringField then
begin
if Field.AsString = '' then
orderJSON.AddPair(Field.FieldName, '')
else
orderJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields
end
else if Field is TBooleanField then
begin
if Field.AsBoolean then
orderJSON.AddPair(Field.FieldName, 'T')
else
orderJSON.AddPair(Field.FieldName, '');
end;
end;
XDataWebDataSet1.Next;
end;
orderJSON.AddPair('COMPANY_ID', customerID);
orderJSON.AddPair('USER_ID', '1011');
orderJSON.AddPair('mode', mode);
if mode = 'EDIT' then
orderJSON.AddPair('ORDER_ID', orderID);
AddCuttingDieOrder(orderJSON);
FViewMain.ViewOrders('Success');
end;
procedure TFOrderEntryCuttingDie.AddCuttingDieOrder(orderJSON: TJSONObject);
// sends the order JSON object to the server
var
Response: TXDataClientResponse;
begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCuttingDieOrder',
[orderJSON.ToString]));
end;
class function TFOrderEntryCuttingDie.CreateForm(AElementID, orderInfo, customerInfo, mode: string): TWebForm;
var
localMode: string;
begin
localMode := mode;
Application.CreateForm(TFOrderEntryCuttingDie, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderEntryCuttingDie(AForm) do
begin
HideNotification;
TFOrderEntryCuttingDie(AForm).customerID := customerInfo;
TFOrderEntryCuttingDie(AForm).orderID := orderInfo;
TFOrderEntryCuttingDie(AForm).mode := localMode;
end;
end
);
end;
procedure TFOrderEntryCuttingDie.btnCancelClick(Sender: TObject);
begin
FViewMain.ViewOrders('');
end;
procedure TFOrderEntryCuttingDie.WebFormCreate(Sender: TObject);
begin
if not DMConnection.ApiConnection.Connected then
begin
DMConnection.ApiConnection.OpenAsync;
console.log('report requirements connection open')
end;
end;
procedure TFOrderEntryCuttingDie.getCuttingDieOrder(Order_ID: string);
// retrieves an order from the server then loads the info into the page
var
xdcResponse: TXDataClientResponse;
orderList : TJSObject;
i: integer;
data: TJSArray;
order: TJSObject;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetOrder',
[Order_ID]));
order := TJSObject(xdcResponse.Result);
data := TJSArray(order['data']);
XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(order);
XDataWebDataSet1.Open;
// Check boxes and dates need to be manually set
if not (XDataWebDataSet1staff_fields_order_date.AsString = '') then
dtpOrderDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_order_date.Value)
else
dtpOrderDate.Date := 0;
if not (XDataWebDataSet1staff_fields_proof_date.AsString = '') then
dtpProofDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_proof_date.AsString)
else
dtpProofDate.Date := 0;
if not (XDataWebDataSet1staff_fields_ship_date.AsString = '') then
dtpShipDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_ship_date.AsString)
else
dtpShipDate.Date := 0;
console.log(mode);
console.log(XDataWebDataSet1COMPANY_ID.AsString);
if mode = 'EDIT' then
CustomerID := XDataWebDataSet1COMPANY_ID.AsString;
console.log(CustomerID);
end;
procedure TFOrderEntryCuttingDie.getCustomer(customerID: string);
// gets a customer from the database then loads the appropiate fields
var
xdcResponse: TXDataClientResponse;
customer : TJSObject;
address: string;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer',
[customerID]));
customer := TJSObject(xdcResponse.Result);
console.log(customer);
XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(customer);
XDataWebDataSet1.Open;
console.log(XDataWebDataSet1NAME.AsString);
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(customer['ADDRESS_LIST']);
xdwdsShipTo.Open;
end;
procedure TFOrderEntryCuttingDie.WebFormShow(Sender: TObject);
begin
if mode <> 'ADD' then
getCuttingDieOrder(orderID)
else
getCustomer(customerID);
HideNotification();
end;
procedure TFOrderEntryCuttingDie.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFOrderEntryCuttingDie.ShowNotification(Notification: string);
begin
if Notification <> '' then
begin
lblMessage.Caption := Notification;
pnlMessage.ElementHandle.hidden := False;
end;
end;
procedure TFOrderEntryCuttingDie.tmrScrollTopTimer(Sender: TObject);
begin
tmrScrollTop.Enabled := False;
window.scrollTo(0, 0);
end;
initialization
RegisterClass(TFOrderEntryCuttingDie);
end.
\ No newline at end of file
object FOrderEntryWeb: TFOrderEntryWeb
Width = 1015
Height = 628
OnShow = WebFormShow
object WebLabel2: TWebLabel
Left = 26
Top = 72
Width = 52
Height = 15
Caption = 'Company'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel1: TWebLabel
Left = 34
Top = 188
Width = 57
Height = 15
Caption = 'Staff Fields'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 276
Top = 193
Width = 117
Height = 15
Caption = 'Supplied By Customer'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel4: TWebLabel
Left = 444
Top = 72
Width = 46
Height = 15
Caption = 'Proofing'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel5: TWebLabel
Left = 634
Top = 8
Width = 111
Height = 15
Caption = 'Color and Qty Colors'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel6: TWebLabel
Left = 634
Top = 118
Width = 61
Height = 15
Caption = 'Plate Marks'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel7: TWebLabel
Left = 634
Top = 387
Width = 88
Height = 15
Caption = 'Print Orientation'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel8: TWebLabel
Left = 782
Top = 8
Width = 36
Height = 15
Caption = 'Layout'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel9: TWebLabel
Left = 782
Top = 402
Width = 23
Height = 15
Caption = 'UPC'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel10: TWebLabel
Left = 634
Top = 437
Width = 26
Height = 15
Caption = 'Plate'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object WebLabel11: TWebLabel
Left = 276
Top = 139
Width = 40
Height = 15
Caption = 'General'
HeightPercent = 100.000000000000000000
Visible = False
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 324
Top = 19
Width = 121
Height = 33
ElementID = 'pnl_message'
ChildOrder = 5
ElementPosition = epRelative
Role = 'alert'
TabOrder = 0
object lblMessage: TWebLabel
Left = 28
Top = 9
Width = 46
Height = 15
Caption = 'Message'
ElementID = 'view.login.message.label'
ElementPosition = epRelative
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementID = 'view.login.message.button'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
end
end
object edtCompanyName: TWebDBEdit
Left = 24
Top = 92
Width = 260
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtcompanyname'
HeightPercent = 100.000000000000000000
MaxLength = 90
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
DataField = 'NAME'
DataSource = WebDataSource1
end
object edtCompanyAccountName: TWebDBEdit
Left = 24
Top = 120
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtaccountcompanyname'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'SHORT_NAME'
DataSource = WebDataSource1
end
object edtInQuickBooks: TWebDBEdit
Left = 26
Top = 148
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtinquickbooks'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'inQuickBooks'
DataSource = WebDataSource1
end
object dtpOrderDate: TWebDateTimePicker
Left = 22
Top = 218
Width = 170
Height = 22
ElementID = 'dtporderdate'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object dtpProofDate: TWebDateTimePicker
Left = 22
Top = 250
Width = 170
Height = 22
ElementID = 'dtpproofdate'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object dtpShipDate: TWebDateTimePicker
Left = 22
Top = 282
Width = 170
Height = 22
ElementID = 'dtpshipdate'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object dtpArtDue: TWebDateTimePicker
Left = 24
Top = 544
Width = 170
Height = 22
ElementID = 'dtpartdue'
BorderStyle = bsSingle
ChildOrder = 17
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object dtpPlateDue: TWebDateTimePicker
Left = 24
Top = 568
Width = 170
Height = 22
ElementID = 'dtpplatedue'
BorderStyle = bsSingle
ChildOrder = 17
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object edtShipVia: TWebDBEdit
Left = 24
Top = 314
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtshipvia'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_ship_via'
DataSource = WebDataSource1
end
object edtQuantity: TWebDBEdit
Left = 24
Top = 346
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtquantity'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_quantity'
DataSource = WebDataSource1
end
object edtPrice: TWebDBEdit
Left = 24
Top = 374
Width = 121
Height = 22
ChildOrder = 79
ElementID = 'edtprice'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_price'
DataSource = WebDataSource1
end
object edtInvoiceTo: TWebDBEdit
Left = 26
Top = 402
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtinvoiceto'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_invoice_to'
DataSource = WebDataSource1
end
object edtPONumber: TWebDBEdit
Left = 26
Top = 458
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtponumber'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_po_number'
DataSource = WebDataSource1
end
object edtJobName: TWebDBEdit
Left = 26
Top = 486
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtjobname'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_job_name'
DataSource = WebDataSource1
end
object WebDBComboBox1: TWebDBComboBox
Left = 26
Top = 430
Width = 145
Height = 23
ElementID = 'wcbshipto'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
DataField = 'staff_fields_ship_to'
DataSource = WebDataSource1
ListField = 'ADDRESS'
ListSource = wdsShipTo
end
object edtBWorColorCopy: TWebDBEdit
Left = 276
Top = 214
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtbworcolorcopy'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_b_w_or_co'
DataSource = WebDataSource1
end
object edtPlates: TWebDBEdit
Left = 276
Top = 243
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtplates'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_plates'
DataSource = WebDataSource1
end
object edtDimensionalLayout: TWebDBEdit
Left = 276
Top = 314
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtdimensionallayout'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_dimension'
DataSource = WebDataSource1
end
object edtSample: TWebDBEdit
Left = 276
Top = 281
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtsample'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_sample'
DataSource = WebDataSource1
end
object edtOther: TWebDBEdit
Left = 276
Top = 346
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtother'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_other'
DataSource = WebDataSource1
end
object edtEmail: TWebDBEdit
Left = 276
Top = 379
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtemail'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_e_mail'
DataSource = WebDataSource1
end
object edtTotalInchesUsed: TWebDBEdit
Left = 276
Top = 442
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edttotalinchesused'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_total_inc'
DataSource = WebDataSource1
end
object edtFTP: TWebDBEdit
Left = 276
Top = 408
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtftp'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_ftp'
DataSource = WebDataSource1
end
object edtSheetsUsed: TWebDBEdit
Left = 276
Top = 471
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtsheetsused'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_sheets_us'
DataSource = WebDataSource1
end
object edtInitials: TWebDBEdit
Left = 276
Top = 504
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtinitials'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_initials'
DataSource = WebDataSource1
end
object cbPDF: TWebDBCheckBox
Left = 444
Top = 96
Width = 113
Height = 22
Caption = 'PDF'
ChildOrder = 79
ElementID = 'cbpdf'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_pdf'
DataSource = WebDataSource1
end
object edtPDFTo: TWebDBEdit
Left = 444
Top = 128
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtpdfto'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_pdf_to'
DataSource = WebDataSource1
end
object dtpPDFDate1: TWebDateTimePicker
Left = 444
Top = 157
Width = 170
Height = 22
ElementID = 'dtppdfdate1'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object dtpPDFDate3: TWebDateTimePicker
Left = 444
Top = 206
Width = 170
Height = 22
ElementID = 'dtppdfdate3'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object dtpPDFDate2: TWebDateTimePicker
Left = 444
Top = 181
Width = 170
Height = 22
ElementID = 'dtppdfdate2'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object cbInkJet: TWebDBCheckBox
Left = 444
Top = 238
Width = 113
Height = 22
Caption = 'Full Size Ink Jet For Layout Content Only'
ChildOrder = 79
ElementID = 'cbfullsizeinkjet'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_full_size_ink_jet_for'
DataSource = WebDataSource1
end
object edtInkJetTo2: TWebDBEdit
Left = 444
Top = 295
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtinkjetto2'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_ink_jet_to_2'
DataSource = WebDataSource1
end
object edtInkJetTo1: TWebDBEdit
Left = 444
Top = 266
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtinkjetto'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_ink_jet_to'
DataSource = WebDataSource1
end
object dtpInkJetDate1: TWebDateTimePicker
Left = 444
Top = 329
Width = 170
Height = 22
ElementID = 'dtpinkjetdate1'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object dtpInkJetDate3: TWebDateTimePicker
Left = 444
Top = 378
Width = 170
Height = 22
ElementID = 'dtpinkjetdate3'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object dtpInkJetDate2: TWebDateTimePicker
Left = 444
Top = 353
Width = 170
Height = 22
ElementID = 'dtpinkjetdate2'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object edtColorContrastTo: TWebDBEdit
Left = 444
Top = 435
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtcolorcontrastto'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_color_contrac_to'
DataSource = WebDataSource1
end
object dtpColorContractDate1: TWebDateTimePicker
Left = 444
Top = 464
Width = 170
Height = 22
ElementID = 'dtpcolorcontrastdate1'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object dtpColorContractDate2: TWebDateTimePicker
Left = 444
Top = 488
Width = 170
Height = 22
ElementID = 'dtpcolorcontrastdate2'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object edtDigitalColorTo: TWebDBEdit
Left = 444
Top = 545
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtdigitalcolorto'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_digital_color_to'
DataSource = WebDataSource1
end
object edtDigitalColorKey: TWebDBEdit
Left = 444
Top = 516
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtdigitalcolorkey'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'proofing_digital_color_key'
DataSource = WebDataSource1
end
object dtpDigitalColorDate: TWebDateTimePicker
Left = 444
Top = 578
Width = 170
Height = 22
ElementID = 'dtpdigitalcolordate'
BorderStyle = bsSingle
ChildOrder = 4
Color = clWhite
Date = 45638.529943136570000000
Role = ''
Text = ''
end
object edtAniloxInfo: TWebDBEdit
Left = 634
Top = 58
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtanilaxinfo'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'quantity_and_colors_anilox_info'
DataSource = WebDataSource1
end
object edtPressName: TWebDBEdit
Left = 634
Top = 29
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtpressname'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'quantity_and_colors_press_name'
DataSource = WebDataSource1
end
object WebButton1: TWebButton
Left = 634
Top = 87
Width = 96
Height = 25
Caption = '+'
ChildOrder = 59
ElementID = 'btnaddcolor'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = WebButton1Click
end
object edtMicroDots: TWebDBEdit
Left = 634
Top = 139
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtmicrodots'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plate_marks_microdots'
DataSource = WebDataSource1
end
object edtMicrodotsComments: TWebDBEdit
Left = 634
Top = 168
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtmicrodotscomments'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plate_marks_microdots_comments'
DataSource = WebDataSource1
end
object edtCrosshairsComments: TWebDBEdit
Left = 634
Top = 239
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtcrosshairscomments'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plate_marks_crosshairs_comments'
DataSource = WebDataSource1
end
object edtCrosshairs: TWebDBEdit
Left = 634
Top = 206
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtcrosshairs'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plate_marks_crosshairs'
DataSource = WebDataSource1
end
object edtColorBarsComments: TWebDBEdit
Left = 634
Top = 300
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtcolorbarscomments'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plate_marks_color_bars_comments'
DataSource = WebDataSource1
end
object edtColorBars: TWebDBEdit
Left = 634
Top = 271
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtcolorbars'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plate_marks_color_bars'
DataSource = WebDataSource1
end
object edtPlateOther: TWebDBEdit
Left = 634
Top = 329
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtplateother'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plate_marks_other'
DataSource = WebDataSource1
end
object edtPlateOtherComments: TWebDBEdit
Left = 634
Top = 358
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtplateothercomments'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plate_marks_other_comments'
DataSource = WebDataSource1
end
object edtAround: TWebDBEdit
Left = 782
Top = 29
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtaround'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_around'
DataSource = WebDataSource1
end
object edtAccross: TWebDBEdit
Left = 782
Top = 58
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtaccross'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_accross'
DataSource = WebDataSource1
end
object edtReversePrint: TWebDBEdit
Left = 782
Top = 129
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtreverseprint'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_reverse_print'
DataSource = WebDataSource1
end
object edtSurfacePrint: TWebDBEdit
Left = 782
Top = 96
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtsurfaceprint'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_surface_print'
DataSource = WebDataSource1
end
object edtCutoffDimension: TWebDBEdit
Left = 782
Top = 190
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtcutoffdimension'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_cutoff_dimension'
DataSource = WebDataSource1
end
object edtCylinderRepeat: TWebDBEdit
Left = 782
Top = 161
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtcylinderrepeat'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_cylinder_repeat'
DataSource = WebDataSource1
end
object edtPitch: TWebDBEdit
Left = 782
Top = 219
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtpitch'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_pitch'
DataSource = WebDataSource1
end
object edtBleed: TWebDBEdit
Left = 782
Top = 282
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtbleed'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_bleed'
DataSource = WebDataSource1
end
object edtTeeth: TWebDBEdit
Left = 782
Top = 248
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtteeth'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_teeth'
DataSource = WebDataSource1
end
object edtCutback: TWebDBEdit
Left = 782
Top = 311
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtcutback'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_cutback'
DataSource = WebDataSource1
end
object edtMinimumTrapDim: TWebDBEdit
Left = 782
Top = 344
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtminimumtrapdimension'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_minimum_trap_dim'
DataSource = WebDataSource1
end
object edtMaximumTrapDim: TWebDBEdit
Left = 782
Top = 373
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtmaximumtrapdimension'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_maximum_trap_dim'
DataSource = WebDataSource1
end
object edtSize: TWebDBEdit
Left = 782
Top = 423
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtsize'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'upc_size'
DataSource = WebDataSource1
end
object edtBarWidthReduction: TWebDBEdit
Left = 782
Top = 452
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtbarwidthreduction'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'upc_bar_width_reduction'
DataSource = WebDataSource1
end
object edtDistortionAmount: TWebDBEdit
Left = 782
Top = 523
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtdistortionamount'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'upc_distortion_amount'
DataSource = WebDataSource1
end
object edtDistortionPercent: TWebDBEdit
Left = 782
Top = 490
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtdistortionpercent'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'upc_distortion_percent'
DataSource = WebDataSource1
end
object edtJobNumber: TWebDBEdit
Left = 634
Top = 516
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtjobnumber'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'plates_job_number'
DataSource = WebDataSource1
end
object Comments: TWebDBEdit
Left = 276
Top = 160
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtcomments'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'general_comments'
DataSource = WebDataSource1
end
object btnConfirm: TWebButton
Left = 649
Top = 568
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 79
ElementID = 'btnconfirm'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object btnEdit: TWebButton
Left = 867
Top = 568
Width = 96
Height = 25
Caption = 'Edit'
ChildOrder = 79
ElementID = 'btnedit'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCancel: TWebButton
Left = 761
Top = 568
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 79
ElementID = 'btncancel'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object wcbQBItem: TWebDBComboBox
Left = 26
Top = 515
Width = 145
Height = 23
ElementID = 'wcbqbitem'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
DataField = 'staff_fields_quickbooks_item'
DataSource = WebDataSource1
ListField = 'name'
ListSource = wdsQBItem
end
object WebDBComboBox2: TWebDBComboBox
Left = 631
Top = 487
Width = 145
Height = 23
ElementID = 'wcbmaterial'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'PhotoPolymer'
'Rubber')
DataField = 'plates_plate_material'
DataSource = WebDataSource1
end
object WebDBComboBox3: TWebDBComboBox
Left = 631
Top = 458
Width = 145
Height = 23
ElementID = 'wcbthickness'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'.250'
'.155'
'.107'
'.067'
'.045')
DataField = 'plates_thickness'
DataSource = WebDataSource1
end
object wcbPrint: TWebDBComboBox
Left = 621
Top = 408
Width = 145
Height = 23
ElementID = 'wcbprint'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'Portrait'
'Landscape')
DataField = 'print_orientation_print_orient'
DataSource = WebDataSource1
end
object WebDBComboBox4: TWebDBComboBox
Left = 444
Top = 402
Width = 145
Height = 23
ElementID = 'wcbcolorcontract'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'Cromapro Ink Jet'
'Kodak Approval')
DataField = 'print_orientation_print_orient'
DataSource = WebDataSource1
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 160
Top = 18
end
object tmrScrollTop: TWebTimer
Interval = 100
OnTimer = tmrScrollTopTimer
Left = 240
Top = 8
end
object XDataWebDataSet1: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 90
Top = 20
object XDataWebDataSet1ORDER_ID: TIntegerField
FieldName = 'ORDER_ID'
end
object XDataWebDataSet1COMPANY_ID: TIntegerField
FieldName = 'COMPANY_ID'
end
object XDataWebDataSet1USER_ID: TIntegerField
FieldName = 'USER_ID'
end
object XDataWebDataSet1ORDER_DATE: TDateField
FieldName = 'ORDER_DATE'
end
object XDataWebDataSet1NAME: TStringField
FieldName = 'NAME'
end
object XDataWebDataSet1SHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object XDataWebDataSet1staff_fields_ship_via: TStringField
FieldName = 'staff_fields_ship_via'
end
object XDataWebDataSet1staff_fields_price: TStringField
FieldName = 'staff_fields_price'
end
object XDataWebDataSet1staff_fields_invoice_to: TStringField
FieldName = 'staff_fields_invoice_to'
end
object XDataWebDataSet1staff_fields_invoice_attention: TStringField
FieldName = 'staff_fields_invoice_attention'
end
object XDataWebDataSet1staff_fields_ship_to: TStringField
FieldName = 'staff_fields_ship_to'
end
object XDataWebDataSet1staff_fields_ship_attention: TStringField
FieldName = 'staff_fields_ship_attention'
end
object XDataWebDataSet1staff_fields_po_number: TStringField
FieldName = 'staff_fields_po_number'
end
object XDataWebDataSet1staff_fields_job_name: TStringField
FieldName = 'staff_fields_job_name'
end
object XDataWebDataSet1staff_fields_quickbooks_item: TStringField
FieldName = 'staff_fields_quickbooks_item'
end
object XDataWebDataSet1staff_fields_quantity: TStringField
FieldName = 'staff_fields_quantity'
end
object XDataWebDataSet1staff_fields_art_location: TStringField
FieldName = 'staff_fields_art_location'
end
object XDataWebDataSet1staff_fields_order_date: TStringField
FieldName = 'staff_fields_order_date'
end
object XDataWebDataSet1staff_fields_proof_date: TStringField
FieldName = 'staff_fields_proof_date'
end
object XDataWebDataSet1staff_fields_ship_date: TStringField
FieldName = 'staff_fields_ship_date'
end
object XDataWebDataSet1staff_fields_art_due: TStringField
FieldName = 'staff_fields_art_due'
end
object XDataWebDataSet1staff_fields_plate_due: TStringField
FieldName = 'staff_fields_plate_due'
end
object XDataWebDataSet1ADDRESS_LIST: TStringField
FieldName = 'ADDRESS_LIST'
end
object XDataWebDataSet1plates_job_number: TStringField
FieldName = 'plates_job_number'
end
object XDataWebDataSet1supplied_by_customer_plates: TStringField
FieldName = 'supplied_by_customer_plates'
end
object XDataWebDataSet1supplied_by_customer_sample: TStringField
FieldName = 'supplied_by_customer_sample'
end
object XDataWebDataSet1supplied_by_customer_dimension: TStringField
FieldName = 'supplied_by_customer_dimension'
end
object XDataWebDataSet1supplied_by_customer_other: TStringField
FieldName = 'supplied_by_customer_other'
end
object XDataWebDataSet1supplied_by_customer_disk: TStringField
FieldName = 'supplied_by_customer_disk'
end
object XDataWebDataSet1supplied_by_customer_e_mail: TStringField
FieldName = 'supplied_by_customer_e_mail'
end
object XDataWebDataSet1supplied_by_customer_ftp: TStringField
FieldName = 'supplied_by_customer_ftp'
end
object XDataWebDataSet1plates_plate_material: TStringField
FieldName = 'plates_plate_material'
end
object XDataWebDataSet1plates_thickness: TStringField
FieldName = 'plates_thickness'
end
object XDataWebDataSet1supplied_by_customer_total_inc: TStringField
FieldName = 'supplied_by_customer_total_inc'
end
object XDataWebDataSet1supplied_by_customer_sheets_us: TStringField
FieldName = 'supplied_by_customer_sheets_us'
end
object XDataWebDataSet1supplied_by_customer_initials: TStringField
FieldName = 'supplied_by_customer_initials'
end
object XDataWebDataSet1proofing_pdf_to: TStringField
FieldName = 'proofing_pdf_to'
end
object XDataWebDataSet1proofing_pdf_date_1: TStringField
FieldName = 'proofing_pdf_date_1'
end
object XDataWebDataSet1proofing_pdf_date_2: TStringField
FieldName = 'proofing_pdf_date_2'
end
object XDataWebDataSet1proofing_pdf_date_3: TStringField
FieldName = 'proofing_pdf_date_3'
end
object XDataWebDataSet1proofing_ink_jet_to: TStringField
FieldName = 'proofing_ink_jet_to'
end
object XDataWebDataSet1proofing_ink_jet_to_2: TStringField
FieldName = 'proofing_ink_jet_to_2'
end
object XDataWebDataSet1proofing_ink_jet_date_1: TStringField
FieldName = 'proofing_ink_jet_date_1'
Size = 0
end
object XDataWebDataSet1proofing_ink_jet_date_2: TStringField
FieldName = 'proofing_ink_jet_date_2'
end
object XDataWebDataSet1proofing_ink_jet_date_3: TStringField
FieldName = 'proofing_ink_jet_date_3'
end
object XDataWebDataSet1proofing_color_contract: TStringField
FieldName = 'proofing_color_contract'
end
object XDataWebDataSet1proofing_color_contrac_to: TStringField
FieldName = 'proofing_color_contrac_to'
end
object XDataWebDataSet1proofing_color_contrac_date_1: TStringField
FieldName = 'proofing_color_contrac_date_1'
end
object XDataWebDataSet1proofing_color_contrac_date_2: TStringField
FieldName = 'proofing_color_contrac_date_2'
end
object XDataWebDataSet1proofing_digital_color_key: TStringField
FieldName = 'proofing_digital_color_key'
end
object XDataWebDataSet1proofing_digital_color_to: TStringField
FieldName = 'proofing_digital_color_to'
end
object XDataWebDataSet1proofing_digital_color_date_1: TStringField
FieldName = 'proofing_digital_color_date_1'
Size = 0
end
object XDataWebDataSet1quantity_and_colors_press_name: TStringField
FieldName = 'quantity_and_colors_press_name'
end
object XDataWebDataSet1quantity_and_colors_anilox_info: TStringField
FieldName = 'quantity_and_colors_anilox_info'
end
object XDataWebDataSet1plate_marks_microdots_comments: TStringField
FieldName = 'plate_marks_microdots_comments'
end
object XDataWebDataSet1plate_marks_microdots: TStringField
FieldName = 'plate_marks_microdots'
end
object XDataWebDataSet1plate_marks_crosshairs: TStringField
FieldName = 'plate_marks_crosshairs'
end
object XDataWebDataSet1plate_marks_crosshairs_comments: TStringField
FieldName = 'plate_marks_crosshairs_comments'
end
object XDataWebDataSet1plate_marks_color_bars: TStringField
FieldName = 'plate_marks_color_bars'
end
object XDataWebDataSet1plate_marks_color_bars_comments: TStringField
FieldName = 'plate_marks_color_bars_comments'
end
object XDataWebDataSet1plate_marks_other: TStringField
FieldName = 'plate_marks_other'
end
object XDataWebDataSet1plate_marks_other_comments: TStringField
FieldName = 'plate_marks_other_comments'
end
object XDataWebDataSet1print_orientation_print_orient: TStringField
FieldName = 'print_orientation_print_orient'
end
object XDataWebDataSet1layout_around: TStringField
FieldName = 'layout_around'
end
object XDataWebDataSet1layout_accross: TStringField
FieldName = 'layout_accross'
end
object XDataWebDataSet1layout_surface_print: TStringField
FieldName = 'layout_surface_print'
end
object XDataWebDataSet1layout_reverse_print: TStringField
FieldName = 'layout_reverse_print'
end
object XDataWebDataSet1layout_cylinder_repeat: TStringField
FieldName = 'layout_cylinder_repeat'
end
object XDataWebDataSet1layout_cutoff_dimension: TStringField
FieldName = 'layout_cutoff_dimension'
end
object XDataWebDataSet1layout_pitch: TStringField
FieldName = 'layout_pitch'
end
object XDataWebDataSet1layout_teeth: TStringField
FieldName = 'layout_teeth'
end
object XDataWebDataSet1layout_bleed: TStringField
FieldName = 'layout_bleed'
end
object XDataWebDataSet1layout_minimum_trap_dim: TStringField
FieldName = 'layout_minimum_trap_dim'
end
object XDataWebDataSet1layout_maximum_trap_dim: TStringField
FieldName = 'layout_maximum_trap_dim'
end
object XDataWebDataSet1upc_size: TStringField
FieldName = 'upc_size'
end
object XDataWebDataSet1upc_bar_width_reduction: TStringField
FieldName = 'upc_bar_width_reduction'
end
object XDataWebDataSet1general_comments: TStringField
FieldName = 'general_comments'
end
object XDataWebDataSet1upc_distortion_percent: TStringField
FieldName = 'upc_distortion_percent'
end
object XDataWebDataSet1upc_distortion_amount: TStringField
FieldName = 'upc_distortion_amount'
end
object XDataWebDataSet1layout_cutback: TStringField
FieldName = 'layout_cutback'
end
object XDataWebDataSet1proofing_full_size_ink_jet_for: TBooleanField
FieldName = 'proofing_full_size_ink_jet_for'
end
object XDataWebDataSet1proofing_pdf: TBooleanField
FieldName = 'proofing_pdf'
end
object XDataWebDataSet1quantity_and_colors_qty_colors: TStringField
FieldName = 'quantity_and_colors_qty_colors'
end
object XDataWebDataSet1supplied_by_customer_b_w_or_co: TStringField
FieldName = 'supplied_by_customer_b_w_or_co'
end
end
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
Left = 22
Top = 10
end
object wdsShipTo: TWebDataSource
DataSet = xdwdsShipTo
Left = 212
Top = 436
end
object xdwdsShipTo: TXDataWebDataSet
Left = 208
Top = 398
object xdwdsShipToADDRESS: TStringField
FieldName = 'ADDRESS'
end
end
object wdsQBItem: TWebDataSource
DataSet = xdwdsQBItem
Left = 240
Top = 518
end
object xdwdsQBItem: TXDataWebDataSet
Left = 200
Top = 512
object xdwdsQBItemname: TStringField
FieldName = 'name'
end
end
end
<div class="col-12 col-md-8">
<div class="row">
<div class=col-sm>
<div id="pnl_message" class="alert alert-danger">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
</div>
</div>
<h4 class="custom-h4 mt-3">Company</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label class="form-label mt-2">Company Name:</label>
<input id="edtcompanyname" type="text" class="form-control" style="width: 300px;"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Account Company Name:</label>
<input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">In Quickbooks?:</label>
<input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/>
</div>
</div>
<h4 class="custom-h4 mt-3">Staff Fields</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Order Date:</label>
<input class="form-control input-sm" id="dtporderdate" type="date">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Proof Date:</label>
<input class="form-control input-sm" id="dtpproofdate" type="date">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ship Date:</label>
<input class="form-control input-sm" id="dtpshipdate" type="date">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ship Via:</label>
<input id="edtshipvia" type="text" class="form-control"/>
</div>
<div class="col-auto">
<label 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"/>
</div>
<div class="col-auto">
<label 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"/>
</div>
<div>
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Invoice To:</label>
<input id="edtinvoiceto" class="form-control input-sm"/>
</div>
<div>
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ship To:</label>
<select id="wcbshipto" class='form-select'></select>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PO Number:</label>
<input id="edtponumber" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Job Name:</label>
<input id="edtjobname" class="form-control input-sm" width='50%'/>
</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>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Art Due:</label>
<input class="form-control input-sm" id="dtpartdue" type="date">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Plate Due:</label>
<input class="form-control input-sm" id="dtpplatedue" type="date">
</div>
</div>
<h4 class="custom-h4 mt-3">Supplied by Customer</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">B/W or Color Copy:</label>
<input id="edtbworcolorcopy" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Plates:</label>
<input id="edtplates" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Sample:</label>
<input id="edtsample" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Dimensional Layout:</label>
<input id="edtdimensionallayout" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Other:</label>
<input id="edtother" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Email:</label>
<input id="edtemail" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">FTP:</label>
<input id="edtftp" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Total Inches Used:</label>
<input id="edttotalinchesused" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Sheets Used:</label>
<input id="edtsheetsused" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Initials:</label>
<input id="edtinitials" class="form-control input-sm" width='50%'/>
</div>
</div>
<h4 class="custom-h4 mt-3">Proofing</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF:</label>
<input type="checkbox" id="cbpdf">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF To:</label>
<input id="edtpdfto" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF Date 1:</label>
<input class="form-control input-sm" id="dtppdfdate1" type="date">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF Date 2:</label>
<input class="form-control input-sm" id="dtppdfdate2" type="date">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF Date 3:</label>
<input class="form-control input-sm" id="dtppdfdate3" type="date">
</div>
<div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Full Size Ink Jet For Layout Content Only:</label>
<input type="checkbox" id="cbfullsizeinkjet">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ink Jet To:</label>
<input id="edtinkjetto" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ink Jet To 2:</label>
<input id="edtinkjetto2" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ink Jet Date 1:</label>
<input class="form-control input-sm" id="dtpinkjetdate1" type="date">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ink Jet Date 2:</label>
<input class="form-control input-sm" id="dtpinkjetdate2" type="date">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ink Jet Date 3:</label>
<input class="form-control input-sm" id="dtpinkjetdate3" type="date">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Color Contract:</label>
<select id="wcbcolorcontract" class='form-select'></select>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Color Contract To:</label>
<input id="edtcolorcontrastto" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Color Contrast Date 1:</label>
<input class="form-control input-sm" id="dtpcolorcontrastdate1" type="date">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Color Contrast Date 2:</label>
<input class="form-control input-sm" id="dtpcolorcontrastdate2" type="date">
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Digital Color Key:</label>
<input id="edtdigitalcolorkey" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Digital Color To:</label>
<input id="edtdigitalcolorto" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Digital Color Date:</label>
<input class="form-control input-sm" id="dtpdigitalcolordate" type="date">
</div>
</div>
<h4 class="custom-h4 mt-3">Quantity and Colors</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Press Name:</label>
<input id="edtpressname" class="form-control input-sm" width='50%'/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Anilax Info:</label>
<input id="edtanilaxinfo" 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">Colors:</label>
<button id="btnaddcolor" class="btn btn-primary btn-sm float-end">+</button>
<div id="additionalFields" class="row mt-3"></div>
</div>
</div>
<h4 class="custom-h4 mt-3">Plate Marks</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Microdots:</label>
<input id="edtmicrodots" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Microdots Comments:</label>
<input id="edtmicrodotscomments" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Crosshairs:</label>
<input id="edtcrosshairs" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Crosshairs Comments:</label>
<input id="edtcrosshairscomments" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Color Bars:</label>
<input id="edtcolorbars" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Color Bars Comments:</label>
<input id="edtcolorbarscomments" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Other:</label>
<input id="edtplateother" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Microdots Comments:</label>
<input id="edtplateothercomments" class="form-control input-sm" style="width: 150px"/>
</div>
</div>
<h4 class="custom-h4 mt-3">Layout</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Around:</label>
<input id="edtaround" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Accross:</label>
<input id="edtaccross" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Surface Print:</label>
<input id="edtsurfaceprint" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Reverse Print:</label>
<input id="edtreverseprint" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Cylinder Repeat:</label>
<input id="edtcylinderrepeat" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Cutoff Dimension:</label>
<input id="edtcutoffdimension" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Pitch:</label>
<input id="edtpitch" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Teeth:</label>
<input id="edtteeth" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Bleed:</label>
<input id="edtbleed" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Cutback:</label>
<input id="edtcutback" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Minimum Trap Dimension:</label>
<input id="edtminimumtrapdimension" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Maximum Trap Dimension:</label>
<input id="edtmaximumtrapdimension" class="form-control input-sm" style="width: 150px"/>
</div>
</div>
<h4 class="custom-h4 mt-3">Print Orientation</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Print Orientation:</label>
<select id="wcbprint" class='form-select'></select>
</div>
</div>
<h4 class="custom-h4 mt-3">UPC</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Size:</label>
<input id="edtsize" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Bar Width Reduction:</label>
<input id="edtbarwidthreduction" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Distortion Percent:</label>
<input id="edtdistortionpercent" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Distortion Amount:</label>
<input id="edtdistortionamount" class="form-control input-sm" style="width: 150px"/>
</div>
<h4 class="custom-h4 mt-3">Plates</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Thickness:</label>
<select id="wcbthickness" class='form-select'></select>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Plate Material:</label>
<select id="wcbmaterial" class='form-select'></select>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Job Number:</label>
<input id="edtjobnumber" class="form-control input-sm" style="width: 150px"/>
</div>
</div>
<h4 class="custom-h4 mt-3">General</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label">Comments</label>
<textarea id="edtcomments" class="form-control" style=" width: 500px; height: 150px;"></textarea>
</div>
</div>
<div class="row">
<div class="col-auto">
<button id="btnconfirm" class="btn btn-primary btn-sm float-end my-2">Confirm</button>
</div>
<div class="col-auto">
<button id="btncancel" class="btn btn-primary btn-sm float-end my-2">Cancel</button>
</div>
<div class="col-auto">
<button id="btnedit" class="btn btn-primary btn-sm float-end my-2">Edit</button>
</div>
</div>
</div>
unit View.OrderEntryWeb;
interface
uses
System.SysUtils, System.Generics.Collections, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB;
type
TFOrderEntryWeb = class(TWebForm)
WebLabel2: TWebLabel;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
edtCompanyName: TWebDBEdit;
edtCompanyAccountName: TWebDBEdit;
edtInQuickBooks: TWebDBEdit;
XDataWebClient1: TXDataWebClient;
tmrScrollTop: TWebTimer;
XDataWebDataSet1: TXDataWebDataSet;
XDataWebDataSet1ORDER_ID: TIntegerField;
XDataWebDataSet1COMPANY_ID: TIntegerField;
XDataWebDataSet1USER_ID: TIntegerField;
XDataWebDataSet1ORDER_DATE: TDateField;
XDataWebDataSet1NAME: TStringField;
XDataWebDataSet1SHORT_NAME: TStringField;
XDataWebDataSet1staff_fields_ship_via: TStringField;
XDataWebDataSet1staff_fields_price: TStringField;
XDataWebDataSet1staff_fields_invoice_to: TStringField;
XDataWebDataSet1staff_fields_invoice_attention: TStringField;
XDataWebDataSet1staff_fields_ship_to: TStringField;
XDataWebDataSet1staff_fields_ship_attention: TStringField;
XDataWebDataSet1staff_fields_po_number: TStringField;
XDataWebDataSet1staff_fields_job_name: TStringField;
XDataWebDataSet1staff_fields_quickbooks_item: TStringField;
XDataWebDataSet1staff_fields_quantity: TStringField;
XDataWebDataSet1staff_fields_art_location: TStringField;
XDataWebDataSet1staff_fields_order_date: TStringField;
XDataWebDataSet1staff_fields_proof_date: TStringField;
XDataWebDataSet1staff_fields_ship_date: TStringField;
XDataWebDataSet1staff_fields_art_due: TStringField;
XDataWebDataSet1staff_fields_plate_due: TStringField;
XDataWebDataSet1ADDRESS_LIST: TStringField;
WebDataSource1: TWebDataSource;
WebLabel1: TWebLabel;
dtpOrderDate: TWebDateTimePicker;
dtpProofDate: TWebDateTimePicker;
dtpShipDate: TWebDateTimePicker;
dtpArtDue: TWebDateTimePicker;
dtpPlateDue: TWebDateTimePicker;
edtShipVia: TWebDBEdit;
edtQuantity: TWebDBEdit;
edtPrice: TWebDBEdit;
edtInvoiceTo: TWebDBEdit;
edtPONumber: TWebDBEdit;
edtJobName: TWebDBEdit;
WebDBComboBox1: TWebDBComboBox;
wdsShipTo: TWebDataSource;
xdwdsShipTo: TXDataWebDataSet;
xdwdsShipToADDRESS: TStringField;
WebLabel3: TWebLabel;
edtBWorColorCopy: TWebDBEdit;
edtPlates: TWebDBEdit;
edtDimensionalLayout: TWebDBEdit;
edtSample: TWebDBEdit;
edtOther: TWebDBEdit;
edtEmail: TWebDBEdit;
edtTotalInchesUsed: TWebDBEdit;
edtFTP: TWebDBEdit;
edtSheetsUsed: TWebDBEdit;
edtInitials: TWebDBEdit;
WebLabel4: TWebLabel;
cbPDF: TWebDBCheckBox;
edtPDFTo: TWebDBEdit;
dtpPDFDate1: TWebDateTimePicker;
dtpPDFDate3: TWebDateTimePicker;
dtpPDFDate2: TWebDateTimePicker;
cbInkJet: TWebDBCheckBox;
edtInkJetTo2: TWebDBEdit;
edtInkJetTo1: TWebDBEdit;
dtpInkJetDate1: TWebDateTimePicker;
dtpInkJetDate3: TWebDateTimePicker;
dtpInkJetDate2: TWebDateTimePicker;
edtColorContrastTo: TWebDBEdit;
dtpColorContractDate1: TWebDateTimePicker;
dtpColorContractDate2: TWebDateTimePicker;
edtDigitalColorTo: TWebDBEdit;
edtDigitalColorKey: TWebDBEdit;
dtpDigitalColorDate: TWebDateTimePicker;
WebLabel5: TWebLabel;
edtAniloxInfo: TWebDBEdit;
edtPressName: TWebDBEdit;
WebButton1: TWebButton;
WebLabel6: TWebLabel;
edtMicroDots: TWebDBEdit;
edtMicrodotsComments: TWebDBEdit;
edtCrosshairsComments: TWebDBEdit;
edtCrosshairs: TWebDBEdit;
edtColorBarsComments: TWebDBEdit;
edtColorBars: TWebDBEdit;
edtPlateOther: TWebDBEdit;
edtPlateOtherComments: TWebDBEdit;
WebLabel7: TWebLabel;
WebLabel8: TWebLabel;
edtAround: TWebDBEdit;
edtAccross: TWebDBEdit;
edtReversePrint: TWebDBEdit;
edtSurfacePrint: TWebDBEdit;
edtCutoffDimension: TWebDBEdit;
edtCylinderRepeat: TWebDBEdit;
edtPitch: TWebDBEdit;
edtBleed: TWebDBEdit;
edtTeeth: TWebDBEdit;
edtCutback: TWebDBEdit;
edtMinimumTrapDim: TWebDBEdit;
edtMaximumTrapDim: TWebDBEdit;
WebLabel9: TWebLabel;
edtSize: TWebDBEdit;
edtBarWidthReduction: TWebDBEdit;
edtDistortionAmount: TWebDBEdit;
edtDistortionPercent: TWebDBEdit;
WebLabel10: TWebLabel;
edtJobNumber: TWebDBEdit;
WebLabel11: TWebLabel;
Comments: TWebDBEdit;
btnConfirm: TWebButton;
btnEdit: TWebButton;
btnCancel: TWebButton;
XDataWebDataSet1plates_job_number: TStringField;
XDataWebDataSet1supplied_by_customer_plates: TStringField;
XDataWebDataSet1supplied_by_customer_sample: TStringField;
XDataWebDataSet1supplied_by_customer_dimension: TStringField;
XDataWebDataSet1supplied_by_customer_other: TStringField;
XDataWebDataSet1supplied_by_customer_disk: TStringField;
XDataWebDataSet1supplied_by_customer_e_mail: TStringField;
XDataWebDataSet1supplied_by_customer_ftp: TStringField;
XDataWebDataSet1plates_plate_material: TStringField;
XDataWebDataSet1plates_thickness: TStringField;
XDataWebDataSet1supplied_by_customer_total_inc: TStringField;
XDataWebDataSet1supplied_by_customer_sheets_us: TStringField;
XDataWebDataSet1supplied_by_customer_initials: TStringField;
XDataWebDataSet1proofing_pdf_to: TStringField;
XDataWebDataSet1proofing_pdf_date_1: TStringField;
XDataWebDataSet1proofing_pdf_date_2: TStringField;
XDataWebDataSet1proofing_pdf_date_3: TStringField;
XDataWebDataSet1proofing_ink_jet_to: TStringField;
XDataWebDataSet1proofing_ink_jet_to_2: TStringField;
XDataWebDataSet1proofing_ink_jet_date_1: TStringField;
XDataWebDataSet1proofing_ink_jet_date_2: TStringField;
XDataWebDataSet1proofing_ink_jet_date_3: TStringField;
XDataWebDataSet1proofing_color_contract: TStringField;
XDataWebDataSet1proofing_color_contrac_to: TStringField;
XDataWebDataSet1proofing_color_contrac_date_1: TStringField;
XDataWebDataSet1proofing_color_contrac_date_2: TStringField;
XDataWebDataSet1proofing_digital_color_key: TStringField;
XDataWebDataSet1proofing_digital_color_to: TStringField;
XDataWebDataSet1proofing_digital_color_date_1: TStringField;
XDataWebDataSet1quantity_and_colors_press_name: TStringField;
XDataWebDataSet1quantity_and_colors_anilox_info: TStringField;
XDataWebDataSet1plate_marks_microdots_comments: TStringField;
XDataWebDataSet1plate_marks_microdots: TStringField;
XDataWebDataSet1plate_marks_crosshairs: TStringField;
XDataWebDataSet1plate_marks_crosshairs_comments: TStringField;
XDataWebDataSet1plate_marks_color_bars: TStringField;
XDataWebDataSet1plate_marks_color_bars_comments: TStringField;
XDataWebDataSet1plate_marks_other: TStringField;
XDataWebDataSet1plate_marks_other_comments: TStringField;
XDataWebDataSet1print_orientation_print_orient: TStringField;
XDataWebDataSet1layout_around: TStringField;
XDataWebDataSet1layout_accross: TStringField;
XDataWebDataSet1layout_surface_print: TStringField;
XDataWebDataSet1layout_reverse_print: TStringField;
XDataWebDataSet1layout_cylinder_repeat: TStringField;
XDataWebDataSet1layout_cutoff_dimension: TStringField;
XDataWebDataSet1layout_pitch: TStringField;
XDataWebDataSet1layout_teeth: TStringField;
XDataWebDataSet1layout_bleed: TStringField;
XDataWebDataSet1layout_minimum_trap_dim: TStringField;
XDataWebDataSet1layout_maximum_trap_dim: TStringField;
XDataWebDataSet1upc_size: TStringField;
XDataWebDataSet1upc_bar_width_reduction: TStringField;
XDataWebDataSet1general_comments: TStringField;
XDataWebDataSet1upc_distortion_percent: TStringField;
XDataWebDataSet1upc_distortion_amount: TStringField;
XDataWebDataSet1layout_cutback: TStringField;
XDataWebDataSet1proofing_full_size_ink_jet_for: TBooleanField;
XDataWebDataSet1proofing_pdf: TBooleanField;
XDataWebDataSet1quantity_and_colors_qty_colors: TStringField;
XDataWebDataSet1supplied_by_customer_b_w_or_co: TStringField;
wcbQBItem: TWebDBComboBox;
wdsQBItem: TWebDataSource;
xdwdsQBItem: TXDataWebDataSet;
xdwdsQBItemname: TStringField;
WebDBComboBox2: TWebDBComboBox;
WebDBComboBox3: TWebDBComboBox;
wcbPrint: TWebDBComboBox;
WebDBComboBox4: TWebDBComboBox;
procedure WebFormCreate(Sender: TObject);
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure WebFormShow(Sender: TObject);
[async] procedure getOrder(Order_ID: string);
[async] procedure getCustomer(customerID: string);
procedure tmrScrollTopTimer(Sender: TObject);
procedure WebButton1Click(Sender: TObject);
procedure addColorRow(num, Color, LPI, Size: string);
procedure btnConfirmClick(Sender: TObject);
[async] procedure AddWebOrder(orderJSON: TJSONObject);
procedure btnCancelClick(Sender: TObject);
private
FAgencyCode: string;
FCurrentReportType: string;
FSelectProc: TSelectProc;
orderID: string;
customerID: string;
mode: string;
//FJSONProc1: TJSONProc1;
public
class function CreateForm(AElementID, orderInfo, customerInfo, mode: string): TWebForm;
end;
var
FOrderEntryWeb: TFOrderEntryWeb;
implementation
{$R *.dfm}
uses
View.Home, View.Main;
procedure TFOrderEntryWeb.btnConfirmClick(Sender: TObject);
// Converts all the information on the page into a JSON to then send to the server
var
colorList: TJSONArray;
container: TJSElement;
colorCollection: TJSHTMLCollection;
color: TJSHTMLElement;
I, J: integer;
colorJSON, orderJSON, colorListJSON: TJSONObject;
fieldNames: TStringList;
itemList: TJSNodeList;
header, value, info: string;
Field: TField;
Response: TXDataClientResponse;
begin
console.log('confirm');
orderJSON := TJSONObject.Create;
colorList := TJSONArray.Create;
container := document.getElementById('additionalFields');
colorCollection := container.children;
for I := 0 to colorCollection.length - 1 do
begin
colorJSON := TJSONObject.Create;
itemList := colorCollection[I].childNodes;
for J := 0 to itemList.length - 2 do
begin
header := TJSHTMLElement(itemList[J]).children[0].innerText.Replace(':', '').Trim();
value := TJSHTMLInputElement(TJSHTMLElement(itemList[J]).childNodes[1]).value;
colorJSON.AddPair(header, value);
end;
colorList.Add(colorJSON);
end;
colorListJSON := TJSONObject.Create;
colorListJSON.AddPair('items', colorList);
XDataWebDataSet1.Edit;
XDataWebDataSet1quantity_and_colors_qty_colors.Value := colorListJSON.ToString;
//Convert all dates to strings because I was having less issues with that data type.
XDataWebDataSet1staff_fields_proof_date.Value := DateTimeToStr(dtpProofDate.Date);
XDataWebDataSet1staff_fields_ship_date.Value := DateTimeToStr(dtpShipDate.Date);
XDataWebDataSet1staff_fields_art_due.Value := DateTimeToStr(dtpArtDue.Date);
XDataWebDataSet1staff_fields_plate_due.Value := DateTimeToStr(dtpPlateDue.Date);
XDataWebDataSet1staff_fields_order_date.Value := DateTimeToStr(dtpOrderDate.Date);
XDataWebDataSet1proofing_pdf_date_1.Value := DateTimeToStr(dtpPDFDate1.Date);
XDataWebDataSet1proofing_pdf_date_2.Value := DateTimeToStr(dtpPDFDate2.Date);
XDataWebDataSet1proofing_pdf_date_3.Value := DateTimeToStr(dtpPDFDate3.Date);
XDataWebDataSet1proofing_ink_jet_date_1.Value := DateTimeToStr(dtpInkJetDate1.Date);
XDataWebDataSet1proofing_ink_jet_date_2.Value := DateTimeToStr(dtpInkJetDate2.Date);
XDataWebDataSet1proofing_ink_jet_date_3.Value := DateTimeToStr(dtpInkJetDate3.Date);
XDataWebDataSet1proofing_color_contrac_date_1.Value := DateTimeToStr(dtpColorContractDate1.Date);
XDataWebDataSet1proofing_color_contrac_date_2.Value := DateTimeToStr(dtpColorContractDate2.Date);
XDataWebDataSet1proofing_digital_color_date_1.Value := DateTimeToStr(dtpDigitalColorDate.Date);
XDataWebDataSet1.Post;
XDataWebDataSet1.First;
while not XDataWebDataSet1.Eof do
begin
for Field in XDataWebDataSet1.Fields do
begin
if Field is TStringField then
begin
if Field.AsString = '' then
orderJSON.AddPair(Field.FieldName, '')
else
orderJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields
end
else if Field is TBooleanField then
begin
if Field.AsBoolean then
orderJSON.AddPair(Field.FieldName, 'T')
else
orderJSON.AddPair(Field.FieldName, '');
end;
end;
XDataWebDataSet1.Next;
end;
orderJSON.AddPair('COMPANY_ID', customerID);
orderJSON.AddPair('USER_ID', JS.toString(AuthService.TokenPayload.Properties['user_id']));
orderJSON.AddPair('mode', mode);
if mode = 'EDIT' then
begin
orderJSON.AddPair('ORDER_ID', orderID);
info := 'Success:Order Successfully Edited';
end
else
info := 'Success:Order Successfully Added';
AddWebOrder(orderJSON);
FViewMain.ViewOrders(info);
end;
procedure TFOrderEntryWeb.AddWebOrder(orderJSON: TJSONObject);
// sends the order JSON object to the server
var
Response: TXDataClientResponse;
begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddWebOrder',
[orderJSON.ToString]));
end;
class function TFOrderEntryWeb.CreateForm(AElementID, orderInfo, customerInfo, mode: string): TWebForm;
var
localMode: string;
begin
localMode := mode;
Application.CreateForm(TFOrderEntryWeb, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderEntryWeb(AForm) do
begin
HideNotification;
TFOrderEntryWeb(AForm).customerID := customerInfo;
TFOrderEntryWeb(AForm).orderID := orderInfo;
TFOrderEntryWeb(AForm).mode := localMode;
end;
end
);
end;
procedure TFOrderEntryWeb.addColorRow(num: string; Color: string; LPI: string; Size: string);
// Java script code to add a row of colors when a button is clicked
// all variables are information to be placed in the boxes when loading an order.
// TODO: convert to Delphi
begin
asm
const container = document.getElementById('additionalFields');
// Create a new row for the new fields
const newRow = document.createElement('div');
newRow.className = 'row mb-2';
const labels = ['#', 'Color', 'LPI', 'Size'];
const values = [num, Color, LPI, Size];
labels.forEach((label, index) => {
const col = document.createElement('div');
col.className = 'col-sm';
const labelElement = document.createElement('label');
labelElement.className = 'pe-2';
labelElement.style.fontWeight = '700';
labelElement.style.fontSize = '15px';
labelElement.textContent = label + ':';
const inputElement = document.createElement('input');
inputElement.className = 'form-control input-sm';
inputElement.style.width = '100%';
inputElement.id = 'input-' + container.childElementCount + '-' + index; // Unique ID based on count
inputElement.value = values[index]; // Set the value based on the parameter
col.appendChild(labelElement);
col.appendChild(inputElement);
newRow.appendChild(col);
});
const removeButtonCol = document.createElement('div');
removeButtonCol.className = 'col-auto d-flex align-items-center';
const removeButton = document.createElement('button');
removeButton.className = 'btn btn-danger btn-sm';
removeButton.textContent = 'Remove';
removeButton.addEventListener('click', function() {
container.removeChild(newRow);
});
removeButtonCol.appendChild(removeButton);
newRow.appendChild(removeButtonCol);
container.appendChild(newRow);
end;
end;
procedure TFOrderEntryWeb.WebButton1Click(Sender: TObject);
begin
addColorRow('','','','');
end;
procedure TFOrderEntryWeb.btnCancelClick(Sender: TObject);
begin
FViewMain.ViewOrders('');
end;
procedure TFOrderEntryWeb.WebFormCreate(Sender: TObject);
begin
if not DMConnection.ApiConnection.Connected then
begin
DMConnection.ApiConnection.OpenAsync;
console.log('report requirements connection open')
end;
end;
procedure TFOrderEntryWeb.getOrder(Order_ID: string);
// retrieves an order from the server then loads the info into the page
var
xdcResponse: TXDataClientResponse;
orderList : TJSObject;
i: integer;
data: TJSArray;
order: TJSObject;
callListLength: integer;
tempString, strColorList: string;
colorObject: TJSObject;
colorList: TJSArray;
colorLength: integer;
color: TJSObject;
colorJSON: TJSONObject;
colorListJSON: TJSONArray;
items: TJSObject;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetWebOrder',
[Order_ID]));
order := TJSObject(xdcResponse.Result);
console.log(order);
data := TJSArray(order['data']);
XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(order);
XDataWebDataSet1.Open;
if XDataWebDataSet1quantity_and_colors_qty_colors.Value <> '' then
begin
colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1quantity_and_colors_qty_colors.Value));
colorList := TJSArray(colorObject['items']);
for I := 0 to colorList.length -1 do
begin
color := TJSObject(colorList[i]);
addColorRow(String(color['#']), string(color['Color']), string(color['LPI']), string(color['Size']));
end;
end;
// Dates need to be manually set
if not (XDataWebDataSet1staff_fields_order_date.AsString = '') then
dtpOrderDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_order_date.Value)
else
dtpOrderDate.Date := 0;
if not (XDataWebDataSet1staff_fields_proof_date.AsString = '') then
dtpProofDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_proof_date.AsString)
else
dtpProofDate.Date := 0;
if not (XDataWebDataSet1staff_fields_ship_date.AsString = '') then
dtpShipDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_ship_date.AsString)
else
dtpShipDate.Date := 0;
if not (XDataWebDataSet1staff_fields_art_due.AsString = '') then
dtpArtDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_art_due.AsString)
else
dtpArtDue.Date := 0;
if not (XDataWebDataSet1staff_fields_plate_due.AsString = '') then
dtpPlateDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_plate_due.AsString)
else
dtpPlateDue.Date := 0;
if not (XDataWebDataSet1proofing_pdf_date_1.AsString = '') then
dtpPDFDate1.Date := StrToDateTime(XDataWebDataSet1proofing_pdf_date_1.Value)
else
dtpPDFDate1.Date := 0;
if not (XDataWebDataSet1proofing_pdf_date_2.AsString = '') then
dtpPDFDate2.Date := StrToDateTime(XDataWebDataSet1proofing_pdf_date_2.Value)
else
dtpPDFDate2.Date := 0;
if not (XDataWebDataSet1proofing_pdf_date_3.AsString = '') then
dtpPDFDate3.Date := StrToDateTime(XDataWebDataSet1proofing_pdf_date_3.Value)
else
dtpPDFDate3.Date := 0;
if not (XDataWebDataSet1proofing_ink_jet_date_1.AsString = '') then
dtpInkJetDate1.Date := StrToDateTime(XDataWebDataSet1proofing_ink_jet_date_1.Value)
else
dtpInkJetDate1.Date := 0;
if not (XDataWebDataSet1proofing_ink_jet_date_2.AsString = '') then
dtpInkJetDate2.Date := StrToDateTime(XDataWebDataSet1proofing_ink_jet_date_2.Value)
else
dtpInkJetDate2.Date := 0;
if not (XDataWebDataSet1proofing_ink_jet_date_3.AsString = '') then
dtpInkJetDate3.Date := StrToDateTime(XDataWebDataSet1proofing_ink_jet_date_3.Value)
else
dtpInkJetDate3.Date := 0;
if not (XDataWebDataSet1proofing_color_contrac_date_1.AsString = '') then
dtpColorContractDate1.Date := StrToDateTime(XDataWebDataSet1proofing_color_contrac_date_1.Value)
else
dtpColorContractDate1.Date := 0;
if not (XDataWebDataSet1proofing_color_contrac_date_2.AsString = '') then
dtpColorContractDate2.Date := StrToDateTime(XDataWebDataSet1proofing_color_contrac_date_2.Value)
else
dtpColorContractDate2.Date := 0;
if not (XDataWebDataSet1proofing_digital_color_date_1.AsString = '') then
dtpDigitalColorDate.Date := StrToDateTime(XDataWebDataSet1proofing_digital_color_date_1.Value)
else
dtpDigitalColorDate.Date := 0;
if mode = 'EDIT' then
begin
CustomerID := XDataWebDataSet1COMPANY_ID.AsString;
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(order['ADDRESS_LIST']);
xdwdsShipTo.Open;
end;
xdwdsQBItem.Close;
items := TJSObject(order['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open;
end;
procedure TFOrderEntryWeb.getCustomer(customerID: string);
// gets a customer from the database then loads the appropiate fields
var
xdcResponse: TXDataClientResponse;
customer : TJSObject;
address: string;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer',
[customerID]));
customer := TJSObject(xdcResponse.Result);
XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(customer);
XDataWebDataSet1.Open;
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(customer['ADDRESS_LIST']);
xdwdsShipTo.Open;
end;
procedure TFOrderEntryWeb.WebFormShow(Sender: TObject);
begin
if mode <> 'ADD' then
getOrder(orderID)
else
getCustomer(customerID);
HideNotification();
end;
procedure TFOrderEntryWeb.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFOrderEntryWeb.ShowNotification(Notification: string);
begin
if Notification <> '' then
begin
lblMessage.Caption := Notification;
pnlMessage.ElementHandle.hidden := False;
end;
end;
procedure TFOrderEntryWeb.tmrScrollTopTimer(Sender: TObject);
begin
tmrScrollTop.Enabled := False;
window.scrollTo(0, 0);
end;
end.
\ No newline at end of file
......@@ -56,50 +56,6 @@ object FViewOrders: TFViewOrders
WidthPercent = 100.000000000000000000
OnClick = btnSearchClick
end
object pnlMessage: TWebPanel
Left = 82
Top = 352
Width = 125
Height = 33
ElementClassName = 'card'
ElementID = 'pnl_message'
ChildOrder = 5
ElementBodyClassName = 'card-body'
ElementFont = efCSS
ElementPosition = epRelative
Role = 'alert'
TabOrder = 2
object lblMessage: TWebLabel
Left = 32
Top = 11
Width = 42
Height = 13
Caption = 'Message'
ElementID = 'pnl_message'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementClassName = 'btn btn-light'
ElementID = 'view.login.message.button'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end
object WebButton1: TWebButton
Left = 188
Top = 79
......@@ -114,6 +70,7 @@ object FViewOrders: TFViewOrders
TabOrder = 7
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = WebButton1Click
end
object btnPDF: TWebButton
Left = 332
......@@ -163,6 +120,8 @@ object FViewOrders: TFViewOrders
Header.ListItemElementClassName = 'page-item'
Header.ListLinkElementClassName = 'page-link'
WordWrap = True
OnClickCell = wdbtcOrdersClickCell
OnDblClickCell = wdbtcOrdersDblClickCell
Columns = <
item
DataField = 'ID'
......@@ -342,6 +301,36 @@ object FViewOrders: TFViewOrders
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 12
Top = 16
Width = 121
Height = 33
ElementID = 'view.login.message'
ChildOrder = 17
TabOrder = 8
object lblMessage: TWebLabel
Left = 16
Top = 11
Width = 42
Height = 13
Caption = 'Message'
ElementID = 'view.login.message.label'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementID = 'view.login.message.button'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 28
......
<div class="container h-100 d-flex flex-column mt-0" style="max-width: 100%; padding-bottom: 0;">
<!-- Alert Section -->
<div class="row">
<div class="col-sm">
<div id="pnl_message" class="alert alert-danger">
<div class=col-sm>
<div id="view.login.message" class="alert alert-danger">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
......
......@@ -42,9 +42,6 @@ type
xdwdsOrdersplateDue: TStringField;
xdwdsOrdersplateDone: TStringField;
xdwdsOrdersorderType: TStringField;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
WebButton1: TWebButton;
btnPDF: TWebButton;
wdsCustomers: TWebDataSource;
......@@ -59,30 +56,34 @@ type
wcbPageSize: TWebComboBox;
wlcbOrderBy: TWebLookupComboBox;
edtSearch: TWebEdit;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
procedure WebFormCreate(Sender: TObject);
procedure btnAddOrderClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject);
procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnPDFClick(Sender: TObject);
procedure wcbPageSizeChange(Sender: TObject);
procedure wlcbOrderByChange(Sender: TObject);
procedure wdbtcOrdersDblClickCell(Sender: TObject; ACol, ARow: Integer);
procedure wdbtcOrdersClickCell(Sender: TObject; ACol, ARow: Integer);
procedure WebButton1Click(Sender: TObject);
private
FChildForm: TWebForm;
procedure ClearTable();
procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string;
procedure orderEntry(orderInfo, customerInfo, mode: string);
procedure orderEntry(orderInfo, customerInfo, mode, orderType: string);
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure ShowAddOrderForm();
procedure ShowSearchForm();
[async] procedure Search(searchOptions: string);
procedure ShowSetStatusForm();
[async] procedure GetOrders(searchOptions: string);
[async] procedure getUser();
procedure GeneratePDF(OrderID: string);
[async] procedure GenerateReportPDF;
[async] procedure SetStatus(statusInfo: string);
var
PageNumber: integer;
PageSize: integer;
......@@ -107,6 +108,7 @@ type
OrderBy: string;
filters: boolean;
info: string;
row: integer;
public
class function CreateForm(AElementID, Info: string): TWebForm;
......@@ -118,7 +120,7 @@ var
implementation
uses
XData.Model.Classes, View.Main, View.AddOrder, View.Search, View.PDF;
XData.Model.Classes, View.Main, View.AddOrder, View.Search, View.SetStatus;
{$R *.dfm}
......@@ -128,6 +130,7 @@ begin
end;
[async] procedure TFViewOrders.GenerateReportPDF;
// sends the search to the server which then sends back a pdf of the results
var
xdcResponse: TXDataClientResponse;
searchOptions, pdfURL: string;
......@@ -147,6 +150,14 @@ end;
procedure TFViewOrders.WebButton1Click(Sender: TObject);
begin
if OrderID <> '' then
ShowSetStatusForm()
else
ShowNotification('Failure:Please select an order');
end;
procedure TFViewOrders.WebFormCreate(Sender: TObject);
// Initializes important values:
// PageNumber: What page number the user is on IE 1: 1-10, 2: 11-20 etc
......@@ -197,20 +208,6 @@ begin
getOrders(generateSearchOptions());
end;
procedure TFViewOrders.getUser();
var
xdcResponse: TXDataClientResponse;
userList, user: TJSObject;
data: TJSArray;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetUsers',
[JS.toString(AuthService.TokenPayload.Properties['user_name'])]));
userList := TJSObject(xdcResponse.Result);
data := TJSArray(userList['data']);
user := TJSObject(data[0]);
end;
class function TFViewOrders.CreateForm(AElementID, Info: string): TWebForm;
var
localInfo: string;
......@@ -229,6 +226,7 @@ end;
procedure TFViewOrders.ShowAddOrderForm();
// displays the add order pop-up so the user can choose a customer
var
newform: TFAddOrder;
begin
......@@ -245,12 +243,21 @@ begin
procedure(AValue: TModalResult)
begin
if newform.confirm then
orderEntry('', newForm.edtID.Text, 'ADD');
begin
if newform.cbCorrugatedPlate.Checked then
orderType := 'corrugated'
else if newform.cbWebPlate.Checked then
orderType := 'web'
else
orderType := 'cutting';
orderEntry('', newForm.edtID.Text, 'ADD', orderType);
end;
end
);
end;
procedure TFViewOrders.ShowSearchForm();
// displays the search pop-up that allows the user to filter the order list
var
newform: TFSearch;
begin
......@@ -298,6 +305,62 @@ begin
);
end;
procedure TFViewOrders.ShowSetStatusForm();
// displays the search pop-up that allows the user to filter the order list
var
newform: TFSetStatus;
begin
newform := TFSetStatus.CreateNew;
newform.Caption := 'Input Search Options';
newForm.Popup := True;
newForm.Border := fbDialog;
newForm.OrderID := OrderID;
newForm.JobName := wdbtcOrders.Cells[2, row];
newForm.ShipDue := StrToDateTime(wdbtcOrders.Cells[13, row]);
newForm.MountDue := StrToDateTime(wdbtcOrders.Cells[11, row]);
newForm.PlateDue := StrToDateTime(wdbtcOrders.Cells[9, row]);
newForm.ArtDue := StrToDateTime(wdbtcOrders.Cells[7, row]);
// used to manage Back button handling to close subform
window.location.hash := 'subform';
newform.ShowModal(
procedure(AValue: TModalResult)
var
searchOptions: string;
StatusJSON: TJSONObject;
begin
if newform.confirm then
begin
StatusJSON := TJSONObject.Create;
StatusJSON.AddPair('ORDER_ID', OrderID);
StatusJSON.AddPair('date', DateTimeToStr(newform.dtpDate.Date));
StatusJSON.AddPair('status', newform.wlcbStatus.Value);
StatusJSON.AddPair('USER_ID', 1011);
StatusJSON.AddPair('mode', 'EDIT');
StatusJSON.AddPair('staff_fields_ship_date', DateToStr(newForm.dtpNewShipDue.Date));
StatusJSON.AddPair('staff_fields_mount_due', DateToStr(newForm.dtpNewMountDue.Date));
StatusJSON.AddPair('staff_fields_plate_due', DateToStr(newForm.dtpNewPlateDue.Date));
StatusJSON.AddPair('staff_fields_art_due', DateToStr(newForm.dtpNewArtDue.Date));
SetStatus(StatusJSON.ToString);
OrderID := '';
getOrders(GenerateSearchOptions());
end;
end
);
end;
procedure TFViewOrders.SetStatus(statusInfo: string);
var
xdcResponse: TXDataClientResponse;
statusOptions: string;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.SetStatus', [statusInfo]));
end;
procedure TFViewOrders.wcbPageSizeChange(Sender: TObject);
begin
......@@ -305,6 +368,21 @@ begin
getOrders(generateSearchOptions());
end;
procedure TFViewOrders.wdbtcOrdersClickCell(Sender: TObject; ACol,
ARow: Integer);
begin
OrderID := wdbtcOrders.Cells[0, ARow];
row := ARow;
end;
procedure TFViewOrders.wdbtcOrdersDblClickCell(Sender: TObject; ACol,
ARow: Integer);
begin
OrderID := wdbtcOrders.Cells[0, ARow];
orderType := wdbtcOrders.Cells[3, ARow].Split([' '])[0];
orderEntry(OrderID, '', 'EDIT', orderType);
end;
procedure TFViewOrders.GeneratePagination(TotalPages: Integer);
// Generates pagination for the table.
// TotalPages: Total amount of pages generated by the search
......@@ -505,6 +583,8 @@ end;
procedure TFViewOrders.GetOrders(searchOptions: string);
// retrieves a list of orders that fit a given search criteria
// searchOptions: search info to be sent to the server
var
xdcResponse: TXDataClientResponse;
orderList: TJSObject;
......@@ -560,9 +640,14 @@ begin
end;
procedure TFViewOrders.orderEntry(orderInfo, customerInfo, mode: string);
procedure TFViewOrders.orderEntry(orderInfo, customerInfo, mode, orderType: string);
begin
FViewMain.ViewOrderEntry(orderInfo, customerInfo, mode);
if orderType = 'corrugated' then
FViewMain.ViewOrderEntryCorrugated(orderInfo, customerInfo, mode)
else if orderType = 'web' then
FViewMain.ViewOrderEntryWeb(orderInfo, customerInfo, mode)
else
FViewMain.ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode);
end;
procedure TFViewOrders.btnCloseNotificationClick(Sender: TObject);
......@@ -570,65 +655,13 @@ begin
HideNotification();
end;
procedure TFViewOrders.btnConfirmClick(Sender: TObject);
begin
//orderEntry('', 'ADD');
end;
procedure TFViewOrders.btnSearchClick(Sender: TObject);
var
filterSection: TJSHTMLElement;
begin
{if btnFilters.Caption = 'Show Filters' then
begin
btnFilters.Caption := 'Hide Filters';
filterSection := TJSHTMLElement(document.getElementById('filter_info'));
if Assigned(filterSection) then
filterSection.style.setProperty('display', 'block');
end
else
begin
btnFilters.Caption := 'Show Filters';
filterSection := TJSHTMLElement(document.getElementById('filter_info'));
if Assigned(filterSection) then
filterSection.style.setProperty('display', 'none');
end;}
ShowSearchForm();
end;
procedure TFViewOrders.Search(searchOptions: string);
// Search method that searches the database for a specific phone number
var
xdcResponse: TXDataClientResponse;
callList : TJSObject;
i: integer;
data: TJSArray;
call: TJSObject;
callListLength: integer;
begin
if PageNumber > 0 then
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.Search',
[searchOptions]));
callList := TJSObject(xdcResponse.Result);
data := TJSArray(callList['data']);
callListLength := integer(callList['count']);
ClearTable();
for i := 0 to data.Length - 1 do
begin
call := TJSObject(data[i]);
{AddRowToTable(string(call['toNumber']), string(call['fromNumber']), string(call['dateCreated']),
string(call['duration']), string(call['transcription']), string(call['mediaUrl']));}
end;
TotalPages := (callListLength + PageSize - 1) div PageSize;
lblEntries.Caption := 'Showing entries for phone number: ' + searchOptions;
end;
end;
procedure TFViewOrders.ClearTable();
// clears the table
var
......@@ -677,7 +710,6 @@ begin
end;
end;
console.log(orderType);
if ( ( orderType <> '' ) AND ( orderType <> 'Any' ) ) then
searchOptions := searchOptions + '&orderType=' + orderType;
......@@ -689,7 +721,6 @@ begin
if orderID <> '' then
searchOptions := searchOptions + '&orderID=' + orderID;
Result := searchOptions;
end;
......@@ -702,32 +733,31 @@ end;
procedure TFViewOrders.ShowNotification(Notification: string);
var
splitNotification: TArray<string>;
begin
if Notification <> '' then
begin
lblMessage.Caption := Notification;
splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False;
end;
end;
procedure TFViewOrders.GeneratePDF(OrderID: string);
var
XDCResponse: TXDataClientResponse;
PDFBase64: string;
PDFBlob: TJSUint8Array;
PDFLink: TJSHTMLElement;
begin
// XDCResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderPDF', [OrderID]));
// PDFBase64 := string(XDCResponse.Result);
//
// // Convert Base64 to binary and create a link to download it
// PDFBlob := TJSUint8Array.new(TJSBase64.decodeBase64(PDFBase64));
// PDFLink := TJSHTMLElement(document.createElement('a'));
// PDFLink.setAttribute('href', 'data:application/pdf;base64,' + PDFBase64);
// PDFLink.setAttribute('download', 'Order_' + OrderID + '.pdf');
// PDFLink.click;
end;
end.
object FSearch: TFSearch
Width = 1016
Width = 733
Height = 683
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
......@@ -468,7 +468,7 @@ object FSearch: TFSearch
object TMSFNCGrid1: TTMSFNCGrid
Left = 20
Top = 112
Width = 620
Width = 699
Height = 233
ParentDoubleBuffered = False
DoubleBuffered = True
......@@ -544,7 +544,7 @@ object FSearch: TFSearch
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 241.000000000000000000
Width = 320.000000000000000000
end
item
BorderWidth = 1
......@@ -742,13 +742,13 @@ object FSearch: TFSearch
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 738
Top = 61
Left = 520
Top = 383
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 666
Top = 73
Left = 418
Top = 393
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
......@@ -764,7 +764,7 @@ object FSearch: TFSearch
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 650
Top = 23
Left = 594
Top = 387
end
end
// Search pop-up form used to filter the list.
// Author: Cameron Hayes
unit View.Search;
interface
......@@ -105,6 +107,7 @@ begin
end;
procedure TFSearch.WebFormShow(Sender: TObject);
// Auto fills information based on previous search
var
params: TStringList;
DateFormatSettings: TFormatSettings;
......@@ -241,6 +244,7 @@ begin
end;
[async] procedure TFSearch.getCustomers();
// Gets a list of customers from the server
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
......
object FSetStatus: TFSetStatus
Width = 640
Height = 361
OnShow = WebFormShow
object lblStatus1: TWebLabel
Left = 326
Top = 80
Width = 38
Height = 14
Caption = 'Status:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel1: TWebLabel
Left = 484
Top = 80
Width = 91
Height = 14
Caption = 'Date Completed:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 14
Top = 80
Width = 48
Height = 14
Caption = 'Order ID:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 172
Top = 78
Width = 57
Height = 14
Caption = 'Job Name:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel4: TWebLabel
Left = 11
Top = 142
Width = 51
Height = 14
Caption = 'Ship Due:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel5: TWebLabel
Left = 169
Top = 142
Width = 78
Height = 14
Caption = 'New Due Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel6: TWebLabel
Left = 326
Top = 140
Width = 62
Height = 14
Caption = 'Mount Due:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel7: TWebLabel
Left = 484
Top = 140
Width = 78
Height = 14
Caption = 'New Due Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel8: TWebLabel
Left = 11
Top = 200
Width = 54
Height = 14
Caption = 'Plate Due:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel9: TWebLabel
Left = 169
Top = 200
Width = 78
Height = 14
Caption = 'New Due Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel10: TWebLabel
Left = 324
Top = 200
Width = 44
Height = 14
Caption = 'Art Due:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel11: TWebLabel
Left = 482
Top = 200
Width = 78
Height = 14
Caption = 'New Due Date:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object wlcbStatus: TWebLookupComboBox
Left = 326
Top = 100
Width = 145
Height = 22
ElementClassName = 'custom-select'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
LookupValues = <
item
Value = 'PROOF'
DisplayText = 'Proof Done'
end
item
Value = 'ART'
DisplayText = 'Art Done'
end
item
Value = 'PLATE'
DisplayText = 'Plate Done'
end
item
Value = 'MOUNT'
DisplayText = 'Mount Done'
end
item
Value = 'SHIP'
DisplayText = 'Ship Done'
end>
end
object dtpDate: TWebDateTimePicker
Left = 484
Top = 100
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Role = ''
Text = ''
end
object btnConfirm: TWebButton
Left = 11
Top = 271
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 5
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object btnCancel: TWebButton
Left = 133
Top = 271
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 5
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object edtOrderID: TWebEdit
Left = 14
Top = 100
Width = 145
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtNotification: TWebEdit
Left = 14
Top = 24
Width = 303
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtJobName: TWebEdit
Left = 172
Top = 100
Width = 145
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object dtpShipDue: TWebDateTimePicker
Left = 11
Top = 162
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Enabled = False
Role = ''
Text = ''
end
object dtpNewShipDue: TWebDateTimePicker
Left = 169
Top = 162
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Role = ''
Text = ''
end
object dtpMountDue: TWebDateTimePicker
Left = 326
Top = 160
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Enabled = False
Role = ''
Text = ''
end
object dtpNewMountDue: TWebDateTimePicker
Left = 484
Top = 160
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Role = ''
Text = ''
end
object dtpPlateDue: TWebDateTimePicker
Left = 11
Top = 220
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Enabled = False
Role = ''
Text = ''
end
object dtpNewPlateDue: TWebDateTimePicker
Left = 169
Top = 220
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Role = ''
Text = ''
end
object dtpArtDue: TWebDateTimePicker
Left = 324
Top = 220
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Enabled = False
Role = ''
Text = ''
end
object dtpNewArtDue: TWebDateTimePicker
Left = 482
Top = 220
Width = 145
Height = 22
BorderStyle = bsSingle
ChildOrder = 1
Color = clWhite
Date = 45665.641243414350000000
Role = ''
Text = ''
end
end
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>TMS Web Project</title>
<style>
</style>
</head>
<body>
</body>
</html>
\ No newline at end of file
unit View.SetStatus;
interface
uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.ExtCtrls,
WEBLib.StdCtrls;
type
TFSetStatus = class(TWebForm)
wlcbStatus: TWebLookupComboBox;
dtpDate: TWebDateTimePicker;
lblStatus1: TWebLabel;
WebLabel1: TWebLabel;
btnConfirm: TWebButton;
btnCancel: TWebButton;
WebLabel2: TWebLabel;
edtOrderID: TWebEdit;
edtNotification: TWebEdit;
edtJobName: TWebEdit;
WebLabel3: TWebLabel;
WebLabel4: TWebLabel;
dtpShipDue: TWebDateTimePicker;
WebLabel5: TWebLabel;
dtpNewShipDue: TWebDateTimePicker;
WebLabel6: TWebLabel;
dtpMountDue: TWebDateTimePicker;
WebLabel7: TWebLabel;
dtpNewMountDue: TWebDateTimePicker;
WebLabel8: TWebLabel;
dtpPlateDue: TWebDateTimePicker;
WebLabel9: TWebLabel;
dtpNewPlateDue: TWebDateTimePicker;
WebLabel10: TWebLabel;
dtpArtDue: TWebDateTimePicker;
WebLabel11: TWebLabel;
dtpNewArtDue: TWebDateTimePicker;
procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
private
{ Private declarations }
procedure HideNotification;
procedure ShowNotification(Notification: string);
public
{ Public declarations }
confirm: boolean;
OrderID, JobName: string;
ShipDue, MountDue, PlateDue, ArtDue: TDateTime;
end;
var
FSetStatus: TFSetStatus;
implementation
{$R *.dfm}
procedure TFSetStatus.btnCancelClick(Sender: TObject);
begin
Close;
end;
procedure TFSetStatus.btnConfirmClick(Sender: TObject);
begin
if ( (dtpDate.Date = 0 ) or ( wlcbStatus.value = '' ) ) then
ShowNotification('Failure:Please fill in all information')
else
begin
confirm := true;
Close;
end;
end;
procedure TFSetStatus.WebFormShow(Sender: TObject);
begin
HideNotification();
edtOrderID.Text := OrderID;
dtpDate.Date := 0;
edtJobName.Text := JobName;
dtpShipDue.Date := ShipDue;
dtpMountDue.Date := MountDue;
dtpPlateDue.Date := PlateDue;
dtpArtDue.Date := ArtDue;
dtpNewShipDue.Date := 0;
dtpNewMountDue.Date := 0;
dtpNewPlateDue.Date := 0;
dtpNewArtDue.Date := 0;
end;
procedure TFSetStatus.HideNotification;
begin
//pnlMessage.ElementHandle.hidden := True;
end;
procedure TFSetStatus.ShowNotification(Notification: string);
begin
if Notification <> '' then
begin
edtNotification.Text := Notification;
end;
end;
end.
\ No newline at end of file
......@@ -57,6 +57,7 @@ input[type="text"] {
/* Navbar items - keep them aligned and spaced out */
.navbar-nav .nav-item {
padding: 0 15px; /* Adjust spacing between navbar items */
z-index: 9999;
}
/* Flexbox for the entire navbar */
......
......@@ -17,9 +17,12 @@ uses
View.Users in 'View.Users.pas' {FViewUsers: TWebForm} {*.html},
View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html},
View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html},
View.OrderEntryCorrugated in 'View.OrderEntryCorrugated.pas' {FOrderEntry: TWebForm} {*.html},
View.OrderEntryCorrugated in 'View.OrderEntryCorrugated.pas' {FOrderEntryCorrugated: TWebForm} {*.html},
View.AddOrder in 'View.AddOrder.pas' {FAddOrder: TWebForm} {*.html},
View.Search in 'View.Search.pas' {FSearch: TWebForm} {*.html};
View.Search in 'View.Search.pas' {FSearch: TWebForm} {*.html},
View.SetStatus in 'View.SetStatus.pas' {FSetStatus: TWebForm} {*.html},
View.OrderEntryCuttingDie in 'View.OrderEntryCuttingDie.pas' {FOrderEntryCuttingDie: TWebForm} {*.html},
View.OrderEntryWeb in 'View.OrderEntryWeb.pas' {FOrderEntryWeb: TWebForm} {*.html};
{$R *.res}
......
......@@ -166,7 +166,7 @@
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.OrderEntryCorrugated.pas">
<Form>FOrderEntry</Form>
<Form>FOrderEntryCorrugated</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
......@@ -180,6 +180,21 @@
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.SetStatus.pas">
<Form>FSetStatus</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.OrderEntryCuttingDie.pas">
<Form>FOrderEntryCuttingDie</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.OrderEntryWeb.pas">
<Form>FOrderEntryWeb</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<None Include="index.html"/>
<None Include="css\app.css"/>
<None Include="config\config.json"/>
......
......@@ -22,9 +22,11 @@ type
userName: string;
userFullName: string;
userId: string;
userAdmin: boolean;
userPhone: string;
userPerspectiveID: string;
userQBID: string;
userAccessType: string;
userEmail: string;
userStatus: string;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
property Query: TUniQuery read GetQuery;
......@@ -106,9 +108,12 @@ begin
JWT.Claims.SetClaimOfType<string>('user_name', userName);
JWT.Claims.SetClaimOfType<string>('user_fullname', userFullName);
JWT.Claims.SetClaimOfType<string>('user_id', userId);
JWT.Claims.SetClaimOfType<boolean>('user_admin', userAdmin);
JWT.Claims.SetClaimOfType<string>('user_phone', userPhone);
JWT.Claims.SetClaimOfType<string>('user_perspective_id', userPerspectiveID);
JWT.Claims.SetClaimOfType<string>('user_status', userStatus);
JWT.Claims.SetClaimOfType<string>('user_email', userEmail);
JWT.Claims.SetClaimOfType<string>('user_qb_id', userQBID);
JWT.Claims.SetClaimOfType<string>('user_access_type', userAccessType);
Result := TJOSE.SHA256CompactToken(serverConfig.jwtTokenSecret, JWT);
finally
JWT.Free;
......@@ -139,17 +144,15 @@ begin
//checkString := THashSHA2.GetHashString(date_created + password, THashSHA2.TSHA2Version.SHA512).ToUpper;
if password = authDB.uq.FieldByName('PASSWORD').AsString then
begin
{userName := user;
userFullName:= authDB.uq.FieldByName('full_name').AsString;;
userId := authDB.uq.FieldByName('user_id').AsString;
userAdmin := authDB.uq.FieldByName('admin').AsBoolean;
userPhone := authDB.uq.FieldByName('phone_number').AsString;
userEmail := authDB.uq.FieldByName('email').AsString;
userStr := '?username=' + userName;
userStr := userStr + '&fullname=' + userFullName;
userStr := userStr + '&userid=' + userId;
userStr := userStr + '&useradmin=' + BoolToStr(userAdmin);}
userName := user;
userFullName:= authDB.uq.FieldByName('NAME').AsString;;
userId := authDB.uq.FieldByName('USER_ID').AsString;
userStatus := authDB.uq.FieldByName('STATUS').AsString;
userPerspectiveID := authDB.uq.FieldByName('PERSPECTIVE_ID').AsString;
userEmail := authDB.uq.FieldByName('EMAIL').AsString;
userQBID := authDB.uq.FieldByName('QB_ID').AsString;
userAccessType := authDB.uq.FieldByName('ACCESS_TYPE').AsString;
//Logger.Log( 3, Format('AuthDB.SetLoginAuditEntry: "%s"', [user]) );
//AuthDB.SetLoginAuditEntry( userStr );
Result := 3; // Succcess
......
......@@ -125,12 +125,15 @@ type
data: TList<TCustomerItem>;
end;
TFullOrder = class
TFullOrder = class //TODO change name to TCorrugatedOrder
Public
//Company
COMPANY_ID: integer;
NAME: string;
SHORT_NAME: string;
inQuickBooks: string;
ADDRESS_LIST: TList<TAddressItem>;
ITEMS: TItemList;
// Staff Fields:
staff_fields_order_date: string;
......@@ -214,20 +217,126 @@ type
// General
general_special_instructions: string;
end;
TWebOrder = class
Public
//Company
COMPANY_ID: integer;
NAME: string;
SHORT_NAME: string;
inQuickBooks: string;
ADDRESS_LIST: TList<TAddressItem>;
ITEMS: TItemList;
// Staff Fields:
staff_fields_order_date: string;
staff_fields_proof_date: string;
staff_fields_ship_date: string;
staff_fields_ship_via: string;
staff_fields_quantity: string;
staff_fields_price: string;
staff_fields_invoice_to: string;
staff_fields_ship_to: string;
staff_fields_po_number: string;
staff_fields_job_name: string;
staff_fields_quickbooks_item: string;
staff_fields_art_due: string;
staff_fields_plate_due: string;
staff_fields_mount_due: string;
staff_fields_art_location: string;
// Supplied by Customer:
supplied_by_customer_b_w_or_co: string;
supplied_by_customer_plates: string;
supplied_by_customer_sample: string;
supplied_by_customer_dimension: string;
supplied_by_customer_other: string;
supplied_by_customer_disk: string;
supplied_by_customer_e_mail: string;
supplied_by_customer_ftp: string;
supplied_by_customer_total_inc: string;
supplied_by_customer_sheets_us: string;
supplied_by_customer_initials: string;
// Proofing
proofing_pdf: boolean;
proofing_pdf_to: string;
proofing_pdf_date_1: string;
proofing_pdf_date_2: string;
proofing_pdf_date_3: string;
proofing_full_size_ink_jet_for: boolean;
proofing_ink_jet_to: string;
proofing_ink_jet_to_2: string;
proofing_ink_jet_date_1: string;
proofing_ink_jet_date_2: string;
proofing_color_contract: string;
proofing_color_contrac_to: string;
proofing_color_contrac_date_1: string;
proofing_color_contrac_date_2: string;
proofing_digital_color_key: string;
proofing_digital_color_to: string;
proofing_digital_color_date_1: string;
// Print Orientation
print_orientation_print_orient: string;
// Plate
plates_plate_material: string;
plates_thickness: string;
plates_job_number: string;
// Quantity and Color
quantity_and_colors_press_name: string;
quantity_and_colors_anilox_info: string;
quantity_and_colors_qty_colors: string;
// Plate Marks
plate_marks_microdots: string;
plate_marks_microdots_comments: string;
plate_marks_crosshairs: string;
plate_marks_crosshairs_comments: string;
plate_marks_color_bars: string;
plate_marks_color_bars_comments: string;
plate_marks_other: string;
plate_marks_other_comments: string;
// Layout
layout_around: string;
layout_accross: string;
layout_surface_print: string;
layout_reverse_print: string;
layout_cylinder_repeat: string;
layout_cutoff_dimension: string;
layout_pitch: string;
layout_teeth: string;
layout_bleed: string;
layout_cutback: string;
layout_minimum_trap_dim: string;
layout_maximum_trap_dim: string;
// UPC
upc_size: string;
upc_bar_width_reduction: string;
upc_distortion_percent: string;
upc_distortion_amount: string;
// General
general_comments: string;
end;
type
[ServiceContract, Model(API_MODEL)]
ILookupService = interface(IInvokable)
['{F24E1468-5279-401F-A877-CD48B44F4416}']
[HttpGet] function Search(phoneNum: string): TOrderList;
[HttpGet] function GetUsers(searchOptions: string): TUserList;
[HttpGet] function GetItems(searchOptions: string): TItemList;
[HttpGet] function GetOrders(searchOptions: string): TOrderList;
[HttpGet] function GetOrder(orderInfo: string): TFullOrder;
[HttpGet] function GetWebOrder(orderInfo: string): TWebOrder;
[HttpGet] function GetCustomers(): TCustomerList;
[HttpGet] function GetCustomer(ID: string): TCustomerItem;
[HttpGet] function GenerateReportPDF(searchOptions: string): string;
......@@ -238,7 +347,9 @@ type
function DelUser(username: string): string;
function EditUser(const editOptions: string): string;
function AddCorrugatedOrder(orderInfo: string): TJSONObject;
function AddWebOrder(orderInfo: string): TJSONObject;
function AddStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: integer): string;
function SetStatus(statusOptions: string): string;
end;
implementation
......
// Implementation of the Lookup Service interface used to send call information
// to the client.
// Implementation of the Lookup Service interface used to send information
// to the client. Very overcrowded. Probably should move SQL functions to new
// file.
// Authors:
// Cameron Hayes
// Mac ...
......@@ -34,21 +35,21 @@ type
function GetCustomers(): TCustomerList;
function GetCustomer(ID: string): TCustomerItem;
function EditUser(const editOptions: string): string;
function Search(phoneNum: string): TOrderList;
function GenerateReportPDF(searchOptions: string): string;
function AddUser(userInfo: string): string;
function AddItem(itemInfo: string): string;
function DelUser(username: string): string;
function GenerateSelectSQL(filterType, startDate, endDate: string): string;
function GenerateSubQuery(currStatus: string): string;
function AddCorrugatedOrder(orderInfo: string): TJSONObject;
function AddWebOrder(orderInfo: string): TJSONObject;
function AddStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: integer): string;
function EditStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: string): string;
function GenerateOrdersSQL(searchOptions: string): TSQLQuery;
function GetColorCount(colors: string): string;
function GetWebOrder(orderInfo: string): TWebOrder;
function GenerateStatusSelectSQL(statusTableShort, statusTableLong, startDate, endDate, statusType: string): string;
function GenerateStatusWhereSQL(status: TStatusSearchInfo): string;
function CreateStatusSearchInfo(params: TStringList; statusNum: string): TStatusSearchInfo;
function SetStatus(statusOptions: string): string;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
end;
......@@ -73,6 +74,8 @@ begin
end;
function TLookupService.GetCustomers: TCustomerList;
// Retrieves a list of customers and sends it to the client in object form.
// The object contains the ID, Name, Short Name, and the shipping address.
var
SQL: string;
customer: TCustomerItem;
......@@ -103,6 +106,8 @@ begin
end;
function TLookupService.GetCustomer(ID: string): TCustomerItem;
// Gets one specific customer from the ID given by the client. This is used for
// the OrderEntry forms.
var
SQL: string;
ADDRESS: TAddressItem;
......@@ -131,44 +136,9 @@ begin
end;
function TLookupService.Search(phoneNum: string): TOrderList;
// Searchs the database for a specific from phone number then returns a list of
// calls from said number
// SQL: String of the sql query used to retrieve info from the database
// call: object representing the call information we want to send to the client
// Return: A list of calls
var
SQL: string;
order: TOrderItem;
begin
SQL := 'select * ' +
'from calls inner join recordings on calls.sid = recordings.call_sid ' +
'where from_formatted = ' + QuotedStr(PhoneNum) + ' order by calls.date_created desc';
doQuery(ordersDB.UniQuery1, SQL);
Result:= TOrderList.Create;
Result.data := TList<TOrderItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
while not ordersDB.UniQuery1.Eof do
begin
order := TOrderItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( order );
Result.data.Add( order );
//TODO
end;
ordersDB.UniQuery1.Close;
SQL:= '';
doQuery(ordersDB.UniQuery1, SQL);
Result.count := ordersDB.UniQuery1.FieldByName('total_count').AsInteger;
end;
function TLookupService.GenerateReportPDF(searchOptions: string): string;
// Generates a report pdf based on the last search (if any) Linked to rOrders
// file which does most of the work.
var
SQL: string;
rptOrders: TrptOrders; // Local instance of rptOrders
......@@ -187,14 +157,13 @@ begin
end;
end;
function TLookupService.generateSelectSQL(filterType, startDate, endDate: string): string;
begin
end;
function TLookupService.generateSubQuery(currStatus: string): string;
// Generates the subquery in order to retrieve all the status due/done dates
// This must be a subquery because there are at most 5 different entries which
// causes the query to return 5 different entries on a join. There is probably
// a work around but I couldn't get the SQL to work with it. Manually goes through
// all 5 statuses.
// currStatus: current status SQL is getting generated for.
begin
result := '(select oss.STATUS_DATE from orders_status_schedule oss ' +
'where oss.ORDER_ID = o.ORDER_ID and oss.ORDER_STATUS = ' + quotedStr(currStatus) + ') AS '+ currStatus + '_DUE,';
......@@ -204,6 +173,11 @@ begin
end;
function TLookupService.generateStatusSelectSQL(statusTableShort: string; statusTableLong: string; startDate: string; endDate: string; statusType: string): string;
// Generates the SQL query to figure out whether or not an entry exists within
// a given time frame.
// statusTableShort: short name for the status tables (os or oss)
// statusTableLong: full name for the status table
// startDate/endDate: starting date/ending date for when the status is due/done.
begin
result := 'exists ( select 1 from ' + statusTableLong + ' ' +
statusTableShort + ' where ' + statusTableShort + '.ORDER_ID = ' +
......@@ -224,6 +198,12 @@ begin
end;
function TLookupService.createStatusSearchInfo(params: TStringList; statusNum: string): TStatusSearchInfo;
// Takes all the status info recieved from the client and puts it into an object
// for convinence and to make it easier to expand. Returns said object.
// params: string list recieved from the client with all the search params
// statusNum: which status number we are on to make it easier to tell what info
// we want to take from client. I.E. differentiate between startDate1 and
// startDate2
var
statusType: string;
begin
......@@ -262,8 +242,11 @@ begin
end;
function TLookupService.generateStatusWhereSQL(status: TStatusSearchInfo): string;
// Generates the where SQL for each status to apply the filters used from the
// clients search.
// status - status information obtained from the client.
begin
if status.filterType <> 'ORDER_DATE' then
if status.filterType <> 'ORDER_DATE' then
begin
if status.null then
begin
......@@ -271,8 +254,9 @@ begin
' ' + status.statusTableShort + ' where '
+ status.statusTableShort +'.ORDER_ID = o.ORDER_ID ' +
'AND ' + status.statusTableShort + '.ORDER_STATUS = ' +
quotedStr(status.statusType) + ') AND ' +
generateStatusSelectSQL(status.altStatusTableShort, status.altStatusTableLong, status.startDate, status.endDate, status.statusType);
quotedStr(status.statusType) + ')';
// out dated useage. uncomment if you want to return entries where dues are null, but dones exist or vice versa.
//generateStatusSelectSQL(status.altStatusTableShort, status.altStatusTableLong, status.startDate, status.endDate, status.statusType);
end
else
result := result + ' AND ' + generateStatusSelectSQL(status.statusTableShort, status.statusTableLong, status.startDate, status.endDate, status.statusType);
......@@ -292,6 +276,9 @@ begin
end;
function TLookupService.generateOrdersSQL(searchOptions: string): TSQLQuery;
// Generates the orderSQL to retrieve entries specified by the search recieved
// from the client.
// searchOptions: search information sent form client to be parsed.
var
params: TStringList;
PageNum: integer;
......@@ -384,7 +371,10 @@ begin
result.whereSQL := whereSQL;
end;
function TLookupService.GetColorCount(colors: string): string;
function TLookupService.getColorCount(colors: string): string;
// Colors are stored in a JSON in the database so this function parses the
// stringified JSON and returns the count of colors.
// colors: stringified JSON to be parsed.
var
colorObject: TJSONObject;
colorList: TJSONArray;
......@@ -490,11 +480,15 @@ end;
function TLookupService.GetOrder(orderInfo: string): TFullOrder;
// Gets on singular order from the database for the order entry page.
// orderInfo: the ORDER_ID.
// TODO seperate this into GetCorrugatedOrder and GetWebOrder.
var
orderType: string;
orderID: string;
SQL: string;
table: string;
ADDRESS: TAddressItem;
begin
orderID := orderInfo;
SQL := 'select ORDER_TYPE from orders where ORDER_ID = ' + quotedStr(orderID);
......@@ -510,6 +504,7 @@ begin
result := TFullOrder.Create;
// Company
result.COMPANY_ID := ordersDB.UniQuery1.FieldByName('COMPANY_ID').AsInteger;
result.NAME := ordersDB.UniQuery1.FieldByName('NAME').AsString;
result.SHORT_NAME := ordersDB.UniQuery1.FieldByName('SHORT_NAME').AsString;
result.inQuickBooks := '?';
......@@ -666,9 +661,170 @@ begin
result.general_special_instructions := ordersDB.UniQuery1.FieldByName('general_special_instructions').AsString
else
//result.specialInstructions := ordersDB.UniQuery1.FieldByName('general_comments').AsString
ordersDB.UniQuery1.Close;
SQL := 'SELECT s.ship_block FROM customers c JOIN customers_ship s ON c.CUSTOMER_ID = s.customer_id WHERE c.CUSTOMER_ID = ' + IntToStr(result.COMPANY_ID);
doQuery(ordersDB.UniQuery1, SQL);
result.ADDRESS_LIST := TList<TAddressItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.ADDRESS_LIST );
while not ordersDB.UniQuery1.Eof do
begin
ADDRESS := TAddressItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( ADDRESS );
ADDRESS.ADDRESS := ordersDB.UniQuery1.FieldByName('ship_block').AsString;
result.ADDRESS_LIST.Add(ADDRESS);
ordersDB.UniQuery1.Next;
end;
ordersDB.UniQuery1.Close;
result.ITEMS := GetItems('');
end;
function TLookupService.GetWebOrder(orderInfo: string): TWebOrder;
var
orderType: string;
orderID: string;
SQL: string;
ADDRESS: TAddressItem;
begin
orderID := orderInfo;
SQL := 'select * from web_plate_orders o JOIN customers c ON c.CUSTOMER_ID = o.COMPANY_ID where ORDER_ID = ' + quotedStr(orderID);
doQuery(ordersDB.UniQuery1, SQL);
result := TWebOrder.Create;
// Company
result.COMPANY_ID := ordersDB.UniQuery1.FieldByName('COMPANY_ID').AsInteger;
result.NAME := ordersDB.UniQuery1.FieldByName('NAME').AsString;
result.SHORT_NAME := ordersDB.UniQuery1.FieldByName('SHORT_NAME').AsString;
result.inQuickBooks := '?';
// Staff Fields
result.staff_fields_order_date := ordersDB.UniQuery1.FieldByName('staff_fields_order_date').AsString;
result.staff_fields_proof_date := ordersDB.UniQuery1.FieldByName('staff_fields_proof_date').AsString;
result.staff_fields_ship_date := ordersDB.UniQuery1.FieldByName('staff_fields_ship_date').AsString;
result.staff_fields_ship_via := ordersDB.UniQuery1.FieldByName('staff_fields_ship_via').AsString;
result.staff_fields_quantity := ordersDB.UniQuery1.FieldByName('staff_fields_quantity').AsString;
result.staff_fields_ship_to := ordersDB.UniQuery1.FieldByName('staff_fields_ship_to').AsString;
result.staff_fields_po_number := ordersDB.UniQuery1.FieldByName('staff_fields_po_number').AsString;
result.staff_fields_job_name := ordersDB.UniQuery1.FieldByName('staff_fields_job_name').AsString;
result.staff_fields_quickbooks_item := ordersDB.UniQuery1.FieldByName('staff_fields_quickbooks_item').AsString;
result.staff_fields_art_due := ordersDB.UniQuery1.FieldByName('staff_fields_art_due').AsString;
result.staff_fields_plate_due := ordersDB.UniQuery1.FieldByName('staff_fields_plate_due').AsString;
result.staff_fields_price := ordersDB.UniQuery1.FieldByName('staff_fields_price').AsString;
result.staff_fields_art_location := ordersDB.UniQuery1.FieldByName('staff_fields_art_location').AsString;
result.staff_fields_invoice_to := ordersDB.UniQuery1.FieldByName('staff_fields_invoice_to').AsString;
// Supplied by Customer
result.supplied_by_customer_b_w_or_co := ordersDB.UniQuery1.FieldByName('supplied_by_customer_b_w_or_co').AsString;
result.supplied_by_customer_plates := ordersDB.UniQuery1.FieldByName('supplied_by_customer_plates').AsString;
result.supplied_by_customer_sample := ordersDB.UniQuery1.FieldByName('supplied_by_customer_sample').AsString;
result.supplied_by_customer_dimension := ordersDB.UniQuery1.FieldByName('supplied_by_customer_dimension').AsString;
result.supplied_by_customer_other := ordersDB.UniQuery1.FieldByName('supplied_by_customer_other').AsString;
result.supplied_by_customer_disk := ordersDB.UniQuery1.FieldByName('supplied_by_customer_disk').AsString;
result.supplied_by_customer_e_mail := ordersDB.UniQuery1.FieldByName('supplied_by_customer_e_mail').AsString;
result.supplied_by_customer_ftp := ordersDB.UniQuery1.FieldByName('supplied_by_customer_ftp').AsString;
result.supplied_by_customer_total_inc := ordersDB.UniQuery1.FieldByName('supplied_by_customer_total_inc').AsString;
result.supplied_by_customer_sheets_us := ordersDB.UniQuery1.FieldByName('supplied_by_customer_sheets_us').AsString;
result.supplied_by_customer_initials := ordersDB.UniQuery1.FieldByName('supplied_by_customer_initials').AsString;
// Proofing
result.proofing_pdf := ordersDB.UniQuery1.FieldByName('proofing_pdf').AsBoolean;
result.proofing_pdf_to := ordersDB.UniQuery1.FieldByName('proofing_pdf_to').AsString;
result.proofing_pdf_date_1 := ordersDB.UniQuery1.FieldByName('proofing_pdf_date_1').AsString;
result.proofing_pdf_date_2 := ordersDB.UniQuery1.FieldByName('proofing_pdf_date_2').AsString;
result.proofing_pdf_date_3 := ordersDB.UniQuery1.FieldByName('proofing_pdf_date_3').AsString;
result.proofing_full_size_ink_jet_for := ordersDB.UniQuery1.FieldByName('proofing_full_size_ink_jet_for').AsBoolean;
result.proofing_ink_jet_to := ordersDB.UniQuery1.FieldByName('proofing_ink_jet_to').AsString;
result.proofing_ink_jet_to_2 := ordersDB.UniQuery1.FieldByName('proofing_ink_jet_to').AsString;
result.proofing_ink_jet_date_1 := ordersDB.UniQuery1.FieldByName('proofing_ink_jet_date_1').AsString;
result.proofing_ink_jet_date_2 := ordersDB.UniQuery1.FieldByName('proofing_ink_jet_date_2').AsString;
result.proofing_color_contract := ordersDB.UniQuery1.FieldByName('proofing_color_contract').AsString;
result.proofing_color_contrac_to := ordersDB.UniQuery1.FieldByName('proofing_color_contrac_to').AsString;
result.proofing_color_contrac_date_1 := ordersDB.UniQuery1.FieldByName('proofing_color_contrac_date_1').AsString;
result.proofing_color_contrac_date_2 := ordersDB.UniQuery1.FieldByName('proofing_color_contrac_date_2').AsString;
result.proofing_digital_color_key := ordersDB.UniQuery1.FieldByName('proofing_digital_color_key').AsString;
result.proofing_digital_color_to := ordersDB.UniQuery1.FieldByName('proofing_digital_color_to').AsString;
result.proofing_digital_color_date_1 := ordersDB.UniQuery1.FieldByName('proofing_digital_color_date_1').AsString;
// Colors
result.quantity_and_colors_press_name := ordersDB.UniQuery1.FieldByName('quantity_and_colors_press_name').AsString;
result.quantity_and_colors_anilox_info := ordersDB.UniQuery1.FieldByName('quantity_and_colors_anilox_info').AsString;
result.quantity_and_colors_qty_colors := ordersDB.UniQuery1.FieldByName('quantity_and_colors_qty_colors').AsString;
// Plate Marks
result.plate_marks_microdots := ordersDB.UniQuery1.FieldByName('plate_marks_microdots').AsString;
result.plate_marks_microdots_comments := ordersDB.UniQuery1.FieldByName('plate_marks_microdots_comments').AsString;
result.plate_marks_crosshairs := ordersDB.UniQuery1.FieldByName('plate_marks_crosshairs').AsString;
result.plate_marks_crosshairs_comments := ordersDB.UniQuery1.FieldByName('plate_marks_crosshairs').AsString;
result.plate_marks_color_bars := ordersDB.UniQuery1.FieldByName('plate_marks_color_bars').AsString;
result.plate_marks_color_bars_comments := ordersDB.UniQuery1.FieldByName('plate_marks_color_bars_comments').AsString;
result.plate_marks_other := ordersDB.UniQuery1.FieldByName('plate_marks_other').AsString;
result.plate_marks_other_comments := ordersDB.UniQuery1.FieldByName('plate_marks_other_comments').AsString;
// Print Orientation
result.print_orientation_print_orient := ordersDB.UniQuery1.FieldByName('print_orientation_print_orient').AsString;
// Plate
result.plates_plate_material := ordersDB.UniQuery1.FieldByName('plates_plate_material').AsString;
result.plates_thickness := ordersDB.UniQuery1.FieldByName('plates_thickness').AsString;
result.plates_job_number := ordersDB.UniQuery1.FieldByName('plates_job_number').AsString;
// Layout
result.layout_around := ordersDB.UniQuery1.FieldByName('layout_around').AsString;
result.layout_accross := ordersDB.UniQuery1.FieldByName('layout_accross').AsString;
result.layout_surface_print := ordersDB.UniQuery1.FieldByName('layout_surface_print').AsString;
result.layout_reverse_print := ordersDB.UniQuery1.FieldByName('layout_reverse_print').AsString;
result.layout_cylinder_repeat := ordersDB.UniQuery1.FieldByName('layout_cylinder_repeat').AsString;
result.layout_cutoff_dimension := ordersDB.UniQuery1.FieldByName('layout_cutoff_dimension').AsString;
result.layout_pitch := ordersDB.UniQuery1.FieldByName('layout_pitch').AsString;
result.layout_teeth := ordersDB.UniQuery1.FieldByName('layout_teeth').AsString;
result.layout_bleed := ordersDB.UniQuery1.FieldByName('layout_bleed').AsString;
result.layout_cutback := ordersDB.UniQuery1.FieldByName('layout_cutback').AsString;
result.layout_minimum_trap_dim := ordersDB.UniQuery1.FieldByName('layout_minimum_trap_dim').AsString;
result.layout_maximum_trap_dim := ordersDB.UniQuery1.FieldByName('layout_maximum_trap_dim').AsString;
// UPC
result.upc_size := ordersDB.UniQuery1.FieldByName('upc_size').AsString;
result.upc_bar_width_reduction := ordersDB.UniQuery1.FieldByName('upc_bar_width_reduction').AsString;
result.upc_distortion_percent := ordersDB.UniQuery1.FieldByName('upc_distortion_percent').AsString;
result.upc_distortion_amount := ordersDB.UniQuery1.FieldByName('upc_distortion_amount').AsString;
// General
result.general_comments := ordersDB.UniQuery1.FieldByName('general_comments').AsString;
ordersDB.UniQuery1.Close;
SQL := 'SELECT s.ship_block FROM customers c JOIN customers_ship s ON c.CUSTOMER_ID = s.customer_id WHERE c.CUSTOMER_ID = ' + IntToStr(result.COMPANY_ID);
doQuery(ordersDB.UniQuery1, SQL);
result.ADDRESS_LIST := TList<TAddressItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.ADDRESS_LIST );
while not ordersDB.UniQuery1.Eof do
begin
ADDRESS := TAddressItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( ADDRESS );
ADDRESS.ADDRESS := ordersDB.UniQuery1.FieldByName('ship_block').AsString;
result.ADDRESS_LIST.Add(ADDRESS);
ordersDB.UniQuery1.Next;
end;
ordersDB.UniQuery1.Close;
result.ITEMS := GetItems('');
end;
function TLookupService.GetItems(searchOptions: string): TItemList;
// retrueves all the quickbooks items for the items page on client.
// searchOptions: probably not needed but adds limits to the page to prevent
// table on client side from getting too long. This table currently has about 27
// entries so probably not needed.
var
params: TStringList;
PageNum: integer;
......@@ -685,14 +841,20 @@ begin
params.Delimiter := '&';
params.DelimitedText := searchOptions;
PageNum := StrToInt(params.Values['pagenumber']);
PageSize := StrToInt(params.Values['pagesize']);
OrderBy := params.Values['orderby'];
SQL := 'select * from qb_items';
offset := IntToStr((PageNum - 1) * PageSize);
limit := IntToStr(PageSize);
if ( ( params.Values['pagenumber'] <> '' ) and ( params.Values['pagesize'] <> '' ) ) then
begin
pageNum := StrToInt(params.Values['pagenumber']);
PageSize := StrToInt(params.Values['pagesize']);
OrderBy := params.Values['orderby'];
limit := IntToStr(PageSize);
offset := IntToStr((PageNum - 1) * PageSize);
SQL := SQL + ' limit ' + limit + ' offset ' + offset;
end;
SQL := 'select * from qb_items ' + 'limit ' + limit + ' offset ' + offset;
doQuery(ordersDB.UniQuery1, SQL);
......@@ -720,6 +882,9 @@ begin
end;
function TLookupService.GetUsers(searchOptions: string): TUserList;
// Gets a list of all users for the user edit page.
// searchOptions: username of a specific user otherwise empty.
// TODO: change SQL to hide passwords instead of storing them in plain text.
var
SQL: string;
user: TUserItem;
......@@ -759,6 +924,8 @@ begin
end;
function TLookupService.EditUser(const editOptions: string): string;
// Edits the user.
// editOptions: all user information that will be changed.
var
params: TStringList;
user: string;
......@@ -954,6 +1121,10 @@ end;
function TLookupService.AddCorrugatedOrder(orderInfo: string): TJSONObject;
// Adds corrugated order to the database. This process is done in 3 different
// tables so if any changes are made make sure to check orders, corrugated_plate_orders
// and orders_status_schedule. This also functions as an edit function.
// orderInfo - all the inputted order information from client side.
var
JSONData: TJSONObject;
SQL: string;
......@@ -962,6 +1133,7 @@ var
DateFormat: TFormatSettings;
ORDER_ID: integer;
mode: string;
temp: string;
begin
DateFormat := TFormatSettings.Create;
DateFormat.ShortDateFormat := 'yyyy-mm-dd';
......@@ -1019,13 +1191,19 @@ begin
begin
SQL := 'select * from orders where ORDER_ID = ' + IntToStr(ORDER_ID);
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Edit;
end;
ordersDB.UniQuery1.FieldByName('COMPANY_ID').AsString := JSONData.GetValue<string>('COMPANY_ID');
ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString := 'corrugated_plate';
if mode = 'ADD' then
ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsDateTime := Now;
ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsDateTime := Now
else
begin
// No idea why I need this line but without it an error gets thrown
ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsDateTime := ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsDateTime;
end;
if JSONData.GetValue<string>('staff_fields_price') = '' then
ordersDB.UniQuery1.FieldByName('PRICE').AsString := '0'
......@@ -1040,6 +1218,7 @@ begin
ordersDB.UniQuery1.Close;
//Retrieve Order ID
if mode = 'ADD' then
begin
ordersDB.UniQuery1.SQL.Text := 'SELECT LAST_INSERT_ID() AS OrderID'; // Use database's method to get the last inserted ID
......@@ -1047,6 +1226,40 @@ begin
ORDER_ID := ordersDB.UniQuery1.FieldByName('OrderID').AsInteger;
end;
if mode = 'ADD' then
SQL := 'select * from corrugated_plate_orders where ORDER_ID = 0 and ORDER_ID <> 0'
else
begin
ORDER_ID := JSONData.GetValue<integer>('ORDER_ID');
SQL := 'select * from corrugated_plate_orders where ORDER_ID = ' + IntToStr(ORDER_ID);
end;
doQuery(ordersDB.UniQuery1, SQL);
try
if mode = 'ADD' then
ordersDB.UniQuery1.Insert
else
ordersDB.UniQuery1.Edit;
for Pair in JSONData do
begin
Field := ordersDB.UniQuery1.FindField(Pair.JsonString.Value); // Checks if the field exists in the dataset
if Assigned(Field) then
begin
// handles any dates or datetimes
if (Field is TDateTimeField) and (Pair.JsonValue.Value <> '') then
TDateTimeField(Field).AsDateTime := StrToDate(Pair.JsonValue.Value)
else if Pair.JsonValue.Value <> '' then
Field.AsString := Pair.JsonValue.Value;
end;
end;
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsInteger := ORDER_ID;
// Post the record to the database
ordersDB.UniQuery1.Post;
if JSONData.GetValue<string>('staff_fields_proof_date') <> '' then
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_ship_date') <> '' then
......@@ -1070,9 +1283,14 @@ end;
function TLookupService.AddStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: integer): string;
// Adds/edits orders_status_schedule table.
// StatusType: name of the status getting added to the schedule.
// Order: JSON object containing all of the order info sent from client
// ORDER_ID: order id sent from client if we are in edit mode empty if in add mode
var
SQL: string;
mode: string;
change: boolean;
begin
mode := order.GetValue<string>('mode');
if mode = 'ADD' then
......@@ -1083,7 +1301,7 @@ begin
end
else
begin
SQL := 'select * from orders_status_schedule where ORDER_ID = ' + IntToStr(ORDER_ID);
SQL := 'select * from orders_status_schedule where ORDER_ID = ' + IntToStr(ORDER_ID) + ' AND ORDER_STATUS = ' + quotedStr(StatusType);
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Edit;
end;
......@@ -1093,33 +1311,107 @@ begin
if( (StatusType = 'PROOF') or (StatusType = 'SHIP') ) then
begin
change := ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsString <> order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_date');
ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsString := order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_date');
ordersDB.UniQuery1.FieldByName('ORIGINAL_STATUS_DATE').AsString := order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_date');
if mode <> 'EDIT' then
ordersDB.UniQuery1.FieldByName('ORIGINAL_STATUS_DATE').AsString := order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_date');
end
else
begin
change := ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsDateTime <> StrToDateTime(order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_due'));
ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsDateTime := StrToDateTime(order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_due'));
ordersDB.UniQuery1.FieldByName('ORIGINAL_STATUS_DATE').AsDateTime := StrToDateTime(order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_due'));
if mode <> 'EDIT' then
ordersDB.UniQuery1.FieldByName('ORIGINAL_STATUS_DATE').AsDateTime := StrToDateTime(order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_due'));
end;
ordersDB.UniQuery1.FieldByName('USER_ID').AsString := order.GetValue<string>('USER_ID');
if mode = 'ADD' then
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := 1
else
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger + 1;
begin
if change then
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger + 1;
end;
ordersDB.UniQuery1.Post;
Result := 'success';
end;
function TLookupService.EditStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: string): string;
function TLookupService.SetStatus(statusOptions: string): string;
var
params: TStringList;
StatusInfo: TJSONObject;
ORDER_ID: integer;
Date: String;
Status: string;
UserID: string;
SQL: string;
temp: string;
begin
try
logger.Log(1, 'Set Status Hit');
StatusInfo := TJSONObject.ParseJSONValue(statusOptions) as TJSONObject;
params := TStringList.Create;
// parse the statusOptions
params.Delimiter := '&';
params.StrictDelimiter := true;
params.DelimitedText := statusOptions;
ORDER_ID := StatusInfo.GetValue<integer>('ORDER_ID');
Date := StatusInfo.GetValue<string>('date');
Status := StatusInfo.GetValue<string>('status');
UserID := StatusInfo.GetValue<string>('USER_ID');
SQL := 'select * from orders_status where ORDER_ID = ' + IntToStr(ORDER_ID) + ' AND ' +
'ORDER_STATUS = ' + quotedStr(Status);
logger.Log(1, 'Trying to Set Status');
doQuery(ordersDB.UniQuery1, SQL);
if ordersDB.UniQuery1.IsEmpty then
// Add Status
begin
ordersDB.UniQuery1.Insert;
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsString := IntToStr(ORDER_ID);
ordersDB.UniQuery1.FieldByName('ORDER_STATUS').AsString := Status;
ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsDateTime := StrToDateTime(Date);
ordersDB.UniQuery1.FieldByName('STATUS_TIMESTAMP').AsDateTime := Now;
ordersDB.UniQuery1.FieldByName('USER_ID').AsString := UserID;
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := 1;
end
else
// Edit Status
begin
ordersDB.UniQuery1.Edit;
ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsDateTime := StrToDateTime(Date);
ordersDB.UniQuery1.FieldByName('STATUS_TIMESTAMP').AsDateTime := Now;
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger + 1;
end;
ordersDB.UniQuery1.Post;
if StatusInfo.GetValue<string>('staff_fields_ship_date') <> '12/30/1899' then
AddStatusSchedule('SHIP', StatusInfo, ORDER_ID);
if StatusInfo.GetValue<string>('staff_fields_art_due') <> '12/30/1899' then
AddStatusSchedule('ART', StatusInfo, ORDER_ID);
if StatusInfo.GetValue<string>('staff_fields_plate_due') <> '12/30/1899' then
AddStatusSchedule('PLATE', StatusInfo, ORDER_ID);
if StatusInfo.GetValue<string>('staff_fields_mount_due') <> '12/30/1899' then
AddStatusSchedule('MOUNT', StatusInfo, ORDER_ID);
logger.Log(1, 'Status Successfully set');
result := 'success';
except
on E: Exception do
// This block will catch any exception derived from the Exception class
logger.Log(5, 'An error occurred when setting status: ' + E.Message);
end;
end;
function TLookupService.AddUser(userInfo:string): string;
// Adds a user to the database
// userInfo - user information being added
var
user: string;
password: string;
......@@ -1187,6 +1479,8 @@ begin
end;
function TLookupService.AddItem(itemInfo: string): string;
// Adds an item to the database
// itemInfo: item info to add to database
var
params: TStringList;
Name: string;
......@@ -1226,8 +1520,10 @@ begin
end;
function TLookupService.DelUser(username: string): string;
// deletes a user. not currently implemented definitely needs touching up to avoid
// deleting users prematurely.
// username: username to be deleted.
var
SQL: string;
params: TStringList;
begin
......@@ -1249,6 +1545,125 @@ begin
end;
function TLookupService.AddWebOrder(orderInfo: string): TJSONObject;
// Adds corrugated order to the database. This process is done in 3 different
// tables so if any changes are made make sure to check orders, corrugated_plate_orders
// and orders_status_schedule. This also functions as an edit function.
// orderInfo - all the inputted order information from client side.
var
JSONData, ResponseData: TJSONObject;
SQL: string;
Pair: TJSONPair;
Field: TField;
DateFormat: TFormatSettings;
CurrDate: TDateTime;
ORDER_ID: integer;
mode: string;
temp: string;
begin
DateFormat := TFormatSettings.Create;
DateFormat.ShortDateFormat := 'yyyy-mm-dd';
DateFormat.DateSeparator := '-';
JSONData := TJSONObject.ParseJSONValue(orderInfo) as TJSONObject;
if JSONData = nil then
raise Exception.Create('Invalid JSON format'); // If parsing fails, raise an exception
mode := JSONData.GetValue<string>('mode');
if mode = 'ADD' then
begin
SQL := 'select * from orders where ORDER_ID = 0 and ORDER_ID <> 0';
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Insert;
end
else
begin
SQL := 'select * from orders where ORDER_ID = ' + IntToStr(ORDER_ID);
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Edit;
end;
temp := JSONData.GetValue<string>('COMPANY_ID');
ordersDB.UniQuery1.FieldByName('COMPANY_ID').AsString := JSONData.GetValue<string>('COMPANY_ID');
ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString := 'web_plate';
if mode = 'ADD' then
ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsDateTime := Now
else
begin
// No idea why I need this line but without it an error gets thrown
ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsDateTime := ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsDateTime;
end;
if JSONData.GetValue<string>('staff_fields_price') = '' then
ordersDB.UniQuery1.FieldByName('PRICE').AsString := '0'
else
ordersDB.UniQuery1.FieldByName('PRICE').AsString := JSONData.GetValue<string>('staff_fields_price');
ordersDB.UniQuery1.FieldByName('JOB_NAME').AsString := JSONData.GetValue<string>('staff_fields_job_name');
ordersDB.UniQuery1.FieldByName('USER_ID').AsString := JSONData.GetValue<string>('USER_ID');
ordersDB.UniQuery1.FieldByName('LOCATION').AsString := JSONData.GetValue<string>('staff_fields_art_location');
ordersDB.UniQuery1.Post;
ordersDB.UniQuery1.Close;
if mode = 'ADD' then
begin
ordersDB.UniQuery1.SQL.Text := 'SELECT LAST_INSERT_ID() AS OrderID'; // Use database's method to get the last inserted ID
ordersDB.UniQuery1.Open;
ORDER_ID := ordersDB.UniQuery1.FieldByName('OrderID').AsInteger;
end;
if mode = 'ADD' then
SQL := 'select * from web_plate_orders where ORDER_ID = 0 and ORDER_ID <> 0'
else
begin
ORDER_ID := JSONData.GetValue<integer>('ORDER_ID');
SQL := 'select * from web_plate_orders where ORDER_ID = ' + IntToStr(ORDER_ID);
end;
doQuery(ordersDB.UniQuery1, SQL);
try
if mode = 'ADD' then
ordersDB.UniQuery1.Insert
else
ordersDB.UniQuery1.Edit;
for Pair in JSONData do
begin
Field := ordersDB.UniQuery1.FindField(Pair.JsonString.Value); // Checks if the field exists in the dataset
if Assigned(Field) then
begin
// handles any dates or datetimes
if (Field is TDateTimeField) and (Pair.JsonValue.Value <> '') then
TDateTimeField(Field).AsDateTime := StrToDate(Pair.JsonValue.Value)
else if Pair.JsonValue.Value <> '' then
Field.AsString := Pair.JsonValue.Value;
end;
end;
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsInteger := ORDER_ID;
// Post the record to the database
ordersDB.UniQuery1.Post;
if JSONData.GetValue<string>('staff_fields_proof_date') <> '' then
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_ship_date') <> '' then
AddStatusSchedule('SHIP', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_art_due') <> '' then
AddStatusSchedule('ART', JSONData, ORDER_ID);
if JSONData.GetValue<string>('staff_fields_plate_due') <> '' then
AddStatusSchedule('PLATE', JSONData, ORDER_ID);
Result := TJSONObject.Create.AddPair('status', 'success');
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
except
on E: Exception do
begin
Result := TJSONObject.Create.AddPair('error', E.Message);
end;
end;
end;
initialization
RegisterServiceType(TLookupService);
......
[Settings]
MemoLogLevel=4
FileLogLevel=5
LogFileNum=90
LogFileNum=146
webClientVersion=1.0.0
[Database]
......
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