Files
2025-05-12 15:44:39 +00:00

40 lines
1.8 KiB
PHP
Executable File

<?php
global $app_list_strings;
include_once ("include/MPDF57/mpdf.php");
include_once ("modules/EcmProducts/EcmProduct.php");
$smarty = new Sugar_Smarty ();
$produkt = new EcmProduct();
$produkt->retrieve($_REQUEST['record']);
$companyLogoURL = "custom/themes/default/images/company_logo.png";
list ( $width, $height ) = getimagesize($companyLogoURL);
if ($width > 212 || $height > 40) {
$resizePctWidth = ($width - 212) / 212;
$resizePctHeight = ($height - 40) / 40;
if ($resizePctWidth > $resizePctHeight) {
$resizeAmount = $width / 212;
} else {
$resizeAmount = $height / 40;
}
$smarty->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount)));
$smarty->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount)));
} else {
$smarty->assign("COMPANY_LOGO_WIDTH", $width);
$smarty->assign("COMPANY_LOGO_HEIGHT", $height);
}
$smarty->assign('actionList', $produkt->action_list);
$smarty->assign('componentList', $produkt->component_list);
$smarty->assign('product', $produkt);
$smarty->assign('APP_LIST_STRINGS', $app_list_strings);
$smarty->assign('thcss', 'background-color: rgb(224,240,255);text-align: center;vertical-align: middle;border: 1px solid rgb(48,192,255);height: 0px;font-family: Arial;font-size: 12px;color: black;');
$smarty->assign('tbodytd', 'border-color: rgb(199,199,199);border-width: 1px;border-right-style: dashed;border-bottom-style: solid;font-family: Arial;font-size: 12px;color: black;vertical-align: top;margin:0px; padding:0px;');
$smarty->assign('current_date', date('Y-m-d'));
//$smarty->display('modules/EcmProducts/tpls/shortPDF.tpl');
//die();
$p = new mPDF('', 'A4', null, 'helvetica', 10, 10, 10, 10, 5, 5);
$p->setTitle($produkt->name);
$p->setFooter('{PAGENO}');
$p->writeHTML($smarty->fetch('modules/EcmProducts/tpls/shortPDF.tpl'));
$p->Output();