/*
 * JSMin
 * Javascript Compressor
 * http://www.crockford.com/
 * http://www.smallsharptools.com/Projects/Packer/
*/

// V:\1.1.007\js\form\QB\controlli_QB.js

function controllaFabbricati(){var store_app=this.store.getRange();var NUM_GIORNI=0;var VIEW=this.listaFabbricati.getView();var arrayIndici=new Array();var arr=new Array();var b22;var returnValue=true;for(var j=store_app.length-1;j>=0;j--){if(b22=='X'){NUM_GIORNI+=parseInt(store_app[j].get('B22'));arrayIndici.push(this.store.indexOf(store_app[j]));if(NUM_GIORNI>GIORNIANNO){arr.push(arrayIndici);}}else{NUM_GIORNI=parseInt(store_app[j].get('B22'));arrayIndici=new Array();arrayIndici.push(this.store.indexOf(store_app[j]));}
b22=store_app[j].get('B29');}
for(var i=0;i<arr.length;i++){for(var k=0;k<arr[i].length;k++){VIEW.setRowError(arr[i][k],'Totale giorni superiori a 365');returnValue=false;}}
return returnValue;}
function controlloPrimaCasa(){var store_app=this.store.getRange();var NUM_GIORNI=0;var VIEW=this.listaFabbricati.getView();var arrayIndici=new Array();var arr=new Array();var b20;var returnValue=true;for(var j=store_app.length-1;j>=0;j--){if(store_app[j].get('B20')==1){NUM_GIORNI+=parseInt(store_app[j].get('B22'));arrayIndici.push(this.store.indexOf(store_app[j]));if(NUM_GIORNI>GIORNIANNO){arr.push(arrayIndici);}}}
for(var i=0;i<arr.length;i++){for(var k=0;k<arr[i].length;k++){VIEW.setRowError(arr[i][k],'Totale giorni abitazione principale superiori a 365');returnValue=false;}}
return returnValue;}
function controllaUtilizzo5(){var result=false;var returnValue=true;var VIEW=this.listaFabbricati.getView();var utilizzo5=new Array();this.store.each(function(rec){if(rec.get('B20')==5){utilizzo5.push(this.store.indexOf(rec));}
if(rec.get('B20')==1){result=true;}},this)
if(!result){for(var i=0;i<utilizzo5.length;i++){VIEW.setRowError(utilizzo5[i],'Non '+UNI_E+' possibile inserire un fabbricato con Utilizzo 5 <br>se non '+UNI_E+' presente un fabbricato con utilizzo 1');returnValue=false;}}
return returnValue;}
function valid_CasiP(val){if((val==1||val==3)&&(this.editor_B20.getValue()!=9)){return'I casi particolari 1 e 3 possono essere impostati solo con utilizzo 9'}else{return true;}}
function SommaIciDovutaSuPrimoRigo(){var ICI_TOT=0;var ICI_DOVUTA;var B29;var rec=conn.query(getQuery(SEL_ICI,[dichiarazione.getCurrentCfisc()]));if(rec.totalRows>0){Ext.each(rec.rows,function(record){B29=record.B29;var iciDov=Ext.isEmpty(record.ICI_DOVUTA)?0:parseFloat(record.ICI_DOVUTA)
ICI_TOT+=iciDov;if(Ext.isEmpty(B29)){conn.exec(getQuery(UPD_ICI_FABBR,[ICI_TOT.toFixed(2),record.ID]));ICI_TOT=0;}else{conn.exec(getQuery(UPD_ICI_FABBR,['',record.ID]));}},this)}}
function getNumeroGiorniRimanenti(){var store_app=this.store.getRange();var NUM_GIORNI=0;var VIEW=this.listaFabbricati.getView();var arrayIndici=new Array();var arr=new Array();var b22;var returnValue=true;for(var j=store_app.length-1;j>=0;j--){if(b22=='X'){NUM_GIORNI+=parseInt(store_app[j].get('B22'));arrayIndici.push(this.store.indexOf(store_app[j]));if(NUM_GIORNI>GIORNIANNO){arr.push(arrayIndici);}}else{NUM_GIORNI=parseInt(store_app[j].get('B22'));arrayIndici=new Array();arrayIndici.push(this.store.indexOf(store_app[j]));}
b22=store_app[j].get('B29');}
for(var i=0;i<arr.length;i++){for(var k=0;k<arr[i].length;k++){VIEW.setRowError(arr[i][k],'Totale giorni superiori a 365');returnValue=false;}}
return returnValue;}

