Cacarelle liquidazzione IVA, altre cacarelle rimangono da cacare
git-svn-id: svn://10.65.10.50/trunk@1367 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									b62750d4a9
								
							
						
					
					
						commit
						5e540e903e
					
				@ -2905,7 +2905,7 @@ void CG1500_application::stampa_totali_uno(const real& r1,const real& r2)
 | 
			
		||||
       sbilprec = -sbilprec;
 | 
			
		||||
       pareggio = _tot_dare + sbilprec;
 | 
			
		||||
       set_row(_i++, "@15gSBILANCIO ESERCIZIO PRECEDENTE@49g%r", 
 | 
			
		||||
               &sbilprec);
 | 
			
		||||
         &sbilprec);
 | 
			
		||||
       set_row(_i++, "@28gTOTALE A PAREGGIO@49g%r",&pareggio);
 | 
			
		||||
     }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -199,6 +199,7 @@ class TLiquidazione_app : public TPrint_application
 | 
			
		||||
  long       _n_ditte;         // numero ditte
 | 
			
		||||
  bool       _comp_acconto;    // stiamo calcolando l'acconto
 | 
			
		||||
  TArray     _nomiditte;       // array descr. ditte per sheet
 | 
			
		||||
  bool       _proper_recalc;   // vedi nel testo                                        
 | 
			
		||||
  
 | 
			
		||||
  TProgind*  _prind;
 | 
			
		||||
  int        _row;
 | 
			
		||||
 | 
			
		||||
@ -100,11 +100,18 @@ bool TLiquidazione_app::recalc_all()
 | 
			
		||||
               "Si desidera eseguirlo?"))
 | 
			
		||||
            _recalc = ever;
 | 
			
		||||
       }         
 | 
			
		||||
      
 | 
			
		||||
                             
 | 
			
		||||
       
 | 
			
		||||
       for (int m = 1; m <= _month; m++)   // fino a 13 compreso
 | 
			
		||||
         if (is_month_ok(m, _month) || _recalc == ever)
 | 
			
		||||
         {               
 | 
			
		||||
           if (_prind->iscancelled()) break;
 | 
			
		||||
 | 
			
		||||
           // questo serve ad evitare che il ricalcolo mesi precedenti
 | 
			
		||||
           // per l'annuale segua le stesse regole del ricalcolo annuale
 | 
			
		||||
           // propriamente inteso                      
 | 
			
		||||
           _proper_recalc = m == 13;
 | 
			
		||||
 | 
			
		||||
           update_firm(m);
 | 
			
		||||
         }
 | 
			
		||||
      
 | 
			
		||||
@ -184,8 +191,14 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
 | 
			
		||||
               (const char*)_nditte_r->get("RAGSOC"),
 | 
			
		||||
               (const char*)desatt);
 | 
			
		||||
      if (_prind) _prind->set_text(buf);
 | 
			
		||||
      _vend_arr.destroy();
 | 
			
		||||
      _corr_arr.destroy();
 | 
			
		||||
      
 | 
			
		||||
      // se ricalcola l'annuale si tiene tutte le vendite e corrispettivi di
 | 
			
		||||
      // tutti i lerci mesi
 | 
			
		||||
      if (!(_month == 13 && month > 1))
 | 
			
		||||
      { 
 | 
			
		||||
        _vend_arr.destroy();
 | 
			
		||||
      	_corr_arr.destroy();
 | 
			
		||||
      }                            
 | 
			
		||||
      
 | 
			
		||||
      cattivs = "";
 | 
			
		||||
      
 | 
			
		||||
@ -273,7 +286,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
 | 
			
		||||
    
 | 
			
		||||
    // rimborso infraannuale
 | 
			
		||||
    _DescrItem* rimb_d = NULL;
 | 
			
		||||
    if (month == _month && is_trim(month))
 | 
			
		||||
    if (month == _month)
 | 
			
		||||
    {
 | 
			
		||||
      // unica nel suo genere, recalc_rimborso ritorna
 | 
			
		||||
      // un bel descritem (NULL se non si rimborsa un cas)
 | 
			
		||||
@ -284,7 +297,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
 | 
			
		||||
    if (month == _month)
 | 
			
		||||
    {
 | 
			
		||||
      describe_firm(month);
 | 
			
		||||
      describe_liq(_month, atts, rimb_d);
 | 
			
		||||
      describe_liq(_month, atts, _isregis ? NULL : rimb_d);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return ok || calc;
 | 
			
		||||
@ -308,16 +321,13 @@ bool TLiquidazione_app::update_att(int month, const char* codatt,
 | 
			
		||||
  {
 | 
			
		||||
    zero_att(month,codatt);            
 | 
			
		||||
    recalc_att(month,codatt);          
 | 
			
		||||
    if (month == 13)
 | 
			
		||||
     recalc_annual(codatt);
 | 
			
		||||
    else if (!_isagricolo)
 | 
			
		||||
    if (!_isagricolo)
 | 
			
		||||
    { 
 | 
			
		||||
      // nei PIM della 13a vanno solo alcune stranezze,
 | 
			
		||||
      // mi rifiuto di pensare che vadano ventilate
 | 
			
		||||
      // o corrispettivizzicizzate
 | 
			
		||||
      recalc_ventilation(month, codatt); 
 | 
			
		||||
      recalc_corrispettivi(month, codatt);  
 | 
			
		||||
    }
 | 
			
		||||
    if (month == 13)
 | 
			
		||||
     recalc_annual(codatt);
 | 
			
		||||
  }
 | 
			
		||||
  return ok || calc;  
 | 
			
		||||
}
 | 
			
		||||
@ -363,6 +373,23 @@ void TLiquidazione_app::zero_att(int month, const char* codatt)
 | 
			
		||||
      _pim->put("S1","");
 | 
			
		||||
      _pim->rewrite();
 | 
			
		||||
    }
 | 
			
		||||
  }      
 | 
			
		||||
  if (look_plm(month, codatt))
 | 
			
		||||
  {
 | 
			
		||||
    // zero PLM, POM, PAM, PUM
 | 
			
		||||
    TString codtab(_plm->get("CODTAB"));
 | 
			
		||||
    _plm->zero();
 | 
			
		||||
    _pom->zero();   
 | 
			
		||||
    _pam->zero();   
 | 
			
		||||
    _pum->zero();
 | 
			
		||||
    _plm->put("CODTAB", codtab);   
 | 
			
		||||
    _pom->put("CODTAB", codtab);   
 | 
			
		||||
    _pam->put("CODTAB", codtab);   
 | 
			
		||||
    _pum->put("CODTAB", codtab);   
 | 
			
		||||
    _plm->rewrite();
 | 
			
		||||
    _pam->rewrite();
 | 
			
		||||
    _pom->rewrite();
 | 
			
		||||
    _pum->rewrite();
 | 
			
		||||
  }
 | 
			
		||||
  if (_isplafond && month != 13)
 | 
			
		||||
    zero_plafond(month,codatt);
 | 
			
		||||
@ -403,6 +430,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
 | 
			
		||||
  real corr_misCEE      = 0.0;
 | 
			
		||||
  real acq_misCEE       = 0.0;
 | 
			
		||||
  real acq_misnoCEE     = 0.0;
 | 
			
		||||
  real agr_1i           = 0.0;
 | 
			
		||||
  real agr_2i           = 0.0;
 | 
			
		||||
  real agr_1            = 0.0;
 | 
			
		||||
  real agr_2            = 0.0;
 | 
			
		||||
  real agr_3            = 0.0;
 | 
			
		||||
@ -527,7 +556,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
 | 
			
		||||
       * In liq. annuale si totalizzano
 | 
			
		||||
       * solo le stranezze che seguono
 | 
			
		||||
       */
 | 
			
		||||
      if (_month == 13)
 | 
			
		||||
      if (_month == 13 && _proper_recalc)
 | 
			
		||||
      {         
 | 
			
		||||
        // si contano soltanto le vendite.
 | 
			
		||||
        bool okc = tipomov == vendita;  
 | 
			
		||||
@ -728,9 +757,15 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
 | 
			
		||||
          if (tipomov == vendita)
 | 
			
		||||
          {
 | 
			
		||||
            if (tipoagr == 1 || tipoagr == 3)
 | 
			
		||||
              agr_1 += imposta;
 | 
			
		||||
            {  
 | 
			
		||||
              agr_1  += imposta;       
 | 
			
		||||
              agr_1i += imponibile;
 | 
			
		||||
            }
 | 
			
		||||
            else if (tipoagr == 2)
 | 
			
		||||
              agr_2 += imposta;
 | 
			
		||||
            {
 | 
			
		||||
              agr_2  += imposta;
 | 
			
		||||
              agr_2i += imponibile;
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          else if (tipodet == 0)
 | 
			
		||||
          {
 | 
			
		||||
@ -1052,6 +1087,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
 | 
			
		||||
    _plm->put("R9",  agr_5);
 | 
			
		||||
    _plm->put("R10", agr_6);
 | 
			
		||||
    _plm->put("R11", agr_7); 
 | 
			
		||||
    _pum->put("R10", agr_1i);
 | 
			
		||||
    _pum->put("R11", agr_2i);
 | 
			
		||||
    
 | 
			
		||||
    // Il porco agricoltore spende poco e paga meno
 | 
			
		||||
    vendite_iva  = agr_2;   
 | 
			
		||||
@ -1060,7 +1097,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
 | 
			
		||||
    // nuovo calcolo IVA detraibile 
 | 
			
		||||
    if (!agr_7.is_zero())
 | 
			
		||||
    {         
 | 
			
		||||
      real pdetr   = (agr_2 / (agr_1 + agr_2));
 | 
			
		||||
      real pdetr   = (agr_2i / (agr_1i + agr_2i));  
 | 
			
		||||
      pdetr.round(2);
 | 
			
		||||
      acquisti_iva += agr_7 * pdetr;
 | 
			
		||||
      acquisti_iva.round(ROUND_LIRA);
 | 
			
		||||
    }
 | 
			
		||||
@ -1307,9 +1345,10 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
 | 
			
		||||
        {
 | 
			
		||||
          deb_mens    = (bi /((CENTO + aliquota_agvia())/CENTO)) *
 | 
			
		||||
                        (aliquota_agvia()/CENTO);
 | 
			
		||||
          deb_mens.round(ROUND_LIRA);    
 | 
			
		||||
          deb_mens.ceil(ROUND_LIRA);   // ceil voluto MI3074 
 | 
			
		||||
          risultato  += deb_mens; 
 | 
			
		||||
          res_debt   += deb_mens;
 | 
			
		||||
          res_debt   += deb_mens; 
 | 
			
		||||
          iva_vend   += deb_mens;
 | 
			
		||||
        }
 | 
			
		||||
      }      
 | 
			
		||||
    }    
 | 
			
		||||
 | 
			
		||||
@ -558,12 +558,9 @@ real TLiquidazione_app::credito_costo_prec(int month)
 | 
			
		||||
  real c(0.0);
 | 
			
		||||
  if (is_first_month(month))
 | 
			
		||||
  {
 | 
			
		||||
    int yr = atoi(_year)-1;
 | 
			
		||||
    _lim->zero();
 | 
			
		||||
    *_lim_anno = yr;
 | 
			
		||||
    *_lim_mese = 12;
 | 
			
		||||
    if (_lim->read() == NOERR) 
 | 
			
		||||
      c = _lim->get_real("R2");
 | 
			
		||||
    // credito inizio anno
 | 
			
		||||
    if (look_lia()) 
 | 
			
		||||
      c = _lia->get_real("R5");
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
 | 
			
		||||
@ -111,7 +111,7 @@ void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt)
 | 
			
		||||
// ricalcolo della malefica ventilazione
 | 
			
		||||
void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
 | 
			
		||||
{
 | 
			
		||||
  if (!_isvent || _vend_arr.items() == 0) return;
 | 
			
		||||
  if (!_isvent || _isagricolo || _isviaggio || _vend_arr.items() == 0) return;
 | 
			
		||||
 | 
			
		||||
  TString att(codatt);
 | 
			
		||||
 | 
			
		||||
@ -126,13 +126,19 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
 | 
			
		||||
  
 | 
			
		||||
  for (m = 1; m <= month; m++)
 | 
			
		||||
  {
 | 
			
		||||
    // aggiunge gli acquisti del mese m operando sui pim
 | 
			
		||||
    // aggiunge gli acquisti del mese m operando sui pim  
 | 
			
		||||
    for (_pim->first(); !_pim->eof(); _pim->next())
 | 
			
		||||
    {
 | 
			
		||||
      if (_year != *_pim_anno) continue;
 | 
			
		||||
      
 | 
			
		||||
      // se e' acquisto beni per rivendita
 | 
			
		||||
      int tipocr  = atoi(*_pim_tipocr);
 | 
			
		||||
      int mese    = atoi(*_pim_mese);     
 | 
			
		||||
      int tipodet = atoi(*_pim_tipodet);
 | 
			
		||||
      look_iva(*_pim_codiva);
 | 
			
		||||
      // base di riparto solo se non esente, non soggetto, non imponibile
 | 
			
		||||
      TString16 tipoiva(_iva->get("S1"));                        
 | 
			
		||||
      TString16 reg = *_pim_codreg;
 | 
			
		||||
      
 | 
			
		||||
      /*
 | 
			
		||||
       * se non si e' settato il ricalcolo nei parametri ditta
 | 
			
		||||
@ -151,14 +157,11 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
 | 
			
		||||
      if (tipocr == 5 && tipodet == 3)
 | 
			
		||||
        continue;
 | 
			
		||||
      
 | 
			
		||||
      TString att(codatt); 
 | 
			
		||||
      if (tipocr == 1 && mese == m && att == (const char*)(*_pim_codatt))  
 | 
			
		||||
      TString att(codatt);                     
 | 
			
		||||
      
 | 
			
		||||
      if (tipocr == 1 && (mese == m) && 
 | 
			
		||||
          att == (const char*)(*_pim_codatt))  
 | 
			
		||||
      {
 | 
			
		||||
        look_iva(*_pim_codiva);
 | 
			
		||||
 | 
			
		||||
        // base di riparto solo se non esente, non soggetto, non imponibile
 | 
			
		||||
        TString tipoiva(_iva->get("S1"));                        
 | 
			
		||||
        
 | 
			
		||||
        if (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES")   
 | 
			
		||||
        {
 | 
			
		||||
          real lurd     = _pim->get_real("R0");
 | 
			
		||||
@ -183,8 +186,8 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
 | 
			
		||||
  
 | 
			
		||||
  for (int j = 0; j < _vent_arr.items(); j++)
 | 
			
		||||
  {
 | 
			
		||||
    _VentItem* vv = (_VentItem*)&_vent_arr[j];
 | 
			
		||||
    totacq += vv->_totale;
 | 
			
		||||
    _VentItem& vv = (_VentItem&)_vent_arr[j];
 | 
			
		||||
    totacq += vv._totale;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  // 3) ricalcola (solo per il mese in corso!) operando sull'array 
 | 
			
		||||
@ -235,10 +238,11 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
 | 
			
		||||
      _pim->rewrite();
 | 
			
		||||
    }
 | 
			
		||||
  }   
 | 
			
		||||
 | 
			
		||||
  // memorizza totali per il prospettino di m.
 | 
			
		||||
  look_plm(month, codatt);
 | 
			
		||||
 | 
			
		||||
  // TBI PAM e PUM
 | 
			
		||||
  // PAM e PUM
 | 
			
		||||
  _pam->put("R2",totacq);
 | 
			
		||||
  _pam->put("R3",totven);
 | 
			
		||||
  _pam->rewrite();
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										159
									
								
								cg/cg4304.cpp
									
									
									
									
									
								
							
							
						
						
									
										159
									
								
								cg/cg4304.cpp
									
									
									
									
									
								
							@ -194,16 +194,12 @@ void TLiquidazione_app::describe_plafond(int month, const char* codatt)
 | 
			
		||||
 | 
			
		||||
void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
 | 
			
		||||
{                                      
 | 
			
		||||
  if (!_isvent) return;
 | 
			
		||||
  if (!_isvent || _isagricolo || _isviaggio) return;
 | 
			
		||||
  
 | 
			
		||||
  _DescrItem* d = new _DescrItem(VENTILA);
 | 
			
		||||
  TString att(codatt);
 | 
			
		||||
 | 
			
		||||
  look_plm(month, att);
 | 
			
		||||
  real r0 = _pam->get("R2");
 | 
			
		||||
  real r1 = _pam->get("R3");
 | 
			
		||||
  
 | 
			
		||||
  d->_r0 = r0; d->_r1 = r1;
 | 
			
		||||
  look_plm(month, att);
 | 
			
		||||
  
 | 
			
		||||
  for (_pim->first(); !_pim->eof(); _pim->next())
 | 
			
		||||
  {
 | 
			
		||||
@ -220,14 +216,21 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
 | 
			
		||||
    real    imponibile  = _pim->get_real("R0");
 | 
			
		||||
    real    imposta     = _pim->get_real("R1");
 | 
			
		||||
    tiporeg tipomov     = (tiporeg)_reg->get_long("I0");
 | 
			
		||||
    TString tipoiva    = _iva->get("S1");
 | 
			
		||||
 | 
			
		||||
    if (_year != *_pim_anno)  continue;                                      
 | 
			
		||||
 | 
			
		||||
    if (imponibile.is_zero() && imposta.is_zero()) continue;
 | 
			
		||||
 | 
			
		||||
    // questi non vanno in liquidazione, i totali sono
 | 
			
		||||
    // gia' calcolati altrove
 | 
			
		||||
    if (tipodet == 1 || tipodet == 3 || tipodet == 9)
 | 
			
		||||
      continue;     
 | 
			
		||||
    
 | 
			
		||||
    // questi non si devono vedere perche' so' bbrutti                          
 | 
			
		||||
    if (tipoiva == "NS" || tipoiva == "ES" || tipoiva == "NI")
 | 
			
		||||
      continue;
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    if (mese <= month)
 | 
			
		||||
    {
 | 
			
		||||
      if (tipocr == 1 && tipomov == acquisto)
 | 
			
		||||
@ -243,14 +246,15 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
 | 
			
		||||
        if (vd == NULL) { vd = new _vDesc; }
 | 
			
		||||
 | 
			
		||||
        vd->_acq += (imponibile+imposta);
 | 
			
		||||
 | 
			
		||||
        d->_r0   += (imponibile+imposta); 
 | 
			
		||||
        
 | 
			
		||||
        if (vd->_codiva.empty()) 
 | 
			
		||||
        {
 | 
			
		||||
          vd->_codiva = *_pim_codiva;
 | 
			
		||||
          d->_arr.add(vd);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      else if (is_month_ok(mese,month) && corrisp 
 | 
			
		||||
      else if ((is_month_ok(mese,month)  || month == 13) && corrisp 
 | 
			
		||||
               && _pim->get_bool("B1") &&
 | 
			
		||||
               tipocr == 0 && tipomov == vendita)
 | 
			
		||||
        // non sono sicurissimo della above condition
 | 
			
		||||
@ -268,6 +272,8 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
 | 
			
		||||
        vd->_vnd  += imponibile;
 | 
			
		||||
        vd->_viv  += imposta;
 | 
			
		||||
        
 | 
			
		||||
        d->_r1     += imponibile+imposta;
 | 
			
		||||
        
 | 
			
		||||
        if (vd->_codiva.empty()) 
 | 
			
		||||
        {
 | 
			
		||||
          vd->_codiva = *_pim_codiva;
 | 
			
		||||
@ -276,7 +282,10 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }  
 | 
			
		||||
  _descr_arr.add(d);
 | 
			
		||||
  if (d->_r1.is_zero() || d->_r0.is_zero())
 | 
			
		||||
    delete d;
 | 
			
		||||
  else
 | 
			
		||||
    _descr_arr.add(d);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TLiquidazione_app::describe_agricolo(int month, const char* codatt)
 | 
			
		||||
@ -297,7 +306,9 @@ void TLiquidazione_app::describe_agricolo(int month, const char* codatt)
 | 
			
		||||
    d->_r3 += _plm->get_real("R8");  
 | 
			
		||||
    d->_r4 += _plm->get_real("R9");     
 | 
			
		||||
    d->_r5 += _plm->get_real("R10");  
 | 
			
		||||
    d->_r6 += _plm->get_real("R11");
 | 
			
		||||
    d->_r6 += _plm->get_real("R11");     
 | 
			
		||||
    d->_r7 += _pum->get_real("R10");
 | 
			
		||||
    d->_r8 += _pum->get_real("R11");
 | 
			
		||||
  }  
 | 
			
		||||
  _descr_arr.add(d);
 | 
			
		||||
}
 | 
			
		||||
@ -519,6 +530,27 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
 | 
			
		||||
    }
 | 
			
		||||
    _descr_arr.add(ads);        
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // ag. viaggio: iva dovuta 74 ter la vogliono in mezzo ai progressivi
 | 
			
		||||
  look_lim(month);
 | 
			
		||||
  real iva74t = _lim->get_real("R3");  
 | 
			
		||||
  if (iva74t.sign() > 0)
 | 
			
		||||
  {
 | 
			
		||||
    _DescrItem* ads = new _DescrItem(PIM_ROW);
 | 
			
		||||
    ads->_s0 = "74TER";                // cosi' vollero
 | 
			
		||||
    ads->_s1 = "IVA ";                 // cosi' vollero
 | 
			
		||||
    ads->_s2 = " dovuta - 74 ter";     // cosi' vollero
 | 
			
		||||
    ads->_r1 = iva74t;
 | 
			
		||||
    t1      += iva74t; 
 | 
			
		||||
    if (isfirst)
 | 
			
		||||
    {
 | 
			
		||||
      isfirst = FALSE;
 | 
			
		||||
      ads->_f0  = TRUE;
 | 
			
		||||
    }
 | 
			
		||||
    _descr_arr.add(ads);        
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // prepara una bella riga di totali
 | 
			
		||||
  if (/* !isfirst */ TRUE)
 | 
			
		||||
  {
 | 
			
		||||
@ -531,15 +563,18 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
 | 
			
		||||
    _DescrItem* t = new _DescrItem(MISC_LIQ);
 | 
			
		||||
    t->_f1 = isfirst;  // per il form feed
 | 
			
		||||
    
 | 
			
		||||
    TToken_string ttm("0|0|0");
 | 
			
		||||
 | 
			
		||||
    for (int m = 1; m <= month && m < 13; m++)
 | 
			
		||||
    {
 | 
			
		||||
      if (!is_month_ok(m,month)) continue;
 | 
			
		||||
 | 
			
		||||
      atts.restart();
 | 
			
		||||
      atts.restart();   
 | 
			
		||||
      while ((tmpatt = atts.get()) != NULL)
 | 
			
		||||
      {
 | 
			
		||||
        TString att(tmpatt);
 | 
			
		||||
        look_plm(m, att);
 | 
			
		||||
        look_plm(m, att);                                
 | 
			
		||||
        real ad1, ad2;
 | 
			
		||||
        
 | 
			
		||||
        d->_r6  += _pom->get_real("R0");  // acq. intracomunitari
 | 
			
		||||
        d->_r7  += _pom->get_real("R1");  // inded. art 19
 | 
			
		||||
@ -556,9 +591,16 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
 | 
			
		||||
        t->_r9  += _pum->get_real("R1");  // IVA su cessioni ammort.
 | 
			
		||||
        t->_r10 += _pum->get_real("R4");  // tot. esenti IVA
 | 
			
		||||
        t->_r11 += _plm->get_real("R2");  // pro-rata indetraibile
 | 
			
		||||
        t->_s0  =  (_plm->get_real("R12")).string();  // % pro-rata  
 | 
			
		||||
        t->_s0  << "|" << _pom->get_real("R11").string();   // imp. acq. amm. indetr.
 | 
			
		||||
        t->_s0  << "|" << _pom->get_real("R12").string();   // IVA  acq. amm. indetr
 | 
			
		||||
 | 
			
		||||
        ad1 = real(ttm.get(1));
 | 
			
		||||
        ad2 = real(ttm.get(2));        
 | 
			
		||||
        ad1 += _pom->get_real("R11");
 | 
			
		||||
        ad2 += _pom->get_real("R12");        
 | 
			
		||||
        ttm.add(_plm->get("R12"), 0);     // % pro-rata 
 | 
			
		||||
        ttm.add(ad1.string(),1);          // imp. acq. amm. indetr.
 | 
			
		||||
        ttm.add(ad2.string(),2);          // IVA  acq. amm. indetr
 | 
			
		||||
        t->_s0  = ttm;   
 | 
			
		||||
 | 
			
		||||
        t->_f0  =  !_prorata.is_zero();   // flag per segnalare l'esistenza      
 | 
			
		||||
        d->_r9  += _pom->get_real("R9");  // acq. inded. su ricavi esenti 
 | 
			
		||||
        d->_r10 += _pom->get_real("R10"); // IVA acq. inded. su ricavi esenti 
 | 
			
		||||
@ -591,7 +633,8 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
 | 
			
		||||
        vnsi += _pam->get_real("R8");
 | 
			
		||||
        vnsv += _pam->get_real("R9");
 | 
			
		||||
        
 | 
			
		||||
        tt = aqsi.string();
 | 
			
		||||
        tt = "";
 | 
			
		||||
        tt.add(aqsi.string());
 | 
			
		||||
        tt.add(aqsv.string());
 | 
			
		||||
        tt.add(vnsi.string());
 | 
			
		||||
        tt.add(vnsv.string());
 | 
			
		||||
@ -601,10 +644,6 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
 | 
			
		||||
    } // for (mese ok)
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    // ag. viaggio: iva dovuta 74 ter
 | 
			
		||||
    look_lim(month);
 | 
			
		||||
    d->_s2 = _lim->get_real("R3").string();
 | 
			
		||||
 | 
			
		||||
    // annual follows in _arr
 | 
			
		||||
    if (month == 13 && ref != "ALL")
 | 
			
		||||
    {
 | 
			
		||||
@ -903,27 +942,29 @@ void TLiquidazione_app::set_plafond(_DescrItem& d)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TLiquidazione_app::set_pim(_DescrItem& d)
 | 
			
		||||
{
 | 
			
		||||
{        
 | 
			
		||||
  int rw = 1;
 | 
			
		||||
  if (d._s1 == "A35") 
 | 
			
		||||
  {
 | 
			
		||||
    d._s2 = "Artt.17c3/74c1";
 | 
			
		||||
  } 
 | 
			
		||||
  else if (d._s0 == "74TER")
 | 
			
		||||
    rw++;
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    look_iva(d._s1);
 | 
			
		||||
    d._s2 = _iva->get("S0");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (d._f0)  // e' il primo
 | 
			
		||||
  {
 | 
			
		||||
    // intestazioncina
 | 
			
		||||
    set_bookmark("Riepilogo progressivi", _att_bookmark);
 | 
			
		||||
 | 
			
		||||
    set_row(1," Cod.@41gVENDITE@71gCORRISPETTIVI@106gACQUISTI");
 | 
			
		||||
    set_row(2," IVA Descrizione@30gImponibile@49gImposta@63gImponibile"
 | 
			
		||||
    set_row(rw++," Cod.@41gVENDITE@71gCORRISPETTIVI@106gACQUISTI");
 | 
			
		||||
    set_row(rw++," IVA Descrizione@30gImponibile@49gImposta@63gImponibile"
 | 
			
		||||
            "@82gImposta@96gImponibile@115gImposta");
 | 
			
		||||
    set_row(3,"");
 | 
			
		||||
    set_row(rw++,"");
 | 
			
		||||
  }
 | 
			
		||||
  set_row(d._f0 ? 4 : 1,"%4s %-20s@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r",
 | 
			
		||||
  set_row(rw++,"%4s %-20s@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r",
 | 
			
		||||
          (const char*)d._s1,
 | 
			
		||||
          (const char*)d._s2,
 | 
			
		||||
          &(d._r0),
 | 
			
		||||
@ -1051,14 +1092,14 @@ void TLiquidazione_app::set_pumpam(_DescrItem& d)
 | 
			
		||||
            &(d._r4), 
 | 
			
		||||
            &(d._r5));
 | 
			
		||||
  }
 | 
			
		||||
  if (! (d._r0.is_zero() && d._r1.is_zero()))
 | 
			
		||||
  if (! (ammindi.is_zero() && ammindv.is_zero()))
 | 
			
		||||
  {
 | 
			
		||||
    printed = TRUE;
 | 
			
		||||
    set_row(row++, "Acquisto beni ammortizzabili IVA detraibile@50g%r@69g%r", 
 | 
			
		||||
            &ammindi, 
 | 
			
		||||
            &ammindv);
 | 
			
		||||
  }
 | 
			
		||||
  if (! (ammindi.is_zero() && ammindv.is_zero()))
 | 
			
		||||
  if (! (d._r0.is_zero() && d._r1.is_zero()))
 | 
			
		||||
  {
 | 
			
		||||
    printed = TRUE;
 | 
			
		||||
    set_row(row++, "Acquisto beni ammortizzabili IVA indetraibile@50g%r@69g%r", 
 | 
			
		||||
@ -1414,14 +1455,16 @@ void TLiquidazione_app::set_regagr(_DescrItem& d)
 | 
			
		||||
{
 | 
			
		||||
  set_print_zero(TRUE);
 | 
			
		||||
 | 
			
		||||
  real& agr_1 = d._r0;
 | 
			
		||||
  real& agr_2 = d._r1;
 | 
			
		||||
  real& agr_3 = d._r2;
 | 
			
		||||
  real& agr_4 = d._r3;
 | 
			
		||||
  real& agr_5 = d._r4;
 | 
			
		||||
  real& agr_6 = d._r5;
 | 
			
		||||
  real& agr_7 = d._r6;                                     
 | 
			
		||||
  
 | 
			
		||||
  real& agr_1  = d._r0;
 | 
			
		||||
  real& agr_2  = d._r1;
 | 
			
		||||
  real& agr_3  = d._r2;
 | 
			
		||||
  real& agr_4  = d._r3;
 | 
			
		||||
  real& agr_5  = d._r4;
 | 
			
		||||
  real& agr_6  = d._r5;
 | 
			
		||||
  real& agr_7  = d._r6;                                     
 | 
			
		||||
  real& agr_1i = d._r7;
 | 
			
		||||
  real& agr_2i = d._r8;
 | 
			
		||||
 | 
			
		||||
  real ara = agr_5 + agr_6;
 | 
			
		||||
  real arn = agr_3 + agr_4;
 | 
			
		||||
  
 | 
			
		||||
@ -1444,28 +1487,30 @@ void TLiquidazione_app::set_regagr(_DescrItem& d)
 | 
			
		||||
  
 | 
			
		||||
  if (/*agr_7.sign() > 0*/ TRUE)
 | 
			
		||||
  {
 | 
			
		||||
    real pdetr  = (agr_2 / (agr_1 + agr_2));
 | 
			
		||||
    real pdetr  = (agr_2i / (agr_1i + agr_2i)); 
 | 
			
		||||
    pdetr.round(2);
 | 
			
		||||
    real ivadt  = agr_7 * pdetr;           
 | 
			
		||||
    pdetr *= CENTO; pdetr.round(2);
 | 
			
		||||
    pdetr *= CENTO; 
 | 
			
		||||
    pdetr.round(ROUND_LIRA);
 | 
			
		||||
    ivadt.round(ROUND_LIRA);
 | 
			
		||||
 | 
			
		||||
    TString up = agr_2.string(".");
 | 
			
		||||
    TString up = agr_2i.string(".");
 | 
			
		||||
    up << " x 100";
 | 
			
		||||
    TString dn = agr_1.string(".");
 | 
			
		||||
    dn << " + " << agr_2.string(".");
 | 
			
		||||
    TString dn = agr_1i.string(".");
 | 
			
		||||
    dn << " + " << agr_2i.string(".");
 | 
			
		||||
    int ln = max(up.len(), dn.len()) + 2; 
 | 
			
		||||
    TString den(ln); den.fill('-');
 | 
			
		||||
    up.center_just(ln); dn.center_just(ln);
 | 
			
		||||
 | 
			
		||||
    set_row(13, "");
 | 
			
		||||
    set_row(14, "@31g%s", (const char*)up);
 | 
			
		||||
    set_row(15, "Percentuale di detraibilita'@31g%s = @64g%s",
 | 
			
		||||
    set_row(15, "Percentuale di detraibilita'@31g%s = @54g%r",
 | 
			
		||||
            (const char*)den, 
 | 
			
		||||
            (const char*)pdetr.string("##,##"));
 | 
			
		||||
            &pdetr);
 | 
			
		||||
    set_row(16, "@31g%s", (const char*)dn);
 | 
			
		||||
 | 
			
		||||
    up = agr_7.string(".");
 | 
			
		||||
    up << " x " << pdetr.string(".2");
 | 
			
		||||
    up << " x " << pdetr.string(".");
 | 
			
		||||
    dn = "100";
 | 
			
		||||
    if ((max(up.len(), dn.len()) + 2) > ln)
 | 
			
		||||
      ln = max(up.len(), dn.len()) + 2; 
 | 
			
		||||
@ -1491,7 +1536,7 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
 | 
			
		||||
  // Nel corso della scrittura di questa funzione
 | 
			
		||||
  // Berlusconi + Fini + Bossi hanno vinto le elezioni
 | 
			
		||||
  // Il moderno imprenditore illuminato dalla fiamma tricolore
 | 
			
		||||
  // ha rincoglionito gli imbecilli con la TV
 | 
			
		||||
  // ha rincoglionito gli imbecilli con la TV e gli stronzi con la P2
 | 
			
		||||
  // Che la rovina, la galera e la giustizia rossa 
 | 
			
		||||
  // possano aver campo su tutto
 | 
			
		||||
  
 | 
			
		||||
@ -1551,7 +1596,7 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
 | 
			
		||||
  real rip = d._r7; rip.round(2);
 | 
			
		||||
  
 | 
			
		||||
  // la bella frazioncina degli imponibili viaggi misti
 | 
			
		||||
  TString tmp2 = d._r3.string(REAL_PICTURE); tmp2.ltrim(); 
 | 
			
		||||
  TString tmp2 = d._r1.string(REAL_PICTURE); tmp2.ltrim(); 
 | 
			
		||||
  TString up2 = tmp2;
 | 
			
		||||
  up2 << " x " << rip.string(2);
 | 
			
		||||
  TString dn2 = "100";
 | 
			
		||||
@ -1605,9 +1650,6 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
 | 
			
		||||
  
 | 
			
		||||
  real bil = tmr - tma - d._r8;
 | 
			
		||||
  
 | 
			
		||||
  bool iscred = bil.sign() < 0;
 | 
			
		||||
  bil = abs(bil);
 | 
			
		||||
 | 
			
		||||
  tmp = tmr.string(REAL_PICTURE); tmp.ltrim();
 | 
			
		||||
  up = "["; up << tmp << " - (";
 | 
			
		||||
  tmp = tma.string(REAL_PICTURE); tmp.ltrim();
 | 
			
		||||
@ -1616,18 +1658,15 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
 | 
			
		||||
  up << tmp << ")]";
 | 
			
		||||
  den.fill('.',59-up.len());
 | 
			
		||||
 | 
			
		||||
  set_row(26,"Base imponibile lorda@40g%t %t@100g%r", &up, &den, &bil);
 | 
			
		||||
  set_row(27,"");
 | 
			
		||||
  set_row(26,"");
 | 
			
		||||
  set_row(iscred ? 28 : 26,"%s@40g%t %t@100g%r", 
 | 
			
		||||
          iscred ? "CREDITO DI COSTO " : "Base imponibile lorda",
 | 
			
		||||
          &up, &den, &bil);
 | 
			
		||||
 | 
			
		||||
  if (bil.sign() > 0 && !iscred)
 | 
			
		||||
  if (bil.sign() > 0)
 | 
			
		||||
  {
 | 
			
		||||
    real aliva  = aliquota_agvia();
 | 
			
		||||
    real alcnt  = aliquota_agvia() + CENTO;
 | 
			
		||||
    real dovuta = (bil/(alcnt/CENTO)) * (aliva/CENTO); 
 | 
			
		||||
    dovuta.round(ROUND_LIRA);
 | 
			
		||||
    dovuta.ceil(ROUND_LIRA);          // ceil voluto da MI3074
 | 
			
		||||
    
 | 
			
		||||
    tmp = bil.string(REAL_PICTURE); tmp.ltrim(); 
 | 
			
		||||
    up = tmp;
 | 
			
		||||
@ -1643,6 +1682,12 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d)
 | 
			
		||||
    set_row(29,"IVA A DEBITO@40g%t %t@100g%r", &den, &tmp, &dovuta);
 | 
			
		||||
    set_row(30,"@40g%t", &dn);
 | 
			
		||||
  }
 | 
			
		||||
  else if (bil.sign() < 0)
 | 
			
		||||
  {
 | 
			
		||||
    bil = abs(bil);
 | 
			
		||||
    set_row(28,"");
 | 
			
		||||
    set_row(29,"CREDITO DI COSTO DA RIPORTARE@100g%r", &bil);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  set_print_zero(FALSE);
 | 
			
		||||
  set_auto_ff(TRUE);
 | 
			
		||||
 | 
			
		||||
@ -1913,7 +1913,7 @@ bool CG4400_application::preprocess_page(int file, int counter)
 | 
			
		||||
              printer().formfeed();
 | 
			
		||||
              _intesta_liq = FALSE; 
 | 
			
		||||
              reset_print();
 | 
			
		||||
              fremove(t);
 | 
			
		||||
              remove(t);
 | 
			
		||||
            }  
 | 
			
		||||
          }
 | 
			
		||||
        _st_liq[m] = TRUE;
 | 
			
		||||
@ -2415,7 +2415,7 @@ void CG4400_application::liq_b0_settato()
 | 
			
		||||
    printer().footerlen(0); 
 | 
			
		||||
    merge_export_file(f,FALSE,TRUE);
 | 
			
		||||
    _intesta_liq = FALSE;
 | 
			
		||||
    fremove(f);
 | 
			
		||||
    remove(f);
 | 
			
		||||
  } 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -2484,7 +2484,7 @@ print_action CG4400_application::postprocess_page (int file, int counter)
 | 
			
		||||
              printer().footerlen(0);
 | 
			
		||||
              merge_export_file(_t,FALSE,TRUE);
 | 
			
		||||
              _intesta_liq = FALSE;
 | 
			
		||||
              fremove(_t);
 | 
			
		||||
              remove(_t);
 | 
			
		||||
            }
 | 
			
		||||
            //_t = NULL;  Come ho potuto scrivere cio?!
 | 
			
		||||
          }   
 | 
			
		||||
@ -2738,7 +2738,7 @@ void CG4400_application::no_movimenti()
 | 
			
		||||
          merge_export_file(f,FALSE,TRUE);
 | 
			
		||||
          printer().formfeed();
 | 
			
		||||
          _intesta_liq = FALSE;
 | 
			
		||||
          fremove(f); 
 | 
			
		||||
          remove(f); 
 | 
			
		||||
        }  
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
@ -2954,7 +2954,7 @@ void CG4400_application::stampa_liq_mesi_succ()
 | 
			
		||||
        printer().footerlen(0);
 | 
			
		||||
        merge_export_file(t,FALSE,TRUE);  
 | 
			
		||||
        _intesta_liq = FALSE;
 | 
			
		||||
        fremove(t);  
 | 
			
		||||
        remove(t);  
 | 
			
		||||
      } 
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user