<?php
// $user_codigo=3;
// $sql_acce ='select * ';
$sql_acce ='select numero,docum, ';
$sql_acce.='nuev,modi,cons,info,anul,elim,clon,proc,';
$sql_acce.='max(nuev) as nuev, ';
$sql_acce.='max(modi) as modi, ';
$sql_acce.='max(cons) as cons, ';
$sql_acce.='max(info) as info, ';
$sql_acce.='max(anul) as anul, ';
$sql_acce.='max(elim) as elim, ';
$sql_acce.='max(clon) as clon, ';
$sql_acce.='max(proc) as proc, ';
$sql_acce.='status ';
$sql_acce.='from acce12 ';
$sql_acce.='where numero="'.$user_codigo.'"  ';
$sql_acce.='and docum like "'.$docuacce.'%" ';

if(strlen($docuacce)==2)
{$sql_acce.='group by substring(docum,1,2) ';}

$sql_acce.='order by docum ';
$res_acce=msql_query($sql_acce,$link_vcrx);

// echo '<msgsistemas>';
// echo '*/*/*/*> '.$docuacce;
// echo '*/*/*/*> '.$sql_acce;
// echo '*/*/*/*> '.msql_error($link_vcrx);
// echo '</msgsistemas>';

$user_nuev=@msql_result($res_acce,0,'nuev');
$user_modi=@msql_result($res_acce,0,'modi');

$user_cons=@msql_result($res_acce,0,'cons');
$user_info=@msql_result($res_acce,0,'info');

$user_anul=@msql_result($res_acce,0,'anul');
$user_elim=@msql_result($res_acce,0,'elim');

$user_clon=@msql_result($res_acce,0,'clon');
$user_proc=@msql_result($res_acce,0,'proc');
$user_apro=@msql_result($res_acce,0,'apro');

if($user_tipo=='sist') 
{
  $user_nuev=1;
  $user_cons=1;
  $user_modi=1;
  $user_anul=1;
  $user_elim=1;
  $user_clon=1;
  $user_proc=1;
  $user_info=1;
  $user_apro=1;
}

if($user_tipo=='supe') 
{
//   $user_nuev=1;
  $user_cons=1;
//   $user_modi=1;
  $user_anul=1;
  $user_elim=1;
//   $user_clon=1;
//   $user_proc=1;
  $user_info=1;
}

if($docuacce=='PC19'){$user_nuev=1;}

?>