$new->get(); $ret .= '<div class="content">'; $ret .= '<h2 class="info">' . _("Mise à jour") . '</h2>'; $ret .= '<form method="post">'; $ret .= dossier::hidden(); $ret .= $new->form(); $ret .= $wSa; $ret .= HtmlInput::submit("submit", _("Enregistre")); $ret .= HtmlInput::button_anchor(_('Efface'), '', 'remove_analytic_plan', 'onclick="return confirm_box(\'remove_analytic_plan\',\'Effacer ?\',function () {window.location=\'do.php?ac=' . $_REQUEST['ac'] . '&pa_id=' . $_GET['pa_id'] . '&sa=pa_delete&' . $str_dossier . '\';})"', 'smallbutton'); $ret .= '</form>'; /** * Detail now */ $count = 0; $new = new Anc_Plan($cn, $_REQUEST['pa_id']); $new->get(); $array = $new->get_poste_analytique(" order by po_name"); $ret .= '<div class="content">'; $ret .= '<table class="table_large">'; $ret .= "<tr>"; $ret .= "<th>" . _("Nom") . " </td>"; $ret .= "<th>" . _("Montant") . " </td>"; $ret .= "<th>" . _("Description") . " </td>"; $ret .= "<th>" . _("Groupe") . "</th>"; $ret .= "<th>" . _("Plan A") . " </td>"; $ret .= "</tr>"; $class = ""; foreach ($array as $obj) { $count++; if ($count % 2 == 0) { $class = "even";
function display_pdf() { $array = $this->load(); if (empty($array)) { return; } $pdf = new PDF($this->db); $pdf->Setdossierinfo(dossier::name()); $pdf->setTitle("Balance analytique", true); $pdf->SetAuthor('NOALYSS'); $pdf->AliasNbPages(); $pdf->AddPage(); $pa = new Anc_Plan($this->db, $this->pa_id); $pa->get(); $pb = new Anc_Plan($this->db, $this->pa_id2); $pb->get(); $pdf->SetFont('DejaVu', 'B', 9); $pdf->Cell(0, 7, sprintf("Balance croise plan %s %s ", $pa->name, $pb->name), 1, 0, 'C'); $filtre_date = ""; $filtre_pa = ""; $filtre_pb = ""; if ($this->from != "" || $this->to != "") { $filtre_date = sprintf("Filtre date %s %s", $this->from, $this->to); } if ($this->from_poste != "" || $this->to_poste != "") { $filtre_pa = sprintf("Filtre poste plan1 %s %s", $this->from_poste != "" ? "de " . $this->from_poste : " ", $this->to_poste != "" ? "jusque " . $this->to_poste : ""); } if ($this->from_poste2 != "" || $this->to_poste2 != "") { $filtre_pb = sprintf("Filtre poste plan2 %s %s", $this->from_poste2 != "" ? "de " . $this->from_poste2 : " ", $this->to_poste2 != "" ? "jusque " . $this->to_poste2 : ""); } $pdf->SetFont('DejaVu', '', 8); $pdf->Cell(50, 7, $filtre_date); $pdf->Cell(50, 7, $filtre_pa); $pdf->Cell(50, 7, $filtre_pb); $pdf->Ln(); $pdf->SetFont('DejaVu', '', 6); $pdf->Cell(20, 7, 'id', 'B'); $pdf->Cell(100, 7, 'Poste Comptable', 'B'); $pdf->Cell(20, 7, 'Débit', 'B', 0, 'L'); $pdf->Cell(20, 7, 'Crédit', 'B', 0, 'L'); $pdf->Cell(20, 7, 'Solde', 'B', 0, 'L'); $pdf->Cell(20, 7, 'D/C', 'B', 0, 'L'); $pdf->Ln(); for ($i = 0; $i < count($array); $i++) { $row = $array[$i]; $pdf->Cell(20, 6, $row['a_po_name'], 0, 0, 'L'); $pdf->Cell(40, 6, mb_substr($row['a_po_description'], 0, 31), 0, 0, 'L'); $pdf->Cell(20, 6, $row['b_po_name'], 0, 0, 'L'); $pdf->Cell(40, 6, mb_substr($row['b_po_description'], 0, 31), 0, 0, 'L'); $pdf->Cell(20, 6, $row['a_d'], 0, 0, 'R'); $pdf->Cell(20, 6, $row['a_c'], 0, 0, 'R'); $pdf->Cell(20, 6, $row['a_solde'], 0, 0, 'R'); $pdf->Cell(20, 6, $row['a_debit'], 0, 0, 'C'); $pdf->Ln(); } $sum = $this->show_sum($array); $pdf->SetFont('DejaVu', 'B', 8); $pdf->Cell(70, 6, 'Somme', 1, 0, 'C'); $pdf->Ln(5); $pdf->SetFont('DejaVu', '', 6); $pdf->Cell(20, 7, 'Poste'); $pdf->Cell(60, 7, 'Description', 'B'); $pdf->Cell(20, 7, 'Débit', 'B', 0, 'L'); $pdf->Cell(20, 7, 'Crédit', 'B', 0, 'L'); $pdf->Cell(20, 7, 'Solde', 'B', 0, 'L'); $pdf->Cell(20, 7, 'D/C', 'B', 0, 'L'); $pdf->Ln(); for ($i = 0; $i < count($sum); $i++) { $row = $sum[$i]; $pdf->Cell(20, 6, $row['poste'], 0, 0, 'L'); $pdf->Cell(60, 6, $row['desc'], 0, 0, 'L'); $pdf->Cell(20, 6, sprintf('%.2f', $row['debit']), 0, 0, 'R'); $pdf->Cell(20, 6, sprintf('%.2f', $row['credit']), 0, 0, 'R'); $pdf->Cell(20, 6, sprintf('%.2f', $row['solde']), 0, 0, 'R'); $pdf->Cell(20, 6, $row['dc'], 0, 0, 'R'); $pdf->Ln(); } $fDate = date('dmy-Hi'); $pdf->output('crossbalance-' . $fDate . '.pdf', 'D'); }
function form() { $r = ''; $wName = new IText("po_name", $this->name); $wAmount = new INum("po_amount", $this->amount); $wDescription = new IText("po_description", $this->description); $aGroup_analytic = $this->db->make_array("select ga_id,ga_id from groupe_analytique where pa_id=" . $this->pa_id, 1); if (count($aGroup_analytic) > 1) { $wGa_id = new ISelect("ga_id"); $wGa_id->value = $aGroup_analytic; $wGa_id->selected = $this->ga_id; $wGa_id->table = 1; } else { $wGa_id = new ISpan(); } $pa = new Anc_Plan($this->db, $this->pa_id); $pa->get(); $wPaName = new IText("", $pa->name); $wPaName->table = 1; $wPaName->readOnly = true; $wName->table = 1; $wAmount->table = 1; $wDescription->table = 1; $r .= HtmlInput::hidden("pa_id", $this->pa_id); $r .= HtmlInput::hidden("po_id", $this->id); $r .= "<table>"; $r .= "<tr>"; $r .= td(_('Nom')); $r .= $wName->input(); $r .= "</tr>"; $r .= "<tr>"; $r .= td(_('Montant')); $r .= $wAmount->input(); $r .= "</tr>"; $r .= "<tr>"; $r .= td(_('Description')); $r .= $wDescription->input(); $r .= "</tr>"; $r .= "<tr>"; $r .= td(_('Plan Analytique')); $r .= $wPaName->input(); $r .= "</tr>"; $r .= "<tr>"; $r .= td(_('Groupe')); $r .= $wGa_id->input(); $r .= "</tr>"; $r .= "</table>"; return $r; }