Modifica relativa agli occasionali nella ricezione da PC, e modifica relativa al cambio di segno del totale documento dell'imponibile e dell'imposta in caso di nota credito e storno
git-svn-id: svn://10.65.10.50/trunk@2688 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									d2e2e9fb5f
								
							
						
					
					
						commit
						a4f1d08bc5
					
				| @ -1153,7 +1153,9 @@ void TRic_ListaMov::aggiorna_mov() | |||||||
|   mov.put(MOV_ANNOIVA,  _annoiva); |   mov.put(MOV_ANNOIVA,  _annoiva); | ||||||
|   mov.put(MOV_REG,      _registro); |   mov.put(MOV_REG,      _registro); | ||||||
|   mov.put(MOV_TIPODOC,  _tipodoc); |   mov.put(MOV_TIPODOC,  _tipodoc); | ||||||
|   mov.put(MOV_TIPO,     _tipocf); |   mov.put(MOV_TIPO,     _tipocf);  | ||||||
|  |   if (_tipodoc == "NC" || _tipodoc == "ST") | ||||||
|  |     _tot_doc = _tot_doc * -1; | ||||||
|   mov.put(MOV_TOTDOC,   _tot_doc); |   mov.put(MOV_TOTDOC,   _tot_doc); | ||||||
|    |    | ||||||
|   mov.rewrite(); |   mov.rewrite(); | ||||||
| @ -1175,6 +1177,11 @@ void TRic_ListaMov::aggiorna_iva(char tipo) | |||||||
|   TLocalisamfile& riva = current_cursor()->file(LF_RMOVIVA);  |   TLocalisamfile& riva = current_cursor()->file(LF_RMOVIVA);  | ||||||
|    |    | ||||||
| //  riva.put(RMI_ANNOES,     _annoese);
 | //  riva.put(RMI_ANNOES,     _annoese);
 | ||||||
|  |   if (_tipodoc == "NC" || _tipodoc == "ST") | ||||||
|  |   { | ||||||
|  |     _impo  = _impo * -1; | ||||||
|  |     _impos = _impos * -1; | ||||||
|  |   }   | ||||||
|   riva.put(RMI_IMPONIBILE, _impo); |   riva.put(RMI_IMPONIBILE, _impo); | ||||||
|   riva.put(RMI_IMPOSTA,    _impos);   |   riva.put(RMI_IMPOSTA,    _impos);   | ||||||
|   riva.put(RMI_TIPOC,      tipo); |   riva.put(RMI_TIPOC,      tipo); | ||||||
|  | |||||||
| @ -159,6 +159,7 @@ public: | |||||||
|   void  invio_righe_contabili(); |   void  invio_righe_contabili(); | ||||||
|   void  invio_righe_IVA(); |   void  invio_righe_IVA(); | ||||||
|   void  invio_occasionali(TString& record, TString& ocfpi); |   void  invio_occasionali(TString& record, TString& ocfpi); | ||||||
|  |   void  tipodocumento(long nreg,TString& tipodoc); | ||||||
|    |    | ||||||
|   TInv_cont(char mov); |   TInv_cont(char mov); | ||||||
| };                                       | };                                       | ||||||
|  | |||||||
| @ -744,8 +744,11 @@ void TInv_cont::invio_testata_movimenti() | |||||||
|     long codcf = _tmov->get_long(MOV_CODCF); |     long codcf = _tmov->get_long(MOV_CODCF); | ||||||
|     str.format("%06ld", codcf); |     str.format("%06ld", codcf); | ||||||
|     record.overwrite(str,174); |     record.overwrite(str,174); | ||||||
| 
 |      | ||||||
|     real totdoc (_tmov->get_real(MOV_TOTDOC));    |     TString tipodoc (_tmov->get(MOV_TIPODOC)); | ||||||
|  |     real totdoc (_tmov->get_real(MOV_TOTDOC)); | ||||||
|  |     if (tipodoc == "NC" || tipodoc =="ST") | ||||||
|  |       totdoc = totdoc * -1;    | ||||||
|     if (totdoc.sign() < 0)  |     if (totdoc.sign() < 0)  | ||||||
|     { |     { | ||||||
|       record.overwrite("-",180); |       record.overwrite("-",180); | ||||||
| @ -952,10 +955,25 @@ void TInv_cont::invio_righe_contabili() | |||||||
|   _tras_file.close();                       |   _tras_file.close();                       | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void TInv_cont::tipodocumento(long nreg, TString& tipodoc) | ||||||
|  | {                               | ||||||
|  |   TRecnotype rec = _tmov->recno(); | ||||||
|  |   TIsamtempfile&  tmov = *_tmov; | ||||||
|  |                                    | ||||||
|  |   tmov.setkey(1); | ||||||
|  |   tmov.zero(); | ||||||
|  |   tmov.put(MOV_NUMREG, nreg); | ||||||
|  |   if (tmov.read() == NOERR) | ||||||
|  |     tipodoc = tmov.get(MOV_TIPODOC); | ||||||
|  |    | ||||||
|  |   _tmov->readat(rec);   | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void TInv_cont::invio_righe_IVA() | void TInv_cont::invio_righe_IVA() | ||||||
| { | { | ||||||
|   int     size = 1024; |   int     size = 1024; | ||||||
|   TString record(size); |   TString record(size); | ||||||
|  |   long nreg_p = -1; | ||||||
|    |    | ||||||
|   long cicli = _triva->items(); |   long cicli = _triva->items(); | ||||||
|   _prog = new TProgind(cicli,"Movimenti Iva: generazione file TRASFER per PC\nPrego attendere.",FALSE); |   _prog = new TProgind(cicli,"Movimenti Iva: generazione file TRASFER per PC\nPrego attendere.",FALSE); | ||||||
| @ -984,8 +1002,14 @@ void TInv_cont::invio_righe_IVA() | |||||||
|     TString codiva = _triva->get(RMI_CODIVA); |     TString codiva = _triva->get(RMI_CODIVA); | ||||||
|     str.format("%-4s", (const char*) codiva); |     str.format("%-4s", (const char*) codiva); | ||||||
|     record.overwrite(str,60); |     record.overwrite(str,60); | ||||||
|      | 
 | ||||||
|  |     TString tipodoc = "";     | ||||||
|  |     if (nreg != nreg_p) | ||||||
|  |       tipodocumento(nreg,tipodoc); | ||||||
|  |     nreg_p = nreg;   | ||||||
|     real imponibile (_triva->get_real(RMI_IMPONIBILE)); |     real imponibile (_triva->get_real(RMI_IMPONIBILE)); | ||||||
|  |     if (tipodoc == "NC" || tipodoc =="ST") | ||||||
|  |       imponibile = imponibile * -1; | ||||||
|     if (imponibile.sign() < 0) |     if (imponibile.sign() < 0) | ||||||
|     { |     { | ||||||
|       record.overwrite("-",64); |       record.overwrite("-",64); | ||||||
| @ -997,6 +1021,8 @@ void TInv_cont::invio_righe_IVA() | |||||||
|     record.overwrite(str,65);                    //Imponibile
 |     record.overwrite(str,65);                    //Imponibile
 | ||||||
| 
 | 
 | ||||||
|     real imposta (_triva->get_real(RMI_IMPOSTA)); |     real imposta (_triva->get_real(RMI_IMPOSTA)); | ||||||
|  |     if (tipodoc == "NC" || tipodoc =="ST") | ||||||
|  |       imposta = imposta * -1;     | ||||||
|     if (imposta.sign() < 0) |     if (imposta.sign() < 0) | ||||||
|     { |     { | ||||||
|       record.overwrite("-",79); |       record.overwrite("-",79); | ||||||
|  | |||||||
| @ -4,7 +4,6 @@ | |||||||
| #include <progind.h> | #include <progind.h> | ||||||
| #include <stdlib.h>  | #include <stdlib.h>  | ||||||
| #include <extcdecl.h> | #include <extcdecl.h> | ||||||
| #include "cglib.h" |  | ||||||
| #include "cglib04.h" | #include "cglib04.h" | ||||||
| 
 | 
 | ||||||
| const int size  = 256;     //Lunghezza del record del TRASFER
 | const int size  = 256;     //Lunghezza del record del TRASFER
 | ||||||
| @ -1484,16 +1483,6 @@ void TTransfer_file::write_tmp_movPN(TString& record,bool create) | |||||||
|          |          | ||||||
|         if (fname == "TIPODOC") |         if (fname == "TIPODOC") | ||||||
|           tipodoc = field;           |           tipodoc = field;           | ||||||
|            |  | ||||||
|         if (fname == "TOTDOC") |  | ||||||
|         { |  | ||||||
|           if (tipodoc == "NC" || tipodoc == "ST") |  | ||||||
|           { |  | ||||||
|             real totdoc (field); |  | ||||||
|             totdoc = totdoc * -1; |  | ||||||
|             field = totdoc.string(); |  | ||||||
|           } |  | ||||||
|         }   |  | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       if (fname == "IMPORTO") |       if (fname == "IMPORTO") | ||||||
| @ -1781,15 +1770,6 @@ void TTransfer_file::write_tmp_movIVA(TString& record, bool create) | |||||||
|           int nriga = atoi(field); |           int nriga = atoi(field); | ||||||
|           field.format("%3d", nriga); |           field.format("%3d", nriga); | ||||||
|         }          |         }          | ||||||
|         if (fname == "IMPONIBILE" || fname == "IMPOSTA") |  | ||||||
|         {  |  | ||||||
|           if (tipodoc == "NC" || tipodoc == "ST") |  | ||||||
|           { |  | ||||||
|             real imp (field); |  | ||||||
|             imp = imp * -1; |  | ||||||
|             field = imp.string(); |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|       } |       } | ||||||
|        |        | ||||||
|       if (logicnum == LF_MOV && ( fname == "NUMREG" || flag == 2 ) )  |       if (logicnum == LF_MOV && ( fname == "NUMREG" || flag == 2 ) )  | ||||||
| @ -2919,8 +2899,18 @@ void TTransfer_file::write_testata_movimenti(TString& record) | |||||||
|       } |       } | ||||||
|        |        | ||||||
|       if (fname == MOV_OCFPI) |       if (fname == MOV_OCFPI) | ||||||
|         if (field.trim().empty())         |         if (field.trim().empty())   | ||||||
|           occas = FALSE;          |         { | ||||||
|  |           TString rags = record.sub(290,340); | ||||||
|  |           if (rags.trim().not_empty()) | ||||||
|  |           { | ||||||
|  |             TString app = "RIC"; | ||||||
|  |             _npoccas++; | ||||||
|  |             field.format("%3s%6d", (const char*)app,_npoccas);   | ||||||
|  |           } | ||||||
|  |           else | ||||||
|  |             occas = FALSE;          | ||||||
|  |         } | ||||||
|            |            | ||||||
|       if (flag == 2) |       if (flag == 2) | ||||||
|       { |       { | ||||||
| @ -3410,9 +3400,16 @@ const char* riconverti (TString& data_PC,bool anno_di_quattro) | |||||||
| int date2esc(const TDate& d, int* prevesc) | int date2esc(const TDate& d, int* prevesc) | ||||||
| {                    | {                    | ||||||
|   if (prevesc) *prevesc = 0; |   if (prevesc) *prevesc = 0; | ||||||
|   TEsercizi_contabili esc; |   TTable esc("ESC"); | ||||||
|   int e = esc.date2esc(d); |   for (int err = esc.first(); err == NOERR; err = esc.next()) | ||||||
|   if (prevesc) *prevesc = esc.pred(e); |   { | ||||||
|   return e; |     const TDate ia(esc.get("D0"));   // Data inizio esercizio
 | ||||||
|  |     const TDate fa(esc.get("D1"));   // Data fine esercizio
 | ||||||
|  |     const anno = esc.get_int("CODTAB");   | ||||||
|  |     if (d >= ia && d <= fa) | ||||||
|  |       return anno; | ||||||
|  |     if (prevesc) *prevesc = anno;  | ||||||
|  |   }  | ||||||
|  |   return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user