diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index c7d82126ad4..7936f0c581e 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -42,14 +42,14 @@ $langs->load('orders'); $page=$_GET["page"]; $sortorder=$_GET["sortorder"]; $sortfield=$_GET["sortfield"]; +$viewstatut=$_GET['viewstatut']; +$propal_statut = $_GET['propal_statut']; +if($propal_statut != '') + $viewstatut=$propal_statut; -if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="nom"; +if (! $sortorder) $sortorder="DESC"; +if (! $sortfield) $sortfield="p.datep"; if ($page == -1) { $page = 0 ; } -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - // Sécurité accés client $user->getrights('facture'); @@ -448,9 +448,11 @@ if ($_GET["propalid"] > 0) /* * Boutons Actions */ + print '
'; + print ''.'Retour Liste'.""; + if ($propal->statut <> 4 && $user->societe_id == 0) { - print '
'; if ($propal->statut == 2 && $user->rights->facture->creer) { @@ -461,10 +463,9 @@ if ($_GET["propalid"] > 0) { print '".$langs->trans("ClassifyBilled").""; } - - print "
"; - print "
\n"; } + print "
"; + print "
\n"; @@ -638,10 +639,6 @@ else */ - if (! $sortfield) $sortfield="p.datep"; - if (! $sortorder) $sortorder="DESC"; - if ($page == -1) $page = 0 ; - $limit = $conf->liste_limit; $offset = $limit * $page ; $pageprev = $page - 1; @@ -658,10 +655,28 @@ else $sql.= " WHERE p.fk_soc = s.rowid"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql .= " AND s.rowid = ".$socid; - if ($viewstatut <> '') $sql .= " AND p.fk_statut in ($viewstatut)"; // viewstatut peut etre combinaisons séparé par virgules - if ($month > 0) $sql .= " AND date_format(p.datep, '%Y-%m') = '".$year-$month."'"; - if ($year > 0) $sql .= " AND date_format(p.datep, '%Y') = ".$year; - $sql .= " ORDER BY ".$sortfield." ".$sortorder.", p.rowid DESC "; + if ($viewstatut <> '') $sql .= " AND p.fk_statut in ($viewstatut)"; // viewstatut peut etre combinaisons séparé par virgules + if ($month > 0) + { + if ($year > 0) + $sql .= " AND date_format(p.datep, '%Y-%m') = '$year-$month'"; + else + $sql .= " AND date_format(p.datep, '%m') = '$month'"; + } + if ($year > 0) $sql .= " AND date_format(p.datep, '%Y') = $year"; + if (!empty($_GET['search_ref'])) + { + $sql .= " AND p.ref LIKE '%".addslashes($_GET['search_ref'])."%'"; + } + if (!empty($_GET['search_societe'])) + { + $sql .= " AND s.nom LIKE '%".addslashes($_GET['search_societe'])."%'"; + } + if (!empty($_GET['search_montant_ht'])) + { + $sql .= " AND p.price='".addslashes($_GET['search_montant_ht'])."'"; + } + $sql .= " ORDER BY $sortfield $sortorder, p.rowid DESC "; $sql .= $db->plimit($limit + 1,$offset); if ( $db->query($sql) ) @@ -669,7 +684,7 @@ else $num = $db->num_rows(); - print_barre_liste($langs->trans("Proposals"), $page, "propal.php","&socid=$socid",$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans("Proposals"), $page, "propal.php","&socid=$socid&month=$month&year=$year&search_ref=$search_ref&search_societe=$search_societe&search_montant_ht=$search_montant_ht".'&viewstatut='.$viewstatut,$sortfield,$sortorder,'',$num); $i = 0; $var=true; @@ -681,8 +696,35 @@ else print_liste_field_titre($langs->trans("Date"),"propal.php","p.datep","&viewstatut=$viewstatut","",'align="right"',$sortfield); print_liste_field_titre($langs->trans("Price"),"propal.php","p.price","&viewstatut=$viewstatut","",'align="right"',$sortfield); print_liste_field_titre($langs->trans("Status"),"propal.php","p.fk_statut","&viewstatut=$viewstatut","",'align="right"',$sortfield); + print ' '; print "\n"; - + + // Lignes des champs de filtre + print '
'; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print 'mois : ' . ''; + print ' année : ' . ''; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + $html->select_propal_statut($viewstatut); + print ''; + print ''; + print ''; + print "\n"; + print '
'; + while ($i < min($num, $limit)) { $objp = $db->fetch_object(); @@ -691,27 +733,27 @@ else print ""; print ''; - $propalstatic->id=$objp->propalid; - $propalstatic->ref=$objp->ref; - - // Ref - print ''; - print ''; - - print ''; - - print '
'; - print $propalstatic->getNomUrl(1); - print ''; - if ($objp->fk_statut == 1 && $objp->din < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); - print ''; - - $filename=sanitize_string($objp->ref); - $filedir=$conf->propal->dir_output . '/' . sanitize_string($objp->ref); - $urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid; - $html->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1); - - print '
'; + $propalstatic->id=$objp->propalid; + $propalstatic->ref=$objp->ref; + + //Ref + print ''; + print ''; + + print ''; + + print '
'; + print $propalstatic->getNomUrl(1, 'compta', "&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder"); + print ''; + if ($objp->fk_statut == 1 && $objp->din < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + print ''; + + $filename=sanitize_string($objp->ref); + $filedir=$conf->propal->dir_output . '/' . sanitize_string($objp->ref); + $urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid; + $html->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1); + + print '
'; print "\n"; @@ -736,7 +778,8 @@ else // Prix print "".price($objp->price)."\n"; print "".$propalstatic->LibStatut($objp->fk_statut,5)."\n"; - print "\n"; + print " "; + print "\n"; $i++; }