<?php
include('../../validadores/validarSession.php');
include('../StoGlobal/include/conexion.php');
include('../StoGlobal/include/conexion1.php');
include('../StoGlobal/include/conexion3.php');
error_reporting(0);


$idCot=$_GET['id_cot'];

if($idCot!=null){
    // $stmt1 = $conexion->prepare("SELECT id_cotizacion FROM desert_cotizacion where id_cotizacion='".$idCot."'");
    // $stmt1->execute();
    // //se obtiene un arreglo asociativo
    // $result = $stmt1->setFetchMode(PDO::FETCH_ASSOC);
    // $a = $stmt1->fetchAll();
    // foreach($a as $fila){
    //     foreach ($fila as $clave => $valor){
    //         $pid = intval($valor);
    //         $query = "DELETE FROM desert_cotizacion_items WHERE id_cotizacion=:pid";
    //         $stmt1 = $DBcon->prepare( $query );
    //         $stmt1->execute(array(':pid'=>$pid));
            
    //     }
    // }

    $pid = intval($idCot);
    $query = "DELETE FROM sto_cotizacion_items WHERE id_cotizacion=:pid";
    $stmt1 = $DBcon->prepare( $query );
    $stmt1->execute(array(':pid'=>$pid));
}

if($idCot!=null){
    $pid = intval($idCot);
    $query = "DELETE FROM sto_cotizacion WHERE id_cotizacion=:pid";
    $stmt = $DBcon->prepare( $query );
    $stmt->execute(array(':pid'=>$pid));
}

    echo "<script languaje='javascript' type='text/javascript'>window.close();</script>";
    // header("location:index.php");

?>