Corretti errori Gabri

git-svn-id: svn://10.65.10.50/trunk@2405 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-01-09 10:32:00 +00:00
parent 67c4f0bef0
commit 99b99f1557
12 changed files with 87 additions and 68 deletions

View File

@ -54,7 +54,6 @@ protected:
static bool sezione_hndl (TMask_field& f, KEY k);
static bool conto_hndl (TMask_field& f, KEY k);
static bool sottoconto_hndl (TMask_field& f, KEY k);
// static bool codcausim_hndl (TMask_field& f, KEY k);
static bool m770_hndl (TMask_field& f, KEY k);
static bool ss_notify (TSheet_field& s, int r, KEY k);
@ -249,7 +248,7 @@ void TCaus_app::causale_inc_pag()
set_descr ( i++, "C Cessione");
set_descr ( i++, "C Paghero'");
set_descr ( i++, "C Lettera di credito");
// set_descr ( i++, "C Tratta accettata");
set_descr ( i++, "C Tratta accettata");
set_descr ( i++, "C Abbuoni pass./sc.");
set_descr ( i++, "C Abbuoni att./sc.");
set_descr ( i++, "C Spese e rimborsi");

View File

@ -3,7 +3,7 @@
//**************************************************
#include <mov.h>
#include <rmoviva.h>
#include <caus.h>
#include <causali.h>
#include "cg2103.h"
#include "cg1301.h"

View File

@ -275,7 +275,6 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
}
else
{
m->efield(F_CODPAG).check_type(_is_saldaconto ? CHECK_REQUIRED : CHECK_NORMAL);
m->efield(F_CODPAG).enable(!nota_credito);
m->show(F_ANNORIF, _is_saldaconto); // Mostra/nasconde anno e riferimento partita
@ -337,9 +336,10 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
if (iva == nessuna_iva)
{
char tipr = ' ';
if (_is_saldaconto)
if (is_pagamento())
{
if (nriga < 13 && nriga != 10) continue; // Si considerano solo le spese
if (nriga <= RIGA_DIFFCAM && nriga != RIGA_SPESE)
continue; // Si considerano solo le spese
tipr = 'G';
}
const int pos = set_cgs_row(-1, zero, tc, desc, tipr);

View File

@ -216,7 +216,7 @@ BEGIN
OUTPUT F_CODPAG CODTAB
CHECKTYPE NORMAL
ADD RUN ba3 -6
WARNING "Codice pagamento assente"
WARNING "Codice pagamento errato"
END
STRING F_CLIFO 1

View File

@ -1936,20 +1936,26 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
TMask& m = f.mask();
if (key == K_TAB && f.focusdirty())
{
if (app().iva() != nessuna_iva)
{
TPrimanota_application& a = app();
if (a.iva() != nessuna_iva)
{
app().add_cgs_tot(m);
a.add_cgs_tot(m);
if (m.insert_mode()) // Se si e' in inserimento provoca ricalcolo
m.field(F_CODIVA).on_hit(); // dello sheet iva e delle scadenze
else
{
if (a.is_fattura())
a.set_totale_pagamento();
}
}
else
{
if (app().is_pagamento())
app().calcola_saldo();
if (a.is_pagamento())
a.calcola_saldo();
}
app().gioca_cambi();
a.gioca_cambi();
}
if (key == K_ENTER)
@ -1979,8 +1985,13 @@ bool TPrimanota_application::totdocval_handler(TMask_field& f, KEY key)
app().gioca_cambi();
TMask& m = f.mask();
if (app().is_fattura() && m.insert_mode()) // Se e' una fattura
app().set_scadenze(m);
if (app().is_fattura()) // Se e' una fattura
{
if (m.insert_mode())
app().set_scadenze(m);
else
app().set_totale_pagamento();
}
}
return TRUE;

View File

@ -25,6 +25,12 @@
#include "cg2103.h"
#endif
#define RIGA_ABBUONI_PASSIVI 9
#define RIGA_ABBUONI_ATTIVI 10
#define RIGA_SPESE 11
#define RIGA_RITENUTE 12
#define RIGA_DIFFCAM 13
class TPrimanota_application : public TRelation_application
{
TArray _file; // Tutti i fiels da usare
@ -222,6 +228,7 @@ protected:
TPagamento& pagamento() const;
void set_pagamento(const char* c, const char* d);
void set_totale_pagamento();
void reset_pagamento(TMask& m);
void set_scadenze(TMask& m);
bool read_scadenze(TMask& m);

View File

@ -198,7 +198,7 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
const TString is(imp.string(pic));
const TString ts(tot.string(pic));
const bool recalc = yesno_box("Il totale delle rate e' %s mentre\n"
"il totale del documento in valuta e' %s.\n"
"il totale del documento e' %s.\n"
"Si desidera ricalcolare le rate e poi\n"
"registrare in un secondo momento?",
(const char*)is, (const char*)ts);
@ -247,10 +247,15 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
if (m.insert_mode() && app().is_fattura())
{
if (key == K_ENTER && f.get().empty())
if (key == K_ENTER)
{
const bool required = m.insert_mode() || !m.get(F_NUMRIF).blank();
if (required && f.get().empty())
{
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 = app().clifo();
const long cod = m.get_long(typ == 'C' ? F_CLIENTE : F_FORNITORE);
@ -259,22 +264,21 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
clifo.put(CLI_CODCF, cod);
if (clifo.read() == NOERR)
{
f.set(clifo.get(CLI_CODPAG));
key = K_TAB; // cosi' scatta l'handler del K_TAB
}
return error_box("Il codice di pagamento e' obbligatorio!\n"
"Se possibile esso verra' proposto, ma potra'\n"
"essere modificato prima di registrare il movimento.");
}
if (key == K_TAB && f.focusdirty())
{
const TString16 dt(m.get(F_DATADOC));
app().set_pagamento(f.get(), dt);
app().set_scadenze(m);
const TString& cp = clifo.get(CLI_CODPAG);
if (cp.not_empty())
{
f.set(cp);
if (m.insert_mode())
app().set_scadenze(m);
}
}
return FALSE;
}
}
if (key == K_TAB && f.focusdirty() && m.insert_mode())
app().set_scadenze(m);
return TRUE;
}
@ -528,15 +532,12 @@ void TPrimanota_application::set_pagamento(const char* c, const char* d)
_pag = new TPagamento(c, d);
}
void TPrimanota_application::set_scadenze(TMask& m)
{
const TString16 cp(m.get(F_CODPAG));
const TString16 dt(m.get(F_DATADOC));
set_pagamento(cp, dt);
void TPrimanota_application::set_totale_pagamento()
{
real imponibile, imposta;
const real spese(0.0);
const TMask& m = curr_mask();
TPagamento& pag = pagamento();
pag.set_cambio(m.get_real(SK_CAMBIO));
@ -550,7 +551,18 @@ void TPrimanota_application::set_scadenze(TMask& m)
imposta = m.get_real(F_IMPOSTE);
imponibile = m.get_real(F_TOTALE) - imposta;
}
pag.set_total(imponibile, imposta, spese);
}
void TPrimanota_application::set_scadenze(TMask& m)
{
const TString16 cp(m.get(F_CODPAG));
const TString16 dt(m.get(F_DATADOC));
set_pagamento(cp, dt);
set_totale_pagamento();
TPagamento& pag = pagamento();
if (m.field(FS_RECALC).enabled())
{
m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2");
@ -561,7 +573,6 @@ void TPrimanota_application::set_scadenze(TMask& m)
m.set(FS_NRATE, pag.n_rate());
}
pag.set_total(imponibile, imposta, spese);
pag.set_rate_auto();
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
pag.set_sheet(ps); // prepara lo sheet
@ -596,30 +607,16 @@ bool TPrimanota_application::read_scadenze(TMask& m)
}
set_pagamento(codpag, datadoc.string());
TPagamento& pag = pagamento();
const TValuta cambio(partita);
const bool in_valuta = cambio.in_valuta();
if (in_valuta)
pag.set_cambio(cambio.cambio());
const bool in_valuta = pag.in_valuta();
const real totale = m.get(in_valuta ? SK_TOTDOCVAL : F_TOTALE);
if (totale != partita.importo(in_valuta).valore() ||
m.get_real(F_IMPOSTE) != partita.get_real(PART_IMPOSTA))
{
warning_box("Gli importi delle scadenze non corrispondono al totale documento");
}
real imponibile = partita.importo(in_valuta).valore();
real imposta = partita.get_real(PART_IMPOSTA);
real spese(0.0);
if (in_valuta)
{
cambio.lit2val(imposta); // Converte in valuta imposte e spese
cambio.lit2val(spese);
}
imponibile -= imposta; // Nel pagamento il totale deve essere senza imposta
pag.set_total(imponibile, imposta, spese);
set_totale_pagamento();
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
@ -838,6 +835,7 @@ bool TPrimanota_application::showpartite_handler(TMask_field& f, KEY k)
// 0 non sto cancellando nulla
// 1 sto cancellando la prima riga contabile
// n sto cancellando la ennesima riga contabile
bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pag,
const TValuta& valuta, int deleting)
{
@ -895,8 +893,8 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
const riga = type2pos('F');
if (riga < 0)
{
TBill conto_rit; causale().bill(11, conto_rit);
const TString desc(causale().desc_agg(11));
TBill conto_rit; causale().bill(RIGA_RITENUTE, conto_rit);
const TString desc(causale().desc_agg(RIGA_RITENUTE));
set_cgs_row(riga, grow_ritenute, conto_rit, desc, 'F');
}
else
@ -941,7 +939,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
if (riga_abb < 0)
{
const int rc = new_ap == 'A' ? 9 : 8;
const int rc = new_ap == 'A' ? RIGA_ABBUONI_ATTIVI : RIGA_ABBUONI_PASSIVI;
TBill conto_abb; causale().bill(rc, conto_abb);
const TString desc(causale().desc_agg(rc));
app().set_cgs_row(riga_abb, new_abbuono, conto_abb, desc, new_ap);
@ -967,8 +965,8 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
if (riga_diffcam < 0)
{
TBill conto_diffcam; causale().bill(12, conto_diffcam);
const TString desc(causale().desc_agg(12));
TBill conto_diffcam; causale().bill(RIGA_DIFFCAM, conto_diffcam);
const TString desc(causale().desc_agg(RIGA_DIFFCAM));
set_cgs_row(riga_diffcam, grow_diffcam, conto_diffcam, desc, 'C');
}
else

View File

@ -1339,8 +1339,8 @@ void TGame_mask::fill_partite()
if (!app().partite().exist(conto(), anno, num))
{
TPartita game(conto(), anno, num);
if (all || !game.chiusa())
update_partita(game, -1);
if (all || !game.chiusa())
update_partita(game, -1);
}
partita.put(PART_NRIGA, 9999); // Forza lettura partita successiva nella prossima read
}

View File

@ -1,6 +1,10 @@
#ifndef __CONTO_H
#define __CONTO_H
#ifndef __OBJECT_H
#include <object.h>
#endif
#ifndef __ISAM_H
class TRectype;
#endif

View File

@ -701,7 +701,7 @@ void TPagamento::strerr(word err, TString& s)
imp += tpay_rata(i);
const char pic[3] = { '.', _round, '\0' };
s << "La somma degli importi (" << imp.string(pic);
s << ") e' diversa dal totale del pagamento (" << tot.string(pic) << ")\n";
s << ") e' diversa dal\ntotale del pagamento (" << tot.string(pic) << ")\n";
}
if (err & P_MCOMM)
s << "Scadenze incompatibili con il mese commerciale\n";

View File

@ -243,8 +243,8 @@ TDecoder::TDecoder(int num, const char* inf, const char* outf)
: _file(new TLocalisamfile(num)), _if(inf), _of(outf)
{ }
TDecoder::TDecoder(const char* tab)
: _file(new TTable(tab)), _if("CODTAB"), _of("S0")
TDecoder::TDecoder(const char* tab, const char* outf)
: _file(new TTable(tab)), _if("CODTAB"), _of(outf)
{ }
TDecoder::~TDecoder()

View File

@ -119,7 +119,7 @@ public:
const TString& decode(long code);
TDecoder(int num, const char* inf, const char* outf);
TDecoder(const char* table);
TDecoder(const char* table, const char* outf = "S0");
virtual ~TDecoder();
};