diff --git a/ChangeLog b/ChangeLog
index 429650dea7d..c7defe5f444 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.0 compared to 2.9 *****
For users:
+- New: Add Sales journal and Purchase journal report.
- New: Can create supplier invoice from supplier order.
New: Support login by openid
- New: Support "full day" event in calendar module.
diff --git a/htdocs/compta/journaux/index.php b/htdocs/compta/journal/index.php
old mode 100644
new mode 100755
similarity index 100%
rename from htdocs/compta/journaux/index.php
rename to htdocs/compta/journal/index.php
diff --git a/htdocs/compta/journaux/journalachat.php b/htdocs/compta/journal/purchasesjournal.php
old mode 100644
new mode 100755
similarity index 75%
rename from htdocs/compta/journaux/journalachat.php
rename to htdocs/compta/journal/purchasesjournal.php
index d76f1a8e2a2..64283e31143
--- a/htdocs/compta/journaux/journalachat.php
+++ b/htdocs/compta/journal/purchasesjournal.php
@@ -66,10 +66,10 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$date_start=dol_get_first_day($year_current,$pastmonth,false); $date_end=dol_get_last_day($year_current,$pastmonth,false);
}
-$nom=$langs->trans("JournalAchat");
+$nom=$langs->trans("PurchasesJournal");
//$nomlink=;
$builddate=time();
-$description=$langs->trans("DescJournalAchat");
+$description=$langs->trans("DescPurchasesJournal");
$period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1);
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
@@ -92,9 +92,9 @@ if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start
{
$num = $db->num_rows($result);
// les variables
- $cptfour = isset($conf->global->COMPTA_ACCOUNT_SUPPLIER)?$conf->global->COMPTA_ACCOUNT_SUPPLIER:$langs->trans("CodeNotDef");
- $cpttva = isset($conf->global->COMPTA_VAT_ACCOUNT)?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef");
-
+ $cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER))?$conf->global->COMPTA_ACCOUNT_SUPPLIER:$langs->trans("CodeNotDef");
+ $cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT))?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef");
+
$tabfac = array();
$tabht = array();
$tabtva = array();
@@ -105,14 +105,14 @@ if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start
{
$obj = $db->fetch_object($result);
// contrôles
- $compta_soc = isset($obj->code_compta_fournisseur)?$obj->code_compta_fournisseur:$cptfour;
+ $compta_soc = (! empty($obj->code_compta_fournisseur))?$obj->code_compta_fournisseur:$cptfour;
$compta_prod = $obj->accountancy_code_buy;
- if (!isset($compta_prod) || empty($compta_prod))
+ if (empty($compta_prod))
{
- if($obj->product_type == 0) $compta_prod = isset($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT)?$conf->global->COMPTA_PRODUCT_BUY_ACCOUNT:$langs->trans("CodeNotDef") ;
- else $compta_prod = isset($conf->global->COMPTA_SERVICE_BUY_ACCOUNT)?$conf->global->COMPTA_SERVICE_BUY_ACCOUNT:$langs->trans("CodeNotDef") ;
+ if($obj->product_type == 0) $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT))?$conf->global->COMPTA_PRODUCT_BUY_ACCOUNT:$langs->trans("CodeNotDef") ;
+ else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT))?$conf->global->COMPTA_SERVICE_BUY_ACCOUNT:$langs->trans("CodeNotDef") ;
}
- $compta_tva = isset($obj->accountancy_code)?$obj->accountancy_code:$cpttva;
+ $compta_tva = (! empty($obj->accountancy_code))?$obj->accountancy_code:$cpttva;
$tabfac[$obj->rowid]["date"] = $obj->datef;
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
@@ -121,8 +121,8 @@ if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
-
- $i++;
+
+ $i++;
}
}
else {
@@ -135,9 +135,12 @@ if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start
$i = 0;
print "
";
print "";
-print "| ".$langs->trans("JournalNum")." | ".$langs->trans("Invoicedate")." | ".$langs->trans("InvoiceRef")." | ";
-print "".$langs->trans("Piece")." | ".$langs->trans("Account")." | ";
-print "".$langs->trans("InvoiceLib")." | ".$langs->trans("AmountDbt")." | ".$langs->trans("AmountCdt")." | ";
+///print "".$langs->trans("JournalNum")." | ";
+print "".$langs->trans("Date")." | ";
+print "".$langs->trans("InvoiceRef")." | ";
+print "".$langs->trans("Piece")." | ";
+print "".$langs->trans("Account")." | ";
+print "".$langs->trans("Label")." | ".$langs->trans("Debit")." | ".$langs->trans("Credit")." | ";
print "
\n";
$var=true;
@@ -147,7 +150,9 @@ foreach ($tabfac as $key => $val)
{
print "";
//facture
- print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ".$val["date"]." | ".$val["ref"]." | ".$val["piece"]." | ";
+ //print "".$conf->global->COMPTA_JOURNAL_BUY." | ";
+ print "".$val["date"]." | ".$val["ref"]." | ";
+ print "".$val["piece"]." | ";
foreach ($tabttc[$key] as $k => $mt)
{
print "".$k." | ".$val["lib"]." | ".$mt." | | ";
@@ -156,28 +161,34 @@ foreach ($tabfac as $key => $val)
// produit
foreach ($tabht[$key] as $k => $mt)
{
- print "
| ".$conf->global->COMPTA_JOURNAL_BUY." | ".$val["date"]." | ".$val["ref"]." | ".$val["piece"]." | ";
+ print "
";
+ //print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ";
+ print "".$val["date"]." | ".$val["ref"]." | ";
+ print "".$val["piece"]." | ";
print "".$k." | ".$val["lib"]." | | ".$mt." |
";
}
// tva
foreach ($tabtva[$key] as $k => $mt)
{
- print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ".$val["date"]." | ".$val["ref"]." | ".$val["piece"]." | ";
+ print "
";
+ //print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ";
+ print "".$val["date"]." | ".$val["ref"]." | ";
+ print "".$val["piece"]." | ";
print "".$k." | ".$val["lib"]." | | ".$mt." |
";
}
-
+
$val = !$val;
}
print "
";
-
+
/***************************************************
* LINKED OBJECT BLOCK
*
* Put here code to view linked object
****************************************************/
/*
-
+
$myobject->load_object_linked($myobject->id,$myobject->element);
foreach($myobject->linked_object as $linked_object => $linked_objectid)
diff --git a/htdocs/compta/journaux/journalvente.php b/htdocs/compta/journal/sellsjournal.php
old mode 100644
new mode 100755
similarity index 75%
rename from htdocs/compta/journaux/journalvente.php
rename to htdocs/compta/journal/sellsjournal.php
index 96a3ffd0a65..3b70e692af6
--- a/htdocs/compta/journaux/journalvente.php
+++ b/htdocs/compta/journal/sellsjournal.php
@@ -65,20 +65,20 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$date_start=dol_get_first_day($year_current,$pastmonth,false); $date_end=dol_get_last_day($year_current,$pastmonth,false);
}
-$nom=$langs->trans("JournalVente");
+$nom=$langs->trans("SellsJournal");
//$nomlink=;
$builddate=time();
-$description=$langs->trans("DescJournalvente");
+$description=$langs->trans("DescSellsJournal");
$period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1);
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS);
$idpays = $p[0];
-$sql = "SELECT f.rowid, f.facnumber, f.datef, f.ref_client , fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx ";
+$sql = "SELECT f.rowid, f.facnumber, f.datef, f.ref_client , fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx ";
$sql .= " , fd.total_ttc,p.accountancy_code_sell, s.code_compta , ct.accountancy_code";
-$sql .= " FROM ".MAIN_DB_PREFIX."facturedet fd ";
-$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product ";
+$sql .= " FROM ".MAIN_DB_PREFIX."facturedet fd ";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product ";
$sql .= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture ";
$sql .= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'";
@@ -93,7 +93,7 @@ if ($result)
$tabht = array();
$tabtva = array();
$tabttc = array();
-
+
$num = $db->num_rows($result);
$i=0;
$resligne=array();
@@ -101,17 +101,17 @@ if ($result)
{
$obj = $db->fetch_object($result);
// les variables
- $cptcli = isset($conf->global->COMPTA_ACCOUNT_CUSTOMER)?$conf->global->COMPTA_ACCOUNT_CUSTOMER:$langs->trans("CodeNotDef");
- $compta_soc = isset($obj->code_compta)?$obj->code_compta:$cptcli;
+ $cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER))?$conf->global->COMPTA_ACCOUNT_CUSTOMER:$langs->trans("CodeNotDef");
+ $compta_soc = (! empty($obj->code_compta))?$obj->code_compta:$cptcli;
$compta_prod = $obj->accountancy_code_sell;
- if (!isset($compta_prod))
+ if (empty($compta_prod))
{
- if($obj->product_type == 0) $compta_prod = isset($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT)?$conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT:$langs->trans("CodeNotDef") ;
- else $compta_prod = isset($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT)?$conf->global->COMPTA_SERVICE_SOLD_ACCOUNT:$langs->trans("CodeNotDef") ;
- }
- $cpttva = isset($conf->global->COMPTA_VAT_ACCOUNT)?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef");
- $compta_tva = isset($obj->accountancy_code)?$obj->accountancy_code:$cpttva;
-
+ if($obj->product_type == 0) $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT))?$conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT:$langs->trans("CodeNotDef") ;
+ else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT))?$conf->global->COMPTA_SERVICE_SOLD_ACCOUNT:$langs->trans("CodeNotDef") ;
+ }
+ $cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT))?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef");
+ $compta_tva = (! empty($obj->accountancy_code))?$obj->accountancy_code:$cpttva;
+
//la ligne facture
$tabfac[$obj->rowid]["date"] = $obj->datef;
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
@@ -120,7 +120,7 @@ if ($result)
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
-
+
$i++;
}
}
@@ -128,18 +128,19 @@ else {
dol_print_error($db);
}
-
+
/*
* Show result array
*/
-
-
+
+
$i = 0;
print "";
print "";
-print "| ".$langs->trans("JournalNum")." | ".$langs->trans("Invoicedate")." | ".$langs->trans("InvoiceRef")." | ";
+//print "".$langs->trans("JournalNum")." | ";
+print "".$langs->trans("Date")." | ".$langs->trans("InvoiceRef")." | ";
print "".$langs->trans("Piece")." | ".$langs->trans("Account")." | ";
-print "".$langs->trans("InvoiceLib")." | ".$langs->trans("AmountDbt")." | ".$langs->trans("AmountCdt")." | ";
+print "".$langs->trans("Label")." | ".$langs->trans("Debit")." | ".$langs->trans("Credit")." | ";
print "
\n";
$var=true;
@@ -149,7 +150,9 @@ foreach ($tabfac as $key => $val)
{
print "";
//facture
- print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ".$val["date"]." | ".$val["ref"]." | ".$val["piece"]." | ";
+ //print "".$conf->global->COMPTA_JOURNAL_SELL." | ";
+ print "".$val["date"]." | ".$val["ref"]." | ";
+ print "".$val["piece"]." | ";
foreach ($tabttc[$key] as $k => $mt)
{
print "".$k." | ".$val["lib"]." | ".$mt." | | ";
@@ -158,16 +161,22 @@ foreach ($tabfac as $key => $val)
// produit
foreach ($tabht[$key] as $k => $mt)
{
- print "
| ".$conf->global->COMPTA_JOURNAL_SELL." | ".$val["date"]." | ".$val["ref"]." | ".$val["piece"]." | ";
+ print "
";
+ //print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ";
+ print "".$val["date"]." | ".$val["ref"]." | ";
+ print "".$val["piece"]." | ";
print "".$k." | ".$val["lib"]." | | ".$mt." |
";
}
// tva
foreach ($tabtva[$key] as $k => $mt)
{
- print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ".$val["date"]." | ".$val["ref"]." | ".$val["piece"]." | ";
+ print "
";
+ //print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ";
+ print "".$val["date"]." | ".$val["ref"]." | ";
+ print "".$val["piece"]." | ";
print "".$k." | ".$val["lib"]." | | ".$mt." |
";
}
-
+
$val = !$val;
}
@@ -179,7 +188,7 @@ print "
";
* Put here code to view linked object
****************************************************/
/*
-
+
$myobject->load_object_linked($myobject->id,$myobject->element);
foreach($myobject->linked_object as $linked_object => $linked_objectid)
diff --git a/htdocs/includes/menus/standard/eldy.lib.php b/htdocs/includes/menus/standard/eldy.lib.php
index 2fe371476e2..720356d2032 100644
--- a/htdocs/includes/menus/standard/eldy.lib.php
+++ b/htdocs/includes/menus/standard/eldy.lib.php
@@ -987,32 +987,34 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
// Rapports
if ($conf->compta->enabled || $conf->accounting->enabled)
{
+ $langs->load("compta");
+
// Bilan, resultats
$newmenu->add(DOL_URL_ROOT."/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy",$langs->trans("Reportings"),0,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/resultat/index.php?leftmenu=ca",$langs->trans("ReportInOut"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/resultat/clientfourn.php?leftmenu=ca",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
- /* On verra ca avec module compabilit� expert
- if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/resultat/compteres.php?leftmenu=ca","Compte de r�sultat",2,$user->rights->compta->resultat->lire);
+ /* On verra ca avec module compabilite expert
+ if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/resultat/compteres.php?leftmenu=ca","Compte de resultat",2,$user->rights->compta->resultat->lire);
if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/resultat/bilan.php?leftmenu=ca","Bilan",2,$user->rights->compta->resultat->lire);
*/
if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/stats/index.php?leftmenu=ca",$langs->trans("ReportTurnover"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
/*
- if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/stats/cumul.php?leftmenu=ca","Cumul�",2,$user->rights->compta->resultat->lire);
+ if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/stats/cumul.php?leftmenu=ca","Cumule",2,$user->rights->compta->resultat->lire);
if ($conf->propal->enabled) {
- if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/stats/prev.php?leftmenu=ca","Pr�visionnel",2,$user->rights->compta->resultat->lire);
- if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/stats/comp.php?leftmenu=ca","Transform�",2,$user->rights->compta->resultat->lire);
+ if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/stats/prev.php?leftmenu=ca","Previsionnel",2,$user->rights->compta->resultat->lire);
+ if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/stats/comp.php?leftmenu=ca","Transforme",2,$user->rights->compta->resultat->lire);
}
*/
if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/stats/casoc.php?leftmenu=ca",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/stats/cabyuser.php?leftmenu=ca",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
// Journaux
- if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
+ //if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
//journaux
- if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/journaux/journalvente.php?leftmenu=ca",$langs->trans("JournalVente"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
- if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/journaux/journalachat.php?leftmenu=ca",$langs->trans("JournalAchat"),2,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
+ if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/journal/sellsjournal.php?leftmenu=ca",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
+ if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/journal/purchasesjournal.php?leftmenu=ca",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
}
}
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index 3d31bb2ec05..8ceda551c19 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -121,5 +121,6 @@ SellsJournal=Sales Journal
PurchasesJournal=Purchases Journal
DescSellsJournal=Sales Journal
DescPurchasesJournal=Purchases Journal
+InvoiceRef=Invoice ref.
CodeNotDef=Not defined
diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang
index 25855f98686..2648acd4e80 100644
--- a/htdocs/langs/fr_FR/compta.lang
+++ b/htdocs/langs/fr_FR/compta.lang
@@ -121,7 +121,7 @@ ThirdPartyMustBeEditAsCustomer=Le tiers doit être défini comme client
SellsJournal=Journal des ventes
PurchasesJournal=Journal des achats
Journaux=Journaux
-InvoiceRef=Référence Fourn.
+InvoiceRef=Réf facture
Piece=Piece compta
DescSellsJournal=Journal des ventes
DescPurchasesJournal=Journal des achats