<?php

session_start();
if (empty($_SESSION["nombre"])) {
    header("Location: ../");
}
include_once '../controller/cSistema.php';
$cSistema = new cSistema();
?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
	<meta charset="utf-8"/>
	<title>Temposatis</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
	<meta content="" name="description"/>
	<meta content="" name="author"/>
	<!-- BEGIN PACE PLUGIN FILES -->
	<script src="../assets/global/plugins/pace/pace.min.js" type="text/javascript"></script>
	<!-- <link href="../assets/global/plugins/pace/themes/pace-theme-flash.css" rel="stylesheet" type="text/css"/> -->
	<link href="../assets/global/plugins/pace/themes/pace-theme-barber-shop.css" rel="stylesheet" type="text/css"/>
	<!-- BEGIN GLOBAL MANDATORY STYLES -->
	<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
	<link href="../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
	<link href="../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>
<?php

if ($_POST) {
    include_once '../controller/cSistema.php';
    $cSistema = new cSistema();
    switch ($_POST['opcion']) {
        case 'getDolar':
            $datos = $cSistema->getDolar();
            while ($row = $datos->NextRow()) {
                $dolar = $row['valor'];
            }
            echo $dolar;
            break;
        case 'setDolar':
            try {
                $cSistema->setDolar($_POST['dolar']);
                $respuesta = array('respuesta' => 1);
                echo json_encode($respuesta);
            } catch (Exception $e) {
                $respuesta = array('error' => $e->getMessage());
                echo json_encode($respuesta);
            }
            break;
        case 'porcentajes':
            //regresa interes ordinario,comision apertura, manejo de cuenta y gastos de cobranza
            $datos = $cSistema->getPorcentajes();
            while ($row = $datos->NextRow()) {
                $respuesta = array('interes' => $row['interes'], 'apertura' => $row['apertura'], 'manejo_cuenta' => $row['manejo_cuenta'], 'cobranza' => $row['cobranza']);
            }
            echo json_encode($respuesta);
            break;
<?php

session_start();
// print_r( $_SESSION);
if (empty($_SESSION["nombre"])) {
    header("Location: ../");
}
if ($_SESSION['perfil'] == 1) {
    header("Location: ./consultarUsuarios.php");
}
include_once '../controller/cSistema.php';
$cSistema = new cSistema();
?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <meta charset="utf-8"/>
    <title>Temposatis</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
    <meta content="" name="description"/>
    <meta content="" name="author"/>
    <!-- BEGIN PACE PLUGIN FILES -->
    <script src="../assets/global/plugins/pace/pace.min.js" type="text/javascript"></script>
    <link href="../assets/global/plugins/pace/themes/pace-theme-flash.css" rel="stylesheet" type="text/css"/>
    <link href="../assets/global/plugins/pace/themes/pace-theme-barber-shop.css" rel="stylesheet" type="text/css"/>
<?php

session_start();
if (empty($_SESSION["nombre"])) {
    header("Location: ../");
}
include_once '../controller/cSistema.php';
$cSistema = new cSistema();
?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
	<meta charset="utf-8"/>
	<title>Temposatis</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
	<meta content="" name="description"/>
	<meta content="" name="author"/>
	<!-- BEGIN PACE PLUGIN FILES -->
	<script src="../assets/global/plugins/pace/pace.min.js" type="text/javascript"></script>
	<!-- <link href="../assets/global/plugins/pace/themes/pace-theme-flash.css" rel="stylesheet" type="text/css"/> -->
	<link href="../assets/global/plugins/pace/themes/pace-theme-barber-shop.css" rel="stylesheet" type="text/css"/>
	<!-- BEGIN GLOBAL MANDATORY STYLES -->
	<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
	<link href="../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
	<link href="../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>
<?php

if ($_POST) {
    include_once '../controller/cSistema.php';
    $cSistema = new cSistema();
    switch ($_POST['opcion']) {
        case 'validar':
            sleep(1);
            echo $cSistema->validar($_POST['email'], $_POST['pass']);
            break;
        case 'correo':
            //recuperacion de contrasenna
            $datos = $cSistema->recuperarContrasenna($_POST['correo']);
            while ($row = $datos->fetch_array(MYSQLI_ASSOC)) {
                $nombre = $row['paterno'] . " " . $row['materno'] . " " . $row['nombre'];
                $contra = $row['contra'];
            }
            $respuesta = array('nombre' => $nombre, 'correo' => $_POST['correo'], 'contra' => $contra);
            echo json_encode($respuesta);
            break;
        case 'updateEstatusComunicado':
            try {
                $cSistema->updateStatusComunicado($_POST['id_comunicado'], $_POST['estatus']);
                $respuesta = array('resultado' => 'correcto');
                echo json_encode($respuesta);
            } catch (Exception $e) {
                $respuesta = array('error' => $e->getMessage());
                echo json_encode($respuesta);
            }
            break;
        case 'getTablaComunicados':
<?php

include_once "../controller/cFiles.php";
include_once "../controller/cSistema.php";
$cSistema = new cSistema();
$cFiles = new cFiles();
try {
    $cFiles->setName($_POST['txtNombreAgregar'], 'archivo');
    // echo $cFiles->getName();
    $result = $cFiles->setFile('archivo', '../comunicados', true);
    if ($result == 1) {
        $cSistema->setComunicados($_POST['txtClienteAgregar'], $cFiles->getName(), 1, $_POST['txtTipoAgregar']);
        header("Location:../view/configurarcomunicados.php");
    } else {
        throw new Exception($result, 1);
    }
} catch (Exception $e) {
    echo $e->getMessage();
}