57 lines
1.4 KiB
PHP
Executable File
57 lines
1.4 KiB
PHP
Executable File
<?php
|
|
function showDiscount($record) {
|
|
$db = $GLOBALS['db'];
|
|
$res = $db->fetchByAssoc($db->query("SELECT count(distinct discount) AS c FROM ecmsaleitems WHERE
|
|
ecmsale_id='$record'
|
|
AND discount!=0"));
|
|
|
|
if (isset($res['c']) && $res['c']>0)
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
function formatPDFPositions($positions, $focus) {
|
|
$result = array();
|
|
foreach ($positions as $pos) {
|
|
|
|
$pos['position'] = intval($pos['position'])+1;
|
|
$p = new EcmProduct();
|
|
$p -> retrieve($pos['product_id']);
|
|
|
|
$pos['ean'] = $p->ean;
|
|
$pos['ean2'] = $p->ean2;
|
|
|
|
$pos['image'] = $p->product_picture;
|
|
|
|
unset($p);
|
|
|
|
$c = new Currency();
|
|
$c->retrieve($focus->currency_id);
|
|
|
|
$pos['price_start']=format_number($pos['price_start']).' '.$c->symbol;
|
|
$pos['price_netto']=format_number($pos['price_netto']).' '.$c->symbol;
|
|
$pos['total_netto']=format_number($pos['total_netto']).' '.$c->symbol;
|
|
|
|
unset($c);
|
|
|
|
/*
|
|
if ($focus->ecmlanguage=='en_ussss') {
|
|
//get names
|
|
$db = $GLOBALS['db'];
|
|
$r = $db->fetchByAssoc($db->query("SELECT short_description FROM ecmproduct_language WHERE ecmproduct_id='".$pos['product_id']."' AND language='en'"));
|
|
$pos['name'] = $r['short_description'];
|
|
|
|
$lists = return_app_list_strings_language($focus->ecmlanguage);
|
|
$pos['unit_name'] = $lists['ecmproducts_unit_dom'][$pos['unit_id']];
|
|
unset($lists);
|
|
}
|
|
*/
|
|
|
|
$pos['discount'].='%';
|
|
|
|
$result[] = $pos;
|
|
}
|
|
|
|
return $result;
|
|
} |