Patch level : 4.0 979

Files correlati     : ve6.exe
Ricompilazione Demo : [ ]
Commento            :

Riportata la versione 3.1 patch 979


git-svn-id: svn://10.65.10.50/trunk@15623 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2007-09-17 15:33:04 +00:00
parent 93535d40d0
commit 96f33c01ee
386 changed files with 14839 additions and 5422 deletions

@ -1,4 +0,0 @@
#define APPNAME AVIS
#define QAPPNAME "AVIS"
#include <default.url>
#include <mainmenu.url>

@ -1,4 +0,0 @@
#define APPNAME AVIS
#define QAPPNAME "AVIS"
#include <default.url>
#include <mainmenu.url>

@ -1,4 +0,0 @@
#define APPNAME AVIS
#define QAPPNAME "AVIS"
#include <default.url>
#include <mainmenu.url>

@ -163,7 +163,7 @@ void TStampaSospesi::set_page(int file, int cnt)
if (current_cursor()->pos()<current_cursor()->items())
{
_netichette++;
force_setpage(TRUE);
force_setpage(true);
corpo.update();
int nriga = 1;
if (_etrighe > 0)
@ -243,7 +243,7 @@ void TStampaSospesi::set_page(int file, int cnt)
TPrintrow& riga = corpo.row(i);
set_row(nriga++,riga);
}
force_setpage(TRUE);
force_setpage(true);
_ncartoline++;
}
break;
@ -256,7 +256,7 @@ void TStampaSospesi::set_page(int file, int cnt)
TPrintrow& riga = corpo.row(i);
set_row(i+1,riga);
}
force_setpage(TRUE); // serve perchè alla prossima etichetta rifaccia la setpage
force_setpage(true); // serve perchè alla prossima etichetta rifaccia la setpage
// altrimenti stampa sempre la stessa etichetta
}
break;
@ -327,8 +327,8 @@ void TStampaSospesi::set_page(int file, int cnt)
bool TStampaSospesi::filter_func_sospesi(const TRelation* rel)
{
bool filtrato = TRUE;
bool filtrocat = TRUE;
bool filtrato = true;
bool filtrocat = true;
TRectype recsog = rel->lfile().curr();
// filtro per categorie
TAssoc_array& categorie = app()._categorie;
@ -369,18 +369,18 @@ bool TStampaSospesi::filter_func_sospesi(const TRelation* rel)
const TString16 motivo = contsan.get(CON_MOTIVO);
if ((app()._motivo1==motivo)
|| (app()._motivo2==motivo && app()._motivo2.not_empty()) || (app()._motivo3==motivo && app()._motivo3.not_empty()) || (app()._motivo4==motivo && app()._motivo4.not_empty()) || (app()._motivo5==motivo) && app()._motivo5.not_empty())
filtrato = TRUE;
filtrato = true;
else
filtrato = FALSE;
filtrato = false;
}
else
filtrato = FALSE;
filtrato = false;
}
if (!filtrato && filtrocat && app()._sosingole)
{
// verifico se e' sospeso per una singola tipologia di donazione
// Sangue intero
filtrato = TRUE;
filtrato = true;
if ((filtrato) && (app()._sodataini.ok()))
{
const TDate datastato = recsog.get_date(SOG_DATASI);
@ -406,7 +406,7 @@ bool TStampaSospesi::filter_func_sospesi(const TRelation* rel)
{
// verifico se e' sospeso per una singola tipologia di donazione
// Aferesi
filtrato = TRUE;
filtrato = true;
if ((filtrato) && (app()._sodataini.ok()))
{
const TDate datastato = recsog.get_date(SOG_DATAAF);
@ -499,7 +499,7 @@ bool TStampaSospesi::preprocess_page(int file, int counter)
printer().formfeed();
_contatore++;
_totale++;
return TRUE;
return true;
}
print_action TStampaSospesi::postprocess_print(int file, int counter)
@ -664,7 +664,7 @@ bool TStampaSospesi::set_print(int m)
_prosstipo = _msk->get(F_PROSSTIPO);
if (_prosstipo.not_empty())
filtro << " && (" << SOG_PROS_STATO << "== \"" << _prosstipo << "\")";
current_cursor()->setfilter(filtro, TRUE);
current_cursor()->setfilter(filtro, true);
// filtro per categorie
_categorie.destroy();
const TString16 catpri = _msk->get(F_CAT1);
@ -699,10 +699,10 @@ bool TStampaSospesi::set_print(int m)
reset_print();
printer().footerlen(0);
crea_intestazione();
return TRUE;
return true;
}
else
return FALSE;
return false;
}
void TStampaSospesi::crea_intestazione()
@ -801,7 +801,7 @@ bool TStampaSospesi::user_create()
_cabordofin = config.get_int("CaBordoFin");
_form_let = new TEti_sospesi_form("ATLETTER");
return TRUE;
return true;
}
bool TStampaSospesi::user_destroy()
@ -811,7 +811,7 @@ bool TStampaSospesi::user_destroy()
delete _msk;
delete _contsan;
delete _rel;
return TRUE;
return true;
}
int at2100(int argc, char* argv[])

@ -116,7 +116,7 @@ void TStampaPerEta::set_page(int file, int cnt)
{
if (current_cursor()->pos()<current_cursor()->items())
{
force_setpage(TRUE);
force_setpage(true);
corpo.update();
for (word i = 0; i < corpo.height(); i++)
{
@ -174,7 +174,7 @@ void TStampaPerEta::set_page(int file, int cnt)
bool TStampaPerEta::filter_func_pereta(const TRelation* rel)
{
bool filtrato = TRUE;
bool filtrato = true;
TLocalisamfile& sog = rel->lfile();
// filtro per sesso
if (app()._sesso != 'I')
@ -265,7 +265,7 @@ bool TStampaPerEta::preprocess_page(int file, int counter)
printer().formfeed();
_contatore++;
_totale++;
return TRUE;
return true;
}
print_action TStampaPerEta::postprocess_print(int file, int counter)
@ -362,10 +362,10 @@ bool TStampaPerEta::set_print(int m)
reset_print();
printer().footerlen(0);
crea_intestazione();
return TRUE;
return true;
}
else
return FALSE;
return false;
}
void TStampaPerEta::crea_intestazione()
@ -438,7 +438,7 @@ bool TStampaPerEta::user_create()
_form_eti = new TEti_pereta_form(etformato);
_msk = new TMask("at2200a");
_stampa80 = config.get_bool("Stampa80");
return TRUE;
return true;
}
bool TStampaPerEta::user_destroy()
@ -446,7 +446,7 @@ bool TStampaPerEta::user_destroy()
delete _form_eti;
delete _msk;
delete _rel;
return TRUE;
return true;
}
int at2200(int argc, char* argv[])

@ -104,7 +104,7 @@ void TStampaEsclusi::set_page(int file, int cnt)
}
// serve perchè alla prossima etichetta rifaccia la setpage
// altrimenti stampa sempre la stessa etichetta
force_setpage(TRUE);
force_setpage(true);
}
break;
case elenco:
@ -124,7 +124,7 @@ void TStampaEsclusi::set_page(int file, int cnt)
bool TStampaEsclusi::filter_func_esclusi(const TRelation * rel)
{
bool filtrato = TRUE;
bool filtrato = true;
TLocalisamfile& sog = rel->lfile();
//filtro per categorie
TAssoc_array& categorie = app()._categorie;
@ -169,7 +169,7 @@ bool TStampaEsclusi::preprocess_page(int file, int counter)
printer().formfeed();
_contatore++;
_totale++;
return TRUE;
return true;
}
print_action TStampaEsclusi::postprocess_print(int file, int counter)
@ -293,10 +293,10 @@ bool TStampaEsclusi::set_print(int)
reset_print();
printer().footerlen(0);
crea_intestazione();
return TRUE;
return true;
}
else
return FALSE;
return false;
}
void TStampaEsclusi::crea_intestazione()
@ -347,7 +347,7 @@ bool TStampaEsclusi::user_create()
_etlarghezza = config.get_int("EtLarghezza");
_etcolonne = config.get_int("EtColonne");
_form_eti = new TEti_esclusi_form(etformato);
return TRUE;
return true;
}
bool TStampaEsclusi::user_destroy()
@ -355,7 +355,7 @@ bool TStampaEsclusi::user_destroy()
delete _form_eti;
delete _msk;
delete _rel;
return TRUE;
return true;
}
int at2300(int argc, char* argv[])

@ -351,7 +351,7 @@ bool TStampaModificati::set_print(int)
return TRUE;
}
else
return FALSE;
return false;
}
void TStampaModificati::crea_intestazione()

@ -1,4 +0,0 @@
#define APPNAME AVIS
#define QAPPNAME "AVIS"
#include <default.url>
#include <mainmenu.url>

@ -126,12 +126,15 @@ DATE F_DATAINI
BEGIN
PROMPT 2 6 "Donazioni effettuate dal "
HELP "Data iniziale"
CHECKTYPE REQUIRED
END
DATE F_DATAFIN
BEGIN
PROMPT 40 6 "al "
HELP "Data finale"
CHECKTYPE REQUIRED
VALIDATE DATE_CMP_FUNC >= F_DATAINI
END
BOOLEAN F_PRIMEDON

@ -1,4 +0,0 @@
#define APPNAME AVIS
#define QAPPNAME "AVIS"
#include <default.url>
#include <mainmenu.url>

@ -67,7 +67,7 @@ class TStampaScadenze : public TPrintapp
TDate _data_stampa;
TDate _dataini, _datafin, _dataultid, _dataultdon;
int _intminconv;
bool _usomodo, _usasez, _registra, _gpd_esclusivo, _proc_esclusivo, _perfamiglie, _usodisp;
bool _usomodo, _usasez, _registra, _gpd_esclusivo, _proc_esclusivo, _perfamiglie, _usodisp, _percap;
TString16 _giorni, _punto;
TString16 _procdon, _modo, _ab01, _ab02, _ab03, _rh;
ts _tipostampa;
@ -364,7 +364,8 @@ void TStampaScadenze::set_page(int file, int cnt)
set_row(1,"@119g@S", FLD(LF_SOGGETTI,SOG_DISP_AF_1));
set_row(1,"@122g@S", FLD(LF_SOGGETTI,SOG_DISP_AF_2));
set_row(4,"");
set_row(4,"@36g@S", FLD(LF_SOGGETTI,SOG_EMAIL));
set_row(5,"");
}
break;
case personale:
@ -581,7 +582,7 @@ bool TStampaScadenze::preprocess_page(int file, int counter)
_contatore = 0;
}
else
if ((printer().rows_left()<4 && _tipostampa==elenco) || (printer().rows_left()<3 && _tipostampa==completo))
if ((printer().rows_left()<5 && _tipostampa==elenco) || (printer().rows_left()<3 && _tipostampa==completo))
printer().formfeed();
_contatore++;
_totfinestampa++;
@ -814,6 +815,7 @@ bool TStampaScadenze::set_print(int m)
_usomodo = _msk->get_bool(F_USOMODO);
_modo = _msk->get(F_MODO);
_perfamiglie = _msk->get_bool(F_PERFAMIGLIE);
_percap = _msk->get_bool(F_PERCAP);
_ab01 = _msk->get(F_AB01);
_ab02 = _msk->get(F_AB02);
_ab03 = _msk->get(F_AB03);
@ -858,6 +860,9 @@ bool TStampaScadenze::set_print(int m)
_categorie.add((const char*) catqui);
if (catses.not_empty())
_categorie.add((const char*) catses);
if (_percap)
((TSorted_cursor*)current_cursor())->change_order("90->DOM_CAP|90->DOM_CODCOM|90->COGNOME|90->NOME");
// filtro per idoneo e non escluso
//if (_usomodo)
//current_cursor()->setfilter(format("(TCS->S6 == \"I\" || TCS->S6 == \"F\") && (ESCLUSO == \"\") && (MODCONV == \"%s\")",(const char*)_modo), TRUE);
@ -953,7 +958,7 @@ void TStampaScadenze::crea_intestazione()
{
set_header(5,"@0gCodice@10gCognome e Nome@36gIndirizzo@62gTelefoni@77gData pr.SI@88gData ult.SI@99gUlt.idon.@110gInt.SI@119gDisp.AF");
set_header(6,"@0gTessera@10gData nasc.@77gData pr.AF@88gData ult.AF@99g Gio.pre.@110gInt.AF");
set_header(7,"@0gCat.77gGr. Rh. Fen. Kell Du A CMV@110gTot.don.");
set_header(7,"@0gCat.@36gPosta elettronica@77gGr. Rh. Fen. Kell Du A CMV@110gTot.don.");
set_header(8,"@0g------@10g-------------------------@36g-------------------------@62g-------------@77g----------@88g----------@99g---------@110g------@119g-------");
}
printer().footerlen(3);
@ -990,7 +995,7 @@ bool TStampaScadenze::user_create()
_donaz = new TLocalisamfile(LF_DONAZ);
_famiglie = new TLocalisamfile(LF_FAMIGLIE);
_sfamiglia = new TRecord_array(LF_FAMIGLIE,FAM_PROGFAM);
add_cursor(new TCursor(_rel, "", 3));
add_cursor(new TSorted_cursor(_rel,"","",3));
_msk = new TMask("at4100a");
TConfig config(CONFIG_STUDIO);

@ -49,6 +49,7 @@
#define F_PROC_ESCLUSIVO 324
#define F_PERFAMIGLIE 325
#define F_DATAULTDON 326
#define F_PERCAP 327
#define F_ELENCO 401
#define F_COMPLETO 402

@ -430,6 +430,11 @@ BEGIN
MESSAGE FALSE RESET,F_MODO|DISABLE,F_MODO
END
BOOLEAN F_PERCAP
BEGIN
PROMPT 40 18 "Ordinamento per CAP+Alfabetico"
END
LISTBOX F_AB01 5
BEGIN
PROMPT 2 19 "Gruppi AB0 "

@ -1,4 +0,0 @@
#define APPNAME AVIS
#define QAPPNAME "AVIS"
#include <default.url>
#include <mainmenu.url>

@ -1,4 +0,0 @@
#define APPNAME AVIS
#define QAPPNAME "AVIS"
#include <default.url>
#include <mainmenu.url>

@ -1,4 +0,0 @@
#define APPNAME AVIS
#define QAPPNAME "AVIS"
#include <default.url>
#include <mainmenu.url>

@ -1,4 +0,0 @@
#define APPNAME AVIS
#define QAPPNAME "AVIS"
#include <default.url>
#include <mainmenu.url>

@ -1,4 +0,0 @@
#define APPNAME AVIS
#define QAPPNAME "AVIS"
#include <default.url>
#include <mainmenu.url>

@ -157,7 +157,7 @@ bool TStatSogSosp::crea_colonne()
contatore = contatore+1;
real* oggetto2 = new real(contatore);
_colonne->add(indice,(TObject*)oggetto2);
return TRUE;
return true;
}
bool TStatSogSosp::create()
@ -175,7 +175,7 @@ bool TStatSogSosp::create()
_colonne = new TAssoc_array();
_sospensioni = new TAssoc_array();
dispatch_e_menu(BAR_ITEM(1));
return TRUE;
return true;
}
bool TStatSogSosp::destroy()
@ -208,7 +208,7 @@ bool TStatSogSosp::menu(MENU_TAG m)
if (riepilogo())
stampa();
}
return FALSE;
return false;
}
void TStatSogSosp::crea_intestazione()
@ -284,7 +284,7 @@ bool TStatSogSosp::stampa()
delete curstat;
delete relstat;
printer().close();
return TRUE;
return true;
}
else
return FALSE;
@ -474,7 +474,7 @@ bool TStatSogSosp::riepilogo()
filtro << " && ";
//filtro << "((TCS->S6 == \"S\") || (TCS->S6 == \"B\"))";
filtro << "(TCS->S6 == \"S\")";
_cur->setfilter((const char*) filtro, TRUE);
_cur->setfilter((const char*) filtro, true);
long numero, numero2; // numero sospesi, durata
TString16 codsez, codsot, tiposos;
TDate dataini, datafin;
@ -484,7 +484,7 @@ bool TStatSogSosp::riepilogo()
long codice = 0;
long durata = 0;
long last = _cur->items();
TProgind prg (last, "Elaborazione in corso... Prego attendere", FALSE, TRUE, 30);
TProgind prg (last, "Elaborazione in corso... Prego attendere", false, true, 30);
for ( *_cur=0; _cur->pos() < last; ++(*_cur) )
{
prg.addstatus(1);
@ -499,7 +499,7 @@ bool TStatSogSosp::riepilogo()
else
{
if (codice != 0)
ok = TRUE;
ok = true;
codice = reccon.get_long(CON_CODICE);
tiposos = reccon.get(CON_TIPOCON);
}

@ -88,7 +88,7 @@ bool TCom2prov_mask::on_field_event(TOperable_field& f, TField_event e, long jol
default:
break;
}
return TRUE;
return true;
}
@ -162,7 +162,7 @@ void TCom2prov::transfer()
filtro << "(ANSI(" << SOG_DATAULTAGG << ")>=\"" << data.string(ANSI) << "\")";
TCursor cursore(_rel, filtro, 3, &da, &da);
long records = cursore.items();
TProgind pi(records,"Estrazione dati", TRUE, TRUE);
TProgind pi(records,"Estrazione dati", true, true);
pi.setstatus(1);
for (cursore = 0; cursore.pos() < records; ++(cursore))
{
@ -173,7 +173,7 @@ void TCom2prov::transfer()
filesog.write(cursore.curr());
if (donazioni)
{
bool continua = TRUE;
bool continua = true;
while (continua)
{
const long codice = cursore.curr(LF_DONAZ).get_long(DON_CODICE);
@ -184,7 +184,7 @@ void TCom2prov::transfer()
}
if (controlli)
{
bool continua = TRUE;
bool continua = true;
while (continua)
{
const long codice = cursore.curr(LF_CONTSAN).get_long(CON_CODICE);
@ -192,7 +192,7 @@ void TCom2prov::transfer()
filecon.write(cursore.curr(LF_CONTSAN));
continua = cursore.next_match(LF_CONTSAN, "CODICE");
}
continua = TRUE;
continua = true;
while (continua)
{
const long codice = cursore.curr(LF_IDONEITA).get_long(IDO_CODICE);
@ -203,7 +203,7 @@ void TCom2prov::transfer()
}
if (benemerenze)
{
bool continua = TRUE;
bool continua = true;
while (continua)
{
const long codice = cursore.curr(LF_BENEM).get_long(BEN_CODICE);
@ -214,7 +214,7 @@ void TCom2prov::transfer()
}
if (storico)
{
bool continua = TRUE;
bool continua = true;
while (continua)
{
const long codice = cursore.curr(LF_STORICO).get_long(STO_CODICE);

@ -176,12 +176,12 @@ void TProv2com::transfer()
TString80 nomesto = percorso;
nomesto << "STORICO";
_filesog = new TIsamtempfile(LF_SOGGETTI, (const char *) nomesog, FALSE);
_filecon = new TIsamtempfile(LF_CONTSAN, (const char*) nomecon, FALSE);
_filedon = new TIsamtempfile(LF_DONAZ, (const char* ) nomedon, FALSE);
_fileido = new TIsamtempfile(LF_IDONEITA, (const char*) nomeido, FALSE);
_fileben = new TIsamtempfile(LF_BENEM, (const char*) nomeben, FALSE);
_filesto = new TIsamtempfile(LF_STORICO, (const char*) nomesto, FALSE);
_filesog = new TIsamtempfile(LF_SOGGETTI, (const char *) nomesog, false);
_filecon = new TIsamtempfile(LF_CONTSAN, (const char*) nomecon, false);
_filedon = new TIsamtempfile(LF_DONAZ, (const char* ) nomedon, false);
_fileido = new TIsamtempfile(LF_IDONEITA, (const char*) nomeido, false);
_fileben = new TIsamtempfile(LF_BENEM, (const char*) nomeben, false);
_filesto = new TIsamtempfile(LF_STORICO, (const char*) nomesto, false);
_rel = new TRelation(LF_SOGGETTI);
_reltmp = new TRelation(LF_SOGGETTI);
@ -212,7 +212,7 @@ void TProv2com::transfer()
//anagrafica = (anagrafica || donazioni || controlli || benemerenze || storico);
TCursor cursore(_reltmp);
long records = cursore.items();
TProgind pi(records,"Aggiornamento archivi", TRUE, TRUE);
TProgind pi(records,"Aggiornamento archivi", true, true);
pi.setstatus(1);
for (cursore = 0; cursore.pos() < records; ++(cursore))
{
@ -222,7 +222,7 @@ void TProv2com::transfer()
agg_anagrafica(cursore.curr(), anagrafica);
if (donazioni)
{
bool continua = TRUE;
bool continua = true;
while (continua)
{
const long codice = cursore.curr(LF_DONAZ).get_long(DON_CODICE);
@ -233,7 +233,7 @@ void TProv2com::transfer()
}
if (controlli)
{
bool continua = TRUE;
bool continua = true;
while (continua)
{
const long codice = cursore.curr(LF_CONTSAN).get_long(CON_CODICE);
@ -241,7 +241,7 @@ void TProv2com::transfer()
agg_controllo(cursore.curr(), cursore.curr(LF_CONTSAN));
continua = cursore.next_match(LF_CONTSAN, "CODICE");
}
continua = TRUE;
continua = true;
while (continua)
{
const long codice = cursore.curr(LF_IDONEITA).get_long(IDO_CODICE);
@ -254,7 +254,7 @@ void TProv2com::transfer()
}
if (benemerenze)
{
bool continua = TRUE;
bool continua = true;
while (continua)
{
const long codice = cursore.curr(LF_BENEM).get_long(BEN_CODICE);
@ -265,7 +265,7 @@ void TProv2com::transfer()
}
if (storico)
{
bool continua = TRUE;
bool continua = true;
while (continua)
{
const long codice = cursore.curr(LF_STORICO).get_long(STO_CODICE);
@ -288,7 +288,7 @@ void TProv2com::print_line(const TString& message)
void TProv2com::agg_anagrafica(const TRectype& recsog, const bool aggiorna)
{
_print_header = FALSE;
_print_header = false;
TString intestazione = "";
TString message = "";
const TString80 cognome = recsog.get(SOG_COGNOME);
@ -305,7 +305,7 @@ void TProv2com::agg_anagrafica(const TRectype& recsog, const bool aggiorna)
intestazione << nome;
intestazione << " ";
intestazione << datanasc.string();
bool confronta = TRUE;
bool confronta = true;
if (!aggiorna)
{
_soggetti->read(rec);
@ -319,7 +319,7 @@ void TProv2com::agg_anagrafica(const TRectype& recsog, const bool aggiorna)
{
const char xcatdon = _configfile->get(catdon, "CATDON")[0];
if (xcatdon != X_SOS_CONAVVISO)
confronta = FALSE;
confronta = false;
}
if (confronta)
{
@ -340,7 +340,7 @@ void TProv2com::agg_anagrafica(const TRectype& recsog, const bool aggiorna)
{
print_line();
print_line(intestazione);
_print_header = TRUE;
_print_header = true;
}
switch (operazione)
{
@ -444,7 +444,7 @@ void TProv2com::agg_donazione(const TRectype& recsog, const TRectype& recdon)
{
print_line();
print_line(intestazione);
_print_header = TRUE;
_print_header = true;
}
message = " INSERITA DONAZIONE in data ";
message << datadon.string();
@ -507,7 +507,7 @@ void TProv2com::agg_controllo(const TRectype& recsog, const TRectype& reccon)
{
print_line();
print_line(intestazione);
_print_header = TRUE;
_print_header = true;
}
const char* tipocon = reccon.get(CON_TIPOCON);
message.format(" INSERITO CONTROLLO %s in data %s", tipocon, datacon.string());
@ -565,7 +565,7 @@ void TProv2com::agg_benemerenza(const TRectype& recsog, const TRectype& recben)
{
print_line();
print_line(intestazione);
_print_header = TRUE;
_print_header = true;
}
message.format(" INSERITA BENEMERENZA %s", (const char*) tipoben);
print_line(message);
@ -617,7 +617,7 @@ void TProv2com::agg_storico(const TRectype& recsog, const TRectype& recsto)
{
print_line();
print_line(intestazione);
_print_header = TRUE;
_print_header = true;
}
message.format(" INSERITA RIGA DI STORICO");
print_line(message);

@ -78,7 +78,7 @@ bool TReconstruction::create()
_intsi_m = config.get_int("IntSI_M");
_intaf_m = config.get_int("IntAF_M");
dispatch_e_menu(BAR_ITEM(1));
return TRUE;
return true;
}
bool TReconstruction::destroy()
@ -111,17 +111,17 @@ static int compare_date(const TObject** o1, const TObject** o2)
bool TReconstruction::menu(MENU_TAG m)
{
bool _calcolacat = FALSE;
bool _calcolacat = false;
KEY tasto = _msk->run();
if (tasto == K_ENTER)
{
TLocalisamfile rconvoc(LF_RCONVOC);
_rel->lfile().setkey(1);
bool modificato = FALSE;
bool modificato = false;
TDate oggi(TODAY);
TRectype& recsog = _rel->curr();
TProgind pi(_rel->items(),"Aggiornamento situazione soggetti da appoggio", TRUE, TRUE, 10);
TProgind pi(_rel->items(),"Aggiornamento situazione soggetti da appoggio", true, true, 10);
pi.setstatus(1);
for (_rel->first(); _rel->ok(); _rel->next())
{
@ -198,7 +198,7 @@ bool TReconstruction::menu(MENU_TAG m)
rconvoc.put(RCV_DATACONV, recsog.get(SOG_DATACONV));
if (rconvoc.read() == NOERR)
{
rconvoc.put(RCV_ANNULLATO, TRUE);
rconvoc.put(RCV_ANNULLATO, true);
int err = rconvoc.write();
}
const TDate datanulla(NULLDATE);
@ -212,7 +212,7 @@ bool TReconstruction::menu(MENU_TAG m)
recsog.rewrite(_rel->lfile());
}
}
return FALSE;
return false;
}
int TReconstruction::write(TSheet_field& s)

@ -17,7 +17,20 @@ public:
bool TMaskModInt::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
return TRUE;
switch (o.dlg())
{
case F_S_REPORT:
if (e == fe_button)
{
TFilename path = "at95*";
if (select_custom_file(path,"rep"))
o.set(path.name());
}
break;
default:
break;
}
return true;
}
class TTModInt : public TSkeleton_application
@ -38,8 +51,7 @@ void TTModInt::main_loop()
{
TReport_book book;
TReport rep;
TFilename report_name("at9500b");
TFilename report_name(m.get(F_S_REPORT));
report_name.ext("rep");
report_name.custom_path();
if (rep.load(report_name))

@ -7,12 +7,14 @@
#define F_S_CODSOT 106
#define F_S_CATDON 107
#define F_S_TESSAVIS 108
#define F_S_TESTO1 109
#define F_S_TESTO2 110
#define F_S_TESTO3 111
#define F_S_TESTO4 112
#define F_S_TESTO5 113
#define F_S_REPORT 109
#define F_S_DENSEZ 211
#define F_S_DENSOT 212
#define F_S_TESTO1 110
#define F_S_TESTO2 111
#define F_S_TESTO3 112
#define F_S_TESTO4 113
#define F_S_TESTO5 114
#define F_S_DENSEZ 211
#define F_S_DENSOT 212
#define F_S_DESC_CATDON 213

@ -153,31 +153,38 @@ BEGIN
FLAGS "D"
END
// SCELTA REPORT
STRING F_S_REPORT 32
BEGIN
PROMPT 2 9 "Modulo "
FLAGS "B"
CHECKTYPE REQUIRED
END
STRING F_S_TESTO1 70
BEGIN
PROMPT 2 9 ""
END
STRING F_S_TESTO2 70
BEGIN
PROMPT 2 10 ""
END
STRING F_S_TESTO3 70
BEGIN
PROMPT 2 11 ""
END
STRING F_S_TESTO4 70
STRING F_S_TESTO2 70
BEGIN
PROMPT 2 12 ""
END
STRING F_S_TESTO5 70
STRING F_S_TESTO3 70
BEGIN
PROMPT 2 13 ""
END
STRING F_S_TESTO4 70
BEGIN
PROMPT 2 14 ""
END
STRING F_S_TESTO5 70
BEGIN
PROMPT 2 15 ""
END
ENDPAGE

@ -1,26 +0,0 @@
call mskcomp at0100a
call mskcomp at0200a
call mskcomp at0300a
call mskcomp at0700a
call mskcomp at0800a
call mskcomp at1100a
call mskcomp at1200a
call mskcomp at2100a
call mskcomp at2200a
call mskcomp at2300a
call mskcomp at2400a
call mskcomp at2500a
call mskcomp at2600a
call mskcomp at3100a
call mskcomp at3200a
call mskcomp at3300a
call mskcomp at3400a
call mskcomp at4100a
call mskcomp batbbnz
call mskcomp batbctd
call mskcomp batbctn
call mskcomp batbido
call mskcomp batblcp
call mskcomp batbldn
call mskcomp batbtcs
call mskcomp batbtdn

@ -4,6 +4,7 @@
#include <automask.h>
#include <controls.h>
#include <dongle.h>
#include <execp.h>
#include <modaut.h>
#include <execp.h>
#include <recarray.h>
@ -65,7 +66,9 @@ protected:
int do_level();
int do_tree();
int do_explore();
int get_user_status(const char* usr) const;
bool set_user_status(const char* usr, int status) const;
bool check_user();
static bool menu_item_handler(TMask_field& f, KEY k);
@ -1066,6 +1069,61 @@ bool TMenu_application::ask_user_password(TString& utente)
return ok;
}
// Testa stato utente: 0 inesistente; 1 = esiste; 2 connesso; 4 conversione in corso
// ATTENZIONE: non usare mai cache() in ba0!
int TMenu_application::get_user_status(const char* usr) const
{
CHECK(usr && *usr, "Utente nullo");
int status = 0;
if (prefix_valid())
{
TLocalisamfile utonti(LF_USER);
utonti.put(USR_USERNAME, usr);
status = utonti.read() == NOERR;
if (status)
{
if (utonti.get_bool(USR_CONNECTED))
status |= 2;
if (dongle().administrator() == usr && utonti.get(USR_AUTSTR) == "CONVERTING")
status |= 4;
}
}
else
{
// Senza file aperti questo e' il massimo che posso fare
status = dongle().administrator() == usr;
}
return status;
}
bool TMenu_application::set_user_status(const char* usr, int status) const
{
CHECK(usr && *usr, "Utente nullo");
bool ok = false;
if (prefix_valid())
{
TLocalisamfile utonti(LF_USER);
utonti.put(USR_USERNAME, usr);
if (utonti.read(_isequal, _lock) == NOERR)
{
utonti.put(USR_CONNECTED, status & 2 ? "X" : "");
ok = utonti.rewrite() == NOERR;
}
}
if (status & 2)
{
// Memorizza utente per riproporlo la prossima volta
TConfig campo_ini(CONFIG_INSTALL, "Main");
campo_ini.set("User", usr);
}
return ok;
}
bool TMenu_application::check_user()
{
bool ok = dongle().type() == _no_dongle;
@ -1078,7 +1136,7 @@ bool TMenu_application::check_user()
TConfig campo_ini(CONFIG_INSTALL, "Main");
const bool use_system_user = campo_ini.get_bool("AutoLogin");
if (use_system_user)
ok = !cache().get(LF_USER, utente).empty();
ok = get_user_status(utente) != 0; // L'utente esiste!
}
if (!ok)
@ -1086,8 +1144,8 @@ bool TMenu_application::check_user()
if (ok)
{
const TString& autstr = cache().get(LF_USER, dongle().administrator(), USR_AUTSTR);
if (autstr == "CONVERTING")
const bool converting = (get_user_status(dongle().administrator()) & 4) != 0;
if (converting)
{
TString msg; msg << TR("E' in corso una conversione archivi") << ":\n";
if (utente == dongle().administrator())
@ -1103,13 +1161,7 @@ bool TMenu_application::check_user()
}
if (ok)
{
dongle().logout();
user() = utente;
ok = get_serial_number() >= 0;
if (!ok)
error_box(TR("Probabilmente è stato superato il numero massimo di utenti"));
}
set_user_status(utente, 3); // Esistente e connesso (1 | 2 = 3)
if (ok)
{
@ -1305,17 +1357,8 @@ bool TMenu_application::user_create()
void TMenu_application::deconnect_user()
{
if (prefix_valid())
{
TLocalisamfile users(LF_USER);
users.put("USERNAME", user());
const int err = users.read(_isequal, _lock);
if (err == NOERR)
{
users.zero("CONNECTED");
users.rewrite();
}
}
if (get_user_status(user()) & 2) // Se e' connesso
set_user_status(user(), 1); // Sconnettilo
}
bool TMenu_application::destroy()

@ -382,9 +382,9 @@ void TSubmenu::read(TScanner& scanner)
break;
}
}
if (disable)
_enabled = false;
}
if (disable)
_enabled = false;
} else
if (line.starts_with("Picture", true))
{

@ -664,6 +664,9 @@ void TMenulist_window::click_on(int index)
else
{
mi.perform();
//se installa si suicida
if (installing())
owner().mask().stop_run(K_FORCE_CLOSE);
}
set_focus();
}

@ -1348,6 +1348,9 @@ bool TAttivazione_moduli::create()
ok = TApplication::test_assistance_year();
#ifdef DBG
// Backdoor nascosta per la cifratura del dninst.zip
// Mettere nella cartella dei programi il file dninst.txt ...
// ... e nascera' in automagico il file dninst.zip per Luca
if (ok && argc() > 2 && strcmp(argv(2), "-dninst") == 0)
ok = false;
#endif

@ -461,8 +461,9 @@ bool TInstaller_mask::autoload()
installini.list_paragraphs(paragrafi);
//settaggio del produttore sull'install.ini locale nel caso sia cambiato..
//..ovvero ad ogni nuova versione prassi..no partners..cioe' doubleone..volevo dire sirio..
//const TString& local_producer = installini.get("Producer", "Main");
installini.set("Producer", (const char*)producer, "Main");
if (producer.full())
installini.set("Producer", (const char*)producer, "Main");
FOR_EACH_ARRAY_ROW(modules, am, arow)
{
file = *arow;

@ -324,6 +324,8 @@ void TReport_properties_mask::set_report(const TReport& r)
set(F_INCLUDE, ((TReport&)r).get_libraries());
set(F_PRESCRIPT, r.prescript());
set(F_POSTSCRIPT, r.postscript());
set(F_PAGE_SPLIT, r.page_split_allowed());
set(F_PAGE_MERGE, r.page_merge_allowed());
sfield(F_PARAMS).rows_array() = r.params();
sfield(F_LINK).rows_array() = r.allegates();
@ -357,6 +359,9 @@ void TReport_properties_mask::get_report(TReport& r) const
r.set_params(sfield(F_PARAMS).rows_array());
r.set_allegates(sfield(F_LINK).rows_array());
r.allow_page_split(get_bool(F_PAGE_SPLIT));
r.allow_page_merge(get_bool(F_PAGE_MERGE));
}
///////////////////////////////////////////////////////////

@ -55,7 +55,9 @@
#define F_CAN_BREAK 168
#define F_ORIENTATION 169
#define F_CLASS 170
#define F_COMMAND 171
#define F_COMMAND 171
#define F_PAGE_SPLIT 172
#define F_PAGE_MERGE 173
#define F_SQL 201

@ -24,16 +24,26 @@ BEGIN
CHECKTYPE NORMAL
END
BOOLEAN F_PAGE_SPLIT
BEGIN
PROMPT 26 1 "Suddividi una pagina su piu' fogli"
END
BOOLEAN F_PAGE_MERGE
BEGIN
PROMPT 26 2 "Raggruppa piu' pagine in un foglio"
END
NUMBER F_DY 2
BEGIN
PROMPT 1 6 "Linee per pollice "
PROMPT 26 3 "Linee per pollice "
FLAGS "U"
CHECKTYPE REQUIRED
END
BUTTON F_FONT_SELECT 12 2
BEGIN
PROMPT 1 7 "~Font"
PROMPT 26 4 "~Font"
END
MEMO F_INCLUDE 57 3
@ -67,7 +77,7 @@ PAGE "Parametri" -1 -1 60 16
SPREADSHEET F_PARAMS 0 -3
BEGIN
PROMPT 1 1 ""
PROMPT 1 6 ""
ITEM "Parametro@16"
ITEM "Valore@50"
END

@ -185,13 +185,13 @@ public:
bool TGoogle_app::create()
{
TConfig ini("servers/servers.ini", "Spotlight");
TConfig ini("servers/servers.ini", "Spotlite");
TFilename name = ini.get("Data");
bool ok = name.exist();
if (!ok)
{
name = firm2dir(-1);
name.add("spotlight");
name.add("spotlite");
TString msg;
msg << TR("Il server di archiviazione non e' configurato")
<< ":\n" << TR("si desidera usare la seguente cartella?")

@ -4,7 +4,7 @@ PAGE "Installazione VE" -1 -1 78 8
BOOL F_DEFAULTSDATA
BEGIN
PROMPT 2 2 "Carica le tabelle con i tipi documento"
PROMPT 2 2 "Carica le tabelle del modulo Vendite"
END
BUTTON DLG_OK 10 2

@ -4,7 +4,7 @@ PAGE "Installazione MG" -1 -1 78 8
BOOL F_DEFAULTSDATA
BEGIN
PROMPT 2 2 "Carica le tabelle con le causali"
PROMPT 2 2 "Carica le tabelle del modulo Magazzino"
END
BUTTON DLG_OK 10 2

@ -26,6 +26,7 @@ Item_07 = "Stampa anagrafiche", "ba6 -0", ""
Item_08 = "Stampa tabelle", [MENU_003]
Item_09 = "Stampa tabelle ministeriali", [MENU_012]
Item_10 = "Stampa fogli libri bollati", "ba3 -2", "F"
Item_11 = "Moduli aggiuntivi", <baaddon.men>
[MENU_002]
Caption = "Tabelle"
@ -33,16 +34,16 @@ Picture = <ba02>
Module = 0
Flags = ""
Item_01 = "Codici IVA", "ba3 -0 %iva", ""
Item_02 = "Codici Attivita'", "ba3 -0 %ais", ""
Item_03 = "Condizioni di pagamento", "ba3 -6", ""
Item_04 = "Classificazione pagamenti", "ba3 -0 %clr", ""
Item_05 = "Libri sociali", "ba3 -0 %itl", ""
Item_06 = "Banche", "ba3 -0 %ban", ""
Item_07 = "Codici statistici", "ba3 -0 %stt", ""
Item_08 = "Cariche sociali", "ba3 -0 %crs", ""
Item_09 = "Vecchi cod.Attivita'", "ba3 -0 %ois", ""
Item_10 = "Stati", "ba3 -0 %sta", ""
Item_11 = "Indetraibiltà", "ba3 -0 %det", ""
Item_02 = "Indetraibiltà", "ba3 -0 %det", ""
Item_03 = "Codici Attivita'", "ba3 -0 %ais", ""
Item_04 = "Condizioni di pagamento", "ba3 -6", ""
Item_05 = "Classificazione pagamenti", "ba3 -0 %clr", ""
Item_06 = "Libri sociali", "ba3 -0 %itl", ""
Item_07 = "Banche", "ba3 -0 %ban", ""
Item_08 = "Codici statistici", "ba3 -0 %stt", ""
Item_09 = "Cariche sociali", "ba3 -0 %crs", ""
Item_10 = "Vecchi cod.Attivita'", "ba3 -0 %ois", ""
Item_11 = "Stati", "ba3 -0 %sta", ""
[MENU_003]
Caption = "Stampa tabelle"
@ -102,7 +103,7 @@ Caption = "Manutenzione"
Picture = <ba04>
Module = 0
Flags = ""
Item_01 = "Archivi", "ba1", ""
Item_01 = "Archivi", "ba1 -0", ""
Item_02 = "Compatta tutti i files", "ba1 -2", ""
Item_03 = "Utenti", "ba1 -3", ""
Item_04 = "Attivazione moduli", "ba1 -4", ""

@ -130,50 +130,49 @@ END
#endif
GROUPBOX DLG_NULL 40 4
GROUPBOX DLG_NULL 14 4
BEGIN
PROMPT 3 6 "@bColonne per allegati imponibili"
END
LIST FLD_TABIVA_S7 1 24
BEGIN
PROMPT 4 7 "Clienti "
FIELD S7
HELP "Inserire il numero della colonna degli allegati clienti relativa all'imposta"
ITEM " |Non in allegato"
ITEM "1|Imponibili"
ITEM "2|Non imponibili"
ITEM "3|Senza applicaz.imposta"
END
LIST FLD_TABIVA_S8 1 24
BEGIN
PROMPT 4 8 "Fornitori "
FIELD S8
HELP "Inserire il numero della colonna degli allegati fornitori relativa all'imposta"
ITEM " |Non in allegato"
ITEM "1|Imponibili"
ITEM "2|Non imponibili"
ITEM "3|Senza applicaz.imposta"
END
GROUPBOX DLG_NULL 25 4
BEGIN
PROMPT 44 6 "@bIndicatori mod. 101/102"
PROMPT 3 6 "@bMod. 101/102"
END
BOOLEAN CHK_TABIVA_B0
BEGIN
PROMPT 50 7 "Clienti"
PROMPT 4 7 "Clienti"
FIELD B0
HELP "Indicare se il codice deve comparire nel modello 101"
END
BOOLEAN FLD_TABIVA_B1
BEGIN
PROMPT 50 8 "Fornitori"
PROMPT 4 8 "Fornitori"
FIELD B1
HELP "Indicare se il codice deve comparire nel modello 102"
END
GROUPBOX DLG_NULL 48 4
BEGIN
PROMPT 19 6 "@bAllegati Clienti/Fornitori"
END
LIST FLD_TABIVA_S7 1 43
BEGIN
PROMPT 20 7 ""
FIELD S7
ITEM " |Non in allegato"
ITEM "1|CL004001 - Imponibili"
ITEM "2|CL005001 - Non imponibili"
ITEM "3|CL006001 - Senza applicazione imposta"
ITEM "4|CL007001 - IVA non esposta in fattura"
END
LIST FLD_TABIVA_S8 1 43
BEGIN
PROMPT 20 8 ""
FIELD S8
ITEM " |Non in allegato"
ITEM "1|FR004001 - Imponibili"
ITEM "5|FR005001 - Imponibili+Imposta afferente"
ITEM "2|FR006001 - Non imponibili"
ITEM "3|FR007001 - Senza applicazione imposta"
ITEM "4|FR008001 - IVA non esposta in fattura"
END
STRING FLD_TABIVA_I3 3

@ -29,3 +29,4 @@
#define AMMCE_MSG05 "MSG05"
#define AMMCE_MSGD05 "MSGD05"
#define AMMCE_MSG06 "MSG06"
#define AMMCE_FRINGEBEN "FRINGEBEN"

@ -326,7 +326,7 @@ int ce0100(int argc, char* argv[])
if (argc > 2)
{
TString name;
name << TR("Tabella ") << argv[2];
name << TR("Tabella") << ' ' << argv[2];
TCEtables a;
a.run(argc, argv, name);
}

@ -11,7 +11,6 @@
#include "ce0500a.h"
#include "../cg/cglib01.h"
#include "cespi.h"
#include "salce.h"
#include "ammce.h"
@ -135,17 +134,18 @@ void TQuery_mask::on_user_search(TOperable_field& o)
TString prompt = o.prompt();
prompt << "@" << o.size(); //lunghezza del prompt del campo
header.add(prompt);
order.add(CESPI_IDCESPITE); header.add(TR("Cespite@10"));
order.add(CESPI_DESC); header.add(FR("Descrizione cespite@50"));
order.add(CESPI_IDCESPITE); header.add(HR("Cespite@10"));
order.add(CESPI_DESC); header.add(HR("Descrizione cespite@50"));
TRelation rel(LF_CESPI);
TSorted_cursor cur(&rel, order);
TCursor_sheet sht(&cur, order, TR("Cespiti"), header, 0, 1);
TToken_string siblings;
TBrowse_sheet sht(&cur, order, TR("Cespiti"), header, 0, (TEdit_field&)o, siblings);
if (sht.run() == K_ENTER)
{
TToken_string& row = sht.row();
set(F_IDCESPITE, row.get(1), TRUE);
set(F_IDCESPITE, row.get(1), true);
stop_run(K_AUTO_ENTER);
}
}
@ -155,27 +155,26 @@ void TQuery_mask::on_search_event(TOperable_field& o)
TToken_string order, fields, header;
if (o.dlg() >= F_SEARCH3)
{
order.add(CESPI_STABILIM); header.add(TR("Stabilimento"));
order.add(CESPI_REPARTO); header.add(FR("Reparto@10"));
order.add(CESPI_STABILIM); header.add(HR("Stabilimento"));
order.add(CESPI_REPARTO); header.add(HR("Reparto@10"));
}
if (o.dlg() >= F_SEARCH2)
{
order.add(CESPI_CODIMP); header.add(FR("Impianto@10"));
order.add("CIM->S0"); header.add(FR("Descrizione impianto@40"));
order.add(CESPI_CODIMP); header.add(HR("Impianto@10"));
order.add("CIM->S0"); header.add(HR("Descrizione impianto@40"));
}
if (o.dlg() >= F_SEARCH1)
{
order.add(CESPI_CODCAT); header.add(TR("Cat"));
order.add(CESPI_DTCOMP); header.add(FR("Data Acq.@10"));
order.add(CESPI_CODCAT); header.add(HR("Cat"));
order.add(CESPI_DTCOMP); header.add(HR("Data Acq.@10"));
}
order.add(CESPI_IDCESPITE); header.add(FR("Codice@10"));
order.add(CESPI_IDCESPITE); header.add(HR("Codice@10"));
fields = order;
fields.add(CESPI_DESC); header.add(FR("Descrizione cespite@50"));
fields.add(CESPI_DESC); header.add(HR("Descrizione cespite@50"));
TRelation rel(LF_CESPI);
rel.add("CIM","CODTAB==CODIMP");
TString filter;
@ -193,12 +192,13 @@ void TQuery_mask::on_search_event(TOperable_field& o)
}
TSorted_cursor cur(&rel, order, filter);
TCursor_sheet sht(&cur, fields, TR("Cespiti"), header, 0, 1);
TCursor_sheet sht(&cur, order, TR("Cespiti"), header, 0, 1);
if (sht.run() == K_ENTER)
{
TToken_string& row = sht.row();
const int cod_pos = row.items()-2;
set(F_IDCESPITE, row.get(cod_pos), TRUE);
set(F_IDCESPITE, row.get(cod_pos), true);
stop_run(K_AUTO_ENTER);
}
}
@ -334,7 +334,7 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
default:
break;
}
return TRUE;
return true;
}
void TQuery_mask::on_firm_change()
@ -408,7 +408,7 @@ TCurrency TEdit_mask::sum_fields(const short* f) const
bool TEdit_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
bool ok = TRUE;
bool ok = true;
switch (o.dlg())
{
case F_CATEGORIA:
@ -524,7 +524,7 @@ bool TEdit_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
TCurrency plusr; get_currency(F_PLUSREIN, plusr);
const TCurrency minim = costo - noamm;
if (plusr > minim)
return error_box(FR("La plusvalenza reinvestita non puo' superare %s"), minim.string(TRUE));
return error_box(FR("La plusvalenza reinvestita non puo' superare %s"), minim.string(true));
}
break;
case F_ELEMENTI:
@ -567,10 +567,18 @@ bool TEdit_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
if (fon_amm > val_amm)
{
TString msg;
msg << TR("Il fondo ammortamento fiscale (") << fon_amm.string(TRUE) << ')';
msg << TR("non puo' superare il valore da ammortizzare (") << val_amm.string(TRUE) << ')';
msg << TR("Il fondo ammortamento fiscale (") << fon_amm.string(true) << ')';
msg << TR("non puo' superare il valore da ammortizzare (") << val_amm.string(true) << ')';
return error_box(msg);
}
if (field(F_FRINGEBEN).active())
{
const short ff[] = { F_NORMALE, F_ACCELERATO, F_ANTICIPATO, 0};
const TCurrency fringe_amm = sum_fields(ff);
TCurrency fringe_ben; get_currency(F_FRINGEBEN, fringe_ben);
if (fringe_amm > fringe_ben)
return error_box(TR("Il fondo ammortamento fiscale non puo' superare il valore di fringe benefit"));
}
}
break;
case F_FPRIVATO:
@ -593,8 +601,8 @@ bool TEdit_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
if (fon_amm > val_amm)
{
TString msg;
msg << TR("Il fondo ammortamento civilistico (") << fon_amm.string(TRUE) << ')';
msg << TR("non puo' superare il valore da ammortizzare (") << val_amm.string(TRUE) << ')';
msg << TR("Il fondo ammortamento civilistico (") << fon_amm.string(true) << ')';
msg << TR("non puo' superare il valore da ammortizzare (") << val_amm.string(true) << ')';
return error_box(msg);
}
}
@ -639,13 +647,13 @@ void TEdit_mask::protect_page(int page, TToken_string& enabling)
bool TEdit_mask::test_ammissibilita_dati()
{
const char* msg = insert_mode() ? TR("Inserimento") : TR("Modifica");
xvtil_statbar_set(msg, TRUE);
xvtil_statbar_set(msg, true);
return FALSE;
}
bool TEdit_mask::test_ammissibilita_saldi()
{
bool protez = FALSE;
bool protez = false;
const char* msg = "";
switch (_staat)
{
@ -656,7 +664,7 @@ bool TEdit_mask::test_ammissibilita_saldi()
const TDate dtacq(get(F_DTCOMP));
const TDate dtfunz(get(F_DTFUNZ));
if (!dtacq.ok() || !dtfunz.ok())
protez = TRUE;
protez = true;
else
protez = dtacq >= iniz || dtfunz >= iniz;
if (protez)
@ -664,7 +672,7 @@ bool TEdit_mask::test_ammissibilita_saldi()
}
break;
case 3:
protez = TRUE;
protez = true;
msg = TR("Bollato stampato: non sono ammesse modifiche");
break;
default:
@ -680,14 +688,14 @@ bool TEdit_mask::test_ammissibilita_saldi()
beep(1);
else
msg = insert_mode() ? TR("Inserimento") : TR("Modifica");
xvtil_statbar_set(msg, TRUE);
xvtil_statbar_set(msg, true);
return protez;
}
bool TEdit_mask::test_ammissibilita_fondi()
{
bool protez = FALSE;
bool protez = false;
const char* msg = "";
switch (_staat)
{
@ -697,7 +705,7 @@ bool TEdit_mask::test_ammissibilita_fondi()
const TDate dtacq(get(F_DTCOMP));
const TDate dtfunz(get(F_DTFUNZ));
if (!dtacq.ok() || !dtfunz.ok())
protez = TRUE;
protez = true;
else
{
const TDate iniz(get(F_INIZIO_ES));
@ -708,10 +716,10 @@ bool TEdit_mask::test_ammissibilita_fondi()
}
break;
case 3:
protez = TRUE;
protez = true;
msg = TR("Bollato stampato: non sono ammesse modifiche");
break;
default: protez = FALSE; break;
default: protez = false; break;
}
TToken_string enabling;
@ -723,11 +731,11 @@ bool TEdit_mask::test_ammissibilita_fondi()
{
const TDate dtfunz(get(F_DTFUNZ));
const TDate iniz(get(F_INIZIO_ES));
bool prot9 = FALSE;
bool prot9 = false;
if (!dtfunz.ok() || dtfunz >= iniz)
{
msg = TR("Cespite non ancora entrato in funzione a inizio esercizio");
prot9 = TRUE;
prot9 = true;
}
else
{
@ -735,16 +743,24 @@ bool TEdit_mask::test_ammissibilita_fondi()
if (cac.get_bool("B0"))
{
msg = TR("Categoria non ammortizzabile");
prot9 = TRUE;
prot9 = true;
}
}
enable(-9, !prot9);
//testa se e' un veicolo promiscuo in uso a dipendente
if (!prot9)
{
const bool veicolodipendente = get_bool(F_VEIDIP);
//navi,aerei,astronavi etc. non possono godere del fringe benefit
const int tipoveicolo = get_int(F_VEICOLO);
enable(F_FRINGEBEN, veicolodipendente && tipoveicolo > 1 && tipoveicolo < 5);
}
}
if (*msg)
beep(1);
else
msg = insert_mode() ? TR("Inserimento") : TR("Modifica");
xvtil_statbar_set(msg, TRUE);
xvtil_statbar_set(msg, true);
return protez;
}
@ -759,6 +775,7 @@ bool TEdit_mask::on_key(KEY k)
case K_CTRL+K_F1: new_page = 1; break;
case K_CTRL+K_F2: new_page = 2; break;
case K_CTRL+K_F3: new_page = 3; break;
case K_CTRL+K_F4: new_page = 4; break;
case K_PREV : new_page--; break;
case K_NEXT : new_page++; break;
default: break;
@ -767,9 +784,9 @@ bool TEdit_mask::on_key(KEY k)
// If page will change ...
if (old_page != new_page) switch(new_page)
{
case 1: test_ammissibilita_dati(); break;
case 2: test_ammissibilita_saldi(); break;
case 3: test_ammissibilita_fondi(); break;
case 1: test_ammissibilita_dati(); break;
case 3: test_ammissibilita_saldi(); break;
case 4: test_ammissibilita_fondi(); break;
default: break;
}
@ -819,7 +836,7 @@ protected:
bool TAnacespi::changing_mask(int)
{
return TRUE;
return true;
}
TMask* TAnacespi::get_mask(int mode)
@ -934,42 +951,35 @@ void TAnacespi::init_modify_mode(TMask& m)
if (dtacq < iniz)
{
if (!dtfunz.ok() || dtfunz >= iniz)
{
enabling.add(F_DTFUNZ);
enabling.add(F_USOPROM);
enabling.add(F_VEIDIP);
enabling.add(F_VEICOLO);
if (_emask->tipo_cespite() == tc_materiale)
enabling.add(F_SPEMAN);
}
else
if (_emask->tipo_cespite() == tc_materiale)
{
enabling.add(F_USOPROM);
enabling.add(F_VEIDIP);
enabling.add(F_VEICOLO);
if (_emask->tipo_cespite() == tc_materiale)
enabling.add(F_SPEMAN);
enabling.add(F_SPEMAN);
enabling.add(F_FABBR06);
}
}
break;
case 3:
if (!dtfunz.ok() || dtfunz >= iniz)
{
enabling.add(F_DTFUNZ);
}
break;
default:
break;
}
_emask->protect_page(1, enabling);
enabling.cut(0);
if (staat == 2 || staat == 3)
{
enabling.cut(0);
_emask->protect_page(2, enabling);
}
if (!m.field(F_DTALIEN).empty())
xvtil_statbar_set(TR("Cespite alienato: non è possibile apportare modifiche"), TRUE);
xvtil_statbar_set(TR("Cespite alienato: non è possibile apportare modifiche"), true);
}
const char* TAnacespi::get_next_key()
@ -983,8 +993,7 @@ const char* TAnacespi::get_next_key()
int TAnacespi::read(TMask& m)
{
int err = TRelation_application::read(m);
return err;
return TRelation_application::read(m);
}
int TAnacespi::write(const TMask& m)
@ -1045,7 +1054,7 @@ bool TAnacespi::kill_cespite(const TString& idcespite, int lfile, int key)
{
TRelation rel(lfile);
TRectype& filter = rel.curr();
filter.put("IDCESPITE", idcespite);
filter.put(CESPI_IDCESPITE, idcespite);
TCursor cur(&rel, "", key, &filter, &filter);
const TRecnotype items = cur.items();
if (items > 0)
@ -1059,13 +1068,13 @@ bool TAnacespi::kill_cespite(const TString& idcespite, int lfile, int key)
return error_box(FR("Errore %d di cancellazione sul file %d"), err, lfile);
}
}
return TRUE;
return true;
}
bool TAnacespi::remove()
{
const int staat = _qmask->stato_attivita();
bool yes = FALSE;
bool yes = false;
if (staat == 3)
yes = yesno_box(TR("ATTENZIONE: il cespite è già stato stampato su bollato.\n"
"Si desidera confermare l'elimininazione?"));
@ -1082,9 +1091,9 @@ bool TAnacespi::remove()
kill_cespite(idcespite, LF_MOVAM) && kill_cespite(idcespite, LF_AMMMV) &&
kill_cespite(idcespite, LF_AMMCE))
{
rel->write_enable(0, FALSE); // Disabilito la cancellazione dei saldi (gia' cancellati prima)
rel->write_enable(0, false); // Disabilito la cancellazione dei saldi (gia' cancellati prima)
yes = TRelation_application::remove();
rel->write_enable(0, TRUE);
rel->write_enable(0, true);
}
}
return yes;
@ -1098,7 +1107,7 @@ bool TAnacespi::user_create()
_qmask = new TQuery_mask;
_emask = new TEdit_mask;
return TRUE;
return true;
}
bool TAnacespi::user_destroy()
@ -1106,7 +1115,7 @@ bool TAnacespi::user_destroy()
delete _cespiti;
delete _emask;
delete _qmask;
return TRUE;
return true;
}
int ce0500(int argc, char* argv[])

@ -30,12 +30,12 @@
#define F_VEIDIP 138
#define F_LEASING 139
#define F_USATO 140
#define F_FABBR06 141
#define F_SPEMAN 150
#define F_VEICOLO 151
#define F_DESC_VEICOLO 152
#define F_USOPROM 153
#define F_DESC_USOPROM 154
#define F_ANNIRIC 155
#define F_USER 160
@ -43,15 +43,17 @@
#define F_ELEMENTI 202
#define F_COSTO 203
#define F_VNONAMM 204
#define F_PLUSREIN 205
#define F_RIV75 206
#define F_RIV83 207
#define F_RIV90 208
#define F_ANNI_90 209
#define F_RIV91 210
#define F_ANNI_91 211
#define F_RIVGF 212
#define F_RIVGC 213
#define F_VNONAMM06 205
#define F_VNONAMMC 206
#define F_PLUSREIN 207
#define F_RIV75 208
#define F_RIV83 209
#define F_RIV90 210
#define F_ANNI_90 211
#define F_RIV91 212
#define F_ANNI_91 213
#define F_RIVGF 214
#define F_RIVGC 215
#define F_NORMALE 252
#define F_ACCELERATO 253
@ -61,6 +63,7 @@
#define F_QPERSEPRIV 257
#define F_VSPMANU 258
#define F_ANNIAMM 259
#define F_FRINGEBEN 260
#define F_NORMALE2 302
#define F_ACCELERATO2 303

@ -244,6 +244,16 @@ BEGIN
FIELD USATO
END
LIST F_FABBR06 13
BEGIN
PROMPT 31 16 "Fabbricato strumentale art.43 "
ITEM "0|" MESSAGE CLEAR,F_VNONAMM06|CLEAR,F_VNONAMMC
ITEM "1|Industriale" MESSAGE ENABLE,F_VNONAMM06|ENABLE,F_VNONAMMC
ITEM "2|Altro" MESSAGE ENABLE,F_VNONAMM06|ENABLE,F_VNONAMMC
FIELD FABBR06
FLAGS "G"
END
LIST F_SPEMAN 1 24
BEGIN
PROMPT 1 17 "Gestione spese manutenzione "
@ -275,25 +285,15 @@ BEGIN
FLAGS "D"
END
NUMBER F_USOPROM 1
LIST F_USOPROM 1 57
BEGIN
PROMPT 1 19 "Uso promiscuo "
SHEET "Tipo@4R|Descrizione@60"
INPUT F_USOPROM
ITEM "1|Deducibilità 100% - Esclusivamente strumentale"
ITEM "2|Deducibilità 50% - Uso promiscuo"
ITEM "3|Deducibilità 80% - Uso promiscuo agenti/rappresentanti"
OUTPUT F_USOPROM
OUTPUT F_DESC_USOPROM
FIELD USOPROM
END
STRING F_DESC_USOPROM 80 54
BEGIN
PROMPT 22 19 ""
FLAGS "D"
END
ENDPAGE
PAGE "Personalizzazioni" -1 -1 78 18
@ -374,46 +374,76 @@ END
CURRENCY F_COSTO 15
BEGIN
PROMPT 1 7 "Costo storico "
PROMPT 47 6 "Costo storico "
FIELD LF_SALCE->CSTO
END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 0 7 "@bValore non ammortizzabile"
END
CURRENCY F_VNONAMM 15
BEGIN
PROMPT 1 8 "Valore non ammortizzabile "
PROMPT 1 8 "Fiscale "
FIELD LF_SALCE->VNONAMM
END
CURRENCY F_PLUSREIN 15
CURRENCY F_VNONAMMC 15
BEGIN
PROMPT 1 9 "Plusvalenza reinvestita "
FIELD LF_SALCE->PLUSREIN
PROMPT 49 8 "Civilistico "
FIELD LF_SALCE->VNONAMMC
END
CURRENCY F_VNONAMM06 15
BEGIN
PROMPT 1 9 "Da scorporo terreno secondo articolo 36 D.L. 223/06 "
FIELD LF_SALCE->VNONAMM06
END
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 0 11 "@bRivalutazione"
END
CURRENCY F_RIVGF 15
BEGIN
PROMPT 1 12 "Generica fiscale "
FIELD LF_SALCE->RIVGF
GROUP 8
END
CURRENCY F_RIVGC 15
BEGIN
PROMPT 40 12 "Generica civilistica "
FIELD LF_SALCE->RIVGC
GROUP 8
END
CURRENCY F_RIV75 15
BEGIN
PROMPT 1 10 "Rivalutazione L. 576/75 "
PROMPT 1 13 "Legge 576/75 "
FIELD LF_SALCE->RIV75
GROUP 8
END
CURRENCY F_RIV83 15
BEGIN
PROMPT 1 11 "Rivalutazione L. 72/83 "
PROMPT 40 13 "Legge 72/83 "
FIELD LF_SALCE->RIV83
GROUP 8
END
CURRENCY F_RIV90 15
BEGIN
PROMPT 1 12 "Rivalutazione L. 408/90 "
PROMPT 1 14 "L.408/90 "
FIELD LF_SALCE->RIV90
GROUP 8
END
NUMBER F_ANNI_90 2
BEGIN
PROMPT 1 13 "Anni post rivalutazione L. 408/90 "
PROMPT 40 14 "Anni post rivalutazione L. 408/90 "
FLAGS "DU"
FIELD LF_SALCE->ANNIPOST90
CHECKTYPE REQUIRED
@ -423,14 +453,14 @@ END
CURRENCY F_RIV91 15
BEGIN
PROMPT 1 14 "Rivalutazione L. 413/91 "
PROMPT 1 15 "L.413/91 "
FIELD LF_SALCE->RIV91
GROUP 8
END
NUMBER F_ANNI_91 2
BEGIN
PROMPT 1 15 "Anni post rivalutazione L. 413/91 "
PROMPT 40 15 "Anni post rivalutazione L. 413/91 "
FLAGS "DU"
FIELD LF_SALCE->ANNIPOST91
CHECKTYPE REQUIRED
@ -438,18 +468,10 @@ BEGIN
GROUP 8
END
CURRENCY F_RIVGF 15
CURRENCY F_PLUSREIN 15
BEGIN
PROMPT 1 16 "Rivalutazione generica fiscale "
FIELD LF_SALCE->RIVGF
GROUP 8
END
CURRENCY F_RIVGC 15
BEGIN
PROMPT 1 17 "Rivalutazione generica civilistica "
FIELD LF_SALCE->RIVGC
GROUP 8
PROMPT 1 17 "Plusvalenza reinvestita "
FIELD LF_SALCE->PLUSREIN
END
CURRENCY F_VSPMANU 15
@ -587,6 +609,18 @@ BEGIN
GROUP 9
END
CURRENCY F_FRINGEBEN 15
BEGIN
PROMPT 1 14 "Fringe benefit "
FIELD LF_AMMCE->FRINGEBEN
GROUP 9
CHECKTYPE REQUIRED
END
//quelli che seguono hidati sono i campi chiave del record di ammce che non si devono vedere
//a video ma che ci devono essere per avere una riscrittura completa del record in caso di
//registrazione (altrimenti nascono antipatici record con chiave incopleta!)
LIST DLG_NULL 1 1
BEGIN
PROMPT 41 6 ""

@ -1,8 +1,5 @@
#include <applicat.h>
#include <automask.h>
#include <isam.h>
#include <mask.h>
#include <prefix.h>
#include <progind.h>
#include <relation.h>
#include <sheet.h>

@ -2,7 +2,6 @@
#include <recarray.h>
#include <relapp.h>
#include <sheet.h>
#include <utility.h>
#include "ce1.h"
#include "ce2101.h"
@ -302,7 +301,15 @@ bool TForce_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
real sumf = get_real(F_AMMNOR_F)+get_real(F_AMMACC_F)+get_real(F_AMMANT_F)+get_real(F_QUOTE_PERSE)+get_real(F_PRIVATO)+get_real(F_QUOTE_PRIV);
if (sumf > _residuof_ini)
return error_box(TR("Attenzione: l'ammortamento richiesto supera il residuo fiscale del cespite"));
return error_box(TR("Attenzione: l'ammortamento richiesto supera il residuo fiscale del cespite"));
if (e == fe_close && field(F_FRINGEBEN).shown())
{
const real fringe_amm = get_real(F_AMMNOR_F)+get_real(F_AMMACC_F)+get_real(F_AMMANT_F);
const real fringe_ben = get_real(F_FRINGEBEN);
if (fringe_amm > fringe_ben)
return error_box(TR("Il fondo ammortamento fiscale non puo' superare il valore di fringe benefit"));
}
}
break;
case F_AMMNOR_C: // controlla che residuoc sia < della somma dei campi quota civilistici
@ -417,9 +424,10 @@ void TForza_amm_cespi::init_modify_mode(TMask& m)
m.enable(F_FORZATURA_Q_C, accendiforzatura);
m.enable(F_FORZATURA_P_C, accendiforzatura);
const TCespite ces(m.get(F_IDCESPITE));
if (accendiforzatura) //se lo stato attivitá lascia liberi di forzare, controlla se il tipocespite fa altrettanto...
{
TCespite ces(m.get(F_IDCESPITE));
{
const TRectype& cac = ces.categoria();
switch (ces.tipo())
{
@ -454,6 +462,11 @@ void TForza_amm_cespi::init_modify_mode(TMask& m)
m.set(F_RIS_AMMNOR_C, m.get_real(F_AMMNOR_C));
m.set(F_RIS_AMMACC_C, m.get_real(F_AMMACC_C));
m.set(F_RIS_AMMANT_C, m.get_real(F_AMMANT_C));
if (ces.get_bool(CESPI_VEIDIP) && ces.get_int(CESPI_FLGTPVEI) > 1 && ces.get_int(CESPI_FLGTPVEI) < 5)
m.show(F_FRINGEBEN);
else
m.hide(F_FRINGEBEN);
}
// funzione per il ricalcolo degli ammortamenti dopo la forzatura

@ -46,7 +46,8 @@
#define F_RIS_AMMACC_C 149
#define F_RIS_AMMANT_C 150
#define F_RIS_QUOTE_PERSE 151
#define F_RIS_PRIVATO 152
#define F_RIS_PRIVATO 152
#define F_RIS_QUOTE_PRIV 153
#define F_RESIDUO_F 154
#define F_RESIDUO_C 155
#define F_FRINGEBEN 156

@ -311,6 +311,14 @@ BEGIN
GROUP 3
END
CURRENCY F_FRINGEBEN 15
BEGIN
PROMPT 1 21 "Fringe benefit "
FIELD FRINGEBEN
FLAGS "D"
GROUP 1
END
NUMBER F_P_AMMNOR_F 6 2
BEGIN
PROMPT 35 15 ""

@ -1,8 +1,6 @@
#include <defmask.h>
#include <recarray.h>
#include <relapp.h>
#include <sheet.h>
#include <utility.h>
#include "ce1.h"
#include "ce2101.h"

@ -2,7 +2,6 @@
#include <recarray.h>
#include <relapp.h>
#include <sheet.h>
#include <utility.h>
#include "ce1.h"
#include "ce2101.h"
@ -421,6 +420,8 @@ bool TSelam_mmask::on_field_event(TOperable_field& o, TField_event e, long jolly
}
break;
default:
break;
}
@ -764,7 +765,13 @@ void TSelect_ammoces::init_mask(TMask& m)
m.set(F_AMMFISC_ACC_CT, catdi.get(CATDI_PFACC));
m.set(F_AMMCIV_ACC_CT, catdi.get(CATDI_PCACC));
m.set(F_AMMRIT_CT, catdi.get(CATDI_AMMRIT));
m.set(F_AMM100_CT, catdi.get(CATDI_CSCEN));
m.set(F_AMM100_CT, catdi.get(CATDI_CSCEN));
if (ces.get_bool(CESPI_VEIDIP) && ces.get_int(CESPI_FLGTPVEI) > 1 && ces.get_int(CESPI_FLGTPVEI) < 5)
m.show(F_FRINGEBEN);
else
m.hide(F_FRINGEBEN);
break;
} //chiude lo switch

@ -54,6 +54,9 @@
#define F_AMM100_CE 249
#define F_AMM1002_CE 250
#define F_AMM1003_CE 251
#define F_FRINGEBEN 252
#define F_FRINGEBEN2 253
#define F_FRINGEBEN3 254
#define F_ALIQMAX 301
#define F_AMMFISC_CT 302

@ -153,7 +153,7 @@ END
TEXT DLG_NULL
BEGIN
PROMPT 56 7 " Normale Anticipato"
PROMPT 56 7 "Normale Anticipato"
END
TEXT DLG_NULL
@ -223,7 +223,7 @@ END
TEXT DLG_NULL
BEGIN
PROMPT 40 11 " Normale Accelerato Anticipato"
PROMPT 40 11 "Normale Accelerato Anticipato"
END
TEXT DLG_NULL
@ -292,7 +292,7 @@ END
TEXT DLG_NULL
BEGIN
PROMPT 40 17 " Normale Accelerato Anticipato"
PROMPT 40 17 "Normale Accelerato Anticipato"
END
TEXT DLG_NULL
@ -379,7 +379,6 @@ BEGIN
PROMPT 111 20 ""
FLAGS "D"
FIELD 69@->AMMRIT
GROUP 1
END
BOOLEAN F_AMMRIT_CE3
@ -387,9 +386,32 @@ BEGIN
PROMPT 113 20 ""
FLAGS "D"
FIELD 77@->AMMRIT
END
CURRENCY F_FRINGEBEN 15
BEGIN
PROMPT 35 20 "Fringe benefit veicoli "
FIELD FRINGEBEN
FLAGS "G"
MESSAGE FALSE COPY,F_FRINGEBEN2|COPY,F_FRINGEBEN3
MESSAGE TRUE COPY,,F_FRINGEBEN2|COPY,F_FRINGEBEN3
GROUP 1
END
CURRENCY F_FRINGEBEN2 15
BEGIN
PROMPT 115 20 ""
FIELD 69@->FRINGEBEN
FLAGS "D"
END
CURRENCY F_FRINGEBEN3 15
BEGIN
PROMPT 117 20 ""
FIELD 77@->FRINGEBEN
FLAGS "D"
END
BOOLEAN F_AMM100_CE
BEGIN
PROMPT 1 21 "Amm.to al 100% per beni di valore unitario inferiore a 516.46 Euro"

@ -335,12 +335,14 @@ private:
void set_fondi_inputability();
real calc_riv(const TRectype& salpro, int tipo) const;
real calc_vnonamm(const TRectype& salpro, int tipo) const;
bool calc_amm(int tipo);
void calc_plus_minus(int tipo, real& plus, real& minus) const;
bool cespite_nuovo() const;
TCurrency sum_fields(const short* f) const;
void super_polish();
void enable_fabbricato();
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
@ -385,6 +387,26 @@ void TMov_emask::super_polish()
}
}
//metodo per accendere/spegnere campi relativi ai fabbricati scorporabili
void TMov_emask::enable_fabbricato()
{
const TDate dtmov = get(F_DTMOV);
const TTipoFabbricato tipo_fabbr = _cespite.fabbricato();
if (tipo_fabbr != tf_nessuno && dtmov >= TDate(4,7,2006) && field(F_VNONAMM).active())
{
enable(-13);
set(F_FABBR06, tipo_fabbr);
set(F_DATASCORP06, dtmov);
if (mode() == MODE_INS)
set(F_PERCALC06, tipo_fabbr == tf_industriale ? 30 : 20);
}
else
{
reset(-13);
disable(-13);
}
}
void TMov_emask::set_inputability(short id, char flag)
{
TMask_field& f = field(id);
@ -456,7 +478,10 @@ bool TMov_emask::on_field_event(TOperable_field& o, TField_event e, long jolly)
set_inputability(F_IMPVEN, _s5[2]);
set_inputability(F_ELEMENTI, _s5[3]);
set_inputability(F_COSTO, _s5[4]);
set_inputability(F_VNONAMM, _s5[5]);
set_inputability(F_VNONAMMC, _s5[5]);
set_inputability(F_PLUSREIN, _s5[6]);
set_inputability(riv_ids, _s5[7]);
set_inputability(F_RIVGF, _s5[8]);
@ -468,6 +493,11 @@ bool TMov_emask::on_field_event(TOperable_field& o, TField_event e, long jolly)
case '-': disable(F_SEGNO); set(F_SEGNO, "-"); break;
default : enable(F_SEGNO); break;
}
//solo se e' in modifica abilita il test sul fabbricato;se fosse in fe_init non potrebbe conoscere in..
//..questo momento l'idcespite e quindi non potrebbe riconoscerlo come fabbricato anche se lo fosse e..
//..resetterebbe i campi della pagina fabbricato!
if (e == fe_modify)
enable_fabbricato();
}
break;
case F_IDRET:
@ -493,13 +523,13 @@ bool TMov_emask::on_field_event(TOperable_field& o, TField_event e, long jolly)
const TString& id = o.get();
if (_cespite.get(CESPI_IDCESPITE) != id)
_cespite.read(id);
enable_page(3, id.not_empty());
enable_page(4, id.not_empty());
if (id.not_empty())
{
const TRectype& cat = _cespite.categoria();
set(F_CATEGORIA, _cespite.get(CESPI_CODCAT), true);
set(F_DESC_CAT, cat.get("S0"), true);
if (o.enabled())
if (e != fe_init && o.enabled())
{
const TRectype& tpmov = cache().get("%TMC", get(F_CODMOV));
@ -519,7 +549,9 @@ bool TMov_emask::on_field_event(TOperable_field& o, TField_event e, long jolly)
break;
}
}
}
//gestione fabbricati scorporabili da d.l. 223/06
enable_fabbricato();
} //if(id.not_empty...
else
{
reset(F_CATEGORIA);
@ -557,13 +589,15 @@ bool TMov_emask::on_field_event(TOperable_field& o, TField_event e, long jolly)
ini.set("DataMovimento", "");
}
const TDate dtmov(o.get());
const TDate dtret(get(F_DTMOV_RET));
if (dtret.ok())
{
const TDate dtmov(o.get());
if (dtmov < dtret)
return error_box(TR("La data del movimento di rettifica deve seguire la data del movimento rettificato"));
}
if (dtret.ok() && dtmov < dtret)
return error_box(TR("La data del movimento di rettifica deve seguire la data del movimento rettificato"));
//gestione campi per fabbricati scorporati
if (e == fe_modify)
enable_fabbricato();
}
break;
case F_TPDOC:
@ -621,7 +655,8 @@ bool TMov_emask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
if (!test_inputability(fis_ids, _s5[10]))
return false;
const short fv[] = { F_COSTO, -F_VNONAMM, F_RIV75, F_RIV83, F_RIV90, F_RIV91, F_RIVGF, 0 };
const short fv[] = { F_COSTO, -F_VNONAMM, -F_VNONAMM06,
F_RIV75, F_RIV83, F_RIV90, F_RIV91, F_RIVGF, 0 };
const short fa[] = { F_NORMALE, F_ACCELERATO, F_ANTICIPATO, F_QPERSE, F_FPRIVATO, F_QPERSEPRIV, 0 };
const TCurrency val_amm = sum_fields(fv);
const TCurrency fon_amm = sum_fields(fa);
@ -630,8 +665,12 @@ bool TMov_emask::on_field_event(TOperable_field& o, TField_event e, long jolly)
TString msg;
msg << TR("Il fondo ammortamento fiscale (") << fon_amm.string(true) << ')';
msg << TR("non puo' superare il valore da ammortizzare (") << val_amm.string(true) << ')';
return error_box(msg);
}
// Per i fabbricati scorporati non e' un errore
if (_cespite.fabbricato() != tf_nessuno && !field(F_VNONAMM06).empty())
warning_box(msg);
else
return error_box(msg); }
}
break;
case F_NORMALE2:
@ -668,13 +707,29 @@ real TMov_emask::calc_riv(const TRectype& salpro, int tipo) const
real riv;
for (int i = 0; riv_ids[i]; i++)
riv += salpro.get_real(riv_ids[i]);
if (tipo == 1)
riv += salpro.get_real(SALCE_RIVGF);
if (tipo == 2)
if (tipo == 1 || _cespite.get_bool(CESPI_LEASING))
riv += salpro.get_real(SALCE_RIVGF); else
if (tipo == 2 && !_cespite.get_bool(CESPI_LEASING))
riv += salpro.get_real(SALCE_RIVGC);
return riv;
}
real TMov_emask::calc_vnonamm(const TRectype& salpro, int tipo) const
{
real vnonamm;
if (tipo == 2)
vnonamm += salpro.get_real(SALCE_VNONAMMC);
else
vnonamm += salpro.get_real(SALCE_VNONAMM);
if (_cespite.fabbricato() != tf_nessuno)
vnonamm += salpro.get_real(SALCE_VNONAMM06);
return vnonamm;
}
void TMov_emask::calc_plus_minus(int tipo, real& plus, real& minus) const
{
TDitta_cespiti& cce = ditta_cespiti();
@ -712,7 +767,7 @@ void TMov_emask::calc_plus_minus(int tipo, real& plus, real& minus) const
bool TMov_emask::calc_amm(int tipo)
{
const TString& idcespite = _cespite.get(CESPI_IDCESPITE);
if (idcespite.empty())
if (idcespite.blank())
return false;
const TDate dtlim(get(F_DTMOV));
@ -721,13 +776,16 @@ bool TMov_emask::calc_amm(int tipo)
const TRectype& s = _cespite.sal_pro();
set(S_ELEMENTI, s.get(SALCE_NUMELE));
set(S_COSTO, s.get_real(SALCE_CSTO));
set(S_VNONAMM, s.get(SALCE_VNONAMM));
set(S_COSTO, s.get_real(SALCE_CSTO));
set(S_PLUSREIN, s.get(SALCE_PLUSREIN));
set(S_TOTRIV, calc_riv(s, tipo));
set(S_TOTRIV, calc_riv(s, tipo));
set(S_VNONAMM, calc_vnonamm(s, tipo));
real tot_val;
tot_val += get_real(S_COSTO); tot_val -= get_real(S_VNONAMM);
tot_val -= get_real(S_PLUSREIN); tot_val += get_real(S_TOTRIV);
tot_val += get_real(S_COSTO);
tot_val += get_real(S_TOTRIV);
tot_val -= get_real(S_PLUSREIN);
tot_val -= get_real(S_VNONAMM);
set(S_TOTVAL, tot_val);
const TRectype& a = _cespite.amm_pro();
@ -738,12 +796,12 @@ bool TMov_emask::calc_amm(int tipo)
set(S_FPRIVATO, a.get(AMMCE_FPRIVATOP));
set(S_QPERSEP, a.get(AMMCE_QPPRIVATEP));
real tot_fon;
tot_fon += get_real(S_NORMALE); tot_fon += get_real(S_ACCELERATO);
tot_fon += get_real(S_NORMALE); tot_fon += get_real(S_ACCELERATO);
tot_fon += get_real(S_ANTICIPATO); tot_fon += get_real(S_QPERSE);
tot_fon += get_real(S_FPRIVATO); tot_fon += get_real(S_QPERSEP);
tot_fon += get_real(S_FPRIVATO); tot_fon += get_real(S_QPERSEP);
set(S_TOTFON, tot_fon);
const real tot_res = tot_val-tot_fon;
const real tot_res = tot_val - tot_fon;
set(S_RESIDUO, tot_res);
real plus, minus;

@ -52,13 +52,22 @@
#define F_RIVGF 210
#define F_RIVGC 211
#define F_IMPVEN 212
#define F_VNONAMMC 213
#define F_PLUSMIN_FIS_TXT 221
#define F_PLUSMIN_FIS 222
#define F_PLUSMIN_CIV_TXT 223
#define F_PLUSMIN_CIV 224
#define F_PLUSMIN_GES_TXT 225
#define F_PLUSMIN_GES 226
#define F_PLUSMIN_FIS_TXT 221
#define F_PLUSMIN_FIS 222
#define F_PLUSMIN_CIV_TXT 223
#define F_PLUSMIN_CIV 224
#define F_PLUSMIN_GES_TXT 225
#define F_PLUSMIN_GES 226
#define F_FABBR06 230
#define F_DATASCORP06 231
#define F_VALTERR06 232
#define F_PERCALC06 233
#define F_VALCALC06 234
#define F_RISCALC06 235
#define F_VNONAMM06 236
#define F_IDMOVAM 251
#define F_IDCESAM 252

@ -1,6 +1,6 @@
#include "ce1500a.h"
TOOLBAR "Toolbar" 0 -3 0 3
TOOLBAR "Toolbar" 0 -2 0 2
#include <toolbar.h>
@ -441,107 +441,280 @@ BEGIN
FIELD SEGNO
END
CURRENCY F_IMPVEN 15
BEGIN
PROMPT 21 10 "Importo vendita "
FIELD IMPVEN
END
NUMBER F_ELEMENTI 4
BEGIN
PROMPT 1 11 "Numero elementi "
PROMPT 57 10 "Numero elementi "
FIELD NUMELE
END
CURRENCY F_COSTO 15
BEGIN
PROMPT 1 12 "Costo storico "
PROMPT 1 11 "Costo storico "
FIELD CSTO
END
CURRENCY F_VNONAMM 15
BEGIN
PROMPT 1 13 "Valore non ammortizzabile "
FIELD VNONAMM
END
CURRENCY F_PLUSREIN 15
BEGIN
PROMPT 1 14 "Plusvalenza reinvestita "
PROMPT 37 11 "Plusvalenza reinvestita "
FIELD PLUSREIN
END
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 12 "@bValore non ammortizzabile"
END
CURRENCY F_VNONAMM 15
BEGIN
PROMPT 2 13 "Fiscale "
FIELD VNONAMM
END
CURRENCY F_VNONAMMC 15
BEGIN
PROMPT 41 13 "Civilistico "
FIELD VNONAMMC
END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 15 "@bRivalutazioni"
END
CURRENCY F_RIV75 15
BEGIN
PROMPT 1 15 "Rivalutazione L. 576/75 "
PROMPT 2 16 "L. 576/75 "
FIELD RIV75
END
CURRENCY F_RIV83 15
BEGIN
PROMPT 1 16 "Rivalutazione L. 72/83 "
PROMPT 41 16 "L. 72/83 "
FIELD RIV83
END
CURRENCY F_RIV90 15
BEGIN
PROMPT 1 17 "Rivalutazione L. 408/90 "
PROMPT 2 17 "L. 408/90 "
FIELD RIV90
END
CURRENCY F_RIV91 15
BEGIN
PROMPT 1 18 "Rivalutazione L. 413/91 "
PROMPT 41 17 "L. 413/91 "
FIELD RIV91
END
CURRENCY F_RIVGF 15
BEGIN
PROMPT 1 19 "Rivalutazione generica fiscale "
PROMPT 2 18 "Generica fiscale "
FIELD RIVGF
END
CURRENCY F_RIVGC 15
BEGIN
PROMPT 1 20 "Rivalutazione generica civilistica "
PROMPT 41 18 "Generica civilistica "
FIELD RIVGC
END
CURRENCY F_IMPVEN 15
BEGIN
PROMPT 45 10 "Importo vendita "
FIELD IMPVEN
END
TEXT F_PLUSMIN_FIS_TXT
BEGIN
PROMPT 54 12 "Minusvalenza fiscale"
PROMPT 1 20 "Minusvalenza fiscale"
END
CURRENCY F_PLUSMIN_FIS 15
BEGIN
PROMPT 61 13 ""
PROMPT 5 21 ""
FLAGS "D"
END
TEXT F_PLUSMIN_CIV_TXT
BEGIN
PROMPT 54 15 "Minusvalenza civilistica"
PROMPT 25 20 "Minusvalenza civilistica"
END
CURRENCY F_PLUSMIN_CIV 15
BEGIN
PROMPT 61 16 ""
PROMPT 33 21 ""
FLAGS "D"
END
TEXT F_PLUSMIN_GES_TXT
BEGIN
PROMPT 54 18 "Minusvalenza gestionale"
PROMPT 54 20 "Minusvalenza gestionale"
END
CURRENCY F_PLUSMIN_GES 15
BEGIN
PROMPT 61 19 ""
PROMPT 62 21 ""
FLAGS "D"
END
ENDPAGE
PAGE "Fabbricati" -1 -1 78 18
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 0 1 "@bDitta"
END
NUMBER DLG_NULL 5
BEGIN
PROMPT 1 2 "Ditta "
FLAGS "DF"
END
STRING DLG_NULL 50
BEGIN
PROMPT 26 2 ""
FLAGS "D"
GROUP 1
END
NUMBER DLG_NULL 4
BEGIN
PROMPT 1 3 "Esercizio "
FLAGS "DZ"
GROUP 2
END
DATE DLG_NULL
BEGIN
PROMPT 26 3 "Inizio "
FLAGS "D"
GROUP 3
END
DATE DLG_NULL
BEGIN
PROMPT 50 3 "Fine "
FLAGS "D"
GROUP 4
END
NUMBER DLG_NULL 2
BEGIN
PROMPT 1 4 "Gruppo "
FLAGS "DZ"
GROUP 5
END
STRING DLG_NULL 4
BEGIN
PROMPT 16 4 "Specie "
FLAGS "D"
GROUP 6
END
STRING DLG_NULL 60 45
BEGIN
PROMPT 31 4 ""
FLAGS "D"
GROUP 7
END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 0 6 "@bCespite"
END
NUMBER DLG_NULL 10
BEGIN
PROMPT 1 7 ""
FLAGS "DZ"
GROUP 8
END
STRING DLG_NULL 60
BEGIN
PROMPT 16 7 ""
FLAGS "DZ"
GROUP 9
END
NUMBER DLG_NULL 2
BEGIN
PROMPT 1 8 "Categoria "
FLAGS "DZ"
GROUP 10
END
STRING DLG_NULL 70 60
BEGIN
PROMPT 16 8 ""
FLAGS "D"
GROUP 11
END
GROUPBOX DLG_NULL 78 9
BEGIN
PROMPT 0 10 "@bScorporo terreno per fabbricati strumentali art.43 D.L.223/06"
END
LIST F_FABBR06 13
BEGIN
PROMPT 1 11 "Tipologia del fabbricato "
ITEM "0|"
ITEM "1|Industriale"
ITEM "2|Altro"
FLAGS "D"
END
DATE F_DATASCORP06
BEGIN
PROMPT 1 12 "Data immissione scorporo "
FLAGS "D"
END
CURRENCY F_VALTERR06 15
BEGIN
PROMPT 1 13 "Valore del terreno "
GROUP 13
FIELD VALTERR06
END
CURRENCY F_VALCALC06 15
BEGIN
PROMPT 1 14 "Valore calcolo % scorporo "
FIELD VALCALC06
GROUP 13
END
NUMBER F_PERCALC06 6 2
BEGIN
PROMPT 1 15 "% da scorporare "
GROUP 13
FIELD PERCALC06
END
NUMBER F_RISCALC06 15
BEGIN
PROMPT 1 16 "Risultato dello scorporo "
PICTURE ".2"
FLAGS "DG"
DRIVENBY F_VALCALC06 F_PERCALC06
NUM_CALC ROUND(#F_VALCALC06*#F_PERCALC06/100;2)
END
NUMBER F_VNONAMM06 15
BEGIN
PROMPT 1 17 "Costo indeducibile "
PICTURE ".2"
FIELD VNONAMM06
FLAGS "DG"
DRIVENBY F_RISCALC06 F_VALTERR06
NUM_CALC IF(#F_RISCALC06>#F_VALTERR06;#F_RISCALC06;#F_VALTERR06)
END
ENDPAGE
PAGE "Fondi" -1 -1 78 18
GROUPBOX DLG_NULL 78 5

@ -1,9 +1,6 @@
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <progind.h>
#include <recarray.h>
#include <relation.h>
#include "ce2100a.h"
#include "ce2101.h"

@ -132,7 +132,17 @@ void TCespite::read_sal(int esercizio)
TLocalisamfile salce(LF_SALCE);
fill_sal_key(salce.curr(), esercizio, 1);
if (salce.read() == NOERR)
{
_salini = salce.curr();
// Il campo VNONAMMC nasce solo nel 2006, prima era da intendersi uguale a VNONAMM
if (!_salini.get_real(SALCE_VNONAMM).is_zero() &&
_salini.get_real(SALCE_VNONAMMC).is_zero())
{
TEsercizi_contabili esc;
if (esc[esercizio].inizio() < TDate(4,7,2006))
_salini.put(SALCE_VNONAMMC, _salini.get(SALCE_VNONAMM));
}
}
else
{
fill_sal_key(_salini, esercizio, 1);
@ -165,13 +175,14 @@ void TCespite::read_amm(int esercizio)
fill_amm_key(_ammpro, esercizio, 2);
_ammpro.write(ammce);
}
_ammpro.put(AMMCE_QNORP, _ammini.get(AMMCE_QNOR));
_ammpro.put(AMMCE_QACCP, _ammini.get(AMMCE_QACC));
_ammpro.put(AMMCE_QANTP, _ammini.get(AMMCE_QANT));
_ammpro.put(AMMCE_QPERSEP, _ammini.get(AMMCE_QPERSE));
_ammpro.put(AMMCE_FPRIVATOP, _ammini.get(AMMCE_FPRIVATO));
_ammpro.put(AMMCE_QNORP, _ammini.get(AMMCE_QNOR));
_ammpro.put(AMMCE_QACCP, _ammini.get(AMMCE_QACC));
_ammpro.put(AMMCE_QANTP, _ammini.get(AMMCE_QANT));
_ammpro.put(AMMCE_QPERSEP, _ammini.get(AMMCE_QPERSE));
_ammpro.put(AMMCE_FPRIVATOP, _ammini.get(AMMCE_FPRIVATO));
_ammpro.put(AMMCE_QPPRIVATEP, _ammini.get(AMMCE_QPPRIVATE));
_ammpro.put(AMMCE_SCELTE, _ammini.get(AMMCE_SCELTE));
_ammpro.put(AMMCE_SCELTE, _ammini.get(AMMCE_SCELTE));
_ammpro.put(AMMCE_FRINGEBEN, _ammini.get(AMMCE_FRINGEBEN));
zero_fields(_ammpro, AMMCE_MSG01, AMMCE_MSG02, AMMCE_MSG03, AMMCE_MSG04,
AMMCE_MSG05, AMMCE_MSGD05, AMMCE_MSG06, NULL);
@ -230,6 +241,38 @@ TTipo_cespite TCespite::tipo() const
return tc==0 ? tc_materiale : (tc==1 ? tc_immateriale : tc_pluriennale);
}
TTipoFabbricato TCespite::fabbricato() const
{
TTipoFabbricato tf = tf_nessuno;
switch (get_int(CESPI_FABBR06))
{
case 1: tf = tf_industriale; break;
case 2: tf = tf_altro; break;
default: break;
}
return tf;
}
TTipoVeicolo TCespite::veicolo() const
{
TTipoVeicolo tv = tv_nessuno; // Normalmente non sono un veicolo!
switch (get_int(CESPI_FLGTPVEI))
{
case 2: tv = tv_automobile; break;
case 3: tv = tv_motociclo; break;
case 4: tv = tv_ciclomotore; break;
case 5: tv = tv_altro; break;
default: break;
}
return tv;
}
bool TCespite::auto_o_moto() const
{
const TTipoVeicolo tv = veicolo();
return tv >= tv_automobile && tv <= tv_ciclomotore;
}
// Registra un messaggio 5 su AMMPRO
// Certified 100%
void TCespite::set_msg05(const char* msg)
@ -320,24 +363,33 @@ bool TCespite::valido()
// Certified 50%
real TCespite::val_amm() const
{
real val = _salpro.get_real(SALCE_CSTO)-_salpro.get_real(SALCE_VNONAMM)-_salpro.get_real(SALCE_PLUSREIN)+
_salpro.get_real(SALCE_RIV75)+_salpro.get_real(SALCE_RIV83);
if (_tipo_sit == 1 || get_bool(CESPI_LEASING))
real val = sum_fields(_salpro, SALCE_CSTO, SALCE_RIV75, SALCE_RIV83);
val -= sum_fields(_salpro, SALCE_PLUSREIN, SALCE_VNONAMM);
const bool leasing = get_bool(CESPI_LEASING);
if (_tipo_sit == 1 || leasing)
val += _salpro.get_real(SALCE_RIVGF); else
if (_tipo_sit == 2 && !get_bool(CESPI_LEASING))
if (_tipo_sit == 2 && !leasing)
val += _salpro.get_real(SALCE_RIVGC);
const real riv90 = _salpro.get_real(SALCE_RIV90);
const real riv91 = _salpro.get_real(SALCE_RIV91);
if (riv90 != ZERO || riv91 != ZERO)
if (!riv90.is_zero() || !riv91.is_zero())
{
const int annipost90 = _salpro.get_int(SALCE_ANNIPOST90);
if (riv91 != ZERO || annipost90 >= 3)
if (!riv91.is_zero() || annipost90 >= 3)
val += riv90;
val += riv91;
}
val += riv91;
// Novita' 2006: gestione VNONAMM06 e VNONAMMC
val -= _salpro.get_real(SALCE_VNONAMM06);
if (_tipo_sit == 2)
{
val += _salpro.get_real(SALCE_VNONAMM); // Metto nuovamente il VNONAMM fiscale ...
val -= _salpro.get_real(SALCE_VNONAMMC); // ... poi tolgo il civilistico
}
return val;
}
@ -346,13 +398,10 @@ real TCespite::val_amm() const
real TCespite::res_amm() const
{
const real valamm = val_amm(); // Valore ammortizzabile
real fondo; // Fondo ammortamento
fondo += _ammpro.get_real(AMMCE_QNORP);
fondo += _ammpro.get_real(AMMCE_QANTP);
fondo += _ammpro.get_real(AMMCE_QACCP);
fondo += _ammpro.get_real(AMMCE_QPERSEP);
fondo += _ammpro.get_real(AMMCE_QPPRIVATEP);
fondo += _ammpro.get_real(AMMCE_FPRIVATOP);
// Fondo ammortamento
const real fondo = sum_fields(_ammpro, AMMCE_QNORP, AMMCE_QANTP, AMMCE_QACCP,
AMMCE_QPERSEP, AMMCE_QPPRIVATEP, AMMCE_FPRIVATOP);
const real resamm = valamm - fondo; // Residuo da ammortizzare
return resamm;
}
@ -395,9 +444,8 @@ real TCespite::get_limit() const
{
real limite = -1.0; // Partiamo con limite non valido che in realtà e' considerato +infinito
const int tipo_veicolo = get_int(CESPI_FLGTPVEI);
// Mi pare inutile cercare limiti se è un veicolo senza limiti!
if (tipo_veicolo > 1 && tipo_veicolo < 5)
if (auto_o_moto())
{
TDate inies, fines;
ditta_cespiti().esercizio_corrente(inies, fines);
@ -406,26 +454,57 @@ real TCespite::get_limit() const
// Stabilisce il limite in base al tipo di veicolo ed al suo uso
if (!clm.empty())
{
const TTipoVeicolo tipo_veicolo = veicolo();
switch(tipo_veicolo)
{
case 2: // Autoveicolo
case tv_automobile:
{
const int uso_promiscuo = get_int(CESPI_USOPROM);
if (uso_promiscuo == 2 || uso_promiscuo == 4)
if (uso_promiscuo == 2)
limite = clm.get_real("R0"); else
if (uso_promiscuo == 3 || uso_promiscuo == 5)
if (uso_promiscuo == 3)
limite = clm.get_real("R1");
}
break;
case 3: limite = clm.get_real("R2"); break; // Motociclo
case 4: limite = clm.get_real("R3"); break; // Ciclomotore
case tv_motociclo : limite = clm.get_real("R2"); break;
case tv_ciclomotore: limite = clm.get_real("R3"); break;
default: break;
}
}
}
}
return limite;
}
real TCespite::percentuale_deducibilita() const
{
real percento;
const int uso_promiscuo = get_int(CESPI_USOPROM);
switch (uso_promiscuo)
{
case 2: // Beni in uso promiscuo
percento = 50;
if (ditta_cespiti().legge_223_06())
{
if (auto_o_moto()) // Automobili, motocicli e ciclomotori
{
if (ditta_cespiti().professionista())
percento = 25;
else
percento = ZERO;
}
}
break;
case 3:
percento = 80; // Beni raccomandati?
break;
default:
percento = CENTO; // Beni strumentali al 100%
break;
}
return percento;
}
// Calcola spese manutenzione da scrivere su SALPRO
// Certified 75%
real TCespite::calcola_spese_manutenzione(const real& valamm)
@ -435,18 +514,17 @@ real TCespite::calcola_spese_manutenzione(const real& valamm)
real vspmanu = valamm;
if (!cce.esercizio_costituzione())
{
const real coeff = cce.coefficiente_durata_esercizio();
real limite = get_limit();
if (vspmanu < limite || limite < ZERO) // Limite < 0 = nessun limite
limite = vspmanu;
vspmanu = coeff * limite;
const real limite = get_limit(); // se limite < 0 significa infinito
if (limite > ZERO && vspmanu > limite)
vspmanu = limite;
vspmanu *= cce.coefficiente_durata_esercizio();
}
const int usoprom = get_int(CESPI_USOPROM);
if (usoprom == 2 || usoprom == 4)
vspmanu = vspmanu * 0.50; else // 50%
if (usoprom == 3 || usoprom == 5)
vspmanu = vspmanu * 0.80; // 80%
const real perded = percentuale_deducibilita();
if (perded < CENTO)
vspmanu = vspmanu * perded / CENTO;
// Non arrotondare qui! Altrove serve così com'è
return vspmanu;
}
@ -464,7 +542,7 @@ void TCespite::prepara_saldi(bool is_valid)
if ((tpspeman == 2 || tpspeman == 3) && inies.year() > cce.anno_tuir())
{
const real valamm = val_amm();
real vspmanu = calcola_spese_manutenzione(valamm); // Non arrotondare qui! Altrove serve così com'è
real vspmanu = calcola_spese_manutenzione(valamm);
cce.arrotonda(vspmanu);
_salpro.put(SALCE_VSPMANU, vspmanu);
}
@ -492,6 +570,11 @@ void TCespite::incr_field(TRectype& dst, const char* fdst, const TRectype& src,
}
}
void TCespite::decr_field(TRectype& dst, const char* fdst, const TRectype& src, const char* fsrc, char segno) const
{
incr_field(dst, fdst, src, fsrc, segno == '+' ? '-' : '+');
}
// Applica tutte le rettifice al movimento tmv
// Certified 50%
void TCespite::applica_rettifiche(TRectype& tmv, TRectype& tmvam)
@ -529,7 +612,6 @@ void TCespite::applica_rettifiche(TRectype& tmv, TRectype& tmvam)
const char segno = segno_mov == segno_ret ? '+' : '-';
incr_field(tmv, MOVCE_NUMELE, movret, MOVCE_NUMELE, segno);
incr_field(tmv, MOVCE_CSTO, movret, MOVCE_CSTO, segno);
incr_field(tmv, MOVCE_VNONAMM, movret, MOVCE_VNONAMM, segno);
incr_field(tmv, MOVCE_PLUSREIN, movret, MOVCE_PLUSREIN, segno);
incr_field(tmv, MOVCE_RIV75, movret, MOVCE_RIV75, segno);
incr_field(tmv, MOVCE_RIV83, movret, MOVCE_RIV83, segno);
@ -538,7 +620,10 @@ void TCespite::applica_rettifiche(TRectype& tmv, TRectype& tmvam)
incr_field(tmv, MOVCE_RIVGF, movret, MOVCE_RIVGF, segno);
incr_field(tmv, MOVCE_RIVGC, movret, MOVCE_RIVGC, segno);
incr_field(tmv, MOVCE_IMPVEN, movret, MOVCE_IMPVEN, segno);
incr_field(tmv, MOVCE_VNONAMM, movret, MOVCE_VNONAMM, segno);
incr_field(tmv, MOVCE_VNONAMMC, movret, MOVCE_VNONAMMC, segno);
incr_field(tmv, MOVCE_VNONAMM06,movret, MOVCE_VNONAMM06,segno);
if (rel.is_first_match(LF_MOVAM))
{
const TRectype& ammret = rel.curr(LF_MOVAM);
@ -558,7 +643,6 @@ void TCespite::aggiorna_salpro(const TRectype& tmv, const TRectype& tmvam, char
log(TR("= Aggiornamento saldi ed ammortamenti progressivi"));
incr_field(_salpro, SALCE_NUMELE, tmv, MOVCE_NUMELE, segno);
incr_field(_salpro, SALCE_CSTO, tmv, MOVCE_CSTO, segno);
incr_field(_salpro, SALCE_VNONAMM, tmv, MOVCE_VNONAMM, segno);
incr_field(_salpro, SALCE_PLUSREIN, tmv, MOVCE_PLUSREIN, segno);
incr_field(_salpro, SALCE_RIV75, tmv, MOVCE_RIV75, segno);
incr_field(_salpro, SALCE_RIV83, tmv, MOVCE_RIV83, segno);
@ -566,7 +650,13 @@ void TCespite::aggiorna_salpro(const TRectype& tmv, const TRectype& tmvam, char
incr_field(_salpro, SALCE_RIV91, tmv, MOVCE_RIV91, segno);
incr_field(_salpro, SALCE_RIVGF, tmv, MOVCE_RIVGF, segno);
incr_field(_salpro, SALCE_RIVGC, tmv, MOVCE_RIVGC, segno);
incr_field(_salpro, SALCE_VSPMANU, tmv, "VSPMANU", segno); // Campo virtuale su tmv!
incr_field(_salpro, SALCE_VNONAMM, tmv, MOVCE_VNONAMM, segno);
incr_field(_salpro, SALCE_VSPMANU, tmv, "VSPMANU", segno); // Campo virtuale su tmv!
// Nuova gestione fabbricati Legge 223/06
incr_field(_salpro, SALCE_VNONAMM06, tmv, MOVCE_VNONAMM06, segno);
incr_field(_salpro, SALCE_VNONAMMC, tmv, MOVCE_VNONAMMC, segno);
save_sal();
incr_field(_ammpro, AMMCE_QNORP, tmvam, MOVAM_QNOR, segno);
@ -584,13 +674,14 @@ real TCespite::mov_val_amm(const TRectype& tmv) const
{
const real riv90 = tmv.get_real(MOVCE_RIV90);
const real riv91 = tmv.get_real(MOVCE_RIV91);
real val = tmv.get_real(MOVCE_CSTO) - tmv.get_real(MOVCE_VNONAMM) + tmv.get_real(MOVCE_RIV75) +
tmv.get_real(MOVCE_RIV83) + riv90 + riv91;
if (_tipo_sit == 1 || get_bool(CESPI_LEASING))
val += tmv.get_real(SALCE_RIVGF);
if (_tipo_sit == 2 && !get_bool(CESPI_LEASING))
val += tmv.get_real(SALCE_RIVGC);
real val = sum_fields(tmv, MOVCE_CSTO, MOVCE_RIV75, MOVCE_RIV83);
val += riv90 + riv91 - tmv.get_real(MOVCE_VNONAMM);
const bool leasing = get_bool(CESPI_LEASING);
if (_tipo_sit == 1 || leasing)
val += tmv.get_real(MOVCE_RIVGF);
if (_tipo_sit == 2 && !leasing)
val += tmv.get_real(MOVCE_RIVGC);
const int anni_post90 = _salini.get_int(SALCE_ANNIPOST90);
const int anni_post91 = _salini.get_int(SALCE_ANNIPOST91);
@ -606,6 +697,14 @@ real TCespite::mov_val_amm(const TRectype& tmv) const
}
if (anni_post91 == 0)
val -= riv91;
// Legge 223/06
val -= tmv.get_real(MOVCE_VNONAMM06);
if (_tipo_sit == 2)
{
val += tmv.get_real(MOVCE_VNONAMM); // Recupero VNONAMM fiscale ...
val -= tmv.get_real(MOVCE_VNONAMMC); // ... sottraggo il civilistico
}
return val;
}
@ -625,13 +724,16 @@ real TCespite::mov_res_amm(const TRectype& tmv, const TRectype& tmvam) const
// Cerified 90%
void TCespite::rip_jolly(TRelation& rel, const real& num, const real& den, int mode)
{
TDitta_cespiti& cce = ditta_cespiti();
const TDitta_cespiti& cce = ditta_cespiti();
if (mode & 0x1)
{
TRectype& movsem = rel.curr(LF_MOVCE);
const char* flm[] = { MOVCE_CSTO, MOVCE_VNONAMM, MOVCE_PLUSREIN, MOVCE_RIV75, MOVCE_RIV83,
MOVCE_RIV90, MOVCE_RIV91, MOVCE_RIVGF, MOVCE_RIVGC, NULL };
const char* flm[] = { MOVCE_CSTO, MOVCE_PLUSREIN,
MOVCE_RIV75, MOVCE_RIV83, MOVCE_RIV90, MOVCE_RIV91,
MOVCE_RIVGF, MOVCE_RIVGC,
MOVCE_VNONAMM, MOVCE_VNONAMMC, MOVCE_VNONAMM06, NULL };
for (int i = 0; flm[i]; i++)
{
real n = _salpro.get_real(flm[i]);
@ -701,7 +803,7 @@ int TCespite::test_rip(TRelation& rel)
{
int rip_flag = 0x0;
if (_salpro.get_long(SALCE_NUMELE) == 0L || _salpro.get_real(SALCE_CSTO) == ZERO)
if (_salpro.get_long(SALCE_NUMELE) == 0L || _salpro.get_real(SALCE_CSTO).is_zero())
return rip_flag;
const TRectype& movsem = rel.curr();
@ -719,20 +821,20 @@ int TCespite::test_rip(TRelation& rel)
rip_flag |= 0x1;
// Determina se considerare le rivalutazioni fiscali o civilistiche
const char* rivgfgc = NULL;
if (_tipo_sit == 1)
rivgfgc = MOVCE_RIVGF;
else
{
if (_tipo_sit == 2)
rivgfgc = MOVCE_RIVGC;
}
bool null_movce = null_fields(movsem, MOVCE_VNONAMM, MOVCE_PLUSREIN, MOVCE_RIV75,
MOVCE_RIV83, MOVCE_RIV90, MOVCE_RIV91, rivgfgc);
const bool leasing = get_bool(CESPI_LEASING);
const char* riv_gen_fc = NULL;
if (_tipo_sit==1 || leasing)
riv_gen_fc = MOVCE_RIVGF; else
if (_tipo_sit==2 && !leasing)
riv_gen_fc = MOVCE_RIVGC;
bool null_movce = null_fields(movsem, MOVCE_PLUSREIN, MOVCE_RIV75,
MOVCE_RIV83, MOVCE_RIV90, MOVCE_RIV91,
MOVCE_VNONAMM, MOVCE_VNONAMMC, MOVCE_VNONAMM06,
riv_gen_fc);
if (null_movce)
rip_flag |= 0x2;
if (rip_flag)
if (rip_flag != 0)
{
if (movsem.get_real(MOVCE_CSTO).is_zero())
rip_elem(rel, rip_flag);
@ -743,24 +845,24 @@ int TCespite::test_rip(TRelation& rel)
return rip_flag;
}
// Calcola una quota di ammortamento: semplicemente moltiplica il valore ammortizzabile per una
// percentuale ed ottiene la quota. Se questa supera il residuo da ammortizzare allora
// pone la quota uguale al residuo e ricalcola la percentuale effettiva
// Calcola una quota di ammortamento: semplicemente moltiplica il valore ammortizzabile
// per una percentuale ed ottiene la quota.
// Se questa supera il residuo da ammortizzare allora pone la quota uguale al residuo e
// ricalcola la percentuale effettiva
real TCespite::calc_quota(const real& valamm, const real& perric,
const real& residuo, real& pereff, TRelation* mov /* =NULL */)
{
real quota;
// Caso anomalo di percentuale nulla
// Caso anomalo di percentuale o valore nulli
if (perric <= ZERO || valamm <= ZERO)
{
pereff = ZERO;
return quota;
return ZERO;
}
// Caso normale
quota = valamm * perric / CENTO;
real quota = valamm * perric / CENTO;
pereff = perric;
const TDitta_cespiti& cce = ditta_cespiti();
if (mov != NULL && cce.ragguaglio_ammortamenti_parti_vendute())
@ -776,9 +878,9 @@ real TCespite::calc_quota(const real& valamm, const real& perric,
const long giorni_possesso = dtmov - fnc_max(inies, dtcomp) + 1;
const long giorni_esercizio = fines - inies + 1;
quota = quota * giorni_possesso / giorni_esercizio;
note << TR("Ammortamenti ragguagliati a ")
<< giorni_possesso << TR(" giorni di possesso su ")
<< giorni_esercizio << TR(" giorni dell'esercizio");
note.format(
FR("Ammortamenti ragguagliati a %d giorni di possesso su %d d'esercizio"),
giorni_possesso, giorni_esercizio);
}
ammmv.put(AMMMV_NOTE, note);
}
@ -786,15 +888,10 @@ real TCespite::calc_quota(const real& valamm, const real& perric,
const real coeff_durata = cce.coefficiente_durata_esercizio();
quota *= coeff_durata;
cce.arrotonda(quota);
if (quota > residuo)
{
quota = residuo;
if (valamm > ZERO)
pereff = (quota * CENTO) / (coeff_durata * valamm);
else
pereff = ZERO;
}
if (quota > residuo)
quota = residuo;
pereff = (quota * CENTO) / (coeff_durata * valamm);
return quota;
}
@ -806,7 +903,7 @@ real TCespite::calc_quote_perse(const real& valamm, const real& peric, const rea
const TDitta_cespiti& cce = ditta_cespiti();
const real coeff_durata = cce.coefficiente_durata_esercizio();
real quota = valamm * peric / CENTO * coeff_durata;
real quota = valamm * coeff_durata * peric / CENTO;
if (mov_vend)
{
TDate inies, fines;
@ -834,37 +931,23 @@ real TCespite::calc_quote_perse(const real& valamm, const real& peric, const rea
void TCespite::agg_quota(const real& movvalamm, TRectype& rec, const char* field, bool calcq)
{
const int tipo_veicolo = get_int(CESPI_FLGTPVEI);
const int uso_promiscuo = get_int(CESPI_USOPROM);
real perc;
switch (uso_promiscuo)
{
case 2:
case 4: perc = 0.5; break;
case 3:
case 5: perc = 0.8; break;
default: break;
}
if (perc > ZERO)
const real percento = percentuale_deducibilita();
if (percento < CENTO)
{
const real mva = (rec.num() == LF_AMMMV) ? movvalamm : val_amm();
real clim;
if (tipo_veicolo >= 2 && tipo_veicolo <= 4)
real clim = mva;
if (auto_o_moto()) // Auto, motociclo, ciclomotore
{
clim = get_limit();
if (clim < ZERO || mva < clim)
clim = mva;
}
else
clim = mva;
const TDitta_cespiti& cce = ditta_cespiti();
const real quotat = rec.get_real(field);
const real limcsto = clim / mva;
real campo = quotat * limcsto * perc;
real campo = quotat * limcsto * percento / CENTO;
cce.arrotonda(campo);
rec.put(field, campo);
if (strcmp(field, "QNOR") == 0)
@ -874,7 +957,7 @@ void TCespite::agg_quota(const real& movvalamm, TRectype& rec, const char* field
if (calcq)
{
const real quotap = rec.get_real("QPERSE");
real qp = quotap * limcsto * perc;
real qp = quotap * limcsto * percento / CENTO;
cce.arrotonda(qp);
rec.put("QPERSE", qp);
rec.put("QPPRIVATE", quotap - qp);
@ -894,59 +977,98 @@ HIDDEN const TString& catdi_get(const TRectype* pcatdi, const char* name, int si
// Non sempre basta prendere un campo da AMMINI così com'è:
// in base al campo SCELTE esistono campi speciali da prelevare dalle categorie
// con le seguenti "semplici" modalità
TString& TCespite::ammini_get(const char* pstar) const
const TString& TCespite::ammini_get(const char* pstar) const
{
static TString _val;
_val = _ammini.get(pstar);
TString16 val = _ammini.get(pstar);
TToken_string special = "AMMRIT|CSCEN|PNOR|PACC|PANT";
const int fld = special.get_pos(pstar);
if (fld < 0) // Should NEVER happen: tuttavia non è affatto grave!
return _val;
if (fld >= 0) // Should ALWAYS happen: tuttavia non è affatto grave!
{
const TRectype* pcatdi = NULL;
const TRectype* pcac = NULL;
const TRectype* pcatdi = NULL;
const TRectype* pcac = NULL;
// L'utente fa le sue scelte: ma saranno sensate e coerenti?
int scelte = _ammini.get_int(AMMCE_SCELTE);
if (scelte != 1) // Cerco se esiste un record appropriato su CATDI
{
const int anno = ditta_cespiti().esercizio_corrente();
const int gruppo = get_int(CESPI_CODCGRA);
const TString4 specie = get(CESPI_CODSPA);
const int categ = get_int(CESPI_CODCAT);
TString80 key; key.format("%d|%d|%s|%d", anno, gruppo, (const char*)specie, categ);
const TRectype& catdi = cache().get(LF_CATDI, key);
if (!catdi.empty())
// L'utente fa le sue scelte: ma saranno sensate e coerenti?
int scelte = _ammini.get_int(AMMCE_SCELTE);
if (scelte != 1) // Cerco se esiste un record appropriato su CATDI
{
pcatdi = &catdi;
scelte = 2;
}
else
scelte = 0; // Non trovato: riprova con CAC
}
if (scelte == 0) // Cerco se esiste un record appropriato su CAC
{
const TRectype& cac = categoria();
if (!cac.empty())
pcac = &cac;
else
scelte = 1; // Non trovato: usa direttamente AMMCE
}
if (scelte != 1) // L'utente non ha fatto una esplicita scelta per cespite!
{
const TTipo_cespite tc = tipo();
switch (fld)
{
case 0: // AMMRIT
case 1: // CSCEN
if (tc == tc_materiale && scelte == 2)
_val = pcatdi->get(pstar);
break;
case 2: // PNOR
switch (tc)
const int anno = ditta_cespiti().esercizio_corrente();
const int gruppo = get_int(CESPI_CODCGRA);
const TString4 specie = get(CESPI_CODSPA);
const int categ = get_int(CESPI_CODCAT);
TString80 key; key.format("%d|%d|%s|%d", anno, gruppo, (const char*)specie, categ);
const TRectype& catdi = cache().get(LF_CATDI, key);
if (!catdi.empty())
{
case tc_materiale:
pcatdi = &catdi;
scelte = 2;
}
else
scelte = 0; // Non trovato: riprova con CAC
}
if (scelte == 0) // Cerco se esiste un record appropriato su CAC
{
const TRectype& cac = categoria();
if (!cac.empty())
pcac = &cac;
else
scelte = 1; // Non trovato: usa direttamente AMMCE
}
if (scelte != 1) // L'utente non ha fatto una esplicita scelta per cespite!
{
const TTipo_cespite tc = tipo();
switch (fld)
{
case 0: // AMMRIT
case 1: // CSCEN
if (tc == tc_materiale && scelte == 2)
val = pcatdi->get(pstar);
break;
case 2: // PNOR
switch (tc)
{
case tc_materiale:
{
TDate dtfunz = get_date(CESPI_DTFUNZ);
if (!dtfunz.ok())
{
TDate dtdummy;
ditta_cespiti().esercizio_corrente(dtfunz, dtdummy);
}
const int anno_funz = dtfunz.year();
if (scelte == 2)
{
if (anno_funz < 1988)
val = catdi_get(pcatdi, CATDI_PFNORVN, _tipo_sit);
else
val = catdi_get(pcatdi, anno_funz < 1989 ? CATDI_PFNORVT : CATDI_PFNORNT, _tipo_sit);
}
else
val = pcac->get(anno_funz < 1989 ? "R12" : "R11");
}
break;
case tc_immateriale:
if (scelte == 2)
val = catdi_get(pcatdi, CATDI_PFNORVN, _tipo_sit);
else
val = pcac->get("R13");
break;
case tc_pluriennale:
if (scelte == 2)
val = catdi_get(pcatdi, CATDI_PFNORVN, _tipo_sit);
else
val = pcac->get("R15");
break;
default:
break;
}
break;
case 3: // PACC
if (tc == tc_materiale && scelte == 2)
val = catdi_get(pcatdi, CATDI_PFACC, _tipo_sit);
break;
case 4: // PANT
if (tc == tc_materiale && scelte == 2)
{
TDate dtfunz = get_date(CESPI_DTFUNZ);
if (!dtfunz.ok())
@ -955,59 +1077,19 @@ TString& TCespite::ammini_get(const char* pstar) const
ditta_cespiti().esercizio_corrente(dtfunz, dtdummy);
}
const int anno_funz = dtfunz.year();
if (scelte == 2)
{
if (anno_funz < 1988)
_val = catdi_get(pcatdi, CATDI_PFNORVN, _tipo_sit);
else
_val = catdi_get(pcatdi, anno_funz < 1989 ? CATDI_PFNORVT : CATDI_PFNORNT, _tipo_sit);
}
if (anno_funz < 1988)
val = catdi_get(pcatdi, CATDI_PFANTVN, _tipo_sit);
else
_val = pcac->get(anno_funz < 1989 ? "R12" : "R11");
val = catdi_get(pcatdi, anno_funz < 1989 ? CATDI_PFANTVT : CATDI_PFANTNT, _tipo_sit);
}
break;
case tc_immateriale:
if (scelte == 2)
_val = catdi_get(pcatdi, CATDI_PFNORVN, _tipo_sit);
else
_val = pcac->get("R13");
default:
CHECKS(0, "Unknown special field ", pstar);
break;
case tc_pluriennale:
if (scelte == 2)
_val = catdi_get(pcatdi, CATDI_PFNORVN, _tipo_sit);
else
_val = pcac->get("R15");
break;
default:
break;
}
break;
case 3: // PACC
if (tc == tc_materiale && scelte == 2)
_val = catdi_get(pcatdi, CATDI_PFACC, _tipo_sit);
break;
case 4: // PANT
if (tc == tc_materiale && scelte == 2)
{
TDate dtfunz = get_date(CESPI_DTFUNZ);
if (!dtfunz.ok())
{
TDate dtdummy;
ditta_cespiti().esercizio_corrente(dtfunz, dtdummy);
}
const int anno_funz = dtfunz.year();
if (anno_funz < 1988)
_val = catdi_get(pcatdi, CATDI_PFANTVN, _tipo_sit);
else
_val = catdi_get(pcatdi, anno_funz < 1989 ? CATDI_PFANTVT : CATDI_PFANTNT, _tipo_sit);
}
break;
default:
CHECKS(0, "Unknown special field ", pstar);
break;
}
}
return _val;
return get_tmp_string() = val;
}
bool TCespite::ammini_get_bool(const char* pfield) const
@ -1049,11 +1131,11 @@ void TCespite::calc_perc(TRelation& rel, const TRectype& tmv, const TRectype& tm
if (resamm < ammmv.get_real(AMMMV_QNOR))
{
ammmv.put(AMMMV_QNOR, resamm);
penor = resamm / coeff * 100.0 / mov_val_amm(tmv);
penor = resamm / coeff * CENTO / mov_val_amm(tmv);
}
else //caso per le forzature
{
penor = ammmv.get_real(AMMMV_QNOR) / coeff * 100.0 / mov_val_amm(tmv);
penor = ammmv.get_real(AMMMV_QNOR) / coeff * CENTO / mov_val_amm(tmv);
}
ammmv.put(AMMMV_PENOR, penor);
ammmv.put(AMMMV_PNOR, penor); // Per chiarezza di stampa
@ -1064,11 +1146,11 @@ void TCespite::calc_perc(TRelation& rel, const TRectype& tmv, const TRectype& tm
if (resamm < ammmv.get_real(AMMMV_QACC))
{
ammmv.put(AMMMV_QACC, resamm);
peacc = resamm / coeff * 100.0 / mov_val_amm(tmv);
peacc = resamm / coeff * CENTO / mov_val_amm(tmv);
}
else
{
peacc = ammmv.get_real(AMMMV_QACC) / coeff * 100.0 / mov_val_amm(tmv);
peacc = ammmv.get_real(AMMMV_QACC) / coeff * CENTO / mov_val_amm(tmv);
}
ammmv.put(AMMMV_PEACC, peacc);
ammmv.put(AMMMV_PACC, peacc); // Per chiarezza di stampa
@ -1084,12 +1166,12 @@ void TCespite::calc_perc(TRelation& rel, const TRectype& tmv, const TRectype& tm
if (resamm < ammmv.get_real(AMMMV_QANT))
{
ammmv.put(AMMMV_QANT, resamm);
peant = resamm / coeff * 100.0 / mov_val_amm(tmv);
peant = resamm / coeff * CENTO / mov_val_amm(tmv);
}
else
{
peant = ammmv.get_real(AMMMV_QANT) / coeff * 100.0 / mov_val_amm(tmv);
peant = ammmv.get_real(AMMMV_QANT) / coeff * CENTO / mov_val_amm(tmv);
}
ammmv.put(AMMMV_PEANT, peant);
ammmv.put(AMMMV_PANT, peant); // Per chiarezza di stampa
@ -1160,7 +1242,7 @@ void TCespite::calc_perc(TRelation& rel, const TRectype& tmv, const TRectype& tm
const real mva = mov_val_amm(tmv) / numele;
if (ammini_get_bool(AMMCE_CSCEN) && mva < un_milione())
{
ammmv.put(AMMMV_PENOR, "100");
ammmv.put(AMMMV_PENOR, CENTO);
ammmv.zero(AMMMV_PEANT);
ammmv.zero(AMMMV_PEACC);
}
@ -1280,7 +1362,7 @@ void TCespite::calc_anni(TRectype& ammmv, const TRectype& tmv, const TRectype& t
qnor = resamm;
ammmv.put(AMMMV_QNOR, qnor);
}
const real penor = qnor * 100.0 / mov_val_amm(tmv);
const real penor = qnor * CENTO / mov_val_amm(tmv);
ammmv.put(AMMMV_PENOR, penor);
}
@ -1324,12 +1406,12 @@ real TCespite::mov_r91_escl_ven(const TRectype& tmv)
real TCespite::mov_val_ven(const TRectype& tmv)
{
real val = sum_fields(tmv, MOVCE_CSTO, MOVCE_RIV75, MOVCE_RIV83, MOVCE_RIV90, MOVCE_RIV91);
// val -= sum_fields(tmv, MOVCE_VNONAMM, MOVCE_PLUSREIN);
val -= tmv.get_real(MOVCE_PLUSREIN);
if (_tipo_sit == 1 || get_bool(CESPI_LEASING))
val += tmv.get_real(SALCE_RIVGF);
if (_tipo_sit == 2 && !get_bool(CESPI_LEASING))
const bool leasing = get_bool(CESPI_LEASING);
if (_tipo_sit == 1 || leasing)
val += tmv.get_real(SALCE_RIVGF); else
if (_tipo_sit == 2 && !leasing)
val += tmv.get_real(SALCE_RIVGC);
val -= mov_r90_escl_ven(tmv);
@ -1491,6 +1573,55 @@ void TCespite::scansione_movimenti(const TDate& data_limite, bool is_valid)
} // If esistono movimenti
}
bool TCespite::controllo_fringe_benefit()
{
const real fringe_benefit = ammini_get_real(AMMCE_FRINGEBEN);
if (fringe_benefit <= ZERO)
return false; // Niente fringe benefit: inutile continuare!
// SOLO situazione fiscale di veicoli in uso a dipendenti dal 2006
if (_tipo_sit != 1 || !get_bool(CESPI_VEIDIP) || !auto_o_moto() ||
!ditta_cespiti().legge_223_06())
return false;
const real quote = sum_fields(_ammpro, AMMCE_QNOR, AMMCE_QACC, AMMCE_QANT);
if (quote > fringe_benefit)
{
log(TR("- Aggiornamento quote in base al fringe benefit"));
const char* const qfld[3] = { AMMCE_QNOR, AMMCE_QACC, AMMCE_QANT };
const char* const pfld[3] = { AMMCE_PNOR, AMMCE_PACC, AMMCE_PANT };
real sforamento = quote - fringe_benefit;
_ammpro.add(AMMCE_QPERSE, sforamento); // Incremento le quote perse
for (int i = 2; i >= 0 && sforamento > ZERO; i--)
{
const real old_quota = _ammpro.get_real(qfld[i]);
if (old_quota > ZERO) // C'e' trippa per gatti in questa quota?
{
real new_quota; // Nuova quota ridotta per coprire lo sforamento
if (old_quota >= sforamento)
{
new_quota = old_quota - sforamento;
sforamento = ZERO;
}
else
{
new_quota = ZERO;
sforamento -= old_quota;
}
_ammpro.put(qfld[i], new_quota); // Aggiorno la quota
// Ricalcolo anche la percentuale di conseguenza
const real old_perc = _ammpro.get_real(pfld[i]);
const real new_perc = old_perc * new_quota / old_quota;
ammpro_put_perc(pfld[i], new_perc);
}
}
}
return true;
}
void TCespite::calc_amm_residui(bool is_valid)
{
log("- Calcolo ammortamenti residui");
@ -1540,7 +1671,7 @@ void TCespite::calc_amm_residui(bool is_valid)
}
else
{
zero_fields(_ammpro, AMMCE_QANT, AMMCE_PANT, AMMCE_QACC, AMMCE_PACC, NULL);
zero_fields(_ammpro, AMMCE_QACC, AMMCE_PACC, NULL);
}
if (resamm > ZERO)
{
@ -1630,7 +1761,7 @@ void TCespite::calc_amm_residui(bool is_valid)
}
if (ammini_get_bool(AMMCE_CSCEN) && vam < un_milione())
{
_ammpro.put(AMMCE_PNOR, "100");
_ammpro.put(AMMCE_PNOR, CENTO);
_ammpro.zero(AMMCE_PANT); _ammpro.zero(AMMCE_PACC);
_ammpro.put(AMMCE_MSG04, "X"); // Ammortamento totale
}
@ -1666,7 +1797,7 @@ void TCespite::calc_amm_residui(bool is_valid)
real per_eff;
const real qnor = calc_quota(valamm, pnor, resamm, per_eff);
_ammpro.put(AMMCE_QNOR, qnor);
_ammpro.put(AMMCE_PNOR, per_eff);
ammpro_put_perc(AMMCE_PNOR, per_eff);
const real quote_perse = calc_quote_perse(valamm, pmat, resamm, qnor, false, TDate());
_ammpro.put(AMMCE_QPERSE, quote_perse);
@ -1777,6 +1908,10 @@ void TCespite::calc_amm_residui(bool is_valid)
}
}
// Controlli preliminari per evitare un inutile calcolo del fringe benefit
if (is_valid && _tipo_sit == 1 && tc == tc_materiale && !leasing)
controllo_fringe_benefit();
save_amm();
}
@ -1784,15 +1919,15 @@ void TCespite::agg_spe_man(bool is_valid)
{
if (_tipo_sit != 1 || !is_valid || tipo() != tc_materiale)
return;
log(TR("- Aggiornamento spese di manutenzione"));
const real vspmanu = _salpro.get(SALCE_VSPMANU);
if (vspmanu > ZERO)
{
log(TR("- Aggiornamento spese di manutenzione"));
TDitta_cespiti& cce = ditta_cespiti();
const char* field = NULL; // Nome del campo da incrementare
const int tpspeman = get_int(CESPI_TPSPEMAN);
const int tpspeman = get_int(CESPI_TPSPEMAN);
const char* field = NULL; // Nome del campo da incrementare
if (tpspeman == 2 || (tpspeman == 4 && !cce.esente_art14()))
field = "R2"; else
if (tpspeman == 3)
@ -1839,10 +1974,8 @@ bool TCespite::calc_amm(int tipo_sit, const TDate& data_limite, bool recalc_spe_
log(FR("* Inizio calcolo situazione %d cespite %s"), tipo_sit, (const char*)idcespite);
#ifdef DBG
if (tipo_sit == 1 && atol(idcespite) == 1L)
{
if (tipo_sit == 1 && atol(idcespite) == 89L)
tipo_sit = 1; // Put your breakpoint here
}
#endif
const bool is_valid = valido();
@ -1875,7 +2008,17 @@ void TCespite::load_saldi(const int tiposit, const int esercizio)
TLocalisamfile salce(LF_SALCE);
fill_sal_key(salce.curr(), esercizio, 1);
if (salce.read() == NOERR)
{
_salini = salce.curr();
// Il campo VNONAMMC nasce solo nel 2006, prima era da intendersi uguale a VNONAMM
if (!_salini.get_real(SALCE_VNONAMM).is_zero() &&
_salini.get_real(SALCE_VNONAMMC).is_zero())
{
if (esercizio <= 2006) // Uso improprio dell'esercizio come anno solare
_salini.put(SALCE_VNONAMMC, _salini.get(SALCE_VNONAMM));
}
}
else
_salini.zero();
@ -1899,6 +2042,7 @@ void TCespite::load_saldi(const int tiposit, const int esercizio)
_ammpro = _ammini;
}
TCespite::TCespite()
: TRectype(LF_CESPI), _salini(LF_SALCE), _salpro(LF_SALCE), _ammini(LF_AMMCE), _ammpro(LF_AMMCE)
{

@ -5,7 +5,9 @@
#include <relation.h>
#endif
enum TTipo_cespite { tc_materiale, tc_immateriale, tc_pluriennale };
enum TTipo_cespite { tc_materiale, tc_immateriale, tc_pluriennale };
enum TTipoFabbricato { tf_nessuno, tf_industriale, tf_altro };
enum TTipoVeicolo { tv_nessuno, tv_automobile, tv_motociclo, tv_ciclomotore, tv_altro };
class TCespite : public TRectype
{
@ -39,7 +41,7 @@ protected:
void rip_costo(TRelation& rel, int mode);
int test_rip(TRelation& rel);
TString& ammini_get(const char* pstar) const;
const TString& ammini_get(const char* pstar) const;
bool ammini_get_bool(const char* pstar) const;
real ammini_get_real(const char* pstar) const;
void ammpro_put_perc(const char* pfield, const real& p);
@ -60,17 +62,26 @@ protected:
void agg_quota(const real& valamm, TRectype& rec, const char* field, bool calcq);
void incr_field(TRectype& dst, const char* fdst, const TRectype& src, const char* fsrc, char segno) const;
void decr_field(TRectype& dst, const char* fdst, const TRectype& src, const char* fsrc, char segno) const;
void applica_rettifiche(TRectype& tmv, TRectype& tmvam);
void aggiorna_salpro(const TRectype& tmv, const TRectype& tmvam, char segno);
void scansione_movimenti(const TDate& data_limite, bool is_valid);
void calc_amm_residui(bool is_valid);
void agg_spe_man(bool is_valid);
real percentuale_deducibilita() const;
bool controllo_fringe_benefit();
public:
bool calc_amm(int tipo_sit, const TDate& data_limite, bool calc_spe_man = FALSE);
const TRectype& categoria() const;
TTipo_cespite tipo() const;
TTipoFabbricato fabbricato() const;
TTipoVeicolo veicolo() const;
bool auto_o_moto() const;
const TRectype& sal_ini() const { return _salini; }
const TRectype& sal_pro() const { return _salpro; }
const TRectype& amm_ini() const { return _ammini; }

@ -3,7 +3,6 @@
#include <modaut.h>
#include <progind.h>
#include <recarray.h>
#include <relation.h>
#include <tabutil.h>
#include "celib.h"

@ -21,7 +21,7 @@ protected:
virtual void get_row(long n, TToken_string& row);
public:
TCollces_sheet(TCursor* cursor, TEdit_field* ef, TToken_string& sibling);
TCollces_sheet(TCursor* cursor, TEdit_field& ef);
};
void TCollces_sheet::get_row(long n, TToken_string& row)
@ -40,9 +40,9 @@ void TCollces_sheet::get_row(long n, TToken_string& row)
row.add(desc, 3);
}
TCollces_sheet::TCollces_sheet(TCursor* cursor, TEdit_field* ef, TToken_string& sibling)
TCollces_sheet::TCollces_sheet(TCursor* cursor, TEdit_field& ef)
: TBrowse_sheet(cursor, "CODGRUPPO|CODSPECIE|CODCAT|CODCAT", TR("Categorie"),
HR("Gruppo|Specie|Categoria|Descrizione@70"), 0, ef, sibling)
HR("Gruppo|Specie|Categoria|Descrizione@70"), 0, ef, TToken_string())
{
}
@ -70,8 +70,7 @@ bool TCesp2cg_qmask::on_field_event(TOperable_field& o, TField_event e, long jol
if (e == fe_button)
{
TEdit_field& ef = (TEdit_field&)o;
TToken_string sibling;
TCollces_sheet sht(_curcoll, &ef, sibling);
TCollces_sheet sht(_curcoll, ef);
if (!o.empty())
{
TRectype& rec = _curcoll->curr();

@ -2,7 +2,6 @@
#include <automask.h>
#include <progind.h>
#include <recarray.h>
#include <relation.h>
#include <tabutil.h>
#include "ce2500a.h"
@ -162,10 +161,9 @@ void TRestore_boll::main_loop()
bool ok = TRUE;
if (dc.bollato_stampato())
ok = yesno_box(TR("Si desidera veramente ripristinare la stampa bollato:\n"
"dell' attivita' selezionata ?"));
ok = yesno_box(TR("Si desidera veramente ripristinare il bollato dell'attivita'"));
else
ok = warning_box(TR("Il bollato dell' attivita' selezionata non risulta stampato"));
ok = warning_box(TR("Il bollato dell'attivita' non risulta stampato"));
if (ok)
{

@ -1,7 +1,6 @@
#include <applicat.h>
#include <automask.h>
#include <execp.h>
#include <form.h>
#include <printer.h>
#include <recarray.h>
#include <tabutil.h>
@ -97,7 +96,7 @@ class TRegistro_cespiti : public TSkeleton_application
int _tipoamm;
bool _bollato;
TEsercizi_contabili _esc;
TString _idspese5, _idspese25;
TString16 _idspese5, _idspese25;
protected:
virtual bool create();
@ -389,8 +388,8 @@ void TRegistro_cespiti::costruisci_cespite(int cat, const real& spese)
// Calcola ammortamenti per cespite (creando anche salce 2 e i 6 ammce)
TCespite ces(idcespite);
for (int i = 1; i <= 3; i++)
ces.calc_amm(i, datafine);
for (int sit = 1; sit <= 3; sit++)
ces.calc_amm(sit, datafine);
}
void TRegistro_cespiti::crea_cespite_man()

@ -21,75 +21,87 @@
#define FR_CAT 21
#define FR_D_CAT 22
//Saldi Iniziali
#define FR_SI_CSTO 31
#define FR_SI_VNONAMM 32
#define FR_SI_TOTRIV 33
#define FR_SI_VALAMM 34
#define FR_SI_RIVGF 35
#define FR_SI_RIVGC 36
#define FR_SI_VNONAMMF 32
#define FR_SI_VNONAMMC 33
#define FR_SI_VNONAMM06 34
#define FR_SI_TOTRIV 35
#define FR_SI_VALAMM 36
#define FR_SI_RIVGF 37
#define FR_SI_RIVGC 38
#define FR_SI_VNONAMM 39
#define FR_MV_SEGNO 41
#define FR_MV_NUMELE 42
#define FR_MV_CSTO 43
#define FR_MV_VNONAMM 44
#define FR_MV_IMPVEN 45
#define FR_MV_IMPVEN_S 64
#define FR_MV_RIVGF 46
#define FR_MV_RIVGC 47
#define FR_MV_TOTRIV 48
#define FR_MV_VALAMM 49
#define FR_MV_RESAMM 50
#define FR_MV_PLUSREIN 51
#define FR_MV_FONDOAMM 52
#define FR_MV_QNONAMM 53
#define FR_MV_QNOR 54
#define FR_MV_QACC 55
#define FR_MV_QANT 56
#define FR_MV_QNONAMM4 64
#define FR_MV_QNONAMM4_SEGNO 65
#define FR_MV_TOTFONDOAMM 57
#define FR_MV_QNOR_SEGNO 58
#define FR_MV_QACC_SEGNO 59
#define FR_MV_QANT_SEGNO 60
#define FR_MV_MINUSVALENZA 61
#define FR_MV_PLUSVALENZA 62
#define FR_MV_VALAMM_SEGNO 63
//MoVimenti
#define FR_MV_SEGNO 41
#define FR_MV_NUMELE 42
#define FR_MV_CSTO 43
#define FR_MV_VNONAMMF 44
#define FR_MV_VNONAMMC 45
#define FR_MV_VNONAMM06 46
#define FR_MV_IMPVEN 47
#define FR_MV_IMPVEN_S 48
#define FR_MV_RIVGF 49
#define FR_MV_RIVGC 50
#define FR_MV_TOTRIV 51
#define FR_MV_VNONAMM 52
#define FR_MV_VALAMM 53
#define FR_MV_RESAMM 54
#define FR_MV_PLUSREIN 55
#define FR_MV_FONDOAMM 56
#define FR_MV_QNONAMM 57
#define FR_MV_QNOR 58
#define FR_MV_QACC 59
#define FR_MV_QANT 60
#define FR_MV_QNONAMM4 61
#define FR_MV_QNONAMM4_SEGNO 62
#define FR_MV_TOTFONDOAMM 63
#define FR_MV_QNOR_SEGNO 64
#define FR_MV_QACC_SEGNO 65
#define FR_MV_QANT_SEGNO 66
#define FR_MV_MINUSVALENZA 67
#define FR_MV_PLUSVALENZA 68
#define FR_MV_VALAMM_SEGNO 69
#define FR_FE_NUMELE 71
#define FR_FE_CSTO 72
#define FR_FE_VNONAMM 73
#define FR_FE_RIVGF 74
#define FR_FE_RIVGC 75
#define FR_FE_TOTRIV 76
#define FR_FE_VALAMM 77
#define FR_FE_RESAMM 78
#define FR_FE_PLUSREIN 79
#define FR_FE_FONDOAMM 80
#define FR_FE_QNONAMM 81
#define FR_FE_VSPMANU 82
#define FR_FE_PNOR 83
#define FR_FE_PACC 84
#define FR_FE_PANT 85
#define FR_FE_QNOR 86
#define FR_FE_FPRIVATO1 87
#define FR_FE_QACC 88
#define FR_FE_FPRIVATO2 89
#define FR_FE_QANT 90
#define FR_FE_FPRIVATO3 91
#define FR_FE_MSG1 92
#define FR_FE_MSG2 93
#define FR_FE_MSG3 94
#define FR_FE_MSG4 95
#define FR_FE_MSG5 96
#define FR_FE_MSG6 97
#define FR_VB_FONDOAMM 98
#define FR_VB_QNONAMM 99
#define FR_AE_NORMALE 100
#define FR_AE_ACCELERATO 101
#define FR_AE_ANTICIPATO 102
#define FR_AR_NORMALE 103
#define FR_AR_ACCELERATO 104
#define FR_AR_ANTICIPATO 105
//Rettifiche
#define FR_FE_NUMELE 71
#define FR_FE_CSTO 72
#define FR_FE_VNONAMMF 73
#define FR_FE_VNONAMMC 74
#define FR_FE_VNONAMM06 75
#define FR_FE_RIVGF 76
#define FR_FE_RIVGC 77
#define FR_FE_TOTRIV 78
#define FR_FE_VNONAMM 79
#define FR_FE_VALAMM 80
#define FR_FE_RESAMM 81
#define FR_FE_PLUSREIN 82
#define FR_FE_FONDOAMM 83
#define FR_FE_QNONAMM 84
#define FR_FE_VSPMANU 85
#define FR_FE_PNOR 86
#define FR_FE_PACC 87
#define FR_FE_PANT 88
#define FR_FE_QNOR 89
#define FR_FE_FPRIVATO1 90
#define FR_FE_QACC 91
#define FR_FE_FPRIVATO2 92
#define FR_FE_QANT 93
#define FR_FE_FPRIVATO3 94
#define FR_FE_MSG1 95
#define FR_FE_MSG2 96
#define FR_FE_MSG3 97
#define FR_FE_MSG4 98
#define FR_FE_MSG5 99
#define FR_FE_MSG6 100
#define FR_VB_FONDOAMM 101
#define FR_VB_QNONAMM 102
#define FR_AE_NORMALE 103
#define FR_AE_ACCELERATO 104
#define FR_AE_ANTICIPATO 105
#define FR_AR_NORMALE 106
#define FR_AR_ACCELERATO 107
#define FR_AR_ANTICIPATO 108
#define FR_TC_ELEM 111
#define FR_TC_CSTO 112

@ -360,14 +360,30 @@ SECTION HEADER LAST 3
PICTURE "##.###.###.###.@@@"
END
VALUTA FR_SI_VNONAMM 18
VALUTA FR_SI_VNONAMMF 18
BEGIN
KEY "Parte n.amm"
KEY "Parte n.amm fiscale"
PROMPT 130 1 ""
FIELD 102@->VNONAMM
PICTURE "##.###.###.###.@@@"
FLAGS "H"
END
VALUTA FR_SI_VNONAMMC 18
BEGIN
KEY "Parte n.amm civilistica"
PROMPT 130 1 ""
FIELD 102@->VNONAMMC
FLAGS "H"
END
VALUTA FR_SI_VNONAMM06 18
BEGIN
KEY "Parte n.amm scorporo fabbricati"
PROMPT 130 1 ""
FIELD 102@->VNONAMM06
FLAGS "H"
END
VALUTA FR_SI_RIVGF 18
BEGIN
KEY "RIVGF"
@ -392,13 +408,21 @@ SECTION HEADER LAST 3
FLAGS "H"
PROMPT 0 0 ""
ITEM "1|1"
MESSAGE RESET,FR_SI_RIVGC
MESSAGE RESET,FR_SI_RIVGC|RESET,FR_SI_VNONAMMC
ITEM "2|2"
MESSAGE RESET,FR_SI_RIVGF
MESSAGE RESET,FR_SI_RIVGF|RESET,FR_SI_VNONAMMF
ITEM "3|3"
MESSAGE RESET,FR_SI_RIVGF
MESSAGE RESET,FR_SI_RIVGF|RESET,FR_SI_VNONAMMF
FIELD 104@->TPAMM
END
VALUTA FR_SI_VNONAMM 18
BEGIN
KEY "Parte n.amm da far vedere"
PROMPT 130 1 ""
MESSAGE _NUMEXPR,#FR_SI_VNONAMMF+#FR_SI_VNONAMMC+#FR_SI_VNONAMM06
PICTURE "##.###.###.###.@@@"
END
VALUTA FR_SI_TOTRIV 18
BEGIN
@ -507,15 +531,30 @@ SECTION BODY FIRST 9
PICTURE "##.###.###.###.@@@"
END
VALUTA FR_MV_VNONAMM 18
VALUTA FR_MV_VNONAMMF 18
BEGIN
KEY "Parte n.amm"
KEY "Parte n.amm fiscale"
PROMPT 130 1 ""
MESSAGE _NUMEXPR,105@->VNONAMM*#FR_MV_SEGNO
MESSAGE ADD,BO->FR_MV_VNONAMM
PICTURE "##.###.###.###.@@@"
FIELD 105@->VNONAMM
FLAGS "H"
END
VALUTA FR_MV_VNONAMMC 18
BEGIN
KEY "Parte n.amm civilistico"
PROMPT 130 1 ""
FIELD 105@->VNONAMMC
FLAGS "H"
END
VALUTA FR_MV_VNONAMM06 18
BEGIN
KEY "Parte n.amm scorporo terreni"
PROMPT 130 1 ""
FIELD 105@->VNONAMM06
FLAGS "H"
END
STRINGA -1 2
BEGIN
KEY "Tipo doc."
@ -580,13 +619,22 @@ SECTION BODY FIRST 9
PROMPT 0 0 ""
ITEM " | "
ITEM "1|1"
MESSAGE RESET,FR_MV_RIVGC
MESSAGE RESET,FR_MV_RIVGC|RESET,FR_MV_VNONAMMC
ITEM "2|2"
MESSAGE RESET,FR_MV_RIVGF
MESSAGE RESET,FR_MV_RIVGF|RESET,FR_MV_VNONAMMF
ITEM "3|3"
MESSAGE RESET,FR_MV_RIVGF
MESSAGE RESET,FR_MV_RIVGF|RESET,FR_MV_VNONAMMF
FIELD 106@->TPAMM
END
VALUTA FR_MV_VNONAMM 18
BEGIN
KEY "Valore non ammortizzabile da far vedere"
PROMPT 130 1 ""
MESSAGE _NUMEXPR,(#FR_MV_VNONAMMF+#FR_MV_VNONAMMC+#FR_MV_VNONAMM06)*#FR_MV_SEGNO
MESSAGE ADD,BO->FR_MV_VNONAMM
PICTURE "##.###.###.###.@@@"
END
VALUTA FR_MV_TOTRIV 18
BEGIN
@ -601,7 +649,7 @@ SECTION BODY FIRST 9
BEGIN
KEY "Valore da ammortizzare (con segno!!!)"
PROMPT 108 2 ""
MESSAGE _NUMEXPR, #FR_MV_CSTO-#FR_MV_VNONAMM+#FR_MV_TOTRIV
MESSAGE _NUMEXPR,MAX(#FR_MV_CSTO-#FR_MV_VNONAMM+#FR_MV_TOTRIV;0)
MESSAGE ADD,BO->FR_MV_VALAMM
PICTURE "##.###.###.###.@@@"
END
@ -871,15 +919,7 @@ SECTION BODY ODD 3
FLAGS "H"
PROMPT 106 3 ""
PICTURE "##.###.###.###.@@@"
END
/* VALUTA FR_MV_QNONAMM4
BEGIN
KEY "Quota non + amm. (con segno!!); viene dalla riga 4 dei movimenti"
FLAGS "H"
PROMPT 126 3 ""
PICTURE "##.###.###.###.@@@"
END */
END
VALUTA FR_MV_FONDOAMM 18
BEGIN
@ -921,7 +961,6 @@ SECTION BODY ODD 3
BEGIN
KEY "Totale plusvalenza reinvestita"
PROMPT 82 3 ""
// MESSAGE _NUMEXPR,#FR_MV_PLUSREIN
PICTURE "##.###.###.###.@@@"
END
@ -929,7 +968,6 @@ SECTION BODY ODD 3
BEGIN
KEY "Totale quote non + ammortizzabili"
PROMPT 126 3 ""
// MESSAGE _NUMEXPR,#FR_MV_QNONAMM
PICTURE "##.###.###.###.@@@"
END
@ -979,12 +1017,28 @@ SECTION BODY EVEN 17
PICTURE "##.###.###.###.@@@"
END
VALUTA FR_FE_VNONAMM 18
VALUTA FR_FE_VNONAMMF 18
BEGIN
KEY "Parte n.amm"
KEY "Parte n.amm fiscale"
PROMPT 130 1 ""
FIELD 102@->VNONAMM
PICTURE "##.###.###.###.@@@"
FLAGS "H"
END
VALUTA FR_FE_VNONAMMC 18
BEGIN
KEY "Parte n.amm civilistica"
PROMPT 130 1 ""
FIELD 102@->VNONAMMC
FLAGS "H"
END
VALUTA FR_FE_VNONAMM06 18
BEGIN
KEY "Parte n.amm scorporo fabbricati"
PROMPT 130 1 ""
FIELD 102@->VNONAMM06
FLAGS "H"
END
VALUTA FR_FE_RIVGF 18
@ -1011,13 +1065,21 @@ SECTION BODY EVEN 17
FLAGS "H"
PROMPT 0 0 ""
ITEM "1|1"
MESSAGE RESET,FR_FE_RIVGC
MESSAGE RESET,FR_FE_RIVGC|RESET,FR_FE_VNONAMMC
ITEM "2|2"
MESSAGE RESET,FR_FE_RIVGF
MESSAGE RESET,FR_FE_RIVGF|RESET,FR_FE_VNONAMMF
ITEM "3|3"
MESSAGE RESET,FR_FE_RIVGF
MESSAGE RESET,FR_FE_RIVGF|RESET,FR_FE_VNONAMMF
FIELD 104@->TPAMM
END
VALUTA FR_FE_VNONAMM 18
BEGIN
KEY "Valore non ammortizzabile da far vedere"
PROMPT 130 1 ""
MESSAGE _NUMEXPR,#FR_FE_VNONAMMF+#FR_FE_VNONAMMC+#FR_FE_VNONAMM06
PICTURE "##.###.###.###.@@@"
END
VALUTA FR_FE_TOTRIV 18
BEGIN
@ -1031,7 +1093,7 @@ SECTION BODY EVEN 17
BEGIN
KEY "Valore da ammortizzare"
PROMPT 108 2 ""
MESSAGE _NUMEXPR,#FR_FE_CSTO-#FR_FE_VNONAMM+#FR_FE_TOTRIV
MESSAGE _NUMEXPR,MAX(#FR_FE_CSTO-#FR_FE_VNONAMM+#FR_FE_TOTRIV;0)
PICTURE "##.###.###.###.@@@"
END
@ -1206,7 +1268,7 @@ SECTION BODY EVEN 17
STRINGA FR_FE_MSG1
BEGIN
KEY "Messaggio 1"
PROMPT 16 7 "Ammortamento ridotto a metá per 1º esercizio di utilizzo del cespite"
PROMPT 16 7 "Ammortamento ridotto al 50% nel primo esercizio di utilizzo"
END
STRINGA FR_FE_MSG2

@ -29,6 +29,7 @@
#define FF_TOTAMMO 33
#define FF_MINUS 35
#define FF_MINUSVEN 36
#define FF_VNONAMM 37
#define FF_DATE 40
#define FF_PAGE 41

@ -303,11 +303,18 @@ BEGIN
MESSAGE ADD,F->FF_TOTELEM
END
VALUTA FF_VNONAMM 15
BEGIN
PROMPT 48 1 ""
MESSAGE _NUMEXPR,IF(LF_MOVAM->TPAMM=2;LF_MOVCE->VNONAMMC;LF_MOVCE->VNONAMM)+LF_MOVCE->VNONAMM06
FLAGS "H"
END
VALUTA -1 15
BEGIN
KEY "valore"
PROMPT 50 1 ""
MESSAGE _NUMEXPR,(LF_MOVCE->CSTO-LF_MOVCE->VNONAMM+LF_MOVCE->RIV75+LF_MOVCE->RIV83+LF_MOVCE->RIV90+LF_MOVCE->RIV91+LF_MOVCE->RIVGF)*#FF_SEGNO
MESSAGE _NUMEXPR,(LF_MOVCE->CSTO-#FF_VNONAMM+LF_MOVCE->RIV75+LF_MOVCE->RIV83+LF_MOVCE->RIV90+LF_MOVCE->RIV91+LF_MOVCE->RIVGF)*#FF_SEGNO
MESSAGE ADD,F->FF_TOTVALORE
END
@ -459,11 +466,18 @@ BEGIN
MESSAGE ADD,F0->FF_TOTELEM
END
VALUTA FF_VNONAMM 15
BEGIN
PROMPT 48 1 ""
MESSAGE _NUMEXPR,IF(LF_MOVAM->TPAMM=2;LF_MOVCE->VNONAMMC;LF_MOVCE->VNONAMM)+LF_MOVCE->VNONAMM06
FLAGS "H"
END
VALUTA -1 15
BEGIN
KEY "valore"
PROMPT 50 1 ""
MESSAGE _NUMEXPR, (LF_MOVCE->CSTO-LF_MOVCE->VNONAMM+LF_MOVCE->RIV75+LF_MOVCE->RIV83+LF_MOVCE->RIV90+LF_MOVCE->RIV91+LF_MOVCE->RIVGF)*#FF_SEGNO
MESSAGE _NUMEXPR, (LF_MOVCE->CSTO-#FF_VNONAMM+LF_MOVCE->RIV75+LF_MOVCE->RIV83+LF_MOVCE->RIV90+LF_MOVCE->RIV91+LF_MOVCE->RIVGF)*#FF_SEGNO
MESSAGE ADD,F0->FF_TOTVALORE
END

@ -1,8 +1,6 @@
#include <applicat.h>
#include <form.h>
#include <printer.h>
#include <recarray.h>
#include <utility.h>
#include "ce3.h"
#include "celib.h"
@ -337,30 +335,23 @@ void TStampa_prospetto::aggiorna_totali(TCursor& cur, const int tipo, TTipo_cesp
TRectype& recsalce = cur.curr(LF_SALCE);
real csto = recsalce.get_real(SALCE_CSTO);
if (tipo == 1)
{
real vnonamm1 = recsalce.get_real(SALCE_VNONAMM);
_cat._tot_csto += csto - vnonamm1;
}
_cat._tot_csto += csto;
if (tipo == 2)
_cat._tot_csto -= recsalce.get_real(SALCE_VNONAMMC);
else
_cat._tot_csto += csto;
_cat._tot_csto -= recsalce.get_real(SALCE_VNONAMM);
_cat._tot_csto -= recsalce.get_real(SALCE_VNONAMM06);
real riv75 = recsalce.get_real(SALCE_RIV75);
real riv83 = recsalce.get_real(SALCE_RIV83);
real riv90 = recsalce.get_real(SALCE_RIV90);
real riv91 = recsalce.get_real(SALCE_RIV91);
real riv = riv75+riv83+riv90+riv91;
real rivsalce = recsalce.get_real(SALCE_RIV75);
rivsalce += recsalce.get_real(SALCE_RIV83);
rivsalce += recsalce.get_real(SALCE_RIV90);
rivsalce += recsalce.get_real(SALCE_RIV91);
if (tipo == 1)
{
const real rivgf = recsalce.get_real(SALCE_RIVGF);
_cat._tot_riv += riv + rivgf;
}
_cat._tot_riv += rivsalce;
if (tipo == 2)
_cat._tot_riv += recsalce.get_real(SALCE_RIVGC);
else
{
const real rivgc = recsalce.get_real(SALCE_RIVGC);
_cat._tot_riv += riv + rivgc;
}
_cat._tot_riv += recsalce.get_real(SALCE_RIVGF);
// valori della riga 2 (e, giá che si fa la scansione dei movimenti, anche i valori dei movam della riga 3)
// (i valori della riga 2 non dipendono da tipo, mentre quelli della riga 3 si, in quanto hanno movam)
@ -397,30 +388,41 @@ void TStampa_prospetto::aggiorna_totali(TCursor& cur, const int tipo, TTipo_cesp
const char tmc = cache().get("%TMC", codmov, "S6")[0]; //prende il valore del campo S6 nella tabella tipi movimento
const char segno = mov.get_char(MOVCE_SEGNO);
const real signum = segno == '-' ? -1.0 : +1.0; //serve per sommare i movimenti con il loro segno effettivo
riv75 = mov.get_real(MOVCE_RIV75);
riv83 = mov.get_real(MOVCE_RIV83);
riv90 = mov.get_real(MOVCE_RIV90);
riv91 = mov.get_real(MOVCE_RIV91);
riv = riv75+riv83+riv90+riv91;
real rivmovce = mov.get_real(MOVCE_RIV75);
rivmovce += mov.get_real(MOVCE_RIV83);
rivmovce += mov.get_real(MOVCE_RIV90);
rivmovce += mov.get_real(MOVCE_RIV91);
csto = mov.get_real(MOVCE_CSTO);
// inquietante modo di selezionare la rivg (rivgf o rivgc) in base al tipo senza usare una if else!
real rivg = mov.get_real(tipo == 1 ? MOVCE_RIVGF : MOVCE_RIVGC);
real vnonamm2 = mov.get_real(MOVCE_VNONAMM);
real qnor = amm.get_real(MOVAM_QNOR);
real qacc = amm.get_real(MOVAM_QACC);
real qant = amm.get_real(MOVAM_QANT);
const real rivg = mov.get_real(tipo == 2 ? MOVCE_RIVGC : MOVCE_RIVGF);
real vnonamm2;
if (tipo == 2)
vnonamm2 = recsalce.get_real(SALCE_VNONAMMC);
else
vnonamm2 = recsalce.get_real(SALCE_VNONAMM);
vnonamm2 += recsalce.get_real(SALCE_VNONAMM06);
//non si puo' avere un valore non ammortizzabile maggiore del costo prima delle
//rivalutazioni
if (vnonamm2 > csto)
vnonamm2 = csto;
real qmovam = amm.get_real(MOVAM_QNOR);
qmovam += amm.get_real(MOVAM_QACC);
qmovam += amm.get_real(MOVAM_QANT);
if (tmc == 'R')
_cat._tot_riveser += (riv + rivg) * signum;
_cat._tot_riveser += (rivmovce + rivg) * signum;
if (tmc == 'I' || (tmc <= ' ' && segno == '+'))
{
_cat._tot_acqincr += (csto - vnonamm2 + riv + rivg) * signum;
_cat._tot_incr += (qnor + qacc + qant) * signum;
_cat._tot_acqincr += (csto - vnonamm2 + rivmovce + rivg) * signum;
_cat._tot_incr += qmovam * signum;
}
if (tmc == 'E' || (tmc <= ' ' && segno == '-'))
{
_cat._tot_cesselim2 += (csto - vnonamm2 + riv + rivg) * (-signum);
_cat._tot_cesselim3 += (qnor + qant + qacc) * (-signum);
_cat._tot_cesselim2 += (csto - vnonamm2 + rivmovce + rivg) * (-signum);
_cat._tot_cesselim3 += qmovam * (-signum);
}
if (tmc == 'P')
_cat._tot_reinplus += (mov.get_real(MOVCE_PLUSREIN)) * signum;

@ -107,9 +107,17 @@ bool TLC_form::validate(TForm_item& fld, TToken_string& val)
if (xvt_str_compare_ignoring_case(cmd, "_RIVGEN") == 0)
{
const TRectype& salce = relation()->curr(LF_SALCE);
fld.set(salce.get(_tiposit == 1 ? SALCE_RIVGF : SALCE_RIVGC));
return TRUE;
}
fld.set(salce.get(_tiposit == 2 ? SALCE_RIVGC : SALCE_RIVGF));
return true;
}
if (xvt_str_compare_ignoring_case(cmd, "_VNONAMM") == 0)
{
const TRectype& salce = relation()->curr(LF_SALCE);
real vnonamm = salce.get_real(_tiposit == 2 ? SALCE_VNONAMMC : SALCE_VNONAMM);
vnonamm += salce.get_real(SALCE_VNONAMM06);
fld.set(vnonamm.string());
return true;
}
return TCespi_list_form::validate(fld, val);
}

@ -330,7 +330,7 @@ END
VALUTA 12 15
BEGIN
PROMPT 17 3 ""
FIELD LF_SALCE->VNONAMM
MESSAGE _VNONAMM
PICTURE "###.###.###.@@@"
MESSAGE ADD,BE->12
END

@ -1,6 +1,5 @@
#include <applicat.h>
#include <automask.h>
#include <form.h>
#include <printer.h>
#include <recarray.h>
@ -50,9 +49,17 @@ bool TLM_form::validate(TForm_item& fld, TToken_string& val)
if (xvt_str_compare_ignoring_case(cmd, "_RIVGEN") == 0)
{
const TRectype& mov = relation()->curr();
fld.set(mov.get(_tiposit == 1 ? MOVCE_RIVGF : MOVCE_RIVGC));
fld.set(mov.get(_tiposit == 2 ? MOVCE_RIVGC : MOVCE_RIVGF));
return TRUE;
}
}
if (xvt_str_compare_ignoring_case(cmd, "_VNONAMM") == 0)
{
const TRectype& mov = relation()->curr();
real vnonamm = mov.get_real(_tiposit == 2 ? MOVCE_VNONAMMC : MOVCE_VNONAMM);
vnonamm += mov.get_real(MOVCE_VNONAMM06);
fld.set(vnonamm.string());
return true;
}
return TCespi_list_form::validate(fld, val);
}

@ -300,7 +300,7 @@ END
VALUTA 12 15
BEGIN
PROMPT 17 3 ""
FIELD VNONAMM
MESSAGE _VNONAMM
PICTURE "###.###.###.@@@"
END

@ -168,7 +168,9 @@ END
LISTA -1
BEGIN
KEY "Usoprom"
PROMPT 68 1 ""
ITEM "|"
ITEM "1|100% - Esclusivamente strumentale"
ITEM "2| 50% - Uso promiscuo"
ITEM "3| 80% - Uso prom. agenti/rappresentanti"
@ -177,6 +179,7 @@ END
LISTA -1
BEGIN
KEY "Flgtpvei"
PROMPT 110 1 ""
ITEM "1|Nessuno"
ITEM "2|Auto, Autocaravan"
@ -188,6 +191,7 @@ END
LISTA -1
BEGIN
KEY "Veidip"
PROMPT 129 1 ""
ITEM "|NO"
ITEM "X|SI"

@ -81,9 +81,11 @@ bool TECFE_form::validate(TForm_item& fld, TToken_string& val)
if (xvt_str_compare_ignoring_case(cmd, "_VALAMM") == 0)
{
const TRectype& salpro = relation()->curr(LF_SALCE);
real val = salpro.get_real(SALCE_CSTO)-salpro.get_real(SALCE_VNONAMM)-salpro.get_real(SALCE_PLUSREIN)+
real val = salpro.get_real(SALCE_CSTO)-salpro.get_real(SALCE_PLUSREIN)+
salpro.get_real(SALCE_RIV75)+salpro.get_real(SALCE_RIV83)+salpro.get_real(SALCE_RIV90)+salpro.get_real(SALCE_RIV91);
val += salpro.get_real(_tipo_sit == 1 ? SALCE_RIVGF : SALCE_RIVGC);
val += salpro.get_real(_tipo_sit == 2 ? SALCE_RIVGC : SALCE_RIVGF);
val -= salpro.get_real(_tipo_sit == 2 ? SALCE_VNONAMMC : SALCE_VNONAMM);
val -= salpro.get_real(SALCE_VNONAMM06);
fld.set(val.string());
return TRUE;
}

@ -44,20 +44,29 @@ bool TStampa_sintetica_mask::on_field_event(TOperable_field& o, TField_event e,
ok = dc.on_category_event(o, e, jolly);
}
break;
case F_ESERCIZIO:
case F_GRUPPO:
case F_SPECIE:
if (e == fe_init || e == fe_modify)
if ((e == fe_init && o.dlg() == F_ESERCIZIO)|| e == fe_modify)
{
const TString& esercizio = get(F_ESERCIZIO);
const TString& gruppo = get(F_GRUPPO);
const TString& specie = get(F_SPECIE);
TString16 key; key << esercizio << gruppo << specie;
TRelation ccb("CCB");
ccb.curr().put("CODTAB", key);
if (ccb.read() == NOERR)
int err = NOERR;
const TString& esercizio = get(F_ESERCIZIO);
if (esercizio.full())
{
const TString& gruppo = get(F_GRUPPO);
const TString& specie = get(F_SPECIE);
TString16 key; key << esercizio << gruppo << specie;
ccb.curr().put("CODTAB", key);
err = ccb.read();
}
else
err = ccb.last();
if (err == NOERR)
{
autoload(ccb);
o.check();
}
}
break;
default: break;
@ -116,9 +125,11 @@ void TStampa_sintetica_recordset::set_filter(const TStampa_sintetica_mask& msk)
class TStampa_sintetica_rep : public TReport
{
int _anno;
int _tpamm;
TCespite _cespite;
protected:
real val_amm(const TRectype& rec_saldi) const;
virtual bool get_usr_val(const TString& name, TVariant& var) const;
public:
void set_filter(const TStampa_sintetica_mask& msk);
@ -127,9 +138,30 @@ public:
void TStampa_sintetica_rep::set_filter(const TStampa_sintetica_mask& msk)
{
_anno = msk.get_int(F_ESERCIZIO);
_tpamm = msk.get_int(F_SITUAZIONE);
((TStampa_sintetica_recordset*) recordset())->set_filter(msk);
}
real TStampa_sintetica_rep::val_amm(const TRectype& rec_saldi) const
{
real valore = rec_saldi.get_real(SALCE_CSTO);
if (_tpamm == 2)
valore -= rec_saldi.get_real(SALCE_VNONAMMC);
else
valore -= rec_saldi.get_real(SALCE_VNONAMM);
valore -= rec_saldi.get_real(SALCE_VNONAMM06);
valore += rec_saldi.get_real(SALCE_RIV75);
valore += rec_saldi.get_real(SALCE_RIV83);
valore += rec_saldi.get_real(SALCE_RIV90);
valore += rec_saldi.get_real(SALCE_RIV91);
valore += rec_saldi.get_real(SALCE_RIVGF);
if (valore < ZERO)
valore = ZERO;
return valore;
}
//metodo per il calcolo dei campi da calcolare (ma va'!) nel report
bool TStampa_sintetica_rep::get_usr_val(const TString& name, TVariant& var) const
{
@ -139,8 +171,7 @@ bool TStampa_sintetica_rep::get_usr_val(const TString& name, TVariant& var) cons
{
TCespite& c = (TCespite&)_cespite;
c.read(idcespite);
c.load_saldi(1, _anno);
}
c.load_saldi(_tpamm, _anno); }
if (name == "#DESCAT") //categoria (descrizione della categoria corrente)
{
@ -154,32 +185,37 @@ bool TStampa_sintetica_rep::get_usr_val(const TString& name, TVariant& var) cons
if (name.starts_with("#COSTO")) //costo storico dell'anno
{
if (name.ends_with("FIN")) //tiposaldo finale
var = _cespite.sal_pro().get_real(SALCE_CSTO);
var = val_amm(_cespite.sal_pro());
else //tiposaldo iniziale
var = _cespite.sal_ini().get_real(SALCE_CSTO);
var = val_amm(_cespite.sal_ini());
return true;
}
if (name == "#PERCAMM") //percentuale ammortamento
{
const TRectype& rec_ammce = _cespite.amm_pro();
var = rec_ammce.get_real(AMMCE_PNOR) + rec_ammce.get_real(AMMCE_PACC) + rec_ammce.get_real(AMMCE_PANT);
var = real(rec_ammce.get_real(AMMCE_PNOR) + rec_ammce.get_real(AMMCE_PACC) + rec_ammce.get_real(AMMCE_PANT));
return true;
}
if (name == "#QAMM") //fondo ammortamento esercizio corrente
{
const TRectype& rec_ammce = _cespite.amm_pro();
var = rec_ammce.get_real(AMMCE_QNOR) + rec_ammce.get_real(AMMCE_QACC) + rec_ammce.get_real(AMMCE_QANT);
var = real(rec_ammce.get_real(AMMCE_QNOR) + rec_ammce.get_real(AMMCE_QACC) + rec_ammce.get_real(AMMCE_QANT));
return true;
}
if (name == "#FAMM") //fondo ammortamento alla fine dell'esercizio precedente
{
const TRectype& rec_ammce = _cespite.amm_ini();
var = rec_ammce.get_real(AMMCE_QNOR) + rec_ammce.get_real(AMMCE_QACC) + rec_ammce.get_real(AMMCE_QANT);
const TRectype& rec_ammce = _cespite.amm_pro();
var = rec_ammce.get_real(AMMCE_PNOR) + rec_ammce.get_real(AMMCE_PACC) + rec_ammce.get_real(AMMCE_PANT);
return true;
}
if (name == "#RESAMM") //residuo da ammortizzare
{
var = _cespite.res_amm();
return true
}
if (name == "#SITUAZIONE") //tipo situazione da stampare in testata
{
var.set(_tpamm);
return true;
}
return TReport::get_usr_val(name, var);

@ -15,5 +15,6 @@
#define F_D_FROM_CAT 113
#define F_TO_CAT 114
#define F_D_TO_CAT 115
#define F_SITUAZIONE 116
#define F_REPORT 116
#define F_REPORT 117

@ -148,4 +148,13 @@ BEGIN
GROUP 1
END
RADIOBUTTON F_SITUAZIONE 78
BEGIN
PROMPT 1 10 "@bSituazione"
ITEM "1|Fiscale"
ITEM "2|Civilistica"
ITEM "3|Gestionale"
FLAGS "Z"
END
ENDPAGE

@ -1,9 +1,7 @@
#include <applicat.h>
#include <automask.h>
#include <form.h>
#include <printer.h>
#include <progind.h>
#include <recarray.h>
#include "celib.h"
#include "../ve/velib.h"

@ -16,21 +16,20 @@ void TDitta_cespiti::load_default()
{
_ditta = prefix().get_codditta();
TConfig dit(CONFIG_DITTA);
TConfig dit(CONFIG_DITTA, "ce");
_esercizio = dit.get_int("CODESCORR");
TEsercizi_contabili esc;
if (_esercizio <= 0)
{
const TDate oggi(TODAY);
_esercizio = oggi.year();
}
_esercizio = esc.date2prevesc(TDate(TODAY));
_gruppo = dit.get("GRUPPOCORR");
TString16 str = dit.get("SPECIECORR");
TString8 str = dit.get("SPECIECORR");
str.strip("\"");
_specie = str;
_data_primi_ricavi = dit.get("CADTR");
_anno_tuir = dit.get_int("CATSU");
if (_anno_tuir == 0 || _anno_tuir == 1) // Demenzialmente può essere memorizzato come 0 o 1
_anno_tuir += 1988;
@ -57,16 +56,12 @@ void TDitta_cespiti::load_records()
void TDitta_cespiti::set_attivita(int esercizio, int gruppo, const char* specie)
{
if (esercizio <= 0)
{
const TDate oggi(TODAY);
_esercizio = oggi.year();
}
else
if (esercizio > 0)
_esercizio = esercizio;
if (gruppo > 0)
_gruppo.format("%02d", gruppo);
if (specie && *specie)
_specie.format("%-4s", (const char*)specie);
@ -80,7 +75,7 @@ void TDitta_cespiti::set_attivita(int esercizio, int gruppo, const char* specie)
_anno_tuir = dit.get_int("CATSU");
if (_anno_tuir == 0 || _anno_tuir == 1) // Demenzialmente può essere memorizzato come 0 o 1
_anno_tuir += 1988;
_ditta = prefix().get_codditta();
load_records();
@ -107,9 +102,7 @@ bool TDitta_cespiti::bollato_stampato() const
int TDitta_cespiti::esercizio_corrente(TDate& inies, TDate& fines) const
{
TEsercizi_contabili esc;
const TEsercizio& e = esc[_esercizio];
inies = e.inizio();
fines = e.fine();
esc.code2range(_esercizio, inies, fines);
return _esercizio;
}
@ -118,8 +111,8 @@ void TDitta_cespiti::init_mask(TMask& m)
update_when_needed();
TBit_array found;
bool started = FALSE;
bool finished = FALSE;
bool started = false;
bool finished = false;
for (int i = 0; !finished && i < 20 && i < m.fields(); i++)
{
TMask_field& f = m.fld(i);
@ -134,7 +127,7 @@ void TDitta_cespiti::init_mask(TMask& m)
{
f.set(_esercizio);
f.check();
found.set(1, TRUE);
found.set(1, true);
}
} else
if (f.is_edit())
@ -144,7 +137,7 @@ void TDitta_cespiti::init_mask(TMask& m)
f.set(_specie);
f.check();
found.set(5);
finished = TRUE;
finished = true;
}
}
break;
@ -157,7 +150,7 @@ void TDitta_cespiti::init_mask(TMask& m)
break;
default:
if (f.is_kind_of(CLASS_GROUPBOX_FIELD))
finished = TRUE;
finished = true;
break;
}
}
@ -198,7 +191,6 @@ real TDitta_cespiti::coefficiente_durata_esercizio() const
return _cce.get_real("S5");
}
bool TDitta_cespiti::rinvio_ammortamento_ai_primi_ricavi() const
{
return _cce.get_bool("B2");
@ -219,9 +211,17 @@ bool TDitta_cespiti::esente_art14() const
return _cce.get_bool("B7");
}
bool TDitta_cespiti::legge_223_06() const
{
const TDate data(4, 7, 2006);
TDate inies, fines;
esercizio_corrente(inies, fines);
return data <= fines;
}
const TRectype& TDitta_cespiti::categoria(int gr, const char* sp, int ca) const
{
TString16 key;
TString8 key;
if (ca >= 41)
key.format(" %02d", ca);
else
@ -293,11 +293,12 @@ bool TDitta_cespiti::on_category_event(TOperable_field& o, TField_event e, long
rec.put("S0", fld.get());
recno = cur.read();
}
TCursor_sheet sht(&cur, fields, TR("Categorie dei cespiti"), header, 0, 1);
TToken_string siblings;
TBrowse_sheet sht(&cur, fields, TR("Categorie cespiti"), header, 0, fld, siblings);
sht.select(recno);
if (sht.run() == K_ENTER)
{
TMask& m = fld.mask();
const TMask& m = fld.mask();
const int pos = m.id2pos(fld.dlg());
TMask_field& fout = m.fld(pos + (by_code ? +1 : -1));
TToken_string& row = sht.row();
@ -354,10 +355,9 @@ TDitta_cespiti& ditta_cespiti()
bool TForm_cespiti::validate(TForm_item& fld, TToken_string& val)
{
const TString16 code = val.get(0);
if (code == "_DESCAT")
if (val.starts_with("_DESCAT"))
{
const TString8 fgr = val.get();
const TString8 fgr = val.get(1);
const TString8 fsp = val.get();
const TString8 fca = val.get();
@ -366,7 +366,7 @@ bool TForm_cespiti::validate(TForm_item& fld, TToken_string& val)
const int categoria = atoi(fld.find_field(fca).get());
const TRectype& cac = ditta_cespiti().categoria(gruppo, specie, categoria);
fld.set(cac.get("S0"));
return TRUE;
return true;
}
return TForm::validate(fld,val);
}
@ -386,23 +386,23 @@ bool null_fields(const TRectype& rec, const char* fld0, const char* fld1, const
const char* fld6, const char* fld7, const char* fld8)
{
if (!rec.get_real(fld0).is_zero())
return FALSE;
return false;
if (!rec.get_real(fld1).is_zero())
return FALSE;
return false;
if (fld2 && *fld2 && !rec.get_real(fld2).is_zero())
return FALSE;
return false;
if (fld3 && *fld3 && !rec.get_real(fld3).is_zero())
return FALSE;
return false;
if (fld4 && *fld4 && !rec.get_real(fld4).is_zero())
return FALSE;
return false;
if (fld5 && *fld5 && !rec.get_real(fld5).is_zero())
return FALSE;
return false;
if (fld6 && *fld6 && !rec.get_real(fld6).is_zero())
return FALSE;
return false;
if (fld7 && *fld7 && !rec.get_real(fld7).is_zero())
return FALSE;
return false;
if (fld8 && *fld8 && !rec.get_real(fld8).is_zero())
return FALSE;
return false;
return TRUE;
return true;
}

@ -44,6 +44,8 @@ public:
bool esercizio_costituzione() const;
real coefficiente_durata_esercizio() const;
int anno_tuir() const { return _anno_tuir; }
bool legge_223_06() const;
bool bollato_stampato() const;
bool ammortamento_proporzionale() const { return _amm_prop; }

@ -31,3 +31,4 @@
#define CESPI_REPARTO "REPARTO"
#define CESPI_IDIMP "IDIMP"
#define CESPI_PERCIMP "PERCIMP"
#define CESPI_FABBR06 "FABBR06"

@ -1,3 +1,3 @@
136
0
$ammce|0|0|325|0|Ammortamento cespiti|||
$ammce|0|0|343|0|Ammortamento cespiti|||

@ -1,12 +1,12 @@
136
31
32
IDCESPITE|1|10|0|Codice cespite (ZZZZZZZZZZ)
CODES|2|4|0|Codice esercizio
TPSALDO|2|1|0|Tipo saldo
TPAMM|2|1|0|Tipo ammortamento
SCELTE|2|1|0|Flag scelta ammortamento
AMMRIT|8|1|0|Scelta ammortamento ritardato
CSCEN|8|1|0|Ammortamento 100% beni inferiori al milione
CSCEN|8|1|0|Ammortamento 100% beni inferiori a 516,46 euro
FZPER|8|1|0|Flag forzatura percentuali
PNOR|4|7|3|% ammortamento normale
PACC|4|7|3|% ammortamento accelerato
@ -31,5 +31,6 @@ MSG04|8|1|0|Messaggio 4
MSG05|8|1|0|Messaggio 5
MSGD05|1|60|0|Descrizione messaggio 5
MSG06|8|1|0|Messaggio 6
FRINGEBEN|4|18|3|Fringe benefit veicoli in uso ai dipendenti
1
IDCESPITE+CODES+TPSALDO+TPAMM|

@ -1,3 +1,3 @@
139
0
$cespi|0|0|255|0|Anagrafica cespiti|||
$cespi|0|0|256|0|Anagrafica cespiti|||

@ -1,5 +1,5 @@
139
33
34
IDCESPITE|1|10|0|Codice cespite (ZZZZZZZZZZ)
CODCGRA|2|2|0|Codice gruppo (da chiarire) (AG0CGR)
CODSPA|1|4|0|Codice specie (da chiarire) (ATACSP)
@ -33,6 +33,7 @@ STABILIM|1|30|0|Stabilimento
REPARTO|1|30|0|Reparto
IDIMP|3|5|0|Codice impianto
PERCIMP|4|7|3|% di assegnazione all'impianto
FABBR06|2|1|0|Fabbr.str. art.43 d.l.223/06(0=Nessuno, 1=Industriale, 2=Altro)
3
IDCESPITE|
CODCGRA+CODSPA+CODCAT+DTCOMP+IDCESPITE|

@ -1,3 +1,3 @@
142
0
$movce|0|0|301|0|Movimenti cespiti|||
$movce|0|0|380|0|Movimenti cespiti|||

@ -1,5 +1,5 @@
142
23
28
IDCESPITE|1|10|0|Codice cespite (ZZZZZZZZZZ)
IDMOV|1|11|0|Numero movimento (ZZZZZZZZZZZ)
DTMOV|5|8|0|Data movimento cespite
@ -13,7 +13,7 @@ IMPVEN|4|18|3|Importo di vendita (per calcolo plusvalenza/minusvalenza)
SEGNO|1|1|0|Segno movimento (da chiarire)
NUMELE|2|3|0|Nunero elementi
CSTO|4|18|3|Costo storico
VNONAMM|4|18|3|Valore non ammortizzabile
VNONAMM|4|18|3|Valore non ammortizzabile fiscale e gestionale
PLUSREIN|4|18|3|Plusvalenza reinvestita
RIV75|4|18|3|Rivalutazione Legge 576/75
RIV83|4|18|3|Rivalutazione Legge 72/83
@ -23,6 +23,11 @@ RIVGF|4|18|3|Rivalutazione generica fiscale
RIVGC|4|18|3|Rivalutazione generica civilistica
STAMPATO|8|1|0|Stampato su almeno un bollato in esercizi passati (STBOLLATO)
NUMREG|3|7|0|Numero di registrazione corrispondente di prima nota
VNONAMM06|4|18|3|Valore non ammortizzabile (Fabbricati strumentali art.43 d.l.223/06)
VNONAMMC|4|18|3|Valore non ammortizzabile civilistico
VALTERR06|4|18|3|Valore terreno (Fabbricati strumentali art.43 d.l.223/06)
VALCALC06|4|18|3|Valore calcolo (Fabbricati strumentali art.43 d.l.223/06)
PERCALC06|4|7|3|% calcolo (Fabbricati strumentali art.43 d.l.223/06)
3
IDMOV|
IDCESPITE+IDMOV|

@ -1,3 +1,3 @@
143
0
$salce|0|0|212|0|Saldi cespiti|||
$salce|0|0|248|0|Saldi cespiti|||

@ -1,11 +1,11 @@
143
18
20
IDCESPITE|1|10|0|Codice cespite (ZZZZZZZZZZ)
CODES|2|4|0|Codice esercizio (DTINES)
TPSALDO|2|1|0|Tipo saldo
NUMELE|2|3|0|Numero elementi
CSTO|4|18|3|Costo storico
VNONAMM|4|18|3|Valore non ammortizzabile
VNONAMM|4|18|3|Valore non ammortizzabile fiscale e gestionale
PLUSREIN|4|18|3|PLusvalenza reinvestita
RIV75|4|18|3|Rivalutazione Legge 576/75
RIV83|4|18|3|Rivalutazione Legge 72/83
@ -18,5 +18,7 @@ RIVGC|4|18|3|Rivalutazione generica civilistica
VSPMANU|4|18|3|Valore spese di manutenzione
ANNIAMM|2|3|0|Numero esercizi ammortamento giá chiusi (per controllo ammortamento anticipato)
DTSTBOLL|5|8|0|Data di stampa del bollato
VNONAMMC|4|18|3|Valore non ammortizzabile civilistico
VNONAMM06|4|18|3|Valore non ammortizzabile (Fabbricati strumentali art.43 d.l.223/06)
1
IDCESPITE+CODES+TPSALDO|

@ -12,6 +12,8 @@
#define MOVCE_NUMELE "NUMELE"
#define MOVCE_CSTO "CSTO"
#define MOVCE_VNONAMM "VNONAMM"
#define MOVCE_VNONAMMC "VNONAMMC"
#define MOVCE_VNONAMM06 "VNONAMM06"
#define MOVCE_PLUSREIN "PLUSREIN"
#define MOVCE_RIV75 "RIV75"
#define MOVCE_RIV83 "RIV83"
@ -20,3 +22,6 @@
#define MOVCE_RIVGF "RIVGF"
#define MOVCE_RIVGC "RIVGC"
#define MOVCE_STAMPATO "STAMPATO"
#define MOVCE_VALTERR "VALTERR06"
#define MOVCE_VALCALC "VALCALC06"
#define MOVCE_PERCALC "PERCALC06"

@ -4,6 +4,8 @@
#define SALCE_NUMELE "NUMELE"
#define SALCE_CSTO "CSTO"
#define SALCE_VNONAMM "VNONAMM"
#define SALCE_VNONAMM06 "VNONAMM06"
#define SALCE_VNONAMMC "VNONAMMC"
#define SALCE_PLUSREIN "PLUSREIN"
#define SALCE_RIV75 "RIV75"
#define SALCE_RIV83 "RIV83"

@ -1,28 +1,22 @@
#include <config.h>
#include <defmask.h>
#include <execp.h>
#include <golem.h>
#include <msksheet.h>
#include <relapp.h>
#include <recarray.h>
#include <sheet.h>
#include <validate.h>
#include <utility.h>
#include <pconti.h>
#include <comuni.h>
#include <clifo.h>
#include <anagr.h>
#include <anafis.h>
#include <cfven.h>
#include <mov.h>
#include <indsp.h>
#include <modaut.h>
#include "cg0.h"
#include "cg0200.h"
#include "cg0201.h"
#include <defmask.h>
#include <golem.h>
#include <modaut.h>
#include <msksheet.h>
#include <recarray.h>
#include <relapp.h>
#include <anagr.h>
#include <anafis.h>
#include <cfven.h>
#include <clifo.h>
#include <comuni.h>
#include <indsp.h>
#include <mov.h>
class TClifo_application : public TRelation_application
{
TMask* _msk;
@ -37,7 +31,7 @@ protected:
bool user_create();
bool user_destroy();
virtual TMask* get_mask(int mode) { return _msk; }
virtual bool changing_mask(int mode) { return FALSE; }
virtual bool changing_mask(int mode) { return false; }
virtual bool save_and_new() const { return _savenew; }
virtual bool protected_record(TRectype &rec);
virtual bool get_next_key(TToken_string& key);
@ -74,12 +68,12 @@ protected:
static bool percip_handler(TMask_field& f, KEY key);
static bool email_handler(TMask_field& f, KEY k);
static bool rsoc_handler(TMask_field& f, KEY k);
virtual bool has_filtered_cursor() const { return TRUE;}
virtual bool has_filtered_cursor() const { return true;}
public:
// @cmember Disabilita la verifica del modulo : essendo una anagrafica, va sempre abilitata
virtual bool check_autorization() const
{return FALSE;}
{return false;}
virtual TRelation* get_relation() const {return (TRelation*)_rel;}
};
@ -88,24 +82,26 @@ inline TClifo_application& app() { return (TClifo_application&)main_app(); }
bool TClifo_application::protected_record(TRectype &rec)
{
if (!_has_cg)
return FALSE;
TMask* m = get_mask(MODE_MOD);
const TString16 tipocf(m->get(F_TIPOCF));
const long codice = atol(m->get(F_CODCF));
TLocalisamfile mov(LF_MOV);
return false;
mov.setkey(3);
mov.curr().put(MOV_TIPO, tipocf);
mov.curr().put(MOV_CODCF, codice);
mov.read();
return tipocf == mov.get(MOV_TIPO) && codice == atol(mov.get(MOV_CODCF));
const TMask& m = *get_mask(MODE_MOD);
const char tipocf = m.get(F_TIPOCF)[0];
const long codice = m.get_long(F_CODCF);
TLocalisamfile mov(LF_MOV); mov.setkey(3);
TRectype& head = mov.curr();
head.put(MOV_TIPO, tipocf);
head.put(MOV_CODCF, codice);
const int err = mov.read(_isgteq);
return err == NOERR && tipocf == head.get_char(MOV_TIPO)
&& codice == head.get_long(MOV_CODCF);
}
bool TClifo_application::get_next_key(TToken_string& key)
{
TLocalisamfile& clifo = _rel->lfile() ;
long codcf = 1L ;
const TString tipo(_msk->get(F_TIPOCF)) ;
TLocalisamfile& clifo = _rel->lfile();
long codcf = 1L;
const TString& tipo = _msk->get(F_TIPOCF);
if (!clifo.empty())
{
@ -128,12 +124,12 @@ bool TClifo_application::get_next_key(TToken_string& key)
}
}
key.format("%d|%s|%d|%ld", F_TIPOCF, (const char*) tipo, F_CODCF, codcf);
return TRUE;
return true;
}
HIDDEN bool no_dup_fis(TMask_field& f, KEY key)
{
bool ok = TRUE;
bool ok = true;
TMask& msk = f.mask() ;
if (msk.query_mode() || !f.to_check(key))
@ -166,42 +162,66 @@ HIDDEN bool no_dup_fis(TMask_field& f, KEY key)
HIDDEN bool no_dup_iva(TMask_field& f, KEY key)
{
bool ok = TRUE;
bool ok = true;
TMask& msk = f.mask() ;
if (msk.query_mode() || !f.to_check(key))
return ok;
TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ;
if (f.get().not_empty() && !clifo.empty() )
if (!f.empty())
{
clifo.zero() ;
const char t1 = msk.get(F_TIPOCF)[0];
clifo.put(CLI_TIPOCF, t1) ;
TLocalisamfile clifo(LF_CLIFO) ;
clifo.put(CLI_TIPOCF, msk.get(F_TIPOCF)) ;
clifo.put(CLI_STATOPAIV, msk.get(F_STATOPAIV)) ;
clifo.put(CLI_PAIV, f.get()) ;
clifo.setkey(5) ;
clifo.read() ;
clifo.setkey(1) ;
const char t = clifo.get_char(CLI_TIPOCF);
const long s = clifo.get_long(CLI_CODCF);
const long s1 = msk.get_long(F_CODCF);
if (clifo.good() && (t1 != t || s1 != s))
const int err = clifo.read() ;
if (err == NOERR)
{
ok = f.error_box(FR("Partita iva gia' utilizzata per il codice %c/%ld"
"\nsenza avere indicato il valore 4 nell'inserimento in allegato"), t, s);
const long s = clifo.get_long(CLI_CODCF);
const long s1 = msk.get_long(F_CODCF);
if (s1 != s)
ok = f.error_box(FR("Partita IVA gia' utilizzata per il codice %ld"
"\nsenza avere indicato il valore 4 nell'inserimento in allegato"), s);
}
}
return ok;
}
// Controlla la presenza di Codice Fiscale e/o Partita IVA
HIDDEN bool almeno_cf_o_pi(TMask_field& f)
{
bool ok = true;
if (f.empty())
{
const TMask& m = f.mask();
const TString& stato = m.get(F_STATOPAIV);
if (stato.blank() || stato == "IT") // Se sono un italiano ...
{
const bool occas = m.get_bool(F_OCCASIONALE);
const int alleg = m.get_int(F_ALLEG);
if (!occas && (alleg == 0 || alleg == 6)) // ... e non sono occasionale
{
const TEdit_field& cofi = m.efield(F_COFI);
if (cofi.empty()) // Dal 2007 serve il codice fiscale
ok = cofi.error_box(TR("Codice fiscale obbligatorio per residenti in Italia"));
else
{
// Se NON sono privato (alleg!=6), serve partita IVA
const TEdit_field& paiv = m.efield(F_PAIV);
if (alleg != 6 && paiv.empty())
ok = paiv.error_box(TR("E' necessario specificare la partita IVA per i non privati"));
}
}
}
}
return ok;
}
HIDDEN bool cofi_handler(TMask_field& f, KEY key)
{
bool ok = TRUE;
bool ok = true;
TMask& m = f.mask();
if (key == K_ENTER && !f.dirty() && !m.query_mode())
@ -212,11 +232,16 @@ HIDDEN bool cofi_handler(TMask_field& f, KEY key)
if (key == K_TAB)
{
const TString& s1 = f.get();
if (s1.not_empty())
if (s1.full())
m.set(F_TIPOPERS, isdigit(s1[0]) ? "G" : "F");
}
if (m.get(F_ALLEG) != "4")
const int alleg = m.get_int(F_ALLEG);
if (alleg != 4)
{
ok = no_dup_fis(f, key);
if (ok)
ok = almeno_cf_o_pi(f);
}
}
return ok;
@ -224,14 +249,25 @@ HIDDEN bool cofi_handler(TMask_field& f, KEY key)
HIDDEN bool paiv_handler(TMask_field& f, KEY key)
{
bool ok = TRUE;
bool ok = true;
const TMask& m = f.mask();
if (key == K_ENTER && !f.dirty() && !m.query_mode())
ok = ((TEdit_field&)f).validate(key);
if (ok && f.to_check(key) && m.get(F_ALLEG) != "4")
ok = no_dup_iva(f, key);
if (key == K_ENTER && !m.query_mode())
{
if (!f.dirty())
ok = ((TEdit_field&)f).validate(key);
if (ok)
{
const int alleg = m.get_int(F_ALLEG);
if (alleg != 4)
{
ok = no_dup_iva(f, key);
if (ok)
ok = almeno_cf_o_pi(f);
}
}
}
return ok;
}
@ -241,7 +277,7 @@ bool TClifo_application::tipocf_handler(TMask_field& f, KEY key)
if (key == K_TAB && f.focusdirty())
app().update_navigation_bar();
return TRUE;
return true;
}
bool TClifo_application::tipo_handler(TMask_field& f, KEY key)
@ -250,28 +286,28 @@ bool TClifo_application::tipo_handler(TMask_field& f, KEY key)
const bool fis = f.get() == "F";
m.show(-5, app()._lbcn && fis);
return TRUE;
return true;
}
bool TClifo_application::percip_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
if (f.to_check(key) && m.get(F_CODANAGPER).not_empty())
if (f.to_check(key) && !m.field(F_CODANAGPER).empty())
{
const TRectype& anag = m.efield(F_CODANAGPER).browse()->cursor()->file().curr();
TString80 c(m.get(F_COFI)), p(m.get(F_PAIV));
const TString& c = m.get(F_COFI), p = m.get(F_PAIV);
if ((c.not_empty() && c != anag.get(ANA_COFI)) ||
(p.not_empty() && p != anag.get(ANA_PAIV)))
if ((c.full() && c != anag.get(ANA_COFI)) ||
(p.full() && p != anag.get(ANA_PAIV)))
return error_box(TR("Percipiente non corretto: codice fiscale o partita IVA diversa"));
const TString r(anag.get(ANA_RAGSOC));
if (key == K_TAB && m.get(F_RAGSOC).empty() &&
const TString& r = anag.get(ANA_RAGSOC);
if (key == K_TAB && m.field(F_RAGSOC).empty() &&
yesno_box(FR("Ragione sociale mancante: assumo %s"), (const char*)r))
{
m.set(F_RAGSOC, r.left(30), TRUE);
m.set(F_RAGSOCA, r.mid(30), TRUE);
m.set(F_RAGSOC, r.left(30), true);
m.set(F_RAGSOCA, r.mid(30), true);
}
if (m.get(F_INDCF).empty()) m.set(F_INDCF, anag.get(ANA_INDRES));
@ -279,8 +315,8 @@ bool TClifo_application::percip_handler(TMask_field& f, KEY key)
if (m.get(F_CAPCF).empty()) m.set(F_CAPCF, anag.get(ANA_CAPRES));
if (m.get(F_COMCF).empty())
{
m.set(F_STATOCF, anag.get(ANA_STATORES), TRUE);
m.set(F_COMCF, anag.get(ANA_COMRES), TRUE);
m.set(F_STATOCF, anag.get(ANA_STATORES), true);
m.set(F_COMCF, anag.get(ANA_COMRES), true);
}
if (c.empty()) m.set(F_COFI, anag.get(ANA_COFI));
if (p.empty()) m.set(F_PAIV, anag.get(ANA_PAIV));
@ -296,18 +332,16 @@ bool TClifo_application::percip_handler(TMask_field& f, KEY key)
if (m.get(F_DATANASC).empty()) m.set(F_DATANASC, fis.get(ANF_DATANASC));
if (m.get(F_COMNASC).empty())
{
m.set(F_STATONASC, fis.get(ANF_STATONASC), TRUE);
m.set(F_COMNASC, fis.get(ANF_COMNASC), TRUE);
m.set(F_STATONASC, fis.get(ANF_STATONASC), true);
m.set(F_COMNASC, fis.get(ANF_COMNASC), true);
}
}
}
}
}
return TRUE;
return true;
}
bool TClifo_application::email_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
@ -315,50 +349,46 @@ bool TClifo_application::email_handler(TMask_field& f, KEY k)
TMail_message msg(f.mask().get(F_MAIL));
msg.send();
}
return TRUE;
return true;
}
bool TClifo_application::rsoc_handler(TMask_field& f, KEY k)
{
if (k == K_TAB && f.focusdirty())
{
TMask & m = f.mask();
TMask& m = f.mask();
if (m.query_mode() && m.key_valid(2) && app().find(2))
{
f.set_focusdirty(FALSE);
f.set_focusdirty(false);
m.stop_run(K_AUTO_ENTER);
}
}
return TRUE;
return true;
}
HIDDEN bool alleg_handler(TMask_field& f, KEY key)
{
if (key == K_ENTER)
{
TMask& m = f.mask();
const int tipoall = atoi(f.get());
if (m.get_bool(F_OCCASIONALE))
if (f.to_check(key, true))
{
TMask& m = f.mask();
const int tipoall = atoi(f.get());
if (key == K_ENTER)
{
if (m.get_bool(F_OCCASIONALE))
{
if (tipoall != 2 && tipoall != 5 && tipoall != 6)
return f.error_box(TR("Tipo allegato non valido per gli occasionali"));
}
else
{
if (tipoall == 2)
return f.error_box(TR("Tipo allegato non valido per i non occasionali"));
}
}
else
{
if (tipoall != 2 && tipoall != 6)
return f.error_box("Tipo allegato %d errato per gli occasionali", tipoall);
}
else
{
if (tipoall == 2)
return f.error_box("Tipo allegato %d errato per i non occasionali", tipoall);
}
}
else
if (f.to_check(key, TRUE))
{
TMask& m = f.mask();
const int tipoall = atoi(f.get());
m.field(F_COMCF).check_type(tipoall == 6 ? CHECK_REQUIRED : CHECK_NORMAL);
if (tipoall == 0 || tipoall == 1 || tipoall == 4 || tipoall == 6)
m.enable(F_CODALLEG);
@ -366,47 +396,43 @@ HIDDEN bool alleg_handler(TMask_field& f, KEY key)
{
m.disable(F_CODALLEG);
m.reset(F_CODALLEG);
m.reset(F_RAGSOCALLEG);
}
if (tipoall < 6)
m.set(F_OCCASIONALE, (tipoall == 2) ? "X" : " ");
m.field(F_COFI).set_dirty(TRUE);
m.field(F_PAIV).set_dirty(TRUE);
if (tipoall == 2)
m.set(F_OCCASIONALE, "X");
m.field(F_COFI).set_dirty(true);
m.field(F_PAIV).set_dirty(true);
}
return TRUE;
}
return true;
}
HIDDEN bool codalleg_handler(TMask_field& f, KEY key)
{
if (f.to_check(key))
if (f.to_check(key) && !f.empty())
{
const TString16 cod(f.get());
TMask& m = f.mask();
const TString& cod = f.get();
if (cod == m.get(F_CODCF))
return error_box(TR("Il codice per allegato coincide con il codice anagrafico"));
const char tipo = m.get(F_TIPOCF)[0];
if (cod.not_empty())
{
TMask& m = f.mask();
if (cod == m.get(F_CODCF))
return error_box(TR("Il codice per allegato coincide con il codice anagrafico"));
const char tipo = m.get(F_TIPOCF)[0];
TString16 key; key.format("%c|%s", tipo, (const char *) cod);
const TRectype & clifo = cache().get(LF_CLIFO, key);
if (clifo.empty())
return FALSE;
if (clifo.get(CLI_CODALLEG).not_empty())
return error_box(TR("Codice non utilizzabile: contiene a sua volta un codice per allegato"));
if (clifo.get(CLI_PAIV).empty())
return error_box(TR("Codice non utilizzabile: privo di partita IVA"));
const TString& tipoall = clifo.get(CLI_ALLEG);
if (tipoall.not_empty() && tipoall != "1" && tipoall != "4")
return error_box(TR("Codice non utilizzabile: codice inserimento allegato non corretto"));
}
TString16 key; key.format("%c|%s", tipo, (const char*)cod);
const TRectype& clifo = cache().get(LF_CLIFO, key);
if (clifo.empty())
return false;
if (clifo.get(CLI_CODALLEG).full())
return error_box(TR("Codice non utilizzabile: contiene a sua volta un codice per allegato"));
if (clifo.get(CLI_PAIV).empty())
return error_box(TR("Codice non utilizzabile: privo di partita IVA"));
const int tipoall = clifo.get_int(CLI_ALLEG);
if (tipoall != 0 && tipoall != 1 && tipoall != 4)
return error_box(TR("Codice non utilizzabile: codice inserimento allegato non corretto"));
}
return TRUE;
return true;
}
void TClifo_application::on_config_change()
@ -503,7 +529,7 @@ int TClifo_application::read(TMask& m)
riga.add(rec.get(IND_PFAX));
riga.add(rec.get(IND_FAX));
riga.add(rec.get(IND_IVARID));
TString16 key;
TString8 key;
key << rec.get(IND_STATO);
key << '|' << rec.get(IND_COM);
const TRectype& com = cache().get(LF_COMUNI, key);
@ -692,7 +718,7 @@ void TClifo_application::indsp_pack()
{
TToken_string& riga=(TToken_string&)rows[i];
if (riga.empty_items())
rows.destroy(i,FALSE);
rows.destroy(i,false);
}
rows.pack();
}
@ -818,7 +844,7 @@ bool TClifo_application::effetti_notify(TSheet_field& pnae, int r, KEY key)
int mass_rig = mass_len / 11; // Numero di periodi ivi salvabili
return pnae.items() < mass_rig; // Non accettare righe che non si possono salvare
}
return TRUE;
return true;
}
bool TClifo_application::user_create() // initvar e arrmask
@ -828,7 +854,6 @@ bool TClifo_application::user_create() // initvar e arrmask
_has_cg = has_module(CGAUT, CHK_DONGLE);
_rel = new TClifoVI;
_msk = new TMask("cg0200a") ;
_msk->set_handler(F_TIPOCF, tipocf_handler);
@ -850,14 +875,14 @@ bool TClifo_application::user_create() // initvar e arrmask
TConfig config(CONFIG_STUDIO);
_savenew = !config.get_bool("Cg02SN");
return TRUE;
return true;
}
bool TClifo_application::user_destroy() // releasev e arrmask
{
delete _msk;
delete _rel;
return TRUE;
return true;
}
int cg0200(int argc, char* argv[])

@ -132,10 +132,11 @@
#define F_CODVETT1 217
#define F_CODVETT2 218
#define F_CODVETT3 219
#define F_DESTACF 224
#define F_CODSPED1 225
#define F_CODSPED2 226
#define F_RAGSOCALLEG 220
#define F_DESTACF 224
#define F_RAGSOCALLEG 228
#define F_DESTACF 229
#define F_CODDEP 230
#define F_RAGGEFF 232
#define F_NUMCC 233

@ -140,7 +140,7 @@ BEGIN
DISPLAY "Partita IVA@11" PAIV
COPY OUTPUT F_CODCF
HELP "Codice fiscale del cliente/fornitore"
VALIDATE CF_FUNC F_STATOPAIV
VALIDATE CF_FUNC F_STATOPAIV
END
STRING F_PAIV 12

@ -1,7 +1,6 @@
// cg0500.cpp - Tabella causali
#include <applicat.h>
#include <config.h>
#include <msksheet.h>
#include <recarray.h>
#include <relapp.h>

@ -1,11 +1,10 @@
// --------------------------------------------------------------
// fv: cg0 -5 <tab>: gestione maschere contabilita'
// --------------------------------------------------------------
#include <tabapp.h>
#include <saldi.h>
#include <defmask.h>
#include <sheet.h>
#include <tabapp.h>
#include "../ba/batbesc.h"
#include "cglib01.h"

@ -1,15 +1,6 @@
//********************************
//* Aggiornamento Tipo Attivita' *
//********************************
#include <applicat.h>
#include <mask.h>
#include <relation.h>
#include <tabutil.h>
#include <progind.h>
#include <mov.h>
#include <rmoviva.h>
#include "cg1.h"
#include "cg1301.h"
#include "cg1302.h"
@ -19,16 +10,19 @@
#include "cg1306.h"
#include "cg1307.h"
#include "cg1308.h"
#include "cg1309.h"
#include "cglib01.h"
#include <applicat.h>
#include <mask.h>
#include <progind.h>
#include <mov.h>
class TAgg_attiv : public TSkeleton_application
{
TLocalisamfile* _pcon,* _attiv;
TTable* _reg;
protected:
virtual bool create();
virtual bool destroy();
virtual void main_loop();
public:
@ -37,24 +31,6 @@ public:
// HIDDEN TAgg_attiv& app() { return (TAgg_attiv&)main_app(); }
bool TAgg_attiv::create()
{
_pcon = new TLocalisamfile(LF_PCON);
_attiv = new TLocalisamfile(LF_ATTIV);
_reg = new TTable("REG");
return TSkeleton_application::create();
}
bool TAgg_attiv::destroy()
{
delete _pcon;
delete _attiv;
delete _reg;
return TSkeleton_application::destroy();
}
void TAgg_attiv::main_loop()
{
TMask msk("cg1300a");
@ -114,55 +90,58 @@ int cg1300(int argc, char* argv[])
switch (toupper(*argv[2]))
{
case 'A':
{
TAgg_attiv a;
a.run(argc, argv, TR("Aggiornamento tipo attivita' su movimenti iva"));
}
break;
{
TAgg_attiv a;
a.run(argc, argv, TR("Aggiornamento tipo attivita' su movimenti iva"));
}
break;
case 'C':
{
TAgg_codatt a;
a.run(argc, argv,TR("Aggiornamento codice attivita'"));
}
break;
{
TAgg_codatt a;
a.run(argc, argv,TR("Aggiornamento codice attivita'"));
}
break;
case 'D':
{
TAgg_datacomp a;
a.run(argc, argv,TR("Aggiornamento data competenza"));
}
break;
{
TAgg_datacomp a;
a.run(argc, argv,TR("Aggiornamento data competenza"));
}
break;
case 'E':
{
TAgg_codes a;
a.run(argc, argv,TR("Aggiornamento codice esercizio"));
}
break;
{
TAgg_codes a;
a.run(argc, argv,TR("Aggiornamento codice esercizio"));
}
break;
case 'I':
{
TAgg_opintra a;
a.run(argc, argv, TR("Aggiornamento flag op. intracomunitarie"));
}
break;
{
TAgg_opintra a;
a.run(argc, argv, TR("Aggiornamento flag op. intracomunitarie"));
}
break;
case 'L':
controlla_PIVA(argc, argv); // cg1309
break;
case 'P':
{
TAgg_nprot a;
a.run(argc, argv,TR("Rinumerazione numero di protocollo"));
}
break;
{
TAgg_nprot a;
a.run(argc, argv,TR("Rinumerazione numero di protocollo"));
}
break;
case 'T':
{
TAgg_tconto a;
a.run(argc, argv, TR("Aggiornamento tipo conto")); // cg1302
}
break;
{
TAgg_tconto a;
a.run(argc, argv, TR("Aggiornamento tipo conto")); // cg1302
}
break;
case 'Z':
elimina_zoppi(argc, argv);
break;
break;
case 'M':
setta_meseliq(argc, argv);
break;
break;
default:
break;
break;
}
return 0;
}

11
cg/cg1300l.h Executable file

@ -0,0 +1,11 @@
#define F_TIPO 201
#define F_CLIFO 202
#define F_COFI 203
#define F_RESET 204
#define S_DIRTY 101
#define S_CODCF 102
#define S_RAGSOC 103
#define S_PAIV 104
#define S_COFI 105
#define S_ERROR 106

112
cg/cg1300l.uml Executable file

@ -0,0 +1,112 @@
#include "cg1300l.h"
TOOLBAR "Toolbar" 0 -2 0 2
BUTTON F_RESET 10 2
BEGIN
PROMPT -13 -11 "Deselezione"
END
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -23 -11 ""
PICTURE BMP_SAVEREC
PICTURE BMP_SAVERECDN
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -33 -11 ""
END
ENDPAGE
PAGE "Controllo Partita IVA" 0 0 0 -3
RADIOBUTTON F_TIPO 1 28
BEGIN
PROMPT 1 0 "Tipo"
ITEM "C|Clienti"
ITEM "F|Fornitori"
FLAGS "Z"
END
BOOLEAN F_COFI
BEGIN
PROMPT 31 1 "Controllo Codice Fiscale"
END
SPREADSHEET F_CLIFO 0 -1
BEGIN
PROMPT 0 3 ""
ITEM "@1"
ITEM "Codice@7"
ITEM "Ragione Sociale@50"
ITEM "Partita IVA"
ITEM "Codice Fiscale@16"
ITEM "Problema riscontrato@50"
END
ENDPAGE
ENDMASK
PAGE "Dati" -1 -1 52 10
BOOLEAN S_DIRTY
BEGIN
PROMPT 1 0 "Modificato"
END
NUMBER S_CODCF 7
BEGIN
PROMPT 21 0 "Codice "
FLAGS "D"
END
STRING S_RAGSOC 50
BEGIN
PROMPT 1 1 ""
FLAGS "D"
END
STRING S_PAIV 12
BEGIN
PROMPT 1 3 "Partita IVA "
END
STRING S_COFI 16
BEGIN
PROMPT 1 4 "Codice Fiscale "
END
BUTTON DLG_USER 10 2
BEGIN
PROMPT -1 3 "Allinea"
END
MEMO S_ERROR 50 3
BEGIN
PROMPT 1 5 "Problema riscontrato"
FLAGS "D"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_LINK 10 2
BEGIN
PROMPT -23 -1 ""
PICTURE BMP_LINK
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
ENDMASK

@ -8,13 +8,12 @@
#include <rmoviva.h>
#include <nditte.h>
#include "cg1300.h"
#include "cg1302.h"
#include "cglib01.h"
const int TAgg_tconto::look_reg (const char* cod, int anno)
{
TString16 codtab;
TString8 codtab;
codtab.format("%4d%-3s", anno, cod);
int tipo_reg = cache().get("REG", codtab).get_int("I0");
return tipo_reg;

@ -1,17 +1,13 @@
//*****************************************************
//* Aggiornamento codice attivita' su progressivi IVA *
//*****************************************************
#include <mask.h>
#include <progind.h>
#include <tabutil.h>
#include <mov.h>
#include "cg1300.h"
#include "cg1304.h"
#include "cglib01.h"
// HIDDEN TAgg_codatt& app() { return (TAgg_codatt&) main_app(); }
#include <mask.h>
#include <progind.h>
#include <tabutil.h>
bool TAgg_codatt::create()
{

Some files were not shown because too many files have changed in this diff Show More