Correzioni a errori da PR
git-svn-id: svn://10.65.10.50/trunk@2476 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									5116c3f37e
								
							
						
					
					
						commit
						567eaa4f6e
					
				| @ -83,8 +83,8 @@ TMask* TPrimanota_application::load_mask(int n) | |||||||
|   case 2: |   case 2: | ||||||
|     if (m) |     if (m) | ||||||
|     {                                     |     {                                     | ||||||
|       m->set_handler(F_DATADOC, doc_handler);  |       m->set_handler(F_DATADOC, datadoc_handler);  | ||||||
|       m->set_handler(F_NUMDOC, doc_handler);  |       m->set_handler(F_NUMDOC, numdoc_handler);  | ||||||
|       m->set_handler(F_DATA74TER, data74ter_handler);  |       m->set_handler(F_DATA74TER, data74ter_handler);  | ||||||
|       m->set_handler(F_PROTIVA, protiva_handler); |       m->set_handler(F_PROTIVA, protiva_handler); | ||||||
|       m->set_handler(F_CLIENTE, clifo_handler); |       m->set_handler(F_CLIENTE, clifo_handler); | ||||||
| @ -494,19 +494,19 @@ void TPrimanota_application::init_mask(TMask& m) | |||||||
|     if (is_fattura()) |     if (is_fattura()) | ||||||
|     { |     { | ||||||
|       const TPartita* game = partite().first(); |       const TPartita* game = partite().first(); | ||||||
|       const bool scad_free = game == NULL || !game->esistono_abbuoni_diffcam(m.get_long(F_NUMREG)); |       _scad_free = game == NULL || !game->esistono_abbuoni_diffcam(m.get_long(F_NUMREG)); | ||||||
|       if (m.edit_mode()) |       if (m.edit_mode()) | ||||||
|         m.enable(DLG_DELREC, scad_free);  // Disabilita tasto elimina
 |         m.enable(DLG_DELREC, _scad_free);  // Disabilita tasto elimina
 | ||||||
|       m.enable(-1, scad_free);            // Disabilita cliente
 |       m.enable(-1, _scad_free);            // Disabilita cliente
 | ||||||
|       m.enable(-2, scad_free); |       m.enable(-2, _scad_free); | ||||||
|       m.enable(F_ANNORIF, scad_free);     // Disabilita anno e numero partita
 |       m.enable(F_ANNORIF, _scad_free);     // Disabilita anno e numero partita
 | ||||||
|       m.enable(F_NUMRIF, scad_free); |       m.enable(F_NUMRIF,  _scad_free); | ||||||
|                   |       m.enable(F_SOLAIVA, _scad_free);     // Disabilita movimenti di sola IVA      
 | ||||||
|       m.enable(F_CODPAG, scad_free);      // Disabilita codice pagamento
 |       m.enable(F_CODPAG,  _scad_free);     // Disabilita codice pagamento
 | ||||||
|       m.enable(FS_RESET, scad_free);      // Disabilita tasto di reset
 |       m.enable(FS_RESET,  _scad_free);     // Disabilita tasto di reset
 | ||||||
|       if (!scad_free)  |       if (!_scad_free)  | ||||||
|         m.set(FS_RECALC, "", TRUE);        // Disabilita ricalcolo automatico 
 |         m.set(FS_RECALC, "", TRUE);        // Disabilita ricalcolo automatico 
 | ||||||
|       m.enable(FS_RECALC, scad_free);      |       m.enable(FS_RECALC, _scad_free);      | ||||||
|     }   |     }   | ||||||
|   } |   } | ||||||
|    |    | ||||||
| @ -675,8 +675,7 @@ int TPrimanota_application::read(TMask& m) | |||||||
|     return _rel->status(); |     return _rel->status(); | ||||||
|    |    | ||||||
|   const bool solaiva = i == 0; |   const bool solaiva = i == 0; | ||||||
|   m.set(F_SOLAIVA, solaiva ? "X" : " "); |   m.set(F_SOLAIVA, solaiva ? "X" : " ", TRUE); | ||||||
|   m.field(F_SOLAIVA).on_hit(); |  | ||||||
|    |    | ||||||
|   const bool to_swap = test_swap(FALSE); |   const bool to_swap = test_swap(FALSE); | ||||||
|   if (to_swap) |   if (to_swap) | ||||||
|  | |||||||
| @ -158,9 +158,7 @@ BEGIN | |||||||
|   PROMPT 1 9 ""   |   PROMPT 1 9 ""   | ||||||
|   FLAGS "Z" |   FLAGS "Z" | ||||||
|   ITEM "A|Acconto"  |   ITEM "A|Acconto"  | ||||||
|     MESSAGE DIRTY,S_IMPORTO|K_TAB,S_IMPORTO|DIRTY,S_IMPORTOVAL|K_TAB,S_IMPORTOVAL |  | ||||||
|   ITEM "S|Saldo" |   ITEM "S|Saldo" | ||||||
|     MESSAGE RESET,S_RESIDUORATA |  | ||||||
|   FIELD ACCSAL |   FIELD ACCSAL | ||||||
| END          | END          | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -587,7 +587,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k) | |||||||
|     if (app().is_fattura()) |     if (app().is_fattura()) | ||||||
|     { |     { | ||||||
|       TBill contocf;  |       TBill contocf;  | ||||||
|       if (!app().cerca_conto_cf(contocf)) |       if (app().cerca_conto_cf(contocf) < 0) | ||||||
|       { |       { | ||||||
|         TString msg(80); msg = "Non esiste una riga contabile riferita al "; |         TString msg(80); msg = "Non esiste una riga contabile riferita al "; | ||||||
|         msg << (contocf.tipo() == 'C' ? "cliente" : "fornitore") << ' '; |         msg << (contocf.tipo() == 'C' ? "cliente" : "fornitore") << ' '; | ||||||
| @ -1654,42 +1654,41 @@ bool TPrimanota_application::data74ter_handler(TMask_field& f, KEY key) | |||||||
|   return ok;  |   return ok;  | ||||||
| }    | }    | ||||||
| 
 | 
 | ||||||
| bool TPrimanota_application::doc_handler(TMask_field& f, KEY key) | 
 | ||||||
|  | bool TPrimanota_application::numdoc_handler(TMask_field& f, KEY key) | ||||||
|  | { | ||||||
|  |   TMask& m = f.mask(); | ||||||
|  |   if (key == K_TAB && f.to_check(key, TRUE) && m.insert_mode() && app().is_saldaconto()) | ||||||
|  |   { | ||||||
|  |     if (!app().npart_is_prot())                // Copiare numero documento nel numero partita?
 | ||||||
|  |     {  | ||||||
|  |       if (m.get(F_NUMRIF).empty()) | ||||||
|  |         m.set(F_NUMRIF, f.get(), TRUE);              | ||||||
|  |     }   | ||||||
|  |   } | ||||||
|  |   return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool TPrimanota_application::datadoc_handler(TMask_field& f, KEY key) | ||||||
| { | { | ||||||
|   TMask& m = f.mask(); |   TMask& m = f.mask(); | ||||||
| 
 | 
 | ||||||
|   if (key == K_TAB && m.insert_mode() && app().is_saldaconto()) |   if (key == K_TAB && f.to_check(key, TRUE) && app().is_saldaconto()) | ||||||
|   { |   { | ||||||
|     const TString16 val(f.get()); |     const TDate dd(f.get());                              // Fattura o nota credito
 | ||||||
| 
 |     if (dd.ok()) | ||||||
|     if (val.not_empty())                       |  | ||||||
|     { |     { | ||||||
|       if (f.dlg() == F_DATADOC) |  | ||||||
|       { |  | ||||||
|         const TDate dd(val);                              // Fattura o nota credito
 |  | ||||||
|       if (m.get(F_ANNORIF).empty()) |       if (m.get(F_ANNORIF).empty()) | ||||||
|         m.set(F_ANNORIF, dd.year());                    // copia anno documento
 |         m.set(F_ANNORIF, dd.year());                    // copia anno documento
 | ||||||
|       if (app().is_fattura())      |       if (app().is_fattura())      | ||||||
|  |       {    | ||||||
|  |         if (m.insert_mode()) | ||||||
|           app().recalc_scadenze(dd); |           app().recalc_scadenze(dd); | ||||||
|       } |  | ||||||
|         else  |         else  | ||||||
|       if (!app().npart_is_prot())  |  | ||||||
|       {  |  | ||||||
|         if (m.get(F_NUMRIF).empty()) |  | ||||||
|           m.set(F_NUMRIF, val, TRUE);                     // copia numero documento
 |  | ||||||
|       }   |  | ||||||
|     }   |  | ||||||
|   } |  | ||||||
|   else  |  | ||||||
|     if (key == K_TAB && m.edit_mode() && app().is_saldaconto()) |  | ||||||
|     {  |  | ||||||
|       if (f.dlg() == F_DATADOC) |  | ||||||
|       { |  | ||||||
|         const TDate dd(f.get());                            // Fattura o nota credito
 |  | ||||||
|         if (app().is_fattura()) |  | ||||||
|           app().pagamento().set_datadoc(dd); |           app().pagamento().set_datadoc(dd); | ||||||
|       } |       } | ||||||
|     }   |     }   | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
| @ -2213,7 +2212,40 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key) | |||||||
|   if (key == K_SPACE) |   if (key == K_SPACE) | ||||||
|   {      |   {      | ||||||
|     TMask& m = f.mask();                                   |     TMask& m = f.mask();                                   | ||||||
|     const bool anchecg = !m.get_bool(F_SOLAIVA); |     bool anchecg = !m.get_bool(F_SOLAIVA); | ||||||
|  |      | ||||||
|  |     if (m.is_running() && app().is_fattura() && app()._scad_free) | ||||||
|  |     { | ||||||
|  |       const TPartita* game = app().partite().first(); | ||||||
|  | 
 | ||||||
|  |       if (anchecg) | ||||||
|  |       {     | ||||||
|  |         m.enable(F_NUMRIF); | ||||||
|  |         m.enable(F_ANNORIF); | ||||||
|  |          | ||||||
|  |         if (game != NULL) | ||||||
|  |         { | ||||||
|  |           m.set(F_ANNORIF, game->anno()); | ||||||
|  |           m.set(F_NUMRIF, game->numero(), TRUE); | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       else | ||||||
|  |       {                  | ||||||
|  |         bool del = TRUE; | ||||||
|  |         if (game != NULL) | ||||||
|  |           del = f.yesno_box("Si desidera cancellare il saldaconto?"); | ||||||
|  |         if (del)   | ||||||
|  |         { | ||||||
|  |           m.set(F_NUMRIF, "", TRUE); m.disable(F_NUMRIF); | ||||||
|  |           m.reset(F_ANNORIF);        m.disable(F_ANNORIF); | ||||||
|  |         }   | ||||||
|  |         else              | ||||||
|  |         { | ||||||
|  |           anchecg = TRUE; | ||||||
|  |           f.reset(); | ||||||
|  |         }   | ||||||
|  |       } | ||||||
|  |     } | ||||||
|      |      | ||||||
|     m.show(F_SHEETCG, anchecg); |     m.show(F_SHEETCG, anchecg); | ||||||
|     m.show(F_DARE, anchecg); |     m.show(F_DARE, anchecg); | ||||||
|  | |||||||
| @ -48,6 +48,7 @@ class TPrimanota_application : public TRelation_application | |||||||
|   bool _sheet_shown;          // Lo sheet e' gia' stato visualizzato una volta?
 |   bool _sheet_shown;          // Lo sheet e' gia' stato visualizzato una volta?
 | ||||||
| 
 | 
 | ||||||
|   bool _is_saldaconto;        // saldaconto si/no (vede parametri e causale)
 |   bool _is_saldaconto;        // saldaconto si/no (vede parametri e causale)
 | ||||||
|  |   bool _scad_free;            // posso variare liberamente le rate della fattura 
 | ||||||
|    |    | ||||||
|   TSaldo_agg _saldi;          // Saldi da aggiornare
 |   TSaldo_agg _saldi;          // Saldi da aggiornare
 | ||||||
|   TPartite_array _partite;    // Partite coinvolte
 |   TPartite_array _partite;    // Partite coinvolte
 | ||||||
| @ -80,7 +81,8 @@ class TPrimanota_application : public TRelation_application | |||||||
|   static bool datareg_handler(TMask_field& f, KEY key); |   static bool datareg_handler(TMask_field& f, KEY key); | ||||||
|   static bool datacomp_handler(TMask_field& f, KEY key); |   static bool datacomp_handler(TMask_field& f, KEY key); | ||||||
|   static bool data74ter_handler(TMask_field& f, KEY key); |   static bool data74ter_handler(TMask_field& f, KEY key); | ||||||
|   static bool doc_handler(TMask_field& f, KEY key); |   static bool datadoc_handler(TMask_field& f, KEY key); | ||||||
|  |   static bool numdoc_handler(TMask_field& f, KEY key); | ||||||
|   static bool annorif_handler(TMask_field& f, KEY key); |   static bool annorif_handler(TMask_field& f, KEY key); | ||||||
|   static bool numrif_handler(TMask_field& f, KEY key); |   static bool numrif_handler(TMask_field& f, KEY key); | ||||||
|   static bool protiva_handler(TMask_field& f, KEY key); |   static bool protiva_handler(TMask_field& f, KEY key); | ||||||
| @ -231,7 +233,7 @@ protected: | |||||||
|   void renumber_partita(TMask& m, const char* oldp, const char* newp); |   void renumber_partita(TMask& m, const char* oldp, const char* newp); | ||||||
|   void recalc_scadenze(const TDate& d); |   void recalc_scadenze(const TDate& d); | ||||||
| 
 | 
 | ||||||
|   bool cerca_conto_cf(TBill& bill) const; |   int cerca_conto_cf(TBill& bill) const; | ||||||
|    |    | ||||||
|   bool edit_partite(const TMask& m, int riga); |   bool edit_partite(const TMask& m, int riga); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -351,7 +351,7 @@ bool TPrimanota_application::numrif_handler(TMask_field& f, KEY key) | |||||||
|   if (f.to_check(key, TRUE)) |   if (f.to_check(key, TRUE)) | ||||||
|   {               |   {               | ||||||
|     TMask& m = f.mask(); |     TMask& m = f.mask(); | ||||||
|     const bool empty = f.get().blank(); |     const bool empty = f.get().blank() && !m.get_bool(F_SOLAIVA); | ||||||
|      |      | ||||||
|     if (empty && f.focusdirty() && m.insert_mode()) |     if (empty && f.focusdirty() && m.insert_mode()) | ||||||
|     {                                                                 |     {                                                                 | ||||||
| @ -399,12 +399,16 @@ bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key) | |||||||
|   if (key == K_TAB && f.to_check(key, TRUE)) |   if (key == K_TAB && f.to_check(key, TRUE)) | ||||||
|   {            |   {            | ||||||
|     TMask& m = f.mask(); |     TMask& m = f.mask(); | ||||||
|     TEdit_field& dc = m.efield(SK_DATACAMBIO); |     const TString16 val(f.get()); | ||||||
|     if (dc.get().empty())                        // Inizializza data cambio se assente
 |      | ||||||
|  |     if (val.not_empty()) | ||||||
|  |     { | ||||||
|  |       if (m.get(SK_DATACAMBIO).empty())      // Inizializza data cambio se assente
 | ||||||
|         m.set(SK_DATACAMBIO, m.get(F_DATADOC), TRUE); |         m.set(SK_DATACAMBIO, m.get(F_DATADOC), TRUE); | ||||||
|  |     } | ||||||
|      |      | ||||||
|     if (app().is_fattura())   |     if (app().is_fattura())   | ||||||
|       m.set(FS_VALUTA, f.get());                 // Copia a pagina 3
 |       m.set(FS_VALUTA, val);                 // Copia a pagina 3
 | ||||||
|   } |   } | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
| @ -725,7 +729,7 @@ bool TPrimanota_application::read_scadenze(TMask& m) | |||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool TPrimanota_application::cerca_conto_cf(TBill& bill) const | int TPrimanota_application::cerca_conto_cf(TBill& bill) const | ||||||
| { | { | ||||||
|   const char tipocf = clifo(); |   const char tipocf = clifo(); | ||||||
|   const long codcf  = curr_mask().get_long(tipocf == 'C' ? F_CLIENTE : F_FORNITORE); |   const long codcf  = curr_mask().get_long(tipocf == 'C' ? F_CLIENTE : F_FORNITORE); | ||||||
| @ -733,13 +737,14 @@ bool TPrimanota_application::cerca_conto_cf(TBill& bill) const | |||||||
|   TString_array& a = cgs().rows_array(); |   TString_array& a = cgs().rows_array(); | ||||||
|   for (int r = 0; r < a.items(); r++) |   for (int r = 0; r < a.items(); r++) | ||||||
|   {              |   {              | ||||||
|     bill.get(a.row(r), 2, 0x1); |     TToken_string& row = a.row(r); | ||||||
|  |     bill.get(row, 2, 0x1); | ||||||
|     if (bill.tipo() == tipocf && bill.codclifo() == codcf) |     if (bill.tipo() == tipocf && bill.codclifo() == codcf) | ||||||
|       return TRUE; |       return r; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   bill.set(0, 0, codcf, tipocf); |   bill.set(0, 0, codcf, tipocf); | ||||||
|   return FALSE; |   return -1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void TPrimanota_application::write_scadenze(const TMask& m) | void TPrimanota_application::write_scadenze(const TMask& m) | ||||||
| @ -761,8 +766,9 @@ void TPrimanota_application::write_scadenze(const TMask& m) | |||||||
|     const TString agente (m.get(FS_AGENTE));  |     const TString agente (m.get(FS_AGENTE));  | ||||||
|     const char sezione = get_cgs_imp(0).sezione();        // Dare/Avere
 |     const char sezione = get_cgs_imp(0).sezione();        // Dare/Avere
 | ||||||
|   |   | ||||||
|     TBill clifo; cerca_conto_cf(clifo); |     TBill clifo;  | ||||||
|     CHECK(clifo.ok(), "Impossibile generare la fattura senza gruppo/conto cliente"); |     const int riga_clifo = cerca_conto_cf(clifo); | ||||||
|  |     CHECK(riga_clifo >= 0, "Impossibile generare la fattura senza gruppo/conto cliente"); | ||||||
|     newgame = new TPartita(clifo, anno, numpart); |     newgame = new TPartita(clifo, anno, numpart); | ||||||
|    |    | ||||||
|     const int row = newgame->prima_fattura(nreg);         // Riga fattura di questo movimento
 |     const int row = newgame->prima_fattura(nreg);         // Riga fattura di questo movimento
 | ||||||
| @ -781,7 +787,10 @@ void TPrimanota_application::write_scadenze(const TMask& m) | |||||||
|     partita.put(PART_REG,       causale().reg().name()); |     partita.put(PART_REG,       causale().reg().name()); | ||||||
|     partita.put(PART_PROTIVA,   m.get_long(F_PROTIVA)); |     partita.put(PART_PROTIVA,   m.get_long(F_PROTIVA)); | ||||||
|     partita.put(PART_SEZ,       sezione); |     partita.put(PART_SEZ,       sezione); | ||||||
|     partita.put(PART_IMPTOTDOC, m.get(F_TOTALE)); |      | ||||||
|  |     const TImporto totdoc = get_cgs_imp(riga_clifo); | ||||||
|  |     partita.put(PART_IMPTOTDOC, totdoc.valore()); | ||||||
|  |      | ||||||
|     cambio.put(partita); |     cambio.put(partita); | ||||||
|     const bool in_valuta = cambio.in_valuta(); |     const bool in_valuta = cambio.in_valuta(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -25,6 +25,7 @@ class TPay_mask : public TMask | |||||||
| protected: | protected: | ||||||
|   static bool importo_handler(TMask_field& f, KEY k); |   static bool importo_handler(TMask_field& f, KEY k); | ||||||
|   static bool importolire_handler(TMask_field& f, KEY k); |   static bool importolire_handler(TMask_field& f, KEY k); | ||||||
|  |   static bool saldo_handler(TMask_field& f, KEY k); | ||||||
|   static bool cambio_handler(TMask_field& f, KEY k); |   static bool cambio_handler(TMask_field& f, KEY k); | ||||||
|   static bool datapag_handler(TMask_field& f, KEY k); |   static bool datapag_handler(TMask_field& f, KEY k); | ||||||
|   static bool conto_handler(TMask_field& f, KEY k); |   static bool conto_handler(TMask_field& f, KEY k); | ||||||
| @ -90,6 +91,7 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad, | |||||||
|   } |   } | ||||||
|   else   |   else   | ||||||
|     set_handler(S_IMPORTO, importo_handler);  |     set_handler(S_IMPORTO, importo_handler);  | ||||||
|  |   set_handler(S_SALDOACC, saldo_handler); | ||||||
|    |    | ||||||
|   real oldimp = oldpag.get_real(in_valuta ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO);    |   real oldimp = oldpag.get_real(in_valuta ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO);    | ||||||
|   if (!in_valuta) |   if (!in_valuta) | ||||||
| @ -225,7 +227,7 @@ bool TPay_mask::importo_handler(TMask_field& f, KEY k) | |||||||
|     if (m.field(S_RITENUTE).active()) |     if (m.field(S_RITENUTE).active()) | ||||||
|       i += real(m.get(S_RITENUTE)); |       i += real(m.get(S_RITENUTE)); | ||||||
|      |      | ||||||
|     if (i >= m._da_pagare && m.field(S_SALDOACC).active()) |     if (i >= m._da_pagare && m.mode() == NO_MODE && m.field(S_SALDOACC).active()) | ||||||
|       m.set(S_SALDOACC, "S"); |       m.set(S_SALDOACC, "S"); | ||||||
|      |      | ||||||
|     if (m.get(S_SALDOACC)[0] != 'S') |     if (m.get(S_SALDOACC)[0] != 'S') | ||||||
| @ -255,6 +257,21 @@ bool TPay_mask::importolire_handler(TMask_field& f, KEY k) | |||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool TPay_mask::saldo_handler(TMask_field& f, KEY k) | ||||||
|  | { | ||||||
|  |   if (k == K_SPACE) | ||||||
|  |   {            | ||||||
|  |     TMask& m = f.mask(); | ||||||
|  |     m.set_mode(MODE_QUERY); | ||||||
|  |     TMask_field& imp =  m.field(m.field(S_IMPORTOVAL).active() ? S_IMPORTOVAL : S_IMPORTO); | ||||||
|  |     imp.set_dirty(); | ||||||
|  |     imp.on_hit(); | ||||||
|  |     m.set_mode(NO_MODE); | ||||||
|  |   } | ||||||
|  |   return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| bool TPay_mask::cambio_handler(TMask_field& f, KEY k) | bool TPay_mask::cambio_handler(TMask_field& f, KEY k) | ||||||
| {              | {              | ||||||
|   if (k == K_TAB && f.focusdirty()) |   if (k == K_TAB && f.focusdirty()) | ||||||
| @ -607,7 +624,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k) | |||||||
|     gm.set(P_NUMERO, num); |     gm.set(P_NUMERO, num); | ||||||
|      |      | ||||||
|     TValuta cambio; |     TValuta cambio; | ||||||
|     bool in_valuta = FALSE; |     bool prima_valuta = FALSE; | ||||||
|        |        | ||||||
|     if (anno > 0) |     if (anno > 0) | ||||||
|     { |     { | ||||||
| @ -629,7 +646,9 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k) | |||||||
|           continue; |           continue; | ||||||
| 
 | 
 | ||||||
|         cambio.get(riga); |         cambio.get(riga); | ||||||
|         in_valuta = cambio.in_valuta(); |         const bool in_valuta = cambio.in_valuta(); | ||||||
|  |         if (in_valuta) | ||||||
|  |           prima_valuta = TRUE; | ||||||
|          |          | ||||||
|         riga_fattura.cut(0); |         riga_fattura.cut(0); | ||||||
|         riga_fattura.add(ri); |         riga_fattura.add(ri); | ||||||
| @ -799,15 +818,13 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k) | |||||||
|         delete game; |         delete game; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     if (in_valuta != gm._valfirst) |     if (prima_valuta != gm._valfirst) | ||||||
|     {  |     {  | ||||||
|       sheet.swap_columns(106, 107); // Scambia le colonne dell'importo in lire e in valuta
 |       sheet.swap_columns(106, 107); // Scambia le colonne dell'importo in lire e in valuta
 | ||||||
|       gm._valfirst = in_valuta; |       gm._valfirst = prima_valuta; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     sheet.force_update();        |     sheet.force_update();        | ||||||
|     if (sheet.selected() > 0) |  | ||||||
|       sheet.select(0); |  | ||||||
|   }    |   }    | ||||||
|   if (k == K_INS) |   if (k == K_INS) | ||||||
|   { |   { | ||||||
| @ -1049,9 +1066,17 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k) | |||||||
| #endif         | #endif         | ||||||
|     }   |     }   | ||||||
|     if (cambiato) |     if (cambiato) | ||||||
|  |     {                  | ||||||
|  |       if (game.ok()) | ||||||
|       { |       { | ||||||
|         gm.update_partita(game, gm._riga_partite); |         gm.update_partita(game, gm._riga_partite); | ||||||
|         partite_notify(gm.partite(), gm._riga_partite, K_TAB); |         partite_notify(gm.partite(), gm._riga_partite, K_TAB); | ||||||
|  |       } | ||||||
|  |       else | ||||||
|  |       { | ||||||
|  |         app().partite().destroy(game); | ||||||
|  |         gm.fill_partite(); | ||||||
|  |       }   | ||||||
|       gm._changed = TRUE; |       gm._changed = TRUE; | ||||||
|     }   |     }   | ||||||
|   } |   } | ||||||
| @ -1137,7 +1162,7 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k) | |||||||
|         gm._changed = TRUE; |         gm._changed = TRUE; | ||||||
|       } |       } | ||||||
|       else |       else | ||||||
|         app().partite().destroy(gm.conto(), anno, numero); |         app().partite().destroy(game); | ||||||
|       gm.fill_partite();         // Aggiorna sheet partite
 |       gm.fill_partite();         // Aggiorna sheet partite
 | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @ -1423,7 +1448,7 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co | |||||||
|       somma.put(PART_DATAPAG, m.get(S_DATAPAG));    // Aggiorna data pagamento (comune alla riga)
 |       somma.put(PART_DATAPAG, m.get(S_DATAPAG));    // Aggiorna data pagamento (comune alla riga)
 | ||||||
|       somma.put(PART_TIPOPAG, m.get(S_TIPOPAG));    // Aggiorna tipo pagamento (comune alla riga)
 |       somma.put(PART_TIPOPAG, m.get(S_TIPOPAG));    // Aggiorna tipo pagamento (comune alla riga)
 | ||||||
| #ifndef __EXTRA__ | #ifndef __EXTRA__ | ||||||
|       aggiorna_sorelle(somma); | //      aggiorna_sorelle(somma);                    // Tolta chiamata alla aggiorna sorelle lasciare la funzione perche potrebbe servire in futuro
 | ||||||
| #endif       | #endif       | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  | |||||||
| @ -1468,7 +1468,6 @@ void TPartita::sposta_riga(int r, TPartita& part) | |||||||
|       if (part.esiste(new_row, new_sca, nrigp))     // Se il pagamento esiste di gia'
 |       if (part.esiste(new_row, new_sca, nrigp))     // Se il pagamento esiste di gia'
 | ||||||
|       {   |       {   | ||||||
|         npg = part.pagamento(new_row, new_sca, nrigp); |         npg = part.pagamento(new_row, new_sca, nrigp); | ||||||
|         CHECK(npg.get_char(PAGSCA_ACCSAL) != 'S', "Can't add to soldered payment"); |  | ||||||
|         somma(pag, npg, PART_IMPORTO); |         somma(pag, npg, PART_IMPORTO); | ||||||
|         somma(pag, npg, PART_IMPORTOVAL);  |         somma(pag, npg, PART_IMPORTOVAL);  | ||||||
|         somma(pag, npg, PART_RITENUTE); |         somma(pag, npg, PART_RITENUTE); | ||||||
| @ -1616,6 +1615,12 @@ bool TPartite_array::destroy(const TBill& clifo, int anno, const char* num) | |||||||
|   return remove(k); |   return remove(k); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool TPartite_array::destroy(TPartita& game) | ||||||
|  | { | ||||||
|  |   const TString& k = key(game.conto(), game.anno(), game.numero()); | ||||||
|  |   return remove(k); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| bool TPartite_array::write(bool re) | bool TPartite_array::write(bool re) | ||||||
| {        | {        | ||||||
|   bool ok = TRUE; |   bool ok = TRUE; | ||||||
|  | |||||||
| @ -325,6 +325,7 @@ public: | |||||||
|   { return ((TPartite_array*)this)->find(part, FALSE); } |   { return ((TPartite_array*)this)->find(part, FALSE); } | ||||||
|    |    | ||||||
|   bool destroy(const TBill& clifo, int anno, const char* num); |   bool destroy(const TBill& clifo, int anno, const char* num); | ||||||
|  |   bool destroy(TPartita& game); | ||||||
|    |    | ||||||
|   bool write(bool re = FALSE); |   bool write(bool re = FALSE); | ||||||
|   bool rewrite() { return write(TRUE); } |   bool rewrite() { return write(TRUE); } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user