Corretto aggiornamento saldi in prima nota e azzeramento PLM
git-svn-id: svn://10.65.10.50/trunk@1499 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6264d262be
commit
e080b9f0fc
@ -846,9 +846,11 @@ int TPrimanota_application::write(const TMask& m)
|
|||||||
static int lasterr = NOERR;
|
static int lasterr = NOERR;
|
||||||
|
|
||||||
const long numreg = m.get_long(F_NUMREG);
|
const long numreg = m.get_long(F_NUMREG);
|
||||||
if (numreg > _lastreg) _lastreg = numreg; // Aggiorna ultima registrazione
|
if (numreg > _lastreg) _lastreg = numreg; // Aggiorna ultima registrazione libera
|
||||||
|
|
||||||
mask2rel(m);
|
if (lasterr == NOERR)
|
||||||
|
mask2rel(m); // Altrimenti raddoppia i saldi!
|
||||||
|
|
||||||
const int err = _rel->write(TRUE);
|
const int err = _rel->write(TRUE);
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
{
|
{
|
||||||
@ -857,16 +859,21 @@ int TPrimanota_application::write(const TMask& m)
|
|||||||
|
|
||||||
if (iva() != nessuna_iva)
|
if (iva() != nessuna_iva)
|
||||||
{
|
{
|
||||||
causale().reg().reread(); // Aggiorna protocollo IVA
|
causale().reg().reread(); // Aggiorna protocollo IVA
|
||||||
if (_is_saldaconto)
|
if (_is_saldaconto)
|
||||||
write_scadenze(m);
|
{
|
||||||
|
if (m.page_enabled(2))
|
||||||
|
write_scadenze(m);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (!m.get_bool(F_SOLAIVA))
|
{
|
||||||
|
if (!m.get_bool(F_SOLAIVA))
|
||||||
{
|
{
|
||||||
const TString16 causimm(causale().causale_inc_imm());
|
const TString16 causimm(causale().causale_inc_imm());
|
||||||
if (causimm.not_empty())
|
if (causimm.not_empty())
|
||||||
genera_incasso(causimm);
|
genera_incasso(causimm); // Genera incasso immediato
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <rmoviva.h>
|
#include <rmoviva.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
// Calcola l'anno di esercizio di una data
|
// Calcola l'anno di esercizio di una data, e se prevesc != NULL calcola anche l'anno precedente
|
||||||
// Certified 99%
|
// Certified 99%
|
||||||
int date2esc(const TDate& d, int* prevesc)
|
int date2esc(const TDate& d, int* prevesc)
|
||||||
{
|
{
|
||||||
@ -225,7 +225,7 @@ int TMovimentoPN::registra(bool re, bool force)
|
|||||||
{
|
{
|
||||||
TString16 chiave;
|
TString16 chiave;
|
||||||
TString16 attivita(registro.attivita()); attivita.right_just(5, '0');
|
TString16 attivita(registro.attivita()); attivita.right_just(5, '0');
|
||||||
chiave << annoiva << attivita << a << format("%02d", date2liq(datareg));
|
chiave << annoiva << attivita << a << format("%02d", datareg.month());
|
||||||
plm.put("CODTAB", chiave);
|
plm.put("CODTAB", chiave);
|
||||||
if (plm.read() == NOERR)
|
if (plm.read() == NOERR)
|
||||||
{
|
{
|
||||||
|
126
cg/cg3400.cpp
126
cg/cg3400.cpp
@ -133,6 +133,7 @@ private:
|
|||||||
bool _stampa_definitiva;
|
bool _stampa_definitiva;
|
||||||
bool _MovGiaStampato;
|
bool _MovGiaStampato;
|
||||||
bool _gia_settato_ariportare;
|
bool _gia_settato_ariportare;
|
||||||
|
bool _forza_ariportare;
|
||||||
bool _nuovo_mese; // Finito il mese ?
|
bool _nuovo_mese; // Finito il mese ?
|
||||||
long _num_rig;
|
long _num_rig;
|
||||||
real _importo;
|
real _importo;
|
||||||
@ -189,20 +190,20 @@ public:
|
|||||||
virtual bool user_create();
|
virtual bool user_create();
|
||||||
virtual bool user_destroy();
|
virtual bool user_destroy();
|
||||||
|
|
||||||
void set_rows (int file, int counter);
|
void set_rows (int file, int counter);
|
||||||
int setta_righe_indirizzo(char tipocf, long codcf, int rdesc);
|
int setta_righe_indirizzo(char tipocf, long codcf, int rdesc);
|
||||||
int setta_righe_iva();
|
int setta_righe_iva();
|
||||||
int setta_righe_valuta(int start_riga);
|
int setta_righe_valuta(int start_riga);
|
||||||
int setta_righe_descr(TParagraph_string&, enum descr);
|
int setta_righe_descr(TParagraph_string&, enum descr);
|
||||||
|
|
||||||
void fill_page(int row);
|
void fill_page(int row);
|
||||||
void calcola_iva();
|
void calcola_iva();
|
||||||
void init_print();
|
void init_print();
|
||||||
bool init_cursor();
|
bool init_cursor();
|
||||||
|
|
||||||
void init_totals();
|
void init_totals();
|
||||||
int stampa_intestazione_ditta();
|
int stampa_intestazione_ditta();
|
||||||
int set_headers();
|
int set_headers();
|
||||||
|
|
||||||
bool leggi_tabreg(const char * codreg, int annoes);
|
bool leggi_tabreg(const char * codreg, int annoes);
|
||||||
bool controlla_mov_aep();
|
bool controlla_mov_aep();
|
||||||
@ -216,12 +217,12 @@ public:
|
|||||||
int set_totali_pagina(int r);
|
int set_totali_pagina(int r);
|
||||||
void get_dati_ditta ();
|
void get_dati_ditta ();
|
||||||
|
|
||||||
const char* get_descr_caus (const char * codcaus);
|
const char* get_descr_caus (const char * codcaus);
|
||||||
TRectype& look_com (const char * cod);
|
TRectype& look_com (const char * cod);
|
||||||
const char* get_codiva_des(const char* codiva);
|
const char* get_codiva_des(const char* codiva);
|
||||||
void get_date_aep(int aep, TDate* in, TDate* fin);
|
void get_date_aep(int aep, TDate* in, TDate* fin);
|
||||||
void update_totals (char sezione, real& importo);
|
void update_totals (char sezione, real& importo);
|
||||||
void set_reg_filter(TMask& m);
|
void set_reg_filter(TMask& m);
|
||||||
|
|
||||||
CG3400_application() {};
|
CG3400_application() {};
|
||||||
virtual ~CG3400_application() {};
|
virtual ~CG3400_application() {};
|
||||||
@ -246,9 +247,9 @@ bool CG3400_application::filtra_reg(const TRelation * r)
|
|||||||
|
|
||||||
bool CG3400_application::filter_func(const TRelation * r)
|
bool CG3400_application::filter_func(const TRelation * r)
|
||||||
{
|
{
|
||||||
const TRectype& recmov = r->lfile().curr();
|
const TRectype& recmov = r->lfile().curr();
|
||||||
TRectype& recrmov = r->lfile(LF_RMOV).curr();
|
TRectype& recrmov = r->lfile(LF_RMOV).curr();
|
||||||
const long numreg = recmov.get_long("NUMREG");
|
const long numreg = recmov.get_long("NUMREG");
|
||||||
|
|
||||||
// Scarto SEMPRE i provvisori
|
// Scarto SEMPRE i provvisori
|
||||||
TString16 provvis = recmov.get(MOV_PROVVIS);
|
TString16 provvis = recmov.get(MOV_PROVVIS);
|
||||||
@ -547,26 +548,31 @@ void CG3400_application::preprocess_footer()
|
|||||||
// OPPURE
|
// OPPURE
|
||||||
// 2. Sono sull'ultima riga
|
// 2. Sono sull'ultima riga
|
||||||
//
|
//
|
||||||
if (!_gia_settato_ariportare)
|
|
||||||
if (_cur->pos() < _cur->items()-1)
|
const bool riporta = _forza_ariportare ||
|
||||||
{
|
(!_gia_settato_ariportare && _cur->pos() < _cur->items()-1);
|
||||||
dt = _tot_dare_progr + _tot_dare_progr_ap;
|
|
||||||
at = _tot_avere_progr + _tot_avere_progr_ap;
|
if (riporta)
|
||||||
dts = dt.string(REAL_PICTURE);
|
{
|
||||||
ats = at.string(REAL_PICTURE);
|
dt = _tot_dare_progr + _tot_dare_progr_ap;
|
||||||
|
at = _tot_avere_progr + _tot_avere_progr_ap;
|
||||||
|
dts = dt.string(REAL_PICTURE);
|
||||||
|
ats = at.string(REAL_PICTURE);
|
||||||
|
|
||||||
riga.format ("@b@%dg%s@%dg%c %s @%dg%c @%dg%s",
|
riga.format ("@b@%dg%s@%dg%c %s @%dg%c @%dg%s",
|
||||||
_stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB,
|
_stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB,
|
||||||
_nuovo_mese ? "Totale progressivi generali " : "A riportare ",
|
_nuovo_mese ? "Totale progressivi generali " : "A riportare ",
|
||||||
_stampa_width == 132 ? DARE132-3 : DARE198,
|
_stampa_width == 132 ? DARE132-3 : DARE198,
|
||||||
'D',
|
'D',
|
||||||
(const char *) dts,
|
(const char *) dts,
|
||||||
_stampa_width == 132 ? DARE132+16 : DARE198+20,
|
_stampa_width == 132 ? DARE132+16 : DARE198+20,
|
||||||
'A',
|
'A',
|
||||||
_stampa_width == 132 ? AVERE132 : AVERE198,
|
_stampa_width == 132 ? AVERE132 : AVERE198,
|
||||||
(const char *) ats);
|
(const char *) ats);
|
||||||
set_footer (r++, (const char*) riga);
|
set_footer (r++, (const char*) riga);
|
||||||
}
|
|
||||||
|
_forza_ariportare = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -866,7 +872,12 @@ void CG3400_application::fill_page(int riga)
|
|||||||
{
|
{
|
||||||
TString256 rigas;
|
TString256 rigas;
|
||||||
// char frm[4];
|
// char frm[4];
|
||||||
int r_l = printer().rows_left() - 2; // Tolgo le 2 righe del totale!
|
int r_l = printer().rows_left() - 2; // Tolgo le 2 righe del totale
|
||||||
|
if (r_l < 0)
|
||||||
|
{
|
||||||
|
r_l += printer().formlen() - 8; // Tolgo la testata
|
||||||
|
_forza_ariportare = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// Se sono rimaste righe da riempire
|
// Se sono rimaste righe da riempire
|
||||||
if (r_l > 0)
|
if (r_l > 0)
|
||||||
@ -1616,7 +1627,7 @@ HIDDEN int date2esc(const TDate& d, int* prevesc)
|
|||||||
void CG3400_application::set_reg_filter(TMask& m)
|
void CG3400_application::set_reg_filter(TMask& m)
|
||||||
{
|
{
|
||||||
TEdit_field& reg = m.efield(CODREG);
|
TEdit_field& reg = m.efield(CODREG);
|
||||||
reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
@ -1638,16 +1649,18 @@ bool CG3400_application::data_a_hndl (TMask_field& f, KEY k)
|
|||||||
const TDate data_a(f.get());
|
const TDate data_a(f.get());
|
||||||
TString16 dep(data_a.string());
|
TString16 dep(data_a.string());
|
||||||
|
|
||||||
app().set_reg_filter(m);
|
|
||||||
|
|
||||||
if (dep.empty()) return TRUE;
|
if (dep.empty()) return TRUE;
|
||||||
|
|
||||||
const int ae = date2esc(data_a); // Anno esercizio
|
const int ae = date2esc(data_a); // Anno esercizio
|
||||||
|
|
||||||
app()._ae = ae;
|
app()._ae = ae;
|
||||||
|
|
||||||
if (ae == 0)
|
if (ae == 0)
|
||||||
return f.error_box("La data specificata non appartiene a nessun esercizio");
|
return f.error_box("La data specificata non appartiene a nessun esercizio");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m.set(ANNO_ESER, ae);
|
||||||
|
m.send_key(K_TAB, CODREG);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k == K_ENTER)
|
if (k == K_ENTER)
|
||||||
@ -1721,7 +1734,7 @@ bool CG3400_application::data_da_hndl(TMask_field& f, KEY k)
|
|||||||
//
|
//
|
||||||
bool CG3400_application::mask_a_cod_reg (TMask_field& f, KEY k)
|
bool CG3400_application::mask_a_cod_reg (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_TAB || k == K_ENTER)
|
if (f.to_check(k))
|
||||||
{
|
{
|
||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
CG3400_application& a = app();
|
CG3400_application& a = app();
|
||||||
@ -1742,7 +1755,7 @@ bool CG3400_application::mask_a_cod_reg (TMask_field& f, KEY k)
|
|||||||
if (k == K_TAB) // Magari ci ripassa e lo inserisce
|
if (k == K_TAB) // Magari ci ripassa e lo inserisce
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else // Se e' K_ENTER mi serve davvero
|
else // Se e' K_ENTER mi serve davvero
|
||||||
return f.warning_box("Manca il codice registro");
|
return f.error_box("Manca il codice registro");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reg_ok = a.leggi_tabreg(reg_cod, a._ae);
|
bool reg_ok = a.leggi_tabreg(reg_cod, a._ae);
|
||||||
@ -1750,14 +1763,15 @@ bool CG3400_application::mask_a_cod_reg (TMask_field& f, KEY k)
|
|||||||
// Output da qui della descrizione del registro e dell'anno
|
// Output da qui della descrizione del registro e dell'anno
|
||||||
m.set(REG_DESC, a._reg_descr);
|
m.set(REG_DESC, a._reg_descr);
|
||||||
m.set(ANNO_ESER, a._ae);
|
m.set(ANNO_ESER, a._ae);
|
||||||
|
/*
|
||||||
// CHECKTYPE NORMAL abolito! (nella maschera non ho l'anno...
|
// CHECKTYPE NORMAL abolito! (nella maschera non ho l'anno...
|
||||||
if (!reg_ok)
|
if (!reg_ok)
|
||||||
return f.warning_box("Registro inesistente");
|
return f.warning_box("Registro inesistente");
|
||||||
|
|
||||||
if (app()._tipo != 5)
|
if (app()._tipo != 5)
|
||||||
return f.warning_box("Il registro %s per l'anno %d non e' di tipo libro giornale",
|
return f.warning_box("Il registro %s per l'anno %d non e' di tipo libro giornale",
|
||||||
(const char *) reg_cod, a._ae);
|
(const char *) reg_cod, a._ae);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1903,8 +1917,10 @@ bool CG3400_application::set_print(int)
|
|||||||
ma.set_handler (CODREG, mask_a_cod_reg);
|
ma.set_handler (CODREG, mask_a_cod_reg);
|
||||||
ma.set_handler (DATA_A, data_a_hndl);
|
ma.set_handler (DATA_A, data_a_hndl);
|
||||||
ma.set_handler (DATA_DA,data_da_hndl);
|
ma.set_handler (DATA_DA,data_da_hndl);
|
||||||
|
// set_reg_filter(ma);
|
||||||
|
|
||||||
_pagina_da = 0; // Parto dall'inizio
|
_pagina_da = 0; // Parto dall'inizio
|
||||||
|
_forza_ariportare = FALSE;
|
||||||
|
|
||||||
while ((tasto = ma.run()) != K_QUIT)
|
while ((tasto = ma.run()) != K_QUIT)
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "cg3400a.h"
|
#include "cg3400a.h"
|
||||||
|
|
||||||
PAGE "Stampa Libro Giornale" -1 -1 78 17
|
PAGE "Stampa Libro Giornale" -1 -1 78 14
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 78 3
|
GROUPBOX DLG_NULL 77 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 0 ""
|
PROMPT 1 0 ""
|
||||||
END
|
END
|
||||||
@ -14,10 +14,7 @@ BEGIN
|
|||||||
USE LF_NDITTE KEY 1
|
USE LF_NDITTE KEY 1
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
INPUT CODDITTA F_CODDITTA
|
INPUT CODDITTA F_CODDITTA
|
||||||
DISPLAY "Codice" CODDITTA
|
|
||||||
DISPLAY "Ragione sociale @50" RAGSOC
|
|
||||||
OUTPUT F_RAGSOC RAGSOC
|
OUTPUT F_RAGSOC RAGSOC
|
||||||
KEY 1
|
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_RAGSOC 50
|
STRING F_RAGSOC 50
|
||||||
@ -26,58 +23,58 @@ BEGIN
|
|||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING CODREG 3
|
|
||||||
BEGIN
|
|
||||||
PROMPT 1 4 "Codice registro "
|
|
||||||
HELP "Codice del libro giornale da stampare"
|
|
||||||
USE REG SELECT (I0 = 5) || (I0 = 4)
|
|
||||||
// INPUT CODTAB[1,4] ANNO_ESER
|
|
||||||
INPUT CODTAB[5,7] CODREG
|
|
||||||
DISPLAY "Anno" CODTAB[1,4]
|
|
||||||
DISPLAY "Codice" CODTAB[5,7]
|
|
||||||
DISPLAY "Descrizione@50" S0
|
|
||||||
DISPLAY "Tipo" I0
|
|
||||||
// OUTPUT ANNO_ESER CODTAB[1,4]
|
|
||||||
OUTPUT CODREG CODTAB[5,7]
|
|
||||||
OUTPUT REG_DESC S0
|
|
||||||
// OUTPUT PAGINA_DA I1
|
|
||||||
// OUTPUT DATA_DA D0
|
|
||||||
// OUTPUT DATA_A D1
|
|
||||||
// CHECKTYPE NORMAL
|
|
||||||
WARNING "Registro inesistente"
|
|
||||||
VALIDATE ZEROFILL_FUNC 3
|
|
||||||
FLAGS "U"
|
|
||||||
END
|
|
||||||
|
|
||||||
NUMBER ANNO_ESER 4
|
|
||||||
BEGIN
|
|
||||||
PROMPT 30 5 "Esercizio "
|
|
||||||
FLAGS "ZH"
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING REG_DESC 50
|
|
||||||
BEGIN
|
|
||||||
// PROMPT 1 6 "Descrizione "
|
|
||||||
PROMPT 25 4 ""
|
|
||||||
FLAGS "D"
|
|
||||||
END
|
|
||||||
|
|
||||||
DATE DATA_DA
|
DATE DATA_DA
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 6 "Dalla data "
|
PROMPT 1 3 "Dalla data "
|
||||||
HELP "Stampa i movimenti a partire dalla data specificata"
|
HELP "Stampa i movimenti a partire dalla data specificata"
|
||||||
END
|
END
|
||||||
|
|
||||||
DATE DATA_A
|
DATE DATA_A
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 40 6 "Alla data "
|
PROMPT 40 3 "Alla data "
|
||||||
HELP "Stampa i movimenti fino alla data specificata"
|
HELP "Stampa i movimenti fino alla data specificata"
|
||||||
// VALIDATE DATE_CMP_FUNC >= DATA_DA
|
// VALIDATE DATE_CMP_FUNC >= DATA_DA
|
||||||
WARNING "Specificare la data di fine stampa"
|
WARNING "Specificare la data di fine stampa"
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
MESSAGE K_TAB, CODREG
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
NUMBER ANNO_ESER 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 5 "Esercizio "
|
||||||
|
FLAGS "DZ"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING CODREG 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 6 "Codice registro "
|
||||||
|
HELP "Codice del libro giornale da stampare"
|
||||||
|
USE REG SELECT (I0=5)||(I0=4)
|
||||||
|
INPUT CODTAB[1,4] ANNO_ESER
|
||||||
|
INPUT CODTAB[5,7] CODREG
|
||||||
|
DISPLAY "Anno" CODTAB[1,4]
|
||||||
|
DISPLAY "Codice" CODTAB[5,7]
|
||||||
|
DISPLAY "Descrizione@50" S0
|
||||||
|
DISPLAY "Tipo" I0
|
||||||
|
OUTPUT ANNO_ESER CODTAB[1,4]
|
||||||
|
OUTPUT CODREG CODTAB[5,7]
|
||||||
|
OUTPUT REG_DESC S0
|
||||||
|
// OUTPUT PAGINA_DA I1
|
||||||
|
// OUTPUT DATA_DA D0
|
||||||
|
// OUTPUT DATA_A D1
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
WARNING "Registro inesistente"
|
||||||
|
// VALIDATE ZEROFILL_FUNC 3
|
||||||
|
FLAGS "UZ"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING REG_DESC 50
|
||||||
|
BEGIN
|
||||||
|
// PROMPT 1 7 "Descrizione "
|
||||||
|
PROMPT 25 5 ""
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
GROUPBOX DLG_NULL 30 4
|
GROUPBOX DLG_NULL 30 4
|
||||||
BEGIN
|
BEGIN
|
||||||
|
Loading…
x
Reference in New Issue
Block a user