i want to use teechart to show a bargraph of the daily sales made within a given time periode using teechart but i am getting error data type conversion is not supported
MDB.FDQuery1.SQL.Text :=
'SELECT DateCreated, SUM(TotalAmount) AS DailySales ' +
'FROM SalesReceipts ' +
'WHERE DateCreated BETWEEN :StartDate AND :EndDate ' +
'GROUP BY DateCreated ' +
'ORDER BY DateCreated';
// Assign the date parameters for the query
MDB.FDQuery1.ParamByName('StartDate').Value := DatePicker1.Date;
MDB.FDQuery1.ParamByName('EndDate').Value := DatePicker2.Date;
// Open the query
MDB.FDQuery1.Open;
// Bind the dataset to the chart
Series1.DataSource := MDB.FDQuery1;
Series1.XLabelsSource := 'DateCreated';
Series1.YValues.ValueSource := 'DailySales';
// Refresh the chart
DBChart1.RefreshData;
tables in firebird 2.5:
CREATE TABLE SalesReceipts (
ID INT NOT NULL PRIMARY KEY,
DateCreated DATE NOT NULL,
TotalAmount NUMERIC(10, 2),
Discount NUMERIC(10, 2),
Versement NUMERIC(10, 2),
IsClosed SMALLINT DEFAULT 0
);
CREATE TABLE SalesReceiptDetails (
ReceiptDetailID INT NOT NULL PRIMARY KEY,
ReceiptID INT NOT NULL, -- Changed data type to match SalesReceipts
ProductID INT NOT NULL,
ReceiptBarcode CHAR(7),
ProductName VARCHAR(255) NOT NULL,
Price NUMERIC(10, 2) NOT NULL,
QuantitySold INT NOT NULL,
Subtotal NUMERIC(10, 2),
FOREIGN KEY (ReceiptID) REFERENCES SalesReceipts(ID),
FOREIGN KEY (ProductID) REFERENCES PRODUCTS(ID)
);