208 lines
		
	
	
		
			8.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			208 lines
		
	
	
		
			8.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
 | |
| <HTML>
 | |
| <HEAD>
 | |
|    <TITLE>cond_pago</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 Condiciones de Pago">
 | |
|    <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_condpago.action=top.main.document.location.href+"&cookie=1&lock=true";
 | |
| 		document.f_condpago.submit(); 
 | |
| } 
 | |
| function Chek_fields(obj) {
 | |
|      if ( emptyField(obj.cp_cond_pago) == true ) {
 | |
|           alert("!!! Es necesario rellenar el Código de Forma de Pago !!!->"+obj.cp_cond_pago.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_condpago;');
 | |
| 	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.cp_cond_pago,"Condiciones Pago","cp_");
 | |
|    }  
 | |
|    writeln('}');
 | |
| }
 | |
| if ( request.ViewFkey == "S" ) {
 | |
|    writeln('function RePaint(obj) {');
 | |
|    writeln('    var mainFrame=find_frame(top,"main");');
 | |
|    writeln('    for ( var i=0; i < document.f_condpago.length; i++ ) { ');
 | |
|    writeln('        if ( document.f_condpago.elements[i].name == obj.name ) ');
 | |
|    writeln('           break; ');
 | |
|    writeln('    }   ');
 | |
|    writeln('	 document.f_condpago.action=mainFrame.document.location.href+"&cookie=1&nro="+i+"&lock=true"');
 | |
|    writeln('	 document.f_condpago.submit();'); 
 | |
|    writeln('}   ');
 | |
| }   
 | |
| else {
 | |
|    writeln('function RePaint(obj) {');
 | |
|    writeln('}   ');
 | |
| }
 | |
| writeln('function Enfoca(obj) {')
 | |
| if ( request.nro ) {  
 | |
|       writeln('document.f_condpago.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 cond_pago where cond_pago=\'"+StringClip(true,request.cp_cond_pago)+"\'") == true ){        
 | |
|             redirect("alertpage.html?alert=2");      
 | |
|          }  
 | |
|          else {
 | |
|            status=database.execute("INSERT INTO cond_pago(" +
 | |
|  	          " cond_pago," +
 | |
|  	          " descripcion," +
 | |
|          	 " vencimiento)  VALUES ('" + StringClip(true,request.cp_cond_pago) + "','" + 
 | |
| 		   StringClip(true,request.cp_descripcion) + "','"+ 
 | |
| 		   parseInt(request.cp_vencimiento) + "')");
 | |
|         if ( status != 0 )
 | |
|        		 redirect(addClient('error.html?alert=5'));
 | |
| 
 | |
|         DbsError(true,status);  
 | |
|        } 
 | |
|         redirect(addClient("o_condpago.html?nvo=1&"+baseHtml));
 | |
| 	} 
 | |
| 	//Ejecuta una actualización de la fila sobre la fila actual ...
 | |
| 	if (request.upd && request.cp_cond_pago) {
 | |
|         // if (request.lock)  
 | |
|         //   c_cond_pago.close();        
 | |
|         status=database.execute("UPDATE cond_pago SET "+
 | |
|                           " descripcion='" + StringClip(true,request.cp_descripcion) + "',"+ 
 | |
|       				  		  " vencimiento='" + parseInt(request.cp_vencimiento) + "',"+      
 | |
|       				  		  " cond_pago='" + StringClip(true,request.cp_cond_pago) + "'" +
 | |
|                               " WHERE cond_pago = '" + request.cp_cond_pago + "'" ); 
 | |
|                         if ( status != 0 )
 | |
|                        		  redirect(addClient('error.html?alert=6'));
 | |
|         DbsError(true,status);  
 | |
|         redirect(addClient("g_condpago.html?"+baseHtml));
 | |
|    }
 | |
|    //Ejecuta un borrado de la fila actual ...
 | |
| 	if (request.del) {
 | |
|    	  status=database.execute("DELETE FROM cond_pago WHERE cond_pago = \'" + request.cp_cond_pago + "\'");    
 | |
|         if ( status != 0 )
 | |
|        		 redirect(addClient('error.html?alert=7'));
 | |
|         DbsError(true,status);  
 | |
|         redirect(addClient("g_condpago.html?"+baseHtml));
 | |
| 	}
 | |
|    if (request.cp_cond_pago && !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("cp","cond_pago","=\'"+request.cp_cond_pago+"\'",true,true);
 | |
| 	  else   
 | |
|   	     CursorTabla("cp","cond_pago","=\'"+request.cp_cond_pago+"\'",true,"");
 | |
|      // Asignamos a request todas las columnas necesarias para el form.
 | |
|          request.cp_cond_pago=StringClip(false,c_cond_pago.cond_pago);
 | |
|          request.cp_descripcion=StringClip(false,c_cond_pago.descripcion);
 | |
|          request.cp_vencimiento=c_cond_pago.vencimiento+" ";            
 | |
|      if (!request.lock)  
 | |
|          c_cond_pago.close();        
 | |
|    }
 | |
|    else { 
 | |
|  	// Estos son los Defaults Reales del Form ... Aquí pueden cambiarse ...
 | |
|            IniciaRequest("cp_");            
 | |
|            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.cp_cond_pago && request.cp_cond_pago != null ) {
 | |
|        if ( entriesExist(" from cond_pago where cond_pago=\'"+StringClip(true,request.cp_cond_pago)+"\'") == true ) {
 | |
|             redirect("alertpage.html?alert=2");
 | |
|        }       
 | |
|    }
 | |
| }
 | |
| writeln('<FORM NAME="f_condpago" METHOD="post" ');
 | |
| if (request.cp_cond_pago && !request.nvo )          
 | |
|      htmlpath="o_condpago.html?cp_cond_pago="+escape(request.cp_cond_pago)+"&"+baseHtml;
 | |
| else
 | |
|      htmlpath="o_condpago.html?nvo=1"+baseHtml;
 | |
| writeln('action="'+htmlpath+'"');
 | |
| writeln('  onSubmit="return Chek_fields(this)">');
 | |
| LoadHidden(htmlpath);
 | |
| if (!request.waux && request.FrameType == "L" )
 | |
|    ObjHeadBar(request.cp_cond_pago,"Condiciones Pago","cp_");
 | |
| writeln(' <CENTER>');
 | |
| writeln(' <TABLE BORDER=1 ALIGN=CENTER><TR>');
 | |
| //if (!request.waux)
 | |
| //	writeln('<TD ALIGN=RIGHT><INPUT TYPE="button" VALUE=" N.I.F. " ONCLICK="w_auxiliar(\'cond_pago\',\'cond_pago\',\'cp_cond_pago\',\''+request.cp_cond_pago+'\')">');
 | |
| //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>');
 | |
| //}	
 | |
| 
 | |
| if (request.cp_cond_pago && !request.nvo) 
 | |
| 	writeln('<FONT COLOR="#800040"><B>'+request.cp_cond_pago+'</B></FONT><INPUT type="hidden" name="cp_cond_pago" VALUE="'+request.cp_cond_pago+'"></FONT></TD>');
 | |
| else
 | |
| 	writeln('<INPUT TYPE="text" NAME="cp_cond_pago" VALUE="'+request.cp_cond_pago+'" SIZE=2  OnChange="RePaint(this)"></TD>');
 | |
| 
 | |
| writeln('<TD ALIGN=RIGTH>');
 | |
| if (request.waux || !request.lock)
 | |
|    writeln('<FONT COLOR="#800040"><B>'+request.cp_descripcion+'</FONT></B><INPUT  type="hidden" NAME="cp_descripcion" VALUE="'+request.cp_descripcion+'" SIZE=40	maxlength=40 ></FONT></TD></TR>');
 | |
| else
 | |
|    writeln('<INPUT TYPE="text" NAME="cp_descripcion" VALUE="'+request.cp_descripcion+'" SIZE=20	maxlength=20 ></TD></TR>');
 | |
| writeln('<TR><TD ALIGN=RIGHT> <B>Vencimiento:</B> ');
 | |
| if (request.waux || !request.lock) 
 | |
|    writeln('<TD><FONT COLOR="#800040"><B>'+request.cp_vencimiento+'<B></FONT></TD>');
 | |
| else {
 | |
|    writeln('<TD> <INPUT TYPE="text" NAME="cp_vencimiento" VALUE="'+request.cp_vencimiento+'")');
 | |
|    writeln(' 	onFocus="setStatus(\'\')"');
 | |
| 	writeln('	SIZE=3 </TD></TR>');
 | |
| }
 | |
| writeln('</TABLE></FORM>');
 | |
| if (!request.waux) {
 | |
| 	writeSignature(true);
 | |
| }
 | |
| if (request.gofunc) {
 | |
| 	writeln('-->');
 | |
| }
 | |
| else {
 | |
| 	writeln('</BODY>');
 | |
| 	writeln('</HTML>');
 | |
| }
 | |
| </SERVER>
 |