Patch level : 2.0 600

Files correlati     : cg2.exe cg3.exe cg3100a.msk
Ricompilazione Demo : [ ]
Commento            :

Nuova implementazione
3
Implementare nella stampa lista movimenti la possibilità di avere i soli movimenti di competenza


Corretto calcolo saldo riga corrente di prima nota
durante l'inserimento di nuovi movimenti


git-svn-id: svn://10.65.10.50/trunk@11488 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-10-13 15:03:52 +00:00
parent 6c568d83a0
commit 197f5e9388
4 changed files with 187 additions and 220 deletions

View File

@ -988,7 +988,8 @@ void TPrimanota_application::update_saldo_riga(int r)
if (bill.ok())
{
const int annoes = _saldi.anno_es();
TMask& m = curr_mask();
const int annoes = m.get_int(F_ANNOES);
// Legge il saldo finale del conto
TBalance bilancio;
@ -1029,7 +1030,6 @@ void TPrimanota_application::update_saldo_riga(int r)
s << ' ' << saldo.sezione();
}
TMask& m = curr_mask();
bill.set(m, F_GRUPPO, F_CONTO, F_SOTTOCONTO); // Stampa conto
m.set(F_SALDOCONTO, s); // Stampa saldo

View File

@ -6,7 +6,6 @@
#include <modaut.h>
#include <printapp.h>
#include <recarray.h>
#include <tabutil.h>
#include "cg3.h"
#include "cg3100.h"
@ -30,31 +29,24 @@ enum liste {
fatture=2,
};
bool filter_func (const TRelation *);
bool filter_func_fatture (const TRelation *);
bool annoes_handler(TMask_field&, KEY);
bool data_inizio (TMask_field&, KEY);
bool data_fine (TMask_field&, KEY);
class TListaMov_application : public TPrintapp
{
friend bool filter_func (const TRelation *);
friend bool filter_func_fatture (const TRelation *);
friend bool annoes_handler(TMask_field&, KEY);
friend bool data_inizio (TMask_field&, KEY);
friend bool data_fine (TMask_field&, KEY);
static bool filter_func (const TRelation *);
static bool filter_func_fatture (const TRelation *);
static bool annoes_handler(TMask_field&, KEY);
static bool data_inizio (TMask_field&, KEY);
static bool data_fine (TMask_field&, KEY);
static bool cdc_handler (TMask_field& f, KEY k);
TRigaiva_array _c;
TTable * _tabiva, * _tabtpd, * _tabreg, * _tabes;
TRelation * _relmov1,* _relmov2,* _relmov3;
TCursor * _curr1, * _curr2, * _curr3;
TBit_array _err;
TDate _data_ini, _data_fin, _datareg, _data_prec, _datacomp;
TString _descr, _descr_doc, _descr_causale;
TString _tipo_ini, _causale, _app;
TString _causale_ini, _causale_fin, _registro,_registro_ini, _registro_fin;
TString4 _causale_ini, _causale_fin, _registro,_registro_ini, _registro_fin;
TString _tipoatt, _tipo_elenco,_tipo_clifo_prec,_cod,_tipoelsucc;
char _appoggio;
TString16 _tipodoc, _tipodocumento;
@ -64,7 +56,7 @@ class TListaMov_application : public TPrintapp
long _numreg, _numreg_fin, _numreg_ini, _codalleg, _numeroregp,_codclifosucc;
long _codcf_prec, _numr, _numero;
int _ae, _anno, _annoes, _annoeser;
bool _noseparator;
bool _noseparator, _competence_only;
real _totdocumenti, _totdoc, _totimponibile, _totimposta, _importo;
real _op_esenti, _op_non_imp, _impo, _impos;
real _tot_dare, _tot_avere, _tot_avere_giornaliero;
@ -94,6 +86,7 @@ protected:
void print_intra(int& rr);
void filtra_cursore_provvisori(TCursor* cur) const;
void imposta_parametri_stampa(const TMask& msk);
void set_cdc_header(int& soh);
@ -130,7 +123,7 @@ public:
HIDDEN inline TListaMov_application& app()
{ return (TListaMov_application&)main_app();}
bool annoes_handler(TMask_field& f, KEY k)
bool TListaMov_application::annoes_handler(TMask_field& f, KEY k)
{
if (k == K_TAB && f.focusdirty())
{
@ -147,7 +140,7 @@ bool annoes_handler(TMask_field& f, KEY k)
return TRUE;
}
bool data_inizio(TMask_field& f, KEY k)
bool TListaMov_application::data_inizio(TMask_field& f, KEY k)
{
if (k == K_ENTER)
{
@ -177,11 +170,11 @@ bool data_inizio(TMask_field& f, KEY k)
return TRUE;
}
bool data_fine(TMask_field& f, KEY k)
bool TListaMov_application::data_fine(TMask_field& f, KEY k)
{
if (k == K_ENTER)
{
int decidi;
int decidi = 0;
int anno = f.mask().get_int (F_ANNO);
TDate dataini = f.mask().get(F_DATAINI);
TDate datafin = f.mask().get(F_DATAFIN);
@ -237,15 +230,8 @@ bool TListaMov_application::cdc_handler(TMask_field& f, KEY k)
bool TListaMov_application::RicercaDoc(const char * tipo)
{
TTable tab_tpd(TAB_TPD);
TString16 codtab; codtab.format ("%-2s", tipo);
tab_tpd.zero();
tab_tpd.put("CODTAB", codtab);
tab_tpd.read();
if (tab_tpd.good())
return TRUE;
else
return FALSE;
const TRectype& tab_tpd = cache().get(TAB_TPD, tipo);
return !tab_tpd.empty();
}
void TListaMov_application::compila_clifo()
@ -267,7 +253,7 @@ void TListaMov_application::compila_clifo()
nome = _ragsoc.mid(30,20);
cognome.trim(); nome.trim();
_ragsoc = cognome;
_ragsoc << " " << nome;
_ragsoc << ' ' << nome;
}
_indcf = clifo.get(CLI_INDCF);
_civcf = clifo.get(CLI_CIVCF);
@ -406,9 +392,9 @@ const int AllegClifo (int gruppo, int conto, long sottoconto)
const char * DescrConto (long gruppo, long conto, long sottoconto,
const char* tipocf)
{
TString key(30);
TString& tmp = get_tmp_string(50);
TString16 key;
key << gruppo;
if (conto != 0)
key << '|' << conto;
@ -427,7 +413,6 @@ const char * DescrConto (long gruppo, long conto, long sottoconto,
if (tipoa == 'F') //persona fisica
{
const TString& ragsoc = clifo.get("RAGSOC");
tmp = ragsoc.mid(0,30);
tmp.trim();
tmp << ' ' << ragsoc.mid(30);
@ -476,9 +461,9 @@ const char * AttivitaRegistro (const char * cod, int anno)
return cache().get("REG", key, "S8");
}
int CodiceRegistro (const char* cod, int anno)
HIDDEN int tipo_registro(const char* cod, int anno)
{
TString16 codtab; codtab.format("%4d%-3s", anno, cod);
TString8 codtab; codtab.format("%4d%-3s", anno, cod);
const TString& tipo_reg = cache().get("REG", codtab, "I0");
return atoi(tipo_reg);
@ -514,7 +499,7 @@ bool cdc_filter(const TRelation* rel)
return ok;
}
bool filter_func_fatture (const TRelation* rel)
bool TListaMov_application::filter_func_fatture (const TRelation* rel)
{
const TRectype& mov = rel->curr(LF_MOV);
@ -525,7 +510,7 @@ bool filter_func_fatture (const TRelation* rel)
const int ann_reg = mov.get_int(MOV_ANNOIVA);
const TString16 cod_reg = mov.get(MOV_REG);
const int tipo_reg = CodiceRegistro (cod_reg, ann_reg);
const int tipo_reg = tipo_registro (cod_reg, ann_reg);
// Considera solo iva acquisti o vendite
if (tipo_reg != 1 && tipo_reg != 2)
@ -555,63 +540,59 @@ bool filter_func_fatture (const TRelation* rel)
return ok;
}
bool filter_func (const TRelation * rel)
bool TListaMov_application::filter_func (const TRelation * rel)
{
bool ok = FALSE;
int tipo_reg, ann_reg;
TString cod_reg, causale;
TLocalisamfile* mov = &(rel->lfile(LF_MOV));
TRectype from (mov->curr());
TRectype to (mov->curr());
switch (app()._scelta_stampa)
{
case 0:
ann_reg = mov->get_int(MOV_ANNOIVA);
causale = mov->get (MOV_CODCAUS);
from.zero();
to.zero();
const TRectype& mov = rel->curr(LF_MOV);
if ( (app()._decidi == 2) && (app()._annoes != 0) )
{
from.put(MOV_ANNOES, app()._annoes);
to.put(MOV_ANNOES, app()._annoes);
const int annoes = mov.get_int(MOV_ANNOES);
if (annoes != app()._annoes)
return false;
}
from.put(MOV_CODCAUS, app()._causale_ini);
to.put(MOV_CODCAUS, app()._causale_fin);
from.put(MOV_REG, app()._registro_ini);
to.put(MOV_REG, app()._registro_fin);
ok = (mov->curr() >= from) && (mov->curr() <= to);
break;
case 1:
cod_reg = mov->get (MOV_REG);
ann_reg = mov->get_int (MOV_ANNOIVA);
tipo_reg = CodiceRegistro(cod_reg, ann_reg);
causale = mov->get (MOV_CODCAUS);
from.zero();
to.zero();
if ( (app()._decidi == 2) && (app()._annoes != 0) )
const TString& causale = mov.get(MOV_CODCAUS);
if (app()._causale_ini.not_empty() && causale < app()._causale_ini)
return false;
if (app()._causale_fin.not_empty() && causale > app()._causale_fin)
return false;
if (app()._scelta_stampa == 0) // Lista movimenti
{
from.put(MOV_ANNOES, app()._annoes);
to.put(MOV_ANNOES, app()._annoes);
const TString& codreg = mov.get(MOV_REG);
if (app()._registro_ini.not_empty() && codreg < app()._registro_ini)
return false;
if (app()._registro_fin.not_empty() && codreg > app()._registro_fin)
return false;
}
from.put(MOV_CODCAUS, app()._causale_ini);
to.put(MOV_CODCAUS, app()._causale_fin);
ok = ((mov->curr() >= from) && (mov->curr() <= to)) &&
((tipo_reg != 1) && (tipo_reg != 2));
break;
default:
break;
else // Lista movimenti sola prima nota
{
const TString& cod_reg = mov.get(MOV_REG);
const int ann_reg = mov.get_int(MOV_ANNOIVA);
const int tipo_reg = tipo_registro(cod_reg, ann_reg);
if (tipo_reg == 1 || tipo_reg == 2)
return false;
}
if (ok && app().cdc().not_empty())
ok = cdc_filter(rel);
if (app()._competence_only && app()._annoes == 0)
{
const TDate datareg = mov.get(MOV_DATAREG);
const int annoes = mov.get_int(MOV_ANNOES);
TEsercizi_contabili esc;
// La data di registrazione appartiene allo stesso esercizio della data di competenza
if (esc.date2esc(datareg) == annoes)
return false;
}
return ok;
if (app().cdc().not_empty())
return cdc_filter(rel);
return true;
}
void TListaMov_application::stampa_errori_rmov()
{
TRectype rec (current_cursor()->file(LF_RMOV).curr());
const TRectype& rec = current_cursor()->curr(LF_RMOV);
int gruppo = rec.get_int(RMV_GRUPPO);
int conto = rec.get_int(RMV_CONTO);
long sottoconto = rec.get_long(RMV_SOTTOCONTO);
@ -750,10 +731,8 @@ void TListaMov_application::stampa_errori_contropartita(int gruppo, int conto, l
void TListaMov_application::stampa_errori_iva(int* nr, const char* cod, const int tipodet, const int tipocr)
{
TTable tab_iva ("%IVA");
tab_iva.zero();
tab_iva.put("CODTAB", cod);
if (tab_iva.read()==NOERR)
const TRectype& tab_iva = cache().get("%IVA", cod);
if (!tab_iva.empty())
{
int allc = tab_iva.get_int("S7");
int allf = tab_iva.get_int("S8");
@ -873,7 +852,7 @@ void TListaMov_application::set_page(int file, int count)
TString16 reg = current_cursor()->curr(LF_MOV).get(MOV_REG);
int anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOIVA);
char prov = current_cursor()->curr(LF_MOV).get_char(MOV_PROVVIS);
int tipo = CodiceRegistro(reg, anno);
int tipo = tipo_registro(reg, anno);
TEsercizi_contabili esc;
int ae = esc.date2esc(data);
@ -920,9 +899,10 @@ void TListaMov_application::stampa_intestazione()
bool TListaMov_application::preprocess_page(int file,int counter)
{
TCursor* cur = current_cursor();
if (counter)
return TRUE;
if (counter) return TRUE;
TCursor* cur = current_cursor();
switch (_tipo_lista)
{
@ -931,41 +911,38 @@ bool TListaMov_application::preprocess_page(int file,int counter)
{
if (file == LF_MOV)
{
const TRectype& curmov = cur->curr(LF_MOV);
_tot_avere = 0;
_tot_dare = 0;
_c.destroy();
_no_preprocess_page = FALSE;
_esiste_riga_iva = FALSE;
_nonesiste_riga_iva = FALSE;
_annoeser = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOES);
_datacomp = current_cursor()->curr(LF_MOV).get_date(MOV_DATACOMP);
_causale = current_cursor()->curr(LF_MOV).get(MOV_CODCAUS);
_registro = current_cursor()->curr(LF_MOV).get(MOV_REG);
_anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOIVA);
_tipodoc = current_cursor()->curr(LF_MOV).get(MOV_TIPODOC);
_datareg = current_cursor()->file(LF_MOV).get_date(MOV_DATAREG);
_tipo_elenco = current_cursor()->file(LF_MOV).get(MOV_TIPO);
_codcf = current_cursor()->file(LF_MOV).get_long(MOV_CODCF);
_numero = current_cursor()->file(LF_MOV).get_long(MOV_NUMREG);
_codval = cur->curr(LF_MOV).get(MOV_CODVALI);
_tiporegistro = CodiceRegistro(_registro, _anno);
_annoeser = curmov.get_int(MOV_ANNOES);
_datacomp = curmov.get_date(MOV_DATACOMP);
_causale = curmov.get(MOV_CODCAUS);
_registro = curmov.get(MOV_REG);
_anno = curmov.get_int(MOV_ANNOIVA);
_tipodoc = curmov.get(MOV_TIPODOC);
_datareg = curmov.get_date(MOV_DATAREG);
_tipo_elenco = curmov.get(MOV_TIPO);
_codcf = curmov.get_long(MOV_CODCF);
_numero = curmov.get_long(MOV_NUMREG);
_codval = curmov.get(MOV_CODVALI);
_tiporegistro = tipo_registro(_registro, _anno);
_causale_gia_stampata = FALSE;
TEsercizi_contabili esc;
_ae = esc.date2esc(_datareg);
if (_registro.not_empty()) //si tratta di fattura
if (current_cursor()->is_first_match(LF_RMOV))
_mov_di_sola_iva = FALSE;
else _mov_di_sola_iva = TRUE;
_mov_di_sola_iva = !cur->is_first_match(LF_RMOV);
_descr_doc = DescrDoc(_tipodoc);
TLocalisamfile& fl = current_cursor()->file(LF_MOV);
TRectype da (fl.curr());
TRectype a (fl.curr());
da.zero();
a.zero();
TRectype da (LF_MOV);
TRectype a (LF_MOV);
if (_annoes != 0)
{
da.put(MOV_ANNOES, _annoes);
@ -976,7 +953,7 @@ bool TListaMov_application::preprocess_page(int file,int counter)
a.put(MOV_CODCAUS, _causale_fin);
a.put(MOV_REG, _registro_fin);
if ((fl.curr() >= da) && (fl.curr() <= a))
if ((curmov >= da) && (curmov <= a))
{
const TRectype& caus = cache().get(LF_CAUSALI, _causale);
@ -1011,14 +988,15 @@ bool TListaMov_application::preprocess_page(int file,int counter)
set_row(_nr,"@8g%-.20s", (const char*) _descr_causale);
_causale_gia_stampata = TRUE;
}
int gruppo = current_cursor()->curr(LF_RMOV).get_int(RMV_GRUPPO);
int conto = current_cursor()->curr(LF_RMOV).get_int(RMV_CONTO);
long sottoconto = current_cursor()->curr(LF_RMOV).get_long(RMV_SOTTOCONTO);
TString tipoc = current_cursor()->curr(LF_RMOV).get(RMV_TIPOC);
const TRectype& currig = cur->curr(LF_RMOV);
int gruppo = currig.get_int(RMV_GRUPPO);
int conto = currig.get_int(RMV_CONTO);
long sottoconto = currig.get_long(RMV_SOTTOCONTO);
const TString4 tipoc = currig.get(RMV_TIPOC);
_descr = DescrConto(gruppo, conto, sottoconto, tipoc);
_alleg = AllegClifo(gruppo, conto, sottoconto);
_importo = current_cursor()->file(LF_RMOV).get_real(RMV_IMPORTO);
_appoggio = toupper(current_cursor()->curr(LF_RMOV).get_char(RMV_SEZIONE));
_importo = currig.get_real(RMV_IMPORTO);
_appoggio = currig.get_char(RMV_SEZIONE);
if (!_no_preprocess_page)
{
if (_appoggio=='D')
@ -1031,13 +1009,14 @@ bool TListaMov_application::preprocess_page(int file,int counter)
_tot_avere += _importo;
_tot_avere_generale += _importo;
}
if (_controllo_mov_errati != 3) stampa_errori_rmov();
if (_controllo_mov_errati != 3)
stampa_errori_rmov();
}
return TRUE;
}
else if ( _stampa_parte_iva && file == LF_RMOVIVA)
{
TRectype iva(current_cursor()->file(LF_RMOVIVA).curr());
const TRectype& iva = cur->curr(LF_RMOVIVA);
_impo = iva.get_real(RMI_IMPONIBILE);
_impos = iva.get_real(RMI_IMPOSTA);
_tipocr = iva.get_int(RMI_TIPOCR);
@ -1057,18 +1036,17 @@ bool TListaMov_application::preprocess_page(int file,int counter)
_tot_avere = 0;
_tot_dare = 0;
_no_preprocess_page = FALSE;
_causale = current_cursor()->curr(LF_MOV).get(MOV_CODCAUS);
_registro = current_cursor()->curr(LF_MOV).get(MOV_REG);
_anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOES);
_tipodoc = current_cursor()->curr(LF_MOV).get(MOV_TIPODOC);
const TRectype& curmov = cur->curr(LF_MOV);
_causale = curmov.get(MOV_CODCAUS);
_registro = curmov.get(MOV_REG);
_anno = curmov.get_int(MOV_ANNOES);
_tipodoc = curmov.get(MOV_TIPODOC);
_causale_gia_stampata = FALSE;
TLocalisamfile* fl = &(current_cursor()->file(LF_MOV));
TRectype da (fl->curr());
TRectype a (fl->curr());
da.zero();
a.zero();
TRectype da (LF_MOV);
TRectype a (LF_MOV);
if (_annoes != 0)
{
da.put(MOV_ANNOES, _annoes);
@ -1077,7 +1055,7 @@ bool TListaMov_application::preprocess_page(int file,int counter)
da.put(MOV_CODCAUS, _causale_ini);
a.put(MOV_CODCAUS, _causale_fin);
if ((fl->curr() >= da) && (fl->curr() <= a))
if ((curmov >= da) && (curmov <= a))
{
const TRectype & caus = cache().get(LF_CAUSALI, _causale);
@ -1085,7 +1063,7 @@ bool TListaMov_application::preprocess_page(int file,int counter)
_alleg_causale = caus.get_bool(CAU_ALLEG);
_tipodocumento = caus.get(CAU_TIPODOC);
_tiporegistro = CodiceRegistro (_registro, _anno);
_tiporegistro = tipo_registro (_registro, _anno);
if ((_tiporegistro != 1)&&(_tiporegistro != 2))//se si tratta di un movimento di sola prima nota
return TRUE;
@ -1099,13 +1077,14 @@ bool TListaMov_application::preprocess_page(int file,int counter)
set_row(_nr,"@8g%-.20s", (const char*) _descr_causale);
_causale_gia_stampata = TRUE;
}
long gruppo = atol(current_cursor()->curr(LF_RMOV).get(RMV_GRUPPO));
long conto = atol(current_cursor()->curr(LF_RMOV).get(RMV_CONTO));
long sottoconto = atol(current_cursor()->curr(LF_RMOV).get(RMV_SOTTOCONTO));
TString tipoc = current_cursor()->curr(LF_RMOV).get(RMV_TIPOC);
const TRectype& rmov = current_cursor()->curr(LF_RMOV);
int gruppo = rmov.get_int(RMV_GRUPPO);
int conto = rmov.get_int(RMV_CONTO);
long sottoconto = rmov.get_long(RMV_SOTTOCONTO);
const TString4 tipoc = rmov.get(RMV_TIPOC);
_descr = DescrConto(gruppo, conto, sottoconto, tipoc);
_importo = current_cursor()->file(LF_RMOV).get_real(RMV_IMPORTO);
_appoggio = toupper(current_cursor()->curr(LF_RMOV).get_char(RMV_SEZIONE));
_importo = rmov.get_real(RMV_IMPORTO);
_appoggio = toupper(rmov.get_char(RMV_SEZIONE));
if (!_no_preprocess_page)
{
if (_appoggio=='D')
@ -1128,32 +1107,30 @@ bool TListaMov_application::preprocess_page(int file,int counter)
{
if (file == LF_MOV)
{
int anno = cur->curr(LF_MOV).get_int(MOV_ANNOIVA);
TString codreg = cur->curr(LF_MOV).get(MOV_REG);
_numr = current_cursor()->curr(LF_MOV).get_long(MOV_NUMREG);
_tipo_elenco = current_cursor()->curr(LF_MOV).get(MOV_TIPO);
_codcf = current_cursor()->curr(LF_MOV).get_long(MOV_CODCF);
int tiporeg = CodiceRegistro (codreg, anno);
TString attreg = AttivitaRegistro (codreg, anno);
const TRectype& curmov = current_cursor()->curr(LF_MOV);
int anno = curmov.get_int(MOV_ANNOIVA);
const TString8 codreg = curmov.get(MOV_REG);
_numr = curmov.get_long(MOV_NUMREG);
_tipo_elenco = curmov.get(MOV_TIPO);
_codcf = curmov.get_long(MOV_CODCF);
int tiporeg = tipo_registro (codreg, anno);
const TString8 attreg = AttivitaRegistro (codreg, anno);
if (tiporeg == 1 || tiporeg == 2)//se si tratta di un movimento iva
{
_tipoatt = TipoAttivita(attreg, get_firm());
_tipo_elenco = cur->curr(LF_MOV).get(MOV_TIPO);
_codcf = cur->curr(LF_MOV).get_long(MOV_CODCF);
_codcaus = cur->curr(LF_MOV).get(MOV_CODCAUS);
_tipodoc = cur->curr(LF_MOV).get(MOV_TIPODOC);
_codval = cur->curr(LF_MOV).get(MOV_CODVALI);
_totdoc = cur->curr(LF_MOV).get_real(MOV_TOTDOC);
_tipo_elenco = curmov.get(MOV_TIPO);
_codcf = curmov.get_long(MOV_CODCF);
_codcaus = curmov.get(MOV_CODCAUS);
_tipodoc = curmov.get(MOV_TIPODOC);
_codval = curmov.get(MOV_CODVALI);
_totdoc = curmov.get_real(MOV_TOTDOC);
if (_tipo_elenco != _tipo_clifo_prec && _tipo_clifo_prec != "")
printer().formfeed();
TLocalisamfile& file = cur->file(LF_MOV);
TRectype da (file.curr());
TRectype a (file.curr());
da.zero();
a.zero();
TRectype da (LF_MOV);
TRectype a (LF_MOV);
if (_annoes != 0) //anno specificato nella maschera
{
@ -1175,7 +1152,7 @@ bool TListaMov_application::preprocess_page(int file,int counter)
if (_codice_fin != 0)
a.put(MOV_CODCF, _codice_fin);
if ((file.curr() >= da) && (file.curr() <= a))
if ((curmov >= da) && (curmov <= a))
{
compila_clifo();
compila_comuni();
@ -1204,8 +1181,9 @@ bool TListaMov_application::preprocess_page(int file,int counter)
}
else if (file == LF_RMOVIVA)
{
int gruppo = current_cursor()->curr(LF_RMOV).get_int(RMV_GRUPPO);
int conto = current_cursor()->curr(LF_RMOV).get_int(RMV_CONTO);
const TRectype& rmov = current_cursor()->curr(LF_RMOV);
int gruppo = rmov.get_int(RMV_GRUPPO);
int conto = rmov.get_int(RMV_CONTO);
TToken_string key;
key.add(gruppo);
@ -1592,13 +1570,11 @@ bool TListaMov_application::segnala_errori_primariga()
{
const int tipo = rg.tipo();
TipoIVA i = nessuna_iva;
TTable tabtpd("%TPD");
tabtpd.put("CODTAB", _tipodoc);
if (tabtpd.read() == NOERR)
const TRectype& tabtpd = cache().get("%TPD", _tipodoc);
if (!tabtpd.empty())
{
bool cor = tabtpd.get_bool("B0");
int i = tabtpd.get_int("I0");
const bool cor = tabtpd.get_bool("B0");
const int i = tabtpd.get_int("I0");
if (i == 1 && tipo != 1)
_err.set(15);
if (i == 2 && tipo != 2)
@ -1903,9 +1879,8 @@ bool TListaMov_application::segnala_errori_iva()
cod = rec.get(RMI_CODIVA);
tipodet = rec.get_int(RMI_TIPODET);
tipocr = rec.get_int(RMI_TIPOCR);
tab_iva.zero();
tab_iva.put("CODTAB", cod);
if (tab_iva.read()==NOERR)
const TRectype& tab_iva = cache().get("%IVA", cod);
if (!tab_iva.empty())
{
int allc = tab_iva.get_int("S7");
int allf = tab_iva.get_int("S8");
@ -1958,21 +1933,15 @@ bool TListaMov_application::segnala_errori_iva()
void TListaMov_application::incrementa_totali()
{
TString dep1;
real imponibile, imposta;
const TRectype& rmoviva = current_cursor()->curr(LF_RMOVIVA);
const real imponibile = rmoviva.get(RMI_IMPONIBILE);
const real imposta = rmoviva.get(RMI_IMPOSTA);
const TString& codiva = rmoviva.get(RMI_CODIVA);
imponibile = current_cursor()->file(LF_RMOVIVA).get_real(RMI_IMPONIBILE);
imposta = current_cursor()->file(LF_RMOVIVA).get_real(RMI_IMPOSTA);
TString codiva = current_cursor()->file(LF_RMOVIVA).get(RMI_CODIVA);
_tabiva->zero();
dep1.format("%-4s",(const char*) codiva);
_tabiva->put("CODTAB", (const char*)dep1);
_tabiva->read();
if (_tabiva->bad())
_tabiva->zero();
const TRectype& tabiva = cache().get("%IVA", codiva);
if ((_tipo_elenco == "C")||(_tipo_elenco == "c"))
{
const int colonna = _tabiva->get_int("S7");
const int colonna = tabiva.get_int("S7");
if ((colonna == 1)||(colonna == 3))
_totimposta += imposta;
if (colonna == 1)
@ -1983,7 +1952,7 @@ void TListaMov_application::incrementa_totali()
}
else
{
const int colonna = _tabiva->get_int("S8");
const int colonna = tabiva.get_int("S8");
if ((colonna == 1)||(colonna == 3)||(colonna == 4))
_totimposta += imposta;
if (colonna == 1)
@ -1997,6 +1966,18 @@ void TListaMov_application::incrementa_totali()
}
}
void TListaMov_application::filtra_cursore_provvisori(TCursor* cur) const
{
TString filter;
switch (_provvis)
{
case 1: filter = "(PROVVIS=\"\")"; break; //normale
case 2: filter = ""; break; //globale
default: filter = "(PROVVIS=\"\")"; break; //solo provvisori
}
cur->setfilter(filter);
}
void TListaMov_application::imposta_parametri_stampa(const TMask& msk)
{
set_magic_currency(TRUE);
@ -2009,7 +1990,7 @@ void TListaMov_application::imposta_parametri_stampa(const TMask& msk)
{
case movimenti:
{
_scelta_stampa = atoi(msk.get(F_MOVIMENTI));
_scelta_stampa = msk.get_int(F_MOVIMENTI);
_annoes = msk.get_int (F_ANNO);
_decidi = msk.get_int(F_DECIDI);
_causale_ini = msk.get(F_CAUSALEINI);
@ -2024,44 +2005,32 @@ void TListaMov_application::imposta_parametri_stampa(const TMask& msk)
_data_ini = msk.get(F_DATAINI);
_data_fin = msk.get(F_DATAFIN);
_provvis = msk.get_int(F_STAMPAMOVP);
_competence_only = msk.get_bool(F_COMPETENZA);
TRectype da (LF_MOV), a(LF_MOV);
if (_decidi == 1)
{
select_cursor(_cur1);
if (_provvis == 1) //normale
_curr1->setfilter("(PROVVIS=\"\")");
else if (_provvis == 2) //globale
_curr1->setfilter("");
else _curr1->setfilter("(PROVVIS!=\"\")"); //solo provvisori
filtra_cursore_provvisori(_curr1);
TRectype da(LF_MOV), a(LF_MOV);
da.put(MOV_NUMREG, _numreg_ini);
a.put(MOV_NUMREG, _numreg_fin);
current_cursor()->setregion(da,a);
add_file(LF_MOV);
add_file(LF_RMOV,LF_MOV);
add_file(LF_RMOVIVA,LF_MOV);
}
else
{
select_cursor(_cur2);
if (_provvis == 1) //normale
_curr2->setfilter("(PROVVIS=\"\")");
else if (_provvis == 2) //globale
_curr2->setfilter("");
else
_curr2->setfilter("(PROVVIS!=\"\")"); //solo provvisori
TRectype da (LF_MOV), a(LF_MOV);
filtra_cursore_provvisori(_curr2);
if (_data_ini.ok())
da.put(MOV_DATAREG, _data_ini);
if (_data_fin.ok())
a.put(MOV_DATAREG, _data_fin);
}
current_cursor()->setregion(da,a);
add_file(LF_MOV);
add_file(LF_RMOV,LF_MOV);
add_file(LF_RMOVIVA,LF_MOV);
}
}
break;
case fatture:
@ -2224,10 +2193,6 @@ bool TListaMov_application::user_create()
open_files(LF_TAB, LF_TABCOM, LF_CAUSALI, LF_CLIFO, LF_COMUNI, LF_ATTIV,
LF_PCON, LF_SALDI, LF_RMOVIVA, LF_NDITTE, 0);
_tabiva = new TTable(TAB_IVA);
_tabtpd = new TTable(TAB_TPD);
_tabreg = new TTable("REG");
_tabes = new TTable("ESC");
return TRUE;
}
@ -2237,10 +2202,6 @@ bool TListaMov_application::user_destroy() // releasev e arrmask
delete _relmov1;
delete _relmov2;
delete _relmov3;
delete _tabiva;
delete _tabreg;
delete _tabtpd;
delete _tabes;
return TRUE;

View File

@ -43,6 +43,7 @@
#define F_DADESCRCAUS 140
#define F_ACODCAUS 141
#define F_ADESCRCAUS 142
#define F_COMPETENZA 143
#define ST_DATA 0x0001
#define ST_NUMERO 0x0002

View File

@ -96,13 +96,18 @@ END
BOOLEAN F_ALLEGATO
BEGIN
GROUP 1
PROMPT 20 9 "Allegato iva "
PROMPT 44 8 "Allegato iva "
HELP "Indicare se stampare l'allegato IVA"
MESSAGE TRUE DISABLE,F_STAMPA|COPY,F_STAMPA
MESSAGE FALSE ENABLE,F_STAMPA
GROUP 5
END
BOOLEAN F_COMPETENZA
BEGIN
PROMPT 2 9 "Stampa i soli movimenti con competenza nell'esercizio precedente"
END
RADIOBUTTON F_DECIDI 12
BEGIN
PROMPT 2 10 "Stampa "