Gestione clienti occasionali con saldaconto attivato
git-svn-id: svn://10.65.10.50/trunk@2558 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d2671c6f69
commit
92b5b6e8a4
@ -787,15 +787,16 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
|||||||
|
|
||||||
if (_iva == nessuna_iva) return;
|
if (_iva == nessuna_iva) return;
|
||||||
|
|
||||||
|
TRectype& rec = _rel->curr(); // Record della testata
|
||||||
|
|
||||||
if (causale().corrispettivi())
|
if (causale().corrispettivi())
|
||||||
{
|
{
|
||||||
TRectype& rec = _rel->lfile().curr();
|
|
||||||
rec.put("TIPO", "");
|
rec.put("TIPO", "");
|
||||||
rec.put("CODCF", ""); // Azzera il cliente nei movimenti dei corrispettivi
|
rec.put("CODCF", ""); // Azzera il cliente nei movimenti dei corrispettivi
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_rel->lfile().put("TIPO", clifo());
|
rec.put("TIPO", clifo());
|
||||||
|
|
||||||
int err = ~NOERR;
|
int err = ~NOERR;
|
||||||
if (m.field(F_OCCASEDIT).active()) // Se e' un occasionale
|
if (m.field(F_OCCASEDIT).active()) // Se e' un occasionale
|
||||||
@ -809,35 +810,39 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
|||||||
err = occas.rewrite();
|
err = occas.rewrite();
|
||||||
|
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
_rel->lfile().put("OCFPI", occas_mask().get(O_CODICE));
|
rec.put("OCFPI", occas_mask().get(O_CODICE));
|
||||||
else
|
else
|
||||||
error_box("Errore di scrittura sul file dei clienti/fornitori occasionali: %d", err);
|
error_box("Errore di scrittura sul file dei clienti/fornitori occasionali: %d", err);
|
||||||
}
|
}
|
||||||
if (err) _rel->lfile().zero("OCFPI");
|
if (err)
|
||||||
|
rec.zero("OCFPI");
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool intra = causale().intra();
|
|
||||||
const bool to_swap = test_swap(FALSE);
|
const bool to_swap = test_swap(FALSE);
|
||||||
if (to_swap)
|
if (to_swap)
|
||||||
{
|
{
|
||||||
real totale = _rel->lfile().get("TOTDOC");
|
real totale = rec.get("TOTDOC");
|
||||||
totale = -totale;
|
totale = -totale;
|
||||||
_rel->lfile().put("TOTDOC", totale);
|
rec.put("TOTDOC", totale);
|
||||||
}
|
}
|
||||||
|
|
||||||
ivas_pack();
|
const bool intra = causale().intra();
|
||||||
|
|
||||||
TArray& irows = ivas().rows_array();
|
TArray& irows = ivas().rows_array();
|
||||||
|
ivas_pack();
|
||||||
|
|
||||||
for (int i = 0; i < irows.items(); i++)
|
for (int i = 0; i < irows.items(); i++)
|
||||||
{
|
{
|
||||||
TToken_string& row = (TToken_string&)irows[i];
|
TToken_string& row = (TToken_string&)irows[i];
|
||||||
|
|
||||||
TRectype &r = _rel->iva(i);
|
TRectype &r = _rel->iva(i);
|
||||||
r.zero();
|
r.zero();
|
||||||
r.put("ANNOES", annoes); // Anno d'esercizio della testata (che ca$$ata!)
|
|
||||||
r.put("NUMREG", numreg);
|
r.put("NUMREG", numreg);
|
||||||
r.put("INTRA", intra); // Causale intra (che ca$$ata!)
|
|
||||||
r.put("NUMRIG", i+1);
|
r.put("NUMRIG", i+1);
|
||||||
|
|
||||||
|
r.put("ANNOES", annoes); // Anno d'esercizio della testata (che ca$$ata!)
|
||||||
|
r.put("INTRA", intra); // Causale intra (che ca$$ata!)
|
||||||
|
|
||||||
real imponibile(row.get(0));
|
real imponibile(row.get(0));
|
||||||
if (to_swap) imponibile = -imponibile;
|
if (to_swap) imponibile = -imponibile;
|
||||||
r.put("IMPONIBILE", imponibile);
|
r.put("IMPONIBILE", imponibile);
|
||||||
@ -862,7 +867,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
|||||||
void TPrimanota_application::check_saldi()
|
void TPrimanota_application::check_saldi()
|
||||||
{
|
{
|
||||||
TString_array& rows = cgs().rows_array();
|
TString_array& rows = cgs().rows_array();
|
||||||
const int anno = _rel->lfile().get_int("ANNOES");
|
const int anno = _rel->curr().get_int("ANNOES");
|
||||||
|
|
||||||
for (int i = 0; i < rows.items(); i++)
|
for (int i = 0; i < rows.items(); i++)
|
||||||
{
|
{
|
||||||
|
@ -558,10 +558,10 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
|||||||
return f.error_box("Il movimento e' sbilanciato di %s lire.", ss);
|
return f.error_box("Il movimento e' sbilanciato di %s lire.", ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool paga = a.is_pagamento();
|
|
||||||
const bool nota = a.is_nota_credito();
|
|
||||||
|
|
||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
|
const bool paga = a.is_pagamento();
|
||||||
|
const bool nota = a.is_nota_credito() && m.field(F_NUMRIF).active();
|
||||||
|
|
||||||
const long numreg = m.get_long(F_NUMREG);
|
const long numreg = m.get_long(F_NUMREG);
|
||||||
|
|
||||||
const bool in_valuta = m.get(SK_VALUTA).not_empty();
|
const bool in_valuta = m.get(SK_VALUTA).not_empty();
|
||||||
@ -1892,13 +1892,17 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
|
|||||||
// Certified 99%
|
// Certified 99%
|
||||||
bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
||||||
{
|
{
|
||||||
|
if (!suspended_handler(f, key))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (key == K_TAB && f.active())
|
if (key == K_TAB && f.active())
|
||||||
{
|
{
|
||||||
|
TPrimanota_application& a = app();
|
||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
|
|
||||||
if (f.focusdirty() && app().is_nota_credito())
|
if (f.focusdirty() && a.is_nota_credito())
|
||||||
{
|
{
|
||||||
TPartite_array& p = app().partite();
|
TPartite_array& p = a.partite();
|
||||||
if (m.edit_mode())
|
if (m.edit_mode())
|
||||||
p.add_numreg(m.get_long(F_NUMREG));
|
p.add_numreg(m.get_long(F_NUMREG));
|
||||||
|
|
||||||
@ -1913,11 +1917,11 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
f.set_dirty(); // yesno_box cleared the dirty flag
|
f.set_dirty(); // yesno_box cleared the dirty flag
|
||||||
app().notify_cgline_deletion(-1);
|
a.notify_cgline_deletion(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char cf = app().clifo();
|
const char cf = a.clifo();
|
||||||
const long codice = atol(f.get());
|
const long codice = atol(f.get());
|
||||||
|
|
||||||
if (codice == 0)
|
if (codice == 0)
|
||||||
@ -1926,7 +1930,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
|||||||
m.show(F_STATOPAIV); // Stato partita IVA
|
m.show(F_STATOPAIV); // Stato partita IVA
|
||||||
m.show(cf == 'C' ? F_PIVACLIENTE : F_PIVAFORNITORE); // Partita IVA
|
m.show(cf == 'C' ? F_PIVACLIENTE : F_PIVAFORNITORE); // Partita IVA
|
||||||
m.show(cf == 'C' ? F_COFICLIENTE : F_COFIFORNITORE); // Codice Fiscale
|
m.show(cf == 'C' ? F_COFICLIENTE : F_COFIFORNITORE); // Codice Fiscale
|
||||||
|
a.activate_numrif(TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1936,14 +1940,11 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
|||||||
clifo.put(CLI_CODCF, codice);
|
clifo.put(CLI_CODCF, codice);
|
||||||
cliforel.read();
|
cliforel.read();
|
||||||
|
|
||||||
if (!suspended_handler(f, key))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!m.is_running() || f.dirty())
|
if (!m.is_running() || f.dirty())
|
||||||
{
|
{
|
||||||
app()._conto_ricavo.set(clifo.get_int(CLI_GRUPPORIC),
|
a._conto_ricavo.set(clifo.get_int(CLI_GRUPPORIC),
|
||||||
clifo.get_int(CLI_CONTORIC),
|
clifo.get_int(CLI_CONTORIC),
|
||||||
clifo.get_long(CLI_SOTTOCRIC));
|
clifo.get_long(CLI_SOTTOCRIC));
|
||||||
|
|
||||||
const int alleg = clifo.get_int(CLI_ALLEG);
|
const int alleg = clifo.get_int(CLI_ALLEG);
|
||||||
TEdit_field& upi = m.efield(F_RIEPILOGO);
|
TEdit_field& upi = m.efield(F_RIEPILOGO);
|
||||||
@ -1964,7 +1965,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f.focusdirty() && app().is_saldaconto())
|
if (f.focusdirty() && a.is_saldaconto())
|
||||||
{
|
{
|
||||||
if (m.field(SK_VALUTA).active() && m.get(SK_VALUTA).empty())
|
if (m.field(SK_VALUTA).active() && m.get(SK_VALUTA).empty())
|
||||||
{
|
{
|
||||||
@ -1973,12 +1974,12 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
|||||||
m.set(SK_VALUTA, valuta, TRUE);
|
m.set(SK_VALUTA, valuta, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app().is_fattura())
|
if (a.is_fattura())
|
||||||
{
|
{
|
||||||
if (clifo.get(CLI_CODCAB).not_empty())
|
if (clifo.get(CLI_CODCAB).not_empty())
|
||||||
{
|
{
|
||||||
m.set(FS_VSABI, clifo.get(CLI_CODABI));
|
m.set(FS_VSABI, clifo.get(CLI_CODABI));
|
||||||
m.set(FS_VSCAB, clifo.get(CLI_CODCAB));
|
m.set(FS_VSCAB, clifo.get(CLI_CODCAB));
|
||||||
m.send_key(K_TAB, FS_VSCAB);
|
m.send_key(K_TAB, FS_VSCAB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1992,16 +1993,21 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool occas = clifo.get_bool(CLI_OCCAS) && !app().is_saldaconto();
|
const bool occas = clifo.get_bool(CLI_OCCAS);
|
||||||
m.show(F_OCCASEDIT, occas); // Bottone Dati anagrafici
|
m.show(F_OCCASEDIT, occas); // Bottone Dati anagrafici
|
||||||
m.show(F_STATOPAIV, !occas); // Stato partita IVA
|
m.show(F_STATOPAIV, !occas); // Stato partita IVA
|
||||||
m.show(cf == 'C' ? F_PIVACLIENTE : F_PIVAFORNITORE, !occas); // Partita IVA
|
m.show(cf == 'C' ? F_PIVACLIENTE : F_PIVAFORNITORE, !occas); // Partita IVA
|
||||||
m.show(cf == 'C' ? F_COFICLIENTE : F_COFIFORNITORE, !occas); // Codice Fiscale
|
m.show(cf == 'C' ? F_COFICLIENTE : F_COFIFORNITORE, !occas); // Codice Fiscale
|
||||||
|
|
||||||
|
if (occas && a.is_fattura() && a.partite().first() != NULL)
|
||||||
|
f.warning_box("Attenzione, il saldaconto verra' eliminato!");
|
||||||
|
|
||||||
|
a.activate_numrif(TRUE);
|
||||||
|
|
||||||
if (f.focusdirty())
|
if (f.focusdirty())
|
||||||
{
|
{
|
||||||
app().add_cgs_tot(m);
|
a.add_cgs_tot(m);
|
||||||
if (occas && app().occas_mask().get(O_CODICE).empty())
|
if (occas && a.occas_mask().get(O_CODICE).blank())
|
||||||
m.send_key(K_SPACE, F_OCCASEDIT); // Lancia maschera occasionali
|
m.send_key(K_SPACE, F_OCCASEDIT); // Lancia maschera occasionali
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2338,8 +2344,8 @@ bool TPrimanota_application::activate_numrif(bool init_pag)
|
|||||||
|
|
||||||
if (shown)
|
if (shown)
|
||||||
{
|
{
|
||||||
const bool solaiva = m.get_bool(F_SOLAIVA);
|
const bool hide = m.get_bool(F_SOLAIVA) || m.field(F_OCCASEDIT).shown();
|
||||||
if (solaiva) shown = FALSE;
|
if (hide) shown = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shown != m.field(F_NUMRIF).shown())
|
if (shown != m.field(F_NUMRIF).shown())
|
||||||
|
@ -339,16 +339,17 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
|
|||||||
bool TPrimanota_application::annorif_handler(TMask_field& f, KEY key)
|
bool TPrimanota_application::annorif_handler(TMask_field& f, KEY key)
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
const TMask& m = f.mask();
|
if (f.to_check(key, TRUE))
|
||||||
|
{
|
||||||
if (f.to_check(key, TRUE) && f.get().empty() &&
|
const TMask& m = f.mask();
|
||||||
(m.insert_mode() || m.get(F_NUMRIF).not_empty()))
|
if (!m.get(F_NUMRIF).blank() && f.get().empty())
|
||||||
{
|
{
|
||||||
const TString& anno = m.get(F_DATADOC).right(4);
|
const TString& anno = m.get(F_DATADOC).right(4);
|
||||||
f.set(anno);
|
f.set(anno);
|
||||||
ok = error_box("Il numero di riferimento partita e' obbligatorio!\n"
|
ok = error_box("L'anno di riferimento partita e' obbligatorio!\n"
|
||||||
"Se possibile esso verra' proposto, ma potra'\n"
|
"Se possibile esso verra' proposto, ma potra'\n"
|
||||||
"essere modificato prima di registrare il movimento.");
|
"essere modificato prima di registrare il movimento.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -361,8 +362,12 @@ bool TPrimanota_application::numrif_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
TPrimanota_application& a = app();
|
TPrimanota_application& a = app();
|
||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
|
|
||||||
|
const bool required = m.insert_mode() && a.is_fattura() &&
|
||||||
|
(key == K_ENTER || f.focusdirty()) &&
|
||||||
|
!(m.get_bool(F_SOLAIVA) || m.field(F_OCCASEDIT).enabled());
|
||||||
|
|
||||||
if (f.focusdirty() && m.insert_mode() && f.get().blank())
|
if (required && f.get().blank())
|
||||||
{
|
{
|
||||||
f.set(m.get(a._npart_is_prot ? F_PROTIVA : F_NUMDOC));
|
f.set(m.get(a._npart_is_prot ? F_PROTIVA : F_NUMDOC));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user