public function destroy($id)
 {
     $validacion = Validation::find($id);
     $anexo = $validacion->anexo22_id;
     $result = Validation::destroy($id);
     return Response::json($anexo);
 }
Пример #2
0
 public function show($referen)
 {
     $empresa = Session::get('empresa');
     Checklist::where('chk_referen', $referen)->delete();
     $documentos = \DB::connection('master')->table('mdb_tipodocum')->select('doc_clave', 'doc_nombre')->get();
     foreach ($documentos as $doc) {
         $result = Result::where('res_referen', $referen)->first();
         if (!empty($result)) {
             $validacion = Validation::where('attribute_id', 9)->where('id', $result->validations_id)->whereRaw('SUBSTRING_INDEX(val_data, "|", 1) = ' . $doc->doc_clave)->count();
             if ($validacion > 0) {
                 $imagen = \DB::connection('users')->table('opauimg')->where('pk_referencia', $referen)->where('imgtipodoc', $doc->doc_clave)->count();
                 if ($imagen > 0) {
                     $check = 1;
                 } else {
                     $check = 0;
                 }
             } else {
                 $check = 2;
             }
         } else {
             $check = 0;
         }
         $data = ["chk_referen" => $referen, "chk_document" => $doc->doc_nombre, "chk_status" => $check, "chk_company" => $empresa];
         Checklist::create($data);
     }
     $result = Checklist::where('chk_company', $empresa)->get();
     return view('list_document')->with(['document' => $result, 'referen' => $referen]);
 }
Пример #3
0
 public function checkPedimento($referen, $valorOrigen)
 {
     if ($valorOrigen['entrada'] == 1) {
         $pk_referencia = $referen->pk_referencia;
         $tabla = 'optr02';
         $camposel1 = 'pk_factura';
         $camposel2 = 'pk_cove';
         $campow = 'pk_referencia';
     } else {
         $pk_referencia = $referen->folio_ds;
         $tabla = 'ds505';
         $camposel1 = 'NumeroFactura';
         $camposel2 = 'NumeroFactura';
         $campow = 'folio_ds';
     }
     //Recorrer campos del Anexo 22
     $anexo = Anexo22::all();
     foreach ($anexo as $anx) {
         //Checar validaciones por campo
         foreach ($anx->validations as $val) {
             $valid = $val->id;
             $camposbd = $anx->relationships->where('origin_id', $valorOrigen['entrada'])->first();
             $data = ["tabla" => $camposbd->table, "campos" => $camposbd->field, "attr_id" => $val->attribute_id, "data_val" => $val->val_data, "anx_id" => $anx->id, "entrada" => $valorOrigen['entrada'], "referencia" => $pk_referencia];
             $validacion = new Validation();
             $valor = $validacion->isValid($data);
             if ($valor == 0) {
                 if ($val->attribute_id == 9) {
                     $docum = 1;
                 } else {
                     $docum = 0;
                 }
                 $datos = ["res_referen" => $pk_referencia, "validations_id" => $valid, "res_document" => $docum, "res_company" => Session::get('empresa'), "res_user" => Session::get('usuario')];
                 $totalres = Result::where('res_referen', $pk_referencia)->where('validations_id', $valid)->count();
                 if ($totalres == 0) {
                     Result::create($datos);
                 }
             }
         }
     }
     $factura = \DB::connection('users')->table($tabla)->where($campow, $pk_referencia)->first();
     $cove = $this->checkCove($factura, $camposel1, $camposel2, $pk_referencia);
     echo $cove;
 }
Пример #4
0
 public static function insertDocument($request)
 {
     $result = Result::find($request->results_id);
     $result->res_status = 1;
     $result->save();
     $validacion = Validation::find($result->validations_id);
     $data = explode('|', $validacion->val_data);
     $documento = \Input::file('document');
     $nombre = $result->res_referen . '_' . $data[0];
     $dir = '../../public_html/clientes/ftp/' . Session::get('empresa') . '/pdf/';
     if (null === $documento) {
         $documento->move($dir, $nombre);
     }
     $nombredoc = \DB::connection('master')->table('mdb_tipodocum')->where('doc_clave', $data[0])->first();
     \DB::connection('users')->table('opauimg')->insert(['pk_referencia' => $result->res_referen, 'imgNameFile' => $nombre, 'strImageName' => $nombredoc->doc_nombre, 'imgtipo' => 'application/pdf', 'imgtipodoc' => $data[0]]);
 }
Пример #5
0
<?php

namespace App\Modules\mod_booking;

use App\Validation;
use App\Booking;
use App\Rooms;
$fields = Validation::NotEmpty($_POST);
if ($fields && isset($_POST['submit'])) {
    $fields_array = Validation::Filter($fields);
    if ($fields_array) {
        Booking::Insert($fields_array);
        header("Location: index.php?pid=3");
    }
}
?>
<div class="wrapper">			
	<div id="form_container">
		<form id="bookForm"  method="post" action="" class="validate">
			<div class="form_description">
				<h2>Hotel Reservation</h2>
			</div><!-- END of Book_Form -->

			<hr>
			<div class="form_element">
				<label class="labels" for="name">Firstname: </label>
				<input id="firstname" name="firstname"  type="text" maxlength="255" 
				value="" title ="Firstname required" /> 
			</div> 

			<div class="form_element">
Пример #6
0
 public function action_message()
 {
     if (Users::login()) {
         $user = Users::factory();
         $valid = Validation::factory($_POST);
         $valid->rule('fio', 'alpha', 0)->rule('phone', 'digit', 0);
         if ($valid->check()) {
             $this->header('Content-type', 'application/json')->body(json_encode(array('error' => !$user->message())));
         } else {
             $this->header('Content-type', 'application/json')->body(json_encode(array('error' => true, 'message' => 'data')));
         }
     } else {
         throw new HTTP_Exception(401);
     }
 }