Fix: Pagination
This commit is contained in:
parent
e8101e3cde
commit
69f0d596ba
@ -65,28 +65,26 @@ llxHeader('',$langs->trans("TaxAndDividendsArea"));
|
||||
$title=$langs->trans("TaxAndDividendsArea");
|
||||
if ($_GET["mode"] == 'sconly') $title=$langs->trans("SocialContributionsPayments");
|
||||
|
||||
print_fiche_titre($title,($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":""));
|
||||
$param='';
|
||||
if (GETPOST("mode") == 'sconly') $param='&mode=sconly';
|
||||
if ($sortfield) $param.='&sortfield='.$sortfield;
|
||||
if ($sortorder) $param.='&sortorder='.$sortorder;
|
||||
|
||||
if ($_GET["mode"] != 'sconly')
|
||||
print_fiche_titre($title, ($year?"<a href='index.php?year=".($year-1).$param."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1).$param."'>".img_next()."</a>":""));
|
||||
|
||||
if ($year) $param.='&year='.$year;
|
||||
|
||||
// Social contributions only
|
||||
if (GETPOST("mode") != 'sconly')
|
||||
{
|
||||
print $langs->trans("DescTaxAndDividendsArea").'<br>';
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
|
||||
// Social contributions
|
||||
if ($_GET["mode"] != 'sconly')
|
||||
{
|
||||
print_titre($langs->trans("SocialContributionsPayments"));
|
||||
}
|
||||
|
||||
if ($_GET["mode"] == 'sconly')
|
||||
{
|
||||
$param='&mode=sconly';
|
||||
print_fiche_titre($langs->trans("SocialContributionsPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="120"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
|
||||
@ -110,10 +108,10 @@ if ($year > 0)
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||
$sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
|
||||
$sql .= "OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
|
||||
$sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
|
||||
$sql .= ")";
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
if (! preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
|
||||
//$sql.= $db->plimit($limit+1,$offset);
|
||||
//print $sql;
|
||||
|
||||
@ -184,18 +182,18 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
|
||||
|
||||
$tva = new Tva($db);
|
||||
|
||||
print_titre($langs->trans("VATPayments"));
|
||||
print_fiche_titre($langs->trans("VATPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
|
||||
|
||||
$sql = "SELECT f.rowid, f.amount, f.label, f.datev as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as f ";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
|
||||
$sql.= " WHERE pv.entity = ".$conf->entity;
|
||||
if ($year > 0)
|
||||
{
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||
$sql.= " AND f.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
$sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
$sql.= " ORDER BY dm DESC";
|
||||
if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -205,12 +203,12 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
|
||||
$total = 0 ;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="120" class="nowrap">'.$langs->trans("PeriodEndDate").'</td>';
|
||||
print "<td>".$langs->trans("Label")."</td>";
|
||||
print '<td align="right" width="10%">'.$langs->trans("ExpectedToPay")."</td>";
|
||||
print '<td align="right" width="10%">'.$langs->trans("RefPayment")."</td>";
|
||||
print '<td align="center" width="15%">'.$langs->trans("DatePayment")."</td>";
|
||||
print '<td align="right" width="10%">'.$langs->trans("PayedByThisPayment")."</td>";
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
$var=1;
|
||||
while ($i < $num)
|
||||
@ -227,12 +225,13 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
|
||||
// Ref payment
|
||||
$tva_static->id=$obj->rowid;
|
||||
$tva_static->ref=$obj->rowid;
|
||||
print '<td align="right">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
||||
print "<td align=\"right\">".price($obj->amount)."</td>";
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
|
||||
@ -1212,7 +1212,7 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64)
|
||||
$newskype.='<img src="../theme/'.$conf->theme.'/img/object_skype.png" border="0"> ';
|
||||
$newskype.=dol_trunc($skype,$max);
|
||||
$newskype.='</a>';
|
||||
|
||||
|
||||
if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
$type='AC_SKYPE'; $link='';
|
||||
@ -2372,7 +2372,7 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar
|
||||
* Get title line of an array
|
||||
*
|
||||
* @param string $name Label of field
|
||||
* @param int $thead 0=To use with standard table forat, 1=To use inside <thead><tr>, 2=To use with <div>
|
||||
* @param int $thead 0=To use with standard table forat, 1=To use inside <thead><tr>, 2=To use with <div>
|
||||
* @param string $file Url used when we click on sort picto
|
||||
* @param string $field Field to use for new sorting. Empty if this field is not sortable.
|
||||
* @param string $begin ("" by defaut)
|
||||
@ -2392,7 +2392,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
|
||||
|
||||
$tag='th';
|
||||
if ($thead==2) $tag='div';
|
||||
|
||||
|
||||
// If field is used as sort criteria we use a specific class
|
||||
// Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom")
|
||||
if ($field && ($sortfield == $field || $sortfield == preg_replace("/^[^\.]+\./","",$field))) $out.= '<'.$tag.' class="liste_titre_sel" '. $moreattrib.'>';
|
||||
@ -2449,7 +2449,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a title (deprecated. use print_fiche_titre instrad)
|
||||
* Show a title (deprecated. use print_fiche_titre instead)
|
||||
*
|
||||
* @param string $title Title to show
|
||||
* @return string Title to show
|
||||
@ -2462,16 +2462,16 @@ function print_titre($title)
|
||||
/**
|
||||
* Show a title with picto
|
||||
*
|
||||
* @param string $titre Title to show
|
||||
* @param string $title Title to show
|
||||
* @param string $mesg Added message to show on right
|
||||
* @param string $picto Icon to use before title (should be a 32x32 transparent png file)
|
||||
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image
|
||||
* @param int $id To force an id on html objects
|
||||
* @return void
|
||||
*/
|
||||
function print_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='')
|
||||
function print_fiche_titre($title, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='')
|
||||
{
|
||||
print load_fiche_titre($titre, $mesg, $picto, $pictoisfullpath, $id);
|
||||
print load_fiche_titre($title, $mesg, $picto, $pictoisfullpath, $id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3004,7 +3004,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
|
||||
$sql.= " WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$thirdparty_seller->country_code."'";
|
||||
$sql.= " ORDER BY t.taux DESC, t.recuperableonly ASC";
|
||||
$sql.= $db->plimit(1);
|
||||
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user