Corretta gestione rate in modifica e corretto calcolo Abbuoni
git-svn-id: svn://10.65.10.50/trunk@2353 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									10f904dd5a
								
							
						
					
					
						commit
						0da41d73fc
					
				| @ -23,7 +23,6 @@ typedef enum { no_descr, acquisto, vendita, incasso_pagamento, | ||||
| { | ||||
|   TRelation* _rel;           // Relazione principale
 | ||||
|   TLocalisamfile * _rcaus; | ||||
|   TTable  * _dpn; | ||||
|   TMask* _msk;               // Maschera principale
 | ||||
| 
 | ||||
|    | ||||
| @ -55,7 +54,7 @@ protected: | ||||
|   static bool sezione_hndl (TMask_field& f, KEY k); | ||||
|   static bool conto_hndl (TMask_field& f, KEY k); | ||||
|   static bool sottoconto_hndl (TMask_field& f, KEY k); | ||||
|   static bool codcausim_hndl (TMask_field& f, KEY k); | ||||
| //  static bool codcausim_hndl (TMask_field& f, KEY k);
 | ||||
|   static bool m770_hndl (TMask_field& f, KEY k); | ||||
|   static bool ss_notify (TSheet_field& s, int r, KEY k); | ||||
| 
 | ||||
| @ -379,6 +378,7 @@ bool TCaus_app::tipomov_hndl (TMask_field& f, KEY k) | ||||
|   return TRUE; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
| // Il codice causale per incasso immediato, se specificato, deve
 | ||||
| // essere puramente contabile (= codreg vuoto e tpm = Nessuno
 | ||||
| bool TCaus_app::codcausim_hndl (TMask_field& f, KEY k) | ||||
| @ -393,15 +393,14 @@ bool TCaus_app::codcausim_hndl (TMask_field& f, KEY k) | ||||
|     caus.put(CAU_CODCAUS, causim); | ||||
|     if (caus.read() == NOERR) | ||||
|     { | ||||
| //      const int tpm = caus.get_int(CAU_TIPOMOV);
 | ||||
|       const TString& codreg = caus.get(CAU_REG); | ||||
|       if (codreg.not_empty() /* || tpm != 0 */) | ||||
|       if (codreg.not_empty()) | ||||
|         return f.warning_box("La causale per l'incasso/pagamento immediato deve essere puramente contabile");  | ||||
|     } | ||||
|   } | ||||
|   return TRUE; | ||||
| } | ||||
| 
 | ||||
| */ | ||||
| 
 | ||||
| bool TCaus_app::mostra_campi() | ||||
| { | ||||
| @ -703,10 +702,11 @@ void TCaus_app::add_riga(int numrig, char sz, TConto& tc, const TString& d, cons | ||||
| void TCaus_app::load_rcaus(TMask& m) | ||||
| { | ||||
|   const TString16 cod(_rel->lfile().get(RCA_CODCAUS)); | ||||
|   TString16 d; | ||||
|   TString80 da;  | ||||
|   const int last = _rcaus_rec->last_row(); | ||||
|   TString d, da(50);  | ||||
|    | ||||
|   TTable dpn("%DPN"); | ||||
| 
 | ||||
|   const int last = _rcaus_rec->last_row(); | ||||
|   for (int i = 1; i <= last; i++) | ||||
|   {          | ||||
|     TRectype & r = _rcaus_rec->row(i, TRUE); | ||||
| @ -716,17 +716,16 @@ void TCaus_app::load_rcaus(TMask& m) | ||||
|     const int c   = r.get_int(RCA_CONTO); | ||||
|     const long s  = r.get_long(RCA_SOTTOCONTO); | ||||
|     d = r.get(RCA_CODDESC); | ||||
|      | ||||
|     da.cut(0); | ||||
|     if (d.not_empty()) | ||||
|     { | ||||
|       _dpn->put("CODTAB", d); | ||||
|       _dpn->read() ; | ||||
|       da = _dpn->get("S0"); | ||||
|     } else da.cut(0);   | ||||
|       dpn.put("CODTAB", d); | ||||
|       if (dpn.read() == NOERR) | ||||
|         da = dpn.get("S0"); | ||||
|     }  | ||||
| 
 | ||||
|     TConto tc(g,c,s,cf); | ||||
|     add_riga(i-1, sz, tc, d, da); | ||||
| 
 | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| @ -864,7 +863,6 @@ bool TCaus_app::user_create() | ||||
|   _rel = new TRelation (LF_CAUSALI); | ||||
|   //  _rel->add(LF_RCAUSALI, "CODCAUS=CODCAUS");
 | ||||
|   _rcaus = new TLocalisamfile(LF_RCAUSALI); | ||||
|   _dpn = new TTable("%DPN"); | ||||
| 
 | ||||
|   _rcaus_rec = new TRecord_array(LF_RCAUSALI, RCA_NRIGA); | ||||
| 
 | ||||
| @ -873,8 +871,8 @@ bool TCaus_app::user_create() | ||||
|    | ||||
|   _msk->set_handler(F_TIPO_DOC, tipodoc_hndl); | ||||
|   _msk->set_handler(F_COD_REG, cod_reg_hndl); | ||||
|   _msk->set_handler(F_COD_CAUS_IM, codcausim_hndl); | ||||
|   _msk->set_handler(F_M_770, m770_hndl); | ||||
| //  _msk->set_handler(F_COD_CAUS_IM, codcausim_hndl);
 | ||||
| 
 | ||||
|   TSheet_field& cs = ss(); | ||||
|   cs.set_notify(ss_notify); | ||||
| @ -892,16 +890,11 @@ bool TCaus_app::user_destroy() | ||||
|   delete _msk; | ||||
|   delete _rel; | ||||
|   delete _rcaus;     | ||||
|   delete _dpn; | ||||
|   delete _rcaus_rec; | ||||
|   return TRUE; | ||||
| } | ||||
| 
 | ||||
| #ifdef MAIN | ||||
| int main(int argc, char** argv) | ||||
| #else                                  | ||||
|   int cg0500(int argc, char* argv[]) | ||||
| #endif | ||||
| int cg0500(int argc, char* argv[]) | ||||
| { | ||||
|   TCaus_app a; | ||||
|   a.run(argc, argv, "Tabella causali"); | ||||
|  | ||||
| @ -186,8 +186,8 @@ SPREADSHEET F_SHEET_GCS | ||||
| BEGIN | ||||
|   PROMPT 0 7 "" | ||||
|   ITEM "Tipo conto@21F" | ||||
|   ITEM "D/A" | ||||
|   ITEM "C/F" | ||||
|   ITEM "D/A@1" | ||||
|   ITEM "C/F@1" | ||||
|   ITEM "Gr." | ||||
|   ITEM "Co." | ||||
|   ITEM "Sottoc.@6" | ||||
|  | ||||
| @ -135,7 +135,7 @@ BEGIN | ||||
|   GROUP 1 | ||||
| END | ||||
| 
 | ||||
| LISTBOX SS_SEZIONE 5 | ||||
| LISTBOX SS_SEZIONE 1 5 | ||||
| BEGIN | ||||
|   PROMPT 51 3 "Sezione " | ||||
|   HELP "Indicare la sezione del conto" | ||||
|  | ||||
| @ -98,8 +98,6 @@ TMask* TPrimanota_application::load_mask(int n) | ||||
|       m->set_handler(F_SOLAIVA, solaiva_handler); | ||||
|       m->set_handler(F_SHEETIVA, iva_handler); | ||||
|       m->set_handler(F_CODPAG, codpag_handler); | ||||
|       m->set_handler(SK_VALUTA, valuta_handler); | ||||
|       m->set_handler(SK_CAMBIO, cambio_handler); | ||||
|        | ||||
|       TSheet_field& is = (TSheet_field&)m->field(F_SHEETIVA); | ||||
|       is.set_notify(iva_notify); | ||||
| @ -140,8 +138,10 @@ TMask* TPrimanota_application::load_mask(int n) | ||||
|       m->set_handler(F_DESCR, descr_handler); | ||||
|       m->set_handler(F_CODCAUS, caus_modify_handler); | ||||
|       m->set_handler(F_TOTALE, totdoc_handler); | ||||
|       m->set_handler(SK_TOTDOCVAL, totdocval_handler); | ||||
|       m->set_handler(F_SHEETCG, cg_handler); | ||||
|       m->set_handler(SK_VALUTA, valuta_handler); | ||||
|       m->set_handler(SK_CAMBIO, cambio_handler); | ||||
|       m->set_handler(SK_TOTDOCVAL, totdocval_handler); | ||||
| 
 | ||||
|       TSheet_field& cg = (TSheet_field&)m->field(F_SHEETCG);                                                       | ||||
|       cg.set_notify(cg_notify); | ||||
| @ -708,9 +708,6 @@ int TPrimanota_application::read(TMask& m) | ||||
|   partite().destroy(); | ||||
|   if (is_fattura())                      // Ci sono scadenze
 | ||||
|   {                            | ||||
|     const TString16 cp(m.get(F_CODPAG)); | ||||
|     const TString16 dt(m.get(F_DATADOC)); | ||||
|     set_pagamento(cp, dt);    | ||||
|     if (!read_scadenze(m)) | ||||
|       set_scadenze(m); | ||||
|   } | ||||
|  | ||||
| @ -193,7 +193,7 @@ BEGIN | ||||
|   OUTPUT SK_VALUTA CODTAB | ||||
|   CHECKTYPE NORMAL | ||||
|   MESSAGE EMPTY CLEAR,SK_CAMBIO|CLEAR,SK_TOTDOCVAL | ||||
|   MESSAGE ENABLE,SK_CAMBIO|ENABLE,SK_TOTDOCVAL | ||||
|   MESSAGE ENABLE,SK_CAMBIO|ENABLE,SK_TOTDOCVAL|DIRTY,SK_DATACAMBIO|K_TAB,SK_DATACAMBIO | ||||
| END | ||||
| 
 | ||||
| DATE SK_DATACAMBIO | ||||
| @ -206,12 +206,11 @@ BEGIN | ||||
|   INPUT CODTAB[4,11] SK_DATACAMBIO | ||||
|   DISPLAY "Valuta" CODTAB[1,3] | ||||
|   DISPLAY "Data@10" D0 | ||||
|   DISPLAY "Cambio@18" R10    | ||||
|   OUTPUT SK_VALUTA CODTAB[1,3] | ||||
|   DISPLAY "Cambio@15" R10    | ||||
|   OUTPUT SK_DATACAMBIO D0 | ||||
|   OUTPUT SK_CAMBIO R10 | ||||
|   GROUP 3 5 | ||||
|   CHECKTYPE NORMAL | ||||
|   CHECKTYPE SEARCH | ||||
| END | ||||
| 
 | ||||
| NUMBER SK_CAMBIO 15 5 | ||||
|  | ||||
| @ -176,6 +176,7 @@ BEGIN | ||||
|   DISPLAY "Descrizione@50" S0 | ||||
|   OUTPUT F_DESCAGG CODTAB | ||||
|   OUTPUT F_DESCR S0 | ||||
|   CHECKTYPE NORMAL | ||||
| END | ||||
| 
 | ||||
| STRING F_DESCR 50 | ||||
|  | ||||
| @ -564,14 +564,17 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k) | ||||
|      | ||||
|     if (paga) | ||||
|     {               | ||||
|       const real totdoc(f.mask().get(F_TOTALE)); | ||||
|       const real valore = saldaconto.normalize().valore(); | ||||
|       if (totdoc != valore) | ||||
|       const char s(app().causale().sezione(2)); | ||||
|       const real t(f.mask().get(F_TOTALE)); | ||||
|       const TImporto totdoc(s, t); | ||||
|       if (totdoc != saldaconto) | ||||
|       {                                          | ||||
|         const TString td(totdoc.string(".")); | ||||
|         const char* ss = valore.string("."); | ||||
|         return f.error_box("Il totale documento inserito e' %s mentre\n" | ||||
|                            "i pagamenti e le spese ammontano a  %s", (const char*)td, ss); | ||||
|         const TString st(totdoc.valore().string(".")); | ||||
|         const TString ss(saldaconto.valore().string(".")); | ||||
|         return f.error_box("Il totale documento inserito e' %s %c mentre\n" | ||||
|                            "i pagamenti e le spese ammontano a %s %c",  | ||||
|                            (const char*)st, totdoc.sezione(),  | ||||
|                            (const char*)ss, saldaconto.sezione()); | ||||
|       }   | ||||
|     } | ||||
|      | ||||
| @ -745,7 +748,6 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k) | ||||
|           app().crea_somma_spese(growth); | ||||
|         else | ||||
|           app().sub_cgs_imp(s, growth); | ||||
|         app().calcola_saldo();   | ||||
|       }     | ||||
|     } | ||||
|     else | ||||
| @ -1005,14 +1007,16 @@ real TPrimanota_application::calcola_imp() const | ||||
|     imposte += real(row.get(3)); | ||||
|   } | ||||
|    | ||||
|   curr_mask().set(F_IMPONIBILI, imponibili); | ||||
|   curr_mask().set(F_IMPOSTE, imposte); | ||||
|   TMask& m = curr_mask(); | ||||
|   m.set(F_IMPONIBILI, imponibili); | ||||
|   m.set(F_IMPOSTE, imposte); | ||||
|    | ||||
|   // Se e' attiva la terza pagina allora riporta i totali in testata
 | ||||
|   if (is_fattura()) | ||||
|   { | ||||
|     curr_mask().set(FS_IMPONIBILI, imponibili); | ||||
|     curr_mask().set(FS_IMPOSTE, imposte); | ||||
|   {                               | ||||
|     real tot(m.get(F_TOTALE)); tot -= imposte; | ||||
|     m.set(FS_IMPONIBILI, tot); | ||||
|     m.set(FS_IMPOSTE, imposte); | ||||
|   } | ||||
|    | ||||
|   return imponibili+imposte; | ||||
| @ -1182,27 +1186,33 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k) | ||||
|         newposiva = app().set_cgs_row(-1, val, contoiva, d, tipod); | ||||
|       }   | ||||
|     } | ||||
| else | ||||
| { | ||||
|   const TImporto val(app().real2imp(imposta, 'I'));          | ||||
|   const bool empty = app().add_cgs_imp(newposiva, val); | ||||
|   if (empty)                                    // Se l'imposta si e' azzerata ...
 | ||||
|   { | ||||
|     app().reset_cgs_row(newposiva);             // ... cancellala
 | ||||
|     newposiva = -1; | ||||
|   }   | ||||
|    | ||||
| } | ||||
|     else | ||||
|     { | ||||
|       const TImporto val(app().real2imp(imposta, 'I'));          | ||||
|       const bool empty = app().add_cgs_imp(newposiva, val); | ||||
|       if (empty)                                    // Se l'imposta si e' azzerata ...
 | ||||
|       { | ||||
|         app().reset_cgs_row(newposiva);             // ... cancellala
 | ||||
|         newposiva = -1; | ||||
|       }   | ||||
|     } | ||||
| 
 | ||||
|     oldiva = imposta;                       | ||||
|     oldposiva = newposiva;    | ||||
|    | ||||
|     TMask& m = app().curr_mask();                                    | ||||
|     if (r == 0)                             // Se cambio la prima riga ...
 | ||||
|       app().add_cgs_tot(m);                 // ... ricalcola conti
 | ||||
|     { | ||||
|       app().add_cgs_tot(m);                 // ... ricalcola conti e imponibili
 | ||||
|     }   | ||||
|     else | ||||
|     {                                                                  | ||||
|       app().calcola_saldo();                // Calcola sbilancio
 | ||||
|       app().calcola_imp();                  // Calcola imponibili
 | ||||
|     } | ||||
|      | ||||
|     if (app().is_fattura() && m.insert_mode())  | ||||
|       app().set_scadenze(m);                // Aggiorna rate
 | ||||
|       app().set_scadenze(m);                // Ricalcola rate
 | ||||
|   }                                                          | ||||
|   return TRUE; | ||||
| } | ||||
| @ -1215,9 +1225,9 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k) | ||||
|   if ((k == K_TAB && !f.mask().is_running()) || k == K_ENTER) | ||||
|   { | ||||
|     const real imp = app().calcola_imp(); | ||||
|     const real tot = app().totale_documento(); | ||||
|     if (k == K_ENTER) | ||||
|     { | ||||
|       const real tot = app().totale_documento(); | ||||
|       if (imp != tot) | ||||
|       { | ||||
|         const TString t(tot.string(".")); | ||||
| @ -1862,29 +1872,29 @@ bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key) | ||||
| void TPrimanota_application::gioca_cambi(int force) | ||||
| {                | ||||
|   TMask& m = curr_mask(); | ||||
|   real totale = m.get(F_TOTALE); | ||||
|   real totval = m.get(SK_TOTDOCVAL); | ||||
|   real cambio = m.get(SK_CAMBIO); | ||||
|   const real totale = m.get(F_TOTALE); | ||||
|   const real totval = m.get(SK_TOTDOCVAL); | ||||
|   const real cambio = m.get(SK_CAMBIO); | ||||
|    | ||||
|   if ( (force == 0x1 || totale.is_zero()) && !(totval.is_zero() || cambio.is_zero()) ) | ||||
|   { | ||||
|     totale = totval * cambio; | ||||
|     m.set(F_TOTALE, totale, TRUE); | ||||
|     return; | ||||
|     const real new_totale = totval * cambio; | ||||
|     if (new_totale != totale) | ||||
|       m.set(F_TOTALE, new_totale, TRUE); | ||||
|   }  | ||||
|    | ||||
|   if ( (force == 0x2 || totval.is_zero()) && !(totale.is_zero() || cambio.is_zero())) | ||||
|   { | ||||
|     totval = totale / cambio; | ||||
|     m.set(SK_TOTDOCVAL, totval); | ||||
|     return; | ||||
|     const real new_totval = totale / cambio; | ||||
|     if (new_totval != totval) | ||||
|       m.set(SK_TOTDOCVAL, new_totval, TRUE); | ||||
|   }  | ||||
|    | ||||
|   if ( (force == 0x4 || cambio.is_zero()) && !(totale.is_zero() || totval.is_zero())) | ||||
|   { | ||||
|     cambio = totale / totval; | ||||
|     m.set(SK_CAMBIO, cambio); | ||||
|     return; | ||||
|     const real new_cambio = totale / totval; | ||||
|     if (new_cambio != cambio) | ||||
|       m.set(SK_CAMBIO, new_cambio, TRUE); | ||||
|   }  | ||||
| } | ||||
| 
 | ||||
| @ -1939,7 +1949,8 @@ bool TPrimanota_application::totdocval_handler(TMask_field& f, KEY key) | ||||
|   {   | ||||
|     app().gioca_cambi(0x1); | ||||
|      | ||||
|     if (app().is_fattura())                  // Se e' una vera fattura
 | ||||
|     const TMask& m = f.mask(); | ||||
|     if (app().is_fattura() && m.insert_mode())     // Se e' una vera fattura
 | ||||
|     { | ||||
|       TPagamento& pag = app().pagamento(); | ||||
|       const real totval(f.get()); | ||||
| @ -1973,7 +1984,11 @@ void TPrimanota_application::add_cgs_rit(bool fiscali) | ||||
|     else | ||||
|       set_cgs_imp(pos, real2imp(imp, tipo)); | ||||
|   }   | ||||
|   m.field(F_CODIVA).on_hit(); | ||||
|    | ||||
|   if (m.insert_mode()) | ||||
|     m.field(F_CODIVA).on_hit(); | ||||
|   else | ||||
|     app().calcola_saldo(); | ||||
| } | ||||
| 
 | ||||
| // Handler of the F_PROTIVA
 | ||||
|  | ||||
							
								
								
									
										262
									
								
								cg/cg2104.cpp
									
									
									
									
									
								
							
							
						
						
									
										262
									
								
								cg/cg2104.cpp
									
									
									
									
									
								
							| @ -11,6 +11,7 @@ | ||||
| #include "cg21sld.h" | ||||
| 
 | ||||
| #include <clifo.h> | ||||
| #include <mov.h> | ||||
| #include <partite.h> | ||||
| #include <scadenze.h>    | ||||
| #include <pagsca.h>    | ||||
| @ -173,9 +174,34 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key) | ||||
|     { | ||||
|       TString s(256); | ||||
|       pag.strerr(err, s); | ||||
|       error_box(s);  | ||||
|       ok = FALSE; | ||||
|       ok = error_box(s);    | ||||
|     }   | ||||
|      | ||||
|     TMask& m = f.mask(); | ||||
|     if (key == K_ENTER && m.edit_mode()) | ||||
|     {       | ||||
|       const bool valuta = m.get(SK_CAMBIO).not_empty(); | ||||
|       const real tot = m.get(valuta ? SK_TOTDOCVAL : F_TOTALE); | ||||
|       real imp; | ||||
|       for (int r = pag.n_rate()-1; r >= 0; r--) | ||||
|         imp += pag.tpay_rata(r);                                  | ||||
|       if (imp != tot)   | ||||
|       {                      | ||||
|         const char* const pic = valuta ? ".3" : ".";                 | ||||
|         const TString is(imp.string(pic)); | ||||
|         const TString ts(tot.string(pic)); | ||||
|         const bool recalc = yesno_box("Il totale delle rate e' %s mentre\n" | ||||
|                                       "il totale del documento e' %s.\n" | ||||
|                                       "Si desidera ricalcolare le rate e poi\n" | ||||
|                                       "registrare in un secondo momento?", | ||||
|                                       (const char*)is, (const char*)ts); | ||||
|         if (recalc)                               | ||||
|         { | ||||
|           app().set_scadenze(m); | ||||
|           ok = FALSE;              // Permette di guardare il risultato prima di registrare
 | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   return ok; | ||||
| } | ||||
| @ -295,12 +321,14 @@ bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key) | ||||
|     TEdit_field& dc = m.efield(SK_DATACAMBIO); | ||||
|     if (dc.get().empty())                        // Inizializza data cambio se assente
 | ||||
|       m.set(SK_DATACAMBIO, m.get(F_DATADOC), TRUE); | ||||
|      | ||||
| /*    
 | ||||
|     const TDate datacam(dc.get()); | ||||
|     const TRectype& rec = dc.browse()->cursor()->curr();   | ||||
|     const TDate curcam(rec.get("CODTAB")); | ||||
|     if (datacam != curcam)                       // Se non esiste cambio per la nuova valuta
 | ||||
|     const TString& cur = rec.get("CODTAB"); | ||||
|     TString16 key; key << f.get() << datacam.string(ANSI); | ||||
|     if (cur != key)                              // Se non esiste cambio per la nuova valuta
 | ||||
|       m.set(SK_CAMBIO, "", TRUE); | ||||
| */       | ||||
|   } | ||||
|   return TRUE; | ||||
| } | ||||
| @ -436,20 +464,24 @@ void TPrimanota_application::set_pagamento(const char* c, const char* d) | ||||
| 
 | ||||
| void TPrimanota_application::set_scadenze(TMask& m) | ||||
| {                                                                   | ||||
|   const TString16 cp(m.get(F_CODPAG)); | ||||
|   const TString16 dt(m.get(F_DATADOC)); | ||||
|   set_pagamento(cp, dt);    | ||||
| 
 | ||||
|   real imponibile, imposta; | ||||
|   const real spese(0.0);         | ||||
|   const real cambio(m.get(SK_CAMBIO)); | ||||
|   TPagamento& pag = pagamento();         | ||||
|    | ||||
|   TPagamento& pag = pagamento();         | ||||
|   if (cambio <= 1.0) | ||||
|   { | ||||
|     imponibile = real(m.get(F_IMPONIBILI));    | ||||
|     imposta = real(m.get(F_IMPOSTE));    | ||||
|     imposta = m.get_real(F_IMPOSTE);    | ||||
|     imponibile = m.get_real(F_TOTALE) - imposta;    | ||||
|   } | ||||
|   else | ||||
|   { | ||||
|     pag.set_cambio(cambio); | ||||
|     imponibile = real(m.get(SK_TOTDOCVAL));    | ||||
|     imponibile = m.get_real(SK_TOTDOCVAL);    | ||||
|     imposta = ZERO;    | ||||
|   }   | ||||
| 
 | ||||
| @ -472,134 +504,117 @@ void TPrimanota_application::set_scadenze(TMask& m) | ||||
| 
 | ||||
| bool TPrimanota_application::read_scadenze(TMask& m) | ||||
| {                                                                   | ||||
|   const TRectype& testa = _rel->curr(); | ||||
|   const long nreg = testa.get_long("NUMREG"); | ||||
|   const TString16 ndoc(testa.get("NUMDOC")); | ||||
|   const int tmov = testa.get_int("TIPOMOV"); | ||||
|   const TDate ddoc(testa.get_date("DATADOC")); | ||||
|   const TDate dreg(testa.get_date("DATAREG"));                                     | ||||
|   const TString16 reg (testa.get("REG"));  | ||||
|   const long protiva = testa.get_long("PROTIVA");  | ||||
|   const TString16 codcaus(testa.get("CODCAUS"));  | ||||
|   const TString16 codval (testa.get("CODVAL"));  | ||||
|   const real cambio(testa.get("CAMBIO"));  | ||||
|   TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET); | ||||
| 
 | ||||
|   real imponibile, imposta; | ||||
|   const real spese(0.0);         | ||||
|    | ||||
|   TPagamento& pag = pagamento();         | ||||
|   bool in_valuta = FALSE; | ||||
|   if (cambio.sign() > 0) | ||||
|   { | ||||
|     in_valuta = TRUE; | ||||
|     pag.set_cambio(cambio); | ||||
|     imponibile = real(m.get(SK_TOTDOCVAL));    | ||||
|     imposta = ZERO;       | ||||
|   } | ||||
|   else | ||||
|   { | ||||
|     imponibile = real(m.get(F_IMPONIBILI));    | ||||
|     imposta = real(m.get(F_IMPOSTE));    | ||||
|   }   | ||||
|   pag.set_total(imponibile, imposta, spese);                               | ||||
|   const TRectype& testa = _rel->curr();     | ||||
|   const long nreg = testa.get_long(MOV_NUMREG); | ||||
|   const TDate datadoc = testa.get_date(MOV_DATADOC); | ||||
| 
 | ||||
|   const TRectype& prima = _rel->cg(0); | ||||
|   const char sezione    = prima.get_char("SEZIONE"); // Dare/Avere
 | ||||
|   const int  nriga      = 1; | ||||
|   const int  numrig     = 1; | ||||
| //  const char sezione    = prima.get_char("SEZIONE"); // Dare/Avere
 | ||||
| //  const int  nriga      = 1;
 | ||||
| //  const int  numrig     = 1;
 | ||||
| 
 | ||||
|   TBill clifo; clifo.get(prima);           | ||||
|   const int anno = m.get_int(F_ANNORIF); | ||||
|   const TString16 numpart(m.get(F_NUMRIF)); | ||||
| 
 | ||||
|   partite().destroy(); | ||||
|   const TPartita& part = partite().partita(clifo, anno, numpart); | ||||
|    | ||||
|   int npart = part.prima_fattura(nreg); | ||||
|   bool fromscratch = FALSE; | ||||
|   if (npart <= 0)  // la gh'e' no!
 | ||||
|     return FALSE; | ||||
| 
 | ||||
|   if (npart > 0)  // la gh'e'
 | ||||
|   {     | ||||
|     const TRiga_partite&  partita   = part.riga(npart);                    | ||||
|   const TRiga_partite&  partita = part.riga(npart);                    | ||||
|   TString codpag = testa.get(MOV_CODPAG); | ||||
|   if (partita.rate() > 0) | ||||
|   { | ||||
|     const TRiga_scadenze& primarata = partita.rata(1); | ||||
|      | ||||
|     // se si e' specificato un codice pagamento diverso si rifa' da capo 
 | ||||
|     // la follia e' che e' sulle SCADENZE, non sulle partite, naturalmente
 | ||||
|     // uguale per tutte      
 | ||||
|     if (pag.code() != primarata.get(SCAD_CODPAG)) | ||||
|       fromscratch = TRUE;                     | ||||
|                           | ||||
|     // se invece la maschera contiene importi diversi da quelli
 | ||||
|     // registrati si passa la palla al culano/a                                            
 | ||||
|     // TBC controllo se imponibile deve contenere le spese
 | ||||
|     else  | ||||
|     { | ||||
|       if ((imponibile + imposta) != partita.get_real(in_valuta ? PART_IMPORTOVAL : PART_IMPORTO) ||  | ||||
|            imposta               != partita.get_real(PART_IMPOSTA) || | ||||
|            spese                 != partita.get_real(PART_SPESE))   | ||||
|       { | ||||
|         fromscratch = !yesno_box("Gli importi totali delle scadenze sono stati modificati rispetto" | ||||
|                                  " all'ultima registrazione. Si desidera mantenere" | ||||
|                                  " comunque la rateazione precedente"); | ||||
|         // nel qual caso, of course, si disabilitano gli automatismi
 | ||||
|         m.set(FS_RECALC, fromscratch ? "X" : "", TRUE); | ||||
|       } | ||||
|     }   | ||||
|      | ||||
|     if (fromscratch) | ||||
|     { | ||||
|       pag.set_rate_auto(); | ||||
|     }   | ||||
|     else | ||||
|     {                        | ||||
|       pag.zap_rate(); | ||||
|       for (int i = 1; i <= partita.rate(); i++) | ||||
|       {  | ||||
|         const TRiga_scadenze& scadenza = partita.rata(i); | ||||
|         real  importo       = scadenza.get(SCAD_IMPORTO);  | ||||
|         const TDate scad    = scadenza.get(SCAD_DATASCAD); | ||||
|         const int tipop     = scadenza.get_int(SCAD_TIPOPAG);      | ||||
|         const bool paid     = scadenza.get_bool(SCAD_PAGATA); | ||||
|         const TString16 ulc = scadenza.get(SCAD_ULTCLASS);                        | ||||
|         if (scadenza.in_valuta()) | ||||
|         {                                                         | ||||
|           const real impval(scadenza.get(SCAD_IMPORTOVAL)); | ||||
|           pag.set_rata(i-1, impval, importo, scad, tipop, ulc, paid); | ||||
|         } | ||||
|         else | ||||
|           pag.set_rata(i-1, importo, ZERO, scad, tipop, ulc, paid); | ||||
|          | ||||
|         TToken_string& str = ps.row(i-1); | ||||
|         str.add(scadenza.get(SCAD_CODABIPR), 7); | ||||
|         str.add(scadenza.get(SCAD_CODCABPR), 8); | ||||
|         str.add(scadenza.get(SCAD_CODABI),   9); | ||||
|         str.add(scadenza.get(SCAD_CODCAB),   10);     | ||||
|         if (i == 1) | ||||
|         { | ||||
|           m.set(FS_NSABI, str.get(7)); | ||||
|           m.set(FS_NSCAB, str.get(8)); | ||||
|           m.set(FS_VSABI, str.get(9)); | ||||
|           m.set(FS_VSCAB, str.get(10)); | ||||
|           m.set(FS_AGENTE, scadenza.get(SCAD_CODAG)); | ||||
|         } | ||||
|       }  | ||||
|       m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2"); | ||||
|       m.set(FS_NAMEPAG, pag.name()); | ||||
|       m.set(FS_TIPOPR,  pag.desc_tpr()); | ||||
|       m.set(FS_MCOMM,   pag.mese_commerciale() ? "X" : "", TRUE); | ||||
|       m.set(FS_RECALC,  m.insert_mode() ? "X" : "", TRUE); | ||||
|       m.set(FS_NRATE,   pag.n_rate()); | ||||
|     } //else
 | ||||
|     codpag = primarata.get(SCAD_CODPAG); | ||||
|   }   | ||||
|   set_pagamento(codpag, datadoc.string()); | ||||
|    | ||||
|   real imponibile, imposta; | ||||
|   const real spese(0.0);         | ||||
| 
 | ||||
|   const real cambio(partita.get(PART_CAMBIO));  | ||||
|   const bool in_valuta = cambio > 1.0; | ||||
|   if (in_valuta) | ||||
|   { | ||||
|     imponibile = m.get_real(SK_TOTDOCVAL);    | ||||
|     imposta = m.get_real(F_IMPOSTE); imposta /= cambio; imposta.round(3); | ||||
|   } | ||||
|   else | ||||
|     return FALSE; | ||||
|   { | ||||
|     imposta = m.get_real(F_IMPOSTE);    | ||||
|     imponibile = m.get_real(F_TOTALE) - imposta;    | ||||
|   }   | ||||
| 
 | ||||
|   // se la maschera contiene importi diversi da quelli
 | ||||
|   // registrati si passa la palla al culano/a                                            
 | ||||
|   // TBC controllo se imponibile deve contenere le spese
 | ||||
|   if ((imponibile + imposta) != partita.importo(in_valuta).valore() ||  | ||||
|        imposta               != partita.get_real(PART_IMPOSTA) || | ||||
|        spese                 != partita.get_real(PART_SPESE))   | ||||
|   { | ||||
|     warning_box("Gli importi delle scadenze non corrispondono al totale documento"); | ||||
|   } | ||||
|      | ||||
|   if (in_valuta) | ||||
|   { | ||||
|     imposta    = partita.get_real(PART_IMPOSTA); imposta /= cambio; imposta.round(3); | ||||
|     imponibile = partita.importo(TRUE).valore() - imposta; | ||||
|   } | ||||
|   else | ||||
|   { | ||||
|     imposta = partita.get_real(PART_IMPOSTA); | ||||
|     imponibile = partita.importo(FALSE).valore() - imposta; | ||||
|   } | ||||
| 
 | ||||
|   TPagamento& pag = pagamento();         | ||||
|   pag.set_total(imponibile, imposta, spese); | ||||
| 
 | ||||
|   TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET); | ||||
|        | ||||
|   pag.zap_rate(); | ||||
|   for (int i = 1; i <= partita.rate(); i++) | ||||
|   {  | ||||
|     const TRiga_scadenze& scadenza = partita.rata(i); | ||||
|     real  importo       = scadenza.get(SCAD_IMPORTO);  | ||||
|     const TDate scad    = scadenza.get(SCAD_DATASCAD); | ||||
|     const int tipop     = scadenza.get_int(SCAD_TIPOPAG);      | ||||
|     const bool paid     = scadenza.get_bool(SCAD_PAGATA); | ||||
|     const TString16 ulc = scadenza.get(SCAD_ULTCLASS);                        | ||||
|     if (scadenza.in_valuta()) | ||||
|     {                                                         | ||||
|       const real impval(scadenza.get(SCAD_IMPORTOVAL)); | ||||
|       pag.set_rata(i-1, impval, importo, scad, tipop, ulc, paid); | ||||
|     } | ||||
|     else | ||||
|       pag.set_rata(i-1, importo, ZERO, scad, tipop, ulc, paid); | ||||
|          | ||||
|     TToken_string& str = ps.row(i-1); | ||||
|     str.add(scadenza.get(SCAD_CODABIPR), 7); | ||||
|     str.add(scadenza.get(SCAD_CODCABPR), 8); | ||||
|     str.add(scadenza.get(SCAD_CODABI),   9); | ||||
|     str.add(scadenza.get(SCAD_CODCAB),   10);     | ||||
|     if (i == 1) | ||||
|     { | ||||
|       m.set(FS_NSABI, str.get(7)); | ||||
|       m.set(FS_NSCAB, str.get(8)); | ||||
|       m.set(FS_VSABI, str.get(9)); | ||||
|       m.set(FS_VSCAB, str.get(10)); | ||||
|       m.set(FS_AGENTE, scadenza.get(SCAD_CODAG)); | ||||
|     } | ||||
|   }  | ||||
|   m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2"); | ||||
|   m.set(FS_NAMEPAG, pag.name()); | ||||
|   m.set(FS_TIPOPR,  pag.desc_tpr()); | ||||
|   m.set(FS_MCOMM,   pag.mese_commerciale() ? "X" : "", TRUE); | ||||
|   m.set(FS_RECALC,  m.insert_mode() ? "X" : "", TRUE); | ||||
|   m.set(FS_NRATE,   pag.n_rate()); | ||||
| 
 | ||||
|   pag.set_sheet(ps); | ||||
|   _pag_rows = ps.rows_array(); | ||||
| 
 | ||||
|   // se la prima rata e' fissa non si tocca
 | ||||
|   if (pag.tipo_prima_rata() > 3) | ||||
|     ps.disable_cell(0,-1); | ||||
|    | ||||
|   return TRUE; | ||||
| } | ||||
| @ -625,6 +640,7 @@ void TPrimanota_application::write_scadenze(const TMask& m) | ||||
|     const TDate   dreg(m.get(F_DATAREG));                                     | ||||
|     const TString reg (causale().reg().name());        | ||||
|     const TString desc(m.get(F_DESCR)); | ||||
|     const TString codpag(m.get(F_CODPAG)); | ||||
|     const long protiva = m.get_long(F_PROTIVA);  | ||||
|     const TString codcaus(causale().codice());  | ||||
|     const TString codval (m.get(SK_VALUTA));  | ||||
| @ -656,7 +672,7 @@ void TPrimanota_application::write_scadenze(const TMask& m) | ||||
|      | ||||
|     if (partita.in_valuta())     | ||||
|     {                                               | ||||
|       partita.put(PART_IMPORTO, m.get(F_IMPONIBILI)); | ||||
|       partita.put(PART_IMPORTO, m.get(F_TOTALE)); | ||||
|       partita.put(PART_IMPORTOVAL, pag.imponibile()); | ||||
|       partita.zero(PART_IMPOSTA); | ||||
|     } | ||||
| @ -666,7 +682,7 @@ void TPrimanota_application::write_scadenze(const TMask& m) | ||||
|       partita.zero(PART_IMPORTOVAL); | ||||
|       partita.put(PART_IMPOSTA, pag.imposta()); | ||||
|     }   | ||||
|     partita.put(PART_SPESE,   pag.spese()); | ||||
|     partita.put(PART_SPESE, pag.spese()); | ||||
|    | ||||
|     TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET); | ||||
|     partita.elimina_rata(-1); | ||||
| @ -675,7 +691,7 @@ void TPrimanota_application::write_scadenze(const TMask& m) | ||||
|       TToken_string& row = ps.row(i); | ||||
|        | ||||
|       TRiga_scadenze& scadenza = partita.new_row();  | ||||
|       scadenza.put(SCAD_CODPAG,   pag.code()); | ||||
|       scadenza.put(SCAD_CODPAG,   codpag); | ||||
|       scadenza.put(SCAD_TIPOPAG,  pag.tipo_rata(i)); | ||||
|       scadenza.put(SCAD_ULTCLASS, pag.ulc_rata(i)); | ||||
|       if (partita.in_valuta())     | ||||
|  | ||||
| @ -23,6 +23,7 @@ class TPay_mask : public TMask | ||||
|    | ||||
| protected: | ||||
|   static bool importo_handler(TMask_field& f, KEY k); | ||||
|   static bool importolire_handler(TMask_field& f, KEY k); | ||||
|   static bool cambio_handler(TMask_field& f, KEY k); | ||||
| 
 | ||||
| public: | ||||
| @ -77,8 +78,14 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad, | ||||
|   res.set_decimals(in_valuta ? 2 : 0); | ||||
|   if (get(S_SALDOACC)[0] != 'S') | ||||
|     res.set(_da_pagare.string()); | ||||
| 
 | ||||
|   set_handler(in_valuta ? S_IMPORTOVAL : S_IMPORTO, importo_handler);  | ||||
|    | ||||
|   if (in_valuta) | ||||
|   { | ||||
|     set_handler(S_IMPORTOVAL, importo_handler);  | ||||
|     set_handler(S_IMPORTO, importolire_handler);  | ||||
|   } | ||||
|   else   | ||||
|     set_handler(S_IMPORTO, importo_handler);  | ||||
|    | ||||
|   real oldimp = oldpag.get_real(in_valuta ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO);    | ||||
|   if (!in_valuta) | ||||
| @ -191,7 +198,7 @@ bool TPay_mask::importo_handler(TMask_field& f, KEY k) | ||||
| 
 | ||||
|     if (f.dlg() == S_IMPORTOVAL) | ||||
|     {                                             | ||||
|       TValuta val; val.get(m, S_VALUTA, S_DATACAMBIO, S_CAMBIO); | ||||
|       const TValuta val(m, 0, 0, S_CAMBIO); | ||||
|       val.val2lit(i); | ||||
|       m.set(S_IMPORTO, i); | ||||
|     } | ||||
| @ -200,6 +207,22 @@ bool TPay_mask::importo_handler(TMask_field& f, KEY k) | ||||
|   return TRUE; | ||||
| } | ||||
| 
 | ||||
| bool TPay_mask::importolire_handler(TMask_field& f, KEY k) | ||||
| { | ||||
|   if (f.to_check(k)) | ||||
|   { | ||||
|     TPay_mask& m = (TPay_mask&)f.mask();          | ||||
|     const real implit(f.get()); | ||||
|     if (!implit.is_zero() && m.get(S_IMPORTOVAL).empty()) | ||||
|     { | ||||
|       const TValuta val(m, 0, 0, S_CAMBIO); | ||||
|       const real impval = val.lit2val(implit); | ||||
|       m.set(S_IMPORTOVAL, impval); | ||||
|     } | ||||
|   } | ||||
|   return TRUE; | ||||
| } | ||||
| 
 | ||||
| bool TPay_mask::cambio_handler(TMask_field& f, KEY k) | ||||
| {              | ||||
|   if (k == K_TAB && f.focusdirty()) | ||||
| @ -376,7 +399,7 @@ bool TGame_mask::cambio_handler(TMask_field& f, KEY k) | ||||
|       yesno_box("Aggiornare gli importi dei pagamenti?")) | ||||
|   { | ||||
|     TGame_mask& gm = (TGame_mask&)f.mask(); | ||||
|     TValuta val; val.get(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO); | ||||
|     const TValuta val(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO); | ||||
|     gm.aggiorna_valuta(val); | ||||
|   } | ||||
|   return TRUE; | ||||
| @ -590,7 +613,6 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k) | ||||
|             }   | ||||
|             else | ||||
|             { | ||||
|               imp.valore() += pag.get_real(PAGSCA_RITENUTE); | ||||
|               gm.add_importo(row, imp); | ||||
|               row.add(""); | ||||
|             }   | ||||
| @ -600,12 +622,23 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k) | ||||
|             row.add("");  | ||||
|             row.add(pa); | ||||
|           } | ||||
|            | ||||
|           const TImporto rit(scad.importo_pagato(FALSE, 0x8)); | ||||
|           if (!rit.is_zero())    | ||||
|           { | ||||
|             TToken_string& rrit = scadenze.row(scadenze.add("")); | ||||
|             rrit.add("Ritenute professionali", 4);  | ||||
|             gm.add_importo(rrit, rit, FALSE); | ||||
|           } | ||||
|              | ||||
|           TImporto abb(scad.importo_pagato(TRUE, 0x2)); | ||||
|           if (!abb.is_zero()) | ||||
|           { | ||||
|             TToken_string& rabb = scadenze.row(scadenze.add("")); | ||||
|             rabb.add("Abbuoni rata ", 4); rabb << ra; | ||||
|             rabb.add("Abbuoni ", 4);  | ||||
|             abb.normalize(); | ||||
|             rabb << (abb.sezione() == 'D' ? "attivi" : "passivi"); | ||||
|              | ||||
|             if (in_valuta) | ||||
|             { | ||||
|               gm.add_importo(rabb, scad.importo_pagato(FALSE, 0x2), FALSE); | ||||
| @ -624,7 +657,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k) | ||||
|             if (!diff.is_zero()) | ||||
|             { | ||||
|               TToken_string& rdiff = scadenze.row(scadenze.add("")); | ||||
|               rdiff.add("Differ. cambio rata ", 4); rdiff << ra; | ||||
|               rdiff.add("Differenza cambio", 4); | ||||
|               gm.add_importo(rdiff, diff); | ||||
|             } | ||||
|           } | ||||
|  | ||||
| @ -22,8 +22,10 @@ END | ||||
| NUMBER 103 15 2 | ||||
| BEGIN | ||||
|   PROMPT 1 4 "Importo valuta " | ||||
|   FLAGS "D" | ||||
|   PICTURE ".3" | ||||
|   VALIDATE REQIF_FUNC 1 102 | ||||
|   WARNING "E' necessario specificare anche un importo in valuta" | ||||
| END | ||||
| 
 | ||||
| NUMBER 104 6 2 | ||||
|  | ||||
| @ -585,10 +585,7 @@ void TPagamento::strerr(word err, TString& s) | ||||
|   if (err & P_SCAD) | ||||
|     s << "Le scadenze non sono consecutive\n"; | ||||
|   if (err & P_INIZIO) | ||||
|   { | ||||
|     s << "La prima rata (" << data_rata(0) << ") e' antecedente"; | ||||
|     s << " alla data del documento (" << _inizio << ")\n"; | ||||
|   }   | ||||
|     s << "La prima rata e' antecedente alla data del documento (" << _inizio << ")\n"; | ||||
|   if (err & P_NEG) | ||||
|     s << "L'importo dato e' inferiore al minimo possibile\n"; | ||||
|   if (err & P_TROP) | ||||
| @ -1190,8 +1187,8 @@ bool TPagamento::read(TTable* t, TTable* r) | ||||
|   // set everything 
 | ||||
|   _rdiff   = t->get_bool("B1"); | ||||
|   _mcomm   = t->get_bool("B0"); | ||||
|   _tpr     = atoi(t->get("S3")); | ||||
|   _inscad  = *((const char*)(t->get("S1"))); | ||||
|   _tpr     = t->get_int("S3"); | ||||
|   _inscad  = t->get_char("S1"); | ||||
|   _code    = t->get("CODTAB"); | ||||
|   _name    = t->get("S0"); | ||||
|   _fixd[0] = t->get_int("I0"); | ||||
| @ -1434,7 +1431,7 @@ void TPagamento::set_sheet(TSheet_field& sf, int sscad) | ||||
|    | ||||
|   if (_inited) | ||||
|   { | ||||
|     const bool in_valuta = _cambio != 1.0; | ||||
|     const bool in_valuta = _cambio > 1.0; | ||||
|                         | ||||
|     // si istanzia uno sheet di primanota
 | ||||
|     for (int i = 0; i < n_rate(); i++) | ||||
|  | ||||
| @ -134,16 +134,18 @@ TValuta::TValuta() : _cod(""), _dat(TODAY), _cam(1.0) | ||||
| 
 | ||||
| void TValuta::adjust() | ||||
| {  | ||||
|   _cod.upper(); | ||||
|   if (_cod.empty() || _cod == "LIT" || _cam.is_zero())  | ||||
|   if (_cam <= 1.0)  | ||||
|   { | ||||
|     _cod = ""; | ||||
|     _dat = TDate(TODAY); | ||||
|     _cam = 1.0;  | ||||
|   }   | ||||
| } | ||||
| 
 | ||||
| int TValuta::compare(const TSortable& s) const | ||||
| { | ||||
|   const TValuta& v = (const TValuta&)s; | ||||
|   real c(_cam); c -= v._cam; | ||||
|   return c.sign(); | ||||
|   return stricmp(_cod, v._cod); | ||||
| } | ||||
| 
 | ||||
| void TValuta::get(const TRectype& rec) | ||||
| @ -164,9 +166,9 @@ void TValuta::put(TRectype& rec) const | ||||
|   } | ||||
|   else | ||||
|   { | ||||
|     rec.put("CODVAL", _cod); | ||||
|     rec.put("CODVAL",  _cod); | ||||
|     rec.put("DATACAM", _dat); | ||||
|     rec.put("CAMBIO", _cam); | ||||
|     rec.put("CAMBIO",  _cam); | ||||
|   }   | ||||
| } | ||||
| 
 | ||||
| @ -188,12 +190,19 @@ void TValuta::set(TMask& m, short v, short d, short c) const | ||||
| 
 | ||||
| void TValuta::get(const TMask& m, short v, short d, short c) | ||||
| { | ||||
|   _cod = m.get(v); | ||||
|   _dat = m.get(d); | ||||
|   if (v > 0) _cod = m.get(v); | ||||
|   if (d > 0) _dat = m.get(d); | ||||
|   _cam = real(m.get(c)); | ||||
|   adjust(); | ||||
| } | ||||
| 
 | ||||
| void TValuta::set(const TValuta& v) | ||||
| { | ||||
|   _cod = v._cod; | ||||
|   _dat = v._dat; | ||||
|   _cam = v._cam; | ||||
| } | ||||
| 
 | ||||
| real TValuta::lit2val(const real& lit) const | ||||
| { | ||||
|   real val(lit); | ||||
| @ -385,7 +394,7 @@ char TRiga_scadenze::calcola_abbuono(int p, TImporto& abbuono, bool update) | ||||
|     {                                 | ||||
|       abbuono = importo(TRUE); | ||||
|       pag.zero(PAGSCA_ABBUONI); | ||||
|       abbuono += importo_pagato(TRUE, 0x3);          // Conta anche altri abbuoni
 | ||||
|       abbuono += importo_pagato(TRUE, 0x0B);  // Somma di importi, abbuoni e ritenute
 | ||||
|       abbuono.swap_section(); | ||||
| 
 | ||||
|       const int sign = abbuono.valore().sign(); | ||||
|  | ||||
| @ -70,12 +70,13 @@ class TValuta : public TSortable | ||||
|   TDate _dat; | ||||
|   real _cam; | ||||
|    | ||||
| protected: | ||||
|   void adjust();     // Controlla il cambio per le lire
 | ||||
| 
 | ||||
| protected:           // TSortable
 | ||||
|   virtual int compare(const TSortable& s) const; | ||||
| 
 | ||||
| protected: | ||||
|   void adjust();     // Controlla il cambio per le lire
 | ||||
|   void set(const TValuta& v); | ||||
|    | ||||
| public:                 | ||||
|   const TString& codice() const { return _cod; } | ||||
|   const TDate& data() const { return _dat; } | ||||
| @ -93,11 +94,14 @@ public: | ||||
|    | ||||
|   void set(TMask& m, short v, short d, short c) const; | ||||
|   void get(const TMask& m, short v, short d, short c);  | ||||
| 
 | ||||
|   const TValuta& operator =(const TValuta& v) { set(v); return *this; } | ||||
|    | ||||
|   TValuta(); | ||||
|   TValuta(const char* cod, const TDate& dat, const real& cam); | ||||
|   TValuta(const TRectype& rec) { get(rec); } | ||||
|   TValuta(const TMask& m, short v, short d, short c) { get(m, v, d, c); } | ||||
|   TValuta(const TValuta& v) { set(v); } | ||||
|   virtual ~TValuta() {} | ||||
| };     | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user