diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 0dc1798ef57..0b43e99b1d8 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -198,7 +198,8 @@ if (! $conf->use_javascript_ajax) { $listmodelcsv = array ( '1' => $langs->trans("Modelcsv_normal"), '2' => $langs->trans("Modelcsv_CEGID"), - '3' => $langs->trans("Modelcsv_COALA") + '3' => $langs->trans("Modelcsv_COALA"), + '4' => $langs->trans("Modelcsv_bob50") ); print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0); diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 16027a42af4..3e4b69d6624 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -106,81 +106,38 @@ if (! empty($search_accountancy_code_end)) { if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $journal = 'bookkepping'; - + include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; - - $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); + + $result = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - + foreach ( $object->lines as $line ) { - + 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 $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 "\n"; - } elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) { - - // Std export - $date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE); - print $date . $sep; - print $line->doc_ref . $sep; - print length_accounta($line->numero_compte) . $sep; - print length_accountg($line->code_tiers) . $sep; - print price($line->debit) . $sep; - 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->code_journal . $sep; - print "\n"; - } elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) { - - // Coala export - $date = dol_print_date($line->doc_date, '%d/%m/%Y'); - print $date . $sep; - print $line->code_journal . $sep; - print length_accounta($line->numero_compte) . $sep; - print $line->piece_num . $sep; - print $line->doc_ref . $sep; - print price($line->debit) . $sep; - print price($line->credit) . $sep; - print 'E' . $sep; - print length_accountg($line->code_tiers) . $sep; - print "\n"; } + print length_accountg($line->numero_compte) . $sep; + print $line->debit . $sep; + print $line->credit . $sep; + print $line->debit . $sep; + print $line->credit - $line->debit . $sep; + print "\n"; } -} +} else { - + $title_page = $langs->trans("AccountBalance") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end); - + llxHeader('', $title_page); - + /* * List */ - + $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); @@ -188,27 +145,27 @@ else { setEventMessages($object->error, $object->errors, 'errors'); } } - + $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - + print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords); - + print '
'; print '
' . "\n"; print '
'; - + print '
'; - + print '
'; print $langs->trans('DateStart') . ': '; print $form->select_date($search_date_start, 'date_start', 0, 0, 1); print $langs->trans('DateEnd') . ': '; print $form->select_date($search_date_end, 'date_end', 0, 0, 1); print '
'; - + print ''; print ''; print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); @@ -217,7 +174,7 @@ else { print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print "\n"; - + print ''; print ''; - + print ''; print ''; print ''; - + print ''; - + print ''; - + $var = True; - + $total_debit = 0; $total_credit = 0; - + foreach ( $object->lines as $line ) { $var = ! $var; - + $total_debit += $line->debit; $total_credit += $line->credit; - + print ""; - + print ''; print ''; print ''; @@ -260,7 +217,7 @@ else { print ''; print "\n"; } - + print ''; print ''; print ''; print ''; print ''; - + print "
'; print $langs->trans('From'); @@ -226,32 +183,32 @@ else { print $langs->trans('To'); print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); print '   '; print ''; print ' '; print ''; print '
' . length_accountg($line->numero_compte) . '' . price($line->debit) . '' . price($line->credit) . '
'; @@ -272,10 +229,10 @@ else { print '' . price($total_credit - $total_debit) . '
"; print '
'; - + llxFooter(); } $db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 387df40122c..515736580f8 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -182,9 +182,9 @@ if (! empty($search_mvt_num)) { * Action */ if ($action == 'delbookkeeping') { - + $import_key = GETPOST('importkey', 'alpha'); - + if (! empty($import_key)) { $result = $object->deleteByImportkey($import_key); if ($result < 0) { @@ -194,9 +194,9 @@ if ($action == 'delbookkeeping') { exit(); } } elseif ($action == 'delbookkeepingyearconfirm') { - + $delyear = GETPOST('delyear', 'int'); - + if (! empty($delyear)) { $result = $object->deleteByYear($delyear); if ($result < 0) { @@ -206,34 +206,30 @@ if ($action == 'delbookkeeping') { exit(); } } elseif ($action == 'delmouvconfirm') { - + $mvt_num = GETPOST('mvt_num', 'int'); - + if (! empty($mvt_num)) { $result = $object->deleteMvtNum($mvt_num); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - // 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'; - + $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - + foreach ( $object->lines as $line ) { - + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) { $sep = ";"; // Model Cegid Expert Export @@ -246,16 +242,9 @@ if ($action == 'delbookkeeping') { 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 "\n"; } elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) { - + // Std export $date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE); print $date . $sep; @@ -264,15 +253,10 @@ if ($action == 'delbookkeeping') { print length_accounta($line->code_tiers) . $sep; print price($line->debit) . $sep; 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->code_journal . $sep; print "\n"; } elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) { - + // Coala export $date = dol_print_date($line->doc_date, '%d/%m/%Y'); print $date . $sep; @@ -285,23 +269,48 @@ if ($action == 'delbookkeeping') { print 'E' . $sep; print length_accountg($line->code_tiers) . $sep; print "\n"; + } elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 4) { + + // Bob50 + print $line->piece_num . $sep; + $date = dol_print_date($line->doc_date, '%d/%m/%Y'); + print $date . $sep; + + if (empty($line->code_tiers)) { + print 'G' . $sep; + print length_accounta($line->numero_compte) . $sep; + } else { + if (substr($line->numero_compte,0,3)=='411') { + print 'C' . $sep; + } + if (substr($line->numero_compte,0,3)=='401') { + print 'F' . $sep; + } + print length_accountg($line->code_tiers) . $sep; + + } + + print price($line->debit) . $sep; + print price($line->credit) . $sep; + print dol_trunc($line->label_compte, 32) . $sep; + print "\n"; } } -} +} /* * View */ else { - + $title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end); - + llxHeader('', $title_page); - + /* * List */ - + $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); @@ -309,78 +318,48 @@ else { setEventMessages($object->error, $object->errors, 'errors'); } } - + $result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - + if ($action == 'delmouv') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1); print $formconfirm; } if ($action == 'delbookkeepingyear') { - + $form_question = array (); $delyear = GETPOST('delyear'); - + if (empty($delyear)) { $delyear = dol_print_date(dol_now(), '%Y'); } $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 + 'default' => $delyear ); - + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1); print $formconfirm; } - + print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords); - - /*print '
'; - print ''; - print ''; - - print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey')); - - print '
'; - - print '
';*/ - + print '
'; print '
' . "\n"; print '
'; print ''; - // print '' . $langs->trans("Export") . ''; print '
'; - + print '
'; - - /*print '
'; - print $langs->trans('DateStart') . ': '; - print $form->select_date($search_date_start, 'date_start', 0, 0, 1); - print $langs->trans('DateEnd') . ': '; - print $form->select_date($search_date_end, 'date_end', 0, 0, 1); - print '
'; - print '
'; - print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': '; - print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); - print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': '; - print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); - print '
'; - print '
'; - print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; - print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); - print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; - print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); - print '
';*/ - + print ''; print ''; print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder); @@ -391,12 +370,10 @@ else { print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); - // print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder); - // print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print "\n"; - + print ''; print ''; print ''; @@ -404,61 +381,52 @@ else { print $langs->trans('From') . ': '; print $form->select_date($search_date_start, 'date_start', 0, 0, 1); print '
'; - 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_doc_date, 'doc_date', 0, 0, 1); print ''; print ''; print ''; - // print ''; print ''; - // print ''; - + print ''; print ''; print ''; - // print ''; - // print ''; print ''; print ''; - + print ''; - + $var = True; - + $total_debit = 0; $total_credit = 0; - + foreach ( $object->lines as $line ) { $var = ! $var; - + $total_debit += $line->debit; $total_credit += $line->credit; - + print ""; - + print ''; print ''; print ''; @@ -467,8 +435,6 @@ else { print ''; print ''; print ''; - // print ''; - // print ''; print ''; print ''; print "\n"; } - + print ''; print ''; print ''; print ''; print ''; - + print "
'; - // print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': '; print $langs->trans('From'); print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); - // print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': '; print '
'; - print $langs->trans('to'); + print $langs->trans('To'); print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); print '
'; - // print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; print $langs->trans('From'); print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); - // print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; print '
'; - print $langs->trans('to'); + print $langs->trans('To'); print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); print '
'; print ''; print '    '; print ''; print ' '; print ''; print '
' . $line->piece_num . '' . dol_print_date($line->doc_date, 'day') . '' . $line->doc_ref . '' . $line->label_compte . '' . price($line->debit) . '' . price($line->credit) . '' . price($line->montant) . '' . $line->sens . '' . $line->code_journal . ''; print '' . img_edit() . ' '; @@ -476,7 +442,7 @@ else { print '
'; @@ -487,10 +453,10 @@ else { print '
"; print '
'; - + llxFooter(); } diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index dfd52ec0f00..10640c1887a 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2013-2016 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -74,7 +74,6 @@ if (empty($search_date_start)) { $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y')); $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y')); } - if ($sortorder == "") $sortorder = "ASC"; if ($sortfield == "") @@ -184,13 +183,13 @@ print ''; print '
'; print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': '; print $formventilation->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, ''); -print $langs->trans('to') . ' ' . $langs->trans('AccountAccounting') . ': '; +print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': '; print $formventilation->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, ''); print '
'; print '
'; print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; print $formventilation->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1); -print $langs->trans('to') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; +print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; print $formventilation->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1); print '
'; print ""; @@ -257,9 +256,10 @@ print ''; -print ''; print "\n"; @@ -268,7 +268,7 @@ $var = True; foreach ( $object->lines as $line ) { $var = ! $var; - + print ""; print '' . "\n"; print '' . "\n"; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 0015dfbf9e9..f4b478b681e 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015-*2016 Florian Henry + * Copyright (C) 2015-2016 Florian Henry * Copyright (C) 2015 Raphaƫl Doursenaud * * This program is free software; you can redistribute it and/or modify @@ -1064,6 +1064,7 @@ class BookKeeping extends CommonObject $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; + dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); @@ -1118,7 +1119,7 @@ class BookKeeping extends CommonObject $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; - dol_syslog(get_class($this) . "fetch_all_per_mvt sql=" . $sql, LOG_DEBUG); + dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1147,7 +1148,7 @@ class BookKeeping extends CommonObject } } else { $this->error = "Error " . $this->db->lasterror(); - dol_syslog(get_class($this) . "::fetch_all_per_mvt " . $this->error, LOG_ERR); + dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR); return - 1; } diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 7b4d597fc12..471a329e64c 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -48,6 +48,8 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); +$search_country = GETPOST('search_country', 'alpha'); +$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); // Getpost Order and column and limit page $sortfield = GETPOST('sortfield', 'alpha'); @@ -68,7 +70,7 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { $offset = $limit * $page; if (! $sortfield) - $sortfield = "f.datef, f.facnumber, l.rowid"; + $sortfield = "f.datef, f.facnumber, fd.rowid"; if (! $sortorder) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { @@ -94,6 +96,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_amount = ''; $search_account = ''; $search_vat = ''; + $search_country = ''; + $search_tvaintra = ''; } if (is_array($changeaccount) && count($changeaccount) > 0) { @@ -150,14 +154,27 @@ print '
'; print ''; print ''; -$searchpitco=$form->showFilterAndCheckAddButtons(0); -print $searchpitco; +print ''; +print ''; +print ' '; +print ''; print '
' . $line->piece_num . '' . $line->doc_type . '