Corretti parametri liquidazione

git-svn-id: svn://10.65.10.50/trunk@1001 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-02-15 08:52:47 +00:00
parent 7b4320cec7
commit 148956c90c
9 changed files with 162 additions and 152 deletions

@ -311,7 +311,7 @@ END
BOOLEAN FLD_CM2_STSOTTBIL
BEGIN
PROMPT 1 14 "Non stampare dettaglio sottoconti su bilanci "
PROMPT 1 14 "Non stampare dettaglio sottoconti su bilanci a sezioni"
HELP "Indicare se stampare il dettaglio dei sottoconti nei bilanci di verifica"
FIELD LF_PCON->STSOTTBIL
GROUP 1 3
@ -319,7 +319,7 @@ END
BOOLEAN FLD_CM2_COMPENS
BEGIN
PROMPT 50 14 "Compensazione saldi "
PROMPT 50 14 "Compensazione saldi"
HELP "Indicare se e' ammessa la compensazione dei saldi"
FIELD LF_PCON->COMPENS
GROUP 1 3
@ -327,7 +327,7 @@ END
BOOLEAN FLD_CM2_STSOTTAB
BEGIN
PROMPT 1 15 "Stampa dettaglio sottoconti su analisi "
PROMPT 1 15 "Stampa dettaglio sottoconti su analisi"
HELP "Indicare se stampare il dettaglio dei sottoconti nell'analisi di bilancio"
FIELD LF_PCON->STSOTTAB
GROUP 1 3

@ -55,7 +55,7 @@ END
STRING F_RAGSOC 30
BEGIN
PROMPT 23 1 "Ragione sociale "
PROMPT 23 1 "Cognome / Rag. Soc."
FIELD LF_CLIFO->RAGSOC[1,30]
KEY 2
USE LF_CLIFO KEY 2
@ -75,7 +75,7 @@ END
STRING F_RAGSOCA 20
BEGIN
PROMPT 23 2 "Nome o seconda parte rag. soc. "
PROMPT 23 2 "Nome / Seconda parte Rag. Soc. "
FIELD LF_CLIFO->RAGSOC[31,]
KEY 2
HELP "Seconda parte della ragione sociale o nome"
@ -360,14 +360,14 @@ END
STRING DLG_NULL 30
BEGIN
PROMPT 23 1 "Ragione sociale "
PROMPT 23 1 "Cognome / Rag. Soc. "
FLAGS "D"
GROUP 3
END
STRING DLG_NULL 20
BEGIN
PROMPT 23 2 "Nome o seconda parte rag. soc. "
PROMPT 23 2 "Nome / Seconda parte Rag. Soc. "
FLAGS "D"
GROUP 6
END
@ -583,14 +583,14 @@ END
STRING DLG_NULL 30
BEGIN
PROMPT 23 1 "Ragione sociale "
PROMPT 23 1 "Cognome / Rag. Soc. "
FLAGS "D"
GROUP 3
END
STRING DLG_NULL 20
BEGIN
PROMPT 23 2 "Nome o seconda parte rag. soc. "
PROMPT 23 2 "Nome / Seconda parte Rag. Soc. "
FLAGS "D"
GROUP 6
END
@ -831,14 +831,14 @@ END
STRING DLG_NULL 30
BEGIN
PROMPT 23 1 "Ragione sociale "
PROMPT 23 1 "Cognome / Rag. Soc. "
FLAGS "D"
GROUP 3
END
STRING DLG_NULL 20
BEGIN
PROMPT 23 2 "Nome o seconda parte rag. soc. "
PROMPT 23 2 "Nome / Seconda parte Rag. Soc. "
FLAGS "D"
GROUP 6
END
@ -890,14 +890,14 @@ END
STRING DLG_NULL 30
BEGIN
PROMPT 23 1 "Ragione sociale "
PROMPT 23 1 "Cognome / Rag. Soc. "
FLAGS "D"
GROUP 3
END
STRING DLG_NULL 20
BEGIN
PROMPT 23 2 "Nome o seconda parte rag. soc. "
PROMPT 23 2 "Nome / seconda parte Rag. Soc. "
FLAGS "D"
GROUP 6
END
@ -1048,14 +1048,14 @@ END
STRING DLG_NULL 30
BEGIN
PROMPT 23 1 "Ragione sociale "
PROMPT 23 1 "Cognome / Rag. Soc. "
FLAGS "D"
GROUP 3
END
STRING DLG_NULL 20
BEGIN
PROMPT 23 2 "Nome o seconda parte rag. soc. "
PROMPT 23 2 "Nome / Seconda parte Rag. Soc. "
FLAGS "D"
GROUP 6
END
@ -1305,14 +1305,14 @@ END
STRING DLG_NULL 30
BEGIN
PROMPT 23 1 "Ragione sociale "
PROMPT 23 1 "Cognome / Rag. Soc. "
FLAGS "D"
GROUP 3
END
STRING DLG_NULL 20
BEGIN
PROMPT 23 2 "Nome o seconda parte rag. soc. "
PROMPT 23 2 "Nome / Seconda Parte Rag. Soc. "
FLAGS "D"
GROUP 6
END
@ -1480,14 +1480,14 @@ END
STRING DLG_NULL 30
BEGIN
PROMPT 23 1 "Ragione sociale "
PROMPT 23 1 "Cognome / Rag. Soc. "
FLAGS "D"
GROUP 3
END
STRING DLG_NULL 20
BEGIN
PROMPT 23 2 "Nome o seconda parte rag. soc. "
PROMPT 23 2 "Nome / Seconda parte Rag. Soc. "
FLAGS "D"
GROUP 6
END
@ -1646,7 +1646,7 @@ BEGIN
HELP "Codice del titolo onorifico"
END
LIST F_RAGGOR 1 14
LIST F_RAGGOR 1 16
BEGIN
PROMPT 2 15 "Raggruppamento ordine "
FIELD LF_CFVEN->RAGGOR

@ -89,7 +89,7 @@ BEGIN
OUTPUT F_CODCAUS CODCAUS
OUTPUT F_DESCRCAUS DESCR
ADD RUN cg0 -4
CHECKTYPE REQUIRED
CHECKTYPE NORMAL
WARNING "Causale assente"
END

@ -1184,8 +1184,9 @@ bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
if (ok)
f.mask().stop_run(K_INS); // Entra in modo inserimento
}
else return FALSE;
}
else
return FALSE;
}
return TRUE;
}

@ -146,7 +146,7 @@ bool TRegistro::read_att()
_att.zero();
TString16 chiave; // Ditta - Anno - Attivita' - Tipo Attivita' (fissata a 1)
chiave.format("%5ld", main_app().get_firm());
chiave.format("%05ld", main_app().get_firm());
chiave << year(); // non fare << year() << attivita()
chiave << attivita() << "1";

@ -29,6 +29,7 @@ BEGIN
WARNIG "Codice ABI errato"
USE %BAN
INPUT CODTAB[1,5] FLD_CODABI
INPUT CODTAB[6,10] FLD_CODCAB
DISPLAY "ABI@5" CODTAB[1,5]
DISPLAY "CAB@5" CODTAB[6,10]
DISPLAY "Denominazione@50" S0
@ -46,10 +47,10 @@ BEGIN
HELP "Codice CAB banca di appoggio per deleghe IVA"
WARNIG "Codice CAB errato"
COPY ALL FLD_CODABI
INPUT CODTAB[6,10] FLD_CODCAB
CHECKTYPE NORMAL
FIELD CodCAB
FLAGS "Z"
VALIDATE REQUIF_FUNC 1 FLD_CODABI
END
STRING FLD_RAGSOCB 50

@ -13,10 +13,10 @@
#include <attiv.h>
#include <nditte.h>
#define TAB_LIA "%LIA"
#define TAB_PLA "%PLA"
class TParaliq_app : public TRelation_application
{
TRelation * _rel;
@ -28,16 +28,16 @@ class TParaliq_app : public TRelation_application
TString_array _atts; // array di stringhe con i codici attivita'
TString_array _tips; // array di stringhe con i tipi attivita'
long _lastditta;
TString16 _freqiva;
void check_registers(int year);
protected:
protected: // Applicat
virtual void on_config_change();
protected: // Relapp
virtual bool user_create();
virtual bool user_destroy();
// minchia di cristo
virtual TRelation* get_relation() const { return _rel; }
virtual TMask* get_mask(int mode) { return _msk; }
virtual bool changing_mask(int mode) { return FALSE; }
@ -53,75 +53,74 @@ protected:
virtual int write(const TMask& m) { return rewrite(m);}
virtual int read(TMask& m);
protected:
void init_array(TMask& m);
// notifier
static bool sheet_action(int r, KEY k);
public:
TParaliq_app() { _lastditta = 0L;}
virtual ~TParaliq_app() {}
TParaliq_app() { _lastditta = 0L; }
virtual ~TParaliq_app() {}
};
void TParaliq_app::check_registers(int year)
{
// controlla che per ogni data attivita' esistano almeno un registro
// acquisti, vendite e giornale; warning appropriato in caso negativo
TTable reg("REG");
TRecfield reg_year(reg.curr(), "CODTAB", 0,3);
const byte R_ACQ = 0x01;
const byte R_VEN = 0x02;
const byte R_ALL = R_ACQ | R_VEN;
// controlla che per ogni data attivita' esistano almeno un registro
// acquisti, vendite e giornale; warning appropriato in caso negativo
TTable reg("REG");
TRecfield reg_year(reg.curr(), "CODTAB", 0,3);
const byte R_ACQ = 0x01;
const byte R_VEN = 0x02;
const byte R_ALL = R_ACQ | R_VEN;
bool is_giornale = FALSE;
bool is_giornale = FALSE;
byte flags = 0x00;
for (int i = 0; i < _atts.items(); i++)
{
TString& att = (TString&)_atts[i];
for (reg.first(); !reg.eof(); reg.next())
{
if (atoi(reg_year) == year && reg.get_int("I0") == 5)
{
is_giornale = TRUE;
continue;
}
if (atoi(reg_year) != year || att != reg.get("S8"))
continue;
switch (reg.get_int("I0"))
{
case 1: // vendite
flags |= R_VEN;
break;
case 2: // acquisti
flags |= R_ACQ;
break;
}
if (flags == R_ALL && is_giornale) break;
}
if (flags < R_ALL)
{
TString wrn("I seguenti registri non esistono per l'attivita' ");
wrn << att << "(" << year << "):";
if ((flags & R_VEN) == 0x00) wrn << "\n\tregistro vendite";
if ((flags & R_ACQ) == 0x00) wrn << "\n\tregistro acquisti";
warning_box(wrn);
}
for (int i = 0; i < _atts.items(); i++)
{
TString& att = (TString&)_atts[i];
for (reg.first(); !reg.eof(); reg.next())
{
if (atoi(reg_year) == year && reg.get_int("I0") == 5)
{
is_giornale = TRUE;
continue;
}
if (atoi(reg_year) != year || att != reg.get("S8"))
continue;
switch (reg.get_int("I0"))
{
case 1: // vendite
flags |= R_VEN;
break;
case 2: // acquisti
flags |= R_ACQ;
break;
}
if (flags == R_ALL && is_giornale) break;
}
if (flags < R_ALL)
{
TString wrn("I seguenti registri non esistono per l'attivita' ");
wrn << att << "(" << year << "):";
if ((flags & R_VEN) == 0x00) wrn << "\n\tregistro vendite";
if ((flags & R_ACQ) == 0x00) wrn << "\n\tregistro acquisti";
warning_box(wrn);
}
}
// libro giornale non si controlla per attivita'
if(!is_giornale)
warning_box("Non esiste probabilmente nessun "
"libro giornale per l'anno %d", year);
// libro giornale non si controlla per attivita'
if(!is_giornale)
warning_box("Non esiste probabilmente nessun "
"libro giornale per l'anno %d", year);
}
void TParaliq_app::init_array(TMask& m)
{
{
const long newditta = m.get_long(F_CODDITTA);
if (newditta != _lastditta)
@ -136,25 +135,30 @@ void TParaliq_app::init_array(TMask& m)
for(_attiv->read(_isgteq);
_attiv->status() == NOERR && _attiv->curr() == r;
_attiv->next())
_attiv->next())
{
// istanzia array _atts on le attivita' della ditta corrente
_atts.add(_attiv->get(ATT_CODATT));
_tips.add(_attiv->get(ATT_TIPOATT));
}
_ditte->put(NDT_CODDITTA, _lastditta);
TString16 freq;
_ditte->put(NDT_CODDITTA, newditta);
if (_ditte->read() == NOERR)
_freqiva = _ditte->get(NDT_FREQVIVA);
else
_freqiva = "";
freq = _ditte->get(NDT_FREQVIVA);
m.set(F_FREQ_VERS, freq);
}
}
void TParaliq_app::on_config_change()
{
TConfig d(CONFIG_DITTA);
_yearliq = (int)d.get_long("AnLiIv");
}
bool TParaliq_app::user_create()
{
TConfig d(CONFIG_DITTA);
_yearliq = (int)d.get_long("AnLiIv");
_rel = new TRelation(TAB_LIA);
_pla = new TTable(TAB_PLA);
_attiv = new TLocalisamfile(LF_ATTIV);
@ -192,28 +196,26 @@ void TParaliq_app::init_insert_mode(TMask& m)
{
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA);
TToken_string tt(60);
init_array(m);
m.set(F_FREQ_VERS, _freqiva);
// Inizializza array delle attivita'
init_array(m);
// Inizializza array delle attivita'
for (int i = 0; i < _atts.items(); i++)
{
TString& att = _atts.row(i);
TString& tips = _tips.row(i);
// cerca l'attivita' in pla
tt = "";
tt.add(att);
const TString& tips = _tips.row(i);
tt = _atts.row(i);
tt.add(tips);
tt.add("");
tt.add("");
tt.add("");
tt.add("");
sf.row(-1) = tt;
sf.row(i) = tt;
}
sf.force_update();
}
int TParaliq_app::rewrite(const TMask& m)
{
// scrive %LIA
@ -225,28 +227,28 @@ int TParaliq_app::rewrite(const TMask& m)
const int year = m.get_int(F_YEAR);
int err = NOERR;
bool was = FALSE;
bool was = FALSE;
for (int i = 0; err == NOERR && i < _atts.items(); i++)
{
TToken_string& tt = sf.row(i);
const TString& att = (TString&) _atts[i];
const TString& att = _atts.row(i);
const TString16 tips(tt.get(1));
const TString16 codtab(format("%05ld%4d%s1", firm, year, (const char *)att));
_pla->zero();
_pla->put("CODTAB", codtab);
was =_pla->read() == NOERR;
if (!was) _pla->zero();
real prorata = _pla->get_real("R8");
real es_a8 = _pla->get_real("R5");
real es_a8b = _pla->get_real("R6");
real es_a9 = _pla->get_real("R7");
was =_pla->read() == NOERR;
if (!was) _pla->zero();
real prorata = _pla->get_real("R8");
real es_a8 = _pla->get_real("R5");
real es_a8b = _pla->get_real("R6");
real es_a9 = _pla->get_real("R7");
_pla->put("CODTAB", codtab);
// scrive i campi (vedi a read() per i nomi)
// in base alla riga sheet
// in base alla riga sheet
_pla->put("S7", tips); // tipo attivita'
_pla->put("R8", tt.get()); // prorata
_pla->put("R5", tt.get()); // plafond art. 8
@ -257,25 +259,25 @@ int TParaliq_app::rewrite(const TMask& m)
// se si e' cambiato qualcosa..
if (prorata != _pla->get_real("R8") ||
es_a8 != _pla->get_real("R5") ||
es_a8b != _pla->get_real("R6") ||
es_a9 != _pla->get_real("R7") ||
m.field(F_CRED_PREC).dirty())
es_a8 != _pla->get_real("R5") ||
es_a8b != _pla->get_real("R6") ||
es_a9 != _pla->get_real("R7") ||
m.field(F_CRED_PREC).dirty())
{
// invalida la prima liquidazione calcolata se ce n'e'
TTable lim("LIM");
// invalida la prima liquidazione calcolata se ce n'e'
TTable lim("LIM");
TRecfield lim_anno(lim.curr(),"CODTAB",0,3);
TRecfield lim_anno(lim.curr(),"CODTAB",0,3);
for (lim.first(); !lim.eof(); lim.next())
{
if (year == atoi(lim_anno))
{
lim.put("B0","");
lim.rewrite();
break;
}
}
for (lim.first(); !lim.eof(); lim.next())
{
if (year == atoi(lim_anno))
{
lim.put("B0","");
lim.rewrite();
break;
}
}
}
}
@ -287,18 +289,18 @@ int TParaliq_app::rewrite(const TMask& m)
if (err == NOERR) err = (was ? lia.rewrite() : lia.write());
if (err == NOERR && year == _yearliq)
{
_ditte->put(NDT_CODDITTA, _lastditta);
_ditte->put(NDT_CODDITTA, firm);
if (_ditte->read() == NOERR)
{
_ditte->put(NDT_FREQVIVA, m.get(F_FREQ_VERS));
_ditte->rewrite();
}
}
// per ogni anno liquidazione controlla (una volta) l'esistenza
// dei registri fondamentali
if (year != oldyear && err == NOERR)
check_registers(year);
check_registers(year);
oldyear = year;
return err;
@ -310,31 +312,33 @@ int TParaliq_app::read(TMask& m)
// prende le attivita' una per una da _atts e
// crea le righe sheet
m.autoload(get_relation());
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA);
TToken_string tt(60);
const long firm = m.get_long(F_CODDITTA);
const int year = m.get_int(F_YEAR);
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA);
sf.reset();
const TString16 ctab = format("%05ld%d", firm, year);
_pla->zero();
_pla->put("CODTAB", ctab);
TToken_string tt(60);
for (int err = _pla->read(_isgteq); err == NOERR; _pla->next())
for (_pla->read(_isgteq); _pla->good(); _pla->next())
{
if (ctab == _pla->get("CODTAB").left(9))
{
tt = "";
tt.add(ctab.mid(9,5));
tt.add(_pla->get("S7")); // tipo attivita'
tt.add(_pla->get("R8")); // prorata
tt.add(_pla->get("R5")); // plafond art. 8
tt.add(_pla->get("R6")); // plafond art. 8bis
tt.add(_pla->get("R7")); // plafond art. 9
if (strncmp(ctab, _pla->get("CODTAB"), 9) == 0)
{
tt = "";
tt.add(_pla->get("CODTAB").mid(9,5)); // codice attivita'
tt.add(_pla->get("S7")); // tipo attivita'
tt.add(_pla->get("R8")); // prorata
tt.add(_pla->get("R5")); // plafond art. 8
tt.add(_pla->get("R6")); // plafond art. 8bis
tt.add(_pla->get("R7")); // plafond art. 9
sf.row(-1) = tt;
}
else break;
sf.row(-1) = tt;
}
sf.force_update();
return NOERR;
}
@ -362,4 +366,4 @@ int cg5300(int argc, char* argv[])

@ -38,7 +38,7 @@ BEGIN
DISPLAY "Codice" CODDITTA
COPY OUTPUT F_CODDITTA
CHECKTYPE REQUIRED
KEY 2
KEY 1
END
NUMBER F_YEAR 4
@ -49,7 +49,7 @@ BEGIN
INPUT CODTAB[1,5] F_CODDITTA
INPUT CODTAB[6,9] F_YEAR
DISPLAY "Codice Ditta" CODTAB[1,5]
DISPLAY "Anno IVA" CODTAB[6,9]
DISPLAY "Anno Liquidazione IVA" CODTAB[6,9]
OUTPUT F_YEAR CODTAB[6,9]
KEY 1
CHECKTYPE REQUIRED

@ -113,7 +113,7 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
cursor = 0L;
const long nitems = cursor.items();
TProgind p(nitems ? nitems : 1, format("Ripristino stampa del registro %s", (const char *) regist) , TRUE, TRUE, 70);
TProgind p(nitems ? nitems : 1, format("Ripristino stampa del registro %s", (const char*)regist) , TRUE, TRUE, 70);
if (giornale)
{
@ -125,7 +125,7 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
{
p.addstatus(1);
mov.read(_isequal, _lock);
mov.zero(fieldname); // Azzera flag STAMPATO o REGST
mov.zero(fieldname); // Azzera flag STAMPATO o REGST
ok = (mov.rewrite() == NOERR);
if (!ok)
error_box("Errore nell'aggiornamento del movimento %ld.\n Errore n. %d",
@ -137,20 +137,24 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
{
reg.put("D3", d); // Data ultima stampa
reg.put("I4", d.month()-1); // Ultimo mese di stampa liquidazione
if (reg.get_int("I8") >= d.month())
reg.zero("I8"); // Mese di ultima stampa credito precedente
}
else
{
reg.zero("D3");
reg.zero("I4");
reg.zero("I8");
}
ok = (reg.rewrite() == NOERR);
if (!ok)
error_box("Errore nell'aggiornamento del registro %s.\n Errore n. %d",
(const char * ) regist, mov.status());
(const char*)regist, mov.status());
}
else
ok = error_box("Impossibile leggere il registro %s anno %s", (const char *) regist, (const char *) year);
ok = error_box("Impossibile leggere il registro %s anno %s",
(const char*)regist, (const char*)year);
return ok;
}