diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 30a8d2d4353..11811d1c6aa 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -25,6 +25,7 @@ require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; @@ -44,6 +45,8 @@ $search_label = GETPOST('search_label','alpha'); $search_amount_deb = GETPOST('search_amount_deb','alpha'); $search_amount_cred = GETPOST('search_amount_cred','alpha'); $search_account = GETPOST('search_account','int'); +$search_date = dol_mktime(0, 0, 0, GETPOST('date_docmonth', 'int'), GETPOST('date_docday', 'int'), GETPOST('date_docyear', 'int')); +$search_accountancy_code = GETPOST("search_accountancy_code"); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -80,6 +83,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_amount_cred=""; $search_account=''; $typeid=""; + $search_date = ''; + $search_accountancy_code = ''; } /* @@ -89,6 +94,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', llxHeader(); $form = new Form($db); +$formaccounting = new FormAccounting($db); $variousstatic = new PaymentVarious($db); $accountstatic = new Account($db); @@ -102,11 +108,14 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row $sql.= " WHERE v.entity IN (".getEntity('payment_various').")"; // Search criteria -if ($search_ref) $sql.=" AND v.rowid=".$search_ref; -if ($search_label) $sql.=natural_search(array('v.label'), $search_label); -if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); -if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); -if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; +if ($search_ref) $sql.=" AND v.rowid=".$search_ref; +if ($search_label) $sql.=natural_search(array('v.label'), $search_label); +if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); +if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); +if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account; +if ($search_date) $sql.=" AND v.datep=".$search_date; +if ($search_accountancy_code) $sql.=" AND v.accountancy_code=".$search_accountancy_code; + if ($filtre) { $filtre=str_replace(":","=",$filtre); $sql .= " AND ".$filtre; @@ -159,7 +168,7 @@ if ($result) print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre("AccountAccounting",$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder); + if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting",$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre("Debit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("Credit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); @@ -176,7 +185,11 @@ if ($result) print ''; // Date - print ' '; + print ''; + print '
'; + print $form->select_date($search_date, 'date_doc', 0, 0, 1); + print '
'; + print ''; // Type print ''; @@ -192,7 +205,14 @@ if ($result) } // Accounting account - if (! empty($conf->accounting->enabled)) print ' '; + if (! empty($conf->accounting->enabled)) + { + print ''; + print '
'; + print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, array (), 1, 1, 'maxwidth200'); + print '
'; + print ''; + } // Debit print ''; @@ -224,7 +244,7 @@ if ($result) print "".dol_trunc($obj->label,40)."\n"; // Date payment - print ''.dol_print_date($db->jdate($obj->datep),'day')."\n"; + print ''.dol_print_date($db->jdate($obj->datep),'day')."\n"; // Type print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'';