Patch level : 2.2

Files correlati     : cg2 cg3 cg4 cg5
Ricompilazione Demo : [ ]
Commento            :

000422
Aggiunta gestione data di attivazione data saldaconto.
La causale ora diventa di saldaconto solo dalla data specificata in configurazione


git-svn-id: svn://10.65.10.50/trunk@13408 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2005-10-10 17:17:16 +00:00
parent b02619ff40
commit a8e9b6c2d1
15 changed files with 260 additions and 541 deletions

View File

@ -22,7 +22,6 @@ int main(int argc,char** argv)
default:
cg1100(argc,argv); break; // Stampa Piano dei conti
}
exit(0); // Altrimenti non esce mai!
return 0;
}

View File

@ -142,7 +142,7 @@ TMask* TPrimanota_application::load_mask(int n)
// Se esiste lo sheet delle rate
if (is_fattura())
{
TSheet_field& ps = (TSheet_field&)m->field(FS_RATESHEET);
TSheet_field& ps = m->sfield(FS_RATESHEET);
ps.set_notify(pag_notify);
m->set_handler(FS_RATESHEET, pag_sheet_handler);
m->set_handler(F_ANNORIF, annorif_handler);
@ -190,13 +190,13 @@ bool TPrimanota_application::user_create()
set_search_field(F_NUMREG); // Set field for default search
_pag = NULL;
_is_saldaconto = FALSE;
_is_saldaconto = false;
load_mask(0);
load_colors();
return TRUE;
return true;
}
bool TPrimanota_application::save_and_new() const
@ -217,36 +217,34 @@ bool TPrimanota_application::user_destroy()
delete _incasso;
return TRUE;
return true;
}
// Legge la causale di codice cod ed il relativo registro dell'anno year
// Certified 99%
bool TPrimanota_application::read_caus(const char* cod, int year)
{
bool ok = TRUE;
bool ok = true;
if (cod != NULL)
ok = causale().read(cod, year);
bool nob = FALSE, dob = FALSE;
TipoIVA iva = nessuna_iva;
_is_saldaconto = FALSE;
bool nob = false, dob = false;
_is_saldaconto = false;
const TipoIVA iva = ok ? causale().iva() : nessuna_iva;
TMask* m = _msk[iva == nessuna_iva ? 1 : 2];
// Se sono chiamato dai campi di query ho belle che finito
if (_mode == MODE_QUERY || m == NULL)
return true;
if (ok)
{
_is_saldaconto = gestione_saldaconto() && causale().saldaconto();
_is_saldaconto = gestione_saldaconto() && causale().saldaconto(m->get_date(F_DATAREG));
dob = is_fattura() || causale().data_doc();
nob = is_fattura() || causale().num_doc();
iva = causale().iva();
}
TMask* m = _msk[iva == nessuna_iva ? 1 : 2];
// Se sono chiamato dai campi di query ho belle che finito
if (_mode == MODE_QUERY || m == NULL)
return TRUE;
const bool ins = m->insert_mode();
m->efield(F_NUMDOC).check_type(nob ? CHECK_REQUIRED : CHECK_NORMAL); // Num. doc. obbligatorio
@ -255,7 +253,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
const bool nota_credito = is_nota_credito();
const bool show_games = is_pagamento() || nota_credito;
TSheet_field& cgsheet = (TSheet_field&)m->field(F_SHEETCG);
TSheet_field& cgsheet = m->sfield(F_SHEETCG);
TMask& cgm = cgsheet.sheet_mask();
cgm.set_handler(DLG_USER, show_games ? showpartite_handler : NULL); // bottoncino riga
cgm.enable(DLG_USER, show_games);
@ -264,7 +262,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
m->enable(F_PROVVISORIO, !_is_saldaconto); // Il saldaconto vieta i movimenti provvisori
m->show(SK_TIPORIGA, is_pagamento()); // Abilita scelta tipo riga
m->enable(SK_TIPORIGA);
activate_numrif(*m, FALSE);
activate_numrif(*m, false);
}
else
{
@ -274,7 +272,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
TEdit_field& numrif = m->efield(F_NUMRIF);
numrif.set_justify(iva == iva_acquisti ? _num_for : _num_cli);
numrif.set_trim(!numrif.right_justified());
activate_numrif(*m, FALSE);
activate_numrif(*m, false);
const bool av = causale().reg().agenzia_viaggi();
m->show(F_DATA74TER, av);
@ -283,7 +281,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
if (ins)
{
const long protiva = causale().reg().protocol() + 1;
m->set(F_PROTIVA, protiva, TRUE); // Aggiorna protocollo IVA
m->set(F_PROTIVA, protiva, true); // Aggiorna protocollo IVA
}
}
@ -368,7 +366,7 @@ void TPrimanota_application::print()
bool TPrimanota_application::menu(MENU_TAG mt)
{
bool ok = TRUE;
bool ok = true;
if (mt == MENU_ITEM(1))
set_colors();
else
@ -385,7 +383,7 @@ bool TPrimanota_application::changing_mask(int mode)
return flag;
}
_iva = iva_errata;
return TRUE;
return true;
}
@ -464,13 +462,13 @@ void TPrimanota_application::init_mask(TMask& m)
bool clig, forg;
if (_iva == iva_acquisti)
{
forg = TRUE;
clig = FALSE;
forg = true;
clig = false;
}
else
{
forg = FALSE;
clig = corrisp ? FALSE : TRUE;
forg = false;
clig = corrisp ? false : true;
}
m.show(-1, clig);
m.show(-2, forg);
@ -481,7 +479,7 @@ void TPrimanota_application::init_mask(TMask& m)
m.show(F_DATAINTRA, causale().intra());
if (causale().soloiva())
m.set(F_SOLAIVA, "X", TRUE); // Propone movimento di sola iva
m.set(F_SOLAIVA, "X", true); // Propone movimento di sola iva
m.show(F_CODIVA, m.insert_mode()); // Codice IVA standard
@ -504,7 +502,7 @@ void TPrimanota_application::init_mask(TMask& m)
m.enable(F_DESPAG, _scad_free); // Disabilita descrizione pagamento
m.enable(FS_RESET, _scad_free); // Disabilita tasto di reset
if (!_scad_free)
m.set(FS_RECALC, "", TRUE); // Disabilita ricalcolo automatico
m.set(FS_RECALC, "", true); // Disabilita ricalcolo automatico
m.enable(FS_RECALC, _scad_free);
}
}
@ -606,7 +604,7 @@ bool TPrimanota_application::get_next_key(TToken_string& tmp)
}
}
return TRUE;
return true;
}
@ -629,7 +627,7 @@ void TPrimanota_application::init_insert_mode(TMask& m)
partite().destroy(); // Elimina tutte le partite in memoria
if (is_fattura())
{
activate_numrif(m, FALSE);
activate_numrif(m, false);
const TString16 dt(m.get(F_DATADOC));
set_pagamento(NULL,dt);
set_scadenze(m);
@ -647,7 +645,7 @@ void TPrimanota_application::init_insert_mode(TMask& m)
m.reset(F_DATACOMP); // Azzera quasi sempre la data di competenza
// La preservo solo per l'incasso immediato
_as400 = FALSE; // Un movimento nuovo non puo' essere trasferito da AS400
_as400 = false; // Un movimento nuovo non puo' essere trasferito da AS400
}
@ -660,12 +658,12 @@ void TPrimanota_application::init_modify_mode(TMask& m)
// Determina se il movimento e' stato trasferito da AS/400:
// praticamente controlla che non ci sia nessun tipo movimento sulle righe contabili.
_as400 = FALSE;
_as400 = false;
if (is_saldaconto() || iva() != nessuna_iva)
{
if (cg.items() > 0)
{
_as400 = TRUE;
_as400 = true;
for (int i = cg.items()-1; i >= 0 && _as400; i--)
{
const char rt = row_type(cg.row(i));
@ -724,8 +722,8 @@ void TPrimanota_application::init_modify_mode(TMask& m)
}
}
// Controlla sulla causale se il segno del totale documento (ritsoc=FALSE)
// o quello delle ritenute sociali (ritsoc=TRUE) e' invertito rispetto al normale
// Controlla sulla causale se il segno del totale documento (ritsoc=false)
// o quello delle ritenute sociali (ritsoc=true) e' invertito rispetto al normale
bool TPrimanota_application::test_swap(bool ritsoc)
{
const char sez = ritsoc ? causale().sezione_ritsoc() : causale().sezione_clifo();
@ -752,7 +750,7 @@ int TPrimanota_application::read(TMask& m)
occas_mask().reset();
const TString16 occode(_rel->curr().get("OCFPI"));
occas_mask().set(O_CODICE, occode, TRUE);
occas_mask().set(O_CODICE, occode, true);
}
_saldi.reset(); // Azzera saldi
@ -763,7 +761,7 @@ int TPrimanota_application::read(TMask& m)
_saldi.set_anno_es(m.get_int(F_ANNOES));
_saldi.set_num_ulmov(numreg);
_saldi.set_data_ulmov((TDate)m.get(F_DATAREG));
_saldi.set_movimentato(TRUE);
_saldi.set_movimentato(true);
int i;
for (i = 0; i < _rel->cg_items(); i++)
@ -777,12 +775,12 @@ int TPrimanota_application::read(TMask& m)
TBill conto; conto.get(r);
riga.add(conto.string(0x3)); // Conto 103-107
_saldi.aggiorna(conto, import, FALSE);
_saldi.aggiorna(conto, import, false);
riga.add(""); // Codice descrizione 108
riga.add(r.get(RMV_DESCR)); // Descrizione riga 109
conto.get(r, TRUE);
conto.get(r, true);
riga.add(conto.string(0x3)); // Contropartita 110-114
const char tipo = r.get_char(RMV_ROWTYPE);
@ -817,7 +815,7 @@ int TPrimanota_application::read(TMask& m)
m.set(F_DIFFERITA, "X");
}
const bool to_swap = test_swap(FALSE);
const bool to_swap = test_swap(false);
if (to_swap)
{
real totdoc(m.get(F_TOTALE));
@ -884,7 +882,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
_saldi.set_anno_es(annoes);
_saldi.set_num_ulmov(numreg);
_saldi.set_data_ulmov((TDate)m.get(F_DATAREG));
_saldi.set_movimentato(TRUE);
_saldi.set_movimentato(true);
const int tm = causale().tipomov();
char s[2];
@ -911,7 +909,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
TImporto n; n = row;
const TBill conto(row, 2, 0x3);
_saldi.aggiorna(conto, n, TRUE);
_saldi.aggiorna(conto, n, true);
TRectype &r = _rel->cg(i);
r.zero();
@ -987,7 +985,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
rec.zero("OCFPI");
}
const bool to_swap = test_swap(FALSE);
const bool to_swap = test_swap(false);
if (to_swap)
{
real totale = rec.get_real("TOTDOC");
@ -1071,13 +1069,13 @@ int TPrimanota_application::write(const TMask& m)
_last_dreg = m.get(F_DATAREG);
_last_dcom = m.get(F_DATACOMP);
const int err = _rel->write(TRUE);
const int err = _rel->write(true);
if (err == NOERR)
{
_saldi.registra();
check_saldi();
bool salvaconto = FALSE;
bool salvaconto = false;
const long old_nreg = NUMREG_PROVVISORIO;
if (iva() != nessuna_iva)
@ -1091,7 +1089,7 @@ int TPrimanota_application::write(const TMask& m)
write_scadenze(m); // Salva fattura
break;
case tm_nota_credito:
salvaconto = TRUE; // Salva nota credito
salvaconto = true; // Salva nota credito
break;
default:
break;
@ -1136,7 +1134,7 @@ int TPrimanota_application::write(const TMask& m)
int TPrimanota_application::rewrite(const TMask& m)
{
mask2rel(m);
const int err = _rel->rewrite(TRUE);
const int err = _rel->rewrite(true);
if (err == NOERR)
{
_saldi.registra();
@ -1144,11 +1142,11 @@ int TPrimanota_application::rewrite(const TMask& m)
if (is_saldaconto())
{
bool salvaconto = FALSE;
bool salvaconto = false;
if (iva() != nessuna_iva)
{
if (causale().tipomov() == tm_nota_credito)
salvaconto = TRUE;
salvaconto = true;
else
{
partite().update_reg(_rel->curr());
@ -1390,7 +1388,7 @@ bool TPrimanota_application::link_m770()
{
const int m770 = causale().link_m770();
if (!has_module(M77AUT) || iva() == iva_vendite || m770 == 0)
return FALSE;
return false;
int tipo_coll = 0;
char tipper = ' ';
@ -1516,7 +1514,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
add_not_empty(riga, 2, ini, RMI_TIPODET); // Detrazione 103
add_not_empty(riga, 3, ini, RMI_IMPOSTA); // Imposta 104
TBill c; ini2bill(ini, c, FALSE);
TBill c; ini2bill(ini, c, false);
if (c.gruppo() > 0)
c.add_to(riga, 4, 0x7); // Conto 105-110
@ -1531,7 +1529,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
char tipo = ini.get_char(RMV_ROWTYPE);
if (tipo == '\0') tipo = ' ';
TBill conto; ini2bill(ini, conto, FALSE);
TBill conto; ini2bill(ini, conto, false);
int numrig = ini.get_int(RMV_NUMRIG)-1;
if (numrig != i) // Controllo se ho un numero riga valido
@ -1574,7 +1572,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
riga.add("", 7); // Codice descrizione 108
add_not_empty(riga, 8, ini, RMV_DESCR); // Descrizione riga 109
ini2bill(ini, conto, TRUE);
ini2bill(ini, conto, true);
if (conto.gruppo() > 0)
conto.add_to(riga, 9, 0x3); // Contropartita 110-114
@ -1684,15 +1682,15 @@ bool TPrimanota_application::link_cesp(const TMask& msk, const char* action)
{
// Controlla autorizzazione
if (!has_module(CEAUT))
return FALSE;
return false;
// Controlla flag sulla causale
if (causale().link_cespiti() <= ' ')
return FALSE;
return false;
// Controlla l'esistenza del programma cespiti
if (!fexist("ce1.exe"))
return FALSE;
return false;
// Cerca una riga con tipo costo/ricavo 2,3,4,8
int i;
@ -1706,7 +1704,7 @@ bool TPrimanota_application::link_cesp(const TMask& msk, const char* action)
break;
}
if (i < 0)
return FALSE;
return false;
TFilename cespini;
cespini.tempdir();
@ -1842,7 +1840,7 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action)
if (xvt_str_compare_ignoring_case(action, "Insert") == 0)
{
real totdoc = m.get_real(valintra ? F_CORRISPETTIVO : F_IMPONIBILI);
if (test_swap(FALSE))
if (test_swap(false))
totdoc = -totdoc;
intro.set("TOTDOC", totdoc.string());
}

View File

@ -90,8 +90,8 @@ real TPrimanota_application::totale_documento()
const real ritsoc(m.get(F_RITSOC));
const bool swapt = test_swap(FALSE); // Totale invertito ?
const bool swaps = test_swap(TRUE); // Ritenute sociali invertite ?
const bool swapt = test_swap(false); // Totale invertito ?
const bool swaps = test_swap(true); // Ritenute sociali invertite ?
if (swapt ^ swaps) // Somma ritenute sociali con segno
tot -= ritsoc;
else
@ -120,7 +120,7 @@ bool TPrimanota_application::suspended_handler(TMask_field& f, KEY k)
return f.error_box(TR("Il codice '%s' e' sospeso e non puo' essere utilizzato"), sf);
}
}
return TRUE;
return true;
}
@ -130,11 +130,11 @@ bool TPrimanota_application::detraibile(TToken_string& row)
{
const TPrimanota_application& a = app();
if (a.iva() == iva_vendite) // Vendite sempre detraibili
return TRUE;
return true;
const int tipo_det = row.get_int(2); // Leggi tipo detraibilita
if (tipo_det != 0)
return FALSE;
return false;
const int annodoc = a._msk[2]->get_date(F_DATADOC).year();
const bool prorata100 = a.causale().reg().prorata100(annodoc);
@ -342,13 +342,13 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
break;
}
bool needs_update = FALSE;
bool needs_update = false;
if (last)
{
for (int i = first; i < last; i++)
cg.disable_cell(n, i);
needs_update = TRUE;
needs_update = true;
}
COLOR back_color, fore_color;
@ -356,7 +356,7 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
if (back_color != NORMAL_BACK_COLOR || fore_color != NORMAL_COLOR)
{
cg.set_back_and_fore_color(back_color, fore_color, n);
needs_update = TRUE;
needs_update = true;
}
if (needs_update)
@ -456,7 +456,7 @@ void TPrimanota_application::cgs_pack()
if (can_remove(r))
{
bool ok = TRUE;
bool ok = true;
if (pagamento && rt == 'K')
{
ok = !partite().utilizzata(numreg, i+1);
@ -464,7 +464,7 @@ void TPrimanota_application::cgs_pack()
cg_notify(s, i, K_DEL);
}
if (ok)
rows.destroy(i, TRUE);
rows.destroy(i, true);
}
}
if (!pagamento && rowtypes_present) // Il pagamento e' gia' ordinato
@ -541,7 +541,7 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
{
TImporto cassa(impsal); cassa.swap_section();
TImporto residuo(imptot); residuo -= cassa; residuo.normalize(imptot.sezione());
bool ok = TRUE;
bool ok = true;
// if (!residuo.is_zero())
if (abs(residuo.valore()) >= 0.001)
@ -558,14 +558,14 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
msg << TR("Il totale documento in valuta") << ' ' << codval;
else
msg << TR("Il totale documento inserito");
msg << TR(" e' ") << euro.string(TRUE) << ' ' << imptot.sezione() << ",\n";
msg << TR(" e' ") << euro.string(true) << ' ' << imptot.sezione() << ",\n";
euro.set_num(cassa.valore());
msg << TR("i pagamenti e le spese ammontano a ")
<< euro.string(TRUE) << ' ' << cassa.sezione() << ",\n";
<< euro.string(true) << ' ' << cassa.sezione() << ",\n";
euro.set_num(residuo.valore());
msg << TR("per cui il residuo e' ") << euro.string(TRUE);
msg << TR("per cui il residuo e' ") << euro.string(true);
if (m.edit_mode() && impsal.is_zero())
{
@ -590,7 +590,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
if (!saldo.get_num().is_zero())
{
const char* ss = saldo.string(TRUE);
const char* ss = saldo.string(true);
if (*ss == '-') ss++;
const TRectype& rec = cache().get("%VAL", TCurrency::get_firm_val());
@ -627,7 +627,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
{
const bool ok = f.yesno_box(FR("La contropartita della riga %d non e' completa:\n"
"Si desidera continuare ugualmente?"), i+1);
if (!ok) return FALSE;
if (!ok) return false;
}
if (app().is_transaction())
@ -650,7 +650,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
bool errato = importo != speso;
if (errato && a._as400 && speso.is_zero())
errato = FALSE;
errato = false;
if (nota && errato && speso.is_zero())
{
@ -669,11 +669,11 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
{
TString msg(128);
const TCurrency euro(speso.valore());
msg.format("L'importo sul saldaconto della riga %d e' %s", currig, (const char*)euro.string(TRUE));
msg.format("L'importo sul saldaconto della riga %d e' %s", currig, (const char*)euro.string(true));
if (!speso.is_zero())
msg << (speso.sezione() == 'A' ? TR(" Avere") : TR(" Dare"));
bool ok = FALSE;
bool ok = false;
if (m.edit_mode() && speso.is_zero())
{
msg << TR("\nSi desidera registrare ugualmente?");
@ -682,7 +682,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
else
ok = f.error_box(msg);
if (!ok)
return FALSE;
return false;
}
}
if (strchr("ACGKPT", tipo) != NULL)
@ -698,7 +698,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
saldaconto_val += imp_spe;
} else
if (tipo == 'K' || tipo == 'T')
saldaconto_val += a.partite().importo_speso(numreg, i+1, TRUE, 0x1);
saldaconto_val += a.partite().importo_speso(numreg, i+1, true, 0x1);
}
}
}
@ -712,16 +712,16 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
{
const char sez(a.causale().sezione(2));
const TImporto totdoc(sez, m.get_real(F_TOTALE));
bool ok = imptot_error(totdoc, saldaconto, FALSE);
bool ok = imptot_error(totdoc, saldaconto, false);
if (ok && in_valuta && !saldaconto.is_zero())
{
const TImporto totdoc_val(sez, m.get_real(SK_TOTDOCVAL));
ok = imptot_error(totdoc_val, saldaconto_val, TRUE);
ok = imptot_error(totdoc_val, saldaconto_val, true);
}
if (!ok)
return FALSE;
return false;
}
if (fatt || nota)
@ -750,7 +750,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
}
}
else
return FALSE;
return false;
}
else
{
@ -760,7 +760,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
}
}
}
return TRUE;
return true;
}
@ -966,8 +966,8 @@ void TPrimanota_application::update_saldo_riga(int r)
bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
{
static TImporto old_spesa;
static bool delete_l = FALSE;
static bool selecting = FALSE;
static bool delete_l = false;
static bool selecting = false;
CHECKD(r >= 0, "Chi e' quel ca$$one che notifica la riga ", r);
@ -980,14 +980,14 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
const int l = type2pos('L');
CHECK(l >= 0, "Impossibile cancellare riga di tipo L");
cg.destroy(l);
delete_l = FALSE;
delete_l = false;
}
a.calcola_saldo(); // Ricalcola saldo dopo cancellazione
return TRUE; // Ritorna subito, altrimenti crea riga vuota
return true; // Ritorna subito, altrimenti crea riga vuota
}
if (k == K_INS) // La riga non esiste ancora
return TRUE;
return true;
TToken_string& row = cg.row(r);
const char tipo = row_type(row); // Tipo della riga in esame
@ -1006,9 +1006,9 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
cg.sheet_mask().enable(DLG_DELREC, tipo <= ' ' || tipo == 'K' || tipo == 'G');
if (row.empty_items())
{
selecting = TRUE;
selecting = true;
cg.select(r, 1); // Vado alla prima colonna delle righe vuote
selecting = FALSE;
selecting = false;
}
a.update_saldo_riga(r);
}
@ -1103,7 +1103,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
default:
break;
}
return TRUE;
return true;
}
bool TPrimanota_application::descr_handler(TMask_field& f, KEY k)
@ -1130,7 +1130,7 @@ bool TPrimanota_application::descr_handler(TMask_field& f, KEY k)
if (f.mask().get(F_CODCAUS).empty())
return f.error_box(TR("La descrizione del documento e' necessaria in assenza della causale"));
}
return TRUE;
return true;
}
// Handler per le colonne 'Dare' e 'Avere' dello sheet contabile.
@ -1187,7 +1187,7 @@ bool TPrimanota_application::dareavere_handler(TMask_field& f, KEY k)
a.update_saldo_riga(currig);
}
return TRUE;
return true;
}
TSheet_field& TPrimanota_application::pags() const
@ -1221,7 +1221,7 @@ bool TPrimanota_application::imponibile_handler(TMask_field& f, KEY key)
{
iva = app().curr_mask().get(F_CODIVA);
if (iva.not_empty())
m.set(102, iva, TRUE);
m.set(102, iva, true);
}
if (iva.not_empty() && !app().causale().corrispettivi())
{
@ -1244,7 +1244,7 @@ bool TPrimanota_application::imponibile_handler(TMask_field& f, KEY key)
}
}
return TRUE;
return true;
}
@ -1253,7 +1253,7 @@ bool TPrimanota_application::imponibile_handler(TMask_field& f, KEY key)
bool TPrimanota_application::codiva_handler(TMask_field& f, KEY key)
{
if (!suspended_handler(f, key))
return FALSE;
return false;
if (key == K_TAB && f.dirty())
{
@ -1296,7 +1296,7 @@ bool TPrimanota_application::codiva_handler(TMask_field& f, KEY key)
return f.error_box(TR("Codice IVA obbligatorio"));
}
}
return TRUE;
return true;
}
// Gestione del codice detrazione sullo sheet iva
@ -1310,7 +1310,7 @@ bool TPrimanota_application::detrazione_handler(TMask_field& f, KEY key)
ci.set_dirty();
ci.on_hit();
}
return TRUE;
return true;
}
// Gestione del campo imposta sullo sheet iva
@ -1340,7 +1340,7 @@ bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key)
if (val != imposta)
{
const TCurrency euro(imposta);
f.warning_box(FR("L'imposta dovrebbe essere %s"), euro.string(TRUE));
f.warning_box(FR("L'imposta dovrebbe essere %s"), euro.string(true));
}
} else
if (key == K_F8)
@ -1358,7 +1358,7 @@ bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key)
f.warning_box(TR("Cancellare l'imposta (tasto F2) prima di effettuare lo scorporo"));
}
return TRUE;
return true;
}
@ -1406,7 +1406,7 @@ void TPrimanota_application::ivas_pack()
if (imponibile != ZERO) continue;
const real imposta(r.get(3));
if (imposta != ZERO) continue;
rows.destroy(i, FALSE);
rows.destroy(i, false);
}
rows.pack(); // Pack array
@ -1417,14 +1417,14 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
{
static int oldpos,oldposiva;
static TImporto oldimp, oldiva;
static bool selecting = FALSE;
static bool selecting = false;
TPrimanota_application& a = app();
if (a._as400)
return TRUE;
return true;
if (k == K_INS || k == K_CTRL+K_DEL)
return TRUE;
return true;
TToken_string& row = iva.row(r);
const TCausale& cau = a.causale();
@ -1433,11 +1433,11 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
{
if (!selecting && row.empty_items())
{
selecting = TRUE;
selecting = true;
iva.select(r, 1); // Vado alla prima colonna delle righe vuote
selecting = FALSE;
selecting = false;
}
return TRUE;
return true;
}
if (k == K_SPACE)
@ -1648,7 +1648,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
a.set_scadenze(m); // Ricalcola rate
}
}
return TRUE;
return true;
}
@ -1664,8 +1664,8 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
const TCurrency tot(app().totale_documento());
if (imp != tot)
{
const TString t(tot.string(TRUE));
const TString i(imp.string(TRUE));
const TString t(tot.string(true));
const TString i(imp.string(true));
return error_box(FR("La somma del totale documento e delle ritenute (%s) e' diverso dalla "
"somma degli imponibili e delle imposte (%s)"),
(const char*)t, (const char*)i);
@ -1689,7 +1689,7 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
}
}
}
return TRUE;
return true;
}
/* qui
@ -1707,7 +1707,7 @@ bool TPrimanota_application::cg_tipo_handler(TMask_field& f, KEY key)
m.enable(CG_COMMESSA, on);
m.enable(CG_FASE, on);
}
return TRUE;
return true;
}
*/
@ -1722,12 +1722,12 @@ bool TPrimanota_application::cg_gruppo_handler(TMask_field& f, KEY key)
if (curr.get(RMV_GRUPPO) != f.get()) // Se non e' gia' posizionato ...
conto.check(RUNNING_CHECK); // ... forza ricerca sul conto
}
return TRUE;
return true;
}
bool TPrimanota_application::cg_conto_handler(TMask_field& f, KEY key)
{
bool ok = TRUE;
bool ok = true;
if (key == K_ENTER)
{
@ -1753,7 +1753,7 @@ bool TPrimanota_application::cg_conto_handler(TMask_field& f, KEY key)
bool TPrimanota_application::iva_sottoconto_handler(TMask_field& f, KEY key)
{
if (!suspended_handler(f, key))
return FALSE;
return false;
TMask& m = f.mask();
@ -1774,24 +1774,24 @@ bool TPrimanota_application::iva_sottoconto_handler(TMask_field& f, KEY key)
}
}
TString16 s; if (spric > 0) s << spric;
m.set(105, s, TRUE); // Setta il campo spesa-ricavo della riga IVA
m.set(105, s, true); // Setta il campo spesa-ricavo della riga IVA
}
return TRUE;
return true;
}
bool TPrimanota_application::cg_sottoconto_handler(TMask_field& f, KEY k)
{
if (!suspended_handler(f, k))
return FALSE;
return false;
return TRUE;
return true;
}
bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k)
{
if (!suspended_handler(f, k))
return FALSE;
return false;
if (k == K_TAB || k == K_ENTER)
{
@ -1816,7 +1816,7 @@ bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k)
}
}
}
return TRUE;
return true;
}
///////////////////////////////////////////////////////////
@ -1827,21 +1827,21 @@ bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k)
// Certified 99%
bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.to_check(key, TRUE))
if (key == K_TAB && f.to_check(key, true))
{
TMask& m = f.mask();
TPrimanota_application& a = app();
if (a.autodeleting() == 0x3)
return TRUE; // Non effettuare controlli inutili in cancellazione
return true; // Non effettuare controlli inutili in cancellazione
a._skip_giornale_check = FALSE;
a._skip_bollato_check = FALSE;
a._skip_giornale_check = false;
a._skip_bollato_check = false;
const TRectype& mov = cache().get(LF_MOV, f.get());
if (!mov.empty())
{
bool ok = TRUE;
bool ok = true;
if (mov.get_bool(MOV_STAMPATO))
{
@ -1866,10 +1866,10 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
if (ok)
{
// Riempie a mano i campi necessari nel caso non sia stato usata la ricerca F9
m.set(F_DATAREG, mov.get(MOV_DATAREG), TRUE);
m.set(F_DATAREG, mov.get(MOV_DATAREG), true);
m.set(F_CODCAUS, mov.get(MOV_CODCAUS));
f.set_focusdirty(FALSE);
f.set_focusdirty(false);
ok = m.stop_run(K_AUTO_ENTER);
}
else
@ -1881,7 +1881,7 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
return ok;
}
}
return TRUE;
return true;
}
@ -1890,7 +1890,8 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
{
const TMask& m = f.mask();
if (!m.is_running()) return TRUE;
if (!m.is_running())
return true;
if (f.to_check(key))
{
@ -1904,7 +1905,7 @@ bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
return error_box(TR("Causale non presente in archivio"));
}
return TRUE;
return true;
}
// Handler of the F_CODCAUS field on the modify mask
@ -1914,16 +1915,17 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
if (f.to_check(key))
{
bool ok = suspended_handler(f, key);
if (!ok) return FALSE;
if (!ok) return false;
const int ann = f.mask().get_int(F_ANNOIVA);
const TString cau(f.get());
const TCausale c(cau, ann);
if (!c.ok()) return FALSE;
if (!c.ok()) return false;
ok = app().causale().similar(c);
if (!ok)
return FALSE; // L'errore viene gia' segnalato dalla similar
return false; // L'errore viene gia' segnalato dalla similar
if (key == K_TAB)
{
app().read_caus(cau, ann);
@ -1931,7 +1933,7 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
}
}
return TRUE;
return true;
}
@ -1939,7 +1941,7 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
// Certified 70%
bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
{
bool ok = TRUE;
bool ok = true;
TMask& m = f.mask();
//if ((key == K_TAB && m.is_running() ) || key == K_ENTER)
@ -1964,7 +1966,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
return f.error_box(FR("Non esiste il libro giornale del %d"), ar);
}
else
ok = TRUE;
ok = true;
if (key == K_ENTER || f.focusdirty())
{
@ -1978,7 +1980,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
f.error_box(FR("La data dell'operazione e' antecedente al %s,\n"
"ultima stampa del libro giornale del %d"),
gio.last_print().string(), ar);
if (error) return FALSE;
if (error) return false;
}
if (key == K_TAB && dr < gio.last_reg())
f.warning_box(FR("La data dell'operazione e' antecedente al %s,\n"
@ -1996,7 +1998,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
if (reg.year() != ar)
{
const bool ok = reg.read(codreg, ar);
if (!ok) return FALSE;
if (!ok) return false;
a.read_caus(NULL, 0);
if (a.iva() != nessuna_iva)
m.field(F_CODREG).on_hit();
@ -2009,7 +2011,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
f.error_box(FR("La data dell'operazione e' antecedente al %s,\n"
"ultima stampa del registro '%s' del %d"),
reg.last_print().string(), (const char*)codreg, ar);
if (error) return FALSE;
if (error) return false;
}
if (f.dirty() && dr < reg.last_reg())
f.warning_box(FR("La data dell'operazione e' antecedente al %s,\n"
@ -2017,7 +2019,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
reg.last_reg().string(), (const char*)codreg, ar);
}
if (reg.iva() != nessuna_iva && a._rel->controlla_liquidazione(dr, reg) == TRUE)
if (reg.iva() != nessuna_iva && a._rel->controlla_liquidazione(dr, reg) == true)
{
const char* const mese = itom(dr.month());
f.warning_box(FR("La liquidazione IVA relativa al mese di %s e' gia' stata calcolata"), mese);
@ -2053,12 +2055,12 @@ bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
const char* data = TR("La data del 74/ter");
if (f.dlg() == F_DATACOMP)
{
m.set(F_ANNOES, ae, TRUE); // Aggiorna anno esercizio in entrambe le pagine
m.set(F_ANNOES, ae, true); // Aggiorna anno esercizio in entrambe le pagine
data = TR("La data di competenza");
if (dc > dr)
{
bool ok = FALSE;
bool ok = false;
const TString& ca = m.get(F_CODCAUS);
if (ca.not_empty()) // Controlla ratei e risconti
{
@ -2091,7 +2093,7 @@ bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
}
}
return TRUE;
return true;
}
// Handler of the F_DATA74TER field on the modify mask
@ -2099,12 +2101,12 @@ bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
bool TPrimanota_application::data74ter_handler(TMask_field& f, KEY key)
{
if (!f.to_check(key))
return TRUE;
return true;
const TDate dr(f.mask().get(F_DATAREG)); // Data operazione
const TDate d74(f.get()); // Data 74/ter
if (d74 > dr)
return TRUE;
return true;
if (d74.year() < dr.year()-1)
return error_box(FR("La data 74/ter non puo' essere antecedente all'anno %d"), dr.year()-1);
@ -2119,12 +2121,12 @@ bool TPrimanota_application::data74ter_handler(TMask_field& f, KEY key)
return f.error_box(FR("La data 74/ter e' antecedente al %s,\n"
"data di stampa del libro giornale del %d"), lp, g.year());
}
return TRUE;
return true;
}
bool TPrimanota_application::numdoc_handler(TMask_field& f, KEY key)
{
if (f.to_check(key, TRUE))
if (f.to_check(key, true))
{
TMask& m = f.mask();
if (key == K_TAB && m.insert_mode() && app().is_saldaconto())
@ -2132,7 +2134,7 @@ bool TPrimanota_application::numdoc_handler(TMask_field& f, KEY key)
if (!f.empty() && !app().npart_is_prot()) // Copiare numero documento nel numero partita?
{
if (m.field(F_NUMRIF).active() && m.get(F_NUMRIF).blank())
m.set(F_NUMRIF, f.get(), TRUE);
m.set(F_NUMRIF, f.get(), true);
}
}
}
@ -2182,14 +2184,14 @@ bool TPrimanota_application::numdoc_handler(TMask_field& f, KEY key)
}
}
return TRUE;
return true;
}
bool TPrimanota_application::datadoc_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
if (key == K_TAB && f.to_check(key, TRUE) && app().is_saldaconto())
if (key == K_TAB && f.to_check(key, true) && app().is_saldaconto())
{
const TDate dd(f.get()); // Fattura o nota credito
if (dd.ok())
@ -2214,7 +2216,7 @@ bool TPrimanota_application::datadoc_handler(TMask_field& f, KEY key)
}
}
return TRUE;
return true;
}
bool TPrimanota_application::occas_code_handler(TMask_field& f, KEY key)
@ -2235,7 +2237,7 @@ bool TPrimanota_application::occas_code_handler(TMask_field& f, KEY key)
}
}
}
return TRUE;
return true;
}
bool TPrimanota_application::occas_handler(TMask_field& f, KEY key)
@ -2246,7 +2248,7 @@ bool TPrimanota_application::occas_handler(TMask_field& f, KEY key)
om.run();
f.set_focus();
}
return TRUE;
return true;
}
// Crea o aggiorna la riga contabile col totale documento
@ -2338,7 +2340,7 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
{
if (!suspended_handler(f, key))
return FALSE;
return false;
if (key == K_TAB && f.active())
{
@ -2357,7 +2359,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
{
TString cod; cod << game->conto().codclifo();
f.set(cod);
return TRUE;
return true;
}
f.set_dirty(); // yesno_box cleared the dirty flag
a.notify_cgline_deletion(-1);
@ -2373,8 +2375,8 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
m.show(F_STATOPAIV); // Stato partita IVA
m.show(cf == 'C' ? F_PIVACLIENTE : F_PIVAFORNITORE); // Partita IVA
m.show(cf == 'C' ? F_COFICLIENTE : F_COFIFORNITORE); // Codice Fiscale
a.activate_numrif(m, TRUE);
return TRUE;
a.activate_numrif(m, true);
return true;
}
TRelation cliforel(LF_CLIFO); cliforel.add(LF_CFVEN, "TIPOCF=TIPOCF|CODCF=CODCF");
@ -2419,7 +2421,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
{
const TString16 valintra(clifo.get("VALINTRA"));
if (!valintra.empty())
m.set(F_VALUTAINTRA, valintra, TRUE);
m.set(F_VALUTAINTRA, valintra, true);
}
}
@ -2429,7 +2431,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
{
const TString& valuta = clifo.get(CLI_CODVAL);
if (valuta.not_empty())
m.set(SK_VALUTA, valuta, TRUE);
m.set(SK_VALUTA, valuta, true);
}
if (a.is_fattura())
@ -2452,7 +2454,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
const TString& agente = clifov.get(CLI_CODAG);
if (agente.not_empty())
{
m.set(FS_AGENTE, agente, TRUE);
m.set(FS_AGENTE, agente, true);
m.send_key(K_TAB, FS_AGENTE);
}
}
@ -2472,7 +2474,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
f.warning_box(TR("Attenzione, il saldaconto verra' eliminato!"));
f.set_dirty(); // warning_box cleans the field!
}
a.activate_numrif(m, TRUE);
a.activate_numrif(m, true);
if (f.focusdirty())
{
@ -2483,7 +2485,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
}
return TRUE;
return true;
}
@ -2503,7 +2505,7 @@ bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key)
if (key == K_TAB && !f.empty())
{
if (!suspended_handler(f, key))
return FALSE;
return false;
TPrimanota_application& a = app();
const real imp(a.ivas().row(1).get(0));
@ -2542,7 +2544,7 @@ bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key)
iva_notify(a.ivas(), 0, K_ENTER);
}
}
return TRUE;
return true;
}
// Riempie i campi valuta a zero in base agli altri
@ -2561,7 +2563,7 @@ void TPrimanota_application::gioca_cambi(int force)
const TValuta cam(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
const real new_totale = cam.val2lit(totval);
if (new_totale != totale)
m.set(F_TOTALE, new_totale, TRUE);
m.set(F_TOTALE, new_totale, true);
}
if ( (force == 0x2 || totval.is_zero()) && !(totale.is_zero() || cambio.is_zero()) )
@ -2569,7 +2571,7 @@ void TPrimanota_application::gioca_cambi(int force)
const TValuta cam(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
const real new_totval = cam.lit2val(totale);
if (new_totval != totval)
m.set(SK_TOTDOCVAL, new_totval, TRUE);
m.set(SK_TOTDOCVAL, new_totval, true);
}
if ( (force == 0x4 || cambio.is_zero()) && !(totale.is_zero() || totval.is_zero()) )
@ -2585,7 +2587,7 @@ void TPrimanota_application::gioca_cambi(int force)
new_cambio.round(6);
if (new_cambio != cambio)
m.set(SK_CAMBIO, new_cambio, TRUE);
m.set(SK_CAMBIO, new_cambio, true);
}
}
@ -2594,7 +2596,7 @@ void TPrimanota_application::gioca_cambi(int force)
// Certified 99%
bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
{
bool ok = TRUE;
bool ok = true;
TMask& m = f.mask();
TPrimanota_application& a = app();
@ -2630,7 +2632,7 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
const TCurrency totlit(cambio.val2lit(totval));
if (totale != totlit)
ok = f.yesno_box(FR("Il totale documento dovrebbe essere %s: continuare ugualmente?"),
totlit.string(TRUE));
totlit.string(true));
}
}
@ -2663,7 +2665,7 @@ bool TPrimanota_application::totdocval_handler(TMask_field& f, KEY key)
a.set_scadenze(m);
}
return TRUE;
return true;
}
// Aggiunge o aggiorna la riga delle ritenute fiscali o sociali
@ -2705,7 +2707,7 @@ void TPrimanota_application::add_cgs_rit(bool fiscali)
// Handler of the F_PROTIVA
bool TPrimanota_application::protiva_handler(TMask_field& f, KEY key)
{
bool ok = TRUE;
bool ok = true;
TMask& m = f.mask();
if (m.insert_mode())
@ -2725,7 +2727,7 @@ bool TPrimanota_application::protiva_handler(TMask_field& f, KEY key)
{
const TString& piva = f.get();
if (piva.not_empty())
m.set(F_NUMRIF, piva, TRUE);
m.set(F_NUMRIF, piva, true);
}
}
return ok;
@ -2737,8 +2739,8 @@ bool TPrimanota_application::protiva_handler(TMask_field& f, KEY key)
bool TPrimanota_application::ritfis_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.focusdirty())
app().add_cgs_rit(TRUE);
return TRUE;
app().add_cgs_rit(true);
return true;
}
@ -2747,8 +2749,8 @@ bool TPrimanota_application::ritfis_handler(TMask_field& f, KEY key)
bool TPrimanota_application::ritsoc_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.focusdirty())
app().add_cgs_rit(FALSE);
return TRUE;
app().add_cgs_rit(false);
return true;
}
HIDDEN void inventa_cambio_intra(TMask& m)
@ -2834,7 +2836,7 @@ bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key)
}
}
return TRUE;
return true;
}
// Handler of F_CORRVALUTA
@ -2864,7 +2866,7 @@ bool TPrimanota_application::corrvaluta_handler(TMask_field& f, KEY key)
cl.on_hit();
}
}
return TRUE;
return true;
}
bool TPrimanota_application::activate_numrif(TMask& m, bool init_pag)
@ -2913,7 +2915,7 @@ bool TPrimanota_application::activate_numrif(TMask& m, bool init_pag)
{
const TString& dt = m.get(F_DATADOC);
set_pagamento(NULL, dt); // Reset pagamento
set_totale_pagamento(TRUE);
set_totale_pagamento(true);
}
else
set_scadenze(m); // Inizializza pagamento
@ -2950,17 +2952,17 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
}
else
{
bool del = TRUE;
bool del = true;
if (game != NULL)
del = f.yesno_box(TR("Si desidera cancellare il saldaconto?"));
if (!del)
{
f.reset();
anchecg = TRUE;
recalcg = FALSE;
anchecg = true;
recalcg = false;
}
}
a.activate_numrif(m, TRUE);
a.activate_numrif(m, true);
}
m.show(F_SHEETCG, anchecg);
@ -2971,14 +2973,14 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
{
TSheet_field& iva = a.ivas();
const int righe = iva.items();
TProgind pi(righe, TR("Generazione righe contabilita'"), FALSE, TRUE);
TProgind pi(righe, TR("Generazione righe contabilita'"), false, true);
TSheet_field& cg = a.cgs();
cg.reset();
a.add_cgs_tot(m); // Genera totale documento
if (m.get(F_RITFIS).not_empty()) a.add_cgs_rit(TRUE); // Genera ritenute fiscali
if (m.get(F_RITSOC).not_empty()) a.add_cgs_rit(FALSE); // Genera ritenute sociali
if (m.get(F_RITFIS).not_empty()) a.add_cgs_rit(true); // Genera ritenute fiscali
if (m.get(F_RITSOC).not_empty()) a.add_cgs_rit(false); // Genera ritenute sociali
TToken_string oldrow(128);
for (int i = 0; i < righe; i++)
@ -2999,5 +3001,5 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
m.set_focus(); // Ripristina il focus al campo (a causa della progind)
}
}
return TRUE;
return true;
}

View File

@ -188,10 +188,10 @@ protected:
bool gestione_saldaconto() const { return _ges_sal; }
bool npart_is_prot() { return _npart_is_prot; }
bool is_saldaconto() const { return _is_saldaconto; }
bool is_fattura() const { return gestione_saldaconto() && causale().tipomov() == 1; }
bool is_nota_credito() const { return gestione_saldaconto() && causale().tipomov() == 2; }
bool is_pagamento() const { return gestione_saldaconto() && causale().tipomov() >= 3; }
bool is_saldaconto() const { return _is_saldaconto; }
bool is_fattura() const { return is_saldaconto() && causale().tipomov() == 1; }
bool is_nota_credito() const { return is_saldaconto() && causale().tipomov() == 2; }
bool is_pagamento() const { return is_saldaconto() && causale().tipomov() >= 3; }
bool activate_numrif(TMask& m, bool set_pag);
void fill_sheet(TMask& m) const;

View File

@ -17,10 +17,11 @@
TCausale::TCausale(const char* cod, int year)
: TArray(12), _rec(LF_CAUSALI),
_iva(iva_errata), _corrisp(FALSE),
_iva(iva_errata), _corrisp(false),
_sezione_clifo(' '), _sezione_ritsoc(' ')
{
if (*cod) read(cod, year);
if (*cod)
read(cod, year);
}
@ -31,24 +32,22 @@ bool TCausale::read(const char* cod, int year)
destroy(); // Delete all rows
_iva = iva_errata; // Delete misc info
_sezione_clifo = _sezione_ritsoc = ' ';
_corrisp = FALSE;
_corrisp = false;
if (*cod > ' ')
{
int err;
_rec = cache().get(LF_CAUSALI, cod);
if (_rec.empty())
return FALSE;
return false;
TLocalisamfile rcaus(LF_RCAUSALI);
rcaus.put(CAU_CODCAUS, cod);
rcaus.put(CAU_NRIGA, 0);
int err;
for (err = rcaus.read(_isgteq); // Find first line
err == NOERR && rcaus.get(CAU_CODCAUS) == cod;
err = rcaus.next() // Read next line
)
err = rcaus.next()) // Read next line
{
const int riga = rcaus.get_int(CAU_NRIGA);
add(rcaus.curr(), riga);
@ -64,7 +63,7 @@ bool TCausale::read(const char* cod, int year)
else
{
_iva = nessuna_iva; // Clear IVA data
_corrisp = FALSE;
_corrisp = false;
_reg.read("", year);
}
@ -142,8 +141,21 @@ const TString& TCausale::tipo_doc() const
int TCausale::tipomov() const
{ return _rec.get_int(CAU_TIPOMOV); }
bool TCausale::saldaconto() const
{ return tipomov() > 0; }
bool TCausale::saldaconto(const TDate& datareg) const
{
static TDate _data_sal(8,8,3);
if (datareg.ok())
{
if (_data_sal.year() == 3)
{
TConfig cfg(CONFIG_DITTA, "cg");
_data_sal = TDate(cfg.get("DatSal"));
}
if (datareg < _data_sal)
return false;
}
return tipomov() > 0;
}
int TCausale::link_m770() const
{ return _rec.get_int(CAU_M770); }
@ -196,7 +208,7 @@ char TCausale::sezione_ritsoc()
void TCausale::calcIVA()
{
TipoIVA i = nessuna_iva; // Tipo IVA di default
bool c = FALSE; // Corrispettivi di default
bool c = false; // Corrispettivi di default
const TString& td = tipo_doc();
if (td.not_empty())
@ -234,9 +246,9 @@ bool TCausale::similar(const TCausale& c) const
if (tipomov() != c.tipomov()) err = TR("il tipo di movimento");
if (*err)
error_box(FR("La causale e' diversa per %s"), err);
return error_box(FR("La causale e' diversa per %s"), err);
return *err ? FALSE : TRUE;
return true;
}
bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const

View File

@ -49,7 +49,7 @@ public:
bool IVA2bill(const TCodiceIVA& iva, TBill& bill) const;
int tipomov() const;
bool saldaconto() const;
bool saldaconto(const TDate& datareg) const;
int link_m770() const;
char link_cespiti() const;
bool link_analitica() const;

View File

@ -4,7 +4,6 @@
#include <colors.h>
#include <controls.h>
#include <execp.h>
#include <mailbox.h>
#include <progind.h>
#include <recarray.h>
#include <relation.h>
@ -13,7 +12,6 @@
#include <varmask.h>
#include "cg3.h"
#include "cglib01.h"
#include "cglib02.h"
#include "cg3600.h"
@ -27,292 +25,6 @@
// TList
///////////////////////////////////////////////////////////
#ifdef USE_OBSOLETE_LIST
class TList : public TContainer
{
enum { MAX_SKIP = 8192 };
struct TList_object : public TObject
{
TObject* _obj;
TList_object* _next;
TList_object* _prev;
};
TList_object** _skip;
long _items, _current;
long _step, _last_skip;
protected:
// @cmember Ritorna un puntatore al primo oggetto del contenitore
virtual TObject* first_item( );
// @cmember Ritorna un puntatore all'ultimo oggetto del contenitore
virtual TObject* last_item( );
// @cmember Ritorna un puntatore all'oggetto successivo all'oggetto corrente
virtual TObject* succ_item( );
// @cmember Ritorna un puntatore all'oggetto che precede l'oggetto corrente
virtual TObject* pred_item( );
// @cmember Ritorna il numero di oggetti nel contenitore
virtual long objects( ) const;
protected:
TList_object* detach_lstobj(long index);
TList_object* lstobjptr(long index) const;
public:
long items() const { return _items; }
TObject* objptr(long index) const;
TObject& obj(long index)
{ TObject* o = objptr(index); CHECK(o, "Null list item"); return *o; }
const TObject& obj(long index) const
{ const TObject* o = objptr(index); CHECK(o, "Null list item"); return *o; }
void destroy();
long insert(TObject* obj, long pos);
long append(TObject* obj, long pos = -1);
TObject* detach(long pos);
bool remove(long pos);
void change_step(long step); // Forza il passo per gli elementi
long choose_step(long expected_size); // Sceglie il passo per gli elemnti
TList(long expected_size = 128L);
virtual ~TList();
};
TList::TList(long expected_size)
: _items(0), _current(0)
{
_skip = new TList_object*[MAX_SKIP+1];
_skip[0] = NULL;
choose_step(expected_size);
}
TList::~TList()
{
destroy();
delete [] _skip;
}
long TList::objects( )
{
return _items;
}
TObject* TList::first_item()
{
return objptr(_current = 0);
}
TObject* TList::succ_item()
{
return objptr(++_current);
}
TObject* TList::pred_item()
{
return objptr(_current++);
}
TObject* TList::last_item()
{
return objptr(_current = _items-1);
}
void TList::destroy()
{
TList_object* head = _skip[0];
while (head)
{
TList_object* next = head->_next;
if (head->_obj)
delete head->_obj;
delete head;
head = next;
}
_items = _current = _last_skip = 0;
_skip[0] = NULL;
}
TList::TList_object* TList::lstobjptr(long index) const
{
TList_object* lstobj = NULL;
const ldiv_t p = ldiv(index, _step);
if (p.quot >= 0 && p.quot < _last_skip)
{
TList_object* lo = _skip[p.quot];
for (long s = p.rem; lo && s > 0; s--)
lo = lo->_next;
lstobj = lo;
}
return lstobj;
}
TObject* TList::objptr(long index) const
{
const TList_object* lo = lstobjptr(index);
return lo ? lo->_obj : NULL;
}
void TList::change_step(long step)
{
CHECKD(step > 0 && step <= 16384, "Bad list step ", step);
_step = step;
_last_skip = 0;
step = 0;
for (TList_object* lo = _skip[0]; lo; lo = lo->_next, step--)
{
if (step == 0)
{
CHECK(_last_skip < MAX_SKIP, "Too many items");
_skip[_last_skip++] = lo;
step = _step;
}
}
}
long TList::choose_step(long expected_size)
{
long step = expected_size / MAX_SKIP + 1;
if (step < 8)
step = 8;
change_step(step);
return step;
}
long TList::insert(TObject* obj, long index)
{
if (index < 0)
index = 0;
else
{
if (index > _items)
index = _items;
}
const long pred = index-1;
TList_object* newobj = new TList_object;
newobj->_obj = obj;
if (pred < 0)
{
newobj->_prev = NULL;
newobj->_next = _skip[0];
if (_skip[0])
_skip[0]->_prev = newobj;
}
else
{
TList_object* lo = lstobjptr(pred);
CHECK(lo, "NULL insertion point");
newobj->_next = lo->_next;
newobj->_prev = lo;
if (lo->_next)
lo->_next->_prev = newobj;
lo->_next = newobj;
}
_items++;
ldiv_t p = ldiv(index, _step);
if (p.rem == 0 && p.quot < MAX_SKIP) // Cambia il capolista
_skip[p.quot] = newobj;
for (long i = p.quot + 1; i < _last_skip; i++)
_skip[i] = _skip[i]->_prev; // Aggiorna capilista successivi
// Siamo andati oltre l'ultimo skip
const long s = (_items - 1) / _step + 1;
if (s > _last_skip)
{
if (s > MAX_SKIP)
change_step(_step+1);
else
{
if (_last_skip > 0)
{
TList_object* lo = _skip[_last_skip-1];
while (lo->_next != NULL)
lo = lo->_next;
_skip[_last_skip++] = lo;
_skip[_last_skip] = NULL;
}
else
_last_skip = 1;
}
}
return index;
}
long TList::append(TObject* obj, long index)
{
if (index < 0 || index >= _items)
index = _items;
else
index++;
return insert(obj, index);
}
TList::TList_object* TList::detach_lstobj(long index)
{
TList_object* lo = lstobjptr(index);
if (lo)
{
if (lo->_prev)
lo->_prev->_next = lo->_next;
if (lo->_next)
lo->_next->_prev = lo->_prev;
ldiv_t res = ldiv(index, _step);
if (res.rem == 0)
_skip[res.quot] = lo->_next;
long p;
for (p = res.quot + 1; p < _last_skip; p++)
_skip[p] = _skip[p]->_next;
_items--;
p = (_items - 1) / _step + 1;
if (p < _last_skip)
{
_last_skip--;
_skip[_last_skip] = NULL;
}
}
return lo;
}
TObject* TList::detach(long index)
{
TList_object* lo = detach_lstobj(index);
TObject* obj;
if (lo)
{
obj = lo->_obj;
delete lo;
}
else
obj = NULL;
return obj;
}
bool TList::remove(long index)
{
TObject* o = detach(index);
if (o)
delete o;
return o != NULL;
}
#else
// Simpler and faster 32 bit implemetation
class TList : public TContainer
@ -351,8 +63,6 @@ long TList::append(TObject* obj, long index)
return insert(obj, index);
}
#endif
///////////////////////////////////////////////////////////
// TMastrino
///////////////////////////////////////////////////////////
@ -584,11 +294,6 @@ void TMastrino::read(const TBill& conto,
max_data_reg = esercizi[ae].fine();
}
#ifdef USE_OBSOLETE_LIST
// Stima dimensione mastrino
_riga.choose_step(num_giorni);
#endif
// Valori dei saldi fino alla data di inizio stampa:
// Vengono inizializzati con i saldi iniziali dell'esercizio,
// poi verranno sommati gli importi dei movimenti che
@ -637,9 +342,9 @@ void TMastrino::read(const TBill& conto,
const TRecnotype totrows = cur.items();
cur.freeze();
TString caption(80);
caption.format(FR("Caricamento mastrino %03d.%03d.%06ld"),
_conto.gruppo(), _conto.conto(), _conto.sottoconto());
TString caption;
caption = FR("Caricamento mastrino");
caption << ' ' << _conto.gruppo() << '.' << _conto.conto() << '.' << _conto.sottoconto();
TProgind pi(totrows, caption, FALSE, TRUE);
for (cur = 0L; cur.pos() < totrows; ++cur)
@ -653,7 +358,7 @@ void TMastrino::read(const TBill& conto,
if (sec > 0.0)
{
TString80 msg;
msg.format(FR("%ld records at %ld rec/sec"), num_rec, long(num_rec/sec));
msg.format("%ld records at %ld rec/sec", num_rec, long(num_rec/sec));
pi.set_text(msg);
}
}
@ -2778,11 +2483,11 @@ bool TMastrini_video::menu(MENU_TAG mt)
TQuery_mask& qm = *_qm;
const TEsercizi_contabili esercizi;
const int codice_ultimo_esercizio = esercizi.last();
if (codice_ultimo_esercizio > 0)
const int codice_esercizio = esercizi.date2esc(TDate(TODAY));
if (codice_esercizio > 0)
{
const TEsercizio& esercizio = esercizi.esercizio(codice_ultimo_esercizio);
qm.set(F_ESERCIZIO, codice_ultimo_esercizio);
const TEsercizio& esercizio = esercizi.esercizio(codice_esercizio);
qm.set(F_ESERCIZIO, codice_esercizio);
qm.set(F_DADATA, esercizio.inizio());
qm.set(F_ADATA, esercizio.fine());
}
@ -2790,11 +2495,12 @@ bool TMastrini_video::menu(MENU_TAG mt)
KEY key = 0;
while (key != K_QUIT)
{
/* Ca$$ata tipica della Prassi
qm.reset(F_SOTTOCONTO); // Azzera sottoconto
qm.reset(F_CLIENTE); // Azzera cliente
qm.reset(F_FORNITORE); // Azzera fornitore
qm.reset(-5); // Azzera causali
*/
key = qm.run();
switch (key)
{

View File

@ -1,6 +1,6 @@
#include "cg3600.h"
TOOLBAR "" 0 -3 0 3
TOOLBAR "" 0 -2 0 2
BUTTON DLG_OK 10 2
BEGIN

View File

@ -1,6 +1,6 @@
#include "cg3600.h"
TOOLBAR "" 0 -3 0 3
TOOLBAR "" 0 -2 0 2
BUTTON DLG_LINK 10 2
BEGIN
@ -66,7 +66,7 @@ BEGIN
FLAGS "D"
END
SPREADSHEET F_MASTRINI 0 -6
SPREADSHEET F_MASTRINI 0 -5
BEGIN
PROMPT 1 2 "Mastrini"
FLAGS "DM2"

View File

@ -715,7 +715,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
msgdbg.format(FR("Ricalcolo attivita': %ld/%ld"),_cur->pos(),items);
long freespace = xvt_sys_get_free_memory_kb();
msgdbg << TR(" Memoria libera: ") << freespace << TR(" Kbytes.");
xvt_statbar_set(msgdbg);
xvtil_statbar_set(msgdbg);
#endif
do_events();
}

View File

@ -33,7 +33,7 @@ class TApertura_chiusura : public TSkeleton_application
int _annoesch, _annoesap;
long _numreg;
TDate _dataregap, _dataregch, _datacompch, _datacompap;
TString _codcausap, _codcausch;
TString4 _codcausap, _codcausch;
protected:
static bool mask_datac (TMask_field&, KEY);

View File

@ -27,6 +27,5 @@ int main(int argc,char** argv)
default:
cg5000(argc,argv); break; // Parametri Studio
}
exit(0);
return 0;
}

View File

@ -16,6 +16,7 @@
#define FLD_COCAAP 116
#define FLD_NUM_EC 117
#define FLD_LAST_EC 118
#define FLD_DATSAL 119
#define FLD_CSBICHS 217
#define FLD_CSBICHG 218

View File

@ -106,9 +106,16 @@ BEGIN
GROUP GROUP_SALDACONTO
END
DATE FLD_DATSAL
BEGIN
PROMPT 35 13 "Data attivazione saldaconto "
FIELD DatSal
GROUP GROUP_SALDACONTO
END
BOOLEAN CHK_GESVAL
BEGIN
PROMPT 48 13 "Gestione Valuta"
PROMPT 4 14 "Gestione Valuta"
HELP "Indicare se gestire i movimenti prima nota in valuta"
FIELD GesVal
GROUP GROUP_SALDACONTO
@ -116,7 +123,7 @@ END
BOOLEAN CHK_NRCLIDX
BEGIN
PROMPT 4 14 "N. Rif. allineato a destra per clienti"
PROMPT 4 15 "N. Rif. allineato a destra per clienti"
HELP "Indicare se allineare a destra il num. di rif. delle partite nel saldaconto"
FIELD NrCliDx
GROUP GROUP_SALDACONTO
@ -124,21 +131,12 @@ END
BOOLEAN CHK_NRFORDX
BEGIN
PROMPT 48 14 "e per fornitori"
PROMPT 48 15 "e per fornitori"
HELP "Indicare se allineare a destra il num. di rif. delle partite nel saldaconto"
FIELD NrForDx
GROUP GROUP_SALDACONTO
END
BOOLEAN CHK_DTCFPG
BEGIN
PROMPT 4 15 "Dettaglio riga C/F sui pagamenti"
HELP "Indicare se si desidera il dettaglio riga clienti/fornitori in gestione pagamenti"
FIELD DtCfPg
GROUP GROUP_SALDACONTO
FLAGS "H" // Per ora Vladimiro non lo vuole
END
BOOLEAN CHK_RIFPRO
BEGIN
PROMPT 4 16 "Riferimento partita con numero protocollo"
@ -178,6 +176,15 @@ BEGIN
GROUP GROUP_SALDACONTO
END
BOOLEAN CHK_DTCFPG
BEGIN
PROMPT 4 18 "Dettaglio riga C/F sui pagamenti"
HELP "Indicare se si desidera il dettaglio riga clienti/fornitori in gestione pagamenti"
FIELD DtCfPg
GROUP GROUP_SALDACONTO
FLAGS "H" // Per ora Vladimiro non lo vuole
END
ENDPAGE

View File

@ -1,14 +1,9 @@
// Esercizi contabili e registri IVA
#include <currency.h>
#include <diction.h>
#include <mask.h>
#include <prefix.h>
#include <recarray.h>
#include <relation.h>
#include <tabutil.h>
#include <utility.h>
#include <diction.h>
#include <pconti.h>
#include <rmov.h>
@ -886,7 +881,7 @@ int TBill::indicatore_bilancio() const
TString8 str;
str.format("%d|%d", gruppo(), conto());
const int ib = atoi(cache().get(LF_PCON, str, PCN_INDBIL));
if (ib == 0)
if (ib <= 0)
NFCHECK("Impossibile stabilire l'indicatore di bilancio");
return ib;
}