Patch level : 12.0 382

Files correlati     : cg2.exe cg0500a.msk

Rilevazione automatica delle fatture da emettere o ricevere

git-svn-id: svn://10.65.10.50/branches/R_10_00@23750 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
bonazzi 2017-04-21 01:25:38 +00:00
parent 9288c34b3e
commit 7fcdcc999f
8 changed files with 577 additions and 493 deletions

View File

@ -36,6 +36,8 @@
#define F_CODCAUREG 233
#define F_REGSPIVA 234
#define F_MOVCGIND 235
#define F_RIL_FT_EM_RI 236
#define F_DATAREG_PREC 237
#define SS_TIPO 101
#define SS_SEZIONE 102

View File

@ -70,8 +70,8 @@ BEGIN
CHECKTYPE NORMAL
FLAGS "U"
ADD NONE
MESSAGE EMPTY CLEAR,F_SOLAIVA|ENABLE,F_PROVV
MESSAGE ENABLE,F_SOLAIVA|CLEAR,F_PROVV
MESSAGE EMPTY CLEAR,F_SOLAIVA|ENABLE,F_PROVV|ENABLE,9@
MESSAGE ENABLE,F_SOLAIVA|CLEAR,F_PROVV|CLEAR,9@
END
STRING F_DES_DOC 50
@ -294,6 +294,20 @@ BEGIN
FLAGS "H"
END
BOOLEAN F_RIL_FT_EM_RI
BEGIN
PROMPT 2 12 "Rilevazione fatt.da ric./em."
FIELD RILFTEMRI
GROUP 9
END
BOOLEAN F_DATAREG_PREC
BEGIN
PROMPT 34 12 "Regis.ril. fatt.da ric./em.a fine esercizio"
FIELD DATAREGPR
GROUP 9
END
LIST F_PROVV 1 26
BEGIN
PROMPT 2 13 "Movimento provvisorio "

View File

@ -31,7 +31,7 @@ public:
int _tipo, _step;
TString4 _causale, _codiva;
TBill _clifo;
TDate _datadoc;
TDate _datadoc, _datareg;
TString8 _numdoc;
real _totale;
TString4 _causale_originale;
@ -1441,6 +1441,12 @@ int TPrimanota_application::write(const TMask& m)
causauto = causale().causale_reg_iva();
tipauto = causauto.full() ? 2 : 0;
}
if (tipauto <= 1)
{
causauto = causale().causale_collegata();
if (cached_causale(causauto, causale().reg().year()).ril_fat_em_ric())
tipauto = 4;
}
if (tipauto <= 0)
{
causauto = causale().causale_collegata();
@ -1577,6 +1583,25 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
if (_automatico->_codiva.blank() && _rel->iva_items() > 0)
_automatico->_codiva = _rel->iva(0).get(RMI_CODIVA);
}
else
if (_automatico->_tipo == 4)
{
const int esercizio = m.get_int(F_ANNOES);
const int esprec = esercizi().pred(esercizio);
TEsercizio e = esercizi().esercizio(esprec);
TDate last(e.fine());
_automatico->_datadoc = last;
if (cached_causale(causimm, caus.reg().year()).datareg_prec())
_automatico->_datareg = last;
else
_automatico->_datareg = m.get(F_DATAREG);
const int nrows = _rel->iva_items();
_automatico->_totale = ZERO;
for (int i = 0; i < nrows; i++)
_automatico->_totale += _rel->iva(i).get_real(RMI_IMPONIBILE);
}
_automatico->_step = 1;
}
@ -1611,6 +1636,8 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
row2.add(caus.desc_agg(2));
row2.add(_automatico->_clifo.string(0x3));
fill_sheet(m);
if (TRelation_application::is_transaction())
m.send_key(K_CTRL+'R', 0);
}
break;
case 2: // Regolarizzazione IVA
@ -1626,6 +1653,33 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
}
break;
case 4: // Rilevazione fatture da emettere/ricevere
{
m.set(F_DATAREG, _automatico->_datareg);
m.set(F_DATACOMP, _automatico->_datadoc);
TBill conto; caus.bill(1, conto);
TBill contro; caus.bill(2, contro);
cgs().reset();
TToken_string& row1 = cgs().row(0);
TImporto imp(caus.sezione_clifo(), _automatico->_totale);
imp.add_to(row1, 0);
row1.add(conto.string(0x3));
row1.add(" ");
row1.add(" ");
row1.add(contro.string(0x3));
TToken_string& row2 = cgs().row(1);
imp.swap_section();
imp.add_to(row2, 0);
row2.add(contro.string(0x3));
row2.add(" ");
row2.add(caus.desc_agg(2));
row2.add(conto.string(0x3));
fill_sheet(m);
if (TRelation_application::is_transaction())
m.send_key(K_CTRL+'R', 0);
}
default:
break;
}

View File

@ -196,7 +196,7 @@ protected: // TRelation_application
protected:
void check_saldi();
void genera_automatico(int tipo, const char* causimm); // 0=nessuno, 1=incasso, 2=regolarizzazione
void genera_automatico(int tipo, const char* causimm); // 0=nessuno, 1=incasso, 2=regolarizzazione 3= ?? 4 = rilevazione fatture da emettere/ricevere
void gioca_cambi(int force = 0x00);
TMask* load_mask(int n);

View File

@ -162,6 +162,16 @@ bool TCausale::regolarizzazione()
return _regolarizzazione != 0;
}
bool TCausale::ril_fat_em_ric() const
{
return _rec.get_bool(CAU_RILFTEMRI);
}
bool TCausale::datareg_prec() const
{
return _rec.get_bool(CAU_DATAREGPR);
}
bool TCausale::reverse_charge() const
{
const int rsi = regime_speciale();

View File

@ -42,6 +42,8 @@ public:
bool soloiva() const;
bool reverse_charge() const;
bool regolarizzazione();
bool ril_fat_em_ric() const;
bool datareg_prec() const;
char provvisorio() const { return _provvisorio; }
const TString& causale_collegata() const;
const TString& causale_reg_iva() const;

View File

@ -1,3 +1,3 @@
26
0
$caus|0|0|86|0|Causali contabili|||
$caus|0|0|88|0|Causali contabili|60||

View File

@ -1,5 +1,5 @@
26
26
28
CODCAUS|1|3|0|Codice causale
DESCR|1|50|0|Descrizione causale
TIPODOC|1|2|0|Tipo documento
@ -26,6 +26,8 @@ PROVV|1|1|0|Tipo movimento (" " Normale, "P" Provvisorio cancellabile, "C" Provv
REGSPIVA|2|2|0|Regimi speciali IVA
CODCAUREG|1|3|0|Causale regolarizzazione IVA
LIQDIFF|8|1|0|Fatture a liquidazione differita
RILFTEMRI|8|1|0|Causale di rilevazione fatture de emettere o ricevere
DATAREGPR|8|1|0|Data di registrazion nell'ereserciozio precedente per il caso del campo precedente
2
CODCAUS|
UPPER(DESCR)|X