Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : real.* Aggiunto real::print_on e segnalato /= ZERO recarray.* Corretta gestione cambio ditta git-svn-id: svn://10.65.10.50/trunk@6853 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									1a08111fb5
								
							
						
					
					
						commit
						29cfcac9e8
					
				| @ -83,6 +83,7 @@ real& real::operator *= (long double b) | |||||||
| 
 | 
 | ||||||
| real& real::operator /= (long double b) | real& real::operator /= (long double b) | ||||||
| { | { | ||||||
|  |   CHECK(b != 0.0, "Disivision by zero"); | ||||||
|   _dec /= b; |   _dec /= b; | ||||||
|   return *this; |   return *this; | ||||||
| } | } | ||||||
| @ -1513,6 +1514,11 @@ char *real ::stringa (int len, int dec, char pad) const | |||||||
|   return __string; |   return __string; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void real::print_on(ostream& out) const | ||||||
|  | { | ||||||
|  |   out << string(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| ///////////////////////////////////////////////////////////
 | ///////////////////////////////////////////////////////////
 | ||||||
| // Distrib
 | // Distrib
 | ||||||
| // Oggetto per dividere un real in varie sue percentuali
 | // Oggetto per dividere un real in varie sue percentuali
 | ||||||
|  | |||||||
| @ -24,6 +24,11 @@ class real : public TObject | |||||||
|   // @cmember:(INTERNAL) Numero reale
 |   // @cmember:(INTERNAL) Numero reale
 | ||||||
|   long double _dec; |   long double _dec; | ||||||
| 
 | 
 | ||||||
|  |   // @access Protected Member
 | ||||||
|  | protected:                              | ||||||
|  |   // @cmember Permette di stampare l'oggetto
 | ||||||
|  |   virtual void print_on(ostream& out) const; | ||||||
|  | 
 | ||||||
|   // @access Protected Member
 |   // @access Protected Member
 | ||||||
| protected:                              | protected:                              | ||||||
|   // @cmember Duplica il numero reale (vedi classe <c TObject>)
 |   // @cmember Duplica il numero reale (vedi classe <c TObject>)
 | ||||||
| @ -152,6 +157,11 @@ class real : public TObject | |||||||
|   // @cmember:(INTERNAL) Numero reale
 |   // @cmember:(INTERNAL) Numero reale
 | ||||||
|   DEC _dec; |   DEC _dec; | ||||||
| 
 | 
 | ||||||
|  |   // @access Protected Member
 | ||||||
|  | protected:                              | ||||||
|  |   // @cmember Permette di stampare l'oggetto
 | ||||||
|  |   virtual void print_on(ostream& out) const; | ||||||
|  | 
 | ||||||
|   // @access Protected Member
 |   // @access Protected Member
 | ||||||
| protected: | protected: | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -32,7 +32,8 @@ void TRecord_array::set_key(TRectype* r) | |||||||
|   CHECK(r != NULL, "TRecord_array can't have a null key"); |   CHECK(r != NULL, "TRecord_array can't have a null key"); | ||||||
|   CHECK(r->num() == _file, "Bad key record"); |   CHECK(r->num() == _file, "Bad key record"); | ||||||
| 
 | 
 | ||||||
|   _data.add(r, 0);                              // Setta il nuovo campo chiave
 |   if (_data.objptr(0) != r) | ||||||
|  |     _data.add(r, 0);                      // Setta il nuovo campo chiave
 | ||||||
|   if (rows() > 0) |   if (rows() > 0) | ||||||
|   { |   { | ||||||
|     const RecDes* recd = r->rec_des();    // Descrizione del record della testata
 |     const RecDes* recd = r->rec_des();    // Descrizione del record della testata
 | ||||||
| @ -172,7 +173,7 @@ void TRecord_array::pack() | |||||||
| {                        | {                        | ||||||
|   _data.pack(); |   _data.pack(); | ||||||
|    |    | ||||||
|   for (int i = _data.size()-1; i > 0; i--) |   for (int i = _data.last(); i > 0; i--) | ||||||
|   { |   { | ||||||
|     TRectype* r = (TRectype*)_data.objptr(i); |     TRectype* r = (TRectype*)_data.objptr(i); | ||||||
|     if (r != NULL) |     if (r != NULL) | ||||||
| @ -402,20 +403,20 @@ int TRecord_array::remove() const | |||||||
| TFile_cache::TFile_cache(TLocalisamfile *f , int key) | TFile_cache::TFile_cache(TLocalisamfile *f , int key) | ||||||
|              : _file(NULL), _key(key) |              : _file(NULL), _key(key) | ||||||
| {     | {     | ||||||
|   _code << f->num(); |   _filecode << f->num(); | ||||||
|   init_file(f); |   init_file(f); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| TFile_cache::TFile_cache(int num, int key) | TFile_cache::TFile_cache(int num, int key) | ||||||
|              : _file(NULL), _key(key), _last_firm(-883) |              : _file(NULL), _key(key), _last_firm(-883) | ||||||
| {     | {     | ||||||
|   _code << num; |   _filecode << num; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| TFile_cache::TFile_cache(const char* tab, int key) | TFile_cache::TFile_cache(const char* tab, int key) | ||||||
|              : _file(NULL), _key(key), _last_firm(-883) |              : _file(NULL), _key(key), _last_firm(-883) | ||||||
| { | { | ||||||
|   _code = tab; |   _filecode = tab; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| TFile_cache::~TFile_cache() | TFile_cache::~TFile_cache() | ||||||
| @ -431,10 +432,10 @@ void TFile_cache::init_file(TLocalisamfile* f) | |||||||
| 
 | 
 | ||||||
|   if (f == NULL) |   if (f == NULL) | ||||||
|   { |   { | ||||||
|     int logicnum = atoi(_code); |     int logicnum = atoi(_filecode); | ||||||
|     if (logicnum == 0) |     if (logicnum == 0) | ||||||
|     { |     { | ||||||
|       _file = new TTable(_code); |       _file = new TTable(_filecode); | ||||||
|       logicnum = _file->num(); |       logicnum = _file->num(); | ||||||
|     }   |     }   | ||||||
|     else |     else | ||||||
| @ -448,7 +449,7 @@ void TFile_cache::init_file(TLocalisamfile* f) | |||||||
|   if (_file != NULL) |   if (_file != NULL) | ||||||
|   { |   { | ||||||
|     TDir dir;  |     TDir dir;  | ||||||
|     dir.get(_file->num()); |     dir.get(_file->num(), _nolock, _nordir, _sysdirop); | ||||||
|     // Se e' un file comune metti a -1, altrimenti alla ditta corrente
 |     // Se e' un file comune metti a -1, altrimenti alla ditta corrente
 | ||||||
|     _last_firm = dir.is_com() ? -1 : prefix().get_codditta(); |     _last_firm = dir.is_com() ? -1 : prefix().get_codditta(); | ||||||
|   } |   } | ||||||
| @ -523,12 +524,11 @@ int TFile_cache::io_result() | |||||||
|   return _error; |   return _error; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int TFile_cache::fill() | long TFile_cache::fill() | ||||||
| {                | {                | ||||||
|   test_firm(); |   test_firm(); | ||||||
| 
 | 
 | ||||||
|   TLocalisamfile& f = file(); |   TLocalisamfile& f = file(); | ||||||
| 
 |  | ||||||
|   TRectype& curr = f.curr(); |   TRectype& curr = f.curr(); | ||||||
|   const RecDes* recd = curr.rec_des();    // Descrizione del record della testata
 |   const RecDes* recd = curr.rec_des();    // Descrizione del record della testata
 | ||||||
|   const KeyDes& kd = recd->Ky[_key-1];    // Elenco dei campi della chiave
 |   const KeyDes& kd = recd->Ky[_key-1];    // Elenco dei campi della chiave
 | ||||||
| @ -552,6 +552,11 @@ int TFile_cache::fill() | |||||||
|    |    | ||||||
|   return _cache.items(); |   return _cache.items(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | void TFile_cache::destroy() | ||||||
|  | { | ||||||
|  |   _cache.destroy(); | ||||||
|  | } | ||||||
|    |    | ||||||
| TLocalisamfile& TFile_cache::file() | TLocalisamfile& TFile_cache::file() | ||||||
| { | { | ||||||
|  | |||||||
| @ -144,8 +144,8 @@ public: | |||||||
| 
 | 
 | ||||||
| class TFile_cache : public TObject | class TFile_cache : public TObject | ||||||
| {  | {  | ||||||
| 
 |  | ||||||
|   TToken_string _code; |   TToken_string _code; | ||||||
|  |   TString16 _filecode; | ||||||
|   TLocalisamfile* _file; |   TLocalisamfile* _file; | ||||||
|   int _key; |   int _key; | ||||||
|   long _last_firm; |   long _last_firm; | ||||||
| @ -165,10 +165,13 @@ protected: | |||||||
| public:             | public:             | ||||||
|   int io_result(); |   int io_result(); | ||||||
|   const int key_number() const |   const int key_number() const | ||||||
|     {return _key;} |   { return _key; } | ||||||
|   long items() | 
 | ||||||
|     {return _cache.items();} |   long items() const | ||||||
|   int fill(); |   { return _cache.items(); } | ||||||
|  | 
 | ||||||
|  |   long fill(); | ||||||
|  |   void destroy(); | ||||||
|    |    | ||||||
|   TFile_cache(TLocalisamfile *f,int key = 1); |   TFile_cache(TLocalisamfile *f,int key = 1); | ||||||
|   TFile_cache(int num, int key = 1); |   TFile_cache(int num, int key = 1); | ||||||
|  | |||||||
| @ -767,11 +767,12 @@ int TRelation_application::write(const TMask& m) | |||||||
|   const int max = m.fields(); |   const int max = m.fields(); | ||||||
|   for (int i = 0; i < max; i++) |   for (int i = 0; i < max; i++) | ||||||
|   { |   { | ||||||
|     if (m.fld(i).is_sheet()) { |     if (m.fld(i).is_sheet())  | ||||||
|  |     { | ||||||
|       TSheet_field& f = (TSheet_field& )m.fld(i); |       TSheet_field& f = (TSheet_field& )m.fld(i); | ||||||
|       if (f.record() && !f.external_record()) |       if (f.record() && !f.external_record()) | ||||||
|         err|=f.record()->write(FALSE); |         err|=f.record()->write(FALSE); | ||||||
|      } |     } | ||||||
|   } |   } | ||||||
|   return err; |   return err; | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user