diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index c4515e0bc5c..c87232f4fb2 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -48,10 +48,12 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid); +$req_nb=GETPOST("req_nb",'',3); +$thirdarty=GETPOST("thirdparty",'',3); +$account=GETPOST("account"); +$vline=GETPOST("vline"); +$action=GETPOST("action"); -$account=isset($_GET["account"])?$_GET["account"]:$_POST["account"]; -$vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"]; -$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; $page=isset($_GET["page"])?$_GET["page"]:0; $negpage=isset($_GET["negpage"])?$_GET["negpage"]:0; if ($negpage) @@ -184,10 +186,10 @@ if ($account || $_GET["ref"]) $param=''; $sql_rech=''; $mode_search = 0; - if ($_REQUEST["req_nb"]) + if ($req_nb) { - $sql_rech.= " AND b.num_chq like '%".$db->escape($_REQUEST["req_nb"])."%'"; - $param.='&req_nb='.urlencode($_REQUEST["req_nb"]); + $sql_rech.= " AND b.num_chq like '%".$db->escape($req_nb)."%'"; + $param.='&req_nb='.urlencode($req_nb); $mode_search = 1; } if ($_REQUEST["req_desc"]) @@ -208,10 +210,10 @@ if ($account || $_GET["ref"]) $param.='&req_credit='.urlencode($_REQUEST["req_credit"]); $mode_search = 1; } - if ($_REQUEST["thirdparty"]) + if ($thirdparty) { - $sql_rech.=" AND (COALESCE(s.nom,'') LIKE '%".$db->escape($_REQUEST["thirdparty"])."%')"; - $param.='&thirdparty='.urlencode($_REQUEST["thirdparty"]); + $sql_rech.=" AND (COALESCE(s.nom,'') LIKE '%".$db->escape($thirdparty)."%')"; + $param.='&thirdparty='.urlencode($thirdparty); $mode_search = 1; } if ($_REQUEST["paiementtype"]) @@ -311,11 +313,11 @@ if ($account || $_GET["ref"]) } $navig.= $langs->trans("Page")." "; // ' Page '; $navig.=''; - $navig.=''; + $navig.=''; $navig.=''; $navig.=''; $navig.=''; - $navig.=''; + $navig.=''; $navig.=''; $navig.=''; $navig.='/'.$nbpage.' '; @@ -421,15 +423,16 @@ if ($account || $_GET["ref"]) print ''; print ''; - print ' '; + print ' '; + print ' '; print ''; //$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...) $filtertype=''; print $html->select_types_paiements($_REQUEST['paiementtype'],'paiementtype',$filtertype,2,1,1,8); print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; print ' '; @@ -533,6 +536,8 @@ if ($account || $_GET["ref"]) if ($objp->fk_type == 'SOLD') $label=' '; print $label; print "\n"; + + // Num print ''.($objp->num_chq?$objp->num_chq:"")."\n"; // Description diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index ee9fe86e511..3fe12a604bb 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -75,7 +75,7 @@ $html = new Form($db); if ($vline) $viewline = $vline; else $viewline = 50; -$sql = "SELECT b.rowid, b.dateo as do, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,"; +$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,"; $sql.= " b.fk_account, b.fk_type,"; $sql.= " ba.rowid as bankid, ba.ref as bankref,"; $sql.= " bu.label as labelurl, bu.url_id"; @@ -84,8 +84,19 @@ if (! empty($_REQUEST["bid"])) $sql.= MAIN_DB_PREFIX."bank_class as l,"; $sql.= " ".MAIN_DB_PREFIX."bank_account as ba,"; $sql.= " ".MAIN_DB_PREFIX."bank as b"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid"; $sql.= " WHERE b.fk_account = ba.rowid"; $sql.= " AND ba.entity = ".$conf->entity; +if (GETPOST("req_nb")) +{ + $sql.= " AND b.num_chq like '%".$db->escape(GETPOST("req_nb"))."%'"; + $param.='&req_nb='.urlencode(GETPOST("req_nb")); +} +if (GETPOST("thirdparty")) +{ + $sql.=" AND (COALESCE(s.nom,'') LIKE '%".$db->escape(GETPOST("thirdparty"))."%')"; + $param.='&thirdparty='.urlencode(GETPOST("thirdparty")); +} if (! empty($_REQUEST["bid"])) { $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$_REQUEST["bid"]; @@ -141,32 +152,36 @@ if ($resql) print ''; print ''; print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('DateOperationShort'),$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('DateOperationShort'),$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Value'),$_SERVER['PHP_SELF'],'b.datev','',$param,'align="center"',$sortfield,$sortorder); + print ''; + print ''; print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; print "\n"; print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - print ''; + print ''; print ''; print ''; - print ''; print ''; - // Date - print '\n"; + // Date ope + print '\n"; - // Description + // Date value + print '\n"; + + // Payment type + print "\n"; + + // Num + print '\n"; + + // Description print "\n"; } - // Payment type - print "\n"; - // Bank account print '
'.$langs->trans("Type").''.$langs->trans("Numero").''.$langs->trans("Description").''.$langs->trans("ThirdParty").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Type").''.$langs->trans("Account").'   '.$langs->trans("Account").'
  '; - print ''; + print '  '; + $html->select_types_paiements(empty($_REQUEST["type"])?'':$_REQUEST["type"], 'type', '', 2, 0, 1, 8); + print ''; + print ''; print ' '; - print ''; + print ''; print ''; - print ''; - print ''; - $html->select_types_paiements(empty($_REQUEST["type"])?'':$_REQUEST["type"], 'type', '', 2, 0, 1, 8); + print ''; print ''; print ''; @@ -189,83 +204,25 @@ if ($resql) print "rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid."   "; print ''.dol_print_date($db->jdate($objp->do),"day")."   '.dol_print_date($db->jdate($objp->do),"day")."'.dol_print_date($db->jdate($objp->dv),"day").""; + $labeltype=$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle'); + if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance"); + else print $labeltype; + print "'.($objp->num_chq?$objp->num_chq:"").""; - /* This bloc is same than in page compta/bank/account.php - - // Show generic description - if (preg_match('/^\((.*)\)$/i',$objp->label,$reg)) - { - // Generic description because between (). We show it after translating. - print $langs->trans($reg[1]); - } - else - { - print dol_trunc($objp->label,60); - } - // Add links after description - $links = $acct->get_url($objp->rowid); - foreach($links as $key=>$val) - { - if ($links[$key]['type']=='payment') { - $paymentstatic->id=$links[$key]['url_id']; - print ' '.$paymentstatic->getNomUrl(2); - } - else if ($links[$key]['type']=='payment_supplier') { - $paymentsupplierstatic->id=$links[$key]['url_id']; - $paymentsupplierstatic->ref=$links[$key]['url_id']; - print ' '.$paymentsupplierstatic->getNomUrl(2); - } - else if ($links[$key]['type']=='company') { - } - else if ($links[$key]['type']=='sc') { // This is waiting for card to link to payment_sc - $chargestatic->id=$links[$key]['url_id']; - $chargestatic->ref=$links[$key]['url_id']; - $chargestatic->lib=$langs->trans("SocialContribution"); - print ' '.$chargestatic->getNomUrl(2); - } - else if ($links[$key]['type']=='payment_sc') - { - //print ' - '; - print ''; - print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; - //print $langs->trans("SocialContributionPayment"); - print ''; - - } - else if ($links[$key]['type']=='payment_vat') - { - $paymentvatstatic->id=$links[$key]['url_id']; - $paymentvatstatic->ref=$links[$key]['url_id']; - print ' '.$paymentvatstatic->getNomUrl(2); - } - else if ($links[$key]['type']=='banktransfert') { - // Do not show this link (avoid confusion). Can already be accessed from transaction detail - } - else if ($links[$key]['type']=='member') { - } - else { - //print ' - '; - print ''; - if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg)) - { - // Label generique car entre parentheses. On l'affiche en le traduisant - if ($reg[1]=='paiement') $reg[1]='Payment'; - print $langs->trans($reg[1]); - } - else - { - print $links[$key]['label']; - } - print ''; - } - } - */ - print "rowid."&account=".$objp->fk_account."\">"; $reg=array(); preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction @@ -299,13 +256,6 @@ if ($resql) print " ".price($objp->amount).""; - $labeltype=$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle'); - if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance"); - else print $labeltype; - print "'; $bankaccountstatic->id=$objp->bankid;