git-svn-id: svn://10.65.10.50/branches/R_10_00@23192 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									3c7e9a5c69
								
							
						
					
					
						commit
						7f77af2a62
					
				
							
								
								
									
										126
									
								
								m770/770400.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								m770/770400.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,126 @@
 | 
				
			|||||||
 | 
					#include <tabapp.h>
 | 
				
			||||||
 | 
					#include <recset.h>
 | 
				
			||||||
 | 
					#include <msksheet.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nditte.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class TTabelle_770 : public TTable_application
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
					  virtual int read(TMask& m);
 | 
				
			||||||
 | 
					  virtual int write(const TMask& m);
 | 
				
			||||||
 | 
					  virtual int rewrite(const TMask& m);
 | 
				
			||||||
 | 
					  virtual bool remove();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					  bool is_ENT() const { return get_tabname() == "%ENT"; }
 | 
				
			||||||
 | 
					  TSheet_field* sheet_ENT() const;
 | 
				
			||||||
 | 
					  void write_rewrite_ENT() const;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TSheet_field* TTabelle_770::sheet_ENT() const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  if (is_ENT())
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    TMask& m = curr_mask();
 | 
				
			||||||
 | 
					    for (int i = m.fields()-1; i > 0; i--)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      TMask_field& f = m.fld(i);
 | 
				
			||||||
 | 
					      if (f.is_sheet())
 | 
				
			||||||
 | 
					        return (TSheet_field*)&f;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return NULL;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int TTabelle_770::read(TMask& m)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  const int err = TTable_application::read(m);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  TSheet_field* se = sheet_ENT();
 | 
				
			||||||
 | 
					  if (err == NOERR && se != NULL)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    const TString& ent = m.get_key_field(1, true)->get();
 | 
				
			||||||
 | 
					    se->destroy();
 | 
				
			||||||
 | 
					    TLocalisamfile mr(LF_MULTIREL);
 | 
				
			||||||
 | 
					    TISAM_recordset nditte("USE NDITTE");
 | 
				
			||||||
 | 
					    for (bool go = nditte.move_first(); go; go = nditte.move_next())
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      TToken_string& r = se->row(-1);
 | 
				
			||||||
 | 
					      const long n = nditte.get(NDT_CODDITTA).as_int();
 | 
				
			||||||
 | 
					      TString8 cod; cod.format("%05ld", n);
 | 
				
			||||||
 | 
					      r = cod;
 | 
				
			||||||
 | 
					      r.add(nditte.get(NDT_RAGSOC).as_string());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      mr.put("COD", "77ENT");
 | 
				
			||||||
 | 
					      mr.put("FIRST", ent);
 | 
				
			||||||
 | 
					      mr.put("SECOND", cod);
 | 
				
			||||||
 | 
					      if (mr.read() == NOERR)
 | 
				
			||||||
 | 
					        r.add(mr.get("DATA"));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    se->force_update();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return err;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TTabelle_770::write_rewrite_ENT() const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TSheet_field& s = *sheet_ENT();
 | 
				
			||||||
 | 
					  const TString& ent = s.mask().get_key_field(1, true)->get();
 | 
				
			||||||
 | 
					  TLocalisamfile mr(LF_MULTIREL);
 | 
				
			||||||
 | 
					  TString8 cod; 
 | 
				
			||||||
 | 
					  FOR_EACH_SHEET_ROW(s, r, row)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    mr.zero();
 | 
				
			||||||
 | 
					    mr.put("COD",    "77ENT");
 | 
				
			||||||
 | 
					    mr.put("FIRST",  ent);
 | 
				
			||||||
 | 
					    cod.format("%05ld", row->get_long(0));
 | 
				
			||||||
 | 
					    mr.put("SECOND", cod);
 | 
				
			||||||
 | 
					    const TFixed_string data = row->get(2);
 | 
				
			||||||
 | 
					    if (data.full())
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      mr.put("DATA",   data);
 | 
				
			||||||
 | 
					      mr.rewrite_write();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      mr.remove();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int TTabelle_770::write(const TMask& m)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  const int err = TTable_application::write(m);
 | 
				
			||||||
 | 
					  if (err == NOERR && is_ENT())
 | 
				
			||||||
 | 
					    write_rewrite_ENT();
 | 
				
			||||||
 | 
					  return err;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int TTabelle_770::rewrite(const TMask& m)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  const int err = TTable_application::rewrite(m);
 | 
				
			||||||
 | 
					  if (err == NOERR && is_ENT())
 | 
				
			||||||
 | 
					    write_rewrite_ENT();
 | 
				
			||||||
 | 
					  return err;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool TTabelle_770::remove()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  const bool done = TTable_application::remove();
 | 
				
			||||||
 | 
					  if (done && is_ENT())
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    TSheet_field& s = *sheet_ENT();
 | 
				
			||||||
 | 
					    FOR_EACH_SHEET_ROW(s, r, row)
 | 
				
			||||||
 | 
					      row->add(" ", 2);
 | 
				
			||||||
 | 
					    write_rewrite_ENT();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return done;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int TableManager(int argc, char* argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TTabelle_770 a;
 | 
				
			||||||
 | 
					  a.run(argc, argv, TR("Tabella 770"));
 | 
				
			||||||
 | 
					  return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										220
									
								
								m770/771230.cpp
									
									
									
									
									
								
							
							
						
						
									
										220
									
								
								m770/771230.cpp
									
									
									
									
									
								
							@ -34,7 +34,7 @@ TRectype& operator += (TRectype& dst, const TRectype& src)
 | 
				
			|||||||
  for (int i = dst.items()-1; i >= 0; i--)
 | 
					  for (int i = dst.items()-1; i >= 0; i--)
 | 
				
			||||||
  {              
 | 
					  {              
 | 
				
			||||||
    const char* name = dst.fieldname(i);
 | 
					    const char* name = dst.fieldname(i);
 | 
				
			||||||
    if (dst.type(name) == _realfld && dst.length(name) >= 9)
 | 
					    if (dst.type(name) == _realfld && dst.length(name) >= 9) // somma importi
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      real num = dst.get_real(name);
 | 
					      real num = dst.get_real(name);
 | 
				
			||||||
      num += src.get_real(name);
 | 
					      num += src.get_real(name);
 | 
				
			||||||
@ -44,97 +44,157 @@ TRectype& operator += (TRectype& dst, const TRectype& src)
 | 
				
			|||||||
  return dst;
 | 
					  return dst;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TRighe_pagamento : public TAssoc_array
 | 
					class TRighe_riepilogo : public TArray
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TString4 _quadro; // Codice quadro
 | 
					  TString4 _quadro; // Codice quadro
 | 
				
			||||||
  TArray _prosp_e1; // Righe prospetto e1
 | 
					  TArray _prosp_e1; // Righe prospetto e1
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
					  void genera_aliquota(TRectype& quadro, const char* aliquota, 
 | 
				
			||||||
 | 
					                       const char* imponibile, const char* imposta) const;
 | 
				
			||||||
 | 
					  void genera_la(TRectype& quadro, const TRectype& riga, const TString& codcaus) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  void add_riga(const TRectype& scheda, const TRectype& riga);
 | 
					  bool add_riga_pag(const TRectype& riga, const TRectype& scheda);
 | 
				
			||||||
  const TRectype* prospetto_e1(char caus);
 | 
					  const TRectype* prospetto_e1(char caus);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  TRighe_pagamento(const char* quadro);
 | 
					  TRighe_riepilogo(const char* quadro);
 | 
				
			||||||
  virtual ~TRighe_pagamento() { }
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TRighe_pagamento::TRighe_pagamento(const char* quadro)
 | 
					TRighe_riepilogo::TRighe_riepilogo(const char* quadro)
 | 
				
			||||||
                : _quadro(quadro)
 | 
					                : _quadro(quadro)
 | 
				
			||||||
{ }
 | 
					{ }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TRectype* TRighe_pagamento::prospetto_e1(char caus)
 | 
					const TRectype* TRighe_riepilogo::prospetto_e1(char caus)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const int index = caus - 'C';
 | 
					  const int index = caus - 'C';
 | 
				
			||||||
  return (const TRectype*)_prosp_e1.objptr(index);
 | 
					  return (const TRectype*)_prosp_e1.objptr(index);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TRighe_pagamento::add_riga(const TRectype& scheda, const TRectype& riga)
 | 
					void TRighe_riepilogo::genera_aliquota(TRectype& quadro, const char* aliquota, 
 | 
				
			||||||
 | 
					                                       const char* imponibile, const char* imposta) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TString16 chiave;
 | 
					  real aliq = quadro.get_real(aliquota);
 | 
				
			||||||
 | 
					  if (aliq.is_zero())
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    const real impon = quadro.get(imponibile);
 | 
				
			||||||
 | 
					    if (!impon.is_zero())
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      const real impos = quadro.get(imposta);
 | 
				
			||||||
 | 
					      aliq = impos * CENTO / impon;
 | 
				
			||||||
 | 
					      if (aliq % UNO == ZERO)  
 | 
				
			||||||
 | 
					        quadro.put(aliquota, aliq);
 | 
				
			||||||
 | 
					    }  
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TRighe_riepilogo::genera_la(TRectype& quadro, const TRectype& riga, const TString& codcaus) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					#ifdef DBG
 | 
				
			||||||
 | 
					  if (riga.get_long(SPR_CODANAGR) == 3072)
 | 
				
			||||||
 | 
					    int minimo = 1;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const TDate datapag = riga.get(PAG_DATAPAG);
 | 
				
			||||||
 | 
					  const real compenso = riga.get_real(PAG_COMPENSO);
 | 
				
			||||||
 | 
					  const real imponibile = riga.get(PAG_IMPONIBILE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  quadro.put("ANNO", datapag.year());
 | 
				
			||||||
 | 
					  quadro.put(QUD_PERC, riga.get(PAG_PERC));
 | 
				
			||||||
 | 
					  quadro.put(QUD_CODCAUS, codcaus);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  real ammlordo = imponibile;           
 | 
				
			||||||
 | 
					  ammlordo += riga.get_real(PAG_SOMNSRIT);
 | 
				
			||||||
 | 
					  ammlordo += riga.get_real(PAG_CONTROBB);
 | 
				
			||||||
 | 
					  ammlordo += riga.get_real(PAG_SOMREGCONV);
 | 
				
			||||||
 | 
					  quadro.put(QUD_TOTALE, ammlordo);                      
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  real somme = compenso;
 | 
				
			||||||
 | 
					  somme -= imponibile;
 | 
				
			||||||
 | 
					  somme += riga.get_real(PAG_SPESA);
 | 
				
			||||||
 | 
					  somme -= riga.get_real(PAG_IMPCPA);
 | 
				
			||||||
 | 
					  somme -= riga.get_real(PAG_SOMREGCONV);
 | 
				
			||||||
 | 
					  quadro.put(QUD_SOMME, somme);  // altre somme non soggette                           
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  quadro.put(QUD_SOMREGCONV, riga.get(PAG_SOMREGCONV));  
 | 
				
			||||||
 | 
					  quadro.put(QUD_IMPONIBILE, imponibile);                // AUXXX008
 | 
				
			||||||
 | 
					  quadro.put(QUD_IMPORTO, riga.get(PAG_RITENUTA));        
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const real inps_tot = riga.get(PAG_INPSCOMP);
 | 
				
			||||||
 | 
					  if (inps_tot > ZERO /*&& riga.get_real(PAG_IMPONIBILE) > 5000.0*/)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    const real inps_perc = riga.get_real(PAG_INPSPERC);
 | 
				
			||||||
 | 
					    const real inps_erog = inps_tot - inps_perc;
 | 
				
			||||||
 | 
					    quadro.put(QUD_CTINPSEROG, inps_erog);                 // AUXXX020
 | 
				
			||||||
 | 
					    quadro.put(QUD_CTINPSPERC, inps_perc);                 // AUXXX021
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const TRectype& perc = cache().get_rec(LF_PERC, riga.get(SPR_CODDITTA), riga.get(SPR_TIPOA), riga.get(SPR_CODANAGR));
 | 
				
			||||||
 | 
					  quadro.put("ENTEPREV", perc.get("ENTEPREV"));    // AUXXX029 / 32
 | 
				
			||||||
 | 
					  quadro.put("CATEGORIA", perc.get("CATEGORIA"));  // AUXXX033
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (somme.is_zero() && quadro.get(QUD_TOTALE) == quadro.get(QUD_IMPONIBILE))
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    const TRectype& ca7 = cache().get("%CA7", codcaus);
 | 
				
			||||||
 | 
					    if (ca7.get_int("I1") == 3)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      quadro.put(QUD_SOMME, quadro.get(QUD_IMPONIBILE));
 | 
				
			||||||
 | 
					      quadro.zero(QUD_IMPONIBILE);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool TRighe_riepilogo::add_riga_pag(const TRectype& riga, const TRectype& scheda)
 | 
				
			||||||
 | 
					{ 
 | 
				
			||||||
  const TString4 codcaus = scheda.get(SPR_CODCAUS);
 | 
					  const TString4 codcaus = scheda.get(SPR_CODCAUS);
 | 
				
			||||||
  const char causqua = toupper(scheda.get_char(SPR_CAUSQUA));
 | 
					  const char causqua = toupper(scheda.get_char(SPR_CAUSQUA));
 | 
				
			||||||
  chiave.format("%-2s%c", (const char*)codcaus, causqua);
 | 
					
 | 
				
			||||||
  if (_quadro == "C")
 | 
					  // cerca riga compatibile
 | 
				
			||||||
    chiave << scheda.get(SPR_FLAGTS); else
 | 
					  int i = 0;
 | 
				
			||||||
  if (_quadro == "E1")
 | 
					  for (i = last(); i >= 0; i--)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    // Le righe del prospetto vengono trattate a parte
 | 
					    const TRectype* rr = (const TRectype*)objptr(i);
 | 
				
			||||||
    if (causqua >= 'C')
 | 
					    if (rr->get_char("CAUSALE") == causqua)
 | 
				
			||||||
    {                    
 | 
					      break;
 | 
				
			||||||
      const int index = causqua - 'C';
 | 
					 | 
				
			||||||
      TRectype* rec = (TRectype*)_prosp_e1.objptr(index);
 | 
					 | 
				
			||||||
      if (rec)
 | 
					 | 
				
			||||||
        *rec += riga;
 | 
					 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
        _prosp_e1.add(riga, index);
 | 
					 | 
				
			||||||
      return;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
    chiave << riga.get("PERC");
 | 
					  if (i < 0)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    TRectype* rec = NULL;
 | 
				
			||||||
 | 
					    if (_quadro == "LA")
 | 
				
			||||||
 | 
					      rec = new TRectype(LF_QUALA);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (rec == NULL)
 | 
				
			||||||
 | 
					      return false;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					    rec->put(PAG_CODDITTA, riga.get(PAG_CODDITTA)); 
 | 
				
			||||||
 | 
					    rec->put(PAG_TIPOA, riga.get(PAG_TIPOA));
 | 
				
			||||||
 | 
					    rec->put(PAG_CODANAGR, riga.get(PAG_CODANAGR));
 | 
				
			||||||
 | 
					    rec->put("NPROG", i+1);
 | 
				
			||||||
 | 
					    rec->put("CODCAUS", codcaus);
 | 
				
			||||||
 | 
					    rec->put("CAUSALE", causqua);
 | 
				
			||||||
 | 
					    rec->put("ANNO", riga.get_date(PAG_DATAPAG).year());
 | 
				
			||||||
 | 
					    rec->put("GENERATA", true);
 | 
				
			||||||
 | 
					    i = add(rec);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TRectype* rec = (TRectype*)objptr(chiave);
 | 
					  TRectype& riep = *(TRectype*)objptr(i);
 | 
				
			||||||
  if (rec)
 | 
					  switch (riep.num())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    *rec += riga;
 | 
					  case LF_QUALA:
 | 
				
			||||||
    if (_quadro == "C") // Nel caso di quadro C somma anche i giorni detr dip.
 | 
					 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      const real gglav = riga.get(PAG_GIOLAVDIP);
 | 
					      TRectype curr(riep.num());
 | 
				
			||||||
      rec->add(PAG_GIOLAVDIP, gglav);
 | 
					      genera_la(curr, riga, codcaus);
 | 
				
			||||||
 | 
					      riep += curr;
 | 
				
			||||||
 | 
					      genera_aliquota(riep, QUD_PERC, QUD_IMPONIBILE, QUD_IMPORTO);
 | 
				
			||||||
 | 
					      if (riep.get("CODCAUS") != codcaus) 
 | 
				
			||||||
 | 
					        riep.zero("CODCAUS");  // Azzero codice se fondo diverse causali 770 nella stesa causale quadro
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    rec = new TRectype(riga);
 | 
					 | 
				
			||||||
    add(chiave, rec);
 | 
					 | 
				
			||||||
  }  
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
  if (_quadro == "DB")  
 | 
					 | 
				
			||||||
  { 
 | 
					 | 
				
			||||||
    // Calcola il flag per il contributo del 10%
 | 
					 | 
				
			||||||
    // Esso deve essere A se tutte le righe sono A, 
 | 
					 | 
				
			||||||
    // C se tutte sono C, B in tutti gli altri casi  
 | 
					 | 
				
			||||||
    char cod10 = toupper(riga.get_char(PAG_COD10));   // Valore scheda attuale
 | 
					 | 
				
			||||||
    if (cod10 < 'A' || cod10 > 'C')                   // Mette a posto archivi incompleti
 | 
					 | 
				
			||||||
      cod10 = 'B';                                  
 | 
					 | 
				
			||||||
    char lcq = rec->get_char(PAG_COD10);              // Valore ultima scheda
 | 
					 | 
				
			||||||
    switch (lcq)  
 | 
					 | 
				
			||||||
    {       
 | 
					 | 
				
			||||||
    case 'A':
 | 
					 | 
				
			||||||
      if (cod10 != 'A')
 | 
					 | 
				
			||||||
        lcq = 'B';
 | 
					 | 
				
			||||||
      break;
 | 
					 | 
				
			||||||
    case 'B':
 | 
					 | 
				
			||||||
      break;
 | 
					 | 
				
			||||||
    case 'C':
 | 
					 | 
				
			||||||
      if (cod10 != 'C')
 | 
					 | 
				
			||||||
        lcq = 'B';
 | 
					 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
  default:
 | 
					  default:
 | 
				
			||||||
      lcq = cod10;
 | 
					 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
    rec->put(PAG_COD10, lcq);                       // Aggiorna valore
 | 
					
 | 
				
			||||||
  }
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////
 | 
				
			||||||
@ -194,7 +254,7 @@ protected:
 | 
				
			|||||||
  void genera_e(TRectype& quadro, const TRectype& riga) const;
 | 
					  void genera_e(TRectype& quadro, const TRectype& riga) const;
 | 
				
			||||||
  void genera_e1(TRectype& quadro, const TRectype& riga) const;
 | 
					  void genera_e1(TRectype& quadro, const TRectype& riga) const;
 | 
				
			||||||
  void genera_la(TRectype& quadro, const TRectype& riga,const TString& codcaus) const;
 | 
					  void genera_la(TRectype& quadro, const TRectype& riga,const TString& codcaus) const;
 | 
				
			||||||
  void genera_righe(TRighe_pagamento& righe) const;
 | 
					  void salva_righe(const TRighe_riepilogo& righe) const;
 | 
				
			||||||
  void distruzione() const;
 | 
					  void distruzione() const;
 | 
				
			||||||
  void generazione();
 | 
					  void generazione();
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
@ -706,7 +766,6 @@ void TQuadroC_E2::genera_e(TRectype& quadro, const TRectype& riga) const
 | 
				
			|||||||
  nonsog -= riga.get_real(PAG_IMPONIBILE);
 | 
					  nonsog -= riga.get_real(PAG_IMPONIBILE);
 | 
				
			||||||
  nonsog += riga.get_real(PAG_SPESA);
 | 
					  nonsog += riga.get_real(PAG_SPESA);
 | 
				
			||||||
  quadro.put(QUE_SOMME, nonsog);                                  // 16
 | 
					  quadro.put(QUE_SOMME, nonsog);                                  // 16
 | 
				
			||||||
 | 
					 | 
				
			||||||
  genera_aliquota(quadro, QUE_PERC, QUE_IMPONIBILE, QUE_IMPORTO); // 13
 | 
					  genera_aliquota(quadro, QUE_PERC, QUE_IMPONIBILE, QUE_IMPORTO); // 13
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -787,9 +846,11 @@ void TQuadroC_E2::genera_la(TRectype& quadro, const TRectype& riga, const TStrin
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TQuadroC_E2::genera_righe(TRighe_pagamento& righe) const
 | 
					void TQuadroC_E2::salva_righe(const TRighe_riepilogo& righe) const
 | 
				
			||||||
{                                       
 | 
					{                                       
 | 
				
			||||||
  TFast_isamfile file(_file);
 | 
					  TFast_isamfile file(_file);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /*
 | 
				
			||||||
  TRectype& curr = file.curr();
 | 
					  TRectype& curr = file.curr();
 | 
				
			||||||
  int nriga = 1;
 | 
					  int nriga = 1;
 | 
				
			||||||
  righe.restart();
 | 
					  righe.restart();
 | 
				
			||||||
@ -803,13 +864,13 @@ void TQuadroC_E2::genera_righe(TRighe_pagamento& righe) const
 | 
				
			|||||||
    curr.put(PAG_TIPOA, riga.get(PAG_TIPOA));
 | 
					    curr.put(PAG_TIPOA, riga.get(PAG_TIPOA));
 | 
				
			||||||
    curr.put(PAG_CODANAGR, riga.get(PAG_CODANAGR));
 | 
					    curr.put(PAG_CODANAGR, riga.get(PAG_CODANAGR));
 | 
				
			||||||
    curr.put("NPROG", nriga);
 | 
					    curr.put("NPROG", nriga);
 | 
				
			||||||
    curr.put("CAUSALE", chiave[2]);
 | 
					    curr.put("CAUSALE", chiave[0]);
 | 
				
			||||||
    curr.put("GENERATA", true);
 | 
					    curr.put("GENERATA", true);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    switch (_quadro[0]) 
 | 
					    switch (_quadro[0]) 
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    case 'C':
 | 
					    case 'C':
 | 
				
			||||||
      curr.put("TASSAZIONE", chiave[3]);
 | 
					      curr.put("TASSAZIONE", chiave[1]);
 | 
				
			||||||
      genera_c(curr, riga);
 | 
					      genera_c(curr, riga);
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case 'D':
 | 
					    case 'D':
 | 
				
			||||||
@ -831,7 +892,7 @@ void TQuadroC_E2::genera_righe(TRighe_pagamento& righe) const
 | 
				
			|||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case 'L':  
 | 
					    case 'L':  
 | 
				
			||||||
      if (_quadro[1] == 'A')
 | 
					      if (_quadro[1] == 'A')
 | 
				
			||||||
        genera_la(curr, riga, chiave.left(2));
 | 
					        genera_la(curr, riga);
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
      CHECK(FALSE, "Quadro non generabile dalle schede");  
 | 
					      CHECK(FALSE, "Quadro non generabile dalle schede");  
 | 
				
			||||||
@ -896,6 +957,25 @@ void TQuadroC_E2::genera_righe(TRighe_pagamento& righe) const
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    read_prospetto_e1();
 | 
					    read_prospetto_e1();
 | 
				
			||||||
  } 
 | 
					  } 
 | 
				
			||||||
 | 
					  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 int nriga = 1;
 | 
				
			||||||
 | 
					 for (int i = 0; i < righe.items(); i++)
 | 
				
			||||||
 | 
					 {
 | 
				
			||||||
 | 
					   const TRectype& rec = *(const TRectype*)righe.objptr(i);
 | 
				
			||||||
 | 
					   file.curr() = rec;
 | 
				
			||||||
 | 
					   int err = _isreinsert;
 | 
				
			||||||
 | 
					   while (err == _isreinsert)
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
 | 
					     file.put("NPROG", nriga++);
 | 
				
			||||||
 | 
					     err = file.write();
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					   if (err != NOERR)
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
 | 
					     error_box("Errore %d durante la scrittura", err);
 | 
				
			||||||
 | 
					     break;
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TQuadroC_E2::generazione()
 | 
					void TQuadroC_E2::generazione()
 | 
				
			||||||
@ -926,7 +1006,7 @@ void TQuadroC_E2::generazione()
 | 
				
			|||||||
  char last_type = ' ';
 | 
					  char last_type = ' ';
 | 
				
			||||||
  long last_code = 0L;
 | 
					  long last_code = 0L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TRighe_pagamento righe(_quadro);
 | 
					  TRighe_riepilogo righe(_quadro);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (cur = 0; cur.pos() < items; ++cur)
 | 
					  for (cur = 0; cur.pos() < items; ++cur)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@ -939,7 +1019,7 @@ void TQuadroC_E2::generazione()
 | 
				
			|||||||
    {           
 | 
					    {           
 | 
				
			||||||
      if (righe.items() > 0)
 | 
					      if (righe.items() > 0)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        genera_righe(righe);
 | 
					        salva_righe(righe);
 | 
				
			||||||
        righe.destroy();
 | 
					        righe.destroy();
 | 
				
			||||||
      }  
 | 
					      }  
 | 
				
			||||||
      last_type = tipoa;
 | 
					      last_type = tipoa;
 | 
				
			||||||
@ -950,12 +1030,12 @@ void TQuadroC_E2::generazione()
 | 
				
			|||||||
    {          
 | 
					    {          
 | 
				
			||||||
      const TDate datapag = riga.get(PAG_DATAPAG);
 | 
					      const TDate datapag = riga.get(PAG_DATAPAG);
 | 
				
			||||||
      if (datapag.year() == anno770)
 | 
					      if (datapag.year() == anno770)
 | 
				
			||||||
        righe.add_riga(scheda, riga);
 | 
					        righe.add_riga_pag(riga, scheda);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }  
 | 
					  }  
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  if (righe.items() > 0)
 | 
					  if (righe.items() > 0)
 | 
				
			||||||
    genera_righe(righe);
 | 
					    salva_righe(righe);
 | 
				
			||||||
  _registra = true;
 | 
					  _registra = true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -752,11 +752,6 @@ bool TTrasferimentoCU::append_record_h(const TRectype& qla, int modulo, TLog_rep
 | 
				
			|||||||
      const TString& azienda = cache().get(LF_MULTIREL, cod_az, "DATA");
 | 
					      const TString& azienda = cache().get(LF_MULTIREL, cod_az, "DATA");
 | 
				
			||||||
      rec.np_put("AU001032", azienda); // codice azienda presso ente previdenziale
 | 
					      rec.np_put("AU001032", azienda); // codice azienda presso ente previdenziale
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      TString msg; msg.format(FR("Percipiente privo di dati previdenziali %c/%ld %s"), tipoanag, codanagr, (const char*)perc.codice_fiscale());
 | 
					 | 
				
			||||||
      log.log(1, msg);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rec.np_put("AU001033", cat);
 | 
					    rec.np_put("AU001033", cat);
 | 
				
			||||||
    rec.np_put("AU001034", cce); // contributi a carico erogante
 | 
					    rec.np_put("AU001034", cce); // contributi a carico erogante
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user