Patch level : OMASA
Files correlati : cgp4.exe cgp4100a.msk omasa.ini Ricompilazione Demo : [ ] Commento : Ulteriori modifiche a OSAMA B.L. git-svn-id: svn://10.65.10.50/trunk@12128 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									fe2e1eb01e
								
							
						
					
					
						commit
						3ffd1a4a2e
					
				
							
								
								
									
										187
									
								
								cg/cgp4100.cpp
									
									
									
									
									
								
							
							
						
						
									
										187
									
								
								cg/cgp4100.cpp
									
									
									
									
									
								
							@ -23,6 +23,8 @@
 | 
			
		||||
 | 
			
		||||
#define MAX_CG_ROWS 98
 | 
			
		||||
 | 
			
		||||
// tabella per la conversione dei numeri negativi (schede perforate????)
 | 
			
		||||
static unsigned char _tabella[10] = {0x7d,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52};
 | 
			
		||||
 | 
			
		||||
// TAutomask
 | 
			
		||||
 | 
			
		||||
@ -31,9 +33,7 @@ class TOmasa_mask : public TAutomask
 | 
			
		||||
protected:
 | 
			
		||||
  bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
  TOmasa_mask();
 | 
			
		||||
  
 | 
			
		||||
  virtual ~TOmasa_mask(){};
 | 
			
		||||
};
 | 
			
		||||
  
 | 
			
		||||
@ -55,7 +55,10 @@ protected:
 | 
			
		||||
  virtual void validate(TCursor& cur,TRecord_text &rec, TToken_string &val, TString& str);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
	void negativo(TString& importo);
 | 
			
		||||
  int  strip_zero(TString& importo);
 | 
			
		||||
  bool my_isdigit(unsigned char ch);
 | 
			
		||||
  int  look(unsigned char carattere);
 | 
			
		||||
  TOmasa_file(const TString& file_name);
 | 
			
		||||
  virtual ~TOmasa_file() { }
 | 
			
		||||
};
 | 
			
		||||
@ -68,15 +71,68 @@ TOmasa_file::TOmasa_file(const TString& file_name)
 | 
			
		||||
void TOmasa_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TString& str)
 | 
			
		||||
{
 | 
			
		||||
  const TString code(s.get(0));
 | 
			
		||||
  TString valore;
 | 
			
		||||
  TString valore = str;
 | 
			
		||||
  if (code == "_UPPERCASE")
 | 
			
		||||
  {
 | 
			
		||||
    valore.upper(); 
 | 
			
		||||
  }
 | 
			
		||||
	else if (code == "_IMPORTO")
 | 
			
		||||
	{
 | 
			
		||||
		negativo(valore);
 | 
			
		||||
	}
 | 
			
		||||
  else NFCHECK("Macro non definita: %s", (const char *)code);
 | 
			
		||||
  str = valore;
 | 
			
		||||
} 
 | 
			
		||||
 | 
			
		||||
int TOmasa_file::strip_zero(TString& importo)
 | 
			
		||||
{
 | 
			
		||||
  TString16 app;
 | 
			
		||||
  
 | 
			
		||||
  int size = importo.len();
 | 
			
		||||
  
 | 
			
		||||
  for (int i = 0; i < size; i++)
 | 
			
		||||
    if (importo[i] != '0') break;
 | 
			
		||||
    
 | 
			
		||||
  if (i > 0)
 | 
			
		||||
  {
 | 
			
		||||
    app = importo.mid(importo[i] == '.' ? i - 1 : i);
 | 
			
		||||
    importo = app;
 | 
			
		||||
  }               
 | 
			
		||||
  
 | 
			
		||||
  return (i ? i - 1 : i);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TOmasa_file::my_isdigit(unsigned char ch)
 | 
			
		||||
{
 | 
			
		||||
  return (ch >= '0' && ch <= '9');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int TOmasa_file::look(unsigned char carattere)
 | 
			
		||||
{
 | 
			
		||||
  for (int i = 0; i < 10; i++)
 | 
			
		||||
    if (_tabella[i] == carattere)
 | 
			
		||||
      return i;
 | 
			
		||||
      
 | 
			
		||||
  return -1;
 | 
			
		||||
}                                                             
 | 
			
		||||
 | 
			
		||||
void TOmasa_file::negativo(TString& importo)
 | 
			
		||||
{                           
 | 
			
		||||
  strip_zero(importo);
 | 
			
		||||
  int size = importo.len(); 
 | 
			
		||||
  if (!size) return;
 | 
			
		||||
  unsigned char last = importo[size - 1]; 
 | 
			
		||||
  if (!my_isdigit(last))
 | 
			
		||||
  {     
 | 
			
		||||
    int new_last = look(last);
 | 
			
		||||
    TString16 dep; dep << new_last;
 | 
			
		||||
    if (new_last >= 0) 
 | 
			
		||||
    {
 | 
			
		||||
      importo[size - 1] = dep[0];
 | 
			
		||||
      importo.insert("-");  
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TSkeleton_application
 | 
			
		||||
 | 
			
		||||
@ -171,7 +227,7 @@ bool TOmasa::transfer()
 | 
			
		||||
  while (_trasfile->read(curr) == NOERR) 
 | 
			
		||||
  {
 | 
			
		||||
    pi.setstatus(_trasfile->read_file()->tellg());
 | 
			
		||||
		TString impstr = curr.get(F_IMPORTO);
 | 
			
		||||
		TString impstr = curr.get(F_VALOREVOCE);
 | 
			
		||||
		impstr.insert(".",11);
 | 
			
		||||
		const real importo(impstr);
 | 
			
		||||
		TString16 contodare = curr.get(F_CONTODARE);
 | 
			
		||||
@ -190,23 +246,23 @@ bool TOmasa::transfer()
 | 
			
		||||
			movpn->set("CODCMS",codcms);
 | 
			
		||||
			if (!contodare.blank())
 | 
			
		||||
			{
 | 
			
		||||
				movpn->set_paragraph("DARE");
 | 
			
		||||
				movpn->set_paragraph("IMPORTI");
 | 
			
		||||
				contodare.trim();
 | 
			
		||||
				impstr = movpn->get(contodare, "DARE");
 | 
			
		||||
				impstr = movpn->get(contodare, "IMPORTI");
 | 
			
		||||
				// verificare se l'ultimo carattere e'una lettera = importo negativo
 | 
			
		||||
				real importomem(impstr);
 | 
			
		||||
				importomem+=importo;
 | 
			
		||||
				movpn->set(contodare, importomem.string());
 | 
			
		||||
			}
 | 
			
		||||
			if (!contoavere.blank())
 | 
			
		||||
			{
 | 
			
		||||
				movpn->set_paragraph("AVERE");
 | 
			
		||||
				movpn->set_paragraph("IMPORTI");
 | 
			
		||||
				contoavere.trim();
 | 
			
		||||
				impstr = movpn->get(contoavere, "AVERE");
 | 
			
		||||
				impstr = movpn->get(contoavere, "IMPORTI");
 | 
			
		||||
				real importomem(impstr);
 | 
			
		||||
				importomem+=importo;
 | 
			
		||||
				importomem-=importo;
 | 
			
		||||
				movpn->set(contoavere, importomem.string());
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			delete movpn;
 | 
			
		||||
			if (pi.iscancelled())
 | 
			
		||||
				return TRUE;
 | 
			
		||||
@ -249,23 +305,23 @@ bool TOmasa::transfer()
 | 
			
		||||
		int numrig = 0;
 | 
			
		||||
		
 | 
			
		||||
		TString_array vl;
 | 
			
		||||
	  file_oo.list_variables(vl,TRUE, "DARE", TRUE);
 | 
			
		||||
		FOR_EACH_ARRAY_ROW(vl,rd,sd)
 | 
			
		||||
	  file_oo.list_variables(vl,TRUE, "IMPORTI", TRUE);
 | 
			
		||||
		FOR_EACH_ARRAY_ROW(vl,r,s)
 | 
			
		||||
		{
 | 
			
		||||
			TString16 contodare = (*sd).get();
 | 
			
		||||
			TString16 importodare = (*sd).get();
 | 
			
		||||
			TToken_string conto = _configfile->get(contodare, "CONTI");
 | 
			
		||||
			TString16 contoomasa = (*s).get();
 | 
			
		||||
			TString16 importos = (*s).get();
 | 
			
		||||
			TToken_string conto = _configfile->get(contoomasa, "CONTI");
 | 
			
		||||
			if (conto.empty())
 | 
			
		||||
			{
 | 
			
		||||
				TMask mskconto("cgp4100b");		
 | 
			
		||||
				mskconto.set(F_CONTOOMASA, contodare);
 | 
			
		||||
				mskconto.set(F_CONTOOMASA, contoomasa);
 | 
			
		||||
				if (mskconto.run() == K_ENTER)
 | 
			
		||||
				{
 | 
			
		||||
					const int gr = mskconto.get_int(F_GRUPPO);
 | 
			
		||||
					const int co = mskconto.get_int(F_CONTO);
 | 
			
		||||
					const long so = mskconto.get_long(F_SOTTOCONTO);
 | 
			
		||||
					conto.format("%d|%d|%ld", gr, co, so);
 | 
			
		||||
					_configfile->set(contodare, conto, "CONTI");
 | 
			
		||||
					_configfile->set(contoomasa, conto, "CONTI");
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
					return TRUE;
 | 
			
		||||
@ -275,53 +331,23 @@ bool TOmasa::transfer()
 | 
			
		||||
			movpn->set("ANNOES", annoes);
 | 
			
		||||
			movpn->set("DATAREG", datareg);
 | 
			
		||||
			movpn->set("NUMRIG", numrig);
 | 
			
		||||
			movpn->set("IMPORTO", importodare);
 | 
			
		||||
			movpn->set("SEZIONE", "D");
 | 
			
		||||
			const int indbil = cache().get(LF_PCON, conto, PCN_INDBIL)[0]; 
 | 
			
		||||
			if ((indbil != 1) && (indbil != 2))
 | 
			
		||||
				movpn->set("CODCMS", codcms);
 | 
			
		||||
			movpn->set("GRUPPO", conto.get(0));
 | 
			
		||||
			movpn->set("CONTO", conto.get(1));
 | 
			
		||||
			movpn->set("SOTTOCONTO", conto.get(2));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		file_oo.list_variables(vl,TRUE, "AVERE", TRUE);
 | 
			
		||||
		FOR_EACH_ARRAY_ROW(vl,ra,sa)
 | 
			
		||||
		{
 | 
			
		||||
			TString16 contoavere = (*sa).get();
 | 
			
		||||
			TString16 importoavere = (*sa).get();
 | 
			
		||||
			TToken_string conto = _configfile->get(contoavere, "CONTI");
 | 
			
		||||
			if (conto.empty())
 | 
			
		||||
			{
 | 
			
		||||
				TMask mskconto("cgp4100b");		
 | 
			
		||||
				mskconto.set(F_CONTOOMASA, contoavere);
 | 
			
		||||
				if (mskconto.run() == K_ENTER)
 | 
			
		||||
				{
 | 
			
		||||
					const int gr = mskconto.get_int(F_GRUPPO);
 | 
			
		||||
					const int co = mskconto.get_int(F_CONTO);
 | 
			
		||||
					const long so = mskconto.get_long(F_SOTTOCONTO);
 | 
			
		||||
					conto.format("%d|%d|%ld", gr, co, so);
 | 
			
		||||
					_configfile->set(contoavere, conto, "CONTI");
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
					return TRUE;
 | 
			
		||||
			}
 | 
			
		||||
			numrig++;
 | 
			
		||||
			movpn->set_paragraph(format("%d,%d",LF_RMOV, numrig));
 | 
			
		||||
			movpn->set("ANNOES", annoes);
 | 
			
		||||
			movpn->set("DATAREG", datareg);
 | 
			
		||||
			movpn->set("NUMRIG", numrig);
 | 
			
		||||
			movpn->set("IMPORTO", importoavere);
 | 
			
		||||
			movpn->set("SEZIONE", "A");
 | 
			
		||||
			const int indbil = cache().get(LF_PCON, conto, PCN_INDBIL)[0]; 
 | 
			
		||||
			if ((indbil != 1) && (indbil != 2))
 | 
			
		||||
			real importo(importos);
 | 
			
		||||
			if (importo > 0)
 | 
			
		||||
				movpn->set("SEZIONE", "D");
 | 
			
		||||
			else
 | 
			
		||||
				movpn->set("SEZIONE", "A");
 | 
			
		||||
			importos.strip("-");
 | 
			
		||||
			movpn->set("IMPORTO", importos);
 | 
			
		||||
			const char indbil = cache().get(LF_PCON, conto, PCN_INDBIL)[0]; 
 | 
			
		||||
			if ((indbil != '1') && (indbil != '2'))
 | 
			
		||||
				movpn->set("CODCMS", codcms);
 | 
			
		||||
			movpn->set("GRUPPO", conto.get(0));
 | 
			
		||||
			movpn->set("CONTO", conto.get(1));
 | 
			
		||||
			movpn->set("SOTTOCONTO", conto.get(2));
 | 
			
		||||
		}
 | 
			
		||||
		delete movpn;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	tempdir.tempdir();
 | 
			
		||||
	TString80 applicat = "cg2.exe -0 -i";
 | 
			
		||||
	applicat << tempdir;
 | 
			
		||||
@ -343,46 +369,3 @@ int cgp4100 (int argc, char* argv[])
 | 
			
		||||
  main_app.run(argc, argv, TR("Importazione stipendi"));
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
				numrig++;
 | 
			
		||||
				movpn->set_paragraph(format("%d,%d",LF_RMOV, numrig));
 | 
			
		||||
				movpn->set("ANNOES", annoes);
 | 
			
		||||
				movpn->set("DATAREG", datareg);
 | 
			
		||||
				movpn->set("NUMRIG", numrig);
 | 
			
		||||
				movpn->set("IMPORTO", importo.string());
 | 
			
		||||
				movpn->set("SEZIONE", "D");
 | 
			
		||||
				movpn->set("CODCMS", codcms);
 | 
			
		||||
				movpn->set("GRUPPO", conto.get(0));
 | 
			
		||||
				movpn->set("CONTO", conto.get(1));
 | 
			
		||||
				movpn->set("SOTTOCONTO", conto.get(2));
 | 
			
		||||
			}
 | 
			
		||||
				TToken_string conto = _configfile->get(contoavere, "CONTI");
 | 
			
		||||
				if (conto.empty())
 | 
			
		||||
				{
 | 
			
		||||
					TMask mskconto("cgp4100b");		
 | 
			
		||||
					mskconto.set(F_CONTOOMASA, contoavere);
 | 
			
		||||
					if (mskconto.run() == K_ENTER)
 | 
			
		||||
					{
 | 
			
		||||
						const int gr = mskconto.get_int(F_GRUPPO);
 | 
			
		||||
						const int co = mskconto.get_int(F_CONTO);
 | 
			
		||||
						const long so = mskconto.get_long(F_SOTTOCONTO);
 | 
			
		||||
						conto.format("%d|%d|%ld", gr, co, so);
 | 
			
		||||
					  _configfile->set(contoavere, conto, "CONTI");		
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
						return TRUE;
 | 
			
		||||
				}
 | 
			
		||||
				numrig++;
 | 
			
		||||
				movpn->set_paragraph(format("%d,%d",LF_RMOV, numrig));
 | 
			
		||||
				movpn->set("ANNOES", annoes);
 | 
			
		||||
				movpn->set("DATAREG", datareg);
 | 
			
		||||
				movpn->set("NUMRIG", numrig);
 | 
			
		||||
				movpn->set("IMPORTO", importo.string());
 | 
			
		||||
				movpn->set("SEZIONE", "A");
 | 
			
		||||
				movpn->set("CODCMS", F_CENTROCOSTO);
 | 
			
		||||
				movpn->set("GRUPPO", conto.get(0));
 | 
			
		||||
				movpn->set("CONTO", conto.get(1));
 | 
			
		||||
				movpn->set("SOTTOCONTO", conto.get(2));
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
@ -4,9 +4,14 @@
 | 
			
		||||
#define F_DATAREG  102
 | 
			
		||||
#define F_CODCAUS  103
 | 
			
		||||
#define F_DESCR    104
 | 
			
		||||
#define F_SHEET_CONTI 105
 | 
			
		||||
 | 
			
		||||
// campi della maschera di conversione conti
 | 
			
		||||
 | 
			
		||||
#define F_S_CONTOOMASA	101
 | 
			
		||||
#define F_S_GRUPPO			102
 | 
			
		||||
#define F_S_CONTO				103
 | 
			
		||||
#define F_S_SOTTOCONTO	104
 | 
			
		||||
#define F_S_DESCRIZIONE	105
 | 
			
		||||
 | 
			
		||||
// campi del tracciato record
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -60,9 +60,5 @@ END
 | 
			
		||||
 | 
			
		||||
ENDPAGE
 | 
			
		||||
 | 
			
		||||
PAGE "Tabella conversione conti" 0 -1 0 19
 | 
			
		||||
 | 
			
		||||
ENDPAGE
 | 
			
		||||
 | 
			
		||||
ENDMASK
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -80,12 +80,14 @@ TYPE(5) = NUMERO
 | 
			
		||||
POSITION(5) = 21
 | 
			
		||||
LENGTH(5) = 13
 | 
			
		||||
DECIMAL(5) = 2
 | 
			
		||||
MESSAGE(5) = _IMPORTO
 | 
			
		||||
 | 
			
		||||
NAME(6) = IMPORTO UNITARIO
 | 
			
		||||
TYPE(6) = IMPORTO
 | 
			
		||||
POSITION(6) = 34
 | 
			
		||||
LENGTH(6) = 13
 | 
			
		||||
DECIMAL(6) = 2
 | 
			
		||||
MESSAGE(6) = _IMPORTO
 | 
			
		||||
 | 
			
		||||
NAME(7) = CONTO DARE
 | 
			
		||||
TYPE(7) = STRINGA
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user