EcmProducts

Faktury: Produkty na fakturach:


Rok Index Ilość Cena Kontrahent

'; $trs=''; $tre=''; $tds=''; $tde=''; $tbs=''; $tbe='
'; $t.=$tbs; $t.=$trs; $t.=$tds1; $t.="Index"; $t.=$tde; $t.=$tds1; $t.="Nazwa"; $t.=$tde; $t.=$tds1; $t.="Ilość"; $t.=$tde; $t.=$tds1; $t.="Cena"; $t.=$tde; $t.=$tds1; $t.="Nr dokumentu"; $t.=$tde; $t.=$tds1; $t.="Data rejestracji"; $t.=$tde; $t.=$tre; $i=1; if($_REQUEST['year'])$wh[]="e.register_date like '".$_REQUEST['year']."%'"; if($_REQUEST['price'])$wh[]="p.price='".(float)str_replace(",",".",$_REQUEST['price'])."'"; if($_REQUEST['code'])$wh[]="p.code like '".$_REQUEST['code']."%'"; if($_REQUEST['quantity'])$wh[]="p.quantity>=".$_REQUEST['quantity'].""; if($_REQUEST['account_id'])$wh[]="e.parent_id='".$_REQUEST['account_id']."'"; if($_REQUEST['account_name'] && !$_REQUEST['account_id'])$wh[]="e.parent_name like '".$_REQUEST['account_name']."%'"; if(count($wh)>0)$where=" and ".implode(" and ",$wh); else $where=""; if($_REQUEST['code'] && ($_REQUEST['account_name'] || $_REQUEST['account_id'])){ $z="select p.subprice, p.quantity,p.price,p.code,p.name,e.document_no,e.register_date,e.id as iid,p.ecmproduct_id as pid from ecminvoiceoutolds as e inner join ecminvoiceoutolditems as p on p.ecminvoiceoutold_id=e.id where e.deleted='0' and e.type!='correct' ".$where; $w=$GLOBALS['db']->query($z); echo mysql_error();//echo $z; while($r=$GLOBALS['db']->fetchByAssoc($w)){ $t.=$trs; $t.=$tds; $t.=$r['code']; $t.=$tde; $t.=$tds; $t.=$r['name']; $t.=$tde; $t.=$tds; $t.=number_format($r['quantity'],0,"",""); $t.=$tde; $t.=$tds; $t.=number_format($r['subprice'],2,",","."); $t.=$tde; $t.=$tds; $t.=''.$r['document_no'].''; $t.=$tde; $t.=$tds; $t.=$GLOBALS['timedate']->to_display_date($r['register_date']); $t.=$tde; $t.=$tre; $i++; } } $t.=$tbe; echo $t; ?>