Commit 738e0705 by cam

OrderEntry autofills information

Currently this is hard coded when pressing  add order but I will fix it later
parent f2c46524
...@@ -64,7 +64,7 @@ uses ...@@ -64,7 +64,7 @@ uses
View.Users, View.Users,
View.EditUser, View.EditUser,
View.Orders, View.Orders,
View.ReportRequirements; View.OrderEntry;
{$R *.dfm} {$R *.dfm}
...@@ -175,7 +175,7 @@ procedure TFViewMain.ViewOrderEntry( orderInfo: string); ...@@ -175,7 +175,7 @@ procedure TFViewMain.ViewOrderEntry( orderInfo: string);
begin begin
if Assigned(FChildForm) then if Assigned(FChildForm) then
FChildForm.Free; FChildForm.Free;
FChildForm := TFReportRequirements.CreateForm(WebPanel1.ElementID, orderInfo); FChildForm := TFOrderEntry.CreateForm(WebPanel1.ElementID, orderInfo);
end; end;
procedure TFViewMain.ShowUserForm(Info: string); procedure TFViewMain.ShowUserForm(Info: string);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Company Name:</label> <label for="wdbe_first_name" class="form-label mt-2">Company Name:</label>
<input id="edtcompanyname" type="text" class="form-control" width=300px/> <input id="edtcompanyname" type="text" class="form-control" width=150px/>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Account Company Name:</label> <label for="wdbe_first_name" class="form-label mt-2">Account Company Name:</label>
...@@ -317,49 +317,5 @@ ...@@ -317,49 +317,5 @@
</div> </div>
</div> </div>
<script> <script>
document.getElementById('btnaddcolor').addEventListener('click', function() {
const container = document.getElementById('additionalFields');
// Create a new row for the new fields
const newRow = document.createElement('div');
newRow.className = 'row mb-2';
// Labels and inputs
const labels = ['#', 'Color', 'LPI', 'Size'];
labels.forEach(label => {
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%';
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);
// Add the new row to the container
container.appendChild(newRow);
});
</script> </script>
...@@ -255,6 +255,7 @@ begin ...@@ -255,6 +255,7 @@ begin
colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1colors.Value)); colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1colors.Value));
colorList := TJSArray(colorObject['items']); colorList := TJSArray(colorObject['items']);
colors := colorList.flength; colors := colorList.flength;
console.log(colorList);
Cell.innerText := IntToStr(colors); Cell.innerText := IntToStr(colors);
end; end;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
......
unit View.ReportRequirements;
interface
uses
System.SysUtils, 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;
type
TFReportRequirements = class(TWebForm)
clntReportRequirements: TXDataWebClient;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
dtpOrderDate: TWebDateTimePicker;
dtpProofDate: TWebDateTimePicker;
dtpShipDate: TWebDateTimePicker;
WebLabel1: TWebLabel;
WebLabel2: TWebLabel;
dtpArtDue: TWebDateTimePicker;
dtpPlateDue: TWebDateTimePicker;
dtpMountDue: TWebDateTimePicker;
WebLabel3: TWebLabel;
cbBWCopy: TWebCheckBox;
cbColorCopy: TWebCheckBox;
cbPlates: TWebCheckBox;
cbDiskOrCD: TWebCheckBox;
cbSampleCarton: TWebCheckBox;
WebLabel4: TWebLabel;
cbExcaliburDie: TWebCheckBox;
WebLabel5: TWebLabel;
cbLoose: TWebCheckBox;
cbStickyBak: TWebCheckBox;
cbFullMount: TWebCheckBox;
cbStripMount: TWebCheckBox;
WebLabel6: TWebLabel;
WebButton1: TWebButton;
WebLabel7: TWebLabel;
cbFullSizePanel: TWebCheckBox;
cbPrintCard: TWebCheckBox;
cbWideFormat: TWebCheckBox;
cbPDFFile: TWebCheckBox;
cbArtApprovedAsIs: TWebCheckBox;
dtpApprovedDate: TWebDateTimePicker;
WebLabel8: TWebLabel;
WebLabel9: TWebLabel;
edtCompanyName: TWebDBEdit;
edtCompanyAccountName: TWebDBEdit;
edtInQuickBooks: TWebDBEdit;
edtShipVia: TWebDBEdit;
edtQuantity: TWebDBEdit;
edtPrice: TWebDBEdit;
edtInvoiceTo: TWebDBEdit;
edtShipTo: TWebDBEdit;
edtPONumber: TWebDBEdit;
edtJobName: TWebDBEdit;
edtQuickBooksItem: TWebDBEdit;
edtArtLocation: TWebDBEdit;
edtDimensionalLayout: TWebDBEdit;
edtEmail: TWebDBEdit;
edtFTP: TWebDBEdit;
edtOther: TWebDBEdit;
edtExistingCuttingDie: TWebDBEdit;
edtRefArtPrintCard: TWebDBEdit;
edtRefArtAPDF: TWebDBEdit;
edtCADFile: TWebDBEdit;
edtAroundNo: TWebDBEdit;
edtAcrossNo: TWebDBEdit;
edtDieCutNo: TWebDBEdit;
edtRSCD: TWebDBEdit;
edtRSCW: TWebDBEdit;
edtRSCL: TWebDBEdit;
edtCustomAdhesive: TWebDBEdit;
edtCustomBacking: TWebDBEdit;
edtStandardSetup: TWebDBEdit;
edtStripMount: TWebDBEdit;
edtLoose: TWebDBEdit;
edtRSCStyle: TWebDBEdit;
edtProofOther: TWebDBEdit;
edtProofShipTo: TWebDBEdit;
edtEmailAttn: TWebDBEdit;
edtProofEmail: TWebDBEdit;
edtFaxAttn: TWebDBEdit;
edtFax: TWebDBEdit;
edtClemson: TWebDBEdit;
edtCrossHairs: TWebDBEdit;
edtMachineIndent: TWebDBEdit;
edtCylinderSize: TWebDBEdit;
edtJobNumber: TWebDBEdit;
edtPlateMaterial: TWebDBEdit;
edtThickness: TWebDBEdit;
procedure WebFormCreate(Sender: TObject);
procedure HideNotification();
procedure ShowNotification(Notification: string);
private
FAgencyCode: string;
FCurrentReportType: string;
FSelectProc: TSelectProc;
//FJSONProc1: TJSONProc1;
public
class function CreateForm(AElementID, orderInfo: string): TWebForm;
end;
var
FReportRequirements: TFReportRequirements;
implementation
{$R *.dfm}
uses
View.Home;
class function TFReportRequirements.CreateForm(AElementID, orderInfo: string): TWebForm;
begin
Application.CreateForm(TFReportRequirements, AElementID, Result,
procedure(AForm: TObject)
begin
with TFReportRequirements(AForm) do
begin
HideNotification;
end;
end
);
end;
procedure TFReportRequirements.WebFormCreate(Sender: TObject);
begin
if not DMConnection.ApiConnection.Connected then
begin
DMConnection.ApiConnection.OpenAsync;
console.log('report requirements connection open')
end;
end;
procedure TFReportRequirements.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFReportRequirements.ShowNotification(Notification: string);
begin
if Notification <> '' then
begin
lblMessage.Caption := Notification;
pnlMessage.ElementHandle.hidden := False;
end;
end;
initialization
RegisterClass(TFReportRequirements);
end.
...@@ -17,7 +17,7 @@ uses ...@@ -17,7 +17,7 @@ uses
View.Users in 'View.Users.pas' {FViewUsers: TWebForm} {*.html}, View.Users in 'View.Users.pas' {FViewUsers: TWebForm} {*.html},
View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html}, View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html},
View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html}, View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html},
View.ReportRequirements in 'View.ReportRequirements.pas' {FReportRequirements: TWebForm} {*.html}; View.OrderEntry in 'View.OrderEntry.pas' {FOrderEntry: TWebForm} {*.html};
{$R *.res} {$R *.res}
......
...@@ -166,8 +166,8 @@ ...@@ -166,8 +166,8 @@
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="View.ReportRequirements.pas"> <DCCReference Include="View.OrderEntry.pas">
<Form>FReportRequirements</Form> <Form>FOrderEntry</Form>
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
......
...@@ -80,6 +80,95 @@ type ...@@ -80,6 +80,95 @@ type
data: TList<TOrderItem> data: TList<TOrderItem>
end; end;
TFullOrder = class
Public
//Company
companyName: string;
accountCompanyName: string;
inQuickBooks: string;
// Staff Fields:
orderDate: string;
proofDate: string;
shipDate: string;
shipVia: string;
Quantity: string;
price: string;
invoiceTo: string;
shipTo: string;
poNumber: string;
jobName: string;
quickBooksItem: string;
artDue: string;
plateDue: string;
mountDue: string;
artLocation: string;
// Supplied by Customer:
bwCopy: boolean;
colorCopy: boolean;
plates: boolean;
sampleCarton: boolean;
dimensionalLayout: string;
diskOrCD: boolean;
email: string;
ftp: string;
other: string;
existingCuttingDie: string;
refArtPrintCard: string;
refArtAPDF: string;
// Layout
rscl: string;
rscw: string;
rscd: string;
dieCutNo: string;
acrossNo: string;
aroundNo: string;
cadFile: string;
excalliburDie: boolean;
rscStyle: string;
// Mounting
loose: string;
stickyBak: boolean;
fullMount: boolean;
stripMount: string;
standardSetup: string;
customBacking: string;
customAdhesive: string;
// Colors
cylinderSize: string;
machineIdent: string;
crossHairs: string;
clemson: string;
colors: string;
// Proofing
fax: string;
faxAttn: string;
proofEmail: string;
emailAttn: string;
proofShipTo: string;
fullSizePanel: boolean;
printCard: boolean;
wideFormat: boolean;
pdfFile: boolean;
proofOther: string;
artApprovedAsIs: boolean;
approvedDate: string;
// Plates
thickness: string;
plateMaterial: string;
jobNumber: string;
// General
specialInstructions: string;
end;
type type
...@@ -90,6 +179,8 @@ type ...@@ -90,6 +179,8 @@ type
[HttpGet] function GetUsers(searchOptions: string): TUserList; [HttpGet] function GetUsers(searchOptions: string): TUserList;
[HttpGet] function GetItems(searchOptions: string): TItemList; [HttpGet] function GetItems(searchOptions: string): TItemList;
[HttpGet] function GetOrders(searchOptions: string): TOrderList; [HttpGet] function GetOrders(searchOptions: string): TOrderList;
[HttpGet] function GetOrder(orderInfo: string): TFullOrder;
function AddUser(userInfo: string): string; function AddUser(userInfo: string): string;
function AddItem(itemInfo: string): string; function AddItem(itemInfo: string): string;
function DelUser(username: string): string; function DelUser(username: string): string;
......
...@@ -24,6 +24,7 @@ type ...@@ -24,6 +24,7 @@ type
function GetItems(searchOptions: string): TItemList; function GetItems(searchOptions: string): TItemList;
function GetUsers(searchOptions: string): TUserList; function GetUsers(searchOptions: string): TUserList;
function GetOrders(searchOptions: string): TOrderList; function GetOrders(searchOptions: string): TOrderList;
function GetOrder(orderInfo: string): TFullOrder;
function EditUser(const editOptions: string): string; function EditUser(const editOptions: string): string;
function Search(phoneNum: string): TOrderList; function Search(phoneNum: string): TOrderList;
function AddUser(userInfo: string): string; function AddUser(userInfo: string): string;
...@@ -215,6 +216,187 @@ begin ...@@ -215,6 +216,187 @@ begin
ordersDB.UniQuery1.Close; ordersDB.UniQuery1.Close;
end; end;
function TLookupService.GetOrder(orderInfo: string): TFullOrder;
var
orderType: string;
orderID: string;
SQL: string;
table: string;
begin
orderID := orderInfo;
SQL := 'select ORDER_TYPE from orders where ORDER_ID = ' + quotedStr(orderID);
doQuery(ordersDB.UniQuery1, SQL);
orderType := ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString;
if orderType = 'web_plate' then
table := 'web_plate_orders'
else
table := 'corrugated_plate_orders';
SQL := 'select * from ' + table + ' o JOIN customers c ON c.CUSTOMER_ID = o.COMPANY_ID where ORDER_ID = ' + quotedStr(orderID);
doQuery(ordersDB.UniQuery1, SQL);
result := TFullOrder.Create;
// Company
result.companyName := ordersDB.UniQuery1.FieldByName('NAME').AsString;
result.accountCompanyName := ordersDB.UniQuery1.FieldByName('SHORT_NAME').AsString;
result.inQuickBooks := '?';
// Staff Fields
result.orderDate := ordersDB.UniQuery1.FieldByName('staff_fields_order_date').AsString;
result.proofDate := ordersDB.UniQuery1.FieldByName('staff_fields_proof_date').AsString;
result.shipDate := ordersDB.UniQuery1.FieldByName('staff_fields_ship_date').AsString;
result.shipVia := ordersDB.UniQuery1.FieldByName('staff_fields_ship_via').AsString;
result.Quantity := ordersDB.UniQuery1.FieldByName('staff_fields_quantity').AsString;
result.shipTo := ordersDB.UniQuery1.FieldByName('staff_fields_ship_to').AsString;
result.poNumber := ordersDB.UniQuery1.FieldByName('staff_fields_po_number').AsString;
result.jobName := ordersDB.UniQuery1.FieldByName('staff_fields_job_name').AsString;
result.quickBooksItem := ordersDB.UniQuery1.FieldByName('staff_fields_quickbooks_item').AsString;
result.artDue := ordersDB.UniQuery1.FieldByName('staff_fields_art_due').AsString;
result.plateDue := ordersDB.UniQuery1.FieldByName('staff_fields_plate_due').AsString;
if orderType = 'corrugated_plate_order' then
result.mountDue := ordersDB.UniQuery1.FieldByName('staff_fields_mount_due').AsString;
result.artLocation := ordersDB.UniQuery1.FieldByName('staff_fields_art_location').AsString;
// Supplied by Customer
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_b_w_copy').AsString = 'T' then
result.bwCopy := true
else
result.bwCopy := false;
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_color_copy').AsString = 'T' then
result.colorCopy := true
else
result.colorCopy := false;
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_plates').AsString = 'T' then
result.plates := true
else
result.plates := false;
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_sample_ca').AsString = 'T' then
result.sampleCarton := true
else
result.sampleCarton := false;
result.dimensionalLayout := ordersDB.UniQuery1.FieldByName('supplied_by_customer_dimension').AsString;
if orderType = 'web_plate' then
begin
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_disk').AsString = 'T' then
result.diskOrCD := true
else
result.diskOrCD := false;
end
else
begin
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_disk_or_cd').AsString = 'T' then
result.diskOrCD := true
else
result.diskOrCD := false;
end;
result.email := ordersDB.UniQuery1.FieldByName('supplied_by_customer_e_mail').AsString;
result.ftp := ordersDB.UniQuery1.FieldByName('supplied_by_customer_ftp').AsString;
result.other := ordersDB.UniQuery1.FieldByName('supplied_by_customer_other').AsString;
if orderType = 'corrugated_plate' then
begin
result.existingCuttingDie := ordersDB.UniQuery1.FieldByName('supplied_by_customer_existing_').AsString;
result.refArtPrintCard := ordersDB.UniQuery1.FieldByName('supplied_by_customer_ref_art_p').AsString;
result.refArtAPDF := ordersDB.UniQuery1.FieldByName('supplied_by_customer_ref_art_a').AsString;
end;
// Layout
if orderType = 'corrugated_plate' then
begin
result.rscl := ordersDB.UniQuery1.FieldByName('layout_rsc_l').AsString;
result.rscw := ordersDB.UniQuery1.FieldByName('layout_rcs_w').AsString;
result.rscd := ordersDB.UniQuery1.FieldByName('layout_rcs_d').AsString;
result.dieCutNo := ordersDB.UniQuery1.FieldByName('layout_die_cut_no').AsString;
result.acrossNo := ordersDB.UniQuery1.FieldByName('layout_accross_no').AsString;
result.aroundNo := ordersDB.UniQuery1.FieldByName('layout_around_no').AsString;
result.cadFile := ordersDB.UniQuery1.FieldByName('layout_cad_file').AsString;
if ordersDB.UniQuery1.FieldByName('layout_excalibur_die').AsString = 'T' then
result.excalliburDie := true
else
result.excalliburDie := false;
result.rscStyle := ordersDB.UniQuery1.FieldByName('layout_rsc_style').AsString;
end
else
begin
result.acrossNo := ordersDB.UniQuery1.FieldByName('layout_accross').AsString;
result.aroundNo := ordersDB.UniQuery1.FieldByName('layout_around').AsString;
end;
// Mounting & Colors & Proofing
if orderType = 'corrugated_plate' then
begin
result.loose := ordersDB.UniQuery1.FieldByName('mounting_loose').AsString;
if ordersDB.UniQuery1.FieldByName('mounting_sticky_bak').AsString = 'T' then
result.stickyBak := true
else
result.stickyBak := false;
if ordersDB.UniQuery1.FieldByName('mounting_full_mount').AsString = 'T' then
result.fullMount := true
else
result.fullMount := false;
result.stripMount := ordersDB.UniQuery1.FieldByName('mounting_strip_mount').AsString;
result.standardSetup := ordersDB.UniQuery1.FieldByName('mounting_standard_setup').AsString;
result.customBacking := ordersDB.UniQuery1.FieldByName('mounting_custom_backing').AsString;
result.customAdhesive := ordersDB.UniQuery1.FieldByName('mounting_custom_adhesive').AsString;
result.cylinderSize := ordersDB.UniQuery1.FieldByName('colors_cylinder_size').AsString;
result.machineIdent := ordersDB.UniQuery1.FieldByName('colors_machine_ident').AsString;
result.crossHairs := ordersDB.UniQuery1.FieldByName('colors_cross_hairs').AsString;
result.clemson := ordersDB.UniQuery1.FieldByName('colors_clemson').AsString;
result.colors := ordersDB.UniQuery1.FieldByName('colors_colors').AsString;
result.fax := ordersDB.UniQuery1.FieldByName('proofing_fax').AsString;
result.faxAttn := ordersDB.UniQuery1.FieldByName('proofing_fax_attn').AsString;
result.proofEmail := ordersDB.UniQuery1.FieldByName('proofing_e_mail').AsString;
result.proofShipTo := ordersDB.UniQuery1.FieldByName('proofing_ship_to').AsString;
if ordersDB.UniQuery1.FieldByName('proofing_full_size_panel').AsString = 'T' then
result.fullSizePanel := true
else
result.fullSizePanel := false;
if ordersDB.UniQuery1.FieldByName('proofing_print_card').AsString = 'T'then
result.printCard := true
else
result.printCard := false;
if ordersDB.UniQuery1.FieldByName('proofing_wide_format').AsString = 'T'then
result.wideFormat := true
else
result.wideFormat := false;
if ordersDB.UniQuery1.FieldByName('proofing_pdf_file').AsString = 'T'then
result.pdfFile := true
else
result.pdfFile := false;
result.proofOther := ordersDB.UniQuery1.FieldByName('proofing_other').AsString;
if ordersDB.UniQuery1.FieldByName('proofing_art_approved_as_is').AsString = 'T'then
result.artApprovedAsIs := true
else
result.artApprovedAsIs := false;
result.approvedDate := ordersDB.UniQuery1.FieldByName('proofing_approved_date').AsString;
end
else
begin
result.colors := ordersDB.UniQuery1.FieldByName('quatity_and_colors_qty_colors').AsString;
if ordersDB.UniQuery1.FieldByName('proofing_pdf').AsString = 'T'then
result.pdfFile := true
else
result.pdfFile := false;
end;
// Plates
result.thickness := ordersDB.UniQuery1.FieldByName('plates_thickness').AsString;
result.plateMaterial := ordersDB.UniQuery1.FieldByName('plates_plate_material').AsString;
result.jobNumber := ordersDB.UniQuery1.FieldByName('plates_job_number').AsString;
// General
if orderType = 'corrugated_plate' then
result.specialInstructions := ordersDB.UniQuery1.FieldByName('general_special_instructions').AsString
else
result.specialInstructions := ordersDB.UniQuery1.FieldByName('general_comments').AsString
end;
function TLookupService.GetItems(searchOptions: string): TItemList; function TLookupService.GetItems(searchOptions: string): TItemList;
var var
params: TStringList; params: TStringList;
......
[Options] [Options]
LogFileNum=101 LogFileNum=109
UpdateTimerLength=0 UpdateTimerLength=0
......
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