Patch level : 2.2 164

Files correlati     : ve0.exe
Ricompilazione Demo : [ ]
Commento            :

Aggiunti deposito e magazzino a commesse e centri di cosito


git-svn-id: svn://10.65.10.50/trunk@13316 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2005-08-23 08:54:32 +00:00
parent 2cbd850658
commit ad8036daaf
4 changed files with 4015 additions and 3962 deletions

View File

@ -196,6 +196,7 @@ public:
class TTipo_documento : public TRectype // velib03 class TTipo_documento : public TRectype // velib03
{ {
static TAssoc_array _formule_documento; static TAssoc_array _formule_documento;
TToken_string _formule; TToken_string _formule;
TString_array _keys_descrs; // Tipi riga per listbox TString_array _keys_descrs; // Tipi riga per listbox
@ -221,7 +222,6 @@ class TTipo_documento : public TRectype // velib03
char _check_qta; char _check_qta;
bool _cnt_prezzi, _show_evaded_lines; bool _cnt_prezzi, _show_evaded_lines;
protected: protected:
void add_formula_if_needed(TConfig& profile, TString& variable, const char* varname, const char* formula); void add_formula_if_needed(TConfig& profile, TString& variable, const char* varname, const char* formula);
void read_formule(); void read_formule();
@ -229,11 +229,9 @@ protected:
public: public:
TObject* dup() const { return new TTipo_documento(codice()); } TObject* dup() const { return new TTipo_documento(codice()); }
enum { _altro, _bolla, _fattura, _ordine}; enum { _altro, _bolla, _fattura, _ordine};
public: public:
// const TString& profile_name() const { return get("S4"); }
const TFilename& profile_name(TFilename& name) const; const TFilename& profile_name(TFilename& name) const;
// Funzioni che effettuano la cache di importanti valori contenuti nel profilo // Funzioni che effettuano la cache di importanti valori contenuti nel profilo
@ -259,7 +257,6 @@ public:
bool check_giac() const { return _check_qta == 'G'; } bool check_giac() const { return _check_qta == 'G'; }
bool check_disp() const { return _check_qta == 'D'; } bool check_disp() const { return _check_qta == 'D'; }
const TString & descrizione() const { return get("S0"); } const TString & descrizione() const { return get("S0"); }
const TString & riferimento(const TDocumento& doc, TString& rif) const; const TString & riferimento(const TDocumento& doc, TString& rif) const;
const TString & imponibile() const { return _imponibile;} const TString & imponibile() const { return _imponibile;}
@ -599,9 +596,7 @@ class TDocumento : public TMultiple_rectype // velib03
static TCodgiac_livelli *_livelli; static TCodgiac_livelli *_livelli;
protected: protected:
virtual TRectype * new_body_record(int logicnum = 0) virtual TRectype * new_body_record(int logicnum = 0) { return new TRiga_documento(this); }
{ return new TRiga_documento(this); }
TRiga_documento & row(int index); TRiga_documento & row(int index);
const TRiga_documento& physical_row(int index) const; const TRiga_documento& physical_row(int index) const;
@ -779,6 +774,8 @@ class TDocumento_mask : public TVariable_mask // velib06
bool _ges_mag, _ges_dep; bool _ges_mag, _ges_dep;
TString _std_mag, _std_dep; TString _std_mag, _std_dep;
TSmart_card * _smartcard; TSmart_card * _smartcard;
short _last_cdc_dlg;
short _last_cms_dlg;
protected: protected:
void update_progs(bool stop_run = false); void update_progs(bool stop_run = false);
@ -831,6 +828,8 @@ public:
const TString& stdmag() const { return _std_mag; } const TString& stdmag() const { return _std_mag; }
const TString& stddep() const { return _std_dep; } const TString& stddep() const { return _std_dep; }
const short last_cdc_dlg() const { return _last_cdc_dlg;}
const short last_cms_dlg() const { return _last_cms_dlg;}
TSheet_field& sheet() const { return *_sheet; } TSheet_field& sheet() const { return *_sheet; }
@ -852,8 +851,8 @@ public:
}; };
struct dec_parm { struct dec_parm {
int qta_lit, int qta_lit;
qta_val; int qta_val;
// add other groups here // add other groups here
}; };
@ -866,10 +865,8 @@ class TDocumentoEsteso : public TDocumento
// Parametri del documento // Parametri del documento
dec_parm _parm; // Parametri per gli arrotondamenti dec_parm _parm; // Parametri per gli arrotondamenti
// Totali del documento ricalcolati non appena la tabellina di riepilogo IVA e' completa
// real _importi_netti, _imposte;
// membri per il calcolo del riepilogo IVA // membri per il calcolo del riepilogo IVA
int _sum_filter; // Filtro corrente della riga TRiepilogo_iva in corso di stampa (-1 se non ha ancora calcolato la tabella) int _sum_filter; // Filtro corrente della riga TRiepilogo_iva in corso di stampa (-1 se non ha ancora calcolato la tabella)
bool _sum_selected; // true se ha selezionato una riga del riepilogo, funge da semaforo per leggere la prossima bool _sum_selected; // true se ha selezionato una riga del riepilogo, funge da semaforo per leggere la prossima
TString_array _order_array; // Array di TToken_string contenenti i codici IVA soddisfacenti ad ogni tipo di filtro TString_array _order_array; // Array di TToken_string contenenti i codici IVA soddisfacenti ad ogni tipo di filtro

View File

@ -54,7 +54,9 @@ bool TOriginal_row_mask::on_key(KEY key)
TDocumento_mask::TDocumento_mask(const char* td) TDocumento_mask::TDocumento_mask(const char* td)
: TVariable_mask(), _progs_page(-1), : TVariable_mask(), _progs_page(-1),
_condv(NULL), _smartcard(NULL) _condv(NULL), _smartcard(NULL),
_last_cdc_dlg(-1), _last_cms_dlg(-1)
{ {
CHECK(strlen(td) <= 4, "TDocumento_mask(TipoDocumento) not (MaskName)"); CHECK(strlen(td) <= 4, "TDocumento_mask(TipoDocumento) not (MaskName)");
@ -379,7 +381,9 @@ void TDocumento_mask::insert_anal_page()
else else
{ {
const bool cdc_req = ini.get_bool("CdcRequired"); const bool cdc_req = ini.get_bool("CdcRequired");
insert_anal_fields(*this, newpage, LF_CDC, y, dlg, dlgd, cdc_req); insert_anal_fields(*this, newpage, LF_CDC, y, dlg, dlgd, cdc_req);
_last_cdc_dlg = dlg - 1;
} }
} else } else
if (level == "CMS") // Crea commessa if (level == "CMS") // Crea commessa
@ -389,7 +393,9 @@ void TDocumento_mask::insert_anal_page()
else else
{ {
const bool cms_req = ini.get_bool("CmsRequired"); const bool cms_req = ini.get_bool("CmsRequired");
insert_anal_fields(*this, newpage, LF_COMMESSE, y, dlg, dlgd, cms_req); insert_anal_fields(*this, newpage, LF_COMMESSE, y, dlg, dlgd, cms_req);
_last_cms_dlg = dlg - 1;
} }
} }
} }
@ -1139,14 +1145,21 @@ TVariable_mask* TDocumento_mask::riga_mask(int numriga)
if (use_fsc && fasinfo.parent() == LF_CDC) if (use_fsc && fasinfo.parent() == LF_CDC)
insert_anal_fields(*m, page, LF_FASI, y, dlg, dlgd, false); insert_anal_fields(*m, page, LF_FASI, y, dlg, dlgd, false);
else else
{
insert_anal_fields(*m, page, LF_CDC, y, dlg, dlgd, false); insert_anal_fields(*m, page, LF_CDC, y, dlg, dlgd, false);
m->set_handler( dlg - 1, cdc_mag_handler);
}
} else } else
if (level == "CMS") // Crea commessa if (level == "CMS") // Crea commessa
{ {
if (use_fsc && fasinfo.parent() == LF_COMMESSE) if (use_fsc && fasinfo.parent() == LF_COMMESSE)
insert_anal_fields(*m, page, LF_FASI, y, dlg, dlgd, false); insert_anal_fields(*m, page, LF_FASI, y, dlg, dlgd, false);
else else
{
insert_anal_fields(*m, page, LF_COMMESSE, y, dlg, dlgd, false); insert_anal_fields(*m, page, LF_COMMESSE, y, dlg, dlgd, false);
m->set_handler( dlg - 1, cms_mag_handler);
}
} }
} }
if (use_fsc && fasinfo.parent() <= 0) if (use_fsc && fasinfo.parent() <= 0)

View File

@ -39,6 +39,7 @@
#include "../mg/codcorr.h" #include "../mg/codcorr.h"
#include "../mg/deslin.h" #include "../mg/deslin.h"
#include "../mg/umart.h" #include "../mg/umart.h"
#include "../ca/calib01.h"
#include "velib.h" #include "velib.h"
#define MAX_VIS_RATE 5 #define MAX_VIS_RATE 5
@ -78,7 +79,7 @@ bool numdocrif_hndl( TMask_field& field, KEY key )
(const char *)field.get()); (const char *)field.get());
} }
} }
return TRUE; return true;
} }
bool totdoc_hndl( TMask_field& field, KEY key ) bool totdoc_hndl( TMask_field& field, KEY key )
@ -99,7 +100,7 @@ bool totdoc_hndl( TMask_field& field, KEY key )
(const char *) tchk, totdoc.string()); (const char *) tchk, totdoc.string());
} }
} }
return TRUE; return true;
} }
bool smart_hndl( TMask_field& field, KEY key ) bool smart_hndl( TMask_field& field, KEY key )
@ -148,7 +149,7 @@ bool smart_hndl( TMask_field& field, KEY key )
} }
} }
return TRUE; return true;
} }
bool ora_hndl( TMask_field& field, KEY key ) bool ora_hndl( TMask_field& field, KEY key )
@ -192,7 +193,7 @@ bool ora_hndl( TMask_field& field, KEY key )
bool dummy_hndl(TMask_field& field, KEY key) bool dummy_hndl(TMask_field& field, KEY key)
{ {
warning_box( "Al campo %d è arrivato un KEY %d", field.dlg( ), key ); warning_box( "Al campo %d è arrivato un KEY %d", field.dlg( ), key );
return TRUE; return true;
} }
// Handler per il calcolo delle date di pagamento // Handler per il calcolo delle date di pagamento
@ -229,7 +230,7 @@ bool condpag_hndl( TMask_field& field, KEY key )
} }
} }
} }
return TRUE; return true;
} }
bool note_hndl( TMask_field& f, KEY key ) bool note_hndl( TMask_field& f, KEY key )
@ -284,7 +285,7 @@ bool data_hndl( TMask_field& field, KEY key )
} }
if (m.id2pos(F_DATACAMBIO1) >= 0 && !m.get(F_CODVAL).empty()) if (m.id2pos(F_DATACAMBIO1) >= 0 && !m.get(F_CODVAL).empty())
m.set(F_DATACAMBIO1, field.get(), TRUE); m.set(F_DATACAMBIO1, field.get(), true);
} }
if (key == K_ENTER || field.to_check(key)) if (key == K_ENTER || field.to_check(key))
{ {
@ -318,15 +319,13 @@ bool data_hndl( TMask_field& field, KEY key )
} }
} }
if (codnum.dont_test_datadoc()) if (codnum.dont_test_datadoc())
return TRUE; // Non devo fare altri test return true; // Non devo fare altri test
TLocalisamfile doc(LF_DOC); TLocalisamfile doc(LF_DOC);
doc.curr() = m.doc().head(); doc.curr() = m.doc().head();
bool same_key = FALSE; bool same_key = false;
doc.read(_isgteq); doc.read(_isgteq);
if (doc.eof() || doc.prev() == NOERR) if (doc.eof() || doc.prev() == NOERR)
@ -344,7 +343,7 @@ bool data_hndl( TMask_field& field, KEY key )
if (doc.good() && same_key && datadoc > doc.get_date(DOC_DATADOC)) if (doc.good() && same_key && datadoc > doc.get_date(DOC_DATADOC))
return field.error_box("Data documento superiore alla data del documento successivo"); return field.error_box("Data documento superiore alla data del documento successivo");
} }
return TRUE; return true;
} }
// handler delle righe // handler delle righe
@ -360,7 +359,7 @@ void row_set_handler( TMask& m, const int field, const int index )
m.set_handler( field, dummy_hndl ); m.set_handler( field, dummy_hndl );
break; break;
default: default:
yesnofatal_box( FALSE, "Funzione di handler sulla riga non definita( %d ).", index ); yesnofatal_box( false, "Funzione di handler sulla riga non definita( %d ).", index );
} }
} }
@ -386,7 +385,7 @@ bool iva_handler( TMask_field& f, KEY key )
TRiga_documento& riga = mask.doc()[r]; TRiga_documento& riga = mask.doc()[r];
const int pos_ai = row_mask.id2pos(FR_ADDIVA); const int pos_ai = row_mask.id2pos(FR_ADDIVA);
bool addiva = FALSE; bool addiva = false;
if (pos_ai >= 0) if (pos_ai >= 0)
addiva = row_mask.fld(pos_ai).get() == "X"; // Controlla le righe Omaggio solo se e' settato l'addebito IVA addiva = row_mask.fld(pos_ai).get() == "X"; // Controlla le righe Omaggio solo se e' settato l'addebito IVA
@ -407,7 +406,7 @@ bool iva_handler( TMask_field& f, KEY key )
return f.error_box("Il codice IVA e' obbligatorio."); return f.error_box("Il codice IVA e' obbligatorio.");
} }
} }
return TRUE; return true;
} }
bool dcons_handler( TMask_field& f, KEY key ) bool dcons_handler( TMask_field& f, KEY key )
@ -502,7 +501,7 @@ bool dcons_handler( TMask_field& f, KEY key )
} }
} }
} }
return TRUE; return true;
} }
bool tipo_riga_handler(TMask_field& f, KEY key) bool tipo_riga_handler(TMask_field& f, KEY key)
@ -549,7 +548,7 @@ bool tipo_riga_handler(TMask_field& f, KEY key)
bool codmag_handler( TMask_field& f, KEY key ) bool codmag_handler( TMask_field& f, KEY key )
{ {
// if (f.to_check(key, TRUE)) // if (f.to_check(key, true))
if (key == K_TAB && f.focusdirty()) if (key == K_TAB && f.focusdirty())
{ {
TMask& row_mask = f.mask(); TMask& row_mask = f.mask();
@ -576,7 +575,7 @@ bool codmag_handler( TMask_field& f, KEY key )
docmask.update_giacenza(); docmask.update_giacenza();
} }
return TRUE; return true;
} }
bool codmag_coll_handler( TMask_field& f, KEY key ) bool codmag_coll_handler( TMask_field& f, KEY key )
@ -601,7 +600,7 @@ bool codmag_coll_handler( TMask_field& f, KEY key )
} }
} }
} }
return TRUE; return true;
} }
void upd_colli_peso_tara(TMask& m, const TRectype& a) void upd_colli_peso_tara(TMask& m, const TRectype& a)
@ -663,23 +662,23 @@ bool pricerange_handler(TMask_field& f, KEY key )
if (incr == 0 && decr == 0) if (incr == 0 && decr == 0)
{ {
if (old_price != new_price && !yesno_box("Il prezzo è variato, confermare")) if (old_price != new_price && !yesno_box("Il prezzo è variato, confermare"))
return FALSE; return false;
} }
else else
{ {
real inf = old_price * (UNO - (decr/CENTO)); real inf = old_price * (UNO - (decr/CENTO));
if (inf > new_price && !yesno_box("Il prezzo è diminuito di più del %d%%, confermare", decr)) if (inf > new_price && !yesno_box("Il prezzo è diminuito di più del %d%%, confermare", decr))
return FALSE; return false;
real sup = old_price * (UNO + (incr/CENTO)); real sup = old_price * (UNO + (incr/CENTO));
if (sup < new_price && !yesno_box("Il prezzo è aumentato di più del %d%%, confermare", incr)) if (sup < new_price && !yesno_box("Il prezzo è aumentato di più del %d%%, confermare", incr))
return FALSE; return false;
} }
} }
riga.put(RDOC_PREZZO, new_price); riga.put(RDOC_PREZZO, new_price);
} }
} }
return TRUE; return true;
} }
bool codart_handler(TMask_field& f, KEY key ) bool codart_handler(TMask_field& f, KEY key )
@ -687,10 +686,9 @@ bool codart_handler(TMask_field& f, KEY key )
TMask& row_mask = f.mask(); TMask& row_mask = f.mask();
TSheet_field& sh = *row_mask.get_sheet(); TSheet_field& sh = *row_mask.get_sheet();
TDocumento_mask& mask = (TDocumento_mask &)sh.mask(); TDocumento_mask& mask = (TDocumento_mask &)sh.mask();
const int current_doc_row = sh.selected() + 1; const int current_doc_row = sh.selected() + 1;
if (f.to_check(key, TRUE)) if (f.to_check(key, true))
{ {
if (!f.empty()) if (!f.empty())
row_mask.enable(FR_LIV1); row_mask.enable(FR_LIV1);
@ -714,7 +712,7 @@ bool codart_handler(TMask_field& f, KEY key )
bool found = !anamag.empty(); bool found = !anamag.empty();
if (found) if (found)
row_mask.set(FR_CODARTMAG, codart, TRUE); row_mask.set(FR_CODARTMAG, codart, true);
else else
{ {
TLocalisamfile codalt(LF_CODCORR); TLocalisamfile codalt(LF_CODCORR);
@ -727,12 +725,12 @@ bool codart_handler(TMask_field& f, KEY key )
anamag = cache().get(LF_ANAMAG, codart); anamag = cache().get(LF_ANAMAG, codart);
found = !anamag.empty(); found = !anamag.empty();
if (found) if (found)
row_mask.set(FR_CODARTMAG, codart, TRUE); row_mask.set(FR_CODARTMAG, codart, true);
} }
} }
row_mask.set(FR_CHECKED, "X"); row_mask.set(FR_CHECKED, "X");
if (!found) if (!found)
row_mask.set(FR_CODARTMAG, "", TRUE); row_mask.set(FR_CODARTMAG, "", true);
else else
{ {
const TString8 lingua = mask.get(F_CODLIN); const TString8 lingua = mask.get(F_CODLIN);
@ -824,7 +822,6 @@ bool codart_handler(TMask_field& f, KEY key )
} }
} }
} }
} }
else else
if (key == K_F8 && !sh.sheet_mask().is_running()) if (key == K_F8 && !sh.sheet_mask().is_running())
@ -865,7 +862,7 @@ bool codart_handler(TMask_field& f, KEY key )
const int items = db.explode(components, matbase, raggart, livello, "A", ordin); const int items = db.explode(components, matbase, raggart, livello, "A", ordin);
if (items > 0) if (items > 0)
{ {
TProgind pi(items, "Esplosione in corso...",FALSE, TRUE); TProgind pi(items, "Esplosione in corso...",false, true);
int row = current_doc_row; int row = current_doc_row;
const TString16 tiporiga(curr_row.tipo().codice()); const TString16 tiporiga(curr_row.tipo().codice());
@ -876,7 +873,7 @@ bool codart_handler(TMask_field& f, KEY key )
pi.addstatus(1L); pi.addstatus(1L);
TRiga_esplosione & r = (TRiga_esplosione &) components[i]; TRiga_esplosione & r = (TRiga_esplosione &) components[i];
TRiga_documento & new_row = doc.insert_row(row + 1, tiporiga); TRiga_documento & new_row = doc.insert_row(row + 1, tiporiga);
//sh.insert(row, FALSE); //sh.insert(row, false);
str_arr.insert(new TToken_string, row); str_arr.insert(new TToken_string, row);
TDocumento::copy_data(new_row, curr_row); TDocumento::copy_data(new_row, curr_row);
@ -895,7 +892,7 @@ bool codart_handler(TMask_field& f, KEY key )
if (!valcomp) if (!valcomp)
{ {
new_row.zero(RDOC_PREZZO); new_row.zero(RDOC_PREZZO);
// new_row.autoload(sh); // Da rdoc a sheet // new_row.autoload(sh); // Da rdoc a shee
sh.row(row).add("0", FR_PREZZO-FIRST_FIELD); sh.row(row).add("0", FR_PREZZO-FIRST_FIELD);
row_mask.reset(FR_PREZZO); row_mask.reset(FR_PREZZO);
} }
@ -903,8 +900,8 @@ bool codart_handler(TMask_field& f, KEY key )
} }
if (elrorig) if (elrorig)
{ {
doc.destroy_row(current_doc_row, TRUE); doc.destroy_row(current_doc_row, true);
sh.destroy(current_doc_row - 1, FALSE); sh.destroy(current_doc_row - 1, false);
row--; row--;
} }
else else
@ -918,9 +915,7 @@ bool codart_handler(TMask_field& f, KEY key )
} }
} }
} }
return true;
return TRUE;
} }
bool codartmag_handler( TMask_field& f, KEY key ) bool codartmag_handler( TMask_field& f, KEY key )
@ -943,12 +938,12 @@ bool codartmag_handler( TMask_field& f, KEY key )
mask.update_giacenza(); mask.update_giacenza();
} }
return TRUE; return true;
} }
bool liv_handler( TMask_field& f, KEY key ) bool liv_handler( TMask_field& f, KEY key )
{ {
bool ok = TRUE; bool ok = true;
TDocumento_mask & mask=(TDocumento_mask &) f.mask().get_sheet()->mask(); TDocumento_mask & mask=(TDocumento_mask &) f.mask().get_sheet()->mask();
if (key == K_TAB && f.focusdirty() && !f.get().empty()) if (key == K_TAB && f.focusdirty() && !f.get().empty())
@ -1015,7 +1010,7 @@ bool liv_handler( TMask_field& f, KEY key )
} }
} }
if (f.to_check(key, TRUE)) if (f.to_check(key, true))
{ {
if (f.dlg() < FR_LIV4) if (f.dlg() < FR_LIV4)
{ {
@ -1087,14 +1082,13 @@ bool umart_handler( TMask_field& f, KEY key )
qta.round(5); qta.round(5);
row_mask.set(FR_QTAEVASA, qta); row_mask.set(FR_QTAEVASA, qta);
} }
} }
curr_um = um; curr_um = um;
curr_fc = fc; curr_fc = fc;
condv.ricerca(TRUE); condv.ricerca(true);
mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO)); mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO));
} }
return TRUE; return true;
} }
bool um_handler( TMask_field& f, KEY key ) bool um_handler( TMask_field& f, KEY key )
@ -1126,7 +1120,6 @@ bool um_handler( TMask_field& f, KEY key )
const real fc1 = ums.get_real("R10"); const real fc1 = ums.get_real("R10");
const TString16 umsrif1(ums.get("S7")); const TString16 umsrif1(ums.get("S7"));
if (fc1 > ZERO) if (fc1 > ZERO)
{ {
if (curr_um == umsrif1) if (curr_um == umsrif1)
@ -1145,12 +1138,11 @@ bool um_handler( TMask_field& f, KEY key )
qta.round(5); qta.round(5);
row_mask.set(FR_QTAEVASA, qta); row_mask.set(FR_QTAEVASA, qta);
} }
} }
curr_um = um; curr_um = um;
curr_fc = fc; curr_fc = fc;
} }
return TRUE; return true;
} }
bool descr_handler( TMask_field& f, KEY key ) bool descr_handler( TMask_field& f, KEY key )
@ -1166,7 +1158,7 @@ bool descr_handler( TMask_field& f, KEY key )
f.mask().set(FR_CODART, anamag.get(ANAMAG_CODART), 3); f.mask().set(FR_CODART, anamag.get(ANAMAG_CODART), 3);
} }
} }
return TRUE; return true;
} }
bool qtaart_handler( TMask_field& f, KEY key ) bool qtaart_handler( TMask_field& f, KEY key )
@ -1181,7 +1173,7 @@ bool qtaart_handler( TMask_field& f, KEY key )
TCond_vendita & condv = mask.condv(); TCond_vendita & condv = mask.condv();
condv.set_riga(&row_mask); condv.set_riga(&row_mask);
condv.ricerca(FALSE, TRUE); condv.ricerca(false, true);
mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO)); mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO));
const TString& codart = row_mask.get(FR_CODARTMAG); const TString& codart = row_mask.get(FR_CODARTMAG);
@ -1254,7 +1246,6 @@ bool qtaart_handler( TMask_field& f, KEY key )
} }
} }
} }
return qta_handler(f, key); return qta_handler(f, key);
} }
@ -1276,7 +1267,7 @@ bool qta_handler( TMask_field& f, KEY key )
row_mask.enable(FR_RIGAEVASA); row_mask.enable(FR_RIGAEVASA);
} }
return TRUE; return true;
} }
bool qta_evasa_handler( TMask_field& f, KEY key ) bool qta_evasa_handler( TMask_field& f, KEY key )
@ -1301,7 +1292,7 @@ bool qta_evasa_handler( TMask_field& f, KEY key )
sheet->enable_cell(riga, sheet->cid2index(FR_RIGAEVASA), enable_evasa); sheet->enable_cell(riga, sheet->cid2index(FR_RIGAEVASA), enable_evasa);
} }
} }
return TRUE; return true;
} }
bool causmag_handler( TMask_field& f, KEY key ) bool causmag_handler( TMask_field& f, KEY key )
@ -1323,22 +1314,22 @@ bool causmag_handler( TMask_field& f, KEY key )
{ {
if (c.has_default_mag() && row_mask.get(FR_CODMAG).empty()) if (c.has_default_mag() && row_mask.get(FR_CODMAG).empty())
{ {
row_mask.set(FR_CODMAG, c.default_mag(), TRUE); row_mask.set(FR_CODMAG, c.default_mag(), true);
row_mask.set(FR_CODDEPC, "", TRUE); row_mask.set(FR_CODDEPC, "", true);
} }
if (c.has_default_dep() && row_mask.get(FR_CODDEP).empty()) if (c.has_default_dep() && row_mask.get(FR_CODDEP).empty())
row_mask.set(FR_CODDEP, c.default_dep(), TRUE); row_mask.set(FR_CODDEP, c.default_dep(), true);
if (!c.caus_collegata().empty()) if (!c.caus_collegata().empty())
{ {
c = cache().get("%CAU", c.caus_collegata()); c = cache().get("%CAU", c.caus_collegata());
if (c.has_default_mag() && row_mask.get(FR_CODMAGC).empty()) if (c.has_default_mag() && row_mask.get(FR_CODMAGC).empty())
{ {
row_mask.set(FR_CODMAGC, c.default_mag(), TRUE); row_mask.set(FR_CODMAGC, c.default_mag(), true);
row_mask.set(FR_CODDEPC, "", TRUE); row_mask.set(FR_CODDEPC, "", true);
} }
if (c.has_default_dep() && row_mask.get(FR_CODDEPC).empty()) if (c.has_default_dep() && row_mask.get(FR_CODDEPC).empty())
row_mask.set(FR_CODDEPC, c.default_dep(), TRUE); row_mask.set(FR_CODDEPC, c.default_dep(), true);
static int copy_defmagc = -883; static int copy_defmagc = -883;
if (copy_defmagc < 0) if (copy_defmagc < 0)
@ -1350,9 +1341,9 @@ bool causmag_handler( TMask_field& f, KEY key )
if (copy_defmagc!=0) if (copy_defmagc!=0)
{ {
if (row_mask.get(FR_CODMAGC).empty()) if (row_mask.get(FR_CODMAGC).empty())
row_mask.set(FR_CODMAGC, mask.stdmag(), TRUE); row_mask.set(FR_CODMAGC, mask.stdmag(), true);
if (row_mask.get(FR_CODDEPC).empty()) if (row_mask.get(FR_CODDEPC).empty())
row_mask.set(FR_CODDEPC, mask.stddep(), TRUE); row_mask.set(FR_CODDEPC, mask.stddep(), true);
} }
} }
if (!c.movimenta_sospesi()) if (!c.movimenta_sospesi())
@ -1364,7 +1355,7 @@ bool causmag_handler( TMask_field& f, KEY key )
} }
} }
} }
return TRUE; return true;
} }
bool sppr_handler( TMask_field& f, KEY key ) bool sppr_handler( TMask_field& f, KEY key )
@ -1387,8 +1378,8 @@ bool sppr_handler( TMask_field& f, KEY key )
const char tipo = sp.tipo(); const char tipo = sp.tipo();
const bool qta_val_fl = tipo == 'Q'; const bool qta_val_fl = tipo == 'Q';
const bool perc_fl = tipo == 'P'; const bool perc_fl = tipo == 'P';
short pos = row_mask.id2pos(FR_UMQTASP); short pos = row_mask.id2pos(FR_UMQTASP);
if (pos >= 0) if (pos >= 0)
row_mask.fld(pos).enable(!perc_fl); row_mask.fld(pos).enable(!perc_fl);
pos = row_mask.id2pos(FR_PREZZO); pos = row_mask.id2pos(FR_PREZZO);
@ -1409,7 +1400,6 @@ bool sppr_handler( TMask_field& f, KEY key )
row_mask.fld(pos).show(perc_fl); row_mask.fld(pos).show(perc_fl);
row_mask.fld(pos).enable(perc_fl); row_mask.fld(pos).enable(perc_fl);
} }
if (!perc_fl) if (!perc_fl)
{ {
const real cambio = mask.get_real(F_CAMBIO); const real cambio = mask.get_real(F_CAMBIO);
@ -1427,7 +1417,7 @@ bool sppr_handler( TMask_field& f, KEY key )
} }
} }
} }
return TRUE; return true;
} }
bool TDocumento_mask::numdocrif_search_handler(TMask_field& f, KEY key) bool TDocumento_mask::numdocrif_search_handler(TMask_field& f, KEY key)
@ -1437,9 +1427,12 @@ bool TDocumento_mask::numdocrif_search_handler(TMask_field& f, KEY key)
TMask& m = f.mask(); TMask& m = f.mask();
TRectype filtrec(LF_DOC); TRectype filtrec(LF_DOC);
filtrec.put(DOC_TIPOCF, m.get(F_TIPOCF)); filtrec.put(DOC_TIPOCF, m.get(F_TIPOCF));
filtrec.put(DOC_CODCF, m.get(F_CODCF)); filtrec.put(DOC_CODCF, m.get(F_CODCF));
const long codcf = atol(m.get(F_CODCF)); const long codcf = atol(m.get(F_CODCF));
if (codcf != 0) if (codcf != 0)
filtrec.put(DOC_TIPOCF, m.get(F_TIPOCF)); filtrec.put(DOC_TIPOCF, m.get(F_TIPOCF));
@ -1461,8 +1454,7 @@ bool TDocumento_mask::numdocrif_search_handler(TMask_field& f, KEY key)
m.stop_run(K_AUTO_ENTER); m.stop_run(K_AUTO_ENTER);
} }
} }
return true;
return TRUE;
} }
bool TDocumento_mask::ragsoc_search_handler(TMask_field& f, KEY key) bool TDocumento_mask::ragsoc_search_handler(TMask_field& f, KEY key)
@ -1472,6 +1464,7 @@ bool TDocumento_mask::ragsoc_search_handler(TMask_field& f, KEY key)
TMask& m = f.mask(); TMask& m = f.mask();
TRectype filtrec(LF_DOC); TRectype filtrec(LF_DOC);
filtrec.put(DOC_CODNUM, m.get(F_CODNUM)); filtrec.put(DOC_CODNUM, m.get(F_CODNUM));
filtrec.put(DOC_PROVV, m.get(F_PROVV)); filtrec.put(DOC_PROVV, m.get(F_PROVV));
filtrec.put(DOC_ANNO, m.get(F_ANNO)); filtrec.put(DOC_ANNO, m.get(F_ANNO));
@ -1481,7 +1474,8 @@ bool TDocumento_mask::ragsoc_search_handler(TMask_field& f, KEY key)
TSorted_cursor cur(&rel, "TIPOCF|UPPER(20->RAGSOC)|PROVV|ANNO|CODNUM|PROVV|NDOC", "", 1, &filtrec, &filtrec); TSorted_cursor cur(&rel, "TIPOCF|UPPER(20->RAGSOC)|PROVV|ANNO|CODNUM|PROVV|NDOC", "", 1, &filtrec, &filtrec);
TString80 form; form.format("CODNUM==\"%s\"", (const char *)m.get(F_CODNUM)); TString80 form; form.format("CODNUM==\"%s\"", (const char *)m.get(F_CODNUM));
cur.setfilter(form, TRUE); cur.setfilter(form, true);
TCursor_sheet sheet(&cur, "20->RAGSOC|CODCF|20->PAIV|ANNO|CODNUM|NDOC|DATADOC|CODVAL|G1:TOTDOC", TCursor_sheet sheet(&cur, "20->RAGSOC|CODCF|20->PAIV|ANNO|CODNUM|NDOC|DATADOC|CODVAL|G1:TOTDOC",
"Ragione Sociale", "Ragione Sociale",
"Ragione Sociale@50|Codice|Partita IVA|Anno|Numeraz|Documento|Data\nDocumento@10|Valuta|Totale\nDocumento@18V", "Ragione Sociale@50|Codice|Partita IVA|Anno|Numeraz|Documento|Data\nDocumento@10|Valuta|Totale\nDocumento@18V",
@ -1501,12 +1495,9 @@ bool TDocumento_mask::ragsoc_search_handler(TMask_field& f, KEY key)
m.stop_run(K_AUTO_ENTER); m.stop_run(K_AUTO_ENTER);
} }
} }
return true;
return TRUE;
} }
bool TDocumento_mask::datadocrif_handler(TMask_field& f, KEY key) bool TDocumento_mask::datadocrif_handler(TMask_field& f, KEY key)
{ {
if (key == K_ENTER && f.empty()) if (key == K_ENTER && f.empty())
@ -1520,7 +1511,7 @@ bool TDocumento_mask::datadocrif_handler(TMask_field& f, KEY key)
"quando si desidera generare effetti raggruppati"); "quando si desidera generare effetti raggruppati");
} }
} }
return TRUE; return true;
} }
bool link_handler( TMask_field& f, KEY key ) bool link_handler( TMask_field& f, KEY key )
@ -1534,5 +1525,54 @@ bool link_handler( TMask_field& f, KEY key )
const TRiga_documento & r = d[nrow]; const TRiga_documento & r = d[nrow];
r.edit(LF_DOC, "DAPROVV|DAANNO|DACODNUM|DANDOC"); r.edit(LF_DOC, "DAPROVV|DAANNO|DACODNUM|DANDOC");
} }
return TRUE; return true;
}
bool ca_mag_handler(TMask_field& f, bool cdc = true)
{
TMask& row_mask = f.mask();
const TSheet_field & sf = *f.mask().get_sheet();
const TDocumento_mask & mask = (TDocumento_mask & )sf.mask();
short i, first_fld, last_fld;
const int lffile = cdc ? LF_CDC : LF_COMMESSE;
const TMultilevel_code_info & info = ca_multilevel_code_info(lffile);
TString80 cod;
last_fld = f.dlg();
first_fld = last_fld - info.levels() + 1;
for (i = first_fld; i <= last_fld; i++)
cod << row_mask.get(i);
if (cod.blank())
{
cod.cut(0);
last_fld = cdc ? mask.last_cdc_dlg() : mask.last_cms_dlg();
first_fld = last_fld - info.levels() + 1;
for (i = first_fld; i <= last_fld; i++)
cod << mask.get(i);
}
const TRectype & rec = cache().get(lffile, cod);
const TString16 codmag = rec.get("CODMAG");
if (codmag.not_empty())
{
row_mask.set(FR_CODMAG, codmag.left(3), true);
row_mask.set(FR_CODDEP, codmag.mid(3), true);
}
return true;
}
bool cms_mag_handler(TMask_field& f, KEY key)
{
if ((key == K_TAB && f.focusdirty()) || key == K_ENTER)
ca_mag_handler(f, false);
return true;
}
bool cdc_mag_handler(TMask_field& f, KEY key)
{
if ((key == K_TAB && f.focusdirty()) || key == K_ENTER)
ca_mag_handler(f);
return true;
} }

View File

@ -27,6 +27,9 @@ bool qta_evasa_handler(TMask_field& f, KEY key);
bool causmag_handler(TMask_field& f, KEY key); bool causmag_handler(TMask_field& f, KEY key);
bool pricerange_handler(TMask_field& f, KEY key ); bool pricerange_handler(TMask_field& f, KEY key );
bool link_handler( TMask_field& f, KEY key ); bool link_handler( TMask_field& f, KEY key );
bool cdc_mag_handler(TMask_field& f, KEY key);
bool cms_mag_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);