Aggiunta ricerca per descrizione nelle causali

Corretto aggiornamento automatico del protocollo IVA in prima nota


git-svn-id: svn://10.65.10.50/trunk@432 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-10-20 17:48:25 +00:00
parent d490e495d9
commit 62b6b0d5cf
8 changed files with 59 additions and 23 deletions

View File

@ -21,11 +21,11 @@ BEGIN
FLAGS "U"
USE LF_CAUSALI
INPUT CODCAUS F_COD_CAUS
DISPLAY "Cod. causale" CODCAUS
DISPLAY "Codice" CODCAUS
DISPLAY "Descrizione @50" DESCR
DISPLAY "Tipo documento" TIPODOC
DISPLAY "Codice registro" REG
DISPLAY "Tipo movimento" TIPOMOV
DISPLAY "Documento" TIPODOC
DISPLAY "Registro" REG
DISPLAY "Movimento" TIPOMOV
OUTPUT F_COD_CAUS CODCAUS
OUTPUT F_DESCR DESCR
HELP "Codice causale"
@ -36,14 +36,14 @@ STRING F_DESCR 40
BEGIN
PROMPT 17 1 "Descrizione "
FIELD LF_CAUSALI->DESCR
COPY USE F_COD_CAUS
USE LF_CAUSALI KEY 2
INPUT CODCAUS F_COD_CAUS
INPUT DESCR F_DESCR
DISPLAY "Cod. causale" CODCAUS
DISPLAY "Descrizione @50" DESCR
DISPLAY "Tipo documento" TIPODOC
DISPLAY "Codice registro" REG
DISPLAY "Tipo movimento" TIPOMOV
DISPLAY "Codice" CODCAUS
DISPLAY "Documento" TIPODOC
DISPLAY "Registro" REG
DISPLAY "Movimento" TIPOMOV
OUTPUT F_COD_CAUS CODCAUS
OUTPUT F_DESCR DESCR
HELP "Descrizione della causale"

View File

@ -76,7 +76,7 @@ TMask* TPrimanota_application::load_mask(int n)
ism.set_handler(102, codiva_handler);
ism.set_handler(103, detrazione_handler);
ism.set_handler(104, imposta_handler);
ism.set_handler(109, suspended_handler);
ism.set_handler(109, iva_sottoconto_handler);
ism.set_handler(209, sheet_clifo_handler);
ism.set_handler(309, sheet_clifo_handler);
}
@ -304,6 +304,8 @@ void TPrimanota_application::init_mask(TMask& m)
const bool corrval = intra && _causale.corrval();
m.show(F_CORRVALUTA, corrval);
m.show(F_CODIVA, m.mode() == MODE_INS);
}
// Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_VISVAL (GROUP 3)
@ -443,8 +445,6 @@ void TPrimanota_application::init_insert_mode(TMask& m)
void TPrimanota_application::init_modify_mode(TMask& m)
{
init_mask(m);
if (iva() != nessuna_iva)
m.hide(F_CODIVA);
}
@ -754,14 +754,18 @@ int TPrimanota_application::write(const TMask& m)
{
_saldi.registra();
if (iva() != nessuna_iva && !gestione_saldaconto())
if (iva() != nessuna_iva)
{
const TString16 causimm(_causale.causale_inc_imm());
if (causimm.not_empty())
genera_incasso(causimm);
causale().reg().reread(); // Aggiorna protocollo IVA
if (!gestione_saldaconto())
{
const TString16 causimm(causale().causale_inc_imm());
if (causimm.not_empty())
genera_incasso(causimm);
}
}
if (gestione_saldaconto() && _causale.saldaconto())
if (gestione_saldaconto() && causale().saldaconto())
aggiorna_scadenzario(m);
}
return err;

View File

@ -892,7 +892,7 @@ bool TPrimanota_application::cg_conto_handler(TMask_field& f, KEY key)
if (key == K_TAB || key == K_ENTER)
{
TMask& m = f.mask();
if (m.get(115)[0] == 'T')
if (m.get(115)[0] == 'T') // Se riga totale documento
{
const char cf = m.get(f.dlg()-2)[0];
char tipo = app().clifo();
@ -907,6 +907,26 @@ bool TPrimanota_application::cg_conto_handler(TMask_field& f, KEY key)
return TRUE;
}
bool TPrimanota_application::iva_sottoconto_handler(TMask_field& f, KEY key)
{
if (!suspended_handler(f, key))
return FALSE;
if (key == K_TAB && f.dirty() && !app().causale().corrispettivi())
{
TMask& m = f.mask();
const TFixed_string td(app().causale().tipo_doc());
if (td == "FV" || td == "NC") // Nun lo vulevo fa' CASAP
{
const int cr = m.get_int(105);
if (cr == 2 || cr == 3)
m.set(105, 4);
}
}
return TRUE;
}
bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k)
{
if (!suspended_handler(f, k))
@ -996,7 +1016,7 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
f.error_box("Causale incongruente con quella inserita precedentemente");
return FALSE;
}
app().read_caus(cau, ann);
app().causale().read(cau, ann);
}
return TRUE;
@ -1062,7 +1082,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
{
if (reg.year() != dr.year())
{
const bool ok = reg.read(codreg, dr.year());
const bool ok = reg.reread();
if (!ok) return FALSE;
}

View File

@ -71,6 +71,7 @@ class TPrimanota_application : public TRelation_application
static bool descr_handler(TMask_field& f, KEY k);
static bool sheet_clifo_handler(TMask_field& f, KEY k);
static bool iva_sottoconto_handler(TMask_field& f, KEY k);
static bool imponibile_handler(TMask_field& f, KEY key);
static bool detrazione_handler(TMask_field& f, KEY key);
static bool codiva_handler(TMask_field& f, KEY key);

View File

@ -62,6 +62,16 @@ bool TRegistro::read(const char* cod, int year)
return err == NOERR;
}
bool TRegistro::reread()
{
if (ok())
{
const TString16 n(name());
const int y = year();
return read(n, y);
}
return FALSE;
}
int TRegistro::year() const
{

View File

@ -30,6 +30,7 @@ protected:
public:
bool read(const char* code, int year);
bool reread();
TRegistro& operator =(const TRegistro& r);
virtual bool ok() const { return !_rec.empty(); }

View File

@ -2,14 +2,12 @@
MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File"
ITEM BAR_ITEM(1) "~Parametri"
MENUBAR MENU_BAR(1)
MENU MENU_BAR(1)
SUBMENU MENU_FILE "~File"
ITEM BAR_ITEM(1) "~Parametri"
MENUBAR MENU_BAR(2)

View File

@ -5,6 +5,8 @@
//
/////////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <isam.h>
#include <date.h>
#include <saldi.h>
@ -167,7 +169,7 @@ void TSaldo_agg::registra()
for (int i=0; i < conti; i++)
{
THash_object * hobj = tconti();
TConto & tcon = hobj->obj();
TConto & tcon = (TConto &)hobj->obj();
if (!tcon.ok()) continue;
saldi.zero();