Patch level : 12.0 344
Files correlati : li Commento : - Aggiunto una virgoletta al menù - Sistemata lilib01 per accogliere i controlli di ve0 - Tolti i puntatori da lilib01 git-svn-id: svn://10.65.10.50/branches/R_10_00@23627 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
269e2cd65b
commit
2dc99bfc17
@ -109,7 +109,9 @@ void TResDI_app::elab(TResDI_mask& m)
|
||||
TString msg;
|
||||
msg << "\nDichiarazione di intento cliente N." << row_clifo.get_long("CODCF") << "\nRagione sociale: " << row_clifo.get("RAGSOC") << "\nPlafond totale: " << static_cast<TCurrency>(plafond).string() << "€\n";
|
||||
log.log(0, msg);
|
||||
msg = TString("Plafond disponibile: ") << static_cast<TCurrency>(resPlafond).string() << "€\n";
|
||||
msg = TString("Plafond disponibile: ") << static_cast<TCurrency>(resPlafond).string() << "€";
|
||||
log.log(0, msg);
|
||||
msg = TString("Tipo dichiarazione: ") << (currentCli.isSoluzione() ? "Singola\n" : "A concorrenza\n");
|
||||
log.log(0, msg);
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,19 @@
|
||||
#include "lilib01.h"
|
||||
#include <recarray.h>
|
||||
|
||||
#define FINO_A_PLAFOND 2
|
||||
#define SOLUZIONE_UNICA 1
|
||||
#define FINO_A_PLAFOND 2
|
||||
|
||||
void TLi_manager::elabTipiStati(TToken_string& tipi, TToken_string& stati)
|
||||
{
|
||||
for(int i = 0; i < tipidoc->items(); i++)
|
||||
for(int i = 0; i < tipidoc.items(); i++)
|
||||
{
|
||||
TToken_string statidoc(ini_get_string(CONFIG_DITTA, "li", tipidoc->get(i)), ',');
|
||||
TString app("");
|
||||
tipidoc.get(i, app);
|
||||
TToken_string statidoc(ini_get_string(CONFIG_DITTA, "li", app), ',');
|
||||
for(int j = statidoc.get_int(0); j <= statidoc.get_int(1); j++)
|
||||
{
|
||||
tipi.add(tipidoc->get(i));
|
||||
tipi.add(app);
|
||||
stati.add(j);
|
||||
}
|
||||
}
|
||||
@ -22,8 +25,9 @@ void TLi_manager::elabPlafond()
|
||||
TRectype filtro(letint.curr());
|
||||
filtro.add("CODCLI", codcli);
|
||||
|
||||
if(year != -1)
|
||||
filtro.add("ANNO", year);
|
||||
if(year == -1)
|
||||
year = TDate(TODAY).year();
|
||||
filtro.add("ANNO", year);
|
||||
|
||||
// Creo un cursore ordinato e prelevo la prima riga non chiusa
|
||||
TSorted_cursor c_dicint(&letint, "ANNO-|NUMPROT-", "", 2, &filtro, &filtro);
|
||||
@ -39,8 +43,9 @@ void TLi_manager::elabPlafond()
|
||||
if(!row.get_bool("CHIUSA"))
|
||||
{
|
||||
done = true;
|
||||
if(row.get_int("TIPOOP") != FINO_A_PLAFOND) continue;
|
||||
if(row.get_int("TIPOOP") != FINO_A_PLAFOND && row.get_int("TIPOOP") != SOLUZIONE_UNICA) continue;
|
||||
|
||||
if(row.get_int("TIPOOP") == SOLUZIONE_UNICA) soluzione = true;
|
||||
year = row.get_int("ANNO");
|
||||
iniDicInt = row.get_date("VSDATA");
|
||||
plafond = row.get_real("IMPORTO");
|
||||
@ -85,11 +90,18 @@ const real TLi_manager::elabPlaRes(TToken_string tipi, TToken_string stati)
|
||||
int anno = din[i].anno();
|
||||
TRiepilogo_iva * totali = dynamic_cast<TRiepilogo_iva *>(tabIva.get());
|
||||
|
||||
if(totali->cod_iva().codice() == *codiva)
|
||||
if(totali->cod_iva().codice() == codiva)
|
||||
{
|
||||
resPlafond -= cache().get("%TIP", din[i].tipo().codice()).get_bool("B7") ? -totali->imp_orig() : totali->imp_orig();
|
||||
}
|
||||
if(resPlafond < 0) break;
|
||||
//if(resPlafond < 0) break;
|
||||
|
||||
// Nel caso il plafond trovato fosse una soluzione unica e ho già trovato dei documenti vuol dire che il plafond non è più valido
|
||||
if(soluzione)
|
||||
{
|
||||
resPlafond = -UNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return resPlafond;
|
||||
@ -107,11 +119,8 @@ bool TLi_manager::testPlafond(TLista_documenti dout, TLog_report& lerr)
|
||||
for(int i = 0; i < dout.items(); i++)
|
||||
{
|
||||
TAssoc_array tabIva = dout[i].tabella_iva(true);
|
||||
TString numerazione = dout[i].numerazione();
|
||||
int numdoc = dout[i].numero();
|
||||
int anno = dout[i].anno();
|
||||
TRiepilogo_iva * totali = static_cast<TRiepilogo_iva *>(tabIva.get());
|
||||
if(totali->cod_iva().codice() == *codiva)
|
||||
if(totali->cod_iva().codice() == codiva)
|
||||
{
|
||||
resPlafond -= totali->imp_orig();
|
||||
totFatt += totali->imp_orig();
|
||||
@ -131,16 +140,14 @@ bool TLi_manager::testPlafond(TLista_documenti dout, TLog_report& lerr)
|
||||
|
||||
// TIPOCF, CODCLI, ANNO
|
||||
TLi_manager::TLi_manager(const char t, const long c, int y)
|
||||
: tipocf(t), codcli(c), year(y), iniDicInt(), plafond(-UNO), validPlafond(false)
|
||||
: tipocf(t), codcli(c), year(y), iniDicInt(),
|
||||
tipidoc(ini_get_string(CONFIG_DITTA, "li", "TIPIDOC")), codiva(ini_get_string(CONFIG_DITTA, "li", "CODIVA")),
|
||||
plafond(-UNO), validPlafond(false), soluzione(false)
|
||||
{
|
||||
tipidoc = new TToken_string(ini_get_string(CONFIG_DITTA, "li", "TIPIDOC"));
|
||||
elabPlafond();
|
||||
// Estrapolo il codice iva
|
||||
codiva = new TString(ini_get_string(CONFIG_DITTA, "li", "CODIVA"));
|
||||
}
|
||||
|
||||
TLi_manager::~TLi_manager()
|
||||
TLi_manager::~TLi_manager() // Perchè se lo sposto nel file .h il programma crasha?
|
||||
{
|
||||
delete codiva;
|
||||
delete tipidoc;
|
||||
|
||||
}
|
@ -20,15 +20,16 @@
|
||||
class TLi_manager : TObject
|
||||
{
|
||||
bool validPlafond;
|
||||
bool soluzione;
|
||||
int year;
|
||||
const char tipocf;
|
||||
const long codcli;
|
||||
|
||||
TDate iniDicInt;
|
||||
TToken_string* tipidoc;
|
||||
real plafond;
|
||||
|
||||
TString* codiva;
|
||||
const TToken_string tipidoc;
|
||||
const TString codiva;
|
||||
|
||||
void elabTipiStati(TToken_string& tipi, TToken_string& stati); // Preparo due token string con le tipi[0] -> stati[0], ...
|
||||
|
||||
@ -41,6 +42,7 @@ public:
|
||||
bool hasValidPlafond() { return validPlafond; } // Ritorno se il plafond è valido
|
||||
bool testPlafond(TLista_documenti dout, TLog_report& lerr); // Testo se con i documenti passati supero il plafond
|
||||
bool checkModule(); // Controllo se il modulo è attivo
|
||||
bool isSoluzione() { return soluzione; } // Ritorna se è una dichiarazione di tipo soluzione
|
||||
|
||||
// Costructors/Destructors
|
||||
TLi_manager(const char t, const long c, int y = -1);
|
||||
|
@ -5,6 +5,6 @@ Module = 16
|
||||
Flags = "F"
|
||||
Item_01 = "Dichiarazioni d'intento", "li0 -3", ""
|
||||
Item_02 = "Stampa dichiarazioni", "li0 -4", ""
|
||||
Item_03 = "Riepilogo dichiarazioni", li0 -1", ""
|
||||
Item_03 = "Riepilogo dichiarazioni", "li0 -1", ""
|
||||
Item_03 = "Impostazioni", "li0 -2", ""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user