diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index b67a7b8b99a..409b6a1e33f 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -921,7 +921,7 @@ else { $langs->load("projects"); print ''; - print ''; print ''; $var = True; - $tot_ht=0; - $tot_ttc=0; + $tot_ht=$tot_ttc=$tot_tobill=0; while ($i < $num) { $obj = $db->fetch_object($resql); diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index a5110363b71..6f81cdcec0e 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -272,7 +272,7 @@ if ($_GET["propalid"]) } else { - print ''; + print ''; } print ''; @@ -319,7 +319,7 @@ if ($_GET["propalid"]) print ''; print "\n"; } - $var=True; + $var=true; while ($i < $num_lignes) { $objp = $db->fetch_object($resql); @@ -620,6 +620,8 @@ if ($_GET["propalid"]) print_barre_liste($langs->trans("Proposals"), $page, "propal.php","&socidp=$socidp",$sortfield,$sortorder,'',$num); $i = 0; + $var=true; + print "
'; + print ''; if ($_GET["action"] != "classer") print ''; @@ -929,11 +929,11 @@ else print '"; } else { diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 78b692e3a78..8d80ef6f93b 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -22,10 +22,10 @@ */ /** - \file htdocs/compta/facture.php - \ingroup facture - \brief Page de création d'une facture - \version $Revision$ + \file htdocs/compta/facture.php + \ingroup facture + \brief Page de création d'une facture + \version $Revision$ */ require("./pre.inc.php"); @@ -41,7 +41,6 @@ if (!$user->rights->facture->lire) $langs->load("main"); // BUG De chargement de traduction ne pas modifier cette ligne $langs->load("bills"); -$warning_delay=31*24*60*60; // Delai affichage warning retard (si retard paiement facture > delai) if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } @@ -117,19 +116,18 @@ if ($user->rights->facture->lire) { $sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'"; } - - $sql .= " GROUP BY f.facnumber"; - - $sql .= " ORDER BY "; - $listfield=split(',',$sortfield); - foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.","; - $sql .= " f.fk_soc ASC"; - - //$sql .= $db->plimit($limit+1,$offset); - - $result = $db->query($sql); - - if ($result) + $sql.= " GROUP BY f.facnumber"; + + $sql.= " ORDER BY "; + $listfield=split(',',$sortfield); + foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.","; + $sql.= " f.fk_soc ASC"; + + //$sql .= $db->plimit($limit+1,$offset); + + $result = $db->query($sql); + + if ($result) { $num = $db->num_rows($result); @@ -190,13 +188,13 @@ if ($user->rights->facture->lire) print '\n"; print "\n"; print "\n"; - print ''; + print ''; print ""; print ""; diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index 350e346b313..c655dad9746 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -322,7 +322,7 @@ if ($socid > 0) */ if ($conf->projet->enabled) { - print '
'; print $langs->trans("Project"); print ''.img_edit($langs->trans("SetProject")).''; if ($_GET["action"] == "classer") { - $html->form_project("facture.php?facid=$fac->id",$fac->fk_soc,$fac->projetid,"projetid"); + $html->form_project($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->fk_soc,$fac->projetid,"projetid"); } else { - $html->form_project("facture.php?facid=$fac->id",$fac->fk_soc,$fac->projetid,"none"); + $html->form_project($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->fk_soc,$fac->projetid,"none"); } print "'.img_object($langs->trans("ShowBill"),"bill")." "; print ''.$objp->facnumber.''.$objp->increment; - if ($objp->datelimite < (time() - $warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) print img_warning($langs->trans("Late")); + if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late")); print "".dolibarr_print_date($objp->df)."".dolibarr_print_date($objp->datelimite)."'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,44).''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,32).'".price($objp->total)."".price($objp->total_ttc)."
'; + print '
'; $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index c42597b1727..80e71b53c60 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -37,13 +37,12 @@ $langs->load("bills"); $warning_delay=31*24*60*60; // Delai affichage warning retard (si retard paiement facture > delai) -/* - * Sécurité accés client - */ +// Sécurité accés client +$socidp=''; if ($user->societe_id > 0) { - $action = ''; - $socidp = $user->societe_id; + $action = ''; + $socidp = $user->societe_id; } @@ -54,24 +53,24 @@ llxHeader("",$langs->trans("AccountancyTreasuryArea")); * Actions */ -if ($_GET["action"] == 'add_bookmark') +if (isset($_GET["action"]) && $_GET["action"] == 'add_bookmark') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socidp." AND fk_user=".$user->id; - if (! $db->query($sql) ) - { - dolibarr_print_error($db); - } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");"; - if (! $db->query($sql) ) - { - dolibarr_print_error($db); - } +$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socidp." AND fk_user=".$user->id; +if (! $db->query($sql) ) +{ + dolibarr_print_error($db); +} +$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");"; +if (! $db->query($sql) ) +{ + dolibarr_print_error($db); +} } -if ($_GET["action"] == 'del_bookmark') +if (isset($_GET["action"]) && $_GET["action"] == 'del_bookmark') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE rowid=".$_GET["bid"]; - $result = $db->query($sql); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE rowid=".$_GET["bid"]; + $result = $db->query($sql); } @@ -80,11 +79,11 @@ if ($_GET["action"] == 'del_bookmark') * Affichage page * */ -print_titre($langs->trans("AccountancyTreasuryArea")); +print_fiche_titre($langs->trans("AccountancyTreasuryArea")); -print '
'; +print '
'; -print '
'; +print '
'; /* * Zone recherche facture @@ -100,101 +99,114 @@ if ($conf->facture->enabled) { } -/* +/** * Factures brouillons */ if ($conf->facture->enabled && $user->rights->facture->lire) { - $sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp"; - $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE s.idp = f.fk_soc AND f.fk_statut = 0"; + $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom, s.idp"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; + $sql .= " WHERE s.idp = f.fk_soc AND f.fk_statut = 0"; - if ($socidp) + if ($socidp) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socidp"; } - $resql = $db->query($sql); + $resql = $db->query($sql); - if ( $resql ) + if ( $resql ) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + if ($num) + { + print ''; + print ''; + print ''; + $i = 0; + $tot_ttc = 0; + $var = True; + while ($i < $num && $i < 20) + { + $obj = $db->fetch_object($resql); + $var=!$var; + print ''; + print ''; + print ''; + print ''; + $tot_ttc+=$obj->total_ttc; + $i++; + } - if ($num) - { - print '
'.$langs->trans("DraftBills").' ('.$num.')
'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,24).''.price($obj->total_ttc).'
'; - print ''; - print ''; - $var = True; - while ($i < $num && $i < 20) - { - $obj = $db->fetch_object($resql); - $var=!$var; - print ''; - print ''; - $i++; - } + print ''; + print ''; + print ''; - print "
'.$langs->trans("DraftBills").' ('.$num.')
'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,24).'
'.$langs->trans("Total").''.price($tot_ttc).'

"; - } - $db->free($resql); + print "

"; + } + $db->free($resql); } - else + else { - dolibarr_print_error($db); + dolibarr_print_error($db); } } -if ($conf->compta->enabled) { - -/* +/** * Charges a payer */ -if ($user->societe_id == 0) +if ($conf->compta->enabled) { - - $sql = "SELECT c.amount, cc.libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as c, ".MAIN_DB_PREFIX."c_chargesociales as cc"; - $sql .= " WHERE c.fk_type = cc.id AND c.paye=0"; - - $resql = $db->query($sql); - - if ( $resql ) + if ($user->societe_id == 0) { - $num = $db->num_rows($resql); - if ($num) - { - print ''; - print ''; - print ''; - $i = 0; - $var = True; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var = !$var; - print ""; - print ''; - print ''; - print ''; - $i++; - } - print '
'.$langs->trans("ContributionsToPay").' ('.$num.')
'.$obj->libelle.''.price($obj->amount).'

'; - } - $db->free($resql); - } - else - { - dolibarr_print_error($db); + + $sql = "SELECT c.rowid, c.amount, cc.libelle"; + $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as c, ".MAIN_DB_PREFIX."c_chargesociales as cc"; + $sql .= " WHERE c.fk_type = cc.id AND c.paye=0"; + + $resql = $db->query($sql); + + if ( $resql ) + { + $num = $db->num_rows($resql); + if ($num) + { + print ''; + print ''; + print ''; + $i = 0; + $tot_ttc=0; + $var = True; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $var = !$var; + print ""; + print ''; + print ''; + print ''; + $tot_ttc+=$obj->amount; + $i++; + } + + print ''; + print ''; + print ''; + + print '
'.$langs->trans("ContributionsToPay").' ('.$num.')
'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->libelle.''.price($obj->amount).'
'.$langs->trans("Total").''.price($tot_ttc).'

'; + } + $db->free($resql); + } + else + { + dolibarr_print_error($db); + } } } -} - -/* +/** * Bookmark */ $sql = "SELECT s.idp, s.nom,b.rowid as bid"; @@ -231,7 +243,9 @@ else { dolibarr_print_error($db); } -print '
'; + + +print ''; /* @@ -270,8 +284,7 @@ if ($conf->commande->enabled && $user->rights->commande->lire) print ''.$langs->trans("ToBill").'
'.$propal->remise_percent.' %'.$propal->remise_percent.'%
  
"; print ''; print_liste_field_titre($langs->trans("Ref"),"propal.php","p.ref","","&year=$year&viewstatut=$viewstatut",'',$sortfield);