Patch level : 12.0 640

Files correlati     : cg2.exe
Commento            : Corretti errori di calcolo totale documento nel saldaconto
                      Modificata segnalazione relativi alla data di comeptenza inferiore o UGUALE alla
                      data di chiusura.
                      Segnalato da CRPA. Per movimenti configurati come fatture per il saldaconto ma non
                      IVA
                      es.
                      causale IN6 INCASSATO CONTRIBUTO PROGETTO
                      cercava un campo codice cliente che sulla maschera non c'era.
This commit is contained in:
AlexBonazzi 2018-11-05 20:42:59 +01:00
parent 3535c88e0a
commit d897604657
3 changed files with 105 additions and 45 deletions

View File

@ -509,7 +509,7 @@ real TPrimanota_application::calcola_saldo() const
if (pag)
{
const char tipo = row_type(*r);
if (strchr("ACGKP", tipo) != NULL) // Abbuoni attivi, differenze cambio, spese, ...
if (strchr("GK", tipo) != NULL) // Abbuoni attivi, differenze cambio, spese, ... // (A o P) Abbuoni e (C) Differenze cambio perchè c'erano ? non (T) totolae documento perchè pagamento
saldaconto += importo;
}
}
@ -580,7 +580,10 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
msg << TR("\nSi desidera correggere il totale documento?");
ok = a.cgs().yesno_box(msg);
if (ok)
{
m.set(F_TOTALE, cassa.valore());
a.calcola_saldo();
}
}
return ok;
}
@ -671,7 +674,8 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
}
}
if (errato)
if (errato)
{
TString msg(128);
const TCurrency euro(speso.valore());
@ -699,7 +703,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
return false;
}
}
if (strchr("ACGKPT", tipo) != NULL)
if (strchr("GKT", tipo) != NULL) // Abbuoni attivi, differenze cambio, spese, ... // (A o P) Abbuoni e (C) Differenze cambio perchè c'erano ?
{
saldaconto += importo;
if (in_valuta)
@ -2497,13 +2501,20 @@ bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
}
const TDate chiusura = app()._esercizi[ae].chiusura();
if (chiusura.ok() && dc <= chiusura)
{
f.error_box(FR("%s è antecedente al %s,\ndata di chiusura dell'esercizio %d"),
data, chiusura.stringa(), ae);
// Errore non bloccante
}
if (chiusura.ok() && dc < chiusura)
{
f.error_box(FR("%s è antecedente al %s,\ndata di chiusura dell'esercizio %d"),
data, chiusura.stringa(), ae);
// Errore non bloccante
}
else
if (chiusura.ok() && dc == chiusura)
{
f.error_box(FR("%s è uguale al %s,\ndata di chiusura dell'esercizio %d"),
data, chiusura.stringa(), ae);
// Errore non bloccante
}
}
else
{
@ -3150,8 +3161,9 @@ const TString & TPrimanota_application::clifo() const
bool TPrimanota_application::is_split_payment() const
{
const TMask& m = curr_mask();
const TMask& m = curr_mask();
char s = ' ';
TMask_field* sp = m.find_by_id(F_SPLITPAY);
if (sp != NULL)
{
@ -3163,7 +3175,9 @@ bool TPrimanota_application::is_split_payment() const
if (s != 'N' && s != 'S')
{
s = 'N';
if (clifo() == "C" && m.get_int(F_ANNOIVA) >= 2015 && !causale().reverse_charge())
if (iva() == nessuna_iva)
return false;
if (clifo() == "C" && m.get_int(F_ANNOIVA) >= 2015 && !causale().reverse_charge())
{
const TRectype& cliente = cache().get_rec(LF_CLIFO, "C", m.get(F_CODCLIFOR));
if (cliente.get_bool(CLI_SPLITPAY))
@ -3287,17 +3301,50 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
if (a.is_pagamento())
a.calcola_saldo();
}
}
if (key == K_ENTER)
{
const TCurrency totale(real(f.get()));
if (totale.get_num().is_zero())
}
if (key == K_TAB && a.is_pagamento() && !a._as400)
{
m.show(K_RESIDUO, f.get().full());
m.show(K_TOTALE, f.get().full());
}
if (key == K_ENTER)
{
if (a.is_pagamento()&& ! a._as400)
{
TImporto importo, totdocsc,tot;
TSheet_field& cgrows = a.cgs();
FOR_EACH_SHEET_ROW_BACK(cgrows, i, r)
{
const char tipo = row_type(*r);
if (strchr("GK", tipo) != NULL) // Abbuoni attivi, differenze cambio, spese, ... // (A o P) Abbuoni e (C) Differenze cambio perchè c'erano ? non (T) totolae documento perchè pagamento
{
TImporto importo;
importo = *r;
totdocsc += importo;
}
}
if (tot.valore().is_zero())
{
totdocsc.normalize(a.causale().sezione_clifo());
tot = totdocsc;
f.set(tot.valore().string());
a.calcola_saldo();
}
}
TCurrency totale(real(f.get()));
if (totale.get_num().is_zero())
ok = yesno_box(TR("Totale documento nullo: continuare ugualmente?"));
if (ok)
{
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
if (cambio.in_valuta())
{
const real totval(m.get(SK_TOTDOCVAL));

View File

@ -34,6 +34,8 @@
#endif
class TDati_mov_auto;
enum CGMaskType { _query = 0, _no_iva = 1, _iva = 2, _occas = 3};
class TPrimanota_application : public TRelation_application
{
TMovimentoPN* _rel; // Relazione principale
@ -264,7 +266,6 @@ protected:
void ivas_pack();
void cgs_pack();
bool ci_sono_importi(const TSheet_field& cgs) const;
real calcola_saldo() const;
real calcola_imp() const;
void add_cgs_tot(TMask& m);
@ -324,9 +325,12 @@ public:
static bool iva_notify(TSheet_field& s, int r, KEY key);
static bool cg_notify(TSheet_field& s, int r, KEY key);
TMask * mask(CGMaskType type) { return _msk[type]; }
void type2colors(char tipor, COLOR& back, COLOR& fore);
void set_type_colors(char tipor, COLOR back, COLOR fore);
void reset_colors();
real calcola_saldo() const;
TCausale& causale() const { return *_causale; }
TPartite_array& partite() { return _partite; } // Partite editate

View File

@ -256,8 +256,8 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
const char sez_fat = fatt.sezione();
set(S_SEZIONE_SCAD, sez_fat == 'A' ? "A" : "D"); // Sezione della riga
if (assigned())
{
if (assigned())
{
set(S_IMPORTO_SCAD, scad.get(SCAD_IMPORTO)); // Importo della rata
if (in_valuta)
set(S_IMPORTOVAL_SCAD, scad.get(SCAD_IMPORTOVAL)); // Importo in valuta
@ -309,6 +309,16 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
_pagabile += oldimp;
#endif
if (_pagabile.is_zero())
{
hide(S_RESIDUOPAG);
hide(S_RESIDUORATA); // Se non assegnato nascondi residuo rata
}
else
{
show(S_RESIDUOPAG);
show(S_RESIDUORATA); // Se non assegnato nascondi residuo rata
}
// Il flag di saldo/acconto e' attivo solo se non ci sono acconti, cioe':
// pagamento non assegnato o con data documento antecedente quella della fattura
@ -333,7 +343,7 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
#else
set_handler(S_GRUPPO, conto_handler);
set_handler(S_CONTO, conto_handler);
const bool mostra_conto = !sum.is_nota_credito() && app().curr_mask().get_real(F_TOTALE) != ZERO;
const bool mostra_conto = !sum.is_nota_credito(); // && app().curr_mask().get_real(F_TOTALE) != ZERO;
show(-2, mostra_conto); // mostra/nasconde conto contropartita
if (!mostra_conto)
reset(-2);
@ -1032,7 +1042,9 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (pag.get_char(PAGSCA_ACCSAL) == 'S')
{
const TImporto abb(sez, pag.get_real(PAGSCA_ABBUONI));
if (!abb.is_zero())
bool is_totdoc = app().mask(_no_iva)->get(F_TOTALE).full();
if (!abb.is_zero())
{
const char tipo_abb = pag.get_char(PAGSCA_PASSATT);
TToken_string& rabb = gm.add_colored_row(sheet, tipo_abb);
@ -1040,13 +1052,18 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (in_valuta)
{
TImporto abb_lit = abb;
prima_valuta.val2eur(abb_lit);
gm.add_importo(rabb, abb_lit);
gm.add_importo(rabb, abb, prima_valuta.codice());
if (is_totdoc)
{
gm.add_importo(rabb, abb_lit);
gm.add_importo(rabb, abb, prima_valuta.codice());
}
}
else
{
gm.add_importo(rabb, abb);
if (is_totdoc)
gm.add_importo(rabb, abb);
rabb.add("");
}
rabb.add((int)sum.tipo(), 11);
@ -1060,7 +1077,8 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
{
TToken_string& rdiff = gm.add_colored_row(sheet, 'C');
rdiff.add(TR("Differenza cambio"), 4);
gm.add_importo(rdiff, diff);
if (is_totdoc)
gm.add_importo(rdiff, diff);
rdiff.add((int)sum.tipo(), 11);
}
}
@ -1152,6 +1170,8 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (pag.get_char(PAGSCA_ACCSAL) == 'S' || !pag.get_real(PAGSCA_ABBUONI).is_zero())
{
const TImporto abb(sez, pag.get_real(PAGSCA_ABBUONI));
bool is_totdoc = app().mask(_no_iva)->get(F_TOTALE).full();
if (!abb.is_zero())
{
const char tipo_abb = pag.get_char(PAGSCA_PASSATT);
@ -1161,34 +1181,23 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
{
TImporto abb_lit = abb;
prima_valuta.val2eur(abb_lit);
gm.add_importo(rabb, abb_lit);
gm.add_importo(rabb, abb, prima_valuta.codice());
if (is_totdoc)
{
gm.add_importo(rabb, abb_lit);
gm.add_importo(rabb, abb, prima_valuta.codice());
}
tot_lit += abb_lit;
tot_val += abb;
}
else
{
gm.add_importo(rabb, abb);
if (is_totdoc)
gm.add_importo(rabb, abb);
rabb.add("");
tot_lit += abb;
}
rabb.add((int)sum.tipo(), 11);
}
/* Continuo a ritenre impossibile ... per ora
// Le differenze cambio possono esistere solo in valuta
if (in_valuta)
{
const TImporto diff(sez, pag.get_real(PAGSCA_DIFFCAM));
if (!diff.is_zero())
{
TToken_string& rdiff = gm.add_colored_row(sheet, 'C');
rdiff.add(TR("Differenza cambio"), 4);
gm.add_importo(rdiff, diff);
rdiff.add((int)sum.tipo(), 11);
}
}
*/
} // Il pagamento era a saldo
} // Fine ciclo non assegnati