Gestione numero paritita in inserimento
git-svn-id: svn://10.65.10.50/trunk@2232 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b951884742
commit
0aeeb04dad
@ -476,7 +476,7 @@ void TPrimanota_application::init_mask(TMask& m)
|
||||
|
||||
m.show(F_CODIVA, m.mode() == MODE_INS); // Codice IVA standard
|
||||
|
||||
if (pagamento() != NULL)
|
||||
if (is_fattura())
|
||||
{
|
||||
const TPartita* game = partite().first();
|
||||
const bool scad_free = game == NULL || !game->esistono_abbuoni_diffcam(m.get_long(F_NUMREG));
|
||||
@ -487,7 +487,8 @@ void TPrimanota_application::init_mask(TMask& m)
|
||||
|
||||
m.enable(F_CODPAG, scad_free); // Disabilita codice pagamento
|
||||
m.enable(FS_RESET, scad_free); // Disabilita tasto di reset
|
||||
if (!scad_free) m.set(FS_RECALC, "", TRUE);
|
||||
if (!scad_free)
|
||||
m.set(FS_RECALC, "", TRUE);
|
||||
m.enable(FS_RECALC, scad_free); // Disabilita ricalcolo automatico
|
||||
}
|
||||
}
|
||||
@ -574,10 +575,14 @@ void TPrimanota_application::init_insert_mode(TMask& m)
|
||||
set_pagamento(NULL,dt);
|
||||
set_scadenze(m);
|
||||
}
|
||||
else
|
||||
set_pagamento(NULL,NULL); // Annulla pagamento
|
||||
}
|
||||
else
|
||||
{
|
||||
partite().destroy();
|
||||
|
||||
set_pagamento(NULL,NULL); // Annulla pagamento
|
||||
}
|
||||
_saldi.reset(); // Inizializza saldi
|
||||
}
|
||||
|
||||
@ -695,8 +700,7 @@ int TPrimanota_application::read(TMask& m)
|
||||
calcola_imp(); // Calcola totale imponibile ed imposte
|
||||
|
||||
partite().destroy();
|
||||
const int tm = causale().tipomov();
|
||||
if (tm != 0 && tm != 2) // Ci sono scadenze
|
||||
if (is_fattura()) // Ci sono scadenze
|
||||
{
|
||||
const TString16 cp(m.get(F_CODPAG));
|
||||
const TString16 dt(m.get(F_DATAREG));
|
||||
@ -892,9 +896,9 @@ int TPrimanota_application::write(const TMask& m)
|
||||
{
|
||||
switch (causale().tipomov())
|
||||
{
|
||||
case 1:
|
||||
case tm_fattura:
|
||||
write_scadenze(m); break; // Salva fattura
|
||||
case 2:
|
||||
case tm_nota_credito:
|
||||
salvaconto = TRUE; break; // Salva nota credito
|
||||
default:
|
||||
break;
|
||||
@ -945,7 +949,7 @@ int TPrimanota_application::rewrite(const TMask& m)
|
||||
bool salvaconto = FALSE;
|
||||
if (iva() != nessuna_iva)
|
||||
{
|
||||
if (causale().tipomov() == 2)
|
||||
if (causale().tipomov() == tm_nota_credito)
|
||||
salvaconto = TRUE;
|
||||
else
|
||||
write_scadenze(m);
|
||||
|
@ -181,11 +181,30 @@ bool TPrimanota_application::numrif_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
if (f.to_check(key))
|
||||
{
|
||||
const TPartita* old = app().partite().first();
|
||||
if (old && f.get().blank()) // Se esisteva una partita ma ora non piu'
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const bool empty = f.get().blank();
|
||||
if (empty && m.insert_mode())
|
||||
{
|
||||
f.set(m.get(app()._npart_is_prot ? F_PROTIVA : F_NUMDOC));
|
||||
if (m.get(F_ANNORIF).empty())
|
||||
{
|
||||
const TString& anno = m.get(F_DATADOC).right(4);
|
||||
m.set(F_ANNORIF, anno);
|
||||
}
|
||||
if (m.get(F_CODPAG).empty())
|
||||
{
|
||||
TMask_field& clifo = m.field(app().iva() == iva_vendite ? F_CLIENTE : F_FORNITORE);
|
||||
clifo.on_hit();
|
||||
}
|
||||
return error_box("Il numero di riferimento partita e' obbligatorio!\n"
|
||||
"Se possibile esso verra' proposto, ma potra'\n"
|
||||
"essere modificato prima di registrare il movimento.");
|
||||
}
|
||||
|
||||
const TPartita* old = app().partite().first();
|
||||
if (old && empty) // Se esisteva una partita ma ora non piu'
|
||||
{
|
||||
const KEY k = yesnocancel_box("Attenzione la fattura della partita %d %s verra' eliminata.\n"
|
||||
"Premere SI per cancellarla, NO per ripristinarla, ANNULLA modificarla",
|
||||
old->anno(), (const char*)old->numero());
|
||||
@ -343,7 +362,12 @@ void TPrimanota_application::recalc_scadenze(const TDate& d)
|
||||
|
||||
void TPrimanota_application::set_pagamento(const char* c, const char* d)
|
||||
{
|
||||
if (_pag != NULL) delete _pag;
|
||||
if (_pag != NULL)
|
||||
{
|
||||
delete _pag;
|
||||
_pag = NULL;
|
||||
}
|
||||
if (c != NULL || d != NULL)
|
||||
_pag = new TPagamento(c, d);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <applicat.h>
|
||||
#include <prefix.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "cglib.h"
|
||||
@ -284,7 +284,7 @@ TEsercizi_contabili::TEsercizi_contabili() : _firm(0)
|
||||
|
||||
void TEsercizi_contabili::update()
|
||||
{
|
||||
_firm = main_app().get_firm();
|
||||
_firm = prefix().get_codditta();
|
||||
|
||||
destroy();
|
||||
TTable esc("ESC");
|
||||
@ -298,7 +298,7 @@ void TEsercizi_contabili::update()
|
||||
|
||||
void TEsercizi_contabili::check()
|
||||
{
|
||||
if (_firm != main_app().get_firm())
|
||||
if (_firm != prefix().get_codditta())
|
||||
{
|
||||
#ifdef DBG
|
||||
if (_firm != 0)
|
||||
|
@ -571,14 +571,11 @@ int TRiga_partite::ultima_ratapagata() const
|
||||
return r;
|
||||
}
|
||||
|
||||
bool TRiga_partite::is_fattura() const
|
||||
tipo_movimento TRiga_partite::tipo() const
|
||||
{
|
||||
return get_int(PART_TIPOMOV) == 1;
|
||||
}
|
||||
|
||||
bool TRiga_partite::is_nota_credito() const
|
||||
{
|
||||
return get_int(PART_TIPOMOV) == 2;
|
||||
const tipo_movimento tm = (tipo_movimento)get_int(PART_TIPOMOV);
|
||||
CHECKD(tm != tm_nessuno, "Riga partite con un tipo losco ", tm);
|
||||
return tm;
|
||||
}
|
||||
|
||||
int TRiga_partite::read(TBaseisamfile& f, word op)
|
||||
|
@ -158,6 +158,9 @@ public:
|
||||
virtual ~TRiga_scadenze() {}
|
||||
};
|
||||
|
||||
enum tipo_movimento { tm_nessuno = 0, tm_fattura = 1, tm_nota_credito = 2,
|
||||
tm_pagamento = 3, tm_insoluto = 5, tm_pagamento_insoluto = 6 };
|
||||
|
||||
class TRiga_partite : public TTree_rectype
|
||||
{
|
||||
friend class TPartita;
|
||||
@ -180,8 +183,9 @@ public:
|
||||
void elimina_rata(int r = 0);
|
||||
TRiga_scadenze& new_row(int r = 0);
|
||||
|
||||
bool is_fattura() const;
|
||||
bool is_nota_credito() const;
|
||||
tipo_movimento tipo() const;
|
||||
bool is_fattura() const { return tipo() == tm_fattura; }
|
||||
bool is_nota_credito() const { return tipo() == tm_nota_credito; }
|
||||
int ultima_ratapagata() const;
|
||||
int ultimo_pagamento(int rata) const;
|
||||
int rata_con_abbuoni_diffcam() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user