Merge branch 'R12.00.1136' of http://10.65.20.33/sirio/CAMPO/campo into R12.00.1136

This commit is contained in:
Simoe 2022-09-08 17:13:36 +02:00
commit 3179ea6e46
29 changed files with 369 additions and 202 deletions

View File

@ -52,26 +52,24 @@ bool TTestrel_application::user_destroy()
// Testmask
///////////////////////////////////////////////////////////
class TTest_application : public TApplication
class TTest_application : public TSkeleton_application
{
const char* _maskname;
protected:
bool create() { return menu(0); }
bool destroy() { return TRUE; }
bool menu(MENU_TAG);
void main_loop();
public:
TTest_application(const char* name) : _maskname(name) {}
};
bool TTest_application::menu(MENU_TAG)
void TTest_application::main_loop()
{
if (*_maskname)
{
TMask m(_maskname);
KEY k = m.run();
if (k == K_QUIT) stop_run();
while (m.run() == K_ENTER);
}
else
{
@ -83,8 +81,6 @@ bool TTest_application::menu(MENU_TAG)
m.run();
}
}
return FALSE;
}
///////////////////////////////////////////////////////////

View File

@ -4,7 +4,7 @@ PAGE "Richiesta" -1 -1 76 12
STRING F_NOME 50
BEGIN
PROMPT 3 3 "Nome maschera"
PROMPT 3 3 "Maschera "
END
BUTTON DLG_OK 10 2

View File

@ -567,6 +567,13 @@ bool TReport_mask::save_report()
if (ok)
_is_dirty = false;
}
if (is_power_station())
{
DIRECTORY dir;
xvt_fsys_get_default_dir(&dir);
xvt_fsys_set_dir(&dir);
}
return ok;
}

View File

@ -7,7 +7,7 @@ BEGIN
PROMPT 1 0 ""
RSELECT ""
WARNING "E' necessario specificare il codice"
CHECKTYPE REQUIRED
// CHECKTYPE REQUIRED
END
STRING F_DESCR 50 46

View File

@ -46,7 +46,7 @@ BEGIN
WARNING "Manca la descrizione"
END
LIST LST_TABIVA_S1 2 20
LIST LST_TABIVA_S1 2 28
BEGIN
PROMPT 2 2 "Tipo "
FIELD S1
@ -70,11 +70,15 @@ BEGIN
MESSAGE CLEAR,FLD_TABIVA_R0|CLEAR,FLD_TABIVA_I0
MESSAGE ENABLE,FLD_TABIVA_I3|ENABLE,FLD_TABIVA_I4|SHOW,CHK_TABIVA_B5
MESSAGE ENABLE,FLD_TABIVA_S6
ITEM "RC|Reverse Charge (vendite)"
MESSAGE CLEAR,FLD_TABIVA_R0|CLEAR,FLD_TABIVA_I0
MESSAGE ENABLE,FLD_TABIVA_I3|ENABLE,FLD_TABIVA_I4|SHOW,CHK_TABIVA_B5
MESSAGE ENABLE,FLD_TABIVA_S6
END
STRING FLD_TABIVA_S6 4
BEGIN
PROMPT 39 2 "C.IVA a cui ventilare "
PROMPT 44 2 "C.IVA a cui ventilare "
FLAGS "U"
FIELD S6
COPY USE FLD_TABIVA_CODTAB
@ -188,6 +192,8 @@ BEGIN
INPUT FLD_TABIVA_I3
OUTPUT FLD_TABIVA_I3
ITEM " |Nessuno"
ITEM "14|Passaggi interni"
ITEM "16|Cessioni beni ammortizzabili"
ITEM "20|Operazioni non imponibili (comma 1, artt.8, 8bis e 9)"
ITEM "21|Operazioni non imponibili a seguito di dich. d'intento"
ITEM "22|Altre operazioni non imponibili"
@ -201,6 +207,7 @@ BEGIN
ITEM "36|Cessione di microprocessori"
ITEM "37|Prestazioni comparto edile e settori connessi"
ITEM "38|Operazioni settore energetico"
ITEM "39|Reverse charge altri casi"
ITEM "B1|Ammontare op. es. escluse da nr. 1 a 9 e 11 art. 10"
ITEM "B2|Ammontare op. es. di cui al nr. 11 art. 10"
ITEM "B3|Ammontare op. es. di cui ai nr. 1 a 9 art. 10"

Binary file not shown.

View File

@ -16,4 +16,14 @@
#define O_COMUNENAS 113
#define O_DENCOMNAS 114
#define O_STATOPAIV 115
#define O_REFERENTE 116
#define O_BYMAIL 117
#define O_MAIL 118
#define O_DOCMAIL 119
#define O_PEC 120
#define O_PTEL 121
#define O_TEL 122
#define O_PTEL2 123
#define O_TEL2 124
#define O_PTEL3 125
#define O_TEL3 126

View File

@ -200,6 +200,99 @@ BEGIN
//CHECKTYPE NORMAL
END
STRING O_REFERENTE 50
BEGIN
PROMPT 2 14 "Referente "
FIELD REFERENTE
END
TEXT DLG_NULL
BEGIN
PROMPT 2 15 "E-Mail"
END
STRING O_MAIL 50 25
BEGIN
PROMPT 2 16 "Normale "
FIELD MAIL
END
BOOLEAN O_BYMAIL
BEGIN
PROMPT 40 16 "Consenso spedizione doc tramite email"
FIELD BYMAIL
MESSAGE FALSE CLEAR,O_DOCMAIL
MESSAGE TRUE ENABLE,O_DOCMAIL
END
STRING O_DOCMAIL 50 25
BEGIN
PROMPT 2 17 "Documenti "
FIELD DOCMAIL
CHECKTYPE REQUIRED
END
STRING O_PEC 80 45
BEGIN
PROMPT 2 18 "Pec "
FIELD PEC
END
STRING O_PTEL 5
BEGIN
PROMPT 2 19 "Telefono "
FIELD PTEL
HELP "Prefisso telefonico primo recapito"
END
STRING O_TEL 20 15
BEGIN
PROMPT 18 19 "/"
FIELD TEL
HELP "Numero telefonico primo recapito"
END
STRING O_PTEL2 5
BEGIN
PROMPT 11 20 " "
FIELD PTEL2
HELP "Prefisso telefonico secondo recapito"
END
STRING O_TEL2 20 15
BEGIN
PROMPT 18 20 "/"
FIELD TEL2
HELP "Numero telefonico secondo recapito"
END
STRING O_PTEL3 5
BEGIN
PROMPT 11 21 " "
FIELD PTEL3
HELP "Prefisso telefonico terzo recapito"
END
STRING O_TEL3 20 15
BEGIN
PROMPT 18 21 "/"
FIELD TEL3
HELP "Numero telefonico terzo recapito"
END
STRING DLG_NULL 50 32
BEGIN
PROMPT 1 -1 "Ultimo aggiornamento "
FLAGS "D"
FIELD UTENTE
END
DATE DLG_NULL
BEGIN
PROMPT 60 -1 ""
FLAGS "D"
FIELD DATAAGG
END
ENDPAGE
ENDMASK

View File

@ -988,7 +988,7 @@ void TPrimanota_application::init_insert_mode(TMask& m)
const TString4 codreg = reg.name();
const int regyear = reg.year();
reg.force_read(codreg, regyear);
//reg.force_read(codreg, regyear);
const long protiva = reg.protocol() + 1;
m.set(F_PROTIVA, protiva, true); // Aggiorna protocollo IVA
@ -1911,7 +1911,7 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
_automatico->_numdoc.cut(0);
TRegistro & cr = (TRegistro &) cached_registro(causreg.codice_registro());
cr.reread();
// cr.reread();
_automatico->_numdoc << cr.protocol() + 1;
}
else

View File

@ -68,7 +68,8 @@ class TListaMov_application : public TPrintapp
int _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, _scelta_stampa, _nr, _n;
int _numero_riga, _alleg, _scelta_stampa, _nr, _n;
tiporeg _tiporegistro;
int _provvis;
liste _tipo_lista;
word _flags;
@ -481,11 +482,11 @@ bool TListaMov_application::filter_func_fatture (const TRelation* rel)
const int ann_reg = mov.get_int(MOV_ANNOIVA);
const TString4 cod_reg = mov.get(MOV_REG);
const int tipo_reg = tipo_registro(cod_reg, ann_reg);
const tiporeg tipo_reg = cached_registro(cod_reg, ann_reg).tipo_registro();
// Considera solo iva acquisti o vendite
if (tipo_reg != 1 && tipo_reg != 2)
return FALSE;
if (tipo_reg != vendita && tipo_reg != acquisto)
return false;
if (app()._annoes > 0) //anno esercizio specificato nella maschera
{
@ -536,8 +537,10 @@ bool TListaMov_application::filter_func (const TRelation * rel)
{
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)
const tiporeg tipo_reg = cached_registro(cod_reg, ann_reg).tipo_registro();
// Considera solo iva acquisti o vendite
if (tipo_reg != vendita && tipo_reg != acquisto)
return false;
}
@ -626,9 +629,10 @@ void TListaMov_application::stampa_errori_rmov()
else set_row(_nr++, FR("@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'))
const TRegistro & reg = cached_registro(_registro, _ae);
const tiporeg tipo = reg.tipo_registro();
if ((tipo == vendita && t != 'C') || (tipo == acquisto && t != 'F'))
set_row(_nr++, FR("@11gTipo C/F non compatibile con tipo registro"));
}
}
@ -715,14 +719,14 @@ void TListaMov_application::stampa_errori_iva(int* nr, const TRigaiva& riva)
const int tipocr = riva._tipocr;
if (tipodet == 1 || tipodet == 3 || tipodet == 5 || tipodet == 9)
if (_tiporegistro != 2)
if (_tiporegistro != acquisto)
set_row(++(*nr), FR("@11gCodice di indetraibilita' errato"));
if (_tiporegistro == 1)
if (_tiporegistro == vendita)
if (tipocr != 0 && tipocr != 1 && tipocr != 4 && tipocr != 9)
set_row(++(*nr), FR("@11gTipo costo/ricavo non valido"));
if (_tiporegistro == 2)
if (_tiporegistro == acquisto)
if (tipocr != 0 && tipocr != 1 && tipocr != 2 && tipocr != 3 && tipocr != 5 && tipocr != 8 && tipocr != 9)
set_row(++(*nr), FR("@11gTipo costo/ricavo non valido"));
}
@ -782,11 +786,11 @@ 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 = tipo_registro(reg, anno);
const tiporeg tipo = cached_registro(reg, anno).tipo_registro();
TEsercizi_contabili esc;
esc.date2esc(data); // qui verificare
if ( (tipo == 1) || (tipo == 2) )
if ( (tipo == vendita) || (tipo == acquisto) )
{
set_row (_n, FR("@103greg @3s"),FLD(LF_MOV,MOV_REG));
set_row (_n, FR("@111gpr @5n"),FLD(LF_MOV,MOV_PROTIVA));
@ -860,7 +864,8 @@ bool TListaMov_application::preprocess_page(int file,int counter)
_codcf = curmov.get_long(MOV_CODCF);
_numero = curmov.get_long(MOV_NUMREG);
_codval = curmov.get(MOV_CODVALI);
_tiporegistro = tipo_registro(_registro, _anno);
_tiporegistro = cached_registro(_registro, _anno).tipo_registro();
_causale_gia_stampata = FALSE;
TEsercizi_contabili esc;
@ -987,11 +992,9 @@ bool TListaMov_application::preprocess_page(int file,int counter)
_descr_causale = caus.get(CAU_DESCR);
_alleg_causale = caus.get_bool(CAU_ALLEG);
_tipodocumento = caus.get(CAU_TIPODOC);
_tiporegistro = tipo_registro (_registro, _anno);
if ((_tiporegistro != 1)&&(_tiporegistro != 2))//se si tratta di un movimento di sola prima nota
return TRUE;
_tiporegistro = cached_registro(_registro, _anno).tipo_registro();
if ((_tiporegistro != vendita) && (_tiporegistro != acquisto))//se si tratta di un movimento di sola prima nota
return true;
}
}
else if (file == LF_RMOV)
@ -1038,10 +1041,10 @@ bool TListaMov_application::preprocess_page(int file,int counter)
_numr = curmov.get_long(MOV_NUMREG);
_tipo_elenco = curmov.get(MOV_TIPO);
_codcf = curmov.get_long(MOV_CODCF);
const int tiporeg = tipo_registro (codreg, anno);
const TString8 attreg = AttivitaRegistro (codreg, anno);
const tiporeg tiporeg = cached_registro(codreg, anno).tipo_registro();
const TString8 attreg = cached_registro(codreg, anno).attivita();
if (tiporeg == 1 || tiporeg == 2)//se si tratta di un movimento iva
if (tiporeg == vendita || tiporeg == acquisto)//se si tratta di un movimento iva
{
_tipoatt = TipoAttivita(attreg, get_firm());
_tipo_elenco = curmov.get(MOV_TIPO);
@ -1870,18 +1873,18 @@ bool TListaMov_application::segnala_errori_iva()
return true;
}
if (tipodet == 1 || tipodet == 3 || tipodet == 5 || tipodet == 9)
if (_tiporegistro != 2)
if (_tiporegistro != acquisto)
{
rmoviva.readat(nrec);
return true;
}
if (_tiporegistro == 1)
if (_tiporegistro == vendita)
if (tipocr != 0 && tipocr != 1 && tipocr != 4 && tipocr != 9)
{
rmoviva.readat(nrec);
return true;
}
if (_tiporegistro == 2)
if (_tiporegistro == acquisto)
if (tipocr != 0 && tipocr != 1 && tipocr != 2 && tipocr != 3 && tipocr != 5 && tipocr != 8 && tipocr != 9)
{
rmoviva.readat(nrec);

View File

@ -25,6 +25,7 @@
#include "cg3.h"
#include "cg3300.h"
#include "cglib.h"
#include "cg3300a.h"
#include "cg3300b.h"
@ -469,18 +470,19 @@ void TStampa_allegati::ricalcola(int anno_dic)
{
pi.addstatus(1);
const int tiporeg = reg.get_int("I0");
if ((tiporeg != 2) && (tiporeg != 1))
const tiporeg tipo = cached_registro(reg).tipo_registro();
if ((tipo != acquisto) && (tipo != vendita))
continue;
if (tiporeg == 1)
if (tiporeg == vendita)
{
bool sosp = reg.get_bool ("B0");
if (sosp) continue;
vendite = TRUE;
if (cached_registro(reg).sospeso())
continue;
vendite = true;
}
else
vendite = FALSE;
vendite = false;
tipodoc = cau.get (CAU_TIPODOC);
if (corrispettivo (tipodoc))

View File

@ -84,7 +84,6 @@ class TLista_fatture : public TPrintapp
protected:
long select_firm_range(long from, long to);
int tiporeg(const TString& );
static bool mix_handler(TMask_field&, KEY);
static bool date_handler(TMask_field&, KEY);
static bool to_ditt_handler(TMask_field&, KEY);
@ -117,12 +116,6 @@ public:
inline TLista_fatture& app() { return (TLista_fatture&) main_app(); }
int TLista_fatture::tiporeg(const TString& reg)
{
TString8 s; s.format("%4d%-3s",_date_from.year(),(const char*)reg);
return atoi(cache().get("REG", s, "I0"));
}
bool TLista_fatture::filter_func1(const TRelation *r)
{
TLista_fatture& a = app();
@ -144,8 +137,8 @@ bool TLista_fatture::filter_func1(const TRelation *r)
if (riv.get(RMI_TIPODET).blank() || percind.is_zero())
return false;
const int tiporeg = a.tiporeg(rg);
if (tiporeg != 2)
const tiporeg tipo = cached_registro(rg).tipo_registro();
if (tipo != acquisto)
return false;
}
else // Tipo costo/ricavo
@ -443,8 +436,9 @@ bool TLista_fatture::preprocess_page(int file, int counter)
if (_tipo == intra)
{
TString4 codiva = rec.get(RMI_CODIVA);
const int tipomov = tiporeg(mov.get(MOV_REG));
if (tipomov == 2 && tipodet == 9)
const tiporeg tipomov = cached_registro(mov.get(MOV_REG)).tipo_registro();
if (tipomov == acquisto && tipodet == 9)
codiva = "~A19"; // Speciale per acquisti indeducibili art. 19
const bool is_key = _intra_items.is_key(codiva); // Esiste l'elemento ?
// Se si' allora prendi quello, altrimenti prendine uno nuovo
@ -469,8 +463,10 @@ bool TLista_fatture::preprocess_page(int file, int counter)
_tot_iva += iva;
_tp_imp += imp;
_tp_iva += iva;
const int tipomov = tiporeg(mov.get(MOV_REG));
if (_tipo == indetraibile && tipomov == 2 && tipodet > 0)
const tiporeg tipomov = cached_registro(mov.get(MOV_REG)).tipo_registro();
if (_tipo == indetraibile && tipomov == acquisto && tipodet > 0)
{
TString4 codiva = rec.get(RMI_CODIVA);
_Iva_item * iva_row = (_Iva_item *) _indetr.objptr(codiva);

View File

@ -24,7 +24,7 @@
#include <saldi.h>
#include <causali.h>
#include "cglib02.h"
#include "cglib.h"
struct therec
{
@ -89,7 +89,7 @@ bool CG4100_App::sort_sal()
sal.set_anno_es(year);
sal.clear_saldi(year);
long numreg = 0L;
tiposal tsal = normale;
tiposal tsal = saldo_normale;
char provvis;
TDate datareg;
@ -127,20 +127,11 @@ bool CG4100_App::sort_sal()
mov.put(MOV_NUMREG, numreg);
mov.read();
CHECK(mov.good(),"Archivi movimenti e righe inconsistenti");
// Tipo saldo normale per default
tsal = normale;
const TString& codcaus = mov.get(MOV_CODCAUS);
const TRectype& causale = cache().get(LF_CAUSALI, codcaus);
if (!causale.empty())
{
const char ac = causale.get_char(CAU_MOVAP);
if (ac == 'A')
tsal = apertura; else
if (ac == 'C')
tsal = chiusura;
}
tsal = saldo_normale; // Tipo saldo normale per default
if(codcaus.full())
tsal = cached_causale(codcaus, year).tipo_saldo();
scaricato = mov.get_bool(MOV_SCARCON);
provvis = mov.get_char(MOV_PROVVIS);
datareg = mov.get_date(MOV_DATAREG);

View File

@ -208,7 +208,6 @@ bool TLiquidazione_app::user_create()
_lam = new TTable("LAM");
_pla = new TTable("%PLA");
_reg = new TTable("REG");
_iva = new TTable("%IVA");
_del = new TTable("%DEL");
_mov = &_cur->file(LF_MOV);
@ -225,7 +224,6 @@ bool TLiquidazione_app::user_create()
_pum_r = &(_pum->curr());
_pam_r = &(_pam->curr());
_pom_r = &(_pom->curr());
_iva_r = &(_iva->curr());
_del_r = &(_del->curr());
_lam_r = &(_lam->curr());
_pla_r = &(_pla->curr());

View File

@ -338,7 +338,6 @@ class TLiquidazione_app : public TPrint_application
TTable* _pla;
TTable* _ppa;
TTable* _reg;
TTable* _iva;
TTable* _del;
// a reference rectype per file/table
@ -346,7 +345,6 @@ class TLiquidazione_app : public TPrint_application
TRectype* _rmoviva_r;
TRectype* _pcon_1_r;
TRectype* _pcon_2_r;
TRectype* _iva_r;
TRectype* _pim_r;
TRectype* _pis_r;
TRectype* _prm_r;
@ -622,7 +620,7 @@ public:
bool look_pla(const char* a, bool create = false);
bool look_ppa(int m, const char* a, int t, bool create = false);
bool look_del(int month, int type, bool create = false);
bool look_iva(const char* cod);
// bool look_iva(const char* cod);
bool look_reg(const char* reg);
const TRectype & get_lia(long ditta = 0l, bool create = false, int anno = 0);
const int put_lia(const TRectype & lia, bool re = true);

View File

@ -554,8 +554,7 @@ bool TLiquidazione_app::look_pla(const char* a, bool create)
(*_pla_codatt) = buf;
const TString16 s = _pla_r->get("CODTAB");
const int err = _pla->read();
bool ok = err == NOERR;
bool ok = _pla->read() == NOERR;
if (!ok && create)
{
_pla->zero();
@ -584,6 +583,7 @@ bool TLiquidazione_app::look_reg(const char* reg)
return rt;
}
/*
bool TLiquidazione_app::look_iva(const char* cod)
{
bool rt = true;
@ -604,6 +604,7 @@ bool TLiquidazione_app::look_iva(const char* cod)
return rt;
}
*/
bool TLiquidazione_app::look_ppa(int month, const char* codatt, int type, bool create)
{
@ -982,8 +983,10 @@ real TLiquidazione_app::aliquota_agvia()
{
real r;
const TString& codagv = ini_get_string(CONFIG_STUDIO, "cg", "CodAgv");
if (codagv.full() && look_iva(codagv)) // Controlla se è vuoto! CM600475
r = _iva->get_real("R0");
const TCodiceIVA & civa = cached_codIVA(codagv);
if (civa.ok()) // Controlla se è vuoto! CM600475
r = civa.percentuale();
return r;
}

View File

@ -95,10 +95,13 @@ void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt)
vaf += imponibile;
_pam->put("R1", vaf);
_pam->rewrite();
// Aggiorna il totale IVA periodica CD1_1
if (month == 13 && look_iva(ci->_codiva))
const TCodiceIVA & civa = cached_codIVA(ci->_codiva);
if (month == 13 && civa.ok())
{
if (_iva->get("S10").not_empty()) // Solo CD1_1 ha senso coi corrispettivi...
if (civa.tipo_comunicazione_attive().full()) // Solo CD1_1 ha senso coi corrispettivi...
{
_pum->curr().add("R14", imponibile); // CD1_1
_pum->rewrite();
@ -142,12 +145,11 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
int tipocr = atoi(*_pim_tipocr);
int mese = atoi(*_pim_mese);
int tipodet = atoi(*_pim_tipodet);
look_iva(*_pim_codiva);
const TCodiceIVA & civa = cached_codIVA(*_pim_codiva);
// base di riparto solo se non esente, non soggetto, non imponibile
TString16 tipoiva(_iva->get("S1"));
TString16 tipoiva(civa.tipo());
TString16 reg = *_pim_codreg;
/*
* caso particolare SENSU Vladimiro (1995) #MI3001
* questi vengono pero' conteggiati nel totale
@ -161,18 +163,15 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
if (tipocr == 1 && (mese == m) &&
att == (const char*)(*_pim_codatt))
{
if (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES")
if (civa.iva_da_ventilare())
{
real lurd = _pim->get_real("R0");
lurd += _pim->get_real("R1");
real perc = _iva->get_real("R0");
TString other = _iva->get("S6");
if (!other.empty())
{
// ventila a un altro codice
look_iva(other);
perc = _iva->get_real("R0");
}
real perc = civa.percentuale();
TString other = civa.iva_a_cui_ventilare();
if (other.full())
perc = cached_codIVA(other).percentuale(); // ventila a un altro codice
add_ventilation(perc / CENTO, lurd, *_pim_codiva, other);
}
}
@ -341,9 +340,11 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
_pam->rewrite();
// Aggiorna il totale IVA periodica CD1_1
if (month == 13 && look_iva(vv->_codiva))
const TCodiceIVA & civa = cached_codIVA(vv->_codiva);
if (month == 13 && civa.ok())
{
if (_iva->get("S10").not_empty()) // Solo CD1_1 ha senso coi corrispettivi
if (civa.get("S10").full()) // Solo CD1_1 ha senso coi corrispettivi
{
_pum->curr().add("R14", imponibile); // CD1_1
_pum->rewrite();
@ -364,9 +365,10 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
// viene amorosamente messo a quanto il codice IVA prevede
if (!was)
{
look_iva(vv->_codiva);
const TCodiceIVA & civa = cached_codIVA((vv->_codiva));
_pim->put("I1", (long)vendita);
if (!_iva->get_bool("B4"))
if (!civa.escluso_dal_rimborso())
_pim->put("B3", "X");
}
_pim->rewrite();
@ -533,8 +535,8 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts,
if (!_pim->get_bool("B3")) continue;
// Se il tipo di codice e' NS non va considerato nella sommatoria del tot. acquisti
look_iva(codiva);
const bool non_sogg = _iva->get("S1") == "NS";
const TCodiceIVA & civa = cached_codIVA(codiva);
const bool non_sogg = civa.iva_non_soggetta();
if (!is_mens) // Trimestrali
{
@ -565,7 +567,7 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts,
ca._totale += _pim->get_real("R3");
if (!is_key) // se non c'e' lo aggiunge
{
ca._aliquota = _iva->get_real("R0")/CENTO; // Se e' nuovo setta l'aliquota
ca._aliquota = civa.moltiplicatore_percentuale(); // Se e' nuovo setta l'aliquota
corr_ann.add(codiva,ca);
}
}

View File

@ -286,7 +286,7 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
continue;
look_reg(*_pim_codreg);
look_iva(*_pim_codiva);
const TCodiceIVA & civa = cached_codIVA(*_pim_codiva);
int tipocr = atoi(*_pim_tipocr);
int tipodet = atoi(*_pim_tipodet);
@ -295,7 +295,7 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
real imponibile = _pim->get_real("R0");
real imposta = _pim->get_real("R1");
tiporeg tipomov = (tiporeg)_reg->get_long("I0");
TString4 tipoiva = _iva->get("S1");
TString4 tipoiva = civa.tipo();
if (_year != *_pim_anno || (month == 13 && mese < 13))
continue;
@ -564,28 +564,19 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
continue;
TString4 codiva = codtab.mid(16,4); codiva.trim();
if (!look_iva(codiva))
const TCodiceIVA & civa = cached_codIVA(codiva);
if (!civa.ok())
continue;
tiporeg tipomov = (tiporeg)_reg->get_int("I0");
bool corrisp = _reg->get_bool("B0");
const TString4 tipoiva = _iva->get("S1");
const TString4 tipoiva = civa.tipo();
const TString4 other = tab->get("S4");
TToken_string s1(tab->get("S1"), '!'); // Imponibile/iva fatture in ritardo
real rit_imp(s1.get(0));
real rit_iva(s1.get(1));
/* Perchè _pim invece di tab ? 17-10-2012
diffimp = _pim->get_real("R26");
diffiva = _pim->get_real("R27");
diffincimp = _pim->get_real("R28");
diffinciva = _pim->get_real("R29");
diffimp_acq = _pim->get_real("R30");
diffiva_acq = _pim->get_real("R31");
diffincimp_acq = _pim->get_real("R32");
diffinciva_acq = _pim->get_real("R33"); */
diffimp = tab->get_real("R26");
diffiva = tab->get_real("R27");
diffincimp = tab->get_real("R28");
@ -603,10 +594,10 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
issosp |= (sosp_imp != nessuna_sospensione); // Setta il flag di presenza registri in sospensione (qualsiasi tipo: sospensione_normale, vol_affari, liquidazione)
// ACHTUNG! Corrispettivi da ventileer possono ventilare ad un altro codiva; in tal caso si scrive quello
if (corrisp && other.full())
{
look_iva(other);
codiva = other;
}
const TCodiceIVA & civa1 = cached_codIVA(codiva); // codice IVA aggiornato per eventuale ventilazione
// se e' corrispettivo da ventilare non scrivo un cannolo ripieno visto che e' stato ventilato
if (tipomov == vendita && tipoiva == "VE" && !describe_pis)
continue;
@ -713,7 +704,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
ca._totale_vf += tab->get_real(tipoiva == "VE" ? "R2" : "R3");
if (!is_key) // se non c'e' lo aggiunge
{
ca._aliquota = _iva->get_real("R0")/CENTO; // Se e' nuovo setta l'aliquota
ca._aliquota = civa.moltiplicatore_percentuale(); // Se e' nuovo setta l'aliquota
corr_ann.add(codiva,ca);
}
// vedi corrispettivi veri e falsi
@ -1804,8 +1795,9 @@ void TLiquidazione_app::set_pim(_DescrItem& d)
rw++;
else
{
look_iva(d._s1);
d._s2 = _iva->get("S0");
const TCodiceIVA & civa = cached_codIVA(d._s1);
d._s2 = civa.get("S0");
if (d._s2.len() > 19) d._s2.cut(19);
}
@ -2934,8 +2926,9 @@ void TLiquidazione_app::set_ventila(_DescrItem& d)
for(i = 0; i < d._arr.items(); i++)
{
_vDesc& vd = (_vDesc&)d._arr[i];
look_iva(vd._codiva);
s0 = _iva->get("S0"); s0.cut(23);
const TCodiceIVA & civa = cached_codIVA(vd._codiva);
s0 = civa.descrizione(); s0.cut(23);
set_row(row+i,"@8g%5s@17g%-23s@41g%r@68g%r@89g%r",
(const char*)vd._codiva,
@ -3065,13 +3058,15 @@ void TLiquidazione_app::set_regagr(_DescrItem& d)
_DescrItem& di = (_DescrItem&) agr_array[i];
if (di._flags != PROGAGR)
continue;
look_iva(di._s0);
des = _iva->get("S0"); des.cut(25);
al = _iva->get_real("R0");
const TCodiceIVA & civa = cached_codIVA(di._s0);
des = civa.descrizione(); des.cut(25);
al = civa.percentuale();
set_row(r,"%4s %-25s@48g%s %%", (const char*) di._s0, (const char*) des, al.string("#@,@@"));
set_row(r,"@56g%r@75g%4s",&di._r0, (const char*)di._s1);
look_iva(di._s1);
al = _iva->get_real("R0");
const TCodiceIVA & civa1 = cached_codIVA(di._s1);
al = civa1.percentuale();
set_row(r++,"@92g%s %%@100g%r", al.string("#@,@@"), &di._r1);
t1 += di._r0;
t2 += di._r1;

View File

@ -120,7 +120,7 @@ void TQuadro_VE_recordset::load()
const int int_tipo_iva11_ven = atoi(tipo_iva11_ven);
const bool non_imponibile = (tipo_aliquota == "NI");
const bool esente = (tipo_aliquota == "ES");
const bool reverse = int_tipo_iva11_ven >= 31 && int_tipo_iva11_ven <= 38;
const bool reverse = (int_tipo_iva11_ven >= 31 && int_tipo_iva11_ven <= 39) || (tipo_iva11_ven == "G7A");
const bool terremotati = int_tipo_iva11_ven == 25;
TToken_string codatt;
codatt.add(prefix().get_codditta());
@ -172,7 +172,7 @@ void TQuadro_VE_recordset::load()
if (tipocr == 4)
{
if (int_tipo_iva11_ven == acq_ind_pass_int || int_tipo_iva11_ven == cess_amm)
if (reverse || int_tipo_iva11_ven == acq_ind_pass_int || int_tipo_iva11_ven == cess_amm)
add_value("VE40.1", imp);
}
}

View File

@ -286,9 +286,9 @@ void TQuadro_VF_recordset::load()
}
if (non_soggetto)
{
if (tipo_iva11_acq == "15A" || int_tipo_iva11_acq == 15)
if (int_tipo_iva11_acq == 15)
{
if (tipo_iva11_acq == "15A")
if (tipo_iva11_acq == "15B")
add_value("VF17.2", imp);
add_value("VF17.1", imp);
}
@ -350,7 +350,7 @@ void TQuadro_VF_recordset::load()
key = codiva;
tipo_aliquota = cache().get("%IVA", key, "S1");
if (tipo_aliquota.blank() && datapag <= a_datareg && tipoiva == 2) // Acquists
if (tipo_aliquota.blank() && datapag <= a_datareg && tipoiva == 2) // Acquisti
{
imp211 += imp;
if (tipodiff == 2)

View File

@ -5,7 +5,7 @@
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Head" level="" hidden="" page_break="" can_break="" pattern="1" />
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Head" level="1" hidden="" page_break="" can_break="" pattern="1" />
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Body" level="" hidden="" page_break="" can_break="" pattern="1">
<field deactivated="" type="Immagine" hidden="" link="" dynamic_height="" shade_offset="" width="83" codval="" height="72" id="" pattern="1" hide_zero="" text="">
<field deactivated="" type="Immagine" hidden="" image_resize_type="" link="" dynamic_height="" shade_offset="" width="83" codval="" height="72" id="" pattern="1" hide_zero="" text="">
<source>"cg7700a.png"</source>
</field>
</section>
@ -142,7 +142,7 @@
<source>VF22.1</source>
</field>
<field x="51" y="40" deactivated="" type="Numero" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="11" codval="" id="2301" pattern="1" hide_zero="" text="###.###.###">
<source>#101+#201+#301+#401+#501+#601+#701+#801+#901+#1001+#1101+#1201+#1301+#1401+#1501+#1601+#1701+#1801+#1901+#2001+#2101-#2201</source>
<source>#101+#201+#301+#401+#501+#601+#701+#801+#901+#1001+#1101+#1201+#1301+#1401+#1501+#1601+#1602+#1701+#1801+#1901+#2001+#2101-#2201</source>
</field>
<field x="65" y="40" deactivated="" type="Numero" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="11" codval="" id="2302" pattern="1" hide_zero="" text="###.###.###">
<source>#102+#202+#302+#402+#502+#602+#702+#802+#902+#1002+#1102+#1202+#1302+#1402</source>

View File

@ -371,6 +371,7 @@ void TCausale::calcIVA()
if (td.full())
{
const TRectype& tpd = cache().get("%TPD", td);
if (!tpd.empty())
{
i = (TipoIVA) tpd.get_int("I0"); // IVA acquisti, vendite, generica
@ -450,35 +451,36 @@ bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const
///////////////////////////////////////////////////////////
// TCache_causali
///////////////////////////////////////////////////////////
class TCache_causale : public TCache
class TCache_causale : public TFile_cache
{
int _year;
protected:
virtual TObject* key2obj(const char* key);
virtual TObject* rec2obj(const TRectype & rec) const;
public:
const TCausale & caus(const char* key, const int anno = 0);
const TCausale & caus(const char* cod, const int anno = 0);
TCache_causale() : TCache() { }
TCache_causale() : TFile_cache(LF_CAUSALI), _year(0) { }
virtual ~TCache_causale() { }
};
TObject* TCache_causale::key2obj(const char* key)
TObject* TCache_causale::rec2obj(const TRectype & rec) const
{
TToken_string k(key);
TString4 cod;
k.get(0, cod);
TString4 cod = rec.get(CAU_CODCAUS);
cod.trim();
int year; k.get(1, year);
return new TCausale(cod, year);
return new TCausale(cod, _year);
}
const TCausale & TCache_causale::caus(const char* key, const int anno)
const TCausale & TCache_causale::caus(const char* cod, const int anno)
{
TToken_string k;
TToken_string key;
k.add(key);
k.add(anno, 1);
return (const TCausale &)*objptr(k);
key.add(cod);
key.add(anno, 1);
_year = anno;
return (const TCausale &)query(key);
}
const TCausale & cached_causale(const char * codcaus, int year)
@ -1063,37 +1065,40 @@ bool TRegistro::update(long protiva, const TDate& datareg)
///////////////////////////////////////////////////////////
// TCache_registri
///////////////////////////////////////////////////////////
class TCache_registri : public TCache
class TCache_registri : public TFile_cache
{
protected:
virtual TObject* key2obj(const char* key);
virtual TObject* rec2obj(const TRectype& rec) const;
public:
const TRegistro & registro(const char* key, const int anno = 0);
const TRegistro & registro(const char* cod, const int anno = 0);
TCache_registri() : TCache() { }
TCache_registri() : TFile_cache("REG") { }
virtual ~TCache_registri() { }
};
TObject* TCache_registri::key2obj(const char* key)
TObject* TCache_registri::rec2obj(const TRectype& rec) const
{
TToken_string k(key);
TString16 cod;
TString k = rec.get("CODTAB");
k.get(0, cod);
cod.trim();
int year;
k.get(1, year);
return new TRegistro(cod, year);
return new TRegistro(k.mid(4), atoi(k.left(4)));
}
const TRegistro & TCache_registri::registro(const char* key, const int anno)
const TRegistro & TCache_registri::registro(const char* cod, const int anno)
{
TToken_string k(key);
k.add(anno);
return (const TRegistro &)*objptr(k);
TToken_string key("REG");
int year = anno;
if (year == 0)
year = ini_get_int(CONFIG_DITTA, "cg", "AnLiIv");
TString16 codtab;
codtab << format("%04d", year) << cod;
key.add(codtab);
return (const TRegistro &)query(key);
}
const TRegistro & cached_registro(const char * codreg, int year)
@ -1234,20 +1239,27 @@ bool TCodiceIVA::reverse_charge_pubb() const
} */
///////////////////////////////////////////////////////////
// TCache_clifor
// TCache_codIVA
///////////////////////////////////////////////////////////
class TCache_codIVA : public TCache
class TCache_codIVA : public TFile_cache
{
protected:
virtual TObject* key2obj(const char* key) { return new TCodiceIVA(key); }
virtual TObject* rec2obj(const TRectype & rec) const { return new TCodiceIVA(rec.get("CODTAB")); }
public:
const TCodiceIVA & codIVA(const char * codice) { return (const TCodiceIVA &)*objptr(codice); }
TCache_codIVA() : TCache() { }
const TCodiceIVA & codIVA(const char * codice);
TCache_codIVA() : TFile_cache("%IVA") { }
virtual ~TCache_codIVA() { }
};
const TCodiceIVA & TCache_codIVA::codIVA(const char * codice)
{
TToken_string key("IVA");
key.add(codice);
return (const TCodiceIVA &)query(key);
}
const TCodiceIVA & cached_codIVA(const char * codiva)
{
HIDDEN TCache_codIVA __cache_codIVA;
@ -2035,7 +2047,7 @@ int TMovimentoPN::registra(bool re, bool force)
{
TTable tab("%DET");
tab.curr() = det;
tab.curr().put("FPC", "X");
tab.curr().put("FPC", true);
tab.rewrite();
}
}

View File

@ -917,9 +917,9 @@ void TSaldo_agg::clear_saldi(int year)
}
else
{
saldi.put(SLD_FLSCA, "");
saldi.put(SLD_FLSCA, false);
saldi.write();
saldi.put(SLD_FLSCA, "X");
saldi.put(SLD_FLSCA, true);
saldi.read(_isequal,_unlock);
}
}

View File

@ -210,7 +210,7 @@ int TMovimento_contabile::write_rewrite(TBaseisamfile& f, bool re) const
{
TTable tab("%DET");
tab.curr() = det;
tab.curr().put("FPC", "X");
tab.curr().put("FPC", true);
tab.rewrite();
}
}

View File

@ -593,34 +593,32 @@ bool TAnagrafica::init(char tipocf, long codice, const TString& ocfpi)
///////////////////////////////////////////////////////////
// TCache_clifor
///////////////////////////////////////////////////////////
class TCache_clifor : public TCache
class TCache_clifor : public TFile_cache
{
protected:
virtual TObject* key2obj(const char* key);
virtual TObject* rec2obj(const TRectype & rec) const ;
public:
const TCli_for & clifor(const char tipo, const long codice);
TCache_clifor() : TCache() { }
TCache_clifor() : TFile_cache(LF_CLIFO) { }
virtual ~TCache_clifor() { }
};
TObject* TCache_clifor::key2obj(const char* key)
TObject* TCache_clifor::rec2obj(const TRectype & rec) const
{
TToken_string k(key);
TString4 tipo;
long codice;
const char tipo = rec.get_char(CLI_TIPOCF);
long codice = rec.get_long(CLI_CODCF);
k.get(0, tipo);
k.get(1, codice);
return new TCli_for(tipo[0], codice);
return new TCli_for(tipo, codice);
}
const TCli_for & TCache_clifor::clifor(const char tipo, const long codice)
{
TToken_string k; k << tipo;
k.add(codice);
return (const TCli_for &)*objptr(k);
return (const TCli_for &)query(k);
}
const TCli_for & cached_clifor(const char tipo, long codice)

4
src/cg/dir18.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<FileDesc>
<DirInfo Name="$occas" File="18" EOD="4" EOX="4" Des="Clienti occasionali" Com="" Flags="" Len="607" />
</FileDesc>

View File

@ -1,3 +1,3 @@
18
0
$occas|0|0|216|0|Clienti occasionali|||
$occas|5|5|607|0|Clienti occasionali|||

View File

@ -1,11 +1,11 @@
18
15
28
CFPI|1|16|0|Codice progressivo, codice fiscale, o partita IVA
RAGSOC|1|50|0|Ragione sociale
INDIR|1|50|0|Indirizzo
CIV|1|6|0|Numero civico
STATO|1|3|0|Codice stato
LOCALITA|1|35|0|Localita
LOCALITA|1|35|0|Località
COM|1|4|0|Codice comune
CAP|1|5|0|CAP
SESSO|1|1|0|Sesso
@ -15,6 +15,19 @@ COMNASC|1|4|0|Codice comune di nascita
COFI|1|16|0|Codice fiscale
STATOPAIV|1|2|0|Stato CEE
PAIV|1|12|0|Partita IVA
REFERENTE|1|50|0|referente
BYMAIL|8|1|0|Consenso all'invio documenti per email
MAIL|1|50|0|e-mail
DOCMAIL|1|50|0|e-mail invio documenti
PEC|1|80|0|PEC
PTEL|1|10|0|Prefisso telefono 1
TEL|1|30|0|Telefono 1
PTEL2|1|10|0|Prefisso telefono 2
TEL2|1|30|0|Telefono 2
PTEL3|1|10|0|Prefisso telefono 3
TEL3|1|30|0|Telefono 3
UTENTE|1|32|0|Utente
DATAAGG|5|8|0|Data aggiornamento
2
CFPI|
RAGSOC|X

39
src/cg/trc18.xml Normal file
View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" ?>
<RecDesc>
<TrcInfo TabCode="" Lenght="607" File="18">
<Fields NFields="28">
<Field0001 Description="Codice progressivo, codice fiscale, o partita IVA" Name="CFPI" Decimals="" Offset="1" Lenght="16" Type="1" />
<Field0002 Description="Ragione sociale" Name="RAGSOC" Decimals="" Offset="17" Lenght="50" Type="1" />
<Field0003 Description="Indirizzo" Name="INDIR" Decimals="" Offset="67" Lenght="50" Type="1" />
<Field0004 Description="Numero civico" Name="CIV" Decimals="" Offset="117" Lenght="6" Type="1" />
<Field0005 Description="Codice stato" Name="STATO" Decimals="" Offset="123" Lenght="3" Type="1" />
<Field0006 Description="Localit&#E0;" Name="LOCALITA" Decimals="" Offset="126" Lenght="35" Type="1" />
<Field0007 Description="Codice comune" Name="COM" Decimals="" Offset="161" Lenght="4" Type="1" />
<Field0008 Description="CAP" Name="CAP" Decimals="" Offset="165" Lenght="5" Type="1" />
<Field0009 Description="Sesso" Name="SESSO" Decimals="" Offset="170" Lenght="1" Type="1" />
<Field0010 Description="Data di nascita" Name="DNASC" Decimals="" Offset="171" Lenght="8" Type="5" />
<Field0011 Description="Codice stato di nascita" Name="STATONASC" Decimals="" Offset="179" Lenght="3" Type="1" />
<Field0012 Description="Codice comune di nascita" Name="COMNASC" Decimals="" Offset="182" Lenght="4" Type="1" />
<Field0013 Description="Codice fiscale" Name="COFI" Decimals="" Offset="186" Lenght="16" Type="1" />
<Field0014 Description="Stato CEE" Name="STATOPAIV" Decimals="" Offset="202" Lenght="2" Type="1" />
<Field0015 Description="Partita IVA" Name="PAIV" Decimals="" Offset="204" Lenght="12" Type="1" />
<Field0016 Description="referente" Name="REFERENTE" Decimals="" Offset="216" Lenght="50" Type="1" />
<Field0017 Description="Consenso all'invio documenti per email" Name="BYMAIL" Decimals="" Offset="266" Lenght="1" Type="8" />
<Field0018 Description="e-mail" Name="MAIL" Decimals="" Offset="267" Lenght="50" Type="1" />
<Field0019 Description="e-mail invio documenti" Name="DOCMAIL" Decimals="" Offset="317" Lenght="50" Type="1" />
<Field0020 Description="PEC" Name="PEC" Decimals="" Offset="367" Lenght="80" Type="1" />
<Field0021 Description="Prefisso telefono 1" Name="PTEL" Decimals="" Offset="447" Lenght="10" Type="1" />
<Field0022 Description="Telefono 1" Name="TEL" Decimals="" Offset="457" Lenght="30" Type="1" />
<Field0023 Description="Prefisso telefono 2" Name="PTEL2" Decimals="" Offset="487" Lenght="10" Type="1" />
<Field0024 Description="Telefono 2" Name="TEL2" Decimals="" Offset="497" Lenght="30" Type="1" />
<Field0025 Description="Prefisso telefono 3" Name="PTEL3" Decimals="" Offset="527" Lenght="10" Type="1" />
<Field0026 Description="Telefono 3" Name="TEL3" Decimals="" Offset="537" Lenght="30" Type="1" />
<Field0027 Description="Utente" Name="UTENTE" Decimals="" Offset="567" Lenght="32" Type="1" />
<Field0028 Description="Data aggiornamento" Name="DATAAGG" Decimals="" Offset="599" Lenght="8" Type="5" />
</Fields>
<Keys NKeys="2">
<Key0001 DuplicateKeys="" Expr="CFPI" />
<Key0002 DuplicateKeys="1" Expr="RAGSOC" />
</Keys>
</TrcInfo>
</RecDesc>