Corretta gestione saldaconto con valuta
git-svn-id: svn://10.65.10.50/trunk@2653 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
f2770ff0cb
commit
6fd645a927
@ -5,6 +5,32 @@
|
|||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
|
|
||||||
#include "sc0100.h"
|
#include "sc0100.h"
|
||||||
|
#include "sc0100a.h"
|
||||||
|
|
||||||
|
HIDDEN bool gruppo_handler(TMask_field& f, KEY key)
|
||||||
|
{
|
||||||
|
static bool ignore = FALSE;
|
||||||
|
|
||||||
|
if (key == K_TAB && f.focusdirty())
|
||||||
|
{
|
||||||
|
if (!ignore)
|
||||||
|
{
|
||||||
|
TMask_field& c = f.mask().field(F_CONTO);
|
||||||
|
if (c.get().not_empty())
|
||||||
|
{
|
||||||
|
ignore = TRUE;
|
||||||
|
c.set_dirty();
|
||||||
|
c.on_key(K_TAB);
|
||||||
|
ignore = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Gestione saldaconto extra-contabile
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TSaldaconto_app::TSaldaconto_app()
|
TSaldaconto_app::TSaldaconto_app()
|
||||||
: _file(32), _allow_firm(TRUE)
|
: _file(32), _allow_firm(TRUE)
|
||||||
@ -13,7 +39,10 @@ TSaldaconto_app::TSaldaconto_app()
|
|||||||
bool TSaldaconto_app::create()
|
bool TSaldaconto_app::create()
|
||||||
{
|
{
|
||||||
open_files(LF_PARTITE, LF_SCADENZE, LF_PAGSCA, 0);
|
open_files(LF_PARTITE, LF_SCADENZE, LF_PAGSCA, 0);
|
||||||
|
|
||||||
_msk = new TMask("sc0100a");
|
_msk = new TMask("sc0100a");
|
||||||
|
_msk->set_handler(F_GRUPPO, gruppo_handler);
|
||||||
|
|
||||||
dispatch_e_menu(MENU_ITEM(1));
|
dispatch_e_menu(MENU_ITEM(1));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -99,7 +128,7 @@ void TSaldaconto_app::gioca_cambi(TMask& m, int force)
|
|||||||
|
|
||||||
int sc0100(int argc, char* argv[])
|
int sc0100(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TSaldaconto_app app;
|
TSaldaconto_app salda;
|
||||||
app.run(argc, argv, "Gestione Saldaconto");
|
salda.run(argc, argv, "Gestione Saldaconto");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ END
|
|||||||
BUTTON DLG_DELREC 10 2
|
BUTTON DLG_DELREC 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -23 -1 ""
|
PROMPT -23 -1 ""
|
||||||
|
MESSAGE EXIT,K_DEL
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_CANCEL 10 2
|
BUTTON DLG_CANCEL 10 2
|
||||||
@ -55,7 +56,6 @@ DATE E_DATADOC
|
|||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 4 "Data documento "
|
PROMPT 1 4 "Data documento "
|
||||||
FIELD LF_PARTITE->DATADOC
|
FIELD LF_PARTITE->DATADOC
|
||||||
CHECKTYPE REQUIRED
|
|
||||||
WARNING "Inserire una data documento non superiore alla data dell'operazione"
|
WARNING "Inserire una data documento non superiore alla data dell'operazione"
|
||||||
VALIDATE DATE_CMP_FUNC <= E_DATAREG
|
VALIDATE DATE_CMP_FUNC <= E_DATAREG
|
||||||
END
|
END
|
||||||
@ -104,11 +104,12 @@ BEGIN
|
|||||||
VALIDATE NOT_EMPTY_FUNC
|
VALIDATE NOT_EMPTY_FUNC
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST DLG_NULL 1
|
LIST E_CLIFO 1 16
|
||||||
BEGIN
|
BEGIN
|
||||||
ITEM "C" MESSAGE SHOW,1@¦HIDE,2@
|
ITEM "C|Cliente" MESSAGE SHOW,1@|HIDE,2@
|
||||||
ITEM "F" MESSAGE SHOW,2@¦HIDE,1@
|
ITEM "F|Fornitore" MESSAGE SHOW,2@|HIDE,1@
|
||||||
FIELD LF_PARTITE->TIPOC
|
FIELD LF_PARTITE->TIPOC
|
||||||
|
FLAGS "HG"
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER E_CLIENTE 6
|
NUMBER E_CLIENTE 6
|
||||||
|
116
sc/sc0101.cpp
116
sc/sc0101.cpp
@ -393,6 +393,10 @@ bool TFattura_mask::datadoc_handler(TMask_field& f, KEY key)
|
|||||||
else
|
else
|
||||||
pag.set_datadoc(dd);
|
pag.set_datadoc(dd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key == K_ENTER && f.get().empty())
|
||||||
|
return error_box("La data del documento e' obbligatoria.");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -680,11 +684,11 @@ bool TFattura_mask::tipopag_handler(TMask_field& f, KEY key)
|
|||||||
|
|
||||||
void TFattura_mask::write_scadenze() const
|
void TFattura_mask::write_scadenze() const
|
||||||
{
|
{
|
||||||
const TBill conto(_fattura); // Conto cliente/fornitore della partita
|
TPartita* oldgame = &_fattura.partita();
|
||||||
|
const TBill conto(oldgame->conto()); // Conto cliente/fornitore della partita
|
||||||
const int anno = get_int(E_ANNORIF); // Anno di riferimento
|
const int anno = get_int(E_ANNORIF); // Anno di riferimento
|
||||||
const TString numpart(get(E_NUMRIF)); // Numero di riferimento
|
const TString numpart(get(E_NUMRIF)); // Numero di riferimento
|
||||||
|
|
||||||
TPartita* oldgame = &_fattura.partita();;
|
|
||||||
int vecchia_riga = _fattura.get_int(PART_NRIGA);
|
int vecchia_riga = _fattura.get_int(PART_NRIGA);
|
||||||
if (insert_mode())
|
if (insert_mode())
|
||||||
{
|
{
|
||||||
@ -822,24 +826,24 @@ bool TGame_mask::edit_fattura(TPartita& p, int nriga)
|
|||||||
TRiga_partite& f = p.riga(nriga);
|
TRiga_partite& f = p.riga(nriga);
|
||||||
TFattura_mask fm(f);
|
TFattura_mask fm(f);
|
||||||
const KEY k = fm.run();
|
const KEY k = fm.run();
|
||||||
|
bool updated = FALSE;
|
||||||
bool update = FALSE;
|
|
||||||
if (k == K_ENTER)
|
if (k == K_ENTER)
|
||||||
{
|
{
|
||||||
update = TRUE;
|
fm.write_scadenze();
|
||||||
|
updated = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (nuova || k == K_DEL)
|
if (nuova || k == K_DEL)
|
||||||
{
|
{
|
||||||
p.rimuovi_riga(nriga);
|
p.rimuovi_riga(nriga);
|
||||||
update = !nuova;
|
updated = !nuova;
|
||||||
|
if (updated)
|
||||||
|
p.rewrite();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (update)
|
|
||||||
fm.write_scadenze();
|
|
||||||
|
|
||||||
return update;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TGame_mask::prima_nota(const long nreg)
|
bool TGame_mask::prima_nota(const long nreg)
|
||||||
@ -914,16 +918,30 @@ bool TSaldaconto_app::totale_handler(TMask_field& f, KEY k)
|
|||||||
|
|
||||||
if (k == K_TAB)
|
if (k == K_TAB)
|
||||||
{
|
{
|
||||||
|
const bool dirty = f.focusdirty();
|
||||||
|
if (dirty) app().gioca_cambi(m);
|
||||||
if (is_fatt)
|
if (is_fatt)
|
||||||
{
|
{
|
||||||
if (f.focusdirty())
|
if (dirty)
|
||||||
{
|
|
||||||
app().gioca_cambi(m);
|
|
||||||
update_rate(m);
|
update_rate(m);
|
||||||
|
const real tot(f.get());
|
||||||
|
const real imp(m.get(E_IMPOSTE));
|
||||||
|
m.set(FS_IMPONIBILI, real(tot-imp));
|
||||||
|
m.set(FS_IMPOSTE, imp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dirty)
|
||||||
|
{
|
||||||
|
if (m.insert_mode() && m.get(S_IMPORTO).empty())
|
||||||
|
m.set(S_IMPORTO, f.get(), TRUE);
|
||||||
|
}
|
||||||
|
if (dirty || !m.is_running())
|
||||||
|
{
|
||||||
|
TPay_mask& pm = (TPay_mask&)m;
|
||||||
|
if (pm.unassigned())
|
||||||
|
pm.set(S_IMPORTO_SCAD, f.get());
|
||||||
}
|
}
|
||||||
real tot(f.get());
|
|
||||||
tot -= m.get_real(E_IMPOSTE);
|
|
||||||
m.set(FS_IMPONIBILI, tot);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -949,20 +967,14 @@ bool TSaldaconto_app::totale_handler(TMask_field& f, KEY k)
|
|||||||
if (ok && !is_fatt)
|
if (ok && !is_fatt)
|
||||||
{
|
{
|
||||||
const real totdoc(f.get());
|
const real totdoc(f.get());
|
||||||
const real imppag(m.get(S_IMPORTO));
|
const real imppag(m.get_real(S_IMPORTO) + m.get_real(S_RITENUTE));
|
||||||
if (totdoc < imppag)
|
if (totdoc != imppag)
|
||||||
{
|
{
|
||||||
TString msg(80);
|
TString msg(80);
|
||||||
msg << "Il totale del documento deve essere maggiore dell'importo pagato "
|
msg << "Il totale del documento e' diverso dall'importo pagato "
|
||||||
<< imppag.string(".");
|
<< imppag.string(".") << "\nSi desidera continuare ugualmente?";
|
||||||
if (m.edit_mode())
|
|
||||||
{
|
|
||||||
msg << "\nSi desidera continuare ugualmente?";
|
|
||||||
ok = f.yesno_box(msg);
|
ok = f.yesno_box(msg);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
ok = f.error_box(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,15 +983,11 @@ bool TSaldaconto_app::totale_handler(TMask_field& f, KEY k)
|
|||||||
|
|
||||||
bool TSaldaconto_app::imposte_handler(TMask_field& f, KEY key)
|
bool TSaldaconto_app::imposte_handler(TMask_field& f, KEY key)
|
||||||
{
|
{
|
||||||
if (key == K_TAB)
|
if (key == K_TAB && f.focusdirty())
|
||||||
{
|
{
|
||||||
TMask& m = f.mask();
|
TMask_field& tot = f.mask().field(E_TOTALE);
|
||||||
if (is_fattura(m))
|
tot.set_dirty();
|
||||||
{
|
tot.on_hit();
|
||||||
if (f.focusdirty())
|
|
||||||
update_rate(m);
|
|
||||||
m.set(FS_IMPOSTE, f.get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -999,32 +1007,45 @@ bool TSaldaconto_app::totval_handler(TMask_field& f, KEY key)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
f.set(m.get(S_IMPORTOVAL));
|
f.set(m.get(S_IMPORTOVAL));
|
||||||
|
key = K_TAB;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == K_TAB && f.focusdirty())
|
if (key == K_TAB)
|
||||||
{
|
{
|
||||||
app().gioca_cambi(m, m.insert_mode() ? 0x1 : 0x0);
|
const bool dirty = f.focusdirty();
|
||||||
|
if (dirty)
|
||||||
|
app().gioca_cambi(m);
|
||||||
|
|
||||||
if (is_fatt)
|
if (is_fatt)
|
||||||
|
{
|
||||||
|
if (dirty)
|
||||||
update_rate(m);
|
update_rate(m);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dirty && m.insert_mode() && m.get(S_IMPORTOVAL).empty())
|
||||||
|
m.set(S_IMPORTOVAL, f.get(), TRUE);
|
||||||
|
if (dirty || !m.is_running())
|
||||||
|
{
|
||||||
|
TPay_mask& pm = (TPay_mask&)m;
|
||||||
|
if (pm.unassigned())
|
||||||
|
pm.set(S_IMPORTOVAL_SCAD, f.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (key == K_ENTER && !is_fatt)
|
if (key == K_ENTER && !is_fatt)
|
||||||
{
|
{
|
||||||
const real totdoc(f.get());
|
const real totdoc(f.get());
|
||||||
const real imppag(m.get(S_IMPORTOVAL));
|
const real imppag(m.get(S_IMPORTOVAL));
|
||||||
if (totdoc < imppag)
|
if (totdoc != imppag)
|
||||||
{
|
{
|
||||||
TString msg(80);
|
TString msg(80);
|
||||||
msg << "Il totale del documento in valuta " << m.get(E_VALUTA)
|
msg << "Il totale del documento in valuta e' diverso dall'importo pagato "
|
||||||
<< " deve essere maggiore dell'importo pagato " << imppag.string(".3");
|
<< imppag.string(".3")
|
||||||
if (m.edit_mode())
|
<< "\nSi desidera continuare ugualmente?";
|
||||||
{
|
|
||||||
msg << "\nSi desidera continuare ugualmente?";
|
|
||||||
ok = f.yesno_box(msg);
|
ok = f.yesno_box(msg);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
ok = f.error_box(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
@ -1059,8 +1080,15 @@ bool TSaldaconto_app::valuta_handler(TMask_field& f, KEY k)
|
|||||||
m.enable(E_TOTDOCVAL, full);
|
m.enable(E_TOTDOCVAL, full);
|
||||||
|
|
||||||
if (is_fattura(m))
|
if (is_fattura(m))
|
||||||
|
{
|
||||||
m.set(FS_VALUTA, val); // Copia a pagina 2
|
m.set(FS_VALUTA, val); // Copia a pagina 2
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TPay_mask& pm = (TPay_mask&)m;
|
||||||
|
pm.attiva_valuta(full);
|
||||||
|
}
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user