Patch level : NO PATCH
Files correlati : Ricompilazione Demo : [ ] Commento : Generate tutti i tipi riga; mancano le decodifiche e alcuni campi sulle righe stesse git-svn-id: svn://10.65.10.50/branches/R_10_00@21194 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									335f4aa082
								
							
						
					
					
						commit
						861e33ad2f
					
				
							
								
								
									
										20
									
								
								lv/lv4.cpp
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								lv/lv4.cpp
									
									
									
									
									
								
							@ -7,19 +7,13 @@ int main(int argc, char** argv)
 | 
			
		||||
  int n = argc > 1 ? atoi(argv[1]+1) : 0;
 | 
			
		||||
  switch(n)
 | 
			
		||||
  {
 | 
			
		||||
  case 1:
 | 
			
		||||
    lv4200(argc, argv); break;	// Importazione saldaconto
 | 
			
		||||
  case 2:
 | 
			
		||||
    lv4300(argc, argv); break;	// Importazione cespiti
 | 
			
		||||
	case 3:
 | 
			
		||||
    lv4400(argc, argv); break;	// Riscrittura movimenti
 | 
			
		||||
	case 5:
 | 
			
		||||
    lv4600(argc, argv); break;	// Riclassificazione conti COGECO
 | 
			
		||||
	case 6:
 | 
			
		||||
    lv4700(argc, argv); break;	// Riclassificazione tabelle COGECO
 | 
			
		||||
  case 0:
 | 
			
		||||
  default:
 | 
			
		||||
    lv4100(argc, argv); break;	//importazione movimenti contabili
 | 
			
		||||
  case 1:  lv4200(argc, argv); break;	// Importazione saldaconto
 | 
			
		||||
  case 2:  lv4300(argc, argv); break;	// Importazione cespiti
 | 
			
		||||
	case 3:  lv4400(argc, argv); break;	// Riscrittura movimenti
 | 
			
		||||
  case 4:  lv4500(argc, argv); break;	// Importa fatture
 | 
			
		||||
  case 5:  lv4600(argc, argv); break;	// Riclassificazione conti COGECO
 | 
			
		||||
  case 6:  lv4700(argc, argv); break;	// Riclassificazione tabelle COGECO
 | 
			
		||||
  default: lv4100(argc, argv); break;	// Importazione movimenti contabili
 | 
			
		||||
  }
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								lv/lv4.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								lv/lv4.h
									
									
									
									
									
								
							@ -2,5 +2,6 @@ int lv4100(int argc, char* argv[]); // importazione movimenti contabili
 | 
			
		||||
int lv4200(int argc, char* argv[]); // importazione saldaconto
 | 
			
		||||
int lv4300(int argc, char* argv[]); // importazione cespiti
 | 
			
		||||
int lv4400(int argc, char* argv[]); // riscrittura movimenti
 | 
			
		||||
int lv4500(int argc, char* argv[]); // importazione fatture
 | 
			
		||||
int lv4600(int argc, char* argv[]); // riclassificazione conti COGECO
 | 
			
		||||
int lv4700(int argc, char* argv[]); // riclassificazione tabelle COGECO
 | 
			
		||||
@ -6,7 +6,7 @@
 | 
			
		||||
#include <utility.h>
 | 
			
		||||
 | 
			
		||||
#include <mov.h>
 | 
			
		||||
#include <rmov.h>
 | 
			
		||||
#include <scadenze.h>
 | 
			
		||||
#include <rmoviva.h>
 | 
			
		||||
 | 
			
		||||
#include "../ce/ammce.h"
 | 
			
		||||
@ -60,6 +60,7 @@ TLaundry_recordset::TLaundry_recordset(const int rec_lenght)
 | 
			
		||||
                                      ////    TIMPORTA_FAT_REC    ////
 | 
			
		||||
                                      ////////////////////////////////
 | 
			
		||||
 | 
			
		||||
//Classe TImporta_fat_rec
 | 
			
		||||
class TImporta_fat_rec : public TLaundry_recordset
 | 
			
		||||
{
 | 
			
		||||
protected:
 | 
			
		||||
@ -143,10 +144,12 @@ TImporta_fat_rec::TImporta_fat_rec(const TFilename& filename)
 | 
			
		||||
  TText_recordset::load_file(filename);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TAutomask
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
                                      ////////////////////////////////
 | 
			
		||||
                                      ////    TIMPORTA_FAT_MSK    ////
 | 
			
		||||
                                      ////////////////////////////////
 | 
			
		||||
 | 
			
		||||
//Classe TImporta_fat_msk
 | 
			
		||||
class TImporta_fat_msk : public TAutomask
 | 
			
		||||
{
 | 
			
		||||
protected:
 | 
			
		||||
@ -190,10 +193,11 @@ bool TImporta_fat_msk::on_field_event(TOperable_field& f, TField_event e, long j
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
                                      ////////////////////////////////
 | 
			
		||||
                                      ////    TIMPORTA_FAT_APP    ////
 | 
			
		||||
                                      ////////////////////////////////
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////
 | 
			
		||||
// TSkeleton_application
 | 
			
		||||
///////////////////////////////////////
 | 
			
		||||
//Classe TImporta_fat_app
 | 
			
		||||
class TImporta_fat_app : public TSkeleton_application
 | 
			
		||||
{
 | 
			
		||||
	TImporta_fat_msk*	_msk;
 | 
			
		||||
@ -201,12 +205,20 @@ class TImporta_fat_app : public TSkeleton_application
 | 
			
		||||
protected:
 | 
			
		||||
	bool search_gr_sp_ca(const int gruppo, const char* specie, const int categoria);
 | 
			
		||||
 | 
			
		||||
  const TFilename crea_tmpdir() const;
 | 
			
		||||
  const TFilename crea_tmpdir()                  const;
 | 
			
		||||
  const TFilename crea_nomefile(const long ndoc) const;
 | 
			
		||||
  
 | 
			
		||||
  const int       segno_testata(const char sezione, const TCausale& cau) const;
 | 
			
		||||
  const int       segno_riga(const char sezione, const TCausale& cau) const;
 | 
			
		||||
  const TString16 genera_real(const TVariant importo, const int segno) const;
 | 
			
		||||
  const int       segno_testata(const char sezione, const TCausale& cau)     const;
 | 
			
		||||
  const int       segno_riga(const char sezione, const TCausale& cau)        const;
 | 
			
		||||
  const TString16 genera_real(const TVariant importo, const int segno = 1)   const;
 | 
			
		||||
 | 
			
		||||
  const TString80 riclassifica_pconti();
 | 
			
		||||
 | 
			
		||||
  const TString80 riclassifica_causali(const int cau_cog)     const;
 | 
			
		||||
  const TString80 riclassifica_condpag(const int condpag_cog) const;
 | 
			
		||||
  const TString80 riclassifica_codiva(const int codiva_cog)   const;
 | 
			
		||||
  const TString80 riclassifica_regiva(const int regiva_cog)   const;
 | 
			
		||||
  const TString80 riclassifica_valute(const int val_cog)      const;
 | 
			
		||||
  
 | 
			
		||||
  void genera_testata(TImporta_fat_rec& recset, TConfig* conf, TFilename& tmpdir);
 | 
			
		||||
  //void genera_contropartite(TImporta_fat_rec& recset, TConfig* configfile);
 | 
			
		||||
@ -228,6 +240,7 @@ bool TImporta_fat_app::search_gr_sp_ca(const int gruppo, const char* specie, con
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//CREA_TMPDIR: crea la directory temporanea e restituisce il suo nome
 | 
			
		||||
const TFilename TImporta_fat_app::crea_tmpdir() const
 | 
			
		||||
{
 | 
			
		||||
  TFilename tmpdir;
 | 
			
		||||
@ -238,6 +251,7 @@ const TFilename TImporta_fat_app::crea_tmpdir() const
 | 
			
		||||
  return tmpdir;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//CREA_NOMEFILE: genera il nome del file dal numero documento
 | 
			
		||||
const TFilename TImporta_fat_app::crea_nomefile(const long ndoc) const
 | 
			
		||||
{
 | 
			
		||||
  TString strname;
 | 
			
		||||
@ -247,16 +261,21 @@ const TFilename TImporta_fat_app::crea_nomefile(const long ndoc) const
 | 
			
		||||
  return strname;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//SEGNO_TESTATA: restituisce + o - uno a seconda che la sezione della riga in esame
 | 
			
		||||
//e quella della prima riga della causale siano uguali o opposte
 | 
			
		||||
const int TImporta_fat_app::segno_testata(const char sezione, const TCausale& cau) const
 | 
			
		||||
{
 | 
			
		||||
  return cau.sezione_clifo() == sezione ? 1 : -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//SEGNO_TESTATA: restituisce + o - uno a seconda che la sezione della riga in esame
 | 
			
		||||
//e quella della prima riga della causale siano opposte o uguali
 | 
			
		||||
const int TImporta_fat_app::segno_riga(const char sezione, const TCausale& cau) const
 | 
			
		||||
{
 | 
			
		||||
  return cau.sezione_clifo() == sezione ? -1 : 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//GENERA_REAL: crea il numero reale, aggiungendo i decimali e tenendo conto del segno corretto
 | 
			
		||||
const TString16 TImporta_fat_app::genera_real(const TVariant importo, const int segno) const
 | 
			
		||||
{
 | 
			
		||||
  real imp = importo.as_real();
 | 
			
		||||
@ -273,7 +292,8 @@ void TImporta_fat_app::genera_testata(TImporta_fat_rec& recset, TConfig* conf, T
 | 
			
		||||
  const TCausale cau(recset.get("CODCAU").as_string());
 | 
			
		||||
  const int      segno = segno_testata(recset.get("SEZIONE").as_string()[0], cau);
 | 
			
		||||
 | 
			
		||||
  TFilename nomefile = crea_nomefile(ndoc);
 | 
			
		||||
  TFilename nomefile = tmpdir;
 | 
			
		||||
  nomefile << crea_nomefile(ndoc);
 | 
			
		||||
 | 
			
		||||
  conf = new TConfig(nomefile);
 | 
			
		||||
	conf->set_paragraph("Transaction"); //setto il paragrafo [Transaction] del file ini
 | 
			
		||||
@ -311,13 +331,29 @@ void TImporta_fat_app::genera_righe_iva(TImporta_fat_rec& recset, TConfig* conf,
 | 
			
		||||
  conf->set(RMI_ANNOES,     datadoc.year());
 | 
			
		||||
  conf->set(RMI_CODIVA,     recset.get("CODIVA").as_int());               //da codificare se mappato
 | 
			
		||||
  conf->set(RMI_IMPONIBILE, genera_real(recset.get("IMPONIBILE"), segno));
 | 
			
		||||
  conf->set(RMI_IMPOSTA,    genera_real(recset.get("IMPOSTA"), 1));
 | 
			
		||||
  conf->set(RMI_IMPOSTA,    genera_real(recset.get("IMPOSTA")));
 | 
			
		||||
 | 
			
		||||
  /*Mancano Codice mastro e codice conto*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TImporta_fat_app::genera_rate(TImporta_fat_rec& recset, TConfig* conf, int nriga)
 | 
			
		||||
{
 | 
			
		||||
  TString paragraph;
 | 
			
		||||
  paragraph.format("%d,%d", LF_RMOVIVA, nriga++);
 | 
			
		||||
	conf->set_paragraph(paragraph);
 | 
			
		||||
 | 
			
		||||
  const TDate    datadoc = recset.get("DATADOC").as_date();
 | 
			
		||||
 | 
			
		||||
  conf->set(SCAD_ANNO, datadoc.year());
 | 
			
		||||
  conf->set(SCAD_NUMPART, recset.get("NPART").as_int());
 | 
			
		||||
  conf->set(SCAD_NRIGA, nriga);
 | 
			
		||||
  conf->set(SCAD_NRATA, recset.get("NRATA").as_int());
 | 
			
		||||
  //??? CODPAG ???//
 | 
			
		||||
  conf->set(SCAD_TIPOPAG, recset.get("TIPOPAG").as_int());
 | 
			
		||||
  conf->set(SCAD_IMPORTO,    genera_real(recset.get("IMPORTO")));
 | 
			
		||||
  conf->set(SCAD_IMPORTOVAL, genera_real(recset.get("IMPORTO")));  //NON SO IN QUALE DEI DUE VADA
 | 
			
		||||
  conf->set(SCAD_DATASCAD, recset.get("DATASCAD").as_date());
 | 
			
		||||
  //??? ABI CAB GRUPPO CONTO SOTTOCONTO ???//
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TImporta_fat_app::elabora_file(const TFilename& tmpdir)
 | 
			
		||||
@ -337,14 +373,14 @@ void TImporta_fat_app::transfer(const TFilename& file)
 | 
			
		||||
{
 | 
			
		||||
  TImporta_fat_rec recset(file);
 | 
			
		||||
 | 
			
		||||
  TProgind pi(recset.items(), "Importazione in corso...", true, true);
 | 
			
		||||
 | 
			
		||||
  TConfig* configfile = NULL;
 | 
			
		||||
 | 
			
		||||
  TFilename tmpdir = crea_tmpdir();
 | 
			
		||||
 | 
			
		||||
  int nrigai, nrigar;
 | 
			
		||||
  
 | 
			
		||||
  TProgind pi(recset.items(), "Importazione in corso...", true, true);
 | 
			
		||||
 | 
			
		||||
  for(bool ok = recset.move_first(); ok; ok = recset.move_next())
 | 
			
		||||
  {
 | 
			
		||||
    if (!pi.addstatus(1)) 
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user