Patch level : 10.0
Files correlati : ve0.exe Ricompilazione Demo : [ ] Commento : Corretta gestione degli articoli il cui imballo sia costituito da materiali diversi come categoria CONAI git-svn-id: svn://10.65.10.50/trunk@19379 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2ab4a131ad
commit
83fec07a39
@ -1,14 +1,6 @@
|
|||||||
#include <tabutil.h>
|
|
||||||
|
|
||||||
#include "velib.h"
|
|
||||||
#include "sconti.h"
|
#include "sconti.h"
|
||||||
#include "vepriv.h"
|
#include "vepriv.h"
|
||||||
#include "verig.h"
|
|
||||||
#include "../ca/commesse.h"
|
#include "../ca/commesse.h"
|
||||||
#include "../mg/mglib.h"
|
|
||||||
|
|
||||||
#include "rdoc.h"
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Tipo riga di un documento
|
// Tipo riga di un documento
|
||||||
@ -201,7 +193,7 @@ const TTipo_riga_documento& TRiga_documento::tipo() const
|
|||||||
TTable tri("%TRI"); // Tabella dei tipi riga
|
TTable tri("%TRI"); // Tabella dei tipi riga
|
||||||
for (tri.first(); !tri.eof(); tri.next())
|
for (tri.first(); !tri.eof(); tri.next())
|
||||||
{
|
{
|
||||||
const TString16 codice = tri.get("CODTAB");
|
const TString4 codice = tri.get("CODTAB");
|
||||||
_tipi.add(codice, new TTipo_riga_documento(tri.curr()));
|
_tipi.add(codice, new TTipo_riga_documento(tri.curr()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -787,6 +779,8 @@ real TRiga_documento::qtaresidua_mag() const
|
|||||||
return ZERO;
|
return ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Converte un codice categoria o sottocategoria (avente la categoria come prefisso)
|
||||||
|
// nell'identificatore interno della classe CONAI nel range [0,5]
|
||||||
TCONAI_class conai_str2class(const char* code)
|
TCONAI_class conai_str2class(const char* code)
|
||||||
{
|
{
|
||||||
TCONAI_class ct = CONAI_NONE;
|
TCONAI_class ct = CONAI_NONE;
|
||||||
@ -822,22 +816,38 @@ bool conai_configured_class(TCONAI_class cc)
|
|||||||
if (__con_conf == NULL)
|
if (__con_conf == NULL)
|
||||||
{
|
{
|
||||||
__con_conf = new bool[CONAI_CLASSES];
|
__con_conf = new bool[CONAI_CLASSES];
|
||||||
const char* const __conai_conf_names[CONAI_CLASSES] = {"CONFACC", "CONFALL", "CONFCAR", "CONFPLA", "CONFLEG", "CONFVET"};
|
const char* const __conai_suffixes[CONAI_CLASSES] = { "ACC", "ALL", "CAR", "PLA", "LEG", "VET" };
|
||||||
TConfig c(CONFIG_DITTA, "ve");
|
TConfig c(CONFIG_DITTA, "ve");
|
||||||
|
TString8 name_conf, name_cods;
|
||||||
FOR_EACH_CONAI_CLASS(i)
|
FOR_EACH_CONAI_CLASS(i)
|
||||||
__con_conf[i] = c.get_bool(__conai_conf_names[i]);
|
{
|
||||||
|
name_conf.cut(0) << "CONF" << __conai_suffixes[i];
|
||||||
|
bool yes = c.get_bool(name_conf);
|
||||||
|
if (!yes)
|
||||||
|
{
|
||||||
|
name_cods.cut(0) << "COD" << __conai_suffixes[i];
|
||||||
|
yes = c.get(name_cods).full();
|
||||||
|
if (yes)
|
||||||
|
c.set(name_conf, yes);
|
||||||
|
}
|
||||||
|
__con_conf[i] = yes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cc>=CONAI_FIRST && cc<=CONAI_LAST && __con_conf[cc];
|
return cc>=CONAI_FIRST && cc<=CONAI_LAST && __con_conf[cc];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Campi virtuali per peso CONAI su RDOC in Kg
|
// Campi virtuali per peso CONAI su RDOC e ANAMAG in Kg
|
||||||
const char* conai_peso_name(TCONAI_class type, int logicnum)
|
const char* conai_peso_name(TCONAI_class type, int logicnum)
|
||||||
{
|
{
|
||||||
if (conai_configured_class(type))
|
if (conai_configured_class(type)) // Garantisce anche che type < CONAI_CLASSES
|
||||||
{
|
{
|
||||||
const char* const __conai_peso_rdoc[] = {"CONPUACC", "CONPUALL", "CONPUCAR", "CONPUPLA", "CONPULEG", "CONPUVET"};
|
const char* const __conai_peso_rdoc[CONAI_CLASSES] =
|
||||||
const char* const __conai_peso_anmg[] = {"CONACC", "CONALL", "CONCAR", "CONPLA", "CONLEG", "CONVET"};
|
{ "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)
|
switch (logicnum)
|
||||||
{
|
{
|
||||||
case LF_ANAMAG : return __conai_peso_anmg[type];
|
case LF_ANAMAG : return __conai_peso_anmg[type];
|
||||||
@ -848,15 +858,16 @@ const char* conai_peso_name(TCONAI_class type, int logicnum)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Campi virtuali per sottocategoria CONAI su RDOC
|
// Campi virtuali per sottocategoria CONAI su RDOC e ANAMAG
|
||||||
const char* conai_sottocat_name(TCONAI_class type, int logicnum)
|
const char* conai_sottocat_name(TCONAI_class type, int logicnum)
|
||||||
{
|
{
|
||||||
if (conai_configured_class(type))
|
if (conai_configured_class(type)) // Garantisce anche che type < CONAI_CLASSES
|
||||||
{
|
{
|
||||||
const char* const __conai_scat_rdoc[CONAI_CLASSES] =
|
const char* const __conai_scat_rdoc[CONAI_CLASSES] =
|
||||||
{ "CONSCACC", "CONSCALL", "CONSCCAR", "CONSCPLA", "CONSCLEG", "CONSCVET" };
|
{ "CONSCACC", "CONSCALL", "CONSCCAR", "CONSCPLA", "CONSCLEG", "CONSCVET" };
|
||||||
const char* const __conai_scat_anmg[CONAI_CLASSES] =
|
const char* const __conai_scat_anmg[CONAI_CLASSES] =
|
||||||
{ "CONAISC[1,4]", "CONAISC[5,8]", "CONAISC[9,12]", "CONAISC[13,16]", "CONAISC[17,20]", "CONAISC[21,24]" };
|
{ 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)
|
switch (logicnum)
|
||||||
{
|
{
|
||||||
case LF_ANAMAG : return __conai_scat_anmg[type];
|
case LF_ANAMAG : return __conai_scat_anmg[type];
|
||||||
@ -869,9 +880,11 @@ const char* conai_sottocat_name(TCONAI_class type, int logicnum)
|
|||||||
|
|
||||||
const char* conai_esenzione_name(TCONAI_class cc, int logicnum)
|
const char* conai_esenzione_name(TCONAI_class cc, int logicnum)
|
||||||
{
|
{
|
||||||
if (conai_configured_class(cc))
|
if (conai_configured_class(cc)) // Garantisce anche che type < CONAI_CLASSES
|
||||||
{
|
{
|
||||||
const char* const __conai_ese_cfven[CONAI_CLASSES] = { CFV_ESACC, CFV_ESALL, CFV_ESCAR, CFV_ESPLA, CFV_ESLEG, CFV_ESVET };
|
const char* const __conai_ese_cfven[CONAI_CLASSES] =
|
||||||
|
{ CFV_ESACC, CFV_ESALL, CFV_ESCAR, CFV_ESPLA, CFV_ESLEG, CFV_ESVET };
|
||||||
|
|
||||||
switch (logicnum)
|
switch (logicnum)
|
||||||
{
|
{
|
||||||
case LF_RIGHEDOC:
|
case LF_RIGHEDOC:
|
||||||
@ -882,21 +895,27 @@ const char* conai_esenzione_name(TCONAI_class cc, int logicnum)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
real TRiga_documento::calc_conai_qta(TCONAI_class type) const
|
||||||
{
|
{
|
||||||
real qta;
|
real kg;
|
||||||
if (is_merce() && conai_configured_class(type))
|
if (is_merce() || is_omaggio())
|
||||||
{
|
{
|
||||||
qta = quantita();
|
const char* weight_name = conai_peso_name(type, LF_RIGHEDOC);
|
||||||
if (!qta.is_zero())
|
if (weight_name && *weight_name) // Se la categoria conai e' gestita
|
||||||
{
|
{
|
||||||
TArticolo& art = articolo();
|
const real peso = get_real(weight_name); // Peso unitario imballo
|
||||||
const TString4 um = get(RDOC_UMQTA);
|
real qta = quantita(); // Quantita' merce
|
||||||
qta = art.convert_to_um(qta, NULL, um);
|
if (peso > ZERO && !qta.is_zero()) // Verifica se ha un peso valido
|
||||||
qta *= get_real(conai_peso_name(type));
|
{
|
||||||
|
const TString4 um = get(RDOC_UMQTA);
|
||||||
|
TArticolo& art = articolo();
|
||||||
|
qta = art.convert_to_um(qta, NULL, um); // Converte la quantita nell'unita' base
|
||||||
|
kg = qta * peso; // Calcola peso dell'imballo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return qta;
|
return kg;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TRiga_documento::is_evasa() const
|
bool TRiga_documento::is_evasa() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user