<?php

/**
 * 	Dear developer!
 *	Never modify events.php file, it is autogenerated.
 *  Modify PHP/EventTemplates/events.txt instead.
 *
 */

 class eventclass_pro_ganador  extends eventsBase
{
	function __construct()
	{
	// fill list of events


		$this->events["AfterAdd"]=true;

		$this->events["AfterEdit"]=true;


	}

//	handlers

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// After record added
function AfterAdd(&$values, &$keys, $inline, $pageObject)
{

		

//**********  Insert a record into another table  ************

$data = array();
$data["GANADOR"] = $values["id_ganador"];
$data["NO_FACTURA"] = (1000000000+$values["id_ganador"]);
$data["PLACA"] = $values["placa"];
$data["VOLUMEN"] = (-1*$values["monto_premio"]);
$data["USUARIO"] = $_SESSION["UserID"];
$data["FECHA"] = now();
$data["ID_PROMOCION"] = $values["id_promocion"];



DB::Insert("pro_ventas", $data );








$data2 = array();
$data2["no_Factura"] = $values["id_ganador"];
$data2["no_placa"] = $values["placa"];
$data2["volumen"] = (-1*$values["monto_premio"]);


DB::Insert("pro_registro", $data2 );
















;		
} // function AfterAdd

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
				// After record updated
function AfterEdit(&$values, $where, &$oldvalues, &$keys, $inline, $pageObject)
{

		
//**********  Insert a record into another table  ************

$data = array();
$data["GANADOR"] = $values["id_ganador"];
$data["NO_FACTURA"] = (1000000000+$values["id_ganador"]);
$data["PLACA"] = $values["placa"];
$data["VOLUMEN"] = (-1*$values["monto_premio"]);
DB::Insert("pro_ventas", $data );




$data2 = array();
$data2["no_Factura"] = $values["id_ganador"];
$data2["no_placa"] = $values["placa"];
$data2["volumen"] = (-1*$values["monto_premio"]);
DB::Insert("pro_registro", $data2 );

;		
} // function AfterEdit

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		



}
?>
