63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
require_once 'AnalysisEcmQuoteInclude.php';
|
||
|
|
require_once ('modules/EcmInvoiceOuts/EcmInvoiceOut.php');
|
||
|
|
global $mod_strings, $app_list_strings;
|
||
|
|
|
||
|
|
$accountName = $_REQUEST["accountName"];
|
||
|
|
$accountId = $_REQUEST["accountId"];
|
||
|
|
|
||
|
|
if (isset($accountId) && $accountId!='') {
|
||
|
|
$where['accountId'] = $accountId;
|
||
|
|
} else if (!isset($accountId) && isset($accountName) && strlen($accountName) > 0) {
|
||
|
|
$where['accountName'] = $accountName;
|
||
|
|
}
|
||
|
|
|
||
|
|
try {
|
||
|
|
$tmp = new DateTime(date('Y-m-31'));
|
||
|
|
$tmp2 = new DateTime(date('Y-m-01'));
|
||
|
|
$tmp2->sub(new DateInterval('P1Y'));
|
||
|
|
$where['register_date_to'] = $tmp->format('Y-m-d');
|
||
|
|
$where['register_date_from'] = $tmp2->format('Y-m-d');
|
||
|
|
|
||
|
|
} catch (Exception $e) {
|
||
|
|
echo $e->getMessage();
|
||
|
|
exit(1);
|
||
|
|
}
|
||
|
|
|
||
|
|
$data = AnalysisEcmQuote($where);
|
||
|
|
$rows = array();
|
||
|
|
|
||
|
|
foreach ($data as $key => $value) {
|
||
|
|
$rows['created'][] = $value['created'];
|
||
|
|
$rows['accepted'][] = $value['accepted'];
|
||
|
|
$rows['not_accepted'][] = $value['not_accepted'];
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
$smarty = new Sugar_Smarty ();
|
||
|
|
$smarty->assign("MOD", $mod_strings);
|
||
|
|
$smarty->assign("DATA", $data);
|
||
|
|
$smarty->assign("ROWS", $rows);
|
||
|
|
|
||
|
|
$smarty->assign("accountName", $accountName);
|
||
|
|
$smarty->assign("accountId", $accountId);
|
||
|
|
|
||
|
|
$smarty->assign("productName", $productName);
|
||
|
|
$smarty->assign("productId", $productId);
|
||
|
|
|
||
|
|
|
||
|
|
if ($_GET ['to_pdf'] == '1') {
|
||
|
|
$output = $smarty->fetch('modules/EcmReports/tpls/PDF/AnalysisProductSale.tpl');
|
||
|
|
|
||
|
|
include_once ("include/MPDF57/mpdf.php");
|
||
|
|
$p = new mPDF('', 'A4', NULL, 'helvetica', 10, 10, 10, 10, 5, 5);
|
||
|
|
$p->writeHTML($output);
|
||
|
|
$p->Output('RaportSprzedazy.pdf', 'I');
|
||
|
|
} else {
|
||
|
|
echo $smarty->display('modules/EcmReports/tpls/AnalysisEcmQuote.tpl');
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
?>
|