64 lines
2.6 KiB
PHP
Executable File
64 lines
2.6 KiB
PHP
Executable File
<?php
|
|
require_once 'ReportSalesByContractor.inc';
|
|
|
|
/*****************************************************/
|
|
/********************** SMARTY ***********************/
|
|
/*****************************************************/
|
|
$Calendar_daFormat = str_replace ( "d", "%d", str_replace ( "m", "%m", str_replace ( "Y", "%Y", $GLOBALS ['timedate']->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','<div style="text-align: right; border-bottom: 1px solid #000000; font-weight: bold; font-size: 10pt;">Chapter 2</div>');
|
|
$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' );
|
|
}
|
|
?>
|