Prima versione 770 2013
git-svn-id: svn://10.65.10.50/branches/R_10_00@22863 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									11da9586be
								
							
						
					
					
						commit
						f5f80e6152
					
				
							
								
								
									
										198
									
								
								m770/770100.cpp
									
									
									
									
									
								
							
							
						
						
									
										198
									
								
								m770/770100.cpp
									
									
									
									
									
								
							@ -1,7 +1,7 @@
 | 
			
		||||
// 770100.cpp - Scheda percipienti
 | 
			
		||||
#include <tabutil.h>
 | 
			
		||||
#include <mailbox.h>
 | 
			
		||||
#include <defmask.h>
 | 
			
		||||
#include <mailbox.h>
 | 
			
		||||
#include <recarray.h>
 | 
			
		||||
 | 
			
		||||
#include "scperc.h"
 | 
			
		||||
#include "rver.h"
 | 
			
		||||
@ -152,13 +152,14 @@ TMask* TSchedaPercipienti::load_mask(int n)
 | 
			
		||||
////////////////////////////////////////////////////////////////////////
 | 
			
		||||
      TSheet_field& vers = m->sfield(F_VERSAMENTI);  
 | 
			
		||||
      vers.set_notify(vers_notify);
 | 
			
		||||
      vers.sheet_mask().set_handler(F_VERS_1015, vers1015_handler);
 | 
			
		||||
      vers.sheet_mask().set_handler(DLG_SELPAG, pag_select);
 | 
			
		||||
      vers.sheet_mask().set_handler(DLG_AZZERA, ver_azzera);
 | 
			
		||||
      vers.sheet_mask().set_handler(F_TIPOVERS, tipo_hndl);
 | 
			
		||||
      vers.sheet_mask().set_handler(F_LUOVERS,  luo_hndl);
 | 
			
		||||
      vers.sheet_mask().set_handler(F_ABI,  abicab_hndl);
 | 
			
		||||
      vers.sheet_mask().set_handler(F_CAB,  abicab_hndl);
 | 
			
		||||
      TMask& sm = vers.sheet_mask();
 | 
			
		||||
      sm.set_handler(F_VERS_1015, vers1015_handler);
 | 
			
		||||
      sm.set_handler(DLG_SELPAG, pag_select);
 | 
			
		||||
      sm.set_handler(DLG_AZZERA, ver_azzera);
 | 
			
		||||
      sm.set_handler(F_TIPOVERS, tipo_hndl);
 | 
			
		||||
      sm.set_handler(F_LUOVERS,  luo_hndl);
 | 
			
		||||
      sm.set_handler(F_ABI,  abicab_hndl);
 | 
			
		||||
      sm.set_handler(F_CAB,  abicab_hndl);
 | 
			
		||||
    }
 | 
			
		||||
    break;
 | 
			
		||||
  default:
 | 
			
		||||
@ -271,12 +272,12 @@ bool TSchedaPercipienti::codanagr_handler(TMask_field& f, KEY k)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TSchedaPercipienti::calcola_riga_pag(TRectype & rec,
 | 
			
		||||
                                                 const real h_PercAssImp,
 | 
			
		||||
                                                 const real h_PercCassaPrev,
 | 
			
		||||
                                                 const real h_PercRitenuta,
 | 
			
		||||
                                                 const real h_PercInps,
 | 
			
		||||
                                                 const real h_PercAssImpInps,
 | 
			
		||||
                                                 const real h_PercCommitInps)
 | 
			
		||||
                                          const real h_PercAssImp,
 | 
			
		||||
                                          const real h_PercCassaPrev,
 | 
			
		||||
                                          const real h_PercRitenuta,
 | 
			
		||||
                                          const real h_PercInps,
 | 
			
		||||
                                          const real h_PercAssImpInps,
 | 
			
		||||
                                          const real h_PercCommitInps)
 | 
			
		||||
{
 | 
			
		||||
  const int fdec = TCurrency::get_firm_dec();
 | 
			
		||||
	real compenso = rec.get_real(PAG_COMPENSO);
 | 
			
		||||
@ -320,7 +321,7 @@ void TSchedaPercipienti::calcola_riga_pag(TRectype & rec,
 | 
			
		||||
	rec.put(PAG_COMNETTO, comnetto);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
 | 
			
		||||
void TSchedaPercipienti::agg_pagamenti(const TRectype& sch, const TDate& pag_dal)
 | 
			
		||||
{
 | 
			
		||||
	const long numreg = sch.get_long(SCH_NUMREG);
 | 
			
		||||
 | 
			
		||||
@ -344,7 +345,7 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
 | 
			
		||||
			real spperc = spese / totale; spperc.round(8);
 | 
			
		||||
			real ivaperc = iva / totale; ivaperc.round(8);
 | 
			
		||||
 | 
			
		||||
			TString16 codcau(sc.lfile().get("CODCAUS"));
 | 
			
		||||
			const TString4 codcau = sc.lfile().get("CODCAUS");
 | 
			
		||||
			const TRectype cau = cache().get("%CA7", codcau);
 | 
			
		||||
 | 
			
		||||
			// leggo valori tabella causali per calcolo
 | 
			
		||||
@ -355,8 +356,7 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
 | 
			
		||||
			const real h_PercAssImpInps = cau.get_real("R2");
 | 
			
		||||
			const real h_PercCommitInps = cau.get_real("R3");
 | 
			
		||||
		
 | 
			
		||||
			
 | 
			
		||||
			for (TPartita * p = partarr.first(); p != NULL; p =partarr.next())
 | 
			
		||||
			for (TPartita* p = partarr.first(); p != NULL; p =partarr.next())
 | 
			
		||||
			{
 | 
			
		||||
				const int row = p->prima_fattura(numreg);
 | 
			
		||||
 | 
			
		||||
@ -377,17 +377,22 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
 | 
			
		||||
 | 
			
		||||
						for (int rowp = ratapart.last(); rowp > 0; rowp = ratapart.pred(rowp))
 | 
			
		||||
						{
 | 
			
		||||
							const TRectype& pag = ratapart.row(rowp);                         // Riga pagamento
 | 
			
		||||
							const TRiga_partite& sum = p->riga(rowp);              // Riga partite
 | 
			
		||||
							const TRectype& pag = ratapart.row(rowp);              // Riga pagamento
 | 
			
		||||
              
 | 
			
		||||
              const TRiga_partite& sum = p->riga(rowp);              // Riga partite
 | 
			
		||||
              const TDate sum_datapag = pag.get(PART_DATAPAG);
 | 
			
		||||
              if (sum_datapag < pag_dal)
 | 
			
		||||
                continue;			
 | 
			
		||||
 | 
			
		||||
							const char sez = sum.sezione();
 | 
			
		||||
							TImporto imppag(sez, pag.get_real(PAGSCA_IMPORTO));
 | 
			
		||||
							const long num = sum.get_long(PART_NREG);
 | 
			
		||||
							if(lastsch == 0 && numregp[0] == 0L)
 | 
			
		||||
							if (lastsch == 0 && numregp[0] == 0L)
 | 
			
		||||
							{
 | 
			
		||||
								numregp[lastsch] = num;
 | 
			
		||||
								tot[lastsch].reset();
 | 
			
		||||
							}
 | 
			
		||||
							if(num != numregp[lastsch])
 | 
			
		||||
							if (num != numregp[lastsch])
 | 
			
		||||
							{
 | 
			
		||||
								numregp[++lastsch] = num;
 | 
			
		||||
								tot[lastsch].reset();
 | 
			
		||||
@ -405,9 +410,9 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
 | 
			
		||||
							real abb = pag.get_real(PAGSCA_ABBUONI);
 | 
			
		||||
							if (!abb.is_zero())
 | 
			
		||||
								imppag += TImporto(sez, abb);
 | 
			
		||||
							for (int i = 0; !found &&i < rows; i++)
 | 
			
		||||
							for (int i = 0; !found && i < rows; i++)
 | 
			
		||||
							{
 | 
			
		||||
								TRectype & pagrec = sc.pag(i);
 | 
			
		||||
								TRectype& pagrec = sc.pag(i);
 | 
			
		||||
								const long numsch = pagrec.get_long(PAG_NUMREG);
 | 
			
		||||
								found = num == numsch;
 | 
			
		||||
								if (numsch == 0L && !found)
 | 
			
		||||
@ -417,7 +422,7 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
 | 
			
		||||
										data = sum.get_date(PART_DATAREG);
 | 
			
		||||
									if (!data.ok())
 | 
			
		||||
										data = sum.get_date(PART_DATAPAG);
 | 
			
		||||
									const TDate datasch(pagrec.get(PAG_DATAPAG));
 | 
			
		||||
									const TDate datasch = pagrec.get(PAG_DATAPAG);
 | 
			
		||||
									if (data == datasch)
 | 
			
		||||
									{
 | 
			
		||||
										pagrec.put(PAG_NUMREG, num);
 | 
			
		||||
@ -438,7 +443,6 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
 | 
			
		||||
											ivap = iva;
 | 
			
		||||
 | 
			
		||||
										real compensop = imppag.valore() - spesep - ivap;
 | 
			
		||||
 | 
			
		||||
										compensop += compensop * h_PercRitenuta;
 | 
			
		||||
										compensop.round(TCurrency::get_firm_dec());
 | 
			
		||||
										if (abs(compensop) > abs(compenso))
 | 
			
		||||
@ -454,13 +458,13 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
 | 
			
		||||
							if (!found)
 | 
			
		||||
							{
 | 
			
		||||
								tot[lastsch] += imppag;
 | 
			
		||||
							if (!datapag.ok())
 | 
			
		||||
								datapag = sum.get_date(PART_DATADOC);
 | 
			
		||||
							if (!datapag.ok())
 | 
			
		||||
								datapag = sum.get_date(PART_DATAREG);
 | 
			
		||||
							if (!datapag.ok())
 | 
			
		||||
								datapag = sum.get_date(PART_DATAPAG);
 | 
			
		||||
						}
 | 
			
		||||
							  if (!datapag.ok())
 | 
			
		||||
								  datapag = sum.get_date(PART_DATADOC);
 | 
			
		||||
							  if (!datapag.ok())
 | 
			
		||||
								  datapag = sum.get_date(PART_DATAREG);
 | 
			
		||||
							  if (!datapag.ok())
 | 
			
		||||
								  datapag = sum.get_date(PART_DATAPAG);
 | 
			
		||||
						  }
 | 
			
		||||
						}
 | 
			
		||||
						for (int j = 0; j < 10 && numregp[j] > 0L; j++)
 | 
			
		||||
						{
 | 
			
		||||
@ -479,32 +483,32 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype & sch)
 | 
			
		||||
							real spesepag = tot[j].valore() * spperc;
 | 
			
		||||
							real ivapag = tot[j].valore() * ivaperc;
 | 
			
		||||
						
 | 
			
		||||
						spesepag.round(TCurrency::get_firm_dec());
 | 
			
		||||
						if (abs(spesepag) > abs(spese))
 | 
			
		||||
							spesepag = spese;
 | 
			
		||||
						ivapag.round(TCurrency::get_firm_dec());
 | 
			
		||||
						if (abs(ivapag) > abs(iva))
 | 
			
		||||
							ivapag = iva;
 | 
			
		||||
						  spesepag.round(TCurrency::get_firm_dec());
 | 
			
		||||
						  if (abs(spesepag) > abs(spese))
 | 
			
		||||
							  spesepag = spese;
 | 
			
		||||
						  ivapag.round(TCurrency::get_firm_dec());
 | 
			
		||||
						  if (abs(ivapag) > abs(iva))
 | 
			
		||||
							  ivapag = iva;
 | 
			
		||||
 | 
			
		||||
							real compensopag = tot[j].valore() - spesepag - ivapag;
 | 
			
		||||
 | 
			
		||||
						compensopag += compensopag * h_PercRitenuta;
 | 
			
		||||
						compensopag.round(TCurrency::get_firm_dec());
 | 
			
		||||
						if (abs(compensopag) > abs(compenso))
 | 
			
		||||
							compensopag = compenso;
 | 
			
		||||
						pagrec.put(PAG_COMPENSO, compensopag);
 | 
			
		||||
						pagrec.put(PAG_SPESA, spesepag);
 | 
			
		||||
						pagrec.put(PAG_DATAPAG, datapag);
 | 
			
		||||
						  compensopag += compensopag * h_PercRitenuta;
 | 
			
		||||
						  compensopag.round(TCurrency::get_firm_dec());
 | 
			
		||||
						  if (abs(compensopag) > abs(compenso))
 | 
			
		||||
							  compensopag = compenso;
 | 
			
		||||
						  pagrec.put(PAG_COMPENSO, compensopag);
 | 
			
		||||
						  pagrec.put(PAG_SPESA, spesepag);
 | 
			
		||||
						  pagrec.put(PAG_DATAPAG, datapag);
 | 
			
		||||
							sc.lfile().put(SCH_ANNOC, datapag.year());
 | 
			
		||||
							sc.lfile().put(SCH_MESEC, datapag.month());
 | 
			
		||||
						pagrec.put(PAG_PERC, h_PercRitenuta); // percentuale ritenuta acconto
 | 
			
		||||
						pagrec.put(PAG_ALQIMP10, h_PercAssImpInps);// percentuale 10% INPS
 | 
			
		||||
							pagrec.put(PAG_NUMREG, numregp[j]);
 | 
			
		||||
						pagrec.put(PAG_COD10, "C");
 | 
			
		||||
						calcola_riga_pag(pagrec, h_PercAssImp, h_PercCassaPrev, h_PercRitenuta, h_PercInps, h_PercAssImpInps, h_PercCommitInps);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
						  pagrec.put(PAG_PERC, h_PercRitenuta); // percentuale ritenuta acconto
 | 
			
		||||
						  pagrec.put(PAG_ALQIMP10, h_PercAssImpInps);// percentuale 10% INPS
 | 
			
		||||
  					  pagrec.put(PAG_NUMREG, numregp[j]);
 | 
			
		||||
						  pagrec.put(PAG_COD10, "C");
 | 
			
		||||
						  calcola_riga_pag(pagrec, h_PercAssImp, h_PercCassaPrev, h_PercRitenuta, h_PercInps, h_PercAssImpInps, h_PercCommitInps);
 | 
			
		||||
					  }
 | 
			
		||||
				  }
 | 
			
		||||
			  }
 | 
			
		||||
			}
 | 
			
		||||
			sc.rewrite();
 | 
			
		||||
		}
 | 
			
		||||
@ -515,8 +519,16 @@ bool schede(const TRelation& rel, void* pJolly)
 | 
			
		||||
{
 | 
			
		||||
	const TRectype& sch = rel.curr();
 | 
			
		||||
	TSchedaPercipienti* schper = (TSchedaPercipienti *) pJolly;
 | 
			
		||||
	schper->agg_pagamenti(sch);
 | 
			
		||||
	return true;
 | 
			
		||||
 | 
			
		||||
  TMask mp("Aggiorna pagamenti", 1, 20, 4);
 | 
			
		||||
  mp.add_date(101, 0, "Data minimima pagamenti ", 1, 1);
 | 
			
		||||
  const bool ok = mp.run() == K_ENTER;
 | 
			
		||||
  if (ok)
 | 
			
		||||
  {
 | 
			
		||||
    const TDate pag_dal = mp.get(101);
 | 
			
		||||
	  schper->agg_pagamenti(sch, pag_dal);
 | 
			
		||||
  }
 | 
			
		||||
	return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TSchedaPercipienti::aggpag_handler(TMask_field& f, KEY k)
 | 
			
		||||
@ -583,8 +595,8 @@ bool TSchedaPercipienti::user_create()
 | 
			
		||||
  _rpag     = new TLocalisamfile(LF_RPAG);
 | 
			
		||||
 | 
			
		||||
  _pags = new TNikArray_sheet(-1, -1, -4, -4, TR("Selezione Pagamenti"),
 | 
			
		||||
         HR("@1|Data@11|Compenso@16|Ritenuta@16|"),
 | 
			
		||||
         0,NULL_WIN,5);
 | 
			
		||||
                              HR("@1|Data@11|Compenso@16|Ritenuta@16|"),
 | 
			
		||||
                              0, NULL_WIN, 5);
 | 
			
		||||
 | 
			
		||||
  set_search_field(F_CODANAGRPERC);
 | 
			
		||||
 | 
			
		||||
@ -669,16 +681,16 @@ void TSchedaPercipienti::compila_testata(TMask& m)
 | 
			
		||||
 | 
			
		||||
  switch (tipo_coll())
 | 
			
		||||
  {                               
 | 
			
		||||
    case occasionale:
 | 
			
		||||
      m.set(F_COMPENS, _coll._compenso.string()); 
 | 
			
		||||
      m.set(F_TOTDOC,  _coll._compenso.string());   
 | 
			
		||||
      break;
 | 
			
		||||
    case fattura:
 | 
			
		||||
      m.set(F_TOTDOC, _coll._totdoc.string());   
 | 
			
		||||
      m.set(F_TOTRIT, _coll._ritenute.string());
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      break;
 | 
			
		||||
  case occasionale:
 | 
			
		||||
    m.set(F_COMPENS, _coll._compenso.string()); 
 | 
			
		||||
    m.set(F_TOTDOC,  _coll._compenso.string());   
 | 
			
		||||
    break;
 | 
			
		||||
  case fattura:
 | 
			
		||||
    m.set(F_TOTDOC, _coll._totdoc.string());   
 | 
			
		||||
    m.set(F_TOTRIT, _coll._ritenute.string());
 | 
			
		||||
    break;
 | 
			
		||||
  default:
 | 
			
		||||
    break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -708,12 +720,29 @@ void TSchedaPercipienti::init_modify_mode(TMask& m)
 | 
			
		||||
void TSchedaPercipienti::init_insert_mode(TMask& m)
 | 
			
		||||
{
 | 
			
		||||
  init_mask(m);
 | 
			
		||||
 | 
			
		||||
  // La proposta causale è valida con e senza collegamneto da prima nota
 | 
			
		||||
  TToken_string key; key.format("%c|%ld", m.get(F_TIPOA)[0], m.get_long(F_CODANAGR));
 | 
			
		||||
  TString4 codcaus = cache().get(LF_ANAG, key, "CAUSQUA");
 | 
			
		||||
  if (codcaus.blank())
 | 
			
		||||
  {
 | 
			
		||||
    key.format("%ld|%c|%ld|%d", 
 | 
			
		||||
               m.get_long(F_CODDITTA), m.get(F_TIPOA)[0], 
 | 
			
		||||
               m.get_long(F_CODANAGR), m.get_int(F_NPROG)-1);
 | 
			
		||||
    codcaus = cache().get(LF_SCPERC, key, SPR_CODCAUS);
 | 
			
		||||
  }
 | 
			
		||||
  if (codcaus.full())
 | 
			
		||||
  {
 | 
			
		||||
    const TRectype& caus = cache().get("%CA7", codcaus);
 | 
			
		||||
    build_causqua_items(m, caus.get("S1"));  
 | 
			
		||||
    m.set(F_CODCAUS, codcaus, 0x3);
 | 
			
		||||
    m.set(F_CAUSQUA, caus.get("S2"));
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TSchedaPercipienti::on_config_change()
 | 
			
		||||
{
 | 
			
		||||
  TConfig conf(CONFIG_STUDIO, "77");
 | 
			
		||||
  _anno_dic = conf.get_int(ANNO_SEL); 
 | 
			
		||||
  _anno_dic = ini_get_int(CONFIG_STUDIO, "77", ANNO_SEL); 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TSchedaPercipienti::init_query_mode(TMask& m)
 | 
			
		||||
@ -1347,12 +1376,10 @@ TSheet_field& TSchedaPercipienti::pag_sheet_enabled(TMask& m, bool force_enable)
 | 
			
		||||
  if (s == NULL)
 | 
			
		||||
  {
 | 
			
		||||
    // reperisco codice quadro della scheda 
 | 
			
		||||
    TString16 codcau(_rel->lfile().get("CODCAUS"));
 | 
			
		||||
    TTable cau("%ca7");
 | 
			
		||||
    cau.zero();
 | 
			
		||||
    cau.put("CODTAB", codcau);
 | 
			
		||||
    TString16 qua = "C";
 | 
			
		||||
    if (cau.read() == NOERR)
 | 
			
		||||
    TString4 qua = "C";
 | 
			
		||||
    const TString4 codcau = _rel->lfile().get("CODCAUS");
 | 
			
		||||
    const TRectype& cau = cache().get("%CA7", codcau);
 | 
			
		||||
    if (!cau.empty())
 | 
			
		||||
      qua = cau.get("S1");  
 | 
			
		||||
      
 | 
			
		||||
    // abilito sheet  
 | 
			
		||||
@ -1421,12 +1448,12 @@ bool TSchedaPercipienti::activate_pag_sheet(TMask& m)
 | 
			
		||||
  for (int r = 0; r < curr_s.items(); r++)   
 | 
			
		||||
  {         
 | 
			
		||||
    TToken_string& t = curr_s.row(r);
 | 
			
		||||
    if (!my_empty_items(t, FALSE)) 
 | 
			
		||||
    if (!my_empty_items(t, false)) 
 | 
			
		||||
    {
 | 
			
		||||
      from_sheet_to_struct(t, s);
 | 
			
		||||
      calcola_riga_pag(s,
 | 
			
		||||
                       c, 
 | 
			
		||||
                       TRUE,  
 | 
			
		||||
                       true,  
 | 
			
		||||
                       h_PercAssImp,
 | 
			
		||||
                       h_PercCassaPrev,
 | 
			
		||||
                       h_PercRitenuta,
 | 
			
		||||
@ -1644,7 +1671,7 @@ Pag_struct& TSchedaPercipienti::from_sheet_to_struct(TToken_string& t, Pag_struc
 | 
			
		||||
  return s;
 | 
			
		||||
}    
 | 
			
		||||
 | 
			
		||||
void TSchedaPercipienti::from_struct_to_sheet(Pag_struct& s, TToken_string& t)
 | 
			
		||||
void TSchedaPercipienti::from_struct_to_sheet(const Pag_struct& s, TToken_string& t)
 | 
			
		||||
{
 | 
			
		||||
  // reperisco la Token_string pilota
 | 
			
		||||
  TToken_string columns(pilot_sheet());
 | 
			
		||||
@ -2076,6 +2103,7 @@ Pag_struct& TSchedaPercipienti::clear_struct(Pag_struct& s)
 | 
			
		||||
  s.quotaprov = ZERO;   
 | 
			
		||||
  s.impnetto = ZERO;  
 | 
			
		||||
  s.comnetto = ZERO;
 | 
			
		||||
  s.numreg = 0L;
 | 
			
		||||
  
 | 
			
		||||
  return s;
 | 
			
		||||
}    
 | 
			
		||||
@ -2096,13 +2124,13 @@ Pag_struct& TSchedaPercipienti::calcola_riga_pag(Pag_struct& s,
 | 
			
		||||
  clear_struct(c);
 | 
			
		||||
    
 | 
			
		||||
  // calcolo CPA
 | 
			
		||||
  c.impcpa = (s.compenso * h_PercCassaPrev) / (CENTO + h_PercCassaPrev);
 | 
			
		||||
  c.impcpa = s.compenso * h_PercCassaPrev / (CENTO + h_PercCassaPrev);
 | 
			
		||||
  c.impcpa.round(fdec);
 | 
			
		||||
  if (s.impcpa == ZERO || force)
 | 
			
		||||
    s.impcpa = c.impcpa; 
 | 
			
		||||
    
 | 
			
		||||
  // calcolo imponibile
 | 
			
		||||
  c.imponibile = ((s.compenso - s.impcpa) * h_PercAssImp) / CENTO;
 | 
			
		||||
  c.imponibile = (s.compenso - s.impcpa) * h_PercAssImp / CENTO;
 | 
			
		||||
  c.imponibile.round(fdec);
 | 
			
		||||
  if (s.imponibile == ZERO || force)
 | 
			
		||||
    s.imponibile = c.imponibile;                                 
 | 
			
		||||
@ -2112,7 +2140,7 @@ Pag_struct& TSchedaPercipienti::calcola_riga_pag(Pag_struct& s,
 | 
			
		||||
    s.perc = h_PercRitenuta;                                     
 | 
			
		||||
      
 | 
			
		||||
  // calcolo ritenuta lorda
 | 
			
		||||
  c.ritlorda = (s.imponibile * s.perc) / CENTO;
 | 
			
		||||
  c.ritlorda = s.imponibile * s.perc / CENTO;
 | 
			
		||||
  c.ritlorda.round(fdec);
 | 
			
		||||
  s.ritlorda = c.ritlorda; 
 | 
			
		||||
    
 | 
			
		||||
@ -2132,7 +2160,7 @@ Pag_struct& TSchedaPercipienti::calcola_riga_pag(Pag_struct& s,
 | 
			
		||||
    s.alqimp10 = h_PercAssImpInps;
 | 
			
		||||
      
 | 
			
		||||
  // calcolo contributo Inps complessivo
 | 
			
		||||
  c.ctssncomp = (((s.compenso * s.alqimp10) / CENTO) * h_PercInps) / CENTO;
 | 
			
		||||
  c.ctssncomp = ((s.compenso * s.alqimp10 / CENTO) * h_PercInps) / CENTO;
 | 
			
		||||
  c.ctssncomp.round(fdec);
 | 
			
		||||
  if (s.ctssncomp == ZERO || force)
 | 
			
		||||
    s.ctssncomp = c.ctssncomp; 
 | 
			
		||||
@ -2182,8 +2210,6 @@ Pag_struct& TSchedaPercipienti::calcola_riga_pag(Pag_struct& s,
 | 
			
		||||
  // calcolo compenso al netto delle ritenute
 | 
			
		||||
  s.comnetto = s.compenso - s.ritenuta;    
 | 
			
		||||
 | 
			
		||||
	s.numreg = c.numreg;
 | 
			
		||||
  
 | 
			
		||||
  return s;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -43,7 +43,7 @@ void TSchedaPercipienti::init_mask(TMask& m, bool inserimento)
 | 
			
		||||
            // Update spreadsheet
 | 
			
		||||
            rec2row(pags.row(0), rpag, 0);  
 | 
			
		||||
            // ricalcolo riga pagamento
 | 
			
		||||
            TString16 codcau(m.get(F_CODCAUS));
 | 
			
		||||
            const TString& codcau = m.get(F_CODCAUS);
 | 
			
		||||
            TTable cau("%ca7");
 | 
			
		||||
            cau.zero();
 | 
			
		||||
            cau.put("CODTAB", codcau);
 | 
			
		||||
@ -730,16 +730,19 @@ bool TSchedaPercipienti::vers1015_handler(TMask_field& f, KEY k)
 | 
			
		||||
bool TSchedaPercipienti::check_causale(TMask_field& f, KEY k)
 | 
			
		||||
{
 | 
			
		||||
  TMask& m = f.mask();
 | 
			
		||||
  TString16 cod_qua(m.get(F_CODQUA));
 | 
			
		||||
  
 | 
			
		||||
  // creo run-time gli items per la causale quadro  
 | 
			
		||||
  app().build_causqua_items(m, cod_qua);  
 | 
			
		||||
 | 
			
		||||
  if (k == K_TAB)
 | 
			
		||||
  {
 | 
			
		||||
    const TString& cod_qua = m.get(F_CODQUA);
 | 
			
		||||
    // creo run-time gli items per la causale quadro  
 | 
			
		||||
    app().build_causqua_items(m, cod_qua);  
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  if (k == K_TAB && m.is_running())
 | 
			
		||||
  {
 | 
			
		||||
    // leggo causale indicata
 | 
			
		||||
    TFixed_string cod_caus(f.get(),3);
 | 
			
		||||
    //TFixed_string cod_caus(f.get(),3);
 | 
			
		||||
    const TString& cod_qua = m.get(F_CODQUA);
 | 
			
		||||
    
 | 
			
		||||
    // cose da fare solo se viene modificato il codice causale
 | 
			
		||||
    if (f.to_check(k))
 | 
			
		||||
 | 
			
		||||
@ -134,7 +134,7 @@ class TSchedaPercipienti : public TRelation_application
 | 
			
		||||
    // riempe la struttura pagamento da una riga di sheet 
 | 
			
		||||
    Pag_struct& from_sheet_to_struct(TToken_string& t, Pag_struct& s); 
 | 
			
		||||
    // riempe una riga di sheet dalla struttura pagamento
 | 
			
		||||
    void from_struct_to_sheet(Pag_struct& s, TToken_string& t);
 | 
			
		||||
    void from_struct_to_sheet(const Pag_struct& s, TToken_string& t);
 | 
			
		||||
    // riempe la struttura pagamento dalla maschera di sheet
 | 
			
		||||
    Pag_struct& from_mask_to_struct(TMask& m, Pag_struct& s); 
 | 
			
		||||
    // riempe la maschera di sheet dalla struttura pagamento
 | 
			
		||||
@ -207,7 +207,7 @@ class TSchedaPercipienti : public TRelation_application
 | 
			
		||||
    bool        coll_datanum() const { return _coll._datadoc.not_empty() && _coll._numdoc.not_empty(); }
 | 
			
		||||
    long        coll_numreg() const { return _coll._numreg; }
 | 
			
		||||
    bool        esiste_perc(const TMask& m, const char* coda=NULL);
 | 
			
		||||
		void				agg_pagamenti(const TRectype & sch);
 | 
			
		||||
		void				agg_pagamenti(const TRectype& sch, const TDate& pag_dal);
 | 
			
		||||
 | 
			
		||||
    TSheet_field& pags() const;
 | 
			
		||||
    TSheet_field& vers() const;
 | 
			
		||||
 | 
			
		||||
@ -747,20 +747,13 @@ TTracciato770::TTracciato770(char tipo) : _tipo(tipo)
 | 
			
		||||
    add_field("Situazione",                           NU, 674, 1);
 | 
			
		||||
    add_field("Dicastero di appartenenza",            CN, 675, 11);
 | 
			
		||||
 | 
			
		||||
    add_field("Firma del dichiarante",                CB, 746, 1, 54); // 54
 | 
			
		||||
    add_field("Codice fiscale incaricato",            CF, 747,16);
 | 
			
		||||
    add_field("Soggetto",                             NU, 763, 1);
 | 
			
		||||
    add_field("Firma incaricato",                     CB, 764, 1);
 | 
			
		||||
    add_field("Codice fiscale presidente",            CF, 765,16);
 | 
			
		||||
    add_field("Firma presidente",                     CB, 781, 1);     // 59
 | 
			
		||||
 | 
			
		||||
    add_field("Redazione della dichiarazione",        NU, 797, 1, 75); // 75
 | 
			
		||||
    add_field("Numero comunicaz. lavoro dipendente",  NU, 798, 8);
 | 
			
		||||
    add_field("Numero comunicaz. lavoro autonomo",    NU, 806, 8);
 | 
			
		||||
    add_field("Casella prospetto SS",                 CB, 814, 1);     // 78
 | 
			
		||||
    add_field("Casella prospetto ST",                 CB, 815, 1);
 | 
			
		||||
    add_field("Casella prospetto SV",                 CB, 816, 1);     // 80
 | 
			
		||||
    add_field("Casella prospetto SX",                 CB, 817, 1);     
 | 
			
		||||
    add_field("Casella prospetto SV",                 CB, 816, 1);     
 | 
			
		||||
    add_field("Casella prospetto SX",                 CB, 817, 1);     // 81
 | 
			
		||||
    add_field("Casella prospetto SY",                 CB, 818, 1);     
 | 
			
		||||
    add_field("Presenza 770 ordinario 2011",          CB, 819, 1);
 | 
			
		||||
    add_field("Codice fiscale parte restante",        CF, 820,16);
 | 
			
		||||
@ -776,7 +769,24 @@ TTracciato770::TTracciato770(char tipo) : _tipo(tipo)
 | 
			
		||||
    add_field("Numero comunicaz. lavoro dipendente",  NU, 864, 8);     
 | 
			
		||||
    add_field("Numero comunicaz. lavoro autonomo",    NU, 872, 8);      // 93
 | 
			
		||||
 | 
			
		||||
    add_field("Situazioni particolari",               NU,1180,2, 100);  // 100
 | 
			
		||||
    add_field("Firma del dichiarante",                CB, 880, 1, 94);  // 94
 | 
			
		||||
    add_field("Codice fiscale",                       CF, 881,16);
 | 
			
		||||
    add_field("Soggetto",                             NU, 897, 1);
 | 
			
		||||
    add_field("Firma",                                CB, 898, 1);      // 97
 | 
			
		||||
    add_field("Codice fiscale",                       CF, 899,16);
 | 
			
		||||
    add_field("Soggetto",                             NU, 915, 1);
 | 
			
		||||
    add_field("Firma",                                CB, 916, 1);      // 100
 | 
			
		||||
    add_field("Codice fiscale",                       CF, 917,16);
 | 
			
		||||
    add_field("Soggetto",                             NU, 933, 1);
 | 
			
		||||
    add_field("Firma",                                CB, 934, 1);      // 103
 | 
			
		||||
    add_field("Codice fiscale",                       CF, 935,16);
 | 
			
		||||
    add_field("Soggetto",                             NU, 951, 1);
 | 
			
		||||
    add_field("Firma",                                CB, 952, 1);      // 106
 | 
			
		||||
    add_field("Codice fiscale",                       CF, 953,16);
 | 
			
		||||
    add_field("Soggetto",                             NU, 969, 1);
 | 
			
		||||
    add_field("Firma",                                CB, 970, 1);      // 107
 | 
			
		||||
 | 
			
		||||
    add_field("Situazioni particolari",               NU,1180,2, 116);  // 116
 | 
			
		||||
 | 
			
		||||
    add_field("Codice fiscale del rappresentante",    CF,1396,16,126);  // 126
 | 
			
		||||
    add_field("Codice carica del rappresentante",     NU,1412, 2);
 | 
			
		||||
@ -1352,7 +1362,6 @@ bool TTrasferimento770::append_record_b()
 | 
			
		||||
      rec.set(47, rec_anagiu.get(ANG_SITSOC));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    rec.set(54, 1); // Firma del dichiarante
 | 
			
		||||
    rec.set(75, 1); // Reazione della dichiarazione (sezione I)
 | 
			
		||||
    rec.set(76, 0); // Comunicazioni relative a certificazioni lavoro dipendente
 | 
			
		||||
    const int autonomi = conta_certificazioni();
 | 
			
		||||
@ -1364,6 +1373,8 @@ bool TTrasferimento770::append_record_b()
 | 
			
		||||
    rec.set(81, prosp_s);      // casella prospetto SX
 | 
			
		||||
    rec.set(82, false);        // casella prospetto SY
 | 
			
		||||
    
 | 
			
		||||
    rec.set(94, 1);            // Firma del dichiarante
 | 
			
		||||
 | 
			
		||||
    rec.set(100, 0);           // situazioni particolari: vale sempre 0
 | 
			
		||||
 | 
			
		||||
    const TRectype& rec_nditte = _cache770.get(LF_NDITTE, _cod_ditta);
 | 
			
		||||
@ -1412,9 +1423,9 @@ void TTrasferimento770::riepiloga_ss(const TRecord770& rec, TArray& riep_ss) con
 | 
			
		||||
  {   
 | 
			
		||||
    const TString& key = code.right(3);
 | 
			
		||||
    const int num = atoi(key);
 | 
			
		||||
    if (num >= 25 && num <= 30) 
 | 
			
		||||
    if (num >= 26 && num <= 31) 
 | 
			
		||||
    {
 | 
			
		||||
      const int idx = num-25;
 | 
			
		||||
      const int idx = num-26;
 | 
			
		||||
      real* r = (real*)riep_ss.objptr(idx);
 | 
			
		||||
      if (r == NULL)
 | 
			
		||||
      {
 | 
			
		||||
 | 
			
		||||
@ -401,17 +401,17 @@ struct Pag_struct
 | 
			
		||||
	long numreg;
 | 
			
		||||
  
 | 
			
		||||
  // overloading operatore di confronto
 | 
			
		||||
  int operator==(Pag_struct& s);        
 | 
			
		||||
  bool operator==(const Pag_struct& s) const;        
 | 
			
		||||
  
 | 
			
		||||
  // overloading operatore di assegnazione
 | 
			
		||||
  // ritorna per riferimento la struttura
 | 
			
		||||
  // compilata con i valori del record passato
 | 
			
		||||
  Pag_struct& operator=(TRectype & rec);  
 | 
			
		||||
  Pag_struct& operator=(const TRectype & rec);  
 | 
			
		||||
  
 | 
			
		||||
  // overloading operatore di assegnazione
 | 
			
		||||
  // ritorna per riferimento la struttura
 | 
			
		||||
  // incrementata dai valori della struttura passata 
 | 
			
		||||
  Pag_struct& operator+=(Pag_struct& s); 
 | 
			
		||||
  Pag_struct& operator+=(const Pag_struct& s); 
 | 
			
		||||
};  
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -1076,7 +1076,7 @@ bool TVersamento_stampa::find(TVersamento& vers)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// overloading operatore di confronto per la struct dei pagamenti
 | 
			
		||||
int Pag_struct::operator==(Pag_struct& s)
 | 
			
		||||
bool Pag_struct::operator==(const Pag_struct& s) const
 | 
			
		||||
{
 | 
			
		||||
  if (this->datapag != s.datapag)
 | 
			
		||||
    return 0;
 | 
			
		||||
@ -1145,7 +1145,7 @@ int Pag_struct::operator==(Pag_struct& s)
 | 
			
		||||
 | 
			
		||||
// overloading operatore di assegnazione per la struct dei pagamenti 
 | 
			
		||||
// partendo da un TRectype
 | 
			
		||||
Pag_struct& Pag_struct::operator=(TRectype& rec)
 | 
			
		||||
Pag_struct& Pag_struct::operator=(const TRectype& rec)
 | 
			
		||||
{
 | 
			
		||||
  // compila struttura con valori del record
 | 
			
		||||
  this->datapag = rec.get_date("DATAPAG");      
 | 
			
		||||
@ -1177,14 +1177,14 @@ Pag_struct& Pag_struct::operator=(TRectype& rec)
 | 
			
		||||
  this->ammlordo = rec.get_real("AMMLORDO");
 | 
			
		||||
  this->quotaprov = rec.get_real("QUOTAPROV");
 | 
			
		||||
  this->impnetto = rec.get_real("IMPNETTO");
 | 
			
		||||
  this->comnetto = rec.get_real("COMNETTO"); 
 | 
			
		||||
  
 | 
			
		||||
  this->comnetto = rec.get_real(PAG_COMNETTO); 
 | 
			
		||||
  this->numreg = rec.get_long(PAG_NUMREG); 
 | 
			
		||||
  return *this; 
 | 
			
		||||
}                                                                    
 | 
			
		||||
 | 
			
		||||
// overloading operatore di assegnazione per la struct dei pagamenti 
 | 
			
		||||
// aggiunge i valori della struttura passata
 | 
			
		||||
Pag_struct& Pag_struct::operator+=(Pag_struct& s)
 | 
			
		||||
Pag_struct& Pag_struct::operator+=(const Pag_struct& s)
 | 
			
		||||
{
 | 
			
		||||
  // aggiunge agli importi i valori della struttura passata
 | 
			
		||||
  this->imponibile += s.imponibile;
 | 
			
		||||
 | 
			
		||||
@ -219,100 +219,108 @@ BEGIN
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001022" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
VALUTA 23
 | 
			
		||||
NUMERO 23
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "SOMME NON SOGGETTE A RITENUTA"
 | 
			
		||||
  PROMPT 66 9 ""
 | 
			
		||||
  FIELD SOMME
 | 
			
		||||
  KEY "Codice somme non soggette a ritenuta"
 | 
			
		||||
  PROMPT 64 9 ""
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001023" "NP"
 | 
			
		||||
  MESSAGE _NUMEXPR,IF(SOMME>0,1,0)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
VALUTA 24
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "IMPONIBILE = 21-22-23"
 | 
			
		||||
  PROMPT 88 9 ""
 | 
			
		||||
  FIELD IMPONIBILE    
 | 
			
		||||
  KEY "SOMME NON SOGGETTE A RITENUTA"
 | 
			
		||||
  PROMPT 66 9 ""
 | 
			
		||||
  FIELD SOMME
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001024" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
VALUTA 25
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "Ritenute operate a titolo di acconto"
 | 
			
		||||
  PROMPT 109 9 ""
 | 
			
		||||
  FIELD IMPORTO       
 | 
			
		||||
  KEY "IMPONIBILE = 21-22-23"
 | 
			
		||||
  PROMPT 88 9 ""
 | 
			
		||||
  FIELD IMPONIBILE    
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001025" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
VALUTA 26
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "Ritenute operate a titolo di imposta"
 | 
			
		||||
  KEY "Ritenute operate a titolo di acconto"
 | 
			
		||||
  PROMPT 109 9 ""
 | 
			
		||||
  FIELD IMPORTO       
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001026" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
VALUTA 27
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "RITENUTE SOSPESE"
 | 
			
		||||
  KEY "Ritenute operate a titolo di imposta"
 | 
			
		||||
  PROMPT 109 9 ""
 | 
			
		||||
  FIELD RITSOSPESE
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001027" ""
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001027" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
VALUTA 28
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "ADDIZIONALE REGIONALE a titolo di acconto"
 | 
			
		||||
  KEY "RITENUTE SOSPESE"
 | 
			
		||||
  PROMPT 109 9 ""
 | 
			
		||||
  FIELD ADDREG                    
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001028" "NP"
 | 
			
		||||
  FIELD RITSOSPESE
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001028" ""
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
VALUTA 29
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "ADDIZIONALE REGIONALE a titolo di imposta"
 | 
			
		||||
  KEY "ADDIZIONALE REGIONALE a titolo di acconto"
 | 
			
		||||
  PROMPT 109 9 ""
 | 
			
		||||
  FIELD ADDREG                    
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001029" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
VALUTA 30
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "ADDIZIONALE REGIONALE SOSPESA"
 | 
			
		||||
  KEY "ADDIZIONALE REGIONALE a titolo di imposta"
 | 
			
		||||
  PROMPT 109 9 ""
 | 
			
		||||
  FIELD ADDREGSOSP
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001030" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
VALUTA 31
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "IMPONIBILE ANNI PRECEDENTI"
 | 
			
		||||
  KEY "ADDIZIONALE REGIONALE SOSPESA"
 | 
			
		||||
  PROMPT 109 9 ""
 | 
			
		||||
  FIELD IMPANNIPRE
 | 
			
		||||
  FIELD ADDREGSOSP
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001031" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
VALUTA 32
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "RITENUTE ANNI PRECEDENTI"
 | 
			
		||||
  KEY "IMPONIBILE ANNI PRECEDENTI"
 | 
			
		||||
  PROMPT 109 9 ""
 | 
			
		||||
  FIELD RITANNIPRE
 | 
			
		||||
  FIELD IMPANNIPRE
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001032" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
VALUTA 33
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "CONTRIBUTI PREVIDENZIALI A CARICO DEL SOGGETTO EROGANTE"
 | 
			
		||||
  KEY "RITENUTE ANNI PRECEDENTI"
 | 
			
		||||
  PROMPT 109 9 ""
 | 
			
		||||
  FIELD CTINPSEROG
 | 
			
		||||
  FIELD RITANNIPRE
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001033" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
VALUTA 34
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "CONTRIBUTI PREVIDENZIALI A CARICO DEL PERCIPIENTE"
 | 
			
		||||
  KEY "CONTRIBUTI PREVIDENZIALI A CARICO DEL SOGGETTO EROGANTE"
 | 
			
		||||
  PROMPT 109 9 ""
 | 
			
		||||
  FIELD CTINPSPERC
 | 
			
		||||
  FIELD CTINPSEROG
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001034" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
VALUTA 35
 | 
			
		||||
BEGIN
 | 
			
		||||
  KEY "CONTRIBUTI PREVIDENZIALI A CARICO DEL PERCIPIENTE"
 | 
			
		||||
  PROMPT 109 9 ""
 | 
			
		||||
  FIELD CTINPSPERC
 | 
			
		||||
  SPECIAL STRING TRASFER "AU001035" "NP"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user