Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop_bug_restapi

This commit is contained in:
Regis Houssin 2017-06-16 10:52:43 +02:00
commit c656856ec2
29 changed files with 654 additions and 447 deletions

View File

@ -546,7 +546,7 @@ if ($id)
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); } if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); } if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
if ($valuetoshow != '') if ($valuetoshow != '')
@ -700,7 +700,7 @@ if ($id)
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); } if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
// Affiche nom du champ // Affiche nom du champ
if ($showfield) if ($showfield)

View File

@ -50,23 +50,26 @@ if (! empty($user->rights->accountancy->chartofaccount))
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$list_account_main = array (
'ACCOUNTING_ACCOUNT_CUSTOMER',
'ACCOUNTING_ACCOUNT_SUPPLIER',
);
$list_account = array ( $list_account = array (
'ACCOUNTING_ACCOUNT_SUPPLIER', 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
'ACCOUNTING_ACCOUNT_CUSTOMER', 'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
'ACCOUNTING_PRODUCT_BUY_ACCOUNT', 'ACCOUNTING_SERVICE_BUY_ACCOUNT',
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', 'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
'ACCOUNTING_SERVICE_BUY_ACCOUNT', 'ACCOUNTING_VAT_BUY_ACCOUNT',
'ACCOUNTING_SERVICE_SOLD_ACCOUNT', 'ACCOUNTING_VAT_SOLD_ACCOUNT',
'ACCOUNTING_VAT_BUY_ACCOUNT', 'ACCOUNTING_VAT_PAY_ACCOUNT',
'ACCOUNTING_VAT_SOLD_ACCOUNT', 'ACCOUNTING_ACCOUNT_SUSPENSE',
'ACCOUNTING_VAT_PAY_ACCOUNT', 'ACCOUNTING_ACCOUNT_TRANSFER_CASH',
'ACCOUNTING_ACCOUNT_SUSPENSE', 'DONATION_ACCOUNTINGACCOUNT',
'ACCOUNTING_ACCOUNT_TRANSFER_CASH', 'LOAN_ACCOUNTING_ACCOUNT_CAPITAL',
'DONATION_ACCOUNTINGACCOUNT', 'LOAN_ACCOUNTING_ACCOUNT_INTEREST',
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL', 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'
'LOAN_ACCOUNTING_ACCOUNT_INTEREST',
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'
); );
@ -94,7 +97,7 @@ if (GETPOST('change_chart'))
if ($action == 'update') { if ($action == 'update') {
$error = 0; $error = 0;
foreach ( $list_account as $constname ) { foreach ( $list_account_main as $constname ) {
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
@ -102,6 +105,14 @@ if ($action == 'update') {
} }
} }
foreach ( $list_account as $constname ) {
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -114,11 +125,11 @@ if ($action == 'update') {
* View * View
*/ */
llxHeader();
$form = new Form($db); $form = new Form($db);
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
llxHeader();
$linkback = ''; $linkback = '';
print load_fiche_titre($langs->trans('MenuDefaultAccounts'), $linkback, 'title_accountancy'); print load_fiche_titre($langs->trans('MenuDefaultAccounts'), $linkback, 'title_accountancy');
@ -129,16 +140,45 @@ print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
// Define Chart of accounts
// Define main accounts for thirdparty
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
foreach ( $list_account as $key ) { foreach ($list_account_main as $key) {
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
$keydesc=$key.'_Desc';
$htmltext = $langs->trans($keydesc);
print '<td class="fieldrequired" width="50%">';
print $form->textwithpicto($label, $htmltext);
print '</td>';
// Value
print '<td>'; // Do not force align=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>';
print '</tr>';
}
print "</table>\n";
print '<br>';
// Define default accounts
print '<table class="noborder" width="100%">';
foreach ($list_account as $key) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param
$label = $langs->trans($key); $label = $langs->trans($key);
print '<td>' . $label . '</td>'; print '<td width="50%">' . $label . '</td>';
// Value // Value
print '<td>'; // Do not force align=right, or it align also the content of the select box print '<td>'; // Do not force align=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);

View File

@ -371,13 +371,6 @@ if ($id)
print load_fiche_titre($titre,$linkback,$titlepicto); print load_fiche_titre($titre,$linkback,$titlepicto);
if (empty($id))
{
print $langs->trans("DictionaryDesc");
print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
}
print "<br>\n";
// Confirmation de la suppression de la ligne // Confirmation de la suppression de la ligne
if ($action == 'delete') if ($action == 'delete')

View File

@ -48,9 +48,9 @@ $piece_num = GETPOST("piece_num");
$mesg = ''; $mesg = '';
$account_number = GETPOST('account_number'); $account_number = GETPOST('account_number');
$code_tiers = GETPOST('code_tiers'); $subledger_account = GETPOST('subledger_account');
if ($code_tiers == - 1) { if ($subledger_account == - 1) {
$code_tiers = null; $subledger_account = null;
} }
$label_compte = GETPOST('label_compte'); $label_compte = GETPOST('label_compte');
$debit = price2num(GETPOST('debit')); $debit = price2num(GETPOST('debit'));
@ -82,7 +82,7 @@ if ($action == "confirm_update") {
setEventMessages($book->error, $book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} else { } else {
$book->numero_compte = $account_number; $book->numero_compte = $account_number;
$book->code_tiers = $code_tiers; $book->subledger_account = $subledger_account;
$book->label_compte = $label_compte; $book->label_compte = $label_compte;
$book->debit = $debit; $book->debit = $debit;
$book->credit = $credit; $book->credit = $credit;
@ -119,7 +119,7 @@ else if ($action == "add") {
$book = new BookKeeping($db); $book = new BookKeeping($db);
$book->numero_compte = $account_number; $book->numero_compte = $account_number;
$book->code_tiers = $code_tiers; $book->subledger_account = $subledger_account;
$book->label_compte = $label_compte; $book->label_compte = $label_compte;
$book->debit = $debit; $book->debit = $debit;
$book->credit = $credit; $book->credit = $credit;
@ -256,7 +256,7 @@ if ($action == 'create') {
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("AccountancyJournal").'</td>'; print '<td class="fieldrequired">'.$langs->trans("AccountancyJournal").'</td>';
print '<td>'; print '<td>';
print $formaccountancy->select_journal('', 'code_journal', '', 0, '', 1, 1, 1, 1); print $formaccountancy->select_journal('', 'code_journal', '', 0, 1, 1, 1, 1);
print '</td></tr>'; print '</td></tr>';
print '<tr>'; print '<tr>';
@ -368,7 +368,7 @@ if ($action == 'create') {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("AccountAccountingShort")); print_liste_field_titre($langs->trans("AccountAccountingShort"));
print_liste_field_titre($langs->trans("Code_tiers")); print_liste_field_titre($langs->trans("subledger_account"));
print_liste_field_titre($langs->trans("Labelcompte")); print_liste_field_titre($langs->trans("Labelcompte"));
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="right"'); print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="right"');
print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="right"'); print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="right"');
@ -387,10 +387,10 @@ if ($action == 'create') {
if ($action == 'update' && $line->id == $id) { if ($action == 'update' && $line->id == $id) {
print '<td>'; print '<td>';
print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, ''); print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, 'maxwidth300');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $formaccounting->select_auxaccount($line->code_tiers, 'code_tiers', 1); print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1, 'maxwidth300');
print '</td>'; print '</td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>'; print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
print '<td align="right"><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>'; print '<td align="right"><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
@ -403,7 +403,7 @@ if ($action == 'create') {
print '</td>'; print '</td>';
} else { } else {
print '<td>' . length_accountg($line->numero_compte) . '</td>'; print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td>' . length_accounta($line->code_tiers) . '</td>'; print '<td>' . length_accounta($line->subledger_account) . '</td>';
print '<td>' . $line->label_compte . '</td>'; print '<td>' . $line->label_compte . '</td>';
print '<td align="right">' . price($line->debit) . '</td>'; print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>'; print '<td align="right">' . price($line->credit) . '</td>';
@ -431,10 +431,10 @@ if ($action == 'create') {
if ($action == "" || $action == 'add') { if ($action == "" || $action == 'add') {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, 'maxwidth300');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $formaccounting->select_auxaccount($code_tiers, 'code_tiers', 1); print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, 'maxwidth300');
print '</td>'; print '</td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>'; print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>';
print '<td align="right"><input type="text" class="right maxwidth50" name="debit" value="' . price($debit) . '"/></td>'; print '<td align="right"><input type="text" class="right maxwidth50" name="debit" value="' . price($debit) . '"/></td>';

View File

@ -171,15 +171,15 @@ if (! empty($search_accountancy_code_end)) {
$param .= '&search_accountancy_code_end=' . $search_accountancy_code_end; $param .= '&search_accountancy_code_end=' . $search_accountancy_code_end;
} }
if (! empty($search_accountancy_aux_code)) { if (! empty($search_accountancy_aux_code)) {
$filter['t.code_tiers'] = $search_accountancy_aux_code; $filter['t.subledger_account'] = $search_accountancy_aux_code;
$param .= '&search_accountancy_aux_code=' . $search_accountancy_aux_code; $param .= '&search_accountancy_aux_code=' . $search_accountancy_aux_code;
} }
if (! empty($search_accountancy_aux_code_start)) { if (! empty($search_accountancy_aux_code_start)) {
$filter['t.code_tiers>='] = $search_accountancy_aux_code_start; $filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
$param .= '&search_accountancy_aux_code_start=' . $search_accountancy_aux_code_start; $param .= '&search_accountancy_aux_code_start=' . $search_accountancy_aux_code_start;
} }
if (! empty($search_accountancy_aux_code_end)) { if (! empty($search_accountancy_aux_code_end)) {
$filter['t.code_tiers<='] = $search_accountancy_aux_code_end; $filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
$param .= '&search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end; $param .= '&search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end;
} }
if (! empty($search_mvt_label)) { if (! empty($search_mvt_label)) {
@ -322,7 +322,7 @@ if ($action == 'delbookkeepingyear') {
$delyear = dol_print_date(dol_now(), '%Y'); $delyear = dol_print_date(dol_now(), '%Y');
} }
$year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
$journal_array = $formaccounting->selectjournal($deljournal, 'deljournal', '', 1, 'array', 1, 1); $journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1);
$form_question['delyear'] = array ( $form_question['delyear'] = array (
'name' => 'delyear', 'name' => 'delyear',
@ -333,9 +333,9 @@ if ($action == 'delbookkeepingyear') {
); );
$form_question['deljournal'] = array ( $form_question['deljournal'] = array (
'name' => 'deljournal', 'name' => 'deljournal',
'type' => 'select', 'type' => 'other', // We don't use select here, the journal_array is already a select html component
'label' => $langs->trans('DelJournal'), 'label' => $langs->trans('DelJournal'),
'values' => $journal_array, 'value' => $journal_array,
'default' => $deljournal 'default' => $deljournal
); );
@ -365,7 +365,7 @@ $groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/l
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby, '', $limit); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby, '', $limit);
print '<div class="tabsAction">' . "\n"; print '<div class="tabsAction tabsActionNoBottom">' . "\n";
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
print '<div class="inline-block divButAction"><a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param?'&'.$param:'').'">' . $langs->trans("DelBookKeeping") . '</a></div>'; print '<div class="inline-block divButAction"><a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param?'&'.$param:'').'">' . $langs->trans("DelBookKeeping") . '</a></div>';
@ -376,26 +376,35 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>'; print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ': '; print $langs->trans('From') . ': ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1); print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
print '<br>'; print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ': '; print $langs->trans('to') . ': ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1); print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
print '</div>';
print '</td>'; print '</td>';
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>'; print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<div class="nowrap">';
print $langs->trans('From'); print $langs->trans('From');
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
print '<br>'; print '</div>';
print '<div class="nowrap">';
print $langs->trans('to'); print $langs->trans('to');
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
print '</div>';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<div class="nowrap">';
print $langs->trans('From'); print $langs->trans('From');
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
print '<br>'; print '</div>';
print '<div class="nowrap">';
print $langs->trans('to'); print $langs->trans('to');
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
print '</div>';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>'; print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
@ -414,7 +423,7 @@ print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("SubledgerAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
@ -440,14 +449,15 @@ foreach ($object->lines as $line ) {
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>'; print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
print '<td class="nowrap">' . $line->doc_ref . '</td>'; print '<td class="nowrap">' . $line->doc_ref . '</td>';
print '<td>' . length_accountg($line->numero_compte) . '</td>'; print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td>' . length_accounta($line->code_tiers) . '</td>'; print '<td>' . length_accounta($line->subledger_account) . '</td>';
print '<td>' . $line->label_compte . '</td>'; print '<td>' . $line->label_compte . '</td>';
print '<td align="right">' . price($line->debit) . '</td>'; print '<td align="right">' . ($line->debit ? price($line->debit) : ''). '</td>';
print '<td align="right">' . price($line->credit) . '</td>'; print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch('',$line->code_journal); $result = $accountingjournal->fetch('',$line->code_journal);
print '<td align="center">' . $accountingjournal->getNomUrl(0,0,0,'',0) . '</td>'; $journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal);
print '<td align="center">' . $journaltoshow . '</td>';
print '<td align="center">'; print '<td align="center">';
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;'; print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';

View File

@ -75,10 +75,6 @@ if (empty($search_date_end)) $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_
$object = new BookKeeping($db); $object = new BookKeeping($db);
$formaccounting = new FormAccounting($db);
$formother = new FormOther($db);
$form = new Form($db);
$options = ''; $options = '';
$filter = array (); $filter = array ();
@ -126,7 +122,7 @@ if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Bot
* Action * Action
*/ */
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{ {
$search_doc_date = ''; $search_doc_date = '';
$search_accountancy_code = ''; $search_accountancy_code = '';
@ -156,6 +152,10 @@ if ($action == 'delmouvconfirm') {
* View * View
*/ */
$formaccounting = new FormAccounting($db);
$formother = new FormOther($db);
$form = new Form($db);
$title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By")) . ' ' . $langs->trans("AccountAccounting"); $title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By")) . ' ' . $langs->trans("AccountAccounting");
llxHeader('', $title_page); llxHeader('', $title_page);
@ -217,7 +217,7 @@ if ( preg_match('/^asc/i', $sortorder) )
else else
$sortorder = "desc"; $sortorder = "desc";
print '<div class="tabsAction">' . "\n"; print '<div class="tabsAction tabsActionNoBottom">' . "\n";
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
print '</div>'; print '</div>';
@ -257,7 +257,6 @@ print "</tr>\n";
print '</tr>'; print '</tr>';
$var = True;
$total_debit = 0; $total_debit = 0;
$total_credit = 0; $total_credit = 0;
@ -313,14 +312,14 @@ foreach ( $object->lines as $line ) {
// Affiche un lien vers la facture client/fournisseur // Affiche un lien vers la facture client/fournisseur
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
print strlen(length_accounta($line->code_tiers)) == 0 ? '<td>' . $line->label_compte . '</td>' : '<td>' . $line->label_compte . '<br /><span style="font-size:0.8em">(' . length_accounta($line->code_tiers) . ')</span></td>'; print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_compte . '</td>' : '<td>' . $line->label_compte . '<br /><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
print '<td align="right">' . price($line->debit) . '</td>'; print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>';
print '<td align="right">' . price($line->credit) . '</td>'; print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
print '<td align="center">' . $line->code_journal . '</td>'; print '<td align="center">' . $line->code_journal . '</td>';
print '<td align="center">'; print '<td align="center">';
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;'; print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>'; print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -355,6 +354,4 @@ print "</table>";
print '</form>'; print '</form>';
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -52,14 +52,14 @@ $search_numero_compte_end = GETPOST('search_numero_compte_end', 'alpha');
if ($search_numero_compte_end == - 1) { if ($search_numero_compte_end == - 1) {
$search_numero_compte_end = ''; $search_numero_compte_end = '';
} }
$search_code_tiers = GETPOST('search_code_tiers', 'alpha'); $search_subledger_account = GETPOST('search_subledger_account', 'alpha');
$search_code_tiers_start = GETPOST('search_code_tiers_start', 'alpha'); $search_subledger_account_start = GETPOST('search_subledger_account_start', 'alpha');
if ($search_code_tiers_start == - 1) { if ($search_subledger_account_start == - 1) {
$search_code_tiers_start = ''; $search_subledger_account_start = '';
} }
$search_code_tiers_end = GETPOST('search_code_tiers_end', 'alpha'); $search_subledger_account_end = GETPOST('search_subledger_account_end', 'alpha');
if ($search_code_tiers_end == - 1) { if ($search_subledger_account_end == - 1) {
$search_code_tiers_end = ''; $search_subledger_account_end = '';
} }
$search_label_compte = GETPOST('search_label_compte', 'alpha'); $search_label_compte = GETPOST('search_label_compte', 'alpha');
$search_sens = GETPOST('search_sens', 'alpha'); $search_sens = GETPOST('search_sens', 'alpha');
@ -81,15 +81,18 @@ if ($sortfield == "")
$offset = $limit * $page; $offset = $limit * $page;
llxHeader('', $langs->trans("Bookkeeping"));
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers /*
* Actions
*/
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{ {
$search_doc_type = ""; $search_doc_type = "";
$search_doc_date = ""; $search_doc_date = "";
$search_doc_ref = ""; $search_doc_ref = "";
$search_numero_compte = ""; $search_numero_compte = "";
$search_code_tiers = ""; $search_subledger_account = "";
$search_label_compte = ""; $search_label_compte = "";
$search_sens = ""; $search_sens = "";
$search_code_journal = ""; $search_code_journal = "";
@ -129,17 +132,17 @@ if (! empty($search_numero_compte_end)) {
$filter['t.numero_compte<='] = $search_numero_compte_end; $filter['t.numero_compte<='] = $search_numero_compte_end;
$options .= '&amp;search_numero_compte_end=' . $search_numero_compte_end; $options .= '&amp;search_numero_compte_end=' . $search_numero_compte_end;
} }
if (! empty($search_code_tiers)) { if (! empty($search_subledger_account)) {
$filter['t.code_tiers'] = $search_code_tiers; $filter['t.subledger_account'] = $search_subledger_account;
$options .= '&amp;search_code_tiers=' . $search_code_tiers; $options .= '&amp;search_subledger_account=' . $search_subledger_account;
} }
if (! empty($search_code_tiers_start)) { if (! empty($search_subledger_account_start)) {
$filter['t.code_tiers>='] = $search_code_tiers_start; $filter['t.subledger_account>='] = $search_subledger_account_start;
$options .= '&amp;search_code_tiers_start=' . $search_code_tiers_start; $options .= '&amp;search_subledger_account_start=' . $search_subledger_account_start;
} }
if (! empty($search_code_tiers_end)) { if (! empty($search_subledger_account_end)) {
$filter['t.code_tiers<='] = $search_code_tiers_end; $filter['t.subledger_account<='] = $search_subledger_account_end;
$options .= '&amp;search_code_tiers_end=' . $search_code_tiers_end; $options .= '&amp;search_subledger_account_end=' . $search_subledger_account_end;
} }
if (! empty($search_label_compte)) { if (! empty($search_label_compte)) {
$filter['t.label_compte'] = $search_label_compte; $filter['t.label_compte'] = $search_label_compte;
@ -154,10 +157,13 @@ if (! empty($search_code_journal)) {
$options .= '&amp;search_code_journal=' . $search_code_journal; $options .= '&amp;search_code_journal=' . $search_code_journal;
} }
/* /*
* Mode List * Actions
*/ */
llxHeader('', $langs->trans("Bookkeeping"));
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0); $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0);
@ -188,9 +194,9 @@ print $formaccounting->select_account($search_numero_compte_end, 'search_numero_
print '</div>'; print '</div>';
print '<div class="liste_titre">'; print '<div class="liste_titre">';
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formaccounting->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1); print $formaccounting->select_auxaccount($search_subledger_account_start, 'search_subledger_account_start', 1);
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formaccounting->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1); print $formaccounting->select_auxaccount($search_subledger_account_end, 'search_subledger_account_end', 1);
print '</div>'; print '</div>';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
@ -200,7 +206,7 @@ print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "t.doc_t
print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
@ -232,7 +238,7 @@ print '<input type="text" size=6 class="flat" name="search_numero_compte" value=
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_code_tiers" value="' . $search_code_tiers . '"/>'; print '<input type="text" size=6 class="flat" name="search_subledger_account" value="' . $search_subledger_account . '"/>';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -264,8 +270,6 @@ print '</td>';
print "</tr>\n"; print "</tr>\n";
$var = True;
foreach ( $object->lines as $line ) { foreach ( $object->lines as $line ) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -274,7 +278,7 @@ foreach ( $object->lines as $line ) {
print '<td align="center">' . dol_print_date($line->doc_date) . '</td>'; print '<td align="center">' . dol_print_date($line->doc_date) . '</td>';
print '<td>' . $line->doc_ref . '</td>'; print '<td>' . $line->doc_ref . '</td>';
print '<td>' . length_accountg($line->numero_compte) . '</td>'; print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td>' . length_accounta($line->code_tiers) . '</td>'; print '<td>' . length_accounta($line->subledger_account) . '</td>';
print '<td>' . $line->label_compte . '</td>'; print '<td>' . $line->label_compte . '</td>';
print '<td align="right">' . price($line->debit) . '</td>'; print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>'; print '<td align="right">' . price($line->credit) . '</td>';

View File

@ -332,7 +332,7 @@ class AccountancyCategory
} }
/** /**
* Function to show result of an accounting account from the general ledger with a sens and a period * Function to show result of an accounting account from the ledger with a direction and a period
* *
* @param int $cpt Id accounting account * @param int $cpt Id accounting account
* @param string $month Specifig month - Can be empty * @param string $month Specifig month - Can be empty

View File

@ -172,7 +172,7 @@ class AccountancyExport
print $date . $this->separator; print $date . $this->separator;
print $line->doc_ref . $this->separator; print $line->doc_ref . $this->separator;
print length_accountg($line->numero_compte) . $this->separator; print length_accountg($line->numero_compte) . $this->separator;
print length_accounta($line->code_tiers) . $this->separator; print length_accounta($line->subledger_account) . $this->separator;
print price($line->debit) . $this->separator; print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator; print price($line->credit) . $this->separator;
print $line->code_journal . $this->separator; print $line->code_journal . $this->separator;
@ -195,7 +195,7 @@ class AccountancyExport
print $date . $separator; print $date . $separator;
print $line->code_journal . $separator; print $line->code_journal . $separator;
print length_accountg($line->numero_compte) . $separator; print length_accountg($line->numero_compte) . $separator;
print length_accounta($line->code_tiers) . $separator; print length_accounta($line->subledger_account) . $separator;
print $line->sens . $separator; print $line->sens . $separator;
print price($line->montant) . $separator; print price($line->montant) . $separator;
print $line->label_compte . $separator; print $line->label_compte . $separator;
@ -254,7 +254,7 @@ class AccountancyExport
print price($line->debit) . $this->separator; print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator; print price($line->credit) . $this->separator;
print 'E' . $this->separator; print 'E' . $this->separator;
print length_accountg($line->code_tiers) . $this->separator; print length_accountg($line->subledger_account) . $this->separator;
print $this->end_line; print $this->end_line;
} }
} }
@ -274,7 +274,7 @@ class AccountancyExport
$date = dol_print_date($line->doc_date, '%d/%m/%Y'); $date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $this->separator; print $date . $this->separator;
if (empty($line->code_tiers)) { if (empty($line->subledger_account)) {
print 'G' . $this->separator; print 'G' . $this->separator;
print length_accounta($line->numero_compte) . $this->separator; print length_accounta($line->numero_compte) . $this->separator;
} else { } else {
@ -284,7 +284,7 @@ class AccountancyExport
if (substr($line->numero_compte, 0, 3) == '401') { if (substr($line->numero_compte, 0, 3) == '401') {
print 'F' . $this->separator; print 'F' . $this->separator;
} }
print length_accountg($line->code_tiers) . $this->separator; print length_accountg($line->subledger_account) . $this->separator;
} }
print price($line->debit) . $this->separator; print price($line->debit) . $this->separator;
@ -307,11 +307,11 @@ class AccountancyExport
$this->end_line ="\r\n"; $this->end_line ="\r\n";
$i = 1; $i = 1;
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
foreach ( $TData as $data ) { foreach ( $TData as $data ) {
$code_compta = $data->numero_compte; $code_compta = $data->numero_compte;
if (! empty($data->code_tiers)) if (! empty($data->subledger_account))
$code_compta = $data->code_tiers; $code_compta = $data->subledger_account;
$Tab = array (); $Tab = array ();
$Tab['num_ecriture'] = str_pad($i, 5); $Tab['num_ecriture'] = str_pad($i, 5);
@ -349,8 +349,8 @@ class AccountancyExport
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
foreach ( $TData as $data ) { foreach ( $TData as $data ) {
$code_compta = $data->numero_compte; $code_compta = $data->numero_compte;
if (! empty($data->code_tiers)) if (! empty($data->subledger_account))
$code_compta = $data->code_tiers; $code_compta = $data->subledger_account;
$Tab = array (); $Tab = array ();
$Tab['type_ligne'] = 'M'; $Tab['type_ligne'] = 'M';
@ -437,18 +437,20 @@ class AccountancyExport
print $date . $this->separator; print $date . $this->separator;
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator; print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
if (empty($line->code_tiers)) { if (empty($line->subledger_account)) {
print length_accountg($line->numero_compte) . $this->separator; print length_accountg($line->numero_compte) . $this->separator;
} else { } else {
// FIXME Because the subledger_account is already an accounting account, does we really need
// to concat 4011 or 401 to it ?
if (substr($line->numero_compte, 0, 1) == 'C' || substr($line->numero_compte, 0, 1) == '9') { if (substr($line->numero_compte, 0, 1) == 'C' || substr($line->numero_compte, 0, 1) == '9') {
print '411' . substr(str_replace(" ", "", $line->code_tiers), 0, 5) . $this->separator; print '411' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
} }
if (substr($line->numero_compte, 0, 1) == 'F' || substr($line->numero_compte, 0, 1) == '0') { if (substr($line->numero_compte, 0, 1) == 'F' || substr($line->numero_compte, 0, 1) == '0') {
print '401' . substr(str_replace(" ", "", $line->code_tiers), 0, 5) . $this->separator; print '401' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
} }
} }
print length_accounta($line->code_tiers) . $this->separator; print length_accounta($line->subledger_account) . $this->separator;
print price($line->debit) . $this->separator; print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator; print price($line->credit) . $this->separator;
print price($line->montant).$this->separator; print price($line->montant).$this->separator;

View File

@ -62,9 +62,9 @@ class AccountingJournal extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
$sql .= " WHERE"; $sql .= " WHERE";
if ($rowid) { if ($rowid) {
$sql .= " rowid = '" . $rowid . "'"; $sql .= " rowid = " . (int) $rowid;
} elseif ($journal_code) { } elseif ($journal_code) {
$sql .= " code = '" . $journal_code . "'"; $sql .= " code = '" . $this->db->escape($journal_code) . "'";
} }
dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG);

View File

@ -20,14 +20,14 @@
/** /**
* \file htdocs/accountancy/class/bookkeeping.class.php * \file htdocs/accountancy/class/bookkeeping.class.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief File of class to manage general ledger * \brief File of class to manage Ledger (General Ledger and Subledger)
*/ */
// Class // Class
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
/** /**
* Class to manage general ledger * Class to manage Ledger (General Ledger and Subledger)
*/ */
class BookKeeping extends CommonObject class BookKeeping extends CommonObject
{ {
@ -75,7 +75,9 @@ class BookKeeping extends CommonObject
public $doc_ref; public $doc_ref;
public $fk_doc; public $fk_doc;
public $fk_docdet; public $fk_docdet;
public $code_tiers; public $thirdparty_code;
public $subledger_account;
public $subledger_label;
public $numero_compte; public $numero_compte;
public $label_compte; public $label_compte;
public $debit; public $debit;
@ -127,8 +129,14 @@ class BookKeeping extends CommonObject
if (isset($this->fk_docdet)) { if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet); $this->fk_docdet = trim($this->fk_docdet);
} }
if (isset($this->code_tiers)) { if (isset($this->thirdparty_code)) {
$this->code_tiers = trim($this->code_tiers); $this->thirdparty_code = trim($this->thirdparty_code);
}
if (isset($this->subledger_account)) {
$this->subledger_account = trim($this->subledger_account);
}
if (isset($this->subledger_label)) {
$this->subledger_label = trim($this->subledger_label);
} }
if (isset($this->numero_compte)) { if (isset($this->numero_compte)) {
$this->numero_compte = trim($this->numero_compte); $this->numero_compte = trim($this->numero_compte);
@ -176,7 +184,13 @@ class BookKeeping extends CommonObject
} }
else else
{ {
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->fk_doc, $this->doc_type); //$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->doc_ref, $this->label_compte);
$mesg=$this->doc_ref.', '.$langs->trans("AccountAccounting").': '.$this->numero_compte;
if ($this->subledger_account && $this->subledger_account != $this->numero_compte)
{
$mesg.=', '.$langs->trans("SubledgerAccount").': '.$this->subledger_account;
}
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForLine', $mesg);
} }
return -1; return -1;
@ -244,7 +258,9 @@ class BookKeeping extends CommonObject
$sql .= ", doc_ref"; $sql .= ", doc_ref";
$sql .= ", fk_doc"; $sql .= ", fk_doc";
$sql .= ", fk_docdet"; $sql .= ", fk_docdet";
$sql .= ", code_tiers"; $sql .= ", thirdparty_code";
$sql .= ", subledger_account";
$sql .= ", subledger_label";
$sql .= ", numero_compte"; $sql .= ", numero_compte";
$sql .= ", label_compte"; $sql .= ", label_compte";
$sql .= ", debit"; $sql .= ", debit";
@ -259,22 +275,24 @@ class BookKeeping extends CommonObject
$sql .= ', entity'; $sql .= ', entity';
$sql .= ") VALUES ("; $sql .= ") VALUES (";
$sql .= "'" . $this->db->idate($this->doc_date) . "'"; $sql .= "'" . $this->db->idate($this->doc_date) . "'";
$sql .= ",'" . $this->doc_type . "'"; $sql .= ",'" . $this->db->escape($this->doc_type) . "'";
$sql .= ",'" . $this->doc_ref . "'"; $sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
$sql .= "," . $this->fk_doc; $sql .= "," . $this->fk_doc;
$sql .= "," . $this->fk_docdet; $sql .= "," . $this->fk_docdet;
$sql .= ",'" . $this->code_tiers . "'"; $sql .= ",'" . $this->db->escape($this->thirdparty_code) . "'";
$sql .= ",'" . $this->numero_compte . "'"; $sql .= ",'" . $this->db->escape($this->subledger_account) . "'";
$sql .= ",'" . $this->db->escape($this->subledger_label) . "'";
$sql .= ",'" . $this->db->escape($this->numero_compte) . "'";
$sql .= ",'" . $this->db->escape($this->label_compte) . "'"; $sql .= ",'" . $this->db->escape($this->label_compte) . "'";
$sql .= "," . $this->debit; $sql .= "," . $this->debit;
$sql .= "," . $this->credit; $sql .= "," . $this->credit;
$sql .= "," . $this->montant; $sql .= "," . $this->montant;
$sql .= ",'" . $this->sens . "'"; $sql .= ",'" . $this->db->escape($this->sens) . "'";
$sql .= ",'" . $this->fk_user_author . "'"; $sql .= ",'" . $this->db->escape($this->fk_user_author) . "'";
$sql .= ",'" . $this->db->idate($this->date_create). "'"; $sql .= ",'" . $this->db->idate($this->date_create). "'";
$sql .= ",'" . $this->code_journal . "'"; $sql .= ",'" . $this->db->escape($this->code_journal) . "'";
$sql .= ",'" . $this->journal_label . "'"; $sql .= ",'" . $this->db->escape($this->journal_label) . "'";
$sql .= "," . $this->piece_num; $sql .= "," . $this->db->escape($this->piece_num);
$sql .= ", " . (! isset($this->entity) ? '1' : $this->entity); $sql .= ", " . (! isset($this->entity) ? '1' : $this->entity);
$sql .= ")"; $sql .= ")";
@ -360,8 +378,14 @@ class BookKeeping extends CommonObject
if (isset($this->fk_docdet)) { if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet); $this->fk_docdet = trim($this->fk_docdet);
} }
if (isset($this->code_tiers)) { if (isset($this->thirdparty_code)) {
$this->code_tiers = trim($this->code_tiers); $this->thirdparty_code = trim($this->thirdparty_code);
}
if (isset($this->subledger_account)) {
$this->subledger_account = trim($this->subledger_account);
}
if (isset($this->subledger_label)) {
$this->subledger_label = trim($this->subledger_label);
} }
if (isset($this->numero_compte)) { if (isset($this->numero_compte)) {
$this->numero_compte = trim($this->numero_compte); $this->numero_compte = trim($this->numero_compte);
@ -409,7 +433,9 @@ class BookKeeping extends CommonObject
$sql .= 'doc_ref,'; $sql .= 'doc_ref,';
$sql .= 'fk_doc,'; $sql .= 'fk_doc,';
$sql .= 'fk_docdet,'; $sql .= 'fk_docdet,';
$sql .= 'code_tiers,'; $sql .= 'thirdparty,';
$sql .= 'subledger_account,';
$sql .= 'subledger_label,';
$sql .= 'numero_compte,'; $sql .= 'numero_compte,';
$sql .= 'label_compte,'; $sql .= 'label_compte,';
$sql .= 'debit,'; $sql .= 'debit,';
@ -428,8 +454,10 @@ class BookKeeping extends CommonObject
$sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ','; $sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
$sql .= ' ' . (empty($this->fk_doc) ? '0' : $this->fk_doc) . ','; $sql .= ' ' . (empty($this->fk_doc) ? '0' : $this->fk_doc) . ',';
$sql .= ' ' . (empty($this->fk_docdet) ? '0' : $this->fk_docdet) . ','; $sql .= ' ' . (empty($this->fk_docdet) ? '0' : $this->fk_docdet) . ',';
$sql .= ' ' . (! isset($this->code_tiers) ? 'NULL' : "'" . $this->db->escape($this->code_tiers) . "'") . ','; $sql .= ' ' . (! isset($this->thirdparty_code) ? 'NULL' : "'" . $this->db->escape($this->thirdparty_code) . "'") . ',';
$sql .= ' ' . (! isset($this->numero_compte) ? "'NotDefined'" : "'" . $this->db->escape($this->numero_compte) . "'") . ','; $sql .= ' ' . (! isset($this->subledger_account) ? 'NULL' : "'" . $this->db->escape($this->subledger_account) . "'") . ',';
$sql .= ' ' . (! isset($this->subledger_label) ? 'NULL' : "'" . $this->db->escape($this->subledger_label) . "'") . ',';
$sql .= ' ' . (! isset($this->numero_compte) ? "NULL" : "'" . $this->db->escape($this->numero_compte) . "'") . ',';
$sql .= ' ' . (! isset($this->label_compte) ? 'NULL' : "'" . $this->db->escape($this->label_compte) . "'") . ','; $sql .= ' ' . (! isset($this->label_compte) ? 'NULL' : "'" . $this->db->escape($this->label_compte) . "'") . ',';
$sql .= ' ' . (! isset($this->debit) ? 'NULL' : $this->debit ). ','; $sql .= ' ' . (! isset($this->debit) ? 'NULL' : $this->debit ). ',';
$sql .= ' ' . (! isset($this->credit) ? 'NULL' : $this->credit ). ','; $sql .= ' ' . (! isset($this->credit) ? 'NULL' : $this->credit ). ',';
@ -439,7 +467,7 @@ class BookKeeping extends CommonObject
$sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ','; $sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ',';
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ','; $sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ','; $sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->piece_num).','; $sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';
$sql .= ' ' . (! isset($this->entity) ? '1' : $this->entity); $sql .= ' ' . (! isset($this->entity) ? '1' : $this->entity);
$sql .= ')'; $sql .= ')';
@ -498,7 +526,9 @@ class BookKeeping extends CommonObject
$sql .= " t.doc_ref,"; $sql .= " t.doc_ref,";
$sql .= " t.fk_doc,"; $sql .= " t.fk_doc,";
$sql .= " t.fk_docdet,"; $sql .= " t.fk_docdet,";
$sql .= " t.code_tiers,"; $sql .= " t.thirdparty_code,";
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
$sql .= " t.numero_compte,"; $sql .= " t.numero_compte,";
$sql .= " t.label_compte,"; $sql .= " t.label_compte,";
$sql .= " t.debit,"; $sql .= " t.debit,";
@ -532,7 +562,9 @@ class BookKeeping extends CommonObject
$this->doc_ref = $obj->doc_ref; $this->doc_ref = $obj->doc_ref;
$this->fk_doc = $obj->fk_doc; $this->fk_doc = $obj->fk_doc;
$this->fk_docdet = $obj->fk_docdet; $this->fk_docdet = $obj->fk_docdet;
$this->code_tiers = $obj->code_tiers; $this->thirdparty_code = $obj->thirdparty_code;
$this->subledger_account = $obj->subledger_account;
$this->subledger_label = $obj->subledger_label;
$this->numero_compte = $obj->numero_compte; $this->numero_compte = $obj->numero_compte;
$this->label_compte = $obj->label_compte; $this->label_compte = $obj->label_compte;
$this->debit = $obj->debit; $this->debit = $obj->debit;
@ -584,7 +616,9 @@ class BookKeeping extends CommonObject
$sql .= " t.doc_ref,"; $sql .= " t.doc_ref,";
$sql .= " t.fk_doc,"; $sql .= " t.fk_doc,";
$sql .= " t.fk_docdet,"; $sql .= " t.fk_docdet,";
$sql .= " t.code_tiers,"; $sql .= " t.thirdparty_code,";
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
$sql .= " t.numero_compte,"; $sql .= " t.numero_compte,";
$sql .= " t.label_compte,"; $sql .= " t.label_compte,";
$sql .= " t.debit,"; $sql .= " t.debit,";
@ -604,11 +638,11 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key . '=\'' . $this->db->idate($value) . '\''; $sqlwhere[] = $key . '=\'' . $this->db->idate($value) . '\'';
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') { } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\''; $sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.code_tiers>=' || $key == 't.code_tiers<=') { } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key . '\'' . $this->db->escape($value) . '\''; $sqlwhere[] = $key . '\'' . $this->db->escape($value) . '\'';
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key . '=' . $value; $sqlwhere[] = $key . '=' . $value;
} elseif ($key == 't.code_tiers' || $key == 't.numero_compte') { } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
} elseif ($key == 't.label_compte') { } elseif ($key == 't.label_compte') {
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
@ -647,7 +681,9 @@ class BookKeeping extends CommonObject
$line->doc_ref = $obj->doc_ref; $line->doc_ref = $obj->doc_ref;
$line->fk_doc = $obj->fk_doc; $line->fk_doc = $obj->fk_doc;
$line->fk_docdet = $obj->fk_docdet; $line->fk_docdet = $obj->fk_docdet;
$line->code_tiers = $obj->code_tiers; $line->thirdparty_code = $obj->thirdparty_code;
$line->subledger_account = $obj->subledger_account;
$line->subledger_label = $obj->subledger_label;
$line->numero_compte = $obj->numero_compte; $line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte; $line->label_compte = $obj->label_compte;
$line->debit = $obj->debit; $line->debit = $obj->debit;
@ -698,7 +734,9 @@ class BookKeeping extends CommonObject
$sql .= " t.doc_ref,"; $sql .= " t.doc_ref,";
$sql .= " t.fk_doc,"; $sql .= " t.fk_doc,";
$sql .= " t.fk_docdet,"; $sql .= " t.fk_docdet,";
$sql .= " t.code_tiers,"; $sql .= " t.thirdparty_code,";
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
$sql .= " t.numero_compte,"; $sql .= " t.numero_compte,";
$sql .= " t.label_compte,"; $sql .= " t.label_compte,";
$sql .= " t.debit,"; $sql .= " t.debit,";
@ -719,11 +757,11 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key . '=\'' . $this->db->idate($value) . '\''; $sqlwhere[] = $key . '=\'' . $this->db->idate($value) . '\'';
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') { } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\''; $sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.code_tiers>=' || $key == 't.code_tiers<=') { } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key . '\'' . $this->db->escape($value) . '\''; $sqlwhere[] = $key . '\'' . $this->db->escape($value) . '\'';
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key . '=' . $value; $sqlwhere[] = $key . '=' . $value;
} elseif ($key == 't.code_tiers' || $key == 't.numero_compte') { } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
} else { } else {
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
@ -758,7 +796,9 @@ class BookKeeping extends CommonObject
$line->doc_ref = $obj->doc_ref; $line->doc_ref = $obj->doc_ref;
$line->fk_doc = $obj->fk_doc; $line->fk_doc = $obj->fk_doc;
$line->fk_docdet = $obj->fk_docdet; $line->fk_docdet = $obj->fk_docdet;
$line->code_tiers = $obj->code_tiers; $line->thirdparty_code = $obj->thirdparty_code;
$line->subledger_account = $obj->subledger_account;
$line->subledger_label = $obj->subledger_label;
$line->numero_compte = $obj->numero_compte; $line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte; $line->label_compte = $obj->label_compte;
$line->debit = $obj->debit; $line->debit = $obj->debit;
@ -814,11 +854,11 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key . '=\'' . $this->db->idate($value) . '\''; $sqlwhere[] = $key . '=\'' . $this->db->idate($value) . '\'';
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') { } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\''; $sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.code_tiers>=' || $key == 't.code_tiers<=') { } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key . '\'' . $this->db->escape($value) . '\''; $sqlwhere[] = $key . '\'' . $this->db->escape($value) . '\'';
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key . '=' . $value; $sqlwhere[] = $key . '=' . $value;
} elseif ($key == 't.code_tiers' || $key == 't.numero_compte') { } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
} else { } else {
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
@ -890,8 +930,14 @@ class BookKeeping extends CommonObject
if (isset($this->fk_docdet)) { if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet); $this->fk_docdet = trim($this->fk_docdet);
} }
if (isset($this->code_tiers)) { if (isset($this->thirdparty_code)) {
$this->code_tiers = trim($this->code_tiers); $this->thirdparty_code = trim($this->thirdparty_code);
}
if (isset($this->subledger_account)) {
$this->subledger_account = trim($this->subledger_account);
}
if (isset($this->subledger_label)) {
$this->subledger_label = trim($this->subledger_label);
} }
if (isset($this->numero_compte)) { if (isset($this->numero_compte)) {
$this->numero_compte = trim($this->numero_compte); $this->numero_compte = trim($this->numero_compte);
@ -937,7 +983,9 @@ class BookKeeping extends CommonObject
$sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ','; $sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ',';
$sql .= ' fk_doc = ' . (isset($this->fk_doc) ? $this->fk_doc : "null") . ','; $sql .= ' fk_doc = ' . (isset($this->fk_doc) ? $this->fk_doc : "null") . ',';
$sql .= ' fk_docdet = ' . (isset($this->fk_docdet) ? $this->fk_docdet : "null") . ','; $sql .= ' fk_docdet = ' . (isset($this->fk_docdet) ? $this->fk_docdet : "null") . ',';
$sql .= ' code_tiers = ' . (isset($this->code_tiers) ? "'" . $this->db->escape($this->code_tiers) . "'" : "null") . ','; $sql .= ' thirdparty_code = ' . (isset($this->thirdparty_code) ? "'" . $this->db->escape($this->thirdparty_code) . "'" : "null") . ',';
$sql .= ' subledger_account = ' . (isset($this->subledger_account) ? "'" . $this->db->escape($this->subledger_account) . "'" : "null") . ',';
$sql .= ' subledger_label = ' . (isset($this->subledger_label) ? "'" . $this->db->escape($this->subledger_label) . "'" : "null") . ',';
$sql .= ' numero_compte = ' . (isset($this->numero_compte) ? "'" . $this->db->escape($this->numero_compte) . "'" : "null") . ','; $sql .= ' numero_compte = ' . (isset($this->numero_compte) ? "'" . $this->db->escape($this->numero_compte) . "'" : "null") . ',';
$sql .= ' label_compte = ' . (isset($this->label_compte) ? "'" . $this->db->escape($this->label_compte) . "'" : "null") . ','; $sql .= ' label_compte = ' . (isset($this->label_compte) ? "'" . $this->db->escape($this->label_compte) . "'" : "null") . ',';
$sql .= ' debit = ' . (isset($this->debit) ? $this->debit : "null") . ','; $sql .= ' debit = ' . (isset($this->debit) ? $this->debit : "null") . ',';
@ -1196,8 +1244,10 @@ class BookKeeping extends CommonObject
$this->doc_ref = ''; $this->doc_ref = '';
$this->fk_doc = ''; $this->fk_doc = '';
$this->fk_docdet = ''; $this->fk_docdet = '';
$this->code_tiers = ''; $this->thirdparty_code = 'CU001';
$this->numero_compte = ''; $this->subledger_account = '410CU001';
$this->subledger_label = 'My customer company';
$this->numero_compte = '410';
$this->label_compte = ''; $this->label_compte = '';
$this->debit = 99.9; $this->debit = 99.9;
$this->credit = ''; $this->credit = '';
@ -1205,8 +1255,8 @@ class BookKeeping extends CommonObject
$this->sens = ''; $this->sens = '';
$this->fk_user_author = $user->id; $this->fk_user_author = $user->id;
$this->import_key = ''; $this->import_key = '';
$this->code_journal = ''; $this->code_journal = 'VT';
$this->journal_label = ''; $this->journal_label = 'Journal de vente';
$this->piece_num = ''; $this->piece_num = '';
} }
@ -1281,7 +1331,7 @@ class BookKeeping extends CommonObject
global $conf; global $conf;
$sql = "SELECT rowid, doc_date, doc_type,"; $sql = "SELECT rowid, doc_date, doc_type,";
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,"; $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
$sql .= " numero_compte, label_compte, debit, credit,"; $sql .= " numero_compte, label_compte, debit, credit,";
$sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num"; $sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
@ -1303,7 +1353,9 @@ class BookKeeping extends CommonObject
$line->doc_ref = $obj->doc_ref; $line->doc_ref = $obj->doc_ref;
$line->fk_doc = $obj->fk_doc; $line->fk_doc = $obj->fk_doc;
$line->fk_docdet = $obj->fk_docdet; $line->fk_docdet = $obj->fk_docdet;
$line->code_tiers = $obj->code_tiers; $line->thirdparty_code = $obj->thirdparty_code;
$line->subledger_account = $obj->subledger_account;
$line->subledger_label = $obj->subledger_label;
$line->numero_compte = $obj->numero_compte; $line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte; $line->label_compte = $obj->label_compte;
$line->debit = $obj->debit; $line->debit = $obj->debit;
@ -1335,7 +1387,7 @@ class BookKeeping extends CommonObject
global $conf; global $conf;
$sql = "SELECT rowid, doc_date, doc_type,"; $sql = "SELECT rowid, doc_date, doc_type,";
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,"; $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
$sql .= " numero_compte, label_compte, debit, credit,"; $sql .= " numero_compte, label_compte, debit, credit,";
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
@ -1359,7 +1411,9 @@ class BookKeeping extends CommonObject
$line->doc_ref = $obj->doc_ref; $line->doc_ref = $obj->doc_ref;
$line->fk_doc = $obj->fk_doc; $line->fk_doc = $obj->fk_doc;
$line->fk_docdet = $obj->fk_docdet; $line->fk_docdet = $obj->fk_docdet;
$line->code_tiers = $obj->code_tiers; $line->thirdparty_code = $obj->thirdparty_code;
$line->subledger_account = $obj->subledger_account;
$line->subledger_label = $obj->subledger_label;
$line->numero_compte = $obj->numero_compte; $line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte; $line->label_compte = $obj->label_compte;
$line->debit = $obj->debit; $line->debit = $obj->debit;
@ -1547,7 +1601,9 @@ class BookKeepingLine
public $doc_ref; public $doc_ref;
public $fk_doc; public $fk_doc;
public $fk_docdet; public $fk_docdet;
public $code_tiers; public $thirdparty_code;
public $subledger_account;
public $subledger_label;
public $numero_compte; public $numero_compte;
public $label_compte; public $label_compte;
public $debit; public $debit;

View File

@ -63,8 +63,6 @@ print load_fiche_titre($langs->trans("AccountancyArea"), '', 'title_accountancy'
$step = 0; $step = 0;
print "<br>\n";
print $langs->trans("AccountancyAreaDescIntro")."<br>\n"; print $langs->trans("AccountancyAreaDescIntro")."<br>\n";
print "<br>\n";print "<br>\n"; print "<br>\n";print "<br>\n";

View File

@ -103,8 +103,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
} }
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); $idpays = $mysoc->country_id;
$idpays = $p[0];
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,"; $sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
@ -144,6 +143,7 @@ $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
// Variables // Variables
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); $account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
$account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); $account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
@ -364,7 +364,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->date_create = $now; $bookkeeping->date_create = $now;
if ($tabtype[$key] == 'payment') { if ($tabtype[$key] == 'payment') {
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$sqlmid = 'SELECT fac.facnumber'; $sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac"; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac";
@ -378,7 +378,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->doc_ref = $objmid->facnumber; // Ref of invoice $bookkeeping->doc_ref = $objmid->facnumber; // Ref of invoice
} }
} else if ($tabtype[$key] == 'payment_supplier') { } else if ($tabtype[$key] == 'payment_supplier') {
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$sqlmid = 'SELECT facf.ref_supplier, facf.ref'; $sqlmid = 'SELECT facf.ref_supplier, facf.ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf"; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf";
@ -392,7 +392,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; // Ref on invoice $bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; // Ref on invoice
} }
} else if ($tabtype[$key] == 'payment_expensereport') { } else if ($tabtype[$key] == 'payment_expensereport') {
$bookkeeping->code_tiers = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$sqlmid = 'SELECT e.ref'; $sqlmid = 'SELECT e.ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "expensereport as e"; $sqlmid .= " FROM " . MAIN_DB_PREFIX . "expensereport as e";
@ -405,13 +405,13 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->doc_ref = $objmid->ref; // Ref of expensereport $bookkeeping->doc_ref = $objmid->ref; // Ref of expensereport
} }
} else if ($tabtype[$key] == 'payment_vat') { } else if ($tabtype[$key] == 'payment_vat') {
$bookkeeping->code_tiers = ''; $bookkeeping->subledger_account = '';
$bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat payment $bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat payment
} else if ($tabtype[$key] == 'payment_donation') { } else if ($tabtype[$key] == 'payment_donation') {
$bookkeeping->code_tiers = ''; $bookkeeping->subledger_account = '';
$bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation $bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation
} else if ($tabtype[$key] == 'payment_salary') { } else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->code_tiers = ''; $bookkeeping->subledger_account = '';
$bookkeeping->label_compte = $tabuser[$key]['name']; $bookkeeping->label_compte = $tabuser[$key]['name'];
$bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Ref of salary payment $bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Ref of salary payment
} }
@ -458,7 +458,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->date_create = $now; $bookkeeping->date_create = $now;
if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
$bookkeeping->code_tiers = ''; $bookkeeping->subledger_account = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
} else if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice } else if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
$sqlmid = 'SELECT fac.facnumber'; $sqlmid = 'SELECT fac.facnumber';
@ -472,7 +472,7 @@ if (! $error && $action == 'writebookkeeping') {
$objmid = $db->fetch_object($resultmid); $objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->facnumber; $bookkeeping->doc_ref = $objmid->facnumber;
} }
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice } else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
$sqlmid = 'SELECT facf.ref_supplier,facf.ref'; $sqlmid = 'SELECT facf.ref_supplier,facf.ref';
@ -486,23 +486,23 @@ if (! $error && $action == 'writebookkeeping') {
$objmid = $db->fetch_object($resultmid); $objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; $bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
} }
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
} else if ($tabtype[$key] == 'payment_vat') { } else if ($tabtype[$key] == 'payment_vat') {
$bookkeeping->code_tiers = ''; $bookkeeping->subledger_account = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat $bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat
} else if ($tabtype[$key] == 'payment_donation') { } else if ($tabtype[$key] == 'payment_donation') {
$bookkeeping->code_tiers = ''; $bookkeeping->subledger_account = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation $bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation
} else if ($tabtype[$key] == 'payment_salary') { } else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->code_tiers = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = $tabuser[$key]['name']; $bookkeeping->label_compte = $tabuser[$key]['name'];
$bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Rowid of salary payment $bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Rowid of salary payment
} else if ($tabtype[$key] == 'banktransfert') { } else if ($tabtype[$key] == 'banktransfert') {
$bookkeeping->code_tiers = ''; $bookkeeping->subledger_account = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
} else { } else {
// FIXME Should be a temporary account ??? // FIXME Should be a temporary account ???
@ -537,6 +537,12 @@ if (! $error && $action == 'writebookkeeping') {
else else
{ {
$db->rollback(); $db->rollback();
if ($error >= 10)
{
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
break; // Break in the foreach
}
} }
} }
@ -758,7 +764,7 @@ if (empty($action) || $action == 'view') {
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />'; print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}*/ }*/
print '<div class="tabsAction">'; print '<div class="tabsAction tabsActionNoBottom">';
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
print '</div>'; print '</div>';

View File

@ -86,21 +86,21 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
} }
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); $idpays = $mysoc->country_id;
$idpays = $p[0];
$sql = "SELECT er.rowid, er.ref, er.date_debut as de,"; $sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation,"; $sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation, erd.vat_src_code, ";
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,"; $sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
$sql .= " f.accountancy_code, ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; $sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,";
//$sql .= " ct.accountancy_code_buy as account_tva";
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON erd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; //$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON erd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
$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 aa.rowid = erd.fk_code_ventilation"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
$sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; $sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_author"; $sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_author";
$sql .= " WHERE er.fk_statut > 0 "; $sql .= " WHERE er.fk_statut > 0";
$sql .= " AND erd.fk_code_ventilation > 0 "; $sql .= " AND erd.fk_code_ventilation > 0";
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy $sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
if ($date_start && $date_end) if ($date_start && $date_end)
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'"; $sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
@ -110,7 +110,8 @@ dol_syslog('accountancy/journal/expensereportsjournal.php:: $sql=' . $sql);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
// les variables
// Variables
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef"); $account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef");
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef"); $account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
@ -128,10 +129,15 @@ if ($result) {
// Controls // Controls
$compta_user = (! empty($obj->user_accountancy_account)) ? $obj->user_accountancy_account : $account_salary; $compta_user = (! empty($obj->user_accountancy_account)) ? $obj->user_accountancy_account : $account_salary;
$compta_fees = $obj->compte; $compta_fees = $obj->compte;
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $account_vat);
// Define array for display vat tx $vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
$def_tva[$obj->rowid]=price($obj->tva_tx); $compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $account_vat);
// Define array to display all VAT rates that use this accounting account $compta_tva
if ((! price2num($obj->tva_tx)) || ! empty($obj->vat_src_code))
{
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
}
$taber[$obj->rowid]["date"] = $db->jdate($obj->de); $taber[$obj->rowid]["date"] = $db->jdate($obj->de);
$taber[$obj->rowid]["ref"] = $obj->ref; $taber[$obj->rowid]["ref"] = $obj->ref;
@ -175,7 +181,8 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'expense_report'; $bookkeeping->doc_type = 'expense_report';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->fk_docdet = $val["fk_expensereportdet"];
$bookkeeping->code_tiers = $tabuser[$key]['user_accountancy_code']; $bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['user_accountancy_code'];
$bookkeeping->label_compte = $tabuser[$key]['name']; $bookkeeping->label_compte = $tabuser[$key]['name'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
@ -222,7 +229,8 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'expense_report'; $bookkeeping->doc_type = 'expense_report';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->fk_docdet = $val["fk_expensereportdet"];
$bookkeeping->code_tiers = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
@ -267,8 +275,9 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'expense_report'; $bookkeeping->doc_type = 'expense_report';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->fk_docdet = $val["fk_expensereportdet"];
$bookkeeping->code_tiers = ''; $bookkeeping->subledger_account = '';
$bookkeeping->label_compte = $langs->trans("VAT"). ' '.$def_tva[$key]; $bookkeeping->subledger_label = '';
$bookkeeping->label_compte = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@ -304,6 +313,12 @@ if ($action == 'writebookkeeping') {
else else
{ {
$db->rollback(); $db->rollback();
if ($error >= 10)
{
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
break; // Break in the foreach
}
} }
} }
@ -462,7 +477,7 @@ if (empty($action) || $action == 'view') {
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />'; print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}*/ }*/
print '<div class="tabsAction">'; print '<div class="tabsAction tabsActionNoBottom">';
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
print '</div>'; print '</div>';
@ -553,7 +568,7 @@ if (empty($action) || $action == 'view') {
} }
else print $accountoshow; else print $accountoshow;
print "</td>"; print "</td>";
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]. "</td>"; print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>"; print "</tr>";
@ -576,7 +591,7 @@ if (empty($action) || $action == 'view') {
} }
else print $accountoshow; else print $accountoshow;
print "</td>"; print "</td>";
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("Code_tiers") . "</td>"; print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("subledger_account") . "</td>";
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>"; print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>"; print "</tr>";

View File

@ -85,26 +85,27 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
} }
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); $idpays = $mysoc->country_id;
$idpays = $p[0];
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier,"; $sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier,";
$sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,"; $sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " p.accountancy_code_buy , ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; $sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
//$sql .= " ct.accountancy_code_buy as account_tva";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; //$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; $sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " WHERE f.fk_statut > 0 "; $sql .= " WHERE f.fk_statut > 0"; // TODO Facture annulée ?
$sql .= " AND fd.fk_code_ventilation > 0 "; $sql .= " AND fd.fk_code_ventilation > 0";
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy $sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2)"; $sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")";
else } else {
$sql .= " AND f.type IN (0,1,2,3)"; $sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_DEPOSIT . "," . FactureFournisseur::TYPE_SITUATION . ")";
}
if ($date_start && $date_end) if ($date_start && $date_end)
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'"; $sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
$sql .= " ORDER BY f.datef"; $sql .= " ORDER BY f.datef";
@ -114,7 +115,7 @@ $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
// les variables // Variables
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"); $cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef"); $cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
@ -129,7 +130,7 @@ if ($result) {
while ( $i < $num ) { while ( $i < $num ) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
// contrôles // Controls
$compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour; $compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour;
$compta_prod = $obj->compte; $compta_prod = $obj->compte;
@ -139,10 +140,15 @@ if ($result) {
else else
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"); $compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef");
} }
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
//Define array for display vat tx $vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
$def_tva[$obj->rowid]=price($obj->tva_tx); $compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
// Define array to display all VAT rates that use this accounting account $compta_tva
if ((! price2num($obj->tva_tx)) || ! empty($obj->vat_src_code))
{
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
}
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df); $tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')'; $tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
@ -214,9 +220,11 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur']; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers"); $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
$bookkeeping->numero_compte = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_label = ''; // TODO To complete
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account");
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt <= 0) ? $mt : 0; $bookkeeping->debit = ($mt <= 0) ? $mt : 0;
@ -261,7 +269,9 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->code_tiers = ''; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label; $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
@ -306,8 +316,10 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->code_tiers = ''; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@ -343,6 +355,12 @@ if ($action == 'writebookkeeping') {
else else
{ {
$db->rollback(); $db->rollback();
if ($error >= 10)
{
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
break; // Break in the foreach
}
} }
} }
@ -479,7 +497,7 @@ $companystatic = new Fournisseur($db);
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("subledger_account") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . ($mt >= 0 ? price($mt) : '') . '"';
} }
@ -518,8 +536,18 @@ if (empty($action) || $action == 'view') {
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />'; print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}*/ }*/
print '<div class="tabsAction">'; // Button to write into Ledger
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
}
print '<div class="tabsAction tabsActionNoBottom">';
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
}
else {
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
}
print '</div>'; print '</div>';
print ' print '
@ -612,7 +640,7 @@ if (empty($action) || $action == 'view') {
} }
else print $accountoshow; else print $accountoshow;
print "</td>"; print "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]. "</td>"; print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>"; print "</tr>";
@ -635,7 +663,7 @@ if (empty($action) || $action == 'view') {
} }
else print $accountoshow; else print $accountoshow;
print "</td>"; print "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers") . "</td>"; print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account") . "</td>";
// print "</td><td>" . $langs->trans("ThirdParty"); // print "</td><td>" . $langs->trans("ThirdParty");
// print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')'; // print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
// print "</td>"; // print "</td>";

View File

@ -89,27 +89,26 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
} }
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); $idpays = $mysoc->country_id;
$idpays = $p[0];
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,"; $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,"; $sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
$sql .= " fd.situation_percent,ct.accountancy_code_sell as account_tva"; //$sql .= " ct.accountancy_code_sell as account_tva";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; $sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; //$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON ((fd.vat_src_code <> '' AND fd.vat_src_code = ct.code) OR (fd.vat_src_code = '' AND fd.tva_tx = ct.taux)) AND ct.fk_pays = '" . $idpays . "'";
$sql .= " WHERE fd.fk_code_ventilation > 0"; $sql .= " WHERE fd.fk_code_ventilation > 0";
$sql .= " AND f.entity IN (".getEntity('facture', 0).')'; // We don't share object for accountancy $sql .= " AND f.entity IN (".getEntity('facture', 0).')'; // We don't share object for accountancy
$sql .= " AND f.fk_statut > 0"; // TODO Facture annulée ? $sql .= " AND f.fk_statut > 0"; // TODO Facture annulée ?
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
} else { } else {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
} }
$sql .= " AND fd.product_type IN (0,1)"; $sql .= " AND fd.product_type IN (0,1)";
if ($date_start && $date_end) if ($date_start && $date_end)
@ -127,29 +126,34 @@ if ($result) {
$tabcompany = array (); $tabcompany = array ();
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0;
// Variables
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"); $cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
$i = 0;
while ( $i < $num ) { while ( $i < $num ) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
// les variables // Controls
$compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli; $compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
$compta_prod = $obj->compte; $compta_prod = $obj->compte;
if (empty($compta_prod)) { if (empty($compta_prod)) {
if ($obj->product_type == 0) if ($obj->product_type == 0)
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"); $compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
else else
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"); $compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
} }
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
//Define array for display vat tx // Define array to display all VAT rates that use this accounting account $compta_tva
$def_tva[$obj->rowid]=price($obj->tva_tx); if ((! price2num($obj->tva_tx)) || ! empty($obj->vat_src_code))
{
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
}
// Situation invoices handling // Situation invoices handling
$line = new FactureLigne($db); $line = new FactureLigne($db);
@ -231,10 +235,11 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'customer_invoice'; $bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->code_tiers = $tabcompany[$key]['code_client']; $bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->numero_compte = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
// $bookkeeping->label_compte = $tabcompany[$key]['name']; $bookkeeping->subledger_label = ''; // TODO To complete
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers"); $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account");
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->debit = ($mt >= 0) ? $mt : 0;
@ -277,7 +282,9 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'customer_invoice'; $bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add;
$bookkeeping->code_tiers = ''; $bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label; $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
@ -321,9 +328,11 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'customer_invoice'; $bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->code_tiers = ''; $bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key]; $bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]);
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? $mt : 0; $bookkeeping->debit = ($mt < 0) ? $mt : 0;
@ -358,6 +367,12 @@ if ($action == 'writebookkeeping') {
else else
{ {
$db->rollback(); $db->rollback();
if ($error >= 10)
{
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
break; // Break in the foreach
}
} }
} }
@ -416,7 +431,7 @@ $form = new Form($db);
print length_accounta(html_entity_decode($k)) . $sep; print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'C' : 'D') . $sep; print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep; print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . $sep;
print $val["ref"]; print $val["ref"];
print "\n"; print "\n";
} }
@ -469,7 +484,7 @@ $form = new Form($db);
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n"; print "\n";
@ -535,8 +550,19 @@ if (empty($action) || $action == 'view') {
} else { } else {
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />'; print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}*/ }*/
print '<div class="tabsAction">';
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; // Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
}
print '<div class="tabsAction tabsActionNoBottom">';
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
}
else {
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
}
print '</div>'; print '</div>';
print ' print '
@ -602,7 +628,7 @@ if (empty($action) || $action == 'view') {
// print "</td><td>" . $langs->trans("ThirdParty"); // print "</td><td>" . $langs->trans("ThirdParty");
// print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')'; // print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
print '</td>'; print '</td>';
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . "</td>"; print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>"; print "</tr>";
@ -649,7 +675,7 @@ if (empty($action) || $action == 'view') {
} }
else print $accountoshow; else print $accountoshow;
print "</td>"; print "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . ' '.$def_tva[$key]. "</td>"; print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . ' '.join(', ',$def_tva[$key][$k]). "</td>";
// print "<td>" . $langs->trans("VAT") . "</td>"; // print "<td>" . $langs->trans("VAT") . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";

View File

@ -1502,9 +1502,12 @@ if ($id)
} }
$class='tddict'; $class='tddict';
if ($fieldlist[$field] == 'note' && $id == 10) $class.=' tdoverflowmax200';
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto'; if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
if ($fieldlist[$field] == 'code') $class.=' width100'; if ($fieldlist[$field] == 'code') $class.=' width100';
if ($fieldlist[$field] == 'position') $class.=' right'; if ($fieldlist[$field] == 'position') $class.=' right';
if ($fieldlist[$field] == 'localtax1_type') $class.=' nowrap';
if ($fieldlist[$field] == 'localtax2_type') $class.=' nowrap';
// Show value for field // Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>'; if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
} }
@ -1694,7 +1697,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
} // For state page, we do not show the country input (we link to region, not country) } // For state page, we do not show the country input (we link to region, not country)
print '<td>'; print '<td>';
$fieldname='country'; $fieldname='country';
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth150 maxwidthonsmartphone');
print '</td>'; print '</td>';
} }
elseif ($fieldlist[$field] == 'country_id') elseif ($fieldlist[$field] == 'country_id')
@ -1820,7 +1823,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
{ {
$fieldname = $fieldlist[$field]; $fieldname = $fieldlist[$field];
$accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0); $accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0);
print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); print $formaccounting->select_account($accountancy_account, '.'.$fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
} }
else else
{ {

View File

@ -262,21 +262,23 @@ if ($id > 0)
print '</tr>'; print '</tr>';
} }
// Assujeti a TVA ou pas // VAT is used
print '<tr>'; print '<tr>';
print '<td class="nowrap">'.$langs->trans('VATIsUsed').'</td><td>'; print '<td class="nowrap">'.$langs->trans('VATIsUsed').'</td>';
print '<td>';
print yn($object->tva_assuj); print yn($object->tva_assuj);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Local Taxes // Local Taxes
if ($mysoc->useLocalTax(1)) // TODO Move this on same record than VATIsUsed
if ($mysoc->localtax1_assuj=="1")
{ {
print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td>'; print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td>';
print yn($object->localtax1_assuj); print yn($object->localtax1_assuj);
print '</td></tr>'; print '</td></tr>';
} }
if ($mysoc->useLocalTax(2)) if ($mysoc->localtax1_assuj=="1")
{ {
print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).'</td><td>'; print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).'</td><td>';
print yn($object->localtax2_assuj); print yn($object->localtax2_assuj);

View File

@ -524,7 +524,7 @@ if ($action == 'create')
{ {
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>'; print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 0, 0); print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
print '</td></tr>'; print '</td></tr>';
} }
@ -982,7 +982,7 @@ else
{ {
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>'; print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 0, 0); print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -54,15 +54,14 @@ class FormAccounting extends Form
* @param string $htmlname Name of field in html form * @param string $htmlname Name of field in html form
* @param int $nature Limit the list to a particular type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new) * @param int $nature Limit the list to a particular type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new)
* @param int $showempty Add an empty field * @param int $showempty Add an empty field
* @param array $event Event options
* @param int $select_in 0=selectid value is the journal rowid (default) or 1=selectid is journal code * @param int $select_in 0=selectid value is the journal rowid (default) or 1=selectid is journal code
* @param int $select_out Set value returned by select. 0=rowid (default), 1=code * @param int $select_out Set value returned by select. 0=rowid (default), 1=code
* @param string $morecss More css non HTML object * @param string $morecss More css non HTML object
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
* * @param int $disabledajaxcombo Disable ajax combo box.
* @return string String with HTML select * @return string String with HTML select
*/ */
function select_journal($selectid, $htmlname = 'journal', $nature=0, $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='') function select_journal($selectid, $htmlname = 'journal', $nature=0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='', $disabledajaxcombo=0)
{ {
global $conf; global $conf;
@ -92,8 +91,6 @@ class FormAccounting extends Form
return -1; return -1;
} }
$out = ajax_combobox($htmlname, $event);
$selected = 0; $selected = 0;
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
@ -125,7 +122,7 @@ class FormAccounting extends Form
} }
} }
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, ($disabledajaxcombo?0:1));
return $out; return $out;
} }
@ -205,7 +202,7 @@ class FormAccounting extends Form
dol_print_error($db,$db->lasterror()); dol_print_error($db,$db->lasterror());
} }
$out .= ajax_combobox($htmlname, $event); $out .= ajax_combobox($htmlname, array());
print $out; print $out;
} }
@ -244,7 +241,7 @@ class FormAccounting extends Form
* Return list of accounts with label by chart of accounts * Return list of accounts with label by chart of accounts
* *
* @param string $selectid Preselected id or code of accounting accounts (depends on $select_in) * @param string $selectid Preselected id or code of accounting accounts (depends on $select_in)
* @param string $htmlname Name of field in html form * @param string $htmlname Name of HTML field id. If name start with '.', it is name of HTML css class, so several component with same name in different forms can be used.
* @param int $showempty Add an empty field * @param int $showempty Add an empty field
* @param array $event Event options * @param array $event Event options
* @param int $select_in 0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number * @param int $select_in 0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number
@ -287,8 +284,6 @@ class FormAccounting extends Form
return -1; return -1;
} }
$out .= ajax_combobox($htmlname, $event);
$selected = 0; $selected = 0;
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
@ -330,14 +325,13 @@ class FormAccounting extends Form
/** /**
* Return list of auxilary thirdparty accounts * Return list of auxilary thirdparty accounts
* *
* @param string $selectid Preselected pcg_type * @param string $selectid Preselected pcg_type
* @param string $htmlname Name of field in html form * @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field * @param int $showempty Add an empty field
* @param array $event Event options * @param string $morecss More css
* * @return string String with HTML select
* @return string String with HTML select
*/ */
function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) { function select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, $morecss='maxwidth200') {
$aux_account = array(); $aux_account = array();
@ -382,8 +376,7 @@ class FormAccounting extends Form
$this->db->free($resql); $this->db->free($resql);
// Build select // Build select
$out = ajax_combobox($htmlname, $event); $out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
$out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
return $out; return $out;
} }

View File

@ -4099,29 +4099,49 @@ function get_localtax_by_third($local)
/** /**
* Get vat rate and npr from id. * Get vat main information from Id.
* You can call getLocalTaxesFromRate after to get other fields * You can call getLocalTaxesFromRate after to get other fields.
* *
* @param int $vatrowid Line ID into vat rate table. * @param int|string $vatrate VAT ID or Rate. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123.
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) * @param Societe $buyer Company object
* @param Societe $seller Company object
* @param int $firstparamisid 1 if first param is id into table (use this if you can)
* @return array array('rowid'=> , 'code'=> ...)
* @see getLocalTaxesFromRate
*/ */
function getTaxesFromId($vatrowid) function getTaxesFromId($vatrate, $buyer=null, $seller=null, $firstparamisid=1)
{ {
global $db, $mysoc; global $db, $mysoc;
dol_syslog("getTaxesFromId vatrowid=".$vatrowid); dol_syslog("getTaxesFromId vatrowid=".$vatrate);
// Search local taxes // Search local taxes
$sql = "SELECT t.rowid, t.code, t.taux as rate, t.recuperableonly as npr"; $sql = "SELECT t.rowid, t.code, t.taux as rate, t.recuperableonly as npr, t.accountancy_code_sell, t.accountancy_code_buy";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t"; $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t";
$sql.= " WHERE t.rowid ='".$vatrowid."'"; if ($firstparamisid) $sql.= " WHERE t.rowid = ".(int) $vatrate;
else
{
$vatratecleaned = $vatrate;
$vatratecode = '';
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)"
{
$vatratecleaned = $reg[1];
$vatratecode = $reg[2];
}
$sql.=", ".MAIN_DB_PREFIX."c_country as c";
if ($mysoc->country_code == 'ES') $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // local tax in spain use the buyer country ??
else $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'";
$sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
if ($vatratecode) $sql.= " AND t.code = '".$vatratecode."'";
}
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj) return array('rowid'=>$obj->rowid, 'code'=>$obj->code, 'rate'=>$obj->rate, 'npr'=>$obj->npr, 'accountancy_code_sell'=>$obj->accountancy_code_sell, 'accountancy_code_buy'=>$obj->accountancy_code_buy);
return array('rowid'=>$obj->rowid, 'code'=>$obj->code, 'rate'=>$obj->rate, 'npr'=>$obj->npr); else return array();
} }
else dol_print_error($db); else dol_print_error($db);
@ -4135,12 +4155,13 @@ function getTaxesFromId($vatrowid)
* Instead this function must be called when adding a line to get the array of localtax and type, and then * Instead this function must be called when adding a line to get the array of localtax and type, and then
* provide it to the function calcul_price_total. * provide it to the function calcul_price_total.
* *
* @param string $vatrate VAT Rate. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123. * @param int|string $vatrate VAT ID or Rate. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123.
* @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2) * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
* @param Societe $buyer Company object * @param Societe $buyer Company object
* @param Societe $seller Company object * @param Societe $seller Company object
* @param int $firstparamisid 1 if first param is id into table (use this if you can) * @param int $firstparamisid 1 if first param is id into table (use this if you can)
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
* @see getTaxesFromId
*/ */
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0) function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
{ {
@ -4148,25 +4169,25 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local); dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local);
$vatratecleaned = $vatrate;
$vatratecode = '';
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)"
{
$vatratecleaned = $reg[1];
$vatratecode = $reg[2];
}
// Search local taxes // Search local taxes
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
if ($firstparamisid) $sql.= " WHERE t.rowid ='".$vatrate."'"; if ($firstparamisid) $sql.= " WHERE t.rowid = ".(int) $vatrate;
else else
{ {
$vatratecleaned = $vatrate;
$vatratecode = '';
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)"
{
$vatratecleaned = $reg[1];
$vatratecode = $reg[2];
}
$sql.=", ".MAIN_DB_PREFIX."c_country as c"; $sql.=", ".MAIN_DB_PREFIX."c_country as c";
if ($mysoc->country_code == 'ES') $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // local tax in spain use the buyer country ?? if ($mysoc->country_code == 'ES') $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // local tax in spain use the buyer country ??
else $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; else $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'";
$sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; $sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'"; if ($vatratecode) $sql.= " AND t.code = '".$vatratecode."'";
} }
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -244,7 +244,7 @@ class modAccounting extends DolibarrModules
*/ */
$this->rights[$r][0] = 50411; $this->rights[$r][0] = 50411;
$this->rights[$r][1] = 'Read operations in General Ledger'; $this->rights[$r][1] = 'Read operations in Ledger';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'mouvements'; $this->rights[$r][4] = 'mouvements';
@ -252,7 +252,7 @@ class modAccounting extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 50412; $this->rights[$r][0] = 50412;
$this->rights[$r][1] = 'Write/Edit operations in General Ledger'; $this->rights[$r][1] = 'Write/Edit operations in Ledger';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'mouvements'; $this->rights[$r][4] = 'mouvements';
@ -260,7 +260,7 @@ class modAccounting extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 50420; $this->rights[$r][0] = 50420;
$this->rights[$r][1] = 'Report and export reports (turnover, balance, journals, general ledger)'; $this->rights[$r][1] = 'Report and export reports (turnover, balance, journals, ledger)';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'comptarapport'; $this->rights[$r][4] = 'comptarapport';

View File

@ -90,6 +90,8 @@ ALTER TABLE llx_expedition ADD COLUMN fk_projet integer DEFAULT NULL after fk_so
ALTER TABLE llx_expensereport ADD COLUMN import_key varchar(14); ALTER TABLE llx_expensereport ADD COLUMN import_key varchar(14);
ALTER TABLE llx_expensereport ADD COLUMN extraparams varchar(255); ALTER TABLE llx_expensereport ADD COLUMN extraparams varchar(255);
ALTER TABLE llx_bank_account ADD COLUMN extraparams varchar(255); ALTER TABLE llx_bank_account ADD COLUMN extraparams varchar(255);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',30); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',30);
@ -187,6 +189,7 @@ UPDATE llx_bank_account as ba set fk_accountancy_journal = (SELECT rowid FROM ll
ALTER TABLE llx_bank_account ADD CONSTRAINT fk_bank_account_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid); ALTER TABLE llx_bank_account ADD CONSTRAINT fk_bank_account_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid);
--Update general ledger for FEC format & harmonization --Update general ledger for FEC format & harmonization
ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN code_tiers varchar(32); ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN code_tiers varchar(32);
ALTER TABLE llx_accounting_bookkeeping CHANGE COLUMN code_tiers thirdparty_code varchar(32); ALTER TABLE llx_accounting_bookkeeping CHANGE COLUMN code_tiers thirdparty_code varchar(32);
@ -229,6 +232,7 @@ ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_invoic
ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_invoice_supplier_source FOREIGN KEY (fk_invoice_supplier) REFERENCES llx_facture_fourn (rowid); ALTER TABLE llx_societe_remise_except ADD CONSTRAINT fk_societe_remise_fk_invoice_supplier_source FOREIGN KEY (fk_invoice_supplier) REFERENCES llx_facture_fourn (rowid);
ALTER TABLE llx_facture_rec ADD COLUMN vat_src_code varchar(10) DEFAULT ''; ALTER TABLE llx_facture_rec ADD COLUMN vat_src_code varchar(10) DEFAULT '';
ALTER TABLE llx_expensereport_det ADD COLUMN vat_src_code varchar(10) DEFAULT '';
DELETE FROM llx_const WHERE name = __ENCRYPT('ADHERENT_BANK_USE_AUTO')__; DELETE FROM llx_const WHERE name = __ENCRYPT('ADHERENT_BANK_USE_AUTO')__;

View File

@ -27,6 +27,7 @@ CREATE TABLE llx_expensereport_det
qty real NOT NULL, qty real NOT NULL,
value_unit real NOT NULL, value_unit real NOT NULL,
remise_percent real, remise_percent real,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3), -- Vat rate tva_tx double(6,3), -- Vat rate
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type localtax1_type varchar(10) NULL, -- localtax1 type

View File

@ -49,8 +49,8 @@ AccountancyAreaDescLoan=STEP %s: Define default accounting accounts for loans. F
AccountancyAreaDescBank=STEP %s: Define accounting accounts for each bank and financial accounts. For this, go on the card of each financial account. You can start from page %s. AccountancyAreaDescBank=STEP %s: Define accounting accounts for each bank and financial accounts. For this, go on the card of each financial account. You can start from page %s.
AccountancyAreaDescProd=STEP %s: Define accounting accounts on your products/services. For this, use the menu entry %s. AccountancyAreaDescProd=STEP %s: Define accounting accounts on your products/services. For this, use the menu entry %s.
AccountancyAreaDescBind=STEP %s: Check the binding between existing %s lines and accounting account is done, so application will be able to journalize transactions in General Ledger in one click. Complete missing bindings. For this, use the menu entry %s. AccountancyAreaDescBind=STEP %s: Check the binding between existing %s lines and accounting account is done, so application will be able to journalize transactions in Ledger in one click. Complete missing bindings. For this, use the menu entry %s.
AccountancyAreaDescWriteRecords=STEP %s: Write transactions into the General Ledger. For this, go into menu <strong>%s</strong>, and click into button <strong>%s</strong>. AccountancyAreaDescWriteRecords=STEP %s: Write transactions into the Ledger. For this, go into menu <strong>%s</strong>, and click into button <strong>%s</strong>.
AccountancyAreaDescAnalyze=STEP %s: Add or edit existing transactions and generate reports and exports. AccountancyAreaDescAnalyze=STEP %s: Add or edit existing transactions and generate reports and exports.
AccountancyAreaDescClosePeriod=STEP %s: Close period so we can't make modification in a future. AccountancyAreaDescClosePeriod=STEP %s: Close period so we can't make modification in a future.
@ -61,6 +61,8 @@ ChangeAndLoad=Change and load
Addanaccount=Add an accounting account Addanaccount=Add an accounting account
AccountAccounting=Accounting account AccountAccounting=Accounting account
AccountAccountingShort=Account AccountAccountingShort=Account
SubledgerAccount=Subledger Account
subledger_account=Subledger Account
ShowAccountingAccount=Show accounting account ShowAccountingAccount=Show accounting account
ShowAccountingJournal=Show accounting journal ShowAccountingJournal=Show accounting journal
AccountAccountingSuggest=Accounting account suggested AccountAccountingSuggest=Accounting account suggested
@ -77,8 +79,8 @@ SuppliersVentilation=Supplier invoice binding
ExpenseReportsVentilation=Expense report binding ExpenseReportsVentilation=Expense report binding
CreateMvts=Create new transaction CreateMvts=Create new transaction
UpdateMvts=Modification of a transaction UpdateMvts=Modification of a transaction
WriteBookKeeping=Journalize transactions in General Ledger WriteBookKeeping=Journalize transactions in Ledger
Bookkeeping=General ledger Bookkeeping=Ledger
AccountBalance=Account balance AccountBalance=Account balance
CAHTF=Total purchase supplier before tax CAHTF=Total purchase supplier before tax
@ -141,16 +143,16 @@ TransactionNumShort=Num. transaction
AccountingCategory=Accounting account groups AccountingCategory=Accounting account groups
GroupByAccountAccounting=Group by accounting account GroupByAccountAccounting=Group by accounting account
NotMatch=Not Set NotMatch=Not Set
DeleteMvt=Delete general ledger lines DeleteMvt=Delete Ledger lines
DelYear=Year to delete DelYear=Year to delete
DelJournal=Journal to delete DelJournal=Journal to delete
ConfirmDeleteMvt=This will delete all lines of the general ledger for year and/or from a specific journal. At least one criteria is required. ConfirmDeleteMvt=This will delete all lines of the Ledger for year and/or from a specific journal. At least one criteria is required.
ConfirmDeleteMvtPartial=This will delete the selected line(s) of the general ledger ConfirmDeleteMvtPartial=This will delete the selected line(s) of the Ledger
DelBookKeeping=Delete record of the general ledger 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 products/services accountancy account and can be recorded into the General Ledger. DescJournalOnlyBindedVisible=This is a view of record that are bound to products/services accountancy 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
@ -192,7 +194,7 @@ AutomaticBindingDone=Automatic binding done
ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used
MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s
FicheVentilation=Binding card FicheVentilation=Binding card
GeneralLedgerIsWritten=Transactions are written in the general ledger GeneralLedgerIsWritten=Transactions are written in the Ledger
GeneralLedgerSomeRecordWasNotRecorded=Some of the transactions could not be dispatched. If there is no other error message, this is probably because they were already dispatched. GeneralLedgerSomeRecordWasNotRecorded=Some of the transactions could not be dispatched. If there is no other error message, this is probably because they were already dispatched.
NoNewRecordSaved=No new record dispatched NoNewRecordSaved=No new record dispatched
ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account
@ -254,6 +256,7 @@ Calculated=Calculated
Formula=Formula Formula=Formula
## Error ## Error
SomeMandatoryStepsOfSetupWereNotDone=Some mandatory steps of setup was not done, please complete them
ErrorNoAccountingCategoryForThisCountry=No accounting account group available for country %s (See Home - Setup - Dictionaries) ErrorNoAccountingCategoryForThisCountry=No accounting account group available for country %s (See Home - Setup - Dictionaries)
ExportNotSupported=The export format setuped is not supported into this page ExportNotSupported=The export format setuped is not supported into this page
BookeppingLineAlreayExists=Lines already existing into bookeeping BookeppingLineAlreayExists=Lines already existing into bookeeping
@ -261,4 +264,4 @@ NoJournalDefined=No journal defined
Binded=Lines bound Binded=Lines bound
ToBind=Lines to bind ToBind=Lines to bind
WarningReportNotReliable=Warning, this report is not based on the General Ledger, so does not contains transaction modified manualy in the General ledger. It will be replaced by a more complete report in a next version. WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manualy in the Ledger. It will be replaced by a more complete report in a next version.

View File

@ -190,8 +190,10 @@ AccountancyJournal=Accountancy code journal
ACCOUNTING_VAT_SOLD_ACCOUNT=Accounting account by default for collecting VAT - VAT on sales (used if not defined on VAT dictionary setup) ACCOUNTING_VAT_SOLD_ACCOUNT=Accounting account by default for collecting VAT - VAT on sales (used if not defined on VAT dictionary setup)
ACCOUNTING_VAT_BUY_ACCOUNT=Accounting account by default for recovered VAT - VAT on purchases (used if not defined on VAT dictionary setup) ACCOUNTING_VAT_BUY_ACCOUNT=Accounting account by default for recovered VAT - VAT on purchases (used if not defined on VAT dictionary setup)
ACCOUNTING_VAT_PAY_ACCOUNT=Accounting account by default for paying VAT ACCOUNTING_VAT_PAY_ACCOUNT=Accounting account by default for paying VAT
ACCOUNTING_ACCOUNT_CUSTOMER=Accounting account by default for customer third parties (used if not defined on third party card) ACCOUNTING_ACCOUNT_CUSTOMER=Accounting account used for customer third parties
ACCOUNTING_ACCOUNT_SUPPLIER=Accounting account by default for supplier third parties (used if not defined on third party card) ACCOUNTING_ACCOUNT_CUSTOMER_Desc=Dedicated accounting account defined on third party card will be used for Subledger accouting, this one for General Ledger or as default value of Subledger accounting if dedicated customer accouting account on third party is not defined
ACCOUNTING_ACCOUNT_SUPPLIER=Accounting account used for supplier third parties
ACCOUNTING_ACCOUNT_SUPPLIER_Desc=Dedicated accounting account defined on third party card will be used for Subledger accouting, this one for General Ledger or as default value of Subledger accounting if dedicated supplier accouting account on third party is not defined
CloneTax=Clone a social/fiscal tax CloneTax=Clone a social/fiscal tax
ConfirmCloneTax=Confirm the clone of a social/fiscal tax payment ConfirmCloneTax=Confirm the clone of a social/fiscal tax payment
CloneTaxForNextMonth=Clone it for next month CloneTaxForNextMonth=Clone it for next month

View File

@ -182,6 +182,7 @@ ErrorFailedToLoadLoginFileForMode=Failed to get the login key for mode '%s'.
ErrorModuleNotFound=File of module was not found. ErrorModuleNotFound=File of module was not found.
ErrorFieldAccountNotDefinedForBankLine=Value for Accounting account not defined for source line id %s (%s) ErrorFieldAccountNotDefinedForBankLine=Value for Accounting account not defined for source line id %s (%s)
ErrorFieldAccountNotDefinedForInvoiceLine=Value for Accounting account not defined for invoice id %s (%s) ErrorFieldAccountNotDefinedForInvoiceLine=Value for Accounting account not defined for invoice id %s (%s)
ErrorFieldAccountNotDefinedForLine=Value for Accounting account not defined for the line (%s)
ErrorBankStatementNameMustFollowRegex=Error, bank statement name must follow the following syntax rule %s ErrorBankStatementNameMustFollowRegex=Error, bank statement name must follow the following syntax rule %s
ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information. ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information.
ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter time consumed. ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter time consumed.
@ -191,6 +192,7 @@ ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (<st
ErrorDuplicateTrigger=Error, duplicate trigger name %s. Already loaded from %s. ErrorDuplicateTrigger=Error, duplicate trigger name %s. Already loaded from %s.
ErrorNoWarehouseDefined=Error, no warehouses defined. ErrorNoWarehouseDefined=Error, no warehouses defined.
ErrorBadLinkSourceSetButBadValueForRef=The link you use is not valid. A 'source' for payment is defined, but value for 'ref' is not valid. ErrorBadLinkSourceSetButBadValueForRef=The link you use is not valid. A 'source' for payment is defined, but value for 'ref' is not valid.
ErrorTooManyErrorsProcessStopped=Too many errors. Process was stopped.
# Warnings # Warnings
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.

View File

@ -1766,8 +1766,9 @@ else
$formcompany->select_localtax(1,$object->localtax1_value, "lt1"); $formcompany->select_localtax(1,$object->localtax1_value, "lt1");
print '</span>'; print '</span>';
} }
print '</td>';
print '</td><td>'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').'</td><td>'; print '<td>'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').'</td><td>';
print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
if (! isOnlyOneLocalTax(2)) if (! isOnlyOneLocalTax(2))
{ {

View File

@ -365,7 +365,7 @@ if ($sql_select)
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">'; print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre nowrap">'; // date print '<td class="liste_titre nowrap center">'; // date
print $formother->select_month($month?$month:-1,'month',1); print $formother->select_month($month?$month:-1,'month',1);
$formother->select_year($year?$year:-1,'year',1, 20, 1); $formother->select_year($year?$year:-1,'year',1, 20, 1);
print '</td>'; print '</td>';