Correzioni varie su lavanderie:
Aggiunto nuovo tipo di fatturazione con importo totale minimo Aggiunto flag per non riportare le note da bolla a fattura Aggiunte colonne di dotazione a buoni di ritiro Aggiunta nuova proposta causale di consegna su nuovo documento git-svn-id: svn://10.65.10.50/branches/R_10_00@22806 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									6cac0698e0
								
							
						
					
					
						commit
						82b76f399a
					
				| @ -96,6 +96,7 @@ | |||||||
| 
 | 
 | ||||||
| #define F_AGGHEAD          275 | #define F_AGGHEAD          275 | ||||||
| #define F_DESTHEAD         276 | #define F_DESTHEAD         276 | ||||||
|  | #define F_ZERONOTE         277 | ||||||
| 
 | 
 | ||||||
| #define F_BACKUP					 300 | #define F_BACKUP					 300 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -179,10 +179,16 @@ END | |||||||
| 
 | 
 | ||||||
| BOOLEAN F_RIFTEST | BOOLEAN F_RIFTEST | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 2 6 "Scrivi riferimenti in testata documento" |   PROMPT 2 6 "Riportare riferimenti in testata documento" | ||||||
|   FIELD RifTest |   FIELD RifTest | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
|  | BOOLEAN F_ZERONOTE | ||||||
|  | BEGIN | ||||||
|  |   PROMPT 42 6 "Non riportare note da bolle a fatture" | ||||||
|  |   FIELD ZeroNote | ||||||
|  | END | ||||||
|  | 
 | ||||||
| STRING F_FELAB_DIF 8 | STRING F_FELAB_DIF 8 | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 2 7 "Tipo fatt. definitiva" |   PROMPT 2 7 "Tipo fatt. definitiva" | ||||||
|  | |||||||
| @ -1,6 +1,5 @@ | |||||||
| #include <automask.h> | #include <automask.h> | ||||||
| #include <colmask.h> | #include <colmask.h> | ||||||
| #include <defmask.h> |  | ||||||
| #include <execp.h> | #include <execp.h> | ||||||
| #include <progind.h> | #include <progind.h> | ||||||
| #include <relapp.h> | #include <relapp.h> | ||||||
| @ -695,8 +694,6 @@ bool TContratti_msk::on_field_event(TOperable_field& o,TField_event e,long jolly | |||||||
|           } |           } | ||||||
|         } |         } | ||||||
|          |          | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|         //se ho scritto un articolo diverso da quello che esisteva prima
 |         //se ho scritto un articolo diverso da quello che esisteva prima
 | ||||||
|         //e se si desidera veramente modificarlo, allora permetto la modifica
 |         //e se si desidera veramente modificarlo, allora permetto la modifica
 | ||||||
|         //e forzo l'updatre della riga, altrimenti riscrivo l'articolo che c'era prima
 |         //e forzo l'updatre della riga, altrimenti riscrivo l'articolo che c'era prima
 | ||||||
| @ -1106,8 +1103,8 @@ bool TContratti_app:: user_create() | |||||||
|     _codart = ""; |     _codart = ""; | ||||||
|    |    | ||||||
|   const TDate oggi(TODAY); |   const TDate oggi(TODAY); | ||||||
| 	if (esercizi().date2esc(oggi) == 0) | 	if (esercizi().date2esc(oggi) <= 0) | ||||||
| 		return error_box("Attenzione non esiste l'esercizio corrispondente al %s", oggi.string()); | 		error_box("Non esiste l'esercizio corrispondente al %s", oggi.string()); | ||||||
| 
 | 
 | ||||||
|   _rel=new TRelation (LF_LVCONDV); |   _rel=new TRelation (LF_LVCONDV); | ||||||
|   _msk= new TContratti_msk; |   _msk= new TContratti_msk; | ||||||
|  | |||||||
| @ -429,6 +429,8 @@ BEGIN | |||||||
|   MESSAGE DISABLE,F_RAGART|ENABLE,F_IMPFIX|SHOW,F_CANFIX|HIDE,F_NOLCICTE |   MESSAGE DISABLE,F_RAGART|ENABLE,F_IMPFIX|SHOW,F_CANFIX|HIDE,F_NOLCICTE | ||||||
|   ITEM "2|% sul val. conv. per cli."  |   ITEM "2|% sul val. conv. per cli."  | ||||||
|   MESSAGE DISABLE,F_RAGART|DISABLE,F_IMPFIX|HIDE,F_CANFIX|SHOW,F_NOLCICTE |   MESSAGE DISABLE,F_RAGART|DISABLE,F_IMPFIX|HIDE,F_CANFIX|SHOW,F_NOLCICTE | ||||||
|  |   ITEM "3|Importo minimo"  | ||||||
|  |   MESSAGE DISABLE,F_RAGART|ENABLE,F_IMPFIX|SHOW,F_CANFIX|HIDE,F_NOLCICTE | ||||||
|   FIELD TIPOCAN |   FIELD TIPOCAN | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										139
									
								
								lv/lv2500.cpp
									
									
									
									
									
								
							
							
						
						
									
										139
									
								
								lv/lv2500.cpp
									
									
									
									
									
								
							| @ -102,7 +102,7 @@ TObject* TCalc_02_data::dup() const | |||||||
|                                       ////////////////////////////////////////
 |                                       ////////////////////////////////////////
 | ||||||
| 
 | 
 | ||||||
| //Classe TFatturazione_lavanderie
 | //Classe TFatturazione_lavanderie
 | ||||||
| class TFatturazione_lavanderie:public TFatturazione_bolle | class TFatturazione_lavanderie : public TFatturazione_bolle | ||||||
| { | { | ||||||
|   TDate _data_elab; |   TDate _data_elab; | ||||||
| 	TToken_string _campi_raggruppamento; | 	TToken_string _campi_raggruppamento; | ||||||
| @ -509,6 +509,7 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do | |||||||
| { | { | ||||||
| 	const bool use_indsp = ini_get_bool(CONFIG_DITTA, "mg", "MOV_INDSPED"); | 	const bool use_indsp = ini_get_bool(CONFIG_DITTA, "mg", "MOV_INDSPED"); | ||||||
|   const bool riftest   = ini_get_bool(CONFIG_DITTA, "lv", "RifTest"); |   const bool riftest   = ini_get_bool(CONFIG_DITTA, "lv", "RifTest"); | ||||||
|  |   const bool zero_note = ini_get_bool(CONFIG_DITTA, "lv", "ZeroNote"); | ||||||
| 	 | 	 | ||||||
|   //scorro tutti i documenti di output generati precedentemente
 |   //scorro tutti i documenti di output generati precedentemente
 | ||||||
|   for (int id = 0; id < doc_out.items(); id++) |   for (int id = 0; id < doc_out.items(); id++) | ||||||
| @ -560,6 +561,9 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do | |||||||
| 					doc.destroy_row(1, true); | 					doc.destroy_row(1, true); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  |     if (zero_note) | ||||||
|  |       doc.zero(DOC_NOTE); | ||||||
|  | 
 | ||||||
|     //se devo mettere i riferimenti della bolla in testata, prendo la descrizione della prima riga
 |     //se devo mettere i riferimenti della bolla in testata, prendo la descrizione della prima riga
 | ||||||
|     //e la metto sulla testata del documento, poi cancello la prima riga del documento
 |     //e la metto sulla testata del documento, poi cancello la prima riga del documento
 | ||||||
|     if (rifbol && riftest) |     if (rifbol && riftest) | ||||||
| @ -740,8 +744,8 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do | |||||||
| 			    const TRectype& rcont = contr.row(codart); | 			    const TRectype& rcont = contr.row(codart); | ||||||
| 			    const TString4 tipodot = rcont.get(LVRCONDV_NOLCIC); | 			    const TString4 tipodot = rcont.get(LVRCONDV_NOLCIC); | ||||||
| 			    const TString4 artcli = rcont.get(LVRCONDV_VCARTCLI); | 			    const TString4 artcli = rcont.get(LVRCONDV_VCARTCLI); | ||||||
|  			    real dot; |  | ||||||
| 			    const int annoes = _data_elab.year(); | 			    const int annoes = _data_elab.year(); | ||||||
|  |  			    real dot; | ||||||
| 
 | 
 | ||||||
|           //instanzio il TArticolo_lavanderia
 |           //instanzio il TArticolo_lavanderia
 | ||||||
|           //cerco la giacenza per articolo dell'articolo esaminato
 |           //cerco la giacenza per articolo dell'articolo esaminato
 | ||||||
| @ -809,7 +813,7 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do | |||||||
| 												warning_box(TR("Manca l'unità di misura di riferimento")); | 												warning_box(TR("Manca l'unità di misura di riferimento")); | ||||||
| 												break; | 												break; | ||||||
| 											} | 											} | ||||||
| 											if(umrif != umkg) | 											if (umrif != umkg) | ||||||
| 											{ | 											{ | ||||||
| 												warning_box(TR("L'unità di misura di riferimento non è quella dei Kg")); | 												warning_box(TR("L'unità di misura di riferimento non è quella dei Kg")); | ||||||
| 												break; | 												break; | ||||||
| @ -817,7 +821,7 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do | |||||||
| 
 | 
 | ||||||
| 											//leggo e controllo il fattore di conversione
 | 											//leggo e controllo il fattore di conversione
 | ||||||
| 											fatconv = unita.get_real("R10"); | 											fatconv = unita.get_real("R10"); | ||||||
| 											if(fatconv == ZERO) | 											if (fatconv.is_zero()) | ||||||
| 											{ | 											{ | ||||||
| 												warning_box(TR("Manca il fattore di conversione")); | 												warning_box(TR("Manca il fattore di conversione")); | ||||||
| 												break; | 												break; | ||||||
| @ -934,13 +938,13 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do | |||||||
|               if (tipovalconv == 'A') |               if (tipovalconv == 'A') | ||||||
|               { |               { | ||||||
|                 //leggo la quantità consegnata e calcolo consumo e importo convenzionale secondo le formule
 |                 //leggo la quantità consegnata e calcolo consumo e importo convenzionale secondo le formule
 | ||||||
|                 //CONSUMO   = QTA * PREZZO(dalla riga documento)
 |                 //CONSUMO = QTA * PREZZO(dalla riga documento)
 | ||||||
|                 //IMPCONV = DOT * PREZZO(dalla riga contratto) * PERCENTUALE DI FORFAIT CLIENTE
 |                 //IMPCONV = DOT * PREZZO(dalla riga contratto) * PERCENTUALE DI FORFAIT CLIENTE
 | ||||||
|                 const real qta = rout.get_real(RDOC_QTA); |                 const real qta = rout.get_real(RDOC_QTA); | ||||||
|                 const real consumo = qta * rout.get_real(RDOC_PREZZO); |                 const real consumo = qta * rout.get_real(RDOC_PREZZO); | ||||||
|                 const real impconv = dot * rcont.get_real(LVRCONDV_VALCONV) * rcont.get_real(LVRCONDV_FORFPERCL) / 100; |                 const real impconv = dot * rcont.get_real(LVRCONDV_VALCONV) * rcont.get_real(LVRCONDV_FORFPERCL) / CENTO; | ||||||
| 
 | 
 | ||||||
| 								impvconv += impconv; | 								impvconv  += impconv; | ||||||
| 								consvconv += consumo; | 								consvconv += consumo; | ||||||
|               } |               } | ||||||
|               else |               else | ||||||
| @ -965,7 +969,7 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do | |||||||
|                     const TString80 codart = riga.get(RDOC_CODART); |                     const TString80 codart = riga.get(RDOC_CODART); | ||||||
|                     const TRectype & rcont = contr.row(codart); |                     const TRectype & rcont = contr.row(codart); | ||||||
|                     const char tipvalconvcli = rcont.get_char(LVRCONDV_VCARTCLI); |                     const char tipvalconvcli = rcont.get_char(LVRCONDV_VCARTCLI); | ||||||
| 										char lavtype = riga.get_char("LVTYPE"); | 										const char lavtype = riga.get_char("LVTYPE"); | ||||||
|                     if (tipvalconvcli == 'C' && lavtype != 'D') |                     if (tipvalconvcli == 'C' && lavtype != 'D') | ||||||
|                     { |                     { | ||||||
| 											if (arts.objptr(codart) == NULL) | 											if (arts.objptr(codart) == NULL) | ||||||
| @ -987,7 +991,7 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do | |||||||
|                       consumotot += riga.get_real(RDOC_QTA) * riga.get_real(RDOC_PREZZO); |                       consumotot += riga.get_real(RDOC_QTA) * riga.get_real(RDOC_PREZZO); | ||||||
|                     } |                     } | ||||||
|                   } |                   } | ||||||
|                   //se il consumo è minore del ciclaggio, allora
 |                   //se il consumo è minore dell'importo convenzionale, allora
 | ||||||
|                   if (consumotot < impconvtot) |                   if (consumotot < impconvtot) | ||||||
|                   { |                   { | ||||||
|                     const bool cicl2rig=contr.get_bool(LVCONDV_CICLAGGIO); |                     const bool cicl2rig=contr.get_bool(LVCONDV_CICLAGGIO); | ||||||
| @ -1073,52 +1077,79 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do | |||||||
| 			    } | 			    } | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
|         //se il consumo è minore del ciclaggio, allora
 |         if (tipocan == 3) | ||||||
| 				if (impvconv - consvconv > ZERO) |  | ||||||
|         { |         { | ||||||
|           const bool cicl2rig = contr.get_bool(LVCONDV_CICLAGGIO); |           const real canfis = contr.get_real(LVCONDV_IMPFIX); | ||||||
| 					const int rows = doc.physical_rows(); |           const real imponibile = doc.imponibile(); | ||||||
| 
 |           if (canfis > imponibile) | ||||||
| 					//se il ciclaggio è su due linee, allora aggiungo una riga merce, che contiene
 |  | ||||||
|           //il conguaglio al valore convenzionale, che ha come quantità la costante UNO
 |  | ||||||
|           //e come prezzo la differenza tra l'importo convenzionale e il consumo;
 |  | ||||||
|           //altimenti correggo quantità e prezzo direttamente sulla riga documento che sto analizzando
 |  | ||||||
|           TRiga_documento& congrow = doc.new_row("01"); |  | ||||||
| 		      const TString80 codartcon = ini_get_string(CONFIG_DITTA, "lv", "Codartcofix"); |  | ||||||
| 
 |  | ||||||
| 					congrow.put(RDOC_CODART, codartcon); |  | ||||||
| 					congrow.put(RDOC_CHECKED, "X"); |  | ||||||
| 					congrow.put(RDOC_CODARTMAG, codartcon); |  | ||||||
|           congrow.put(RDOC_DESCR, "Conguaglio valore convenzionale"); |  | ||||||
|           congrow.put(RDOC_QTA, UNO); |  | ||||||
| 
 |  | ||||||
| 					TString8 codiva = doc.clifor().vendite().get(CFV_ASSFIS); |  | ||||||
| 					 |  | ||||||
| 					if (codiva.blank()) |  | ||||||
| 	          codiva = cache().get(LF_ANAMAG, codartcon, ANAMAG_CODIVA); |  | ||||||
| 
 |  | ||||||
| 					congrow.put(RDOC_CODIVA, codiva); |  | ||||||
| 
 |  | ||||||
|           if (cicl2rig) |  | ||||||
| 		        congrow.put(RDOC_PREZZO, impvconv - consvconv); |  | ||||||
|           else |  | ||||||
|           { |           { | ||||||
| 		        congrow.put(RDOC_PREZZO, impvconv); |             TRiga_documento& congrow = doc.new_row("01"); | ||||||
|             for (int k = rows - 1; k >= 1; k--) | 		        const TString80 codartcon = ini_get_string(CONFIG_DITTA, "lv", "Codartcofix"); | ||||||
|             { | 
 | ||||||
|               TRiga_documento& delrow = doc[k]; | 					  congrow.put(RDOC_CODART, codartcon); | ||||||
|               const TString80 codart = delrow.get(RDOC_CODART); | 					  congrow.put(RDOC_CHECKED, "X"); | ||||||
|               const TRectype& rcont = contr.row(codart); | 					  congrow.put(RDOC_CODARTMAG, codartcon); | ||||||
| 							const int tipoforf = rcont.get_int(LVRCONDV_TIPOFORF); |             congrow.put(RDOC_DESCR, "Conguaglio valore convenzionale"); | ||||||
| 							char lavtype = delrow.get_char("LVTYPE"); |             congrow.put(RDOC_QTA, UNO); | ||||||
|               if (tipoforf == 4 && lavtype != 'D') | 
 | ||||||
|                 doc.destroy_row(k, true); | 					  TString4 codiva = doc.clifor().vendite().get(CFV_ASSFIS); | ||||||
| 						} | 					  if (codiva.blank()) | ||||||
|  | 	            codiva = cache().get(LF_ANAMAG, codartcon, ANAMAG_CODIVA); | ||||||
|  | 
 | ||||||
|  | 					  congrow.put(RDOC_CODIVA, codiva); | ||||||
|  | 
 | ||||||
|  | 		        congrow.put(RDOC_PREZZO, canfis - imponibile); | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|  |         else | ||||||
|  |         { | ||||||
|  |           //se il consumo è minore del ciclaggio, allora
 | ||||||
|  | 				  if (impvconv > consvconv) | ||||||
|  |           { | ||||||
|  |             const bool cicl2rig = contr.get_bool(LVCONDV_CICLAGGIO); | ||||||
|  | 					  const int rows = doc.physical_rows(); | ||||||
| 
 | 
 | ||||||
|  | 					  //se il ciclaggio è su due linee, allora aggiungo una riga merce, che contiene
 | ||||||
|  |             //il conguaglio al valore convenzionale, che ha come quantità la costante UNO
 | ||||||
|  |             //e come prezzo la differenza tra l'importo convenzionale e il consumo;
 | ||||||
|  |             //altimenti correggo quantità e prezzo direttamente sulla riga documento che sto analizzando
 | ||||||
|  |             TRiga_documento& congrow = doc.new_row("01"); | ||||||
|  | 		        const TString80 codartcon = ini_get_string(CONFIG_DITTA, "lv", "Codartcofix"); | ||||||
|  | 
 | ||||||
|  | 					  congrow.put(RDOC_CODART, codartcon); | ||||||
|  | 					  congrow.put(RDOC_CHECKED, "X"); | ||||||
|  | 					  congrow.put(RDOC_CODARTMAG, codartcon); | ||||||
|  |             congrow.put(RDOC_DESCR, "Conguaglio valore convenzionale"); | ||||||
|  |             congrow.put(RDOC_QTA, UNO); | ||||||
|  | 
 | ||||||
|  | 					  TString8 codiva = doc.clifor().vendite().get(CFV_ASSFIS); | ||||||
|  | 					 | ||||||
|  | 					  if (codiva.blank()) | ||||||
|  | 	            codiva = cache().get(LF_ANAMAG, codartcon, ANAMAG_CODIVA); | ||||||
|  | 
 | ||||||
|  | 					  congrow.put(RDOC_CODIVA, codiva); | ||||||
|  | 
 | ||||||
|  |             if (cicl2rig) | ||||||
|  | 		          congrow.put(RDOC_PREZZO, impvconv - consvconv); | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  | 		          congrow.put(RDOC_PREZZO, impvconv); | ||||||
|  |               for (int k = rows - 1; k >= 1; k--) | ||||||
|  |               { | ||||||
|  |                 TRiga_documento& delrow = doc[k]; | ||||||
|  |                 const TString80 codart = delrow.get(RDOC_CODART); | ||||||
|  |                 const TRectype& rcont = contr.row(codart); | ||||||
|  | 							  const int tipoforf = rcont.get_int(LVRCONDV_TIPOFORF); | ||||||
|  | 							  char lavtype = delrow.get_char("LVTYPE"); | ||||||
|  |                 if (tipoforf == 4 && lavtype != 'D') | ||||||
|  |                   doc.destroy_row(k, true); | ||||||
|  | 						  } | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         } | ||||||
|       } |       } | ||||||
| 			if (redditivita > ZERO && fatt_02() && !ragart && tipocan != 1) | 			 | ||||||
|  |       if (redditivita > ZERO && fatt_02() && !ragart && tipocan != 1) | ||||||
| 			{ | 			{ | ||||||
| 				const real totdoc = doc.totale_doc(); | 				const real totdoc = doc.totale_doc(); | ||||||
| 				const real provvigione1 = doc.provvigione(); | 				const real provvigione1 = doc.provvigione(); | ||||||
| @ -2513,14 +2544,14 @@ void TFatturazione_lav_app::main_loop() | |||||||
|     numdocgen += elab.write_fatt_ragg(_solototali); |     numdocgen += elab.write_fatt_ragg(_solototali); | ||||||
| 		 | 		 | ||||||
| 		TString str; | 		TString str; | ||||||
|     const char* const parolapl = _solototali ? "generate" : "elaborate"; |     const char* const parolapl = _solototali ? TR("generate") : TR("elaborate"); | ||||||
|     const char* const parolasi = _solototali ? "generata" : "elaborata"; |     const char* const parolasi = _solototali ? TR("generata") : TR("elaborata"); | ||||||
| 
 | 
 | ||||||
|     switch (numdocgen) |     switch (numdocgen) | ||||||
|     { |     { | ||||||
|     case  0: str << "Non e' stata " << parolasi << " alcuna fattura"; break; |     case  0: str << TR("Non è stata ") << parolasi << TR(" alcuna fattura"); break; | ||||||
|     case  1: str << "E' stata " << parolasi << " una fattura"; break; |     case  1: str << TR("E' stata ") << parolasi << TR(" una fattura"); break; | ||||||
|     default: str << "Sono state " << parolapl << ' ' << numdocgen << " fatture"; break; |     default: str << TR("Sono state ") << parolapl << ' ' << numdocgen << TR(" fatture"); break; | ||||||
|     } |     } | ||||||
|     if (numdocgen <= 0) |     if (numdocgen <= 0) | ||||||
|       warning_box(str); |       warning_box(str); | ||||||
|  | |||||||
| @ -7,7 +7,6 @@ int main(int argc, char** argv) | |||||||
|   const int r = (argc > 1) ? argv[1][1] - '0' : 0; |   const int r = (argc > 1) ? argv[1][1] - '0' : 0; | ||||||
|   switch (r) |   switch (r) | ||||||
|   {  |   {  | ||||||
|   case  0: lv3100(argc, argv); break; // gestione manuale bolle                lv3100
 |  | ||||||
|   case  1: lv3200(argc, argv); break; // evasione buoni di prelievo            lv3200
 |   case  1: lv3200(argc, argv); break; // evasione buoni di prelievo            lv3200
 | ||||||
|   case  2: lv3300(argc, argv); break; // gestione manuale buoni di prelievo    lv3300
 |   case  2: lv3300(argc, argv); break; // gestione manuale buoni di prelievo    lv3300
 | ||||||
|   case  3: lv3400(argc, argv); break; // evasione buoni di prelievo terminale  lv3400
 |   case  3: lv3400(argc, argv); break; // evasione buoni di prelievo terminale  lv3400
 | ||||||
|  | |||||||
| @ -16,6 +16,24 @@ | |||||||
| 
 | 
 | ||||||
| #define FOR_EACH_DOC_ROW_BACK(d, r, row) const TRiga_documento* row = NULL; for (int r = d.rows(); r > 0 && (row = &d[r]) != NULL; r--) | #define FOR_EACH_DOC_ROW_BACK(d, r, row) const TRiga_documento* row = NULL; for (int r = d.rows(); r > 0 && (row = &d[r]) != NULL; r--) | ||||||
| 
 | 
 | ||||||
|  | HIDDEN bool doc_is_buono_ritiro(const TDocumento& doc) | ||||||
|  | { | ||||||
|  |   const TString4 codnum = doc.get(DOC_CODNUM); | ||||||
|  |   const TString4 tipo = doc.get(DOC_TIPODOC); | ||||||
|  | 
 | ||||||
|  |   for (int i = 0; ; i++) | ||||||
|  |   { | ||||||
|  |     const TString& n = ini_get_string(CONFIG_DITTA, "lv", "NUM_RIT", "", i); | ||||||
|  |     const TString& t = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_RIT", "", i); | ||||||
|  |     if (n.blank() || t.blank()) | ||||||
|  |       break; | ||||||
|  |     if ((codnum.blank() || codnum == n) && tipo == t) | ||||||
|  |       return true; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   return false; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|                             //////////////////////////////////////////
 |                             //////////////////////////////////////////
 | ||||||
|                             ////    CLASSE TGESTIONE_BOLLE_MSK    ////
 |                             ////    CLASSE TGESTIONE_BOLLE_MSK    ////
 | ||||||
|                             //////////////////////////////////////////
 |                             //////////////////////////////////////////
 | ||||||
| @ -411,8 +429,13 @@ bool TGestione_bolle_msk::lv_bolla_handler(TMask_field& f, KEY k) | |||||||
|   default: break; |   default: break; | ||||||
|   } |   } | ||||||
|   TGestione_bolle_msk& dmsk = (TGestione_bolle_msk&)f.mask(); |   TGestione_bolle_msk& dmsk = (TGestione_bolle_msk&)f.mask(); | ||||||
|   if(dmsk.mode() == MODE_INS) |    | ||||||
|  |   bool init_consegna = false; | ||||||
|  |   if (dmsk.mode() == MODE_INS) | ||||||
|  |   { | ||||||
|     dmsk.set(F_CODAG, dmsk.proponi_autista()); |     dmsk.set(F_CODAG, dmsk.proponi_autista()); | ||||||
|  |     init_consegna = !doc_is_buono_ritiro(dmsk.doc()); | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|   if (ok && k == K_TAB && ((dmsk.insert_mode() && f.to_check(k, true)) || f.focusdirty()) && dmsk.mode() != MODE_MOD ) |   if (ok && k == K_TAB && ((dmsk.insert_mode() && f.to_check(k, true)) || f.focusdirty()) && dmsk.mode() != MODE_MOD ) | ||||||
|   { |   { | ||||||
| @ -489,10 +512,7 @@ bool TGestione_bolle_msk::lv_bolla_handler(TMask_field& f, KEY k) | |||||||
|       //recupero i dati di interesse dalla riga del contratto e li inserisco sullo sheet
 |       //recupero i dati di interesse dalla riga del contratto e li inserisco sullo sheet
 | ||||||
|       const TString80 codart = rcont.get(LVRCONDV_CODART).as_string(); |       const TString80 codart = rcont.get(LVRCONDV_CODART).as_string(); | ||||||
| 
 | 
 | ||||||
|       TString4 causale = rcont.get(LVRCONDV_CAUSLAV).as_string(); |       const TString4 causale = lv_get_causale_from_rcontr(rcont.cursor()->curr(), init_consegna); | ||||||
| 
 |  | ||||||
|       if (causale.blank() || atoi(causale) == 0) |  | ||||||
|         causale = ini_get_string(CONFIG_DITTA, "lv", "CAUSLAV"); |  | ||||||
|        |        | ||||||
|       //instanzio una cache sulle anagrafice di magazzino
 |       //instanzio una cache sulle anagrafice di magazzino
 | ||||||
|       const TRectype& anamag = cache().get(LF_ANAMAG,codart); |       const TRectype& anamag = cache().get(LF_ANAMAG,codart); | ||||||
| @ -756,10 +776,7 @@ bool TGestione_bolle_msk::lv_codart_handler(TMask_field& f, KEY k) | |||||||
|       const TRectype& rcont = cont.row(codart); |       const TRectype& rcont = cont.row(codart); | ||||||
| 
 | 
 | ||||||
|       //cerco la causale relativa all'articolo; se non la trovo prendo quella standard
 |       //cerco la causale relativa all'articolo; se non la trovo prendo quella standard
 | ||||||
|       TString4 causale = rcont.get(LVRCONDV_CAUSLAV); |       TString4 causale = lv_get_causale_from_rcontr(rcont, false); | ||||||
|       if (causale.blank() || atoi(causale) == 0 )       |  | ||||||
|         causale = ini_get_string(CONFIG_DITTA, "lv", "CAUSLAV");               |  | ||||||
| 
 |  | ||||||
|       if (rdoc.get("DOTOD").empty()) |       if (rdoc.get("DOTOD").empty()) | ||||||
|       { |       { | ||||||
|         //gestione campi dotazione odierna e dotazione temporanea
 |         //gestione campi dotazione odierna e dotazione temporanea
 | ||||||
| @ -1015,7 +1032,7 @@ bool TGestione_bolle_msk::lv_causale_handler(TMask_field& f, KEY k) | |||||||
|       TString16 tmp; |       TString16 tmp; | ||||||
|       tmp << dotmp; |       tmp << dotmp; | ||||||
|        |        | ||||||
|       if(msk.field(FR_TIPORIGA).get_long() != 22) |       if(msk.get_int(FR_TIPORIGA) != 22) | ||||||
|       { |       { | ||||||
|         msk.field(FR_JOLLY2).set(tmp); |         msk.field(FR_JOLLY2).set(tmp); | ||||||
|         //setto le date di inizio e fine della dotazione temporanea
 |         //setto le date di inizio e fine della dotazione temporanea
 | ||||||
| @ -1292,13 +1309,15 @@ TMask* TGestione_bolle_app::get_mask( int mode ) | |||||||
|       TGestione_bolle_msk* m = new TGestione_bolle_msk(tipodoc); |       TGestione_bolle_msk* m = new TGestione_bolle_msk(tipodoc); | ||||||
| 
 | 
 | ||||||
|       TSheet_field& sheet = m->sfield(F_SHEET); |       TSheet_field& sheet = m->sfield(F_SHEET); | ||||||
|       if (sheet.exist_column(FR_JOLLY1)) |       //setto l'allineamento a destra dei campi incriminati e pure criminali 
 | ||||||
|       {         |       // Dotazione              Odierna    Temporanea Iniziale
 | ||||||
|         //setto l'allineamento a destra dei campi incriminati e pure criminali 
 |       const short id_dot[4] = { FR_JOLLY1, FR_JOLLY2, FR_JOLLY5, 0 }; | ||||||
|         sheet.set_column_justify(sheet.cid2index(FR_JOLLY1), true); |       for (int i = 0; id_dot[i]; i++) | ||||||
|         sheet.set_column_justify(sheet.cid2index(FR_JOLLY2), true); |       { | ||||||
|  |         if (sheet.exist_column(id_dot[i])) | ||||||
|  |           sheet.set_column_justify(sheet.cid2index(id_dot[i]), true);  | ||||||
|       } |       } | ||||||
| 
 |        | ||||||
|       _doc_masks.add(tipodoc, m); |       _doc_masks.add(tipodoc, m); | ||||||
|       const TTipo_documento& tdoc = m->doc().tipo(); |       const TTipo_documento& tdoc = m->doc().tipo(); | ||||||
|       const TString_array& handlers = tdoc.handlers(); |       const TString_array& handlers = tdoc.handlers(); | ||||||
| @ -1338,9 +1357,7 @@ void TGestione_bolle_app::salva_conguaglio(const TDocumento_mask& mask) | |||||||
| 		const TLaundry_contract cont(codcf, indsped, datadoc); | 		const TLaundry_contract cont(codcf, indsped, datadoc); | ||||||
| 		const int codcont = cont.get_int(LVCONDV_CODCONT); | 		const int codcont = cont.get_int(LVCONDV_CODCONT); | ||||||
| 
 | 
 | ||||||
|     const bool is_buono_ritiro = mask.get(F_CODNUM) == ini_get_string(CONFIG_DITTA, "lv", "NUM_RIT(0)") && |     const bool is_buono_ritiro = doc_is_buono_ritiro(d); | ||||||
|                                  mask.get(F_TIPODOC) == ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_RIT(0)"); |  | ||||||
| 
 |  | ||||||
| 		TLocalisamfile rcondv(LF_LVRCONDV); | 		TLocalisamfile rcondv(LF_LVRCONDV); | ||||||
| 
 | 
 | ||||||
| 		FOR_EACH_DOC_ROW_BACK(d, r, row) | 		FOR_EACH_DOC_ROW_BACK(d, r, row) | ||||||
| @ -1499,9 +1516,8 @@ void TGestione_bolle_app::init_insert_mode(TMask &m) | |||||||
|   _giac.reset(d); |   _giac.reset(d); | ||||||
| 
 | 
 | ||||||
|   //se sto leggendo o generando un buono di ritiro, abilito questo campo
 |   //se sto leggendo o generando un buono di ritiro, abilito questo campo
 | ||||||
|   bool enable_dataprco = mask.get(F_CODNUM) == ini_get_string(CONFIG_DITTA, "lv", "NUM_RIT(0)") && |   const bool enable_dataprco = doc_is_buono_ritiro(d); | ||||||
|                          mask.get(F_TIPODOC) == ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_RIT(0)"); |   | ||||||
|    |  | ||||||
|   mask.field(F_LVDATAPRCO).enable(enable_dataprco); |   mask.field(F_LVDATAPRCO).enable(enable_dataprco); | ||||||
| 
 | 
 | ||||||
|   mask.reset_var_mask(); |   mask.reset_var_mask(); | ||||||
| @ -1513,10 +1529,10 @@ void TGestione_bolle_app::init_insert_mode(TMask &m) | |||||||
| //ridefinisco il metodo init_query_mode della TMotore_application
 | //ridefinisco il metodo init_query_mode della TMotore_application
 | ||||||
| void TGestione_bolle_app::init_modify_mode(TMask& mask) | void TGestione_bolle_app::init_modify_mode(TMask& mask) | ||||||
| { | { | ||||||
|  |   TGestione_bolle_msk& m = (TGestione_bolle_msk&) mask; | ||||||
|   //se sto leggendo o generando un buono di ritiro, abilito questo campo
 |   //se sto leggendo o generando un buono di ritiro, abilito questo campo
 | ||||||
|   bool enable_dataprco = mask.get(F_CODNUM) == ini_get_string(CONFIG_DITTA, "lv", "NUM_RIT(0)") && |   const bool enable_dataprco = doc_is_buono_ritiro(m.doc()); | ||||||
|                          mask.get(F_TIPODOC) == ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_RIT(0)"); |      | ||||||
|    |  | ||||||
|   mask.field(F_LVDATAPRCO).enable(enable_dataprco); |   mask.field(F_LVDATAPRCO).enable(enable_dataprco); | ||||||
|    |    | ||||||
|   mask.first_focus(F_CODCF, false); |   mask.first_focus(F_CODCF, false); | ||||||
|  | |||||||
| @ -414,7 +414,8 @@ bool TGestione_buoni_msk::set_righe_buono_handler(TMask_field& f, KEY k) | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   TGestione_buoni_msk& dmsk = (TGestione_buoni_msk&)f.mask(); |   TGestione_buoni_msk& dmsk = (TGestione_buoni_msk&)f.mask(); | ||||||
|   if(dmsk.mode() == MODE_INS) |   const bool ins_mode = dmsk.mode() == MODE_INS; | ||||||
|  |   if (ins_mode) | ||||||
|     dmsk.set(F_CODAG, dmsk.proponi_autista()); |     dmsk.set(F_CODAG, dmsk.proponi_autista()); | ||||||
| 
 | 
 | ||||||
|   if (ok && k == K_TAB && ((dmsk.insert_mode() && f.to_check(k, true)) || f.focusdirty()) && dmsk.mode() != MODE_MOD) |   if (ok && k == K_TAB && ((dmsk.insert_mode() && f.to_check(k, true)) || f.focusdirty()) && dmsk.mode() != MODE_MOD) | ||||||
| @ -492,11 +493,8 @@ bool TGestione_buoni_msk::set_righe_buono_handler(TMask_field& f, KEY k) | |||||||
|       //recupero i dati di interesse dalla riga del contratto e li inserisco sullo sheet
 |       //recupero i dati di interesse dalla riga del contratto e li inserisco sullo sheet
 | ||||||
|       const TString80 codart = rcont.get(LVRCONDV_CODART).as_string(); |       const TString80 codart = rcont.get(LVRCONDV_CODART).as_string(); | ||||||
| 
 | 
 | ||||||
|       TString4 causale = rcont.get(LVRCONDV_CAUSLAV).as_string(); |       const TString4 causale = lv_get_causale_from_rcontr(rcont.cursor()->curr(), ins_mode); | ||||||
| 
 |              | ||||||
|       if (causale.blank() || atoi(causale) == 0) |  | ||||||
|         causale = ini_get_string(CONFIG_DITTA, "lv", "CAUSLAV"); |  | ||||||
|        |  | ||||||
|       //instanzio una cache sulle anagrafice di magazzino
 |       //instanzio una cache sulle anagrafice di magazzino
 | ||||||
|       const TRectype& anamag = cache().get(LF_ANAMAG,codart); |       const TRectype& anamag = cache().get(LF_ANAMAG,codart); | ||||||
|        |        | ||||||
| @ -1485,7 +1483,6 @@ TGiac_per_cli& TGestione_buoni_app::giacenza() | |||||||
| int lv3300( int argc, char* argv[]) | int lv3300( int argc, char* argv[]) | ||||||
| { | { | ||||||
|   TGestione_buoni_app a; |   TGestione_buoni_app a; | ||||||
| 
 |  | ||||||
|   a.run( argc, argv, TR("Buoni di Prelievo")); |   a.run( argc, argv, TR("Buoni di Prelievo")); | ||||||
|   return 0; |   return 0; | ||||||
| } | } | ||||||
| @ -200,11 +200,13 @@ Col(5)=FR_DESCR||28 | |||||||
| Col(6)=FR_CAULAV|Caus.|5 | Col(6)=FR_CAULAV|Caus.|5 | ||||||
| Col(7)=FR_RITIRO|Ritiro|6 | Col(7)=FR_RITIRO|Ritiro|6 | ||||||
| Col(8)=FR_QTA|Rotti|6 | Col(8)=FR_QTA|Rotti|6 | ||||||
| Col(9)=FR_TIPORIGA|Tipo|4 | Col(9)=FR_JOLLY1|Dot.Od.|7 | ||||||
| Col(10)=FR_CODMAG | Col(10)=FR_JOLLY5|Dot.In.|7 | ||||||
| Col(11)=FR_CODDEP | Col(11)=FR_TIPORIGA|Tipo|4 | ||||||
| Col(12)=FR_CODMAGC | Col(12)=FR_CODMAG | ||||||
| Col(13)=FR_CODDEPC | Col(13)=FR_CODDEP | ||||||
|  | Col(14)=FR_CODMAGC | ||||||
|  | Col(15)=FR_CODDEPC | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| [RIGHE] | [RIGHE] | ||||||
|  | |||||||
							
								
								
									
										19
									
								
								lv/lvlib.cpp
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								lv/lvlib.cpp
									
									
									
									
									
								
							| @ -120,6 +120,25 @@ long lv_find_contract(const long codcf, const long indsped, const TDate& data) | |||||||
|   return cod; |   return cod; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | const TString& lv_get_causale_from_rcontr(const TRectype& rcont, bool is_consegna) | ||||||
|  | { | ||||||
|  |   TString4 causale = rcont.get(LVRCONDV_CAUSLAV); | ||||||
|  | 
 | ||||||
|  |   if (causale.blank() || atoi(causale) == 0) | ||||||
|  |     causale = ini_get_string(CONFIG_DITTA, "lv", "CAUSLAV"); | ||||||
|  | 
 | ||||||
|  |   if (is_consegna) | ||||||
|  |   { | ||||||
|  |     const TString& causale_consegna = cache().get("&CAU", causale, "S5"); | ||||||
|  |     if (causale_consegna.full()) | ||||||
|  |       causale = causale_consegna; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   return get_tmp_string() = causale; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| ///////////////////////////////////////////////////////////
 | ///////////////////////////////////////////////////////////
 | ||||||
| // TLaundry_contract
 | // TLaundry_contract
 | ||||||
| ///////////////////////////////////////////////////////////
 | ///////////////////////////////////////////////////////////
 | ||||||
|  | |||||||
| @ -16,6 +16,8 @@ void lv_set_update_info(TRectype& rec); | |||||||
| long lv_find_contract(const long codcf, const long indsped, const TDate& data); | long lv_find_contract(const long codcf, const long indsped, const TDate& data); | ||||||
| bool lv_is_holiday(const TDate& data);  | bool lv_is_holiday(const TDate& data);  | ||||||
| bool lv_is_02_active();  | bool lv_is_02_active();  | ||||||
|  | const TString& lv_get_causale_from_rcontr(const TRectype& lvcontr, bool is_consegna); | ||||||
|  | 
 | ||||||
| const TFilename & lv_backup_path(); | const TFilename & lv_backup_path(); | ||||||
| 
 | 
 | ||||||
| class TLaundry_contract : public TRectype | class TLaundry_contract : public TRectype | ||||||
|  | |||||||
| @ -1,10 +1,6 @@ | |||||||
| #ifndef __LVLIB2_H | #ifndef __LVLIB2_H | ||||||
| #define __LVLIB2_H | #define __LVLIB2_H | ||||||
| 
 | 
 | ||||||
| #ifndef __ISAM_H |  | ||||||
| #include <isam.h> |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| #ifndef __RECSET_H | #ifndef __RECSET_H | ||||||
| #include <recset.h> | #include <recset.h> | ||||||
| #endif | #endif | ||||||
|  | |||||||
| @ -195,6 +195,25 @@ BEGIN | |||||||
|   FIELD PREZZO |   FIELD PREZZO | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
|  | GR -1 78 4 | ||||||
|  | BE | ||||||
|  | PR 1 10 "@bDotazioni" | ||||||
|  | EN | ||||||
|  | 
 | ||||||
|  | NU 155 7 | ||||||
|  | BE | ||||||
|  | PR 2 11 "Dotazione Odierna  " | ||||||
|  | FI DOTOD | ||||||
|  | FL "D" | ||||||
|  | EN | ||||||
|  | 
 | ||||||
|  | NU 159 7 | ||||||
|  | BE | ||||||
|  | PR 2 12 "Dotazione iniziale " | ||||||
|  | FI DOTIN | ||||||
|  | FL "D" | ||||||
|  | EN | ||||||
|  | 
 | ||||||
| STRING FR_CAULAV 3 | STRING FR_CAULAV 3 | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 2 7 "Cau.Lav. " |   PROMPT 2 7 "Cau.Lav. " | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user