Patch level : 10.0
Files correlati : ve0.exe ve0100n.msk vetbnar.msk Ricompilazione Demo : [ ] Commento : Aggiunto supporto per note articolo git-svn-id: svn://10.65.10.50/branches/R_10_00@21650 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
54ff580f71
commit
9da797d43f
12
ve/ve0100n.h
Executable file
12
ve/ve0100n.h
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#ifndef __VE0100N_H
|
||||||
|
#define __VE0100N_H
|
||||||
|
|
||||||
|
#define N_CHECKED 101
|
||||||
|
#define N_TYPE 102
|
||||||
|
#define N_NOTE 103
|
||||||
|
|
||||||
|
// Maschera note articolo
|
||||||
|
#define N_NOTES 201
|
||||||
|
#define N_WHERE 202
|
||||||
|
|
||||||
|
#endif
|
81
ve/ve0100n.uml
Executable file
81
ve/ve0100n.uml
Executable file
@ -0,0 +1,81 @@
|
|||||||
|
#include "ve0100n.h"
|
||||||
|
|
||||||
|
PAGE "Note articolo" -1 -1 70 20
|
||||||
|
|
||||||
|
LIST N_WHERE 1 32
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 0 "Copia note selezionate "
|
||||||
|
ITEM "A|dopo la riga selezionata"
|
||||||
|
ITEM "B|prima della riga selezionata"
|
||||||
|
END
|
||||||
|
|
||||||
|
SPREADSHEET N_NOTES 66 15
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 ""
|
||||||
|
ITEM "@1B"
|
||||||
|
ITEM "Tipo"
|
||||||
|
ITEM "Nota@50"
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
TOOLBAR "botbar" 0 -2 0 2
|
||||||
|
|
||||||
|
BUTTON DLG_SAVEREC 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -14 -1 "Copia"
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_NEWREC 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -24 -1 "Nuovo"
|
||||||
|
PICTURE BMP_NEWREC
|
||||||
|
PICTURE BMP_NEWRECDN
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_FINDREC 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -34 -1 "Ricerca"
|
||||||
|
PICTURE BMP_FINDREC
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_CANCEL 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -44 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
||||||
|
|
||||||
|
PAGE "Nota" -1 -1 52 10
|
||||||
|
|
||||||
|
BOOLEAN N_CHECKED
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 "Selezione"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING N_TYPE 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 21 1 "Tipo "
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
MEMO N_NOTE 50 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 2 "Nota"
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_OK 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -12 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_CANCEL 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -22 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
@ -1,6 +1,6 @@
|
|||||||
#include "ve0100o.h"
|
#include "ve0100o.h"
|
||||||
|
|
||||||
TOOLBA "topbar" 0 0 0 2
|
TOOLBAR "topbar" 0 0 0 2
|
||||||
|
|
||||||
BUTTON DLG_OK 10 2
|
BUTTON DLG_OK 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -53,16 +53,16 @@ void TVendite_mask::get_printer_config(TString& config) const
|
|||||||
|
|
||||||
bool TVendite_mask::get_printer_name(TString& name) const
|
bool TVendite_mask::get_printer_name(TString& name) const
|
||||||
{
|
{
|
||||||
TString config; get_printer_config(config);
|
TString parag; get_printer_config(parag);
|
||||||
TConfig ini(CONFIG_STAMPE, config);
|
TConfig ini(CONFIG_STAMPE, parag);
|
||||||
name = ini.get("Name");
|
name = ini.get("Name");
|
||||||
return name.not_empty();
|
return name.full();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TVendite_mask::reset_printer_config() const
|
void TVendite_mask::reset_printer_config() const
|
||||||
{
|
{
|
||||||
TString config; get_printer_config(config);
|
TString parag; get_printer_config(parag);
|
||||||
TConfig ini(CONFIG_STAMPE, config);
|
TConfig ini(CONFIG_STAMPE, parag);
|
||||||
ini.remove_all();
|
ini.remove_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,10 +121,8 @@ TVendite_mask::TVendite_mask(const char* name) : TAutomask(name)
|
|||||||
|
|
||||||
class TVendite_tabapp : public TTable_application
|
class TVendite_tabapp : public TTable_application
|
||||||
{
|
{
|
||||||
|
|
||||||
virtual const char * extra_modules() const {return "dt";}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual const char* extra_modules() const {return "dt";}
|
||||||
virtual TMask* set_mask(TMask* m);
|
virtual TMask* set_mask(TMask* m);
|
||||||
virtual void add_anal_fields(TVendite_mask& vm);
|
virtual void add_anal_fields(TVendite_mask& vm);
|
||||||
virtual void init_query_mode(TMask& m);
|
virtual void init_query_mode(TMask& m);
|
||||||
@ -132,6 +130,7 @@ protected:
|
|||||||
virtual int write(const TMask& m);
|
virtual int write(const TMask& m);
|
||||||
virtual int rewrite(const TMask& m);
|
virtual int rewrite(const TMask& m);
|
||||||
virtual bool user_create();
|
virtual bool user_create();
|
||||||
|
virtual bool get_next_key(TToken_string& key);
|
||||||
void write_gmc(const TMask& m, TRectype& curr);
|
void write_gmc(const TMask& m, TRectype& curr);
|
||||||
static bool codgmc_handler(TMask_field& f, KEY k);
|
static bool codgmc_handler(TMask_field& f, KEY k);
|
||||||
|
|
||||||
@ -255,6 +254,24 @@ void TVendite_tabapp::init_query_mode(TMask& m)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TVendite_tabapp::get_next_key(TToken_string& key)
|
||||||
|
{
|
||||||
|
if (is_table("NAR"))
|
||||||
|
{
|
||||||
|
long n = 1;
|
||||||
|
TEdit_field& codice = curr_mask().efield(101);
|
||||||
|
TCursor& cur = *codice.browse()->cursor();
|
||||||
|
if (cur.items() > 0)
|
||||||
|
{
|
||||||
|
cur = cur.items()-1;
|
||||||
|
n += cur.curr().get_long("CODTAB");
|
||||||
|
}
|
||||||
|
key.format("101|%6ld", n);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return TTable_application::get_next_key(key);
|
||||||
|
}
|
||||||
|
|
||||||
int TVendite_tabapp::read(TMask& m)
|
int TVendite_tabapp::read(TMask& m)
|
||||||
{
|
{
|
||||||
int err = Tab_application::read(m);
|
int err = Tab_application::read(m);
|
||||||
|
@ -246,7 +246,7 @@ int ve0600(int argc, char* argv[])
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
TVE_tab_mod_app a;
|
TVE_tab_mod_app a;
|
||||||
a.run(argc, argv, TR("Tabelle module vendite"));
|
a.run(argc, argv, TR("Tabelle modulo vendite"));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,7 @@ Item_14 = "Zone", "ba3 -0 ZON", "F"
|
|||||||
Item_15 = "Fatture da emettere/ricevere", "ve0 -6 &MRE", "F"
|
Item_15 = "Fatture da emettere/ricevere", "ve0 -6 &MRE", "F"
|
||||||
Item_16 = "Conti ricavo dei materiali", "ve0 -6 &CMT", "F"
|
Item_16 = "Conti ricavo dei materiali", "ve0 -6 &CMT", "F"
|
||||||
Item_17 = "Sottocategorie CONAI", "ve0 -6 &SCC", "F"
|
Item_17 = "Sottocategorie CONAI", "ve0 -6 &SCC", "F"
|
||||||
|
Item_18 = "Note articolo", "ve0 -4 NAR", "F"
|
||||||
|
|
||||||
[ACQVEN_005]
|
[ACQVEN_005]
|
||||||
Caption = "Tabelle contabili"
|
Caption = "Tabelle contabili"
|
||||||
|
@ -1055,6 +1055,7 @@ public:
|
|||||||
|
|
||||||
bool is_calculated_page(int p) const { return _calculated_pages[p]; }
|
bool is_calculated_page(int p) const { return _calculated_pages[p]; }
|
||||||
TSmart_card* smartcard() const { return _smartcard;}
|
TSmart_card* smartcard() const { return _smartcard;}
|
||||||
|
bool show_note_articolo(const TString& codart);
|
||||||
|
|
||||||
short cdc_start() const { return _cdc_start;}
|
short cdc_start() const { return _cdc_start;}
|
||||||
short cdc_end() const { return _cdc_end;}
|
short cdc_end() const { return _cdc_end;}
|
||||||
@ -1072,6 +1073,7 @@ public:
|
|||||||
TArray& color_rules() { return _color_rules; }
|
TArray& color_rules() { return _color_rules; }
|
||||||
|
|
||||||
void sel_color();
|
void sel_color();
|
||||||
|
bool gestione_note_per_articolo() const;
|
||||||
|
|
||||||
TDocumento_mask(const char* tipodoc);
|
TDocumento_mask(const char* tipodoc);
|
||||||
virtual ~TDocumento_mask();
|
virtual ~TDocumento_mask();
|
||||||
|
@ -235,10 +235,9 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
|||||||
hide(204);
|
hide(204);
|
||||||
disable(204);
|
disable(204);
|
||||||
|
|
||||||
if (cfg.get_bool("GESLISCV"))
|
if (cfg.get_bool("GESLISCV") && id2pos(F_CODLIST) > 0)
|
||||||
{
|
{
|
||||||
TBrowse * b = efield(F_CODLIST).browse();
|
TBrowse * b = efield(F_CODLIST).browse();
|
||||||
|
|
||||||
if (b != NULL)
|
if (b != NULL)
|
||||||
{
|
{
|
||||||
b->remove_input_field();
|
b->remove_input_field();
|
||||||
@ -248,13 +247,15 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
|||||||
b->add_input_field("\"\"", DOC_CODCF);
|
b->add_input_field("\"\"", DOC_CODCF);
|
||||||
b->add_input_field(TOSTRING(F_CODLIST), RCONDV_COD);
|
b->add_input_field(TOSTRING(F_CODLIST), RCONDV_COD);
|
||||||
}
|
}
|
||||||
b = efield(F_DESLIST).browse();
|
if (id2pos(F_DESLIST) > 0)
|
||||||
if (b != NULL)
|
{
|
||||||
{
|
b = efield(F_DESLIST).browse();
|
||||||
TString filter;
|
if (b != NULL)
|
||||||
|
{
|
||||||
filter << DOC_CATVEN << "==#" << F_CATVEN;
|
TString filter;
|
||||||
b->set_filter(filter);
|
filter << DOC_CATVEN << "==#" << F_CATVEN;
|
||||||
|
b->set_filter(filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,10 +265,9 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
|||||||
show(F_DESCONT, gescontr);
|
show(F_DESCONT, gescontr);
|
||||||
enable(F_CODCONT, gescontr);
|
enable(F_CODCONT, gescontr);
|
||||||
enable(F_DESCONT, gescontr);
|
enable(F_DESCONT, gescontr);
|
||||||
if (cfg.get_bool("GESCONCC"))
|
if (cfg.get_bool("GESCONCC") && id2pos(F_CODCONT) > 0)
|
||||||
{
|
{
|
||||||
TBrowse * b = efield(F_CODCONT).browse();
|
TBrowse * b = efield(F_CODCONT).browse();
|
||||||
|
|
||||||
if (b != NULL)
|
if (b != NULL)
|
||||||
{
|
{
|
||||||
b->remove_input_field();
|
b->remove_input_field();
|
||||||
@ -277,14 +277,16 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
|||||||
b->add_input_field(TOSTRING(F_CODCF), RCONDV_CODCF, -1, true);
|
b->add_input_field(TOSTRING(F_CODCF), RCONDV_CODCF, -1, true);
|
||||||
b->add_input_field(TOSTRING(F_CODCONT), RCONDV_COD);
|
b->add_input_field(TOSTRING(F_CODCONT), RCONDV_COD);
|
||||||
}
|
}
|
||||||
b = efield(F_DESCONT).browse();
|
if (id2pos(F_DESCONT) > 0)
|
||||||
if (b != NULL)
|
{
|
||||||
{
|
b = efield(F_DESCONT).browse();
|
||||||
TString filter;
|
if (b != NULL)
|
||||||
|
{
|
||||||
filter << "(" << DOC_TIPOCF << "==#" << F_TIPOCF << ")&&(" << DOC_CODCF << "==#" << F_CODCF << ")";
|
TString filter;
|
||||||
b->set_filter(filter);
|
filter << "(" << DOC_TIPOCF << "==#" << F_TIPOCF << ")&&(" << DOC_CODCF << "==#" << F_CODCF << ")";
|
||||||
}
|
b->set_filter(filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (main_app().has_module(CUAUT))
|
if (main_app().has_module(CUAUT))
|
||||||
@ -444,6 +446,9 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
|||||||
if (back != fore)
|
if (back != fore)
|
||||||
c.set_colors(back, fore);
|
c.set_colors(back, fore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gestione_note_per_articolo())
|
||||||
|
set_handler(F_NAR, nar_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
TDocumento_mask::~TDocumento_mask()
|
TDocumento_mask::~TDocumento_mask()
|
||||||
@ -1956,12 +1961,12 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
|||||||
if (!selecting && m.is_running())
|
if (!selecting && m.is_running())
|
||||||
{
|
{
|
||||||
const TRiga_documento& rdoc = doc[r + 1];
|
const TRiga_documento& rdoc = doc[r + 1];
|
||||||
TMask & riga_mask = ss.sheet_mask();
|
TMask& riga_mask = ss.sheet_mask();
|
||||||
|
|
||||||
if (r < doc.physical_rows())
|
if (r < doc.physical_rows())
|
||||||
{
|
{
|
||||||
m.update_giacenza();
|
m.update_giacenza();
|
||||||
const TRectype& rdoc = doc[r + 1];
|
const TRectype& rdoc = doc[r + 1];
|
||||||
set_curr_um(rdoc.get(RDOC_UMQTA));
|
set_curr_um(rdoc.get(RDOC_UMQTA));
|
||||||
const bool on = rdoc.get(RDOC_DACODNUM).full();
|
const bool on = rdoc.get(RDOC_DACODNUM).full();
|
||||||
riga_mask.enable(DLG_USER, on);
|
riga_mask.enable(DLG_USER, on);
|
||||||
@ -1978,6 +1983,9 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
|||||||
ss.select(r, 1, false);
|
ss.select(r, 1, false);
|
||||||
selecting = false;
|
selecting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m.gestione_note_per_articolo())
|
||||||
|
m.send_key(K_F8, F_NAR, &ss);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_CTRL + K_TAB: // uscita dalla riga
|
case K_CTRL + K_TAB: // uscita dalla riga
|
||||||
@ -4266,3 +4274,7 @@ void TDocumento_mask::sel_color()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TDocumento_mask::gestione_note_per_articolo() const
|
||||||
|
{
|
||||||
|
return id2pos(F_NAR) > 0;
|
||||||
|
}
|
||||||
|
312
ve/velib06a.cpp
312
ve/velib06a.cpp
@ -7,6 +7,7 @@
|
|||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <smartcard.h>
|
#include <smartcard.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
|
#include <toolfld.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
@ -19,6 +20,7 @@
|
|||||||
#include "sconti.h"
|
#include "sconti.h"
|
||||||
|
|
||||||
#include "velib07.h"
|
#include "velib07.h"
|
||||||
|
#include "ve0100n.h"
|
||||||
|
|
||||||
#include "../cg/cg2103.h"
|
#include "../cg/cg2103.h"
|
||||||
#include "../db/dblib.h"
|
#include "../db/dblib.h"
|
||||||
@ -1569,14 +1571,15 @@ bool codart_handler(TMask_field& f, KEY key )
|
|||||||
|
|
||||||
if (f.to_check(key, true))
|
if (f.to_check(key, true))
|
||||||
{
|
{
|
||||||
if (!f.empty())
|
TEdit_field& liv1 = row_mask.efield(FR_LIV1);
|
||||||
row_mask.enable(FR_LIV1);
|
if (f.empty())
|
||||||
else
|
|
||||||
{
|
{
|
||||||
row_mask.reset(FR_LIV1);
|
liv1.reset();
|
||||||
row_mask.disable(FR_LIV1);
|
liv1.disable();
|
||||||
}
|
}
|
||||||
row_mask.field(FR_LIV1).on_hit();
|
else
|
||||||
|
liv1.enable();
|
||||||
|
liv1.on_hit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == K_TAB && (f.focusdirty() || row_mask.get(FR_CHECKED).empty()))
|
if (key == K_TAB && (f.focusdirty() || row_mask.get(FR_CHECKED).empty()))
|
||||||
@ -1764,6 +1767,9 @@ bool codart_handler(TMask_field& f, KEY key )
|
|||||||
return error_box(TR("Articolo %s sospeso, quindi non movimentabile"), (const char *)codart);
|
return error_box(TR("Articolo %s sospeso, quindi non movimentabile"), (const char *)codart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mask.gestione_note_per_articolo())
|
||||||
|
mask.send_key(K_F8, F_NAR, &sh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3031,3 +3037,297 @@ bool datafcomp_handler(TMask_field& f, KEY key)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Gestione note articolo
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if 0 && (_MSC_VER > 1300) // Dalla versione 10.x
|
||||||
|
#define NAR_TABLE "&VENAR"
|
||||||
|
#else // Versione 3.x
|
||||||
|
#define NAR_TABLE "NAR"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class TNar_mask : public TAutomask
|
||||||
|
{
|
||||||
|
static TMask* _doc_mask;
|
||||||
|
static char _tipocf;
|
||||||
|
static long _codcf;
|
||||||
|
static TString4 _tipodoc;
|
||||||
|
static TCodice_articolo _codart;
|
||||||
|
static bool nar_filter(const TRelation* rel);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||||
|
bool add_nota(const TRectype& curr, TSheet_field& sht);
|
||||||
|
|
||||||
|
public: // virtual methods
|
||||||
|
virtual void open(); // : TMask : TWindow
|
||||||
|
virtual void close(); // : TMask : TWindow
|
||||||
|
|
||||||
|
public:
|
||||||
|
void set_doc_mask(TMask& docmask) { _doc_mask = &docmask; }
|
||||||
|
bool show_note();
|
||||||
|
TNar_mask();
|
||||||
|
};
|
||||||
|
|
||||||
|
TMask* TNar_mask::_doc_mask = NULL;
|
||||||
|
char TNar_mask::_tipocf = ' ';
|
||||||
|
long TNar_mask::_codcf;
|
||||||
|
TString4 TNar_mask::_tipodoc;
|
||||||
|
TCodice_articolo TNar_mask::_codart;
|
||||||
|
|
||||||
|
void TNar_mask::open()
|
||||||
|
{
|
||||||
|
RCT rctd; xvt_vobj_get_client_rect(_doc_mask->win(), &rctd);
|
||||||
|
RCT rctn; xvt_vobj_get_client_rect(win(), &rctn);
|
||||||
|
const short dx = rctd.right - (rctn.right-rctn.left) - 4;
|
||||||
|
const short dy = 4;
|
||||||
|
xvt_rect_offset(&rctn, dx-rctn.left, dy-rctn.top);
|
||||||
|
xvt_vobj_move(win(), &rctn);
|
||||||
|
|
||||||
|
TAutomask::open();
|
||||||
|
_running = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TNar_mask::close()
|
||||||
|
{
|
||||||
|
TAutomask::close();
|
||||||
|
_running = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TNar_mask::nar_filter(const TRelation* rel)
|
||||||
|
{
|
||||||
|
const TString& codtab = rel->curr().get("S0");
|
||||||
|
|
||||||
|
const char r_tipocf = codtab[0]; // C/F
|
||||||
|
if (r_tipocf > ' ' && r_tipocf != _tipocf) // Considera solo le note cliente/fornitore compatibili
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const long r_codcf = atol(codtab.mid(1,6));
|
||||||
|
if (r_codcf > 0 && r_codcf != _codcf)
|
||||||
|
return false; // Scarta i clienti diversi da quello sulla maschera
|
||||||
|
|
||||||
|
TString4 r_tipod = codtab.mid(7, 4);
|
||||||
|
if (r_tipod.full())
|
||||||
|
{
|
||||||
|
r_tipod.rtrim();
|
||||||
|
if (r_tipod != _tipodoc)
|
||||||
|
return false; // Scarta i tipi documento diversi da quello sulla maschera
|
||||||
|
}
|
||||||
|
|
||||||
|
const TString& codart = codtab.mid(11);
|
||||||
|
return codart.blank() || codart == _codart;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TNar_mask::add_nota(const TRectype& curr, TSheet_field& sht)
|
||||||
|
{
|
||||||
|
TToken_string nota;
|
||||||
|
char sn[4] = "S0";
|
||||||
|
for (int s = 1; s <= 3; s++)
|
||||||
|
{
|
||||||
|
sn[1] = '0' + s;
|
||||||
|
const TString& esse = curr.get(sn);
|
||||||
|
if (esse.full())
|
||||||
|
nota << esse << ' ';
|
||||||
|
}
|
||||||
|
const bool done = nota.full();
|
||||||
|
if (done)
|
||||||
|
{
|
||||||
|
nota.strip_double_spaces();
|
||||||
|
|
||||||
|
TString8 tipo;
|
||||||
|
tipo << 'X' << nota.separator();
|
||||||
|
if (atol(curr.get("S0").mid(1,6)) > 0)
|
||||||
|
tipo << 'C';
|
||||||
|
if (curr.get("S0").mid(7,4).full())
|
||||||
|
tipo << 'T';
|
||||||
|
if (curr.get("S0").mid(11).full())
|
||||||
|
tipo << 'A';
|
||||||
|
tipo << nota.separator();
|
||||||
|
nota.insert(tipo, 0);
|
||||||
|
const int n = sht.insert(-1, false, true);
|
||||||
|
sht.row(n) = nota;
|
||||||
|
sht.set_row_height(n, 2*CHARY);
|
||||||
|
}
|
||||||
|
|
||||||
|
return done;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int notes_compare(TSheet_field& s, int r1, int r2)
|
||||||
|
{
|
||||||
|
TToken_string order = "C|T|CT|A|CA|TA|CTA";
|
||||||
|
const char* c1 = s.row(r1).get(1);
|
||||||
|
const char* c2 = s.row(r2).get(1);
|
||||||
|
const int i1 = order.get_pos(c1);
|
||||||
|
const int i2 = order.get_pos(c2);
|
||||||
|
int cmp = i1 - i2;
|
||||||
|
if (cmp == 0)
|
||||||
|
cmp = r1 - r2;
|
||||||
|
return cmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TNar_mask::show_note()
|
||||||
|
{
|
||||||
|
TSheet_field& ss = _doc_mask->sfield(F_SHEET);
|
||||||
|
const int sel = ss.selected();
|
||||||
|
if (sel >= 0)
|
||||||
|
{
|
||||||
|
_tipocf = _doc_mask->get(F_TIPOCF)[0];
|
||||||
|
_codcf = _doc_mask->get_long(F_CODCF);
|
||||||
|
_tipodoc = _doc_mask->get(F_TIPODOC);
|
||||||
|
_codart = ss.row(sel).get(ss.cid2index(FR_CODART));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_codart.cut(0);
|
||||||
|
|
||||||
|
close();
|
||||||
|
if (_codart.full())
|
||||||
|
{
|
||||||
|
TRelation rel(NAR_TABLE);
|
||||||
|
TCursor cur(&rel, "", 2);
|
||||||
|
cur.set_filterfunction(nar_filter);
|
||||||
|
|
||||||
|
const TRecnotype items = cur.items();
|
||||||
|
if (items > 0)
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
cur.freeze();
|
||||||
|
const TRectype& curr = rel.curr();
|
||||||
|
TSheet_field& sheet = sfield(N_NOTES);
|
||||||
|
sheet.destroy();
|
||||||
|
for (cur = 0L; cur.pos() < items; ++cur)
|
||||||
|
add_nota(curr, sheet);
|
||||||
|
sheet.sort(notes_compare);
|
||||||
|
open();
|
||||||
|
sheet.force_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_open();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool TNar_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||||
|
{
|
||||||
|
switch (o.dlg())
|
||||||
|
{
|
||||||
|
case DLG_FINDREC:
|
||||||
|
if (e == fe_button)
|
||||||
|
{
|
||||||
|
TRelation rel(NAR_TABLE);
|
||||||
|
TCursor cur(&rel, "", 2);
|
||||||
|
TRectype& curr = rel.curr();
|
||||||
|
bool update = false;
|
||||||
|
_tipocf = _doc_mask->get(F_TIPOCF)[0];
|
||||||
|
_codcf = _doc_mask->get_long(F_CODCF);
|
||||||
|
_tipodoc = _doc_mask->get(F_TIPODOC);
|
||||||
|
_codart.cut(0); // Nessun codice articolo corrente
|
||||||
|
cur.set_filterfunction(nar_filter);
|
||||||
|
TCursor_sheet as(&cur, "CODTAB|S0[1,1]|S0[2,7]|S0[8,11]|S0[12,31]|S1", TR("Note articolo"),
|
||||||
|
HR("Codice Nota@20|C/F|Codice|Tipo|Articolo@20|Note@50"), 0x3, 1, parent());
|
||||||
|
switch (as.run())
|
||||||
|
{
|
||||||
|
case K_ENTER:
|
||||||
|
cur = as.selected();
|
||||||
|
update = true;
|
||||||
|
break;
|
||||||
|
case K_CTRL+'G':
|
||||||
|
cur = as.selected();
|
||||||
|
update = curr.edit();
|
||||||
|
if (update)
|
||||||
|
cur = as.selected(); // Aggiorna valori editati esternamente
|
||||||
|
break;
|
||||||
|
case K_INS:
|
||||||
|
rel.file().zero(); // Usa azzeramento avanzato che funziona anche per tabelle di modulo
|
||||||
|
curr.edit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (update)
|
||||||
|
{
|
||||||
|
TSheet_field& ns = sfield(N_NOTES); // Sheet delle note articolo
|
||||||
|
ns.destroy();
|
||||||
|
if (add_nota(curr, ns))
|
||||||
|
{
|
||||||
|
ns.force_update();
|
||||||
|
open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DLG_NEWREC:
|
||||||
|
if (e == fe_button)
|
||||||
|
{
|
||||||
|
TRelation rel(NAR_TABLE); // Lascio a rel l'onere di decidere se TAB o TABMOD
|
||||||
|
rel.curr().edit();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DLG_SAVEREC:
|
||||||
|
if (e == fe_button)
|
||||||
|
{
|
||||||
|
TSheet_field& ns = sfield(N_NOTES); // Sheet delle note articolo
|
||||||
|
TString note;
|
||||||
|
FOR_EACH_SHEET_ROW(ns, n, row) if (row->get_char(0) > ' ') // For each checked row
|
||||||
|
note << row->get(2) << '\n';
|
||||||
|
if (note.full())
|
||||||
|
{
|
||||||
|
const TString4 tiporiga = _doc_mask->get(F_LBTIPORIGA); // Memorizza tipo riga
|
||||||
|
_doc_mask->set(F_LBTIPORIGA, "05"); // Impone riga descrizione
|
||||||
|
TSheet_field& ss = _doc_mask->sfield(F_SHEET); // Sheet delle righe documento
|
||||||
|
int i = ss.selected() + (get(N_WHERE)=="A" ? 1 : 0); // Inserisci prima o dopo?
|
||||||
|
i = ss.insert(i, false, true); // Crea nuova riga descrizione
|
||||||
|
ss.row(i).add(note.trim(), ss.cid2index(FR_DESCR)); // Copia descrizione dal memo
|
||||||
|
ss.force_update(); // Aggiorna sheet
|
||||||
|
_doc_mask->set(F_LBTIPORIGA, tiporiga); // Ripristina tipo riga
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (e == fe_button && is_open())
|
||||||
|
close();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TNar_mask::TNar_mask() : TAutomask("ve0100n")
|
||||||
|
{
|
||||||
|
_doc_mask = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nar_handler(TMask_field& f, KEY key)
|
||||||
|
{
|
||||||
|
static TNar_mask* nw = NULL;
|
||||||
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case K_SPACE:
|
||||||
|
if (nw == NULL)
|
||||||
|
nw = new TNar_mask;
|
||||||
|
nw->set_doc_mask(f.mask());
|
||||||
|
nw->open();
|
||||||
|
break;
|
||||||
|
case K_ESC:
|
||||||
|
case K_ENTER:
|
||||||
|
if (nw != NULL && nw->is_open())
|
||||||
|
nw->close();
|
||||||
|
break;
|
||||||
|
case K_F8:
|
||||||
|
if (xvt_vobj_is_focusable(f.parent()))
|
||||||
|
{
|
||||||
|
if (nw == NULL)
|
||||||
|
{
|
||||||
|
nw = new TNar_mask;
|
||||||
|
nw->set_doc_mask(f.mask());
|
||||||
|
}
|
||||||
|
nw->show_note();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -44,6 +44,7 @@ bool codcms_handler(TMask_field &f, KEY key);
|
|||||||
bool numdocrif_hndl(TMask_field& field, KEY key);
|
bool numdocrif_hndl(TMask_field& field, KEY key);
|
||||||
bool smart_hndl(TMask_field& field, KEY key);
|
bool smart_hndl(TMask_field& field, KEY key);
|
||||||
bool fido_hndl(TMask_field& field, KEY key);
|
bool fido_hndl(TMask_field& field, KEY key);
|
||||||
|
bool nar_handler(TMask_field& f, KEY key);
|
||||||
|
|
||||||
bool tipodoc_ok(const TString & tipodoc);
|
bool tipodoc_ok(const TString & tipodoc);
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
[MAIN]
|
[MAIN]
|
||||||
CALCOLI=*
|
CALCOLI=*
|
||||||
CAMPICALC=
|
CAMPICALC=
|
||||||
IMPONIBILE=IMPNN
|
IMPONIBILE=IMPNS
|
||||||
|
|
||||||
[HANDLERS]
|
[HANDLERS]
|
||||||
NHANDLER = 0
|
NHANDLER = 0
|
||||||
|
|
||||||
|
14
ve/vetbnar.h
Executable file
14
ve/vetbnar.h
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#define F_CODICE 101
|
||||||
|
|
||||||
|
#define F_TIPOCF 201
|
||||||
|
#define F_CLIFO 202
|
||||||
|
#define F_TIPO 203
|
||||||
|
#define F_ARTICOLO 204
|
||||||
|
|
||||||
|
#define F_RAGSOC 212
|
||||||
|
#define F_DESCTIPO 213
|
||||||
|
#define F_DESCART 214
|
||||||
|
|
||||||
|
#define F_DESCR1 301
|
||||||
|
#define F_DESCR2 302
|
||||||
|
#define F_DESCR3 303
|
142
ve/vetbnar.uml
Executable file
142
ve/vetbnar.uml
Executable file
@ -0,0 +1,142 @@
|
|||||||
|
#include "vetbnar.h"
|
||||||
|
|
||||||
|
TOOLBAR "Toolbar" 0 0 0 2
|
||||||
|
|
||||||
|
#include <relapbar.h>
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
PAGE "Note articoli " 0 2 0 0
|
||||||
|
|
||||||
|
NUMBER F_CODICE 6
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 "Codice nota "
|
||||||
|
FLAGS "Z"
|
||||||
|
USE NAR
|
||||||
|
INPUT CODTAB F_CODICE
|
||||||
|
DISPLAY "Codice@6" CODTAB
|
||||||
|
DISPLAY "C/F" S0[1,1]
|
||||||
|
DISPLAY "Codice" S0[2,7]
|
||||||
|
DISPLAY "Tipo" S0[8,11]
|
||||||
|
DISPLAY "Articolo@20" S0[12,31]
|
||||||
|
DISPLAY "Note@50" S1
|
||||||
|
OUTPUT F_CODICE CODTAB
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
FIELD CODTAB
|
||||||
|
KEY 1
|
||||||
|
END
|
||||||
|
|
||||||
|
LIST F_TIPOCF 1 10
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 3 ""
|
||||||
|
ITEM "|" MESSAGE CLEAR, F_CLIFO|CLEAR, F_RAGSOC
|
||||||
|
ITEM "C|Cliente" MESSAGE ENABLE,F_CLIFO|ENABLE,F_RAGSOC
|
||||||
|
ITEM "F|Fornitore" MESSAGE ENABLE,F_CLIFO|ENABLE,F_RAGSOC
|
||||||
|
FIELD S0[1,1]
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_CLIFO 6
|
||||||
|
BEGIN
|
||||||
|
PROMPT 15 3 ""
|
||||||
|
USE LF_CLIFO
|
||||||
|
INPUT TIPOCF F_TIPOCF SELECT
|
||||||
|
INPUT CODCF F_CLIFO
|
||||||
|
DISPLAY "Codice" CODCF
|
||||||
|
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||||
|
OUTPUT F_CLIFO CODCF
|
||||||
|
OUTPUT F_RAGSOC RAGSOC
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
FIELD S0[2,7]
|
||||||
|
FLAGS "Z"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGA F_TIPO 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 5 "Tipo documento "
|
||||||
|
USE %TIP
|
||||||
|
INPUT CODTAB F_TIPO
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
|
DISPLAY "Descrizione@50" S0
|
||||||
|
OUTPUT F_TIPO CODTAB
|
||||||
|
OUTPUT F_DESCTIPO S0
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
FIELD S0[8,11]
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_ARTICOLO 20
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 7 "Articolo "
|
||||||
|
FIELD S0[12,31]
|
||||||
|
USE ANAMAG
|
||||||
|
INPUT CODART F_ARTICOLO
|
||||||
|
DISPLAY "Codice@20" CODART
|
||||||
|
DISPLAY "Descrizione@50" DESCR
|
||||||
|
OUTPUT F_ARTICOLO CODART
|
||||||
|
OUTPUT F_DESCART DESCR
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
VALIDATE ONEREQ_FUNC 3 F_CLIFO F_TIPO F_ARTICOLO
|
||||||
|
WARNING "Inserire almeno un dato a scelta tra: codice cliente/fornitore; tipo documento; codice articolo"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_RAGSOC 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 26 3 ""
|
||||||
|
USE LF_CLIFO KEY 2
|
||||||
|
INPUT TIPOCF F_TIPOCF SELECT
|
||||||
|
INPUT RAGSOC F_RAGSOC
|
||||||
|
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||||
|
DISPLAY "Codice" CODCF
|
||||||
|
COPY OUTPUT F_CLIFO
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESCTIPO 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 26 5 ""
|
||||||
|
USE %TIP KEY 2
|
||||||
|
INPUT S0 F_DESCTIPO
|
||||||
|
DISPLAY "Descrizione@50" S0
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
|
COPY OUTPUT F_TIPO
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESCART 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 15 8 ""
|
||||||
|
USE ANAMAG KEY 2
|
||||||
|
INPUT DESCR F_DESCART
|
||||||
|
DISPLAY "Descrizione@50" DESCR
|
||||||
|
DISPLAY "Codice@20" CODART
|
||||||
|
COPY OUTPUT F_ARTICOLO
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
END
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 78 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 10 "@bNote"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESCR1 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 15 11 ""
|
||||||
|
FIELD S1
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESCR2 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 15 12 ""
|
||||||
|
FIELD S2
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESCR3 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 15 13 ""
|
||||||
|
FIELD S3
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
||||||
|
|
@ -127,6 +127,8 @@
|
|||||||
#define F_DATAFCOMP 292
|
#define F_DATAFCOMP 292
|
||||||
//#define F_SELECT 101
|
//#define F_SELECT 101
|
||||||
|
|
||||||
|
#define F_NAR 299
|
||||||
|
|
||||||
//scontrini
|
//scontrini
|
||||||
#define DLG_CHIUDI 401
|
#define DLG_CHIUDI 401
|
||||||
#define DLG_TURNO 402
|
#define DLG_TURNO 402
|
||||||
|
Loading…
x
Reference in New Issue
Block a user