Merge remote-tracking branch 'origin/R_10_00' into R_10_00
This commit is contained in:
		
						commit
						f2a6e9d21f
					
				@ -1373,19 +1373,21 @@ bool TDoc_fp::export_info_articolo(TFPRiga_documento* rdoc, TPaf_record& paf1900
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// Controllo se ha il CONAI in tal caso aggiungo i dati
 | 
			
		||||
	FOR_EACH_CONFIGURED_CONAI_CLASS(cc)
 | 
			
		||||
	for (int i = 0; i < FR_CMAX; i++)
 | 
			
		||||
	{
 | 
			
		||||
		const TString conai_fld(conai_peso_name(cc, LF_RIGHEDOC));
 | 
			
		||||
		if (rdoc->get(conai_fld).full())
 | 
			
		||||
		if (rdoc->get(conai_peso_name(i)).full())
 | 
			
		||||
		{
 | 
			
		||||
			reset(paf2100f);
 | 
			
		||||
			paf2100f.set("PK_KEYNLINEA", static_cast<long>(riga_doc));
 | 
			
		||||
			paf2100f.set("PK_KEYNLINAR", _idx_adg_doc_row++);
 | 
			
		||||
			static TString msg_conai;
 | 
			
		||||
			msg_conai.cut(0) << "Contributo CONAI " << conai_material(cc) << " (KG)";
 | 
			
		||||
			
 | 
			
		||||
			TString scat = rdoc->get(conai_sottocat_name(i));
 | 
			
		||||
			TString msg_conai;
 | 
			
		||||
			
 | 
			
		||||
			msg_conai << "Contributo CONAI " << conai_material(conai_str2class(scat)) << " (KG)";
 | 
			
		||||
			paf2100f.set("PK_TIPODATO", "CONAI");
 | 
			
		||||
			paf2100f.set("PK_RIFDATO", msg_conai);
 | 
			
		||||
			paf2100f.set("PK_RIFNUMERO", rdoc->get_real(conai_fld).string());
 | 
			
		||||
			paf2100f.set("PK_RIFNUMERO", rdoc->get_real(conai_peso_name(i)).string());
 | 
			
		||||
			ok &= insert(paf2100f);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -340,21 +340,15 @@ class TArticolo_conai : TObject
 | 
			
		||||
{
 | 
			
		||||
private:
 | 
			
		||||
	const TString _codart;
 | 
			
		||||
	// Categoria -> Sottocategoria + peso
 | 
			
		||||
	std::map<TString, std::map<TString, real>> _catsotpes;
 | 
			
		||||
	TArray 	_sc;
 | 
			
		||||
	TArray	_peso;// Categoria -> Sottocategoria + peso
 | 
			
		||||
public:
 | 
			
		||||
	const std::map<TString, std::map<TString, real>>& get_map() { return _catsotpes; }
 | 
			
		||||
	const std::map<TString, real>* get_scat(const TString& cat);
 | 
			
		||||
	real get_peso(const TString& cat, const TString& scat);
 | 
			
		||||
	real get_peso(const TString& fcat) { return get_peso(fcat.left(2), fcat.right(2)); }
 | 
			
		||||
	const TString & get_scat(int i) {return _sc.objptr(i) != NULL ? (const TString &)_sc[i] : EMPTY_STRING;}
 | 
			
		||||
	const real get_peso(int i) {return _peso.objptr(i) != NULL ? (const real &)_peso[i] : ZERO;}
 | 
			
		||||
 | 
			
		||||
	TArticolo_conai(const TString& codart);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define FOR_EACH_CONAI_CAT(_art_con, _cat) const auto& _map_conai =  ac.get_map(); \
 | 
			
		||||
	for(const auto& _cat : _map_conai)
 | 
			
		||||
#define FOR_EACH_CONAI_SOTTOCAT(_art_con, _cat, _sottocat) FOR_EACH_CONAI_CAT(_art_con, _cat) for(const auto& _sottocat : (_cat).second)
 | 
			
		||||
 | 
			
		||||
// *******************************
 | 
			
		||||
// LIBRERIA DI utility del magazzino
 | 
			
		||||
// *******************************
 | 
			
		||||
 | 
			
		||||
@ -1882,10 +1882,12 @@ TArticolo_conai::TArticolo_conai(const TString& codart)
 | 
			
		||||
		int err = conart.read(_isgteq);
 | 
			
		||||
		while (err == NOERR && _codart == conart.get(CONART_CODART))
 | 
			
		||||
		{
 | 
			
		||||
			const TString& categoria = conart.get(CONART_CATEGORIA);
 | 
			
		||||
			const TString& sottocat = conart.get(CONART_SOTTOCAT);
 | 
			
		||||
			const int i = conart.get_int(CONART_NRIGA) - 1;
 | 
			
		||||
			TString categoria = conart.get(CONART_CATEGORIA);
 | 
			
		||||
			categoria << conart.get(CONART_SOTTOCAT);
 | 
			
		||||
			_sc.add(categoria, i);
 | 
			
		||||
			const real& peso = conart.get_real(CONART_PESO);
 | 
			
		||||
			_catsotpes[categoria][sottocat] = peso;
 | 
			
		||||
			_peso.add(peso, i);
 | 
			
		||||
			err = conart.next();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@ -1894,49 +1896,28 @@ TArticolo_conai::TArticolo_conai(const TString& codart)
 | 
			
		||||
	 * La risposta è semplice, tutti i programmi che non verranno aggiornati da queste modifiche (es. Importazione Pack/SKNT)
 | 
			
		||||
	 * scrivono li e quindi va tenuta la compatibilità
 | 
			
		||||
	 */
 | 
			
		||||
	if (_sc.empty())
 | 
			
		||||
	{
 | 
			
		||||
		TLocalisamfile anamag(LF_ANAMAG);
 | 
			
		||||
		TRectype ranamag(LF_ANAMAG);
 | 
			
		||||
		TRectype	& ranamag = anamag.curr();
 | 
			
		||||
			
 | 
			
		||||
		ranamag.put(ANAMAG_CODART, _codart);
 | 
			
		||||
		if (ranamag.read(anamag) == NOERR) // Non dovrebbe mai fallire
 | 
			
		||||
		{
 | 
			
		||||
			const TString& conaisc = ranamag.get(ANAMAG_CONAISC);
 | 
			
		||||
			int startcon = -1;
 | 
			
		||||
			// Mi serve sapere dove iniziano i campi del conai
 | 
			
		||||
			const RecFieldDes* fs = ranamag.rec_des().Fd;
 | 
			
		||||
			for (int i = 0; i < ranamag.rec_des().NFields && startcon == -1; i++)
 | 
			
		||||
				startcon = strcmp(fs[i].Name, ANAMAG_CONACC) == 0 ? i : -1;
 | 
			
		||||
 | 
			
		||||
			if (startcon > -1)
 | 
			
		||||
			{
 | 
			
		||||
				for (int i = 0; i < conaisc.len() / 4; i++)
 | 
			
		||||
			for (int i = 0; i < 6; i++)
 | 
			
		||||
			{
 | 
			
		||||
				const TString& con = conaisc.mid(i * 4, 4);
 | 
			
		||||
				const TString& categoria = con.left(2);
 | 
			
		||||
				const TString& sottocat = con.right(2);
 | 
			
		||||
				if (con.blank()) continue;
 | 
			
		||||
 | 
			
		||||
					_catsotpes[categoria][sottocat] = ranamag.get_real(fs[startcon + i].Name);
 | 
			
		||||
				_sc.add(con);
 | 
			
		||||
				_peso.add(ranamag.get_real(conai2anamagfld(categoria)));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const std::map<TString, real>* TArticolo_conai::get_scat(const TString& cat)
 | 
			
		||||
{
 | 
			
		||||
	if (_catsotpes.find(cat) != _catsotpes.end())
 | 
			
		||||
		return &_catsotpes[cat];
 | 
			
		||||
	else
 | 
			
		||||
		return nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
real TArticolo_conai::get_peso(const TString& cat, const TString& scat)
 | 
			
		||||
{
 | 
			
		||||
	real peso = -UNO;
 | 
			
		||||
	if (_catsotpes.find(cat) != _catsotpes.end() && _catsotpes[cat].find(scat) != _catsotpes[cat].end())
 | 
			
		||||
		peso = _catsotpes[cat][scat];
 | 
			
		||||
	return peso;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// causali 
 | 
			
		||||
 | 
			
		||||
@ -6,4 +6,4 @@ CATEGORIA|1|2|0|Codice categoia CONAI
 | 
			
		||||
SOTTOCAT|1|2|0|Codice sottocategoria CONAI
 | 
			
		||||
PESO|4|15|5|Peso CONAI (Kg)
 | 
			
		||||
1
 | 
			
		||||
CODART+NRIGA+CATEGORIA+SOTTOCAT| 
 | 
			
		||||
CODART+NRIGA| 
 | 
			
		||||
 | 
			
		||||
@ -361,24 +361,26 @@ bool TMotore_application::last_doc(char provv, int anno, const char* codnum,
 | 
			
		||||
  return found;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char* TMotore_application::get_next_key( )
 | 
			
		||||
bool TMotore_application::get_next_key(TToken_string& key)
 | 
			
		||||
{
 | 
			
		||||
  const TMask& m = curr_mask( );
 | 
			
		||||
	const TMask& m = curr_mask();
 | 
			
		||||
	const TCodice_numerazione& cod_num = cached_numerazione(m.get(F_CODNUM));
 | 
			
		||||
 | 
			
		||||
	// Se per questa numerazione e' abilitata le numerazione automatica
 | 
			
		||||
	key.cut(0);
 | 
			
		||||
	if (cod_num.auto_num())
 | 
			
		||||
	{
 | 
			
		||||
	  TDate ddoc; // unused
 | 
			
		||||
	  long ndoc = 1;
 | 
			
		||||
		
 | 
			
		||||
	  if (last_doc(m.get(F_PROVV)[0], m.get_int(F_ANNO), cod_num.codice(), ndoc, ddoc))
 | 
			
		||||
		ndoc++;
 | 
			
		||||
	  else
 | 
			
		||||
		ndoc = 1;
 | 
			
		||||
    return format("%d|%ld", F_NDOC, ndoc);
 | 
			
		||||
	  key.format("%d|%ld", F_NDOC, ndoc);
 | 
			
		||||
	  return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
  return "";
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char* TMotore_application::record_description(const TRelation& rel) const
 | 
			
		||||
 | 
			
		||||
@ -106,7 +106,8 @@ public:
 | 
			
		||||
  TMotore_application( ) : _ncopie(-1){ }
 | 
			
		||||
  virtual ~TMotore_application( ) { }
 | 
			
		||||
 | 
			
		||||
  virtual const char* get_next_key( );
 | 
			
		||||
	bool TMotore_application::get_next_key(TToken_string& key);
 | 
			
		||||
//  virtual const char* get_next_key( );
 | 
			
		||||
 | 
			
		||||
	// Test Plafond
 | 
			
		||||
	int check_plafond_write(TDocumento& d);
 | 
			
		||||
 | 
			
		||||
@ -1384,6 +1384,7 @@ void TMask_generator::genera_testata_1()
 | 
			
		||||
  _m->field( DOC_CODCF );
 | 
			
		||||
  _m->group( 1 );
 | 
			
		||||
  _m->use( LF_CLIFO, 1 );
 | 
			
		||||
  _m->join(LF_COMUNI, "STATO==STATOCF COM==COMCF");
 | 
			
		||||
  temp_s.format( "TIPOCF \"%c\"~CODCF %d", tipo_cf, F_CODCF);
 | 
			
		||||
  _m->input( temp_s );
 | 
			
		||||
  _m->display( "\"Codice\" CODCF~\"Ragione Sociale@50\" RAGSOC~\"Partita IVA@12\" PAIV~\"Sospeso\" SOSPESO~\"Indirizzo@35\" INDCF ~\"Numero@15\" CIVCF~\"Località@50\" LOCALITACF ~\"Comune@50\" 13->DENCOM" );
 | 
			
		||||
 | 
			
		||||
@ -64,16 +64,24 @@ JOLLY9|2|20|Jolly|20
 | 
			
		||||
JOLLY10|2|20|Jolly|20
 | 
			
		||||
RIDPREZZO|3|18|Riduzione prezzo|18
 | 
			
		||||
PERCPROV|3|502|2a Perc.\nProvv.|5
 | 
			
		||||
SCAACC|2|4|Sottocategoria\nACCIAIO|4
 | 
			
		||||
PUNACC|3|1305|Peso unitario\nACCIAIO|13
 | 
			
		||||
SCAALL|2|4|Sottocategoria\nALLUMINIO|4
 | 
			
		||||
PUNALL|3|1305|Peso unitario\nALLUMINIO|13
 | 
			
		||||
SCACAR|2|4|Sottocategoria\nCARTA|4
 | 
			
		||||
PUNCAR|3|1305|Peso unitario\nCARTA|13
 | 
			
		||||
SCAPLA|2|4|Sottocategoria\nPLASTICA|4
 | 
			
		||||
PUNPLA|3|1305|Peso unitario\nPLASTICA|13
 | 
			
		||||
SCALEG|2|4|Sottocategoria\nLEGNO|4
 | 
			
		||||
PUNLEG|3|1305|Peso unitario\nLEGNO|13
 | 
			
		||||
SCAVET|2|4|Sottocategoria\nVETRO|4
 | 
			
		||||
PUNVET|3|1305|Peso unitario\nVETRO|13
 | 
			
		||||
CCON(1)|2|4|CONAI\nSottoc.1|4
 | 
			
		||||
PCON(1)|3|1305|CONAI\nPeso un.1|13
 | 
			
		||||
CCON(2)|2|4|CONAI\nSottoc.2|4
 | 
			
		||||
PCON(2)|3|1305|CONAI\nPeso un.2|13
 | 
			
		||||
CCON(3)|2|4|CONAI\nSottoc.3|4
 | 
			
		||||
PCON(3)|3|1305|CONAI\nPeso un.3|13
 | 
			
		||||
CCON(4)|2|4|CONAI\nSottoc.4|4
 | 
			
		||||
PCON(4)|3|1305|CONAI\nPeso un.4|13
 | 
			
		||||
CCON(5)|2|4|CONAI\nSottoc.5|4
 | 
			
		||||
PCON(5)|3|1305|CONAI\nPeso un.5|13
 | 
			
		||||
CCON(6)|2|4|CONAI\nSottoc.6|4
 | 
			
		||||
PCON(6)|3|1305|CONAI\nPeso un.6|13
 | 
			
		||||
CCON(6)|2|4|CONAI\nSottoc.7|4
 | 
			
		||||
PCON(7)|3|1305|CONAI\nPeso un.7|13
 | 
			
		||||
CCON(7)|2|4|CONAI\nSottoc.8|4
 | 
			
		||||
PCON(8)|3|1305|CONAI\nPeso un.8|13
 | 
			
		||||
CCON(8)|2|4|CONAI\nSottoc.9|4
 | 
			
		||||
PCON(9)|3|1305|CONAI\nPeso un.9|13
 | 
			
		||||
CCON(10)|2|4|CONAI\nSottoc.10|4
 | 
			
		||||
PCON(10)|3|1305|CONAI\nPeso un.10|13
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -48,15 +48,14 @@ public:
 | 
			
		||||
 | 
			
		||||
TRiga_documento& TDoc_recordset::riga_doc(int n) const
 | 
			
		||||
{
 | 
			
		||||
	if (n == 0)
 | 
			
		||||
		n = _mypos + 1;
 | 
			
		||||
	if (n < 0 || n > _doc->rows()) // Non dovrebbe succedere mai
 | 
			
		||||
  {
 | 
			
		||||
		message_box("chi mi chiama ?");
 | 
			
		||||
    n = _doc->new_row("05").numero(); // Crea una riga descrizione fittizia
 | 
			
		||||
    ((TDoc_recordset*)this)->_lastpos++;
 | 
			
		||||
  }
 | 
			
		||||
  if (n <= 0)
 | 
			
		||||
    n = _mypos+1;
 | 
			
		||||
	if (n <= 0)
 | 
			
		||||
		n = 1;
 | 
			
		||||
  return _doc->row(n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -847,7 +846,7 @@ bool TReport_doc::msg_add_row(TVariant_stack& stack)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  TRiga_documento& curr_rdoc = riga_doc(0);
 | 
			
		||||
  TRiga_documento& curr_rdoc = riga_doc();
 | 
			
		||||
  if (curr_rdoc.get(RDOC_TIPORIGA) == row_type)
 | 
			
		||||
    return false; // Riga generata
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -72,6 +72,7 @@ class TMask_anamag: public TMask
 | 
			
		||||
  static bool handle_sheet_cod(TMask_field &, KEY); // handler dello sheet dei codici alternativi
 | 
			
		||||
  static bool notify_sheet_cod(TSheet_field & s, int r, KEY k); // notify dello sheet delle unità di misura
 | 
			
		||||
  static bool handle_codcorr(TMask_field &, KEY); // handler dello sheet dei codici alternativi
 | 
			
		||||
	static bool notify_sheet_conai(TSheet_field & s, int r, KEY k);
 | 
			
		||||
	static bool notify_sheet_giac(TSheet_field & s, int r, KEY k); // notify delle giacenze
 | 
			
		||||
  static bool handle_sheetgiac(TMask_field &, KEY); // handler dello sheet giacenze
 | 
			
		||||
  static bool notify_sheet_sto(TSheet_field & s, int r, KEY k); // notify dello storico
 | 
			
		||||
@ -377,6 +378,9 @@ void TMask_anamag::set_parametered_fields()
 | 
			
		||||
  TSheet_field &fld_stomag = sfield(F_SHEETSTOMAG); 
 | 
			
		||||
	TSheet_field &fld_giac = sfield(F_SHEETGIAC);
 | 
			
		||||
	fld_giac.set_notify(notify_sheet_giac);
 | 
			
		||||
	TSheet_field &fld_conai = sfield(F_SHEETCON);
 | 
			
		||||
	fld_conai.set_notify(notify_sheet_conai);
 | 
			
		||||
	fld_conai.set_append(false);
 | 
			
		||||
	TSheet_field &fld_cod = sfield(F_SHEETCOD);
 | 
			
		||||
 | 
			
		||||
  // disabilita le colonne quando non sono utilizzati i livelli di giacenza
 | 
			
		||||
@ -1476,7 +1480,19 @@ bool TMask_anamag::check_totali_storico()
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}                          
 | 
			
		||||
 | 
			
		||||
bool TMask_anamag::notify_sheet_conai(TSheet_field &f, int i, KEY k)
 | 
			
		||||
{
 | 
			
		||||
	TMask_anamag& m = (TMask_anamag&)f.mask();
 | 
			
		||||
 | 
			
		||||
	switch (k)
 | 
			
		||||
	{
 | 
			
		||||
		case (K_INS) :
 | 
			
		||||
		{
 | 
			
		||||
			return f.rows_array().items() < 10;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
bool TMask_anamag::notify_sheet_giac(TSheet_field &f, int i, KEY k)
 | 
			
		||||
{
 | 
			
		||||
  TMask_anamag& m = (TMask_anamag&)f.mask();
 | 
			
		||||
@ -1999,12 +2015,12 @@ void TAnagrafica_magazzino::fill_conai(const TString& codart, TSheet_field& fld_
 | 
			
		||||
	fld_con.hide();
 | 
			
		||||
 | 
			
		||||
	TArticolo_conai ac(codart);
 | 
			
		||||
	FOR_EACH_CONAI_SOTTOCAT(ac, cat, sottocat)
 | 
			
		||||
	for (int i = 0; i < FR_CMAX; i++)
 | 
			
		||||
	{
 | 
			
		||||
		TToken_string& row = fld_con.row(-1);
 | 
			
		||||
		row.add(cat.first);
 | 
			
		||||
		row.add(sottocat.first);
 | 
			
		||||
		row.add(sottocat.second);
 | 
			
		||||
		row.add(ac.get_scat(i).left(2));
 | 
			
		||||
		row.add(ac.get_scat(i).right(2));
 | 
			
		||||
		row.add(ac.get_peso(i));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Lo rimostro
 | 
			
		||||
@ -2014,47 +2030,30 @@ void TAnagrafica_magazzino::fill_conai(const TString& codart, TSheet_field& fld_
 | 
			
		||||
int TAnagrafica_magazzino::write_conai(const TMask& m) const
 | 
			
		||||
{
 | 
			
		||||
	int ok = NOERR;
 | 
			
		||||
	// Prima di tutto svuoto i campi del conai sull'articolo
 | 
			
		||||
	TLocalisamfile anamag(LF_ANAMAG);
 | 
			
		||||
	anamag.put(ANAMAG_CODART, m.get(F_CODART));
 | 
			
		||||
	if(anamag.read() == NOERR)
 | 
			
		||||
	{
 | 
			
		||||
		anamag.put(ANAMAG_CONAISC, "");
 | 
			
		||||
		anamag.put(ANAMAG_CONACC, "");
 | 
			
		||||
		anamag.put(ANAMAG_CONALL, "");
 | 
			
		||||
		anamag.put(ANAMAG_CONCAR, "");
 | 
			
		||||
		anamag.put(ANAMAG_CONLEG, "");
 | 
			
		||||
		anamag.put(ANAMAG_CONPLA, "");
 | 
			
		||||
		anamag.put(ANAMAG_CONVET, "");
 | 
			
		||||
		ok |= anamag.rewrite();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Adesso svuoto i record presenti in CONART
 | 
			
		||||
	TLocalisamfile conart(LF_CONART);
 | 
			
		||||
	TRelation rel_conart(LF_CONART);
 | 
			
		||||
	TRectype filter_conart(LF_CONART);
 | 
			
		||||
	filter_conart.put(ANAMAG_CODART, m.get(F_CODART));
 | 
			
		||||
 | 
			
		||||
	TCursor cur_conart(&rel_conart, "", 1, &filter_conart, &filter_conart);
 | 
			
		||||
	while(cur_conart.items() > 0)
 | 
			
		||||
	{
 | 
			
		||||
		ok |= conart.remove(cur_conart.curr());
 | 
			
		||||
	}
 | 
			
		||||
	TRecord_array conart(m.get(F_CODART), LF_CONART);
 | 
			
		||||
	TRectype conrec(LF_CONART);
 | 
			
		||||
 | 
			
		||||
	conart.destroy_rows();
 | 
			
		||||
	// Infine salvo i nuovi dati in conart
 | 
			
		||||
 | 
			
		||||
	TSheet_field& sheet_conai = m.sfield(F_SHEETCON);
 | 
			
		||||
	int r = 1;
 | 
			
		||||
	FOR_EACH_SHEET_ROW(sheet_conai, num_riga, row)
 | 
			
		||||
	{
 | 
			
		||||
		conart.zero();
 | 
			
		||||
		conart.put(CONART_CODART, m.get(F_CODART));
 | 
			
		||||
		conart.put(CONART_NRIGA, num_riga +1);
 | 
			
		||||
		conart.put(CONART_CATEGORIA, row->get(cid2index(FS_CAT_CONAI)));
 | 
			
		||||
		conart.put(CONART_SOTTOCAT, row->get(cid2index(FS_SCAT_CONAI)));
 | 
			
		||||
		conart.put(CONART_PESO, row->get(cid2index(FS_PES_CONAI)));
 | 
			
		||||
		ok |= conart.write();
 | 
			
		||||
	}
 | 
			
		||||
		const TString cat = row->get(cid2index(FS_CAT_CONAI));
 | 
			
		||||
 | 
			
		||||
		if (cat.full())
 | 
			
		||||
		{
 | 
			
		||||
			conrec.zero();
 | 
			
		||||
			conrec.put(CONART_CODART, m.get(F_CODART));
 | 
			
		||||
			conrec.put(CONART_NRIGA, r++);
 | 
			
		||||
			conrec.put(CONART_CATEGORIA, cat);
 | 
			
		||||
			conrec.put(CONART_SOTTOCAT, row->get(cid2index(FS_SCAT_CONAI)));
 | 
			
		||||
			conrec.put(CONART_PESO, row->get(cid2index(FS_PES_CONAI)));
 | 
			
		||||
			conart.add_row(conrec);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	ok |= conart.write(true);
 | 
			
		||||
	return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -13,6 +13,10 @@
 | 
			
		||||
#include <config.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __UTILITY_H
 | 
			
		||||
#include <utility.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __VISWIN_H
 | 
			
		||||
class TViswin;
 | 
			
		||||
#endif
 | 
			
		||||
@ -247,6 +251,8 @@ class TTipo_documento : public TRectype	// velib03
 | 
			
		||||
	TString16 _field_qta_mag, _field_qtaevasa_mag; // Veri campi Quantità e Quantità Evasa per magazzino
 | 
			
		||||
	TString16 _raee_cod, _raee_fld;
 | 
			
		||||
	TString _str_desc_doc, _str_desc_rdoc;
 | 
			
		||||
	TDate _first_ok_date;
 | 
			
		||||
	int _max_days;
 | 
			
		||||
	int _liv, _row;
 | 
			
		||||
	TString4 _module;
 | 
			
		||||
 | 
			
		||||
@ -373,6 +379,7 @@ public:
 | 
			
		||||
	bool head_ca_required() const { return _hca_req; }
 | 
			
		||||
  bool check_double_art() const { return _check_double_art; }
 | 
			
		||||
  bool ignora_anticipi_fatturazione() const { return _ignora_anticipi_fatturazione; }
 | 
			
		||||
	const TDate & first_ok_date();
 | 
			
		||||
  
 | 
			
		||||
	TTipo_documento(const char* tipodoc = NULL);
 | 
			
		||||
	TTipo_documento(const TRectype& rec);
 | 
			
		||||
@ -542,32 +549,23 @@ TCONAI_class	conai_str2class(const char* class_or_subclass);
 | 
			
		||||
const char* conai_class2str(TCONAI_class cc);
 | 
			
		||||
const char* conai_material(TCONAI_class cc);
 | 
			
		||||
bool conai_configured_class(TCONAI_class cc);
 | 
			
		||||
const char* conai_peso_name(TCONAI_class cc, int logic_num = LF_RIGHEDOC);
 | 
			
		||||
const char* conai_sottocat_name(TCONAI_class cc, int logic_num = LF_RIGHEDOC);
 | 
			
		||||
// Campi virtuali per peso CONAI su RDOC in Kg
 | 
			
		||||
inline const char* conai_peso_name(int i) { return format("PCON(%d)", i); }
 | 
			
		||||
// Campi virtuali per sottocategoria CONAI su RDOC
 | 
			
		||||
inline const char* conai_sottocat_name(int i) { return format("CCON(%d)", i); }
 | 
			
		||||
const char* conai_esenzione_name(TCONAI_class cc, int logicnum = LF_RIGHEDOC);
 | 
			
		||||
 | 
			
		||||
#define CHECK_CONAI(cc) CHECKD(cc>=CONAI_FIRST&&cc<CONAI_CLASSES, "Classe CONAI errata: ", cc)
 | 
			
		||||
#define FOR_EACH_CONAI_CLASS(cc) for (TCONAI_class cc = CONAI_FIRST; cc < CONAI_CLASSES; cc=TCONAI_class(cc+1))
 | 
			
		||||
#define FOR_EACH_CONFIGURED_CONAI_CLASS(cc) FOR_EACH_CONAI_CLASS(cc) if (conai_configured_class(cc))
 | 
			
		||||
 | 
			
		||||
class TConai : public TObject
 | 
			
		||||
{
 | 
			
		||||
private:
 | 
			
		||||
	/* It's a trap! 
 | 
			
		||||
	 * Design mappa 1:
 | 
			
		||||
	 * Codice CONAI, mappa2
 | 
			
		||||
	 * Design mappa 1:
 | 
			
		||||
	 * Sottocategoria CONAI, classe spesa
 | 
			
		||||
	*/
 | 
			
		||||
	std::map<TString, std::map<TString, TSpesa_prest>> _conais;
 | 
			
		||||
	std::map<TString, TCONAI_class> _tipo_spesa;
 | 
			
		||||
public:
 | 
			
		||||
	TAssoc_array _conais;
 | 
			
		||||
 | 
			
		||||
	const TSpesa_prest& get_spesa(const TString& cat, const TString& sottocat) { return _conais[cat][sottocat]; }
 | 
			
		||||
	const TSpesa_prest& get_spesa(const TString& full_sottocat) { return get_spesa(full_sottocat.left(2), full_sottocat.right(2)); }
 | 
			
		||||
	const std::map<TString, TSpesa_prest> get_categoria(const TString& cat) 	{ return _conais[cat];	}
 | 
			
		||||
	const bool find(const TString& cod_spesa) { return _conais.find(cod_spesa.left(2)) != _conais.end() && _conais[cod_spesa.left(2)].find(cod_spesa.right(2)) != _conais[cod_spesa.left(2)].end(); }
 | 
			
		||||
	const TString_array get_lista_cod_spesa();
 | 
			
		||||
public:
 | 
			
		||||
	const TSpesa_prest& get_spesa(const TString& sottocat) { return (const TSpesa_prest &) _conais[sottocat]; }
 | 
			
		||||
	const bool find(const TString& cod_spesa) { return _conais.objptr(cod_spesa) != NULL; }
 | 
			
		||||
	int get_lista_cod_spesa(TString_array & keys) { return _conais.get_keys(keys); }
 | 
			
		||||
 | 
			
		||||
	TConai();
 | 
			
		||||
};
 | 
			
		||||
@ -692,7 +690,7 @@ public:
 | 
			
		||||
  virtual real quantita_mag() const;
 | 
			
		||||
  virtual real qtaevasa_mag() const;
 | 
			
		||||
  virtual real qtaresidua_mag() const;
 | 
			
		||||
  real calc_conai_qta(TCONAI_class type, const int num_field) const;
 | 
			
		||||
  real calc_conai_qta(const int num_field) const;
 | 
			
		||||
 | 
			
		||||
	real valore(bool totale, bool lordo = false, int ndec = AUTO_DECIMALS) const;
 | 
			
		||||
	const TString& codice_costo() const;
 | 
			
		||||
@ -789,8 +787,7 @@ class TDocumento : public TMultiple_rectype	// velib03
 | 
			
		||||
	static short _has_provv;
 | 
			
		||||
	static TCodgiac_livelli *_livelli;
 | 
			
		||||
 | 
			
		||||
	TConai _conai;
 | 
			
		||||
	std::map<TString, real> _conaiqta;	// Per ogni sottocategoria CONAI mi calcola la qta
 | 
			
		||||
	TAssoc_array _conaiqta;	// Per ogni sottocategoria CONAI mi calcola la qta
 | 
			
		||||
 | 
			
		||||
protected:	
 | 
			
		||||
  virtual TRectype * new_body_record(int logicnum = 0) 
 | 
			
		||||
@ -850,8 +847,8 @@ public:
 | 
			
		||||
	virtual void zero(char c = '\0') { TMultiple_rectype::zero(c); }
 | 
			
		||||
  void sort_rows(const char * key);
 | 
			
		||||
 | 
			
		||||
	int physical_rows() const { return	body().rows(); } 
 | 
			
		||||
	virtual int rows() const { return physical_rows() + (ha_riga_sconto() ? 1 : 0) + (ha_riga_esenzione() ? 1 : 0) + (ha_riga_valfisc() ? 1 : 0); }
 | 
			
		||||
	inline int physical_rows() const { return	body().rows(); } 
 | 
			
		||||
	inline virtual int rows() const { return physical_rows() + (ha_riga_sconto() ? 1 : 0) + (ha_riga_esenzione() ? 1 : 0) + (ha_riga_valfisc() ? 1 : 0); }
 | 
			
		||||
	const TRiga_documento& operator[](int index) const { return (const TRiga_documento&)((TDocumento *)this)->row(index); }
 | 
			
		||||
	TRiga_documento& operator[](int index) { return (TRiga_documento&)row(index); } 
 | 
			
		||||
	
 | 
			
		||||
@ -947,7 +944,6 @@ public:
 | 
			
		||||
 | 
			
		||||
	void update_spese_aut(TString_array & spese, bool preserve_old = false, TSheet_field * sh = NULL, bool force = false);
 | 
			
		||||
	void update_conai_qta();
 | 
			
		||||
	//real calc_conai_qta(TCONAI_class type);
 | 
			
		||||
	void update_conai();
 | 
			
		||||
	void old_update_conai();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -953,51 +953,7 @@ TString conai_configured_spesa(TCONAI_class cc)
 | 
			
		||||
	return __con_conf->get(cc);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Campi virtuali per peso CONAI su RDOC e ANAMAG in Kg
 | 
			
		||||
const char* conai_peso_name(TCONAI_class type, int logicnum)
 | 
			
		||||
{
 | 
			
		||||
  if (conai_configured_class(type)) // Garantisce anche che type < CONAI_CLASSES
 | 
			
		||||
  {
 | 
			
		||||
    const char* const __conai_peso_rdoc[CONAI_CLASSES] = 
 | 
			
		||||
    { "CONPUACC", "CONPUALL", "CONPUCAR", "CONPUPLA", "CONPULEG", "CONPUVET" };
 | 
			
		||||
 | 
			
		||||
    const char* const __conai_peso_anmg[CONAI_CLASSES] = 
 | 
			
		||||
    {ANAMAG_CONACC, ANAMAG_CONALL, ANAMAG_CONCAR, ANAMAG_CONPLA, ANAMAG_CONLEG, ANAMAG_CONVET};
 | 
			
		||||
    
 | 
			
		||||
    switch (logicnum)
 | 
			
		||||
    {
 | 
			
		||||
    case LF_ANAMAG  : 
 | 
			
		||||
			error_box("La gestione conai è stata modificata! Impossibile determinare il campo");
 | 
			
		||||
    	return __conai_peso_anmg[type];
 | 
			
		||||
    case LF_RIGHEDOC: 
 | 
			
		||||
    	return __conai_peso_rdoc[type];
 | 
			
		||||
    default         : break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return "";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Campi virtuali per sottocategoria CONAI su RDOC e ANAMAG
 | 
			
		||||
const char* conai_sottocat_name(TCONAI_class type, int logicnum)
 | 
			
		||||
{
 | 
			
		||||
  if (conai_configured_class(type)) // Garantisce anche che type < CONAI_CLASSES
 | 
			
		||||
  {
 | 
			
		||||
    const char* const __conai_scat_rdoc[CONAI_CLASSES] = 
 | 
			
		||||
    { "CONSCACC", "CONSCALL", "CONSCCAR", "CONSCPLA", "CONSCLEG", "CONSCVET" };
 | 
			
		||||
    const char* const __conai_scat_anmg[CONAI_CLASSES] = 
 | 
			
		||||
    { ANAMAG_CONAISC"[1,4]",   ANAMAG_CONAISC"[5,8]",   ANAMAG_CONAISC"[9,12]", 
 | 
			
		||||
      ANAMAG_CONAISC"[13,16]", ANAMAG_CONAISC"[17,20]", ANAMAG_CONAISC"[21,24]" };
 | 
			
		||||
    switch (logicnum)
 | 
			
		||||
    {
 | 
			
		||||
    case LF_ANAMAG  : 
 | 
			
		||||
			error_box("La gestione conai è stata modificata! Impossibile determinare il campo"); 
 | 
			
		||||
    	return __conai_scat_anmg[type];
 | 
			
		||||
    case LF_RIGHEDOC: return __conai_scat_rdoc[type];
 | 
			
		||||
    default         : break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return "";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char* conai_esenzione_name(TCONAI_class cc, int logicnum)
 | 
			
		||||
{
 | 
			
		||||
@ -1020,21 +976,6 @@ const char* conai_esenzione_name(TCONAI_class cc, int logicnum)
 | 
			
		||||
// TConai
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
const TString_array TConai::get_lista_cod_spesa()
 | 
			
		||||
{
 | 
			
		||||
	TString_array ret;
 | 
			
		||||
	for (auto i = _conais.begin(); i != _conais.end(); ++i)
 | 
			
		||||
	{
 | 
			
		||||
		/*for (auto j = i->second.begin(); j != i->second().end(); ++j)
 | 
			
		||||
		{
 | 
			
		||||
			if (ret.find(j->second.codice()) == -1)
 | 
			
		||||
				ret.add(j->second.codice());
 | 
			
		||||
		}
 | 
			
		||||
		*/
 | 
			
		||||
	}
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TConai::TConai()
 | 
			
		||||
{
 | 
			
		||||
	TRelation rel(LF_TABMOD);
 | 
			
		||||
@ -1045,15 +986,16 @@ TConai::TConai()
 | 
			
		||||
	TCursor conais(&rel, "", 1, &rec, &rec);
 | 
			
		||||
	for (conais = 0; conais.pos() < conais.items(); ++conais)
 | 
			
		||||
	{
 | 
			
		||||
		TRectype row = conais.curr();
 | 
			
		||||
		const TString& con_class = row.get("CODTAB").left(2);
 | 
			
		||||
		const TString& con_sub = row.get("CODTAB").mid(2);
 | 
			
		||||
		const TString& cod_spesa = row.get("S1").blank() ? conai_configured_spesa(conai_str2class(con_class)) : row.get("S1");
 | 
			
		||||
		if (conai_configured_class(conai_str2class(con_class)))
 | 
			
		||||
		{
 | 
			
		||||
			// Aggiungo 
 | 
			
		||||
			_conais[con_class][con_sub] = TSpesa_prest(cod_spesa);
 | 
			
		||||
		}
 | 
			
		||||
		TRectype & row = conais.curr();
 | 
			
		||||
		const TString& con_sub = row.get("CODTAB");
 | 
			
		||||
		TString cod_spesa = row.get("S1");
 | 
			
		||||
		
 | 
			
		||||
		if (cod_spesa.blank())
 | 
			
		||||
			cod_spesa = conai_configured_spesa(conai_str2class(con_sub));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		if (cod_spesa.full())
 | 
			
		||||
			_conais.add(con_sub, new TSpesa_prest(cod_spesa), true);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1063,17 +1005,14 @@ TConai::TConai()
 | 
			
		||||
 | 
			
		||||
// Calcola il peso in Kg di una componente (carta, palstica, ecc.) dell'imballo della riga corrente
 | 
			
		||||
 | 
			
		||||
real TRiga_documento::calc_conai_qta(TCONAI_class type, const int num_field) const
 | 
			
		||||
real TRiga_documento::calc_conai_qta(const int num_field) const
 | 
			
		||||
{  
 | 
			
		||||
	real kg;
 | 
			
		||||
	if (is_merce() || is_omaggio())
 | 
			
		||||
	{
 | 
			
		||||
		TString weight_name = conai_peso_name(type, LF_RIGHEDOC);
 | 
			
		||||
    if (weight_name.full())            // Se la categoria conai e' gestita
 | 
			
		||||
    {
 | 
			
		||||
			weight_name << "(%d)";
 | 
			
		||||
      const real peso = get_real(weight_name.format(weight_name, num_field));				// Peso unitario imballo
 | 
			
		||||
      const real peso = get_real(conai_peso_name(num_field));				// Peso unitario imballo
 | 
			
		||||
      real qta = quantita();                    // Quantita' merce
 | 
			
		||||
 | 
			
		||||
      if (peso > ZERO && !qta.is_zero())        // Verifica se ha un peso valido
 | 
			
		||||
      {
 | 
			
		||||
        // A volte CODARTMAG è vuoto per cui converte erroneamente la qta in 0 :-(
 | 
			
		||||
@ -1086,7 +1025,6 @@ real TRiga_documento::calc_conai_qta(TCONAI_class type, const int num_field) con
 | 
			
		||||
        kg = qta * peso;                        // Calcola peso dell'imballo 
 | 
			
		||||
				kg.round(5);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    }
 | 
			
		||||
	return kg;
 | 
			
		||||
}   
 | 
			
		||||
@ -1363,7 +1301,7 @@ void TRiga_documento::autosave(TSheet_field& f)
 | 
			
		||||
					break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		for (short id = FR_SCAACC;  id <= FR_PUNVET; id++)
 | 
			
		||||
		for (short id = FR_CCON01;  id <= FR_PCON10; id++)
 | 
			
		||||
		{
 | 
			
		||||
			const int pos = m.id2pos(id);
 | 
			
		||||
 | 
			
		||||
@ -1487,7 +1425,7 @@ void TRiga_documento::autoload(TSheet_field & f)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for (short id = FR_SCAACC;  id <= FR_PUNVET; id++)
 | 
			
		||||
	for (short id = FR_CCON01;  id <= FR_PCON10; id++)
 | 
			
		||||
  {
 | 
			
		||||
		const int pos = m.id2pos(id);
 | 
			
		||||
		if (pos > 0)
 | 
			
		||||
 | 
			
		||||
@ -1968,6 +1968,8 @@ TRiga_documento & TDocumento::row(int index)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  if (r != NULL)
 | 
			
		||||
		r->set_doc(this);
 | 
			
		||||
  return *r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -3001,29 +3003,25 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
 | 
			
		||||
 | 
			
		||||
void TDocumento::update_conai_qta()
 | 
			
		||||
{
 | 
			
		||||
	_conaiqta.clear();
 | 
			
		||||
	_conaiqta.destroy();
 | 
			
		||||
 | 
			
		||||
	FOR_EACH_PHYSICAL_RDOC(*this, i, r) if (r->is_merce() || r->is_omaggio())
 | 
			
		||||
	{
 | 
			
		||||
		FOR_EACH_CONFIGURED_CONAI_CLASS(cc)
 | 
			
		||||
		{
 | 
			
		||||
			TString catconai = conai_sottocat_name(cc, LF_RIGHEDOC); catconai << "(%d)";
 | 
			
		||||
			int row_conai = 1;
 | 
			
		||||
			bool ok = true;
 | 
			
		||||
			while(ok)
 | 
			
		||||
			{
 | 
			
		||||
				static TString current_cat; current_cat.cut(0);
 | 
			
		||||
				current_cat.format(catconai, row_conai);
 | 
			
		||||
		TString current_cat;
 | 
			
		||||
 | 
			
		||||
				if (r->get(current_cat).full())
 | 
			
		||||
		for (int i = 1; i <= FR_CMAX; i++)
 | 
			
		||||
		{
 | 
			
		||||
					const real rowqty = r->calc_conai_qta(cc, row_conai);
 | 
			
		||||
					if (rowqty.is_zero()) continue;
 | 
			
		||||
					_conaiqta[r->get(current_cat)] += rowqty;
 | 
			
		||||
					row_conai++;
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
					ok = false;
 | 
			
		||||
			TString8 cat = r->get(conai_sottocat_name(i));
 | 
			
		||||
 | 
			
		||||
			if (cat.full())
 | 
			
		||||
			{
 | 
			
		||||
				const real rowqty = r->calc_conai_qta(i);
 | 
			
		||||
 | 
			
		||||
				real * q = (real *) _conaiqta.objptr(cat);
 | 
			
		||||
					
 | 
			
		||||
				if (q == NULL)
 | 
			
		||||
					_conaiqta.add(cat, q = new real);
 | 
			
		||||
				*q += rowqty;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@ -3065,7 +3063,7 @@ void TDocumento::update_conai()
 | 
			
		||||
{                   
 | 
			
		||||
  if (main_app().has_module(DCAUT, CHK_DONGLE) && tipo().add_conai() && tipo().stati_iniziali_modifica().find(stato()) >= 0)
 | 
			
		||||
  {
 | 
			
		||||
		set<TString> conai_aggiornati;
 | 
			
		||||
	TAssoc_array conai_aggiornati;
 | 
			
		||||
    const TRectype& cfven = clifor().vendite();
 | 
			
		||||
    const bool cli_add_conai = cfven.get_bool("ADDCONAI");
 | 
			
		||||
    
 | 
			
		||||
@ -3087,18 +3085,16 @@ void TDocumento::update_conai()
 | 
			
		||||
				// Controllo se il documento ha il metodo nuovo, in caso negativo skippo tutto
 | 
			
		||||
				// Cancella le righe generate e poi ti ricalcolo tutto
 | 
			
		||||
				if(!has_new_conai(*this))
 | 
			
		||||
				{
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				const TString& cod = r.get(RDOC_CODART);
 | 
			
		||||
				const TString& sottocat = r.get(RDOC_TIPOCON);
 | 
			
		||||
				if (_conai.find(sottocat))
 | 
			
		||||
				if (_conaiqta.objptr(sottocat) != NULL)
 | 
			
		||||
				{  
 | 
			
		||||
					if (cli_add_conai)
 | 
			
		||||
					{
 | 
			
		||||
						real perc_esenz = cfven.get_real(get_cf_esenz(sottocat.left(2)));
 | 
			
		||||
						real qta = _conaiqta[sottocat];
 | 
			
		||||
						real qta = (real &) _conaiqta[sottocat];
 | 
			
		||||
						if (dataes.ok() && datadoc > dataes)
 | 
			
		||||
							perc_esenz = ZERO;
 | 
			
		||||
						const bool cli_esente = esponi_esenti && (perc_esenz >= CENTO);
 | 
			
		||||
@ -3115,7 +3111,7 @@ void TDocumento::update_conai()
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
						destroy_row(i, true);
 | 
			
		||||
					conai_aggiornati.insert(sottocat);
 | 
			
		||||
					conai_aggiornati.add(sottocat, sottocat);
 | 
			
		||||
				}
 | 
			
		||||
      }
 | 
			
		||||
    } 
 | 
			
		||||
@ -3124,23 +3120,23 @@ void TDocumento::update_conai()
 | 
			
		||||
    if (cli_add_conai)
 | 
			
		||||
    {  
 | 
			
		||||
      const TString4 cod_iva_cli = codesiva();
 | 
			
		||||
	  TConai conai;
 | 
			
		||||
 | 
			
		||||
			std::map<TString, TRiga_documento> righe_spesa;
 | 
			
		||||
 | 
			
		||||
			for(auto cp = _conaiqta.begin(); cp != _conaiqta.end(); ++cp)
 | 
			
		||||
      FOR_EACH_ASSOC_OBJECT(_conaiqta, o, key, item)
 | 
			
		||||
	{
 | 
			
		||||
				const TString cod_sottocat = cp->first;
 | 
			
		||||
		const TString cod_sottocat = key;
 | 
			
		||||
 | 
			
		||||
		// Se l'ho già fatto skippo
 | 
			
		||||
				if (conai_aggiornati.find(cod_sottocat) != conai_aggiornati.end())
 | 
			
		||||
		if (conai_aggiornati.objptr(cod_sottocat) != NULL)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
				TSpesa_prest sp = _conai.get_spesa(cod_sottocat);
 | 
			
		||||
		TSpesa_prest sp = conai.get_spesa(cod_sottocat);
 | 
			
		||||
				
 | 
			
		||||
		// Aggiungo la spesa
 | 
			
		||||
		const real perc_esenz = cfven.get_real(get_cf_esenz(cod_sottocat.left(2)));
 | 
			
		||||
		const bool cli_esente = (esponi_esenti) && (perc_esenz >= CENTO);
 | 
			
		||||
				const real qta_lorda = _conaiqta[cod_sottocat];
 | 
			
		||||
		const real qta_lorda = *((real *) item);
 | 
			
		||||
		real qta = qta_lorda;
 | 
			
		||||
		if (!cli_esente && !qta_lorda.is_zero() && !perc_esenz.is_zero())
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
@ -267,7 +267,15 @@ const TString_array& TTipo_documento::sheet_columns() const
 | 
			
		||||
  if (_sheet_columns.empty())
 | 
			
		||||
  {
 | 
			
		||||
    TFilename pn; profile_name(pn);
 | 
			
		||||
    TConfig prof(pn, "SHEET");
 | 
			
		||||
		TConfig prof(pn);//, "SHEET");
 | 
			
		||||
		TString_array para;
 | 
			
		||||
 | 
			
		||||
		prof.list_paragraphs(para);
 | 
			
		||||
		if (para.find("SHEET", 0) >= 0)
 | 
			
		||||
			prof.set_paragraph("SHEET");
 | 
			
		||||
		else
 | 
			
		||||
			if (para.find("SH", 0) >= 0)
 | 
			
		||||
				prof.set_paragraph("SH");
 | 
			
		||||
		for (int i = 0; i < MAX_COLUMNS; i++)
 | 
			
		||||
    {
 | 
			
		||||
	    const TString& id = prof.get("Col", NULL, i);
 | 
			
		||||
@ -444,6 +452,7 @@ void TTipo_documento::read_formule()
 | 
			
		||||
		_load_cont = prof.get_bool("LOAD_CONT", "MAIN");
 | 
			
		||||
		_raee_cod = prof.get("RAEE_COD", "MAIN");
 | 
			
		||||
		_raee_fld = prof.get("RAEE_FLD", "MAIN");
 | 
			
		||||
		_max_days = prof.get_int("MAXDAYSBEFORE", "MAIN", -1, -1);
 | 
			
		||||
 | 
			
		||||
		TToken_string str = prof.get("ART_TO_SHOW", "MAIN");
 | 
			
		||||
		_liv = str.get_int();
 | 
			
		||||
@ -527,7 +536,22 @@ bool TTipo_documento::scarica_residuo()  const
 | 
			
		||||
  return get_bool("B4");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const TDate & TTipo_documento::first_ok_date()
 | 
			
		||||
{
 | 
			
		||||
	if (!_first_ok_date.ok())
 | 
			
		||||
	{
 | 
			
		||||
		_first_ok_date = TDate(TODAY);
 | 
			
		||||
		if (_max_days < 0)
 | 
			
		||||
		{
 | 
			
		||||
			_first_ok_date.set_day(1);
 | 
			
		||||
			_first_ok_date.set_month(1);
 | 
			
		||||
			_first_ok_date.set_year(1900);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
			_first_ok_date -= _max_days;
 | 
			
		||||
	}
 | 
			
		||||
	return _first_ok_date;
 | 
			
		||||
}
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// Espressione rdocumento
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
@ -1231,10 +1231,6 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
 | 
			
		||||
					_error = ultprot_error;
 | 
			
		||||
					return _error;
 | 
			
		||||
				}
 | 
			
		||||
				if (upd_prot)
 | 
			
		||||
					reg.update(ult_prot, doc.data());
 | 
			
		||||
				else
 | 
			
		||||
					registro.update(ult_prot, doc.data());
 | 
			
		||||
			}
 | 
			
		||||
			else // oppure dal numero di documento
 | 
			
		||||
				ult_prot = doc.numero();
 | 
			
		||||
@ -3212,6 +3208,18 @@ error_type TContabilizzazione::write_all(TDocumento& doc, TMovimentoPN_VE & movi
 | 
			
		||||
    error_box("*** Errore %d scrivendo il movimento contabile %ld.", err, numreg);
 | 
			
		||||
    return generic_error;
 | 
			
		||||
  }
 | 
			
		||||
	if (_nump_iva)  // Reperisce l'ultimo numero di protocollo dal registro IVA
 | 
			
		||||
	{
 | 
			
		||||
		const bool upd_prot = ini_get_bool(CONFIG_DITTA, "ve", "UpdateProtocol", true);
 | 
			
		||||
		TRegistro& registro = _caus->reg();
 | 
			
		||||
		TRegistro reg(registro);
 | 
			
		||||
		const int ult_prot = head.get_int(MOV_PROTIVA);
 | 
			
		||||
 | 
			
		||||
		if (upd_prot)
 | 
			
		||||
			reg.update(ult_prot, doc.data());
 | 
			
		||||
		else
 | 
			
		||||
			registro.update(ult_prot, doc.data());
 | 
			
		||||
	}
 | 
			
		||||
  // Aggiorno subito i saldi
 | 
			
		||||
  if (_caus->soloiva())
 | 
			
		||||
    movimento.destroy_cg_row(-1);
 | 
			
		||||
 | 
			
		||||
@ -72,17 +72,11 @@ TColor_rule::TColor_rule(const char* desc, const char* expr, TTypeexp type, COLO
 | 
			
		||||
// Gestione campi CONAI su maschera righe
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
short conai_peso_id(TCONAI_class type)
 | 
			
		||||
{ return type >= CONAI_FIRST && type <= CONAI_LAST ? FR_PUNACC + 2 * type : DLG_NULL; }
 | 
			
		||||
short conai_peso_id(int id)
 | 
			
		||||
{ return id >= 0 && id < FR_CMAX ? FR_PCON01 + 2 * id : DLG_NULL; }
 | 
			
		||||
 | 
			
		||||
short conai_sottocat_id(TCONAI_class type)
 | 
			
		||||
{ return type >= CONAI_FIRST && type <= CONAI_LAST ? FR_SCAACC + 2*type : DLG_NULL; }
 | 
			
		||||
 | 
			
		||||
TCONAI_class conai_id2class(short id)
 | 
			
		||||
{ 
 | 
			
		||||
  const TCONAI_class t = TCONAI_class((id-FR_SCAACC) / 2);
 | 
			
		||||
  return t >= CONAI_FIRST && t <= CONAI_LAST ? t : CONAI_NONE;
 | 
			
		||||
}
 | 
			
		||||
short conai_sottocat_id(int id)
 | 
			
		||||
{ return id >= 0 && id < FR_CMAX ? FR_CCON01 + 2 * id : DLG_NULL; }
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TDocumento_mask
 | 
			
		||||
@ -664,7 +658,7 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	colonne = "0";
 | 
			
		||||
	for (i = 0; i < ncols; i ++ )
 | 
			
		||||
	for (i = 0; i < ncols; i++)
 | 
			
		||||
	{
 | 
			
		||||
		TToken_string& sheet_col = (TToken_string&)sheet_columns.row(i);
 | 
			
		||||
		const int field_id = sheet_col.get_int(0);
 | 
			
		||||
@ -672,12 +666,12 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
 | 
			
		||||
		to_delete.reset(coltomove);
 | 
			
		||||
 | 
			
		||||
		const TString80 descr(sheet_col.get(1));
 | 
			
		||||
		if (descr.not_empty() )
 | 
			
		||||
			sheet.set_column_header( field_id, descr);
 | 
			
		||||
		if (descr.not_empty())
 | 
			
		||||
			sheet.set_column_header(field_id, descr);
 | 
			
		||||
 | 
			
		||||
		const int size = sheet_col.get_int(2) * 8; // XI_FU_MULTIPLE
 | 
			
		||||
		if (size != 0)
 | 
			
		||||
			sheet.set_column_width( field_id, size);
 | 
			
		||||
			sheet.set_column_width(field_id, size);
 | 
			
		||||
 | 
			
		||||
		if (field_id != FR_LORDO)
 | 
			
		||||
			colonne.add(field_id);
 | 
			
		||||
@ -693,14 +687,19 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
 | 
			
		||||
	to_delete.set(0L);
 | 
			
		||||
	to_delete.reset(1);
 | 
			
		||||
 | 
			
		||||
	bool has_conai = false;
 | 
			
		||||
 | 
			
		||||
	FOR_EACH_CONAI_CLASS(ct)
 | 
			
		||||
		has_conai |= conai_configured_class(ct);
 | 
			
		||||
 | 
			
		||||
	for (int ct = 0; ct < FR_CMAX; ct++)
 | 
			
		||||
	{
 | 
			
		||||
		const short posc = conai_sottocat_id(ct);
 | 
			
		||||
		const short posp = conai_peso_id(ct);
 | 
			
		||||
		const int colc = sheet.cid2index(posc);
 | 
			
		||||
		const int colp = sheet.cid2index(posp);
 | 
			
		||||
 | 
			
		||||
		if (conai_configured_class(ct))
 | 
			
		||||
		if (has_conai)
 | 
			
		||||
		{
 | 
			
		||||
			to_delete.reset(colc);
 | 
			
		||||
			if (colonne.find(format("%d", posc)) < 0)
 | 
			
		||||
@ -753,6 +752,7 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	if (!to_delete[sheet.cid2index(FR_CODDEP)])
 | 
			
		||||
		sheet.enable_column(FR_CODDEP, _ges_dep && _ges_mag);
 | 
			
		||||
	if (!to_delete[sheet.cid2index(FR_CODMAG)])
 | 
			
		||||
@ -1760,11 +1760,17 @@ TVariable_mask* TDocumento_mask::riga_mask(int numriga)
 | 
			
		||||
		  f.add_driver(-F_CODVAL);
 | 
			
		||||
	  }
 | 
			
		||||
 | 
			
		||||
		FOR_EACH_CONAI_CLASS(type)
 | 
			
		||||
	  bool has_conai = false;
 | 
			
		||||
 | 
			
		||||
	  FOR_EACH_CONAI_CLASS(ct)
 | 
			
		||||
		  has_conai |= conai_configured_class(ct);
 | 
			
		||||
	 
 | 
			
		||||
	  for (int i = 0; i < FR_CMAX; i++)
 | 
			
		||||
	  {
 | 
			
		||||
			const short posc = conai_sottocat_id(type);
 | 
			
		||||
			const short posp = conai_peso_id(type);
 | 
			
		||||
			if (conai_configured_class(type))
 | 
			
		||||
			const short posc = conai_sottocat_id(i);
 | 
			
		||||
			const short posp = conai_peso_id(i);
 | 
			
		||||
 | 
			
		||||
			if (has_conai)
 | 
			
		||||
			{
 | 
			
		||||
				m->show(posc);
 | 
			
		||||
				m->set_handler(posc, sottocat_conai_handler);
 | 
			
		||||
@ -1778,6 +1784,7 @@ TVariable_mask* TDocumento_mask::riga_mask(int numriga)
 | 
			
		||||
			}
 | 
			
		||||
	  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		// Impostiamo gli eventuali drivers
 | 
			
		||||
    FOR_EACH_MASK_FIELD((*m), i, f) if (f->is_edit())
 | 
			
		||||
			((TEdit_field*)f)->test_drivers();
 | 
			
		||||
 | 
			
		||||
@ -420,7 +420,7 @@ bool note_hndl( TMask_field& f, KEY key )
 | 
			
		||||
					TString stringone;
 | 
			
		||||
					for (int i = 0; i < 6; i++)
 | 
			
		||||
					{
 | 
			
		||||
						const char fieldname[3] = { 'S', i+'0', '\0' };
 | 
			
		||||
						TString4 fieldname; fieldname << 'S' << i;
 | 
			
		||||
						stringone << note.get(fieldname);
 | 
			
		||||
					}
 | 
			
		||||
					stringone.replace(char(0xB6), '\n');
 | 
			
		||||
@ -486,10 +486,11 @@ bool data_hndl( TMask_field& field, KEY key )
 | 
			
		||||
    if (m.id2pos(F_DATACAMBIO1) >= 0 && !m.get(F_CODVAL).empty())
 | 
			
		||||
      m.set(F_DATACAMBIO1, field.get(), TRUE);
 | 
			
		||||
  }
 | 
			
		||||
	const TDate datadoc(m.get(F_DATADOC));
 | 
			
		||||
	if (key == K_ENTER || field.to_check(key))
 | 
			
		||||
  {           
 | 
			
		||||
    const TDate datadoc(m.get(F_DATADOC));
 | 
			
		||||
    const int annodoc = m.get_int(F_ANNO);
 | 
			
		||||
  
 | 
			
		||||
	  if (datadoc.year() != annodoc)
 | 
			
		||||
    {
 | 
			
		||||
      if (datadoc.ok())
 | 
			
		||||
@ -544,6 +545,12 @@ bool data_hndl( TMask_field& field, KEY key )
 | 
			
		||||
    if (doc.good() && same_key && datadoc > doc.get_date(DOC_DATADOC))
 | 
			
		||||
      return field.error_box("Data documento superiore alla data del documento successivo"); 
 | 
			
		||||
	}
 | 
			
		||||
	if (key == K_ENTER || field.to_check(key))
 | 
			
		||||
	{
 | 
			
		||||
		if (m.insert_mode() && datadoc < ((TTipo_documento &)m.doc().tipo()).first_ok_date())
 | 
			
		||||
			return field.error_box("La data documento non può essere antecente al %s.", ((TTipo_documento &)m.doc().tipo()).first_ok_date().stringa());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
	
 | 
			
		||||
@ -1897,28 +1904,21 @@ bool codart_handler(TMask_field& f, KEY key )
 | 
			
		||||
 | 
			
		||||
    const char* rdoc_prezzo = mask.doc().tipo().calcolo_lordo() ? RDOC_PREZZOL : RDOC_PREZZO;
 | 
			
		||||
    mask.doc()[current_doc_row].put(rdoc_prezzo, row_mask.get(FR_PREZZO)); 
 | 
			
		||||
	TArticolo_conai cart(codart);
 | 
			
		||||
	    
 | 
			
		||||
		FOR_EACH_CONFIGURED_CONAI_CLASS(type)
 | 
			
		||||
		for (int i = 0; i < FR_CMAX; i++)
 | 
			
		||||
		{
 | 
			
		||||
			short id = conai_sottocat_id(type);
 | 
			
		||||
			short id = conai_sottocat_id(i);
 | 
			
		||||
			int pos = row_mask.id2pos(id);
 | 
			
		||||
 | 
			
		||||
			if (pos >= 0 && row_mask.fld(pos).get().blank())
 | 
			
		||||
      {
 | 
			
		||||
        const int lognum = anamag.num();
 | 
			
		||||
        const TFieldref fr(conai_sottocat_name(type, lognum), lognum);
 | 
			
		||||
        row_mask.fld(pos).set(fr.read(anamag));
 | 
			
		||||
      }
 | 
			
		||||
        row_mask.fld(pos).set(cart.get_scat(i));
 | 
			
		||||
 | 
			
		||||
			id = conai_peso_id(type);
 | 
			
		||||
			id = conai_peso_id(i);
 | 
			
		||||
			pos = row_mask.id2pos(id);
 | 
			
		||||
 | 
			
		||||
			if (pos >= 0 && row_mask.fld(pos).get().blank())
 | 
			
		||||
      {
 | 
			
		||||
        const int lognum = anamag.num();
 | 
			
		||||
        const TFieldref fr(conai_peso_name(type, lognum), lognum);
 | 
			
		||||
				row_mask.fld(pos).set(fr.read(anamag));
 | 
			
		||||
      }
 | 
			
		||||
				row_mask.set(id, cart.get_peso(i));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		const int pos = row_mask.id2pos(FR_CODIVA);
 | 
			
		||||
@ -3315,10 +3315,10 @@ bool sottocat_conai_handler(TMask_field& f, KEY key )
 | 
			
		||||
	if (key == K_F8)
 | 
			
		||||
	{
 | 
			
		||||
		const TString& codart = f.mask().get(FR_CODARTMAG);
 | 
			
		||||
		const TArticolo& articolo = cached_article(codart);
 | 
			
		||||
		const TCONAI_class type = conai_id2class(f.dlg());
 | 
			
		||||
    const TFieldref fld(conai_sottocat_name(type, LF_ANAMAG), LF_ANAMAG);
 | 
			
		||||
    f.set(fld.read(articolo));
 | 
			
		||||
		TArticolo_conai articolo(codart);
 | 
			
		||||
		const int i = (f.dlg() - FR_CCON01)/2;
 | 
			
		||||
	    f.set(articolo.get_scat(i)); 
 | 
			
		||||
		peso_conai_handler(f.mask().field(f.dlg() + 1), key);
 | 
			
		||||
	}
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
@ -3328,9 +3328,9 @@ bool peso_conai_handler(TMask_field& f, KEY key)
 | 
			
		||||
	if (key == K_F8)
 | 
			
		||||
	{
 | 
			
		||||
		const TString& codart = f.mask().get(FR_CODARTMAG);
 | 
			
		||||
		const TArticolo& articolo = cached_article(codart);
 | 
			
		||||
		const TCONAI_class type = conai_id2class(f.dlg());
 | 
			
		||||
		f.set(articolo.get(conai_peso_name(type, LF_ANAMAG)));
 | 
			
		||||
		TArticolo_conai articolo(codart);
 | 
			
		||||
		const int i = (f.dlg() - FR_PCON01) / 2;
 | 
			
		||||
		f.set(articolo.get_peso(i).string());
 | 
			
		||||
	}
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -50,9 +50,8 @@ bool reportba8_hndl(TMask_field& f, KEY key);
 | 
			
		||||
 | 
			
		||||
bool is_tipodoc_ok(const TString & tipodoc);
 | 
			
		||||
 | 
			
		||||
TCONAI_class conai_id2class(short id);
 | 
			
		||||
short conai_peso_id(TCONAI_class cc);
 | 
			
		||||
short conai_sottocat_id(TCONAI_class cc);
 | 
			
		||||
short conai_peso_id(int cc);
 | 
			
		||||
short conai_sottocat_id(int cc);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -109,22 +109,30 @@
 | 
			
		||||
 | 
			
		||||
//campi CONAI
 | 
			
		||||
 | 
			
		||||
#define FR_SCAACC			 167
 | 
			
		||||
#define FR_PUNACC			 168
 | 
			
		||||
#define FR_SCAALL			 169
 | 
			
		||||
#define FR_PUNALL			 170
 | 
			
		||||
#define FR_SCACAR			 171
 | 
			
		||||
#define FR_PUNCAR			 172
 | 
			
		||||
#define FR_SCAPLA			 173
 | 
			
		||||
#define FR_PUNPLA			 174
 | 
			
		||||
#define FR_SCALEG			 175
 | 
			
		||||
#define FR_PUNLEG			 176
 | 
			
		||||
#define FR_SCAVET			 177
 | 
			
		||||
#define FR_PUNVET			 178
 | 
			
		||||
#define FR_CCON01			 167
 | 
			
		||||
#define FR_PCON01			 168
 | 
			
		||||
#define FR_CCON02			 169
 | 
			
		||||
#define FR_PCON02			 170
 | 
			
		||||
#define FR_CCON03			 171
 | 
			
		||||
#define FR_PCON03			 172
 | 
			
		||||
#define FR_CCON04			 173
 | 
			
		||||
#define FR_PCON04			 174
 | 
			
		||||
#define FR_CCON05			 175
 | 
			
		||||
#define FR_PCON05			 176
 | 
			
		||||
#define FR_CCON06			 177
 | 
			
		||||
#define FR_PCON06			 178
 | 
			
		||||
#define FR_CCON07			 179
 | 
			
		||||
#define FR_PCON07			 180
 | 
			
		||||
#define FR_CCON08			 181
 | 
			
		||||
#define FR_PCON08			 182
 | 
			
		||||
#define FR_CCON09			 183
 | 
			
		||||
#define FR_PCON09			 184
 | 
			
		||||
#define FR_CCON10			 185
 | 
			
		||||
#define FR_PCON10			 186
 | 
			
		||||
#define FR_CMAX				 (FR_PCON10-FR_CCON01+1)/2
 | 
			
		||||
 | 
			
		||||
// Ultimo campo fittizio
 | 
			
		||||
#define FR_END         179
 | 
			
		||||
 | 
			
		||||
#define FR_END         187
 | 
			
		||||
#define MAX_COLUMNS    FR_END-FR_LORDO
 | 
			
		||||
 | 
			
		||||
#define FR_DESMAG      270
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										173
									
								
								src/ve/verig.uml
									
									
									
									
									
								
							
							
						
						
									
										173
									
								
								src/ve/verig.uml
									
									
									
									
									
								
							@ -2083,109 +2083,174 @@ ENDPAGE
 | 
			
		||||
 | 
			
		||||
PAGE "Pag.4"  -1 -1 MASK_WIDTH MASK_HEIGHT
 | 
			
		||||
 | 
			
		||||
GROUPBOX DLG_NULL 78 8
 | 
			
		||||
GROUPBOX DLG_NULL 78 12
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 1 0 "CONAI"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING FR_SCAACC 4
 | 
			
		||||
STRING FR_CCON01 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 1 "Sottocategoria ACCIAIO   "
 | 
			
		||||
  USE &SCC SELECT CODTAB[1,2]=="AC"
 | 
			
		||||
  INPUT CODTAB FR_SCAACC
 | 
			
		||||
  DISPLAY "Sottocategoria" CODTAB[3,4]
 | 
			
		||||
  PROMPT 2 1 "Sottocategoria 1 "
 | 
			
		||||
  USE &SCC 
 | 
			
		||||
  INPUT CODTAB FR_CCON01
 | 
			
		||||
  DISPLAY "Sottocategoria" CODTAB
 | 
			
		||||
  DISPLAY "Descrizione@50" S0
 | 
			
		||||
  OUTPUT FR_SCAACC CODTAB 
 | 
			
		||||
  FIELD CONSCACC
 | 
			
		||||
  OUTPUT  FR_CCON01 CODTAB 
 | 
			
		||||
  FIELD CCON(1)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER FR_PUNACC 13 5
 | 
			
		||||
NUMBER FR_PCON01 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 40 1 "Peso unitario "
 | 
			
		||||
  FIELD CONPUACC
 | 
			
		||||
  FIELD PCON(1)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING FR_SCAALL 4
 | 
			
		||||
STRING FR_CCON02 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 2 "Sottocategoria ALLUMINIO "
 | 
			
		||||
  USE &SCC SELECT CODTAB[1,2]=="AL"
 | 
			
		||||
  INPUT CODTAB FR_SCAALL
 | 
			
		||||
  COPY DISPLAY FR_SCAACC
 | 
			
		||||
  OUTPUT FR_SCAALL CODTAB 
 | 
			
		||||
  FIELD CONSCALL
 | 
			
		||||
  PROMPT 2 2 "Sottocategoria 2 "
 | 
			
		||||
  USE &SCC 
 | 
			
		||||
  INPUT CODTAB FR_CCON02
 | 
			
		||||
  COPY DISPLAY FR_CCON01
 | 
			
		||||
  OUTPUT FR_CCON02 CODTAB 
 | 
			
		||||
  FIELD CCON(2)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER FR_PUNALL 13 5
 | 
			
		||||
NUMBER FR_PCON02 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 40 2 "Peso unitario "
 | 
			
		||||
  FIELD CONPUALL
 | 
			
		||||
  FIELD PCON(2)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING FR_SCACAR 4
 | 
			
		||||
STRING FR_CCON03 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 3 "Sottocategoria CARTA     "
 | 
			
		||||
  USE &SCC SELECT CODTAB[1,2]=="CA"
 | 
			
		||||
  INPUT CODTAB FR_SCACAR
 | 
			
		||||
  COPY DISPLAY FR_SCAACC
 | 
			
		||||
  OUTPUT FR_SCACAR CODTAB 
 | 
			
		||||
  FIELD CONSCCAR
 | 
			
		||||
  PROMPT 2 3 "Sottocategoria 3 "
 | 
			
		||||
  USE &SCC
 | 
			
		||||
  INPUT CODTAB FR_CCON03
 | 
			
		||||
  COPY DISPLAY FR_CCON01
 | 
			
		||||
  OUTPUT FR_CCON03 CODTAB 
 | 
			
		||||
  FIELD  CCON(3)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER FR_PUNCAR 13 5
 | 
			
		||||
NUMBER FR_PCON03 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 40 3 "Peso unitario "
 | 
			
		||||
  FIELD CONPUCAR
 | 
			
		||||
  FIELD PCON(3)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING FR_SCAPLA 4
 | 
			
		||||
STRING FR_CCON04 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 4 "Sottocategoria PLASTICA  "
 | 
			
		||||
  PROMPT 2 4 "Sottocategoria 4 "
 | 
			
		||||
  USE &SCC SELECT CODTAB[1,2]=="PL"
 | 
			
		||||
  INPUT CODTAB FR_SCAPLA
 | 
			
		||||
  COPY DISPLAY FR_SCAACC
 | 
			
		||||
  OUTPUT FR_SCAPLA CODTAB 
 | 
			
		||||
  FIELD CONSCPLA
 | 
			
		||||
  INPUT CODTAB FR_CCON04
 | 
			
		||||
  COPY DISPLAY FR_CCON01
 | 
			
		||||
  OUTPUT FR_CCON04 CODTAB 
 | 
			
		||||
  FIELD CCON(4)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER FR_PUNPLA 13 5
 | 
			
		||||
NUMBER FR_PCON04 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 40 4 "Peso unitario "
 | 
			
		||||
  FIELD CONPUPLA
 | 
			
		||||
  FIELD PCON(4)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING FR_SCALEG 4
 | 
			
		||||
STRING FR_CCON05 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 5 "Sottocategoria LEGNO     "
 | 
			
		||||
  USE &SCC SELECT CODTAB[1,2]=="LE"
 | 
			
		||||
  INPUT CODTAB FR_SCALEG
 | 
			
		||||
  COPY DISPLAY FR_SCAACC
 | 
			
		||||
  OUTPUT FR_SCALEG CODTAB
 | 
			
		||||
  FIELD CONSCLEG
 | 
			
		||||
  PROMPT 2 5 "Sottocategoria 5 "
 | 
			
		||||
  USE &SCC 
 | 
			
		||||
  INPUT CODTAB FR_CCON05
 | 
			
		||||
  COPY DISPLAY FR_CCON01
 | 
			
		||||
  OUTPUT FR_CCON05 CODTAB
 | 
			
		||||
  FIELD CCON(5)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER FR_PUNLEG 13 5
 | 
			
		||||
NUMBER FR_PCON05 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 40 5 "Peso unitario "
 | 
			
		||||
  FIELD CONPULEG
 | 
			
		||||
  FIELD PCON(5)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING FR_SCAVET 4
 | 
			
		||||
STRING FR_CCON06 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 6 "Sottocategoria VETRO     "
 | 
			
		||||
  USE &SCC SELECT CODTAB[1,2]=="VE"
 | 
			
		||||
  INPUT CODTAB FR_SCAVET
 | 
			
		||||
  COPY DISPLAY FR_SCAACC
 | 
			
		||||
  OUTPUT FR_SCAVET CODTAB
 | 
			
		||||
  FIELD CONSCVET
 | 
			
		||||
  PROMPT 2 6 "Sottocategoria 6 "
 | 
			
		||||
  USE &SCC 
 | 
			
		||||
  INPUT CODTAB FR_CCON06
 | 
			
		||||
  COPY DISPLAY FR_CCON01
 | 
			
		||||
  OUTPUT FR_CCON06 CODTAB
 | 
			
		||||
  FIELD CCON(6)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER FR_PUNVET 13 5
 | 
			
		||||
NUMBER FR_PCON06 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 40 6 "Peso unitario "
 | 
			
		||||
  FIELD CONPUVET
 | 
			
		||||
  FIELD PCON(6)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING FR_CCON07 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 7 "Sottocategoria 7 "
 | 
			
		||||
  USE &SCC
 | 
			
		||||
  INPUT CODTAB FR_CCON07
 | 
			
		||||
  COPY DISPLAY FR_CCON01
 | 
			
		||||
  OUTPUT FR_CCON07 CODTAB
 | 
			
		||||
  FIELD CCON(7)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER FR_PCON07 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 40 7 "Peso unitario "
 | 
			
		||||
  FIELD PCON(7)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING FR_CCON08 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 8 "Sottocategoria 8 "
 | 
			
		||||
  USE &SCC 
 | 
			
		||||
  INPUT CODTAB FR_CCON08
 | 
			
		||||
  COPY DISPLAY FR_CCON01
 | 
			
		||||
  OUTPUT FR_CCON08 CODTAB
 | 
			
		||||
  FIELD CCON(8)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER FR_PCON08 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 40 8 "Peso unitario "
 | 
			
		||||
  FIELD PCON(8)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING FR_CCON09 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 9 "Sottocategoria 9 "
 | 
			
		||||
  USE &SCC
 | 
			
		||||
  INPUT CODTAB FR_CCON09
 | 
			
		||||
  COPY DISPLAY FR_CCON01
 | 
			
		||||
  OUTPUT FR_CCON09 CODTAB
 | 
			
		||||
  FIELD CCON(9)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER FR_PCON09 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 40 9 "Peso unitario "
 | 
			
		||||
  FIELD PCON(9)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING FR_CCON10 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 10 "Sottocategoria 10 "
 | 
			
		||||
  USE &SCC
 | 
			
		||||
  INPUT CODTAB FR_CCON10
 | 
			
		||||
  COPY DISPLAY FR_CCON01
 | 
			
		||||
  OUTPUT FR_CCON10 CODTAB
 | 
			
		||||
  FIELD CCON(10)
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER FR_PCON10 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 40 10 "Peso unitario "
 | 
			
		||||
  FIELD PCON(10)
 | 
			
		||||
END
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifndef FULL_SCREEN
 | 
			
		||||
ENDPAGE
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user