130 lines
4.7 KiB
PHP
130 lines
4.7 KiB
PHP
<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>Faktury: Produkty na fakturach:</h2></td></tr></table><br />
|
|
<ul class="tablist" style="width:100%;">
|
|
<li>
|
|
<a class="current" href="#">Podstawowe wyszukiwanie</a>
|
|
</li>
|
|
</ul>
|
|
<form action="index.php" method="get" name="SearchFormSales">
|
|
<input type="hidden" name="module" value="EcmInvoiceOutOlds" />
|
|
<input type="hidden" name="action" value="ListSales" />
|
|
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" 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">
|
|
<input name="year" id="year" value="<? echo $_REQUEST['year'];?>" title="" tabindex="" size="11" type="text">
|
|
</td>
|
|
<td class="dataLabel" width="10%" nowrap="nowrap">
|
|
Index
|
|
</td>
|
|
<td class="dataField" width="30%" nowrap="nowrap">
|
|
<input name="code" id="code" value="<? echo $_REQUEST['code'];?>" title="" tabindex="" size="11" type="text">
|
|
</td>
|
|
|
|
<td class="dataLabel" width="10%" nowrap="nowrap">
|
|
Ilość
|
|
</td>
|
|
<td class="dataField" width="30%" nowrap="nowrap">
|
|
<input name="quantity" id="quantity" value="<? echo $_REQUEST['quantity'];?>" title="" tabindex="" size="11" type="text">
|
|
</td>
|
|
|
|
<td class="dataLabel" width="10%" nowrap="nowrap">
|
|
Cena
|
|
</td>
|
|
<td class="dataField" width="30%" nowrap="nowrap">
|
|
<input name="price" id="price" value="<? echo $_REQUEST['price'];?>" title="" tabindex="" size="11" type="text">
|
|
</td>
|
|
|
|
<td class="dataLabel" width="10%" nowrap="nowrap">Kontrahent</td>
|
|
<td class="dataField" nowrap="nowrap">
|
|
<input name="account_name" 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="Wybierz [Alt+T]" accesskey="T" class="button" value="Wybierz" onclick='open_popup("Accounts", 600, 400, "", true, false, {"call_back_function":"set_return","form_name":"SearchFormSales","field_to_name_array":{"id":"account_id","name":"account_name"}}, "single", true);' type="button"></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=EcmInvoiceOutOlds&action=ListSales';"><?
|
|
?>
|
|
</form><br />
|
|
|
|
<?php
|
|
|
|
$tds1='<td class="listViewThS1">';
|
|
|
|
$trs='<tr style="vertical-align:top;">';
|
|
$tre='</tr>';
|
|
|
|
$tds='<td class="oddListRowS1" style="vertical-align:top;">';
|
|
$tde='</td>';
|
|
|
|
$tbs='<table cellpadding="0" cellspacing="0" border="0" class="ListView" style="width:100%;">';
|
|
$tbe='</table>';
|
|
|
|
$t.=$tbs;
|
|
$t.=$trs;
|
|
$t.=$tds1;
|
|
$t.="Index";
|
|
$t.=$tde;
|
|
$t.=$tds1;
|
|
$t.="Nazwa";
|
|
$t.=$tde;
|
|
$t.=$tds1;
|
|
$t.="Ilość";
|
|
$t.=$tde;
|
|
$t.=$tds1;
|
|
$t.="Cena";
|
|
$t.=$tde;
|
|
$t.=$tds1;
|
|
$t.="Nr dokumentu";
|
|
$t.=$tde;
|
|
$t.=$tds1;
|
|
$t.="Data rejestracji";
|
|
$t.=$tde;
|
|
$t.=$tre;
|
|
$i=1;
|
|
|
|
if($_REQUEST['year'])$wh[]="e.register_date like '".$_REQUEST['year']."%'";
|
|
if($_REQUEST['price'])$wh[]="p.price='".(float)str_replace(",",".",$_REQUEST['price'])."'";
|
|
if($_REQUEST['code'])$wh[]="p.code like '".$_REQUEST['code']."%'";
|
|
if($_REQUEST['quantity'])$wh[]="p.quantity>=".$_REQUEST['quantity']."";
|
|
if($_REQUEST['account_id'])$wh[]="e.parent_id='".$_REQUEST['account_id']."'";
|
|
if($_REQUEST['account_name'] && !$_REQUEST['account_id'])$wh[]="e.parent_name like '".$_REQUEST['account_name']."%'";
|
|
if(count($wh)>0)$where=" and ".implode(" and ",$wh);
|
|
else $where="";
|
|
if($_REQUEST['code'] && ($_REQUEST['account_name'] || $_REQUEST['account_id'])){
|
|
$z="select p.subprice, p.quantity,p.price,p.code,p.name,e.document_no,e.register_date,e.id as iid,p.ecmproduct_id as pid from ecminvoiceoutolds as e inner join ecminvoiceoutolditems as p on p.ecminvoiceoutold_id=e.id where e.deleted='0' and e.type!='correct' ".$where;
|
|
$w=$GLOBALS['db']->query($z);
|
|
echo mysql_error();//echo $z;
|
|
|
|
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
|
$t.=$trs;
|
|
$t.=$tds;
|
|
$t.=$r['code'];
|
|
$t.=$tde;
|
|
$t.=$tds;
|
|
$t.=$r['name'];
|
|
$t.=$tde;
|
|
$t.=$tds;
|
|
$t.=number_format($r['quantity'],0,"","");
|
|
$t.=$tde;
|
|
$t.=$tds;
|
|
$t.=number_format($r['subprice'],2,",",".");
|
|
$t.=$tde;
|
|
$t.=$tds;
|
|
$t.='<a href="index.php?module=EcmInvoiceOutOlds&action=DetailView&record='.$r['iid'].'">'.$r['document_no'].'</a>';
|
|
$t.=$tde;
|
|
$t.=$tds;
|
|
$t.=$GLOBALS['timedate']->to_display_date($r['register_date']);
|
|
$t.=$tde;
|
|
$t.=$tre;
|
|
$i++;
|
|
}
|
|
}
|
|
$t.=$tbe;
|
|
echo $t;
|
|
?>
|