66fe24764c
alla contabilita'. cglib01.cpp Cambiato il campo TIPOAPERS in TIPOPER per stabilire il tipo di anagrafica nell'oggetto TBill git-svn-id: svn://10.65.10.50/trunk@5400 c028cbd2-c16b-5b4b-a496-9718f37d4682
2470 lines
72 KiB
C++
Executable File
2470 lines
72 KiB
C++
Executable File
//
|
|
//Lista movimenti
|
|
//
|
|
#include <mask.h>
|
|
#include <printapp.h>
|
|
#include <tabutil.h>
|
|
#include <utility.h>
|
|
#include <urldefid.h>
|
|
|
|
#include "cg3.h"
|
|
#include "cg3100.h"
|
|
|
|
#include <attiv.h>
|
|
#include <causali.h>
|
|
#include <clifo.h>
|
|
#include <comuni.h>
|
|
#include <mov.h>
|
|
#include <nditte.h>
|
|
#include <pconti.h>
|
|
#include <rmov.h>
|
|
#include <rmoviva.h>
|
|
#include <saldi.h>
|
|
|
|
#include "cglib01.h"
|
|
#include "cglib03.h"
|
|
|
|
enum liste {
|
|
movimenti=1,
|
|
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);
|
|
|
|
HIDDEN const char* err_msg[] = {"La data operazione non appartiene a nessun esercizio",
|
|
"Anno IVA non compatibile con data operazione",
|
|
"Data operazione successiva all'esercizio di competenza",
|
|
"Movimento con competenza anno precedente",
|
|
"La data di competenza non appartiene a nessun esercizio",
|
|
"Data competenza incompatibile con data operazione",
|
|
"Esercizio incompatibile con data competenza",
|
|
"Codice causale non presente in tabella",
|
|
"Codice causale sospeso",
|
|
"Nella causale e' stato attivato il segnale non va in allegato",
|
|
"Tipo documento non corrisponde a quello indicato in causale",
|
|
"Tipo documento non presente in tabella",
|
|
"Codice registro non corrisponde a quello indicato in causale",
|
|
"Codice registro non presente in tabella",
|
|
"Codice registro sospeso",
|
|
"Tipo registro incompatibile con tipo documento",
|
|
"Non indicato codice cliente/fornitore",
|
|
"Tipo cliente/fornitore non compatibile con tipo registro",
|
|
"Codice cliente/fornitore sospeso",
|
|
"Nel cliente/fornitore e' stato attivato il segnale: non va in allegato",
|
|
"Indicato codice C/F per allegato che richiama se stesso",
|
|
"Indicato codice C/F per allegato sospeso",
|
|
"C/F per allegato riporta un altro C/F per allegato",
|
|
"Indicato codice C/F per allegato con segnale: non va in allegato",
|
|
"Indicato codice C/F per allegato non presente in anagrafica",
|
|
"Codice cliente/fornitore non presente in anagrafica",
|
|
"Movimento con data competenza diversa da data operazione"};
|
|
|
|
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);
|
|
|
|
TRigaiva_array _c;
|
|
TTable * _tabiva, * _tabtpd, * _tabreg, * _tabes;
|
|
TLocalisamfile * _caus,* _comuni,* _rmoviva, * _clifo, * _pcon, * _attiv, *_nditte, *_saldi;
|
|
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, _masc, _causale, _app;
|
|
TString _causale_ini, _causale_fin, _registro,_registro_ini, _registro_fin;
|
|
TString _tipoatt, _tipo_elenco,_tipo_clifo_prec,_cod,_tipoelsucc;
|
|
TString _appoggio, _tipodoc, _tipodocumento;
|
|
TString _ragsoc, _indcf, _civcf, _paiv, _codcaus, _dencom, _provcom, _cofi;
|
|
TString _capcf, _codval, _simbolo, _statocf, _comcf, _tipo_fin, _reg_causale;
|
|
long _documenti, _codice_ini, _codice_fin, _numero_reg, _codcf;
|
|
long _numreg, _numreg_fin, _numreg_ini, _codalleg, _numeroregp,_codclifosucc;
|
|
long _codcf_prec, _numr, _numero;
|
|
int _ae, _anno, _annoes, _annoeser;
|
|
bool _noseparator;
|
|
real _totdocumenti, _totdoc, _totimponibile, _totimposta, _importo;
|
|
real _op_esenti, _op_non_imp, _impo, _impos;
|
|
real _tot_dare, _tot_avere, _tot_avere_giornaliero;
|
|
real _tot_dare_giornaliero, _tot_dare_generale, _tot_avere_generale;
|
|
bool _intra, _no_preprocess_page, _salto_pagina, _stampa_anno_comp,_esiste_riga_iva,_nonesiste_riga_iva;
|
|
bool _stampa_parte_iva,_alleg_causale,_stampa_mess_alleg_iva,_allegb,_ricser;
|
|
bool _settata_prima_riga, _causale_gia_stampata,_mov_di_sola_iva;
|
|
int _cur1,_cur2,_cur2b,_cur3,_cur4,_decidi,_tipod,_controllo_mov_errati;
|
|
int _numero_riga, _alleg, _tiporegistro, _tipocr, _scelta_stampa, _nr, _n;
|
|
int _provvis;
|
|
liste _tipo_lista;
|
|
word _flags;
|
|
char _tipoc;
|
|
|
|
protected:
|
|
virtual void preprocess_header();
|
|
virtual bool preprocess_page(int,int);
|
|
virtual print_action postprocess_page(int,int);
|
|
virtual print_action postprocess_print(int,int);
|
|
virtual void set_page(int,int);
|
|
virtual bool set_print(int m);
|
|
void init_print(const TMask& m);
|
|
|
|
public:
|
|
|
|
bool user_create();
|
|
bool user_destroy();
|
|
bool segnala_errori_primariga();
|
|
bool segnala_errori_ogniriga();
|
|
bool segnala_errori_iva();
|
|
bool contropartita(int, int, long, char);
|
|
void stampa_errori_rmov();
|
|
void stampa_errori_mov();
|
|
void stampa_errori_iva(int*,const char*,const int,const int);
|
|
void stampa_errori_contropartita(int, int, long, char);
|
|
void stampa_intestazione();
|
|
void incrementa_totali();
|
|
void compila_clifo();
|
|
void compila_comuni();
|
|
bool RicercaDoc(const char*);
|
|
|
|
TListaMov_application(char tipost): _tipoc(tipost), _err(80) {}
|
|
virtual ~TListaMov_application() {}
|
|
};
|
|
|
|
HIDDEN inline TListaMov_application & app()
|
|
{ return (TListaMov_application&)main_app();}
|
|
|
|
bool annoes_handler(TMask_field& f, KEY k)
|
|
{
|
|
if (k == K_TAB)
|
|
{
|
|
const int anno = atoi(f.get());
|
|
TEsercizi_contabili esc;
|
|
if (esc.exist(anno))
|
|
{
|
|
f.mask().set(F_DATAINI, esc[anno].inizio());
|
|
const int prossimo = esc.next(anno);
|
|
const TDate fine = esc[prossimo > 0 ? prossimo : anno].fine();
|
|
f.mask().set(F_DATAFIN, fine);
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
bool data_inizio(TMask_field& f, KEY k)
|
|
{
|
|
if (k == K_ENTER)
|
|
{
|
|
int decidi;
|
|
int anno = f.mask().get_int (F_ANNO);
|
|
TDate data = f.mask().get(F_DATAINI);
|
|
if (app()._masc == "cg3100a")
|
|
decidi = f.mask().get_int (F_DECIDI);
|
|
|
|
TEsercizi_contabili esc;
|
|
if (esc.exist(anno) && ( (app()._masc == "cg3100b") ||
|
|
((app()._masc == "cg3100a" ) && (decidi == 2)) ) )
|
|
{
|
|
const TDate inizio = esc[anno].inizio();
|
|
if (data.ok())
|
|
{
|
|
if (data < inizio)
|
|
{
|
|
f.error_box("La data indicata non deve essere inferiore alla data di inizio esercizio");
|
|
return FALSE;
|
|
}
|
|
}
|
|
else //se la data e' vuota
|
|
f.mask().field(F_DATAINI).set(inizio);
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
bool data_fine(TMask_field& f, KEY k)
|
|
{
|
|
if (k == K_ENTER)
|
|
{
|
|
int decidi;
|
|
int anno = f.mask().get_int (F_ANNO);
|
|
TDate dataini = f.mask().get(F_DATAINI);
|
|
TDate datafin = f.mask().get(F_DATAFIN);
|
|
if (app()._masc == "cg3100a")
|
|
decidi = f.mask().get_int (F_DECIDI);
|
|
if ( (app()._masc == "cg3100b") ||
|
|
((app()._masc == "cg3100a" ) && (decidi == 2)) )
|
|
if ( dataini.ok() && datafin.ok() )
|
|
if (dataini > datafin)
|
|
{
|
|
f.error_box("La data iniziale non deve essere superiore alla data finale");
|
|
return FALSE;
|
|
}
|
|
|
|
TEsercizi_contabili esc;
|
|
if (esc.exist(anno) && ( (app()._masc == "cg3100b") || ((app()._masc == "cg3100a" ) && (decidi == 2)) ) )
|
|
{
|
|
const int prossimo = esc.next(anno);
|
|
const TDate fine = esc[prossimo > 0 ? prossimo : anno].fine();
|
|
if (datafin.ok())
|
|
{
|
|
if (datafin > fine)
|
|
{
|
|
f.error_box("La data indicata non deve essere superiore alla data di fine esercizio successivo, oppure, in caso questo non esista, dell'esercizio indicato");
|
|
return FALSE;
|
|
}
|
|
}
|
|
else //se la data e' vuota
|
|
f.mask().set(F_DATAFIN, fine);
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
bool TListaMov_application::RicercaDoc(const char * tipo)
|
|
{
|
|
TTable tab_tpd(TAB_TPD);
|
|
TString codtab = format ("%-2s", tipo);
|
|
tab_tpd.zero();
|
|
tab_tpd.put("CODTAB", codtab);
|
|
tab_tpd.read();
|
|
if (tab_tpd.good())
|
|
return TRUE;
|
|
else
|
|
return FALSE;
|
|
}
|
|
|
|
void TListaMov_application::compila_clifo()
|
|
{
|
|
_clifo->setkey(1);
|
|
_clifo->zero();
|
|
_clifo->put(CLI_TIPOCF,_tipo_elenco);
|
|
_clifo->put(CLI_CODCF,_codcf);
|
|
_clifo->read();
|
|
if (_clifo->bad())
|
|
_clifo->zero();
|
|
else
|
|
{
|
|
char tipoa = _clifo->curr().get_char("TIPOAPER");
|
|
_alleg = _clifo->curr().get_int(CLI_ALLEG);
|
|
_statocf = _clifo->curr().get(CLI_STATOCF);
|
|
_comcf = _clifo->curr().get(CLI_COMCF);
|
|
_ragsoc = _clifo->curr().get(CLI_RAGSOC);
|
|
if (tipoa == 'F')
|
|
{
|
|
TString80 cognome, nome;
|
|
cognome = _ragsoc.mid(0,30);
|
|
nome = _ragsoc.mid(30,20);
|
|
cognome.trim(); nome.trim();
|
|
_ragsoc = cognome;
|
|
_ragsoc << " " << nome;
|
|
}
|
|
_indcf = _clifo->curr().get(CLI_INDCF);
|
|
_civcf = _clifo->curr().get(CLI_CIVCF);
|
|
_paiv = _clifo->curr().get(CLI_PAIV);
|
|
_capcf = _clifo->curr().get(CLI_CAPCF);
|
|
_dencom = _clifo->curr().get(CLI_LOCCF);
|
|
_cofi = _clifo->curr().get(CLI_COFI);
|
|
_codalleg = _clifo->curr().get_long(CLI_CODALLEG);
|
|
}
|
|
}
|
|
|
|
void TListaMov_application::compila_comuni()
|
|
{
|
|
_comuni->setkey(1);
|
|
_comuni->zero();
|
|
_comuni->put(COM_STATO,_statocf);
|
|
_comuni->put(COM_COM,_comcf);
|
|
_comuni->read();
|
|
if (_comuni->bad())
|
|
_comuni->curr().zero();
|
|
//modifica del 26/04/1995
|
|
_dencom = _comuni->get(COM_DENCOM);
|
|
if (!_dencom.empty())
|
|
_app = "Com";
|
|
else _app = "Loc";
|
|
//fine modifica
|
|
_provcom = _comuni->get(COM_PROVCOM);
|
|
}
|
|
|
|
const int AllegClifo (int gruppo, int conto, long sottoconto)
|
|
{
|
|
TLocalisamfile clifo(LF_CLIFO);
|
|
int alleg;
|
|
|
|
clifo.setkey(3);
|
|
clifo.zero();
|
|
clifo.put(CLI_GRUPPO, gruppo);
|
|
clifo.put(CLI_CONTO, conto);
|
|
clifo.put(CLI_CODCF, sottoconto);
|
|
clifo.read();
|
|
if (clifo.good())
|
|
alleg = clifo.curr().get_int(CLI_ALLEG);
|
|
else
|
|
alleg = 0;
|
|
|
|
return alleg;
|
|
}
|
|
|
|
const char * DescrConto (long gruppo, long conto, long sottoconto,
|
|
const char* tipocf)
|
|
{
|
|
TString80 ragsoc;
|
|
const char* desc = NULL;
|
|
TLocalisamfile pcon (LF_PCON);
|
|
TLocalisamfile clifo(LF_CLIFO);
|
|
|
|
pcon.setkey(1);
|
|
pcon.zero();
|
|
pcon.put(PCN_GRUPPO, gruppo);
|
|
if (conto != 0)
|
|
pcon.put(PCN_CONTO, conto);
|
|
if (sottoconto != 0)
|
|
pcon.put(PCN_SOTTOCONTO,sottoconto);
|
|
pcon.read();
|
|
if (pcon.good())
|
|
TMP = pcon.curr().get(PCN_DESCR);
|
|
else
|
|
{
|
|
clifo.setkey(1);
|
|
clifo.zero();
|
|
clifo.put(CLI_CODCF, sottoconto);
|
|
clifo.put(CLI_TIPOCF,tipocf);
|
|
if (clifo.read() == NOERR)
|
|
{
|
|
char tipoa = clifo.get_char("TIPOAPER");
|
|
if (tipoa == 'F') //persona fisica
|
|
{
|
|
TString80 cognome, nome;
|
|
ragsoc = clifo.get("RAGSOC");
|
|
cognome = ragsoc.mid(0,30);
|
|
nome = ragsoc.mid(30,20);
|
|
cognome.trim(); nome.trim();
|
|
ragsoc = cognome;
|
|
ragsoc << " " << nome;
|
|
desc = ragsoc;
|
|
}
|
|
else
|
|
desc = clifo.get("RAGSOC");
|
|
TMP = desc;
|
|
}
|
|
else
|
|
TMP = "";
|
|
}
|
|
return TMP;
|
|
}
|
|
|
|
bool CausAlleg (const char * cod)
|
|
{
|
|
TLocalisamfile caus(LF_CAUSALI);
|
|
bool allegb;
|
|
|
|
caus.setkey(1);
|
|
caus.zero();
|
|
caus.put(CAU_CODCAUS,cod);
|
|
caus.read();
|
|
if (caus.bad())
|
|
caus.zero();
|
|
allegb = caus.get_bool(CAU_ALLEG);
|
|
|
|
return allegb;
|
|
}
|
|
|
|
const char * TipoAttivita (const char * attreg, long codice_ditta)
|
|
{
|
|
TLocalisamfile attiv(LF_ATTIV);
|
|
|
|
attiv.setkey(1);
|
|
attiv.zero();
|
|
attiv.put(ATT_CODDITTA, codice_ditta);
|
|
attiv.put(ATT_CODATT, attreg);
|
|
|
|
attiv.read();
|
|
if (attiv.good())
|
|
TMP = attiv.curr().get(ATT_TIPOATT);
|
|
else
|
|
TMP = "";
|
|
|
|
return TMP;
|
|
}
|
|
|
|
const char * SimboloValuta (const char * cod)
|
|
{
|
|
TTable tab_val(TAB_VAL);
|
|
TString codtab = format ("%-3s", cod);
|
|
|
|
tab_val.zero();
|
|
|
|
tab_val.put("CODTAB", codtab);
|
|
tab_val.read();
|
|
if (tab_val.good())
|
|
TMP = tab_val.get("S7");
|
|
else
|
|
TMP = "";
|
|
|
|
return TMP;
|
|
}
|
|
|
|
const char * DescrDoc (const char * tipo)
|
|
{
|
|
TTable tab_tpd(TAB_TPD);
|
|
TString codtab = format ("%-2s", tipo);
|
|
|
|
tab_tpd.zero();
|
|
|
|
tab_tpd.put("CODTAB", codtab);
|
|
tab_tpd.read();
|
|
if (tab_tpd.good())
|
|
TMP = tab_tpd.get("S0");
|
|
else
|
|
TMP = "";
|
|
|
|
return TMP;
|
|
}
|
|
|
|
const char * AttivitaRegistro (const char * cod, int anno)
|
|
{
|
|
TTable tab_reg("REG");
|
|
TString codtab ( format ("%04d%-3s", anno, cod) );
|
|
|
|
tab_reg.zero();
|
|
|
|
tab_reg.put("CODTAB", codtab);
|
|
tab_reg.read();
|
|
|
|
if (tab_reg.good())
|
|
TMP = tab_reg.get("S8");
|
|
else
|
|
TMP = "";
|
|
|
|
return TMP;
|
|
}
|
|
|
|
const int CodiceRegistro (const char* cod, int anno)
|
|
{
|
|
TTable tab_reg("REG");
|
|
TString codtab;
|
|
codtab.format("%4d%-3s", anno, cod);
|
|
//sprintf (__tmp, "%04d%-3s", anno, cod);
|
|
//TString codtab (__tmp);
|
|
int tipo_reg;
|
|
|
|
tab_reg.zero();
|
|
tab_reg.put("CODTAB", codtab);
|
|
tab_reg.read();
|
|
if (tab_reg.good())
|
|
tipo_reg = tab_reg.get_int("I0");
|
|
else
|
|
tipo_reg = 0;
|
|
|
|
return tipo_reg;
|
|
}
|
|
|
|
bool filter_func_fatture (const TRelation * rel)
|
|
{
|
|
int tipo_reg;
|
|
int ann_reg;
|
|
TString cod_reg;
|
|
TLocalisamfile* mov = &(rel->lfile(LF_MOV));
|
|
TRectype from (mov->curr());
|
|
TRectype to (mov->curr());
|
|
ann_reg = mov->get_int (MOV_ANNOIVA);
|
|
cod_reg = mov->get (MOV_REG);
|
|
tipo_reg = CodiceRegistro (cod_reg, ann_reg);
|
|
from.zero();
|
|
to.zero();
|
|
if (app()._annoes != 0) //anno esercizio specificato nella maschera
|
|
{
|
|
from.put(MOV_ANNOES, app()._annoes);
|
|
to.put(MOV_ANNOES, app()._annoes);
|
|
}
|
|
if (app()._data_ini.ok())
|
|
from.put(MOV_DATAREG, app()._data_ini);
|
|
from.put(MOV_TIPO, app()._tipo_ini);
|
|
if (app()._codice_ini != 0)
|
|
from.put(MOV_CODCF, app()._codice_ini);
|
|
if (app()._data_fin.ok())
|
|
to.put(MOV_DATAREG, app()._data_fin);
|
|
to.put(MOV_TIPO, app()._tipo_fin);
|
|
if (app()._codice_fin != 0)
|
|
to.put(MOV_CODCF, app()._codice_fin);
|
|
|
|
if (((mov->curr() >= from) && (mov->curr() <= to)) &&
|
|
((tipo_reg == 1) || (tipo_reg == 2)))
|
|
return TRUE;
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
bool filter_func (const TRelation * rel)
|
|
{
|
|
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();
|
|
if ( (app()._decidi == 2) && (app()._annoes != 0) )
|
|
{
|
|
from.put(MOV_ANNOES, app()._annoes);
|
|
to.put(MOV_ANNOES, app()._annoes);
|
|
}
|
|
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);
|
|
if ((mov->curr() >= from) && (mov->curr() <= to))
|
|
return TRUE;
|
|
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) )
|
|
{
|
|
from.put(MOV_ANNOES, app()._annoes);
|
|
to.put(MOV_ANNOES, app()._annoes);
|
|
}
|
|
from.put(MOV_CODCAUS, app()._causale_ini);
|
|
to.put(MOV_CODCAUS, app()._causale_fin);
|
|
|
|
if (((mov->curr() >= from) && (mov->curr() <= to)) &&
|
|
((tipo_reg != 1) && (tipo_reg != 2)))
|
|
return TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
void TListaMov_application::stampa_errori_rmov()
|
|
{
|
|
TRectype rec (current_cursor()->file(LF_RMOV).curr());
|
|
int gruppo = rec.get_int(RMV_GRUPPO);
|
|
int conto = rec.get_int(RMV_CONTO);
|
|
long sottoconto = rec.get_long(RMV_SOTTOCONTO);
|
|
int anno = rec.get_int(RMV_ANNOES);
|
|
TDate datareg = rec.get_date(RMV_DATAREG);
|
|
char sez = rec.get_char(RMV_SEZIONE);
|
|
char tipo = rec.get_char(RMV_TIPOC);
|
|
int gruppoc = rec.get_int(RMV_GRUPPOC);
|
|
int contoc = rec.get_int(RMV_CONTOC);
|
|
long sottocontoc = rec.get_long(RMV_SOTTOCONTOC);
|
|
char tipoc = rec.get_char(RMV_TIPOCC);
|
|
|
|
bool g = FALSE;
|
|
char t;
|
|
|
|
TBill tc (gruppo,conto,sottoconto);
|
|
|
|
_nr++;
|
|
|
|
if (anno != _annoeser || datareg != _datareg)
|
|
set_row(_nr++, "@11gUno o piu' campi non sono costanti nella riga dell' operazione");
|
|
if (sez != 'D' && sez != 'A')
|
|
set_row(_nr++, "@11gIndicato tipo movimento Dare/Avere errato");
|
|
if (tc.empty())
|
|
set_row(_nr++, "@11gNon presente codice gruppo/conto/sottoconto");
|
|
if (!tc.ok())
|
|
set_row(_nr++, "@11gCodice gruppo/conto/sottoconto non corrisponde ad un sottoconto");
|
|
|
|
TRectype pc (_pcon->curr());
|
|
tc.set(gruppo,0,0l);
|
|
if (!tc.read(pc))
|
|
g = TRUE;
|
|
tc.set(gruppo,conto,0l);
|
|
if (!tc.read(pc))
|
|
set_row(_nr++, "@11gCodice gruppo/conto/sottoconto non presente in Piano dei Conti");
|
|
else
|
|
{
|
|
t = pc.get_char(PCN_TMCF);
|
|
if (t != tipo)
|
|
set_row(_nr++, "@11gIl tipo C/F indicato non corrisponde a quello presente su Piano dei Conti");
|
|
else
|
|
{
|
|
tc.set(gruppo,conto,sottoconto);
|
|
if (t != 'C' && t != 'F')
|
|
{
|
|
if (!tc.read(pc) || g )
|
|
set_row(_nr++, "@11gCodice gruppo/conto/sottoconto non presente in Piano dei Conti");
|
|
else
|
|
{
|
|
bool sosp = tc.sospeso();
|
|
if (sosp)
|
|
set_row(_nr++, "@11gCodice gruppo/conto/sottoconto sospeso in Piano dei Conti");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TLocalisamfile clifo(LF_CLIFO);
|
|
clifo.setkey(1);
|
|
clifo.zero();
|
|
clifo.put(CLI_CODCF, sottoconto);
|
|
clifo.put(CLI_TIPOCF,t);
|
|
if (clifo.read() == NOERR)
|
|
{
|
|
bool sosp = clifo.get_bool(CLI_SOSPESO);
|
|
if (sosp)
|
|
set_row(_nr++, "@11gCodice C/F sospeso in Anagrafica");
|
|
}
|
|
else set_row(_nr++, "@11gCodice C/F non presente in Anagrafica");
|
|
if (_registro.not_empty()) //se su mov e' indicato il codice registro
|
|
{
|
|
TRegistro rg (_registro, _ae);
|
|
const int tiporeg = rg.tipo();
|
|
if ((tiporeg == 1 && t != 'C') || (tiporeg == 2 && t != 'F'))
|
|
set_row(_nr++, "@11gTipo C/F non compatibile con tipo registro");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
TLocalisamfile saldi(LF_SALDI);
|
|
saldi.setkey(1);
|
|
saldi.zero();
|
|
saldi.put(SLD_ANNOES,anno);
|
|
saldi.put(SLD_GRUPPO,gruppo);
|
|
saldi.put(SLD_CONTO, conto);
|
|
saldi.put(SLD_SOTTOCONTO,sottoconto);
|
|
saldi.put(SLD_FLSCA, "");
|
|
|
|
if (saldi.read() != NOERR)
|
|
set_row(_nr++, "@11gCodice gruppo/conto/sottoconto non presente in Saldi p.d.c.");
|
|
|
|
if (gruppoc != 0 || contoc != 0 || sottocontoc != 0l)
|
|
stampa_errori_contropartita(gruppoc, contoc, sottocontoc, tipoc);
|
|
}
|
|
|
|
void TListaMov_application::stampa_errori_contropartita(int gruppo, int conto, long sottoconto, char t)
|
|
{
|
|
bool g = FALSE;
|
|
|
|
TBill tc;
|
|
TRectype pc (_pcon->curr());
|
|
tc.set(gruppo,0,0l);
|
|
if (!tc.read(pc))
|
|
g = TRUE;
|
|
tc.set(gruppo,conto,0l);
|
|
if (!tc.read(pc))
|
|
set_row(_nr++, "@11gCodice gruppo/conto/sottoconto di contropartita non presente in Piano dei Conti");
|
|
else
|
|
{
|
|
//t = pc.get_char(PCN_TMCF);
|
|
tc.set(gruppo,conto,sottoconto);
|
|
if (t != 'C' && t != 'F')
|
|
{
|
|
if (!tc.read(pc) || g )
|
|
set_row(_nr++, "@11gCodice gruppo/conto/sottoconto di contropartita non presente in Piano dei Conti");
|
|
else
|
|
{
|
|
bool sosp = tc.sospeso();
|
|
if (sosp)
|
|
set_row(_nr++, "@11gCodice gruppo/conto/sottoconto di contropartita sospeso in Piano dei Conti");
|
|
}
|
|
}
|
|
else if (sottoconto != 0l)
|
|
{
|
|
TLocalisamfile clifo(LF_CLIFO);
|
|
clifo.setkey(1);
|
|
clifo.zero();
|
|
clifo.put(CLI_CODCF, sottoconto);
|
|
clifo.put(CLI_TIPOCF,t);
|
|
if (clifo.read() == NOERR)
|
|
{
|
|
bool sosp = clifo.get_bool(CLI_SOSPESO);
|
|
if (sosp)
|
|
set_row(_nr++, "@11gCodice C/F di contropartita sospeso in Anagrafica");
|
|
}
|
|
else set_row(_nr++, "@11gCodice C/F di contropartita non presente in Anagrafica");
|
|
}
|
|
}
|
|
}
|
|
|
|
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)
|
|
{
|
|
int allc = tab_iva.get_int("S7");
|
|
int allf = tab_iva.get_int("S8");
|
|
bool s = tab_iva.get_bool("B2");
|
|
if (s)
|
|
set_row(++(*nr), "@11gCodice IVA sospeso");
|
|
if (_stampa_mess_alleg_iva)
|
|
if (allc == 0 || allf == 0)
|
|
set_row(++(*nr), "@11gSul Codice IVA non e' stato attivato l'indicatore per allegato");
|
|
}
|
|
else
|
|
set_row(++(*nr), "@11gCodice IVA non presente in tabella");
|
|
|
|
if (tipodet == 1 || tipodet == 3 || tipodet == 5 || tipodet == 9)
|
|
if (_tiporegistro != 2)
|
|
set_row(++(*nr), "@11gCodice di indetraibilita' errato");
|
|
|
|
if (_tiporegistro == 1)
|
|
if (tipocr != 0 && tipocr != 1 && tipocr != 4 && tipocr != 9)
|
|
set_row(++(*nr), "@11gTipo costo/ricavo non valido");
|
|
|
|
if (_tiporegistro == 2)
|
|
if (tipocr != 0 && tipocr != 1 && tipocr != 2 && tipocr != 3 && tipocr != 5 && tipocr != 8 && tipocr != 9)
|
|
set_row(++(*nr), "@11gTipo costo/ricavo non valido");
|
|
}
|
|
|
|
void TListaMov_application::stampa_errori_mov()
|
|
{
|
|
long i = _err.first_one();
|
|
if (i != -1)
|
|
{
|
|
for (; i <= _err.last_one(); i++)
|
|
if (_err[i])
|
|
set_row(++_n, "@11g%s", (const char*) err_msg[i]);
|
|
}
|
|
}
|
|
|
|
void TListaMov_application::set_page(int file, int count)
|
|
{
|
|
switch (_tipo_lista)
|
|
{
|
|
case movimenti:
|
|
if (file == LF_RMOVIVA)
|
|
break;
|
|
if (file == LF_RMOV)
|
|
{
|
|
_nr = 1;
|
|
set_row(_nr,"@3n",FLD(LF_RMOV,RMV_NUMRIG));
|
|
set_row(_nr,"@30g@22s",FLD(LF_RMOV,RMV_DESCR));
|
|
set_row(_nr,"@54g@pn",FLD(LF_RMOV,RMV_GRUPPO,"###"));
|
|
set_row(_nr,"@58g@pn",FLD(LF_RMOV,RMV_CONTO,"###"));
|
|
set_row(_nr,"@62g@pn",FLD(LF_RMOV,RMV_SOTTOCONTO,"######"));
|
|
set_row(_nr,"@69g#.20t",&_descr);
|
|
_appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
|
|
if ((_appoggio=="D")||(_appoggio=="d"))
|
|
set_row(_nr,"@90g@n",FLD(LF_RMOV,RMV_IMPORTO));
|
|
else
|
|
set_row(_nr,"@110g@n",FLD(LF_RMOV,RMV_IMPORTO));
|
|
}
|
|
else if (file == LF_MOV)
|
|
{
|
|
_n = 1;
|
|
set_row (_n++,"");
|
|
set_row (_n, "Operazione n. @14g@7n", FLD(LF_MOV,MOV_NUMREG));
|
|
set_row (_n, "@22gdel@26g@d",FLD(LF_MOV,MOV_DATAREG));
|
|
set_row (_n, "@37g@36s",FLD(LF_MOV,MOV_DESCR));
|
|
set_row (_n, "@75gdoc. @7s",FLD(LF_MOV,MOV_NUMDOC));
|
|
set_row (_n, "@88gdel@92g@d", FLD(LF_MOV,MOV_DATADOC));
|
|
int annoese = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOES);
|
|
TDate data = current_cursor()->curr(LF_MOV).get_date(MOV_DATAREG);
|
|
TDate dcomp = current_cursor()->curr(LF_MOV).get_date(MOV_DATACOMP);
|
|
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);
|
|
|
|
TEsercizi_contabili esc;
|
|
int ae = esc.date2esc(data);
|
|
if ( (tipo == 1) || (tipo == 2) )
|
|
{
|
|
set_row (_n, "@103greg @3s",FLD(LF_MOV,MOV_REG));
|
|
set_row (_n, "@111gpr @5n",FLD(LF_MOV,MOV_PROTIVA));
|
|
}
|
|
else if (_provvis == 2 && prov >= ' ')
|
|
set_row (_n, "@103gMov.Provvisorio");
|
|
//15/12/1995
|
|
/*
|
|
if (ae != annoese)
|
|
if (_annoes == 0) //se non indicato l'anno nella maschera
|
|
set_row (_n, "@120gcomp @4n", FLD(LF_MOV,MOV_ANNOES));
|
|
*/
|
|
if (data != dcomp)
|
|
set_row (_n, "@119gc.%s", (const char*)dcomp.string(brief, '-'));
|
|
//fine
|
|
set_row (_n, "@130g@f", FLD(LF_MOV,MOV_STAMPATO));
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
void TListaMov_application::stampa_intestazione()
|
|
{
|
|
set_row (1,"");
|
|
if (_tipo_elenco == "C")
|
|
set_row (2, "@bCliente@8g@6n", FLD(LF_MOV,MOV_CODCF));
|
|
else
|
|
set_row (2, "@bFornitore@10g@6n", FLD(LF_MOV,MOV_CODCF));
|
|
set_row (2, "@b@18g#.35t", &_ragsoc);
|
|
//set_row (2, "@b@54gInd #.29t", &_indcf);
|
|
//set_row (2, "@b@84g#.10t", &_civcf);
|
|
set_row (2, "@b@54gInd #-.29t #-.10t", &_indcf, &_civcf);
|
|
set_row (2, "@b@98gP.I. #11t", &_paiv);
|
|
if (_alleg == 0)
|
|
set_row (2, "@b@121gAllegato SI");
|
|
else
|
|
set_row (2, "@b@121gAllegato NO");
|
|
set_row (3, "@b@54gCap #5t", &_capcf);
|
|
set_row (3,"@b@64g%s #-.20t Pr #-.5t",
|
|
(const char*)_app, &_dencom, &_provcom);
|
|
//set_row (3,"@b@89gPr #-.5t", &_provcom);
|
|
set_row (3, "@b@98gC.F. #-16t", &_cofi);
|
|
if (_alleg == 0)
|
|
set_row (3, "@b@120gRifer@126g#6d", &_codalleg);
|
|
}
|
|
|
|
bool TListaMov_application::preprocess_page(int file,int counter)
|
|
{
|
|
TCursor* cur = current_cursor();
|
|
|
|
if (counter) return TRUE;
|
|
|
|
switch (_tipo_lista)
|
|
{
|
|
case movimenti:
|
|
if (_scelta_stampa == 0)
|
|
{
|
|
if (file == 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);
|
|
|
|
_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;
|
|
|
|
_descr_doc = DescrDoc(_tipodoc);
|
|
|
|
TLocalisamfile& fl = current_cursor()->file(LF_MOV);
|
|
TRectype da (fl.curr());
|
|
TRectype a (fl.curr());
|
|
da.zero();
|
|
a.zero();
|
|
if (_annoes != 0)
|
|
{
|
|
da.put(MOV_ANNOES, _annoes);
|
|
a.put(MOV_ANNOES, _annoes);
|
|
}
|
|
da.put(MOV_CODCAUS, _causale_ini);
|
|
da.put(MOV_REG, _registro_ini);
|
|
a.put(MOV_CODCAUS, _causale_fin);
|
|
a.put(MOV_REG, _registro_fin);
|
|
|
|
if ((fl.curr() >= da) && (fl.curr() <= a))
|
|
{
|
|
_caus->setkey(1);
|
|
_caus->curr().put(CAU_CODCAUS,_causale);
|
|
_caus->read();
|
|
if (_caus->bad())
|
|
_caus->curr().zero();
|
|
_reg_causale = _caus->curr().get(CAU_REG);
|
|
_descr_causale = _caus->curr().get(CAU_DESCR);
|
|
_alleg_causale = _caus->curr().get_bool(CAU_ALLEG);
|
|
_tipodocumento = _caus->curr().get(CAU_TIPODOC);
|
|
|
|
if (_controllo_mov_errati == 1 || _controllo_mov_errati == 2)
|
|
{
|
|
bool controlla = segnala_errori_primariga();
|
|
bool verifica = (_stampa_parte_iva && segnala_errori_iva()) || segnala_errori_ogniriga();
|
|
|
|
if ((_controllo_mov_errati == 1 && controlla)
|
|
|| _controllo_mov_errati == 2 )
|
|
{
|
|
stampa_errori_mov();
|
|
return TRUE;
|
|
}
|
|
else if (_controllo_mov_errati == 1 && !verifica)
|
|
return FALSE;
|
|
else return TRUE;
|
|
}
|
|
else return TRUE;
|
|
}
|
|
}
|
|
else if (file == LF_RMOV)
|
|
{
|
|
if (!_causale_gia_stampata)
|
|
{
|
|
set_row(_nr,"@4g%3s", (const char*) _causale);
|
|
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);
|
|
_descr = DescrConto(gruppo, conto, sottoconto, tipoc);
|
|
_alleg = AllegClifo(gruppo, conto, sottoconto);
|
|
_importo = current_cursor()->file(LF_RMOV).get_real(RMV_IMPORTO);
|
|
_appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
|
|
if (!_no_preprocess_page)
|
|
{
|
|
if ((_appoggio=="D")||(_appoggio=="d"))
|
|
{
|
|
_tot_dare_generale += _importo;
|
|
_tot_dare += _importo;
|
|
}
|
|
else if ((_appoggio=="A")||(_appoggio=="a"))
|
|
{
|
|
_tot_avere += _importo;
|
|
_tot_avere_generale += _importo;
|
|
}
|
|
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());
|
|
_impo = iva.get_real(RMI_IMPONIBILE);
|
|
_impos = iva.get_real(RMI_IMPOSTA);
|
|
_tipocr = iva.get_int(RMI_TIPOCR);
|
|
_tipod = iva.get_int(RMI_TIPODET);
|
|
_cod = iva.get(RMI_CODIVA);
|
|
_intra = iva.get_bool(RMI_INTRA);
|
|
|
|
_c.add_riga(_impo,_impos,ZERO,ZERO,_cod,_tipod,_tipocr,_intra);
|
|
|
|
return TRUE;
|
|
}
|
|
}
|
|
else //_scelta_stampa == 1
|
|
{
|
|
if (file == LF_MOV)
|
|
{
|
|
_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);
|
|
|
|
_causale_gia_stampata = FALSE;
|
|
|
|
TLocalisamfile* fl = &(current_cursor()->file(LF_MOV));
|
|
TRectype da (fl->curr());
|
|
TRectype a (fl->curr());
|
|
da.zero();
|
|
a.zero();
|
|
if (_annoes != 0)
|
|
{
|
|
da.put(MOV_ANNOES, _annoes);
|
|
a.put(MOV_ANNOES, _annoes);
|
|
}
|
|
da.put(MOV_CODCAUS, _causale_ini);
|
|
a.put(MOV_CODCAUS, _causale_fin);
|
|
|
|
if ((fl->curr() >= da) && (fl->curr() <= a))
|
|
{
|
|
_caus->setkey(1);
|
|
_caus->curr().put(CAU_CODCAUS,_causale);
|
|
_caus->read();
|
|
if (_caus->bad())
|
|
_caus->curr().zero();
|
|
_descr_causale = _caus->curr().get(CAU_DESCR);
|
|
_alleg_causale = _caus->curr().get_bool(CAU_ALLEG);
|
|
_tipodocumento = _caus->curr().get(CAU_TIPODOC);
|
|
|
|
_tiporegistro = CodiceRegistro (_registro, _anno);
|
|
|
|
if ((_tiporegistro != 1)&&(_tiporegistro != 2))//se si tratta di un movimento di sola prima nota
|
|
return TRUE;
|
|
}
|
|
}
|
|
else if (file == LF_RMOV)
|
|
{
|
|
if (!_causale_gia_stampata)
|
|
{
|
|
set_row(_nr,"@4g%3s", (const char*) _causale);
|
|
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);
|
|
_descr = DescrConto(gruppo, conto, sottoconto, tipoc);
|
|
_importo = current_cursor()->file(LF_RMOV).get_real(RMV_IMPORTO);
|
|
_appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
|
|
if (!_no_preprocess_page)
|
|
{
|
|
if ((_appoggio=="D")||(_appoggio=="d"))
|
|
{
|
|
_tot_dare_generale += _importo;
|
|
_tot_dare += _importo;
|
|
}
|
|
else if ((_appoggio=="A")||(_appoggio=="a"))
|
|
{
|
|
_tot_avere += _importo;
|
|
_tot_avere_generale += _importo;
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case fatture:
|
|
{
|
|
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);
|
|
|
|
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);
|
|
|
|
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();
|
|
|
|
if (_annoes != 0) //anno specificato nella maschera
|
|
{
|
|
da.put(MOV_ANNOES, _annoes);
|
|
a.put(MOV_ANNOES, _annoes);
|
|
}
|
|
if (_data_ini.ok())
|
|
da.put(MOV_DATAREG, _data_ini);
|
|
da.put(MOV_TIPO, _tipo_ini);
|
|
if (_codice_ini != 0)
|
|
da.put(MOV_CODCF, _codice_ini);
|
|
if (_data_fin.ok())
|
|
a.put(MOV_DATAREG, _data_fin);
|
|
a.put(MOV_TIPO, _tipo_fin);
|
|
if (_codice_fin != 0)
|
|
a.put(MOV_CODCF, _codice_fin);
|
|
|
|
if ((file.curr() >= da) && (file.curr() <= a))
|
|
{
|
|
compila_clifo();
|
|
compila_comuni();
|
|
|
|
if ((_tipo_clifo_prec == "")&&(_codcf_prec == 0l))
|
|
{
|
|
_tipo_clifo_prec = _tipo_elenco;
|
|
_codcf_prec = _codcf;
|
|
stampa_intestazione();
|
|
}
|
|
else
|
|
if (_tipo_clifo_prec == _tipo_elenco && _codcf_prec == _codcf)
|
|
_settata_prima_riga = FALSE;
|
|
else
|
|
{
|
|
if ( _salto_pagina && _tipo_clifo_prec == _tipo_elenco )
|
|
printer().formfeed();
|
|
stampa_intestazione();
|
|
_tipo_clifo_prec = _tipo_elenco;
|
|
_codcf_prec = _codcf;
|
|
_settata_prima_riga = FALSE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
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);
|
|
|
|
_pcon->zero();
|
|
_pcon->put("GRUPPO",gruppo);
|
|
_pcon->put("CONTO", conto);
|
|
_pcon->put("SOTTOCONTO", 0L);
|
|
|
|
if (_pcon->read() == NOERR)
|
|
_ricser = _pcon->get_int("RICSER");
|
|
|
|
_simbolo = SimboloValuta(_codval);
|
|
_allegb = CausAlleg(_codcaus);
|
|
_descr_doc = DescrDoc(_tipodoc);
|
|
_intra = cur->curr(LF_RMOVIVA).get_bool(RMI_INTRA);
|
|
|
|
if (!_settata_prima_riga)
|
|
{
|
|
reset_print();
|
|
set_row(1, "");
|
|
set_row(2,"@7n",FLD(LF_MOV,MOV_NUMREG));
|
|
set_row(2,"@8g@d",FLD(LF_MOV,MOV_DATAREG));
|
|
set_row(2,"@17g@3,rs",FLD(LF_MOV,MOV_REG));
|
|
set_row(2,"@21g@5n",FLD(LF_MOV,MOV_PROTIVA));
|
|
|
|
TString protiva = cur->curr(LF_MOV).get(MOV_PROTIVA);
|
|
TString uprotiva = cur->curr(LF_MOV).get(MOV_UPROTIVA);
|
|
|
|
if (uprotiva.not_empty())
|
|
{
|
|
for (int i = 0; protiva[i] && (protiva[i] == uprotiva[i]); i++);
|
|
uprotiva = uprotiva.mid(i);
|
|
set_row(2, "@24g/@25g%s", (const char*) uprotiva);
|
|
}
|
|
set_row(2, "@33g@d", FLD(LF_MOV,MOV_DATADOC));
|
|
set_row(2,"@42g@6,rs",FLD(LF_MOV,MOV_NUMDOC));
|
|
set_row(2,"@49g@3s",FLD(LF_MOV,MOV_CODCAUS));
|
|
set_row(2,"@53g@2s",FLD(LF_MOV,MOV_TIPODOC));
|
|
set_row(2,"@56g%-.12s", (const char *)_descr_doc);
|
|
set_row(2,"@67g@n",FLD(LF_MOV,MOV_TOTDOC));
|
|
set_row(2,"@84g@n",FLD(LF_RMOVIVA,RMI_IMPONIBILE));
|
|
set_row(2,"@101g@4s",FLD(LF_RMOVIVA,RMI_CODIVA));
|
|
set_row(2,"@105g@1n",FLD(LF_RMOVIVA,RMI_TIPODET));
|
|
if (_tipoatt == "E")
|
|
if (_ricser == 1)
|
|
set_row(2,"@109g1");
|
|
else if (_ricser == 2)
|
|
set_row(2,"@109g2");
|
|
set_row(2,"@111g@f",FLD(LF_RMOVIVA,RMI_INTRA));
|
|
set_row(2,"@114g@n",FLD(LF_RMOVIVA,RMI_IMPOSTA));
|
|
if (_allegb)
|
|
set_row(2,"@131g*");
|
|
|
|
incrementa_totali();
|
|
_settata_prima_riga = TRUE;
|
|
++_documenti;
|
|
}
|
|
else if (_settata_prima_riga)
|
|
{
|
|
reset_print();
|
|
set_row(1,"@84g@n", FLD(LF_RMOVIVA,RMI_IMPONIBILE));
|
|
set_row(1,"@101g@4s", FLD(LF_RMOVIVA,RMI_CODIVA));
|
|
set_row(1,"@105g@1n",FLD(LF_RMOVIVA,RMI_TIPODET));
|
|
set_row(1,"@114g@n", FLD(LF_RMOVIVA,RMI_IMPOSTA));
|
|
incrementa_totali();
|
|
}
|
|
return TRUE;
|
|
}
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
print_action TListaMov_application::postprocess_page(int file,int count)
|
|
{
|
|
if (count)
|
|
{
|
|
reset_print();
|
|
return NEXT_PAGE;
|
|
}
|
|
switch (_tipo_lista)
|
|
{
|
|
case movimenti:
|
|
if (file == LF_RMOV)
|
|
{
|
|
force_setpage();
|
|
break;
|
|
}
|
|
if (file == LF_MOV)
|
|
{
|
|
reset_print();
|
|
_err.reset();
|
|
int n = 1;
|
|
int r = 0;
|
|
if (_scelta_stampa == 0)
|
|
if (_registro.not_empty() && _mov_di_sola_iva)
|
|
{
|
|
compila_clifo();
|
|
// set_row(++r, "@1g%3s %-.19s@25g%-35s %6ld %-50s", (const char*)_causale, (const char*)_descr_causale,
|
|
// (const char*) _descr_doc, _codcf, (const char*)_ragsoc);
|
|
set_row(++r, "@1g%3s %-50s %6ld %-50s", (const char*)_causale, (const char*)_descr_causale, _codcf, (const char*)_ragsoc);
|
|
}
|
|
if ( _scelta_stampa == 0 && _stampa_parte_iva )
|
|
{
|
|
for (int j = 0; j < _c.items(); j++)
|
|
{
|
|
TRigaiva& riga = (TRigaiva&)_c[j];
|
|
//r = j+1;
|
|
r++;
|
|
set_row(r, "Imponibile@12g%r", &riga._imponibile);
|
|
set_row(r, "@31gImposta@39g%r", &riga._imposta);
|
|
set_row(r, "@58gCodice Iva@69g%3s", (const char*)riga._codiva);
|
|
switch (riga._tipodet)
|
|
{
|
|
case 0 : set_row(r, "@76gDetraibile");
|
|
break;
|
|
case 1 : set_row(r, "@76gIndetraibile su op.es.");
|
|
break;
|
|
case 3 : set_row(r, "@76gPassaggi interni");
|
|
break;
|
|
case 9 : set_row(r, "@76gIndetraibile art.19");
|
|
break;
|
|
default: break;
|
|
}
|
|
if (riga._intra)
|
|
set_row(r, "@104gOper.intrac.");
|
|
if (_controllo_mov_errati != 3)
|
|
if (!_esiste_riga_iva && ! _nonesiste_riga_iva)
|
|
stampa_errori_iva(&r, riga._codiva, riga._tipodet, riga._tipocr);
|
|
}
|
|
real corrval = current_cursor()->file(LF_MOV).get_real(MOV_CORRVALUTA);
|
|
real corrlire = current_cursor()->file(LF_MOV).get_real(MOV_CORRLIRE);
|
|
TString vall (corrval.string("###.###.###.###,@@@"));
|
|
if (corrval != ZERO)
|
|
{
|
|
set_row(++r,"Corr.in lire@14g%r", &corrlire);
|
|
set_row(r,"@34gCorr.in valuta@49g%s", (const char*)vall);
|
|
set_row(r,"@70g%-3s", (const char *)_codval);
|
|
}
|
|
if (_esiste_riga_iva)
|
|
set_row(++r, "@11gPresenti righe IVA in una registrazione senza IVA");
|
|
if (_nonesiste_riga_iva)
|
|
set_row(++r, "@11gNon presente alcuna riga IVA in una registrazione con IVA");
|
|
_c.destroy();
|
|
}
|
|
if (r > 0)
|
|
n = ++r;
|
|
TRecnotype pos, items;
|
|
bool FINITO = FALSE;
|
|
if ((_scelta_stampa == 0)&&(_controllo_mov_errati != 3)&&(_tot_dare != _tot_avere))
|
|
set_row(n++, "@11gIl movimento risulta sbilanciato");
|
|
|
|
pos = current_cursor()->pos();
|
|
items = current_cursor()->items();
|
|
|
|
FINITO = (pos == items-1);
|
|
|
|
_datareg = current_cursor()->file(LF_MOV).get_date(MOV_DATAREG);
|
|
_numreg = current_cursor()->file(LF_MOV).get_long(MOV_NUMREG);
|
|
|
|
TDate datarec (_datareg);
|
|
if (!FINITO)
|
|
{
|
|
TCursor * cur = current_cursor();
|
|
cur->save_status();
|
|
++(*cur);
|
|
datarec = cur->file(LF_MOV).get_date(MOV_DATAREG);
|
|
--(*cur);
|
|
cur->restore_status();
|
|
}
|
|
|
|
_tot_avere_giornaliero += _tot_avere;
|
|
_tot_dare_giornaliero += _tot_dare;
|
|
|
|
//stampa i totali giornalieri
|
|
if ( FINITO ||
|
|
(_datareg != datarec)||(_numreg == _numreg_fin))
|
|
{
|
|
if (( _scelta_stampa == 0 && _controllo_mov_errati != 1 && _decidi == 2) || (_scelta_stampa == 1 && _decidi == 2))
|
|
{
|
|
set_row(n, "@b@60gTotali del giorno %s", _datareg.string());
|
|
set_row(n++, "@b@90g%r %r", &_tot_dare_giornaliero, &_tot_avere_giornaliero);
|
|
_tot_avere_giornaliero = 0;
|
|
_tot_dare_giornaliero = 0;
|
|
}
|
|
if ((_scelta_stampa == 0 && _controllo_mov_errati != 1 && FINITO) || (_scelta_stampa == 1 && FINITO))
|
|
{
|
|
set_row(n++,"");
|
|
set_row(n, "@b@60gTotale generale");
|
|
set_row(n++, "@b@90g%r %r", &_tot_dare_generale, &_tot_avere_generale);
|
|
}
|
|
}
|
|
|
|
if (n == 1)
|
|
{
|
|
force_setpage(); //probabilmente e' inutile
|
|
return NEXT_PAGE;
|
|
}
|
|
else
|
|
{
|
|
_no_preprocess_page = TRUE;
|
|
force_setpage(FALSE);
|
|
return REPEAT_PAGE;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case fatture:
|
|
if (file == LF_MOV)
|
|
{
|
|
reset_print();
|
|
TCursor* cur = current_cursor();
|
|
int rr = 1;
|
|
real corrval = cur->file(LF_MOV).get_real(MOV_CORRVALUTA);
|
|
real corrlire = cur->file(LF_MOV).get_real(MOV_CORRLIRE);
|
|
if (corrval != ZERO)
|
|
{
|
|
TString vall (corrval.string("###.###.###.###,@@@"));
|
|
set_row(rr,"Corr.in lire@14g%r", &corrlire);
|
|
set_row(rr,"@34gCorr.in valuta@49g%s", (const char*) vall);
|
|
set_row(rr++,"@70g%-3s", (const char *)_codval);
|
|
}
|
|
_totdocumenti += _totdoc;
|
|
TRecnotype pos, items;
|
|
bool FINITO = FALSE;
|
|
|
|
pos = current_cursor()->pos();
|
|
items = current_cursor()->items();
|
|
|
|
FINITO = (pos == items-1);
|
|
|
|
if (!FINITO)
|
|
{
|
|
cur->save_status();
|
|
++(*cur);
|
|
// long numrsucc = cur->file(LF_MOV).get_long(MOV_NUMREG);
|
|
_tipoelsucc = cur->file(LF_MOV).get(MOV_TIPO);
|
|
_codclifosucc = cur->file(LF_MOV).get_long(MOV_CODCF);
|
|
--(*cur);
|
|
cur->restore_status();
|
|
}
|
|
|
|
if (FINITO || (_tipo_elenco != _tipoelsucc)||(_codcf != _codclifosucc))
|
|
{
|
|
TString blank = "";
|
|
set_row(rr++,(const char*)blank);
|
|
if ((_tipo_elenco == "C")||(_tipo_elenco == "c"))
|
|
set_row(rr++, "@bTotali Cliente@18gDocumenti Totale documenti@47gAllegati:@63gImponibile@82gImposta@95gop. esenti@110gop. non imp.");
|
|
else
|
|
set_row(rr++, "@bTotali Fornitore@18gDocumenti Totale documenti@49gAllegati:@63gImponibile@82gImposta@95gop. esenti@110gop. non imp.");
|
|
set_row(rr, "@b@18g%9d", _documenti);
|
|
set_row(rr, "@b@28g%r", &_totdocumenti);
|
|
set_row(rr, "@b@56g%r", &_totimponibile);
|
|
set_row(rr, "@b@74g%r", &_totimposta);
|
|
set_row(rr, "@b@92g%r", &_op_esenti);
|
|
set_row(rr, "@b@110g%r", &_op_non_imp);
|
|
_totimposta = 0;
|
|
_totimponibile = 0;
|
|
_op_esenti = 0;
|
|
_op_non_imp = 0;
|
|
_documenti = 0;
|
|
_totdocumenti = 0;
|
|
//return REPEAT_PAGE;
|
|
}
|
|
if (rr > 1)
|
|
return REPEAT_PAGE;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return NEXT_PAGE;
|
|
}
|
|
|
|
print_action TListaMov_application::postprocess_print(int file,int count)
|
|
{
|
|
if (count)
|
|
{
|
|
reset_print();
|
|
return NEXT_PAGE;
|
|
}
|
|
|
|
switch (_tipo_lista)
|
|
{
|
|
case movimenti:
|
|
break;
|
|
|
|
case fatture:
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
return NEXT_PAGE;
|
|
}
|
|
|
|
//cerca errori sulla testata (MOV)
|
|
bool TListaMov_application::segnala_errori_primariga()
|
|
{
|
|
TEsercizi_contabili esc;
|
|
const int ae = esc.date2esc(_datacomp);
|
|
|
|
if (_ae == 0)
|
|
_err.set(0l);
|
|
|
|
if (_registro.not_empty()) //si tratta di fattura
|
|
if (_datareg.year() != _anno)
|
|
_err.set(1);
|
|
|
|
if ( _scelta_stampa == 0 && _stampa_anno_comp )
|
|
if (_ae != _annoeser)
|
|
{
|
|
if (_annoes) //specificato l'anno nella maschera
|
|
_err.set(2);
|
|
else _err.set(3);
|
|
}
|
|
else
|
|
if (_datacomp != _datareg) // altrimenti se gli esercizi corrispondono controlla datacomp e dataop
|
|
_err.set(26);
|
|
|
|
if (ae)
|
|
{
|
|
const int ar = esc.date2esc(_datareg); // Esercizio in corso
|
|
const int pr = esc.pred(ar); // Esercizio precedente
|
|
if (ae != ar && ae != pr)
|
|
_err.set(4);
|
|
}
|
|
else
|
|
_err.set(5);
|
|
|
|
if (_annoeser != ae)
|
|
_err.set(6);
|
|
|
|
if (_tipodoc != "")
|
|
if (!RicercaDoc(_tipodoc))
|
|
_err.set(11);
|
|
|
|
if (_causale.not_empty()) //se indicata la causale
|
|
{
|
|
if (_caus->curr().empty())
|
|
_err.set(7);
|
|
else
|
|
{
|
|
bool sos = _caus->curr().get_bool(CAU_SOSPESO);
|
|
if (sos)
|
|
_err.set(8);
|
|
if (_stampa_mess_alleg_iva && _alleg_causale)
|
|
_err.set(9);
|
|
}
|
|
if (_tipodoc != _tipodocumento)
|
|
_err.set(10);
|
|
/*
|
|
if (_tipodoc != "")
|
|
if (!RicercaDoc(_tipodoc))
|
|
_err.set(11);
|
|
*/
|
|
if (_registro != _reg_causale)
|
|
_err.set(12);
|
|
|
|
if (_registro.not_empty()) //movimento iva (fatture)
|
|
{
|
|
TRegistro rg (_registro, _datareg.year());
|
|
if (rg.name().empty())
|
|
_err.set(13);
|
|
else
|
|
{
|
|
const int tipo = rg.tipo();
|
|
TipoIVA i = nessuna_iva;
|
|
TTable tabtpd("%TPD");
|
|
tabtpd.put("CODTAB", _tipodoc);
|
|
if (tabtpd.read() == NOERR)
|
|
{
|
|
bool cor = tabtpd.get_bool("B0");
|
|
|
|
int i = tabtpd.get_int("I0");
|
|
if (i == 1 && tipo != 1)
|
|
_err.set(15);
|
|
if (i == 2 && tipo != 2)
|
|
_err.set(15);
|
|
if (i == 9 && (tipo != 1 && tipo != 2))
|
|
_err.set(15);
|
|
if (cor && !rg.corrispettivi())
|
|
_err.set(15);
|
|
if (!cor)
|
|
if (_codcf == 0l)
|
|
_err.set(16);
|
|
}
|
|
if (_codcf != 0l)
|
|
{
|
|
if ((tipo == 1 && _tipo_elenco != "C") || (tipo == 2 && _tipo_elenco != "F"))
|
|
_err.set(17);
|
|
|
|
TLocalisamfile clifo(LF_CLIFO);
|
|
clifo.setkey(1);
|
|
clifo.zero();
|
|
clifo.put(CLI_CODCF, _codcf);
|
|
clifo.put(CLI_TIPOCF,_tipo_elenco);
|
|
if (clifo.read() == NOERR)
|
|
{
|
|
bool sosp = clifo.get_bool(CLI_SOSPESO);
|
|
if (sosp)
|
|
_err.set(18);
|
|
bool occ = clifo.get_bool(CLI_OCCAS);
|
|
char alleg = clifo.get_char(CLI_ALLEG);
|
|
long calleg = clifo.get_long(CLI_CODALLEG);
|
|
if (!occ)
|
|
{
|
|
if (_stampa_mess_alleg_iva && alleg == '1')
|
|
_err.set(19);
|
|
if (calleg != 0l)
|
|
{
|
|
if (calleg == _codcf)
|
|
_err.set(20);
|
|
clifo.zero();
|
|
clifo.put(CLI_CODCF, calleg);
|
|
clifo.put(CLI_TIPOCF,_tipo_elenco);
|
|
if (clifo.read() == NOERR)
|
|
{
|
|
bool sospall = clifo.get_bool(CLI_SOSPESO);
|
|
long codall = clifo.get_long(CLI_CODALLEG);
|
|
char alleg = clifo.get_char(CLI_ALLEG);
|
|
if (sospall)
|
|
_err.set(21);
|
|
if (codall != 0l)
|
|
_err.set(22);
|
|
if (_stampa_mess_alleg_iva && alleg == '1')
|
|
_err.set(23);
|
|
}
|
|
else _err.set(24);
|
|
}
|
|
}
|
|
}
|
|
else _err.set(25);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (_err.ones())
|
|
return TRUE;
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
//controlli sulla contropartita
|
|
bool TListaMov_application::contropartita(int gruppo, int conto, long sottoconto, char t)
|
|
{
|
|
TBill tc;
|
|
TRectype pc (_pcon->curr());
|
|
tc.set(gruppo,0,0l);
|
|
if (!tc.read(pc))
|
|
return TRUE;
|
|
tc.set(gruppo,conto,0l);
|
|
if (!tc.read(pc))
|
|
return TRUE;
|
|
//else t = pc.get_char(PCN_TMCF);
|
|
tc.set(gruppo,conto,sottoconto);
|
|
if (t != 'C' && t != 'F')
|
|
{
|
|
if (!tc.read(pc))
|
|
return TRUE;
|
|
else
|
|
{
|
|
bool sosp = tc.sospeso();
|
|
if (sosp)
|
|
return TRUE;
|
|
}
|
|
}
|
|
else if (sottoconto != 0l)
|
|
{
|
|
TLocalisamfile clifo(LF_CLIFO);
|
|
clifo.setkey(1);
|
|
clifo.zero();
|
|
clifo.put(CLI_CODCF, sottoconto);
|
|
clifo.put(CLI_TIPOCF,t);
|
|
if (clifo.read() == NOERR)
|
|
{
|
|
bool sosp = clifo.get_bool(CLI_SOSPESO);
|
|
if (sosp)
|
|
return TRUE;
|
|
}
|
|
else
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
//guarda se c'e' almeno un errore su almeno una riga (rmov)
|
|
bool TListaMov_application::segnala_errori_ogniriga()
|
|
{
|
|
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
|
|
int gruppo, conto, anno, gruppoc, contoc;
|
|
long sottoconto, sottocontoc;
|
|
TDate datareg;
|
|
char sez, tipo, t, tipoc;
|
|
real importo;
|
|
real dare, avere;
|
|
|
|
if (current_cursor()->is_first_match(LF_RMOV))
|
|
{
|
|
dare = avere = ZERO;
|
|
TRecnotype nrec = rmov.recno();
|
|
rmov.zero();
|
|
rmov.setkey(1);
|
|
rmov.put(RMV_NUMREG, _numero);
|
|
TRectype recc (rmov.curr());
|
|
for (rmov.read(_isgteq); !rmov.eof() ;rmov.next())
|
|
{
|
|
TRectype rec (rmov.curr());
|
|
if (rec > recc) break;
|
|
gruppo = rec.get_int(RMV_GRUPPO);
|
|
conto = rec.get_int(RMV_CONTO);
|
|
sottoconto = rec.get_long(RMV_SOTTOCONTO);
|
|
gruppoc = rec.get_int(RMV_GRUPPOC);
|
|
contoc = rec.get_int(RMV_CONTOC);
|
|
sottocontoc = rec.get_long(RMV_SOTTOCONTOC);
|
|
tipoc = rec.get_char(RMV_TIPOCC);
|
|
anno = rec.get_int(RMV_ANNOES);
|
|
datareg = rec.get_date(RMV_DATAREG);
|
|
sez = rec.get_char(RMV_SEZIONE);
|
|
tipo = rec.get_char(RMV_TIPOC);
|
|
importo = rec.get_real(RMV_IMPORTO);
|
|
|
|
if (sez == 'D')
|
|
dare += importo;
|
|
if (sez == 'A')
|
|
avere += importo;
|
|
|
|
TBill tc (gruppo,conto,sottoconto);
|
|
|
|
if (gruppoc != 0 || contoc != 0 || sottocontoc != 0l)
|
|
if (contropartita(gruppoc, contoc, sottocontoc, tipoc))
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
|
|
if (anno != _annoeser || datareg != _datareg)
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
if (sez != 'D' && sez != 'A')
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
if (tc.empty())
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
if (!tc.ok())
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
TRectype pc (_pcon->curr());
|
|
tc.set(gruppo,0,0l);
|
|
|
|
if (!tc.read(pc))
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
tc.set(gruppo,conto,0l);
|
|
if (!tc.read(pc))
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
else t = pc.get_char(PCN_TMCF);
|
|
if (t != tipo)
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
tc.set(gruppo,conto,sottoconto);
|
|
if (t != 'C' && t != 'F')
|
|
{
|
|
if (!tc.read(pc))
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
bool sosp = tc.sospeso();
|
|
if (sosp)
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TLocalisamfile clifo(LF_CLIFO);
|
|
clifo.setkey(1);
|
|
clifo.zero();
|
|
clifo.put(CLI_CODCF, sottoconto);
|
|
clifo.put(CLI_TIPOCF,t);
|
|
if (clifo.read() == NOERR)
|
|
{
|
|
bool sosp = clifo.get_bool(CLI_SOSPESO);
|
|
if (sosp)
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
if (_registro.not_empty()) //se su mov e' indicato il codice registro
|
|
{
|
|
TRegistro rg (_registro, _ae);
|
|
const int tiporeg = rg.tipo();
|
|
if ((tiporeg == 1 && t != 'C') || (tiporeg == 2 && t != 'F'))
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
TLocalisamfile saldi(LF_SALDI);
|
|
saldi.setkey(1);
|
|
saldi.zero();
|
|
saldi.put(SLD_ANNOES,anno);
|
|
saldi.put(SLD_GRUPPO,gruppo);
|
|
saldi.put(SLD_CONTO, conto);
|
|
saldi.put(SLD_SOTTOCONTO,sottoconto);
|
|
saldi.put(SLD_FLSCA, "");
|
|
|
|
if (saldi.read() != NOERR)
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
} //for
|
|
if (dare != avere)
|
|
{
|
|
rmov.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
rmov.readat(nrec);
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
bool TListaMov_application::segnala_errori_iva()
|
|
{
|
|
TLocalisamfile& rmoviva = current_cursor()->file(LF_RMOVIVA);
|
|
TTable tab_iva("%IVA");
|
|
TString16 cod;
|
|
int tipodet, tipocr;
|
|
|
|
if (current_cursor()->is_first_match(LF_RMOVIVA))
|
|
{
|
|
TRecnotype nrec = rmoviva.recno();
|
|
rmoviva.setkey(1);
|
|
rmoviva.zero();
|
|
rmoviva.put(RMI_NUMREG, _numero);
|
|
TRectype recc (rmoviva.curr());
|
|
for (rmoviva.read(_isgteq); !rmoviva.eof() ;rmoviva.next())
|
|
{
|
|
TRectype rec (rmoviva.curr());
|
|
if (rec > recc) break;
|
|
if (_registro.empty())
|
|
{
|
|
rmoviva.readat(nrec);
|
|
_esiste_riga_iva = TRUE;
|
|
return TRUE;
|
|
}
|
|
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)
|
|
{
|
|
int allc = tab_iva.get_int("S7");
|
|
int allf = tab_iva.get_int("S8");
|
|
bool s = tab_iva.get_bool("B2");
|
|
if (s)
|
|
{
|
|
rmoviva.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
if (_stampa_mess_alleg_iva)
|
|
if (allc == 0 || allf == 0)
|
|
{
|
|
rmoviva.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
rmoviva.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
if (tipodet == 1 || tipodet == 3 || tipodet == 5 || tipodet == 9)
|
|
if (_tiporegistro != 2)
|
|
{
|
|
rmoviva.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
if (_tiporegistro == 1)
|
|
if (tipocr != 0 && tipocr != 1 && tipocr != 4 && tipocr != 9)
|
|
{
|
|
rmoviva.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
if (_tiporegistro == 2)
|
|
if (tipocr != 0 && tipocr != 1 && tipocr != 2 && tipocr != 3 && tipocr != 5 && tipocr != 8 && tipocr != 9)
|
|
{
|
|
rmoviva.readat(nrec);
|
|
return TRUE;
|
|
}
|
|
}
|
|
rmoviva.readat(nrec);
|
|
}
|
|
else if (_registro.not_empty()) //cioe' si tratta di fattura
|
|
{
|
|
_nonesiste_riga_iva = TRUE;
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
void TListaMov_application::incrementa_totali()
|
|
{
|
|
TString dep1;
|
|
real imponibile, imposta;
|
|
|
|
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();
|
|
if ((_tipo_elenco == "C")||(_tipo_elenco == "c"))
|
|
{
|
|
TString colonna = _tabiva->get("S7");
|
|
if ((colonna == "1")||(colonna == "3"))
|
|
_totimposta += imposta;
|
|
if (colonna == "1")
|
|
_totimponibile += imponibile;
|
|
else
|
|
if (colonna == "3")
|
|
_op_esenti += imponibile;
|
|
}
|
|
else
|
|
{
|
|
TString colonna = _tabiva->get("S8");
|
|
if ((colonna == "1")||(colonna == "3")||(colonna == "4"))
|
|
_totimposta += imposta;
|
|
if (colonna == "1")
|
|
_totimponibile += imponibile;
|
|
else
|
|
if (colonna == "3")
|
|
_op_esenti += imponibile;
|
|
else
|
|
if (colonna == "4")
|
|
_op_non_imp += imponibile;
|
|
}
|
|
}
|
|
|
|
bool TListaMov_application::set_print(int m)
|
|
{
|
|
_masc = "";
|
|
switch(toupper(_tipoc))
|
|
{
|
|
case 'C':
|
|
_masc = "cg3100b";
|
|
_tipo_lista = fatture;
|
|
break;
|
|
case 'M':
|
|
_masc = "cg3100a";
|
|
_tipo_lista = movimenti;
|
|
break;
|
|
break;
|
|
default:
|
|
NFCHECK("Bad _tipoc");
|
|
return FALSE;
|
|
}
|
|
|
|
TMask msk(_masc);
|
|
|
|
msk.set_handler(F_ANNO, annoes_handler);
|
|
msk.set_handler(F_DATAINI, data_inizio);
|
|
msk.set_handler(F_DATAFIN, data_fine);
|
|
|
|
if (msk.run() != K_ENTER)
|
|
return FALSE;
|
|
|
|
reset_files();
|
|
TLocalisamfile* fl;
|
|
_curr1->set_filterfunction (filter_func);
|
|
_curr2->set_filterfunction (filter_func);
|
|
_curr3->set_filterfunction (filter_func_fatture);
|
|
switch (_tipo_lista)
|
|
{
|
|
case movimenti:
|
|
{
|
|
_scelta_stampa = atoi(msk.get(F_MOVIMENTI));
|
|
_annoes = msk.get_int (F_ANNO);
|
|
_decidi = msk.get_int(F_DECIDI);
|
|
_causale_ini = msk.get(F_CAUSALEINI);
|
|
_causale_fin = msk.get(F_CAUSALEFIN);
|
|
if (_scelta_stampa == 0)
|
|
{
|
|
_registro_ini = msk.get(F_REGISTROINI);
|
|
_registro_fin = msk.get(F_REGISTROFIN);
|
|
}
|
|
_numreg_ini = atol(msk.get(F_NUMEROINI));
|
|
_data_ini = msk.get(F_DATAINI);
|
|
_data_fin = msk.get(F_DATAFIN);
|
|
_numreg_fin = atoi(msk.get(F_NUMEROFIN));
|
|
_provvis = msk.get_int(F_STAMPAMOVP);
|
|
if (_decidi == 1)
|
|
{
|
|
select_cursor(_cur1);
|
|
/*
|
|
if (!provvis)
|
|
_curr1->setfilter("(PROVVIS=\"\")");
|
|
else _curr1->setfilter("");
|
|
*/
|
|
if (_provvis == 1) //normale
|
|
_curr1->setfilter("(PROVVIS=\"\")");
|
|
else if (_provvis == 2) //globale
|
|
_curr1->setfilter("");
|
|
else _curr1->setfilter("(PROVVIS!=\"\")"); //solo provvisori
|
|
fl = &(current_cursor()->file(LF_MOV));
|
|
TRectype da (fl->curr());
|
|
TRectype a (fl->curr());
|
|
da.zero();
|
|
a.zero();
|
|
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)
|
|
_curr2->setfilter("(PROVVIS=\"\")");
|
|
else
|
|
_curr2->setfilter("");
|
|
*/
|
|
if (_provvis == 1) //normale
|
|
_curr2->setfilter("(PROVVIS=\"\")");
|
|
else if (_provvis == 2) //globale
|
|
_curr2->setfilter("");
|
|
else _curr2->setfilter("(PROVVIS!=\"\")"); //solo provvisori
|
|
fl = &(current_cursor()->file(LF_MOV));
|
|
TRectype da (fl->curr());
|
|
TRectype a (fl->curr());
|
|
da.zero();
|
|
a.zero();
|
|
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:
|
|
{
|
|
_noseparator = msk.get_bool(F_SEPARATOR);
|
|
fl = &(current_cursor()->file(LF_MOV));
|
|
TString tipo = msk.get(F_TIPOELENCO);
|
|
//bool movprov = msk.get_bool(F_STAMPAMOVP);
|
|
_data_ini = msk.get(F_DATAINI);
|
|
_data_fin = msk.get(F_DATAFIN);
|
|
_annoes = msk.get_int(F_ANNO);
|
|
if (tipo=="C" || tipo=="F")
|
|
{
|
|
_codice_ini = atol(msk.get(F_CODICEINI));
|
|
_codice_fin = atol(msk.get(F_CODICEFIN));
|
|
}
|
|
else
|
|
{
|
|
_codice_ini = atol(msk.get(F_CODICEINI1));
|
|
_codice_fin = atol(msk.get(F_CODICEFIN1));
|
|
}
|
|
|
|
// _relmov->add(LF_MOV, "NUMREG=NUMREG",1, LF_RMOVIVA,100); //creo un alias per il file LF_MOV
|
|
if (tipo == "E")
|
|
{
|
|
_tipo_ini = "C";
|
|
_tipo_fin = "F";
|
|
}
|
|
else
|
|
{
|
|
_tipo_ini = tipo;
|
|
_tipo_fin = tipo;
|
|
}
|
|
select_cursor(_cur3);
|
|
/*
|
|
if (!movprov)
|
|
_curr3->setfilter("(PROVVIS=\"\")");
|
|
else _curr3->setfilter("");
|
|
*/
|
|
_curr3->setfilter("");
|
|
TRectype da (fl->curr());
|
|
TRectype a (fl->curr());
|
|
da.zero();
|
|
a.zero();
|
|
if (_codice_ini != 0)
|
|
da.put(MOV_CODCF, _codice_ini);
|
|
a.put(MOV_TIPO, _tipo_fin);
|
|
if (_codice_fin != 0)
|
|
a.put(MOV_CODCF, _codice_fin);
|
|
da.put(MOV_TIPO, _tipo_ini);
|
|
current_cursor()->setregion(da,a);
|
|
add_file(LF_MOV);
|
|
add_file(LF_RMOVIVA,LF_MOV);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
init_print(msk);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
bool TListaMov_application::user_create()
|
|
{
|
|
_relmov1 = new TRelation (LF_MOV);
|
|
_relmov1->add(LF_RMOV, "NUMREG=NUMREG",1);
|
|
_relmov1->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
|
|
_curr1 = new TCursor (_relmov1, "", 1);
|
|
_cur1 = add_cursor (_curr1);
|
|
|
|
_relmov2 = new TRelation (LF_MOV);
|
|
_relmov2->add(LF_RMOV, "NUMREG=NUMREG",1);
|
|
_relmov2->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
|
|
_curr2 = new TCursor (_relmov2, "", 2);
|
|
_cur2 = add_cursor (_curr2);
|
|
|
|
_relmov3 = new TRelation (LF_MOV);
|
|
_relmov3->add(LF_RMOVIVA, "NUMREG==NUMREG",1);
|
|
_relmov3->add(LF_RMOV, "NUMREG==NUMREG",1);
|
|
_curr3 = new TCursor (_relmov3, "", 3);
|
|
_cur3 = add_cursor (_curr3);
|
|
|
|
_caus = new TLocalisamfile(LF_CAUSALI);
|
|
_clifo = new TLocalisamfile(LF_CLIFO);
|
|
_comuni = new TLocalisamfile(LF_COMUNI);
|
|
_attiv = new TLocalisamfile(LF_ATTIV);
|
|
_pcon = new TLocalisamfile(LF_PCON);
|
|
_saldi = new TLocalisamfile(LF_SALDI);
|
|
_rmoviva = new TLocalisamfile(LF_RMOVIVA);
|
|
_nditte = new TLocalisamfile(LF_NDITTE);
|
|
_tabiva = new TTable(TAB_IVA);
|
|
_tabtpd = new TTable(TAB_TPD);
|
|
_tabreg = new TTable("REG");
|
|
_tabes = new TTable("ESC");
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
bool TListaMov_application::user_destroy() // releasev e arrmask
|
|
{
|
|
delete _relmov1;
|
|
delete _relmov2;
|
|
delete _relmov3;
|
|
delete _curr1;
|
|
delete _curr2;
|
|
delete _curr3;
|
|
delete _clifo;
|
|
delete _caus;
|
|
delete _pcon;
|
|
delete _attiv;
|
|
delete _comuni;
|
|
delete _tabiva;
|
|
delete _tabreg;
|
|
delete _tabtpd;
|
|
delete _tabes;
|
|
delete _rmoviva;
|
|
delete _saldi;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
void TListaMov_application::init_print(const TMask& msk)
|
|
{
|
|
const TDate data (msk.get(F_DATASTAMPA));
|
|
printer().setdate(data);
|
|
printer().footerlen(5);
|
|
|
|
switch (_tipo_lista)
|
|
{
|
|
case movimenti:
|
|
{
|
|
set_real_picture("###.###.###.###.###");
|
|
reset_print();
|
|
_flags = 0;
|
|
_err.reset();
|
|
_tot_dare_giornaliero = 0;
|
|
_tot_avere_giornaliero = 0;
|
|
_tot_dare_generale = 0;
|
|
_tot_avere_generale = 0;
|
|
if (_scelta_stampa == 0)
|
|
{
|
|
_annoes = msk.get_int(F_ANNO);
|
|
_stampa_parte_iva = msk.get_bool(F_STAMPA);
|
|
if (_stampa_parte_iva)
|
|
_flags |= ST_DATI_IVA;
|
|
_stampa_mess_alleg_iva = msk.get_bool(F_ALLEGATO);
|
|
if (_stampa_mess_alleg_iva)
|
|
_flags |= ST_MESS_ALLEG;
|
|
_stampa_anno_comp = msk.get_bool(F_ANNOC);
|
|
if (_stampa_anno_comp)
|
|
_flags |= ST_ANNO_COMP;
|
|
_controllo_mov_errati = msk.get_int(F_CONTROLLO);
|
|
if (_controllo_mov_errati == 1)
|
|
_flags |= ST_SOLO_MOVERR;
|
|
else if (_controllo_mov_errati == 2)
|
|
_flags |= ST_CONTROLLO;
|
|
else _flags |= ST_SENZA_CONTR;
|
|
if ((_numreg_ini != 0)&&(_decidi == 1))
|
|
_flags |= ST_NUMERO;
|
|
if ((_data_ini.ok())&&(_decidi == 2))
|
|
_flags |= ST_DATA;
|
|
_causale_ini = msk.get(F_CAUSALEINI);
|
|
if (_causale_ini != "")
|
|
_flags |= ST_CAUSALE;
|
|
_registro_ini = msk.get(F_REGISTROINI);
|
|
if (_registro_ini != "")
|
|
_flags |= ST_REGISTRO;
|
|
if ((_data_fin.ok())&&(_decidi == 2))
|
|
_flags |= ST_DATA;
|
|
if ((_numreg_fin != 0)&&(_decidi == 2))
|
|
_flags |= ST_NUMERO;
|
|
_causale_fin = msk.get(F_CAUSALEFIN);
|
|
if (_causale_fin != "")
|
|
_flags |= ST_CAUSALE;
|
|
_registro_fin = msk.get(F_REGISTROFIN);
|
|
if (_registro_fin != "")
|
|
_flags |= ST_REGISTRO;
|
|
}
|
|
else //_scelta_stampa == 1
|
|
{
|
|
_annoes = msk.get_int(F_ANNO);
|
|
if (_numreg_ini != 0)
|
|
_flags |= ST_NUMERO;
|
|
if (_data_ini.ok())
|
|
_flags |= ST_DATA;
|
|
_causale_ini = msk.get(F_CAUSALEINI);
|
|
if (_causale_ini != "")
|
|
_flags |= ST_CAUSALE;
|
|
if (_data_fin.ok())
|
|
_flags |= ST_DATA;
|
|
if (_numreg_fin != 0)
|
|
_flags |= ST_NUMERO;
|
|
_causale_fin = msk.get(F_CAUSALEFIN);
|
|
if (_causale_fin != "")
|
|
_flags |= ST_CAUSALE;
|
|
}
|
|
}
|
|
break;
|
|
case fatture:
|
|
{
|
|
if (_noseparator)
|
|
set_real_picture("################");
|
|
else
|
|
set_real_picture("####.###.###.###");
|
|
|
|
_flags = 0;
|
|
|
|
reset_print();
|
|
_settata_prima_riga = FALSE;
|
|
_tipo_clifo_prec = "";
|
|
_codcf_prec = 0l;
|
|
_numeroregp = 0;
|
|
_documenti = 0;
|
|
_totdocumenti = 0;
|
|
_totimponibile = 0;
|
|
_totimposta = 0;
|
|
_op_esenti = 0;
|
|
_op_non_imp = 0;
|
|
_annoes = msk.get_int(F_ANNO);
|
|
_salto_pagina = (bool)(msk.get(F_CAMBIO)=="X");
|
|
_data_ini = msk.get(F_DATAINI);
|
|
if (_data_ini.ok())
|
|
_flags |= ST_DATA;
|
|
_data_fin = msk.get(F_DATAFIN);
|
|
if (_data_fin.ok())
|
|
_flags |= ST_DATA;
|
|
TString tipo = msk.get(F_TIPOELENCO);
|
|
if ((tipo=="C")||(tipo=="F"))
|
|
{
|
|
_codice_ini = atol(msk.get(F_CODICEINI));
|
|
_codice_fin = atol(msk.get(F_CODICEFIN));
|
|
}
|
|
else
|
|
{
|
|
_codice_ini = atol(msk.get(F_CODICEINI1));
|
|
_codice_fin = atol(msk.get(F_CODICEFIN1));
|
|
}
|
|
if (_codice_ini != 0)
|
|
_flags |= ST_CODICE;
|
|
if (_codice_fin != 0)
|
|
_flags |= ST_CODICE;
|
|
if (tipo == "E")
|
|
{
|
|
_tipo_ini = "C";
|
|
_tipo_fin = "F";
|
|
}
|
|
else
|
|
{
|
|
_tipo_ini = tipo;
|
|
_tipo_fin = tipo;
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
void TListaMov_application::preprocess_header()
|
|
{
|
|
int soh; // riga d'inizio dell'intestazione
|
|
TString sep(132);
|
|
TString ragsoc(50);
|
|
TLocalisamfile nditte(LF_NDITTE);
|
|
|
|
nditte.zero();
|
|
nditte.put(NDT_CODDITTA, get_firm());
|
|
if (nditte.read() == NOERR)
|
|
ragsoc = nditte.get(NDT_RAGSOC);
|
|
|
|
reset_header();
|
|
soh=1;
|
|
sep << "Ditta " << get_firm();
|
|
sep << " " << ragsoc;
|
|
sep.left_just(132);
|
|
|
|
set_header (soh++, (const char*) sep);
|
|
|
|
//sep = "Studio ";
|
|
sep = "";
|
|
sep << "Data @< Pag. @#";
|
|
|
|
sep.right_just(126);
|
|
|
|
switch (_tipo_lista)
|
|
{
|
|
case movimenti:
|
|
if (_scelta_stampa == 0)
|
|
{
|
|
sep.overwrite ("Lista movimenti");
|
|
set_header (soh++, (const char*)sep);
|
|
if (_decidi == 2) // se _decidi e' 1 _annoes e' sempre uguale a zero
|
|
{
|
|
if (_annoes != 0)
|
|
{
|
|
set_header (soh, "Cod. eserc.%d", _annoes);
|
|
if (_flags & ST_DATA)
|
|
{
|
|
set_header (soh, "@16gda@19g%s",_data_ini.string());
|
|
set_header (soh, "@30ga@32g%s",_data_fin.string());
|
|
}
|
|
}
|
|
else // _annoes == 0
|
|
if (_flags & ST_DATA)
|
|
{
|
|
set_header (soh, "Dalla data@11g%s",_data_ini.string());
|
|
if (_data_fin.ok())
|
|
set_header (soh, "@23galla data@33g%s",_data_fin.string());
|
|
}
|
|
else
|
|
set_header (soh, "Completa in ordine di data");
|
|
}
|
|
else
|
|
if (_flags & ST_NUMERO)
|
|
{
|
|
set_header (soh, "dal numero@12g%ld", _numreg_ini);
|
|
if (_numreg_fin != 0)
|
|
set_header (soh, "@20gal numero@30g%ld", _numreg_fin);
|
|
}
|
|
else
|
|
set_header (soh, "Completa in ordine di numero");
|
|
if (_flags & ST_CAUSALE)
|
|
{
|
|
set_header (soh, "@46gdalla causale@60g%s",(const char*)_causale_ini);
|
|
set_header (soh++, "@64galla causale@77g%s",(const char*)_causale_fin);
|
|
}
|
|
else
|
|
set_header (soh++, " tutte le causali");
|
|
if (_flags & ST_REGISTRO)
|
|
{
|
|
set_header (soh, "dal registro %s",(const char*)_registro_ini);
|
|
set_header (soh, "@17gal registro %s",(const char*)_registro_fin);
|
|
}
|
|
else
|
|
set_header (soh, "tutti i registri");
|
|
if (_flags & ST_DATI_IVA)
|
|
set_header (soh, "@34gstampa dati iva");
|
|
if (_flags & ST_CONTROLLO)
|
|
set_header (soh, "@50g(controllo movimenti)");
|
|
else if (_flags & ST_SOLO_MOVERR)
|
|
set_header (soh, "@50g(solo movimenti errati)");
|
|
else set_header (soh, "@50g(senza controllo movimenti)");
|
|
if (_flags & ST_MESS_ALLEG)
|
|
{
|
|
if (_flags & ST_ANNO_COMP)
|
|
set_header (soh, "@78gcon messaggi: data competenza, allegato iva");
|
|
else
|
|
set_header (soh, "@78gcon messaggio: allegato iva");
|
|
}
|
|
else if (_flags & ST_ANNO_COMP)
|
|
{
|
|
if (_flags & ST_MESS_ALLEG)
|
|
set_header (soh, "@78gcon messaggi: data competenza, allegato iva");
|
|
else
|
|
set_header (soh, "@78gcon messaggio: data competenza");
|
|
}
|
|
sep.fill('-');
|
|
set_header (++soh, (const char *) sep);
|
|
set_header (++soh, "Rg Cod Causale@30gDescrizione@56gCodice conto@71gDescrizione conto@103gDare@120gAvere@130gSB");
|
|
}
|
|
else
|
|
{
|
|
sep.overwrite ("Lista movimenti di sola prima nota");
|
|
set_header (soh++, (const char*)sep);
|
|
if (_decidi == 2)
|
|
{
|
|
if (_annoes != 0)
|
|
{
|
|
set_header (soh, "Cod. comp. %d", _annoes);
|
|
if (_flags & ST_DATA)
|
|
{
|
|
set_header (soh, "@16gda@19g%s", (const char*)_data_ini.string());
|
|
set_header (soh, "@30ga@32g%s", (const char*)_data_fin.string());
|
|
}
|
|
}
|
|
else
|
|
if (_flags & ST_DATA)
|
|
{
|
|
set_header (soh, "Dalla data@11g%s", (const char*)_data_ini.string());
|
|
set_header (soh, "@23galla data@33g%s", (const char*)_data_fin.string());
|
|
}
|
|
else
|
|
set_header (soh, "Completa in ordine di data");
|
|
}
|
|
else
|
|
if (_flags & ST_NUMERO)
|
|
{
|
|
set_header (soh, "@46gdal numero@57g%ld", _numreg_ini);
|
|
set_header (soh, "@65gal numero@75g%ld", _numreg_fin);
|
|
}
|
|
else
|
|
set_header (soh, "@46gCompleta in ordine di numero");
|
|
if (_flags & ST_CAUSALE)
|
|
{
|
|
set_header(soh, "@86gdalla causale@100g%3s",(const char*)_causale_ini);
|
|
set_header(soh++,"@104galla causale@117g%3s",(const char*)_causale_fin);
|
|
}
|
|
else
|
|
set_header (soh++, "@86gtutte le causali");
|
|
sep.fill('-');
|
|
set_header (soh++, (const char *) sep);
|
|
set_header (soh, "Rg Cod Causale@30gDescrizione@56gCodice conto@71gDescrizione conto@103gDare@120gAvere@130gSB");
|
|
}
|
|
break;
|
|
|
|
case fatture:
|
|
sep.overwrite ("Lista fatture");
|
|
set_header (soh, (const char*)sep);
|
|
if (_annoes != 0)
|
|
{
|
|
set_header (soh, "@15gCod. comp %d", _annoes);
|
|
if (_flags & ST_DATA)
|
|
{
|
|
set_header (soh, "@30gdalla data@41g%s", (const char*)_data_ini.string());
|
|
set_header (soh, "@52galla data@62g%s", (const char*)_data_fin.string());
|
|
}
|
|
}
|
|
else
|
|
if (_flags & ST_DATA)
|
|
{
|
|
set_header (soh, "@15gdalla data %s", (const char*)_data_ini.string());
|
|
set_header (soh, "@37galla data %s", (const char*)_data_fin.string());
|
|
}
|
|
else
|
|
set_header (soh, "@15gcompleta in ordine di data");
|
|
if (_flags & ST_CODICE)
|
|
{
|
|
set_header (soh, "@74gdal codice %ld", _codice_ini);
|
|
set_header (soh, "@92gal codice %ld", _codice_fin);
|
|
}
|
|
sep.fill('-');
|
|
set_header (++soh, (const char *) sep);
|
|
set_header (++soh, "Numero Data Cod Protoc. Documento@49gCod Tp @75gTotale@101gCd Tp T O@129gNo");
|
|
set_header (++soh, "Regis. Operaz. Reg Numero Data@42gNumero@49gCau Dc @56gDescrizione@75gDocumento@90gImponibile@101gIv Det A I@121gImposta@129gAll");
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
set_header (++soh,(const char*)sep);
|
|
}
|
|
|
|
int cg3100(int argc, char* argv[])
|
|
{
|
|
const char tipo = *argv[2];
|
|
TListaMov_application a(tipo);
|
|
|
|
const char* title;
|
|
switch (tipo)
|
|
{
|
|
case 'C':
|
|
title = "Lista fatture clienti/fornitori";
|
|
break;
|
|
default:
|
|
title = "Lista movimenti";
|
|
break;
|
|
}
|
|
a.run(argc, argv, title);
|
|
return TRUE;
|
|
}
|
|
|
|
|