ctasapagar/o_clave.html
2021-10-01 20:28:38 +01:00

187 lines
7.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>cod_clave</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 Claves Contables">
<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_clave.action=top.main.document.location.href+"&cookie=1&lock=true";
document.f_clave.submit();
}
function Chek_fields(obj) {
if ( emptyField(obj.cv_cod_clave) == true ) {
alert("!!! Es necesario rellenar el Código de Claves a Contables !!!->"+obj.cv_cod_clave.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_clave;');
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.cv_cod_clave,"Claves","cv_");
}
writeln('}');
}
if ( request.ViewFkey == "S" ) {
writeln('function RePaint(obj) {');
writeln(' var mainFrame=find_frame(top,"main");');
writeln(' for ( var i=0; i < document.f_clave.length; i++ ) { ');
writeln(' if ( document.f_clave.elements[i].name == obj.name ) ');
writeln(' break; ');
writeln(' } ');
writeln(' document.f_clave.action=mainFrame.document.location.href+"&cookie=1&nro="+i+"&lock=true"');
writeln(' document.f_clave.submit();');
writeln('} ');
}
else {
writeln('function RePaint(obj) {');
writeln('} ');
}
writeln('function Enfoca(obj) {')
if ( request.nro ) {
writeln('document.f_clave.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 claves where cod_clave=\'"+StringClip(true,request.cv_cod_clave)+"\'") == true ){
redirect("alertpage.html?alert=2");
}
else {
status=database.execute("INSERT INTO claves (" +
" cod_clave," +
" descripcion ) VALUES ('" + StringClip(true,request.cv_cod_clave) + "','" +
StringClip(true,request.cv_descripcion) + "')");
if ( status != 0 )
redirect(addClient('error.html?alert=5'));
DbsError(true,status);
}
redirect(addClient("o_clave.html?nvo=1&"+baseHtml));
}
//Ejecuta una actualización de la fila sobre la fila actual ...
if (request.upd && request.cv_cod_clave) {
// if (request.lock)
// c_claves.close();
status=database.execute("UPDATE claves SET "+
" descripcion='" + StringClip(true,request.cv_descripcion) + "'"+
" WHERE cod_clave = '" + request.cv_cod_clave + "'" );
if ( status != 0 )
redirect(addClient('error.html?alert=6'));
DbsError(true,status);
redirect(addClient("g_clave.html?"+baseHtml));
}
//Ejecuta un borrado de la fila actual ...
if (request.del) {
status=database.execute("DELETE FROM claves WHERE cod_clave = \'" + request.cv_cod_clave + "\'");
if ( status != 0 )
redirect(addClient('error.html?alert=7'));
DbsError(true,status);
redirect(addClient("g_clave.html?"+baseHtml));
}
if (request.cv_cod_clave && !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("cv","cod_clave","=\'"+request.cv_cod_clave+"\'",true,true);
else
CursorTabla("cv","cod_clave","=\'"+request.cv_cod_clave+"\'",true,"");
// Asignamos a request todas las columnas necesarias para el form.
request.cv_cod_clave=StringClip(false,c_claves.cod_clave);
request.cv_descripcion=StringClip(false,c_claves.descripcion);
if (!request.lock)
c_claves.close();
}
else {
// Estos son los Defaults Reales del Form ... Aquí pueden cambiarse ...
IniciaRequest("cv_");
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.cv_cod_clave && request.cv_cod_clave != null ) {
if ( entriesExist(" from claves where cod_clave=\'"+StringClip(true,request.cv_cod_clave)+"\'") == true ) {
redirect("alertpage.html?alert=2");
}
}
}
writeln('<FORM NAME="f_clave" METHOD="post"');
if (request.cv_cod_clave && !request.nvo )
htmlpath="o_clave.html?cv_cod_clave="+escape(request.cv_cod_clave)+"&"+baseHtml;
else
htmlpath="o_clave.html?nvo=1"+baseHtml;
writeln('action="'+htmlpath+'"');
writeln(' onSubmit="return Chek_fields(this)">');
LoadHidden(htmlpath);
if (!request.waux && request.FrameType == "L" )
ObjHeadBar(request.cv_cod_clave,"Claves","cv_");
writeln('<CENTER>');
writeln('<TABLE BORDER=1 ALIGN=CENTER><TR>');
writeln('<TR><TD ALIGN=RIGHT><B> Código Clave: </B></TD>');
if (request.cv_cod_clave && !request.nvo)
writeln('<TD ALIGN=RIGTH><FONT COLOR="#800040"><B>'+request.cv_cod_clave+'</B></FONT><INPUT type="hidden" name="cv_cod_clave" VALUE="'+request.cv_cod_clave+'"></FONT></TD></TR>');
else
writeln('<TD ALIGN=RIGTH><INPUT TYPE="text" NAME="cv_cod_clave" VALUE="'+request.cv_cod_clave+'" SIZE=3 OnChange="RePaint(this)"></TD></TR>');
writeln('<TR><TD ALIGN=RIGTH><B> Descripción: </B></TD>');
if (request.waux || !request.lock)
writeln('<TD ALIGN=RIGTH><FONT COLOR="#800040"><B>'+request.cv_descripcion+'</FONT></B><INPUT type="hidden" NAME="cv_descripcion" VALUE="'+request.cv_descripcion+'" SIZE=30 maxlength=30 ></FONT></TD></TR>');
else
writeln('<TD ALIGN=RIGTH><INPUT TYPE="text" NAME="cv_descripcion" VALUE="'+request.cv_descripcion+'" SIZE=30 maxlength=30 ></TD></TR>');
writeln('</TABLE></FORM>');
if (!request.waux) {
writeSignature(true);
}
if (request.gofunc) {
writeln('-->');
}
else {
writeln('</BODY>');
writeln('</HTML>');
}
</SERVER>