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;
|
TTable* _tab_tra;
|
||||||
TTransfer_file* _tras_file;
|
TTransfer_file* _tras_file;
|
||||||
|
TLocalisamfile* _mov;
|
||||||
|
TLocalisamfile* _rmov;
|
||||||
|
TLocalisamfile* _rmoviva;
|
||||||
|
|
||||||
TString80 TEMP;
|
TString80 TEMP;
|
||||||
|
|
||||||
@ -30,8 +33,7 @@ class TRic_sistema : public TApplication
|
|||||||
long _dittainv,_dittainvp,_dittaric,_totrectras,_totrectrasp;
|
long _dittainv,_dittainvp,_dittaric,_totrectras,_totrectrasp;
|
||||||
TDate _datatras,_datatrasp,_dataultras_tab,_dataultras;
|
TDate _datatras,_datatrasp,_dataultras_tab,_dataultras;
|
||||||
TString _sigle_file,_nrec_file;
|
TString _sigle_file,_nrec_file;
|
||||||
char _agg_cau,_agg_pcon,_agg_cls,_agg_clifo;
|
char _agg_cau,_agg_pcon,_agg_cls,_agg_clifo,_agg_fatatt,_agg_fatpas;
|
||||||
bool _agg_fatatt,_agg_fatpas;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
@ -65,6 +67,10 @@ bool TRic_sistema::create()
|
|||||||
_tab_tra = new TTable ("%TRA");
|
_tab_tra = new TTable ("%TRA");
|
||||||
_tras_file = new TTransfer_file();
|
_tras_file = new TTransfer_file();
|
||||||
|
|
||||||
|
_mov = new TLocalisamfile (LF_MOV);
|
||||||
|
_rmov = new TLocalisamfile (LF_RMOV);
|
||||||
|
_rmoviva = new TLocalisamfile (LF_RMOVIVA);
|
||||||
|
|
||||||
_numdisk = 1;
|
_numdisk = 1;
|
||||||
_prima_volta = TRUE;
|
_prima_volta = TRUE;
|
||||||
_nultras = 0;
|
_nultras = 0;
|
||||||
@ -81,6 +87,10 @@ bool TRic_sistema::destroy()
|
|||||||
delete _tab_tra;
|
delete _tab_tra;
|
||||||
delete _tras_file;
|
delete _tras_file;
|
||||||
|
|
||||||
|
delete _mov;
|
||||||
|
delete _rmov;
|
||||||
|
delete _rmoviva;
|
||||||
|
|
||||||
return TApplication::destroy();
|
return TApplication::destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +385,7 @@ bool TRic_sistema::video_ripartenza()
|
|||||||
|
|
||||||
bool TRic_sistema::baipassa(TMask& m,KEY k)
|
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;
|
app()._baipassa = TRUE;
|
||||||
else
|
else
|
||||||
app()._baipassa = FALSE;
|
app()._baipassa = FALSE;
|
||||||
@ -413,6 +423,7 @@ long TRic_sistema::leggi_tabella_tras()
|
|||||||
{
|
{
|
||||||
TString dep;
|
TString dep;
|
||||||
long ditta = 0;
|
long ditta = 0;
|
||||||
|
bool agg_fatatt,agg_fatpas;
|
||||||
|
|
||||||
_tab_tra->zero();
|
_tab_tra->zero();
|
||||||
dep = format("%10s%05d", (const char*) _nomeid, _dittainv);
|
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_clifo = _tab_tra->get_char("S1");
|
||||||
_agg_pcon = _tab_tra->get_char("S2");
|
_agg_pcon = _tab_tra->get_char("S2");
|
||||||
_agg_cls = _tab_tra->get_char("S3");
|
_agg_cls = _tab_tra->get_char("S3");
|
||||||
_agg_fatatt = _tab_tra->get_bool("B0");
|
agg_fatatt = _tab_tra->get_bool("B0");
|
||||||
_agg_fatpas = _tab_tra->get_bool("B1");
|
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;
|
return ditta;
|
||||||
@ -490,7 +510,7 @@ bool TRic_sistema::set_flag()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (sigla == "Z" || sigla == "U" || sigla == "A")
|
if (sigla == "Z" || sigla == "U" || sigla == "B")
|
||||||
{
|
{
|
||||||
if (nrec > 0)
|
if (nrec > 0)
|
||||||
{
|
{
|
||||||
@ -504,7 +524,10 @@ bool TRic_sistema::set_flag()
|
|||||||
fatto = FALSE;
|
fatto = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flag == "T")
|
||||||
uselab = sigla;
|
uselab = sigla;
|
||||||
|
else
|
||||||
|
uselab = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sigla == "W" || sigla == "P")
|
if (sigla == "W" || sigla == "P")
|
||||||
|
293
cg/cg2600.cpp
293
cg/cg2600.cpp
@ -19,6 +19,7 @@
|
|||||||
#include <rmoviva.h>
|
#include <rmoviva.h>
|
||||||
#include <pconti.h>
|
#include <pconti.h>
|
||||||
#include <comuni.h>
|
#include <comuni.h>
|
||||||
|
#include <clifo.h>
|
||||||
|
|
||||||
#include "cglib04.h"
|
#include "cglib04.h"
|
||||||
#include "cglib.h"
|
#include "cglib.h"
|
||||||
@ -35,6 +36,7 @@ class TRic_tab : public TApplication
|
|||||||
{
|
{
|
||||||
|
|
||||||
TTable* _tab_tra;
|
TTable* _tab_tra;
|
||||||
|
TLocalisamfile* _mov, *_rmov, *_rmoviva;
|
||||||
TTransfer_file _tras_file;
|
TTransfer_file _tras_file;
|
||||||
TArray _aggiorna;
|
TArray _aggiorna;
|
||||||
char _scelta;
|
char _scelta;
|
||||||
@ -67,24 +69,29 @@ public:
|
|||||||
|
|
||||||
void setta_parametri_record(const TString& sigla,const TString& flag);
|
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 trasferimento();
|
||||||
|
|
||||||
void scrivi_record_tab(TString& record,long rec);
|
void scrivi_record_tab(TString& record,long rec);
|
||||||
int trasfer_data_tab(TLocalisamfile& file, TRectype& dep, const TString& sigla);
|
int trasfer_data_tab(TLocalisamfile& file, TRectype& dep, const TString& sigla);
|
||||||
int trasfer_data_conto(TLocalisamfile& file, TRectype& dep);
|
int trasfer_data_conto(TLocalisamfile& file, TRectype& dep);
|
||||||
int trasfer_data_sottoc(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);
|
void scrivi_record_mov(TString& record,long rec);
|
||||||
int trasfer_data_mov(TLocalisamfile& file, TRectype& dep);
|
int trasfer_data_mov(TLocalisamfile& file, TRectype& dep);
|
||||||
long esiste_numreg(long nreg);
|
long esiste_numreg(long nreg);
|
||||||
void num_protocollo(TString& record);
|
void num_protocollo(TString& record);
|
||||||
void controlli_prima_nota(TString& record);
|
void controlli_prima_nota(TString& record,TString& codreg);
|
||||||
long ulnumprot_reg(int anno,char codreg);
|
long ulnumprot_reg(int anno,TString& codreg);
|
||||||
long ultima_registrazione();
|
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);
|
int annoes_datacomp(const TString& record,TDate& datacomp);
|
||||||
void datafine_esprec(const int annop,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 prepara_saldi(const TString& fname,const TString& field);
|
||||||
|
|
||||||
void scrivi_record_moviva(TString& record,long rec);
|
void scrivi_record_moviva(TString& record,long rec);
|
||||||
@ -121,6 +128,9 @@ bool TRic_tab::create()
|
|||||||
TApplication::create();
|
TApplication::create();
|
||||||
|
|
||||||
_tab_tra = new TTable ("%TRA");
|
_tab_tra = new TTable ("%TRA");
|
||||||
|
_mov = new TLocalisamfile (LF_MOV);
|
||||||
|
_rmov = new TLocalisamfile (LF_RMOV);
|
||||||
|
_rmoviva = new TLocalisamfile (LF_RMOVIVA);
|
||||||
|
|
||||||
_numrec = 1;
|
_numrec = 1;
|
||||||
_prima_volta = TRUE;
|
_prima_volta = TRUE;
|
||||||
@ -138,6 +148,9 @@ bool TRic_tab::create()
|
|||||||
bool TRic_tab::destroy()
|
bool TRic_tab::destroy()
|
||||||
{
|
{
|
||||||
delete _tab_tra;
|
delete _tab_tra;
|
||||||
|
delete _mov;
|
||||||
|
delete _rmov;
|
||||||
|
delete _rmoviva;
|
||||||
|
|
||||||
return TApplication::destroy();
|
return TApplication::destroy();
|
||||||
}
|
}
|
||||||
@ -180,6 +193,60 @@ const char* TRic_tab::riconverti (TString& data_PC)
|
|||||||
return TEMP;
|
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()
|
bool TRic_tab::main_loop()
|
||||||
{
|
{
|
||||||
int posiz;
|
int posiz;
|
||||||
@ -307,7 +374,7 @@ void TRic_tab::trasferimento()
|
|||||||
|
|
||||||
void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
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
|
int numfield = 2; //Per le tabelle il primo campo della mappa non e' significativo
|
||||||
//ai fini del trasferimento (flag di record gia trasferito).
|
//ai fini del trasferimento (flag di record gia trasferito).
|
||||||
TMappa_trc& trc = _tras_file.mappa();
|
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 campi_righe = 0;
|
||||||
int num_riga = 1;
|
int num_riga = 1;
|
||||||
TToken_string data;
|
TToken_string data;
|
||||||
|
TString cap = "";
|
||||||
|
|
||||||
sigla = record.mid(0,2);
|
sigla = record.mid(0,2);
|
||||||
gia_trasf = record.mid(255,1)[0];
|
gia_trasf = record.mid(255,1)[0];
|
||||||
@ -344,6 +412,9 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
|||||||
delete dep;
|
delete dep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( (logicnum == LF_RCAUSALI) && (_tras_file.flg_agg() == 'D') )
|
||||||
|
break;
|
||||||
|
|
||||||
file = new TLocalisamfile(logicnum);
|
file = new TLocalisamfile(logicnum);
|
||||||
dep = new TRectype (logicnum);
|
dep = new TRectype (logicnum);
|
||||||
dep->zero();
|
dep->zero();
|
||||||
@ -369,6 +440,9 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
|||||||
|
|
||||||
trasfer_data_tab(*file, *dep, sigla);
|
trasfer_data_tab(*file, *dep, sigla);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
num_riga++;
|
||||||
|
|
||||||
campi_righe = 1;
|
campi_righe = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -381,7 +455,9 @@ 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
|
//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.
|
//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)
|
||||||
|
{
|
||||||
|
if (fname == "REG")
|
||||||
{
|
{
|
||||||
char f = field[0];
|
char f = field[0];
|
||||||
if (isdigit(f))
|
if (isdigit(f))
|
||||||
@ -390,6 +466,24 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
|||||||
field.format("%-3c", f);
|
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
|
//Il tipo cliente/fornitore presente su AS400 puo' assumere come valori 1 o 2
|
||||||
//mentre quello su PC C o F; devo fare la conversione.
|
//mentre quello su PC C o F; devo fare la conversione.
|
||||||
if (sigla == "A1")
|
if (sigla == "A1")
|
||||||
@ -424,15 +518,74 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
|||||||
else
|
else
|
||||||
field.format("%-4s", (const char*) f);
|
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 (flag)
|
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 && (_tras_file.flg_agg() == 'D') )
|
||||||
{
|
{
|
||||||
data = "";
|
data = "";
|
||||||
data.add(fname);
|
data.add(fname);
|
||||||
data.add(field);
|
data.add(field);
|
||||||
|
|
||||||
_aggiorna.add(data);
|
_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,
|
//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.
|
//vuoto la stringa prima di fare la put.
|
||||||
if (sigla == "P2" || sigla == "P3")
|
if (sigla == "P2" || sigla == "P3")
|
||||||
{
|
{
|
||||||
|
if (fname == "STSOTTBIL")
|
||||||
|
{
|
||||||
|
if (field == "0")
|
||||||
|
field = "X";
|
||||||
|
else
|
||||||
|
if (field == "1")
|
||||||
|
field = " ";
|
||||||
|
}
|
||||||
|
|
||||||
if (fname == "NUMRIVD" || fname == "NUMRIVDOPP")
|
if (fname == "NUMRIVD" || fname == "NUMRIVDOPP")
|
||||||
{
|
{
|
||||||
if (field == "000")
|
if (field == "000")
|
||||||
@ -451,6 +613,7 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
|||||||
field = "0";
|
field = "0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dep->put(fname, (const char*)field);
|
dep->put(fname, (const char*)field);
|
||||||
|
|
||||||
numfield++;
|
numfield++;
|
||||||
@ -459,6 +622,8 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
|||||||
while (trc.is_key((const char*) key));
|
while (trc.is_key((const char*) key));
|
||||||
|
|
||||||
if (logicnum == LF_RCAUSALI)
|
if (logicnum == LF_RCAUSALI)
|
||||||
|
{
|
||||||
|
if (_tras_file.flg_agg() != 'D')
|
||||||
{
|
{
|
||||||
campi_righe++;
|
campi_righe++;
|
||||||
|
|
||||||
@ -475,9 +640,13 @@ void TRic_tab::scrivi_record_tab(TString& record,long rec)
|
|||||||
dep->put("NRIGA", num_riga++);
|
dep->put("NRIGA", num_riga++);
|
||||||
trasfer_data_tab(*file, *dep, sigla);
|
trasfer_data_tab(*file, *dep, sigla);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
num_riga++;
|
||||||
|
|
||||||
campi_righe = 1;
|
campi_righe = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_prog->addstatus(1);
|
_prog->addstatus(1);
|
||||||
@ -528,6 +697,8 @@ int TRic_tab::trasfer_data_tab(TLocalisamfile& file, TRectype& dep, const TStrin
|
|||||||
file.rewrite();
|
file.rewrite();
|
||||||
}
|
}
|
||||||
if (flag == 'D')
|
if (flag == 'D')
|
||||||
|
{
|
||||||
|
if (file.num() != LF_RCAUSALI)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _aggiorna.items(); i++)
|
for (int i = 0; i < _aggiorna.items(); i++)
|
||||||
{
|
{
|
||||||
@ -537,6 +708,8 @@ int TRic_tab::trasfer_data_tab(TLocalisamfile& file, TRectype& dep, const TStrin
|
|||||||
file.put(fname,field);
|
file.put(fname,field);
|
||||||
}
|
}
|
||||||
file.rewrite();
|
file.rewrite();
|
||||||
|
_aggiorna.destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -755,35 +928,23 @@ void TRic_tab::num_protocollo(TString& record)
|
|||||||
_nuprotiva = _uprotiva;
|
_nuprotiva = _uprotiva;
|
||||||
}
|
}
|
||||||
|
|
||||||
long TRic_tab::ulnumprot_reg(int anno,char codreg)
|
long TRic_tab::ulnumprot_reg(int anno,TString& cr)
|
||||||
{
|
{
|
||||||
/*
|
//TString cr = format("%c", codreg);
|
||||||
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);
|
|
||||||
TRegistro rg (cr, anno);
|
TRegistro rg (cr, anno);
|
||||||
|
|
||||||
return rg.protocol();
|
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");
|
TTable reg ("REG");
|
||||||
TString16 dep;
|
TString16 dep;
|
||||||
|
|
||||||
if (isdigit(codreg))
|
if (real::is_natural(codreg))
|
||||||
dep.format("%04d%03c", anno,codreg);
|
dep.format("%04d%03s", anno,(const char*) codreg);
|
||||||
else
|
else
|
||||||
dep.format("%04d%-3c", anno,codreg);
|
dep.format("%04d%-3s", anno,(const char*) codreg);
|
||||||
|
|
||||||
reg.zero();
|
reg.zero();
|
||||||
reg.put("CODTAB", (const char*) dep);
|
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");
|
TTable tpd ("%TPD");
|
||||||
bool corrisp;
|
bool corrisp;
|
||||||
TDate datareg;
|
TDate datareg;
|
||||||
int anno;
|
int anno;
|
||||||
long ulnum;
|
long ulnum = 0;
|
||||||
TString16 tmp;
|
TString16 tmp;
|
||||||
char codreg;
|
|
||||||
TString tipodoc;
|
TString tipodoc;
|
||||||
|
|
||||||
// char codreg = record.sub(35,36)[0];
|
|
||||||
// TString tipodoc = record.sub(220,222);
|
|
||||||
|
|
||||||
int tiporeg = atoi(record.sub(222,223));
|
int tiporeg = atoi(record.sub(222,223));
|
||||||
|
|
||||||
TString80 tmpmov = "%";
|
TString80 tmpmov = "%";
|
||||||
@ -825,7 +982,7 @@ void TRic_tab::controlli_prima_nota(TString& record)
|
|||||||
tmp_mov.put(MOV_NUMREG, _numreg);
|
tmp_mov.put(MOV_NUMREG, _numreg);
|
||||||
if (tmp_mov.read() == NOERR)
|
if (tmp_mov.read() == NOERR)
|
||||||
{
|
{
|
||||||
codreg = tmp_mov.get_char(MOV_REG);
|
codreg = tmp_mov.get(MOV_REG);
|
||||||
tipodoc = tmp_mov.get(MOV_TIPODOC);
|
tipodoc = tmp_mov.get(MOV_TIPODOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -842,7 +999,7 @@ void TRic_tab::controlli_prima_nota(TString& record)
|
|||||||
if (tpd.read() == NOERR)
|
if (tpd.read() == NOERR)
|
||||||
corrisp = tpd.get_bool("B0");
|
corrisp = tpd.get_bool("B0");
|
||||||
|
|
||||||
if (codreg != ' ' && !corrisp)
|
if (codreg != "" && !corrisp)
|
||||||
{
|
{
|
||||||
if ( ( (tiporeg == 1 && (numprot_att || _protiva == 0) ) )
|
if ( ( (tiporeg == 1 && (numprot_att || _protiva == 0) ) )
|
||||||
|| ( (tiporeg == 2 && (numprot_pas || _protiva == 0) ) ) )
|
|| ( (tiporeg == 2 && (numprot_pas || _protiva == 0) ) ) )
|
||||||
@ -904,18 +1061,19 @@ long TRic_tab::ultima_registrazione()
|
|||||||
return _nreg;
|
return _nreg;
|
||||||
}
|
}
|
||||||
|
|
||||||
char TRic_tab::ricerca_causale(const TString& causale)
|
char TRic_tab::ricerca_causale(TString& causale)
|
||||||
{
|
{
|
||||||
TLocalisamfile cau (LF_CAUSALI);
|
TLocalisamfile cau (LF_CAUSALI);
|
||||||
TString codcau;
|
|
||||||
char movap = ' ';
|
char movap = ' ';
|
||||||
|
|
||||||
long caus = atol(causale);
|
if (real::is_natural(causale))
|
||||||
codcau.format("%03d", caus);
|
causale.format("%03s", (const char*) causale);
|
||||||
|
else
|
||||||
|
causale.format("%-3s", (const char*) causale);
|
||||||
|
|
||||||
cau.setkey(1);
|
cau.setkey(1);
|
||||||
cau.zero();
|
cau.zero();
|
||||||
cau.put("CODCAUS", codcau);
|
cau.put("CODCAUS", causale);
|
||||||
if (cau.read() == NOERR)
|
if (cau.read() == NOERR)
|
||||||
movap = cau.get_char("MOVAP");
|
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)
|
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
|
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).
|
//ai fini del trasferimento (flag record gia trasferito e nuovo ultimo numero di registrazione).
|
||||||
TMappa_trc& trc = _tras_file.mappa();
|
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
|
numulreg = ultima_registrazione(); //reperisco il numero ultima registrazione
|
||||||
_nreg = esiste_numreg(numulreg);
|
_nreg = esiste_numreg(numulreg);
|
||||||
num_protocollo(record);
|
num_protocollo(record);
|
||||||
controlli_prima_nota(record);
|
controlli_prima_nota(record,codreg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1043,18 +1201,25 @@ void TRic_tab::scrivi_record_mov(TString& record,long rec)
|
|||||||
TString fname = trc.field_name(key);
|
TString fname = trc.field_name(key);
|
||||||
TString field = record.sub(from-1,to);
|
TString field = record.sub(from-1,to);
|
||||||
int flag = trc.flag(key);
|
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 (logicnum == LF_MOV)
|
||||||
{
|
{
|
||||||
if (fname == "REG")
|
if (fname == "REG")
|
||||||
{
|
{
|
||||||
char f = field[0];
|
if (real::is_natural(codreg))
|
||||||
if (isdigit(f))
|
field.format("%03s", (const char*) codreg);
|
||||||
field.format("%03c", f);
|
|
||||||
else
|
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
|
//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);
|
_sld.set_movap(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logicnum == LF_MOV && (fname == "NUMREG" || flag == 1) )
|
if (logicnum == LF_MOV && (fname == "NUMREG" || flag == 2) )
|
||||||
{
|
{
|
||||||
if (fname == "NUMREG")
|
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_DATAREG, _datareg);
|
||||||
dep->put(MOV_DATACOMP, datacomp);
|
dep->put(MOV_DATACOMP, datacomp);
|
||||||
}
|
}
|
||||||
if (flag == 1)
|
if (flag == 2)
|
||||||
{
|
{
|
||||||
TString f = converti(field);
|
TString f = converti(field);
|
||||||
dep->put(fname,f);
|
dep->put(fname,f);
|
||||||
@ -1129,7 +1294,7 @@ void TRic_tab::scrivi_record_mov(TString& record,long rec)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dep->put(fname, (const char*)field);
|
dep->put(fname, field);
|
||||||
|
|
||||||
numfield++;
|
numfield++;
|
||||||
key.format("%2s%d", (const char*) sigla,numfield);
|
key.format("%2s%d", (const char*) sigla,numfield);
|
||||||
@ -1393,6 +1558,13 @@ void TRic_tab::salva_dati_testata()
|
|||||||
_tras_file.write(numrec);
|
_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)
|
void TRic_tab::scrivi_record_moviva(TString& record,long rec)
|
||||||
{
|
{
|
||||||
TString sigla,key,str;
|
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 fname = trc.field_name(key);
|
||||||
TString field = record.sub(from-1,to);
|
TString field = record.sub(from-1,to);
|
||||||
int flag = trc.flag(key);
|
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();
|
numfield++;
|
||||||
int p = l - flag;
|
key.format("%2s%d", (const char*) sigla,numfield);
|
||||||
field.insert(".",p);
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logicnum == LF_MOV && fname == "CORRVALUTA" && flag == 5)
|
if (flag == 3)
|
||||||
{
|
{
|
||||||
int l = field.len();
|
if (dec > 0)
|
||||||
int p = l -flag;
|
decimali(field,dec);
|
||||||
field.insert(".",p);
|
|
||||||
|
real appoggio (field);
|
||||||
|
field = appoggio.string();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logicnum == LF_MOV && ( fname == "NUMREG" || flag == 1 ) )
|
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);
|
dep->put("NUMREG", _nreg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dep->put(fname, (const char*)field);
|
dep->put(fname, field);
|
||||||
|
|
||||||
numfield++;
|
numfield++;
|
||||||
key.format("%2s%d", (const char*) sigla,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));
|
TDate data74ter (dep.get_date(MOV_DATA74TER));
|
||||||
TString codval (dep.get (MOV_CODVAL));
|
TString codval (dep.get (MOV_CODVAL));
|
||||||
long codcf = dep.get_long(MOV_CODCF);
|
long codcf = dep.get_long(MOV_CODCF);
|
||||||
real totdoc (dep.get_real(MOV_TOTDOC));
|
|
||||||
real cambioi (dep.get_real(MOV_CAMBIOI));
|
real cambioi (dep.get_real(MOV_CAMBIOI));
|
||||||
real corrlire (dep.get_real(MOV_CORRLIRE));
|
real corrlire (dep.get_real(MOV_CORRLIRE));
|
||||||
real corrvaluta(dep.get_real(MOV_CORRVALUTA));
|
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_DATA74TER, data74ter);
|
||||||
file.put(MOV_CODVAL, codval);
|
file.put(MOV_CODVAL, codval);
|
||||||
file.put(MOV_CODCF, codcf);
|
file.put(MOV_CODCF, codcf);
|
||||||
file.put(MOV_TOTDOC, totdoc);
|
|
||||||
file.put(MOV_CAMBIOI, cambioi);
|
file.put(MOV_CAMBIOI, cambioi);
|
||||||
file.put(MOV_CORRLIRE, corrlire);
|
file.put(MOV_CORRLIRE, corrlire);
|
||||||
file.put(MOV_CORRVALUTA,corrvaluta);
|
file.put(MOV_CORRVALUTA,corrvaluta);
|
||||||
|
189
cg/cg2700.cpp
189
cg/cg2700.cpp
@ -1,6 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Ricezione dati: lista controllo movimenti
|
// Ricezione dati: lista controllo movimenti
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
@ -23,9 +24,9 @@
|
|||||||
#include "cg2700.h"
|
#include "cg2700.h"
|
||||||
|
|
||||||
HIDDEN const char* err_msg[] = {"*** Data operazione non valida",
|
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 valida",
|
||||||
"--- Data competenza non compresa in alcun esercizio",
|
"*** Data competenza non compresa in alcun esercizio",
|
||||||
"--- Data competenza incompatibile con data operazione",
|
"--- Data competenza incompatibile con data operazione",
|
||||||
"*** Data operazione antecedente ad ultima stampa giornale",
|
"*** Data operazione antecedente ad ultima stampa giornale",
|
||||||
"--- Data documento non valida",
|
"--- Data documento non valida",
|
||||||
@ -40,9 +41,9 @@ HIDDEN int date2esc(const TDate& d, int* prevesc = NULL);
|
|||||||
|
|
||||||
class TRic_ListaMov : public TPrintapp
|
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;
|
TIsamtempfile* _tmov,* _trmov,* _tiva;
|
||||||
TLocalisamfile* _caus,* _ditte,* _clifo,* _pcon;
|
TLocalisamfile* _caus,* _ditte,* _clifo,* _pcon, *_mov, *_rmov, *_rmoviva;
|
||||||
TRelation* _rel;
|
TRelation* _rel;
|
||||||
TCursor* _cur;
|
TCursor* _cur;
|
||||||
TTransfer_file* _trasfer;
|
TTransfer_file* _trasfer;
|
||||||
@ -51,7 +52,7 @@ class TRic_ListaMov : public TPrintapp
|
|||||||
TString16 _causale, _registro, _numdoc, _tipodoc, _codval;
|
TString16 _causale, _registro, _numdoc, _tipodoc, _codval;
|
||||||
TString16 _codpag, _codiva, _tipo_conto;
|
TString16 _codpag, _codiva, _tipo_conto;
|
||||||
TString _record;
|
TString _record;
|
||||||
bool _mov_sez, _errore_grave, _esiste_conto, _esiste_causale;
|
bool _mov_sez, _errore_grave, _esiste_conto;
|
||||||
char _sdt, _sezione;
|
char _sdt, _sezione;
|
||||||
int _ae, _anno, _gruppo, _conto, _tipocr, _tipod, _tiporeg;
|
int _ae, _anno, _gruppo, _conto, _tipocr, _tipod, _tiporeg;
|
||||||
int _gruppoc, _contoc, _n_rec, _gruppocr, _contocr;
|
int _gruppoc, _contoc, _n_rec, _gruppocr, _contocr;
|
||||||
@ -212,10 +213,14 @@ bool TRic_ListaMov::user_create()
|
|||||||
_tab_tpd = new TTable ("%TPD");
|
_tab_tpd = new TTable ("%TPD");
|
||||||
_tab_pag = new TTable ("%CPG");
|
_tab_pag = new TTable ("%CPG");
|
||||||
_tab_iva = new TTable ("%IVA");
|
_tab_iva = new TTable ("%IVA");
|
||||||
|
_tab_ese = new TTable ("ESC");
|
||||||
_caus = new TLocalisamfile (LF_CAUSALI);
|
_caus = new TLocalisamfile (LF_CAUSALI);
|
||||||
_ditte = new TLocalisamfile (LF_NDITTE);
|
_ditte = new TLocalisamfile (LF_NDITTE);
|
||||||
_clifo = new TLocalisamfile (LF_CLIFO);
|
_clifo = new TLocalisamfile (LF_CLIFO);
|
||||||
_pcon = new TLocalisamfile (LF_PCON);
|
_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);
|
if (pnd) pnd->addstatus(1);
|
||||||
|
|
||||||
@ -331,7 +336,7 @@ bool TRic_ListaMov::controlla_mov()
|
|||||||
bool check_reg = TRUE;
|
bool check_reg = TRUE;
|
||||||
TString16 causreg;
|
TString16 causreg;
|
||||||
TDate udata;
|
TDate udata;
|
||||||
char tipocf;
|
char tipocf = ' ';
|
||||||
|
|
||||||
_tiporeg = 0;
|
_tiporeg = 0;
|
||||||
|
|
||||||
@ -346,12 +351,18 @@ bool TRic_ListaMov::controlla_mov()
|
|||||||
int pr;
|
int pr;
|
||||||
const int ar = date2esc(_datareg, &pr); // Esercizio in corso
|
const int ar = date2esc(_datareg, &pr); // Esercizio in corso
|
||||||
if (ar == 0)
|
if (ar == 0)
|
||||||
|
{
|
||||||
_err.set(1);
|
_err.set(1);
|
||||||
|
_errore_grave = TRUE;
|
||||||
|
}
|
||||||
if (_datacomp.ok())
|
if (_datacomp.ok())
|
||||||
{
|
{
|
||||||
const int ae = date2esc(_datacomp);
|
const int ae = date2esc(_datacomp);
|
||||||
if (ae == 0)
|
if (ae == 0)
|
||||||
|
{
|
||||||
_err.set(3);
|
_err.set(3);
|
||||||
|
_errore_grave = TRUE;
|
||||||
|
}
|
||||||
else if (ae != ar && ae != pr && ar)
|
else if (ae != ar && ae != pr && ar)
|
||||||
_err.set(4);
|
_err.set(4);
|
||||||
}
|
}
|
||||||
@ -383,14 +394,10 @@ bool TRic_ListaMov::controlla_mov()
|
|||||||
caus.zero();
|
caus.zero();
|
||||||
caus.put(CAU_CODCAUS,_causale);
|
caus.put(CAU_CODCAUS,_causale);
|
||||||
if (caus.read() == NOERR)
|
if (caus.read() == NOERR)
|
||||||
{
|
|
||||||
_esiste_causale = TRUE;
|
|
||||||
_tipodoc = caus.get(CAU_TIPODOC);
|
_tipodoc = caus.get(CAU_TIPODOC);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
caus.zero();
|
caus.zero();
|
||||||
_esiste_causale = FALSE;
|
|
||||||
if (look_causale(_causale)) //se la causale e' significativa
|
if (look_causale(_causale)) //se la causale e' significativa
|
||||||
{
|
{
|
||||||
_errore_grave = TRUE;
|
_errore_grave = TRUE;
|
||||||
@ -451,12 +458,12 @@ bool TRic_ListaMov::controlla_mov()
|
|||||||
_registro = causreg;
|
_registro = causreg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_reg && !_registro.blank())
|
if (!_registro.blank())
|
||||||
{
|
{
|
||||||
if (_tiporeg == 1) tipocf = 'C';
|
if (_tiporeg == 1) tipocf = 'C';
|
||||||
else if (_tiporeg == 2) tipocf = 'F';
|
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");
|
TTable tabtpd("%TPD");
|
||||||
tabtpd.put("CODTAB", _tipodoc);
|
tabtpd.put("CODTAB", _tipodoc);
|
||||||
if (tabtpd.read() == NOERR)
|
if (tabtpd.read() == NOERR)
|
||||||
@ -481,8 +488,28 @@ bool TRic_ListaMov::controlla_mov()
|
|||||||
_err.set(10);
|
_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();
|
TString16 d74 = _data74tr.string();
|
||||||
if (d74.not_empty())
|
if (d74.not_empty())
|
||||||
@ -567,6 +594,19 @@ bool TRic_ListaMov::controlla_rmov()
|
|||||||
sezione = rec.get_char(RMV_SEZIONE);
|
sezione = rec.get_char(RMV_SEZIONE);
|
||||||
importo = rec.get_real(RMV_IMPORTO);
|
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')
|
if (sezione == 'D')
|
||||||
dare += importo;
|
dare += importo;
|
||||||
if (sezione == 'A')
|
if (sezione == 'A')
|
||||||
@ -587,21 +627,13 @@ bool TRic_ListaMov::controlla_rmov()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (importo == ZERO && sezione != ' ') ||
|
if ( (importo != ZERO && sezione == '\0') ||
|
||||||
(sezione != 'D' && sezione != 'A') )
|
(sezione != 'D' && sezione != 'A' && sezione != '\0') )
|
||||||
{
|
{
|
||||||
rmov.readat(nrec);
|
rmov.readat(nrec);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (gruppoc == 0 || contoc == 0 || sottocontoc == 0l)
|
|
||||||
{
|
|
||||||
rmov.readat(nrec);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*/
|
|
||||||
if (gruppoc != 0 || contoc != 0 || sottocontoc != 0l)
|
if (gruppoc != 0 || contoc != 0 || sottocontoc != 0l)
|
||||||
{
|
{
|
||||||
bool ok = errori_partita(gruppoc,contoc,sottocontoc);
|
bool ok = errori_partita(gruppoc,contoc,sottocontoc);
|
||||||
@ -612,7 +644,6 @@ bool TRic_ListaMov::controlla_rmov()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_esiste_causale)
|
|
||||||
if (!_mov_sez && importo == ZERO)
|
if (!_mov_sez && importo == ZERO)
|
||||||
{
|
{
|
||||||
rmov.readat(nrec);
|
rmov.readat(nrec);
|
||||||
@ -645,8 +676,8 @@ void TRic_ListaMov::stampa_errori_rmov(int riga)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (_importo == ZERO && _sezione != ' ') ||
|
if ( (_importo != ZERO && _sezione == '\0') ||
|
||||||
(_sezione != 'D' && _sezione != 'A') )
|
(_sezione != 'D' && _sezione != 'A' && _sezione != '\0') )
|
||||||
{
|
{
|
||||||
_errore_grave = TRUE;
|
_errore_grave = TRUE;
|
||||||
set_row(++riga, "@8g*** Segnale dare/avere non valido");
|
set_row(++riga, "@8g*** Segnale dare/avere non valido");
|
||||||
@ -663,13 +694,9 @@ void TRic_ListaMov::stampa_errori_rmov(int riga)
|
|||||||
{
|
{
|
||||||
bool ok = errori_partita(_gruppoc,_contoc,_sottocontoc);
|
bool ok = errori_partita(_gruppoc,_contoc,_sottocontoc);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
set_row(++riga, "@8g--- Sottoconto contropartita non valido o non presente in archivio");
|
||||||
_errore_grave = TRUE;
|
|
||||||
set_row(++riga, "@8g*** Sottoconto contropartita non valido o non presente in archivio");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_esiste_causale)
|
|
||||||
if (!_mov_sez && _importo == ZERO)
|
if (!_mov_sez && _importo == ZERO)
|
||||||
set_row(++riga, "@8g--- Importo riga uguale a zero");
|
set_row(++riga, "@8g--- Importo riga uguale a zero");
|
||||||
}
|
}
|
||||||
@ -681,6 +708,7 @@ bool TRic_ListaMov::controlla_riva()
|
|||||||
TString16 codiva;
|
TString16 codiva;
|
||||||
int tipodet, tipocr, gruppocr, contocr;
|
int tipodet, tipocr, gruppocr, contocr;
|
||||||
long sottocontocr;
|
long sottocontocr;
|
||||||
|
real impo, impos;
|
||||||
|
|
||||||
if (current_cursor()->is_first_match(LF_RMOVIVA))
|
if (current_cursor()->is_first_match(LF_RMOVIVA))
|
||||||
{
|
{
|
||||||
@ -693,12 +721,42 @@ bool TRic_ListaMov::controlla_riva()
|
|||||||
{
|
{
|
||||||
TRectype rec (rmoviva.curr());
|
TRectype rec (rmoviva.curr());
|
||||||
if (rec > recc) break;
|
if (rec > recc) break;
|
||||||
|
_n_rec = rec.get_int(RMI_ANNOES);
|
||||||
codiva = rec.get(RMI_CODIVA);
|
codiva = rec.get(RMI_CODIVA);
|
||||||
tipodet = rec.get_int(RMI_TIPODET);
|
tipodet = rec.get_int(RMI_TIPODET);
|
||||||
tipocr = rec.get_int(RMI_TIPOCR);
|
tipocr = rec.get_int(RMI_TIPOCR);
|
||||||
gruppocr = rec.get_int(RMI_GRUPPO);
|
gruppocr = rec.get_int(RMI_GRUPPO);
|
||||||
contocr = rec.get_int(RMI_CONTO);
|
contocr = rec.get_int(RMI_CONTO);
|
||||||
sottocontocr = rec.get_long(RMI_SOTTOCONTO);
|
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");
|
TTable iva ("%IVA");
|
||||||
iva.zero();
|
iva.zero();
|
||||||
@ -713,17 +771,6 @@ bool TRic_ListaMov::controlla_riva()
|
|||||||
rmoviva.readat(nrec);
|
rmoviva.readat(nrec);
|
||||||
return TRUE;
|
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)
|
if (gruppocr == 0 || contocr == 0 || sottocontocr == 0l)
|
||||||
{
|
{
|
||||||
rmoviva.readat(nrec);
|
rmoviva.readat(nrec);
|
||||||
@ -762,18 +809,12 @@ void TRic_ListaMov::stampa_errori_riva(int riga)
|
|||||||
set_row(++riga, "@8g--- Tipo costo/ricavo non valido");
|
set_row(++riga, "@8g--- Tipo costo/ricavo non valido");
|
||||||
|
|
||||||
if (_gruppocr == 0 || _contocr == 0 || _sottocontocr == 0l)
|
if (_gruppocr == 0 || _contocr == 0 || _sottocontocr == 0l)
|
||||||
{
|
set_row(++riga, "@8g--- Sottoconto costo/ricavo non valido o non presente in archivio");
|
||||||
_errore_grave = TRUE;
|
|
||||||
set_row(++riga, "@8g*** Sottoconto costo/ricavo non valido o non presente in archivio");
|
|
||||||
}
|
|
||||||
else if (_gruppocr != 0 && _contocr != 0 && _sottocontocr != 0l)
|
else if (_gruppocr != 0 && _contocr != 0 && _sottocontocr != 0l)
|
||||||
{
|
{
|
||||||
bool ok = errori_partita(_gruppocr,_contocr,_sottocontocr);
|
bool ok = errori_partita(_gruppocr,_contocr,_sottocontocr);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
set_row(++riga, "@8g--- Sottoconto costo/ricavo non valido o non presente in archivio");
|
||||||
_errore_grave = TRUE;
|
|
||||||
set_row(++riga, "@8g*** Sottoconto costo/ricavo non valido o non presente in archivio");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tipod != 0 && _tipod != 1 && _tipod != 3 && _tipod != 9)
|
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);
|
_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 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 ||
|
if ( (_controllo == 1 && controlla) || _controllo == 2 ||
|
||||||
(_controllo == 1 && verifica) )
|
(_controllo == 1 && verifica) )
|
||||||
@ -867,6 +910,7 @@ bool TRic_ListaMov::preprocess_page(int file,int counter)
|
|||||||
_esiste_conto = FALSE;
|
_esiste_conto = FALSE;
|
||||||
_descr_conto = "";
|
_descr_conto = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
int r = 1;
|
int r = 1;
|
||||||
set_row(r, "P%d", numrig);
|
set_row(r, "P%d", numrig);
|
||||||
set_row(r, "@5g%3s %-.20s @30g%-.24s @56g%03d %03d %06ld @71g%-.28s", (const char*) _causale,
|
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);
|
_tipocr = cur->curr(LF_RMOVIVA).get_int(RMI_TIPOCR);
|
||||||
_tipod = cur->curr(LF_RMOVIVA).get_int(RMI_TIPODET);
|
_tipod = cur->curr(LF_RMOVIVA).get_int(RMI_TIPODET);
|
||||||
_codiva = cur->curr(LF_RMOVIVA).get(RMI_CODIVA);
|
_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);
|
_gruppocr = cur->curr(LF_RMOVIVA).get_int(RMI_GRUPPO);
|
||||||
_contocr = cur->curr(LF_RMOVIVA).get_int(RMI_CONTO);
|
_contocr = cur->curr(LF_RMOVIVA).get_int(RMI_CONTO);
|
||||||
_sottocontocr = cur->curr(LF_RMOVIVA).get_long(RMI_SOTTOCONTO);
|
_sottocontocr = cur->curr(LF_RMOVIVA).get_long(RMI_SOTTOCONTO);
|
||||||
|
|
||||||
TString80 codiva_des(get_codiva_des(_codiva));
|
TString80 codiva_des(get_codiva_des(_codiva));
|
||||||
|
|
||||||
_tot_doc += impo + impos;
|
//_tot_doc += impo + impos;
|
||||||
|
|
||||||
_impo = impo;
|
_impo = impo;
|
||||||
_impos = impos;
|
_impos = impos;
|
||||||
|
|
||||||
@ -916,8 +961,13 @@ bool TRic_ListaMov::preprocess_page(int file,int counter)
|
|||||||
|
|
||||||
int r = 1;
|
int r = 1;
|
||||||
set_row(r, "I%d", numrig);
|
set_row(r, "I%d", numrig);
|
||||||
set_row(r, "@5gImponibile %r Imposta %r Codice %4s %-50s %d",
|
set_row(r, "@5gImponibile@16g%r",&_impo);
|
||||||
&_impo, &_impos, (const char*) _codiva, (const char*) codiva_des, _tipod);
|
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);
|
stampa_errori_riva(r);
|
||||||
}
|
}
|
||||||
@ -929,7 +979,7 @@ print_action TRic_ListaMov::postprocess_page(int file,int count)
|
|||||||
if (count) return NEXT_PAGE;
|
if (count) return NEXT_PAGE;
|
||||||
if (file == LF_MOV)
|
if (file == LF_MOV)
|
||||||
{
|
{
|
||||||
aggiorna_trasfer_Z();
|
// aggiorna_trasfer_Z();
|
||||||
reset_print();
|
reset_print();
|
||||||
_err.reset();
|
_err.reset();
|
||||||
int n = 1;
|
int n = 1;
|
||||||
@ -941,9 +991,10 @@ print_action TRic_ListaMov::postprocess_page(int file,int count)
|
|||||||
return REPEAT_PAGE;
|
return REPEAT_PAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (file == LF_RMOVIVA)
|
if (file == LF_RMOVIVA)
|
||||||
aggiorna_trasfer_U();
|
aggiorna_trasfer_U();
|
||||||
|
*/
|
||||||
return NEXT_PAGE;
|
return NEXT_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,11 +1021,11 @@ void TRic_ListaMov::aggiorna_trasfer_Z()
|
|||||||
int i=0;
|
int i=0;
|
||||||
while (_registro[i]=='0' || _registro[i]==' ') i++;
|
while (_registro[i]=='0' || _registro[i]==' ') i++;
|
||||||
|
|
||||||
_registro = "";
|
TString16 registro = "";
|
||||||
_registro << _registro[i];
|
registro << _registro[i];
|
||||||
_registro.left_just(3, ' ');
|
registro.left_just(3, ' ');
|
||||||
|
|
||||||
mov.put(MOV_REG, _registro);
|
mov.put(MOV_REG, registro);
|
||||||
mov.put(MOV_TIPODOC, _tipodoc);
|
mov.put(MOV_TIPODOC, _tipodoc);
|
||||||
mov.rewrite();
|
mov.rewrite();
|
||||||
|
|
||||||
@ -983,14 +1034,14 @@ void TRic_ListaMov::aggiorna_trasfer_Z()
|
|||||||
long num = _inizioZ + _num_rec;
|
long num = _inizioZ + _num_rec;
|
||||||
if (tr.read_rec_trasfer(num) > 0)
|
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)
|
if (_tiporeg != 0)
|
||||||
{
|
{
|
||||||
str = format("%d", _tiporeg);
|
str = format("%d", _tiporeg);
|
||||||
tr.put(str, "Z1", 26);
|
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(str, "Z1", 13);
|
||||||
tr.put(_tipo_conto, "Z1", 11);
|
tr.put(_tipo_conto, "Z1", 11);
|
||||||
tr.write(num);
|
tr.write(num);
|
||||||
@ -1003,9 +1054,9 @@ void TRic_ListaMov::aggiorna_trasfer_U()
|
|||||||
long num = _inizioU + _n_rec;
|
long num = _inizioU + _n_rec;
|
||||||
if (tr.read_rec_trasfer(num) > 0)
|
if (tr.read_rec_trasfer(num) > 0)
|
||||||
{
|
{
|
||||||
TString16 str = _impo.string();
|
TString str = format("%011s", (const char*)_impo.string());
|
||||||
tr.put(str, "U1", 14);
|
tr.put(str, "U1", 14);
|
||||||
str = _impos.string();
|
str = format("%09s", (const char*)_impos.string());
|
||||||
tr.put(str, "U1", 15);
|
tr.put(str, "U1", 15);
|
||||||
tr.write(num);
|
tr.write(num);
|
||||||
}
|
}
|
||||||
@ -1024,10 +1075,14 @@ bool TRic_ListaMov::user_destroy()
|
|||||||
delete _ditte;
|
delete _ditte;
|
||||||
delete _clifo;
|
delete _clifo;
|
||||||
delete _pcon;
|
delete _pcon;
|
||||||
|
delete _mov;
|
||||||
|
delete _rmov;
|
||||||
|
delete _rmoviva;
|
||||||
delete _tab_tra;
|
delete _tab_tra;
|
||||||
delete _tab_pag;
|
delete _tab_pag;
|
||||||
delete _tab_tpd;
|
delete _tab_tpd;
|
||||||
delete _tab_iva;
|
delete _tab_iva;
|
||||||
|
delete _tab_ese;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,8 @@ HIDDEN TString80 TEMP;
|
|||||||
class TVar_mov : public TApplication
|
class TVar_mov : public TApplication
|
||||||
{
|
{
|
||||||
TIsamtempfile* _tmov,* _trmov,* _tiva;
|
TIsamtempfile* _tmov,* _trmov,* _tiva;
|
||||||
TLocalisamfile* _pcon,* _clifo;
|
TLocalisamfile* _pcon,* _clifo, *_mov, *_rmov, *_rmoviva;
|
||||||
|
TTable* _tab_reg;
|
||||||
TRectype* _rec_mov,* _rec_rmov,* _rec_riva;
|
TRectype* _rec_mov,* _rec_rmov,* _rec_riva;
|
||||||
TTransfer_file _tras_file;
|
TTransfer_file _tras_file;
|
||||||
char _scelta;
|
char _scelta;
|
||||||
@ -143,6 +144,10 @@ bool TVar_mov::create()
|
|||||||
_pcon = new TLocalisamfile (LF_PCON);
|
_pcon = new TLocalisamfile (LF_PCON);
|
||||||
_clifo = new TLocalisamfile (LF_CLIFO);
|
_clifo = new TLocalisamfile (LF_CLIFO);
|
||||||
_rec_mov = new TRectype (LF_MOV);
|
_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')
|
if (_scelta == 'P')
|
||||||
{
|
{
|
||||||
@ -182,6 +187,10 @@ bool TVar_mov::destroy()
|
|||||||
delete _rec_mov;
|
delete _rec_mov;
|
||||||
delete _pcon;
|
delete _pcon;
|
||||||
delete _clifo;
|
delete _clifo;
|
||||||
|
delete _mov;
|
||||||
|
delete _rmov;
|
||||||
|
delete _rmoviva;
|
||||||
|
delete _tab_reg;
|
||||||
|
|
||||||
if (_scelta == 'P')
|
if (_scelta == 'P')
|
||||||
{
|
{
|
||||||
@ -569,7 +578,7 @@ void TVar_mov::setta_campi_maschera(TMask& m)
|
|||||||
int gruppo = _trmov->get_int (RMV_GRUPPO);
|
int gruppo = _trmov->get_int (RMV_GRUPPO);
|
||||||
int conto = _trmov->get_int (RMV_CONTO);
|
int conto = _trmov->get_int (RMV_CONTO);
|
||||||
long sottocon = _trmov->get_long(RMV_SOTTOCONTO);
|
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);
|
TString descr = _trmov->get (RMV_DESCR);
|
||||||
int gruppoc = _trmov->get_int (RMV_GRUPPOC);
|
int gruppoc = _trmov->get_int (RMV_GRUPPOC);
|
||||||
int contoc = _trmov->get_int (RMV_CONTOC);
|
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)
|
if (k == K_ENTER)
|
||||||
{
|
{
|
||||||
real importo (f.mask().get(F_IMPORTO));
|
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");
|
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;
|
return TRUE;
|
||||||
|
@ -131,11 +131,14 @@ BEGIN
|
|||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST F_SEZIONE 7
|
LIST F_SEZIONE 9
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 13 "Sezione "
|
PROMPT 1 13 "Sezione "
|
||||||
|
ITEM " |Nessuna"
|
||||||
ITEM "D|Dare"
|
ITEM "D|Dare"
|
||||||
ITEM "A|Avere"
|
ITEM "A|Avere"
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
WARNING "Valore non valido per sezione"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_DESCR 30
|
STRING F_DESCR 30
|
||||||
|
@ -24,16 +24,23 @@ bool TDitta_ric::set()
|
|||||||
TMask msk ("cg2801a");
|
TMask msk ("cg2801a");
|
||||||
KEY tasto;
|
KEY tasto;
|
||||||
|
|
||||||
|
_old_ditta = get_firm();
|
||||||
|
|
||||||
tasto = msk.run();
|
tasto = msk.run();
|
||||||
|
|
||||||
if (tasto != K_ENTER) return FALSE;
|
if (tasto != K_ENTER) return FALSE;
|
||||||
|
|
||||||
_dittaric = msk.get_int(F_CODDITTA);
|
_dittaric = msk.get_int(F_CODDITTA);
|
||||||
|
|
||||||
if (!esegui_controlli()) return FALSE;
|
|
||||||
|
|
||||||
set_firm(_dittaric);
|
set_firm(_dittaric);
|
||||||
|
|
||||||
|
if (!esegui_controlli())
|
||||||
|
{
|
||||||
|
set_firm(_old_ditta);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//set_firm(_dittaric);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,12 +86,16 @@ bool TDitta_ric::esegui_controlli()
|
|||||||
|
|
||||||
if (_uselab != " ")
|
if (_uselab != " ")
|
||||||
return error_box("Ultimo trasferimento NON COMPLETATO: completarlo");
|
return error_box("Ultimo trasferimento NON COMPLETATO: completarlo");
|
||||||
}
|
|
||||||
else
|
|
||||||
return error_box("Ultimo trasferimento NON COMPLETATO: completarlo");
|
|
||||||
|
|
||||||
if (!controlli())
|
if (!controlli())
|
||||||
return FALSE;
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -201,12 +212,6 @@ bool TDitta_ric::controlli()
|
|||||||
if (!_tras_file.write_control_rec(_control_rec, size))
|
if (!_tras_file.write_control_rec(_control_rec, size))
|
||||||
return FALSE;
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class TDitta_ric : public TApplication
|
|||||||
TTransfer_file _tras_file;
|
TTransfer_file _tras_file;
|
||||||
|
|
||||||
TString _trasf,_std,_uselab,_record,_nrec_file,_sigle_file,_key;
|
TString _trasf,_std,_uselab,_record,_nrec_file,_sigle_file,_key;
|
||||||
long _dittaric;
|
long _dittaric, _old_ditta;
|
||||||
TString _control_rec;
|
TString _control_rec;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -23,6 +23,7 @@ bool TAnn_mov::create()
|
|||||||
|
|
||||||
_pcon = new TLocalisamfile (LF_PCON);
|
_pcon = new TLocalisamfile (LF_PCON);
|
||||||
_clifo = new TLocalisamfile (LF_CLIFO);
|
_clifo = new TLocalisamfile (LF_CLIFO);
|
||||||
|
_mov = new TLocalisamfile (LF_MOV);
|
||||||
|
|
||||||
TString80 tmpmov = "%";
|
TString80 tmpmov = "%";
|
||||||
tmpmov << get_firm_dir();
|
tmpmov << get_firm_dir();
|
||||||
@ -49,6 +50,7 @@ bool TAnn_mov::destroy()
|
|||||||
{
|
{
|
||||||
delete _pcon;
|
delete _pcon;
|
||||||
delete _clifo;
|
delete _clifo;
|
||||||
|
delete _mov;
|
||||||
|
|
||||||
delete _tmov;
|
delete _tmov;
|
||||||
delete _trmov;
|
delete _trmov;
|
||||||
|
@ -19,7 +19,7 @@ HIDDEN int date2esc(const TDate& d, int* prevesc = NULL);
|
|||||||
class TAnn_mov : public TApplication
|
class TAnn_mov : public TApplication
|
||||||
{
|
{
|
||||||
TIsamtempfile* _tmov,* _trmov,* _tiva;
|
TIsamtempfile* _tmov,* _trmov,* _tiva;
|
||||||
TLocalisamfile* _pcon,* _clifo;
|
TLocalisamfile* _pcon,* _clifo, *_mov;
|
||||||
TRectype* _rec_mov;
|
TRectype* _rec_mov;
|
||||||
TTransfer_file _tras_file;
|
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 uselab = f.mask().get(F_USELAB);
|
||||||
TString chiave = f.mask().get(F_STATO);
|
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");
|
return warning_box("Valore non valido per stato ultima ricezione");
|
||||||
}
|
}
|
||||||
else
|
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");
|
return warning_box("Lo stato ultima ricezione non e' significativo: la chiave ultimo file elaborato non puo' essere significativa");
|
||||||
|
|
||||||
if (uselab == "" && chiave != "")
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -209,6 +209,9 @@ void TVis_ric::registra(TMask& m)
|
|||||||
flags[6] = '\0';
|
flags[6] = '\0';
|
||||||
|
|
||||||
TString uselab = m.get(F_USELAB);
|
TString uselab = m.get(F_USELAB);
|
||||||
|
if (uselab == "")
|
||||||
|
uselab = " ";
|
||||||
|
|
||||||
str = m.get(F_STATO);
|
str = m.get(F_STATO);
|
||||||
TString chiave = format("%-15s", (const char*) str);
|
TString chiave = format("%-15s", (const char*) str);
|
||||||
|
|
||||||
|
130
cg/cg2900.cpp
130
cg/cg2900.cpp
@ -40,11 +40,11 @@ class TInv_cont : public TApplication
|
|||||||
TString _control_rec, _trasf, _std, _stato, _marker, _nome_simbolico;
|
TString _control_rec, _trasf, _std, _stato, _marker, _nome_simbolico;
|
||||||
TString _files, _codcaus, _numdoc, _reg, _codpag, _tipodoc, _codcausm;
|
TString _files, _codcaus, _numdoc, _reg, _codpag, _tipodoc, _codcausm;
|
||||||
TString _ocfpi, _ragsococc, _indocc, _capocc, _localocc, _provocc, _codvali;
|
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 _ditta, _protiva, _uprotiva, _codcf, _numrec, _tot_rec;
|
||||||
long _dim_tot, _dim_disk;
|
long _dim_tot, _dim_disk;
|
||||||
int _num;
|
int _num;
|
||||||
TDate _data, _datadoc, _data74ter;
|
TDate _data, _datadoc, _data74ter,_datalimsk,_dataregiva;
|
||||||
real _corrlire, _cambioi, _corrval;
|
real _corrlire, _cambioi, _corrval;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -85,6 +85,9 @@ public:
|
|||||||
|
|
||||||
void aggiorna_marker(TString& token, int pos);
|
void aggiorna_marker(TString& token, int pos);
|
||||||
void calcola_totale_record();
|
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* converti (TString& data_AS400);
|
||||||
const char* riconverti (TString& data_PC);
|
const char* riconverti (TString& data_PC);
|
||||||
@ -230,6 +233,8 @@ bool TInv_cont::main_loop()
|
|||||||
|
|
||||||
if (tasto != K_ENTER) return FALSE;
|
if (tasto != K_ENTER) return FALSE;
|
||||||
|
|
||||||
|
_datalimsk = msk.get(F_DATALIM);
|
||||||
|
|
||||||
if (!ripartenza)
|
if (!ripartenza)
|
||||||
{
|
{
|
||||||
crea_marker(msk); //Crea il record con le informazioni sul marker
|
crea_marker(msk); //Crea il record con le informazioni sul marker
|
||||||
@ -895,6 +900,21 @@ bool TInv_cont::invio_contabilita(TMask& m)
|
|||||||
return TRUE;
|
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)
|
bool TInv_cont::invio_tab_cau(TString& key,TMask& m)
|
||||||
{
|
{
|
||||||
int size = 256;
|
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
|
// Se trovo un codice causale alfanumerico l'invio deve essere interrotto
|
||||||
const char* codcau = cau.get(CAU_CODCAUS);
|
const char* codcau = cau.get(CAU_CODCAUS);
|
||||||
if (!real::is_natural(codcau))
|
if (codcau && *codcau && !real::is_natural(codcau) )
|
||||||
return error_box("Rilevato un codice causale alfanumerico nella causale %03s: impossibile proseguire",codcau);
|
return error_box("Rilevato un codice causale alfanumerico nella causale %-3s: impossibile proseguire",codcau);
|
||||||
str.format("%03s", codcau);
|
str.format("%03s", codcau);
|
||||||
record.overwrite("W1",0); //Tipo record
|
record.overwrite("W1",0); //Tipo record
|
||||||
record.overwrite(str,2); //Codice causale
|
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
|
//Se trovo un registro IVA con lunghezza maggiore di 1 l'invio deve essere interrotto
|
||||||
TString reg = cau.get(CAU_REG);
|
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);
|
return error_box("Rilevato un registro IVA con lunghezza superiore a 1 nella causale %03s: impossibile proseguire", codcau);
|
||||||
record.overwrite(reg,37); //Registro IVA
|
record.overwrite(reg,37); //Registro IVA
|
||||||
|
|
||||||
@ -984,7 +1004,7 @@ bool TInv_cont::invio_tab_cau(TString& key,TMask& m)
|
|||||||
record.overwrite("0",207);
|
record.overwrite("0",207);
|
||||||
|
|
||||||
const char* codcausim = cau.get(CAU_CODCAUSIM);
|
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);
|
return error_box("Rilevato un codice causale per incasso immediato alfanumerico nella causale %03s: impossibile proseguire",codcau);
|
||||||
str.format("%03s", codcausim);
|
str.format("%03s", codcausim);
|
||||||
record.overwrite(str,209); //Codice causale per incasso immediato
|
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
|
record.overwrite(str,77); //Codice fiscale
|
||||||
|
|
||||||
TString indcf = clifo.get(CLI_INDCF);
|
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);
|
str.format("%-35s", (const char*) indcf);
|
||||||
record.overwrite(str,93); //Indirizzo
|
record.overwrite(str,93); //Indirizzo
|
||||||
|
|
||||||
@ -1247,7 +1274,7 @@ bool TInv_cont::invio_clifo(TString& key,TMask& m)
|
|||||||
TString appoggio;
|
TString appoggio;
|
||||||
appoggio << ptel << " " << tel;
|
appoggio << ptel << " " << tel;
|
||||||
if (appoggio.len() > 12)
|
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
|
else //Numero telefono
|
||||||
record.overwrite(appoggio,155);
|
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
|
//Se il codice di pagamento e' superiore alle 2 cifre l'invio deve essere interrotto
|
||||||
TString codpag = clifo.get(CLI_CODPAG);
|
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);
|
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);
|
str.format("%-2s", (const char*) codpag);
|
||||||
@ -1496,7 +1523,7 @@ bool TInv_cont::invio_pcon(TString& key,TMask& m)
|
|||||||
record.overwrite(str,4); //Conto
|
record.overwrite(str,4); //Conto
|
||||||
|
|
||||||
str.format("%06ld", s);
|
str.format("%06ld", s);
|
||||||
record.overwrite(str,6);
|
record.overwrite(str,6); //Sottoconto
|
||||||
|
|
||||||
TString descr (pcon.get(PCN_DESCR));
|
TString descr (pcon.get(PCN_DESCR));
|
||||||
str.format("%-.30s", (const char*) descr);
|
str.format("%-.30s", (const char*) descr);
|
||||||
@ -1612,6 +1639,7 @@ bool TInv_cont::testata_mov_PN(long numreg)
|
|||||||
_tipodoc = mov.get (MOV_TIPODOC);
|
_tipodoc = mov.get (MOV_TIPODOC);
|
||||||
_protiva = mov.get_long(MOV_PROTIVA);
|
_protiva = mov.get_long(MOV_PROTIVA);
|
||||||
_uprotiva = mov.get_long(MOV_UPROTIVA);
|
_uprotiva = mov.get_long(MOV_UPROTIVA);
|
||||||
|
_inviato = mov.get_bool(MOV_INVIATO);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1619,6 +1647,20 @@ bool TInv_cont::testata_mov_PN(long numreg)
|
|||||||
return TRUE;
|
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)
|
bool TInv_cont::invio_mov_PN(TString& key,TMask& m)
|
||||||
{
|
{
|
||||||
int size = 256;
|
int size = 256;
|
||||||
@ -1651,6 +1693,7 @@ bool TInv_cont::invio_mov_PN(TString& key,TMask& m)
|
|||||||
TString str;
|
TString str;
|
||||||
|
|
||||||
_prog->addstatus(1);
|
_prog->addstatus(1);
|
||||||
|
|
||||||
_tras_file.open(_trasf);
|
_tras_file.open(_trasf);
|
||||||
|
|
||||||
record.spaces();
|
record.spaces();
|
||||||
@ -1658,6 +1701,13 @@ bool TInv_cont::invio_mov_PN(TString& key,TMask& m)
|
|||||||
long nreg = rmov.get_long(RMV_NUMREG);
|
long nreg = rmov.get_long(RMV_NUMREG);
|
||||||
int nrig = rmov.get_int (RMV_NUMRIG);
|
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
|
//Salvataggio della chiave sul record di controllo del file trasfer
|
||||||
leggi_record_controllo();
|
leggi_record_controllo();
|
||||||
TString chiave,app;
|
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.write_control_rec(_control_rec,size);
|
||||||
// _tras_file.close();
|
// _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)
|
if (nreg > 999999)
|
||||||
return error_box("Rilevato un numero di registrazione composto da 7 cifre in %07ld riga %03d: impossibile proseguire",nreg,nrig);
|
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);
|
str.format("%02d", nrig);
|
||||||
record.overwrite(str,8); //Numero di riga
|
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;
|
nreg_p = nreg;
|
||||||
|
|
||||||
TDate datareg (rmov.get(RMV_DATAREG));
|
TString datastr = datareg.string();
|
||||||
TString dataregstr = datareg.string();
|
|
||||||
str = riconverti(dataregstr);
|
str = riconverti(dataregstr);
|
||||||
record.overwrite(str,15); //Data di registrazione
|
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);
|
str.format("%-7s", (const char*) _numdoc);
|
||||||
record.overwrite(str,28);
|
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);
|
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
|
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);
|
str.format("%06ld", sottocc);
|
||||||
record.overwrite(str,89); //Sottoconto di contropartita
|
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);
|
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);
|
str.format("%-2s", (const char*) _codpag);
|
||||||
record.overwrite(str,95); //Codice di pagamento
|
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.open(_trasf,TRUE);
|
||||||
_tras_file.write_control_rec(record,size);
|
_tras_file.write_control_rec(record,size);
|
||||||
_tras_file.close();
|
_tras_file.close();
|
||||||
|
|
||||||
|
primanota_inviata(nreg);
|
||||||
}
|
}
|
||||||
delete _prog;
|
delete _prog;
|
||||||
|
|
||||||
@ -1839,6 +1894,8 @@ bool TInv_cont::testata_mov_IVA(long numreg)
|
|||||||
_cambioi = mov.get_real(MOV_CAMBIOI);
|
_cambioi = mov.get_real(MOV_CAMBIOI);
|
||||||
_corrval = mov.get_real(MOV_CORRVALUTA);
|
_corrval = mov.get_real(MOV_CORRVALUTA);
|
||||||
_ocfpi = mov.get (MOV_OCFPI);
|
_ocfpi = mov.get (MOV_OCFPI);
|
||||||
|
_dataregiva = mov.get_date(MOV_DATAREG);
|
||||||
|
_inviato = mov.get_bool(MOV_INVIVA);
|
||||||
if (_ocfpi.not_empty())
|
if (_ocfpi.not_empty())
|
||||||
cerca_occasionale();
|
cerca_occasionale();
|
||||||
}
|
}
|
||||||
@ -1848,6 +1905,20 @@ bool TInv_cont::testata_mov_IVA(long numreg)
|
|||||||
return TRUE;
|
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()
|
void TInv_cont::cerca_occasionale()
|
||||||
{
|
{
|
||||||
TLocalisamfile occas (LF_OCCAS);
|
TLocalisamfile occas (LF_OCCAS);
|
||||||
@ -1920,6 +1991,7 @@ bool TInv_cont::invio_mov_IVA(TString& key,TMask& m)
|
|||||||
TString str;
|
TString str;
|
||||||
|
|
||||||
_prog->addstatus(1);
|
_prog->addstatus(1);
|
||||||
|
|
||||||
_tras_file.open(_trasf);
|
_tras_file.open(_trasf);
|
||||||
|
|
||||||
record.spaces();
|
record.spaces();
|
||||||
@ -1927,6 +1999,17 @@ bool TInv_cont::invio_mov_IVA(TString& key,TMask& m)
|
|||||||
long nreg = rmoviva.get_long(RMI_NUMREG);
|
long nreg = rmoviva.get_long(RMI_NUMREG);
|
||||||
int nrig = rmoviva.get_int (RMI_NUMRIG);
|
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
|
//Salvataggio della chiave sul record di controllo del file trasfer
|
||||||
leggi_record_controllo();
|
leggi_record_controllo();
|
||||||
TString chiave,app;
|
TString chiave,app;
|
||||||
@ -1951,13 +2034,6 @@ bool TInv_cont::invio_mov_IVA(TString& key,TMask& m)
|
|||||||
str.format("%02d", nrig);
|
str.format("%02d", nrig);
|
||||||
record.overwrite(str,8); //Numero di riga
|
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++;
|
numero_righe++;
|
||||||
if (numero_righe > 9)
|
if (numero_righe > 9)
|
||||||
return error_box("Rilevata una registrazione IVA con piu' di 9 righe: impossibile proseguire");
|
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
|
//Se trovo un codice iva composto da piu' di 2 cifre l'invio viene interrotto
|
||||||
TString codiva (rmoviva.get(RMI_CODIVA));
|
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);
|
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);
|
str.format("%02s", (const char*) codiva);
|
||||||
record.overwrite(str,32); //Codice iva
|
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.open(_trasf,TRUE);
|
||||||
_tras_file.write_control_rec(record,size);
|
_tras_file.write_control_rec(record,size);
|
||||||
_tras_file.close();
|
_tras_file.close();
|
||||||
|
|
||||||
|
iva_inviata(nreg);
|
||||||
}
|
}
|
||||||
delete _prog;
|
delete _prog;
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ long TTransfer_file::start(char sigla)
|
|||||||
long TTransfer_file::start(int i)
|
long TTransfer_file::start(int i)
|
||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
return 0;
|
return 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TToken_string data = (TToken_string&)_index[i-1];
|
TToken_string data = (TToken_string&)_index[i-1];
|
||||||
@ -782,6 +782,8 @@ void TMappa_trc::leggi_modulo()
|
|||||||
{
|
{
|
||||||
record = s.line();
|
record = s.line();
|
||||||
|
|
||||||
|
if (record.mid(0,1) == "#") continue; //Perche' e' un commento
|
||||||
|
|
||||||
TString sigla = record.get(0);
|
TString sigla = record.get(0);
|
||||||
long numrec = record.get_long(1);
|
long numrec = record.get_long(1);
|
||||||
key.format("%2s%d", (const char*)sigla,numrec);
|
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);
|
TToken_string * data = (TToken_string *) objptr(key);
|
||||||
return data->get_int(6);
|
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);
|
int logicnum (const char* key);
|
||||||
const char* field_name (const char* key);
|
const char* field_name (const char* key);
|
||||||
int flag (const char* key);
|
int flag (const char* key);
|
||||||
|
int flag_bis (const char* key);
|
||||||
|
|
||||||
TMappa_trc() {};
|
TMappa_trc() {};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user