<?php
class eventclass_derechos_no_vigentes  extends TableEventsBase {
	
	function init() {
		$this->events = array(
			'BeforeAdd' => true,
			'BeforeEdit' => true,
			'OnPageLoad' => true,
			'AfterImport' => true,
			'AfterAdd' => true,
			'AfterEdit' => true 
		);
		$this->fieldValues = array(
			'filterLimit' => array(
				 
			),
			'mapIcon' => array(
				 
			),
			'viewCustom' => array(
				 
			),
			'lookupWhere' => array(
				 
			),
			'viewFileText' => array(
				 
			),
			'defaultValue' => array(
				'fecha_Emision' => array(
					'edit' => true 
				),
				'fecha_Inscripcion' => array(
					'edit' => true 
				) 
			),
			'autoUpdateValue' => array(
				 
			),
			'uploadFolder' => array(
				 
			),
			'viewPluginInit' => array(
				 
			),
			'editPluginInit' => array(
				 
			) 
		);
			}
		function BeforeAdd( &$values, &$sqlValues, &$message, $inline, $pageObject ) {
			
	
	require __DIR__ . '/../app/number/convert2.php';
	
	
	return true;
			;
			return true;
		}
	
		function BeforeEdit( &$values, &$sqlValues, $where, &$oldvalues, &$keys, &$message, $inline, $pageObject ) {
			
	
	require __DIR__ . '/../app/number/convert2.php';
	
	return true;
	
	
	
			;
			return true;
		}
	
		function AfterImport( $count, $skipCount, $pageObject ) {
			$data = array();
	$data["id_constitucion"] = $values["id_constitucion"];
	$data["id_gestion"] = $values["gestion"];
	$data["id_socio"] = $values["accionista"];
	DB::Insert("socio_g_d", $data );
	
	$data1 = array();
	$data1["id_constitucion"] = $values["id_constitucion"];
	$data1["id_dp"] = $values["id_derecho_Propietario"];
	$data1["id_gestion"] = $values["gestion"];
	$data1["id_socio"] = $values["accionista"];
	DB::Insert("socio_dp", $data1);
	
	
	$data2 = array();
	$data2["derecho_propietario"] = $values["id_derecho_Propietario"];
	$data2["id_gestion"] = $values["gestion"];
	$data2["accionista"] = $values["accionista"];
	$data2["estado"] = 65;
	DB::Insert("pago_dp", $data2 );
	
	
	
	$data3 = array();
	$data3["derecho_propietario"] = $values["id_derecho_Propietario"];
	$data3["id_gestion"] = $values["gestion"];
	$data3["accionista"] = $values["accionista"];
	$data3["estado"] = 66;
	DB::Insert("entrega_dp", $data3 );
	
			;
			
		}
	
		function AfterAdd( &$values, &$keys, $inline, $pageObject ) {
			
	$data = array();
	$data["id_constitucion"] = $values["id_constitucion"];
	$data["id_gestion"] = $values["gestion"];
	$data["id_dp"] = $values["id_derecho_Propietario"];
	$data["id_Socio"] = $values["accionista"];
	
	DB::Insert("socio_g_d", $data );
	
	
	
	
	
	$data1 = array();
	$data1["id_constitucion"] = $values["id_constitucion"];
	$data1["id_dp"] = $values["id_derecho_Propietario"];
	$data1["id_gestion"] = $values["gestion"];
	$data1["id_socio"] = $values["accionista"];
	$data1["tipo_accionista"] =29;
	
	DB::Insert("socio_dp", $data1);
	
	
	
	$data2 = array();
	$data2["id_constitucion"] = $values["id_constitucion"];
	$data2["derecho_Propietario"] = $values["id_derecho_Propietario"];
	$data2["gestion"] = $values["gestion"];
	$data2["accionista"] = $values["accionista"];
	$data2["estado"] = 65;
	DB::Insert("pago_dp", $data2 );
	
	
	
	
	$data3 = array();
	$data3["derecho_propietario"] = $values["id_derecho_Propietario"];
	$data3["id_gestion"] = $values["gestion"];
	$data3["accionista"] = $values["accionista"];
	$data3["estado"] = 66;
	DB::Insert("entrega_dp", $data3 );
	
			;
			
		}
	
		function AfterEdit( &$values, $where, &$oldvalues, &$keys, $inline, $pageObject ) {
			$data1 = array();
	$data1["id_constitucion"] = $values["id_constitucion"];
	$data1["id_dp"] = $values["id_derecho_Propietario"];
	$data1["id_gestion"] = $values["gestion"];
	$data1["id_socio"] = $values["accionista"];
	$data1["tipo_accionista"] =29;
	$keyvalues["id_dp"] = $values["id_derecho_Propietario"];
	
	DB::update("socio_dp", $data1, $keyvalues);
	
	$data3 = array();
	$data3["derecho_propietario"] = $values["id_derecho_Propietario"];
	$data3["id_gestion"] = $values["gestion"];
	$data3["accionista"] = $values["accionista"];
	$data3["estado"] = 66;
	$keyvalues2["derecho_propietario"] = $values["id_derecho_Propietario"];
	
	
	DB::update("entrega_dp", $data3, $keyvalues2);
	
			;
			
		}
	public function default_fecha_Emision_efedit(  ) {
		$defaultValue = now();
		return $defaultValue;
	}
	
	public function default_fecha_Inscripcion_efedit(  ) {
		$defaultValue = now();
		return $defaultValue;
	}	

}


?>