30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/lettering.class.php';
49$langs->loadLangs(array(
"accountancy",
"bills",
"compta"));
51$action =
GETPOST(
'action',
'aZ09');
52$cancel =
GETPOST(
'cancel',
'aZ09');
53$confirm =
GETPOST(
'confirm',
'alpha');
55$optioncss =
GETPOST(
'optioncss',
'aZ');
64$accountingaccount_number =
GETPOST(
'accountingaccount_number',
'alphanohtml');
65$accountingaccount->fetch(0, $accountingaccount_number,
true);
66$accountingaccount_label = $accountingaccount->label;
68$journal_code =
GETPOST(
'code_journal',
'alpha');
69$accountingjournal->fetch(0, $journal_code);
70$journal_label = $accountingjournal->label;
72$subledger_account =
GETPOST(
'subledger_account',
'alphanohtml');
73if ($subledger_account == -1) {
74 $subledger_account =
null;
76$subledger_label =
GETPOST(
'subledger_label',
'alphanohtml');
78$label_operation =
GETPOST(
'label_operation',
'alphanohtml');
82$save =
GETPOST(
'save',
'alpha');
86$update =
GETPOST(
'update',
'alpha');
88 $action =
'confirm_update';
92$hookmanager->initHooks(array(
'bookkeepingcard',
'globalcard'));
97if (!isModEnabled(
'accounting')) {
100if ($user->socid > 0) {
103if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
107$permissiontoadd = $user->hasRight(
'accounting',
'mouvements',
'creer');
108$permissiontodelete = $user->hasRight(
'accounting',
'mouvements',
'supprimer');
115$parameters = array();
116$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
120if (empty($reshook)) {
124 header(
"Location: ".DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php');
128 if ($action ==
"confirm_update" && $permissiontoadd) {
129 if (((
float) $debit != 0.0) && ((
float) $credit != 0.0)) {
134 if (empty($accountingaccount_number) || $accountingaccount_number ==
'-1') {
136 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
"AccountAccountingShort")),
null,
'errors');
143 $result =
$object->fetch($id,
null, $mode);
148 $object->numero_compte = $accountingaccount_number;
149 $object->subledger_account = $subledger_account;
150 $object->subledger_label = $subledger_label;
151 $object->label_compte = $accountingaccount_label;
152 $object->label_operation = $label_operation;
156 if ((
float) $debit != 0.0) {
161 if ((
float) $credit != 0.0) {
167 $result =
$object->update($user,
false, $mode);
171 if ($mode !=
'_tmp') {
182 } elseif ($action ==
"add" && $permissiontoadd) {
183 if (((
float) $debit != 0.0) && ((
float) $credit != 0.0)) {
188 if (empty($accountingaccount_number) || $accountingaccount_number ==
'-1') {
190 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
"AccountAccountingShort")),
null,
'errors');
203 $object->numero_compte = $accountingaccount_number;
204 $object->subledger_account = $subledger_account;
205 $object->subledger_label = $subledger_label;
206 $object->label_compte = $accountingaccount_label;
207 $object->label_operation = $label_operation;
212 $object->piece_num = $piece_num;
214 $object->code_journal = $journal_code;
215 $object->journal_label = $journal_label;
219 if ((
float) $debit != 0.0) {
225 if ((
float) $credit != 0.0) {
231 $result =
$object->createStd($user,
false, $mode);
236 if ($mode !=
'_tmp') {
246 } elseif ($action ==
"confirm_delete" && $permissiontoadd) {
249 $result =
$object->fetch($id,
null, $mode);
250 $piece_num = (int)
$object->piece_num;
257 $result =
$object->delete($user, 0, $mode);
263 } elseif ($action ==
"confirm_create" && $permissiontoadd) {
266 if (!$journal_code || $journal_code ==
'-1') {
267 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
"Journal")),
null,
'errors');
271 if (!
GETPOST(
'doc_ref',
'alpha')) {
272 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Piece")),
null,
'errors');
283 $object->doc_date = $date_start;
287 $object->code_journal = $journal_code;
288 $object->journal_label = $journal_label;
294 $result =
$object->createStd($user, 0, $mode);
301 $reshook = $hookmanager->executeHooks(
'afterCreateBookkeeping', $parameters,
$object, $action);
303 if ($mode !=
'_tmp') {
308 $piece_num = (int)
$object->piece_num;
313 if ($action ==
'setdate' && $permissiontoadd) {
315 $result =
$object->updateByMvt($piece_num,
'doc_date', $db->idate($datedoc), $mode);
319 if ($mode !=
'_tmp') {
326 if ($action ==
'setjournal' && $permissiontoadd) {
327 $result =
$object->updateByMvt($piece_num,
'code_journal', $journal_code, $mode);
328 $result =
$object->updateByMvt($piece_num,
'journal_label', $journal_label, $mode);
332 if ($mode !=
'_tmp') {
339 if ($action ==
'setdocref' && $permissiontoadd) {
340 $refdoc =
GETPOST(
'doc_ref',
'alpha');
341 $result =
$object->updateByMvt($piece_num,
'doc_ref', $refdoc, $mode);
345 if ($mode !=
'_tmp') {
353 if ($action ==
'valid' && $permissiontoadd) {
354 $result =
$object->transformTransaction(0, $piece_num);
358 header(
"Location: list.php?sortfield=t.piece_num&sortorder=asc");
364 $toselect = explode(
',',
GETPOST(
'toselect',
'alphanohtml'));
366 if ($action ==
'deletebookkeepingwriting' && $confirm ==
"yes" && $permissiontodelete) {
371 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
372 if ($nb_lettering < 0) {
381 foreach ($toselect as $toselectid) {
382 $result =
$object->fetch($toselectid);
383 if ($result >= 0 && (!isset(
$object->date_validation) ||
$object->date_validation ===
'')) {
392 } elseif ($result < 0) {
396 } elseif (isset(
$object->date_validation) &&
$object->date_validation !=
'') {
397 setEventMessages($langs->trans(
"ValidatedRecordWhereFound"),
null,
'errors');
410 } elseif ($nbok > 0) {
416 header(
"Location: ".DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?noreset=1');
430$form =
new Form($db);
433$title = $langs->trans(
"CreateMvts");
434$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double';
436llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-consultation page-card');
439if ($action ==
'delete') {
440 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&mode='.$mode, $langs->trans(
'DeleteMvt'), $langs->trans(
'ConfirmDeleteMvt', $langs->transnoentitiesnoconv(
"RegistrationInAccounting")),
'confirm_delete',
'', 0, 1);
444if ($action ==
'create') {
448 $next_num_mvt =
$object->getNextNumMvt(
'_tmp');
450 if (empty($next_num_mvt)) {
454 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="create_mvt" method="POST">';
455 if ($optioncss !=
'') {
456 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
458 print
'<input type="hidden" name="token" value="'.newToken().
'">';
459 print
'<input type="hidden" name="action" value="confirm_create">'.
"\n";
460 print
'<input type="hidden" name="next_num_mvt" value="'.$next_num_mvt.
'">'.
"\n";
461 print
'<input type="hidden" name="mode" value="_tmp">'.
"\n";
465 print
'<table class="border centpercent">';
473 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Docdate").
'</td>';
475 print $form->selectDate(
'',
'doc_date', 0, 0, 0,
"create_mvt", 1, 1);
480 print
'<td class="fieldrequired">'.$langs->trans(
"Codejournal").
'</td>';
481 print
'<td>'.$formaccounting->select_journal($journal_code,
'code_journal', 0, 0, 1, 1).
'</td>';
485 print
'<td class="fieldrequired">'.$langs->trans(
"Piece").
'</td>';
486 print
'<td><input type="text" class="minwidth200" name="doc_ref" value="'.GETPOST(
'doc_ref',
'alpha').
'"></td>';
495 $reshookAddLine = $hookmanager->executeHooks(
'bookkeepingAddLine', $parameters,
$object, $action);
501 print $form->buttonsSaveCancel(
"Create");
507 $result =
$object->fetchPerMvt($piece_num, $mode);
512 if (!empty(
$object->piece_num)) {
513 $backlink =
'<a href="'.DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?restore_lastsearch_values=1">'.$langs->trans(
'BackToList').
'</a>';
523 $head[$h][0] = $_SERVER[
'PHP_SELF'].
'?piece_num='.((int)
$object->piece_num).($mode ?
'&mode='.$mode :
'');
524 $head[$h][1] = $langs->trans(
"Transaction");
525 $head[$h][2] =
'transaction';
533 $morehtmlref =
'<div style="clear: both;"></div>';
534 $morehtmlref .=
'<div class="refidno opacitymedium">';
535 $morehtmlref .=
$object->label;
536 $morehtmlref .=
'</div>';
538 dol_banner_tab(
$object,
'ref', $backlink, 1,
'piece_num',
'piece_num', $morehtmlref);
540 print
'<div class="fichecenter">';
542 print
'<div class="fichehalfleft">';
544 print
'<div class="underbanner clearboth"></div>';
545 print
'<table class="border tableforfield centpercent">';
549 print
'<td class="titlefield">'.$langs->trans(
"NumMvts").
'</td>';
550 print
'<td>'.($mode ==
'_tmp' ?
'<span class="opacitymedium" title="Id tmp '.$object->piece_num.
'">'.$langs->trans(
"Draft").
'</span>' :
$object->piece_num).
'</td>';
555 print
'<table class="nobordernopadding centpercent"><tr><td>';
556 print $langs->trans(
'Piece');
558 if ($action !=
'editdocref') {
559 print
'<td class="right">';
560 if ($permissiontoadd) {
561 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdocref&token='.
newToken().
'&piece_num='.((int)
$object->piece_num).
'&mode='.urlencode((
string) $mode).
'">'.
img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</a>';
565 print
'</tr></table>';
567 if ($action ==
'editdocref') {
568 print
'<form name="setdocref" action="'.$_SERVER[
"PHP_SELF"].
'?piece_num='.((int)
$object->piece_num).
'" method="POST">';
569 if ($optioncss !=
'') {
570 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
572 print
'<input type="hidden" name="token" value="'.newToken().
'">';
573 print
'<input type="hidden" name="action" value="setdocref">';
574 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
575 print
'<input type="text" size="20" name="doc_ref" value="'.dol_escape_htmltag(
$object->doc_ref).
'">';
576 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
586 print
'<table class="nobordernopadding centpercent"><tr><td>';
587 print $langs->trans(
'Docdate');
589 if ($action !=
'editdate') {
590 print
'<td class="right">';
591 if ($permissiontoadd) {
592 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdate&token='.
newToken().
'&piece_num='.((int)
$object->piece_num).
'&mode='.urlencode((
string) $mode).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetDate'), 1).
'</a>';
596 print
'</tr></table>';
597 print
'</td><td colspan="3">';
598 if ($action ==
'editdate') {
599 print
'<form name="setdate" action="'.$_SERVER[
"PHP_SELF"].
'?piece_num='.((int)
$object->piece_num).
'" method="POST">';
600 if ($optioncss !=
'') {
601 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
603 print
'<input type="hidden" name="token" value="'.newToken().
'">';
604 print
'<input type="hidden" name="action" value="setdate">';
605 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
606 print $form->selectDate(
$object->doc_date ?
$object->doc_date : -1,
'doc_date', 0, 0, 0,
"setdate");
607 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
617 print
'<table class="nobordernopadding" width="100%"><tr><td>';
618 print $langs->trans(
'Codejournal');
620 if ($action !=
'editjournal') {
621 print
'<td class="right">';
622 if ($permissiontoadd) {
623 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=editjournal&token='.
newToken().
'&piece_num='.((int)
$object->piece_num).
'&mode='.urlencode((
string) $mode).
'">'.
img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</a>';
627 print
'</tr></table>';
629 if ($action ==
'editjournal') {
630 print
'<form name="setjournal" action="'.$_SERVER[
"PHP_SELF"].
'?piece_num='.((int)
$object->piece_num).
'" method="POST">';
631 if ($optioncss !=
'') {
632 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
634 print
'<input type="hidden" name="token" value="'.newToken().
'">';
635 print
'<input type="hidden" name="action" value="setjournal">';
636 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
637 print $formaccounting->select_journal(
$object->code_journal,
'code_journal', 0, 0, 0, 1, 1);
638 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
651 print
'<div class="fichehalfright">';
653 print
'<div class="underbanner clearboth"></div>';
654 print
'<table class="border tableforfield centpercent">';
657 if (!empty(
$object->doc_type)) {
659 print
'<td class="titlefield">'.$langs->trans(
"Doctype").
'</td>';
660 print
'<td>'.$object->doc_type.
'</td>';
666 print
'<td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
675 print
'<td class="titlefield">' . $form->textwithpicto($langs->trans(
'DateDue'), $langs->trans(
"IfTransactionHasDueDate")) .
'</td>';
683 if ($mode !=
"_tmp") {
686 print
'<td class="titlefield">' . $langs->trans(
"DateExport") .
'</td>';
694 print
'<td class="titlefield">' . $langs->trans(
"DateValidation") .
'</td>';
701 if (!empty(
$object->import_key)) {
703 print
'<td class="titlefield">' . $langs->trans(
"ImportId") .
'</td>';
756 print
'<div class="clearboth"></div>';
762 $result =
$object->fetchAllPerMvt($piece_num, $mode);
768 $tmptoselect = array();
769 $atleastonevalidated = 0;
770 $atleastoneexported = 0;
771 foreach (
$object->linesmvt as $line) {
772 $tmptoselect[] = $line->id;
773 if (!empty($line->date_validation)) {
774 $atleastonevalidated = 1;
776 if (!empty($line->date_export) || !empty($line->date_validation)) {
777 $atleastoneexported = 1;
781 if ($mode !=
'_tmp' && !$atleastonevalidated) {
782 print
"\n".
'<div class="tabsAction">'.
"\n";
784 $parameters = array();
785 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
786 if (empty($reshook)) {
787 if ($permissiontodelete) {
788 if (!isset($hookmanager->resArray[
'no_button_edit']) || $hookmanager->resArray[
'no_button_edit'] != 1) {
789 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', DOL_URL_ROOT.
'/accountancy/bookkeeping/card.php?action=deletebookkeepingwriting&confirm=yes&token='.
newToken().
'&piece_num='.((
int)
$object->piece_num).
'&toselect='.implode(
',', $tmptoselect),
'', $permissiontodelete);
800 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?piece_num='.((int)
$object->piece_num).
'" method="POST">';
801 if ($optioncss !=
'') {
802 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
804 print
'<input type="hidden" name="token" value="'.newToken().
'">';
805 print
'<input type="hidden" name="doc_date" value="'.$object->doc_date.
'">'.
"\n";
806 print
'<input type="hidden" name="doc_type" value="'.$object->doc_type.
'">'.
"\n";
807 print
'<input type="hidden" name="doc_ref" value="'.$object->doc_ref.
'">'.
"\n";
808 print
'<input type="hidden" name="code_journal" value="'.$object->code_journal.
'">'.
"\n";
809 print
'<input type="hidden" name="fk_doc" value="'.$object->fk_doc.
'">'.
"\n";
810 print
'<input type="hidden" name="fk_docdet" value="'.$object->fk_docdet.
'">'.
"\n";
811 print
'<input type="hidden" name="mode" value="'.$mode.
'">'.
"\n";
813 if (count(
$object->linesmvt) > 0) {
814 print
'<div class="div-table-responsive-no-min">';
815 print
'<table class="noborder centpercent">';
820 print
'<tr class="liste_titre">';
827 if (empty(
$object->date_validation)) {
836 if (!empty(
$object->linesmvt[0])) {
837 $tmpline =
$object->linesmvt[0];
838 if (!empty($tmpline->numero_compte)) {
844 foreach (
$object->linesmvt as $line) {
845 $total_debit += $line->debit;
846 $total_credit += $line->credit;
848 if ($action ==
'update' && $line->id == $id) {
849 print
'<tr class="oddeven" data-lineid="'.((int) $line->id).
'">';
850 print
'<!-- td columns in edit mode -->';
852 print $formaccounting->select_account((GETPOSTISSET(
"accountingaccount_number") ?
GETPOST(
"accountingaccount_number",
"alpha") : $line->numero_compte),
'accountingaccount_number', 1, array(), 1, 1,
'minwidth200 maxwidth500');
860 print $formaccounting->select_auxaccount((GETPOSTISSET(
"subledger_account") ?
GETPOST(
"subledger_account",
"alpha") : $line->subledger_account),
'subledger_account', 1,
'maxwidth250',
'',
'subledger_label');
862 print
'<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET(
"subledger_account") ?
GETPOST(
"subledger_account",
"alpha") : $line->subledger_account).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"SubledgerAccount")).
'">';
865 print
'<br><input type="text" class="maxwidth150" name="subledger_label" value="'.(GETPOSTISSET(
"subledger_label") ?
GETPOST(
"subledger_label",
"alpha") : $line->subledger_label).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"SubledgerAccountLabel")).
'">';
867 print
'<td><input type="text" class="minwidth200" name="label_operation" value="'.(GETPOSTISSET(
"label_operation") ?
GETPOST(
"label_operation",
"alpha") : $line->label_operation).
'"></td>';
868 print
'<td class="right"><input type="text" class="right width50" name="debit" value="'.(GETPOSTISSET(
"debit") ?
GETPOST(
"debit",
"alpha") :
price($line->debit)).
'"></td>';
869 print
'<td class="right"><input type="text" class="right width50" name="credit" value="'.(GETPOSTISSET(
"credit") ?
GETPOST(
"credit",
"alpha") :
price($line->credit)).
'"></td>';
871 print
'<input type="hidden" name="id" value="'.$line->id.
'">'.
"\n";
872 print
'<input type="submit" class="button" name="update" value="'.$langs->trans(
"Update").
'">';
875 } elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) {
876 if (($action ==
"" || $action ==
'add') && $permissiontoadd) {
877 print
'<tr class="oddeven" data-lineid="'.((int) $line->id).
'">';
878 print
'<!-- td columns in add mode -->';
880 print $formaccounting->select_account($action ==
'add' ?
GETPOST(
'accountingaccount_number') :
'',
'accountingaccount_number', 1, array(), 1, 1,
'minwidth200 maxwidth500');
888 print $formaccounting->select_auxaccount(
'',
'subledger_account', 1,
'maxwidth250',
'',
'subledger_label');
890 print
'<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' .
dol_escape_htmltag($langs->trans(
"SubledgerAccount")) .
'">';
892 print
'<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="' .
dol_escape_htmltag($langs->trans(
"SubledgerAccountLabel")) .
'">';
894 print
'<td><input type="text" class="minwidth200" name="label_operation" value="' .
dol_escape_htmltag($label_operation) .
'"/></td>';
895 print
'<td class="right"><input type="text" class="right width50" name="debit" value=""/></td>';
896 print
'<td class="right"><input type="text" class="right width50" name="credit" value=""/></td>';
897 print
'<td class="center"><input type="submit" class="button small" name="save" value="' . $langs->trans(
"Add") .
'"></td>';
901 print
'<tr class="oddeven" data-lineid="'.((int) $line->id).
'">';
902 print
'<!-- td columns in display mode -->';
903 $resultfetch = $accountingaccount->fetch(0, $line->numero_compte,
true);
905 if ($resultfetch > 0) {
906 print $accountingaccount->getNomUrl(0, 1, 1,
'', 0);
908 print
dol_escape_htmltag($line->numero_compte).
' <span class="warning">('.$langs->trans(
"AccountRemovedFromCurrentChartOfAccount").
')</span>';
911 print
'<td>'.length_accounta($line->subledger_account);
912 if ($line->subledger_label) {
913 print
' - <span class="opacitymedium">'.dol_escape_htmltag($line->subledger_label).
'</span>';
916 print
'<td>'.$line->label_operation.
'</td>';
917 print
'<td class="right nowraponall amount">'.($line->debit != 0 ?
price($line->debit) :
'').
'</td>';
918 print
'<td class="right nowraponall amount">'.($line->credit != 0 ?
price($line->credit) :
'').
'</td>';
920 print
'<td class="center nowraponall">';
921 if ($permissiontoadd) {
922 if (empty($line->date_export) && empty($line->date_validation)) {
923 print
'<a class="editfielda reposition" href="' . $_SERVER[
"PHP_SELF"] .
'?action=update&id=' . $line->id .
'&piece_num=' . ((int) $line->piece_num) .
'&mode=' . urlencode((
string) $mode) .
'&token=' . urlencode(
newToken()) .
'">';
924 print
img_edit(
'', 0,
'class="marginrightonly"');
927 print
'<a class="editfielda nohover cursornotallowed reposition disabled" href="#" title="'.dol_escape_htmltag($langs->trans(
"ForbiddenTransactionAlreadyExported")).
'">';
928 print
img_edit($langs->trans(
"ForbiddenTransactionAlreadyExported"), 0,
'class="marginrightonly"');
932 if (empty($line->date_validation)) {
933 $actiontodelete =
'delete';
934 if ($mode ==
'_tmp' || $action !=
'delmouv') {
935 $actiontodelete =
'confirm_delete';
938 print
'<a href="' . $_SERVER[
"PHP_SELF"] .
'?action=' . $actiontodelete .
'&id=' . $line->id .
'&piece_num=' . ((int) $line->piece_num) .
'&mode=' . urlencode((
string) $mode) .
'&token=' . urlencode(
newToken()) .
'">';
942 print
'<a class="editfielda nohover cursornotallowed disabled" href="#" title="'.dol_escape_htmltag($langs->trans(
"ForbiddenTransactionAlreadyExported")).
'">';
943 print
img_delete($langs->trans(
"ForbiddenTransactionAlreadyValidated"));
952 $total_debit =
price2num($total_debit,
'MT');
953 $total_credit =
price2num($total_credit,
'MT');
955 if ($total_debit != $total_credit) {
956 setEventMessages(
null, array($langs->trans(
'MvtNotCorrectlyBalanced', $total_debit, $total_credit)),
'warnings');
962 if ($mode ==
'_tmp' && $action ==
'' && $permissiontoadd) {
964 print
'<div class="center">';
965 if (empty($total_debit) && empty($total_credit)) {
966 print
'<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans(
"EnterNonEmptyLinesFirst")).
'" value="'.
dol_escape_htmltag($langs->trans(
"ValidTransaction")).
'">';
967 } elseif ($total_debit == $total_credit) {
968 print
'<a class="button" href="'.$_SERVER[
"PHP_SELF"].
'?piece_num='.((int)
$object->piece_num).
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"ValidTransaction").
'</a>';
970 print
'<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans(
"MvtNotCorrectlyBalanced", $total_debit, $total_credit)).
'" value="'.
dol_escape_htmltag($langs->trans(
"ValidTransaction")).
'">';
974 print
'<a class="button button-cancel" href="'.DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php">'.$langs->trans(
"Cancel").
'</a>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage accounting accounts.
Class to manage accounting journals.
Class to manage Ledger (General Ledger and Subledger)
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.