Correzione MI3465 e MI3466.
git-svn-id: svn://10.65.10.50/trunk@4219 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0f86adfeae
commit
844bc34d22
@ -753,6 +753,16 @@ bool TInv_cont::tabella_ditta()
|
||||
_files << "B";
|
||||
|
||||
_flag_bollato = ind.get_bool("B7");
|
||||
|
||||
// Compila l'array contenente le causali di corrispondenza per l'invio extracontabile
|
||||
TString s5(ind.get("S5"));
|
||||
_tab_cau.destroy();
|
||||
_tab_cau.add(s5.mid(0,2));
|
||||
_tab_cau.add(s5.mid(3,5));
|
||||
_tab_cau.add(s5.mid(6,8));
|
||||
_tab_cau.add(s5.mid(9,11));
|
||||
_tab_cau.add(s5.mid(12,15));
|
||||
_tab_cau.add(s5.mid(16,18));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -812,8 +822,10 @@ bool TInv_cont::setta_maschera_hnd(TMask_field& f, KEY k)
|
||||
{
|
||||
if ( (k == K_TAB || k == K_ENTER) && f.mask().is_running())
|
||||
{
|
||||
app()._ditta = f.mask().get_long(F_DITTAINV);
|
||||
if (!prefix().exist(app()._ditta))
|
||||
long& d = app()._ditta;
|
||||
d = f.mask().get_long(F_DITTAINV);
|
||||
if (d == 0L) return TRUE;
|
||||
if (!prefix().exist(d))
|
||||
return error_box("La ditta indicata non e' abilitata alla contabilita'");
|
||||
|
||||
if (!app().tabella_ditta())
|
||||
@ -822,7 +834,7 @@ bool TInv_cont::setta_maschera_hnd(TMask_field& f, KEY k)
|
||||
if (app()._stato != "")
|
||||
return error_box("Rilevato STATO DI RIPARTENZA NON RECUPERABILE sulla ditta richiesta");
|
||||
|
||||
f.mask().set(F_DITTAINV, app()._ditta);
|
||||
f.mask().set(F_DITTAINV, d);
|
||||
app().codifica_ditta(f.mask());
|
||||
f.mask().set(F_NUMULINV, app()._num);
|
||||
f.mask().set(F_DATAULIN, app()._data.string());
|
||||
|
@ -71,6 +71,8 @@ class TInv_cont : public TApplication
|
||||
TIsamtempfile* _tpagsca;
|
||||
TArchive _arc;
|
||||
TAssoc_array _riga_interna, _ultima_rata;
|
||||
TArray _tab_cau; // tabella di corrispondenza causali per invio saldaconto extracontabile a sistema
|
||||
|
||||
|
||||
char _scelta;
|
||||
|
||||
|
@ -96,6 +96,16 @@ bool TLista_archivi::tabella_ditta()
|
||||
if (ind.get_bool("B5"))
|
||||
_files << "B";
|
||||
|
||||
// Compila l'array contenente le causali di corrispondenza per l'invio extracontabile
|
||||
TString s5(ind.get("S5"));
|
||||
_tab_cau.destroy();
|
||||
_tab_cau.add(s5.mid(0,2));
|
||||
_tab_cau.add(s5.mid(3,5));
|
||||
_tab_cau.add(s5.mid(6,8));
|
||||
_tab_cau.add(s5.mid(9,11));
|
||||
_tab_cau.add(s5.mid(12,15));
|
||||
_tab_cau.add(s5.mid(16,18));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -960,6 +970,15 @@ void TLista_archivi::controlla_fatture(char file)
|
||||
errore = TRUE;
|
||||
stampa.add(" - Rilevato un numero di registrazione corrispondente a primanota composto da 7 cifre");
|
||||
}
|
||||
else
|
||||
if (nreg == 0) // Allora fa parte del saldaconto extracontabile: si controlli la tabella di corrispondenza relativa al tipo mov.
|
||||
{
|
||||
if (((TString&) _tab_cau[_part->get_int(PART_TIPOMOV)-1]).trim().empty())
|
||||
{
|
||||
errore = TRUE;
|
||||
stampa.add(" - Rilevato un movimento extracontabile senza causale. Compilare tabella di corrispondenza");
|
||||
}
|
||||
}
|
||||
if (numrig > 99)
|
||||
{
|
||||
errore = TRUE;
|
||||
|
@ -29,6 +29,7 @@ class TLista_archivi : public TApplication
|
||||
TLocalisamfile* _part;
|
||||
TLocalisamfile* _scad;
|
||||
TLocalisamfile* _pagsca;
|
||||
TArray _tab_cau; // tabella di corrispondenza causali per invio saldaconto extracontabile a sistema
|
||||
|
||||
TString _files, _ragsoc;
|
||||
TDate _datalimite;
|
||||
|
361
cg/cg6902.cpp
361
cg/cg6902.cpp
@ -1493,6 +1493,12 @@ long TInv_cont::crea_record_riferimento_PN()
|
||||
str.format("%c", tipocf);
|
||||
record.overwrite(str,219); //Flag Cliente / Fornitore
|
||||
|
||||
TString codcaus (_tpart->get(PART_CODCAUS));
|
||||
if (tipocf != ' ' && codcaus.empty())
|
||||
codcaus = (TString&)_tab_cau[_tpart->get_int(PART_TIPOMOV)-1]; // Causale
|
||||
str.format("%03s",(const char*)codcaus);
|
||||
record.overwrite(str,41);
|
||||
|
||||
_tras_file.write_control_rec(record,size);
|
||||
|
||||
_numrec_pn++;
|
||||
@ -1510,8 +1516,9 @@ void TInv_cont::partita2trasfer(TString& record, bool crea_record_riferimento)
|
||||
|
||||
long nreg = _tpart->get_long(PART_NREG);
|
||||
int nrig = _tpart->get_int (PART_NUMRIG);
|
||||
const bool extra = nreg == 0 && nrig == 0;
|
||||
|
||||
if (nreg == 0 && nrig == 0) //Se si tratta di extracontabile nreg = 0 e nrig = 0
|
||||
if (extra) //Se si tratta di extracontabile nreg = 0 e nrig = 0
|
||||
{ //prendo come nreg l'ultimo che trovo sugli archivi + 1.
|
||||
if (crea_record_riferimento) //Creo anche un record di riferimento nei mov di PN (Z1).
|
||||
nreg = crea_record_riferimento_PN(); //In caso di abbuoni o diff.cambio o ritenute non e'
|
||||
@ -1595,6 +1602,8 @@ void TInv_cont::partita2trasfer(TString& record, bool crea_record_riferimento)
|
||||
record.overwrite(str,58); //Numero protocollo IVA
|
||||
|
||||
TString codcaus (_tpart->get(PART_CODCAUS));
|
||||
if (extra && tipoAS < 3 && codcaus.empty())
|
||||
codcaus = (TString&)_tab_cau[tipomov-1]; // Causale da tabella
|
||||
str.format("%03s", (const char*)codcaus);
|
||||
record.overwrite(str,63); //Codice causale
|
||||
|
||||
@ -1753,182 +1762,182 @@ bool TInv_cont::invio_mov_SC()
|
||||
int nriga = _tpart->get_int (PART_NRIGA);
|
||||
int tipomov = _tpart->get_int (PART_TIPOMOV);
|
||||
|
||||
if (tipo == 'C' || tipo == 'F')
|
||||
{
|
||||
if (tipomov == 1)
|
||||
{
|
||||
_tscad->zero();
|
||||
_tscad->put(SCAD_TIPOCF, tipo);
|
||||
if (gruppo != 0)
|
||||
_tscad->put(SCAD_GRUPPO, gruppo);
|
||||
if (conto != 0)
|
||||
_tscad->put(SCAD_CONTO, conto);
|
||||
if (sottoc != 0)
|
||||
_tscad->put(SCAD_SOTTOCONTO, sottoc);
|
||||
_tscad->put(SCAD_ANNO, anno);
|
||||
_tscad->put(SCAD_NUMPART, numpart);
|
||||
_tscad->put(SCAD_NRIGA, nriga);
|
||||
|
||||
TRectype scad (_tscad->curr());
|
||||
|
||||
TString rec,file,str,codpag,ultclass,datascad,numero,codag,impvalstr,numpart;
|
||||
|
||||
for (_tscad->read(_isgteq); !_tscad->eof(); _tscad->next())
|
||||
{
|
||||
rec = scad.get(SCAD_NUMPART);
|
||||
file = _tscad->get(SCAD_NUMPART);
|
||||
|
||||
if (_tscad->curr() != scad || file != rec) break;
|
||||
|
||||
partita2trasfer(record);
|
||||
|
||||
int nrata = _tscad->get_int(SCAD_NRATA);
|
||||
str.format("%02d", nrata);
|
||||
record.overwrite(str,35); //Numero di rata
|
||||
|
||||
char tipo = _tscad->get_char(SCAD_TIPOCF);
|
||||
int g = _tscad->get_int (SCAD_GRUPPO);
|
||||
int c = _tscad->get_int (SCAD_CONTO);
|
||||
long s = _tscad->get_long(SCAD_SOTTOCONTO);
|
||||
int anno = _tscad->get_int (SCAD_ANNO);
|
||||
numpart = _tscad->get(SCAD_NUMPART);
|
||||
aggiorna_array_rate(tipo,g,c,s,anno,numpart,nrata);
|
||||
|
||||
codpag = _tscad->get(SCAD_CODPAG);
|
||||
str.format("%-2s", (const char*) codpag);
|
||||
record.overwrite(str,112); //Codice di pagamento
|
||||
|
||||
int tipopag = _tscad->get_int(SCAD_TIPOPAG);
|
||||
str.format("%d", tipopag);
|
||||
record.overwrite(str,114); //Tipo pagamento
|
||||
|
||||
ultclass = _tscad->get(SCAD_ULTCLASS);
|
||||
str.format("%s", (const char*) ultclass);
|
||||
record.overwrite(str,115); //Ulteriore classificazione
|
||||
|
||||
real importo (_tscad->get_real(SCAD_IMPORTO));
|
||||
numero = importo.string();
|
||||
if (importo.sign() < 0)
|
||||
negPC2negAS(numero);
|
||||
str.format("%011s", (const char*) numero);
|
||||
record.overwrite(str,116); //Importo in lire rata partita
|
||||
|
||||
real importoval (_tscad->get_real(SCAD_IMPORTOVAL));
|
||||
dec2integer(importoval,1000);
|
||||
impvalstr = importoval.string();
|
||||
if (importoval.sign() < 0)
|
||||
negPC2negAS(impvalstr);
|
||||
str.format("%013s", (const char*) impvalstr);
|
||||
record.overwrite(str,127); //Importo in valuta rata partita
|
||||
|
||||
datascad = _tscad->get_date(SCAD_DATASCAD);
|
||||
str = riconverti(datascad,FALSE);
|
||||
str.format("%06s", (const char*) str);
|
||||
record.overwrite(str,140); //Data scadenza
|
||||
|
||||
codag = _tscad->get(SCAD_CODAG);
|
||||
str.format("%-6s", (const char*) codag);
|
||||
record.overwrite(str,172); //Codice agente
|
||||
|
||||
_tras_file.write_control_rec(record,size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_tpagsca->zero();
|
||||
_tpagsca->put(PAGSCA_TIPOC, tipo);
|
||||
if (gruppo != 0)
|
||||
_tpagsca->put(PAGSCA_GRUPPO, gruppo);
|
||||
if (conto != 0)
|
||||
_tpagsca->put(PAGSCA_CONTO, conto);
|
||||
if (sottoc != 0)
|
||||
_tpagsca->put(PAGSCA_SOTTOCONTO, sottoc);
|
||||
_tpagsca->put(PAGSCA_ANNO, anno);
|
||||
_tpagsca->put(PAGSCA_NUMPART, numpart);
|
||||
|
||||
TRectype pagsca (_tpagsca->curr());
|
||||
|
||||
TString str,rec,file;
|
||||
|
||||
for (_tpagsca->read(_isgteq); !_tpagsca->eof(); _tpagsca->next())
|
||||
{
|
||||
int nrigp = _tpagsca->get_int(PAGSCA_NRIGP);
|
||||
|
||||
rec = pagsca.get(PAGSCA_NUMPART);
|
||||
file = _tpagsca->get(PAGSCA_NUMPART);
|
||||
|
||||
if (_tpagsca->curr() != pagsca || file != rec) break;
|
||||
|
||||
if (nriga != nrigp) continue;
|
||||
|
||||
partita2trasfer(record);
|
||||
|
||||
real importo (_tpagsca->get_real(PAGSCA_IMPORTO));
|
||||
real importoval (_tpagsca->get_real(PAGSCA_IMPORTOVAL));
|
||||
pagsca2trasfer(record,importo,importoval);
|
||||
|
||||
real abbuoni (_tpagsca->get_real(PAGSCA_ABBUONI));
|
||||
if (abbuoni != ZERO)
|
||||
{
|
||||
char sezabb;
|
||||
char passat = _tpagsca->get_char(PAGSCA_PASSATT);
|
||||
char sez = _tpart->get_char(PART_SEZ);
|
||||
if (passat == 'A')
|
||||
sezabb = 'D';
|
||||
else
|
||||
if (passat == 'P')
|
||||
sezabb = 'A';
|
||||
if (sezabb != sez)
|
||||
abbuoni = abbuoni * -1;
|
||||
real abblire = ZERO;
|
||||
if (tipo == 'C' || tipo == 'F')
|
||||
{
|
||||
if (tipomov == 1)
|
||||
{
|
||||
_tscad->zero();
|
||||
_tscad->put(SCAD_TIPOCF, tipo);
|
||||
if (gruppo != 0)
|
||||
_tscad->put(SCAD_GRUPPO, gruppo);
|
||||
if (conto != 0)
|
||||
_tscad->put(SCAD_CONTO, conto);
|
||||
if (sottoc != 0)
|
||||
_tscad->put(SCAD_SOTTOCONTO, sottoc);
|
||||
_tscad->put(SCAD_ANNO, anno);
|
||||
_tscad->put(SCAD_NUMPART, numpart);
|
||||
_tscad->put(SCAD_NRIGA, nriga);
|
||||
|
||||
TRectype scad (_tscad->curr());
|
||||
|
||||
TString rec,file,str,codpag,ultclass,datascad,numero,codag,impvalstr,numpart;
|
||||
|
||||
for (_tscad->read(_isgteq); !_tscad->eof(); _tscad->next())
|
||||
{
|
||||
rec = scad.get(SCAD_NUMPART);
|
||||
file = _tscad->get(SCAD_NUMPART);
|
||||
|
||||
if (_tscad->curr() != scad || file != rec) break;
|
||||
|
||||
partita2trasfer(record);
|
||||
|
||||
int nrata = _tscad->get_int(SCAD_NRATA);
|
||||
str.format("%02d", nrata);
|
||||
record.overwrite(str,35); //Numero di rata
|
||||
|
||||
char tipo = _tscad->get_char(SCAD_TIPOCF);
|
||||
int g = _tscad->get_int (SCAD_GRUPPO);
|
||||
int c = _tscad->get_int (SCAD_CONTO);
|
||||
long s = _tscad->get_long(SCAD_SOTTOCONTO);
|
||||
int anno = _tscad->get_int (SCAD_ANNO);
|
||||
numpart = _tscad->get(SCAD_NUMPART);
|
||||
aggiorna_array_rate(tipo,g,c,s,anno,numpart,nrata);
|
||||
|
||||
codpag = _tscad->get(SCAD_CODPAG);
|
||||
str.format("%-2s", (const char*) codpag);
|
||||
record.overwrite(str,112); //Codice di pagamento
|
||||
|
||||
int tipopag = _tscad->get_int(SCAD_TIPOPAG);
|
||||
str.format("%d", tipopag);
|
||||
record.overwrite(str,114); //Tipo pagamento
|
||||
|
||||
ultclass = _tscad->get(SCAD_ULTCLASS);
|
||||
str.format("%s", (const char*) ultclass);
|
||||
record.overwrite(str,115); //Ulteriore classificazione
|
||||
|
||||
real importo (_tscad->get_real(SCAD_IMPORTO));
|
||||
numero = importo.string();
|
||||
if (importo.sign() < 0)
|
||||
negPC2negAS(numero);
|
||||
str.format("%011s", (const char*) numero);
|
||||
record.overwrite(str,116); //Importo in lire rata partita
|
||||
|
||||
real importoval (_tscad->get_real(SCAD_IMPORTOVAL));
|
||||
dec2integer(importoval,1000);
|
||||
impvalstr = importoval.string();
|
||||
if (importoval.sign() < 0)
|
||||
negPC2negAS(impvalstr);
|
||||
str.format("%013s", (const char*) impvalstr);
|
||||
record.overwrite(str,127); //Importo in valuta rata partita
|
||||
|
||||
datascad = _tscad->get_date(SCAD_DATASCAD);
|
||||
str = riconverti(datascad,FALSE);
|
||||
str.format("%06s", (const char*) str);
|
||||
record.overwrite(str,140); //Data scadenza
|
||||
|
||||
codag = _tscad->get(SCAD_CODAG);
|
||||
str.format("%-6s", (const char*) codag);
|
||||
record.overwrite(str,172); //Codice agente
|
||||
|
||||
_tras_file.write_control_rec(record,size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_tpagsca->zero();
|
||||
_tpagsca->put(PAGSCA_TIPOC, tipo);
|
||||
if (gruppo != 0)
|
||||
_tpagsca->put(PAGSCA_GRUPPO, gruppo);
|
||||
if (conto != 0)
|
||||
_tpagsca->put(PAGSCA_CONTO, conto);
|
||||
if (sottoc != 0)
|
||||
_tpagsca->put(PAGSCA_SOTTOCONTO, sottoc);
|
||||
_tpagsca->put(PAGSCA_ANNO, anno);
|
||||
_tpagsca->put(PAGSCA_NUMPART, numpart);
|
||||
|
||||
TRectype pagsca (_tpagsca->curr());
|
||||
|
||||
TString str,rec,file;
|
||||
|
||||
for (_tpagsca->read(_isgteq); !_tpagsca->eof(); _tpagsca->next())
|
||||
{
|
||||
int nrigp = _tpagsca->get_int(PAGSCA_NRIGP);
|
||||
|
||||
rec = pagsca.get(PAGSCA_NUMPART);
|
||||
file = _tpagsca->get(PAGSCA_NUMPART);
|
||||
|
||||
if (_tpagsca->curr() != pagsca || file != rec) break;
|
||||
|
||||
if (nriga != nrigp) continue;
|
||||
|
||||
partita2trasfer(record);
|
||||
|
||||
real importo (_tpagsca->get_real(PAGSCA_IMPORTO));
|
||||
real importoval (_tpagsca->get_real(PAGSCA_IMPORTOVAL));
|
||||
pagsca2trasfer(record,importo,importoval);
|
||||
|
||||
real abbuoni (_tpagsca->get_real(PAGSCA_ABBUONI));
|
||||
if (abbuoni != ZERO)
|
||||
{
|
||||
char sezabb;
|
||||
char passat = _tpagsca->get_char(PAGSCA_PASSATT);
|
||||
char sez = _tpart->get_char(PART_SEZ);
|
||||
if (passat == 'A')
|
||||
sezabb = 'D';
|
||||
else
|
||||
if (passat == 'P')
|
||||
sezabb = 'A';
|
||||
if (sezabb != sez)
|
||||
abbuoni = abbuoni * -1;
|
||||
real abblire = ZERO;
|
||||
partita2trasfer(record,FALSE);
|
||||
if (_codval.not_empty())
|
||||
{
|
||||
abblire = abbuoni * _cambio;
|
||||
abblire.round();
|
||||
}
|
||||
str.format("%d", 4);
|
||||
record.overwrite(str,37);
|
||||
str.format("%c", sezabb);
|
||||
record.overwrite(str,152);
|
||||
if (_codval.not_empty())
|
||||
pagsca2trasfer(record,abblire,abbuoni);
|
||||
else
|
||||
pagsca2trasfer(record,abbuoni,abblire);
|
||||
}
|
||||
|
||||
real diffcam (_tpagsca->get_real(PAGSCA_DIFFCAM));
|
||||
if (diffcam != ZERO)
|
||||
{
|
||||
real imp = ZERO;
|
||||
partita2trasfer(record,FALSE);
|
||||
char sez = _tpart->get_char(PART_SEZ);
|
||||
if (diffcam < ZERO)
|
||||
{
|
||||
diffcam = diffcam * -1;
|
||||
if (sez == 'D')
|
||||
sez = 'A';
|
||||
else
|
||||
if (sez == 'A')
|
||||
sez = 'D';
|
||||
}
|
||||
str.format("%d", 4);
|
||||
record.overwrite(str,37);
|
||||
str.format("%c", sez);
|
||||
record.overwrite(str,152);
|
||||
pagsca2trasfer(record,diffcam,imp);
|
||||
}
|
||||
|
||||
real ritenute (_tpagsca->get_real(PAGSCA_RITENUTE));
|
||||
if (ritenute != ZERO)
|
||||
{
|
||||
real imp = ZERO;
|
||||
partita2trasfer(record,FALSE);
|
||||
pagsca2trasfer(record,ritenute,imp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_codval.not_empty())
|
||||
{
|
||||
abblire = abbuoni * _cambio;
|
||||
abblire.round();
|
||||
}
|
||||
str.format("%d", 4);
|
||||
record.overwrite(str,37);
|
||||
str.format("%c", sezabb);
|
||||
record.overwrite(str,152);
|
||||
if (_codval.not_empty())
|
||||
pagsca2trasfer(record,abblire,abbuoni);
|
||||
else
|
||||
pagsca2trasfer(record,abbuoni,abblire);
|
||||
}
|
||||
|
||||
real diffcam (_tpagsca->get_real(PAGSCA_DIFFCAM));
|
||||
if (diffcam != ZERO)
|
||||
{
|
||||
real imp = ZERO;
|
||||
partita2trasfer(record,FALSE);
|
||||
char sez = _tpart->get_char(PART_SEZ);
|
||||
if (diffcam < ZERO)
|
||||
{
|
||||
diffcam = diffcam * -1;
|
||||
if (sez == 'D')
|
||||
sez = 'A';
|
||||
else
|
||||
if (sez == 'A')
|
||||
sez = 'D';
|
||||
}
|
||||
str.format("%d", 4);
|
||||
record.overwrite(str,37);
|
||||
str.format("%c", sez);
|
||||
record.overwrite(str,152);
|
||||
pagsca2trasfer(record,diffcam,imp);
|
||||
}
|
||||
|
||||
real ritenute (_tpagsca->get_real(PAGSCA_RITENUTE));
|
||||
if (ritenute != ZERO)
|
||||
{
|
||||
real imp = ZERO;
|
||||
partita2trasfer(record,FALSE);
|
||||
pagsca2trasfer(record,ritenute,imp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete _prog;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user