';
print '';
print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
+ print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
@@ -176,11 +175,11 @@ else {
print "
\n";
print '';
- print '| ';
+ print ' | ';
print $langs->trans('From');
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
print ' ';
- print $langs->trans('To');
+ print $langs->trans('to');
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print ' | ';
@@ -203,23 +202,28 @@ else {
foreach ( $object->lines as $line ) {
$var = ! $var;
-
+ $link = '';
$total_debit += $line->debit;
$total_credit += $line->credit;
-
+ $description = $object->get_compte_desc($line->numero_compte); // Search description of the account
+ if(empty($description)){
+ $link = '' . img_edit_add() .'';
+ }
print "
";
print '| ' . length_accountg($line->numero_compte) . ' | ';
- print '' . price($line->debit) . ' | ';
- print '' . price($line->credit) . ' | ';
- print '' . price($line->credit - $line->debit) . ' | ';
- print '';
+ print ' | ' . $description . ' | ';
+ print '' . number_format($line->debit, 2, ',', ' ') . ' | ';
+ print '' . number_format($line->credit, 2, ',', ' ') . ' | ';
+ print '' . number_format($line->credit - $line->debit, 2, ',', ' ') . ' | ';
+ print '' . $link;
print ' | ';
print "
\n";
}
print '';
print ' | ';
+ print ' | ';
print '';
print price($total_debit);
print ' | ';
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 4a0ebbe8988..14bc6c32487 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -1,7 +1,7 @@
* Copyright (C) 2014 Juanjo Menent
- * Copyright (C) 2015-2016 Florian Henry
+ * Copyright (C) 2015-2016 Florian Henry
* Copyright (C) 2015 Raphaël Doursenaud
*
* This program is free software; you can redistribute it and/or modify
@@ -1207,6 +1207,48 @@ class BookKeeping extends CommonObject
return - 1;
}
}
+
+ /**
+ * Description of accounting account
+ *
+ * @param string $account Accounting account
+ * @return string
+ */
+ function get_compte_desc($account = null)
+ {
+ global $conf;
+ $pcgver = $conf->global->CHARTOFACCOUNTS;
+
+ $sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa ";
+ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
+ $sql .= " AND aa.account_number = '" . $account . "'";
+ $sql .= " AND asy.rowid = " . $pcgver;
+ $sql .= " AND aa.active = 1";
+ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
+
+ dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ $obj = '';
+ if ($this->db->num_rows($resql)) {
+ $obj = $this->db->fetch_object($resql);
+ }
+
+ if(empty($obj->category)){
+ return $obj->label;
+ }else{
+ return $obj->label.' ('.$obj->category.')';
+
+ }
+ } else {
+ $this->error = "Error " . $this->db->lasterror();
+ dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
+
+ return -1;
+ }
+ }
+
}
/**
diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php
index 82811598188..62309dc222e 100644
--- a/htdocs/accountancy/journal/purchasesjournal.php
+++ b/htdocs/accountancy/journal/purchasesjournal.php
@@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent
* Copyright (C) 2012 Regis Houssin
* Copyright (C) 2013-2015 Alexandre Spangaro
- * Copyright (C) 2013-2014 Olivier Geffroy
+ * Copyright (C) 2013-2016 Olivier Geffroy
* Copyright (C) 2013-2016 Florian Henry
*
* This program is free software; you can redistribute it and/or modify
@@ -123,7 +123,7 @@ if ($result) {
$i = 0;
while ( $i < $num ) {
$obj = $db->fetch_object($result);
- // contrôles
+ // contrôles
$compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour;
$compta_prod = $obj->compte;
if (empty($compta_prod)) {
@@ -164,6 +164,19 @@ if ($action == 'writebookkeeping') {
$error = 0;
foreach ( $tabfac as $key => $val ) {
+
+ $invoicestatic->id = $key;
+ $invoicestatic->ref = $val["ref"];
+ $invoicestatic->ref = $val["refsologest"];
+ $invoicestatic->refsupplier = $val["refsuppliersologest"];
+ $invoicestatic->type = $val["type"];
+ $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
+
+ $companystatic->id = $tabcompany[$key]['id'];
+ $companystatic->name = $tabcompany[$key]['name'];
+ $companystatic->client = $tabcompany[$key]['code_client'];
+
+
foreach ( $tabttc[$key] as $k => $mt ) {
// get compte id and label
@@ -175,7 +188,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur'];
- $bookkeeping->label_compte = $tabcompany[$key]['name'];
+ $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers");
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
@@ -193,6 +206,8 @@ if ($action == 'writebookkeeping') {
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
+ $accountingaccount = new AccountingAccount($db);
+ $accountingaccount->fetch(null, $k);
if ($mt) {
// get compte id and label
$accountingaccount = new AccountingAccount($db);
@@ -205,7 +220,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = '';
- $bookkeeping->label_compte = $accountingaccount->label;
+ $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->refsupplier . ' - ' . utf8_decode($accountingaccount->label);
$bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@@ -236,7 +251,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = '';
- $bookkeeping->label_compte = $langs->trans("VAT");
+ $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->refsupplier .' - '. $langs->trans("VAT");
$bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@@ -248,7 +263,7 @@ if ($action == 'writebookkeeping') {
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
- setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@@ -517,5 +532,4 @@ if ($action == 'export_csv') {
// End of page
llxFooter();
}
-
$db->close();
diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php
index 670875ec52b..a88d60b8376 100644
--- a/htdocs/accountancy/journal/sellsjournal.php
+++ b/htdocs/accountancy/journal/sellsjournal.php
@@ -7,7 +7,7 @@
* Copyright (C) 2013-2016 Alexandre Spangaro
* Copyright (C) 2013-2016 Florian Henry
* Copyright (C) 2013-2016 Olivier Geffroy
- * Copyright (C) 2014 Raphaël Doursenaud
+ * Copyright (C) 2014 Raphaël Doursenaud
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,9 +24,9 @@
*/
/**
- * \file htdocs/accountancy/journal/sellsjournal.php
- * \ingroup Advanced accountancy
- * \brief Page with sells journal
+ * \file htdocs/accountancy/journal/sellsjournal.php
+ * \ingroup Advanced accountancy
+ * \brief Page with sells journal
*/
require '../../main.inc.php';
@@ -142,15 +142,14 @@ if ($result) {
// Situation invoices handling
$line = new FactureLigne($db);
- $line->fetch($obj->fdid); // id of line
- $prev_progress = 0;
+ $line->fetch($obj->rowid);
+ $prev_progress = $line->get_prev_progress();
if ($obj->type == Facture::TYPE_SITUATION) {
- // Avoid divide by 0
+ // Avoid divide by 0
if ($obj->situation_percent == 0) {
$situation_ratio = 0;
} else {
- $prev_progress = $line->get_prev_progress($obj->rowid); // id of invoice
- $situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
+ $situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
}
} else {
$situation_ratio = 1;
@@ -194,6 +193,14 @@ if ($action == 'writebookkeeping') {
$error = 0;
foreach ( $tabfac as $key => $val ) {
+ $companystatic->id = $tabcompany[$key]['id'];
+ $companystatic->name = $tabcompany[$key]['name'];
+ $companystatic->client = $tabcompany[$key]['code_client'];
+
+$invoicestatic->id = $key;
+ $invoicestatic->ref = $val["ref"];
+
+
foreach ( $tabttc[$key] as $k => $mt ) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
@@ -204,7 +211,8 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_facturedet"];
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
- $bookkeeping->label_compte = $tabcompany[$key]['name'];
+ //$bookkeeping->label_compte = $tabcompany[$key]['name'];
+ $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
@@ -234,7 +242,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_facturedet"];
$bookkeeping->code_tiers = '';
$bookkeeping->numero_compte = $k;
- $bookkeeping->label_compte = $accountingaccount->label;
+ $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode($accountingaccount->label);
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
@@ -264,7 +272,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_facturedet"];
$bookkeeping->code_tiers = '';
$bookkeeping->numero_compte = $k;
- $bookkeeping->label_compte = $langs->trans("VAT");
+ $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
@@ -275,7 +283,7 @@ if ($action == 'writebookkeeping') {
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
- setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@@ -305,6 +313,9 @@ if ($action == 'export_csv') {
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
+$invoicestatic->id = $key;
+ $invoicestatic->ref = $val["ref"];
+
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
foreach ( $tabttc[$key] as $k => $mt ) {
@@ -314,7 +325,8 @@ if ($action == 'export_csv') {
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
- print utf8_decode($companystatic->name) . $sep;
+ print utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep;
+ //print utf8_decode($companystatic->name) . $sep;
print $val["ref"];
print "\n";
}
@@ -329,7 +341,8 @@ if ($action == 'export_csv') {
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
- print dol_trunc($accountingaccount_static->label, 32) . $sep;
+ print utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount_static->label)) . $sep;
+ //print dol_trunc($accountingaccount_static->label, 32) . $sep;
print $val["ref"];
print "\n";
}
@@ -344,7 +357,8 @@ if ($action == 'export_csv') {
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
- print $langs->trans("VAT") . $sep;
+ print utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . $sep;
+ //print $langs->trans("VAT") . $sep;
print $val["ref"];
print "\n";
}
@@ -356,6 +370,9 @@ if ($action == 'export_csv') {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
+
+ $invoicestatic->id = $key;
+ $invoicestatic->ref = $val["ref"];
$date = dol_print_date($db->jdate($val["date"]), 'day');
@@ -363,7 +380,7 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
- print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $companystatic->ref_client . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
+ print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
//print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
@@ -393,7 +410,7 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
- print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - '. $langs->trans("VAT") . '"' . $sep;
+ print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . '"' . $sep;
//print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
@@ -481,7 +498,7 @@ if ($action == 'export_csv') {
print "" . length_accounta($k);
//print " | " . $langs->trans("ThirdParty");
//print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
- print " | " . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref_client . ' - ' . $langs->trans("Code_tiers"). " | ";
+ print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers"). " | ";
print "" . ($mt >= 0 ? price($mt) : '') . " | ";
print "" . ($mt < 0 ? price(- $mt) : '') . " | ";
}
@@ -498,7 +515,7 @@ if ($action == 'export_csv') {
print "" . $invoicestatic->getNomUrl(1) . " | ";
print "" . length_accountg($k) . " | ";
//print "" . $accountingaccount->label . " | ";
- print "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref_client . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount->label)) . " | ";
+ print "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount->label)) . " | ";
print "" . ($mt < 0 ? price(- $mt) : '') . " | ";
print "" . ($mt >= 0 ? price($mt) : '') . " | ";
print "
";
@@ -512,7 +529,7 @@ if ($action == 'export_csv') {
print "" . $date . " | ";
print "" . $invoicestatic->getNomUrl(1) . " | ";
print "" . length_accountg($k) . " | ";
- print "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref_client .' - '. $langs->trans("VAT") . " | ";
+ print "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . " | ";
//print "" . $langs->trans("VAT") . " | ";
print "" . ($mt < 0 ? price(- $mt) : '') . " | ";
print "" . ($mt >= 0 ? price($mt) : '') . " | ";
diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php
index 048e351044d..8f196de9f13 100644
--- a/htdocs/admin/bank.php
+++ b/htdocs/admin/bank.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2010-2013 Juanjo Menent
+ * Copyright (C) 2010-2016 Juanjo Menent
* Copyright (C) 2013-2014 Philippe Grand
* Copyright (C) 2015 Jean-François Ferry
*
@@ -46,24 +46,6 @@ $action = GETPOST('action','alpha');
* Actions
*/
-if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
-{
- $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string
-
- $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
-
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
-
//Order display of bank account
if ($action == 'setbankorder')
{
@@ -89,58 +71,13 @@ $form=new Form($db);
$linkback=''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
-
-print '';
-*/
-
-
//Show bank account order
print load_fiche_titre($langs->trans("BankOrderShow"));
@@ -202,8 +139,6 @@ print '
'."\n";
dol_fiche_end();
-print '';
-
llxFooter();
$db->close();
diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php
new file mode 100644
index 00000000000..f319692f27d
--- /dev/null
+++ b/htdocs/admin/chequereceipts.php
@@ -0,0 +1,287 @@
+
+ * Copyright (C) 2010-2016 Juanjo Menent