'; echo ''; echo ''; echo ''; $json_config = new json_config (); $db=$GLOBALS['db']; $where=false; $where_c=array(); if($_POST['year']!=''){ $where_c[]='YEAR(faktura.register_date)="'.$_POST['year'].'"'; } if($_POST['code']!=''){ $where_c[]='pozycja.code like "%'.$_POST['code'].'%"'; } if($_POST['quantity']!=''){ $where_c[]='pozycja.quantity="'.$_POST['quantity'].'"'; } if($_POST['price']!=''){ $_POST['price']=str_replace(',','.',$_POST['price']); $where_c[]='pozycja.price_netto="'.$_POST['price'].'"'; } if($_POST['account_id']!=''){ $where_c[]='faktura.parent_id="'.$_POST['account_id'].'"'; } $where_string=''; if(count($where_c)>0){ $where_string.=' where '; $where_string.=implode(' and ',$where_c); } echo $_POST['account_name']; if($_POST['submit']){ $zap=$db->query("select pozycja.id, pozycja.code, pozycja.name, pozycja.quantity, pozycja.price_netto, faktura.document_no, faktura.id as fk_id, faktura.register_date, faktura.number, faktura.parent_shipping_address_name, faktura.parent_name from ecminvoiceoutitems pozycja JOIN ecminvoiceouts faktura ON pozycja.ecminvoiceout_id = faktura.id JOIN ecmproducts produkt ON pozycja.ecmproduct_id = produkt.id ".$where_string); $position_list=array(); while($dane=$db->fetchByAssoc($zap)){ //if ($dane['parent_shipping_address_name'] && $dane['parent_shipping_address_name']!='' && // $dane['parent_shipping_address_name'] != $dane['parent_name']) $dane['document_no'].='
'.$dane['parent_shipping_address_name']; $position_list[]=$dane; } } //$focus = new EcmInvoiceOut (); $edit->ss = new Sugar_Smarty (); $edit->module = 'EcmInvoiceOuts'; //$edit->ss->assign ( "CREATED_BY_NAME", $focus->created_by_name ); //$edit->ss->assign ( "MODIFIED_BY_NAME", $focus->modified_by_name ); //$edit->ss->assign ( 'FOCUS', $focus); $edit->ss->assign ( 'POST', $_POST); $edit->ss->assign ( 'LINK', $link); $edit->ss->assign('POSITION_LIST',$position_list); $edit->ss->assign ( 'MOD', $mod_strings); $edit->ss-> display('modules/EcmInvoiceOuts/tpls/ListSales.tpl'); //4 ?>