public function getArticulosExternos($oc) { //Obtener No. de Requisición a partir de OC $oc = Oc::whereOc($oc)->get(array('req')); $arr_req = $oc->lists('req'); $req = $arr_req[0]; $articulos = DB::connection('sgf14')->table('tbl_req_art')->leftJoin('tbl_articulos', 'tbl_articulos.art_id', '=', 'tbl_req_art.art_id')->where('req', '=', $req)->get(array('art_count', 'art', 'esp', 'cantidad', 'costo', 'impuesto', 'monto', 'unidad')); return $articulos; }
public function formato($id) { $salida = Salida::find($id); $entrada = Entrada::find($salida->entrada_id); if ($entrada->ref_tipo == 'OC') { $oc = Oc::whereOc($entrada->ref)->get(); } $articulos = SalidaArticulo::whereSalidaId($id)->get(); $artEntrada = EntradaArticulo::whereEntradaId($salida->entrada_id)->get(array('costo', 'impuesto')); $data['tipo_formato'] = 'Salida'; $data['req'] = $oc[0]->req; $data['ref_tipo'] = $entrada->ref_tipo; $data['ref'] = $entrada->ref; $data['fecha_oc'] = $oc[0]->fecha_oc; $data['d_proveedor'] = $entrada->proveedor->d_proveedor; $data['id'] = $id; $data['fecha'] = $salida->fecha_salida; $data['d_urg'] = $entrada->urg->d_urg; $data['cmt'] = $salida->cmt; $data['usr_id'] = $entrada->usr_id; $sum_total = 0; $fpdf = new EntradaSalidaPdf($data); $fpdf->AddPage(); //Artículos $fpdf->SetFont('Arial', '', 10); $fpdf->Cell(20, 5, utf8_decode('Código'), 'TB', 0, 'C'); $fpdf->Cell(90, 5, utf8_decode('Descripción'), 'TB', 0, 'C'); $fpdf->Cell(20, 5, 'Cantidad', 'TB', 0, 'C'); $fpdf->Cell(30, 5, 'Precio Unitario', 'TB', 0, 'C'); $fpdf->Cell(30, 5, 'Total', 'TB', 1, 'C'); foreach ($articulos as $art) { $i = 0; $y_inicial = $fpdf->GetY(); $fpdf->SetX(30); $fpdf->MultiCell(90, 4, utf8_decode($art->articulo->articulo), 0, 'L'); $y_final = $fpdf->GetY(); $h_renglon = $y_final - $y_inicial; $fpdf->SetY($y_inicial); $fpdf->Cell(20, $h_renglon, $art->id, 0, 0, 'C'); $fpdf->SetXY(120, $y_inicial); $fpdf->Cell(20, $h_renglon, number_format($art->cantidad), 0, 0, 'C'); $fpdf->Cell(30, $h_renglon, number_format($artEntrada[$i]->costo, 2), 0, 0, 'C'); $fpdf->Cell(30, $h_renglon, number_format($artEntrada[$i]->costo * $art->cantidad, 2), 0, 2, 'R'); $sum_total += $artEntrada[$i]->costo * $art->cantidad; $i++; } $fpdf->Cell(30, 5, number_format($sum_total, 2), 'T', 2, 'R'); return View::make($fpdf->Output()); }
<?php include "../librerias.php"; $objOc = new Oc($_POST["txtestado"], $_POST["txtfec"], 0, 0, $_POST["txtoc"]); $objOc->Agregar(); // Se muestra mensaje de exito echo "Registro Agregado <br/>"; echo "<br/>Estado OC: " . $_POST["txtestado"]; echo "<br/>Fecha OC: " . $_POST["txtfec"]; echo "<br/>Total OC: " . $_POST["txtoc"]; echo "<br /><a href='index.php'>Aceptar</a>";
<?php $oOc = new Oc(); ?> <form name="frmdatos" method="post" action="Oc_upd.php"> <input type="hidden" name="hidcodigo" id="hidcodigo" value="" /> <table style="width:700px;"> <tr> <td colspan="5" height="30" valign="middle" align="center" style="color:#ffffff;background-color:#ff5512;">Orden de Compra</td> </tr> <tr style="background-color:#d8d8b1;"> <td>Estado</td> <td>Fecha</td> <td>nbsp;</td> <td>nbsp;</td> <td>Total</td> </tr> <?php while ($Registro = $oOc->Selecciona()) { ?> <tr> <td><?php echo $Registro->getEstado(); ?> </td> <td><?php echo $Registro->getFechaemi(); ?> </td> <td align="center"><a href="#" onclick="<?php echo "javascript:editar(" . $Registro->getIdoc() . ");";
<?php include 'valida_acceso.php'; // Lee datos del registro a editar $oOc = new Oc(); if (isset($_POST["hidcodigo"])) { $oOc->setIdoc($_POST["hidcodigo"]); $Registro = $oOc->LeerRegistro(); } else { echo "Código no especificado."; exit; } ?> <!doctype html> <html lang=''> <head> <meta charset='utf-8'> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="css/styles.css"> <script src="js/jquery-1.11.2.min.js" type="text/javascript"></script> <title>Editar OC</title> </head> <body> <?php include 'menu.php'; ?> <div style="text-align: center;width:100%"> <br/> <form id="frmdatos" method="post"> <table style="width:400px;">
<?php include "../librerias.php"; // Se crea objeto producto con la informacion del formulario y se agrega a bd $objOc = new Oc($_POST["txtestado"], $_POST["txtfec"], $_POST["hidid"], $_POST["hidid2"], $_POST["txtoc"]); $objOc->Actualizar(); // Se muestra mensaje de exito echo "Registro Actualizado <br/>"; echo "<br/>Id: " . $_POST["hidid"]; echo "<br/>Estado : " . $_POST["txtdescripcion"]; echo "<br /><a href='Oc_lst.php'>Aceptar</a>";