1997-06-19 14:33:52 +00:00
|
|
|
|
// Esercizi contabili e registri IVA
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
#include "cglib01.h"
|
|
|
|
|
|
2002-12-20 17:08:30 +00:00
|
|
|
|
#include <diction.h>
|
1997-06-19 14:33:52 +00:00
|
|
|
|
#include <mask.h>
|
2007-03-30 13:51:17 +00:00
|
|
|
|
#include <tabutil.h>
|
1999-04-06 15:34:39 +00:00
|
|
|
|
#include <recarray.h>
|
2012-06-18 14:10:20 +00:00
|
|
|
|
#include <recset.h>
|
2006-04-14 12:00:25 +00:00
|
|
|
|
#include <relation.h>
|
1996-11-29 14:58:01 +00:00
|
|
|
|
|
2010-06-01 15:37:01 +00:00
|
|
|
|
#include <clifo.h>
|
2006-12-13 16:22:33 +00:00
|
|
|
|
#include <comuni.h>
|
2012-06-18 14:10:20 +00:00
|
|
|
|
#include <mov.h>
|
1998-05-04 07:43:58 +00:00
|
|
|
|
#include <pconti.h>
|
2012-06-18 14:10:20 +00:00
|
|
|
|
#include <causali.h>
|
2010-06-01 15:37:01 +00:00
|
|
|
|
#include <rcausali.h>
|
1998-05-04 07:43:58 +00:00
|
|
|
|
#include <rmoviva.h>
|
2007-03-30 13:51:17 +00:00
|
|
|
|
#include <rmov.h>
|
|
|
|
|
|
|
|
|
|
#include "comuni.h"
|
1998-05-04 07:43:58 +00:00
|
|
|
|
|
1995-07-21 10:12:15 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
1997-06-19 14:33:52 +00:00
|
|
|
|
// Gestione Tabella esercizi
|
1995-07-21 10:12:15 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
TArray TEsercizi_contabili::_esercizi;
|
|
|
|
|
long TEsercizi_contabili::_firm = 0;
|
|
|
|
|
|
|
|
|
|
TEsercizio::TEsercizio(const TRectype& rec)
|
|
|
|
|
{
|
2011-07-05 16:08:26 +00:00
|
|
|
|
_codice = rec.get_int("CODTAB");
|
|
|
|
|
_inizio = rec.get("D0");
|
|
|
|
|
_fine = rec.get("D1");
|
|
|
|
|
_scarico = rec.get("D2");
|
|
|
|
|
_chiusura = rec.get("D3");
|
1997-06-19 14:33:52 +00:00
|
|
|
|
_chiusura_mag = rec.get("D4");
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
int TEsercizio::compare(const TSortable& s) const
|
|
|
|
|
{
|
|
|
|
|
const TEsercizio& e = (const TEsercizio&)s;
|
|
|
|
|
int c = 0;
|
|
|
|
|
if (_inizio != e._inizio)
|
|
|
|
|
c = _inizio > e._inizio ? +1 : -1;
|
2012-09-04 12:40:50 +00:00
|
|
|
|
return c;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
2012-06-18 14:10:20 +00:00
|
|
|
|
const TDate& TEsercizio::chiusura() const
|
|
|
|
|
{
|
|
|
|
|
if (!_chiusura.ok() && fine() < TDate(TODAY))
|
|
|
|
|
{
|
|
|
|
|
TAssoc_array chiusure; // Lista delle causali di chiusura (solitamente una!)
|
|
|
|
|
TISAM_recordset caus("USE CAUS SELECT MOVAP='C'");
|
|
|
|
|
for (bool ok = caus.move_first(); ok; ok = caus.move_next())
|
|
|
|
|
{
|
|
|
|
|
const TString& codcaus = caus.get(CAU_CODCAUS).as_string();
|
|
|
|
|
chiusure.add(codcaus, codcaus);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TDate presto = fine(); // Prima data utile per chiusura esercizio
|
|
|
|
|
TDate tardi = presto; tardi.addyear(); // Ultima data utile per chiusura esercizio
|
|
|
|
|
|
|
|
|
|
TString query;
|
|
|
|
|
query = "USE MOV KEY 2";
|
|
|
|
|
if (chiusure.items() == 1)
|
|
|
|
|
{
|
|
|
|
|
const TString& codcaus = *(TString*)chiusure.first_item();
|
|
|
|
|
query << " SELECT CODCAUS='" << codcaus << '\'';
|
|
|
|
|
}
|
|
|
|
|
query << "\nFROM DATAREG=#PRESTO\nTO DATAREG=#TARDI";
|
|
|
|
|
TISAM_recordset mov(query);
|
|
|
|
|
mov.set_var("#PRESTO", presto);
|
|
|
|
|
mov.set_var("#TARDI", tardi);
|
|
|
|
|
for (bool ok = mov.move_first(); ok; ok = mov.move_next())
|
|
|
|
|
{
|
|
|
|
|
const TString& codcaus = mov.get(MOV_CODCAUS).as_string();
|
|
|
|
|
if (chiusure.is_key(codcaus))
|
|
|
|
|
{
|
|
|
|
|
const TDate datacomp = mov.get(MOV_DATACOMP).as_date();
|
|
|
|
|
if (datacomp <= presto)
|
|
|
|
|
{
|
|
|
|
|
((TDate&)_chiusura) = datacomp; // Forzatura
|
|
|
|
|
TTable esc("ESC");
|
|
|
|
|
esc.put("CODTAB", codice());
|
2012-09-04 12:40:50 +00:00
|
|
|
|
if (esc.read(_isequal, _lock) == NOERR)
|
2012-06-18 14:10:20 +00:00
|
|
|
|
{
|
|
|
|
|
esc.put("D3", datacomp);
|
|
|
|
|
esc.rewrite();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return _chiusura;
|
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
TEsercizi_contabili::TEsercizi_contabili()
|
2011-07-05 16:08:26 +00:00
|
|
|
|
{ }
|
1997-06-19 14:33:52 +00:00
|
|
|
|
|
|
|
|
|
void TEsercizi_contabili::update()
|
|
|
|
|
{
|
|
|
|
|
_firm = prefix().get_codditta();
|
|
|
|
|
_esercizi.destroy();
|
|
|
|
|
TTable tab_esc("ESC");
|
|
|
|
|
for (int err = tab_esc.first(); err == NOERR; err = tab_esc.next())
|
1995-07-21 10:12:15 +00:00
|
|
|
|
{
|
1997-06-19 14:33:52 +00:00
|
|
|
|
TEsercizio* e = new TEsercizio(tab_esc.curr());
|
|
|
|
|
_esercizi.add(e);
|
|
|
|
|
}
|
|
|
|
|
_esercizi.sort();
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
void TEsercizi_contabili::check()
|
|
|
|
|
{
|
|
|
|
|
if (_firm != prefix().get_codditta())
|
|
|
|
|
update();
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
int TEsercizi_contabili::date2index(const TDate& d) const
|
|
|
|
|
{
|
2006-02-09 16:50:35 +00:00
|
|
|
|
int i = -1;
|
|
|
|
|
if (d.ok())
|
|
|
|
|
{
|
|
|
|
|
check();
|
|
|
|
|
for (i = items()-1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
const TEsercizio& e = esc(i);
|
|
|
|
|
if (d >= e.inizio() && d <= e.fine())
|
|
|
|
|
break;
|
|
|
|
|
}
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
return i;
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
int TEsercizi_contabili::esc2index(int codice) const
|
|
|
|
|
{
|
2006-02-09 16:50:35 +00:00
|
|
|
|
int i = -1;
|
|
|
|
|
if (codice > 0)
|
|
|
|
|
{
|
|
|
|
|
check();
|
|
|
|
|
for (i = items()-1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
const TEsercizio& e = esc(i);
|
|
|
|
|
if (codice == e.codice())
|
|
|
|
|
break;
|
|
|
|
|
}
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
return i;
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
int TEsercizi_contabili::date2esc(const TDate& d) const
|
|
|
|
|
{
|
|
|
|
|
const int i = date2index(d);
|
|
|
|
|
return i >= 0 ? esc(i).codice() : 0;
|
|
|
|
|
}
|
1996-11-29 14:58:01 +00:00
|
|
|
|
|
2001-05-01 08:17:07 +00:00
|
|
|
|
int TEsercizi_contabili::date2prevesc(const TDate& d) const
|
|
|
|
|
{
|
|
|
|
|
const int i = date2index(d);
|
|
|
|
|
return i > 0 ? esc(i - 1).codice() : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TEsercizi_contabili::date2nextesc(const TDate& d) const
|
|
|
|
|
{
|
|
|
|
|
const int i = date2index(d);
|
2011-07-05 16:08:26 +00:00
|
|
|
|
return i >= 0 && i < items()-1 ? esc(i+1).codice() : 0;
|
2001-05-01 08:17:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
int TEsercizi_contabili::first() const
|
|
|
|
|
{
|
|
|
|
|
check();
|
|
|
|
|
return items() ? esc(0).codice() : 0;
|
|
|
|
|
}
|
1996-11-29 14:58:01 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
int TEsercizi_contabili::last() const
|
1995-07-21 10:12:15 +00:00
|
|
|
|
{
|
1997-06-19 14:33:52 +00:00
|
|
|
|
check();
|
|
|
|
|
return items() ? esc(items()-1).codice() : 0;
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-02 16:21:23 +00:00
|
|
|
|
// Certified 99%
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int TEsercizi_contabili::last_mag() const
|
|
|
|
|
{
|
2002-07-02 16:21:23 +00:00
|
|
|
|
check();
|
2004-04-28 20:36:21 +00:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = items()-1; i >= 0; i--)
|
2002-07-02 16:21:23 +00:00
|
|
|
|
{
|
|
|
|
|
const TEsercizio& e = esc(i);
|
|
|
|
|
if (e.chiusura_mag().ok())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return esc(i+1).codice();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
int TEsercizi_contabili::pred(int codice) const
|
1995-07-21 10:12:15 +00:00
|
|
|
|
{
|
1997-06-19 14:33:52 +00:00
|
|
|
|
const int i = esc2index(codice);
|
|
|
|
|
return i > 0 ? esc(i-1).codice() : 0;
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
int TEsercizi_contabili::next(int anno) const
|
|
|
|
|
{
|
|
|
|
|
const int i = esc2index(anno);
|
|
|
|
|
return i < items()-1 ? esc(i+1).codice() : 0;
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
bool TEsercizi_contabili::exist(int codice) const
|
|
|
|
|
{
|
|
|
|
|
const int i = esc2index(codice);
|
|
|
|
|
return i >= 0;
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
const TEsercizio& TEsercizi_contabili::esercizio(int codice) const
|
|
|
|
|
{
|
2006-02-08 13:09:34 +00:00
|
|
|
|
int i = esc2index(codice);
|
|
|
|
|
if (i < 0 && codice > 0)
|
|
|
|
|
{
|
2007-02-07 10:09:59 +00:00
|
|
|
|
error_box(FR("Attenzione! E' necessario aprire l'esercizio %d"), codice);
|
2006-02-08 13:09:34 +00:00
|
|
|
|
const int last_index = items()-1;
|
|
|
|
|
if (last_index >= 0)
|
|
|
|
|
{
|
|
|
|
|
TRectype rec(LF_TAB); rec.settab("ESC");
|
|
|
|
|
const TEsercizio& last = esc(last_index);
|
|
|
|
|
const int last_code = last.codice();
|
|
|
|
|
for (int k = last_code+1; k <= codice; k++)
|
|
|
|
|
{
|
|
|
|
|
rec.put("CODTAB", k);
|
|
|
|
|
TDate ini = last.inizio(); ini.set_year(ini.year()+k-last_code);
|
|
|
|
|
TDate fin = last.fine(); fin.set_year(fin.year()+k-last_code);
|
|
|
|
|
rec.put("D0", ini);
|
|
|
|
|
rec.put("D1", fin);
|
|
|
|
|
_esercizi.add(new TEsercizio(rec));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (codice > 2000)
|
|
|
|
|
{
|
|
|
|
|
TRectype rec(LF_TAB); rec.settab("ESC");
|
|
|
|
|
rec.put("CODTAB", codice);
|
|
|
|
|
rec.put("D0", TDate(1,1,codice));
|
|
|
|
|
rec.put("D1", TDate(31,12,codice));
|
|
|
|
|
_esercizi.add(new TEsercizio(rec));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
i = esc2index(codice); // Dovrei ritrovare l'ultimo
|
|
|
|
|
}
|
1997-06-19 14:33:52 +00:00
|
|
|
|
return esc(i);
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-09 16:50:35 +00:00
|
|
|
|
bool TEsercizi_contabili::code2range(int codice, TDate& dal, TDate& al) const
|
|
|
|
|
{
|
|
|
|
|
bool ok = exist(codice);
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
const TEsercizio& e = esercizio(codice);
|
|
|
|
|
dal = e.inizio();
|
|
|
|
|
al = e.fine();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-05-11 09:32:48 +00:00
|
|
|
|
const int primo_esercizio = first();
|
|
|
|
|
const int ultimo_esercizio = last();
|
|
|
|
|
if (codice < primo_esercizio)
|
|
|
|
|
{
|
|
|
|
|
const TEsercizio& e = esercizio(primo_esercizio);
|
|
|
|
|
dal = e.inizio();
|
|
|
|
|
al = e.fine();
|
|
|
|
|
dal.addyear(primo_esercizio - codice);
|
|
|
|
|
al.addyear(primo_esercizio - codice);
|
|
|
|
|
ok = true;
|
|
|
|
|
}
|
|
|
|
|
if (codice > ultimo_esercizio)
|
|
|
|
|
{
|
|
|
|
|
const TEsercizio& e = esercizio(ultimo_esercizio);
|
|
|
|
|
dal = e.inizio();
|
|
|
|
|
al = e.fine();
|
|
|
|
|
dal.addyear(codice - ultimo_esercizio);
|
|
|
|
|
al.addyear(codice - ultimo_esercizio);
|
|
|
|
|
ok = true;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-15 10:47:01 +00:00
|
|
|
|
if (!ok)
|
2006-02-09 16:50:35 +00:00
|
|
|
|
{
|
2009-07-15 10:47:01 +00:00
|
|
|
|
if(codice > 1900)
|
|
|
|
|
{
|
|
|
|
|
dal = TDate(1, 1, codice);
|
|
|
|
|
al = TDate(31, 12, codice);
|
|
|
|
|
ok = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
dal = al = TDate();
|
2006-02-09 16:50:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-30 16:56:45 +00:00
|
|
|
|
TEsercizi_contabili& esercizi()
|
2008-10-07 00:50:22 +00:00
|
|
|
|
{
|
|
|
|
|
HIDDEN TEsercizi_contabili __esercizi;
|
|
|
|
|
return __esercizi;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-13 17:56:02 +00:00
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
|
// Simpatici metodi jolly
|
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
const char* iva2name(TipoIVA iva)
|
|
|
|
|
{
|
|
|
|
|
const char* i;
|
|
|
|
|
switch(iva)
|
|
|
|
|
{
|
|
|
|
|
case nessuna_iva:
|
2002-12-20 17:08:30 +00:00
|
|
|
|
i = TR("Nessuna IVA"); break;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
case iva_acquisti:
|
2002-12-20 17:08:30 +00:00
|
|
|
|
i = TR("IVA Acquisti"); break;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
case iva_vendite:
|
2002-12-20 17:08:30 +00:00
|
|
|
|
i = TR("IVA Vendite"); break;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
case iva_generica:
|
2002-12-20 17:08:30 +00:00
|
|
|
|
i = TR("IVA Generica"); break;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
default:
|
2002-12-20 17:08:30 +00:00
|
|
|
|
i = TR("IVA ERRATA!"); break;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
return i;
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-04-13 17:56:02 +00:00
|
|
|
|
const TString& cap2comune(const TString& cap, const TString& denom)
|
|
|
|
|
{
|
2013-02-07 14:28:26 +00:00
|
|
|
|
TString80 up_denom = denom;
|
|
|
|
|
up_denom.upper();
|
|
|
|
|
TString4 codone;
|
|
|
|
|
|
|
|
|
|
if (cap.len() == 5 && up_denom.full())
|
2007-03-07 10:11:15 +00:00
|
|
|
|
{
|
|
|
|
|
TString8 cappone = cap;
|
|
|
|
|
if (cappone[2] == '1') //e' un capoluogo di provincia
|
|
|
|
|
cappone.overwrite("00", 3, 2);
|
2006-04-13 17:56:02 +00:00
|
|
|
|
|
2007-03-07 10:11:15 +00:00
|
|
|
|
TRelation relcom(LF_COMUNI);
|
|
|
|
|
TRectype& comrec = relcom.curr();
|
2008-03-11 16:48:19 +00:00
|
|
|
|
comrec.put(COM_CAPCOM, cappone);
|
|
|
|
|
|
2007-03-07 10:11:15 +00:00
|
|
|
|
TCursor comuni (&relcom, "", 3, &comrec, &comrec);
|
|
|
|
|
const TRecnotype items = comuni.items();
|
|
|
|
|
comuni.freeze();
|
|
|
|
|
double cmp = 0.69;
|
|
|
|
|
for (comuni = 0L; comuni.pos() < items; ++comuni)
|
|
|
|
|
{
|
2008-03-11 16:48:19 +00:00
|
|
|
|
TString80 denominazione = comrec.get(COM_DENCOM);
|
|
|
|
|
denominazione.upper();
|
|
|
|
|
const double fc = xvt_str_fuzzy_compare (up_denom, denominazione);
|
2007-03-07 10:11:15 +00:00
|
|
|
|
if (fc > cmp)
|
|
|
|
|
{
|
|
|
|
|
codone = comrec.get(COM_COM);
|
|
|
|
|
cmp = fc;
|
|
|
|
|
}
|
2008-03-11 16:48:19 +00:00
|
|
|
|
}
|
2013-02-07 14:28:26 +00:00
|
|
|
|
}
|
|
|
|
|
if (codone.blank() && denom.full())
|
2013-01-04 08:09:47 +00:00
|
|
|
|
{
|
|
|
|
|
TLocalisamfile comuni(LF_COMUNI);
|
|
|
|
|
comuni.setkey(2);
|
|
|
|
|
comuni.put(COM_DENCOM, denom);
|
|
|
|
|
if (comuni.read() == NOERR)
|
2013-02-07 14:28:26 +00:00
|
|
|
|
codone = comuni.get(COM_COM);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
double cmp = 0.9;
|
|
|
|
|
comuni.zero();
|
|
|
|
|
const TString4 pref = up_denom.left(4);
|
|
|
|
|
comuni.put(COM_DENCOM, pref);
|
|
|
|
|
for (int err = comuni.read(_isgteq); err == NOERR; err = comuni.next())
|
|
|
|
|
{
|
|
|
|
|
TString80 denominazione = comuni.get(COM_DENCOM);
|
|
|
|
|
denominazione.upper();
|
|
|
|
|
if (!denominazione.starts_with(pref))
|
|
|
|
|
break;
|
2014-05-14 08:25:17 +00:00
|
|
|
|
const double fc = xvt_str_fuzzy_compare(up_denom, denominazione);
|
2013-02-07 14:28:26 +00:00
|
|
|
|
if (fc > cmp)
|
|
|
|
|
{
|
|
|
|
|
cmp = fc;
|
|
|
|
|
codone = comuni.get(COM_COM);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-03-07 10:11:15 +00:00
|
|
|
|
}
|
2013-01-04 08:09:47 +00:00
|
|
|
|
|
2013-02-07 14:28:26 +00:00
|
|
|
|
return codone.full() ? (get_tmp_string() = codone) : EMPTY_STRING;
|
2006-04-13 17:56:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-11-29 14:58:01 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
1997-06-19 14:33:52 +00:00
|
|
|
|
// Registro
|
1996-11-29 14:58:01 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
1998-05-04 07:43:58 +00:00
|
|
|
|
TRegistro::TRegistro(const char* cod, int year)
|
|
|
|
|
: _rec(LF_TAB), _att(LF_ATTIV)
|
2011-07-05 16:08:26 +00:00
|
|
|
|
{ read(cod, year); }
|
1996-11-29 14:58:01 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
bool TRegistro::read(const char* cod, int year)
|
|
|
|
|
{
|
|
|
|
|
if (year <= 0)
|
|
|
|
|
{
|
|
|
|
|
const TDate oggi(TODAY);
|
|
|
|
|
year = oggi.year();
|
|
|
|
|
}
|
1999-07-16 14:59:11 +00:00
|
|
|
|
if (cod == NULL)
|
|
|
|
|
cod = "";
|
1996-05-20 09:26:39 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
TString8 chiave; chiave.format("%04d%s", year, cod);
|
1999-07-16 14:59:11 +00:00
|
|
|
|
_rec = cache().get("REG", chiave);
|
1997-06-19 14:33:52 +00:00
|
|
|
|
read_att();
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1999-07-16 14:59:11 +00:00
|
|
|
|
return !_rec.empty();
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
bool TRegistro::reread()
|
1995-07-21 10:12:15 +00:00
|
|
|
|
{
|
1997-06-19 14:33:52 +00:00
|
|
|
|
if (ok())
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
const TString8 n(name());
|
1997-06-19 14:33:52 +00:00
|
|
|
|
const int y = year();
|
|
|
|
|
return read(n, y);
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
2011-07-05 16:08:26 +00:00
|
|
|
|
return false;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
int TRegistro::year() const
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
const TString& anno = _rec.get("CODTAB").left(4);
|
1997-06-19 14:33:52 +00:00
|
|
|
|
return atoi(anno);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TString& TRegistro::name() const
|
|
|
|
|
{
|
|
|
|
|
return _rec.get("CODTAB").mid(4);
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
TRegistro& TRegistro::operator =(const TRegistro& r)
|
|
|
|
|
{
|
|
|
|
|
_rec = r._rec;
|
|
|
|
|
_att = r._att;
|
|
|
|
|
_prorata = r._prorata;
|
|
|
|
|
return *this;
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
int TRegistro::tipo() const
|
1995-07-21 10:12:15 +00:00
|
|
|
|
{
|
1997-06-19 14:33:52 +00:00
|
|
|
|
const int t = _rec.get_int("I0");
|
|
|
|
|
return t;
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
bool TRegistro::corrispettivi() const
|
1995-07-21 10:12:15 +00:00
|
|
|
|
{
|
1997-06-19 14:33:52 +00:00
|
|
|
|
const bool c = _rec.get_bool("B0");
|
|
|
|
|
return c;
|
|
|
|
|
}
|
1996-11-29 14:58:01 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
TipoIVA TRegistro::iva() const
|
|
|
|
|
{
|
|
|
|
|
TipoIVA i = (TipoIVA)tipo();
|
|
|
|
|
switch (i)
|
|
|
|
|
{
|
|
|
|
|
case nessuna_iva:
|
|
|
|
|
case iva_vendite:
|
|
|
|
|
case iva_acquisti:
|
|
|
|
|
break;
|
|
|
|
|
case libro_giornale:
|
|
|
|
|
i = nessuna_iva;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2002-12-20 17:08:30 +00:00
|
|
|
|
error_box(FR("Il registro '%s' non e' un registro IVA o contabile: tipo %d"),
|
1997-06-19 14:33:52 +00:00
|
|
|
|
(const char*)name(), i);
|
|
|
|
|
i = nessuna_iva;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return i;
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
bool TRegistro::read_att()
|
|
|
|
|
{
|
1999-07-16 14:59:11 +00:00
|
|
|
|
TString16 chiave;
|
|
|
|
|
chiave << prefix().get_codditta() << '|' << attivita();
|
|
|
|
|
|
|
|
|
|
_att = cache().get(LF_ATTIV, chiave);
|
2013-07-26 15:35:51 +00:00
|
|
|
|
// Ditta - Anno - Attivit<69> - Tipo Attivit<69> (fissata a 1)
|
1997-06-19 14:33:52 +00:00
|
|
|
|
chiave.format("%05ld", prefix().get_codditta());
|
2011-07-05 16:08:26 +00:00
|
|
|
|
chiave << year(); // non fare << year() << attivita()
|
1997-06-19 14:33:52 +00:00
|
|
|
|
chiave << attivita() << "1";
|
1999-07-16 14:59:11 +00:00
|
|
|
|
|
1997-12-24 09:40:34 +00:00
|
|
|
|
_prorata.destroy();
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
2011-07-05 16:08:26 +00:00
|
|
|
|
const TRectype& pla = cache().get("%PLA", chiave);
|
1999-07-16 14:59:11 +00:00
|
|
|
|
if (!pla.empty())
|
1997-06-19 14:33:52 +00:00
|
|
|
|
{
|
1997-12-24 09:40:34 +00:00
|
|
|
|
chiave.format("%d", year());
|
|
|
|
|
_prorata.add(chiave, pla.get_real("R8"));
|
2013-07-26 15:35:51 +00:00
|
|
|
|
_att.put("TIPOATT", pla.get("S7")); // Aggiorna tipo attivit<69>
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1999-07-16 14:59:11 +00:00
|
|
|
|
return !_att.empty();
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
1996-11-29 14:58:01 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
bool TRegistro::agenzia_viaggi()
|
|
|
|
|
{
|
2011-07-05 16:08:26 +00:00
|
|
|
|
bool av = false;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
if (iva() == iva_vendite)
|
|
|
|
|
av = _att.get_bool("REG74TER");
|
|
|
|
|
return av;
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
const TString& TRegistro::tipo_attivita()
|
|
|
|
|
{
|
|
|
|
|
return _att.get("TIPOATT");
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-12-24 09:40:34 +00:00
|
|
|
|
real* TRegistro::read_prorata(int anno) const
|
|
|
|
|
{
|
2013-07-26 15:35:51 +00:00
|
|
|
|
TString16 chiave; // Ditta - Anno - Attivit<69> - Tipo Attivit<69> (fissata a 1)
|
1997-12-24 09:40:34 +00:00
|
|
|
|
chiave.format("%05ld", prefix().get_codditta());
|
|
|
|
|
chiave << anno << attivita() << "1";
|
|
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
|
real* prorata = NULL;
|
|
|
|
|
const TRectype& pla = cache().get("%PLA", chiave);
|
2003-04-08 12:57:12 +00:00
|
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
|
if (!pla.empty())
|
|
|
|
|
prorata = new real(pla.get("R8"));
|
|
|
|
|
|
1997-12-24 09:40:34 +00:00
|
|
|
|
return prorata;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
1996-11-29 14:58:01 +00:00
|
|
|
|
|
1997-12-24 09:40:34 +00:00
|
|
|
|
real TRegistro::prorata(int annodoc)
|
|
|
|
|
{
|
|
|
|
|
const int annoiva = year();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (annodoc <= 1900) annodoc = annoiva; // Test per anno documento non specificato
|
|
|
|
|
const int annopro = annoiva >= 1998 && annodoc < annoiva ? annodoc+1 : annoiva;
|
1997-12-24 09:40:34 +00:00
|
|
|
|
|
|
|
|
|
TString16 chiave; chiave << annopro;
|
|
|
|
|
real* pr = (real*)_prorata.objptr(chiave);
|
|
|
|
|
|
|
|
|
|
if (pr == NULL)
|
|
|
|
|
{
|
|
|
|
|
pr = read_prorata(annopro);
|
|
|
|
|
if (pr == NULL && annopro != annoiva)
|
1998-05-04 07:43:58 +00:00
|
|
|
|
pr = read_prorata(annoiva);
|
2002-12-20 17:08:30 +00:00
|
|
|
|
|
1997-12-24 09:40:34 +00:00
|
|
|
|
if (pr == NULL)
|
1998-05-04 07:43:58 +00:00
|
|
|
|
pr = new real(ZERO);
|
2011-07-05 16:08:26 +00:00
|
|
|
|
_prorata.add(chiave, pr, true);
|
1997-12-24 09:40:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return *pr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRegistro::set_prorata(int annodoc, const real& pro)
|
|
|
|
|
{
|
2003-02-25 14:39:02 +00:00
|
|
|
|
const int annoiva = year();
|
2015-02-24 08:26:33 +00:00
|
|
|
|
if (annodoc <= 2000) annodoc = annoiva; // Test per anno documento non specificato
|
|
|
|
|
const int annopro = annodoc < annoiva ? annodoc+1 : annoiva;
|
|
|
|
|
TString4 chiave; chiave << annopro;
|
1997-12-24 09:40:34 +00:00
|
|
|
|
_prorata.add(chiave, pro, TRUE);
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Certified 99%
|
|
|
|
|
bool TRegistro::update(long protiva, const TDate& datareg)
|
|
|
|
|
{
|
2011-07-05 16:08:26 +00:00
|
|
|
|
bool updated = true;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
|
|
|
|
|
if (protiva > _rec.get_long("I5"))
|
|
|
|
|
{
|
|
|
|
|
_rec.put("I5", protiva);
|
|
|
|
|
updated = FALSE;
|
|
|
|
|
}
|
|
|
|
|
if (datareg > _rec.get_date("D2"))
|
|
|
|
|
{
|
|
|
|
|
_rec.put("D2", datareg);
|
2011-07-05 16:08:26 +00:00
|
|
|
|
updated = false;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
if (!updated)
|
|
|
|
|
{
|
|
|
|
|
TTable reg("REG");
|
|
|
|
|
updated = reg.rewrite(_rec) == NOERR;
|
2000-10-03 13:45:12 +00:00
|
|
|
|
cache().discard(_rec); // Forza rilettura registro in cache
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return updated;
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Libro giornale
|
|
|
|
|
///////////////////////////////////////////////////////////
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
// Legge il libro giornale dell'anno specificato
|
|
|
|
|
bool TLibro_giornale::read(int y)
|
1995-07-21 10:12:15 +00:00
|
|
|
|
{
|
2011-07-05 16:08:26 +00:00
|
|
|
|
bool found = false;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
|
|
|
|
|
if (y <= 0)
|
|
|
|
|
{
|
|
|
|
|
const TDate oggi(TODAY);
|
|
|
|
|
y = oggi.year();
|
|
|
|
|
}
|
1995-10-30 10:17:14 +00:00
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
TString4 anno; anno.format("%04d", y);
|
1997-06-19 14:33:52 +00:00
|
|
|
|
TTable reg("REG");
|
|
|
|
|
reg.put("CODTAB", anno); // Cerca il primo registro dell'anno
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
for (int err = reg.read(_isgteq); err == NOERR; err = reg.next())
|
|
|
|
|
{
|
|
|
|
|
if (reg.get("CODTAB").compare(anno, 4) != 0)
|
|
|
|
|
break; // Sono arrivato all'anno dopo
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
if (reg.get_int("I0") == libro_giornale)
|
|
|
|
|
{
|
2011-07-05 16:08:26 +00:00
|
|
|
|
found = true;
|
1995-10-30 10:17:14 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
1997-06-19 14:33:52 +00:00
|
|
|
|
|
|
|
|
|
if (!found) reg.zero(); // Memorizza record (anche vuoto)
|
|
|
|
|
_rec = reg.curr();
|
|
|
|
|
|
|
|
|
|
return found;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TLibro_giornale::TLibro_giornale(int y)
|
|
|
|
|
{
|
|
|
|
|
read(y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Codice IVA
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
TCodiceIVA::TCodiceIVA(const char* cod) : TRectype(LF_TABCOM)
|
|
|
|
|
{
|
|
|
|
|
read(cod);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TCodiceIVA::read(const char* cod)
|
|
|
|
|
{
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if (cod && *cod)
|
|
|
|
|
*this = cache().get("%IVA", cod);
|
|
|
|
|
else
|
|
|
|
|
zero();
|
1999-07-16 14:59:11 +00:00
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
return !empty();
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-10-06 10:38:38 +00:00
|
|
|
|
void TCodiceIVA::round(real& n, int ndec, const char* codval) const
|
1999-07-16 14:59:11 +00:00
|
|
|
|
{
|
|
|
|
|
switch (ndec)
|
|
|
|
|
{
|
2011-10-06 10:38:38 +00:00
|
|
|
|
case AUTO_DECIMALS : ndec = (codval && *codval) ? TExchange(codval).decimals(false) : 2; break;
|
|
|
|
|
case AUTO_PRICES_DECIMALS: ndec = TExchange(codval).decimals(true); break;
|
|
|
|
|
default : break;
|
1999-07-16 14:59:11 +00:00
|
|
|
|
}
|
2011-10-06 10:38:38 +00:00
|
|
|
|
if (ndec < 10)
|
|
|
|
|
n.round(ndec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
real TCodiceIVA::imposta(const real& imponibile, int ndec, const char* codval) const
|
|
|
|
|
{
|
|
|
|
|
real iva = imponibile * percentuale() / CENTO;
|
|
|
|
|
round(iva, ndec, codval);
|
1999-07-16 14:59:11 +00:00
|
|
|
|
return iva;
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-23 14:14:55 +00:00
|
|
|
|
real TCodiceIVA::scorpora(real& lordo, int ndec, const char* codval) const
|
1997-06-19 14:33:52 +00:00
|
|
|
|
{
|
2011-10-06 10:38:38 +00:00
|
|
|
|
round(lordo, ndec, codval); // Arrotondo importo lordo
|
|
|
|
|
real imponibile = lordo * CENTO / (CENTO + percentuale());
|
|
|
|
|
round(imponibile, ndec, codval); // Arrotondo importo netto
|
|
|
|
|
const real iva = lordo - imponibile;
|
2002-10-23 14:14:55 +00:00
|
|
|
|
lordo = imponibile; // lordo <20> un reference da aggiornare con l'imponibile!
|
1999-07-16 14:59:11 +00:00
|
|
|
|
return iva;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
real TCodiceIVA::lordo(const real& imponibile, int ndec, const char* codval) const
|
2011-10-06 10:38:38 +00:00
|
|
|
|
{ return imponibile + imposta(imponibile, ndec, codval); }
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TBill
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
TBill::~TBill()
|
|
|
|
|
{
|
|
|
|
|
if (_descrizione)
|
|
|
|
|
delete _descrizione;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TBill::set_description(const char* d)
|
|
|
|
|
{
|
|
|
|
|
if (_descrizione || (d && *d))
|
|
|
|
|
{
|
|
|
|
|
if (_descrizione)
|
|
|
|
|
*_descrizione = d;
|
|
|
|
|
else
|
2000-10-03 13:45:12 +00:00
|
|
|
|
_descrizione = new TString(d);
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Certified 90%
|
|
|
|
|
const TBill& TBill::get(TToken_string& s, int from, int mode)
|
|
|
|
|
{
|
|
|
|
|
const char* first = s.get(from);
|
|
|
|
|
if (mode & 0x1)
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_tipo = first ? char(toupper(*first)) : ' ';
|
1997-06-19 14:33:52 +00:00
|
|
|
|
first = s.get();
|
|
|
|
|
} else _tipo = ' ';
|
|
|
|
|
|
|
|
|
|
#ifdef DBG
|
|
|
|
|
if (strchr(" CF", _tipo) == NULL)
|
|
|
|
|
{
|
2002-12-20 17:08:30 +00:00
|
|
|
|
error_box(FR("Tipo conto errato: '%c'"), _tipo);
|
1997-06-19 14:33:52 +00:00
|
|
|
|
_tipo = ' ';
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
_gruppo = first ? atoi(first) : 0;
|
|
|
|
|
_conto = s.get_int();
|
|
|
|
|
_sottoconto = s.get_long();
|
|
|
|
|
if (mode & 0x2)
|
|
|
|
|
set_description(s.get());
|
|
|
|
|
|
|
|
|
|
_tipo_cr = -1;
|
|
|
|
|
_sezione = ' ';
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TBill& TBill::copy(const TBill& bill)
|
|
|
|
|
{
|
|
|
|
|
_tipo = bill._tipo;
|
|
|
|
|
_gruppo = bill._gruppo;
|
|
|
|
|
_conto = bill._conto;
|
|
|
|
|
_sottoconto = bill._sottoconto;
|
|
|
|
|
set_description(bill.descrizione());
|
|
|
|
|
_tipo_cr = bill._tipo_cr;
|
|
|
|
|
_sospeso = bill._sospeso;
|
|
|
|
|
_sezione = bill._sezione;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Certified 100%
|
|
|
|
|
const TBill& TBill::set(int g, int c, long s, char t, const char* d, int r)
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_tipo = (t > ' ') ? char(toupper(t)) : ' ';
|
1997-06-19 14:33:52 +00:00
|
|
|
|
_gruppo = g;
|
|
|
|
|
_conto = c;
|
|
|
|
|
_sottoconto = s;
|
|
|
|
|
set_description(d);
|
|
|
|
|
_tipo_cr = r;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TBill& TBill::add_to(TToken_string& ts, int from, int mode)
|
|
|
|
|
{
|
|
|
|
|
if (mode & 0x4)
|
|
|
|
|
{
|
|
|
|
|
const int cr = tipo_cr();
|
|
|
|
|
if (cr > 0) ts.add(cr, from++); else ts.add(" ", from++);
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
if (mode & 0x1)
|
|
|
|
|
ts.add(_tipo, from++);
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
if (_gruppo > 0) ts.add(_gruppo, from++); else ts.add(" ", from++);
|
|
|
|
|
if (_conto > 0) ts.add(_conto, from++); else ts.add(" ", from++);
|
|
|
|
|
if (_sottoconto > 0L) ts.add(_sottoconto, from++); else ts.add(" ", from++);
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
if (mode & 0x2)
|
|
|
|
|
ts.add(descrizione(), from++);
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2010-06-01 15:37:01 +00:00
|
|
|
|
const char* TBill::field_name(int n, const TRectype& r, bool contro) const
|
1997-06-19 14:33:52 +00:00
|
|
|
|
{
|
1998-05-04 07:43:58 +00:00
|
|
|
|
CHECKD(n >= 0 && n <= 3, "Invalid bill field ", n);
|
1997-06-19 14:33:52 +00:00
|
|
|
|
|
2005-07-25 11:42:44 +00:00
|
|
|
|
const char* f = NULL;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
if (contro)
|
|
|
|
|
{
|
2010-06-01 15:37:01 +00:00
|
|
|
|
CHECKD(r.num() == LF_RMOV || r.num() == LF_PAGSCA, "Record non valido per contropartita: ", r.num());
|
1997-06-19 14:33:52 +00:00
|
|
|
|
switch(n)
|
|
|
|
|
{
|
1998-05-04 07:43:58 +00:00
|
|
|
|
case 0: f = RMV_GRUPPOC; break;
|
|
|
|
|
case 1: f = RMV_CONTOC; break;
|
|
|
|
|
case 2: f = RMV_SOTTOCONTOC; break;
|
|
|
|
|
default:f = RMV_TIPOCC; break;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch(n)
|
|
|
|
|
{
|
1998-05-04 07:43:58 +00:00
|
|
|
|
case 0: f = RMV_GRUPPO; break;
|
|
|
|
|
case 1: f = RMV_CONTO; break;
|
2010-06-01 15:37:01 +00:00
|
|
|
|
case 2:
|
|
|
|
|
if (r.num() == LF_CLIFO)
|
|
|
|
|
f = CLI_CODCF;
|
|
|
|
|
else
|
|
|
|
|
f = RMV_SOTTOCONTO;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
switch(r.num())
|
|
|
|
|
{
|
|
|
|
|
case LF_CLIFO : f = CLI_TIPOCF; break;
|
|
|
|
|
case LF_RCAUSALI: f = RCA_TIPOCF; break;
|
|
|
|
|
default : f = RMV_TIPOC; break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TBill::put(TRectype& r, bool c) const
|
|
|
|
|
{
|
2010-06-01 15:37:01 +00:00
|
|
|
|
r.put(field_name(0, r, c), gruppo());
|
|
|
|
|
r.put(field_name(1, r, c), conto());
|
|
|
|
|
r.put(field_name(2, r, c), sottoconto());
|
|
|
|
|
r.put(field_name(3, r, c), tipo());
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TBill::get(const TRectype& r, bool c)
|
|
|
|
|
{
|
2005-07-25 11:42:44 +00:00
|
|
|
|
char t = ' ';
|
2010-06-01 15:37:01 +00:00
|
|
|
|
if (r.type(field_name(3, r, c)) != _nullfld)
|
|
|
|
|
t = r.get_char(field_name(3, r, c));
|
2005-07-25 11:42:44 +00:00
|
|
|
|
|
2010-06-01 15:37:01 +00:00
|
|
|
|
set(r.get_int(field_name(0, r, c)),
|
|
|
|
|
r.get_int(field_name(1, r, c)),
|
|
|
|
|
r.get_long(field_name(2, r, c)),
|
2005-07-25 11:42:44 +00:00
|
|
|
|
t);
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
set_description(NULL);
|
|
|
|
|
_tipo_cr = -1;
|
|
|
|
|
_sezione = ' ';
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
if (r.num() == LF_RMOVIVA)
|
1998-05-04 07:43:58 +00:00
|
|
|
|
tipo_cr(r.get_int(RMI_TIPOCR));
|
1996-07-09 13:00:08 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
return ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TBill::set(TMask& m, short g, short c, short s, short t, short d) const
|
|
|
|
|
{
|
2011-10-25 15:52:53 +00:00
|
|
|
|
if (g > 0)
|
|
|
|
|
m.set(g, gruppo());
|
|
|
|
|
if (c > 0)
|
|
|
|
|
m.set(c, conto());
|
|
|
|
|
if (s > 0)
|
|
|
|
|
m.set(s, sottoconto());
|
|
|
|
|
if (t > 0)
|
1997-06-19 14:33:52 +00:00
|
|
|
|
{
|
|
|
|
|
char typ[2] = { tipo(), '\0' };
|
|
|
|
|
m.set(t, typ);
|
|
|
|
|
}
|
2011-10-25 15:52:53 +00:00
|
|
|
|
if (d > 0)
|
1997-06-19 14:33:52 +00:00
|
|
|
|
m.set(d, descrizione());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TBill::get(const TMask& m, short g, short c, short s, short t, short d)
|
|
|
|
|
{
|
|
|
|
|
const int gr = m.get_int(g);
|
|
|
|
|
const int co = m.get_int(c);
|
|
|
|
|
const long so = m.get_long(s);
|
|
|
|
|
char ti = ' ';
|
|
|
|
|
if (t)
|
|
|
|
|
ti = m.get(t)[0];
|
|
|
|
|
TString80 de;
|
|
|
|
|
if (d)
|
|
|
|
|
de = m.get(d);
|
|
|
|
|
set(gr, co, so, ti, de);
|
|
|
|
|
}
|
|
|
|
|
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
// Certified 100%
|
|
|
|
|
bool TBill::ok() const
|
1995-07-21 10:12:15 +00:00
|
|
|
|
{
|
1997-06-19 14:33:52 +00:00
|
|
|
|
return _gruppo != 0 && _conto != 0 && _sottoconto != 0L;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Certified 99%
|
|
|
|
|
int TBill::compare(const TSortable& s) const
|
|
|
|
|
{
|
|
|
|
|
CHECK(class_name()==s.class_name(), "Can't compare TBill with TObject");
|
|
|
|
|
const TBill& c = (const TBill&)s;
|
|
|
|
|
|
|
|
|
|
int res = _gruppo - c._gruppo;
|
|
|
|
|
if (res) return res;
|
|
|
|
|
|
|
|
|
|
res = _conto - c._conto;
|
|
|
|
|
if (res) return res;
|
|
|
|
|
|
|
|
|
|
const long lres = _sottoconto - c._sottoconto;
|
|
|
|
|
if (lres < 0L) res = -1; else
|
|
|
|
|
if (lres > 0L) res = +1;
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Certified 95%
|
|
|
|
|
bool TBill::find()
|
|
|
|
|
{
|
|
|
|
|
bool ok = FALSE;
|
|
|
|
|
|
|
|
|
|
if ((_tipo != 'C' && _tipo != 'F') || _sottoconto == 0L)
|
|
|
|
|
{
|
|
|
|
|
TRectype pcon(LF_PCON);
|
|
|
|
|
ok = read(pcon);
|
1998-05-04 07:43:58 +00:00
|
|
|
|
if (!ok && _sottoconto != 0L)
|
1997-06-19 14:33:52 +00:00
|
|
|
|
{
|
1998-05-04 07:43:58 +00:00
|
|
|
|
const long sotto = _sottoconto;
|
|
|
|
|
_sottoconto = 0L;
|
2001-06-25 10:41:20 +00:00
|
|
|
|
if (read(pcon))
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_tipo = char(toupper(pcon.get_char(PCN_TMCF)));
|
1998-05-04 07:43:58 +00:00
|
|
|
|
_sottoconto = sotto;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
1998-05-04 07:43:58 +00:00
|
|
|
|
}
|
1997-06-19 14:33:52 +00:00
|
|
|
|
|
1998-05-04 07:43:58 +00:00
|
|
|
|
if ((_tipo == 'C' || _tipo == 'F') && _sottoconto != 0L)
|
|
|
|
|
{
|
2003-04-08 12:57:12 +00:00
|
|
|
|
TString16 key;
|
|
|
|
|
key.format("%c|%ld", _tipo, _sottoconto);
|
2015-02-24 08:26:33 +00:00
|
|
|
|
const TRectype& clifo = cache().get(LF_CLIFO, key);
|
2003-05-14 13:12:14 +00:00
|
|
|
|
ok = !clifo.empty();
|
|
|
|
|
if (ok)
|
1998-05-04 07:43:58 +00:00
|
|
|
|
{
|
|
|
|
|
set_description(clifo.get("RAGSOC"));
|
|
|
|
|
if (_tipo_cr < 0)
|
|
|
|
|
{
|
|
|
|
|
_tipo_cr = 0;
|
|
|
|
|
_sezione = ' ';
|
|
|
|
|
}
|
|
|
|
|
_sospeso = clifo.get_bool("SOSPESO");
|
|
|
|
|
|
|
|
|
|
const char tipoa = clifo.get_char("TIPOPERS");
|
|
|
|
|
if (tipoa == 'F') // Se persona fisica allora aggiusta la ragione sociale
|
|
|
|
|
{
|
|
|
|
|
TString nome(descrizione().mid(30));
|
|
|
|
|
if (nome.not_empty())
|
|
|
|
|
{
|
|
|
|
|
_descrizione->cut(30);
|
|
|
|
|
_descrizione->trim(); nome.trim();
|
|
|
|
|
*_descrizione << ' ' << nome;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (_gruppo == 0 || _conto == 0)
|
|
|
|
|
{
|
|
|
|
|
_gruppo = clifo.get_int("GRUPPO");
|
|
|
|
|
_conto = clifo.get_int("CONTO");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1997-06-19 14:33:52 +00:00
|
|
|
|
return ok;
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
|
|
|
|
|
bool TBill::read(TRectype &r)
|
1995-07-21 10:12:15 +00:00
|
|
|
|
{
|
2011-06-21 15:01:30 +00:00
|
|
|
|
bool ok = false;
|
1996-05-20 09:26:39 +00:00
|
|
|
|
|
2002-09-13 14:56:23 +00:00
|
|
|
|
if (tipo() <= ' ' || sottoconto() <= 0)
|
|
|
|
|
{
|
2005-07-25 11:42:44 +00:00
|
|
|
|
const char* key = string();
|
2002-09-13 14:56:23 +00:00
|
|
|
|
const TRectype& pcon = cache().get(LF_PCON, key);
|
|
|
|
|
if (!pcon.empty())
|
|
|
|
|
{
|
|
|
|
|
r = pcon;
|
2011-06-21 15:01:30 +00:00
|
|
|
|
ok = true;
|
2002-09-13 14:56:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ok)
|
1997-06-19 14:33:52 +00:00
|
|
|
|
{
|
1998-05-04 07:43:58 +00:00
|
|
|
|
_tipo_cr = r.get_int(PCN_TIPOSPRIC);
|
|
|
|
|
_sezione = r.get_char(PCN_SEZSALDI);
|
|
|
|
|
set_description(r.get(PCN_DESCR));
|
|
|
|
|
_sospeso = r.get_bool(PCN_SOSPESO);
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
r.zero();
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
2002-09-13 14:56:23 +00:00
|
|
|
|
return ok;
|
1997-06-19 14:33:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TBill::tipo_att()
|
|
|
|
|
{
|
|
|
|
|
int tipo_att = 1;
|
|
|
|
|
if (tipo() <= ' ' && ok())
|
1996-05-20 09:26:39 +00:00
|
|
|
|
{
|
1997-06-19 14:33:52 +00:00
|
|
|
|
TBill bill(gruppo(), conto());
|
|
|
|
|
TRectype rec(LF_PCON); bill.read(rec);
|
1998-05-04 07:43:58 +00:00
|
|
|
|
const TIndbil ib = (TIndbil)rec.get_int(PCN_INDBIL);
|
1997-06-19 14:33:52 +00:00
|
|
|
|
if (ib == ib_passivita || ib == ib_ricavi)
|
|
|
|
|
{
|
|
|
|
|
read(rec);
|
1998-05-04 07:43:58 +00:00
|
|
|
|
const int ricser = rec.get_int(PCN_RICSER); // 0 = Altre attivita 1 = Servizi
|
1997-06-19 14:33:52 +00:00
|
|
|
|
tipo_att = (ricser == 1) ? 1 : 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tipo_att;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Certified 99%
|
|
|
|
|
const TString& TBill::descrizione() const
|
|
|
|
|
{
|
|
|
|
|
TBill& myself = (TBill&)*this;
|
1997-07-09 10:05:15 +00:00
|
|
|
|
// Se il conto e' valido (c'e' almeno il gruppo) cerca la sua descrizione su file
|
2011-01-27 14:50:46 +00:00
|
|
|
|
if ((_descrizione == NULL || _descrizione->blank()) &&
|
|
|
|
|
(gruppo() != 0 || (tipo() > ' ' && codclifo()>0)))
|
1997-06-19 14:33:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (!myself.find())
|
2002-12-20 17:08:30 +00:00
|
|
|
|
myself.set_description(TR("Sconosciuto"));
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
1997-06-19 14:33:52 +00:00
|
|
|
|
|
2002-05-31 10:35:40 +00:00
|
|
|
|
return _descrizione ? *_descrizione : (const TString&) EMPTY_STRING;
|
1995-07-21 10:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
int TBill::tipo_cr() const
|
|
|
|
|
{
|
2000-10-03 13:45:12 +00:00
|
|
|
|
if (_tipo_cr < 0)
|
1997-06-19 14:33:52 +00:00
|
|
|
|
{
|
|
|
|
|
TBill& myself = (TBill&)*this;
|
|
|
|
|
myself.find();
|
|
|
|
|
}
|
|
|
|
|
return _tipo_cr;
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
2004-11-30 22:02:59 +00:00
|
|
|
|
int TBill::indicatore_bilancio() const
|
|
|
|
|
{
|
2005-07-25 11:42:44 +00:00
|
|
|
|
TString8 str;
|
2004-11-30 22:02:59 +00:00
|
|
|
|
str.format("%d|%d", gruppo(), conto());
|
|
|
|
|
const int ib = atoi(cache().get(LF_PCON, str, PCN_INDBIL));
|
2005-10-10 17:17:16 +00:00
|
|
|
|
if (ib <= 0)
|
2006-01-24 18:26:50 +00:00
|
|
|
|
{
|
|
|
|
|
TString msg = str;
|
|
|
|
|
msg.replace('|', '.');
|
|
|
|
|
msg.insert(TR("Impossibile stabilire l'indicatore di bilancio del conto "));
|
|
|
|
|
NFCHECK(msg);
|
|
|
|
|
}
|
2004-11-30 22:02:59 +00:00
|
|
|
|
return ib;
|
|
|
|
|
}
|
|
|
|
|
|
2006-07-11 13:10:51 +00:00
|
|
|
|
|
2000-10-03 13:45:12 +00:00
|
|
|
|
bool TBill::sospeso() const
|
|
|
|
|
{
|
|
|
|
|
if (_tipo_cr < 0) tipo_cr(); // trick to load _sospeso
|
|
|
|
|
return _sospeso;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char TBill::sezione() const
|
|
|
|
|
{
|
|
|
|
|
if (_sezione == ' ') tipo_cr(); // trick to load _sezione
|
|
|
|
|
return _sezione;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-06 14:55:52 +00:00
|
|
|
|
// Certified 100%
|
1997-06-19 14:33:52 +00:00
|
|
|
|
const char* TBill::string(int mode) const
|
|
|
|
|
{
|
2003-05-06 14:55:52 +00:00
|
|
|
|
TString& s = get_tmp_string();
|
2002-09-13 14:56:23 +00:00
|
|
|
|
|
2005-07-25 11:42:44 +00:00
|
|
|
|
if (mode & 0x8)
|
|
|
|
|
{
|
|
|
|
|
if (_sottoconto != 0)
|
|
|
|
|
s.format("%03d%03d%06ld", _gruppo, _conto, _sottoconto); else
|
|
|
|
|
if (_conto != 0)
|
|
|
|
|
s.format("%03d%03d", _gruppo, _conto); else
|
|
|
|
|
if (_gruppo != 0)
|
|
|
|
|
s.format("%03d", _gruppo);
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
1997-06-19 14:33:52 +00:00
|
|
|
|
if (mode & 0x4)
|
|
|
|
|
{
|
|
|
|
|
const int cr = tipo_cr();
|
|
|
|
|
if (cr > 0) s << cr << '|';
|
|
|
|
|
else s << " |";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mode & 0x1)
|
|
|
|
|
s << _tipo << '|';
|
|
|
|
|
|
|
|
|
|
if (_gruppo > 0) s << _gruppo << '|';
|
|
|
|
|
else s << " |";
|
|
|
|
|
|
|
|
|
|
if (_conto > 0) s << _conto << '|';
|
|
|
|
|
else s << " |";
|
|
|
|
|
|
|
|
|
|
if (_sottoconto > 0L) s << _sottoconto;
|
|
|
|
|
else s << ' ';
|
|
|
|
|
|
|
|
|
|
if (mode & 0x2)
|
|
|
|
|
s << '|' << descrizione();
|
|
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
}
|
1995-07-21 10:12:15 +00:00
|
|
|
|
|
2004-09-15 14:50:57 +00:00
|
|
|
|
bool TBill::required_cdc() const
|
|
|
|
|
{
|
|
|
|
|
TString16 key;
|
|
|
|
|
for (int i = 2; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
key.format("%d|%d|%ld", gruppo(), i > 0 ? conto() : 0, i > 1 ? sottoconto() : 0);
|
|
|
|
|
const TRectype& sottoc = cache().get(LF_PCON, key);
|
|
|
|
|
if (sottoc.get_bool(PCN_CMSNEEDED))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-13 14:06:05 +00:00
|
|
|
|
bool TBill::default_cdc(TString& cdc, TString& fas) const
|
|
|
|
|
{
|
2005-09-19 12:45:16 +00:00
|
|
|
|
bool ok = tipo() <= ' ' && sottoconto() > 0;
|
2002-09-13 14:06:05 +00:00
|
|
|
|
if (ok)
|
|
|
|
|
{
|
2004-09-15 14:50:57 +00:00
|
|
|
|
TString16 key;
|
|
|
|
|
for (int i = 2; i >= 0; i--)
|
2002-09-13 14:06:05 +00:00
|
|
|
|
{
|
2004-09-15 14:50:57 +00:00
|
|
|
|
key.format("%d|%d|%ld", gruppo(), i > 0 ? conto() : 0, i > 1 ? sottoconto() : 0);
|
|
|
|
|
const TRectype& pcon = cache().get(LF_PCON, key);
|
|
|
|
|
if (!pcon.empty())
|
|
|
|
|
{
|
|
|
|
|
cdc = pcon.get(PCN_CODCMS);
|
|
|
|
|
fas = pcon.get(PCN_FASCMS);
|
|
|
|
|
if (cdc.not_empty() || fas.not_empty())
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-09-13 14:06:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2004-09-15 14:50:57 +00:00
|
|
|
|
return ok && (cdc.not_empty() || fas.not_empty());
|
2004-04-28 20:36:21 +00:00
|
|
|
|
}
|
2005-02-11 15:33:58 +00:00
|
|
|
|
|
|
|
|
|
bool TBill::is_analitico() const
|
|
|
|
|
{
|
|
|
|
|
TString16 key;
|
|
|
|
|
|
|
|
|
|
for (int i = 2; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
key.format("%d|%d|%ld", gruppo(), i > 0 ? conto() : 0, i > 1 ? sottoconto() : 0);
|
|
|
|
|
const TRectype& picone = cache().get(LF_PCON, key);
|
|
|
|
|
if (picone.get_bool(PCN_ANALITICA))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2010-03-24 15:33:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-03 21:44:29 +00:00
|
|
|
|
const char* num2str(const TString & s)
|
2010-03-24 15:33:50 +00:00
|
|
|
|
{
|
|
|
|
|
TString & str = get_tmp_string(20);
|
|
|
|
|
|
|
|
|
|
str = s;
|
|
|
|
|
str.trim();
|
|
|
|
|
if (str.len() > 2)
|
|
|
|
|
{
|
|
|
|
|
str = s.left(2);
|
|
|
|
|
const int sub = atoi(s.mid(2, 2));
|
|
|
|
|
const TString4 sotsub(s.mid(4));
|
|
|
|
|
|
|
|
|
|
switch (sub)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
case 1:
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
str << " bis";
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
str << " ter";
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
str << " quater";
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
str << " quinquies";
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
str << " sexies";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (sotsub.full())
|
|
|
|
|
str << " " << sotsub;
|
|
|
|
|
}
|
|
|
|
|
return (const char *) str;
|
|
|
|
|
}
|
|
|
|
|
|