';
+
// Param
- $label = $langs->trans($key);
- print ''.$label.' ';
-
+ $label = $langs->trans($key);
+ print '' . $label . ' ';
+
// Value
print '';
print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1);
@@ -323,7 +315,7 @@ print "\n";
dol_fiche_end();
-print '
';
+print '
';
print '';
diff --git a/htdocs/accountancy/admin/journal.php b/htdocs/accountancy/admin/journal.php
index 18f01abb082..e1b76273193 100644
--- a/htdocs/accountancy/admin/journal.php
+++ b/htdocs/accountancy/admin/journal.php
@@ -22,24 +22,23 @@
*/
/**
- * \file htdocs/accountancy/admin/journal.php
- * \ingroup Accounting Expert
- * \brief Setup page to configure accounting expert module
+ * \file htdocs/accountancy/admin/journal.php
+ * \ingroup Accounting Expert
+ * \brief Setup page to configure accounting expert module
*/
-
require '../../main.inc.php';
-
+
// Class
-require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
-require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
-require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
-require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
$langs->load("accountancy");
// Security check
-if (!$user->admin)
- accessforbidden();
+if (! $user->admin)
+ accessforbidden();
$action = GETPOST('action', 'alpha');
@@ -49,7 +48,7 @@ $list = array (
'ACCOUNTING_PURCHASE_JOURNAL',
'ACCOUNTING_SOCIAL_JOURNAL',
'ACCOUNTING_MISCELLANEOUS_JOURNAL',
- 'ACCOUNTING_EXPENSEREPORT_JOURNAL'
+ 'ACCOUNTING_EXPENSEREPORT_JOURNAL'
);
/*
@@ -82,8 +81,8 @@ llxHeader();
$form = new Form($db);
-$linkback=''.$langs->trans("BackToModuleList").' ';
-print load_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'title_setup');
+$linkback = '' . $langs->trans("BackToModuleList") . ' ';
+print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
$head = admin_accounting_prepare_head(null);
@@ -115,10 +114,8 @@ foreach ( $list as $key ) {
print "\n";
-
print ' ';
-
print '\n";
@@ -169,6 +164,5 @@ print 'load("main");
$langs->load("accountancy");
// Security check
-if (!$user->admin) accessforbidden();
-if (empty($conf->accounting->enabled)) accessforbidden();
-
+if (! $user->admin) {
+ accessforbidden();
+}
+if (empty($conf->accounting->enabled)) {
+ accessforbidden();
+}
+
// search & action GETPOST
$action = GETPOST('action');
$codeventil_buy = GETPOST('codeventil_buy', 'array');
@@ -73,14 +77,16 @@ $pagenext = $page + 1;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else {
- $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
+ $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
}
$offset = $limit * $page;
-if (! $sortfield)
+if (! $sortfield) {
$sortfield = "p.ref";
-if (! $sortorder)
+}
+if (! $sortorder) {
$sortorder = "ASC";
+}
// Sales or Purchase mode ?
if ($action == 'update') {
@@ -103,7 +109,7 @@ if ($action == 'update') {
$error ++;
}
}
-
+
if (! empty($btn_changeaccount)) {
$msg = '
' . $langs->trans("Processing") . '...
';
if (! empty($chk_prod)) {
@@ -115,11 +121,11 @@ if ($action == 'update') {
$cpt = 0;
foreach ( $chk_prod as $productid ) {
- $accounting_account_id=GETPOST('codeventil_'.$productid);
+ $accounting_account_id = GETPOST('codeventil_' . $productid);
- $result=$accounting->fetch($accounting_account_id,null,1);
- if ($result<0) {
- //setEventMessages(null, $accounting->errors, 'errors');
+ $result = $accounting->fetch($accounting_account_id, null, 1);
+ if ($result < 0) {
+ // setEventMessages(null, $accounting->errors, 'errors');
$msg .= '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . ' ' . $sql . ' ';
} else {
@@ -131,7 +137,7 @@ if ($action == 'update') {
$sql .= " SET accountancy_code_sell = " . $accounting->account_number;
}
$sql .= " WHERE rowid = " . $productid;
-
+
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
if ($db->query($sql)) {
$msg .= '
' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '
';
@@ -146,7 +152,6 @@ if ($action == 'update') {
$msg .= '
' . $langs->trans("AnyLineVentilate") . '
';
}
$msg .= '
' . $langs->trans("EndProcessing") . '
';
-
}
}
@@ -236,12 +241,12 @@ if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
- print load_fiche_titre($langs->trans("InitAccountancy"),'','title_setup');
+ print load_fiche_titre($langs->trans("InitAccountancy"), '', 'title_setup');
print '
';
-
- print $langs->trans("InitAccountancyDesc").'
';
+
+ print $langs->trans("InitAccountancyDesc") . '
';
print '
';
-
+
print '
';
print '';
@@ -345,26 +350,23 @@ if ($result) {
print '' . nl2br(dol_trunc($obj->description, $trunclengh)) . ' ';
// Accounting account buy
- if ($accounting_product_mode == 'ACCOUNTANCY_BUY')
- {
+ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
// print '' . $obj->accountancy_code_buy . ' ';
// TODO: replace by select
// print '' . $compta_prodbuy . ' ';
// TODO: we shoul set a user defined value to adjust user square / wide screen size
// $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print '';
- print $form->select_account($compta_prodbuy_id, 'codeventil_'.$product_static->id, 1);
+ print $form->select_account($compta_prodbuy_id, 'codeventil_' . $product_static->id, 1);
print ' ';
- }
- else
- {
+ } else {
// Accounting account sell
// print '' . $obj->accountancy_code_sell . ' ';
// TODO: replace by select
// TODO: we shoul set a user defined value to adjust user square / wide screen size
// $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print '';
- print $form->select_account($compta_prodsell_id, 'codeventil_'.$product_static->id, 1);
+ print $form->select_account($compta_prodsell_id, 'codeventil_' . $product_static->id, 1);
print ' ';
}
diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php
index c1902c16fee..3404ddcc8df 100644
--- a/htdocs/accountancy/bookkeeping/balancebymonth.php
+++ b/htdocs/accountancy/bookkeeping/balancebymonth.php
@@ -20,16 +20,15 @@
*/
/**
- * \file htdocs/accountancy/bookkeeping/balancebymonth.php
- * \ingroup Accounting Expert
- * \brief Balance by month
+ * \file htdocs/accountancy/bookkeeping/balancebymonth.php
+ * \ingroup Accounting Expert
+ * \brief Balance by month
*/
-
require '../../main.inc.php';
-
+
// Class
-require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
-require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs
$langs->load("main");
diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php
index 86aca8b8af4..2d7242ff225 100644
--- a/htdocs/accountancy/bookkeeping/card.php
+++ b/htdocs/accountancy/bookkeeping/card.php
@@ -18,15 +18,14 @@
*/
/**
- * \file htdocs/accountancy/bookkeeping/card.php
- * \ingroup Accounting Expert
- * \brief Page to show account
+ * \file htdocs/accountancy/bookkeeping/card.php
+ * \ingroup Accounting Expert
+ * \brief Page to show account
*/
-
require '../../main.inc.php';
// Class
-require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
+require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
// Langs
@@ -34,8 +33,9 @@ $langs->load("accountancy");
// Security check
$id = GETPOST('id', 'int');
-if ($user->societe_id > 0)
- accessforbidden();
+if ($user->societe_id > 0) {
+ accessforbidden();
+}
$action = GETPOST('action');
$piece_num = GETPOST("piece_num");
@@ -44,150 +44,150 @@ $mesg = '';
$account_number = GETPOST('account_number');
$code_tiers = GETPOST('code_tiers');
-if ($code_tiers==-1) {
- $code_tiers=null;
+if ($code_tiers == - 1) {
+ $code_tiers = null;
}
$label_compte = GETPOST('label_compte');
$debit = price2num(GETPOST('debit'));
$credit = price2num(GETPOST('credit'));
-$save=GETPOST('save');
-if (!empty($save)) {
- $action='add';
+$save = GETPOST('save');
+if (! empty($save)) {
+ $action = 'add';
}
-$update=GETPOST('update');
-if (!empty($update)) {
- $action='confirm_update';
+$update = GETPOST('update');
+if (! empty($update)) {
+ $action = 'confirm_update';
}
if ($action == "confirm_update") {
-
- $error = 0;
-
- if ((floatval($debit)!=0.0) && (floatval($credit)!=0.0)) {
- setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
- $error ++;
- }
-
- if (empty($error)) {
- $book = new BookKeeping($db);
-
- $result = $book->fetch($id);
- if ($result < 0) {
- setEventMessages($book->error, $book->errors, 'errors');
- } else {
- $book->numero_compte = $account_number;
- $book->code_tiers = $code_tiers;
- $book->label_compte = $label_compte;
- $book->debit = $debit;
- $book->credit = $credit;
-
- if (floatval($debit)!=0.0) {
- $book->montant = $debit;
- $book->sens = 'D';
- }
- if (floatval($credit)!=0.0) {
- $book->montant = $credit;
- $book->sens = 'C';
- }
-
- $result = $book->update($user);
- if ($result < 0) {
- setEventMessages($book->error, $book->errors, 'errors');
- } else {
- setEventMessages($langs->trans('Saved'), null, 'mesgs');
- $action = '';
- }
- }
- }
-}
-
-else if ($action == "add") {
- $error = 0;
-
+
+ $error = 0;
+
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$error ++;
}
+
+ if (empty($error)) {
+ $book = new BookKeeping($db);
+
+ $result = $book->fetch($id);
+ if ($result < 0) {
+ setEventMessages($book->error, $book->errors, 'errors');
+ } else {
+ $book->numero_compte = $account_number;
+ $book->code_tiers = $code_tiers;
+ $book->label_compte = $label_compte;
+ $book->debit = $debit;
+ $book->credit = $credit;
+
+ if (floatval($debit) != 0.0) {
+ $book->montant = $debit;
+ $book->sens = 'D';
+ }
+ if (floatval($credit) != 0.0) {
+ $book->montant = $credit;
+ $book->sens = 'C';
+ }
+
+ $result = $book->update($user);
+ if ($result < 0) {
+ setEventMessages($book->error, $book->errors, 'errors');
+ } else {
+ setEventMessages($langs->trans('Saved'), null, 'mesgs');
+ $action = '';
+ }
+ }
+ }
+}
- if (empty($error)) {
- $book = new BookKeeping($db);
-
+else if ($action == "add") {
+ $error = 0;
+
+ if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
+ setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
+ $error ++;
+ }
+
+ if (empty($error)) {
+ $book = new BookKeeping($db);
+
$book->numero_compte = $account_number;
- $book->code_tiers = $code_tiers;
- $book->label_compte = $label_compte;
- $book->debit = $debit;
- $book->credit = $credit;
- $book->doc_date = GETPOST('doc_date');
- $book->doc_type = GETPOST('doc_type');
- $book->piece_num = $piece_num;
- $book->doc_ref = GETPOST('doc_ref');
- $book->code_journal = GETPOST('code_journal');
- $book->fk_doc = GETPOST('fk_doc');
- $book->fk_docdet = GETPOST('fk_docdet');
-
+ $book->code_tiers = $code_tiers;
+ $book->label_compte = $label_compte;
+ $book->debit = $debit;
+ $book->credit = $credit;
+ $book->doc_date = GETPOST('doc_date');
+ $book->doc_type = GETPOST('doc_type');
+ $book->piece_num = $piece_num;
+ $book->doc_ref = GETPOST('doc_ref');
+ $book->code_journal = GETPOST('code_journal');
+ $book->fk_doc = GETPOST('fk_doc');
+ $book->fk_docdet = GETPOST('fk_docdet');
+
if (floatval($debit) != 0.0) {
- $book->montant = $debit;
- $book->sens = 'D';
- }
+ $book->montant = $debit;
+ $book->sens = 'D';
+ }
if (floatval($credit) != 0.0) {
- $book->montant = $credit;
- $book->sens = 'C';
- }
-
- $result = $book->createStd($user);
- if ($result < 0) {
- setEventMessages($book->error, $book->errors, 'errors');
- } else {
- setEventMessages($langs->trans('Saved'), null, 'mesgs');
- $action = '';
- }
- }
-}
+ $book->montant = $credit;
+ $book->sens = 'C';
+ }
+
+ $result = $book->createStd($user);
+ if ($result < 0) {
+ setEventMessages($book->error, $book->errors, 'errors');
+ } else {
+ setEventMessages($langs->trans('Saved'), null, 'mesgs');
+ $action = '';
+ }
+ }
+}
else if ($action == "confirm_delete") {
- $book = new BookKeeping($db);
-
- $result = $book->fetch($id);
-
- $piece_num = $book->piece_num;
-
- if ($result < 0) {
- setEventMessages($book->error, $book->errors, 'errors');
- } else {
- $result = $book->delete($user);
- if ($result < 0) {
- setEventMessages($book->error, $book->errors, 'errors');
- }
- }
- $action = '';
-}
+ $book = new BookKeeping($db);
+
+ $result = $book->fetch($id);
+
+ $piece_num = $book->piece_num;
+
+ if ($result < 0) {
+ setEventMessages($book->error, $book->errors, 'errors');
+ } else {
+ $result = $book->delete($user);
+ if ($result < 0) {
+ setEventMessages($book->error, $book->errors, 'errors');
+ }
+ }
+ $action = '';
+}
else if ($action == "confirm_create") {
- $book = new BookKeeping($db);
-
- $book->label_compte = '';
- $book->debit = 0;
- $book->credit = 0;
- $book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
- $book->doc_type = GETPOST('doc_type');
- $book->piece_num = GETPOST('next_num_mvt');
- $book->doc_ref = GETPOST('doc_ref');
- $book->code_journal = GETPOST('code_journal');
- $book->fk_doc = 0;
- $book->fk_docdet = 0;
-
- $book->montant = 0;
-
- $result = $book->createStd($user);
- if ($result < 0) {
- setEventMessages($book->error, $book->errors, 'errors');
- } else {
- setEventMessages($langs->trans('Saved'), null, 'mesgs');
- $action = '';
- $piece_num = $book->piece_num;
- }
+ $book = new BookKeeping($db);
+
+ $book->label_compte = '';
+ $book->debit = 0;
+ $book->credit = 0;
+ $book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
+ $book->doc_type = GETPOST('doc_type');
+ $book->piece_num = GETPOST('next_num_mvt');
+ $book->doc_ref = GETPOST('doc_ref');
+ $book->code_journal = GETPOST('code_journal');
+ $book->fk_doc = 0;
+ $book->fk_docdet = 0;
+
+ $book->montant = 0;
+
+ $result = $book->createStd($user);
+ if ($result < 0) {
+ setEventMessages($book->error, $book->errors, 'errors');
+ } else {
+ setEventMessages($langs->trans('Saved'), null, 'mesgs');
+ $action = '';
+ $piece_num = $book->piece_num;
+ }
}
llxHeader();
@@ -199,115 +199,115 @@ $formventilation = new FormVentilation($db);
* Confirmation to delete the command
*/
if ($action == 'delete') {
- $formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
- print $formconfirm;
+ $formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
+ print $formconfirm;
}
if ($action == 'create') {
- print load_fiche_titre($langs->trans("CreateMvts"));
-
- $code_journal_array = array (
- $conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL,
- $conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL,
- $conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL,
- $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL,
- $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL
- );
-
- $sql = 'SELECT DISTINCT accountancy_journal FROM '.MAIN_DB_PREFIX.'bank_account WHERE clos=0';
- $resql=$db->query($sql);
- if (!$resql) {
- setEventMessages($db->lasterror,null,'errors');
- } else {
- while ($obj_bank=$db->fetch_object($resql)) {
- if (!empty($obj_bank->accountancy_journal)) {
- $code_journal_array[$obj_bank->accountancy_journal]=$obj_bank->accountancy_journal;
- }
- }
- }
-
- $book = new BookKeeping($db);
- $next_num_mvt = $book->getNextNumMvt();
-
- print '';
+ print load_fiche_titre($langs->trans("CreateMvts"));
+
+ $code_journal_array = array (
+ $conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL,
+ $conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL,
+ $conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL,
+ $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL,
+ $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL
+ );
+
+ $sql = 'SELECT DISTINCT accountancy_journal FROM ' . MAIN_DB_PREFIX . 'bank_account WHERE clos=0';
+ $resql = $db->query($sql);
+ if (! $resql) {
+ setEventMessages($db->lasterror, null, 'errors');
+ } else {
+ while ( $obj_bank = $db->fetch_object($resql) ) {
+ if (! empty($obj_bank->accountancy_journal)) {
+ $code_journal_array[$obj_bank->accountancy_journal] = $obj_bank->accountancy_journal;
+ }
+ }
+ }
+
+ $book = new BookKeeping($db);
+ $next_num_mvt = $book->getNextNumMvt();
+
+ print '';
} else {
- $book = new BookKeeping($db);
- $result = $book->fetchPerMvt($piece_num);
- if ($result < 0) {
- setEventMessages($book->error, $book->errors, 'errors');
- }
- if (! empty($book->piece_num)) {
-
- print load_fiche_titre($langs->trans("UpdateMvts"));
-
- print '';
- print '';
- print '' . $langs->trans("NumMvts") . ' ';
- print '' . $book->piece_num . ' ';
- print ' ';
- print '';
- print '' . $langs->trans("Docdate") . ' ';
- print '' . dol_print_date($book->doc_date, 'daytextshort') . ' ';
- print ' ';
- print '';
- print '' . $langs->trans("Codejournal") . ' ';
- print '' . $book->code_journal . ' ';
- print ' ';
- print '';
- print '' . $langs->trans("Docref") . ' ';
- print '' . $book->doc_ref . ' ';
- print ' ';
- print '';
- print '' . $langs->trans("Doctype") . ' ';
- print '' . $book->doc_type . ' ';
- print ' ';
- print '
';
-
- $result = $book->fetch_all_per_mvt($piece_num);
- if ($result < 0) {
- setEventMessages($book->error, $book->errors, 'errors');
- } else {
-
- print load_fiche_titre($langs->trans("ListeMvts"));
+ $book = new BookKeeping($db);
+ $result = $book->fetchPerMvt($piece_num);
+ if ($result < 0) {
+ setEventMessages($book->error, $book->errors, 'errors');
+ }
+ if (! empty($book->piece_num)) {
+
+ print load_fiche_titre($langs->trans("UpdateMvts"), '' . $langs->trans('BackToList') . ' ');
+
+ print '';
+ print '';
+ print '' . $langs->trans("NumMvts") . ' ';
+ print '' . $book->piece_num . ' ';
+ print ' ';
+ print '';
+ print '' . $langs->trans("Docdate") . ' ';
+ print '' . dol_print_date($book->doc_date, 'daytextshort') . ' ';
+ print ' ';
+ print '';
+ print '' . $langs->trans("Codejournal") . ' ';
+ print '' . $book->code_journal . ' ';
+ print ' ';
+ print '';
+ print '' . $langs->trans("Docref") . ' ';
+ print '' . $book->doc_ref . ' ';
+ print ' ';
+ print '';
+ print '' . $langs->trans("Doctype") . ' ';
+ print '' . $book->doc_type . ' ';
+ print ' ';
+ print '
';
+
+ $result = $book->fetch_all_per_mvt($piece_num);
+ if ($result < 0) {
+ setEventMessages($book->error, $book->errors, 'errors');
+ } else {
+
+ print load_fiche_titre($langs->trans("ListeMvts"));
print '';
+ }
+ }
+ } else {
+ print load_fiche_titre($langs->trans("NoRecords"));
+ }
}
llxFooter();
-$db->close();
+$db->close();
\ No newline at end of file
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index c517df2d129..d6925ac1995 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -46,10 +46,10 @@ $search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST(
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt")) {
- $action='delbookkeepingyear';
+ $action = 'delbookkeepingyear';
}
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) {
- $action='export_csv';
+ $action = 'export_csv';
}
$search_accountancy_code = GETPOST("search_accountancy_code");
@@ -79,8 +79,6 @@ $search_ledger_code = GETPOST('search_ledger_code', 'alpha');
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
-
-
$offset = $limit * $page;
$object = new BookKeeping($db);
@@ -114,9 +112,8 @@ if (empty($search_date_start)) {
}
if ($sortorder == "")
$sortorder = "ASC";
- if ($sortfield == "")
- $sortfield = "t.rowid";
-
+if ($sortfield == "")
+ $sortfield = "t.rowid";
$options = '';
$filter = array ();
@@ -181,7 +178,6 @@ if (! empty($search_mvt_num)) {
$options .= '&search_mvt_num=' . $search_mvt_num;
}
-
/*
* Action
*/
@@ -218,18 +214,18 @@ if ($action == 'delbookkeeping') {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
- //if (!empty($options)) {
- // Header("Location: list.php?".urldecode($options));
- //} else {
- Header("Location: list.php");
- //}
+ // if (!empty($options)) {
+ // Header("Location: list.php?".urldecode($options));
+ // } else {
+ Header("Location: list.php");
+ // }
exit();
}
} elseif ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = 'bookkepping';
- include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
+ include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
if ($result < 0) {
@@ -237,32 +233,30 @@ if ($action == 'delbookkeeping') {
}
foreach ( $object->lines as $line ) {
-
- if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
- {
+
+ if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
// Model Cegid Expert Export
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $date . $sep;
print $line->code_journal . $sep;
print length_accountg($line->numero_compte) . $sep;
- print ' '. $sep;
+ print ' ' . $sep;
print $line->sens . $sep;
print price($line->montant) . $sep;
print dol_trunc($line->label_compte, 32) . $sep;
print $line->doc_ref . $sep;
/*print $line->piece_num . $sep;
- print length_accounta($line->code_tiers) . $sep;
- print . $sep;
- print price($line->debit) . $sep;
- print price($line->credit) . $sep;*/
+ print length_accounta($line->code_tiers) . $sep;
+ print . $sep;
+ print price($line->debit) . $sep;
+ print price($line->credit) . $sep;*/
print "\n";
- }
- elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
+ } elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
- //Std export
+ // Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
print $date . $sep;
print $line->doc_ref . $sep;
@@ -272,14 +266,14 @@ if ($action == 'delbookkeeping') {
print price($line->credit) . $sep;
/*print $line->piece_num . $sep;
- print $line->label_compte . $sep;
- print price($line->montant) . $sep;
- print $line->sens . $sep;*/
+ print $line->label_compte . $sep;
+ print price($line->montant) . $sep;
+ print $line->sens . $sep;*/
print $line->code_journal . $sep;
print "\n";
- }elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
+ } elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
- //Coala export
+ // Coala export
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $sep;
print $line->code_journal . $sep;
@@ -297,7 +291,7 @@ if ($action == 'delbookkeeping') {
else {
- $title_page=$langs->trans("Bookkeeping") .' '. dol_print_date($search_date_start).'-'.dol_print_date($search_date_end);
+ $title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
llxHeader('', $title_page);
@@ -324,15 +318,21 @@ else {
}
if ($action == 'delbookkeepingyear') {
- $form_question=array();
- $delyear=GETPOST('delyear');
+ $form_question = array ();
+ $delyear = GETPOST('delyear');
if (empty($delyear)) {
- $delyear=dol_print_date(dol_now(),'%Y');
+ $delyear = dol_print_date(dol_now(), '%Y');
}
- $year_array=$formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear',0,'array');
+ $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
- $form_question['delyear']=array('name'=>'delyear','type'=>'select','label'=>$langs->trans('DelYear'),'values'=>$year_array,'default'=>$delyear);
+ $form_question['delyear'] = array (
+ 'name' => 'delyear',
+ 'type' => 'select',
+ 'label' => $langs->trans('DelYear'),
+ 'values' => $year_array,
+ 'default' => $delyear
+ );
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
print $formconfirm;
@@ -351,33 +351,32 @@ else {
print '';*/
print '