2Patch level : 12.0 958
Files correlati : cg2.exe cg2100c.msk (ba) f25.dir f25.trr Commento : Reverse charge parziale in prima nota
This commit is contained in:
parent
711ce906bc
commit
056feee2f2
@ -49,6 +49,7 @@ public:
|
||||
long _movcoll;
|
||||
TString4 _causale_originale;
|
||||
TipoIVA _iva_originale;
|
||||
TString_array _iva;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -56,15 +57,16 @@ public:
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TPrimanota_application::TPrimanota_application()
|
||||
: _rel(NULL), _mode(0), _iva(nessuna_iva), _causale(NULL), _giornale(NULL),
|
||||
_lastreg(0), _last_dreg(TODAY), _last_dcom(TODAY), _automatico(NULL), _swap_mask(false), _is_set_fpcheck(false), _f1_ini(false), _f1_liq(false)
|
||||
: _rel(nullptr), _mode(0), _iva(nessuna_iva), _causale(nullptr), _giornale(nullptr),
|
||||
_lastreg(0), _last_dreg(TODAY), _last_dcom(TODAY), _automatico(nullptr), _swap_mask(false), _is_set_fpcheck(false), _f1_ini(false), _f1_liq(false),
|
||||
_skip_giornale_check(false), _skip_bollato_check(false)
|
||||
{
|
||||
memset(_msk, 0, sizeof(_msk));
|
||||
}
|
||||
|
||||
TMask* TPrimanota_application::load_mask(int n)
|
||||
{
|
||||
if (_msk[n] != NULL)
|
||||
if (_msk[n] != nullptr)
|
||||
return _msk[n];
|
||||
|
||||
TString8 name = "cg2100"; name << char(n == 3 ? 'o' : 'a'+n);
|
||||
@ -120,29 +122,30 @@ TMask* TPrimanota_application::load_mask(int n)
|
||||
TSheet_field& is = m->sfield(F_SHEETIVA);
|
||||
is.set_notify(iva_notify);
|
||||
TMask& ism = is.sheet_mask();
|
||||
ism.set_handler(101, imponibile_handler);
|
||||
ism.set_handler(102, codiva_handler);
|
||||
ism.set_handler(103, detrazione_handler);
|
||||
ism.set_handler(104, imposta_handler);
|
||||
ism.set_handler(107, cg_gruppo_handler);
|
||||
ism.set_handler(109, iva_sottoconto_handler);
|
||||
ism.set_handler(110, iva_sottoconto_handler);
|
||||
ism.set_handler(209, sheet_clifo_handler);
|
||||
ism.set_handler(309, sheet_clifo_handler);
|
||||
|
||||
ism.set_handler(IVA_IMPONIBILE, imponibile_handler);
|
||||
ism.set_handler(IVA_CODIVA, codiva_handler);
|
||||
ism.set_handler(IVA_INDETRAIBILE, detrazione_handler);
|
||||
ism.set_handler(IVA_IMPOSTA, imposta_handler);
|
||||
ism.set_handler(IVA_GRUPPO, cg_gruppo_handler);
|
||||
ism.set_handler(IVA_SOTTOCONTO, iva_sottoconto_handler);
|
||||
ism.set_handler(IVA_DESCRCONTO, iva_sottoconto_handler);
|
||||
ism.set_handler(IVA_CLIENTE, sheet_clifo_handler);
|
||||
ism.set_handler(IVA_FORNITORE, sheet_clifo_handler);
|
||||
ism.set_handler(CG_RATEO, sheet_rateo_handler);
|
||||
ism.set_handler(CG_RISCONTO, sheet_risconto_handler);
|
||||
if (!has_module(FPAUT))
|
||||
{
|
||||
if (m->find_by_id(F_COLFPPRO) != NULL)
|
||||
if (m->find_by_id(F_COLFPPRO) != nullptr)
|
||||
m->hide(F_COLFPPRO);
|
||||
if (m->find_by_id(DLG_LINK) != NULL)
|
||||
if (m->find_by_id(DLG_LINK) != nullptr)
|
||||
{
|
||||
m->disable(DLG_LINK);
|
||||
m->disable(DLG_EDIT);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (m->find_by_id(DLG_LINK) != NULL)
|
||||
if (m->find_by_id(DLG_LINK) != nullptr)
|
||||
{
|
||||
m->set_handler(DLG_LINK, fppro_mask);
|
||||
m->set_handler(DLG_EDIT, scollega_handler);
|
||||
@ -273,7 +276,7 @@ bool TPrimanota_application::user_create()
|
||||
|
||||
set_search_field(F_NUMREG); // Set field for default search
|
||||
|
||||
_pag = NULL;
|
||||
_pag = nullptr;
|
||||
_is_saldaconto = false;
|
||||
|
||||
TFilename tmp;
|
||||
@ -315,17 +318,13 @@ bool TPrimanota_application::is_transaction() const
|
||||
bool TPrimanota_application::user_destroy()
|
||||
{
|
||||
for (int m = 3; m >= 0; m--)
|
||||
if (_msk[m] != NULL) delete _msk[m];
|
||||
|
||||
if (_pag) delete _pag;
|
||||
|
||||
delete _giornale;
|
||||
delete _causale;
|
||||
delete _rel;
|
||||
|
||||
delete _automatico;
|
||||
|
||||
return true;
|
||||
SAFE_DELETE(_msk[m]);
|
||||
SAFE_DELETE(_pag);
|
||||
SAFE_DELETE(_giornale);
|
||||
SAFE_DELETE(_causale);
|
||||
SAFE_DELETE(_rel);
|
||||
SAFE_DELETE(_automatico);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Legge la causale di codice cod ed il relativo registro dell'anno year
|
||||
@ -334,7 +333,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
if (cod != NULL)
|
||||
if (cod != nullptr)
|
||||
{
|
||||
ok = causale().read(cod, year);
|
||||
_iva = causale().iva();
|
||||
@ -355,7 +354,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
|
||||
}
|
||||
|
||||
// Se sono chiamato dai campi di query ho belle che finito
|
||||
if (_mode == MODE_QUERY || m == NULL)
|
||||
if (_mode == MODE_QUERY || m == nullptr)
|
||||
return true;
|
||||
|
||||
const bool ins = check_insert_mode();
|
||||
@ -366,9 +365,10 @@ 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 = m->sfield(F_SHEETCG);
|
||||
TSheet_field& cgsheet = cgs();
|
||||
TMask& cgm = cgsheet.sheet_mask();
|
||||
cgm.set_handler(DLG_USER, show_games ? showpartite_handler : NULL); // bottoncino riga
|
||||
|
||||
cgm.set_handler(DLG_USER, show_games ? showpartite_handler : nullptr); // bottoncino riga
|
||||
cgm.enable(DLG_USER, show_games);
|
||||
if (iva == nessuna_iva)
|
||||
{
|
||||
@ -394,12 +394,15 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
|
||||
|
||||
TRegistro& r = c.reg();
|
||||
const bool reg_vendite = r.iva() == iva_vendite && !r.corrispettivi();
|
||||
const bool show_notevar = iva == iva_vendite || iva == iva_acquisti;
|
||||
TSheet_field& ivasheet = m->sfield(F_SHEETIVA);
|
||||
const bool show_notevar = iva == iva_vendite || iva == iva_acquisti;
|
||||
const bool show_active_revcharge = iva == iva_acquisti && causale().reverse_charge_pubb();
|
||||
TSheet_field& ivasheet = m->sfield(F_SHEETIVA);
|
||||
|
||||
ivasheet.enable_column(IVA_NOTAVARECF, show_notevar);
|
||||
ivasheet.sheet_mask().enable(IVA_NOTAVARECF, show_notevar);
|
||||
}
|
||||
ivasheet.enable_column(IVA_REVCHARGE, show_active_revcharge);
|
||||
ivasheet.sheet_mask().enable(IVA_REVCHARGE, show_active_revcharge);
|
||||
}
|
||||
|
||||
if (ins && !ci_sono_importi(cgsheet))
|
||||
{
|
||||
@ -407,7 +410,8 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
|
||||
for (int i = 1; i < causale().size(); i++)
|
||||
{
|
||||
const TRectype* rcaus = (TRectype*)causale().objptr(i);
|
||||
if (rcaus == NULL) continue; // Evita eventuali righe nulle
|
||||
|
||||
if (rcaus == nullptr) continue; // Evita eventuali righe nulle
|
||||
|
||||
const int nriga = rcaus->get_int(RCA_NRIGA);
|
||||
if (nriga <= 0) continue; // Considera solo righe reali (non riempimenti)
|
||||
@ -593,7 +597,7 @@ void TPrimanota_application::on_config_change()
|
||||
TConfig cnf(CONFIG_DITTA, "cg");
|
||||
_ges_val = cnf.get_bool("GesVal");
|
||||
_ges_sal = cnf.get_bool("GesSal");
|
||||
_easy_sal = _ges_sal && cnf.get_bool("EasySal", NULL, -1, false) && xvt_vobj_get_attr(NULL_WIN, ATTR_APPL_VERSION_YEAR) > 2101;
|
||||
_easy_sal = _ges_sal && cnf.get_bool("EasySal", nullptr, -1, false) && xvt_vobj_get_attr(NULL_WIN, ATTR_APPL_VERSION_YEAR) > 2101;
|
||||
|
||||
_npart_is_prot = cnf.get_bool("RifPro");
|
||||
_npart_is_month = cnf.get_bool("RifMonth");
|
||||
@ -614,7 +618,7 @@ void TPrimanota_application::init_mask(TMask& m)
|
||||
disable_menu_item(M_FILE_PRINT);
|
||||
disable_menu_item(M_FONT);
|
||||
|
||||
read_caus(NULL, 0); // Setta campi obbligatori
|
||||
read_caus(nullptr, 0); // Setta campi obbligatori
|
||||
|
||||
if (_iva == nessuna_iva)
|
||||
{
|
||||
@ -657,7 +661,8 @@ void TPrimanota_application::init_mask(TMask& m)
|
||||
if (is_fattura())
|
||||
{
|
||||
const TPartita* game = partite().first();
|
||||
_scad_free = game == NULL || !game->esistono_abbuoni_diffcam(m.get_long(F_NUMREG));
|
||||
|
||||
_scad_free = game == nullptr || !game->esistono_abbuoni_diffcam(m.get_long(F_NUMREG));
|
||||
if (m.edit_mode() && !_scad_free)
|
||||
m.enable(DLG_DELREC, _scad_free); // Disabilita tasto elimina
|
||||
m.enable(-1, _scad_free); // Disabilita cliente
|
||||
@ -675,30 +680,21 @@ void TPrimanota_application::init_mask(TMask& m)
|
||||
|
||||
m.show(F_ADJUST_IVA, _quadratura);
|
||||
|
||||
TMask_field* ixc = m.find_by_id(F_IVAXCASSA);
|
||||
if (ixc)
|
||||
{
|
||||
const TDate dr = m.get(F_DATAREG);
|
||||
ixc->show(gestione_IVAxCassa(dr));
|
||||
}
|
||||
const TDate dr = m.get(F_DATAREG);
|
||||
|
||||
TEdit_field& rc = m.efield(F_REVCHARGE);
|
||||
rc.show(cc.iva() == iva_acquisti && cc.reverse_charge_pubb());
|
||||
|
||||
m.efield(F_MOVCOLL).show((cc.iva() == iva_acquisti && cc.reverse_charge_pubb()) ||
|
||||
(cc.iva() == iva_vendite && cc.causale_reg_iva()));
|
||||
// m.efield(F_GOCOLL).show((c.iva() == iva_acquisti && c.reverse_charge()) ||
|
||||
// (c.iva() == iva_vendite && c.causale_reg_iva()));
|
||||
m.show(F_IVAXCASSA, gestione_IVAxCassa(dr));
|
||||
m.show(F_REVCHARGE, cc.iva() == iva_acquisti && cc.reverse_charge_pubb());
|
||||
m.show(F_MOVCOLL, (cc.iva() == iva_acquisti && cc.reverse_charge_pubb()) ||
|
||||
(cc.iva() == iva_vendite && cc.causale_reg_iva()));
|
||||
activate_split_payment(m);
|
||||
}
|
||||
|
||||
// Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_DATACAMBIO (GROUP 3)
|
||||
const bool valuta = _ges_val && is_saldaconto() && causale().valuta();
|
||||
|
||||
m.show(-3, valuta);
|
||||
_sal_dirty = false; // Azzero il flag di modifica del saldaconto
|
||||
|
||||
fill_sheet(m); // Riempe righe contabili coi conti della causale
|
||||
|
||||
m.hide(F_LINKDOC);
|
||||
set_has_f1_db(&m);
|
||||
}
|
||||
@ -881,15 +877,16 @@ bool TPrimanota_application::get_next_key(TToken_string& tmp)
|
||||
|
||||
void TPrimanota_application::init_insert_mode(TMask& m)
|
||||
{
|
||||
init_mask(m);
|
||||
init_mask(m);
|
||||
m.first_focus(_firstfocus);
|
||||
|
||||
if (causale().reg().agenzia_viaggi())
|
||||
m.set(F_DATA74TER, m.get(F_DATAREG));
|
||||
|
||||
if (iva() != nessuna_iva)
|
||||
|
||||
if (iva() != nessuna_iva)
|
||||
{
|
||||
occas_mask().reset();
|
||||
occas_mask().reset();
|
||||
m.hide(F_OCCASEDIT);
|
||||
|
||||
const TString & tipo = clifo();
|
||||
@ -927,19 +924,21 @@ void TPrimanota_application::init_insert_mode(TMask& m)
|
||||
if (is_fattura())
|
||||
{
|
||||
activate_numrif(m, false);
|
||||
|
||||
const TString& dt = m.get(F_DATADOC);
|
||||
set_pagamento(NULL,dt);
|
||||
|
||||
set_pagamento(nullptr, dt);
|
||||
set_scadenze(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_pagamento(NULL,NULL); // Annulla gestione rate
|
||||
set_pagamento(nullptr, nullptr); // Annulla gestione rate
|
||||
}
|
||||
|
||||
_saldi.reset(); // Inizializza saldi
|
||||
|
||||
if (_automatico->_step == 1)
|
||||
genera_automatico(_automatico->_tipo, NULL);
|
||||
genera_automatico(_automatico->_tipo, nullptr);
|
||||
else
|
||||
{
|
||||
m.reset(F_DATACOMP); // Azzera quasi sempre la data di competenza
|
||||
@ -990,7 +989,7 @@ void TPrimanota_application::init_insert_mode(TMask& m)
|
||||
m.set(F_PROTIVA, protiva, true); // Aggiorna protocollo IVA
|
||||
}
|
||||
// Controllo se abilitare il fornitore per bolla doganale
|
||||
if(m.find_by_id(F_BOLLACODCLI) != NULL)
|
||||
if(m.find_by_id(F_BOLLACODCLI) != nullptr)
|
||||
{
|
||||
m.enable(F_BOLLACODCLI, causale().tipo_doc() == "BD");
|
||||
m.enable(F_BOLLARAGCLI, causale().tipo_doc() == "BD");
|
||||
@ -1000,13 +999,15 @@ void TPrimanota_application::init_insert_mode(TMask& m)
|
||||
void TPrimanota_application::f1_init_modify(TMask& m, const TRectype& mov)
|
||||
{
|
||||
const bool after_data_inizio_fe = TDate(mov.get(MOV_DATADOC)) >= TDate(fp_settings().get_data_start_fatt());
|
||||
if (m.find_by_id(F_COLFPPRO) != NULL && after_data_inizio_fe)
|
||||
|
||||
if (m.find_by_id(F_COLFPPRO) != nullptr && after_data_inizio_fe)
|
||||
m.set(F_COLFPPRO, mov.get(MOV_KEYFPPRO).empty() ? " " : "X");
|
||||
else if(m.find_by_id(F_COLFPPRO) != NULL && !after_data_inizio_fe)
|
||||
{
|
||||
m.field(F_COLFPPRO).hide();
|
||||
m.field(DLG_LINK).disable();
|
||||
}
|
||||
else
|
||||
if(m.find_by_id(F_COLFPPRO) != nullptr && !after_data_inizio_fe)
|
||||
{
|
||||
m.field(F_COLFPPRO).hide();
|
||||
m.field(DLG_LINK).disable();
|
||||
}
|
||||
}
|
||||
|
||||
void TPrimanota_application::init_modify_mode(TMask& m)
|
||||
@ -1051,40 +1052,40 @@ void TPrimanota_application::init_modify_mode(TMask& m)
|
||||
m.field(F_RITFIS).set_prompt("IVA intracomun. ");
|
||||
else
|
||||
m.field(F_RITFIS).set_prompt("Ritenute fiscali ");
|
||||
#ifdef PRORATA100
|
||||
// Non controllare il prorata durante la cancellazione automatica
|
||||
if (autodeleting() != 0x3)
|
||||
{
|
||||
if (!test_prorata()) // Controlla prorata
|
||||
{
|
||||
m.show(F_ADJUST_PRORATA);
|
||||
m.set_handler(F_ADJUST_PRORATA, prorata_handler);
|
||||
|
||||
warning_box(TR("Questo movimento è stato registrato con una percentuale\n"
|
||||
"prorata non compatibile con quella corrente:\n"
|
||||
"Premere il bottone di correzione automatica delle righe."));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nascondi il bottone del prorata se esiste
|
||||
if (m.id2pos(F_ADJUST_PRORATA) >= 0)
|
||||
{
|
||||
m.set_handler(F_ADJUST_PRORATA, nullptr);
|
||||
m.hide(F_ADJUST_PRORATA);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (_as400 && is_pagamento())
|
||||
{
|
||||
m.set(SK_TIPORIGA, "A"); // Forza il tipo riga normale
|
||||
m.disable(SK_TIPORIGA); // Disabilita la sua modifica
|
||||
}
|
||||
|
||||
#ifdef PRORATA100
|
||||
// Non controllare il prorata durante la cancellazione automatica
|
||||
if (autodeleting() != 0x3)
|
||||
{
|
||||
if (!test_prorata()) // Controlla prorata
|
||||
{
|
||||
m.show(F_ADJUST_PRORATA);
|
||||
m.set_handler(F_ADJUST_PRORATA, prorata_handler);
|
||||
|
||||
warning_box(TR("Questo movimento è stato registrato con una percentuale\n"
|
||||
"prorata non compatibile con quella corrente:\n"
|
||||
"Premere il bottone di correzione automatica delle righe."));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nascondi il bottone del prorata se esiste
|
||||
if (m.id2pos(F_ADJUST_PRORATA) >= 0)
|
||||
{
|
||||
m.set_handler(F_ADJUST_PRORATA, NULL);
|
||||
m.hide(F_ADJUST_PRORATA);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
const TRectype& mov = get_relation()->curr();
|
||||
if (!mov.empty())
|
||||
|
||||
if (!mov.empty())
|
||||
{
|
||||
if (navigating())
|
||||
{
|
||||
@ -1109,7 +1110,7 @@ void TPrimanota_application::init_modify_mode(TMask& m)
|
||||
activate_split_payment(m);
|
||||
}
|
||||
// Controllo se abilitare il fornitore per bolla doganale
|
||||
if(m.find_by_id(F_BOLLACODCLI) != NULL)
|
||||
if(m.find_by_id(F_BOLLACODCLI) != nullptr)
|
||||
{
|
||||
m.enable(F_BOLLACODCLI, causale().tipo_doc() == "BD");
|
||||
m.enable(F_BOLLARAGCLI, causale().tipo_doc() == "BD");
|
||||
@ -1133,9 +1134,10 @@ void TPrimanota_application::add_cup_or_cig(short id, const TRectype& rec, TToke
|
||||
const TString& cod = rec.get(cup ? RMV_CUP : RMV_CIG);
|
||||
if (cod.full())
|
||||
{
|
||||
riga.add(cod, id-FIRST_FIELD); // Tipo di riga 115 o 117
|
||||
const TString& desc = cache().get(cup ? "%CUP" : "%CIG", cod, "S0");
|
||||
riga.add(desc, (cup ? CG_DCUP : CG_DCIG) - FIRST_FIELD);
|
||||
const TString& desc = cache().get(cup ? "%CUP" : "%CIG", cod, "S0");
|
||||
|
||||
riga.add(cod, cid2index(id)); // Tipo di riga 115 o 117
|
||||
riga.add(desc, cid2index(cup ? CG_DCUP : CG_DCIG));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1145,9 +1147,10 @@ void TPrimanota_application::add_cup_or_cig(short id, TConfig& ini, TToken_strin
|
||||
const TString& cod = ini.get(cup ? RMV_CUP : RMV_CIG);
|
||||
if (cod.full())
|
||||
{
|
||||
riga.add(cod, id-FIRST_FIELD); // Tipo di riga 115 o 117
|
||||
const TString& desc = cache().get(cup ? "%CUP" : "%CIG", cod, "S0");
|
||||
riga.add(desc, (cup ? CG_DCUP : CG_DCIG) - FIRST_FIELD);
|
||||
const TString& desc = cache().get(cup ? "%CUP" : "%CIG", cod, "S0");
|
||||
|
||||
riga.add(cod, cid2index(id)); // Tipo di riga 115 o 117
|
||||
riga.add(desc, cid2index(cup ? CG_DCUP : CG_DCIG));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1208,7 +1211,7 @@ int TPrimanota_application::read(TMask& m)
|
||||
add_cup_or_cig(CG_CIG, r, riga); // CIG 117-118
|
||||
|
||||
const char tipo = r.get_char(RMV_ROWTYPE);
|
||||
riga.add(tipo, CG_ROWTYPE-FIRST_FIELD); // Tipo di riga 119
|
||||
riga.add(tipo, cid2index(CG_ROWTYPE)); // Tipo di riga 119
|
||||
|
||||
disable_cgs_cells(i, tipo);
|
||||
//cgs().check_row(i); // Fare le decodifche a mano: NON USARE!
|
||||
@ -1220,7 +1223,7 @@ int TPrimanota_application::read(TMask& m)
|
||||
if (!read_scadenze(m)) // Se non esiste fattura
|
||||
{
|
||||
const TString& dd = m.get(F_DATADOC);
|
||||
set_pagamento(NULL, dd); // Ignora codice pagamento in testata
|
||||
set_pagamento(nullptr, dd); // Ignora codice pagamento in testata
|
||||
}
|
||||
}
|
||||
|
||||
@ -1241,7 +1244,8 @@ int TPrimanota_application::read(TMask& m)
|
||||
}
|
||||
|
||||
const bool to_swap = test_swap(false);
|
||||
if (to_swap)
|
||||
|
||||
if (to_swap)
|
||||
{
|
||||
real totdoc(m.get(F_TOTALE));
|
||||
totdoc = -totdoc;
|
||||
@ -1271,19 +1275,21 @@ int TPrimanota_application::read(TMask& m)
|
||||
TBill c; c.get(r);
|
||||
c.add_to(riga, 4, 0x7); // Conto 105-110
|
||||
riga.add(r.get(RMI_NAVP), cid2index(IVA_NOTAVARECF));
|
||||
riga.add(r.get(RMI_REVCHARGE), cid2index(IVA_REVCHARGE));
|
||||
}
|
||||
|
||||
calcola_imp(); // Calcola totale imponibile ed imposte
|
||||
|
||||
if (is_fattura()) // Ci dovrebbero essere delle scadenze
|
||||
ivas().update_original_rows();
|
||||
if (is_fattura()) // Ci dovrebbero essere delle scadenze
|
||||
{
|
||||
pags().reset(); // Azzera sheet rate
|
||||
if (!read_scadenze(m)) // Se non esiste fattura
|
||||
{
|
||||
const TString& dd = m.get(F_DATADOC);
|
||||
set_pagamento(NULL, dd); // Ignora codice pagamento in testata
|
||||
|
||||
set_pagamento(nullptr, dd); // Ignora codice pagamento in testata
|
||||
}
|
||||
}
|
||||
|
||||
return _rel->status();
|
||||
}
|
||||
|
||||
@ -1355,10 +1361,10 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
||||
r.put(RMV_CONTOC, row.get());
|
||||
r.put(RMV_SOTTOCONTOC, row.get());
|
||||
|
||||
r.put(RMV_CUP, row.get(CG_CUP-FIRST_FIELD)); // CUP
|
||||
r.put(RMV_CIG, row.get(CG_CIG-FIRST_FIELD)); // CIG
|
||||
r.put(RMV_CUP, row.get(cid2index(CG_CUP))); // CUP
|
||||
r.put(RMV_CIG, row.get(cid2index(CG_CIG))); // CIG
|
||||
|
||||
r.put(RMV_ROWTYPE, row.get(CG_ROWTYPE-FIRST_FIELD)); // Tipo riga
|
||||
r.put(RMV_ROWTYPE, row.get(cid2index(CG_ROWTYPE))); // Tipo riga
|
||||
}
|
||||
}
|
||||
|
||||
@ -1434,25 +1440,26 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
||||
r.put(RMI_ANNOES, annoes); // Anno d'esercizio della testata (che ca$$ata!)
|
||||
r.put(RMI_INTRA, intra); // Causale intra (che ca$$ata!)
|
||||
|
||||
real imponibile(row.get(0));
|
||||
real imponibile(row.get(cid2index(IVA_IMPONIBILE)));
|
||||
if (to_swap) imponibile = -imponibile;
|
||||
r.put(RMI_IMPONIBILE, imponibile);
|
||||
|
||||
r.put(RMI_CODIVA, row.get());
|
||||
r.put(RMI_TIPODET, row.get());
|
||||
r.put(RMI_CODIVA, row.get(cid2index(IVA_CODIVA)));
|
||||
r.put(RMI_TIPODET, row.get(cid2index(IVA_INDETRAIBILE)));
|
||||
|
||||
real imposta(row.get());
|
||||
real imposta(row.get(cid2index(IVA_IMPOSTA)));
|
||||
if (to_swap) imposta = -imposta;
|
||||
r.put(RMI_IMPOSTA, imposta);
|
||||
|
||||
r.put(RMI_TIPOCR, row.get());
|
||||
r.put(RMI_TIPOCR, row.get(cid2index(IVA_TIPOCOSTORIC)));
|
||||
|
||||
// Roba obsoleta allo stato brado
|
||||
const TBill c(row, 6);
|
||||
const TBill c(row, cid2index(IVA_TIPO), 0x1);
|
||||
const int rimp = bill2pos(c, 'I')+1;
|
||||
r.put(RMI_RIGAIMP, rimp);
|
||||
c.put(r);
|
||||
r.put(RMI_NAVP, row.get(10));
|
||||
r.put(RMI_NAVP, row.get(cid2index(IVA_NOTAVARECF)));
|
||||
r.put(RMI_REVCHARGE, row.get(cid2index(IVA_REVCHARGE)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1479,13 +1486,13 @@ void TPrimanota_application::check_saldi()
|
||||
|
||||
void TPrimanota_application::write_fppro()
|
||||
{
|
||||
// Controllo se la registrazione ha avuto effetto anche su FPPRO allora salvo riferimento sul mov
|
||||
if (save_fppro() > 0 && !save_dbmov())
|
||||
message_box(
|
||||
TString("ATTENZIONE:") <<
|
||||
" non è stato possibile salvare i riferimenti del documento in ingresso per questo movimento.\n" <<
|
||||
"Movimento registrato senza collegamento ai documenti in ingresso.");
|
||||
}
|
||||
// Controllo se la registrazione ha avuto effetto anche su FPPRO allora salvo riferimento sul mov
|
||||
if (save_fppro() > 0 && !save_dbmov())
|
||||
message_box(
|
||||
TString("ATTENZIONE:") <<
|
||||
" non è stato possibile salvare i riferimenti del documento in ingresso per questo movimento.\n" <<
|
||||
"Movimento registrato senza collegamento ai documenti in ingresso.");
|
||||
}
|
||||
|
||||
bool TPrimanota_application::has_tot_doc(TToken_string& fppro_keys)
|
||||
{
|
||||
@ -1539,27 +1546,28 @@ void TPrimanota_application::set_movcoll(const long movcoll, const long numreg)
|
||||
const int err = mov.rewrite(TLocalisamfile(LF_MOV));
|
||||
}
|
||||
}
|
||||
int TPrimanota_application::controlli_f1(const TMask& m){
|
||||
if (m.find_by_id(F_PROKEY) != NULL && m.get(F_PROKEY).full() && has_f1_db((TMask*)&m) && fp_db().sq_is_connect() && check_causale(m.get(F_CODCAUS)))
|
||||
{
|
||||
TToken_string keys(m.get(F_PROKEY), ';');
|
||||
const TDate dataoraric = fppro_db().set_keys(keys).get_dataorarioric();
|
||||
// Devo controllare che la data operazione sia maggiore della data ric
|
||||
const TDate data_operazione(m.get(F_DATAREG));
|
||||
if (data_operazione < dataoraric)
|
||||
return pro_dataric_err;
|
||||
const int numreg = fppro_db().set_keys(keys).get_numregcont();
|
||||
if (numreg != 0 && numreg != m.get_int(F_NUMREG))
|
||||
int TPrimanota_application::controlli_f1(const TMask& m)
|
||||
{
|
||||
if (m.find_by_id(F_PROKEY) != nullptr && m.get(F_PROKEY).full() && has_f1_db((TMask*)&m) && fp_db().sq_is_connect() && check_causale(m.get(F_CODCAUS)))
|
||||
{
|
||||
const TDate data_documento(m.get(F_DATADOC));
|
||||
TString msg; msg << "Attenzione il documento " << data_documento.year() << " / " << m.get(F_NUMDOCEXT) <<
|
||||
" appena registrato e' gia' stato inserito con la registrazione numero " << numreg <<
|
||||
"\nSe si vuole registrare questo documento elettronico, scollegarlo prima dalla precedente registrazione.";
|
||||
error_box(msg);
|
||||
return pro_numreg_err;
|
||||
TToken_string keys(m.get(F_PROKEY), ';');
|
||||
const TDate dataoraric = fppro_db().set_keys(keys).get_dataorarioric();
|
||||
// Devo controllare che la data operazione sia maggiore della data ric
|
||||
const TDate data_operazione(m.get(F_DATAREG));
|
||||
if (data_operazione < dataoraric)
|
||||
return pro_dataric_err;
|
||||
const int numreg = fppro_db().set_keys(keys).get_numregcont();
|
||||
if (numreg != 0 && numreg != m.get_int(F_NUMREG))
|
||||
{
|
||||
const TDate data_documento(m.get(F_DATADOC));
|
||||
TString msg; msg << "Attenzione il documento " << data_documento.year() << " / " << m.get(F_NUMDOCEXT) <<
|
||||
" appena registrato e' gia' stato inserito con la registrazione numero " << numreg <<
|
||||
"\nSe si vuole registrare questo documento elettronico, scollegarlo prima dalla precedente registrazione.";
|
||||
error_box(msg);
|
||||
return pro_numreg_err;
|
||||
}
|
||||
}
|
||||
}
|
||||
//app().curr_mask().set(FS_RECALC, "");
|
||||
//app().curr_mask().set(FS_RECALC, "");
|
||||
return pro_noerr;
|
||||
}
|
||||
|
||||
@ -1775,7 +1783,7 @@ void TPrimanota_application::clean_fppro()
|
||||
|
||||
void TPrimanota_application::set_has_f1_db(TMask* m)
|
||||
{
|
||||
if (m->find_by_id(F_DATAREG) != NULL && !m->get(F_DATAREG).empty())
|
||||
if (m->find_by_id(F_DATAREG) != nullptr && !m->get(F_DATAREG).empty())
|
||||
{
|
||||
if (TDate(m->get(F_DATAREG)) >= TDate(fp_settings().get_data_start_fatt()))
|
||||
_isf1 = has_module(F1AUT) && !fp_settings().get_db_indirizzo().empty();
|
||||
@ -1856,11 +1864,26 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
|
||||
// Solo regolarizzazioni IVA
|
||||
if (_automatico->_tipo == 2)
|
||||
{
|
||||
_automatico->_totale += m.get_real(F_REVCHARGE) + m.get_real(F_RITFIS);
|
||||
TSheet_field & iva = app().ivas();
|
||||
const int items = iva.items();
|
||||
|
||||
_automatico->_movcoll = m.get_long(F_NUMREG);
|
||||
_automatico->_codiva = m.get(F_CODIVA);
|
||||
if (_automatico->_codiva.blank() && _rel->iva_items() > 0)
|
||||
_automatico->_codiva = _rel->iva(0).get(RMI_CODIVA);
|
||||
_automatico->_iva.destroy();
|
||||
_automatico->_totale = ZERO;
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
TToken_string row = iva.row(i);
|
||||
|
||||
if (row.get_bool(cid2index(IVA_REVCHARGE)))
|
||||
{
|
||||
const real imponibile = row.get(cid2index(IVA_IMPONIBILE));
|
||||
const real imposta = row.get(cid2index(IVA_IMPOSTA));
|
||||
|
||||
row.add("", cid2index(IVA_REVCHARGE));
|
||||
_automatico->_totale += imponibile+imposta;
|
||||
_automatico->_iva.add(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (_automatico->_tipo == 4)
|
||||
@ -1934,9 +1957,18 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
|
||||
const TString& clnt = cache().get(LF_CLIFO, forn, CLI_CODCFASS);
|
||||
m.set(F_CODCLIFOR, clnt);
|
||||
}
|
||||
TSheet_field & iva = m.sfield(F_SHEETIVA);
|
||||
const int items = _automatico->_iva.items();
|
||||
|
||||
m.set(F_TOTALE, _automatico->_totale); // Imposta il totale documento e ...
|
||||
m.set(F_MOVCOLL, _automatico->_movcoll); // Imposta il movimenti collegato e ...
|
||||
m.set(F_CODIVA, _automatico->_codiva, true); // ... scatena creazione prima riga IVA
|
||||
m.set(F_MOVCOLL, _automatico->_movcoll); // Imposta il movimenti collegato comp_han le righe iva
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
TToken_string & original_row = _automatico->_iva.row(i);
|
||||
TToken_string & row = iva.row(i);
|
||||
|
||||
row = original_row;
|
||||
}
|
||||
if (TRelation_application::is_transaction())
|
||||
m.send_key(K_CTRL+'R', 0);
|
||||
|
||||
@ -1948,9 +1980,11 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
|
||||
m.set(F_DATACOMP, _automatico->_datadoc);
|
||||
TBill conto; caus.bill(1, conto);
|
||||
TBill contro; caus.bill(2, contro);
|
||||
cgs().reset();
|
||||
cgs().reset();
|
||||
|
||||
TToken_string& row1 = cgs().row(0);
|
||||
TImporto imp(caus.sezione_clifo(), _automatico->_totale);
|
||||
|
||||
imp.add_to(row1, 0);
|
||||
row1.add(conto.string(0x3));
|
||||
row1.add(" ");
|
||||
@ -1958,6 +1992,7 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
|
||||
row1.add(contro.string(0x3));
|
||||
|
||||
TToken_string& row2 = cgs().row(1);
|
||||
|
||||
imp.swap_section();
|
||||
imp.add_to(row2, 0);
|
||||
row2.add(contro.string(0x3));
|
||||
@ -2277,13 +2312,14 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
||||
// Genera eventuali righe per ritenute fiscali e sociali
|
||||
const short frit[4] = { F_RITFIS, F_RITSOC, F_REVCHARGE, 0 };
|
||||
const char trit[4] = { 'F', 'S', 'V', '\0' };
|
||||
|
||||
|
||||
for (int i = 0; frit[i]; i++)
|
||||
{
|
||||
TEdit_field& ritfld = msk.efield(frit[i]);
|
||||
if (!ritfld.empty() && ritfld.active())
|
||||
add_cgs_ritenute(trit[i]);
|
||||
}
|
||||
|
||||
calcola_imp(); // Calcola totale imponibile ed imposte
|
||||
}
|
||||
|
||||
@ -2302,7 +2338,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
||||
{
|
||||
numrig = -1; // Normalmente aggiungi la riga in fondo
|
||||
// Cerca una riga che abbia già il tipo ed il conto richiesto
|
||||
if (strchr(" DINT", tipo) != NULL)
|
||||
if (strchr(" DINT", tipo) != nullptr)
|
||||
{
|
||||
int nr = -1;
|
||||
if (tipo == 'I' || tipo == ' ')
|
||||
@ -2408,7 +2444,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
||||
pagamento().set_sheet(pag);
|
||||
}
|
||||
}
|
||||
if (_f1_ini && msk.find_by_id(FS_RECALC) != NULL)
|
||||
if (_f1_ini && msk.find_by_id(FS_RECALC) != nullptr)
|
||||
{
|
||||
msk.set(F_COLFPPRO, "X");
|
||||
if (scad_from_ini)
|
||||
@ -2417,10 +2453,11 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
||||
set_scad_f1(msk);
|
||||
}
|
||||
}
|
||||
if (_f1_liq && msk.find_by_id(F_DIFFERITA) != NULL)
|
||||
if (_f1_liq && msk.find_by_id(F_DIFFERITA) != nullptr)
|
||||
{
|
||||
TDate datadoc(msk.get(F_DATADOC)); datadoc.set_day(1);
|
||||
TDate datareg(msk.get(F_DATAREG)); datareg.set_day(1);
|
||||
|
||||
if(datadoc < datareg && (double)datadoc.year() == real(msk.get(F_ANNOIVA)))
|
||||
msk.set(F_DIFFERITA, "X");
|
||||
}
|
||||
@ -2571,7 +2608,8 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini)
|
||||
else
|
||||
{
|
||||
int pref = 1;
|
||||
for (TPartita* game = p.first(); game != NULL; game = p.next())
|
||||
|
||||
for (TPartita* game = p.first(); game != nullptr; game = p.next())
|
||||
{
|
||||
const int lastrow = game->last();
|
||||
|
||||
@ -2814,7 +2852,7 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action)
|
||||
if (n > last_rett)
|
||||
last_rett = n;
|
||||
if (curr.get_long("NUMREG") == m.get_long(F_NUMREG))
|
||||
return curr.edit(0, NULL, "in0 -6");
|
||||
return curr.edit(0, nullptr, "in0 -6");
|
||||
}
|
||||
|
||||
intro.set("Action", "Insert");
|
||||
@ -2919,7 +2957,7 @@ bool TPrimanota_application::link_anal(const TMask& msk, const char* action)
|
||||
|
||||
// Cerco se c'e' almeno un conto interessato all'analitica
|
||||
bool bAnalBill = false;
|
||||
TSheet_field& sheet = msk.sfield(F_SHEETCG);
|
||||
TSheet_field& sheet = cgs();
|
||||
FOR_EACH_SHEET_ROW(sheet, i, row)
|
||||
{
|
||||
const TBill bill(*row, 3, 0x0);
|
||||
|
@ -122,9 +122,15 @@
|
||||
#define IVA_GRUPPO 107
|
||||
#define IVA_CONTO 108
|
||||
#define IVA_SOTTOCONTO 109
|
||||
#define IVA_CLIENTE 209
|
||||
#define IVA_FORNITORE 309
|
||||
#define IVA_DESCRCONTO 110
|
||||
#define IVA_DESCRCONTOC 210
|
||||
#define IVA_DESCRCONTOF 310
|
||||
#define IVA_PERCIVA 111
|
||||
#define IVA_NATURIVA 112
|
||||
#define IVA_NOTAVARECF 113
|
||||
#define IVA_REVCHARGE 114
|
||||
|
||||
// Campi ripetuti sulla seconda pagina
|
||||
#define H_DATAREG 201
|
||||
|
@ -554,13 +554,6 @@ BEGIN
|
||||
FLAGS "U#"
|
||||
END
|
||||
|
||||
DATE F_DATAINC
|
||||
BEGIN
|
||||
PROMPT 52 19 "Data incasso "
|
||||
WARNING "Data di incasso per liquidazione differita"
|
||||
FIELD DATAINC
|
||||
END
|
||||
|
||||
BOOLEAN F_COLFPPRO
|
||||
BEGIN
|
||||
PROMPT 1 19 "Registrazione collegata a FPPRO"
|
||||
@ -571,8 +564,8 @@ STRING F_PROKEY 80
|
||||
BEGIN
|
||||
PROMPT 1 19 "db key"
|
||||
HELP "Chiave database"
|
||||
FIELD KEYFPPRO
|
||||
FLAGS "H"
|
||||
FIELD KEYFPPRO
|
||||
FLAGS "H"
|
||||
END
|
||||
|
||||
BOOLEAN F_IVAXCASSA
|
||||
@ -582,7 +575,6 @@ BEGIN
|
||||
MODULE IC
|
||||
END
|
||||
|
||||
|
||||
BOOLEAN F_LIQDIFF
|
||||
BEGIN
|
||||
PROMPT 25 20 "Liquidazione differita"
|
||||
@ -593,9 +585,16 @@ BEGIN
|
||||
FLAGS "HG"
|
||||
END
|
||||
|
||||
DATE F_DATAINC
|
||||
BEGIN
|
||||
PROMPT 52 20 "Data incasso "
|
||||
WARNING "Data di incasso per liquidazione differita"
|
||||
FIELD DATAINC
|
||||
END
|
||||
|
||||
LIST F_SPLITPAY 1 2
|
||||
BEGIN
|
||||
PROMPT 51 20 "Scissione pagamenti "
|
||||
PROMPT 51 21 "Scissione pagamenti "
|
||||
FIELD SPLITPAY
|
||||
ITEM "| "
|
||||
ITEM "S|Si"
|
||||
@ -604,7 +603,7 @@ END
|
||||
|
||||
STRING F_VALUTAINTRA 3
|
||||
BEGIN
|
||||
PROMPT 1 21 "Cambio intracom. "
|
||||
PROMPT 1 22 "Cambio intracom. "
|
||||
FIELD CODVALI
|
||||
FLAGS "UZ"
|
||||
GROUP 4
|
||||
@ -631,20 +630,20 @@ END
|
||||
|
||||
DATE F_DATAINTRA
|
||||
BEGIN
|
||||
PROMPT 43 21 "Data competenza intra "
|
||||
PROMPT 43 22 "Data competenza intra "
|
||||
FIELD DATACOMPI
|
||||
END
|
||||
|
||||
CURRENCY F_CORRISPETTIVO 18
|
||||
BEGIN
|
||||
PROMPT 1 22 "Corrispettivo "
|
||||
PROMPT 1 23 "Corrispettivo "
|
||||
FIELD CORRLIRE
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
CURRENCY F_CORRVALUTA 18
|
||||
BEGIN
|
||||
PROMPT 39 22 "Corrispet. valuta "
|
||||
PROMPT 39 23 "Corrispet. valuta "
|
||||
FIELD CORRVALUTA
|
||||
GROUP 4
|
||||
VALIDATE REQIF_FUNC 1 F_VALUTAINTRA
|
||||
@ -653,20 +652,13 @@ END
|
||||
|
||||
BOOLEAN F_RITFATT
|
||||
BEGIN
|
||||
PROMPT 1 23 "Fattura in ritardo "
|
||||
PROMPT 1 24 "Fattura in ritardo "
|
||||
FIELD RITFATT
|
||||
END
|
||||
|
||||
#ifdef PRORATA100
|
||||
BUTTON F_ADJUST_PRORATA 40
|
||||
BEGIN
|
||||
PROMPT 1 -1 "Corre~zione automatica righe contabili"
|
||||
FLAGS "H"
|
||||
END
|
||||
#endif
|
||||
STRING NP_CONTSEP 6
|
||||
BEGIN
|
||||
PROMPT 1 23 "Cont. separata "
|
||||
PROMPT 1 24 "Cont. separata "
|
||||
USE &NPENT
|
||||
INPUT CODTAB NP_CONTSEP
|
||||
DISPLAY "Codice@6" CODTAB
|
||||
@ -688,6 +680,14 @@ BEGIN
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
#ifdef PRORATA100
|
||||
BUTTON F_ADJUST_PRORATA 40
|
||||
BEGIN
|
||||
PROMPT 1 -1 "Corre~zione automatica righe contabili"
|
||||
FLAGS "H"
|
||||
END
|
||||
#endif
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "IVA" -1 -1 77 20
|
||||
@ -745,8 +745,10 @@ BEGIN
|
||||
ITEM "Co."
|
||||
ITEM "Sottoc.@6"
|
||||
ITEM "Descrizione Conto@50"
|
||||
ITEM "%IVA@5"
|
||||
ITEM "Natura@5"
|
||||
ITEM "%IVA@5"
|
||||
ITEM "Natura@5"
|
||||
ITEM "Nota.Var.@9"
|
||||
ITEM "Reverse Charge@13"
|
||||
END
|
||||
|
||||
CURRENCY F_IMPONIBILI 18
|
||||
|
@ -51,6 +51,45 @@ void TMovimentoPN::destroy_iva_row(int i)
|
||||
_iva.destroy_row(i+1, true);
|
||||
}
|
||||
|
||||
void TMovimentoPN::update_rev_charge()
|
||||
{
|
||||
const int year = lfile().get_int(MOV_ANNOIVA);
|
||||
const TString & codcaus = lfile().get(MOV_CODCAUS);
|
||||
const TCausale & caus = cached_causale(codcaus, year);
|
||||
const TipoIVA t = caus.iva();
|
||||
|
||||
if (t == iva_acquisti)
|
||||
{
|
||||
const bool rev_charge = caus.reverse_charge_pubb();
|
||||
|
||||
if (rev_charge)
|
||||
{
|
||||
int rows = _iva.rows();
|
||||
real imp_revcharge;
|
||||
bool has_revcharge = false;
|
||||
|
||||
for (int i = _iva.first_row(); !has_revcharge && i <= rows; i = _iva.succ_row(i))
|
||||
{
|
||||
has_revcharge |= _iva[i].get_bool(RMI_REVCHARGE);
|
||||
imp_revcharge += _iva[i].get_real(RMI_IMPOSTA);
|
||||
}
|
||||
if (!has_revcharge)
|
||||
{
|
||||
TRectype & h = head();
|
||||
|
||||
if (h.get_real(MOV_REVCHARGE) <= ZERO)
|
||||
{
|
||||
h.put(MOV_REVCHARGE, imp_revcharge);
|
||||
h.sub(MOV_RITFIS, imp_revcharge);
|
||||
if (h.get_real(MOV_RITFIS) < ZERO)
|
||||
h.zero(MOV_RITFIS);
|
||||
}
|
||||
for (int i = _iva.first_row(); i <= rows; i = _iva.succ_row(i))
|
||||
_iva[i].put(RMI_REVCHARGE, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int TMovimentoPN::read_mov_rows()
|
||||
{
|
||||
const TRectype& mov = curr();
|
||||
@ -63,7 +102,7 @@ int TMovimentoPN::read_mov_rows()
|
||||
TRectype* ivafilter = new TRectype(LF_RMOVIVA);
|
||||
ivafilter->put(RMI_NUMREG, numreg);
|
||||
_iva.read(ivafilter);
|
||||
|
||||
update_rev_charge();
|
||||
_old_iva = _iva;
|
||||
/*
|
||||
if (_cg.rows() > 0 && _iva.rows() > 0 && cg(0).get_char(RMV_ROWTYPE) != 'T')
|
||||
@ -85,9 +124,8 @@ int TMovimentoPN::read(TIsamop op, TReclock lockop)
|
||||
_olddataliq.set_day(1); // Evita problemi coi mesi corti!
|
||||
_olddataliq.set_month(meseliq);
|
||||
}
|
||||
|
||||
read_mov_rows(); // Riempie i due record array
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -225,6 +263,7 @@ int TMovimentoPN::registra(bool re, bool force)
|
||||
TRegistro registro(reg, annoiva);
|
||||
const bool att_mista = reg.empty() ? false : registro.attivita_mista();
|
||||
|
||||
update_rev_charge();
|
||||
for (int i = 0 ; i < iva_items(); i++)
|
||||
{
|
||||
TRectype& r = iva(i);
|
||||
@ -298,7 +337,7 @@ int TMovimentoPN::registra(bool re, bool force)
|
||||
|
||||
const int npart = partarray.items();
|
||||
|
||||
for (TPartita * part = partarray.first(); !reset && part != NULL; part = partarray.next())
|
||||
for (TPartita * part = partarray.first(); !reset && part != nullptr; part = partarray.next())
|
||||
{
|
||||
const int nrpart = part->last();
|
||||
|
||||
@ -381,11 +420,12 @@ bool TConti_array::add(const TBill& conto, const real& importo)
|
||||
{
|
||||
const char* key = conto.string();
|
||||
real* imp = (real*)objptr(key);
|
||||
if (imp == NULL)
|
||||
|
||||
if (imp == nullptr)
|
||||
TAssoc_array::add(key, importo);
|
||||
else
|
||||
*imp += importo;
|
||||
return imp != NULL;
|
||||
return imp != nullptr;
|
||||
}
|
||||
|
||||
real TConti_array::importo(const TBill& conto)
|
||||
@ -403,17 +443,19 @@ bool TConti_array::remove(const TBill& conto)
|
||||
|
||||
bool TConti_array::add_iva(bool det, const real& importo)
|
||||
{
|
||||
real* imp = NULL;
|
||||
real* imp = nullptr;
|
||||
|
||||
if (!importo.is_zero())
|
||||
{
|
||||
const char* const key = det ? "D" : "N";
|
||||
|
||||
imp = (real*)objptr(key);
|
||||
if (imp == NULL)
|
||||
if (imp == nullptr)
|
||||
TAssoc_array::add(key, importo);
|
||||
else
|
||||
*imp += importo;
|
||||
}
|
||||
return imp != NULL;
|
||||
return imp != nullptr;
|
||||
}
|
||||
|
||||
real TConti_array::importo_iva(bool det)
|
||||
|
@ -46,6 +46,7 @@ protected:
|
||||
|
||||
int registra(bool re, bool force);
|
||||
int read_mov_rows();
|
||||
void update_rev_charge();
|
||||
|
||||
// @END
|
||||
|
||||
@ -68,6 +69,7 @@ public:
|
||||
TRecord_array& iva_rows() { return _iva; }
|
||||
TRectype& cg(int i);
|
||||
TRectype& iva(int i);
|
||||
TRectype & head() { return lfile().curr(); }
|
||||
int cg_items() const { return _cg.rows(); }
|
||||
int iva_items() const { return _iva.rows(); }
|
||||
void destroy_rows(long numreg);
|
||||
|
1587
src/cg/cg2102.cpp
1587
src/cg/cg2102.cpp
File diff suppressed because it is too large
Load Diff
@ -312,7 +312,7 @@ protected:
|
||||
void set_type_color(char tipor, char tipoc, COLOR col);
|
||||
void set_colors();
|
||||
|
||||
bool read_caus(const char* cod, int year);
|
||||
bool read_caus(const char* cod = nullptr, int year = 0);
|
||||
TLibro_giornale& giornale() { return *_giornale; }
|
||||
|
||||
bool test_swap(bool ritsoc);
|
||||
@ -325,8 +325,8 @@ protected:
|
||||
real calcola_imp() const;
|
||||
|
||||
void add_cgs_tot(TMask& m);
|
||||
int set_cgs_row(int n, const TImporto& importo, TBill& conto, const char* desc, char tipo,
|
||||
const char* cms = NULL, const char* fas = NULL);
|
||||
int set_cgs_row(int n, const TImporto& importo, const TBill& conto, const char* desc, char tipo,
|
||||
const char* cms = nullptr, const char* fas = nullptr);
|
||||
void set_cgs_imp(int n, const TImporto& importo);
|
||||
bool add_cgs_imp(int n, const TImporto& importo);
|
||||
bool sub_cgs_imp(int n, const TImporto& importo);
|
||||
@ -378,7 +378,9 @@ protected:
|
||||
public:
|
||||
static int type2pos(char tipo);
|
||||
static char row_type(const TToken_string& s);
|
||||
static bool iva_notify(TSheet_field& s, int r, KEY key);
|
||||
void add2cg_row(TSheet_field& s, TToken_string & row, TString_array & saved_desc, const bool add = true);
|
||||
void sub2cg_row(TSheet_field& s, TToken_string & row, TString_array & saved_desc) { add2cg_row(s, row, saved_desc, false) ; }
|
||||
static bool iva_notify(TSheet_field& s, int r, KEY k);
|
||||
static bool cg_notify(TSheet_field& s, int r, KEY key);
|
||||
bool get_isf1() const { return _isf1; }
|
||||
int get_lastdate() { return _last_date; }
|
||||
|
@ -97,7 +97,8 @@ bool TCausale::read(const char* cod, int year)
|
||||
TBill& TCausale::bill(int num, TBill& conto) const
|
||||
{
|
||||
const TRectype* rec = row(num);
|
||||
if (rec != NULL)
|
||||
|
||||
if (rec != nullptr)
|
||||
conto.set(rec->get_int(RCA_GRUPPO), rec->get_int(RCA_CONTO),
|
||||
rec->get_long(RCA_SOTTOCONTO), rec->get_char(RCA_TIPOCF));
|
||||
return conto;
|
||||
@ -318,7 +319,8 @@ void TCausale::calcIVA()
|
||||
|
||||
const TString& TCausale::compatible(const TCausale& c) const
|
||||
{
|
||||
const char* err = NULL;
|
||||
const char* err = nullptr;
|
||||
|
||||
if (sezionale() != c.sezionale())
|
||||
err = TR("il segnale di sezionale");
|
||||
if (intra() != c.intra())
|
||||
@ -334,9 +336,10 @@ const TString& TCausale::compatible(const TCausale& c) const
|
||||
if (tipomov() != c.tipomov())
|
||||
err = TR("il tipo di movimento");
|
||||
|
||||
if (err != NULL)
|
||||
if (err != nullptr)
|
||||
{
|
||||
TString& msg = get_tmp_string();
|
||||
|
||||
msg.format(FR("Causale incompatibile per %s"), err);
|
||||
return msg;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
|
||||
TMask* msk = &(ps.mask());
|
||||
|
||||
// if (!msk->is_running()) return true; // Necessario per evitare il CHECK sul pagamento nullo
|
||||
if (!app().is_fattura() || app()._pag == NULL) return true; // Necessario per evitare il CHECK sul pagamento nullo
|
||||
if (!app().is_fattura() || app()._pag == nullptr) return true; // Necessario per evitare il CHECK sul pagamento nullo
|
||||
|
||||
TPagamento& pag = app().pagamento();
|
||||
TString_array& rws = app().pag_rows();
|
||||
@ -138,11 +138,11 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
|
||||
// ricalcola sheet come sai fare tu
|
||||
ahiahi = pag.recalc_rate(r, m_perc,
|
||||
((m_perc || m_impv) ?
|
||||
(m_perc ? (const char*)newp : (const char*)newv) : NULL),
|
||||
(m_impl ? (const char*)newl : NULL),
|
||||
(m_scad ? (const char*)news : NULL),
|
||||
(m_tipo ? (const char*)newt : NULL),
|
||||
(m_ulc ? (const char*)newu : NULL),
|
||||
(m_perc ? (const char*)newp : (const char*)newv) : nullptr),
|
||||
(m_impl ? (const char*)newl : nullptr),
|
||||
(m_scad ? (const char*)news : nullptr),
|
||||
(m_tipo ? (const char*)newt : nullptr),
|
||||
(m_ulc ? (const char*)newu : nullptr),
|
||||
rdiff, mcomm, need_recalc);
|
||||
|
||||
// see if rdiff changed
|
||||
@ -301,10 +301,11 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
|
||||
|
||||
bool TPrimanota_application::tipopag_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if ((key == K_TAB || key == K_ENTER) && f.dirty())
|
||||
if (f.to_check(key))
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
int t = m.get_int(105);
|
||||
|
||||
if (t <= 0)
|
||||
{
|
||||
t = 1;
|
||||
@ -607,7 +608,7 @@ bool TPrimanota_application::recalc_handler(TMask_field& f, KEY key)
|
||||
|
||||
bool TPrimanota_application::nrate_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_TAB && f.focusdirty())
|
||||
if (f.running_check(K_TAB))
|
||||
{
|
||||
TPagamento& pag = app().pagamento();
|
||||
pag.set_numero_rate(atoi(f.get()));
|
||||
@ -701,18 +702,14 @@ void TPrimanota_application::recalc_scadenze(const TDate& d)
|
||||
|
||||
void TPrimanota_application::set_pagamento(const char* c, const char* d)
|
||||
{
|
||||
if (_pag != NULL)
|
||||
{
|
||||
delete _pag;
|
||||
_pag = NULL;
|
||||
}
|
||||
if (c != NULL || d != NULL)
|
||||
SAFE_DELETE(_pag);
|
||||
if (c != nullptr || d != nullptr)
|
||||
{
|
||||
if (!TDate::isdate(d))
|
||||
d = "";
|
||||
_pag = new TPagamento(c, d);
|
||||
}
|
||||
if (_pag != NULL && iva() == iva_vendite)
|
||||
if (_pag != nullptr && iva() == iva_vendite)
|
||||
_pag->set_clifo(curr_mask().get_long(F_CODCLIFOR)); // Dato indispensabile per non accettazione effetti
|
||||
|
||||
}
|
||||
@ -968,7 +965,7 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
||||
const TString numpart(m.get(F_NUMRIF));
|
||||
|
||||
TPartita* oldgame = partite().first();
|
||||
TPartita* newgame = NULL;
|
||||
TPartita* newgame = nullptr;
|
||||
|
||||
int nuova_riga = 0;
|
||||
|
||||
@ -1085,14 +1082,15 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
||||
}
|
||||
}
|
||||
|
||||
if (oldgame != NULL)
|
||||
if (oldgame != nullptr)
|
||||
{
|
||||
const int rigafatt = oldgame->prima_fattura(nreg);
|
||||
if (rigafatt > 0)
|
||||
{
|
||||
if (newgame == NULL || *oldgame != *newgame)
|
||||
if (newgame == nullptr || *oldgame != *newgame)
|
||||
{
|
||||
bool sposta = newgame != NULL;
|
||||
bool sposta = newgame != nullptr;
|
||||
|
||||
if (sposta)
|
||||
{
|
||||
sposta = (oldgame->conto().sottoconto() == newgame->conto().sottoconto());
|
||||
@ -1117,8 +1115,7 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newgame != NULL) // Se non ho cancellato il numero partita ...
|
||||
if (newgame != nullptr) // Se non ho cancellato il numero partita ...
|
||||
{
|
||||
newgame->write(); // Salva nuova partita
|
||||
delete newgame;
|
||||
@ -1258,11 +1255,11 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
|
||||
TBill contro; contro.get(cli_row, 9, 0x3);
|
||||
if (!contro.ok()) // Completa controparita della riga cliente se necessario
|
||||
new_conto.add_to(cli_row, 9, 0x3);
|
||||
TString80 descr = cli_row.get(CG_DESCR-FIRST_FIELD);
|
||||
TString80 descr = cli_row.get(cid2index(CG_DESCR));
|
||||
if (descr.blank()) // Compila descrizione della riga cliente se necessario
|
||||
{
|
||||
descr = somma.get(PART_DESCR);
|
||||
cli_row.add(descr, CG_DESCR-FIRST_FIELD);
|
||||
cli_row.add(descr, cid2index(CG_DESCR));
|
||||
}
|
||||
|
||||
// Compila contropartita della nuova riga
|
||||
|
@ -46,7 +46,7 @@ protected:
|
||||
static bool nuovo_handler(TMask_field& f, KEY k);
|
||||
static bool cambio_handler(TMask_field& f, KEY k);
|
||||
|
||||
void add_importo(TToken_string& s, const TImporto& i, const char* val = NULL, int pos = -1);
|
||||
void add_importo(TToken_string& s, const TImporto& i, const char* val = nullptr, int pos = -1);
|
||||
void add_descrizione(TToken_string& s, const TRiga_partite& riga, int pos = -1);
|
||||
TImporto get_importo(TToken_string& s, int pos) const;
|
||||
|
||||
@ -650,7 +650,8 @@ void TGame_mask::init(const TBill& bill, long numreg, int riga)
|
||||
#else
|
||||
TValuta val;
|
||||
const TRiga_partite* row = cerca_prima_riga();
|
||||
if (row != NULL)
|
||||
|
||||
if (row != nullptr)
|
||||
{
|
||||
val.get(*row); // Legge valuta standard dalla partita
|
||||
set(P_ANNO, row->get(PART_ANNO)); // Propone anno e partita
|
||||
@ -868,13 +869,15 @@ TToken_string& TGame_mask::add_colored_row(TSheet_field& sheet, char type) const
|
||||
TPartita* TGame_mask::partita_corrente() const
|
||||
{
|
||||
if (_riga_partite < 0)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
TToken_string& row = partite().row(_riga_partite);
|
||||
const int anno = row.get_int(0); // Anno partita
|
||||
const TNumero_partita num = row.get(); // Numero partita
|
||||
const TBill& zio = conto();
|
||||
TPartita* game = app().partite().exist(zio, anno, num);
|
||||
return game;
|
||||
|
||||
return game;
|
||||
}
|
||||
|
||||
bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
||||
@ -915,7 +918,8 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
||||
const TBill& zio = gm.conto(); // Conto cliente/fornitore
|
||||
|
||||
TPartita* game = app().partite().exist(zio, anno, num); // Cerca la partita tra quelle editate
|
||||
const bool should_delete_game = (game == NULL); // Ricorda di fare delete
|
||||
const bool should_delete_game = (game == nullptr); // Ricorda di fare delete
|
||||
|
||||
if (should_delete_game) // Se non c'era ...
|
||||
game = new TPartita(zio, anno, num); // ... creane una temporanea
|
||||
|
||||
@ -958,7 +962,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
||||
row = riga_fattura;
|
||||
row.add(ra, 1);
|
||||
row.add(scad.get(SCAD_DATASCAD), 3);
|
||||
gm.add_importo(row, scad.importo(false), NULL, 5);
|
||||
gm.add_importo(row, scad.importo(false), nullptr, 5);
|
||||
if (in_valuta)
|
||||
gm.add_importo(row, scad.importo(true), prima_valuta.codice(), 6);
|
||||
|
||||
@ -1383,8 +1387,9 @@ int TGame_mask::nuova_riga(TPartita& partita, tipo_movimento tm) const
|
||||
part.put(PART_DATAPAG, cm.get(F_DATAREG));
|
||||
part.put(PART_TIPOPAG, 1);
|
||||
|
||||
const TRiga_partite* prima = (tm != tm_fattura) ? cerca_prima_riga() : NULL;
|
||||
if (prima != NULL && prima != &part)
|
||||
const TRiga_partite* prima = (tm != tm_fattura) ? cerca_prima_riga() : nullptr;
|
||||
|
||||
if (prima != nullptr && prima != &part)
|
||||
{
|
||||
part.put(PART_DESCR, prima->get(PART_DESCR));
|
||||
part.put(PART_DATAPAG, prima->get(PART_DATAPAG));
|
||||
@ -1497,7 +1502,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (m.get_bool(114))
|
||||
{
|
||||
if (was == NULL)
|
||||
if (was == nullptr)
|
||||
giochi.destroy(game);
|
||||
return f.error_box(FR("La rata %d risulta bloccata."), nrata);
|
||||
}
|
||||
@ -1510,7 +1515,8 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
TString4 c = parval.codice();
|
||||
if (c.empty())
|
||||
c = TCurrency::get_firm_val();
|
||||
if (was == NULL) giochi.destroy(game);
|
||||
|
||||
if (was == nullptr) giochi.destroy(game);
|
||||
return f.error_box(FR("La fattura deve essere pagata in %s."), (const char*)c);
|
||||
}
|
||||
#endif
|
||||
@ -1522,11 +1528,11 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
// nm->set(P_NUMERO, game.numero()); // Non deve proporre nulla: CM000206
|
||||
const KEY k = nm->run();
|
||||
tm = (tipo_movimento)nm->get_int(P_NUOVO);
|
||||
delete nm; nm = NULL;
|
||||
SAFE_DELETE(nm);
|
||||
|
||||
if (k != K_ENTER)
|
||||
{
|
||||
if (was == NULL)
|
||||
if (was == nullptr)
|
||||
giochi.destroy(game);
|
||||
return false;
|
||||
}
|
||||
@ -1558,7 +1564,8 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
gm.prima_nota(nreg);
|
||||
if (m.is_running()) m.set_focus();
|
||||
#else
|
||||
if (was == NULL) giochi.destroy(game);
|
||||
if (was == nullptr)
|
||||
giochi.destroy(game);
|
||||
return f.error_box(FR("Modificare il movimento %ld"), nreg);
|
||||
#endif
|
||||
}
|
||||
@ -1580,7 +1587,8 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
f.error_box(TR("Utilizzare la gestione extra-contabile"));
|
||||
else
|
||||
f.error_box(FR("Modificare il movimento %ld"), nreg);
|
||||
if (was == NULL) giochi.destroy(game);
|
||||
if (was == nullptr)
|
||||
giochi.destroy(game);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
@ -1626,8 +1634,9 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
||||
const bool allow_fatt = FALSE;
|
||||
#endif
|
||||
|
||||
static TNew_mask* new_game = NULL;
|
||||
if (new_game == NULL)
|
||||
static TNew_mask* new_game = nullptr;
|
||||
|
||||
if (new_game == nullptr)
|
||||
new_game = new TNew_mask(gm.conto().tipo(), allow_fatt, true);
|
||||
else
|
||||
new_game->init(gm.conto().tipo(), allow_fatt, true);
|
||||
@ -1949,10 +1958,11 @@ void TGame_mask::fill_partite()
|
||||
const bool all = get(P_SHOWALL).not_empty(); // Visualizza anche partite chiuse
|
||||
|
||||
partite().destroy();
|
||||
TString_array& a = partite().rows_array();
|
||||
|
||||
|
||||
TString_array& a = partite().rows_array();
|
||||
TPartite_array& giochi = app().partite();
|
||||
for (TPartita* gioco = giochi.first(); gioco != NULL; gioco = giochi.next())
|
||||
|
||||
for (TPartita* gioco = giochi.first(); gioco != nullptr; gioco = giochi.next())
|
||||
{
|
||||
// Visualizza solo le partite con almeno una riga! Non posso scaricarle a priori in quanto
|
||||
// potrebbero essere state cancellate proprio ora e quindi devo tenerle cosi' per aggiornare
|
||||
@ -2020,7 +2030,8 @@ void TGame_mask::fill_partite()
|
||||
found = r;
|
||||
|
||||
TPartita* gioco = app().partite().exist(conto(), anno, numero);
|
||||
if (gioco != NULL && gioco->mov2rig(_numreg, _numrig) > 0)
|
||||
|
||||
if (gioco != nullptr && gioco->mov2rig(_numreg, _numrig) > 0)
|
||||
{
|
||||
COLOR back, fore;
|
||||
app().type2colors('X', back, fore);
|
||||
@ -2053,8 +2064,9 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
|
||||
oldpag.get_real(PAGSCA_RITSOC).is_zero();
|
||||
|
||||
// We must create masks on the heap
|
||||
static TPay_mask* pm = NULL;
|
||||
if (pm == NULL)
|
||||
static TPay_mask* pm = nullptr;
|
||||
|
||||
if (pm == nullptr)
|
||||
pm = new TPay_mask(this, nuovo ? MODE_INS : MODE_MOD);
|
||||
else
|
||||
pm->init(this, nuovo ? MODE_INS : MODE_MOD);
|
||||
@ -2117,9 +2129,6 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
|
||||
app().notify_edit_pagamento(p, newpag, val);
|
||||
#endif
|
||||
}
|
||||
|
||||
// delete pm; pm = NULL; // commentata in quanto statica
|
||||
|
||||
#ifdef __EXTRA__
|
||||
xvtil_statbar_set(TR("Estratto conto"), true);
|
||||
#endif
|
||||
@ -2171,7 +2180,8 @@ static bool genera_riferimento(int riga, TString& rif)
|
||||
if (field.file() == LF_MOV)
|
||||
{
|
||||
const TMask_field* mf = mov_mask.find_by_fieldname(field.name());
|
||||
if (mf != NULL)
|
||||
|
||||
if (mf != nullptr)
|
||||
{
|
||||
val = mf->get();
|
||||
if (field.to() > 0)
|
||||
@ -2183,7 +2193,8 @@ static bool genera_riferimento(int riga, TString& rif)
|
||||
{
|
||||
TMask& row_mask = app().cgs().sheet_row_mask(riga);
|
||||
const TMask_field* rf = row_mask.find_by_fieldname(field.name());
|
||||
if (rf != NULL)
|
||||
|
||||
if (rf != nullptr)
|
||||
{
|
||||
val = rf->get();
|
||||
if (field.to() > 0)
|
||||
@ -2265,8 +2276,9 @@ bool TPrimanota_application::edit_partite(const TMask& m, int riga)
|
||||
if (_easy_sal)
|
||||
{
|
||||
// Nuova maschera di gestione partite
|
||||
static TEasySolder_mask* mask = NULL;
|
||||
if (mask == NULL)
|
||||
static TEasySolder_mask* mask = nullptr;
|
||||
|
||||
if (mask == nullptr)
|
||||
mask = new TEasySolder_mask(b, numreg, riga+1);
|
||||
else
|
||||
mask->init(b, numreg, riga+1);
|
||||
@ -2275,8 +2287,9 @@ bool TPrimanota_application::edit_partite(const TMask& m, int riga)
|
||||
else
|
||||
{
|
||||
// Maschera tradizionale di gestione partite
|
||||
static TGame_mask* mask = NULL;
|
||||
if (mask == NULL)
|
||||
static TGame_mask* mask = nullptr;
|
||||
|
||||
if (mask == nullptr)
|
||||
mask = new TGame_mask(b, numreg, riga+1);
|
||||
else
|
||||
mask->init(b, numreg, riga+1);
|
||||
|
@ -91,7 +91,7 @@ void TColor_mask::load_props()
|
||||
a.type2colors(*k, back, fore);
|
||||
|
||||
prop[0] = *k; prop[1] = '\0';
|
||||
ps.set_property(prop, (const char*)NULL, desc[d]);
|
||||
ps.set_property(prop, (const char*)nullptr, desc[d]);
|
||||
|
||||
prop[0] = *k; prop[1] = '_'; prop[2] = 'B';
|
||||
ps.set_property(prop, back, TR("Sfondo"));
|
||||
@ -188,7 +188,8 @@ COLOR TPrimanota_application::type2color(char tipor, char tipoc)
|
||||
{
|
||||
const char key[3] = { tipoc, tipor, '\0' };
|
||||
TString* colstr = (TString*)_colori.objptr(key);
|
||||
if (colstr == NULL)
|
||||
|
||||
if (colstr == nullptr)
|
||||
{
|
||||
colstr = new TString(8);
|
||||
if (tipor == 'X')
|
||||
@ -212,7 +213,8 @@ void TPrimanota_application::set_type_color(char tipor, char tipoc, COLOR col)
|
||||
{
|
||||
const char key[3] = { tipoc, tipor, '\0' };
|
||||
TString* colstr = (TString*)_colori.objptr(key);
|
||||
if (colstr == NULL)
|
||||
|
||||
if (colstr == nullptr)
|
||||
{
|
||||
colstr = new TString(8);
|
||||
_colori.add(key, colstr);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <urldefid.h>
|
||||
#include <toolfld.h>
|
||||
#include <treectrl.h>
|
||||
#include <utility.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TNew_game_mask
|
||||
@ -90,42 +91,6 @@ void TEasySolder_mask::set_imp(short id, const TImporto& imp)
|
||||
e.reset();
|
||||
}
|
||||
|
||||
#define get_row_bool(sheet, row, id) (row).get_char(sheet.cid2index(id))=='X'
|
||||
#define get_row_int(sheet, row, id) (row).get_int(sheet.cid2index(id))
|
||||
#define get_row_str(sheet, row, id) (row).get(sheet.cid2index(id))
|
||||
#define get_row_real(sheet, row, id) real((row).get(sheet.cid2index(id)))
|
||||
|
||||
#define set_row_bool(sheet, row, id, n) (row).add(n ? "X" : "", sheet.cid2index(id))
|
||||
#define set_row_int(sheet, row, id, n) (row).add(n, sheet.cid2index(id))
|
||||
#define set_row_str(sheet, row, id, n) (row).add(n, sheet.cid2index(id))
|
||||
|
||||
static bool set_row_currency(const TSheet_field& sheet, TToken_string& row, short id, const real& n)
|
||||
{
|
||||
const TMask& m = sheet.sheet_mask();
|
||||
const TCurrency_field& cf = (const TCurrency_field&)m.field(id);
|
||||
TOperable_field* vf = cf.driver(0);
|
||||
if (vf != NULL && !vf->empty()) // E' un importo in valuta?
|
||||
{
|
||||
const TString& codval = vf->get();
|
||||
if (is_true_value(codval)) // La valuta e' diversa dall'euro?
|
||||
{
|
||||
if (n.is_zero())
|
||||
set_row_str(sheet, row, id, "");
|
||||
else
|
||||
{
|
||||
const TCurrency cur(n, codval);
|
||||
set_row_str(sheet, row, id, cur.get_num().string());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (n.is_zero())
|
||||
set_row_str(sheet, row, id, "");
|
||||
else
|
||||
set_row_str(sheet, row, id, n.string(-1, 2));
|
||||
return false;
|
||||
}
|
||||
|
||||
void TEasySolder_mask::save_sheet()
|
||||
{
|
||||
// Memorizza i dati del cambio da salvare sulle righe di partita
|
||||
@ -137,27 +102,30 @@ void TEasySolder_mask::save_sheet()
|
||||
FOR_EACH_SHEET_ROW(s, r, row_ptr)
|
||||
{
|
||||
TToken_string& row = *row_ptr;
|
||||
const int anno = get_row_int(s, row, S_ANNO);
|
||||
const TString8 numpart = get_row_str(s, row, S_PARTITA);
|
||||
const int rigaf = get_row_int(s, row, S_RIGAF);
|
||||
const int nrata = get_row_int(s, row, S_RATA);
|
||||
|
||||
const int anno = s.get_int_row_cell(row, S_ANNO);
|
||||
const TString8 numpart = s.get_str_row_cell(row, S_PARTITA);
|
||||
const int rigaf = s.get_int_row_cell(row, S_RIGAF);
|
||||
const int nrata = s.get_int_row_cell(row, S_RATA);
|
||||
const bool goodrat = nrata > 0 && nrata < TPartita::UNASSIGNED;
|
||||
int nrigp = get_row_int(s, row, S_RIGAP);
|
||||
const real importo = get_row_real(s, row, S_IMPORTO);
|
||||
const real ritfis = valuta.in_valuta() ? ZERO : get_row_real(s, row, S_RITFIS);
|
||||
const real ritsoc = valuta.in_valuta() ? ZERO : get_row_real(s, row, S_RITSOC);
|
||||
const bool a_saldo = goodrat && get_row_bool(s, row, S_SALDO);
|
||||
const TTipo_pag tipopag = (TTipo_pag)get_row_int(s, row, S_MODOPAG);
|
||||
const TDate datapag = get_row_str(s, row, S_DATAPAG);
|
||||
int nrigp = s.get_int_row_cell(row, S_RIGAP);
|
||||
const real importo = s.get_real_row_cell(row, S_IMPORTO);
|
||||
const real ritfis = valuta.in_valuta() ? ZERO : s.get_real_row_cell(row, S_RITFIS);
|
||||
const real ritsoc = valuta.in_valuta() ? ZERO : s.get_real_row_cell(row, S_RITSOC);
|
||||
const bool a_saldo = goodrat && s.get_bool_row_cell(row, S_SALDO);
|
||||
const TTipo_pag tipopag = (TTipo_pag) s.get_int_row_cell(row, S_MODOPAG);
|
||||
const TDate datapag = s.get_date_row_cell(row, S_DATAPAG);
|
||||
|
||||
if (a_saldo || !importo.is_zero() || !ritfis.is_zero() || !ritsoc.is_zero() || nrigp > 0)
|
||||
{
|
||||
TPartita& partita = app().partite().partita(_conto, anno, numpart);
|
||||
|
||||
if (nrigp <= 0)
|
||||
{
|
||||
TRiga_partite& part = partita.new_row(); // Creazione nuova riga vuota
|
||||
|
||||
nrigp = part.get_int(PART_NRIGA); // Nuova riga
|
||||
set_row_int(s, row, S_RIGAP, nrigp);
|
||||
s.set_row_cell(row, S_RIGAP, nrigp);
|
||||
part.put(PART_SEZ, calcola_sezione());
|
||||
}
|
||||
|
||||
@ -191,9 +159,10 @@ void TEasySolder_mask::save_sheet()
|
||||
|
||||
if (valuta.in_valuta())
|
||||
{
|
||||
newpag.put(PAGSCA_IMPORTOVAL, importo);
|
||||
const real impeur = get_row_str(s, row, S_IMPORTO_EUR);
|
||||
newpag.put(PAGSCA_IMPORTO, impeur);
|
||||
const real impeur = s.get_real_row_cell(row, S_IMPORTO_EUR);
|
||||
|
||||
newpag.put(PAGSCA_IMPORTOVAL, importo);
|
||||
newpag.put(PAGSCA_IMPORTO, impeur);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -237,7 +206,8 @@ long TEasySolder_mask::handler(WINDOW w, EVENT* ep)
|
||||
{
|
||||
if (s->parent() == w && s->point2cell(ep->v.mouse.where, id, rec) && rec < 0)
|
||||
{
|
||||
const char* st = NULL;
|
||||
const char* st = nullptr;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case S_DATADOC :
|
||||
@ -385,6 +355,7 @@ real TEasySolder_mask::eur2val(const real& eur) const
|
||||
const TMask& mm = app().curr_mask();
|
||||
const real toteur = mm.get(F_TOTALE);
|
||||
const real totval = mm.get(SK_TOTDOCVAL);
|
||||
|
||||
if (toteur.is_zero() || totval.is_zero())
|
||||
{
|
||||
const TValuta valuta(mm, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
|
||||
@ -401,6 +372,7 @@ real TEasySolder_mask::eur2val(const real& eur) const
|
||||
TImporto TEasySolder_mask::eur2val(const TImporto& imp) const
|
||||
{
|
||||
TImporto eur = imp;
|
||||
|
||||
eur.valore() = eur2val(imp.valore());
|
||||
return eur;
|
||||
}
|
||||
@ -441,11 +413,12 @@ bool TEasySolder_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
{
|
||||
TSheet_field& s = (TSheet_field&)o;
|
||||
TToken_string& row = s.row(jolly);
|
||||
_anno = get_row_int(s, row, S_ANNO);
|
||||
_numpart = get_row_str(s, row, S_PARTITA);
|
||||
const int rigaf = get_row_int(s, row, S_RIGAF);
|
||||
const int nrata = get_row_int(s, row, S_RATA);
|
||||
const int nrigp = get_row_int(s, row, S_RIGAP);
|
||||
|
||||
_anno = s.get_int_row_cell(row, S_ANNO);
|
||||
_numpart = s.get_str_row_cell(row, S_PARTITA);
|
||||
const int rigaf = s.get_int_row_cell(row, S_RIGAF);
|
||||
const int nrata = s.get_int_row_cell(row, S_RATA);
|
||||
const int nrigp = s.get_int_row_cell(row, S_RIGAP);
|
||||
|
||||
if (_tree->goto_single_game(_anno, _numpart, rigaf, nrata, nrigp))
|
||||
{
|
||||
@ -459,6 +432,7 @@ bool TEasySolder_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
case se_query_add:
|
||||
{
|
||||
TNew_game_mask m(_conto);
|
||||
|
||||
if (m.run() == K_ENTER)
|
||||
{
|
||||
// Memorizzo il codice partita in modo da poterlo mettere nella nuova riga
|
||||
@ -474,10 +448,11 @@ bool TEasySolder_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
// Metto nella nuova riga il codice partita memorizzato sopra
|
||||
TSheet_field& sheet = (TSheet_field&)o;
|
||||
TToken_string& row = sheet.row(jolly);
|
||||
set_row_int(sheet, row, S_ANNO, _anno);
|
||||
set_row_str(sheet, row, S_PARTITA, _numpart);
|
||||
set_row_int(sheet, row, S_RIGAF, TPartita::UNASSIGNED);
|
||||
set_row_int(sheet, row, S_RATA, TPartita::UNASSIGNED);
|
||||
|
||||
sheet.set_row_cell(row, S_ANNO, _anno);
|
||||
sheet.set_row_cell(row, S_PARTITA, _numpart);
|
||||
sheet.set_row_cell(row, S_RIGAF, TPartita::UNASSIGNED);
|
||||
sheet.set_row_cell(row, S_RATA, TPartita::UNASSIGNED);
|
||||
sheet.disable_cell(jolly, S_SALDO);
|
||||
}
|
||||
break;
|
||||
@ -644,7 +619,8 @@ static int nrigp_pagamento_locale(const TSolder_tree& st)
|
||||
if (level == 3)
|
||||
{
|
||||
const TRiga_scadenze* scad = st.scadenza();
|
||||
if (scad != NULL) // Vera scadenza
|
||||
|
||||
if (scad != nullptr) // Vera scadenza
|
||||
{
|
||||
for (int nrigp = scad->last(); nrigp > 0; nrigp = scad->pred(nrigp))
|
||||
{
|
||||
@ -687,7 +663,6 @@ static int has_lonely_nc(TPartita& game)
|
||||
return ncs;
|
||||
}
|
||||
|
||||
|
||||
// Aggiunge una nota di credito non associata a fattura
|
||||
static bool add_lonely_nc(TPartita& game, TSheet_field& sheet, int rigasheet)
|
||||
{
|
||||
@ -703,27 +678,29 @@ static bool add_lonely_nc(TPartita& game, TSheet_field& sheet, int rigasheet)
|
||||
|
||||
TImporto res = game.calcola_saldo(true);
|
||||
res.normalize(expected_section);
|
||||
set_row_currency(sheet, row, S_RESIDUO, res.valore());
|
||||
sheet.set_row_cell_currency(row, S_RESIDUO, res.valore());
|
||||
|
||||
TImporto tot = riga.importo(true);
|
||||
|
||||
tot.normalize(expected_section);
|
||||
set_row_currency(sheet, row, S_TOTALE, tot.valore());
|
||||
sheet.set_row_cell_currency(row, S_TOTALE, tot.valore());
|
||||
|
||||
set_row_int(sheet, row, S_ANNO, game.anno());
|
||||
set_row_str(sheet, row, S_PARTITA, game.numero());
|
||||
set_row_int(sheet, row, S_RIGAF, TPartita::UNASSIGNED);
|
||||
set_row_int(sheet, row, S_RATA, TPartita::UNASSIGNED);
|
||||
set_row_int(sheet, row, S_RIGAP, 0); // Lasciare 0 e NON mettere assultamente nrigp o la scambia per pagamento!
|
||||
set_row_str(sheet, row, S_DATASCAD, riga.get(PART_DATAPAG));
|
||||
sheet.set_row_cell(row, S_ANNO, game.anno());
|
||||
sheet.set_row_cell(row, S_PARTITA, game.numero());
|
||||
sheet.set_row_cell(row, S_RIGAF, TPartita::UNASSIGNED);
|
||||
sheet.set_row_cell(row, S_RATA, TPartita::UNASSIGNED);
|
||||
sheet.set_row_cell(row, S_RIGAP, 0); // Lasciare 0 e NON mettere assultamente nrigp o la scambia per pagamento!
|
||||
sheet.set_row_cell(row, S_DATASCAD, riga.get(PART_DATAPAG));
|
||||
if (game.in_valuta())
|
||||
{
|
||||
row.add(game.codice_valuta(), sheet.cid2index(S_VALUTA));
|
||||
TImporto reseur = riga.importo(false);
|
||||
reseur.normalize(expected_section);
|
||||
set_row_currency(sheet, row, S_RESIDUO_EUR, reseur.valore());
|
||||
|
||||
sheet.set_row_cell(row, S_VALUTA, game.codice_valuta());
|
||||
reseur.normalize(expected_section);
|
||||
sheet.set_row_cell_currency(row, S_RESIDUO_EUR, reseur.valore());
|
||||
}
|
||||
set_row_str(sheet, row, S_NUMDOC, riga.get(PART_NUMDOC));
|
||||
set_row_str(sheet, row, S_DATADOC, riga.get(PART_DATADOC));
|
||||
sheet.set_row_cell(row, S_NUMDOC, riga.get(PART_NUMDOC));
|
||||
sheet.set_row_cell(row, S_DATADOC, riga.get(PART_DATADOC));
|
||||
const int nrow = sheet.items()-1;
|
||||
sheet.disable_cell(nrow, S_SALDO);
|
||||
|
||||
@ -752,8 +729,9 @@ bool TEasySolder_mask::sheet_rate_filler(TTree& tree, void* jolly, word /* flags
|
||||
bool good_rat = level >= 3 && nrata > 0 && nrata < TPartita::UNASSIGNED;
|
||||
bool good_pag = level == 4 && nrigp > 0;
|
||||
|
||||
const TRiga_scadenze* scad = good_rat ? st.scadenza() : NULL;
|
||||
if (good_rat && scad == NULL)
|
||||
const TRiga_scadenze* scad = good_rat ? st.scadenza() : nullptr;
|
||||
|
||||
if (good_rat && scad == nullptr)
|
||||
{
|
||||
CHECKD(false, "Rata nulla inattesa ", nrata); // Segnalazione 1867
|
||||
return false;
|
||||
@ -812,37 +790,40 @@ bool TEasySolder_mask::sheet_rate_filler(TTree& tree, void* jolly, word /* flags
|
||||
res = scad->residuo(true);
|
||||
res.normalize(rat_section);
|
||||
}
|
||||
set_row_currency(sheet, row, S_RESIDUO, res.valore());
|
||||
sheet.set_row_cell_currency(row, S_RESIDUO, res.valore());
|
||||
const TImporto tot = scad->importo(true);
|
||||
set_row_currency(sheet, row, S_TOTALE, tot.valore());
|
||||
set_row_int(sheet, row, S_ANNO, game.anno());
|
||||
set_row_str(sheet, row, S_PARTITA, game.numero());
|
||||
set_row_int(sheet, row, S_RIGAF, nriga);
|
||||
set_row_int(sheet, row, S_RATA, nrata);
|
||||
set_row_str(sheet, row, S_DATASCAD, scad->get(SCAD_DATASCAD));
|
||||
set_row_str(sheet, row, S_MODOPAG, scad->get(SCAD_TIPOPAG)); // Solo proposta
|
||||
sheet.set_row_cell_currency(row, S_TOTALE, tot.valore());
|
||||
sheet.set_row_cell(row, S_ANNO, game.anno());
|
||||
sheet.set_row_cell(row, S_PARTITA, game.numero());
|
||||
sheet.set_row_cell(row, S_RIGAF, nriga);
|
||||
sheet.set_row_cell(row, S_RATA, nrata);
|
||||
sheet.set_row_cell(row, S_DATASCAD, scad->get_date(SCAD_DATASCAD));
|
||||
sheet.set_row_cell(row, S_MODOPAG, scad->get(SCAD_TIPOPAG)); // Solo proposta
|
||||
if (game.in_valuta())
|
||||
{
|
||||
// Calcola il residuo rata utilizzando il cambio della fattura e non quello del pagamento
|
||||
const TImporto reseur = tm == tm_insoluto ? scad->importo_pagato(false) : scad->residuo(false);
|
||||
set_row_currency(sheet, row, S_RESIDUO_EUR, reseur.valore());
|
||||
|
||||
sheet.set_row_cell_currency(row, S_RESIDUO_EUR, reseur.valore());
|
||||
}
|
||||
if (nriga > 0 && nriga < TPartita::UNASSIGNED) // Dovrebbe sempre essere vero, ma ...
|
||||
{
|
||||
const TRiga_partite& riga = game.riga(nriga);
|
||||
set_row_str(sheet, row, S_NUMDOC, riga.get(PART_NUMDOC));
|
||||
set_row_str(sheet, row, S_DATADOC, riga.get(PART_DATADOC));
|
||||
|
||||
set_row_str(sheet, row, S_NOTE, scad->get(SCAD_DESCR));
|
||||
|
||||
sheet.set_row_cell(row, S_NUMDOC, riga.get(PART_NUMDOC));
|
||||
sheet.set_row_cell(row, S_DATADOC, riga.get(PART_DATADOC));
|
||||
sheet.set_row_cell(row, S_NOTE, scad->get(SCAD_DESCR));
|
||||
if (scad->get_bool(SCAD_BLOCCATA))
|
||||
{
|
||||
set_row_bool(sheet, row, S_BLOCCO, true);
|
||||
sheet.set_row_cell(row, S_BLOCCO, true);
|
||||
sheet.disable_cell(sheet.items()-1, -1);
|
||||
|
||||
const TString8 cbp = scad->get(SCAD_MOTIVO);
|
||||
|
||||
if (cbp.full())
|
||||
{
|
||||
set_row_str(sheet, row, S_MOTIVO, cbp);
|
||||
set_row_str(sheet, row, S_NOTE, cache().get("%CBP", cbp, "S0"));
|
||||
sheet.set_row_cell(row, S_MOTIVO, cbp);
|
||||
sheet.set_row_cell(row, S_NOTE, cache().get("%CBP", cbp, "S0"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -851,13 +832,15 @@ bool TEasySolder_mask::sheet_rate_filler(TTree& tree, void* jolly, word /* flags
|
||||
if (!good_pag)
|
||||
{
|
||||
TDate dp(TODAY);
|
||||
|
||||
if (scad->get_int(SCAD_TIPOPAG) > 1)
|
||||
{
|
||||
const TDate ds = scad->get(SCAD_DATASCAD);
|
||||
const TDate ds = scad->get_date(SCAD_DATASCAD);
|
||||
|
||||
if (ds > dp)
|
||||
dp = ds;
|
||||
}
|
||||
set_row_str(sheet, row, S_DATAPAG, dp);
|
||||
sheet.set_row_cell(row, S_DATAPAG, dp);
|
||||
}
|
||||
}
|
||||
if (good_pag)
|
||||
@ -866,42 +849,45 @@ bool TEasySolder_mask::sheet_rate_filler(TTree& tree, void* jolly, word /* flags
|
||||
add_lonely_nc(game, sheet, sheet.items()-1);
|
||||
|
||||
const TRiga_partite& rigp = game.riga(nrigp);
|
||||
set_row_int(sheet, row, S_RIGAP, nrigp);
|
||||
set_row_int(sheet, row, S_NREG, rigp.get_long(PART_NREG));
|
||||
set_row_int(sheet, row, S_NRIG, rigp.get_int(PART_NUMRIG));
|
||||
|
||||
sheet.set_row_cell(row, S_RIGAP, nrigp);
|
||||
sheet.set_row_cell(row, S_NREG, rigp.get_long(PART_NREG));
|
||||
sheet.set_row_cell(row, S_NRIG, rigp.get_int(PART_NUMRIG));
|
||||
|
||||
const TRectype& pag = *st.pagamento();
|
||||
const real imp = pag.get_real(PAGSCA_IMPORTO);
|
||||
|
||||
if (!imp.is_zero())
|
||||
{
|
||||
set_row_bool(sheet, row, S_SPUNTA, true);
|
||||
sheet.set_row_cell(row, S_SPUNTA, true);
|
||||
if (rigp.in_valuta())
|
||||
{
|
||||
const real impval = pag.get_real(PAGSCA_IMPORTOVAL);
|
||||
set_row_currency(sheet, row, S_IMPORTO, impval);
|
||||
set_row_currency(sheet, row, S_IMPORTO_EUR, imp);
|
||||
|
||||
sheet.set_row_cell_currency(row, S_IMPORTO, impval);
|
||||
sheet.set_row_cell_currency(row, S_IMPORTO_EUR, imp);
|
||||
}
|
||||
else
|
||||
set_row_currency(sheet, row, S_IMPORTO, imp);
|
||||
sheet.set_row_cell_currency(row, S_IMPORTO, imp);
|
||||
}
|
||||
set_row_str(sheet, row, S_SALDO, (good_rat && pag.get_char(PAGSCA_ACCSAL)=='S') ? "X" : "");
|
||||
set_row_int(sheet, row, S_MODOPAG, rigp.get_int(PART_TIPOPAG));
|
||||
set_row_currency(sheet, row, S_RITFIS, pag.get_real(PAGSCA_RITENUTE));
|
||||
set_row_currency(sheet, row, S_RITSOC, pag.get_real(PAGSCA_RITSOC));
|
||||
sheet.set_row_cell(row, S_SALDO, (good_rat && pag.get_char(PAGSCA_ACCSAL)=='S') ? "X" : "");
|
||||
sheet.set_row_cell(row, S_MODOPAG, rigp.get_int(PART_TIPOPAG));
|
||||
sheet.set_row_cell_currency(row, S_RITFIS, pag.get_real(PAGSCA_RITENUTE));
|
||||
sheet.set_row_cell_currency(row, S_RITSOC, pag.get_real(PAGSCA_RITSOC));
|
||||
|
||||
set_row_int(sheet, row, S_ANNO, game.anno());
|
||||
set_row_str(sheet, row, S_PARTITA, game.numero());
|
||||
set_row_int(sheet, row, S_RIGAF, nriga);
|
||||
set_row_int(sheet, row, S_RATA, nrata);
|
||||
set_row_str(sheet, row, S_MODOPAG, rigp.get(PART_TIPOPAG));
|
||||
sheet.set_row_cell(row, S_ANNO, game.anno());
|
||||
sheet.set_row_cell(row, S_PARTITA, game.numero());
|
||||
sheet.set_row_cell(row, S_RIGAF, nriga);
|
||||
sheet.set_row_cell(row, S_RATA, nrata);
|
||||
sheet.set_row_cell(row, S_MODOPAG, rigp.get(PART_TIPOPAG));
|
||||
if (good_rat)
|
||||
{
|
||||
set_row_str(sheet, row, S_DATAPAG, rigp.get(PART_DATAPAG));
|
||||
}
|
||||
sheet.set_row_cell(row, S_DATAPAG, rigp.get_date(PART_DATAPAG));
|
||||
else
|
||||
{
|
||||
set_row_str(sheet, row, S_DATASCAD, rigp.get(PART_DATAPAG));
|
||||
sheet.set_row_cell(row, S_DATASCAD, rigp.get_date(PART_DATAPAG));
|
||||
|
||||
const int nrow = sheet.items()-1;
|
||||
|
||||
sheet.disable_cell(nrow, S_SALDO);
|
||||
}
|
||||
}
|
||||
@ -997,14 +983,14 @@ void TEasySolder_mask::calcola_residuo()
|
||||
{
|
||||
if (in_val)
|
||||
{
|
||||
_tot_val += get_row_real(s, *row, S_IMPORTO);
|
||||
_tot_eur += get_row_real(s, *row, S_IMPORTO_EUR);
|
||||
_tot_val += s.get_real_row_cell(*row, S_IMPORTO);
|
||||
_tot_eur += s.get_real_row_cell(*row, S_IMPORTO_EUR);
|
||||
}
|
||||
else
|
||||
{
|
||||
_tot_eur += get_row_real(s, *row, S_IMPORTO);
|
||||
_tot_eur += get_row_real(s, *row, S_RITFIS);
|
||||
_tot_eur += get_row_real(s, *row, S_RITSOC) * segno_ritsoc;
|
||||
_tot_eur += s.get_real_row_cell(*row, S_IMPORTO);
|
||||
_tot_eur += s.get_real_row_cell(*row, S_RITFIS);
|
||||
_tot_eur += s.get_real_row_cell(*row, S_RITSOC) * segno_ritsoc;
|
||||
|
||||
_tot_val = _tot_eur;
|
||||
}
|
||||
@ -1013,9 +999,9 @@ void TEasySolder_mask::calcola_residuo()
|
||||
|
||||
void TEasySolder_mask::aggiorna_residuo()
|
||||
{
|
||||
const TCausale& caus = app().causale();
|
||||
const TCausale & caus = app().causale();
|
||||
const real segno_ritsoc = caus.sezione_clifo() == caus.sezione_ritsoc() ? UNO : -UNO;
|
||||
const TSheet_field& s = sfield(G_SHEET);
|
||||
TSheet_field & s = sfield(G_SHEET);
|
||||
const bool in_val = in_valuta();
|
||||
|
||||
real totval, toteur;
|
||||
@ -1023,16 +1009,16 @@ void TEasySolder_mask::aggiorna_residuo()
|
||||
{
|
||||
if (in_val)
|
||||
{
|
||||
totval += get_row_real(s, *row, S_IMPORTO);
|
||||
toteur += get_row_real(s, *row, S_IMPORTO_EUR);
|
||||
totval += s.get_real_row_cell(*row, S_IMPORTO);
|
||||
toteur += s.get_real_row_cell(*row, S_IMPORTO_EUR);
|
||||
}
|
||||
else
|
||||
{
|
||||
toteur += get_row_real(s, *row, S_IMPORTO);
|
||||
toteur += s.get_real_row_cell(*row, S_IMPORTO);
|
||||
|
||||
// Gestisco le ritenute solo per i movimenti in Euro
|
||||
toteur += get_row_real(s, *row, S_RITFIS); // Ritfis ha sempre la sezione dell'importo
|
||||
toteur += get_row_real(s, *row, S_RITSOC) * segno_ritsoc; // Ritsoc puo' avere segno contrario
|
||||
toteur += s.get_real_row_cell(*row, S_RITFIS); // Ritfis ha sempre la sezione dell'importo
|
||||
toteur += s.get_real_row_cell(*row, S_RITSOC) * segno_ritsoc; // Ritsoc puo' avere segno contrario
|
||||
}
|
||||
}
|
||||
|
||||
@ -1050,7 +1036,8 @@ void TEasySolder_mask::aggiorna_residuo()
|
||||
void TEasySolder_mask::fill_sheet()
|
||||
{
|
||||
TSheet_field& s = sfield(G_SHEET);
|
||||
s.destroy();
|
||||
|
||||
s.destroy();
|
||||
|
||||
const TString& codval = get(G_VALUTA);
|
||||
const real cambio = get(G_CAMBIO);
|
||||
@ -1150,7 +1137,7 @@ void TEasySolder_mask::init(const TBill& conto, long numreg, int numrig)
|
||||
for (short id = G_ABI; id <= G_DESCONTOC; id++)
|
||||
show(id, _tipomov != tm_nota_credito);
|
||||
|
||||
if (_tree == NULL)
|
||||
if (_tree == nullptr)
|
||||
{
|
||||
_tree = new TSolder_tree;
|
||||
tfield(G_PARTITE).set_tree(_tree);
|
||||
@ -1160,12 +1147,11 @@ void TEasySolder_mask::init(const TBill& conto, long numreg, int numrig)
|
||||
}
|
||||
|
||||
TEasySolder_mask::TEasySolder_mask(const TBill& conto, long numreg, int numrig)
|
||||
: TAutomask("cg2100e"), _tree(NULL)
|
||||
: TAutomask("cg2100e"), _tree(nullptr)
|
||||
{ init(conto, numreg, numrig); }
|
||||
|
||||
TEasySolder_mask::~TEasySolder_mask()
|
||||
{
|
||||
if (_tree != NULL)
|
||||
delete _tree;
|
||||
SAFE_DELETE(_tree);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
PAGE "RIGA IVA" -1 -1 78 13
|
||||
PAGE "RIGA IVA" -1 -1 78 19
|
||||
|
||||
GROUPBOX DLG_NULL 76 5
|
||||
BEGIN
|
||||
@ -61,47 +61,53 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING IVA_NATURIVA 4
|
||||
BEGIN
|
||||
PROMPT 40 4 "Nat."
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
CURRENCY IVA_IMPOSTA 18
|
||||
BEGIN
|
||||
PROMPT 48 4 "Imposta "
|
||||
HELP "Importo dell'IVA. Se e' nullo, col tasto F8 si puo' effettuare lo scorporo"
|
||||
END
|
||||
|
||||
STRING IVA_NATURIVA 4
|
||||
BEGIN
|
||||
PROMPT 2 6 "Natura"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
BOOLEAN IVA_REVCHARGE
|
||||
BEGIN
|
||||
PROMPT 48 6 "Reverse charge"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 76 5
|
||||
BEGIN
|
||||
PROMPT 1 6 "@BConto"
|
||||
PROMPT 1 8 "@BConto"
|
||||
END
|
||||
|
||||
LIST IVA_TIPO 1 12
|
||||
BEGIN
|
||||
PROMPT 2 7 ""
|
||||
PROMPT 2 9 ""
|
||||
HELP "Tipo del conto"
|
||||
FIELD TIPOC
|
||||
ITEM " |Conto"
|
||||
MESSAGE SHOW,109|HIDE,209|HIDE,309|SHOW,110|HIDE,210|HIDE,310
|
||||
MESSAGE SHOW,IVA_SOTTOCONTO|HIDE,IVA_CLIENTE|HIDE,IVA_FORNITORE|SHOW,IVA_DESCRCONTO|HIDE,IVA_DESCRCONTOC|HIDE,IVA_DESCRCONTOF
|
||||
ITEM "C|Cliente"
|
||||
MESSAGE SHOW,209|HIDE,109|HIDE,309|SHOW,210|HIDE,110|HIDE,310
|
||||
MESSAGE SHOW,IVA_CLIENTE|HIDE,IVA_SOTTOCONTO|HIDE,IVA_FORNITORE|SHOW,IVA_DESCRCONTOC|HIDE,IVA_DESCRCONTO|HIDE,IVA_DESCRCONTOF
|
||||
ITEM "F|Fornitore"
|
||||
MESSAGE SHOW,309|HIDE,109|HIDE,209|SHOW,310|HIDE,110|HIDE,210
|
||||
MESSAGE SHOW,IVA_FORNITORE|HIDE,IVA_SOTTOCONTO|HIDE,IVA_CLIENTE|SHOW,IVA_DESCRCONTOF|HIDE,IVA_DESCRCONTO|HIDE,IVA_DESCRCONTOC
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
NUMBER IVA_GRUPPO 3
|
||||
BEGIN
|
||||
PROMPT 22 7 "Gruppo "
|
||||
PROMPT 22 9 "Gruppo "
|
||||
HELP "Codice del gruppo"
|
||||
FIELD GRUPPO
|
||||
END
|
||||
|
||||
NUMBER IVA_CONTO 3
|
||||
BEGIN
|
||||
PROMPT 38 7 "Conto "
|
||||
PROMPT 38 9 "Conto "
|
||||
FIELD CONTO
|
||||
USE LF_PCON SELECT (CONTO!="")&&(SOTTOCONTO="")
|
||||
INPUT GRUPPO IVA_GRUPPO
|
||||
@ -113,9 +119,9 @@ BEGIN
|
||||
OUTPUT IVA_TIPO TMCF
|
||||
OUTPUT IVA_GRUPPO GRUPPO
|
||||
OUTPUT IVA_CONTO CONTO
|
||||
OUTPUT 110 DESCR
|
||||
OUTPUT IVA_DESCRCONTO DESCR
|
||||
ADD RUN cg0 -0
|
||||
MESSAGE DIRTY,109|DIRTY,209|DIRTY,309
|
||||
MESSAGE DIRTY,IVA_SOTTOCONTO|DIRTY,IVA_CLIENTE|DIRTY,IVA_FORNITORE
|
||||
CHECKTYPE NORMAL
|
||||
WARNING "Conto assente"
|
||||
END
|
||||
@ -123,7 +129,7 @@ END
|
||||
|
||||
NUMBER IVA_SOTTOCONTO 6
|
||||
BEGIN
|
||||
PROMPT 55 7 "Sottoconto "
|
||||
PROMPT 55 9 "Sottoconto "
|
||||
FIELD SOTTOCONTO
|
||||
USE LF_PCON SELECT SOTTOCONTO!=""
|
||||
INPUT GRUPPO IVA_GRUPPO
|
||||
@ -137,27 +143,26 @@ BEGIN
|
||||
OUTPUT IVA_SOTTOCONTO SOTTOCONTO
|
||||
OUTPUT IVA_GRUPPO GRUPPO
|
||||
OUTPUT IVA_CONTO CONTO
|
||||
OUTPUT 110 DESCR
|
||||
OUTPUT IVA_DESCRCONTO DESCR
|
||||
ADD RUN cg0 -0
|
||||
CHECKTYPE NORMAL
|
||||
VALIDATE REQIF_FUNC 1 IVA_IMPONIBILE
|
||||
WARNING "Sottoconto assente"
|
||||
END
|
||||
|
||||
|
||||
NUMBER 209 6
|
||||
NUMBER IVA_CLIENTE 6
|
||||
BEGIN
|
||||
PROMPT 55 7 "Cliente "
|
||||
PROMPT 55 9 "Cliente "
|
||||
HELP "Codice del cliente"
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF 209
|
||||
INPUT CODCF IVA_CLIENTE
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale Cliente@50" RAGSOC
|
||||
DISPLAY "Gruppo" GRUPPO
|
||||
DISPLAY "Conto" CONTO
|
||||
OUTPUT 209 CODCF
|
||||
OUTPUT 210 RAGSOC
|
||||
OUTPUT IVA_CLIENTE CODCF
|
||||
OUTPUT IVA_DESCRCONTOC RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN cg0 -1 C
|
||||
MESSAGE COPY,IVA_SOTTOCONTO
|
||||
@ -165,17 +170,17 @@ BEGIN
|
||||
WARNING "Cliente assente"
|
||||
END
|
||||
|
||||
NUMBER 309 6
|
||||
NUMBER IVA_FORNITORE 6
|
||||
BEGIN
|
||||
PROMPT 55 7 "Fornitore "
|
||||
PROMPT 55 9 "Fornitore "
|
||||
HELP "Codice del fornitore"
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "F"
|
||||
INPUT CODCF 309
|
||||
INPUT CODCF IVA_FORNITORE
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale Fornitore@50" RAGSOC
|
||||
OUTPUT 309 CODCF
|
||||
OUTPUT 310 RAGSOC
|
||||
OUTPUT IVA_FORNITORE CODCF
|
||||
OUTPUT IVA_DESCRCONTOF RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN cg0 -1 F
|
||||
MESSAGE COPY,IVA_SOTTOCONTO
|
||||
@ -183,12 +188,12 @@ BEGIN
|
||||
WARNING "Fornitore assente"
|
||||
END
|
||||
|
||||
STRING 110 50
|
||||
STRING IVA_DESCRCONTO 50
|
||||
BEGIN
|
||||
PROMPT 2 8 "Descrizione "
|
||||
PROMPT 2 10 "Descrizione "
|
||||
FIELD LF_PCON->DESCR
|
||||
USE LF_PCON KEY 2
|
||||
INPUT DESCR 110
|
||||
INPUT DESCR IVA_DESCRCONTO
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Gruppo" GRUPPO
|
||||
DISPLAY "Conto" CONTO
|
||||
@ -198,41 +203,41 @@ BEGIN
|
||||
ADD RUN cg0 -0
|
||||
END
|
||||
|
||||
STRING 210 50
|
||||
STRING IVA_DESCRCONTOC 50
|
||||
BEGIN
|
||||
PROMPT 2 8 "Cliente "
|
||||
PROMPT 2 10 "Cliente "
|
||||
FIELD LF_CLIFO->RAGSOC
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC 210
|
||||
INPUT RAGSOC IVA_DESCRCONTOC
|
||||
DISPLAY "Ragione Sociale Cliente@55" RAGSOC
|
||||
DISPLAY "Gruppo" GRUPPO
|
||||
DISPLAY "Conto" CONTO
|
||||
DISPLAY "Codice" CODCF
|
||||
COPY OUTPUT 209
|
||||
MESSAGE COPY,110
|
||||
COPY OUTPUT IVA_CLIENTE
|
||||
MESSAGE COPY,IVA_DESCRCONTO
|
||||
ADD RUN cg0 -1 C
|
||||
END
|
||||
|
||||
STRING 310 50
|
||||
STRING IVA_DESCRCONTOF 50
|
||||
BEGIN
|
||||
PROMPT 2 8 "Fornitore "
|
||||
PROMPT 2 10 "Fornitore "
|
||||
FIELD LF_PCON->SOTTOCONTO
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "F"
|
||||
INPUT RAGSOC 310
|
||||
INPUT RAGSOC IVA_DESCRCONTOF
|
||||
DISPLAY "Ragione Sociale Fornitore@55" RAGSOC
|
||||
DISPLAY "Gruppo" GRUPPO
|
||||
DISPLAY "Conto" CONTO
|
||||
DISPLAY "Codice" CODCF
|
||||
COPY OUTPUT 309
|
||||
MESSAGE COPY,110
|
||||
COPY OUTPUT IVA_FORNITORE
|
||||
MESSAGE COPY,IVA_DESCRCONTO
|
||||
ADD RUN cg0 -1 F
|
||||
END
|
||||
|
||||
LIST IVA_TIPOCOSTORIC 2 51
|
||||
BEGIN
|
||||
PROMPT 2 9 "Tipo Costo/Ricavo "
|
||||
PROMPT 2 11 "Tipo Costo/Ricavo "
|
||||
ITEM " |0. Acquisti o vendite in genere"
|
||||
ITEM "1|1. Acquisti beni per rivendita"
|
||||
ITEM "2|2. Acquisti beni ammortizzabili"
|
||||
@ -241,14 +246,14 @@ BEGIN
|
||||
ITEM "5|5. Beni per rivendita da non ventilare"
|
||||
ITEM "8|8. Altri beni strumentali acquistati in leasing"
|
||||
ITEM "9|9. Spese generali"
|
||||
ITEM "17|17. Operazioni nei confronti dei condominii"
|
||||
ITEM "17|17. Operazioni nei confronti dei condominii"
|
||||
FLAGS "D"
|
||||
HELP "Tipo Costo/Ricavo del conto"
|
||||
END
|
||||
|
||||
BOOLEAN IVA_NOTAVARECF
|
||||
BEGIN
|
||||
PROMPT 2 15 "Nota di variazione riferita ad anni precedenti (per Elenco Clienti/Fornitori)"
|
||||
PROMPT 2 17 "Nota di variazione riferita ad anni precedenti (per Elenco Clienti/Fornitori)"
|
||||
FIELD NOTAVARECF
|
||||
END
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <sheet.h>
|
||||
#include <tabutil.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <causali.h>
|
||||
|
||||
@ -47,7 +48,7 @@ public:
|
||||
~TProvvisori_msk();
|
||||
};
|
||||
|
||||
TProvvisori_msk* TProvvisori_msk::_msk = NULL;
|
||||
TProvvisori_msk* TProvvisori_msk::_msk = nullptr;
|
||||
|
||||
bool TProvvisori_msk::filter(const TRelation* rel)
|
||||
{
|
||||
@ -96,9 +97,9 @@ TCursor& TProvvisori_msk::update_cursor(bool use_argv)
|
||||
_provv = main_app().argv(2)[0];
|
||||
}
|
||||
|
||||
if (_rel == NULL)
|
||||
if (_rel == nullptr)
|
||||
_rel = new TRelation(LF_MOV);
|
||||
if (_cur == NULL)
|
||||
if (_cur == nullptr)
|
||||
_cur = new TCursor(_rel, "", 2);
|
||||
|
||||
TRectype from_rec(LF_MOV), to_rec(LF_MOV);
|
||||
@ -137,7 +138,7 @@ TCursor_sheet* TProvvisori_msk::get_selection_sheet()
|
||||
sel_items = total;
|
||||
set(F_SELECTED, sel_items); // Aggiorno campo a video
|
||||
|
||||
return sel_items < total ? _sheet : NULL; // Ritorno NULL se tutti selezionati
|
||||
return sel_items < total ? _sheet : nullptr; // Ritorno NULL se tutti selezionati
|
||||
}
|
||||
|
||||
void TProvvisori_msk::update_search(short id, const TString& fil)
|
||||
@ -185,7 +186,7 @@ bool TProvvisori_msk::on_field_event(TOperable_field& o, TField_event e, long jo
|
||||
case DLG_SELECT:
|
||||
if (e == fe_button)
|
||||
{
|
||||
if (_sheet == NULL) // Devo creare sheet di delezione
|
||||
if (_sheet == nullptr) // Devo creare sheet di delezione
|
||||
{
|
||||
TBrowse* br = efield(F_FROMREG).browse(); // Copia intestazione dal campo della maschera!
|
||||
TToken_string head = br->head(); head.insert("@1|"); // Aggiunge prima colonna di selezione
|
||||
@ -196,7 +197,7 @@ bool TProvvisori_msk::on_field_event(TOperable_field& o, TField_event e, long jo
|
||||
update_cursor();
|
||||
_sheet->run(); // Mostra sheet di selezione
|
||||
get_selection_sheet(); // Aggiorna F_SELECTED
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -208,20 +209,17 @@ bool TProvvisori_msk::on_field_event(TOperable_field& o, TField_event e, long jo
|
||||
}
|
||||
|
||||
TProvvisori_msk::TProvvisori_msk()
|
||||
: TAutomask("cg2200a"), _sheet(NULL), _rel(NULL), _cur(NULL), _update_cursor(true)
|
||||
: TAutomask("cg2200a"), _sheet(nullptr), _rel(nullptr), _cur(nullptr), _update_cursor(true)
|
||||
{
|
||||
_msk = this;
|
||||
}
|
||||
|
||||
TProvvisori_msk::~TProvvisori_msk()
|
||||
{
|
||||
_msk = NULL;
|
||||
if (_sheet != NULL)
|
||||
delete _sheet;
|
||||
if (_cur)
|
||||
delete _cur;
|
||||
if (_rel)
|
||||
delete _rel;
|
||||
_msk = nullptr;
|
||||
SAFE_DELETE(_sheet);
|
||||
SAFE_DELETE(_cur);
|
||||
SAFE_DELETE(_rel);
|
||||
}
|
||||
|
||||
class TProvvisori_app : public TSkeleton_application
|
||||
@ -242,8 +240,8 @@ public:
|
||||
void aggiorna_saldi();
|
||||
void aggiorna_analitica(const long numreg);
|
||||
|
||||
bool confirm_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet= NULL);
|
||||
bool delete_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet= NULL);
|
||||
bool confirm_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet= nullptr);
|
||||
bool delete_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet= nullptr);
|
||||
|
||||
void auto_delete(TCursor& cur);
|
||||
|
||||
@ -257,7 +255,7 @@ inline TProvvisori_app& app()
|
||||
|
||||
bool TProvvisori_app::create()
|
||||
{
|
||||
open_files(LF_TAB, LF_MOV, LF_CAUSALI, LF_SALDI, NULL);
|
||||
open_files(LF_TAB, LF_MOV, LF_CAUSALI, LF_SALDI, nullptr);
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
@ -327,7 +325,7 @@ bool TProvvisori_app::confirm_provv(TCursor& cur, TProgind& pi, TCursor_sheet* s
|
||||
TLocalisamfile rmov(LF_RMOV);
|
||||
|
||||
if (sheet && sheet->checked() == 0)
|
||||
sheet = NULL;
|
||||
sheet = nullptr;
|
||||
|
||||
for (cur = 0; cur.pos() < cur.items(); ++cur)
|
||||
{
|
||||
@ -372,7 +370,7 @@ bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sh
|
||||
TLocalisamfile rmoviva(LF_RMOVIVA);
|
||||
|
||||
if (sheet && sheet->checked() == 0)
|
||||
sheet = NULL;
|
||||
sheet = nullptr;
|
||||
|
||||
TString error(256);
|
||||
|
||||
|
@ -127,10 +127,9 @@ void TCompetenze_mask::fill_contc()
|
||||
|
||||
sf.hide();
|
||||
sf.reset();
|
||||
|
||||
_conts.clear();
|
||||
// Per ogni registrazione
|
||||
for (int i = 0; i < _regs.size(); ++i)
|
||||
for (int i = 0; i < (int)_regs.size(); ++i)
|
||||
{
|
||||
const int numreg = _regs[i];
|
||||
rmovs.zero();
|
||||
@ -209,13 +208,14 @@ void TCompetenze_mask::fill()
|
||||
const TDate dataini(1, mese, anno);
|
||||
TDate dataend(dataini); dataend.set_end_month();
|
||||
movs.put(MOV_DATAREG, dataini);
|
||||
if (movs.read() != NULL)
|
||||
if (movs.read() != NOERR)
|
||||
{
|
||||
for (; movs.next() == NOERR && movs.get_date(MOV_DATAREG) <= dataend; )
|
||||
{
|
||||
const int month_liq = movs.get_int(MOV_MESELIQ);
|
||||
const TDate datareg(movs.get(MOV_DATAREG));
|
||||
const TDate datacomp(movs.get(MOV_DATACOMP));
|
||||
|
||||
if (month_liq != 0)
|
||||
{
|
||||
_regs.insert(_regs.end(), movs.get_int(MOV_NUMREG));
|
||||
|
@ -416,7 +416,7 @@ bool TRegistro::read(const char* cod, int year)
|
||||
const TDate oggi(TODAY);
|
||||
year = oggi.year();
|
||||
}
|
||||
if (cod == NULL)
|
||||
if (cod == nullptr)
|
||||
cod = "";
|
||||
|
||||
TString8 chiave; chiave.format("%04d%s", year, cod);
|
||||
@ -537,7 +537,8 @@ real* TRegistro::read_prorata(int anno) const
|
||||
chiave.format("%05ld", prefix().get_codditta());
|
||||
chiave << anno << attivita() << "1";
|
||||
|
||||
real* prorata = NULL;
|
||||
real* prorata = nullptr;
|
||||
|
||||
const TRectype& pla = cache().get("%PLA", chiave);
|
||||
if (!pla.empty())
|
||||
prorata = new real(pla.get("R8"));
|
||||
@ -554,13 +555,13 @@ real TRegistro::prorata(int annodoc)
|
||||
TString16 chiave; chiave << annopro;
|
||||
real* pr = (real*)_prorata.objptr(chiave);
|
||||
|
||||
if (pr == NULL)
|
||||
if (pr == nullptr)
|
||||
{
|
||||
pr = read_prorata(annopro);
|
||||
if (pr == NULL && annopro != annoiva)
|
||||
if (pr == nullptr && annopro != annoiva)
|
||||
pr = read_prorata(annoiva);
|
||||
|
||||
if (pr == NULL)
|
||||
if (pr == nullptr)
|
||||
pr = new real(ZERO);
|
||||
_prorata.add(chiave, pr, true);
|
||||
}
|
||||
@ -715,7 +716,7 @@ real TCodiceIVA::scorpora(real& lordo, int ndec, const char* codval) const
|
||||
real TCodiceIVA::lordo(const real& imponibile, int ndec, const char* codval) const
|
||||
{ return imponibile + imposta(imponibile, ndec, codval); }
|
||||
|
||||
bool TCodiceIVA::reverse_charge() const
|
||||
/* bool TCodiceIVA::reverse_charge() const
|
||||
{
|
||||
const int rsi = regime_speciale();
|
||||
return rsi == 13 || rsi == 50 || rsi == 51; // Reverse charge!
|
||||
@ -725,7 +726,7 @@ bool TCodiceIVA::reverse_charge_pubb() const
|
||||
{
|
||||
const int rsi = regime_speciale();
|
||||
return rsi == 13 || rsi == 19 || rsi == 50 || rsi == 51; // Reverse charge! con aggiunta dienti pubblici
|
||||
}
|
||||
} */
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TBill
|
||||
@ -760,7 +761,7 @@ const TBill& TBill::get(TToken_string& s, int from, int mode)
|
||||
else
|
||||
_tipo = ' ';
|
||||
|
||||
if (strchr(" CF", _tipo) == NULL)
|
||||
if (strchr(" CF", _tipo) == nullptr)
|
||||
{
|
||||
#ifdef DBG
|
||||
error_box(FR("Tipo conto errato: '%c'"), _tipo);
|
||||
@ -831,41 +832,40 @@ const char* TBill::field_name(int n, const TRectype& r, bool contro) const
|
||||
{
|
||||
CHECKD(n >= 0 && n <= 3, "Invalid bill field ", n);
|
||||
|
||||
const char* f = NULL;
|
||||
if (contro)
|
||||
{
|
||||
CHECKD(r.num() == LF_RMOV || r.num() == LF_PAGSCA, "Record non valido per contropartita: ", r.num());
|
||||
switch(n)
|
||||
{
|
||||
case 0: f = RMV_GRUPPOC; break;
|
||||
case 1: f = RMV_CONTOC; break;
|
||||
case 2: f = RMV_SOTTOCONTOC; break;
|
||||
default:f = RMV_TIPOCC; break;
|
||||
case 0: return RMV_GRUPPOC; break;
|
||||
case 1: return RMV_CONTOC; break;
|
||||
case 2: return RMV_SOTTOCONTOC; break;
|
||||
default:return RMV_TIPOCC; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(n)
|
||||
{
|
||||
case 0: f = RMV_GRUPPO; break;
|
||||
case 1: f = RMV_CONTO; break;
|
||||
case 0: return RMV_GRUPPO; break;
|
||||
case 1: return RMV_CONTO; break;
|
||||
case 2:
|
||||
if (r.num() == LF_CLIFO)
|
||||
f = CLI_CODCF;
|
||||
return CLI_CODCF;
|
||||
else
|
||||
f = RMV_SOTTOCONTO;
|
||||
return RMV_SOTTOCONTO;
|
||||
break;
|
||||
default:
|
||||
switch(r.num())
|
||||
{
|
||||
case LF_CLIFO : f = CLI_TIPOCF; break;
|
||||
case LF_RCAUSALI: f = RCA_TIPOCF; break;
|
||||
default : f = RMV_TIPOC; break;
|
||||
case LF_CLIFO : return CLI_TIPOCF; break;
|
||||
case LF_RCAUSALI: return RCA_TIPOCF; break;
|
||||
default : return RMV_TIPOC; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return f;
|
||||
return "";
|
||||
}
|
||||
|
||||
void TBill::put(TRectype& r, bool c) const
|
||||
@ -887,7 +887,7 @@ bool TBill::get(const TRectype& r, bool c)
|
||||
r.get_long(field_name(2, r, c)),
|
||||
t);
|
||||
|
||||
set_description(NULL);
|
||||
set_description(nullptr);
|
||||
_tipo_cr = -1;
|
||||
_sezione = ' ';
|
||||
|
||||
@ -1059,8 +1059,9 @@ int TBill::tipo_att()
|
||||
const TString& TBill::descrizione() const
|
||||
{
|
||||
TBill& myself = (TBill&)*this;
|
||||
|
||||
// Se il conto e' valido (c'e' almeno il gruppo) cerca la sua descrizione su file
|
||||
if ((_descrizione == NULL || _descrizione->blank()) &&
|
||||
if ((_descrizione == nullptr || _descrizione->blank()) &&
|
||||
(gruppo() != 0 || (tipo() > ' ' && codclifo()>0)))
|
||||
{
|
||||
if (!myself.find())
|
||||
@ -1223,4 +1224,3 @@ const char* num2str(const TString& s)
|
||||
}
|
||||
return (const char*)str;
|
||||
}
|
||||
|
||||
|
@ -162,19 +162,20 @@ public: // TObject
|
||||
bool sospeso() const { return get_bool("B2"); }
|
||||
bool escluso_esenti() const { return get_bool("B5"); }
|
||||
bool numeratore_pro_rata() const { return get_bool("B6"); }
|
||||
bool denominatore_pro_rata() const { return get_bool("B7"); }
|
||||
bool denominatore_pro_rata() const { return get_bool("B7"); }
|
||||
bool reverse_charge_attivo() const { return get_bool("B8"); }
|
||||
|
||||
real imposta(const real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Calcola l'imposta sull'imponibile l'imposta e la ritorna
|
||||
real scorpora(real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Scorpora dall'imponibile l'imposta e la ritorna
|
||||
real lordo(const real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Calcola il lordo dell'imponibile l'imposta e la ritorna
|
||||
|
||||
bool reverse_charge() const;
|
||||
bool reverse_charge_pubb() const;
|
||||
// bool reverse_charge() const;
|
||||
// bool reverse_charge_pubb() const;
|
||||
int regime_speciale() const { return get_int("I5");}
|
||||
|
||||
const TString& natura() const { return get("S12"); }
|
||||
|
||||
TCodiceIVA(const char* codice = NULL);
|
||||
TCodiceIVA(const char* codice = nullptr);
|
||||
TCodiceIVA(const TRectype & rec) : TRectype(rec) {}
|
||||
TCodiceIVA(const TCodiceIVA & iva) : TRectype(iva) {}
|
||||
virtual ~TCodiceIVA() {}
|
||||
@ -205,27 +206,27 @@ public: // TObject
|
||||
virtual bool ok() const; // Gruppo, Conto e Sottoconto non nulli
|
||||
|
||||
public:
|
||||
TBill(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL, int r = -1)
|
||||
: _tipo(t), _gruppo(g), _conto(c), _sottoconto(s), _descrizione(NULL),
|
||||
TBill(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = nullptr, int r = -1)
|
||||
: _tipo(t), _gruppo(g), _conto(c), _sottoconto(s), _descrizione(nullptr),
|
||||
_sezione(' '), _sospeso(false)
|
||||
{ set(g,c,s,t,d,r);}
|
||||
|
||||
TBill(TToken_string& tgcsd, int from, int mode = 0)
|
||||
: _descrizione(NULL), _sezione(' '), _sospeso(false)
|
||||
: _descrizione(nullptr), _sezione(' '), _sospeso(false)
|
||||
{ get(tgcsd, from, mode); }
|
||||
|
||||
TBill(const TRectype& rec, bool contro = false)
|
||||
: _descrizione(NULL), _sezione(' '), _sospeso(false)
|
||||
: _descrizione(nullptr), _sezione(' '), _sospeso(false)
|
||||
{ get(rec, contro); }
|
||||
|
||||
TBill(const TBill& b)
|
||||
: _descrizione(NULL)
|
||||
: _descrizione(nullptr)
|
||||
{ copy(b); }
|
||||
|
||||
virtual ~TBill();
|
||||
|
||||
const TBill& set(int g = 0, int c = 0, long s = 0L, char t = ' ',
|
||||
const char* d = NULL, int r = -1);
|
||||
const char* d = nullptr, int r = -1);
|
||||
|
||||
const TBill& get(TToken_string& ts, int from, int mode = 0);
|
||||
const TBill& add_to(TToken_string& ts, int from, int mode = 0);
|
||||
|
@ -222,7 +222,7 @@ bool TSaldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDat
|
||||
cur.freeze();
|
||||
|
||||
// Anche se non movimentato vado a vedere il saldo
|
||||
if ((provv & 0x1) && (filter == NULL || *filter == '\0'))
|
||||
if ((provv & 0x1) && (filter == nullptr || *filter == '\0'))
|
||||
_saldo = calcola_saldo_iniziale(g,c,s,indbil,provv);
|
||||
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
@ -516,18 +516,13 @@ const real& TSaldo::saldo_periodo(int g, int c, long s, const TDate& dal, const
|
||||
{
|
||||
cur.freeze();
|
||||
|
||||
TProgind* p = NULL;
|
||||
if (items > 100) // E' proprio utile la progind?
|
||||
{
|
||||
TString80 prompt;
|
||||
prompt.format(FR("Calcolo saldo del conto %d.%d.%ld"), g, c, s);
|
||||
p = new TProgind(items, prompt, false);
|
||||
}
|
||||
TString80 prompt;
|
||||
prompt.format(FR("Calcolo saldo del conto %d.%d.%ld"), g, c, s);
|
||||
TProgress_monitor p(items, prompt, false);
|
||||
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
if (p != NULL)
|
||||
p->addstatus(1L);
|
||||
p.addstatus(1L);
|
||||
|
||||
const long num_reg = rmov.get_long(RMV_NUMREG);
|
||||
const real importo = rmov.get_real(RMV_IMPORTO);
|
||||
@ -569,10 +564,6 @@ const real& TSaldo::saldo_periodo(int g, int c, long s, const TDate& dal, const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (p != NULL)
|
||||
delete p;
|
||||
}
|
||||
_saldo = _saldo_iniziale + _prg_dare - _prg_avere;
|
||||
return _saldo;
|
||||
@ -667,18 +658,13 @@ bool TSaldo::saldo_cont_sep(int g, int c, long s, const int codes, TDate al,
|
||||
{
|
||||
cur.freeze();
|
||||
|
||||
TProgind* p = NULL;
|
||||
if (items > 100) // E' proprio utile la progind?
|
||||
{
|
||||
TString80 prompt;
|
||||
prompt.format(FR("Calcolo saldo del conto %d.%d.%ld"), g, c, s);
|
||||
p = new TProgind(items, prompt, false);
|
||||
}
|
||||
TString80 prompt;
|
||||
prompt.format(FR("Calcolo saldo del conto %d.%d.%ld"), g, c, s);
|
||||
TProgress_monitor p(items, prompt, false);
|
||||
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
if (p != NULL)
|
||||
p->addstatus(1L);
|
||||
p.addstatus(1L);
|
||||
|
||||
const long num_reg = rmov.get_long(RMV_NUMREG);
|
||||
const real importo = rmov.get_real(RMV_IMPORTO);
|
||||
@ -691,7 +677,7 @@ bool TSaldo::saldo_cont_sep(int g, int c, long s, const int codes, TDate al,
|
||||
|
||||
if (ok)
|
||||
{
|
||||
if (( cont_sep != NULL && *cont_sep == '\0') || mov.get(MOV_CONTSEP) == cont_sep)
|
||||
if (( cont_sep != nullptr && *cont_sep == '\0') || mov.get(MOV_CONTSEP) == cont_sep)
|
||||
{
|
||||
_codcaus = mov.get(MOV_CODCAUS);
|
||||
_datareg = mov.get(MOV_DATAREG);
|
||||
@ -739,8 +725,6 @@ bool TSaldo::saldo_cont_sep(int g, int c, long s, const int codes, TDate al,
|
||||
NFCHECK("Testata assente: %ld", num_reg);
|
||||
}
|
||||
}
|
||||
if (p != NULL)
|
||||
delete p;
|
||||
}
|
||||
_saldo = _saldo_iniziale + _prg_dare - _prg_avere;
|
||||
return _movimentato;
|
||||
@ -759,7 +743,7 @@ public:
|
||||
|
||||
bool scaricato() const { return _scaricato; }
|
||||
|
||||
TContoExt(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL, bool sc = false)
|
||||
TContoExt(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = nullptr, bool sc = false)
|
||||
: TConto(g, c, s, t, d), _scaricato(sc) {}
|
||||
TContoExt(TToken_string& tgcsd, int from, int mode = 0, bool sc = false)
|
||||
: TConto(tgcsd, from, mode), _scaricato(sc) {}
|
||||
@ -777,8 +761,9 @@ TConto* TTab_conti::add(const TBill& c, int anno, bool scar)
|
||||
{
|
||||
const TString& key = build_key(c, anno, scar);
|
||||
TContoExt* tc = new TContoExt(c.gruppo(), c.conto(), c.sottoconto(),
|
||||
c.tipo(), NULL, scar);
|
||||
c.tipo(), nullptr, scar);
|
||||
TAssoc_array::add(key, tc);
|
||||
|
||||
return tc;
|
||||
}
|
||||
|
||||
@ -800,7 +785,8 @@ void TTab_conti::aggiorna_conto(const TBill& tcon,
|
||||
char provv, bool somma, bool movimentato, bool scaricato)
|
||||
{
|
||||
TContoExt* tc = (TContoExt*)find(tcon, anno_es, scaricato);
|
||||
if (tc == NULL)
|
||||
|
||||
if (tc == nullptr)
|
||||
tc = (TContoExt*)add(tcon, anno_es, scaricato);
|
||||
|
||||
const real i(somma ? importo.valore() : -importo.valore());
|
||||
|
@ -21,7 +21,7 @@ class TConto : public TBill
|
||||
TImporto _saldo_finale;
|
||||
|
||||
public:
|
||||
TConto(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL)
|
||||
TConto(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = nullptr)
|
||||
: TBill(g, c, s, t, d) {}
|
||||
TConto (TToken_string& tgcsd, int from, int mode = 0)
|
||||
: TBill(tgcsd, from, mode) {}
|
||||
@ -129,7 +129,7 @@ public:
|
||||
|
||||
bool ultima_immissione_bilancio(int annoes, int g,int c,long s,int indbil,int provv = 0x1,bool saldo_chiusura = true);
|
||||
bool ultima_immissione_verifica(int annoes, int g,int c,long s,int indbil,int provv = 0x1);
|
||||
bool data_limite_bilancio(int annoes,int g,int c,long s,const TDate& data_inf,const TDate& data_suo,int indbil, int provv = 0x1, const char* filter = NULL);
|
||||
bool data_limite_bilancio(int annoes,int g,int c,long s,const TDate& data_inf,const TDate& data_suo,int indbil, int provv = 0x1, const char* filter = nullptr);
|
||||
const real& saldo_periodo(int g, int c, long s, const TDate& dal, const TDate& al, int indbil, int provv = 0x1);
|
||||
bool saldo_cont_sep(int g, int c, long s, const int codes, TDate al, int indbil, const char * cont_sep, int provv = 0x1, bool chiusura = false, bool first = true);
|
||||
bool ricerca_progr_prec(int, int, int, long);
|
||||
|
@ -117,13 +117,17 @@ bool gestione_IVAxCassa(const TDate& data_mov, long firm)
|
||||
const TDate data = data_mov.ok() ? data_mov : TDate(TODAY);
|
||||
const int anno = data.year();
|
||||
bool yes = anno >= 2012 && dongle().active(ICAUT) && dongle().active(SCAUT);
|
||||
|
||||
if (yes)
|
||||
{
|
||||
if (firm <= 0)
|
||||
firm = prefix().get_codditta();
|
||||
TString16 codtab;
|
||||
TString16 codtab;
|
||||
|
||||
codtab.format("%05ld%04d", firm, anno);
|
||||
|
||||
const TRectype& lia = cache().get("%LIA", codtab);
|
||||
|
||||
yes = lia.get_bool("B5");
|
||||
if (yes)
|
||||
{
|
||||
@ -532,4 +536,3 @@ TIva_round::TIva_round()
|
||||
_mode = _def_mode;
|
||||
_decimals = _def_decimals;
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
const int sizeT = 256; //Lunghezza del record del TRASFER
|
||||
const int sizeH = 1024; //Lunghezza del record dell'HEADER
|
||||
const size_t sizeT = 256; //Lunghezza del record del TRASFER
|
||||
const size_t sizeH = 1024; //Lunghezza del record dell'HEADER
|
||||
|
||||
const int RIC_SIZE = 512;
|
||||
|
||||
@ -476,7 +476,7 @@ bool TTransfer_file::read_control_rec()
|
||||
|
||||
// va all'inizio del file
|
||||
fseek(_trasfer, 0L, SEEK_SET);
|
||||
const word letti = fread(_control_rec->get_buffer(sizeH), 1, sizeH, _trasfer);
|
||||
const size_t letti = fread(_control_rec->get_buffer(sizeH), 1, sizeH, _trasfer);
|
||||
_control_rec->cut(sizeH);
|
||||
|
||||
_tiporec = _control_rec->left(2);
|
||||
@ -506,7 +506,7 @@ bool TTransfer_file::read_control_rec_t()
|
||||
|
||||
// va all'inizio del file
|
||||
fseek (_trasfer, 0L, SEEK_SET);
|
||||
const word letti = fread((char*)(const char*)_control_rec_t,sizeof(char),sizeT,_trasfer);
|
||||
const size_t letti = fread((char*)(const char*)_control_rec_t,sizeof(char),sizeT,_trasfer);
|
||||
|
||||
_tiporec = _control_rec_t.sub(0,2);
|
||||
|
||||
@ -3029,7 +3029,7 @@ bool TTransfer_file::ordina_trasfer(const char* orig)
|
||||
|
||||
while (ok)
|
||||
{
|
||||
const word letti = fread(buffer.get_buffer(), 1, sizeT, i);
|
||||
const size_t letti = fread(buffer.get_buffer(), 1, sizeT, i);
|
||||
buffer.cut(sizeT);
|
||||
|
||||
// A causa di errori di invio da parte del sistema
|
||||
|
@ -46,17 +46,6 @@ TDate TPagamento::_rata_dfield(int n, int f) const
|
||||
return v;
|
||||
}
|
||||
|
||||
/* Funzione sgradita al nuovo C ed anche a Guy: static bleah!
|
||||
const char* TPagamento::_rata_sfield(int n, int f) const
|
||||
{
|
||||
TToken_string& t = (TToken_string&)_rate[n];
|
||||
TString & s = get_tmp_string(30);
|
||||
|
||||
s = t.get(f);
|
||||
return s;
|
||||
}
|
||||
*/
|
||||
|
||||
// Funzione digeribile dal nuovo C
|
||||
const TString& TPagamento::_rata_sfield(int n, int f) const
|
||||
{
|
||||
@ -88,7 +77,7 @@ void TPagamento::set_inizio(const TDate& d, bool rispetta_date)
|
||||
next_scad(data, scad_rata(0), _mcomm, 0);
|
||||
|
||||
bool dummy;
|
||||
recalc_rate(0, false, NULL, NULL, data.string(), NULL, NULL, _rdiff, _mcomm, dummy);
|
||||
recalc_rate(0, false, nullptr, nullptr, data.string(), nullptr, nullptr, _rdiff, _mcomm, dummy);
|
||||
}
|
||||
|
||||
void TPagamento::set_intervallo_rate(int in)
|
||||
@ -568,15 +557,16 @@ TToken_string& TPagamento::set_rata (int index, real perc, int day, int type,
|
||||
bool val, const char* ulc, const char* imp, const char* data)
|
||||
{
|
||||
TToken_string* tt = (TToken_string*)_rate.objptr(index);
|
||||
const bool nwr = (tt == NULL);
|
||||
const bool nwr = (tt == nullptr);
|
||||
|
||||
if (nwr) tt = new TToken_string(64);
|
||||
|
||||
tt->add(day,0); // scadenza
|
||||
tt->add(perc.string(),1); // percentuale
|
||||
tt->add(type,2); // tipo
|
||||
tt->add(data == NULL ? "" : data, 3);
|
||||
tt->add(imp == NULL ? "" : imp, val ? 4 : 7);
|
||||
tt->add(ulc == NULL ? "" : ulc, 5);
|
||||
tt->add(data == nullptr ? "" : data, 3);
|
||||
tt->add(imp == nullptr ? "" : imp, val ? 4 : 7);
|
||||
tt->add(ulc == nullptr ? "" : ulc, 5);
|
||||
|
||||
if (!nwr)
|
||||
{
|
||||
@ -634,8 +624,7 @@ TToken_string& TPagamento::set_rata(int index, const real& impval, const real& i
|
||||
// calcola percentuali e scadenze a partire dagli importi
|
||||
TToken_string* tt = _rate.rowptr(index);
|
||||
const int first = _tpr < 4 ? 0 : 1;
|
||||
|
||||
const bool nwr = (tt == NULL); // nuova rata
|
||||
const bool nwr = (tt == nullptr); // nuova rata
|
||||
|
||||
if (nwr) tt = new TToken_string(64);
|
||||
|
||||
@ -827,8 +816,10 @@ const char* TPagamento::desc_tpr() const
|
||||
|
||||
const char* TPagamento::desc_tipo(int tipo, char ulc, bool* ok) const
|
||||
{
|
||||
const char* o = "";
|
||||
if (ok != NULL) *ok = true;
|
||||
const char* o = "";
|
||||
|
||||
if (ok != nullptr)
|
||||
*ok = true;
|
||||
if (ulc > ' ')
|
||||
{
|
||||
// const char key[3] = { tipo+'0', toupper(ulc), '\0' };
|
||||
@ -849,7 +840,10 @@ const char* TPagamento::desc_tipo(int tipo, char ulc, bool* ok) const
|
||||
case 7: o = TR("Tratta accettata"); break;
|
||||
case 8: o = TR("Rapporti interban. diretti"); break;
|
||||
case 9: o = TR("Bonifici"); break;
|
||||
default: if (ok != NULL) *ok = false; break;
|
||||
default:
|
||||
if (ok != nullptr)
|
||||
*ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return o;
|
||||
@ -867,7 +861,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
||||
// possibile modificare entrambi; se succede viene data
|
||||
// priorita' alla percentuale.
|
||||
{
|
||||
CHECK(!(!is_perc_modified && (new_value != NULL || new_lire != NULL) && !_inited),
|
||||
CHECK(!(!is_perc_modified && (new_value != nullptr || new_lire != nullptr) && !_inited),
|
||||
"A'stronzo! E famme 'na pippa! Me dai n'importo che nun ce sta? Ma Vaffanculo!");
|
||||
|
||||
if (_rate.items() == 0) return P_OK;
|
||||
@ -887,7 +881,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
||||
{
|
||||
if (i == row)
|
||||
{
|
||||
if (typ != NULL)
|
||||
if (typ != nullptr)
|
||||
{
|
||||
for (int k = 0; k < srate.items(); k++)
|
||||
{
|
||||
@ -907,7 +901,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
||||
}
|
||||
}
|
||||
|
||||
if (ulc != NULL)
|
||||
if (ulc != nullptr)
|
||||
{
|
||||
for (int k = 0; k < srate.items(); k++)
|
||||
{
|
||||
@ -924,8 +918,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scad != NULL)
|
||||
if (scad != nullptr)
|
||||
{
|
||||
// if !_inited scad e' il n. giorni, se no e' la rata
|
||||
if (_inited)
|
||||
@ -982,14 +975,14 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
||||
}
|
||||
}
|
||||
|
||||
if (new_value != NULL)
|
||||
if (new_value != nullptr)
|
||||
{
|
||||
need_recalc = true;
|
||||
// questa la subappaltiamo, per evitare l'inferno
|
||||
return change_value(row, real(new_value), rdiff, is_perc_modified, mcomm, true);
|
||||
}
|
||||
|
||||
if (new_lire != NULL)
|
||||
if (new_lire != nullptr)
|
||||
{
|
||||
need_recalc = true;
|
||||
// questa pure la subappaltiamo, sempre per evitare l'inferno
|
||||
@ -1001,7 +994,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
||||
if (rdiff == 2)
|
||||
continue;
|
||||
|
||||
if (scad != NULL)
|
||||
if (scad != nullptr)
|
||||
{
|
||||
// check sulle scadenze solo se si sono modificate
|
||||
lastdate = data_rata(i);
|
||||
@ -1475,7 +1468,8 @@ bool TPagamento::read(TTable* t, TTable* r)
|
||||
{
|
||||
// puo' chiamarla chiunque
|
||||
bool istnew = false;
|
||||
if (t == NULL)
|
||||
|
||||
if (t == nullptr)
|
||||
{
|
||||
t = new TTable("%CPG");
|
||||
istnew = true;
|
||||
@ -1506,7 +1500,8 @@ bool TPagamento::read(TTable* t, TTable* r)
|
||||
|
||||
// leggi rate e scadenze
|
||||
bool isrnew = false;
|
||||
if (r == NULL)
|
||||
|
||||
if (r == nullptr)
|
||||
{
|
||||
r = new TTable("%RPG");
|
||||
isrnew = true;
|
||||
@ -1694,7 +1689,7 @@ void TPagamento::set_total(const real& ib, const real& im, const real& sp)
|
||||
{
|
||||
_in_valuta = false;
|
||||
_firstr = _secndr = ZERO; // Azzera importi in valuta
|
||||
init_total(ib, im, sp, NULL); // setta regolarmente totali in lire
|
||||
init_total(ib, im, sp, nullptr); // setta regolarmente totali in lire
|
||||
}
|
||||
|
||||
void TPagamento::set_total_valuta(const real& ib, const real& im, const real& sp, const real& c,
|
||||
@ -1705,7 +1700,7 @@ void TPagamento::set_total_valuta(const real& ib, const real& im, const real&
|
||||
|
||||
_in_valuta = true;
|
||||
// setta regolarmente totali in lire
|
||||
init_total(ibl, iml, spl, NULL);
|
||||
init_total(ibl, iml, spl, nullptr);
|
||||
// ripeti tutto con la valuta
|
||||
init_total(ib, im, sp, codval);
|
||||
|
||||
@ -1715,7 +1710,8 @@ void TPagamento::set_total_valuta(const real& ib, const real& im, const real&
|
||||
|
||||
void TPagamento::init_total(const real& ib, const real& im, const real& sp, const char* codval)
|
||||
{
|
||||
const bool valuta = (codval != NULL) && *codval && TCurrency::get_firm_val() != codval;
|
||||
const bool valuta = (codval != nullptr) && *codval && TCurrency::get_firm_val() != codval;
|
||||
|
||||
if (valuta)
|
||||
{
|
||||
const TCurrency cur(ZERO, codval);
|
||||
@ -1986,7 +1982,7 @@ TPagamento::TPagamento(const char* codtab, const char* data) :
|
||||
_def_tpr(1), _def_ulc(""), _was_tpr4(false), _in_valuta(false), _tipocf('C'), _codcf(0L)
|
||||
{
|
||||
_fixd[0] = _fixd[1] = _fixd[2] = 0;
|
||||
if (data != NULL && *data)
|
||||
if (data != nullptr && *data)
|
||||
_inizio = data;
|
||||
else
|
||||
_inizio = TDate(TODAY);
|
||||
|
@ -61,13 +61,14 @@ void TPartite_cache::set_bill(TPartite_array& games, const TBill& conto, long nu
|
||||
TCursor cur(&partite, filter, 1, &rec, &rec);
|
||||
cur.scan(fill_games, this);
|
||||
|
||||
for (TPartita* p = games.first(); p != NULL; p = games.next()) if (!p->is_on_file())
|
||||
for (TPartita* p = games.first(); p != nullptr; p = games.next()) if (!p->is_on_file())
|
||||
add_game(*p);
|
||||
}
|
||||
|
||||
TPartita* TPartite_cache::find(int idx) const
|
||||
{
|
||||
TPartita* g = NULL;
|
||||
TPartita* g = nullptr;
|
||||
|
||||
if (has_game(idx))
|
||||
{
|
||||
const TToken_string& str = row(idx);
|
||||
@ -142,11 +143,13 @@ TPartita* TSolder_tree::partita() const
|
||||
|
||||
TRiga_partite* TSolder_tree::riga_partita() const
|
||||
{
|
||||
TRiga_partite* fatt = NULL;
|
||||
TRiga_partite* fatt = nullptr;
|
||||
|
||||
if (_curr.items() >= 2)
|
||||
{
|
||||
TPartita* g = partita();
|
||||
if (g != NULL)
|
||||
|
||||
if (g != nullptr)
|
||||
{
|
||||
int nriga = 1; _curr.get(1, nriga);
|
||||
if (nriga > 0 && nriga < g->UNASSIGNED)
|
||||
@ -158,11 +161,13 @@ TRiga_partite* TSolder_tree::riga_partita() const
|
||||
|
||||
TRiga_scadenze* TSolder_tree::scadenza() const
|
||||
{
|
||||
TRiga_scadenze* scad = NULL;
|
||||
TRiga_scadenze* scad = nullptr;
|
||||
|
||||
if (_curr.items() >= 3)
|
||||
{
|
||||
TPartita* g = partita();
|
||||
if (g != NULL)
|
||||
|
||||
if (g != nullptr)
|
||||
{
|
||||
int nriga = 1; _curr.get(1, nriga);
|
||||
int nrata = 1; _curr.get(2, nrata);
|
||||
@ -175,11 +180,13 @@ TRiga_scadenze* TSolder_tree::scadenza() const
|
||||
|
||||
TRectype* TSolder_tree::pagamento() const
|
||||
{
|
||||
TRectype* rpag = NULL;
|
||||
TRectype* rpag = nullptr;
|
||||
|
||||
if (_curr.items() >= 4)
|
||||
{
|
||||
TPartita* g = partita();
|
||||
if (g != NULL)
|
||||
|
||||
if (g != nullptr)
|
||||
{
|
||||
int nriga = 1; _curr.get(1, nriga);
|
||||
int nrata = 1; _curr.get(2, nrata);
|
||||
@ -208,7 +215,8 @@ bool TSolder_tree::goto_firstson()
|
||||
return false;
|
||||
|
||||
TPartita* g = partita();
|
||||
if (g == NULL) // Dovrebbe funzionare sempre per level > 0
|
||||
|
||||
if (g == nullptr) // Dovrebbe funzionare sempre per level > 0
|
||||
return false;
|
||||
|
||||
if (level == 1)
|
||||
@ -270,7 +278,8 @@ bool TSolder_tree::goto_rbrother()
|
||||
const int index = _curr.get_int(0);
|
||||
if (level == 1) // Esite la prossima partita?
|
||||
{
|
||||
const bool ok = _cache.find(index+1) != NULL;
|
||||
const bool ok = _cache.find(index+1) != nullptr;
|
||||
|
||||
if (ok)
|
||||
_curr.add(index+1, 0);
|
||||
return ok;
|
||||
@ -343,7 +352,8 @@ bool TSolder_tree::could_have_son() const
|
||||
return false; // Sono su di un pagamento
|
||||
|
||||
const TPartita* g = partita();
|
||||
if (g == NULL)
|
||||
|
||||
if (g == nullptr)
|
||||
return false;
|
||||
|
||||
int riga = 0; _curr.get(1, riga);
|
||||
@ -880,4 +890,3 @@ bool TSolder_tree::goto_single_game(int anno, const char* numpart, int nriga, in
|
||||
// Posiziono l'albero normalmente
|
||||
return goto_game(anno, numpart, nriga, nrata, nrigp);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
bool add_game(const TRectype& rec);
|
||||
bool add_game(const TPartita& part);
|
||||
|
||||
TPartite_cache() : _games(NULL) {}
|
||||
TPartite_cache() : _games(nullptr) {}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -203,6 +203,7 @@ void TValuta::set(const TValuta& v)
|
||||
real TValuta::eur2val(const real& lit) const
|
||||
{
|
||||
TCurrency cur(lit);
|
||||
|
||||
cur.change_value(_cod, _cam);
|
||||
return cur.get_num();
|
||||
}
|
||||
@ -210,6 +211,7 @@ real TValuta::eur2val(const real& lit) const
|
||||
real TValuta::val2eur(const real& val) const
|
||||
{
|
||||
TCurrency cur(val, _cod, _cam);
|
||||
|
||||
cur.change_to_firm_val();
|
||||
return cur.get_num();
|
||||
}
|
||||
@ -217,6 +219,7 @@ real TValuta::val2eur(const real& val) const
|
||||
void TValuta::val2eur(real& val) const
|
||||
{
|
||||
TCurrency cur(val, _cod, _cam);
|
||||
|
||||
cur.change_to_firm_val();
|
||||
val = cur.get_num();
|
||||
}
|
||||
@ -313,15 +316,13 @@ TImporto TPartita::importo_pagsca(const TRectype& pag, bool val, int mode) const
|
||||
|
||||
const TRiga_partite& sum = riga(nrigp);
|
||||
|
||||
// Inizio aggiunte di Bonazzi del 16/02/2012
|
||||
if (mode & 0x10) // solo le note di credito
|
||||
{
|
||||
const tipo_movimento tm = sum.tipo();
|
||||
if (tm != tm_nota_credito)
|
||||
return totale; // = ZERO
|
||||
}
|
||||
// Fine aggiunte di Bonazzi del 16/02/2012
|
||||
|
||||
|
||||
const bool in_val = sum.in_valuta();
|
||||
const char* imp_field = (val && in_val) ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO;
|
||||
|
||||
@ -1228,7 +1229,7 @@ int TRiga_partite::calcola_pagato_periodo(const TDate& dal, const TDate& al, TIm
|
||||
pg += imp;
|
||||
flag |= 1;
|
||||
}
|
||||
if (pagsca != NULL)
|
||||
if (pagsca != nullptr)
|
||||
pagsca->add(obj);
|
||||
}
|
||||
|
||||
@ -1242,7 +1243,7 @@ int TRiga_partite::calcola_pagato_periodo(const TDate& dal, const TDate& al, TIm
|
||||
// Filtra le righe saldo per non creare array di 9999 elementi nulli!
|
||||
int TRiga_partite_array::add_row(TRectype* row)
|
||||
{
|
||||
if (row == NULL)
|
||||
if (row == nullptr)
|
||||
return -1;
|
||||
if (row->get_int(PART_NRIGA) >= TPartita::UNASSIGNED)
|
||||
{
|
||||
@ -1480,7 +1481,7 @@ int TPartita::write_saldo(bool re, TRectype* rec) const
|
||||
// sld.put(PART_CHIUSA, row.get(PART_CHIUSA)); // Copia il flag di chiusura
|
||||
sld.put(PART_CHIUSA, chiusa(true));
|
||||
|
||||
if (rec != NULL)
|
||||
if (rec != nullptr)
|
||||
*rec = sld;
|
||||
|
||||
// Scrittura del record di saldo
|
||||
@ -2340,7 +2341,8 @@ TPartita* TPartite_array::find(const TBill& clifo, int anno, const char* num, bo
|
||||
{
|
||||
const TString& k = key(clifo, anno, num);
|
||||
TPartita* p = (TPartita*)objptr(k);
|
||||
if (p == NULL && create)
|
||||
|
||||
if (p == nullptr && create)
|
||||
{
|
||||
p = new TPartita(clifo, anno, num);
|
||||
add(k, p);
|
||||
@ -2379,9 +2381,11 @@ bool TPartite_array::insert(TPartita* p)
|
||||
{
|
||||
const TString& k = key(p->conto(), p->anno(), p->numero());
|
||||
TPartita* old = (TPartita*)objptr(k);
|
||||
if (old != NULL) remove(k);
|
||||
|
||||
if (old != nullptr)
|
||||
remove(k);
|
||||
add(k, p);
|
||||
return old != NULL;
|
||||
return old != nullptr;
|
||||
}
|
||||
|
||||
bool TPartite_array::destroy(const TBill& clifo, int anno, const char* num)
|
||||
@ -2399,10 +2403,10 @@ bool TPartite_array::destroy(TPartita& game)
|
||||
bool TPartite_array::write(bool re)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
TPartita* game;
|
||||
|
||||
restart();
|
||||
while ((game = (TPartita*)get()) != NULL)
|
||||
while ((game = (TPartita*)get()) != nullptr)
|
||||
{
|
||||
ok = game->write(re);
|
||||
if (!ok) // L'errore viene gia' segnalato dalla partita
|
||||
@ -2506,8 +2510,9 @@ TRiga_partite* TPartite_array::mov2rig(long numreg, int numrig)
|
||||
for (TPartita* game = first(); game; game = next())
|
||||
{
|
||||
const int r = game->mov2rig(numreg, numrig);
|
||||
|
||||
if (r > 0)
|
||||
return &game->riga(r);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
25
|
||||
0
|
||||
$rmoviva|0|0|110|0|Righe movimento IVA|NMOV*2||
|
||||
$rmoviva|0|0|111|0|Righe movimento IVA|NMOV*2||
|
||||
|
@ -1,5 +1,5 @@
|
||||
25
|
||||
19
|
||||
20
|
||||
ANNOES|2|4|0|Codice esercizio
|
||||
NUMREG|3|7|0|Numero operazione
|
||||
NUMRIG|2|3|0|Numero riga
|
||||
@ -19,5 +19,6 @@ SOTTOCONTO|3|6|0|Sottoconto o codice cliente/fornitore
|
||||
CODCMS|1|20|0|Codice Commessa
|
||||
FASCMS|1|10|0|Fase Commessa
|
||||
NAVP|8|1|0|Nota di variazione anni precedenti x Elenco CF
|
||||
REVCHARGE|8|1|0|Riga IVA reverse charge
|
||||
1
|
||||
NUMREG+NUMRIG|
|
||||
|
Loading…
x
Reference in New Issue
Block a user