Generazione automatica giri da contratti e correzioni varie
git-svn-id: svn://10.65.10.50/branches/R_10_00@22651 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									b7afe8715d
								
							
						
					
					
						commit
						52faa371ab
					
				| @ -7,7 +7,6 @@ int main(int argc, char** argv) | ||||
|   const int r = (argc > 1) ? argv[1][1] - '0' : 0; | ||||
|   switch (r) | ||||
|   { | ||||
|   case 0: lv2100(argc, argv); break;    //generazione automatica del planning
 | ||||
|   case 1: lv2200(argc, argv); break;    //manipolazione e stampa del planning
 | ||||
|   case 2: lv2300(argc, argv); break;    //Stampa Giri Giornaliero/Settimanale
 | ||||
|   case 3: lv2400(argc, argv); break;    //generazione automatica bolle di consegna
 | ||||
| @ -16,7 +15,8 @@ int main(int argc, char** argv) | ||||
|   case 6: lv2700(argc, argv); break;    //Riepilogo Bolle di Lavanderie
 | ||||
|   case 7: lv2800(argc, argv); break;    //Venduto Per Cliente nei 12 Mesi
 | ||||
|   case 8: lv2900(argc, argv); break;    //acquisizione del pulito
 | ||||
|   default: lv2100(argc, argv); break;   //generazione automatica del planning
 | ||||
|   case 9: lv2A00(argc, argv); break;    //generazione automatica giri
 | ||||
|   default:lv2100(argc, argv); break;    //generazione automatica del planning
 | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
							
								
								
									
										1
									
								
								lv/lv2.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								lv/lv2.h
									
									
									
									
									
								
							| @ -10,5 +10,6 @@ int lv2600(int argc, char* argv[]); | ||||
| int lv2700(int argc, char* argv[]);   //Riepilogo Bolle di Lavanderie -6
 | ||||
| int lv2800(int argc, char* argv[]);   //Venduto Per Cliente nei 12 Mesi -7
 | ||||
| int lv2900(int argc, char* argv[]); | ||||
| int lv2A00(int argc, char* argv[]); | ||||
| 
 | ||||
| #endif // __LV2_H
 | ||||
| @ -221,7 +221,7 @@ BEGIN | ||||
|   FIELD FREQ | ||||
| END | ||||
| 
 | ||||
| LIST F_S_MODPASS 10 | ||||
| LIST F_S_MODPASS 1 10 | ||||
| BEGIN | ||||
|   PROMPT 38 3 "Mod. pas. " | ||||
|   ITEM "C|Consegna" | ||||
|  | ||||
| @ -2283,7 +2283,7 @@ void TFatturazione_lav_app::main_loop() | ||||
|         if(!contr.ok()) | ||||
|         { | ||||
|           TString msg; | ||||
|           msg << "Non ci sono contratti in essere per il cliente " << clifo << " " << clirec.get(CLI_RICALT) << " in data " << datafat.string(); | ||||
|           msg << TR("Non ci sono contratti in essere per il cliente ") << clifo << " " << clirec.get(CLI_RICALT) << TR(" in data ") << datafat.string(); | ||||
|           _log->log(0, msg); | ||||
|         } | ||||
|         const int contrper = contr.get_int(LVCONDV_PERFAT); | ||||
|  | ||||
							
								
								
									
										141
									
								
								lv/lv2A00.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								lv/lv2A00.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,141 @@ | ||||
| #include <applicat.h> | ||||
| #include <automask.h> | ||||
| #include <progind.h> | ||||
| #include <recarray.h> | ||||
| #include <recset.h> | ||||
| #include <relation.h> | ||||
| #include <reputils.h> | ||||
| 
 | ||||
| #include <clifo.h> | ||||
| #include "lvcondv.h" | ||||
| #include "lvpasplan.h" | ||||
| 
 | ||||
| #include "lv2a00a.h" | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // TAutogiro_msk
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| class TAutogiro_msk : public TAutomask | ||||
| { | ||||
| protected: | ||||
|   virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); | ||||
| 
 | ||||
| public: | ||||
|   TAutogiro_msk(); | ||||
| }; | ||||
| 
 | ||||
| bool TAutogiro_msk::on_field_event(TOperable_field& o, TField_event e, long jolly) | ||||
| { | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| TAutogiro_msk::TAutogiro_msk() : TAutomask("lv2a00a")  | ||||
| { | ||||
|   // Propone itinerario senza autista
 | ||||
|   TEdit_field& g = efield(F_ITINERARIO); | ||||
|   TCursor& gcur = *g.browse()->cursor(); | ||||
|   for (gcur = gcur.items()-1; gcur.ok(); --gcur) | ||||
|   { | ||||
|     if (gcur.curr().get("S1").empty()) | ||||
|     { | ||||
|       g.browse()->do_output(); | ||||
|       break; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   // Propone prima frequenza disponibile (settimanale)
 | ||||
|   TEdit_field& f = efield(F_FREQUENZA); | ||||
|   TCursor& fcur = *f.browse()->cursor(); | ||||
|   if (fcur.items()) | ||||
|   { | ||||
|     fcur = 0L; | ||||
|     f.browse()->do_output(); | ||||
|   } | ||||
| 
 | ||||
|   // Propone consegna e ritiro
 | ||||
|   set(F_CONSEGNA, "E"); | ||||
| 
 | ||||
|   // Preimposta i feriali
 | ||||
|   for (int d = 0; d < 5; d++) | ||||
|     set(F_LUNEDI+d, "X"); | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // TAutogiro_app
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| class TAutogiro_app : public TSkeleton_application | ||||
| { | ||||
| protected: | ||||
|   virtual void main_loop(); | ||||
| }; | ||||
| 
 | ||||
| void TAutogiro_app::main_loop() | ||||
| { | ||||
|   TAutogiro_msk msk; | ||||
|   while (msk.run() == K_ENTER) | ||||
|   { | ||||
|     const TDate oggi(TODAY); | ||||
|     TLocalisamfile pasplan(LF_LVPASPLAN); | ||||
| 
 | ||||
|     TString query; | ||||
|     query << "USE LVCONDV SELECT LVPASPLAN->NRIGA!=1" | ||||
|          <<  "\nJOIN LVPASPLAN INTO CODCF==CODCF CODCONT==CODCONT NRIGA==1"; | ||||
|     TISAM_recordset contratti(query); | ||||
| 
 | ||||
|     TProgind pi(contratti.items(), title()); | ||||
|     TLog_report log; | ||||
| 
 | ||||
|     for (bool ok = contratti.move_first(); ok; ok = contratti.move_next()) | ||||
|     { | ||||
|       if (!pi.addstatus(1)) | ||||
|         break; | ||||
|       const TDate datasc = contratti.get(LVCONDV_DATASC).as_date(); | ||||
|       if (datasc.ok() && datasc < oggi) | ||||
|         continue; | ||||
| 
 | ||||
|       int nriga = 1; | ||||
|       for (int day = 0; day < 7; day++) if (msk.get_bool(F_LUNEDI+day)) | ||||
|       { | ||||
|         if (nriga == 1) | ||||
|         { | ||||
|           TString msg; | ||||
| 
 | ||||
|           TString8 cod; cod.format("%06ld", contratti.get(LVCONDV_CODCF).as_int()); | ||||
|           msg << TR("Contratto ") << cod << '/' << contratti.get(LVCONDV_CODCONT);         | ||||
|           cod.insert("C|"); | ||||
|           msg << " - " << cache().get(LF_CLIFO, cod, CLI_RAGSOC); | ||||
|           log.log(0, msg); | ||||
|         } | ||||
|          | ||||
|         pasplan.zero(); | ||||
|         pasplan.put(LVPASPLAN_CODCF,   contratti.get(LVCONDV_CODCF).as_int()); | ||||
|         pasplan.put(LVPASPLAN_CODCONT, contratti.get(LVCONDV_CODCONT).as_int()); | ||||
|         pasplan.put(LVPASPLAN_NRIGA,   nriga++); | ||||
|         pasplan.put(LVPASPLAN_CODITI,  msk.get(F_ITINERARIO)); | ||||
|         pasplan.put(LVPASPLAN_FREQ,    msk.get(F_FREQUENZA)); | ||||
|         pasplan.put(LVPASPLAN_MODPASS, msk.get(F_CONSEGNA)); | ||||
|         pasplan.put(LVPASPLAN_GGCONS,  day+1); | ||||
|          | ||||
|         const int err = pasplan.write(); | ||||
|         if (err != NOERR) | ||||
|         { | ||||
|           cantwrite_box(pasplan.description()); | ||||
|           log.log(2, TR("Errore di scrittura sul file LVPASPLAN")); | ||||
|           contratti.move_last(); | ||||
|           break; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     log.preview(); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| int lv2A00(int argc, char* argv[]) | ||||
| { | ||||
|   TAutogiro_app app; | ||||
|   app.run(argc, argv, TR("Generazione automatica giri")); | ||||
|   return 0; | ||||
| } | ||||
							
								
								
									
										10
									
								
								lv/lv2a00a.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								lv/lv2a00a.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | ||||
| #define F_ITINERARIO 101 | ||||
| #define F_FREQUENZA  102 | ||||
| #define F_CONSEGNA   103 | ||||
| #define F_LUNEDI     111 | ||||
| #define F_MARTEDI    112 | ||||
| #define F_MERCOLEDI  113 | ||||
| #define F_GIOVEDI    114 | ||||
| #define F_VENERDI    115 | ||||
| #define F_SABATO     116 | ||||
| #define F_DOMENICA   117 | ||||
							
								
								
									
										95
									
								
								lv/lv2a00a.uml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								lv/lv2a00a.uml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,95 @@ | ||||
| #include "lv2a00a.h" | ||||
| 
 | ||||
| PAGE "Generazione automatica giri" -1 -1 53 9 | ||||
| 
 | ||||
| GROUPBOX DLG_NULL 50 3 | ||||
| BEGIN | ||||
|   PROMPT 1 0 "@bParametri standard per contratti privi di giri" | ||||
| END | ||||
| 
 | ||||
| STRING F_ITINERARIO 3 | ||||
| BEGIN | ||||
|   PROMPT 2 1 "Itinerario " | ||||
|   USE &ITI | ||||
|   JOIN &AUT TO &ITI ALIAS 1000 INTO CODTAB==S1 | ||||
|   JOIN &MEZ TO &ITI ALIAS 2000 INTO CODTAB==S2 | ||||
|   INPUT CODTAB F_ITINERARIO | ||||
|   DISPLAY "Codice" CODTAB | ||||
|   DISPLAY "Descrizione@50" S0 | ||||
|   DISPLAY "Autista" S1 | ||||
|   DISPLAY "Descrizione Autista@50" 1000@->S0 | ||||
|   DISPLAY "Targa@8" S2 | ||||
|   DISPLAY "Descrizione Mezzo@50" 2000@->S0 | ||||
|   OUTPUT F_ITINERARIO CODTAB | ||||
|   FLAGS "UZ" | ||||
|   CHECKTYPE REQUIRED | ||||
| END | ||||
| 
 | ||||
| NUMBER F_FREQUENZA 2 | ||||
| BEGIN | ||||
|   PROMPT 25 1 "Frequenza  " | ||||
|   USE &FRQ | ||||
|   INPUT CODTAB F_FREQUENZA | ||||
|   DISPLAY "Codice" CODTAB | ||||
|   DISPLAY "Descrizione@50" S0 | ||||
|   OUTPUT F_FREQUENZA CODTAB | ||||
|   CHECKTYPE REQUIRED | ||||
|   FLAGS "UZ" | ||||
| END | ||||
| 
 | ||||
| RADIOBUTTON F_CONSEGNA 50 | ||||
| BEGIN | ||||
|   PROMPT 1 3 "@bModalità di consegna" | ||||
|   ITEM "C|Consegna" | ||||
|   ITEM "R|Ritiro" | ||||
|   ITEM "E|Entrambi" | ||||
|   FLAGS "Z" | ||||
| END | ||||
| 
 | ||||
| GROUPBOX DLG_NULL 50 3 | ||||
| BEGIN | ||||
|   PROMPT 1 6 "@bGiorni di passaggio" | ||||
| END | ||||
| 
 | ||||
| BOOLEAN F_LUNEDI | ||||
| BEGIN | ||||
|   PROMPT 2 7 "Lun" | ||||
| END | ||||
| 
 | ||||
| BOOLEAN F_MARTEDI | ||||
| BEGIN | ||||
|   PROMPT 9 7 "Mar" | ||||
| END | ||||
| 
 | ||||
| BOOLEAN F_MERCOLEDI | ||||
| BEGIN | ||||
|   PROMPT 16 7 "Mer" | ||||
| END | ||||
| 
 | ||||
| BOOLEAN F_GIOVEDI | ||||
| BEGIN | ||||
|   PROMPT 23 7 "Gio" | ||||
| END | ||||
| 
 | ||||
| BOOLEAN F_VENERDI | ||||
| BEGIN | ||||
|   PROMPT 30 7 "Ven" | ||||
| END | ||||
| 
 | ||||
| BOOLEAN F_SABATO | ||||
| BEGIN | ||||
|   PROMPT 37 7 "Sab" | ||||
| END | ||||
| 
 | ||||
| BOOLEAN F_DOMENICA | ||||
| BEGIN | ||||
|   PROMPT 43 7 "Dom" | ||||
| END | ||||
| 
 | ||||
| ENDPAGE | ||||
| 
 | ||||
| TOOLBAR "topbar" 0 0 0 2 | ||||
| #include "elabar.h" | ||||
| END | ||||
| 
 | ||||
| ENDMASK | ||||
| @ -11,7 +11,7 @@ int main(int argc, char** argv) | ||||
|   case  1: lv3200(argc, argv); break; // evasione buoni di prelievo            lv3200
 | ||||
|   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  4: lv3500(argc, argv); break; // sitauzione a mag. di un art.          lv3500
 | ||||
|   case  4: lv3500(argc, argv); break; // situazione a mag. di un art.          lv3500
 | ||||
|   case  5: lv3600(argc, argv); break; // invio dati a contapezzi Montanari     lv3600
 | ||||
|   case  6: lv3700(argc, argv); break; // inventario da terminale               lv3700
 | ||||
|   case  7: lv3800(argc, argv); break; // invio dati a contapezzi Skema         lv3800
 | ||||
|  | ||||
| @ -23,8 +23,8 @@ | ||||
| //Definizione della classe della maschera
 | ||||
| class TGestione_bolle_msk : public TDocumento_mask | ||||
| { | ||||
|   long      _stcodcf; | ||||
|   long      _stcodcont; | ||||
|   long _stcodcf, _stcodcont; | ||||
|   int  _autoselect; | ||||
| 
 | ||||
| protected:   | ||||
|   static void arrotonda(const TMask& msk, real& quantita); | ||||
| @ -48,17 +48,15 @@ protected: | ||||
| 
 | ||||
|   virtual void on_idle(); | ||||
| 
 | ||||
| 
 | ||||
| public: | ||||
|   virtual void user_set_handler( short fieldid, int index); | ||||
|   virtual void user_set_row_handler(TMask& rm, short field, int index); | ||||
|   void reset_var_mask() {_stcodcf = 0; _stcodcont = 0;} | ||||
|   void reset_var_mask() { _stcodcf = _stcodcont = 0; } | ||||
|   TDate proponi_dataprco() const; | ||||
|   TString8 proponi_autista() const; | ||||
|   void reset_autoselect() { _autoselect = 0; } | ||||
| 
 | ||||
|   TGestione_bolle_msk(const char* tipodoc); | ||||
| 
 | ||||
|   int     _autoselect; | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
|                             //////////////////////////////////////////
 | ||||
| @ -79,7 +77,7 @@ protected: | ||||
|   virtual void init_modify_mode( TMask& m ); | ||||
| 
 | ||||
|   void elimina_vuote( const TMask& m); | ||||
|   void salva_conguaglio( const TMask& m); | ||||
|   void salva_conguaglio( const TDocumento_mask& m); | ||||
|   void date_dotmp( const TMask& m); | ||||
| 
 | ||||
|   virtual const char * query_mask_name() { return "lv3100a"; } | ||||
| @ -604,7 +602,7 @@ bool TGestione_bolle_msk::lv_bolla_handler(TMask_field& f, KEY k) | ||||
|         f->on_hit(); | ||||
|     } | ||||
| 		dmsk.highlight(); | ||||
|     dmsk._autoselect = 0; | ||||
|     dmsk.reset_autoselect(); | ||||
|   } | ||||
|   return ok; | ||||
| } | ||||
| @ -787,7 +785,7 @@ bool TGestione_bolle_msk::lv_codart_handler(TMask_field& f, KEY k) | ||||
|       if (k == K_ENTER && rcont.get_int(LVRCONDV_CALCCONS) == 1) | ||||
|       { | ||||
|         TSheet_field* sheet = msk.get_sheet(); | ||||
|         TRiga_documento rdoc = dmsk.doc()[sheet->selected()+1]; | ||||
|         const TRiga_documento& rdoc = dmsk.doc()[sheet->selected()+1]; | ||||
| 
 | ||||
|         const real ritor = rdoc.get_real(RDOC_QTAGG4); | ||||
|         const real conor = rdoc.get_real(RDOC_QTAGG3); | ||||
| @ -802,7 +800,6 @@ bool TGestione_bolle_msk::lv_codart_handler(TMask_field& f, KEY k) | ||||
|         if (cau.movcong() && (ritor != ritat || conor != conat) && ini_get_bool(CONFIG_DITTA, "lv", "Aggcong")) | ||||
|         { | ||||
|           const real congor = rcont.get_real(LVRCONDV_QTACONG); | ||||
| 
 | ||||
|           const real congat = conat - conor - ritat + ritor + congor; | ||||
| 
 | ||||
| 					msk.set(FR_QTAGG5, congat); | ||||
| @ -1325,17 +1322,15 @@ void TGestione_bolle_app::elimina_vuote( const TMask& m) | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void TGestione_bolle_app::salva_conguaglio( const TMask& m) | ||||
| void TGestione_bolle_app::salva_conguaglio(const TDocumento_mask& mask) | ||||
| { | ||||
| 	if (ini_get_bool(CONFIG_DITTA, "lv", "Aggcong")) | ||||
| 	{ | ||||
| 		TDocumento_mask& mask = (TDocumento_mask&) m; | ||||
| 		TDocumento& d = mask.doc(); | ||||
| 		const TDocumento& d = mask.doc(); | ||||
| 
 | ||||
| 		TSheet_field& sheet = mask.sfield(F_SHEET); | ||||
| 		const long codcf = mask.get_long(F_CODCF); | ||||
| 		const int indsped = mask.get_int(F_CODINDSP); | ||||
| 		TDate datadoc = mask.get_date(F_DATADOC); | ||||
| 		const TDate datadoc = mask.get_date(F_DATADOC); | ||||
| 
 | ||||
| 		const TLaundry_contract cont(codcf, indsped, datadoc); | ||||
| 		const int codcont = cont.get_int(LVCONDV_CODCONT); | ||||
| @ -1345,17 +1340,25 @@ void TGestione_bolle_app::salva_conguaglio( const TMask& m) | ||||
| 		FOR_EACH_DOC_ROW_BACK(d, r, row) | ||||
| 		{ | ||||
| 			TRiga_documento& rdoc = (TRiga_documento&)*row; | ||||
| 			rcondv.put(LVRCONDV_CODCF,codcf); | ||||
| 			rcondv.put(LVRCONDV_CODCONT, codcont); | ||||
| 			rcondv.put(LVRCONDV_CODART, rdoc.get(RDOC_CODART)); | ||||
| 			if (rcondv.read() == NOERR) | ||||
| 				rcondv.put(LVRCONDV_QTACONG, rdoc.get_real(RDOC_QTAGG5)); | ||||
| 
 | ||||
|       const TCausale_lavanderie cau(rdoc.get(RDOC_CODAGG1)); | ||||
|       if (cau.movcong()) | ||||
|       { | ||||
| 			  rcondv.put(LVRCONDV_CODCF, codcf); | ||||
| 			  rcondv.put(LVRCONDV_CODCONT, codcont); | ||||
| 			  rcondv.put(LVRCONDV_CODART, rdoc.get(RDOC_CODART)); | ||||
| 			  if (rcondv.read() == NOERR) | ||||
|         { | ||||
| 				  rcondv.put(LVRCONDV_QTACONG, rdoc.get_real(RDOC_QTAGG5)); | ||||
|     		  rcondv.rewrite(); | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
| 			const real ritat = rdoc.get_real(RDOC_QTAGG1); | ||||
|       const real conat = rdoc.get_real(RDOC_QTA); | ||||
| 			rdoc.put(RDOC_QTAGG4, ritat); | ||||
| 			rdoc.put(RDOC_QTAGG3, conat); | ||||
| 		}   | ||||
| 		rcondv.rewrite(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| @ -1434,7 +1437,7 @@ int TGestione_bolle_app::write( const TMask& m ) | ||||
| {    | ||||
|   elimina_vuote(m); | ||||
| 
 | ||||
|   salva_conguaglio(m); | ||||
|   salva_conguaglio((TDocumento_mask&)m); | ||||
| 
 | ||||
|   date_dotmp(m); | ||||
| 	 | ||||
| @ -1446,7 +1449,7 @@ int TGestione_bolle_app::rewrite( const TMask& m ) | ||||
| { | ||||
|   elimina_vuote(m); | ||||
|    | ||||
|   salva_conguaglio(m); | ||||
|   salva_conguaglio((TDocumento_mask&)m); | ||||
| 
 | ||||
|   date_dotmp(m); | ||||
| 
 | ||||
| @ -1474,7 +1477,7 @@ int TGestione_bolle_app::read(TMask& m) | ||||
|       //real dotmp = _giac.giac_att(rdoc, false);
 | ||||
|     } | ||||
|     mask.doc2mask(); | ||||
|     mask._autoselect = 0; | ||||
|     mask.reset_autoselect(); | ||||
|   } | ||||
| 
 | ||||
|   return err; | ||||
|  | ||||
							
								
								
									
										247
									
								
								lv/lv3200.cpp
									
									
									
									
									
								
							
							
						
						
									
										247
									
								
								lv/lv3200.cpp
									
									
									
									
									
								
							| @ -42,7 +42,7 @@ protected: | ||||
|   void riordina_righe(); | ||||
|   void genera_documento(); | ||||
|   void evadi_tutto(); | ||||
|   int arrotonda(const int quantita); | ||||
|   int arrotonda(const TString& codart, const int quantita); | ||||
|   void spezza_riga(); | ||||
|   void salva(); | ||||
|   void annulla_operazioni(); | ||||
| @ -392,7 +392,7 @@ void TEvasione_msk::genera_documento() | ||||
|   const TString80 iban   = clifo.get(CLI_IBAN); | ||||
|     | ||||
|   //reupero la cuasale di magazzino di testata
 | ||||
|   const TString16 causmag = cache().get("%TIP", tipodoc, "S9"); | ||||
|   const TString8 causmag = cache().get("%TIP", tipodoc, "S9"); | ||||
| 
 | ||||
|   //recupero i dati di interesse dal file CFVEN  
 | ||||
|   const TRectype& cfven = cache().get(LF_CFVEN, key); | ||||
| @ -546,7 +546,7 @@ void TEvasione_msk::genera_documento() | ||||
|     rdoc.put(RDOC_CHECKED,'X'); | ||||
|     rdoc.put(RDOC_GENERATA, true); | ||||
| 
 | ||||
|     if(descr.len() <= 50) | ||||
|     if (descr.len() <= 50) | ||||
|       rdoc.put(RDOC_DESCR, descr); | ||||
|     else | ||||
|     { | ||||
| @ -557,22 +557,29 @@ void TEvasione_msk::genera_documento() | ||||
| 
 | ||||
|     rdoc.put(RDOC_QTA, rbpre.qta_consegnata());   //consegnato
 | ||||
|     rdoc.put(RDOC_QTAGG1, rbpre.qta_ritirata());  //ritirato
 | ||||
| 
 | ||||
|     dotod += (rbpre.qta_consegnata() - rbpre.qta_ritirata()); | ||||
|     const real diff = rbpre.qta_consegnata() - rbpre.qta_ritirata(); | ||||
|      | ||||
|     dotod += diff; | ||||
|     rdoc.put("DOTOD", dotod);     | ||||
| 
 | ||||
|     bool dtmp = false; | ||||
|     if (datagen >= rcont.get_date(LVRCONDV_INDTTMP) && datagen <= rcont.get_date(LVRCONDV_FIDTTMP)) | ||||
|       dtmp = true; | ||||
| 
 | ||||
|     if(dtmp) | ||||
|     { | ||||
|       rdoc.put("DOTMP", dottmp); | ||||
|       rdoc.add("DOTMP", rbpre.qta_consegnata() - rbpre.qta_ritirata()); | ||||
|     } | ||||
|     const bool dtmp = datagen >= rcont.get_date(LVRCONDV_INDTTMP) && datagen <= rcont.get_date(LVRCONDV_FIDTTMP); | ||||
|     if (dtmp) | ||||
|       rdoc.put("DOTMP", dottmp + diff); | ||||
|      | ||||
|     const TCausale_lavanderie cau(rbpre.causale()); | ||||
|     rdoc.put(RDOC_CODAGG1, cau.codice()); | ||||
|      | ||||
|     // Aggiorna conguaglio su contratto se necessario 26-04-2012
 | ||||
|     if (!diff.is_zero() && cau.movcong() && ini_get_bool(CONFIG_DITTA, "lv", "Aggcong")) | ||||
|     { | ||||
|       real cong = rcont.get(LVRCONDV_QTACONG); | ||||
|       cong += diff; | ||||
|       rdoc.put(RDOC_QTAGG5, cong);   | ||||
| 
 | ||||
|       TLocalisamfile rcondv(LF_LVRCONDV); | ||||
|       ((TRectype&)rcont).put(LVRCONDV_QTACONG, cong); | ||||
|       rcont.rewrite(rcondv); | ||||
|     } | ||||
| 
 | ||||
|     const TRectype& anamag = cache().get(LF_ANAMAG, codart); | ||||
|     //gestione prezzo
 | ||||
| @ -592,8 +599,8 @@ void TEvasione_msk::genera_documento() | ||||
|     rdoc.put(RDOC_CODIVA, anamag.get(ANAMAG_CODIVA)); | ||||
|    | ||||
|     //scrivo il magazzino
 | ||||
|     TCausale_magazzino rit(cau.causale_ritiro()); | ||||
|     TCausale_magazzino con(cau.causale_consegna()); | ||||
|     const TCausale_magazzino rit(cau.causale_ritiro()); | ||||
|     const TCausale_magazzino con(cau.causale_consegna()); | ||||
| 
 | ||||
|     TString8 magazzino; | ||||
|     TString8 magazzinoc; | ||||
| @ -630,7 +637,7 @@ void TEvasione_msk::genera_documento() | ||||
|       if (!rbpre.evaso()) | ||||
|         continue; | ||||
| 
 | ||||
|       TDoc_key kbuono = rbpre.rifbcon(); | ||||
|       const TDoc_key kbuono = rbpre.rifbcon(); | ||||
|       if (kbuono.full()) | ||||
|         continue; | ||||
| 
 | ||||
| @ -639,9 +646,10 @@ void TEvasione_msk::genera_documento() | ||||
|       rbpre.set_rifbcon(rifbcon); | ||||
|     } | ||||
| 
 | ||||
|     if(controlla()) | ||||
|     if (controlla()) | ||||
|     { | ||||
|       const TString4 stato = cache().get("%TIP", ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_PRE", NULL, 0), "S2").mid(2,1); | ||||
|       const TString4 tipo = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_PRE", NULL, 0); | ||||
|       const TString4 stato = cache().get("%TIP", tipo, "S2").mid(2,1); | ||||
|       bpre.put(DOC_STATO, stato); | ||||
|       set(F_STATO, stato); | ||||
|     } | ||||
| @ -650,7 +658,7 @@ void TEvasione_msk::genera_documento() | ||||
| 
 | ||||
|   if (err == NOERR) | ||||
|   { | ||||
|     if (yesno_box(TR("Il documento è stato generato; si desiderla stamparlo?"))) | ||||
|     if (yesno_box(TR("Il documento è stato generato.\nSi desiderla stamparlo?"))) | ||||
|     { | ||||
|       //stampa automatica
 | ||||
|       TString80 str; | ||||
| @ -680,17 +688,15 @@ void TEvasione_msk::evadi_tutto() | ||||
|   genera_documento(); | ||||
| } | ||||
| 
 | ||||
| int TEvasione_msk::arrotonda(const int quantita) | ||||
| int TEvasione_msk::arrotonda(const TString& codart, const int quantita) | ||||
| { | ||||
|   int perarr = ini_get_int(CONFIG_DITTA, "lv", "Perarr"); | ||||
|   int qta = quantita; | ||||
|    | ||||
|   const TString& codart = get(FR_CODART); | ||||
|   //instanzio una cache sulla tabella del magazzino
 | ||||
|   const TRectype& anamag = cache().get(LF_ANAMAG,codart); | ||||
|   //recupero i dati di interesse dall'anagrafica di magazzino
 | ||||
|   const long ppconf = anamag.get_long(ANAMAG_PPCONF); | ||||
|   if (ppconf > 0) | ||||
|   if (ppconf > 1) | ||||
|   { | ||||
|     //recupero dal documento i dati di interesse per recuperare...
 | ||||
|     //...i dati dalla riga contratto
 | ||||
| @ -703,15 +709,13 @@ int TEvasione_msk::arrotonda(const int quantita) | ||||
|     //recupero i dati di interesse dalla riga del contratto
 | ||||
|     if (rcont.get_int(LVRCONDV_CALCCONS) == 1) | ||||
|     { | ||||
|       const int perarr = ini_get_int(CONFIG_DITTA, "lv", "Perarr"); | ||||
|       //calcolo di quanti pezzi sforo
 | ||||
|       long arr = quantita % ppconf; | ||||
|       const long arr = quantita % ppconf; | ||||
| 
 | ||||
|       //calcolo quanti pezzi in più o in meno gli devo dare e aggiorno la quantità
 | ||||
|       if (arr > ppconf * perarr / 100)  //arr <= ppconf*perarr/100 -> formula calcolo congualgio di Tassan
 | ||||
|       { | ||||
|         arr = ppconf - arr; | ||||
|         qta += arr;       | ||||
|       } | ||||
|         qta += ppconf - arr;       | ||||
|       else | ||||
|         qta -= arr;     | ||||
|     } | ||||
| @ -735,8 +739,9 @@ void TEvasione_msk::spezza_riga() | ||||
|       int idriga2 = riga2.get_int(sheet.cid2index(S_NROW)); | ||||
|       idriga2 *= -1; | ||||
| 
 | ||||
|       //scrivi le quantità sulla seconda riga      
 | ||||
|       const int dacons2 = arrotonda(riga2.get_int(sheet.cid2index(S_RITIRATO)) - riga2.get_int(sheet.cid2index(S_CONSEGNATO))); | ||||
|       //scrivi le quantità sulla seconda riga 
 | ||||
|       const TString80 codart = riga1->get(sheet.cid2index(S_CODART)); | ||||
|       const int dacons2 = arrotonda(codart, riga2.get_int(sheet.cid2index(S_RITIRATO)) - riga2.get_int(sheet.cid2index(S_CONSEGNATO))); | ||||
|       riga2.add(dacons2, sheet.cid2index(S_RITIRATO)); | ||||
|       riga2.add(dacons2, sheet.cid2index(S_DACONS)); | ||||
|       riga2.add(0L, sheet.cid2index(S_CONSEGNATO)); | ||||
| @ -777,7 +782,7 @@ void TEvasione_msk::salva() | ||||
|     const int rowid = riga->get_int(sheet.cid2index(S_NROW)); | ||||
|     const TRiga_documento* riori = doc.get_row_id(abs(rowid)); | ||||
|     int nriga = riori ? riori->get_int(RDOC_NRIGA) : -1; | ||||
|     if (rowid < 0) | ||||
|     if (nriga <= 0) | ||||
|     { | ||||
|       TRiga_documento& row = doc.new_row("24"); | ||||
|       if (riori != NULL) | ||||
| @ -787,11 +792,7 @@ void TEvasione_msk::salva() | ||||
|     TBuono_prelievo_row rdoc(doc[nriga]); | ||||
| 
 | ||||
|     const char flgev = riga->get(sheet.cid2index(S_EVASO))[0]; | ||||
|     bool flag; | ||||
|     if (flgev == 'X') | ||||
|       flag = true; | ||||
|     else | ||||
|       flag = false; | ||||
|     const bool flag = flgev == 'X'; | ||||
| 
 | ||||
|     const TString80 codart = riga->get(sheet.cid2index(S_CODART)); | ||||
| 
 | ||||
| @ -860,7 +861,7 @@ void TEvasione_msk::salva() | ||||
|     magazzino  << ini_get_string(CONFIG_DITTA, "lv", "CODMAG") << ini_get_string(CONFIG_DITTA, "lv", "CODMAGP"); | ||||
| 
 | ||||
|     TEsercizi_contabili es;     | ||||
|     int annoes = es.date2esc(datadoc); | ||||
|     const int annoes = es.date2esc(datadoc); | ||||
| 
 | ||||
|     TMov_mag movmag(++nummov); | ||||
|     movmag.put(MOVMAG_ANNOES, annoes); | ||||
| @ -888,7 +889,6 @@ void TEvasione_msk::salva() | ||||
|       TRectype& rmovmag = movmag.new_row(); | ||||
|       rmovmag.put(RMOVMAG_CODMAG, magazzino); | ||||
|       rmovmag.put(RMOVMAG_CODART, codart); | ||||
| 
 | ||||
|       rmovmag.put(RMOVMAG_UM, um); | ||||
|       rmovmag.put(RMOVMAG_QUANT, qta); | ||||
|     } | ||||
| @ -1027,7 +1027,7 @@ void TEvasione_msk::evadi_da_barcode() | ||||
| 
 | ||||
|         if (scodart == codart) | ||||
|         { | ||||
| 		      if (yesno_box(TR("ATTENZIONE: il pacco risulta già conteggato; si desidera annularlo?"))) | ||||
| 		      if (yesno_box(TR("ATTENZIONE: il pacco risulta già conteggato!\nSi desidera annularlo?"))) | ||||
| 		      { | ||||
| 		        int qtadacon = riga->get_int(sheet.cid2index(S_DACONS)); | ||||
|             int pacchi = riga->get_int(pospa);  pacchi -= 1; | ||||
| @ -1140,134 +1140,117 @@ bool TEvasione_msk::on_field_event(TOperable_field& f, TField_event e, long joll | ||||
|   switch (f.dlg()) | ||||
|   { | ||||
|   case DLG_SELECT: | ||||
|     { | ||||
|       if (e == fe_button) | ||||
|         evadi_tutto(); | ||||
|     } | ||||
|     if (e == fe_button) | ||||
|       evadi_tutto(); | ||||
|     break; | ||||
|   case DLG_PREVIEW: | ||||
|     { | ||||
|     if (e == fe_button) | ||||
|       riordina_righe(); | ||||
|     } | ||||
|     break; | ||||
|   case DLG_ELABORA: | ||||
|     if (e == fe_button) | ||||
|     { | ||||
|       if (e == fe_button) | ||||
|         if (controlla()) | ||||
|           genera_documento(); | ||||
|         else | ||||
|       if (controlla()) | ||||
|         genera_documento(); | ||||
|       else | ||||
|       { | ||||
|         if (yesno_box(TR("ATTENZIONE: non tutte le righe sono evase.\nSi desidera continuare ugualmente?"))) | ||||
|         { | ||||
|           if(yesno_box(TR("ATTENZIONE: non tutte le righe sono evase. Si desidera continuare ugualmente?"))) | ||||
|           { | ||||
|             if(yesno_box(TR("Si desidera considerare evase tutte le righe?" | ||||
|                             "(in caso contrario le righe evase parzialmente verranno spezzate su due righe)"))) | ||||
|               evadi_tutto(); | ||||
|             else | ||||
|             { | ||||
|               spezza_riga(); | ||||
|               genera_documento(); | ||||
|             } | ||||
|           } | ||||
|           if (yesno_box(TR("Si desidera considerare evase tutte le righe?\n" | ||||
|                           "(in caso contrario le righe evase parzialmente verranno spezzate su due righe)"))) | ||||
|             evadi_tutto(); | ||||
|           else | ||||
|             riordina_righe(); | ||||
|           { | ||||
|             spezza_riga(); | ||||
|             genera_documento(); | ||||
|           } | ||||
|         } | ||||
|         else | ||||
|           riordina_righe(); | ||||
|       } | ||||
|     } | ||||
|     break; | ||||
|   case DLG_SAVEREC: | ||||
|     { | ||||
|       if (e == fe_button) | ||||
|         salva(); | ||||
|     } | ||||
|     if (e == fe_button) | ||||
|       salva(); | ||||
|     break; | ||||
|   case DLG_CANCEL: | ||||
|     if (e ==  fe_button && jolly == 0) | ||||
|     { | ||||
|       if (e ==  fe_button && jolly == 0) | ||||
|       { | ||||
|         annulla_operazioni(); | ||||
|         return false; | ||||
|       } | ||||
|       annulla_operazioni(); | ||||
|       return false; | ||||
|     } | ||||
|     break; | ||||
|   case F_NDOC:     | ||||
|     if (e == fe_modify) | ||||
|     { | ||||
|       if (e == fe_modify) | ||||
|         if (f.get_long() > 0) | ||||
|           carica_righe();         | ||||
|         else | ||||
|         { | ||||
|           sfield(F_RIGHE).destroy(); | ||||
|           disable(DLG_SELECT); | ||||
|           disable(DLG_PREVIEW); | ||||
|           disable(DLG_ELABORA); | ||||
|           disable(DLG_SAVEREC); | ||||
|           disable(DLG_CANCEL); | ||||
|           reset(F_STATO); | ||||
|           reset(F_DATADOC);  setta_campi_data(); | ||||
|           reset(F_CODCF);    setta_campi_cliente(); | ||||
|           hide(F_RIGHE); | ||||
|         }          | ||||
|       if (f.get_long() > 0) | ||||
|         carica_righe();         | ||||
|       else | ||||
|       { | ||||
|         sfield(F_RIGHE).destroy(); | ||||
|         disable(DLG_SELECT); | ||||
|         disable(DLG_PREVIEW); | ||||
|         disable(DLG_ELABORA); | ||||
|         disable(DLG_SAVEREC); | ||||
|         disable(DLG_CANCEL); | ||||
|         reset(F_STATO); | ||||
|         reset(F_DATADOC);  setta_campi_data(); | ||||
|         reset(F_CODCF);    setta_campi_cliente(); | ||||
|         hide(F_RIGHE); | ||||
|       }          | ||||
|     } | ||||
|     break; | ||||
|   case F_DATADOC: | ||||
|     { | ||||
|       if (e == fe_modify) | ||||
|         setta_campi_data();       | ||||
|     } | ||||
|     if (e == fe_modify) | ||||
|       setta_campi_data();       | ||||
|     break; | ||||
|   case F_CODCF: | ||||
|     { | ||||
|       if (e == fe_modify) | ||||
|         setta_campi_cliente(); | ||||
|     } | ||||
|     if (e == fe_modify) | ||||
|       setta_campi_cliente(); | ||||
|     break; | ||||
|   case F_BARCODE: | ||||
|     if (e == fe_modify && f.get().full()) | ||||
|     { | ||||
|       if (e == fe_modify && f.get().full()) | ||||
|       { | ||||
|         _autoselect = 1; | ||||
|         evadi_da_barcode(); | ||||
|         sfield(F_RIGHE).force_update(); | ||||
|       _autoselect = 1; | ||||
|       evadi_da_barcode(); | ||||
|       sfield(F_RIGHE).force_update(); | ||||
| 
 | ||||
|         if (controlla()) | ||||
|           send_key(K_SPACE, DLG_ELABORA);         | ||||
|       } | ||||
|       if (controlla()) | ||||
|         send_key(K_SPACE, DLG_ELABORA);         | ||||
|     } | ||||
|     break; | ||||
|   case S_CONSEGNATO: | ||||
|     if (e == fe_modify) | ||||
|     { | ||||
|       if (e == fe_modify) | ||||
|       TSheet_field& sheet = sfield(F_RIGHE); | ||||
|       TMask& msk = sheet.sheet_mask(); | ||||
|       //la riga risulta evasa se la quantità consegnata è maggiore o uguale alla quantità da consegnare
 | ||||
|       if(msk.get_long(S_CONSEGNATO) > msk.get_long(S_DACONS)) | ||||
|       { | ||||
|         TSheet_field& sheet = sfield(F_RIGHE); | ||||
|         TMask& msk = sheet.sheet_mask(); | ||||
|         //la riga risulta evasa se la quantità consegnata è maggiore o uguale alla quantità da consegnare
 | ||||
|         if(msk.get_long(S_CONSEGNATO) > msk.get_long(S_DACONS)) | ||||
|         { | ||||
|           warning_box(TR("ATTENZIONE: si sta consegnando un quantitativo maggiore al dovuto")); | ||||
|           msk.set(S_EVASO, "X"); | ||||
|           TToken_string& riga = sheet.row(sheet.selected()); | ||||
|           riga.add("X", sheet.cid2index(S_EVASO)); | ||||
|           sheet.disable_row(sheet.selected()); | ||||
|         } | ||||
|         else if (msk.get_long(S_CONSEGNATO) == msk.get_long(S_DACONS)) | ||||
|         { | ||||
|           msk.set(S_EVASO, "X"); | ||||
|           TToken_string& riga = sheet.row(sheet.selected()); | ||||
|           riga.add("X", sheet.cid2index(S_EVASO)); | ||||
|           sheet.disable_row(sheet.selected()); | ||||
|         } | ||||
|            | ||||
|         sistema_pacchi(); | ||||
| 
 | ||||
|         if (controlla()) | ||||
|           send_key(K_SPACE, DLG_ELABORA, &f); | ||||
|         warning_box(TR("ATTENZIONE: si sta consegnando un quantitativo maggiore al dovuto")); | ||||
|         msk.set(S_EVASO, "X"); | ||||
|         TToken_string& riga = sheet.row(sheet.selected()); | ||||
|         riga.add("X", sheet.cid2index(S_EVASO)); | ||||
|         sheet.disable_row(sheet.selected()); | ||||
|       } | ||||
|       else if (msk.get_long(S_CONSEGNATO) == msk.get_long(S_DACONS)) | ||||
|       { | ||||
|         msk.set(S_EVASO, "X"); | ||||
|         TToken_string& riga = sheet.row(sheet.selected()); | ||||
|         riga.add("X", sheet.cid2index(S_EVASO)); | ||||
|         sheet.disable_row(sheet.selected()); | ||||
|       } | ||||
|            | ||||
|       sistema_pacchi(); | ||||
| 
 | ||||
|       if (controlla()) | ||||
|         send_key(K_SPACE, DLG_ELABORA, &f); | ||||
|     } | ||||
|     break; | ||||
|   case S_PACCHI: | ||||
|     { | ||||
|       if (e == fe_modify) | ||||
|         sistema_quantita(); | ||||
|     } | ||||
|     if (e == fe_modify) | ||||
|       sistema_quantita(); | ||||
|     break; | ||||
|   default:break; | ||||
|   } | ||||
| @ -1276,7 +1259,7 @@ bool TEvasione_msk::on_field_event(TOperable_field& f, TField_event e, long joll | ||||
| } | ||||
| 
 | ||||
| //metodo costruttore che precarica i campi di interesse sulla maschera
 | ||||
| TEvasione_msk::TEvasione_msk():TAutomask("lv3200a")  | ||||
| TEvasione_msk::TEvasione_msk() : TAutomask("lv3200a")  | ||||
| { | ||||
|   //precarico i campi fissi
 | ||||
|   set(F_CODNUM, ini_get_string(CONFIG_DITTA, "lv", "NUM_PRE", NULL, 0)); | ||||
|  | ||||
| @ -78,7 +78,7 @@ protected: | ||||
|   virtual void init_modify_mode( TMask& m ); | ||||
| 
 | ||||
|   void elimina_vuote( const TMask& m); | ||||
|   void salva_conguaglio( const TMask& m); | ||||
|   bool salva_conguaglio( const TDocumento_mask& m); | ||||
|   void date_dotmp( const TMask& m); | ||||
|   virtual const char * query_mask_name() { return "lv3300a"; } | ||||
| 
 | ||||
| @ -97,7 +97,7 @@ inline TGestione_buoni_app& gbapp() { return (TGestione_buoni_app &)main_app(); | ||||
| //ARROTONDA: metodo che arrotonda la quantità che gli passo se è previsto sul contratto
 | ||||
| void TGestione_buoni_msk::arrotonda(const TMask& msk, real& quantita) | ||||
| { | ||||
|   int perarr = ini_get_int(CONFIG_DITTA, "lv", "Perarr"); | ||||
|   const int perarr = ini_get_int(CONFIG_DITTA, "lv", "Perarr"); | ||||
|    | ||||
|   const TString& codart = msk.get(FR_CODART); | ||||
|   //instanzio una cache sulla tabella del magazzino
 | ||||
| @ -106,7 +106,7 @@ void TGestione_buoni_msk::arrotonda(const TMask& msk, real& quantita) | ||||
|   const long ppconf = anamag.get_long(ANAMAG_PPCONF); | ||||
|   if (ppconf > 0) | ||||
|   { | ||||
|     TDocumento_mask& dmsk = (TDocumento_mask&) msk.get_sheet()->mask(); | ||||
|     TDocumento_mask& dmsk = (TDocumento_mask&)msk.get_sheet()->mask(); | ||||
|      | ||||
|     //recupero dal documento i dati di interesse per recuperare...
 | ||||
|     //...i dati dalla riga contratto
 | ||||
| @ -141,7 +141,7 @@ void TGestione_buoni_msk::arrotonda(const TMask& msk, real& quantita) | ||||
| void TGestione_buoni_msk::dettaglio_causale(TSheet_field& ss) | ||||
| { | ||||
|   TGestione_buoni_msk& dmsk = (TGestione_buoni_msk&) ss.mask(); | ||||
|   TString4 causale = ss.cell(ss.selected(),ss.cid2index(FR_CODAGG1)); | ||||
|   const TString4 causale = ss.cell(ss.selected(),ss.cid2index(FR_CODAGG1)); | ||||
| 
 | ||||
|   //instanzio una cache sulle causali
 | ||||
|   const TCausale_lavanderie cau(causale); | ||||
| @ -1276,38 +1276,47 @@ void TGestione_buoni_app::elimina_vuote( const TMask& m) | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void TGestione_buoni_app::salva_conguaglio( const TMask& m) | ||||
| bool TGestione_buoni_app::salva_conguaglio( const TDocumento_mask& mask) | ||||
| { | ||||
| 	if (ini_get_bool(CONFIG_DITTA, "lv", "Aggcong")) | ||||
|   if (!ini_get_bool(CONFIG_DITTA, "lv", "Aggcong")) | ||||
|     return false; | ||||
| 
 | ||||
| 	const TDocumento& d = mask.doc(); | ||||
| 
 | ||||
| 	TSheet_field& sheet = mask.sfield(F_SHEET); | ||||
| 	const long codcf = mask.get_long(F_CODCF); | ||||
| 	const int indsped = mask.get_int(F_CODINDSP); | ||||
| 	TDate datadoc = mask.get_date(F_DATADOC); | ||||
| 
 | ||||
| 	const TLaundry_contract cont(codcf, indsped, datadoc); | ||||
| 	const int codcont = cont.get_int(LVCONDV_CODCONT); | ||||
| 
 | ||||
| 	TLocalisamfile rcondv(LF_LVRCONDV); | ||||
| 
 | ||||
| 	FOR_EACH_DOC_ROW_BACK(d, r, row) | ||||
| 	{ | ||||
| 		TDocumento_mask& mask = (TDocumento_mask&) m; | ||||
| 		TDocumento& d = mask.doc(); | ||||
| 		TRiga_documento& rdoc = (TRiga_documento&)*row; | ||||
|      | ||||
|     const TCausale_lavanderie cau(rdoc.get(RDOC_CODAGG1)); | ||||
|     if (cau.movcong()) | ||||
|     { | ||||
|       rcondv.put(LVRCONDV_CODCF,codcf); | ||||
| 		  rcondv.put(LVRCONDV_CODCONT, codcont); | ||||
| 		  rcondv.put(LVRCONDV_CODART, rdoc.get(RDOC_CODART)); | ||||
| 		  if (rcondv.read() == NOERR) | ||||
|       { | ||||
| 			  rcondv.put(LVRCONDV_QTACONG, rdoc.get_real(RDOC_QTAGG5)); | ||||
|     	  rcondv.rewrite(); | ||||
|       } | ||||
|     } | ||||
| 		 | ||||
|     const real ritat = rdoc.get_real(RDOC_QTAGG1); | ||||
|     const real conat = rdoc.get_real(RDOC_QTA); | ||||
| 		rdoc.put(RDOC_QTAGG4, ritat); | ||||
| 		rdoc.put(RDOC_QTAGG3, conat); | ||||
| 	}   | ||||
| 
 | ||||
| 		TSheet_field& sheet = mask.sfield(F_SHEET); | ||||
| 		const long codcf = mask.get_long(F_CODCF); | ||||
| 		const int indsped = mask.get_int(F_CODINDSP); | ||||
| 		TDate datadoc = mask.get_date(F_DATADOC); | ||||
| 
 | ||||
| 		const TLaundry_contract cont(codcf, indsped, datadoc); | ||||
| 		const int codcont = cont.get_int(LVCONDV_CODCONT); | ||||
| 
 | ||||
| 		TLocalisamfile rcondv(LF_LVRCONDV); | ||||
| 
 | ||||
| 		FOR_EACH_DOC_ROW_BACK(d, r, row) | ||||
| 		{ | ||||
| 			TRiga_documento& rdoc = (TRiga_documento&)*row; | ||||
| 			rcondv.put(LVRCONDV_CODCF,codcf); | ||||
| 			rcondv.put(LVRCONDV_CODCONT, codcont); | ||||
| 			rcondv.put(LVRCONDV_CODART, rdoc.get(RDOC_CODART)); | ||||
| 			if (rcondv.read() == NOERR) | ||||
| 				rcondv.put(LVRCONDV_QTACONG, rdoc.get_real(RDOC_QTAGG5)); | ||||
| 			const real ritat = rdoc.get_real(RDOC_QTAGG1); | ||||
|       const real conat = rdoc.get_real(RDOC_QTA); | ||||
| 			rdoc.put(RDOC_QTAGG4, ritat); | ||||
| 			rdoc.put(RDOC_QTAGG3, conat); | ||||
| 		}   | ||||
| 		rcondv.rewrite(); | ||||
| 	} | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| void TGestione_buoni_app::date_dotmp( const TMask& m) | ||||
| @ -1318,7 +1327,7 @@ void TGestione_buoni_app::date_dotmp( const TMask& m) | ||||
| 	TSheet_field& sheet = mask.sfield(F_SHEET); | ||||
| 	const long codcf = mask.get_long(F_CODCF); | ||||
| 	const int indsped = mask.get_int(F_CODINDSP); | ||||
| 	TDate datadoc = mask.get_date(F_DATADOC); | ||||
| 	const TDate datadoc = mask.get_date(F_DATADOC); | ||||
| 
 | ||||
| 	const TLaundry_contract cont(codcf, indsped, datadoc); | ||||
| 	const int codcont = cont.get_int(LVCONDV_CODCONT); | ||||
| @ -1343,7 +1352,7 @@ void TGestione_buoni_app::date_dotmp( const TMask& m) | ||||
| 				const TDate da_data_contr = rcondv.get_date(LVRCONDV_INDTTMP); | ||||
| 				const TDate da_data_bolla = rdoc.get_date("DADATATMP"); | ||||
| 
 | ||||
|         if(da_data_contr > da_data_bolla) | ||||
|         if (da_data_contr > da_data_bolla) | ||||
| 				{ | ||||
|           rcondv.put(LVRCONDV_INDTTMP, da_data_bolla); | ||||
| 					to_write = true; | ||||
| @ -1369,7 +1378,7 @@ int TGestione_buoni_app::write( const TMask& m ) | ||||
| {    | ||||
|   elimina_vuote(m); | ||||
| 
 | ||||
|   salva_conguaglio(m); | ||||
|   salva_conguaglio((const TDocumento_mask&)m); | ||||
| 
 | ||||
|   date_dotmp(m); | ||||
| 
 | ||||
| @ -1381,7 +1390,7 @@ int TGestione_buoni_app::rewrite( const TMask& m ) | ||||
| { | ||||
|   elimina_vuote(m); | ||||
| 
 | ||||
|   salva_conguaglio(m); | ||||
|   salva_conguaglio((const TDocumento_mask&)m); | ||||
| 
 | ||||
|   date_dotmp(m); | ||||
| 
 | ||||
|  | ||||
| @ -108,6 +108,7 @@ Module  = 41 | ||||
| Flags   = "" | ||||
| Item_01 = "Generazione automatica", "lv2 -0", "F" | ||||
| Item_02 = "Gestione manuale", "lv2 -1", "F" | ||||
| Item_03 = "Generazione da contratti", "lv2 -9", "F" | ||||
| 
 | ||||
| [LVMENU_032] | ||||
| Caption = "Stampe" | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| #include "tctbtpg.h" | ||||
| #include "../tc/tctbtpg.h" | ||||
| 
 | ||||
| TOOLBAR "topbar" 0 0 0 2 | ||||
| #include <relapbar.h> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user