369 lines
16 KiB
HTML
369 lines
16 KiB
HTML
<!---
|
|
application: Cuentas a Pagar
|
|
version: 1.0.0
|
|
filename: l_albaran.html
|
|
description: Esta página busca las filas de la tabla de acuerdo con el
|
|
criterio de búsqueda establecido. Las filas tinen un hiper-enlace para
|
|
poder ver los detalles completos, modificarla o Borrala.
|
|
El botón de Alta permite acceder al form para crear una nueva fila
|
|
--->
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>Listado de albaranes</TITLE>
|
|
<SCRIPT SRC="global.js">
|
|
</SCRIPT>
|
|
<SCRIPT SRC="ctasapagar.js">
|
|
</SCRIPT>
|
|
<SCRIPT SRC="l_albaran.js">
|
|
</SCRIPT>
|
|
</HEAD>
|
|
<SERVER>
|
|
var NF6=""
|
|
var NF8=""
|
|
var NF9=""
|
|
var NF10=""
|
|
var HOY=new Date();
|
|
// Algunos formatos para fechas.
|
|
var NLDF=""; // para columnas en las queries INFORMIX
|
|
var nprinter="";
|
|
var spoolpath="";
|
|
var baseHtml="";
|
|
var textoReqs="";
|
|
var nomFile="c:/tmprpts/empty";
|
|
fileRpt=new File(nomFile);
|
|
fileRpt.close();
|
|
var PaperVLines=76// Nro. Lins. del Papel A4 Vertical FONT Default
|
|
var PaperHLines=52// Nro. Lins. del Papel A4 Horizontal FONT Default
|
|
dbAcl();
|
|
if (request.gofunc)
|
|
writeln(' <BODY OnLoad="RunFunction(\''+request.gofunc+'\',\''+request.valor+'\')"');
|
|
else {
|
|
if ( request.FrameType == "F" || request.FrameType == "T" )
|
|
writeln(' <BODY OnLoad="WriteFrameButtons();GoField()"');
|
|
else
|
|
writeln(' <BODY OnLoad="GoField()"');
|
|
}
|
|
writeln(' BACKGROUND="images/backgrnd.gif">');
|
|
writeln('<SCRIPT SRC="global.js">');
|
|
writeln('</SCRIPT>');
|
|
writeln('<SCRIPT SRC="ctasapagar.js">');
|
|
writeln('</SCRIPT>');
|
|
writeln('<SCRIPT SRC="albaran.js">');
|
|
writeln('</SCRIPT>');
|
|
writeln("<SCRIPT LANGUAGE='JavaScript'>");
|
|
writeln(' function GoField() {');
|
|
writeln(' var f=document.l_albaran; ');
|
|
writeln('// alert("\\r¡¡¡ !!!"); ');
|
|
if (!request.f_orden)
|
|
writeln(' f.f_formato.focus();');
|
|
if (request.f_orden)
|
|
writeln("displayReport();");
|
|
writeln(' }');
|
|
writeln(' function chkYearNroReg(obj) {');
|
|
writeln(' var nro=parseInt(obj.value); ');
|
|
writeln(' if (nro+1 > 0 ) { ');
|
|
writeln(' obj.value=nro; ');
|
|
writeln(' if ( HOY.getFullYear() != nro ) ');
|
|
writeln(' alert("¡¡ El Año del Nro. de Registro no es el actual !! ");');
|
|
writeln(' }');
|
|
writeln(' }');
|
|
writeln('function NroPad(obj,longNro) {');
|
|
writeln(' if ( obj.value.length == 0 )');
|
|
writeln(' return;');
|
|
writeln(' if (obj.value.indexOf("*") >= 0) ');
|
|
writeln(' return;');
|
|
writeln(' c_nro=obj.value;');
|
|
writeln(' for (var j=c_nro.length ; j<longNro ; j++ ) {');
|
|
writeln(' c_nro="0"+c_nro;');
|
|
writeln(' }');
|
|
writeln(' obj.value=c_nro.substring(0,longNro);');
|
|
writeln('}');
|
|
if (request.gofunc) {
|
|
writeln('function RunFunction(obj,valor) {');
|
|
writeln(' var mainFrame=find_frame(top,"main");');
|
|
writeln(' var f_frame=mainFrame.document.g_albaran;');
|
|
writeln(' if ( obj == "Alta" ) {');
|
|
writeln(' f_frame.action="l_albaran.html?nvo=1&'+baseHtml+'";');
|
|
writeln(' f_frame.submit(); ');
|
|
writeln(' }');
|
|
writeln(' if ( obj == "Ayuda" )');
|
|
writeln(' NetHelp(valor);');
|
|
writeln(' history.back();');
|
|
writeln('}');
|
|
}
|
|
writeln('</SCRIPT>');
|
|
if( request.f_orden) {
|
|
if (!request.gofunc) {
|
|
dbConnect();
|
|
if (request.desde && request.hasta) {
|
|
var desde_fecha=DateFormat(request.desde,NLDF);
|
|
if ( desde_fecha.substring(0,1) == "-" )
|
|
redirect("alertpage.html?alert=3");
|
|
var hasta_fecha=DateFormat(request.hasta,NLDF);
|
|
if ( hasta_fecha.substring(0,1) == "-" )
|
|
redirect("alertpage.html?alert=3");
|
|
c_albaranes = database.cursor("SELECT * FROM albaranes,proveedores WHERE albaranes.nif=proveedores.nif and "+ client.criteria +" Between '" +
|
|
desde_fecha + "' and '"+ hasta_fecha + "' ORDER BY " + client.criteria);
|
|
}
|
|
else if (request.search1) {
|
|
c_albaranes = database.cursor("SELECT * FROM albaranes,proveedores WHERE albaranes.nif=proveedores.nif and "+ client.criteria +" MATCHES '" +
|
|
request.search1 + "' ORDER BY " + client.criteria);
|
|
}
|
|
else if (request.f_orden) {
|
|
var criterio=""
|
|
if ( request.f_desde.length > 0 ) {
|
|
var f_desde=DateFormat(request.f_desde,NLDF);
|
|
if ( f_desde.substring(0,1) == "-" )
|
|
redirect("alertpage.html?alert=3");
|
|
criterio=" f_emision >= '"+f_desde+"' "
|
|
}
|
|
if ( request.f_hasta.length > 0 ) {
|
|
var f_hasta=DateFormat(request.f_hasta,NLDF);
|
|
if ( f_hasta.substring(0,1) == "-" )
|
|
redirect("alertpage.html?alert=3");
|
|
if (criterio.length > 0 )
|
|
criterio=criterio+" and "
|
|
criterio=criterio+" f_emision <= '"+f_hasta+"' "
|
|
}
|
|
if ( request.h_cod_centro.length > 0 ) {
|
|
if (criterio.length > 0 )
|
|
criterio=criterio+" and "
|
|
criterio=criterio+" albaranes.cod_centro >= '"+request.d_cod_centro+"' and albaranes.cod_centro <= '"+request.h_cod_centro+"' "
|
|
} else {
|
|
if ( request.d_cod_centro.length > 0 ) {
|
|
if (criterio.length > 0 )
|
|
criterio=criterio+" and "
|
|
criterio=criterio+" albaranes.cod_centro matches '"+request.d_cod_centro+"'"
|
|
}
|
|
}
|
|
if ( request.nif.length > 0 ) {
|
|
if (criterio.length > 0 )
|
|
criterio=criterio+" and "
|
|
criterio=criterio+" albaranes.nif matches '"+request.nif+"'"
|
|
}
|
|
if ( request.h_nro_fra.length > 0 ) {
|
|
if (criterio.length > 0 )
|
|
criterio=criterio+" and "
|
|
criterio=criterio+" albaranes.fra_reg >= '"+request.d_nro_fra+"' and albaranes.nro_fra <= '"+request.h_nro_fra+"'"
|
|
} else {
|
|
if ( request.d_nro_fra.length > 0 ) {
|
|
if (criterio.length > 0 )
|
|
criterio=criterio+" and "
|
|
criterio=criterio+" albaranes.fra_reg >= '"+request.d_nro_fra+"'"
|
|
}
|
|
}
|
|
if ( request.h_nro_reg.length > 0 ) {
|
|
if (criterio.length > 0 )
|
|
criterio=criterio+" and "
|
|
criterio=criterio+" albaranes.nro_reg >= '"+StringClip(true,request.d_nro_reg)+"' and albaranes.nro_reg <= '"+StringClip(true,request.h_nro_reg)+"'"
|
|
} else {
|
|
if ( request.d_nro_reg.length > 0 ) {
|
|
if (criterio.length > 0 )
|
|
criterio=criterio+" and "
|
|
criterio=criterio+" albaranes.nro_reg >= '"+StringClip(true,request.d_nro_reg)+"'"
|
|
}
|
|
}
|
|
if ( request.razon_social.length > 0 ) {
|
|
if (criterio.length > 0 )
|
|
criterio=criterio+" and "
|
|
var razon_social=request.razon_social;
|
|
// var lowcaps = request.razon_social.toLowerCase();
|
|
// var uppercaps = request.razon_social.toUpperCase();
|
|
criterio=criterio+"razon_social matches '"+razon_social+"'"
|
|
}
|
|
if (request.f_formato=="proveedor")
|
|
request.f_orden=" albaranes.nif,"+request.f_orden;
|
|
if (request.f_formato=="centro")
|
|
request.f_orden=" albaranes.cod_centro,razon_social,"+request.f_orden;
|
|
if (request.f_formato=="pendientes") {
|
|
request.f_orden=" albaranes.cod_centro,razon_social,"+request.f_orden;
|
|
if (criterio.length > 0 )
|
|
criterio=criterio+" and "
|
|
criterio=criterio+"fra_reg matches ' *' "
|
|
}
|
|
if (request.f_formato=="emitidas") {
|
|
request.f_orden=""+request.f_orden;
|
|
if (criterio.length > 0 )
|
|
criterio=criterio+" and "
|
|
criterio=criterio+"fecha_emision is not null "
|
|
}
|
|
if (request.f_formato=="provBloq")
|
|
request.f_orden=" albaranes.nif,"+request.f_orden;
|
|
// if (request.f_formato=="documento")
|
|
// request.f_orden=" albaranes.nif,"+request.f_orden;
|
|
if (criterio.length > 0 )
|
|
criterio=" and "+criterio;
|
|
c_albareg = database.cursor("SELECT * FROM albaranes,proveedores,centros WHERE albaranes.nif=proveedores.nif and albaranes.cod_centro=centros.cod_centro"+ criterio +
|
|
" ORDER BY " + request.f_orden);
|
|
}
|
|
if (!c_albareg)
|
|
DbsError(false,-1);
|
|
else {
|
|
report_alb();
|
|
writeln("<SCRIPT LANGUAGE='JavaScript'>");
|
|
writeln("function displayReport() {");
|
|
if ( textoReqs.length > 0 )
|
|
writeln(' alert("Listado(s): '+textoReqs+'\\r está(n) en la cola \''+nprinter+'\'"); ');
|
|
writeln("}");
|
|
writeln("</SCRIPT>");
|
|
c_albareg.close();
|
|
}
|
|
}
|
|
}
|
|
criterio="Listado";
|
|
writeln("<SCRIPT LANGUAGE='JavaScript'>");
|
|
writeln('function RangoFecha(obj,clave) {');
|
|
writeln(' if (obj.value.length > 0 ){ ');
|
|
writeln(' if (clave == "emision") { ');
|
|
writeln(' if (dateCmp(obj.value,document.l_albaran.f_desde.value) != 1 ) {;');
|
|
writeln(' alert("¡ El Rango de Fechas no es posible !");');
|
|
writeln(' obj.value="";');
|
|
writeln(' document.g_albaran.f_desde.focus();');
|
|
writeln(' } ');
|
|
writeln(' } ');
|
|
writeln(' if (clave == "vto") { ');
|
|
writeln(' if (dateCmp(obj.value,document.l_albaran.v_desde.value) != 1 ) {;');
|
|
writeln(' alert("¡ El Rango de Fechas no es posible !");');
|
|
writeln(' obj.value="";');
|
|
writeln(' document.g_albaran.v_desde.focus();');
|
|
writeln(' } ');
|
|
writeln(' } ');
|
|
writeln(' if (clave == "fecha") { ');
|
|
writeln(' if (dateCmp(obj.value,document.l_albaran.desde.value) != 1 ) {');
|
|
writeln(' alert("¡ El Rango de Fechas no es posible !");');
|
|
writeln(' obj.value="";');
|
|
writeln(' document.g_albaran.desde.focus();');
|
|
writeln(' } ');
|
|
writeln(' } ');
|
|
writeln(' } ');
|
|
writeln('} ');
|
|
writeln('function HastaDefault(obj,clave) {');
|
|
writeln(' if (obj.value.length <= 0 ){ ');
|
|
writeln(' if (clave == "emision") ');
|
|
writeln(' obj.value=document.l_albaran.f_desde.value;');
|
|
writeln(' if (clave == "vto") ');
|
|
writeln(' obj.value=document.l_albaran.v_desde.value;');
|
|
writeln(' if (clave == "fecha") ');
|
|
writeln(' obj.value=document.l_albaran.desde.value;');
|
|
writeln(' } ');
|
|
writeln('} ');
|
|
writeln('</SCRIPT>');
|
|
if ( request.FrameType == "F" || request.FrameType == "T" ) {
|
|
writeln("<SCRIPT LANGUAGE='JavaScript'>");
|
|
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;');
|
|
QueryButtons("albaranes",criterio,"rpt");
|
|
}
|
|
writeln('}');
|
|
writeln("</SCRIPT>");
|
|
}
|
|
if (!request.waux) {
|
|
if (request.gofunc) {
|
|
writeln('</BODY>');
|
|
writeln('</HTML>');
|
|
writeln(' <!--');
|
|
}
|
|
else {
|
|
if ( request.FrameType == "L" ) {
|
|
writeln('<FORM METHOD="post" ACTION="l_albaran.html?'+baseHtml+'&nvo=1">');
|
|
QueryHeadBar("albaranes",criterio,"rpt")
|
|
writeln('</FORM>');
|
|
}
|
|
writeln('<FORM NAME="l_albaran" method="Post" action="l_albaran.html?'+baseHtml+'">');
|
|
}
|
|
}
|
|
else {
|
|
writeln('<FORM NAME="l_albaran" method="Post" action="l_albaran.html?waux='+request.waux+'&'+baseHtml+'">');
|
|
writeln('<CENTER><FONT SIZE=+2>'+criterio+' </FONT></FONT></H1></CENTER>');
|
|
}
|
|
writeln("<B>Criterios de Seleccion Datos: </B>");
|
|
writeln("<HR>");
|
|
if (!request.nif)
|
|
request.nif="";
|
|
if (!request.d_cod_centro)
|
|
request.d_cod_centro="";
|
|
if (!request.h_cod_centro)
|
|
request.h_cod_centro="";
|
|
if (!request.razon_social)
|
|
request.razon_social="";
|
|
if (!request.d_nro_fra)
|
|
request.d_nro_fra="";
|
|
if (!request.h_nro_fra)
|
|
request.h_nro_fra="";
|
|
if (!request.f_desde)
|
|
request.f_desde="";
|
|
if (!request.f_hasta)
|
|
request.f_hasta="";
|
|
if (!request.d_nro_reg)
|
|
request.d_nro_reg="";
|
|
if (!request.h_nro_reg)
|
|
request.h_nro_reg="";
|
|
writeln('<TABLE ALIGN="CENTER" BORDER=0>');
|
|
writeln('<TR><TD ALIGN=LEFT><B>Formato: </B></TD><TD><SELECT NAME="f_formato" SIZE=1>');
|
|
writeln('<OPTION VALUE="documento" SELECTED>Documento Registrado');
|
|
writeln('<OPTION VALUE="proveedor" >Por Proveedor');
|
|
writeln('<OPTION VALUE="centro" >Por Centro');
|
|
writeln('<OPTION VALUE="pendientes" >Pendientes de Factura');
|
|
writeln('<OPTION VALUE="emitidos" >Emitidos');
|
|
writeln('<OPTION VALUE="provBloq" >Retenidos');
|
|
writeln('</SELECT>');
|
|
writeln("<INPUT type='hidden' name='f_tipo' size=4 maxlength=4 VALUE='html' >");
|
|
writeln("<INPUT type='hidden' name='maxLins' size=2 maxlength=2 VALUE='76' >");
|
|
writeln('<TD ALIGN=LEFT><B>Borde: </B></TD><TD><SELECT NAME="borde" SIZE=1>');
|
|
writeln('<OPTION VALUE="0" SELECTED>No');
|
|
writeln('<OPTION VALUE="1" >Fino');
|
|
writeln('<OPTION VALUE="2" >Medio');
|
|
writeln('<OPTION VALUE="3" >Grueso');
|
|
writeln('</SELECT>');
|
|
writeln("</TD></TR>");
|
|
// writeln('<B>Tipo: </B><SELECT NAME="f_tipo" SIZE=1>');
|
|
// writeln('<OPTION VALUE="html" SELECTED>HTML');
|
|
// writeln('<OPTION VALUE="ascii" >ASCII');
|
|
// writeln('</SELECT></TD></TR>');
|
|
writeln('</TABLE>');
|
|
writeln("<HR>");
|
|
writeln('<TABLE ALIGN="CENTER" BORDER=0>');
|
|
writeln('<INPUT TYPE="submit" value="Buscar">');
|
|
writeln('<TR><TD ALIGN=LEFT><B>Nro.Reg.Desde: </B></TD><TD><INPUT TYPE="text" NAME="d_nro_reg" VALUE="'+request.d_nro_reg+'" OnChange="NroPad(this,5)" SIZE=5 >');
|
|
writeln('Hasta: <INPUT TYPE="text" NAME="h_nro_reg" VALUE="'+request.h_nro_reg+'" OnChange="NroPad(this,5)" SIZE=5 ></TD>');
|
|
writeln('<TR><TD ALIGN=LEFT><B>Nro.Fra.Desde: </B></TD><TD><INPUT TYPE="text" NAME="d_nro_fra" VALUE="'+request.d_nro_fra+'" SIZE=12 >');
|
|
writeln('Hasta: <INPUT TYPE="text" NAME="h_nro_fra" VALUE="'+request.h_nro_fra+'" SIZE=12 > </TD>');
|
|
writeln("<TR><TD ALIGN=LEFT>N.I.F. .......: </TD><TD><INPUT type='text' name='nif' size=12 maxlength=12 VALUE='"+request.nif +"' onChange='this.value=this.value.toUpperCase()' > </TD></TR>");
|
|
writeln("<TR><TD ALIGN=LEFT>Razón Social .: </TD><TD><INPUT type='text' name='razon_social' size=30 maxlength=40 VALUE='"+request.razon_social +"' ></TD></TR>");
|
|
writeln("<TR><TD ALIGN=LEFT>Código Centro Desde: </TD><TD><INPUT type='text' name='d_cod_centro' size=12 maxlength=12 VALUE='"+request.d_cod_centro +"' >");
|
|
writeln("Hasta: <INPUT type='text' name='h_cod_centro' size=12 maxlength=12 VALUE='"+request.h_cod_centro +"' ></TD></TR>");
|
|
writeln("<TR><TD ALIGN=LEFT>Emitido Desde: </TD><TD><INPUT type='text' name='f_desde' size=8 maxlength=10 VALUE='"+request.f_desde +"' onBlur='ToStringDate(this,IFDF)' onFocus='UnfrmtStrDate(this,IFDF)' >");
|
|
writeln("Hasta: <INPUT type='text' name='f_hasta' size=8 maxlength=10 VALUE='"+request.f_hasta +"' onBlur='ToStringDate(this,IFDF)' onFocus='HastaDefault(this,\"emision\");UnfrmtStrDate(this,IFDF)' onChange='RangoFecha(this,\"emision\")' ></TD></TR>");
|
|
writeln('<TR><TD ALIGN=LEFT>Ordenado por: </TD><TD><SELECT NAME="f_orden" SIZE=1>');
|
|
writeln('<OPTION VALUE="razon_social" >Razón Social');
|
|
writeln('<OPTION VALUE="nif" >N.I.F.');
|
|
writeln('<OPTION VALUE="fra_reg" >Nro.Fra. ');
|
|
writeln('<OPTION VALUE="nro_reg" SELECTED>Nro.Reg. ');
|
|
writeln('<OPTION VALUE="fecha_emision" >Fecha Emisión');
|
|
writeln('<OPTION VALUE="cod_centro" >Centro ');
|
|
writeln('</SELECT></TD></TR></TABLE>');
|
|
writeln('<INPUT TYPE="submit" value="Buscar">');
|
|
writeln('</FORM>');
|
|
writeln("<CENTER>");
|
|
if (!request.waux) {
|
|
refHtml="l_albaran.html?"+baseHtml+"&search2=";
|
|
}
|
|
else {
|
|
refHtml="l_albaran.html?waux="+request.waux+"&"+baseHtml+"&search2=";
|
|
}
|
|
LoadHidden(refHtml);
|
|
if (!request.waux)
|
|
writeSignature(true);
|
|
if (request.gofunc) {
|
|
writeln('-->');
|
|
}
|
|
else {
|
|
writeln('</BODY>');
|
|
writeln('</HTML>');
|
|
}
|
|
</SERVER>
|