Patch level : 10.0 148
Files correlati : lv0.exe Ricompilazione Demo : [ ] Commento : Aggiunti i flag di lavanderia alle causali di magazzino In inserimento data inizio contratto deve riportare data del giorno In inserimento data scadenza contratto non deve essere obbligatoria git-svn-id: svn://10.65.10.50/trunk@17495 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									2955c4120a
								
							
						
					
					
						commit
						5fd0b50cda
					
				
							
								
								
									
										112
									
								
								lv/lv0400.cpp
									
									
									
									
									
								
							
							
						
						
									
										112
									
								
								lv/lv0400.cpp
									
									
									
									
									
								
							| @ -6,6 +6,8 @@ | ||||
| #include <recset.h> | ||||
| 
 | ||||
| #include "lv0400.h" | ||||
| #include "lvlib.h" | ||||
| #include "../cg/cglib01.h" | ||||
| #include "../mg/anamag.h" | ||||
| #include "../mg/mglib.h" | ||||
| 
 | ||||
| @ -21,92 +23,40 @@ public: | ||||
| 
 | ||||
| bool TContratti_msk::on_art_select()  | ||||
| { | ||||
|   TSheet_field& ss=sfield(F_RIGHE); | ||||
|   TSheet_field& ss = sfield(F_RIGHE); | ||||
|   TMask& rowmask = ss.sheet_mask(); | ||||
|   TToken_string & row  = ss.row(ss.selected()); | ||||
|   const TString80 codart(row.get(ss.cid2index(S_CODART))); | ||||
|   const long codcf = get_long(F_CODCF); | ||||
|   const int indsped = get_int(F_INDSPED); | ||||
|   TArticolo_lavanderie & artrec = cached_article_laundry(codart, 'C', codcf, indsped); | ||||
| 	TDate datasc = get_date(F_DATASC); | ||||
| 
 | ||||
| 	if (!datasc.ok()) | ||||
| 		datasc = TDate(TODAY); | ||||
| 	const int annoes = esercizi().date2esc(datasc); | ||||
|   int index = artrec.find_clifomag(annoes); | ||||
| 
 | ||||
| 	if (index > 0) | ||||
| 	{ | ||||
| 	  const TString4 umcont(row.get(ss.cid2index(S_UM))); | ||||
|   TArticolo artrec(codart); | ||||
|   TMask& rowmask=ss.sheet_mask(); | ||||
|     | ||||
|   const int indsped=get_int(F_INDSPED); | ||||
|   const TDate oggi(TODAY); | ||||
| 
 | ||||
|   TString query, filter; | ||||
| 
 | ||||
|   filter << "ANNOES=#ANNOES CODART=#CODART TIPOCF=C CODCF=#CLIENTE"; | ||||
|   filter << " INDSPED=" << indsped; | ||||
| 
 | ||||
|   query << "USE CLIFOGIAC KEY 3\n" | ||||
|         << "FROM " << filter << '\n' | ||||
|         << "TO " << filter << '\n'; | ||||
| 
 | ||||
|   TISAM_recordset recgiac (query); | ||||
| 
 | ||||
|   recgiac.set_var("#CLIENTE",get_long(F_CODCF)); | ||||
|   recgiac.set_var("#ANNOES",TVariant((long)oggi.year())); | ||||
|   recgiac.set_var("#CODART",TVariant(codart)); | ||||
| 
 | ||||
|   real dotod,consyear,consmonth; | ||||
|   if (recgiac.move_first()) | ||||
|   { | ||||
|     dotod=artrec.convert_to_um(recgiac.get("GIAC").as_real(),umcont); | ||||
|     consyear=artrec.convert_to_um(recgiac.get("ACQ").as_real()+recgiac.get("ENT").as_real(),umcont); | ||||
| 		const real dotin = artrec.convert_to_um(artrec.clifomag(annoes)[index].get_real("DOTIN"),umcont); | ||||
| 		rowmask.set(S_DOTIN, dotin); | ||||
| 		row.add(dotin.stringa(), ss.cid2index(S_DOTIN)); | ||||
| 		const real dotod = artrec.convert_to_um(artrec.clifomag(annoes)[index].get_real("DOTOD"),umcont); | ||||
| 		rowmask.set(S_DOTOD, dotod); | ||||
| 		row.add(dotod.stringa(), ss.cid2index(S_DOTOD)); | ||||
| 		const real dottmp = artrec.convert_to_um(artrec.clifomag(annoes)[index].get_real("DOTTM"),umcont); | ||||
| 		rowmask.set(S_DOTTMP, dottmp); | ||||
| 		row.add(dottmp.stringa(), ss.cid2index(S_DOTTMP)); | ||||
| 		const real consyear = artrec.convert_to_um(artrec.clifomag(annoes)[index].get_real("CONSANNO"),umcont); | ||||
| 		rowmask.set(S_CONSANNO, consyear); | ||||
| 		row.add(consyear.stringa(), ss.cid2index(S_CONSANNO)); | ||||
| 		const real consmonth = artrec.convert_to_um(artrec.clifomag(annoes)[index].get_real("CONSMESE"),umcont); | ||||
| 		rowmask.set(S_CONSMESE, consmonth); | ||||
| 		row.add(consmonth.stringa(), ss.cid2index(S_CONSMESE)); | ||||
| 	} | ||||
| 
 | ||||
|   rowmask.set(S_DOTOD,dotod); | ||||
|   row.add(dotod.stringa(),ss.cid2index(S_DOTOD)); | ||||
| 
 | ||||
|   rowmask.set(S_CONSANNO,consyear); | ||||
|   row.add(consyear.stringa(),ss.cid2index(S_CONSANNO)); | ||||
| 
 | ||||
|   TDate imese(oggi); | ||||
|   imese.set_day(1); | ||||
|    | ||||
|   query="USE MOVMAG KEY 3\n"; | ||||
|   query << "SELECT (TIPOCF='C')&&(STR(CODCF=" << get_long(F_CODCF) << "))&&(STR(CODINDSP=" << indsped << "))\n"; | ||||
|   query << "FROM DATAREG=" << imese << "\n" | ||||
|         << "TO DATAREG=" << oggi << "\n"; | ||||
| 
 | ||||
|   TISAM_recordset recmag(query); | ||||
| 
 | ||||
|   for (bool ok=recmag.move_first(); ok; ok=recmag.move_next()) | ||||
|   { | ||||
|     const TCausale_magazzino tcaus(recmag.get(MOVMAG_CODCAUS).as_string()); | ||||
|      | ||||
|     TString queryrmag="USE RMOVMAG\n"; | ||||
|     queryrmag << "SELECT CODART='" << codart << "'\n"; | ||||
|     queryrmag << "FROM NUMREG=" << recmag.get(MOVMAG_NUMREG) << "\n" | ||||
|               << "TO NUMREG=" << recmag.get(MOVMAG_NUMREG) << "\n"; | ||||
| 
 | ||||
|      | ||||
|     TISAM_recordset recrmag(queryrmag); | ||||
| 
 | ||||
|     for (bool ok=recrmag.move_first(); ok; ok=recrmag.move_next()) | ||||
|     { | ||||
|       int sgn_acq=tcaus.sgn(s_acq); | ||||
|       int sgn_ent=tcaus.sgn(s_ent); | ||||
|       const TString& codcaus=recrmag.get(RMOVMAG_CODCAUS).as_string(); | ||||
|       if (codcaus.full()) | ||||
|       { | ||||
|         const TCausale_magazzino rcaus(codcaus); | ||||
|         sgn_acq=rcaus.sgn(s_acq); | ||||
|         sgn_ent=rcaus.sgn(s_ent); | ||||
|       } | ||||
|       if (sgn_acq!=0 || sgn_ent!=0) | ||||
|       { | ||||
|         const TString4 um=recrmag.get(RMOVMAG_UM).as_string(); | ||||
|         const real qta=artrec.convert_to_um(recrmag.get(RMOVMAG_QUANT).as_real(),umcont,um); | ||||
|         if (sgn_acq!=0) | ||||
|           consmonth+=qta*sgn_acq; | ||||
|         if (sgn_ent!=0) | ||||
|           consmonth+=qta*sgn_ent; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   rowmask.set(S_CONSMESE,consmonth); | ||||
|   row.add(consmonth.stringa(),ss.cid2index(S_CONSMESE)); | ||||
| 
 | ||||
|   const bool varclcons = rowmask.get_int(S_PPCONF)>0; | ||||
| 
 | ||||
|   ss.enable_cell(ss.selected(),ss.cid2index(S_CALCCONS)); | ||||
|  | ||||
| @ -67,6 +67,7 @@ DATE F_DATAIN | ||||
| BEGIN | ||||
|   PROMPT 25 2 "Inizio " | ||||
|   FIELD DATAIN | ||||
|   FLAGS "A" | ||||
|   CHECKTYPE REQUIRED | ||||
| END | ||||
| 
 | ||||
| @ -74,7 +75,6 @@ DATE F_DATASC | ||||
| BEGIN | ||||
|   PROMPT 45 2 "Scadenza " | ||||
|   FIELD DATASC | ||||
|   CHECKTYPE REQUIRED | ||||
| END | ||||
| 
 | ||||
| NUMBER F_INDSPED 3 | ||||
|  | ||||
							
								
								
									
										341
									
								
								lv/lvlib.cpp
									
									
									
									
									
								
							
							
						
						
									
										341
									
								
								lv/lvlib.cpp
									
									
									
									
									
								
							| @ -1,6 +1,9 @@ | ||||
| #include "lvlib.h" | ||||
| #include "..\mg\clifogiac.h" | ||||
| 
 | ||||
| #include <recset.h> | ||||
| #include <utility.h> | ||||
| #include "../cg/cglib01.h" | ||||
| 
 | ||||
| void lv_set_creation_info(TRectype& rec) | ||||
| { | ||||
| @ -11,3 +14,341 @@ void lv_set_update_info(TRectype& rec) | ||||
| { | ||||
|   rec.set_modify_info(); | ||||
| } | ||||
| 
 | ||||
| void TRecmag_lavanderie::update() | ||||
| { | ||||
| 	if (_update_time > 0L) | ||||
| 		return; | ||||
| 
 | ||||
| 	_update_time = 1L; | ||||
| 
 | ||||
|   TString query, filter; | ||||
| 	const int anno = get_int(CLIFOGIAC_ANNOES); | ||||
| 	const TString4 tipocf(get(CLIFOGIAC_TIPOCF)); | ||||
| 	const long codcf = get_long(CLIFOGIAC_CODCF); | ||||
|   const int indsped = get_int(CLIFOGIAC_INDSPED); | ||||
| 	const TString80 codart(get(CLIFOGIAC_CODART)); | ||||
| 	const TString80 livello(get(CLIFOGIAC_LIVELLO)); | ||||
|   const TDate oggi(TODAY); | ||||
|   TDate imese; | ||||
| 	TDate ianno; | ||||
| 	TEsercizi_contabili & esc = esercizi(); | ||||
| 	const TArticolo & artrec = cached_article(codart); | ||||
| 
 | ||||
| 	if (anno >= esc.date2esc(oggi)) | ||||
| 	{ | ||||
| 		imese = oggi; | ||||
| 		imese.set_day(1); | ||||
| 	  ianno.set_month(1); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		imese = esc.esercizio(anno).fine(); | ||||
| 		ianno = imese; | ||||
| 	} | ||||
|    | ||||
|   query="USE MOVMAG KEY 3\n"; | ||||
|   query << "SELECT (TIPOCF='C')&&(STR(CODCF=" << codcf << "))&&(STR(CODINDSP=" << indsped << "))\n"; | ||||
|   query << "TO DATAREG=" << oggi << "\n"; | ||||
| 
 | ||||
|   TISAM_recordset recmag(query); | ||||
| 
 | ||||
|   for (bool ok=recmag.move_first(); ok; ok=recmag.move_next()) | ||||
|   { | ||||
| 		const TDate datareg = recmag.get(MOVMAG_DATAREG).as_date(); | ||||
|     TString queryrmag="USE RMOVMAG\n"; | ||||
| 		queryrmag << " SELECT (CODART=\"" << codart << "\")&&(LIVGIAC=\"" << livello << "\")\n"; | ||||
| 		queryrmag << "FROM NUMREG=" << recmag.get(MOVMAG_NUMREG) << "\n" | ||||
|               << "TO NUMREG=" << recmag.get(MOVMAG_NUMREG) << "\n"; | ||||
|      | ||||
|     TISAM_recordset recrmag(queryrmag); | ||||
| 
 | ||||
|     for (bool ok=recrmag.move_first(); ok; ok=recrmag.move_next()) | ||||
|     { | ||||
|       const TString& codcaus = recrmag.get(RMOVMAG_CODCAUS).as_string(); | ||||
| 			const TCausale_magazzino & tcaus = cached_causale_magazzino(codcaus.full() ? codcaus : recmag.get(MOVMAG_CODCAUS).as_string()); | ||||
|       int sgn_dotin = tcaus.sgn(s_dotin); | ||||
|       int sgn_dotod = tcaus.sgn(s_dotod); | ||||
|       int sgn_dottm = tcaus.sgn(s_dottm); | ||||
|       int sgn_consanno = tcaus.sgn(s_consanno); | ||||
|       int sgn_consmese = tcaus.sgn(s_consmese); | ||||
|       if (sgn_dotin != 0 || sgn_dotod != 0 || sgn_dottm != 0 || sgn_consanno != 0 || sgn_consmese != 0) | ||||
|       { | ||||
|         const TString4 um = recrmag.get(RMOVMAG_UM).as_string(); | ||||
|         const real qta = ((TArticolo &)artrec).convert_to_um(recrmag.get(RMOVMAG_QUANT).as_real(), NULL,um); | ||||
| 
 | ||||
| 				_dotin += qta * sgn_dotin; | ||||
| 				_dotod += qta * sgn_dotod; | ||||
| 				_dottm += qta * sgn_dottm; | ||||
| 				if (datareg >= ianno) | ||||
| 					_consanno += qta * sgn_consanno; | ||||
| 				if (datareg >= imese) | ||||
| 					_consmese += qta * sgn_consmese; | ||||
|       } | ||||
|     } | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| int TRecmag_lavanderie::name2index(const char* fieldname) const | ||||
| { | ||||
| 	if (strcmp(fieldname, "DOTIN") == 0) | ||||
| 		return 0; | ||||
| 	if (strcmp(fieldname, "DOTOD") == 0) | ||||
| 		return 1; | ||||
| 	if (strcmp(fieldname, "DOTTM") == 0) | ||||
| 		return 2; | ||||
| 	if (strcmp(fieldname, "CONSANNO") == 0) | ||||
| 		return 3; | ||||
| 	if (strcmp(fieldname, "CONSMESE") == 0) | ||||
| 		return 4; | ||||
| 	return -1; | ||||
| } | ||||
| 
 | ||||
| TFieldtypes TRecmag_lavanderie::type(const char* fieldname) const | ||||
| 
 | ||||
| { | ||||
|   if (name2index(fieldname) >= 0) | ||||
|     return _realfld;  | ||||
|   return TRectype::type(fieldname); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int TRecmag_lavanderie::length(const char* fieldname) const | ||||
| 
 | ||||
| { | ||||
|   if (name2index(fieldname) >= 0) | ||||
|     return 18; | ||||
|   return TRectype::length(fieldname); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int TRecmag_lavanderie::ndec(const char* fieldname) const | ||||
| { | ||||
|   if (name2index(fieldname) >= 0) | ||||
|     return 3;  | ||||
|   return TRectype::ndec(fieldname); | ||||
| } | ||||
| 
 | ||||
| bool TRecmag_lavanderie::exist(const char* fieldname) const | ||||
| {                    | ||||
|   if (name2index(fieldname) >= 0) | ||||
|     return true; | ||||
|   return TRectype::exist(fieldname); | ||||
| } | ||||
| 
 | ||||
| const TString & TRecmag_lavanderie::get_str(const char* fieldname) const | ||||
| {  | ||||
| 	const int index = name2index(fieldname); | ||||
| 
 | ||||
| 	if (index >= 0) | ||||
| 		((TRecmag_lavanderie *)this)->update(); | ||||
| 	switch (index) | ||||
| 	{ | ||||
| 		case 0: | ||||
| 			return _dotin.as_string(); | ||||
| 			break; | ||||
| 		case 1: | ||||
| 			return _dotod.as_string(); | ||||
| 			break; | ||||
| 		case 2: | ||||
| 			return _dottm.as_string(); | ||||
| 			break; | ||||
| 		case 3: | ||||
| 			return	_consanno.as_string(); | ||||
| 			break; | ||||
| 		case 4: | ||||
| 			return _consmese.as_string(); | ||||
| 			break; | ||||
| 		default: | ||||
| 			break; | ||||
| 	} | ||||
| 	return TVariable_rectype::get_str(fieldname); | ||||
| } | ||||
| 
 | ||||
| TRecmag_lavanderie::TRecmag_lavanderie() | ||||
|                   : TVariable_rectype(LF_CLIFOGIAC) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| TObject* TRecmag_lavanderie::dup() const | ||||
| { | ||||
|   TRecmag_lavanderie* o = new TRecmag_lavanderie(*this); | ||||
|   return o; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| const TString & TArticolo_lavanderie::get_str(const char* fieldname) const | ||||
| {  | ||||
|   if (*fieldname != '#') | ||||
|     return TRectype::get_str(fieldname); | ||||
|   char * fname = (char *) fieldname + 1; | ||||
|   const int logicnum = atoi(fname); | ||||
|   if (logicnum != LF_CLIFOGIAC) | ||||
| 		return TArticolo_giacenza_data::get_str(fieldname); | ||||
| 
 | ||||
|   const char * op1 =  strchr(fname, '_'); | ||||
|   int index = 0; | ||||
|   if (op1) | ||||
|   { | ||||
|     op1=op1+1; | ||||
|     fname = (char *) op1; | ||||
|     if (*op1 == '#') | ||||
|       index = atoi(fname + 1);              | ||||
|   } | ||||
|   const char * op2 = strchr(fname, '_'); | ||||
|   if (op2)  | ||||
|   { | ||||
|     op2=op2+1; | ||||
|     fname = (char *) op2 + 1; | ||||
|   } | ||||
|   const char * op3 = strchr(fname, '_'); | ||||
|   if (op3)  | ||||
|   { | ||||
|     op3=op3+1; | ||||
|     fname = (char *) op3 + 1; | ||||
|   } | ||||
|   const char * op4 = strchr(fname, '_'); | ||||
|   if (op4)  | ||||
|   { | ||||
|     op4=op4+1; | ||||
|     fname = (char *) op2 + 1; | ||||
|   } | ||||
|   const char * op5 = strchr(fname, '_'); | ||||
|   if (op5) | ||||
|     op5=op5+1; | ||||
|   const char * op6 = strstr(fname, "->");  | ||||
|   CHECKS(op6, "Can't find '->' in string ", fieldname); | ||||
|   op6=op6+2; | ||||
|         | ||||
|   if (logicnum == LF_CLIFOGIAC && op2 && op3 && op4) | ||||
| 	{ | ||||
| 		((TArticolo_lavanderie *)this)->set_tipocf(*op2); | ||||
| 		((TArticolo_lavanderie *)this)->set_codcf(atol(op3)); | ||||
| 		((TArticolo_lavanderie *)this)->set_indsped(atol(op4)); | ||||
|     if (index == 0) | ||||
|       index = find_clifomag(op1, op5); | ||||
|     if (index > 0) | ||||
|       return clifomag(op1).row(index).get(op4); | ||||
| 	} | ||||
|   return EMPTY_STRING; | ||||
| } | ||||
| 
 | ||||
| void TArticolo_lavanderie::set_body_key(TRectype & rowrec) | ||||
| { | ||||
|   const int logicnum = rowrec.num(); | ||||
|   const char * cod = (const char *) codice(); | ||||
|    | ||||
|   switch (logicnum) | ||||
|   {  | ||||
|     case LF_CLIFOGIAC: | ||||
|       rowrec.put(CLIFOGIAC_ANNOES, _anno_lav); | ||||
|       rowrec.put(CLIFOGIAC_CODART, cod); | ||||
|       rowrec.put(CLIFOGIAC_TIPOCF, _tipocf); | ||||
|       rowrec.put(CLIFOGIAC_CODCF, _codcf); | ||||
|       rowrec.put(CLIFOGIAC_INDSPED, _indsped); | ||||
|       break; | ||||
|     default: | ||||
|       TArticolo_giacenza_data::set_body_key(rowrec); | ||||
|       break; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void TArticolo_lavanderie::set_anno_lav (int anno) | ||||
| { | ||||
|   if (_anno_lav != anno) | ||||
|     remove_body(LF_CLIFOGIAC); | ||||
|   _anno_lav = anno; | ||||
| } | ||||
| 
 | ||||
| TRectype * TArticolo_lavanderie::new_body_record(int logicnum) | ||||
| { | ||||
| 	if (logicnum == LF_CLIFOGIAC) | ||||
| 		return new TRecmag_lavanderie(); | ||||
| 	return new TRectype(logicnum ? logicnum : TArticolo_giacenza_data::num()); | ||||
| } | ||||
| 
 | ||||
| int TArticolo_lavanderie::find_clifomag(TRecord_array& rclifomag, const char * livello, int from) const | ||||
| 
 | ||||
| { | ||||
|   const int last = rclifomag.last_row(); | ||||
| 
 | ||||
|   if (last > 0 && from < last) | ||||
|   { | ||||
|     const int livello_len = livello ? strlen(livello) : 0;    | ||||
|      | ||||
|     if (livello_len == 0) | ||||
|       return from + 1; | ||||
| 
 | ||||
|     for (int i = rclifomag.succ_row(from); i <= last; i = rclifomag.succ_row(i)) | ||||
|     { | ||||
|       const TRectype & rec = rclifomag.row(i); | ||||
|      | ||||
| 			if (livello_len == 0 || rec.get(CLIFOGIAC_LIVELLO).compare(livello, livello_len) == 0) | ||||
| 				return i; | ||||
|     } | ||||
|   } | ||||
|   return -1; | ||||
| } | ||||
| 
 | ||||
| int TArticolo_lavanderie::find_clifomag(int annoes, const char * livello, int from) const | ||||
| { | ||||
|   TRecord_array & rclifomag = clifomag(annoes); | ||||
|   return find_clifomag(rclifomag, livello, from);   | ||||
| } | ||||
| 
 | ||||
| TRecord_array & TArticolo_lavanderie::clifomag(int annoes) const | ||||
| { | ||||
| 	((TArticolo_lavanderie*)this)->set_anno_lav(annoes > 0 ? annoes : esercizi().last_mag()); | ||||
|   return body(LF_CLIFOGIAC); | ||||
| } | ||||
| 
 | ||||
| TArticolo_lavanderie::TArticolo_lavanderie(const char* codice, const char tipocf, const long codcf, const int indsped) | ||||
| 										 : TArticolo_giacenza_data(codice), _anno_lav(0), | ||||
| 										   _tipocf(tipocf), _codcf(codcf), _indsped(indsped) | ||||
| 
 | ||||
| { | ||||
|   add_file(LF_CLIFOGIAC ,"NRIGA"); | ||||
| } | ||||
| 
 | ||||
| TArticolo_lavanderie::TArticolo_lavanderie(const TRectype & rec, const char tipocf, const long codcf, const int indsped) | ||||
| 										 : TArticolo_giacenza_data(rec), _anno_lav(0), | ||||
| 										   _tipocf(tipocf), _codcf(codcf), _indsped(indsped) | ||||
| 
 | ||||
| { | ||||
|   add_file(LF_CLIFOGIAC ,"NRIGA"); | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // TArticolo_lavanderie_cache
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| class TCache_articoli_lavanderie : public TRecord_cache | ||||
| { | ||||
| protected: | ||||
|   virtual TObject* rec2obj(const TRectype& rec) const { return new TArticolo_lavanderie(rec);} | ||||
| 
 | ||||
| public: | ||||
|   TArticolo_lavanderie& lav(const char* key) { return (TArticolo_lavanderie&)query(key); } | ||||
| 
 | ||||
| 	TCache_articoli_lavanderie(); | ||||
|   virtual ~TCache_articoli_lavanderie() { } | ||||
| }; | ||||
| 
 | ||||
| TCache_articoli_lavanderie::TCache_articoli_lavanderie() | ||||
| 												   : TRecord_cache(LF_ANAMAG, 1) | ||||
| {  | ||||
|   test_file_changes();   // Tieni d'occhio le modifiche sul file
 | ||||
|   set_items_limit(256);  // Standard
 | ||||
| }         | ||||
| 
 | ||||
| TArticolo_lavanderie & cached_article_laundry(const char * codart, const char tipocf, const long codcf, const int indsped) | ||||
| { | ||||
| 	HIDDEN TCache_articoli_lavanderie __cache_articoli_lavanderie; | ||||
| 
 | ||||
| 	TArticolo_lavanderie & art = __cache_articoli_lavanderie.lav(codart); | ||||
| 	 | ||||
| 	art.set_tipocf(tipocf); | ||||
| 	art.set_codcf(codcf); | ||||
| 	art.set_indsped(indsped); | ||||
| 	return art; | ||||
| } | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										82
									
								
								lv/lvlib.h
									
									
									
									
									
								
							
							
						
						
									
										82
									
								
								lv/lvlib.h
									
									
									
									
									
								
							| @ -5,7 +5,89 @@ | ||||
| #include <isam.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifndef __RECSET_H | ||||
| #include <recset.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifndef __VARREC_H | ||||
| #include <varrec.h> | ||||
| #endif | ||||
| 
 | ||||
| #include "../mg/mglib.h" | ||||
| 
 | ||||
| void lv_set_creation_info(TRectype& rec); | ||||
| void lv_set_update_info(TRectype& rec); | ||||
| 
 | ||||
| class TRecmag_lavanderie : public TVariable_rectype | ||||
| 
 | ||||
| { | ||||
| 	TVariant _dotin; | ||||
| 	TVariant _dotod; | ||||
| 	TVariant _dottm; | ||||
| 	TVariant _consanno; | ||||
| 	TVariant _consmese; | ||||
| 	long _update_time; | ||||
| 
 | ||||
| protected: | ||||
|   virtual const TString & get_str(const char* fieldname) const ; | ||||
| 	virtual void put_str(const char* fieldname, const char* val) { return TRectype::put_str(fieldname, val);} | ||||
| 	void update(); | ||||
| 
 | ||||
| public: | ||||
| 	virtual int name2index(const char* fieldname) const; | ||||
| 	virtual TFieldtypes type(const char* fieldname) const; | ||||
| 	virtual int length(const char* fieldname) const; | ||||
| 	virtual int ndec(const char* fieldname) const; | ||||
| 	virtual bool exist(const char* fieldname) const; | ||||
|   virtual TObject* dup() const; | ||||
|   TRecmag_lavanderie(); | ||||
| 	TRecmag_lavanderie(const TRecmag_lavanderie & rec) : TVariable_rectype(rec), _update_time(0L) {} | ||||
|   virtual ~TRecmag_lavanderie() {} | ||||
| }; | ||||
| 
 | ||||
| class TArticolo_lavanderie : public TArticolo_giacenza_data | ||||
| {       | ||||
| 		int _anno_lav; | ||||
| 		char _tipocf; | ||||
| 		long _codcf; | ||||
| 		int _indsped; | ||||
| 
 | ||||
| protected: | ||||
|   // la get_str supporta anche la sintassi:
 | ||||
|   //     #LF->fieldname              
 | ||||
|   //     #LF_par1->fieldname              
 | ||||
|   //     #LF_par1_par2->fieldname              
 | ||||
|   //     #LF_par1_par2_par3->fieldname              
 | ||||
|   // dove:
 | ||||
|   //   LF = numero logico del sottofile collegato (LF_UMART, LF_DESLIN, LF_CODCORR
 | ||||
|   //   par1, par2, par3 = varie parti della chiave dell'indice del file collegato
 | ||||
|   //          il numero di queste parti ed il loro valore dipende dal file collegato
 | ||||
|   //          se parX comincia per # rappresenta il numero progressivo nell'indice 
 | ||||
|   //   fieldname = nome del campo nel file collegato
 | ||||
|   virtual const TString & get_str(const char* fieldname) const ; | ||||
|   virtual void set_body_key(TRectype & rowrec); | ||||
|   void set_anno_lav (int anno = 0); | ||||
| 	void set_anno_lav (const char * anno) { set_anno_mag(atoi(anno)); } | ||||
|   virtual TRectype * new_body_record(int logicnum = 0); | ||||
| public: | ||||
|   virtual TObject* dup() const { return new TArticolo_lavanderie(codice(), _tipocf, _codcf, _indsped); } | ||||
| 
 | ||||
|   int find_clifomag(TRecord_array& rclifomag, const char * livello = NULL, int from = 0) const ; | ||||
|   int find_clifomag(int annoes, const char * livello = NULL, int from = 0) const ; | ||||
| 	int find_clifomag(const char * annoes, const char * livello = NULL, int from = 0) const { return find_clifomag(atoi(annoes), livello, from); } | ||||
| 
 | ||||
|   TRecord_array & clifomag(int annoes) const; | ||||
| 	TRecord_array & clifomag(const char * annoes) const { return clifomag(atoi(annoes));} | ||||
| 
 | ||||
| 	void set_tipocf(char tipocf) { _tipocf = tipocf;} | ||||
| 	void set_codcf(long codcf) { _codcf = codcf;} | ||||
| 	void set_indsped(int indsped) { _indsped = indsped;} | ||||
|    | ||||
| 	TArticolo_lavanderie(const char* codice = NULL, const char tipocf = ' ', const long codcf = 0L, const int indsped = 0); | ||||
| 	TArticolo_lavanderie(const TRectype& rec, const char tipocf = ' ', const long codcf = 0L, const int indsped = 0); | ||||
|   virtual ~TArticolo_lavanderie() {} | ||||
| };   | ||||
| 
 | ||||
| TArticolo_lavanderie & cached_article_laundry(const char * codart, const char tipocf, const long codcf, const int indsped); | ||||
| 
 | ||||
| #endif | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user