Exemplo n.º 1
0
function insertarObjetoReparacion($username, $password, $reparacion)
{
    try {
        include_once $_SERVER['DOCUMENT_ROOT'] . "/repositorio/preparaBD.php";
        include_once $_SERVER['DOCUMENT_ROOT'] . "/dominio/Cliente.php";
        include_once $_SERVER['DOCUMENT_ROOT'] . "/repositorio/repositorioClientes.php";
        $conn = preparaBD($username, $password);
        $cliente_id = $reparacion->cliente_id;
        $reparacion_id = $reparacion->reparacion_id;
        $marcamodelo = $reparacion->marcamodelo;
        $imei = $reparacion->imei;
        $sim = $reparacion->sim;
        $funda = $reparacion->funda;
        $sd = $reparacion->sd;
        $cargador = $reparacion->cargador;
        $observaciones_previas = $reparacion->observaciones_previas;
        $presupuesto = $reparacion->presupuesto;
        $estado_de_presupuesto = $reparacion->estado_de_presupuesto;
        $plazoentrega = $reparacion->plazoentrega;
        $estado = $reparacion->estado;
        $operaciones_efectuadas = $reparacion->operaciones_efectuadas;
        $piezas_a_comprar = $reparacion->piezas_a_comprar;
        $fecha_fin_de_reparacion = $reparacion->fecha_fin_de_reparacion;
        $observaciones_y_recomendaciones = $reparacion->observaciones_y_recomendaciones;
        $tecnicos = $reparacion->tecnicos;
        $clienteEnBD = getClienteById($username, $password, $cliente_id);
        $exito = false;
        if ($clienteEnBD != null) {
            $query = 'INSERT INTO Reparaciones (cliente_id, marcamodelo, imei, sim, funda, sd, cargador, observaciones_previas, presupuesto, estado_de_presupuesto, plazoentrega, estado, operaciones_efectuadas, piezas_a_comprar, fecha_fin_de_reparacion, observaciones_y_recomendaciones, creado_por, tecnicos)
                      VALUES ("' . $cliente_id . '", "' . $marcamodelo . '", "' . $imei . '", ' . $sim . ', ' . $funda . ', ' . $sd . ', ' . $cargador . ', "' . $observaciones_previas . '", ' . $presupuesto . ', ' . $estado_de_presupuesto . ', "' . $plazoentrega . '", "' . $estado . '", "' . $operaciones_efectuadas . '", "' . $piezas_a_comprar . '", "' . $fecha_fin_de_reparacion . '", "' . $observaciones_y_recomendaciones . '", "' . $username . '", "' . $tecnicos . '") ';
            //echo $query;
            //$myfile = fopen("testfile.txt", "w");
            //fwrite($myfile, $query);
            $stmt = $conn->prepare($query);
            $exito = $stmt->execute();
            cerrarBD($conn);
        }
        return $exito;
    } catch (PDOException $e) {
        echo "Error: " . $e->getMessage();
    }
}
Exemplo n.º 2
0
<?php

/**
 * Created by PhpStorm.
 * User: MarcosAlberto
 * Date: 23/01/2016
 * Time: 18:31
 */
session_start();
$username = $_SESSION['username'];
$password = $_SESSION['password'];
$cliente_id = $_GET['id'];
include_once $_SERVER['DOCUMENT_ROOT'] . "/dominio/Cliente.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/repositorio/repositorioClientes.php";
$cliente = getClienteById($username, $password, $cliente_id);
?>
<html>
    <head>
        <?php 
include_once $_SERVER['DOCUMENT_ROOT'] . "/vistas/header.php";
?>
    </head>
<body>
    <header class="cabecera">
        <?php 
include_once $_SERVER['DOCUMENT_ROOT'] . "/vistas/barraMenu.php";
?>
    </header>
    <div id="main">

        <h2>Clientes</h2>
Exemplo n.º 3
0
    <h2>Lista de Reparaciones:</h2>
    <?php 
include_once $_SERVER['DOCUMENT_ROOT'] . "/dominio/Cliente.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/dominio/Reparacion.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/repositorio/repositorioClientes.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/repositorio/repositorioReparaciones.php";
$username = $_SESSION['username'];
$password = $_SESSION['password'];
echo "<table id=\"example\" class=\"display\" cellspacing=\"0\" width=\"100%\">";
echo "<thead>\n            <tr>\n                <th>Cliente</th>\n                <th>Modelo</th>\n                <th>Imei</th>\n                <th>Complementos</th>\n                <th>Observaciones</th>\n                <th>Presupuesto</th>\n                <th>Ok?</th>\n                <th>Plazo de Entrega</th>\n                <th>Estado</th>\n                <th>Operaciones hechas</th>\n                <th>Piezas a comprar</th>\n                <th>Fecha de entrega reparación</th>\n                <th>Técnicos</th>\n                <!--<th>Recomendaciones</th>-->\n                <th>Zona</th>\n                <th></th>\n            </tr>\n        </thead>";
echo "<tfoot>\n            <tr>\n                <th>Cliente</th>\n                <th>Modelo</th>\n                <th>Imei</th>\n                <th>Complementos</th>\n                <th>Observaciones</th>\n                <th>Presupuesto</th>\n                <th>Valorado?</th>\n                <th>Plazo de Entrega</th>\n                <th>Estado</th>\n                <th>Operaciones hechas</th>\n                <th>Piezas a comprar</th>\n                <th>Fecha de entrega reparación</th>\n                <th>Tecnicos</th>\n                <!--<th>Recomendaciones</th>-->\n                <th>Zona</th>\n                <th></th>\n            </tr>\n        </tfoot>";
$array = getReparaciones($username, $password);
echo "<tbody>";
foreach ($array as $clave => $valor) {
    $cliente_id_iterador = $valor->getClienteId();
    $cliente = getClienteById($username, $password, $cliente_id_iterador);
    $nombreCliente = $cliente->getNombre();
    $funda = $valor->getfunda();
    $sd = $valor->getsd();
    $sim = $valor->getsim();
    $cargador = $valor->getcargador();
    $iconoFunda = '<img class="iconoFunda" src="../images/funda.png"/>';
    $iconoSd = '<img class="iconoComplemento" src="../images/sd.png"/>';
    $iconoSim = '<img class="iconoSd" src="../images/sim.png"/>';
    $iconoCargador = '<img class="iconoComplemento" src="../images/cargador.png"/>';
    $iconos = "";
    if ($funda) {
        $iconos = $iconos . $iconoFunda;
    }
    if ($sim) {
        $iconos = $iconos . $iconoSim;
Exemplo n.º 4
0
<?php

/**
 * Created by PhpStorm.
 * User: MarcosAlberto
 * Date: 15/01/2016
 * Time: 23:14
 */
//    echo phpinfo();
$username = "******";
$password = "******";
chdir($_SERVER['DOCUMENT_ROOT']);
// echo $_SERVER['DOCUMENT_ROOT'];
include_once $_SERVER['DOCUMENT_ROOT'] . "/repositorio/repositorioClientes.php";
$array = getClientes($username, $password);
foreach ($array as $clave => $valor) {
    $valor->imprimeCliente();
}
$cliente = getClienteById($username, $password, 1);
$cliente->imprimeCliente();
Exemplo n.º 5
0
<?php

$tipo = filter_input(INPUT_POST, "function");
switch ($tipo) {
    case "getClienteById":
        getClienteById(intval(filter_input(INPUT_POST, "idCliente")));
        break;
    case "getDetallePaquete":
        $idPaquete = filter_input(INPUT_POST, "idPaquete");
        $tipoPoliza = filter_input(INPUT_POST, "tipoPoliza");
        getDetallePaquete($idPaquete, $tipoPoliza);
        break;
    case "getOrdenById":
        $idOrden = filter_input(INPUT_POST, "idOrden");
        getOrdenById($idOrden);
        break;
    case "getDetallePaqueteByOrden":
        $idOrden = filter_input(INPUT_POST, "idOrden");
        getDetallePaqueteByOrden($idOrden);
        break;
    case "getAgenteByIdAgente":
        $idAgente = filter_input(INPUT_POST, "idAgente");
        getAgenteByIdAgente($idAgente);
        break;
    default:
        break;
}
function getClienteById($idCliente)
{
    $query = "SELECT * FROM cliente WHERE idCliente = {$idCliente}";
    include './dataBaseClass/connection.php';
Exemplo n.º 6
0
<?php

include "db.php";
include "clienteDaoTest.php";
if ($_SERVER['REQUEST_METHOD'] == "GET") {
    if ($_GET["id"]) {
        return getClienteById($db, $_GET["id"]);
    } else {
        return getClientes($db);
    }
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    $postdata = file_get_contents("php://input");
    $request = json_decode($postdata);
    return saveCliente($db, $request);
}
if ($_SERVER['REQUEST_METHOD'] == "PUT") {
    $postdata = file_get_contents("php://input");
    $request = json_decode($postdata);
    return updateCliente($db, $request);
}