206 lines
8.7 KiB
HTML
206 lines
8.7 KiB
HTML
<TITLE>centros</TITLE>
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>Centros</TITLE>
|
|
<META NAME="GENERATOR" CONTENT="AdmiSys Sistemas informáticos">
|
|
<META NAME="Author" CONTENT="WebTeam">
|
|
<META NAME="Organization" CONTENT="AdmiSys S.L.">
|
|
<META NAME="Document description" CONTENT="Alta y Modificación de Centros">
|
|
<META NAME="Last modified date" CONTENT="Thursday, February 06, 1997 07:33:31">
|
|
</HEAD>
|
|
<SCRIPT SRC="global.js">
|
|
</SCRIPT>
|
|
<SCRIPT SRC="ctasapagar.js">
|
|
</SCRIPT>
|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
function FormPaint(obj) {
|
|
document.f_centro.action=top.main.document.location.href+"&cookie=1&lock=true";
|
|
document.f_centro.submit();
|
|
}
|
|
function Chek_fields(obj) {
|
|
if ( emptyField(obj.ce_cod_centro) == true ) {
|
|
alert("!!! Es necesario rellenar el Código de centro !!!->"+obj.ce_cod_centro.value+"<-");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
</SCRIPT>
|
|
<SERVER>
|
|
var baseHtml="";
|
|
dbAcl();
|
|
writeln("<SCRIPT LANGUAGE='JavaScript'>");
|
|
if ( request.FrameType == "F" || request.FrameType == "T" ) {
|
|
writeln('function RunFunction(obj,valor,clave,f_nro) {');
|
|
writeln(' var mainFrame=find_frame(top,"main");');
|
|
writeln(' var f_frame=mainFrame.document.f_centro;');
|
|
writeln(' if ( obj == "Ayuda" ) {');
|
|
writeln(' NetHelp(valor);');
|
|
writeln(' }');
|
|
writeln(' history.back();');
|
|
writeln('}');
|
|
writeln('function WriteFrameButtons() {')
|
|
if (!request.waux) {
|
|
writeln(' var topFrame=find_frame(top,"top");');
|
|
writeln(' var ndoc=topFrame.document; ');
|
|
writeln(' var mainFrame=find_frame(top,"main");');
|
|
writeln(' var formAction=mainFrame.document.location.href;');
|
|
ObjButtons(request.ce_cod_centro,"Centros","ce_");
|
|
}
|
|
writeln('}');
|
|
}
|
|
if ( request.ViewFkey == "S" ) {
|
|
writeln('function RePaint(obj) {');
|
|
writeln(' var mainFrame=find_frame(top,"main");');
|
|
writeln(' for ( var i=0; i < document.f_centro.length; i++ ) { ');
|
|
writeln(' if ( document.f_centro.elements[i].name == obj.name ) ');
|
|
writeln(' break; ');
|
|
writeln(' } ');
|
|
writeln(' document.f_centro.action=top.main.document.location.href+"&cookie=1&nro="+i+"&lock=true"');
|
|
writeln(' document.f_centro.submit();');
|
|
writeln('} ');
|
|
}
|
|
else {
|
|
writeln('function RePaint(obj) {');
|
|
writeln('} ');
|
|
}
|
|
writeln('function Enfoca(obj) {')
|
|
if ( request.nro ) {
|
|
writeln('document.f_centro.elements['+request.nro+'].focus();');
|
|
}
|
|
writeln('}');
|
|
writeln("</SCRIPT>");
|
|
if (request.gofunc)
|
|
writeln(' <BODY OnLoad="RunFunction(\''+request.gofunc+'\',\''+request.valor+'\',\''+request.nvo+'\','+request.nro+')"');
|
|
else {
|
|
if ( request.FrameType == "F" || request.FrameType == "T" )
|
|
writeln(' <BODY OnLoad="WriteFrameButtons()"');
|
|
else
|
|
writeln('<BODY "');
|
|
}
|
|
writeln(' BACKGROUND="images/backgrnd.gif">');
|
|
if (request.gofunc) {
|
|
writeln(' </BODY>');
|
|
writeln(' </HTML>');
|
|
writeln(' <!--');
|
|
}
|
|
if (!request.cookie && !request.gofunc) {
|
|
dbConnect();
|
|
// Vemos que tarea hay que ejecutar:
|
|
if (request.add) {
|
|
if ( entriesExist(" from centros where cod_centro=\'"+StringClip(true,request.ce_cod_centro)+"\'") == true ){
|
|
redirect("alertpage.html?alert=2");
|
|
}
|
|
else {
|
|
status=database.execute("INSERT INTO centros(" +
|
|
" cod_centro," +
|
|
" cod_departamento," +
|
|
" descripcion) VALUES ('" + StringClip(true,request.ce_cod_centro) + "','" +
|
|
StringClip(true,request.ce_cod_departamento) + "','"+
|
|
StringClip(true,request.ce_descripcion) + "')");
|
|
if ( status != 0 )
|
|
redirect(addClient('error.html?alert=5'));
|
|
DbsError(true,status);
|
|
}
|
|
redirect(addClient("o_centro.html?nvo=1&"+baseHtml));
|
|
}
|
|
//Ejecuta una actualización de la fila sobre la fila actual ...
|
|
if (request.upd && request.ce_cod_centro) {
|
|
// if (request.lock)
|
|
// c_centros.close();
|
|
status=database.execute("UPDATE centros SET "+
|
|
" cod_departamento='" + StringClip(true,request.ce_cod_departamento) + "',"+
|
|
" descripcion='" + StringClip(true,request.ce_descripcion) + "'"+
|
|
" WHERE cod_centro = '" + request.ce_cod_centro + "'" );
|
|
if ( status != 0 )
|
|
redirect(addClient('error.html?alert=6'));
|
|
DbsError(true,status);
|
|
redirect(addClient("g_centro.html?"+baseHtml));
|
|
}
|
|
//Ejecuta un borrado de la fila actual ...
|
|
if (request.del) {
|
|
status=database.execute("DELETE FROM centros WHERE cod_centro = \'" + request.ce_cod_centro + "\'");
|
|
if ( status != 0 )
|
|
redirect(addClient('error.html?alert=7'));
|
|
DbsError(true,status);
|
|
redirect(addClient("g_centro.html?"+baseHtml));
|
|
}
|
|
if (request.ce_cod_centro && !request.upd && !request.add ) {
|
|
// Si hay Clave de la tabla seleccionamos los datos ....
|
|
//Si se busca la fila ... usando la clave primaria de la relación
|
|
if (request.lock)
|
|
CursorTabla("ce","cod_centro","=\'"+request.ce_cod_centro+"\'",true,true);
|
|
else
|
|
CursorTabla("ce","cod_centro","=\'"+request.ce_cod_centro+"\'",true,"");
|
|
// Asignamos a request todas las columnas necesarias para el form.
|
|
request.ce_cod_centro=StringClip(false,c_centros.cod_centro);
|
|
request.ce_cod_departamento=StringClip(false,c_centros.cod_departamento);
|
|
request.ce_descripcion=StringClip(false,c_centros.descripcion);
|
|
if (request.lock)
|
|
c_centros.close();
|
|
}
|
|
else {
|
|
// Estos son los Defaults Reales del Form ... Aquí pueden cambiarse ...
|
|
IniciaRequest("ce_");
|
|
request.lock=true;
|
|
}
|
|
}
|
|
else if (!request.gofunc) {
|
|
// Se entiende que request contiene todas las columnas necesarias para el form.
|
|
// y que esta llamada es para leer y cargar las claves foráneas de la tabla.
|
|
if (request.nvo && request.ce_cod_centro && request.ce_cod_centro != null ) {
|
|
if ( entriesExist(" from centros where cod_centro=\'"+StringClip(true,request.ce_cod_centro)+"\'") == true ) {
|
|
redirect("alertpage.html?alert=2");
|
|
}
|
|
}
|
|
}
|
|
writeln('<FORM NAME="f_centro" METHOD="post"');
|
|
if (request.ce_cod_centro && !request.nvo)
|
|
htmlpath="o_centro.html?ce_cod_centro="+escape(request.ce_cod_centro)+"&"+baseHtml;
|
|
else
|
|
htmlpath="o_centro.html?nvo=1"+baseHtml;
|
|
writeln('action="'+htmlpath+'"');
|
|
writeln(' onSubmit="return Chek_fields(this)">');
|
|
LoadHidden(htmlpath);
|
|
if (!request.waux && request.FrameType == "L" )
|
|
ObjHeadBar(request.ce_cod_centro,"Centros","ce_");
|
|
writeln(' <CENTER>');
|
|
writeln(' <TABLE BORDER=1 ALIGN=CENTER><TR>');
|
|
//if (!request.waux)
|
|
// writeln('<TD ALIGN=RIGHT><INPUT TYPE="button" VALUE=" Código " ONCLICK="w_auxiliar(\'cod_centro\',\'cod_centro\',\'ce_cod_centro\',\''+request.ce_cod_centro+'\')">');
|
|
//else {
|
|
//if (request.waux == 2)
|
|
// writeln('<TD></TD><TD align="right" valign="top"><A HREF="javascript:top.close()"><IMG SRC="images/exit1.gif" BORDER=0 HEIGHT=37 WIDTH=44></A></TD></TR>');
|
|
writeln('<TR><TD ALIGN=RIGHT><B> Código: </B></TD>');
|
|
//}
|
|
|
|
if (request.ce_cod_centro && !request.nvo)
|
|
writeln('<TD><FONT COLOR="#800040"><B>'+request.ce_cod_centro+'</B></FONT><INPUT type="hidden" name="ce_cod_centro" VALUE="'+request.ce_cod_centro+'"></TD></FONT>');
|
|
else
|
|
writeln('<TD><INPUT TYPE="text" NAME="ce_cod_centro" VALUE="'+request.ce_cod_centro+'" SIZE=5 OnChange="RePaint(this)"></TD>');
|
|
|
|
writeln('<TR><TD ALIGN=RIGHT><B>Departamento:</B></TD>');
|
|
if (request.waux || !request.lock)
|
|
writeln('<TD><FONT COLOR="#800040"><B>'+request.ce_cod_departamento+'</FONT><INPUT type="hidden" name="ce_cod_departamento" VALUE="'+request.ce_cod_departamento+'" size=12 maxlength=12></TD></FONT></TR>');
|
|
else
|
|
writeln('<TD><INPUT type="text" name="ce_cod_departamento" VALUE="'+request.ce_cod_departamento+'" size=12 maxlength=12></TD></TR>');
|
|
writeln('<TR><TD ALIGN=RIGHT><B>Descripción:</B></TD>');
|
|
if (request.waux || !request.lock)
|
|
writeln('<TD><FONT COLOR="#800040"><B>'+request.ce_descripcion+'</FONT><INPUT type="hidden" name="ce_descripcion" VALUE="'+request.ce_descripcion+'" size=40 maxlength=40></TD></FONT></TR>');
|
|
else
|
|
writeln('<TD><INPUT type="text" name="ce_descripcion" VALUE="'+request.ce_descripcion+'" size=40 maxlength=40></TD></TR>');
|
|
// writeln(' onFocus="setStatus(\'\')"');
|
|
|
|
writeln('</TABLE></FORM>');
|
|
if (!request.waux) {
|
|
writeSignature(true);
|
|
}
|
|
if (request.gofunc) {
|
|
writeln('-->');
|
|
}
|
|
else {
|
|
writeln('</BODY>');
|
|
writeln('</HTML>');
|
|
}
|
|
</SERVER>
|