3. Archivo crear.php (en /administrador/facturas/) no esta asi el archivo crear-facturas esta has administrador <?php
require_once __DIR__.'/../../../modelo/val-admin.php';
require_once __DIR__.'/../../../modelo/datos-usuarios.php';

$mis_Usuarios = new misUsuarios();
$clientes = $mis_Usuarios->viewUsuariosCliente();
?>
<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sistema de Facturación</title>
    
    <!-- CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="../../../librerias/plugins/select2/css/select2.min.css" rel="stylesheet">
    <link href="../../../librerias/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.0/font/bootstrap-icons.css" rel="stylesheet">
    <link href="../../../librerias/indexDashBoard.css" rel="stylesheet">
    
    <style>
        .invoice-container {
            max-width: 800px;
            margin: 30px auto;
            padding: 20px;
            border: 1px solid #ddd;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
            background: white;
        }
        .service-item {
            border: 1px solid #eee;
            padding: 15px;
            margin-bottom: 15px;
            border-radius: 5px;
        }
        .totals-section {
            background: #f9f9f9;
            padding: 20px;
            border-radius: 5px;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div class="d-flex">
        <!-- Sidebar -->
        <div id="sidebar-container" class="bg-primary">
            <div class="logo">
                <img id="logo" src="../../../imagenes/logo-jaziz_sf.png" alt="Logo Jaziz Biológico">
            </div>
            <div class="menu">
                <a href="../reporte.php" class="d-block text-light p-3"><i class="bi bi-file-earmark-text-fill me-2"></i>Reportes</a>
                <a href="../calendario.php" class="d-block text-light p-3"><i class="bi bi-calendar me-2"></i>Calendario</a>
                <a href="../usuarios.php" class="d-block text-light p-3"><i class="bi bi-people-fill me-2"></i>Usuarios</a>
                <a href="../facturas-electronica.php" class="d-block text-light p-3 border-start border-3 border-warning"><i class="bi bi-receipt me-2"></i>Facturas</a>
            </div>
        </div>

        <!-- Main Content -->
        <div class="container-fluid d-block">
            <nav class="navbar navbar-expand-lg border-bottom">
                <div class="container-fluid">
                    <button class="navbar-toggler" type="button" onclick="mostrarOcultar(event)">
                        <span class="navbar-toggler-icon"></span>
                    </button>
                    <div class="collapse navbar-collapse">
                        <ul class="navbar-nav ms-auto mb-2 mb-lg-0">
                            <li class="nav-item">
                                <span class="nav-link">Crear Factura</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </nav>

            <div class="content p-4">
                <div class="invoice-container">
                    <div class="invoice-header row">
                        <div class="col-md-6">
                            <img src="../../../imagenes/logo-jaziz_sf.png" alt="Logo" style="height: 80px;">
                            <h3>Jaziz Biológico</h3>
                            <p>Nit: 123456789-0</p>
                            <p>Dirección: Calle 123 #45-67</p>
                            <p>Teléfono: (123) 456-7890</p>
                        </div>
                        <div class="col-md-6 text-end">
                            <h3>FACTURA #<span id="invoice-number"><?= date('YmdHis') ?></span></h3>
                            <p>Fecha: <span id="invoice-date"><?= date('d/m/Y') ?></span></p>
                            <div class="mb-3">
                                <label class="form-label">Cliente</label>
                                <select id="client-select" class="form-select">
                                    <option value="">Seleccione Cliente</option>
                                    <?php foreach($clientes as $cliente): ?>
                                        <option value="<?= $cliente['identificacion'] ?> - <?= $cliente['nombre'] ?>">
                                            <?= $cliente['identificacion'] ?> - <?= $cliente['nombre'] ?> <?= $cliente['apellido'] ?>
                                        </option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="mt-4">
                        <h4>Servicios</h4>
                        <div id="services-container">
                            <div class="service-item">
                                <div class="row">
                                    <div class="col-md-6">
                                        <label class="form-label">Servicio</label>
                                        <select class="form-select service-select" name="service[]">
                                            <option value="">Seleccione servicio</option>
                                        </select>
                                    </div>
                                    <div class="col-md-3">
                                        <label class="form-label">Cantidad</label>
                                        <input type="number" class="form-control quantity" name="quantity[]" min="1" value="1">
                                    </div>
                                    <div class="col-md-3">
                                        <label class="form-label">Valor Unitario</label>
                                        <input type="number" class="form-control unit-price" name="unit_price[]" min="0" step="0.01">
                                    </div>
                                </div>
                                <div class="row mt-2">
                                    <div class="col-12">
                                        <label class="form-label">Descripción</label>
                                        <textarea class="form-control description" name="description[]" rows="2"></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <button type="button" class="btn btn-secondary btn-sm" id="add-service-btn">
                            <i class="bi bi-plus"></i> Agregar servicio
                        </button>
                    </div>

                    <div class="totals-section">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="mb-3">
                                    <label class="form-label">Forma de pago</label>
                                    <select class="form-select" id="payment-method">
                                        <option value="contado">Contado</option>
                                        <option value="transferencia">Transferencia bancaria</option>
                                    </select>
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Observaciones</label>
                                    <textarea class="form-control" id="notes" rows="2"></textarea>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="text-end">
                                    <p>Subtotal: <span id="subtotal-display">$0.00</span></p>
                                    <p>IVA (19%): <span id="tax-display">$0.00</span></p>
                                    <h4>Total: <span id="total-display">$0.00</span></h4>
                                    <input type="hidden" id="subtotal" value="0">
                                    <input type="hidden" id="tax" value="0">
                                    <input type="hidden" id="total" value="0">
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="d-flex justify-content-between mt-4">
                        <button type="button" class="btn btn-light" id="preview-invoice-btn">
                            <i class="bi bi-printer"></i> Vista previa
                        </button>
                        <button type="button" class="btn btn-primary" id="generate-invoice-btn">
                            <i class="bi bi-file-earmark-text"></i> Generar factura
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- JavaScript -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://code.jquery.com/ui/1.13.1/jquery-ui.min.js"></script>
    <script src="../../../librerias/plugins/select2/js/select2.full.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <script src="../../../controlador/funciones-facturas.js"></script>
    
    <script>
    function mostrarOcultar(event) {
        event.preventDefault();
        const sidebar = document.getElementById('sidebar-container');
        sidebar.style.display = sidebar.style.display === 'none' ? 'block' : 'none';
    }
    </script>
</body>
</html> y este <?php
// Activar mostrar errores (solo para desarrollo)
error_reporting(E_ALL);
ini_set('display_errors', 1);

try {
    // Incluir solo el archivo necesario
    require_once '../modelo/val-admin.php';
    require_once '../modelo/datos-usuarios.php';
    
    // Verificar que la clase existe
    if (!class_exists('misUsuarios')) {
        throw new Exception("La clase misUsuarios no existe en datos-usuarios.php");
    }
    
    // Instanciar y obtener clientes
    $mis_Usuarios = new misUsuarios();
    $clientes = $mis_Usuarios->viewUsuariosCliente();
    
    if (!is_array($clientes)) {
        throw new Exception("Error al obtener clientes: el método no devolvió un array");
    }

} catch (Exception $e) {
    die("Error inicializando: " . $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="es">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sistema de Facturación</title>
    <link rel="stylesheet" href="../librerias/plugins/select2/css/select2.min.css">
    <link rel="stylesheet" href="../librerias/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="../librerias/indexDashBoard.css" rel="stylesheet" type="text/css" />
    <?php include 'librerias-css.php'; ?>
    <style>
        .invoice-container {
            max-width: 800px;
            margin: 30px auto;
            padding: 20px;
            border: 1px solid #ddd;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
            background: white;
        }
        .invoice-header {
            border-bottom: 1px solid #eee;
            margin-bottom: 20px;
            padding-bottom: 20px;
        }
        .invoice-logo {
            max-height: 100px;
        }
        .service-item {
            border: 1px solid #eee;
            padding: 15px;
            margin-bottom: 15px;
            border-radius: 5px;
        }
        .totals-section {
            background: #f9f9f9;
            padding: 20px;
            border-radius: 5px;
            margin-top: 20px;
        }
        .legal-text {
            font-size: 0.8em;
            color: #666;
            margin-top: 30px;
            border-top: 1px solid #eee;
            padding-top: 15px;
        }
        /* Estilo para el modal de vista previa */
        .preview-modal {
            max-width: 90%;
            width: 800px;
        }
        .preview-modal .modal-body {
            overflow-y: auto;
            max-height: 70vh;
        }
    </style>
</head>

<body>
    <div class="d-flex">
        <!-- Sidebar -->
        <div id="sidebar-container" class="bg-primary">
            <div class="logo">
                <img id="logo" src="../imagenes/logo-jaziz_sf.png" alt="Logo Jaziz Biológico">
            </div>
            <div class="menu">
                <a href="reporte.php" class="d-block text-light p-3"><i class="bi bi-file-earmark-text-fill me-2 lead"></i>Reportes</a>
                <a href="calendario.php" class="d-block text-light p-3"><i class="bi bi-calendar me-2 lead"></i>Calendario</a>
                <a href="usuarios.php" class="d-block text-light p-3"><i class="bi bi-people-fill me-2 lead"></i>Usuarios y empresa</a>
                <a href="mecanismo.php" class="d-block text-light p-3"><i class="bi bi-gear-fill me-2 lead"></i>Mecanismos</a>
                <a href="sustancias.php" class="d-block text-light p-3"><i class="bi bi-droplet-half me-2 lead"></i>Sustancias</a>
                <a href="crear_qr.php" class="d-block text-light p-3"><i class="bi bi-qr-code me-2 lead"></i>generador de QR</a>
                <a href="tipo_plagas.php" class="d-block text-light p-3"><i class="bi bi-bug-fill me-2 lead"></i>Tipo de plagas</a>
                <a href="facturas-electronica.php" class="d-block text-light p-3"><i class="bi bi-receipt me-2 lead"></i>Facturas eletronica</a>
            </div>
        </div>

        <!-- Main Content -->
        <div class="container-fluid d-block">
            <nav class="navbar navbar-expand-lg border-bottom">
                <div class="container-fluid">
                    <button class="navbar-toggler" type="button" onclick="mostrarOcultar(event)">
                        <span class="navbar-toggler-icon"></span>
                    </button>
                    <div class="collapse navbar-collapse">
                        <ul class="navbar-nav ms-auto mb-2 mb-lg-0">
                            <li class="nav-item">
                                <span class="nav-link">Sistema de Facturación</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </nav>

            <div class="content p-4">
                <!-- Factura Container -->
                <div class="invoice-container">
                    <div class="invoice-header row">
                        <div class="col-md-6">
                            <img src="../imagenes/logo-jaziz_sf.png" alt="Company Logo" class="invoice-logo">
                            <h2>Jaziz Biológico</h2>
                            <p>Nit: 123456789-0</p>
                            <p>Dirección: Calle 123 #45-67</p>
                            <p>Teléfono: (123) 456-7890</p>
                        </div>
                        <div class="col-md-6 text-end">
                            <h3>FACTURA #<span id="invoice-number"><?= date('YmdHis') ?></span></h3>
                            <p>Fecha: <span id="invoice-date"><?= date('d/m/Y') ?></span></p>
                            <div class="mb-3">
                                <label class="form-label">Cliente</label>
                                <select id="client-select" class="form-select" style="width: 100%;">
                                    <option value="">Seleccione Cliente</option>
                                    <?php foreach($clientes as $cliente): ?>
                                        <option value="<?= $cliente['identificacion'] ?>">
                                            <?= $cliente['nombre'] ?> <?= $cliente['apellido'] ?>
                                        </option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                        </div>
                    </div>

                    <!-- Servicios -->
                    <div id="services-container">
                        <h4>Servicios</h4>
                        
                        <!-- Servicio 1 -->
                        <div class="service-item">
                            <div class="row">
                                <div class="col-md-6">
                                    <label class="form-label">Servicio</label>
                                    <select class="form-select service-select" name="service[]">
                                        <option value="">Seleccione servicio</option>
                                        <option value="control_plagas">Control de plagas</option>
                                        <option value="desinfeccion">Desinfección</option>
                                        <option value="fumigacion">Fumigación</option>
                                        <option value="asesoria">Asesoría técnica</option>
                                    </select>
                                </div>
                                <div class="col-md-3">
                                    <label class="form-label">Cantidad</label>
                                    <input type="number" class="form-control quantity" name="quantity[]" min="1" value="1">
                                </div>
                                <div class="col-md-3">
                                    <label class="form-label">Valor Unitario</label>
                                    <input type="number" class="form-control unit-price" name="unit_price[]" min="0" step="0.01">
                                </div>
                            </div>
                            <div class="row mt-2">
                                <div class="col-12">
                                    <label class="form-label">Descripción</label>
                                    <textarea class="form-control description" name="description[]" rows="2"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Botón para agregar más servicios -->
                    <button type="button" class="btn btn-secondary btn-sm" id="add-service-btn">
                        <i class="bi bi-plus"></i> Agregar otro servicio
                    </button>

                    <!-- Totales -->
                    <div class="totals-section">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="mb-3">
                                    <label class="form-label">Forma de pago</label>
                                    <select class="form-select" id="payment-method">
                                        <option value="contado">Contado</option>
                                        <option value="transferencia">Transferencia bancaria</option>
                                    </select>
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Observaciones</label>
                                    <textarea class="form-control" id="notes" rows="2"></textarea>
                                </div>
                            </div>