get_date_format () ) ) ); //$db_date_from = $GLOBALS ['timedate']->to_db_format ($date_from); // 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 ); // Konwersja daty do odpowiedniego formatu $date = new DateTime ( $date_from ); $date_from_formatted = $date->format ( 'd.m.Y' ); $date = new DateTime ( $date_to ); $date_to_formatted = $date->format ( 'd.m.Y' ); $date = new DateTime (); $current_date_formatted = $date->format ( 'd.m.Y' ); // create & execute smarty $smarty = new Sugar_Smarty (); global $mod_strings; global $app_list_strings; $smarty->assign ( "MOD", $mod_strings ); $smarty->assign ( "DATA", $data ); $smarty->assign ( "SUM", $sum ); $smarty->assign ( "date_from", $date_from ); $smarty->assign ( "date_to", $date_to ); $smarty->assign ( "CATEGORY", $app_list_strings['ecminvoiceouts_category_dom']); $smarty->assign ( "categories", $category); $smarty->assign ( "dateFormat", $Calendar_daFormat ); $smarty->assign ( "searchByType", $searchByType ); $smarty->assign ( "contractorId", $contractorId ); $smarty->assign ( "contractorName", $contractorName ); $smarty->assign ( "date_from_formatted", $date_from_formatted ); $smarty->assign ( "date_to_formatted", $date_to_formatted ); $smarty->assign ( "current_date_formatted", $current_date_formatted ); $smarty->assign ( "submit", $_GET["submit"]); $smarty->assign ( "pdfType", $pdfType ); // Eksport do PDF if ($_GET ['to_pdf'] == '1') { $output = $smarty->fetch ( 'modules/EcmReports/tpls/PDF/ReportSalesByContractor.tpl' ); include_once ("include/MPDF57/mpdf.php"); $p = new mPDF ( '', 'A4', null, 'helvetica', 10, 10, 40, 10, 5, 5 ); // Set header $p->DefHTMLHeaderByName('MainHeader','
Chapter 2
'); $p->SetHTMLHeaderByName('MainHeader'); // Set a simple Footer including the page number $p->setFooter('{PAGENO}'); $p->setTitle ( "Raport wartościowy" ); $p->writeHTML ( $output ); $p->Output ( 'RaportSprzedazy.pdf', 'I' ) ; } else { echo $smarty->display ( 'modules/EcmReports/tpls/ReportSalesByContractor.tpl' ); } ?>