Patch level : 10.0 888
Files correlati : cg3.exe Ricompilazione Demo : [ ] Commento : 0001748: Visualizzazione mastrini, sul cliente vedo nella descrizione delle contropartite la ragione sociale del cliente Visualizzazione mastrini, sul cliente vedo nella descrizione delle contropartite la ragione sociale del cliente: è possibile vedere il conto di ricavo? rif.Pharmatex git-svn-id: svn://10.65.10.50/branches/R_10_00@21463 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
70544fb760
commit
4d68666e72
217
cg/cg3600.cpp
217
cg/cg3600.cpp
@ -14,6 +14,7 @@
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <clifo.h>
|
||||
#include <causali.h>
|
||||
#include <mov.h>
|
||||
#include <pconti.h>
|
||||
@ -167,6 +168,7 @@ public:
|
||||
real progressivo_avere_periodo() const { return _pavere_ini + _pavere_per; }
|
||||
TImporto saldo_periodo() const;
|
||||
|
||||
const TBill& conto() const { return _conto; }
|
||||
int esercizio() const { return _esercizio; }
|
||||
const TDate& inizio_periodo() const { return _da_data; }
|
||||
const TDate& fine_periodo() const { return _a_data; }
|
||||
@ -186,9 +188,7 @@ TRelation* TMastrino::_rel = NULL;
|
||||
TLocalisamfile* TMastrino::_rmov = NULL; // File principale della relazione
|
||||
TLocalisamfile* TMastrino::_mov = NULL; // File secondario della relazione
|
||||
|
||||
|
||||
TMastrino::TMastrino()
|
||||
: _esercizio(0)
|
||||
TMastrino::TMastrino() : _esercizio(0)
|
||||
{
|
||||
if (_instances == 0L)
|
||||
{
|
||||
@ -1698,7 +1698,7 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
|
||||
rmov.get_long(RMV_SOTTOCONTO));
|
||||
}
|
||||
break;
|
||||
case 104:
|
||||
case 104: // Descrizione
|
||||
if (riga.tipo() == riga_mastrino)
|
||||
{
|
||||
const TRectype& rmov = _mastrino.riga(rec);
|
||||
@ -1718,14 +1718,15 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
|
||||
{
|
||||
const TRectype& rmov = _mastrino.riga(rec);
|
||||
cell.set(rmov.get(RMV_DESCR));
|
||||
if (cell.empty())
|
||||
// Bug 0001748: ignora descrizioni generate da contabilizzazione
|
||||
if (cell.empty() || cell == _mastrino.conto().descrizione())
|
||||
{
|
||||
const TBill conto(rmov);
|
||||
cell.set(conto.descrizione());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 105:
|
||||
case 105: // Dare
|
||||
{
|
||||
const TRectype& rmov = _mastrino.riga(rec);
|
||||
const char sez = rmov.get_char(RMV_SEZIONE);
|
||||
@ -1733,7 +1734,7 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
|
||||
cell = real2string(rmov.get_real(RMV_IMPORTO));
|
||||
}
|
||||
break;
|
||||
case 106:
|
||||
case 106: // Avere
|
||||
{
|
||||
const TRectype& rmov = _mastrino.riga(rec);
|
||||
const char sez = rmov.get_char(RMV_SEZIONE);
|
||||
@ -2310,128 +2311,142 @@ long TGrid_mask::handler(WINDOW win, EVENT* ep)
|
||||
return TMask::handler(win, ep);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TQuery_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TQuery_mask : public TMask
|
||||
class TQuery_mask : public TAutomask
|
||||
{
|
||||
TGrid_mask* _gm;
|
||||
|
||||
protected:
|
||||
static bool esercizio_handler(TMask_field& f, KEY k);
|
||||
static bool data_handler(TMask_field& f, KEY k);
|
||||
static bool find_handler(TMask_field& f, KEY k);
|
||||
static bool colors_handler(TMask_field& f, KEY k);
|
||||
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
void do_query();
|
||||
|
||||
TQuery_mask(TGrid_mask* gm);
|
||||
virtual ~TQuery_mask() { }
|
||||
};
|
||||
|
||||
TQuery_mask::TQuery_mask(TGrid_mask* gm) : TMask("cg3600a"), _gm(gm)
|
||||
{
|
||||
set_handler(F_ESERCIZIO, esercizio_handler);
|
||||
set_handler(F_DADATA, data_handler);
|
||||
set_handler(F_ADATA, data_handler);
|
||||
set_handler(DLG_FINDREC, find_handler);
|
||||
set_handler(DLG_CONFIG, colors_handler);
|
||||
}
|
||||
|
||||
bool TQuery_mask::esercizio_handler(TMask_field& f, KEY k)
|
||||
bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
{
|
||||
TEsercizi_contabili esc;
|
||||
const int anno = atoi(f.get());
|
||||
if (esc.exist(anno))
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_TIPO:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
TDate dd = m.get(F_DADATA);
|
||||
if (esc.date2esc(dd) != anno)
|
||||
m.set(F_DADATA, esc[anno].inizio());
|
||||
dd = m.get(F_ADATA);
|
||||
if (esc.date2esc(dd) != anno)
|
||||
m.set(F_ADATA, esc[anno].fine());
|
||||
const TString& tipo = o.get();
|
||||
if (tipo.full())
|
||||
{
|
||||
TWait_cursor hourglass;
|
||||
TString query;
|
||||
query << "USE " << LF_PCON << " SELECT " << PCN_TMCF << "=\"" << tipo << "\"";
|
||||
TISAM_recordset conti(query);
|
||||
if (conti.move_first())
|
||||
{
|
||||
set(F_GRUPPO, conti.get(PCN_GRUPPO).as_int(), 0x2);
|
||||
set(F_CONTO, conti.get(PCN_CONTO).as_int(), 0x2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
case F_CLIENTE:
|
||||
case F_FORNITORE:
|
||||
if (e == fe_modify && !o.empty())
|
||||
{
|
||||
if (anno > 0)
|
||||
return error_box(FR("Esercizio inesistente: %d"), anno);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TQuery_mask::data_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
bool ok = true;
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
const TQuery_mask& qm = (const TQuery_mask&)f.mask();
|
||||
const TEsercizi_contabili esercizi;
|
||||
int codice_esercizio = qm.get_int(F_ESERCIZIO);
|
||||
|
||||
if (codice_esercizio == 0)
|
||||
const TRectype& rec = ((TEdit_field&)o).browse()->cursor()->curr();
|
||||
const int g = rec.get_int(CLI_GRUPPO);
|
||||
const int c = rec.get_int(CLI_CONTO);
|
||||
if (g > 0 && c > 0)
|
||||
{
|
||||
set(F_GRUPPO, g, 0x2);
|
||||
set(F_CONTO, g, 0x2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case F_ESERCIZIO:
|
||||
if (e == fe_modify || e == fe_close)
|
||||
{
|
||||
const short id_altra_data = f.dlg() == F_DADATA ? F_ADATA : F_DADATA;
|
||||
const TDate d = qm.get(id_altra_data);
|
||||
if (d.ok())
|
||||
codice_esercizio = esercizi.date2esc(d);
|
||||
}
|
||||
TEsercizi_contabili esc;
|
||||
const int anno = atoi(o.get());
|
||||
if (esc.exist(anno))
|
||||
{
|
||||
TDate dd = get(F_DADATA);
|
||||
if (esc.date2esc(dd) != anno)
|
||||
set(F_DADATA, esc[anno].inizio());
|
||||
dd = get(F_ADATA);
|
||||
if (esc.date2esc(dd) != anno)
|
||||
set(F_ADATA, esc[anno].fine());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (anno > 0)
|
||||
return error_box(FR("Esercizio inesistente: %d"), anno);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case F_DADATA:
|
||||
case F_ADATA:
|
||||
if (e == fe_close)
|
||||
{
|
||||
const TEsercizi_contabili esercizi;
|
||||
int codice_esercizio = get_int(F_ESERCIZIO);
|
||||
if (codice_esercizio <= 0)
|
||||
{
|
||||
const short id_altra_data = o.dlg() == F_DADATA ? F_ADATA : F_DADATA;
|
||||
const TDate d = get(id_altra_data);
|
||||
if (d.ok())
|
||||
codice_esercizio = esercizi.date2esc(d);
|
||||
}
|
||||
|
||||
if (f.empty())
|
||||
{
|
||||
if (codice_esercizio == 0)
|
||||
return error_box(TR("E' necessario specificare almeno una data."));
|
||||
return true;
|
||||
}
|
||||
if (o.empty())
|
||||
{
|
||||
if (codice_esercizio == 0)
|
||||
return error_box(TR("E' necessario specificare almeno una data."));
|
||||
return true;
|
||||
}
|
||||
|
||||
const TDate d = f.get();
|
||||
const int esercizio = esercizi.date2esc(d);
|
||||
if (qm.get_int(F_ESERCIZIO) != 0)
|
||||
{
|
||||
if (esercizio != codice_esercizio)
|
||||
ok = error_box(FR("La data deve appartenere all'esercizio %d"), codice_esercizio);
|
||||
const TDate d = o.get();
|
||||
const int esercizio = esercizi.date2esc(d);
|
||||
if (get_int(F_ESERCIZIO) != 0)
|
||||
{
|
||||
if (esercizio != codice_esercizio)
|
||||
return error_box(FR("La data deve appartenere all'esercizio %d"), codice_esercizio);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (esercizio == 0)
|
||||
return error_box(TR("La data deve appartenere ad un esercizio contabile"));
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
case DLG_FINDREC:
|
||||
if (e == fe_button)
|
||||
{
|
||||
if (esercizio == 0)
|
||||
ok = error_box(TR("La data deve appartenere ad un esercizio contabile"));
|
||||
}
|
||||
short id;
|
||||
switch (get(F_TIPO)[0])
|
||||
{
|
||||
case 'C': id = F_CLIENTE; break;
|
||||
case 'F': id = F_FORNITORE; break;
|
||||
default : id = F_SOTTOCONTO; break;
|
||||
}
|
||||
field(id).on_key(K_F9);
|
||||
}
|
||||
break;
|
||||
case DLG_CONFIG:
|
||||
if (e == fe_button)
|
||||
_gm->grid().set_colors();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TQuery_mask::find_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
const TQuery_mask& qm = (const TQuery_mask&)f.mask();
|
||||
short id;
|
||||
switch (qm.get(F_TIPO)[0])
|
||||
{
|
||||
case 'C': id = F_CLIENTE; break;
|
||||
case 'F': id = F_FORNITORE; break;
|
||||
default : id = F_SOTTOCONTO; break;
|
||||
}
|
||||
qm.field(id).on_key(K_F9);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TQuery_mask::colors_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
const TQuery_mask& qm = (const TQuery_mask&)f.mask();
|
||||
qm._gm->grid().set_colors();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
TQuery_mask::TQuery_mask(TGrid_mask* gm) : TAutomask("cg3600a"), _gm(gm)
|
||||
{ }
|
||||
|
||||
void TQuery_mask::do_query()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user