Commit 39bcaa4d by Mac Stephens

Changed table to twebdbtablecontrol, still working on styling

parent 38b88255
......@@ -26,7 +26,6 @@ object FAddOrder: TFAddOrder
Width = 121
Height = 22
HeightPercent = 100.000000000000000000
Text = 'edtSearch'
WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end
......@@ -37,14 +36,14 @@ object FAddOrder: TFAddOrder
Height = 22
ChildOrder = 1
HeightPercent = 100.000000000000000000
Text = 'WebEdit1'
WidthPercent = 100.000000000000000000
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 0
Top = 166
Top = 146
Width = 871
Height = 303
Height = 331
Align = alBottom
ParentDoubleBuffered = False
DoubleBuffered = True
TabOrder = 2
......@@ -242,13 +241,13 @@ object FAddOrder: TFAddOrder
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 728
Top = 109
Left = 730
Top = 93
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 600
Top = 109
Top = 95
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
......@@ -265,7 +264,7 @@ object FAddOrder: TFAddOrder
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 470
Top = 109
Left = 468
Top = 93
end
end
......@@ -12,8 +12,8 @@ object FViewOrders: TFViewOrders
OnCreate = WebFormCreate
OnShow = WebFormShow
object lblEntries: TWebLabel
Left = 68
Top = 333
Left = 59
Top = 113
Width = 77
Height = 13
Caption = 'Showing 0 of ...'
......@@ -207,7 +207,7 @@ object FViewOrders: TFViewOrders
TabStop = False
WidthPercent = 100.000000000000000000
end
object WebButton2: TWebButton
object btnPDF: TWebButton
Left = 328
Top = 79
Width = 96
......@@ -221,73 +221,181 @@ object FViewOrders: TFViewOrders
TabOrder = 8
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnPDFClick
end
object wdbtcOrders: TWebDBTableControl
Left = 26
Top = 132
Width = 631
Height = 200
ElementClassName = 'table'
ElementId = 'tblPhoneGrid'
BorderColor = clSilver
ChildOrder = 11
ElementFont = efCSS
ElementHeaderClassName = 'thead-light'
ElementPosition = epRelative
ElementTableClassName = 'table table-striped table-hover table-bordered text-sm'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
Footer.ButtonElementClassName = 'btn btn-light'
Footer.DropDownElementClassName = 'form-control'
Footer.InputElementClassName = 'form-control'
Footer.LinkActiveElementClassName = 'link-primary'
Footer.LinkElementClassName = 'link-secondary'
Footer.ListElementClassName = 'pagination'
Footer.ListItemElementClassName = 'page-item'
Footer.ListLinkElementClassName = 'page-link'
Header.ButtonActiveElementClassName = 'btn btn-primary'
Header.ButtonElementClassName = 'btn btn-light'
Header.DropDownElementClassName = 'form-control'
Header.InputElementClassName = 'form-control'
Header.LinkActiveElementClassName = 'link-primary'
Header.LinkElementClassName = 'link-secondary'
Header.ListElementClassName = 'pagination'
Header.ListItemElementClassName = 'page-item'
Header.ListLinkElementClassName = 'page-link'
WordWrap = True
Columns = <
item
DataField = 'ID'
Title = 'ID'
end
item
DataField = 'companyName'
Title = 'Company Name'
end
item
DataField = 'jobName'
Title = 'Job Name'
end
item
DataField = 'orderDate'
Title = 'Order Date'
end
item
DataField = 'proofDue'
Title = 'Proof Due'
end
item
DataField = 'proofDone'
Title = 'Proof Done'
end
item
DataField = 'artDue'
Title = 'Art Due'
end
item
DataField = 'artDone'
Title = 'Art Done'
end
item
DataField = 'mountDue'
Title = 'Mount Due'
end
item
DataField = 'mountDone'
Title = 'Mount Done'
end
item
DataField = 'shipDue'
Title = 'Ship Due'
end
item
DataField = 'shipDone'
Title = 'Ship Done'
end
item
DataField = 'price'
Title = 'Price'
end
item
DataField = 'qbRefNum'
Title = 'Quickbooks Reference Number'
end
item
DataField = 'colors'
Title = 'Colors'
end
item
DataField = 'plateDue'
Title = 'Plate Due'
end
item
DataField = 'plateDone'
Title = 'Plate Done'
end
item
DataField = 'orderType'
Title = 'Order Type'
end>
DataSource = wdsOrders
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 28
Top = 410
end
object XDataWebDataSet1: TXDataWebDataSet
object xdwdsOrders: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 70
Top = 410
object XDataWebDataSet1ID: TStringField
object xdwdsOrdersID: TStringField
FieldName = 'ID'
end
object XDataWebDataSet1companyName: TStringField
object xdwdsOrderscompanyName: TStringField
FieldName = 'companyName'
end
object XDataWebDataSet1jobName: TStringField
object xdwdsOrdersjobName: TStringField
FieldName = 'jobName'
end
object XDataWebDataSet1orderDate: TStringField
object xdwdsOrdersorderDate: TStringField
FieldName = 'orderDate'
end
object XDataWebDataSet1proofDue: TStringField
object xdwdsOrdersproofDue: TStringField
FieldName = 'proofDue'
end
object XDataWebDataSet1proofDone: TStringField
object xdwdsOrdersproofDone: TStringField
FieldName = 'proofDone'
end
object XDataWebDataSet1artDue: TStringField
object xdwdsOrdersartDue: TStringField
FieldName = 'artDue'
end
object XDataWebDataSet1artDone: TStringField
object xdwdsOrdersartDone: TStringField
FieldName = 'artDone'
end
object XDataWebDataSet1mountDue: TStringField
object xdwdsOrdersmountDue: TStringField
FieldName = 'mountDue'
end
object XDataWebDataSet1mountDone: TStringField
object xdwdsOrdersmountDone: TStringField
FieldName = 'mountDone'
end
object XDataWebDataSet1shipDue: TStringField
object xdwdsOrdersshipDue: TStringField
FieldName = 'shipDue'
end
object XDataWebDataSet1shipDone: TStringField
object xdwdsOrdersshipDone: TStringField
FieldName = 'shipDone'
end
object XDataWebDataSet1price: TStringField
object xdwdsOrdersprice: TStringField
FieldName = 'price'
end
object XDataWebDataSet1qbRefNum: TStringField
object xdwdsOrdersqbRefNum: TStringField
FieldName = 'qbRefNum'
end
object XDataWebDataSet1colors: TStringField
object xdwdsOrderscolors: TStringField
FieldName = 'colors'
end
object XDataWebDataSet1plateDue: TStringField
object xdwdsOrdersplateDue: TStringField
FieldName = 'plateDue'
end
object XDataWebDataSet1plateDone: TStringField
object xdwdsOrdersplateDone: TStringField
FieldName = 'plateDone'
end
object XDataWebDataSet1orderType: TStringField
object xdwdsOrdersorderType: TStringField
FieldName = 'orderType'
end
end
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
object wdsOrders: TWebDataSource
DataSet = xdwdsOrders
Left = 120
Top = 410
end
......
<div class="container vh-100 d-flex flex-column pb-5" style="max-width: 80%;">
<div class="container h-100 d-flex flex-column mt-0" style="max-width: 85%;">
<!-- Alert Section -->
<div class="row">
<div class="col-sm">
......@@ -46,7 +45,10 @@
<button id="btnsetstatus" class="btn btn-secondary mt-3">Set Status</button>
</div>
<div class="col-auto">
<button id="btngeneratepdf" class="btn btn-secondary mt-3">Generate PDF</button>
<button id="btngeneratepdf" class="btn btn-secondary mt-3" type="button">Generate PDF</button>
<div class="invalid-feedback">
No order selected. Please select an order to generate a PDF.
</div>
</div>
<div class="col-auto">
<button id="btnfilters" class="btn btn-secondary mt-3">Filters</button>
......@@ -67,34 +69,20 @@
</div>
<!-- Table Section -->
<div id="order_table_section" class="overflow-auto mt-2 flex-grow-1">
<div id="order_table_section" class="overflow-auto mt-2"
style="max-height: calc(100vh - 380px); border-bottom: none; padding-bottom: 0;">
<table id="tblPhoneGrid" class="table table-striped table-bordered">
<thead style="position: sticky; top: 0; z-index: 1; background-color: white; border-bottom: 2px solid #dee2e6;">
<tr>
<th>Order ID</th>
<th>Company Name</th>
<th>Job Name</th>
<th>Order Date</th>
<th>Proof Due</th>
<th>Proof Date</th>
<th>Art Due</th>
<th>Art Done</th>
<th>Plate Due</th>
<th>Plate Done</th>
<th>Mount Due</th>
<th>Mount Done</th>
<th>Ship Due</th>
<th>Ship Done</th>
<th>Price</th>
<th>QuickBooks Ref Number</th>
<th>Colors</th>
<thead class="sticky-top bg-light">
<tr style="font-size: 0.875rem;">
<!-- Table headers are dynamically generated -->
</tr>
</thead>
<tbody>
<!-- Rows will be dynamically added -->
<tbody id="orderTableBody" class="align-middle">
<!-- Table rows are dynamically generated -->
</tbody>
</table>
</div>
</div>
<!-- Pagination Section -->
<div class="container mt-4">
......
{
"AuthUrl" : "http://localhost:2004/emsys/kgOrders/auth/",
"ApiUrl" : "http://localhost:2004/emsys/kgOrders/api/",
"ApiUrl" : "http://localhost:2004/emsys/kgOrders/api/"
}
......@@ -279,6 +279,20 @@ input[type="text"] {
color: #fff !important;
}
.card {
border: none !important;
box-shadow: none !important; /* If shadow is causing the issue */
}
.color-column {
width: 200px; /* Fixed width for the column */
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis; /* Adds ellipsis */
}
.grid-container {
position: relative; /* Ensure the container is the reference for child positioning */
......
......@@ -216,6 +216,7 @@ type
function EditUser(const editOptions: string): string;
function AddCorrugatedOrder(orderInfo: string): TJSONObject;
function AddStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: integer): string;
function GenerateOrderPDF(OrderID: string): string;
end;
implementation
......
......@@ -11,7 +11,7 @@ interface
uses
XData.Server.Module,
XData.Service.Common,
KGOrders.Database, Data.DB,
KGOrders.Database, Data.DB, rOrders, frxClass, frxExportPDF,
Lookup.Service, System.Hash, System.Classes, System.JSON;
......@@ -39,6 +39,7 @@ type
function EditStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: string): string;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
function GenerateOrderPDF(OrderID: string): string;
end;
implementation
......@@ -988,6 +989,39 @@ begin
end;
end;
function TLookupService.GenerateOrderPDF(OrderID: string): string;
var
ReportFileName: string;
Stream: TMemoryStream;
Base64PDF: string;
begin
// try
// // Create an instance of the rptOrders DataModule
// rptOrders := TrptOrders.Create(nil);
// Stream := TMemoryStream.Create;
//
// // Prepare the report using the rptOrders DataModule
// rptOrders.PrepareReport(OrderID);
//
// // Export the report to a PDF file in memory
// rptOrders.frxReport.Export(rptOrders.frxReport.FindComponent('frxPDFExport') as TfrxPDFExport, Stream);
//
// // Optionally save PDF to a file (optional)
// ReportFileName := TPath.Combine('C:\Reports\', 'Order_' + OrderID + '.pdf');
// Stream.SaveToFile(ReportFileName);
//
// // Convert to Base64 if you want to send it back as a string
// Stream.Position := 0;
// Base64PDF := TNetEncoding.Base64.EncodeBytesToString(Stream.Memory, Stream.Size);
// Result := Base64PDF;
// finally
// rptOrders.Free;
// Stream.Free;
// end;
end;
initialization
RegisterServiceType(TLookupService);
......
object rptOrders: TrptOrders
Left = 0
Top = 0
Caption = 'rptOrders'
ClientHeight = 441
ClientWidth = 624
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
TextHeight = 15
object frxReport1: TfrxReport
Version = '2024.2.1'
DotMatrixReport = False
IniFile = '\Software\Fast Reports'
PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick, pbCopy, pbSelection]
PreviewOptions.Zoom = 1.000000000000000000
PrintOptions.Printer = 'Default'
PrintOptions.PrintOnSheet = 0
ReportOptions.CreateDate = 45639.622835810190000000
ReportOptions.LastChange = 45639.622835810190000000
ScriptLanguage = 'PascalScript'
ScriptText.Strings = (
'begin'
''
'end.')
Left = 282
Top = 158
Datasets = <>
Variables = <>
Style = <>
end
object frxPDFExport1: TfrxPDFExport
UseFileCache = True
ShowProgress = True
OverwritePrompt = False
DataOnly = False
EmbedFontsIfProtected = False
InteractiveFormsFontSubset = 'A-Z,a-z,0-9,#43-#47 '
OpenAfterExport = False
PrintOptimized = False
Outline = False
Background = False
HTMLTags = True
Quality = 95
Author = 'FastReport'
Subject = 'FastReport PDF export'
Creator = 'FastReport'
ProtectionFlags = [ePrint, eModify, eCopy, eAnnot]
HideToolbar = False
HideMenubar = False
HideWindowUI = False
FitWindow = False
CenterWindow = False
PrintScaling = False
PdfA = False
PDFStandard = psNone
PDFVersion = pv17
Left = 282
Top = 106
end
end
unit rOrders;
interface
uses
System.SysUtils, System.Classes, frxClass, frxDBSet,
frxExportBaseDialog, frxExportPDF, frCoreClasses, Uni, Data.DB,
XData.Service.Common, Aurelius.Mapping.Attributes, System.JSON, System.Generics.Collections;
type
TrptOrders = class(TDataModule)
frxReport: TfrxReport;
frxPDFExport: TfrxPDFExport;
frxDBDataset: TfrxDBDataset;
DataSource: TDataSource;
UniQuery: TUniQuery;
frxReport1: TfrxReport;
frxPDFExport1: TfrxPDFExport;
private
{ Private declarations }
public
{ Public declarations }
procedure PrepareReport(OrderID: string);
end;
var
rptOrders: TrptOrders;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
{ TrptOrders }
procedure TrptOrders.PrepareReport(OrderID: string);
var
SQL: string;
begin
try
// 1. **Prepare the Query**
SQL := 'SELECT * FROM orders WHERE ORDER_ID = :OrderID';
UniQuery.Close;
UniQuery.SQL.Text := SQL;
UniQuery.ParamByName('OrderID').AsString := OrderID;
UniQuery.Open;
// 2. **Connect the Query to the Report**
frxDBDataset.DataSet := UniQuery;
// 3. **Set Report Variables (if needed)**
frxReport.Variables['OrderID'] := QuotedStr(OrderID);
// 4. **Prepare the Report**
frxReport.PrepareReport(True);
except
on E: Exception do
raise Exception.Create('Error preparing the report: ' + E.Message);
end;
end;
end.
......@@ -20,7 +20,8 @@ uses
Auth.ServiceImpl in 'Source\Auth.ServiceImpl.pas',
Lookup.ServiceImpl in 'Source\Lookup.ServiceImpl.pas',
App.Server.Module in 'Source\App.Server.Module.pas' {AppServerModule: TDataModule},
Data in 'Source\Data.pas' {FData};
Data in 'Source\Data.pas' {FData},
rOrders in 'Source\rOrders.pas' {rptOrders};
type
TMemoLogAppender = class( TInterfacedObject, ILogAppender )
......
......@@ -164,6 +164,10 @@
<Form>FData</Form>
<FormType>dfm</FormType>
</DCCReference>
<DCCReference Include="Source\rOrders.pas">
<Form>rptOrders</Form>
<FormType>dfm</FormType>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
......
[Settings]
MemoLogLevel=5
FileLogLevel=5
LogFileNum=21
LogFileNum=25
webClientVersion=1.0.0
[Database]
--Server=192.168.159.132
Server=192.168.198.131
--Server=192.168.75.133
Password=emsys!012
--Server=192.168.198.131
Server=192.168.102.130
--Password=emsys!012
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