Prove tecniche di rimborso
Aggiustato menu indice per ditta singola git-svn-id: svn://10.65.10.50/trunk@1417 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									a88c72ee56
								
							
						
					
					
						commit
						86cc17e39e
					
				@ -23,7 +23,7 @@ inline TLiquidazione_app& app()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TLiquidazione_app::TLiquidazione_app(int m) :
 | 
					TLiquidazione_app::TLiquidazione_app(int m) :
 | 
				
			||||||
_ditte(NULL), _selected(10000),
 | 
					_ditte(NULL), _selected(10000),
 | 
				
			||||||
_year(4), _nomiditte(100), _menu(m)
 | 
					_year(4), _nomiditte(100), _menu(m), _firm_bookmark(-1)
 | 
				
			||||||
{ 
 | 
					{ 
 | 
				
			||||||
  _isprint = _is_interactive = _canprint = TRUE; 
 | 
					  _isprint = _is_interactive = _canprint = TRUE; 
 | 
				
			||||||
  _isplafond = _printonly = _is_visliq = FALSE; 
 | 
					  _isplafond = _printonly = _is_visliq = FALSE; 
 | 
				
			||||||
 | 
				
			|||||||
@ -40,13 +40,18 @@ class TProgind;
 | 
				
			|||||||
#define SOGLIA_TRIM_ALTRE     real(1000000000)
 | 
					#define SOGLIA_TRIM_ALTRE     real(1000000000)
 | 
				
			||||||
// minima percentuale di operazioni esenti per aver diritto al rimborso
 | 
					// minima percentuale di operazioni esenti per aver diritto al rimborso
 | 
				
			||||||
// infrannuale
 | 
					// infrannuale
 | 
				
			||||||
#define MIN_PARTE_ESENTE      real(0.50)
 | 
					#define MIN_PARTE_ESENTE      real(0.25)
 | 
				
			||||||
// percentuale IVA da versare in acconto a dicembre
 | 
					// percentuale IVA da versare in acconto a dicembre
 | 
				
			||||||
#define ACCONTO_DICEMBRE      real(0.88)
 | 
					#define ACCONTO_DICEMBRE      real(0.88)
 | 
				
			||||||
// percentuale degli imponibili da usare nel calcolo aliquota
 | 
					// percentuale degli imponibili da usare nel calcolo aliquota
 | 
				
			||||||
// media acquisti e vendite per controllo diritto al rimborso
 | 
					// media acquisti e vendite per controllo diritto al rimborso
 | 
				
			||||||
// infraanuuale secondo norme 1994
 | 
					// infraanuuale secondo norme 1994
 | 
				
			||||||
 | 
					// ANNULLATO ANCOR PRIMA DI ESISTERE; LO LASCIO PER MEMORIA FUTURA
 | 
				
			||||||
 | 
					// (due giorni di lavoro)
 | 
				
			||||||
#define PERC_IMP_RIMBORSABILE real(0.51)   
 | 
					#define PERC_IMP_RIMBORSABILE real(0.51)   
 | 
				
			||||||
 | 
					// NUOVO ENNESIMO CRITERIO RIMBORSO; mi si scusera' un minimo di
 | 
				
			||||||
 | 
					// risentimento
 | 
				
			||||||
 | 
					#define SOGLIA_MAGGIORE_ALIQUOTA_DEL_CAZZO_PER_AVER_DIRITTO_AL_RIMBORSO  real(0.1)
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// ------------------------------------------------------------------
 | 
					// ------------------------------------------------------------------
 | 
				
			||||||
// Fine parametri modificabili
 | 
					// Fine parametri modificabili
 | 
				
			||||||
 | 
				
			|||||||
@ -451,7 +451,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
 | 
				
			|||||||
  real agr_5            = 0.0;
 | 
					  real agr_5            = 0.0;
 | 
				
			||||||
  real agr_6            = 0.0;
 | 
					  real agr_6            = 0.0;
 | 
				
			||||||
  real agr_7            = 0.0;
 | 
					  real agr_7            = 0.0;
 | 
				
			||||||
  real for_rimb         = 0.0;
 | 
					 | 
				
			||||||
  real acq_ies          = 0.0;
 | 
					  real acq_ies          = 0.0;
 | 
				
			||||||
  real acq_ies_iva      = 0.0;                                    
 | 
					  real acq_ies_iva      = 0.0;                                    
 | 
				
			||||||
  real ult_detr         = 0.0;
 | 
					  real ult_detr         = 0.0;
 | 
				
			||||||
@ -531,7 +530,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
 | 
				
			|||||||
      int     tipoag     = atoi(_iva->get("S5"));
 | 
					      int     tipoag     = atoi(_iva->get("S5"));
 | 
				
			||||||
      int     tipopla    = atoi(_iva->get("S3"));
 | 
					      int     tipopla    = atoi(_iva->get("S3"));
 | 
				
			||||||
      int     tipodet    = atoi(_rmoviva->get("TIPODET"));
 | 
					      int     tipodet    = atoi(_rmoviva->get("TIPODET"));
 | 
				
			||||||
      bool    ivarimb    = _iva->get_bool("B3");
 | 
					      bool    ivarimb    = !_iva->get_bool("B3");
 | 
				
			||||||
      TString tipocr_s   = _rmoviva->get("TIPOCR");       
 | 
					      TString tipocr_s   = _rmoviva->get("TIPOCR");       
 | 
				
			||||||
      int     tipocr     = atoi(tipocr_s);        
 | 
					      int     tipocr     = atoi(tipocr_s);        
 | 
				
			||||||
      real    imponibile = _rmoviva->get_real("IMPONIBILE");
 | 
					      real    imponibile = _rmoviva->get_real("IMPONIBILE");
 | 
				
			||||||
@ -674,11 +673,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
 | 
				
			|||||||
 	      bool ok   = _isagricolo ? tipoagr == 2 : FALSE;
 | 
					 	      bool ok   = _isagricolo ? tipoagr == 2 : FALSE;
 | 
				
			||||||
 	      
 | 
					 	      
 | 
				
			||||||
 	      if (tipomov == acquisto && !ok)
 | 
					 	      if (tipomov == acquisto && !ok)
 | 
				
			||||||
 	         ok = (tipocr == 0 || tipocr == 1 || tipocr == 5);
 | 
					 	         ok = (tipocr == 0 || tipocr == 1 || tipocr == 5 || tipocr == 9);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 	  	  if (tipomov == vendita && !ok)
 | 
					 	  	  if (tipomov == vendita && !ok)
 | 
				
			||||||
 	  	    ok = tipoiva.empty() && tipodoc != "CR" && 
 | 
					 	  	    ok = tipoiva != "NS" && tipodoc != "CR" && 
 | 
				
			||||||
 	  	         tipodoc != "SC" && tipodoc != "RF";
 | 
					 	  	         tipodoc != "SC" && tipodoc != "RF" && tipocr != 4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          if (ok)
 | 
					          if (ok)
 | 
				
			||||||
 	  	  {
 | 
					 	  	  {
 | 
				
			||||||
 | 
				
			|||||||
@ -305,14 +305,22 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts)
 | 
				
			|||||||
  // ---------------------- condizione 2
 | 
					  // ---------------------- condizione 2
 | 
				
			||||||
  // u'casinu pazzescu d'u nuiu guvernu 
 | 
					  // u'casinu pazzescu d'u nuiu guvernu 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // due array dove ficcare i totali per 
 | 
					 | 
				
			||||||
  // codiva in ordine di imponibile
 | 
					 | 
				
			||||||
  TArray varr, aarr; 
 | 
					 | 
				
			||||||
  real   vtot = 0.0;
 | 
					  real   vtot = 0.0;
 | 
				
			||||||
  real   atot = 0.0;
 | 
					  real   atot = 0.0;
 | 
				
			||||||
  real   ivav = 0.0;
 | 
					  real   ivav = 0.0;
 | 
				
			||||||
  real   ivaa = 0.0; 
 | 
					  real   ivaa = 0.0; 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  real alv = 0.0;    // aliquota media vendite
 | 
				
			||||||
 | 
					  real ala = 0.0;    // aliquota media acquisti  
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  /***********************************************************************
 | 
				
			||||||
 | 
					    Sembra che sia stato annullato subito dopo che ho finito di scrivere
 | 
				
			||||||
 | 
					    queste 150 righe di casino
 | 
				
			||||||
 | 
					    ***********************************************************************                                               
 | 
				
			||||||
 | 
					    // due array dove ficcare i totali per 
 | 
				
			||||||
 | 
					    // codiva in ordine di imponibile
 | 
				
			||||||
 | 
					    TArray varr, aarr; 
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    // scorri i bellissimi progressivi mensili rimborso
 | 
					    // scorri i bellissimi progressivi mensili rimborso
 | 
				
			||||||
    for (_rmb->first(); !_rmb->eof(); _rmb->next()) 
 | 
					    for (_rmb->first(); !_rmb->eof(); _rmb->next()) 
 | 
				
			||||||
    {                                   
 | 
					    {                                   
 | 
				
			||||||
@ -390,9 +398,6 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts)
 | 
				
			|||||||
    vtot *= PERC_IMP_RIMBORSABILE;
 | 
					    vtot *= PERC_IMP_RIMBORSABILE;
 | 
				
			||||||
    atot *= PERC_IMP_RIMBORSABILE;  
 | 
					    atot *= PERC_IMP_RIMBORSABILE;  
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  real alv = 0.0;    // aliquota media vendite
 | 
					 | 
				
			||||||
  real ala = 0.0;    // aliquota media acquisti  
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
    for (w = 0; w < 2; w++)
 | 
					    for (w = 0; w < 2; w++)
 | 
				
			||||||
    {               
 | 
					    {               
 | 
				
			||||||
    TArray& arr  = w == 0 ? varr : aarr; 
 | 
					    TArray& arr  = w == 0 ? varr : aarr; 
 | 
				
			||||||
@ -423,11 +428,40 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts)
 | 
				
			|||||||
    else        ivaa = tiva; 
 | 
					    else        ivaa = tiva; 
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // scorri i bellissimi progressivi mensili rimborso
 | 
				
			||||||
 | 
					  for (_rmb->first(); !_rmb->eof(); _rmb->next()) 
 | 
				
			||||||
 | 
					  {                                   
 | 
				
			||||||
 | 
					    int year  = atoi((const char*)_year);
 | 
				
			||||||
 | 
					    int ryear = atoi((const char*)(*_rmb_anno));
 | 
				
			||||||
 | 
					    int rmese = atoi((const char*)(*_rmb_mese));
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    if (year != ryear  || (rmese < (month - 2) || rmese > month))
 | 
				
			||||||
 | 
					      continue; 
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    real imp = _rmb->get("R0");
 | 
				
			||||||
 | 
					    real iva = _rmb->get("R1");
 | 
				
			||||||
 | 
					    real per = _rmb->get("R2");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // totali imponibili 
 | 
				
			||||||
 | 
					    if ((tiporeg)atoi((const char*)(*_rmb_tiporeg)) == vendita)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      vtot += imp;     
 | 
				
			||||||
 | 
					      ivav += iva;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      atot += imp;
 | 
				
			||||||
 | 
					      ivaa += iva;  
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  // finalmente
 | 
					  // finalmente
 | 
				
			||||||
  alv = ivav/vtot;  alv.round(2);
 | 
					  alv = ivav/vtot;  alv.round(2);
 | 
				
			||||||
  ala = ivaa/atot;  ala.round(2);
 | 
					  ala = ivaa/atot;  ala.round(2);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  if (ala > alv)
 | 
					  if ((ala - alv) > SOGLIA_MAGGIORE_ALIQUOTA_DEL_CAZZO_PER_AVER_DIRITTO_AL_RIMBORSO)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    rimborsami = TRUE;
 | 
					    rimborsami = TRUE;
 | 
				
			||||||
    if (d == NULL) d = new _DescrItem(RIMBORSO);
 | 
					    if (d == NULL) d = new _DescrItem(RIMBORSO);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user