/** * @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(); } }
?> " onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';show_tabs(a_tab,'document_div_id')"> <?php echo _('Document'); ?> </a></li> <li class="tabs"> <a href="javascript:void(0)" title="<?php echo _("Extourne"); ?> " onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';show_tabs(a_tab,'reverse_div_id')"> <?php echo _('Extourne'); ?> </a></li> </ul> <div id="modele_div_id"> <?php echo Pre_operation::save_propose(); ?> </div> <div id="reverse_div_id" style="display:none;height:185px;height:10rem"> <?php $reverse_date = new IDate('reverse_date'); $reverse_ck = new ICheckBox('reverse_ck'); echo _('Extourne opération') . " " . $reverse_ck->input() . " "; echo $reverse_date->input(); ?> </div> <div id="document_div_id" style="display:none;height:185px;height:10rem"> <?php $file = new IFile(); $file->table = 0; echo '<p class="decale">';
echo $hid->input("sa", "jrn"); echo $hid->input("ac", $request_ac); echo '<hr>'; echo HtmlInput::submit('Accepter', 'Accepter'); echo '</form>'; // if $_REQUEST[sa] == del delete the predefined operation if ($request_sa == 'del') { $op = new Pre_operation($cn); $op->od_id = $_REQUEST['od_id']; $op->delete(); $request_sa = 'jrn'; } // if $_REQUEST[sa] == jrn show the predefined operation for this // ledger if ($request_sa == 'jrn') { $op = new Pre_operation($cn); $op->set_jrn($get_jrn); $is_ods = $cn->get_value("select count(*)\n\t\tfrom jrn_def where\n\t\t\tjrn_def_id=\$1\n\t\t\tand jrn_def_type='ODS'", array($get_jrn)); $op->od_direct = $is_ods > 0 ? 't' : 'f'; $array = $op->get_list_ledger(); if (empty($array) == true) { echo _("Aucun enregistrement"); return; } echo '<table>'; $count = 0; foreach ($array as $row) { if ($count % 2 == 0) { echo '<tr class="odd">'; } else { echo '<tr class="even">';