Пример #1
0
 function display_html()
 {
     $idx = 0;
     $r = "";
     //---Html
     $array = $this->load();
     if (is_array($array) == false || empty($array)) {
         return 0;
     }
     $r .= '<table class="result" style="width=100%">';
     $r .= '<tr>' . '<th>' . _('Date') . '</th>' . '<th>' . _('Poste') . '</th>' . '<th>' . _('Quick_code') . '</th>' . '<th>' . _('Analytique') . '</th>' . th(_('Description')) . '<th>' . _('libelle') . '</th>' . '<th>' . _('Num.interne') . '</th>' . '<th>' . _('Montant') . '</th>' . '<th>' . _('D/C') . '</th>' . '</tr>';
     foreach ($array as $row) {
         $class = $idx % 2 == 0 ? 'even' : 'odd';
         $idx++;
         $r .= '<tr class="' . $class . '">';
         $detail = $row['jr_id'] != null ? HtmlInput::detail_op($row['jr_id'], $row['jr_internal']) : '';
         $post_detail = $row['j_poste'] != null ? HtmlInput::history_account($row['j_poste'], $row['j_poste']) : '';
         $card_detail = $row['f_id'] != null ? HtmlInput::history_card($row['f_id'], $row['qcode']) : '';
         $r .= '<td>' . $row['oa_date'] . '</td>' . td($post_detail) . td($card_detail) . '<td>' . h($row['po_name']) . '</td>' . '<td>' . h($row['oa_description']) . '</td>' . td($row['jr_comment']) . '<td>' . $detail . '</td>' . '<td class="num">' . nbm($row['oa_amount']) . '</td>' . '<td>' . ($row['oa_debit'] == 'f' ? 'CREDIT' : 'DEBIT') . '</td>';
         $r .= '</tr>';
     }
     $r .= '</table>';
     return $r;
 }
Пример #2
0
          
        </table>

</div>
<div style="clear: both"></div>
	<div style="float:left;width: 47%">
		<h4 style="display:inline;">Opérations concernées</h4>
		<ol>

		<?php 
for ($o = 0; $o < count($operation); $o++) {
    if ($p_view != 'READ') {
        $js = HtmlInput::button_action_remove_operation($operation[$o]['ago_id']);
        echo '<li id="op' . $operation[$o]['ago_id'] . '">' . $operation[$o]['str_date'] . " " . HtmlInput::detail_op($operation[$o]['jr_id'], $operation[$o]['jr_internal']) . " " . h($operation[$o]['jr_comment']) . " " . $js . '</li>';
    } else {
        echo '<li >' . $operation[$o]['str_date'] . " " . HtmlInput::detail_op($operation[$o]['jr_id'], $operation[$o]['jr_internal']) . " " . h($operation[$o]['jr_comment']) . " " . '</li>';
    }
}
?>
		</ol>
		<?php 
if ($p_view != 'READ') {
    echo '<span class="noprint">' . $iconcerned->input() . '</span>';
}
?>
	</div>

        <div style="float:left;width: 47%">
		<h4 style="display:inline"><?php 
echo _("Actions concernées");
?>
Пример #3
0
 function html_table($p_from)
 {
     if ($p_from == "") {
         $from = "";
         $to = "";
     } else {
         $p = new Periode($this->db);
         list($from, $to) = $p->get_date_limit($p_from);
     }
     $array = $this->get_list($from, $to);
     if (empty($array)) {
         return "Pas d'enregistrement trouv&eacute;";
     }
     // navigation_bar
     $step = $_SESSION['g_pagesize'];
     $page = isset($_GET['offset']) ? $_GET['page'] : 1;
     $offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
     $bar = navigation_bar($offset + 1, count($array), $step, $page);
     if ($step != -1) {
         $view = array_splice($array, $offset, $step);
     } else {
         $view = $array;
     }
     $gDossier = dossier::id();
     $ret = "";
     $ret .= $bar;
     $count = 0;
     $group = 0;
     $oldgroup = 0;
     $oldjrid = 0;
     foreach ($view as $row) {
         $group = $row['oa_group'];
         if ($group != $oldgroup) {
             if ($oldgroup != 0) {
                 $efface = new IButton();
                 $efface->javascript = "anc_remove_operation(" . $gDossier . "," . $oldgroup . ")";
                 $efface->name = "Efface";
                 $efface->label = "Efface";
                 $ret .= "<td>" . $efface->input() . "</td>";
                 $this->oa_group = $oldgroup;
                 $jr_id = $this->get_jrid();
                 if ($jr_id != 0) {
                     // get the old jr_id
                     $detail = new IButton();
                     $detail->javascript = "viewOperation({$jr_id},{$gDossier})";
                     $detail->name = "Detail";
                     $detail->label = "Detail";
                     $ret .= "<td>" . $detail->input() . "</td>";
                 }
                 $ret .= '</table>';
             }
             $ret .= '<table id="' . $row['oa_group'] . '" class="result">';
             $ret .= "<tr class=\"highlight\">" . td($row['oa_date']) . "<td>" . HtmlInput::detail_op($row['jr_id'], h($row['oa_description'] . " " . $row['jr_pj_number'])) . "</td>" . td();
             $ret .= "<td>" . "Groupe id : " . $row['oa_group'] . "</td>" . ($oldgroup = $group);
         }
         $class = $count % 2 == 0 ? "odd" : "even";
         $count++;
         $cred = $row['oa_debit'] == 'f' ? "CREDIT" : "DEBIT";
         $ret .= "<tr class=\"{$class}\">";
         $ret .= "<td>" . h($row['po_name']) . "</td>";
         $ret .= td(h($row['po_description']));
         $ret .= '<td class="num">' . nbm($row['oa_amount']) . "</td>" . "<td>" . $cred . "</td>" . "</tr>";
     }
     $efface = new IButton();
     $efface->javascript = "anc_remove_operation(" . "{$gDossier}," . $oldgroup . ")";
     $efface->name = "Efface";
     $efface->label = "Efface";
     $ret .= "<td>" . $efface->input() . "</td>";
     // get the old jr_id
     $this->oa_group = $oldgroup;
     $jr_id = $this->get_jrid();
     if ($jr_id != 0) {
         $detail = new IButton();
         $detail->javascript = "modifyOperation({$jr_id},'" . $gDossier . "')";
         $detail->name = "Detail";
         $detail->label = "Detail";
         $ret .= "<td>" . $detail->input() . "</td>";
     }
     $ret .= '</table>';
     $ret .= $bar;
     return $ret;
 }
Пример #4
0
    ?>
	</td>
	<td class="box">
		<?php 
    echo $last_ledger[$i]['jr_pj_number'];
    ?>
            
        </td>
<td class="box">
   <?php 
    echo h(mb_substr($last_ledger[$i]['jr_comment'], 0, 40, 'UTF-8'));
    ?>
</td>
<td class="box">
<?php 
    echo HtmlInput::detail_op($last_ledger[$i]['jr_id'], $last_ledger[$i]['jr_internal']);
    ?>
</td>
<td class="num box">
<?php 
    echo nbm($last_ledger[$i]['jr_montant']);
    ?>
</td>

</tr>
<?php 
}
?>
</table>
    
</div>
Пример #5
0
 $prog = 0;
 bcscale(2);
 for ($i = 0; $i < count($letter->content); $i++) {
     $row = $letter->content[$i];
     $html_letter = "";
     if ($row['letter'] != -1) {
         $html_letter = strtoupper(base_convert($row['letter'], 10, 36));
     }
     if ($i % 2 == 0) {
         echo '<tr class="even" name="tr_' . $html_letter . '_">';
     } else {
         echo '<tr class="odd" name="tr_' . $html_letter . '_">';
     }
     echo td($row['j_date_fmt']);
     echo td(h($row['jr_pj_number']));
     echo td(HtmlInput::detail_op($row['jr_id'], $row['jr_internal']));
     echo td(h($row['jr_comment']));
     if ($row['j_debit'] == 't') {
         echo td(nbm($row['j_montant']), ' style="text-align:right"');
         $amount_deb = bcadd($amount_deb, $row['j_montant']);
         $prog = bcadd($prog, $row['j_montant']);
         echo td("");
     } else {
         echo td("");
         echo td(nbm($row['j_montant']), ' style="text-align:right"');
         $amount_cred = bcadd($amount_cred, $row['j_montant']);
         $prog = bcsub($prog, $row['j_montant']);
     }
     $side = "&nbsp;" . $fiche->get_amount_side($prog);
     echo td(nbm($prog) . $side, 'style="text-align:right"');
     $html_let = "";
     $side = "&nbsp;" . $Poste->get_amount_side($solde);
     $letter = "";
     $html_let = "";
     if ($detail['letter'] != -1) {
         $letter = strtoupper(base_convert($detail['letter'], 10, 36));
         $html_let = HtmlInput::show_reconcile("", $letter);
     }
     $i++;
     if ($i % 2 == 0) {
         $class = "odd";
     } else {
         $class = "even";
     }
     echo '<tr name="tr_' . $letter . '_" class="' . $class . '">
     <td>' . $detail['j_date_fmt'] . '</td>
     <td>' . HtmlInput::detail_op($detail['jr_id'], $detail['jr_internal']) . '</td>
     <td>' . $detail['description'] . '</td>
     <td>' . $detail['jr_pj_number'] . '</td>
     <td align="right">' . ($detail['deb_montant'] > 0 ? nbm($detail['deb_montant']) : '') . '</td>
     <td align="right">' . ($detail['cred_montant'] > 0 ? nbm($detail['cred_montant']) : '') . '</td>
     <td align="right">' . nbm(abs($solde)) . $side . '</td>
     <td  style="text-align:right;color:red">' . $html_let . '</td>
     </tr>';
 }
 echo '<tr class="highlight">
 <td>' . $current_exercice . '</td>
 <td>' . '' . '</td>
 <td>' . '<b>' . 'Total du compte ' . $poste_id['pcm_val'] . '</b>' . '</td>
 <td>' . '' . '</td>
 <td align="right">' . '<b>' . ($solde_d > 0 ? nbm($solde_d) : '') . '</b>' . '</td>
 <td align="right">' . '<b>' . ($solde_c > 0 ? nbm($solde_c) : '') . '</b>' . '</td>
Пример #7
0
/**
 * @brief Display a box with the contains
 * @param type $p_array Data to display
 * @param type $p_title Title of the box
 * @param type $p_div id of the box
 */
function display_dashboard_operation($p_array, $p_title, $p_div)
{
    ?>
<div id="<?php 
    echo $p_div;
    ?>
" class="inner_box" style="display:none;position:fixed;top:250px;left:12%;width: 75%;min-height:50%;overflow:auto;">
	<?php 
    echo HtmlInput::title_box($p_title, $p_div, "hide");
    ?>
	<?php 
    if (count($p_array) > 0) {
        ?>
	<table class="result">
		<tr>
			<th><?php 
        echo _('Date');
        ?>
</th>
			<th><?php 
        echo _('Code Interne');
        ?>
</th>
			<th><?php 
        echo _('Pièce');
        ?>
</th>
			<th><?php 
        echo _('Description');
        ?>
</th>
			<th>
				<?php 
        echo _('Montant');
        ?>
			</th>

		</tr>
		<?php 
        for ($i = 0; $i < count($p_array); $i++) {
            ?>
		<tr class="<?php 
            echo $i % 2 == 0 ? 'odd' : 'even';
            ?>
">
			<td>
				<?php 
            echo smaller_date(format_date($p_array[$i]['jr_date']));
            ?>
			</td>
			<td>
				<?php 
            echo HtmlInput::detail_op($p_array[$i]['jr_id'], $p_array[$i]['jr_internal']);
            ?>
			</td>
                        <td>
                            <?php 
            echo h($p_array[$i]['jr_pj_number']);
            ?>
                        </td>
			<td>
				<?php 
            echo h($p_array[$i]['jr_comment']);
            ?>
			</td>
			<td>
				<?php 
            echo nbm($p_array[$i]['jr_montant']);
            ?>
			</td>
		</tr>
		<?php 
        }
        ?>
	</table>
	<?php 
    } else {
        ?>
	<h2 class="notice"><?php 
        echo _('Aucune donnée');
        ?>
</h2>
	<?php 
    }
    ?>
</div>
<?php 
}
Пример #8
0
            <?php 
    for ($x = 0; $x < $nb_operation; $x++) {
        ?>
        <tr>
            <td>
                <?php 
        echo $a_operation[$x]['j_date'];
        ?>
            </td>
            <td>
                <?php 
        echo h($a_operation[$x]['jr_comment']);
        ?>
            </td>
            <td>
                <?php 
        echo HtmlInput::detail_op($a_operation[$x]['jr_id'], $a_operation[$x]['jr_internal']);
        ?>
            </td>
            <td>
              
            </td>
        </tr>
        <?php 
    }
    ?>
        </table>
    <?php 
}
?>
</div>
Пример #9
0
                printf("<td class=\"num\"></td>");
            }
        }
    }
    echo '<td class="num">' . $line['TVAC'] . '</td>';
    $tot['tvac'] = bcadd($tot['tvac'], floatval($line['TVAC']));
    /*
     * If reconcile print them
     */
    echo '<td>';
    $max = Database::num_row($ret_reconcile);
    if ($max > 0) {
        $sep = "";
        for ($e = 0; $e < $max; $e++) {
            $row = Database::fetch_array($ret_reconcile, $e);
            echo $sep . HtmlInput::detail_op($row['jr_id'], $row['jr_date'] . ' ' . $row['jr_internal']);
            $sep = ' ,';
        }
    }
    echo '</td>';
    echo "</tr>";
}
/** 
 * summary
 */
?>
    <tr class="highlight">
        <td>
            <?php 
echo _('Totaux');
?>
Пример #10
0
echo '<span style="display:block">';
echo '</span>';
echo '<table id="t_rec_bk" class="sortable" style="width:90%;margin-left:5%">';
$r = '<th class=" sorttable_sorted_reverse">' . 'Date ' . HtmlInput::infobulle(17) . '<span id="sorttable_sortrevind">&nbsp;&blacktriangle;</span>' . '</th>';
$r .= th('Libellé');
$r .= th('N° interne');
$r .= th('Montant', ' style="text-align:right"');
$r .= th('Selection', ' style="text-align:center" ');
echo tr($r);
$iradio = new ICheckBox('op[]');
$tot_not_reconcilied = 0;
$diff = 0;
for ($i = 0; $i < count($operation); $i++) {
    $row = $operation[$i];
    $r = '';
    $js = HtmlInput::detail_op($row['jr_id'], $row['jr_internal']);
    $r .= '<td sorttable_customkey="' . $row['raw_date'] . '">' . $row['fmt_date'] . '</td>';
    $r .= td($row['jr_comment']);
    $r .= td($js);
    $amount = $cn->get_value('select qf_amount from quant_fin where jr_id=$1', array($row['jr_id']));
    $r .= '<td class="num" class="sorttable_numeric" sorttable_customkey="' . $amount . '" style="text-align:right">' . nbm($amount) . '</td>';
    $diff = bcadd($diff, $amount);
    $tot_not_reconcilied += $row['jr_montant'];
    $iradio->value = $row['jr_id'];
    $iradio->selected = false;
    if (isset($_POST['op'])) {
        for ($x = 0; $x < count($_POST['op']); $x++) {
            if ($row['jr_id'] == $_POST['op'][$x]) {
                $iradio->selected = true;
                break;
            }
Пример #11
0
 function display_html()
 {
     $r = "";
     //---Html
     $array = $this->load();
     if (is_array($array) == false || empty($array)) {
         return 0;
     }
     $r .= '<table class="result" style="width:100%">';
     $ix = 0;
     $prev = 'xx';
     $idx = 0;
     $tot_deb = $tot_cred = 0;
     bcscale(2);
     foreach ($array as $row) {
         if ($prev != $row['po_name']) {
             if ($ix > 0) {
                 $r .= '<tr>';
                 $tot_solde = bcsub($tot_cred, $tot_deb);
                 $sign = " " . ($tot_solde > 0) ? 'C' : 'D';
                 $r .= td('') . td('') . td('');
                 $r .= td('') . td('') . td('') . td('') . td('') . td(nbm($tot_deb), ' class="num"') . td(nbm($tot_cred), ' class="num"') . td(nbm($tot_solde) . $sign, ' class="num notice"');
             }
             $r .= '<tr>' . '<td colspan="7" style="width:auto">' . '<h2>' . h($row['po_name'] . ' ' . $row['po_description']) . '</td></tr>';
             $r .= '<tr>' . '<th>' . '</th>' . '<th>' . _('Date') . '</th>' . '<th>' . _('Poste') . '</th>' . '<th>' . _('Quick_code') . '</th>' . '<th>' . _('Libellé') . '</th>' . '<th>' . '</th>' . '<th>' . _('Pièce') . '</th>' . '<th>' . _('Interne') . '</th>' . '<th style="text-align:right">' . _('Débit') . '</th>' . '<th style="text-align:right">' . _('Crédit') . '</th>' . '<th style="text-align:right">' . _('Prog.') . '</th>' . '</tr>';
             $tot_deb = $tot_cred = 0;
             $prev = $row['po_name'];
             $ix++;
         }
         $class = $idx % 2 == 0 ? 'even' : 'odd';
         $idx++;
         $r .= '<tr class="' . $class . '">';
         $detail = $row['jr_id'] != null ? HtmlInput::detail_op($row['jr_id'], $row['jr_internal']) : '';
         $post_detail = $row['j_poste'] != null ? HtmlInput::history_account($row['j_poste'], $row['j_poste']) : '';
         $card_detail = $row['f_id'] != null ? HtmlInput::history_card($row['f_id'], $row['qcode']) : '';
         $amount_deb = $row['oa_debit'] == 't' ? $row['oa_amount'] : 0;
         $amount_cred = $row['oa_debit'] == 'f' ? $row['oa_amount'] : 0;
         $tot_deb = bcadd($tot_deb, $amount_deb);
         $tot_cred = bcadd($tot_cred, $amount_cred);
         $tot_solde = bcsub($tot_cred, $tot_deb);
         /*
          * Checked button
          */
         $str_ck = "";
         $str_document = "";
         if ($row['jr_id'] != null) {
             /*
              * Get receipt info  
              */
             $str_document = HtmlInput::show_receipt_document($row['jr_id']);
             if ($str_document != "") {
                 $ck = new ICheckBox('ck[]', $row['jr_id']);
                 $str_ck = $ck->input();
             }
         }
         $r .= '<td>' . $str_ck . '</td>' . '<td>' . $row['oa_date'] . '</td>' . td($post_detail) . td($card_detail) . td($row['jr_comment']) . '<td>' . $str_document . '</td>' . td($row['jr_pj_number']) . '<td>' . $detail . '</td>' . '<td class="num">' . nbm($amount_deb) . '</td>' . '<td class="num">' . nbm($amount_cred) . '</td>' . '<td class="num">' . nbm($tot_solde) . '</td>';
         $r .= '</tr>';
     }
     $r .= '<tr>';
     $tot_solde = bcsub($tot_cred, $tot_deb);
     $sign = $tot_solde > 0 ? 'C' : 'D';
     $r .= td('') . td('') . td('');
     $r .= td('') . td('') . td('') . td('') . td('') . td(nbm($tot_deb), ' class="num"') . td(nbm($tot_cred), ' class="num"') . td(nbm($tot_solde) . $sign, '  class="num notice"');
     $r .= '</table>';
     return $r;
 }
Пример #12
0
 echo $card->content[$j]['j_date_fmt'];
 ?>
 </td>
 <td>
     <?php 
 echo HtmlInput::detail_op($card->content[$j]['jr_id'], $card->content[$j]['jr_pj_number']);
 ?>
 </td>
 <td>
     <?php 
 echo $card->content[$j]['jr_comment'];
 ?>
 </td>
 <td>
     <?php 
 echo HtmlInput::detail_op($card->content[$j]['jr_id'], $card->content[$j]['jr_internal']);
 ?>
 </td>
 <td style="text-align: right">
     <?php 
 $side = $card->content[$j]['j_debit'] == 't' ? 'D' : 'C';
 if ($card->content[$j]['jrn_def_type'] == 'FIN' || $card->content[$j]['jrn_def_type'] == 'ODS') {
     echo nbm($card->content[$j]['j_montant']) . " " . $side;
     if ($card->content[$j]['j_debit'] == 't') {
         $sum_fin = bcadd($sum_fin, $card->content[$j]['j_montant']);
     } else {
         $sum_fin = bcsub($sum_fin, $card->content[$j]['j_montant']);
     }
     $show = false;
 }
 ?>
Пример #13
0
 $r .= td($detail);
 $r .= td($array[$i]['first']['jr_pj_number']);
 $r .= td($array[$i]['first']['jr_comment']);
 $r .= td(nbm($array[$i]['first']['jr_montant']), 'style="text-align:right"');
 echo tr($r);
 // check if operation does exist in v_detail_quant
 $ret = $acc_reconciliation->db->execute('detail_quant', array($array[$i]['first']['jr_id']));
 $acc_reconciliation->show_detail($ret);
 if (isset($array[$i]['depend'])) {
     $tot2 = 0;
     $limit = count($array[$i]['depend']) - 1;
     for ($e = 0; $e < count($array[$i]['depend']); $e++) {
         $r = '';
         $r .= td($i);
         $r .= td(format_date($array[$i]['depend'][$e]['jr_date']));
         $detail = HtmlInput::detail_op($array[$i]['depend'][$e]['jr_id'], $array[$i]['depend'][$e]['jr_internal']);
         $r .= td($detail);
         $r .= td($array[$i]['depend'][$e]['jr_pj_number']);
         $r .= td($array[$i]['depend'][$e]['jr_comment']);
         $r .= td(nbm($array[$i]['depend'][$e]['jr_montant']), 'style="text-align:right"');
         $tot2 = bcadd($tot2, $array[$i]['depend'][$e]['jr_montant']);
         if ($e == $limit) {
             echo '<tr>' . $r . '</tr>';
         } else {
             echo tr($r);
         }
         $ret = $acc_reconciliation->db->execute('detail_quant', array($array[$i]['depend'][$e]['jr_id']));
         $acc_reconciliation->show_detail($ret);
     }
     echo tr(td(_('Total ')) . td('operation') . td(nbm($tot)) . td('operations dépendantes') . td(nbm($tot2)) . td('Delta') . td(bcsub($tot, $tot2)), ' class="highlight"');
     echo tr(td('<hr>', ' colspan="6" style="witdh:auto"'));
Пример #14
0
     } else {
         /*
          * Ledger ACH or VEN
          */
         $own = new Own($cn);
         require_once NOALYSS_INCLUDE . '/template/print_ledger_simple.php';
     }
 } elseif ($_GET['p_simple'] == 2) {
     foreach ($Row as $line) {
         echo '<div style="margin-top:2px;margin-bottom:10px;border:solid 1px black">';
         $class = ' class="odd" style="font-stretch: expanded;font-size:1em;"';
         echo '<table class="result" style="font-weight: bolder;font-variant: small-caps;width:100%;">';
         echo "<tr {$class}>";
         echo '<TD style="width:5%">' . $line['date'] . "</TD>";
         echo '<TD style="width:10%">' . h($line['jr_pj_number']) . "</TD>";
         echo '<TD style="width:5%">' . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . "</TD>";
         $tiers = $Jrn->get_tiers($line['jrn_def_type'], $line['jr_id']);
         $ledger_name = $cn->get_value("select jrn_def_name from jrn_def where jrn_def_id=\$1", array($line['jr_def_id']));
         echo '<TD style="width:20%">' . h($ledger_name) . ' </td>';
         echo '<TD style="width:20%">' . h($tiers) . ' </td>';
         echo '<TD style="width:30%">' . h($line['comment']) . "</TD>";
         echo '<TD style="text-align:right">';
         if ($line['jrn_def_type'] == 'FIN') {
             $positive = $cn->get_value("select qf_amount from quant_fin where jr_id=\$1", array($line['jr_id']));
             if ($cn->count() == 0) {
                 $positive = 1;
             } else {
                 $positive = $positive > 0 ? 1 : 0;
             }
             echo $positive == 0 ? "<font color=\"red\">  - " . nbm($line['montant']) . "</font>" : nbm($line['montant']);
         } else {
Пример #15
0
 public function insert($p_array = null)
 {
     global $g_parameter;
     bcscale(2);
     $internal_code = "";
     $oid = 0;
     extract($p_array);
     $ret = '';
     // Debit = banque
     $bank_id = $this->get_bank();
     $fBank = new Fiche($this->db, $bank_id);
     $e_bank_account = $fBank->strAttribut(ATTR_DEF_QUICKCODE);
     // Get the saldo
     $pPeriode = new Periode($this->db);
     $sposte = $fBank->strAttribut(ATTR_DEF_ACCOUNT);
     // if 2 accounts, take only the debit one for customer
     if (strpos($sposte, ',') != 0) {
         $array = explode(',', $sposte);
         $poste_val = $array[0];
     } else {
         $poste_val = $sposte;
     }
     $acc_account = new Acc_Account_Ledger($this->db, $poste_val);
     // If date = deposit date
     if ($chdate == 1) {
         if ($this->check_periode() == true) {
             $pPeriode->p_id = $periode;
         } else {
             $pPeriode->find_periode($e_date);
         }
         $exercice = $pPeriode->get_exercice();
         $filter_year = "  j_tech_per in (select p_id from parm_periode where  p_exercice='" . $exercice . "')";
         $asolde = $acc_account->get_solde_detail($filter_year);
         $deb = $asolde['debit'];
         $cred = $asolde['credit'];
         $solde = bcsub($deb, $cred);
         $new_solde = $solde;
     }
     try {
         $this->db->start();
         $amount = 0.0;
         $idx_operation = 0;
         $ret = '<table class="result" >';
         $ret .= tr(th('Date') . th('n° interne') . th('Quick Code') . th('Nom') . th('Libellé') . th('Montant', ' style="text-align:right"'));
         // Credit = goods
         $get_solde = true;
         for ($i = 0; $i < $nb_item; $i++) {
             // insert it into the database
             // and quit the loop ?
             if (strlen(trim(${"e_other{$i}"})) == 0) {
                 continue;
             }
             if ($chdate == 2) {
                 $e_date = ${'dateop' . $i};
             }
             // if date is date of operation
             if ($chdate == 2 && $get_solde) {
                 $get_solde = false;
                 if ($this->check_periode() == true) {
                     $pPeriode->p_id = $periode;
                 } else {
                     $pPeriode->find_periode($e_date);
                 }
                 $exercice = $pPeriode->get_exercice();
                 $filter_year = "  j_tech_per in (select p_id from parm_periode where  p_exercice='" . $exercice . "')";
                 $solde = $acc_account->get_solde($filter_year);
                 $new_solde = $solde;
             }
             $fPoste = new Fiche($this->db);
             $fPoste->get_by_qcode(${"e_other{$i}"});
             // round it
             ${"e_other{$i}" . "_amount"} = round(${"e_other{$i}" . "_amount"}, 2);
             $amount += ${"e_other{$i}" . "_amount"};
             // Record a line for the bank
             // Compute the j_grpt
             $seq = $this->db->get_next_seq('s_grpt');
             $acc_operation = new Acc_Operation($this->db);
             $acc_operation->date = $e_date;
             $sposte = $fPoste->strAttribut(ATTR_DEF_ACCOUNT);
             // if 2 accounts
             if (strpos($sposte, ',') != 0) {
                 $array = explode(',', $sposte);
                 if (${"e_other{$i}" . "_amount"} < 0) {
                     $poste_val = $array[1];
                 } else {
                     $poste_val = $array[0];
                 }
             } else {
                 $poste_val = $sposte;
             }
             $acc_operation->poste = $poste_val;
             $acc_operation->amount = ${"e_other{$i}" . "_amount"} * -1;
             $acc_operation->grpt = $seq;
             $acc_operation->jrn = $p_jrn;
             $acc_operation->type = 'd';
             if (isset($periode)) {
                 $tperiode = $periode;
             } else {
                 $per = new Periode($this->db);
                 $tperiode = $per->find_periode($e_date);
             }
             $acc_operation->periode = $tperiode;
             $acc_operation->qcode = ${"e_other" . $i};
             $j_id = $acc_operation->insert_jrnx();
             $acc_operation = new Acc_Operation($this->db);
             $acc_operation->date = $e_date;
             $sposte = $fBank->strAttribut(ATTR_DEF_ACCOUNT);
             // if 2 accounts
             if (strpos($sposte, ',') != 0) {
                 $array = explode(',', $sposte);
                 if (${"e_other{$i}" . "_amount"} < 0) {
                     $poste_val = $array[1];
                 } else {
                     $poste_val = $array[0];
                 }
             } else {
                 $poste_val = $sposte;
             }
             $acc_operation->poste = $poste_val;
             $acc_operation->amount = ${"e_other{$i}" . "_amount"};
             $acc_operation->grpt = $seq;
             $acc_operation->jrn = $p_jrn;
             $acc_operation->type = 'd';
             $acc_operation->periode = $tperiode;
             $acc_operation->qcode = $e_bank_account;
             $acc_operation->insert_jrnx();
             if (sql_string(${"e_other{$i}" . "_comment"}) == null) {
                 // if comment is blank set a default one
                 $comment = "  compte : " . $fBank->strAttribut(ATTR_DEF_NAME) . ' a ' . $fPoste->strAttribut(ATTR_DEF_NAME);
             } else {
                 $comment = ${'e_other' . $i . '_comment'};
             }
             $acc_operation = new Acc_Operation($this->db);
             $acc_operation->jrn = $p_jrn;
             $acc_operation->amount = abs(${"e_other{$i}" . "_amount"});
             $acc_operation->date = $e_date;
             $acc_operation->desc = $comment;
             $acc_operation->grpt = $seq;
             $acc_operation->periode = $tperiode;
             $acc_operation->mt = $mt;
             $idx_operation++;
             $acc_operation->pj = '';
             if (trim($e_pj) != '' && $this->numb_operation() == true) {
                 $acc_operation->pj = $e_pj . str_pad($idx_operation, 3, 0, STR_PAD_LEFT);
             }
             if (trim($e_pj) != '' && $this->numb_operation() == false) {
                 $acc_operation->pj = $e_pj;
             }
             $jr_id = $acc_operation->insert_jrn();
             // 	  $acc_operation->set_pj();
             $this->db->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2', array($acc_operation->pj, $jr_id));
             $internal = $this->compute_internal_code($seq);
             if (trim(${"e_concerned" . $i}) != "") {
                 if (strpos(${"e_concerned" . $i}, ',') != 0) {
                     $aRapt = explode(',', ${"e_concerned" . $i});
                     foreach ($aRapt as $rRapt) {
                         // Add a "concerned operation to bound these op.together
                         //
                         $rec = new Acc_Reconciliation($this->db);
                         $rec->set_jr_id($jr_id);
                         if (isNumber($rRapt) == 1) {
                             $rec->insert($rRapt);
                         }
                     }
                 } else {
                     if (isNumber(${"e_concerned" . $i}) == 1) {
                         $rec = new Acc_Reconciliation($this->db);
                         $rec->set_jr_id($jr_id);
                         $rec->insert(${"e_concerned{$i}"});
                     }
                 }
             }
             // Set Internal code
             $this->grpt_id = $seq;
             /**
              * save also into quant_fin
              */
             $this->insert_quant_fin($fBank->id, $jr_id, $fPoste->id, ${"e_other{$i}" . "_amount"});
             if ($g_parameter->MY_ANALYTIC != "nu") {
                 // for each item, insert into operation_analytique */
                 $op = new Anc_Operation($this->db);
                 $op->oa_group = $this->db->get_next_seq("s_oa_group");
                 /* for analytic */
                 $op->j_id = $j_id;
                 $op->oa_date = $e_date;
                 $op->oa_debit = 'f';
                 $op->oa_description = sql_string($comment);
                 $op->save_form_plan($_POST, $i, $j_id);
             }
             $this->update_internal_code($internal);
             $js_detail = HtmlInput::detail_op($jr_id, $internal);
             // Compute display
             $row = td($e_date) . td($js_detail) . td(${"e_other{$i}"}) . td($fPoste->strAttribut(ATTR_DEF_NAME)) . td(${"e_other" . $i . "_comment"}) . td(nbm(${"e_other{$i}" . "_amount"}), 'class="num"');
             $class = $i % 2 == 0 ? ' class="even" ' : ' class="odd" ';
             $ret .= tr($row, $class);
             if ($i == 0) {
                 // first record we upload the files and
                 // keep variable to update other row of jrn
                 if (isset($_FILES)) {
                     $oid = $this->db->save_upload_document($seq);
                 }
             } else {
                 if ($oid != 0) {
                     $this->db->exec_sql("update jrn set jr_pj=\$1 , jr_pj_name=\$2,\n                                            jr_pj_type=\$3  where jr_grpt_id=\$4", array($oid, $_FILES['pj']['name'], $_FILES['pj']['type'], $seq));
                 }
             }
         }
         // for nbitem
         // increment pj
         if (strlen(trim($e_pj)) != 0) {
             $this->inc_seq_pj();
         }
         $ret .= '</table>';
     } catch (Exception $e) {
         $r = '<span class="error">' . 'Erreur dans l\'enregistrement ' . __FILE__ . ':' . __LINE__ . ' ' . $e->getMessage();
         $this->db->rollback();
         throw new Exception($r);
     }
     $this->db->commit();
     $r = "";
     $r .= "<br>Ancien solde " . nbm($solde);
     $new_solde = bcadd($new_solde, $amount);
     $r .= "<br>Nouveau solde " . nbm($new_solde);
     $ret .= $r;
     return $ret;
 }