Modifica relativa agli occasionali nella ricezione da PC, e modifica relativa al cambio di segno del totale documento dell'imponibile e dell'imposta in caso di nota credito e storno

git-svn-id: svn://10.65.10.50/trunk@2688 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
nik 1996-03-22 09:44:35 +00:00
parent d2e2e9fb5f
commit a4f1d08bc5
4 changed files with 61 additions and 30 deletions

View File

@ -1154,6 +1154,8 @@ void TRic_ListaMov::aggiorna_mov()
mov.put(MOV_REG, _registro);
mov.put(MOV_TIPODOC, _tipodoc);
mov.put(MOV_TIPO, _tipocf);
if (_tipodoc == "NC" || _tipodoc == "ST")
_tot_doc = _tot_doc * -1;
mov.put(MOV_TOTDOC, _tot_doc);
mov.rewrite();
@ -1175,6 +1177,11 @@ void TRic_ListaMov::aggiorna_iva(char tipo)
TLocalisamfile& riva = current_cursor()->file(LF_RMOVIVA);
// 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);

View File

@ -159,6 +159,7 @@ public:
void invio_righe_contabili();
void invio_righe_IVA();
void invio_occasionali(TString& record, TString& ocfpi);
void tipodocumento(long nreg,TString& tipodoc);
TInv_cont(char mov);
};

View File

@ -745,7 +745,10 @@ void TInv_cont::invio_testata_movimenti()
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);
@ -952,10 +955,25 @@ void TInv_cont::invio_righe_contabili()
_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);
_tmov->readat(rec);
}
void TInv_cont::invio_righe_IVA()
{
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);
@ -985,7 +1003,13 @@ void TInv_cont::invio_righe_IVA()
str.format("%-4s", (const char*) codiva);
record.overwrite(str,60);
TString tipodoc = "";
if (nreg != nreg_p)
tipodocumento(nreg,tipodoc);
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);
@ -997,6 +1021,8 @@ void TInv_cont::invio_righe_IVA()
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);

View File

@ -4,7 +4,6 @@
#include <progind.h>
#include <stdlib.h>
#include <extcdecl.h>
#include "cglib.h"
#include "cglib04.h"
const int size = 256; //Lunghezza del record del TRASFER
@ -1484,16 +1483,6 @@ void TTransfer_file::write_tmp_movPN(TString& record,bool create)
if (fname == "TIPODOC")
tipodoc = field;
if (fname == "TOTDOC")
{
if (tipodoc == "NC" || tipodoc == "ST")
{
real totdoc (field);
totdoc = totdoc * -1;
field = totdoc.string();
}
}
}
if (fname == "IMPORTO")
@ -1781,15 +1770,6 @@ void TTransfer_file::write_tmp_movIVA(TString& record, bool create)
int nriga = atoi(field);
field.format("%3d", nriga);
}
if (fname == "IMPONIBILE" || fname == "IMPOSTA")
{
if (tipodoc == "NC" || tipodoc == "ST")
{
real imp (field);
imp = imp * -1;
field = imp.string();
}
}
}
if (logicnum == LF_MOV && ( fname == "NUMREG" || flag == 2 ) )
@ -2920,7 +2900,17 @@ void TTransfer_file::write_testata_movimenti(TString& record)
if (fname == MOV_OCFPI)
if (field.trim().empty())
occas = FALSE;
{
TString rags = record.sub(290,340);
if (rags.trim().not_empty())
{
TString app = "RIC";
_npoccas++;
field.format("%3s%6d", (const char*)app,_npoccas);
}
else
occas = FALSE;
}
if (flag == 2)
{
@ -3410,9 +3400,16 @@ const char* riconverti (TString& data_PC,bool anno_di_quattro)
int date2esc(const TDate& d, int* prevesc)
{
if (prevesc) *prevesc = 0;
TEsercizi_contabili esc;
int e = esc.date2esc(d);
if (prevesc) *prevesc = esc.pred(e);
return e;
TTable esc("ESC");
for (int err = esc.first(); err == NOERR; err = esc.next())
{
const TDate ia(esc.get("D0")); // Data inizio esercizio
const TDate fa(esc.get("D1")); // Data fine esercizio
const anno = esc.get_int("CODTAB");
if (d >= ia && d <= fa)
return anno;
if (prevesc) *prevesc = anno;
}
return 0;
}