0){ foreach($_REQUEST['check'] as $c){ if($c)$files[]='/home/mz/edi/infinite-salesorders/orders/'.$c; } } $list=$archive->create($files,PCLZIP_OPT_REMOVE_ALL_PATH); //echo $archive->errorInfo(true);die(); chmod($zf,0777); //header("Content-type: application/octet-stream"); //header("Content-disposition: attachment; filename=archive.zip"); //readfile($zf); header("Location: ".$zf); } else{ if(count($_REQUEST['check'])>0){ foreach($_REQUEST['check'] as $c){ $tmp=$GLOBALS['db']->query("select id from infinite_files where file like '".$c."'"); if ($tmp->num_rows==0) { $GLOBALS['db']->query("insert into infinite_files set status='print',id='".create_guid()."',file='".$c."'"); } else{ $GLOBALS['db']->query("update infinite_files set status='print' where file='".$c."'"); } } } header("Location: index.php?module=EcmSales&action=ListOrders"); } } $tds1=''; $trs=''; $tre=''; $tds=''; $tde=''; $tbs=''; $tbe='
'; function sortableColumn($title,$order_by,$sorder){ if($sorder=="asc")$sorder="desc"; else $sorder="asc"; return ''.$title.''; } ?>
EcmSales

Zamówienia sprzedaży: Skrzynka zleceń sprzedaży


Wydrukowane Data Enter Date Kontrahenci
 

Lista zamówień

'.$tbs; echo $tdr; echo $tds1.sortableColumn("Plik","file",$_REQUEST['sorder']).$tde; echo $tds1.sortableColumn("Nr zamówienia","document_no",$_REQUEST['sorder']).$tde; echo $tds1.sortableColumn("Status","status",$_REQUEST['sorder']).$tde; echo $tds1.sortableColumn("Kontrahent","account_name",$_REQUEST['sorder']).$tde; echo $tds1.sortableColumn("Data","date",$_REQUEST['sorder']).$tde; echo $tds1.sortableColumn("Data dostawy","delivery_date",$_REQUEST['sorder']).$tde; echo $tds1.sortableColumn("Razem","total",$_REQUEST['sorder']).$tde; echo $tds1." ".$tde; echo $tds1." ".$tde; echo $tre; require_once("include/ECM/EcmXml2Array/class.xml2array.php"); require_once("modules/EcmProducts/EcmProduct.php"); if(is_dir($d)) { if ($dh = opendir($d)) { while (($entry = readdir($dh)) !== false) { if($entry!="." && $entry!=".." && $entry!="invoice" && $entry!="orders" && !is_dir($d.$entry)){ $r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select status from infinite_files where file like '".$entry."'")); if($r['status'])$status="Printed"; else $status=""; if($_REQUEST['printed']=="yes"){ if($status=="")continue; } if($_REQUEST['printed']=="no"){ if($status=="Printed")continue; } $xml_data = file_get_contents($d.$entry); $xmlObj = new XmlToArray($xml_data); $ad = $xmlObj->createArray(); $racc=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name,id from accounts where iln='".$ad['Document-Order']['Order-Parties'][0]['DeliveryPoint'][0]['ILN']."'")); if($_REQUEST['account_id'] && $_REQUEST['account_id']!=$racc['id'])continue; $pr=$ad['Document-Order']['Order-Lines'][0]['Line']; $total=0; foreach($pr as $prod){ //if($ad['Document-Order']['Order-Header'][0]['OrderDate']!=$date)continue; $product_id=""; $wwww=$GLOBALS['db']->query("select ecmproduct_language.ecmproduct_id from ecmproduct_language inner join ecmproducts on ecmproducts.id=ecmproduct_language.ecmproduct_id where ecmproduct_language.ean='".$prod['Line-Item'][0]['EAN']."' and ecmproducts.deleted='0' and ecmproduct_language.deleted='0' and ecmproducts.code NOT LIKE '%_w' and ecmproducts.code NOT LIKE '%_z' and ecmproducts.code NOT LIKE '%_W' and ecmproducts.code NOT LIKE '%_Z'"); $rrrr=$GLOBALS['db']->fetchByAssoc($wwww); $product_id=$rrrr['ecmproduct_id']; $ecmp=new EcmProduct(); $ecmp->retrieve($product_id); $product_code=$ecmp->code; $product_name=$ecmp->name; $vat_id=$ecmp->vat_id; $vat_name=$ecmp->vat_name; $vat_value=$ecmp->vat_value; if(eregi("Real",$racc['name'])){ $rrr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select p.price from ecmpricebooks_ecmproducts as p inner join ecmpricebooks as e on e.id=p.ecmpricebook_id where e.id='b8c8cb50-4b60-5b02-5969-4b955880554a' and p.ecmproduct_id='".$product_id."'")); $prod['Line-Item'][0]['OrderedUnitNetPrice']=$rrr['price']; } $total+=$prod['Line-Item'][0]['OrderedQuantity']*$prod['Line-Item'][0]['OrderedUnitNetPrice']*(1+$vat_value/100); } $row[]=array( "status"=>$status, "account_name"=>$racc['name'], "account_id"=>$racc['id'], "file"=>$entry, "document_no"=>$ad['Document-Order']['Order-Header'][0]['OrderNumber'], "date"=>$ad['Document-Order']['Order-Header'][0]['OrderDate'], "delivery_date"=>$ad['Document-Order']['Order-Header'][0]['ExpectedDeliveryDate'], "total"=>$total, ); } } } } include_once('modules/EcmCharts/chartHelper.php'); if(!$_REQUEST['order_by'])$order_by="date"; else $order_by=$_REQUEST['order_by']; if(!$_REQUEST['sorder'])$sorder="desc"; else $sorder=$_REQUEST['sorder']; $row=multisort($row,array(array('key'=>$order_by,'sort'=>$sorder))); if(count($row)>0){ foreach($row as $r){ echo $trs.$tds.$r['file'].$tde; echo $tds.$r['document_no'].$tde; echo $tds.$r['status'].$tde; echo $tds.''.$r['account_name'].''.$tde; echo $tds.$timedate->to_display_date($r['date']).$tde; echo $tds.$timedate->to_display_date($r['delivery_date']).$tde; echo $tds.number_format($r['total'],2,",",".").$tde; echo $tds.'pokaż'.$tde; echo $tds.''.$tde.$tdr; } } echo $tbe.'  '; ?>