From 1c2f6533c2eddd37199cdc98d47e3dc3fee02d82 Mon Sep 17 00:00:00 2001 From: AWeerWolf Date: Sat, 9 Mar 2024 18:43:41 +0100 Subject: [PATCH 1/5] Adding Hooks in bookkeeping card --- htdocs/accountancy/bookkeeping/card.php | 1117 ++++++++++++----------- 1 file changed, 566 insertions(+), 551 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 66838b8c2e274..075b30174b309 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -94,34 +94,90 @@ /* * Actions */ +$parameters = array(); //***HOOK +$reshook_onBeforeActions = $hookmanager->executeHooks('onBeforeActions', $parameters, $object, $action); //***HOOK Note that $action and $object may have been modified by some hooks +if ($reshook_onBeforeActions < 0) { //***HOOK + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); //***HOOK +} //***HOOK +if (empty($reshook_onBeforeActions)) { //***HOOK + if ($cancel) { + header("Location: ".DOL_URL_ROOT.'/accountancy/bookkeeping/list.php'); + exit; + } + + if ($action == "confirm_update") { + $error = 0; -if ($cancel) { - header("Location: ".DOL_URL_ROOT.'/accountancy/bookkeeping/list.php'); - exit; -} + if (((float) $debit != 0.0) && ((float) $credit != 0.0)) { + $error++; + setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); + $action = 'update'; + } + if (empty($accountingaccount_number) || $accountingaccount_number == '-1') { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); + $action = 'update'; + } -if ($action == "confirm_update") { - $error = 0; + if (!$error) { + $object = new BookKeeping($db); - if (((float) $debit != 0.0) && ((float) $credit != 0.0)) { - $error++; - setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); - $action = 'update'; - } - if (empty($accountingaccount_number) || $accountingaccount_number == '-1') { - $error++; - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); - $action = 'update'; - } + $result = $object->fetch($id, null, $mode); + if ($result < 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } else { + $object->numero_compte = $accountingaccount_number; + $object->subledger_account = $subledger_account; + $object->subledger_label = $subledger_label; + $object->label_compte = $accountingaccount_label; + $object->label_operation = $label_operation; + $object->debit = $debit; + $object->credit = $credit; + + if ((float) $debit != 0.0) { + $object->montant = $debit; // deprecated + $object->amount = $debit; + $object->sens = 'D'; + } + if ((float) $credit != 0.0) { + $object->montant = $credit; // deprecated + $object->amount = $credit; + $object->sens = 'C'; + } - if (!$error) { - $object = new BookKeeping($db); + $result = $object->update($user, false, $mode); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + if ($mode != '_tmp') { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + } - $result = $object->fetch($id, null, $mode); - if ($result < 0) { + $debit = 0; + $credit = 0; + + $action = ''; + } + } + } + } elseif ($action == "add") { + $error = 0; + + if (((float) $debit != 0.0) && ((float) $credit != 0.0)) { $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } else { + setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); + $action = ''; + } + if (empty($accountingaccount_number) || $accountingaccount_number == '-1') { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); + $action = ''; + } + + if (!$error) { + $object = new BookKeeping($db); + $object->numero_compte = $accountingaccount_number; $object->subledger_account = $subledger_account; $object->subledger_label = $subledger_label; @@ -129,19 +185,28 @@ $object->label_operation = $label_operation; $object->debit = $debit; $object->credit = $credit; + $object->doc_date = (string) GETPOST('doc_date', 'alpha'); + $object->doc_type = (string) GETPOST('doc_type', 'alpha'); + $object->piece_num = $piece_num; + $object->doc_ref = (string) GETPOST('doc_ref', 'alpha'); + $object->code_journal = $journal_code; + $object->journal_label = $journal_label; + $object->fk_doc = GETPOSTINT('fk_doc'); + $object->fk_docdet = GETPOSTINT('fk_docdet'); if ((float) $debit != 0.0) { $object->montant = $debit; // deprecated $object->amount = $debit; $object->sens = 'D'; } + if ((float) $credit != 0.0) { $object->montant = $credit; // deprecated $object->amount = $credit; $object->sens = 'C'; } - $result = $object->update($user, false, $mode); + $result = $object->createStd($user, false, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -155,113 +220,96 @@ $action = ''; } } - } -} elseif ($action == "add") { - $error = 0; + } elseif ($action == "confirm_delete") { + $object = new BookKeeping($db); - if (((float) $debit != 0.0) && ((float) $credit != 0.0)) { - $error++; - setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); - $action = ''; - } - if (empty($accountingaccount_number) || $accountingaccount_number == '-1') { - $error++; - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); + $result = $object->fetch($id, null, $mode); + $piece_num = $object->piece_num; + + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + $result = $object->delete($user, false, $mode); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } $action = ''; - } + } elseif ($action == "confirm_create") { + $error = 0; - if (!$error) { $object = new BookKeeping($db); - $object->numero_compte = $accountingaccount_number; - $object->subledger_account = $subledger_account; - $object->subledger_label = $subledger_label; - $object->label_compte = $accountingaccount_label; - $object->label_operation = $label_operation; - $object->debit = $debit; - $object->credit = $credit; - $object->doc_date = (string) GETPOST('doc_date', 'alpha'); - $object->doc_type = (string) GETPOST('doc_type', 'alpha'); - $object->piece_num = $piece_num; - $object->doc_ref = (string) GETPOST('doc_ref', 'alpha'); - $object->code_journal = $journal_code; - $object->journal_label = $journal_label; - $object->fk_doc = GETPOSTINT('fk_doc'); - $object->fk_docdet = GETPOSTINT('fk_docdet'); - - if ((float) $debit != 0.0) { - $object->montant = $debit; // deprecated - $object->amount = $debit; - $object->sens = 'D'; + if (!$journal_code || $journal_code == '-1') { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors'); + $action = 'create'; + $error++; + } + if (!GETPOST('doc_ref', 'alpha')) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors'); + $action = 'create'; + $error++; } - if ((float) $credit != 0.0) { - $object->montant = $credit; // deprecated - $object->amount = $credit; - $object->sens = 'C'; + if (!$error) { + $object->label_compte = ''; + $object->debit = 0; + $object->credit = 0; + $object->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); + $object->doc_type = GETPOST('doc_type', 'alpha'); + $object->piece_num = GETPOSTINT('next_num_mvt'); + $object->doc_ref = GETPOST('doc_ref', 'alpha'); + $object->code_journal = $journal_code; + $object->journal_label = $journal_label; + $object->fk_doc = 0; + $object->fk_docdet = 0; + $object->montant = 0; // deprecated + $object->amount = 0; + + $result = $object->createStd($user, 0, $mode); + $reshook = $hookmanager->executeHooks('onConfirmCreate_onAfterCreateEmptyLine', $parameters, $object, $action); //***HOOK Note that $action and $object may have been modified by some hooks + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + if ($mode != '_tmp') { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + } + $action = ''; + $id = $object->id; + $piece_num = $object->piece_num; + } } + } - $result = $object->createStd($user, false, $mode); + if ($action == 'setdate') { + $datedoc = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); + $result = $object->updateByMvt($piece_num, 'doc_date', $db->idate($datedoc), $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { if ($mode != '_tmp') { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } - - $debit = 0; - $credit = 0; - $action = ''; } } -} elseif ($action == "confirm_delete") { - $object = new BookKeeping($db); - $result = $object->fetch($id, null, $mode); - $piece_num = $object->piece_num; - - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - $result = $object->delete($user, false, $mode); + if ($action == 'setjournal') { + $result = $object->updateByMvt($piece_num, 'code_journal', $journal_code, $mode); + $result = $object->updateByMvt($piece_num, 'journal_label', $journal_label, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); + } else { + if ($mode != '_tmp') { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + } + $action = ''; } } - $action = ''; -} elseif ($action == "confirm_create") { - $error = 0; - - $object = new BookKeeping($db); - - if (!$journal_code || $journal_code == '-1') { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors'); - $action = 'create'; - $error++; - } - if (!GETPOST('doc_ref', 'alpha')) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors'); - $action = 'create'; - $error++; - } - if (!$error) { - $object->label_compte = ''; - $object->debit = 0; - $object->credit = 0; - $object->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); - $object->doc_type = GETPOST('doc_type', 'alpha'); - $object->piece_num = GETPOSTINT('next_num_mvt'); - $object->doc_ref = GETPOST('doc_ref', 'alpha'); - $object->code_journal = $journal_code; - $object->journal_label = $journal_label; - $object->fk_doc = 0; - $object->fk_docdet = 0; - $object->montant = 0; // deprecated - $object->amount = 0; - - $result = $object->createStd($user, 0, $mode); + if ($action == 'setdocref') { + $refdoc = GETPOST('doc_ref', 'alpha'); + $result = $object->updateByMvt($piece_num, 'doc_ref', $refdoc, $mode); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -269,440 +317,379 @@ setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } $action = ''; - $id = $object->id; - $piece_num = $object->piece_num; - } - } -} - -if ($action == 'setdate') { - $datedoc = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear')); - $result = $object->updateByMvt($piece_num, 'doc_date', $db->idate($datedoc), $mode); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - if ($mode != '_tmp') { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); - } - $action = ''; - } -} - -if ($action == 'setjournal') { - $result = $object->updateByMvt($piece_num, 'code_journal', $journal_code, $mode); - $result = $object->updateByMvt($piece_num, 'journal_label', $journal_label, $mode); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - if ($mode != '_tmp') { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } - $action = ''; } -} -if ($action == 'setdocref') { - $refdoc = GETPOST('doc_ref', 'alpha'); - $result = $object->updateByMvt($piece_num, 'doc_ref', $refdoc, $mode); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - if ($mode != '_tmp') { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + // Validate transaction + if ($action == 'valid') { + $result = $object->transformTransaction(0, $piece_num); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + header("Location: list.php?sortfield=t.piece_num&sortorder=asc"); + exit; } - $action = ''; - } -} - -// Validate transaction -if ($action == 'valid') { - $result = $object->transformTransaction(0, $piece_num); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - header("Location: list.php?sortfield=t.piece_num&sortorder=asc"); - exit; } -} +} //***HOOK +$reshook_onAfterActions = $hookmanager->executeHooks('onAfterActions', $parameters, $object, $action); ///***HOOK Note that $action and $object may have been modified by some hooks /* * View */ - -$form = new Form($db); -$formaccounting = new FormAccounting($db); - -$title = $langs->trans("CreateMvts"); -$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double'; -llxHeader('', $title, $help_url); - -// Confirmation to delete the command -if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&mode='.$mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'confirm_delete', '', 0, 1); - print $formconfirm; -} - -if ($action == 'create') { - print load_fiche_titre($title); - - $object = new BookKeeping($db); - $next_num_mvt = $object->getNextNumMvt('_tmp'); - - if (empty($next_num_mvt)) { - dol_print_error(null, 'Failed to get next piece number'); +$reshook_onBeforeView = $hookmanager->executeHooks('onBeforeView', $parameters, $object, $action); //***HOOK Note that $action and $object may have been modified by some hooks +if ($reshook_onBeforeView < 0) { //***HOOK + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); //***HOOK Error +} //***HOOK +if (empty($reshook_onBeforeView)) { //***HOOK Return 0 so execute the standard prog. + $form = new Form($db); + $formaccounting = new FormAccounting($db); + + $title = $langs->trans("CreateMvts"); + $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double'; + llxHeader('', $title, $help_url); + + // Confirmation to delete the command + if ($action == 'delete') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&mode='.$mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'confirm_delete', '', 0, 1); + print $formconfirm; } - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''."\n"; - print ''."\n"; - print ''."\n"; - - print dol_get_fiche_head(); - - print ''; - - /*print ''; - print ''; - print ''; - print '';*/ - - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - - /* - print ''; - print ''; - print ''; - print ''; - */ - - print '
' . $langs->trans("NumPiece") . '' . $next_num_mvt . '
'.$langs->trans("Docdate").''; - print $form->selectDate('', 'doc_date', 0, 0, 0, "create_mvt", 1, 1); - print '
'.$langs->trans("Codejournal").''.$formaccounting->select_journal($journal_code, 'code_journal', 0, 0, 1, 1).'
'.$langs->trans("Piece").'
' . $langs->trans("Doctype") . '
'; - - print dol_get_fiche_end(); - - print $form->buttonsSaveCancel("Create"); - - print '
'; -} else { - $object = new BookKeeping($db); - $result = $object->fetchPerMvt($piece_num, $mode); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } + if ($action == 'create') { + print load_fiche_titre($title); - if (!empty($object->piece_num)) { - $backlink = ''.$langs->trans('BackToList').''; + $object = new BookKeeping($db); + $next_num_mvt = $object->getNextNumMvt('_tmp'); - if ($mode == '_tmp') { - print load_fiche_titre($langs->trans("CreateMvts"), $backlink); - } else { - print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); + if (empty($next_num_mvt)) { + dol_print_error(null, 'Failed to get next piece number'); } - $head = array(); - $h = 0; - $head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode ? '&mode='.$mode : ''); - $head[$h][1] = $langs->trans("Transaction"); - $head[$h][2] = 'transaction'; - $h++; + print '
'; + if ($optioncss != '') { + print ''; + } + print ''; + print ''."\n"; + print ''."\n"; + print ''."\n"; - print dol_get_fiche_head($head, 'transaction', '', -1); + print dol_get_fiche_head(); - //dol_banner_tab($object, '', $backlink); + print ''; - print '
'; - print '
'; + /*print '
'; + print ''; + print ''; + print '';*/ - print '
'; - print '
' . $langs->trans("NumPiece") . '' . $next_num_mvt . '
'; + print ''; + print ''; + print ''; + print ''; - // Account movement print ''; - print ''; - print ''; + print ''; + print ''; print ''; - // Date - print ''; + print ''; + print ''; + print ''; print ''; - // Journal - print ''; + /* + print ''; + print ''; + print ''; print ''; + */ + $reshook_onCreate_onAfterShowFields = $hookmanager->executeHooks('onCreate_onAfterShowFields', $parameters, $object, $action); //***HOOK Note that $action and $object may have been modified by some hooks + + print '
'.$langs->trans("Docdate").''; + print $form->selectDate('', 'doc_date', 0, 0, 0, "create_mvt", 1, 1); + print '
'.$langs->trans("NumMvts").''.($mode == '_tmp' ? ''.$langs->trans("Draft").'' : $object->piece_num).''.$langs->trans("Codejournal").''.$formaccounting->select_journal($journal_code, 'code_journal', 0, 0, 1, 1).'
'; - print ''; - if ($action != 'editdate') { - print ''; - } - print '
'; - print $langs->trans('Docdate'); - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'
'; - print '
'; - if ($action == 'editdate') { - print ''; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', 0, 0, 0, "setdate"); - print ''; - print ''; - } else { - print $object->doc_date ? dol_print_date($object->doc_date, 'day') : ' '; - } - print '
'.$langs->trans("Piece").'
'; - print ''; - if ($action != 'editjournal') { - print ''; - } - print '
'; - print $langs->trans('Codejournal'); - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; - print '
'; - if ($action == 'editjournal') { - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1); - print ''; - print '
'; - } else { - print $object->code_journal; - } - print '
' . $langs->trans("Doctype") . '
'; - // Ref document - print ''; - print ''; - if ($action != 'editdocref') { - print ''; - } - print '
'; - print $langs->trans('Piece'); - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; - print ''; - if ($action == 'editdocref') { - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - } else { - print $object->doc_ref; + print dol_get_fiche_end(); + + print $form->buttonsSaveCancel("Create"); + + print ''; + } else { + $object = new BookKeeping($db); + $result = $object->fetchPerMvt($piece_num, $mode); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); } - print ''; - print ''; - print ''; + if (!empty($object->piece_num)) { + $backlink = ''.$langs->trans('BackToList').''; - print ''; + if ($mode == '_tmp') { + print load_fiche_titre($langs->trans("CreateMvts"), $backlink); + } else { + print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); + } - print '
'; + $head = array(); + $h = 0; + $head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode ? '&mode='.$mode : ''); + $head[$h][1] = $langs->trans("Transaction"); + $head[$h][2] = 'transaction'; + $h++; - print '
'; - print ''; + print dol_get_fiche_head($head, 'transaction', '', -1); - // Doc type - if (!empty($object->doc_type)) { - print ''; - print ''; - print ''; - print ''; - } + //dol_banner_tab($object, '', $backlink); - // Date document creation - print ''; - print ''; - print ''; - print ''; + print '
'; + print '
'; + + print '
'; + print '
'.$langs->trans("Doctype").''.$object->doc_type.'
'.$langs->trans("DateCreation").''; - print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; - print '
'; - // Don't show in tmp mode, inevitably empty - if ($mode != "_tmp") { - // Date document export + // Account movement print ''; - print ''; - print ''; + print ''; + print ''; print ''; - // Date document validation - print ''; - print ''; - print ''; print ''; - } - // Validate - /* - print ''; - print ''; - print ''; - print ''; - */ + print ''; - // check data - /* - print ''; - print ''; - if ($object->doc_type == 'customer_invoice') - { - $sqlmid = 'SELECT rowid as ref'; - $sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac"; - $sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc); - dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $invoicestatic = new Facture($db); - $invoicestatic->fetch($objmid->ref); - $ref=$langs->trans("Invoice").' '.$invoicestatic->getNomUrl(1); + // Ref document + print '
' . $langs->trans("DateExport") . ''; - print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; - print ''.$langs->trans("NumMvts").''.($mode == '_tmp' ? ''.$langs->trans("Draft").'' : $object->piece_num).'
' . $langs->trans("DateValidation") . ''; - print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; + // Date + print '
'; + print ''; + if ($action != 'editdate') { + print ''; + } + print '
'; + print $langs->trans('Docdate'); + print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'
'; + print '
'; + if ($action == 'editdate') { + print '
'; + if ($optioncss != '') { + print ''; + } + print ''; + print ''; + print ''; + print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', 0, 0, 0, "setdate"); + print ''; + print '
'; + } else { + print $object->doc_date ? dol_print_date($object->doc_date, 'day') : ' '; + } print '
' . $langs->trans("Status") . ''; - if (empty($object->validated)) { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; + // Journal + print '
'; + print ''; + if ($action != 'editjournal') { + print ''; + } + print '
'; + print $langs->trans('Codejournal'); + print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; + print '
'; + if ($action == 'editjournal') { + print '
'; + if ($optioncss != '') { + print ''; + } + print ''; + print ''; + print ''; + print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1); + print ''; + print '
'; } else { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; + print $object->code_journal; } print '
' . $langs->trans("Control") . '
'; + print ''; + if ($action != 'editdocref') { + print ''; } - else dol_print_error($db); - } - print ''; - print ''; - */ - print "
'; + print $langs->trans('Piece'); + print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'' . $ref .'
\n"; + print '
'; + print ''; + if ($action == 'editdocref') { + print '
'; + if ($optioncss != '') { + print ''; + } + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + } else { + print $object->doc_ref; + } + print ''; + print ''; - print '
'; + print ''; - print dol_get_fiche_end(); + print ''; - print '
'; + print '
'; - print '
'; + print '
'; + print ''; - $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt + // Doc type + if (!empty($object->doc_type)) { + print ''; + print ''; + print ''; + print ''; + } - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - // List of movements - print load_fiche_titre($langs->trans("ListeMvts"), '', ''); + // Date document creation + print ''; + print ''; + print ''; + print ''; - print ''; - if ($optioncss != '') { - print ''; + // Don't show in tmp mode, inevitably empty + if ($mode != "_tmp") { + // Date document export + print ''; + print ''; + print ''; + print ''; + + // Date document validation + print ''; + print ''; + print ''; + print ''; } - print ''; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - - if (count($object->linesmvt) > 0) { - print '
'; - print '
'.$langs->trans("Doctype").''.$object->doc_type.'
'.$langs->trans("DateCreation").''; + print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; + print '
' . $langs->trans("DateExport") . ''; + print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; + print '
' . $langs->trans("DateValidation") . ''; + print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; + print '
'; - - $total_debit = 0; - $total_credit = 0; - - print ''; - - print_liste_field_titre("AccountAccountingShort"); - print_liste_field_titre("SubledgerAccount"); - print_liste_field_titre("LabelOperation"); - print_liste_field_titre("AccountingDebit", "", "", "", "", 'class="right"'); - print_liste_field_titre("AccountingCredit", "", "", "", "", 'class="right"'); - if (empty($object->date_validation)) { - print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center '); + + // Validate + /* + print ''; + print ''; + print ''; + print ''; + */ + + // check data + /* + print ''; + print ''; + if ($object->doc_type == 'customer_invoice') + { + $sqlmid = 'SELECT rowid as ref'; + $sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac"; + $sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc); + dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $invoicestatic = new Facture($db); + $invoicestatic->fetch($objmid->ref); + $ref=$langs->trans("Invoice").' '.$invoicestatic->getNomUrl(1); } + else dol_print_error($db); + } + print ''; + print ''; + */ + print "
' . $langs->trans("Status") . ''; + if (empty($object->validated)) { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; } else { - print_liste_field_titre(""); + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } + print '
' . $langs->trans("Control") . '' . $ref .'
\n"; - print "\n"; + print '
'; - // Add an empty line if there is not yet - if (!empty($object->linesmvt[0])) { - $tmpline = $object->linesmvt[0]; - if (!empty($tmpline->numero_compte)) { - $line = new BookKeepingLine($db); - $object->linesmvt[] = $line; - } + print dol_get_fiche_end(); + + print '
'; + + print '
'; + + $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt + + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + // List of movements + print load_fiche_titre($langs->trans("ListeMvts"), '', ''); + + print ''; + if ($optioncss != '') { + print ''; } + print ''; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + + if (count($object->linesmvt) > 0) { + print '
'; + print ''; + + $total_debit = 0; + $total_credit = 0; + + print ''; + + print_liste_field_titre("AccountAccountingShort"); + print_liste_field_titre("SubledgerAccount"); + print_liste_field_titre("LabelOperation"); + print_liste_field_titre("AccountingDebit", "", "", "", "", 'class="right"'); + print_liste_field_titre("AccountingCredit", "", "", "", "", 'class="right"'); + if (empty($object->date_validation)) { + print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center '); + } else { + print_liste_field_titre(""); + } - foreach ($object->linesmvt as $line) { - print ''; - $total_debit += $line->debit; - $total_credit += $line->credit; - - if ($action == 'update' && $line->id == $id) { - print ''; - print ''; - print '\n"; + + // Add an empty line if there is not yet + if (!empty($object->linesmvt[0])) { + $tmpline = $object->linesmvt[0]; + if (!empty($tmpline->numero_compte)) { + $line = new BookKeepingLine($db); + $object->linesmvt[] = $line; } - // Add also input for subledger label - print '
subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; - print ''; - print ''; - print ''; - print ''; - print ''; - } elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) { - if ($action == "" || $action == 'add') { - print ''; + } + + foreach ($object->linesmvt as $line) { + print ''; + $total_debit += $line->debit; + $total_credit += $line->credit; + + if ($action == 'update' && $line->id == $id) { + print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - } - } else { - print ''; - $resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true); - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; + print ''; + print ''; + print ''; + } elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) { + if ($action == "" || $action == 'add') { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } } else { - print ''; - print img_edit($langs->trans("ForbiddenTransactionAlreadyExported"), 0, 'class="marginrightonly"'); - print '  '; - } + print ''; + $resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true); + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; } - - print ''; + print "\n"; } - print "\n"; - } - $total_debit = price2num($total_debit, 'MT'); - $total_credit = price2num($total_credit, 'MT'); + $total_debit = price2num($total_debit, 'MT'); + $total_credit = price2num($total_credit, 'MT'); - if ($total_debit != $total_credit) { - setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings'); - } + if ($total_debit != $total_credit) { + setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings'); + } - print '
'; - print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); - print ''; - // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: - // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. - // Also, it is not possible to use a value that is not in the list. - // Also, the label is not automatically filled when a value is selected. - if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { - print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); - } else { - print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; + print "
label_operation).'">debit)).'">credit)).'">'; - print ''."\n"; - print ''; - print '
'; - print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); + print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); print ''; // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: @@ -710,99 +697,127 @@ // Also, it is not possible to use a value that is not in the list. // Also, the label is not automatically filled when a value is selected. if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { - print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); + print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); } else { - print ''; + print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; } - print '
'; + // Add also input for subledger label + print '
subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; print '
'; - if ($resultfetch > 0) { - print $accountingaccount->getNomUrl(0, 1, 1, '', 0); - } else { - print $line->numero_compte.' ('.$langs->trans("AccountRemovedFromCurrentChartOfAccount").')'; - } - print ''.length_accounta($line->subledger_account); - if ($line->subledger_label) { - print ' - '.$line->subledger_label.''; - } - print ''.$line->label_operation.''.($line->debit != 0 ? price($line->debit) : '').''.($line->credit != 0 ? price($line->credit) : '').''; - if (empty($line->date_export) && empty($line->date_validation)) { - print 'id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; - print img_edit('', 0, 'class="marginrightonly"'); - print '  '; + print 'label_operation).'">debit)).'">credit)).'">'; + print ''."\n"; + print ''; + print ''; + print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); + print ''; + // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: + // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. + // Also, it is not possible to use a value that is not in the list. + // Also, the label is not automatically filled when a value is selected. + if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { + print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); + } else { + print ''; + } + print '
'; + print '
'; + if ($resultfetch > 0) { + print $accountingaccount->getNomUrl(0, 1, 1, '', 0); + } else { + print $line->numero_compte.' ('.$langs->trans("AccountRemovedFromCurrentChartOfAccount").')'; + } + print ''.length_accounta($line->subledger_account); + if ($line->subledger_label) { + print ' - '.$line->subledger_label.''; + } + print ''.$line->label_operation.''.($line->debit != 0 ? price($line->debit) : '').''.($line->credit != 0 ? price($line->credit) : '').''; + if (empty($line->date_export) && empty($line->date_validation)) { + print 'id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; + print img_edit('', 0, 'class="marginrightonly"'); + print '  '; + } else { + print ''; + print img_edit($langs->trans("ForbiddenTransactionAlreadyExported"), 0, 'class="marginrightonly"'); + print '  '; + } - if (empty($line->date_validation)) { - $actiontodelete = 'delete'; - if ($mode == '_tmp' || $action != 'delmouv') { - $actiontodelete = 'confirm_delete'; + if (empty($line->date_validation)) { + $actiontodelete = 'delete'; + if ($mode == '_tmp' || $action != 'delmouv') { + $actiontodelete = 'confirm_delete'; + } + + print ''; + print img_delete(); + print ''; + } else { + print ''; + print img_delete($langs->trans("ForbiddenTransactionAlreadyValidated")); + print ''; } - print ''; - print img_delete(); - print ''; - } else { - print ''; - print img_delete($langs->trans("ForbiddenTransactionAlreadyValidated")); - print ''; + print '
'; - print '
'; + print ''; + print ''; - if ($mode == '_tmp' && $action == '') { - print '
'; - print '
'; - if ($total_debit == $total_credit) { - print ''.$langs->trans("ValidTransaction").''; - } else { - print ''; - } + if ($mode == '_tmp' && $action == '') { + print '
'; + print '
'; + if ($total_debit == $total_credit) { + print ''.$langs->trans("ValidTransaction").''; + } else { + print ''; + } - print '   '; - print ''.$langs->trans("Cancel").''; + print '   '; + print ''.$langs->trans("Cancel").''; - print "
"; + print "
"; + } } - } - print ''; + print ''; + } + } else { + print load_fiche_titre($langs->trans("NoRecords")); } - } else { - print load_fiche_titre($langs->trans("NoRecords")); } -} +} //***HOOK +$reshook_onAfterView = $hookmanager->executeHooks('onAfterView', $parameters, $object, $action); //***HOOK Note that $action and $object may have been modified by some hooks print dol_get_fiche_end(); From f1715a5209a5ddb4d8fa3e17093542d985027b3b Mon Sep 17 00:00:00 2001 From: AWeerWolf Date: Sat, 9 Mar 2024 22:44:39 +0100 Subject: [PATCH 2/5] Suppressing White soace at end of lines --- htdocs/accountancy/bookkeeping/card.php | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 075b30174b309..ffd10c4ccff89 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -94,12 +94,12 @@ /* * Actions */ -$parameters = array(); //***HOOK -$reshook_onBeforeActions = $hookmanager->executeHooks('onBeforeActions', $parameters, $object, $action); //***HOOK Note that $action and $object may have been modified by some hooks -if ($reshook_onBeforeActions < 0) { //***HOOK - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); //***HOOK -} //***HOOK -if (empty($reshook_onBeforeActions)) { //***HOOK +$parameters = array(); +$reshook_onBeforeActions = $hookmanager->executeHooks('onBeforeActions', $parameters, $object, $action); +if ($reshook_onBeforeActions < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} +if (empty($reshook_onBeforeActions)) { if ($cancel) { header("Location: ".DOL_URL_ROOT.'/accountancy/bookkeeping/list.php'); exit; @@ -267,7 +267,7 @@ $object->amount = 0; $result = $object->createStd($user, 0, $mode); - $reshook = $hookmanager->executeHooks('onConfirmCreate_onAfterCreateEmptyLine', $parameters, $object, $action); //***HOOK Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('onConfirmCreate_onAfterCreateEmptyLine', $parameters, $object, $action); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -330,18 +330,18 @@ exit; } } -} //***HOOK -$reshook_onAfterActions = $hookmanager->executeHooks('onAfterActions', $parameters, $object, $action); ///***HOOK Note that $action and $object may have been modified by some hooks +} +$reshook_onAfterActions = $hookmanager->executeHooks('onAfterActions', $parameters, $object, $action); /* * View */ -$reshook_onBeforeView = $hookmanager->executeHooks('onBeforeView', $parameters, $object, $action); //***HOOK Note that $action and $object may have been modified by some hooks -if ($reshook_onBeforeView < 0) { //***HOOK - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); //***HOOK Error -} //***HOOK -if (empty($reshook_onBeforeView)) { //***HOOK Return 0 so execute the standard prog. +$reshook_onBeforeView = $hookmanager->executeHooks('onBeforeView', $parameters, $object, $action); +if ($reshook_onBeforeView < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} +if (empty($reshook_onBeforeView)) { $form = new Form($db); $formaccounting = new FormAccounting($db); @@ -406,7 +406,7 @@ print ''; print ''; */ - $reshook_onCreate_onAfterShowFields = $hookmanager->executeHooks('onCreate_onAfterShowFields', $parameters, $object, $action); //***HOOK Note that $action and $object may have been modified by some hooks + $reshook_onCreate_onAfterShowFields = $hookmanager->executeHooks('onCreate_onAfterShowFields', $parameters, $object, $action); print ''; @@ -816,8 +816,8 @@ print load_fiche_titre($langs->trans("NoRecords")); } } -} //***HOOK -$reshook_onAfterView = $hookmanager->executeHooks('onAfterView', $parameters, $object, $action); //***HOOK Note that $action and $object may have been modified by some hooks +} +$reshook_onAfterView = $hookmanager->executeHooks('onAfterView', $parameters, $object, $action); print dol_get_fiche_end(); From 8906d734dbc3154e77d1f0f9dcc87e03ddd43abb Mon Sep 17 00:00:00 2001 From: AWeerWolf Date: Sat, 9 Mar 2024 22:49:06 +0100 Subject: [PATCH 3/5] Still some White Spaces --- htdocs/accountancy/bookkeeping/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index ffd10c4ccff89..30702e4471757 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -104,7 +104,7 @@ header("Location: ".DOL_URL_ROOT.'/accountancy/bookkeeping/list.php'); exit; } - + if ($action == "confirm_update") { $error = 0; From 96eb651f954b1fef6db581ca35c1d12ab8a98545 Mon Sep 17 00:00:00 2001 From: AWeerWolf Date: Sat, 9 Mar 2024 22:53:16 +0100 Subject: [PATCH 4/5] White spaces is hell --- htdocs/accountancy/bookkeeping/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 30702e4471757..8449bc8028b67 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -407,7 +407,7 @@ print ''; */ $reshook_onCreate_onAfterShowFields = $hookmanager->executeHooks('onCreate_onAfterShowFields', $parameters, $object, $action); - + print ''; print dol_get_fiche_end(); From 39b866b2e139a04b66424a3dcb1d4eb986d0c229 Mon Sep 17 00:00:00 2001 From: AWeerWolf Date: Mon, 18 Mar 2024 09:24:45 +0100 Subject: [PATCH 5/5] Renaming Hooks --- htdocs/accountancy/bookkeeping/card.php | 799 ++++++++++++------------ 1 file changed, 395 insertions(+), 404 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 8449bc8028b67..4382227d1ddd6 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -95,7 +95,7 @@ * Actions */ $parameters = array(); -$reshook_onBeforeActions = $hookmanager->executeHooks('onBeforeActions', $parameters, $object, $action); +$reshook_onBeforeActions = $hookmanager->executeHooks('doActions', $parameters, $object, $action); if ($reshook_onBeforeActions < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } @@ -331,365 +331,384 @@ } } } -$reshook_onAfterActions = $hookmanager->executeHooks('onAfterActions', $parameters, $object, $action); - /* * View */ -$reshook_onBeforeView = $hookmanager->executeHooks('onBeforeView', $parameters, $object, $action); -if ($reshook_onBeforeView < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +$form = new Form($db); +$formaccounting = new FormAccounting($db); + +$title = $langs->trans("CreateMvts"); +$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double'; +llxHeader('', $title, $help_url); + +// Confirmation to delete the command +if ($action == 'delete') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&mode='.$mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'confirm_delete', '', 0, 1); + print $formconfirm; } -if (empty($reshook_onBeforeView)) { - $form = new Form($db); - $formaccounting = new FormAccounting($db); - - $title = $langs->trans("CreateMvts"); - $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double'; - llxHeader('', $title, $help_url); - - // Confirmation to delete the command - if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&mode='.$mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'confirm_delete', '', 0, 1); - print $formconfirm; + +if ($action == 'create') { + print load_fiche_titre($title); + + $object = new BookKeeping($db); + $next_num_mvt = $object->getNextNumMvt('_tmp'); + + if (empty($next_num_mvt)) { + dol_print_error(null, 'Failed to get next piece number'); } - if ($action == 'create') { - print load_fiche_titre($title); + print '
'; + if ($optioncss != '') { + print ''; + } + print ''; + print ''."\n"; + print ''."\n"; + print ''."\n"; + + print dol_get_fiche_head(); + + print ''; + + /*print ''; + print ''; + print ''; + print '';*/ + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + + /* + print ''; + print ''; + print ''; + print ''; + */ + $reshook_onCreate_onAfterShowFields = $hookmanager->executeHooks('onCreate_onAfterShowFields', $parameters, $object, $action); + + print '
' . $langs->trans("NumPiece") . '' . $next_num_mvt . '
'.$langs->trans("Docdate").''; + print $form->selectDate('', 'doc_date', 0, 0, 0, "create_mvt", 1, 1); + print '
'.$langs->trans("Codejournal").''.$formaccounting->select_journal($journal_code, 'code_journal', 0, 0, 1, 1).'
'.$langs->trans("Piece").'
' . $langs->trans("Doctype") . '
'; + + print dol_get_fiche_end(); + + print $form->buttonsSaveCancel("Create"); + + print '
'; +} else { + $object = new BookKeeping($db); + $result = $object->fetchPerMvt($piece_num, $mode); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } - $object = new BookKeeping($db); - $next_num_mvt = $object->getNextNumMvt('_tmp'); + if (!empty($object->piece_num)) { + $backlink = ''.$langs->trans('BackToList').''; - if (empty($next_num_mvt)) { - dol_print_error(null, 'Failed to get next piece number'); + if ($mode == '_tmp') { + print load_fiche_titre($langs->trans("CreateMvts"), $backlink); + } else { + print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); } - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''."\n"; - print ''."\n"; - print ''."\n"; + $head = array(); + $h = 0; + $head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode ? '&mode='.$mode : ''); + $head[$h][1] = $langs->trans("Transaction"); + $head[$h][2] = 'transaction'; + $h++; - print dol_get_fiche_head(); + print dol_get_fiche_head($head, 'transaction', '', -1); - print ''; + //dol_banner_tab($object, '', $backlink); - /*print ''; - print ''; - print ''; - print '';*/ + print '
'; + print '
'; - print '
'; - print ''; - print ''; - print ''; + print '
'; + print '
' . $langs->trans("NumPiece") . '' . $next_num_mvt . '
'.$langs->trans("Docdate").''; - print $form->selectDate('', 'doc_date', 0, 0, 0, "create_mvt", 1, 1); - print '
'; + // Account movement print ''; - print ''; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; - print ''; + // Date + print ''; print ''; - /* - print ''; - print ''; - print ''; + // Journal + print ''; print ''; - */ - $reshook_onCreate_onAfterShowFields = $hookmanager->executeHooks('onCreate_onAfterShowFields', $parameters, $object, $action); - - print '
'.$langs->trans("Codejournal").''.$formaccounting->select_journal($journal_code, 'code_journal', 0, 0, 1, 1).''.$langs->trans("NumMvts").''.($mode == '_tmp' ? ''.$langs->trans("Draft").'' : $object->piece_num).'
'.$langs->trans("Piece").'
'; + print ''; + if ($action != 'editdate') { + print ''; + } + print '
'; + print $langs->trans('Docdate'); + print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'
'; + print '
'; + if ($action == 'editdate') { + print ''; + if ($optioncss != '') { + print ''; + } + print ''; + print ''; + print ''; + print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', 0, 0, 0, "setdate"); + print ''; + print ''; + } else { + print $object->doc_date ? dol_print_date($object->doc_date, 'day') : ' '; + } + print '
' . $langs->trans("Doctype") . '
'; + print ''; + if ($action != 'editjournal') { + print ''; + } + print '
'; + print $langs->trans('Codejournal'); + print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; + print '
'; + if ($action == 'editjournal') { + print '
'; + if ($optioncss != '') { + print ''; + } + print ''; + print ''; + print ''; + print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1); + print ''; + print '
'; + } else { + print $object->code_journal; + } + print '
'; - - print dol_get_fiche_end(); - - print $form->buttonsSaveCancel("Create"); - print ''; - } else { - $object = new BookKeeping($db); - $result = $object->fetchPerMvt($piece_num, $mode); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); + // Ref document + print ''; + print ''; + if ($action != 'editdocref') { + print ''; } - - if (!empty($object->piece_num)) { - $backlink = ''.$langs->trans('BackToList').''; - - if ($mode == '_tmp') { - print load_fiche_titre($langs->trans("CreateMvts"), $backlink); - } else { - print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); + print '
'; + print $langs->trans('Piece'); + print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; + print ''; + if ($action == 'editdocref') { + print '
'; + if ($optioncss != '') { + print ''; } + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + } else { + print $object->doc_ref; + } + print ''; + print ''; - $head = array(); - $h = 0; - $head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode ? '&mode='.$mode : ''); - $head[$h][1] = $langs->trans("Transaction"); - $head[$h][2] = 'transaction'; - $h++; - - print dol_get_fiche_head($head, 'transaction', '', -1); + print ''; - //dol_banner_tab($object, '', $backlink); + print ''; - print '
'; - print '
'; + print '
'; - print '
'; - print ''; + print '
'; + print '
'; - // Account movement + // Doc type + if (!empty($object->doc_type)) { print ''; - print ''; - print ''; - print ''; - - // Date - print ''; + print ''; + print ''; print ''; + } - // Journal - print ''; - print ''; + // Date document creation + print ''; + print ''; + print ''; + print ''; - // Ref document - print ''; + print ''; + print ''; print ''; - print '
'.$langs->trans("NumMvts").''.($mode == '_tmp' ? ''.$langs->trans("Draft").'' : $object->piece_num).'
'; - print ''; - if ($action != 'editdate') { - print ''; - } - print '
'; - print $langs->trans('Docdate'); - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'
'; - print '
'; - if ($action == 'editdate') { - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', 0, 0, 0, "setdate"); - print ''; - print '
'; - } else { - print $object->doc_date ? dol_print_date($object->doc_date, 'day') : ' '; - } - print '
'.$langs->trans("Doctype").''.$object->doc_type.'
'; - print ''; - if ($action != 'editjournal') { - print ''; - } - print '
'; - print $langs->trans('Codejournal'); - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; - print '
'; - if ($action == 'editjournal') { - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1); - print ''; - print '
'; - } else { - print $object->code_journal; - } - print '
'.$langs->trans("DateCreation").''; + print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; + print '
'; - print ''; - if ($action != 'editdocref') { - print ''; - } - print '
'; - print $langs->trans('Piece'); - print 'piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; - print '
'; - if ($action == 'editdocref') { - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - } else { - print $object->doc_ref; - } + // Don't show in tmp mode, inevitably empty + if ($mode != "_tmp") { + // Date document export + print '
' . $langs->trans("DateExport") . ''; + print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; print '
'; - - print '
'; - - print '
'; - - print '
'; - print ''; - - // Doc type - if (!empty($object->doc_type)) { - print ''; - print ''; - print ''; - print ''; - } - - // Date document creation + // Date document validation print ''; - print ''; + print ''; print ''; print ''; + } - // Don't show in tmp mode, inevitably empty - if ($mode != "_tmp") { - // Date document export - print ''; - print ''; - print ''; - print ''; - - // Date document validation - print ''; - print ''; - print ''; - print ''; + // Validate + /* + print ''; + print ''; + print ''; + print ''; + */ - // Validate - /* - print ''; - print ''; - print ''; - print ''; - */ - - // check data - /* - print ''; - print ''; - if ($object->doc_type == 'customer_invoice') - { - $sqlmid = 'SELECT rowid as ref'; - $sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac"; - $sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc); - dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $invoicestatic = new Facture($db); - $invoicestatic->fetch($objmid->ref); - $ref=$langs->trans("Invoice").' '.$invoicestatic->getNomUrl(1); - } - else dol_print_error($db); + // check data + /* + print ''; + print ''; + if ($object->doc_type == 'customer_invoice') + { + $sqlmid = 'SELECT rowid as ref'; + $sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac"; + $sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc); + dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $invoicestatic = new Facture($db); + $invoicestatic->fetch($objmid->ref); + $ref=$langs->trans("Invoice").' '.$invoicestatic->getNomUrl(1); } - print ''; - print ''; - */ - print "
'.$langs->trans("Doctype").''.$object->doc_type.'
'.$langs->trans("DateCreation").'' . $langs->trans("DateValidation") . ''; - print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; + print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; print '
' . $langs->trans("DateExport") . ''; - print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; - print '
' . $langs->trans("DateValidation") . ''; - print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; - print '
' . $langs->trans("Status") . ''; + if (empty($object->validated)) { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; + } else { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; } + print '
' . $langs->trans("Status") . ''; - if (empty($object->validated)) { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } else { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } - print '
' . $langs->trans("Control") . '
' . $langs->trans("Control") . '' . $ref .'
\n"; + else dol_print_error($db); + } + print '' . $ref .''; + print ''; + */ + print "\n"; - print '
'; + print '
'; - print dol_get_fiche_end(); + print dol_get_fiche_end(); - print '
'; + print '
'; - print '
'; + print '
'; - $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt + $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } else { - // List of movements - print load_fiche_titre($langs->trans("ListeMvts"), '', ''); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + // List of movements + print load_fiche_titre($langs->trans("ListeMvts"), '', ''); - print '
'; - if ($optioncss != '') { - print ''; + print ''; + if ($optioncss != '') { + print ''; + } + print ''; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + + if (count($object->linesmvt) > 0) { + print '
'; + print ''; + + $total_debit = 0; + $total_credit = 0; + + print ''; + + print_liste_field_titre("AccountAccountingShort"); + print_liste_field_titre("SubledgerAccount"); + print_liste_field_titre("LabelOperation"); + print_liste_field_titre("AccountingDebit", "", "", "", "", 'class="right"'); + print_liste_field_titre("AccountingCredit", "", "", "", "", 'class="right"'); + if (empty($object->date_validation)) { + print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center '); + } else { + print_liste_field_titre(""); } - print ''; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - - if (count($object->linesmvt) > 0) { - print '
'; - print '
'; - - $total_debit = 0; - $total_credit = 0; - - print ''; - - print_liste_field_titre("AccountAccountingShort"); - print_liste_field_titre("SubledgerAccount"); - print_liste_field_titre("LabelOperation"); - print_liste_field_titre("AccountingDebit", "", "", "", "", 'class="right"'); - print_liste_field_titre("AccountingCredit", "", "", "", "", 'class="right"'); - if (empty($object->date_validation)) { - print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center '); - } else { - print_liste_field_titre(""); - } - print "\n"; + print "\n"; - // Add an empty line if there is not yet - if (!empty($object->linesmvt[0])) { - $tmpline = $object->linesmvt[0]; - if (!empty($tmpline->numero_compte)) { - $line = new BookKeepingLine($db); - $object->linesmvt[] = $line; - } + // Add an empty line if there is not yet + if (!empty($object->linesmvt[0])) { + $tmpline = $object->linesmvt[0]; + if (!empty($tmpline->numero_compte)) { + $line = new BookKeepingLine($db); + $object->linesmvt[] = $line; } + } - foreach ($object->linesmvt as $line) { - print ''; - $total_debit += $line->debit; - $total_credit += $line->credit; - - if ($action == 'update' && $line->id == $id) { - print ''; + foreach ($object->linesmvt as $line) { + print ''; + $total_debit += $line->debit; + $total_credit += $line->credit; + + if ($action == 'update' && $line->id == $id) { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) { + if ($action == "" || $action == 'add') { + print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - } elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) { - if ($action == "" || $action == 'add') { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; + print ''; + } + } else { + print ''; + $resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true); + print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print img_delete(); + print ''; + } else { + print ''; + print img_delete($langs->trans("ForbiddenTransactionAlreadyValidated")); + print ''; } - print "\n"; - } - - $total_debit = price2num($total_debit, 'MT'); - $total_credit = price2num($total_credit, 'MT'); - if ($total_debit != $total_credit) { - setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings'); + print ''; } + print "\n"; + } - print '
'; + print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); + print ''; + // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: + // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. + // Also, it is not possible to use a value that is not in the list. + // Also, the label is not automatically filled when a value is selected. + if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { + print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); + } else { + print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; + } + // Add also input for subledger label + print '
subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; + print '
label_operation).'">debit)).'">credit)).'">'; + print ''."\n"; + print ''; + print ''; - print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); + print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); print ''; // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: @@ -697,129 +716,101 @@ // Also, it is not possible to use a value that is not in the list. // Also, the label is not automatically filled when a value is selected. if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { - print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); + print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); } else { - print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; + print ''; } - // Add also input for subledger label - print '
subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; - print '
label_operation).'">debit)).'">credit)).'">'; - print ''."\n"; - print ''; + print '
'; print '
'; - print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); - print ''; - // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: - // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. - // Also, it is not possible to use a value that is not in the list. - // Also, the label is not automatically filled when a value is selected. - if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { - print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); - } else { - print ''; - } - print '
'; - print '
'; + if ($resultfetch > 0) { + print $accountingaccount->getNomUrl(0, 1, 1, '', 0); } else { - print ''; - $resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true); - print ''; - if ($resultfetch > 0) { - print $accountingaccount->getNomUrl(0, 1, 1, '', 0); - } else { - print $line->numero_compte.' ('.$langs->trans("AccountRemovedFromCurrentChartOfAccount").')'; - } - print ''.length_accounta($line->subledger_account); - if ($line->subledger_label) { - print ' - '.$line->subledger_label.''; - } - print ''.$line->label_operation.''.($line->debit != 0 ? price($line->debit) : '').''.($line->credit != 0 ? price($line->credit) : '').''; - if (empty($line->date_export) && empty($line->date_validation)) { - print 'id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; - print img_edit('', 0, 'class="marginrightonly"'); - print '  '; - } else { - print ''; - print img_edit($langs->trans("ForbiddenTransactionAlreadyExported"), 0, 'class="marginrightonly"'); - print '  '; - } - - if (empty($line->date_validation)) { - $actiontodelete = 'delete'; - if ($mode == '_tmp' || $action != 'delmouv') { - $actiontodelete = 'confirm_delete'; - } + print $line->numero_compte.' ('.$langs->trans("AccountRemovedFromCurrentChartOfAccount").')'; + } + print ''.length_accounta($line->subledger_account); + if ($line->subledger_label) { + print ' - '.$line->subledger_label.''; + } + print ''.$line->label_operation.''.($line->debit != 0 ? price($line->debit) : '').''.($line->credit != 0 ? price($line->credit) : '').''; + if (empty($line->date_export) && empty($line->date_validation)) { + print 'id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; + print img_edit('', 0, 'class="marginrightonly"'); + print '  '; + } else { + print ''; + print img_edit($langs->trans("ForbiddenTransactionAlreadyExported"), 0, 'class="marginrightonly"'); + print '  '; + } - print ''; - print img_delete(); - print ''; - } else { - print ''; - print img_delete($langs->trans("ForbiddenTransactionAlreadyValidated")); - print ''; + if (empty($line->date_validation)) { + $actiontodelete = 'delete'; + if ($mode == '_tmp' || $action != 'delmouv') { + $actiontodelete = 'confirm_delete'; } - print '
'; - print '
'; + $total_debit = price2num($total_debit, 'MT'); + $total_credit = price2num($total_credit, 'MT'); - if ($mode == '_tmp' && $action == '') { - print '
'; - print '
'; - if ($total_debit == $total_credit) { - print ''.$langs->trans("ValidTransaction").''; - } else { - print ''; - } + if ($total_debit != $total_credit) { + setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings'); + } - print '   '; - print ''.$langs->trans("Cancel").''; + print ''; + print '
'; - print "
"; + if ($mode == '_tmp' && $action == '') { + print '
'; + print '
'; + if ($total_debit == $total_credit) { + print ''.$langs->trans("ValidTransaction").''; + } else { + print ''; } - } - print ''; + print '   '; + print ''.$langs->trans("Cancel").''; + + print "
"; + } } - } else { - print load_fiche_titre($langs->trans("NoRecords")); + + print ''; } + } else { + print load_fiche_titre($langs->trans("NoRecords")); } } -$reshook_onAfterView = $hookmanager->executeHooks('onAfterView', $parameters, $object, $action); -print dol_get_fiche_end(); + print dol_get_fiche_end(); // End of page llxFooter();