Patch level : XX.312

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Riportata la versione 01.05 patch 312


git-svn-id: svn://10.65.10.50/trunk@8093 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1999-04-26 15:58:05 +00:00
parent 2afc3025a0
commit 7da1be4f90
95 changed files with 2571 additions and 1255 deletions

View File

@ -11,6 +11,8 @@
#define F_PERMESSI 151
#define F_PROPERTIES 152
#define G_SUPERUSER 33
#define F_BASE 200
#define F_74 201
#define F_75 202

View File

@ -617,7 +617,7 @@ bool TSet_user_passwd::user_create()
sheet_field().enable(superuser);
_msk->enable_page(1, superuser);
_msk->enable(F_GROUPNAME, superuser);
_msk->enable(-G_SUPERUSER, superuser);
return TRUE;
}
@ -659,13 +659,14 @@ void TSet_user_passwd::put_in_record(const TMask& m)
{
const TString16 s = encode(m.get(F_PASSWORD));
TRectype& r = get_relation()->curr();
r.put("PASSWORD", s);
if (_msk->get(F_USER) == user())
r.put("PASSWORD", s);
else
error_box("Impossibile cambiare la password di altri utenti");
}
void TSet_users::put_in_record(const TMask& m)
{
TSet_user_passwd::put_in_record(m) ;
TString autstr(ENDAUT, ' ');
TSheet_field& sf = sheet_field();
FOR_EACH_SHEET_ROW(sf, i, riga)
@ -676,7 +677,9 @@ void TSet_users::put_in_record(const TMask& m)
autstr[module] = c;
}
const TString16 s = encode(m.get(F_PASSWORD));
TRectype& r = get_relation()->curr();
r.put("PASSWORD", s);
r.put("AUTSTR", autstr);
TToken_string prop_field(256, '\n');
@ -764,40 +767,6 @@ void TSet_user_passwd::init_modify_mode(TMask& m)
_msk->disable(DLG_DELREC);
}
class TSet_user_password : public TSkeleton_application
{
protected:
virtual void main_loop();
public:
TSet_user_password () {}
};
void TSet_user_password::main_loop()
{
TMask msk("ba1400b");
TRelation rel(LF_USER);
TLocalisamfile &users=rel.lfile();
users.put("USERNAME",user());
users.read();
msk.autoload(rel);
TString16 pwd(users.get("PASSWORD"));
msk.set(F_PASSWORD, pwd);
msk.set(F_TEST, pwd);
int key=0;
while (key != K_QUIT)
{
key = msk.run() ;
if (key == K_SAVE)
{
users.put("PASSWORD",msk.get(F_PASSWORD));
users.rewrite();
}
}
}
int ba1400(int argc, char** argv)
{
if (user() == "PRASSI")
@ -806,7 +775,7 @@ int ba1400(int argc, char** argv)
a.run(argc, argv, "Configurazione utenti");
} else {
TSet_user_passwd a ;
a.run(argc, argv, "Modifica password");
a.run(argc, argv, "Configurazione utenti");
}
return 0;
}

View File

@ -14,6 +14,7 @@ BEGIN
ITEM "X|Gruppo"
MESSAGE HIDE,3@
FIELD ISGROUP
GROUP G_SUPERUSER
END
STRING F_USER 8
@ -42,12 +43,14 @@ BEGIN
OUTPUT F_GROUP USERNAME
CHECKTYPE NORMAL
FIELD GROUPNAME
GROUP G_SUPERUSER
END
STRING F_USERDESC 50
BEGIN
PROMPT 1 2 "Descrizione "
FIELD USERDESC
GROUP G_SUPERUSER
END
STRING F_PASSWORD 8
@ -72,6 +75,7 @@ BEGIN
ITEM "Modulo@40"
ITEM "Abilitato"
ITEM "Codice"
GROUP G_SUPERUSER
END
ENDPAGE

View File

@ -896,7 +896,7 @@ TMod_composition_msk::TMod_composition_msk(const bool modify_mode)
class TModule_mask : public TMask
{
bool _dirty_composition;
bool module_dependent(int row, TString_array &p_submodules, TString16 &sub_mod, TString16 &ver, int & patch) const ;
bool module_dependent(int row, TString_array &p_submodules, TString &sub_mod, TString &ver, int & patch) const ;
public:
bool list_is_dirty() {return _dirty_composition;}
@ -981,7 +981,7 @@ bool TCreadischi_mask::modules_notify(TSheet_field& f, int row, KEY k)
//TString16 &sub_mod, : il codice del (primo) sottomodulo da cui dipende
//TString16 &ver, : la propria versione
//int & patch : la propria patchlevel
bool TModule_mask::module_dependent(int rownum, TString_array &p_submodules, TString16 &sub_mod, TString16 &ver, int & patch) const
bool TModule_mask::module_dependent(int rownum, TString_array &p_submodules, TString &sub_mod, TString &ver, int & patch) const
{
TSheet_field& modsheet = get_sheet()->mask().sfield(F_SHEET);
TToken_string& curr_row=modsheet.row(rownum);

View File

@ -162,9 +162,9 @@ bool CG0100_application::protected_record(TRectype &rec)
{
TMask* m = get_mask(MODE_MOD);
TLocalisamfile& pconti = _rel->lfile();
const int gruppo = atoi(m->get(FLD_CM1_GRUPPO));
const int conto = atoi(m->get(FLD_CM1_CONTO));
const long sottoc = atol(m->get(FLD_CM1_SOTTOCONTO));
const int gruppo = m->get_int(FLD_CM1_GRUPPO);
const int conto = m->get_int(FLD_CM1_CONTO);
const long sottoc = m->get_long(FLD_CM1_SOTTOCONTO);
// Se e' un sottoconto posso cancellarlo se non esistono saldi
if ((gruppo != 0) && (conto != 0) && (sottoc != 0))

View File

@ -113,6 +113,7 @@ class TStampa_bilanci : public TPrintapp
bool _add_dare, _add_avere, _controlla, _salto_pagina, _flag, _stampato;
bool _sottoc_dare, _sottoc_avere, _salto_pagina1, _livello_conto;
bool _mov_ap,_quadratura;
bool _print_exercise;
int _stampa_mov_prov;
TArray _clienti, _fornitori;
@ -400,7 +401,7 @@ bool TStampa_bilanci::mask_datalim (TMask_field& f, KEY k)
f.error_box ("La data limite deve appartenere ad un esercizio attivo della ditta");
return FALSE;
}
f.mask().set(F_ANNO,anno);
//f.mask().set(F_ANNO,anno);
}
}
return TRUE;
@ -1521,6 +1522,11 @@ else
_prg_prec_dare = ZERO;
_prg_prec_avere = ZERO;
if (sld.sezsf() == 'A')
_mov_periodo_avere -= sld.saldofin();
else
_mov_periodo_dare += sld.saldofin();
saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere;
}
}
@ -1738,7 +1744,7 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
//calcolo i movimenti del periodo
if ( data_reg >= _datada && data_reg <= _dataa)
if ((causap == 'A' && _dataini != _datada) || (causap != 'A'))
if ((causap == 'A' && _dataini.ok() && _dataini != _datada) || (causap != 'A'))
{
conto_mov = TRUE;
if (sezione == 'D')
@ -1930,6 +1936,11 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin
_prg_prec_dare = ZERO;
_prg_prec_avere = ZERO;
if (sld.sezsf() == 'A')
_mov_periodo_avere -= sld.saldofin();
else
_mov_periodo_dare += sld.saldofin();
saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere;
if (saldo_finale == ZERO)
@ -2374,6 +2385,11 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf)
_mov_periodo_avere = sld.prgavere();
_prg_prec_dare = ZERO;
_prg_prec_avere = ZERO;
if (sld.sezsf() == 'A')
_mov_periodo_avere -= sld.saldofin();
else
_mov_periodo_dare += sld.saldofin();
saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere;
}
@ -3188,7 +3204,7 @@ void TStampa_bilanci::stampa_riga_totali(int r)
{
if (_stampa_width == 132)
{
set_row(r,"***@8gTOTALE GENERALE@46g!%r@64g%r@80g!%r@96g%r@114g!@115g%r",&_saldo_dare_tot,&_saldo_avere_tot,&_mov_dare_tot,
set_row(r,"***@8gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!@115g%r",&_saldo_dare_tot,&_saldo_avere_tot,&_mov_dare_tot,
&_mov_avere_tot,&_saldo_finale_tot);
if (_saldo_finale_tot != ZERO)
set_row(r,"@131g%c", app);
@ -3208,7 +3224,7 @@ void TStampa_bilanci::stampa_riga_totali(int r)
{
if (_stampa_width == 132)
{
set_row(r,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@96g%r@114g!@115g%r",&_saldo_dare_tot,&_saldo_avere_tot,
set_row(r,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!@115g%r",&_saldo_dare_tot,&_saldo_avere_tot,
&_mov_dare_tot,&_mov_avere_tot,&_saldo_finale_tot);
if (_saldo_finale_tot != ZERO)
set_row(r,"@131g%c", app);
@ -3218,8 +3234,8 @@ void TStampa_bilanci::stampa_riga_totali(int r)
{
//modifica del 21/11/1995
if (_tipo_stampa1 == 2)
set_row(r,"@1g****** ********@17gTOTALE CON SALDI INIZIALI@46g!@80g!%r@96g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
else set_row(r,"@1g****** ********@17gTOTALE CON MOVIM. DI APERTURA@46g!@80g!%r@96g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
set_row(r,"@1g****** ********@17gTOTALE CON SALDI INIZIALI@46g!@80g!%r@98g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
else set_row(r,"@1g****** ********@17gTOTALE CON MOVIM. DI APERTURA@46g!@80g!%r@98g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
//fine
}
}
@ -3688,11 +3704,18 @@ bool TStampa_bilanci::set_print(int)
if (_tipo_stampa == 1)
{
_datalim = m.get(F_DATALIM);
_print_exercise = TRUE;
if (_annoes == 0)
{
_print_exercise = FALSE;
_annoes = date2esc(_datalim);
}
if (_annoes != 0)
_dataini = InizioEsercizio(_annoes);
else
_dataini = _inizioEs;
_datalim = m.get(F_DATALIM);
//_stampa_mov_prov = (bool)(m.get(F_STAMPAMPROV) == "X");
}
bil_sez_contr();
@ -3860,6 +3883,7 @@ void TStampa_bilanci::preprocess_header()
//else set_header(r, "@41gall'ultima immissione Es. Precedente");
//modifica del 20/04/1995
if (_print_exercise)
{
TString d1(InizioEsercizio(_annoes).string());
TString d2(FineEsercizio(_annoes).string());

View File

@ -33,7 +33,7 @@ BEGIN
FLAGS "R"
END
NUMBER F_NUMREG 6
NUMBER F_NUMREG 7
BEGIN
PROMPT 3 6 "Numero operazione "
HELP "Numero del movimento di prima nota da gestire"
@ -41,7 +41,7 @@ BEGIN
FIELD LF_MOV->NUMREG
USE LF_MOV
INPUT NUMREG F_NUMREG
DISPLAY "Numero@6" NUMREG
DISPLAY "Numero@7" NUMREG
DISPLAY "Data@10" DATAREG
DISPLAY "Causale" CODCAUS
DISPLAY "Documento" NUMDOC

View File

@ -54,9 +54,9 @@ BEGIN
FLAGS "DG"
END
NUMBER F_NUMREG 6
NUMBER F_NUMREG 7
BEGIN
PROMPT 57 3 "Operazione n. "
PROMPT 56 3 "Operazione n. "
FIELD NUMREG
FLAGS "DGR"
KEY 1
@ -73,7 +73,7 @@ END
NUMBER F_ANNOIVA 4
BEGIN
PROMPT 32 3 "Anno IVA "
PROMPT 31 3 "Anno IVA "
FIELD ANNOIVA
FLAGS "D"
END
@ -88,7 +88,7 @@ END
NUMBER F_ANNOES 4
BEGIN
PROMPT 32 4 "Codice esercizio "
PROMPT 31 4 "Codice esercizio "
FIELD ANNOES
FLAGS "DGZ"
MESSAGE COPY,H_ANNOES
@ -96,7 +96,7 @@ END
STRING F_CODREG 3
BEGIN
PROMPT 57 4 "Registro IVA "
PROMPT 56 4 "Registro IVA "
FLAGS "DUZ"
FIELD REG
END
@ -571,7 +571,7 @@ BEGIN
PROMPT 1 0 "@BRighe movimento IVA"
END
NUMBER H_NUMREG 6
NUMBER H_NUMREG 7
BEGIN
PROMPT 2 1 "Operazione n. "
FLAGS "D"

View File

@ -17,9 +17,9 @@ BEGIN
FIELD LF_MOV->ANNOIVA
END
NUMBER F_NUMREG 6
NUMBER F_NUMREG 7
BEGIN
PROMPT 52 1 "Operazione n. "
PROMPT 51 1 "Operazione n. "
HELP "Numero del movimento di prima nota da gestire"
FIELD LF_MOV->NUMREG
CHECKTYPE REQUIRED

View File

@ -842,6 +842,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
{
static TImporto old_spesa;
static bool delete_l = FALSE;
static bool selecting = FALSE;
CHECKD(r >= 0, "Chi e' quel ca$$one che notifica la riga ", r);
@ -873,7 +874,16 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
old_spesa = row;
break;
case K_TAB:
cg.sheet_mask().enable(DLG_DELREC, tipo <= ' ' || tipo == 'K' || tipo == 'G');
if (!selecting)
{
cg.sheet_mask().enable(DLG_DELREC, tipo <= ' ' || tipo == 'K' || tipo == 'G');
if (row.empty_items())
{
selecting = TRUE;
cg.select(r); // Vado alla prima colonna delle righe vuote
selecting = FALSE;
}
}
break;
case K_DEL:
if (tipo == 'G')
@ -1230,6 +1240,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
{
static int oldpos,oldposiva;
static TImporto oldimp, oldiva;
static bool selecting = FALSE;
TPrimanota_application& a = app();
if (a._as400)
@ -1241,6 +1252,17 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
TToken_string& row = iva.row(r);
const TCausale& cau = a.causale();
if (k == K_TAB)
{
if (!selecting && row.empty_items())
{
selecting = TRUE;
iva.select(r); // Vado alla prima colonna delle righe vuote
selecting = FALSE;
}
return TRUE;
}
if (k == K_SPACE)
{
oldimp = a.real2imp(real(row.get(0)), 'I'); // Imponibile
@ -1583,8 +1605,11 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.to_check(key, TRUE))
{
TPrimanota_application& a = app();
TMask& m = f.mask();
TPrimanota_application& a = app();
if (a.autodeleting() == 0x3)
return TRUE; // Non effettuare controlli inutili in cancellazione
a._skip_giornale_check = FALSE;
a._skip_bollato_check = FALSE;

View File

@ -245,6 +245,7 @@ protected:
void set_totale_pagamento(bool update);
void reset_pagamento();
void set_scadenze(TMask& m);
void set_banche(TMask& m);
bool read_scadenze(TMask& m);
void write_scadenze(const TMask& m);
void remove_scadenze(const TMask& m, const char* rif);

View File

@ -445,12 +445,12 @@ bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key)
if (key == K_TAB && f.to_check(key, TRUE))
{
TMask& m = f.mask();
const TString val = f.get();
const TString16 val = f.get();
const bool full = val.not_empty();
if (full)
{
TMask_field& dc = m.field(SK_DATACAMBIO);
TEdit_field& dc = m.efield(SK_DATACAMBIO);
if (dc.get().empty()) // Inizializza data cambio se assente
dc.set(m.get(F_DATADOC));
if (f.focusdirty())
@ -458,6 +458,25 @@ bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key)
dc.set_dirty();
dc.check(RUNNING_CHECK); // Forza ricerca cambio
dc.on_hit(); // Forza messaggi (eventuale copia a pag. 3)
if (m.get(SK_CAMBIO).empty())
{
TCursor& cur = *dc.browse()->cursor();
if (cur.items() == 0) // Uso cambio standard
{
TCurrency std(1.0, val); // Converto un Marco ...
std.change_to_firm_val(); // ... in lire
dc.set("31-12-1998"); // Data di passaggio all'Euro
m.enable(SK_CAMBIO);
m.set(SK_CAMBIO, std.get_num(), TRUE);
}
}
TEdit_field& vi = m.efield(F_VALUTAINTRA);
if (vi.active() && vi.empty())
{
m.set(F_VALUTAINTRA, val);
m.set(F_CAMBIOINTRA, m.get(SK_CAMBIO), TRUE);
}
}
}
else
@ -588,7 +607,8 @@ bool TPrimanota_application::nrate_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
pag.set_sheet(ps);
pag.set_sheet(ps);
app().set_banche(m);
app().pag_rows() = ps.rows_array();
}
f.set(format("%d", pag.n_rate()));
@ -715,6 +735,31 @@ void TPrimanota_application::set_totale_pagamento(bool update)
}
}
void TPrimanota_application::set_banche(TMask& m)
{
// Aggiunge banche: CM000033
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
bool update = FALSE;
for (int i = ps.items()-1; i >= 0; i--)
{
TToken_string& row = ps.row(i);
if (row.get_char(7) <= ' ')
{
row.add(m.get(FS_NSABI), 7);
row.add(m.get(FS_NSCAB), 8);
update = TRUE;
}
if (row.get_char(9) <= ' ')
{
row.add(m.get(FS_VSABI), 9);
row.add(m.get(FS_VSCAB), 10);
update = TRUE;
}
}
if (update)
ps.force_update();
}
void TPrimanota_application::set_scadenze(TMask& m)
{
const TString16 cp(m.get(F_CODPAG));
@ -736,6 +781,7 @@ void TPrimanota_application::set_scadenze(TMask& m)
pag.set_rate_auto();
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
pag.set_sheet(ps); // prepara lo sheet
set_banche(m);
_pag_rows = ps.rows_array(); // copia sheet
}

View File

@ -1937,7 +1937,7 @@ bool TListaMov_application::set_print(int m)
set_magic_currency(TRUE);
reset_files();
TLocalisamfile* fl;
// TLocalisamfile* fl;
_curr1->set_filterfunction (filter_func);
_curr2->set_filterfunction (filter_func);
_curr3->set_filterfunction (filter_func_fatture);
@ -1955,32 +1955,25 @@ bool TListaMov_application::set_print(int m)
_registro_ini = msk.get(F_REGISTROINI);
_registro_fin = msk.get(F_REGISTROFIN);
}
_numreg_ini = atol(msk.get(F_NUMEROINI));
_numreg_ini = msk.get_long(F_NUMEROINI);
_numreg_fin = msk.get_long(F_NUMEROFIN);
_data_ini = msk.get(F_DATAINI);
_data_fin = msk.get(F_DATAFIN);
_numreg_fin = atoi(msk.get(F_NUMEROFIN));
_provvis = msk.get_int(F_STAMPAMOVP);
if (_decidi == 1)
{
select_cursor(_cur1);
/*
if (!provvis)
_curr1->setfilter("(PROVVIS=\"\")");
else _curr1->setfilter("");
*/
if (_provvis == 1) //normale
_curr1->setfilter("(PROVVIS=\"\")");
else if (_provvis == 2) //globale
_curr1->setfilter("");
else _curr1->setfilter("(PROVVIS!=\"\")"); //solo provvisori
fl = &(current_cursor()->file(LF_MOV));
TRectype da (fl->curr());
TRectype a (fl->curr());
da.zero();
a.zero();
TRectype da(LF_MOV), a(LF_MOV);
da.put(MOV_NUMREG, _numreg_ini);
a.put(MOV_NUMREG, _numreg_fin);
current_cursor()->setregion(da,a);
add_file(LF_MOV);
add_file(LF_RMOV,LF_MOV);
add_file(LF_RMOVIVA,LF_MOV);
@ -1988,22 +1981,13 @@ bool TListaMov_application::set_print(int m)
else
{
select_cursor(_cur2);
/*
if (!provvis)
_curr2->setfilter("(PROVVIS=\"\")");
else
_curr2->setfilter("");
*/
if (_provvis == 1) //normale
_curr2->setfilter("(PROVVIS=\"\")");
else if (_provvis == 2) //globale
_curr2->setfilter("");
else _curr2->setfilter("(PROVVIS!=\"\")"); //solo provvisori
fl = &(current_cursor()->file(LF_MOV));
TRectype da (fl->curr());
TRectype a (fl->curr());
da.zero();
a.zero();
else
_curr2->setfilter("(PROVVIS!=\"\")"); //solo provvisori
TRectype da (LF_MOV), a(LF_MOV);
if (_data_ini.ok())
da.put(MOV_DATAREG, _data_ini);
if (_data_fin.ok())
@ -2018,65 +2002,56 @@ bool TListaMov_application::set_print(int m)
case fatture:
{
_noseparator = msk.get_bool(F_SEPARATOR);
fl = &(current_cursor()->file(LF_MOV));
TString tipo = msk.get(F_TIPOELENCO);
//bool movprov = msk.get_bool(F_STAMPAMOVP);
_data_ini = msk.get(F_DATAINI);
_data_fin = msk.get(F_DATAFIN);
_annoes = msk.get_int(F_ANNO);
if (tipo=="C" || tipo=="F")
{
_codice_ini = atol(msk.get(F_CODICEINI));
_codice_fin = atol(msk.get(F_CODICEFIN));
_noseparator = msk.get_bool(F_SEPARATOR);
TString tipo = msk.get(F_TIPOELENCO);
//bool movprov = msk.get_bool(F_STAMPAMOVP);
_data_ini = msk.get(F_DATAINI);
_data_fin = msk.get(F_DATAFIN);
_annoes = msk.get_int(F_ANNO);
if (tipo=="C" || tipo=="F")
{
_codice_ini = atol(msk.get(F_CODICEINI));
_codice_fin = atol(msk.get(F_CODICEFIN));
}
else
{
_codice_ini = atol(msk.get(F_CODICEINI1));
_codice_fin = atol(msk.get(F_CODICEFIN1));
}
// _relmov->add(LF_MOV, "NUMREG=NUMREG",1, LF_RMOVIVA,100); //creo un alias per il file LF_MOV
if (tipo == "E")
{
_tipo_ini = "C";
_tipo_fin = "F";
}
else
{
_tipo_ini = tipo;
_tipo_fin = tipo;
}
select_cursor(_cur3);
_curr3->setfilter("");
TRectype da(LF_MOV), a(LF_MOV);
if (_codice_ini != 0)
da.put(MOV_CODCF, _codice_ini);
a.put(MOV_TIPO, _tipo_fin);
if (_codice_fin != 0)
a.put(MOV_CODCF, _codice_fin);
da.put(MOV_TIPO, _tipo_ini);
current_cursor()->setregion(da,a);
add_file(LF_MOV);
add_file(LF_RMOVIVA,LF_MOV);
}
else
{
_codice_ini = atol(msk.get(F_CODICEINI1));
_codice_fin = atol(msk.get(F_CODICEFIN1));
break;
default:
break;
}
// _relmov->add(LF_MOV, "NUMREG=NUMREG",1, LF_RMOVIVA,100); //creo un alias per il file LF_MOV
if (tipo == "E")
{
_tipo_ini = "C";
_tipo_fin = "F";
}
else
{
_tipo_ini = tipo;
_tipo_fin = tipo;
}
select_cursor(_cur3);
/*
if (!movprov)
_curr3->setfilter("(PROVVIS=\"\")");
else _curr3->setfilter("");
*/
_curr3->setfilter("");
TRectype da (fl->curr());
TRectype a (fl->curr());
da.zero();
a.zero();
if (_codice_ini != 0)
da.put(MOV_CODCF, _codice_ini);
a.put(MOV_TIPO, _tipo_fin);
if (_codice_fin != 0)
a.put(MOV_CODCF, _codice_fin);
da.put(MOV_TIPO, _tipo_ini);
current_cursor()->setregion(da,a);
add_file(LF_MOV);
add_file(LF_RMOVIVA,LF_MOV);
}
break;
init_print(msk);
default:
break;
}
init_print(msk);
return TRUE;
return TRUE;
}

View File

@ -3204,8 +3204,8 @@ void TMastrini_application::calcola_progressivi()
if (_stampa_mov_prov)
{
progredare_eseprec = pdarep + saldi.get_real(SLD_PDAREPRO);
progreavere_eseprec = paverep + saldi.get_real(SLD_PAVEREPRO);
progredare_eseprec += saldi.get_real(SLD_PDAREPRO);
progreavere_eseprec += saldi.get_real(SLD_PAVEREPRO);
}
// cerca eventuale record scaricati

View File

@ -1574,9 +1574,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
// E quelli che non hanno la % prorata settata in tabella
real aaa = acquisti_iva;
if (percentuale1 != INVALID_PRORATA && percentuale1 != INVALID_PRORATA_ASSERT)
aaa -= *rr1;
aaa -= rr1 ? *rr1 : ZERO;
if (percentuale2 != INVALID_PRORATA && percentuale2 != INVALID_PRORATA_ASSERT)
aaa -= *rr2;
aaa -= rr2 ? *rr2 : ZERO;
prorata = _prorata.calc_prorata(aaa, _year);
// Somma i vari prorata calcolati per gli anni precedenti
@ -2769,8 +2769,24 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
// comprende anche il conguaglio prorata
risultato += tot_cong;
if (tot_cong.sign() > 0) res_debt += tot_cong;
if (tot_cong.sign() < 0) res_cred += abs(tot_cong);
if (atoi(_year) <= 1997)
{
if (tot_cong.sign() > 0) res_debt += tot_cong;
if (tot_cong.sign() < 0) res_cred += abs(tot_cong);
}
else // Nuovo prorata dal 1998, congloba il conguaglio pro-rata nell'IVA ammessa in detrazione
{
if (tot_cong.sign() > 0)
{
iva_acq -= tot_cong;
res_cred -= tot_cong;
}
else
{
iva_acq += abs(tot_cong);
res_cred += abs(tot_cong);
}
}
look_lim(month+deltam,TRUE);
// azzeriamo tutto (tranne r1, r5, s1, s0, s7)
@ -2909,8 +2925,9 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
res_cred = iva_acq + versamenti + vers_int + cred_prec - cred_trasf + acc_dec;
res_debt = iva_vend + rimborsi + debt_precd; // Tolto la somma di deb_mens, perche' gia' presente in iva_vend
if (tot_cong.sign() > 0) res_debt += tot_cong;
else res_cred -= tot_cong;
if (atoi(_year) <= 1997) // Non vale piu' dal 1998 in poi; iva_acq e' gia' ok e cosi' res_cred.
if (tot_cong.sign() > 0) res_debt += tot_cong;
else res_cred -= tot_cong;
if (rettifiche.sign() > 0) res_debt += rettifiche;
else res_cred -= rettifiche;

View File

@ -1042,7 +1042,8 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts,
d->_r6 = _lim->get_real("R6");
d->_r7 = _lim->get_real("R14");
d->_r9 = _lim->get_real("R9");
d->_r10 = _lim->get_real("R7"); // totale conguaglio prorata
if (atoi(_year) <= 1997) // Dal 1998 in poi il conguaglio prorata non va stampato, ma conglobato nell'iva acquisti
d->_r10 = _lim->get_real("R7"); // totale conguaglio prorata
TToken_string tt(80);
tt.add(_lam->get_real("R0").string());
@ -1318,7 +1319,10 @@ void TLiquidazione_app::set_att(_DescrItem& d)
void TLiquidazione_app::set_plafond(_DescrItem& d)
{
if (_isregis && _isfinal) return;
// In caso di stampa liquidazione da stampa registri, il prospetto plafond
// complessivo va evidenziato in testa; solo nel caso di trimestrali.
if (_isregis && _freqviva == "M") return;
set_bookmark("Quadro plafond", _att_bookmark);
@ -1712,8 +1716,9 @@ void TLiquidazione_app::set_pumpam(_DescrItem& d)
}
else
{
real prc(dp.get(0));
set_row(row++, "%% PRO-RATA ed IVA non detraibile (%s%%)@69g%r",
(const char*)dp.get(0), &(d._r11));
(const char*)prc.string(), &(d._r11));
}
}

View File

@ -1677,6 +1677,10 @@ void TStampa_registri_app::set_page_tot_reg()
for (int k = 0; k < array.items(); k++) // Mamma mia, mamma mia...
{
TRiga& riga = (TRiga&)array[k];
if (_tipo_stampa == prova && riga._imponibile == ZERO && riga._imposta == ZERO && riga._implordo == ZERO)
continue;
set_row(rr, "%-4s", (const char*)riga._codiva);
TString80 descr = descr_iva(riga._codiva);
set_row(rr, "@5g%-.23s",(const char*)descr);
@ -1743,7 +1747,7 @@ void TStampa_registri_app::set_page_tot_reg()
stampa_plafonds(rr);
}
void TStampa_registri_app::stampa_plafonds(int r)
bool TStampa_registri_app::stampa_plafonds(int r)
{
TTable pla ("%PLA");
TTable ppa ("PPA");
@ -1819,7 +1823,7 @@ void TStampa_registri_app::stampa_plafonds(int r)
}
}
else
return;
return FALSE;
const bool is_bollato = _tipo_stampa == bollato;
@ -1977,6 +1981,7 @@ void TStampa_registri_app::stampa_plafonds(int r)
}
else
set_row(++r, "@35gRiporto @55g%r", &disponibile);
return TRUE;
}
real TStampa_registri_app::stampa_valori_plafonds(const real& r1, const int mese, TTable& ppa, const char* tipo)
@ -2359,6 +2364,31 @@ print_action TStampa_registri_app::postprocess_page (int file, int counter)
//le righe settate in set_page_tot_reg()), in pratica a rottura di mese o alla fine
{
reset_print();
TRecnotype pos = _cur->pos();
long items = _cur->items();
const bool last_mov = pos == items-1;
if (_stampa_plafonds)
{
// Nel caso sia richiesta la stampa prospetto mensile plafond e vi siano mesi
// senza movimenti, è necessario forzarne la stampa
TDate save_date(_datareg);
// Caso speciale, in cui non vi siano movimenti sull'ultimo mese indicato in stampa
const bool print_over = last_mov && _dataregp == _dataregs && _dataregp.month() < _data_a.month();
const int m1 = _dataregp.month()+1;
const int m2 = print_over ? _data_a.month()+1 : _dataregs.month();
for (int kk = m1; kk < m2; kk++)
{
_datareg = TDate(1, kk, _annoes);
printer().formfeed();
stampa_plafonds(-1);
}
_datareg = save_date;
}
if (_liquidazione)
if (!_st_liq[_datareg.month()] && stampo_liquidazione(_datareg.month()))
{
@ -2377,9 +2407,8 @@ print_action TStampa_registri_app::postprocess_page (int file, int counter)
}
}
}
TRecnotype pos = _cur->pos();
long items = _cur->items();
if (pos == items-1)
if (last_mov)
{
if (_tipo_stampa != libro_unico && _liquidazione)
stampa_liq_mesi_succ();
@ -3019,11 +3048,15 @@ void TStampa_registri_app::no_movimenti()
//RICALCOLO PROGRESSIVI per registro riepilogativo
//il ricalcolo dei progressivi mensili viene sempre
//fatto (se B1 e' FALSE) anche se poi il riepilogativo
//fatto, se B1 e' FALSE, anche se poi il riepilogativo
//non verra' stampato (se il mese richiesto non e'
//in accordo con la frequenza di stampa del registro stesso)
//Il ricalcolo nel caso di riepilogativo avviene sempre,
//a causa della separazione dei progressivi per registri, ma
//solo se l'anno in questione e oltre il 1997, cioè prima della effettiva
//separazione dei progressivi.
const bool calc = _tipo_reg == riepilogativo && _annoes > 1997;
if (ricalcola(a)) // Il ricalcolo nel caso di riepilogativo avviene solo se necessario.
if (ricalcola(a) || calc)
{
TFilename app;
app.temp();
@ -3057,17 +3090,15 @@ void TStampa_registri_app::no_movimenti()
}
}
if (_stampa_plafonds) // Se non vi sono movimenti da stampare, e c'e' la X
{ // di stampa prospetto plafond, STAMPALO!
if (_freq_riepilogo == 'M' ||
(m == 3 || m == 6 || m == 9 || m == 12))
{
if (! printer().isopen())
printer().open();
_datareg = TDate(1, m, _annoes);
stampa_plafonds(-1); // Con -1 compone e stampa printrows all'istante
// In prova va stampato per ogni mese (sia Mensile che Trimestrale; in bollato, solo per i mesi che ancora mancano)
const bool print_plafond_bollato = _tipo_stampa != prova && _u_data.ok() && m > _u_data.month();
if (_stampa_plafonds && (_tipo_stampa == prova || print_plafond_bollato))
{
if (! printer().isopen())
printer().open();
_datareg = TDate(1, m, _annoes);
if (stampa_plafonds(-1)) // Con -1 compone e stampa printrows all'istante
printer().formfeed();
}
}
//la funzione stampo_liquidazione non stampera' la liquidazione sul

View File

@ -136,7 +136,7 @@ public:
int stampa_intestazione();
int stampa_prospetto(int, bool);
long select_firm_range(long,long);
void stampa_plafonds(int);
bool stampa_plafonds(int);
void get_dati_ditta();
void stampa_vidi();
void scrivi_reg(const TDate&);

View File

@ -2,7 +2,7 @@
PAGE "" -1 -1 50 8
NUMBER F_NUMREG 6
NUMBER F_NUMREG 7
BEGIN
PROMPT 2 1 "Numero di registrazione "
HELP "Inserire il numero di registrazione che si vuole modificare"

View File

@ -25,7 +25,7 @@ ENDPAGE
PAGE "Movimento" -1 -1 78 18
NUMBER F_NUMREG 6
NUMBER F_NUMREG 7
BEGIN
PROMPT 1 1 "Numero registrazione "
HELP "Inserire il numero di registrazione che si vuole modificare"

View File

@ -25,7 +25,7 @@ ENDPAGE
PAGE "" -1 -1 78 18
NUMBER F_NUMREG 6
NUMBER F_NUMREG 7
BEGIN
PROMPT 1 1 "Numero registrazione "
HELP "Inserire il numero di registrazione che si vuole modificare"
@ -119,9 +119,11 @@ BEGIN
FLAGS "HG"
END
CURRENCY F_IMPONIBILE 15
NUMBER F_IMPONIBILE 15
BEGIN
PROMPT 1 11 "Imponibile "
FLAGS "R"
PICTURE "."
END
STRING F_CODIVA 4
@ -136,9 +138,11 @@ BEGIN
FLAGS "D"
END
CURRENCY F_IMPOSTA 15
NUMBER F_IMPOSTA 15
BEGIN
PROMPT 1 13 "Imposta "
FLAGS "R"
PICTURE "."
END
NUMBER F_TIPODET 1

View File

@ -2,7 +2,7 @@
PAGE "" -1 -1 50 6
NUMBER F_NUMREG 6
NUMBER F_NUMREG 7
BEGIN
PROMPT 2 1 "Numero di registrazione "
HELP "Inserire il numero di registrazione che si vuole modificare"

View File

@ -24,7 +24,7 @@ ENDPAGE
PAGE "" -1 -1 78 18
NUMBER F_NUMREG 6
NUMBER F_NUMREG 7
BEGIN
PROMPT 1 1 "Numero registrazione "
HELP "Inserire il numero di registrazione che si vuole modificare"

View File

@ -305,10 +305,10 @@ bool TSaldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDat
bool TSaldo::ultima_immissione_verifica(int annoes,int g,int c,long s,int indbil,int stp_prov)
{
//Si considerano i saldi e non piu' i movimenti
char sezione,sezsf;
char sezione;
int gruppo, conto, annoe;
long sottoconto;
real pdarepro, paverepro,saldofin;
real pdarepro, paverepro;
bool esito = FALSE;
_saldo_iniziale = ZERO;
@ -316,7 +316,8 @@ bool TSaldo::ultima_immissione_verifica(int annoes,int g,int c,long s,int indbil
_prg_dare = ZERO;
_prg_avere = ZERO;
_saldo = ZERO;
saldofin = ZERO;
_saldofin = ZERO;
_sezsf = ' ';
_saldi.zero();
_saldi.put(SLD_ANNOES,annoes);
@ -337,8 +338,8 @@ bool TSaldo::ultima_immissione_verifica(int annoes,int g,int c,long s,int indbil
pdarepro = _saldi.get_real(SLD_PDAREPRO);
paverepro = _saldi.get_real(SLD_PAVEREPRO);
sezione = _saldi.get_char(SLD_FLAGSALINI);
sezsf = _saldi.get_char(SLD_FLAGSALFIN); // W96SALDI del 19-06-96 modifica richiesta
saldofin = _saldi.get_real(SLD_SALDOFIN); // da PATRIZIA
_sezsf = _saldi.get_char(SLD_FLAGSALFIN); // W96SALDI del 19-06-96 modifica richiesta
_saldofin = _saldi.get_real(SLD_SALDOFIN); // da PATRIZIA
if (stp_prov == 1) //bilancio normale (senza provvisori)
if (_saldo_iniziale == ZERO && _prg_dare == ZERO && _prg_avere == ZERO)
@ -352,7 +353,7 @@ bool TSaldo::ultima_immissione_verifica(int annoes,int g,int c,long s,int indbil
if (sezione == 'A') _saldo_iniziale = -_saldo_iniziale;
if (sezsf == 'A') saldofin = -saldofin; // W96SALDI del 19-06-96
if (_sezsf == 'A') _saldofin = -_saldofin; // W96SALDI del 19-06-96
_saldoiniziale = _saldo_iniziale; //saldo iniziale presente sul record saldi
//non comprensivo del saldo finale es.precedente
@ -367,10 +368,10 @@ bool TSaldo::ultima_immissione_verifica(int annoes,int g,int c,long s,int indbil
switch (stp_prov)
{
case 1:
_saldo = _saldo_iniziale + _prg_dare - _prg_avere + saldofin; // W96SALDI del 19-06-96
_saldo = _saldo_iniziale + _prg_dare - _prg_avere + _saldofin; // W96SALDI del 19-06-96
break;
case 2:
_saldo = _saldo_iniziale + _prg_dare - _prg_avere + pdarepro - paverepro + saldofin; // W96SALDI del 19-06-96
_saldo = _saldo_iniziale + _prg_dare - _prg_avere + pdarepro - paverepro + _saldofin; // W96SALDI del 19-06-96
if (pdarepro != ZERO) // Modifica del 24-09-96 errore MI0890: nel caso in cui i progressivi
_prg_dare = pdarepro; // pdarepro o paverepro sono compilati sono in presenza di un movimento
if (paverepro != ZERO) // provvisorio, dunque li trasferisco nei progressivi che poi uso nel
@ -402,14 +403,14 @@ bool TSaldo::ultima_immissione_bilancio(int annoes,int g,int c,long s,int indbil
int gruppo, conto, annoe;
long sottoconto;
real pdarepro, paverepro;
real saldofinale;
char flagsf;
bool esito = FALSE;
_saldo_iniziale = ZERO;
_prg_dare = ZERO;
_prg_avere = ZERO;
_saldo = ZERO;
_saldofin = ZERO;
_sezsf = ' ';
_rec_presente_ec = FALSE;
_rec_presente_ep = FALSE;
_prec = FALSE;
@ -433,8 +434,8 @@ bool TSaldo::ultima_immissione_bilancio(int annoes,int g,int c,long s,int indbil
pdarepro = _saldi.get_real(SLD_PDAREPRO);
paverepro = _saldi.get_real(SLD_PAVEREPRO);
sezione = _saldi.get_char(SLD_FLAGSALINI);
flagsf = _saldi.get_char(SLD_FLAGSALFIN);
saldofinale = _saldi.get_real(SLD_SALDOFIN);
_sezsf = _saldi.get_char(SLD_FLAGSALFIN);
_saldofin = _saldi.get_real(SLD_SALDOFIN);
if (stp_prov == 1) //bilancio normale (senza provvisori)
esito = (_saldo_iniziale != ZERO || _prg_dare != ZERO || _prg_avere != ZERO);
@ -449,8 +450,8 @@ bool TSaldo::ultima_immissione_bilancio(int annoes,int g,int c,long s,int indbil
if (sezione == 'A') _saldo_iniziale = -_saldo_iniziale;
if (saldo_chiusura) // W96SALDI modifica inserita per il discorso di inclusione oppure
if (flagsf == 'A') // no del saldo di chiusura inserita il 09-07-96
saldofinale = -saldofinale;
if (_sezsf == 'A') // no del saldo di chiusura inserita il 09-07-96
_saldofin = -_saldofin;
_rec_presente_ec = esito;
}
@ -473,7 +474,7 @@ bool TSaldo::ultima_immissione_bilancio(int annoes,int g,int c,long s,int indbil
_saldo = pdarepro - paverepro;
if (saldo_chiusura) // W96SALDI modifica inserita per il discorso di inclusione oppure
_saldo += saldofinale; // no del saldo di chiusura inserita il 09-07-96
_saldo += _saldofin; // no del saldo di chiusura inserita il 09-07-96
return esito;
}

View File

@ -67,7 +67,8 @@ class TSaldo : public TObject
TLocalisamfile _saldi;
real _saldo, _saldo_iniziale, _saldoiniziale; // oh my GOSH
real _prg_dare, _prg_avere;
real _prg_dare, _prg_avere, _saldofin;
char _sezsf;
int _indbil;
int _annoes;
TDate _inizioEs, _fineEs;
@ -122,6 +123,8 @@ public:
const real& saldoinisusaldi() const { return _saldoiniziale;}
const real& prgdare() const { return _prg_dare;}
const real& prgavere() const { return _prg_avere;}
const real& saldofin() const { return _saldofin;}
const char sezsf() const { return _sezsf;}
const bool flagprec() { return _prec; }
// bool prg_attuali(int i,TConto& c, int d, real& p1, real& p2);

View File

@ -1905,9 +1905,10 @@ void TPagamento::adjust_refused_scad()
codice << _tipocf << '|' << _codcf;
const TRectype& clifo = cache().get(LF_CFVEN, codice);
TToken_string nonacceff(clifo.get(CFV_NONACCEFF), ';');
const TToken_string nonacceff(clifo.get(CFV_NONACCEFF), ';');
if (nonacceff.empty_items())
return;
const TToken_string nonscadeff(clifo.get(CFV_NONSCADEFF), ';');
TToken_string intervallo(12, ',');
TToken_string dalgiorno(5, '-'), algiorno(5, '-');
@ -1942,9 +1943,8 @@ void TPagamento::adjust_refused_scad()
const TDate tod(gio, mes, ann);
if (d > tod)
continue;
intervallo = clifo.get(CFV_NONSCADEFF);
intervallo.get(inter, algiorno);
nonscadeff.get(inter, algiorno);
gio = algiorno.get_int(0);
mes = algiorno.get_int(1);
ann += (mes < tod.month()) ? 1 : 0;

View File

@ -316,7 +316,8 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
if (m.get_bool(F_VIRTUALI)) fi << 'V';
if (m.get_bool(F_GHOST)) fi << 'G';
_tree.explode(a.rows_array(), mb, gr, md, fi, sk);
_tree.goto_root();
_tree.explode(a.rows_array(), mb, gr, md, fi, sk, lq);
a.run();
}
}
@ -547,7 +548,7 @@ bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long
row.add("A", F_TIPOCOMP-FIRST_FIELD); // Forza il listbox ad articolo
row.add("", F_EXPR-FIRST_FIELD); // Forza la quantita' ad 1
row.add(nrig+1, F_SORT0-FIRST_FIELD); // Inizializza numero riga
sheet.set_focus_cell(nrig,F_TIPOCOMP-FIRST_FIELD);
sheet.select(nrig);
break;
case se_notify_modify:
return test_row(row);
@ -757,18 +758,26 @@ bool TDistinta_mask::on_field_event(TOperable_field& o, TField_event e, long jol
{
TSheet_field& sf = sfield(F_SHEET);
_sort_key = atoi(o.get());
if (e == fe_close && _sort_key > 0)
{
if (yesno_box("Attenzione, l'ordine di immissione verra' modificato:\n"
"Si desidera registrare secondo l'ordinamento %d?", _sort_key))
break;
if (e == fe_close)
{
if (_sort_key > 0)
{
if (yesno_box("Attenzione, l'ordine di immissione verra' modificato:\n"
"Si desidera registrare secondo l'ordinamento %d?", _sort_key))
_sort_key = -1;
else
_sort_key = 0;
o.reset();
}
else
_sort_key = 0;
o.reset();
_sort_key = -1;
}
if (_sort_key >= 0)
{
TString_array& a = sf.rows_array();
a.TArray::sort(compare_sheet_rows);
sf.force_update();
}
TString_array& a = sf.rows_array();
a.TArray::sort(compare_sheet_rows);
sf.force_update();
}
break;
case F_UNITA:

View File

@ -316,10 +316,9 @@ void TLavorazione::put_linee()
}
}
int TLavorazione::linee() const
{
return _linee.items()/3;
return _linee.items()/3;
}
int TLavorazione::linee_standard() const
@ -454,12 +453,15 @@ TDistinta_expr::TDistinta_expr()
// TDistinta_tree
///////////////////////////////////////////////////////////
#define TREE_SEPARATOR '~'
const TRectype* TDistinta_tree::_curr = NULL;
TToken_string TDistinta_tree::_tmp(80, ',');
TToken_string TDistinta_tree::_tmp(80, TREE_SEPARATOR);
bool TDistinta_tree::isola_codice(TString& code) const
{
int comma = code.find(',');
int comma = code.find(TREE_SEPARATOR);
if (comma > 0)
code.cut(comma);
return code.not_empty();
@ -690,10 +692,15 @@ bool TDistinta_tree::set_root(const TQuantita& qta)
const bool ok = find(qta.articolo(), 1) != NULL;
if (ok)
{
_root = qta.articolo();
_root << ", ,0,0,"
<< qta.um() << ',' << qta.val()
<< ',' << get_type(qta.articolo());
_tmp = qta.articolo();
_tmp.add(' ');
_tmp.add('0');
_tmp.add('0');
_tmp.add(qta.um());
_tmp.add(qta.val().string());
_tmp.add(get_type(qta.articolo()));
_root = _tmp;
restart();
}
return ok;
@ -726,7 +733,6 @@ bool TDistinta_tree::set_root(const TRectype & rec)
art = rec.get(RDOC_CODARTMAG);
umart = rec.get(RDOC_UMQTA);
qta = rec.get_real(RDOC_QTA);
set_global("_RADICE", art);
set_global("_MAGAZZINO", rec.get(RDOC_CODMAG));
set_global("_LIVELLO", rec.get(RDOC_LIVELLO));
set_global("_LINEA", rec.get(RDOC_LINEA));
@ -736,7 +742,6 @@ bool TDistinta_tree::set_root(const TRectype & rec)
art = rec.get(RMOVMAG_CODART);
umart = rec.get(RMOVMAG_UM);
qta = rec.get_real(RMOVMAG_QUANT);
set_global("_RADICE", art);
set_global("_MAGAZZINO", rec.get(RMOVMAG_CODMAG));
set_global("_LIVELLO", rec.get(RMOVMAG_LIVGIAC));
set_global("_LINEA", ZERO);
@ -921,23 +926,24 @@ void TDistinta_tree::add_child()
}
_path.add(comp); // 0 - Codice articolo
_path << ',' << _curr->get("LIVELLO");// 1 - Livello giacenza
_path << TREE_SEPARATOR << _curr->get("LIVELLO");// Livello giacenza
long num = _curr->get_long("NRIG");
_path << ',' << num; // 2 - Numero componente
_path << TREE_SEPARATOR << num; // Numero componente
if (_sort > 0)
{
TString16 field; field << "SORT" << _sort;
num = _curr->get_long(field);
}
_path << ',' << num; // 3 - Numero ordinamento
_path << TREE_SEPARATOR << num; // Numero ordinamento
_path << ',' << _curr->get("UM"); // 4 - Unita' di misura
_path << TREE_SEPARATOR << _curr->get("UM"); // Unita' di misura
const TString& expr = _curr->get("EXPR");
const real qta = evaluate_numexpr(expr);
_path << ',' << qta; // 5 - Quantita'
_path << ',' << get_type(comp); // 6 - Articolo, Lavorazione, Virtuale, Ghost
_path << TREE_SEPARATOR << qta; // Quantita'
_path << TREE_SEPARATOR << get_type(comp); // 6 - Articolo, Lavorazione, Virtuale, Ghost
push_vars();
}

View File

@ -115,7 +115,7 @@ TSheet_field& TVariazione_effetti::righe_sheet() const
// comune alla write e alla rewrite
void TVariazione_effetti::common_f(const TMask& m)
{
long nprogtr = m.get_long(F_NPROGTR);
const long nprogtr = m.get_long(F_NPROGTR);
m.autosave(*_rel);
_effetto->head() = _rel->curr();
TSheet_field& shcess = cess_sheet();
@ -404,7 +404,6 @@ bool TVariazione_effetti::contab_handler(TMask_field& f, KEY k)
for (int i = sf.items() - 1; i >= 0; i--)
{
TToken_string& row = sf.row(i);
row.add(" ", sf.cid2index(F_NUMRIGA));
}
}

View File

@ -2,6 +2,7 @@
#include <relapp.h>
#include <msksheet.h>
#include <sheet.h>
#include <tabutil.h>
#include <utility.h>
#include <clifo.h>
@ -20,6 +21,7 @@ class TVariazione_distinte: public TRelation_application
TDistinta *_distinta;
TRelation *_rel;
TLocalisamfile *_reff, *_cession, *_clifo;
TTable *_ban;
protected:
virtual void init_query_mode(TMask&);
virtual void init_insert_mode(TMask&);
@ -380,6 +382,7 @@ bool TVariazione_distinte::user_create()
_reff = new TLocalisamfile(LF_REFFETTI);
_cession = new TLocalisamfile(LF_CESS);
_clifo = new TLocalisamfile(LF_CLIFO);
_ban = new TTable("%BAN");
_distinta = new TDistinta;
set_search_field(F_NUMBER);//setto il campo di ricerca della distinta
_msk->set_handler(F_TIPODIST, tipodist_handler);
@ -404,6 +407,7 @@ bool TVariazione_distinte::user_destroy()
delete _reff;
delete _cession;
delete _clifo;
delete _ban;
delete _distinta;
return TRUE;
}
@ -441,6 +445,7 @@ void TVariazione_distinte::carica_riba(int tipopag, const bool reset)
TLocalisamfile f(LF_EFFETTI);
// per prendere la ragione sociale del cliente di cui ho il codice
TLocalisamfile * clifo = app()._clifo;
TTable * ban = app()._ban;
TToken_string riga(80);
TMask* m2 = app()._m2;
if (reset)
@ -450,6 +455,7 @@ void TVariazione_distinte::carica_riba(int tipopag, const bool reset)
sf.reset();
TString16 codval = app()._msk->get(F_CODVAL);
TString16 codtab;
if (codval.empty()) codval = "LIT";
int err, i = 0;
@ -488,6 +494,13 @@ void TVariazione_distinte::carica_riba(int tipopag, const bool reset)
riga.add(clifo->get(CLI_RAGSOC));
else
riga.add("");
codtab = eff.get(EFF_CODABI);
codtab << eff.get(EFF_CODCAB);
ban->put("CODTAB", codtab);
if (ban->read() == NOERR)
riga.add(ban->get("S0"));
else
riga.add("");
if (eff.fatt(numero))// se l'effetto contiene solo una fattura
{ // metto i riferimenti al documento ed al numero di rata
const TRectype& rec_r = eff.row_r(1);

View File

@ -33,12 +33,13 @@
#define F_NRIBA 102
#define F_SCAD 103
#define F_CLIENTE 104
#define F_NFATT 105
#define F_DATAFATT 106
#define F_NRATA 107
#define F_VALUTA 108
#define F_IMPORTO 109
#define F_IMPORTOVAL 110
#define F_BANCA 105
#define F_NFATT 106
#define F_DATAFATT 107
#define F_NRATA 108
#define F_VALUTA 109
#define F_IMPORTO 110
#define F_IMPORTOVAL 111
#endif // __EF0300_H

View File

@ -32,7 +32,8 @@ BEGIN
ITEM "Sel."
ITEM "Nr. Ri.Ba."
ITEM "Scadenza"
ITEM "Cliente@50"
ITEM "Cliente@50"
ITEM "Banca d'appoggio@50"
ITEM "Nr. Fattura"
ITEM "Data Fattura"
ITEM "Nr. Rata"

View File

@ -28,44 +28,50 @@ BEGIN
FLAGS "D"
END
STRING F_BANCA 50 40
BEGIN
PROMPT 2 5 "Banca d'appoggio "
FLAGS "D"
END
STRING F_NFATT 7
BEGIN
PROMPT 2 5 "Numero Fatt. "
PROMPT 2 6 "Numero Fatt. "
FIELD LF_REFFETTI->NFATT
FLAGS "D"
END
DATA F_DATAFATT
BEGIN
PROMPT 2 6 "Data Fattura "
PROMPT 2 7 "Data Fattura "
FIELD LF_REFFETTI->DATAFATT
FLAGS "D"
END
NUMBER F_NRATA 3
BEGIN
PROMPT 2 7 "Numero Rata "
PROMPT 2 8 "Numero Rata "
FIELD LF_REFFETTI->NRATA
FLAGS "D"
END
STRING F_VALUTA 3
BEGIN
PROMPT 2 8 "Valuta "
PROMPT 2 9 "Valuta "
FIELD LF_EFFETTI->CODVAL
FLAGS "D"
END
STRING F_IMPORTO 18
BEGIN
PROMPT 2 9 "Importo "
PROMPT 2 10 "Importo "
FIELD LF_EFFETTI->IMPORTO
FLAGS "DR"
END
STRING F_IMPORTOVAL 18
BEGIN
PROMPT 2 10 "Importo Val. "
PROMPT 2 11 "Importo Val. "
FIELD LF_EFFETTI->IMPORTOVAL
FLAGS "DR"
END

View File

@ -39,7 +39,8 @@ protected:
virtual void main_loop();
virtual bool destroy(void) ;
virtual void on_firm_change(void);
void conferma(void);
void conferma(void);
void enable_dettaglio(TForm& form) const;
virtual void print_rb(char tipost, int ndist, char tipodist, int ncopie, const bool is_vis);
virtual void print_dse(char tipost, int ndist, char tipodist, int ncopie, const bool is_vis);
virtual void print(void);
@ -153,8 +154,8 @@ bool TEmissione::destroy()
// carica la ditta corrente
void TEmissione::on_firm_change()
{
TLocalisamfile &firmfile= _firmrel->lfile();
firmfile.put("CODDITTA", get_firm());
TRectype& firm = _firmrel->curr();
firm.put("CODDITTA", get_firm());
_firmrel->read();
}
@ -189,11 +190,11 @@ void TEmissione::main_loop()
// gestisce la scelta fra le due possibili emissioni
void TEmissione::conferma()
{
int tipoemis = _msk->get_int(F_TIPOEMIS);
const int tipoemis = _msk->get_int(F_TIPOEMIS);
if (tipoemis == 1)
floppy();
floppy();
else
print();
print();
}
// gestione emissione su floppy
@ -201,14 +202,17 @@ void TEmissione::floppy()
{
inizializza_cur();
long codabi = _cur->file().get_long(EFF_CODABIP);
const char tipo = _cur->file().get_char(EFF_TIPOCF);
const long codabi = _cur->curr().get_long(EFF_CODABIP);
const char tipocf = _cur->curr().get_char(EFF_TIPOCF);
const char tipopag = _cur->curr().get_char(EFF_TIPOPAG);
TFilename ribaini;
ribaini.format("ri%c%05ld.ini",tipo, codabi);// compongo il nome del tracciato
if (!ribaini.exist()) // ne controllo l'esistenza se non
ribaini = "riba.ini"; // esiste utilizzo quello generico
ribaini.format("r%c%c%05ld.ini",tipocf, tipopag, codabi);// compongo il nome del tracciato
if (!ribaini.exist()) // se non esiste
ribaini.overwrite("00000", 3); // Elimino codice banca
if (!ribaini.exist()) // se non esiste
ribaini = "riba.ini"; // utilizzo quello generico
_trasfile = new TRiba_file(RIBAFILENAME, ribaini);
_trasfile->set_ditta(get_firm());
@ -221,7 +225,7 @@ void TEmissione::floppy()
error_box("Impossibile continuare dischetto pieno");
else
{
TProgind pi(n_eff,"Emissione Ri.Ba. su floppy...",FALSE,TRUE,10);
TProgind pi(n_eff,"Emissione Ri.Ba. su floppy...",FALSE,TRUE);
TAssoc_array& tracciati = _trasfile->tracciati();
header_rb();//intestazione flusso effetti
@ -368,38 +372,41 @@ void TEmissione::print_rb(char tipost, int ndist, char tipodist, int ncopie, con
{
TCursor* fcur = _formrb->cursor();
TLocalisamfile &eff = fcur->file(LF_EFFETTI);
TString16 filter;
TString filter;
if (tipost == 'D' && !_msk->get_bool(F_RIST)) // se stampa definitiva effetti e se non deve ristampare le riba
filter = "EFFSTAMP=\" \"";// setta il filtro del cursore per ...
fcur->setfilter(filter,TRUE);// ... stampare solo gli effetti non ancora stampati
filter = "EFFSTAMP=\" \"";// setta il filtro del cursore per stampare solo gli effetti non ancora stampati
// setta la chiave 4 per il cursore per poter leggere tutti gli effetti della distinta
fcur->setkey(4);
TRectype darec(eff.curr());// fissa i dati per la scelta degli ...
darec.zero();// ... effetti nel primo e nell'ultimo record del cursore
if (ndist > 0)
{
darec.put(EFF_NDIST, ndist);
TRectype darec(eff.curr());// fissa i dati per la scelta degli ...
darec.zero();// ... effetti nel primo e nell'ultimo record del cursore
darec.put(EFF_TIPODIST, tipodist);
TRectype arec(darec);
fcur->setregion(darec, arec);
fcur->setfilter("");
darec.put(EFF_NDIST, ndist);
fcur->setregion(darec, darec);
}
else
fcur->setfilter("(TIPODIST==\"\")&&(NDIST==\"\")");
{
if (filter.not_empty()) filter << "&&";
filter << "(TIPODIST==\"\")&&(NDIST==\"\")";
}
fcur->setfilter(filter,TRUE);
long n = fcur->items();
fcur->freeze();
// se la stampa non si fa a video istanzia puntatore per la gestione
// della barra di attesa
for (int j=0; j < ncopie; j++)
{
TProgind* pi;
TProgind* pi = NULL;
if (!is_vis)
pi = new TProgind(n,"Stampa Effetti...",FALSE,TRUE,10);
// ciclo sugli elementi del cursore di stampa
//for (*fcur = 0; fcur->pos() < n; ++(*fcur))
{
if (!is_vis)
pi->addstatus(1L); // aggiorna la barra d'attesa
if (pi) pi->addstatus(1L); // aggiorna la barra d'attesa
_formrb->print(); // stampa il form
}
}
@ -453,6 +460,23 @@ void TEmissione::print_dse(char tipost, int ndist, char tipodist, int ncopie, co
aggiorna_dist(fcur);// ... devo aggiornare flag di stampa distinta
}
void TEmissione::enable_dettaglio(TForm& form) const
{
TForm_subsection* fss = form.exist_field('B', odd_page, "RIGHE_EFFETTO");
const bool dett = _msk->get_bool(F_DETTAGLIO);
if (fss)
fss->show(dett);
else
{
if (dett)
{
warning_box("Il modulo %s non prevede la stampa dei dettagli:\n"
"E' necessario aggiungere la sezione RIGHE_EFFETTO",
(const char*)form.name());
}
}
}
// gestione emissione effetti/distinte su moduli cartacei
void TEmissione::print()
{
@ -465,33 +489,39 @@ void TEmissione::print()
int ndist = _msk->get_int(F_NUMBER);
char tipodist = _msk->get(F_TIPODIST)[0];
_rel->lfile().put(EFF_TIPODIST,tipodist);
_rel->lfile().put(EFF_NDIST,ndist);
_rel->lfile().put(EFF_NDIST,ndist);
_rel->lfile().put(EFF_NRIGADIST,1);
_rel->lfile().setkey(4);
_rel->read();
long codabi = _rel->lfile().get_long(EFF_CODABIP);
const char tipo = _rel->lfile().get_char(EFF_TIPOCF);
const char tipocf = _rel->lfile().get_char(EFF_TIPOCF);
const char tipopag = _rel->lfile().get_char(EFF_TIPOPAG);
char tipost = _msk->get(F_TIPOST)[0];
char tipord = _msk->get(F_TIPORD)[0];
// se emetto riba istanzio il form per le riba
// se emetto distinta istanzio il form per le distinte
TFilename nomeform; // compongo il nome del form
if (emis == 1)
{
TFilename nomeform;
nomeform.format("rb%c%05ld.frm",tipo, codabi);// compongo il nome del form
if (!nomeform.exist()) // ne controllo l'esistenza se non
nomeform = "rb.frm"; // esiste utilizzo quello generico
nomeform.format("r%c%c%05ld.frm",tipocf, tipopag, codabi);
if (!nomeform.exist()) // se non esiste
nomeform.overwrite("00000", 3); // elimino codice banca
if (!nomeform.exist()) // se non esiste
nomeform = "rb.frm"; // utilizzo quello generico
_formrb = new TRiba_form(nomeform);
enable_dettaglio(*_formrb);
print_rb(tipost,ndist,tipodist,ncopie,is_vis);
}
else
{
TFilename nomeform;
nomeform.format("ds%c%05ld.frm",tipo, codabi);// compongo il nome del form
if (!nomeform.exist()) // ne controllo l'esistenza
nomeform = "dse.frm"; // se non esiste utilizzo quello generico
nomeform.format("d%c%c%05ld.frm",tipocf, tipopag, codabi);// compongo il nome del form
if (!nomeform.exist()) // se non esiste
nomeform.overwrite("00000", 3); // elimino codice banca
if (!nomeform.exist()) // se non esiste
nomeform = "dse.frm"; // utilizzo quello generico
_formdse = new TDistinta_form(nomeform, _firmrel);
enable_dettaglio(*_formdse);
_formdse->set_order(tipord);
print_dse(tipost,ndist,tipodist,ncopie,is_vis);
}
@ -1046,7 +1076,13 @@ void TRiba_file:: validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TSt
else
CHECKS (TRUE,"Sotto-Macro _IMPORTO non definita",(const char *)in);
} else
CHECKS (TRUE,"Macro non definita",(const char *)code);
if (code == "_CODSIA")
{
TConfig cnf(CONFIG_DITTA);
valore = cnf.get("CODSIA", "ef");
}
else
CHECKS (TRUE,"Macro non definita",(const char *)code);
str = valore;
}

View File

@ -18,5 +18,6 @@
#define F_RIST 112
#define F_NOMEFILE 113
#define F_TIPOCF 114
#define F_DETTAGLIO 115
#endif //__EF0500_H

View File

@ -85,12 +85,12 @@ BEGIN
FLAGS "H"
END
LIST F_EMIS 20
LIST F_EMIS 10
BEGIN
PROMPT 2 8 "Emissione "
ITEM "1|Emissione effetti"
ITEM "1|Effetti"
MESSAGE DISABLE,4@
ITEM "2|Emissione distinta"
ITEM "2|Distinte"
MESSAGE ENABLE,4@
GROUP 2
END
@ -113,24 +113,30 @@ END
LIST F_TIPOST 14
BEGIN
PROMPT 43 9 "Tipo di Stampa "
PROMPT 38 9 "Tipo di Stampa "
ITEM "P|Provvisoria"
ITEM "D|Definitiva"
GROUP 2
END
BOOLEAN F_RIST
BEGIN
PROMPT 43 10 "Ristampa"
GROUP 2
END
DATA F_DATAEMIS
BEGIN
PROMPT 2 11 "Data Emissione "
FLAGS "A"
END
BOOLEAN F_RIST
BEGIN
PROMPT 38 10 "Ristampa"
GROUP 2
END
BOOLEAN F_DETTAGLIO
BEGIN
PROMPT 38 11 "Stampa dettaglio (se previsto)"
GROUP 2
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -13 -1 ""

View File

@ -27,7 +27,7 @@ class TPrint_effetti_app : public TPrintapp
TDate _scad_prec;
//TRectype* _rec_prec;
int _cur_1, _cur_2, _cur_3, _cur_4, _interline;
long _dist_prec, _cliente_prec;
long _dist_prec, _cliente_prec;
char _tipo_prec, _tipocf_prec;
real _tot_data, _tot_mese, _tot_banca, _tot_distinta, _tot_tip_dist, _tot_cliente, _tot_stampa;
bool _prima_volta;
@ -812,16 +812,21 @@ bool TPrint_effetti_app::set_print(int)
to.put(EFF_DATASCAD,cod_to);
cod_from = mask.get(F_DADIST);
cod_to = mask.get(F_ADIST);
const TString & tipo_dist = &mask.get(F_DATIPODIST);
filter.cut(0);
if (cod_from.empty())
cod_from = "1";
filter << "(NDIST>=" << cod_from << ")";
if (cod_to.not_empty())
filter << "&&(NDIST<=" << cod_to << ")";
if (tipo_dist.empty())
filter << "(NDIST==\"\")";
else
{
if (cod_from.empty() && )
cod_from = "1";
filter << "(NDIST>=" << cod_from << ")";
if (cod_to.not_empty())
filter << "&&(NDIST<=" << cod_to << ")";
filter << "&&(TIPODIST==\"" << tipo_dist << "\")"; // di distinta
}
cod_from = mask.get(F_DATIPODIST);
filter << "&&(TIPODIST==\"" << cod_from << "\")"; // di distinta
select_cursor(_cur_3);
break;
case st_cliente:

View File

@ -2,7 +2,7 @@
#include "ef0600.h"
PAGE "Stampe di Controllo Effetti" -1 -1 58 16
PAGE "Stampe di Controllo Effetti" -1 -1 58 15
DATE F_DATA_STAMPA
BEGIN
@ -117,10 +117,10 @@ BEGIN
PROMPT 4 9 " "
KEY 4
GROUP 3
ITEM " | "
ITEM "I|All'incasso"
ITEM "B|Salvo buon fine"
ITEM "S|Allo sconto"
ITEM " |Senza distinta" MESSAGE CLEAR,F_DADIST|MESSAGE CLEAR,F_ADIST
ITEM "I|All'incasso" MESSAGE ENABLE,F_DADIST|MESSAGE ENABLE,F_ADIST
ITEM "B|Salvo buon fine" MESSAGE ENABLE,F_DADIST|MESSAGE ENABLE,F_ADIST
ITEM "S|Allo sconto" MESSAGE ENABLE,F_DADIST|MESSAGE ENABLE,F_ADIST
END
NUMBER F_DADIST 5
@ -136,8 +136,6 @@ BEGIN
DISPLAY "Nr. distinta" NDIST
DISPLAY "Tipo distinta" TIPODIST
OUTPUT F_DADIST NDIST
OUTPUT F_DATIPODIST TIPODIST
OUTPUT F_NUMBERRIGA NRIGADIST
CHECKTYPE NORMAL
END
@ -246,12 +244,12 @@ BEGIN
WARNING "Data limite superiore non valida"
END
BUTTON DLG_OK 9 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 9 2
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END

View File

@ -1,2 +1,3 @@
#define F_CAUSALE 101
#define F_CAUSALE_PAG 102
#define F_CODSIA 103

View File

@ -50,6 +50,13 @@ BEGIN
CHECKTYPE NORMAL
END
STRING F_CODSIA 5
BEGIN
PROMPT 2 7 "Codice SIA "
FLAGS "Z"
FIELD CODSIA
END
ENDPAGE
ENDMASK

View File

@ -62,7 +62,7 @@ MESSAGE(1)=_FISSO,!RB
NAME(2)=CODICE MITTENTE
POSITION(2)=3
LENGTH(2)=5
MESSAGE(2)=_FISSO,!00000
MESSAGE(2)=_CODSIA
NAME(3)=CODICE DESTINATARIO
FIELD(3)=31->CODABIP
@ -167,10 +167,10 @@ TYPE(14) = FISSO
POSITION(14) = 79
LENGTH(14) = 12
NAME(15) = CODICE AZIENDA (FACOLTATIVO)
TYPE(15) = FISSO
NAME(15) = CODICE AZIENDA
POSITION(15) = 91
LENGTH(15) = 5
MESSAGE(15) = _CODSIA
NAME(16) = CODICE FISSO (FACOLTATIVO)
TYPE(16) = FISSO
@ -441,7 +441,7 @@ MESSAGE(1)=_FISSO,!EF
NAME(2)=CODICE MITTENTE
POSITION(2)=3
LENGTH(2)=5
MESSAGE(2)=_FISSO,!00000
MESSAGE(2)=_CODSIA
NAME(3)=CODICE DESTINATARIO
FIELD(3)=31->CODABIP

203
ef/ribadett.frm Executable file
View File

@ -0,0 +1,203 @@
USE 31
JOIN 14 INTO NPROGTR==NPROGTR
JOIN 20 INTO TIPOCF=="C" CODCF==CODCF
JOIN 13 TO 20 ALIAS 113 INTO COM==COMCF
JOIN %BAN ALIAS 201 INTO CODTAB[1,5]==CODABI
JOIN %BAN ALIAS 203 INTO CODTAB==CODABI+CODCAB
JOIN 13 TO 203@ ALIAS 213 INTO COM==S5
JOIN %BAN ALIAS 202 INTO CODTAB==CODABIP+CODCABP
END
DESCRIPTION
BEGIN
31->* "Effetti"
14->* "Righe effetto"
20->* "Clienti e Fornitori"
113@->* "Comuni"
213@->* "Comuni"
201@->* "Tabella banche"
202@->* "Tabella banche"
203@->* "Tabella banche"
END
GENERAL
BEGIN
OFFSET 0 0
END
SECTION BODY ODD 20
DATA 1 10
BEGIN
KEY "data scadenza"
PROMPT 50 2 ""
FIELD 31->DATASCAD
END
NUMERO 2 18
BEGIN
KEY "importo"
PROMPT 70 2 ""
MESSAGE _IMPORTO
PICTURE "###.###.###.###"
END
STRING 3 50
BEGIN
KEY "denominazione banca di presentazione"
PROMPT 27 7 ""
FIELD 202@->S0
END
NUMERO 4 56
BEGIN
KEY "importo in lettere"
PROMPT 27 6 ""
FIELD 31->IMPORTO
PICTURE "(*,*)LETTERE@44"
END
LISTA 5 4
BEGIN
KEY "a saldo/in conto"
FIELD 31->ULTRATA
PROMPT 27 10 ""
ITEM " |########"
ITEM "X|"
END
LISTA 6 4
BEGIN
KEY "a saldo/in conto"
FIELD 31->ULTRATA
PROMPT 27 11 ""
ITEM " |"
ITEM "X|########"
END
STRING 7 1
BEGIN
KEY "lettera a/e a seconda che la fattura raggruppata/o no"
PROMPT 35 10 ""
MESSAGE _FATT,!A
END
STRING 8 1
BEGIN
KEY "lettera a/e a seconda che la fattura raggruppata/o no"
PROMPT 43 10 ""
MESSAGE _FATT,!A
END
STRING 9 17 5
BEGIN
KEY "dati fattura"
PROMPT 48 10 ""
MESSAGE _FATT,!DATIFATT
END
NUMERO 10 18
BEGIN
KEY "importo fattura"
PROMPT 73 10 ""
MESSAGE _FATT,!IMPFATT
PICTURE "###.###.###.###"
END
STRING 11 30 2
BEGIN
KEY "ragione sociale debitore"
PROMPT 31 14 ""
FIELD 20->RAGSOC
END
STRING 13 32
BEGIN
KEY "indirizzo debitore"
PROMPT 31 16 ""
MESSAGE _CLI,!IND
END
STRING 14 5
BEGIN
KEY "CAP debitore"
PROMPT 31 17 ""
FIELD 20->CAPCF
END
STRING 15 30
BEGIN
KEY "localita debitore"
PROMPT 38 17 ""
MESSAGE _CLI,!PIAZZA
END
STRING 17 27 2
BEGIN
KEY "istituto banca d'appoggio"
PROMPT 1 14 ""
FIELD 201@->S0
END
STRING 18 27 2
BEGIN
KEY "denominazione banca d'appoggio"
PROMPT 1 16 ""
FIELD 203@->S0
END
STRINGA 19
BEGIN
KEY "via banca appoggio"
PROMPT 0 0 ""
FLAGS "H"
MESSAGE COPY,21
FIELD 203@->S2
END
STRINGA 20
BEGIN
KEY "n. civico banca appoggio"
PROMPT 0 0 ""
FLAGS "H"
MESSAGE APPEND,21
FIELD 203@->S7
END
STRING 21 27
BEGIN
KEY "indirizzo banca d'appoggio"
PROMPT 1 18 ""
END
STRINGA 22 27
BEGIN
KEY "localita banca d'appoggio"
PROMPT 1 19 ""
FIELD 213@->DENCOM
END
SECTION RIGHE_EFFETTO 21 1 1 FILE 14 GROUP NPROGTR
NUMERO 1
BEGIN
PROMPT 1 1 "Fattura n."
PICTURE "#######"
FIELD 14->NFATT
END
DATA 2
BEGIN
PROMPT 20 1 "del "
FIELD 14->DATAFATT
END
VALUTA 3
BEGIN
PROMPT 35 1 "di lire "
FIELD 14->IMPORTO
END
END
END
END

View File

@ -756,19 +756,19 @@ void TControl::update_tab_cid()
if (is_cont)
{
XI_OBJ* first = find_operable(_obj->itf, TRUE, TRUE);
XI_OBJ* last = find_operable(_obj->itf, FALSE, TRUE);
XI_OBJ* fi = find_operable(_obj->itf, TRUE, TRUE);
XI_OBJ* la = find_operable(_obj->itf, FALSE, TRUE);
int num;
XI_OBJ** child = xi_get_member_list(_obj, &num);
set_tab_cid(child[num-1], first->cid);
set_tab_cid(last, child[0]->cid);
set_tab_cid(child[num-1], fi->cid);
set_tab_cid(la, child[0]->cid);
} else
if (_obj->parent != _obj->itf)
{
XI_OBJ* first = find_operable(_obj->itf, TRUE, FALSE);
XI_OBJ* last = find_operable(_obj->itf, FALSE, FALSE);
set_tab_cid(_obj->parent, first->cid);
set_tab_cid(last, _obj->parent->cid);
XI_OBJ* fi = find_operable(_obj->itf, TRUE, FALSE);
XI_OBJ* la = find_operable(_obj->itf, FALSE, FALSE);
set_tab_cid(_obj->parent, fi->cid);
set_tab_cid(la, _obj->parent->cid);
}
}

View File

@ -2215,9 +2215,15 @@ bool TPrint_section::update()
}
TForm_item* TPrint_section::exist_field(short id) const
{
TForm_item* f = find_field_everywhere(id,this);
return f;
}
TForm_item& TPrint_section::find_field(short id) const
{
TForm_item * f = find_field_everywhere(id,this);
TForm_item* f = exist_field(id);
if (f) return *f;
yesnofatal_box("Can't find item with id %d", id);
return field(0);
@ -2252,11 +2258,17 @@ TForm_item *TPrint_section::find_field_everywhere(short id,const TPrint_section
return NULL;
}
TForm_item* TPrint_section::exist_field(const char *sec_name) const
{
TForm_item* f = find_field_everywhere(sec_name,this);
return f;
}
TForm_item& TPrint_section::find_field(const char *sec_name) const
{
TForm_item * f = find_field_everywhere(sec_name,this);
TForm_item* f = exist_field(sec_name);
if (f) return *f;
yesnofatal_box("Can't find item with id %s", sec_name);
yesnofatal_box("Can't find subsection '%s'", sec_name);
return field(0);
}
@ -2630,8 +2642,23 @@ TPrint_section* TForm::exist(
return sec;
}
TForm_item& TForm::find_field(char s, pagetype t, short id) const
TForm_item* TForm::exist_field(char s, pagetype t, short id) const
{
const TPrint_section* ps = ((TForm*)this)->exist(s, t);
CHECKD(ps, "Can't find section for field ", id);
return ps->exist_field(id);
}
TForm_subsection* TForm::exist_field(char s, pagetype t, const char *section) const
{
const TPrint_section* ps = ((TForm*)this)->exist(s, t);
CHECKS(ps, "Can't find section for field ", section);
return (TForm_subsection*)ps->exist_field(section);
}
TForm_item& TForm::find_field(char s, pagetype t, short id) const
{
const TPrint_section* ps = ((TForm*)this)->exist(s, t);
CHECKD(ps, "Can't find section for field ", id);
return ps->find_field(id);

View File

@ -344,10 +344,16 @@ public:
// @cmember Effettua operazioni personalizzate dall'applicazione sul <c TForm_item>
virtual bool validate(TForm_item& fld, TToken_string& val);
// @cmember Ritorna il campo <p id>-esimo della sezione <p sec> se esiste
TForm_item* exist_field(char sec, pagetype pag, short id) const;
// @cmember Ritorna la sottosezione <p name> della sezione <p sec> se esiste
TForm_subsection* exist_field(char sec, pagetype pag, const char *name) const;
// @cmember Ritorna il campo <p id>-esimo della sezione <p sec>
TForm_item& find_field(char sec, pagetype pag, short id) const;
// @cmember Ritorna la sottosezione <p name> della sezione <p sec>
TForm_subsection& find_field(char sec, pagetype pag, const char *name) const;
// @cmember Ritorna l'offset x valido per tutte le sezioni
int& offset_x()
{ return _x; }
@ -579,6 +585,12 @@ public:
// @cmember Ritorna l'<p n>-esimo campo da stampare
TForm_item& field(int n) const
{ return (TForm_item&)_item[n]; }
// @cmember Cerca e ritorna l'<p id>-esimo campo nella sezione
TForm_item* exist_field(short id) const;
// @cmember Cerca e ritorna la sottosezione <p id> nella sezione
TForm_item* exist_field(const char *id) const;
// @cmember Cerca e ritorna l'<p id>-esimo campo da stampare
TForm_item& find_field(short id) const;
// @cmember Cerca e ritorna la sottosezione <p id> da stampare

View File

@ -608,8 +608,6 @@ protected:
virtual TString& get_window_data() pure;
virtual void set_window_data(const char* data) pure;
int validate_func() const { return _validate ? _validate->_func : -1; }
public: // TMask_field
// @cmember Ritorna il prompt del campo
virtual const char* prompt() const;
@ -635,8 +633,11 @@ public:
{ return _field; }
// @cmember Setta il nome del campo corrsipondente sul file
void set_field(const TString& fr);
// @cmember Chiama l' eventuale funzione di validazione
// @cmember Ritorna il codice dell'eventuale funzione di validazione
int validate_func() const { return _validate ? _validate->_func : -1; }
// @cmember Chiama l'eventuale funzione di validazione
bool validate(KEY k);
// @cmember Legge dalla relazione il valore del campo

View File

@ -1069,7 +1069,6 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
if (xiev->v.select.column > 0)
{
// str2mask(_cur_rec); // Spostato sopra
TOperable_field* f = col2field(xiev->v.select.column);
if (f && f->active())
{

View File

@ -1037,6 +1037,7 @@ void TPrint_application::set_translation (
void TPrint_application::print()
{
_cancelled = FALSE;
_print_defined = FALSE;
// open printer if needed
if (!(printer().isopen ()))
@ -1565,10 +1566,10 @@ bool TPrint_application::destroy ()
void TPrint_application::do_print(int n)
{
while (set_print(n))
{
do { print(); } while(_repeat_print);
enable_print_menu();
}
{
do { print(); } while(_repeat_print);
enable_print_menu();
}
}
void TPrint_application::enable_print_menu()

View File

@ -3,6 +3,10 @@
#ifndef XVT_INCL_XVT
#include <xvt.h>
#endif
#ifndef __STDIO_H
#include <stdio.h>
#endif
#ifndef __DATE_H
@ -225,7 +229,6 @@ typedef void (*PRINTSECTIONHANDLER)(TPrinter& printer);
typedef void (*LINKHANDLER)(int, const char*);
class TViswin;
// @doc EXTERNAL

View File

@ -503,6 +503,53 @@ bool TRelation_application::search_mode()
return FALSE;
}
HIDDEN bool delete_handler(TMask_field& f, KEY k)
{
if (k == K_TAB && f.focusdirty() && !f.empty())
{
TMask& m = f.mask();
const bool finale = *f.prompt() == 'A';
const int pos = m.id2pos(f.dlg());
if (pos >= 3)
{
const TMask_field& e = m.fld(pos - 3);
if (e.is_edit() && e.get().blank())
{
const short id = e.dlg() - (finale ? 200 : 100);
const TRelation_application& app = (TRelation_application&)main_app();
const TMask_field& orig = app.curr_mask().field(id);
bool req = orig.required();
if (!req && orig.is_edit())
{
const TEdit_field& e = (TEdit_field&)orig;
req = e.validate_func() == 12;
}
if (req)
{
TString str; str << (finale ? "A " : "Da ") << orig.prompt();
return f.error_box("Specificare anche il valore %s", (const char*)str);
}
}
}
if (finale && !f.get().blank())
{
const TMask_field& p = m.fld(pos - 1);
TString80 prec = p.get();
TString80 curr = f.get();
bool ok;
switch (p.class_id())
{
case CLASS_REAL_FIELD: ok = real(prec) <= real(curr); break;
case CLASS_DATE_FIELD: ok = TDate(prec) <= TDate(curr); break;
default : ok = prec <= curr; break;
}
if (!ok)
return f.error_box("Inserire un valore non inferiore a '%s'", (const char*)prec);
}
}
return TRUE;
}
int TRelation_application::delete_mode()
{
TEdit_field& fld = get_search_field();
@ -546,16 +593,17 @@ int TRelation_application::delete_mode()
y = -1; // Posizione del campo precedente
TString prompt; // Prompt del campo corrente
const short delta = 100;
FOR_EACH_TOKEN(inplist, tok)
{
if (*tok != '"' && strchr(tok, '@') == NULL)
{
TMask_field& e = _mask->field(atoi(tok));
TMask_field& e = _mask->field(short(atoi(tok)));
if (!e.active())
continue;
const short id = 1000+e.dlg();
const short id = e.dlg()+delta;
prompt = "Da "; prompt << e.prompt();
sht.add_static(DLG_NULL, 0, prompt, 1, ++y);
TString16 flags;
@ -567,16 +615,28 @@ int TRelation_application::delete_mode()
switch (e.class_id())
{
case CLASS_DATE_FIELD:
sht.add_date(id, 0, "", tab1, y, flags);
sht.add_date(id+1000, 0, "A ", tab2, y, flags);
{
TDate_field& d1 = sht.add_date(id, 0, "", tab1, y, flags);
TDate_field& d2 = sht.add_date(id+delta, 0, "A ", tab2, y, flags);
d1.set_handler(delete_handler);
d2.set_handler(delete_handler);
}
break;
case CLASS_REAL_FIELD:
sht.add_number(id, 0, "", tab1, y, e.size(), flags);
sht.add_number(id+1000, 0, "A ", tab2, y, e.size(), flags);
{
TReal_field& r1 = sht.add_number(id, 0, "", tab1, y, e.size(), flags);
TReal_field& r2 = sht.add_number(id+delta, 0, "A ", tab2, y, e.size(), flags);
r1.set_handler(delete_handler);
r2.set_handler(delete_handler);
}
break;
default:
sht.add_string(id, 0, "", tab1, y, e.size(), flags);
sht.add_string(id+1000, 0, "A ", tab2, y, e.size(), flags);
{
TEdit_field& e1 = sht.add_string(id, 0, "", tab1, y, e.size(), flags);
TEdit_field& e2 = sht.add_string(id+delta, 0, "A ", tab2, y, e.size(), flags);
e1.set_handler(delete_handler);
e2.set_handler(delete_handler);
}
break;
}
if (y == 0)
@ -593,7 +653,8 @@ int TRelation_application::delete_mode()
tasto = sht.run();
if (tasto == K_ENTER)
{
TRectype rec_from(cur.file().num()), rec_to(cur.file().num());
TRectype rec_from(cur.curr()), rec_to(cur.curr());
rec_from.zero(); rec_to.zero();
TToken_string fldlist = brw->get_input_field_names();
TString80 str;
int fi = 0;
@ -610,12 +671,12 @@ int TRelation_application::delete_mode()
else
{
const short id = short(atoi(tok));
if (sht.id2pos(id+1000) >= 0)
if (sht.id2pos(id+delta) >= 0)
{
str = sht.get(id+1000);
str = sht.get(id+delta);
if (str.not_empty())
rec_from.put(fn, str);
str = sht.get(id+2000);
str = sht.get(id+2*delta);
if (str.not_empty())
rec_to.put(fn, str);
}
@ -668,9 +729,9 @@ int TRelation_application::delete_mode()
if (can_delete)
{
TWait_cursor hourglass;
long skipped = 0; // Record non cancellati perche' protetti
long skipped = 0; // Record non cancellati perche' protetti
cur.freeze(TRUE); // Congelo il cursore altrimenti si riaggiorna troppo
for (long pos = 0; deleting > 0; pos++)
for (long pos = sht.items()-1; deleting > 0; pos--)
{
if (sht.checked(pos))
{
@ -689,7 +750,7 @@ int TRelation_application::delete_mode()
can_delete = remove();
}
query_mode();
}
}
_autodelete = FALSE;
}
if (!can_delete)
@ -704,6 +765,7 @@ int TRelation_application::delete_mode()
warning_box("Un elemento non e' stato cancellato in quanto protetto.");
else
warning_box("%ld elementi non sono stati cancellati in quanto protetti.", skipped);
query_mode();
}
}
}

View File

@ -194,7 +194,7 @@ TSheet_control::TSheet_control(
XI_OBJ_DEF* listdef = xi_add_list_def(NULL, cid,
rct.top, rct.left, rct.bottom-rct.top,
XI_ATR_ENABLED | XI_ATR_VISIBLE,
XI_ATR_ENABLED | XI_ATR_VISIBLE | XI_ATR_NAVIGATE,
NORMAL_COLOR, NORMAL_BACK_COLOR, // normal
NORMAL_COLOR, DISABLED_BACK_COLOR, // disabled
FOCUS_COLOR, // active
@ -794,6 +794,9 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
refused = TRUE;
}
break;
case XIE_ON_LIST:
_sheet->notify_focus_field(id());
break;
case XIE_ON_ROW:
{
const long rec = row2rec(xiev->v.xi_obj->v.row);
@ -1166,6 +1169,7 @@ void TSheet::on_idle()
_sheet->set_focus_rec(-1);
_select_row = -1;
}
TMask::on_idle();
}
// @doc INTERNAL

View File

@ -208,7 +208,7 @@ void TTextfile::read_line (
{
CHECK (_isopen, "Attempt operation on closed file");
CHECKD (n >= 0 && n < _lines, "Line not present", n);
// CHECKD (n >= 0 && n < _lines, "Line not present", n);
if (pg && !_in_page (n))
_read_page (n);

View File

@ -246,7 +246,7 @@ bool TMask_movmag::handle_righeprezzo2(TMask_field &f, KEY k)
if (f.focusdirty())
{
// propone il prezzo in base alla causale
if (codart.not_empty() && codart != mmm._price_codart && !m.get(F_QUANT).blank())
if (codart.not_empty() && codart != mmm._price_codart)
{
TMask_movmag& mmm = (TMask_movmag&)m.get_sheet()->mask();
real prz = mmm.proposed_price(codart, m.get_real(F_QUANT), m.get(F_CAUSRIG));
@ -424,7 +424,7 @@ bool TMask_movmag::add_explrows(int r)
const char tipo_costo = cau.get("S11")[0];
const int livello = cau.get_int("I0");
distinta.set_root(sheet.cell(r,sheet.cid2index(F_CODART)));
distinta.explode(boom, FALSE, RAGGR_EXP_NONE, livello, "A");
distinta.explode(boom, TRUE, RAGGR_EXP_NONE, livello, "A");
for (int newrow=0; newrow < boom.items() ; newrow++)
{
TRiga_esplosione & riga_esp=(TRiga_esplosione & )(boom[newrow]);

View File

@ -20,13 +20,13 @@ public:
bool TForm_giacprezzi::validate(TForm_item &cf, TToken_string &s)
{
const TString code(s.get(0)); // prende il primo parametro, il codice del messaggio
TString subcode;
if (code=="_USER") {
subcode=s.get();
if (subcode=="PREZZO") {
TString codart(relation()->lfile(LF_ANAMAG).get("CODART"));
const TFixed_string code = s.get(0); // prende il primo parametro, il codice del messaggio
if (code == "_USER")
{
const TFixed_string subcode = s.get();
if (subcode=="PREZZO")
{
const TString80 codart = relation()->lfile(LF_ANAMAG).get("CODART");
const bool found = listino->ricerca(codart, ZERO);
cf.set(found ? listino->get_prezzo().string() : "");
return TRUE;
@ -100,10 +100,10 @@ bool TStampadatist_mask::handle_filt(TMask_field &fld, KEY k)
{
if (k == K_SPACE)
{
const bool articles = fld.mask().get(F_ORDINE)=="A";
TMask& m = fld.mask();
const bool articles = m.get(F_ORDINE)=="A";
if (articles)
{
TMask& m = fld.mask();
switch (fld.get()[0])
{
case '0':
@ -429,21 +429,23 @@ void TStampa_datistorici::setprint_perarticoli()
_form->set_ordering(normale);
break;
case 'M':
case 'S':
_form->find_field('B',odd_page,"H_CATMER").show();
_form->find_field('B',odd_page,"TOT_CATMER").show();
_form->set_ordering(cat_merc);
espr.format("%d->GRMERC[1,3]", LF_ANAMAG);
_form->set_ordering(subordine == 'M' ? cat_merc : scat_merc);
espr.format("%d->%s", LF_ANAMAG, subordine == 'M' ? "GRMERC[1,3]" : "GRMERC");
_form->find_field('B',odd_page,"GRUPPI_CATMER").setcondition(espr,_strexpr);
if (!_mask->get(F_DACATMER).blank())
if (!_mask->get(F_DASCATMER).blank())
{
srangecm << "da \"" << _mask->get(F_DACATMER) << "\" ";
filter << "&&(" << LF_ANAMAG << "->GRMERC[1,3]>=\"" << _mask->get(F_DACATMER) << "\")";
srangecm << "da \"" << _mask->get(F_DASCATMER) << "\" ";
filter << "&&(" << espr << ">=\"" << _mask->get(F_DASCATMER) << "\")";
}
if (!_mask->get(F_ACATMER).blank())
if (!_mask->get(F_ASCATMER).blank())
{
srangecm << "fino a \"" << _mask->get(F_ACATMER) << "\"";
filter << "&&(" << LF_ANAMAG << "->GRMERC[1,3]<=\"" << _mask->get(F_ACATMER) << "\")";
srangecm << "fino a \"" << _mask->get(F_ASCATMER) << "\"";
filter << "&&(" << espr << "<=\"" << _mask->get(F_ASCATMER) << "\")";
}
rangecm.set(srangecm.empty() ? "Tutte le categorie merceologiche" : format("Categorie merc. %s", (const char *)srangecm));
break;
@ -480,8 +482,18 @@ void TStampa_datistorici::setprint_perarticoli()
arec.put("ANNOES",_mask->get(F_ANNOES));
arec.put("CODMAG",_mask->get(F_AMAG));
// arec.put("CODART",_mask->get(F_AART));
const bool order_by_group = subordine == 'M' || subordine == 'S';
_cur->setregion(darec,arec);
_cur->setfilter(filter, subordine == 'M');
_cur->setfilter(filter, order_by_group);
if (order_by_group)
{
TString so;
so.format("ANNOES|%d->GRMERC|CODART|LIVELLO|CODMAG", LF_ANAMAG);
((TSorted_cursor*) _cur)->change_order(so);
}
}
// ORDINAMENTO
@ -581,12 +593,13 @@ void TStampa_datistorici::setprint_perarticoli_all()
srangea << "fino a \"" << _mask->get(F_ADES) << "\"";
break;
case 'M':
case 'S':
_cur->setkey(3);
darec.put("GRMERC",_mask->get(F_DACATMER));
arec.put("GRMERC",_mask->get(F_ACATMER));
_form->find_field('B',odd_page,"H_CATMER").show();
_form->find_field('B',odd_page,"TOT_CATMER").show();
_form->set_ordering(cat_merc);
_form->set_ordering(subordine == 'M' ? cat_merc : scat_merc);
if (!_mask->get(F_DAART).blank())
{
@ -653,23 +666,30 @@ void TStampa_datistorici::setprint_perarticoli_all()
void TStampa_datistorici::main_loop()
{
while (_mask->run() == K_ENTER) {
while (_mask->run() == K_ENTER)
{
if (_mask->magazz_ini().gestmag(TRUE))
{
if (*_mask->get(F_ORDINE)=='A')
if (_mask->get(F_ORDINE)[0]=='A')
{
if (*_mask->get(F_FILTRO) == 'T')
if (_mask->get(F_FILTRO)[0] == 'T')
setprint_perarticoli_all();
else
setprint_perarticoli();
} else {
const bool sp = _mask->field(F_SALTOPAG).active()&&_mask->get_bool(F_SALTOPAG);
TForm_subsection& ss = _form->find_field('B', odd_page, "H_CATMER");
ss.set_newpage(sp);
}
else
{
setprint_permagazzini();
}
}
_form->print();
delete _form;
}
} // while true
return ;
}

View File

@ -13,6 +13,9 @@
#define F_ADES 112
#define F_VALMEDI 113
#define F_STAMPAGIAC 114
#define F_SALTOPAG 115
#define F_DASCATMER 116
#define F_ASCATMER 117
#define F_TOTALIMAGAZZINI 119
#define F_TOTALIDEPOSITI 120
@ -30,5 +33,6 @@
#define G_DESART 3
#define G_PARAMVALORI 4
#define G_LISTINO 5
#define G_SCATMER 6

View File

@ -55,25 +55,26 @@ LISTBOX F_ORDINE 10
BEGIN
PROMPT 2 2 "Ordinamento "
ITEM "A|articoli"
MESSAGE " ", F_FILTRO|SHOW,F_ORDINEART|ENABLE,F_ORDINEART|HIDE,F_TOTALIDEPOSITI|"X",F_DETTAGLIODEP
MESSAGE SHOW,F_TOTALIMAGAZZINI|SHOW,F_DETTAGLIOMAG
MESSAGE " ", F_FILTRO|SHOW,F_ORDINEART|ENABLE,F_ORDINEART|HIDE,F_TOTALIDEPOSITI|"X",F_DETTAGLIODEP
MESSAGE SHOW,F_TOTALIMAGAZZINI|SHOW,F_DETTAGLIOMAG
ITEM "M|magazzini"
MESSAGE " ", F_FILTRO|"C",F_ORDINEART|K_SPACE,F_ORDINEART|SHOW,F_ORDINEART|DISABLE,F_ORDINEART|HIDE,F_ORDINEMAG|SHOW,G_CODART@|HIDE,G_DESART@
MESSAGE SHOW,F_TOTALIDEPOSITI|"X",F_DETTAGLIODEP
MESSAGE HIDE,F_TOTALIMAGAZZINI|HIDE,F_DETTAGLIOMAG
MESSAGE " ", F_FILTRO|"C",F_ORDINEART|K_SPACE,F_ORDINEART|SHOW,F_ORDINEART|DISABLE,F_ORDINEART|HIDE,F_ORDINEMAG|SHOW,G_CODART@|HIDE,G_DESART@
MESSAGE SHOW,F_TOTALIDEPOSITI|"X",F_DETTAGLIODEP
MESSAGE HIDE,F_TOTALIMAGAZZINI|HIDE,F_DETTAGLIOMAG
END
LISTBOX F_ORDINEART 20
BEGIN
FLAGS "G"
PROMPT 34 2 "Sotto-ordinamento "
ITEM "C|codice"
MESSAGE HIDE,G_CATMER@|ENABLE,G_CODART@|HIDE,G_DESART@
MESSAGE HIDE,G_CATMER@|HIDE,G_SCATMER@|ENABLE,G_CODART@|HIDE,G_DESART@|HIDE,F_SALTOPAG
ITEM "D|descrizione"
MESSAGE HIDE,G_CATMER@|DISABLE,G_CODART@|SHOW,G_DESART@
MESSAGE HIDE,G_CATMER@|HIDE,G_SCATMER@|DISABLE,G_CODART@|SHOW,G_DESART@|HIDE,F_SALTOPAG
ITEM "M|gruppo merc./codice"
MESSAGE SHOW,G_CATMER@|ENABLE,G_CODART@|HIDE,G_DESART@
MESSAGE SHOW,G_CATMER@|HIDE,G_SCATMER@|ENABLE,G_CODART@|HIDE,G_DESART@|SHOW,F_SALTOPAG
ITEM "S|Sottogr.merc./codice"
MESSAGE HIDE,G_CATMER@|SHOW,G_SCATMER@|ENABLE,G_CODART@|HIDE,G_DESART@|SHOW,F_SALTOPAG
END
LISTBOX F_ORDINEMAG 20
@ -81,15 +82,23 @@ BEGIN
FLAGS "G"
PROMPT 34 2 "Sotto-ordinamento "
ITEM "C|codice"
MESSAGE HIDE,G_CATMER@|ENABLE,G_CODART@|HIDE,G_DESART@
MESSAGE HIDE,G_CATMER@|HIDE,G_SCATMER@|ENABLE,G_CODART@|HIDE,G_DESART@|HIDE,F_SALTOPAG
ITEM "M|gruppo merc./codice"
MESSAGE SHOW,G_CATMER@|ENABLE,G_CODART@|HIDE,G_DESART@
MESSAGE SHOW,G_CATMER@|HIDE,G_SCATMER@|ENABLE,G_CODART@|HIDE,G_DESART@|SHOW,F_SALTOPAG
ITEM "S|Sottogr.merc./codice"
MESSAGE HIDE,G_CATMER@|SHOW,G_SCATMER@|ENABLE,G_CODART@|HIDE,G_DESART@|SHOW,F_SALTOPAG
END
BOOLEAN F_SALTOPAG
BEGIN
PROMPT 2 3 "Salto pagina per ogni cambio di gruppo merceologico"
FLAGS "Z"
END
NUMBER F_ANNOES 4
BEGIN
FLAGS "A"
PROMPT 2 3 "Codice es. "
PROMPT 2 4 "Codice es. "
USE ESC
INPUT CODTAB F_ANNOES
DISPLAY "Esercizio" CODTAB
@ -103,7 +112,7 @@ END
LISTBOX F_FILTRO 30
BEGIN
FLAGS "G"
PROMPT 34 3 "Stampo "
PROMPT 34 4 "Stampa "
ITEM "0|solo giacenze non nulle"
ITEM "P|solo giacenze positive"
ITEM "N|solo giacenze negativie"
@ -188,9 +197,10 @@ BEGIN
USE GMC SELECT CODTAB[4,5]==""
INPUT CODTAB F_DACATMER
DISPLAY "Codice" CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_DACATMER CODTAB[1,3]
DISPLAY "Descrizione@50" S0
OUTPUT F_DACATMER CODTAB
GROUP G_CATMER
MESSAGE COPY,F_DASCATMER
END
@ -201,10 +211,35 @@ BEGIN
COPY USE F_DACATMER
INPUT CODTAB F_ACATMER
COPY DISPLAY F_DACATMER
OUTPUT F_ACATMER CODTAB[1,3]
OUTPUT F_ACATMER CODTAB
GROUP G_CATMER
MESSAGE COPY,F_ASCATMER
END
STRING F_DASCATMER 5
BEGIN
PROMPT 2 11 "Dal gruppo "
FLAGS "UH"
USE GMC SELECT CODTAB[4,5]!=""
INPUT CODTAB F_DASCATMER
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_DASCATMER CODTAB
GROUP G_SCATMER
END
STRING F_ASCATMER 5
BEGIN
PROMPT 2 12 " al gruppo "
FLAGS "UH"
COPY USE F_DASCATMER
INPUT CODTAB F_ASCATMER
COPY DISPLAY F_DASCATMER
OUTPUT F_ASCATMER CODTAB
GROUP G_SCATMER
END
BOOL F_TOTALIDEPOSITI
BEGIN

View File

@ -157,7 +157,8 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
TCausale_magazzino &cau=(cau_r.codice().blank() ? cau_m : cau_r);
if (subcode=="*SEGNOCAUS") {
real v(cf.get());
v=v*cau.sgn(_tiposcheda) ;
const int sgn = cau.sgn(_tiposcheda);
v*=real (sgn);
cf.set(v.string());
return TRUE;
}
@ -520,9 +521,9 @@ void TStampa_schede_mag::setprint_perarticoli()
filter << '(' << LF_MOVMAG << "->ANNOES==" << _mask->get(F_ANNOES)<< ")&&" ;
// filtering from/to MAGS
if (*_mask->get(F_DAMAG))
filter << "(CODMAG[1,3]>=" <<'"' << _mask->get(F_DAMAG)<< "\")&&" ;
filter << "(" << LF_RMOVMAG << "->CODMAG[1,3]>=" <<'"' << _mask->get(F_DAMAG)<< "\")&&" ;
if (*_mask->get(F_AMAG))
filter << "(CODMAG[1,3]<=" <<'"' << _mask->get(F_AMAG)<< "\")&&" ;
filter << "(" << LF_RMOVMAG << "->CODMAG[1,3]<=" <<'"' << _mask->get(F_AMAG)<< "\")&&" ;
// filtering from/to DATA
if (*_mask->get(F_DADATA))
{

View File

@ -1,27 +1,21 @@
#include <xvt.h>
#include <strings.h>
//
// Modulo stampa inventario e libro giornale
#include "mg4.h"
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7|8|9}"
int main(int argc, char** argv)
{
int rt = -1;
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
const int r = (argc > 1) ? argv[1][1]-'0' : 0;
switch (r)
{
case 0:
rt = mg4100(argc,argv) ; break; // stampa lista controllo movimenti
case 1:
rt = mg4200(argc,argv) ; break; // stampa inventario
mg4200(argc,argv) ; break; // stampa inventario
case 2:
rt = mg4300(argc,argv) ; break; // stampa libro giornale
default:
error_box(usage, argv[0]) ; break;
mg4300(argc,argv) ; break; // stampa libro giornale
default:
mg4100(argc,argv) ; break; // stampa lista controllo movimenti
}
return rt ;
exit(0);
return 0;
}

View File

@ -293,25 +293,13 @@ TStampainv_mask::TStampainv_mask():
bool TStampainv_mask::handle_filt(TMask_field &fld, KEY k)
{
if (k == K_SPACE)
if (k == K_SPACE)
{
const bool articles = fld.mask().get(F_ORDINE)=="A";
TMask& m = fld.mask();
switch (fld.get()[0])
{
case '+':
case 'N':
m.show(F_ORDINEMAG);
m.hide(F_ORDINEART);
m.send_key(K_SPACE, F_ORDINEMAG);
break;
case 'T':
m.show(F_ORDINEART, articles);
m.show(F_ORDINEMAG, !articles);
m.send_key(K_SPACE, articles ? F_ORDINEART : F_ORDINEMAG);
default:
break;
}
m.show(F_ORDINEART, articles);
m.show(F_ORDINEMAG, !articles);
m.send_key(K_SPACE, articles ? F_ORDINEART : F_ORDINEMAG);
}
return TRUE;
}

View File

@ -57,7 +57,7 @@ typedef enum {
riga_nongenerata=' ' // immissione direttta del mov.
} TTipo_rigamovmag;
extern char * Nome_valorizz[];
extern char * Nome_valorizz[16];
typedef enum {
valorizz_ultcos,
@ -164,9 +164,10 @@ public:
// rimanenze iniziali dell'esercizio newes, valorizzando secondo il tipo passato
// Si suppone che i saldi siano coerenti con i movimenti (effettuare una rebuild_balances()
// di oldes.
bool riporta_saldi(const char * oldes, const char* newes, const TTipo_valorizz tipo, const char * catven ,const char * codlist);
bool riporta_saldi(const char * oldes, const char* newes, const TTipo_valorizz tipo,
const char * catven ,const char * codlist, bool save_to_disk = TRUE);
// La seguente funzione azzera tutti i saldi di mgazzino per l'esercizio cod_es
bool azzera_saldi(const char * cod_es);
bool azzera_saldi(const char* cod_es, bool save_to_disk = TRUE);
// valorizzazioni
real ultimo_costo(const char * annoes) const;
@ -205,6 +206,21 @@ public:
virtual ~TArticolo_giacenza() {}
};
class TArticolo_giacenza_data : public TArticolo_giacenza
{
protected:
virtual int write(TBaseisamfile&) const;
virtual int rewrite(TBaseisamfile&) const;
virtual int remove(TBaseisamfile&) const;
public:
void al(const TDate& data, const char* codmag = NULL, const char* livello = NULL,
TTipo_valorizz tipo = valorizz_costmedio, const char* catven = NULL, const char* codlis = NULL);
TArticolo_giacenza_data(const char* codice = NULL);
TArticolo_giacenza_data(const TRectype& rec);
};
// *******************************
// LIBRERIA DI utility del magazzino
// *******************************
@ -425,7 +441,7 @@ public:
virtual ~TCausale_magazzino() {}
};
class TLine_movmag ; // convenience...
class TLine_movmag;
// classe per la definizione dei movimenti di magazzino
// ( un movimento (testata+righe) == un oggetto TMov_mag )
@ -453,7 +469,7 @@ protected:
// @member: compone la chiave a partire dalla riga dello sheet
TToken_string & line2key(int numriga) const;
// @member: compone la dati a partire dalla riga dello sheet
TLine_movmag & line2data(int numriga) const;
TLine_movmag& line2data(int numriga) const;
// @member: estrae dalla Tokenstring della chiave i valori corrispondenti ai campi del file
static TString key2field(TToken_string &key,const char * f);
// @member: memorizza la linea come "da togliere"
@ -495,9 +511,11 @@ public:
virtual int write(TBaseisamfile& f) const ;
virtual int rewrite(TBaseisamfile& f) const ;
int force_update_bal();
const TCausale_magazzino& causale(const char* cod = NULL) const;
// @member: effettua l'aggiornamento dei saldi di una giacenza
int update_balances(TRectype& magrec, int numrig, int sign);
//
int codice_esercizio(const TDate &d);
// costruttori e distruttori

View File

@ -3,10 +3,10 @@
// funzione di ricostruzione saldi
#include <msksheet.h>
#include <applicat.h>
#include <execp.h>
#include <prefix.h>
#include <tabutil.h>
#include <execp.h>
#include <applicat.h>
#include "mglib.h"
@ -838,8 +838,6 @@ TString TCodice_livelli::build_tabcode_packed(const TString & pack, const int le
return build_tabcode(unpack_grpcode(pack,levnum),levnum);
}
const TString & TCodice_livelli::group_descr(const char * group_code, int levnum) const
{
return _gruppi->decode(build_tabcode(group_code,levnum));

View File

@ -2,14 +2,16 @@
// oggetto TArticolo_giacenza, multirecord dell'articolo di magazzino
// oggetto TMov_Mag , multirecord del movimento di magazzino
// funzione di ricostruzione saldi
//#include <utility.h>
#include <tabutil.h>
#include <currency.h>
#include <progind.h>
#include <tabutil.h>
#include "mglib.h"
#include "anamag.h"
#include "mag.h"
#include "movmag.h"
#include "rmovmag.h"
#include "..\cg\cglib01.h"
#include "..\ve\veconf.h"
@ -32,7 +34,7 @@ TTimed_skipbox:: TTimed_skipbox(const char * message,int seconds,int x,int y)
TTimed_skipbox::~TTimed_skipbox()
{}
char * Nome_valorizz[]=
char * Nome_valorizz[16]=
{
"Ultimo costo", "Media ultimi costi", "Prezzo di listino",
"Costo standard", "Costo medio acquisto" ,
@ -475,7 +477,7 @@ bool TArticolo_giacenza::is_last_esercizio(const char* annoes) const
return yes;
}
bool TArticolo_giacenza::azzera_saldi(const char * cod_es)
bool TArticolo_giacenza::azzera_saldi(const char* cod_es, bool save_to_disk)
{
TRecord_array& rec_arr = TArticolo_giacenza::mag(cod_es);
@ -499,10 +501,11 @@ bool TArticolo_giacenza::azzera_saldi(const char * cod_es)
mag.put(MAG_ACL,0);
mag.put(MAG_NLABEL,0);
}
return rec_arr.write(TRUE) == NOERR;
return save_to_disk ? (rec_arr.write(TRUE) == NOERR) : TRUE;
}
bool TArticolo_giacenza::riporta_saldi(const char * oldes, const char* newes, const TTipo_valorizz tipo, const char* catven, const char* codlis)
bool TArticolo_giacenza::riporta_saldi(const char * oldes, const char* newes, const TTipo_valorizz tipo,
const char* catven, const char* codlis, bool save_to_disk)
{
TString codes(newes), mag, liv;
TRecord_array& rec_arr = TArticolo_giacenza::mag(oldes);
@ -585,7 +588,7 @@ bool TArticolo_giacenza::riporta_saldi(const char * oldes, const char* newes, co
}
// Scrive il pastrocchio (eventualmente sovrascrive)
return rec_arr.write(TRUE) == NOERR;
return save_to_disk ? (rec_arr.write(TRUE) == NOERR) : TRUE;
}
real TArticolo_giacenza::disponibilita(const char * annoes, const char * codmag, const char * livello, bool solo_giac) const
@ -1146,6 +1149,104 @@ TArticolo_giacenza::TArticolo_giacenza(const TRectype& rec)
add_file(LF_STOMAG,"NRIGA");
}
// Giacenze alla data
int TArticolo_giacenza_data::write(TBaseisamfile&) const
{
NFCHECK("Non e' possibile scrivere un Articolo con giacenza alla data");
return NOERR;
}
int TArticolo_giacenza_data::rewrite(TBaseisamfile& f) const
{ return write(f); }
int TArticolo_giacenza_data::remove(TBaseisamfile& f) const
{ return write(f); }
void TArticolo_giacenza_data::al(const TDate& data, const char* codmag, const char* livello,
TTipo_valorizz tipo, const char* catven, const char* codlis)
{
const TEsercizi_contabili esc;
const int anno = esc.date2esc(data);
const TDate inizio = esc[anno].inizio();
TString16 annoes; annoes << anno;
TString16 predes;
bool reset_giac = TRUE;
const int anno_pred = esc.pred(anno);
if (anno_pred != 0)
{
predes << anno_pred;
const TDate dc = esc[anno_pred].chiusura_mag();
reset_giac = dc.ok();
}
remove_body(LF_MAG); // Azzero la cache dei magazzini
TRecord_array& rmag = mag(annoes);
for (int i = find_mag(annoes, codmag, livello); i > 0;
i = find_mag(annoes, codmag, livello, i))
{
const TRectype& rec = rmag.row(i);
if (reset_giac)
azzera_saldi(annoes, FALSE);
else
riporta_saldi(predes, annoes, tipo, catven, codlis, FALSE);
}
TRelation rel(LF_RMOVMAG); rel.add(LF_MOVMAG, "MOVMAG==MOVMAG");
TRectype filter(LF_RMOVMAG);
filter.put(RMOVMAG_CODART, codice());
if (livello && *livello)
filter.put(RMOVMAG_LIVGIAC, livello);
if (codmag && *codmag)
filter.put(RMOVMAG_CODMAG, codmag);
TCursor cur(&rel, "", 2, &filter, &filter);
const long items = cur.items();
cur.freeze();
TProgind* pi = NULL;
if (items >= 10)
{
TString80 str; str << "Calcolo giacenza articolo " << codice();
pi = new TProgind(items, str, FALSE, TRUE);
}
TMov_mag* p_movmag = new TMov_mag;
rel.lfile(LF_MOVMAG).set_curr(p_movmag);
TMov_mag& movmag = *p_movmag;
const TRectype& rmovmag = rel.curr();
for (cur = 0; cur.pos() < items; ++cur)
{
if (pi) pi->addstatus(1);
const TDate datacomp = movmag.get(MOVMAG_DATACOMP);
if (datacomp >= inizio && datacomp <= data)
{
const TString16 codmag = rmovmag.get(RMOVMAG_CODMAG);
const TString16 livello = rmovmag.get(RMOVMAG_LIVGIAC);
i = find_mag(annoes, codmag, livello);
if (i >= 0)
{
TRectype& rec = (TRectype&)rmag.row(i);
const int nrig = rmovmag.get_int(RMOVMAG_NRIG);
movmag.update_balances(rec, nrig, +1);
}
}
}
if (pi) delete pi;
}
TArticolo_giacenza_data::TArticolo_giacenza_data(const char* codice)
: TArticolo_giacenza(codice)
{ }
TArticolo_giacenza_data::TArticolo_giacenza_data(const TRectype& rec)
: TArticolo_giacenza(rec)
{ }
// causali
@ -1176,14 +1277,13 @@ int TCausale_magazzino::sgn(TTipo_saldomag tiposaldo) const
case s_user6: index = 38; break;
default : index = -1; break;
}
int s = 0;
int segno = 0;
if (index >= 0)
{
const TString& s2 = get("S2");
s = atoi(s2.mid(index, 2));
{
const TString& segni = get("S2");
segno = atoi(segni.mid(index, 2));
}
return s;
return segno;
}
TDecoder TCausale_magazzino::_ragg_fisc("%RFC", "S6");
@ -1191,15 +1291,15 @@ TDecoder TCausale_magazzino::_ragg_fisc("%RFC", "S6");
bool TCausale_magazzino::is_fiscale()
{
bool rt = FALSE;
if (raggfisc().not_empty()) // Per essere fiscale deve avere il raggruppamento fiscale
{
const char tm = tipomov();
rt = tm=='S' || tm=='C'; // La causale deve essere Carico o Scarico...
rt = tm == 'S' || tm == 'C'; // La causale deve essere Carico o Scarico...
if (rt)
{
const char rfc = _ragg_fisc.decode(raggfisc())[0];
rt = rfc == 'S' || rfc == 'C'; // Ed il raggruppamento deve essere Carico o Scarico
const TRectype& rfc = ragg_fisc_cache.get(raggfisc());
const char ragg = rfc.get_char("S6");
rt &= (ragg == 'S' || ragg == 'C'); // Ed il raggruppamento deve essere Carico o Scarico
}
}
return rt;

View File

@ -28,22 +28,23 @@ class TLine_movmag : public TObject
TString16 _um;
real _quant;
real _prezzo;
public:
const TString16 &codcaus() const {return _codcaus;}
const TString16 &um() const {return _um;}
const real &quant() const {return _quant;}
const real &prezzo() const {return _prezzo;}
void set(const TString16 cau,const TString16 um,const real q, const real p);
const TString& codcaus() const {return _codcaus;}
const TString& um() const {return _um;}
const real& quant() const {return _quant;}
const real& prezzo() const {return _prezzo;}
void set(const TString& cau,const TString& um,const real q, const real p);
int operator==(TLine_movmag &);
virtual TObject* dup() const {return new TLine_movmag(*this);};
virtual TObject* dup() const { return new TLine_movmag(*this); }
TLine_movmag() {};
TLine_movmag(const TLine_movmag &);
virtual ~TLine_movmag() {};
};
void TLine_movmag ::set(const TString16 cau,const TString16 um,const real q, const real p)
void TLine_movmag ::set(const TString& cau,const TString& um,const real q, const real p)
{
_codcaus=cau;
_um=um;
@ -207,35 +208,39 @@ bool TMov_mag::add_explrows() const
// mancano le righe, le inserisco
const char tipo_costo = cau.get("S11")[0];
const int livello = cau.get_int("I0");
const TString4 umroot(row.get(RMOVMAG_UM));
// mancano le righe, le inserisco
distinta.set_root(row.get(RMOVMAG_CODART));
distinta.explode(boom, FALSE, RAGGR_EXP_NONE, livello, "A");
TString codmag(codmag_rauto(r));
real prezzo(prezzo_rauto(r));
TRectype * linea_auto;
for (int newrow=0; newrow < boom.items() ; newrow++)
boom.destroy();
if (distinta.set_root(row.get(RMOVMAG_CODART),umroot,row.get_real(RMOVMAG_QUANT)))
{
TRiga_esplosione & riga_esp=(TRiga_esplosione & )(boom[newrow]);
linea_auto = new TRectype(row);
linea_auto->put(RMOVMAG_CODART, riga_esp.articolo());
linea_auto->put(RMOVMAG_UM, riga_esp.um());
linea_auto->put(RMOVMAG_QUANT, riga_esp.val());
if (codmag.not_empty())
linea_auto->put(RMOVMAG_CODMAG, codmag);
//if (!prezzo.is_zero())
articolo.read(riga_esp.articolo());
if (tipo_costo == 'U')
prezzo = articolo.get_real(ANAMAG_ULTCOS1);
else
if (tipo_costo == 'S')
prezzo = articolo.get_real(ANAMAG_COSTSTD);
linea_auto->put(RMOVMAG_PREZZO, prezzo);
linea_auto->put(RMOVMAG_NRIG, r+1+newrow);
linea_auto->put(RMOVMAG_ESPLOSA, TRUE);
//linea_auto->put(RMOVMAG_TIPORIGA, (char) riga_automatica);
//linea_auto->put(RMOVMAG_CODCAUS, codcaus);
b.insert_row(linea_auto);
added=TRUE;
distinta.explode(boom, TRUE, RAGGR_EXP_NONE, livello, "A");
TString codmag(codmag_rauto(r));
real prezzo(prezzo_rauto(r));
TRectype * linea_auto;
for (int newrow=0; newrow < boom.items() ; newrow++)
{
TRiga_esplosione & riga_esp=(TRiga_esplosione & )(boom[newrow]);
linea_auto = new TRectype(row);
linea_auto->put(RMOVMAG_CODART, riga_esp.articolo());
linea_auto->put(RMOVMAG_UM, riga_esp.um());
linea_auto->put(RMOVMAG_QUANT, riga_esp.val());
if (codmag.not_empty())
linea_auto->put(RMOVMAG_CODMAG, codmag);
//if (!prezzo.is_zero())
articolo.read(riga_esp.articolo());
if (tipo_costo == 'U')
prezzo = articolo.get_real(ANAMAG_ULTCOS1);
else
if (tipo_costo == 'S')
prezzo = articolo.get_real(ANAMAG_COSTSTD);
linea_auto->put(RMOVMAG_PREZZO, prezzo);
linea_auto->put(RMOVMAG_NRIG, r+1+newrow);
linea_auto->put(RMOVMAG_ESPLOSA, TRUE);
//linea_auto->put(RMOVMAG_TIPORIGA, (char) riga_automatica);
//linea_auto->put(RMOVMAG_CODCAUS, codcaus);
b.insert_row(linea_auto);
added=TRUE;
}
}
}
// ora ci sono, mi basta eliminare la riga "padre"
@ -311,7 +316,7 @@ int TMov_mag::force_update_bal()
}
// restituisce il valore dei dati
TLine_movmag & TMov_mag::line2data(int nrig) const
TLine_movmag& TMov_mag::line2data(int nrig) const
{
static TLine_movmag line;
TRecord_array & b = body();
@ -414,21 +419,20 @@ bool TMov_mag::unlock_anamag(const char *codart)
bool TMov_mag::lock_anamag(const char *codart)
{
TLocalisamfile anamag(LF_ANAMAG);
anamag.put(ANAMAG_CODART,codart);
bool insert_new=TRUE;
TString mess;
mess << "Il record di anagrafica dell'articolo ''"<< codart << "'' risulta essere già in uso.";
TTimed_breakbox bbox((const char *)mess,10);
do
KEY key = K_ENTER;
while (key != K_ESC)
{
if (anamag.read(_isequal,_testandlock)==NOERR)
return TRUE;
} while (bbox.run()!=K_ESC);
TString mess;
mess << "Il record di anagrafica dell'articolo ''"<< codart << "'' risulta essere già in uso.";
TTimed_breakbox bbox((const char *)mess,10);
key = bbox.run();
}
return FALSE;
}
@ -442,7 +446,6 @@ void TMov_mag::giac_putkey(TLocalisamfile & mag,TString16 annoes,TToken_string c
mag.put(MAG_LIVELLO,key2field(curr_key,RMOVMAG_LIVGIAC));
}
// aggiorna tutti i saldi in base alle modifiche fatte.
// il lock su anagrafica dovrebbe garantire il lock su tutte le
// giacenze dell'articolo
@ -557,8 +560,8 @@ int TMov_mag::update_balances(TRectype & magrec, const TLine_movmag &l,int rett_
umart.read();
real fc=umart.get_real("FC");
diff=((real)rett_sign) * l.quant() * fc;
diff_val= ((real)rett_sign) * l.quant() * l.prezzo();
diff=real(rett_sign) * l.quant() * fc;
diff_val= real(rett_sign) * l.quant() * l.prezzo();
if (caus.update_qta())
{
update_balance(magrec,"GIAC",diff* (real)caus.sgn(s_giac)); // update ..
@ -602,10 +605,10 @@ int TMov_mag::update_balances(TRectype & magrec, const TLine_movmag &l,int rett_
return 0;
}
void TMov_mag::update_balance(TRectype & magrec, const char * fieldname, real diff) const
int TMov_mag::update_balances(TRectype& magrec, int numrig, int rett_sign)
{
magrec.put(fieldname,magrec.get_real(fieldname)+diff);
const TLine_movmag& lmm = line2data(numrig);
return update_balances(magrec, lmm, rett_sign);
}
HIDDEN TEsercizi_contabili _esercizi;
@ -615,6 +618,10 @@ int TMov_mag::codice_esercizio(const TDate &d)
return _esercizi.date2esc(d);
}
void TMov_mag::update_balance(TRectype & magrec, const char * fieldname, real diff) const
{
magrec.put(fieldname,magrec.get_real(fieldname)+diff);
}
void zero_balances(TRectype & mag)
{
@ -634,7 +641,7 @@ void zero_balances(TRectype & mag)
mag.put(MAG_NLABEL,0);
}
void copy_oldbalances(TRectype & oldmag,TRectype & mag)
void copy_oldbalances(const TRectype& oldmag,TRectype & mag)
{
mag.put(MAG_GIAC,oldmag.get(MAG_GIAC));
mag.put(MAG_RIM,oldmag.get(MAG_RIM));
@ -660,8 +667,6 @@ void copy_oldbalances(TRectype & oldmag,TRectype & mag)
mag.put(MAG_NLABEL,0);
}
//**********************
bool rebuild_balances(const TString& annoes,
const TTipo_valorizz tipo_valorizz, const char* catven, const char* codlis)
@ -677,54 +682,59 @@ bool rebuild_balances(const TString& annoes,
bool ok=TRUE;
// Aggiorna il cazzillo per caricare eventuali date di chiusura e altre amenita' simili
_esercizi.update();
TEsercizi_contabili esercizi;
esercizi.update();
const int cod_pred_es = _esercizi.pred(atoi(annoes));
const int cod_pred_es = esercizi.pred(atoi(annoes));
TString16 pred_es; pred_es.format("%d",cod_pred_es);
const bool reset_giac = cod_pred_es != 0 ? _esercizi.esercizio(cod_pred_es).chiusura_mag() != TDate(NULLDATE) : TRUE;
const bool reset_giac = cod_pred_es != 0 ? esercizi.esercizio(cod_pred_es).chiusura_mag() != TDate(NULLDATE) : TRUE;
TString information;
// azzera tutte giacenze (ciclo sulle giacenze)
TCursor cur2(&rel2);
const long maxart=cur2.objects();
information.format("Ricostruzione saldi esercizio %s: azzeramento...",(const char *)annoes);
TProgind barra_art(maxart,information, FALSE, TRUE);
for (long a=0; a<maxart; a++)
if (maxart > 0)
{
barra_art.addstatus(1);
cur2=a;
TArticolo_giacenza & articolo=(TArticolo_giacenza &)cur2.file().curr();
if (articolo.lock_and_prompt(articolo.codice()))
information.format("Ricostruzione saldi esercizio %s: azzeramento...",(const char *)annoes);
TProgind barra_art(maxart,information, FALSE, TRUE);
cur2.freeze();
for (long a=0; a<maxart; a++)
{
if (reset_giac)
articolo.azzera_saldi(annoes);
barra_art.addstatus(1);
cur2=a;
TArticolo_giacenza & articolo=(TArticolo_giacenza &)cur2.curr();
if (articolo.lock_and_prompt(articolo.codice()))
{
if (reset_giac)
articolo.azzera_saldi(annoes);
else
articolo.riporta_saldi(pred_es, annoes, tipo_valorizz, catven, codlis);
articolo.unlock();
}
else
articolo.riporta_saldi(pred_es, annoes, tipo_valorizz, catven, codlis);
articolo.unlock();
}
else
ok=FALSE;
// do_events(); // Lo fa' gia' la addstatus
}
ok=FALSE;
}
}
// ricostruisce i saldi (ciclo sui movimenti)
TString filterexpr;
filterexpr << LF_MOVMAG << "->ANNOES==" << annoes;
TCursor cur(&rel,filterexpr); // cursore filtrato
const long maxmov=cur.objects();
information.format("Ricostruzione saldi esercizio %s: ricalcolo ...",(const char *)annoes);
TProgind barra_mov(maxmov,information, FALSE, TRUE);
for (long m=0; m<maxmov; m++)
if (maxmov > 0)
{
barra_mov.addstatus(1);
cur=m;
TMov_mag & mov_rec=(TMov_mag &)cur.file().curr();
if (!mov_rec.force_update_bal())
ok=FALSE;
}
cur.freeze();
information.format("Ricostruzione saldi esercizio %s: ricalcolo ...",(const char *)annoes);
TProgind barra_mov(maxmov,information, FALSE, TRUE);
for (long m=0; m<maxmov; m++)
{
barra_mov.addstatus(1);
cur=m;
TMov_mag & mov_rec=(TMov_mag &)cur.curr();
if (!mov_rec.force_update_bal())
ok=FALSE;
}
}
return ok;
}

View File

@ -70,12 +70,12 @@ void TForm_stampemg::codgruppogiac(TForm_item &cf, TToken_string &s)
bool TForm_stampemg::validate(TForm_item &cf, TToken_string &s)
{
static TString *last_um=NULL;
const TString code(s.get(0)); // prende il primo parametro, il codice del messaggio
TString subcode;
TString valore,levname;
const TFixed_string code = s.get(0); // prende il primo parametro, il codice del messaggio
if (code=="_USER") {
subcode=s.get();
if (code=="_USER")
{
const TFixed_string subcode = s.get();
TString valore,levname;
if (subcode=="GRUPPOGIAC") {
gruppogiac(cf,s);
@ -90,14 +90,16 @@ bool TForm_stampemg::validate(TForm_item &cf, TToken_string &s)
valore.rpad(25).cut(_artlev->packed_length(lv));
} while (--lv>0 && valore=="");
cf.set(valore);
} else if (subcode=="CATMER") {
valore=relation()->lfile(_ordering == ragg_fisc ? -600 : (_ordering == scat_merc ? -401 : -400)).get("S0");
cf.set(valore);
} else if (subcode=="CODCATMER") {
valore=relation()->lfile(LF_ANAMAG).get(_ordering == ragg_fisc ? "RAGGFIS" : "GRMERC");
if (_ordering != ragg_fisc)
valore.rpad(5).cut(_ordering == scat_merc ? 5:3);
if (_ordering != ragg_fisc)
{
valore.rpad(5);
valore.cut(_ordering == scat_merc ? 5 : 3);
}
cf.set(valore);
} else if (subcode=="LIVELLIGIAC") {
int lv=_tolivgiac;

View File

@ -735,7 +735,7 @@ void TMSP_line2::add_mastercode (TMaster_code *mc)
TMaster_code *TMSP_line2::get_mastercode (int i)
{
if (i>=0 && i < _mastercodes.items())
if (i>=0 && i < _mastercodes.items());
return (TMaster_code *) _mastercodes.objptr(i);
return NULL;
}
@ -2862,7 +2862,7 @@ bool TMSP_mask::do_test_art_row(int r, int c, bool signal)
currconstr->discard_line2(art2ndlev);
}
}
return signal == FALSE;
return c-2;
}
void TMSP_mask::do_test_art_2ndlevel(TMSP_line2 *art2ndlev, bool erase)
@ -2886,8 +2886,7 @@ void TMSP_mask::do_test_art_2ndlevel(TMSP_line2 *art2ndlev, bool erase)
bool changed=FALSE;
for (int b = 1; b <= LAST_BUCKET; b++)
{
const real r2=mc->leadtime()/days_per_bucket()+0.5;
const int b2=b-int(r2.integer());
const int b2=b-int(long(mc->leadtime()/days_per_bucket()+0.5));
if (b2>=0)
{
if (!erase)

View File

@ -84,16 +84,37 @@ void TStampa_schedeprovv::main_loop()
{
// filtro e regione
TString filter;
if (_m->get(F_FILTRO).not_empty())
{
TString filter(PROV_SALDATA);
filter = PROV_SALDATA;
if (_m->get(F_FILTRO)[0]=='P')
filter << "==\"X\"" ;
else
filter << "!=\"X\"" ;
filter << "!=\"X\"" ;
}
const TString & tipodoc = _m->get(F_TIPODOC);
if (tipodoc.not_empty())
{
frm.cursor()->relation()->add(LF_DOC, "CODNUM==CODNUM|ANNO==ANNO|PROVV==\"D\"|NDOC==NDOC");
bool not_empty = filter.not_empty();
if (not_empty)
{
filter.insert("(");
filter << ") && (";
}
filter << LF_DOC << "->TIPODOC == \"" << tipodoc << "\"";
if (not_empty)
filter << ")";
frm.cursor()->setfilter(filter, TRUE);
}
else
frm.cursor()->setfilter(filter);
} else
frm.cursor()->setfilter("");
TRectype start(LF_PROVV),end(LF_PROVV);
if (_m->get(F_DAAGE).not_empty())

View File

@ -659,9 +659,7 @@ END // end clienti
END // Fine body
/*
SECTION FOOTER ODD 3
SECTION FOOTER ODD 3
END // Fine footer
END // Fine Form
*/

View File

@ -5,3 +5,4 @@
#define F_RAGGCLI 105
#define F_FILTRO 106
#define F_DEFINITIVA 107
#define F_TIPODOC 108

View File

@ -1,10 +1,11 @@
#include "pr1300a.h"
PAGE "Stampa schede di provvigione" -1 -1 78 20
#include "pr1300a.h"
STRING F_DAAGE 6
PAGE "Stampa schede di provvigione" -1 -1 78 13
STRING F_DAAGE 5
BEGIN
PROMPT 2 1 "Dall'agente "
FLAGS "U"
PROMPT 2 1 "Da agente "
FLAGS "UZ"
USE LF_AGENTI
INPUT CODAGE F_DAAGE
DISPLAY "Codice" CODAGE
@ -13,10 +14,10 @@ BEGIN
GROUP G_CODAGE
END
STRING F_AAGE 6
STRING F_AAGE 5
BEGIN
PROMPT 2 3 " all'agente "
FLAGS "U"
PROMPT 35 1 "A agente "
FLAGS "UZ"
COPY USE F_DAAGE
INPUT CODAGE F_AAGE
COPY DISPLAY F_DAAGE
@ -24,9 +25,9 @@ BEGIN
GROUP G_CODAGE
END
LIST F_DEFINITIVA 30
LIST F_DEFINITIVA 15
BEGIN
PROMPT 2 5 " Stampa "
PROMPT 2 3 "Stampa "
ITEM "P|provvisoria"
MESSAGE ENABLE,F_FILTRO
ITEM "D|definitiva"
@ -35,7 +36,7 @@ END
LIST F_FILTRO 30
BEGIN
PROMPT 2 7 " Stampo "
PROMPT 35 3 "Stampo "
ITEM "|tutte le provvigioni"
ITEM "D|solo le provv. da pagare"
ITEM "P|solo le provv. gia' pagate"
@ -43,23 +44,35 @@ END
BOOL F_RAGGCLI
BEGIN
PROMPT 2 9 "Raggruppo i clienti"
PROMPT 2 5 "Raggruppo i clienti"
MESSAGE TRUE "X",F_RAGGDOC|DISABLE,F_RAGGDOC
MESSAGE FALSE ENABLE,F_RAGGDOC
END
BOOL F_RAGGDOC
BEGIN
PROMPT 2 11 "Raggruppo i documenti"
MESSAGE TRUE "X",F_RAGGRATE|DISABLE,F_RAGGRATE
MESSAGE FALSE ENABLE,F_RAGGRATE
PROMPT 35 5 "Raggruppo i documenti"
MESSAGE TRUE "X",F_RAGGRATE|DISABLE,F_RAGGRATE|"",F_TIPODOC|DISABLE, F_TIPODOC
MESSAGE FALSE ENABLE,F_RAGGRATE|ENABLE,F_TIPODOC
END
BOOL F_RAGGRATE
BEGIN
PROMPT 2 13 "Raggruppo le rate"
PROMPT 2 7 "Raggruppo le rate"
END
STRING F_TIPODOC 4
BEGIN
PROMPT 2 9 "Tipo doc. "
HELP "Codice tipo documento"
USE %TIP SELECT B3=="X"
INPUT CODTAB F_TIPODOC
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOC CODTAB
CHECKTYPE NORMAL
FLAG "UP"
END
BUTTON DLG_OK 10 2
BEGIN

View File

@ -1,3 +1,3 @@
87
0
$svstat|0|0|764|38|Archivio statistiche|||
$svstat|0|0|1430|38|Archivio statistiche|||

View File

@ -1,5 +1,5 @@
87
43
80
CODICE|1|60|0|Codice dell'oggetto della riga
LEVCODE|1|2|0|Codice del livello
LIVELLO|2|2|0|Livello di totale (0: totale generale; N: riga)
@ -43,5 +43,42 @@ R33|4|18|3|
R34|4|18|3|
R35|4|18|3|
R36|4|18|3|
Q0|4|18|3|Quantita' 1
Q1|4|18|3|
Q2|4|18|3|
Q3|4|18|3|
Q4|4|18|3|
Q5|4|18|3|
Q6|4|18|3|
Q7|4|18|3|
Q8|4|18|3|
Q9|4|18|3|
Q10|4|18|3|
Q11|4|18|3|
Q12|4|18|3|
Q13|4|18|3|
Q14|4|18|3|
Q15|4|18|3|
Q16|4|18|3|
Q17|4|18|3|
Q18|4|18|3|
Q19|4|18|3|
Q20|4|18|3|
Q21|4|18|3|
Q22|4|18|3|
Q23|4|18|3|
Q24|4|18|3|
Q25|4|18|3|
Q26|4|18|3|
Q27|4|18|3|
Q28|4|18|3|
Q29|4|18|3|
Q30|4|18|3|
Q31|4|18|3|
Q32|4|18|3|
Q33|4|18|3|
Q34|4|18|3|
Q35|4|18|3|
Q36|4|18|3|
1
CODICE+TIPO|

View File

@ -4,8 +4,9 @@
#include <msksheet.h>
#include <printer.h>
#include <progind.h>
#include <urldefid.h>
#include <recarray.h>
#include <tabutil.h>
#include <urldefid.h>
#include "../sc/scselect.h"
#include "../ve/velib.h"
@ -27,6 +28,7 @@ protected:
static bool save_handler(TMask_field& f, KEY k);
static bool sheet_notify(TSheet_field& s, int row, KEY k);
static bool fieldname_handler(TMask_field& f, KEY k);
static bool realfield_handler(TMask_field& f, KEY k);
static bool cambio_handler(TMask_field& f, KEY k);
public:
@ -114,6 +116,26 @@ bool TSchede_mask::fieldname_handler(TMask_field& f, KEY k)
return TRUE;
}
bool TSchede_mask::realfield_handler(TMask_field& f, KEY k)
{
if (k == K_F9)
{
TRelation rel(LF_DOC);
TRelation_description rd(rel);
if (rd.choose_field(f.get()))
{
f.set(rd.field_name());
TSchede_mask& m = (TSchede_mask&)f.mask();
TEdit_field& head = m.efield(S_HEAD);
TParagraph_string para(rd.field_desc(), head.size());
head.set(para.get(0));
m.set(S_DESCR, rd.field_desc());
m.set(S_IMPORTO, rd.field_type() == _realfld ? "X" : "");
}
}
return TRUE;
}
bool TSchede_mask::sheet_notify(TSheet_field& s, int row, KEY k)
{
@ -121,7 +143,10 @@ bool TSchede_mask::sheet_notify(TSheet_field& s, int row, KEY k)
switch(k)
{
case K_INS:
ok = s.items() < 8;
ok = s.items() < 8; // Posso aggiungere al massimo otto colonne di stampa
break;
case K_CTRL+K_INS:
s.row(row) = "F"; // Proponi una formula
break;
default:
break;
@ -133,19 +158,15 @@ void TSchede_mask::sheet2ini(short id)
{
TSheet_field& sheet = sfield(id);
TString_array& arr = sheet.rows_array();
for (int r = arr.last(); r >= 0; r--)
if (arr.row(r)[0] <= ' ')
arr.destroy(r);
arr.pack();
const char* field = id == F_SINTETICA ? "SynField" : "DetField";
const char* head = id == F_SINTETICA ? "SynHead" : "DetHead";
TConfig ini(CONFIG_STUDIO, "sv1100");
for (r = arr.last(); r >= 0; r--)
for (int r = arr.last(); r >= 0; r--)
{
TToken_string& row = arr.row(r);
ini.set(field, row.get(0), NULL, TRUE, r);
ini.set(field, row.get(1), NULL, TRUE, r);
ini.set(head, row.get(), NULL, TRUE, r);
}
ini.remove(field, arr.items());
@ -159,16 +180,28 @@ void TSchede_mask::ini2sheet(short id)
const char* field = id == F_SINTETICA ? "SynField" : "DetField";
const char* head = id == F_SINTETICA ? "SynHead" : "DetHead";
TRelation rel(LF_DOC);
const TRectype& rec = rel.curr();
TRelation_description rd(rel);
TConfig ini(CONFIG_STUDIO, "sv1100");
for (int r = 0; ; r++)
{
TString16 str = ini.get(field, NULL, r);
if (str.not_empty())
{
{
TToken_string& row = sheet.row(r);
row = str;
row = rec.exist(str) ? "C" : "F";
row.add(str);
row.add(ini.get(head, NULL, r));
sheet.check_row(r);
if (row[0] == 'C')
{
row.add(rd.get_field_description(str));
if (rec.type(str) == _realfld)
row.add("X");
}
else
sheet.check_row(r);
}
else
break;
@ -193,6 +226,7 @@ void TSchede_mask::init_sheet(short id)
sheet.set_notify(sheet_notify);
TMask& sm = sheet.sheet_mask();
sm.set_handler(S_FIELD, fieldname_handler);
sm.set_handler(S_REALFIELD, realfield_handler);
}
TSchede_mask::TSchede_mask()
@ -217,6 +251,7 @@ class TSchede_form : public TForm
{
public:
void init(const TSheet_field& sheet);
void init_pictures(const TMask& msk);
TSchede_form();
virtual ~TSchede_form() { }
@ -242,7 +277,7 @@ void TSchede_form::init(const TSheet_field& sheet)
{
if (riga < arr.items())
{
str = arr.row(riga).get(0);
str = arr.row(riga).get(1);
on = str.not_empty();
}
else
@ -254,7 +289,9 @@ void TSchede_form::init(const TSheet_field& sheet)
item.show(on);
if (on)
{
str = arr.row(riga).get(1);
str = arr.row(riga).get(2);
if (str.blank())
str = arr.row(riga).get(1);
item.set_col_head(str);
}
}
@ -274,9 +311,36 @@ void TSchede_form::init(const TSheet_field& sheet)
rows[3] = 0;
genera_fincatura(odd_page, rows[0], rows[2], rows);
genera_intestazioni(odd_page, hh-1);
TForm::genera_intestazioni(odd_page, hh-1);
}
void TSchede_form::init_pictures(const TMask& msk)
{
const TPrint_section& head = section('H', odd_page);
const int hh = head.height();
TForm::genera_intestazioni(odd_page, hh-1);
const bool in_valuta = msk.get_bool(F_INVALUTA);
const char tipo_stampa = msk.get(F_TIPO)[0];
TSheet_field& sheet = msk.sfield(tipo_stampa == 'D' ? F_DETTAGLIATA : F_SINTETICA);
const int imppos = sheet.cid2index(S_IMPORTO);
TPrint_section& body = section('B', odd_page);
const int campi = sheet.items()+2;
for (int c = 0; c < campi; c++)
{
TForm_item& fi = body.find_field(FF_FIRSTCOLUMN+c);
bool val = in_valuta;
if (val && c > 1)
{
bool importo = sheet.row(c-2).get_char(imppos) > ' ';
val &= importo;
}
fi.set_picture(val ? "##.###.###.###,@@" : "#.###.###.###.###");
}
}
///////////////////////////////////////////////////////////
// Main app
///////////////////////////////////////////////////////////
@ -284,15 +348,19 @@ void TSchede_form::init(const TSheet_field& sheet)
class TStampa_schede : public TApplication
{
TArray _file;
char _clifo; // <C>lienti o <F>ornitori
char _clifo; // <C>lienti o <F>ornitori
char _tipo; // <D>ettagliata o <S>intetica
char _sort; // <F>attura o <A>rticolo
char _prov; // <P>rovvisori o <D>efinitivi
bool _peragenti; // Stampa per agenti
TString _curagente; // Codice e descrizione agente corrente
TDate _fromdate, _todate; // Date limite
TString _fromnum, _tonum; // Numerazioni limite
TString _tipodoc; // Tipo documento limite
TArray _totali; // Totali complessivi
TArray _totriga; // Totali di riga
TArray _totage; // Totali per agente
long _progressivo; // Numero progressivo di record per file di stampa
TString _lastkey; // Ultima chiave del file di stampa temporaneo
@ -308,6 +376,7 @@ protected:
void put_real(TRectype& tab, int index, real val, real fc, bool importo, const TDocumento& doc);
void fill_key(TRectype& tab, const TDocumento& doc);
void fill_key(TRectype& tab, const TRiga_documento& rdoc);
static bool filtra_doc_per_stat(const TRelation* rel);
public:
void open_files(int logicnum, ...);
@ -317,8 +386,10 @@ public:
// stampa una riga documento (stampa dettagliata)
bool fill_rdoc(TRectype& tab, const TRiga_documento& rdoc);
void update_totriga(const TRectype& tab);
void update_totage(const TRectype& tab);
void fill_totriga(TRectype& tab);
void fill_tot(TRectype& tab);
void fill_totage(TRectype& tab);
bool write_tab(TLocalisamfile& tab) const;
bool write_totali_per_articolo(TLocalisamfile& tab);
@ -328,19 +399,19 @@ public:
bool stampa_dettagliata() const { return _tipo == 'D'; }
bool stampa_per_articolo() const { return _sort == 'A'; }
bool stampa_per_documento() const { return _sort == 'D'; }
bool stampa_per_agente() const { return _peragenti; }
bool stampa_clifo(TCursor& cur, const TString& ragsoc);
long clifo2index(TCursor_sheet& clifosheet, long codcf);
bool stampa_clifo(TCursor& cur, const TString& ragsoc, bool last_clifo);
bool stampa_selezione(TCursor& clifocur, const TSheet& clifosheet, const TString& filter);
};
void TStampa_schede::put_real(TRectype& tab, int index, real val,
real fc, bool importo, const TDocumento& doc)
{
char erre[4]; sprintf(erre, "R%d", index);
if (importo )
{
if (importo)
val *= fc;
val.round(0);
}
tab.put(erre, val);
real* r = (real*)_totali.objptr(index);
@ -434,7 +505,7 @@ bool TStampa_schede::fill_doc(TRectype& tab, const TDocumento& doc)
return FALSE;
// fattore di conversione per doc in valuta
real fc=converti_valute(*_mask,doc);
const real fc=converti_valute(*_mask,doc);
fill_key(tab, doc);
TString descr(80);
@ -452,20 +523,21 @@ bool TStampa_schede::fill_doc(TRectype& tab, const TDocumento& doc)
put_real(tab, 1, doc.totale_doc(), fc, TRUE, doc);
TSheet_field& sheet = _mask->sfield(F_SINTETICA);
const int fldpos = sheet.cid2index(S_FIELD);
const int imppos = sheet.cid2index(S_IMPORTO);
TString_array& arr = sheet.rows_array();
TString16 src;
for (int r = 0; r < arr.items(); r++)
{
TToken_string& row = arr.row(r);
src = row.get(0);
src = row.get(fldpos);
if (src.blank())
break;
const bool importo = row.get(3)[0] > ' ';
real val = doc.get(src);
const bool importo = row.get_char(imppos) > ' ';
const real val = doc.get(src);
put_real(tab, r+2, val, fc, importo, doc);
}
return TRUE;
}
@ -503,6 +575,7 @@ bool TStampa_schede::fill_rdoc(TRectype& tab, const TRiga_documento& rdoc)
descr << rdoc.get(RDOC_CODART) << ' ';
descr << rdoc.get(RDOC_DESCR);
}
descr.cut(50);
tab.put("S1", descr);
put_real(tab, 0, rdoc.importo(TRUE, FALSE, 0), fc, TRUE, doc); // importo netto scontato
@ -580,8 +653,7 @@ void TStampa_schede::fill_tot(TRectype& tab)
tab.zero();
tab.put("COD", "PRN");
tab.put("CODTAB", ++_progressivo);
tab.put("S0", "zzzzzzzzzzzzzzzzzzzz");
tab.put("S0", "yyyyyyyy"); // Si assicura che sia l'ultima prima dell'agente
tab.put("S1", "Totale");
tab.put("B8", TRUE); // Riga totale
@ -631,7 +703,44 @@ bool TStampa_schede::write_totali_per_articolo(TLocalisamfile& tab)
return ok;
}
bool TStampa_schede::stampa_clifo(TCursor& cur, const TString& ragsoc)
void TStampa_schede::update_totage(const TRectype& tab)
{
char erre[4];
for (int r = _totali.last(); r >= 0; r--)
{
sprintf(erre, "R%d", r);
const real val(tab.get(erre));
real* tot = (real*)_totage.objptr(r);
if (tot == NULL)
_totage.add(val, r);
else
*tot += val;
}
}
void TStampa_schede::fill_totage(TRectype& tab)
{
tab.zero();
tab.put("COD", "PRN");
tab.put("CODTAB", ++_progressivo);
TString80 descr;
descr << "Totale Agente " << _curagente;
descr.cut(50);
tab.put("S0", "zzzzzzzz"); // Mi assicuro che sia l'ultima riga
tab.put("S1", descr);
tab.put("B8", TRUE); // Riga totale
for (int r = _totage.last(); r >= 0; r--)
{
char erre[4]; sprintf(erre, "R%d", r);
tab.put(erre, (real&)_totage[r]);
}
}
bool TStampa_schede::stampa_clifo(TCursor& cur, const TString& ragsoc, bool last_clifo)
{
const long items = cur.items();
@ -655,7 +764,18 @@ bool TStampa_schede::stampa_clifo(TCursor& cur, const TString& ragsoc)
bool can_print = TRUE;
_form->find_field('H',odd_page,FF_TITOLO).set(stampa_clienti() ? "clienti" : "fornitori");;
TForm_item& tit = _form->find_field('H',odd_page,FF_TITOLO);
tit.set(stampa_clienti() ? "clienti" : "fornitori");
TForm_item& age = _form->find_field('H',odd_page,FF_AGENTE);
if (stampa_per_agente())
{
age.show();
age.set(_curagente);
}
else
age.hide();
for (cur = 0; cur.pos() < items && can_print; ++cur)
{
pi.addstatus(1);
@ -668,7 +788,11 @@ bool TStampa_schede::stampa_clifo(TCursor& cur, const TString& ragsoc)
if (stampa_sintetica())
{
if (fill_doc(curtab, doc))
{
can_print = write_tab(*tab);
if (can_print && stampa_per_agente())
update_totage(curtab);
}
}
else
{
@ -679,8 +803,13 @@ bool TStampa_schede::stampa_clifo(TCursor& cur, const TString& ragsoc)
if (fill_rdoc(curtab, rdoc))
{
can_print = write_tab(*tab);
if (stampa_per_documento())
update_totriga(curtab);
if (can_print)
{
if (stampa_per_documento())
update_totriga(curtab);
if (stampa_per_agente())
update_totage(curtab);
}
}
}
@ -692,21 +821,30 @@ bool TStampa_schede::stampa_clifo(TCursor& cur, const TString& ragsoc)
}
}
if (can_print && stampa_per_articolo())
can_print = write_totali_per_articolo(*tab);
if (can_print)
{
fill_tot(curtab);
can_print = write_tab(*tab);
if (can_print && tab->items() > 0)
{
if (can_print && stampa_per_articolo())
can_print = write_totali_per_articolo(*tab);
if (can_print)
{
fill_tot(curtab);
can_print = write_tab(*tab);
}
if (can_print && stampa_per_agente() && last_clifo)
{
fill_totage(curtab);
can_print = write_tab(*tab);
}
}
pi.close_modal();
if (can_print && tab->items() > 0)
{
TForm_item & col1=_form->find_field('B',odd_page,FF_FIRSTCOLUMN);
TForm_item & col2=_form->find_field('B',odd_page,FF_SECONDCOLUMN);
TForm_item& col1 = _form->find_field('B',odd_page,FF_FIRSTCOLUMN);
TForm_item& col2 = _form->find_field('B',odd_page,FF_SECONDCOLUMN);
if (stampa_sintetica())
{
col1.set_col_head("Base sconto");
@ -715,13 +853,96 @@ bool TStampa_schede::stampa_clifo(TCursor& cur, const TString& ragsoc)
col1.set_col_head("Netto scontato");
col2.set_col_head("Lordo scontato");
}
_form->genera_intestazioni( odd_page,8);
_form->init_pictures(*_mask);
_form->print();
}
_form->relation()->replace(new TLocalisamfile(LF_TAB));
return can_print;
}
bool TStampa_schede::filtra_doc_per_stat(const TRelation* rel)
{
const TString16 tipodoc = rel->curr().get(DOC_TIPODOC);
const TRectype& tipo = cache().get("%TIP", tipodoc);
const stat = tipo.get_bool("B2");
return stat;
}
bool TStampa_schede::stampa_selezione(TCursor& clifocur, const TSheet& clifosheet,
const TString& filter)
{
const long clifos = clifosheet.items();
long toprint = clifosheet.checked();
if (toprint == 0) toprint = clifos;
const bool all = toprint == clifos;
TString ragsoc;
TRelation rel(LF_DOC);
TRectype rec(LF_DOC);
bool cancel = FALSE;
for (clifocur = 0; clifocur.pos() < clifos && toprint > 0 && !cancel; ++clifocur)
{
if (all || clifosheet.checked(clifocur.pos()))
{
const char tipocf = clifocur.curr().get_char(CLI_TIPOCF);
const long codcf = clifocur.curr().get_long(CLI_CODCF);
ragsoc = tipocf == 'C' ? "Cliente" : "Fornitore";
ragsoc << ' ' << codcf << " - " << clifocur.file().get(CLI_RAGSOC);
rec.put(DOC_TIPOCF, tipocf);
rec.put(DOC_CODCF, codcf);
rec.put(DOC_PROVV, _prov);
// Uso la chiave 2: TIPOCF+CODCF+PROVV+ANNO+DATADOC+CODNUM+NDOC
TCursor cur(&rel, filter, 2, &rec, &rec);
cur.set_filterfunction(filtra_doc_per_stat);
if (cur.items() > 0)
{
cur.freeze();
cancel = !stampa_clifo(cur, ragsoc, toprint == 1);
cur.freeze(FALSE);
}
toprint--;
}
}
return !cancel;
}
long TStampa_schede::clifo2index(TCursor_sheet& clifosheet, long codcf)
{
long i = -1;
const int codpos = _mask->get_int(SC_SORTCF); // Posizione del codice clifo nello sheet
if (codpos == 1)
{
long a = 0;
long b = clifosheet.items()-1;
while (a <= b)
{
i = (a+b)/2;
const long clifo = clifosheet.row(i).get_long(codpos);
if (clifo == codcf)
break;
if (clifo > codcf)
b = i-1;
else
a = i+1;
}
}
else
{
for (i = clifosheet.items()-1; i >= 0; i--)
{
TToken_string& row = clifosheet.row(i);
long clifo = row.get_long(codpos);
if (clifo == codcf)
break;
}
}
return i;
}
bool TStampa_schede::menu(MENU_TAG mt)
@ -730,18 +951,19 @@ bool TStampa_schede::menu(MENU_TAG mt)
while (m.run() != K_QUIT)
{
_clifo = m.get(SC_CLIFO)[0];
_tipo = m.get(F_TIPO)[0];
_sort = m.get(F_ORDINE)[0];
_prov = m.get(F_PROVVIS)[0];
_fromdate = m.get_date(F_FROMDATE);
_todate = m.get_date(F_TODATE);
_fromnum = m.get(F_FROMNUM);
_tonum = m.get(F_TONUM);
_tipo = m.get(F_TIPO)[0];
_sort = m.get(F_ORDINE)[0];
_prov = m.get(F_PROVVIS)[0];
_peragenti = m.get_bool(F_SORTAGENTI);
_fromdate = m.get_date(F_FROMDATE);
_todate = m.get_date(F_TODATE);
_fromnum = m.get(F_FROMNUM);
_tonum = m.get(F_TONUM);
_tipodoc = m.get(F_TIPODOC);
_form->init(m.sfield(stampa_dettagliata() ? F_DETTAGLIATA : F_SINTETICA));
TString filter(80);
if (_fromdate.ok())
{
if (filter.not_empty()) filter << "&&";
@ -762,50 +984,104 @@ bool TStampa_schede::menu(MENU_TAG mt)
if (filter.not_empty()) filter << "&&";
filter << '(' << DOC_CODNUM << "<=\"" << _tonum << "\")";
}
if (_tipodoc.not_empty())
{
if (filter.not_empty()) filter << "&&";
filter << '(' << DOC_TIPODOC << "==\"" << _tipodoc << "\")";
}
const TCursor_sheet& clifosheet = m.cur_sheet();
TCursor_sheet& clifosheet = m.cur_sheet();
TCursor& clifocur = *clifosheet.cursor();
const long clifos = clifocur.items();
const bool all = clifosheet.checked() == 0;
TRelation rel(LF_DOC);
TRectype rec(LF_DOC);
TString ragsoc(80);
const long clifos = clifocur.items();
long toprint = clifosheet.checked();
const bool all = toprint == 0 || toprint == clifos;
bool cancel = FALSE;
if (all)
{
TString msg;
msg.format("Attenzione: e' stata selezionata la stampa di tutti i %s!\n"
"Si desidera continuare ugualmente?",
m.get_who() == 'C' ? "clienti" : "fornitori");
cancel = !yesno_box(msg);
}
for (clifocur = 0; clifocur.pos() < clifos && !cancel; ++clifocur)
{
if (all || clifosheet.checked(clifocur.pos()))
{
const long codcf = clifocur.file().get_long(CLI_CODCF);
ragsoc = m.get_who() == 'C' ? "Cliente" : "Fornitore";
ragsoc << ' ' << codcf << " - " << clifocur.file().get(CLI_RAGSOC);
if (stampa_per_agente())
{
TRelation relagenti(LF_AGENTI);
TRectype fromage(LF_AGENTI), toage(LF_AGENTI);
if (m.get(F_DAAGENTE).not_empty())
fromage.put(AGE_CODAGE, m.get(F_DAAGENTE));
if (m.get(F_ADAGENTE).not_empty())
toage.put(AGE_CODAGE, m.get(F_ADAGENTE));
TCursor curagenti(&relagenti, "", 1, &fromage, &toage);
const long ages = curagenti.items();
curagenti.freeze();
const TRectype& recagenti = curagenti.curr();
const int codpos = m.get_int(SC_SORTCF); // Posizione del codice clifo nello sheet
TAssoc_array selection;
if (!all)
{
// Crea la lista degli elementi selezionati dall'utente
for (long i = clifosheet.items()-1; i >= 0; i--)
{
if (clifosheet.checked(i))
{
TString16 codcf = clifosheet.row(i).get(codpos);
selection.add(codcf, NULL);
}
}
}
TRelation rel(LF_DOC);
TRectype rec(LF_DOC);
rec.put(DOC_TIPOCF, m.get_who());
for (curagenti = 0L; curagenti.pos() < ages && !cancel; ++curagenti)
{
_totage.destroy(); // Azzera totali agente
TString filterage(filter);
if (filterage.not_empty()) filterage << "&&";
filterage << '(' << DOC_CODAG << "==\"" << recagenti.get(AGE_CODAGE) << "\")";
TCursor cur(&rel, filterage, 2, &rec, &rec);
cur.set_filterfunction(filtra_doc_per_stat);
const long docs = cur.items();
rec.put(DOC_TIPOCF, m.get_who());
rec.put(DOC_CODCF, codcf);
rec.put(DOC_PROVV, _prov);
// Uso la chiave 2: TIPOCF+CODCF+PROVV+ANNO+DATADOC+CODNUM+NDOC
TCursor cur(&rel, filter, 2, &rec, &rec);
if (cur.items() > 0)
{
if (docs > 0)
{
clifosheet.uncheck(-1);
cur.freeze();
cancel = !stampa_clifo(cur, ragsoc);
for (cur = 0; cur.pos() < docs; ++cur)
{
const TString16 codcf = cur.curr().get(DOC_CODCF);
if (all || selection.is_key(codcf))
{
long i = clifo2index(clifosheet, atol(codcf));
if (i >= 0)
clifosheet.check(i);
}
}
cur.freeze(FALSE);
}
}
if (clifosheet.one_checked())
{
_curagente = recagenti.get(AGE_CODAGE);
_curagente << ' ' << recagenti.get(AGE_RAGSOC);
cancel = !stampa_selezione(clifocur, clifosheet, filterage);
}
}
}
}
}
else
{
_curagente.cut(0);
if (all)
{
TString msg;
msg.format("Attenzione: e' stata selezionata la stampa di tutti i %s!\n"
"Si desidera continuare ugualmente?",
m.get_who() == 'C' ? "clienti" : "fornitori");
cancel = !yesno_box(msg);
}
if (!cancel)
stampa_selezione(clifocur, clifosheet, filter);
}
}
return FALSE;
}

View File

@ -18,7 +18,7 @@ BEGIN
END
SECTION HEADER ODD 9
SECTION HEADER ODD 10
NUMERO 1
BEGIN
@ -109,6 +109,12 @@ BEGIN
PROMPT 2 6 ""
END
STRINGA FF_AGENTE
BEGIN
KEY "Agente completo"
PROMPT 2 7 "Agente "
END
END
SECTION BODY ODD -2 COLUMNWISE

View File

@ -12,18 +12,25 @@
#define F_VALUTA 109
#define F_CAMBIO 111
#define H_CAMBIO 112
#define F_TIPODOC 113
#define F_SORTAGENTI 114
#define F_DAAGENTE 115
#define F_ADAGENTE 116
#define F_SINTETICA 201
#define F_DETTAGLIATA 202
#define S_FIELD 101
#define S_HEAD 102
#define S_DESCR 103
#define S_IMPORTO 104
#define S_CAMBIO 105
#define FF_TITOLO 2
#define FF_FIRSTCOLUMN 102
#define S_FIELDTYPE 101
#define S_FIELD 102
#define S_REALFIELD 202
#define S_HEAD 103
#define S_DESCR 104
#define S_IMPORTO 105
#define S_CAMBIO 106
#define FF_TITOLO 2
#define FF_AGENTE 13
#define FF_FIRSTCOLUMN 102
#define FF_SECONDCOLUMN 103
#endif

View File

@ -87,25 +87,62 @@ BEGIN
FLAGS "HB"
END
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 9 "@bSelezione Agenti"
END
BOOLEAN F_SORTAGENTI
BEGIN
PROMPT 2 10 "Ordinamento per agenti"
MESSAGE FALSE CLEAR,F_DAAGENTE|CLEAR,F_ADAGENTE
MESSAGE TRUE ENABLE,F_DAAGENTE|ENABLE,F_ADAGENTE
END
NUMBER F_DAAGENTE 5
BEGIN
PROMPT 33 10 "Dall'agente "
FLAGS "DZ"
USE LF_AGENTI
INPUT CODAGE F_DAAGENTE
DISPLAY "Codice" CODAGE
DISPLAY "Ragione Sociale@50" RAGSOC
OUTPUT F_DAAGENTE CODAGE
CHECKTYPE NORMAL
ADD RUN pr0 -4
END
NUMBER F_ADAGENTE 5
BEGIN
PROMPT 59 10 "All'agente "
FLAGS "DZ"
COPY USE F_DAAGENTE
INPUT CODAGE F_ADAGENTE
COPY DISPLAY F_DAAGENTE
OUTPUT F_ADAGENTE CODAGE
CHECKTYPE NORMAL
ADD RUN pr0 -4
END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 10 "@bLimiti di stampa"
PROMPT 1 13 "@bLimiti di stampa"
END
DATE F_FROMDATE
BEGIN
PROMPT 2 11 "Dalla data "
PROMPT 2 14 "Dalla data "
MESSAGE CHECK,F_TODATE
END
DATE F_TODATE
BEGIN
PROMPT 2 12 "Alla data "
PROMPT 2 15 "Alla data "
END
STRING F_FROMNUM 4
BEGIN
PROMPT 51 11 "Dalla numerazione "
PROMPT 28 14 "Dalla numerazione "
FLAGS "U"
USE %NUM
INPUT CODTAB F_FROMNUM
@ -118,7 +155,7 @@ END
STRING F_TONUM 4
BEGIN
PROMPT 51 12 "Alla numerazione "
PROMPT 28 15 "Alla numerazione "
FLAGS "U"
COPY USE F_FROMNUM
INPUT CODTAB F_TONUM
@ -127,16 +164,28 @@ BEGIN
CHECKTYPE NORMAL
END
STRING F_TIPODOC 4
BEGIN
PROMPT 56 14 "Tipo documento "
FLAGS "U"
USE %TIP SELECT B2=="X"
INPUT CODTAB F_TIPODOC
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TIPODOC CODTAB
CHECKTYPE NORMAL
END
RADIOBUTTON F_PROVVIS 1 24
BEGIN
PROMPT 1 15 "@bTipo movimenti"
PROMPT 1 18 "@bTipo movimenti"
ITEM "D|Definitivi"
ITEM "P|Provvisori"
END
RADIOBUTTON F_TIPO 1 26
BEGIN
PROMPT 27 15 "@bTipo stampa"
PROMPT 27 18 "@bTipo stampa"
ITEM "S|Sintetica"
MESSAGE CLEAR,F_ORDINE
ITEM "D|Dettagliata"
@ -145,7 +194,7 @@ END
RADIOBUTTON F_ORDINE 1 24
BEGIN
PROMPT 55 15 "@bOrdinamento"
PROMPT 55 18 "@bOrdinamento"
ITEM "D|Documento"
ITEM "A|Articolo"
END
@ -154,11 +203,11 @@ ENDPAGE
PAGE "Opzioni" -1 -1 60 20
BOOL F_INVALUTA
BOOLEAN F_INVALUTA
BEGIN
PROMPT 1 1 "Stampa schede in valuta"
MESSAGE TRUE SHOW ,F_CAMBIO|SHOW ,F_VALUTA
MESSAGE FALSE HIDE ,F_CAMBIO|HIDE ,F_VALUTA
MESSAGE TRUE SHOW,F_CAMBIO|SHOW,F_VALUTA
MESSAGE FALSE HIDE,F_CAMBIO|HIDE,F_VALUTA
END
STRING F_VALUTA 3
@ -167,25 +216,26 @@ BEGIN
PROMPT 1 2 "Valuta "
USE %VAL
INPUT CODTAB F_VALUTA
DISPLAY "Codice valuta" CODTAB
DISPLAY "Descrizione @40" S0
DISPLAY "Codice valuta" CODTAB
DISPLAY "Descrizione @50" S0
OUTPUT F_VALUTA CODTAB
OUTPUT H_CAMBIO R10
CHECKTYPE REQUIRED
END
NUMBER F_CAMBIO 7 2
NUMBER F_CAMBIO 15 5
BEGIN
PROMPT 30 2 "Valore cambio "
PICTURE "####,@#"
NUM_EXPR (#F_CAMBIO!=0)
WARNING "Inserire il valore del cambio"
PICTURE ".5"
FLAGS "U"
CHECKTYPE REQUIRED
END
NUMBER H_CAMBIO 7 2
NUMBER H_CAMBIO 15 5
BEGIN
FLAGS "H"
PROMPT 42 1 "Valore cambio "
PICTURE ".5"
FLAGS "H"
END
TEXT DLG_NULL
@ -196,6 +246,7 @@ END
SPREADSHEET F_SINTETICA 0 8
BEGIN
PROMPT 1 4 ""
ITEM "F/C@3"
ITEM "Campo@12"
ITEM "Intestazione@17"
ITEM "Descrizione@50"
@ -210,6 +261,7 @@ END
SPREADSHEET F_DETTAGLIATA 0 8
BEGIN
PROMPT 1 14 ""
ITEM "F/C@3"
ITEM "Campo@12"
ITEM "Intestazione@17"
ITEM "Descrizione@50"
@ -222,9 +274,18 @@ ENDMASK
PAGE "Sheet 1" -1 -1 56 7
LIST S_FIELDTYPE 1 10
BEGIN
PROMPT 1 1 ""
ITEM "F|Formula"
MESSAGE SHOW,S_FIELD|HIDE,S_REALFIELD
ITEM "C|Campo"
MESSAGE HIDE,S_FIELD|SHOW,S_REALFIELD
END
STRING S_FIELD 15
BEGIN
PROMPT 1 1 "Nome campo "
PROMPT 15 1 ""
USE %FRD SELECT B0="X"
INPUT CODTAB S_FIELD
DISPLAY "Campo@15" CODTAB
@ -232,9 +293,17 @@ BEGIN
OUTPUT S_FIELD CODTAB
OUTPUT S_DESCR S0
OUTPUT S_IMPORTO B1
CHECKTYPE NORMAL
CHECKTYPE REQUIRED
END
STRING S_REALFIELD 15
BEGIN
PROMPT 15 1 ""
FLAGS "BH"
CHECKTYPE REQUIRED
END
STRING S_HEAD 17
BEGIN
PROMPT 1 2 "Intestazione "
@ -274,9 +343,18 @@ ENDMASK
PAGE "Sheet 2" -1 -1 56 7
LIST S_FIELDTYPE 1 10
BEGIN
PROMPT 1 1 ""
ITEM "F|Formula"
MESSAGE SHOW,S_FIELD|HIDE,S_REALFIELD
ITEM "C|Campo"
MESSAGE HIDE,S_FIELD|SHOW,S_REALFIELD
END
STRING S_FIELD 15
BEGIN
PROMPT 1 1 "Nome campo "
PROMPT 15 1 ""
USE %FRR SELECT B0="X"
INPUT CODTAB S_FIELD
DISPLAY "Campo@15" CODTAB
@ -287,6 +365,13 @@ BEGIN
CHECKTYPE NORMAL
END
STRING S_REALFIELD 15
BEGIN
PROMPT 15 1 ""
FLAGS "BH"
CHECKTYPE REQUIRED
END
STRING S_HEAD 17
BEGIN
PROMPT 1 2 "Intestazione "

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,22 @@
#ifndef __SV1200A_H
#define __SV1200A_H
#define F_CODICE 101
#define F_DESCR 102
#define F_FREQUENZA 203
#define F_MULTIPLO 204
#define F_NUMERO 205
#define F_PERIODO 206
#define F_RAFFRONTO 207
#define F_DATAINI 208
#define F_DATAFIN 209
#define F_DATARAF 210
#define F_TIPOART 211
#define F_TIPODATO 212
#define F_TIPOCALC 213
#define F_COL_ANNO 214
#define F_CHIAVE 222
#define F_CODICE 101
#define F_DESCR 102
#define F_FREQUENZA 203
#define F_MULTIPLO 204
#define F_NUMERO 205
#define F_PERIODO 206
#define F_RAFFRONTO 207
#define F_DATAINI 208
#define F_DATAFIN 209
#define F_DATARAF 210
#define F_TIPOART 211
#define F_TIPODATO 212
#define F_TIPOCALC 213
#define F_COL_ANNO 214
#define F_VALORI_UNITARI 215
#define F_CHIAVE 222
#define S_CAMPO 101

View File

@ -1,15 +1,15 @@
#include "sv1200a.h"
TOOLBAR "Toolbar" 0 20 0 3
TOOLBAR "Toolbar" 0 -3 0 3
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -13 -1 "~Stampa"
PROMPT -13 -11 "~Stampa"
END
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -23 -1 "~Registra"
PROMPT -23 -11 "~Registra"
MESSAGE EXIT,K_SAVE
PICTURE BMP_SAVEREC
PICTURE BMP_SAVERECDN
@ -17,28 +17,28 @@ END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -33 -1 "~Fine"
PROMPT -33 -11 "~Fine"
PICTURE BMP_QUIT
PICTURE BMP_QUITDN
END
ENDPAGE
PAGE "Generazione statistiche" -1 -1 80 20
PAGE "Generazione Statistiche" -1 -1 78 19
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 1 "@bStatistica "
PROMPT 1 0 "@bStatistica "
END
STRING F_CODICE 20
BEGIN
PROMPT 2 2 ""
PROMPT 2 1 ""
FLAGS "U"
USE PSV
INPUT CODTAB F_CODICE
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@60" S0
DISPLAY "Descrizione@50" S0
OUTPUT F_CODICE CODTAB
OUTPUT F_DESCR S0
OUTPUT F_MULTIPLO S9
@ -51,7 +51,7 @@ END
STRING F_DESCR 50
BEGIN
PROMPT 25 2 ""
PROMPT 25 1 ""
USE PSV KEY 2
INPUT S0 F_DESCR
DISPLAY "Descrizione@60" S0
@ -63,12 +63,12 @@ END
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 4 "@bRaggruppamento colonne"
PROMPT 1 3 "@bRaggruppamento colonne"
END
LIST F_FREQUENZA 1 15
BEGIN
PROMPT 2 5 "Frequenza base "
PROMPT 2 4 "Frequenza base "
ITEM "G|Giornaliera"
ITEM "S|Settimanale"
ITEM "Q|Quindicinale"
@ -83,12 +83,12 @@ END
LIST F_MULTIPLO 1 15
BEGIN
PROMPT 41 5 "Frequenza "
PROMPT 41 4 "Frequenza "
END
NUMBER F_NUMERO 3
BEGIN
PROMPT 74 5 ""
PROMPT 74 4 ""
FLAGS "U"
NUM_EXPR #THIS_FIELD>0
WARNING "Inserire un numero maggiore di zero"
@ -96,35 +96,33 @@ END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 7 "@bPeriodo"
PROMPT 1 6 "@bPeriodo"
END
NUMBER F_PERIODO 3
BEGIN
PROMPT 2 8 "Numero di colonne "
PROMPT 2 7 "Numero di colonne "
FLAGS "U"
NUM_EXPR (#THIS_FIELD>0)&&(#THIS_FIELD<37)
WARNING "Inserire compreso tra 1 e 36"
NUM_EXPR (#THIS_FIELD>=1)&&(#THIS_FIELD<=36)
WARNING "Inserire un numero compreso tra 1 e 36"
END
NUMBER F_RAFFRONTO 2
BEGIN
PROMPT 42 8 "Numero di colonne per raffronto "
PROMPT 42 7 "Numero di colonne per raffronto "
FLAGS "U"
// CHECKTYPE REQUIRED
WARNING "Inserire un numero di colonne positivo"
END
DATE F_DATAINI
BEGIN
PROMPT 2 9 "Dal "
PROMPT 2 8 "Dal "
CHECKTYPE REQUIRED
WARNING "Inserire una data iniziale"
WARNING "Inserire la data iniziale"
END
DATE F_DATAFIN
BEGIN
PROMPT 18 9 "Al "
PROMPT 18 8 "Al "
CHECKTYPE REQUIRED
VALIDATE DATE_CMP_FUNC > F_DATAINI
WARNING "Inserire una data superiore a quella iniziale"
@ -132,63 +130,73 @@ END
DATE F_DATARAF
BEGIN
PROMPT 53 9 "Raffronta dal "
PROMPT 53 8 "Raffronta dal "
VALIDATE DATE_CMP_FUNC <= F_DATAINI
WARNING "Inserire una data inferiore a quella iniziale"
END
NUMBER F_COL_ANNO 2
BEGIN
PROMPT 2 10 "Numero di colonne del periodo di base "
PROMPT 2 9 "Numero di colonne del periodo di base "
FLAGS "U"
CHECKTYPE REQUIRED
NUM_EXPR #THIS_FIELD>1
WARNING "Il periodo di base deve essere di almento due colonne"
END
GROUPBOX DLG_NULL 78 3
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 12 "@bSelezione"
PROMPT 1 11 "@bSelezione"
END
LIST F_TIPOART 1 11
BEGIN
PROMPT 2 13 "Tipo articolo "
PROMPT 2 12 "Tipo articolo "
ITEM "M|Merce"
ITEM "P|Prestazioni"
ITEM "O|Omaggi"
END
LIST F_TIPODATO 1 9
LIST F_TIPODATO 1 20
BEGIN
PROMPT 32 13 "dato "
ITEM "V|valori"
ITEM "Q|quantita'"
PROMPT 32 12 "Tipo di dati "
ITEM "V|Valori"
MESSAGE ENABLE,F_VALORI_UNITARI
ITEM "Q|Quantita'"
MESSAGE CLEAR,F_VALORI_UNITARI
ITEM "E|Valori e Quantita'"
MESSAGE ENABLE,F_VALORI_UNITARI
END
LIST F_TIPOCALC 1 11
BEGIN
PROMPT 54 13 "calcolo "
ITEM "V|venduto"
MESSAGE DISABLE,F_COL_ANNO
ITEM "P|progressivo"
MESSAGE ENABLE,F_COL_ANNO
ITEM "M|mobile"
MESSAGE ENABLE,F_COL_ANNO
PROMPT 2 13 "Tipo calcolo "
ITEM "V|Venduto"
MESSAGE CLEAR,F_COL_ANNO
ITEM "P|Progressivo"
MESSAGE ENABLE,F_COL_ANNO
ITEM "M|Mobile"
MESSAGE ENABLE,F_COL_ANNO
END
SPREADSHEET F_CHIAVE 78
BOOLEAN F_VALORI_UNITARI
BEGIN
PROMPT 1 15 ""
PROMPT 32 13 "Valori unitari"
END
ENDPAGE
PAGE "Criteri Raggruppamento" -1 -1 78 19
SPREADSHEET F_CHIAVE
BEGIN
PROMPT 1 1 ""
ITEM "Campo"
ITEM "Totale"
ITEM "Dal@20"
ITEM "Al@20"
ITEM "Dal@10"
ITEM "Al@10"
ITEM "Descrizione@50"
ITEM "Campo anagrafica\narticolo@17"
ITEM "Campo anagrafica@17"
END
ENDPAGE

View File

@ -1,15 +1,15 @@
#include "sv1200b.h"
TOOLBAR "Toolbar" 0 20 0 3
TOOLBAR "Toolbar" 0 -3 0 3
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -1 "~Stampa"
PROMPT -12 -11 "~Stampa"
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 "~Fine"
PROMPT -22 -11 "~Fine"
PICTURE BMP_QUIT
PICTURE BMP_QUITDN
END
@ -18,7 +18,6 @@ ENDPAGE
PAGE "Stampa statistiche" -1 -1 80 20
BOOL F_STRAFFRONTO
BEGIN
PROMPT 2 2 "Stampo il raffronto"

View File

@ -1,20 +1,21 @@
#include "sv1200c.h"
PAGE "Stampa statistiche" -1 -1 80 6
PAGE "Stampa statistiche" -1 -1 68 5
STRING F_FILENAME 80 40
STRING F_FILENAME 80 50
BEGIN
PROMPT 2 2 "Nome del file di output "
PROMPT 1 1 "Nome del file "
CHECKTYPE REQUIRED
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 4 ""
PROMPT -12 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -22 4 ""
PROMPT -22 -1 ""
END
ENDMASK

View File

@ -46,5 +46,6 @@
#define SVS_TOTALERIGA "R36"
#define SVS_NUMCOLONNE 36
#define SVS_COLNAME "R"
#define SVS_VALCOLNAME "R"
#define SVS_QTACOLNAME "Q"

View File

@ -234,7 +234,7 @@ bool TMotore_application::user_create( )
// Metto in relazione testata e righe
_rel = new TRelation( LF_DOC );
open_files(LF_RIGHEDOC, LF_CONDV, LF_RCONDV, LF_ANAMAG, LF_SCONTI, LF_UMART, LF_TAB, LF_TABCOM, LF_CLIFO,
LF_CFVEN, LF_INDSP, LF_OCCAS, LF_MOVMAG, LF_RMOVMAG, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, 0);
LF_CFVEN, LF_INDSP, LF_OCCAS, LF_MOVMAG, LF_RMOVMAG, LF_MAG, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, 0);
_rel->lfile().set_curr(new TDocumento);
_msk = new TMask("ve0100a");

View File

@ -189,6 +189,13 @@ FIELD BOLLIES
PICTURE "."
END
NUMBER F_IMPMINBOLLI 15
BEGIN
PROMPT 2 12 "Importo minimo per bolli esenti "
FIELD IMPMINBOLLI
PICTURE "."
END
ENDPAGE
PAGE "Automatismi" 1 1 60 14

View File

@ -31,46 +31,20 @@
#include <config.h>
#endif
#ifndef __APPLICATION_H
#include <applicat.h>
#endif
#ifndef __UTILITY_H
#include <utility.h>
#endif
#ifndef __PROGIND_H
#include <config.h>
#include <scanner.h>
#include <progind.h>
#endif
#ifndef __TABUTIL_H
#include <tabutil.h>
#endif
#ifndef __DEFMASK_H
#include <defmask.h>
#endif
#ifndef __RELATION_H
#include <relation.h>
#endif
#include <tabutil.h>
#include <urldefid.h>
#include <utility.h>
#ifndef __VEUML_H
#include "veuml.h"
#endif
#ifndef __VEUML1_H
#include "veuml1.h"
#endif
#ifndef __VEINI_H
#include "veini.h"
#endif
#ifndef __VE0100_H
#include "ve0100.h"
#endif
// Significato delle colonne nella tabella _tab0300b
#define B_NOME 0
@ -137,7 +111,7 @@ public:
void endmask( void ) { outline ( "ENDMASK" ); };
// FLAG
void flag( const TString& s ) { _out << "FLAG \"" << s << "\"\n"; };
void flag( const char* s ) { _out << "FLAG \"" << s << "\"\n"; };
// HELP
void help( const TString& s ) { _out << "HE \"" << s << "\"\n"; };
@ -150,7 +124,8 @@ public:
// PICTURE
void picture( const int p) { _out << "PI " << p << "\n"; };
void picture( const TString & s) { _out << "PI " << '\"' << s << "\"\n"; };
// void picture( const TString & s) { _out << "PI " << '\"' << s << "\"\n"; };
void picture( const char* s) { _out << "PI " << '\"' << s << "\"\n"; }
// FIELD
void field( const TString& s ) { outline( s, "FI "); };
@ -506,13 +481,12 @@ public:
int stato( ){ return _stato; }
int stato_reale( );
void nome( TString& nome ){ _nome = nome; }
void prompt( TString& prompt ){ _prompt = prompt; }
void flag( TString& flag ){ _flag = flag; }
void help( TString& help ){ _help = help; }
void warning( TString& warning ){ _warning = warning; }
void fieldname( TString& fieldname ){ _fieldname = fieldname; }
void nome( const TString& nome ){ _nome = nome; }
void prompt( const TString& prompt ){ _prompt = prompt; }
void flag( const TString& flag ){ _flag = flag; }
void help( const TString& help ){ _help = help; }
void warning( const TString& warning ){ _warning = warning; }
void fieldname( const TString& fieldname ){ _fieldname = fieldname; }
TString& nome( ){ return _nome; }
TString& prompt( ){ return _prompt; }
TString& flag( ){ return _flag; }
@ -1512,25 +1486,32 @@ void TMask_generator::genera( const TString& profilo )
{
_m->end( );
intestazione_pagina( );
}
}
// Generazione del campo con la giacenza della riga corrente
_m->control ( T_NUMERO, F_CURGIAC, 15 );
_m->begin( );
_m->prompt( 2, 6, "Giacenza riga corrente " );
_m->flag("D");
_m->picture(".5");
_m->end( );
// Generazione del listbox per i tipi di riga da aggiungere nello sheet
_m->control ( T_LISTA, F_LBTIPORIGA, 30 );
_m->begin( );
_m->prompt( 2, 6, "Tipo riga da aggiungere " );
_m->prompt( 2, 7, "Tipo riga da aggiungere " );
_m->end( );
// Generazione dello sheet : vedi il profilo
TScanner sheet_in( "ve0300b.dat" );
_m->_out << "SPREADSHEET " << F_SHEET << "\n";
_m->begin( );
_m->prompt( 2, 7 );
_m->prompt( 2, 8 );
do_events();
for( i = 0; i < _tab0300b.items( ); i ++ )
genera_item_sheet( _tab0300b.row( i ) );
_m->end( );
_m->end( );
// Generazione pagina dei piedi

View File

@ -360,7 +360,7 @@ NUMBER F_R_PREZZO 15
BEGIN
PROMPT 2 10 "Prezzo netto "
FIELD LF_RCONDV->PREZZO
PICTURE "."
PICTURE ".3"
END
@ -375,7 +375,7 @@ END
NUMBER F_R_PREZZO_LORDO 15
BEGIN
PROMPT 46 10 "Prezzo lordo "
PICTURE "."
PICTURE ".3"
FLAGS "H"
END

View File

@ -29,13 +29,13 @@ NUMBER FS_PREZZO 15
BEGIN
PROMPT 3 5 "Prezzo netto "
FIELD LF_UMART->PREZZO
PICTURE "###.###.###.###"
PICTURE ".3"
END
NUMBER FS_PREZZO_LORDO 15
BEGIN
PROMPT 3 6 "Prezzo lordo "
PICTURE "###.###.###.###"
PICTURE ".3"
END
BUTTON DLG_OK 9 2

View File

@ -251,6 +251,7 @@ bool TStampa_condizioni_vendita::set_print(int) {
da.put("CODRIGA", mask.get(F_DARIGA_A));
a.put("TIPORIGA", mask.get(F_TIPORIGHE));
a.put("CODRIGA", mask.get(F_ARIGA_A));
current_cursor()->setfilter("");
}
else // Elenco righe per articoli ma filtrate sul gruppo merceologico
{

View File

@ -76,6 +76,7 @@ void TStatus_change::main_loop()
rel.lfile().set_curr(doc);
for (cur = 0; cur.pos() < total && !pi.iscancelled(); ++cur)
{
pi.addstatus(1);
doc->put(DOC_STATO, finale);
doc->rewrite();
}

View File

@ -136,6 +136,7 @@
#define F_SCDRIGA 129
#define F_BOLLIES 130
#define F_OMDESC 131
#define F_IMPMINBOLLI 132
// Campi per ve0200g.uml
#define F_EXPLODEDB 101

View File

@ -711,6 +711,8 @@ public:
void doc2mask(bool reload_clifo = TRUE);
void mask2doc();
void update_giacenza();
TSheet_field& sheet() const { return *_sheet; }
TCodgiac_livelli& livelli() const { return *_livelli_giac; }
static bool num_handler( TMask_field& f, KEY key );
@ -835,6 +837,7 @@ public:
bool riferimenti_in_testa() const { return get_bool("B2"); }
bool ignora_descrizioni() const { return get_bool("B3"); }
const TString& codice_numerazione_iniziale() const { return get("S5"); }
const TString tipo_iniziale(int i) const { return get("S2").smid(i*4, 4).rtrim(); }
const char stato_iniziale(int i) const { return i < 5 ? get("S7")[i] : get("S10")[i - 5]; }
const TString& tipo_finale() const { return get("S8"); }
@ -843,7 +846,7 @@ public:
char tipo_numerazione() const { return get_bool("B4") ? 'P' : 'D'; }
const TString& codice_numerazione_finale() const { return get("S6"); }
const TString & applicazione_esterna() const { return get("S5"); }
const TString& applicazione_esterna() const { return get("S3"); }
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
const TDate& data_elab, bool interattivo = FALSE) pure;

View File

@ -1039,6 +1039,7 @@ real TDocumento::bolli(real & imp, int ndec, TTipo_importo t) const
static TArray sca_bolli;
static TArray imp_bolli;
static real bolli_es;
static real impmin_bolli;
static int nscagl;
TLocalisamfile clifo(LF_CLIFO);
short estero = 2;
@ -1050,6 +1051,7 @@ real TDocumento::bolli(real & imp, int ndec, TTipo_importo t) const
TConfig conf(CONFIG_STUDIO);
bolli_es = (real) conf.get("BOLLIES", "ve");
impmin_bolli = (real) conf.get("IMPMINBOLLI", "ve");
for (nscagl = 0; nscagl < 7; nscagl++)
{
real s(conf.get("SPBOSCA", "ve", nscagl + 1));
@ -1084,7 +1086,7 @@ real TDocumento::bolli(real & imp, int ndec, TTipo_importo t) const
const real imponibile = importo - imposte - imp_spese;
tot_bolli = ZERO;
if (_esenzione != NULL)
if (_esenzione != NULL && importo >= impmin_bolli)
tot_bolli = bolli_es;
pag.set_total(imponibile, imposte, imp_spese);
pag.set_rate_auto();
@ -1567,11 +1569,10 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
mov.put(MOVMAG_CODCONT, get("CODCONT"));
mov.put(MOVMAG_CODCAMP, get("CODCAMP"));
mov.put(MOVMAG_CODCAUS, get("CAUSMAG"));
TString8 codnum(numerazione());
mov.put(MOVMAG_DESCR, format("%s %s n. %ld del %s", (const char *) tipo().get("S1"),(const char *)codnum, numdoc, (const char *) d.string()));
mov.put(MOVMAG_TIPOCF, get("TIPOCF"));
mov.put(MOVMAG_CODCF, get("CODCF"));
TString80 descr;
descr.format("%s n.ro %ld del %s", (const char *)tipo().get("S1"), numdoc, (const char *)d.string());
mov.put(MOVMAG_DESCR, descr);
int j = 1;
real cambio = ZERO;
@ -2535,12 +2536,12 @@ void TDocumento::update_conai()
{
if (cli_add_conai)
{
real qta = calc_conai_qta(pos);
if (qta > ZERO)
r.put("QTA", qta);
else
destroy_row(i, TRUE);
}
real qta = calc_conai_qta(pos);
if (qta > ZERO)
r.put("QTA", qta);
else
destroy_row(i, TRUE);
}
else
destroy_row(i, TRUE);
updated[pos] = TRUE;
@ -2549,47 +2550,47 @@ void TDocumento::update_conai()
}
if (cli_add_conai)
{
TString16 cod_iva_cli = clifor().vendite().get("ASSFIS");
TSpesa_prest sp;
for (i = 0; i < 6; i++)
{
if (!updated[i])
{
real qta = calc_conai_qta(i);
if (qta > ZERO)
{
const TString & s = conai_sp.row(i);
if (sp.read(s) != NOERR)
message_box("Codice spesa %s assente", (const char *) s);
else
{
TString16 tipo(sp.tipo_riga());
TRiga_documento & riga = new_row(tipo);
riga.put("CODART", s);
riga.generata();
riga.put("GENTIPO", "C");
riga.put("DESCR", sp.descrizione());
riga.put("QTA", qta);
const real cambio = get_real("CAMBIO");
const TString16 valuta = get("CODVAL");
real prezzo = sp.prezzo();
sppr_calc(sp, valuta, cambio, prezzo);
riga.put("PREZZO", prezzo);
riga.put("UMQTA", sp.um());
if (cod_iva_cli.empty())
riga.put("CODIVA", sp.cod_iva());
else
riga.put("CODIVA", cod_iva_cli);
}
}
}
}
}
TString16 cod_iva_cli = clifor().vendite().get("ASSFIS");
TSpesa_prest sp;
for (i = 0; i < 6; i++)
{
if (!updated[i])
{
real qta = calc_conai_qta(i);
if (qta > ZERO)
{
const TString & s = conai_sp.row(i);
if (sp.read(s) != NOERR)
message_box("Codice spesa %s assente", (const char *) s);
else
{
TString16 tipo(sp.tipo_riga());
TRiga_documento & riga = new_row(tipo);
riga.put("CODART", s);
riga.generata();
riga.put("GENTIPO", "C");
riga.put("DESCR", sp.descrizione());
riga.put("QTA", qta);
const real cambio = get_real("CAMBIO");
const TString16 valuta = get("CODVAL");
real prezzo = sp.prezzo();
sppr_calc(sp, valuta, cambio, prezzo);
riga.put("PREZZO", prezzo);
riga.put("UMQTA", sp.um());
if (cod_iva_cli.empty())
riga.put("CODIVA", sp.cod_iva());
else
riga.put("CODIVA", cod_iva_cli);
}
}
}
}
}
}
}

View File

@ -201,12 +201,12 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
{
if (campione.raggruppabile()) // Se il documento ha il flag di raggruppabilita' ...
{
for (od = 0; od < tot; od++) // ... cerca un documento compatibile.
{
if (campione.raggruppabile(doc_out[od], campi_doc))
break;
}
}
for (od = 0; od < tot; od++) // ... cerca un documento compatibile.
{
if (campione.raggruppabile(doc_out[od], campi_doc))
break;
}
}
}
if (od >= tot) // Se non ho trovato un documento compatibile ...
{ // ... creane uno nuovo (certamente compatibile)

View File

@ -2072,7 +2072,11 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
righe.add(key, rc);
}
const real qta = rr.quantita();
const real imp = rr.importo(TRUE, FALSE);
real imp;
if (rr.exist("VALINTRA"))
imp = rr.get_real("VALINTRA");
else
imp = rr.importo(TRUE, FALSE);
const real imp_val = imp * cambio;
real ammlire = rc->get_real("AMMLIRE");
real ammvaluta = rc->get_real("AMMVALUTA");
@ -2084,7 +2088,10 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
ammvaluta += is_val ? imp : ZERO;
massakg += qta * rec_anamag.get_real(ANAMAG_MASSANUN);
massaums += qta * rec_anamag.get_real(ANAMAG_UNSUPPUN);
valstat += qta * rec_anamag.get_real(ANAMAG_VALSTATUN);
if (rr.exist("VALSTAT"))
valstat += rr.get_real("VALSTAT");
else
valstat += qta * rec_anamag.get_real(ANAMAG_VALSTATUN);
rc->put("AMMLIRE", ammlire);
rc->put("AMMVALUTA", ammvaluta);

View File

@ -197,7 +197,9 @@ TDocumento_mask::TDocumento_mask(const char* td)
pos = id2pos(F_DESCRMAGC);
if (pos >= 0)
fld(pos).show(has_movmag);
pos = id2pos(F_CURGIAC);
if (pos >= 0)
fld(pos).show(has_movmag);
}
TDocumento_mask::~TDocumento_mask()
@ -741,6 +743,51 @@ TVariable_mask* TDocumento_mask::riga_mask(int numriga)
return m;
}
void TDocumento_mask::update_giacenza()
{
if (id2pos(F_CURGIAC)<0 || !field(F_CURGIAC).shown())
return;
TSheet_field& sf = (TSheet_field&)field(F_SHEET);
TToken_string& row = sf.row(sf.selected());
const TString codart = row.get(sf.cid2index(FR_CODARTMAG));
real giac;
if (codart.not_empty())
{
const TString& annoes = get(F_ANNO);
TString16 codmag = row.get(sf.cid2index(FR_CODMAG));
const TString16 coddep = row.get(sf.cid2index(FR_CODDEP));
if (!coddep.blank())
codmag << coddep;
TString16 livello;
for (int i = 0; i < 4; i++)
{
const char* liv = row.get(sf.cid2index(FR_LIV1+i));
if (*liv > ' ')
livello << liv;
else
break;
}
TArticolo_giacenza art(codart);
giac = art.disponibilita(annoes, codmag, livello, TRUE);
TLocalisamfile umart(LF_UMART);
umart.setkey(2);
umart.put(UMART_CODART, codart);
umart.put(UMART_UM, row.get(sf.cid2index(FR_UMQTA)));
if (umart.read() == NOERR)
{
real curr_fc = umart.get_real(UMART_FC);
if (curr_fc > ZERO)
giac /= curr_fc;
}
}
set(F_CURGIAC, giac.string());
}
///////////////////////////////////////////////////////////
// Handlers and notifiers
///////////////////////////////////////////////////////////
@ -794,26 +841,27 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
else
{
s = m.get(F_CAUSMAG);
TTable c("%CAU");
c.put("CODTAB", s);
if (c.read() == NOERR)
s = c.get("S10");
const TRectype & c=cache().get("%CAU", s);
if (!c.empty() && !c.get("S10").blank())
s = c.get("S10");
else
{
s = m._std_mag;
s.left_just(3);
s << m._std_dep;
}
}
{
s = m._std_mag;
s.left_just(3);
s << m._std_dep;
}
}
riga.put("CODMAG", s);
riga.autoload(ss);
ss.check_row(r);
ss.select(r);
}
else
if ( key == K_TAB ) // modifica
if ( key == K_TAB ) // ingresso nella riga
{
set_curr_um(ss.sheet_mask());
m.update_giacenza();
}
return TRUE;
}
@ -956,7 +1004,7 @@ void TElabora_mask::update_list()
int items = 0;
if (from_elab)
items = _elab.select(elabs, tipo, stato, "", "" /*tipo_elab, stato_elab*/) ;
items = _elab.select(elabs, tipo, stato,"",""/*tipo_elab, stato_elab*/) ;
else
items = _elab.select(elabs, tipo_elab, stato_elab, tipo, stato) ;
@ -1093,15 +1141,18 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
TElaborazione * e = curr_elab();
const bool to_elab = get_bool(F_TYPE);
enable(-1, to_elab);
enable(-1, to_elab && e != NULL);
if (is_tipo_elaborazione)
reset(-1);
if (e != NULL)
{
{
if (to_elab)
{
{
TString8 num_in(e->codice_numerazione_iniziale());
TString8 tipo_in1;
char stato_in1;
if (tipo.not_empty())
{
filter << format("&&(TIPODOC==\"%s\")", (const char *)tipo);
@ -1127,6 +1178,11 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
filter << format("(STATO==\"%c\")", stato_in);
}
if (i==0)
{
tipo_in1=tipo_in;
stato_in1=stato_in;
}
}
if (almost_one)
filter << ')';
@ -1154,11 +1210,19 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
if (stato_in > '0')
filter << format("&&(STATO==\"%c\")", stato_in);
filter << ')';
if (i==0)
{
tipo_in1=tipo_in;
stato_in1=stato_in;
}
}
}
if (almost_one)
filter << ')';
}
set(F_CODNUM_ELAB, num_in);
set(F_TIPODOC_ELAB , tipo_in1);
set(F_STATODOC_ELAB, format("%c",stato_in1));
}
else
if (is_tipo_elaborazione)
@ -1176,13 +1240,13 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
const TString16 num_fin(e->codice_numerazione_finale());
set(F_CODNUM_ELAB, num_fin);
check_field(F_CODNUM_ELAB);
//check_field(F_CODNUM_ELAB);
set(F_TIPODOC_ELAB, tipo_fin);
check_field(F_TIPODOC_ELAB);
//check_field(F_TIPODOC_ELAB);
set(F_STATODOC_ELAB, stato_fin);
check_field(F_STATODOC_ELAB);
//check_field(F_STATODOC_ELAB);
}
}
}
efield(F_NDOC_ELAB).browse()->set_filter(filter);
}

View File

@ -77,6 +77,7 @@
#define F_CODNOTE 182
#define F_GOLEM 183
#define F_CAUSMAGC 184
#define F_CURGIAC 185
#define F_CODVAL1 200
#define F_NOMEVAL1 201
@ -87,5 +88,5 @@
#define F_ORDDA 206
#define F_ORDDADES 207
#define F_SELECT 101
//#define F_SELECT 101
#endif // veuml.h