Tolti messaggi d'errore sul prorata
git-svn-id: svn://10.65.10.50/trunk@6583 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
22adfa73ba
commit
c343fc34b6
135
cg/cglib01.cpp
135
cg/cglib01.cpp
@ -5,6 +5,10 @@
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <pconti.h>
|
||||
#include <rmov.h>
|
||||
#include <rmoviva.h>
|
||||
|
||||
#include "cglib01.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -153,7 +157,8 @@ const char* iva2name(TipoIVA iva)
|
||||
// Registro
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TRegistro::TRegistro(const char* cod, int year) : _rec(LF_TAB), _att(LF_ATTIV)
|
||||
TRegistro::TRegistro(const char* cod, int year)
|
||||
: _rec(LF_TAB), _att(LF_ATTIV)
|
||||
{
|
||||
read(cod, year);
|
||||
}
|
||||
@ -329,15 +334,15 @@ real TRegistro::prorata(int annodoc)
|
||||
pr = read_prorata(annopro);
|
||||
if (pr == NULL && annopro != annoiva)
|
||||
{
|
||||
warning_box("Non esistono i dati relativi al pro rata per il %d:\n"
|
||||
"verra' considerato l'anno %d", annopro, annoiva);
|
||||
pr = read_prorata(annoiva);
|
||||
// warning_box("Non esistono i dati relativi al prorata per il %d:\n"
|
||||
// "verra' considerato l'anno %d", annopro, annoiva);
|
||||
pr = read_prorata(annoiva);
|
||||
}
|
||||
if (pr == NULL)
|
||||
{
|
||||
warning_box("Non esistono i dati relativi al pro rata per il %d:\n"
|
||||
"verra' considerato allo 0%", annoiva);
|
||||
pr = new real;
|
||||
// warning_box("Non esistono i dati relativi al prorata per il %d:\n"
|
||||
// "verra' considerato allo 0%%", annoiva);
|
||||
pr = new real(ZERO);
|
||||
}
|
||||
_prorata.add(chiave, pr, TRUE);
|
||||
}
|
||||
@ -348,7 +353,7 @@ real TRegistro::prorata(int annodoc)
|
||||
void TRegistro::set_prorata(int annodoc, const real& pro)
|
||||
{
|
||||
int annoiva = year();
|
||||
int annopro = annoiva < 1998 ? annoiva : annodoc;
|
||||
int annopro = (annoiva < 1998 || annodoc <= 0) ? annoiva : annodoc;
|
||||
TString16 chiave; chiave << annopro;
|
||||
_prorata.add(chiave, pro, TRUE);
|
||||
}
|
||||
@ -553,27 +558,27 @@ const TBill& TBill::add_to(TToken_string& ts, int from, int mode)
|
||||
|
||||
const char* TBill::field_name(int n, bool contro) const
|
||||
{
|
||||
CHECKD(n >= 0 && n <= 3, "Invalid bill field", n);
|
||||
CHECKD(n >= 0 && n <= 3, "Invalid bill field ", n);
|
||||
|
||||
const char* f;
|
||||
if (contro)
|
||||
{
|
||||
switch(n)
|
||||
{
|
||||
case 0: f = "GRUPPOC"; break;
|
||||
case 1: f = "CONTOC"; break;
|
||||
case 2: f = "SOTTOCONTC"; break;
|
||||
default:f = "TIPOCC"; break;
|
||||
case 0: f = RMV_GRUPPOC; break;
|
||||
case 1: f = RMV_CONTOC; break;
|
||||
case 2: f = RMV_SOTTOCONTOC; break;
|
||||
default:f = RMV_TIPOCC; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(n)
|
||||
{
|
||||
case 0: f = "GRUPPO"; break;
|
||||
case 1: f = "CONTO"; break;
|
||||
case 2: f = "SOTTOCONTO"; break;
|
||||
default:f = "TIPOC"; break;
|
||||
case 0: f = RMV_GRUPPO; break;
|
||||
case 1: f = RMV_CONTO; break;
|
||||
case 2: f = RMV_SOTTOCONTO; break;
|
||||
default:f = RMV_TIPOC; break;
|
||||
}
|
||||
}
|
||||
return f;
|
||||
@ -599,7 +604,7 @@ bool TBill::get(const TRectype& r, bool c)
|
||||
_sezione = ' ';
|
||||
|
||||
if (r.num() == LF_RMOVIVA)
|
||||
tipo_cr(r.get_int("TIPOCR"));
|
||||
tipo_cr(r.get_int(RMI_TIPOCR));
|
||||
|
||||
return ok();
|
||||
}
|
||||
@ -668,44 +673,52 @@ bool TBill::find()
|
||||
{
|
||||
TRectype pcon(LF_PCON);
|
||||
ok = read(pcon);
|
||||
}
|
||||
else
|
||||
if ((_tipo == 'C' || _tipo == 'F') && _sottoconto != 0L)
|
||||
if (!ok && _sottoconto != 0L)
|
||||
{
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
clifo.setkey(1);
|
||||
clifo.put("TIPOCF", _tipo);
|
||||
clifo.put("CODCF", _sottoconto);
|
||||
ok = clifo.read() == NOERR;
|
||||
const long sotto = _sottoconto;
|
||||
_sottoconto = 0L;
|
||||
ok = read(pcon);
|
||||
if (ok)
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
_tipo = toupper(pcon.get_char(PCN_TMCF));
|
||||
_sottoconto = sotto;
|
||||
}
|
||||
}
|
||||
|
||||
if ((_tipo == 'C' || _tipo == 'F') && _sottoconto != 0L)
|
||||
{
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
clifo.setkey(1);
|
||||
clifo.put("TIPOCF", _tipo);
|
||||
clifo.put("CODCF", _sottoconto);
|
||||
ok = clifo.read() == NOERR;
|
||||
if (ok)
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -713,18 +726,18 @@ bool TBill::find()
|
||||
bool TBill::read(TRectype &r)
|
||||
{
|
||||
TLocalisamfile pcon(LF_PCON);
|
||||
pcon.put("GRUPPO", _gruppo);
|
||||
pcon.put("CONTO", _conto);
|
||||
pcon.put("SOTTOCONTO", _sottoconto);
|
||||
pcon.put(PCN_GRUPPO, _gruppo);
|
||||
pcon.put(PCN_CONTO, _conto);
|
||||
pcon.put(PCN_SOTTOCONTO, _sottoconto);
|
||||
|
||||
const int err = pcon.read();
|
||||
if (err == NOERR)
|
||||
{
|
||||
r = pcon.curr();
|
||||
_tipo_cr = r.get_int("TIPOSPRIC");
|
||||
_sezione = r.get_char("SEZSALDI");
|
||||
set_description(r.get("DESCR"));
|
||||
_sospeso = r.get_bool("SOSPESO");
|
||||
_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);
|
||||
}
|
||||
else
|
||||
r.zero();
|
||||
@ -739,11 +752,11 @@ int TBill::tipo_att()
|
||||
{
|
||||
TBill bill(gruppo(), conto());
|
||||
TRectype rec(LF_PCON); bill.read(rec);
|
||||
const TIndbil ib = (TIndbil)rec.get_int("INDBIL");
|
||||
const TIndbil ib = (TIndbil)rec.get_int(PCN_INDBIL);
|
||||
if (ib == ib_passivita || ib == ib_ricavi)
|
||||
{
|
||||
read(rec);
|
||||
const int ricser = rec.get_int("RICSER"); // 0 = Altre attivita 1 = Servizi
|
||||
const int ricser = rec.get_int(PCN_RICSER); // 0 = Altre attivita 1 = Servizi
|
||||
tipo_att = (ricser == 1) ? 1 : 2;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user