Fix send into ledger for expense report. Show accounted status.
This commit is contained in:
parent
3c3e02dbea
commit
273e88a599
@ -200,7 +200,7 @@ $sql.= " aa.rowid as aarowid";
|
|||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$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.= " 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 . "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";
|
$sql.= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if (strlen(trim($search_expensereport))) {
|
if (strlen(trim($search_expensereport))) {
|
||||||
|
|||||||
@ -554,14 +554,15 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
function writebookkeeping() {
|
function writebookkeeping() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
console.log("click on writebookkeeping");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
|
|||||||
@ -709,6 +709,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$("div.fiche form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
function writebookkeeping() {
|
function writebookkeeping() {
|
||||||
|
console.log("click on writebookkeeping");
|
||||||
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||||
$("div.fiche form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
|
|||||||
@ -643,6 +643,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$("div.fiche form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
function writebookkeeping() {
|
function writebookkeeping() {
|
||||||
|
console.log("click on writebookkeeping");
|
||||||
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||||
$("div.fiche form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
|
|||||||
@ -338,7 +338,7 @@ abstract class CommonInvoice extends CommonObject
|
|||||||
*
|
*
|
||||||
* @return int <0 if KO, 0=no, 1=yes
|
* @return int <0 if KO, 0=no, 1=yes
|
||||||
*/
|
*/
|
||||||
function getVentilExportCompta()
|
public function getVentilExportCompta()
|
||||||
{
|
{
|
||||||
$alreadydispatched = 0;
|
$alreadydispatched = 0;
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5);
|
||||||
$morehtmlstatus.=$tmptxt;
|
$morehtmlstatus.=$tmptxt;
|
||||||
}
|
}
|
||||||
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // 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.='</div><div class="statusref statusrefbis">'.($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add alias for thirdparty
|
||||||
|
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>';
|
||||||
|
|
||||||
// Add label
|
// Add label
|
||||||
if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task')
|
if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task')
|
||||||
|
|||||||
@ -2326,6 +2326,41 @@ class ExpenseReport extends CommonObject
|
|||||||
else
|
else
|
||||||
return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->payment->warning_delay);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -25,8 +25,8 @@ Chartofaccounts=Chart of accounts
|
|||||||
CurrentDedicatedAccountingAccount=Current dedicated account
|
CurrentDedicatedAccountingAccount=Current dedicated account
|
||||||
AssignDedicatedAccountingAccount=New account to assign
|
AssignDedicatedAccountingAccount=New account to assign
|
||||||
InvoiceLabel=Invoice label
|
InvoiceLabel=Invoice label
|
||||||
OverviewOfAmountOfLinesNotBound=Overview of amount of lines not 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 accounting account
|
OverviewOfAmountOfLinesBound=Overview of amount of lines already bound to an accounting account
|
||||||
OtherInfo=Other information
|
OtherInfo=Other information
|
||||||
DeleteCptCategory=Remove accounting account from group
|
DeleteCptCategory=Remove accounting account from group
|
||||||
ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account from the accounting account 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
|
FinanceJournal=Finance journal
|
||||||
ExpenseReportsJournal=Expense reports journal
|
ExpenseReportsJournal=Expense reports journal
|
||||||
DescFinanceJournal=Finance journal including all the types of payments by bank account
|
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
|
VATAccountNotDefined=Account for VAT not defined
|
||||||
ThirdpartyAccountNotDefined=Account for third party not defined
|
ThirdpartyAccountNotDefined=Account for third party not defined
|
||||||
ProductAccountNotDefined=Account for product 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
|
NoNewRecordSaved=No more record to journalize
|
||||||
ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account
|
ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account
|
||||||
ChangeBinding=Change the binding
|
ChangeBinding=Change the binding
|
||||||
|
Accounted=Accounted in ledger
|
||||||
|
NotYetAccounted=Not yet accounted in ledger
|
||||||
|
|
||||||
## Admin
|
## Admin
|
||||||
ApplyMassCategories=Apply mass categories
|
ApplyMassCategories=Apply mass categories
|
||||||
|
|||||||
@ -1025,6 +1025,9 @@ select.selectarrowonleft option {
|
|||||||
div.statusref img {
|
div.statusref img {
|
||||||
padding-right: 3px !important;
|
padding-right: 3px !important;
|
||||||
}
|
}
|
||||||
|
div.statusrefbis {
|
||||||
|
padding-right: 3px !important;
|
||||||
|
}
|
||||||
|
|
||||||
input.buttonpayment {
|
input.buttonpayment {
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
@ -1332,6 +1335,11 @@ div.statusref img {
|
|||||||
padding-right: 9px;
|
padding-right: 9px;
|
||||||
vertical-align: text-bottom;
|
vertical-align: text-bottom;
|
||||||
}
|
}
|
||||||
|
div.statusrefbis {
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 9px;
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
}
|
||||||
img.photoref, div.photoref {
|
img.photoref, div.photoref {
|
||||||
border: 1px solid #CCC;
|
border: 1px solid #CCC;
|
||||||
-webkit-box-shadow: 2px 2px 4px #ccc;
|
-webkit-box-shadow: 2px 2px 4px #ccc;
|
||||||
|
|||||||
@ -1015,6 +1015,9 @@ select.selectarrowonleft option {
|
|||||||
div.statusref img {
|
div.statusref img {
|
||||||
padding-right: 3px !important;
|
padding-right: 3px !important;
|
||||||
}
|
}
|
||||||
|
div.statusrefbis {
|
||||||
|
padding-right: 3px !important;
|
||||||
|
}
|
||||||
|
|
||||||
input.buttonpayment {
|
input.buttonpayment {
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
@ -1345,6 +1348,11 @@ div.statusref img {
|
|||||||
padding-right: 9px;
|
padding-right: 9px;
|
||||||
vertical-align: text-bottom;
|
vertical-align: text-bottom;
|
||||||
}
|
}
|
||||||
|
div.statusrefbis {
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 9px;
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
}
|
||||||
img.photoref, div.photoref {
|
img.photoref, div.photoref {
|
||||||
border: 1px solid #CCC;
|
border: 1px solid #CCC;
|
||||||
-webkit-box-shadow: 3px 3px 4px #DDD;
|
-webkit-box-shadow: 3px 3px 4px #DDD;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user