Correzione errore MI2232, relativo al cambio di segno sugli importi

delle note di credito nel caso la lista controllo movimenti venga
lanciata un numero pari di volte.


git-svn-id: svn://10.65.10.50/trunk@3900 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1996-11-15 09:07:08 +00:00
parent 98aaa44159
commit 6f72a76dcc
3 changed files with 35 additions and 43 deletions

View File

@ -2695,8 +2695,6 @@ void TRic_ListaMov::aggiorna_mov()
if (mov.get(MOV_TIPOMOV).empty())
mov.put(MOV_TIPOMOV, _tipom_cau);
mov.put(MOV_CODPAG, _codpag_scad);
if (_tipodoc == "NC" || _tipodoc == "ST")
_tot_doc = _tot_doc * -1;
mov.put(MOV_TOTDOC, _tot_doc);
if (_is_salda)
{
@ -2732,13 +2730,6 @@ void TRic_ListaMov::aggiorna_iva(char tipo)
if (_anno == 0)
riva.put(RMI_ANNOES, _annoese);
if (_tipodoc == "NC" || _tipodoc == "ST")
{
_impo = _impo * -1;
_impos = _impos * -1;
}
riva.put(RMI_IMPONIBILE, _impo);
riva.put(RMI_IMPOSTA, _impos);
riva.put(RMI_TIPOC, tipo);
riva.rewrite();

View File

@ -1727,21 +1727,18 @@ void TTransfer_file::write_tmp_movPN(TString& record,bool create)
int TTransfer_file::trasfer_data_mov(TIsamtempfile& file, TRectype& dep)
{
const int ln = file.num();
file.zero();
file.curr() = dep;
if (file.read() == NOERR)
{
file.zero();
file.curr() = dep;
const bool ok = file.read() == NOERR;
file.zero();
file.curr() = dep;
if (ok)
file.rewrite();
}
else
{
file.zero();
file.curr() = dep;
file.write();
}
return 0;
}
@ -1871,7 +1868,7 @@ void TTransfer_file::write_tmp_movIVA(TString& record, bool create)
{
if (logicnum_p)
{
trasfer_data_moviva(*file, *dep, logicnum_p);
trasfer_data_moviva(*file, *dep, logicnum_p, tipodoc);
delete file;
delete dep;
}
@ -1962,22 +1959,40 @@ void TTransfer_file::write_tmp_movIVA(TString& record, bool create)
while (trc.is_key((const char*) key));
_prog->addstatus(1);
trasfer_data_moviva(*file, *dep, logicnum_p);
trasfer_data_moviva(*file, *dep, logicnum_p, tipodoc);
delete file;
delete dep;
} // if (trc.is_key((const char*) key))
}
int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int ln)
int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int ln, TString& tipodoc)
{
file.zero();
file.curr() = dep;
if (file.read() == NOERR)
{
if (ln == LF_MOV)
{
const bool ok = file.read() == NOERR;
if (ln != LF_MOV)
{
file.zero();
file.curr() = dep;
if (tipodoc == "NC" || tipodoc == "ST")
{
real imp = file.get_real(RMI_IMPONIBILE);
real iva = file.get_real(RMI_IMPOSTA);
imp = imp * -1;
iva = iva * -1;
file.put(RMI_IMPONIBILE,imp);
file.put(RMI_IMPOSTA,iva);
}
if (ok) file.rewrite();
else file.write();
}
else
if (ok)
{
TDate data74ter (dep.get_date(MOV_DATA74TER));
TString codval (dep.get (MOV_CODVALI));
TString ocfpi (dep.get (MOV_OCFPI));
@ -1985,7 +2000,7 @@ int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int
real cambioi (dep.get_real(MOV_CAMBIOI));
real corrlire (dep.get_real(MOV_CORRLIRE));
real corrvaluta(dep.get_real(MOV_CORRVALUTA));
file.put(MOV_DATA74TER, data74ter);
file.put(MOV_CODVALI, codval);
file.put(MOV_OCFPI, ocfpi);
@ -1993,23 +2008,9 @@ int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int
file.put(MOV_CAMBIOI, cambioi);
file.put(MOV_CORRLIRE, corrlire);
file.put(MOV_CORRVALUTA,corrvaluta);
file.rewrite();
}
else
{
file.zero();
file.curr() = dep;
file.rewrite();
}
}
else
{
file.zero();
file.curr() = dep;
file.write();
}
return 0;
}

View File

@ -213,7 +213,7 @@ private:
void write_tmp_movPN(TString& record, bool create);
int trasfer_data_mov(TIsamtempfile& file, TRectype& dep);
void write_tmp_movIVA(TString& record, bool create);
int trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int ln);
int trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int ln, TString& tipodoc);
// Funzioni per la ricezione del Saldaconto da Sistema
void write_tmp_movSC(TString& record, bool create);
void new_key(TString& key, int tipo, TString& buffer);