Migliorata gestione fattura P.A.:
flag di fattura temporanea (no P.A.) corretto calcolo rate in split payment git-svn-id: svn://10.65.10.50/branches/R_10_00@23099 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									d40707a134
								
							
						
					
					
						commit
						5618a1b489
					
				@ -1,33 +1,27 @@
 | 
				
			|||||||
#include <applicat.h>
 | 
					#include <applicat.h>
 | 
				
			||||||
#include <doc.h>
 | 
					 | 
				
			||||||
#include <mask.h>
 | 
					 | 
				
			||||||
#include <postman.h>
 | 
					#include <postman.h>
 | 
				
			||||||
#include <progind.h>
 | 
					#include <progind.h>
 | 
				
			||||||
#include <relation.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "ve5200.h"
 | 
					#include "ve5200.h"
 | 
				
			||||||
#include "velib.h"
 | 
					#include "velib04.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TStatus_mask : public TMask
 | 
					class TStatus_mask : public TMask
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  TStatus_mask() : TMask("ve5200") { }
 | 
					  TStatus_mask() : TMask("ve5200") { }
 | 
				
			||||||
  virtual ~TStatus_mask() { }
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TStatus_change : public TSkeleton_application
 | 
					class TStatus_change : public TSkeleton_application
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						virtual const char* extra_modules() const { return "dt"; }
 | 
				
			||||||
	virtual const char * extra_modules() const {return "dt";}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected: // TSkeleton_application
 | 
					protected: // TSkeleton_application
 | 
				
			||||||
  virtual void main_loop();
 | 
					  virtual void main_loop();
 | 
				
			||||||
  virtual bool create();
 | 
					  virtual bool create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  TStatus_change() { }
 | 
					  void do_elab( TDocumento& doc);
 | 
				
			||||||
  virtual ~TStatus_change() { }
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool TStatus_change::create()
 | 
					bool TStatus_change::create()
 | 
				
			||||||
@ -38,6 +32,56 @@ bool TStatus_change::create()
 | 
				
			|||||||
  return TSkeleton_application::create();
 | 
					  return TSkeleton_application::create();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TStatus_change::do_elab(TDocumento& doc)  // C 90
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TElaborazione * el = NULL;	
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					  const TString16 codelab = doc.tipo().elaborazione();
 | 
				
			||||||
 | 
						if (codelab.full())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						  const TRectype& eld = cache().get("%ELD", codelab);
 | 
				
			||||||
 | 
							if (!eld.empty())
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								switch (eld.get_int("I0"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								case _esterna :
 | 
				
			||||||
 | 
									el = new TElaborazione_esterna(eld);
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								case _consegna_ordini:
 | 
				
			||||||
 | 
									el = new TConsegna_ordini(eld);
 | 
				
			||||||
 | 
									break;	
 | 
				
			||||||
 | 
								case _fatturazione_bolle :
 | 
				
			||||||
 | 
									el = new TFatturazione_bolle(eld);
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								case _contabilizzazione :
 | 
				
			||||||
 | 
									el = new TContabilizzazione(eld);
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								case _copia_documento :
 | 
				
			||||||
 | 
									el = new TCopia_documento(eld);
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								case _generazione_effetti :
 | 
				
			||||||
 | 
									el = new TGenerazione_effetti(eld);
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								case _consuntivazione_produzione :
 | 
				
			||||||
 | 
									el = new TConsuntivazione_produzione(eld);
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								case _contabilizzazione_analitica :
 | 
				
			||||||
 | 
									el = new TContabilizzazione_analitica(eld);
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								default :
 | 
				
			||||||
 | 
									break;				 
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (el != NULL && el->is_document_ok(doc))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TLista_documenti in;	in.add(doc);
 | 
				
			||||||
 | 
							TLista_documenti out; 
 | 
				
			||||||
 | 
							el->elabora(in, out, TDate(TODAY), false);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TStatus_change::main_loop()
 | 
					void TStatus_change::main_loop()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TStatus_mask m;
 | 
					  TStatus_mask m;
 | 
				
			||||||
@ -59,40 +103,43 @@ void TStatus_change::main_loop()
 | 
				
			|||||||
    const long total = cur.items();
 | 
					    const long total = cur.items();
 | 
				
			||||||
    if (total > 0)
 | 
					    if (total > 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      TString msg = "Confermare l'aggiornamento di ";
 | 
					      TString msg = TR("Confermare l'aggiornamento di ");
 | 
				
			||||||
      msg.add_plural(total, "documento");
 | 
					      msg.add_plural(total, TR("documento"));
 | 
				
			||||||
      if (yesno_box(msg))
 | 
					      if (yesno_box(msg))
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        TProgind pi(total, "Elaborazione in corso...", TRUE, TRUE, 60);
 | 
					        TProgress_monitor pi(total, name());
 | 
				
			||||||
        const TString& finale = m.get(F_FINALE);
 | 
					        const TString& finale = m.get(F_FINALE);
 | 
				
			||||||
        TDocumento* doc = new TDocumento;
 | 
					        TDocumento* doc = new TDocumento;
 | 
				
			||||||
        rel.lfile().set_curr(doc);
 | 
					        rel.lfile().set_curr(doc);
 | 
				
			||||||
        cur.freeze();
 | 
					        cur.freeze();
 | 
				
			||||||
        for (cur = 0; cur.pos() < total && !pi.iscancelled(); ++cur)
 | 
					        for (cur = 0; cur.pos() < total; ++cur)
 | 
				
			||||||
        {      
 | 
					        {      
 | 
				
			||||||
          pi.addstatus(1);
 | 
					          if (!pi.add_status())
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
          doc->put(DOC_STATO, finale);
 | 
					          doc->put(DOC_STATO, finale);
 | 
				
			||||||
          doc->rewrite();
 | 
					          int err = doc->rewrite();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          if (err == NOERR)
 | 
				
			||||||
 | 
					            do_elab(*doc);
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
          // Invia anche la transazione se necessario
 | 
					          // Invia anche la transazione se necessario
 | 
				
			||||||
          if (::can_dispatch_transaction(*doc))
 | 
					          if (err = NOERR && ::can_dispatch_transaction(*doc))
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            TFilename tmpname; tmpname.temp();
 | 
					            TFilename tmpname; tmpname.tempdir(); tmpname.add("ve5trans.ini");
 | 
				
			||||||
            { // Parentesi strategiche
 | 
					            { // Parentesi strategiche
 | 
				
			||||||
              TConfig ini(tmpname, "Transaction");
 | 
					              TConfig ini(tmpname, "Transaction");
 | 
				
			||||||
              ini.set("Action", "MODIFY");
 | 
					              ini.set("Action", "MODIFY");
 | 
				
			||||||
              ini.set("Firm", get_firm());
 | 
					              ini.set("Firm", get_firm());
 | 
				
			||||||
              ini.set("Mode", "A");            
 | 
					              ini.set("Mode", "A");            
 | 
				
			||||||
              TString8 paradoc; paradoc.format("%d", LF_DOC);
 | 
					              ini.set_paragraph("33");
 | 
				
			||||||
              ini.set_paragraph(paradoc);
 | 
					              ini.set(DOC_PROVV,  doc->get(DOC_PROVV));    
 | 
				
			||||||
              ini.set(DOC_PROVV, doc->get(DOC_PROVV));    
 | 
					              ini.set(DOC_ANNO,   doc->get(DOC_ANNO));    
 | 
				
			||||||
              ini.set(DOC_ANNO, doc->get(DOC_ANNO));    
 | 
					 | 
				
			||||||
              ini.set(DOC_CODNUM, doc->get(DOC_CODNUM));    
 | 
					              ini.set(DOC_CODNUM, doc->get(DOC_CODNUM));    
 | 
				
			||||||
              ini.set(DOC_NDOC, doc->get(DOC_NDOC));    
 | 
					              ini.set(DOC_NDOC,   doc->get(DOC_NDOC));    
 | 
				
			||||||
              ini.set(DOC_STATO, finale);    
 | 
					              ini.set(DOC_STATO,  finale);    
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            ::dispatch_transaction(*doc, tmpname); 
 | 
					            ::dispatch_transaction(*doc, tmpname); 
 | 
				
			||||||
            ::remove(tmpname);
 | 
					            xvt_fsys_remove_file(tmpname);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -479,20 +479,19 @@ int TElaborazione::read(const char* cod)
 | 
				
			|||||||
bool TElaborazione::is_document_ok(const TRectype& doc) const
 | 
					bool TElaborazione::is_document_ok(const TRectype& doc) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	bool ok = false;
 | 
						bool ok = false;
 | 
				
			||||||
	const TString4 codnum(doc.get(DOC_CODNUM));
 | 
						const TString4 codnum  = doc.get(DOC_CODNUM);
 | 
				
			||||||
	const TString4 tipodoc(doc.get(DOC_TIPODOC));
 | 
					 | 
				
			||||||
	const char stato(doc.get_char(DOC_STATO));
 | 
					 | 
				
			||||||
	const TString& codnumel = codice_numerazione_iniziale();
 | 
						const TString& codnumel = codice_numerazione_iniziale();
 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (codnumel.blank() || codnum == codnumel)
 | 
						if (codnumel.blank() || codnum == codnumel)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
						  const TString4 tipodoc = doc.get(DOC_TIPODOC);
 | 
				
			||||||
 | 
						  const char stato = doc.get_char(DOC_STATO);
 | 
				
			||||||
		for (int i = 0; !ok && i < TElaborazione::_max_tipi_doc_elab; i++)
 | 
							for (int i = 0; !ok && i < TElaborazione::_max_tipi_doc_elab; i++)
 | 
				
			||||||
		{                
 | 
							{                
 | 
				
			||||||
			const TString & tipel = tipo_iniziale(i);
 | 
								const TString& tipel = tipo_iniziale(i);
 | 
				
			||||||
			if (tipel.blank())
 | 
					      if (tipel.blank())
 | 
				
			||||||
				break;
 | 
					        break;
 | 
				
			||||||
			if (tipodoc == tipel && stato == stato_iniziale(i))
 | 
					      const char stael = stato_iniziale(i);
 | 
				
			||||||
				ok = true;
 | 
								ok = tipodoc == tipel && stato == stael;
 | 
				
			||||||
		} 
 | 
							} 
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return ok;
 | 
						return ok;
 | 
				
			||||||
 | 
				
			|||||||
@ -143,9 +143,12 @@ void  TDocumentoEsteso::scadenze_recalc()
 | 
				
			|||||||
  real totimposte = imposta(TRUE);
 | 
					  real totimposte = imposta(TRUE);
 | 
				
			||||||
  real pagato = hh.get_real(DOC_IMPPAGATO);
 | 
					  real pagato = hh.get_real(DOC_IMPPAGATO);
 | 
				
			||||||
  const bool saldo = hh.get_bool(DOC_ACCSALDO);
 | 
					  const bool saldo = hh.get_bool(DOC_ACCSALDO);
 | 
				
			||||||
  real totimponibili = totale_doc() - ritenute() - totimposte - totspese;//tot_documento() - totimposte - totspese;
 | 
					  real totimponibili = totale_doc() - ritenute() - totimposte - totspese;
 | 
				
			||||||
  const bool is_in_valuta = in_valuta();
 | 
					  const bool is_in_valuta = in_valuta();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (is_split_payment())
 | 
				
			||||||
 | 
					    totimposte = ZERO;
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
  if (saldo || pagato > totale_doc())
 | 
					  if (saldo || pagato > totale_doc())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    totimponibili = ZERO;
 | 
					    totimponibili = ZERO;
 | 
				
			||||||
 | 
				
			|||||||
@ -84,3 +84,4 @@
 | 
				
			|||||||
#define F_ARCHIVE        275
 | 
					#define F_ARCHIVE        275
 | 
				
			||||||
#define F_SPMSP					 276
 | 
					#define F_SPMSP					 276
 | 
				
			||||||
#define F_REVLEN				 277
 | 
					#define F_REVLEN				 277
 | 
				
			||||||
 | 
					#define F_NOPA  				 278
 | 
				
			||||||
@ -130,7 +130,7 @@ END
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
BOOLEAN F_SAVEANDNEW
 | 
					BOOLEAN F_SAVEANDNEW
 | 
				
			||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT 2 15 "Rimani in inserimento dopo la registrazione"
 | 
					  PROMPT 2 15 "Rimanere in inserimento dopo la registrazione"
 | 
				
			||||||
  FIELD B4
 | 
					  FIELD B4
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -182,20 +182,25 @@ PAGE "Tipi documento validi" -1 -1 60 14
 | 
				
			|||||||
     PROMPT 2 2 "Tipo dei documenti "
 | 
					     PROMPT 2 2 "Tipo dei documenti "
 | 
				
			||||||
     FIELD I1
 | 
					     FIELD I1
 | 
				
			||||||
     ITEM "|Altro"
 | 
					     ITEM "|Altro"
 | 
				
			||||||
     MESSAGE ENABLE,F_EMRI
 | 
					       MESSAGE ENABLE,F_EMRI|HIDE,F_NOPA
 | 
				
			||||||
     ITEM "1|Bolla"
 | 
					     ITEM "1|Bolla"
 | 
				
			||||||
     MESSAGE CLEAR,F_EMRI
 | 
					       MESSAGE CLEAR,F_EMRI|HIDE,F_NOPA
 | 
				
			||||||
     ITEM "2|Fattura"
 | 
					     ITEM "2|Fattura"
 | 
				
			||||||
     MESSAGE ENABLE,F_EMRI
 | 
					       MESSAGE ENABLE,F_EMRI|SHOW,F_NOPA
 | 
				
			||||||
     ITEM "3|Ordine"
 | 
					     ITEM "3|Ordine"
 | 
				
			||||||
     MESSAGE CLEAR,F_EMRI
 | 
					       MESSAGE CLEAR,F_EMRI|HIDE,F_NOPA
 | 
				
			||||||
	 ITEM "4|Scontrino" 
 | 
						   ITEM "4|Scontrino" 
 | 
				
			||||||
	 MESSAGE ENABLE,F_EMRI
 | 
						     MESSAGE ENABLE,F_EMRI|HIDE,F_NOPA
 | 
				
			||||||
     ITEM "5|Conferimento soci"
 | 
					     ITEM "5|Conferimento soci"
 | 
				
			||||||
     MESSAGE CLEAR,F_EMRI
 | 
					       MESSAGE CLEAR,F_EMRI|HIDE,F_NOPA
 | 
				
			||||||
     ITEM "6|Prestazioni ai soci"
 | 
					     ITEM "6|Prestazioni ai soci"
 | 
				
			||||||
     MESSAGE CLEAR,F_EMRI
 | 
					       MESSAGE CLEAR,F_EMRI|HIDE,F_NOPA
 | 
				
			||||||
 | 
					   END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   BOOLEAN F_NOPA
 | 
				
			||||||
 | 
					   BEGIN
 | 
				
			||||||
 | 
					     PROMPT 2 3 "Fattura provvisioria (non valida per P.A.)"
 | 
				
			||||||
 | 
					     FIELD B10
 | 
				
			||||||
   END
 | 
					   END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   STRING F_TIPODOC1 4
 | 
					   STRING F_TIPODOC1 4
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user