<?php
include_once(getabspath("include/det_movimiento_settings.php"));

function DisplayMasterTableInfo_det_movimiento($params)
{
	$detailtable = $params["detailtable"];
	$keys = $params["keys"];
	$detailPageObj = $params["detailPageObj"];
	global $conn,$strTableName;
	$xt = new Xtempl();
	$oldTableName = $strTableName;
	$strTableName = "det_movimiento";
	
	$settings = new ProjectSettings($strTableName, PAGE_LIST);
	$cipherer = new RunnerCipherer($strTableName);
	
	$masterQuery = $settings->getSQLQuery();
	
	$viewControls = new ViewControlsContainer($settings, PAGE_LIST);

$where = "";
$mKeys = array();
$showKeys = "";

global $page_styles, $page_layouts, $page_layout_names, $container_styles;

$layout = new TLayout("masterlist","BoldAqua","MobileAqua");
$layout->blocks["bare"] = array();
$layout->containers["0"] = array();

$layout->containers["0"][] = array("name"=>"masterlistheader","block"=>"","substyle"=>1);


$layout->skins["0"] = "empty";
$layout->blocks["bare"][] = "0";
$layout->containers["mastergrid"] = array();

$layout->containers["mastergrid"][] = array("name"=>"masterlistfields","block"=>"","substyle"=>1);


$layout->skins["mastergrid"] = "grid";
$layout->blocks["bare"][] = "mastergrid";$page_layouts["det_movimiento_masterlist"] = $layout;


if($detailtable == "v_det_movimiento")
{
		$where.= GetFullFieldName("idmovimiento", "", false)."=".$cipherer->MakeDBValue("idmovimiento",$keys[1-1], "", "", true);
	$showKeys .= " "."ID Movimiento".": ".$keys[1-1];
	$xt->assign('showKeys',$showKeys);
}
	if(!$where)
	{
		$strTableName = $oldTableName;
		return;
	}
	$str = SecuritySQL("Search");
	if(strlen($str))
		$where.= " and ".$str;

	$strWhere = whereAdd($masterQuery->WhereToSql(),$where);
	if(strlen($strWhere))
		$strWhere = " where ".$strWhere." ";
	$strSQL = $masterQuery->HeadToSql().' '.$masterQuery->FromToSql().$strWhere.$masterQuery->TailToSql();

//	$strSQL = AddWhere($strSQL,$where);
	LogInfo($strSQL);
	$rs = db_query($strSQL,$conn);
	$data = $cipherer->DecryptFetchedArray($rs);
	if(!$data)
	{
		$strTableName = $oldTableName;
		return;
	}
	$keylink = "";
	$keylink.="&key1=".htmlspecialchars(rawurlencode(@$data["iddet_movimiento"]));
	

//	iddet_movimiento - 
			$value="";

					$xt->assign("iddet_movimiento_mastervalue", $viewControls->showDBValue("iddet_movimiento", $data, $keylink));

//	idmovimiento - 
			$value="";

					$xt->assign("idmovimiento_mastervalue", $viewControls->showDBValue("idmovimiento", $data, $keylink));

//	idcuenta - 
			$value="";

					$xt->assign("idcuenta_mastervalue", $viewControls->showDBValue("idcuenta", $data, $keylink));

//	monto_apertura - Number
			$value="";

					$xt->assign("monto_apertura_mastervalue", $viewControls->showDBValue("monto_apertura", $data, $keylink));

//	monto_cierre - Number
			$value="";

					$xt->assign("monto_cierre_mastervalue", $viewControls->showDBValue("monto_cierre", $data, $keylink));

//	fecha_apertura - Datetime
			$value="";

					$xt->assign("fecha_apertura_mastervalue", $viewControls->showDBValue("fecha_apertura", $data, $keylink));

//	monto_recaudado - Number
			$value="";

					$xt->assign("monto_recaudado_mastervalue", $viewControls->showDBValue("monto_recaudado", $data, $keylink));

//	monto_gastado - Number
			$value="";

					$xt->assign("monto_gastado_mastervalue", $viewControls->showDBValue("monto_gastado", $data, $keylink));

//	fecha_cierre - Datetime
			$value="";

					$xt->assign("fecha_cierre_mastervalue", $viewControls->showDBValue("fecha_cierre", $data, $keylink));

//	denominacion - 
			$value="";

					$xt->assign("denominacion_mastervalue", $viewControls->showDBValue("denominacion", $data, $keylink));

	$viewControls->addControlsJSAndCSS();
	$detailPageObj->viewControlsMap['mViewControlsMap'] = $viewControls->viewControlsMap;

	$layout = GetPageLayout("det_movimiento", 'masterlist');
	if($layout)
		$xt->assign("pageattrs", 'class="'.$layout->style." page-".$layout->name.'"');
	
	$xt->display("det_movimiento_masterlist.htm");
	
	$strTableName=$oldTableName;
}

?>