<?php
include_once("utiles.php");
//include_once("apt_funciones.php");

date_default_timezone_set("America/Panama");
//error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
error_reporting(E_ALL);

if (!$connection = connectDb()) {
    die("err db");
} else {
    $connection->query("SET NAMES 'utf8';");
}
session_start();

$_SESSION["datab_dest"] = $_POST["datab_dest"];

$cDb_Des = $_SESSION["datab_dest"];

$hoynow = getdate();
$timeStamp = $hoynow["year"] . "-" . $hoynow["mon"] . "-" . $hoynow["mday"];
$timeStamp = date("Y-m-d H:i:s");

if ($SaveLog == 1) {
    logs2('', false);
    logs2('+++++++++++++++++++++++++++++++++++++++++++++++++gen_get_windpos.php++++++++++++++++++++++++++++++++++++++++++');
    logs2('Destino : ' . $cDb_Des);
    logs2('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
    logs2('', false);
}

$sql='UPDATE '.$cDb_Des.'.clientes cl SET cl.usermodify=1';
mysqli_query($connection, $sql);

/*
Desconectado por peticion del cliente
$sql='UPDATE '.$cDb_Des.'.productos pr SET usermodify=1 WHERE (1=1)';
mysqli_query($connection, $sql);
*/

/*
descontinuado
$sql='UPDATE '.$cDb_Des.'.productos_det cl SET cl.usermodify=1 WHERE (IFNULL(cl.aplica_pos,0)=1)';
mysqli_query($connection, $sql);
*/

$sql='UPDATE '.$cDb_Des.'.personal pe SET pe.usermodify=1';
//mysqli_query($connection, $sql);

$sql='UPDATE '.$cDb_Des.'.productos_prom pm SET pm.usermodify =1 WHERE (pm.prom_inact=0) AND ( (NOW() > pm.prom_fechai) AND (NOW() < pm.prom_fechaf) )'; 
mysqli_query($connection, $sql);

$sql='UPDATE '.$cDb_Des.'.tipo_pago tp SET tp.usermodify=1';
mysqli_query($connection, $sql);

$sql='UPDATE '.$cDb_Des.'.wind_pos wp SET wp.usermodify=1';
mysqli_query($connection, $sql);

$sql='UPDATE '.$cDb_Des.'.estaciones_global_conf cg SET cg.usermodify=1';
mysqli_query($connection, $sql);

$sql='UPDATE '.$cDb_Des.'.tipo_sales ts SET ts.usermodify=1';
mysqli_query($connection, $sql);

$sql='UPDATE '.$cDb_Des.'.depositos dp SET dp.usermodify=1';
//mysqli_query($connection, $sql);

$sql='UPDATE '.$cDb_Des.'.tipo_desc td SET td.usermodify=1';
mysqli_query($connection, $sql);

$sql='UPDATE '.$cDb_Des.'.transport tr SET tr.usermodify=1';
mysqli_query($connection, $sql);

echo true;

@mysqli_close($connection);
//*creado por johnn gutierres 2021-05-31        */
//*modificado: 2021-06-03                       */
//*modificado: 2021-08-16                       */