diff --git a/src/cg/cglib.h b/src/cg/cglib.h index b0c87a0f9..b0377b26a 100644 --- a/src/cg/cglib.h +++ b/src/cg/cglib.h @@ -963,6 +963,54 @@ char frequenza_versamenti(int year, long firm = -1); // Ritorna 'M'ensile o 'T int date2liq(const TDate & data, long firm = -1); // Estrae dalla data il mese di liquidazione bool controlla_liquidazione(const TDate & data, const TRegistro & reg, bool reset = false); +class TMovimento_contabile : public TMultiple_rectype +{ + TDate _olddataliq; + TRecord_array _old_iva; + +protected: + int registra(bool re, bool force); + int read_mov_rows(); + void update_rev_charge(); + void find_movcoll(); + virtual int write_rewrite(TBaseisamfile& f, bool re = false) const; + +public: + const TRecord_array& cg() const { return body(LF_RMOV); } + TRecord_array& cg() { return body(LF_RMOV); } + const TRecord_array& iva() const { return body(LF_RMOVIVA); } + TRecord_array& iva() { return body(LF_RMOVIVA); } + TRectype& cg(int i, bool create = true) { return cg().row(i, create); } + TRectype& iva(int i, bool create = true) { return iva().row(i, create); } + const TRectype& cg(int i, bool create = true) const { return (const TRectype &) ((TRecord_array &) cg()).row(i, create); } + const TRectype& iva(int i, bool create = true) const { return (const TRectype &)((TRecord_array &) iva()).row(i, create); } + int cg_rows() const { return cg().rows(); } + int iva_rows() const { return iva().rows(); } + bool solo_IVA() const { return iva_rows() > 0 && cg_rows() == 0; } + bool is_IVA() const { return iva_rows() > 0; } + + virtual int readat(TRecnotype nrec, word lockop = _nolock); + virtual int read(word op = _isequal, word lockop = _nolock); + virtual int TMovimento_contabile::remove(); + + // Funzioni per costruttore di copia + + virtual TMovimento_contabile & copy(const TMovimento_contabile & mov); + virtual TObject* dup() const { return new TMovimento_contabile(*this); } + virtual TMovimento_contabile& operator =(const TMovimento_contabile& mov) { return copy(mov); } + virtual TRectype& operator =(const TRectype & mov); + + void adjust_rowtypes(); + real imponibile(const char * codiva = nullptr) const ; + real imposta(const char * codiva = nullptr) const ; + + TMovimento_contabile(); + TMovimento_contabile(const TMovimento_contabile& mov); + TMovimento_contabile(long numreg); + TMovimento_contabile(const TRectype& mov); + virtual ~TMovimento_contabile() {} +}; + #define TEMP_CAUS "tcaus" #define TEMP_RCAUS "trcaus" #define TEMP_CLIFO "tclifo"