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['submit']){ $z="select id as iid from ecminvoiceoutolds as e where e.deleted='0' and e.type='correct' and e.register_date like '2014%' and e.parent_id='94'"; echo $z; $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++; require_once('modules/EcmInvoiceOutOlds/EcmInvoiceOutOld.php'); if($_REQUEST['gets']==1){ $strPath = dirname(__FILE__) . "\\"; $s = new EcmInvoiceOutOld(); $s->retrieve($r['iid']); //$pdf2 = new PDFMerger; $ab[]=$s->createPdfFileName(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://192.168.1.130/crm/index.php?action=Authenticate&module=Users&return_module=Users&return_action=Login&user_name=db&user_password=rudemodz&login_theme=Sugar&login_language=en_us'); //curl_setopt($ch, CURLOPT_POSTFIELDS,'user_name=db&user_password='.$pass.''); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"); $page = curl_exec($ch); //echo $page; //echo $pass = md5('rudemodz'); $up='http://192.168.1.130/crm/index.php?module=EcmInvoiceOutOlds&action=previewPDF&type=&to_pdf=1&record='.$r['iid'].''; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, $up); $page = curl_exec($ch); $fp = fopen('pdftmp/'.$s->createPdfFileName().'', 'w'); fwrite($fp, $page); fclose($fp); //$pdf2->addPDF('pdftmp/'.$s->createPdfFileName().'', 'all'); } } } if($_REQUEST['gets']==1){ //$pdf2->merge('file', 'pdftmp/TEST2.pdf'); $fp = fopen('generatorfifi2.php', 'w'); $s="addPDF('pdftmp/".$k."', 'all')\n"; } $s.="->merge('file', 'pdftmp/".$current_user->user_name.date("h:y"); $s.=".pdf');"; //$b=microtime(); fwrite($fp, $s); fclose($fp); //echo microtime(); $up='http://192.168.1.130/crm/generatorfifi2.php'; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, $up); $page = curl_exec($ch); header("Location: pdftmp/".$current_user->user_name.date("h:y").".pdf"); } $t.=$tbe; echo $t; ?>