Aggiunti handlers per stampe industriali

git-svn-id: svn://10.65.10.50/branches/R_10_00@22945 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2014-05-14 08:32:23 +00:00
parent d19f6148e1
commit 572ff303d1
12 changed files with 3646 additions and 3509 deletions

View File

@ -844,7 +844,7 @@ void TTRI_handlers_mask::mask2prof(TTipo_riga_documento & tipo)
profile.set(RDOC_QTAEVASA, get(F_QTAEVASAR)); profile.set(RDOC_QTAEVASA, get(F_QTAEVASAR));
profile.set("QTA_MAG", get(F_QTAMAGR)); profile.set("QTA_MAG", get(F_QTAMAGR));
profile.set("QTAEVASA_MAG", get(F_QTAEVASAMAGR)); profile.set("QTAEVASA_MAG", get(F_QTAEVASAMAGR));
profile.set("LIVGEN", get(F_LIVGEN1), NULL, true, 1); profile.set("LIVGEN", get(F_LIVGEN1), NULL, true, 1);
profile.set("LIVGEN", get(F_LIVGEN2), NULL, true, 2); profile.set("LIVGEN", get(F_LIVGEN2), NULL, true, 2);
profile.set("LIVGEN", get(F_LIVGEN3), NULL, true, 3); profile.set("LIVGEN", get(F_LIVGEN3), NULL, true, 3);
profile.set("LIVGEN", get(F_LIVGEN4), NULL, true, 4); profile.set("LIVGEN", get(F_LIVGEN4), NULL, true, 4);
@ -859,24 +859,19 @@ void TTRI_handlers_mask::mask2prof(TTipo_riga_documento & tipo)
for (int i = 0 ; i < 10; i++) for (int i = 0 ; i < 10; i++)
profile.remove(format("%d", i)); profile.remove(format("%d", i));
TSheet_field& sh = sfield(F_HANDLERSR);
TSheet_field & sh = sfield(F_HANDLERSR);
FOR_EACH_SHEET_ROW(sh, r, row) FOR_EACH_SHEET_ROW(sh, r, row)
{ {
const short id = row->get_int(1); const short id = row->get_int(1);
profile.set("Handler", row->get_int(0), NULL, true, id); profile.set("Handler", row->get_int(0), NULL, true, id);
} }
profile.set_paragraph("DEFAULT"); profile.set_paragraph("DEFAULT");
profile.remove_array("Default"); profile.remove_array("Default");
TSheet_field & sd = sfield(F_DEFAULTSR); TSheet_field& sd = sfield(F_DEFAULTSR);
FOR_EACH_SHEET_ROW(sd, dr, drow) FOR_EACH_SHEET_ROW(sd, dr, drow)
{ {
const short id = drow->get_int(0); const short id = drow->get_int(0);
profile.set("Default", drow->get(), NULL, true, id); profile.set("Default", drow->get(), NULL, true, id);
} }
} }

View File

@ -1458,10 +1458,9 @@ void TStampaDoc_application::print_selected(KEY k)
int ncopie = _ncopie <= 0 ? mainform->ncopie() : _ncopie; // Numero di copie da stampare per questo documento int ncopie = _ncopie <= 0 ? mainform->ncopie() : _ncopie; // Numero di copie da stampare per questo documento
if (ncopie <= 0) ncopie = 1; if (ncopie <= 0) ncopie = 1;
TDocumentoEsteso& extdoc = mainform->doc();
for (int n=0; n < ncopie; n++) for (int n=0; n < ncopie; n++)
{ {
TDocumentoEsteso& extdoc = mainform->doc();
print_documento(*mainform); print_documento(*mainform);
extdoc.summary_reset(); extdoc.summary_reset();
extdoc.scadenze_reset(); extdoc.scadenze_reset();
@ -1497,7 +1496,12 @@ void TStampaDoc_application::print_selected(KEY k)
} }
// Totalizza gli importi per eventuale stampa su FAKETOTFLD // Totalizza gli importi per eventuale stampa su FAKETOTFLD
totdocumenti += mainform->doc().totale_doc(); const real tot = extdoc.totale_doc();
if (extdoc.is_nota_credito())
totdocumenti -= tot;
else
totdocumenti += tot;
if (i == items - 1 && mainform->is_faketotfld()) if (i == items - 1 && mainform->is_faketotfld())
{ {
mainform->hide_sections(); mainform->hide_sections();

View File

@ -83,7 +83,7 @@ void TFatturazione_bolle_app::process_by_cli(const TMask& m)
for (int c = 0; c < tot_cli && !iw.iscancelled(); c++) for (int c = 0; c < tot_cli && !iw.iscancelled(); c++)
{ {
const long codcli = clienti[c]; // Codice cliente in esame const long codcli = clienti[c]; // Codice cliente in esame
msg = "Elaborazione dei documenti del cliente "; msg = TR("Elaborazione documenti del cliente ");
msg << codcli << " ..."; msg << codcli << " ...";
iw.set_text(msg); // Messaggio sul cliente iw.set_text(msg); // Messaggio sul cliente
do_events(); // Attende visualizzazione do_events(); // Attende visualizzazione
@ -92,6 +92,8 @@ void TFatturazione_bolle_app::process_by_cli(const TMask& m)
din.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an); din.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
if (din.items() > 0 && !iw.iscancelled()) if (din.items() > 0 && !iw.iscancelled())
{ {
if (m.get(F_ORDINAMENTO) == "Z")
din.sort(DOC_ZONA"|"DOC_DATADOC"|"DOC_NDOC);
bool ok = process(iw, eld, din, data_elab); bool ok = process(iw, eld, din, data_elab);
if (!ok) // In caso di errore termina qui l'elaborazione. if (!ok) // In caso di errore termina qui l'elaborazione.
break; break;
@ -135,7 +137,7 @@ void TFatturazione_bolle_app::process_by_ragsoc(const TMask& m)
for (int c = 0; c < tot_cli && !iw.iscancelled(); c++) for (int c = 0; c < tot_cli && !iw.iscancelled(); c++)
{ {
const long codcli = clienti[c]; // Codice cliente in esame const long codcli = clienti[c]; // Codice cliente in esame
msg = "Elaborazione dei documenti del cliente "; msg = TR("Elaborazione documenti del cliente ");
msg << codcli << " ..."; msg << codcli << " ...";
iw.set_text(msg); // Messaggio sul cliente iw.set_text(msg); // Messaggio sul cliente
do_events(); // Attende visualizzazione do_events(); // Attende visualizzazione
@ -144,6 +146,8 @@ void TFatturazione_bolle_app::process_by_ragsoc(const TMask& m)
din.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an); din.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
if (din.items() > 0 && !iw.iscancelled()) if (din.items() > 0 && !iw.iscancelled())
{ {
if (m.get(F_ORDINAMENTO) == "Z")
din.sort(DOC_ZONA"|"DOC_DATADOC"|"DOC_NDOC);
bool ok = process(iw, eld, din, data_elab); bool ok = process(iw, eld, din, data_elab);
if (!ok) // In caso di errore termina qui l'elaborazione. if (!ok) // In caso di errore termina qui l'elaborazione.
break; break;
@ -190,16 +194,13 @@ void TFatturazione_bolle_app::process_by_doc(const TMask& m)
for (int c = 0; c < tot_cli && !iw.iscancelled(); c++) for (int c = 0; c < tot_cli && !iw.iscancelled(); c++)
{ {
const long codcli = clienti[c]; // Codice cliente in esame const long codcli = clienti[c]; // Codice cliente in esame
msg = TR("Elaborazione dei documenti del cliente"); msg = TR("Elaborazione documenti del cliente");
msg << ' ' << codcli << "..."; msg << ' ' << codcli << "...";
iw.set_text(msg); // Messaggio sul cliente iw.set_text(msg); // Messaggio sul cliente
do_events(); // Attende visualizzazione do_events(); // Attende visualizzazione
if (codcli == 203726)
int cazzone = 1;
TLista_documenti list; TLista_documenti list;
list.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an); list.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
for (int i = list.items()-1; i >= 0; i--) for (int i = list.items()-1; i >= 0; i--)
@ -227,7 +228,11 @@ void TFatturazione_bolle_app::process_by_doc(const TMask& m)
din.add(list[j]); din.add(list[j]);
} }
if (din.items() > 0 && !iw.iscancelled()) if (din.items() > 0 && !iw.iscancelled())
bool ok = process(iw, eld, din, data_elab); {
if (m.get(F_ORDINAMENTO) == "Z")
din.sort(DOC_ZONA"|"DOC_DATADOC"|"DOC_NDOC);
process(iw, eld, din, data_elab);
}
delete e; delete e;
} }
@ -372,7 +377,8 @@ void TFatturazione_bolle_app::main_loop()
cfg.set("FATBOLSEL", _default_selection = select_from); cfg.set("FATBOLSEL", _default_selection = select_from);
} }
if (m.get(F_ORDINAMENTO) == "R") const TString& orderby = m.get(F_ORDINAMENTO);
if (orderby == "R")
process_by_ragsoc(m); process_by_ragsoc(m);
else else
{ {

View File

@ -71,22 +71,22 @@ END
RADIOBUTTON F_ORDINAMENTO 20 RADIOBUTTON F_ORDINAMENTO 20
BEGIN BEGIN
PROMPT 3 5 "@bOrdinamento per" PROMPT 3 5 "@bOrdinamento per"
ITEM "C|Clienti" ITEM "C|Cliente"
MESSAGE ENABLE,1@|CLEAR,2@|CLEAR,3@|CLEAR,4@ MESSAGE ENABLE,1@|CLEAR,2@|CLEAR,3@|CLEAR,4@
ITEM "R|Ragione Soc.Clienti" ITEM "R|Ragione Sociale"
MESSAGE CLEAR,1@|CLEAR,2@|CLEAR,3@|ENABLE,4@ MESSAGE CLEAR,1@|CLEAR,2@|CLEAR,3@|ENABLE,4@
ITEM "A|Agenti" ITEM "A|Agente"
MESSAGE CLEAR,1@|ENABLE,2@|CLEAR,3@|CLEAR,4@ MESSAGE CLEAR,1@|ENABLE,2@|CLEAR,3@|CLEAR,4@
ITEM "Z|Zone" ITEM "Z|Zona"
MESSAGE CLEAR,1@|CLEAR,2@|ENABLE,3@|CLEAR,4@ MESSAGE CLEAR,1@|CLEAR,2@|ENABLE,3@|CLEAR,4@
END END
RADIOBUTTON F_ORDINAMENTO_2 20 RADIOBUTTON F_ORDINAMENTO_2 20
BEGIN BEGIN
PROMPT 3 5 "@bSelezione per" PROMPT 3 5 "@bSelezione per"
ITEM "A|Agenti" ITEM "A|Agente"
MESSAGE ENABLE,1@|ENABLE,2@|CLEAR,3@|COPY,F_ORDINAMENTO MESSAGE ENABLE,1@|ENABLE,2@|CLEAR,3@|COPY,F_ORDINAMENTO
ITEM "Z|Zone" ITEM "Z|Zona"
MESSAGE ENABLE,1@|CLEAR,2@|ENABLE,3@|COPY,F_ORDINAMENTO MESSAGE ENABLE,1@|CLEAR,2@|ENABLE,3@|COPY,F_ORDINAMENTO
FLAGS "H" FLAGS "H"
END END

View File

@ -72,7 +72,7 @@ class TCond_vendita;
class TIVA_array; class TIVA_array;
class TArticolo_giacenza; class TArticolo_giacenza;
class TCache_articoli; class TCache_articoli;
class TSmart_card; // class TSmart_card;
bool ora_hndl(TMask_field& field, KEY key); bool ora_hndl(TMask_field& field, KEY key);
bool totdoc_hndl(TMask_field& field, KEY key); bool totdoc_hndl(TMask_field& field, KEY key);
@ -963,7 +963,7 @@ class TDocumento_mask : public TVariable_mask // velib06
bool _ges_mag, _ges_dep, _ges_ca; bool _ges_mag, _ges_dep, _ges_ca;
TString8 _std_mag, _std_dep; TString8 _std_mag, _std_dep;
real _fconv_qta; real _fconv_qta;
TSmart_card * _smartcard; // TSmart_card * _smartcard; Cassato il macchinaro
static TAssoc_array _father_rows; static TAssoc_array _father_rows;
static TAssoc_array _auto_reopen_nums; static TAssoc_array _auto_reopen_nums;
static TAssoc_array _tipidoc_rels; static TAssoc_array _tipidoc_rels;
@ -1064,7 +1064,7 @@ public:
const real & fconv_qta() const { return _fconv_qta;} const real & fconv_qta() const { return _fconv_qta;}
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); bool show_note_articolo(const TString& codart);
short cdc_start() const { return _cdc_start;} short cdc_start() const { return _cdc_start;}

View File

@ -863,7 +863,7 @@ void TDocumento::set_riga_sconto()
{ {
_tipo_riga_sc = "08"; _tipo_riga_sc = "08";
conf.set("TRSCONTI", _tipo_riga_sc); conf.set("TRSCONTI", _tipo_riga_sc);
warning_box(FR("Il tipo riga sconti di testa non risultava impostato.\n L'applicazione userà automaticamente il tipo %s"), (const char*) _tipo_riga_sc); warning_box(FR("Il tipo riga sconti di testa non risultava impostato.\nL'applicazione userà automaticamente il tipo %s"), (const char*) _tipo_riga_sc);
} }
} }
_sconto = new TRiga_documento(this, _tipo_riga_sc); _sconto = new TRiga_documento(this, _tipo_riga_sc);
@ -1710,15 +1710,19 @@ void TDocumento::calc_provvigione(TProvvigioni_agente & provv, const TString & k
// Crea le nuove rate provvigionali // Crea le nuove rate provvigionali
const bool isnew = provv.items() == 0; // Il documento non ha righe provvigionali const bool isnew = provv.items() == 0; // Il documento non ha righe provvigionali
TRate_doc& rd = provv.rate(anno, codnum, ndoc, isnew ? true : FALSE); TRate_doc& rd = provv.rate(anno, codnum, ndoc, isnew);
// A questo punto rd e' vuoto: settiamo i dati del documento: // A questo punto rd e' vuoto: settiamo i dati del documento:
const int ndec = tot_doc.decimals();
TToken_string t; TToken_string t;
t.add(anno); t.add(codnum);t.add(ndoc); t.add(anno); t.add(codnum); t.add(ndoc); t.add(datadoc.string());
t.add(datadoc.string()); t.add(tot_doc.string()); t.add(tot_doc.get_num().string(-1, ndec));
t.add(tot_provv.string());t.add(tot_netto.string()); t.add(tot_provv.get_num().string(-1, ndec));
t.add(tot_netto.get_num().string(-1, ndec));
t.add(codcf()); t.add(codcf());
t.add(TDocumento::valuta());t.add(change.string()); t.add(TDocumento::valuta());
t.add(change.string());
t.add(get(DOC_DATACAMBIO)); t.add(get(DOC_DATACAMBIO));
rd.set(t); rd.set(t);
@ -1736,7 +1740,7 @@ void TDocumento::calc_provvigione(TProvvigioni_agente & provv, const TString & k
if (nrate == 1 && is_anticipo) // significa che l'anticipo paga tutto ora, quindi provv_fat vale tutta la provvigione del documento if (nrate == 1 && is_anticipo) // significa che l'anticipo paga tutto ora, quindi provv_fat vale tutta la provvigione del documento
provv_fat = tot_provv; provv_fat = tot_provv;
const bool first_rata_ok = provv_fat.get_num() != ZERO; const bool first_rata_ok = !provv_fat.is_zero();
// Impostazione prima rata solo se la provvigione sul fatturato è diversa da 0 // Impostazione prima rata solo se la provvigione sul fatturato è diversa da 0
if (first_rata_ok) if (first_rata_ok)

View File

@ -299,7 +299,7 @@ const TPointer_array& TTipo_documento::handlers() const
break; break;
default: break; default: break;
} }
if (id > 100 && id < 1000 && hnd > 0) if (id > 10 && id < 1000 && hnd > 0)
((TPointer_array&)_handlers).add_long(hnd, id); ((TPointer_array&)_handlers).add_long(hnd, id);
} }
} }

View File

@ -182,6 +182,38 @@ int TLista_documenti::write(bool re) const
return err; return err;
} }
static int doc_cmp(const TSortable& o1, const TSortable& o2, void* jolly)
{
const TDocumento& d1 = (const TDocumento&)o1;
const TDocumento& d2 = (const TDocumento&)o2;
TToken_string& order_by = *(TToken_string*)jolly;
int cmp = 0;
FOR_EACH_TOKEN(order_by, fld)
{
const TFieldtypes ft = d1.type(fld);
switch(ft)
{
case _intfld :
case _longfld :
case _intzerofld :
case _longzerofld: cmp = d1.get_long(fld) - d2.get_long(fld); break;
case _datefld : cmp = d1.get_date(fld) - d2.get_date(fld); break;
default : cmp = d1.get(fld).compare(d2.get(fld), -1, true); break;
}
if (cmp != 0)
break;
}
return cmp;
}
int TLista_documenti::sort(const char* fields)
{
TToken_string orderby = fields;
_documenti.sort(doc_cmp, &orderby);
return items();
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TLista_clifo // TLista_clifo
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////

View File

@ -42,6 +42,8 @@ public:
TDocumento& operator[] (int n) { return (TDocumento&)_documenti[n]; } TDocumento& operator[] (int n) { return (TDocumento&)_documenti[n]; }
int items() const { return _documenti.items(); } int items() const { return _documenti.items(); }
int sort(const char* fields); // token string of field names
TLista_documenti() { } TLista_documenti() { }
virtual ~TLista_documenti() {}; virtual ~TLista_documenti() {};
}; };

View File

@ -4,7 +4,7 @@
#include <multirel.h> #include <multirel.h>
#include <postman.h> #include <postman.h>
#include <recset.h> #include <recset.h>
#include <smartcard.h> // #include <smartcard.h> // Cassato il macchinaro
#include <treectrl.h> #include <treectrl.h>
#include <toolfld.h> #include <toolfld.h>
#include <urldefid.h> #include <urldefid.h>
@ -89,7 +89,7 @@ TCONAI_class conai_id2class(short id)
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
TDocumento_mask::TDocumento_mask(const char* td) TDocumento_mask::TDocumento_mask(const char* td)
: TVariable_mask(), _progs_page(-1), _condv(NULL), _smartcard(NULL), : TVariable_mask(), _progs_page(-1), _condv(NULL), //_smartcard(NULL),
_cms_start(-1), _cms_end(-1), _cms_start_sh(-1), _cms_end_sh(-1), _cms_start(-1), _cms_end(-1), _cms_start_sh(-1), _cms_end_sh(-1),
_cdc_start(-1), _cdc_end(-1), _cdc_start_sh(-1), _cdc_end_sh(-1) _cdc_start(-1), _cdc_end(-1), _cdc_start_sh(-1), _cdc_end_sh(-1)
{ {
@ -107,7 +107,6 @@ TDocumento_mask::TDocumento_mask(const char* td)
read_mask(mname, 0, MAX_PAGES); read_mask(mname, 0, MAX_PAGES);
_sheet = &sfield(F_SHEET); _sheet = &sfield(F_SHEET);
//_sheet->set_handler( ss_handler );
set_field_handler(F_SHEET, ss_handler ); set_field_handler(F_SHEET, ss_handler );
_sheet->set_notify( ss_notify ); _sheet->set_notify( ss_notify );
_sheet->set_append(FALSE); _sheet->set_append(FALSE);
@ -475,8 +474,7 @@ TDocumento_mask::~TDocumento_mask()
delete _condv; delete _condv;
if (_livelli_giac) if (_livelli_giac)
delete _livelli_giac; delete _livelli_giac;
if (_smartcard) // if (_smartcard) delete _smartcard; // cassato il macchinaro
delete _smartcard;
} }
int TDocumento_mask::insert_anal_fields(TMask& m, int page, int lf, int& y, int TDocumento_mask::insert_anal_fields(TMask& m, int page, int lf, int& y,
@ -804,7 +802,8 @@ void TDocumento_mask::next_page(int p)
} }
void TDocumento_mask::start_run() void TDocumento_mask::start_run()
{ {
/* cassato il macchinaro
TSmart_card * s = smartcard(); TSmart_card * s = smartcard();
if (s != NULL) if (s != NULL)
@ -826,6 +825,7 @@ void TDocumento_mask::start_run()
s->display_error(err); s->display_error(err);
} }
} }
*/
TVariable_mask::start_run(); TVariable_mask::start_run();
} }
@ -833,6 +833,7 @@ bool TDocumento_mask::stop_run(KEY key)
{ {
if (key != K_ESC && key != K_QUIT) if (key != K_ESC && key != K_QUIT)
update_progs(true); update_progs(true);
/* Cassato il macchinaro
else else
if (key == K_ESC) if (key == K_ESC)
{ {
@ -848,7 +849,7 @@ bool TDocumento_mask::stop_run(KEY key)
} }
} }
} }
*/
return TVariable_mask::stop_run(key); return TVariable_mask::stop_run(key);
} }
@ -865,10 +866,12 @@ bool TDocumento_mask::on_key(KEY key)
stato.enable(); stato.enable();
enable(DLG_SAVEREC); enable(DLG_SAVEREC);
enable(DLG_DELREC); enable(DLG_DELREC);
TSmart_card * s = smartcard();
xvtil_statbar_set(TR("Modifica")); xvtil_statbar_set(TR("Modifica"));
/*
TSmart_card * s = smartcard();
if (s != NULL && s->card_connected()) if (s != NULL && s->card_connected())
s->enable_prot_fields(*this); s->enable_prot_fields(*this);
*/
} }
else else
warning_box("L'utente %s non puo' modificare questo documento", warning_box("L'utente %s non puo' modificare questo documento",
@ -3756,6 +3759,7 @@ void TDocumento_mask::user_set_handler(short fieldid, int index)
case 2: set_field_handler(fieldid, totdoc_hndl); break; case 2: set_field_handler(fieldid, totdoc_hndl); break;
case 3: set_field_handler(fieldid, numdocrif_hndl); break; case 3: set_field_handler(fieldid, numdocrif_hndl); break;
case 4: case 4:
/* Cassato il macchinaro!
_smartcard = new TSmart_card(); _smartcard = new TSmart_card();
if (_smartcard->type() != no_smartcard) if (_smartcard->type() != no_smartcard)
{ {
@ -3768,9 +3772,12 @@ void TDocumento_mask::user_set_handler(short fieldid, int index)
delete _smartcard; delete _smartcard;
_smartcard = NULL; _smartcard = NULL;
} }
*/
break; break;
case 5: set_field_handler(fieldid, dummy_hndl); break; case 5: set_field_handler(fieldid, dummy_hndl); break;
case 6: set_field_handler(fieldid, fido_hndl); break; case 6: set_field_handler(fieldid, fido_hndl); break;
case 7: set_field_handler(fieldid, subappalto_hndl); break;
case 8: set_field_handler(fieldid, reportba8_hndl); break;
default: break; default: break;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,8 @@ 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 nar_handler(TMask_field& f, KEY key);
bool subappalto_hndl(TMask_field& f, KEY key);
bool reportba8_hndl(TMask_field& f, KEY key);
bool tipodoc_ok(const TString & tipodoc); bool tipodoc_ok(const TString & tipodoc);