Patch level : 10.1048

Files correlati     : cg1.exe cg3.exe
Ricompilazione Demo : [ ]
Commento            :

Stampa giornale, mastrini e visualizzazione mastrini con codice di contabilità separata


git-svn-id: svn://10.65.10.50/branches/R_10_00@22382 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2011-07-07 22:40:13 +00:00
parent 0ee1bf194e
commit 58b198df8c
14 changed files with 244 additions and 35 deletions

View File

@ -80,11 +80,13 @@ class TStampa_bilanci : public TPrintapp
TParagraph_string* _d;
const char* _buff;
bool _noseparator; // Usa separatore delle migliaia o no?
bool _fl_cont_sep;
TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis;
TString _descr_dare, _descr_avere, _gc_corr_dare, _gc_corr_avere, _descr;
TString _gc_prec_dare, _gc_prec_avere, _situazione, _descr_succ;
TString _tmp;
TString _cont_sep;
char _tipo_conto, _tipoc_succ;
int _annoes, _bilancio, _tipo_stampa, _tipo_stampa1,_stampa_width,_gp,_cp,_i;
@ -935,7 +937,12 @@ bool TStampa_bilanci::bil_sez_contr()
}
if (_tipo_stampa == 1) //bil. a sez. contrapposte per data limite
movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
{
if (_fl_cont_sep)
movimentato = sld.saldo_cont_sep(g, c, s, _annoes, _datalim, indbil_conto, _cont_sep, _stampa_mov_prov) != ZERO;
else
movimentato = sld.data_limite_bilancio(_bilancio, g, c, s, _dataini, _datalim, indbil_conto, _stampa_mov_prov);
}
else
{
if (_tipo_stampa == 2) //bil. a sez. contrapposte all'ultima immissione es. in corso
@ -1102,7 +1109,12 @@ bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbi
s = r->get_long(SLD_SOTTOCONTO);
if (_tipo_stampa == 1) //bil. a sez. contrapposte per data limite
movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
{
if (_fl_cont_sep)
movimentato = sld.saldo_cont_sep(g, c, s, _annoes, _datalim, indbil_conto, _cont_sep, _stampa_mov_prov);
else
movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
}
else
if (_tipo_stampa == 2) //bil. a sez. contrapposte all'ultima immissione es. in corso
movimentato = sld.ultima_immissione_bilancio(_annoes,g,c,s,indbil_conto,_stampa_mov_prov);
@ -3791,6 +3803,8 @@ bool TStampa_bilanci::set_print(int)
_quadratura = m.get_bool(F_QUADRATURA);
_hide_clifo = m.get_bool(F_HIDE_CLIFO);
_noseparator = m.get_bool(F_SEPARATOR);
_fl_cont_sep = m.get_bool(F_ST_CONTSEP);
_cont_sep = m.get(F_CONTSEP);
//qui getti le terne dei 2 conti da mettere in bill_from e bill_to con un metodo dei TBill
_bill_from.get(m, F_DA_GRUPPO, F_DA_CONTO, F_DA_SOTTOCONTO);

View File

@ -34,6 +34,8 @@
#define F_A_SOTTOCONTO 138
#define F_A_DESCRIZIONE 139
#define F_PRINT_FULL_CODE 140
#define F_ST_CONTSEP 141
#define F_CONTSEP 142
#endif // __CG1500_H

View File

@ -78,9 +78,11 @@ BEGIN
HELP "Indicare il tipo di stampa"
ITEM "1|Per date limite"
MESSAGE SHOW,F_DATALIM|SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO
MESSAGE SHOW,F_ST_CONTSEP
ITEM "2|All'ultima immissione"
MESSAGE HIDE,F_DATALIM|RESET,F_DATALIM
MESSAGE SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO
MESSAGE HIDE,F_ST_CONTSEP
END
RADIOBUTTON F_STAMPA1 28
@ -90,9 +92,11 @@ BEGIN
HELP "Indicare il tipo di stampa"
ITEM "1|Per date limite"
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV
MESSAGE SHOW,F_ST_CONTSEP
ITEM "2|All'ultima immissione"
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV
MESSAGE COPY,F_STAMPA
MESSAGE HIDE,F_ST_CONTSEP
END
DATE F_DATALIM
@ -172,6 +176,26 @@ BEGIN
PROMPT 2 13 "Quadratura con Libro Giornale"
END
BOOLEAN F_ST_CONTSEP
BEGIN
PROMPT 2 14 "Bilancio a contabilità separata"
MODULE NP
MESSAGE FALSE HIDE,F_CONTSEP
MESSAGE TRUE SHOW,F_CONTSEP
END
STRING F_CONTSEP 6
BEGIN
PROMPT 40 14 "Contabilità separata "
USE &NPENT
INPUT CODTAB F_CONTSEP
DISPLAY "Codice@6" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CONTSEP CODTAB
CHECKTYPE NORMAL
MODULE NP
END
ENDPAGE
PAGE "Parametri bilancio di verifica" -1 -1 74 20

View File

@ -100,6 +100,7 @@ class TMastrini_application : public TPrintapp
TString _descrizione,_sezione,_numdoc,_descrizionemov,_numrivd,_descr;
TString _dataregs, _datadocs;
int _gruppocontr,_contocontr,_nummast,_pagina;
bool _cont_sep;
long _sottocontocontr;
bool _stampaprogre,_stampatotiva,_stampatot,_stampa_mov_prov, _stampa_cont;
@ -1499,6 +1500,10 @@ bool TMastrini_application::preprocess_page(int file, int counter)
descrizione_causale();
_descrizionemov = mov.get(MOV_DESCR);
if (_cont_sep )
_descrizionemov << " " << cache().get("&NPENT", mov.get(MOV_CONTSEP), "S0");
_numgio = atol(mov.get(MOV_NUMGIO));
@ -2297,6 +2302,8 @@ bool TMastrini_application::set_print(int m)
_nummast = _msk->get_int(F_NUMMAST);
_data_ini = _msk->get_date(F_DATAINI);
_data_fine = _msk->get_date(F_DATAFINE);
_cont_sep = _msk->get_bool(F_ST_CONTSEP);
TEsercizi_contabili esc;

View File

@ -37,6 +37,7 @@
#define F_SELEZ_STAMPA 115
#define F_STAMPAMOVPROV 116
#define F_NOT_STAMPA_CONT 117
#define F_ST_CONTSEP 118
#define F_SEPARATOR 150
#define F_SORTDESC 151

View File

@ -430,6 +430,14 @@ BEGIN
GROUP 8
END
BOOLEAN F_ST_CONTSEP
BEGIN
PROMPT 1 19 "Stampa contabilità separata"
MODULE NP
END
BUTTON F_MEMORIZZA 18 2
BEGIN
PROMPT -11 -1 "~Memorizza scelte"

View File

@ -119,6 +119,7 @@ private:
TString16 _reg;
int _anno_iva;
bool _stampa_definitiva;
bool _cont_sep;
bool _MovGiaStampato;
bool _totals_updated;
@ -982,7 +983,7 @@ void TStampa_giornale::set_rows (int file, int counter)
{
TString16 datadoc_str, datareg_str, numdoc, frm, caus;
TDate datadoc, datareg;
TString80 mov_descr, rmv_descr;
TString80 mov_descr, rmv_descr, cont_sep;
long numreg, protiva;
int r = 1;
int g, c;
@ -1011,6 +1012,9 @@ void TStampa_giornale::set_rows (int file, int counter)
numreg = mov.get_long("NUMREG");
mov_descr = mov.get("DESCR");
if (_cont_sep )
cont_sep = cache().get("&NPENT", mov.get(MOV_CONTSEP), "S0");
// Usati in setta_righe_iva per determinare tipo attivita'
_reg = mov.get(MOV_REG);
_anno_iva = mov.get_int(MOV_ANNOIVA);
@ -1034,7 +1038,7 @@ void TStampa_giornale::set_rows (int file, int counter)
set_row(r,FR("Operazione n. @b%-7ld@r"), numreg);
set_row(r,FR(" del @b%s@r"), (const char*) datareg_str);
set_row(r,FR(" doc. n. @b%-7s@r"), (const char*) numdoc);
set_row(r,FR(" del @b%s@r %-50s"), (const char*)datadoc_str,(const char*)mov_descr);
set_row(r,FR(" del @b%s@r %-80s"), (const char*)datadoc_str,(const char*)mov_descr);
}
if (_annoEsMov != _ae)
@ -1047,6 +1051,8 @@ void TStampa_giornale::set_rows (int file, int counter)
set_row(r,fmt);
}
if (cont_sep.full())
set_row(++r,FR("%-50s"), (const char*)cont_sep);
if (caus.not_empty())
{
const char* desc_caus = get_descr_caus(caus);
@ -1775,6 +1781,8 @@ bool TStampa_giornale::set_print(int)
_stampa_definitiva = ma.get_bool(STAMPA_DEF);
_data_da = ma.get(DATA_DA);
_data_a = ma.get(DATA_A);
_cont_sep = ma.get_bool(F_ST_CONTSEP);
_stampa_width = ma.get_int(STAMPA_WIDTH);
_stampa_len = ma.get_int(STAMPA_LEN);

View File

@ -7,6 +7,7 @@
//#define PAGINA_DA 104
#define F_CODVAL 105
#define REG_DESC 107
//#define REG_ANNO 108
@ -15,3 +16,5 @@
#define STAMPA_LEN 110
#define F_CODDITTA 111
#define F_RAGSOC 112
#define F_ST_CONTSEP 113

View File

@ -95,6 +95,12 @@ BEGIN
MESSAGE FALSE ENABLE,DATA_DA
END
BOOLEAN F_ST_CONTSEP
BEGIN
PROMPT 1 10 "Stampa contabilità separata"
MODULE NP
END
ENDPAGE

View File

@ -21,6 +21,41 @@
#include <rmov.h>
#include <saldi.h>
class TGrid_mask;
class TQuery_mask : public TAutomask
{
TGrid_mask* _gm;
TString4 _last_tipo;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
void do_query();
TQuery_mask(TGrid_mask* gm);
virtual ~TQuery_mask() { }
};
class TMastrini_video : public TSkeleton_application
{
TQuery_mask* _qm;
TGrid_mask* _gm;
protected:
virtual bool create();
virtual void main_loop();
virtual bool destroy();
public:
TQuery_mask & query_mask() { return *_qm; }
};
HIDDEN inline TMastrini_video& app()
{ return (TMastrini_video&)main_app();}
///////////////////////////////////////////////////////////
// TList
///////////////////////////////////////////////////////////
@ -1706,12 +1741,17 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
if (cell.empty())
{
const TRectype& mov = _mastrino.testata(rec);
cell.set(mov.get(MOV_DESCR));
TString descr(mov.get(MOV_DESCR));
if (cell.empty())
{
TBill uncle(rmov,true);
cell.set(uncle.descrizione());
descr = uncle.descrizione();
}
if (app().query_mask().get_bool(F_ST_CONTSEP))
descr << "\n" << cache().get("&NPENT", mov.get(MOV_CONTSEP), "S0");
cell.set(descr);
}
}
else
@ -2315,21 +2355,6 @@ long TGrid_mask::handler(WINDOW win, EVENT* ep)
// TQuery_mask
///////////////////////////////////////////////////////////
class TQuery_mask : public TAutomask
{
TGrid_mask* _gm;
TString4 _last_tipo;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
void do_query();
TQuery_mask(TGrid_mask* gm);
virtual ~TQuery_mask() { }
};
bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
@ -2483,17 +2508,6 @@ void TQuery_mask::do_query()
// TMastrini_video
///////////////////////////////////////////////////////////
class TMastrini_video : public TSkeleton_application
{
TQuery_mask* _qm;
TGrid_mask* _gm;
protected:
virtual bool create();
virtual void main_loop();
virtual bool destroy();
};
bool TMastrini_video::create()
{
xvtil_statbar_set("", TRUE);

View File

@ -19,7 +19,8 @@
#define F_ACAUSALE 115
#define F_ADESCAUS 116
#define F_PROVVIS 117
#define F_END 118
#define F_ST_CONTSEP 118
#define F_END 119
#define F_MASTRINI 200
#define F_TOTRIG_SAL 201

View File

@ -246,7 +246,7 @@ BEGIN
PROMPT 40 12 "Vai in fondo al mastrino"
END
GROUPBOX DLG_NULL 76 4
GROUPBOX DLG_NULL 76 5
BEGIN
PROMPT 1 14 "@bCausali"
FLAGS "R"
@ -306,6 +306,12 @@ BEGIN
GROUP 5
END
BOOLEAN F_ST_CONTSEP
BEGIN
PROMPT 2 17 "Visualizza contabilità separata"
MODULE NP
END
ENDPAGE
ENDMASK

View File

@ -627,6 +627,121 @@ bool TSaldo::prg_saldo(int annoes, TConto& conto, real& prgdare, real& prgavere,
return ok;
}
bool TSaldo::saldo_cont_sep(int g, int c, long s, const int codes, const TDate& al,
int indbil, const char * cont_sep, bool provv, bool first)
{
_saldo_iniziale = ZERO;
_saldo = ZERO;
_prg_dare = ZERO;
_prg_avere = ZERO;
_movimentato = false;
_rec_presente_ep = false;
_rec_presente_ec = false;
_prec = false;
TEsercizi_contabili es;
_annoes = codes;
const TDate inizio = es[_annoes].inizio();
TString80 key; key.format("%04d| |%d|%d|%ld", _annoes, g, c, s);
const TRectype& saldo = cache().get(LF_SALDI, key);
/* if (saldo.get_real(SLD_SALDO).is_zero() && (indbil == 1 || indbil == 2 || indbil == 5) && first)
{
const int codesprec = es.date2prevesc(al);
_saldo_iniziale = saldo_cont_sep(g, c, s, codesprec, es[codesprec].fine(), indbil, cont_sep, provv, false);
} */
TRelation relrmov(LF_RMOV);
TRectype& rmov = relrmov.curr();
rmov.put(RMV_GRUPPO,g);
rmov.put(RMV_CONTO,c);
rmov.put(RMV_SOTTOCONTO,s);
TCursor cur(&relrmov, "", 2, &rmov, &rmov);
const TRecnotype items = cur.items();
if (items > 0)
{
cur.freeze();
TProgind* p = NULL;
if (items > 100) // E' proprio utile la progind?
{
TString80 prompt;
prompt.format(FR("Calcolo saldo del conto %d.%d.%ld"), g, c, s);
p = new TProgind(items, prompt, false);
}
for (cur = 0L; cur.pos() < items; ++cur)
{
if (p != NULL)
p->addstatus(1L);
const long num_reg = rmov.get_long(RMV_NUMREG);
const real importo = rmov.get_real(RMV_IMPORTO);
if (!importo.is_zero())
{
const char sezione = rmov.get_char(RMV_SEZIONE);
// "Se la causale del movimento e' di chiusura,
// o di apertura il movimento non va considerato"
const TRectype& mov = cache().get(LF_MOV, num_reg);
const bool ok = !mov.empty();
if (g == 6)
int i = 1;
if (ok)
{
if (mov.get(MOV_CONTSEP) == cont_sep)
{
_codcaus = mov.get(MOV_CODCAUS);
_datareg = mov.get(MOV_DATAREG);
_provv = mov.get(MOV_PROVVIS); // _provv.trim();
_datacomp = mov.get(MOV_DATACOMP);
const TString& movap = _causali_apertura.decode(_codcaus);
if (provv || _provv.empty())
{
if (_datacomp >= inizio && _datacomp <= al)
{
if (movap.blank())
{
_movimentato = true;
if (sezione == 'D')
_prg_dare += importo;
else
_prg_avere += importo;
}
else
if (movap != "C")
{
if (sezione == 'D')
_saldo_iniziale += importo;
else
_saldo_iniziale -= importo;
}
}
}
}
}
else
NFCHECK("Testata assente: %ld", num_reg);
}
}
if (p != NULL)
delete p;
}
_saldo = _saldo_iniziale + _prg_dare - _prg_avere;
return _movimentato;
}
///////////////////////////////////////////////////////////
// TContoExt
///////////////////////////////////////////////////////////

View File

@ -119,7 +119,7 @@ public:
bool ultima_immissione_verifica(int annoes, int g,int c,long s,int indbil,int prov);
bool data_limite_bilancio(int annoes,int g,int c,long s,const TDate& data_inf,const TDate& data_suo,int indbil,int stp_prov, const char* filter = NULL);
const real& saldo_periodo(int g, int c, long s, const TDate& dal, const TDate& al, int indbil, bool provv);
bool saldo_cont_sep(int g, int c, long s, const int codes, const TDate& al, int indbil, const char * cont_sep, bool provv, bool first = true);
bool ricerca_progr_prec(int, int, int, long);
real saldofin_esprec(int,int,int,long,bool saldo_chiusura = FALSE, bool provvisori = FALSE);