示例#1
0
 function writeDetalles(DataSource $dataSource, TCPDF $pdf, $tipo)
 {
     $blackAll = array('LTRB' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     $widthMarginLeft = 1;
     $width1 = 20;
     $width2 = 85;
     $pdf->Ln();
     $pdf->SetFontSize(7.5);
     $pdf->SetFont('', 'B');
     $height = 5;
     $pdf->SetFillColor(255, 255, 255, true);
     $pdf->setTextColor(0, 0, 0);
     if ($tipo == 'adjudicado') {
         $pdf->Cell($width2 - $width1 * 2, $height, 'Item', $blackAll, 0, 'l', true, '', 1, false, 'T', 'C');
     } else {
         $pdf->Cell($width2, $height, 'Item', $blackAll, 0, 'l', true, '', 1, false, 'T', 'C');
     }
     $pdf->Cell($width1, $height, 'Cantidad Ref.', $blackAll, 0, 'L', true, '', 1, false, 'T', 'C');
     if ($tipo != 'borrador') {
         $pdf->Cell($width1, $height, 'Precio Unitario Ref.', $blackAll, 0, 'C', true, '', 1, false, 'T', 'C');
     }
     $pdf->Cell($width1, $height, 'Cantidad Ofert.', $blackAll, 0, 'L', true, '', 1, false, 'T', 'C');
     $pdf->Cell($width1, $height, 'Precio Unitario Ofert.', $blackAll, 0, 'C', true, '', 1, false, 'T', 'C');
     $pdf->Cell($width1, $height, 'Total Ofert.', $blackAll, 0, 'C', true, '', 1, false, 'T', 'C');
     if ($tipo == 'adjudicado') {
         $pdf->Cell($width1, $height, 'Cantidad Adj.', $blackAll, 0, 'l', true, '', 1, false, 'T', 'C');
         $pdf->Cell($width1, $height, 'Total', $blackAll, 0, 'l', true, '', 1, false, 'T', 'C');
     }
     $pdf->Ln();
     $pdf->SetFontSize(6.5);
     foreach ($dataSource->getDataset() as $row) {
         $pdf->SetFont('', '');
         $xAntesMultiCell = $pdf->getX();
         $yAntesMultiCell = $pdf->getY();
         //$totalItem
         if ($tipo == 'borrador') {
             $pdf->MultiCell($width2, $height, $row['desc_solicitud_det'] . "\r\n" . '  - ' . $row['descripcion_sol'], 1, 'L', false, 1);
             $yDespuesMultiCell = $pdf->getY();
             $height = $yDespuesMultiCell - $yAntesMultiCell;
             $pdf->setXY($xAntesMultiCell + $width2, $yAntesMultiCell);
             $pdf->Cell($width1, $height, $row['cantidad_sol'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
             $pdf->Cell($width1, $height, '', 1, 0, 'R', false, '', 1, false, 'T', 'C');
             $pdf->Cell($width1, $height, '', 1, 0, 'R', false, '', 1, false, 'T', 'C');
             $pdf->Cell($width1, $height, '', 1, 0, 'R', false, '', 1, false, 'T', 'C');
         } else {
             if ($tipo == 'cotizado') {
                 $pdf->MultiCell($width2, $height, $row['desc_solicitud_det'] . "\r\n" . '  - ' . $row['descripcion_sol'], 1, 'L', false, 1);
                 $yDespuesMultiCell = $pdf->getY();
                 $height = $yDespuesMultiCell - $yAntesMultiCell;
                 $pdf->setXY($xAntesMultiCell + $width2, $yAntesMultiCell);
                 $pdf->Cell($width1, $height, $row['cantidad_sol'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
                 $pdf->Cell($width1, $height, number_format($row['precio_unitario_sol'], 2), 1, 0, 'R', false, '', 1, false, 'T', 'C');
                 $pdf->Cell($width1, $height, $row['cantidad_coti'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
                 $pdf->Cell($width1, $height, number_format($row['precio_unitario'], 2), 1, 0, 'R', false, '', 1, false, 'T', 'C');
                 $totalItem = number_format($row['cantidad_coti'] * $row['precio_unitario'], 2);
                 $pdf->Cell($width1, $height, $totalItem, 1, 0, 'R', false, '', 1, false, 'T', 'C');
             } else {
                 $pdf->MultiCell($width2 - $width1 * 2, $height, $row['desc_solicitud_det'] . "\r\n" . '  - ' . $row['descripcion_sol'], 1, 'L', false, 1);
                 $yDespuesMultiCell = $pdf->getY();
                 $height = $yDespuesMultiCell - $yAntesMultiCell;
                 $pdf->setXY($xAntesMultiCell + $width2 - $width1 * 2, $yAntesMultiCell);
                 $pdf->Cell($width1, $height, $row['cantidad_sol'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
                 $pdf->Cell($width1, $height, number_format($row['precio_unitario_sol'], 2), 1, 0, 'R', false, '', 1, false, 'T', 'C');
                 $pdf->Cell($width1, $height, $row['cantidad_coti'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
                 $pdf->Cell($width1, $height, number_format($row['precio_unitario'], 2), 1, 0, 'R', false, '', 1, false, 'T', 'C');
                 $totalItem = number_format($row['cantidad_coti'] * $row['precio_unitario'], 2);
                 $pdf->Cell($width1, $height, $totalItem, 1, 0, 'R', false, '', 1, false, 'T', 'C');
                 $pdf->Cell($width1, $height, $row['cantidad_adju'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
                 $totalAdj = number_format($row['cantidad_adju'] * $row['precio_unitario'], 2);
                 $pdf->Cell($width1, $height, $totalAdj, 1, 0, 'R', false, '', 1, false, 'T', 'C');
             }
         }
         $pdf->Ln();
     }
 }
示例#2
0
 function writeDetalles(DataSource $dataSource, TCPDF $pdf, $tipo)
 {
     $blackAll = array('LTRB' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     $widthMarginLeft = 1;
     $width1 = 20;
     $width2 = 130;
     $pdf->Ln();
     $pdf->SetFontSize(7.5);
     $pdf->SetFont('', 'B');
     $height = 5;
     $pdf->SetFillColor(255, 255, 255, true);
     $pdf->setTextColor(0, 0, 0);
     $pdf->Cell($width1 - 5, $height, 'Cantidad', $blackAll, 0, 'L', true, '', 1, false, 'T', 'C');
     if ($tipo == 'Bien') {
         $pdf->Cell($width2, $height, 'Item', $blackAll, 0, 'l', true, '', 1, false, 'T', 'C');
     } else {
         if ($tipo == 'Bien - Servicio') {
             $pdf->Cell($width2, $height, 'Compra-Servicio', $blackAll, 0, 'l', true, '', 1, false, 'T', 'C');
         } else {
             $pdf->Cell($width2, $height, 'Servicio', $blackAll, 0, 'l', true, '', 1, false, 'T', 'C');
         }
     }
     $pdf->Cell($width1, $height, 'Precio Unitario', $blackAll, 0, 'C', true, '', 1, false, 'T', 'C');
     $pdf->Cell($width1, $height, 'Total Bs.', $blackAll, 0, 'C', true, '', 1, false, 'T', 'C');
     $pdf->Ln();
     $pdf->SetFontSize(6.5);
     $totalOrdenCompra = 0.0;
     foreach ($dataSource->getDataset() as $row) {
         $pdf->SetFont('', '');
         //$totalItem
         $pdf->Cell($width1 - 5, $height, $row['cantidad_adju'], 1, 0, 'L', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width2, $height, $row['desc_solicitud_det'], 1, 0, 'L', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width1, $height, number_format($row['precio_unitario'], 2), 1, 0, 'R', false, '', 1, false, 'T', 'C');
         $totalItem = $row['cantidad_adju'] * $row['precio_unitario'];
         $pdf->Cell($width1, $height, number_format($totalItem, 2), 1, 0, 'R', false, '', 1, false, 'T', 'C');
         $pdf->Ln();
         //var_dump($totalItem+$totalOrdenCompra);
         $totalOrdenCompra = $totalOrdenCompra + $totalItem;
         //var_dump($totalOrdenCompra);
         $obj = new Numbers_Words_es_AR();
         $numero = explode('.', number_format($totalItem, 2));
         $pdf->Cell($width2 + $width1 + $width1 / 2 + $width1 / 4, $height, 'SON: ' . strtoupper(trim($obj->toWords(str_replace(',', '', $numero[0])))) . ' ' . $numero[1] . '/' . '100 ' . strtoupper($this->getDataSource()->getParameter('moneda')), 1, 0, 'L', false, '', 1, false, 'T', 'C');
     }
     $pdf->Cell($width1, $height, number_format($totalOrdenCompra, 2), 1, 0, 'R', false, '', 1, false, 'T', 'C');
     $pdf->Ln();
 }
示例#3
0
 function writeDetalles(DataSource $dataSource, TCPDF $pdf)
 {
     $blackAll = array('LTRB' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     $blackSide = array('LR' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     $blackBottom = array('B' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     $blackTop = array('T' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     $widthMarginLeft = 1;
     $width1 = 15;
     $width2 = 25;
     $width3 = 20;
     $pdf->SetFontSize(7.5);
     $pdf->SetFont('', 'B');
     $height = 5;
     $pdf->Ln();
     foreach ($dataSource->getDataset() as $row) {
         $pdf->setFont('', 'B');
         $pdf->Cell($width2, $height, 'Código Partida', 0, 0, 'L', false, '', 0, false, 'T', 'C');
         $pdf->Cell($width2, $height, 'Nombre Partida', 0, 0, 'L', false, '', 0, false, 'T', 'C');
         $pdf->Cell($width2 * 3 + 10, $height, 'Centro de Costo', 0, 0, 'L', false, '', 0, false, 'T', 'C');
         $pdf->Cell($width2, $height, '', 0, 0, 'R', false, '', 0, false, 'T', 'C');
         $pdf->Cell($width2, $height, 'Disponibilidad', 0, 0, 'R', false, '', 0, false, 'T', 'C');
         $pdf->Ln();
         $pdf->setFont('', '');
         $pdf->Cell($width2, $height, $row['groupeddata'][0]['codigo_partida'], 0, 0, 'L', false, '', 0, false, 'T', 'C');
         $pdf->Cell($width2, $height, $row['groupeddata'][0]['nombre_partida'], 0, 0, 'L', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width2 * 3 + 10, $height, $row['groupeddata'][0]['desc_centro_costo'], 0, 0, 'L', false, '', 1, false, 'T', 'C');
         $xRef = $pdf->getX();
         $yRef = $pdf->getY();
         $pdf->Cell($width2, $height, $row['totalRef'], 0, 0, 'R', false, '', 0, false, 'T', 'C');
         if ($row['disponible'] == true) {
             $pdf->setTextColor(0, 0, 0);
             $pdf->Cell($width2, $height, 'DISPONIBLE', 0, 0, 'R', false, '', 0, false, 'T', 'C');
         } else {
             $pdf->setTextColor(255, 0, 0);
             $pdf->Cell($width2, $height, 'NO DISPONIBLE', 0, 0, 'R', false, '', 0, false, 'T', 'C');
         }
         $pdf->setTextColor(0, 0, 0);
         //$pdf->Cell($width2, $height, ($row['disponible']==true)?'DISPONIBLE':'NO DISPONIBLE', 0, 0, 'R', false, '', 0, false, 'T', 'C');
         $pdf->Ln();
         $pdf->setFont('', 'B');
         $pdf->Cell($width2 + $width1, $height, 'Concepto Gasto', $blackAll, 0, 'L', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width2 + 25, $height, 'Descripcion', $blackAll, 0, 'L', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width1, $height, 'Cantidad', $blackAll, 0, 'L', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width3, $height, 'Precio Unitario', $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width3, $height, 'Precio Total', $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width3, $height, 'Precio Ges. Act.', $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width3, $height, 'Precio Ges. Sig.', $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
         $pdf->Ln();
         $totalRef = 0;
         $totalGa = 0;
         $totalSg = 0;
         $xEnd = 0;
         $yEnd = 0;
         foreach ($row['groupeddata'] as $solicitudDetalle) {
             $pdf->setFont('', '');
             $pdf->Cell($width2 + $width1, $height, $solicitudDetalle['desc_concepto_ingas'], $blackSide, 0, 'L', false, '', 1, false, 'T', 'C');
             $pdf->Cell($width2 + 25, $height, $solicitudDetalle['descripcion'], $blackSide, 0, 'L', false, '', 1, false, 'T', 'C');
             $pdf->Cell($width1, $height, $solicitudDetalle['cantidad'], $blackSide, 0, 'R', false, '', 1, false, 'T', 'C');
             $pdf->Cell($width3, $height, number_format($solicitudDetalle['precio_unitario'], 2), $blackSide, 0, 'R', false, '', 1, false, 'T', 'C');
             $pdf->Cell($width3, $height, number_format($solicitudDetalle['precio_total'], 2), $blackSide, 0, 'R', false, '', 1, false, 'T', 'C');
             $pdf->Cell($width3, $height, number_format($solicitudDetalle['precio_ga'], 2), $blackSide, 0, 'R', false, '', 1, false, 'T', 'C');
             $pdf->Cell($width3, $height, number_format($solicitudDetalle['precio_sg'], 2), $blackSide, 0, 'R', false, '', 1, false, 'T', 'C');
             $totalRef = $totalRef + $solicitudDetalle['precio_total'];
             $totalGa = $totalGa + $solicitudDetalle['precio_ga'];
             $totalSg = $totalSg + $solicitudDetalle['precio_sg'];
             $pdf->Ln();
             $xEnd = $pdf->getX();
             $yEnd = $pdf->getY();
         }
         //$pdf->setXY($xRef,$yRef);
         //$pdf->Cell($width2, $height, $totalRef, 0, 0, 'R', false, '', 0, false, 'T', 'C');
         $pdf->setXY($xEnd, $yEnd);
         $pdf->Cell(185, $height, '', $blackTop, 1, 'L', false, '', 0, false, 'T', 'C');
         $pdf->setXY($xEnd, $yEnd);
         $pdf->Cell($width1 * 2 + $width2 * 2 + $width3 + 25, $height, '', '0', 0, 'R', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width3, $height, number_format($totalRef, 2), $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width3, $height, number_format($totalGa, 2), $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
         $pdf->Cell($width3, $height, number_format($totalSg, 2), $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
         $pdf->Ln($height * 2);
     }
 }