Correzioni agli invii e ricezioni
git-svn-id: svn://10.65.10.50/trunk@1421 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4b76c80d5f
commit
9241f8a5fa
@ -19,6 +19,9 @@ class TRic_sistema : public TApplication
|
||||
{
|
||||
TTable* _tab_tra;
|
||||
TTransfer_file* _tras_file;
|
||||
TLocalisamfile* _mov;
|
||||
TLocalisamfile* _rmov;
|
||||
TLocalisamfile* _rmoviva;
|
||||
|
||||
TString80 TEMP;
|
||||
|
||||
@ -30,8 +33,7 @@ class TRic_sistema : public TApplication
|
||||
long _dittainv,_dittainvp,_dittaric,_totrectras,_totrectrasp;
|
||||
TDate _datatras,_datatrasp,_dataultras_tab,_dataultras;
|
||||
TString _sigle_file,_nrec_file;
|
||||
char _agg_cau,_agg_pcon,_agg_cls,_agg_clifo;
|
||||
bool _agg_fatatt,_agg_fatpas;
|
||||
char _agg_cau,_agg_pcon,_agg_cls,_agg_clifo,_agg_fatatt,_agg_fatpas;
|
||||
|
||||
public:
|
||||
virtual bool create();
|
||||
@ -65,6 +67,10 @@ bool TRic_sistema::create()
|
||||
_tab_tra = new TTable ("%TRA");
|
||||
_tras_file = new TTransfer_file();
|
||||
|
||||
_mov = new TLocalisamfile (LF_MOV);
|
||||
_rmov = new TLocalisamfile (LF_RMOV);
|
||||
_rmoviva = new TLocalisamfile (LF_RMOVIVA);
|
||||
|
||||
_numdisk = 1;
|
||||
_prima_volta = TRUE;
|
||||
_nultras = 0;
|
||||
@ -81,6 +87,10 @@ bool TRic_sistema::destroy()
|
||||
delete _tab_tra;
|
||||
delete _tras_file;
|
||||
|
||||
delete _mov;
|
||||
delete _rmov;
|
||||
delete _rmoviva;
|
||||
|
||||
return TApplication::destroy();
|
||||
}
|
||||
|
||||
@ -375,7 +385,7 @@ bool TRic_sistema::video_ripartenza()
|
||||
|
||||
bool TRic_sistema::baipassa(TMask& m,KEY k)
|
||||
{
|
||||
if (k == K_SHIFT+K_F7)
|
||||
if ( (k == K_SHIFT+K_F7) && (app()._stato_ripartenza == 0) )
|
||||
app()._baipassa = TRUE;
|
||||
else
|
||||
app()._baipassa = FALSE;
|
||||
@ -413,6 +423,7 @@ long TRic_sistema::leggi_tabella_tras()
|
||||
{
|
||||
TString dep;
|
||||
long ditta = 0;
|
||||
bool agg_fatatt,agg_fatpas;
|
||||
|
||||
_tab_tra->zero();
|
||||
dep = format("%10s%05d", (const char*) _nomeid, _dittainv);
|
||||
@ -426,8 +437,17 @@ long TRic_sistema::leggi_tabella_tras()
|
||||
_agg_clifo = _tab_tra->get_char("S1");
|
||||
_agg_pcon = _tab_tra->get_char("S2");
|
||||
_agg_cls = _tab_tra->get_char("S3");
|
||||
_agg_fatatt = _tab_tra->get_bool("B0");
|
||||
_agg_fatpas = _tab_tra->get_bool("B1");
|
||||
agg_fatatt = _tab_tra->get_bool("B0");
|
||||
if (agg_fatatt)
|
||||
_agg_fatatt = 'X';
|
||||
else
|
||||
_agg_fatatt = ' ';
|
||||
|
||||
agg_fatpas = _tab_tra->get_bool("B1");
|
||||
if (agg_fatpas)
|
||||
_agg_fatpas = 'X';
|
||||
else
|
||||
_agg_fatpas = ' ';
|
||||
}
|
||||
|
||||
return ditta;
|
||||
@ -490,7 +510,7 @@ bool TRic_sistema::set_flag()
|
||||
}
|
||||
}
|
||||
else
|
||||
if (sigla == "Z" || sigla == "U" || sigla == "A")
|
||||
if (sigla == "Z" || sigla == "U" || sigla == "B")
|
||||
{
|
||||
if (nrec > 0)
|
||||
{
|
||||
@ -504,7 +524,10 @@ bool TRic_sistema::set_flag()
|
||||
fatto = FALSE;
|
||||
}
|
||||
|
||||
uselab = sigla;
|
||||
if (flag == "T")
|
||||
uselab = sigla;
|
||||
else
|
||||
uselab = "";
|
||||
}
|
||||
|
||||
if (sigla == "W" || sigla == "P")
|
||||
|
343
cg/cg2600.cpp
343
cg/cg2600.cpp
@ -19,6 +19,7 @@
|
||||
#include <rmoviva.h>
|
||||
#include <pconti.h>
|
||||
#include <comuni.h>
|
||||
#include <clifo.h>
|
||||
|
||||
#include "cglib04.h"
|
||||
#include "cglib.h"
|
||||
@ -35,6 +36,7 @@ class TRic_tab : public TApplication
|
||||
{
|
||||
|
||||
TTable* _tab_tra;
|
||||
TLocalisamfile* _mov, *_rmov, *_rmoviva;
|
||||
TTransfer_file _tras_file;
|
||||
TArray _aggiorna;
|
||||
char _scelta;
|
||||
@ -67,24 +69,29 @@ public:
|
||||
|
||||
void setta_parametri_record(const TString& sigla,const TString& flag);
|
||||
|
||||
const char* numero_civico(TString& field);
|
||||
const char* cerca_comune_cap(TString& field);
|
||||
const char* cerca_comune_den(TString& field);
|
||||
|
||||
void trasferimento();
|
||||
|
||||
void scrivi_record_tab(TString& record,long rec);
|
||||
int trasfer_data_tab(TLocalisamfile& file, TRectype& dep, const TString& sigla);
|
||||
int trasfer_data_conto(TLocalisamfile& file, TRectype& dep);
|
||||
int trasfer_data_sottoc(TLocalisamfile& file, TRectype& dep);
|
||||
void decimali(TString& campo, int dec);
|
||||
|
||||
void scrivi_record_mov(TString& record,long rec);
|
||||
int trasfer_data_mov(TLocalisamfile& file, TRectype& dep);
|
||||
long esiste_numreg(long nreg);
|
||||
void num_protocollo(TString& record);
|
||||
void controlli_prima_nota(TString& record);
|
||||
long ulnumprot_reg(int anno,char codreg);
|
||||
void controlli_prima_nota(TString& record,TString& codreg);
|
||||
long ulnumprot_reg(int anno,TString& codreg);
|
||||
long ultima_registrazione();
|
||||
void aggiorna_reg(int anno,char codreg,long ulnum);
|
||||
void aggiorna_reg(int anno,TString& codreg,long ulnum);
|
||||
int annoes_datacomp(const TString& record,TDate& datacomp);
|
||||
void datafine_esprec(const int annop,TDate& datacomp);
|
||||
char ricerca_causale(const TString& field);
|
||||
char ricerca_causale(TString& field);
|
||||
void prepara_saldi(const TString& fname,const TString& field);
|
||||
|
||||
void scrivi_record_moviva(TString& record,long rec);
|
||||
@ -121,6 +128,9 @@ bool TRic_tab::create()
|
||||
TApplication::create();
|
||||
|
||||
_tab_tra = new TTable ("%TRA");
|
||||
_mov = new TLocalisamfile (LF_MOV);
|
||||
_rmov = new TLocalisamfile (LF_RMOV);
|
||||
_rmoviva = new TLocalisamfile (LF_RMOVIVA);
|
||||
|
||||
_numrec = 1;
|
||||
_prima_volta = TRUE;
|
||||
@ -138,6 +148,9 @@ bool TRic_tab::create()
|
||||
bool TRic_tab::destroy()
|
||||
{
|
||||
delete _tab_tra;
|
||||
delete _mov;
|
||||
delete _rmov;
|
||||
delete _rmoviva;
|
||||
|
||||
return TApplication::destroy();
|
||||
}
|
||||
@ -180,6 +193,60 @@ const char* TRic_tab::riconverti (TString& data_PC)
|
||||
return TEMP;
|
||||
}
|
||||
|
||||
const char* TRic_tab::numero_civico(TString& indirizzo)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = indirizzo.len(); (indirizzo[i] != ' ' && indirizzo[i] != ',' && i > 0); i--);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
TEMP = indirizzo.mid(i+1);
|
||||
indirizzo = indirizzo.sub(0,i);
|
||||
}
|
||||
else
|
||||
TEMP = "";
|
||||
|
||||
return TEMP;
|
||||
}
|
||||
|
||||
const char* TRic_tab::cerca_comune_cap(TString& field)
|
||||
{
|
||||
TLocalisamfile comuni (LF_COMUNI);
|
||||
TString cap = field;
|
||||
|
||||
if (cap.sub(2,3) == "1")
|
||||
{
|
||||
cap = cap.sub(0,3);
|
||||
cap << "00";
|
||||
}
|
||||
|
||||
comuni.setkey(3);
|
||||
comuni.zero();
|
||||
comuni.put(COM_CAPCOM, cap);
|
||||
if (comuni.read() == NOERR)
|
||||
TEMP = comuni.get(COM_COM);
|
||||
else
|
||||
TEMP = "";
|
||||
|
||||
return TEMP;
|
||||
}
|
||||
|
||||
const char* TRic_tab::cerca_comune_den(TString& field)
|
||||
{
|
||||
TLocalisamfile comuni (LF_COMUNI);
|
||||
|
||||
comuni.setkey(2);
|
||||
comuni.zero();
|
||||
comuni.put(COM_DENCOM, field);
|
||||
if (comuni.read() == NOERR)
|
||||
TEMP = comuni.get(COM_COM);
|
||||
else
|
||||
TEMP = "";
|
||||
|
||||
return TEMP;
|
||||
}
|
||||
|
||||
bool TRic_tab::main_loop()
|
||||
{
|
||||
int posiz;
|
||||
@ -307,7 +374,7 @@ void TRic_tab::trasferimento()
|
||||
|
||||
void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
||||
{
|
||||
TString sigla,key,str;
|
||||
TString sigla,key,str,numero,comune;
|
||||
int numfield = 2; //Per le tabelle il primo campo della mappa non e' significativo
|
||||
//ai fini del trasferimento (flag di record gia trasferito).
|
||||
TMappa_trc& trc = _tras_file.mappa();
|
||||
@ -318,6 +385,7 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
||||
int campi_righe = 0;
|
||||
int num_riga = 1;
|
||||
TToken_string data;
|
||||
TString cap = "";
|
||||
|
||||
sigla = record.mid(0,2);
|
||||
gia_trasf = record.mid(255,1)[0];
|
||||
@ -344,6 +412,9 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
||||
delete dep;
|
||||
}
|
||||
|
||||
if ( (logicnum == LF_RCAUSALI) && (_tras_file.flg_agg() == 'D') )
|
||||
break;
|
||||
|
||||
file = new TLocalisamfile(logicnum);
|
||||
dep = new TRectype (logicnum);
|
||||
dep->zero();
|
||||
@ -369,6 +440,9 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
||||
|
||||
trasfer_data_tab(*file, *dep, sigla);
|
||||
}
|
||||
else
|
||||
num_riga++;
|
||||
|
||||
campi_righe = 1;
|
||||
}
|
||||
}
|
||||
@ -381,13 +455,33 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
||||
|
||||
//Il nostro codice registro IVA e' lungo 3: se il loro registro (lungo 1) e' alfanumerico
|
||||
//devo allinearlo a sinistra, mentre se e' numerico devo allinearlo a destra riempendolo con degli zero.
|
||||
if (logicnum == LF_CAUSALI && fname == "REG")
|
||||
if (logicnum == LF_CAUSALI)
|
||||
{
|
||||
char f = field[0];
|
||||
if (isdigit(f))
|
||||
field.format("%03c", f);
|
||||
else
|
||||
field.format("%-3c", f);
|
||||
if (fname == "REG")
|
||||
{
|
||||
char f = field[0];
|
||||
if (isdigit(f))
|
||||
field.format("%03c", f);
|
||||
else
|
||||
field.format("%-3c", f);
|
||||
}
|
||||
|
||||
if (fname == "M770")
|
||||
if (field == "0")
|
||||
field = " ";
|
||||
|
||||
if (fname == "NUMDOC" || fname == "DATADOC")
|
||||
{
|
||||
if (field == "0")
|
||||
field = " ";
|
||||
else
|
||||
if (field == "1")
|
||||
field = "X";
|
||||
}
|
||||
|
||||
if (fname == "CODCAUSIM")
|
||||
if (field == "000")
|
||||
field = " ";
|
||||
}
|
||||
|
||||
//Il tipo cliente/fornitore presente su AS400 puo' assumere come valori 1 o 2
|
||||
@ -424,15 +518,74 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
||||
else
|
||||
field.format("%-4s", (const char*) f);
|
||||
}
|
||||
|
||||
if (fname == "INDCF")
|
||||
{
|
||||
field = field.rtrim();
|
||||
if (field != "")
|
||||
{
|
||||
numero = numero_civico(field);
|
||||
dep->put(CLI_CIVCF, (const char*)numero);
|
||||
}
|
||||
}
|
||||
|
||||
if (fname == "CAPCF")
|
||||
{
|
||||
if (field == "00000")
|
||||
field = " ";
|
||||
else
|
||||
cap = field;
|
||||
}
|
||||
|
||||
if (fname == "LOCALITACF")
|
||||
{
|
||||
comune = "";
|
||||
|
||||
if (cap.not_empty())
|
||||
comune = cerca_comune_cap(cap);
|
||||
if (comune.empty())
|
||||
comune = cerca_comune_den(field);
|
||||
if (comune.not_empty())
|
||||
{
|
||||
dep->put(CLI_COMCF, comune);
|
||||
field = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (fname == "ALLEG")
|
||||
if (field == "0")
|
||||
field = " ";
|
||||
|
||||
if (fname == "PAIV")
|
||||
if (field == "00000000000")
|
||||
field = " ";
|
||||
}
|
||||
|
||||
if (flag)
|
||||
if (flag && (_tras_file.flg_agg() == 'D') )
|
||||
{
|
||||
data = "";
|
||||
data.add(fname);
|
||||
data.add(field);
|
||||
|
||||
_aggiorna.add(data);
|
||||
|
||||
if (sigla == "A1" && fname == "INDCF")
|
||||
{
|
||||
data = "";
|
||||
data.add("CIVCF");
|
||||
data.add(numero);
|
||||
|
||||
_aggiorna.add(data);
|
||||
}
|
||||
|
||||
if (sigla == "A1" && fname == "LOCALITACF")
|
||||
{
|
||||
data = "";
|
||||
data.add("COMCF");
|
||||
data.add(comune);
|
||||
|
||||
_aggiorna.add(data);
|
||||
}
|
||||
}
|
||||
|
||||
//Quando ricevo la IV direttiva del piano dei conti per evitare che nell'archivio,
|
||||
@ -440,6 +593,15 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
||||
//vuoto la stringa prima di fare la put.
|
||||
if (sigla == "P2" || sigla == "P3")
|
||||
{
|
||||
if (fname == "STSOTTBIL")
|
||||
{
|
||||
if (field == "0")
|
||||
field = "X";
|
||||
else
|
||||
if (field == "1")
|
||||
field = " ";
|
||||
}
|
||||
|
||||
if (fname == "NUMRIVD" || fname == "NUMRIVDOPP")
|
||||
{
|
||||
if (field == "000")
|
||||
@ -451,6 +613,7 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
||||
field = "0";
|
||||
}
|
||||
}
|
||||
|
||||
dep->put(fname, (const char*)field);
|
||||
|
||||
numfield++;
|
||||
@ -460,22 +623,28 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
||||
|
||||
if (logicnum == LF_RCAUSALI)
|
||||
{
|
||||
campi_righe++;
|
||||
|
||||
if (campi_righe == CAMPI_RCAUS)
|
||||
if (_tras_file.flg_agg() != 'D')
|
||||
{
|
||||
TString16 gruppo(dep->get("GRUPPO"));
|
||||
//
|
||||
// scarta le righe non significative
|
||||
// -------------------- NB -----------------------
|
||||
// supponiamo il GRUPPO INDISPENSABILE !!!!!!!!!!!!!
|
||||
//
|
||||
if (gruppo.not_empty())
|
||||
campi_righe++;
|
||||
|
||||
if (campi_righe == CAMPI_RCAUS)
|
||||
{
|
||||
dep->put("NRIGA", num_riga++);
|
||||
trasfer_data_tab(*file, *dep, sigla);
|
||||
TString16 gruppo(dep->get("GRUPPO"));
|
||||
//
|
||||
// scarta le righe non significative
|
||||
// -------------------- NB -----------------------
|
||||
// supponiamo il GRUPPO INDISPENSABILE !!!!!!!!!!!!!
|
||||
//
|
||||
if (gruppo.not_empty())
|
||||
{
|
||||
dep->put("NRIGA", num_riga++);
|
||||
trasfer_data_tab(*file, *dep, sigla);
|
||||
}
|
||||
else
|
||||
num_riga++;
|
||||
|
||||
campi_righe = 1;
|
||||
}
|
||||
campi_righe = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -529,14 +698,18 @@ int TRic_tab::trasfer_data_tab(TLocalisamfile& file, TRectype& dep, const TStrin
|
||||
}
|
||||
if (flag == 'D')
|
||||
{
|
||||
for (int i = 0; i < _aggiorna.items(); i++)
|
||||
if (file.num() != LF_RCAUSALI)
|
||||
{
|
||||
TToken_string& data = (TToken_string&)_aggiorna[i];
|
||||
TString fname = data.get(0);
|
||||
TString field = data.get(1);
|
||||
file.put(fname,field);
|
||||
for (int i = 0; i < _aggiorna.items(); i++)
|
||||
{
|
||||
TToken_string& data = (TToken_string&)_aggiorna[i];
|
||||
TString fname = data.get(0);
|
||||
TString field = data.get(1);
|
||||
file.put(fname,field);
|
||||
}
|
||||
file.rewrite();
|
||||
_aggiorna.destroy();
|
||||
}
|
||||
file.rewrite();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -755,35 +928,23 @@ void TRic_tab::num_protocollo(TString& record)
|
||||
_nuprotiva = _uprotiva;
|
||||
}
|
||||
|
||||
long TRic_tab::ulnumprot_reg(int anno,char codreg)
|
||||
long TRic_tab::ulnumprot_reg(int anno,TString& cr)
|
||||
{
|
||||
/*
|
||||
TTable reg ("REG");
|
||||
TString16 dep;
|
||||
long num = 0;
|
||||
|
||||
dep.format("%04d%s", anno,(const char*) codreg);
|
||||
|
||||
reg.zero();
|
||||
reg.put("CODTAB", (const char*) dep);
|
||||
if (reg.read() == NOERR)
|
||||
num = reg.get_long("I5");
|
||||
*/
|
||||
TString cr = format("%c", codreg);
|
||||
//TString cr = format("%c", codreg);
|
||||
TRegistro rg (cr, anno);
|
||||
|
||||
return rg.protocol();
|
||||
}
|
||||
|
||||
void TRic_tab::aggiorna_reg(int anno,char codreg,long ulnum)
|
||||
void TRic_tab::aggiorna_reg(int anno,TString& codreg,long ulnum)
|
||||
{
|
||||
TTable reg ("REG");
|
||||
TString16 dep;
|
||||
|
||||
if (isdigit(codreg))
|
||||
dep.format("%04d%03c", anno,codreg);
|
||||
if (real::is_natural(codreg))
|
||||
dep.format("%04d%03s", anno,(const char*) codreg);
|
||||
else
|
||||
dep.format("%04d%-3c", anno,codreg);
|
||||
dep.format("%04d%-3s", anno,(const char*) codreg);
|
||||
|
||||
reg.zero();
|
||||
reg.put("CODTAB", (const char*) dep);
|
||||
@ -799,20 +960,16 @@ void TRic_tab::aggiorna_reg(int anno,char codreg,long ulnum)
|
||||
}
|
||||
}
|
||||
|
||||
void TRic_tab::controlli_prima_nota(TString& record)
|
||||
void TRic_tab::controlli_prima_nota(TString& record,TString& codreg)
|
||||
{
|
||||
TTable tpd ("%TPD");
|
||||
bool corrisp;
|
||||
TDate datareg;
|
||||
int anno;
|
||||
long ulnum;
|
||||
long ulnum = 0;
|
||||
TString16 tmp;
|
||||
char codreg;
|
||||
TString tipodoc;
|
||||
|
||||
// char codreg = record.sub(35,36)[0];
|
||||
// TString tipodoc = record.sub(220,222);
|
||||
|
||||
int tiporeg = atoi(record.sub(222,223));
|
||||
|
||||
TString80 tmpmov = "%";
|
||||
@ -825,8 +982,8 @@ void TRic_tab::controlli_prima_nota(TString& record)
|
||||
tmp_mov.put(MOV_NUMREG, _numreg);
|
||||
if (tmp_mov.read() == NOERR)
|
||||
{
|
||||
codreg = tmp_mov.get_char(MOV_REG);
|
||||
tipodoc = tmp_mov.get (MOV_TIPODOC);
|
||||
codreg = tmp_mov.get(MOV_REG);
|
||||
tipodoc = tmp_mov.get(MOV_TIPODOC);
|
||||
}
|
||||
|
||||
tmp = record.sub(15,21);
|
||||
@ -842,7 +999,7 @@ void TRic_tab::controlli_prima_nota(TString& record)
|
||||
if (tpd.read() == NOERR)
|
||||
corrisp = tpd.get_bool("B0");
|
||||
|
||||
if (codreg != ' ' && !corrisp)
|
||||
if (codreg != "" && !corrisp)
|
||||
{
|
||||
if ( ( (tiporeg == 1 && (numprot_att || _protiva == 0) ) )
|
||||
|| ( (tiporeg == 2 && (numprot_pas || _protiva == 0) ) ) )
|
||||
@ -904,18 +1061,19 @@ long TRic_tab::ultima_registrazione()
|
||||
return _nreg;
|
||||
}
|
||||
|
||||
char TRic_tab::ricerca_causale(const TString& causale)
|
||||
char TRic_tab::ricerca_causale(TString& causale)
|
||||
{
|
||||
TLocalisamfile cau (LF_CAUSALI);
|
||||
TString codcau;
|
||||
char movap = ' ';
|
||||
|
||||
long caus = atol(causale);
|
||||
codcau.format("%03d", caus);
|
||||
if (real::is_natural(causale))
|
||||
causale.format("%03s", (const char*) causale);
|
||||
else
|
||||
causale.format("%-3s", (const char*) causale);
|
||||
|
||||
cau.setkey(1);
|
||||
cau.zero();
|
||||
cau.put("CODCAUS", codcau);
|
||||
cau.put("CODCAUS", causale);
|
||||
if (cau.read() == NOERR)
|
||||
movap = cau.get_char("MOVAP");
|
||||
|
||||
@ -946,7 +1104,7 @@ void TRic_tab::prepara_saldi(const TString& fname,const TString& field)
|
||||
|
||||
void TRic_tab::scrivi_record_mov(TString& record,long rec)
|
||||
{
|
||||
TString sigla,key,str;
|
||||
TString sigla,key,str,codreg;
|
||||
int numfield = 3; //Per i movimenti i primi due campi della mappa non sono significativi
|
||||
//ai fini del trasferimento (flag record gia trasferito e nuovo ultimo numero di registrazione).
|
||||
TMappa_trc& trc = _tras_file.mappa();
|
||||
@ -987,7 +1145,7 @@ void TRic_tab::scrivi_record_mov(TString& record,long rec)
|
||||
numulreg = ultima_registrazione(); //reperisco il numero ultima registrazione
|
||||
_nreg = esiste_numreg(numulreg);
|
||||
num_protocollo(record);
|
||||
controlli_prima_nota(record);
|
||||
controlli_prima_nota(record,codreg);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1043,18 +1201,25 @@ void TRic_tab::scrivi_record_mov(TString& record,long rec)
|
||||
TString fname = trc.field_name(key);
|
||||
TString field = record.sub(from-1,to);
|
||||
int flag = trc.flag(key);
|
||||
int dec = trc.flag_bis(key);
|
||||
|
||||
if (flag == 3)
|
||||
{
|
||||
if (dec > 0)
|
||||
decimali(field,dec);
|
||||
|
||||
real appoggio (field);
|
||||
field = appoggio.string();
|
||||
}
|
||||
|
||||
//Il nostro codice registro IVA e' lungo 3: se il loro registro (lungo 1) e' alfanumerico
|
||||
//devo allinearlo a sinistra, mentre se e' numerico devo allinearlo a destra riempendolo con degli zero.
|
||||
if (logicnum == LF_MOV)
|
||||
{
|
||||
if (fname == "REG")
|
||||
{
|
||||
char f = field[0];
|
||||
if (isdigit(f))
|
||||
field.format("%03c", f);
|
||||
if (real::is_natural(codreg))
|
||||
field.format("%03s", (const char*) codreg);
|
||||
else
|
||||
field.format("%-3c", f);
|
||||
field.format("%-3s", (const char*) codreg);
|
||||
}
|
||||
|
||||
//Il codice pagamento su AS400 e' un alfanumerico di due, mentre su PC e' un
|
||||
@ -1098,7 +1263,7 @@ void TRic_tab::scrivi_record_mov(TString& record,long rec)
|
||||
_sld.set_movap(TRUE);
|
||||
}
|
||||
|
||||
if (logicnum == LF_MOV && (fname == "NUMREG" || flag == 1) )
|
||||
if (logicnum == LF_MOV && (fname == "NUMREG" || flag == 2) )
|
||||
{
|
||||
if (fname == "NUMREG")
|
||||
{
|
||||
@ -1107,7 +1272,7 @@ void TRic_tab::scrivi_record_mov(TString& record,long rec)
|
||||
dep->put(MOV_DATAREG, _datareg);
|
||||
dep->put(MOV_DATACOMP, datacomp);
|
||||
}
|
||||
if (flag == 1)
|
||||
if (flag == 2)
|
||||
{
|
||||
TString f = converti(field);
|
||||
dep->put(fname,f);
|
||||
@ -1129,7 +1294,7 @@ void TRic_tab::scrivi_record_mov(TString& record,long rec)
|
||||
}
|
||||
}
|
||||
else
|
||||
dep->put(fname, (const char*)field);
|
||||
dep->put(fname, field);
|
||||
|
||||
numfield++;
|
||||
key.format("%2s%d", (const char*) sigla,numfield);
|
||||
@ -1393,6 +1558,13 @@ void TRic_tab::salva_dati_testata()
|
||||
_tras_file.write(numrec);
|
||||
}
|
||||
|
||||
void TRic_tab::decimali(TString& campo, int dec)
|
||||
{
|
||||
int l = campo.len();
|
||||
int p = l - dec;
|
||||
campo.insert(".",p);
|
||||
}
|
||||
|
||||
void TRic_tab::scrivi_record_moviva(TString& record,long rec)
|
||||
{
|
||||
TString sigla,key,str;
|
||||
@ -1476,19 +1648,22 @@ void TRic_tab::scrivi_record_moviva(TString& record,long rec)
|
||||
TString fname = trc.field_name(key);
|
||||
TString field = record.sub(from-1,to);
|
||||
int flag = trc.flag(key);
|
||||
int dec = trc.flag_bis(key);
|
||||
|
||||
if (logicnum == LF_MOV && fname == "CAMBIOI" && flag == 5)
|
||||
if (logicnum == LF_MOV && fname == "TOTDOC")
|
||||
{
|
||||
int l = field.len();
|
||||
int p = l - flag;
|
||||
field.insert(".",p);
|
||||
numfield++;
|
||||
key.format("%2s%d", (const char*) sigla,numfield);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (logicnum == LF_MOV && fname == "CORRVALUTA" && flag == 5)
|
||||
if (flag == 3)
|
||||
{
|
||||
int l = field.len();
|
||||
int p = l -flag;
|
||||
field.insert(".",p);
|
||||
if (dec > 0)
|
||||
decimali(field,dec);
|
||||
|
||||
real appoggio (field);
|
||||
field = appoggio.string();
|
||||
}
|
||||
|
||||
if (logicnum == LF_MOV && ( fname == "NUMREG" || flag == 1 ) )
|
||||
@ -1510,7 +1685,7 @@ void TRic_tab::scrivi_record_moviva(TString& record,long rec)
|
||||
dep->put("NUMREG", _nreg);
|
||||
}
|
||||
else
|
||||
dep->put(fname, (const char*)field);
|
||||
dep->put(fname, field);
|
||||
|
||||
numfield++;
|
||||
key.format("%2s%d", (const char*) sigla,numfield);
|
||||
@ -1551,7 +1726,6 @@ int TRic_tab::trasfer_data_moviva(TLocalisamfile& file, TRectype& dep, int ln)
|
||||
TDate data74ter (dep.get_date(MOV_DATA74TER));
|
||||
TString codval (dep.get (MOV_CODVAL));
|
||||
long codcf = dep.get_long(MOV_CODCF);
|
||||
real totdoc (dep.get_real(MOV_TOTDOC));
|
||||
real cambioi (dep.get_real(MOV_CAMBIOI));
|
||||
real corrlire (dep.get_real(MOV_CORRLIRE));
|
||||
real corrvaluta(dep.get_real(MOV_CORRVALUTA));
|
||||
@ -1559,7 +1733,6 @@ int TRic_tab::trasfer_data_moviva(TLocalisamfile& file, TRectype& dep, int ln)
|
||||
file.put(MOV_DATA74TER, data74ter);
|
||||
file.put(MOV_CODVAL, codval);
|
||||
file.put(MOV_CODCF, codcf);
|
||||
file.put(MOV_TOTDOC, totdoc);
|
||||
file.put(MOV_CAMBIOI, cambioi);
|
||||
file.put(MOV_CORRLIRE, corrlire);
|
||||
file.put(MOV_CORRVALUTA,corrvaluta);
|
||||
|
199
cg/cg2700.cpp
199
cg/cg2700.cpp
@ -1,6 +1,7 @@
|
||||
//
|
||||
// Ricezione dati: lista controllo movimenti
|
||||
//
|
||||
|
||||
#include <config.h>
|
||||
#include <mask.h>
|
||||
#include <prefix.h>
|
||||
@ -23,9 +24,9 @@
|
||||
#include "cg2700.h"
|
||||
|
||||
HIDDEN const char* err_msg[] = {"*** Data operazione non valida",
|
||||
"--- Data operazione non compresa in alcun esercizio",
|
||||
"*** Data operazione non compresa in alcun esercizio",
|
||||
"*** Data competenza non valida",
|
||||
"--- Data competenza non compresa in alcun esercizio",
|
||||
"*** Data competenza non compresa in alcun esercizio",
|
||||
"--- Data competenza incompatibile con data operazione",
|
||||
"*** Data operazione antecedente ad ultima stampa giornale",
|
||||
"--- Data documento non valida",
|
||||
@ -40,9 +41,9 @@ HIDDEN int date2esc(const TDate& d, int* prevesc = NULL);
|
||||
|
||||
class TRic_ListaMov : public TPrintapp
|
||||
{
|
||||
TTable* _tab_tra,* _tab_pag,* _tab_tpd,* _tab_iva;
|
||||
TTable* _tab_tra,* _tab_pag,* _tab_tpd,* _tab_iva, *_tab_ese;
|
||||
TIsamtempfile* _tmov,* _trmov,* _tiva;
|
||||
TLocalisamfile* _caus,* _ditte,* _clifo,* _pcon;
|
||||
TLocalisamfile* _caus,* _ditte,* _clifo,* _pcon, *_mov, *_rmov, *_rmoviva;
|
||||
TRelation* _rel;
|
||||
TCursor* _cur;
|
||||
TTransfer_file* _trasfer;
|
||||
@ -51,7 +52,7 @@ class TRic_ListaMov : public TPrintapp
|
||||
TString16 _causale, _registro, _numdoc, _tipodoc, _codval;
|
||||
TString16 _codpag, _codiva, _tipo_conto;
|
||||
TString _record;
|
||||
bool _mov_sez, _errore_grave, _esiste_conto, _esiste_causale;
|
||||
bool _mov_sez, _errore_grave, _esiste_conto;
|
||||
char _sdt, _sezione;
|
||||
int _ae, _anno, _gruppo, _conto, _tipocr, _tipod, _tiporeg;
|
||||
int _gruppoc, _contoc, _n_rec, _gruppocr, _contocr;
|
||||
@ -212,10 +213,14 @@ bool TRic_ListaMov::user_create()
|
||||
_tab_tpd = new TTable ("%TPD");
|
||||
_tab_pag = new TTable ("%CPG");
|
||||
_tab_iva = new TTable ("%IVA");
|
||||
_tab_ese = new TTable ("ESC");
|
||||
_caus = new TLocalisamfile (LF_CAUSALI);
|
||||
_ditte = new TLocalisamfile (LF_NDITTE);
|
||||
_clifo = new TLocalisamfile (LF_CLIFO);
|
||||
_pcon = new TLocalisamfile (LF_PCON);
|
||||
_mov = new TLocalisamfile (LF_MOV);
|
||||
_rmov = new TLocalisamfile (LF_RMOV);
|
||||
_rmoviva = new TLocalisamfile (LF_RMOVIVA);
|
||||
|
||||
if (pnd) pnd->addstatus(1);
|
||||
|
||||
@ -331,7 +336,7 @@ bool TRic_ListaMov::controlla_mov()
|
||||
bool check_reg = TRUE;
|
||||
TString16 causreg;
|
||||
TDate udata;
|
||||
char tipocf;
|
||||
char tipocf = ' ';
|
||||
|
||||
_tiporeg = 0;
|
||||
|
||||
@ -346,12 +351,18 @@ bool TRic_ListaMov::controlla_mov()
|
||||
int pr;
|
||||
const int ar = date2esc(_datareg, &pr); // Esercizio in corso
|
||||
if (ar == 0)
|
||||
{
|
||||
_err.set(1);
|
||||
_errore_grave = TRUE;
|
||||
}
|
||||
if (_datacomp.ok())
|
||||
{
|
||||
const int ae = date2esc(_datacomp);
|
||||
if (ae == 0)
|
||||
{
|
||||
_err.set(3);
|
||||
_errore_grave = TRUE;
|
||||
}
|
||||
else if (ae != ar && ae != pr && ar)
|
||||
_err.set(4);
|
||||
}
|
||||
@ -383,14 +394,10 @@ bool TRic_ListaMov::controlla_mov()
|
||||
caus.zero();
|
||||
caus.put(CAU_CODCAUS,_causale);
|
||||
if (caus.read() == NOERR)
|
||||
{
|
||||
_esiste_causale = TRUE;
|
||||
_tipodoc = caus.get(CAU_TIPODOC);
|
||||
}
|
||||
else
|
||||
{
|
||||
caus.zero();
|
||||
_esiste_causale = FALSE;
|
||||
if (look_causale(_causale)) //se la causale e' significativa
|
||||
{
|
||||
_errore_grave = TRUE;
|
||||
@ -451,12 +458,12 @@ bool TRic_ListaMov::controlla_mov()
|
||||
_registro = causreg;
|
||||
}
|
||||
|
||||
if (check_reg && !_registro.blank())
|
||||
if (!_registro.blank())
|
||||
{
|
||||
if (_tiporeg == 1) tipocf = 'C';
|
||||
else if (_tiporeg == 2) tipocf = 'F';
|
||||
if (_tiporeg != 0 && !_tipodoc.blank()) //se esiste, uso quello della causale!!!
|
||||
{
|
||||
// if (_tiporeg != 0) //se esiste, uso quello della causale!!!
|
||||
// {
|
||||
TTable tabtpd("%TPD");
|
||||
tabtpd.put("CODTAB", _tipodoc);
|
||||
if (tabtpd.read() == NOERR)
|
||||
@ -481,7 +488,27 @@ bool TRic_ListaMov::controlla_mov()
|
||||
_err.set(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_codcf != 0l)
|
||||
{
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
clifo.zero();
|
||||
clifo.put(CLI_CODCF, _codcf);
|
||||
clifo.put(CLI_TIPOCF,tipocf);
|
||||
if (clifo.read() != NOERR)
|
||||
{
|
||||
_errore_grave = TRUE;
|
||||
_err.set(10);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_errore_grave = TRUE;
|
||||
_err.set(10);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
TString16 d74 = _data74tr.string();
|
||||
@ -567,6 +594,19 @@ bool TRic_ListaMov::controlla_rmov()
|
||||
sezione = rec.get_char(RMV_SEZIONE);
|
||||
importo = rec.get_real(RMV_IMPORTO);
|
||||
|
||||
_tipo_conto = "";
|
||||
|
||||
if (gruppo != 0 && conto != 0 && sottoconto != 0l)
|
||||
_esiste_conto = DescrConto(gruppo,conto,sottoconto);
|
||||
else
|
||||
{
|
||||
_esiste_conto = FALSE;
|
||||
_descr_conto = "";
|
||||
}
|
||||
|
||||
_num_rec = rec.get_long(RMV_ANNOES);
|
||||
aggiorna_trasfer_Z();
|
||||
|
||||
if (sezione == 'D')
|
||||
dare += importo;
|
||||
if (sezione == 'A')
|
||||
@ -587,21 +627,13 @@ bool TRic_ListaMov::controlla_rmov()
|
||||
}
|
||||
}
|
||||
|
||||
if ( (importo == ZERO && sezione != ' ') ||
|
||||
(sezione != 'D' && sezione != 'A') )
|
||||
if ( (importo != ZERO && sezione == '\0') ||
|
||||
(sezione != 'D' && sezione != 'A' && sezione != '\0') )
|
||||
{
|
||||
rmov.readat(nrec);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
if (gruppoc == 0 || contoc == 0 || sottocontoc == 0l)
|
||||
{
|
||||
rmov.readat(nrec);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
*/
|
||||
if (gruppoc != 0 || contoc != 0 || sottocontoc != 0l)
|
||||
{
|
||||
bool ok = errori_partita(gruppoc,contoc,sottocontoc);
|
||||
@ -612,8 +644,7 @@ bool TRic_ListaMov::controlla_rmov()
|
||||
}
|
||||
}
|
||||
|
||||
if (_esiste_causale)
|
||||
if (!_mov_sez && importo == ZERO)
|
||||
if (!_mov_sez && importo == ZERO)
|
||||
{
|
||||
rmov.readat(nrec);
|
||||
return TRUE;
|
||||
@ -645,8 +676,8 @@ void TRic_ListaMov::stampa_errori_rmov(int riga)
|
||||
}
|
||||
}
|
||||
|
||||
if ( (_importo == ZERO && _sezione != ' ') ||
|
||||
(_sezione != 'D' && _sezione != 'A') )
|
||||
if ( (_importo != ZERO && _sezione == '\0') ||
|
||||
(_sezione != 'D' && _sezione != 'A' && _sezione != '\0') )
|
||||
{
|
||||
_errore_grave = TRUE;
|
||||
set_row(++riga, "@8g*** Segnale dare/avere non valido");
|
||||
@ -663,15 +694,11 @@ void TRic_ListaMov::stampa_errori_rmov(int riga)
|
||||
{
|
||||
bool ok = errori_partita(_gruppoc,_contoc,_sottocontoc);
|
||||
if (!ok)
|
||||
{
|
||||
_errore_grave = TRUE;
|
||||
set_row(++riga, "@8g*** Sottoconto contropartita non valido o non presente in archivio");
|
||||
}
|
||||
set_row(++riga, "@8g--- Sottoconto contropartita non valido o non presente in archivio");
|
||||
}
|
||||
|
||||
if (_esiste_causale)
|
||||
if (!_mov_sez && _importo == ZERO)
|
||||
set_row(++riga, "@8g--- Importo riga uguale a zero");
|
||||
if (!_mov_sez && _importo == ZERO)
|
||||
set_row(++riga, "@8g--- Importo riga uguale a zero");
|
||||
}
|
||||
|
||||
bool TRic_ListaMov::controlla_riva()
|
||||
@ -681,6 +708,7 @@ bool TRic_ListaMov::controlla_riva()
|
||||
TString16 codiva;
|
||||
int tipodet, tipocr, gruppocr, contocr;
|
||||
long sottocontocr;
|
||||
real impo, impos;
|
||||
|
||||
if (current_cursor()->is_first_match(LF_RMOVIVA))
|
||||
{
|
||||
@ -693,12 +721,42 @@ bool TRic_ListaMov::controlla_riva()
|
||||
{
|
||||
TRectype rec (rmoviva.curr());
|
||||
if (rec > recc) break;
|
||||
_n_rec = rec.get_int(RMI_ANNOES);
|
||||
codiva = rec.get(RMI_CODIVA);
|
||||
tipodet = rec.get_int(RMI_TIPODET);
|
||||
tipocr = rec.get_int(RMI_TIPOCR);
|
||||
gruppocr = rec.get_int(RMI_GRUPPO);
|
||||
contocr = rec.get_int(RMI_CONTO);
|
||||
sottocontocr = rec.get_long(RMI_SOTTOCONTO);
|
||||
impo = rec.get_real(RMI_IMPONIBILE);
|
||||
impos = rec.get_real(RMI_IMPOSTA);
|
||||
|
||||
TString impostr = impo.string();
|
||||
TString impostastr = impos.string();
|
||||
|
||||
_tot_doc += impo + impos;
|
||||
|
||||
TString totdocstr = _tot_doc.string();
|
||||
|
||||
_impo = impo;
|
||||
_impos = impos;
|
||||
|
||||
if (!_tipodoc.blank())
|
||||
{
|
||||
TTable tabtpd("%TPD");
|
||||
tabtpd.put("CODTAB", _tipodoc);
|
||||
if (tabtpd.read() == NOERR)
|
||||
{
|
||||
bool cor = tabtpd.get_bool("B0");
|
||||
if (cor)
|
||||
{
|
||||
_impo = impo + impos;
|
||||
_impos = ZERO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aggiorna_trasfer_U();
|
||||
|
||||
TTable iva ("%IVA");
|
||||
iva.zero();
|
||||
@ -713,17 +771,6 @@ bool TRic_ListaMov::controlla_riva()
|
||||
rmoviva.readat(nrec);
|
||||
return TRUE;
|
||||
}
|
||||
/*
|
||||
if (gruppocr != 0 || contocr != 0 || sottocontocr != 0l)
|
||||
{
|
||||
bool ok = errori_partita(gruppocr,contocr,sottocontocr);
|
||||
if (!ok)
|
||||
{
|
||||
rmoviva.readat(nrec);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (gruppocr == 0 || contocr == 0 || sottocontocr == 0l)
|
||||
{
|
||||
rmoviva.readat(nrec);
|
||||
@ -762,18 +809,12 @@ void TRic_ListaMov::stampa_errori_riva(int riga)
|
||||
set_row(++riga, "@8g--- Tipo costo/ricavo non valido");
|
||||
|
||||
if (_gruppocr == 0 || _contocr == 0 || _sottocontocr == 0l)
|
||||
{
|
||||
_errore_grave = TRUE;
|
||||
set_row(++riga, "@8g*** Sottoconto costo/ricavo non valido o non presente in archivio");
|
||||
}
|
||||
set_row(++riga, "@8g--- Sottoconto costo/ricavo non valido o non presente in archivio");
|
||||
else if (_gruppocr != 0 && _contocr != 0 && _sottocontocr != 0l)
|
||||
{
|
||||
bool ok = errori_partita(_gruppocr,_contocr,_sottocontocr);
|
||||
if (!ok)
|
||||
{
|
||||
_errore_grave = TRUE;
|
||||
set_row(++riga, "@8g*** Sottoconto costo/ricavo non valido o non presente in archivio");
|
||||
}
|
||||
set_row(++riga, "@8g--- Sottoconto costo/ricavo non valido o non presente in archivio");
|
||||
}
|
||||
|
||||
if (_tipod != 0 && _tipod != 1 && _tipod != 3 && _tipod != 9)
|
||||
@ -811,10 +852,12 @@ bool TRic_ListaMov::preprocess_page(int file,int counter)
|
||||
|
||||
_ae = date2esc(_datareg);
|
||||
|
||||
_num_rec = cur->curr(LF_MOV).get_long(MOV_NUMGIO);
|
||||
//_num_rec = cur->curr(LF_MOV).get_long(MOV_NUMGIO);
|
||||
|
||||
bool controlla = controlla_mov(); //se TRUE => ci sono errori nella testata
|
||||
bool verifica = (controlla_rmov() || controlla_riva());
|
||||
bool veriva = controlla_riva();
|
||||
bool verrmov = controlla_rmov();
|
||||
bool verifica = (veriva || verrmov);
|
||||
|
||||
if ( (_controllo == 1 && controlla) || _controllo == 2 ||
|
||||
(_controllo == 1 && verifica) )
|
||||
@ -858,7 +901,7 @@ bool TRic_ListaMov::preprocess_page(int file,int counter)
|
||||
TString80 descr = cur->curr(LF_RMOV).get(RMV_DESCR);
|
||||
int numrig = cur->curr(LF_RMOV).get_int(RMV_NUMRIG);
|
||||
|
||||
_tipo_conto = "";
|
||||
_tipo_conto = "";
|
||||
|
||||
if (_gruppo != 0 && _conto != 0 && _sottoconto != 0l)
|
||||
_esiste_conto = DescrConto(_gruppo,_conto,_sottoconto);
|
||||
@ -867,6 +910,7 @@ bool TRic_ListaMov::preprocess_page(int file,int counter)
|
||||
_esiste_conto = FALSE;
|
||||
_descr_conto = "";
|
||||
}
|
||||
|
||||
int r = 1;
|
||||
set_row(r, "P%d", numrig);
|
||||
set_row(r, "@5g%3s %-.20s @30g%-.24s @56g%03d %03d %06ld @71g%-.28s", (const char*) _causale,
|
||||
@ -888,14 +932,15 @@ bool TRic_ListaMov::preprocess_page(int file,int counter)
|
||||
_tipocr = cur->curr(LF_RMOVIVA).get_int(RMI_TIPOCR);
|
||||
_tipod = cur->curr(LF_RMOVIVA).get_int(RMI_TIPODET);
|
||||
_codiva = cur->curr(LF_RMOVIVA).get(RMI_CODIVA);
|
||||
_n_rec = cur->curr(LF_RMOVIVA).get_int(RMI_ANNOES);
|
||||
//_n_rec = cur->curr(LF_RMOVIVA).get_int(RMI_ANNOES);
|
||||
_gruppocr = cur->curr(LF_RMOVIVA).get_int(RMI_GRUPPO);
|
||||
_contocr = cur->curr(LF_RMOVIVA).get_int(RMI_CONTO);
|
||||
_sottocontocr = cur->curr(LF_RMOVIVA).get_long(RMI_SOTTOCONTO);
|
||||
|
||||
TString80 codiva_des(get_codiva_des(_codiva));
|
||||
|
||||
_tot_doc += impo + impos;
|
||||
//_tot_doc += impo + impos;
|
||||
|
||||
_impo = impo;
|
||||
_impos = impos;
|
||||
|
||||
@ -916,8 +961,13 @@ bool TRic_ListaMov::preprocess_page(int file,int counter)
|
||||
|
||||
int r = 1;
|
||||
set_row(r, "I%d", numrig);
|
||||
set_row(r, "@5gImponibile %r Imposta %r Codice %4s %-50s %d",
|
||||
&_impo, &_impos, (const char*) _codiva, (const char*) codiva_des, _tipod);
|
||||
set_row(r, "@5gImponibile@16g%r",&_impo);
|
||||
set_row(r, "@32gImposta@40g%r", &_impos);
|
||||
set_row(r, "@56gCodice@63g%4s", (const char*) _codiva);
|
||||
set_row(r, "@68g%s", (const char*) codiva_des);
|
||||
|
||||
if (_tipod != 0)
|
||||
set_row(r," %d", _tipod);
|
||||
|
||||
stampa_errori_riva(r);
|
||||
}
|
||||
@ -929,7 +979,7 @@ print_action TRic_ListaMov::postprocess_page(int file,int count)
|
||||
if (count) return NEXT_PAGE;
|
||||
if (file == LF_MOV)
|
||||
{
|
||||
aggiorna_trasfer_Z();
|
||||
// aggiorna_trasfer_Z();
|
||||
reset_print();
|
||||
_err.reset();
|
||||
int n = 1;
|
||||
@ -941,9 +991,10 @@ print_action TRic_ListaMov::postprocess_page(int file,int count)
|
||||
return REPEAT_PAGE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (file == LF_RMOVIVA)
|
||||
aggiorna_trasfer_U();
|
||||
|
||||
*/
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
@ -970,11 +1021,11 @@ void TRic_ListaMov::aggiorna_trasfer_Z()
|
||||
int i=0;
|
||||
while (_registro[i]=='0' || _registro[i]==' ') i++;
|
||||
|
||||
_registro = "";
|
||||
_registro << _registro[i];
|
||||
_registro.left_just(3, ' ');
|
||||
TString16 registro = "";
|
||||
registro << _registro[i];
|
||||
registro.left_just(3, ' ');
|
||||
|
||||
mov.put(MOV_REG, _registro);
|
||||
mov.put(MOV_REG, registro);
|
||||
mov.put(MOV_TIPODOC, _tipodoc);
|
||||
mov.rewrite();
|
||||
|
||||
@ -983,14 +1034,14 @@ void TRic_ListaMov::aggiorna_trasfer_Z()
|
||||
long num = _inizioZ + _num_rec;
|
||||
if (tr.read_rec_trasfer(num) > 0)
|
||||
{
|
||||
//tr.put(_registro, "Z1", 6);
|
||||
//tr.put(_tipodoc, "Z1", 12);
|
||||
tr.put(_tipodoc, "Z1", 12);
|
||||
if (_tiporeg != 0)
|
||||
{
|
||||
str = format("%d", _tiporeg);
|
||||
tr.put(str, "Z1", 26);
|
||||
}
|
||||
str = _tot_doc.string();
|
||||
TString totdocstr = _tot_doc.string();
|
||||
str = format("%011s", (const char*) _tot_doc.string());
|
||||
tr.put(str, "Z1", 13);
|
||||
tr.put(_tipo_conto, "Z1", 11);
|
||||
tr.write(num);
|
||||
@ -1003,9 +1054,9 @@ void TRic_ListaMov::aggiorna_trasfer_U()
|
||||
long num = _inizioU + _n_rec;
|
||||
if (tr.read_rec_trasfer(num) > 0)
|
||||
{
|
||||
TString16 str = _impo.string();
|
||||
TString str = format("%011s", (const char*)_impo.string());
|
||||
tr.put(str, "U1", 14);
|
||||
str = _impos.string();
|
||||
str = format("%09s", (const char*)_impos.string());
|
||||
tr.put(str, "U1", 15);
|
||||
tr.write(num);
|
||||
}
|
||||
@ -1024,10 +1075,14 @@ bool TRic_ListaMov::user_destroy()
|
||||
delete _ditte;
|
||||
delete _clifo;
|
||||
delete _pcon;
|
||||
delete _mov;
|
||||
delete _rmov;
|
||||
delete _rmoviva;
|
||||
delete _tab_tra;
|
||||
delete _tab_pag;
|
||||
delete _tab_tpd;
|
||||
delete _tab_iva;
|
||||
delete _tab_ese;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -30,7 +30,8 @@ HIDDEN TString80 TEMP;
|
||||
class TVar_mov : public TApplication
|
||||
{
|
||||
TIsamtempfile* _tmov,* _trmov,* _tiva;
|
||||
TLocalisamfile* _pcon,* _clifo;
|
||||
TLocalisamfile* _pcon,* _clifo, *_mov, *_rmov, *_rmoviva;
|
||||
TTable* _tab_reg;
|
||||
TRectype* _rec_mov,* _rec_rmov,* _rec_riva;
|
||||
TTransfer_file _tras_file;
|
||||
char _scelta;
|
||||
@ -143,6 +144,10 @@ bool TVar_mov::create()
|
||||
_pcon = new TLocalisamfile (LF_PCON);
|
||||
_clifo = new TLocalisamfile (LF_CLIFO);
|
||||
_rec_mov = new TRectype (LF_MOV);
|
||||
_mov = new TLocalisamfile (LF_MOV);
|
||||
_rmov = new TLocalisamfile (LF_RMOV);
|
||||
_rmoviva = new TLocalisamfile (LF_RMOVIVA);
|
||||
_tab_reg = new TTable ("REG");
|
||||
|
||||
if (_scelta == 'P')
|
||||
{
|
||||
@ -182,6 +187,10 @@ bool TVar_mov::destroy()
|
||||
delete _rec_mov;
|
||||
delete _pcon;
|
||||
delete _clifo;
|
||||
delete _mov;
|
||||
delete _rmov;
|
||||
delete _rmoviva;
|
||||
delete _tab_reg;
|
||||
|
||||
if (_scelta == 'P')
|
||||
{
|
||||
@ -569,7 +578,7 @@ void TVar_mov::setta_campi_maschera(TMask& m)
|
||||
int gruppo = _trmov->get_int (RMV_GRUPPO);
|
||||
int conto = _trmov->get_int (RMV_CONTO);
|
||||
long sottocon = _trmov->get_long(RMV_SOTTOCONTO);
|
||||
char sezione = _trmov->get_char(RMV_SEZIONE);
|
||||
TString sezione = _trmov->get (RMV_SEZIONE);
|
||||
TString descr = _trmov->get (RMV_DESCR);
|
||||
int gruppoc = _trmov->get_int (RMV_GRUPPOC);
|
||||
int contoc = _trmov->get_int (RMV_CONTOC);
|
||||
@ -918,9 +927,12 @@ bool TVar_mov::controllo_importo(TMask_field& f, KEY k)
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
real importo (f.mask().get(F_IMPORTO));
|
||||
char sezione = f.mask().get(F_SEZIONE)[0];
|
||||
|
||||
if (importo == ZERO)
|
||||
if (importo == ZERO && (sezione == 'A' || sezione == 'D') )
|
||||
return warning_box("L' importo deve essere significativo");
|
||||
if (sezione == '\0' && importo != ZERO)
|
||||
return warning_box("La sezione e' nulla: l'importo non puo' essere significativo");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -131,11 +131,14 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
LIST F_SEZIONE 7
|
||||
LIST F_SEZIONE 9
|
||||
BEGIN
|
||||
PROMPT 1 13 "Sezione "
|
||||
ITEM " |Nessuna"
|
||||
ITEM "D|Dare"
|
||||
ITEM "A|Avere"
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Valore non valido per sezione"
|
||||
END
|
||||
|
||||
STRING F_DESCR 30
|
||||
|
@ -24,16 +24,23 @@ bool TDitta_ric::set()
|
||||
TMask msk ("cg2801a");
|
||||
KEY tasto;
|
||||
|
||||
_old_ditta = get_firm();
|
||||
|
||||
tasto = msk.run();
|
||||
|
||||
if (tasto != K_ENTER) return FALSE;
|
||||
|
||||
_dittaric = msk.get_int(F_CODDITTA);
|
||||
|
||||
if (!esegui_controlli()) return FALSE;
|
||||
|
||||
set_firm(_dittaric);
|
||||
|
||||
if (!esegui_controlli())
|
||||
{
|
||||
set_firm(_old_ditta);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//set_firm(_dittaric);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -79,12 +86,16 @@ bool TDitta_ric::esegui_controlli()
|
||||
|
||||
if (_uselab != " ")
|
||||
return error_box("Ultimo trasferimento NON COMPLETATO: completarlo");
|
||||
}
|
||||
else
|
||||
return error_box("Ultimo trasferimento NON COMPLETATO: completarlo");
|
||||
|
||||
if (!controlli())
|
||||
return FALSE;
|
||||
if (!controlli())
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TConfig cfd (CONFIG_DITTA);
|
||||
|
||||
TString std = cfd.get("FlStTra");
|
||||
if (std == "")
|
||||
return error_box ("Non risultano TRASFERIMENTI ATTIVI sulla ditta richiesta");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -201,12 +212,6 @@ bool TDitta_ric::controlli()
|
||||
if (!_tras_file.write_control_rec(_control_rec, size))
|
||||
return FALSE;
|
||||
|
||||
TConfig cfd (CONFIG_DITTA);
|
||||
|
||||
TString std = cfd.get("FlStTra");
|
||||
if (std == "")
|
||||
return error_box ("Non risultano TRASFERIMENTI ATTIVI sulla ditta richiesta");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ class TDitta_ric : public TApplication
|
||||
TTransfer_file _tras_file;
|
||||
|
||||
TString _trasf,_std,_uselab,_record,_nrec_file,_sigle_file,_key;
|
||||
long _dittaric;
|
||||
long _dittaric, _old_ditta;
|
||||
TString _control_rec;
|
||||
|
||||
public:
|
||||
|
@ -23,6 +23,7 @@ bool TAnn_mov::create()
|
||||
|
||||
_pcon = new TLocalisamfile (LF_PCON);
|
||||
_clifo = new TLocalisamfile (LF_CLIFO);
|
||||
_mov = new TLocalisamfile (LF_MOV);
|
||||
|
||||
TString80 tmpmov = "%";
|
||||
tmpmov << get_firm_dir();
|
||||
@ -49,6 +50,7 @@ bool TAnn_mov::destroy()
|
||||
{
|
||||
delete _pcon;
|
||||
delete _clifo;
|
||||
delete _mov;
|
||||
|
||||
delete _tmov;
|
||||
delete _trmov;
|
||||
|
@ -19,7 +19,7 @@ HIDDEN int date2esc(const TDate& d, int* prevesc = NULL);
|
||||
class TAnn_mov : public TApplication
|
||||
{
|
||||
TIsamtempfile* _tmov,* _trmov,* _tiva;
|
||||
TLocalisamfile* _pcon,* _clifo;
|
||||
TLocalisamfile* _pcon,* _clifo, *_mov;
|
||||
TRectype* _rec_mov;
|
||||
TTransfer_file _tras_file;
|
||||
|
||||
|
@ -62,9 +62,9 @@ bool TVis_ric::stato_hnd (TMask_field& f, KEY k)
|
||||
TString uselab = f.mask().get(F_USELAB);
|
||||
TString chiave = f.mask().get(F_STATO);
|
||||
|
||||
if (!app()._ftrasfer)
|
||||
if (!app()._ftrasfer) //_ftrasfer dice se esiste il file trasfer o il suo record di controllo
|
||||
{
|
||||
if (std != "")
|
||||
if (std != "" && std != "*")
|
||||
return warning_box("Valore non valido per stato ultima ricezione");
|
||||
}
|
||||
else
|
||||
@ -108,7 +108,7 @@ bool TVis_ric::chiave_hnd (TMask_field& f, KEY k)
|
||||
return warning_box("Lo stato ultima ricezione non e' significativo: la chiave ultimo file elaborato non puo' essere significativa");
|
||||
|
||||
if (uselab == "" && chiave != "")
|
||||
return warning_box("La sigla ultimo file elaborato non e' significativo: la chiave ultimo file elaborato non puo' essere significativa");
|
||||
return warning_box("La sigla ultimo file elaborato non e' significativa: la chiave ultimo file elaborato non puo' essere significativa");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -209,6 +209,9 @@ void TVis_ric::registra(TMask& m)
|
||||
flags[6] = '\0';
|
||||
|
||||
TString uselab = m.get(F_USELAB);
|
||||
if (uselab == "")
|
||||
uselab = " ";
|
||||
|
||||
str = m.get(F_STATO);
|
||||
TString chiave = format("%-15s", (const char*) str);
|
||||
|
||||
|
144
cg/cg2900.cpp
144
cg/cg2900.cpp
@ -40,11 +40,11 @@ class TInv_cont : public TApplication
|
||||
TString _control_rec, _trasf, _std, _stato, _marker, _nome_simbolico;
|
||||
TString _files, _codcaus, _numdoc, _reg, _codpag, _tipodoc, _codcausm;
|
||||
TString _ocfpi, _ragsococc, _indocc, _capocc, _localocc, _provocc, _codvali;
|
||||
bool _esiste_ditta, _esiste_record;
|
||||
bool _esiste_ditta, _esiste_record, _inviato;
|
||||
long _ditta, _protiva, _uprotiva, _codcf, _numrec, _tot_rec;
|
||||
long _dim_tot, _dim_disk;
|
||||
int _num;
|
||||
TDate _data, _datadoc, _data74ter;
|
||||
TDate _data, _datadoc, _data74ter,_datalimsk,_dataregiva;
|
||||
real _corrlire, _cambioi, _corrval;
|
||||
|
||||
public:
|
||||
@ -85,6 +85,9 @@ public:
|
||||
|
||||
void aggiorna_marker(TString& token, int pos);
|
||||
void calcola_totale_record();
|
||||
bool controlla_valore(const TString& val, int lim);
|
||||
void primanota_inviata(long numreg);
|
||||
void iva_inviata(long numreg);
|
||||
|
||||
const char* converti (TString& data_AS400);
|
||||
const char* riconverti (TString& data_PC);
|
||||
@ -230,6 +233,8 @@ bool TInv_cont::main_loop()
|
||||
|
||||
if (tasto != K_ENTER) return FALSE;
|
||||
|
||||
_datalimsk = msk.get(F_DATALIM);
|
||||
|
||||
if (!ripartenza)
|
||||
{
|
||||
crea_marker(msk); //Crea il record con le informazioni sul marker
|
||||
@ -895,6 +900,21 @@ bool TInv_cont::invio_contabilita(TMask& m)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TInv_cont::controlla_valore(const TString& val,int lim)
|
||||
{
|
||||
if (real::is_natural(val))
|
||||
{
|
||||
int app = atoi(val);
|
||||
if (app > lim)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
if (val.len() > 1)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TInv_cont::invio_tab_cau(TString& key,TMask& m)
|
||||
{
|
||||
int size = 256;
|
||||
@ -928,8 +948,8 @@ bool TInv_cont::invio_tab_cau(TString& key,TMask& m)
|
||||
|
||||
// Se trovo un codice causale alfanumerico l'invio deve essere interrotto
|
||||
const char* codcau = cau.get(CAU_CODCAUS);
|
||||
if (!real::is_natural(codcau))
|
||||
return error_box("Rilevato un codice causale alfanumerico nella causale %03s: impossibile proseguire",codcau);
|
||||
if (codcau && *codcau && !real::is_natural(codcau) )
|
||||
return error_box("Rilevato un codice causale alfanumerico nella causale %-3s: impossibile proseguire",codcau);
|
||||
str.format("%03s", codcau);
|
||||
record.overwrite("W1",0); //Tipo record
|
||||
record.overwrite(str,2); //Codice causale
|
||||
@ -954,7 +974,7 @@ bool TInv_cont::invio_tab_cau(TString& key,TMask& m)
|
||||
|
||||
//Se trovo un registro IVA con lunghezza maggiore di 1 l'invio deve essere interrotto
|
||||
TString reg = cau.get(CAU_REG);
|
||||
if (reg.len() > 1)
|
||||
if (!controlla_valore(reg,9))
|
||||
return error_box("Rilevato un registro IVA con lunghezza superiore a 1 nella causale %03s: impossibile proseguire", codcau);
|
||||
record.overwrite(reg,37); //Registro IVA
|
||||
|
||||
@ -984,7 +1004,7 @@ bool TInv_cont::invio_tab_cau(TString& key,TMask& m)
|
||||
record.overwrite("0",207);
|
||||
|
||||
const char* codcausim = cau.get(CAU_CODCAUSIM);
|
||||
if (!real::is_natural(codcausim))
|
||||
if (codcausim && *codcausim && !real::is_natural(codcausim) )
|
||||
return error_box("Rilevato un codice causale per incasso immediato alfanumerico nella causale %03s: impossibile proseguire",codcau);
|
||||
str.format("%03s", codcausim);
|
||||
record.overwrite(str,209); //Codice causale per incasso immediato
|
||||
@ -1227,6 +1247,13 @@ bool TInv_cont::invio_clifo(TString& key,TMask& m)
|
||||
record.overwrite(str,77); //Codice fiscale
|
||||
|
||||
TString indcf = clifo.get(CLI_INDCF);
|
||||
TString civcf = clifo.get(CLI_CIVCF);
|
||||
int lind = indcf.len();
|
||||
int lciv = civcf.len();
|
||||
int totlen = lind + lciv + 1;
|
||||
if (totlen < 36)
|
||||
indcf << " " << civcf;
|
||||
|
||||
str.format("%-35s", (const char*) indcf);
|
||||
record.overwrite(str,93); //Indirizzo
|
||||
|
||||
@ -1247,7 +1274,7 @@ bool TInv_cont::invio_clifo(TString& key,TMask& m)
|
||||
TString appoggio;
|
||||
appoggio << ptel << " " << tel;
|
||||
if (appoggio.len() > 12)
|
||||
warning_box("Rilevato numero telefonico troppo lungo in codice %c%d: impossibile inviare",tipo,codice);
|
||||
warning_box("Rilevato numero telefonico troppo lungo in codice %c%ld: impossibile inviare",tipo,codice);
|
||||
else //Numero telefono
|
||||
record.overwrite(appoggio,155);
|
||||
|
||||
@ -1277,7 +1304,7 @@ bool TInv_cont::invio_clifo(TString& key,TMask& m)
|
||||
|
||||
//Se il codice di pagamento e' superiore alle 2 cifre l'invio deve essere interrotto
|
||||
TString codpag = clifo.get(CLI_CODPAG);
|
||||
if (codpag.len() > 2)
|
||||
if (!controlla_valore(codpag,99))
|
||||
return error_box("Rilevato un codice di pagamento composto da 3 o piu' cifre in codice %c%d: impossibile proseguire",tipo,codice);
|
||||
|
||||
str.format("%-2s", (const char*) codpag);
|
||||
@ -1496,7 +1523,7 @@ bool TInv_cont::invio_pcon(TString& key,TMask& m)
|
||||
record.overwrite(str,4); //Conto
|
||||
|
||||
str.format("%06ld", s);
|
||||
record.overwrite(str,6);
|
||||
record.overwrite(str,6); //Sottoconto
|
||||
|
||||
TString descr (pcon.get(PCN_DESCR));
|
||||
str.format("%-.30s", (const char*) descr);
|
||||
@ -1612,6 +1639,7 @@ bool TInv_cont::testata_mov_PN(long numreg)
|
||||
_tipodoc = mov.get (MOV_TIPODOC);
|
||||
_protiva = mov.get_long(MOV_PROTIVA);
|
||||
_uprotiva = mov.get_long(MOV_UPROTIVA);
|
||||
_inviato = mov.get_bool(MOV_INVIATO);
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
@ -1619,6 +1647,20 @@ bool TInv_cont::testata_mov_PN(long numreg)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TInv_cont::primanota_inviata(long numreg)
|
||||
{
|
||||
TLocalisamfile mov (LF_MOV);
|
||||
|
||||
mov.setkey(1);
|
||||
mov.zero();
|
||||
mov.put(MOV_NUMREG, numreg);
|
||||
if (mov.read() == NOERR)
|
||||
{
|
||||
mov.put(MOV_INVIATO, "X");
|
||||
mov.rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
bool TInv_cont::invio_mov_PN(TString& key,TMask& m)
|
||||
{
|
||||
int size = 256;
|
||||
@ -1651,6 +1693,7 @@ bool TInv_cont::invio_mov_PN(TString& key,TMask& m)
|
||||
TString str;
|
||||
|
||||
_prog->addstatus(1);
|
||||
|
||||
_tras_file.open(_trasf);
|
||||
|
||||
record.spaces();
|
||||
@ -1658,6 +1701,13 @@ bool TInv_cont::invio_mov_PN(TString& key,TMask& m)
|
||||
long nreg = rmov.get_long(RMV_NUMREG);
|
||||
int nrig = rmov.get_int (RMV_NUMRIG);
|
||||
|
||||
if (nreg != nreg_p)
|
||||
if (!testata_mov_PN(nreg))
|
||||
return error_box("Rilevata riga mancante di testata: impossibile proseguire");
|
||||
|
||||
if (_inviato) continue; //Se il movimento e' gia' stato inviato non lo posso piu' inviare
|
||||
//cosi' come le sue righe di primanota e iva
|
||||
|
||||
//Salvataggio della chiave sul record di controllo del file trasfer
|
||||
leggi_record_controllo();
|
||||
TString chiave,app;
|
||||
@ -1668,6 +1718,14 @@ bool TInv_cont::invio_mov_PN(TString& key,TMask& m)
|
||||
// _tras_file.write_control_rec(_control_rec,size);
|
||||
// _tras_file.close();
|
||||
|
||||
TDate datareg (rmov.get(RMV_DATAREG));
|
||||
|
||||
TString dataregstr = datareg.string();
|
||||
TString datalimstr = _datalimsk.string();
|
||||
|
||||
if (datareg > _datalimsk) continue; //Se la data di operazione e' maggiore di quella
|
||||
//indicata nella maschera iniziale, il
|
||||
//movimento deve essere scartato.
|
||||
if (nreg > 999999)
|
||||
return error_box("Rilevato un numero di registrazione composto da 7 cifre in %07ld riga %03d: impossibile proseguire",nreg,nrig);
|
||||
|
||||
@ -1682,14 +1740,9 @@ bool TInv_cont::invio_mov_PN(TString& key,TMask& m)
|
||||
str.format("%02d", nrig);
|
||||
record.overwrite(str,8); //Numero di riga
|
||||
|
||||
if (nreg != nreg_p)
|
||||
if (!testata_mov_PN(nreg))
|
||||
return error_box("Rilevata riga mancante di testata: impossibile proseguire");
|
||||
|
||||
nreg_p = nreg;
|
||||
|
||||
TDate datareg (rmov.get(RMV_DATAREG));
|
||||
TString dataregstr = datareg.string();
|
||||
TString datastr = datareg.string();
|
||||
str = riconverti(dataregstr);
|
||||
record.overwrite(str,15); //Data di registrazione
|
||||
|
||||
@ -1712,7 +1765,7 @@ bool TInv_cont::invio_mov_PN(TString& key,TMask& m)
|
||||
str.format("%-7s", (const char*) _numdoc);
|
||||
record.overwrite(str,28);
|
||||
|
||||
if (_reg.len() > 1)
|
||||
if (!controlla_valore(_reg,9))
|
||||
return error_box("Rilevato un codice registro IVA composto da 2 o piu' cifre in %07ld riga %03d: impossibile proseguire",nreg,nrig);
|
||||
record.overwrite(_reg,35); //Codice registro IVA
|
||||
|
||||
@ -1767,7 +1820,7 @@ bool TInv_cont::invio_mov_PN(TString& key,TMask& m)
|
||||
str.format("%06ld", sottocc);
|
||||
record.overwrite(str,89); //Sottoconto di contropartita
|
||||
|
||||
if (_codpag.len() > 2)
|
||||
if (!controlla_valore(_codpag,99))
|
||||
return error_box("Rilevato un codice di pagamento composto da 3 o piu' cifre in %07ld riga %03d: impossibile proseguire",nreg,nrig);
|
||||
str.format("%-2s", (const char*) _codpag);
|
||||
record.overwrite(str,95); //Codice di pagamento
|
||||
@ -1795,6 +1848,8 @@ bool TInv_cont::invio_mov_PN(TString& key,TMask& m)
|
||||
_tras_file.open(_trasf,TRUE);
|
||||
_tras_file.write_control_rec(record,size);
|
||||
_tras_file.close();
|
||||
|
||||
primanota_inviata(nreg);
|
||||
}
|
||||
delete _prog;
|
||||
|
||||
@ -1832,13 +1887,15 @@ bool TInv_cont::testata_mov_IVA(long numreg)
|
||||
mov.put(MOV_NUMREG, numreg);
|
||||
if (mov.read() == NOERR)
|
||||
{
|
||||
_codcf = mov.get_long(MOV_CODCF);
|
||||
_data74ter = mov.get_date(MOV_DATA74TER);
|
||||
_corrlire = mov.get_real(MOV_CORRLIRE);
|
||||
_codvali = mov.get (MOV_CODVALI);
|
||||
_cambioi = mov.get_real(MOV_CAMBIOI);
|
||||
_corrval = mov.get_real(MOV_CORRVALUTA);
|
||||
_ocfpi = mov.get (MOV_OCFPI);
|
||||
_codcf = mov.get_long(MOV_CODCF);
|
||||
_data74ter = mov.get_date(MOV_DATA74TER);
|
||||
_corrlire = mov.get_real(MOV_CORRLIRE);
|
||||
_codvali = mov.get (MOV_CODVALI);
|
||||
_cambioi = mov.get_real(MOV_CAMBIOI);
|
||||
_corrval = mov.get_real(MOV_CORRVALUTA);
|
||||
_ocfpi = mov.get (MOV_OCFPI);
|
||||
_dataregiva = mov.get_date(MOV_DATAREG);
|
||||
_inviato = mov.get_bool(MOV_INVIVA);
|
||||
if (_ocfpi.not_empty())
|
||||
cerca_occasionale();
|
||||
}
|
||||
@ -1848,6 +1905,20 @@ bool TInv_cont::testata_mov_IVA(long numreg)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TInv_cont::iva_inviata(long numreg)
|
||||
{
|
||||
TLocalisamfile mov (LF_MOV);
|
||||
|
||||
mov.setkey(1);
|
||||
mov.zero();
|
||||
mov.put(MOV_NUMREG, numreg);
|
||||
if (mov.read() == NOERR)
|
||||
{
|
||||
mov.put(MOV_INVIVA, "X");
|
||||
mov.rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
void TInv_cont::cerca_occasionale()
|
||||
{
|
||||
TLocalisamfile occas (LF_OCCAS);
|
||||
@ -1920,6 +1991,7 @@ bool TInv_cont::invio_mov_IVA(TString& key,TMask& m)
|
||||
TString str;
|
||||
|
||||
_prog->addstatus(1);
|
||||
|
||||
_tras_file.open(_trasf);
|
||||
|
||||
record.spaces();
|
||||
@ -1927,6 +1999,17 @@ bool TInv_cont::invio_mov_IVA(TString& key,TMask& m)
|
||||
long nreg = rmoviva.get_long(RMI_NUMREG);
|
||||
int nrig = rmoviva.get_int (RMI_NUMRIG);
|
||||
|
||||
if (nreg != nreg_p)
|
||||
{
|
||||
numero_righe = 0;
|
||||
if (!testata_mov_IVA(nreg))
|
||||
return error_box("Rilevata riga mancante di testata: impossibile proseguire");
|
||||
}
|
||||
|
||||
if (_inviato) continue;
|
||||
|
||||
if (_dataregiva > _datalimsk) continue;
|
||||
|
||||
//Salvataggio della chiave sul record di controllo del file trasfer
|
||||
leggi_record_controllo();
|
||||
TString chiave,app;
|
||||
@ -1951,13 +2034,6 @@ bool TInv_cont::invio_mov_IVA(TString& key,TMask& m)
|
||||
str.format("%02d", nrig);
|
||||
record.overwrite(str,8); //Numero di riga
|
||||
|
||||
if (nreg != nreg_p)
|
||||
{
|
||||
numero_righe = 0;
|
||||
if (!testata_mov_IVA(nreg))
|
||||
return error_box("Rilevata riga mancante di testata: impossibile proseguire");
|
||||
}
|
||||
|
||||
numero_righe++;
|
||||
if (numero_righe > 9)
|
||||
return error_box("Rilevata una registrazione IVA con piu' di 9 righe: impossibile proseguire");
|
||||
@ -1973,7 +2049,9 @@ bool TInv_cont::invio_mov_IVA(TString& key,TMask& m)
|
||||
|
||||
//Se trovo un codice iva composto da piu' di 2 cifre l'invio viene interrotto
|
||||
TString codiva (rmoviva.get(RMI_CODIVA));
|
||||
if (codiva.len() > 2)
|
||||
if ( codiva && *codiva && !real::is_natural(codiva) )
|
||||
return error_box("Rilevato un codice IVA alfanumerico in %07ld riga %03d: impossibile proseguire",nreg,nrig);
|
||||
if (!controlla_valore(codiva,99))
|
||||
return error_box("Rilevato un codice IVA composto da 3 o piu' cifre in %07ld riga %03d: impossibile proseguire",nreg,nrig);
|
||||
str.format("%02s", (const char*) codiva);
|
||||
record.overwrite(str,32); //Codice iva
|
||||
@ -2054,6 +2132,8 @@ bool TInv_cont::invio_mov_IVA(TString& key,TMask& m)
|
||||
_tras_file.open(_trasf,TRUE);
|
||||
_tras_file.write_control_rec(record,size);
|
||||
_tras_file.close();
|
||||
|
||||
iva_inviata(nreg);
|
||||
}
|
||||
delete _prog;
|
||||
|
||||
|
@ -184,7 +184,7 @@ long TTransfer_file::start(char sigla)
|
||||
long TTransfer_file::start(int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return 0;
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
TToken_string data = (TToken_string&)_index[i-1];
|
||||
@ -782,6 +782,8 @@ void TMappa_trc::leggi_modulo()
|
||||
{
|
||||
record = s.line();
|
||||
|
||||
if (record.mid(0,1) == "#") continue; //Perche' e' un commento
|
||||
|
||||
TString sigla = record.get(0);
|
||||
long numrec = record.get_long(1);
|
||||
key.format("%2s%d", (const char*)sigla,numrec);
|
||||
@ -820,3 +822,9 @@ int TMappa_trc::flag(const char* key)
|
||||
TToken_string * data = (TToken_string *) objptr(key);
|
||||
return data->get_int(6);
|
||||
}
|
||||
|
||||
int TMappa_trc::flag_bis(const char* key)
|
||||
{
|
||||
TToken_string * data = (TToken_string *) objptr(key);
|
||||
return data->get_int(7);
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ class TMappa_trc : public TAssoc_array
|
||||
int logicnum (const char* key);
|
||||
const char* field_name (const char* key);
|
||||
int flag (const char* key);
|
||||
int flag_bis (const char* key);
|
||||
|
||||
TMappa_trc() {};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user