diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 0500ac4a0a756c1782898f31eea87d49b7936309..77c9a4a135e59184e222d8edf6fa4287ae6a7859 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -27,6 +27,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; // Langs $langs->load("accountancy"); @@ -41,12 +42,24 @@ $piece_num = GETPOST("piece_num"); $mesg = ''; -$numero_compte = GETPOST('numero_compte'); +$account_number = GETPOST('account_number'); $code_tiers = GETPOST('code_tiers'); +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'; +} +$update=GETPOST('update'); +if (!empty($update)) { + $action='confirm_update'; +} + if ($action == "confirm_update") { $error = 0; @@ -63,7 +76,7 @@ if ($action == "confirm_update") { if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { - $book->numero_compte = $numero_compte; + $book->numero_compte = $account_number; $book->code_tiers = $code_tiers; $book->label_compte = $label_compte; $book->debit = $debit; @@ -92,15 +105,15 @@ if ($action == "confirm_update") { else if ($action == "add") { $error = 0; - if ((intval($debit) != 0) && (intval($credit) != 0)) { - setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); - $error ++; - } + 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 = $numero_compte; + $book->numero_compte = $account_number; $book->code_tiers = $code_tiers; $book->label_compte = $label_compte; $book->debit = $debit; @@ -113,11 +126,12 @@ else if ($action == "add") { $book->fk_doc = GETPOST('fk_doc'); $book->fk_docdet = GETPOST('fk_docdet'); - if (! empty($debit)) { + if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; } - if (! empty($credit)) { + + if (floatval($credit) != 0.0) { $book->montant = $credit; $book->sens = 'C'; } @@ -179,6 +193,7 @@ else if ($action == "confirm_create") { llxHeader(); $html = new Form($db); +$formventilation = new FormVentilation($db); /* * Confirmation to delete the command @@ -281,9 +296,21 @@ if ($action == 'create') { } else { print load_fiche_titre($langs->trans("ListeMvts")); + + print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">'; + print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n"; + print '<input type="hidden" name="doc_type" value="' . $book->doc_type . '">' . "\n"; + print '<input type="hidden" name="doc_ref" value="' . $book->doc_ref . '">' . "\n"; + print '<input type="hidden" name="code_journal" value="' . $book->code_journal . '">' . "\n"; + print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n"; + print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n"; + print "<table class=\"noborder\" width=\"100%\">"; if (count($book->linesmvt) > 0) { + $total_debit=0; + $total_credit=0; + print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans("Numerocompte")); @@ -301,21 +328,26 @@ if ($action == 'create') { $var = ! $var; print "<tr $bc[$var]>"; + $total_debit+=$line->debit; + $total_credit+=$line->credit; + if ($action == 'update' && $line->id == $id) { - print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">'; - print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n"; - print '<input type="hidden" name="action" value="confirm_update">' . "\n"; - print '<td><input type="text" size="6" name="numero_compte" value="' . $line->numero_compte . '"/></td>'; - print '<td><input type="text" size="15" name="code_tiers" value="' . $line->code_tiers . '"/></td>'; + + print '<td>'; + print $formventilation->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1,''); + print '</td>'; + print '<td>'; + print $formventilation->select_auxaccount($line->code_tiers, 'code_tiers',1); + print '</td>'; print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>'; print '<td><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>'; print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>'; print '<td>' . $line->montant . '</td>'; print '<td>' . $line->sens . '</td>'; print '<td>'; - print '<input type="submit" class="button" value="' . $langs->trans("Update") . '">'; - print '</form>'; + print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n"; + print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">'; print '</td>'; } else { print '<td>' . $line->numero_compte . '</td>'; @@ -327,10 +359,10 @@ if ($action == 'create') { print '<td>' . $line->sens . '</td>'; print '<td>'; - print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">'; + print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">'; print img_edit(); print '</a> '; - print '<a href="./card.php?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '">'; + print '<a href="./card.php?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '">'; print img_delete(); print '</a>'; @@ -339,34 +371,32 @@ if ($action == 'create') { print "</tr>\n"; } + if ($total_debit!=$total_credit) { + setEventMessages(null, array('MvtNotCorrectlyBalanced',$total_credit,$total_debit),'errors'); + } + if ($action == "" || $action == 'add') { $var = ! $var; print "<tr $bc[$var]>"; - - print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">'; - print '<input type="hidden" name="action" value="add">' . "\n"; - print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n"; - print '<input type="hidden" name="doc_type" value="' . $book->doc_type . '">' . "\n"; - print '<input type="hidden" name="doc_ref" value="' . $book->doc_ref . '">' . "\n"; - print '<input type="hidden" name="code_journal" value="' . $book->code_journal . '">' . "\n"; - print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n"; - print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n"; - print '<td><input type="text" size="6" name="numero_compte" value="' . $numero_compte . '"/></td>'; - print '<td><input type="text" size="15" name="code_tiers" value="' . $code_tiers . '"/></td>'; + print '<td>'; + print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); + print '</td>'; + print '<td>'; + print $formventilation->select_auxaccount($code_tiers, 'code_tiers',1); + print '</td>'; print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>'; print '<td><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>'; print '<td><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>'; print '<td></td>'; print '<td></td>'; - print '<td><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>'; + print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Save") . '"></td>'; print '</tr>'; } print '</table>'; print '</form>'; } } - } - else { + } else { print load_fiche_titre($langs->trans("NoRecords")); } } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 26a30171677dcf16a92b42a6cf66df900b0ecd4c..c5fea407a1200c1540412223692aca91d170d280 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -19,18 +19,17 @@ */ /** - * \file htdocs/accountancy/bookkeeping/list.php - * \ingroup Accounting Expert - * \brief List operation of book keeping + * \file htdocs/accountancy/bookkeeping/list.php + * \ingroup Accounting Expert + * \brief List operation of book keeping */ - require '../../main.inc.php'; - + // Class -require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; // Langs $langs->load("accountancy"); @@ -58,11 +57,11 @@ $formother = new FormOther($db); if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { - $search_doc_type=""; - $search_doc_ref=""; - $search_account=""; - $search_thirdparty=""; - $search_journal=""; + $search_piece_num = ""; + $search_doc_ref = ""; + $search_account = ""; + $search_thirdparty = ""; + $search_journal = ""; } /* @@ -80,8 +79,7 @@ if ($action == 'delbookkeeping') { setEventMessages($object->error, $object->errors, 'errors'); } } -} -elseif ($action == 'delbookkeepingyear') { +} elseif ($action == 'delbookkeepingyear') { $delyear = GETPOST('delyear', 'int'); @@ -93,8 +91,7 @@ elseif ($action == 'delbookkeepingyear') { setEventMessages($object->error, $object->errors, 'errors'); } } -} -elseif ($action == 'delbookkeepingyear') { +} elseif ($action == 'delbookkeepingyear') { $delyear = GETPOST('delyear', 'int'); @@ -106,7 +103,7 @@ elseif ($action == 'delbookkeepingyear') { setEventMessages($object->error, $object->errors, 'errors'); } } -}// Export +} // Export else if ($action == 'export_csv') { header('Content-Type: text/csv'); @@ -118,19 +115,55 @@ else if ($action == 'export_csv') { setEventMessages($object->error, $object->errors, 'errors'); } - foreach ( $object->linesexport as $line ) { - print $line->id . ','; - print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; - print '"' . $line->code_journal . '",'; - print '"' . $line->numero_compte . '",'; - print '"' . substr($line->code_journal, 0, 2) . '",'; - print '"' . substr($line->doc_ref, 0, 40) . '",'; - print '"' . $line->num_piece . '",'; - print '"' . $line->montant . '",'; - print '"' . $line->sens . '",'; - print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; - print '"' . $conf->currency . '",'; - print "\n"; + // Model classic Export + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) { + + foreach ( $object->linesexport as $line ) { + print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; + print '"' . $line->code_journal . '",'; + print '"' . $line->numero_compte . '",'; + print '"' . substr($line->code_journal, 0, 2) . '",'; + print '"' . substr($line->doc_ref, 0, 40) . '",'; + print '"' . $line->num_piece . '",'; + print '"' . $line->debit . '",'; + print '"' . $line->credit . '",'; + print '"' . $conf->currency . '",'; + print "\n"; + } + } + // Model cegid Export + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) { + foreach ( $object->linesexport as $line ) { + print $line->id . ','; + print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; + print '"' . $line->code_journal . '",'; + print '"' . $line->numero_compte . '",'; + print '"' . substr($line->code_journal, 0, 2) . '",'; + print '"' . substr($line->doc_ref, 0, 40) . '",'; + print '"' . $line->num_piece . '",'; + print '"' . $line->montant . '",'; + print '"' . $line->sens . '",'; + print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; + print '"' . $conf->currency . '",'; + print "\n"; + } + } + // Model Coala Export + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) { + foreach ( $object->linesexport as $line ) { + print $line->id . ','; + print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; + print '"' . $line->code_journal . '",'; + print '"' . $line->numero_compte . '",'; + print '"' . substr($line->code_journal, 0, 2) . '",'; + print '"' . substr($line->doc_ref, 0, 40) . '",'; + print '"' . $line->num_piece . '",'; + print '"' . $line->montant . '",'; + print '"' . $line->sens . '",'; + print '"' . dol_print_date($line->doc_date, '%d%m%Y') . '",'; + print '"' . $conf->currency . '",'; + print "\n"; + } } } @@ -138,16 +171,16 @@ else { llxHeader('', $langs->trans("Bookkeeping")); -/* - * List - */ + /* + * List + */ $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num "; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk"; if (dol_strlen(trim($search_doc_type))) { - $sql .= " WHERE bk.doc_type LIKE '%" . $search_doc_type . "%'"; + $sql .= " WHERE bk.piece_num LIKE '%" . $search_piece_num . "%'"; if (dol_strlen(trim($search_doc_ref))) { $sql .= " AND bk.doc_ref LIKE '%" . $search_doc_ref . "%'"; @@ -177,20 +210,20 @@ else { print_barre_liste($langs->trans("Bookkeeping"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num); /*print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; - print '<input type="hidden" name="action" value="delbookkeeping">'; - - print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey')); - - print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>'; - - print '</form>';*/ + print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; + print '<input type="hidden" name="action" value="delbookkeeping">'; + + print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey')); + + print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>'; + + print '</form>';*/ print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="delbookkeepingyear">'; - print $formother->select_year(GETPOST('delyear'),'delyear'); + print $formother->select_year(GETPOST('delyear'), 'delyear'); print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>'; @@ -204,7 +237,7 @@ else { print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; - print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "bk.doc_type", "", "", "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "bk.piece_num", "", "", "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "bk.doc_date", "", "", "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "bk.doc_ref", "", "", "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "bk.numero_compte", "", "", "", $sortfield, $sortorder); @@ -215,12 +248,12 @@ else { print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "bk.montant", "", "", 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "bk.sens", "", "", 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "bk.code_journal", "", "", "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); print "</tr>\n"; print '<tr class="liste_titre">'; - print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">'; - print '<td><input type="text" name="search_doc_type" size="8" value="' . $search_doc_type . '"></td>'; + print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">'; + print '<td><input type="text" name="search_doc_type" size="8" value="' . $search_piece_num . '"></td>'; print '<td> </td>'; print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>'; print '<td><input type="text" name="search_account" size="8" value="' . $search_account . '"></td>'; @@ -232,9 +265,9 @@ else { print '<td> </td>'; print '<td><input type="text" name="search_journal" size="3" value="' . $search_journal . '"></td>'; print '<td align="right" colspan="2" class="liste_titre">'; - print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; + print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; print ' '; - print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; + print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">'; print '</td>'; print '</form>'; print '</tr>'; @@ -247,7 +280,16 @@ else { print "<tr $bc[$var]>"; - print '<td>' . $obj->doc_type . '</td>'; + /* if ($old_piecenum!=$obj->piece_num) { + $total_debit=0; + $total_credit=0; + } else { + $total_debit+=$obj->debit; + $total_credit+=$obj->credit; + } + */ + + print '<td>' . $obj->piece_num . '</td>'; print '<td align="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>'; print '<td>' . $obj->doc_ref . '</td>'; print '<td>' . length_accountg($obj->numero_compte) . '</td>'; @@ -260,19 +302,23 @@ else { print '<td>' . $obj->code_journal . '</td>'; print '<td align="center"><a href="./card.php?piece_num=' . $obj->piece_num . '">' . img_edit() . '</a></td>'; print "</tr>\n"; + + //$old_piecenum= $obj->piece_num; $i ++; } print "</table>"; - + print '<div class="tabsAction">'; - print '<a class="butAction" href="./card.php?action=create">'.$langs->trans("NewAccountingMvt").'</a>'; + print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>'; print '</div>'; - + $db->free($resql); } else { dol_print_error($db); } + + llxFooter(); } -llxFooter(); + $db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index f92f5b3ab88d106737e71724467dc40c1bcdff8e..5e838fb475fc1aeefa3c7107ea84fb4112125dd9 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -265,4 +265,81 @@ class FormVentilation extends Form $this->db->free($resql); return $out; } + + /** + * Return list of auxilary thirdparty accounts + * + * @param string $selectid Preselected pcg_type + * @param string $htmlname Name of field in html form + * @param int $showempty Add an empty field + * @param array $event Event options + * + * @return string String with HTML select + */ + function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) { + global $conf; + + $out = ''; + + $aux_account = array (); + + // Auxiliary customer account + $sql = "SELECT DISTINCT code_compta, nom "; + $sql .= " FROM " . MAIN_DB_PREFIX . "societe"; + $sql .= " ORDER BY code_compta"; + dol_syslog(get_class($this) . "::select_auxaccount", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + while ( $obj = $this->db->fetch_object($resql) ) { + if (! empty($obj->code_compta)) { + $aux_account[$obj->code_compta] = $obj->code_compta . ' (' . $obj->nom . ')'; + } + } + } else { + $this->error = "Error " . $this->db->lasterror(); + dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR); + return - 1; + } + $this->db->free($resql); + + // Auxiliary supplier account + $sql = "SELECT DISTINCT code_compta_fournisseur, nom "; + $sql .= " FROM " . MAIN_DB_PREFIX . "societe"; + $sql .= " ORDER BY code_compta"; + dol_syslog(get_class($this) . "::select_auxaccount", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + while ( $obj = $this->db->fetch_object($resql) ) { + if (! empty($obj->code_compta_fournisseur)) { + $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur . ' (' . $obj->nom . ')'; + } + } + } else { + $this->error = "Error " . $this->db->lasterror(); + dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR); + return - 1; + } + $this->db->free($resql); + + + //Build select + if (count($aux_account) > 0) { + + $out .= ajax_combobox($htmlname, $event); + + $out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">'; + if ($showempty) + $out .= '<option value="-1"></option>'; + foreach ( $aux_account as $key => $val ) { + if (($selectid != '') && $selectid == $key) { + $out .= '<option value="' . $key . '" selected>' . $val . '</option>'; + } else { + $out .= '<option value="' . $key . '">' . $val . '</option>'; + } + } + $out .= '</select>'; + } + + return $out; + } } diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 4361e730a2692d9a54851fb4f9a6c3af46b37c9e..7c025c8a893d92554f27dd45bde56b4f26a67b89 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -72,7 +72,7 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { $offset = $limit * $page; if (! $sortfield) - $sortfield = "f.facnumber"; + $sortfield = "f.datef, f.facnumber, l.rowid"; if (! $sortorder) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 10dd38807a42ae0c4603f65ada6a0e7f6803c767..b33becb3f473e4fb7ade751f9d0520dd4513959c 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -355,7 +355,7 @@ if ($action == 'writebookkeeping') $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_ref = $val["ref"]; - $bookkeeping->doc_type = 'banque'; + $bookkeeping->doc_type = 'bank'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->label_compte = $tabcompany[$key]['name']; @@ -675,6 +675,7 @@ else print "</table>"; + llxFooter(); } -llxFooter(); + $db->close(); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index b603c1863bbad75ef3bee6bece04ed4d34c38820..2346df27c7738227d08b79a99d01bc46f7fa78eb 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> - * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> + * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * * 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 @@ -487,7 +487,9 @@ if ($action == 'export_csv') } print "</table>"; - + + // End of page + llxFooter(); } -llxFooter(); + $db->close(); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 51f4766cc185ce48ca474e74385d2e08c478c0d9..b0ebc8e8df7abf79c1d9280fbaf688ff885e61fc 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -531,6 +531,7 @@ if ($action == 'export_csv') print "</table>"; + llxFooter(); } -llxFooter(); + $db->close(); diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index b843f83e1d0618a340caba88767f2e05a1b2c6b5..aad079d2b0eab8761d7d3b539655de5aafc5820f 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1034,7 +1034,7 @@ function price2numjs(amount) { print "var dec='" . $dec . "'; var thousand='" . $thousand . "';\n"; // Set var in javascript ?> - var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>; + var main_max_dec_shown = <?php echo str_replace('.', '', $conf->global->MAIN_MAX_DECIMALS_SHOWN); ?>; var main_rounding_unit = <?php echo $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>; var main_rounding_tot = <?php echo $conf->global->MAIN_MAX_DECIMALS_TOT; ?>; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a04448b60d69b17991037cd500d26a6ebf40f59f..b22d9256c12b70f887554c5b98ace2a9ae1e7b9d 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -822,7 +822,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE)) { $langs->load("supplier"); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); // if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); } } diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 80759ffe9d8e114daaaa38f430c665b75761a91b..ed7eb22c21dcc4d6a53979c66ac94eb263ded103 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -571,7 +571,7 @@ insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (4108, 'Mitarbeitervorsorgekasse', 1,1,'TAXATMVK' ,'41'); insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (4109, 'Familienlastenausgleichsfond', 1,1,'TAXATFLAF' ,'41'); -ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN doc_ref varchar(255) NOT NULL; +ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN doc_ref varchar(300) NOT NULL; ALTER TABLE llx_holiday ADD COLUMN tms timestamp; ALTER TABLE llx_holiday ADD COLUMN entity integer DEFAULT 1 NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql index dca4b70a5d56a2c93b1001832e5d11e4e851554f..0f0c3d4ebf97dc5725a7370737136e3819a4ad3a 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql @@ -22,7 +22,7 @@ CREATE TABLE llx_accounting_bookkeeping rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, doc_date date NOT NULL, doc_type varchar(30) NOT NULL, -- facture_client/reglement_client/facture_fournisseur/reglement_fournisseur - doc_ref varchar(255) NOT NULL, -- facture_client/reglement_client/... reference number + doc_ref varchar(300) NOT NULL, -- facture_client/reglement_client/... reference number fk_doc integer NOT NULL, -- facture_client/reglement_client/... rowid fk_docdet integer NOT NULL, -- facture_client/reglement_client/... line rowid code_tiers varchar(24), -- code tiers diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index dad6b236d92da2bf3be8193f3172cdc8627d7b7e..d7db34b11052e31b4cd714ed1c2c6c6eacbad398 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -169,3 +169,5 @@ Param=Additionnal parameters EnabledProduct=In Product EnabledTiers=In Tiers EnabledVat=In Vat + +MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s \ No newline at end of file