function reporteKardexProduccion() { $txtFechaInicio = $_REQUEST['txtFechaInicio']; $txtFechaFinal = $_REQUEST['txtFechaFinal']; $idProducto = $_REQUEST['idProducto']; $idTipoMovimiento = $_REQUEST['idTipoMovimiento']; $idTipoOperacion = $_REQUEST['idTipoOperacion']; $txtDescripcion = $_REQUEST['txtDescripcion']; $reporte = $this->AutoLoadModel('reporte'); $datos = $reporte->reporteKardexProduccion($txtFechaInicio, $txtFechaFinal, $idProducto, $idTipoMovimiento, $idTipoOperacion); $cantidadData = count($datos); $pdf = new PDF_MC_Table("L", "mm", "A4"); $titulos = array('#', 'FECHA', 'T. MOV.', 'CONCEPTO', 'ORDEN', 'RAZON SOCIAL', 'DEVOLUCION', 'PRECIO', 'CANT. ', 'SALDO', 'IMPORTE S/.'); $pdf->SetFont('Helvetica', 'B', 7.5); $ancho = array(8, 18, 20, 30, 18, 70, 20, 20, 15, 15, 20); $orientacion = array('', 'C', 'C', '', 'C', '', 'C', 'R', 'C', 'C', 'R'); $tipoCambioVentas = $this->configIni($this->configIni('Globals', 'Modo'), 'TipoCambio'); $pdf->SetWidths($ancho); if (!empty($txtFechaFinal) || !empty($txtFechaInicio)) { $fecha1 = !empty($txtFechaInicio) ? $txtFechaInicio : utf8_decode('?'); $fecha2 = !empty($txtFechaFinal) ? $txtFechaFinal : utf8_decode('?'); $pdf->_fecha = 'Rango Fecha: ' . $fecha1 . ' - ' . $fecha2; } $pdf->_titulo = "REPORTE::KARDEX DE PRODUCCION"; $pdf->_datoPie = $txtDescripcion . ' ' . 'Impreso el :' . date('Y-m-d H:m:s'); $pdf->AddPage(); $pdf->_titulos = $titulos; $relleno = true; $pdf->fill($relleno); $pdf->SetFillColor(0224, 235, 255); $pdf->SetTextColor(0); $pdf->SetDrawColor(12, 78, 139); $pdf->SetLineWidth(0.3); $pdf->_orientacion = $orientacion; $pdf->SetAligns($orientacion); $pdf->SetTitulos($titulos); $pdf->SetFillColor(0224, 235, 255); $pdf->SetTextColor(0); $pdf->SetDrawColor(12, 78, 139); $importeFactura = 0; $importeBoleta = 0; for ($i = 0; $i < $cantidadData; $i++) { $modoFactura = ""; $fila = array($i + 1, $datos[$i]['fecha'], $datos[$i]['tipo movimiento'], $datos[$i]['concepto movimiento'], $datos[$i]['codigov'], html_entity_decode($datos[$i]['razon social'], ENT_QUOTES, 'UTF-8'), $datos[$i]['devolucion'], number_format($datos[$i]['precio'], 2), $datos[$i]['cantidad'], $datos[$i]['saldo'], number_format(round($datos[$i]['precio'], 2) * $datos[$i]['cantidad'], 2)); $pdf->Row($fila); $relleno = !$relleno; $pdf->fill($relleno); } $pdf->AliasNbPages(); $pdf->Output(); }
$inicio = strtotime("{$anio}-{$mes}-{$dia} 12:00am"); $inicio += (1 - $sdia) * 86400; $fin = $inicio + 6 * 86400; $inicio = date('d-m-Y', $inicio); $fin = date('d-m-Y', $fin); // Consultamos el tutor del grupo $result = mysqli_query($db_con, "SELECT TUTOR FROM FTUTORES WHERE unidad='{$unidad}'"); $tutor = mysqli_fetch_array($result); mysqli_free_result($result); // Impresi�n de la cabecera $pdf->SetFont('NewsGotT', 'B', 10); $pdf->Cell(96, 5, "PARTE DE FALTAS DEL GRUPO {$unidad}", 0, 0, 'L'); $pdf->Cell(81, 5, "SEMANA: _______________________", 0, 0, 'C'); $pdf->Cell(96, 5, "TUTOR/A: {$tutor['0']}", 0, 1, 'R'); $pdf->Ln(1); $pdf->SetLineWidth(0.6); // Grosor de linea for ($i = 0; $i < 6; $i++) { $pdf->Line(74 + 42 * $i, 16.2, 74 + 42 * $i, 16 + 10); } $pdf->SetLineWidth(0.2); // Grosor por defecto // PRIMERA FILA $pdf->SetFont('NewsGotT', 'B', 10); $pdf->SetWidths(array(63, 42, 42, 42, 42, 42)); $pdf->SetAligns(array('L', 'C', 'C', 'C', 'C', 'C')); $pdf->Row(array('', 'LUNES', 'MARTES', 'MIÉRCOLES', 'JUEVES', 'VIERNES')); // SEGUNDA FILA $pdf->SetWidths(array(8, 55, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7)); $pdf->SetAligns(array('C', 'L', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C')); $pdf->Row(array('#', 'Alumno/a', '1', '2', '3', '4', '5', '6', '1', '2', '3', '4', '5', '6', '1', '2', '3', '4', '5', '6', '1', '2', '3', '4', '5', '6', '1', '2', '3', '4', '5', '6'));
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. No technical support is available for any of this source code. In general, you must modify and test this code before incorporating it into your programs. Warning: Some code contains mistakes or deliberately incorrect coding for the purpose of serving as an example for the book. Please read the book carefully to determine which code is suitable for reuse in your own applications. Copyright 2013 Marc J. Rochkind. All rights reserved. May be copied and used under the BSD-type license at http://basepath.com/aup/copyright.htm. */ require_once 'lib/fpdf17/fpdf.php'; require_once 'lib/fpdf-plus/mc_table.php'; $in = fopen('data/cwa_panels.csv', 'r'); $pdf = new PDF_MC_Table('L', 'pt', array(300, 500)); $pdf->SetFont('Helvetica', '', 7); $pdf->SetLineWidth(0.1); $pdf->SetMargins(30, 20); $pdf->SetAutoPageBreak(true, 20); $pdf->SetHorizontalPadding(2); $pdf->SetVerticalPadding(3); $pdf->SetStyles(array('', 'B', 'B', '', '', 'I')); $pdf->AddPage(); $pdf->SetWidths(array(70, 50, 50, 70, 40, 140)); $pdf->SetAligns(array('R', 'C', 'C', 'C', 'C', 'L')); while ($row = fgetcsv($in)) { $pdf->RowX($row); } $pdf->Output();