Corretto invio a PC del campo TIPODET delle righe IVA git-svn-id: svn://10.65.10.50/branches/R_10_00@22620 c028cbd2-c16b-5b4b-a496-9718f37d4682
1719 lines
54 KiB
C++
Executable File
1719 lines
54 KiB
C++
Executable File
#include <progind.h>
|
|
#include <math.h>
|
|
|
|
#include "cg6900.h"
|
|
#include "cg6900a.h"
|
|
|
|
bool TInv_cont::invio_contabilita_PC()
|
|
{
|
|
const int size = 1024;
|
|
bool header = true;
|
|
|
|
_numrec_cau = 0;
|
|
_numrec_clifo = 0;
|
|
_numrec_pcon = 0;
|
|
_numrec_pn = 0;
|
|
_numrec_iva = 0;
|
|
_numrec_sc = 0;
|
|
|
|
_tras_file.open(_header);
|
|
|
|
leggi_record_controllo();
|
|
|
|
TString16 files = _tras_file.sigle_file();
|
|
TString nrec = _tras_file.nrec_file();
|
|
files.trim();
|
|
|
|
_tras_file.open(_trasf,TRUE);
|
|
|
|
for (int i = 0; i < files.len();i++)
|
|
{
|
|
const char sigla = files[i];
|
|
//_numrec = atol(nrec.mid(i * 6,6));
|
|
|
|
if (header)
|
|
{
|
|
_control_rec.cut(size);
|
|
|
|
_control_rec.overwrite(" ",301); //Nel caso di invio a PC pulisco la ditta aggiuntiva dal record di controllo
|
|
|
|
_tras_file.write_control_rec(_control_rec,size);
|
|
header = FALSE;
|
|
}
|
|
|
|
switch (sigla)
|
|
{
|
|
case 'W':
|
|
{
|
|
long cicli = _tcaus->items() + _trcaus->items();
|
|
_prog = new TProgind(cicli,"Tabella Causali: generazione file TRASFER per PC\nPrego attendere.",FALSE);
|
|
invio_testata_causali();
|
|
invio_righe_causali();
|
|
delete _prog;
|
|
break;
|
|
}
|
|
case 'A':
|
|
invio_clienti_fornitori();
|
|
break;
|
|
|
|
case 'P':
|
|
invio_piano_conti();
|
|
break;
|
|
|
|
case 'Z':
|
|
{
|
|
long cicli = _tmov->items() + _trmov->items();
|
|
_prog = new TProgind(cicli,"Movimenti di Prima nota: generazione file TRASFER per PC\nPrego attendere.",FALSE);
|
|
invio_testata_movimenti();
|
|
invio_righe_contabili();
|
|
delete _prog;
|
|
break;
|
|
}
|
|
case 'U':
|
|
invio_righe_IVA();
|
|
break;
|
|
|
|
case 'B':
|
|
{
|
|
long cicli = _tpart->items() + _tscad->items() + _tpagsca->items();
|
|
_prog = new TProgind(cicli,"Movimenti di Saldaconto: generazione file TRASFER per PC\nPrego attendere.",FALSE);
|
|
invio_partite();
|
|
invio_scadenze();
|
|
invio_pagsca();
|
|
delete _prog;
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
};
|
|
}
|
|
|
|
aggiorna_header(files);
|
|
aggiorna_trasfer(files);
|
|
|
|
calcola_totale_record();
|
|
TString8 str; str.format("%06ld", _tot_rec);
|
|
aggiorna_marker(str,26);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void TInv_cont::invio_testata_causali()
|
|
{
|
|
const int size = 1024;
|
|
TString record(size);
|
|
TString cod;
|
|
|
|
_tras_file.open(_trasf,TRUE);
|
|
|
|
for (_tcaus->first(); !_tcaus->eof(); _tcaus->next())
|
|
{
|
|
TString str;
|
|
|
|
_prog->addstatus(1);
|
|
|
|
record.spaces();
|
|
|
|
const char* codcau = _tcaus->get(CAU_CODCAUS);
|
|
if (real::is_natural(codcau))
|
|
str.format("%03s", (const char*) codcau);
|
|
else
|
|
str.format("%-3s", (const char*) codcau);
|
|
record.overwrite("W1",0); //Tipo record
|
|
record.overwrite(str,2); //Codice causale
|
|
|
|
TString descr = _tcaus->get(CAU_DESCR);
|
|
descr.format("%-50s", (const char*) descr);
|
|
record.overwrite(descr,60); //Descrizione
|
|
|
|
TString tipodoc = _tcaus->get(CAU_TIPODOC);
|
|
str.format("%-2s", (const char*) tipodoc);
|
|
record.overwrite(tipodoc,110); //Tipo documento
|
|
|
|
TString movap = _tcaus->get(CAU_MOVAP);
|
|
if (movap.not_empty())
|
|
record.overwrite(movap,112);
|
|
|
|
bool alleg = _tcaus->get_bool(CAU_ALLEG);
|
|
if (alleg)
|
|
record.overwrite("X",113);
|
|
else
|
|
record.overwrite(" ",113);
|
|
|
|
bool intracom = _tcaus->get_bool(CAU_INTRACOM);
|
|
if (intracom)
|
|
record.overwrite("X",114);
|
|
else
|
|
record.overwrite(" ",114);
|
|
|
|
TString reg = _tcaus->get(CAU_REG);
|
|
if (real::is_natural(reg))
|
|
{
|
|
int app = atoi(reg);
|
|
reg.format("%03d", app);
|
|
}
|
|
else
|
|
reg.format("%-3s", (const char*) reg);
|
|
record.overwrite(reg,115); //Registro IVA
|
|
|
|
bool movval = _tcaus->get_bool(CAU_MOVVAL);
|
|
if (movval)
|
|
record.overwrite("X",118);
|
|
else
|
|
record.overwrite(" ",118);
|
|
|
|
int tipomov = _tcaus->get_int(CAU_TIPOMOV);
|
|
str.format("%d", tipomov);
|
|
record.overwrite(str,119);
|
|
|
|
bool datadoc = _tcaus->get_bool(CAU_DATADOC);
|
|
if (datadoc)
|
|
record.overwrite("X",120);
|
|
else //Flag immissione data documento
|
|
record.overwrite(" ",120);
|
|
|
|
bool numdoc = _tcaus->get_bool(CAU_NUMDOC);
|
|
if (numdoc)
|
|
record.overwrite("X",121);
|
|
else //Flag immissione numero documento
|
|
record.overwrite(" ",121);
|
|
|
|
bool autofatt = _tcaus->get_bool(CAU_AUTOFATT);
|
|
if (autofatt)
|
|
record.overwrite("X",122);
|
|
else //Autofattura art.34
|
|
record.overwrite(" ",122);
|
|
|
|
bool ritfatt = _tcaus->get_bool(CAU_RITFATT);
|
|
if (ritfatt)
|
|
record.overwrite("X",123);
|
|
else //Flag causale per fattura ricevuta in ritardo
|
|
record.overwrite(" ",123);
|
|
|
|
TString cespiti = _tcaus->get(CAU_COLLCESP);
|
|
if (cespiti.not_empty())
|
|
record.overwrite(cespiti,124); //Collegamento cespiti
|
|
|
|
TString m770 = _tcaus->get(CAU_M770);
|
|
if (m770.not_empty())
|
|
record.overwrite(m770,125); //Collegamento modello 770
|
|
|
|
const char* codcausim = _tcaus->get(CAU_CODCAUSIM);
|
|
if (real::is_natural(codcausim))
|
|
str.format("%03s", (const char*) codcausim);
|
|
else
|
|
str.format("%-3s", (const char*) codcausim);
|
|
record.overwrite(str,126); //Codice causale per incasso immediato
|
|
|
|
bool sospeso = _tcaus->get_bool(CAU_SOSPESO);
|
|
if (sospeso)
|
|
record.overwrite("X",129);
|
|
else
|
|
record.overwrite(" ",129);
|
|
|
|
bool valintra = _tcaus->get_bool(CAU_VALINTRA);
|
|
if (valintra)
|
|
record.overwrite("X",130);
|
|
else //Gestione valuta per oper. intracomunitarie
|
|
record.overwrite(" ",130);
|
|
|
|
_numrec_cau++;
|
|
|
|
_tras_file.write_control_rec(record,size);
|
|
}
|
|
|
|
_tras_file.close();
|
|
}
|
|
|
|
void TInv_cont::invio_righe_causali()
|
|
{
|
|
int size = 1024;
|
|
TString record(size);
|
|
TString cod;
|
|
|
|
_tras_file.open(_trasf,TRUE);
|
|
|
|
for (_trcaus->first(); !_trcaus->eof(); _trcaus->next())
|
|
{
|
|
TString str;
|
|
|
|
_prog->addstatus(1);
|
|
|
|
record.spaces();
|
|
|
|
const char* codcau = _trcaus->get(CAU_CODCAUS);
|
|
if (real::is_natural(codcau))
|
|
str.format("%03s", (const char*) codcau);
|
|
else
|
|
str.format("%-3s", (const char*) codcau);
|
|
record.overwrite("W2",0); //Tipo record
|
|
record.overwrite(str,2); //Codice causale
|
|
|
|
int nriga = _trcaus->get_int(RCA_NRIGA);
|
|
str.format("%03d", nriga);
|
|
record.overwrite(str,5);
|
|
|
|
int g = _trcaus->get_int (RCA_GRUPPO);
|
|
str.format("%03d", g);
|
|
record.overwrite(str,60); //Gruppo
|
|
|
|
int c = _trcaus->get_int (RCA_CONTO);
|
|
str.format("%03d", c);
|
|
record.overwrite(str,63); //Conto
|
|
|
|
long s = _trcaus->get_long(RCA_SOTTOCONTO);
|
|
str.format("%06ld", s);
|
|
record.overwrite(str,66); //Sottoconto
|
|
|
|
TString coddesc = _trcaus->get(RCA_CODDESC);
|
|
str.format("%-5s", (const char*) coddesc);
|
|
record.overwrite(str,72); //Codice descrizione
|
|
|
|
TString sez = _trcaus->get(RCA_SEZIONE);
|
|
record.overwrite(sez,77); //Sezione
|
|
|
|
_tras_file.write_control_rec(record,size);
|
|
}
|
|
_tras_file.close();
|
|
}
|
|
|
|
void TInv_cont::invio_clienti_fornitori()
|
|
{
|
|
int size = 1024;
|
|
TString record(size);
|
|
|
|
long cicli = _tclifo->items();
|
|
_prog = new TProgind(cicli,"Anagrafica Clienti/Fornitori: generazione file TRASFER per PC\nPrego attendere.",FALSE);
|
|
|
|
_tras_file.open(_trasf,TRUE);
|
|
|
|
for (_tclifo->first(); !_tclifo->eof(); _tclifo->next())
|
|
{
|
|
TString str;
|
|
|
|
_prog->addstatus(1);
|
|
|
|
record.spaces();
|
|
|
|
TString tipo = _tclifo->get(CLI_TIPOCF);
|
|
record.overwrite("A1",0); //Tipo record
|
|
record.overwrite(tipo,2); //Tipo cliente/fornitore
|
|
|
|
long codice = _tclifo->get_long(CLI_CODCF);
|
|
str.format("%06ld", codice);
|
|
record.overwrite(str,3); //Codice cliente/fornitore
|
|
|
|
TString ragsoc = _tclifo->get(CLI_RAGSOC);
|
|
str.format("%-50s", (const char*) ragsoc);
|
|
record.overwrite(str,60); //Ragione sociale
|
|
|
|
TString indcf = _tclifo->get(CLI_INDCF);
|
|
str.format("%-35s", (const char*) indcf);
|
|
record.overwrite(str,110); //Indirizzo
|
|
|
|
TString civcf = _tclifo->get(CLI_CIVCF);
|
|
str.format("%-10s", (const char*) civcf);
|
|
record.overwrite(str,145); //Numero civico
|
|
|
|
TString localita = _tclifo->get(CLI_LOCCF);
|
|
str.format("%-35s", (const char*) localita);
|
|
record.overwrite(str,155); //Localita'
|
|
|
|
TString stato = _tclifo->get(CLI_STATOCF);
|
|
str.format("%-3s", (const char*) stato);
|
|
record.overwrite(str,190); //Stato
|
|
|
|
TString comcf = _tclifo->get(CLI_COMCF);
|
|
str.format("%-4s", (const char*) comcf);
|
|
record.overwrite(str,193); //Comune
|
|
|
|
TString capcf = _tclifo->get(CLI_CAPCF);
|
|
str.format("%-5s", (const char*) capcf);
|
|
record.overwrite(str,247); //Codice di avviamento postale
|
|
|
|
TString cofi = _tclifo->get(CLI_COFI);
|
|
str.format("%-16s", (const char*) cofi);
|
|
record.overwrite(str,252); //Codice fiscale
|
|
|
|
TString statopaiv = _tclifo->get(CLI_STATOPAIV);
|
|
str.format("%-2s", (const char*) statopaiv);
|
|
record.overwrite(str,268); //Stato partita iva
|
|
|
|
TString paiv = _tclifo->get(CLI_PAIV);
|
|
str.format("%-12s", (const char*) paiv);
|
|
record.overwrite(str,270); //Partita IVA
|
|
|
|
TString tipop = _tclifo->get(CLI_TIPOPERS);
|
|
record.overwrite(tipop,282); //Tipo persona
|
|
|
|
TString alleg = _tclifo->get(CLI_ALLEG);
|
|
record.overwrite(alleg,283); //Flag gestione allegato
|
|
|
|
long codalleg = _tclifo->get_long(CLI_CODALLEG);
|
|
str.format("%06ld", codalleg);
|
|
record.overwrite(str,284);
|
|
|
|
int gruppo = _tclifo->get_int (CLI_GRUPPO);
|
|
int conto = _tclifo->get_int (CLI_CONTO);
|
|
str.format("%03d", gruppo);
|
|
record.overwrite(str,290); //Gruppo prevalente
|
|
str.format("%03d", conto);
|
|
record.overwrite(str,293); //Conto prevalente
|
|
|
|
int gruppor = _tclifo->get_int (CLI_GRUPPORIC);
|
|
int contor = _tclifo->get_int (CLI_CONTORIC);
|
|
long sottocr = _tclifo->get_long(CLI_SOTTOCRIC);
|
|
str.format("%03d", gruppor);
|
|
record.overwrite(str,296); //Gruppo di costo/ricavo
|
|
str.format("%03d", contor);
|
|
record.overwrite(str,299); //Conto di costo/ricavo
|
|
str.format("%06ld", sottocr);
|
|
record.overwrite(str,302); //Sottoconto di costo/ricavo
|
|
|
|
TString ptel = _tclifo->get(CLI_PTEL);
|
|
str.format("%-10s", (const char*) ptel);
|
|
record.overwrite(str,308);
|
|
|
|
TString tel = _tclifo->get(CLI_TEL);
|
|
str.format("%-30s", (const char*) tel);
|
|
record.overwrite(str,318);
|
|
|
|
TString ptel2 = _tclifo->get(CLI_PTEL2);
|
|
str.format("%-10s", (const char*) ptel2);
|
|
record.overwrite(str,348);
|
|
|
|
TString tel2 = _tclifo->get(CLI_TEL2);
|
|
str.format("%-30s", (const char*) tel2);
|
|
record.overwrite(str,358);
|
|
|
|
TString ptel3 = _tclifo->get(CLI_PTEL3);
|
|
str.format("%-10s", (const char*) ptel3);
|
|
record.overwrite(str,388);
|
|
|
|
TString tel3 = _tclifo->get(CLI_TEL3);
|
|
str.format("%-30s", (const char*) tel3);
|
|
record.overwrite(str,398);
|
|
|
|
TString pfax = _tclifo->get(CLI_PFAX);
|
|
str.format("%-10s", (const char*) pfax);
|
|
record.overwrite(str,428);
|
|
|
|
TString fax = _tclifo->get(CLI_FAX);
|
|
str.format("%-30s", (const char*) fax);
|
|
record.overwrite(str,438);
|
|
|
|
TString ptelex = _tclifo->get(CLI_PTELEX);
|
|
str.format("%-10s", (const char*) ptelex);
|
|
record.overwrite(str,468);
|
|
|
|
TString telex = _tclifo->get(CLI_TELEX);
|
|
str.format("%-30s", (const char*) telex);
|
|
record.overwrite(str,478);
|
|
|
|
TString data = _tclifo->get(CLI_DATANASC);
|
|
TString app = riconverti_data(data,TRUE);
|
|
str.format("%08s", (const char*) app);
|
|
record.overwrite(str,508); //Data di registrazione
|
|
|
|
int statonasc = _tclifo->get_int(CLI_STATONASC);
|
|
str.format("%03d", statonasc);
|
|
record.overwrite(str,516);
|
|
|
|
TString comnasc = _tclifo->get(CLI_COMNASC);
|
|
str.format("%-4s", (const char*) comnasc);
|
|
record.overwrite(str,519);
|
|
|
|
TString codstat = _tclifo->get(CLI_CODSTAT);
|
|
str.format("%-7s", (const char*) codstat);
|
|
record.overwrite(str,573);
|
|
|
|
long codabi = _tclifo->get_long(CLI_CODABI);
|
|
str.format("%05ld", codabi);
|
|
record.overwrite(str,580);
|
|
|
|
long codcab = _tclifo->get_long(CLI_CODCAB);
|
|
str.format("%05ld", codcab);
|
|
record.overwrite(str,585);
|
|
|
|
bool occas = _tclifo->get_bool(CLI_OCCAS);
|
|
if (occas)
|
|
record.overwrite("X", 590);
|
|
else
|
|
record.overwrite(" ", 590);
|
|
|
|
TString codval = _tclifo->get(CLI_CODVAL);
|
|
str.format("%-3s", (const char*) codval);
|
|
record.overwrite(str,591);
|
|
|
|
TString codlin = _tclifo->get(CLI_CODLIN);
|
|
record.overwrite(codlin,594);
|
|
|
|
real fido (_tclifo->get_real(CLI_FIDO));
|
|
str.format("%015s", (const char*) fido.string());
|
|
record.overwrite(str,595);
|
|
|
|
TString codpag = _tclifo->get(CLI_CODPAG);
|
|
str.format("%-4s", (const char*) codpag);
|
|
record.overwrite(str,610);
|
|
|
|
bool sospeso = _tclifo->get_bool(CLI_SOSPESO);
|
|
if (sospeso)
|
|
record.overwrite("X",614);
|
|
else
|
|
record.overwrite(" ",614);
|
|
|
|
_numrec_clifo++;
|
|
|
|
_tras_file.write_control_rec(record,size);
|
|
}
|
|
delete _prog;
|
|
|
|
_tras_file.close();
|
|
}
|
|
|
|
void TInv_cont::invio_piano_conti()
|
|
{
|
|
int size = 1024;
|
|
TString record(size);
|
|
|
|
long cicli = _tpcon->items();
|
|
_prog = new TProgind(cicli,"Anagrafica Piano Conti: generazione file TRASFER per PC\nPrego attendere.",FALSE);
|
|
|
|
_tras_file.open(_trasf,TRUE);
|
|
TString str, work_string;
|
|
|
|
for (_tpcon->first(); !_tpcon->eof(); _tpcon->next())
|
|
{
|
|
|
|
_prog->addstatus(1);
|
|
|
|
record.spaces();
|
|
|
|
int g = _tpcon->get_int (PCN_GRUPPO);
|
|
int c = _tpcon->get_int (PCN_CONTO);
|
|
long s = _tpcon->get_long(PCN_SOTTOCONTO);
|
|
|
|
// Se si tratta di un GRUPPO
|
|
|
|
if (g != 0 && c == 0 && s == 0)
|
|
{
|
|
record.overwrite("P1",0); //Tipo record
|
|
str.format("%03d", g);
|
|
record.overwrite(str,2); //Gruppo
|
|
|
|
work_string = _tpcon->get(PCN_DESCR);
|
|
str.format("%-50s", (const char*) work_string);
|
|
record.overwrite(str,60); //Descrizione gruppo
|
|
}
|
|
|
|
// Se si tratta di un CONTO
|
|
|
|
if (g != 0 && c != 0 && s == 0)
|
|
{
|
|
record.overwrite("P2",0); //Tipo record
|
|
str.format("%03d", g);
|
|
record.overwrite(str,2); //Gruppo
|
|
|
|
str.format("%03d", c);
|
|
record.overwrite(str,5); //Conto
|
|
|
|
work_string = _tpcon->get(PCN_DESCR);
|
|
str.format("%-50s", (const char*) work_string);
|
|
record.overwrite(str,60); //Descrizione conto
|
|
|
|
int indbil = _tpcon->get_int(PCN_INDBIL);
|
|
str.format("%d", indbil);
|
|
record.overwrite(str,110); //Indicatore di bilancio
|
|
|
|
work_string = _tpcon->get(PCN_TMCF);
|
|
record.overwrite(work_string,111); //Flag conto cliente/fornitore
|
|
|
|
bool stsottbil = _tpcon->get_bool(PCN_STSOTTBIL);
|
|
if (stsottbil)
|
|
record.overwrite("X",112);
|
|
else
|
|
record.overwrite(" ",112); //Flag stampa dettaglio sottoconti su bilancio
|
|
|
|
bool compens = _tpcon->get_bool(PCN_COMPENS);
|
|
if (compens)
|
|
record.overwrite("X",113);
|
|
else
|
|
record.overwrite(" ",113);
|
|
|
|
// Classe IV direttiva CEE
|
|
|
|
work_string = _tpcon->get(PCN_SEZIVD);
|
|
if (work_string == "0")
|
|
work_string = " ";
|
|
record.overwrite(work_string,114); //Sezione IV dir
|
|
|
|
work_string = _tpcon->get(PCN_LETTIVD);
|
|
record.overwrite(work_string,115); //Lettera IV dir
|
|
|
|
int numrom = atoi(_tpcon->get(PCN_NUMRIVD));
|
|
str.format("%8d", numrom);
|
|
record.overwrite(str,116); //Numero romano IV dir
|
|
|
|
const TString num = _tpcon->get(PCN_NUMIVD).left(2);
|
|
record.overwrite(num,124); //Numero arabo IV dir
|
|
|
|
// Classe IV direttiva CEE di segno opposto
|
|
|
|
work_string = _tpcon->get(PCN_SEZIVDOPP);
|
|
if (work_string == "0")
|
|
work_string = " ";
|
|
record.overwrite(work_string,126); //Sezione IV dir
|
|
|
|
work_string = _tpcon->get(PCN_LETTIVDOPP);
|
|
record.overwrite(work_string,127); //Lettera IV dir
|
|
|
|
int numromop = atoi(_tpcon->get(PCN_NUMRIVDOPP));
|
|
str.format("%8d", numromop);
|
|
record.overwrite(str,128); //Numero romano IV dir
|
|
|
|
const TString numop = _tpcon->get(PCN_NUMIVDOPP).left(2);
|
|
record.overwrite(numop, 136); //Numero arabo IV dir
|
|
}
|
|
|
|
// Se si tratta di un SOTTOCONTO
|
|
|
|
if (g != 0 && c != 0 && s != 0)
|
|
{
|
|
record.overwrite("P3",0); //Tipo record
|
|
str.format("%03d", g);
|
|
record.overwrite(str,2); //Gruppo
|
|
|
|
str.format("%03d", c);
|
|
record.overwrite(str,5); //Conto
|
|
|
|
str.format("%06ld", s);
|
|
record.overwrite(str,8); //Sottoconto
|
|
|
|
work_string = _tpcon->get(PCN_DESCR);
|
|
str.format("%-50s", (const char*) work_string);
|
|
record.overwrite(str,60); //Descrizione sottoconto
|
|
|
|
int tipospric = _tpcon->get_int(PCN_TIPOSPRIC);
|
|
str.format("%d", tipospric);
|
|
record.overwrite(str,110); //Tipo costo/ricavo
|
|
|
|
work_string = _tpcon->get(PCN_SEZSALDI);
|
|
record.overwrite(work_string,111);
|
|
|
|
bool sospeso = _tpcon->get_bool(PCN_SOSPESO);
|
|
if (sospeso)
|
|
record.overwrite("X",112);
|
|
else
|
|
record.overwrite(" ",112);
|
|
|
|
// Classe IV direttiva CEE
|
|
|
|
work_string = _tpcon->get(PCN_SEZIVD);
|
|
if (work_string == "0")
|
|
work_string = " ";
|
|
record.overwrite(work_string,113); //Sezione IV dir
|
|
|
|
work_string = _tpcon->get(PCN_LETTIVD);
|
|
record.overwrite(work_string,114); //Lettera IV dir
|
|
|
|
int numrom = atoi(_tpcon->get(PCN_NUMRIVD));
|
|
str.format("%8d", numrom);
|
|
record.overwrite(str,115); //Numero romano IV dir
|
|
|
|
const TString num = _tpcon->get(PCN_NUMIVD).left(2);
|
|
record.overwrite(num,123); //Numero arabo IV dir
|
|
|
|
// Classe IV direttiva CEE di segno opposto
|
|
|
|
work_string = _tpcon->get(PCN_SEZIVDOPP);
|
|
if (work_string == "0")
|
|
work_string = " ";
|
|
record.overwrite(work_string,125); //Sezione IV dir
|
|
|
|
work_string = _tpcon->get(PCN_LETTIVDOPP);
|
|
record.overwrite(work_string,126); //Lettera IV dir
|
|
|
|
int numromop = atoi(_tpcon->get(PCN_NUMRIVDOPP));
|
|
str.format("%8d", numromop);
|
|
record.overwrite(str,127); //Numero romano IV dir
|
|
|
|
const TString & numop = _tpcon->get(PCN_NUMIVDOPP).left(2);
|
|
record.overwrite(numop,135); //Numero arabo IV dir
|
|
|
|
int ricser = _tpcon->get_int(PCN_RICSER);
|
|
str.format("%d", ricser);
|
|
record.overwrite(str,137); //Tipo attivita'
|
|
|
|
TString work_string = _tpcon->get(PCN_IVACOMP);
|
|
record.overwrite(work_string,138); //Codice IVA compensazine
|
|
}
|
|
|
|
_numrec_pcon++;
|
|
|
|
_tras_file.write_control_rec(record,size);
|
|
}
|
|
delete _prog;
|
|
|
|
_tras_file.close();
|
|
}
|
|
|
|
// Invio testate a PC
|
|
void TInv_cont::invio_testata_movimenti()
|
|
{
|
|
const int size = 1024;
|
|
TString record(size);
|
|
TString datastr;
|
|
|
|
_tras_file.open(_trasf,TRUE);
|
|
|
|
for (_tmov->first(); !_tmov->eof(); _tmov->next())
|
|
{
|
|
TString str(80);
|
|
|
|
_prog->addstatus(1);
|
|
|
|
record.spaces();
|
|
|
|
record.overwrite("Z1",0); //Tipo record
|
|
|
|
long nreg = _tmov->get_long(MOV_NUMREG);
|
|
str.format("%07ld", nreg);
|
|
record.overwrite(str,2); //Numero di registrazione
|
|
|
|
TString datareg = _tmov->get(MOV_DATAREG);
|
|
datastr = riconverti_data(datareg,TRUE);
|
|
str.format("%08s", (const char*) datastr);
|
|
record.overwrite(str,60); //Data di registrazione
|
|
|
|
TString datacomp = _tmov->get(MOV_DATACOMP);
|
|
datastr = riconverti_data(datacomp,TRUE);
|
|
str.format("%08s", (const char*) datastr);
|
|
record.overwrite(str,68); //Data di registrazione
|
|
|
|
TString datadoc = _tmov->get(MOV_DATADOC);
|
|
datastr = riconverti_data(datadoc,TRUE);
|
|
str.format("%08s", (const char*) datastr);
|
|
record.overwrite(str,76); //Data di registrazione
|
|
|
|
TString data74ter = _tmov->get(MOV_DATA74TER);
|
|
datastr = riconverti_data(data74ter,TRUE);
|
|
str.format("%08s", (const char*) datastr);
|
|
record.overwrite(str,84); //Data di 74 ter
|
|
|
|
TString numdoc = _tmov->get(MOV_NUMDOC);
|
|
str.format("%-7s", (const char*) numdoc);
|
|
record.overwrite(str,92);
|
|
|
|
const char* codcaus = _tmov->get(MOV_CODCAUS);
|
|
if (real::is_natural(codcaus))
|
|
str.format("%03s", (const char*) codcaus);
|
|
else
|
|
str.format("%-3s", (const char*) codcaus);
|
|
record.overwrite(str,99); //Codice causale
|
|
|
|
TString descr = _tmov->get(MOV_DESCR);
|
|
str.format("%-50s", (const char*) descr);
|
|
record.overwrite(str,102);
|
|
|
|
const char* reg = _tmov->get(MOV_REG);
|
|
TString registro;
|
|
if (real::is_natural(reg))
|
|
{
|
|
int app = atoi(reg);
|
|
registro.format("%03d", app);
|
|
}
|
|
else
|
|
registro.format("%-3s", (const char*) reg);
|
|
record.overwrite(registro,152); //Codice registro IVA
|
|
|
|
long protiva = _tmov->get_long(MOV_PROTIVA);
|
|
str.format("%05ld", protiva);
|
|
record.overwrite(str,155); //Numero protocollo IVA
|
|
|
|
long uprotiva = _tmov->get_long(MOV_UPROTIVA);
|
|
str.format("%05ld", uprotiva);
|
|
record.overwrite(str,160); //Ultimo numero di protocollo IVA
|
|
|
|
bool regst = _tmov->get_bool(MOV_REGST);
|
|
if (regst)
|
|
record.overwrite("X",165);
|
|
else
|
|
record.overwrite(" ",165);
|
|
|
|
bool stampato = _tmov->get_bool(MOV_STAMPATO);
|
|
if (stampato)
|
|
record.overwrite("X",166);
|
|
else
|
|
record.overwrite(" ",166);
|
|
|
|
long numgio = _tmov->get_long(MOV_NUMGIO);
|
|
str.format("%07ld", numgio);
|
|
record.overwrite(str,167);
|
|
|
|
long codcf = _tmov->get_long(MOV_CODCF);
|
|
str.format("%06ld", codcf);
|
|
record.overwrite(str,174);
|
|
|
|
TString tipodoc (_tmov->get(MOV_TIPODOC));
|
|
real totdoc (_tmov->get_real(MOV_TOTDOC));
|
|
if (tipodoc == "NC" || tipodoc =="ST")
|
|
totdoc = totdoc * -1;
|
|
if (totdoc.sign() < 0)
|
|
{
|
|
record.overwrite("-",180);
|
|
totdoc = totdoc * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",180);
|
|
str.format("%014s", (const char*) totdoc.string());
|
|
record.overwrite(str,181);
|
|
|
|
real ritfis (_tmov->get_real(MOV_RITFIS));
|
|
if (ritfis.sign() < 0)
|
|
{
|
|
record.overwrite("-",195);
|
|
ritfis = ritfis * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",195);
|
|
str.format("%014s", (const char*) ritfis.string());
|
|
record.overwrite(str,196);
|
|
|
|
real ritsoc (_tmov->get_real(MOV_RITSOC));
|
|
if (ritsoc.sign() < 0)
|
|
{
|
|
record.overwrite("-",210);
|
|
ritsoc = -ritsoc;
|
|
}
|
|
else
|
|
record.overwrite("+",210);
|
|
str.format("%014s", (const char*) ritsoc.string());
|
|
record.overwrite(str,211);
|
|
|
|
TString codvali = _tmov->get(MOV_CODVALI);
|
|
str.format("%-3s", (const char*) codvali);
|
|
record.overwrite(str,225);
|
|
|
|
real cambioi (_tmov->get_real(MOV_CAMBIOI));
|
|
str.format("%014s", (const char*)cambioi.string(0, 6));
|
|
record.overwrite(str,228);
|
|
|
|
real corrlire (_tmov->get_real(MOV_CORRLIRE));
|
|
if (corrlire.sign() < 0)
|
|
{
|
|
record.overwrite("-",242);
|
|
corrlire = -corrlire;
|
|
}
|
|
else
|
|
record.overwrite("+",242);
|
|
str.format("%014s", (const char*) corrlire.string());
|
|
record.overwrite(str,243);
|
|
|
|
real corrvaluta (_tmov->get_real(MOV_CORRVALUTA));
|
|
if (corrvaluta.sign() < 0)
|
|
{
|
|
record.overwrite("-",257);
|
|
corrvaluta = -corrvaluta;
|
|
}
|
|
else
|
|
record.overwrite("+",257);
|
|
dec2integer(corrvaluta,1000);
|
|
str.format("%016s", (const char*) corrvaluta.string());
|
|
record.overwrite(str,258);
|
|
|
|
TString ocfpi = _tmov->get(MOV_OCFPI);
|
|
str.format("%-16s", (const char*) ocfpi);
|
|
record.overwrite(str,274);
|
|
|
|
TString16 provvis = _tmov->get(MOV_PROVVIS);
|
|
record.overwrite(provvis, 523);
|
|
|
|
if (ocfpi.not_empty())
|
|
invio_occasionali(record,ocfpi);
|
|
|
|
_tras_file.write_control_rec(record,size);
|
|
}
|
|
_tras_file.close();
|
|
}
|
|
|
|
void TInv_cont::invio_occasionali(TString& record, TString& ocfpi)
|
|
{
|
|
TString str;
|
|
|
|
_toccas->setkey(1);
|
|
_toccas->zero();
|
|
_toccas->put(OCC_CFPI, ocfpi);
|
|
if (_toccas->read() == NOERR)
|
|
{
|
|
TString ragsoc = _toccas->get(OCC_RAGSOC);
|
|
str.format("%-50s", (const char*) ragsoc);
|
|
record.overwrite(str,290);
|
|
|
|
TString ind = _toccas->get(OCC_INDIR);
|
|
str.format("%-50s", (const char*) ind);
|
|
record.overwrite(str,340);
|
|
|
|
TString civ = _toccas->get(OCC_CIV);
|
|
str.format("%-6s", (const char*) civ);
|
|
record.overwrite(str,390);
|
|
|
|
TString stato = _toccas->get(OCC_STATO);
|
|
str.format("%-3s", (const char*) stato);
|
|
record.overwrite(str,396);
|
|
|
|
TString com = _toccas->get(OCC_COM);
|
|
str.format("%-4s", (const char*) com);
|
|
record.overwrite(str,399);
|
|
|
|
TString cap = _toccas->get(OCC_CAP);
|
|
str.format("%-5s", (const char*) cap);
|
|
record.overwrite(str,453);
|
|
|
|
TString datanasc = _toccas->get(OCC_DNASC);
|
|
TString app = riconverti_data(datanasc,TRUE);
|
|
str.format("%08s", (const char*) app);
|
|
record.overwrite(str,458);
|
|
|
|
TString statonasc = _toccas->get(OCC_STATONASC);
|
|
str.format("%-3s", (const char*) statonasc);
|
|
record.overwrite(str,466);
|
|
|
|
TString comnasc = _toccas->get(OCC_COMNASC);
|
|
str.format("%-4s", (const char*) comnasc);
|
|
record.overwrite(str,469);
|
|
}
|
|
}
|
|
|
|
// Invio a PC delle righe contabili
|
|
void TInv_cont::invio_righe_contabili()
|
|
{
|
|
const int size = 1024;
|
|
TString record(size);
|
|
|
|
_tras_file.open(_trasf,TRUE);
|
|
|
|
for (_trmov->first(); !_trmov->eof(); _trmov->next())
|
|
{
|
|
TString str;
|
|
|
|
_prog->addstatus(1);
|
|
|
|
record.spaces();
|
|
|
|
record.overwrite("Z2",0); //Tipo record
|
|
|
|
long nreg = _trmov->get_long(RMV_NUMREG);
|
|
str.format("%07ld", nreg);
|
|
record.overwrite(str,2); //Numero di registrazione
|
|
|
|
int nrig = _trmov->get_int (RMV_NUMRIG);
|
|
str.format("%03d", nrig);
|
|
record.overwrite(str,9);
|
|
|
|
TString4 sezione = _trmov->get(RMV_SEZIONE);
|
|
record.overwrite(sezione,60);
|
|
|
|
TString16 datareg = _trmov->get(RMV_DATAREG);
|
|
TString16 app = riconverti_data(datareg,TRUE);
|
|
str.format("%08s", (const char*) app);
|
|
record.overwrite(str,61); //Data di registrazione
|
|
|
|
int gruppo = _trmov->get_int(RMV_GRUPPO);
|
|
str.format("%03d", gruppo);
|
|
record.overwrite(str,69); //Gruppo di partita
|
|
|
|
int conto = _trmov->get_int(RMV_CONTO);
|
|
str.format("%03d", conto);
|
|
record.overwrite(str,72); //Conto di partita
|
|
|
|
long sottoc = _trmov->get_long(RMV_SOTTOCONTO);
|
|
str.format("%06ld", sottoc);
|
|
record.overwrite(str,75); //Sottoconto di partita
|
|
|
|
TString80 descr = _trmov->get(RMV_DESCR);
|
|
str.format("%-50s", (const char*) descr);
|
|
record.overwrite(str,81); //Descrizione riga di movimento
|
|
|
|
int gruppoc = _trmov->get_int(RMV_GRUPPOC);
|
|
str.format("%03d", gruppoc);
|
|
record.overwrite(str,131); //Gruppo di contropartita
|
|
|
|
int contoc = _trmov->get_int(RMV_CONTOC);
|
|
str.format("%03d", contoc);
|
|
record.overwrite(str,134); //Conto di contropartita
|
|
|
|
long sottocc = _trmov->get_long(RMV_SOTTOCONTOC);
|
|
str.format("%06ld", sottocc);
|
|
record.overwrite(str,137); //Sottoconto di contropartita
|
|
|
|
real importo (_trmov->get_real(RMV_IMPORTO));
|
|
if (importo.sign() < 0)
|
|
{
|
|
record.overwrite("-",143);
|
|
importo = importo * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",143);
|
|
str.format("%014s", (const char*) importo.string());
|
|
record.overwrite(str,144); //Importo riga di movimento
|
|
|
|
TString4 rowtype = _trmov->get(RMV_ROWTYPE);
|
|
record.overwrite(rowtype,158);
|
|
|
|
// record.overwrite(_trmov->get("CODCMS"),159);
|
|
// record.overwrite(_trmov->get("FASCMS"),179);
|
|
|
|
_tras_file.write_control_rec(record,size);
|
|
_numrec_pn++;
|
|
}
|
|
|
|
_tras_file.close();
|
|
}
|
|
|
|
void TInv_cont::tipodocumento(long nreg, TString& tipodoc)
|
|
{
|
|
TRecnotype rec = _tmov->recno();
|
|
TIsamtempfile& tmov = *_tmov;
|
|
|
|
tmov.setkey(1);
|
|
tmov.zero();
|
|
tmov.put(MOV_NUMREG, nreg);
|
|
if (tmov.read() == NOERR)
|
|
tipodoc = tmov.get(MOV_TIPODOC);
|
|
else
|
|
tipodoc = "";
|
|
|
|
_tmov->readat(rec);
|
|
}
|
|
|
|
// Invio a PC delle righe IVA
|
|
void TInv_cont::invio_righe_IVA()
|
|
{
|
|
const int size = 1024;
|
|
TString record(size);
|
|
long nreg_p = -1;
|
|
|
|
long cicli = _triva->items();
|
|
_prog = new TProgind(cicli,"Movimenti Iva: generazione file TRASFER per PC\nPrego attendere.",FALSE);
|
|
|
|
_tras_file.open(_trasf,TRUE);
|
|
TString4 tipodoc;
|
|
TString16 str;
|
|
|
|
for (_triva->first(); !_triva->eof(); _triva->next())
|
|
{
|
|
_prog->addstatus(1);
|
|
|
|
record.spaces();
|
|
|
|
long nreg = _triva->get_long(RMI_NUMREG);
|
|
int nrig = _triva->get_int (RMI_NUMRIG);
|
|
|
|
record.overwrite("U1",0); //Tipo record
|
|
|
|
str.format("%07ld", nreg);
|
|
record.overwrite(str,2); //Numero di registrazione
|
|
|
|
str.format("%03d", nrig);
|
|
record.overwrite(str,9); //Numero di riga
|
|
|
|
TString4 codiva = _triva->get(RMI_CODIVA);
|
|
str.format("%-4s", (const char*) codiva);
|
|
record.overwrite(str,60);
|
|
|
|
if (nreg != nreg_p)
|
|
{
|
|
tipodocumento(nreg,tipodoc);
|
|
}
|
|
// Tipo documento deve rimanere uguale fino a quando cambia il numero di registrazione!
|
|
// Non va percio' resettato ad ogni riga.
|
|
nreg_p = nreg;
|
|
real imponibile (_triva->get_real(RMI_IMPONIBILE));
|
|
if (tipodoc == "NC" || tipodoc =="ST")
|
|
imponibile = imponibile * -1;
|
|
if (imponibile.sign() < 0)
|
|
{
|
|
record.overwrite("-",64);
|
|
imponibile = imponibile * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",64);
|
|
str.format("%014s", (const char*) imponibile.string());
|
|
record.overwrite(str,65); //Imponibile
|
|
|
|
real imposta (_triva->get_real(RMI_IMPOSTA));
|
|
if (tipodoc == "NC" || tipodoc =="ST")
|
|
imposta = imposta * -1;
|
|
if (imposta.sign() < 0)
|
|
{
|
|
record.overwrite("-",79);
|
|
imposta = imposta * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",79);
|
|
str.format("%014s", (const char*) imposta.string());
|
|
record.overwrite(str,80); //Imposta
|
|
|
|
str = _triva->get(RMI_TIPODET);
|
|
record.overwrite(str,94); //Tipo detraibilita'
|
|
|
|
int tipocr = _triva->get_int(RMI_TIPOCR);
|
|
str.format("%d", tipocr);
|
|
record.overwrite(str,95); //Tipo costo/ricavo
|
|
|
|
bool intra = _triva->get_bool(RMI_INTRA);
|
|
if (intra)
|
|
record.overwrite("X",96);
|
|
else
|
|
record.overwrite(" ",96); //Flag causale x acquisti intracomunitari
|
|
|
|
int tipoatt = _triva->get_int(RMI_TIPOATT);
|
|
str.format("%d", tipoatt);
|
|
record.overwrite(str,97); //Tipo attivita'
|
|
|
|
int gruppo = _triva->get_int(RMI_GRUPPO);
|
|
str.format("%03d", gruppo);
|
|
record.overwrite(str,98); //Gruppo
|
|
|
|
int conto = _triva->get_int(RMI_CONTO);
|
|
str.format("%03d", conto);
|
|
record.overwrite(str,101); //Conto
|
|
|
|
long sottoc = _triva->get_long(RMI_SOTTOCONTO);
|
|
str.format("%06ld", sottoc);
|
|
record.overwrite(str,104); //Sottoconto
|
|
|
|
int rigaimp = _triva->get_int(RMI_RIGAIMP);
|
|
str.format("%03d", rigaimp);
|
|
record.overwrite(str,110);
|
|
|
|
int rigaiva = _triva->get_int(RMI_RIGAIVA);
|
|
str.format("%03d", rigaiva);
|
|
record.overwrite(str,113);
|
|
|
|
_tmov->setkey(1);
|
|
_tmov->put(MOV_NUMREG, nreg);
|
|
if (_tmov->read() == NOERR)
|
|
{
|
|
const int meseliq = _tmov->get_int(MOV_MESELIQ);
|
|
if (meseliq > 0)
|
|
{
|
|
str.format("%02d", meseliq);
|
|
record.overwrite(str, 116);
|
|
}
|
|
}
|
|
|
|
record.overwrite(_triva->get(RMI_NAVP), 148);
|
|
|
|
_numrec_iva++;
|
|
|
|
_tras_file.write_control_rec(record,size);
|
|
}
|
|
delete _prog;
|
|
|
|
_tras_file.close();
|
|
}
|
|
|
|
// Invio partite a PC
|
|
void TInv_cont::invio_partite()
|
|
{
|
|
const int size = 1024;
|
|
TString record(size);
|
|
TString datastr;
|
|
|
|
_tras_file.open(_trasf,TRUE);
|
|
|
|
for (_tpart->first(); !_tpart->eof(); _tpart->next())
|
|
{
|
|
TString str;
|
|
|
|
_prog->addstatus(1);
|
|
|
|
record.spaces();
|
|
|
|
record.overwrite("B1",0); //Tipo record
|
|
|
|
char tipo = _tpart->get_char(PART_TIPOCF);
|
|
str.format("%c", tipo);
|
|
record.overwrite(str,2); //Tipo Cliente/Fornitore
|
|
|
|
int gruppo = _tpart->get_int(PART_GRUPPO);
|
|
str.format("%03d", gruppo);
|
|
record.overwrite(str,3); //Gruppo
|
|
|
|
int conto = _tpart->get_int(PART_CONTO);
|
|
str.format("%03d", conto);
|
|
record.overwrite(str,6); //Conto
|
|
|
|
long sottoc = _tpart->get_long(PART_SOTTOCONTO);
|
|
str.format("%06ld", sottoc);
|
|
record.overwrite(str,9); //Sottoconto
|
|
|
|
int anno = _tpart->get_int(PART_ANNO);
|
|
str.format("%04d", anno);
|
|
record.overwrite(str,15); //Anno
|
|
|
|
TString numpart = _tpart->get(PART_NUMPART);
|
|
str.format("%-7s", (const char*) numpart);
|
|
record.overwrite(str,19); //Numero partita
|
|
|
|
int nriga = _tpart->get_int(PART_NRIGA);
|
|
str.format("%04d", nriga);
|
|
record.overwrite(str,26); //Numero riga partita
|
|
|
|
int tipomov = _tpart->get_int(PART_TIPOMOV);
|
|
str.format("%d", tipomov);
|
|
record.overwrite(str,60); //Tipo del movimento
|
|
|
|
int tipopag = _tpart->get_int(PART_TIPOPAG);
|
|
str.format("%d", tipopag);
|
|
record.overwrite(str,61); //Tipo pagamento
|
|
|
|
TString tiporeg = _tpart->get(PART_TIPOREG);
|
|
record.overwrite(tiporeg,62); //Tipo registrazione
|
|
|
|
long nreg = _tpart->get_long(PART_NREG);
|
|
str.format("%07ld", nreg);
|
|
record.overwrite(str,63); //Numero registrazione contabile
|
|
|
|
int numrig = _tpart->get_int(PART_NUMRIG);
|
|
str.format("%03d", numrig);
|
|
record.overwrite(str,70); //Numero riga registrazione contabile
|
|
|
|
TString datareg = _tpart->get(PART_DATAREG);
|
|
datastr = riconverti_data(datareg,TRUE);
|
|
str.format("%08s", (const char*) datastr);
|
|
record.overwrite(str,73); //Data di registrazione
|
|
|
|
TString datadoc = _tpart->get(PART_DATADOC);
|
|
datastr = riconverti_data(datadoc,TRUE);
|
|
str.format("%08s", (const char*) datastr);
|
|
record.overwrite(str,81); //Data documento
|
|
|
|
TString datapag = _tpart->get(PART_DATAPAG);
|
|
datastr = riconverti_data(datapag,TRUE);
|
|
str.format("%08s", (const char*) datastr);
|
|
record.overwrite(str,89); //Data pagamento
|
|
|
|
TString numdoc = _tpart->get(PART_NUMDOC);
|
|
str.format("%-7s", (const char*) numdoc);
|
|
record.overwrite(str,97); //Numero documento
|
|
|
|
TString descr = _tpart->get(PART_DESCR);
|
|
str.format("%-50s", (const char*) descr);
|
|
record.overwrite(str,104); //Descrizione partita
|
|
|
|
const char* reg = _tpart->get(PART_REG);
|
|
TString registro;
|
|
if (real::is_natural(reg))
|
|
{
|
|
int app = atoi(reg);
|
|
registro.format("%03d", app);
|
|
}
|
|
else
|
|
registro.format("%-3s", (const char*) reg);
|
|
record.overwrite(registro,154); //Codice registro IVA
|
|
|
|
long protiva = _tpart->get_long(PART_PROTIVA);
|
|
str.format("%05ld", protiva);
|
|
record.overwrite(str,157); //Numero protocollo IVA
|
|
|
|
const char* codcaus = _tpart->get(PART_CODCAUS);
|
|
if (real::is_natural(codcaus))
|
|
str.format("%03s", (const char*) codcaus);
|
|
else
|
|
str.format("%-3s", (const char*) codcaus);
|
|
record.overwrite(str,162); //Codice causale
|
|
|
|
TString sezione = _tpart->get(PART_SEZ);
|
|
record.overwrite(sezione,165); //Sezione
|
|
|
|
real importo (_tpart->get_real(PART_IMPORTO));
|
|
if (importo.sign() < 0)
|
|
{
|
|
record.overwrite("-",166);
|
|
importo = importo * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",166);
|
|
str.format("%014s", (const char*) importo.string());
|
|
record.overwrite(str,167); //Importo
|
|
|
|
real imposta (_tpart->get_real(PART_IMPOSTA));
|
|
if (imposta.sign() < 0)
|
|
{
|
|
record.overwrite("-",181);
|
|
imposta = imposta * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",181);
|
|
str.format("%014s", (const char*) imposta.string());
|
|
record.overwrite(str,182); //Imposta
|
|
|
|
real spese (_tpart->get_real(PART_SPESE));
|
|
if (spese.sign() < 0)
|
|
{
|
|
record.overwrite("-",196);
|
|
spese = spese * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",196);
|
|
str.format("%014s", (const char*) spese.string());
|
|
record.overwrite(str,197); //Spese
|
|
|
|
TString codval = _tpart->get(PART_CODVAL);
|
|
str.format("%-3s", (const char*) codval);
|
|
record.overwrite(str,211); //Codice valuta
|
|
|
|
real cambio (_tpart->get_real(PART_CAMBIO));
|
|
str.format("%014s", (const char*) cambio.string(0, 6));
|
|
record.overwrite(str,214); //Cambio
|
|
|
|
real importoval (_tpart->get_real(PART_IMPORTOVAL));
|
|
if (importoval.sign() < 0)
|
|
{
|
|
record.overwrite("-",228);
|
|
importoval = importoval * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",228);
|
|
dec2integer(importoval,1000);
|
|
str.format("%016s", (const char*) importoval.string());
|
|
record.overwrite(str,229); //Importo in valuta
|
|
|
|
TString datacam = _tpart->get(PART_DATACAM);
|
|
datastr = riconverti_data(datacam,TRUE);
|
|
str.format("%08s", (const char*) datastr);
|
|
record.overwrite(str,245); //Data cambio
|
|
|
|
real imptotdoc (_tpart->get_real(PART_IMPTOTDOC));
|
|
if (imptotdoc.sign() < 0)
|
|
{
|
|
record.overwrite("-",253);
|
|
imptotdoc = imptotdoc * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",253);
|
|
str.format("%014s", (const char*) imptotdoc.string());
|
|
record.overwrite(str,254); //Importo totale documento
|
|
|
|
real imptotval (_tpart->get_real(PART_IMPTOTVAL));
|
|
if (imptotval.sign() < 0)
|
|
{
|
|
record.overwrite("-",268);
|
|
imptotval = imptotval * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",268);
|
|
dec2integer(imptotval,1000);
|
|
str.format("%016s", (const char*) imptotval.string());
|
|
record.overwrite(str,269); //Importo totale documento in valuta
|
|
|
|
real ritenute (_tpart->get_real(PART_RITENUTE));
|
|
if (ritenute.sign() < 0)
|
|
{
|
|
record.overwrite("-",285);
|
|
ritenute = ritenute * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",285);
|
|
str.format("%014s", (const char*) ritenute.string());
|
|
record.overwrite(str,286); //Ritenute fiscali
|
|
|
|
real ritsoc (_tpart->get_real(PART_RITSOC));
|
|
if (ritsoc.sign() < 0)
|
|
{
|
|
record.overwrite("-",341);
|
|
ritsoc = -ritsoc;
|
|
}
|
|
else
|
|
record.overwrite("+",341);
|
|
str.format("%014s", (const char*) ritsoc.string());
|
|
record.overwrite(str,342); //Ritenute sociali
|
|
|
|
TString sezabb = _tpart->get(PART_SEZABB);
|
|
record.overwrite(sezabb,300); //Sezione abbuoni
|
|
|
|
real abbuoni (_tpart->get_real(PART_ABBUONI));
|
|
if (abbuoni.sign() < 0)
|
|
{
|
|
record.overwrite("-",301);
|
|
abbuoni = abbuoni * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",301);
|
|
dec2integer(abbuoni,1000);
|
|
str.format("%016s", (const char*) abbuoni.string());
|
|
record.overwrite(str,302); //Abbuoni
|
|
|
|
TString sezdifcam = _tpart->get(PART_SEZDIFCAM);
|
|
record.overwrite(sezdifcam,318); //Sezione differenza cambio
|
|
|
|
real diffcam (_tpart->get_real(PART_DIFFCAM));
|
|
if (diffcam.sign() < 0)
|
|
{
|
|
record.overwrite("-",319);
|
|
diffcam = diffcam * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",319);
|
|
str.format("%014s", (const char*) diffcam.string());
|
|
record.overwrite(str,320); //Differenza cambio
|
|
|
|
bool chiusa = _tpart->get_bool(PART_CHIUSA);
|
|
if (chiusa)
|
|
record.overwrite("X",334);
|
|
else
|
|
record.overwrite(" ",334);
|
|
|
|
bool ricaricata = _tpart->get_bool(PART_RICARICATA);
|
|
if (ricaricata)
|
|
record.overwrite("X",335);
|
|
else
|
|
record.overwrite(" ",335);
|
|
|
|
bool inviata = _tpart->get_bool(PART_INVIATA);
|
|
if (inviata)
|
|
record.overwrite("X",336);
|
|
else
|
|
record.overwrite(" ",336);
|
|
|
|
int gruppocl = _tpart->get_int(PART_GRUPPOCL);
|
|
str.format("%03d", gruppocl);
|
|
record.overwrite(str,336); //Gruppo cliente
|
|
|
|
int contocl = _tpart->get_int(PART_CONTOCL);
|
|
str.format("%03d", contocl);
|
|
record.overwrite(str,339); //Conto cliente
|
|
|
|
_tras_file.write_control_rec(record,size);
|
|
_numrec_sc++;
|
|
}
|
|
_tras_file.close();
|
|
}
|
|
|
|
void TInv_cont::invio_scadenze()
|
|
{
|
|
int size = 1024;
|
|
TString record(size);
|
|
|
|
_tras_file.open(_trasf,TRUE);
|
|
|
|
for (_tscad->first(); !_tscad->eof(); _tscad->next())
|
|
{
|
|
TString str;
|
|
|
|
_prog->addstatus(1);
|
|
|
|
record.spaces();
|
|
|
|
record.overwrite("B2",0); //Tipo record
|
|
|
|
char tipo = _tscad->get_char(SCAD_TIPOCF);
|
|
str.format("%c", tipo);
|
|
record.overwrite(str,2); //Tipo Cliente/Fornitore
|
|
|
|
int gruppo = _tscad->get_int(SCAD_GRUPPO);
|
|
str.format("%03d", gruppo);
|
|
record.overwrite(str,3); //Gruppo
|
|
|
|
int conto = _tscad->get_int(SCAD_CONTO);
|
|
str.format("%03d", conto);
|
|
record.overwrite(str,6); //Conto
|
|
|
|
long sottoc = _tscad->get_long(SCAD_SOTTOCONTO);
|
|
str.format("%06ld", sottoc);
|
|
record.overwrite(str,9); //Sottoconto
|
|
|
|
int anno = _tscad->get_int(SCAD_ANNO);
|
|
str.format("%04d", anno);
|
|
record.overwrite(str,15); //Anno
|
|
|
|
TString numpart = _tscad->get(SCAD_NUMPART);
|
|
str.format("%-7s", (const char*) numpart);
|
|
record.overwrite(str,19); //Numero partita
|
|
|
|
int nriga = _tscad->get_int(SCAD_NRIGA);
|
|
str.format("%04d", nriga);
|
|
record.overwrite(str,26); //Numero riga partita
|
|
|
|
int nrata = _tscad->get_int(SCAD_NRATA);
|
|
str.format("%04d", nrata);
|
|
record.overwrite(str,30); //Numero di rata
|
|
|
|
TString descr = _tscad->get(SCAD_DESCR);
|
|
str.format("%-50s", (const char*) descr);
|
|
record.overwrite(str,60); //Descrizione
|
|
|
|
TString codpag = _tscad->get(SCAD_CODPAG);
|
|
str.format("%-4s", (const char*) codpag);
|
|
record.overwrite(str,110); //Codice pagamento
|
|
|
|
int tipopag = _tscad->get_int(SCAD_TIPOPAG);
|
|
str.format("%d", tipopag);
|
|
record.overwrite(str,114); //Tipo pagamento
|
|
|
|
TString ultclass = _tscad->get(SCAD_ULTCLASS);
|
|
record.overwrite(ultclass,115); //Ulteriore classificazione
|
|
|
|
real importo (_tscad->get_real(SCAD_IMPORTO));
|
|
if (importo.sign() < 0)
|
|
{
|
|
record.overwrite("-",116);
|
|
importo = importo * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",116);
|
|
str.format("%014s", (const char*) importo.string());
|
|
record.overwrite(str,117); //Importo
|
|
|
|
real importoval (_tscad->get_real(SCAD_IMPORTOVAL));
|
|
if (importoval.sign() < 0)
|
|
{
|
|
record.overwrite("-",131);
|
|
importoval = importoval * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",131);
|
|
dec2integer(importoval,1000);
|
|
str.format("%016s", (const char*) importoval.string());
|
|
record.overwrite(str,132); //Importo in valuta
|
|
|
|
TString datascad = _tscad->get(SCAD_DATASCAD);
|
|
TString app = riconverti_data(datascad,TRUE);
|
|
str.format("%08s", (const char*) app);
|
|
record.overwrite(str,148); //Data scadenza
|
|
|
|
int nsoll = _tscad->get_int(SCAD_NSOLL);
|
|
str.format("%02d", nsoll);
|
|
record.overwrite(str,156); //Numero sollecito
|
|
|
|
TString datasoll = _tscad->get(SCAD_DATASOLL);
|
|
app = riconverti_data(datasoll,TRUE);
|
|
str.format("%08s", (const char*) app);
|
|
record.overwrite(str,158); //Data sollecito
|
|
|
|
int ggrit = _tscad->get_int(SCAD_GGRIT);
|
|
str.format("%04d", ggrit);
|
|
record.overwrite(str,166); //Giorni di ritardo
|
|
|
|
bool pagata = _tscad->get_bool(SCAD_PAGATA);
|
|
if (pagata)
|
|
record.overwrite("X",170);
|
|
else
|
|
record.overwrite(" ",170); //Scadenza pagata
|
|
|
|
real importopag (_tscad->get_real(SCAD_IMPORTOPAG));
|
|
if (importopag.sign() < 0)
|
|
{
|
|
record.overwrite("-",171);
|
|
importopag = importopag * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",171);
|
|
str.format("%014s", (const char*) importopag.string());
|
|
record.overwrite(str,172); //Importo pagato
|
|
|
|
long codabipr = _tscad->get_long(SCAD_CODABIPR);
|
|
str.format("%05ld", codabipr);
|
|
record.overwrite(str,186); //Codice ABI banca di presentazione
|
|
|
|
long codcabpr = _tscad->get_long(SCAD_CODCABPR);
|
|
str.format("%05ld", codcabpr);
|
|
record.overwrite(str,191); //Codice CAB banca di presentazione
|
|
|
|
long codabi = _tscad->get_long(SCAD_CODABI);
|
|
str.format("%05ld", codabi);
|
|
record.overwrite(str,196); //Codice ABI
|
|
|
|
long codcab = _tscad->get_long(SCAD_CODCAB);
|
|
str.format("%05ld", codcab);
|
|
record.overwrite(str,201); //Codice CAB
|
|
|
|
TString codag = _tscad->get(SCAD_CODAG);
|
|
str.format("%-5s", (const char*) codag);
|
|
record.overwrite(str,206); //Codice agente
|
|
|
|
bool bloccata = _tscad->get_bool(SCAD_BLOCCATA);
|
|
if (bloccata)
|
|
record.overwrite("X",211);
|
|
else
|
|
record.overwrite(" ",211);
|
|
|
|
_tras_file.write_control_rec(record,size);
|
|
_numrec_sc++;
|
|
}
|
|
|
|
_tras_file.close();
|
|
}
|
|
|
|
void TInv_cont::invio_pagsca()
|
|
{
|
|
int size = 1024;
|
|
TString record(size);
|
|
|
|
_tras_file.open(_trasf,TRUE);
|
|
|
|
for (_tpagsca->first(); !_tpagsca->eof(); _tpagsca->next())
|
|
{
|
|
TString str;
|
|
|
|
_prog->addstatus(1);
|
|
|
|
record.spaces();
|
|
|
|
record.overwrite("B3",0); //Tipo record
|
|
|
|
char tipo = _tpagsca->get_char(PAGSCA_TIPOC);
|
|
str.format("%c", tipo);
|
|
record.overwrite(str,2); //Tipo Cliente/Fornitore
|
|
|
|
int gruppo = _tpagsca->get_int(PAGSCA_GRUPPO);
|
|
str.format("%03d", gruppo);
|
|
record.overwrite(str,3); //Gruppo
|
|
|
|
int conto = _tpagsca->get_int(PAGSCA_CONTO);
|
|
str.format("%03d", conto);
|
|
record.overwrite(str,6); //Conto
|
|
|
|
long sottoc = _tpagsca->get_long(PAGSCA_SOTTOCONTO);
|
|
str.format("%06ld", sottoc);
|
|
record.overwrite(str,9); //Sottoconto
|
|
|
|
int anno = _tpagsca->get_int(PAGSCA_ANNO);
|
|
str.format("%04d", anno);
|
|
record.overwrite(str,15); //Anno
|
|
|
|
TString numpart = _tpagsca->get(PAGSCA_NUMPART);
|
|
str.format("%-7s", (const char*) numpart);
|
|
record.overwrite(str,19); //Numero partita
|
|
|
|
int nriga = _tpagsca->get_int(PAGSCA_NRIGA);
|
|
str.format("%04d", nriga);
|
|
record.overwrite(str,26); //Numero riga partita
|
|
|
|
int nrata = _tpagsca->get_int(PAGSCA_NRATA);
|
|
str.format("%04d", nrata);
|
|
record.overwrite(str,30); //Numero di rata
|
|
|
|
int nrigp = _tpagsca->get_int(PAGSCA_NRIGP);
|
|
str.format("%04d", nrigp);
|
|
record.overwrite(str,34); //Numero riga pagamento
|
|
|
|
TString accsal = _tpagsca->get(PAGSCA_ACCSAL);
|
|
record.overwrite(accsal,60); //Acconto/Saldo
|
|
|
|
real importo (_tpagsca->get_real(PAGSCA_IMPORTO));
|
|
if (importo.sign() < 0)
|
|
{
|
|
record.overwrite("-",61);
|
|
importo = importo * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",61);
|
|
str.format("%014s", (const char*) importo.string());
|
|
record.overwrite(str,62); //Importo
|
|
|
|
real importoval (_tpagsca->get_real(PAGSCA_IMPORTOVAL));
|
|
if (importoval.sign() < 0)
|
|
{
|
|
record.overwrite("-",76);
|
|
importoval = importoval * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",76);
|
|
dec2integer(importoval,1000);
|
|
str.format("%016s", (const char*) importoval.string());
|
|
record.overwrite(str,77); //Importo in valuta
|
|
|
|
TString passat = _tpagsca->get(PAGSCA_PASSATT);
|
|
record.overwrite(passat,93); //Abbuono attivo o passivo
|
|
|
|
real abbuoni (_tpagsca->get_real(PAGSCA_ABBUONI));
|
|
if (abbuoni.sign() < 0)
|
|
{
|
|
record.overwrite("-",94);
|
|
abbuoni = abbuoni * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",94);
|
|
dec2integer(abbuoni,1000);
|
|
str.format("%016s", (const char*) abbuoni.string());
|
|
record.overwrite(str,95); //Abbuoni
|
|
|
|
real diffcam (_tpagsca->get_real(PAGSCA_DIFFCAM));
|
|
if (diffcam.sign() < 0)
|
|
{
|
|
record.overwrite("-",111);
|
|
diffcam = diffcam * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",111);
|
|
str.format("%014s", (const char*) diffcam.string());
|
|
record.overwrite(str,112); //Differenza cambio
|
|
|
|
real ritenute (_tpagsca->get_real(PAGSCA_RITENUTE));
|
|
if (ritenute.sign() < 0)
|
|
{
|
|
record.overwrite("-",126);
|
|
ritenute = ritenute * -1;
|
|
}
|
|
else
|
|
record.overwrite("+",126);
|
|
str.format("%014s", (const char*) ritenute.string());
|
|
record.overwrite(str,127); //Ritenute fiscali
|
|
|
|
real ritsoc (_tpagsca->get_real(PAGSCA_RITSOC));
|
|
if (ritsoc.sign() < 0)
|
|
{
|
|
record.overwrite("-",178);
|
|
ritsoc = -ritsoc;
|
|
}
|
|
else
|
|
record.overwrite("+",178);
|
|
str.format("%014s", (const char*) ritsoc.string());
|
|
record.overwrite(str,179); //Ritenute sociali
|
|
|
|
char tipoc = _tpagsca->get_char(PAGSCA_TIPOCC);
|
|
str.format("%c", tipoc);
|
|
record.overwrite(str,141); //Tipo Cliente/Fornitore contropartita
|
|
|
|
int gruppoc = _tpagsca->get_int(PAGSCA_GRUPPOC);
|
|
str.format("%03d", gruppoc);
|
|
record.overwrite(str,142); //Gruppo contropartita
|
|
|
|
int contoc = _tpagsca->get_int(PAGSCA_CONTOC);
|
|
str.format("%03d", contoc);
|
|
record.overwrite(str,145); //Conto contropartita
|
|
|
|
long sottocc = _tpagsca->get_long(PAGSCA_SOTTOCONTC);
|
|
str.format("%06ld", sottocc);
|
|
record.overwrite(str,148); //Sottoconto contropartita
|
|
|
|
long codabi = _tpagsca->get_long(PAGSCA_CODABI);
|
|
str.format("%05ld", codabi);
|
|
record.overwrite(str,154); //Codice ABI
|
|
|
|
long codcab = _tpagsca->get_long(PAGSCA_CODCAB);
|
|
str.format("%05ld", codcab);
|
|
record.overwrite(str,159); //Codice CAB
|
|
|
|
long codabipr = _tpagsca->get_long(PAGSCA_CODABIPR);
|
|
str.format("%05ld", codabipr);
|
|
record.overwrite(str,164); //Codice ABI banca di presentazione
|
|
|
|
long codcabpr = _tpagsca->get_long(PAGSCA_CODCABPR);
|
|
str.format("%05ld", codcabpr);
|
|
record.overwrite(str,169); //Codice CAB banca di presentazione
|
|
|
|
TString codag = _tpagsca->get(PAGSCA_CODAG);
|
|
str.format("%-5s", (const char*) codag);
|
|
record.overwrite(str,174); //Codice agente
|
|
|
|
_tras_file.write_control_rec(record,size);
|
|
_numrec_sc++;
|
|
}
|
|
|
|
_tras_file.close();
|
|
}
|