var NF09=""
var NFY9="";
var NF7="";
var NF10=""
var HOY=new Date();
// Algunos formatos para fechas.
var NLDF=""; // para columnas en las queries INFORMIX
var baseHtml="";
var nprinter="ep1170";
var spoolpath="";
var pathFile="c:/tmprpts/";
var nomFile=pathFile+request.uid+"_pag.html"; // Donde escribe el Server
var nomCarta=pathFile+request.uid+"_car.html";
var nomFich=pathFile+request.uid+"_fic.txt";
var nomTest=pathFile+request.uid+"_tst.html";
var nomList=pathFile+request.uid+"_lst.html";
var urlFile="file:///P|/"+request.uid+"_pag.html" // Donde leen los Clients
var urlCarta="file:///P|/"+request.uid+"_car.html"
var urlFich="file:///P|/"+request.uid+"_fic.txt"
var urlTest="file:///P|/"+request.uid+"_tst.html"
var urlList="file:///P|/"+request.uid+"_lst.html"
// Variable para Impresora y papel
var BodyLines=8; // Nro. Lins. del Cuerpo
var PaperLines=72; // Nro. Lins. del Papel Pagaré
var PaperTray=60; // Nro. Lins. del Papel Bandeja
var PaperTLines=74; // Nro. Lins. del Papel Talón
var HeadPosLin=20; // Nro. Lin. de Cabecera (luego del logo)
var FootPosLin=43; // Nro. Lin. del Pie (pagaré)
var CompLetOn=""; // Código on Letra comprimida
var CompLetOff=""; // Código off Letra comprimida
var LongLine=66; // Longitud de línea
var CarPad="-"; // Caracter de relleno
// Variables de traducción de dígitos -- Se ha fracasado con matrices en el SERVER
var mat_un_0="";
var mat_un_1="";
var mat_un_2="";
var mat_un_3="";
var mat_un_4="";
var mat_un_5="";
var mat_un_6="";
var mat_un_7="";
var mat_un_8="";
var mat_un_9="";
var mat_ud_0="";
var mat_ud_1="";
var mat_ud_2="";
var mat_ud_3="";
var mat_ud_4="";
var mat_ud_5="";
var mat_ud_6="";
var mat_ud_7="";
var mat_ud_8="";
var mat_ud_9="";
var mat_de_1="";
var mat_de_2="";
var mat_de_3="";
var mat_de_4="";
var mat_de_5="";
var mat_de_6="";
var mat_de_7="";
var mat_de_8="";
var mat_de_9="";
var mat_ce_1="";
var mat_ce_2="";
var mat_ce_3="";
var mat_ce_4="";
var mat_ce_5="";
var mat_ce_6="";
var mat_ce_7="";
var mat_ce_8="";
var mat_ce_9="";
var mat_mll_1="";
var mat_mll_2="";
var mat_mll_3="";
var mat_mll_4="";
var mat_mll_5="";
var mat_mll_6="";
var mat_mll_7="";
var mat_mll_8="";
var mat_mll_9="";
var let_ciens=""; // cientos
var let_cient=""; // ciento
var let_cien=""; // cien
var let_plus100=""; // ciento
var let_un=""; // un
var let_mil=""; // mil
var let_mill=""; // cadena "llón"
var let_mills=""; // cadena "llones"
var let_con=""; // con para decimales
var car_dec=""; // carácter decimales
var num_let=""; // resultado
var num_let2=""; // resultado
var tx_cent="";
var tx_dece="";
var tx_und="";
var tx_mll="";
var txletmll="";
var txletmil="";
var linPad="";
dbAcl();
if (request.doc_clean) {
cleanup_docspago();
redirect(addClient("g_docpago.html?"+baseHtml));
}
if (request.doc_pago) {
if (updPagoFras()) {
cleanup_docspago();
redirect(addClient("g_docpago.html?"+baseHtml));
}
}
if (request.doc_delete) {
// Borramos en tabla de pagos datos del usuario
if ( request.h_nro_doc != "0" ) {
criteria=" nro_doc_pago >= '"+NroUnformat(request.d_nro_doc)+"' and nro_doc_pago <= '"+NroUnformat(request.h_nro_doc)+"'";
} else {
criteria=" nro_doc_pago = '"+NroUnformat(request.d_nro_doc)+"'";
}
client.is_trans=true;
database.beginTransaction();
c_docspago = database.cursor("SELECT nro_reg FROM docspago WHERE uid='"+request.uid+"' and "+ criteria+" order by nro_reg ");
while (c_docspago.next()) {
// DesBloquear factura
status=database.execute("UPDATE facturas SET is_locked='' WHERE nro_reg='"+c_docspago.nro_reg+"'");
}
c_docspago.close();
status=database.execute("DELETE FROM docspago WHERE uid=\'" + request.uid+ "\' and "+criteria);
database.commitTransaction();
client.is_trans=false;
}
if (request.gofunc)
writeln(' ');
writeln('');
writeln('');
writeln('');
writeln("');
if (request.docpago) {
writeln("");
}
if (request.doc_list) {
writeln("");
}
if (request.f_tipo_doc_pago == "2" && request.doc_carta) {
writeln("");
}
if (request.f_tipo_doc_pago == "2" && request.doc_file) {
writeln("");
}
if (request.test) {
writeln("");
}
if( request.f_orden && !request.test) {
if (!request.gofunc) {
dbConnect();
LoadParametros();
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+" f_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+" f_pago <= '"+v_hasta+"' "
}
if ( request.h_mes_fra.length > 0 ) {
if (criterio.length > 0 )
criterio=criterio+" and "
criterio=criterio+" facturas.mes >= '"+request.d_mes_fra+"' and facturas.mes <= '"+request.h_mes_fra+"'"
} else {
if ( request.d_mes_fra.length > 0 ) {
if (criterio.length > 0 )
criterio=criterio+" and "
criterio=criterio+" facturas.mes >= '"+request.d_mes_fra+"'"
}
}
if ( request.h_cod_centro.length > 0 ) {
if (criterio.length > 0 )
criterio=criterio+" and "
criterio=criterio+" cod_centro <= '"+request.d_cod_centro+"' and cod_centro >= '"+request.h_cod_centro+"' "
} else {
if ( request.d_cod_centro.length > 0 ) {
if (criterio.length > 0 )
criterio=criterio+" and "
criterio=criterio+" cod_centro matches '"+request.d_cod_centro+"'"
}
}
if ( request.nif.length > 0 ) {
if (criterio.length > 0 )
criterio=criterio+" and "
criterio=criterio+" facturas.nif matches '"+request.nif+"'"
}
if ( request.h_nro_fra.length > 0 ) {
if (criterio.length > 0 )
criterio=criterio+" and "
criterio=criterio+" facturas.nro_fra >= '"+request.d_nro_fra+"' and facturas.nro_fra <= '"+request.h_nro_fra+"'"
} else {
if ( request.d_nro_fra.length > 0 ) {
if (criterio.length > 0 )
criterio=criterio+" and "
criterio=criterio+" facturas.nro_fra >= '"+request.d_nro_fra+"'"
}
}
if ( request.h_nro_regn.length > 0 ) {
if (criterio.length > 0 )
criterio=criterio+" and "
criterio=criterio+" facturas.nro_reg >= '"+StringClip(true,request.d_nro_regy)+StringClip(true,request.d_nro_regn)+"' and facturas.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+" facturas.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+"'"
}
var nro=parseFloat(NroUnformat(request.f_importe_min));
critIMP="";
if ( nro > 0 ) {
critIMP=" and importe_total >= '"+nro+"'"
}
if (criterio.length > 0 )
criterio=" and "+criterio;
request.criterio=criterio;
c_facturas = database.cursor("SELECT * FROM facturas,proveedores,centros WHERE facturas.nif=proveedores.nif and facturas.cod_centro=centros.cod_centro "+
" and is_locked !='S' and f_emision_pago is null and proveedores.cond_pago != '"+client.pa_cp_lock+"'"+
" and tipo_doc_pago ='"+request.f_tipo_doc_pago+"' "+
" and facturas.cond_pago != '"+client.pa_cp_lock+"' and importe_total > 0 "+criterio +
critIMP+" ORDER BY " + request.f_orden);
}
// if (!c_facturas)
// DbsError(false,-1);
// else {
// writeln("");
// c_facturas.close();
// }
}
criterio="Doc. Pago";
writeln("');
if ( request.FrameType == "F" || request.FrameType == "T" ) {
writeln("");
}
if (!request.waux) {
if (request.gofunc) {
writeln('');
writeln('