Patch level :4.0 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento :importazione movimenti di budget: adesso sistema la sezione D/A del movimento in base all'indicatore di bilancio del conto git-svn-id: svn://10.65.10.50/trunk@15063 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6a3392f645
commit
f5d05ffce9
@ -3,9 +3,9 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <filetext.h>
|
#include <filetext.h>
|
||||||
//#include <log.h>
|
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <reprint.h>
|
#include <reprint.h>
|
||||||
|
#include <reputils.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ protected:
|
|||||||
void mask2ini();
|
void mask2ini();
|
||||||
void ini2mask();
|
void ini2mask();
|
||||||
bool transfer();
|
bool transfer();
|
||||||
void transfer_movimento(const TRecord_text& curr); //, TError_log& log);
|
void transfer_movimento(const TRecord_text& curr, TLog_report& log);
|
||||||
const TString& ana2bill(const TString& contone) const;
|
const TString& ana2bill(const TString& contone) const;
|
||||||
|
|
||||||
long get_next_key();
|
long get_next_key();
|
||||||
@ -190,7 +190,7 @@ const TString& TBudget_Import::ana2bill(const TString& contone) const
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TBudget_Import::transfer_movimento(const TRecord_text& curr) //, TError_log& log)
|
void TBudget_Import::transfer_movimento(const TRecord_text& curr, TLog_report& log)
|
||||||
{
|
{
|
||||||
//formato definitivo del tracciato record dei CSV da importare (vedi anche il file crpa1.ini):
|
//formato definitivo del tracciato record dei CSV da importare (vedi anche il file crpa1.ini):
|
||||||
//codice commessa|conto|importo|inizio cms|fine cms
|
//codice commessa|conto|importo|inizio cms|fine cms
|
||||||
@ -241,18 +241,43 @@ void TBudget_Import::transfer_movimento(const TRecord_text& curr) //, TError_log
|
|||||||
TISAM_recordset pconana(query);
|
TISAM_recordset pconana(query);
|
||||||
const TRecnotype items = pconana.items();
|
const TRecnotype items = pconana.items();
|
||||||
if (items <= 0)
|
if (items <= 0)
|
||||||
warning_box(FR("Il sottoconto %s NON esiste!"), (const char*)codconto);
|
{
|
||||||
|
TString errore;
|
||||||
|
errore << "Il sottoconto " << codconto << " NON esiste!";
|
||||||
|
log.log(2, errore);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (items > 1)
|
if (items > 1)
|
||||||
warning_box(FR("Esiste piu' di un sottoconto %s!"), (const char*)codconto);
|
{
|
||||||
|
TString errore;
|
||||||
|
errore << "Esiste piu' di un sottoconto " << codconto ;
|
||||||
|
log.log(1, errore);
|
||||||
|
}
|
||||||
pconana.move_last(); //si posiziona sul record corretto
|
pconana.move_last(); //si posiziona sul record corretto
|
||||||
const TString& contone = pconana.get(PCONANA_CODCONTO).as_string();
|
const TString& contone = pconana.get(PCONANA_CODCONTO).as_string();
|
||||||
|
|
||||||
const TString& contcon = ana2bill(contone);
|
const TString& contcon = ana2bill(contone);
|
||||||
if (contcon.empty())
|
if (contcon.empty())
|
||||||
warning_box(FR("Il conto analitico %s non corrisponde ad alcun conto contabile!"), (const char*)contone);
|
{
|
||||||
|
TString errore;
|
||||||
const TString& sezione = pconana.get(PCONANA_SEZSALDI).as_string();
|
errore << "Il conto analitico " << contone << " non corrisponde ad alcun conto contabile!";
|
||||||
|
log.log(2, errore);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//deve stabilire se la sezione e' D o A in base all'indbil del conto analitico
|
||||||
|
TAnal_bill anazio(contone);
|
||||||
|
const int indbil = anazio.indicatore_bilancio();
|
||||||
|
char sezione = 'D';
|
||||||
|
if (indbil > 0)
|
||||||
|
sezione = (indbil == 1 || indbil == 3) ? 'D' : 'A';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TString errore;
|
||||||
|
errore << "Il conto analitico " << contone << " non ha un indicatore di bilancio!";
|
||||||
|
log.log(2, errore);
|
||||||
|
return;
|
||||||
|
}
|
||||||
//mette quella bastarda di sezione nel record
|
//mette quella bastarda di sezione nel record
|
||||||
movana.put(MOVANA_SEZIONE, sezione);
|
movana.put(MOVANA_SEZIONE, sezione);
|
||||||
|
|
||||||
@ -279,7 +304,6 @@ void TBudget_Import::transfer_movimento(const TRecord_text& curr) //, TError_log
|
|||||||
|
|
||||||
bool TBudget_Import::transfer()
|
bool TBudget_Import::transfer()
|
||||||
{
|
{
|
||||||
|
|
||||||
//azzeramento preventivo di movimenti, righe e saldi di tipo P
|
//azzeramento preventivo di movimenti, righe e saldi di tipo P
|
||||||
if (_msk->get(F_KILLOLD))
|
if (_msk->get(F_KILLOLD))
|
||||||
{
|
{
|
||||||
@ -311,25 +335,24 @@ bool TBudget_Import::transfer()
|
|||||||
//la causale!!!
|
//la causale!!!
|
||||||
_codcaus = _msk->get(F_COD_CAUS);
|
_codcaus = _msk->get(F_COD_CAUS);
|
||||||
|
|
||||||
//*** prima va inserito il log in libreria preparazione del log
|
|
||||||
// TError_log log;
|
|
||||||
// log.set_header(TR("Importazione movimenti"));
|
|
||||||
|
|
||||||
const long dimension = fsize(file);
|
const long dimension = fsize(file);
|
||||||
TProgind pi(dimension,TR("Importazione movimenti in corso..."));
|
TProgind pi(dimension,TR("Importazione movimenti in corso..."));
|
||||||
|
|
||||||
int err = NOERR;
|
int err = NOERR;
|
||||||
TRecord_text curr;
|
TRecord_text curr;
|
||||||
|
//log degli errori di trasferimento con soppressione degli errori ripetuti!
|
||||||
|
TLog_report log("Errori");
|
||||||
|
log.kill_duplicates();
|
||||||
|
|
||||||
while (_trasfile->read(curr) == NOERR && !pi.iscancelled() && err == NOERR)
|
while (_trasfile->read(curr) == NOERR && !pi.iscancelled() && err == NOERR)
|
||||||
{
|
{
|
||||||
pi.setstatus(_trasfile->read_file()->tellg());
|
pi.setstatus(_trasfile->read_file()->tellg());
|
||||||
transfer_movimento(curr); //, log);
|
transfer_movimento(curr, log);
|
||||||
}
|
}
|
||||||
_trasfile->close();
|
_trasfile->close();
|
||||||
delete _trasfile;
|
delete _trasfile;
|
||||||
|
|
||||||
// log.show();
|
log.preview();
|
||||||
_lastfile = _msk->get(F_NAMEFILE);
|
_lastfile = _msk->get(F_NAMEFILE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user