Patch level : 12.0 946
Files correlati : tp0.exe tp0100a.msk Commento : Aggiornato trasferimento Pack
This commit is contained in:
parent
d988f00bca
commit
3088322d2c
@ -291,6 +291,10 @@ long TPack_transfer::get_long(const char* field) const
|
|||||||
return recordset().get(field).as_int();
|
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)
|
const TString& TPack_transfer::decode_value(const char* tab, const TString& cod)
|
||||||
{
|
{
|
||||||
if (cod.full())
|
if (cod.full())
|
||||||
@ -482,7 +486,7 @@ void TTrasferimentoPack_mask::trasferisci()
|
|||||||
pc.set_custrif(get(F_RIF));
|
pc.set_custrif(get(F_RIF));
|
||||||
pc.set_ordrif(get(F_ORD));
|
pc.set_ordrif(get(F_ORD));
|
||||||
pc.activate_order_date(get_bool(F_ORDDATE));
|
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);
|
pc.init(TR("Documenti di trasporto"), query_header, log);
|
||||||
go_on = pc.trasferisci();
|
go_on = pc.trasferisci();
|
||||||
book.add(log);
|
book.add(log);
|
||||||
|
@ -73,7 +73,9 @@ public:
|
|||||||
|
|
||||||
const TString& get_str(const char* campo) const; // Get string from current recordset
|
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
|
const TString& get_real_str(const char* campo) const; // Get eventually empty string from numeric field
|
||||||
long get_long(const char* campo) const;
|
long get_long(const char* campo) const;
|
||||||
|
const real get_real(const char* campo) const;
|
||||||
|
|
||||||
|
|
||||||
bool write_enabled() const { return _write_enabled; }
|
bool write_enabled() const { return _write_enabled; }
|
||||||
|
|
||||||
|
@ -25,5 +25,6 @@
|
|||||||
#define F_RIF 218
|
#define F_RIF 218
|
||||||
#define F_ORD 219
|
#define F_ORD 219
|
||||||
#define F_ORDDATE 220
|
#define F_ORDDATE 220
|
||||||
|
#define F_SCHEMA 221
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -87,64 +87,71 @@ BEGIN
|
|||||||
FLAGS "*"
|
FLAGS "*"
|
||||||
END
|
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
|
GROUPBOX DLG_NULL 78 16
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 6 "@bDocumenti di trasporto"
|
PROMPT 1 7 "@bDocumenti di trasporto"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_CUSTREF
|
BOOLEAN F_CUSTREF
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 7 "Inserire riferimenti cliente nelle righe di descrizione"
|
PROMPT 2 8 "Inserire riferimenti cliente nelle righe di descrizione"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_PAPER
|
BOOLEAN F_PAPER
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 8 "Inserire formato carta nella descrizione aggiuntiva"
|
PROMPT 2 9 "Inserire formato carta nella descrizione aggiuntiva"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_SIZE
|
BOOLEAN F_SIZE
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 9 "Inserire dimensioni articolo nella descrizione aggiuntiva"
|
PROMPT 2 10 "Inserire dimensioni articolo nella descrizione aggiuntiva"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_REFINFO
|
BOOLEAN F_REFINFO
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 10 "Inserire riferimenti cliente nella descrizione aggiuntiva"
|
PROMPT 2 11 "Inserire riferimenti cliente nella descrizione aggiuntiva"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_CMSREF
|
BOOLEAN F_CMSREF
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 11 "Inserire riferimenti cliente nel campo CODCMS"
|
PROMPT 2 12 "Inserire riferimenti cliente nel campo CODCMS"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_CUSTCODE
|
BOOLEAN F_CUSTCODE
|
||||||
BEGIN
|
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
|
END
|
||||||
|
|
||||||
BOOLEAN F_ORDPAPER
|
BOOLEAN F_ORDPAPER
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 13 "Descrizione articoli come da eventuale ordine"
|
PROMPT 2 14 "Descrizione articoli come da eventuale ordine"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_DISCOUNT
|
BOOLEAN F_DISCOUNT
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 14 "Gestione sconti di riga multipli"
|
PROMPT 2 15 "Gestione sconti di riga multipli"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_RIF 20
|
STRING F_RIF 20
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 16 "Vostro rifermento "
|
PROMPT 2 17 "Vostro rifermento "
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_ORD 20
|
STRING F_ORD 20
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 18 "Riferimento ordine "
|
PROMPT 2 19 "Riferimento ordine "
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_ORDDATE
|
BOOLEAN F_ORDDATE
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 20 "Data nel riferimento ordine"
|
PROMPT 2 21 "Data nel riferimento ordine"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// Assegna sottocategoria e peso di una classe CONAI solo se non vuoti
|
// Assegna sottocategoria e peso di una classe CONAI solo se non vuoti
|
||||||
bool TArticolo_pack::set_conai(const TString& scat, const real& weight)
|
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)
|
if (ok)
|
||||||
{
|
{
|
||||||
@ -130,36 +130,33 @@ int TCache_art::get_extra_info(const char* key, TArticolo_pack& art)
|
|||||||
{
|
{
|
||||||
const TString& sc = envtax.get(0u).as_string();
|
const TString& sc = envtax.get(0u).as_string();
|
||||||
const real wkg = envtax.get(1).as_real();
|
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);
|
||||||
TRecord_array conart(article_code, LF_CONART);
|
int r = 1;
|
||||||
TRectype conrec(LF_CONART);
|
|
||||||
int r = 1;
|
|
||||||
|
|
||||||
conart.destroy_rows();
|
conart.destroy_rows();
|
||||||
// Infine salvo i nuovi dati in conart
|
// Infine salvo i nuovi dati in conart
|
||||||
for (int i = 0; i < FR_CMAX; i++)
|
for (int i = 0; i < FR_CMAX; i++)
|
||||||
|
{
|
||||||
|
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() && peso != ZERO)
|
||||||
{
|
{
|
||||||
const TString4 sotcat = art.conai_subclass(i);
|
conrec.zero();
|
||||||
const real peso = art.conai_weight(i); // Faccio i confronti su stringa per evitare decimali impazziti
|
conrec.put(CONART_CODART, article_code);
|
||||||
|
conrec.put(CONART_NRIGA, r++);
|
||||||
if (sotcat.full())
|
conrec.put(CONART_CATEGORIA, sotcat.left(2));
|
||||||
{
|
conrec.put(CONART_SOTTOCAT, sotcat.mid(2));
|
||||||
conrec.zero();
|
conrec.put(CONART_PESO, peso);
|
||||||
conrec.put(CONART_CODART, article_code);
|
conart.add_row(conrec);
|
||||||
conrec.put(CONART_NRIGA, r++);
|
|
||||||
conrec.put(CONART_CATEGORIA, sotcat.left(2));
|
|
||||||
conrec.put(CONART_SOTTOCAT, sotcat.mid(2));
|
|
||||||
conrec.put(CONART_PESO, peso);
|
|
||||||
conart.add_row(conrec);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
conart.write(true);
|
|
||||||
}
|
}
|
||||||
|
conart.write(true);
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@ -822,110 +819,73 @@ bool TPack_ddt::trasferisci()
|
|||||||
const TRectype& cfven = cache().get(LF_CFVEN, tok);
|
const TRectype& cfven = cache().get(LF_CFVEN, tok);
|
||||||
|
|
||||||
// Copia tutte le sottocategorie CONAI dall'anagrafica alla riga documento
|
// 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 int conai_scheme = get_conai();
|
||||||
const TString4 conai_subclass = get_str("SubclassCode");
|
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);
|
||||||
|
|
||||||
|
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 *)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 (cache().get("&VECSS", conai_subclass).empty())
|
|
||||||
log_message(format(TR("Bolla %ld - Articolo %s - Sottocategoria %s assente"),
|
|
||||||
ndoc, (const char *) (rowtype == "01" ? codart : custcode),
|
|
||||||
(const char *) conai_subclass));
|
|
||||||
if (conai_scheme == 1)
|
if (conai_scheme == 1)
|
||||||
{
|
{
|
||||||
// La sottocategoria della bolla prevale su quella anagrafica
|
if (conai_subclass.full() && peso_imballo != ZERO)
|
||||||
int i = 0;
|
|
||||||
if (conai_subclass.len() == 4)
|
|
||||||
{
|
{
|
||||||
|
// 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 *)conai_subclass));
|
||||||
rdoc.put(conai_sottocat_name(1), conai_subclass);
|
rdoc.put(conai_sottocat_name(1), conai_subclass);
|
||||||
peso_imballo_ddt = real(get_real_str("WeightETUnit"));
|
rdoc.put(conai_peso_name(1), peso_imballo); // ex QTAGG1
|
||||||
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())
|
|
||||||
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++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 1; i < FR_CMAX; i++)
|
// Arrotondo la eventuale differenza di pesi al grammo
|
||||||
|
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 <= sottocat_anamag.items(); i++)
|
||||||
{
|
{
|
||||||
const TString& cs = art.conai_subclass(i - 1); // Codice sottocategoria su ANAMAG
|
const TString & cs = sottocat_anamag.row(i - 1); // Codice sottocategoria su ANAMAG
|
||||||
|
const TString cat = cs.left(2); // Codice categoria su ANAMAG
|
||||||
if (cs.full()) // la presenza della sottoclasse implica anche un peso positivo
|
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)
|
||||||
{
|
{
|
||||||
const real& weight = art.conai_weight(i - 1); // Peso imballo su ANAMAG
|
rdoc.put(conai_sottocat_name(i), cs);
|
||||||
|
rdoc.put(conai_peso_name(i), weight); // ex QTAGG1
|
||||||
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
|
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);
|
||||||
// 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);
|
|
||||||
|
|
||||||
for (int i = 1; i < FR_CMAX; i++)
|
rdoc.put(esenzione_name_rdoc, cfven.get(esenzione_name_cfven)); // ex QTAGG2
|
||||||
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
|
|
||||||
{
|
|
||||||
// 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));
|
|
||||||
}
|
|
||||||
|
|
||||||
rdoc.put("FAMILY", get_str("FamilyCode")); // Uso campo virtuale RG1:FAMILY
|
rdoc.put("FAMILY", get_str("FamilyCode")); // Uso campo virtuale RG1:FAMILY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user