Migliorata selezione saldaconto
git-svn-id: svn://10.65.10.50/branches/R_10_00@23046 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e4c1feea4c
commit
7a2b3f956e
BIN
sc/scprassi.hlp
BIN
sc/scprassi.hlp
Binary file not shown.
@ -1,9 +1,54 @@
|
||||
#include <defmask.h>
|
||||
#include <diction.h>
|
||||
|
||||
#include "../cg/cglib01.h"
|
||||
#include "scselect.h"
|
||||
#include <pconti.h>
|
||||
|
||||
static bool sc_filter_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
TCursor_sheet& cs = (TCursor_sheet&)f.mask();
|
||||
TCursor& c = *cs.cursor();
|
||||
|
||||
TString expr; // Espressione di filtro complessiva
|
||||
if (f.get().full()) // Filtro attivato!
|
||||
{
|
||||
const short id = f.dlg()-500;
|
||||
TString e = f.mask().get(id); // Espressione regolare
|
||||
e.strip("\"'"); // Tolgo caratteri che potrebbero dare problemi
|
||||
if (e.full())
|
||||
{
|
||||
expr = (c.file().num() == LF_CLIFO) ? CLI_RAGSOC : PCN_DESCR;
|
||||
expr << "?=\"" << e << '"';
|
||||
expr.upper();
|
||||
}
|
||||
if (expr.empty())
|
||||
f.reset();
|
||||
}
|
||||
c.freeze(false);
|
||||
c.setfilter(expr, true);
|
||||
c.freeze(true);
|
||||
cs.force_update();
|
||||
cs.post_select(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool sc_ragsoc_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
{
|
||||
TMask_field& chk = f.mask().field(f.dlg()+500);
|
||||
if (f.get().starts_with("*"))
|
||||
chk.set("X");
|
||||
if (chk.get().full())
|
||||
sc_filter_handler(chk, K_SPACE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
TSelection_mask::TSelection_mask(const char* name)
|
||||
: TMask(name), _who('C'), _key(1), _clifo_rel(NULL), _pdc_rel(NULL),
|
||||
_cli_cur_k1(NULL), _cli_cur_k2(NULL), _for_cur_k1(NULL), _for_cur_k2(NULL),
|
||||
@ -17,20 +62,24 @@ TSelection_mask::TSelection_mask(const char* name)
|
||||
_cli_cur_k1 = new TCursor(_clifo_rel, "", 1, &filter, &filter);
|
||||
_cli_cur_k2 = new TCursor(_clifo_rel, "", 2, &filter, &filter);
|
||||
|
||||
_cli_sh_k1 = new TCursor_sheet(_cli_cur_k1, " |CODCF|RAGSOC", "Selezione clienti per codice",
|
||||
"@1|Codice|Ragione Sociale@50",0,1);
|
||||
_cli_sh_k2 = new TCursor_sheet(_cli_cur_k2, " |RAGSOC|CODCF", "Selezione clienti per ragione sociale",
|
||||
"@1|Ragione Sociale@50|Codice",0,1);
|
||||
|
||||
_cli_sh_k1 = new TCursor_sheet(_cli_cur_k1, " |CODCF|RAGSOC|PAIV", TR("Selezione cliente per codice"),
|
||||
HR("@1|Codice|Ragione Sociale@50|Partita IVA"),0,1);
|
||||
_cli_sh_k2 = new TCursor_sheet(_cli_cur_k2, " |RAGSOC|CODCF|PAIV", TR("Selezione cliente per ragione sociale"),
|
||||
"@1|Ragione Sociale@50|Codice|Partita IVA",0,1);
|
||||
_cli_sh_k2->add_string(SC_CLIFO, 0, PR("Ragione sociale "), 1, 0, 50, "").set_handler(sc_ragsoc_handler);
|
||||
_cli_sh_k2->add_checkbutton(SC_CLIFO+500, 0, "", 68, 0, 2, 1, "", 10112, 10113).set_handler(sc_filter_handler);
|
||||
|
||||
if (id2pos(SC_CLIFO) >= 0)
|
||||
{
|
||||
filter.put(CLI_TIPOCF, "F");
|
||||
_for_cur_k1 = new TCursor(_clifo_rel, "", 1, &filter, &filter);
|
||||
_for_cur_k2 = new TCursor(_clifo_rel, "", 2, &filter, &filter);
|
||||
_for_sh_k1 = new TCursor_sheet(_for_cur_k1, " |CODCF|RAGSOC", "Selezione fornitori per codice",
|
||||
"@1|Codice|Ragione Sociale@50",0,1);
|
||||
_for_sh_k2 = new TCursor_sheet(_for_cur_k2, " |RAGSOC|CODCF", "Selezione fornitori per ragione sociale",
|
||||
"@1|Ragione Sociale@50|Codice",0,1);
|
||||
_for_sh_k1 = new TCursor_sheet(_for_cur_k1, " |CODCF|RAGSOC|PAIV", TR("Selezione fornitore per codice"),
|
||||
HR("@1|Codice|Ragione Sociale@50|Partita IVA"),0,1);
|
||||
_for_sh_k2 = new TCursor_sheet(_for_cur_k2, " |RAGSOC|CODCF|PAIV", TR("Selezione fornitore per ragione sociale"),
|
||||
"@1|Ragione Sociale@50|Codice|Partita IVA",0,1);
|
||||
_for_sh_k2->add_string(SC_CLIFO, 0, PR("Ragione sociale "), 1, 0, 50, "").set_handler(sc_ragsoc_handler);
|
||||
_for_sh_k2->add_checkbutton(SC_CLIFO+500, 0, "", 68, 0, 2, 1, "", 10112, 10113).set_handler(sc_filter_handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -50,6 +99,8 @@ TSelection_mask::TSelection_mask(const char* name)
|
||||
"@1|Gruppo|Conto|Sottoconto|Descrizione@50",0,1);
|
||||
_pdc_sh_k2 = new TCursor_sheet(_pdc_cur_k2, " |DESCR|GRUPPO|CONTO|SOTTOCONTO", "Selezione conti per descrizione",
|
||||
"@1|Descrizione@50|Gruppo|Conto|Sottoconto",0,1);
|
||||
_pdc_sh_k2->add_string(SC_CLIFO, 0, PR("Descrizione "), 1, 0, 50, "").set_handler(sc_ragsoc_handler);
|
||||
_pdc_sh_k2->add_checkbutton(SC_CLIFO+500, 0, "", 68, 0, 2, 1, "", 10112, 10113).set_handler(sc_filter_handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -367,7 +418,6 @@ bool TSelection_mask::ffrom_handler(TMask_field& f, KEY k)
|
||||
else
|
||||
if (k == K_F9)
|
||||
{
|
||||
TSelection_mask& m = (TSelection_mask&)f.mask();
|
||||
TCursor_sheet& c = m.cur_sheet();
|
||||
c.cursor()->curr().put(CLI_CODCF, f.get());
|
||||
c.cursor()->read();
|
||||
@ -385,6 +435,7 @@ bool TSelection_mask::ffrom_handler(TMask_field& f, KEY k)
|
||||
c.enable_check();
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -401,7 +452,6 @@ bool TSelection_mask::fto_handler(TMask_field& f, KEY k)
|
||||
else
|
||||
if (k == K_F9)
|
||||
{
|
||||
TSelection_mask& m = (TSelection_mask&)f.mask();
|
||||
TCursor_sheet& c = m.cur_sheet();
|
||||
c.cursor()->curr().put(CLI_CODCF, f.get());
|
||||
c.cursor()->read();
|
||||
@ -434,17 +484,18 @@ bool TSelection_mask::fdfrom_handler(TMask_field& f, KEY k)
|
||||
else
|
||||
if (k == K_F9)
|
||||
{
|
||||
TSelection_mask& m = (TSelection_mask&)f.mask();
|
||||
TCursor_sheet& c = m.cur_sheet();
|
||||
const char* fld = m.get_who() >= 'C' ? CLI_RAGSOC : PCN_DESCR;
|
||||
c.cursor()->curr().put(fld, f.get());
|
||||
const TString& value = f.get();
|
||||
c.cursor()->curr().put(fld, value);
|
||||
c.cursor()->read();
|
||||
c.set(SC_CLIFO, value, 0x3);
|
||||
c.disable_check();
|
||||
c.disable(DLG_USER);
|
||||
if (c.run() == K_ENTER)
|
||||
{
|
||||
TToken_string& t = c.row(c.selected());
|
||||
const TString des1(t.get(3 - m.get_key()));
|
||||
const TString des1(t.get(1));
|
||||
const TString des2 = m.get(SC_CFDESTO);
|
||||
m.set(SC_CFDESFR, des1);
|
||||
m.select_des_clifo_range(des1, des2);
|
||||
@ -469,17 +520,19 @@ bool TSelection_mask::fdto_handler(TMask_field& f, KEY k)
|
||||
else
|
||||
if (k == K_F9)
|
||||
{
|
||||
TSelection_mask& m = (TSelection_mask&)f.mask();
|
||||
TCursor_sheet& c = m.cur_sheet();
|
||||
c.cursor()->curr().put(m.get_who() >= 'C' ? CLI_RAGSOC : PCN_DESCR, f.get());
|
||||
const char* fld = m.get_who() >= 'C' ? CLI_RAGSOC : PCN_DESCR;
|
||||
const TString& value = f.get();
|
||||
c.cursor()->curr().put(fld, value);
|
||||
c.cursor()->read();
|
||||
c.set(SC_CLIFO, value, 0x3);
|
||||
c.disable_check();
|
||||
c.disable(DLG_USER);
|
||||
if (c.run() == K_ENTER)
|
||||
{
|
||||
TToken_string& t = c.row(c.selected());
|
||||
const TString des1(m.get(SC_CFDESFR));
|
||||
const TString des2(t.get(3 - m.get_key()));
|
||||
const TString des2(t.get(1));
|
||||
m.set(SC_CFDESTO, des2);
|
||||
m.select_des_clifo_range(des1, des2);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user