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;
 }
 /**
  *@brief export the ledger in  PDF
  */
 function export()
 {
     bcscale(2);
     $a_jrn = $this->ledger->get_operation($_GET['from_periode'], $_GET['to_periode']);
     if ($a_jrn == null) {
         return;
     }
     for ($i = 0; $i < count($a_jrn); $i++) {
         /* initialize tva */
         for ($f = 0; $f < count($this->a_Tva); $f++) {
             $l = $this->a_Tva[$f]['tva_id'];
             $atva_amount[$l] = 0;
         }
         // retrieve info from ledger
         $aAmountVat = $this->ledger->vat_operation($a_jrn[$i]['jr_grpt_id']);
         // put vat into array
         for ($f = 0; $f < count($aAmountVat); $f++) {
             $l = $aAmountVat[$f]['tva_id'];
             $atva_amount[$l] = bcadd($atva_amount[$l], $aAmountVat[$f]['sum_vat']);
             $this->tp_tva[$l] = bcadd($this->tp_tva[$l], $aAmountVat[$f]['sum_vat']);
             $this->rap_tva[$l] = bcadd($this->rap_tva[$l], $aAmountVat[$f]['sum_vat']);
         }
         $row = $a_jrn[$i];
         $this->LongLine(15, 5, $row['pj'], 0);
         $this->Cell(10, 5, $row['date_fmt'], 0, 0);
         $this->Cell(13, 5, $row['internal'], 0, 0);
         list($qc, $name) = $this->get_tiers($row['id'], $this->jrn_type);
         $this->LongLine(40, 5, "[" . $qc . "]" . $name, 0, 'L');
         $this->LongLine(65, 5, mb_substr($row['comment'], 0, 150), 0, 'L');
         /* get other amount (without vat, total vat included, private, ND */
         $other = $this->ledger->get_other_amount($a_jrn[$i]['jr_grpt_id']);
         $this->tp_htva = bcadd($this->tp_htva, $other['price']);
         $this->tp_tvac = bcadd($this->tp_tvac, $other['price'] + $other['vat']);
         $this->tp_tva_np = bcadd($this->tp_tva_np, $other['tva_np']);
         $this->tp_priv = bcadd($this->tp_priv, $other['priv']);
         $this->tp_nd = bcadd($this->tp_nd, $other['tva_nd']);
         $this->rap_htva = bcadd($this->rap_htva, $other['price']);
         $this->rap_tvac = bcadd($this->rap_tvac, bcadd($other['price'], bcsub($other['vat'], $other['tva_np'])));
         $this->rap_priv = bcadd($this->rap_priv, $other['priv']);
         $this->rap_nd = bcadd($this->rap_nd, $other['tva_nd']);
         $this->rap_tva_np = bcadd($this->rap_tva_np, $other['tva_np']);
         $this->Cell(15, 5, nbm($other['price']), 0, 0, 'R');
         if ($this->jrn_type != 'VEN') {
             $this->Cell(15, 5, nbm($other['priv']), 0, 0, 'R');
             $this->Cell(15, 5, nbm($other['tva_nd']), 0, 0, 'R');
         }
         $this->Cell(15, 5, nbm($other['tva_np']), 0, 0, 'R');
         foreach ($atva_amount as $row_atva_amount) {
             $this->Cell(15, 5, nbm($row_atva_amount), 0, 0, 'R');
         }
         $l_tvac = bcadd($other['price'], bcsub($other['vat'], $other['tva_np']));
         $l_tvac = bcadd($l_tvac, $other['tva_nd']);
         $this->Cell(15, 5, nbm($l_tvac), 0, 0, 'R');
         $this->Ln(5);
     }
 }
header('Content-type: application/csv');
header('Content-Disposition: attachment;filename="stock-summary-list.csv"', FALSE);
?>
"Depot";"Adresse";"Ville";"Pays";"Code Stock";"Fiches";"IN";"OUT";"DIFF"
<?php 
$a_repo = $cn->get_array("select distinct t.r_id,r_name,r_adress,r_city,r_country from stock_repository as s join tmp_stockgood_detail as t\n\ton (s.r_id=t.r_id)\n\twhere\n\ts_id=\$1\n\torder by 2\n\t", array($tmp_id));
for ($r = 0; $r < count($a_repo); $r++) {
    $a_stock = $cn->get_array("\n\t\t\t\t\tselect coalesce(sum(s_qin),0) as qin,coalesce(sum(s_qout),0) as qout,sg_code\n\t\t\t\t\t\tfrom tmp_stockgood_detail  where r_id=\$1 and s_id=\$2\n\t\t\t\t\t\tgroup by sg_code\n\t\t\t\t\t\torder by sg_code\n\n\t\t\t\t\t", array($a_repo[$r]['r_id'], $tmp_id));
    for ($s = 0; $s < count($a_stock); $s++) {
        $a_card = $cn->get_array("\n\t\t\t\t\t\tselect f_id,vw_name,quick_code\n\t\t\t\t\t\tfrom vw_fiche_attr\n\t\t\t\t\t\twhere\n\t\t\t\t\t f_id in (\n\t\t\t\t\t\tselect distinct f_id from fiche_detail\n\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\tad_id=19 and\n\t\t\t\t\t\t\tad_value=\$1)\n\t\t\t\t\t\torder by vw_name,quick_code\n\t\t\t\t\t", array($a_stock[$s]['sg_code']));
        printf('"%s";', $a_repo[$r]['r_name']);
        printf('"%s";', $a_repo[$r]['r_adress']);
        printf('"%s";', $a_repo[$r]['r_city']);
        printf('"%s";', $a_repo[$r]['r_country']);
        printf('"%s";', $a_stock[$s]['sg_code']);
        $sep = "";
        for ($c = 0; $c < count($a_card); $c++) {
            $a = sprintf('[%s] %s', $a_card[$c]['quick_code'], $a_card[$c]['vw_name']);
            $sep = "  / ";
        }
        // for C
        if (count($a_card) == 0) {
            $a = ' Erreur Code non utilisé';
        }
        printf('"%s";', $a);
        printf('%s;', nbm($a_stock[$s]['qin']));
        printf('%s;', nbm($a_stock[$s]['qout']));
        printf('%s', nbm(bcsub($a_stock[$s]['qin'], $a_stock[$s]['qout'])));
        printf("\r\n");
    }
}
 function display_html()
 {
     $r = "";
     $array = $this->load();
     $odd = 0;
     if (is_array($array) == false) {
         return $array;
     }
     $old = "";
     $tot_deb = 0;
     $tot_cred = 0;
     foreach ($array as $row) {
         $odd++;
         $r .= $odd % 2 == 0 ? '<tr class="odd">' : '<tr class="even">';
         if ($old == $row['a_po_name']) {
             $r .= '<td></td>';
         } else {
             if ($tot_deb != 0 || $tot_cred != 0) {
                 $r .= "<tr>" . td('');
                 $r .= "<td>Total </td>" . td(nbm($tot_deb), ' class="num"') . td(nbm($tot_cred), ' class="num"');
                 $s = abs($tot_deb - $tot_cred);
                 $d = $tot_deb > $tot_cred ? 'debit' : 'credit';
                 $r .= "<td class=\"num\">" . nbm($s) . "</td><td>{$d}</td>";
                 $r .= "</tr>";
             }
             $tot_deb = 0;
             $tot_cred = 0;
             // new
             $r .= "</table>";
             $r .= "<table class=\"result\" style=\"margin-bottom:3px\">";
             $r .= "<tr>";
             $r .= "<th style=\"width:30%\" >Poste comptable Analytique</th>";
             $r .= "<th style=\"width:30%\">Poste comptable Analytique</th>";
             $r .= "<th style=\"text-align:right\">D&eacute;bit</th>";
             $r .= "<th style=\"text-align:right\">Cr&eacute;dit</th>";
             $r .= "<th style=\"text-align:right\">Solde</th>";
             $r .= "<th>D/C</th>";
             $r .= "</tr>";
             $r .= '<tr>';
             $r .= td($row['a_po_name'] . ' ' . $row['a_po_description']);
             $old = $row['a_po_name'];
             $r .= '</tr>';
             $r .= '<tr>';
             $r .= td('');
         }
         $tot_deb += $row['a_d'];
         $tot_cred += $row['a_c'];
         $r .= td($row['b_po_name'] . " " . $row['b_po_description']);
         $r .= td(nbm($row['a_d']), ' class="num"');
         $r .= td(nbm($row['a_c']), ' class="num"');
         $r .= td(nbm($row['a_solde']), ' class="num"');
         $r .= sprintf("<td>%s</td>", $row['a_debit']);
         $r .= "</tr>";
     }
     /* end loop */
     if ($tot_deb != 0 || $tot_cred != 0) {
         $r .= "<tr>" . td('');
         $r .= "<td>Total </td> <td ' class=\"num\"> " . nbm($tot_deb) . " </td> <td ' class=\"num\">" . nbm($tot_cred) . "</td>";
         $s = abs($tot_deb - $tot_cred);
         $d = $tot_deb > $tot_cred ? 'debit' : 'credit';
         $r .= td(nbm($s), ' class="num"') . "<td>{$d}</td>";
         $r .= "</tr>";
     }
     $r .= "</table>";
     $r .= h2info('Résumé');
     $r .= '<table class="result">';
     $r .= '<tr>';
     $r .= th('Po') . th('Nom') . th('Débit', ' style="text-align:right"') . th('Crédit', 'style="text-align:right" ') . th('Solde', ' style="text-align:right"');
     $sum = $this->show_sum($array);
     $tot_cred = 0;
     $tot_deb = 0;
     foreach ($sum as $row) {
         $r .= '<tr>';
         $r .= '<td>' . $row['poste'] . '</td>';
         $r .= '<td>' . $row['desc'] . '</td>';
         $r .= '<td class="num">' . nbm($row['debit']) . '</td>';
         $r .= '<td class="num">' . nbm($row['credit']) . '</td>';
         $diff = bcsub($row['debit'], $row['credit']);
         $tot_cred = bcadd($tot_cred, $row['credit']);
         $tot_deb = bcadd($tot_deb, $row['debit']);
         $r .= td(nbm($diff), ' class="num" ');
         $r .= '<td>' . $row['dc'] . '</td>';
         $r .= '</tr>';
     }
     $r .= td('');
     $r .= td('total');
     $r .= td(nbm($tot_deb), 'class="num"');
     $r .= td(nbm($tot_cred), 'class="num"');
     $solde = bcsub($tot_deb, $tot_cred);
     $sign = $tot_cred < $tot_deb ? " - " : " + ";
     $r .= td($sign . nbm($solde), 'class="num" style="border:solid 1px blue;font-weight:bold"');
     $r .= '</tr>';
     $r .= '</table>';
     return $r;
 }
            $str_anc .= td(nbm($htva));
            $str_anc .= $anc_op->display_table(1, $htva, $div);
        } else {
            $row .= td('');
        }
    }
    $class = $e % 2 == 0 ? ' class="even"' : 'class="odd"';
    echo tr($row, $class);
}
if ($owner->MY_TVA_USE == 'Y') {
    $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"');
} else {
    $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"');
}
$row .= td(nbm($total_htva), 'class="num" style="font-style:italic;font-weight: bolder;"');
if ($owner->MY_TVA_USE == 'Y') {
    $row .= td("") . td("") . td(nbm($total_tvac), 'class="num" style="font-style:italic;font-weight: bolder;"');
}
echo tr($row);
?>
            </table>


        </div>


<?php 
require_once NOALYSS_INCLUDE . '/template/ledger_detail_bottom.php';
?>
</div>
Example #6
0
 echo $r;
 // show all dossiers
 if ($Res != null) {
     foreach ($Res as $Dossier) {
         if ($compteur % 2 == 0) {
             $cl = 'class="odd"';
         } else {
             $cl = 'class="even"';
         }
         echo "<TR id=\"folder{$Dossier['dos_id']}\" {$cl}><TD style=\"vertical-align:top\"> " . $Dossier['dos_id'] . "</td><td> <B>" . h($Dossier['dos_name']) . "</B> </TD>";
         $str_name = domaine . 'dossier' . $Dossier['dos_id'];
         echo "<TD><I>  " . h($Dossier['dos_description']) . "</I></td>";
         $database_exist = $repocn->exist_database($str_name);
         if ($database_exist > 0) {
             $size = $repocn->get_value("select pg_database_size(\$1)/(1024*1024)::float", array($str_name));
             echo td(nbm($size) . "MB", ' style="text-align:right"');
         } else {
             echo td(_("Dossier inexistant"), 'style="color:red"');
         }
         echo td($str_name);
         if ($database_exist > 0) {
             echo td(HtmlInput::anchor(_('Effacer'), '?action=dossier_mgt&sa=del&d=' . $Dossier['dos_id'], " onclick=\"folder_drop('" . $Dossier['dos_id'] . "')\""));
             echo td(HtmlInput::anchor(_('Modifier'), '?action=dossier_mgt&sa=mod&d=' . $Dossier['dos_id'], " onclick=\"folder_modify('" . $Dossier['dos_id'] . "')\""));
             echo td(HtmlInput::anchor(_('Backup'), 'backup.php?action=backup&sa=b&t=d&d=' . $Dossier['dos_id']));
         } else {
             echo td(HtmlInput::anchor(_('Effacer'), '?action=dossier_mgt&sa=del&d=' . $Dossier['dos_id'], " onclick=\"folder_drop('" . $Dossier['dos_id'] . "')\""));
         }
         $compteur++;
     }
     echo "</TR>";
 }
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
/* $Revision$ */
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/**
 * @file
 * @brief show detail of a operation of fin
 *
 */
echo '<table class="result">';
echo '<tr>';
echo th(_('Compte en banque'));
echo th(_('Tiers'));
echo th(_('Libellé'));
echo th(_('Montant'));
echo '</tr>';
echo '<tr>';
$bk = new Fiche($cn, $obj->det->array[0]['qf_bank']);
$view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" ');
echo td($view_card_detail);
$other = new Fiche($cn, $obj->det->array[0]['qf_other']);
$view_card_detail = HtmlInput::card_detail($other->get_quick_code(), h($other->getName()), ' class="line" ');
echo td($view_card_detail);
$comment = strip_tags($obj->det->jr_comment);
echo td($comment);
echo td(nbm($obj->det->array[0]['qf_amount']), ' class="inum"');
echo '</tr>';
echo '</table>';
?>

                    // get sum for this lettering
                    $pdf->Cell($tab[7], 4, sprintf('%s', nbm($row['letter_diff'])), '0', '0', $align[7], $fill);
                } else {
                    $pdf->Cell($tab[6], 4, "", 0, 0, 'R', $fill);
                }
                $pdf->Ln();
            }
            $pdf->SetFillColor(0, 0, 0);
            $pdf->SetFont('DejaVuCond', 'B', 8);
            $debit = sprintf('Debit  : %s', nbm($amount_deb));
            $credit = sprintf('Credit : %s', nbm($amount_cred));
            if ($amount_deb > $amount_cred) {
                $s = 'solde débiteur';
            } else {
                $s = 'solde crediteur';
            }
            $solde = sprintf('%s  : %s', $s, nbm(abs(round($amount_cred - $amount_deb, 2))));
            $pdf->Cell(0, 6, $debit, 0, 0, 'R');
            $pdf->ln(4);
            $pdf->Cell(0, 6, $credit, 0, 0, 'R');
            $pdf->ln(4);
            $pdf->Cell(0, 6, $solde, 0, 0, 'R');
            $pdf->ln(4);
            $pdf->Ln();
        }
    }
}
//Save PDF to file
$fDate = date('dmy-Hi');
$pdf->Output("category-{$fDate}.pdf", 'D');
exit;
         $name = $cn->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1', array($q[$e]['j_poste']));
         $l_lib = $name;
     }
 }
 $l_lib = strip_tags($l_lib);
 if ($owner->MY_UPDLAB == 'Y') {
     $hidden = HtmlInput::hidden("j_id[]", $q[$e]['j_id']);
     $input = new IText("e_march" . $q[$e]['j_id'] . "_label", $l_lib);
     $input->css_size = "100%";
 } else {
     $input = new ISpan("e_march" . $q[$e]['j_id'] . "_label");
     $input->value = $l_lib;
     $hidden = HtmlInput::hidden("j_id[]", $q[$e]['j_id']);
 }
 $row .= td($input->input() . $hidden);
 $montant = td(nbm($q[$e]['j_montant']), 'class="num"');
 $row .= $q[$e]['j_debit'] == 't' ? $montant : td('');
 $row .= $q[$e]['j_debit'] == 'f' ? $montant : td('');
 /* Analytic accountancy */
 if ($owner->MY_ANALYTIC != "nu") {
     if (preg_match('/^(6|7)/', $q[$e]['j_poste'])) {
         echo HtmlInput::hidden("amount_t" . $amount_idx, $q[$e]['j_montant']);
         $anc_op = new Anc_Operation($cn);
         $anc_op->j_id = $q[$e]['j_id'];
         $anc_op->in_div = $div;
         $str_anc .= '<tr>';
         $str_anc .= HtmlInput::hidden('op[]', $anc_op->j_id);
         $str_anc .= td($q[$e]['j_qcode']);
         $str_anc .= td($q[$e]['j_poste']);
         $str_anc .= td($q[$e]['j_montant']);
         $str_anc .= $anc_op->display_table(1, $q[$e]['j_montant'], $div);
Example #10
0
    }
    ?>
		</td>
		<td>
			<?php 
    echo $row['ccomment'];
    ?>
		</td>
		<td class="num">
			<?php 
    echo nbm($row['j_montant']);
    ?>
		</td>
		<td class="num">
			<?php 
    echo nbm($row['sg_quantity']);
    ?>
		</td>
		<td>
			<?php 
    echo $row['direction'];
    ?>
		</td>
	</tr>
	<?php 
}
?>
</table>
	<?php 
echo $nav_bar;
?>
Example #11
0
        $pdf->Cell($width[$i], 6, $detail['cred_montant'] > 0 ? nbm($detail['cred_montant']) : '', 0, 0, $lor[$i]);
        $i++;
        $pdf->Cell($width[$i], 6, nbm(abs($solde)) . $side, 0, 0, $lor[$i]);
        $i++;
        $pdf->Ln();
    }
    $pdf->SetFont('DejaVuCond', 'B', 8);
    $i = 0;
    $pdf->Cell($width[$i], 6, $current_exercice, 0, 0, $lor[$i]);
    $i++;
    $pdf->Cell($width[$i], 6, '', 0, 0, $lor[$i]);
    $i++;
    $pdf->Cell($width[$i], 6, '', 0, 0, $lor[$i]);
    $i++;
    $pdf->Cell($width[$i], 6, '', 0, 0, $lor[$i]);
    $i++;
    $pdf->Cell($width[$i], 6, 'Total du compte ' . $Poste->id, 0, 0, 'R');
    $i++;
    $pdf->Cell($width[$i], 6, $solde_d > 0 ? nbm($solde_d) : '', 0, 0, $lor[$i]);
    $i++;
    $pdf->Cell($width[$i], 6, $solde_c > 0 ? nbm($solde_c) : '', 0, 0, $lor[$i]);
    $i++;
    $pdf->Cell($width[$i], 6, nbm(abs($solde_c - $solde_d)), 0, 0, $lor[$i]);
    $i++;
    $pdf->Cell(5, 6, $solde_c > $solde_d ? 'C' : 'D', 0, 0, 'L');
    $pdf->Ln();
    $pdf->Ln();
}
//Save PDF to file
$pdf->Output("gl_comptes.pdf", 'D');
exit;
Example #12
0
        }
        foreach ($a_sum as $a) {
            $lvl1[$a] = bcadd($lvl1[$a], $r[$a]);
            $lvl2[$a] = bcadd($lvl2[$a], $r[$a]);
            $lvl3[$a] = bcadd($lvl3[$a], $r[$a]);
        }
        echo '<TR class="' . $tr . '">';
        echo td($view_history);
        echo td(h($r['label']));
        if ($previous == 1) {
            echo td(nbm($r['sum_deb_previous']), ' class="previous_year"');
            echo td(nbm($r['sum_cred_previous']), ' class="previous_year" ');
            echo td(nbm($r['solde_deb_previous']), ' class="previous_year"');
            echo td(nbm($r['solde_cred_previous']), 'class="previous_year" ');
            if (isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) {
                echo '<td></td>';
            }
        }
        echo td(nbm($r['sum_deb']), 'style="text-align:right;"');
        echo td(nbm($r['sum_cred']), 'style="text-align:right;"');
        echo td(nbm($r['solde_deb']), 'style="text-align:right;"');
        echo td(nbm($r['solde_cred']), 'style="text-align:right;"');
        if (isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) {
            echo '<td></td>';
        }
        echo '</TR>';
    }
    echo '</table>';
}
// end submit
echo "</div>";
Example #13
0
    $row = '';
    $q = $detail->det->array;
    $fiche = new Fiche($cn);
    $fiche->get_by_qcode($q[$e]['j_qcode']);
    /* Analytic accountancy */
    if ($owner->MY_ANALYTIC != "nu") {
        $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
        if (preg_match('/^(6|7)/', $q[$e]['j_poste'])) {
            $qcode = $fiche->strAttribut(ATTR_DEF_QUICKCODE);
            $anc_op = new Anc_Operation($cn);
            $anc_op->j_id = $q[$e]['j_id'];
            $anc_op->in_div = $div;
            $str_anc .= '<tr>';
            $str_anc .= td($poste);
            $str_anc .= td($qcode);
            $str_anc .= td(nbm($q[$e]['j_montant']));
            $str_anc .= '<td>';
            $str_anc .= HtmlInput::hidden('op[]', $anc_op->j_id);
            $montant = $q[$e]['j_debit'] == "t" ? $q[$e]['j_montant'] : bcmul($q[$e]['j_montant'], -1);
            $str_anc .= $anc_op->display_table(1, $montant, $div);
            $str_anc .= '</td>';
            $str_anc .= '</tr>';
        }
    }
}
?>
</div>
<?php 
require_once NOALYSS_INCLUDE . '/template/ledger_detail_bottom.php';
?>
</div>
Example #14
0
 /**
  * @brief show the result of the array to confirm
  * before inserting
  * @param$p_array array from the form
  * \return string
  */
 function confirm($p_array, $p_readonly = false)
 {
     global $g_parameter;
     $msg = array();
     if (!$p_readonly) {
         $msg = $this->verify($p_array);
     }
     $this->id = $p_array['p_jrn'];
     if (empty($p_array)) {
         return 'Aucun r&eacute;sultat';
     }
     $anc = null;
     extract($p_array);
     $lPeriode = new Periode($this->db);
     if ($this->check_periode() == true) {
         $lPeriode->p_id = $period;
     } else {
         $lPeriode->find_periode($e_date);
     }
     $total_deb = 0;
     $total_cred = 0;
     bcscale(2);
     $ret = "";
     if (!empty($msg)) {
         $ret .= $this->display_warning($msg, _("Attention : il vaut mieux utiliser les fiches que les postes comptables"));
     }
     $ret .= "<table >";
     $ret .= "<tr><td>" . _('Date') . " : </td><td>{$e_date}</td></tr>";
     /* display periode */
     $date_limit = $lPeriode->get_date_limit();
     $ret .= '<tr> ' . td(_('Période Comptable')) . td($date_limit['p_start'] . '-' . $date_limit['p_end']) . '</tr>';
     $ret .= "<tr><td>" . _('Libellé') . " </td><td>" . h($desc) . "</td></tr>";
     $ret .= "<tr><td>" . _('PJ Num') . " </td><td>" . h($e_pj) . "</td></tr>";
     $ret .= '</table>';
     $ret .= "<table class=\"result\">";
     $ret .= "<tr>";
     $ret .= "<th>" . _('Quick Code ou ');
     $ret .= _("Poste") . " </th>";
     $ret .= "<th style=\"text-align:left\"> " . _("Libellé") . " </th>";
     $ret .= "<th style=\"text-align:right\">" . _("Débit") . "</th>";
     $ret .= "<th style=\"text-align:right\">" . _("Crédit") . "</th>";
     /* if we use the AC */
     if ($g_parameter->MY_ANALYTIC != 'nu') {
         $anc = new Anc_Plan($this->db);
         $a_anc = $anc->get_list();
         $x = count($a_anc);
         /* set the width of the col */
         $ret .= '<th colspan="' . $x . '" style="width:auto;text-align:center" >' . _('Compt. Analytique') . '</th>';
         /* add hidden variables pa[] to hold the value of pa_id */
         $ret .= Anc_Plan::hidden($a_anc);
     }
     $ret .= "</tr>";
     $ret .= HtmlInput::hidden('e_date', $e_date);
     $ret .= HtmlInput::hidden('desc', $desc);
     $ret .= HtmlInput::hidden('period', $lPeriode->p_id);
     $ret .= HtmlInput::hidden('e_pj', $e_pj);
     $ret .= HtmlInput::hidden('e_pj_suggest', $e_pj_suggest);
     $mt = microtime(true);
     $ret .= HtmlInput::hidden('mt', $mt);
     // For predefined operation
     $ret .= HtmlInput::hidden('e_comm', $desc);
     $ret .= HtmlInput::hidden('jrn_type', $this->get_type());
     $ret .= HtmlInput::hidden('p_jrn', $this->id);
     $ret .= HtmlInput::hidden('nb_item', $nb_item);
     if ($this->with_concerned == true) {
         $ret .= HtmlInput::hidden('jrn_concerned', $jrn_concerned);
     }
     $ret .= dossier::hidden();
     $count = 0;
     for ($i = 0; $i < $nb_item; $i++) {
         if ($p_readonly == true) {
             if (!isset(${'qc_' . $i})) {
                 ${'qc_' . $i} = '';
             }
             if (!isset(${'poste' . $i})) {
                 ${'poste' . $i} = '';
             }
             if (!isset(${'amount' . $i})) {
                 ${'amount' . $i} = '';
             }
         }
         $class = $i % 2 == 0 ? ' class="even" ' : ' class="odd" ';
         $ret .= "<tr {$class}> ";
         if (trim(${'qc_' . $i}) != "") {
             $oqc = new Fiche($this->db);
             $oqc->get_by_qcode(${'qc_' . $i}, false);
             $strPoste = $oqc->strAttribut(ATTR_DEF_ACCOUNT);
             $ret .= "<td>" . ${'qc_' . $i} . ' - ' . $oqc->strAttribut(ATTR_DEF_NAME) . HtmlInput::hidden('qc_' . $i, ${'qc_' . $i}) . '</td>';
         }
         if (trim(${'qc_' . $i}) == "" && trim(${'poste' . $i}) != "") {
             $oposte = new Acc_Account_Ledger($this->db, ${'poste' . $i});
             $strPoste = $oposte->id;
             $ret .= "<td>" . h(${"poste" . $i} . " - " . $oposte->get_name()) . HtmlInput::hidden('poste' . $i, ${'poste' . $i}) . '</td>';
         }
         if (trim(${'qc_' . $i}) == "" && trim(${'poste' . $i}) == "") {
             continue;
         }
         $ret .= "<td>" . h(${"ld" . $i}) . HtmlInput::hidden('ld' . $i, ${'ld' . $i});
         $ret .= isset(${"ck{$i}"}) ? HtmlInput::hidden('ck' . $i, ${'ck' . $i}) : "";
         $ret .= "</td>";
         if (isset(${"ck{$i}"})) {
             $ret .= "<td class=\"num\">" . nbm(${"amount" . $i}) . HtmlInput::hidden('amount' . $i, ${'amount' . $i}) . "</td>" . td("");
             $total_deb = bcadd($total_deb, ${'amount' . $i});
         } else {
             $ret .= td("") . "<td class=\"num\">" . nbm(${"amount" . $i}) . HtmlInput::hidden('amount' . $i, ${'amount' . $i}) . "</td>";
             $total_cred = bcadd($total_cred, ${"amount" . $i});
         }
         /*$ret.="<td>";
         		$ret.=(isset(${"ck$i"})) ? HtmlInput::hidden('ck' . $i, ${'ck' . $i}) : "";
         		$ret.="</td>";*/
         // CA
         if ($g_parameter->MY_ANALYTIC != 'nu') {
             if (preg_match("/^[6,7]+/", $strPoste) == 1) {
                 // show form
                 $op = new Anc_Operation($this->db);
                 $null = $g_parameter->MY_ANALYTIC == 'op' ? 1 : 0;
                 $p_array['pa_id'] = $a_anc;
                 /* op is the operation it contains either a sequence or a jrnx.j_id */
                 $ret .= HtmlInput::hidden('op[]=', $i);
                 $ret .= '<td style="text-align:center">';
                 $read = $p_readonly == true ? 0 : 1;
                 $ret .= $op->display_form_plan($p_array, $null, $read, $count, round(${'amount' . $i}, 2));
                 $ret .= '</td>';
                 $count++;
             }
         }
         $ret .= "</tr>";
     }
     $ret .= tr(td('') . td(_('Totaux')) . td($total_deb, 'class="num"') . td($total_cred, 'class="num"'), 'class="highlight"');
     $ret .= "</table>";
     if ($g_parameter->MY_ANALYTIC != 'nu' && $p_readonly == false) {
         $ret .= '<input type="button" class="button" value="' . _('verifie Imputation Analytique') . '" onClick="verify_ca(\'\');">';
     }
     return $ret;
 }
    <td class="num">
        <?php 
echo nbm($tot_cum_price);
?>
    </td>
    <td class="num">
        <?php 
echo nbm($tot_cum_nd);
?>
    </td>
    <td>
        
    </td>
    <td class="num">
        <?php 
echo nbm($tot_cum_vat);
?>
    </td>
    <td class="num">
        <?php 
echo nbm($tot_cum_nd_tva);
?>
    </td>
    <td class="num">
        <?php 
echo nbm($tot_cum_tvac);
?>
    </td>
    </tfoot>
</table>        
    echo $onclick;
    ?>
" >
                <?php 
    echo $a_key[$i]['kd_name'];
    ?>
                </a>
            </td>
            <td>
                <?php 
    echo $a_key[$i]['kd_description'];
    ?>
            </td>
            <?php 
    $sign = $a_key[$i]['distrib'] == 100 ? $g_succeed : $g_failed;
    ?>
            <td>
                <?php 
    echo nbm($a_key[$i]['distrib']);
    ?>
%
                <?php 
    echo $sign;
    ?>
            </td>
        </tr>
    <?php 
}
?>
</table>
</div>
        if (count($a_card) == 0) {
            echo '<span class="notice">' . _("Changement manuel") . '</span>';
        }
        ?>
		</td>
		<td class="num">
			<?php 
        echo nbm($a_stock[$s]['qin']);
        ?>
		</td>
		<td class="num">
			<?php 
        echo nbm($a_stock[$s]['qout']);
        ?>

		</td>
		<td class="num">
			<?php 
        echo nbm(bcsub($a_stock[$s]['qin'], $a_stock[$s]['qout']));
        ?>
		</td>
	</tr>
<?php 
    }
    ?>
</table>
<?php 
}
?>

</div>
 function display_pdf()
 {
     $array = $this->load();
     $pdf = new PDFBalance_Simple($this->db);
     $pdf->set_info($this->from_poste, $this->to_poste, $this->from, $this->to);
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->setTitle("Balance analytique", true);
     $pdf->SetFont('DejaVu', '', 6);
     for ($i = 0; $i < count($array); $i++) {
         $row = $array[$i];
         $pdf->Cell(20, 6, $row['po_id'], 0, 0, 'L');
         $pdf->Cell(90, 6, $row['po_name'], 0, 0, 'L');
         $pdf->Cell(20, 6, sprintf('%s', nbm($row['sum_deb'])), 0, 0, 'R');
         $pdf->Cell(20, 6, sprintf('%s', nbm($row['sum_cred'])), 0, 0, 'R');
         $pdf->Cell(20, 6, sprintf('%s', nbm($row['solde'])), 0, 0, 'R');
         $pdf->Cell(20, 6, $row['debit'], 0, 0, 'R');
         $pdf->Ln();
     }
     $fDate = date('dmy-Hi');
     $pdf->output('simple-balance-' . $fDate . '.pdf', 'D');
 }
Example #19
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 
}
 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;
 }
         <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>
     <td align="right">' . '<b>' . nbm(abs($solde_c - $solde_d)) . '</b>' . '</td>
     <td>';
     if ($solde_c > $solde_d) {
         echo "Crédit";
     }
     if ($solde_c < $solde_d) {
         echo "Débit";
     }
     if ($solde_c == $solde_d) {
         echo "=";
     }
     echo '</td>' . '</tr>';
 }
 echo '</table>';
 echo Acc_Account_Ledger::HtmlTableHeader("gl_comptes");
 echo "</div>";
        $a = $line_tva['tva_id'];
        if (isset($tot['tva'][$a])) {
            ?>
                        <td class="num"><?php 
            echo nbm($tot['tva'][$a]);
            ?>
</td>
                    <?php 
        } else {
            ?>
                        <td>

                        </td>
                    <?php 
        }
        ?>
                <?php 
    }
    ?>
        <?php 
}
?>
        <td class="num"><?php 
echo nbm($tot['tvac']);
?>
</td>
        <td></td>
    </tr>
        
        
</table>
Example #23
0
        echo '</tr>';
        echo '<tr>';
        echo td(_('Credit'));
        echo td(nbm($amount_cred), ' style="font-weight:bold;text-align:right"');
        echo '</tr>';
        echo '<tr class="highlight">';
        $solde = abs(round($amount_cred - $amount_deb, 2));
        if ($solde == 0) {
            $s = 'solde';
        } else {
            if ($amount_deb > $amount_cred) {
                $s = 'solde débiteur';
            } else {
                $s = 'solde crediteur';
            }
        }
        echo td($s);
        echo td(nbm($solde), ' style="font-weight:bold;text-align:right"');
        echo '</tr>';
        echo '</table>';
    }
}
if ($allcard == 0) {
    echo $str_add_card;
}
echo $export_csv;
echo $export_pdf;
echo $export_print;
?>

$bk_card = new Fiche($cn);
$bk_card->id = $Ledger->get_bank();
$filter_year = "  j_tech_per in (select p_id from parm_periode where  p_exercice='" . $g_user->get_exercice() . "')";
/*  get saldo for not reconcilied operations  */
$saldo_not_reconcilied = $bk_card->get_solde_detail($filter_year . " and j_grpt in (select jr_grpt_id from jrn where trim(jr_pj_number) ='' or jr_pj_number is null)");
/*  get saldo for reconcilied operation  */
$saldo_reconcilied = $bk_card->get_solde_detail($filter_year . " and j_grpt in (select jr_grpt_id from jrn where trim(jr_pj_number) != '' and jr_pj_number is not null)");
/* solde compte */
$saldo = $bk_card->get_solde_detail($filter_year);
echo '<table>';
echo '<tr>';
echo td("Solde compte  ");
echo td(nbm(bcsub($saldo['debit'], $saldo['credit'])), ' style="text-align:right"');
echo '</tr>';
echo '<tr>';
echo td("Solde non rapproché ");
echo td(nbm(bcsub($saldo_not_reconcilied['debit'], $saldo_not_reconcilied['credit'])), ' style="text-align:right"');
echo '</tr>';
echo '<tr>';
echo td("Solde  rapproché ");
echo td(nbm(bcsub($saldo_reconcilied['debit'], $saldo_reconcilied['credit'])), ' style="text-align:right"');
echo '</tr>';
echo '<tr>';
echo td("Total montant ");
echo td(nbm($tot_not_reconcilied), ' style="text-align:right"');
echo '</tr>';
echo '</table>';
echo HtmlInput::submit('save', 'Mettre à jour le n° de relevé bancaire');
echo '</form>';
echo '</div>';
return;
Example #25
0
    ?>
            
        </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>
<div id="last_operation_management_div" class="box">
    <?php 
echo HtmlInput::title_box(_('Suivi'), "last_operation_management_div", 'zoom', 'onclick="action_show(' . dossier::id() . ')"');
?>
    <?php 
 function display_html()
 {
     bcscale(2);
     if ($this->check() != 0) {
         alert('Désolé mais une des dates données n\'est pas valide');
         return;
     }
     //---------------------------------------------------------------------------
     // Card  - Acc
     //---------------------------------------------------------------------------
     if ($this->card_poste == '1') {
         $this->load_card();
         /*
          * Show all the result
          */
         $tot_card = 0;
         $prev = '';
         echo '<table class="result" style="margin-left:5px;margin-top:5px">';
         $tot_glob = 0;
         for ($i = 0; $i < count($this->arow); $i++) {
             if ($i == 0) {
                 $prev = $this->arow[$i]['f_id'];
                 echo '<tr><td>' . HtmlInput::history_card($this->arow[$i]['f_id'], $this->arow[$i]['j_qcode'] . ' ' . $this->arow[$i]['name'], ' display:inline') . '</td></tr>';
             }
             $style = $i % 2 == 0 ? ' class="odd" ' : ' class="even" ';
             if ($i != 0 && $prev != $this->arow[$i]['f_id']) {
                 echo td('Total');
                 echo td(nbm($tot_card), ' class="num"');
                 echo '</tr>';
                 echo '<tr  style="padding-top:5px"><td>' . HtmlInput::history_card($this->arow[$i]['f_id'], $this->arow[$i]['j_qcode'] . ' ' . $this->arow[$i]['name'], ' display:inline ') . '</td></tr>';
                 $tot_card = 0;
                 $prev = $this->arow[$i]['f_id'];
             }
             echo '<tr ' . $style . '>';
             $amount = $this->arow[$i]['sum_amount'];
             if ($amount == null) {
                 $amount = 0;
             }
             $tot_card = bcadd($tot_card, $amount);
             $tot_glob = bcadd($tot_glob, $amount);
             echo td($this->arow[$i]['po_name'] . "   " . $this->arow[$i]['po_description'], 'style="padding-left:10"');
             echo td(nbm($amount), ' class="num" ');
             echo '</tr>';
         }
         echo '<tr>';
         echo td('Total');
         echo td(nbm($tot_card), ' class="num"');
         echo '</tr>';
         echo '</table>';
         echo '<h2> Résultat global ' . nbm($tot_glob) . '</h2>';
     }
     //---------------------------------------------------------------------------
     // Accountancy - Analytic
     //---------------------------------------------------------------------------
     if ($this->card_poste == '2') {
         $this->load_poste();
         /*
          * Show all the result
          */
         $tot_card = 0;
         $prev = '';
         echo '<table class="result" style="margin-left:20px;margin-top:5px">';
         $tot_glob = 0;
         for ($i = 0; $i < count($this->arow); $i++) {
             if ($i == 0) {
                 $prev = $this->arow[$i]['j_poste'];
                 echo '<tr><td>' . HtmlInput::history_account($this->arow[$i]['j_poste'], $this->arow[$i]['j_poste'] . ' ' . $this->arow[$i]['name'], ' display:inline') . '</td></tr>';
             }
             $style = $i % 2 == 0 ? ' class="odd" ' : ' class="even" ';
             if ($i != 0 && $prev != $this->arow[$i]['j_poste']) {
                 echo td('Total');
                 echo td(nbm($tot_card), ' class="num"');
                 echo '</tr>';
                 echo '<tr  style="padding-top:5px"><td>' . HtmlInput::history_account($this->arow[$i]['j_poste'], $this->arow[$i]['j_poste'] . ' ' . $this->arow[$i]['name'], ' display:inline ') . '</td></tr>';
                 $tot_card = 0;
                 $prev = $this->arow[$i]['j_poste'];
             }
             echo '<tr ' . $style . '>';
             $amount = $this->arow[$i]['sum_amount'];
             if ($amount == null) {
                 $amount = 0;
             }
             $tot_card = bcadd($tot_card, $amount);
             $tot_glob = bcadd($tot_glob, $amount);
             echo td($this->arow[$i]['po_name'] . "   " . $this->arow[$i]['po_description'], 'style="padding-left:10"');
             echo td(nbm($amount), ' class="num" ');
             echo '</tr>';
         }
         echo '<tr>';
         echo td('Total');
         echo td(nbm($tot_card), ' class="num"');
         echo '</tr>';
         echo '</table>';
         echo td(nbm($tot_card), ' class="num"');
     }
     //---------------------------------------------------------------------------
     // Acc after card
     //---------------------------------------------------------------------------
     if ($this->card_poste == '3') {
         $this->load_anc_card();
         /*
          * Show all the result
          */
         $tot_card = 0;
         $prev = '';
         echo '<table class="result" style="margin-left:20px;margin-top:5px">';
         $tot_glob = 0;
         for ($i = 0; $i < count($this->arow); $i++) {
             if ($i == 0) {
                 $prev = $this->arow[$i]['po_id'];
                 echo '<tr><td>' . $this->arow[$i]['po_name'] . "  " . $this->arow[$i]['po_description'] . '</td></tr>';
             }
             $style = $i % 2 == 0 ? ' class="odd" ' : ' class="even" ';
             if ($i != 0 && $prev != $this->arow[$i]['po_id']) {
                 echo td('Total');
                 echo td(nbm($tot_card), ' class="num"');
                 echo '</tr>';
                 echo '<tr><td>' . $this->arow[$i]['po_name'] . "  " . $this->arow[$i]['po_description'] . '</td></tr>';
                 $tot_card = 0;
                 $prev = $this->arow[$i]['po_id'];
             }
             echo '<tr ' . $style . '>';
             $amount = $this->arow[$i]['sum_amount'];
             if ($amount == null) {
                 $amount = 0;
             }
             $tot_card = bcadd($tot_card, $amount);
             $tot_glob = bcadd($tot_glob, $amount);
             echo '<td style="padding-left:10">' . HtmlInput::history_card($this->arow[$i]['f_id'], $this->arow[$i]['j_qcode'] . ' ' . $this->arow[$i]['name'], ' display:inline') . '</td>';
             echo td(nbm($amount), ' class="num" ');
             echo '</tr>';
         }
         echo '<tr>';
         echo td('Total');
         echo td(nbm($tot_card), ' class="num"');
         echo '</tr>';
         echo '</table>';
         echo td(nbm($tot_card), ' class="num"');
     }
     //---------------------------------------------------------------------------
     // Analytic - Accountancy
     //---------------------------------------------------------------------------
     if ($this->card_poste == '4') {
         $this->load_anc_account();
         /*
          * Show all the result
          */
         $tot_card = 0;
         $prev = '';
         echo '<table class="result" style="margin-left:20px;margin-top:5px">';
         $tot_glob = 0;
         for ($i = 0; $i < count($this->arow); $i++) {
             if ($i == 0) {
                 $prev = $this->arow[$i]['po_id'];
                 echo '<tr><td>' . $this->arow[$i]['po_name'] . "  " . $this->arow[$i]['po_description'] . '</td></tr>';
             }
             $style = $i % 2 == 0 ? ' class="odd" ' : ' class="even" ';
             if ($i != 0 && $prev != $this->arow[$i]['po_id']) {
                 echo td('Total');
                 echo td(nbm($tot_card), ' class="num"');
                 echo '</tr>';
                 $tot_card = 0;
                 $prev = $this->arow[$i]['po_id'];
                 echo '<tr><td>' . $this->arow[$i]['po_name'] . "  " . $this->arow[$i]['po_description'] . '</td></tr>';
             }
             echo '<tr ' . $style . '>';
             $amount = $this->arow[$i]['sum_amount'];
             if ($amount == null) {
                 $amount = 0;
             }
             $tot_card = bcadd($tot_card, $amount);
             $tot_glob = bcadd($tot_glob, $amount);
             echo '<td style="padding-left:10">' . HtmlInput::history_account($this->arow[$i]['j_poste'], $this->arow[$i]['j_poste'] . ' ' . $this->arow[$i]['name'], ' display:inline') . '</td>';
             echo td(nbm($amount), ' class="num" ');
             echo '</tr>';
         }
         echo '<tr>';
         echo td('Total');
         echo td(nbm($tot_card), ' class="num"');
         echo '</tr>';
         echo '</table>';
         echo '<h2> Résultat global ' . nbm($tot_glob) . '</h2>';
     }
 }
 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;
 }
Example #28
0
    } else {
        $result = $g_failed;
    }
    $class = $ix % 2 == 0 ? 'odd' : "even";
    print tr(td($name) . td(nbm($deb), 'class="num"') . td(nbm($cred), 'class="num"') . td(nbm($result), 'class="num"') . td($result), "class=\"{$class}\"");
    $ix++;
}
$deb = $cn->get_value("select sum (j_montant) from jrnx where j_debit='t' {$sql_year} ");
$cred = $cn->get_value("select sum (j_montant) from jrnx where j_debit='f' {$sql_year} ");
if ($cred == $deb) {
    $result = $g_succeed;
} else {
    $result = $g_failed;
}
$class = $ix % 2 == 0 ? 'odd' : "even";
print tr(td(_('Grand livre')) . td(nbm($deb), ' class="num"') . td(nbm($cred), ' class="num"') . td(nbm($result), ' class="num"') . td($result), "class=\"{$class}\"");
echo '</table>';
echo '</div>';
echo '<hr>';
echo '<div class="myfieldset"><h1 class="legend">' . _('Vérification des comptes') . '</h1>';
$bilan = new Acc_Bilan($cn);
$periode = new Periode($cn);
list($start_periode, $end_periode) = $periode->get_limit($exercice);
$bilan->from = $start_periode->p_id;
$bilan->to = $end_periode->p_id;
$bilan->verify();
echo '</div>';
?>
<hr>
<div class="myfieldset">
    <h1 class="legend">
        $internal = $opRap->get_internal();
        $array_jr = $cn->get_array('select jr_date,jr_montant,jr_comment from jrn where jr_id=$1', array($aRap[$e]));
        $amount = $array_jr[0]['jr_montant'];
        $str = "modifyOperation(" . $aRap[$e] . "," . $gDossier . ")";
        $rmReconciliation = new IButton('rmr');
        $rmReconciliation->label = SMALLX;
        $rmReconciliation->class = "tinybutton";
        $rmReconciliation->javascript = "return confirm_box(null,'" . _("vous confirmez?") . "',";
        $rmReconciliation->javascript .= sprintf('function () { dropLink(\'%s\',\'%s\',\'%s\',\'%s\');deleteRowRec(\'%s\',$(\'row%d\'));})', $gDossier, $div, $jr_id, $aRap[$e], $tableid, $e);
        if ($access == 'W') {
            $remove = $rmReconciliation->input();
        } else {
            $remove = '';
        }
        $comment = strip_tags($array_jr[0]['jr_comment']);
        echo tr(td(format_date($array_jr[0]['jr_date'])) . td('<a class="line" href="javascript:void(0)" onclick="' . $str . '" >' . $internal . '</A>') . td($comment) . td(nbm($amount)) . td($remove), ' id = "row' . $e . '"');
    }
    echo '</table>';
}
if ($access == 'W') {
    $wConcerned = new IConcerned("rapt" . $div);
    $wConcerned->amount_id = $obj->det->jr_montant;
    echo $wConcerned->input();
}
?>
</div>
<div id="linked_action_div<?php 
echo $div;
?>
" style="display:<?php 
echo $a_tab['linked_action_div']['display'];
Example #30
0
<th style="text-align:right" ><?php 
        echo _("Solde");
        ?>
</th>
</tr>
<?php 
    }
    if ($idx % 2 == 0) {
        echo '<tr class="even">';
    } else {
        echo '<tr class="odd">';
    }
    echo td($array[$i]['po_name']);
    echo td(nbm($array[$i]['sum_deb']), ' class="num"');
    echo td(nbm($array[$i]['sum_cred']), ' class="num"');
    $solde = bcsub($array[$i]['sum_cred'], $array[$i]['sum_deb']);
    echo td(nbm($solde), ' class="num"');
    $tot_group_deb = bcadd($tot_group_deb, $array[$i]['sum_deb']);
    $tot_group_cred = bcadd($tot_group_cred, $array[$i]['sum_cred']);
    echo '</tr>';
    $idx++;
}
echo '<tr>';
echo td(_('Solde'));
echo td(nbm($tot_group_deb), ' class="num"');
echo td(nbm($tot_group_cred), ' class="num"');
echo td(nbm(bcsub($tot_group_cred, $tot_group_deb)), ' class="num"');
echo '</tr>';
?>

</table>