diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php
index f5429dce86e..4705e21e6d3 100644
--- a/htdocs/accountancy/journal/purchasesjournal.php
+++ b/htdocs/accountancy/journal/purchasesjournal.php
@@ -526,13 +526,13 @@ if ($action == 'exportcsv') {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
+ $companystatic->fournisseur = 1;
$invoicestatic->id = $key;
- $invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["refsologest"];
- $invoicestatic->refsupplier = $val["refsuppliersologest"];
+ $invoicestatic->ref_supplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
- $invoicestatic->description = dol_trunc($val["description"], 32);
+ $invoicestatic->description = dol_trunc(html_entity_decode($val["description"]), 32);
$date = dol_print_date($val["date"], 'day');
@@ -699,15 +699,19 @@ if (empty($action) || $action == 'view') {
$invoicestatic = new FactureFournisseur($db);
$companystatic = new Fournisseur($db);
- foreach ( $tabfac as $key => $val ) {
+ foreach ( $tabfac as $key => $val )
+ {
$invoicestatic->id = $key;
- $invoicestatic->ref = $val["ref"];
$invoicestatic->type = $val["type"];
-
$invoicestatic->ref = $val["refsologest"];
- $invoicestatic->refsupplier = $val["refsuppliersologest"];
+ $invoicestatic->ref_supplier = $val["refsuppliersologest"];
+ $invoicestatic->description = dol_trunc(html_entity_decode($val["description"]), 32);
- $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
+ $companystatic->id = $tabcompany[$key]['id'];
+ $companystatic->name = $tabcompany[$key]['name'];
+ $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
+ $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
+ $companystatic->fournisseur = 1;
$date = dol_print_date($val["date"], 'day');
@@ -717,9 +721,6 @@ if (empty($action) || $action == 'view') {
print "
| ";
print "" . $date . " | ";
print "" . $invoicestatic->getNomUrl(1) . " | ";
- $companystatic->id = $tabcompany[$key]['id'];
- $companystatic->name = $tabcompany[$key]['name'];
- $companystatic->supplier_code = $tabcompany[$key]['code_supplier'];
// Account
print "";
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
@@ -738,7 +739,7 @@ if (empty($action) || $action == 'view') {
}
else print $accountoshow;
print ' | ';
- print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount") . " | ";
+ print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . " | ";
print '' . ($mt < 0 ? - price(- $mt) : '') . " | ";
print '' . ($mt >= 0 ? price($mt) : '') . " | ";
print "";
@@ -768,7 +769,7 @@ if (empty($action) || $action == 'view') {
print '';
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
- print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label . " | ";
+ print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . " | ";
print '' . ($mt >= 0 ? price($mt) : '') . " | ";
print '' . ($mt < 0 ? price(- $mt) : '') . " | ";
print "";
@@ -801,7 +802,7 @@ if (empty($action) || $action == 'view') {
print "";
print ' | ';
print "";
- print $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
+ print $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
print " | ";
print '' . ($mt >= 0 ? price($mt) : '') . " | ";
print '' . ($mt < 0 ? price(- $mt) : '') . " | ";
@@ -814,13 +815,11 @@ if (empty($action) || $action == 'view') {
if (is_array($tabother[$key]))
{
foreach ( $tabother[$key] as $k => $mt ) {
+
print '';
print " | ";
print "" . $date . " | ";
print "" . $invoicestatic->getNomUrl(1) . " | ";
- $companystatic->id = $tabcompany[$key]['id'];
- $companystatic->name = $tabcompany[$key]['name'];
- $companystatic->supplier_code = $tabcompany[$key]['code_supplier'];
// Account
print "";
$accountoshow = length_accountg($k);
@@ -833,7 +832,7 @@ if (empty($action) || $action == 'view') {
// Subledger account
print " | ";
print ' | ';
- print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT") . " NPR (counterpart) | ";
+ print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT") . " NPR (counterpart) | ";
print '' . ($mt < 0 ? - price(- $mt) : '') . " | ";
print '' . ($mt >= 0 ? price($mt) : '') . " | ";
print "
";
diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php
index 81dab1a1f06..f10777c0918 100644
--- a/htdocs/accountancy/journal/sellsjournal.php
+++ b/htdocs/accountancy/journal/sellsjournal.php
@@ -240,7 +240,6 @@ if ($action == 'writebookkeeping') {
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
- $companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key;
$invoicestatic->ref = (string) $val["ref"];
@@ -480,7 +479,10 @@ if ($action == 'exportcsv') {
{
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
- $companystatic->client = $tabcompany[$key]['code_client'];
+ $companystatic->code_compta = $tabcompany[$key]['code_compta'];
+ $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
+ $companystatic->code_client = $tabcompany[$key]['code_client'];
+ $companystatic->code_fournisseur = $tabcompany[$key]['code_supplier'];
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
@@ -632,11 +634,20 @@ if (empty($action) || $action == 'view') {
$invoicestatic = new Facture($db);
$companystatic = new Client($db);
- foreach ( $tabfac as $key => $val ) {
+ foreach ( $tabfac as $key => $val )
+ {
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->type = $val["type"];
+ $companystatic->id = $tabcompany[$key]['id'];
+ $companystatic->name = $tabcompany[$key]['name'];
+ $companystatic->code_compta = $tabcompany[$key]['code_compta'];
+ $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
+ $companystatic->code_client = $tabcompany[$key]['code_client'];
+ $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
+ $companystatic->client = 3;
+
$date = dol_print_date($val["date"], 'day');
// Third party
@@ -645,9 +656,6 @@ if (empty($action) || $action == 'view') {
print " | ";
print "" . $date . " | ";
print "" . $invoicestatic->getNomUrl(1) . " | ";
- $companystatic->id = $tabcompany[$key]['id'];
- $companystatic->name = $tabcompany[$key]['name'];
- $companystatic->customer_code = $tabcompany[$key]['code_client'];
// Account
print "";
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 775d8852b90..9f8c57d145f 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -1965,12 +1965,12 @@ class Societe extends CommonObject
$label.= ' ' . $langs->trans('Country') . ': '. $this->country_code;
if (! empty($this->tva_intra))
$label.= ' ' . $langs->trans('VATIntra') . ': '. $this->tva_intra;
- if (! empty($this->code_client) && $this->client)
+ if (! empty($this->code_client) && $this->client)
$label.= ' ' . $langs->trans('CustomerCode') . ': '. $this->code_client;
if (! empty($this->code_fournisseur) && $this->fournisseur)
$label.= ' ' . $langs->trans('SupplierCode') . ': '. $this->code_fournisseur;
if (! empty($conf->accounting->enabled) && $this->client)
- $label.= ' ' . $langs->trans('CustomerAccountancyCode') . ': '. $this->code_compta_client;
+ $label.= ' ' . $langs->trans('CustomerAccountancyCode') . ': '. ($this->code_compta ? $this->code_compta : $this->code_compta_client);
if (! empty($conf->accounting->enabled) && $this->fournisseur)
$label.= ' ' . $langs->trans('SupplierAccountancyCode') . ': '. $this->code_compta_fournisseur;
|