Praticamente finito saldaconto extra-contabile
git-svn-id: svn://10.65.10.50/trunk@2628 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3ccab681ec
commit
6631234c2b
@ -114,7 +114,7 @@ NUMBER E_CLIENTE 6
|
||||
BEGIN
|
||||
PROMPT 1 8 "Cliente "
|
||||
FIELD LF_PARTITE->SOTTOCONTO
|
||||
FLAGS "D"
|
||||
FLAGS "DG"
|
||||
GROUP 1
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
@ -128,8 +128,6 @@ BEGIN
|
||||
OUTPUT E_STATOPAIV STATOPAIV
|
||||
OUTPUT E_PIVACLIENTE PAIV
|
||||
OUTPUT E_COFICLIENTE COFI
|
||||
OUTPUT E_CODPAG CODPAG
|
||||
OUTPUT E_VALUTA CODVAL
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Cliente assente"
|
||||
ADD RUN cg0 -1 C
|
||||
@ -139,7 +137,7 @@ NUMBER E_FORNITORE 6
|
||||
BEGIN
|
||||
PROMPT 1 8 "Fornitore "
|
||||
FIELD LF_PARTITE->SOTTOCONTO
|
||||
FLAGS "D"
|
||||
FLAGS "DG"
|
||||
GROUP 2
|
||||
USE LF_CLIFO KEY 1
|
||||
INPUT TIPOCF "F"
|
||||
@ -153,8 +151,6 @@ BEGIN
|
||||
OUTPUT E_STATOPAIV STATOPAIV
|
||||
OUTPUT E_PIVAFORNITORE PAIV
|
||||
OUTPUT E_COFIFORNITORE COFI
|
||||
OUTPUT E_CODPAG CODPAG
|
||||
OUTPUT E_VALUTA CODVAL
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Fornitore assente"
|
||||
ADD RUN cg0 -1 F
|
||||
@ -384,7 +380,7 @@ BEGIN
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Il numero di riferimento e' obbligatorio"
|
||||
FIELD LF_PARTITE->NUMPART
|
||||
FLAGS "U"
|
||||
FLAGS "U#"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
@ -24,6 +24,7 @@ class TFattura_mask : public TMask
|
||||
TString_array _pag_rows;
|
||||
|
||||
protected:
|
||||
static bool clifo_handler(TMask_field& f, KEY key);
|
||||
static bool datadoc_handler(TMask_field& f, KEY key);
|
||||
static bool nrate_handler(TMask_field& f, KEY key);
|
||||
static bool recalc_handler(TMask_field& f, KEY key);
|
||||
@ -45,6 +46,7 @@ public:
|
||||
void set_totale_pagamento(bool update);
|
||||
void set_scadenze();
|
||||
void write_scadenze() const;
|
||||
real totale_rate(bool val) const;
|
||||
|
||||
TFattura_mask(TRiga_partite& fattura);
|
||||
virtual ~TFattura_mask();
|
||||
@ -68,6 +70,9 @@ TFattura_mask::TFattura_mask(TRiga_partite& fattura)
|
||||
}
|
||||
else
|
||||
hide(-3);
|
||||
|
||||
const short clifo = _fattura.partita().conto().tipo() == 'C' ? E_CLIENTE : E_FORNITORE;
|
||||
set_handler(clifo, clifo_handler);
|
||||
|
||||
set_handler(E_DATADOC, datadoc_handler);
|
||||
set_handler(FS_NRATE, nrate_handler);
|
||||
@ -100,7 +105,15 @@ TFattura_mask::~TFattura_mask()
|
||||
{
|
||||
delete _pag;
|
||||
}
|
||||
|
||||
|
||||
real TFattura_mask::totale_rate(bool val) const
|
||||
{
|
||||
const TPagamento& pag = pagamento();
|
||||
real tot = pag.importo_da_dividere(val);
|
||||
tot += pag.importo_da_non_dividere(val);
|
||||
return tot;
|
||||
}
|
||||
|
||||
void TFattura_mask::pag2sheet()
|
||||
{
|
||||
TPagamento& pag = pagamento();
|
||||
@ -382,6 +395,33 @@ bool TFattura_mask::datadoc_handler(TMask_field& f, KEY key)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool TFattura_mask::clifo_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_TAB)
|
||||
{
|
||||
TFattura_mask& m = (TFattura_mask&)f.mask();
|
||||
if (m.insert_mode())
|
||||
{
|
||||
const TEdit_field& clifo = (TEdit_field&)f;
|
||||
const TRectype& cur = clifo.browse()->cursor()->curr();
|
||||
TMask_field& cp = m.field(E_CODPAG);
|
||||
if (cp.get().empty())
|
||||
{
|
||||
cp.set(CLI_CODPAG);
|
||||
cp.check(STARTING_CHECK);
|
||||
}
|
||||
TMask_field& cv = m.field(E_VALUTA);
|
||||
if (cv.get().empty())
|
||||
{
|
||||
cv.set(CLI_CODVAL);
|
||||
cv.on_hit();
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool TFattura_mask::reset_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
@ -831,28 +871,40 @@ HIDDEN bool is_fattura(TMask& m)
|
||||
const tipo_movimento tm = (tipo_movimento)m.get_int(E_TIPOMOV);
|
||||
return tm == tm_fattura;
|
||||
}
|
||||
HIDDEN bool update_rate(TMask& m)
|
||||
HIDDEN void update_rate(TMask& m)
|
||||
{
|
||||
const bool isf = is_fattura(m);
|
||||
if (isf && m.insert_mode())
|
||||
CHECK(is_fattura(m), "Non e' una maschera di fattura!");
|
||||
if (m.insert_mode())
|
||||
{
|
||||
TFattura_mask& fm = (TFattura_mask&)m;
|
||||
fm.set_scadenze();
|
||||
}
|
||||
return isf;
|
||||
}
|
||||
|
||||
bool TSaldaconto_app::totale_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
TMask& m = f.mask();
|
||||
const bool is_fatt = is_fattura(m);
|
||||
|
||||
if (k == K_F8)
|
||||
{
|
||||
if (is_fatt)
|
||||
{
|
||||
TFattura_mask& fm = (TFattura_mask&)m;
|
||||
f.set(fm.totale_rate(FALSE).string());
|
||||
}
|
||||
else
|
||||
f.set(m.get(S_IMPORTO));
|
||||
k = K_TAB;
|
||||
}
|
||||
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
{
|
||||
app().gioca_cambi(m);
|
||||
const bool is_fatt = update_rate(m);
|
||||
if (is_fatt)
|
||||
{
|
||||
update_rate(m);
|
||||
real tot(f.get());
|
||||
tot -= m.get_real(E_IMPOSTE);
|
||||
m.set(FS_IMPONIBILI, tot);
|
||||
@ -878,7 +930,7 @@ bool TSaldaconto_app::totale_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
}
|
||||
|
||||
if (ok && !is_fattura(m))
|
||||
if (ok && !is_fatt)
|
||||
{
|
||||
const real totdoc(f.get());
|
||||
const real imppag(m.get(S_IMPORTO));
|
||||
@ -905,10 +957,12 @@ bool TSaldaconto_app::imposte_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_TAB && f.focusdirty())
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const bool isf = update_rate(m);
|
||||
if (isf)
|
||||
TMask& m = f.mask();
|
||||
if (is_fattura(m))
|
||||
{
|
||||
update_rate(m);
|
||||
m.set(FS_IMPOSTE, f.get());
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -917,14 +971,27 @@ bool TSaldaconto_app::totval_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
TMask& m = f.mask();
|
||||
|
||||
const bool is_fatt = is_fattura(m);
|
||||
|
||||
if (key == K_F8)
|
||||
{
|
||||
if (is_fatt)
|
||||
{
|
||||
TFattura_mask& fm = (TFattura_mask&)m;
|
||||
f.set(fm.totale_rate(TRUE).string());
|
||||
}
|
||||
else
|
||||
f.set(m.get(S_IMPORTOVAL));
|
||||
}
|
||||
|
||||
if (key == K_TAB && f.focusdirty())
|
||||
{
|
||||
app().gioca_cambi(m, m.insert_mode() ? 0x1 : 0x0);
|
||||
update_rate(m);
|
||||
if (is_fatt)
|
||||
update_rate(m);
|
||||
}
|
||||
|
||||
if (key == K_ENTER && !is_fattura(m))
|
||||
if (key == K_ENTER && !is_fatt)
|
||||
{
|
||||
const real totdoc(f.get());
|
||||
const real imppag(m.get(S_IMPORTOVAL));
|
||||
|
Loading…
x
Reference in New Issue
Block a user