Patch level : nopatch

Files correlati     :
Commento        :

Implementazione nuovo modulo FP
This commit is contained in:
smen 2021-11-16 17:58:50 +01:00
parent 4be3d3a3e8
commit 58b143e715
2 changed files with 84 additions and 48 deletions

View File

@ -29,6 +29,10 @@
#include <varrec.h>
#endif
#ifndef __CGPAGAME_H
#include "../cg/cgpagame.h"
#endif
#ifndef __PROGIND_H
class TDocumento;
class TProgind;
@ -1015,54 +1019,6 @@ 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"
@ -1593,4 +1549,61 @@ public:
const TCli_for & cached_clifor(const char tipo, const long codice);
const TCli_for & cached_clifor(int file, const TRectype & rec);
class TMovimento_contabile : public TMultiple_rectype
{
TDate _olddataliq;
TRecord_array _old_iva;
TPagamento _pag;
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; }
TPagamento& pagamento();
const TCli_for & clifo() const { return cached_clifor(get_char(MOV_TIPO), get_long(MOV_CODCF)); }
const TCausale & causale() const { return cached_causale(get(MOV_CODCAUS), get_int(MOV_ANNOES)); }
bool is_reverse_charge() const { return ::is_reverse_charge(*this); }
bool is_split_payment() const { return ::is_split_payment(*this); }
bool is_IVA_diff() const { return ::is_IVA_diff(*this); }
bool is_IVAxCassa() const { return ::is_IVAxCassa(*this); }
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() {}
};
#endif

View File

@ -520,3 +520,26 @@ void TMovimento_contabile::adjust_rowtypes()
}
}
}
TPagamento& TMovimento_contabile::pagamento()
{
const char tipocf = get_char(MOV_TIPO);
const long codcf = get_long(MOV_CODCF);
TDate data_in = get_date(MOV_DATADOC);
const TString8 codpag(get(MOV_CODPAG));
_pag.set_clifo(codcf, tipocf);
if (codpag != _pag.code())
{
_pag.set_code(codpag);
_pag.read();
_pag.set_inizio(data_in); // Perche' rispetta rate true?
}
else
{
if (data_in != _pag.get_datadoc())
_pag.set_inizio(data_in); // Perche' rispetta rate true?
}
return _pag;
}