public function chequeRtf($id)
 {
     $egreso = Egreso::findOrFail($id);
     $egreso->load('proyectos.fondos', 'proyectos.urg');
     $arr_rms = [];
     if (count($egreso->rms) > 0) {
         foreach ($egreso->rms as $rm) {
             $arr_rms[$rm->rm] = ['cog' => $rm->cog->cog, 'monto' => 0];
         }
         foreach ($egreso->rms as $rm) {
             $arr_rms[$rm->rm]['monto'] += $rm->pivot->monto;
         }
     }
     $fecha_texto = \Utility::fecha_texto($egreso->fecha);
     $nat = new Nat(round($egreso->monto, 2), '');
     $monto_letra = $nat->convertir();
     $presu = \InfoDirectivos::getResponsable('PRESU')->iniciales;
     $cfin = \InfoDirectivos::getResponsable('FIN')->iniciales;
     $elabora = \Auth::user()->iniciales;
     return view('egresos.formCheque', compact('egreso', 'monto_letra', 'fecha_texto', 'presu', 'cfin', 'elabora', 'arr_rms'));
 }
Example #2
0
 public function crearPdf()
 {
     $this->AliasNbPages();
     $this->SetAutoPageBreak(true, 75);
     $this->AddPage();
     //Articulos Capturados
     $this->SetFont('Arial', '', 6);
     $this->Cell(15, 2, 'UNIDAD DE', 'LTR', 2, 'C', true);
     $this->Cell(15, 2, 'MEDIDA', 'LBR', 1, 'C', true);
     $this->SetXY(25, $this->GetY() - 4);
     $this->Cell(115, 4, utf8_decode('DESCRIPCIÓN DE LOS BIENES'), 1, 0, 'C', true);
     $this->Cell(20, 4, 'CANTIDAD', 1, 0, 'C', true);
     $this->Cell(25, 4, 'PRECIO UNITARIO', 1, 0, 'C', true);
     $this->Cell(25, 4, 'IMPORTE TOTAL', 1, 1, 'C', true);
     $y_linea = $this->GetY();
     $no_pagina = $this->PageNo();
     $subtotal = 0;
     $sum_iva = 0;
     foreach ($this->oc->articulos as $articulo) {
         $this->SetFont('Arial', '', 7);
         //Se calcula cuantos renglones ocupará el artículo y su descripción
         $this->SetX(25);
         $y_inicial = $this->GetY();
         $this->isLongCell = true;
         $this->MultiCell(115, 3, utf8_decode($articulo->articulo), 1, 'L');
         $this->isLongCell = false;
         //Se reinicializa la y_inicial
         if ($no_pagina != $this->PageNo()) {
             $y_inicial = 70;
             $no_pagina = $this->PageNo();
         }
         $y_final = $this->GetY();
         $h_renglon = $y_final - $y_inicial;
         //Determina la altura del renglón
         $subtotal += $articulo->sub_total;
         $iva = $articulo->impuesto * 0.01 * $articulo->sub_total;
         $sum_iva += $iva;
         $this->SetXY(10, $y_inicial);
         $this->Cell(15, $h_renglon, $articulo->unidad, 1, 0, 'C');
         $this->SetXY(140, $y_inicial);
         $this->SetFont('CenturyGothic', '', '7');
         $this->Cell(20, $h_renglon, $articulo->cantidad, 1, 0, 'C');
         $this->Cell(25, $h_renglon, number_format($articulo->monto_cotizado, 2), 1, 0, 'R');
         $this->Cell(25, $h_renglon, number_format($articulo->sub_total, 2), 1, 1, 'R');
     }
     //Dibuja lineas cuando termina iteración
     $this->Line($this->GetX(), $y_linea, $this->GetX(), 207);
     $this->Line($this->GetX() + 15, $this->GetY(), $this->GetX() + 15, 207);
     $this->Line($this->GetX() + 130, $this->GetY(), $this->GetX() + 130, 207);
     $this->Line($this->GetX() + 150, $this->GetY(), $this->GetX() + 150, 207);
     $this->Line($this->GetX() + 175, $this->GetY(), $this->GetX() + 175, 207);
     $this->Line($this->GetX() + 200, $this->GetY(), $this->GetX() + 200, 207);
     //$pdf->Line($pdf->GetX(), 220, 210, 232);
     $total = $subtotal + $sum_iva;
     $nat = new Nat($total, $this->oc->req->moneda);
     $importe_letra = $nat->convertir();
     $simbolo_mondea = $this->monedas($this->oc->req->moneda);
     //Totales
     $this->SetAutoPageBreak(true, 60);
     $this->SetFont('Arial', '', 7);
     $this->SetXY(10, 207);
     $this->Cell(150, 12, 'IMPORTE CON LETRA: ' . $importe_letra, 1, 2, 'L');
     $this->SetXY(160, 207);
     $this->Cell(25, 4, 'SUB-TOTAL ' . $simbolo_mondea, 1, 2, 'R', true);
     $this->Cell(25, 4, 'I.V.A. ' . $simbolo_mondea, 1, 2, 'R', true);
     $this->Cell(25, 4, 'TOTAL ' . $simbolo_mondea, 1, 1, 'R', true);
     $this->SetXY(185, 207);
     $this->SetFont('CenturyGothic', '', '7');
     $this->Cell(25, 4, number_format($subtotal, 2), 1, 2, 'R');
     $this->Cell(25, 4, number_format($sum_iva, 2), 1, 2, 'R');
     $this->Cell(25, 4, number_format($total, 2), 1, 1, 'R');
     $this->Output('Req_' . $this->oc->req->req . '_OC_' . $this->oc->oc . '.pdf', 'I');
 }