Merge remote-tracking branch 'origin/R_10_00' into R_10_00
This commit is contained in:
		
						commit
						1e89bb2f40
					
				
							
								
								
									
										3
									
								
								cd/test/sc0946.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								cd/test/sc0946.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
sc0.exe
 | 
			
		||||
 | 
			
		||||
Aggiunta la possibiltà di pareggiare anche note di credito parzialmente pagate
 | 
			
		||||
							
								
								
									
										21
									
								
								cd/test/sc0946a.ini
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								cd/test/sc0946a.ini
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
[Main]
 | 
			
		||||
Demo=0
 | 
			
		||||
 | 
			
		||||
[sc0]
 | 
			
		||||
File(0) = sc0.exe|X
 | 
			
		||||
Patch = 0946
 | 
			
		||||
Versione = 21511200
 | 
			
		||||
 | 
			
		||||
[sc]
 | 
			
		||||
Data = 18-02-2020
 | 
			
		||||
Descrizione = Saldaconto
 | 
			
		||||
Dischi = 1
 | 
			
		||||
Moduli = ba,cg
 | 
			
		||||
OEM = 
 | 
			
		||||
Patch = 946
 | 
			
		||||
PostProcess = 
 | 
			
		||||
PreProcess = 
 | 
			
		||||
Prezzo(1) = 
 | 
			
		||||
Prezzo(2) = 
 | 
			
		||||
Versione = 21511200
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								cd/test/sc0946a1.zip
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								cd/test/sc0946a1.zip
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										4
									
								
								cd/test/tp0946.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								cd/test/tp0946.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
tp0.exe
 | 
			
		||||
tp0100a.msk
 | 
			
		||||
 | 
			
		||||
Aggiornato trasferimento Pack
 | 
			
		||||
							
								
								
									
										22
									
								
								cd/test/tp0946a.ini
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								cd/test/tp0946a.ini
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
			
		||||
[Main]
 | 
			
		||||
Demo=0
 | 
			
		||||
 | 
			
		||||
[tp1]
 | 
			
		||||
File(0) = tp0.exe|X
 | 
			
		||||
File(2) = tp0100a.msk|X
 | 
			
		||||
Patch = 0946
 | 
			
		||||
Versione = 21511200
 | 
			
		||||
 | 
			
		||||
[tp]
 | 
			
		||||
Data = 18-02-2020
 | 
			
		||||
Descrizione = Trasferimento PACK
 | 
			
		||||
Dischi = 1
 | 
			
		||||
Moduli = ve
 | 
			
		||||
OEM = 
 | 
			
		||||
Patch = 946
 | 
			
		||||
PostProcess = 
 | 
			
		||||
PreProcess = 
 | 
			
		||||
Prezzo(1) = 
 | 
			
		||||
Prezzo(2) = 
 | 
			
		||||
Versione = 21511200
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								cd/test/tp0946a1.zip
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								cd/test/tp0946a1.zip
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@ -631,6 +631,7 @@ static bool is_sirio_station(const char* hostname)
 | 
			
		||||
		"ARCHIMEDE",				// Alessandro
 | 
			
		||||
		"SIRIOCOMP",
 | 
			
		||||
		"NBK_SPALACINO_A",	// Simone
 | 
			
		||||
		"NBKPEREGOW8",      // Stefano
 | 
			
		||||
		NULL
 | 
			
		||||
	};
 | 
			
		||||
  for (int i = 0; ranger[i]; i++)
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,6 @@ protected:
 | 
			
		||||
public:
 | 
			
		||||
  bool init(const TBill& bill, const TString& valuta, bool nc, int stato); // Stato: 1=aperte; 2=chiuse; 0 o 3 = tutte
 | 
			
		||||
  TPartita& partita(const TRectype& rec) const;
 | 
			
		||||
  bool is_lonely_pag(const TRectype& rec) const;
 | 
			
		||||
  const TRectype* node2rec(const TString& id);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -36,24 +35,6 @@ TPartita& TPareggio_tree::partita(const TRectype& rec) const
 | 
			
		||||
  return ((TPartite_array&)_games).partita(rec);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Controlla se rec è una riga di tipo nota credito non associata a nessuna scadenza in una partita a sè stante
 | 
			
		||||
bool TPareggio_tree::is_lonely_pag(const TRectype& rec) const
 | 
			
		||||
{
 | 
			
		||||
  const tipo_movimento tm = (tipo_movimento)rec.get_int(PART_TIPOMOV);
 | 
			
		||||
  if (tm == tm_fattura) 
 | 
			
		||||
    return false;
 | 
			
		||||
 | 
			
		||||
  const TPartita& part = partita(rec);
 | 
			
		||||
  for (int r = part.last(); r > 0; r = part.pred(r))
 | 
			
		||||
  {
 | 
			
		||||
    const tipo_movimento tm = part.riga(r).tipo();
 | 
			
		||||
    if (tm <= tm_fattura || tm >= tm_insoluto)
 | 
			
		||||
      return false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const TRectype* TPareggio_tree::node2rec(const TString& id) 
 | 
			
		||||
{
 | 
			
		||||
  const TRectype* rec = NULL;
 | 
			
		||||
@ -285,7 +266,7 @@ bool TPareggio_tree::init(const TBill& bill, const TString& valuta, bool nc, int
 | 
			
		||||
      {
 | 
			
		||||
        const int nriga = rec.get_int(PART_NRIGA);
 | 
			
		||||
        const TPartita& game = partita(rec);
 | 
			
		||||
        add_riga = ((TPartita&)game).unassigned().exist(nriga) && is_lonely_pag(rec);
 | 
			
		||||
				add_riga = ((TPartita&)game).unassigned().exist(nriga);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
 | 
			
		||||
@ -291,6 +291,10 @@ long TPack_transfer::get_long(const char* field) const
 | 
			
		||||
  return recordset().get(field).as_int();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const real  TPack_transfer::get_real(const char* campo) const
 | 
			
		||||
{
 | 
			
		||||
	return recordset().get(campo).as_real();
 | 
			
		||||
}
 | 
			
		||||
const TString& TPack_transfer::decode_value(const char* tab, const TString& cod)
 | 
			
		||||
{
 | 
			
		||||
  if (cod.full())
 | 
			
		||||
@ -482,7 +486,7 @@ void TTrasferimentoPack_mask::trasferisci()
 | 
			
		||||
    pc.set_custrif(get(F_RIF));
 | 
			
		||||
    pc.set_ordrif(get(F_ORD));
 | 
			
		||||
    pc.activate_order_date(get_bool(F_ORDDATE));
 | 
			
		||||
		pc.activate_conai(ini_get_int(CONFIG_DITTA, "tp", "ConaiScheme", 0));
 | 
			
		||||
		pc.activate_conai(get_int(F_SCHEMA));
 | 
			
		||||
    pc.init(TR("Documenti di trasporto"), query_header, log);
 | 
			
		||||
    go_on = pc.trasferisci();
 | 
			
		||||
    book.add(log);
 | 
			
		||||
 | 
			
		||||
@ -74,6 +74,8 @@ public:
 | 
			
		||||
  const TString& get_str(const char* campo) const;       // Get string from current recordset
 | 
			
		||||
  const TString& get_real_str(const char* campo) const;  // Get eventually empty string from numeric field
 | 
			
		||||
	long get_long(const char* campo) const;
 | 
			
		||||
	const real get_real(const char* campo) const;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  bool write_enabled() const { return _write_enabled; }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
@ -25,5 +25,6 @@
 | 
			
		||||
#define F_RIF       218
 | 
			
		||||
#define F_ORD       219
 | 
			
		||||
#define F_ORDDATE   220
 | 
			
		||||
#define F_SCHEMA	  221
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -87,64 +87,71 @@ BEGIN
 | 
			
		||||
  FLAGS "*"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
LISTBOX F_SCHEMA 1 36
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 6 "Schema CONAI "
 | 
			
		||||
  ITEM "1|Sottocategoria e peso da bolla"
 | 
			
		||||
  ITEM "2|Sottocategoria e peso da articolo"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
GROUPBOX DLG_NULL 78 16
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 1 6 "@bDocumenti di trasporto"
 | 
			
		||||
  PROMPT 1 7 "@bDocumenti di trasporto"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BOOLEAN F_CUSTREF
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 7 "Inserire riferimenti cliente nelle righe di descrizione"
 | 
			
		||||
  PROMPT 2 8 "Inserire riferimenti cliente nelle righe di descrizione"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BOOLEAN F_PAPER
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 8 "Inserire formato carta nella descrizione aggiuntiva"
 | 
			
		||||
  PROMPT 2 9 "Inserire formato carta nella descrizione aggiuntiva"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BOOLEAN F_SIZE
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 9 "Inserire dimensioni articolo nella descrizione aggiuntiva"
 | 
			
		||||
  PROMPT 2 10 "Inserire dimensioni articolo nella descrizione aggiuntiva"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BOOLEAN F_REFINFO
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 10 "Inserire riferimenti cliente nella descrizione aggiuntiva"
 | 
			
		||||
  PROMPT 2 11 "Inserire riferimenti cliente nella descrizione aggiuntiva"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BOOLEAN F_CMSREF
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 11 "Inserire riferimenti cliente nel campo CODCMS"
 | 
			
		||||
  PROMPT 2 12 "Inserire riferimenti cliente nel campo CODCMS"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BOOLEAN F_CUSTCODE
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 12 "Utilizzare il codice articolo del cliente (Richiede tipo riga 14)"
 | 
			
		||||
  PROMPT 2 13 "Utilizzare il codice articolo del cliente (Richiede tipo riga 14)"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BOOLEAN F_ORDPAPER
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 13 "Descrizione articoli come da eventuale ordine"
 | 
			
		||||
  PROMPT 2 14 "Descrizione articoli come da eventuale ordine"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BOOLEAN F_DISCOUNT
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 14 "Gestione sconti di riga multipli"
 | 
			
		||||
  PROMPT 2 15 "Gestione sconti di riga multipli"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING F_RIF 20
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 16 "Vostro rifermento  "
 | 
			
		||||
  PROMPT 2 17 "Vostro rifermento  "
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING F_ORD 20
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 18 "Riferimento ordine "
 | 
			
		||||
  PROMPT 2 19 "Riferimento ordine "
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BOOLEAN F_ORDDATE
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 20 "Data nel riferimento ordine"
 | 
			
		||||
  PROMPT 2 21 "Data nel riferimento ordine"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@
 | 
			
		||||
// Assegna sottocategoria e peso di una classe CONAI solo se non vuoti
 | 
			
		||||
bool TArticolo_pack::set_conai(const TString& scat, const real& weight)
 | 
			
		||||
{
 | 
			
		||||
	const bool ok = scat.full(); // && !weight.is_zero();
 | 
			
		||||
	const bool ok = scat.full() && weight != ZERO;
 | 
			
		||||
 | 
			
		||||
	if (ok)
 | 
			
		||||
  {
 | 
			
		||||
@ -130,12 +130,10 @@ int TCache_art::get_extra_info(const char* key, TArticolo_pack& art)
 | 
			
		||||
    {
 | 
			
		||||
      const TString& sc = envtax.get(0u).as_string();
 | 
			
		||||
      const real wkg = envtax.get(1).as_real();
 | 
			
		||||
      if (art.set_conai(sc, wkg))
 | 
			
		||||
        info = 2;
 | 
			
		||||
 | 
			
		||||
			art.set_conai(sc, wkg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (info == 2) // Ho trovato dati sul CONAI
 | 
			
		||||
    {
 | 
			
		||||
		TRecord_array conart(article_code, LF_CONART);
 | 
			
		||||
		TRectype conrec(LF_CONART);
 | 
			
		||||
		int r = 1;
 | 
			
		||||
@ -147,7 +145,7 @@ int TCache_art::get_extra_info(const char* key, TArticolo_pack& art)
 | 
			
		||||
			const TString4 sotcat = art.conai_subclass(i);
 | 
			
		||||
      const real peso = art.conai_weight(i); // Faccio i confronti su stringa per evitare decimali impazziti
 | 
			
		||||
 | 
			
		||||
				if (sotcat.full())
 | 
			
		||||
			if (sotcat.full() && peso != ZERO)
 | 
			
		||||
			{
 | 
			
		||||
				conrec.zero();
 | 
			
		||||
				conrec.put(CONART_CODART, article_code);
 | 
			
		||||
@ -160,7 +158,6 @@ int TCache_art::get_extra_info(const char* key, TArticolo_pack& art)
 | 
			
		||||
		}
 | 
			
		||||
		conart.write(true);
 | 
			
		||||
  }  
 | 
			
		||||
  }  
 | 
			
		||||
  return info;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -609,13 +606,14 @@ bool TPack_ddt::trasferisci()
 | 
			
		||||
  TString str;        // jolly
 | 
			
		||||
 | 
			
		||||
  TString last_custref;
 | 
			
		||||
	TDate last_datadoc;
 | 
			
		||||
 | 
			
		||||
  TPack_iterator ri(this);
 | 
			
		||||
  while (++ri)
 | 
			
		||||
  {
 | 
			
		||||
    const long code = get_long("DocCode");
 | 
			
		||||
    const long ndoc = get_long("DocRefNumber");
 | 
			
		||||
    const TDate datadoc = recset.get("DocDate").as_date();
 | 
			
		||||
    TDate datadoc = recset.get("DocDate").as_date();
 | 
			
		||||
    
 | 
			
		||||
    if (_data_limite.ok() && datadoc > _data_limite)
 | 
			
		||||
      continue;
 | 
			
		||||
@ -634,6 +632,11 @@ bool TPack_ddt::trasferisci()
 | 
			
		||||
      TString4 codnum, tipodoc;
 | 
			
		||||
      get_tipodoc(codnum, tipodoc);
 | 
			
		||||
 | 
			
		||||
			if (!datadoc.ok())
 | 
			
		||||
				datadoc = last_datadoc;
 | 
			
		||||
			else
 | 
			
		||||
				last_datadoc = datadoc;
 | 
			
		||||
 | 
			
		||||
      doc = new TDocumento('D', datadoc.year(), codnum, ndoc);
 | 
			
		||||
      const bool isnew = doc->rows() == 0;
 | 
			
		||||
      if (isnew)
 | 
			
		||||
@ -822,110 +825,73 @@ bool TPack_ddt::trasferisci()
 | 
			
		||||
      const TRectype& cfven = cache().get(LF_CFVEN, tok);
 | 
			
		||||
 | 
			
		||||
      // Copia tutte le sottocategorie CONAI dall'anagrafica alla riga documento
 | 
			
		||||
			real peso_imballo_anamag;
 | 
			
		||||
			real peso_imballo_ddt;
 | 
			
		||||
			int pesi_anamag = 0;
 | 
			
		||||
			const int conai_scheme = get_conai();
 | 
			
		||||
			const TString4 conai_subclass = get_str("SubclassCode");
 | 
			
		||||
			const TCONAI_class ct = conai_str2class(conai_subclass);
 | 
			
		||||
			real peso_imballo = get_real("WeightETUnit");
 | 
			
		||||
			real peso_imballo_anamag;
 | 
			
		||||
			TString_array sottocat_anamag;
 | 
			
		||||
			TArray pesi_anamag;
 | 
			
		||||
			TGeneric_distrib pesi_bolla(peso_imballo, 3);
 | 
			
		||||
 | 
			
		||||
			if (cache().get("&VECSS", conai_subclass).empty())
 | 
			
		||||
			for (int i = 1; i < FR_CMAX; i++)
 | 
			
		||||
			{
 | 
			
		||||
				const TString& cs = art.conai_subclass(i - 1);  // Codice sottocategoria su ANAMAG
 | 
			
		||||
				const real& weight = art.conai_weight(i - 1); // Peso imballo su ANAMAG
 | 
			
		||||
 | 
			
		||||
				if (cs.full() && weight != ZERO)
 | 
			
		||||
				{
 | 
			
		||||
					if (cache().get("&VECSS", cs).empty())
 | 
			
		||||
						log_message(format(TR("Bolla %ld - Articolo %s - Sottocategoria %s assente"),
 | 
			
		||||
					        ndoc, (const char *) (rowtype == "01" ? codart : custcode),
 | 
			
		||||
									(const char *) conai_subclass));
 | 
			
		||||
							ndoc, (const char *)(rowtype == "01" ? codart : custcode), (const char *)cs));
 | 
			
		||||
 | 
			
		||||
					sottocat_anamag.add(cs);
 | 
			
		||||
					pesi_anamag.add(weight);
 | 
			
		||||
					pesi_bolla.add(weight);
 | 
			
		||||
					peso_imballo_anamag += weight;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (peso_imballo == ZERO)
 | 
			
		||||
				peso_imballo = peso_imballo_anamag;
 | 
			
		||||
 | 
			
		||||
			if (conai_scheme == 1)
 | 
			
		||||
			{
 | 
			
		||||
			// La sottocategoria della bolla prevale su quella anagrafica
 | 
			
		||||
				int i = 0;
 | 
			
		||||
				if (conai_subclass.len() == 4)
 | 
			
		||||
				if (conai_subclass.full() && peso_imballo != ZERO)
 | 
			
		||||
				{
 | 
			
		||||
					rdoc.put(conai_sottocat_name(1), conai_subclass);
 | 
			
		||||
					peso_imballo_ddt = real(get_real_str("WeightETUnit"));
 | 
			
		||||
					if (peso_imballo_ddt.is_zero())
 | 
			
		||||
						peso_imballo_ddt = peso_imballo_anamag;
 | 
			
		||||
				}
 | 
			
		||||
				if (conai_subclass.blank())
 | 
			
		||||
				{
 | 
			
		||||
					for (int i = 1; i < FR_CMAX; i++)
 | 
			
		||||
					{
 | 
			
		||||
						const TString& cs = art.conai_subclass(i - 1);  // Codice sottocategoria su ANAMAG
 | 
			
		||||
 | 
			
		||||
						if (cache().get("&VECSS", cs).empty())
 | 
			
		||||
					// La sottocategoria della bolla prevale su quella anagrafica schema 1
 | 
			
		||||
					if (cache().get("&VESCC", conai_subclass).empty())
 | 
			
		||||
						log_message(format(TR("Bolla %ld - Articolo %s - Sottocategoria %s assente"),
 | 
			
		||||
								        ndoc, (const char *)(rowtype == "01" ? codart : custcode), 
 | 
			
		||||
								        (const char *)cs));
 | 
			
		||||
						
 | 
			
		||||
						if (cs.full()) // la presenza della sottoclasse implica anche un peso positivo
 | 
			
		||||
						{
 | 
			
		||||
							const real& weight = art.conai_weight(i - 1); // Peso imballo su ANAMAG
 | 
			
		||||
 | 
			
		||||
							rdoc.put(conai_sottocat_name(i + 1), cs);
 | 
			
		||||
							rdoc.put(conai_peso_name(i + 1), weight);      // ex QTAGG1  
 | 
			
		||||
							rdoc.put(conai_esenzione_name(conai_str2class(cs.left(2)), LF_RIGHEDOC),
 | 
			
		||||
											 cfven.get(conai_esenzione_name(conai_str2class(cs.left(2)), LF_CFVEN))); // ex QTAGG2
 | 
			
		||||
							peso_imballo_anamag += weight;
 | 
			
		||||
							pesi_anamag++;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
							ndoc, (const char *)(rowtype == "01" ? codart : custcode), (const char *)conai_subclass));
 | 
			
		||||
					rdoc.put(conai_sottocat_name(1), conai_subclass);
 | 
			
		||||
					rdoc.put(conai_peso_name(1), peso_imballo);      // ex QTAGG1
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				for (int i = 1; i < FR_CMAX; i++)
 | 
			
		||||
				{
 | 
			
		||||
					const TString& cs = art.conai_subclass(i - 1);  // Codice sottocategoria su ANAMAG
 | 
			
		||||
					
 | 
			
		||||
					if (cs.full()) // la presenza della sottoclasse implica anche un peso positivo
 | 
			
		||||
					{
 | 
			
		||||
						const real& weight = art.conai_weight(i - 1); // Peso imballo su ANAMAG
 | 
			
		||||
 | 
			
		||||
						if (cache().get("&VECSS", cs).empty())
 | 
			
		||||
							log_message(format(TR("Bolla %ld - Articolo %s - Sottocategoria %s assente"),
 | 
			
		||||
								               ndoc, (const char *)(rowtype == "01" ? codart : custcode),
 | 
			
		||||
								               (const char *)cs));
 | 
			
		||||
 | 
			
		||||
						rdoc.put(conai_sottocat_name(i + 1), cs);
 | 
			
		||||
						rdoc.put(conai_peso_name(i + 1), weight);      // ex QTAGG1  
 | 
			
		||||
						rdoc.put(conai_esenzione_name(conai_str2class(cs.left(2)), LF_RIGHEDOC),
 | 
			
		||||
										 cfven.get(conai_esenzione_name(conai_str2class(cs.left(2)), LF_CFVEN))); // ex QTAGG2
 | 
			
		||||
						peso_imballo_anamag += weight;
 | 
			
		||||
						pesi_anamag++;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			// La sottocategoria della bolla prevale su quella anagrafica impostata sopra
 | 
			
		||||
				if (conai_subclass.len() == 4)
 | 
			
		||||
				{
 | 
			
		||||
					rdoc.put(conai_sottocat_name(1), conai_subclass);
 | 
			
		||||
					peso_imballo_ddt = real(get_real_str("WeightETUnit"));
 | 
			
		||||
					if (peso_imballo_ddt.is_zero())
 | 
			
		||||
						peso_imballo_ddt = peso_imballo_anamag;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
 //     if (pesi_anamag > 1) // Con imballi composti da vari materiali devo riportare o riproporzionare
 | 
			
		||||
//      {
 | 
			
		||||
				// Arrotondo la eventuale differenza di pesi al grammo
 | 
			
		||||
        real diff = peso_imballo_ddt - peso_imballo_anamag; diff.round(3);
 | 
			
		||||
        // Il peso in bolla e' diverso da quello in anagrafica: devo riproporzionarli
 | 
			
		||||
        if (!diff.is_zero() && !peso_imballo_ddt.is_zero())
 | 
			
		||||
        {
 | 
			
		||||
          TGeneric_distrib d(peso_imballo_ddt, 3);
 | 
			
		||||
				real diff = peso_imballo - peso_imballo_anamag; diff.round(3);
 | 
			
		||||
				// Il peso in bolla e' diverso da quello in anagrafica: devo riproporzionarlo
 | 
			
		||||
				const bool riproporziona_pesi_da_bolla = (diff != ZERO);
 | 
			
		||||
				const bool multi_imballo = (pesi_anamag.items() > 1);
 | 
			
		||||
 | 
			
		||||
					for (int i = 1; i < FR_CMAX; i++)
 | 
			
		||||
						if (rdoc.get(conai_sottocat_name(i + 1)).full())
 | 
			
		||||
							d.add(art.conai_weight(i - 1));
 | 
			
		||||
					for (int i = 1; i < FR_CMAX; i++)
 | 
			
		||||
						if (rdoc.get(conai_sottocat_name(i + 1)).full())
 | 
			
		||||
							rdoc.put(conai_peso_name(i - 1), d.get());
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
				for (int i = 1; i <= sottocat_anamag.items(); i++)
 | 
			
		||||
				{
 | 
			
		||||
          // Il peso in bolla coincide con quello in anagrafica: devo riportarli
 | 
			
		||||
					for (int i = 0; i < FR_CMAX; i++)
 | 
			
		||||
						if (rdoc.get(conai_sottocat_name(i + 1)).full())
 | 
			
		||||
							rdoc.put(conai_peso_name(i + 1), art.conai_weight(i));
 | 
			
		||||
					const TString & cs = sottocat_anamag.row(i - 1);  // Codice sottocategoria su ANAMAG
 | 
			
		||||
					const TString cat = cs.left(2);  // Codice categoria su ANAMAG
 | 
			
		||||
					const real& weight =  riproporziona_pesi_da_bolla ? pesi_bolla.get() : (real &) pesi_anamag[i - 1]; // Peso imballo da bolla o da ANAMAG
 | 
			
		||||
 | 
			
		||||
					if (cs.full() && weight != ZERO)
 | 
			
		||||
					{
 | 
			
		||||
						rdoc.put(conai_sottocat_name(i), cs);
 | 
			
		||||
						rdoc.put(conai_peso_name(i), weight);      // ex QTAGG1  
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				const TString esenzione_name_rdoc = conai_esenzione_name(conai_str2class(conai_subclass.left(2)), LF_RIGHEDOC);
 | 
			
		||||
				const TString esenzione_name_cfven = conai_esenzione_name(conai_str2class(conai_subclass.left(2)), LF_CFVEN);
 | 
			
		||||
 | 
			
		||||
				rdoc.put(esenzione_name_rdoc, cfven.get(esenzione_name_cfven)); // ex QTAGG2
 | 
			
		||||
			}     
 | 
			
		||||
      rdoc.put("FAMILY", get_str("FamilyCode")); // Uso campo virtuale RG1:FAMILY
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user