mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-08 18:48:22 +01:00
Library functions must be in lib directory
This commit is contained in:
@@ -158,7 +158,7 @@ print "<tr class=\"liste_titre\">";
|
|||||||
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"name","",'&year='.($year).'&modecompta='.$modecompta,"",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"name","",'&year='.($year).'&modecompta='.$modecompta,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"amount_ttc","",'&year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"amount_ttc","",'&year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Percentage"),$_SERVER["PHP_SELF"],"amount_ttc","",'&year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Percentage"),$_SERVER["PHP_SELF"],"amount_ttc","",'&year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2) print_liste_field_titre($langs->trans("OrderStats"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"');
|
if ($conf->commande->enabled && $conf->global->MAIN_FEATURES_LEVEL == 2) print_liste_field_titre($langs->trans("OrderStats"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ if (sizeof($amount))
|
|||||||
print "<td>".$linkname."</td>\n";
|
print "<td>".$linkname."</td>\n";
|
||||||
print '<td align="right">'.price($amount[$key]).'</td>';
|
print '<td align="right">'.price($amount[$key]).'</td>';
|
||||||
print '<td align="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal,2).'%' : ' ').'</td>';
|
print '<td align="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal,2).'%' : ' ').'</td>';
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2)
|
if ($conf->commande->enabled && $conf->global->MAIN_FEATURES_LEVEL == 2)
|
||||||
{
|
{
|
||||||
if($key>0){
|
if($key>0){
|
||||||
print '<td align="center"><a href="comm.php?id='.$key.'">'.img_picto($langs->trans("Show"),"vcard").'</a></td>';
|
print '<td align="center"><a href="comm.php?id='.$key.'">'.img_picto($langs->trans("Show"),"vcard").'</a></td>';
|
||||||
@@ -213,7 +213,7 @@ if (sizeof($amount))
|
|||||||
|
|
||||||
// Total
|
// Total
|
||||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.price($catotal).'</td><td> </td>';
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.price($catotal).'</td><td> </td>';
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2) print '<td> </td>';
|
if ($conf->commande->enabled && $conf->global->MAIN_FEATURES_LEVEL == 2) print '<td> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
|
|||||||
@@ -19,11 +19,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/comm/index.php
|
* \file htdocs/compta/stats/comm.php
|
||||||
\ingroup commercial
|
* \ingroup commercial
|
||||||
\brief Page acceuil de la zone commercial cliente
|
* \version $Id$
|
||||||
\version $Id$
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/dolgraph.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/dolgraph.class.php");
|
||||||
|
|||||||
@@ -15,106 +15,116 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*/
|
||||||
* $Id$
|
|
||||||
* $Source$
|
/**
|
||||||
*
|
* \file htdocs/compta/stats/comp.php
|
||||||
|
* \ingroup commercial
|
||||||
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require("./lib.inc.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/accountancy.lib.php");
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$socid = $user->societe_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function propals ($db, $year, $month) {
|
|
||||||
global $bc,$langs;
|
function propals ($db, $year, $month)
|
||||||
$sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
|
{
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
|
global $bc,$langs;
|
||||||
$sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
|
$sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
|
||||||
$sql .= " AND c.id in (1,2,4)";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
|
||||||
$sql .= " AND date_format(p.datep, '%Y') = ".$year;
|
$sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
|
||||||
$sql .= " AND round(date_format(p.datep, '%m')) = ".$month;
|
$sql .= " AND c.id in (1,2,4)";
|
||||||
|
$sql .= " AND date_format(p.datep, '%Y') = ".$year;
|
||||||
|
$sql .= " AND round(date_format(p.datep, '%m')) = ".$month;
|
||||||
|
|
||||||
|
|
||||||
$sql .= " ORDER BY p.fk_statut";
|
$sql .= " ORDER BY p.fk_statut";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||||
print "<tr class=\"liste_titre\"><td colspan=\"5\"><b>Propal</b></td></tr>";
|
print "<tr class=\"liste_titre\"><td colspan=\"5\"><b>Propal</b></td></tr>";
|
||||||
|
|
||||||
$oldstatut = -1;
|
$oldstatut = -1;
|
||||||
$subtotal = 0;
|
$subtotal = 0;
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
if ($objp->statut <> $oldstatut ) {
|
if ($objp->statut <> $oldstatut ) {
|
||||||
$oldstatut = $objp->statut;
|
$oldstatut = $objp->statut;
|
||||||
|
|
||||||
if ($i > 0) {
|
if ($i > 0) {
|
||||||
|
print "<tr><td align=\"right\" colspan=\"4\">".$langs->trans("Total").": <b>".price($subtotal)."</b></td>\n";
|
||||||
|
print "<td align=\"left\">".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
|
||||||
|
}
|
||||||
|
$subtotal = 0;
|
||||||
|
|
||||||
|
print "<tr class=\"liste_titre\">";
|
||||||
|
print "<td>Societe</td>";
|
||||||
|
print "<td>".$langs->trans("Ref")."</td>";
|
||||||
|
print "<td align=\"right\">Date</td>";
|
||||||
|
print "<td align=\"right\">".$langs->trans("Price")."</td>";
|
||||||
|
print "<td align=\"center\">".$langs->trans("Status")."</td>";
|
||||||
|
print "</tr>\n";
|
||||||
|
$var=True;
|
||||||
|
}
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
|
print "<td><a href=\"comp.php?socid=".$objp->socid."\">".$objp->nom."</a></td>\n";
|
||||||
|
|
||||||
|
print "<td><a href=\"".DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->propalid."\">".$objp->ref."</a></td>\n";
|
||||||
|
|
||||||
|
print "<td align=\"right\">".dolibarr_print_date($objp->dp)."</td>\n";
|
||||||
|
|
||||||
|
print "<td align=\"right\">".price($objp->price)."</td>\n";
|
||||||
|
print "<td align=\"center\">".$objp->statut."</td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$total = $total + $objp->price;
|
||||||
|
$subtotal = $subtotal + $objp->price;
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
print "<tr><td align=\"right\" colspan=\"4\">".$langs->trans("Total").": <b>".price($subtotal)."</b></td>\n";
|
print "<tr><td align=\"right\" colspan=\"4\">".$langs->trans("Total").": <b>".price($subtotal)."</b></td>\n";
|
||||||
print "<td align=\"left\">".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
|
print "<td align=\"left\">".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
|
||||||
}
|
print "<tr>";
|
||||||
$subtotal = 0;
|
print "<td colspan=\"3\" align=\"right\"><b>".$langs->trans("Total").": ".price($total)."</b></td>";
|
||||||
|
print "<td align=\"left\"><b>".$langs->trans("Currency".$conf->monnaie)."</b></td></tr>";
|
||||||
print "<tr class=\"liste_titre\">";
|
print "</table>";
|
||||||
print "<td>Societe</td>";
|
$db->free();
|
||||||
print "<td>".$langs->trans("Ref")."</td>";
|
|
||||||
print "<td align=\"right\">Date</td>";
|
|
||||||
print "<td align=\"right\">".$langs->trans("Price")."</td>";
|
|
||||||
print "<td align=\"center\">".$langs->trans("Status")."</td>";
|
|
||||||
print "</tr>\n";
|
|
||||||
$var=True;
|
|
||||||
}
|
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
|
|
||||||
print "<td><a href=\"comp.php?socid=".$objp->socid."\">".$objp->nom."</a></td>\n";
|
|
||||||
|
|
||||||
print "<td><a href=\"".DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->propalid."\">".$objp->ref."</a></td>\n";
|
|
||||||
|
|
||||||
print "<td align=\"right\">".dolibarr_print_date($objp->dp)."</td>\n";
|
|
||||||
|
|
||||||
print "<td align=\"right\">".price($objp->price)."</td>\n";
|
|
||||||
print "<td align=\"center\">".$objp->statut."</td>\n";
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$total = $total + $objp->price;
|
|
||||||
$subtotal = $subtotal + $objp->price;
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
print "<tr><td align=\"right\" colspan=\"4\">".$langs->trans("Total").": <b>".price($subtotal)."</b></td>\n";
|
|
||||||
print "<td align=\"left\">".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
|
|
||||||
print "<tr>";
|
|
||||||
print "<td colspan=\"3\" align=\"right\"><b>".$langs->trans("Total").": ".price($total)."</b></td>";
|
|
||||||
print "<td align=\"left\"><b>".$langs->trans("Currency".$conf->monnaie)."</b></td></tr>";
|
|
||||||
print "</table>";
|
|
||||||
$db->free();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function factures ($db, $year, $month, $paye) {
|
function factures ($db, $year, $month, $paye) {
|
||||||
global $bc,$conf;
|
global $bc,$conf;
|
||||||
|
|
||||||
$sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.total,".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid ";
|
$sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.total,".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid ";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql .= " WHERE f.fk_statut = 1";
|
$sql .= " WHERE f.fk_statut = 1";
|
||||||
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||||
$sql .= " AND f.paye = ".$paye;
|
$sql .= " AND f.paye = ".$paye;
|
||||||
}
|
}
|
||||||
$sql .= " AND f.fk_soc = s.rowid";
|
$sql .= " AND f.fk_soc = s.rowid";
|
||||||
$sql .= " AND date_format(f.datef, '%Y') = ".$year;
|
$sql .= " AND date_format(f.datef, '%Y') = ".$year;
|
||||||
$sql .= " AND round(date_format(f.datef, '%m')) = ".$month;
|
$sql .= " AND round(date_format(f.datef, '%m')) = ".$month;
|
||||||
$sql .= " ORDER BY f.datef DESC ";
|
$sql .= " ORDER BY f.datef DESC ";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
|
||||||
$num = $db->num_rows();
|
|
||||||
if ($num > 0)
|
|
||||||
{
|
{
|
||||||
|
$num = $db->num_rows();
|
||||||
|
if ($num > 0)
|
||||||
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
|
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
|
||||||
print "<tr class=\"liste_titre\"><td colspan=\"5\"><b>Factures</b></td></tr>";
|
print "<tr class=\"liste_titre\"><td colspan=\"5\"><b>Factures</b></td></tr>";
|
||||||
@@ -127,206 +137,200 @@ function factures ($db, $year, $month, $paye) {
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$var=True;
|
$var=True;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print "<td><a href=\"comp.php?socid=".$objp->socid."\">".$objp->nom."</a></td>\n";
|
print "<td><a href=\"comp.php?socid=".$objp->socid."\">".$objp->nom."</a></td>\n";
|
||||||
print "<td><a href=\"../facture.php?facid=".$objp->facid."\">".$objp->facnumber."</a></td>\n";
|
print "<td><a href=\"../facture.php?facid=".$objp->facid."\">".$objp->facnumber."</a></td>\n";
|
||||||
if ($objp->df > 0 )
|
if ($objp->df > 0 )
|
||||||
{
|
{
|
||||||
print "<td align=\"right\">".dolibarr_print_date($objp->df)."</td>\n";
|
print "<td align=\"right\">".dolibarr_print_date($objp->df)."</td>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td align=\"right\"><b>!!!</b></td>\n";
|
print "<td align=\"right\"><b>!!!</b></td>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<td align=\"right\">".price($objp->total)."</td>\n";
|
print "<td align=\"right\">".price($objp->total)."</td>\n";
|
||||||
|
|
||||||
$payes[1] = "oui";
|
$payes[1] = "oui";
|
||||||
$payes[0] = "<b>non</b>";
|
$payes[0] = "<b>non</b>";
|
||||||
|
|
||||||
print "<td align=\"right\">".$payes[$objp->paye]."</td>\n";
|
print "<td align=\"right\">".$payes[$objp->paye]."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$total = $total + $objp->total;
|
$total = $total + $objp->total;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print "<tr><td colspan=\"4\" align=\"right\">";
|
print "<tr><td colspan=\"4\" align=\"right\">";
|
||||||
print "<b>Total : ".price($total)."</b></td><td></td></tr>";
|
print "<b>Total : ".price($total)."</b></td><td></td></tr>";
|
||||||
print "</table>";
|
print "</table>";
|
||||||
$db->free();
|
$db->free();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $db->error();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $db->error();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function pt ($db, $sql, $year) {
|
function pt ($db, $sql, $year)
|
||||||
global $bc, $langs;
|
{
|
||||||
|
global $bc, $langs;
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
$i = 0; $total = 0 ;
|
$i = 0; $total = 0 ;
|
||||||
print '<table class="border" width="100%" cellspacing="0" cellpadding="3">';
|
print '<table class="border" width="100%" cellspacing="0" cellpadding="3">';
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print '<td>'.$langs->trans("Month").'</td>';
|
print '<td>'.$langs->trans("Month").'</td>';
|
||||||
print "<td align=\"right\">Montant</td></tr>\n";
|
print "<td align=\"right\">Montant</td></tr>\n";
|
||||||
$var=True;
|
$var=True;
|
||||||
$month = 1 ;
|
$month = 1 ;
|
||||||
|
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
if ($obj->dm > $month ) {
|
if ($obj->dm > $month ) {
|
||||||
for ($b = $month ; $b < $obj->dm ; $b++) {
|
for ($b = $month ; $b < $obj->dm ; $b++) {
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print "<td>".dolibarr_print_date(dolibarr_mktime(12,0,0,$b, 1, $year),"%b")."</td>\n";
|
print "<td>".dolibarr_print_date(dolibarr_mktime(12,0,0,$b, 1, $year),"%b")."</td>\n";
|
||||||
print "<td align=\"right\">0</td>\n";
|
print "<td align=\"right\">0</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$ca[$b] = 0;
|
$ca[$b] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($obj->sum > 0) {
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print "<td><a href=\"comp.php?details=1&year=$year&month=$obj->dm\">";
|
||||||
|
print dolibarr_print_date(dolibarr_mktime(12,0,0,$obj->dm, 1, $year),"%b")."</td>\n";
|
||||||
|
print "<td align=\"right\">".price($obj->sum)."</td>\n";
|
||||||
|
|
||||||
|
print "</TR>\n";
|
||||||
|
$month = $obj->dm + 1;
|
||||||
|
$ca[$obj->dm] = $obj->sum;
|
||||||
|
$total = $total + $obj->sum;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($num) {
|
||||||
|
$beg = $obj->dm;
|
||||||
|
} else {
|
||||||
|
$beg = 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($beg <= 12 ) {
|
||||||
|
for ($b = $beg + 1 ; $b < 13 ; $b++) {
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print "<td>".dolibarr_print_date(dolibarr_mktime(12,0,0,$b, 1, $year),"%b")."</td>\n";
|
||||||
|
print "<td align=\"right\">0</td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
$ca[$b] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr class=\"total\"><td align=\"right\">Total :</td><td align=\"right\"><b>".price($total)."</b></td></tr>";
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
$db->free();
|
||||||
|
return $ca;
|
||||||
|
} else {
|
||||||
|
print $db->error();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($obj->sum > 0) {
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print "<td><a href=\"comp.php?details=1&year=$year&month=$obj->dm\">";
|
|
||||||
print dolibarr_print_date(dolibarr_mktime(12,0,0,$obj->dm, 1, $year),"%b")."</td>\n";
|
|
||||||
print "<td align=\"right\">".price($obj->sum)."</td>\n";
|
|
||||||
|
|
||||||
print "</TR>\n";
|
|
||||||
$month = $obj->dm + 1;
|
|
||||||
$ca[$obj->dm] = $obj->sum;
|
|
||||||
$total = $total + $obj->sum;
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($num) {
|
|
||||||
$beg = $obj->dm;
|
|
||||||
} else {
|
|
||||||
$beg = 0 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($beg <= 12 ) {
|
|
||||||
for ($b = $beg + 1 ; $b < 13 ; $b++) {
|
|
||||||
$var=!$var;
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print "<td>".dolibarr_print_date(dolibarr_mktime(12,0,0,$b, 1, $year),"%b")."</td>\n";
|
|
||||||
print "<td align=\"right\">0</td>\n";
|
|
||||||
print "</tr>\n";
|
|
||||||
$ca[$b] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print "<tr class=\"total\"><td align=\"right\">Total :</td><td align=\"right\"><b>".price($total)."</b></td></tr>";
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
$db->free();
|
|
||||||
return $ca;
|
|
||||||
} else {
|
|
||||||
print $db->error();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ppt ($db, $year, $socid)
|
function ppt ($db, $year, $socid)
|
||||||
{
|
{
|
||||||
global $bc,$conf,$langs;
|
global $bc,$conf,$langs;
|
||||||
print "<table width=\"100%\">";
|
print "<table width=\"100%\">";
|
||||||
|
|
||||||
print '<tr class="liste_titre"><td align="center" valign="top" width="30%">';
|
print '<tr class="liste_titre"><td align="center" valign="top" width="30%">';
|
||||||
print "CA Pr<50>visionnel bas<61> sur les propal $year";
|
print "CA Pr<50>visionnel bas<61> sur les propal $year";
|
||||||
|
|
||||||
print "</td><td align=\"center\" valign=\"top\">CA R<>alis<69> $year</td>";
|
|
||||||
print "<td align=\"center\" valign=\"top\">Delta $year</td></tr>";
|
|
||||||
|
|
||||||
print '<tr><td valign="top" align="center" width="30%">';
|
|
||||||
|
|
||||||
$sql = "SELECT sum(f.price) as sum, round(date_format(f.datep,'%m')) as dm";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep,'%Y') = $year ";
|
|
||||||
|
|
||||||
if ($socid)
|
print "</td><td align=\"center\" valign=\"top\">CA R<>alis<69> $year</td>";
|
||||||
{
|
print "<td align=\"center\" valign=\"top\">Delta $year</td></tr>";
|
||||||
$sql .= " AND f.fk_soc = $socid";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= " GROUP BY dm";
|
print '<tr><td valign="top" align="center" width="30%">';
|
||||||
|
|
||||||
$prev = pt($db, $sql, $year);
|
|
||||||
|
|
||||||
print "</td><td valign=\"top\" width=\"30%\">";
|
|
||||||
|
|
||||||
$sql = "SELECT sum(f.total) as sum, round(date_format(f.datef, '%m')) as dm";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
|
||||||
$sql .= " WHERE f.fk_statut in (1,2)";
|
|
||||||
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
|
||||||
$sql .= " AND f.paye = 1";
|
|
||||||
}
|
|
||||||
$sql .= " AND date_format(f.datef,'%Y') = $year ";
|
|
||||||
if ($socid)
|
|
||||||
{
|
|
||||||
$sql .= " AND f.fk_soc = $socid";
|
|
||||||
}
|
|
||||||
$sql .= " GROUP BY dm";
|
|
||||||
|
|
||||||
$ca = pt($db, $sql, $year);
|
|
||||||
|
|
||||||
print "</td><td valign=\"top\" width=\"30%\">";
|
|
||||||
|
|
||||||
print '<table class="border" width="100%" cellspacing="0" cellpadding="3">';
|
|
||||||
print "<tr class=\"liste_titre\">";
|
|
||||||
print '<td>'.$langs->trans("Month").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$var = 1 ;
|
$sql = "SELECT sum(f.price) as sum, round(date_format(f.datep,'%m')) as dm";
|
||||||
for ($b = 1 ; $b <= 12 ; $b++)
|
$sql .= " FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep,'%Y') = $year ";
|
||||||
{
|
|
||||||
$var=!$var;
|
|
||||||
|
|
||||||
$delta = $ca[$b] - $prev[$b];
|
if ($socid)
|
||||||
$deltat = $deltat + $delta ;
|
{
|
||||||
print "<tr $bc[$var]>";
|
$sql .= " AND f.fk_soc = $socid";
|
||||||
print "<td>".dolibarr_print_date(dolibarr_mktime(12,0,0,$b, 1, $year),"%b")."</td>\n";
|
}
|
||||||
print "<td align=\"right\">".price($delta)."</td>\n";
|
|
||||||
print "</tr>\n";
|
$sql .= " GROUP BY dm";
|
||||||
}
|
|
||||||
|
$prev = pt($db, $sql, $year);
|
||||||
$ayear = $year - 1;
|
|
||||||
$acat = get_ca($db, $ayear, $socid) - get_ca_propal($db, $ayear, $socid);
|
print "</td><td valign=\"top\" width=\"30%\">";
|
||||||
|
|
||||||
|
$sql = "SELECT sum(f.total) as sum, round(date_format(f.datef, '%m')) as dm";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
|
$sql .= " WHERE f.fk_statut in (1,2)";
|
||||||
|
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||||
|
$sql .= " AND f.paye = 1";
|
||||||
|
}
|
||||||
|
$sql .= " AND date_format(f.datef,'%Y') = $year ";
|
||||||
|
if ($socid)
|
||||||
|
{
|
||||||
|
$sql .= " AND f.fk_soc = $socid";
|
||||||
|
}
|
||||||
|
$sql .= " GROUP BY dm";
|
||||||
|
|
||||||
|
$ca = pt($db, $sql, $year);
|
||||||
|
|
||||||
|
print "</td><td valign=\"top\" width=\"30%\">";
|
||||||
|
|
||||||
|
print '<table class="border" width="100%" cellspacing="0" cellpadding="3">';
|
||||||
|
print "<tr class=\"liste_titre\">";
|
||||||
|
print '<td>'.$langs->trans("Month").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$var = 1 ;
|
||||||
|
for ($b = 1 ; $b <= 12 ; $b++)
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
|
||||||
|
$delta = $ca[$b] - $prev[$b];
|
||||||
|
$deltat = $deltat + $delta ;
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print "<td>".dolibarr_print_date(dolibarr_mktime(12,0,0,$b, 1, $year),"%b")."</td>\n";
|
||||||
|
print "<td align=\"right\">".price($delta)."</td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$ayear = $year - 1;
|
||||||
|
$acat = get_ca($db, $ayear, $socid) - get_ca_propal($db, $ayear, $socid);
|
||||||
|
|
||||||
|
|
||||||
print "<tr class=\"total\"><td align=\"right\">Total :</td><td align=\"right\">".price($deltat)."</td></tr>";
|
print "<tr class=\"total\"><td align=\"right\">Total :</td><td align=\"right\">".price($deltat)."</td></tr>";
|
||||||
print "<tr class=\"total\"><td align=\"right\">Rappel $ayear :</td><td align=\"right\">".price($acat)."</td></tr>";
|
print "<tr class=\"total\"><td align=\"right\">Rappel $ayear :</td><td align=\"right\">".price($acat)."</td></tr>";
|
||||||
print "<tr class=\"total\"><td align=\"right\">Soit :</td><td align=\"right\"><b>".price($acat+$deltat)."</b></td></tr>";
|
print "<tr class=\"total\"><td align=\"right\">Soit :</td><td align=\"right\"><b>".price($acat+$deltat)."</b></td></tr>";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "</td></tr></table>";
|
print "</td></tr></table>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
/*
|
|
||||||
* S<>curit<69> acc<63>s client
|
|
||||||
*/
|
|
||||||
if ($user->societe_id > 0)
|
|
||||||
{
|
|
||||||
$socid = $user->societe_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cyear = isset($_GET["year"])?$_GET["year"]:0;
|
$cyear = isset($_GET["year"])?$_GET["year"]:0;
|
||||||
if (! $cyear) { $cyear = strftime ("%Y", time()); }
|
if (! $cyear) { $cyear = strftime ("%Y", time()); }
|
||||||
@@ -337,14 +341,14 @@ ppt($db, $cyear, $socid);
|
|||||||
|
|
||||||
if ($details == 1)
|
if ($details == 1)
|
||||||
{
|
{
|
||||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr><td valign=\"top\" width=\"50%\">";
|
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr><td valign=\"top\" width=\"50%\">";
|
||||||
factures ($db, $year, $month, 1);
|
factures ($db, $year, $month, 1);
|
||||||
print "</td><td valign=\"top\" width=\"50%\">";
|
print "</td><td valign=\"top\" width=\"50%\">";
|
||||||
propals ($db, $year, $month);
|
propals ($db, $year, $month);
|
||||||
print "</td></tr></table>";
|
print "</td></tr></table>";
|
||||||
}
|
}
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
llxFooter('$Date$ - $Revision$');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -503,9 +503,9 @@ class MenuLeft {
|
|||||||
// Compta simple
|
// Compta simple
|
||||||
if ($conf->compta->enabled)
|
if ($conf->compta->enabled)
|
||||||
{
|
{
|
||||||
$newmenu->add(DOL_URL_ROOT."/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Ventilation"),0,$user->rights->compta->ventilation->lire);
|
$newmenu->add(DOL_URL_ROOT."/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Dispatch"),0,$user->rights->compta->ventilation->lire);
|
||||||
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/ventilation/liste.php",$langs->trans("A ventiler"),1,$user->rights->compta->ventilation->lire);
|
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/ventilation/liste.php",$langs->trans("ToDispatch"),1,$user->rights->compta->ventilation->lire);
|
||||||
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/ventilation/lignes.php",$langs->trans("Ventil<EFBFBD>es"),1,$user->rights->compta->ventilation->lire);
|
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/ventilation/lignes.php",$langs->trans("Dispatched"),1,$user->rights->compta->ventilation->lire);
|
||||||
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/",$langs->trans("Setup"),1,$user->rights->compta->ventilation->parametrer);
|
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/",$langs->trans("Setup"),1,$user->rights->compta->ventilation->parametrer);
|
||||||
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/comptes/fiche.php?action=create",$langs->trans("New"),2,$user->rights->compta->ventilation->parametrer);
|
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/comptes/fiche.php?action=create",$langs->trans("New"),2,$user->rights->compta->ventilation->parametrer);
|
||||||
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/comptes/liste.php",$langs->trans("List"),2,$user->rights->compta->ventilation->parametrer);
|
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/comptes/liste.php",$langs->trans("List"),2,$user->rights->compta->ventilation->parametrer);
|
||||||
|
|||||||
@@ -484,9 +484,9 @@ class MenuLeft {
|
|||||||
/*
|
/*
|
||||||
if ($conf->compta->enabled)
|
if ($conf->compta->enabled)
|
||||||
{
|
{
|
||||||
$newmenu->add(DOL_URL_ROOT."/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Ventilation"),0,$user->rights->compta->ventilation->lire);
|
$newmenu->add(DOL_URL_ROOT."/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Dispatch"),0,$user->rights->compta->ventilation->lire);
|
||||||
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/ventilation/liste.php",$langs->trans("A ventiler"),1,$user->rights->compta->ventilation->lire);
|
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/ventilation/liste.php",$langs->trans("ToDispatch"),1,$user->rights->compta->ventilation->lire);
|
||||||
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/ventilation/lignes.php",$langs->trans("Ventil<EFBFBD>es"),1,$user->rights->compta->ventilation->lire);
|
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/ventilation/lignes.php",$langs->trans("Dispatched"),1,$user->rights->compta->ventilation->lire);
|
||||||
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/",$langs->trans("Setup"),1,$user->rights->compta->ventilation->parametrer);
|
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/",$langs->trans("Setup"),1,$user->rights->compta->ventilation->parametrer);
|
||||||
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/comptes/fiche.php?action=create",$langs->trans("New"),2,$user->rights->compta->ventilation->parametrer);
|
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/comptes/fiche.php?action=create",$langs->trans("New"),2,$user->rights->compta->ventilation->parametrer);
|
||||||
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/comptes/liste.php",$langs->trans("List"),2,$user->rights->compta->ventilation->parametrer);
|
if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/comptes/liste.php",$langs->trans("List"),2,$user->rights->compta->ventilation->parametrer);
|
||||||
|
|||||||
@@ -98,4 +98,7 @@ SeeVATReportInDueDebtMode=Voir le rapport <b>%sTVA sur d
|
|||||||
RulesVATIn=- Pour les services, le rapport inclut les TVA des r<>glements effectivement re<72>us ou <20>mis en se basant sur la date du r<>glement.<br>- Pour les biens mat<61>riels, il inclut les TVA des factures en se basant sur la date de validation de la facture.
|
RulesVATIn=- Pour les services, le rapport inclut les TVA des r<>glements effectivement re<72>us ou <20>mis en se basant sur la date du r<>glement.<br>- Pour les biens mat<61>riels, il inclut les TVA des factures en se basant sur la date de validation de la facture.
|
||||||
RulesVATDue=- Pour les services, le rapport inclut les TVA des factures dues, pay<61>es ou non en se basant sur la date de validation de ces factures.<br>- Pour les biens mat<61>riels, il inclut les TVA des factures en se basant sur la date de validation de la facture.
|
RulesVATDue=- Pour les services, le rapport inclut les TVA des factures dues, pay<61>es ou non en se basant sur la date de validation de ces factures.<br>- Pour les biens mat<61>riels, il inclut les TVA des factures en se basant sur la date de validation de la facture.
|
||||||
OptionVatInfoModuleComptabilite=Remarque : Pour les biens mat<61>riels, il faudrait utiliser la date de livraison pour <20>tre plus juste.
|
OptionVatInfoModuleComptabilite=Remarque : Pour les biens mat<61>riels, il faudrait utiliser la date de livraison pour <20>tre plus juste.
|
||||||
PercentOfInvoice=%%/invoice
|
PercentOfInvoice=%%/invoice
|
||||||
|
Dispatch=Dispatching
|
||||||
|
Dispatched=Dispatched
|
||||||
|
ToDispatch=To dispatch
|
||||||
@@ -99,4 +99,7 @@ RulesVATIn=- Pour les services, le rapport inclut les TVA des r
|
|||||||
RulesVATDue=- Pour les services, le rapport inclut les TVA des factures dues, pay<61>es ou non en se basant sur la date de validation de ces factures.<br>- Pour les biens mat<61>riels, il inclut les TVA des factures en se basant sur la date de validation de la facture.
|
RulesVATDue=- Pour les services, le rapport inclut les TVA des factures dues, pay<61>es ou non en se basant sur la date de validation de ces factures.<br>- Pour les biens mat<61>riels, il inclut les TVA des factures en se basant sur la date de validation de la facture.
|
||||||
OptionVatInfoModuleComptabilite=Remarque : Pour les biens mat<61>riels, il faudrait utiliser la date de livraison pour <20>tre plus juste.
|
OptionVatInfoModuleComptabilite=Remarque : Pour les biens mat<61>riels, il faudrait utiliser la date de livraison pour <20>tre plus juste.
|
||||||
PercentOfInvoice=%%/facture
|
PercentOfInvoice=%%/facture
|
||||||
OrderStats=Statistiques sur les commandes
|
OrderStats=Statistiques sur les commandes
|
||||||
|
Dispatch=Ventilation
|
||||||
|
Dispatched=Ventil<69>s
|
||||||
|
ToDispatch=A ventiler
|
||||||
@@ -15,11 +15,15 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/lib/accountancy.lib.php
|
||||||
|
* \brief Library of accountancy functions
|
||||||
|
* \version $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
function get_ca_propal ($db, $year, $socid)
|
function get_ca_propal ($db, $year, $socid)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/lib/admin.lib.php
|
* \file htdocs/lib/admin.lib.php
|
||||||
\brief Library of admin functions
|
* \brief Library of admin functions
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user