Modify code to match new v6 structure.
This commit is contained in:
parent
4009b1837c
commit
097be322a6
@ -151,7 +151,7 @@ $sourceList=array();
|
|||||||
|
|
||||||
if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
|
if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
|
||||||
{
|
{
|
||||||
$search_country_id = '';
|
$search_country_id = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions add or modify an entry into a dictionary
|
// Actions add or modify an entry into a dictionary
|
||||||
@ -479,7 +479,7 @@ if ($id)
|
|||||||
else $sql.=" WHERE ";
|
else $sql.=" WHERE ";
|
||||||
$sql.= " c.rowid = ".$search_country_id;
|
$sql.= " c.rowid = ".$search_country_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sortfield)
|
if ($sortfield)
|
||||||
{
|
{
|
||||||
// If sort order is "country", we use country_code instead
|
// If sort order is "country", we use country_code instead
|
||||||
@ -506,7 +506,7 @@ if ($id)
|
|||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" 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="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Form to add a new line
|
// Form to add a new line
|
||||||
@ -546,9 +546,9 @@ 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 != '')
|
||||||
{
|
{
|
||||||
print '<td align="'.$align.'">';
|
print '<td align="'.$align.'">';
|
||||||
@ -617,7 +617,7 @@ if ($id)
|
|||||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||||
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
||||||
|
|
||||||
// There is several pages
|
// There is several pages
|
||||||
if ($num > $listlimit)
|
if ($num > $listlimit)
|
||||||
{
|
{
|
||||||
@ -632,9 +632,9 @@ if ($id)
|
|||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
$showfield=1; // By defaut
|
$showfield=1; // By defaut
|
||||||
|
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||||
|
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
{
|
{
|
||||||
if ($value == 'country')
|
if ($value == 'country')
|
||||||
@ -661,7 +661,7 @@ if ($id)
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Title of lines
|
// Title of lines
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
@ -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)
|
||||||
@ -754,7 +754,7 @@ if ($id)
|
|||||||
{
|
{
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
$showfield=1;
|
$showfield=1;
|
||||||
$align="left";
|
$align="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
|
|||||||
@ -50,23 +50,26 @@ if (! empty($user->rights->accountancy->chartofaccount))
|
|||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
|
||||||
|
$list_account_main = array (
|
||||||
|
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||||
|
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||||
|
);
|
||||||
|
|
||||||
$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'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -93,15 +96,23 @@ 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)) {
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,18 +140,47 @@ 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);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -127,7 +127,7 @@ complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,
|
|||||||
|
|
||||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||||
$elementList = array();
|
$elementList = array();
|
||||||
// Must match ids defined into eldy.lib.php
|
// Must match ids defined into eldy.lib.php
|
||||||
$sourceList = array(
|
$sourceList = array(
|
||||||
'1' => $langs->trans('AccountingJournalType1'),
|
'1' => $langs->trans('AccountingJournalType1'),
|
||||||
'2' => $langs->trans('AccountingJournalType2'),
|
'2' => $langs->trans('AccountingJournalType2'),
|
||||||
@ -142,7 +142,7 @@ $elementList = array();
|
|||||||
|
|
||||||
if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
|
if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
|
||||||
{
|
{
|
||||||
$search_country_id = '';
|
$search_country_id = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions add or modify an entry into a dictionary
|
// Actions add or modify an entry into a dictionary
|
||||||
@ -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')
|
||||||
@ -400,7 +393,7 @@ if ($id)
|
|||||||
else $sql.=" WHERE ";
|
else $sql.=" WHERE ";
|
||||||
$sql.= " c.rowid = ".$search_country_id;
|
$sql.= " c.rowid = ".$search_country_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sortfield)
|
if ($sortfield)
|
||||||
{
|
{
|
||||||
// If sort order is "country", we use country_code instead
|
// If sort order is "country", we use country_code instead
|
||||||
@ -427,7 +420,7 @@ if ($id)
|
|||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" 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="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Form to add a new line
|
// Form to add a new line
|
||||||
@ -453,7 +446,7 @@ if ($id)
|
|||||||
$valuetoshow=$langs->trans("Label");
|
$valuetoshow=$langs->trans("Label");
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
||||||
|
|
||||||
if ($valuetoshow != '')
|
if ($valuetoshow != '')
|
||||||
{
|
{
|
||||||
print '<td align="'.$align.'">';
|
print '<td align="'.$align.'">';
|
||||||
@ -522,7 +515,7 @@ if ($id)
|
|||||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||||
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
||||||
|
|
||||||
// There is several pages
|
// There is several pages
|
||||||
if ($num > $listlimit)
|
if ($num > $listlimit)
|
||||||
{
|
{
|
||||||
@ -582,7 +575,7 @@ if ($id)
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
// Lines with values
|
// Lines with values
|
||||||
@ -621,7 +614,7 @@ if ($id)
|
|||||||
{
|
{
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
$showfield=1;
|
$showfield=1;
|
||||||
$align="left";
|
$align="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
@ -682,10 +675,10 @@ if ($id)
|
|||||||
else print '<td> </td>';
|
else print '<td> </td>';
|
||||||
|
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
@ -171,7 +171,7 @@ else if ($action == "confirm_delete") {
|
|||||||
|
|
||||||
else if ($action == "confirm_create") {
|
else if ($action == "confirm_create") {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
|
|
||||||
if (! GETPOST('next_num_mvt'))
|
if (! GETPOST('next_num_mvt'))
|
||||||
@ -179,7 +179,7 @@ else if ($action == "confirm_create") {
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$book->label_compte = '';
|
$book->label_compte = '';
|
||||||
@ -192,9 +192,9 @@ else if ($action == "confirm_create") {
|
|||||||
$book->code_journal = GETPOST('code_journal');
|
$book->code_journal = GETPOST('code_journal');
|
||||||
$book->fk_doc = 0;
|
$book->fk_doc = 0;
|
||||||
$book->fk_docdet = 0;
|
$book->fk_docdet = 0;
|
||||||
|
|
||||||
$book->montant = 0;
|
$book->montant = 0;
|
||||||
|
|
||||||
$result = $book->createStd($user);
|
$result = $book->createStd($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
@ -289,9 +289,9 @@ if ($action == 'create') {
|
|||||||
print load_fiche_titre($langs->trans("UpdateMvts"), '<a href="list.php">' . $langs->trans('BackToList') . '</a>');
|
print load_fiche_titre($langs->trans("UpdateMvts"), '<a href="list.php">' . $langs->trans('BackToList') . '</a>');
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print '<tr class="pair">';
|
print '<tr class="pair">';
|
||||||
@ -306,12 +306,12 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '<tr class="pair">';
|
print '<tr class="pair">';
|
||||||
print '<td>' . $langs->trans("Codejournal") . '</td>';
|
print '<td>' . $langs->trans("Codejournal") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$accountingjournal = new AccountingJournal($db);
|
$accountingjournal = new AccountingJournal($db);
|
||||||
$accountingjournal->fetch('',$book->code_journal);
|
$accountingjournal->fetch('',$book->code_journal);
|
||||||
print $accountingjournal->getNomUrl(0,1,1,'',1);
|
print $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="impair">';
|
print '<tr class="impair">';
|
||||||
print '<td>' . $langs->trans("Docref") . '</td>';
|
print '<td>' . $langs->trans("Docref") . '</td>';
|
||||||
print '<td>' . $book->doc_ref . '</td>';
|
print '<td>' . $book->doc_ref . '</td>';
|
||||||
@ -335,13 +335,13 @@ if ($action == 'create') {
|
|||||||
print '<td>' . $typelabel . '</td>';
|
print '<td>' . $typelabel . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$result = $book->fetch_all_per_mvt($piece_num);
|
$result = $book->fetch_all_per_mvt($piece_num);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
@ -358,7 +358,7 @@ if ($action == 'create') {
|
|||||||
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
|
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
|
||||||
|
|
||||||
$var=False;
|
$var=False;
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
if (count($book->linesmvt) > 0) {
|
if (count($book->linesmvt) > 0) {
|
||||||
|
|
||||||
@ -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"');
|
||||||
@ -390,7 +390,7 @@ if ($action == 'create') {
|
|||||||
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, '');
|
||||||
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);
|
||||||
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>';
|
||||||
@ -423,7 +423,7 @@ if ($action == 'create') {
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($total_debit != $total_credit)
|
if ($total_debit != $total_credit)
|
||||||
{
|
{
|
||||||
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
|
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
|
||||||
}
|
}
|
||||||
@ -434,7 +434,7 @@ if ($action == 'create') {
|
|||||||
print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
|
print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
|
||||||
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);
|
||||||
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>';
|
||||||
|
|||||||
@ -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)) {
|
||||||
@ -223,7 +223,7 @@ if ($action == 'delbookkeepingyearconfirm') {
|
|||||||
$deljournal=0;
|
$deljournal=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($delyear) || ! empty($deljournal))
|
if (! empty($delyear) || ! empty($deljournal))
|
||||||
{
|
{
|
||||||
$result = $object->deleteByYearAndJournal($delyear,$deljournal);
|
$result = $object->deleteByYearAndJournal($delyear,$deljournal);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -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, '');
|
||||||
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, '');
|
||||||
|
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> ';
|
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||||
|
|||||||
@ -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,13 +257,12 @@ print "</tr>\n";
|
|||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var = True;
|
|
||||||
|
|
||||||
$total_debit = 0;
|
$total_debit = 0;
|
||||||
$total_credit = 0;
|
$total_credit = 0;
|
||||||
$sous_total_debit = 0;
|
$sous_total_debit = 0;
|
||||||
$sous_total_credit = 0;
|
$sous_total_credit = 0;
|
||||||
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
|
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
|
||||||
|
|
||||||
foreach ( $object->lines as $line ) {
|
foreach ( $object->lines as $line ) {
|
||||||
|
|
||||||
@ -272,10 +271,10 @@ foreach ( $object->lines as $line ) {
|
|||||||
|
|
||||||
$accountg = length_accountg($line->numero_compte);
|
$accountg = length_accountg($line->numero_compte);
|
||||||
//if (empty($accountg)) $accountg = '-';
|
//if (empty($accountg)) $accountg = '-';
|
||||||
|
|
||||||
// Is it a break ?
|
// Is it a break ?
|
||||||
if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) {
|
if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) {
|
||||||
|
|
||||||
// Affiche un Sous-Total par compte comptable
|
// Affiche un Sous-Total par compte comptable
|
||||||
if (isset($displayed_account_number)) {
|
if (isset($displayed_account_number)) {
|
||||||
print '<tr class="liste_total"><td align="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap" align="right">'.price($sous_total_debit).'</td><td class="nowrap" align="right">'.price($sous_total_credit).'</td>';
|
print '<tr class="liste_total"><td align="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap" align="right">'.price($sous_total_debit).'</td><td class="nowrap" align="right">'.price($sous_total_credit).'</td>';
|
||||||
@ -283,7 +282,7 @@ foreach ( $object->lines as $line ) {
|
|||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the break account
|
// Show the break account
|
||||||
$colspan = 9;
|
$colspan = 9;
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
@ -292,7 +291,7 @@ foreach ( $object->lines as $line ) {
|
|||||||
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
|
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$displayed_account_number = $accountg;
|
$displayed_account_number = $accountg;
|
||||||
//if (empty($displayed_account_number)) $displayed_account_number='-';
|
//if (empty($displayed_account_number)) $displayed_account_number='-';
|
||||||
$sous_total_debit = 0;
|
$sous_total_debit = 0;
|
||||||
@ -303,24 +302,24 @@ foreach ( $object->lines as $line ) {
|
|||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '<td align="right"><a href="./card.php?piece_num=' . $line->piece_num . '">'.$line->piece_num.'</a></td>';
|
print '<td align="right"><a href="./card.php?piece_num=' . $line->piece_num . '">'.$line->piece_num.'</a></td>';
|
||||||
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||||
|
|
||||||
// TODO Add a link according to doc_type and fk_doc
|
// TODO Add a link according to doc_type and fk_doc
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
//if ($line->doc_type == 'supplier_invoice')
|
//if ($line->doc_type == 'supplier_invoice')
|
||||||
//if ($line->doc_type == 'customer_invoice')
|
//if ($line->doc_type == 'customer_invoice')
|
||||||
print $line->doc_ref;
|
print $line->doc_ref;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// 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> ';
|
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||||
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();
|
||||||
|
|||||||
@ -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 .= '&search_numero_compte_end=' . $search_numero_compte_end;
|
$options .= '&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 .= '&search_code_tiers=' . $search_code_tiers;
|
$options .= '&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 .= '&search_code_tiers_start=' . $search_code_tiers_start;
|
$options .= '&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 .= '&search_code_tiers_end=' . $search_code_tiers_end;
|
$options .= '&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 .= '&search_code_journal=' . $search_code_journal;
|
$options .= '&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>';
|
||||||
|
|||||||
@ -138,7 +138,7 @@ class AccountancyCategory
|
|||||||
*/
|
*/
|
||||||
public function getAccountsWithNoCategory($id) {
|
public function getAccountsWithNoCategory($id) {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte";
|
$sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
@ -147,9 +147,9 @@ class AccountancyCategory
|
|||||||
$sql .= " AND aa.active = 1";
|
$sql .= " AND aa.active = 1";
|
||||||
$sql .= " GROUP BY aa.account_number, aa.label";
|
$sql .= " GROUP BY aa.account_number, aa.label";
|
||||||
$sql .= " ORDER BY aa.account_number, aa.label";
|
$sql .= " ORDER BY aa.account_number, aa.label";
|
||||||
|
|
||||||
$this->lines_CptBk = array ();
|
$this->lines_CptBk = array ();
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -159,17 +159,17 @@ class AccountancyCategory
|
|||||||
$this->lines_cptbk[] = $obj;
|
$this->lines_cptbk[] = $obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $num;
|
return $num;
|
||||||
} else {
|
} else {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
$this->errors[] = $this->error;
|
$this->errors[] = $this->error;
|
||||||
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to add an accounting account in an accounting category
|
* Function to add an accounting account in an accounting category
|
||||||
*
|
*
|
||||||
@ -191,7 +191,7 @@ class AccountancyCategory
|
|||||||
$sql .= " AND aa.active = 1";
|
$sql .= " AND aa.active = 1";
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
@ -201,9 +201,9 @@ class AccountancyCategory
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( $obj = $this->db->fetch_object($resql))
|
while ( $obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
if (array_key_exists(length_accountg($obj->account_number), $cpts))
|
if (array_key_exists(length_accountg($obj->account_number), $cpts))
|
||||||
{
|
{
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account";
|
||||||
$sql .= " SET fk_accounting_category=" . $id_cat;
|
$sql .= " SET fk_accounting_category=" . $id_cat;
|
||||||
@ -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
|
||||||
|
|||||||
@ -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';
|
||||||
@ -436,19 +436,21 @@ class AccountancyExport
|
|||||||
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;
|
||||||
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;
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class AccountingJournal extends CommonObject
|
|||||||
function __construct($db) {
|
function __construct($db) {
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load an object from database
|
* Load an object from database
|
||||||
*
|
*
|
||||||
@ -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);
|
||||||
@ -96,7 +96,7 @@ class AccountingJournal extends CommonObject
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return clicable name (with picto eventually)
|
* Return clicable name (with picto eventually)
|
||||||
*
|
*
|
||||||
@ -147,7 +147,7 @@ class AccountingJournal extends CommonObject
|
|||||||
{
|
{
|
||||||
$linkstart = '';
|
$linkstart = '';
|
||||||
$linkclose = '';
|
$linkclose = '';
|
||||||
$linkend = '';
|
$linkend = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$label_link = $this->code;
|
$label_link = $this->code;
|
||||||
@ -158,7 +158,7 @@ class AccountingJournal extends CommonObject
|
|||||||
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
|
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'un user (actif, inactif)
|
* Retourne le libelle du statut d'un user (actif, inactif)
|
||||||
*
|
*
|
||||||
@ -169,7 +169,7 @@ class AccountingJournal extends CommonObject
|
|||||||
{
|
{
|
||||||
return $this->LibType($this->nature,$mode);
|
return $this->LibType($this->nature,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return type of an accounting journal
|
* Return type of an accounting journal
|
||||||
*
|
*
|
||||||
@ -182,7 +182,7 @@ class AccountingJournal extends CommonObject
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
$prefix='';
|
$prefix='';
|
||||||
|
|||||||
@ -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
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ class BookKeeping extends CommonObject
|
|||||||
*
|
*
|
||||||
* @var string Name of table without prefix where object is stored
|
* @var string Name of table without prefix where object is stored
|
||||||
*/
|
*/
|
||||||
public $table_element = 'accounting_bookkeeping';
|
public $table_element = 'accounting_bookkeeping';
|
||||||
|
|
||||||
public $entity = 1;
|
public $entity = 1;
|
||||||
|
|
||||||
@ -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);
|
||||||
@ -165,7 +173,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
if (empty($this->debit)) $this->debit = 0;
|
if (empty($this->debit)) $this->debit = 0;
|
||||||
if (empty($this->credit)) $this->credit = 0;
|
if (empty($this->credit)) $this->credit = 0;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($this->numero_compte) || $this->numero_compte == '-1')
|
if (empty($this->numero_compte) || $this->numero_compte == '-1')
|
||||||
{
|
{
|
||||||
@ -176,7 +184,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->fk_doc, $this->doc_type);
|
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->fk_doc, $this->doc_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@ -191,7 +199,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
||||||
$sql .= " AND fk_doc = " . $this->fk_doc;
|
$sql .= " AND fk_doc = " . $this->fk_doc;
|
||||||
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 is record is for several lines
|
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 is record is for several lines
|
||||||
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
|
|
||||||
@ -199,12 +207,12 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$row = $this->db->fetch_object($resql);
|
$row = $this->db->fetch_object($resql);
|
||||||
if ($row->nb == 0)
|
if ($row->nb == 0)
|
||||||
{
|
{
|
||||||
// Determine piece_num
|
// Determine piece_num
|
||||||
$sqlnum = "SELECT piece_num";
|
$sqlnum = "SELECT piece_num";
|
||||||
$sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sqlnum .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'"; // For example doc_type = 'bank'
|
$sqlnum .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'"; // For example doc_type = 'bank'
|
||||||
$sqlnum .= " AND fk_docdet = " . $this->db->escape($this->fk_docdet); // fk_docdet is rowid into llx_bank or llx_facturedet or llx_facturefourndet, or ...
|
$sqlnum .= " AND fk_docdet = " . $this->db->escape($this->fk_docdet); // fk_docdet is rowid into llx_bank or llx_facturedet or llx_facturefourndet, or ...
|
||||||
$sqlnum .= " AND doc_ref = '" . $this->db->escape($this->doc_ref) . "'"; // ref of source object
|
$sqlnum .= " AND doc_ref = '" . $this->db->escape($this->doc_ref) . "'"; // ref of source object
|
||||||
$sqlnum .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sqlnum .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
@ -244,7 +252,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";
|
||||||
@ -256,25 +266,27 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ", code_journal";
|
$sql .= ", code_journal";
|
||||||
$sql .= ", journal_label";
|
$sql .= ", journal_label";
|
||||||
$sql .= ", piece_num";
|
$sql .= ", piece_num";
|
||||||
$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 .= ")";
|
||||||
|
|
||||||
@ -282,7 +294,7 @@ class BookKeeping extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||||
|
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$result = 0;
|
$result = 0;
|
||||||
@ -312,11 +324,11 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
|
|
||||||
if (! $notrigger) {
|
if (! $notrigger) {
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
// want this action to call a trigger.
|
// want this action to call a trigger.
|
||||||
|
|
||||||
// // Call triggers
|
// // Call triggers
|
||||||
// $result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
// $result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||||
// if ($result < 0) $error++;
|
// if ($result < 0) $error++;
|
||||||
@ -360,8 +372,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 +427,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,7 +448,9 @@ 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->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) ? "'NotDefined'" : "'" . $this->db->escape($this->numero_compte) . "'") . ',';
|
$sql .= ' ' . (! isset($this->numero_compte) ? "'NotDefined'" : "'" . $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 ). ',';
|
||||||
@ -458,7 +480,7 @@ class BookKeeping extends CommonObject
|
|||||||
if (! $notrigger) {
|
if (! $notrigger) {
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
// want this action to call a trigger.
|
// want this action to call a trigger.
|
||||||
|
|
||||||
// // Call triggers
|
// // Call triggers
|
||||||
// $result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
// $result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||||
// if ($result < 0) $error++;
|
// if ($result < 0) $error++;
|
||||||
@ -483,7 +505,7 @@ class BookKeeping extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $id Id object
|
* @param int $id Id object
|
||||||
* @param string $ref Ref
|
* @param string $ref Ref
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetch($id, $ref = null) {
|
public function fetch($id, $ref = null) {
|
||||||
@ -498,7 +520,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 +556,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;
|
||||||
@ -555,11 +581,11 @@ class BookKeeping extends CommonObject
|
|||||||
} else {
|
} else {
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load object in memory from the database
|
* Load object in memory from the database
|
||||||
*
|
*
|
||||||
@ -569,7 +595,7 @@ class BookKeeping extends CommonObject
|
|||||||
* @param int $offset offset limit
|
* @param int $offset offset limit
|
||||||
* @param array $filter filter array
|
* @param array $filter filter array
|
||||||
* @param string $filtermode filter mode (AND or OR)
|
* @param string $filtermode filter mode (AND or OR)
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||||
@ -584,7 +610,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 +632,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) . '%\'';
|
||||||
@ -630,7 +658,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
if (! empty($limit)) {
|
if (! empty($limit)) {
|
||||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
$this->lines = array ();
|
$this->lines = array ();
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -647,7 +675,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;
|
||||||
@ -672,8 +702,8 @@ class BookKeeping extends CommonObject
|
|||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load object in memory from the database
|
* Load object in memory from the database
|
||||||
*
|
*
|
||||||
@ -683,7 +713,7 @@ class BookKeeping extends CommonObject
|
|||||||
* @param int $offset offset limit
|
* @param int $offset offset limit
|
||||||
* @param array $filter filter array
|
* @param array $filter filter array
|
||||||
* @param string $filtermode filter mode (AND or OR)
|
* @param string $filtermode filter mode (AND or OR)
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||||
@ -698,7 +728,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 +751,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 +790,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 +848,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) . '%\'';
|
||||||
@ -834,7 +868,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' GROUP BY t.numero_compte';
|
$sql .= ' GROUP BY t.numero_compte';
|
||||||
|
|
||||||
if (! empty($sortfield)) {
|
if (! empty($sortfield)) {
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (! empty($limit)) {
|
if (! empty($limit)) {
|
||||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||||
@ -869,7 +903,7 @@ class BookKeeping extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param User $user User that modifies
|
* @param User $user User that modifies
|
||||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function update(User $user, $notrigger = false) {
|
public function update(User $user, $notrigger = false) {
|
||||||
@ -890,8 +924,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 +977,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") . ',';
|
||||||
@ -963,7 +1005,7 @@ class BookKeeping extends CommonObject
|
|||||||
if (! $error && ! $notrigger) {
|
if (! $error && ! $notrigger) {
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
// want this action calls a trigger.
|
// want this action calls a trigger.
|
||||||
|
|
||||||
// // Call triggers
|
// // Call triggers
|
||||||
// $result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
// $result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||||
// if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
// if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||||
@ -987,7 +1029,7 @@ class BookKeeping extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param User $user User that deletes
|
* @param User $user User that deletes
|
||||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function delete(User $user, $notrigger = false) {
|
public function delete(User $user, $notrigger = false) {
|
||||||
@ -1070,7 +1112,7 @@ class BookKeeping extends CommonObject
|
|||||||
function deleteByYearAndJournal($delyear='', $journal='') {
|
function deleteByYearAndJournal($delyear='', $journal='') {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if (empty($delyear) && empty($journal))
|
if (empty($delyear) && empty($journal))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1137,7 +1179,7 @@ class BookKeeping extends CommonObject
|
|||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
* @param int $fromid Id of object to clone
|
* @param int $fromid Id of object to clone
|
||||||
*
|
*
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone($fromid) {
|
public function createFromClone($fromid) {
|
||||||
@ -1196,8 +1238,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 +1249,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 = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1249,7 +1293,7 @@ class BookKeeping extends CommonObject
|
|||||||
*
|
*
|
||||||
* @return string Next numero to use
|
* @return string Next numero to use
|
||||||
*/
|
*/
|
||||||
public function getNextNumMvt()
|
public function getNextNumMvt()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -1281,7 +1325,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 +1347,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 +1381,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 +1405,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;
|
||||||
@ -1380,9 +1428,9 @@ class BookKeeping extends CommonObject
|
|||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of accounts with label by chart of accounts
|
* Return list of accounts with label by chart of accounts
|
||||||
*
|
*
|
||||||
@ -1397,11 +1445,11 @@ class BookKeeping extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') {
|
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
|
||||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT ab.numero_compte as account_number, aa.label as label, aa.rowid as rowid, aa.fk_pcg_version";
|
$sql = "SELECT DISTINCT ab.numero_compte as account_number, aa.label as label, aa.rowid as rowid, aa.fk_pcg_version";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
||||||
@ -1410,43 +1458,43 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND asy.rowid = " . $pcgver;
|
$sql .= " AND asy.rowid = " . $pcgver;
|
||||||
$sql .= " AND ab.entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND ab.entity IN (" . getEntity('accountancy') . ")";
|
||||||
$sql .= " ORDER BY account_number ASC";
|
$sql .= " ORDER BY account_number ASC";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = ajax_combobox($htmlname, $event);
|
$out = ajax_combobox($htmlname, $event);
|
||||||
|
|
||||||
$options = array();
|
$options = array();
|
||||||
$selected = null;
|
$selected = null;
|
||||||
|
|
||||||
while ($obj = $this->db->fetch_object($resql)) {
|
while ($obj = $this->db->fetch_object($resql)) {
|
||||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||||
|
|
||||||
$select_value_in = $obj->rowid;
|
$select_value_in = $obj->rowid;
|
||||||
$select_value_out = $obj->rowid;
|
$select_value_out = $obj->rowid;
|
||||||
|
|
||||||
if ($select_in == 1) {
|
if ($select_in == 1) {
|
||||||
$select_value_in = $obj->account_number;
|
$select_value_in = $obj->account_number;
|
||||||
}
|
}
|
||||||
if ($select_out == 1) {
|
if ($select_out == 1) {
|
||||||
$select_value_out = $obj->account_number;
|
$select_value_out = $obj->account_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||||
if (($selectid != '') && $selectid == $select_value_in) {
|
if (($selectid != '') && $selectid == $select_value_in) {
|
||||||
$selected = $select_value_out;
|
$selected = $select_value_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
$options[$select_value_out] = $label;
|
$options[$select_value_out] = $label;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
|
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return $out;
|
return $out;
|
||||||
@ -1454,7 +1502,7 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of a root accounting account
|
* Description of a root accounting account
|
||||||
*
|
*
|
||||||
* @param string $account Accounting account
|
* @param string $account Accounting account
|
||||||
* @return string Root account
|
* @return string Root account
|
||||||
@ -1470,7 +1518,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND asy.rowid = " . $pcgver;
|
$sql .= " AND asy.rowid = " . $pcgver;
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as parent ON aa.account_parent = parent.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as parent ON aa.account_parent = parent.rowid";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as root ON parent.account_parent = root.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as root ON parent.account_parent = root.rowid";
|
||||||
$sql .= " WHERE aa.account_number = '" . $account . "'";
|
$sql .= " WHERE aa.account_number = '" . $account . "'";
|
||||||
$sql .= " AND parent.active = 1";
|
$sql .= " AND parent.active = 1";
|
||||||
$sql .= " AND root.active = 1";
|
$sql .= " AND root.active = 1";
|
||||||
$sql .= " AND aa.entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND aa.entity IN (" . getEntity('accountancy') . ")";
|
||||||
@ -1480,7 +1528,7 @@ class BookKeeping extends CommonObject
|
|||||||
if ($resql) {
|
if ($resql) {
|
||||||
$obj = '';
|
$obj = '';
|
||||||
if ($this->db->num_rows($resql)) {
|
if ($this->db->num_rows($resql)) {
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $obj->label;
|
return $obj->label;
|
||||||
@ -1492,8 +1540,8 @@ class BookKeeping extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of accounting account
|
* Description of accounting account
|
||||||
*
|
*
|
||||||
@ -1519,7 +1567,7 @@ class BookKeeping extends CommonObject
|
|||||||
if ($resql) {
|
if ($resql) {
|
||||||
$obj = '';
|
$obj = '';
|
||||||
if ($this->db->num_rows($resql)) {
|
if ($this->db->num_rows($resql)) {
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
}
|
}
|
||||||
if(empty($obj->category)){
|
if(empty($obj->category)){
|
||||||
return $obj->label;
|
return $obj->label;
|
||||||
@ -1532,7 +1580,7 @@ class BookKeeping extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1547,7 +1595,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;
|
||||||
|
|||||||
@ -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";
|
||||||
|
|
||||||
|
|||||||
@ -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 ???
|
||||||
@ -758,7 +758,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>';
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ if ($user->societe_id > 0)
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Get informations of journal
|
// Get informations of journal
|
||||||
$accountingjournalstatic = new AccountingJournal($db);
|
$accountingjournalstatic = new AccountingJournal($db);
|
||||||
$accountingjournalstatic->fetch($id_journal);
|
$accountingjournalstatic->fetch($id_journal);
|
||||||
@ -175,7 +175,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 +223,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,7 +269,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 = $langs->trans("VAT"). ' '.$def_tva[$key];
|
$bookkeeping->label_compte = $langs->trans("VAT"). ' '.$def_tva[$key];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
@ -462,7 +465,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>';
|
||||||
|
|
||||||
@ -576,7 +579,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>";
|
||||||
|
|||||||
@ -131,7 +131,7 @@ if ($result) {
|
|||||||
|
|
||||||
// contrôles
|
// contrôles
|
||||||
$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;
|
||||||
if (empty($compta_prod)) {
|
if (empty($compta_prod)) {
|
||||||
if ($obj->product_type == 0)
|
if ($obj->product_type == 0)
|
||||||
@ -214,9 +214,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 = $tabcompany[$key]['code_fournisseur'];
|
$bookkeeping->thirdparty_code = $tabcompany[$key]['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->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 +262,8 @@ 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->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,7 +308,8 @@ 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->subledger_account = '';
|
||||||
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key];
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
@ -479,7 +482,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,7 +521,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>';
|
||||||
|
|
||||||
@ -635,7 +638,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>";
|
||||||
|
|||||||
@ -231,10 +231,10 @@ 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 = $tabcompany[$key]['code_client'];
|
||||||
$bookkeeping->numero_compte = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
// $bookkeeping->label_compte = $tabcompany[$key]['name'];
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
|
$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 +277,8 @@ 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->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,7 +322,8 @@ 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->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").' '.$def_tva[$key];
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
@ -373,7 +375,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,7 +418,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 +471,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,7 +537,7 @@ 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 '<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>';
|
||||||
|
|
||||||
@ -602,7 +604,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>";
|
||||||
|
|||||||
@ -224,7 +224,7 @@ class modAccounting extends DolibarrModules
|
|||||||
$this->rights[$r][4] = 'chartofaccount';
|
$this->rights[$r][4] = 'chartofaccount';
|
||||||
$this->rights[$r][5] = '';
|
$this->rights[$r][5] = '';
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->rights[$r][0] = 50401;
|
$this->rights[$r][0] = 50401;
|
||||||
$this->rights[$r][1] = 'Bind products and invoices with accounting accounts';
|
$this->rights[$r][1] = 'Bind products and invoices with accounting accounts';
|
||||||
$this->rights[$r][2] = 'r';
|
$this->rights[$r][2] = 'r';
|
||||||
@ -242,9 +242,9 @@ class modAccounting extends DolibarrModules
|
|||||||
$this->rights[$r][5] = 'dispatch_advanced';
|
$this->rights[$r][5] = 'dispatch_advanced';
|
||||||
$r++;
|
$r++;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$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';
|
||||||
@ -279,7 +279,7 @@ class modAccounting extends DolibarrModules
|
|||||||
// Menus
|
// Menus
|
||||||
//-------
|
//-------
|
||||||
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
//--------
|
//--------
|
||||||
$r=0;
|
$r=0;
|
||||||
|
|||||||
@ -187,6 +187,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);
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
@ -261,4 +263,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.
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user