Files
2025-05-12 15:44:39 +00:00

115 lines
5.6 KiB
PHP
Executable File

<?php
set_time_limit(999999);
$year=$_GET['year'];
if(!$year)$year=(int)date("Y");
if($year==date(Y)){
$mmm=(int)date("m")-1;
}
else $mmm=12;
if(!$_GET['category']){
$category=array();
$_REQUEST['category']=array();
}
else $category=$_GET['category'];
/*if(!$category){
$r=mysql_fetch_array(mysql_query("select id from ecmproductcategories where deleted='0' order by name asc limit 1"));
$category=$r['id'];
}*/
if(!$_REQUEST['show'])$_REQUEST['show']=array("sales");
if(!in_array("sales",$_REQUEST['show']))$_REQUEST['show'][]="sales";
?>
<table cellspacing="0" cellpadding="0" border="0"><tr><td><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16"></td><td><h2>Wykres: Produkty</h2></td></tr></table><br />
<ul class="tablist" style="width:1104px;">
<li>
<a class="current" href="#">Podstawowe wyszukiwanie</a>
</li>
</ul>
<form action="index.php" method="get" name="search_reports">
<input type="hidden" name="module" value="EcmCharts" />
<input type="hidden" name="action" value="index1" />
<table style="border-top: 0px none; margin-bottom: 4px;width:1024px;" class="tabForm" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="dataLabel" width="10%" nowrap="nowrap">Rok</td>
<td class="dataField" width="30%" nowrap="nowrap">
<select name="year" id="year">
<?
$ey=(int)date("Y");
$sy=2009;
for($i=$sy;$i<=$ey;$i++){
echo '<option value="'.$i.'"';
if($i==$year)echo ' selected';
echo '>'.$i.'</option>';
}
?>
</select> </td>
<td class="dataLabel" width="20%" nowrap="nowrap">Nazwa kontrahenta</td>
<td class="dataField" width="30%" nowrap="nowrap">
<input name="account_name" readonly="readonly" tabindex="" id="account_name" size="" value="<?php echo $_REQUEST['account_name'];?>" title="" type="text">
<input name="account_id" id="account_id" value="<?php echo $_REQUEST['account_id'];?>" type="hidden">
<input name="btn_account_name" tabindex="" title="Select [Alt+T]" accesskey="T" class="button" value="Wybierz" onclick='open_popup("Accounts", 600, 400, "", true, false, {{"call_back_function":"set_return","form_name":"search_reports","field_to_name_array":{"id":"account_id","name":"account_name"}}}, "single", true);' type="button">
</td>
<td class="dataLabel" width="10%" nowrap="nowrap">Kategorie</td>
<td class="dataField" width="30%" nowrap="nowrap">
<select name="category[]" multiple size="4" id="category">
<?
$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(in_array($r['id'],$_REQUEST['category']))echo ' selected';
echo '>'.$r['name'].'</option>';
}
?>
</select> </td>
<td class="dataLabel" width="10%" nowrap="nowrap">Pokaz</td>
<td class="dataField" width="30%" nowrap="nowrap">
<select name="show[]" multiple size="4">
<option value="sales" <? if(in_array("sales",$_REQUEST['show']))echo "selected";?>>Sprzedaż</option>
<option value="quantity" <? if(in_array("quantity",$_REQUEST['show']))echo "selected";?>>Pcs</option>
<option value="margin" <? if(in_array("margin",$_REQUEST['show']))echo "selected";?>>% Margines </option>
<option value="pln_margin" <? if(in_array("pln_margin",$_REQUEST['show']))echo "selected";?>>PLN Margines</option>
</select></td>
</tr>
</tbody>
</table>
<input class="button" name="submit" value="Szukaj" type="submit">
<input class="button" name="clear" value="Wyczyść" type="button" onclick="location.href='index.php?module=EcmCharts&action=index1';">
<input class="button" name="popup" value="Otwórz w nowym oknie" type="button" onclick="window.open('index.php?module=EcmCharts&action=OpenPopup&file=1&width='+screen.width+'&height='+screen.height+'&to_pdf=1','popup','menubar=0,fullscreen=yes,resizable=0,width='+screen.width+',height='+screen.height);">
<?php
$string="";
foreach($category as $catt)$string.="category[]=".$catt."&";
foreach($_REQUEST['show'] as $sh)$string.="show[]=".$sh."&";
$string.="account=".$_REQUEST['account_id']."&";
$string.="year=".$year;
?>
<input class="button" name="popup" value="Utwórz PDF" type="button" onclick="window.open('index.php?module=EcmCharts&action=CreatePDF1&width='+screen.width+'&height='+screen.height+'&to_pdf=1&<?php echo $string;?>','popup','menubar=0,fullscreen=yes,resizable=0,width='+screen.width+',height='+screen.height);">
<input class="button" name="popup" value="Utwórz zdjęcie" type="button" onclick="window.open('index.php?module=EcmCharts&action=CreateIMG1&width='+screen.width+'&height='+screen.height+'&to_pdf=1&<?php echo $string;?>','popup','menubar=0,fullscreen=yes,resizable=yes,scrollbars=yes,width='+screen.width+',height='+screen.height);">
</form><br />
</form><br />
<?php
include_once('include/ECM/open_flash_chart/ofc-library/open_flash_chart_object.php');
if(count($category)>0){
foreach($category as $cat){
$_SESSION['EcmCharts_1_year']=$year;
$_SESSION['EcmCharts_1_category']=$cat;
$_SESSION['EcmCharts_1_account']=$_REQUEST['account_id'];
$_SESSION['EcmCharts_1_show']=$_REQUEST['show'];
$_SESSION['EcmCharts_1_mmm']=$mmm;
open_flash_chart_object(1024,552,'modules/EcmCharts/1.php?category='.$cat,true,'include/ECM/open_flash_chart/');
}
}
else{
$_SESSION['EcmCharts_1_year']=$year;
$_SESSION['EcmCharts_1_category']="";
$_SESSION['EcmCharts_1_account']=$_REQUEST['account_id'];
$_SESSION['EcmCharts_1_show']=$_REQUEST['show'];
$_SESSION['EcmCharts_1_mmm']=$mmm;
open_flash_chart_object(1024,552,'modules/EcmCharts/1.php?category=',true,'include/ECM/open_flash_chart/');
}
?>