Patch level :AGA2.0 362
Files correlati : Ricompilazione Demo : [ ] Commento :errori compilazione git-svn-id: svn://10.65.10.50/trunk@10682 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5c61f8b554
commit
fff5a70d02
589
or/or1100.cpp
589
or/or1100.cpp
@ -1,22 +1,16 @@
|
|||||||
// Stampa ordini
|
// Stampa ordini
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <form.h>
|
|
||||||
#include <printer.h>
|
#include <printer.h>
|
||||||
#include <tabutil.h>
|
#include "orlib.h"
|
||||||
#include "../ve/velib.h"
|
|
||||||
#include "../mg/mglib.h"
|
|
||||||
|
|
||||||
#include <doc.h>
|
|
||||||
#include <rdoc.h>
|
|
||||||
#include "or1100a.h"
|
#include "or1100a.h"
|
||||||
|
|
||||||
// Tipi di stampa per selezionare il form
|
// Tipi di stampa per selezionare il form
|
||||||
enum tipo_stampa {
|
enum tipo_stampa {
|
||||||
numero, // or1100a.frm
|
numero, // or1100a.frm
|
||||||
clifo, // or1100b.frm
|
clifo, // or1100b.frm
|
||||||
agente, // or1100d.frm
|
agente, // or1100c.frm
|
||||||
articolo // or1100c.frm
|
articolo // or1100d.frm
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tipi di ordinamento
|
// Tipi di ordinamento
|
||||||
@ -25,202 +19,6 @@ enum tipo_ord {
|
|||||||
data_doc // ordinamento per data documento
|
data_doc // ordinamento per data documento
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class _TTotale_valuta : public TObject
|
|
||||||
{
|
|
||||||
real _totord, _totres;
|
|
||||||
int _secnum;
|
|
||||||
public:
|
|
||||||
real& totord() { return _totord;}
|
|
||||||
real& totres() { return _totres;}
|
|
||||||
int& secnum() { return _secnum;}
|
|
||||||
_TTotale_valuta () {};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Form per la stampa ordini
|
|
||||||
class TOrdine_form : public TForm
|
|
||||||
{
|
|
||||||
int _level;
|
|
||||||
bool _detail_mag, _detail_dep;
|
|
||||||
TCodgiac_livelli * _codgiac;
|
|
||||||
TTable *_fcg;
|
|
||||||
TArticolo *_art;
|
|
||||||
TAssoc_array _totvaluta;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual bool validate(TForm_item &, TToken_string &); // gestione dei messaggi estesi nei campi
|
|
||||||
public:
|
|
||||||
void set_options(int lev, bool mag, bool dep) { _level = lev; _detail_mag = mag; _detail_dep = dep;}
|
|
||||||
TOrdine_form(const char* name);
|
|
||||||
virtual ~TOrdine_form() ;
|
|
||||||
};
|
|
||||||
|
|
||||||
TOrdine_form::TOrdine_form(const char* name) : TForm(name)
|
|
||||||
{
|
|
||||||
_art = new TArticolo;
|
|
||||||
_fcg = new TTable("FCG");
|
|
||||||
_codgiac = new TCodgiac_livelli;
|
|
||||||
}
|
|
||||||
|
|
||||||
TOrdine_form::~TOrdine_form()
|
|
||||||
{
|
|
||||||
delete _art;
|
|
||||||
delete _fcg;
|
|
||||||
delete _codgiac;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
|
||||||
{
|
|
||||||
const TString code(s.get(0));
|
|
||||||
|
|
||||||
if (code == "_ORDINE")
|
|
||||||
{
|
|
||||||
TLocalisamfile& rdoc = cf.form().cursor()->file(LF_RIGHEDOC);
|
|
||||||
TLocalisamfile& doc = cf.form().cursor()->file(LF_DOC);
|
|
||||||
// Add custom messages here
|
|
||||||
// All the following messages takes 1 parameter: the field number to set
|
|
||||||
TString action(s.get(1));
|
|
||||||
|
|
||||||
if (action == "DESCRIZIONE")
|
|
||||||
{
|
|
||||||
// Scrive: Cod articolo/cod livello1/cod livello2/.../denominazione ultimo livello codifica /cod mag /cod dep
|
|
||||||
TString codart,livello, coddep, codmag;
|
|
||||||
codart = rdoc.get(RDOC_CODART);
|
|
||||||
if (_level > 0)
|
|
||||||
livello = rdoc.get(RDOC_LIVELLO);
|
|
||||||
if (livello.not_empty())
|
|
||||||
{
|
|
||||||
for (int lev=1; lev <= _level; lev++)
|
|
||||||
{
|
|
||||||
if (!_codgiac->enabled(lev))
|
|
||||||
continue;
|
|
||||||
const int starts = _codgiac->code_start(lev) -1;
|
|
||||||
const int length = _codgiac->code_length(lev);
|
|
||||||
codart << "/";
|
|
||||||
codart << livello.mid(starts,length);
|
|
||||||
}
|
|
||||||
codart << " " << _codgiac->name(_level);
|
|
||||||
codart << " " << _codgiac->group_descr(livello,_level);
|
|
||||||
}
|
|
||||||
|
|
||||||
codmag = rdoc.get(RDOC_CODMAG).left(3);
|
|
||||||
coddep = rdoc.get(RDOC_CODMAG).right(2);
|
|
||||||
if (_detail_mag && codmag.not_empty())
|
|
||||||
codart << " Mag. " << codmag;
|
|
||||||
if (_detail_dep && coddep.not_empty())
|
|
||||||
codart << " Dep. " << coddep;
|
|
||||||
|
|
||||||
cf.set(codart);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (action == "SELECTUM")
|
|
||||||
{
|
|
||||||
TString um(rdoc.get(RDOC_UMQTA));
|
|
||||||
TString cur_um(cf.find_field("407").get());
|
|
||||||
|
|
||||||
if (cur_um.empty()) // Se l'unita' di misura non e' ancora stata settata prende quella principale
|
|
||||||
cf.set(um);
|
|
||||||
else
|
|
||||||
if (cur_um != um) // Se c'e' ma e' diversa dalla prec. allora setta l'unita' di misura su quella principale
|
|
||||||
if (_art->read(rdoc.get(RDOC_CODART)) == NOERR)
|
|
||||||
{
|
|
||||||
// Converte i totali q.ta evasa e ordinata nella unita' di misura principale
|
|
||||||
const real fc = _art->um().row(_art->find_um(cur_um)).get("FCONV");
|
|
||||||
TForm_item& qo = cf.find_field("408");
|
|
||||||
TForm_item& qe = cf.find_field("409");
|
|
||||||
real qtaor(qo.get());
|
|
||||||
real qtaev(qe.get());
|
|
||||||
|
|
||||||
qtaor *= fc;
|
|
||||||
qtaev *= fc;
|
|
||||||
qo.set(qtaor.string());
|
|
||||||
qe.set(qtaev.string());
|
|
||||||
|
|
||||||
cf.set(_art->um().row(1).get("UM")); // UM principale
|
|
||||||
}
|
|
||||||
// hmmm.. TBI:
|
|
||||||
// Riga merce non a magazzino o non e' possibile reperire l'UM principale per art.
|
|
||||||
// non posso interrompere la sezione di stampa da qui, e neppure cambiare il raggruppamento...
|
|
||||||
// This seems to be a great dilemma... For now leave it as is: Somme dure e crude di quantita'
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (action == "CONVUM") // Converte cazzilli quantitativi nella unita' di misura corrente
|
|
||||||
{
|
|
||||||
TString um(rdoc.get(RDOC_UMQTA));
|
|
||||||
TString cur_um(cf.find_field("407").get());
|
|
||||||
|
|
||||||
if (cur_um != um)
|
|
||||||
if (_art->read(rdoc.get(RDOC_CODART)) == NOERR)
|
|
||||||
{
|
|
||||||
const real fc = _art->um().row(_art->find_um(cur_um)).get("FCONV");
|
|
||||||
real qt(cf.get());
|
|
||||||
qt *= fc;
|
|
||||||
cf.set(qt.string());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (action == "VALTABLE") // Comandi per stampa riepilogo per valuta
|
|
||||||
{
|
|
||||||
TString subcommand(s.get(2));
|
|
||||||
if (subcommand == "RESET")
|
|
||||||
{
|
|
||||||
_totvaluta.destroy();
|
|
||||||
cf.find_field("TOTVAL1").disable();
|
|
||||||
cf.find_field("TOTVAL2").disable();
|
|
||||||
cf.find_field("TOTVAL3").disable();
|
|
||||||
cf.find_field("TOTVAL4").disable();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const int valute = _totvaluta.items();
|
|
||||||
TString codval(doc.get(DOC_CODVAL));
|
|
||||||
const bool is_key = _totvaluta.is_key(codval);
|
|
||||||
const bool is_new = !is_key && valute < 4;
|
|
||||||
|
|
||||||
if (is_new) // Aggiunge l'elemento se non c'e'
|
|
||||||
_totvaluta.add(codval,(_TTotale_valuta*)new _TTotale_valuta,is_key);
|
|
||||||
// Controlla/stampa al massimo 4 valute
|
|
||||||
if (is_key || is_new)
|
|
||||||
{
|
|
||||||
_TTotale_valuta& tv = (_TTotale_valuta&)_totvaluta[codval];
|
|
||||||
const bool is_valord = subcommand == "VALORD";
|
|
||||||
real& r = is_valord ? tv.totord() : tv.totres();
|
|
||||||
TString s_id;
|
|
||||||
int i_id;
|
|
||||||
|
|
||||||
// Abilita la sezione corrispondente e setta i valori all'interno
|
|
||||||
if (!is_key)
|
|
||||||
{
|
|
||||||
TString16 sec_name = "TOTVAL";
|
|
||||||
sec_name << valute+1;
|
|
||||||
tv.secnum() = valute+1;
|
|
||||||
cf.find_field(sec_name).enable();
|
|
||||||
// Setta anche il codice valuta
|
|
||||||
i_id = 53 + valute*10;
|
|
||||||
s_id.format("%d",i_id);
|
|
||||||
cf.find_field(s_id).set(codval);
|
|
||||||
if (valute == 0)
|
|
||||||
{
|
|
||||||
i_id--;
|
|
||||||
s_id.format("%d",i_id);
|
|
||||||
cf.find_field(s_id).set("Totali");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const int sn = tv.secnum();
|
|
||||||
i_id = is_valord ? 55 : 56;
|
|
||||||
|
|
||||||
i_id += (sn-1)*10;
|
|
||||||
s_id.format("%d",i_id);
|
|
||||||
r += ((real) cf.get()); // Somma il valore corrente
|
|
||||||
cf.find_field(s_id).set(r.string());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Ignore any other command
|
|
||||||
}
|
|
||||||
return TForm::validate(cf, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Applicazione di stampa
|
// Applicazione di stampa
|
||||||
|
|
||||||
class TStampa_ordini : public TSkeleton_application
|
class TStampa_ordini : public TSkeleton_application
|
||||||
@ -230,12 +28,16 @@ class TStampa_ordini : public TSkeleton_application
|
|||||||
TTable * _fcg;
|
TTable * _fcg;
|
||||||
tipo_stampa _tipo;
|
tipo_stampa _tipo;
|
||||||
TCodgiac_livelli *_codgiac;
|
TCodgiac_livelli *_codgiac;
|
||||||
|
TAssoc_array _tipi_riga; // Cache dei tipi riga attivati: tipo M, S, P, C, O D
|
||||||
TString _codnum;
|
TString _codnum;
|
||||||
int _anno;
|
int _anno;
|
||||||
char _provv, _tipocf,
|
char _provv, _tipocf,
|
||||||
_TEA_ord, _TEA_rord; // Tipi ordini/righe 'T'utti/'E'vasi/'A'perti
|
_TEA_ord, _TEA_rord; // Tipi ordini/righe 'T'utti/'E'vasi/'A'perti
|
||||||
tipo_ord _order;
|
tipo_ord _order;
|
||||||
bool _detail_rows, _detail_doc, _detail_cli, _detail_mag, _detail_dep;
|
bool _detail_rows, _detail_doc, _detail_cli, _detail_mag, _detail_dep,
|
||||||
|
_pr_spese, _pr_prest, _pr_sconti, _pr_omaggi, _pr_descr,
|
||||||
|
_opz_valore, _opz_prezzo, _opz_residuo, _opz_giacenza,
|
||||||
|
_force_evase;
|
||||||
int _detail_level; //0..4 0 = Articoli 4 = FCG #4 Maximum detail level
|
int _detail_level; //0..4 0 = Articoli 4 = FCG #4 Maximum detail level
|
||||||
TString _from_age, _to_age,
|
TString _from_age, _to_age,
|
||||||
_from_art, _to_art,
|
_from_art, _to_art,
|
||||||
@ -250,12 +52,12 @@ class TStampa_ordini : public TSkeleton_application
|
|||||||
TArray _file;
|
TArray _file;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void open_files(int logicnum, ...);
|
|
||||||
static bool stato_handler(TMask_field& f, KEY k);
|
static bool stato_handler(TMask_field& f, KEY k);
|
||||||
static bool detail_handler(TMask_field& f, KEY k);
|
static bool detail_handler(TMask_field& f, KEY k);
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
virtual bool destroy();
|
virtual bool destroy();
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
|
void set_totvaluta_items();
|
||||||
void filter_for_number();
|
void filter_for_number();
|
||||||
void filter_for_clifo_agent();
|
void filter_for_clifo_agent();
|
||||||
void filter_for_articolo();
|
void filter_for_articolo();
|
||||||
@ -266,18 +68,6 @@ public:
|
|||||||
|
|
||||||
inline TStampa_ordini& app() { return (TStampa_ordini&) main_app();}
|
inline TStampa_ordini& app() { return (TStampa_ordini&) main_app();}
|
||||||
|
|
||||||
void TStampa_ordini::open_files(int logicnum, ...)
|
|
||||||
{
|
|
||||||
va_list marker;
|
|
||||||
va_start(marker, logicnum);
|
|
||||||
while (logicnum > 0)
|
|
||||||
{
|
|
||||||
CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
|
|
||||||
_file.add(new TLocalisamfile(logicnum), logicnum);
|
|
||||||
logicnum = va_arg(marker, int);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TStampa_ordini::stato_handler(TMask_field& f, KEY k)
|
bool TStampa_ordini::stato_handler(TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (f.to_check(k))
|
if (f.to_check(k))
|
||||||
@ -309,14 +99,24 @@ bool TStampa_ordini::detail_handler(TMask_field& f, KEY k)
|
|||||||
{
|
{
|
||||||
m.enable(-GR_DETAIL,b);
|
m.enable(-GR_DETAIL,b);
|
||||||
m.enable(F_STATOORD,!b);
|
m.enable(F_STATOORD,!b);
|
||||||
if (tipo != articolo)
|
m.reset(-GR_PRINT);
|
||||||
m.set(F_DETAIL_BY_DOC, !b ? "" : "X");
|
m.disable(-GR_PRINT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m.enable(-GR_ART,b);
|
m.enable(-GR_ART,b);
|
||||||
m.enable(-GR_MAG,b);
|
m.enable(-GR_MAG,b);
|
||||||
|
m.enable(-GR_PRINT, b);
|
||||||
m.enable(F_STATORORD,b);
|
m.enable(F_STATORORD,b);
|
||||||
|
m.enable(F_DETAIL_BY_DOC, b);
|
||||||
|
}
|
||||||
|
m.enable(F_STATOORD,!b);
|
||||||
|
if (tipo != articolo)
|
||||||
|
m.set(F_DETAIL_BY_DOC, !b ? "" : "X");
|
||||||
|
if (!b)
|
||||||
|
{
|
||||||
|
m.reset(F_FORCE_EVASE);
|
||||||
|
m.disable(F_FORCE_EVASE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -324,23 +124,30 @@ bool TStampa_ordini::detail_handler(TMask_field& f, KEY k)
|
|||||||
|
|
||||||
bool TStampa_ordini::create()
|
bool TStampa_ordini::create()
|
||||||
{
|
{
|
||||||
open_files(LF_OCCAS, LF_CLIFO, LF_INDSP, LF_CFVEN, LF_MOVMAG, LF_RMOVMAG, 0);
|
open_files(LF_OCCAS, LF_CLIFO, LF_INDSP, LF_CFVEN, LF_UMART, LF_MAG, LF_STOMAG, LF_MOVMAG, LF_RMOVMAG, LF_RIGHEDOC, 0);
|
||||||
_m = new TMask ("or1100a");
|
_m = new TMask ("or1100a");
|
||||||
_m->set_handler(F_STATOORD, stato_handler);
|
//_m->set_handler(F_STATOORD, stato_handler);
|
||||||
_m->set_handler(F_DETTAGLIO, detail_handler);
|
_m->set_handler(F_DETTAGLIO, detail_handler);
|
||||||
_fcg = new TTable("FCG");
|
_fcg = new TTable("FCG");
|
||||||
_codgiac = new TCodgiac_livelli;
|
_codgiac = new TCodgiac_livelli;
|
||||||
if (!_codgiac->enabled())
|
if (!_codgiac->enabled())
|
||||||
{
|
{
|
||||||
_m->hide(F_DETAIL_LEV);
|
_m->disable(F_DETAIL_LEV);
|
||||||
_m->hide(-GR_GIAC);
|
_m->hide(-GR_GIAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
short id = F_GIAC1;
|
short id = F_GIAC1;
|
||||||
int l = 5;
|
|
||||||
for (_fcg->first(); _fcg->good(); _fcg->next(), id+=4)
|
for (_fcg->first(); _fcg->good(); _fcg->next(), id+=4)
|
||||||
_m->set(id, _fcg->get("CODTAB"));
|
_m->set(id, _fcg->get("CODTAB"));
|
||||||
|
|
||||||
|
// Carica i tipi riga dalla tabella TRI
|
||||||
|
TTable tri ("%TRI");
|
||||||
|
for (tri.first(); !tri.eof(); tri.next())
|
||||||
|
{
|
||||||
|
TString* ss = new TString(tri.get("CODTAB"));
|
||||||
|
_tipi_riga.add(tri.get("S7"), ss);
|
||||||
|
}
|
||||||
|
|
||||||
return TSkeleton_application::create();
|
return TSkeleton_application::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,19 +159,33 @@ bool TStampa_ordini::destroy()
|
|||||||
return TSkeleton_application::destroy();
|
return TSkeleton_application::destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Abilita disabilita i campi per i totali in valuta presenti alla fine del body
|
||||||
|
// per quel che riguarda le stampe per cli/fo/agenti/articoli
|
||||||
|
void TStampa_ordini::set_totvaluta_items()
|
||||||
|
{
|
||||||
|
TString16 sec_name;
|
||||||
|
|
||||||
|
for (int i = 1; i<=4; i++)
|
||||||
|
{
|
||||||
|
sec_name = "TOTVAL";
|
||||||
|
sec_name << i;
|
||||||
|
TForm_subsection& asec = (TForm_subsection&)_frm->find_field('B', odd_page, sec_name);
|
||||||
|
short id = BODY_TOTVALORD + ((i-1) * 10);
|
||||||
|
asec.printsection().find_field(id).show(_opz_valore);
|
||||||
|
asec.printsection().find_field(id + 1).show(_opz_valore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TStampa_ordini::filter_for_number()
|
void TStampa_ordini::filter_for_number()
|
||||||
{
|
{
|
||||||
CHECK(_frm, "Form non valido");
|
CHECK(_frm, "Form non valido");
|
||||||
|
|
||||||
TCursor* cur = _frm->cursor();
|
TCursor* cur = _frm->cursor();
|
||||||
|
|
||||||
TDocumento *doc = new TDocumento; // Don't delete it
|
|
||||||
cur->file().set_curr(doc);
|
|
||||||
cur->file(LF_RIGHEDOC).set_curr(new TRiga_documento(doc));
|
|
||||||
cur->setkey(_order == num_doc ? 1 : 3); // Selezione per numero doc o data emissione
|
cur->setkey(_order == num_doc ? 1 : 3); // Selezione per numero doc o data emissione
|
||||||
|
|
||||||
TRectype f(LF_DOC), t(LF_DOC);
|
TRectype f(LF_DOC), t(LF_DOC);
|
||||||
TString filter_expr,s;
|
TString filter_expr,s, lev_str, mag_str;
|
||||||
|
|
||||||
filter_expr << "(TIPOCF==\"" << _tipocf << "\")";
|
filter_expr << "(TIPOCF==\"" << _tipocf << "\")";
|
||||||
if (_order == num_doc)
|
if (_order == num_doc)
|
||||||
@ -387,50 +208,135 @@ void TStampa_ordini::filter_for_number()
|
|||||||
}
|
}
|
||||||
cur->setregion(f,t);
|
cur->setregion(f,t);
|
||||||
|
|
||||||
|
// Imposta l'ordine CODNUM+ANNO+PROVV+NDOC+CODART+LIVELLO+CODMAG+DATACONS
|
||||||
|
// nel caso si voglia il dettaglio all'interno del singolo documento, per liv.giac e cod.mag.
|
||||||
|
// In tal caso viene sostituito LF_RIGHEDOC nella relazione con un TSortedfile siffatto
|
||||||
|
if (_detail_rows && !_detail_doc)
|
||||||
|
{
|
||||||
|
s << "CODNUM|ANNO|PROVV|NDOC|CODART|";
|
||||||
|
|
||||||
|
if (_detail_level > 0)
|
||||||
|
lev_str.format("LIVELLO[1,%d]",_codgiac->packed_length(_detail_level));
|
||||||
|
if (_detail_mag)
|
||||||
|
mag_str.format("CODMAG[1,3]");
|
||||||
|
if (_detail_dep)
|
||||||
|
mag_str.format("CODMAG");
|
||||||
|
|
||||||
|
if (lev_str.not_empty())
|
||||||
|
s << lev_str << "|";
|
||||||
|
if (mag_str.not_empty())
|
||||||
|
s << mag_str << "|";
|
||||||
|
s << "DATACONS";
|
||||||
|
|
||||||
|
TSortedfile *rdoc = new TSortedfile(LF_RIGHEDOC,NULL,s,"",1);
|
||||||
|
cur->relation()->replace(rdoc,1,"CODNUM==CODNUM|ANNO==ANNO|PROVV==PROVV|NDOC==NDOC");
|
||||||
|
|
||||||
|
TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "RIGHEART");
|
||||||
|
ssec.enable();
|
||||||
|
TString cond(ssec.condition());
|
||||||
|
if (lev_str.not_empty())
|
||||||
|
cond << "+" << lev_str;
|
||||||
|
if (mag_str.not_empty())
|
||||||
|
cond << "+" << mag_str;
|
||||||
|
ssec.setcondition(cond, _strexpr);
|
||||||
|
}
|
||||||
|
|
||||||
if (_TEA_ord == 'E')
|
if (_TEA_ord == 'E')
|
||||||
filter_expr << " && (DOCEVASO==\"X\")";
|
filter_expr << " && (DOCEVASO==\"X\")";
|
||||||
else
|
else
|
||||||
if (_TEA_ord == 'A')
|
if (_TEA_ord == 'A')
|
||||||
filter_expr << " && (DOCEVASO!=\"X\")";
|
filter_expr << " && (DOCEVASO!=\"X\")";
|
||||||
|
|
||||||
if (_from_cons.ok())
|
if (!_detail_rows)
|
||||||
{
|
{
|
||||||
filter_expr << "&&";
|
// In caso di dettaglio per righe non va settato il filtro per dataconsegnain quanto
|
||||||
s.format("(ANSI(DATACONS)>=\"%s\")",
|
// già impostato sulla sottosezione (vedi sotto)
|
||||||
(const char*)_from_cons.string(ANSI));
|
if (_from_cons.ok())
|
||||||
filter_expr << s;
|
{
|
||||||
}
|
filter_expr << "&&";
|
||||||
if (_to_cons.ok())
|
s.format("(ANSI(DATACONS)>=\"%s\")",
|
||||||
{
|
(const char*)_from_cons.string(ANSI));
|
||||||
filter_expr << "&&";
|
filter_expr << s;
|
||||||
s.format("(ANSI(DATACONS)<=\"%s\")",
|
}
|
||||||
(const char*)_to_cons.string(ANSI));
|
if (_to_cons.ok())
|
||||||
filter_expr << s;
|
{
|
||||||
|
filter_expr << "&&";
|
||||||
|
s.format("(ANSI(DATACONS)<=\"%s\")",
|
||||||
|
(const char*)_to_cons.string(ANSI));
|
||||||
|
filter_expr << s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur->setfilter(filter_expr);
|
cur->setfilter(filter_expr);
|
||||||
|
|
||||||
if (_detail_rows)
|
if (_detail_rows)
|
||||||
{
|
{
|
||||||
for (short i = 6; i<=8; i++)
|
for (short i = BODY_COL_7; i<=BODY_COL_12; i++)
|
||||||
_frm->find_field('B', odd_page, i).show();
|
_frm->find_field('B', odd_page, i).show();
|
||||||
_frm->find_field('B', odd_page, "DET").show(); // Visualizza la sottosezione
|
_frm->find_field('B', odd_page, "DET").show(); // Visualizza la sottosezione
|
||||||
TForm_subsection& ssec = (TForm_subsection&)_frm->find_field('B', odd_page, "RIGHE"); // Sottosezione padre
|
TForm_subsection& ssec = (TForm_subsection&)_frm->find_field('B', odd_page, "RIGHE"); // Sottosezione padre
|
||||||
|
|
||||||
// Applica gli altri filtri alla sezione
|
// Applica filtri alla sezione
|
||||||
TString cond;
|
TString cond;
|
||||||
|
|
||||||
|
// Aggiunge filtro sui tipi di riga
|
||||||
|
s.format("((%d->TIPORIGA==\"%s\")", LF_RIGHEDOC, (const char*)(TString&)_tipi_riga["M"]);
|
||||||
|
cond << s;
|
||||||
|
|
||||||
|
if (_pr_spese)
|
||||||
|
{
|
||||||
|
s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["S"]);
|
||||||
|
cond << s;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_pr_prest)
|
||||||
|
{
|
||||||
|
s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["P"]);
|
||||||
|
cond << s;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_pr_sconti)
|
||||||
|
{
|
||||||
|
s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["C"]);
|
||||||
|
cond << s;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_pr_omaggi)
|
||||||
|
{
|
||||||
|
s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["O"]);
|
||||||
|
cond << s;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_pr_descr)
|
||||||
|
{
|
||||||
|
s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["D"]);
|
||||||
|
cond << s;
|
||||||
|
}
|
||||||
|
|
||||||
|
cond << ")";
|
||||||
|
|
||||||
|
// TBI: stampa righe di sconto testata od esenzione. Siccome non sono righe fisiche
|
||||||
|
// credo sara' necessario implementarle con un messaggio nella validate...
|
||||||
|
|
||||||
|
// Applica il filtro per righe evase/aperte
|
||||||
|
s = "";
|
||||||
if (_TEA_rord == 'E')
|
if (_TEA_rord == 'E')
|
||||||
s.format("(%d->RIGAEVASA==\"X\")",LF_RIGHEDOC);
|
s.format("&&(%d->RIGAEVASA==\"X\")",LF_RIGHEDOC);
|
||||||
else
|
else
|
||||||
if (_TEA_rord == 'A')
|
if (_TEA_rord == 'A')
|
||||||
s.format("(%d->RIGAEVASA!=\"X\")",LF_RIGHEDOC);
|
s.format("&&(%d->RIGAEVASA!=\"X\")",LF_RIGHEDOC);
|
||||||
|
|
||||||
cond << s;
|
cond << s;
|
||||||
|
|
||||||
|
s = "";
|
||||||
|
if (_force_evase)
|
||||||
|
s.format("&&(%d->QTAEVASA != %d->QTA)", LF_RIGHEDOC, LF_RIGHEDOC);
|
||||||
|
cond << s;
|
||||||
|
|
||||||
// Setta i range per la data di consegna
|
// Setta i range per la data di consegna
|
||||||
if (_from_cons.ok())
|
if (_from_cons.ok())
|
||||||
{
|
{
|
||||||
if (s.not_empty())
|
if (cond.not_empty())
|
||||||
cond << "&&";
|
cond << "&&";
|
||||||
s.format("(ANSI(%d->DATACONS)>=\"%s\")",
|
s.format("(ANSI(%d->DATACONS)>=\"%s\")",
|
||||||
LF_RIGHEDOC, (const char*)_from_cons.string(ANSI));
|
LF_RIGHEDOC, (const char*)_from_cons.string(ANSI));
|
||||||
@ -438,7 +344,7 @@ void TStampa_ordini::filter_for_number()
|
|||||||
}
|
}
|
||||||
if (_to_cons.ok())
|
if (_to_cons.ok())
|
||||||
{
|
{
|
||||||
if (s.not_empty())
|
if (cond.not_empty())
|
||||||
cond << "&&";
|
cond << "&&";
|
||||||
s.format("(ANSI(%d->DATACONS)<=\"%s\")",
|
s.format("(ANSI(%d->DATACONS)<=\"%s\")",
|
||||||
LF_RIGHEDOC, (const char*)_to_cons.string(ANSI));
|
LF_RIGHEDOC, (const char*)_to_cons.string(ANSI));
|
||||||
@ -448,7 +354,7 @@ void TStampa_ordini::filter_for_number()
|
|||||||
// Setta i range per il codice magazzino
|
// Setta i range per il codice magazzino
|
||||||
if (_from_mag.not_empty())
|
if (_from_mag.not_empty())
|
||||||
{
|
{
|
||||||
if (s.not_empty())
|
if (cond.not_empty())
|
||||||
cond << "&&";
|
cond << "&&";
|
||||||
s.format("(%d->CODMAG>=\"%s\")",
|
s.format("(%d->CODMAG>=\"%s\")",
|
||||||
LF_RIGHEDOC, (const char*)_from_mag);
|
LF_RIGHEDOC, (const char*)_from_mag);
|
||||||
@ -456,7 +362,7 @@ void TStampa_ordini::filter_for_number()
|
|||||||
}
|
}
|
||||||
if (_to_mag.not_empty())
|
if (_to_mag.not_empty())
|
||||||
{
|
{
|
||||||
if (s.not_empty())
|
if (cond.not_empty())
|
||||||
cond << "&&";
|
cond << "&&";
|
||||||
s.format("(%d->CODMAG<=\"%s\")",
|
s.format("(%d->CODMAG<=\"%s\")",
|
||||||
LF_RIGHEDOC, (const char*)_to_mag);
|
LF_RIGHEDOC, (const char*)_to_mag);
|
||||||
@ -466,7 +372,7 @@ void TStampa_ordini::filter_for_number()
|
|||||||
// Setta i range per il codice articolo
|
// Setta i range per il codice articolo
|
||||||
if (_from_art.not_empty())
|
if (_from_art.not_empty())
|
||||||
{
|
{
|
||||||
if (s.not_empty())
|
if (cond.not_empty())
|
||||||
cond << "&&";
|
cond << "&&";
|
||||||
s.format("(%d->CODART>=\"%s\")",
|
s.format("(%d->CODART>=\"%s\")",
|
||||||
LF_RIGHEDOC, (const char*)_from_art);
|
LF_RIGHEDOC, (const char*)_from_art);
|
||||||
@ -474,16 +380,48 @@ void TStampa_ordini::filter_for_number()
|
|||||||
}
|
}
|
||||||
if (_to_art.not_empty())
|
if (_to_art.not_empty())
|
||||||
{
|
{
|
||||||
if (s.not_empty())
|
if (cond.not_empty())
|
||||||
cond << "&&";
|
cond << "&&";
|
||||||
s.format("(%d->CODART<=\"%s\")",
|
s.format("(%d->CODART<=\"%s\")",
|
||||||
LF_RIGHEDOC, (const char*)_to_art);
|
LF_RIGHEDOC, (const char*)_to_art);
|
||||||
cond << s;
|
cond << s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.not_empty())
|
s.format("&&(%d->CODART!=\"\")", LF_RIGHEDOC);
|
||||||
|
cond << s;
|
||||||
|
|
||||||
|
if (cond.not_empty())
|
||||||
ssec.setcondition(cond, _strexpr);
|
ssec.setcondition(cond, _strexpr);
|
||||||
|
|
||||||
|
if (!_detail_doc)
|
||||||
|
{
|
||||||
|
TForm_subsection& ss = (TForm_subsection&)_frm->find_field('B', odd_page, "RIGHE");
|
||||||
|
TPrint_section& ps = ss.printsection();
|
||||||
|
for (short j = BODY_COL_1; j <= BODY_COL_12; j++)
|
||||||
|
{
|
||||||
|
ps.find_field(j + 100).disable();
|
||||||
|
ps.find_field(j + 400).enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Abilitazione intestazioni di colonna
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_5).show(_opz_valore);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_6).show(_opz_valore);
|
||||||
|
_frm->find_field('F', last_page, BODY_COL_5+200).show(_opz_valore);
|
||||||
|
_frm->find_field('F', last_page, BODY_COL_6+200).show(_opz_valore);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_10).show(_opz_prezzo);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_11).show(_opz_residuo);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_12).show(_opz_giacenza);
|
||||||
|
|
||||||
|
// Abilitazione delle righe
|
||||||
|
const short id = !_detail_doc && _detail_rows ? 400 : 100;
|
||||||
|
TForm_subsection& ssec = (TForm_subsection&)_frm->find_field('B', odd_page, "RIGHE"); // Sottosezione padre
|
||||||
|
ssec.printsection().find_field(BODY_COL_5 + id).show(_opz_valore);
|
||||||
|
ssec.printsection().find_field(BODY_COL_6 + id).show(_opz_valore);
|
||||||
|
ssec.printsection().find_field(BODY_COL_10 + id).show(_opz_prezzo);
|
||||||
|
ssec.printsection().find_field(BODY_COL_11 + id).show(_opz_residuo);
|
||||||
|
ssec.printsection().find_field(BODY_COL_12 + id).show(_opz_giacenza);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TStampa_ordini::filter_for_clifo_agent()
|
void TStampa_ordini::filter_for_clifo_agent()
|
||||||
@ -495,9 +433,6 @@ void TStampa_ordini::filter_for_clifo_agent()
|
|||||||
TString s, ws,lev_str, mag_str;
|
TString s, ws,lev_str, mag_str;
|
||||||
TSorted_cursor* cur = (TSorted_cursor*)_frm->cursor();
|
TSorted_cursor* cur = (TSorted_cursor*)_frm->cursor();
|
||||||
|
|
||||||
TDocumento *doc = new TDocumento;
|
|
||||||
cur->file(LF_DOC).set_curr(doc);
|
|
||||||
cur->file(LF_RIGHEDOC).set_curr(new TRiga_documento(doc));
|
|
||||||
if (_detail_rows && !_detail_doc) // Cambia l'ordinamento se si vuol dettagliare per articolo e non per documento
|
if (_detail_rows && !_detail_doc) // Cambia l'ordinamento se si vuol dettagliare per articolo e non per documento
|
||||||
{
|
{
|
||||||
if (_detail_level > 0)
|
if (_detail_level > 0)
|
||||||
@ -511,7 +446,7 @@ void TStampa_ordini::filter_for_clifo_agent()
|
|||||||
s.format("%d->CODAG|",LF_DOC);
|
s.format("%d->CODAG|",LF_DOC);
|
||||||
if (is_for_cli || _detail_cli)
|
if (is_for_cli || _detail_cli)
|
||||||
{
|
{
|
||||||
ws.format("%d->TIPOCF|%d->CODCF|",LF_DOC, LF_DOC);
|
ws.format("%d->TIPOCF|%d->CODCF|%d->OCFPI|",LF_DOC, LF_DOC, LF_DOC);
|
||||||
s << ws;
|
s << ws;
|
||||||
}
|
}
|
||||||
s << "CODART|";
|
s << "CODART|";
|
||||||
@ -544,6 +479,9 @@ void TStampa_ordini::filter_for_clifo_agent()
|
|||||||
s.format("(%d->TIPOCF==\"",LF_DOC);
|
s.format("(%d->TIPOCF==\"",LF_DOC);
|
||||||
filter_expr << s << _tipocf << "\")"; // Nel caso di stampa per agenti e' sempre "C"
|
filter_expr << s << _tipocf << "\")"; // Nel caso di stampa per agenti e' sempre "C"
|
||||||
|
|
||||||
|
s.format("&&(%d->CODART!=\"\")", LF_RIGHEDOC);
|
||||||
|
filter_expr << s;
|
||||||
|
|
||||||
// Filtro su Cli/Fo od agente
|
// Filtro su Cli/Fo od agente
|
||||||
if (is_for_cli)
|
if (is_for_cli)
|
||||||
{
|
{
|
||||||
@ -563,13 +501,13 @@ void TStampa_ordini::filter_for_clifo_agent()
|
|||||||
{
|
{
|
||||||
if (_from_age.not_empty())
|
if (_from_age.not_empty())
|
||||||
{
|
{
|
||||||
s.format("&&(%d->CODAG>=%ld)", LF_DOC, (const char*)_from_age);
|
s.format("&&(%d->CODAG>=\"%s\")", LF_DOC, (const char*)_from_age);
|
||||||
filter_expr << s;
|
filter_expr << s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_to_age.not_empty())
|
if (_to_age.not_empty())
|
||||||
{
|
{
|
||||||
s.format("&&(%d->CODAG)<=%ld)", LF_DOC, _to_age);
|
s.format("&&(%d->CODAG<=\"%s\")", LF_DOC, (const char*)_to_age);
|
||||||
filter_expr << s;
|
filter_expr << s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -669,16 +607,19 @@ void TStampa_ordini::filter_for_clifo_agent()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_TEA_rord == 'E')
|
if (_TEA_rord == 'E')
|
||||||
s.format("(%d->RIGAEVASA==\"X\")",LF_RIGHEDOC);
|
s.format("&&(%d->RIGAEVASA==\"X\")",LF_RIGHEDOC);
|
||||||
else
|
else
|
||||||
if (_TEA_rord == 'A')
|
if (_TEA_rord == 'A')
|
||||||
s.format("(%d->RIGAEVASA!=\"X\")",LF_RIGHEDOC);
|
s.format("&&(%d->RIGAEVASA!=\"X\")",LF_RIGHEDOC);
|
||||||
|
|
||||||
|
if (_force_evase)
|
||||||
|
s << "&&(" << LF_RIGHEDOC << ">QTAEVASA != " << LF_RIGHEDOC << "->QTA)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.not_empty())
|
if (s.not_empty())
|
||||||
filter_expr << s;
|
filter_expr << s;
|
||||||
|
|
||||||
cur->setfilter(filter_expr,TRUE);
|
cur->setfilter(filter_expr,TRUE,2);
|
||||||
|
|
||||||
// Alla fine setta i campi da vedere
|
// Alla fine setta i campi da vedere
|
||||||
if (!is_for_cli && _detail_cli)
|
if (!is_for_cli && _detail_cli)
|
||||||
@ -692,14 +633,18 @@ void TStampa_ordini::filter_for_clifo_agent()
|
|||||||
if (!_detail_rows || _detail_doc) // Stampa distinguendo per documento e non per righe articolo...
|
if (!_detail_rows || _detail_doc) // Stampa distinguendo per documento e non per righe articolo...
|
||||||
{
|
{
|
||||||
TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "DOCUMENTI");
|
TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "DOCUMENTI");
|
||||||
if (!is_for_cli && _detail_doc)
|
if (!is_for_cli)
|
||||||
ssec.enable(); // Se stampa per agenti e dettaglia documenti per cliente abilita la sezione
|
ssec.enable(); // Se stampa per agenti e dettaglia documenti per cliente abilita la sezione
|
||||||
else
|
else
|
||||||
{ // Se stampa per cli/fo abilita i campi corrispondenti al distinguo per documento (valuta, residuo evaso ecc...)
|
{ // Se stampa per cli/fo abilita i campi corrispondenti al distinguo per documento (valuta, residuo evaso ecc...)
|
||||||
ssec.printsection().find_field(101).show();
|
ssec.printsection().find_field(BODY_COL_1 + 100).show();
|
||||||
for (short id = 102; id <= 106; id++)
|
for (short id = BODY_COL_2 + 100; id <= (BODY_COL_6 + 100); id++)
|
||||||
ssec.printsection().find_field(id).enable();
|
ssec.printsection().find_field(id).enable();
|
||||||
}
|
}
|
||||||
|
// Deve essere abilitata ma nascosta, per eseguire i raggruppamenti sulle righe
|
||||||
|
TForm_subsection& dsec = (TForm_subsection&) _frm->find_field('B', odd_page, "RIGHEDOC");
|
||||||
|
dsec.enable();
|
||||||
|
dsec.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// In qualsiasi caso va fatta questa abilitazione
|
// In qualsiasi caso va fatta questa abilitazione
|
||||||
@ -710,7 +655,7 @@ void TStampa_ordini::filter_for_clifo_agent()
|
|||||||
|
|
||||||
if (_detail_rows) // Stampa dettaglio righe...
|
if (_detail_rows) // Stampa dettaglio righe...
|
||||||
{
|
{
|
||||||
for (short i = 7; i<=9; i++)
|
for (short i = BODY_COL_7; i<=BODY_COL_12; i++)
|
||||||
_frm->find_field('B', odd_page, i).show(); // Aggiunge le colonne di dettaglio
|
_frm->find_field('B', odd_page, i).show(); // Aggiunge le colonne di dettaglio
|
||||||
// dulcis in fundo (Dulcinea mia adorata), si abilita la sezione RIGHEART
|
// dulcis in fundo (Dulcinea mia adorata), si abilita la sezione RIGHEART
|
||||||
// anziche' RIGHEDOC nel qual caso sia stato specificato il raggruppamento per Articoli (e sotto-opzioni)
|
// anziche' RIGHEDOC nel qual caso sia stato specificato il raggruppamento per Articoli (e sotto-opzioni)
|
||||||
@ -724,10 +669,16 @@ void TStampa_ordini::filter_for_clifo_agent()
|
|||||||
{
|
{
|
||||||
TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "ARTCLI");
|
TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "ARTCLI");
|
||||||
ssec.enable();
|
ssec.enable();
|
||||||
|
ssec.printsection().find_field(BODY_COL_5 + 400).enable(_opz_valore);
|
||||||
|
ssec.printsection().find_field(BODY_COL_6 + 400).enable(_opz_valore);
|
||||||
|
ssec.printsection().find_field(BODY_COL_10 + 400).enable(_opz_prezzo);
|
||||||
|
ssec.printsection().find_field(BODY_COL_11 + 400).enable(_opz_residuo);
|
||||||
|
ssec.printsection().find_field(BODY_COL_12 + 400).enable(_opz_giacenza);
|
||||||
|
|
||||||
if (_detail_cli) // Se e' abilitata la distinzione per clienti setta l'espressione di raggruppamento
|
if (_detail_cli) // Se e' abilitata la distinzione per clienti setta l'espressione di raggruppamento
|
||||||
{
|
{
|
||||||
cond = ssec.condition();
|
cond = ssec.condition();
|
||||||
cond << LF_CLIFO << "->TIPOCF+" << LF_CLIFO << "->CODCF";
|
cond << "+" << LF_CLIFO << "->TIPOCF+" << LF_CLIFO << "->CODCF+" << LF_DOC << "->OCFPI";
|
||||||
ssec.setcondition(cond, _strexpr);
|
ssec.setcondition(cond, _strexpr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -745,13 +696,34 @@ void TStampa_ordini::filter_for_clifo_agent()
|
|||||||
if (is_for_cli)
|
if (is_for_cli)
|
||||||
{ // I seguenti campi non necessitano di abilitazione se la stampa e' per agente
|
{ // I seguenti campi non necessitano di abilitazione se la stampa e' per agente
|
||||||
TForm_subsection& dsec = (TForm_subsection&) _frm->find_field('B', odd_page, "DOCUMENTI");
|
TForm_subsection& dsec = (TForm_subsection&) _frm->find_field('B', odd_page, "DOCUMENTI");
|
||||||
for (short id = 401; id <= 409; id++)
|
for (short id = BODY_COL_1 + 400; id <= (BODY_COL_12 + 400); id++)
|
||||||
dsec.printsection().find_field(id).enable();
|
dsec.printsection().find_field(id).enable();
|
||||||
|
dsec.printsection().find_field(BODY_COL_5 + 400).enable(_opz_valore);
|
||||||
|
dsec.printsection().find_field(BODY_COL_6 + 400).enable(_opz_valore);
|
||||||
|
dsec.printsection().find_field(BODY_COL_10 + 400).enable(_opz_prezzo);
|
||||||
|
dsec.printsection().find_field(BODY_COL_11 + 400).enable(_opz_residuo);
|
||||||
|
dsec.printsection().find_field(BODY_COL_12 + 400).enable(_opz_giacenza);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_frm->find_field('B', odd_page, "RIGHEDOC").enable(); // Abilita la sezione di dettaglio righe PER DOCUMENTO
|
_frm->find_field('B', odd_page, "RIGHEDOC").enable(); // Abilita la sezione di dettaglio righe PER DOCUMENTO
|
||||||
|
TForm_subsection& rd = (TForm_subsection&) _frm->find_field('B', odd_page, "RIGHEDOC");
|
||||||
|
rd.printsection().find_field(BODY_COL_5 + 200).enable(_opz_valore);
|
||||||
|
rd.printsection().find_field(BODY_COL_6 + 200).enable(_opz_valore);
|
||||||
|
rd.printsection().find_field(BODY_COL_10 + 200).enable(_opz_prezzo);
|
||||||
|
rd.printsection().find_field(BODY_COL_11 + 200).enable(_opz_residuo);
|
||||||
|
rd.printsection().find_field(BODY_COL_12 + 200).enable(_opz_giacenza);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// Abilitazione intestazioni di colonna
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_5).show(_opz_valore);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_6).show(_opz_valore);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_10).show(_opz_prezzo);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_11).show(_opz_residuo);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_12).show(_opz_giacenza);
|
||||||
|
|
||||||
|
set_totvaluta_items();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TStampa_ordini::filter_for_articolo()
|
void TStampa_ordini::filter_for_articolo()
|
||||||
@ -777,10 +749,6 @@ void TStampa_ordini::filter_for_articolo()
|
|||||||
cur->change_order(s); // Setta l'ordine
|
cur->change_order(s); // Setta l'ordine
|
||||||
|
|
||||||
|
|
||||||
TDocumento *doc = new TDocumento;
|
|
||||||
cur->file(LF_DOC).set_curr(doc);
|
|
||||||
cur->file(LF_RIGHEDOC).set_curr(new TRiga_documento(doc));
|
|
||||||
|
|
||||||
TRectype f(LF_RIGHEDOC), t(LF_RIGHEDOC);
|
TRectype f(LF_RIGHEDOC), t(LF_RIGHEDOC);
|
||||||
TString filter_expr;
|
TString filter_expr;
|
||||||
|
|
||||||
@ -798,11 +766,16 @@ void TStampa_ordini::filter_for_articolo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
t = f;
|
t = f;
|
||||||
|
t.put(RDOC_CODART, _to_art);
|
||||||
|
cur->setkey(2); // Questa chiave rende piu' veloce la costruzione se indicato un range di articoli
|
||||||
cur->setregion(f,t); // This is the region...
|
cur->setregion(f,t); // This is the region...
|
||||||
|
|
||||||
s.format("(%d->TIPOCF==\"",LF_DOC);
|
s.format("(%d->TIPOCF==\"",LF_DOC);
|
||||||
filter_expr << s << _tipocf << "\")"; // Nel caso di stampa per agenti e' sempre "C"
|
filter_expr << s << _tipocf << "\")"; // Nel caso di stampa per agenti e' sempre "C"
|
||||||
|
|
||||||
|
s.format("&&(%d->CODART!=\"\")", LF_RIGHEDOC);
|
||||||
|
filter_expr << s;
|
||||||
|
|
||||||
// Filtro su Cli/Fo
|
// Filtro su Cli/Fo
|
||||||
if (_from_cf > 0L)
|
if (_from_cf > 0L)
|
||||||
{
|
{
|
||||||
@ -843,19 +816,6 @@ void TStampa_ordini::filter_for_articolo()
|
|||||||
filter_expr << s;
|
filter_expr << s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_from_art.not_empty())
|
|
||||||
{
|
|
||||||
s.format("&&(%d->CODART>=\"%s\")",
|
|
||||||
LF_RIGHEDOC, (const char*)_from_art);
|
|
||||||
filter_expr << s;
|
|
||||||
}
|
|
||||||
if (_to_art.not_empty())
|
|
||||||
{
|
|
||||||
filter_expr << "&&";
|
|
||||||
s.format("(%d->CODART<=\"%s\")",
|
|
||||||
LF_RIGHEDOC, (const char*)_to_art);
|
|
||||||
filter_expr << s;
|
|
||||||
}
|
|
||||||
// Setta i range per i livelli di giacenza (da 1 a 4)
|
// Setta i range per i livelli di giacenza (da 1 a 4)
|
||||||
if (_detail_level > 0)
|
if (_detail_level > 0)
|
||||||
for (int lev=1, index=0; lev <= _detail_level; lev++)
|
for (int lev=1, index=0; lev <= _detail_level; lev++)
|
||||||
@ -895,18 +855,19 @@ void TStampa_ordini::filter_for_articolo()
|
|||||||
|
|
||||||
s = "";
|
s = "";
|
||||||
if (_TEA_rord == 'E')
|
if (_TEA_rord == 'E')
|
||||||
s.format("(%d->RIGAEVASA==\"X\")",LF_RIGHEDOC);
|
s.format("&&(%d->RIGAEVASA==\"X\")",LF_RIGHEDOC);
|
||||||
else
|
else
|
||||||
if (_TEA_rord == 'A')
|
if (_TEA_rord == 'A')
|
||||||
s.format("(%d->RIGAEVASA!=\"X\")",LF_RIGHEDOC);
|
s.format("&&(%d->RIGAEVASA!=\"X\")",LF_RIGHEDOC);
|
||||||
|
|
||||||
if (s.not_empty())
|
if (s.not_empty())
|
||||||
filter_expr << s;
|
filter_expr << s;
|
||||||
|
|
||||||
cur->setfilter(filter_expr,TRUE); // Setta il filtro e serra i ranghi
|
|
||||||
|
|
||||||
// Setta la condizione di raggruppamento principale per articoli (comune alla stampa per cli/fo e per agenti)
|
cur->setfilter(filter_expr,TRUE,2); // Setta il filtro e serra i ranghi
|
||||||
TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "ARTICOLI");
|
|
||||||
|
// Setta la condizione di raggruppamento principale per articoli
|
||||||
|
TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "ARTMAIN");
|
||||||
ssec.enable();
|
ssec.enable();
|
||||||
s = ssec.condition();
|
s = ssec.condition();
|
||||||
if (lev_str.not_empty())
|
if (lev_str.not_empty())
|
||||||
@ -915,8 +876,25 @@ void TStampa_ordini::filter_for_articolo()
|
|||||||
s << "+" << mag_str;
|
s << "+" << mag_str;
|
||||||
ssec.setcondition(s, _strexpr);
|
ssec.setcondition(s, _strexpr);
|
||||||
|
|
||||||
for (short id = 401; id <= 409; id++)
|
for (short id = BODY_COL_1 + 400; id <= (BODY_COL_12 + 400); id++)
|
||||||
_frm->find_field('B',odd_page,id).enable();
|
_frm->find_field('B',odd_page,id).enable();
|
||||||
|
|
||||||
|
// Abilitazione intestazioni di colonna
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_5).show(_opz_valore);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_6).show(_opz_valore);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_10).show(_opz_prezzo);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_11).show(_opz_residuo);
|
||||||
|
_frm->find_field('B', odd_page, BODY_COL_12).show(_opz_giacenza);
|
||||||
|
|
||||||
|
// Abilitazione intestazioni di riga
|
||||||
|
TForm_subsection& asec = (TForm_subsection&)_frm->find_field('B', odd_page, "ARTMAIN"); // Sottosezione padre
|
||||||
|
asec.printsection().find_field(BODY_COL_5 + 400).show(_opz_valore);
|
||||||
|
asec.printsection().find_field(BODY_COL_6 + 400).show(_opz_valore);
|
||||||
|
asec.printsection().find_field(BODY_COL_10 + 400).show(_opz_prezzo);
|
||||||
|
asec.printsection().find_field(BODY_COL_11 + 400).show(_opz_residuo);
|
||||||
|
asec.printsection().find_field(BODY_COL_12 + 400).show(_opz_giacenza);
|
||||||
|
|
||||||
|
set_totvaluta_items();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TStampa_ordini::main_loop()
|
void TStampa_ordini::main_loop()
|
||||||
@ -978,6 +956,19 @@ void TStampa_ordini::main_loop()
|
|||||||
_detail_dep = _m->get_bool(F_DETAIL_DEP);
|
_detail_dep = _m->get_bool(F_DETAIL_DEP);
|
||||||
_detail_level = _m->get_int(F_DETAIL_LEV);
|
_detail_level = _m->get_int(F_DETAIL_LEV);
|
||||||
|
|
||||||
|
_pr_spese = _m->get_bool(F_PRINTSPESE);
|
||||||
|
_pr_prest = _m->get_bool(F_PRINTPREST);
|
||||||
|
_pr_sconti = _m->get_bool(F_PRINTSCONTI);
|
||||||
|
_pr_omaggi = _m->get_bool(F_PRINTOMAGGI);
|
||||||
|
_pr_descr = _m->get_bool(F_PRINTDESCR);
|
||||||
|
|
||||||
|
_opz_valore = _m->get_bool(F_OPZ_VALORE);
|
||||||
|
_opz_prezzo = _m->get_bool(F_OPZ_PREZZO);
|
||||||
|
_opz_residuo = _m->get_bool(F_OPZ_RESIDUO);
|
||||||
|
_opz_giacenza = _m->get_bool(F_OPZ_GIACENZA);
|
||||||
|
|
||||||
|
_force_evase = _m->get_bool(F_FORCE_EVASE);
|
||||||
|
|
||||||
_TEA_ord = _m->get(F_STATOORD)[0];
|
_TEA_ord = _m->get(F_STATOORD)[0];
|
||||||
_TEA_rord = _m->get(F_STATORORD)[0];
|
_TEA_rord = _m->get(F_STATORORD)[0];
|
||||||
|
|
||||||
@ -1016,22 +1007,30 @@ void TStampa_ordini::main_loop()
|
|||||||
|
|
||||||
|
|
||||||
const int hh = 6;
|
const int hh = 6;
|
||||||
const int fh = 1;
|
|
||||||
const int fl = printer().formlen();
|
const int fl = printer().formlen();
|
||||||
|
|
||||||
int rows[4]; // Righe orizzontali
|
int rows[4]; // Righe orizzontali
|
||||||
rows[0] = hh-2;
|
rows[0] = hh-2;
|
||||||
rows[1] = hh;
|
rows[1] = hh;
|
||||||
rows[2] = fl-1;
|
rows[2] = fl;
|
||||||
rows[3] = 0;
|
rows[3] = 0;
|
||||||
_frm->genera_intestazioni(odd_page, hh-1);
|
_frm->genera_intestazioni(odd_page, hh-1);
|
||||||
_frm->genera_fincatura(odd_page, hh-2, fl-1, rows);
|
_frm->genera_fincatura(odd_page, hh-2, fl, rows);
|
||||||
|
|
||||||
// stampa
|
// Crea il cursore
|
||||||
if (_frm->cursor()->items() > 0)
|
if (_frm->cursor()->items() > 0)
|
||||||
|
{
|
||||||
|
// Sostituzione curr del cursore
|
||||||
|
TCursor* cur = _frm->cursor();
|
||||||
|
TDocumento *doc = new TDocumento; // Don't delete!
|
||||||
|
|
||||||
|
cur->file(LF_DOC).set_curr(doc);
|
||||||
|
cur->file(LF_RIGHEDOC).set_curr(new TRiga_documento(doc));// Don't delete!
|
||||||
|
|
||||||
|
// stampa
|
||||||
_frm->print();
|
_frm->print();
|
||||||
|
}
|
||||||
delete _frm;
|
delete _frm;
|
||||||
_m->reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
29
or/or1100a.h
29
or/or1100a.h
@ -48,6 +48,16 @@
|
|||||||
#define F_DEPTO 148
|
#define F_DEPTO 148
|
||||||
#define F_DETAIL_BY_DOC 149
|
#define F_DETAIL_BY_DOC 149
|
||||||
#define F_DETAIL_BY_CLI 150
|
#define F_DETAIL_BY_CLI 150
|
||||||
|
#define F_PRINTSPESE 151
|
||||||
|
#define F_PRINTPREST 152
|
||||||
|
#define F_PRINTSCONTI 153
|
||||||
|
#define F_PRINTOMAGGI 154
|
||||||
|
#define F_PRINTDESCR 155
|
||||||
|
#define F_OPZ_VALORE 156
|
||||||
|
#define F_OPZ_PREZZO 157
|
||||||
|
#define F_OPZ_RESIDUO 158
|
||||||
|
#define F_OPZ_GIACENZA 159
|
||||||
|
#define F_FORCE_EVASE 160
|
||||||
|
|
||||||
#define GR_CLIFO 1
|
#define GR_CLIFO 1
|
||||||
#define GR_NUM 2
|
#define GR_NUM 2
|
||||||
@ -61,8 +71,27 @@
|
|||||||
#define GR_GIAC 10
|
#define GR_GIAC 10
|
||||||
#define GR_DETAIL 11
|
#define GR_DETAIL 11
|
||||||
#define GR_DETAILART 12
|
#define GR_DETAILART 12
|
||||||
|
#define GR_PRINT 13
|
||||||
|
|
||||||
// Defines per forms
|
// Defines per forms
|
||||||
#define G_DETTAGLIO 1
|
#define G_DETTAGLIO 1
|
||||||
#define G_TOTALE 2
|
#define G_TOTALE 2
|
||||||
#define G_TOTALEART 3
|
#define G_TOTALEART 3
|
||||||
|
|
||||||
|
#define BODY_COL_1 1
|
||||||
|
#define BODY_COL_2 2
|
||||||
|
#define BODY_COL_3 3
|
||||||
|
#define BODY_COL_4 4
|
||||||
|
#define BODY_COL_5 5
|
||||||
|
#define BODY_COL_6 6
|
||||||
|
#define BODY_COL_7 7
|
||||||
|
#define BODY_COL_8 8
|
||||||
|
#define BODY_COL_9 9
|
||||||
|
#define BODY_COL_10 10
|
||||||
|
#define BODY_COL_11 11
|
||||||
|
#define BODY_COL_12 12
|
||||||
|
|
||||||
|
#define BODY_CODVAL 53
|
||||||
|
#define BODY_TOTVALORD 55
|
||||||
|
#define BODY_TOTVALRES 56
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
// Stampa dettaglio disponibilita' articoli
|
// Stampa dettaglio disponibilita' articoli
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
|
#include <mask.h>
|
||||||
|
#include <printer.h>
|
||||||
|
#include "orlib.h"
|
||||||
|
#include "or1200a.h"
|
||||||
|
|
||||||
class TStampa_dettaglio_articoli : public TSkeleton_application
|
class TStampa_dettaglio_articoli : public TSkeleton_application
|
||||||
{
|
{
|
||||||
@ -25,16 +29,32 @@ class TStampa_dettaglio_articoli : public TSkeleton_application
|
|||||||
_to_art,
|
_to_art,
|
||||||
_from_mag, _to_mag,
|
_from_mag, _to_mag,
|
||||||
_from_dep, _to_dep;
|
_from_dep, _to_dep;
|
||||||
TString_array _from_giac, _to_giac;
|
TString_array
|
||||||
|
_from_giac, _to_giac;
|
||||||
protected:
|
protected:
|
||||||
|
void open_files(int logicnum, ...);
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
virtual bool destroy();
|
virtual bool destroy();
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
|
void set_date_array();
|
||||||
|
void set_form();
|
||||||
public:
|
public:
|
||||||
TStampa_dettaglio_articoli() {};
|
TStampa_dettaglio_articoli() {};
|
||||||
virtual ~TStampa_dettaglio_articoli() {};
|
virtual ~TStampa_dettaglio_articoli() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void TStampa_dettaglio_articoli::open_files(int logicnum, ...)
|
||||||
|
{
|
||||||
|
va_list marker;
|
||||||
|
va_start(marker, logicnum);
|
||||||
|
while (logicnum > 0)
|
||||||
|
{
|
||||||
|
CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
|
||||||
|
_file.add(new TLocalisamfile(logicnum), logicnum);
|
||||||
|
logicnum = va_arg(marker, int);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool TStampa_dettaglio_articoli::create()
|
bool TStampa_dettaglio_articoli::create()
|
||||||
{
|
{
|
||||||
open_files(LF_UMART, LF_OCCAS, LF_CLIFO, LF_INDSP, LF_CFVEN, LF_TABCOM, LF_MAG, 0);
|
open_files(LF_UMART, LF_OCCAS, LF_CLIFO, LF_INDSP, LF_CFVEN, LF_TABCOM, LF_MAG, 0);
|
||||||
@ -75,6 +95,9 @@ bool TStampa_dettaglio_articoli::create()
|
|||||||
|
|
||||||
bool TStampa_dettaglio_articoli::destroy()
|
bool TStampa_dettaglio_articoli::destroy()
|
||||||
{
|
{
|
||||||
|
delete _codgiac;
|
||||||
|
delete _fcg;
|
||||||
|
delete _m;
|
||||||
return TSkeleton_application::destroy();
|
return TSkeleton_application::destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,6 +313,7 @@ void TStampa_dettaglio_articoli::main_loop()
|
|||||||
int or1200(int argc, char** argv)
|
int or1200(int argc, char** argv)
|
||||||
{
|
{
|
||||||
TStampa_dettaglio_articoli a;
|
TStampa_dettaglio_articoli a;
|
||||||
a.run(argc,argv,"Stampa dettaglio articoli");
|
a.run(argc,argv,"Stampa disponibilita' articoli");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
|||||||
// Compone la ragione sociale (considera gli occasionali)
|
// Compone la ragione sociale (considera gli occasionali)
|
||||||
// Il formato è il seguente: CODICE (OCFPI) RAGIONE_SOCIALE
|
// Il formato è il seguente: CODICE (OCFPI) RAGIONE_SOCIALE
|
||||||
TString ws;
|
TString ws;
|
||||||
const bool print_cod = s.get_int(2);
|
const bool print_cod = s.get_int(2)!=0;
|
||||||
TDocumento& documento = (TDocumento&)cf.form().cursor()->file(LF_DOC).curr();
|
TDocumento& documento = (TDocumento&)cf.form().cursor()->file(LF_DOC).curr();
|
||||||
TCli_for& cli_for = documento.clifor();
|
TCli_for& cli_for = documento.clifor();
|
||||||
TOccasionale& cli_occ = documento.occas();
|
TOccasionale& cli_occ = documento.occas();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user