Files
crm.e5.pl/modules/EcmReports/ReportSales.php

44 lines
1.7 KiB
PHP
Raw Permalink Normal View History

2024-04-27 09:23:34 +02:00
<?php
require_once 'ReportSales.inc.php';
/*****************************************************/
/********************** SMARTY ***********************/
/*****************************************************/
$Calendar_daFormat = str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));
// Default value from date input
$currentDate = $GLOBALS['timedate']->to_display_date($date_from);
$date_from = $GLOBALS['timedate']->to_display_date($date_from);
$date_to = $GLOBALS['timedate']->to_display_date($date_to);
// create & execute smarty
$smarty = new Sugar_Smarty ();
global $mod_strings;
$smarty -> assign( "MOD", $mod_strings );
$smarty -> assign( "DATA", $newArray1);
$smarty -> assign( "date_from", $date_from );
$smarty -> assign( "date_to", $date_to );
$smarty -> assign("dateFormat", $Calendar_daFormat);
$smarty -> assign( "SUM", $sum);
$smarty -> assign("searchByType", $searchByType);
$smarty -> assign("searchBy", $searchBy);
$smarty -> assign( "USERS", $datausers);
$smarty -> assign( "twinpol", (isset($_REQUEST['twinpol']) ? 1 : null));
$smarty -> assign( "selectUser", $selectUser);
$smarty -> assign( "selectedPdfType", $selectPdfType);
$smarty -> assign( "group_ks", $group_ks);
$smarty -> assign( "all_groups_ks", $all_groups_ks);
// Eksport do PDF
if( $_GET['toPDF'] == '1' ) {
$output = $smarty->fetch( 'modules/EcmReports/tpls/PDF/ReportSales.tpl' );
include_once ("include/MPDF57/mpdf.php");
$p = new mPDF ( '', 'A4', null, 'helvetica', 10, 10, 10, 10, 5, 5 );
$p->setTitle($mod_strings["LBL_SUBPANEL_TITLE"]);
$p->writeHTML( $output );
$p->Output ('RaportSprzedazy.pdf', 'I');
} else {
echo $smarty->display ( 'modules/EcmReports/tpls/ReportSales.tpl' );
}
?>