diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php
index eed1479ab0a..2beadebf46c 100644
--- a/htdocs/accountancy/expensereport/list.php
+++ b/htdocs/accountancy/expensereport/list.php
@@ -200,7 +200,7 @@ $sql.= " aa.rowid as aarowid";
$sql.= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
-$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
+$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
$sql.= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
// Add search filter like
if (strlen(trim($search_expensereport))) {
diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php
index 4a4dafbe2b4..13b97ffb8d3 100644
--- a/htdocs/accountancy/journal/expensereportsjournal.php
+++ b/htdocs/accountancy/journal/expensereportsjournal.php
@@ -554,14 +554,15 @@ if (empty($action) || $action == 'view') {
print '
';
diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php
index e8af356a245..7f25cd63df8 100644
--- a/htdocs/accountancy/journal/purchasesjournal.php
+++ b/htdocs/accountancy/journal/purchasesjournal.php
@@ -709,6 +709,7 @@ if (empty($action) || $action == 'view') {
$("div.fiche form input[name=\"action\"]").val("");
}
function writebookkeeping() {
+ console.log("click on writebookkeeping");
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
$("div.fiche form input[type=\"submit\"]").click();
$("div.fiche form input[name=\"action\"]").val("");
diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php
index 128c6be1471..d8d20978ab7 100644
--- a/htdocs/accountancy/journal/sellsjournal.php
+++ b/htdocs/accountancy/journal/sellsjournal.php
@@ -643,6 +643,7 @@ if (empty($action) || $action == 'view') {
$("div.fiche form input[name=\"action\"]").val("");
}
function writebookkeeping() {
+ console.log("click on writebookkeeping");
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
$("div.fiche form input[type=\"submit\"]").click();
$("div.fiche form input[name=\"action\"]").val("");
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index b69f55ba1a8..9d7ae9d0998 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -338,7 +338,7 @@ abstract class CommonInvoice extends CommonObject
*
* @return int <0 if KO, 0=no, 1=yes
*/
- function getVentilExportCompta()
+ public function getVentilExportCompta()
{
$alreadydispatched = 0;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index d2333028203..a47cc32e44b 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1494,7 +1494,20 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5);
$morehtmlstatus.=$tmptxt;
}
- if (! empty($object->name_alias)) $morehtmlref.='
'.$object->name_alias.'
'; // For thirdparty
+
+ // Add if object was dispatched "into accountancy"
+ if (! empty($conf->accounting->enabled) && in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'expensereport')))
+ {
+ if (method_exists($object, 'getVentilExportCompta'))
+ {
+ $accounted = $object->getVentilExportCompta();
+ $langs->load("accountancy");
+ $morehtmlstatus.=''.($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted"));
+ }
+ }
+
+ // Add alias for thirdparty
+ if (! empty($object->name_alias)) $morehtmlref.='
'.$object->name_alias.'
';
// Add label
if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task')
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 796be33104f..2052b63fe0c 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -2326,6 +2326,41 @@ class ExpenseReport extends CommonObject
else
return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->payment->warning_delay);
}
+
+ /**
+ * Return if an expensereport was dispatched into bookkeeping
+ *
+ * @return int <0 if KO, 0=no, 1=yes
+ */
+ public function getVentilExportCompta()
+ {
+ $alreadydispatched = 0;
+
+ $type = 'expense_report';
+
+ $sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$type."' AND ab.fk_doc = ".$this->id;
+ $resql = $this->db->query($sql);
+ if ($resql)
+ {
+ $obj = $this->db->fetch_object($resql);
+ if ($obj)
+ {
+ $alreadydispatched = $obj->nb;
+ }
+ }
+ else
+ {
+ $this->error = $this->db->lasterror();
+ return -1;
+ }
+
+ if ($alreadydispatched)
+ {
+ return 1;
+ }
+ return 0;
+ }
+
}
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index 949b16109f0..c23e13a6bff 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -25,8 +25,8 @@ Chartofaccounts=Chart of accounts
CurrentDedicatedAccountingAccount=Current dedicated account
AssignDedicatedAccountingAccount=New account to assign
InvoiceLabel=Invoice label
-OverviewOfAmountOfLinesNotBound=Overview of amount of lines not bound to accounting account
-OverviewOfAmountOfLinesBound=Overview of amount of lines already bound to accounting account
+OverviewOfAmountOfLinesNotBound=Overview of amount of lines not bound to an accounting account
+OverviewOfAmountOfLinesBound=Overview of amount of lines already bound to an accounting account
OtherInfo=Other information
DeleteCptCategory=Remove accounting account from group
ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account from the accounting account group ?
@@ -173,7 +173,7 @@ DelBookKeeping=Delete record of the Ledger
FinanceJournal=Finance journal
ExpenseReportsJournal=Expense reports journal
DescFinanceJournal=Finance journal including all the types of payments by bank account
-DescJournalOnlyBindedVisible=This is a view of record that are bound to accounting account and can be recorded into the Ledger.
+DescJournalOnlyBindedVisible=This is a view of record that are bound to an accounting account and can be recorded into the Ledger.
VATAccountNotDefined=Account for VAT not defined
ThirdpartyAccountNotDefined=Account for third party not defined
ProductAccountNotDefined=Account for product not defined
@@ -224,6 +224,8 @@ GeneralLedgerSomeRecordWasNotRecorded=Some of the transactions could not be disp
NoNewRecordSaved=No more record to journalize
ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account
ChangeBinding=Change the binding
+Accounted=Accounted in ledger
+NotYetAccounted=Not yet accounted in ledger
## Admin
ApplyMassCategories=Apply mass categories
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 2ccdac53c52..27fb07d414d 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -1025,6 +1025,9 @@ select.selectarrowonleft option {
div.statusref img {
padding-right: 3px !important;
}
+ div.statusrefbis {
+ padding-right: 3px !important;
+ }
input.buttonpayment {
min-width: 300px;
@@ -1332,6 +1335,11 @@ div.statusref img {
padding-right: 9px;
vertical-align: text-bottom;
}
+div.statusrefbis {
+ padding-left: 8px;
+ padding-right: 9px;
+ vertical-align: text-bottom;
+}
img.photoref, div.photoref {
border: 1px solid #CCC;
-webkit-box-shadow: 2px 2px 4px #ccc;
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index ebe69f736e0..cf872bb117d 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -1015,6 +1015,9 @@ select.selectarrowonleft option {
div.statusref img {
padding-right: 3px !important;
}
+ div.statusrefbis {
+ padding-right: 3px !important;
+ }
input.buttonpayment {
min-width: 300px;
@@ -1345,6 +1348,11 @@ div.statusref img {
padding-right: 9px;
vertical-align: text-bottom;
}
+div.statusrefbis {
+ padding-left: 8px;
+ padding-right: 9px;
+ vertical-align: text-bottom;
+}
img.photoref, div.photoref {
border: 1px solid #CCC;
-webkit-box-shadow: 3px 3px 4px #DDD;