Esempio n. 1
0
 /**
  * with the handle of a successull query, echo each row into CSV and
  * send it directly
  * @param type $ret handle to a query
  * @param type $aheader  double array, each item of the array contains
  * a key type (num) and a key title
  */
 function query_to_csv($ret, $aheader)
 {
     $seq = "";
     for ($i = 0; $i < count($aheader); $i++) {
         echo $seq . '"' . $aheader[$i]['title'] . '"';
         $seq = ";";
     }
     printf("\n\r");
     // fetch all the rows
     for ($i = 0; $i < Database::num_row($ret); $i++) {
         $row = Database::fetch_array($ret, $i);
         $sep2 = "";
         // for each rows, for each value
         for ($e = 0; $e < count($row) / 2; $e++) {
             switch ($aheader[$e]['type']) {
                 case 'num':
                     echo $sep2 . nb($row[$e]);
                     break;
                 default:
                     echo $sep2 . '"' . $row[$e] . '"';
             }
             $sep2 = ";";
         }
         printf("\n\r");
     }
 }
Esempio n. 2
0
<h2 class="info2"  style="margin:0 0"> <?php 
echo _("Solde crédit");
?>
 : <?php 
echo nb($amount_cred);
?>
</h2>
  <?php 
bcscale(2);
$solde = bcsub($amount_deb, $amount_cred);
if ($solde > 0) {
    ?>
  <h2 class="info2"  style="margin:0 0"> <?php 
    echo _("Solde débiteur");
    ?>
       : <?php 
    echo nb($solde);
    ?>
</h2>
<?php 
} else {
    ?>
     <h2 class="info2"  style="margin:0 0"> <?php 
    echo _("Solde créditeur");
    ?>
       : <?php 
    echo nb(abs($solde));
    ?>
</h2>
<?php 
}
 function display_csv()
 {
     $array = $this->load();
     if (is_array($array) == false) {
         return $array;
     }
     $r = "";
     foreach ($array as $row) {
         // the name and po_id
         $solde = $row['sum_cred'] > $row['sum_deb'] ? 'C' : 'D';
         $solde = $row['sum_cred'] == $row['sum_deb'] ? '' : $solde;
         $r .= sprintf("'%s';", $row['po_id']);
         $r .= sprintf("'%s';", $row['po_name']);
         $r .= sprintf("%s;", nb($row['sum_deb']));
         $r .= sprintf("%s;", nb($row['sum_cred']));
         $r .= sprintf("%s;", nb($row['solde']));
         $r .= sprintf("'%s'", $row['debit']);
         $r .= "\r\n";
     }
     return $r;
 }
Esempio n. 4
0
 function export_csv()
 {
     bcscale(2);
     if ($this->check() != 0) {
         throw new Exception("DATE INVALIDE");
     }
     if ($this->card_poste == '1') {
         $this->load_card();
         echo '"Fiche"';
         foreach ($this->aheader as $h) {
             echo ';"' . $h['po_name'] . '"';
         }
         echo ';"Total"';
         printf("\r\n");
         /*
          * Show all the result
          */
         for ($i = 0; $i < count($this->arow); $i++) {
             printf('"%s"', $this->arow[$i]['card_account'] . ' ' . $this->arow[$i]['name']);
             $tot_row = 0;
             for ($x = 0; $x < count($this->aheader); $x++) {
                 $amount = $this->db->get_value($this->sql, array($this->arow[$i]['f_id'], $this->aheader[$x]['po_id']));
                 if ($amount == null) {
                     $amount = 0;
                 }
                 if (isset($tot_col[$x])) {
                     $tot_col[$x] = bcadd($tot_col[$x], $amount);
                 } else {
                     $tot_col[$x] = $amount;
                 }
                 printf(";%s", nb($amount));
                 $tot_row = bcadd($tot_row, $amount);
             }
             printf(";%s", nb($tot_row));
             printf("\r\n");
         }
     }
     if ($this->card_poste == '2') {
         $this->load_poste();
         echo '"Poste"';
         foreach ($this->aheader as $h) {
             echo ';"' . $h['po_name'] . '"';
         }
         echo ';"Total"';
         printf("\r\n");
         /*
          * Show all the result
          */
         for ($i = 0; $i < count($this->arow); $i++) {
             printf('"%s"', $this->arow[$i]['card_account'] . ' ' . $this->arow[$i]['name']);
             $tot_row = 0;
             for ($x = 0; $x < count($this->aheader); $x++) {
                 $amount = $this->db->get_value($this->sql, array($this->arow[$i]['card_account'], $this->aheader[$x]['po_id']));
                 if ($amount == null) {
                     $amount = 0;
                 }
                 if (isset($tot_col[$x])) {
                     $tot_col[$x] = bcadd($tot_col[$x], $amount);
                 } else {
                     $tot_col[$x] = $amount;
                 }
                 printf(";%s", nb($amount));
                 $tot_row = bcadd($tot_row, $amount);
             }
             printf(";%s", nb($tot_row));
             printf("\r\n");
         }
     }
 }
        }
        $solde_type = $tot_deb > $tot_cred ? "solde débiteur" : "solde créditeur";
        $diff = abs($tot_deb - $tot_cred);
        printf(";;;" . '"' . _('total') . '";' . '"' . $current_exercice . '";' . '"' . "{$solde_type}" . '"' . ";" . nb($tot_deb) . ";" . nb($tot_cred) . ";" . nb($diff) . ";" . "\n");
    }
} else {
    /* detail of all operation */
    if (count($a_poste) == 0) {
        exit;
    }
    foreach ($a_poste as $pos) {
        $Poste = new Acc_Account_Ledger($cn, $pos['pcm_val']);
        $Poste->get_name();
        list($array, $tot_deb, $tot_cred) = $Poste->get_row_date($_REQUEST['from_periode'], $_REQUEST['to_periode'], $_GET['ople']);
        if (count($Poste->row) == 0) {
            continue;
        }
        echo '"Poste";' . '"Lib.";' . '"QuickCode";' . "\"Code interne\";" . "\"Date\";" . "\"Description\";" . "\"Montant\";" . "\"D/C\"";
        printf("\n");
        foreach ($Poste->row as $a) {
            $op = new Acc_Operation($cn);
            $op->jr_id = $a['jr_id'];
            $result = $op->get_jrnx_detail();
            foreach ($result as $r) {
                printf('"%s";"%s";"%s";"%s";"%s";"%s";"%s";%12.2f;"%s"', $r['j_poste'], $r['pcm_lib'], $r['j_qcode'], $r['jr_internal'], $r['jr_date'], $a['description'], $a['jr_pj_number'], nb($r['j_montant']), $r['debit']);
                printf("\r\n");
            }
        }
    }
    exit;
}
Esempio n. 6
0
    //---
    for ($e = $_GET['from_periode']; $e <= $_GET['to_periode']; $e += $_GET['p_step']) {
        $periode = getPeriodeName($cn, $e);
        if ($periode == null) {
            continue;
        }
        $array[] = $Form->get_row($e, $e, $_GET['type_periode']);
        $periode_name[] = $periode;
    }
    // Display column heading
    //--
    $x = "";
    printf("Mois;");
    foreach ($array[0] as $e) {
        printf("%s%s", $x, $e['desc']);
        $x = ";";
    }
    printf("\n");
    // Display value for each line
    //--
    $a = 0;
    foreach ($array as $e) {
        print $periode_name[$a];
        $a++;
        foreach ($e as $elt) {
            printf(";%s", nb($elt['montant']));
        }
        printf("\n");
    }
}
exit;
Esempio n. 7
0
printf('"%s";', "Paiement");
printf('"%s";', "Piece");
printf('"%s";"";', "Tiers");
printf('"%s";', "Description");
printf('"%s";', "Note");
printf('"%s"', "Montant opération");
printf("\r\n");
for ($i = 0; $i < count($res); $i++) {
    printf('"%s";', $res[$i]['jr_internal']);
    printf('"%s";', $res[$i]['jrn_def_name']);
    printf('"%s";', $res[$i]['str_jr_date']);
    printf('"%s";', $res[$i]['str_jr_ech']);
    printf('"%s";', $res[$i]['str_jr_date_paid']);
    printf('"%s";', $res[$i]['jr_pj_number']);
    printf('"%s";', $res[$i]['quick_code']);
    printf('"%s %s";', $res[$i]['name'], $res[$i]['first_name']);
    printf('"%s";', $res[$i]['jr_comment']);
    printf('"%s";', $res[$i]['n_text']);
    $amount = $res[$i]['jr_montant'];
    if ($res[$i]['total_invoice'] != null && $res[$i]['jr_montant'] != $res[$i]['total_invoice']) {
        $amount = $res[$i]['total_invoice'];
    }
    if ($res[$i]['jrn_def_type'] == 'FIN') {
        $positive = $cn->get_value("select qf_amount from quant_fin where jr_id=\$1", array($res[$i]['jr_id']));
        if ($positive != '') {
            $amount = $positive;
        }
    }
    printf('%s', nb($amount));
    printf("\r\n");
}
Esempio n. 8
0
 function export_csv()
 {
     $array = $this->get_result();
     printf('"groupe";"activité";"débit";"credit";"solde"');
     printf("\r\n");
     bcscale(2);
     for ($i = 0; $i < count($array); $i++) {
         printf('"%s";"%s";%s;%s;%s', $array[$i]['ga_id'], $array[$i]['po_name'], nb($array[$i]['sum_deb']), nb($array[$i]['sum_cred']), nb(bcsub($array[$i]['sum_cred'], $array[$i]['sum_deb'])));
         printf("\r\n");
     }
 }
                    $amount_deb = bcadd($amount_deb, $row['j_montant']);
                    $prog = bcadd($prog, $row['j_montant']);
                    printf(";");
                } else {
                    printf(";");
                    printf("%s;", nb($row['j_montant']));
                    $amount_cred = bcadd($amount_cred, $row['j_montant']);
                    $prog = bcsub($prog, $row['j_montant']);
                }
                printf("%s;\"%s\";", abs(nb($prog)), $fic->get_amount_side($prog));
                if ($row['letter'] != -1) {
                    printf('"%s";', strtoupper(base_convert($row['letter'], 10, 36)));
                    printf("%s", nb($row['letter_diff']));
                } else {
                    printf(";");
                }
                printf("\n");
            }
            if ($prog < 0) {
                $msg = "Solde Debit";
            } elseif ($prog > 0) {
                $msg = "Solde Credit";
            } else {
                $msg = "soldé";
            }
            printf(';;;"%s";%s;%s;%s;"%s"', $msg, nb($amount_deb), nb($amount_cred), nb(abs($prog)), $fic->get_amount_side($prog));
            printf("\n");
        }
    }
}
exit;
Esempio n. 10
0
        }
        break;
}
$bal->from_poste = $_GET['from_poste'];
$bal->to_poste = $_GET['to_poste'];
if (isset($_GET['unsold'])) {
    $bal->unsold = true;
}
$prev = isset($_GET['previous_exc']) ? 1 : 0;
$row = $bal->get_row($_GET['from_periode'], $_GET['to_periode'], $prev);
$prev = isset($row[0]['sum_cred_previous']) ? 1 : 0;
echo 'poste;libelle;';
if ($prev == 1) {
    echo 'deb n-1;cred n-1;solde n-1;d/c;';
}
echo 'deb;cred;solde;d/c';
printf("\n");
foreach ($row as $r) {
    echo $r['poste'] . ';' . $r['label'] . ';';
    if ($prev == 1) {
        $delta = bcsub($r['solde_deb_previous'], $r['solde_cred_previous']);
        $sign = $delta < 0 ? 'C' : 'D';
        $sign = $delta == 0 ? '=' : $sign;
        echo nb($r['sum_deb_previous']) . ';' . nb($r['sum_cred_previous']) . ';' . nb(abs($delta)) . ';' . "{$sign}" . ';';
    }
    $delta = bcsub($r['solde_deb'], $r['solde_cred']);
    $sign = $delta < 0 ? 'C' : 'D';
    $sign = $delta == 0 ? '=' : $sign;
    echo nb($r['sum_deb']) . ';' . nb($r['sum_cred']) . ';' . nb(abs($delta)) . ';' . "{$sign}";
    printf("\n");
}
Esempio n. 11
0
<html>
<style>

table, th, td {
  color: grey;
  border: 2px solid lightblue;
   border-collapse: collapse;
    padding: 30px;
}
</style>
<?php 
function nb($s, $nbeleves)
{
    return intval(mysql_fetch_assoc(mysql_query("SELECT COUNT(*) as total FROM Note where CodeMatiere=\"{$s}\""))['total']) / $nbeleves * 100;
}
mysql_connect('localhost', 'root', 'mohamed');
mysql_select_db('BDdevoir1');
echo "<table align='center'>";
// Obtenir le numero d'eleves
$q = mysql_query("SELECT COUNT(*) as total FROM Eleve");
$nbeleves = mysql_fetch_assoc($q)['total'];
$nbAlgo = nb("Algo", $nbeleves);
$nbTic = nb("TIC", $nbeleves);
$nbBD = nb("BD", $nbeleves);
echo "<tr><td>Algorithmique</td><td>BD</td><td>TIC</td></tr>";
echo "<tr><td>{$nbAlgo}%</td> <td>{$nbBD}%</td> <td>{$nbTic}%</td> </tr>";
echo "</table>";
mysql_close();
?>
</html>
Esempio n. 12
0
                <?php 
}
?>
                <tfoot style="font-weight: bolder">
                    <tr>
                        <td style="width: auto" colspan="<?php 
echo count($plan) + 1;
?>
">
                            <?php 
echo _('Total');
?>
                        </td>
                        <td  class="num">
                            <span id="total_key"><?php 
echo nb($tot_key);
?>
</span>%
                        </td>
                    </tr>
                </tfoot>
        </table>
<input type="button" class="smallbutton" value="<?php 
echo _('Ajout ligne');
?>
" onclick="add_row_key('key_account_tb');">

        <div>
            <div>
                <h2>
                    <?php 
Esempio n. 13
0
if (isset($_GET['new']) && !empty($_GET['new'])) {
    echo "<div class=\"alert alert-warning alert-dismissible fade in\" role=\"alert\"> <a href=\"find.php?nextid=0\" type=\"button\" class=\"close\" \naria-label=\"Close\"><span aria-hidden=\"true\">×</span></a> <strong>New at Wikimedia Commons?</strong> You should probably read <a href=\"https://commons.wikimedia.org/wiki/Commons:Welcome\">Commons:Welcome</a> first! :-)</div>";
}
?>
      <div class="jumbotron">
	<h2><?php 
par('data/find.txt');
?>
</h2>
	<br><br>
        <p>
          <a class="btn btn-lg btn-primary" href="find.php?nextid=<?php 
echo rand(111, 99999);
?>
" role="button"><?php 
nb();
?>
 &raquo;</a>
        </p>
      </div>
	<small><div style = "float: left;"><a href="index.php">home</a> | <a href="javascript:history.back()">back</a></div> <div style="text-align: right;"><?php 
help("<span class=\"caret\"></span> ");
?>
<a href="find.php?help<?php 
help("back");
?>
">help</a></div></small>
    <?php 
help("<br><div class=\"alert alert-info alert-dismissible fade in\" role=\"alert\"> <a href=\"find.php?nextid=0\" type=\"button\" class=\"close\" \naria-label=\"Close\"><span aria-hidden=\"true\">×</span></a> <strong>Help</strong><br>This pags shows random stuff/tasks which you can do for Wikimedia Commons.<br><br>\n    If you are looking for a general overview you can take a look at <a href=\"https://commons.wikimedia.org/wiki/Commons:Welcome\">Commons:Welcome</a> and <a href=\"https://commons.wikimedia.org/wiki/Commons:Community_portal\">Commons:Community portal</a>.</div>");
echo "</div>";
footer();
Esempio n. 14
0
 function export_csv($p_date_start, $p_let)
 {
     $nb_fiche = count($this->afiche);
     $title = sprintf('"%s";', _('QuickCode'));
     $title .= sprintf('"%s";', _('Nom'));
     $title .= sprintf('"%s";', _('Prénom'));
     $title .= sprintf('"%s";', _('Date'));
     $title .= sprintf('"%s";', _('N° pièce'));
     $title .= sprintf('"%s";', _('Interne'));
     $title .= sprintf('"%s";', _('Fin'));
     $title .= sprintf('"%s";', _('<30 jours'));
     $title .= sprintf('"%s";', _('entre 30 et 60 jours'));
     $title .= sprintf('"%s";', _('entre 60 et 90 jours'));
     $title .= sprintf('"%s";', _('> 90 jours'));
     $title .= sprintf("\n\r");
     $flag_title = false;
     for ($i = 0; $i < $nb_fiche; $i++) {
         $card = new Lettering_Card($this->cn, $this->afiche[$i]['quick_code']);
         $card->set_parameter('start', $p_date_start);
         $card->get_balance_ageing($p_let);
         if (empty($card->content)) {
             continue;
         }
         if (!$flag_title) {
             echo $title;
             $flag_title = true;
         }
         $nb_row = count($card->content);
         $sum_lt_30 = 0;
         $sum_gt_30_lt_60 = 0;
         $sum_gt_60_lt_90 = 0;
         $sum_gt_90 = 0;
         $sum_fin = 0;
         for ($j = 0; $j < $nb_row; $j++) {
             $show = true;
             printf('"%s";', str_replace('"', '', $this->afiche[$i]['quick_code']));
             printf('"%s";', str_replace('"', '', $this->afiche[$i]['name']));
             printf('"%s";', str_replace('"', '', $this->afiche[$i]['first_name']));
             printf('"%s";', $card->content[$j]['j_date_fmt']);
             printf('"%s";', $card->content[$j]['jr_pj_number']);
             printf('"%s";', $card->content[$j]['jr_internal']);
             if ($card->content[$j]['jrn_def_type'] == 'FIN' || $card->content[$j]['jrn_def_type'] == 'ODS') {
                 printf("%s;", nb($card->content[$j]['j_montant']));
                 $sum_fin = bcadd($sum_fin, $card->content[$j]['j_montant']);
                 $show = false;
             } else {
                 printf('0;');
             }
             if ($show && $card->content[$j]['day_paid'] <= 30) {
                 printf("%s;", nb($card->content[$j]['j_montant']));
                 $sum_lt_30 = bcadd($sum_lt_30, $card->content[$j]['j_montant']);
                 $show = false;
             } else {
                 printf('0;');
             }
             if ($show && $card->content[$j]['day_paid'] > 30 && $card->content[$j]['day_paid'] <= 60) {
                 printf("%s;", nb($card->content[$j]['j_montant']));
                 $sum_gt_30_lt_60 = bcadd($sum_gt_30_lt_60, $card->content[$j]['j_montant']);
             } else {
                 printf('0;');
             }
             if ($show && $card->content[$j]['day_paid'] > 60 && $card->content[$j]['day_paid'] <= 90) {
                 printf("%s;", nb($card->content[$j]['j_montant']));
                 $sum_gt_60_lt_90 = bcadd($sum_gt_60_lt_90, $card->content[$j]['j_montant']);
             } else {
                 printf('0;');
             }
             if ($show && $card->content[$j]['day_paid'] > 90) {
                 printf("%s", nb($card->content[$j]['j_montant']));
                 $sum_gt_90 = bcadd($sum_gt_90, $card->content[$j]['j_montant']);
             } else {
                 printf('0;');
             }
             printf("\n\r");
         }
         printf('"%s";', _('Totaux'));
         printf('"";');
         printf('"";');
         printf('"";');
         printf('"";');
         printf('"";');
         printf('%s;', nb($sum_fin));
         printf('%s;', nb($sum_lt_30));
         printf('%s;', nb($sum_gt_30_lt_60));
         printf('%s;', nb($sum_gt_60_lt_90));
         printf('%s', nb($sum_gt_90));
         printf("\n\r");
     }
 }
Esempio n. 15
0
     $tva_dna = $line['tva_dna'] == 0 ? "" : nbm($line['tva_dna']);
     $tot['tva_nd'] = bcadd($tot['tva_nd'], floatval($line['tva_dna']));
     echo "<TD class=\"num\">" . $tva_dna . "</TD>";
     $a_tva_amount = array();
     foreach ($line['TVA'] as $lineTVA) {
         foreach ($a_Tva as $idx => $line_tva) {
             if ($line_tva['tva_id'] == $lineTVA[1][0]) {
                 $a = $line_tva['tva_id'];
                 $a_tva_amount[$a] = $lineTVA[1][2];
             }
         }
     }
     foreach ($a_Tva as $line_tva) {
         $a = $line_tva['tva_id'];
         if (isset($a_tva_amount[$a])) {
             echo '<td class="num">' . nb($a_tva_amount[$a]) . '</td>';
             $tot['tva'][$a] = isset($tot['tva'][$a]) ? bcadd($tot['tva'][$a], floatval($a_tva_amount[$a])) : floatval($a_tva_amount[$a]);
         } else {
             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 = "";
Esempio n. 16
0
 /**
  * with the handle of a successull query, echo each row into CSV and
  * send it directly
  * @param type $array of data
  * @param type $aheader  double array, each item of the array contains
  * a key type (num) and a key title
  */
 static function array_to_csv($array, $aheader)
 {
     $seq = "";
     for ($i = 0; $i < count($aheader); $i++) {
         echo $seq . '"' . $aheader[$i]['title'] . '"';
         $seq = ";";
     }
     printf("\r");
     $seq = "";
     // fetch all the rows
     for ($i = 0; $i < count($array); $i++) {
         $row = $array[$i];
         $sep2 = "";
         $e = 0;
         // for each rows, for each value
         foreach ($array[$i] as $key => $value) {
             if ($e > count($aheader)) {
                 $e = 0;
             }
             if (isset($aheader[$e]['type'])) {
                 switch ($aheader[$e]['type']) {
                     case 'num':
                         echo $sep2 . nb($value);
                         break;
                     default:
                         echo $sep2 . '"' . $value . '"';
                 }
             } else {
                 echo '"' . $value . '"' . $sep2;
             }
             $sep2 = ";";
             $e++;
         }
         printf("\r");
     }
 }
Esempio n. 17
0
 function export_csv()
 {
     bcscale(2);
     if ($this->check() != 0) {
         throw new Exception(_("date invalide"));
     }
     //---------------------------------------------------------------------------
     // Card  - Acc
     //---------------------------------------------------------------------------
     if ($this->card_poste == '1') {
         $this->load_card();
         /*
          * Show all the result
          */
         $prev = '';
         for ($i = 0; $i < count($this->arow); $i++) {
             printf('"%s";" %s"', $this->arow[$i]['j_qcode'], $this->arow[$i]['name']);
             $amount = $this->arow[$i]['sum_amount'];
             if ($amount == null) {
                 $amount = 0;
             }
             printf(';"%s";" %s";', $this->arow[$i]['po_name'], $this->arow[$i]['po_description']);
             printf("%s", nb($amount));
             printf("\r\n");
         }
     }
     //---------------------------------------------------------------------------
     // Accountancy - Analytic
     //---------------------------------------------------------------------------
     if ($this->card_poste == '2') {
         $this->load_poste();
         /*
          * Show all the result
          */
         for ($i = 0; $i < count($this->arow); $i++) {
             printf('"%s";" %s"', $this->arow[$i]['j_poste'], $this->arow[$i]['name']);
             $amount = $this->arow[$i]['sum_amount'];
             if ($amount == null) {
                 $amount = 0;
             }
             printf(';"%s";" %s";', $this->arow[$i]['po_name'], $this->arow[$i]['po_description']);
             printf("%s", nb($amount));
             printf("\r\n");
         }
     }
     //---------------------------------------------------------------------------
     // Acc after card
     //---------------------------------------------------------------------------
     if ($this->card_poste == '3') {
         $this->load_anc_card();
         /*
          * Show all the result
          */
         for ($i = 0; $i < count($this->arow); $i++) {
             printf('"%s";" %s";', $this->arow[$i]['po_name'], $this->arow[$i]['po_description']);
             $amount = $this->arow[$i]['sum_amount'];
             if ($amount == null) {
                 $amount = 0;
             }
             printf('"%s";"%s";', $this->arow[$i]['j_qcode'], $this->arow[$i]['name']);
             printf("%s", nb($amount));
             printf("\r\n");
         }
     }
     //---------------------------------------------------------------------------
     // Analytic - Accountancy
     //---------------------------------------------------------------------------
     if ($this->card_poste == '4') {
         $this->load_anc_account();
         /*
          * Show all the result
          */
         for ($i = 0; $i < count($this->arow); $i++) {
             printf('"%s";"%s";', $this->arow[$i]['po_name'], $this->arow[$i]['po_description']);
             $amount = $this->arow[$i]['sum_amount'];
             if ($amount == null) {
                 $amount = 0;
             }
             printf('"%s";"%s";', $this->arow[$i]['j_poste'], $this->arow[$i]['name']);
             printf("%s", nb($amount));
             printf("\r\n");
         }
     }
 }
             */
            $progress = 0;
            $current_exercice = $op['p_exercice'];
            $tot_deb = 0;
            $tot_cred = 0;
        }
        $diff = bcsub($op['deb_montant'], $op['cred_montant']);
        $progress = bcadd($progress, $diff);
        $tot_deb = bcadd($tot_deb, $op['deb_montant']);
        $tot_cred = bcadd($tot_cred, $op['cred_montant']);
        echo '"' . $op['j_qcode'] . '";' . '"' . $op['j_date_fmt'] . '"' . ";" . '"' . $op['jr_pj_number'] . '"' . ";" . '"' . $op['jr_internal'] . '"' . ";" . '"' . $op['jrn_def_code'] . '"' . ";" . '"' . $op['jrn_def_name'] . '"' . ";" . '"' . $op['description'] . '"' . ";" . nb($op['deb_montant']) . ";" . nb($op['cred_montant']) . ";" . nb(abs($progress)) . ';' . '"' . ($op['letter'] == -1 ? '' : strtoupper(base_convert($op['letter'], 10, 36))) . '"';
        printf("\n");
    }
} else {
    echo '"Poste";"Qcode";"date";"ref";"internal";';
    echo "\"Description\";" . "\"Montant\";" . "\"D/C\"";
    printf("\r\n");
    foreach ($Fiche->row as $op) {
        $acc = new Acc_Operation($cn);
        $acc->jr_id = $op['jr_id'];
        $result = $acc->get_jrnx_detail();
        foreach ($result as $r) {
            printf('"%s";"%s";"%s";"%s";"%s";%s;%s;"%s"', $r['j_poste'], $r['j_qcode'], $r['jr_date'], $op['jr_pj_number'], $r['jr_internal'], $r['description'], nb($r['j_montant']), $r['debit']);
            printf("\r\n");
        }
    }
}
$solde_type = $tot_deb > $tot_cred ? "solde débiteur" : "solde créditeur";
$diff = abs($tot_deb - $tot_cred);
printf('"' . "{$solde_type}" . '"' . ";" . nb($diff) . ";" . nb($tot_deb) . ";" . nb($tot_cred) . "\n");
exit;
 function display_csv()
 {
     $r = "";
     $r .= '"Poste comptable Analytique";';
     $r .= '"Poste comptable Analytique";';
     $r .= '"Debit";';
     $r .= '"Credit";';
     $r .= '"Solde";';
     $r .= '"D/C"';
     $r .= "\r\n";
     $array = $this->load();
     if (is_array($array) == false) {
         return $array;
     }
     foreach ($array as $row) {
         $r .= sprintf('"%s";', $row['a_po_name']);
         $r .= sprintf('"%s";', $row['b_po_name']);
         $r .= sprintf("%s;", nb($row['a_d']));
         $r .= sprintf("%s;", nb($row['a_c']));
         $r .= sprintf("%s;", nb($row['a_solde']));
         $r .= sprintf('"%s"', $row['a_debit']);
         $r .= "\r\n";
     }
     return $r;
 }
Esempio n. 20
0
            $solde += $detail['deb_montant'];
            $solde_d += $detail['deb_montant'];
        }
        echo $detail['j_date_fmt'] . ";";
        echo $detail['jr_internal'] . ";";
        echo $detail['description'] . ";";
        echo $detail['jr_pj_number'] . ";";
        if ($detail['letter'] == -1) {
            echo ';';
        } else {
            echo $detail['letter'] . ";";
        }
        echo ($detail['deb_montant'] > 0 ? nb($detail['deb_montant']) : '') . ";";
        echo ($detail['cred_montant'] > 0 ? nb($detail['cred_montant']) : '') . ";";
        echo nb(abs($solde)) . ";";
        echo $Poste->get_amount_side($solde);
        printf("\n");
    }
    echo ";";
    echo '"' . $current_exercice . '";';
    echo ";";
    echo ";";
    echo 'Total du compte ' . $Poste->id . ";";
    echo ($solde_d > 0 ? nb($solde_d) : '') . ";";
    echo ($solde_c > 0 ? nb($solde_c) : '') . ";";
    echo nb(abs($solde_c - $solde_d)) . ";";
    echo ($solde_c > $solde_d ? 'C' : 'D') . ";";
    printf("\n");
    printf("\n");
}
exit;
Esempio n. 21
0
        ?>
 </td>
 <?php 
        if ($this->content[$i]['j_debit'] == 't') {
            ?>
  <td style="text-align:right"> <?php 
            echo nb($this->content[$i]['j_montant']);
            ?>
 </td>
  <td></td>
  <?php 
        } else {
            ?>
  <td></td>
  <td style="text-align:right"> <?php 
            echo nb($this->content[$i]['j_montant']);
            ?>
 </td>
  <?php 
        }
        ?>
<td style="text-align:center">
<?php 
        // Rapprochement
        $rec = new Acc_Reconciliation($this->db);
        $rec->set_jr_id($this->content[$i]['jr_id']);
        $a = $rec->get();
        if ($a != null) {
            foreach ($a as $key => $element) {
                $operation = new Acc_Operation($this->db);
                $operation->jr_id = $element;
Esempio n. 22
0
         //- set all TVA to 0
         foreach ($a_Tva as $l) {
             $t_id = $l["tva_id"];
             $a_tva_amount[$t_id] = 0;
         }
         foreach ($line['TVA'] as $lineTVA) {
             $idx_tva = $lineTVA[1][0];
             $a_tva_amount[$idx_tva] = $lineTVA[1][2];
         }
         if ($own->MY_TVA_USE == 'Y') {
             foreach ($a_Tva as $line_tva) {
                 $a = $line_tva['tva_id'];
                 echo nb($a_tva_amount[$a]) . ';';
             }
         }
         echo nb($line['TVAC']);
         /**
          * Retrieve payment if any
          */
         $ret_reconcile = $cn->execute('reconcile_date', array($line['jr_id']));
         $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 . $row['str_date'] . '; ' . $row['jr_internal'];
             }
         }
         printf("\r\n");
     }
 }