require_once NOALYSS_INCLUDE . '/ac_common.php'; require_once NOALYSS_INCLUDE . '/class_acc_ledger.php'; $gDossier = dossier::id(); require_once NOALYSS_INCLUDE . '/class_database.php'; /* Admin. Dossier */ $cn = new Database($gDossier); require_once NOALYSS_INCLUDE . '/class_user.php'; // display a search box $base = basename($_SERVER['SCRIPT_NAME']); $inside = false; $ledger = new Acc_Ledger($cn, 0); $ledger->type = 'ALL'; if (isset($_GET['amount_id'])) { put_global(array(array("key" => 'amount_min', 'value' => $_GET['amount_id']), array("key" => 'amount_max', 'value' => $_GET['amount_id']))); } $search_box = $ledger->search_form('ALL', 1, 'search_op'); if ($base == 'recherche.php' || $base == 'do.php') { echo '<div class="content" >'; echo '<form method="GET">'; } else { $div = 'search_op'; $action = ""; $callback = ""; echo HtmlInput::title_box(_('Recherche'), $div); echo '<form name="search_form_ajx" id="search_form_ajx" onsubmit="search_operation(this);return false">'; echo HtmlInput::get_to_hidden(array('ctlc', 'ledger', 'target')); $inside = true; } echo $search_box; echo HtmlInput::submit("viewsearch", _("Recherche")); echo HtmlInput::button_close('search_op');
$g_user = new User($cn); $g_user->Check(); $act = $g_user->check_dossier($gDossier); // AC CODE = SEARCH if ($act == 'P') { redirect("extension.php?" . dossier::get(), 0); exit; } if ($act == 'X') { alert(_('Accès interdit')); exit; } // display a search box $ledger = new Acc_Ledger($cn, 0); $ledger->type = 'ALL'; $search_box = $ledger->search_form('ALL', 1); echo '<div class="content">'; echo '<form method="GET">'; echo $search_box; echo HtmlInput::submit("viewsearch", _("Recherche")); ?> <input type="button" class="smallbutton" onclick="window.close()" value="<?php echo _('Fermer'); ?> "> <?php echo '</form>'; //----------------------------------------------------- // Display search result //-----------------------------------------------------
/** * @brief this function is intended to test this class */ static function test_me($pCase = '') { if ($pCase == '') { echo Acc_Reconciliation::$javascript; html_page_start(); $cn = new Database(dossier::id()); $_SESSION['g_user'] = '******'; $_SESSION['g_pass'] = '******'; $id = isset($_REQUEST['p_jrn']) ? $_REQUEST['p_jrn'] : -1; $a = new Acc_Ledger($cn, $id); $a->with_concerned = true; // Vide echo '<FORM method="post">'; echo $a->select_ledger()->input(); echo HtmlInput::submit('go', 'Test it'); echo '</form>'; if (isset($_POST['go'])) { echo "Ok "; echo '<form method="post">'; echo $a->show_form(); echo HtmlInput::submit('post_id', 'Try me'); echo '</form>'; // Show the predef operation // Don't forget the p_jrn echo '<form>'; echo dossier::hidden(); echo '<input type="hidden" value="' . $id . '" name="p_jrn">'; $op = new Pre_operation($cn); $op->p_jrn = $id; $op->od_direct = 't'; if ($op->count() != 0) { echo HtmlInput::submit('use_opd', 'Utilisez une opération prédéfinie', "", "smallbutton"); echo $op->show_button(); } echo '</form>'; exit('test_me'); } if (isset($_POST['post_id'])) { echo '<form method="post">'; echo $a->show_form($_POST, 1); echo HtmlInput::button('add', 'Ajout d\'une ligne', 'onClick="quick_writing_add_row()"'); echo HtmlInput::submit('save_it', _("Sauver")); echo '</form>'; exit('test_me'); } if (isset($_POST['save_it'])) { print 'saving'; $array = $_POST; $array['save_opd'] = 1; try { $a->save($array); } catch (Exception $e) { alert($e->getMessage()); echo '<form method="post">'; echo $a->show_form($_POST); echo HtmlInput::submit('post_id', 'Try me'); echo '</form>'; } return; } // The GET at the end because automatically repost when you don't // specify the url in the METHOD field if (isset($_GET['use_opd'])) { $op = new Pre_op_advanced($cn); $op->set_od_id($_REQUEST['pre_def']); //$op->p_jrn=$id; $p_post = $op->compute_array(); echo '<FORM method="post">'; echo $a->show_form($p_post); echo HtmlInput::submit('post_id', 'Use predefined operation'); echo '</form>'; return; } } // if case = '' /////////////////////////////////////////////////////////////////////////// // search if ($pCase == 'search') { html_page_start(); $cn = new Database(dossier::id()); $ledger = new Acc_Ledger($cn, 0); $_SESSION['g_user'] = '******'; $_SESSION['g_pass'] = '******'; echo $ledger->search_form('ALL'); } /////////////////////////////////////////////////////////////////////////// // reverse // Give yourself the var and check in your tables /////////////////////////////////////////////////////////////////////////// if ($pCase == 'reverse') { $cn = new Database(dossier::id()); $jr_internal = 'OD-01-272'; try { $cn->start(); $jrn_def_id = $cn->get_value('select jr_def_id from jrn where jr_internal=$1', array($jr_internal)); $ledger = new Acc_Ledger($cn, $jrn_def_id); $ledger->jr_id = $cn->get_value('select jr_id from jrn where jr_internal=$1', array($jr_internal)); echo "Ouvrez le fichier " . __FILE__ . " à la ligne " . __LINE__ . " pour changer jr_internal et vérifier le résultat de l'extourne"; $ledger->reverse('01.07.2010'); } catch (Exception $e) { $cn->rollback(); var_dump($e); } $cn->commit(); } }