For running J!5.1 you must https://fabrikar.com/forums/index.php?wiki/update-from-github/ or include the new file manually https://fabrikar.com/forums/index.php?threads/joomla-5-1-and-fabrik-cannot-find-files-error.54473/post-285151 See also Announcements
Please see our announcement here.
SELECT DATE_FORMAT(date_time, '%Y-%m'), AVG(amount) AS `average` SUM(amount) AS `sum` FROM sales GROUP
BY DATE_FORMAT(date_time, '%Y-%m')
SELECT DATE_FORMAT(date_time, '%Y'), AVG(amount) AS `average` SUM(amount) AS `sum` FROM sales GROUP
BY DATE_FORMAT(date_time, '%Y')
<?php
$db =& JFactory::getDBO();
// replace these 2 items with your info to be displayed on the header left and right
$headingleft = 'Your Company Name Here';
$logo = 'path/logoimagefile.jpg';
//set variables from input form. replace yourform obviously and make varable names match element names
$title = $_REQUEST[yourform___title];
$query = $_REQUEST[yourform___sql_statement];
// setup mpdf
include("./MPDF54/mpdf.php");
$mpdf=new mPDF('c','Letter',0,'sans-serif',10,10,25,16,7,9);
//error_reporting(0); // says could speed up... doesn't seem to
$mpdf->useSubstitutions=false;
$mpdf->simpleTables = true;
$html = '<html><body>'; // get the html string started...
$footer = '
<table width="100%" style="border-top: 1px solid #000000; vertical-align: bottom; font-size: 8pt; color: #000000; font-weight: bold; font-style: italic;">
<tr>
<td width="33%"><span style="font-weight: bold; font-style: italic;">Printed {DATE D, n/j/y g:ia}</span></td>
<td width="33%" valign="bottom" align="center"></td>
<td width="33%" valign="bottom" style="text-align: right;">{PAGENO}/{nbpg}</td>
</tr></table>
';
$mpdf->SetHTMLFooter($footer);
$header = '
<table width="100%" style="vertical-align: bottom; font-size: 10pt; color: #000000;">
<tr>
<td width="25%" valign="top">'.$headingleft.'</td>
<td width="50%" valign="top" align="center" style="font-weight:bold; font-size:14pt;">'.$title.'</span></td>
<td width="25%" valigh="top" style="text-align: right;"><img height= "40" align="top" class="Right_Logo" src="http://'.$_SERVER['SERVER_NAME'].$logo.'"></td>
</tr></table>
';
//
// execute query
//
$db->setQuery($query);
$result = $db->loadAssocList();
if (!$result) { // show ERROR
$html .= "Error In Query:<BR>".$query."<br><br>Error is:<br>".$db->getErrorMsg()."</body></html>";
} else { // no error... process sql results
$thstyle = "text-align:left; border:1px solid white; background-color:black; color:white; padding:2px; font-size:7pt;";
$th6style = "border:1px solid white; background-color:#dddddd; color:black; padding:2px; font-size:7pt;";
$tdstyle = "border:1px solid black; padding:2px; font-size:7pt;";
$first = TRUE;
$html .= "<table style='width:100%; border-collapse:collapse; padding-top:20px;'>";
foreach ($result as $lineofdata) {
$headerhtml = ''; $datahtml = '';
if ($first) $html .= '<thead>';
$html .= '<tr>';
foreach ($lineofdata as $heading => $data) {
if ($first) { // first line, set table headers
$headerhtml .= "<th style='".$thstyle."'>".$heading."</th>";
};
$datahtml .= "<td style='".$tdstyle."'>".$data."</th>";
};
if ($first) $html .= $headerhtml.'</tr></thead><tr>';
$html .= $datahtml;
$first = FALSE;
$html .= '</tr>';
}
$html .= "</table></body></html>";
};
$mpdf->SetHTMLHeader($header);
//echo $html; exit; // comment this out to send to pdf... remove comment to send html to screen for debugging.
$mpdf->WriteHTML($html);
// echo 'run this query:<br>'.$query;
$mpdf->Output($title.'.pdf','I');
exit; // causes pdf to be displayed vs. going back to form... user has to press 'back' to return to form and re-run report.
?>
SELECT DATE_FORMAT(date_time, '%Y-%m'), COUNT(amount) AS `items_sold` FROM sales GROUP
BY DATE_FORMAT(date_time, '%Y-%m')
SELECT DATE_FORMAT( date_time, '%Y-%m' ) AS `datetime`,
encoder AS `user_id`,
AVG( purchased_amount ) AS 'average',
SUM( purchased_amount ) AS `sum`,
COUNT( purchased_amount ) AS 'no of entries',
SUM(CASE WHEN product_clas = 1 then 1 Else 0 end) AS 'Aircon',
SUM(CASE WHEN product_clas = 2 then 1 Else 0 end) AS 'LCD TV'
FROM empenc_warranty
GROUP BY DATE_FORMAT( date_time, '%Y-%m' )
DROP VIEW IF EXISTS hughtest;
CREATE VIEW hughtest AS
SELECT
id,
DATE_FORMAT( date_time, '%Y-%m' ) AS datetime,
encoder AS user_id,
AVG( purchased_amount ) AS average,
SUM( purchased_amount ) AS sum,
COUNT( purchased_amount ) AS no_of_entries,
SUM(CASE WHEN product_clas = 1 then 1 Else 0 end) AS aircon,
SUM(CASE WHEN product_clas = 2 then 1 Else 0 end) AS lcd_tv
FROM empenc_warranty
GROUP BY datetime, user_id