Patch level : 10.0
Files correlati : ve0.exe ve0100b.msk ve0100d.msk Ricompilazione Demo : [ ] Commento : X Euroforesi Corretta e migliorata gestione filtro per articoli in evasione ordini. Aggiunta possibilita' di de/selezionare tutti i documenti Riportata unità di misura in maschera evasione git-svn-id: svn://10.65.10.50/branches/R_10_00@21397 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									d46e00e5dd
								
							
						
					
					
						commit
						d2db578b36
					
				@ -1,6 +1,13 @@
 | 
			
		||||
#include "ve0100b1.h"
 | 
			
		||||
 | 
			
		||||
TOOLBAR "topbar" 0 0 0 2
 | 
			
		||||
 | 
			
		||||
BUTTON DLG_SELECT 2 2 
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 1 1 "Tutti"
 | 
			
		||||
  PICTURE TOOL_MULTISEL
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
#include <elabar.h>
 | 
			
		||||
ENDPAGE
 | 
			
		||||
 | 
			
		||||
@ -231,7 +238,7 @@ END
 | 
			
		||||
 | 
			
		||||
NUMBER F_QTA 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 51 8 "Qta' "
 | 
			
		||||
  PROMPT 52 8 "Quantità "
 | 
			
		||||
  GROUP GRP_ART
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,15 +5,10 @@
 | 
			
		||||
#include "velib.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CG2101_H
 | 
			
		||||
#include "../cg/cg2101.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CALIB01_H
 | 
			
		||||
#include "../ca/calib01.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TLista_documenti : public TObject  // velib04
 | 
			
		||||
{ 
 | 
			
		||||
  TArray _documenti;
 | 
			
		||||
 | 
			
		||||
@ -229,25 +229,25 @@ TConsegna_mask::TConsegna_mask(TConfig & c, int header_code, bool per_codice, bo
 | 
			
		||||
  if (header_code == 1)
 | 
			
		||||
  {                                   
 | 
			
		||||
    TString h; 
 | 
			
		||||
    h = "Quantita'\nconsegnata";
 | 
			
		||||
    h = HR("Quantita'\nconsegnata");
 | 
			
		||||
    s.set_column_header(S_QTARESIDUA, h);
 | 
			
		||||
    s.sheet_mask().field(S_QTARESIDUA).set_prompt("Q.ta' consegnata");
 | 
			
		||||
    s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Q.ta' consegnata"));
 | 
			
		||||
    
 | 
			
		||||
    h = "Quantita'\nda fatturare";
 | 
			
		||||
    h = HR("Quantita'\nda fatturare");
 | 
			
		||||
    s.set_column_header(S_QTADAEVADERE, h);
 | 
			
		||||
    s.sheet_mask().field(S_QTADAEVADERE).set_prompt("Q.ta' da fatturare");
 | 
			
		||||
    s.sheet_mask().field(S_QTADAEVADERE).set_prompt(PR("Q.ta' da fatturare"));
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    if (header_code == 2)
 | 
			
		||||
    {                                   
 | 
			
		||||
      TString h; 
 | 
			
		||||
      h = "Residuo";
 | 
			
		||||
      h = HR("Residuo");
 | 
			
		||||
      s.set_column_header(S_QTARESIDUA, h);
 | 
			
		||||
      s.sheet_mask().field(S_QTARESIDUA).set_prompt("Residuo         ");
 | 
			
		||||
      s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Residuo         "));
 | 
			
		||||
    
 | 
			
		||||
      h = "Da evadere";
 | 
			
		||||
      h = HR("Da evadere");
 | 
			
		||||
      s.set_column_header(S_QTADAEVADERE, h);
 | 
			
		||||
      s.sheet_mask().field(S_QTADAEVADERE).set_prompt("Da evadere        ");
 | 
			
		||||
      s.sheet_mask().field(S_QTADAEVADERE).set_prompt(PR("Da evadere        "));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	if (c.exist("CODAGG1"))
 | 
			
		||||
@ -345,11 +345,16 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
 | 
			
		||||
//      params().set("QUANTITA", ZERO);
 | 
			
		||||
    if (articolo.full())
 | 
			
		||||
		{
 | 
			
		||||
      m.show(F_UMQTA);
 | 
			
		||||
      m.set(F_UMQTA, params().get("UM"));
 | 
			
		||||
			m.show(F_QTA);
 | 
			
		||||
			m.set(F_QTA, params().get("QUANTITA"));
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
    {
 | 
			
		||||
      m.hide(F_UMQTA);
 | 
			
		||||
			m.hide(F_QTA);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ok = m.run() == K_ENTER;
 | 
			
		||||
    if (ok)
 | 
			
		||||
@ -561,7 +566,6 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
 | 
			
		||||
          {                                           
 | 
			
		||||
            const TString4 um(inrec.get(RDOC_UMQTA));
 | 
			
		||||
            const real qta = inrec.articolo().convert_to_um(daeva,  params().get("UM"), um);
 | 
			
		||||
 | 
			
		||||
            params().set("QUANTITA", params().get_real("QUANTITA") - qta);
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -33,5 +33,6 @@
 | 
			
		||||
#define F_RAGFOR    214
 | 
			
		||||
#define F_CODVAL    215
 | 
			
		||||
#define F_CAMBIO    216
 | 
			
		||||
#define F_QTA				217
 | 
			
		||||
#define F_UMQTA     217
 | 
			
		||||
#define F_QTA				218
 | 
			
		||||
#define F_ROWS      250
 | 
			
		||||
 | 
			
		||||
@ -152,6 +152,12 @@ BEGIN
 | 
			
		||||
  FLAGS "D"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING F_UMQTA 2
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 40 7 "U.M.   "
 | 
			
		||||
  FLAG "DU"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER F_CAMBIO 15 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 52 6 "Cambio "
 | 
			
		||||
@ -161,7 +167,7 @@ END
 | 
			
		||||
 | 
			
		||||
NUMBER F_QTA 13 5
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 52 7 "Qta'   "
 | 
			
		||||
  PROMPT 52 7 "Quantità "
 | 
			
		||||
  FLAGS "D"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										296
									
								
								ve/velib06.cpp
									
									
									
									
									
								
							
							
						
						
									
										296
									
								
								ve/velib06.cpp
									
									
									
									
									
								
							@ -2,6 +2,8 @@
 | 
			
		||||
#include <dongle.h>
 | 
			
		||||
#include <execp.h>
 | 
			
		||||
#include <modaut.h>
 | 
			
		||||
#include <multirel.h>
 | 
			
		||||
#include <occas.h> 
 | 
			
		||||
#include <postman.h>
 | 
			
		||||
#include <recset.h>
 | 
			
		||||
#include <smartcard.h>
 | 
			
		||||
@ -22,10 +24,8 @@
 | 
			
		||||
#include "veuml1.h"
 | 
			
		||||
#include "veini.h"
 | 
			
		||||
 | 
			
		||||
#include <multirel.h>
 | 
			
		||||
#include "../cg/cfban.h" 
 | 
			
		||||
#include "../ca/cfcms.h" 
 | 
			
		||||
#include <occas.h> 
 | 
			
		||||
#include "rcondv.h"  
 | 
			
		||||
#include "sconti.h"
 | 
			
		||||
 | 
			
		||||
@ -44,9 +44,7 @@ public:
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
bool TOriginal_row_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
			
		||||
{
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
{	return true; }
 | 
			
		||||
 | 
			
		||||
bool TOriginal_row_mask::on_key(KEY key)
 | 
			
		||||
{
 | 
			
		||||
@ -175,7 +173,7 @@ TDocumento_mask::TDocumento_mask(const char* td)
 | 
			
		||||
		const short pos = _sheet->cid2index(FR_LIV1 + i -1);
 | 
			
		||||
		if (_livelli_giac->enabled(i))
 | 
			
		||||
		{
 | 
			
		||||
			const TString & header = _livelli_giac->name(i);
 | 
			
		||||
			const TString& header = _livelli_giac->name(i);
 | 
			
		||||
			const int len = header.len() + 1;
 | 
			
		||||
			const int f_len = _livelli_giac->code_length(i);
 | 
			
		||||
			_sheet->set_column_header(pos, header);
 | 
			
		||||
@ -2343,6 +2341,46 @@ TLista_elaborazioni::~TLista_elaborazioni()
 | 
			
		||||
		delete _elab;
 | 
			
		||||
}	
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// Filtro per articolo
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
static TCodice_articolo _art_filter;
 | 
			
		||||
 | 
			
		||||
static bool rdoc_article_filter(const TRectype& rdoc)
 | 
			
		||||
{
 | 
			
		||||
  bool good = rdoc.get(RDOC_CODART) == _art_filter;
 | 
			
		||||
  if (good)
 | 
			
		||||
    good = !rdoc.get_bool(RDOC_RIGAEVASA);
 | 
			
		||||
  return good;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool doc_article_filter(const TRelation* rel)
 | 
			
		||||
{													
 | 
			
		||||
	bool yes = false;
 | 
			
		||||
  const TRectype& doc = rel->curr();
 | 
			
		||||
 | 
			
		||||
  TLocalisamfile rdoc(LF_RIGHEDOC); rdoc.setkey(5);
 | 
			
		||||
  rdoc.put(RDOC_CODART, _art_filter);
 | 
			
		||||
	rdoc.put(RDOC_CODNUM, doc.get(DOC_CODNUM));
 | 
			
		||||
	rdoc.put(RDOC_ANNO,	  doc.get(DOC_ANNO));
 | 
			
		||||
	rdoc.put(RDOC_PROVV,	doc.get(DOC_PROVV));
 | 
			
		||||
	rdoc.put(RDOC_NDOC,	  doc.get(DOC_NDOC));
 | 
			
		||||
	
 | 
			
		||||
	for (int err = rdoc.read(); err == NOERR; err = rdoc.next())
 | 
			
		||||
	{
 | 
			
		||||
		const TString& codart = rdoc.get(RDOC_CODART);
 | 
			
		||||
    if (codart != _art_filter || rdoc.get(RDOC_NDOC) != doc.get(DOC_NDOC))
 | 
			
		||||
			break;
 | 
			
		||||
		if (rdoc_article_filter(rdoc.curr()))
 | 
			
		||||
		{	 
 | 
			
		||||
			yes = true;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return yes;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TDocument_tree
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
@ -2355,7 +2393,6 @@ class TDocument_tree : public TBidirectional_tree
 | 
			
		||||
	bool _multiple_selection;
 | 
			
		||||
	TAssoc_array _selected_docs;
 | 
			
		||||
	TString _selected;
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
protected:				 
 | 
			
		||||
	virtual void node2id(const TObject* node, TString& id) const;
 | 
			
		||||
@ -2370,6 +2407,8 @@ public:
 | 
			
		||||
	bool multiple_selection() const { return _multiple_selection;}
 | 
			
		||||
	bool node_selected(const TObject* node = NULL) const;
 | 
			
		||||
	void select_node(const TObject* node = NULL, bool on = true);
 | 
			
		||||
  bool toggle_all_nodes();
 | 
			
		||||
 | 
			
		||||
	real select_doc(long numdoc);
 | 
			
		||||
	void build_doc_list(TLista_documenti & docs);
 | 
			
		||||
	void unselect_node(const TObject* node) { select_node(node, false);}
 | 
			
		||||
@ -2377,6 +2416,7 @@ public:
 | 
			
		||||
	virtual bool goto_firstson();
 | 
			
		||||
	virtual bool goto_rbrother(); 
 | 
			
		||||
	virtual bool goto_node(const TString &id);
 | 
			
		||||
  virtual bool could_have_son() const;
 | 
			
		||||
	virtual bool has_son() const;
 | 
			
		||||
	virtual bool has_rbrother() const;
 | 
			
		||||
	virtual bool has_father() const;
 | 
			
		||||
@ -2395,7 +2435,7 @@ public:
 | 
			
		||||
	const TRectype& record() const;
 | 
			
		||||
	const real totale_doc() const { TDocumento d(testata()); return d.totale_doc();}
 | 
			
		||||
 | 
			
		||||
	void set_cursor(char tipocf, long codcf, int anno, const char* filter, FILTERFUNCTION ff = NULL);
 | 
			
		||||
	void set_cursor(char tipocf, long codcf, int anno, const char* filter);
 | 
			
		||||
	TCursor* get_cursor() { return _cursor; }
 | 
			
		||||
 | 
			
		||||
	TDocument_tree();	
 | 
			
		||||
@ -2468,11 +2508,10 @@ bool TDocument_tree::node_selected(const TObject* node) const
 | 
			
		||||
 | 
			
		||||
void TDocument_tree::select_node(const TObject* node, bool on)
 | 
			
		||||
{
 | 
			
		||||
	TToken_string id;
 | 
			
		||||
 | 
			
		||||
	if (node == NULL)
 | 
			
		||||
		node = curr_node();
 | 
			
		||||
	
 | 
			
		||||
	TToken_string id;
 | 
			
		||||
	node2id(node, id);
 | 
			
		||||
	id = id.get(0);
 | 
			
		||||
	if (on)
 | 
			
		||||
@ -2482,10 +2521,23 @@ void TDocument_tree::select_node(const TObject* node, bool on)
 | 
			
		||||
	select(id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool find_doc(TTree& tree, void* jolly, word flags)
 | 
			
		||||
bool TDocument_tree::toggle_all_nodes()
 | 
			
		||||
{
 | 
			
		||||
	TDocument_tree & t = (TDocument_tree &) tree;
 | 
			
		||||
	if (!t.node_selected() && t.testata().get_long(DOC_NDOC) == *((long *) jolly))
 | 
			
		||||
  bool on = _selected_docs.empty() && _multiple_selection;
 | 
			
		||||
  _selected_docs.destroy();
 | 
			
		||||
  if (on)
 | 
			
		||||
  {
 | 
			
		||||
     for (bool ok = goto_root(); ok; ok = goto_rbrother())
 | 
			
		||||
       select_node(NULL, on);
 | 
			
		||||
     on = !_selected_docs.empty();
 | 
			
		||||
  }
 | 
			
		||||
  return on;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool find_doc(TTree& tree, void* jolly, word flags)
 | 
			
		||||
{
 | 
			
		||||
	TDocument_tree& t = (TDocument_tree&)tree;
 | 
			
		||||
	if (!t.node_selected() && t.testata().get_long(DOC_NDOC) == *((long*)jolly))
 | 
			
		||||
	{
 | 
			
		||||
		t.select_node();
 | 
			
		||||
		return true;
 | 
			
		||||
@ -2496,13 +2548,12 @@ bool find_doc(TTree& tree, void* jolly, word flags)
 | 
			
		||||
real TDocument_tree::select_doc(long numdoc)
 | 
			
		||||
{
 | 
			
		||||
	real val;
 | 
			
		||||
	if (goto_root())
 | 
			
		||||
		if (scan_depth_first(find_doc, (void *) &numdoc, SCAN_PRE_ORDER | SCAN_IGNORING_LEAVES))
 | 
			
		||||
			val = totale_doc();
 | 
			
		||||
	if (goto_root() && scan_depth_first(find_doc, &numdoc, SCAN_PRE_ORDER | SCAN_IGNORING_LEAVES))
 | 
			
		||||
	  val = totale_doc();
 | 
			
		||||
	return val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool add_to_list(TTree& tree, void* jolly, word flags)
 | 
			
		||||
static bool add_to_list(TTree& tree, void* jolly, word flags)
 | 
			
		||||
{
 | 
			
		||||
	TDocument_tree & t = (TDocument_tree &) tree;
 | 
			
		||||
	if (t.node_selected())
 | 
			
		||||
@ -2514,10 +2565,9 @@ bool add_to_list(TTree& tree, void* jolly, word flags)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TDocument_tree::build_doc_list(TLista_documenti & docs)
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
	if (goto_root())
 | 
			
		||||
		scan_depth_first(add_to_list, (void *) &docs, SCAN_PRE_ORDER | SCAN_IGNORING_LEAVES);
 | 
			
		||||
		scan_depth_first(add_to_list, &docs, SCAN_PRE_ORDER | SCAN_IGNORING_LEAVES);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TDocument_tree::goto_root()
 | 
			
		||||
@ -2528,14 +2578,24 @@ bool TDocument_tree::goto_root()
 | 
			
		||||
	return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Fundamental method working also when _art_filter.full()
 | 
			
		||||
bool TDocument_tree::goto_firstson()
 | 
			
		||||
{
 | 
			
		||||
	bool ok = has_son();
 | 
			
		||||
	if (ok)
 | 
			
		||||
		_curnode.add(1,1); 
 | 
			
		||||
  {
 | 
			
		||||
    int nriga = 1;
 | 
			
		||||
    if (_art_filter.full())
 | 
			
		||||
    {
 | 
			
		||||
      const TRectype& rec = _relation->curr(LF_RIGHEDOC);
 | 
			
		||||
      nriga = rec.get_int(RDOC_NRIGA);
 | 
			
		||||
    }
 | 
			
		||||
		_curnode.add(nriga,1); 
 | 
			
		||||
  }
 | 
			
		||||
	return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Fundamental method working also when _art_filter.full()
 | 
			
		||||
bool TDocument_tree::goto_rbrother()
 | 
			
		||||
{
 | 
			
		||||
	bool ok = has_rbrother();
 | 
			
		||||
@ -2558,60 +2618,78 @@ bool TDocument_tree::goto_rbrother()
 | 
			
		||||
bool TDocument_tree::goto_node(const TString &id)
 | 
			
		||||
{						
 | 
			
		||||
	_curnode = id;			
 | 
			
		||||
	return TRUE;
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Drawing speedup
 | 
			
		||||
bool TDocument_tree::could_have_son() const
 | 
			
		||||
{ return on_head(); }
 | 
			
		||||
 | 
			
		||||
// Fundamental method working also when _art_filter.full()
 | 
			
		||||
bool TDocument_tree::has_son() const
 | 
			
		||||
{
 | 
			
		||||
	bool ok = on_head();
 | 
			
		||||
	bool ok = could_have_son();
 | 
			
		||||
	if (ok)
 | 
			
		||||
	{	 
 | 
			
		||||
		testata();
 | 
			
		||||
		const TRectype& rec = _relation->curr(LF_RIGHEDOC);
 | 
			
		||||
		ok = rec.get_int(RDOC_NRIGA) > 0;
 | 
			
		||||
    if (_art_filter.full())
 | 
			
		||||
    {
 | 
			
		||||
      ok = rdoc_article_filter(rec);
 | 
			
		||||
      while (!ok && _relation->next_match(LF_RIGHEDOC))
 | 
			
		||||
        ok = rdoc_article_filter(rec);
 | 
			
		||||
    }
 | 
			
		||||
	}
 | 
			
		||||
	return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Fundamental method working also when _art_filter.full()
 | 
			
		||||
bool TDocument_tree::has_rbrother() const
 | 
			
		||||
{
 | 
			
		||||
	bool ok = FALSE;
 | 
			
		||||
	bool ok = false;
 | 
			
		||||
	if (on_head())
 | 
			
		||||
	{
 | 
			
		||||
		TDocument_tree& me = (TDocument_tree&)*this;
 | 
			
		||||
		const long pos = me._curnode.get_long(0);
 | 
			
		||||
		long pos = 0; _curnode.get(0, pos);
 | 
			
		||||
		ok = pos < _cursor->items()-1;
 | 
			
		||||
	} 
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		riga(); // Posizionati sulla riga corrente
 | 
			
		||||
		ok = _relation->next_match(LF_RIGHEDOC);
 | 
			
		||||
    if (_art_filter.full())
 | 
			
		||||
    {
 | 
			
		||||
      const TRectype& rec = _relation->curr(LF_RIGHEDOC);
 | 
			
		||||
      while (!ok && _relation->next_match(LF_RIGHEDOC))
 | 
			
		||||
        ok = rdoc_article_filter(rec);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
		  ok = _relation->next_match(LF_RIGHEDOC);
 | 
			
		||||
	}
 | 
			
		||||
	return ok;
 | 
			
		||||
} 
 | 
			
		||||
 | 
			
		||||
// Pleonastic method working also when _art_filter.full()
 | 
			
		||||
bool TDocument_tree::has_father() const
 | 
			
		||||
{
 | 
			
		||||
	return on_row();
 | 
			
		||||
}
 | 
			
		||||
{	return on_row(); }
 | 
			
		||||
 | 
			
		||||
// Pleonastic method not working when _art_filter.full()
 | 
			
		||||
bool TDocument_tree::has_lbrother() const
 | 
			
		||||
{
 | 
			
		||||
	bool ok = FALSE;
 | 
			
		||||
	TDocument_tree& me = (TDocument_tree&)*this;
 | 
			
		||||
	bool ok = false;
 | 
			
		||||
	if (on_head())
 | 
			
		||||
	{
 | 
			
		||||
		const long pos = me._curnode.get_long(0);
 | 
			
		||||
		long pos = 0; _curnode.get(0, pos);
 | 
			
		||||
		ok = pos > 0L;
 | 
			
		||||
	} 
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		const int nriga = me._curnode.get_int(1);
 | 
			
		||||
		int nriga = 0; _curnode.get(1, nriga);
 | 
			
		||||
		ok = nriga > 1;
 | 
			
		||||
	}
 | 
			
		||||
	return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Pleonastic method not working when _art_filter.full()
 | 
			
		||||
bool TDocument_tree::goto_father()
 | 
			
		||||
{
 | 
			
		||||
	bool ok = on_row();
 | 
			
		||||
@ -2620,6 +2698,7 @@ bool TDocument_tree::goto_father()
 | 
			
		||||
	return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Pleonastic method not working when _art_filter.full()
 | 
			
		||||
bool TDocument_tree::goto_lbrother()
 | 
			
		||||
{
 | 
			
		||||
	bool ok = has_lbrother();
 | 
			
		||||
@ -2755,10 +2834,10 @@ bool TDocument_tree::get_description(TString& str) const
 | 
			
		||||
			append_custom_fields(tipo, rec, str);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return TRUE;
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TDocument_tree::set_cursor(char tipocf, long codcf, int anno, const char* filter, FILTERFUNCTION ff)
 | 
			
		||||
void TDocument_tree::set_cursor(char tipocf, long codcf, int anno, const char* filter)
 | 
			
		||||
{ 
 | 
			
		||||
	if (_relation == NULL)
 | 
			
		||||
	{
 | 
			
		||||
@ -2779,20 +2858,23 @@ void TDocument_tree::set_cursor(char tipocf, long codcf, int anno, const char* f
 | 
			
		||||
	_cursor->setfilter(""); // Force cursor rebuild
 | 
			
		||||
	_cursor->setfilter(filter);
 | 
			
		||||
	_cursor->setregion(rec, rec);
 | 
			
		||||
	_cursor->set_filterfunction(ff);
 | 
			
		||||
	const long items = _cursor->items();
 | 
			
		||||
 | 
			
		||||
  if (_art_filter.full())
 | 
			
		||||
	  _cursor->set_filterfunction(doc_article_filter);
 | 
			
		||||
  else
 | 
			
		||||
    _cursor->set_filterfunction(NULL);
 | 
			
		||||
 | 
			
		||||
  const long items = _cursor->items();
 | 
			
		||||
	_cursor->freeze(true);
 | 
			
		||||
	
 | 
			
		||||
	goto_root();
 | 
			
		||||
	if (items <= 3)
 | 
			
		||||
	if (items == 1)
 | 
			
		||||
		expand_all();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TDocument_tree::TDocument_tree() 
 | 
			
		||||
							: _relation(NULL), _cursor(NULL), _multiple_selection(false)
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
{ }
 | 
			
		||||
 
 | 
			
		||||
TDocument_tree::~TDocument_tree()
 | 
			
		||||
{
 | 
			
		||||
@ -2817,10 +2899,6 @@ class TElabora_mask : public TAutomask
 | 
			
		||||
	
 | 
			
		||||
// @access Protected Member
 | 
			
		||||
protected:				
 | 
			
		||||
	TString _art_filter, _liv_filter;
 | 
			
		||||
	static TElabora_mask* _myself;
 | 
			
		||||
	static bool article_filter(const TRelation* rel);
 | 
			
		||||
 | 
			
		||||
	void add_valuta_filter(TString& filter) const;
 | 
			
		||||
	
 | 
			
		||||
	void docrif_search();
 | 
			
		||||
@ -2840,8 +2918,6 @@ public:
 | 
			
		||||
	virtual ~TElabora_mask() {} 
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
TElabora_mask* TElabora_mask::_myself = NULL;
 | 
			
		||||
 | 
			
		||||
bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
			
		||||
{
 | 
			
		||||
	switch (o.dlg())
 | 
			
		||||
@ -2862,14 +2938,15 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
 | 
			
		||||
				if (ne == 0)
 | 
			
		||||
					set(F_TYPE, "");
 | 
			
		||||
			}
 | 
			
		||||
			update_ndoc_filter(TRUE);
 | 
			
		||||
			update_ndoc_filter(true);
 | 
			
		||||
			const bool add_to_doc = o.get().not_empty();
 | 
			
		||||
  		    TElaborazione * e = curr_elab();
 | 
			
		||||
  		TElaborazione * e = curr_elab();
 | 
			
		||||
			const bool external = e != NULL && e->tipo() == _esterna;
 | 
			
		||||
      const bool is_search = o.get().empty() || field(F_CODCF_ELAB).empty() || external || add_to_doc;
 | 
			
		||||
			
 | 
			
		||||
			o.mask().field(F_NDOC_ELAB).check_type(is_search ? CHECK_SEARCH : CHECK_NORMAL);
 | 
			
		||||
			_tree.multiple_selection(add_to_doc);
 | 
			
		||||
      
 | 
			
		||||
			bool check_tot = false;
 | 
			
		||||
			if (add_to_doc)
 | 
			
		||||
			{
 | 
			
		||||
@ -2906,7 +2983,7 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
 | 
			
		||||
		break;
 | 
			
		||||
	case F_ELAB:
 | 
			
		||||
		if (e == fe_modify)
 | 
			
		||||
			update_ndoc_filter(TRUE);
 | 
			
		||||
			update_ndoc_filter(true);
 | 
			
		||||
		break;
 | 
			
		||||
	case F_ANNO_ELAB:
 | 
			
		||||
		if (e == fe_modify)
 | 
			
		||||
@ -2941,7 +3018,7 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
 | 
			
		||||
				if (ndoc > 0L)
 | 
			
		||||
				{
 | 
			
		||||
					real val = _tree.select_doc(ndoc);
 | 
			
		||||
					if (val != ZERO)
 | 
			
		||||
					if (!val.is_zero())
 | 
			
		||||
					{
 | 
			
		||||
						val += o.mask().get_real(F_TOTSEL);
 | 
			
		||||
						o.mask().set(F_TOTSEL, val);
 | 
			
		||||
@ -2950,10 +3027,9 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
 | 
			
		||||
			}
 | 
			
		||||
		break;
 | 
			
		||||
	case F_ROWS:
 | 
			
		||||
        if (e == fe_modify && is_running()) 
 | 
			
		||||
    if (e == fe_modify && is_running()) 
 | 
			
		||||
		{								
 | 
			
		||||
			TString id;
 | 
			
		||||
 | 
			
		||||
			_tree.curr_id(id);
 | 
			
		||||
			_tree.select(id);
 | 
			
		||||
			if (is_running() && !_tree.multiple_selection())
 | 
			
		||||
@ -3001,13 +3077,10 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
 | 
			
		||||
			if (!rec.empty())
 | 
			
		||||
			{
 | 
			
		||||
				TFilename tempfile;
 | 
			
		||||
 | 
			
		||||
				tempfile.temp("ve0");
 | 
			
		||||
				tempfile.ext("ini");
 | 
			
		||||
 | 
			
		||||
				{
 | 
			
		||||
					TConfig configfile(tempfile);
 | 
			
		||||
 | 
			
		||||
					configfile.set("Action", "Modify", "Transaction");
 | 
			
		||||
					configfile.set("NDOC", rec.get(DOC_NDOC), "33");
 | 
			
		||||
					configfile.set(DOC_PROVV, rec.get(DOC_PROVV), "33");
 | 
			
		||||
@ -3026,10 +3099,30 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
  case DLG_SELECT:
 | 
			
		||||
    if (e == fe_button)
 | 
			
		||||
    {
 | 
			
		||||
      TTree_field& tf = tfield(F_ROWS);
 | 
			
		||||
      if (tf.active() && _tree.multiple_selection())
 | 
			
		||||
      {
 | 
			
		||||
        TWait_cursor hourglass;
 | 
			
		||||
        const bool sel = _tree.toggle_all_nodes();
 | 
			
		||||
        if (_check_fld > DLG_NULL)
 | 
			
		||||
        {
 | 
			
		||||
           real tot;
 | 
			
		||||
           for (bool ok = _tree.goto_root(); ok && sel; ok = _tree.goto_rbrother())
 | 
			
		||||
             tot += _tree.totale_doc();
 | 
			
		||||
           set(_check_fld, tot.string());
 | 
			
		||||
        }
 | 
			
		||||
        tf.win().force_update(); 
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
    break;
 | 
			
		||||
	default:
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	return TRUE;	
 | 
			
		||||
	return true;	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int TElabora_mask::update_list()
 | 
			
		||||
@ -3162,7 +3255,6 @@ bool TElabora_mask::elabora()
 | 
			
		||||
			}	
 | 
			
		||||
		}
 | 
			
		||||
		delete newdoc;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
@ -3216,22 +3308,6 @@ bool TElabora_mask::elabora()
 | 
			
		||||
		set(F_NUMDOCRIF_ELAB, "");
 | 
			
		||||
				((TDocumento_mask *)_main)->set_focus_field(F_SHEET);
 | 
			
		||||
	}				 
 | 
			
		||||
	/* if (e->tipo() == _consegna_ordini)
 | 
			
		||||
	{
 | 
			
		||||
		TParametri_elaborazione& p = e->params();
 | 
			
		||||
		if (p.get("ARTICOLO").not_empty())
 | 
			
		||||
		{
 | 
			
		||||
			real qta = get_real(F_QTA);
 | 
			
		||||
			if (qta > ZERO)
 | 
			
		||||
			{
 | 
			
		||||
				const real qta_evasa = p.get_real("QUANTITA");
 | 
			
		||||
				qta -= qta_evasa;
 | 
			
		||||
				set(F_QTA, qta);
 | 
			
		||||
			} 
 | 
			
		||||
		}
 | 
			
		||||
	} */
 | 
			
		||||
	
 | 
			
		||||
//	delete newdoc;
 | 
			
		||||
 | 
			
		||||
	// Azzera l'anno in caso di ordini
 | 
			
		||||
	if (in.items() > 0 && in[0].is_ordine()) 
 | 
			
		||||
@ -3252,34 +3328,6 @@ TElaborazione * TElabora_mask::curr_elab()
 | 
			
		||||
	return cod_elab.not_empty() ? &_elab[cod_elab] : NULL;
 | 
			
		||||
}		 
 | 
			
		||||
 | 
			
		||||
bool TElabora_mask::article_filter(const TRelation* rel)
 | 
			
		||||
{													
 | 
			
		||||
	bool yes = false;
 | 
			
		||||
	TElabora_mask& m = *_myself;
 | 
			
		||||
	TLocalisamfile rdoc(LF_RIGHEDOC);
 | 
			
		||||
	rdoc.put(RDOC_CODNUM, rel->curr().get(DOC_CODNUM));
 | 
			
		||||
	rdoc.put(RDOC_ANNO,	 rel->curr().get(DOC_ANNO));
 | 
			
		||||
	rdoc.put(RDOC_PROVV,	rel->curr().get(DOC_PROVV));
 | 
			
		||||
	rdoc.put(RDOC_NDOC,	 rel->curr().get(DOC_NDOC));
 | 
			
		||||
	rdoc.put(RDOC_NRIGA,	1);
 | 
			
		||||
	int next_riga = 1;
 | 
			
		||||
	for (int err = rdoc.read(); err == NOERR; err = rdoc.next())
 | 
			
		||||
	{
 | 
			
		||||
		const int nriga = rdoc.get_int(RDOC_NRIGA);
 | 
			
		||||
		if (nriga != next_riga)
 | 
			
		||||
			break;
 | 
			
		||||
		next_riga++;	
 | 
			
		||||
		const bool evasa= rdoc.get_bool(RDOC_RIGAEVASA);
 | 
			
		||||
		const TString& codart = rdoc.get(RDOC_CODART);
 | 
			
		||||
		if (!evasa && codart == m._art_filter)
 | 
			
		||||
		{	 
 | 
			
		||||
			yes = true;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return yes;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TElabora_mask::add_valuta_filter(TString& filter) const
 | 
			
		||||
{																						 
 | 
			
		||||
	TString16 valuta = get(F_CODVAL_ELAB);
 | 
			
		||||
@ -3313,6 +3361,8 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
 | 
			
		||||
	const bool enable_group_doc = e != NULL && e->tipo() != _generazione_effetti && e->tipo() != _contabilizzazione;
 | 
			
		||||
	show(-GRP_DOC, enable_group_doc);
 | 
			
		||||
 | 
			
		||||
  enable(DLG_SELECT, aggiungi_doc_att && enable_group_doc); // Attiva la selezione multipla se possibile
 | 
			
		||||
 | 
			
		||||
	if (e != NULL)
 | 
			
		||||
	{
 | 
			
		||||
		if (aggiungi_doc_att)
 | 
			
		||||
@ -3332,16 +3382,16 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
 | 
			
		||||
			const TString8 num_in = e->codice_numerazione_iniziale(); 
 | 
			
		||||
			if (elab_changed)
 | 
			
		||||
			{ 
 | 
			
		||||
				const TString16 tipo_in(e->tipo_iniziale(0));
 | 
			
		||||
				const TString4 tipo_in(e->tipo_iniziale(0));
 | 
			
		||||
				const char stato_in = e->stato_iniziale(0);
 | 
			
		||||
 | 
			
		||||
				set(F_CODNUM_ELAB, num_in);
 | 
			
		||||
				field(F_CODNUM_ELAB).check();
 | 
			
		||||
				set(F_TIPODOC_ELAB , tipo_in);
 | 
			
		||||
				field(F_TIPODOC_ELAB).check();
 | 
			
		||||
				set(F_CODNUM_ELAB, num_in, 0x2);
 | 
			
		||||
				//field(F_CODNUM_ELAB).check();   // sostituito da 0x2
 | 
			
		||||
				set(F_TIPODOC_ELAB , tipo_in, 0x2);
 | 
			
		||||
				//field(F_TIPODOC_ELAB).check();  // sostituito da 0x2
 | 
			
		||||
				TString8 si; si << stato_in;
 | 
			
		||||
				set(F_STATODOC_ELAB, si);
 | 
			
		||||
				field(F_STATODOC_ELAB).check();
 | 
			
		||||
				set(F_STATODOC_ELAB, si, 0x2);
 | 
			
		||||
				//field(F_STATODOC_ELAB).check(); // sostituito da 0x2
 | 
			
		||||
	
 | 
			
		||||
				// Azzero anno di elaaborazione quando ho a che fare con degli ordini				
 | 
			
		||||
				const TTipo_documento& tipodocin = 	cached_tipodoc(tipo_in);
 | 
			
		||||
@ -3351,7 +3401,7 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
 | 
			
		||||
 | 
			
		||||
			if (!field(F_TIPODOC_ELAB).empty())																	 
 | 
			
		||||
			{ 
 | 
			
		||||
				const TString16 tipo(get(F_TIPODOC_ELAB));
 | 
			
		||||
				const TString4 tipo(get(F_TIPODOC_ELAB));
 | 
			
		||||
				TString80 td; td.format("&&(TIPODOC==\"%s\")", (const char *)tipo);
 | 
			
		||||
				filter << td;
 | 
			
		||||
				const TString& stato = get(F_STATODOC_ELAB);
 | 
			
		||||
@ -3361,11 +3411,11 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					bool almost_one = FALSE;
 | 
			
		||||
					bool almost_one = false;
 | 
			
		||||
																					 
 | 
			
		||||
					for (int i = 0; i < TElaborazione::_max_tipi_doc_elab; i++)
 | 
			
		||||
					{
 | 
			
		||||
						const TString16 tipo_in(e->tipo_iniziale(i));
 | 
			
		||||
						const TString4 tipo_in(e->tipo_iniziale(i));
 | 
			
		||||
						const char stato_in = e->stato_iniziale(i);
 | 
			
		||||
							
 | 
			
		||||
						if (tipo == tipo_in && stato_in > '0')
 | 
			
		||||
@ -3445,20 +3495,19 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
 | 
			
		||||
	brew.set_filter(filter);
 | 
			
		||||
	
 | 
			
		||||
	_art_filter = get(F_CODART);
 | 
			
		||||
  if (!aggiungi_doc_att || _art_filter.blank())
 | 
			
		||||
    _art_filter.cut(0);
 | 
			
		||||
 | 
			
		||||
	TCursor* cursor = brew.cursor();
 | 
			
		||||
	if (_art_filter.not_empty() && aggiungi_doc_att)
 | 
			
		||||
		cursor->set_filterfunction(article_filter);
 | 
			
		||||
	if (_art_filter.full() && aggiungi_doc_att)
 | 
			
		||||
		cursor->set_filterfunction(doc_article_filter);
 | 
			
		||||
	else
 | 
			
		||||
		cursor->set_filterfunction(NULL);
 | 
			
		||||
		
 | 
			
		||||
	TTree_field& tf = tfield(F_ROWS); 
 | 
			
		||||
	if (!field(F_TIPODOC_ELAB).empty() && e != NULL)
 | 
			
		||||
	{
 | 
			
		||||
		if (aggiungi_doc_att && _art_filter.not_empty())
 | 
			
		||||
			_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter, article_filter);
 | 
			
		||||
		else	
 | 
			
		||||
			_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter);
 | 
			
		||||
  	_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter);
 | 
			
		||||
		tf.set_tree(&_tree);
 | 
			
		||||
 | 
			
		||||
    TToken_string header(256, '\n');
 | 
			
		||||
@ -3469,13 +3518,8 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
 | 
			
		||||
		else
 | 
			
		||||
			header << "  Quantità";
 | 
			
		||||
		tf.set_header(header);
 | 
			
		||||
		
 | 
			
		||||
    if (aggiungi_doc_att && _art_filter.full())
 | 
			
		||||
      _tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter, article_filter);
 | 
			
		||||
    else  
 | 
			
		||||
      _tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter);
 | 
			
		||||
		
 | 
			
		||||
		if (aggiungi_doc_att)	 // GF20059	
 | 
			
		||||
 | 
			
		||||
    if (aggiungi_doc_att)	 // GF20059	
 | 
			
		||||
		{
 | 
			
		||||
			TCursor& cur = *_tree.get_cursor();
 | 
			
		||||
			if (cur.items() == 1) // Propone l'unico documento possibile
 | 
			
		||||
@ -3542,8 +3586,6 @@ void TElabora_mask::docrif_search()
 | 
			
		||||
TElabora_mask::TElabora_mask(TDocumento_mask& main_mask)
 | 
			
		||||
						 : TAutomask("ve0100b"), _main(&main_mask), _last_elab(NULL), _check_fld(-883)
 | 
			
		||||
{																						
 | 
			
		||||
	_myself = this;
 | 
			
		||||
	
 | 
			
		||||
	const TDate oggi(TODAY);
 | 
			
		||||
	set(F_ANNO_ELAB, oggi.year());	//anno della datadoc proposta (risolve bug 0000331)
 | 
			
		||||
	set(F_TIPOCF_ELAB, _main->get(F_TIPOCF));																								 
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user