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
|
// 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_peso_name(i)).full())
|
||||||
if (rdoc->get(conai_fld).full())
|
|
||||||
{
|
{
|
||||||
reset(paf2100f);
|
reset(paf2100f);
|
||||||
paf2100f.set("PK_KEYNLINEA", static_cast<long>(riga_doc));
|
paf2100f.set("PK_KEYNLINEA", static_cast<long>(riga_doc));
|
||||||
paf2100f.set("PK_KEYNLINAR", _idx_adg_doc_row++);
|
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_TIPODATO", "CONAI");
|
||||||
paf2100f.set("PK_RIFDATO", msg_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);
|
ok &= insert(paf2100f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,21 +340,15 @@ class TArticolo_conai : TObject
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
const TString _codart;
|
const TString _codart;
|
||||||
// Categoria -> Sottocategoria + peso
|
TArray _sc;
|
||||||
std::map<TString, std::map<TString, real>> _catsotpes;
|
TArray _peso;// Categoria -> Sottocategoria + peso
|
||||||
public:
|
public:
|
||||||
const std::map<TString, std::map<TString, real>>& get_map() { return _catsotpes; }
|
const TString & get_scat(int i) {return _sc.objptr(i) != NULL ? (const TString &)_sc[i] : EMPTY_STRING;}
|
||||||
const std::map<TString, real>* get_scat(const TString& cat);
|
const real get_peso(int i) {return _peso.objptr(i) != NULL ? (const real &)_peso[i] : ZERO;}
|
||||||
real get_peso(const TString& cat, const TString& scat);
|
|
||||||
real get_peso(const TString& fcat) { return get_peso(fcat.left(2), fcat.right(2)); }
|
|
||||||
|
|
||||||
TArticolo_conai(const TString& codart);
|
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
|
// LIBRERIA DI utility del magazzino
|
||||||
// *******************************
|
// *******************************
|
||||||
|
@ -1882,10 +1882,12 @@ TArticolo_conai::TArticolo_conai(const TString& codart)
|
|||||||
int err = conart.read(_isgteq);
|
int err = conart.read(_isgteq);
|
||||||
while (err == NOERR && _codart == conart.get(CONART_CODART))
|
while (err == NOERR && _codart == conart.get(CONART_CODART))
|
||||||
{
|
{
|
||||||
const TString& categoria = conart.get(CONART_CATEGORIA);
|
const int i = conart.get_int(CONART_NRIGA) - 1;
|
||||||
const TString& sottocat = conart.get(CONART_SOTTOCAT);
|
TString categoria = conart.get(CONART_CATEGORIA);
|
||||||
|
categoria << conart.get(CONART_SOTTOCAT);
|
||||||
|
_sc.add(categoria, i);
|
||||||
const real& peso = conart.get_real(CONART_PESO);
|
const real& peso = conart.get_real(CONART_PESO);
|
||||||
_catsotpes[categoria][sottocat] = peso;
|
_peso.add(peso, i);
|
||||||
err = conart.next();
|
err = conart.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1894,51 +1896,30 @@ TArticolo_conai::TArticolo_conai(const TString& codart)
|
|||||||
* La risposta è semplice, tutti i programmi che non verranno aggiornati da queste modifiche (es. Importazione Pack/SKNT)
|
* 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à
|
* scrivono li e quindi va tenuta la compatibilità
|
||||||
*/
|
*/
|
||||||
|
if (_sc.empty())
|
||||||
{
|
{
|
||||||
TLocalisamfile anamag(LF_ANAMAG);
|
TLocalisamfile anamag(LF_ANAMAG);
|
||||||
TRectype ranamag(LF_ANAMAG);
|
TRectype & ranamag = anamag.curr();
|
||||||
|
|
||||||
ranamag.put(ANAMAG_CODART, _codart);
|
ranamag.put(ANAMAG_CODART, _codart);
|
||||||
if (ranamag.read(anamag) == NOERR) // Non dovrebbe mai fallire
|
if (ranamag.read(anamag) == NOERR) // Non dovrebbe mai fallire
|
||||||
{
|
{
|
||||||
const TString& conaisc = ranamag.get(ANAMAG_CONAISC);
|
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 < 6; i++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < conaisc.len() / 4; i++)
|
const TString& con = conaisc.mid(i * 4, 4);
|
||||||
{
|
const TString& categoria = con.left(2);
|
||||||
const TString& con = conaisc.mid(i * 4, 4);
|
const TString& sottocat = con.right(2);
|
||||||
const TString& categoria = con.left(2);
|
if (con.blank()) continue;
|
||||||
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
|
// causali
|
||||||
|
|
||||||
int TCausale_magazzino::sgn(TTipo_saldomag tiposaldo) const
|
int TCausale_magazzino::sgn(TTipo_saldomag tiposaldo) const
|
||||||
|
@ -6,4 +6,4 @@ CATEGORIA|1|2|0|Codice categoia CONAI
|
|||||||
SOTTOCAT|1|2|0|Codice sottocategoria CONAI
|
SOTTOCAT|1|2|0|Codice sottocategoria CONAI
|
||||||
PESO|4|15|5|Peso CONAI (Kg)
|
PESO|4|15|5|Peso CONAI (Kg)
|
||||||
1
|
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;
|
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));
|
const TCodice_numerazione& cod_num = cached_numerazione(m.get(F_CODNUM));
|
||||||
|
|
||||||
// Se per questa numerazione e' abilitata le numerazione automatica
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
// 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;
|
||||||
|
key.format("%d|%ld", F_NDOC, ndoc);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TMotore_application::record_description(const TRelation& rel) const
|
const char* TMotore_application::record_description(const TRelation& rel) const
|
||||||
|
@ -105,8 +105,9 @@ public:
|
|||||||
// Operazione
|
// Operazione
|
||||||
TMotore_application( ) : _ncopie(-1){ }
|
TMotore_application( ) : _ncopie(-1){ }
|
||||||
virtual ~TMotore_application( ) { }
|
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
|
// Test Plafond
|
||||||
int check_plafond_write(TDocumento& d);
|
int check_plafond_write(TDocumento& d);
|
||||||
|
@ -1384,6 +1384,7 @@ void TMask_generator::genera_testata_1()
|
|||||||
_m->field( DOC_CODCF );
|
_m->field( DOC_CODCF );
|
||||||
_m->group( 1 );
|
_m->group( 1 );
|
||||||
_m->use( LF_CLIFO, 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);
|
temp_s.format( "TIPOCF \"%c\"~CODCF %d", tipo_cf, F_CODCF);
|
||||||
_m->input( temp_s );
|
_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" );
|
_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
|
JOLLY10|2|20|Jolly|20
|
||||||
RIDPREZZO|3|18|Riduzione prezzo|18
|
RIDPREZZO|3|18|Riduzione prezzo|18
|
||||||
PERCPROV|3|502|2a Perc.\nProvv.|5
|
PERCPROV|3|502|2a Perc.\nProvv.|5
|
||||||
SCAACC|2|4|Sottocategoria\nACCIAIO|4
|
CCON(1)|2|4|CONAI\nSottoc.1|4
|
||||||
PUNACC|3|1305|Peso unitario\nACCIAIO|13
|
PCON(1)|3|1305|CONAI\nPeso un.1|13
|
||||||
SCAALL|2|4|Sottocategoria\nALLUMINIO|4
|
CCON(2)|2|4|CONAI\nSottoc.2|4
|
||||||
PUNALL|3|1305|Peso unitario\nALLUMINIO|13
|
PCON(2)|3|1305|CONAI\nPeso un.2|13
|
||||||
SCACAR|2|4|Sottocategoria\nCARTA|4
|
CCON(3)|2|4|CONAI\nSottoc.3|4
|
||||||
PUNCAR|3|1305|Peso unitario\nCARTA|13
|
PCON(3)|3|1305|CONAI\nPeso un.3|13
|
||||||
SCAPLA|2|4|Sottocategoria\nPLASTICA|4
|
CCON(4)|2|4|CONAI\nSottoc.4|4
|
||||||
PUNPLA|3|1305|Peso unitario\nPLASTICA|13
|
PCON(4)|3|1305|CONAI\nPeso un.4|13
|
||||||
SCALEG|2|4|Sottocategoria\nLEGNO|4
|
CCON(5)|2|4|CONAI\nSottoc.5|4
|
||||||
PUNLEG|3|1305|Peso unitario\nLEGNO|13
|
PCON(5)|3|1305|CONAI\nPeso un.5|13
|
||||||
SCAVET|2|4|Sottocategoria\nVETRO|4
|
CCON(6)|2|4|CONAI\nSottoc.6|4
|
||||||
PUNVET|3|1305|Peso unitario\nVETRO|13
|
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
|
TRiga_documento& TDoc_recordset::riga_doc(int n) const
|
||||||
{
|
{
|
||||||
if (n < 0 || n > _doc->rows()) // Non dovrebbe succedere mai
|
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
|
n = _doc->new_row("05").numero(); // Crea una riga descrizione fittizia
|
||||||
((TDoc_recordset*)this)->_lastpos++;
|
((TDoc_recordset*)this)->_lastpos++;
|
||||||
}
|
}
|
||||||
if (n <= 0)
|
|
||||||
n = _mypos+1;
|
|
||||||
if (n <= 0)
|
|
||||||
n = 1;
|
|
||||||
return _doc->row(n);
|
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)
|
if (curr_rdoc.get(RDOC_TIPORIGA) == row_type)
|
||||||
return false; // Riga generata
|
return false; // Riga generata
|
||||||
|
|
||||||
|
@ -72,7 +72,8 @@ class TMask_anamag: public TMask
|
|||||||
static bool handle_sheet_cod(TMask_field &, KEY); // handler dello sheet dei codici alternativi
|
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 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 handle_codcorr(TMask_field &, KEY); // handler dello sheet dei codici alternativi
|
||||||
static bool notify_sheet_giac(TSheet_field & s, int r, KEY k); // notify delle giacenze
|
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 handle_sheetgiac(TMask_field &, KEY); // handler dello sheet giacenze
|
||||||
static bool notify_sheet_sto(TSheet_field & s, int r, KEY k); // notify dello storico
|
static bool notify_sheet_sto(TSheet_field & s, int r, KEY k); // notify dello storico
|
||||||
static bool handle_sheetstomag(TMask_field &, KEY); // handler dello sheet storico giacenze
|
static bool handle_sheetstomag(TMask_field &, KEY); // handler dello sheet storico giacenze
|
||||||
@ -375,9 +376,12 @@ void TMask_anamag::set_parametered_fields()
|
|||||||
|
|
||||||
// setta i campi della maschera per la pagina giacenze
|
// setta i campi della maschera per la pagina giacenze
|
||||||
TSheet_field &fld_stomag = sfield(F_SHEETSTOMAG);
|
TSheet_field &fld_stomag = sfield(F_SHEETSTOMAG);
|
||||||
TSheet_field &fld_giac = sfield(F_SHEETGIAC);
|
TSheet_field &fld_giac = sfield(F_SHEETGIAC);
|
||||||
fld_giac.set_notify(notify_sheet_giac);
|
fld_giac.set_notify(notify_sheet_giac);
|
||||||
TSheet_field &fld_cod = sfield(F_SHEETCOD);
|
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
|
// disabilita le colonne quando non sono utilizzati i livelli di giacenza
|
||||||
for (int i=0; i < 4; i++)
|
for (int i=0; i < 4; i++)
|
||||||
@ -1073,7 +1077,7 @@ bool TMask_anamag::handle_sheet_um(TMask_field &fld, KEY k)
|
|||||||
// aggiunge all'hash table l'elemento della riga corrente e controlla che non esista già
|
// aggiunge all'hash table l'elemento della riga corrente e controlla che non esista già
|
||||||
if (v.add(um))
|
if (v.add(um))
|
||||||
return error_box("Le unità di misura devono essere diverse tra loro");
|
return error_box("Le unità di misura devono essere diverse tra loro");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m.edit_mode())
|
if (m.edit_mode())
|
||||||
@ -1476,7 +1480,19 @@ bool TMask_anamag::check_totali_storico()
|
|||||||
return TRUE;
|
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)
|
bool TMask_anamag::notify_sheet_giac(TSheet_field &f, int i, KEY k)
|
||||||
{
|
{
|
||||||
TMask_anamag& m = (TMask_anamag&)f.mask();
|
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();
|
fld_con.hide();
|
||||||
|
|
||||||
TArticolo_conai ac(codart);
|
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);
|
TToken_string& row = fld_con.row(-1);
|
||||||
row.add(cat.first);
|
row.add(ac.get_scat(i).left(2));
|
||||||
row.add(sottocat.first);
|
row.add(ac.get_scat(i).right(2));
|
||||||
row.add(sottocat.second);
|
row.add(ac.get_peso(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lo rimostro
|
// 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 TAnagrafica_magazzino::write_conai(const TMask& m) const
|
||||||
{
|
{
|
||||||
int ok = NOERR;
|
int ok = NOERR;
|
||||||
// Prima di tutto svuoto i campi del conai sull'articolo
|
TRecord_array conart(m.get(F_CODART), LF_CONART);
|
||||||
TLocalisamfile anamag(LF_ANAMAG);
|
TRectype conrec(LF_CONART);
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
conart.destroy_rows();
|
||||||
// Infine salvo i nuovi dati in conart
|
// Infine salvo i nuovi dati in conart
|
||||||
|
|
||||||
TSheet_field& sheet_conai = m.sfield(F_SHEETCON);
|
TSheet_field& sheet_conai = m.sfield(F_SHEETCON);
|
||||||
|
int r = 1;
|
||||||
FOR_EACH_SHEET_ROW(sheet_conai, num_riga, row)
|
FOR_EACH_SHEET_ROW(sheet_conai, num_riga, row)
|
||||||
{
|
{
|
||||||
conart.zero();
|
const TString cat = row->get(cid2index(FS_CAT_CONAI));
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __UTILITY_H
|
||||||
|
#include <utility.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __VISWIN_H
|
#ifndef __VISWIN_H
|
||||||
class TViswin;
|
class TViswin;
|
||||||
#endif
|
#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 _field_qta_mag, _field_qtaevasa_mag; // Veri campi Quantità e Quantità Evasa per magazzino
|
||||||
TString16 _raee_cod, _raee_fld;
|
TString16 _raee_cod, _raee_fld;
|
||||||
TString _str_desc_doc, _str_desc_rdoc;
|
TString _str_desc_doc, _str_desc_rdoc;
|
||||||
|
TDate _first_ok_date;
|
||||||
|
int _max_days;
|
||||||
int _liv, _row;
|
int _liv, _row;
|
||||||
TString4 _module;
|
TString4 _module;
|
||||||
|
|
||||||
@ -373,6 +379,7 @@ public:
|
|||||||
bool head_ca_required() const { return _hca_req; }
|
bool head_ca_required() const { return _hca_req; }
|
||||||
bool check_double_art() const { return _check_double_art; }
|
bool check_double_art() const { return _check_double_art; }
|
||||||
bool ignora_anticipi_fatturazione() const { return _ignora_anticipi_fatturazione; }
|
bool ignora_anticipi_fatturazione() const { return _ignora_anticipi_fatturazione; }
|
||||||
|
const TDate & first_ok_date();
|
||||||
|
|
||||||
TTipo_documento(const char* tipodoc = NULL);
|
TTipo_documento(const char* tipodoc = NULL);
|
||||||
TTipo_documento(const TRectype& rec);
|
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_class2str(TCONAI_class cc);
|
||||||
const char* conai_material(TCONAI_class cc);
|
const char* conai_material(TCONAI_class cc);
|
||||||
bool conai_configured_class(TCONAI_class cc);
|
bool conai_configured_class(TCONAI_class cc);
|
||||||
const char* conai_peso_name(TCONAI_class cc, int logic_num = LF_RIGHEDOC);
|
// Campi virtuali per peso CONAI su RDOC in Kg
|
||||||
const char* conai_sottocat_name(TCONAI_class cc, int logic_num = LF_RIGHEDOC);
|
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);
|
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 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_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
|
class TConai : public TObject
|
||||||
{
|
{
|
||||||
private:
|
TAssoc_array _conais;
|
||||||
/* 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:
|
|
||||||
|
|
||||||
const TSpesa_prest& get_spesa(const TString& cat, const TString& sottocat) { return _conais[cat][sottocat]; }
|
public:
|
||||||
const TSpesa_prest& get_spesa(const TString& full_sottocat) { return get_spesa(full_sottocat.left(2), full_sottocat.right(2)); }
|
const TSpesa_prest& get_spesa(const TString& sottocat) { return (const TSpesa_prest &) _conais[sottocat]; }
|
||||||
const std::map<TString, TSpesa_prest> get_categoria(const TString& cat) { return _conais[cat]; }
|
const bool find(const TString& cod_spesa) { return _conais.objptr(cod_spesa) != NULL; }
|
||||||
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(); }
|
int get_lista_cod_spesa(TString_array & keys) { return _conais.get_keys(keys); }
|
||||||
const TString_array get_lista_cod_spesa();
|
|
||||||
|
|
||||||
TConai();
|
TConai();
|
||||||
};
|
};
|
||||||
@ -692,7 +690,7 @@ public:
|
|||||||
virtual real quantita_mag() const;
|
virtual real quantita_mag() const;
|
||||||
virtual real qtaevasa_mag() const;
|
virtual real qtaevasa_mag() const;
|
||||||
virtual real qtaresidua_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;
|
real valore(bool totale, bool lordo = false, int ndec = AUTO_DECIMALS) const;
|
||||||
const TString& codice_costo() const;
|
const TString& codice_costo() const;
|
||||||
@ -789,8 +787,7 @@ class TDocumento : public TMultiple_rectype // velib03
|
|||||||
static short _has_provv;
|
static short _has_provv;
|
||||||
static TCodgiac_livelli *_livelli;
|
static TCodgiac_livelli *_livelli;
|
||||||
|
|
||||||
TConai _conai;
|
TAssoc_array _conaiqta; // Per ogni sottocategoria CONAI mi calcola la qta
|
||||||
std::map<TString, real> _conaiqta; // Per ogni sottocategoria CONAI mi calcola la qta
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual TRectype * new_body_record(int logicnum = 0)
|
virtual TRectype * new_body_record(int logicnum = 0)
|
||||||
@ -850,8 +847,8 @@ public:
|
|||||||
virtual void zero(char c = '\0') { TMultiple_rectype::zero(c); }
|
virtual void zero(char c = '\0') { TMultiple_rectype::zero(c); }
|
||||||
void sort_rows(const char * key);
|
void sort_rows(const char * key);
|
||||||
|
|
||||||
int physical_rows() const { return body().rows(); }
|
inline 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 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); }
|
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); }
|
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_spese_aut(TString_array & spese, bool preserve_old = false, TSheet_field * sh = NULL, bool force = false);
|
||||||
void update_conai_qta();
|
void update_conai_qta();
|
||||||
//real calc_conai_qta(TCONAI_class type);
|
|
||||||
void update_conai();
|
void update_conai();
|
||||||
void old_update_conai();
|
void old_update_conai();
|
||||||
|
|
||||||
|
@ -953,51 +953,7 @@ TString conai_configured_spesa(TCONAI_class cc)
|
|||||||
return __con_conf->get(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)
|
const char* conai_esenzione_name(TCONAI_class cc, int logicnum)
|
||||||
{
|
{
|
||||||
@ -1005,8 +961,8 @@ const char* conai_esenzione_name(TCONAI_class cc, int logicnum)
|
|||||||
{
|
{
|
||||||
const char* const __conai_ese_cfven[CONAI_CLASSES] =
|
const char* const __conai_ese_cfven[CONAI_CLASSES] =
|
||||||
{ CFV_ESACC, CFV_ESALL, CFV_ESCAR, CFV_ESPLA, CFV_ESLEG, CFV_ESVET };
|
{ CFV_ESACC, CFV_ESALL, CFV_ESCAR, CFV_ESPLA, CFV_ESLEG, CFV_ESVET };
|
||||||
|
|
||||||
switch (logicnum)
|
switch (logicnum)
|
||||||
{
|
{
|
||||||
case LF_RIGHEDOC:
|
case LF_RIGHEDOC:
|
||||||
case LF_CFVEN : return __conai_ese_cfven[cc];
|
case LF_CFVEN : return __conai_ese_cfven[cc];
|
||||||
@ -1020,21 +976,6 @@ const char* conai_esenzione_name(TCONAI_class cc, int logicnum)
|
|||||||
// TConai
|
// 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()
|
TConai::TConai()
|
||||||
{
|
{
|
||||||
TRelation rel(LF_TABMOD);
|
TRelation rel(LF_TABMOD);
|
||||||
@ -1045,15 +986,16 @@ TConai::TConai()
|
|||||||
TCursor conais(&rel, "", 1, &rec, &rec);
|
TCursor conais(&rel, "", 1, &rec, &rec);
|
||||||
for (conais = 0; conais.pos() < conais.items(); ++conais)
|
for (conais = 0; conais.pos() < conais.items(); ++conais)
|
||||||
{
|
{
|
||||||
TRectype row = conais.curr();
|
TRectype & row = conais.curr();
|
||||||
const TString& con_class = row.get("CODTAB").left(2);
|
const TString& con_sub = row.get("CODTAB");
|
||||||
const TString& con_sub = row.get("CODTAB").mid(2);
|
TString cod_spesa = row.get("S1");
|
||||||
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)))
|
if (cod_spesa.blank())
|
||||||
{
|
cod_spesa = conai_configured_spesa(conai_str2class(con_sub));
|
||||||
// Aggiungo
|
|
||||||
_conais[con_class][con_sub] = TSpesa_prest(cod_spesa);
|
|
||||||
}
|
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
|
// 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;
|
real kg;
|
||||||
if (is_merce() || is_omaggio())
|
if (is_merce() || is_omaggio())
|
||||||
{
|
{
|
||||||
TString weight_name = conai_peso_name(type, LF_RIGHEDOC);
|
const real peso = get_real(conai_peso_name(num_field)); // Peso unitario imballo
|
||||||
if (weight_name.full()) // Se la categoria conai e' gestita
|
real qta = quantita(); // Quantita' merce
|
||||||
{
|
|
||||||
weight_name << "(%d)";
|
|
||||||
const real peso = get_real(weight_name.format(weight_name, num_field)); // Peso unitario imballo
|
|
||||||
real qta = quantita(); // Quantita' merce
|
|
||||||
if (peso > ZERO && !qta.is_zero()) // Verifica se ha un peso valido
|
if (peso > ZERO && !qta.is_zero()) // Verifica se ha un peso valido
|
||||||
{
|
{
|
||||||
// A volte CODARTMAG è vuoto per cui converte erroneamente la qta in 0 :-(
|
// A volte CODARTMAG è vuoto per cui converte erroneamente la qta in 0 :-(
|
||||||
@ -1087,7 +1026,6 @@ real TRiga_documento::calc_conai_qta(TCONAI_class type, const int num_field) con
|
|||||||
kg.round(5);
|
kg.round(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return kg;
|
return kg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1363,7 +1301,7 @@ void TRiga_documento::autosave(TSheet_field& f)
|
|||||||
break;
|
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);
|
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);
|
const int pos = m.id2pos(id);
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
|
@ -1967,7 +1967,9 @@ TRiga_documento & TDocumento::row(int index)
|
|||||||
r = _valfisc;
|
r = _valfisc;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (r != NULL)
|
||||||
|
r->set_doc(this);
|
||||||
return *r;
|
return *r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3001,29 +3003,25 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
|
|||||||
|
|
||||||
void TDocumento::update_conai_qta()
|
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_PHYSICAL_RDOC(*this, i, r) if (r->is_merce() || r->is_omaggio())
|
||||||
{
|
{
|
||||||
FOR_EACH_CONFIGURED_CONAI_CLASS(cc)
|
TString current_cat;
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (r->get(current_cat).full())
|
for (int i = 1; i <= FR_CMAX; i++)
|
||||||
{
|
{
|
||||||
const real rowqty = r->calc_conai_qta(cc, row_conai);
|
TString8 cat = r->get(conai_sottocat_name(i));
|
||||||
if (rowqty.is_zero()) continue;
|
|
||||||
_conaiqta[r->get(current_cat)] += rowqty;
|
if (cat.full())
|
||||||
row_conai++;
|
{
|
||||||
}
|
const real rowqty = r->calc_conai_qta(i);
|
||||||
else
|
|
||||||
ok = false;
|
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)
|
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 TRectype& cfven = clifor().vendite();
|
||||||
const bool cli_add_conai = cfven.get_bool("ADDCONAI");
|
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
|
// Controllo se il documento ha il metodo nuovo, in caso negativo skippo tutto
|
||||||
// Cancella le righe generate e poi ti ricalcolo tutto
|
// Cancella le righe generate e poi ti ricalcolo tutto
|
||||||
if(!has_new_conai(*this))
|
if(!has_new_conai(*this))
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
const TString& cod = r.get(RDOC_CODART);
|
const TString& cod = r.get(RDOC_CODART);
|
||||||
const TString& sottocat = r.get(RDOC_TIPOCON);
|
const TString& sottocat = r.get(RDOC_TIPOCON);
|
||||||
if (_conai.find(sottocat))
|
if (_conaiqta.objptr(sottocat) != NULL)
|
||||||
{
|
{
|
||||||
if (cli_add_conai)
|
if (cli_add_conai)
|
||||||
{
|
{
|
||||||
real perc_esenz = cfven.get_real(get_cf_esenz(sottocat.left(2)));
|
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)
|
if (dataes.ok() && datadoc > dataes)
|
||||||
perc_esenz = ZERO;
|
perc_esenz = ZERO;
|
||||||
const bool cli_esente = esponi_esenti && (perc_esenz >= CENTO);
|
const bool cli_esente = esponi_esenti && (perc_esenz >= CENTO);
|
||||||
@ -3115,7 +3111,7 @@ void TDocumento::update_conai()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
destroy_row(i, true);
|
destroy_row(i, true);
|
||||||
conai_aggiornati.insert(sottocat);
|
conai_aggiornati.add(sottocat, sottocat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3124,62 +3120,62 @@ void TDocumento::update_conai()
|
|||||||
if (cli_add_conai)
|
if (cli_add_conai)
|
||||||
{
|
{
|
||||||
const TString4 cod_iva_cli = codesiva();
|
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
|
// Se l'ho già fatto skippo
|
||||||
if (conai_aggiornati.find(cod_sottocat) != conai_aggiornati.end())
|
if (conai_aggiornati.objptr(cod_sottocat) != NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TSpesa_prest sp = _conai.get_spesa(cod_sottocat);
|
TSpesa_prest sp = conai.get_spesa(cod_sottocat);
|
||||||
|
|
||||||
// Aggiungo la spesa
|
// Aggiungo la spesa
|
||||||
const real perc_esenz = cfven.get_real(get_cf_esenz(cod_sottocat.left(2)));
|
const real perc_esenz = cfven.get_real(get_cf_esenz(cod_sottocat.left(2)));
|
||||||
const bool cli_esente = (esponi_esenti) && (perc_esenz >= CENTO);
|
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;
|
real qta = qta_lorda;
|
||||||
if (!cli_esente && !qta_lorda.is_zero() && !perc_esenz.is_zero())
|
if (!cli_esente && !qta_lorda.is_zero() && !perc_esenz.is_zero())
|
||||||
{
|
{
|
||||||
qta = qta_lorda * (CENTO - perc_esenz) / CENTO;
|
qta = qta_lorda * (CENTO - perc_esenz) / CENTO;
|
||||||
qta.round(5);
|
qta.round(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qta > ZERO)
|
if (qta > ZERO)
|
||||||
{
|
{
|
||||||
const TString4 tipo = sp.tipo_riga();
|
const TString4 tipo = sp.tipo_riga();
|
||||||
TRiga_documento& riga = new_row(tipo);
|
TRiga_documento& riga = new_row(tipo);
|
||||||
|
|
||||||
riga.put(RDOC_CODART, sp.codice());
|
riga.put(RDOC_CODART, sp.codice());
|
||||||
riga.generata();
|
riga.generata();
|
||||||
riga.put(RDOC_GENTIPO, 'C');
|
riga.put(RDOC_GENTIPO, 'C');
|
||||||
static TString descrizione;
|
static TString descrizione;
|
||||||
descrizione.cut(0) << sp.descrizione() << " (" << cod_sottocat << ")";
|
descrizione.cut(0) << sp.descrizione() << " (" << cod_sottocat << ")";
|
||||||
riga.put(RDOC_DESCR, descrizione);
|
riga.put(RDOC_DESCR, descrizione);
|
||||||
riga.put(RDOC_QTA, qta);
|
riga.put(RDOC_QTA, qta);
|
||||||
|
|
||||||
// Mi salvo anche la sottocategoria in questione
|
// Mi salvo anche la sottocategoria in questione
|
||||||
riga.put(RDOC_TIPOCON, cod_sottocat);
|
riga.put(RDOC_TIPOCON, cod_sottocat);
|
||||||
|
|
||||||
const real cambio = get_real(DOC_CAMBIO);
|
const real cambio = get_real(DOC_CAMBIO);
|
||||||
const TString4 valuta = get(DOC_CODVAL);
|
const TString4 valuta = get(DOC_CODVAL);
|
||||||
real prezzo = cli_esente ? ZERO : sp.prezzo();
|
real prezzo = cli_esente ? ZERO : sp.prezzo();
|
||||||
|
|
||||||
sppr_calc(sp, valuta, cambio, prezzo);
|
sppr_calc(sp, valuta, cambio, prezzo);
|
||||||
if (this->tipo().calcolo_lordo())
|
if (this->tipo().calcolo_lordo())
|
||||||
prezzo = riga.iva().lordo(prezzo, ALL_DECIMALS);
|
prezzo = riga.iva().lordo(prezzo, ALL_DECIMALS);
|
||||||
riga.put(RDOC_PREZZO, prezzo);
|
riga.put(RDOC_PREZZO, prezzo);
|
||||||
riga.put(RDOC_UMQTA, sp.um());
|
riga.put(RDOC_UMQTA, sp.um());
|
||||||
if (cod_iva_cli.empty())
|
if (cod_iva_cli.empty())
|
||||||
riga.put(RDOC_CODIVA, sp.cod_iva());
|
riga.put(RDOC_CODIVA, sp.cod_iva());
|
||||||
else
|
else
|
||||||
riga.put(RDOC_CODIVA, cod_iva_cli);
|
riga.put(RDOC_CODIVA, cod_iva_cli);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,8 +267,16 @@ const TString_array& TTipo_documento::sheet_columns() const
|
|||||||
if (_sheet_columns.empty())
|
if (_sheet_columns.empty())
|
||||||
{
|
{
|
||||||
TFilename pn; profile_name(pn);
|
TFilename pn; profile_name(pn);
|
||||||
TConfig prof(pn, "SHEET");
|
TConfig prof(pn);//, "SHEET");
|
||||||
for (int i = 0; i < MAX_COLUMNS; i++)
|
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);
|
const TString& id = prof.get("Col", NULL, i);
|
||||||
if (atoi(id) <= 0)
|
if (atoi(id) <= 0)
|
||||||
@ -444,6 +452,7 @@ void TTipo_documento::read_formule()
|
|||||||
_load_cont = prof.get_bool("LOAD_CONT", "MAIN");
|
_load_cont = prof.get_bool("LOAD_CONT", "MAIN");
|
||||||
_raee_cod = prof.get("RAEE_COD", "MAIN");
|
_raee_cod = prof.get("RAEE_COD", "MAIN");
|
||||||
_raee_fld = prof.get("RAEE_FLD", "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");
|
TToken_string str = prof.get("ART_TO_SHOW", "MAIN");
|
||||||
_liv = str.get_int();
|
_liv = str.get_int();
|
||||||
@ -527,7 +536,22 @@ bool TTipo_documento::scarica_residuo() const
|
|||||||
return get_bool("B4");
|
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
|
// Espressione rdocumento
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -611,11 +635,11 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
|
|||||||
const int cond_nvars = cond_expr.numvar();
|
const int cond_nvars = cond_expr.numvar();
|
||||||
TExpr_documento expr(field, _numexpr, _doc);
|
TExpr_documento expr(field, _numexpr, _doc);
|
||||||
const int nvars = expr.numvar();
|
const int nvars = expr.numvar();
|
||||||
|
|
||||||
for (int i = _doc->rows(); i > 0; i--)
|
for (int i = _doc->rows(); i > 0; i--)
|
||||||
{
|
{
|
||||||
const TRiga_documento& riga = (const TRiga_documento&)(*_doc)[i];
|
const TRiga_documento& riga = (const TRiga_documento&)(*_doc)[i];
|
||||||
|
|
||||||
for (int j = cond_nvars - 1; j >= 0; j--)
|
for (int j = cond_nvars - 1; j >= 0; j--)
|
||||||
{
|
{
|
||||||
const char* s = cond_expr.varname(j);
|
const char* s = cond_expr.varname(j);
|
||||||
|
@ -1231,10 +1231,6 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
|||||||
_error = ultprot_error;
|
_error = ultprot_error;
|
||||||
return _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
|
else // oppure dal numero di documento
|
||||||
ult_prot = doc.numero();
|
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);
|
error_box("*** Errore %d scrivendo il movimento contabile %ld.", err, numreg);
|
||||||
return generic_error;
|
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
|
// Aggiorno subito i saldi
|
||||||
if (_caus->soloiva())
|
if (_caus->soloiva())
|
||||||
movimento.destroy_cg_row(-1);
|
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
|
// Gestione campi CONAI su maschera righe
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
short conai_peso_id(TCONAI_class type)
|
short conai_peso_id(int id)
|
||||||
{ return type >= CONAI_FIRST && type <= CONAI_LAST ? FR_PUNACC + 2 * type : DLG_NULL; }
|
{ return id >= 0 && id < FR_CMAX ? FR_PCON01 + 2 * id : DLG_NULL; }
|
||||||
|
|
||||||
short conai_sottocat_id(TCONAI_class type)
|
short conai_sottocat_id(int id)
|
||||||
{ return type >= CONAI_FIRST && type <= CONAI_LAST ? FR_SCAACC + 2*type : DLG_NULL; }
|
{ return id >= 0 && id < FR_CMAX ? FR_CCON01 + 2 * id : 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TDocumento_mask
|
// TDocumento_mask
|
||||||
@ -662,9 +656,9 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
|
|||||||
|
|
||||||
TToken_string colonne;
|
TToken_string colonne;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
colonne = "0";
|
colonne = "0";
|
||||||
for (i = 0; i < ncols; i ++ )
|
for (i = 0; i < ncols; i++)
|
||||||
{
|
{
|
||||||
TToken_string& sheet_col = (TToken_string&)sheet_columns.row(i);
|
TToken_string& sheet_col = (TToken_string&)sheet_columns.row(i);
|
||||||
const int field_id = sheet_col.get_int(0);
|
const int field_id = sheet_col.get_int(0);
|
||||||
@ -672,13 +666,13 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
|
|||||||
to_delete.reset(coltomove);
|
to_delete.reset(coltomove);
|
||||||
|
|
||||||
const TString80 descr(sheet_col.get(1));
|
const TString80 descr(sheet_col.get(1));
|
||||||
if (descr.not_empty() )
|
if (descr.not_empty())
|
||||||
sheet.set_column_header( field_id, descr);
|
sheet.set_column_header(field_id, descr);
|
||||||
|
|
||||||
const int size = sheet_col.get_int(2) * 8; // XI_FU_MULTIPLE
|
const int size = sheet_col.get_int(2) * 8; // XI_FU_MULTIPLE
|
||||||
if (size != 0)
|
if (size != 0)
|
||||||
sheet.set_column_width( field_id, size);
|
sheet.set_column_width(field_id, size);
|
||||||
|
|
||||||
if (field_id != FR_LORDO)
|
if (field_id != FR_LORDO)
|
||||||
colonne.add(field_id);
|
colonne.add(field_id);
|
||||||
if (field_id == FR_CODIVA && tdoc.is_costo())
|
if (field_id == FR_CODIVA && tdoc.is_costo())
|
||||||
@ -689,18 +683,23 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
|
|||||||
colonne.add(col);
|
colonne.add(col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
to_delete.set(0L);
|
to_delete.set(0L);
|
||||||
to_delete.reset(1);
|
to_delete.reset(1);
|
||||||
|
|
||||||
|
bool has_conai = false;
|
||||||
|
|
||||||
FOR_EACH_CONAI_CLASS(ct)
|
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 posc = conai_sottocat_id(ct);
|
||||||
const short posp = conai_peso_id(ct);
|
const short posp = conai_peso_id(ct);
|
||||||
const int colc = sheet.cid2index(posc);
|
const int colc = sheet.cid2index(posc);
|
||||||
const int colp = sheet.cid2index(posp);
|
const int colp = sheet.cid2index(posp);
|
||||||
|
|
||||||
if (conai_configured_class(ct))
|
if (has_conai)
|
||||||
{
|
{
|
||||||
to_delete.reset(colc);
|
to_delete.reset(colc);
|
||||||
if (colonne.find(format("%d", posc)) < 0)
|
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)])
|
if (!to_delete[sheet.cid2index(FR_CODDEP)])
|
||||||
sheet.enable_column(FR_CODDEP, _ges_dep && _ges_mag);
|
sheet.enable_column(FR_CODDEP, _ges_dep && _ges_mag);
|
||||||
if (!to_delete[sheet.cid2index(FR_CODMAG)])
|
if (!to_delete[sheet.cid2index(FR_CODMAG)])
|
||||||
@ -1760,23 +1760,30 @@ TVariable_mask* TDocumento_mask::riga_mask(int numriga)
|
|||||||
f.add_driver(-F_CODVAL);
|
f.add_driver(-F_CODVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
FOR_EACH_CONAI_CLASS(type)
|
bool has_conai = false;
|
||||||
{
|
|
||||||
const short posc = conai_sottocat_id(type);
|
FOR_EACH_CONAI_CLASS(ct)
|
||||||
const short posp = conai_peso_id(type);
|
has_conai |= conai_configured_class(ct);
|
||||||
if (conai_configured_class(type))
|
|
||||||
|
for (int i = 0; i < FR_CMAX; i++)
|
||||||
|
{
|
||||||
|
const short posc = conai_sottocat_id(i);
|
||||||
|
const short posp = conai_peso_id(i);
|
||||||
|
|
||||||
|
if (has_conai)
|
||||||
{
|
{
|
||||||
m->show(posc);
|
m->show(posc);
|
||||||
m->set_handler(posc, sottocat_conai_handler);
|
m->set_handler(posc, sottocat_conai_handler);
|
||||||
m->show(posp);
|
m->show(posp);
|
||||||
m->set_handler(posp, peso_conai_handler);
|
m->set_handler(posp, peso_conai_handler);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m->hide(posc);
|
m->hide(posc);
|
||||||
m->hide(posp);
|
m->hide(posp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Impostiamo gli eventuali drivers
|
// Impostiamo gli eventuali drivers
|
||||||
FOR_EACH_MASK_FIELD((*m), i, f) if (f->is_edit())
|
FOR_EACH_MASK_FIELD((*m), i, f) if (f->is_edit())
|
||||||
|
@ -420,7 +420,7 @@ bool note_hndl( TMask_field& f, KEY key )
|
|||||||
TString stringone;
|
TString stringone;
|
||||||
for (int i = 0; i < 6; i++)
|
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 << note.get(fieldname);
|
||||||
}
|
}
|
||||||
stringone.replace(char(0xB6), '\n');
|
stringone.replace(char(0xB6), '\n');
|
||||||
@ -482,15 +482,16 @@ bool data_hndl( TMask_field& field, KEY key )
|
|||||||
const TDate datadoc(m.get(F_DATADOC));
|
const TDate datadoc(m.get(F_DATADOC));
|
||||||
if (!datadoc.ok())
|
if (!datadoc.ok())
|
||||||
return field.error_box("La data documento deve essere comunque indicata.");
|
return field.error_box("La data documento deve essere comunque indicata.");
|
||||||
|
|
||||||
if (m.id2pos(F_DATACAMBIO1) >= 0 && !m.get(F_CODVAL).empty())
|
if (m.id2pos(F_DATACAMBIO1) >= 0 && !m.get(F_CODVAL).empty())
|
||||||
m.set(F_DATACAMBIO1, field.get(), TRUE);
|
m.set(F_DATACAMBIO1, field.get(), TRUE);
|
||||||
}
|
}
|
||||||
if (key == K_ENTER || field.to_check(key))
|
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);
|
const int annodoc = m.get_int(F_ANNO);
|
||||||
if (datadoc.year() != annodoc)
|
|
||||||
|
if (datadoc.year() != annodoc)
|
||||||
{
|
{
|
||||||
if (datadoc.ok())
|
if (datadoc.ok())
|
||||||
return field.error_box(TR("La data documento deve appartenere all'anno %d"), annodoc);
|
return field.error_box(TR("La data documento deve appartenere all'anno %d"), annodoc);
|
||||||
@ -544,6 +545,12 @@ bool data_hndl( TMask_field& field, KEY key )
|
|||||||
if (doc.good() && same_key && datadoc > doc.get_date(DOC_DATADOC))
|
if (doc.good() && same_key && datadoc > doc.get_date(DOC_DATADOC))
|
||||||
return field.error_box("Data documento superiore alla data del documento successivo");
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1896,29 +1903,22 @@ bool codart_handler(TMask_field& f, KEY key )
|
|||||||
condv.ricerca();
|
condv.ricerca();
|
||||||
|
|
||||||
const char* rdoc_prezzo = mask.doc().tipo().calcolo_lordo() ? RDOC_PREZZOL : RDOC_PREZZO;
|
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));
|
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);
|
int pos = row_mask.id2pos(id);
|
||||||
|
|
||||||
if (pos >= 0 && row_mask.fld(pos).get().blank())
|
if (pos >= 0 && row_mask.fld(pos).get().blank())
|
||||||
{
|
row_mask.fld(pos).set(cart.get_scat(i));
|
||||||
const int lognum = anamag.num();
|
|
||||||
const TFieldref fr(conai_sottocat_name(type, lognum), lognum);
|
|
||||||
row_mask.fld(pos).set(fr.read(anamag));
|
|
||||||
}
|
|
||||||
|
|
||||||
id = conai_peso_id(type);
|
id = conai_peso_id(i);
|
||||||
pos = row_mask.id2pos(id);
|
pos = row_mask.id2pos(id);
|
||||||
|
|
||||||
if (pos >= 0 && row_mask.fld(pos).get().blank())
|
if (pos >= 0 && row_mask.fld(pos).get().blank())
|
||||||
{
|
row_mask.set(id, cart.get_peso(i));
|
||||||
const int lognum = anamag.num();
|
|
||||||
const TFieldref fr(conai_peso_name(type, lognum), lognum);
|
|
||||||
row_mask.fld(pos).set(fr.read(anamag));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const int pos = row_mask.id2pos(FR_CODIVA);
|
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)
|
if (key == K_F8)
|
||||||
{
|
{
|
||||||
const TString& codart = f.mask().get(FR_CODARTMAG);
|
const TString& codart = f.mask().get(FR_CODARTMAG);
|
||||||
const TArticolo& articolo = cached_article(codart);
|
TArticolo_conai articolo(codart);
|
||||||
const TCONAI_class type = conai_id2class(f.dlg());
|
const int i = (f.dlg() - FR_CCON01)/2;
|
||||||
const TFieldref fld(conai_sottocat_name(type, LF_ANAMAG), LF_ANAMAG);
|
f.set(articolo.get_scat(i));
|
||||||
f.set(fld.read(articolo));
|
peso_conai_handler(f.mask().field(f.dlg() + 1), key);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3328,9 +3328,9 @@ bool peso_conai_handler(TMask_field& f, KEY key)
|
|||||||
if (key == K_F8)
|
if (key == K_F8)
|
||||||
{
|
{
|
||||||
const TString& codart = f.mask().get(FR_CODARTMAG);
|
const TString& codart = f.mask().get(FR_CODARTMAG);
|
||||||
const TArticolo& articolo = cached_article(codart);
|
TArticolo_conai articolo(codart);
|
||||||
const TCONAI_class type = conai_id2class(f.dlg());
|
const int i = (f.dlg() - FR_PCON01) / 2;
|
||||||
f.set(articolo.get(conai_peso_name(type, LF_ANAMAG)));
|
f.set(articolo.get_peso(i).string());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -50,9 +50,8 @@ bool reportba8_hndl(TMask_field& f, KEY key);
|
|||||||
|
|
||||||
bool is_tipodoc_ok(const TString & tipodoc);
|
bool is_tipodoc_ok(const TString & tipodoc);
|
||||||
|
|
||||||
TCONAI_class conai_id2class(short id);
|
short conai_peso_id(int cc);
|
||||||
short conai_peso_id(TCONAI_class cc);
|
short conai_sottocat_id(int cc);
|
||||||
short conai_sottocat_id(TCONAI_class cc);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -109,22 +109,30 @@
|
|||||||
|
|
||||||
//campi CONAI
|
//campi CONAI
|
||||||
|
|
||||||
#define FR_SCAACC 167
|
#define FR_CCON01 167
|
||||||
#define FR_PUNACC 168
|
#define FR_PCON01 168
|
||||||
#define FR_SCAALL 169
|
#define FR_CCON02 169
|
||||||
#define FR_PUNALL 170
|
#define FR_PCON02 170
|
||||||
#define FR_SCACAR 171
|
#define FR_CCON03 171
|
||||||
#define FR_PUNCAR 172
|
#define FR_PCON03 172
|
||||||
#define FR_SCAPLA 173
|
#define FR_CCON04 173
|
||||||
#define FR_PUNPLA 174
|
#define FR_PCON04 174
|
||||||
#define FR_SCALEG 175
|
#define FR_CCON05 175
|
||||||
#define FR_PUNLEG 176
|
#define FR_PCON05 176
|
||||||
#define FR_SCAVET 177
|
#define FR_CCON06 177
|
||||||
#define FR_PUNVET 178
|
#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
|
// Ultimo campo fittizio
|
||||||
#define FR_END 179
|
#define FR_END 187
|
||||||
|
|
||||||
#define MAX_COLUMNS FR_END-FR_LORDO
|
#define MAX_COLUMNS FR_END-FR_LORDO
|
||||||
|
|
||||||
#define FR_DESMAG 270
|
#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
|
PAGE "Pag.4" -1 -1 MASK_WIDTH MASK_HEIGHT
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 78 8
|
GROUPBOX DLG_NULL 78 12
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 0 "CONAI"
|
PROMPT 1 0 "CONAI"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING FR_SCAACC 4
|
STRING FR_CCON01 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 1 "Sottocategoria ACCIAIO "
|
PROMPT 2 1 "Sottocategoria 1 "
|
||||||
USE &SCC SELECT CODTAB[1,2]=="AC"
|
USE &SCC
|
||||||
INPUT CODTAB FR_SCAACC
|
INPUT CODTAB FR_CCON01
|
||||||
DISPLAY "Sottocategoria" CODTAB[3,4]
|
DISPLAY "Sottocategoria" CODTAB
|
||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
OUTPUT FR_SCAACC CODTAB
|
OUTPUT FR_CCON01 CODTAB
|
||||||
FIELD CONSCACC
|
FIELD CCON(1)
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER FR_PUNACC 13 5
|
NUMBER FR_PCON01 13 5
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 40 1 "Peso unitario "
|
PROMPT 40 1 "Peso unitario "
|
||||||
FIELD CONPUACC
|
FIELD PCON(1)
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING FR_SCAALL 4
|
STRING FR_CCON02 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 2 "Sottocategoria ALLUMINIO "
|
PROMPT 2 2 "Sottocategoria 2 "
|
||||||
USE &SCC SELECT CODTAB[1,2]=="AL"
|
USE &SCC
|
||||||
INPUT CODTAB FR_SCAALL
|
INPUT CODTAB FR_CCON02
|
||||||
COPY DISPLAY FR_SCAACC
|
COPY DISPLAY FR_CCON01
|
||||||
OUTPUT FR_SCAALL CODTAB
|
OUTPUT FR_CCON02 CODTAB
|
||||||
FIELD CONSCALL
|
FIELD CCON(2)
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER FR_PUNALL 13 5
|
NUMBER FR_PCON02 13 5
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 40 2 "Peso unitario "
|
PROMPT 40 2 "Peso unitario "
|
||||||
FIELD CONPUALL
|
FIELD PCON(2)
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING FR_SCACAR 4
|
STRING FR_CCON03 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 3 "Sottocategoria CARTA "
|
PROMPT 2 3 "Sottocategoria 3 "
|
||||||
USE &SCC SELECT CODTAB[1,2]=="CA"
|
USE &SCC
|
||||||
INPUT CODTAB FR_SCACAR
|
INPUT CODTAB FR_CCON03
|
||||||
COPY DISPLAY FR_SCAACC
|
COPY DISPLAY FR_CCON01
|
||||||
OUTPUT FR_SCACAR CODTAB
|
OUTPUT FR_CCON03 CODTAB
|
||||||
FIELD CONSCCAR
|
FIELD CCON(3)
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER FR_PUNCAR 13 5
|
NUMBER FR_PCON03 13 5
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 40 3 "Peso unitario "
|
PROMPT 40 3 "Peso unitario "
|
||||||
FIELD CONPUCAR
|
FIELD PCON(3)
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING FR_SCAPLA 4
|
STRING FR_CCON04 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 4 "Sottocategoria PLASTICA "
|
PROMPT 2 4 "Sottocategoria 4 "
|
||||||
USE &SCC SELECT CODTAB[1,2]=="PL"
|
USE &SCC SELECT CODTAB[1,2]=="PL"
|
||||||
INPUT CODTAB FR_SCAPLA
|
INPUT CODTAB FR_CCON04
|
||||||
COPY DISPLAY FR_SCAACC
|
COPY DISPLAY FR_CCON01
|
||||||
OUTPUT FR_SCAPLA CODTAB
|
OUTPUT FR_CCON04 CODTAB
|
||||||
FIELD CONSCPLA
|
FIELD CCON(4)
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER FR_PUNPLA 13 5
|
NUMBER FR_PCON04 13 5
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 40 4 "Peso unitario "
|
PROMPT 40 4 "Peso unitario "
|
||||||
FIELD CONPUPLA
|
FIELD PCON(4)
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING FR_SCALEG 4
|
STRING FR_CCON05 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 5 "Sottocategoria LEGNO "
|
PROMPT 2 5 "Sottocategoria 5 "
|
||||||
USE &SCC SELECT CODTAB[1,2]=="LE"
|
USE &SCC
|
||||||
INPUT CODTAB FR_SCALEG
|
INPUT CODTAB FR_CCON05
|
||||||
COPY DISPLAY FR_SCAACC
|
COPY DISPLAY FR_CCON01
|
||||||
OUTPUT FR_SCALEG CODTAB
|
OUTPUT FR_CCON05 CODTAB
|
||||||
FIELD CONSCLEG
|
FIELD CCON(5)
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER FR_PUNLEG 13 5
|
NUMBER FR_PCON05 13 5
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 40 5 "Peso unitario "
|
PROMPT 40 5 "Peso unitario "
|
||||||
FIELD CONPULEG
|
FIELD PCON(5)
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING FR_SCAVET 4
|
STRING FR_CCON06 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 6 "Sottocategoria VETRO "
|
PROMPT 2 6 "Sottocategoria 6 "
|
||||||
USE &SCC SELECT CODTAB[1,2]=="VE"
|
USE &SCC
|
||||||
INPUT CODTAB FR_SCAVET
|
INPUT CODTAB FR_CCON06
|
||||||
COPY DISPLAY FR_SCAACC
|
COPY DISPLAY FR_CCON01
|
||||||
OUTPUT FR_SCAVET CODTAB
|
OUTPUT FR_CCON06 CODTAB
|
||||||
FIELD CONSCVET
|
FIELD CCON(6)
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER FR_PUNVET 13 5
|
NUMBER FR_PCON06 13 5
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 40 6 "Peso unitario "
|
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
|
END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef FULL_SCREEN
|
#ifndef FULL_SCREEN
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user