1997-06-04 14:18:41 +00:00
|
|
|
|
#include <applicat.h>
|
1999-04-06 15:34:39 +00:00
|
|
|
|
#include <currency.h>
|
1999-05-24 13:34:11 +00:00
|
|
|
|
#include <progind.h>
|
2001-05-02 13:40:49 +00:00
|
|
|
|
#include <utility.h>
|
1997-06-04 14:18:41 +00:00
|
|
|
|
|
1999-05-24 13:34:11 +00:00
|
|
|
|
#include "../cg/cglib01.h"
|
|
|
|
|
#include "../ve/veconf.h"
|
1997-06-09 11:03:52 +00:00
|
|
|
|
#include "mglib.h"
|
1997-06-04 14:18:41 +00:00
|
|
|
|
#include "mg4200.h"
|
2001-05-02 13:40:49 +00:00
|
|
|
|
#include "mg4200a.h"
|
1997-06-04 14:18:41 +00:00
|
|
|
|
#include "mg4frm.h"
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TCursor* TForm_inventario::cursor() const
|
|
|
|
|
{
|
|
|
|
|
if (_use_alternate_cursor) // Se e' settata la stampa per ragg. fisc ritorna il cursore appropriato
|
|
|
|
|
return (TCursor*)_sortcur;
|
|
|
|
|
return TForm_stampemg::cursor();
|
|
|
|
|
}
|
|
|
|
|
|
1997-06-04 14:18:41 +00:00
|
|
|
|
bool TForm_inventario::validate(TForm_item &cf, TToken_string &s)
|
|
|
|
|
{
|
2003-06-12 13:49:45 +00:00
|
|
|
|
const TString80 code = s.get(0); // prende il primo parametro, il codice del messaggio
|
1997-06-04 14:18:41 +00:00
|
|
|
|
|
2001-05-02 13:40:49 +00:00
|
|
|
|
if (code=="_USER")
|
|
|
|
|
{
|
2003-06-12 13:49:45 +00:00
|
|
|
|
const TRectype& magrec=relation()->curr(LF_MAG);
|
|
|
|
|
const TString subcode=s.get();
|
2001-05-02 13:40:49 +00:00
|
|
|
|
if (subcode=="GIAC")
|
|
|
|
|
{
|
|
|
|
|
real v=curr_art().giacenza_corretta(magrec, FALSE,_valcomp);
|
|
|
|
|
cf.set(v.string());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="VAL1")
|
|
|
|
|
valorizzazione(cf,_valorizz_scelte[0]);
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="VAL2"&& _colonne >=2)
|
|
|
|
|
valorizzazione(cf,_valorizz_scelte[1]);
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="VAL3" && _colonne >=3)
|
|
|
|
|
valorizzazione(cf,_valorizz_scelte[2]);
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="VAL4" && _colonne >=4)
|
|
|
|
|
valorizzazione(cf,_valorizz_scelte[3]);
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="VAL5"&& _colonne >=5)
|
|
|
|
|
valorizzazione(cf,_valorizz_scelte[4]);
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="VAL6" && _colonne >=6)
|
|
|
|
|
valorizzazione(cf,_valorizz_scelte[5]);
|
|
|
|
|
/* else
|
|
|
|
|
if (subcode=="NAMEVAL1")
|
|
|
|
|
cf.set(Nome_valorizz[_valorizz_scelte[0]]);
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="NAMEVAL2"&& _colonne >=2)
|
|
|
|
|
cf.set(Nome_valorizz[_valorizz_scelte[1]]);
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="NAMEVAL3" && _colonne >=3)
|
|
|
|
|
cf.set(Nome_valorizz[_valorizz_scelte[2]]);
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="NAMEVAL4" && _colonne >=4)
|
|
|
|
|
cf.set(Nome_valorizz[_valorizz_scelte[3]]);
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="NAMEVAL5"&& _colonne >=5)
|
|
|
|
|
cf.set(Nome_valorizz[_valorizz_scelte[4]]);
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="NAMEVAL6" && _colonne >=6)
|
|
|
|
|
cf.set(Nome_valorizz[_valorizz_scelte[5]]); */
|
|
|
|
|
else
|
|
|
|
|
if (subcode=="LINEATOTALI")
|
|
|
|
|
{
|
|
|
|
|
TString l(29*_colonne+12,'-');
|
|
|
|
|
cf.set(l);
|
|
|
|
|
}
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
2001-05-02 13:40:49 +00:00
|
|
|
|
else
|
|
|
|
|
if (code == "_ANNO")
|
|
|
|
|
cf.set(format("%d", _annoes));
|
2003-10-01 14:14:25 +00:00
|
|
|
|
|
1997-06-04 14:18:41 +00:00
|
|
|
|
return TForm_stampemg::validate(cf, s);
|
|
|
|
|
}
|
|
|
|
|
|
1999-05-24 13:34:11 +00:00
|
|
|
|
TArticolo_giacenza_loadable &TForm_inventario::curr_art()
|
1997-06-04 14:18:41 +00:00
|
|
|
|
{
|
2003-06-12 13:49:45 +00:00
|
|
|
|
const TString80 newcode(relation()->curr(LF_ANAMAG).get(ANAMAG_CODART));
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (_curr_art==NULL || newcode != _curr_art->codice())
|
1999-05-24 13:34:11 +00:00
|
|
|
|
{
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (_curr_art) delete _curr_art;
|
1999-05-24 13:34:11 +00:00
|
|
|
|
_curr_art=new TArticolo_giacenza_loadable(newcode);
|
|
|
|
|
if (_alladata)
|
|
|
|
|
_curr_art->load((TIsamtempfile&)(relation()->lfile(LF_MAG)));
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
|
|
|
|
return *_curr_art;
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
void TForm_inventario::add_colval(int tipo)
|
1997-06-04 14:18:41 +00:00
|
|
|
|
{
|
1998-06-10 16:38:58 +00:00
|
|
|
|
TTipo_valorizz t= (TTipo_valorizz )tipo;
|
|
|
|
|
if (t>=valorizz_ultcos && tipo <=valorizz_LIFOr)
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// Accende le colonne totali del Footer Last...
|
|
|
|
|
find_field('F', last_page, FF_BASEFL + (_colonne * 2)).show();
|
|
|
|
|
if (t < valorizz_FIFOa)
|
|
|
|
|
find_field('F', last_page, FF_BASEFL + (_colonne * 2) +1).show();
|
|
|
|
|
|
1998-06-10 16:38:58 +00:00
|
|
|
|
_valorizz_scelte[_colonne++]=t;
|
|
|
|
|
TString col;
|
|
|
|
|
col << _colonne;
|
|
|
|
|
find_field('B',odd_page,FF_ENABLECOLS).set(col);
|
1998-11-04 18:04:26 +00:00
|
|
|
|
|
|
|
|
|
// Accende le colonne per l'intestazione
|
|
|
|
|
const int base_col = 2*(_colonne-1);
|
|
|
|
|
find_field('B',odd_page,FF_COL1HEADER + base_col).show(); // Colonna valore
|
|
|
|
|
find_field('B',odd_page,FF_COL1HEADER + base_col+1).show(t < valorizz_FIFOa); // Colonna valore unitario (abilitata solo se ! FIFO/LIFO)
|
|
|
|
|
|
|
|
|
|
// Nasconde la colonna del valore unitario se il tipo di valorizzazzione e' FIFO/LIFO
|
|
|
|
|
if (t >= valorizz_FIFOa && t <= valorizz_LIFOr)
|
|
|
|
|
// Abilita i campi necessari per "nascondere" le colonne del prezzo unitario in tutto il form.
|
|
|
|
|
find_field('B', odd_page, FF_DISABLEUNIT1 + _colonne - 1).enable();
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TForm_inventario::valorizzazione(TForm_item &cf, TTipo_valorizz t)
|
|
|
|
|
{
|
1997-07-07 11:08:59 +00:00
|
|
|
|
TRectype & magrec=relation()->lfile(LF_MAG).curr();
|
|
|
|
|
TString annoes(magrec.get(MAG_ANNOES));
|
1997-07-30 13:26:28 +00:00
|
|
|
|
real v;
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (t==valorizz_ultcos) {
|
1999-04-06 15:34:39 +00:00
|
|
|
|
v=curr_art().ultimo_costo(annoes);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
|
|
|
|
if (t==valorizz_mediacos) {
|
1999-04-06 15:34:39 +00:00
|
|
|
|
v=curr_art().media_costi(annoes);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
|
|
|
|
if (t==valorizz_przlist) {
|
1999-04-06 15:34:39 +00:00
|
|
|
|
v=100.0 / (100.0 + curr_art().get_real(ANAMAG_PERCRIC));
|
|
|
|
|
v=curr_art().prezzo_listino(annoes,_catven,_codlist) * v;
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
|
|
|
|
if (t==valorizz_coststd) {
|
1999-04-06 15:34:39 +00:00
|
|
|
|
v=curr_art().costo_standard(annoes);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
if (t==valorizz_costmediopond) {
|
2003-06-12 13:49:45 +00:00
|
|
|
|
const TString4 codmag = magrec.get(MAG_CODMAG).left(3);
|
|
|
|
|
const TString80 livello(magrec.get(MAG_LIVELLO));
|
1999-04-06 15:34:39 +00:00
|
|
|
|
v=curr_art().costo_mediopond(annoes,codmag,livello);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (t==valorizz_costmedio) {
|
2003-06-12 13:49:45 +00:00
|
|
|
|
const TString4 codmag = magrec.get(MAG_CODMAG).left(3);
|
|
|
|
|
const TString80 livello(magrec.get(MAG_LIVELLO));
|
1999-04-06 15:34:39 +00:00
|
|
|
|
v=curr_art().costo_medio(annoes,codmag,livello);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// arrotonda le valorizzazioni a costo unitario
|
|
|
|
|
_currency->set_price(TRUE);
|
|
|
|
|
_currency->set_num(v);
|
2001-05-02 13:40:49 +00:00
|
|
|
|
v = _currency->get_num();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (t==valorizz_LIFO) {
|
2003-06-12 13:49:45 +00:00
|
|
|
|
const TString4 codmag = magrec.get(MAG_CODMAG).left(3);
|
|
|
|
|
const TString80 livello(magrec.get(MAG_LIVELLO));
|
2001-05-02 13:40:49 +00:00
|
|
|
|
v=curr_art().LIFO(annoes,codmag,livello, FALSE,_valcomp);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
|
|
|
|
if (t==valorizz_FIFO) {
|
2003-06-12 13:49:45 +00:00
|
|
|
|
const TString4 codmag = magrec.get(MAG_CODMAG).left(3);
|
|
|
|
|
const TString80 livello(magrec.get(MAG_LIVELLO));
|
2001-05-02 13:40:49 +00:00
|
|
|
|
v=curr_art().FIFO(annoes,codmag,livello, FALSE,_valcomp);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
|
|
|
|
if (t==valorizz_LIFOa) {
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TString codmag(magrec.get(MAG_CODMAG));codmag.left(3);
|
2003-06-12 13:49:45 +00:00
|
|
|
|
const TString80 livello(magrec.get(MAG_LIVELLO));
|
2001-05-02 13:40:49 +00:00
|
|
|
|
v=curr_art().LIFO_annuale(annoes,codmag,livello, FALSE,_valcomp);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
|
|
|
|
if (t==valorizz_FIFOa) {
|
2003-06-12 13:49:45 +00:00
|
|
|
|
const TString4 codmag = magrec.get(MAG_CODMAG).left(3);
|
|
|
|
|
const TString80 livello(magrec.get(MAG_LIVELLO));
|
2001-05-02 13:40:49 +00:00
|
|
|
|
v=curr_art().FIFO_annuale(annoes,codmag,livello, FALSE,_valcomp);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
2001-05-02 13:40:49 +00:00
|
|
|
|
const real giac_corretta = curr_art().giacenza_corretta(magrec, FALSE,_valcomp);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
v= v * giac_corretta ;
|
|
|
|
|
_currency->set_price(FALSE);
|
|
|
|
|
_currency->set_num(v);
|
2001-05-02 13:40:49 +00:00
|
|
|
|
cf.set(_currency->get_num().string());
|
1997-07-07 11:08:59 +00:00
|
|
|
|
return TRUE;
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
bool TForm_inventario::genera_intestazione_supplementare(pagetype p, short y)
|
|
|
|
|
{
|
|
|
|
|
TPrint_section* body = exist('B', p);
|
|
|
|
|
if (body == NULL || !body->columnwise())
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
TPrint_section* header = exist('H', p);
|
|
|
|
|
if (header == NULL)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
TForm_string* s;
|
|
|
|
|
TString des;
|
|
|
|
|
for (int j=0;j<_colonne;j++)
|
|
|
|
|
{
|
|
|
|
|
TForm_item& fi = body->find_field(FF_COL1HEADER+j*2);
|
|
|
|
|
des = Nome_valorizz[_valorizz_scelte[j]];
|
|
|
|
|
int w = fi.width();
|
|
|
|
|
if (_valorizz_scelte[j] < valorizz_FIFOa)
|
|
|
|
|
w *= 2;
|
|
|
|
|
des.center_just(w);
|
|
|
|
|
s = new TForm_string(header);
|
|
|
|
|
s->id() = -1;
|
|
|
|
|
s->set_x(fi.x());
|
|
|
|
|
s->y() = y;
|
|
|
|
|
s->set_prompt(des);
|
|
|
|
|
s->temp() = TRUE;
|
|
|
|
|
header->add_field(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-02 13:40:49 +00:00
|
|
|
|
void TForm_inventario::set_parametri(const char * codcatv,const char * codlist,bool giaceff, bool valcomp, bool alladata, int annoes)
|
1997-06-04 14:18:41 +00:00
|
|
|
|
{
|
1997-07-07 11:08:59 +00:00
|
|
|
|
_catven=codcatv;
|
|
|
|
|
_codlist=codlist;
|
|
|
|
|
_giaceff=giaceff;
|
|
|
|
|
_valcomp=valcomp;
|
2001-05-02 13:40:49 +00:00
|
|
|
|
_alladata=alladata;
|
|
|
|
|
_annoes = annoes;
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TForm_inventario::TForm_inventario(const char *name,const char *code) :
|
1997-07-07 11:08:59 +00:00
|
|
|
|
TForm_stampemg(name,code),_curr_art(NULL)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
_sortcur = new TSorted_cursor(relation(),"RAGGFIS|CODART");
|
|
|
|
|
_use_alternate_cursor = FALSE;
|
1998-06-10 16:38:58 +00:00
|
|
|
|
_colonne=0;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_currency = new TCurrency(ZERO,"_FIRM");
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TForm_inventario::~TForm_inventario()
|
|
|
|
|
{
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (_curr_art) delete _curr_art;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (_sortcur) delete _sortcur;
|
|
|
|
|
delete _currency;
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1998-04-30 14:59:47 +00:00
|
|
|
|
class TStampainv_mask: public TStampemg_mask
|
1997-06-04 14:18:41 +00:00
|
|
|
|
{
|
1997-07-07 11:08:59 +00:00
|
|
|
|
static bool handle_ragg(TMask_field &fld, KEY k); // handler
|
|
|
|
|
static bool handle_liv(TMask_field &fld, KEY k); // handler
|
|
|
|
|
static bool handle_subord(TMask_field &fld, KEY k); // handler
|
1998-06-10 16:38:58 +00:00
|
|
|
|
static bool handle_codlist(TMask_field &fld, KEY k); // handler
|
1999-04-06 15:34:39 +00:00
|
|
|
|
static bool handle_filt(TMask_field &fld, KEY k); // handler
|
1997-06-04 14:18:41 +00:00
|
|
|
|
public:
|
1997-07-07 11:08:59 +00:00
|
|
|
|
TStampainv_mask();
|
|
|
|
|
~TStampainv_mask(){};
|
1997-06-04 14:18:41 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TStampainv_mask::TStampainv_mask():
|
1998-04-30 14:59:47 +00:00
|
|
|
|
TStampemg_mask("mg4200")
|
1997-06-04 14:18:41 +00:00
|
|
|
|
{
|
|
|
|
|
TConfig prassid(CONFIG_DITTA, "ve"); // apre il file di configurazione della ditta corrente
|
|
|
|
|
if (prassid.get_bool("GES", NULL, A_LISTINI))
|
1997-07-07 11:08:59 +00:00
|
|
|
|
field(F_CATVENLISTINO).enable(prassid.get_bool("GESLISCV"));
|
|
|
|
|
else {
|
|
|
|
|
field(F_CATVENLISTINO).disable(); field(F_CODLISTINO).disable();
|
|
|
|
|
}
|
1997-07-07 11:10:16 +00:00
|
|
|
|
|
1997-06-04 14:18:41 +00:00
|
|
|
|
set_handler(F_TOLIVELLOART, handle_liv);
|
|
|
|
|
set_handler(F_TOLIVELLOGIAC, handle_liv);
|
|
|
|
|
set_handler(F_ORDINE, handle_ragg);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
//set_handler(F_DETTAGLIODEP, handle_ragg);
|
1997-06-04 14:18:41 +00:00
|
|
|
|
set_handler(F_DETTAGLIOMAG, handle_ragg);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
set_handler(F_ORDINEART,handle_subord);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
set_handler(F_ORDINEMAG,handle_subord);
|
1998-06-10 16:38:58 +00:00
|
|
|
|
set_handler(F_CODLISTINO, handle_codlist);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
set_handler(F_FILTRO, handle_filt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TStampainv_mask::handle_filt(TMask_field &fld, KEY k)
|
|
|
|
|
{
|
1999-04-26 15:58:05 +00:00
|
|
|
|
if (k == K_SPACE)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
const bool articles = fld.mask().get(F_ORDINE)=="A";
|
|
|
|
|
TMask& m = fld.mask();
|
1999-04-26 15:58:05 +00:00
|
|
|
|
m.show(F_ORDINEART, articles);
|
|
|
|
|
m.show(F_ORDINEMAG, !articles);
|
|
|
|
|
m.send_key(K_SPACE, articles ? F_ORDINEART : F_ORDINEMAG);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TStampainv_mask::handle_subord(TMask_field &fld, KEY k)
|
|
|
|
|
{
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (k == K_SPACE)
|
|
|
|
|
{
|
|
|
|
|
TOperable_field &fraggcod=(TOperable_field &)fld.mask().field(F_RAGGCODICE);
|
|
|
|
|
TOperable_field &fragggiac=(TOperable_field &)fld.mask().field(F_RAGGLIVGIAC);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
switch (fld.get()[0]) {
|
1997-07-07 11:08:59 +00:00
|
|
|
|
case 'C':
|
|
|
|
|
if (fld.mask().get(F_ORDINE)=="A")
|
|
|
|
|
fraggcod.enable();
|
|
|
|
|
else {
|
1998-08-25 18:07:30 +00:00
|
|
|
|
if (!fld.mask().get_bool(F_DETTAGLIODEP))
|
1997-07-07 11:08:59 +00:00
|
|
|
|
{
|
|
|
|
|
fraggcod.reset(); fraggcod.disable();
|
|
|
|
|
fragggiac.reset(); fragggiac.disable();
|
|
|
|
|
fraggcod.do_message(0);fragggiac.do_message(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'M':
|
1999-04-06 15:34:39 +00:00
|
|
|
|
case 'S':
|
|
|
|
|
case 'R':
|
1997-07-07 11:08:59 +00:00
|
|
|
|
case 'D':
|
|
|
|
|
fraggcod.reset(); fraggcod.check();fraggcod.disable();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TStampainv_mask::handle_liv(TMask_field &fld, KEY k)
|
|
|
|
|
{
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (k == K_TAB)
|
|
|
|
|
{
|
|
|
|
|
TOperable_field &ftotmag=(TOperable_field &)fld.mask().field(F_TOTALIMAGAZZINI);
|
|
|
|
|
TOperable_field &fdettmag=(TOperable_field &)fld.mask().field(F_DETTAGLIOMAG);
|
|
|
|
|
if (fld.mask().get(F_ORDINE)=="A")
|
|
|
|
|
{
|
|
|
|
|
if (fld.mask().get_int(F_TOLIVELLOART) || fld.mask().get_int(F_TOLIVELLOGIAC))
|
|
|
|
|
{
|
|
|
|
|
// raggruppamenti prima del dettaglio magazzini
|
|
|
|
|
ftotmag.reset(); ftotmag.disable();ftotmag.do_message(0);
|
|
|
|
|
} else {
|
|
|
|
|
ftotmag.enable();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1997-06-04 14:18:41 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1997-06-04 14:18:41 +00:00
|
|
|
|
bool TStampainv_mask::handle_ragg(TMask_field &fld, KEY k)
|
|
|
|
|
{
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (k == K_SPACE)
|
|
|
|
|
{
|
|
|
|
|
TOperable_field &ftotmag=(TOperable_field &)fld.mask().field(F_TOTALIMAGAZZINI);
|
|
|
|
|
TOperable_field &fraggcod=(TOperable_field &)fld.mask().field(F_RAGGCODICE);
|
|
|
|
|
TOperable_field &fragggiac=(TOperable_field &)fld.mask().field(F_RAGGLIVGIAC);
|
|
|
|
|
if (fld.mask().get(F_ORDINE)=="M")
|
|
|
|
|
{
|
|
|
|
|
ftotmag.enable();
|
1998-08-25 18:07:30 +00:00
|
|
|
|
if (!fld.mask().get_bool(F_DETTAGLIODEP))
|
1997-07-07 11:08:59 +00:00
|
|
|
|
{
|
|
|
|
|
fraggcod.reset(); fraggcod.disable();
|
|
|
|
|
fragggiac.reset(); fragggiac.disable();
|
|
|
|
|
fraggcod.do_message(0);fragggiac.do_message(0);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fraggcod.enable();
|
|
|
|
|
fragggiac.enable();
|
|
|
|
|
}
|
1997-06-04 14:18:41 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1998-06-10 16:38:58 +00:00
|
|
|
|
bool TStampainv_mask::handle_codlist(TMask_field &fld, KEY k)
|
|
|
|
|
{
|
|
|
|
|
if (k == K_ENTER)
|
|
|
|
|
{
|
|
|
|
|
if (fld.empty())
|
|
|
|
|
{
|
|
|
|
|
TMask & m=fld.mask();
|
|
|
|
|
|
|
|
|
|
if (m.get_int(F_VAL1)-1==valorizz_przlist ||
|
|
|
|
|
m.get_int(F_VAL2)-1==valorizz_przlist ||
|
|
|
|
|
m.get_int(F_VAL3)-1==valorizz_przlist ||
|
|
|
|
|
m.get_int(F_VAL4)-1==valorizz_przlist ||
|
|
|
|
|
m.get_int(F_VAL5)-1==valorizz_przlist ||
|
|
|
|
|
m.get_int(F_VAL6)-1==valorizz_przlist
|
|
|
|
|
)
|
|
|
|
|
return fld.error_box("Occorre specificare il listino per la valorizzazione");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1997-06-04 14:18:41 +00:00
|
|
|
|
// STAMPA anagrafiche
|
|
|
|
|
|
1998-06-10 16:38:58 +00:00
|
|
|
|
void TStampa_inventario ::on_firm_change()
|
|
|
|
|
{
|
|
|
|
|
_mask->enable_livellicodice();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1997-06-04 14:18:41 +00:00
|
|
|
|
|
1998-04-30 14:59:47 +00:00
|
|
|
|
bool TStampa_inventario::create()
|
1997-06-04 14:18:41 +00:00
|
|
|
|
{
|
|
|
|
|
_mask = new TStampainv_mask();
|
|
|
|
|
_files = new TArray();
|
1997-07-07 11:08:59 +00:00
|
|
|
|
// aggiunge i files per usare i tracciati record
|
1997-06-04 14:18:41 +00:00
|
|
|
|
_files->add(new TLocalisamfile(LF_ANAMAG));
|
1997-06-12 14:55:12 +00:00
|
|
|
|
_files->add(new TLocalisamfile(LF_UMART));
|
|
|
|
|
_files->add(new TLocalisamfile(LF_DESLIN));
|
|
|
|
|
_files->add(new TLocalisamfile(LF_CODCORR));
|
1997-06-04 14:18:41 +00:00
|
|
|
|
_files->add(new TLocalisamfile(LF_MAG));
|
|
|
|
|
_files->add(new TLocalisamfile(LF_STOMAG));
|
1997-06-12 14:55:12 +00:00
|
|
|
|
_files->add(new TLocalisamfile(LF_MOVMAG));
|
|
|
|
|
_files->add(new TLocalisamfile(LF_RMOVMAG));
|
1998-04-30 14:59:47 +00:00
|
|
|
|
return TSkeleton_application::create();
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-04-30 14:59:47 +00:00
|
|
|
|
bool TStampa_inventario::destroy()
|
1997-06-04 14:18:41 +00:00
|
|
|
|
{
|
1997-07-07 11:08:59 +00:00
|
|
|
|
delete _mask;
|
|
|
|
|
delete _files;
|
1997-06-04 14:18:41 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-02 13:40:49 +00:00
|
|
|
|
bool TStampa_inventario::crea_tempmag(const bool b)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
const bool valcomp = *_mask->get(F_FIN_COMP)=='C';
|
|
|
|
|
|
|
|
|
|
TIsamtempfile* temp_mag = new TIsamtempfile(LF_MAG, "tmpmag", TRUE, b);
|
|
|
|
|
|
|
|
|
|
TRectype darec(LF_ANAMAG), arec(LF_ANAMAG);
|
|
|
|
|
darec.put(ANAMAG_CODART, _mask->get(F_DAART));
|
|
|
|
|
arec.put(ANAMAG_CODART, _mask->get(F_AART));
|
|
|
|
|
|
|
|
|
|
TRelation ana_rel(LF_ANAMAG);
|
|
|
|
|
TCursor ana_cur(&ana_rel, "", 1, &darec, &arec);
|
|
|
|
|
const TRecnotype items = ana_cur.items();
|
|
|
|
|
ana_cur.freeze();
|
|
|
|
|
|
|
|
|
|
const TDate data_limite(_mask->get_date(F_DATALIM));
|
|
|
|
|
TArticolo_giacenza art_giac;
|
|
|
|
|
TString16 annoes(_mask->get(F_ANNOES));
|
|
|
|
|
|
|
|
|
|
TString msg;
|
|
|
|
|
msg << "Creazione giacenze temporanee anno " << annoes;
|
|
|
|
|
|
|
|
|
|
TProgind pi(items, msg, FALSE, TRUE);
|
|
|
|
|
|
|
|
|
|
for (ana_cur = 0L; ana_cur.pos() < items; ++ana_cur)
|
|
|
|
|
{
|
|
|
|
|
art_giac.read(ana_cur.curr());
|
|
|
|
|
|
|
|
|
|
// Scrive i records sul file temporaneo
|
|
|
|
|
TRecord_array& mag = art_giac.mag(annoes);
|
|
|
|
|
for (int i = mag.last_row(); i > 0 && temp_mag->good(); i = mag.pred_row(i))
|
|
|
|
|
{
|
|
|
|
|
TRectype & magrec = (TRectype &) mag.row(i);
|
|
|
|
|
|
|
|
|
|
real v=art_giac.giacenza_corretta(magrec, TRUE, valcomp);
|
|
|
|
|
magrec.put(MAG_GIAC, v);
|
|
|
|
|
temp_mag->write(magrec);
|
|
|
|
|
}
|
|
|
|
|
pi.addstatus(1L);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Se il file <20> ok lo sostituisce all'interno della relazione del form
|
|
|
|
|
const bool rt = temp_mag->good();
|
|
|
|
|
if (!rt)
|
|
|
|
|
{
|
|
|
|
|
error_box("Errore %d in creazione file temporaneo per saldi di magazzino alla data indicata.", temp_mag->status());
|
|
|
|
|
delete temp_mag;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (b) // Non sostituire in caso di stampa tutti gli articoli
|
|
|
|
|
_form->relation()->replace(temp_mag);
|
|
|
|
|
else
|
|
|
|
|
delete temp_mag; // in caso di stampa tutti gli articoli, non cancella fisicamente il file; per riaprirlo poi
|
|
|
|
|
|
|
|
|
|
return rt;
|
|
|
|
|
}
|
|
|
|
|
|
1999-06-18 15:35:05 +00:00
|
|
|
|
bool TStampa_inventario::calcola_giacenze(const bool b)
|
1999-05-24 13:34:11 +00:00
|
|
|
|
{
|
2001-05-02 13:40:49 +00:00
|
|
|
|
const bool giaceff = *_mask->get(F_REALE_GIAC)=='R';
|
|
|
|
|
const bool valcomp = *_mask->get(F_FIN_COMP)=='C';
|
|
|
|
|
|
1999-05-24 13:34:11 +00:00
|
|
|
|
//Scorre l'anagrafica di magazzino e calcola per ognuno la giacenza alla data indicata
|
|
|
|
|
//Memorizzando i records in un file temporaneo che avr<76> lo stesso tracciato di LF_MAG
|
1999-06-18 15:35:05 +00:00
|
|
|
|
TIsamtempfile* temp_mag = new TIsamtempfile(LF_MAG, "tmpmag", TRUE, b);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
|
|
|
|
|
TRectype darec(LF_ANAMAG), arec(LF_ANAMAG);
|
|
|
|
|
darec.put(ANAMAG_CODART, _mask->get(F_DAART));
|
|
|
|
|
arec.put(ANAMAG_CODART, _mask->get(F_AART));
|
|
|
|
|
|
1999-05-24 13:34:11 +00:00
|
|
|
|
TRelation ana_rel(LF_ANAMAG);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
TCursor ana_cur(&ana_rel, "", 1, &darec, &arec);
|
|
|
|
|
const TRecnotype items = ana_cur.items();
|
|
|
|
|
ana_cur.freeze();
|
1999-05-24 13:34:11 +00:00
|
|
|
|
|
|
|
|
|
const TDate data_limite(_mask->get_date(F_DATALIM));
|
|
|
|
|
TArticolo_giacenza_data art_giac;
|
|
|
|
|
const TEsercizi_contabili esc;
|
|
|
|
|
const int anno = esc.date2esc(data_limite);
|
2003-05-05 14:32:23 +00:00
|
|
|
|
TString16 annoes; annoes.format("%04d", anno);
|
1999-05-24 13:34:11 +00:00
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
TString msg;
|
|
|
|
|
msg << "Elaborazione saldi al " << data_limite << " ...";
|
|
|
|
|
|
|
|
|
|
TProgind pi(items, msg, FALSE, TRUE);
|
1999-05-24 13:34:11 +00:00
|
|
|
|
|
|
|
|
|
for (ana_cur = 0L; ana_cur.pos() < items; ++ana_cur)
|
|
|
|
|
{
|
|
|
|
|
art_giac.read(ana_cur.curr());
|
|
|
|
|
art_giac.al(data_limite); // Calcola la giacenza alla data per questo articolo
|
|
|
|
|
|
|
|
|
|
// Scrive i records sul file temporaneo
|
|
|
|
|
TRecord_array& mag = art_giac.mag(annoes);
|
|
|
|
|
for (int i = mag.last_row(); i > 0 && temp_mag->good(); i = mag.pred_row(i))
|
2001-05-02 13:40:49 +00:00
|
|
|
|
{
|
|
|
|
|
TRectype & magrec = (TRectype &) mag.row(i);
|
|
|
|
|
|
|
|
|
|
if (giaceff)
|
|
|
|
|
{
|
|
|
|
|
real v=art_giac.giacenza_corretta(magrec, TRUE,valcomp);
|
|
|
|
|
magrec.put(MAG_GIAC, v);
|
|
|
|
|
}
|
|
|
|
|
temp_mag->write(magrec);
|
|
|
|
|
}
|
1999-05-24 13:34:11 +00:00
|
|
|
|
pi.addstatus(1L);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Se il file <20> ok lo sostituisce all'interno della relazione del form
|
|
|
|
|
const bool rt = temp_mag->good();
|
1999-06-18 15:35:05 +00:00
|
|
|
|
if (!rt)
|
1999-05-24 13:34:11 +00:00
|
|
|
|
{
|
|
|
|
|
error_box("Errore %d in creazione file temporaneo per saldi di magazzino alla data indicata.", temp_mag->status());
|
|
|
|
|
delete temp_mag;
|
|
|
|
|
}
|
1999-06-18 15:35:05 +00:00
|
|
|
|
else
|
|
|
|
|
if (b) // Non sostituire in caso di stampa tutti gli articoli
|
|
|
|
|
_form->relation()->replace(temp_mag);
|
|
|
|
|
else
|
|
|
|
|
delete temp_mag; // in caso di stampa tutti gli articoli, non cancella fisicamente il file; per riaprirlo poi
|
1999-05-24 13:34:11 +00:00
|
|
|
|
|
|
|
|
|
return rt;
|
|
|
|
|
}
|
|
|
|
|
|
1997-06-04 14:18:41 +00:00
|
|
|
|
void TStampa_inventario::setprint_permagazzini()
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const char subordine=*_mask->get(F_ORDINEMAG);
|
|
|
|
|
const bool totdep = _mask->get_bool(F_TOTALIDEPOSITI);
|
1997-06-04 14:18:41 +00:00
|
|
|
|
TRectype darec(LF_MAG),arec(LF_MAG);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TString cfilter, espr1, espr2;
|
1997-06-04 14:18:41 +00:00
|
|
|
|
_cur = _form->cursor();
|
2001-05-02 13:40:49 +00:00
|
|
|
|
// setta il filtro sul cursore
|
1998-06-10 16:38:58 +00:00
|
|
|
|
if (*_mask->get(F_FILTRO)=='N')
|
2000-05-05 15:25:49 +00:00
|
|
|
|
cfilter << "(STR(GIAC!=\"0\"))&&" ;
|
1997-10-15 14:51:09 +00:00
|
|
|
|
if (*_mask->get(F_FILTRO)=='+')
|
2000-05-05 15:25:49 +00:00
|
|
|
|
cfilter << "(STR(GIAC>\"0\"))&&" ;
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (*_mask->get(F_DAART))
|
|
|
|
|
cfilter << "(CODART>=" <<'"' << _mask->get(F_DAART)<< "\")&&" ;
|
|
|
|
|
if (*_mask->get(F_AART))
|
2000-05-05 15:25:49 +00:00
|
|
|
|
cfilter << "(CODART<=" << '"' << _mask->get(F_AART)<< "\")&&" ;
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (cfilter.not_empty())
|
|
|
|
|
cfilter.cut(cfilter.len()-2);
|
2001-05-02 13:40:49 +00:00
|
|
|
|
if (!totdep)
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_DEPOSITO").setcondition("CODMAG[1,3]",_strexpr);
|
|
|
|
|
else
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_DEPOSITO").setcondition("CODMAG[1,5]",_strexpr);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
switch (subordine)
|
|
|
|
|
{
|
|
|
|
|
case 'C':
|
|
|
|
|
_form->find_field('B',odd_page,"H_CATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_CATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
|
|
|
|
|
if (!totdep)
|
|
|
|
|
espr1 = "ANNOES|CODMAG[1,3]|CODART|LIVELLO|CODMAG[4,5]";
|
|
|
|
|
else
|
|
|
|
|
espr1 = "ANNOES|CODMAG|CODART|LIVELLO";
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition("CODART",_strexpr);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_form->set_ordering(mg_normale);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
break;
|
|
|
|
|
case 'S':
|
|
|
|
|
case 'M':
|
|
|
|
|
{
|
|
|
|
|
TString16 m1,m2;
|
1999-05-24 13:34:11 +00:00
|
|
|
|
m1 = _mask->get(F_DACATMER); if (m1.not_empty()) m1.left_just(3);
|
|
|
|
|
m2 = _mask->get(F_ACATMER); if (m2.not_empty()) m2.left_just(3);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_form->find_field('B',odd_page,"H_CATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_CATMER").show();
|
2001-06-25 10:41:20 +00:00
|
|
|
|
|
|
|
|
|
int index_grmerc = 3;
|
|
|
|
|
|
|
|
|
|
if (subordine == 'S')
|
|
|
|
|
index_grmerc = 5;
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (!totdep)
|
2001-06-25 10:41:20 +00:00
|
|
|
|
espr1.format("ANNOES|CODMAG[1,3]|%d->GRMERC[1,%d]|CODART|LIVELLO|CODMAG[4,5]", LF_ANAMAG, index_grmerc);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
else
|
2001-06-25 10:41:20 +00:00
|
|
|
|
espr1.format("ANNOES|CODMAG|%d->GRMERC[1,%d]|CODART|LIVELLO", LF_ANAMAG, index_grmerc);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_form->set_ordering(mg_cat_merc);
|
2001-06-25 10:41:20 +00:00
|
|
|
|
espr2.format("CODMAG[1,3]+CODMAG[1,5]+%d->GRMERC[1,3]", LF_ANAMAG);
|
|
|
|
|
// espr2.format("%d->GRMERC[1,3]", LF_ANAMAG);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_CATMER").setcondition(espr2,_strexpr);
|
2001-06-25 10:41:20 +00:00
|
|
|
|
|
|
|
|
|
TString16 fmerc;
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (subordine == 'S')
|
2001-06-25 10:41:20 +00:00
|
|
|
|
{
|
|
|
|
|
fmerc = "GRMERC";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").show();
|
2001-05-02 13:40:49 +00:00
|
|
|
|
m1 << _mask->get(F_DASCATMER);
|
|
|
|
|
m2 << _mask->get(F_ASCATMER);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2001-05-02 13:40:49 +00:00
|
|
|
|
{
|
2001-06-25 10:41:20 +00:00
|
|
|
|
fmerc = "GRMERC[1,3]";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
|
|
|
|
|
}
|
|
|
|
|
if (m1.not_empty())
|
|
|
|
|
{
|
2001-06-25 10:41:20 +00:00
|
|
|
|
espr2.format("&&(%d->%s >= \"%s\")", LF_ANAMAG, (const char *)fmerc, (const char*)m1);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
cfilter << espr2;
|
|
|
|
|
}
|
|
|
|
|
if (m2.not_empty())
|
|
|
|
|
{
|
2001-06-25 10:41:20 +00:00
|
|
|
|
espr2.format("&&(%d->%s <= \"%s\")", LF_ANAMAG, (const char *)fmerc, (const char*)m2);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
cfilter << espr2;
|
|
|
|
|
}
|
2001-06-25 10:41:20 +00:00
|
|
|
|
espr2.format("CODMAG[1,3]+CODMAG[1,5]+%d->GRMERC", LF_ANAMAG);
|
|
|
|
|
// espr2.format("%d->%s", LF_ANAMAG, (const char *)fmerc);
|
2001-05-02 13:40:49 +00:00
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition(espr2,_strexpr);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'R':
|
|
|
|
|
_form->find_field('B',odd_page,"H_CATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_CATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
|
|
|
|
|
if (!totdep)
|
|
|
|
|
espr1.format("ANNOES|CODMAG[1,3]|%d->RAGGFIS|CODART|LIVELLO|CODMAG[4,5]",LF_ANAMAG);
|
|
|
|
|
else
|
|
|
|
|
espr1.format("ANNOES|CODMAG|%d->RAGGFIS|CODART|LIVELLO|CODMAG[4,5]",LF_ANAMAG);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_form->set_ordering(mg_ragg_fisc);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
espr2.format("CODMAG[1,3]+CODMAG[1,5]+%d->RAGGFIS", LF_ANAMAG);
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_CATMER").setcondition(espr2,_strexpr);
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition(espr2,_strexpr);
|
|
|
|
|
|
|
|
|
|
if (_mask->get(F_DARAGFIS).not_empty())
|
|
|
|
|
{
|
|
|
|
|
espr2.format("&&(%d->RAGGFIS>=\"%s\")", LF_ANAMAG, (const char*) _mask->get(F_DARAGFIS));
|
|
|
|
|
cfilter << espr2;
|
|
|
|
|
}
|
|
|
|
|
if (_mask->get(F_ARAGFIS).not_empty())
|
|
|
|
|
{
|
|
|
|
|
espr2.format("&&(%d->RAGGFIS<=\"%s\")", LF_ANAMAG, (const char*) _mask->get(F_ARAGFIS));
|
|
|
|
|
cfilter << espr2;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
1998-06-10 16:38:58 +00:00
|
|
|
|
//_mask->set_livellicodice();
|
1997-07-07 11:08:59 +00:00
|
|
|
|
// abilita/disabilita le sezioni dei totali
|
1998-06-10 16:38:58 +00:00
|
|
|
|
_form->setdett_permag(
|
|
|
|
|
_mask->get_bool(F_RAGGCODICE),_mask->get_int(F_FROMLIVELLOART),_mask->get_int(F_TOLIVELLOART),
|
|
|
|
|
_mask->get_bool(F_RAGGLIVGIAC),_mask->get_int(F_FROMLIVELLOGIAC),_mask->get_int(F_TOLIVELLOGIAC),
|
1998-08-25 18:07:30 +00:00
|
|
|
|
TRUE,_mask->get_bool(F_TOTALIDEPOSITI),_mask->get_bool(F_DETTAGLIODEP));
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
((TSorted_cursor *)_cur)->change_order(espr1);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
|
|
|
|
|
darec.put("ANNOES",_mask->get(F_ANNOES));
|
|
|
|
|
darec.put("CODMAG",_mask->get(F_DAMAG));
|
|
|
|
|
arec.put("ANNOES",_mask->get(F_ANNOES));
|
|
|
|
|
arec.put("CODMAG",_mask->get(F_AMAG));
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_cur->setfilter(cfilter, TRUE);
|
2001-05-02 13:40:49 +00:00
|
|
|
|
_cur->setregion(darec,arec);
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ORDINAMENTO
|
|
|
|
|
void TStampa_inventario::setprint_perarticoli()
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
2003-06-12 13:49:45 +00:00
|
|
|
|
char subordine=_mask->get(F_ORDINEART)[0];
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TRectype darec(LF_MAG),arec(LF_MAG);
|
|
|
|
|
TString cfilter, espr1, espr2;
|
|
|
|
|
_cur = _form->cursor();
|
|
|
|
|
// setta il filtro sul cursore
|
2003-06-12 13:49:45 +00:00
|
|
|
|
if (_mask->get(F_FILTRO)[0]=='N')
|
2000-05-05 15:25:49 +00:00
|
|
|
|
cfilter << "(STR(GIAC!=\"0\"))&&" ;
|
2003-06-12 13:49:45 +00:00
|
|
|
|
if (_mask->get(F_FILTRO)[0]=='+')
|
2000-05-05 15:25:49 +00:00
|
|
|
|
cfilter << "(STR(GIAC>\"0\"))&&" ;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (cfilter.not_empty())
|
2000-05-05 15:25:49 +00:00
|
|
|
|
cfilter.rtrim(2);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
|
|
switch (subordine)
|
|
|
|
|
{
|
|
|
|
|
case 'C':
|
|
|
|
|
case 'D':
|
|
|
|
|
_form->find_field('B',odd_page,"H_CATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_CATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if (subordine == 'C')
|
|
|
|
|
espr1 = "ANNOES|CODART|LIVELLO|CODMAG";
|
|
|
|
|
else
|
|
|
|
|
espr1.format("ANNOES|UPPER(%d->DESCR)|LIVELLO|CODMAG", LF_ANAMAG);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition("CODART",_strexpr);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_form->set_ordering(mg_normale);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
break;
|
|
|
|
|
case 'S':
|
|
|
|
|
case 'M':
|
|
|
|
|
{
|
|
|
|
|
TString16 m1,m2;
|
2000-05-05 15:25:49 +00:00
|
|
|
|
m1 = _mask->get(F_DACATMER);
|
|
|
|
|
m2 = _mask->get(F_ACATMER);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_form->find_field('B',odd_page,"H_CATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_CATMER").show();
|
2001-06-25 10:41:20 +00:00
|
|
|
|
if (subordine == 'S')
|
|
|
|
|
espr1.format("ANNOES|%d->GRMERC|CODART|LIVELLO|CODMAG", LF_ANAMAG);
|
|
|
|
|
else
|
|
|
|
|
espr1.format("ANNOES|%d->GRMERC[1,3]|CODART|LIVELLO|CODMAG", LF_ANAMAG);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_form->set_ordering(mg_cat_merc);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
espr2.format("%d->GRMERC[1,3]", LF_ANAMAG);
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_CATMER").setcondition(espr2,_strexpr);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (subordine == 'S')
|
|
|
|
|
{
|
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").show();
|
2000-05-05 15:25:49 +00:00
|
|
|
|
m1.left_just(3) << _mask->get(F_DASCATMER);
|
|
|
|
|
m2.left_just(3) << _mask->get(F_ASCATMER);
|
|
|
|
|
if (!m1.blank())
|
|
|
|
|
{
|
|
|
|
|
espr2.format("&&(%d->GRMERC>=\"%s\")", LF_ANAMAG, (const char*)m1);
|
|
|
|
|
cfilter << espr2;
|
|
|
|
|
}
|
|
|
|
|
if (!m2.blank())
|
|
|
|
|
{
|
|
|
|
|
espr2.format("&&(%d->GRMERC<=\"%s\")", LF_ANAMAG, (const char*)m2);
|
|
|
|
|
cfilter << espr2;
|
|
|
|
|
}
|
2001-05-02 13:40:49 +00:00
|
|
|
|
espr2.format("%d->GRMERC", LF_ANAMAG);
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition(espr2,_strexpr);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if (!m1.blank())
|
|
|
|
|
{
|
|
|
|
|
espr2.format("&&(TRIM(%d->GRMERC[1,3])>=\"%s\")", LF_ANAMAG, (const char*)m1);
|
|
|
|
|
cfilter << espr2;
|
|
|
|
|
}
|
|
|
|
|
if (!m2.blank())
|
|
|
|
|
{
|
|
|
|
|
espr2.format("&&(TRIM(%d->GRMERC[1,3])<=\"%s\")", LF_ANAMAG, (const char*)m2);
|
|
|
|
|
cfilter << espr2;
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'R':
|
|
|
|
|
_form->find_field('B',odd_page,"H_CATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_CATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
|
|
|
|
|
espr1.format("ANNOES|%d->RAGGFIS|CODART|LIVELLO|CODMAG",LF_ANAMAG);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_form->set_ordering(mg_ragg_fisc);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
espr2.format("%d->RAGGFIS", LF_ANAMAG);
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_CATMER").setcondition(espr2,_strexpr);
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition(espr2,_strexpr);
|
|
|
|
|
|
|
|
|
|
if (_mask->get(F_DARAGFIS).not_empty())
|
|
|
|
|
{
|
|
|
|
|
espr2.format("&&(%d->RAGGFIS>=\"%s\")", LF_ANAMAG, (const char*) _mask->get(F_DARAGFIS));
|
|
|
|
|
cfilter << espr2;
|
|
|
|
|
}
|
|
|
|
|
if (_mask->get(F_ARAGFIS).not_empty())
|
|
|
|
|
{
|
|
|
|
|
espr2.format("&&(%d->RAGGFIS<=\"%s\")", LF_ANAMAG, (const char*) _mask->get(F_ARAGFIS));
|
|
|
|
|
cfilter << espr2;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
|
|
|
|
_form->setdett_perart(
|
|
|
|
|
_mask->get_bool(F_RAGGCODICE),_mask->get_int(F_FROMLIVELLOART),_mask->get_int(F_TOLIVELLOART),
|
|
|
|
|
_mask->get_bool(F_RAGGLIVGIAC),_mask->get_int(F_FROMLIVELLOGIAC),_mask->get_int(F_TOLIVELLOGIAC),
|
|
|
|
|
_mask->get_bool(F_TOTALIMAGAZZINI),_mask->get_bool(F_DETTAGLIOMAG));
|
|
|
|
|
|
|
|
|
|
((TSorted_cursor *)_cur)->change_order(espr1);
|
|
|
|
|
|
|
|
|
|
darec.put("ANNOES",_mask->get(F_ANNOES));
|
|
|
|
|
darec.put("CODMAG",_mask->get(F_DAMAG));
|
2000-05-05 15:25:49 +00:00
|
|
|
|
|
|
|
|
|
if (subordine == 'D')
|
|
|
|
|
{
|
|
|
|
|
if (_mask->get(F_DADES).not_empty())
|
|
|
|
|
cfilter << "&&(UPPER(47->DESCR)>=\"" << _mask->get(F_DADES) << "\")";
|
|
|
|
|
if (_mask->get(F_ADES).not_empty())
|
|
|
|
|
cfilter << "&&(UPPER(47->DESCR)<=\"" << _mask->get(F_ADES) << "\")";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (*_mask->get(F_DAART))
|
|
|
|
|
cfilter << "&&(CODART>=\"" << _mask->get(F_DAART) << "\")";
|
|
|
|
|
if (*_mask->get(F_AART))
|
|
|
|
|
cfilter << "&&(CODART<=\"" << _mask->get(F_AART) << "\")";
|
|
|
|
|
}
|
2001-05-02 13:40:49 +00:00
|
|
|
|
arec.put("ANNOES",_mask->get(F_ANNOES));
|
|
|
|
|
arec.put("CODMAG", _mask->get(F_AMAG));
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_cur->setfilter(cfilter, subordine != 'C');
|
2001-05-02 13:40:49 +00:00
|
|
|
|
_cur->setregion(darec,arec);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TStampa_inventario::setprint_perarticoli_all()
|
1997-06-04 14:18:41 +00:00
|
|
|
|
{
|
|
|
|
|
TRectype darec(LF_ANAMAG),arec(LF_ANAMAG);
|
|
|
|
|
TString cfilter,filter,joinexp;
|
1997-07-07 11:08:59 +00:00
|
|
|
|
TString sortexp("ANNOES|CODART|LIVELLO|CODMAG");
|
1997-06-04 14:18:41 +00:00
|
|
|
|
|
|
|
|
|
char subordine=*_mask->get(F_ORDINEART);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
2001-05-02 13:40:49 +00:00
|
|
|
|
_cur = _form->cursor();
|
1998-06-10 16:38:58 +00:00
|
|
|
|
if (*_mask->get(F_FILTRO)=='N')
|
2000-05-05 15:25:49 +00:00
|
|
|
|
filter << "(STR(" << LF_MAG <<"->GIAC!=\"0\"))&&";
|
1997-10-15 14:51:09 +00:00
|
|
|
|
if (*_mask->get(F_FILTRO)=='+')
|
2000-05-05 15:25:49 +00:00
|
|
|
|
filter << "(STR(" << LF_MAG <<"->GIAC>\"0\"))&&" ;
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (*_mask->get(F_DAMAG))
|
|
|
|
|
filter << "(CODMAG[1,3]>=" <<'"' << _mask->get(F_DAMAG)<< "\")&&" ;
|
|
|
|
|
if (*_mask->get(F_AMAG))
|
|
|
|
|
filter << "(CODMAG[1,3]<=" <<'"' << _mask->get(F_AMAG)<< "\")&&" ;
|
2002-02-26 16:20:19 +00:00
|
|
|
|
|
1997-07-07 11:08:59 +00:00
|
|
|
|
if (filter.not_empty())
|
2002-02-26 16:20:19 +00:00
|
|
|
|
filter.rtrim(2);
|
1998-06-10 16:38:58 +00:00
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
//_mask->set_livellicodice();
|
1997-06-04 14:18:41 +00:00
|
|
|
|
switch (subordine)
|
|
|
|
|
{
|
1997-07-07 11:08:59 +00:00
|
|
|
|
case 'C':
|
|
|
|
|
_cur->setkey(1);
|
|
|
|
|
darec.put("CODART",_mask->get(F_DAART));
|
|
|
|
|
arec.put("CODART",_mask->get(F_AART));
|
|
|
|
|
_form->find_field('B',odd_page,"H_CATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_CATMER").hide();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition("CODART",_strexpr);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_form->set_ordering(mg_normale);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
break;
|
|
|
|
|
case 'D':
|
|
|
|
|
_cur->setkey(2);
|
|
|
|
|
darec.put("DESCR",_mask->get(F_DADES));
|
|
|
|
|
arec.put("DESCR",_mask->get(F_ADES));
|
|
|
|
|
_form->find_field('B',odd_page,"H_CATMER").disable();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_CATMER").hide();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition("CODART",_strexpr);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_form->set_ordering(mg_normale);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
break;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
case 'S':
|
1997-07-07 11:08:59 +00:00
|
|
|
|
case 'M':
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
TString16 m1,m2;
|
|
|
|
|
m1 = _mask->get(F_DACATMER);
|
|
|
|
|
m2 = _mask->get(F_ACATMER);
|
|
|
|
|
if (subordine == 'S')
|
|
|
|
|
{
|
2001-05-02 13:40:49 +00:00
|
|
|
|
m1.left_just(3) << _mask->get(F_DASCATMER);
|
|
|
|
|
m2.left_just(3) << _mask->get(F_ASCATMER);
|
|
|
|
|
// m1.trim();
|
|
|
|
|
// m2.trim();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
// Siccome GRMERC e' il primo campo della chiave, se e' settato l'articolo di fine intervallo
|
|
|
|
|
// ed esso non e' vuoto, mentre la categoria merc. lo e'... la setregion() del cursore non ha effetti,
|
|
|
|
|
// Quindi se non viene indicata alcuna categoria merc. di fine interv, va preimpostata
|
|
|
|
|
// Alla ultima stringa possibile
|
|
|
|
|
if (m2.empty() && _mask->get(F_AART).not_empty())
|
|
|
|
|
m2.fill('\254',subordine == 'S' ? 5 : 3);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
_cur->setkey(3);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
darec.put("GRMERC", m1);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
darec.put("CODART",_mask->get(F_DAART));
|
1999-04-06 15:34:39 +00:00
|
|
|
|
arec.put("GRMERC", m2);
|
2001-05-02 13:40:49 +00:00
|
|
|
|
const TString80 aart(_mask->get(F_AART));
|
|
|
|
|
if (aart.not_empty())
|
|
|
|
|
arec.put("CODART", aart);
|
1997-07-07 11:08:59 +00:00
|
|
|
|
_form->find_field('B',odd_page,"H_CATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_CATMER").show();
|
2001-05-02 13:40:49 +00:00
|
|
|
|
_form->set_ordering(mg_cat_merc);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (subordine == 'S')
|
|
|
|
|
{
|
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").show();
|
2001-05-02 13:40:49 +00:00
|
|
|
|
TString16 espr ; espr.format("%d->GRMERC", LF_ANAMAG);
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition(espr,_strexpr);
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition("CODART",_strexpr);
|
2001-06-25 10:41:20 +00:00
|
|
|
|
sortexp.format("ANNOES|%d->GRMERC[1,3]|CODART|LIVELLO|CODMAG", LF_ANAMAG);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'R':
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_form->set_ordering(mg_ragg_fisc);// Setta la subsection in modo da raggruppare per RAGGFIS
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_form->use_alternate_cursor();
|
|
|
|
|
_cur = _form->cursor(); // Setta il cursore sortato per questo ordinamento... siccome non esiste una chiave RAGGFIS+CODART
|
|
|
|
|
_cur->setkey(1);
|
|
|
|
|
darec.put("CODART",_mask->get(F_DAART));
|
|
|
|
|
arec.put("CODART",_mask->get(F_AART));
|
|
|
|
|
_form->find_field('B',odd_page,"H_CATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_CATMER").show();
|
|
|
|
|
_form->find_field('B',odd_page,"H_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"TOT_SCATMER").hide();
|
|
|
|
|
_form->find_field('B',odd_page,"GRUPPI_SCATMER").setcondition("RAGGFIS",_strexpr);
|
|
|
|
|
|
|
|
|
|
if (_mask->get(F_DARAGFIS).not_empty())
|
|
|
|
|
cfilter.format("(RAGGFIS>=\"%s\")",(const char*)_mask->get(F_DARAGFIS));
|
|
|
|
|
if (cfilter.not_empty() && _mask->get(F_ARAGFIS).not_empty())
|
|
|
|
|
{
|
|
|
|
|
cfilter << "&&(RAGGFIS<=\"";
|
|
|
|
|
cfilter << _mask->get(F_ARAGFIS);
|
|
|
|
|
cfilter << "\")&&";
|
|
|
|
|
}
|
2002-02-26 16:20:19 +00:00
|
|
|
|
if (cfilter.not_empty())
|
|
|
|
|
cfilter.rtrim(2);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
_cur->setfilter(cfilter);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
_cur->setregion(darec, arec,0x2);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1997-07-07 11:08:59 +00:00
|
|
|
|
break;
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
1997-07-07 11:08:59 +00:00
|
|
|
|
_form->setdett_perart(
|
1998-06-10 16:38:58 +00:00
|
|
|
|
_mask->get_bool(F_RAGGCODICE),_mask->get_int(F_FROMLIVELLOART),_mask->get_int(F_TOLIVELLOART),
|
|
|
|
|
_mask->get_bool(F_RAGGLIVGIAC),_mask->get_int(F_FROMLIVELLOGIAC),_mask->get_int(F_TOLIVELLOGIAC),
|
1998-08-25 18:07:30 +00:00
|
|
|
|
_mask->get_bool(F_TOTALIMAGAZZINI),_mask->get_bool(F_DETTAGLIOMAG));
|
1997-06-04 14:18:41 +00:00
|
|
|
|
|
|
|
|
|
|
2003-05-05 14:32:23 +00:00
|
|
|
|
joinexp << "ANNOES==\"" << _mask->get(F_ANNOES) << "\"|CODART==CODART";
|
|
|
|
|
|
1997-06-04 14:18:41 +00:00
|
|
|
|
|
1997-07-07 11:08:59 +00:00
|
|
|
|
TSortedfile *mag;
|
1999-06-18 15:35:05 +00:00
|
|
|
|
TRelation *rel = NULL;
|
|
|
|
|
|
2001-05-02 13:40:49 +00:00
|
|
|
|
if (_mask->get_bool(F_ALLADATA) || *_mask->get(F_REALE_GIAC)=='R')
|
1999-06-18 15:35:05 +00:00
|
|
|
|
{
|
|
|
|
|
TIsamtempfile* temp_mag = new TIsamtempfile(LF_MAG, "tmpmag", FALSE, TRUE); // Non crearlo, auto cancella il file
|
|
|
|
|
rel = new TRelation(temp_mag);
|
|
|
|
|
}
|
2001-06-25 10:41:20 +00:00
|
|
|
|
else
|
|
|
|
|
rel = new TRelation(LF_MAG);
|
|
|
|
|
if (subordine == 'M')
|
|
|
|
|
rel->add(LF_ANAMAG, "CODART==CODART");
|
1999-06-18 15:35:05 +00:00
|
|
|
|
|
1998-06-10 16:38:58 +00:00
|
|
|
|
// !?!?!! ATTENZIONE : Modifica temporanea
|
1999-06-18 15:35:05 +00:00
|
|
|
|
mag= new TSortedfile(LF_MAG,rel,sortexp,"",1);
|
1998-06-10 16:38:58 +00:00
|
|
|
|
// il filtro viene qui settato DOPO la creazione del Sortedfile a causa di una bug
|
|
|
|
|
// sulla libreria nei TSorted_file / TCursor
|
2001-06-25 10:41:20 +00:00
|
|
|
|
mag->cursor().setfilter(filter, subordine == 'M');
|
1998-06-10 16:38:58 +00:00
|
|
|
|
// FINE MODIFICA ; rimettere il filtro nel costruttore quando il bug sar<61> risolto
|
|
|
|
|
|
1997-07-07 11:08:59 +00:00
|
|
|
|
_cur->relation()->replace(mag,1,joinexp);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
_cur->setregion(darec,arec,0x2);
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1998-04-30 14:59:47 +00:00
|
|
|
|
void TStampa_inventario::main_loop()
|
1997-06-04 14:18:41 +00:00
|
|
|
|
{
|
1998-04-30 14:59:47 +00:00
|
|
|
|
while (_mask->run() == K_ENTER)
|
|
|
|
|
{
|
|
|
|
|
if (_mask->magazz_ini().gestmag(TRUE))
|
1997-07-07 11:08:59 +00:00
|
|
|
|
{
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if (_mask->get(F_DAMAG).blank() && _mask->get(F_AMAG).blank())
|
|
|
|
|
{
|
|
|
|
|
bool empty = FALSE;
|
|
|
|
|
if (_mask->get(F_ORDINEART) == "D")
|
|
|
|
|
empty = _mask->get(F_DADES).blank() && _mask->get(F_ADES).blank();
|
|
|
|
|
else
|
|
|
|
|
empty = _mask->get(F_DAART).blank() && _mask->get(F_AART).blank();
|
|
|
|
|
if (empty && !yesno_box("Sono stati selezionati tutti gli articoli. Confermare la stampa?"))
|
1999-04-06 15:34:39 +00:00
|
|
|
|
continue;
|
2000-05-05 15:25:49 +00:00
|
|
|
|
}
|
1999-05-24 13:34:11 +00:00
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
const bool b = _mask->get_bool(F_ALLADATA);
|
2001-05-02 13:40:49 +00:00
|
|
|
|
const bool r = *_mask->get(F_REALE_GIAC)=='R';
|
|
|
|
|
|
2003-06-12 13:49:45 +00:00
|
|
|
|
if (_mask->get(F_ORDINE)[0]=='A')
|
2000-05-05 15:25:49 +00:00
|
|
|
|
{
|
2003-06-12 13:49:45 +00:00
|
|
|
|
if (_mask->get(F_FILTRO)[0]=='T') // tutti gli articoli
|
1998-06-10 16:38:58 +00:00
|
|
|
|
{
|
2000-05-05 15:25:49 +00:00
|
|
|
|
_form = new TForm_inventario("mg4200aa", "");
|
|
|
|
|
if (b && !calcola_giacenze(FALSE))
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
2000-05-05 15:25:49 +00:00
|
|
|
|
delete _form;
|
|
|
|
|
continue;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
2001-05-02 13:40:49 +00:00
|
|
|
|
else
|
|
|
|
|
if (!b && r && !crea_tempmag(FALSE))
|
|
|
|
|
{
|
|
|
|
|
delete _form;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
setprint_perarticoli_all();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_form = new TForm_inventario("mg4200a", "");
|
1999-05-24 13:34:11 +00:00
|
|
|
|
if (b && !calcola_giacenze())
|
1999-06-18 15:35:05 +00:00
|
|
|
|
{
|
|
|
|
|
delete _form;
|
1999-05-24 13:34:11 +00:00
|
|
|
|
continue;
|
1999-06-18 15:35:05 +00:00
|
|
|
|
}
|
2001-05-02 13:40:49 +00:00
|
|
|
|
else
|
|
|
|
|
if (!b && r && !crea_tempmag())
|
|
|
|
|
{
|
|
|
|
|
delete _form;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
setprint_perarticoli();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_form = new TForm_inventario("mg4200b", "");
|
|
|
|
|
if (b && !calcola_giacenze())
|
|
|
|
|
{
|
|
|
|
|
delete _form;
|
|
|
|
|
continue;
|
1998-06-10 16:38:58 +00:00
|
|
|
|
}
|
2001-05-02 13:40:49 +00:00
|
|
|
|
else
|
|
|
|
|
if (!b && r && !crea_tempmag())
|
|
|
|
|
{
|
|
|
|
|
delete _form;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
setprint_permagazzini();
|
|
|
|
|
}
|
|
|
|
|
_form->set_parametri(_mask->get(F_CATVENLISTINO),
|
2001-05-02 13:40:49 +00:00
|
|
|
|
_mask->get(F_CODLISTINO),
|
|
|
|
|
*_mask->get(F_REALE_GIAC)=='R',
|
|
|
|
|
*_mask->get(F_FIN_COMP)=='C', b,
|
|
|
|
|
_mask->get_int(F_ANNOES));
|
2000-05-05 15:25:49 +00:00
|
|
|
|
_form->add_colval(_mask->get_int(F_VAL1)-1);
|
|
|
|
|
_form->add_colval(_mask->get_int(F_VAL2)-1);
|
|
|
|
|
_form->add_colval(_mask->get_int(F_VAL3)-1);
|
|
|
|
|
_form->add_colval(_mask->get_int(F_VAL4)-1);
|
|
|
|
|
_form->add_colval(_mask->get_int(F_VAL5)-1);
|
|
|
|
|
_form->add_colval(_mask->get_int(F_VAL6)-1);
|
1998-06-10 16:38:58 +00:00
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
_form->genera_intestazioni(odd_page, 5);
|
|
|
|
|
_form->genera_intestazione_supplementare(odd_page, 4); // Nomi valorizzazioni applicate per colonna
|
2001-05-02 13:40:49 +00:00
|
|
|
|
|
|
|
|
|
set_def_valuta(*_form);
|
|
|
|
|
const TDate data_limite(_mask->get_date(F_DATALIM));
|
|
|
|
|
if (data_limite.ok())
|
|
|
|
|
{
|
|
|
|
|
TForm_item & f = _form->find_field('H',odd_page,4);
|
|
|
|
|
TString prompt = f.prompt();
|
2003-10-01 14:14:25 +00:00
|
|
|
|
prompt << "al " << data_limite.string() << " ";
|
2001-05-02 13:40:49 +00:00
|
|
|
|
f.set_prompt(prompt);
|
|
|
|
|
}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
_form->print();
|
|
|
|
|
delete _form;
|
1997-07-07 11:08:59 +00:00
|
|
|
|
}
|
|
|
|
|
} // while true
|
1998-04-30 14:59:47 +00:00
|
|
|
|
return ;
|
1997-06-04 14:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int mg4200(int argc, char* argv[])
|
|
|
|
|
{
|
1997-07-07 11:08:59 +00:00
|
|
|
|
TStampa_inventario a;
|
|
|
|
|
a.run(argc,argv,"Stampa inventario");
|
|
|
|
|
return 0;
|
2003-05-05 14:32:23 +00:00
|
|
|
|
}
|