Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/accountancy/bookkeeping/balancebymonth.php htdocs/accountancy/class/accountancyexport.class.php
This commit is contained in:
commit
dd72a52e8f
@ -1,135 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/bookkeeping/balancebymonth.php
|
||||
* \ingroup Accountancy (Double entries)
|
||||
* \brief Balance by month
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("bills", "compta", "accountancy", "other"));
|
||||
|
||||
// Filter
|
||||
$year = GETPOST("year", 'int');
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$year_start = $year;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Bookkeeping"));
|
||||
|
||||
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
|
||||
$textnextyear = ' <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans("AccountBalanceByMonth").' '.$textprevyear.' '.$langs->trans("Year").' '.$year_start.' '.$textnextyear);
|
||||
|
||||
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE fd.fk_code_ventilation = 0";
|
||||
$sql .= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1;";
|
||||
|
||||
dol_syslog('accountancy/bookkeeping/balancebymonth.php:: $sql='.$sql);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$row = $db->fetch_row($result);
|
||||
$nbfac = $row[0];
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width=150>'.$langs->trans("Label").'</td>';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
print '<td class="right">'.$langs->trans("MonthShort".sprintf("%02s", $i)).'</td>';
|
||||
}
|
||||
print '<td class="center"><strong>'.$langs->trans("Total").'</strong></td>';
|
||||
print '</tr>';
|
||||
|
||||
$sql = "SELECT bk.numero_compte AS 'compte',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=1,bk.montant,0)),2) AS 'Janvier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=2,bk.montant,0)),2) AS 'Fevrier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=3,bk.montant,0)),2) AS 'Mars',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=4,bk.montant,0)),2) AS 'Avril',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=5,bk.montant,0)),2) AS 'Mai',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=6,bk.montant,0)),2) AS 'Juin',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=7,bk.montant,0)),2) AS 'Juillet',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=8,bk.montant,0)),2) AS 'Aout',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=9,bk.montant,0)),2) AS 'Septembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=10,bk.montant,0)),2) AS 'Octobre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=11,bk.montant,0)),2) AS 'Novembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=12,bk.montant,0)),2) AS 'Decembre',";
|
||||
$sql .= " ROUND(SUM(bk.montant),2) as 'Total'";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE bk.doc_date >= '".$db->idate(dol_get_first_day($y, 1, false))."'";
|
||||
$sql .= " AND bk.doc_date <= '".$db->idate(dol_get_last_day($y, 12, false))."'";
|
||||
$sql .= " GROUP BY bk.numero_compte";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
print '<tr class="oddeven"><td width="14%">'.length_accountg($row[0]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[1]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[2]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[3]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[4]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[5]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[6]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[7]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[8]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[9]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[10]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[11]).'</td>';
|
||||
print '<td class="right" width="6.5%">'.price($row[12]).'</td>';
|
||||
print '<td class="right" width="8%"><strong>'.price($row[13]).'</strong></td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror();
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -145,7 +145,7 @@ print dol_get_fiche_end();
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )";
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ print dol_get_fiche_end();
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code, bk.date_validated ";
|
||||
$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code, bk.date_validated ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta_fournisseur)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)."' )";
|
||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
||||
|
||||
@ -359,7 +359,7 @@ class AccountancyExport
|
||||
print length_accountg($line->numero_compte).$separator;
|
||||
print length_accounta($line->subledger_account).$separator;
|
||||
print $line->sens.$separator;
|
||||
print price2fec(abs($line->montant)).$separator;
|
||||
print price2fec(abs($line->debit - $line->credit)).$separator;
|
||||
print dol_string_unaccent($line->label_operation).$separator;
|
||||
print dol_string_unaccent($line->doc_ref);
|
||||
print $end_line;
|
||||
@ -387,11 +387,11 @@ class AccountancyExport
|
||||
print $line->label_operation.$separator;
|
||||
print $date.$separator;
|
||||
if ($line->sens == 'D') {
|
||||
print price($line->montant).$separator;
|
||||
print price($line->debit).$separator;
|
||||
print ''.$separator;
|
||||
} elseif ($line->sens == 'C') {
|
||||
print ''.$separator;
|
||||
print price($line->montant).$separator;
|
||||
print price($line->credit).$separator;
|
||||
}
|
||||
print $line->doc_ref.$separator;
|
||||
print $line->label_operation.$separator;
|
||||
@ -493,7 +493,7 @@ class AccountancyExport
|
||||
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
|
||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).dol_string_unaccent($data->label_operation), 25), 25);
|
||||
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
|
||||
$Tab['montant'] = str_pad(abs($data->debit - $data->credit), 13, ' ', STR_PAD_LEFT);
|
||||
$Tab['type_montant'] = str_pad($data->sens, 1);
|
||||
$Tab['vide'] = str_repeat(' ', 18);
|
||||
$Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34);
|
||||
@ -541,20 +541,23 @@ class AccountancyExport
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20);
|
||||
|
||||
// Credit invoice - invert sens
|
||||
if ($data->montant < 0) {
|
||||
if ($data->sens == 'C') {
|
||||
$Tab['sens'] = 'D';
|
||||
} else {
|
||||
$Tab['sens'] = 'C';
|
||||
}
|
||||
$Tab['signe_montant'] = '-';
|
||||
} else {
|
||||
$Tab['sens'] = $data->sens; // C or D
|
||||
$Tab['signe_montant'] = '+';
|
||||
}
|
||||
/*
|
||||
if ($data->montant < 0) {
|
||||
if ($data->sens == 'C') {
|
||||
$Tab['sens'] = 'D';
|
||||
} else {
|
||||
$Tab['sens'] = 'C';
|
||||
}
|
||||
$Tab['signe_montant'] = '-';
|
||||
} else {
|
||||
$Tab['sens'] = $data->sens; // C or D
|
||||
$Tab['signe_montant'] = '+';
|
||||
}*/
|
||||
$Tab['sens'] = $data->sens; // C or D
|
||||
$Tab['signe_montant'] = '+';
|
||||
|
||||
// The amount must be in centimes without decimal points.
|
||||
$Tab['montant'] = str_pad(abs($data->montant * 100), 12, '0', STR_PAD_LEFT);
|
||||
$Tab['montant'] = str_pad(abs(($data->debit - $abs->credit) * 100), 12, '0', STR_PAD_LEFT);
|
||||
$Tab['contrepartie'] = str_repeat(' ', 8);
|
||||
|
||||
// Force date format : %d%m%y
|
||||
@ -640,13 +643,13 @@ class AccountancyExport
|
||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0');
|
||||
|
||||
if ($data->sens == 'D') {
|
||||
$Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
$Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
|
||||
$Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
} else {
|
||||
$Tab['montant_debit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
|
||||
$Tab['montant_crebit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
$Tab['montant_crebit'] = str_pad(number_format($data->credit), 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30);
|
||||
@ -707,7 +710,7 @@ class AccountancyExport
|
||||
//print substr(length_accountg($line->numero_compte), 0, 2) . $separator;
|
||||
print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"'.$separator;
|
||||
print '"'.dol_trunc($line->piece_num, 15, 'right', 'UTF-8', 1).'"'.$separator;
|
||||
print price2num(abs($line->montant)).$separator;
|
||||
print price2num(abs($line->debit - $line->credit)).$separator;
|
||||
print $line->sens.$separator;
|
||||
print $date.$separator;
|
||||
//print 'EUR';
|
||||
@ -747,7 +750,7 @@ class AccountancyExport
|
||||
print self::toAnsi($line->doc_ref).$separator;
|
||||
print price($line->debit).$separator;
|
||||
print price($line->credit).$separator;
|
||||
print price($line->montant).$separator;
|
||||
print price(abs($line->debit - $line->credit)).$separator;
|
||||
print $line->sens.$separator;
|
||||
print $line->lettering_code.$separator;
|
||||
print $line->code_journal;
|
||||
@ -810,7 +813,7 @@ class AccountancyExport
|
||||
$tab[] = length_accounta($line->subledger_account);
|
||||
$tab[] = price2num($line->debit);
|
||||
$tab[] = price2num($line->credit);
|
||||
$tab[] = price2num($line->montant);
|
||||
$tab[] = price2num($line->debit - $line->credit);
|
||||
$tab[] = $line->code_journal;
|
||||
|
||||
print implode($separator, $tab).$this->end_line;
|
||||
@ -853,8 +856,8 @@ class AccountancyExport
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
if ($line->debit == 0 && $line->credit == 0) {
|
||||
unset($array[$line]);
|
||||
} else {
|
||||
//unset($array[$line]);
|
||||
} else {
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_lettering = dol_print_date($line->date_lettering, '%Y%m%d');
|
||||
@ -959,7 +962,7 @@ class AccountancyExport
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
if ($line->debit == 0 && $line->credit == 0) {
|
||||
unset($array[$line]);
|
||||
//unset($array[$line]);
|
||||
} else {
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
@ -1110,11 +1113,7 @@ class AccountancyExport
|
||||
// Code
|
||||
print '""'.$this->separator;
|
||||
// Netto
|
||||
if ($line->montant >= 0) {
|
||||
print $line->montant.$this->separator;
|
||||
} else {
|
||||
print ($line->montant * -1).$this->separator;
|
||||
}
|
||||
print abs($line->debit - $line->credit).$this->separator;
|
||||
// Steuer
|
||||
print "0.00".$this->separator;
|
||||
// FW-Betrag
|
||||
@ -1190,13 +1189,13 @@ class AccountancyExport
|
||||
print $date_lim_reglement.$separator;
|
||||
// CNPI
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
if (($line->debit - $line->credit) > 0) {
|
||||
$nature_piece = 'AF';
|
||||
} else {
|
||||
$nature_piece = 'FF';
|
||||
}
|
||||
} elseif ($line->doc_type == 'customer_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
if (($line->debit - $line->credit) < 0) {
|
||||
$nature_piece = 'AC';
|
||||
} else {
|
||||
$nature_piece = 'FC';
|
||||
@ -1220,7 +1219,7 @@ class AccountancyExport
|
||||
|
||||
print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead
|
||||
// MONT
|
||||
print price(abs($line->montant), 0, '', 1, 2, 2).$separator;
|
||||
print price(abs($line->debit - $line->credit), 0, '', 1, 2, 2).$separator;
|
||||
// CODC
|
||||
print $line->sens.$separator;
|
||||
// CPTG
|
||||
@ -1451,13 +1450,13 @@ class AccountancyExport
|
||||
print $date_lim_reglement.$separator;
|
||||
// CNPI
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
if (($line->debit - $line->credit) > 0) {
|
||||
$nature_piece = 'AF';
|
||||
} else {
|
||||
$nature_piece = 'FF';
|
||||
}
|
||||
} elseif ($line->doc_type == 'customer_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
if (($line->debit - $line->credit) < 0) {
|
||||
$nature_piece = 'AC';
|
||||
} else {
|
||||
$nature_piece = 'FC';
|
||||
@ -1481,7 +1480,7 @@ class AccountancyExport
|
||||
|
||||
print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead
|
||||
// MONT
|
||||
print price(abs($line->montant), 0, '', 1, 2).$separator;
|
||||
print price(abs($line->debit - $line->credit), 0, '', 1, 2).$separator;
|
||||
// CODC
|
||||
print $line->sens.$separator;
|
||||
// CPTG
|
||||
@ -1602,7 +1601,7 @@ class AccountancyExport
|
||||
print self::trunc($line->label_compte, 60).$separator; //Account label
|
||||
print self::trunc($line->doc_ref, 20).$separator; //Piece
|
||||
print self::trunc($line->label_operation, 60).$separator; //Operation label
|
||||
print price(abs($line->montant)).$separator; //Amount
|
||||
print price(abs($line->debit - $line->credit)).$separator; //Amount
|
||||
print $line->sens.$separator; //Direction
|
||||
print $separator; //Analytic
|
||||
print $separator; //Analytic
|
||||
@ -1631,7 +1630,7 @@ class AccountancyExport
|
||||
$supplier_invoices_infos = array();
|
||||
foreach ($objectLines as $line) {
|
||||
if ($line->debit == 0 && $line->credit == 0) {
|
||||
unset($array[$line]);
|
||||
//unset($array[$line]);
|
||||
} else {
|
||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||
|
||||
@ -1699,8 +1698,8 @@ class AccountancyExport
|
||||
print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . $this->separator;
|
||||
//Devise
|
||||
print 'EUR' . $this->separator;
|
||||
//Montant
|
||||
print price2num(abs($line->montant)) . $this->separator;
|
||||
//Amount
|
||||
print price2num(abs($line->debit - $line->credit)) . $this->separator;
|
||||
//Sens
|
||||
print $line->sens . $this->separator;
|
||||
//Code lettrage
|
||||
@ -1726,14 +1725,14 @@ class AccountancyExport
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
if ($line->debit == 0 && $line->credit == 0) {
|
||||
unset($array[$line]);
|
||||
//unset($array[$line]);
|
||||
} else {
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
|
||||
print $line->id . $this->separator;
|
||||
print $date . $this->separator;
|
||||
print substr($line->code_journal, 0, 4) . $this->separator;
|
||||
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) {
|
||||
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { // TODO No hard code value
|
||||
print length_accountg($line->subledger_account) . $this->separator;
|
||||
} else {
|
||||
print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator;
|
||||
@ -1742,7 +1741,7 @@ class AccountancyExport
|
||||
//print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator;
|
||||
print '"' . dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1) . '"' . $this->separator;
|
||||
print '"' . dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . '"' . $this->separator;
|
||||
print price2num($line->montant) . $this->separator;
|
||||
print price2num(abs($line->debit - $line->credit)) . $this->separator;
|
||||
print $line->sens . $this->separator;
|
||||
print $date . $this->separator;
|
||||
print $this->separator;
|
||||
|
||||
@ -135,6 +135,7 @@ class BookKeeping extends CommonObject
|
||||
|
||||
/**
|
||||
* @var float FEC:Amount (Not necessary)
|
||||
* @deprecated No more used
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
@ -239,6 +240,9 @@ class BookKeeping extends CommonObject
|
||||
if (isset($this->montant)) {
|
||||
$this->montant = (float) $this->montant;
|
||||
}
|
||||
if (isset($this->amount)) {
|
||||
$this->amount = (float) $this->amount;
|
||||
}
|
||||
if (isset($this->sens)) {
|
||||
$this->sens = trim($this->sens);
|
||||
}
|
||||
@ -563,6 +567,9 @@ class BookKeeping extends CommonObject
|
||||
if (isset($this->montant)) {
|
||||
$this->montant = trim($this->montant);
|
||||
}
|
||||
if (isset($this->amount)) {
|
||||
$this->amount = trim($this->amount);
|
||||
}
|
||||
if (isset($this->sens)) {
|
||||
$this->sens = trim($this->sens);
|
||||
}
|
||||
@ -708,7 +715,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.label_operation,";
|
||||
$sql .= " t.debit,";
|
||||
$sql .= " t.credit,";
|
||||
$sql .= " t.montant,";
|
||||
$sql .= " t.montant as amount,";
|
||||
$sql .= " t.sens,";
|
||||
$sql .= " t.fk_user_author,";
|
||||
$sql .= " t.import_key,";
|
||||
@ -747,7 +754,8 @@ class BookKeeping extends CommonObject
|
||||
$this->label_operation = $obj->label_operation;
|
||||
$this->debit = $obj->debit;
|
||||
$this->credit = $obj->credit;
|
||||
$this->montant = $obj->montant;
|
||||
$this->montant = $obj->amount;
|
||||
$this->amount = $obj->amount;
|
||||
$this->sens = $obj->sens;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->import_key = $obj->import_key;
|
||||
@ -1207,8 +1215,8 @@ class BookKeeping extends CommonObject
|
||||
if (isset($this->credit)) {
|
||||
$this->credit = trim($this->credit);
|
||||
}
|
||||
if (isset($this->montant)) {
|
||||
$this->montant = trim($this->montant);
|
||||
if (isset($this->amount)) {
|
||||
$this->amount = trim($this->amount);
|
||||
}
|
||||
if (isset($this->sens)) {
|
||||
$this->sens = trim($this->sens);
|
||||
@ -1655,7 +1663,7 @@ class BookKeeping extends CommonObject
|
||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||
$sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
|
||||
$sql .= " numero_compte, label_compte, label_operation, debit, credit,";
|
||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation";
|
||||
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||
$sql .= " WHERE piece_num = ".$piecenum;
|
||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
||||
@ -1681,7 +1689,8 @@ class BookKeeping extends CommonObject
|
||||
$line->label_operation = $obj->label_operation;
|
||||
$line->debit = $obj->debit;
|
||||
$line->credit = $obj->credit;
|
||||
$line->montant = $obj->montant;
|
||||
$line->montant = $obj->amount;
|
||||
$line->amount = $obj->amount;
|
||||
$line->sens = $obj->sens;
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->journal_label = $obj->journal_label;
|
||||
@ -1714,7 +1723,7 @@ class BookKeeping extends CommonObject
|
||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||
$sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
|
||||
$sql .= " numero_compte, label_compte, label_operation, debit, credit,";
|
||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
||||
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
|
||||
|
||||
@ -1744,7 +1753,8 @@ class BookKeeping extends CommonObject
|
||||
$line->label_operation = $obj->label_operation;
|
||||
$line->debit = $obj->debit;
|
||||
$line->credit = $obj->credit;
|
||||
$line->montant = $obj->montant;
|
||||
$line->montant = $obj->amount;
|
||||
$line->amount = $obj->amount;
|
||||
$line->sens = $obj->sens;
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
|
||||
@ -547,6 +547,7 @@ function hideMessage(fieldId,message) {
|
||||
* @param string token Token
|
||||
*/
|
||||
function setConstant(url, code, input, entity, strict, forcereload, userid, token) {
|
||||
var saved_url = url; /* avoid undefined url */
|
||||
$.post( url, {
|
||||
action: "set",
|
||||
name: code,
|
||||
@ -591,7 +592,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
$.each(data, function(key, value) {
|
||||
$("#set_" + key).hide();
|
||||
$("#del_" + key).show();
|
||||
$.post( url, {
|
||||
$.post( saved_url, {
|
||||
action: "set",
|
||||
name: key,
|
||||
value: value,
|
||||
@ -621,6 +622,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
* @param string token Token
|
||||
*/
|
||||
function delConstant(url, code, input, entity, strict, forcereload, userid, token) {
|
||||
var saved_url = url; /* avoid undefined url */
|
||||
$.post( url, {
|
||||
action: "del",
|
||||
name: code,
|
||||
@ -662,7 +664,7 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
$.each(data, function(key, value) {
|
||||
$("#del_" + value).hide();
|
||||
$("#set_" + value).show();
|
||||
$.post( url, {
|
||||
$.post( saved_url, {
|
||||
action: "del",
|
||||
name: value,
|
||||
entity: entity,
|
||||
|
||||
@ -292,7 +292,8 @@ class modAccounting extends DolibarrModules
|
||||
'b.subledger_label'=>'SubledgerAccountLabel',
|
||||
'b.label_operation'=>'LabelOperation',
|
||||
'b.debit'=>"Debit",
|
||||
'b.credit'=>"Credit"
|
||||
'b.credit'=>"Credit",
|
||||
'b.sens'=>'Direction' // This field is still used by accounting export. We can remove it once it has been replace into accountancyexport.class.php by a detection using ->debit and ->credit
|
||||
);
|
||||
$this->import_fieldshidden_array[$r] = array('b.doc_type'=>'const-import_from_external', 'b.fk_doc'=>'const-0', 'b.fk_docdet'=>'const-0', 'b.fk_user_author'=>'user->id', 'b.date_creation'=>'const-'.dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_regex_array[$r] = array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
@ -309,7 +310,8 @@ class modAccounting extends DolibarrModules
|
||||
'b.subledger_label'=>'',
|
||||
'b.label_operation'=>"Sale of ABC",
|
||||
'b.debit'=>"0",
|
||||
'b.credit'=>"100"
|
||||
'b.credit'=>"100",
|
||||
'b.sens'=>'C' // This field is still used by accounting export. We can remove it once it has been replace into accountancyexport.class.php by a detection using ->debit and ->credit
|
||||
);
|
||||
|
||||
// Chart of accounts
|
||||
|
||||
@ -583,3 +583,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
|
||||
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 6,'AC_EMAIL_IN','system','reception Email',NULL, 1, 4);
|
||||
|
||||
|
||||
-- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN montant double(24,8) NULL;
|
||||
-- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN montant DROP NOT NULL;
|
||||
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ CREATE TABLE llx_accounting_bookkeeping
|
||||
label_operation varchar(255), -- FEC:EcritureLib | label of the operation
|
||||
debit double(24,8) NOT NULL, -- FEC:Debit
|
||||
credit double(24,8) NOT NULL, -- FEC:Credit
|
||||
montant double(24,8) NOT NULL, -- FEC:Montant (Not necessary)
|
||||
montant double(24,8) NULL, -- FEC:Montant (Not necessary)
|
||||
sens varchar(1) DEFAULT NULL, -- FEC:Sens (Not necessary)
|
||||
multicurrency_amount double(24,8), -- FEC:Montantdevise
|
||||
multicurrency_code varchar(255), -- FEC:Idevise
|
||||
|
||||
Loading…
Reference in New Issue
Block a user