This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
<?
set_time_limit(3000);
define('RELATIVE_PATH','include/html2fpdf/');
define('FPDF_FONTPATH','include/html2fpdf/font/');
require_once("include/html2fpdf/html2fpdf.php");
include_once("modules/EcmProductReports/vtigerConnector.php");
$vc=new vtigerConnector();
if($_POST['where'])$vc->where=$_POST['where'];
if(!$_POST['start'])$vc->limit="0,".$vc->pp;
else $vc->limit=$_POST['start'].",".$vc->pp;
if($_POST['order_by'])$vc->order_by=$_POST['order_by'];
else $vc->order_by="purchaseorder.duedate";
if($_POST['sorder'])$vc->sorder=$_POST['sorder'];
else $vc->sorder="desc";
$vc->getData();
$vc->getCount();
$data=$vc->data=$_SESSION['EcmProductReportsData'];
foreach($_REQUEST['check'] as $che)if($che)$ile++;
$pdf = new HTML2FPDF("L");
$j=0;
$k=0;
$m=0;
for($i=0;$i<count($data);$i++){
if($j==0){
$html.='<table border="1" width="1050"><tr height="80" width="1050">';
$html.='<td height="80" align="center" width="210"><img src="modules/EcmPriceBooks/e5.png" border="0" width="200" height="70"></td>';
$html.='<td height="80" align="center" width="840"><font color="#808080">'.iconv("UTF-8","ISO-8859-2","Product Report").'</font></td>';
$html.='</tr></table>';
$html.='<table border="1" width="1050"><tr align="center" height="30" width="1220">';
$html.='<td bgcolor="#FF6600" align="center" height="30" width="255"><font color="#ffffff">Product</font></td>';
$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Code</font></td>';
$html.='<td bgcolor="#FF6600" align="center" height="30" width="255"><font color="#ffffff">Purchase Order</font></td>';
//$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Status</font></td>';
$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Due Date</font></td>';
$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Delivery Time</font></td>';
//$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">List Price</font></td>';
$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Quantity</font></td>';
$html.='<td bgcolor="#FF6600" align="center" height="60" width="90"><font color="#ffffff">Tracking No</font></td>';
$html.='</tr>';
}
if(!$_REQUEST['check'][$i])continue;
$id=$vc->getIdByCode($data[$i]['productcode']);
$duedate=$data[$i]['duedate'];
$exp=explode("-",$duedate);
$dtime=date("Y-m-d",@mktime(0,0,0,$exp[1],$exp[2],$exp[0])+37*24*3600);
$html.='<tr height="30" width="300">';
$html.='<td valign="top" align="center" height="30" width="80">'.iconv("UTF-8","ISO-8859-2",$data[$i]['productname']).'</td>';
$html.='<td valign="top" align="center" height="30" width="40">'.iconv("UTF-8","ISO-8859-2",$data[$i]['productcode']).'</td>';
$html.='<td valign="top" align="center" height="30" width="80">'.iconv("UTF-8","ISO-8859-2",$data[$i]['subject']).'</td>';
//$html.='<td valign="top" align="center" height="30" width="30">'.iconv("UTF-8","ISO-8859-2",$data[$i]['postatus']).'</td>';
$html.='<td valign="top" align="center" height="30" width="50">'.iconv("UTF-8","ISO-8859-2",$vc->timeDate($duedate)).'</td>';
$html.='<td valign="top" align="center" height="30" width="60">'.iconv("UTF-8","ISO-8859-2",$vc->timeDate($dtime)).'</td>';
//$html.='<td valign="top" align="center" height="30" width="40">'.iconv("UTF-8","ISO-8859-2",$vc->formatNumber($data[$i]['listprice'])).'</td>';
$html.='<td valign="top" align="center" height="30" width="40">'.iconv("UTF-8","ISO-8859-2",$data[$i]['quantity']).'</td>';
$html.='<td valign="top" align="center" height="30" width="60">'.iconv("UTF-8","ISO-8859-2",$data[$i]['tracking_no']).'</td>';
$html.='</tr>';
$j++;
$k++;
$m++;
if($j==17 || $ile==$k){
$st++;
$html.='</table>';
$html.='<table border="1" width="1050"><tr height="30" width="1050">';
$html.='<td bgcolor="#FF6600" height="30" align="center" width="200"><font color="#ffffff">www.e5world.com</font></td>';
$html.='<td bgcolor="#FF6600" height="30" align="right" width="850">'.$st.'/'.ceil($ile/17).'&nbsp;&nbsp;&nbsp;&nbsp;</td>';
$html.='</tr></table>';
$ohtml=$html;
$html='';
$pdf->AddPage();
$pdf->WriteHTML($ohtml);
$j=0;
}
}
$pdf->Output("ProductsReport.pdf", "D");
?>

View File

@@ -0,0 +1,95 @@
<?
set_time_limit(3000);
define('RELATIVE_PATH','include/html2fpdf/');
define('FPDF_FONTPATH','include/html2fpdf/font/');
require_once("include/html2fpdf/html2fpdf.php");
include_once("modules/EcmProductReports/vtigerConnector.php");
$vc=new vtigerConnector();
$vc->start=1;
$wc[]="1=1";
$wc[]="purchaseordercf.cf_528='0'";
$wc[]="purchaseorder.tracking_no!=''";
$vc1->where=@implode(" and ",$wc);
$vc->getData();
$cnt=$vc->getCount();
$data=$vc->data;
if(count($data)>0){
foreach($data as $d){
if(trim($d['tracking_no'])==trim($_GET['tracking_no'])){
$dd[]=$d;
}
}
}
$data=$dd;
$ile=ceil((count($data)+1)/17);
$pdf = new HTML2FPDF("L");
$j=0;
$k=0;
$m=0;
for($i=0;$i<count($data)+1;$i++){
if($j==0){
$html.='<table border="1" width="1050"><tr height="80" width="1050">';
$html.='<td height="80" align="center" width="210"><img src="modules/EcmPriceBooks/e5.png" border="0" width="200" height="70"></td>';
$html.='<td height="80" align="center" width="840"><font color="#808080">'.iconv("UTF-8","ISO-8859-2",$GLOBALS['timedate']->to_display_date($data[$i]['deliverydate'])." ".$_GET['tracking_no']).'</font></td>';
$html.='</tr></table>';
$html.='<table border="1" width="1050"><tr align="center" height="30" width="1220">';
$html.='<td bgcolor="#FF6600" align="center" height="30" width="150"><font color="#ffffff">Index</font></td>';
$html.='<td bgcolor="#FF6600" align="center" height="30" width="630"><font color="#ffffff">Name</font></td>';
$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Quantity</font></td>';
$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Cartons</font></td>';
$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">CBM</font></td>';
$html.='</tr>';
}
if($i==count($data)){
$html.='<tr height="30" width="300">';
$html.='<td valign="top" align="center" height="30" width="40"></td>';
$html.='<td valign="top" align="center" height="30" width="80"></td>';
$html.='<td valign="top" align="center" height="30" width="40"><b>'.iconv("UTF-8","ISO-8859-2",$qty_sum).'</b></td>';
$html.='<td valign="top" align="center" height="30" width="60"><b>'.iconv("UTF-8","ISO-8859-2",round($cartons_sum,0)).'</b></td>';
$html.='<td valign="top" align="center" height="30" width="60"><b>'.iconv("UTF-8","ISO-8859-2",number_format($cbm_sum,2,",",".")).'</b></td>';
$html.='</tr>';
}
else{
$id=$vc->getIdByCode($data[$i]['productcode']);
$r=mysql_fetch_array(mysql_query("select pieces_per_carton as ppc,carton_volume_meter as cvm from ecmproducts where id='".$id."'"));
@$cartons=$data[$i]['quantity']/$r['ppc'];
@$cbm=$data[$i]['quantity']*$r['cvm']/$r['ppc'];
$qty_sum+=$data[$i]['quantity'];
$cartons_sum+=$cartons;
$cbm_sum+=$cbm;
$html.='<tr height="30" width="300">';
$html.='<td valign="top" align="center" height="30" width="40">'.iconv("UTF-8","ISO-8859-2",$data[$i]['productcode']).'</td>';
$html.='<td valign="top" align="center" height="30" width="80">'.iconv("UTF-8","ISO-8859-2",$data[$i]['productname']).'</td>';
$html.='<td valign="top" align="center" height="30" width="40">'.iconv("UTF-8","ISO-8859-2",$data[$i]['quantity']).'</td>';
$html.='<td valign="top" align="center" height="30" width="60">'.iconv("UTF-8","ISO-8859-2",round($cartons,0)).'</td>';
$html.='<td valign="top" align="center" height="30" width="60">'.iconv("UTF-8","ISO-8859-2",number_format($cbm,2,",",".")).'</td>';
$html.='</tr>';
}
$j++;
$k++;
$m++;
if($j==17 || count($data)+1==$k){
$st++;
$html.='</table>';
$html.='<table border="1" width="1050"><tr height="30" width="1050">';
$html.='<td bgcolor="#FF6600" height="30" align="center" width="200"><font color="#ffffff">www.e5.pl</font></td>';
$html.='<td bgcolor="#FF6600" height="30" align="right" width="850">'.$st.'/'.$ile.'&nbsp;&nbsp;&nbsp;&nbsp;</td>';
$html.='</tr></table>';
$ohtml=$html;
$html='';
$pdf->AddPage();
$pdf->WriteHTML($ohtml);
$j=0;
}
}
//echo $html;
$pdf->Output("Containers.pdf", "D");
?>

View File

@@ -0,0 +1,208 @@
<?php
include_once("modules/EcmProductReports/vtigerConnector.php");
$vc=new vtigerConnector();
if($_POST['where'])$vc->where=$_POST['where'];
if(!$_POST['start'])$vc->limit="0,".$vc->pp;
else $vc->limit=$_POST['start'].",".$vc->pp;
if($_POST['order_by'])$vc->order_by=$_POST['order_by'];
else $vc->order_by="purchaseorder.duedate";
if($_POST['sorder'])$vc->sorder=$_POST['sorder'];
else $vc->sorder="desc";
$vc->getData();
$vc->getCount();
$data=$vc->data=$_SESSION['EcmProductReportsData'];
set_include_path('include/PHPExcel/');
include 'PHPExcel.php';
include 'PHPExcel/Writer/Excel2007.php';
include 'PHPExcel/IOFactory.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("E5 CRM");
$objPHPExcel->getProperties()->setLastModifiedBy("E5 CRM");
$objPHPExcel->getProperties()->setTitle("Office 2007 PRICEBOOK");
$objPHPExcel->getProperties()->setSubject("Office 2007 PRICEBOOK");
$objPHPExcel->getProperties()->setDescription("PRICEBOOK");
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('argb' => 'FFCCFFCC')
),
'borders' => array(
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
)
),
"A1:N1"
);
$alf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
$objPHPExcel->getActiveSheet()->SetCellValue('A1','Product');
$objPHPExcel->getActiveSheet()->SetCellValue('B1','Code');
$objPHPExcel->getActiveSheet()->SetCellValue('C1','Order Id');/*
$objPHPExcel->getActiveSheet()->SetCellValue('D1','Avg price last 3 m');
$objPHPExcel->getActiveSheet()->SetCellValue('E1','Avg price last 6 m');
$objPHPExcel->getActiveSheet()->SetCellValue('F1','Qty last 3 m');
$objPHPExcel->getActiveSheet()->SetCellValue('G1','Qty last 6 m');*/
$objPHPExcel->getActiveSheet()->SetCellValue('D1','Quantity');
$objPHPExcel->getActiveSheet()->SetCellValue('E1','Inventory');
//$objPHPExcel->getActiveSheet()->SetCellValue('J1','Inv value');
$objPHPExcel->getActiveSheet()->SetCellValue('F1','CBM');
//$objPHPExcel->getActiveSheet()->SetCellValue('L1','Status');
$objPHPExcel->getActiveSheet()->SetCellValue('G1','Due Date');
$objPHPExcel->getActiveSheet()->SetCellValue('H1','Delivery Time');
//$objPHPExcel->getActiveSheet()->SetCellValue('O1','List Price');
$objPHPExcel->getActiveSheet()->SetCellValue('I1','Tracking No');
$j=0;
for($i=0;$i<count($data);$i++){
if(!$_REQUEST['check'][$i])continue;
$sale30=0;
$qty30=0;
$aq30=array();
$sale90=0;
$qty90=0;
$aq90=array();
$sale180=0;
$qty180=0;
$aq180=array();
$id=$vc->getIdByCode($data[$i]['productcode']);
$duedate=$data[$i]['duedate'];
$exp=explode("-",$duedate);
$dtime=date("Y-m-d",@mktime(0,0,0,$exp[1],$exp[2],$exp[0])+37*24*3600);
$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'];
}
}
$objPHPExcel->getActiveSheet()->SetCellValue('A'.($j+2),$data[$i]['productname']);
$objPHPExcel->getActiveSheet()->SetCellValue('B'.($j+2),$data[$i]['productcode']);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.($j+2),$data[$i]['purchaseorderid']);
if($qty90>0){
$saleqtysum90+=($sale90/$qty90);
$v=number_format(($sale90/$qty90),2,",",".");
}
//$objPHPExcel->getActiveSheet()->SetCellValue('D'.($j+2),$v);
if($qty180>0){
$saleqtysum180+=($sale180/$qty180);
$v=number_format(($sale180/$qty180),2,",",".");
}
//$objPHPExcel->getActiveSheet()->SetCellValue('E'.($j+2),$v);
//$objPHPExcel->getActiveSheet()->SetCellValue('F'.($j+2),number_format(($qty90/3),2,",","."));
$qtysum90+=($qty90/3);
//$objPHPExcel->getActiveSheet()->SetCellValue('G'.($j+2),number_format(($qty180/6),2,",","."));
$qtysum180+=($qty180/6);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.($j+2),number_format($data[$i]['quantity'],0,"",""));
$qtyo+=$data[$i]['quantity'];
$rrrr=mysql_fetch_array(mysql_query("select ems_qty_in_stock,ems_price,carton_volume_meter,pieces_per_carton from ecmproducts where code='".$data[$i]['productcode']."'"));
$objPHPExcel->getActiveSheet()->SetCellValue('E'.($j+2),number_format($rrrr['ems_qty_in_stock'],0,"",""));
$emsqtyinstock+=$rrrr['ems_qty_in_stock'];
//$objPHPExcel->getActiveSheet()->SetCellValue('J'.($j+2),number_format(($rrrr['ems_price']*$rrrr['ems_qty_in_stock']),2,",","."));
$emsqtyinstockinv+=($rrrr['ems_price']*$rrrr['ems_qty_in_stock']);
if($rrrr['pieces_per_carton']>0)$cbmv=number_format((($rrrr['ems_qty_in_stock']*$rrrr['carton_volume_meter'])/$rrrr['pieces_per_carton']),2,",",".");
else $cbmv="0,00";
$objPHPExcel->getActiveSheet()->SetCellValue('F'.($j+2),$cbmv);
if($rrrr['pieces_per_carton']>0)$cbm+=(($rrrr['ems_qty_in_stock']*$rrrr['carton_volume_meter'])/$rrrr['pieces_per_carton']);
//$objPHPExcel->getActiveSheet()->SetCellValue('L'.($j+2),$data[$i]['postatus']);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.($j+2),$vc->timeDate($duedate));
$objPHPExcel->getActiveSheet()->SetCellValue('H'.($j+2),$vc->timeDate($dtime));
//$objPHPExcel->getActiveSheet()->SetCellValue('O'.($j+2),$vc->formatNumber($data[$i]['listprice']));
$objPHPExcel->getActiveSheet()->SetCellValue('I'.($j+2),$data[$i]['tracking_no']);
$listprice+=$data[$i]['listprice'];
$j++;
}
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('argb' => 'E6E6E6')
),
),
"A".($j+2).":N".($j+2)
);
$cnt=count($data);
//$objPHPExcel->getActiveSheet()->SetCellValue('D'.($j+2),number_format($saleqtysum90/$cnt,2,",","."));
//$objPHPExcel->getActiveSheet()->SetCellValue('E'.($j+2),number_format($saleqtysum180/$cnt,2,",","."));
//$objPHPExcel->getActiveSheet()->SetCellValue('F'.($j+2),number_format($qtysum90/$cnt,2,",","."));
//$objPHPExcel->getActiveSheet()->SetCellValue('G'.($j+2),number_format($qtysum180/$cnt,2,",","."));
$objPHPExcel->getActiveSheet()->SetCellValue('D'.($j+2),number_format($qtyo,0,"",""));
$objPHPExcel->getActiveSheet()->SetCellValue('E'.($j+2),number_format($emsqtyinstock,0,"",""));
//$objPHPExcel->getActiveSheet()->SetCellValue('J'.($j+2),number_format($emsqtyinstockinv,2,",","."));
//$objPHPExcel->getActiveSheet()->SetCellValue('F'.($j+2),number_format($cbm,2,",","."));
//$objPHPExcel->getActiveSheet()->SetCellValue('N'.($j+2),number_format($listprice/$cnt,2,",","."));
$objPHPExcel->getActiveSheet()->setTitle('Simple');
$objPHPExcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
chmod("cache/upload",0777);
$microtime=str_replace(".","",str_replace(" ","",microtime()));
$name="cache/upload/ProductReport".$microtime.".xlsx";
$objWriter->save($name);
chmod($name,0777);
header("Location: ".$name);
?>

View File

@@ -0,0 +1,233 @@
<?php
$wh[]="1=1";
if($_GET['product_category_id'])$wh[]="product_category_id='".$_GET['product_category_id']."'";
if($_GET['product_name'])$wh[]="name like '".$_GET['product_name']."%'";
if($_GET['product_code'])$wh[]="code like '".$_GET['product_code']."%'";
if($_GET['active']){
if($_GET['active']=="yes")$wh[]="product_active='1'";
if($_GET['active']=="no")$wh[]="product_active='0'";
}
if($_GET['production']){
if($_GET['production']=="yes")$wh[]="production='1'";
if($_GET['production']=="no")$wh[]="production='0'";
}
if($_GET['end_of_line']){
if($_GET['end_of_line']=="yes")$wh[]="end_of_line='1'";
if($_GET['end_of_line']=="no")$wh[]="end_of_line='0'";
}
include_once("modules/EcmProductReports/vtigerConnector.php");
include_once('modules/EcmCharts/chartHelper.php');
$s=sum(2009);
include_once('modules/EcmCharts/chartHelper.php');
$s=sum(2009);
if($_GET['product_category_id'])$wh_cat=" and product_category_id='".$_GET['product_category_id']."'";
else $wh_cat="";
$w=mysql_query("select id,code,name from ecmproducts where deleted='0' and product_category_id is not null and product_active='1' ".$wh_cat);
$i=0;
$sum=0;
while($r=mysql_fetch_array($w)){
$ss=$s[2009];
if($ss['product_sum_'.$r['id']]-$ss['product_pur_sum_'.$r['id']]<0)$value=0;
else $value=$ss['product_sum_'.$r['id']]-$ss['product_pur_sum_'.$r['id']];
$sum+=$value;
$ii++;
$arr[]=array(
"name"=>$r['code'],
"name1"=>$r['name'],
"value"=>$value,
);
}
$arr=multisort($arr,array(array('key'=>'value','sort'=>'desc')));
$i=0;
foreach($arr as $best){
if($best['value']>$sum/$ii)$bests[]=$best['name'];
$i++;
}
function getSales($code){
$sale0=0;
$sale30=0;
$sale90=0;
$sale180=0;
$qty0=0;
$qty30=0;
$qty90=0;
$qty180=0;
$ddate=date("Y-m-d",mktime()-365*24*3600);
//echo "select l.price as price,l.quantity as quantity,e.register_date as date from ecminvoiceoutitems as l inner join ecminvoiceouts as e on l.ecminvoiceout_id=e.id where l.code='".$code."' and e.type!='correct' and e.register_date>'".$ddate."' limit 100";
$w=mysql_query("select ecminvoiceoutitems.price as price,ecminvoiceoutitems.quantity as quantity,ecminvoiceouts.register_date as date from ecminvoiceoutitems inner join ecminvoiceouts on ecminvoiceoutitems.ecminvoiceout_id=ecminvoiceouts.id where ecminvoiceoutitems.ecmproduct_id='".$code."' and ecminvoiceouts.type!='correct' and ecminvoiceouts.register_date>'".$ddate."'");
//$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 '".$code."'");
while($r=mysql_fetch_array($w)){
$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")));
$d=explode("-",$r['date']);
$dd=$d[0]."-".$d[1];
if($dd==$date){
$sale0+=$r['price']*$r['quantity'];
$qty0+=$r['quantity'];
$aq0[$r['no']]+=$r['quantity'];
}
if($dd==$date1 || $dd==$date2 || $dd==$date3){
$sale90+=$r['price']*$r['quantity'];
$qty90+=$r['quantity'];
$aq90[$r['no']]+=$r['quantity'];
}
//if($dd==$date1 || $dd==$date2 || $dd==$date3){
$sale1+=$r['price']*$r['quantity'];
$qty1+=$r['quantity'];
$aq1[$r['no']]+=$r['quantity'];
//}
}
if($qty0>0)$SALE_AVG_PRICE0=round($sale0/$qty0,2);
if($qty90>0)$SALE_AVG_PRICE90=round($sale90/$qty90,2);
return array(
"qty0"=>$qty0,
"qty90"=>($qty90/3),
"qty1"=>($qty1/12),
"sale0"=>$sale0,
"sale90"=>$sale90,
"sale1"=>$sale1,
"avg0"=>$SALE_AVG_PRICE0,
"avg90"=>$SALE_AVG_PRICE90,
);
}
$vc=new vtigerConnector();
if($_GET['where'])$vc->where=$_GET['where'];
if(!$_GET['start'])$vc->limit="0,".$vc->pp;
else $vc->limit=$_POST['start'].",".$vc->pp;
if($_GET['order_by'])$order_by=$_GET['order_by'];
else $order_by="name";
if($_GET['sorder'])$sorder=$_GET['sorder'];
else $sorder="desc";
$vc->getData();
$vc->getCount();
$data=$vc->data=$_SESSION['EcmProductReportsData'];
set_include_path('include/PHPExcel/');
include 'PHPExcel.php';
include 'PHPExcel/Writer/Excel2007.php';
include 'PHPExcel/IOFactory.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("E5 CRM");
$objPHPExcel->getProperties()->setLastModifiedBy("E5 CRM");
$objPHPExcel->getProperties()->setTitle("Office 2007 PRODUCTS");
$objPHPExcel->getProperties()->setSubject("Office 2007 PRODUCTS");
$objPHPExcel->getProperties()->setDescription("PRODUCTS");
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('argb' => 'FFCCFFCC')
),
'borders' => array(
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
)
),
"A1:L1"
);
$alf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(20);
$objPHPExcel->getActiveSheet()->SetCellValue('A1','Product');
$objPHPExcel->getActiveSheet()->SetCellValue('B1','Code');
$objPHPExcel->getActiveSheet()->SetCellValue('C1','Category');
$objPHPExcel->getActiveSheet()->SetCellValue('D1','Inventory');
$objPHPExcel->getActiveSheet()->SetCellValue('E1','Ordered');
$objPHPExcel->getActiveSheet()->SetCellValue('F1','Delivery Date');
$objPHPExcel->getActiveSheet()->SetCellValue('G1','Inv+Ord');
$objPHPExcel->getActiveSheet()->SetCellValue('H1','Qty 12m');
$objPHPExcel->getActiveSheet()->SetCellValue('I1','Qty this m');
$objPHPExcel->getActiveSheet()->SetCellValue('J1','Stock m');
$objPHPExcel->getActiveSheet()->SetCellValue('K1','Pricebook');
$objPHPExcel->getActiveSheet()->SetCellValue('L1','Bestsell');
$j=0;
$w=mysql_query("select * from ecmproducts where deleted='0' and product_category_id is not null and product_active='1' and ".implode(" and ",$wh)." order by ".$order_by." ".$sorder);
while($r=mysql_fetch_array($w)){
//if(!$_REQUEST['check'][$i])continue;
$id=$r['id'];
$gs=getSales($id);
$inv_value=$r['ems_qty_in_stock'];
$inv_qty=$r['ems_qty_in_stock'];
$inv_price=$r['ems_price'];
$deliverydate=$data[$r['code']]['deliverydate'];
$_ord=0;
$_ord+=$data[$r['code']."_S"]['quantity'];
$_ord+=$data[$r['code']."_s"]['quantity'];
$_ord+=$data[$r['code']]['quantity'];
$objPHPExcel->getActiveSheet()->SetCellValue('A'.($j+2),$r['name']);
$objPHPExcel->getActiveSheet()->SetCellValue('B'.($j+2),$r['code']);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.($j+2),$r['product_category_name']);
if(in_array($r['code'],$bests))$b="B";
else $b="";
$objPHPExcel->getActiveSheet()->SetCellValue('D'.($j+2),$inv_value);
$objPHPExcel->getActiveSheet()->SetCellValue('E'.($j+2),$_ord);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.($j+2),$deliverydate);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.($j+2),($inv_qty+$_ord));
$objPHPExcel->getActiveSheet()->SetCellValue('H'.($j+2),((int)$gs['qty1']));
$objPHPExcel->getActiveSheet()->SetCellValue('I'.($j+2),((int)$gs['qty0']));
if($gs['qty1']>$gs['qty0'])$avg=$gs['qty1'];
else $avg=$gs['qty0'];
if($avg>0)$stock_m=(($inv_value+$r['ordered'])/$avg);
else $stock_m="err";
$objPHPExcel->getActiveSheet()->SetCellValue('J'.($j+2),$stock_m);
//pricebook
$accounts=array("Auchan","Carrefour","Euro","Real");
$dig=array();
foreach($accounts as $account){
$www=mysql_query("select p.id from ecmpricebooks_ecmproducts as p inner join ecmpricebooks as e on e.id=p.ecmpricebook_id where p.ecmproduct_id='".$id."' and e.name='".$account."' and e.deleted='0' and p.deleted='0'");
if(mysql_num_rows($www)>0)$dig[]=$account[0];
}
$objPHPExcel->getActiveSheet()->SetCellValue('K'.($j+2),implode(",",$dig));
$objPHPExcel->getActiveSheet()->SetCellValue('L'.($j+2),$b);
$j++;
}
$objPHPExcel->getActiveSheet()->setTitle('Simple');
$objPHPExcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
chmod("cache/upload",0777);
$microtime=str_replace(".","",str_replace(" ","",microtime()));
$name="cache/upload/ProductReport".$microtime.".xlsx";
$objWriter->save($name);
chmod($name,0777);
header("Location: ".$name);
?>

View File

@@ -0,0 +1,134 @@
<?php
include_once("modules/EcmProductReports/vtigerConnector.php");
include_once('modules/EcmCharts/chartHelper.php');
$vc=new vtigerConnector();
$vc->start=1;
$wc[]="1=1";
$wc[]="purchaseordercf.cf_528='0'";
$wc[]="purchaseorder.tracking_no!=''";
$vc->order_by="purchaseordercf.cf_532";
$vc->sorder="asc";
$vc->where=@implode(" and ",$wc);
$vc->getData();
$cnt=$vc->getCount();
$data=$vc->data;
if(count($data)>0){
foreach($data as $d){
if(in_array(trim($d['tracking_no']),$_REQUEST['check'])){
$r=mysql_fetch_array(mysql_query("select product_category_name from ecmproducts where code like '".$d['productcode']."' and deleted='0'"));
$d['category']=$r['product_category_name'];
$dd[]=$d;
}
}
}
$dd=multisort($dd,array(array('key'=>"deliverydate",'sort'=>"asc"),array('key'=>"tracking_no",'sort'=>"asc"),array('key'=>"category",'sort'=>"asc"),array('key'=>"productcode",'sort'=>"asc")));
$data=$dd;
set_include_path('include/PHPExcel/');
include 'PHPExcel.php';
include 'PHPExcel/Writer/Excel2007.php';
include 'PHPExcel/IOFactory.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("E5 CRM");
$objPHPExcel->getProperties()->setLastModifiedBy("E5 CRM");
$objPHPExcel->getProperties()->setTitle("Office 2007 PRICEBOOK");
$objPHPExcel->getProperties()->setSubject("Office 2007 PRICEBOOK");
$objPHPExcel->getProperties()->setDescription("PRICEBOOK");
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('argb' => 'FFCCFFCC')
),
'borders' => array(
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
)
),
"A1:E1"
);
$alf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$objPHPExcel->getActiveSheet()->SetCellValue('A1','Index');
$objPHPExcel->getActiveSheet()->SetCellValue('B1','Name');
$objPHPExcel->getActiveSheet()->SetCellValue('C1','Quantity');
$objPHPExcel->getActiveSheet()->SetCellValue('D1','Cartons');
$objPHPExcel->getActiveSheet()->SetCellValue('E1','CBM');
$j=0;
for($i=0;$i<count($data);$i++){
if($pom!=$data[$i]['tracking_no']){
$objPHPExcel->getActiveSheet()->SetCellValue('A'.($j+2),$data[$i]['tracking_no']." ".$GLOBALS['timedate']->to_display_date($data[$i]['deliverydate']));
$arr_y[]=$j+2;
$j++;
}
$pom=$data[$i]['tracking_no'];
$id=$vc->getIdByCode($data[$i]['productcode']);
$r=mysql_fetch_array(mysql_query("select pieces_per_carton as ppc,carton_volume_meter as cvm from ecmproducts where id='".$id."'"));
@$cartons=$data[$i]['quantity']/$r['ppc'];
@$cbm=$data[$i]['quantity']*$r['cvm']/$r['ppc'];
$qty_sum+=$data[$i]['quantity'];
$cartons_sum+=$cartons;
$cbm_sum+=$cbm;
$objPHPExcel->getActiveSheet()->SetCellValue('A'.($j+2),$data[$i]['productcode']);
$objPHPExcel->getActiveSheet()->SetCellValue('B'.($j+2),$data[$i]['productname']);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.($j+2),$data[$i]['quantity']);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.($j+2),$cartons);
$objPHPExcel->getActiveSheet()->SetCellValue('E'.($j+2),$cbm);
$j++;
}
foreach($arr_y as $ay){
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('argb' => 'FFFF33')
),
),
"A".$ay.":E".$ay
);
}
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('argb' => 'E6E6E6')
),
),
"A".($j+2).":E".($j+2)
);
$cnt=count($data);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.($j+2),number_format($qty_sum,0,"",""));
$objPHPExcel->getActiveSheet()->SetCellValue('D'.($j+2),number_format($cartons_sum,0,"",""));
$objPHPExcel->getActiveSheet()->SetCellValue('E'.($j+2),number_format($cbm_sum,0,"",""));
$objPHPExcel->getActiveSheet()->setTitle('Simple');
$objPHPExcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
chmod("cache/upload",0777);
$microtime=str_replace(".","",str_replace(" ","",microtime()));
$name="cache/upload/Containers".$microtime.".xlsx";
$objWriter->save($name);
chmod($name,0777);
header("Location: ".$name);
?>

View File

@@ -0,0 +1,36 @@
<?
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings, $current_user, $app_list_strings;
require_once('modules/EcmProductReports/EcmProductReport.php');
require_once('modules/EcmProductReports/Forms.php');
require_once ('include/time.php');
require_once('include/json_config.php');
$json_config = new json_config();
$focus = new EcmProductReport();
if(isset($_REQUEST['record']))$focus->retrieve($_REQUEST['record']);
require_once('include/MVC/View/SugarView.php');
if(file_exists('modules/EcmProductReports/views/view.detail.php')) {
require_once('modules/EcmProductReports/views/view.detail.php');
$detail = new EcmProductReport();
}
else{
require_once('include/MVC/View/views/view.detail.php');
$detail = new ViewDetail();
$detail->ss = new Sugar_Smarty();
$detail->module = 'EcmProductReports';
}
global $app_list_strings;
$detail->bean = $focus;
$detail->preDisplay();
echo $detail->display();
?>

View File

@@ -0,0 +1,160 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('data/SugarBean.php');
require_once('include/utils.php');
class EcmProductReport extends SugarBean {
var $field_name_map = array();
var $id;
var $date_entered;
var $date_modified;
var $modified_user_id;
var $assigned_user_id;
var $name;
var $module_dir = 'EcmProductReports';
var $table_name = "ecmproductreports";
var $object_name = "EcmProductReport";
var $new_schema = true;
var $additional_column_fields = array('assigned_user_name', 'assigned_user_id');
function EcmProductReport() {
parent::SugarBean();
$this->setupCustomFields('EcmProductReports');
foreach($this->field_defs as $field){
$this->field_name_map[$field['name']] = $field;
}
}
function get_summary_text(){
return $this->name;
}
function create_list_query($order_by, $where, $show_deleted = 0){
$custom_join = $this->custom_fields->getJOIN();
$query ="SELECT ";
$query.="ecmproductreports.*,users.user_name as assigned_user_name";
if($custom_join)$query.=$custom_join['select'];
$query.=" FROM ecmproductreports ";
$query.="LEFT JOIN users ON ecmproductreports.assigned_user_id=users.id";
$query.=" ";
if($custom_join)$query.=$custom_join['join'];
$where_auto='1=1';
if($show_deleted==0)$where_auto=" $this->table_name.deleted=0 ";
elseif($show_deleted==1)$where_auto=" $this->table_name.deleted=1 ";
if($where!="")$query.="where $where AND ".$where_auto;
else $query.="where ".$where_auto;
if(substr_count($order_by,'.')>0)$query .= " ORDER BY $order_by";
elseif($order_by != "")$query .= " ORDER BY $order_by";
else $query .= " ORDER BY ecmproductreports.name";
return $query;
}
function create_export_query($order_by,$where){
$custom_join = $this->custom_fields->getJOIN();
$query ="SELECT ";
$query.="ecmproductreports.*,users.user_name as assigned_user_name";
if($custom_join)$query.=$custom_join['select'];
$query.=" FROM ecmproductreports ";
$query.="LEFT JOIN users ON ecmproductreports.assigned_user_id=users.id";
$query.=" ";
if($custom_join)$query.=$custom_join['join'];
$where_auto='1=1';
if($show_deleted==0)$where_auto=" $this->table_name.deleted=0 ";
elseif($show_deleted==1)$where_auto=" $this->table_name.deleted=1 ";
if($where!="")$query.="where $where AND ".$where_auto;
else $query.="where ".$where_auto;
if(substr_count($order_by,'.')>0)$query .= " ORDER BY $order_by";
elseif($order_by != "")$query .= " ORDER BY $order_by";
else $query .= " ORDER BY ecmproductreports.name";
return $query;
}
function fill_in_additional_list_fields(){
}
function fill_in_additional_detail_fields(){
parent::fill_in_additional_detail_fields();
}
function get_list_view_data(){
global $current_language;
$the_array=parent::get_list_view_data();
$app_list_strings=return_app_list_strings_language($current_language);
$mod_strings=return_module_language($current_language,'EcmProductReports');
$the_array['NAME']=(($this->name == "") ? "<em>blank</em>" : $this->name);
$the_array['ENCODED_NAME']=$this->name;
return $the_array;
}
function build_generic_where_clause($the_query_string){
$where_clauses=array();
$the_query_string=PearDatabase::quote(from_html($the_query_string));
array_push($where_clauses,"ecmproductreports.name like '$the_query_string%'");
$the_where="";
foreach($where_clauses as $clause){
if($the_where!="")$the_where.=" or ";
$the_where.=$clause;
}
return $the_where;
}
function set_notification_body($xtpl,$ecmproductreport)
{
global $mod_strings,$app_list_strings;
$xtpl->assign("ECMPRODUCTREPORT_SUBJECT",$ecmproductreport->name);
return $xtpl;
}
function bean_implements($interface){
switch($interface){
case 'ACL':return true;
}
return false;
}
function save($check_notify=FALSE){
return parent::save($check_notify);
}
}
?>

View File

@@ -0,0 +1,73 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/EditView/QuickCreate.php');
require_once('modules/EcmProductReports/EcmProductReport.php');
require_once('include/javascript/javascript.php');
class EcmProductReportsQuickCreate extends QuickCreate {
var $javascript;
function process() {
global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
$mod_strings = return_module_language($current_language, 'EcmProductReports');
parent::process();
$this->ss->assign("PRIORITY_OPTIONS", get_select_options_with_id($app_list_strings['ecmproductreport_priority_dom'], $app_list_strings['ecmproductreport_priority_default_key']));
$this->ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['ecmproductreport_status_dom'], $app_list_strings['ecmproductreport_status_default_key']));
$this->ss->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['ecmproductreport_type_dom'],$app_list_strings['ecmproductreport_type_default_key']));
if($this->viaAJAX) { // override for ajax call
$this->ss->assign('saveOnclick', "onclick='if(check_form(\"ecmproductreportsQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"ecmproductreports\"); else return false;'");
$this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_ecmproductreports\")';");
}
$this->ss->assign('viaAJAX', $this->viaAJAX);
$this->javascript = new javascript();
$this->javascript->setFormName('ecmproductreportsQuickCreate');
$focus = new EcmProductReport();
$this->javascript->setSugarBean($focus);
$this->javascript->addAllFields('');
$this->ss->assign('additionalScripts', $this->javascript->getScript(false));
}
}
?>

View File

@@ -0,0 +1,37 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*********************************************************************************/
require_once('include/EditView/SideQuickCreate.php');

View File

@@ -0,0 +1,55 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $mod_strings;
if(ACLController::checkAccess('EcmProductReports', 'list', true)){
//$module_menu[]=array("index.php?module=EcmProductReports&action=index&return_module=EcmProductReports&return_action=DetailView", "Products on sea","EcmProductReports", 'EcmProductReports');
$module_menu[]=array("index.php?module=EcmProductReports&action=index1&return_module=EcmProductReports&return_action=DetailView", "Products to order","EcmProductReports", 'EcmProductReports');
$module_menu[]=array("index.php?module=EcmProductReports&action=index3&return_module=EcmProductReports&return_action=DetailView", "Containers on sea","EcmProductReports", 'EcmProductReports');
//$module_menu[]=array("index.php?module=EcmProductReports&action=index2&return_module=EcmProductReports&return_action=DetailView", "Warehouse cubics","EcmProductReports", 'EcmProductReports');
//$module_menu[]=array("index.php?module=EcmProductReports&action=index_orders&return_module=EcmProductReports&return_action=DetailView", "Orders on sea","EcmProductReports", 'EcmProductReports');
}
if(ACLController::checkAccess('EcmProductReports','list', true)) $module_menu[]=array('#', '<span style="display: none">wp_shortcut_fill_0</span>', '');
?>

View File

@@ -0,0 +1,96 @@
<?
include_once("modules/EcmProductReports/vtigerConnector.php");
include_once("modules/EcmPurchaseOrders/EcmPurchaseOrder.php");
mysql_query("delete e,p from ecmpurchaseorders as e inner join ecmproducts_ecmpurchaseorders as p on p.ecmpurchaseorder_id=e.id where e.order_id!='' or e.order_id is not null");
function updateOrder($id,$data){
$r=mysql_fetch_array(mysql_query("select id from ecmpurchaseorders where order_id='".$id."'"));
$iid=$r['id'];
$p=new EcmPurchaseOrder();
if($iid){
$p->retrieve($iid);
}
$p->assigned_user_id=1;
$p->template_id="97700b0d-fbe9-e366-4016-4b260f058a47";
$p->template_name="e5 Polska Sp. z o. o.";
$p->name=$data['subject'];
$p->status=$data['postatus'];
$p->tracking_no=$data['tracking_no'];
$p->register_date=$data['duedate'];
$p->delivery_date=$data['deliverydate'];
$r=mysql_fetch_array(mysql_query("select * from accounts where name like 'e5 Limited'"));
$p->parent_id=$r['id'];
$p->parent_name=$r['name'];
$p->parent_address_street=$r['billing_address_street'];
$p->parent_address_city=$r['billing_address_city'];
$p->parent_address_postalcode=$r['billing_address_postalcode'];
$p->parent_address_country=$r['billing_address_country'];
$p->ecmlanguage="pl_pl";
$p->currency_id="PLN";
$iid=$p->save();
mysql_query("update ecmpurchaseorders set order_id='".$id."',delivery_date='".$data['deliverydate']."',register_date='".$data['duedate']."' where id='".$iid."'");
}
function addLine($data){
$ro=mysql_fetch_array(mysql_query("select id from ecmpurchaseorders where order_id='".$data['purchaseorderid']."'"));
$rpp=mysql_fetch_array(mysql_query("select max(product_position) as max from ecmproducts_ecmpurchaseorders where ecmpurchaseorder_id='".$ro['id']."'"));
$pos=$rpp['max'];
$rp=mysql_fetch_array(mysql_query("select id,code,name,carton_volume_meter,pieces_per_carton,moq from ecmproducts where code like '".$data['productcode']."'"));
$rv=mysql_fetch_array(mysql_query("select id,name,value from ecmvats where value='0'"));
$arr['id']=create_guid();
$arr['date_entered']=date("Y-m-d H:i:s");
$arr['date_modified']=date("Y-m-d H:i:s");
$arr['modified_user_id']=1;
$arr['assigned_user_id']=1;
$arr['created_by']=1;
$arr['deleted']=0;
$arr['ecmpurchaseorder_id']=$ro['id'];
$arr['ecmproduct_id']=$rp['id'];
$arr['product_name']=$rp['name'];
$arr['product_code']=$rp['code'];
$arr['product_quantity']=$data['quantity'];
$arr['product_price']=$data['unit_price'];
$arr['product_discount']=0;
$arr['product_total']=$data['quantity']*$data['unit_price'];
$arr['product_unit_id']=1;
$arr['product_unit_name']="szt.";
$arr['product_vat_id']=$rv['id'];
$arr['product_vat_name']=$rv['name'];
$arr['product_vat_value']=$rv['value'];
$arr['product_category_id']="";
$arr['product_currency_id']="PLN";
$arr['product_cbm']=$rp['carton_volume_meter']/$rp['pieces_per_carton'];
$arr['product_moq']=$rp['moq'];
$arr['product_position']=$pos++;
foreach($arr as $k=>$v){
$s[]=$k."='".$v."'";
}
mysql_query("insert into ecmproducts_ecmpurchaseorders set ".implode(",",$s));
mysql_query("update ecmpurchaseorders set total=total+".($data['quantity']*$data['unit_price'])." where id='".$ro['id']."'");
}
$vc=new vtigerConnector();
$vc->start=1;
$vc->pp=9999999;
$vc->limit="0,".$vc->pp;
$vc->order_by="purchaseorder.duedate";
$vc->sorder="asc";
$wh[]="purchaseorder.postatus!=''";
$wh[]="(purchaseordercf.cf_528!='test')";
$vc->where=@implode(" and ",$wh);
$vc->getData();
$cnt=$vc->getCount();
$data=$vc->data;
echo '<pre>';
//print_r($data);
echo '</pre>';
foreach($data as $d){
$arr[$d['purchaseorderid']]=$d;
}
foreach($arr as $k=>$v){
updateOrder($k,$v);
}
foreach($data as $d){
addLine($d);
}
echo count($arr);
?>

View File

@@ -0,0 +1,61 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Contains field arrays that are used for caching
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$fields_array['EcmProductReport']=array(
'column_fields'=>array(
"id",
"date_entered",
"date_modified",
"modified_user_id",
"assigned_user_id",
"name",
),
'list_fields'=>array(
'id',
'assigned_user_name',
'assigned_user_id',
'name',
),
'required_fields' => array('name'=>1),
);
?>

View File

@@ -0,0 +1,453 @@
<?
include_once("modules/EcmProductReports/vtigerConnector.php");
$vc=new vtigerConnector();
$vc->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;$i<count($data);$i++){
$id=$vc->getIdByCode($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;
?>
<table cellspacing="0" cellpadding="0" border="0"><tr><td width="19"><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16"></td>
<td width="402"><h2>Products Reports: Products on sea </h2></td></tr></table><br />
<ul class="tablist">
<li>
<a class="current" href="#">Basic Search</a>
</li>
</ul>
<form action="index.php" method="get">
<input type="hidden" name="module" value="EcmProductReports" />
<input type="hidden" name="action" value="index" />
<table style="border-top: 0px none; margin-bottom: 4px;" class="tabForm" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="dataLabel" width="10%" nowrap="nowrap">
Product </td>
<td class="dataField" width="30%" nowrap="nowrap">
<input name="product_name" id="product_name" size="30" maxlength="255" value="<? echo $_GET['product_name'];?>" title="" tabindex="" type="text"> </td>
<td class="dataLabel" width="10%" nowrap="nowrap">
Code </td>
<td class="dataField" width="30%" nowrap="nowrap">
<input name="product_code" id="product_code" size="30" maxlength="255" value="<? echo $_GET['product_code'];?>" title="" tabindex="" type="text"> </td>
<td class="dataLabel" width="10%" nowrap="nowrap">
Purchase Order </td>
<td class="dataField" width="30%" nowrap="nowrap">
<input name="purchase_order" id="purchase_order" size="30" maxlength="255" value="<? echo $_GET['purchase_order'];?>" title="" tabindex="" type="text"> </td>
</tr>
<tr>
<td class="dataLabel" width="10%" nowrap="nowrap">
Status </td>
<td class="dataField" width="30%" nowrap="nowrap">
<select name="status"><? echo $vc->selectStatus($_GET['status']);?></select> </td>
<td class="dataLabel" width="10%" nowrap="nowrap">
Due Date </td>
<td class="dataField" width="30%" nowrap="nowrap">
<input autocomplete="off" name="due_date_from" id="due_date_from" value="<? echo $_GET['due_date_from'];?>" title="" tabindex="" size="11" maxlength="10" type="text">
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="due_date_from_trigger" align="absmiddle" border="0">
<script type="text/javascript">
Calendar.setup ({
inputField : "due_date_from",
daFormat : "<? echo str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));?>",
button : "due_date_from_trigger",
singleClick : true,
dateStr : "",
step : 1
}
);
</script>
&lt;&gt;
<input autocomplete="off" name="due_date_to" id="due_date_to" value="<? echo $_GET['due_date_to'];?>" title="" tabindex="" size="11" maxlength="10" type="text">
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="due_date_to_trigger" align="absmiddle" border="0">
<script type="text/javascript">
Calendar.setup ({
inputField : "due_date_to",
daFormat : "<? echo str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));?>",
button : "due_date_to_trigger",
singleClick : true,
dateStr : "",
step : 1
}
);
</script> </td>
<td class="dataLabel" width="10%" nowrap="nowrap">
Delivery Time </td>
<td class="dataField" width="30%" nowrap="nowrap">
<input autocomplete="off" name="delivery_time_from" id="delivery_time_from" value="<? echo $_GET['delivery_time_from'];?>" title="" tabindex="" size="11" maxlength="10" type="text">
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="delivery_time_from_trigger" align="absmiddle" border="0">
<script type="text/javascript">
Calendar.setup ({
inputField : "delivery_time_from",
daFormat : "<? echo str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));?>",
button : "delivery_time_from_trigger",
singleClick : true,
dateStr : "",
step : 1
}
);
</script>
&lt;&gt;
<input autocomplete="off" name="delivery_time_to" id="delivery_time_to" value="<? echo $_GET['delivery_time_to'];?>" title="" tabindex="" size="11" maxlength="10" type="text">
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="delivery_time_to_trigger" align="absmiddle" border="0">
<script type="text/javascript">
Calendar.setup ({
inputField : "delivery_time_to",
daFormat : "<? echo str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));?>",
button : "delivery_time_to_trigger",
singleClick : true,
dateStr : "",
step : 1
}
);
</script> </td>
</tr>
<tr>
<td class="dataLabel" nowrap="nowrap">&nbsp;</td>
<td class="dataField" nowrap="nowrap">&nbsp;</td>
<td class="dataLabel" nowrap="nowrap">&nbsp;</td>
<td class="dataField" nowrap="nowrap">&nbsp;</td>
<td class="dataLabel" nowrap="nowrap">&nbsp;</td>
<td class="dataField" nowrap="nowrap">&nbsp;</td>
</tr>
<tr>
<td class="dataLabel" width="10%" nowrap="nowrap">
List Price </td>
<td class="dataField" width="30%" nowrap="nowrap">
<input name="list_price_from" id="list_price_from" size="10" maxlength="255" value="<? echo $_GET['list_price_from'];?>" title="" tabindex="" type="text">
&lt;&gt;
<input name="list_price_to" id="list_price_to" size="10" maxlength="255" value="<? echo $_GET['list_price_to'];?>" title="" tabindex="" type="text"> </td>
<td class="dataLabel" width="10%" nowrap="nowrap">
Quantity </td>
<td class="dataField" width="30%" nowrap="nowrap">
<input name="quantity_from" id="quantity_from" size="10" maxlength="255" value="<? echo $_GET['quantity_from'];?>" title="" tabindex="" type="text">
&lt;&gt;
<input name="quantity_to" id="quantity_to" size="10" maxlength="255" value="<? echo $_GET['quantity_to'];?>" title="" tabindex="" type="text"> </td>
<td class="dataLabel" width="10%" nowrap="nowrap">
Category </td>
<td class="dataField" width="30%" nowrap="nowrap">
<select name="category"><option value="">select</option>
<?
$w=mysql_query("select id,name from ecmproductcategories where deleted='0' order by name asc");
while($r=mysql_fetch_array($w)){
echo '<option value="'.$r['id'].'"';
if($r['id']==$_REQUEST['category'])echo ' selected';
echo '>'.$r['name'].'</option>';
}
?>
</td>
</tr>
<tr>
<td class="dataLabel" nowrap="nowrap">Product active </td>
<td class="dataField" nowrap="nowrap">
<select name="active">
<option value="" <? if($_REQUEST['active']=="")echo "selected";?>>select</option>
<option value="1" <? if($_REQUEST['active']=="1")echo "selected";?>>Yes</option>
<option value="0" <? if($_REQUEST['active']=="0")echo "selected";?>>No</option>
</select>
</td>
</tr>
</tbody>
</table>
<input class="button" name="submit" value="Search" type="submit">&nbsp;
<input class="button" name="clear" value="Clear" type="button" onclick="location.href='index.php?module=EcmProductReports&action=index';">
</form>
<table class="h3Row" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td nowrap="nowrap">
<h3>Products List</h3>
</td>
<td width="100%">
<img src="include/images/blank.gif" alt="" width="1" height="1">
</td>
</tr>
</tbody>
</table>
<?
if($_GET['start']+$vc->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 '<form action="index.php" method="post">';
print '<input type="hidden" value="EcmProductReports" name="module">';
print '<input type="hidden" value="CreateXLS" name="action">';
print '<input type="hidden" name="where" value="'.$vc->where.'">';
print '<input type="hidden" name="order_by" value="'.$vc->order_by.'">';
print '<input type="hidden" name="sorder" value="'.$vc->sorder.'">';
print '<input type="hidden" name="limit" value="'.$vc->limit.'">';
print '<input type="hidden" name="start" value="'.($vc->start-1).'">';
print '<input type="hidden" name="to_pdf" value="1">';
print '<div id="products_list">';
print '<script language="javascript">
function check_all_products(v){
var ch=document.getElementsByTagName("input");
for(var i=0;i<ch.length;i++){
if(ch[i].id!="chall"){
if(v==true){
ch[i].checked=true;
}
else{
ch[i].checked=false;
}
}
}
}
</script>';
print '<table cellpadding="0" cellspacing="0" width="1300" border="0" class="ListView">';
?>
<tr>
<td colspan="9">
<table width="100%">
<tr>
<td width="50%">
<?
print '<input type="submit" value="Create XLS" class="button" onclick="this.form.action.value=\'CreateXLS\';">&nbsp;';
print '<input type="submit" value="Create PDF" class="button" onclick="this.form.action.value=\'CreatePDF\';">';
?>
</td>
<td id="listViewPaginationButtons" class="listViewPaginationTdS1" width="100%" align="right" nowrap="nowrap">
<? echo $vc->generateButtons($btns); ?>
</td>
</tr>
</table>
</td></tr>
<?
print '<tr>';
print '<td class="listViewThS1" width="1%"><input type="checkbox" id="chall" onclick="check_all_products(this.checked)" checked></td>';
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 '</tr>';
for($i=0;$i<count($data);$i++){
$sale30=0;
$qty30=0;
$aq30=array();
$sale90=0;
$qty90=0;
$aq90=array();
$sale180=0;
$qty180=0;
$aq180=array();
$id=$vc->getIdByCode($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='<a href="index.php?module=EcmProductCategories&action=DetailView&record='.$rc['product_category_id'].'">'.$rc['product_category_name'].'</a>';
print '<tr>';
print '<td class="oddListRowS1" width="1%"><input type="checkbox" value="1" name="check['.$i.']" checked></td>';
print '<td class="oddListRowS1" width="20%"><a href="index.php?module=EcmProducts&action=DetailView&record='.$id.'">'.$data[$i]['productname'].'</a></td>';
print '<td class="oddListRowS1" width="10%">'.$data[$i]['productcode'].'</td>';
print '<td class="oddListRowS1" width="10%">'.$category.'</td>';
print '<td class="oddListRowS1" width="5%"><a href="http://81.89.194.6/crm/index.php?module=Orders&action=DetailView&record='.$data[$i]['purchaseorderid'].'">'.$data[$i]['purchaseorderid'].'</a></td>';
/*print '<td class="oddListRowS1" width="10%">';
if($qty90>0){
print number_format(($sale90/$qty90),2,",",".");
$saleqtysum90+=($sale90/$qty90);
}
print '</td>';*/
/*print '<td class="oddListRowS1" width="10%">';
if($qty180>0){
print number_format(($sale180/$qty180),2,",",".");
$saleqtysum180+=($sale180/$qty180);
}
print '</td>';
print '<td class="oddListRowS1" width="10%">'.number_format(($qty90/3),2,",",".").'</td>';
$qtysum90+=($qty90/3);
print '<td class="oddListRowS1" width="10%">'.number_format(($qty180/6),2,",",".").'</td>';
$qtysum180+=($qty180/6);
*/
print '<td class="oddListRowS1" width="10%">'.number_format($data[$i]['quantity'],0,"","").'</td>';
$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 '<td class="oddListRowS1" width="10%">'.number_format($rrrr['ems_qty_in_stock'],0,"","").'</td>';
$emsqtyinstock+=$rrrr['ems_qty_in_stock'];
//print '<td class="oddListRowS1" width="10%">'.number_format(($rrrr['ems_price']*$rrrr['ems_qty_in_stock']),2,",",".").'</td>';
$emsqtyinstockinv+=($rrrr['ems_price']*$rrrr['ems_qty_in_stock']);
print '<td class="oddListRowS1" width="10%">';
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 '</td>';
if($rrrr['pieces_per_carton']>0)$cbm+=(($rrrr['ems_qty_in_stock']*$rrrr['carton_volume_meter'])/$rrrr['pieces_per_carton']);
//print '<td class="oddListRowS1" width="10%">'.$data[$i]['postatus'].'</td>';
//print '<td class="oddListRowS1" width="10%">'.$vc->timeDate($duedate).'</td>';
print '<td class="oddListRowS1" width="10%">'.$vc->timeDate($deliverydate).'</td>';
//print '<td class="oddListRowS1" width="10%">'.$vc->formatNumber($data[$i]['listprice']).'</td>';
print '<td class="oddListRowS1" width="10%">'.$data[$i]['tracking_no'].'</td>';
$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 '</tr>';
}
$cnt=count($data);
print '<tr style="background: #e6e6e6; font-weight: bolder;">
<td class="oddListRowS1" colspan="2">Summary</td>
<td class="oddListRowS1"></td>
<td class="oddListRowS1"></td>
<td class="oddListRowS1"></td>
<!--<td class="oddListRowS1">'.@number_format($saleqtysum90/$cnt,2,",",".").'</td>
<td class="oddListRowS1">'.@number_format($saleqtysum180/$cnt,2,",",".").'</td>
<td class="oddListRowS1">'.@number_format($qtysum90/$cnt,2,",",".").'</td>
<td class="oddListRowS1">'.@number_format($qtysum180/$cnt,2,",",".").'</td>-->
<td class="oddListRowS1">'.number_format($qtyo,0,"","").'</td>
<td class="oddListRowS1">'.number_format($emsqtyinstock,0,"","").'</td>
<!--<td class="oddListRowS1">'.number_format($emsqtyinstockinv,2,",",".").'</td>-->
<td class="oddListRowS1">'.number_format($cbm,2,",",".").'</td>
<td class="oddListRowS1"></td>
<td class="oddListRowS1"></td>
<!--<td class="oddListRowS1">'.@number_format($listprice/$cnt,2,",",".").'</td>-->
</tr>';
print '</table>';
print '</div>';
print '</form>';
?>

View File

@@ -0,0 +1,403 @@
<?
include_once("modules/EcmProductReports/vtigerConnector.php");
function getSales($code){
$sale0=0;
$sale30=0;
$sale90=0;
$sale180=0;
$qty0=0;
$qty30=0;
$qty90=0;
$qty180=0;
$ddate=date("Y-m-d",mktime()-365*24*3600);
//echo "select l.price as price,l.quantity as quantity,e.register_date as date from ecminvoiceoutitems as l inner join ecminvoiceouts as e on l.ecminvoiceout_id=e.id where l.code='".$code."' and e.type!='correct' and e.register_date>'".$ddate."' limit 100";
$w=mysql_query("select ecminvoiceoutitems.price as price,ecminvoiceoutitems.quantity as quantity,ecminvoiceouts.register_date as date from ecminvoiceoutitems inner join ecminvoiceouts on ecminvoiceoutitems.ecminvoiceout_id=ecminvoiceouts.id where ecminvoiceoutitems.ecmproduct_id='".$code."' and ecminvoiceouts.type!='correct' and ecminvoiceouts.register_date>'".$ddate."'");
//$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 '".$code."'");
while($r=mysql_fetch_array($w)){
$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")));
$d=explode("-",$r['date']);
$dd=$d[0]."-".$d[1];
if($dd==$date){
$sale0+=$r['price']*$r['quantity'];
$qty0+=$r['quantity'];
$aq0[$r['no']]+=$r['quantity'];
}
if($dd==$date1 || $dd==$date2 || $dd==$date3){
$sale90+=$r['price']*$r['quantity'];
$qty90+=$r['quantity'];
$aq90[$r['no']]+=$r['quantity'];
}
//if($dd==$date1 || $dd==$date2 || $dd==$date3){
$sale1+=$r['price']*$r['quantity'];
$qty1+=$r['quantity'];
$aq1[$r['no']]+=$r['quantity'];
//}
}
if($qty0>0)$SALE_AVG_PRICE0=round($sale0/$qty0,2);
if($qty90>0)$SALE_AVG_PRICE90=round($sale90/$qty90,2);
return array(
"qty0"=>$qty0,
"qty90"=>($qty90/3),
"qty1"=>($qty1/12),
"sale0"=>$sale0,
"sale90"=>$sale90,
"sale1"=>$sale1,
"avg0"=>$SALE_AVG_PRICE0,
"avg90"=>$SALE_AVG_PRICE90,
);
}
$vc=new vtigerConnector();
$vc->start=$_GET['start']+1;
//$wc[]="purchaseorder.tracking_no=''";
$wh[]="1=1";
if($_GET['submit']){
if($_GET['product_category_id'])$wh[]="product_category_id='".$_GET['product_category_id']."'";
if($_GET['product_name'])$wh[]="name like '".$_GET['product_name']."%'";
if($_GET['product_code'])$wh[]="code like '".$_GET['product_code']."%'";
if($_GET['active']){
if($_GET['active']=="yes")$wh[]="product_active='1'";
if($_GET['active']=="no")$wh[]="product_active='0'";
}
if($_GET['production']){
if($_GET['production']=="yes")$wh[]="production='1'";
if($_GET['production']=="no")$wh[]="production='0'";
}
if($_GET['end_of_line']){
if($_GET['end_of_line']=="yes")$wh[]="end_of_line='1'";
if($_GET['end_of_line']=="no")$wh[]="end_of_line='0'";
}
}
//$vc->where=@implode(" and ",$wc);
if(!$_GET['start'])$limit="0,".$vc->pp;
else $limit=$_GET['start'].",".$vc->pp;
if($_GET['order_by'])$order_by=$_GET['order_by'];
else $order_by="name";
if($_GET['sorder'])$sorder=$_GET['sorder'];
else $sorder="desc";
//$vc->where=@implode(" and ",$wc);
$vc->getData();
$cnt=$vc->getCount();
$data=$vc->data;
for($i=0;$i<count($data);$i++){
if(!$dd_pom[strtoupper($data[$i]['productcode'])])$dd_pom[strtoupper($data[$i]['productcode'])]="9999-99-99";
if($_REQUEST['product_category_id'] || $_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['product_category_id'])continue;
if($cat['product_active']==0 && $_REQUEST['active']=="yes")continue;
if($cat['product_active']==1 && $_REQUEST['active']=="no")continue;
}
//if(strtoupper($data[$i]['productcode'])=="RE01633")echo $dat[strtoupper($data[$i]['productcode'])]['quantity']." <br>";
$qty_pom=$dat[strtoupper($data[$i]['productcode'])]['quantity'];
if($dat[strtoupper($data[$i]['productcode'])]['deliverydate'])$dd_pom[strtoupper($data[$i]['productcode'])]=$dat[strtoupper($data[$i]['productcode'])]['deliverydate'];
$dat[strtoupper($data[$i]['productcode'])]=$data[$i];
//$dat[strtoupper($data[$i]['productcode'])]['deliverydate']=$data[$i]['deliverydate'];
$dat[strtoupper($data[$i]['productcode'])]['quantity']=$qty_pom+$dat[strtoupper($data[$i]['productcode'])]['quantity'];
if($dd_pom[strtoupper($data[$i]['productcode'])]>$data[$i]['deliverydate'])$dat[strtoupper($data[$i]['productcode'])]['deliverydate']=$data[$i]['deliverydate'];
}
$data=$dat;
if($_REQUEST['die']==1){
echo '<pre>';
print_r($data);
echo '</pre>';
die();
}
$_SESSION['EcmProductReportsData']=$data;
?>
<table cellspacing="0" cellpadding="0" border="0"><tr><td width="19"><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16"></td>
<td width="544"><h2>Products Reports: Products to orders </h2></td></tr></table><br />
<ul class="tablist">
<li>
<a class="current" href="#">Basic Search</a>
</li>
</ul>
<form action="index.php" method="get">
<input type="hidden" name="module" value="EcmProductReports" />
<input type="hidden" name="action" value="index1" />
<table style="border-top: 0px none; margin-bottom: 4px;" class="tabForm" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="dataLabel" width="10%" nowrap="nowrap">
Product </td>
<td class="dataField" width="30%" nowrap="nowrap">
<input name="product_name" id="product_name" size="30" maxlength="255" value="<? echo $_GET['product_name'];?>" title="" tabindex="" type="text"> </td>
<td class="dataLabel" width="10%" nowrap="nowrap">
Code </td>
<td class="dataField" width="30%" nowrap="nowrap">
<input name="product_code" id="product_code" size="30" maxlength="255" value="<? echo $_GET['product_code'];?>" title="" tabindex="" type="text"> </td>
<td class="dataLabel" width="10%" nowrap="nowrap">
Category </td>
<td class="dataField" width="30%" nowrap="nowrap">
<select name="product_category_id">
<option value="">select</option>
<?php
$w=mysql_query("select id,name from ecmproductcategories where deleted='0' order by name");
while($r=mysql_fetch_array($w)){
echo '<option value="'.$r['id'].'"';
if($r['id']==$_GET['product_category_id'])echo " selected";
echo '>'.$r['name'].'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td class="dataLabel" width="10%" nowrap="nowrap">
Active </td>
<td class="dataField" width="30%" nowrap="nowrap">
<select name="active">
<option value=""></option>
<option value="yes"<? if($_REQUEST['active']=="yes")echo " selected";?>>Yes</option>
<option value="no"<? if($_REQUEST['active']=="no")echo " selected";?>>No</option>
</select>
</td>
<td class="dataLabel" width="10%" nowrap="nowrap">
Production </td>
<td class="dataField" width="30%" nowrap="nowrap">
<select name="production">
<option value=""></option>
<option value="yes"<? if($_REQUEST['production']=="yes")echo " selected";?>>Yes</option>
<option value="no"<? if($_REQUEST['production']=="no")echo " selected";?>>No</option>
</select>
</td>
<td class="dataLabel" width="10%" nowrap="nowrap">
End of line </td>
<td class="dataField" width="30%" nowrap="nowrap">
<select name="end_of_line">
<option value=""></option>
<option value="yes"<? if($_REQUEST['end_of_line']=="yes")echo " selected";?>>Yes</option>
<option value="no"<? if($_REQUEST['end_of_line']=="no")echo " selected";?>>No</option>
</select>
</td>
</tr>
</table>
<input class="button" name="submit" value="Search" type="submit">&nbsp;
<input class="button" name="clear" value="Clear" type="button" onclick="location.href='index.php?module=EcmProductReports&action=index';">
</form>
<table class="h3Row" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td nowrap="nowrap">
<h3>Products List</h3>
</td>
<td width="100%">
<img src="include/images/blank.gif" alt="" width="1" height="1">
</td>
</tr>
</tbody>
</table>
<?
if($_GET['start']+$vc->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 '<form action="index.php" method="post">';
print '<input type="hidden" value="EcmProductReports" name="module">';
print '<input type="hidden" value="CreateXLS1" name="action">';
print '<input type="hidden" name="where" value="'.$vc->where.'">';
print '<input type="hidden" name="order_by" value="'.$order_by.'">';
print '<input type="hidden" name="sorder" value="'.$sorder.'">';
print '<input type="hidden" name="limit" value="'.$vc->limit.'">';
print '<input type="hidden" name="start" value="'.($vc->start-1).'">';
print '<input type="hidden" name="to_pdf" value="1">';
print '<div id="products_list">';
print '<script language="javascript">
function check_all_products(v){
var ch=document.getElementsByTagName("input");
for(var i=0;i<ch.length;i++){
if(ch[i].id!="chall"){
if(v==true){
ch[i].checked=true;
}
else{
ch[i].checked=false;
}
}
}
}
</script>';
print '<table cellpadding="0" cellspacing="0" width="1300" border="0" class="ListView">';
?>
<tr>
<td colspan="9">
<table width="100%">
<tr>
<td width="50%">
<?
foreach($_GET as $k=>$v)$link.=$k."=".$v."&";
print '<input type="submit" value="Create XLS" class="button" onclick="location.href=\'index.php?'.$link.'&action=CreateXLS1">&nbsp;';
?>
</td>
<!--<td id="listViewPaginationButtons" class="listViewPaginationTdS1" width="100%" align="right" nowrap="nowrap">
<? //echo $vc->generateButtons($btns); ?>
</td>-->
</tr>
</table>
</td></tr>
<?
print '<tr>';
print '<td class="listViewThS1" width="1%"><input type="checkbox" id="chall" onclick="check_all_products(this.checked)" checked></td>';
print $vc->sortableColumn("Product","name",$_GET['sorder'],20,"index");
print $vc->sortableColumn("Code","code",$_GET['sorder'],5,"index");
print $vc->sortableColumn("Category","product_category_name",$_GET['sorder'],10,"index");
print $vc->sortableColumn("Inv pcs","ems_qty_in_stock",$_GET['sorder'],5,"index");
print $vc->sortableColumn("Ord pcs","name",$_GET['sorder'],7,"index");
print $vc->sortableColumn("Delivery Date","deliverydate",$_GET['sorder'],10,"index");
print $vc->sortableColumn("Inv+Ord","ems_qty_in_stock",$_GET['sorder'],7,"index");
print $vc->sortableColumn("Qty 12m","qty90",$_GET['sorder'],10,"index");
print $vc->sortableColumn("Qty this m","qty0",$_GET['sorder'],10,"index");
print $vc->sortableColumn("Stock m + ord","stock_month",$_GET['sorder'],7,"index");
print $vc->sortableColumn("Pricebook","name",$_GET['sorder'],10,"index");
print $vc->sortableColumn("Bestsell","name",$_GET['sorder'],7,"index");
print '</tr>';
include_once('modules/EcmCharts/chartHelper.php');
$s=sum(2009);
if($_GET['product_category_id'])$wh_cat=" and product_category_id='".$_GET['product_category_id']."'";
else $wh_cat="";
if($_GET['active']){
if($_GET['active']=="yes")$wh_act=" and product_active='1'";
if($_GET['active']=="no")$wh_act=" and product_active='0'";
}
else $wh_act="";
if($_GET['production']){
if($_GET['production']=="yes")$wh_p=" and production='1'";
if($_GET['production']=="no")$wh_p=" and production='0'";
}
else $wh_p="";
if($_GET['end_of_line']){
if($_GET['end_of_line']=="yes")$wh_e=" and end_of_line='1'";
if($_GET['end_of_line']=="no")$wh_e=" and end_of_line='0'";
}
else $wh_e="";
$w=mysql_query("select id,code,name from ecmproducts where deleted='0' and product_category_id is not null ".$wh_e." ".$wh_p." ".$wh_act." ".$wh_cat);
$i=0;
$sum=0;
echo mysql_error();
while($r=mysql_fetch_array($w)){
$ss=$s[2009];
if($ss['product_sum_'.$r['id']]-$ss['product_pur_sum_'.$r['id']]<0)$value=0;
else $value=$ss['product_sum_'.$r['id']]-$ss['product_pur_sum_'.$r['id']];
$sum+=$value;
$ii++;
$arr[]=array(
"name"=>$r['code'],
"name1"=>$r['name'],
"value"=>$value,
);
}
$arr=multisort($arr,array(array('key'=>'value','sort'=>'desc')));
$i=0;
if(count($arr)>0){
foreach($arr as $best){
if($best['value']>$sum/$ii)$bests[]=$best['name'];
$i++;
}
}
$w=mysql_query("select * from ecmproducts where deleted='0' and product_category_id is not null and ".implode(" and ",$wh)." order by ".$order_by." ".$sorder);
print '<tbody style="overflow: auto;height:500px;">';
while($r=mysql_fetch_array($w)){
$id=$r['id'];
//if(mysql_num_rows(mysql_query("select id from ecmproductcomponents where ecmproduct_id='".$id."' and deleted='0'"))>0)continue;
$gs=getSales($id);
$inv_value=$r['ems_qty_in_stock'];
$inv_qty=$r['ems_qty_in_stock'];
$inv_price=$r['ems_price'];
$deliverydate=$data[strtoupper($r['code'])]['deliverydate'];
$_ord=0;
//if(!$data[$r['code']."_S"]['quantity']){
//$ww=mysql_query("select ordered from ecmproducts where code like '".$r['code']."_S' and deleted='0'");
//while($rr=mysql_fetch_array($ww))$_ord+=$rr['ordered'];
//}
//else{
//$_ord+=$data[$r['code']."_S"]['quantity'];
//$_ord+=$data[$r['code']."_s"]['quantity'];
//}
$_ord+=$data[strtoupper($r['code'])."_S"]['quantity'];
$_ord+=$data[strtoupper($r['code'])."_s"]['quantity'];
$_ord+=$data[strtoupper($r['code'])]['quantity'];
print '<tr>';
print '<td class="oddListRowS1" width="1%"><input type="checkbox" value="1" name="check['.$i.']" checked></td>';
print '<td class="oddListRowS1" width="20%"><a href="index.php?module=EcmProducts&action=DetailView&record='.$id.'">'.$r['name'].'</a></td>';
print '<td class="oddListRowS1" width="5%">'.$r['code'].'</td>';
print '<td class="oddListRowS1" width="10%"><a href="index.php?module=EcmProductCategories&action=DetailView&record='.$r['product_category_id'].'">'.$r['product_category_name'].'</a></td>';
if(@in_array($r['code'],$bests))$b="B";
else $b="";
print '<td class="oddListRowS1" width="5%">'.number_format($inv_value,0,"","").'</td>';
print '<td class="oddListRowS1" width="7%">'.number_format($_ord,0,"","").'</td>';
print '<td class="oddListRowS1" width="10%">'.$vc->timeDate($deliverydate).'</td>';
print '<td class="oddListRowS1" width="5%">'.number_format(($inv_qty+$_ord),0,"","").'</td>';
print '<td class="oddListRowS1" width="10%">'.number_format(($gs['qty1']),0,"","").'</td>';
print '<td class="oddListRowS1" width="10%">'.number_format(($gs['qty0']),0,"","").'</td>';
if($gs['qty1']>$gs['qty0'])$avg=$gs['qty1'];
else $avg=$gs['qty0'];
if($avg)@$stockm=number_format(floor(($inv_value+$_ord)/($avg)),0,"","");
else $stockm="err";
mysql_query("update ecmproducts set stock_month='".$stockm."',qty0='".$gs['qty0']."',qty90='".$gs['qty1']."' where id='".$r['id']."'");
//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 '<td class="oddListRowS1" width="7%">'.$stockm.'</td>';
//pricebook
$accounts=array("Auchan","Carrefour","Euro","Real");
$dig=array();
foreach($accounts as $account){
$www=mysql_query("select p.id from ecmpricebooks_ecmproducts as p inner join ecmpricebooks as e on e.id=p.ecmpricebook_id where p.ecmproduct_id='".$id."' and e.name='".$account."' and e.deleted='0' and p.deleted='0'");
if(mysql_num_rows($www)>0)$dig[]=$account[0];
}
print '<td class="oddListRowS1" width="10%">'.implode(",",$dig).'</td>';
print '<td class="oddListRowS1" width="7%">'.$b.'</td>';
print '</tr>';
}
print '</tbody>';
print '</table>';
print '</div>';
print '</form>';
?>

View File

@@ -0,0 +1,222 @@
<table cellspacing="0" cellpadding="0" border="0"><tr><td width="19"><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16"></td>
<td width="544"><h2>Warehouse cubics </h2></td></tr></table><br />
<table class="h3Row" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td nowrap="nowrap">
<h3>Months List</h3>
</td>
<td width="100%">
<img src="include/images/blank.gif" alt="" width="1" height="1">
</td>
</tr>
</tbody>
</table>
<?
include_once("modules/EcmReports/cache.php");
include_once("modules/EcmProductReports/vtigerConnector.php");
$vc=new vtigerConnector();
$vc->start=1;
$wc[]="1=1";
$wc[]="purchaseordercf.cf_528='0'";
$wc[]="purchaseorder.tracking_no!=''";
$vc1->where=@implode(" and ",$wc);
$vc->getData();
$cnt=$vc->getCount();
$data=$vc->data;
/*
for($i=0;$i<count($data);$i++){
if($data[$i]['deliverydate'])$dat[$data[$i]['productcode']]=$data[$i];
}
$data=$dat;
*/
$vc1=new vtigerConnector();
$vc1->start=1;
$wc1[]="1=1";
$wc1[]="purchaseordercf.cf_528='1'";
$wc1[]="purchaseorder.tracking_no!=''";
$vc1->where=@implode(" and ",$wc1);
$vc1->getData();
$cnt=$vc1->getCount();
$data1=$vc1->data;
/*
for($i=0;$i<count($data1);$i++){
if($data1[$i]['deliverydate'])$dat1[$data1[$i]['productcode']]=$data1[$i];
}
$data1=$dat1;
*/
function getSales($date1,$date2){
$sale=0;
$qty=0;
$w=mysql_query("select p.carton_volume_meter,p.pieces_per_carton,ecminvoiceoutitems.price as price,ecminvoiceoutitems.quantity as quantity,ecminvoiceouts.register_date as date,ecminvoiceouts.type as type,ecminvoiceoutitems.ecminvoiceoutitem_id as item from ecminvoiceoutitems inner join ecminvoiceouts on ecminvoiceoutitems.ecminvoiceout_id=ecminvoiceouts.id inner join ecmproducts as p on p.id=ecminvoiceoutitems.ecmproduct_id where ecminvoiceouts.status='accepted' and ecminvoiceouts.register_date>='".$date1."' and ecminvoiceouts.register_date<='".$date2."'");
while($r=mysql_fetch_array($w)){
//if($r['type']!="correct"){
$sale+=$r['price']*$r['quantity'];
$qty+=$r['quantity'];
@$cbm+=$r['quantity']*$r['carton_volume_meter']/$r['pieces_per_carton'];
//}
if($r['type']=="correct"){
$rr=mysql_fetch_array(mysql_query("select price,quantity from ecminvoiceoutitems where id='".$r['item']."'"));
$sale-=$rr['price']*$rr['quantity'];
$qty-=$rr['quantity'];
@$cbm-=$rr['quantity']*$r['carton_volume_meter']/$r['pieces_per_carton'];
}
}
return array(
"qty"=>$qty,
"sale"=>$sale,
"cbm"=>$cbm,
);
}
function getQuotes($date1,$date2){
$sale=0;
$qty=0;
$w=mysql_query("select p.carton_volume_meter,p.pieces_per_carton,ecmquoteitems.price as price,ecmquoteitems.quantity as quantity from ecmquoteitems inner join ecmquotes on ecmquoteitems.ecmquote_id=ecmquotes.id inner join ecmproducts as p on p.id=ecmquoteitems.ecmproduct_id where ecmquotes.status!='s10' and ecmquotes.validtill_date>'".$date1."' and ecmquotes.validtill_date<='".$date2."'");
while($r=mysql_fetch_array($w)){
$sale+=$r['price']*$r['quantity'];
$qty+=$r['quantity'];
@$cbm+=$r['quantity']*$r['carton_volume_meter']/$r['pieces_per_carton'];
}
return array(
"qty"=>$qty,
"sale"=>$sale,
"cbm"=>$cbm,
);
}
function getS($year,$month,$mmm){
//@$c=$s['cbm']/$s['qty'];
$ww=mysql_query("select id,carton_volume_meter,pieces_per_carton from ecmproducts where product_active='1' and deleted='0'");
$sum=sum($year,"","","",1);
while($rr=mysql_fetch_array($ww)){
$w=mysql_query("select value as quantity from ecmsalesreports_predictions_cat where year='".$year."' and month='".$month."' and bean_id='".$rr['id']."'");
if(mysql_num_rows($w)>0){
while($r=mysql_fetch_array($w)){
if($rr['pieces_per_carton'])$cbm+=$r['quantity']*$rr['carton_volume_meter']/$rr['pieces_per_carton'];
}
}
else{
$s=getSum($sum,$year,$rr['id']);
if($rr['pieces_per_carton'])$cbm+=$s['qty']*$rr['carton_volume_meter']/$rr['pieces_per_carton'];
}
}
return ($cbm/$mmm);
}
function getCbm($stock_id,$date){
$w=mysql_query("select o.quantity,p.carton_volume_meter,p.pieces_per_carton,o.type from ecmstockoperations as o inner join ecmproducts as p on p.id=o.product_id where o.date_entered<='".$date."' and o.stock_id='".$stock_id."'");
while($r=mysql_fetch_array($w)){
if($r['type']==0){
@$cbm+=$r['quantity']*$r['carton_volume_meter']/$r['pieces_per_carton'];
}
else{
@$cbm-=$r['quantity']*$r['carton_volume_meter']/$r['pieces_per_carton'];
}
}
return $cbm;
}
function getOrdered($arr,$month){
if(count($arr)>0){
foreach($arr as $a){
if(!eregi($month,$a['deliverydate']))continue;
$r=mysql_fetch_array(mysql_query("select carton_volume_meter,pieces_per_carton from ecmproducts where code like '".str_replace("_S","",$a['productcode'])."'"));
@$cbm+=$a['quantity']*$r['carton_volume_meter']/$r['pieces_per_carton'];
//echo $a['deliverydate']." ".($a['quantity']*$r['carton_volume_meter']/$r['pieces_per_carton'])." ".$a['productcode']." ".$r['pieces_per_carton']." ".$r['carton_volume_meter']."<br>";
}
}
return $cbm;
}
function getMonths($month,$l){
for($i=1;$i<=$l;$i++){
$m[]=date("Y-m",mktime()+$i*3600*24*30);
}
return $m;
}
$tds1='<td class="listViewThS1">';
$trs='<tr>';
$tre='</tr>';
$tds='<td class="oddListRowS1">';
$tde='</td>';
$tbs='<table cellpadding="0" cellspacing="0" border="0" class="ListView" style="width:100%;">';
$tbe='</table>';
$mmm=(int)date("m")-1;
$t.=$tbs;
$t.=$trs;
$t.=$tds1;
$t.="Month";
$t.=$tde;
$t.=$tds1;
$t.="First day";
$t.=$tde;
$t.=$tds1;
$t.="Sales reg.";
$t.=$tde;
$t.=$tds1;
$t.="Sales promo";
$t.=$tde;
$t.=$tds1;
$t.="Ordered";
$t.=$tde;
$t.=$tds1;
$t.="Last day";
$t.=$tde;
$t.=$tre;
$months=getMonths(date("m"),6);
$cbm_first_day=getCbm("c7afd71a-4c3a-bde4-138d-4acaee1644e4",date("Y-m")."-01");
$s=getSales(date("Y-m")."-01",date("Y-m")."-31");
$cbm_ordered=getOrdered($data,date("Y-m"));
$cbm_ordered1=getOrdered($data1,date("Y-m"));
//$cbm=getS(date("Y"),date("m"),$mmm);
$as=getSales(date("Y")."-01-01",date("Y-m")."-01");
$qs=getQuotes(date("Y-m")."-01",date("Y-m")."-31");
//print_r($as);
$cbm=$as['cbm']/$mmm;
$cbm_q=$qs['cbm'];
if(date("m")=="06")$cbm_fd=753.4;
else $cbm_fd=($cbm_first_day+$cbm_ordered1);
$cbm_last_day=$cbm_fd-$cbm-$cbm_q+$cbm_ordered;
$t.='<tr>';
$t.='<td class="oddListRowS1" width="5%">'.date("Y-m").'</td>';
$t.='<td class="oddListRowS1" width="5%">'.number_format($cbm_fd,2,",",".").'</td>';
$t.='<td class="oddListRowS1" width="5%">'.number_format(($cbm),2,",",".").'</td>';
$t.='<td class="oddListRowS1" width="5%">'.number_format(($cbm_q),2,",",".").'</td>';
$t.='<td class="oddListRowS1" width="5%">'.number_format(($cbm_ordered),2,",",".").'</td>';
$t.='<td class="oddListRowS1" width="5%">'.number_format(($cbm_last_day),2,",",".").'</td>';
$t.='</tr>';
$mmm=(int)date("m")-1;
foreach($months as $m){
$cbm_first_day=$cbm_last_day;
$cbm_ordered=getOrdered($data,$m);
$e=explode("-",$m);
$qs=getQuotes($m."-01",$m."-31");
$cbm_q=$qs['cbm'];
//$cbm=getS($e[0],(int)$e[1],$mmm);
$cbm_last_day=$cbm_first_day+$cbm_ordered-$cbm-$cbm_q;;
$t.='<tr>';
$t.='<td class="oddListRowS1" width="5%">'.$m.'</td>';
$t.='<td class="oddListRowS1" width="5%">'.number_format(($cbm_first_day),2,",",".").'</td>';
$t.='<td class="oddListRowS1" width="5%">'.number_format(($cbm),2,",",".").'</td>';
$t.='<td class="oddListRowS1" width="5%">'.number_format(($cbm_q),2,",",".").'</td>';
$t.='<td class="oddListRowS1" width="5%">'.number_format(($cbm_ordered),2,",",".").'</td>';
$t.='<td class="oddListRowS1" width="5%">'.number_format(($cbm_last_day),2,",",".").'</td>';
$t.='</tr>';
}
$t.='</tbody>';
$t.='</table>';
echo $t;
?>

View File

@@ -0,0 +1,94 @@
<table cellspacing="0" cellpadding="0" border="0"><tr><td width="19"><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16"></td>
<td width="544"><h2>Containers on sea</h2></td></tr></table><br />
<table class="h3Row" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td nowrap="nowrap">
<h3>Containers List</h3>
</td>
<td width="100%">
<img src="include/images/blank.gif" alt="" width="1" height="1">
</td>
</tr>
</tbody>
</table>
<?
include_once("modules/EcmProductReports/vtigerConnector.php");
include_once('modules/EcmCharts/chartHelper.php');
$vc=new vtigerConnector();
$vc->start=1;
$wc[]="1=1";
$wc[]="purchaseordercf.cf_528='0'";
$wc[]="purchaseorder.tracking_no!=''";
$vc1->where=@implode(" and ",$wc);
$vc->getData();
$cnt=$vc->getCount();
$data=$vc->data;
//echo '<pre>';
//print_r($data);
//echo '</pre>';
if(count($data)>0){
foreach($data as $d){
$dd[$d['tracking_no']]=$d;
}
}
if(!$_GET['order_by'])$_GET['order_by']="deliverydate";
if(!$_GET['sorder'])$_GET['sorder']="asc";
$dd=multisort($dd,array(array('key'=>$_GET['order_by'],'sort'=>$_GET['sorder'])));
$tds1='<td class="listViewThS1">';
$trs='<tr>';
$tre='</tr>';
$tds='<td class="oddListRowS1">';
$tde='</td>';
$tbs='<table cellpadding="0" cellspacing="0" border="0" class="ListView" id="containers_list" style="width:100%;">';
$tbe='</table>';
$t.='<script language="javascript">
function checkAll(){
var c = document.getElementsByName("check[]");
for(var i=0;i<c.length;i++){
c[i].checked=document.getElementById("check_all").checked;
}
}
</script>';
$t.='<form id="form_list" action="index.php?module=EcmProductReports&action=CreateXLScontainers&to_pdf=1" method="post">';
$t.=$tbs;
$t.=$trs;
$t.=$tds1;
$t.='<input type="checkbox" id="check_all" onclick="checkAll();" checked>';
$t.=$tde;
$t.=$vc->sortableColumn("ETA","deliverydate",$_GET['sorder'],10,"index");
$t.=$vc->sortableColumn("Tracking No","tracking_no",$_GET['sorder'],85,"index");
$t.=$tds1;
$t.="Spec.";
$t.=$tde;
$t.=$tre;
if(count($dd)>0){
foreach($dd as $a){
if(trim($a['tracking_no'])=="")continue;
$t.=$trs;
$t.=$tds;
$t.='<input type="checkbox" name="check[]" value="'.$a['tracking_no'].'" checked>';
$t.=$tde;
$t.=$tds;
$t.=$GLOBALS['timedate']->to_display_date($a['deliverydate']);
$t.=$tde;
$t.=$tds;
$t.=$a['tracking_no'];
$t.=$tde;
$t.=$tds;
$t.='<a href="index.php?module=EcmProductReports&action=CreatePDFcontainers&tracking_no='.$a['tracking_no'].'&to_pdf=1"><img src="modules/EcmInvoiceOuts/images/pdf.gif" border="0" /></a>';
$t.=$tde;
$t.=$tre;
}
}
$t.=$tbe;
$t.='<input class="button" type="submit" name="xls" value="Create XLS">';
$t.='</form>';
echo $t;
?>

View File

@@ -0,0 +1,232 @@
<script type="text/javascript">
function createOrderLink(column) {
<?php
if ($_GET['order_by'])
echo 'var order_by =\''.$_GET['order_by'].'\';';
else
echo 'var order_by =\'p.name\';';
if ($_GET['order_type'])
echo 'var order_type =\''.$_GET['order_type'].'\';';
else
echo 'var order_type =\'ASC\';';
//$_GET copy
$get='';
echo 'var get=\'\';';
foreach ($_GET as $k => $v) {
echo 'alert(\''.$k.'\');';
if (($k!='order_by') || ($k!='order_type'))
if (is_array($v)) {
$tmp = '';
foreach ($v as $k2=>$v2)
$tmp.='&'.$k.'[]='.$v2;
echo 'var get=get+\''.$tmp.'\';';
} else
echo 'var get=get+\'&'.$k.'='.$v.'\';';
}
?>
var link;
if (column == order_by) {
if (order_type == 'ASC')
link='index.php?order_by='+column+'&order_type=DESC'+get;
if (order_type == 'DESC') {
link='index.php?order_by='+column+'&order_type=ASC'+get;
}
} else
link='index.php?order_by='+column+'&order_type=ASC'+get;
//alert(link);
location.href = link;
}
function showhide(id) {
var el = document.getElementById(id);
if (el.style.display == "none")
el.style.display="block";
else
el.style.display="none";
}
function setTableSize() {
var header_height=document.getElementById('header').offsetHeight;
var left_width=document.getElementById('left').offsetWidth;
var screen_height = screen.height;
var screen_width = screen.width;
var new_height = (screen_height-header_height-300)+'px';
document.getElementById('myListView').style.height=new_height;
var new_width = (screen_width-left_width-50)+'px';
document.getElementById('tableDiv').style.width=new_width;
//td
var i=1;
for (i=1; i<=11; i++) {
var title ='title'+i;
var data ='data'+i;
document.getElementById(title).style.width=document.getElementById(data).offsetWidth
//alert(document.getElementById(title).offsetWidth+' - '+document.getElementById(data).offsetWidth);
}
}
</script>
<table cellspacing="0" cellpadding="0" border="0"><tr><td width="19"><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16"></td>
<td width="402"><h2>Purchase Orders Report</h2></td></tr></table><br />
<div id="search_box">
<ul class="tablist">
<li>
<a class="current" href="#">Basic Search</a>
</li>
</ul>
<form action="index.php" method="get">
<input type="hidden" name="module" value="EcmProductReports" />
<input type="hidden" name="action" value="index4" />
<table style="border-top: 0px none; margin-bottom: 4px;" class="tabForm" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="dataLabel" width="5%" nowrap="nowrap">
Product name </td>
<td class="dataField" width="18%" nowrap="nowrap">
<input name="product_name" id="product_name" size="30" maxlength="255" value="<? echo $_GET['product_name'];?>" title="" tabindex="" type="text">
</td>
<td class="dataLabel" width="5%" nowrap="nowrap">
Product code </td>
<td class="dataField" width="18%" nowrap="nowrap">
<input name="product_code" id="product_code" size="30" maxlength="255" value="<? echo $_GET['product_code'];?>" title="" tabindex="" type="text">
</td>
<td class="dataLabel" width="5%" nowrap="nowrap">
Order no. </td>
<td class="dataField" width="18%" nowrap="nowrap">
<input name="purchase_order_number" id="purchase_order_number" size="30" maxlength="255" value="<? echo $_GET['purchase_order_number'];?>" title="" tabindex="" type="text">
</td>
<td class="dataLabel" width="5%" nowrap="nowrap">
Order status</td>
<td class="dataField" width="26%" nowrap="nowrap">
<select name="purchase_order_status[]" multiple="true" size="6" style="width: 150px;"><option value="">select</option>
<?
foreach ($GLOBALS['app_list_strings']['ecmpurchaseorders_status_dom'] as $k=>$v) {
echo '<option value="'.$k.'"';
if (count($_GET['purchase_order_status']) > 0)
foreach ($_GET['purchase_order_status'] as $status) {
if($k==$status)echo ' selected';
}
echo '>'.$v.'</option>';
}
?>
</td>
</tr><tr>
<td class="dataLabel" width="5%" nowrap="nowrap">
User </td>
<td class="dataField" width="18%" nowrap="nowrap">
<select name="user"><option value="">select</option>
<?
$w=mysql_query("select id, first_name, last_name from users where deleted=0 and status='Active' order by last_name asc");
while($r=mysql_fetch_array($w)){
echo '<option value="'.$r['id'].'"';
if($r['id']==$_REQUEST['user'])echo ' selected';
echo '>'.$r['first_name'].' '.$r['last_name'].'</option>';
}
?>
</td>
<td class="dataLabel" width="5%" nowrap="nowrap">
Category </td>
<td class="dataField" width="18%" nowrap="nowrap">
<select name="category"><option value="">select</option>
<?
$w=mysql_query("select id,name from ecmproductcategories where deleted='0' order by name asc");
while($r=mysql_fetch_array($w)){
echo '<option value="'.$r['id'].'"';
if($r['id']==$_REQUEST['category'])echo ' selected';
echo '>'.$r['name'].'</option>';
}
?>
</td>
<td class="dataLabel" width="5%" nowrap="nowrap">
Tracking No. </td>
<td class="dataField" width="18%" nowrap="nowrap">
<input name="tracking_no" id="tracking_no" size="30" maxlength="255" value="<? echo $_GET['product_name'];?>" title="" tabindex="" type="text">
</td>
</tr>
</tbody>
</table>
</div>
<input class="button" name="submit" value="Search" type="submit">
<input class="button" name="hide" value="Hide/Show Search" type="button" onClick="showhide('search_box');">
<?php
//create query
//$wh_products = array();
//$wh_orders = array();
if ($_GET['submit']) {
if ($_GET['product_name']) $wh_products[] = "p.name LIKE '%".$_GET['product_name']."%'";
if ($_GET['product_code']) $wh_products[] = "p.code LIKE '%".$_GET['product_code']."%'";
if ($_GET['purchase_order_number']) $wh_orders[] = "o.name LIKE '%".$_GET['purchase_order_number']."%'";
if (count($_GET['purchase_order_status']) > 0) {
$wh_status = array();
foreach ($_GET['purchase_order_status'] as $status) {
$wh_status[] = "o.status ='".$status."'";
}
$wh_orders[] = "(".implode(" OR ", $wh_status).")";
}
if ($_GET['user']) $wh_orders[] = "o.assigned_user_id = '".$_GET['user']."'";
if ($_GET['category']) $wh_products[] = "p.product_category_id = '".$_GET['category']."'";
if ($_GET['tracking_no']) $wh_products[] = "o.tracking_no LIKE '%".$_GET['tracking_no']."%'";
}
if (($_GET['order_by']) && $_GET['order_type'])
$order_by=" ORDER BY ".$_GET['order_by'].' '.$_GET['order_type'];
else $order_by=" ORDER BY p.name ASC";
$query = "SELECT p.name, p.product_category_name, o.date_entered, o.document_no, o.status, po.product_quantity, o.delivery_date, o.tracking_no, u.first_name, u.last_name, po.ecmpurchaseorder_id, po.ecmproduct_id, p.code, o.parent_id, o.parent_name FROM ecmproducts_ecmpurchaseorders AS po ";
$query.="INNER JOIN ecmproducts AS p ON p.id=po.ecmproduct_id ";
if (isset($wh_products)) $query.=" AND ".implode(" AND ", $wh_products);
$query.="INNER JOIN ecmpurchaseorders AS o ON o.id=po.ecmpurchaseorder_id AND o.deleted='0' ";
if (isset($wh_orders)) $query.=" AND ".implode(" AND ", $wh_orders);
$query.="INNER JOIN users As u ON o.assigned_user_id=u.id";
$query.=$order_by;
$post_copy = array();
$post_copy
?>
<div id="tableDiv" style="overflow-x: scroll; width: 100px">
<table width="100%"><tr><td>
<div style="overflow-y: scroll;">
<table width="3000" class="h3Row" border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="title1" class="listViewThS1" width="8%"><a class="listViewThLinkS1" href="javascript:createOrderLink('p.code')">Code<img src="themes/Sugar/images/arrow.gif" border="0"/></td>
<td id="title2" class="listViewThS1" width="15%"><a class="listViewThLinkS1" href="javascript:createOrderLink('p.name')">Name<img src="themes/Sugar/images/arrow.gif" border="0"/></td>
<td id="title3" class="listViewThS1" width="15%"><a class="listViewThLinkS1" href="javascript:createOrderLink('p.product_category_name')">Category<img src="themes/Sugar/images/arrow.gif" border="0"/></td>
<td id="title4" class="listViewThS1" width="15%"><a class="listViewThLinkS1" href="javascript:createOrderLink('o.parent_name')">Account name<img src="themes/Sugar/images/arrow.gif" border="0"/></td>
<td id="title5" class="listViewThS1" width="8%"><a class="listViewThLinkS1" href="javascript:createOrderLink('o.date_entered')">Order date<img src="themes/Sugar/images/arrow.gif" border="0"/></td>
<td id="title6" class="listViewThS1" width="8%"><a class="listViewThLinkS1" href="javascript:createOrderLink('o.document_no')">Order No.<img src="themes/Sugar/images/arrow.gif" border="0"/></td>
<td id="title7" class="listViewThS1" width="8%"><a class="listViewThLinkS1" href="javascript:createOrderLink('o.status')">Order status<img src="themes/Sugar/images/arrow.gif" border="0"/></td>
<td id="title8" class="listViewThS1" width="10%"><a class="listViewThLinkS1" href="javascript:createOrderLink('p.user')">User<img src="themes/Sugar/images/arrow.gif" border="0"/></td>
<td id="title9" class="listViewThS1" width="8%"><a class="listViewThLinkS1" href="javascript:createOrderLink('po.product_quantity')">Quantity<img src="themes/Sugar/images/arrow.gif" border="0"/></td>
<td id="title10" class="listViewThS1" width="8%"><a class="listViewThLinkS1" href="javascript:createOrderLink('o.delivery_date')">Delivery date<img src="themes/Sugar/images/arrow.gif" border="0"/></td>
<td id="title11" class="listViewThS1" width="10%"><a class="listViewThLinkS1" href="javascript:createOrderLink('o.tracking_no')">Tracking No<img src="themes/Sugar/images/arrow.gif" border="0"/></td>
</tr>
</table>
</div>
<div id="myListView" style="overflow-y: scroll;">
<table width="3000" border="0" cellpadding="0" cellspacing="0">
<tr>
<?php
$result = $GLOBALS['db']->query($query);
while ($r=$GLOBALS['db']->fetchByAssoc($result)) {
// foreach ($r as $k => $v) echo $k.' - ';
echo "<td id=\"data1\" class=\"oddListRowS1\" width=\"8%\"><a href=\"index.php?module=EcmProducts&action=DetailView&record=".$r['ecmproduct_id']."\">".$r['code']."</a></td>";
echo "<td id=\"data2\" class=\"oddListRowS1\" width=\"15%\"><a href=\"index.php?module=EcmProducts&action=DetailView&record=".$r['ecmproduct_id']."\">".$r['name']."</a></td>";
echo "<td id=\"data3\" class=\"oddListRowS1\" width=\"15%\">".$r['product_category_name']."</td>";
echo "<td id=\"data4\" class=\"oddListRowS1\" width=\"8%\"><a href=\"index.php?module=Accounts&action=DetailView&record=".$r['parent_id']."\">".$r['parent_name']."</a></td>";
echo "<td id=\"data5\" class=\"oddListRowS1\" width=\"8%\">".substr($r['date_entered'],0,10)."</td>";
echo "<td id=\"data6\" class=\"oddListRowS1\" width=\"8%\"><a href=\"index.php?module=EcmPurchaseOrders&action=DetailView&record=".$r['ecmpurchaseorder_id']."\">".$r['document_no']."</a></td>";
echo "<td id=\"data7\" class=\"oddListRowS1\" width=\"8%\">".$GLOBALS['app_list_strings']['ecmpurchaseorders_status_dom'][$r['status']]."</td>";
echo "<td id=\"data8\" class=\"oddListRowS1\" width=\"10%\">".$r['first_name'].' '.$r['last_name']."</td>";
echo "<td id=\"data9\" class=\"oddListRowS1\" width=\"8%\">".$r['product_quantity']."</td>";
echo "<td id=\"data10\" class=\"oddListRowS1\" width=\"8%\">".$r['delivery_date']."</td>";
echo "<td id=\"data11\" class=\"oddListRowS1\" width=\"10%\">".$r['tracking_no']."</td></tr>";
}
?>
</tr>
</div>
</td></tr></table>
</div>
<script type="text/javascript">setTableSize();</script>

View File

@@ -0,0 +1,162 @@
<?
include_once("modules/EcmProductReports/vtigerConnector.php");
$vc=new vtigerConnector();
$vc->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=99999;
$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;$i<count($data);$i++){
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;
?>
<table cellspacing="0" cellpadding="0" border="0"><tr><td width="19"><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16"></td>
<td width="402"><h2>Orders Reports: Orders on sea </h2></td></tr></table><br />
<table class="h3Row" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td nowrap="nowrap">
<h3>Orders List</h3>
</td>
<td width="100%">
<img src="include/images/blank.gif" alt="" width="1" height="1">
</td>
</tr>
</tbody>
</table>
<?
if($_GET['start']+$vc->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 '<form action="index.php" method="post">';
print '<input type="hidden" value="EcmProductReports" name="module">';
print '<input type="hidden" value="CreateXLS" name="action">';
print '<input type="hidden" name="where" value="'.$vc->where.'">';
print '<input type="hidden" name="order_by" value="'.$vc->order_by.'">';
print '<input type="hidden" name="sorder" value="'.$vc->sorder.'">';
print '<input type="hidden" name="limit" value="'.$vc->limit.'">';
print '<input type="hidden" name="start" value="'.($vc->start-1).'">';
print '<input type="hidden" name="to_pdf" value="1">';
print '<div id="products_list">';
print '<table cellpadding="0" cellspacing="0" width="1300" border="0" class="ListView">';
?>
<tr>
<td colspan="9">
<table width="100%">
<tr>
<td width="50%">
<?
//print '<input type="submit" value="Create XLS" class="button" onclick="this.form.action.value=\'CreateXLS\';">&nbsp;';
//print '<input type="submit" value="Create PDF" class="button" onclick="this.form.action.value=\'CreatePDF\';">';
?>
</td>
<td id="listViewPaginationButtons" class="listViewPaginationTdS1" width="100%" align="right" nowrap="nowrap">
<? echo $vc->generateButtons($btns); ?>
</td>
</tr>
</table>
</td></tr>
<?
print '<tr>';
print $vc->sortableColumn("Delivery date","purchaseorder.cf_532",$_GET['sorder'],20);
print $vc->sortableColumn("Id","purchaseorder.purchaseorderid",$_GET['sorder'],10);
print $vc->sortableColumn("Subject","purchaseorder.subject",$_GET['sorder'],10);
print $vc->sortableColumn("Tracking No","purchaseorder.tracking_no",$_GET['sorder'],10);
print $vc->sortableColumn("CBM","purchaseorder.cbm",$_GET['sorder'],10);
print '</tr>';
foreach($data as $dd){
$do[$dd['purchaseorderid']]=$dd;
}
foreach($do as $data){
$duedate=$data['duedate'];
$deliverydate=$data['deliverydate'];
$exp=explode("-",$duedate);
$dtime=date("Y-m-d",@mktime(0,0,0,$exp[1],$exp[2],$exp[0]));
print '<tr>';
print '<td class="oddListRowS1" width="1%">'.$deliverydate.'</td>';
print '<td class="oddListRowS1" width="20%"><a href="http://81.89.194.6/crm/index.php?module=Orders&action=DetailView&record='.$data['purchaseorderid'].'">'.$data['purchaseorderid'].'</a></td>';
print '<td class="oddListRowS1" width="1%">'.$data['subject'].'</td>';
print '<td class="oddListRowS1" width="1%">'.$data['tracking_no'].'</td>';
print '<td class="oddListRowS1" width="1%">'.$data['cbm'].'</td>';
print '</tr>';
}
print '</table>';
print '</div>';
print '</form>';
?>

View File

@@ -0,0 +1,79 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
'LBL_VALUE' => 'Value',
'LBL_MODULE_NAME' => 'Product Report',
'LBL_MODULE_TITLE' => 'Product Report: Home',
'LBL_MODULE_ID' => 'Product Report',
'LBL_SEARCH_FORM_TITLE' => 'Product Report Search',
'LBL_LIST_FORM_TITLE' => 'Product Report List',
'LBL_NEW_FORM_TITLE' => 'New Product Report',
'LBL_SUBJECT' => 'Subject:',
'LBL_ECMPRODUCTREPORT' => 'Product Report:',
'LBL_ECMPRODUCTREPORT_SUBJECT' => 'Product Report Subject:',
'LBL_LIST_SUBJECT' => 'Name',
'LBL_LIST_LAST_MODIFIED' => 'Last Modified',
'LNK_NEW_ECMPRODUCTREPORT' => 'Create Product Report',
'LNK_ECMPRODUCTREPORT_LIST' => 'Product Report',
'ERR_DELETE_RECORD' => 'You must specify a record number in order to delete the vat.',
'LBL_LIST_MY_ECMPRODUCTREPORTS' => 'My Assigned Product Report',
'LBL_CREATED_BY' => 'Created by:',
'LBL_DATE_CREATED' => 'Create Date:',
'LBL_MODIFIED_BY' => 'Last Modified by:',
'LBL_DATE_LAST_MODIFIED' => 'Modify Date:',
'LBL_DEFAULT_SUBPANEL_TITLE' => 'Product Report',
'LBL_SYSTEM_ID' => 'System ID',
'LBL_LIST_ASSIGNED_TO_NAME' => 'Assigned User',
'LBL_LIST_VALUE' => 'Value',
'LBL_ASSIGNED_TO_NAME' => 'Assigned to',
);
?>

View File

@@ -0,0 +1,79 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
'LBL_VALUE' => 'Value',
'LBL_MODULE_NAME' => 'Vat',
'LBL_MODULE_TITLE' => 'Vat: Home',
'LBL_MODULE_ID' => 'Vat',
'LBL_SEARCH_FORM_TITLE' => 'Vat Search',
'LBL_LIST_FORM_TITLE' => 'Vat List',
'LBL_NEW_FORM_TITLE' => 'New Vat',
'LBL_SUBJECT' => 'Subject:',
'LBL_ECMPRODUCTREPORT' => 'Vat:',
'LBL_ECMPRODUCTREPORT_SUBJECT' => 'Vat Subject:',
'LBL_LIST_SUBJECT' => 'Name',
'LBL_LIST_LAST_MODIFIED' => 'Last Modified',
'LNK_NEW_ECMPRODUCTREPORT' => 'Create Vat',
'LNK_ECMPRODUCTREPORT_LIST' => 'Vat',
'ERR_DELETE_RECORD' => 'You must specify a record number in order to delete the vat.',
'LBL_LIST_MY_ECMPRODUCTREPORTS' => 'My Assigned Vat',
'LBL_CREATED_BY' => 'Created by:',
'LBL_DATE_CREATED' => 'Create Date:',
'LBL_MODIFIED_BY' => 'Last Modified by:',
'LBL_DATE_LAST_MODIFIED' => 'Modify Date:',
'LBL_DEFAULT_SUBPANEL_TITLE' => 'Vat',
'LBL_SYSTEM_ID' => 'System ID',
'LBL_LIST_ASSIGNED_TO_NAME' => 'Assigned User',
'LBL_LIST_VALUE' => 'Value',
'LBL_ASSIGNED_TO_NAME' => 'Assigned to',
);
?>

View File

@@ -0,0 +1,79 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
'LBL_VALUE' => 'Value',
'LBL_MODULE_NAME' => 'Vat',
'LBL_MODULE_TITLE' => 'Vat: Home',
'LBL_MODULE_ID' => 'Vat',
'LBL_SEARCH_FORM_TITLE' => 'Vat Search',
'LBL_LIST_FORM_TITLE' => 'Vat List',
'LBL_NEW_FORM_TITLE' => 'New Vat',
'LBL_SUBJECT' => 'Subject:',
'LBL_ECMPRODUCTREPORT' => 'Vat:',
'LBL_ECMPRODUCTREPORT_SUBJECT' => 'Vat Subject:',
'LBL_LIST_SUBJECT' => 'Name',
'LBL_LIST_LAST_MODIFIED' => 'Last Modified',
'LNK_NEW_ECMPRODUCTREPORT' => 'Create Vat',
'LNK_ECMPRODUCTREPORT_LIST' => 'Vat',
'ERR_DELETE_RECORD' => 'You must specify a record number in order to delete the vat.',
'LBL_LIST_MY_ECMPRODUCTREPORTS' => 'My Assigned Vat',
'LBL_CREATED_BY' => 'Created by:',
'LBL_DATE_CREATED' => 'Create Date:',
'LBL_MODIFIED_BY' => 'Last Modified by:',
'LBL_DATE_LAST_MODIFIED' => 'Modify Date:',
'LBL_DEFAULT_SUBPANEL_TITLE' => 'Vat',
'LBL_SYSTEM_ID' => 'System ID',
'LBL_LIST_ASSIGNED_TO_NAME' => 'Assigned User',
'LBL_LIST_VALUE' => 'Value',
'LBL_ASSIGNED_TO_NAME' => 'Assigned to',
);
?>

View File

@@ -0,0 +1,44 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$searchFields['EcmProductReports'] =
array (
'name' => array( 'query_type'=>'default'),
'value' => array( 'query_type'=>'default'),
'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true),
'assigned_user_id'=> array('query_type'=>'default'),
);
?>

View File

@@ -0,0 +1,64 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*********************************************************************************/
require_once('include/utils.php');
function additionalDetailsEcmProductReport($fields) {
static $mod_strings;
global $app_strings;
if(empty($mod_strings)) {
global $current_language;
$mod_strings = return_module_language($current_language, 'EcmProductReports');
}
$overlib_string = '';
if(!empty($fields['DATE_ENTERED']))
$overlib_string .= '<b>'. $app_strings['LBL_DATE_ENTERED'] . '</b> ' . $fields['DATE_ENTERED'] . '<br>';
if(!empty($fields['NAME']))
$overlib_string .= '<b>'. $mod_strings['LBL_NAME'] . '</b> ' . $fields['NAME'] . '<br>';
return array('fieldToAddTo' => 'NAME',
'string' => $overlib_string,
'editLink' => "index.php?action=EditView&module=EcmProductReports&return_module=EcmProductReports&record={$fields['ID']}",
'viewLink' => "index.php?action=DetailView&module=EcmProductReports&return_module=EcmProductReports&record={$fields['ID']}");
}
?>

View File

@@ -0,0 +1,67 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$viewdefs['EcmProductReports']['DetailView'] = array(
'templateMeta'=>array(
'form'=>array(
'buttons'=>array(
'EDIT',
'DUPLICATE',
'DELETE',
)
),
'maxColumns'=>'2',
'widths'=>array(
array(
'label'=>'10',
'field' =>'30'
),
array(
'label'=>'10',
'field'=>'30'
)
),
),
'panels'=>array(
array(
'name',
'assigned_user_name',
),
array(
'value',
),
)
);
?>

View File

@@ -0,0 +1,52 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$viewdefs['EcmProductReports']['EditView'] = array(
'templateMeta'=>array(
'form' => array('buttons'=>array('SAVE', 'CANCEL')),
'maxColumns'=>'2',
'widths'=>array(
array('label'=>'10','field'=>'30'),
array('label'=>'10','field'=>'30'),
),
),
'panels'=>array(
'default'=>array(
array('name','assigned_user_name'),
array('value'),
),
),
);
?>

View File

@@ -0,0 +1,52 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
$listViewDefs['EcmProductReports'] = array(
'NAME' => array(
'width' => '32',
'label' => 'LBL_LIST_SUBJECT',
'default' => true,
'link' => true),
'ASSIGNED_USER_NAME' => array(
'width' => '9',
'label' => 'LBL_LIST_ASSIGNED_USER',
'default' => true)
);
?>

View File

@@ -0,0 +1,51 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on Jun 1, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$metafiles['EcmProductReports'] = array(
'detailviewdefs' => 'modules/EcmProductReports/metadata/detailviewdefs.php',
'editviewdefs' => 'modules/EcmProductReports/metadata/editviewdefs.php',
'listviewdefs' => 'modules/EcmProductReports/metadata/listviewdefs.php',
'searchdefs' => 'modules/EcmProductReports/metadata/searchdefs.php',
'popupdefs' => 'modules/EcmProductReports/metadata/popupdefs.php',
'searchfields' => 'modules/EcmProductReports/metadata/SearchFields.php',
);
?>

View File

@@ -0,0 +1,67 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$popupMeta = array('moduleMain' => 'EcmProductReport',
'varName' => 'ECMPRODUCTREPORT',
'orderBy' => 'ecmproductreports.name',
'whereClauses' =>
array('name' => 'ecmproductreports.name'),
'listviewdefs' => array(
'NAME' => array(
'width' => '32',
'label' => 'LBL_LIST_SUBJECT',
'default' => true,
'link' => true),
'VALUE' => array(
'width' => '10',
'label' => 'LBL_LIST_VALUE',
'default' => true),
'ASSIGNED_USER_NAME' => array(
'width' => '9',
'label' => 'LBL_LIST_ASSIGNED_USER',
'default' => true)
),
'searchdefs' => array(
'name',
'value',
array('name' => 'assigned_user_id', 'type' => 'enum', 'label' => 'LBL_ASSIGNED_TO', 'function' => array('name' => 'get_user_array', 'params' => array(false))),
)
);
?>

View File

@@ -0,0 +1,59 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on May 29, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$searchdefs['EcmProductReports'] = array(
'templateMeta' => array(
'maxColumns' => '3',
'widths' => array('label' => '10', 'field' => '30'),
),
'layout' => array(
'basic_search' => array(
'name',
array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
),
'advanced_search' => array(
'name',
'value',
array('name' => 'assigned_user_id', 'type' => 'enum', 'label' => 'LBL_ASSIGNED_TO', 'function' => array('name' => 'get_user_array', 'params' => array(false))),
),
),
);
?>

View File

@@ -0,0 +1,71 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*********************************************************************************/
$viewdefs['EcmProductReports']['SideQuickCreate'] = array(
'templateMeta' => array('form'=>array('buttons'=>array('SAVE'),
'button_location'=>'bottom',
'headerTpl'=>'include/EditView/header.tpl',
'footerTpl'=>'include/EditView/footer.tpl',
),
'maxColumns' => '1',
'panelClass'=>'none',
'labelsOnTop'=>true,
'widths' => array(
array('label' => '10', 'field' => '30'),
),
),
'panels' =>array (
'DEFAULT' =>
array (
array (
array('name'=>'name', 'displayParams'=>array('size'=>20, 'required'=>true)),
),
array(
array('name'=>'value', 'displayParams'=>array('size'=>20)),
),
array (
array('name'=>'assigned_user_name', 'displayParams'=>array('required'=>true, 'size'=>11, 'selectOnly'=>true)),
),
),
)
);
?>

View File

@@ -0,0 +1,65 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
$GLOBALS['studioDefs']['EcmProductReports'] = array(
'LBL_DETAILVIEW'=>array(
'template'=>'xtpl',
'template_file'=>'modules/EcmProductReports/DetailView.html',
'php_file'=>'modules/EcmProductReports/DetailView.php',
'type'=>'DetailView',
),
'LBL_EDITVIEW'=>array(
'template'=>'xtpl',
'template_file'=>'modules/EcmProductReports/EditView.html',
'php_file'=>'modules/EcmProductReports/EditView.php',
'type'=>'EditView',
),
'LBL_LISTVIEW'=>array(
'template'=>'listview',
'meta_file'=>'modules/EcmProductReports/listviewdefs.php',
'type'=>'ListView',
),
'LBL_SEARCHFORM'=>array(
'template'=>'xtpl',
'template_file'=>'modules/EcmProductReports/SearchForm.html',
'php_file'=>'modules/EcmProductReports/ListView.php',
'type'=>'SearchForm',
),
);

View File

@@ -0,0 +1,42 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* Layout definition for EcmProductReports
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
$layout_defs['EcmProductReports']['subpanel_setup'] = array(
);
?>

View File

@@ -0,0 +1,91 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* Subpanel Layout definition for EcmProductReports
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmProductReports'),
),
'where' => '',
'list_fields' => array(
'ecmproductreport_number'=>array(
'vname' => 'LBL_LIST_NUMBER',
'width' => '5%',
),
'name'=>array(
'vname' => 'LBL_LIST_SUBJECT',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '50%',
),
'status'=>array(
'vname' => 'LBL_LIST_STATUS',
'width' => '15%',
),
'type'=>array(
'vname' => 'LBL_LIST_TYPE',
'width' => '15%',
),
'priority'=>array(
'vname' => 'LBL_LIST_PRIORITY',
'width' => '11%',
),
'assigned_user_name' => array (
'name' => 'assigned_user_name',
'vname' => 'LBL_LIST_ASSIGNED_TO_NAME',
),
'edit_button'=>array(
'widget_class' => 'SubPanelEditButton',
'module' => 'EcmProductReports',
'width' => '4%',
),
'remove_button'=>array(
'widget_class' => 'SubPanelRemoveButton',
'module' => 'EcmProductReports',
'width' => '5%',
),
),
);
?>

View File

@@ -0,0 +1,95 @@
{*
/**
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
*}
<form name="ecmproductreportsQuickCreate" id="ecmproductreportsQuickCreate" method="POST" action="index.php">
<input type="hidden" name="module" value="EcmProductReports">
<input type="hidden" name="email_id" value="{$REQUEST.email_id}">
<input type="hidden" name="account_id" value="{$REQUEST.account_id}">
<input type="hidden" name="case_id" value="{$REQUEST.acase_id}">
<input type="hidden" name="contact_id" value="{$REQUEST.contact_id}">
<input type="hidden" name="return_action" value="{$REQUEST.return_action}">
<input type="hidden" name="return_module" value="{$REQUEST.return_module}">
<input type="hidden" name="return_id" value="{$REQUEST.return_id}">
<input type="hidden" name="action" value='Save'>
<input type="hidden" name="duplicate_parent_id" value="{$REQUEST.duplicate_parent_id}">
<input type="hidden" name="to_pdf" value='1'>
<input id='assigned_user_id' name='assigned_user_id' type="hidden" value="{$ASSIGNED_USER_ID}" />
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left" style="padding-bottom: 2px;">
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" type="submit" name="button" {$saveOnclick|default:"onclick=\"return check_form('EcmProductReportsQuickCreate');\""} value=" {$APP.LBL_SAVE_BUTTON_LABEL} " >
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" type="submit" name="button" {$cancelOnclick|default:"onclick=\"this.form.action.value='$RETURN_ACTION'; this.form.module.value='$RETURN_MODULE'; this.form.record.value='$RETURN_ID'\""} value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" type="submit" name="button" onclick="this.form.to_pdf.value='0';this.form.action.value='EditView'; this.form.module.value='EcmProductReports';" value=" {$APP.LBL_FULL_FORM_BUTTON_LABEL} "></td>
<td align="right" nowrap><span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span> {$APP.NTC_REQUIRED}</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th align="left" class="dataLabel" colspan="4"><h4 class="dataLabel"><slot>{$MOD.LBL_ECMPRODUCTREPORT_INFORMATION}</slot></h4></th>
</tr>
<tr>
<td valign="top" class="dataLabel" width="15%"><slot>{$MOD.LBL_SUBJECT} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
<td width="35%"><slot><textarea name='name' cols="40" tabindex='1' rows="1">{$NAME}</textarea></slot></td>
<td class="dataLabel" width="15%"><slot>{$MOD.LBL_TYPE}</slot></td>
<td width="35%"><slot><select tabindex='2' name='type'>{$TYPE_OPTIONS}</select></slot></td>
</tr>
<tr>
<td valign="top" class="dataLabel" rowspan="2" width="15%"><slot>{$MOD.LBL_DESCRIPTION}</slot></td>
<td rowspan="2" width="35%"><slot><textarea name='description' tabindex='1' cols="40" rows="4">{$DESCRIPTION}</textarea></slot></td>
<td class="dataLabel" width="15%"><slot>{$MOD.LBL_PRIORITY}</slot></td>
<td class="dataField" nowrap width="35%"><slot><select tabindex='2' name='priority'>{$PRIORITY_OPTIONS}</select></slot></td>
</tr>
<tr>
<td class="dataLabel" width="15%"><slot>{$MOD.LBL_STATUS}</slot></td>
<td width="35%"><slot><select tabindex='2' name='status'>{$STATUS_OPTIONS}</select></slot></td>
</tr>
</table>
</form>
<script>
{$additionalScripts}
</script>

View File

@@ -0,0 +1,88 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$dictionary['EcmProductReport']=array(
'table'=>'ecmproductreports',
'audited'=>true,
'comment'=>'EcmProductReports',
'duplicate_merge'=>true ,
'unified_search'=>true,
'fields'=>array(
'name'=>array(
'name'=>'name',
'vname'=>'LBL_NAME',
'type'=>'varchar',
'len'=>'255',
),
),
'indices'=>array(
array('name'=>'idx_ecmproductreport_id_del','type'=>'index','fields'=>array('id','deleted')),
array('name'=>'idx_ecmproductreport_assigned_del','type'=>'index','fields'=>array( 'deleted', 'assigned_user_id')),
),
'relationships'=>array(
'ecmproductreports_assigned_user'=>array(
'lhs_module'=>'Users',
'lhs_table'=>'users',
'lhs_key'=>'id',
'rhs_module'=>'EcmProductReports',
'rhs_table'=>'ecmproductreports',
'rhs_key'=>'assigned_user_id',
'relationship_type'=>'one-to-many'
),
'ecmproductreports_modified_user'=>array(
'lhs_module'=>'Users',
'lhs_table'=>'users',
'lhs_key'=>'id',
'rhs_module'=>'EcmProductReports',
'rhs_table'=>'ecmproductreports',
'rhs_key'=>'modified_user_id',
'relationship_type'=>'one-to-many'
),
'ecmproductreports_created_by'=>array(
'lhs_module'=>'Users',
'lhs_table'=>'users',
'lhs_key'=>'id',
'rhs_module'=>'EcmProductReports',
'rhs_table'=>'ecmproductreports',
'rhs_key'=>'created_by',
'relationship_type'=>'one-to-many'
)
),
'optimistic_locking'=>true,
);
require_once('include/SugarObjects/VardefManager.php');
VardefManager::createVardef('EcmProductReports','EcmProductReport', array('default','assignable'));
?>

View File

@@ -0,0 +1,155 @@
<?
class vtigerConnector{
var $www="http://e5crm.more7.com/e5ltd/crm/sugar.php";
var $data;
var $limit;
var $where;
var $count;
var $pp=50;
var $order_by="purchaseorder.duedate";
var $sorder="asc";
function vtigerConnector(){
}
function curl_get_contents($URL){
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c);
curl_close($c);
if ($contents) return $contents;
else return FALSE;
}
function getData(){
$www=$this->www;
$this->www.="?ok=ok";
if($this->order_by){
$opts['order_by']=$this->order_by;
$opts['sorder']=$this->sorder;
$this->www.="&order_by=".$this->order_by."&sorder=".$this->sorder;
}
$opts['limit']=$this->limit;
$this->www.="&limit=".$this->limit;
if($this->where){
$opts['where']=$this->where;
$this->www.="&where=".$this->where;
}
$source=file_get_contents($www."?content=".base64_encode(serialize($opts)));
//$file=fopen($this->www,"r");
//$source = fread($file,filesize($this->www));
$this->data=unserialize(base64_decode($source));
//echo $source."<br><br>";
//echo "<a href='".$www."?content=".base64_encode(serialize($opts))."'>click</a><br><br>";
//print_r($this->data)."<br><br>";
}
function getCount(){
$this->count=$this->data[0]['count'];
}
function getIdByCode($code){
$r=mysql_fetch_array(mysql_query("select id from ecmproducts where code like '".$code."'"));
return $r['id'];
}
function formatNumber($no){
return number_format($no,$GLOBALS['sugar_config']['default_currency_significant_digits'],$GLOBALS['sugar_config']['default_decimal_seperator'],$GLOBALS['sugar_config']['default_number_grouping_seperator']);
}
function timeDate($time){
if($time!='0000-00-00')return $GLOBALS['timedate']->to_display_date($time);
}
function sortableColumn($name,$field,$ascdesc,$width=10,$index="index"){
$img="";
if($ascdesc=="asc"){
$sorder="desc";
if($this->order_by==$field)$img="_up";
}
else {
$sorder="asc";
if($this->order_by==$field)$img="_down";
}
$str='<td class="listViewThS1" width="'.$width.'%"><a class="listViewThLinkS1" href="'.$this->getAddr($index).'&order_by='.$field.'&sorder='.$sorder.'">'.$name.'&nbsp;<img src="themes/Sugar/images/arrow'.$img.'.gif" border="0" /></a></td>';
return $str;
}
function selectStatus($value){
$arr=array("Created","Approved","Delivered","Canceled");
$str.='<option value="">select</option>';
foreach($arr as $a){
$str.='<option value="'.$a.'"';
if($a==$value)$str.=' selected';
$str.='>'.$a.'</option>';
}
return $str;
}
function unformatNumber($no){
$v=str_replace(".","",$no);
$v=str_replace(",",".",$v);
return $v;
}
function getAddr($index="index"){
$str=$index.".php?ok=ok";
foreach($_GET as $k=>$v){
if($k!="ok")$str.="&".$k."=".$v;
}
return $str;
}
function generateButtons($btns){
if($btns[0]){
$start="";
$dstart="";
}
if($btns[1]){
$previous="";
$dprevious="";
}
if($btns[2]){
$next="";
$dnext="";
}
if($btns[3]){
$end="";
$dend="";
}
if(!$btns[0]){
$start="_off";
$dstart=' disabled="disabled"';
}
if(!$btns[1]){
$previous="_off";
$dprevious=' disabled="disabled"';
}
if(!$btns[2]){
$next="_off";
$dnext=' disabled="disabled"';
}
if(!$btns[3]){
$end="_off";
$dend=' disabled="disabled"';
}
$to=$this->pp+$this->start-1;
if($this->pp+$this->start-1>$this->count)$to=$this->count;
$str='
<a class="listViewThLinkS1" href="'.$this->getAddr().'&start=0">
<button type="button" title="Start" class="button"'.$dstart.'>
<img src="themes/Sugar/images/start'.$start.'.gif" alt="Start" width="13" align="absmiddle" border="0" height="11">
</button>
</a>
<a class="listViewThLinkS1" href="'.$this->getAddr().'&start='.($this->start-$this->pp-1).'">
<button type="button" title="Previous" class="button"'.$dprevious.'>
<img src="themes/Sugar/images/previous'.$previous.'.gif" alt="Previous" width="8" align="absmiddle" border="0" height="11">
</button>
</a>
<span class="pageNumbers">('.$this->start.' - '.$to.' of '.$this->count.')</span>
<a class="listViewThLinkS1" href="'.$this->getAddr().'&start='.($this->start+$this->pp-1).'">
<button type="button" title="Next" class="button"'.$dnext.'>
<img src="themes/Sugar/images/next'.$next.'.gif" alt="Next" width="8" align="absmiddle" border="0" height="11">
</button>
<a class="listViewThLinkS1" href="'.$this->getAddr().'&start='.($this->count-$this->pp-1).'">
<button type="button" title="End" class="button"'.$dend.'>
<img src="themes/Sugar/images/end'.$end.'.gif" alt="End" width="13" align="absmiddle" border="0" height="11">
</button>
</a>';
return $str;
}
}
?>