start=$_GET['start']+1; $wc[]="purchaseorder.tracking_no!=''"; if($_GET['submit']){ if($_GET['product_name'])$wc[]="poproductrel.productname like '".$_GET['product_name']."%'"; if($_GET['product_code'])$wc[]="poproductrel.productcode like '".$_GET['product_code']."%'"; if($_GET['purchase_order'])$wc[]="purchaseorder.subject like '".$_GET['purchase_order']."%'"; if($_GET['status'])$wc[]="purchaseorder.postatus like '".$_GET['status']."'"; if($_GET['due_date_from'])$wc[]="purchaseorder.duedate>='".$GLOBALS['timedate']->to_display($_GET['due_date_from'],$GLOBALS['timedate']->get_date_format(),"Y-m-d")."'"; if($_GET['due_date_to'])$wc[]="purchaseorder.duedate<='".$GLOBALS['timedate']->to_display($_GET['due_date_to'],$GLOBALS['timedate']->get_date_format(),"Y-m-d")."'"; if($_GET['delivery_time_from']){ $dtf=$GLOBALS['timedate']->to_display($_GET['delivery_time_from'],$GLOBALS['timedate']->get_date_format(),"Y-m-d"); $exp=explode("-",$dtf); //$ddtf=date("Y-m-d",mktime(0,0,0,$exp[1],$exp[2],$exp[0])-37*24*3600); $ddtf=date("Y-m-d",mktime(0,0,0,$exp[1],$exp[2],$exp[0])); $wc[]="purchaseordercf.cf_532>='".$ddtf."'"; } if($_GET['delivery_time_to']){ $dtt=$GLOBALS['timedate']->to_display($_GET['delivery_time_to'],$GLOBALS['timedate']->get_date_format(),"Y-m-d"); $exp=explode("-",$dtt); //$ddtt=date("Y-m-d",mktime(0,0,0,$exp[1],$exp[2],$exp[0])-37*24*3600); $ddtt=date("Y-m-d",mktime(0,0,0,$exp[1],$exp[2],$exp[0])); $wc[]="purchaseordercf.cf_532<='".$ddtt."'"; } if($_GET['list_price_from'])$wc[]="poproductrel.listprice>='".$vc->unformatNumber($_GET['list_price_from'])."'"; if($_GET['list_price_to'])$wc[]="poproductrel.listprice<='".$vc->unformatNumber($_GET['list_price_to'])."'"; if($_GET['quantity_from'])$wc[]="poproductrel.quantity>='".$vc->unformatNumber($_GET['quantity_from'])."'"; if($_GET['quantity_to'])$wc[]="poproductrel.quantity<='".$vc->unformatNumber($_GET['quantity_to'])."'"; } $vc->pp=999; $vc->where=@implode(" and ",$wc); if(!$_GET['start'])$vc->limit="0,".$vc->pp; else $vc->limit=$_GET['start'].",".$vc->pp; if($_GET['order_by'])$vc->order_by=$_GET['order_by']; else $vc->order_by="purchaseorder.duedate"; if($_GET['sorder'])$vc->sorder=$_GET['sorder']; else $vc->sorder="desc"; $vc->getData(); $cnt=$vc->getCount(); $data=$vc->data; for($i=0;$igetIdByCode($data[$i]['productcode']); $deliverydate=$data[$i]['deliverydate']; if(($deliverydate<$pom[$id] || !$pom[$id]) && $deliverydate)$pom[$id]=$deliverydate; if($pom[$id])mysql_query("update ecmproducts set deliverydate='".$pom[$id]."' where id='".$id."'"); if($_REQUEST['category'] || $_REQUEST['active']){ $cat=mysql_fetch_array(mysql_query("select product_category_id as cid,product_active from ecmproducts where code='".$data[$i]['productcode']."'")); if($cat['cid']!=$_REQUEST['category'])continue; if(!$cat['product_active'])continue; } $dat[]=$data[$i]; } $data=$dat; $_SESSION['EcmProductReportsData']=$data; ?>
EcmProducts

Products Reports: Products on sea


Product Code Purchase Order
Status Due Date Enter Date <> Enter Date Delivery Time Enter Date <> Enter Date
           
List Price <> Quantity <> Category
Product active
 

Products List

pp>=$vc->count && $_GET['start']-$vc->pp>0){ // >= >= $btns=array(0,0,0,0); } elseif($_GET['start']+$vc->pp<$vc->count && $_GET['start']-$vc->pp>=0){ // < >= $btns=array(1,1,1,1); } elseif($_GET['start']+$vc->pp>=$vc->count){ // >= < $btns=array(1,1,0,0); } elseif($_GET['start']+$vc->pp<$vc->count && $_GET['start']-$vc->pp<0){ // < < $btns=array(0,0,1,1); } print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
'; print ''; print ''; ?> '; print ''; print $vc->sortableColumn("Product","poproductrel.productname",$_GET['sorder'],20); print $vc->sortableColumn("Code","poproductrel.productcode",$_GET['sorder'],10); print $vc->sortableColumn("Category","poproductrel.productname",$_GET['sorder'],10); print $vc->sortableColumn("Order Id","purchaseorder.puchaseorderid",$_GET['sorder'],5); //print $vc->sortableColumn("Sale","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Sale last 3 m","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Sale last 6 m","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Avg price","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Avg price last 3 m","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Avg price last 6 m","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Qty","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Qty last 3 m","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Qty last 6 m","poproductrel.productname",$_GET['sorder'],10); print $vc->sortableColumn("Quantity","poproductrel.quantity",$_GET['sorder'],10); print $vc->sortableColumn("Inventory","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Inv value","poproductrel.productname",$_GET['sorder'],10); print $vc->sortableColumn("CBM","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Avg qty","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Avg qty last 3 m","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Avg qty last 6 m","poproductrel.productname",$_GET['sorder'],10); //print $vc->sortableColumn("Status","purchaseorder.postatus",$_GET['sorder'],10); //print $vc->sortableColumn("Due Date","purchaseorder.duedate",$_GET['sorder'],10); print $vc->sortableColumn("Delivery Time","purchaseordercf.cf_532",$_GET['sorder'],10); //print $vc->sortableColumn("List Price","poproductrel.listprice",$_GET['sorder'],10); print $vc->sortableColumn("Tracking No","purchaseorder.tracking_no",$_GET['sorder'],10); print ''; for($i=0;$igetIdByCode($data[$i]['productcode']); $duedate=$data[$i]['duedate']; $deliverydate=$data[$i]['deliverydate']; $exp=explode("-",$duedate); //$dtime=date("Y-m-d",@mktime(0,0,0,$exp[1],$exp[2],$exp[0])+37*24*3600); $dtime=date("Y-m-d",@mktime(0,0,0,$exp[1],$exp[2],$exp[0])); $w=mysql_query("select ecmproducts_fk_list.price as price,ecmproducts_fk_list.quantity as quantity,ecmproducts_fk_list.no as no,ecmproducts_fk_list.date as date from ecmproducts_fk_list where ecmproducts_fk_list.code like '".$data[$i]['productcode']."'"); //echo mysql_num_rows();mysql_error();die(); while($r=mysql_fetch_array($w)){ $sale+=$r['price']*$r['quantity']; $qty+=$r['quantity']; $aq[$r['no']]+=$r['quantity']; $date=date("Y-m"); $m=(int)date("m"); $date1=date("Y-m",mktime(0,0,0,($m-1),1,date("Y"))); $date2=date("Y-m",mktime(0,0,0,($m-2),1,date("Y"))); $date3=date("Y-m",mktime(0,0,0,($m-3),1,date("Y"))); $date4=date("Y-m",mktime(0,0,0,($m-4),1,date("Y"))); $date5=date("Y-m",mktime(0,0,0,($m-5),1,date("Y"))); $date6=date("Y-m",mktime(0,0,0,($m-6),1,date("Y"))); $d=explode("-",$r['date']); $dd=$d[0]."-".$d[1]; if($dd==$date || $dd==$date1){ $sale30+=$r['price']*$r['quantity']; $qty30+=$r['quantity']; $aq30[$r['no']]+=$r['quantity']; } if($dd==$date || $dd==$date1 || $dd==$date2 || $dd==$date3){ $sale90+=$r['price']*$r['quantity']; $qty90+=$r['quantity']; $aq390[$r['no']]+=$r['quantity']; } if($dd==$date || $dd==$date1 || $dd==$date2 || $dd==$date3 || $dd==$date4 || $dd==$date5 || $dd==$date6){ $sale180+=$r['price']*$r['quantity']; $qty180+=$r['quantity']; $aq180[$r['no']]+=$r['quantity']; } } $rc=mysql_fetch_array(mysql_query("select product_category_name,product_category_id from ecmproducts where id='".$id."'")); $category=''.$rc['product_category_name'].''; print ''; print ''; print ''; print ''; print ''; print ''; /*print '';*/ /*print ''; print ''; $qtysum90+=($qty90/3); print ''; $qtysum180+=($qty180/6); */ print ''; $qtyo+=$data[$i]['quantity']; $rrrr=mysql_fetch_array(mysql_query("select ems_qty_in_stock,ems_price,pieces_per_carton,carton_volume_meter from ecmproducts where code='".$data[$i]['productcode']."'")); print ''; $emsqtyinstock+=$rrrr['ems_qty_in_stock']; //print ''; $emsqtyinstockinv+=($rrrr['ems_price']*$rrrr['ems_qty_in_stock']); print ''; if($rrrr['pieces_per_carton']>0)$cbm+=(($rrrr['ems_qty_in_stock']*$rrrr['carton_volume_meter'])/$rrrr['pieces_per_carton']); //print ''; //print ''; print ''; //print ''; print ''; $listprice+=$data[$i]['listprice']; if(($deliverydate<$pom[$r['id']] || !$pom[$r['id']]) && $deliverydate)$pom[$r['id']]=$deliverydate; if($pom[$r['id']])mysql_query("update ecmproducts set deliverydate='".$pom[$r['id']]."' where id='".$r['id']."'"); print ''; } $cnt=count($data); print ''; print '
 '; print ''; ?> generateButtons($btns); ?>
'.$data[$i]['productname'].''.$data[$i]['productcode'].''.$category.''.$data[$i]['purchaseorderid'].''; if($qty90>0){ print number_format(($sale90/$qty90),2,",","."); $saleqtysum90+=($sale90/$qty90); } print ''; if($qty180>0){ print number_format(($sale180/$qty180),2,",","."); $saleqtysum180+=($sale180/$qty180); } print ''.number_format(($qty90/3),2,",",".").''.number_format(($qty180/6),2,",",".").''.number_format($data[$i]['quantity'],0,"","").''.number_format($rrrr['ems_qty_in_stock'],0,"","").''.number_format(($rrrr['ems_price']*$rrrr['ems_qty_in_stock']),2,",",".").''; if($rrrr['pieces_per_carton']>0)print number_format((($rrrr['ems_qty_in_stock']*$rrrr['carton_volume_meter'])/$rrrr['pieces_per_carton']),2,",","."); else print "0,00"; print ''.$data[$i]['postatus'].''.$vc->timeDate($duedate).''.$vc->timeDate($deliverydate).''.$vc->formatNumber($data[$i]['listprice']).''.$data[$i]['tracking_no'].'
Summary '.number_format($qtyo,0,"","").' '.number_format($emsqtyinstock,0,"","").' '.number_format($cbm,2,",",".").'
'; print '
'; print '
'; ?>