Corretti errori Gabri
git-svn-id: svn://10.65.10.50/trunk@2681 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1a859406ee
commit
1e0dcad4b8
@ -537,12 +537,12 @@ BEGIN
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
NUMBER F_CORRVALUTA 15 3
|
||||
NUMBER F_CORRVALUTA 15 2
|
||||
BEGIN
|
||||
PROMPT 41 18 "Corrispettivo valuta "
|
||||
FIELD CORRVALUTA
|
||||
FLAGS "R"
|
||||
PICTURE ".3"
|
||||
PICTURE ".2"
|
||||
GROUP 4
|
||||
VALIDATE REQIF_FUNC 1 F_VALUTAINTRA
|
||||
END
|
||||
|
@ -230,6 +230,7 @@ END
|
||||
LIST 112 1 20
|
||||
BEGIN
|
||||
PROMPT 1 5 "Tipo movimento "
|
||||
ITEM " |Nessuno"
|
||||
ITEM "1|Fattura"
|
||||
ITEM "2|Nota credito"
|
||||
ITEM "3|Incasso/Pagamento"
|
||||
|
@ -100,6 +100,8 @@ class TPay_mask : public TMask
|
||||
real _da_pagare, _pagabile;
|
||||
const TGame_mask& _parent;
|
||||
|
||||
tipo_movimento _tipomov;
|
||||
|
||||
TDecoder _causale;
|
||||
bool _assigned;
|
||||
bool _can_solder;
|
||||
@ -125,11 +127,12 @@ public:
|
||||
|
||||
bool assigned() const { return _assigned; }
|
||||
bool unassigned() const { return !_assigned; }
|
||||
tipo_movimento tipo() const { return _tipomov; }
|
||||
|
||||
void attiva_valuta(bool on);
|
||||
|
||||
TPay_mask(const TGame_mask& parent, int mode);
|
||||
virtual ~TPay_mask() {}
|
||||
virtual ~TPay_mask();
|
||||
};
|
||||
|
||||
#ifdef __EXTRA__
|
||||
@ -146,6 +149,8 @@ TPay_mask::TPay_mask(const TGame_mask& parent, int mod)
|
||||
enable(DLG_DELREC, edit_mode());
|
||||
|
||||
#ifdef __EXTRA__
|
||||
xvt_statbar_set(mod == MODE_MOD ? "Modifica" : "Inserimento", TRUE);
|
||||
|
||||
hide(E_CODPAG); hide(E_DESPAG);
|
||||
set_handler(E_DATAREG, datareg_handler);
|
||||
set_handler(E_DATADOC, datadoc_handler);
|
||||
@ -178,6 +183,13 @@ TPay_mask::TPay_mask(const TGame_mask& parent, int mod)
|
||||
#endif
|
||||
}
|
||||
|
||||
TPay_mask::~TPay_mask()
|
||||
{
|
||||
#ifdef __EXTRA__
|
||||
xvt_statbar_set("Estratto conto", TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TPay_mask::attiva_valuta(bool in_valuta)
|
||||
{
|
||||
if (in_valuta)
|
||||
@ -209,6 +221,8 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
|
||||
const int nrigp = oldpag.get_int(PAGSCA_NRIGP);
|
||||
const TRiga_partite& sum = p.riga(nrigp);
|
||||
_assigned = oldpag.get_int(PAGSCA_NRIGA) != TPartita::UNASSIGNED;
|
||||
_tipomov = (tipo_movimento)sum.get_int(PART_TIPOMOV);
|
||||
|
||||
const TRiga_partite& fatt = _assigned ? scad.riga() : sum;
|
||||
|
||||
TRelation rel(LF_PAGSCA); // Working relation
|
||||
@ -318,12 +332,13 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
|
||||
// La valuta puo' essere cambiata solo su partite nuove
|
||||
const bool on = p.first() == p.last();
|
||||
enable(E_VALUTA, on);
|
||||
show(-3, on || in_valuta); // Attiva campi relativi alla valuta
|
||||
#else
|
||||
show(-3, in_valuta); // Attiva campi relativi alla valuta
|
||||
set_handler(S_GRUPPO, conto_handler);
|
||||
set_handler(S_CONTO, conto_handler);
|
||||
const bool mostra_conto = !sum.is_nota_credito();
|
||||
show(-2, mostra_conto); // mostra/nasconde conto contropartita
|
||||
show(-3, in_valuta); // Attiva campi relativi alla valuta
|
||||
#endif
|
||||
|
||||
// Gestione data-pagamento: non puo' precedere la data del documento
|
||||
@ -433,7 +448,11 @@ bool TPay_mask::importo_handler(TMask_field& f, KEY k)
|
||||
|
||||
if (sa.get()[0] != 'S')
|
||||
{
|
||||
const real residuo(m._da_pagare - i);
|
||||
real residuo = m._da_pagare;
|
||||
if (m.tipo() == tm_insoluto)
|
||||
residuo += i;
|
||||
else
|
||||
residuo -= i;
|
||||
m.set(S_RESIDUORATA, residuo);
|
||||
}
|
||||
else
|
||||
@ -586,6 +605,8 @@ TGame_mask::TGame_mask(const TBill& bill, long numreg, int riga)
|
||||
set(P_DESCR, descr);
|
||||
|
||||
#ifdef __EXTRA__
|
||||
xvt_statbar_set("Estratto conto", TRUE);
|
||||
|
||||
disable(-3); // Disabilita gestione valuta
|
||||
hide(P_RESIDUO);
|
||||
hide(P_RESIDUOVAL);
|
||||
@ -926,6 +947,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
||||
TToken_string& rrit = scadenze.row(scadenze.add(""));
|
||||
rrit.add("Ritenute professionali", 4);
|
||||
gm.add_importo(rrit, rit, FALSE);
|
||||
rrit.add(sum.get(PART_TIPOMOV), 11);
|
||||
}
|
||||
}
|
||||
|
||||
@ -951,6 +973,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
||||
gm.add_importo(rabb, abb, FALSE);
|
||||
rabb.add("");
|
||||
}
|
||||
rabb.add(sum.get(PART_TIPOMOV), 11);
|
||||
}
|
||||
|
||||
// Le differenze cambio possono esistere solo in valuta
|
||||
@ -962,6 +985,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
||||
TToken_string& rdiff = scadenze.row(scadenze.add(""));
|
||||
rdiff.add("Differenza cambio", 4);
|
||||
gm.add_importo(rdiff, diff);
|
||||
rdiff.add(sum.get(PART_TIPOMOV), 11);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1028,6 +1052,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
||||
TToken_string& row = scadenze.row(scadenze.add(""));
|
||||
row.add("Ritenute professionali", 4);
|
||||
gm.add_importo(row, rit, FALSE);
|
||||
row.add(sum.get(PART_TIPOMOV), 11);
|
||||
tot_lit += rit;
|
||||
}
|
||||
}
|
||||
@ -1200,14 +1225,17 @@ int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata, tipo_mov
|
||||
|
||||
// Calcola riga causale per la contropartita in base al tipo pagamento
|
||||
int caus = 2;
|
||||
if (rata != TPartita::UNASSIGNED)
|
||||
|
||||
if (nriga != TPartita::UNASSIGNED)
|
||||
{
|
||||
const TRiga_scadenze& scad = partita.rata(nriga, rata);
|
||||
const TRiga_partite& fatt = partita.riga(nriga);
|
||||
const TRiga_scadenze& scad = fatt.rata(rata);
|
||||
const int tp = scad.get_int(SCAD_TIPOPAG);
|
||||
caus = partita.tipopag2causale(tp);
|
||||
|
||||
TRiga_partite& somma = partita.riga(nrigp);
|
||||
somma.put(PART_TIPOPAG, tp);
|
||||
somma.put(PART_CODVAL, fatt.get(PART_CODVAL));
|
||||
|
||||
pagamento.put(PAGSCA_CODABIPR, scad.get(SCAD_CODABIPR));
|
||||
pagamento.put(PAGSCA_CODCABPR, scad.get(SCAD_CODCABPR));
|
||||
@ -1232,15 +1260,15 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const int nriga = m.get_int(101);
|
||||
const int nriga = m.get_int(101); // Numero riga fattura
|
||||
|
||||
if (nriga == 0)
|
||||
return FALSE; // Ho cliccato su di un saldo (per sbaglio!)
|
||||
|
||||
TGame_mask& gm = (TGame_mask&)(m.get_sheet()->mask());
|
||||
const TBill& bill = gm.conto();
|
||||
const int anno = gm.get_int(P_ANNO);
|
||||
const TString16 numero = gm.get(P_NUMERO);
|
||||
const TBill& bill = gm.conto(); // Clifo
|
||||
const int anno = gm.get_int(P_ANNO); // Anno
|
||||
const TString numero = gm.get(P_NUMERO); // Numero
|
||||
|
||||
TPartite_array& giochi = app().partite();
|
||||
TPartita* was = giochi.exist(bill, anno, numero); // Controlla esistenza nell'array
|
||||
@ -1258,6 +1286,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
return f.error_box("La rata %d e' bloccata.", nrata);
|
||||
}
|
||||
|
||||
#ifndef __EXTRA__
|
||||
const TValuta parval(game.riga(nriga));
|
||||
const TValuta curval(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||
if (parval != curval)
|
||||
@ -1268,6 +1297,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
if (was == NULL) giochi.destroy(game);
|
||||
return f.error_box("La fattura deve essere pagata in %s.", (const char*)c);
|
||||
}
|
||||
#endif
|
||||
|
||||
tipo_movimento tm;
|
||||
|
||||
@ -1302,9 +1332,6 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
cambiato = gm.edit_pagamento(game, nriga, nrata, nrigp);
|
||||
if (cambiato)
|
||||
{
|
||||
// Se ho cancellato il pagamento chiudo la maschera
|
||||
if (m.is_running() && !game.esiste(nriga, nrata, nrigp))
|
||||
m.stop_run(K_FORCE_CLOSE);
|
||||
#ifdef __EXTRA__
|
||||
game.rewrite(); // In extra-contabile salvo subito!
|
||||
#endif
|
||||
@ -1342,6 +1369,9 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
|
||||
if (cambiato)
|
||||
{
|
||||
if (m.is_running()) // Se la maschera e' aperta la chiudo
|
||||
m.stop_run(K_FORCE_CLOSE);
|
||||
|
||||
TSheet_field& ss = gm.scadenze();
|
||||
const int rs = ss.selected(); // Memorizza la riga corrente
|
||||
gm.fill_partite(); // Aggiorna elenco partite
|
||||
@ -1467,7 +1497,6 @@ void TGame_mask::add_descrizione(TToken_string& s, const TRiga_partite& riga, in
|
||||
s.add(desc, pos);
|
||||
}
|
||||
|
||||
|
||||
TImporto TGame_mask::get_importo(TToken_string& s, int pos) const
|
||||
{
|
||||
const TFixed_string imp(s.get(pos));
|
||||
|
@ -622,8 +622,8 @@ void TRiga_partite::elimina_rata(int r)
|
||||
{ // il metodo rate() funzioni sempre correttamente
|
||||
TRiga_scadenze& scad = rata(r);
|
||||
for (int p = scad.last(); p > 0; p = scad.pred(p))
|
||||
scad.elimina_pagamento(p);
|
||||
rows_array().destroy_row(r);
|
||||
scad.elimina_pagamento(p); // Elimina pagamento
|
||||
rows_array().destroy_row(r); // Elimina rata
|
||||
}
|
||||
}
|
||||
|
||||
@ -643,7 +643,7 @@ tipo_movimento TRiga_partite::tipo() const
|
||||
const tipo_movimento tm = (tipo_movimento)(get_char(PART_TIPOMOV)-'0');
|
||||
#ifdef DBG
|
||||
if (tm == tm_nessuno && get_int(PART_NRIGA) != TPartita::UNASSIGNED)
|
||||
fatal_box("Riga partite con un tipo losco.");
|
||||
yesnofatal_box("Riga partite con un tipo losco.");
|
||||
#endif
|
||||
return tm;
|
||||
}
|
||||
@ -947,11 +947,7 @@ bool TPartita::read(const TBill& clifo, int year, const char* num)
|
||||
if (_conto.tipo() > ' ' && allineamento_corrente() > ' ')
|
||||
{
|
||||
// Cerca la partita usando l'allineamento richiesto dall'utente
|
||||
if (is_on_file())
|
||||
{
|
||||
// Trovata!
|
||||
}
|
||||
else
|
||||
if (!is_on_file())
|
||||
{
|
||||
// Se non la trova inverte l'allineamento
|
||||
if (allineamento_corrente() == 'R')
|
||||
@ -960,16 +956,10 @@ bool TPartita::read(const TBill& clifo, int year, const char* num)
|
||||
_num.right_just(NUMLEN);
|
||||
|
||||
// Riprova a cercarla col nuovo allineamento
|
||||
if (is_on_file())
|
||||
{
|
||||
// Esiste: memorizzo l'allineamento
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!is_on_file())
|
||||
allinea(); // Non esite: e' una nuova partita!
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
_num.trim();
|
||||
_align = allineamento_corrente();
|
||||
@ -1690,6 +1680,7 @@ void TPartita::sposta_riga(int from_row, TPartita& part, int to_row)
|
||||
nuova.zero(PART_IMPORTOVAL);
|
||||
nuova.zero(PART_ABBUONI);
|
||||
nuova.zero(PART_DIFFCAM);
|
||||
nuova.zero(PART_RITENUTE);
|
||||
address[j] = nuova.get_int(PART_NRIGA);
|
||||
}
|
||||
|
||||
|
@ -76,12 +76,19 @@ void TSaldaconto_app::on_config_change()
|
||||
bool TSaldaconto_app::menu(MENU_TAG)
|
||||
{
|
||||
TMask& m = curr_mask();
|
||||
while (m.run() == K_ENTER)
|
||||
|
||||
bool ok = TRUE;
|
||||
while (ok)
|
||||
{
|
||||
xvt_statbar_set("Ricerca", TRUE);
|
||||
ok = m.run() == K_ENTER;
|
||||
if (ok)
|
||||
{
|
||||
_allow_firm = FALSE;
|
||||
edit_partite(m);
|
||||
_allow_firm = TRUE;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ class TFattura_mask : public TMask
|
||||
protected:
|
||||
static bool clifo_handler(TMask_field& f, KEY key);
|
||||
static bool datadoc_handler(TMask_field& f, KEY key);
|
||||
static bool codpag_handler(TMask_field& f, KEY key);
|
||||
static bool nrate_handler(TMask_field& f, KEY key);
|
||||
static bool recalc_handler(TMask_field& f, KEY key);
|
||||
static bool codcab_handler(TMask_field& f, KEY key);
|
||||
@ -55,8 +56,11 @@ public:
|
||||
TFattura_mask::TFattura_mask(TRiga_partite& fattura)
|
||||
: TMask("sc0100c"), _fattura(fattura), _pag(NULL)
|
||||
{
|
||||
set_mode(_fattura.rate() > 0 ? MODE_MOD : MODE_INS);
|
||||
enable(DLG_DELREC, edit_mode());
|
||||
const bool edit = _fattura.rate() > 0;
|
||||
set_mode(edit ? MODE_MOD : MODE_INS);
|
||||
xvt_statbar_set(edit ? "Modifica" : "Inserimento", TRUE);
|
||||
|
||||
enable(DLG_DELREC, edit);
|
||||
|
||||
set_handler(E_TOTALE, TSaldaconto_app::totale_handler);
|
||||
set_handler(E_IMPOSTE, TSaldaconto_app::imposte_handler);
|
||||
@ -75,6 +79,7 @@ TFattura_mask::TFattura_mask(TRiga_partite& fattura)
|
||||
set_handler(clifo, clifo_handler);
|
||||
|
||||
set_handler(E_DATADOC, datadoc_handler);
|
||||
set_handler(E_CODPAG, codpag_handler);
|
||||
set_handler(FS_NRATE, nrate_handler);
|
||||
set_handler(FS_RECALC, recalc_handler);
|
||||
set_handler(FS_NSCAB, codcab_handler);
|
||||
@ -89,7 +94,7 @@ TFattura_mask::TFattura_mask(TRiga_partite& fattura)
|
||||
sm.set_handler(105, tipopag_handler);
|
||||
sm.set_handler(106, tipopag_handler);
|
||||
|
||||
const bool ad = _fattura.ultima_rata_con_abbuoni_diffcam() > 0;
|
||||
const bool ad = edit && _fattura.ultima_rata_con_abbuoni_diffcam() > 0;
|
||||
if (ad) // Esistono abbuoni o differenze cambio sulla fattura
|
||||
{
|
||||
disable(E_SEZIONE); // Non posso cambiare sezione
|
||||
@ -104,6 +109,7 @@ TFattura_mask::TFattura_mask(TRiga_partite& fattura)
|
||||
TFattura_mask::~TFattura_mask()
|
||||
{
|
||||
delete _pag;
|
||||
xvt_statbar_set("Estratto conto", TRUE);
|
||||
}
|
||||
|
||||
real TFattura_mask::totale_rate(bool val) const
|
||||
@ -401,6 +407,44 @@ bool TFattura_mask::datadoc_handler(TMask_field& f, KEY key)
|
||||
}
|
||||
|
||||
|
||||
bool TFattura_mask::codpag_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
|
||||
TFattura_mask& m = (TFattura_mask&)f.mask();
|
||||
if (key == K_ENTER)
|
||||
{
|
||||
if (f.get().empty())
|
||||
{
|
||||
f.error_box("Il codice di pagamento e' obbligatorio!\n"
|
||||
"Se possibile esso verra' proposto, ma potra'\n"
|
||||
"essere modificato prima di registrare il movimento.");
|
||||
|
||||
const char typ = m.get(E_CLIFO)[0];
|
||||
const long cod = m.get_long(typ == 'C' ? E_CLIENTE : E_FORNITORE);
|
||||
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
clifo.put(CLI_TIPOCF, typ);
|
||||
clifo.put(CLI_CODCF, cod);
|
||||
if (clifo.read() == NOERR)
|
||||
{
|
||||
const TString& cp = clifo.get(CLI_CODPAG);
|
||||
if (cp.not_empty())
|
||||
{
|
||||
f.set(cp);
|
||||
key = K_TAB;
|
||||
}
|
||||
}
|
||||
ok = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (key == K_TAB && f.focusdirty() && m.insert_mode())
|
||||
m.set_scadenze();
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TFattura_mask::clifo_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_TAB)
|
||||
@ -858,8 +902,12 @@ bool TPay_mask::descr_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
{
|
||||
TPay_mask& pm = (TPay_mask&)f.mask();
|
||||
const short id = f.dlg() == E_DESCR ? S_DESCAGG : E_DESCR;
|
||||
f.mask().set(id, f.get());
|
||||
const char* d = f.get();
|
||||
pm.set(id, d);
|
||||
if (pm.unassigned())
|
||||
pm.set(S_DESCR, d);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -978,11 +1026,6 @@ bool TSaldaconto_app::totale_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
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;
|
||||
@ -1070,8 +1113,6 @@ bool TSaldaconto_app::totval_handler(TMask_field& f, KEY key)
|
||||
}
|
||||
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;
|
||||
@ -1128,12 +1169,14 @@ bool TSaldaconto_app::valuta_handler(TMask_field& f, KEY k)
|
||||
|
||||
if (is_fattura(m))
|
||||
{
|
||||
m.set(FS_VALUTA, val); // Copia a pagina 2
|
||||
TFattura_mask& fm = (TFattura_mask&)m;
|
||||
fm.set(FS_VALUTA, val); // Copia codice valuta a pagina 2
|
||||
fm.set_totale_pagamento(TRUE); // Aggiorna colonne sheet
|
||||
}
|
||||
else
|
||||
{
|
||||
TPay_mask& pm = (TPay_mask&)m;
|
||||
pm.attiva_valuta(full);
|
||||
pm.attiva_valuta(full); // Dis/abilita campi gestione valuta
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user