Example #1
0
 /* Save the predefined operation */
 if (isset($_POST['opd_name']) && trim($_POST['opd_name']) != "") {
     $opd = new Pre_op_ven($cn);
     $opd->get_post();
     $opd->save();
 }
 /* Show button  */
 echo '<h1 style="float:right;margin-right:20%"> Enregistrement </h1>';
 echo $Ledger->confirm($_POST, true);
 /* Show link for Invoice */
 if (isset($Ledger->doc)) {
     echo '<h2>Document </h2>';
     echo $Ledger->doc;
 }
 /* Save the additional information into jrn_info */
 $obj = new Acc_Ledger_Info($cn);
 $obj->save_extra($Ledger->jr_id, $_POST);
 // extourne
 if (isset($_POST['reverse_ck'])) {
     $p_date = HtmlInput::default_value_post('reverse_date', '');
     if (isDate($p_date) == $p_date) {
         // reverse the operation
         try {
             $Ledger->reverse($p_date);
             echo '<p>';
             echo _('Extourné au ') . $p_date;
             echo '</p>';
         } catch (Exception $e) {
             echo '<p class="notice">' . _('Opération non extournée') . $e->getMessage() . '</p>';
         }
     } else {
 function load_all()
 {
     if (!isset($this->jr_id)) {
         echo "jr_id is not set " . __FILE__ . __LINE__;
         throw new Exception('Error : jr_id not set');
     }
     $sql = "select ji_id from jrn_info where jr_id=" . $this->jr_id;
     $r = $this->cn->exec_sql($sql);
     if (Database::num_row($r) == 0) {
         return array();
     }
     $array = Database::fetch_all($r);
     $ret = array();
     foreach ($array as $row) {
         $o = new Acc_Ledger_Info($this->cn, $row['ji_id']);
         $o->load();
         $ret[] = clone $o;
     }
     return $ret;
 }