138 lines
5.8 KiB
JavaScript
138 lines
5.8 KiB
JavaScript
|
|
// //
|
|||
|
|
// JavaScript Functions //
|
|||
|
|
// //
|
|||
|
|
//////////////////////////////////////
|
|||
|
|
// Algunas variables Globales
|
|||
|
|
|
|||
|
|
function InsAlbLins() {
|
|||
|
|
if ( !request.ab_nro_reg ) {
|
|||
|
|
status=-1
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
var i=1;
|
|||
|
|
var nrolineas=0;
|
|||
|
|
var nroctas=0, nro=0;
|
|||
|
|
nro=parseInt(request.nrolineas);
|
|||
|
|
if ( nro+1 > 1 ) {
|
|||
|
|
for (nl=1;nl<=nro;nl++) {
|
|||
|
|
eval('if ( request.al_'+i+'_cantidad+0 != 0 && request.al_'+i+'_precio_und+0 != 0 ) {'+
|
|||
|
|
'status=database.execute("INSERT INTO albalineas(" +'+
|
|||
|
|
'" nro_lin," +'+
|
|||
|
|
'" nro_reg," +'+
|
|||
|
|
'" cantidad," +'+
|
|||
|
|
'" referencia," +'+
|
|||
|
|
'" descripcion," +'+
|
|||
|
|
'" precio_und ) VALUES (\'" + StringClip(true,request.al_'+i+'_nro_lin) + "\',\'" +'+
|
|||
|
|
'StringClip(true,request.ab_nro_reg) + "\',\'"+'+
|
|||
|
|
'NroUnformat(request.al_'+i+'_cantidad) + "\',\'"+'+
|
|||
|
|
'StringClip(true,request.al_'+i+'_referencia) + "\',\'"+'+
|
|||
|
|
'StringClip(true,request.al_'+i+'_descripcion) + "\',\'"+'+
|
|||
|
|
'NroUnformat(request.al_'+i+'_precio_und ) + "\')");}');
|
|||
|
|
if ( status != 0 ) {
|
|||
|
|
client.is_trans=false;
|
|||
|
|
database.rollbackTransaction();
|
|||
|
|
redirect('error.html?alert=11')
|
|||
|
|
}
|
|||
|
|
DbsError(true,status);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
nroctas=parseInt(request.nroctas);
|
|||
|
|
if ( nroctas+1 > 1 ) {
|
|||
|
|
for (nl=1;nl<=nroctas;nl++) {
|
|||
|
|
eval(' if ( request.ac_'+nl+'_importe+0 != 0 && request.ac_'+nl+'_cod_cta.length > 2 ) {'+
|
|||
|
|
' status=database.execute("INSERT INTO aptecuentas(" + '+
|
|||
|
|
'" nro_lin," + '+
|
|||
|
|
'" nro_reg," +'+
|
|||
|
|
'" tipolin," +'+
|
|||
|
|
'" cod_cta," +'+
|
|||
|
|
'" clave," +'+
|
|||
|
|
'" concepto," +'+
|
|||
|
|
'" importe," +'+
|
|||
|
|
'" tipo_apte," +'+
|
|||
|
|
'" fecha ) VALUES (\'" + StringClip(true,request.ac_'+nl+'_nro_lin) + "\',\'" + '+
|
|||
|
|
'StringClip(true,request.ab_nro_reg) + "\',\'"+'+
|
|||
|
|
'StringClip(true,request.ac_'+nl+'_tipolin) + "\',\'"+'+
|
|||
|
|
'StringClip(true,request.ac_'+nl+'_cod_cta) + "\',\'"+'+
|
|||
|
|
'StringClip(true,request.ac_'+nl+'_clave) + "\',\'"+'+
|
|||
|
|
'StringClip(true,request.ac_'+nl+'_concepto) + "\',\'"+'+
|
|||
|
|
'NroUnformat(request.ac_'+nl+'_importe) + "\',\'"+'+
|
|||
|
|
'StringClip(true,request.ac_'+nl+'_tipo_apte) + "\',\'"+'+
|
|||
|
|
'StringClip(true,datetoString(HOY)) + "\')");}');
|
|||
|
|
if ( status != 0 ) {
|
|||
|
|
client.is_trans=false;
|
|||
|
|
database.rollbackTransaction();
|
|||
|
|
redirect('error.html?alert=12')
|
|||
|
|
}
|
|||
|
|
DbsError(true,status);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function DelAlbLins() {
|
|||
|
|
status=database.execute("DELETE FROM albalineas WHERE nro_reg = \'" + request.ab_nro_reg + "\'");
|
|||
|
|
if ( status != 0 ) {
|
|||
|
|
client.is_trans=false;
|
|||
|
|
database.rollbackTransaction();
|
|||
|
|
redirect('error.html')
|
|||
|
|
}
|
|||
|
|
DbsError(true,status);
|
|||
|
|
status=database.execute("DELETE FROM aptecuentas WHERE nro_reg = \'" + request.ab_nro_reg + "\'");
|
|||
|
|
if ( status != 0 ) {
|
|||
|
|
client.is_trans=false;
|
|||
|
|
database.rollbackTransaction();
|
|||
|
|
redirect('error.html')
|
|||
|
|
}
|
|||
|
|
DbsError(true,status);
|
|||
|
|
}
|
|||
|
|
function scanClaveCta(icta) {
|
|||
|
|
var f=document.f_albaran;
|
|||
|
|
// eval("var clave=f.ac_"+icta+"_clave.value;");
|
|||
|
|
// alert("Clave:"+clave+" linea "+icta);
|
|||
|
|
var importe=0;
|
|||
|
|
var cta="", tipoAte="", tipoLin="";
|
|||
|
|
eval("importe=parseInt(NroUnformat(f.ac_"+icta+"_importe.value));");
|
|||
|
|
eval("cta=f.ac_"+icta+"_cod_cta.value;");
|
|||
|
|
eval("tipoApte=get_value(\'select\',f.ac_"+icta+"_tipo_apte);");
|
|||
|
|
eval("tipoLin=f.ac_"+icta+"_tipolin.value;");
|
|||
|
|
if ( tipoLin == "G" && importe == 0 ) { eval("f.ac_"+icta+"_clave.value=pa_clave_siniva;"); }
|
|||
|
|
if ( tipoLin == "G" && importe > 0 ) { eval("f.ac_"+icta+"_clave.value=pa_clave_coniva;"); }
|
|||
|
|
if ( tipoLin == "G" && importe < 0 ) { eval("f.ac_"+icta+"_clave.value=pa_clave_coniva;"); }
|
|||
|
|
// if ( tipoApte == "D" ) { }
|
|||
|
|
// if ( tipoApte == "H" ) { }
|
|||
|
|
// if ( TipoFra=="2") { // Dev. Retenci<63>n
|
|||
|
|
// if ( tipoLin == "G" || tipoLin == "R" ) { eval("f.acf_"+icta+"_clave.value=pa_clave_dev;"); };
|
|||
|
|
// }
|
|||
|
|
// if ( TipoRet=="1") { // IRPF
|
|||
|
|
// if ( tipoLin == "G" || tipoLin == "R" ) { eval("f.acf_"+icta+"_clave.value=pa_clave_reten_1;"); }
|
|||
|
|
// }
|
|||
|
|
// if ( TipoRet=="2") { // Por Garant<6E>a
|
|||
|
|
// if ( tipoLin == "G" || tipoLin == "R" ) { eval("f.acf_"+icta+"_clave.value=pa_clave_reten_2;"); }
|
|||
|
|
// }
|
|||
|
|
// eval("var clave=f.ac_"+icta+"_clave.value;");
|
|||
|
|
// alert("Clave:"+clave);
|
|||
|
|
}
|
|||
|
|
function AlbDocuHtml(nro_reg) {
|
|||
|
|
var s_seq=getSeqPrt(nprinter);
|
|||
|
|
textoReqs=textoReqs+" "+s_seq;
|
|||
|
|
var nomFile=spoolpath+nprinter+"/req_"+s_seq+".html"
|
|||
|
|
fileRpt=new File(nomFile);
|
|||
|
|
fileRpt.open("w");
|
|||
|
|
fileRpt.writeln('<HTML><HEAD></HEAD>');
|
|||
|
|
nrolin=1;
|
|||
|
|
// CursorTabla("fa","nro_reg","=\'"+nro_reg+"\'",true,"");
|
|||
|
|
// Asignamos a request todas las columnas necesarias para el form.
|
|||
|
|
if (request.f_formato=="documento") {
|
|||
|
|
fileRpt.writeln('</TR></TABLE></CENTER>');
|
|||
|
|
fileRpt.writeln('</BODY>');
|
|||
|
|
fileRpt.writeln('</HTML>');
|
|||
|
|
fileRpt.close();
|
|||
|
|
return nrolin;
|
|||
|
|
}
|
|||
|
|
fileRpt.writeln('</TR></TABLE></CENTER>');
|
|||
|
|
fileRpt.writeln('</BODY>');
|
|||
|
|
fileRpt.writeln('</HTML>');
|
|||
|
|
fileRpt.close();
|
|||
|
|
return nrolin;
|
|||
|
|
}
|
|||
|
|
|