Patch level : 12.0 638
Files correlati : ve,li Commento : - Corretto ordinamento lettere di intento nella mappa - Creata funzione make_key - Cambiato cast in ve0100
This commit is contained in:
parent
17cb208fea
commit
e1ae493ddf
@ -6,6 +6,13 @@
|
||||
#define SOLUZIONE_UNICA 1
|
||||
#define FINO_A_PLAFOND 2
|
||||
|
||||
const TString make_key(const int anno, const int numplaf)
|
||||
{
|
||||
static TString key;
|
||||
key.cut(0).format("%04d|%06d", anno, numplaf);
|
||||
return key;
|
||||
}
|
||||
|
||||
void TLi_manager::elabTipiStati()
|
||||
{
|
||||
createTipiStati(tipi, stati);
|
||||
@ -178,7 +185,7 @@ const TToken_string& TLi_manager::incrPlaf(TDocumento& d, real impNC, const bool
|
||||
lePlafs.add(thisPlaf, i);
|
||||
|
||||
// Aggiungo a plafond
|
||||
static TString key; key.cut(0) << thisPlaf.get(_planno) << "|" << thisPlaf.get(_plnumprot);
|
||||
const TString key = make_key(thisPlaf.get_int(_planno), thisPlaf.get_int(_plnumprot));
|
||||
|
||||
if(plafondi.find(key) != plafondi.end())
|
||||
{
|
||||
@ -306,7 +313,7 @@ const TToken_string& TLi_manager::stornaDoc(const TDocumento& d, real impDC, con
|
||||
for(int i = 0; i < plafs.items() && impDC > ZERO; i++)
|
||||
{
|
||||
TToken_string thisPlafond = plafs.get(i);
|
||||
static TString key; key.cut(0) << thisPlafond.get(_planno) << "|" << thisPlafond.get(_plnumprot);
|
||||
const TString key = make_key(thisPlafond.get_int(_planno), thisPlafond.get_int(_plnumprot));
|
||||
real thisImporto = thisPlafond.get(_plimporto);
|
||||
if(totale)
|
||||
{
|
||||
@ -462,8 +469,7 @@ void TLi_manager::elabPlafond()
|
||||
iniDicInt = row.get_date("DAL");
|
||||
|
||||
// Aggiungo il plafond trovato all'elenco dei plafond
|
||||
static TString key;
|
||||
key.cut(0) << row.get("ANNO") << "|" << row.get("NUMPROT");
|
||||
const TString key = make_key(row.get_int("ANNO"), row.get_int("NUMPROT"));
|
||||
plafondi.insert(std::pair<TString,real>(key, row.get_real("IMPORTO")));
|
||||
|
||||
// Aggiungo il valore del plafond al totale
|
||||
@ -515,7 +521,7 @@ const real TLi_manager::elabPlaRes(TToken_string t, TToken_string s, TDate ad)
|
||||
for(int j = 0; j < plaf.items(); j++)
|
||||
{
|
||||
TToken_string thePla(plaf.get(j));
|
||||
static TString key; key.cut(0) << thePla.get(_planno) << "|" << thePla.get(_plnumprot);
|
||||
const TString key = make_key(thePla.get_int(_planno), thePla.get_int(_plnumprot));
|
||||
static TString chiusura; chiusura.cut(0) << thePla.get(_plchiusura); // La get ritorna un const char*
|
||||
if(din[i].tipo().nota_credito())
|
||||
{
|
||||
@ -652,7 +658,7 @@ bool TLi_manager::checkUtilizzo(TDocumento& d, real impNC)
|
||||
for(int i = 0; i < lePlafs.items() && ok; i++)
|
||||
{
|
||||
TToken_string thisPlaf(lePlafs.get(i));
|
||||
static TString key; key.cut(0) << thisPlaf.get(_planno) << "|" << thisPlaf.get(_plnumprot);
|
||||
const TString key = make_key(thisPlaf.get_int(_planno), thisPlaf.get_int(_plnumprot));
|
||||
if(plafondi.find(key) != plafondi.end())
|
||||
{
|
||||
ok = plafondi[key] > static_cast<real>(lePlafs.get(_plimporto));
|
||||
@ -797,7 +803,7 @@ bool generaLiStorico(TDate dataIni)
|
||||
if(impLI >= utilizzato)
|
||||
{
|
||||
// Creo la chiave da scrivere e metto tutto dentro
|
||||
TString key; key << rletint.get("ANNO") << "|" << rletint.get("NUMPROT") << "|" << utilizzato.string();
|
||||
const TString key = make_key(rletint.get_int("ANNO"), rletint.get_int("NUMPROT"));
|
||||
din[i].put("PLAFOND", key);
|
||||
din[i].rewrite();
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
enum plafStruct { _planno, _plnumprot, _plimporto, _plchiusura, _plNC };
|
||||
|
||||
@ -38,6 +39,7 @@ class TLi_manager : TObject
|
||||
const TString codivaDef;
|
||||
const TString codivaAlt;
|
||||
// Elenco di plafond con eventuale
|
||||
// Chiave ANNO|NUMERO(6)
|
||||
std::map<TString, real> plafondi;
|
||||
std::map<int, TString> modifiche; // Progressivo, TToken_string(chiave,stato);
|
||||
void elabTipiStati(); // Preparo due token string con tipi[0] -> stati[0], ...
|
||||
|
@ -1323,7 +1323,7 @@ int TMotore_application::checkPlafondWrite(TDocumento& d)
|
||||
|
||||
real plaUtil = ZERO;
|
||||
|
||||
for (TRiepilogo_iva * totali = (TRiepilogo_iva *) tabIva.get(); totali != NULL; totali = (TRiepilogo_iva *) tabIva.get())
|
||||
for (TRiepilogo_iva * totali = static_cast<TRiepilogo_iva *>(tabIva.get()); totali != NULL; totali = static_cast<TRiepilogo_iva *>(tabIva.get()))
|
||||
{
|
||||
if(plafond.checkIva(totali->cod_iva().codice())) // Se l'iva del documento è diversa non mi interessa
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user