Example #1
0
     if ($bandera == 2) {
         $get->c_nombre = base64_decode($get->c_nombre);
         $get->c_descripcion = base64_decode($get->c_descripcion);
         if ($get->c_nombre != "" && $get->c_descripcion != "") {
             $result_c = "{{" . $get->c_nombre . ", " . $get->c_descripcion . "}}";
         } else {
             $vacio = true;
         }
     }
 }
 $data = $result_c;
 if ($get->referencia != "" && $get->nombre != "" && $get->descripcion != "" && $get->unidad != "" && $get->iva != "" && !$vacio) {
     $conexion = new Conexion();
     $operation = Materia_Prima::registrar($get->nombre, $get->descripcion, $data, $conexion);
     if ($operation['ejecution'] && $operation['result']) {
         $operation = Item::registrar($operation['returning']['id'], $get->referencia, $get->iva, $get->unidad, $get->tipo, $conexion);
         if ($operation['ejecution'] && $operation['result']) {
             $item = new Item($operation['returning']['id'], $conexion);
             $item->instanciarMateriaprima($conexion);
             $operation['message'] = "Se registro correctamente la informaciΓ³n.";
             $log = Log::registro($usuario->getID(), "info", "Registro de informaciΓ³n - Item. {" . $get->referencia . ", " . $get->iva . ", " . $get->unidad . ", " . $get->tipo . "}", $conexion);
             $log = Log::registro($usuario->getID(), "info", "Registro de informaciΓ³n - Materia Prima. {" . $get->nombre . ", " . $get->descripcion . ", " . $data . "}", $conexion);
         }
     }
     $_SESSION['item'] = serialize($item);
 } else {
     $operation['ejecution'] = true;
     $operation['result'] = false;
     $operation['message'] = "Por favor diligencie todos los campos del formulario.";
 }
 echo json_encode($operation);