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 baseHtml=""; 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(' '); writeln(''); writeln(''); writeln(''); writeln("'); 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_pedidos = database.cursor("SELECT * FROM pedidos,proveedores WHERE pedidos.nif=proveedores.nif and "+ client.criteria +" Between '" + desde_fecha + "' and '"+ hasta_fecha + "' ORDER BY " + client.criteria); } else if (request.search1) { c_pedidos = database.cursor("SELECT * FROM pedidos,proveedores WHERE pedidos.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.v_desde.length > 0 ) { var v_desde=DateFormat(request.v_desde,NLDF); if ( v_desde.substring(0,1) == "-" ) redirect("alertpage.html?alert=3"); if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+" vto_pago >= '"+v_desde+"' " } if ( request.v_hasta.length > 0 ) { var v_hasta=DateFormat(request.v_hasta,NLDF); if ( v_hasta.substring(0,1) == "-" ) redirect("alertpage.html?alert=3"); if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+" vto_pago <= '"+v_hasta+"' " } if ( request.h_cod_centro.length > 0 ) { if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+" pedidos.cod_centro >= '"+request.d_cod_centro+"' and pedidos.cod_centro <= '"+request.h_cod_centro+"' " } else { if ( request.d_cod_centro.length > 0 ) { if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+" pedidos.cod_centro matches '"+request.d_cod_centro+"'" } } if ( request.nif.length > 0 ) { if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+" pedidos.nif matches '"+request.nif+"'" } if ( request.h_nro_fra.length > 0 ) { if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+" pedidos.nro_fra >= '"+request.d_nro_fra+"' and pedidos.nro_fra <= '"+request.h_nro_fra+"'" } else { if ( request.d_nro_fra.length > 0 ) { if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+" pedidos.nro_fra >= '"+request.d_nro_fra+"'" } } if ( request.h_mes_fra.length > 0 ) { if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+" pedidos.mes >= '"+request.d_mes_fra+"' and pedidos.mes <= '"+request.h_mes_fra+"'" } else { if ( request.d_mes_fra.length > 0 ) { if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+" pedidos.mes >= '"+request.d_mes_fra+"'" } } if ( request.h_nro_regn.length > 0 ) { if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+" pedidos.nro_reg >= '"+StringClip(true,request.d_nro_regy)+StringClip(true,request.d_nro_regn)+"' and pedidos.nro_reg <= '"+StringClip(true,request.h_nro_regy)+StringClip(true,request.h_nro_regn)+"'" } else { if ( request.d_nro_regn.length > 0 ) { if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+" pedidos.nro_reg >= '"+StringClip(true,request.d_nro_regy)+StringClip(true,request.d_nro_regn)+"'" } } 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=" pedidos.nif,"+request.f_orden; if (request.f_formato=="centro") request.f_orden=" pedidos.cod_centro,razon_social,"+request.f_orden; if (request.f_formato=="pendientes") request.f_orden=" pedidos.f_recepcion,"+request.f_orden; if (request.f_formato=="emitidas") { request.f_orden=" pedidos.cod_banco,pedidos.vto_pago,"+request.f_orden; if (criterio.length > 0 ) criterio=criterio+" and " criterio=criterio+"f_emision_pago is not null " } if (request.f_formato=="provBloq") request.f_orden=" pedidos.nif,"+request.f_orden; // if (request.f_formato=="documento") // request.f_orden=" pedidos.nif,"+request.f_orden; if (criterio.length > 0 ) criterio=" and "+criterio; c_factreg = database.cursor("SELECT * FROM pedidos,proveedores,centros WHERE pedidos.nif=proveedores.nif and pedidos.cod_centro=centros.cod_centro"+ criterio + " ORDER BY " + request.f_orden); } if (!c_factreg) DbsError(false,-1); else { writeln(""); c_factreg.close(); } } } criterio="Listado"; writeln("'); if ( request.FrameType == "F" || request.FrameType == "T" ) { writeln(""); } if (!request.waux) { if (request.gofunc) { writeln(''); writeln(''); writeln(' '); } else { writeln(''); writeln(''); }