$prog = bcadd($prog, $diff);
            echo '"' . $pos['pcm_val'] . '";' . '"' . $op['jr_pj_number'] . '"' . ";" . '"' . $op['jrn_def_code'] . '"' . ";" . '"' . $op['jrn_def_name'] . '"' . ";" . '"' . $name . '";' . '"' . $op['jr_internal'] . '"' . ";" . '"' . $op['j_date_fmt'] . '"' . ";" . '"' . $op['description'] . '";' . nb($op['deb_montant']) . ";" . nb($op['cred_montant']) . ";" . nb(abs($prog)) . ";" . ($op['letter'] != -1 ? strtoupper(base_convert($op['letter'], 10, 36)) : "");
            printf("\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");
            }
        }
Ejemplo n.º 2
0
$s = isset($_REQUEST['solded']) ? 1 : 0;
foreach ($a_poste as $poste) {
    $Poste = new Acc_Account_Ledger($cn, $poste['pcm_val']);
    $array1 = $Poste->get_row_date($from_periode, $to_periode, $l, $s);
    // don't print empty account
    if (count($array1) == 0) {
        continue;
    }
    $array = $array1[0];
    $tot_deb = $array1[1];
    $tot_cred = $array1[2];
    // don't print empty account
    if (count($array) == 0) {
        continue;
    }
    echo sprintf("%s - %s ", $Poste->id, $Poste->get_name());
    printf("\n");
    for ($i = 0; $i < count($header); $i++) {
        echo $header[$i] . ";";
    }
    printf("\n");
    $solde = 0.0;
    $solde_d = 0.0;
    $solde_c = 0.0;
    $current_exercice = "";
    foreach ($Poste->row as $detail) {
        /*
              [0] => 1 [jr_id] => 1
              [1] => 01.02.2009 [j_date_fmt] => 01.02.2009
              [2] => 2009-02-01 [j_date] => 2009-02-01
              [3] => 0 [deb_montant] => 0
Ejemplo n.º 3
0
// Column widths (in mm)
$width = array(13, 20, 60, 15, 12, 20, 20, 20);
$l = isset($_REQUEST['letter']) ? 2 : 0;
$s = isset($_REQUEST['solded']) ? 1 : 0;
foreach ($a_poste as $poste) {
    $Poste = new Acc_Account_Ledger($cn, $poste['pcm_val']);
    $array1 = $Poste->get_row_date($from_periode, $to_periode, $l, $s);
    // don't print empty account
    if (count($array1) == 0) {
        continue;
    }
    $array = $array1[0];
    $tot_deb = $array1[1];
    $tot_cred = $array1[2];
    $pdf->SetFont('DejaVuCond', '', 10);
    $Libelle = sprintf("%s - %s ", $Poste->id, $Poste->get_name());
    $pdf->Cell(0, 7, $Libelle, 1, 1, 'C');
    $pdf->SetFont('DejaVuCond', '', 6);
    for ($i = 0; $i < count($header); $i++) {
        $pdf->Cell($width[$i], 4, $header[$i], 0, 0, $lor[$i]);
    }
    $pdf->Ln();
    $pdf->SetFont('DejaVuCond', '', 7);
    $solde = 0.0;
    $solde_d = 0.0;
    $solde_c = 0.0;
    $current_exercice = "";
    foreach ($Poste->row as $detail) {
        /*
              [0] => 1 [jr_id] => 1
              [1] => 01.02.2009 [j_date_fmt] => 01.02.2009
Ejemplo n.º 4
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;
 }
$pdf->SetAuthor('NOALYSS');
$pdf->setTitle("Détail poste comptable", true);
if (count($a_poste) == 0) {
    $pdf->Output('poste.pdf', 'D');
    exit;
}
$size = array(13, 25, 13, 65, 12, 20, 20, 20);
$align = array('L', 'C', 'C', 'L', 'R', 'R', 'R', 'R');
foreach ($a_poste as $poste) {
    $Poste = new Acc_Account_Ledger($cn, $poste['pcm_val']);
    list($array, $tot_deb, $tot_cred) = $Poste->get_row_date($from_periode, $to_periode, $_GET['ople']);
    // don't print empty account
    if (count($array) == 0) {
        continue;
    }
    $Libelle = sprintf("(%s) %s ", $Poste->id, $Poste->get_name());
    $pdf->SetFont('DejaVuCond', '', 10);
    $pdf->Cell(0, 8, $Libelle, 1, 0, 'C');
    $pdf->Ln();
    $pdf->SetFont('DejaVuCond', '', 8);
    $l = 0;
    $pdf->Cell($size[$l], 6, 'Date', 0, 0, 'L');
    $l++;
    $pdf->Cell($size[$l], 6, 'Ref', 0, 0, 'C');
    $l++;
    $pdf->Cell($size[$l], 6, 'Journal', 0, 0, 'C');
    $l++;
    $pdf->LongLine($size[$l], 6, 'Libellé', 0, 'L');
    $l++;
    $pdf->Cell($size[$l], 6, 'Let', 0, 0, 'R');
    $l++;
 /**
  * @covers Acc_Account_Ledger::get_name
  * @todo   Implement testGet_name().
  * @dataProvider dataGet_Name
  */
 public function testGet_name($id, $result)
 {
     $this->object->id = $id;
     $this->assertEquals($this->object->get_name(), $result);
 }