Files
crm.twinpol.com/modules/EcmInvoiceOuts2/createCatalogue.php
2025-05-12 15:44:39 +00:00

36 lines
1.2 KiB
PHP
Executable File

<?php
error_reporting(0);
set_time_limit (99999999);
ini_set('memory_limit', '-1');
include_once("modules/EcmProducts/productCardUltraNew.php");
include_once("include/MPDF57/mpdf.php");
$p=new mPDF('utf-8','A4-L', null, 'helvetica');
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select c.iso4217 as s from currencies as c inner join ecminvoiceouts as q on q.currency_id=c.id where q.id='".$_REQUEST['record']."'"));
$symbol=$rr['s'];
$db = $GLOBALS['db'];
$focus = new EcmInvoiceOut();
$focus->retrieve($_REQUEST['record']);
if ($focus->ecmlanguage=='pl_pl')
$lang = "pl";
if ($focus->ecmlanguage=='en_us')
$lang = "en";
$products = $db->query("SELECT id,ecmproduct_id FROM ecminvoiceoutitems WHERE ecminvoiceout_id='".$_REQUEST['record']."' AND deleted='0' ORDER BY position");
while ($prod = $db->fetchByAssoc($products)) {
$p=productCardNew($p,$prod['ecmproduct_id'],$lang,true,true,"",$symbol,true, $_REQUEST['show_ean'], $prod['id'], "EcmInvoiceOuts");
}
if($_REQUEST['create_img']==1){
$guid=create_guid();
$type="F";
$file="cache/upload/Catalogue".$guid.".pdf";
}
else{
$type="D";
$file="Catalogue".date("YmdHi").".pdf";
}
$p->Output($file,$type);