Hi, I just need some small addon to my code.
1 ist add a pre-build fun and a make this query to work on my MySQL 8 server
the idea is to have the func pass the data to my already done UI
the table is :
CREATE TABLE `maverage` (
`id` int(7) unsigned NOT NULL AUTO_INCREMENT,
`provider` varchar(35) DEFAULT NULL, /* select from benefic table */
`af1` int(7) DEFAULT NULL,
`af2` int(7) DEFAULT NULL,
`am1` int(7) DEFAULT NULL,
`am2` int(7) DEFAULT NULL,
`at1` int(7) DEFAULT NULL,
`at2` int(7) DEFAULT NULL,
`media` int(7) DEFAULT NULL, /* sum of af1 to at2 divided by 6 */
`largura` int(7) DEFAULT NULL,
`comprimento` int(7) DEFAULT NULL,
`pmc` int(7) DEFAULT '2.50', /* price per cubic meters */
`totalmedida` int(7) DEFAULT NULL, /* will be media x largura x cumprimento */
`totalprice` int(7) DEFAULT NULL, /* will be result of totalmedida x pmc
and the format needs to be lkie 1.000,00 if the result is 1000
for example. */
`dtcompra` date DEFAULT NULL,
`dtentrega` date DEFAULT NULL,
`status` varchar(15) DEFAULT NULL, /* Pago, Parcial, Em Aberto, Outro */
`obs` text,
`data_criado` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
INSERT INTO `maverage` VALUES (1, 'madeiras comp', 2.52, 2.45, 2.72, 2.65, 2.51, 2.49, 2.55, 10.50, 3.25, 2.50, 87.01, 221.87, '2020-03-03', '2020-03-05', 'Pago', ' Lenha ceca', '2020-03-05 00:00:01');
INSERT INTO `maverage` VALUES (1, 'lugar da madeira', 2.53, 2.46, 2.73, 2.66, 2.52, 2.50, 2.56, 10.20, 3.15, 2.50, 82.25, 205.62, '2020-04-05', '2020-03-07', 'Pago', ' Lenha ceca', '2020-03-06 00:00:02');
SELECT af1, af2, am1, am2, at1, at2 sum(af1 +f2 + am1 + am2 + at1 + at2') as total, sum( af1 + af2 + am1 + am2 + at1 + at2)/6 as avg from maverage group by id
I have controller and struct example as well
the Ui is done as well