Skip to content

Instantly share code, notes, and snippets.

@c3media c3media/On delete event.php Secret
Last active Dec 9, 2019

Embed
What would you like to do?
function delete_budget($data)
{
date_default_timezone_set('America/Bogota');
//$data["params"]["date"] = date("Y-m-d H:i:s");
$client_id = $data["params"]["tickets_id"];
$budget_id = $data["params"]["id"];
global $g;
/* Code to show errors
ob_start();
print_r($data);
$str = ob_get_clean();
phpgrid_error($str);
*/
$restic = $g->execute_query("select id, tickets_id, total from ticket_budget WHERE id = '$budget_id'");
#phpgrid_error($h->con->errormsg());
$arrtic = $restic->GetRows();
#phpgrid_error($arr);
$tickets_id = $arrtic[0]["tickets_id"];
$total_delete = $arrtic[0]["total"];
$restica = $g->execute_query("select id, ticket_budget_total from tickets WHERE id = '$client_id'");
#phpgrid_error($h->con->errormsg());
$arrtica = $restica->GetRows();
#phpgrid_error($arr);
$ticket_budget_total = $arrtica[0]["ticket_budget_total"];
$total_budget = $ticket_budget_total - $total_delete;
$g->execute_query("UPDATE tickets SET ticket_budget_total = '$total_budget' WHERE id = '$client_id'");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.