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 <tabutil.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
|
#include <pconti.h>
|
||||||
|
#include <rmov.h>
|
||||||
|
#include <rmoviva.h>
|
||||||
|
|
||||||
#include "cglib01.h"
|
#include "cglib01.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -153,7 +157,8 @@ const char* iva2name(TipoIVA iva)
|
|||||||
// Registro
|
// 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);
|
read(cod, year);
|
||||||
}
|
}
|
||||||
@ -329,15 +334,15 @@ real TRegistro::prorata(int annodoc)
|
|||||||
pr = read_prorata(annopro);
|
pr = read_prorata(annopro);
|
||||||
if (pr == NULL && annopro != annoiva)
|
if (pr == NULL && annopro != annoiva)
|
||||||
{
|
{
|
||||||
warning_box("Non esistono i dati relativi al pro rata per il %d:\n"
|
// warning_box("Non esistono i dati relativi al prorata per il %d:\n"
|
||||||
"verra' considerato l'anno %d", annopro, annoiva);
|
// "verra' considerato l'anno %d", annopro, annoiva);
|
||||||
pr = read_prorata(annoiva);
|
pr = read_prorata(annoiva);
|
||||||
}
|
}
|
||||||
if (pr == NULL)
|
if (pr == NULL)
|
||||||
{
|
{
|
||||||
warning_box("Non esistono i dati relativi al pro rata per il %d:\n"
|
// warning_box("Non esistono i dati relativi al prorata per il %d:\n"
|
||||||
"verra' considerato allo 0%", annoiva);
|
// "verra' considerato allo 0%%", annoiva);
|
||||||
pr = new real;
|
pr = new real(ZERO);
|
||||||
}
|
}
|
||||||
_prorata.add(chiave, pr, TRUE);
|
_prorata.add(chiave, pr, TRUE);
|
||||||
}
|
}
|
||||||
@ -348,7 +353,7 @@ real TRegistro::prorata(int annodoc)
|
|||||||
void TRegistro::set_prorata(int annodoc, const real& pro)
|
void TRegistro::set_prorata(int annodoc, const real& pro)
|
||||||
{
|
{
|
||||||
int annoiva = year();
|
int annoiva = year();
|
||||||
int annopro = annoiva < 1998 ? annoiva : annodoc;
|
int annopro = (annoiva < 1998 || annodoc <= 0) ? annoiva : annodoc;
|
||||||
TString16 chiave; chiave << annopro;
|
TString16 chiave; chiave << annopro;
|
||||||
_prorata.add(chiave, pro, TRUE);
|
_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
|
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;
|
const char* f;
|
||||||
if (contro)
|
if (contro)
|
||||||
{
|
{
|
||||||
switch(n)
|
switch(n)
|
||||||
{
|
{
|
||||||
case 0: f = "GRUPPOC"; break;
|
case 0: f = RMV_GRUPPOC; break;
|
||||||
case 1: f = "CONTOC"; break;
|
case 1: f = RMV_CONTOC; break;
|
||||||
case 2: f = "SOTTOCONTC"; break;
|
case 2: f = RMV_SOTTOCONTOC; break;
|
||||||
default:f = "TIPOCC"; break;
|
default:f = RMV_TIPOCC; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch(n)
|
switch(n)
|
||||||
{
|
{
|
||||||
case 0: f = "GRUPPO"; break;
|
case 0: f = RMV_GRUPPO; break;
|
||||||
case 1: f = "CONTO"; break;
|
case 1: f = RMV_CONTO; break;
|
||||||
case 2: f = "SOTTOCONTO"; break;
|
case 2: f = RMV_SOTTOCONTO; break;
|
||||||
default:f = "TIPOC"; break;
|
default:f = RMV_TIPOC; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
@ -599,7 +604,7 @@ bool TBill::get(const TRectype& r, bool c)
|
|||||||
_sezione = ' ';
|
_sezione = ' ';
|
||||||
|
|
||||||
if (r.num() == LF_RMOVIVA)
|
if (r.num() == LF_RMOVIVA)
|
||||||
tipo_cr(r.get_int("TIPOCR"));
|
tipo_cr(r.get_int(RMI_TIPOCR));
|
||||||
|
|
||||||
return ok();
|
return ok();
|
||||||
}
|
}
|
||||||
@ -668,44 +673,52 @@ bool TBill::find()
|
|||||||
{
|
{
|
||||||
TRectype pcon(LF_PCON);
|
TRectype pcon(LF_PCON);
|
||||||
ok = read(pcon);
|
ok = read(pcon);
|
||||||
}
|
if (!ok && _sottoconto != 0L)
|
||||||
else
|
|
||||||
if ((_tipo == 'C' || _tipo == 'F') && _sottoconto != 0L)
|
|
||||||
{
|
{
|
||||||
TLocalisamfile clifo(LF_CLIFO);
|
const long sotto = _sottoconto;
|
||||||
clifo.setkey(1);
|
_sottoconto = 0L;
|
||||||
clifo.put("TIPOCF", _tipo);
|
ok = read(pcon);
|
||||||
clifo.put("CODCF", _sottoconto);
|
|
||||||
ok = clifo.read() == NOERR;
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
_tipo = toupper(pcon.get_char(PCN_TMCF));
|
||||||
set_description(clifo.get("RAGSOC"));
|
_sottoconto = sotto;
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,18 +726,18 @@ bool TBill::find()
|
|||||||
bool TBill::read(TRectype &r)
|
bool TBill::read(TRectype &r)
|
||||||
{
|
{
|
||||||
TLocalisamfile pcon(LF_PCON);
|
TLocalisamfile pcon(LF_PCON);
|
||||||
pcon.put("GRUPPO", _gruppo);
|
pcon.put(PCN_GRUPPO, _gruppo);
|
||||||
pcon.put("CONTO", _conto);
|
pcon.put(PCN_CONTO, _conto);
|
||||||
pcon.put("SOTTOCONTO", _sottoconto);
|
pcon.put(PCN_SOTTOCONTO, _sottoconto);
|
||||||
|
|
||||||
const int err = pcon.read();
|
const int err = pcon.read();
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
{
|
{
|
||||||
r = pcon.curr();
|
r = pcon.curr();
|
||||||
_tipo_cr = r.get_int("TIPOSPRIC");
|
_tipo_cr = r.get_int(PCN_TIPOSPRIC);
|
||||||
_sezione = r.get_char("SEZSALDI");
|
_sezione = r.get_char(PCN_SEZSALDI);
|
||||||
set_description(r.get("DESCR"));
|
set_description(r.get(PCN_DESCR));
|
||||||
_sospeso = r.get_bool("SOSPESO");
|
_sospeso = r.get_bool(PCN_SOSPESO);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
r.zero();
|
r.zero();
|
||||||
@ -739,11 +752,11 @@ int TBill::tipo_att()
|
|||||||
{
|
{
|
||||||
TBill bill(gruppo(), conto());
|
TBill bill(gruppo(), conto());
|
||||||
TRectype rec(LF_PCON); bill.read(rec);
|
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)
|
if (ib == ib_passivita || ib == ib_ricavi)
|
||||||
{
|
{
|
||||||
read(rec);
|
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;
|
tipo_att = (ricser == 1) ? 1 : 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user