Patch level : 10.0
Files correlati : ve?.exe tp0.exe Ricompilazione Demo : [ ] Commento : Potenziata gestione campi virtuali CONAI su righe documento git-svn-id: svn://10.65.10.50/trunk@19319 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									ab09d1e972
								
							
						
					
					
						commit
						eabdb76945
					
				
							
								
								
									
										57
									
								
								ve/velib.h
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								ve/velib.h
									
									
									
									
									
								
							@ -21,10 +21,6 @@ class TViswin;
 | 
			
		||||
#include "../ve/verig.h"
 | 
			
		||||
#endif
 | 
			
		||||
                          
 | 
			
		||||
#ifndef __RELAPP_H
 | 
			
		||||
#include <relapp.h>
 | 
			
		||||
#endif
 | 
			
		||||
                    
 | 
			
		||||
#ifndef __CGLIB01_H
 | 
			
		||||
#include "../cg/cglib01.h"
 | 
			
		||||
#endif
 | 
			
		||||
@ -57,15 +53,15 @@ class TSelect_color_mask;
 | 
			
		||||
#include "../cg/cg2101.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define RIGA_MERCE 'M'
 | 
			
		||||
#define RIGA_SPESEDOC 'S'
 | 
			
		||||
#define RIGA_PRESTAZIONI 'P'
 | 
			
		||||
#define RIGA_RISORSE 'R'
 | 
			
		||||
#define RIGA_MERCE        'M'
 | 
			
		||||
#define RIGA_SPESEDOC     'S'
 | 
			
		||||
#define RIGA_PRESTAZIONI  'P'
 | 
			
		||||
#define RIGA_RISORSE      'R'
 | 
			
		||||
#define RIGA_ATTREZZATURE 'A'
 | 
			
		||||
#define RIGA_SCONTI 'C'
 | 
			
		||||
#define RIGA_OMAGGI 'O'
 | 
			
		||||
#define RIGA_DESCRIZIONI 'D'
 | 
			
		||||
#define RIGA_RETTIFICHE 'T'
 | 
			
		||||
#define RIGA_SCONTI       'C'
 | 
			
		||||
#define RIGA_OMAGGI       'O'
 | 
			
		||||
#define RIGA_DESCRIZIONI  'D'
 | 
			
		||||
#define RIGA_RETTIFICHE   'T'
 | 
			
		||||
 | 
			
		||||
#define MAX_IVA_SLICES 5
 | 
			
		||||
 | 
			
		||||
@ -468,13 +464,29 @@ public:
 | 
			
		||||
	virtual ~TTipo_riga_documento() { }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const char * get_conai_contr_name(int type);
 | 
			
		||||
bool conai_configured_type(int type);
 | 
			
		||||
const char * get_conai_peso_name(int type);
 | 
			
		||||
short get_conai_peso_field(int type);
 | 
			
		||||
const char * get_conai_sottocat_name(int type);
 | 
			
		||||
short get_conai_sottocat_field(int type);
 | 
			
		||||
int id2conai_type(short id);
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// Gestione CONAI
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
enum TCONAI_type { CONAI_NONE=-1, CONAI_FIRST=0,
 | 
			
		||||
  CONAI_ACC=0, CONAI_ACCIAIO  =0,  
 | 
			
		||||
  CONAI_ALL=1, CONAI_ALLUMINIO=1, 
 | 
			
		||||
  CONAI_CAR=2, CONAI_CARTA    =2,
 | 
			
		||||
  CONAI_PLA=3, CONAI_PLASTICA =3,
 | 
			
		||||
  CONAI_LEG=4, CONAI_LEGNO    =4,
 | 
			
		||||
  CONAI_VET=5, CONAI_VETRO    =5,
 | 
			
		||||
  CONAI_LAST=5, CONAI_CATEGORIES=6
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
TCONAI_type conai_str2type(const char* str);
 | 
			
		||||
const char* conai_contr_name(TCONAI_type type);
 | 
			
		||||
bool conai_configured_type(TCONAI_type type);
 | 
			
		||||
const char* conai_peso_name(TCONAI_type type);
 | 
			
		||||
const char* conai_sottocat_name(TCONAI_type type);
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TRiga_documento
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
class TRiga_documento : public TAuto_variable_rectype	// velib02
 | 
			
		||||
{
 | 
			
		||||
@ -584,7 +596,7 @@ public:
 | 
			
		||||
  virtual real quantita_mag() const;
 | 
			
		||||
  virtual real qtaevasa_mag() const;
 | 
			
		||||
  virtual real qtaresidua_mag() const;
 | 
			
		||||
  real calc_conai_qta(int type) const;
 | 
			
		||||
  real calc_conai_qta(TCONAI_type type) const;
 | 
			
		||||
 | 
			
		||||
	real valore(bool totale, bool lordo = false, int ndec = AUTO_DECIMALS) const;
 | 
			
		||||
	const TString & codice_costo() const;
 | 
			
		||||
@ -763,7 +775,7 @@ public:
 | 
			
		||||
	bool tipo_valido() const { return get("TIPODOC").not_empty(); }
 | 
			
		||||
	const TTipo_documento& tipo() const;
 | 
			
		||||
	int tipo_riclassificato() const;
 | 
			
		||||
    static const TCodice_numerazione& codice_numerazione(const char * numerazione);
 | 
			
		||||
  static const TCodice_numerazione& codice_numerazione(const char * numerazione);
 | 
			
		||||
	const TCodice_numerazione& codice_numerazione() const;
 | 
			
		||||
	void set_tipo(const char * tipo) { head().put("TIPODOC", tipo);}
 | 
			
		||||
	bool provvisorio() const { return get_char("PROVV") == 'P'; }
 | 
			
		||||
@ -814,7 +826,7 @@ public:
 | 
			
		||||
	TPagamento & pagamento();
 | 
			
		||||
 | 
			
		||||
	void update_spese_aut(TString_array & spese, bool preserve_old = FALSE, TSheet_field * sh = NULL);
 | 
			
		||||
	real calc_conai_qta(int type);
 | 
			
		||||
	real calc_conai_qta(TCONAI_type type);
 | 
			
		||||
	void update_conai();
 | 
			
		||||
 | 
			
		||||
	bool is_generic() const { return tipo_valido() && tipo().is_generic(); }
 | 
			
		||||
@ -1004,7 +1016,6 @@ public:
 | 
			
		||||
	
 | 
			
		||||
	void sel_color();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	TDocumento_mask(const char* tipodoc);
 | 
			
		||||
	virtual ~TDocumento_mask();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										109
									
								
								ve/velib02.cpp
									
									
									
									
									
								
							
							
						
						
									
										109
									
								
								ve/velib02.cpp
									
									
									
									
									
								
							@ -80,8 +80,8 @@ void TTipo_riga_documento::read_formule()
 | 
			
		||||
	_fields_to_update = profile.get("FIELDSTOUPDATE");
 | 
			
		||||
	_field_list = profile.get("FIELDLIST");
 | 
			
		||||
	_header = profile.get("HEADER");
 | 
			
		||||
	_select_clifo =  profile.get_bool("SELCLIFO", NULL, -1, true);
 | 
			
		||||
	_no_desc =  profile.get_bool("NODESC");
 | 
			
		||||
	_select_clifo = profile.get_bool("SELCLIFO", NULL, -1, true);
 | 
			
		||||
	_no_desc = profile.get_bool("NODESC");
 | 
			
		||||
  _formule = profile.get("CAMPICALC");
 | 
			
		||||
 | 
			
		||||
  const TString& calcoli = profile.get("CALCOLI");
 | 
			
		||||
@ -786,74 +786,73 @@ real TRiga_documento::qtaresidua_mag() const
 | 
			
		||||
  }
 | 
			
		||||
  return ZERO;
 | 
			
		||||
}
 | 
			
		||||
	const char * get_conai_contr_name(int type)
 | 
			
		||||
	{
 | 
			
		||||
	  const char* const __conai_contr_names[] = {"CONACC", "CONALL", "CONCAR", "CONPLA", "CONLEG", "CONVET"};
 | 
			
		||||
 | 
			
		||||
		return __conai_contr_names[type];
 | 
			
		||||
TCONAI_type conai_str2type(const char* code)
 | 
			
		||||
{
 | 
			
		||||
  TCONAI_type ct = CONAI_NONE;
 | 
			
		||||
  if (code && *code)
 | 
			
		||||
  {
 | 
			
		||||
    switch(code[0])
 | 
			
		||||
    {
 | 
			
		||||
    case 'A': ct = code[1] == 'L' ? CONAI_ALL : CONAI_ACC; break;
 | 
			
		||||
    case 'C': ct = CONAI_CAR; break;
 | 
			
		||||
    case 'L': ct = CONAI_LEG; break;
 | 
			
		||||
    case 'P': ct = CONAI_PLA; break;
 | 
			
		||||
    case 'V': ct = CONAI_VET; break;
 | 
			
		||||
    default: break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return ct;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Controlla attivazione di una categoria CONAI
 | 
			
		||||
bool conai_configured_type(TCONAI_type type) 
 | 
			
		||||
{
 | 
			
		||||
	static TBit_array* __con_conf = NULL;
 | 
			
		||||
	
 | 
			
		||||
	if (__con_conf == NULL)
 | 
			
		||||
	{
 | 
			
		||||
    __con_conf = new TBit_array;
 | 
			
		||||
	  const char* const __conai_conf_names[CONAI_CATEGORIES] = {"CONFACC", "CONFALL", "CONFCAR", "CONFPLA", "CONFLEG", "CONFVET"};
 | 
			
		||||
		TConfig c(CONFIG_DITTA, "ve");
 | 
			
		||||
		for (int i = CONAI_FIRST; i <= CONAI_LAST; i++)
 | 
			
		||||
			(*__con_conf).set(i, c.get_bool(__conai_conf_names[i]));
 | 
			
		||||
	}
 | 
			
		||||
  
 | 
			
		||||
	bool conai_configured_type(int type) 
 | 
			
		||||
	{
 | 
			
		||||
		static bool __con_conf_read = false;
 | 
			
		||||
		static TBit_array __con_conf;
 | 
			
		||||
  return type >= CONAI_FIRST && type <= CONAI_LAST && (*__con_conf)[type];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		if (!__con_conf_read)
 | 
			
		||||
		{
 | 
			
		||||
		  const char* const __conai_conf_names[] = {"CONFACC", "CONFALL", "CONFCAR", "CONFPLA", "CONFLEG", "CONFVET"};
 | 
			
		||||
			__con_conf_read = true;
 | 
			
		||||
			TConfig c(CONFIG_DITTA, "ve");
 | 
			
		||||
			for (int i = 0; i < 6; i++)
 | 
			
		||||
				__con_conf.set(i, c.get_bool(__conai_conf_names[i]));
 | 
			
		||||
		}
 | 
			
		||||
		return	__con_conf[type];
 | 
			
		||||
	}
 | 
			
		||||
// Campi virtuali per contributo CONAI
 | 
			
		||||
const char* conai_contr_name(TCONAI_type type)
 | 
			
		||||
{
 | 
			
		||||
  const char* const __conai_contr_names[] = {"CONACC", "CONALL", "CONCAR", "CONPLA", "CONLEG", "CONVET"};
 | 
			
		||||
  return (type >= CONAI_FIRST && type <= CONAI_LAST) ? __conai_contr_names[type] : "";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
	const char * get_conai_peso_name(int type)
 | 
			
		||||
	{
 | 
			
		||||
	  const char* const __conai_peso_names[] = {"PUNACC", "PUNALL", "PUNCAR", "PUNPLA", "PUNLEG", "PUNVET"};
 | 
			
		||||
// Campi virtuali per peso CONAI su RDOC in Kg
 | 
			
		||||
const char* conai_peso_name(TCONAI_type type)
 | 
			
		||||
{
 | 
			
		||||
  const char* const __conai_peso_names[] = {"PUNACC", "PUNALL", "PUNCAR", "PUNPLA", "PUNLEG", "PUNVET"};
 | 
			
		||||
  return conai_configured_type(type) ? __conai_peso_names[type] : "";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		if (conai_configured_type(type))
 | 
			
		||||
			return __conai_peso_names[type];
 | 
			
		||||
		return "";
 | 
			
		||||
	}
 | 
			
		||||
// Campi virtuali per sottocategoria CONAI su RDOC
 | 
			
		||||
const char* conai_sottocat_name(TCONAI_type type)
 | 
			
		||||
{
 | 
			
		||||
  const char* const __conai_scat_names[] = {"SCAACC", "SCAALL", "SCACAR", "SCAPLA", "SCALEG", "SCAVET"};
 | 
			
		||||
  return conai_configured_type(type) ? __conai_scat_names[type] : "";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
	short get_conai_peso_field(int type)
 | 
			
		||||
	{
 | 
			
		||||
			return FR_PUNACC + 2 * type;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const char * get_conai_sottocat_name(int type)
 | 
			
		||||
	{
 | 
			
		||||
	  const char* const __conai_scat_names[] = {"SCAACC", "SCAALL", "SCACAR", "SCAPLA", "SCALEG", "SCAVET"};
 | 
			
		||||
	
 | 
			
		||||
		if (conai_configured_type(type))
 | 
			
		||||
			return __conai_scat_names[type];
 | 
			
		||||
		return "";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	short get_conai_sottocat_field(int type)
 | 
			
		||||
	{
 | 
			
		||||
		return FR_SCAACC + 2 * type;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	int id2conai_type(short id)
 | 
			
		||||
	{ 
 | 
			
		||||
		return (int) (id - FR_SCAACC) / 2;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
real TRiga_documento::calc_conai_qta(int type) const
 | 
			
		||||
real TRiga_documento::calc_conai_qta(TCONAI_type type) const
 | 
			
		||||
{  
 | 
			
		||||
	real qta = ZERO;
 | 
			
		||||
 | 
			
		||||
	if (is_merce() && conai_configured_type(type))
 | 
			
		||||
	{
 | 
			
		||||
	  TArticolo & art = articolo();
 | 
			
		||||
	  const TString4 um = get(RDOC_UMQTA);
 | 
			
		||||
 | 
			
		||||
		qta = art.convert_to_um(get_real(RDOC_QTA), NULL, um);
 | 
			
		||||
		qta *= get_real(get_conai_peso_name(type));
 | 
			
		||||
		qta *= get_real(conai_peso_name(type));
 | 
			
		||||
  } 
 | 
			
		||||
	return qta;
 | 
			
		||||
}   
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,5 @@
 | 
			
		||||
#include <applicat.h>
 | 
			
		||||
#include <diction.h>
 | 
			
		||||
#include <dongle.h>
 | 
			
		||||
#include <modaut.h>
 | 
			
		||||
#include <tabutil.h>
 | 
			
		||||
@ -2642,7 +2644,7 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
 | 
			
		||||
  put(DOC_SPESEUPD, true);
 | 
			
		||||
}
 | 
			
		||||
                                   
 | 
			
		||||
real TDocumento::calc_conai_qta(int type)
 | 
			
		||||
real TDocumento::calc_conai_qta(TCONAI_type type)
 | 
			
		||||
{                                     
 | 
			
		||||
	real qta;
 | 
			
		||||
 | 
			
		||||
@ -2664,28 +2666,25 @@ void TDocumento::update_conai()
 | 
			
		||||
  {
 | 
			
		||||
    const TRectype& cfven = clifor().vendite();
 | 
			
		||||
    const bool cli_add_conai = cfven.get_bool("ADDCONAI");
 | 
			
		||||
    const char* const conai_mat[6] = { "Acciaio", "Alluminio", "Carta", "Plastica", "Legno", "Vetro" };
 | 
			
		||||
    const char* const conai_mat[CONAI_CATEGORIES] = { "Acciaio", "Alluminio", "Carta", "Plastica", "Legno", "Vetro" };
 | 
			
		||||
	  const char * const __conai_cf_names[] = {"ESACC", "ESALL", "ESCAR", "ESPLA", "ESLEG", "ESVET"};
 | 
			
		||||
    
 | 
			
		||||
		const TDate datadoc = get(DOC_DATADOC);
 | 
			
		||||
		const TDate dataes = cfven.get(CFV_DATAECONAI);
 | 
			
		||||
		bool esponi_esenti = false;
 | 
			
		||||
	
 | 
			
		||||
    TString_array conai_sp(6);   // Codici spesa conai
 | 
			
		||||
    TString_array conai_sp(CONAI_CATEGORIES);   // Codici spesa conai
 | 
			
		||||
    {
 | 
			
		||||
      const char* const conai_cod[6] = { "CODACC", "CODALL", "CODCAR", "CODPLA", "CODLEG", "CODVET" };
 | 
			
		||||
      const char* const conai_cod[CONAI_CATEGORIES] = { "CODACC", "CODALL", "CODCAR", "CODPLA", "CODLEG", "CODVET" };
 | 
			
		||||
      TConfig c(CONFIG_DITTA, "ve");    
 | 
			
		||||
      for (int i = 0; i < 6; i++)
 | 
			
		||||
        conai_sp.add(c.get(conai_cod[i]));
 | 
			
		||||
			
 | 
			
		||||
			esponi_esenti = c.get_bool("ESPONIESENTI");
 | 
			
		||||
    }                          
 | 
			
		||||
    bool updated[6] = {false,false,false,false,false,false}; 
 | 
			
		||||
    
 | 
			
		||||
    const int nrows = physical_rows();
 | 
			
		||||
    int i;
 | 
			
		||||
    
 | 
			
		||||
    for (i = nrows; i > 0; i--)     
 | 
			
		||||
    bool updated[CONAI_CATEGORIES] = {false,false,false,false,false,false};     
 | 
			
		||||
    for (int i = physical_rows(); i > 0; i--)     
 | 
			
		||||
    {
 | 
			
		||||
      TRiga_documento& r = row(i);   
 | 
			
		||||
      const bool tipo_conai = r.get_char("GENTIPO") == 'C';
 | 
			
		||||
@ -2694,9 +2693,9 @@ void TDocumento::update_conai()
 | 
			
		||||
      if (tipo_conai)
 | 
			
		||||
      {     
 | 
			
		||||
				const TString& cod = r.get(RDOC_CODART);
 | 
			
		||||
				const int pos = conai_sp.find(cod);
 | 
			
		||||
				const TCONAI_type pos = (TCONAI_type)conai_sp.find(cod);
 | 
			
		||||
   
 | 
			
		||||
				if (pos >= 0)
 | 
			
		||||
				if (pos >= CONAI_FIRST && pos <= CONAI_LAST)
 | 
			
		||||
				{  
 | 
			
		||||
					if (cli_add_conai)
 | 
			
		||||
					{
 | 
			
		||||
@ -2730,23 +2729,23 @@ void TDocumento::update_conai()
 | 
			
		||||
      const TString4 cod_iva_cli = codesiva()	;
 | 
			
		||||
      TSpesa_prest sp;
 | 
			
		||||
  
 | 
			
		||||
			for (i = 0; i < 6; i++)
 | 
			
		||||
			for (TCONAI_type ct = CONAI_FIRST; ct <= CONAI_LAST; ct=TCONAI_type(ct+1))
 | 
			
		||||
			{
 | 
			
		||||
				if (!updated[i])
 | 
			
		||||
				if (!updated[ct])
 | 
			
		||||
				{            
 | 
			
		||||
					real perc_esenz = cfven.get_real(__conai_cf_names[i]);
 | 
			
		||||
					real qta = calc_conai_qta(i);
 | 
			
		||||
					real perc_esenz = cfven.get_real(__conai_cf_names[ct]);
 | 
			
		||||
					real qta = calc_conai_qta(ct);
 | 
			
		||||
					const bool cli_esente = (esponi_esenti) && (perc_esenz == CENTO);
 | 
			
		||||
 | 
			
		||||
					if (!cli_esente)
 | 
			
		||||
						qta = qta * (CENTO - perc_esenz) / CENTO;  // More precise
 | 
			
		||||
					if (qta > ZERO)
 | 
			
		||||
					{            
 | 
			
		||||
						const TString & s = conai_sp.row(i);
 | 
			
		||||
						const TString& s = conai_sp.row(ct);
 | 
			
		||||
 | 
			
		||||
						if (sp.read(s) != NOERR)
 | 
			
		||||
							message_box("Il codice spesa CONAI %s specificato nei parametri ditta e' assente: '%s'", 
 | 
			
		||||
													conai_mat[i], (const char*)s);
 | 
			
		||||
													conai_mat[ct], (const char*)s);
 | 
			
		||||
						else 
 | 
			
		||||
						{
 | 
			
		||||
							const TString4 tipo = sp.tipo_riga(); 
 | 
			
		||||
 | 
			
		||||
@ -1,9 +1,6 @@
 | 
			
		||||
#include "velib04.h"
 | 
			
		||||
#include "velib04d.h"
 | 
			
		||||
 | 
			
		||||
#include <automask.h>
 | 
			
		||||
#include <doc.h>
 | 
			
		||||
#include <rdoc.h>
 | 
			
		||||
#include <recset.h>
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
@ -458,25 +455,25 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
        }  
 | 
			
		||||
					memo.insert(riferimento);
 | 
			
		||||
      }
 | 
			
		||||
				rout.put(RDOC_DESCLUNGA, memo.len() > 50);
 | 
			
		||||
        rout.put(RDOC_DESCR, memo.left(50));
 | 
			
		||||
        rout.put(RDOC_DESCEST, memo.mid(50));
 | 
			
		||||
				memo.insert(riferimento);
 | 
			
		||||
      }
 | 
			
		||||
			rout.put(RDOC_DESCLUNGA, memo.len() > 50);
 | 
			
		||||
      rout.put(RDOC_DESCR, memo.left(50));
 | 
			
		||||
      rout.put(RDOC_DESCEST, memo.mid(50));
 | 
			
		||||
    }
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
      TToken_string campi_riga(80);   
 | 
			
		||||
      const bool ragg_rig = raggruppa_righe();
 | 
			
		||||
    TToken_string campi_riga(80);   
 | 
			
		||||
    const bool ragg_rig = raggruppa_righe();
 | 
			
		||||
    
 | 
			
		||||
      if (ragg_rig)
 | 
			
		||||
      {
 | 
			
		||||
        campi_riga = "CODART|LIVELLO|UMQTA";  // Uguali sempre
 | 
			
		||||
        // Uguali opzionalmente
 | 
			
		||||
        if (riga_uguale(0)) campi_riga.add("CODMAG");
 | 
			
		||||
        if (riga_uguale(1)) campi_riga.add("CODIVA");
 | 
			
		||||
        if (riga_uguale(2)) campi_riga.add("PREZZO|SCONTO");
 | 
			
		||||
      }
 | 
			
		||||
    if (ragg_rig)
 | 
			
		||||
    {
 | 
			
		||||
      campi_riga = "CODART|LIVELLO|UMQTA";  // Uguali sempre
 | 
			
		||||
      // Uguali opzionalmente
 | 
			
		||||
      if (riga_uguale(0)) campi_riga.add("CODMAG");
 | 
			
		||||
      if (riga_uguale(1)) campi_riga.add("CODIVA");
 | 
			
		||||
      if (riga_uguale(2)) campi_riga.add("PREZZO|SCONTO");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	  const bool evadi = outdoc.tipo().da_evadere();
 | 
			
		||||
 | 
			
		||||
@ -677,8 +674,6 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
 | 
			
		||||
			m->mask2doc();
 | 
			
		||||
			outdoc = m->doc();
 | 
			
		||||
			delete m;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (nettifica())
 | 
			
		||||
 | 
			
		||||
@ -5,9 +5,7 @@
 | 
			
		||||
#include <modaut.h>
 | 
			
		||||
#include <postman.h>
 | 
			
		||||
#include <recset.h>
 | 
			
		||||
#include <sheet.h>
 | 
			
		||||
#include <smartcard.h>
 | 
			
		||||
#include <tabutil.h>
 | 
			
		||||
#include <tree.h>
 | 
			
		||||
#include <treectrl.h>
 | 
			
		||||
#include <urldefid.h>
 | 
			
		||||
@ -26,9 +24,9 @@
 | 
			
		||||
#include "veini.h"
 | 
			
		||||
 | 
			
		||||
#include <multirel.h>
 | 
			
		||||
#include "sconti.h"
 | 
			
		||||
#include "rcondv.h"  
 | 
			
		||||
#include <occas.h> 
 | 
			
		||||
#include "rcondv.h"  
 | 
			
		||||
#include "sconti.h"
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TOriginal_row_mask
 | 
			
		||||
@ -69,6 +67,22 @@ TColor_rule::TColor_rule(const char* desc, const char* expr, TTypeexp type, COLO
 | 
			
		||||
  _key.replace(' ', '_');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// Gestione campi CONAI su maschera righe
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
short conai_peso_id(TCONAI_type type)
 | 
			
		||||
{ return type >= CONAI_FIRST && type <= TCONAI_LAST ? FR_PUNACC + 2 * type : DLG_NULL; }
 | 
			
		||||
 | 
			
		||||
short conai_sottocat_id(TCONAI_type type)
 | 
			
		||||
{ return type >= CONAI_FIRST && type <= TCONAI_LAST ? FR_SCAACC + 2*type : DLG_NULL; }
 | 
			
		||||
 | 
			
		||||
TCONAI_type conai_id2type(short id)
 | 
			
		||||
{ 
 | 
			
		||||
  const TCONAI_type t = (id-FR_SCAACC) / 2;
 | 
			
		||||
  return type >= CONAI_FIRST && type <= TCONAI_LAST ? t : CONAI_NONE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TDocumento_mask
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
@ -509,14 +523,14 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
 | 
			
		||||
	to_delete.set(0L);
 | 
			
		||||
	to_delete.reset(1);
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i <= 5; i++)
 | 
			
		||||
	for (TCONAI_type ct = CONAI_FIRST; ct <= CONAI_LAST; ct++)
 | 
			
		||||
	{
 | 
			
		||||
		const short posc = get_conai_sottocat_field(i);
 | 
			
		||||
		const short posp = get_conai_peso_field(i);
 | 
			
		||||
		const short posc = conai_sottocat_id(ct);
 | 
			
		||||
		const short posp = conai_peso_id(ct);
 | 
			
		||||
		const int colc = sheet.cid2index(posc);
 | 
			
		||||
		const int colp = sheet.cid2index(posp);
 | 
			
		||||
 | 
			
		||||
		if (conai_configured_type(i))
 | 
			
		||||
		if (conai_configured_type(ct))
 | 
			
		||||
		{
 | 
			
		||||
			to_delete.reset(colc);
 | 
			
		||||
			if (colonne.find(format("%d", posc)) < 0)
 | 
			
		||||
@ -966,10 +980,7 @@ void TDocumento_mask::cli2mask(bool force_load)
 | 
			
		||||
	//gestione contratti
 | 
			
		||||
	bool gescontr = ven_rec.get_bool(CFV_GESTCONTR);
 | 
			
		||||
	if (gescontr)
 | 
			
		||||
	{
 | 
			
		||||
		TConfig ditta(CONFIG_DITTA, "ve");
 | 
			
		||||
		gescontr = ditta.get_bool("GES", "ve", 2);					
 | 
			
		||||
	}
 | 
			
		||||
		gescontr = ini_get_bool(CONFIG_DITTA, "ve", "GES", false, 2);					
 | 
			
		||||
	
 | 
			
		||||
	enable(F_CODCONT1, gescontr);
 | 
			
		||||
	enable(F_CODCONT, gescontr);
 | 
			
		||||
@ -977,9 +988,10 @@ void TDocumento_mask::cli2mask(bool force_load)
 | 
			
		||||
 | 
			
		||||
void TDocumento_mask::sconto_testa2mask()
 | 
			
		||||
{
 | 
			
		||||
	TCli_for & c = doc().clifor(); 
 | 
			
		||||
	TConfig ditta(CONFIG_DITTA, "ve");
 | 
			
		||||
	const char tipogestione = ditta.get("GESSCO", "ve")[ 0 ];
 | 
			
		||||
	const TCli_for& c = doc().clifor(); 
 | 
			
		||||
 | 
			
		||||
  TConfig ditta(CONFIG_DITTA, "ve");
 | 
			
		||||
	const char tipogestione = ditta.get("GESSCO")[ 0 ];
 | 
			
		||||
	switch( tipogestione )
 | 
			
		||||
	{
 | 
			
		||||
		case 'N':	// Sconti non gestiti: pussa via!
 | 
			
		||||
@ -1011,6 +1023,7 @@ void TDocumento_mask::sconto_testa2mask()
 | 
			
		||||
				sconti.setkey(1);
 | 
			
		||||
				sconti.zero();
 | 
			
		||||
				sconti.put("TIPO", "I");
 | 
			
		||||
 | 
			
		||||
				if(ditta.get_bool("SCOKEY", "ve", 1))
 | 
			
		||||
					sconti.put("CODCAT", ven_rec.get(CFV_CATVEN));
 | 
			
		||||
				if(ditta.get_bool("SCOKEY", "ve", 2))
 | 
			
		||||
@ -3810,3 +3823,4 @@ void TDocumento_mask::sel_color()
 | 
			
		||||
		highlight();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -44,4 +44,9 @@ bool fido_hndl(TMask_field& field, KEY key);
 | 
			
		||||
 | 
			
		||||
bool tipodoc_ok(const TString & tipodoc);
 | 
			
		||||
 | 
			
		||||
TCONAI_type conai_id2type(short id);
 | 
			
		||||
short conai_get_peso_field(TCONAI_type type);
 | 
			
		||||
short conai_get_sottocat_field(TCONAI_type type);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user