Patch level : 02.0.369
Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione AGA 1.7 patch 349 git-svn-id: svn://10.65.10.50/trunk@10708 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e0c7629037
commit
c8d2a302e3
292
ba/ba1600.cpp
292
ba/ba1600.cpp
@ -141,12 +141,15 @@ int TInstall_ini::build_complete_list(const TString& module, TString_array& a,
|
||||
sum.set("Demo", demo() ? "X" : "");
|
||||
}
|
||||
// Lista dei file appartenenti ai sottomoduli del modulo principale (0-9)
|
||||
build_list(module, a, sommario, agg);
|
||||
build_list(module, a, sommario, agg);
|
||||
|
||||
TString_array b; //array locale temporaneo contenente la lista dei files da uccidere
|
||||
build_kill_list(module, b, sommario, agg);
|
||||
TAuto_token_string altri(get("Moduli", module));
|
||||
FOR_EACH_TOKEN(altri, mod)
|
||||
{
|
||||
const TString16 submodule = mod;
|
||||
// Lista dei files apparteneti ai sottomoduli esterni (moduli esclusi!)
|
||||
// Lista dei files appartenenti ai sottomoduli esterni (moduli esclusi!)
|
||||
if (submodule.len() > 2)
|
||||
build_list(submodule, a, sommario, agg);
|
||||
}
|
||||
@ -182,6 +185,45 @@ int TInstall_ini::build_app_list(const TString& module, TString_array& a)
|
||||
return a.items();
|
||||
}
|
||||
|
||||
//crea x ogni modulo il sottomodulo 10 con i files da accoppare
|
||||
int TInstall_ini::build_kill_list(const TString& module, TString_array& a,
|
||||
const char* sommario, bool agg)
|
||||
{
|
||||
CHECKS(module.len() >= 2, "Bad module ", (const char*)module);
|
||||
|
||||
TString paragraph;
|
||||
paragraph << module << 99;
|
||||
|
||||
TConfig* sum = NULL;
|
||||
if (sommario && *sommario)
|
||||
sum = new TConfig(sommario, paragraph); //va nei sottomoduli 99
|
||||
|
||||
TAuto_token_string tmp;
|
||||
|
||||
TAssoc_array& varlist = list_variables(paragraph);
|
||||
FOR_EACH_ASSOC_STRING(varlist, obj, key, str)
|
||||
{
|
||||
const bool is_kill = strncmp(key, "Kill", 4) == 0;
|
||||
// Quando creo il disco di aggiornamento prendo solo i file che devono essere uccisi
|
||||
if (is_kill)
|
||||
{
|
||||
tmp = str; // Nome e aggiornamento
|
||||
|
||||
if (agg && tmp.get_char(1) <= ' ') //non e' selezionato
|
||||
continue;
|
||||
if (sum)
|
||||
sum->set(key, tmp);
|
||||
|
||||
tmp.lower();
|
||||
a.add(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
if (sum)
|
||||
delete sum;
|
||||
|
||||
return a.items();
|
||||
}
|
||||
|
||||
void TInstall_ini::export_paragraph(const char* module, const char* summary,const bool remove_old)
|
||||
{
|
||||
@ -199,7 +241,9 @@ void TInstall_ini::export_paragraph(const char* module, const char* summary,cons
|
||||
{
|
||||
// substitute...
|
||||
sum.remove_all();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// merge...
|
||||
sum.build_list(main_module, old_list);
|
||||
sum.set_paragraph(module);
|
||||
@ -226,12 +270,14 @@ void TInstall_ini::export_paragraph(const char* module, const char* summary,cons
|
||||
THash_object* obj;
|
||||
TToken_string oldvalue;
|
||||
oldvars.restart();
|
||||
do {
|
||||
do
|
||||
{
|
||||
obj=oldvars.get_hashobj();
|
||||
oldvalue=((TString &)obj->obj());
|
||||
if (tmps == oldvalue.get(0))
|
||||
break;
|
||||
} while (obj);
|
||||
}
|
||||
while (obj);
|
||||
newkey=obj->key();
|
||||
if (old_smodule!=module)
|
||||
{
|
||||
@ -240,7 +286,9 @@ void TInstall_ini::export_paragraph(const char* module, const char* summary,cons
|
||||
sum.remove(newkey);
|
||||
sum.set_paragraph(module);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// nuovo file
|
||||
newkey = "File";
|
||||
newkey << '(' << last_file_num++ << ')';
|
||||
@ -265,6 +313,11 @@ void TInstall_ini::export_module_paragraphs(const char* module, const char* summ
|
||||
if (set_paragraph(mod))
|
||||
export_paragraph(mod, summary,remove_old);
|
||||
}
|
||||
// esporta la lista di eventuali files da eliminare (sono i killed)
|
||||
mod = module;
|
||||
mod << 99;
|
||||
if (set_paragraph(mod))
|
||||
export_paragraph(mod, summary,remove_old);
|
||||
|
||||
if (remove_old)
|
||||
{
|
||||
@ -314,9 +367,7 @@ int TInstall_ini::patch(const char* module)
|
||||
return patch;
|
||||
}
|
||||
|
||||
void TInstall_ini::version_info(const char* module,
|
||||
int& year, int& release,
|
||||
int& tag, int& patchlevel)
|
||||
void TInstall_ini::version_info(const char* module,int& year, int& release,int& tag, int& patchlevel)
|
||||
{
|
||||
TString ver = version(module);
|
||||
if (ver[0] == '9')
|
||||
@ -361,8 +412,7 @@ bool TInstall_ini::update_prices(const char* from)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TInstall_ini::prices(const char* module, word users,
|
||||
real& full, real& assist, bool correct_ass)
|
||||
void TInstall_ini::prices(const char* module, word users, real& full, real& assist, bool correct_ass)
|
||||
{
|
||||
real last_pac, last_ass;
|
||||
full = assist = 0.0;
|
||||
@ -437,13 +487,19 @@ class TMod_composition_msk : public TMask
|
||||
protected:
|
||||
static bool sheet_notify(TSheet_field& sf, int row, KEY key);
|
||||
static bool missing_notify(TSheet_field& sf, int row, KEY key);
|
||||
bool kill_missing(const char* name, bool update);
|
||||
static bool link_handler(TMask_field& f, KEY k);
|
||||
|
||||
static bool kill_notify(TSheet_field& sf, int row, KEY key); //metodo per la gestione della lista dei files da eliminare effettivamente
|
||||
static bool obsolete_notify(TSheet_field& sf, int row, KEY key); //metodo x riempire la lista dei files che si consiglia di eliminare
|
||||
bool kill_obsolete(const char* name, bool update); //metodi x eliminare i files dalla lista dei consigliati quando si aggiungono
|
||||
static bool obs_handler(TMask_field& f, KEY k); //alla lista definitiva di eliminazione
|
||||
|
||||
static bool file_handler(TMask_field& f, KEY k);
|
||||
static bool edit_handler(TMask_field& f, KEY k);
|
||||
static bool link_handler(TMask_field& f, KEY k);
|
||||
static bool deselect_handler(TMask_field& f, KEY k);
|
||||
static bool isam_handler(TMask_field& f, KEY k);
|
||||
|
||||
bool kill_missing(const char* name, bool update);
|
||||
static bool kill_handler(TMask_field& f, KEY k);
|
||||
|
||||
public:
|
||||
void load(const TString& module);
|
||||
@ -468,6 +524,21 @@ bool TMod_composition_msk::kill_missing(const char* name, bool update)
|
||||
return r >= 0;
|
||||
}
|
||||
|
||||
// Toglie il file dallo sheet degli ELIMINABILI
|
||||
bool TMod_composition_msk::kill_obsolete(const char* name, bool update)
|
||||
{
|
||||
TSheet_field& obs = sfield(F_OBSOLETE);
|
||||
FOR_EACH_SHEET_ROW_BACK(obs, r, row)
|
||||
{
|
||||
if (row->compare(name, -1, TRUE) == 0)
|
||||
{
|
||||
obs.destroy(r, update);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return r >= 0;
|
||||
}
|
||||
|
||||
bool TMod_composition_msk::sheet_notify(TSheet_field& sf, int r, KEY key)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
@ -557,6 +628,81 @@ bool TMod_composition_msk::sheet_notify(TSheet_field& sf, int r, KEY key)
|
||||
return ok;
|
||||
}
|
||||
|
||||
//metodo per la gestione dello sheet con la lista dei files da ELIMINARE effettivamente
|
||||
bool TMod_composition_msk::kill_notify(TSheet_field& sf, int r, KEY key)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
switch(key)
|
||||
{
|
||||
case K_TAB:
|
||||
// Posso cancellare solo le righe abilitate
|
||||
sf.sheet_mask().enable(DLG_DELREC, !sf.cell_disabled(r, 1));
|
||||
break;
|
||||
case K_ENTER:
|
||||
{
|
||||
TFilename mask = sf.row(r).get(0);
|
||||
if (mask.find('*') >= 0 || mask.find('?') >= 0)
|
||||
{
|
||||
TString_array arr; list_files(mask, arr);
|
||||
const int items = arr.items();
|
||||
|
||||
if (items > 0)
|
||||
{
|
||||
TMod_composition_msk& msk = (TMod_composition_msk&)sf.mask();
|
||||
TString_array & rows=msk.sfield(F_KILL).rows_array();
|
||||
|
||||
TFilename start;
|
||||
DIRECTORY dir; xvt_fsys_get_dir(&dir);
|
||||
xvt_fsys_convert_dir_to_str(&dir, start.get_buffer(), start.size());
|
||||
const int maxlen = start.len();
|
||||
|
||||
bool found = FALSE;
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
TString& file = arr.row(i);
|
||||
if (file.compare(start, maxlen, TRUE) == 0)
|
||||
file.ltrim(maxlen+1);
|
||||
file.lower();
|
||||
|
||||
msk.kill_obsolete(file, FALSE);
|
||||
|
||||
if (::find(file,rows)>=0)
|
||||
{
|
||||
TToken_string& row = sf.row(found ? -1 : r);
|
||||
row = file;
|
||||
row.add(" ");
|
||||
found = TRUE;
|
||||
}
|
||||
}
|
||||
// Se ne ho trovato almeno uno valido allora updato
|
||||
if (found)
|
||||
{
|
||||
sf.force_update();
|
||||
TSheet_field& miss = msk.sfield(F_OBSOLETE);
|
||||
miss.force_update();
|
||||
}
|
||||
}
|
||||
else
|
||||
ok = sf.error_box("Nessun file corrisponde a %s", mask.get_buffer());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case K_DEL:
|
||||
ok = !sf.cell_disabled(r, 1);
|
||||
if (ok)
|
||||
{
|
||||
// Sposto la riga cancellata nello sheet a fianco
|
||||
TSheet_field& miss = sf.mask().sfield(F_OBSOLETE);
|
||||
miss.row(-1) = sf.row(r).get(0);
|
||||
miss.force_update();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TMod_composition_msk::missing_notify(TSheet_field& sf, int r, KEY key)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
@ -581,7 +727,7 @@ bool TMod_composition_msk::missing_notify(TSheet_field& sf, int r, KEY key)
|
||||
ok = FALSE;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
bool TMod_composition_msk::file_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
@ -631,6 +777,17 @@ bool TMod_composition_msk::file_handler(TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TMod_composition_msk::kill_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k = K_TAB && f.focusdirty())
|
||||
{
|
||||
TMod_composition_msk& msk = (TMod_composition_msk&)f.mask().get_sheet()->mask();
|
||||
msk.kill_obsolete(f.get(), TRUE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TMod_composition_msk::edit_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
@ -673,6 +830,66 @@ bool TMod_composition_msk::link_handler(TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int obsolete_found(TConfig& cfg, void* jolly)
|
||||
{
|
||||
TAssoc_array& list = cfg.list_variables();
|
||||
TString_array& files = *(TString_array*)jolly; //castato jolly a TString_array; sono i files su disco
|
||||
FOR_EACH_ASSOC_STRING(list, hash, key, string)
|
||||
{
|
||||
if (strncmp(key, "File(", 5) == 0)
|
||||
{
|
||||
int pos = files.find(string);
|
||||
if (pos >=0)
|
||||
files.destroy(pos, TRUE); //se trova il file sia su disco che nell'ini -> lo toglie dall'elenco su disco
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// metodo per riempire lo sheet dei file che si CONSIGLIA di eliminare
|
||||
bool TMod_composition_msk::obsolete_notify(TSheet_field& sf, int r, KEY key)
|
||||
{
|
||||
if (key == K_INS) //la compilazione dello sheet avviene solo quando si preme il pulsante +
|
||||
{
|
||||
TWait_cursor hourglass;
|
||||
TString_array& elenco_dir = sf.rows_array(); //string_array che conterra' i files della directory
|
||||
elenco_dir.destroy(); //resetta l'elenco dei files della directory
|
||||
list_files("*.*", elenco_dir); //legge tutti i files della dir corrente e li mette in elenco_dir
|
||||
FOR_EACH_ARRAY_ROW(elenco_dir,i,row) //mette in minuscolo tutti i nomi di files su disco
|
||||
row->lower();
|
||||
//e' il file install.ini
|
||||
TInstall_ini ini;
|
||||
ini.for_each_paragraph(obsolete_found, &elenco_dir); //per ogni paragrafo dell'install.ini chiama la obsolete_found
|
||||
sf.force_update(); //aggiornamento dello sheet (di sinistra) sulla maschera
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//spostamento oggetti da sheet obsoleti a sheet con files da eliminare (sulla mask e' da destra a sinistra)
|
||||
bool TMod_composition_msk::obs_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
TMask& modmask = f.mask(); //maschera di riga dello sheet
|
||||
TSheet_field* sf = modmask.get_sheet();
|
||||
TMask& mainmask = sf->mask();
|
||||
TSheet_field& sheet = mainmask.sfield(F_KILL); //sheet sinistro della maschera di Eliminazione
|
||||
TToken_string& newrow = sheet.row(-1); //aggiunge una riga allo sheet...
|
||||
newrow = modmask.get(101); //..e ci mette il nome del file
|
||||
|
||||
if (modmask.is_running())
|
||||
{
|
||||
modmask.stop_run(K_ESC);
|
||||
do_events();
|
||||
}
|
||||
sf->destroy(sf->selected());
|
||||
sheet.force_update(); //update dello sheet sinistro della maschera di eliminazione (files condannati)
|
||||
sf->force_update();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool TMod_composition_msk::deselect_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
@ -727,12 +944,13 @@ void TMod_composition_msk::load(const TString& module)
|
||||
TWait_cursor hourglass;
|
||||
set(F_MODULE, module);
|
||||
|
||||
TInstall_ini ini;
|
||||
TSheet_field& s = sfield(F_SHEET);
|
||||
TInstall_ini ini; //install.ini
|
||||
|
||||
TSheet_field& s = sfield(F_SHEET); //legge da install.ini la lista dei files del modulo
|
||||
ini.build_list(module, s.rows_array());
|
||||
s.rows_array().TArray::sort(file_compare);
|
||||
|
||||
TSheet_field& p = sfield(F_PROGRAMS);
|
||||
TSheet_field& p = sfield(F_PROGRAMS); //la lista dei programmi tipo quelli x l'editing
|
||||
ini.build_app_list(module, p.rows_array());
|
||||
|
||||
TFilename mask;
|
||||
@ -742,6 +960,9 @@ void TMod_composition_msk::load(const TString& module)
|
||||
TString_array& arr = miss.rows_array();
|
||||
list_files(mask, arr);
|
||||
|
||||
TSheet_field& kill = sfield(F_KILL); //legge da install.ini la lista dei files da uccidere
|
||||
ini.build_kill_list(module, kill.rows_array());
|
||||
|
||||
const char* bad_ext[] = { "bsc", "mak", "obj", "pdb", "rc",
|
||||
"res", "sbr", "vcw", "wsp", NULL };
|
||||
|
||||
@ -847,6 +1068,15 @@ void TMod_composition_msk::save()
|
||||
n = prow->get(2);
|
||||
ini.set(var, n, sub);
|
||||
}
|
||||
|
||||
TSheet_field& kp = sfield(F_KILL);
|
||||
TString16 sub = module;
|
||||
sub << 99;
|
||||
FOR_EACH_SHEET_ROW(kp, kr, krow)
|
||||
{
|
||||
ini.set("Kill", *krow, sub, TRUE, kr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TMod_composition_msk::TMod_composition_msk(const bool modify_mode)
|
||||
@ -855,6 +1085,8 @@ TMod_composition_msk::TMod_composition_msk(const bool modify_mode)
|
||||
TSheet_field& s = sfield(F_SHEET);
|
||||
TSheet_field& miss = sfield(F_MISSING);
|
||||
TSheet_field& prog = sfield(F_PROGRAMS);
|
||||
TSheet_field& kill = sfield(F_KILL);
|
||||
TSheet_field& obs = sfield(F_OBSOLETE);
|
||||
set_handler(F_DESELECT, deselect_handler);
|
||||
if (modify_mode)
|
||||
{
|
||||
@ -865,13 +1097,17 @@ TMod_composition_msk::TMod_composition_msk(const bool modify_mode)
|
||||
miss.set_notify(missing_notify);
|
||||
miss.sheet_mask().set_handler(100, link_handler);
|
||||
prog.sheet_mask().set_handler(102, isam_handler);
|
||||
|
||||
obs.set_notify(obsolete_notify);
|
||||
obs.sheet_mask().set_handler(100, obs_handler);
|
||||
|
||||
kill.set_notify(kill_notify);
|
||||
kill.sheet_mask().set_handler(101, kill_handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.disable(); // Read-only sheet
|
||||
//hide(DLG_OK);
|
||||
// hide(F_DESELECT);
|
||||
//hide(DLG_CANCEL);
|
||||
|
||||
miss.hide();
|
||||
disable_page(1);
|
||||
}
|
||||
@ -1403,22 +1639,12 @@ bool TCreadischi_mask::import_export_handler(TMask_field& f, KEY k)
|
||||
if (is_export)
|
||||
{
|
||||
TInstall_ini inst;
|
||||
inst.export_module_paragraphs(module, path,TRUE);
|
||||
|
||||
/*TFconv_ini fconv;
|
||||
path = path.path();
|
||||
path.add(module); path << "fconv.ini";
|
||||
fconv.export_module(module, path);*/
|
||||
inst.export_module_paragraphs(module, path, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
TInstall_ini ini(path);
|
||||
ini.export_module_paragraphs(module, ini.default_name(),TRUE);
|
||||
|
||||
/*path = path.path();
|
||||
path.add(module); path << "fconv.ini";
|
||||
TFconv_ini fconv(path);
|
||||
fconv.export_module(module, "fconv.ini");*/
|
||||
ini.export_module_paragraphs(module, ini.default_name(), TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,8 @@ public:
|
||||
int build_complete_list(const TString& m, TString_array& a,
|
||||
const char* s = NULL, bool agg = FALSE);
|
||||
int build_app_list(const TString& m, TString_array& a);
|
||||
|
||||
int build_kill_list(const TString& m, TString_array& a,
|
||||
const char* s = NULL, bool agg = FALSE);
|
||||
void export_paragraph(const char* module, const char* summary,const bool remove);
|
||||
void export_module_paragraphs(const char* module, const char* summary,const bool remove);
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
//campi maschere ba1600a ba1600b
|
||||
#ifndef __BA1600A_H
|
||||
#define __BA1600A_H
|
||||
|
||||
@ -7,6 +8,8 @@
|
||||
#define F_MISSING 204
|
||||
#define F_MODULE 205
|
||||
#define F_PROGRAMS 206
|
||||
#define F_KILL 210
|
||||
#define F_OBSOLETE 211
|
||||
#define F_DESELECT 251
|
||||
|
||||
#define S_FILE 101
|
||||
|
@ -19,6 +19,7 @@ END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
//_______________________________________lista files del modulo____________________________________________________//
|
||||
PAGE "Lista" -1 -1 78 20
|
||||
|
||||
STRING F_MODULE 2
|
||||
@ -27,7 +28,8 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
SPREADSHEET F_SHEET 47
|
||||
//elenco files gia' presenti nella lista del modulo
|
||||
SPREADSHEET F_SHEET 47
|
||||
BEGIN
|
||||
PROMPT 1 1 ""
|
||||
ITEM "File@27"
|
||||
@ -35,6 +37,7 @@ BEGIN
|
||||
ITEM "Mod."
|
||||
END
|
||||
|
||||
//elenco files non presenti nella lista del modulo (che si consiglia di aggiungere)
|
||||
SPREADSHEET F_MISSING 20
|
||||
BEGIN
|
||||
PROMPT 50 1 ""
|
||||
@ -44,6 +47,7 @@ END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
//_________________________lista programmi da eseguire per cose tipo l'editing dei files di dati_________________//
|
||||
PAGE "Programmi" -1 -1 78 20
|
||||
|
||||
SPREADSHEET F_PROGRAMS 78
|
||||
@ -56,8 +60,28 @@ END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
//_______________________lista files da rimuovere dal programma__________________________________________________//
|
||||
PAGE "Eliminazione" -1 -1 78 20
|
||||
|
||||
SPREADSHEET F_KILL 44
|
||||
BEGIN
|
||||
PROMPT 1 1 ""
|
||||
ITEM "File@27"
|
||||
ITEM "Agg."
|
||||
END
|
||||
|
||||
SPREADSHEET F_OBSOLETE 20
|
||||
BEGIN
|
||||
PROMPT 50 1 ""
|
||||
ITEM "File@20"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
//___________________________maschera di riga dello spreadsheet dei files da aggiungere all'aggiornamento___________________//
|
||||
PAGE "File" -1 -1 52 5
|
||||
|
||||
STRING 101 35
|
||||
@ -102,6 +126,7 @@ ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
//______________________________maschera di riga dello spreadsheet dei files da aggiungere alla lista del modulo_________//
|
||||
PAGE "File" -1 -1 42 5
|
||||
|
||||
STRING 101 30
|
||||
@ -124,6 +149,7 @@ ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
//__________________________________maschera di riga dello spreadsheet dei prgrammi per l'editing dei dati___________________//
|
||||
PAGE "Programmi" -1 -1 64 5
|
||||
|
||||
LIST 101 4 10
|
||||
@ -165,4 +191,60 @@ END
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
//__________________________________maschera di riga dello spreadsheet dei files da eliminare____________________________//
|
||||
PAGE "Eliminazione file" -1 -1 52 5
|
||||
|
||||
STRING 101 35
|
||||
BEGIN
|
||||
PROMPT 1 1 "File "
|
||||
FLAGS "B"
|
||||
END
|
||||
|
||||
BOOLEAN 102
|
||||
BEGIN
|
||||
PROMPT 1 2 "Includi nell'aggiornamento"
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 10 2
|
||||
BEGIN
|
||||
PROMPT -23 -1 "~Elimina"
|
||||
PICTURE BMP_DELREC
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -33 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
//____________________maschera di riga dello spreadsheet dei files da aggiungere alla lista di quelli da eliminare_________//
|
||||
PAGE "File" -1 -1 42 5
|
||||
|
||||
STRING 101 30
|
||||
BEGIN
|
||||
PROMPT 1 1 "File "
|
||||
END
|
||||
|
||||
BUTTON 100 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 "~Elimina"
|
||||
PICTURE BMP_DELREC
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
@ -557,6 +557,7 @@ bool TInstaller_mask::move_file(const TFilename& from, const TFilename& file, co
|
||||
bool space_ok = FALSE;
|
||||
while (!space_ok)
|
||||
{
|
||||
|
||||
space_ok = os_test_disk_free_space(dest, filesize);
|
||||
if (!space_ok)
|
||||
{
|
||||
@ -614,7 +615,7 @@ bool TInstaller_mask::move_module(const TString& module, TInstall_ini& ini, bool
|
||||
if (!update)
|
||||
::remove(src);
|
||||
}
|
||||
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -836,6 +837,24 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok) //rimozione files da eliminare indicati nel .ini
|
||||
{
|
||||
TString killmod;
|
||||
killmod << module << 99;
|
||||
if (ini->set_paragraph(killmod))
|
||||
{
|
||||
TToken_string rigaini;
|
||||
TFilename filetokill;
|
||||
for (int k=0; ;k++)
|
||||
{
|
||||
rigaini = ini->get("Kill", NULL, k, "");
|
||||
if (rigaini.empty())
|
||||
break;
|
||||
filetokill = rigaini.get(0);
|
||||
::remove(filetokill);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok) // marca sull'install.ini di destinazione l'avvenuta installazione del modulo
|
||||
|
143
ba/ba7100.cpp
143
ba/ba7100.cpp
@ -433,7 +433,7 @@ TFilter_expr::TFilter_expr(TAutomask& m, int logicnum, const char* expr)
|
||||
if (ok)
|
||||
{
|
||||
if (logicnum < LF_USER || logicnum >= prefix().items())
|
||||
logicnum = LF_TABCOM;
|
||||
logicnum = LF_TABCOM; // Niente errori fatali, se possibile
|
||||
|
||||
TLocalisamfile isf(logicnum);
|
||||
TRectype& rec = isf.curr();
|
||||
@ -462,7 +462,8 @@ class TMailer_mask : public TAutomask
|
||||
TMail_messages _box;
|
||||
bool _sequential;
|
||||
|
||||
TString _last_file, _last_app; // Used by file2app
|
||||
TString_array _key1; // Elenco dei campi della chiave principale dei files
|
||||
TAssoc_array _apps; // Elenco delle applicazioni per processare i files
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
@ -475,6 +476,10 @@ protected:
|
||||
void save_sheet(TConfig& ini, short dlg, const char* var) const;
|
||||
void load_sheet(TConfig& ini, short dlg, const char* var);
|
||||
|
||||
TToken_string& get_key1(int lf) const;
|
||||
bool build_key1(int lf, const TString& body, TToken_string& key) const;
|
||||
void find_redundant_messages();
|
||||
|
||||
public:
|
||||
void test_delete();
|
||||
int fill_messages();
|
||||
@ -515,7 +520,7 @@ void TMailer_mask::test_delete()
|
||||
break;
|
||||
}
|
||||
if (!mailbox.remove(id))
|
||||
error_box("Impossibile cancellare il messagio POP3 %s", (const char*)id);
|
||||
error_box("Impossibile cancellare il messaggio POP3 %s", (const char*)id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -646,15 +651,16 @@ int TMailer_mask::fill_messages()
|
||||
|
||||
bool TMailer_mask::file2app(const TString& file, TString& app) const
|
||||
{
|
||||
bool ok = FALSE;
|
||||
if (file != _last_file)
|
||||
bool ok = FALSE;
|
||||
|
||||
const TString* run = (const TString*)_apps.objptr(file);
|
||||
if (run == NULL)
|
||||
{
|
||||
TConfig d(CONFIG_DITTA, "ba7");
|
||||
TString16 appname; appname << "Edit_" << file;
|
||||
app = d.get(appname);
|
||||
if (app.empty())
|
||||
{
|
||||
|
||||
if (isdigit(file[0]))
|
||||
{
|
||||
const int filenum = atoi(file);
|
||||
@ -676,14 +682,13 @@ bool TMailer_mask::file2app(const TString& file, TString& app) const
|
||||
}
|
||||
else
|
||||
ok = TRUE;
|
||||
// Fool const directive
|
||||
(TString&)_last_file = file;
|
||||
(TString&)_last_app = app;
|
||||
|
||||
((TMailer_mask*)this)->_apps.add(file, app); // Fool const
|
||||
}
|
||||
else
|
||||
{
|
||||
app = _last_app;
|
||||
ok = TRUE;
|
||||
app = *run;
|
||||
ok = app.not_empty();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -854,6 +859,96 @@ bool TMailer_mask::save_sheet_line(int& err, int nrow)
|
||||
return ok;
|
||||
}
|
||||
|
||||
TToken_string& TMailer_mask::get_key1(int lf) const
|
||||
{
|
||||
TString_array& k1 = (TString_array&)_key1; // fool const;
|
||||
if (k1.objptr(lf) == NULL)
|
||||
{
|
||||
TLocalisamfile file(lf);
|
||||
const RecDes* recd = file.curr().rec_des(); // Descrizione del record della testata
|
||||
const KeyDes& kd = recd->Ky[0]; // Elenco dei campi della chiave 1
|
||||
TToken_string key;
|
||||
for (int i = 0; i < kd.NkFields; i++)
|
||||
{
|
||||
const int nf = kd.FieldSeq[i] % MaxFields;
|
||||
const RecFieldDes& rf = recd->Fd[nf];
|
||||
key.add(rf.Name);
|
||||
}
|
||||
k1.add(key, lf);
|
||||
}
|
||||
return k1.row(lf);
|
||||
}
|
||||
|
||||
bool TMailer_mask::build_key1(int lf, const TString& body, TToken_string& key) const
|
||||
{
|
||||
key.format("%d", lf);
|
||||
|
||||
TString16 field; // Nome del campo chiave
|
||||
TString value; // Valore del campo chiave
|
||||
|
||||
TToken_string& key1 = get_key1(lf); // Elenco dei campi chiave
|
||||
FOR_EACH_TOKEN(key1, fld)
|
||||
{
|
||||
field = fld; field.insert("\n");
|
||||
const int start = body.find(field);
|
||||
if (start < 0)
|
||||
return FALSE;
|
||||
const int equal = body.find('=', start);
|
||||
if (equal < 0)
|
||||
return FALSE;
|
||||
const int stop = body.find('\n', equal);
|
||||
if (stop < 0)
|
||||
return FALSE;
|
||||
value = body.sub(equal+1, stop);
|
||||
value.trim();
|
||||
if (value[0] == '"' && value.right(1) == "\"") // Toglie eventuali virgolette
|
||||
{
|
||||
value.rtrim(1);
|
||||
value.ltrim(1);
|
||||
}
|
||||
key.add(value);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TMailer_mask::find_redundant_messages()
|
||||
{
|
||||
// Elenco dei records (chiavi primarie) già processati (virtualmente)
|
||||
TAssoc_array andreotti;
|
||||
|
||||
TSheet_field& sf = sfield(F_MESSAGES);
|
||||
TString subj, body;
|
||||
TToken_string key1;
|
||||
|
||||
// Scorro tutti i messaggi non ancora elaborati
|
||||
FOR_EACH_SHEET_ROW_BACK(sf, nrow, row) if (*row->get(0) != 'X')
|
||||
{
|
||||
row->get(sf.cid2index(F_BODY), body);
|
||||
if (body.find("[Transaction]") < 0) // Scarto i messaggi che non siano transazioni
|
||||
continue;
|
||||
|
||||
row->get(sf.cid2index(F_SUBJECT), subj);
|
||||
|
||||
int lfile = LF_TAB; // Numero logico del file
|
||||
if (isalpha(subj[0])) // Controlla se la tabella in realtà è comune ed aggiunge il simbolino %
|
||||
{
|
||||
TString8 para; para << '[' << LF_TABCOM << ']';
|
||||
if (body.find(para) > 0)
|
||||
lfile = LF_TABCOM;
|
||||
}
|
||||
else
|
||||
lfile = atoi(subj);
|
||||
|
||||
if (build_key1(lfile, body, key1))
|
||||
{
|
||||
if (andreotti.is_key(key1))
|
||||
row->add("R", 0); // Messaggio ridondante!
|
||||
else
|
||||
andreotti.add(key1); // Messaggio da processare!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TMailer_mask::save_all_lines()
|
||||
{
|
||||
TBrowsefile_field& bf = (TBrowsefile_field&)field(F_LOG);
|
||||
@ -869,12 +964,25 @@ void TMailer_mask::save_all_lines()
|
||||
d->tm_mday, d->tm_mon+1, 1900+d->tm_year,
|
||||
d->tm_hour, d->tm_min, d->tm_sec);
|
||||
vv.add_line(msg);
|
||||
|
||||
find_redundant_messages();
|
||||
|
||||
bool one_saved = FALSE;
|
||||
FOR_EACH_SHEET_ROW(sf, nrow, row)
|
||||
{
|
||||
msg.format("Messaggio %d ", nrow+1);
|
||||
if (*row->get(0) != 'X')
|
||||
const char mark = *row->get(0);
|
||||
|
||||
if (mark == 'X')
|
||||
msg << "ignorato in quanto già elaborato";
|
||||
|
||||
if (mark == 'R')
|
||||
{
|
||||
msg << "ignorato in quanto ridondante";
|
||||
row->add("X", 0); // Marcalo come elaborato comunque
|
||||
}
|
||||
|
||||
if (mark <= ' ')
|
||||
{
|
||||
row->get(sf.cid2index(F_BODY), body);
|
||||
if (body.find("[Transaction]") >= 0)
|
||||
@ -889,8 +997,7 @@ void TMailer_mask::save_all_lines()
|
||||
else
|
||||
if (err == NOT_GEST)
|
||||
{
|
||||
TSheet_field& sf = sfield(F_MESSAGES);
|
||||
TMask& m = sf.sheet_mask();
|
||||
const TMask& m = sf.sheet_mask();
|
||||
msg << " definire il programma gestore del file " << m.get(F_SUBJECT);
|
||||
}
|
||||
else
|
||||
@ -903,8 +1010,6 @@ void TMailer_mask::save_all_lines()
|
||||
else
|
||||
msg << "ignorato in quanto transazione non riconosciuta";
|
||||
}
|
||||
else
|
||||
msg << "ignorato in quanto già elaborato";
|
||||
vv.add_line(msg);
|
||||
}
|
||||
|
||||
@ -917,6 +1022,8 @@ void TMailer_mask::save_all_lines()
|
||||
vv.add_line("");
|
||||
vv.goto_end();
|
||||
|
||||
sf.force_update(); // Fai apparire tutte le X
|
||||
|
||||
#ifdef DBG
|
||||
if (one_saved && yesno_box("Si desidera eliminare i messaggi processati?"))
|
||||
#else
|
||||
@ -1088,14 +1195,14 @@ void TMailer_mask::auto_save_all()
|
||||
{
|
||||
if (_mail_semaphore == 0)
|
||||
{
|
||||
TSheet_field& sf = sfield(F_MESSAGES);
|
||||
#ifdef DBG
|
||||
if (yesno_box("Si desidera eliminare i messaggi processati?"))
|
||||
if (sf.items() > 0 && yesno_box("Si desidera eliminare i messaggi processati?"))
|
||||
#endif
|
||||
test_delete();
|
||||
fill_messages();
|
||||
if (!field(F_TIMER).empty())
|
||||
{
|
||||
TSheet_field& sf = sfield(F_MESSAGES);
|
||||
if (sf.items() > 0)
|
||||
save_all_lines();
|
||||
}
|
||||
|
535
ba/baeur0a.cpp
535
ba/baeur0a.cpp
@ -1,535 +0,0 @@
|
||||
#include <automask.h>
|
||||
#include <progind.h>
|
||||
#include <relation.h>
|
||||
#include <viswin.h>
|
||||
#include <browfile.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
#include "baeur.h"
|
||||
#include "baeura0.h"
|
||||
|
||||
#include "../cg/cg2103.h"
|
||||
#include "../cg/cglib01.h"
|
||||
|
||||
#include "mov.h"
|
||||
#include "partite.h"
|
||||
#include "rmov.h"
|
||||
#include "rmoviva.h"
|
||||
#include "saldi.h"
|
||||
#include "scadenze.h"
|
||||
|
||||
class TPirogano_mask : public TAutomask
|
||||
{
|
||||
TViswin* _log_win;
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
void convert_movs(long fr, long to);
|
||||
TViswin& log_win() { return *_log_win; }
|
||||
|
||||
TPirogano_mask();
|
||||
};
|
||||
|
||||
bool TPirogano_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case DLG_PRINT:
|
||||
if (e == fe_button)
|
||||
{
|
||||
_log_win->text().print();
|
||||
return FALSE; // Don't close
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TPirogano_mask::TPirogano_mask() : TAutomask("baeura0")
|
||||
{
|
||||
TBrowsefile_field& bf = (TBrowsefile_field&)field(F_LOG);
|
||||
_log_win = &bf.vis_win();
|
||||
}
|
||||
|
||||
class TPirogano_app : public TEuro_app
|
||||
{
|
||||
TPirogano_mask* _msk;
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
|
||||
public:
|
||||
void log_msg(TString& str);
|
||||
void log_war(TString& str);
|
||||
void log_err(TString& str);
|
||||
|
||||
void scadenze_handler(TRectype& rec, const TRectype& part, real& totrate);
|
||||
void convert_scad(const TRectype& part);
|
||||
bool partite_handler(TRectype& rec);
|
||||
void convert_part(long num_reg);
|
||||
|
||||
void update_saldo(const TRectype& rmov, int segno);
|
||||
void save_row(TEuroisamfile& rmov);
|
||||
void convert_rmovs(long num_reg, long num_rege);
|
||||
void convert_movs(long fr, long to);
|
||||
};
|
||||
|
||||
void TPirogano_app::log_msg(TString& str)
|
||||
{
|
||||
str.insert("- ");
|
||||
_msk->log_win().add_line(str);
|
||||
}
|
||||
|
||||
void TPirogano_app::log_war(TString& str)
|
||||
{
|
||||
str.insert("$[b,w]! ");
|
||||
_msk->log_win().add_line(str);
|
||||
}
|
||||
|
||||
void TPirogano_app::log_err(TString& str)
|
||||
{
|
||||
str.insert("$[r,w]* ");
|
||||
_msk->log_win().add_line(str);
|
||||
}
|
||||
|
||||
void TPirogano_app::update_saldo(const TRectype& rmov, int segno)
|
||||
{
|
||||
// File saldi in euro
|
||||
TEuroisamfile saldi(LF_SALDI, TRUE);
|
||||
TRectype& curr = saldi.curr();
|
||||
|
||||
TBill zio; zio.get(rmov);
|
||||
curr.zero();
|
||||
curr.put(SLD_ANNOES, rmov.get(RMV_ANNOES));
|
||||
curr.put(SLD_GRUPPO, zio.gruppo());
|
||||
curr.put(SLD_CONTO, zio.conto());
|
||||
curr.put(SLD_SOTTOCONTO, zio.sottoconto());
|
||||
curr.put(SLD_FLSCA, "");
|
||||
|
||||
const bool found = saldi.read(_isequal, _lock) == NOERR;
|
||||
if (!found)
|
||||
{
|
||||
curr.zero();
|
||||
curr.put(SLD_ANNOES, rmov.get(RMV_ANNOES));
|
||||
curr.put(SLD_GRUPPO, zio.gruppo());
|
||||
curr.put(SLD_CONTO, zio.conto());
|
||||
curr.put(SLD_SOTTOCONTO, zio.sottoconto());
|
||||
curr.put(SLD_FLSCA, "");
|
||||
}
|
||||
|
||||
const TImporto importo(rmov.get_char(RMV_SEZIONE), rmov.get_real(RMV_IMPORTO));
|
||||
const char* field = importo.sezione() == 'D' ? SLD_PDARE : SLD_PAVERE;
|
||||
real saldo = curr.get(field);
|
||||
if (segno < 0)
|
||||
saldo -= importo.valore();
|
||||
else
|
||||
saldo += importo.valore();
|
||||
curr.put(field, saldo);
|
||||
|
||||
const int err = found ? saldi.rewrite() : saldi.write();
|
||||
if (err != NOERR)
|
||||
{
|
||||
TString str;
|
||||
str << "Errore " << err << " durante l'aggiornamento dei saldi";
|
||||
log_err(str);
|
||||
}
|
||||
}
|
||||
|
||||
void TPirogano_app::save_row(TEuroisamfile& rmov)
|
||||
{
|
||||
const TRectype newrow = rmov.curr();
|
||||
TRectype oldrow(LF_RMOV);
|
||||
const bool found = rmov.read() == NOERR;
|
||||
if (found)
|
||||
oldrow = rmov.curr();
|
||||
rmov.curr() = newrow;
|
||||
const int err = found ? rmov.rewrite() : rmov.write();
|
||||
if (err != NOERR)
|
||||
{
|
||||
TString str;
|
||||
str << "Errore " << err << " durante la scrittura della riga " << rmov.get(RMV_NUMRIG);
|
||||
log_err(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (found)
|
||||
update_saldo(oldrow, -1);
|
||||
update_saldo(newrow, +1);
|
||||
}
|
||||
}
|
||||
|
||||
void TPirogano_app::convert_rmovs(long numreg, long numrege)
|
||||
{
|
||||
// File righe movimento in euro
|
||||
TEuroisamfile fileur(LF_RMOV, TRUE);
|
||||
TRectype& receur = fileur.curr();
|
||||
|
||||
TRelation rel(LF_RMOV);
|
||||
TRectype& curr = rel.curr();
|
||||
curr.put(MOV_NUMREG, numreg);
|
||||
TCursor cur(&rel, "", 1, &curr, &curr);
|
||||
const long items = cur.items();
|
||||
cur.freeze();
|
||||
|
||||
TImporto saldo;
|
||||
int last_rowe = 0;
|
||||
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
receur = curr;
|
||||
convert_import(receur, RMV_IMPORTO);
|
||||
saldo += TImporto(receur.get_char(RMV_SEZIONE), receur.get_real(RMV_IMPORTO));
|
||||
|
||||
last_rowe = receur.get_int(RMV_NUMRIG);
|
||||
receur.put(RMV_NUMREG, numrege);
|
||||
save_row(fileur);
|
||||
}
|
||||
|
||||
if (!saldo.is_zero())
|
||||
{
|
||||
receur.zero();
|
||||
receur.put(RMV_NUMREG, numrege);
|
||||
receur.put(RMV_NUMRIG, ++last_rowe);
|
||||
|
||||
TBill billy; load_round_bill(billy);
|
||||
billy.put(receur, FALSE);
|
||||
|
||||
saldo.swap_section();
|
||||
saldo.normalize();
|
||||
receur.put(RMV_SEZIONE, saldo.sezione());
|
||||
receur.put(RMV_IMPORTO, saldo.valore());
|
||||
|
||||
save_row(fileur);
|
||||
}
|
||||
}
|
||||
|
||||
void TPirogano_app::scadenze_handler(TRectype& rec, const TRectype& parte, real& totrate)
|
||||
{
|
||||
convert_import(rec, SCAD_IMPORTO);
|
||||
|
||||
if (!rec.get_real(SCAD_IMPORTOVAL).is_zero())
|
||||
{
|
||||
const TString& codval = parte.get(PART_CODVAL);
|
||||
if (codval.empty())
|
||||
rec.zero(SCAD_IMPORTOVAL);
|
||||
}
|
||||
|
||||
const int nrata = rec.get_int(SCAD_NRATA);
|
||||
if (nrata == 1)
|
||||
totrate = ZERO;
|
||||
totrate += rec.get_real(SCAD_IMPORTO);
|
||||
|
||||
// I problemi di arrotondamento dovrei averli solo con tante rate
|
||||
if (nrata > 1)
|
||||
{
|
||||
TLocalisamfile scad(LF_SCADENZE);
|
||||
scad.curr() = rec;
|
||||
scad.curr().put(SCAD_NRATA, nrata+1);
|
||||
if (scad.read() != NOERR) // Sono l'ultima rata
|
||||
{
|
||||
const real toteur = parte.get(PART_IMPTOTDOC);
|
||||
const real diff = toteur - totrate;
|
||||
if (diff != ZERO)
|
||||
{
|
||||
real rata = rec.get(SCAD_IMPORTO);
|
||||
rata += diff;
|
||||
rec.put(SCAD_IMPORTO, rata);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TPirogano_app::convert_scad(const TRectype& part)
|
||||
{
|
||||
// File destinazione in euro
|
||||
TEuroisamfile fileur(LF_SCADENZE, TRUE);
|
||||
TRectype& receur = fileur.curr();
|
||||
|
||||
TRelation rel(LF_SCADENZE);
|
||||
TRectype& curr = rel.curr();
|
||||
curr.put(SCAD_TIPOCF, part.get(PART_TIPOCF));
|
||||
curr.put(SCAD_GRUPPO, part.get(PART_GRUPPO));
|
||||
curr.put(SCAD_CONTO, part.get(PART_CONTO));
|
||||
curr.put(SCAD_SOTTOCONTO, part.get(PART_SOTTOCONTO));
|
||||
curr.put(SCAD_ANNO, part.get(PART_ANNO));
|
||||
curr.put(SCAD_NUMPART, part.get(PART_NUMPART));
|
||||
curr.put(SCAD_NRIGA, part.get(PART_NRIGA));
|
||||
|
||||
TCursor cur(&rel, "", 1, &curr, &curr); // Seleziona solo le rate interessate
|
||||
|
||||
const long items = cur.items();
|
||||
cur.freeze();
|
||||
real totrate;
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
receur = curr;
|
||||
scadenze_handler(receur, part, totrate);
|
||||
int err = fileur.write();
|
||||
if (err != NOERR)
|
||||
err = fileur.rewrite();
|
||||
if (err != NOERR)
|
||||
{
|
||||
TString str;
|
||||
str << "Errore " << err << " durante la scrittura della rata " << receur.get(SCAD_NRIGA);
|
||||
log_err(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TPirogano_app::partite_handler(TRectype& rec)
|
||||
{
|
||||
if (rec.get_bool(PART_CHIUSA) || rec.get_int(PART_NRIGA) == 9999)
|
||||
return FALSE;
|
||||
|
||||
zero_import(rec, PART_NREG); // Creo solo partite extra-contabili
|
||||
convert_import(rec, "IMPTOTDOC|IMPORTO|IMPOSTA|SPESE|RITENUTE|DIFFCAM");
|
||||
|
||||
const TString16 codval = rec.get(PART_CODVAL);
|
||||
if (::is_firm_value(codval))
|
||||
{
|
||||
convert_import(rec, PART_ABBUONI);
|
||||
zero_import(rec, "CODVAL|IMPORTOVAL|DIFFCAM");
|
||||
} else
|
||||
if (::is_euro_value(codval))
|
||||
{
|
||||
zero_import(rec, "CODVAL|IMPORTOVAL|DIFFCAM");
|
||||
} else
|
||||
if (::is_true_value(codval))
|
||||
{
|
||||
const real impval = rec.get(PART_IMPORTOVAL);
|
||||
if (impval != ZERO)
|
||||
{
|
||||
const real impeur = rec.get(PART_IMPORTO);
|
||||
const real old_cambio = rec.get(PART_CAMBIO);
|
||||
real new_cambio = impval / impeur;
|
||||
new_cambio.round(5);
|
||||
if (abs(old_cambio - new_cambio) > 0.001) // Non era già contro euro
|
||||
rec.put(PART_CAMBIO, new_cambio);
|
||||
}
|
||||
}
|
||||
|
||||
if (rec.get_int(PART_TIPOMOV) > 1)
|
||||
{
|
||||
// Riempe il campo totale documento per i pagamenti (In contabilità viene lasciato vuoto)
|
||||
rec.put(PART_IMPTOTDOC, rec.get(PART_IMPORTO));
|
||||
}
|
||||
|
||||
rec.put(PART_INVIATA, "X");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TPirogano_app::convert_part(long num_reg)
|
||||
{
|
||||
// File destinazione in euro
|
||||
TEuroisamfile fileur(LF_PARTITE, TRUE);
|
||||
TRectype& receur = fileur.curr();
|
||||
|
||||
TRelation rel(LF_PARTITE);
|
||||
TRectype& curr = rel.curr();
|
||||
curr.put(PART_NREG, num_reg);
|
||||
TCursor cur(&rel, "", 2, &curr, &curr); // Seleziona solo le partite interessate
|
||||
|
||||
const long items = cur.items();
|
||||
cur.freeze();
|
||||
TString str;
|
||||
|
||||
bool one_saved = FALSE;
|
||||
if (items > 0)
|
||||
{
|
||||
str << "Conversione della partita extracontabile " << curr.get(PART_ANNO);
|
||||
str << '/' << curr.get(PART_NUMPART);
|
||||
log_msg(str);
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
receur = curr;
|
||||
if (partite_handler(receur))
|
||||
{
|
||||
int err = fileur.write();
|
||||
if (err != NOERR)
|
||||
err = fileur.rewrite();
|
||||
if (err != NOERR)
|
||||
{
|
||||
str.cut(0) << "Errore " << err << " durante la scrittura della riga " << receur.get(PART_NRIGA);
|
||||
log_err(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
convert_scad(receur);
|
||||
one_saved = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!one_saved)
|
||||
{
|
||||
str = "Non sono state rilevate scadenze aperte";
|
||||
log_war(str);
|
||||
}
|
||||
}
|
||||
|
||||
void TPirogano_app::convert_movs(long fr, long to)
|
||||
{
|
||||
_msk->log_win().destroy_lines();
|
||||
|
||||
// File destinazione in euro
|
||||
TEuroisamfile fileur(LF_MOV, TRUE);
|
||||
TRectype& receur = fileur.curr();
|
||||
|
||||
long next_rege = 1;
|
||||
if (fileur.last() == NOERR)
|
||||
next_rege = receur.get_long(MOV_NUMREG)+1;
|
||||
|
||||
TRelation rel(LF_MOV);
|
||||
TRectype& curr = rel.curr();
|
||||
|
||||
TRectype fr_mov(curr); if (fr > 0) fr_mov.put(MOV_NUMREG, fr);
|
||||
TRectype to_mov(curr); if (to > 0) to_mov.put(MOV_NUMREG, to);
|
||||
TCursor cur(&rel, "", 1, &fr_mov, &to_mov);
|
||||
|
||||
TString str;
|
||||
str << "Conversione " << rel.lfile().description() << " ...";
|
||||
|
||||
const long items = cur.items();
|
||||
cur.freeze();
|
||||
TProgind pi(items, str, FALSE, TRUE);
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
|
||||
const long num_reg = curr.get_long(MOV_NUMREG);
|
||||
const TDate datareg = curr.get(MOV_DATAREG);
|
||||
const int yearreg = datareg.year();
|
||||
const long clifo = curr.get_long(MOV_CODCF);
|
||||
|
||||
const TString8 caus = curr.get(MOV_CODCAUS);
|
||||
TipoIVA iva = nessuna_iva;
|
||||
int tipomov = 0;
|
||||
if (caus.not_empty())
|
||||
{
|
||||
TCausale causale(caus, yearreg);
|
||||
iva = causale.iva();
|
||||
tipomov = causale.tipomov();
|
||||
}
|
||||
|
||||
bool converted = FALSE;
|
||||
if (yearreg == 2002 && iva == nessuna_iva && tipomov == 0)
|
||||
{
|
||||
receur = curr;
|
||||
convert_import(receur, MOV_TOTDOC); // Forse inutile
|
||||
|
||||
int err = 0;
|
||||
long num_rege = curr.get_long("TNUMREG");
|
||||
if (num_rege <= 0)
|
||||
{
|
||||
num_rege = next_rege++;
|
||||
curr.put("TNUMREG", num_rege);
|
||||
rel.rewrite();
|
||||
}
|
||||
receur.put(MOV_NUMREG, num_rege);
|
||||
|
||||
str.cut(0) << "Conversione del movimento " << num_reg << " -> " << num_rege;
|
||||
log_msg(str);
|
||||
|
||||
err = fileur.write();
|
||||
if (err != NOERR)
|
||||
err = fileur.rewrite();
|
||||
|
||||
if (err != NOERR)
|
||||
{
|
||||
str.cut(0) << "Errore " << err << " durante la scrittura della testata";
|
||||
log_err(str);
|
||||
}
|
||||
convert_rmovs(num_reg, num_rege);
|
||||
converted = TRUE;
|
||||
}
|
||||
if (yearreg == 2001 && iva != nessuna_iva && tipomov == 1)
|
||||
{
|
||||
str.cut(0) << "Elaborazione della partita del movimento " << num_reg;
|
||||
log_msg(str);
|
||||
convert_part(num_reg);
|
||||
converted = TRUE;
|
||||
}
|
||||
|
||||
if (!converted)
|
||||
{
|
||||
str.cut(0) << "Ignorato movimento " << num_reg << " del " << datareg;
|
||||
if (caus.not_empty()) str << " con causale " << caus;
|
||||
log_war(str);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
_msk->log_win().goto_end();
|
||||
}
|
||||
|
||||
void TPirogano_app::main_loop()
|
||||
{
|
||||
open_files(LF_TABCOM, LF_TAB, LF_MOV, LF_RMOV, LF_CAUSALI, LF_SALDI, LF_PARTITE, LF_SCADENZE, 0);
|
||||
|
||||
TFilename dati, datie;
|
||||
get_aree_dati(dati, datie);
|
||||
|
||||
_msk = new TPirogano_mask;
|
||||
TMask& m = *_msk;
|
||||
m.set(F_DATI, dati);
|
||||
m.set(F_DATIE, datie);
|
||||
|
||||
const long firm = get_firm();
|
||||
TString8 ditta;
|
||||
ditta.format("%05ldA", firm);
|
||||
TFilename inie = datie;
|
||||
inie.add(ditta);
|
||||
inie.add("prassid.ini");
|
||||
|
||||
KEY k = K_ENTER;
|
||||
while (k == K_ENTER)
|
||||
{
|
||||
if (inie.exist())
|
||||
{
|
||||
TConfig config(inie, "Euro");
|
||||
m.set(F_ADOZIONE, config.get("Adozione"));
|
||||
m.set(F_LAST_DATE, config.get("InvDate"));
|
||||
m.set(F_LAST_FROM, config.get("InvFirst"));
|
||||
m.set(F_LAST_TO, config.get("InvLast"));
|
||||
}
|
||||
else
|
||||
{
|
||||
error_box("Non esiste la ditta %ld nell'area dati in Euro %s", firm, (const char*)datie);
|
||||
m.disable(DLG_OK);
|
||||
}
|
||||
|
||||
k = m.run();
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
const long fr_mov = m.get_long(F_MOV_FROM);
|
||||
const long to_mov = m.get_long(F_MOV_TO);
|
||||
|
||||
convert_movs(fr_mov, to_mov);
|
||||
|
||||
TConfig config(inie, "Euro");
|
||||
config.set("InvDate", TDate(TODAY));
|
||||
config.set("InvFirst", fr_mov);
|
||||
config.set("InvLast", to_mov);
|
||||
}
|
||||
}
|
||||
|
||||
delete _msk;
|
||||
_msk = NULL;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// main
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
int baeur0A(int argc, char* argv[])
|
||||
{
|
||||
TPirogano_app app;
|
||||
app.run(argc, argv, "Trasferimento movimenti 2002");
|
||||
return 0;
|
||||
}
|
16
ba/baeura0.h
16
ba/baeura0.h
@ -1,16 +0,0 @@
|
||||
#define F_DITTA 101
|
||||
#define F_RAGSOC 102
|
||||
#define F_DATI 103
|
||||
#define F_DATIE 104
|
||||
#define F_ADOZIONE 105
|
||||
|
||||
#define F_LAST_DATE 111
|
||||
#define F_LAST_FROM 112
|
||||
#define F_LAST_TO 113
|
||||
|
||||
#define F_MOV_FROM 121
|
||||
#define F_DES_FROM 122
|
||||
#define F_MOV_TO 123
|
||||
#define F_DES_TO 124
|
||||
|
||||
#define F_LOG 130
|
131
ba/baeura0.uml
131
ba/baeura0.uml
@ -1,131 +0,0 @@
|
||||
#include "baeura0.h"
|
||||
|
||||
TOOLBAR "" 0 -2 0 2
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -11 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_PRINT 10 2
|
||||
BEGIN
|
||||
PROMPT -23 -11 ""
|
||||
PICTURE BMP_PRINT
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -33 -11 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Trasferimento movimenti 2002" 0 0 80 18
|
||||
|
||||
GROUPBOX DLG_NULL 78 6
|
||||
BEGIN
|
||||
PROMPT 1 1 "@bDitta da convertire"
|
||||
END
|
||||
|
||||
NUMBER F_DITTA 5
|
||||
BEGIN
|
||||
PROMPT 2 2 "Ditta "
|
||||
USE LF_NDITTE
|
||||
INPUT CODDITTA F_DITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "DF"
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 21 2 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING F_DATI 50
|
||||
BEGIN
|
||||
PROMPT 2 3 "Area dati in Lire "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING F_DATIE 50
|
||||
BEGIN
|
||||
PROMPT 2 4 "Area dati in Euro "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
DATE F_ADOZIONE
|
||||
BEGIN
|
||||
PROMPT 2 5 "Data adozione Euro "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 3
|
||||
BEGIN
|
||||
PROMPT 1 7 "@bUltimo trasferimento "
|
||||
END
|
||||
|
||||
DATE F_LAST_DATE
|
||||
BEGIN
|
||||
PROMPT 2 8 "Data "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER F_LAST_FROM 5
|
||||
BEGIN
|
||||
PROMPT 25 8 "Dal "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER F_LAST_TO 5
|
||||
BEGIN
|
||||
PROMPT 50 8 "al "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 3
|
||||
BEGIN
|
||||
PROMPT 1 10 "@bProssimo trasferimento"
|
||||
END
|
||||
|
||||
DATE DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 2 11 "Data "
|
||||
FLAGS "AD"
|
||||
END
|
||||
|
||||
NUMBER F_MOV_FROM 5
|
||||
BEGIN
|
||||
PROMPT 25 11 "Dal "
|
||||
USE LF_MOV
|
||||
INPUT NUMREG F_MOV_FROM
|
||||
DISPLAY "Num. Lire" NUMREG
|
||||
DISPLAY "Num. Euro" TNUMREG
|
||||
DISPLAY "Registrazione" DATAREG
|
||||
DISPLAY "Causale" CODCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT F_MOV_FROM NUMREG
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Inserire un movimento valido"
|
||||
ADD RUN cg2 -0
|
||||
END
|
||||
|
||||
NUMBER F_MOV_TO 5
|
||||
BEGIN
|
||||
PROMPT 50 11 "al "
|
||||
COPY USE F_MOV_FROM
|
||||
INPUT NUMREG F_MOV_TO
|
||||
COPY DISPLAY F_MOV_FROM
|
||||
OUTPUT F_MOV_TO NUMREG
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Inserire un movimento valido"
|
||||
ADD RUN cg2 -0
|
||||
END
|
||||
|
||||
BROWSEFILE F_LOG 75 -1
|
||||
BEGIN
|
||||
PROMPT 1 12 ""
|
||||
END
|
||||
|
||||
ENDMASK
|
516
ba/bainst.cpp
516
ba/bainst.cpp
@ -6,521 +6,6 @@
|
||||
#include "bainsta.h"
|
||||
#include "bainst.h"
|
||||
|
||||
// ********************************
|
||||
// classe TSystemtempfile
|
||||
// ********************************
|
||||
|
||||
|
||||
// classe provvisoria per i system file temporanei, ovvero file temporanei con
|
||||
// caricamento/scaricamento
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Importa un file ascii
|
||||
//
|
||||
// @rdesc Ritorna NOERR se l'operazione di lettura e' riuscita, altrimenti il codice di
|
||||
// di errore generato (vedi <t TIsamerr>).
|
||||
int TSystemtempfile::load(
|
||||
const char* from, // @parm Nome del file da importare
|
||||
char fs, // @parm Carattere separatore di campo (default <pipe>)
|
||||
char fd, // @parm Carattere delimitatore di campi (default '\\0')
|
||||
char rs, // @parm Carattere separatore di record (default '\\n')
|
||||
bool vis, // @parm Indica se visualizzare lo stato dell'operazione (default TRUE)
|
||||
bool extended) // @parm Indica se interpretare alcune stringhe come macro (default FALSE)
|
||||
|
||||
// @comm Se <p extended> e' TRUE e trova alcune stringhe col formato %stringa% (es. %frm%)
|
||||
// ne sostituisce i valori (es. ditta corrente).
|
||||
|
||||
// @xref <mf TSystemisamfile::dump>
|
||||
|
||||
{
|
||||
FILE* fl = fopen(from, "r");
|
||||
int err=NOERR;
|
||||
if (fl == NULL)
|
||||
{
|
||||
error_box("Non riesco ad aprire il file %s",from);
|
||||
return 2;
|
||||
}
|
||||
TRecnotype r = 0, e = 0, nitems = 0, nread = 0;
|
||||
TString16 firm, year, attprev("00000");
|
||||
|
||||
if (extended)
|
||||
{
|
||||
TDate d(TODAY);
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
|
||||
firm.format("%05ld", prefix().get_codditta());
|
||||
year.format("%04d", d.year());
|
||||
ditte.zero();
|
||||
ditte.put("CODDITTA", firm);
|
||||
if (ditte.read() == NOERR)
|
||||
attprev = ditte.get("CODATTPREV");
|
||||
}
|
||||
if (fl == NULL)
|
||||
{
|
||||
clearerr(fl);
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
char w[80];
|
||||
while ((fgets(w, 80, fl) != NULL))
|
||||
{
|
||||
if (strncmp(w, "[Data]", 6) == 0)
|
||||
{
|
||||
nitems = ftell(fl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fseek(fl, 0L, SEEK_END);
|
||||
nitems = ftell(fl) - nitems;
|
||||
fclose(fl);
|
||||
TScanner f(from);
|
||||
|
||||
//open();
|
||||
|
||||
TToken_string s(1024, fs);
|
||||
bool fixedlen = (fs == '\0');
|
||||
int nflds = curr().items();
|
||||
TArray fld(nflds);
|
||||
int len[MaxFields];
|
||||
TString sfd(3);
|
||||
TString s1(64);
|
||||
//bool lcf = FALSE;
|
||||
|
||||
if (f.paragraph("Header"))
|
||||
{
|
||||
f.equal();
|
||||
const long level = atol(f.line());
|
||||
//rimosso il controllo sul livello archivi;tanto la conversione la fa lo stesso
|
||||
// if (level > get_std_level())
|
||||
// error_box("L'archivio %s e' stato generato con gli archivi di livello %ld%/%ld.\n Il livello attuale e' %ld/%ld.\n Convertire gli archivi e ripetere l' operazione.",
|
||||
// from, level/100, level%100, get_std_level()/100, get_std_level()%100);
|
||||
|
||||
nflds = 0;
|
||||
TToken_string s2(f.line());
|
||||
int p = s2.find('=');
|
||||
if (p > 0)
|
||||
{
|
||||
s1 = s2.left(p);
|
||||
s2.ltrim(p+1);
|
||||
}
|
||||
else s1.cut(0);
|
||||
while (s1 == "Fields")
|
||||
{
|
||||
for (const char * fd = s2.get(); fd != NULL; fd = s2.get())
|
||||
{
|
||||
TToken_string wfd(fd, ',');
|
||||
fld.add(new TString(wfd.get()));
|
||||
len[nflds] = wfd.get_int();
|
||||
nflds++;
|
||||
}
|
||||
s2 = f.line();
|
||||
p = s2.find('=');
|
||||
if (p > 0)
|
||||
{
|
||||
s1 = s2.left(p);
|
||||
s2.ltrim(p+1);
|
||||
}
|
||||
else s1.cut(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < nflds; j++)
|
||||
{
|
||||
fld.add(TString(curr().fieldname(j)), j);
|
||||
const TString & wfld = (const TString & ) fld[j];
|
||||
len[j] = (curr().type(wfld) == _datefld) ? 10 : curr().length(wfld);
|
||||
}
|
||||
}
|
||||
if (!f.paragraph("Data"))
|
||||
{
|
||||
error_box("Formato dei dati non valido");
|
||||
//close();
|
||||
err = 1;
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (fd) sfd << fd;
|
||||
int last = NOERR;
|
||||
|
||||
s1.format("Imp. archivio %s\n%6ld records %6ld errori - %3d", filename(), r, e, last);
|
||||
TProgind p(nitems, s1, TRUE, TRUE, 70);
|
||||
s = f.line();
|
||||
while (s.not_empty() && !p.iscancelled())
|
||||
{
|
||||
if (extended)
|
||||
{
|
||||
int p, i;
|
||||
|
||||
while ((p = s.find("%yr%")) >= 0)
|
||||
for (i = 0; i < 4; i++) s[p + i] = year[i];
|
||||
while ((p = s.find("%frm%")) >= 0)
|
||||
for (i = 0; i < 5; i++) s[p + i] = firm[i];
|
||||
while ((p = s.find("%att%")) >= 0)
|
||||
for (i = 0; i < 5; i++) s[p + i] = attprev[i];
|
||||
}
|
||||
if ((r + e) % 50 == 0)
|
||||
{
|
||||
s1.format("Imp. archivio %s\n%6ld records %6ld errori - %3d", filename(), r, e, last);
|
||||
p.set_text(s1);
|
||||
}
|
||||
p.setstatus(nread + 1);
|
||||
nread += s.len() + 1;
|
||||
zero();
|
||||
if (fixedlen)
|
||||
{
|
||||
int pos = 0;
|
||||
for (int j = 0; j < nflds; j++)
|
||||
{
|
||||
s1 = s.mid(pos,len[j]);
|
||||
s1.rtrim();
|
||||
put((const TString&) fld[j], s1);
|
||||
pos += len[j];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s.restart();
|
||||
for (int j = 0; j < nflds; j++)
|
||||
{
|
||||
char* s2 = (char*) s.get();
|
||||
if (fd)
|
||||
{
|
||||
s2++;
|
||||
s2[strlen(s2) - 1] = '\0';
|
||||
}
|
||||
put((const TString&) fld[j], s2);
|
||||
}
|
||||
}
|
||||
if (write() == NOERR) r++;
|
||||
else
|
||||
{
|
||||
#ifdef DBG
|
||||
yesnofatal_box("Numero linea relativa all'errore: %ld",r+e+1);
|
||||
#endif
|
||||
e++;
|
||||
last = status();
|
||||
}
|
||||
s = f.line();
|
||||
}
|
||||
s1.format("Imp. archivio %s\n%6ld records %6ld errori - %3d", filename(), r, e, last);
|
||||
p.set_text(s1);
|
||||
//close();
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Esporta VERSO un file ascii.
|
||||
//
|
||||
// @rdesc Ritorna NOERR se l'operazione di esportazione e' riuscita, altrimenti il codice di
|
||||
// di errore generato (vedi <t TIsamerr>).
|
||||
int TSystemtempfile::dump(
|
||||
const char* to, // @parm Nome del file verso quale esportare
|
||||
int nkey, // @parm Numero della chiave di ordinamento con cui scaricare i dati (defualt 1)
|
||||
char fs, // @parm Carattere seperatore di campo (defualt <pipe>)
|
||||
char fd, // @parm Carattere delimitatore di campo (default '\\0')
|
||||
char rs, // @parm Carattere separatore di record (default '\\n')
|
||||
bool vis, // @parm Indica se visualizzare lo stato dell'operazione (defualt TRUE)
|
||||
bool withdeleted) // @parm Indica se scaricare anche i record cancellati (dafault FALSE)
|
||||
|
||||
// @xref <mf TSystemisamfile::load>
|
||||
|
||||
{
|
||||
FILE* f = fopen(to, "w");
|
||||
|
||||
if (f == NULL)
|
||||
{
|
||||
setstatus(2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (withdeleted) nkey = 0;
|
||||
int err = ferror(f);
|
||||
|
||||
//open(FALSE, nkey ? TRUE : FALSE);
|
||||
TString s(512);
|
||||
bool fixedlen = (fs == '\0');
|
||||
int nflds = curr().items();
|
||||
TArray fld(nflds);
|
||||
TBit_array rjust(nflds);
|
||||
int len[MaxFields];
|
||||
|
||||
for (int j = 0; j < nflds; j++)
|
||||
{
|
||||
fld.add(TString(curr().fieldname(j)), j);
|
||||
const TString & wfld = (const TString&) fld[j];
|
||||
const TFieldtypes t = curr().type(wfld);
|
||||
rjust.set(j, t == _intfld || t == _longfld || t == _realfld ||
|
||||
t == _wordfld || t == _intzerofld || t == _longzerofld);
|
||||
len[j] = (t == _datefld) ? 10 : curr().length(wfld);
|
||||
}
|
||||
TRecnotype i = 0;
|
||||
const TRecnotype nitems = items();
|
||||
s.format("Esportazione archivio %s", filename());
|
||||
TProgind p(nitems, s, TRUE, TRUE, 70);
|
||||
TString s1;
|
||||
|
||||
fprintf(f, "[Header]\nVersion=%ld", prefix().filelevel());
|
||||
for (int k = 0; k < nflds; k++)
|
||||
{
|
||||
if ((k % 10) == 0) fprintf(f, "\nFields=");
|
||||
else fprintf(f, "|");
|
||||
fprintf(f, "%s,%d", (const char *) (const TString&) fld[k], len[k]);
|
||||
}
|
||||
fprintf(f, "\n\n[Data]\n");
|
||||
if (nkey)
|
||||
{
|
||||
setkey(nkey);
|
||||
for ( first(); status() == NOERR && !p.iscancelled(); next(), i++)
|
||||
{
|
||||
p.setstatus(i + 1);
|
||||
s = "";
|
||||
for (j = 0; j < nflds; j++)
|
||||
{
|
||||
if (fixedlen)
|
||||
{
|
||||
s1 = get((const TString&)fld[j]);
|
||||
if (rjust[j]) s1.right_just(len[j]);
|
||||
else s1.left_just(len[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
s1 = "";
|
||||
if (j && fs) s1 << fs;
|
||||
if (fd) s1 << fd;
|
||||
s1 << get((const TString&)fld[j]);
|
||||
if (fd) s1 << fd;
|
||||
}
|
||||
s << s1;
|
||||
}
|
||||
fprintf(f, "%s%c", (const char*) s, rs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nitems && !p.iscancelled(); i++)
|
||||
{
|
||||
zero();
|
||||
p.setstatus(i + 1);
|
||||
readat(i + 1);
|
||||
s="";
|
||||
if (withdeleted || curr().valid())
|
||||
{
|
||||
for (j = 0; j < nflds; j++)
|
||||
{
|
||||
if (fixedlen)
|
||||
{
|
||||
s1 = get((const TString&)fld[j]);
|
||||
if (rjust[j]) s1.right_just(len[j]);
|
||||
else s1.left_just(len[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
s1 = "";
|
||||
if (j && fs) s1 << fs;
|
||||
if (fd) s1 << fd;
|
||||
s1 << get((const TString&)fld[j]);
|
||||
if (fd) s1 << fd;
|
||||
}
|
||||
s << s1;
|
||||
}
|
||||
fprintf(f, "%s%c", (const char*) s, rs);
|
||||
}
|
||||
}
|
||||
}
|
||||
p.setstatus(nitems);
|
||||
//close();
|
||||
fclose(f);
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
|
||||
// ********************************
|
||||
// classe TStd_filename
|
||||
// ********************************
|
||||
|
||||
bool TStd_filename::check(bool verbose,const char * n)
|
||||
{
|
||||
if (n && *n)
|
||||
set(n);
|
||||
insert("STD\\");
|
||||
if (!exist())
|
||||
{
|
||||
*this = name();
|
||||
if (!exist())
|
||||
{
|
||||
insert("STD\\");
|
||||
insert(prefix().get_studio());
|
||||
if (!exist())
|
||||
{
|
||||
if (verbose)
|
||||
error_box("Non riesco a trovare il file: %s", (const char *)name());
|
||||
cut(0);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool TInstallmodule_app::create()
|
||||
{
|
||||
TScanner scanner("campo.aut");
|
||||
|
||||
bool ok = FALSE;
|
||||
for (int aut = 0; aut<=module_number(); aut++)
|
||||
{
|
||||
scanner.line();
|
||||
}
|
||||
_modcode=scanner.token().left(2);
|
||||
_modname=scanner.token().mid(3);
|
||||
|
||||
if (modal())
|
||||
{
|
||||
TString16 maskname;
|
||||
maskname.format("bainst%02d",module_number());
|
||||
_m = new TMask(maskname);
|
||||
}
|
||||
else
|
||||
_m = NULL;
|
||||
|
||||
TConfig ini("install.ini");
|
||||
TConfig praw(CONFIG_INSTALL);
|
||||
_test_database = praw.get("TestDatabase","Main",-1,"Y") != "N";
|
||||
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
bool TInstallmodule_app::destroy()
|
||||
{
|
||||
if (_m) delete _m;
|
||||
return TSkeleton_application::destroy();
|
||||
}
|
||||
|
||||
bool TInstallmodule_app::preload_mask()
|
||||
{
|
||||
if (!test_database())
|
||||
{
|
||||
_m->set(F_DEFAULTSDATA," ");
|
||||
_m->disable(F_DEFAULTSDATA);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (load_default_data())
|
||||
_m->set(F_DEFAULTSDATA,"X");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TInstallmodule_app::some_to_load()
|
||||
{
|
||||
return _m->get_bool(F_DEFAULTSDATA);
|
||||
}
|
||||
|
||||
void TInstallmodule_app::main_loop()
|
||||
{
|
||||
bool ok =TRUE;
|
||||
|
||||
if (modal())
|
||||
{
|
||||
preload_mask();
|
||||
if (_m->run()!=K_QUIT)
|
||||
{
|
||||
if (some_to_load())
|
||||
{
|
||||
install_firm();
|
||||
install_com();
|
||||
}
|
||||
}
|
||||
else
|
||||
ok =FALSE;
|
||||
}
|
||||
if (ok)
|
||||
post_installer();
|
||||
}
|
||||
|
||||
bool TInstallmodule_app::install_firm()
|
||||
{
|
||||
// ciclo su ogni ditta
|
||||
TStd_filename txtfile(module_code());
|
||||
txtfile << "tab.txt";
|
||||
if (txtfile.check())
|
||||
{
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
for (ditte.first(); !ditte.eof() ; ditte.next())
|
||||
{
|
||||
const int newditta=ditte.get_int("CODDITTA");
|
||||
if (prefix().exist(newditta))
|
||||
{
|
||||
set_firm(newditta);
|
||||
TSystemisamfile tab(LF_TAB);
|
||||
tab.load(txtfile);
|
||||
}
|
||||
}
|
||||
// carica le tabelle nei file di default
|
||||
TLocalisamfile tampone(LF_TAB);
|
||||
TSystemtempfile tabstd(LF_TAB);
|
||||
TFilename stdtabname(prefix().get_studio());
|
||||
stdtabname << "STD\\lf0005.txt";
|
||||
tabstd.load(txtfile);
|
||||
tabstd.load(stdtabname);
|
||||
tabstd.set_autodel();
|
||||
TFilename tempfile;
|
||||
tempfile.temp();
|
||||
|
||||
// riconverte le macro delle date
|
||||
tabstd.dump(tempfile);
|
||||
TScanner scan(tempfile);
|
||||
FILE *dest=fopen((const char *)stdtabname,"w");
|
||||
while (TRUE) {
|
||||
TString &line=scan.line();
|
||||
if (line.empty()) break;
|
||||
|
||||
int pos=(line.find("-0000"));
|
||||
while (pos >= 0 )
|
||||
{
|
||||
line.overwrite("%yr%",pos+1);
|
||||
pos=(line.find("-0000"));
|
||||
}
|
||||
line << '\n' ;
|
||||
fputs((const char * )line,dest);
|
||||
}
|
||||
fclose(dest);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TInstallmodule_app::install_com()
|
||||
{
|
||||
bool ok=TRUE;
|
||||
TStd_filename txtfile(module_code());
|
||||
txtfile << "tabcom.txt";
|
||||
if (txtfile.check())
|
||||
{
|
||||
TSystemisamfile tabcom(LF_TABCOM);
|
||||
tabcom.load(txtfile);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void TInstallmodule_app::run(int argc, char* argv[])
|
||||
{
|
||||
TString title("Installazione ");
|
||||
title << module_name();
|
||||
TSkeleton_application::run(argc, argv,(const char* )title);
|
||||
}
|
||||
|
||||
|
||||
void TInstallmodule_app::set_tab_app(const char * appname)
|
||||
{
|
||||
TConfig ditta(CONFIG_DITTA);
|
||||
ditta.set_paragraph(module_code());
|
||||
ditta.set("TabApp",appname);
|
||||
}
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
@ -557,4 +42,3 @@ int main(int argc,char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
61
ba/bainst.h
61
ba/bainst.h
@ -1,8 +1,5 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <isam.h>
|
||||
#define G_PREINST 1
|
||||
|
||||
#define G_PREINST 1
|
||||
int bainst00(int argc, char** argv);
|
||||
int bainst07(int argc, char** argv);
|
||||
int bainst11(int argc, char** argv);
|
||||
@ -15,60 +12,4 @@ int bainst34(int argc, char** argv);
|
||||
int bainst38(int argc, char** argv);
|
||||
int bainst39(int argc, char** argv);
|
||||
|
||||
// classe provvisoria per i system file temporanei, ovvero file temporanei con
|
||||
// caricamento/scaricamento
|
||||
class TSystemtempfile : public TIsamtempfile
|
||||
{
|
||||
public:
|
||||
//bool getlcf( long flev); // @parm livello archivi di partenza della convesione
|
||||
|
||||
int load(const char* from, char fs = '|', char fd = '\0', char rs = '\n', bool vis = TRUE, bool extended = FALSE) ;
|
||||
|
||||
int dump(const char* to, int nkey = 1, char fs = '|', char fd = '\0', char rs = '\n', bool vis = TRUE, bool withdeleted = FALSE);
|
||||
|
||||
TSystemtempfile(int logicnum) :
|
||||
TIsamtempfile(logicnum,NULL) {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class TStd_filename : public TFilename
|
||||
{
|
||||
public:
|
||||
bool check(bool verbose=FALSE,const char * name=NULL);
|
||||
~TStd_filename () {}
|
||||
TStd_filename () : TFilename(){}
|
||||
TStd_filename (const char * n) : TFilename(n){}
|
||||
};
|
||||
|
||||
class TInstallmodule_app: public TSkeleton_application
|
||||
{
|
||||
bool _is_first_inst , _test_database ;
|
||||
|
||||
protected:
|
||||
TMask * _m ;
|
||||
TString _modcode,_modname;
|
||||
|
||||
protected:
|
||||
void set_tab_app(const char * appname);
|
||||
bool test_database() {return _test_database;}
|
||||
const char * module_name() const {return _modname;}
|
||||
const char * module_code() const {return _modcode;}
|
||||
|
||||
virtual bool load_default_data() const { return TRUE;}
|
||||
virtual bool modal() const {return TRUE;}
|
||||
virtual int module_number() const pure;
|
||||
virtual bool preload_mask();
|
||||
virtual bool post_installer() {return TRUE;}
|
||||
virtual bool some_to_load();
|
||||
|
||||
virtual bool install_com() ; // setta i dati comuni
|
||||
virtual bool install_firm() ; // setta i dati ditta
|
||||
|
||||
virtual void main_loop() ;
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
public:
|
||||
void run(int argc, char* argv[]);
|
||||
};
|
@ -1,9 +1,6 @@
|
||||
#include <windows.h>
|
||||
#include <applicat.h>
|
||||
#include <execp.h>
|
||||
#include <mask.h>
|
||||
#include <isam.h>
|
||||
#include <config.h>
|
||||
#include <execp.h>
|
||||
#include <inst.h>
|
||||
#include <tabutil.h>
|
||||
#include "bainst.h"
|
||||
#include "bainst00.h"
|
||||
|
@ -1,63 +0,0 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <config.h>
|
||||
#include <utility.h>
|
||||
#include <execp.h>
|
||||
#include <isam.h>
|
||||
|
||||
#include "bainst.h"
|
||||
#include "bainst05.h"
|
||||
|
||||
class TInstall_VE : public TSkeleton_application
|
||||
{
|
||||
TMask * _m;
|
||||
protected:
|
||||
virtual void main_loop() ;
|
||||
virtual bool install_firm() ; // setta i dati ditta
|
||||
virtual bool install_com() ; // setta i dati comuni
|
||||
|
||||
public:
|
||||
virtual ~TInstall_VE () {}
|
||||
};
|
||||
|
||||
// setta i dati ditta
|
||||
bool TInstall_VE ::install_firm()
|
||||
{
|
||||
// ciclo su ogni ditta
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TInstall_VE ::install_com()
|
||||
{
|
||||
bool ok=TRUE;
|
||||
if (_m->get_bool(F_LOADTAB))
|
||||
{
|
||||
TStd_filename txtfile("vetabcom.txt");
|
||||
TSystemisamfile tabcom(LF_TABCOM);
|
||||
if (!txtfile.blank())
|
||||
tabcom.load(txtfile);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void TInstall_VE::main_loop()
|
||||
{
|
||||
TConfig ini("install.ini","ve");
|
||||
const bool primainst=ini.get("Versione").blank();
|
||||
|
||||
_m = new TMask ("bainst05.msk");
|
||||
if (primainst)
|
||||
_m->set(F_LOADTAB,"X");
|
||||
if (_m->run()!=K_QUIT)
|
||||
{
|
||||
install_firm();
|
||||
install_com();
|
||||
}
|
||||
}
|
||||
|
||||
int bainst05(int argc, char** argv)
|
||||
{
|
||||
TInstall_VE app;
|
||||
app.run(argc, argv, "Installazione Vendite");
|
||||
return 0;
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
#include "bainsta.h"
|
||||
#define F_LOADTAB 101
|
@ -1,58 +0,0 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <config.h>
|
||||
#include <utility.h>
|
||||
#include <execp.h>
|
||||
#include "bainst06.h"
|
||||
|
||||
class TInstall_MG : public TSkeleton_application
|
||||
{
|
||||
TMask * _m;
|
||||
protected:
|
||||
virtual void main_loop() ;
|
||||
virtual bool install_firm() ; // setta i dati ditta
|
||||
virtual bool install_com() ; // setta i dati comuni
|
||||
|
||||
public:
|
||||
virtual ~TInstall_MG () {}
|
||||
};
|
||||
|
||||
// setta i dati ditta
|
||||
bool TInstall_MG ::install_firm()
|
||||
{
|
||||
// ciclo su ogni ditta
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TInstall_MG ::install_com()
|
||||
{
|
||||
bool ok=TRUE;
|
||||
if (_m->get_bool(F_LOADTAB))
|
||||
{
|
||||
TExternal_app rice("bacnv 1 4 mgtab.txt");
|
||||
ok &= (rice.run()==0);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void TInstall_MG::main_loop()
|
||||
{
|
||||
TConfig ini("install.ini","mg");
|
||||
const bool primainst=ini.get("Versione").blank();
|
||||
|
||||
_m = new TMask ("bainst06.msk");
|
||||
if (primainst)
|
||||
_m->set(F_LOADTAB,"X");
|
||||
if (_m->run()!=K_QUIT)
|
||||
{
|
||||
install_firm();
|
||||
install_com();
|
||||
}
|
||||
}
|
||||
|
||||
int bainst06(int argc, char** argv)
|
||||
{
|
||||
TInstall_MG app;
|
||||
app.run(argc, argv, "Installazione Magazzino");
|
||||
return 0;
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
///#include "bainst.h"
|
||||
#define F_LOADTAB 101
|
@ -1,9 +1,7 @@
|
||||
#include <windows.h>
|
||||
#include <applicat.h>
|
||||
#include <execp.h>
|
||||
#include <mask.h>
|
||||
#include <isam.h>
|
||||
#include <config.h>
|
||||
#include <execp.h>
|
||||
#include <inst.h>
|
||||
#include <modaut.h>
|
||||
#include "bainst.h"
|
||||
#include "bainst07.h"
|
||||
|
||||
@ -16,7 +14,7 @@ private:
|
||||
|
||||
protected:
|
||||
virtual bool modal() const {return FALSE;}
|
||||
virtual int module_number() const {return 7;}
|
||||
virtual int module_number() const {return CGAUT;}
|
||||
virtual bool install_firm() {return TRUE;} // no firm installation
|
||||
virtual bool post_installer();
|
||||
|
||||
@ -28,6 +26,7 @@ public:
|
||||
// crea il .ini per i files exe copiati nella directory di EASYCAMPO
|
||||
bool TInstall_CG ::CreaExeIni(const char * exename)
|
||||
{
|
||||
/* VECCHIO COME IL CUCCO!!!!
|
||||
TFilename ininame(128);
|
||||
GetWindowsDirectory(ininame.get_buffer(), 128);
|
||||
|
||||
@ -49,6 +48,7 @@ bool TInstall_CG ::CreaExeIni(const char * exename)
|
||||
ini.set("Deleted","On","dBase ISAM");
|
||||
|
||||
ini.set("ParadoxNetStyle","3.x","Paradox ISAM" );
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -67,5 +67,5 @@ int bainst07(int argc, char** argv)
|
||||
{
|
||||
TInstall_CG app;
|
||||
app.run(argc, argv);
|
||||
return all_ok;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <config.h>
|
||||
#include <utility.h>
|
||||
#include <execp.h>
|
||||
#include <isam.h>
|
||||
|
||||
#include <inst.h>
|
||||
#include "bainst.h"
|
||||
#include "bainst11.h"
|
||||
|
||||
@ -12,7 +7,7 @@ class TInstall_CE : public TSkeleton_application
|
||||
{
|
||||
protected:
|
||||
virtual void main_loop() ;
|
||||
virtual bool install_com(bool in_lire) ; // setta i dati comuni
|
||||
bool install_com(bool in_lire) ; // setta i dati comuni
|
||||
|
||||
public:
|
||||
virtual ~TInstall_CE () {}
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include <applicat.h>
|
||||
#include <inst.h>
|
||||
#include <mask.h>
|
||||
#include <isam.h>
|
||||
#include <prefix.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include <utility.h>
|
||||
#include "bainst.h"
|
||||
#include "bainst17.h"
|
||||
@ -10,7 +11,7 @@ class TInstall_AT : public TInstallmodule_app
|
||||
{
|
||||
protected:
|
||||
virtual bool load_default_data() const ;
|
||||
virtual int module_number() const {return 17;}
|
||||
virtual int module_number() const {return ATAUT;}
|
||||
|
||||
virtual bool preload_mask() ;
|
||||
bool post_installer() ;
|
||||
@ -19,6 +20,7 @@ public:
|
||||
virtual ~TInstall_AT () {}
|
||||
};
|
||||
|
||||
//controlla la tabella idoneita': se risulta vuota -> deve caricare i dati di default
|
||||
bool TInstall_AT ::load_default_data() const
|
||||
{
|
||||
if (prefix().get_codditta() <= 0)
|
||||
@ -38,7 +40,13 @@ bool TInstall_AT ::post_installer()
|
||||
#endif
|
||||
bool ok=TRUE;
|
||||
if (_m->get_bool(F_USAMENUAVIS))
|
||||
ok=fcopy("agaat.men",menuname);
|
||||
{
|
||||
ok=fcopy("agaat.men","baprassi.men");
|
||||
TConfig config (CONFIG_STUDIO, "at");
|
||||
config.set("EdMask", "at0500a.msk");
|
||||
config.set("EdApp", "at0 -4");
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,15 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <config.h>
|
||||
#include <utility.h>
|
||||
#include <isam.h>
|
||||
#include <inst.h>
|
||||
#include <modaut.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include "bainst.h"
|
||||
#include "bainst18.h"
|
||||
|
||||
class TInstall_IN : public TInstallmodule_app
|
||||
{
|
||||
TMask * _m;
|
||||
protected:
|
||||
virtual bool load_default_data() const ;
|
||||
virtual int module_number() const {return 18;}
|
||||
virtual int module_number() const {return INAUT;}
|
||||
virtual bool post_installer() { return TRUE; }
|
||||
|
||||
public:
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "bainst18.h"
|
||||
|
||||
PAGE "Installazione MG" -1 -1 78 8
|
||||
PAGE "Installazione IN" -1 -1 78 8
|
||||
// GROUP 1 = PRE-INSTALLATION
|
||||
// GROUP 2 = POST-INSTALLATION
|
||||
|
||||
|
@ -1,18 +1,17 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <execp.h>
|
||||
#include <isam.h>
|
||||
#include <inst.h>
|
||||
#include <modaut.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "bainst.h"
|
||||
#include "bainst31.h"
|
||||
|
||||
class TInstall_VE : public TInstallmodule_app
|
||||
{
|
||||
TMask * _m;
|
||||
protected:
|
||||
protected:
|
||||
virtual bool load_default_data() const ;
|
||||
virtual int module_number() const {return 31;}
|
||||
virtual int module_number() const {return VEAUT;}
|
||||
virtual bool install_firm() {return TRUE;} // no firm installation
|
||||
|
||||
public:
|
||||
|
@ -9,14 +9,6 @@ BEGIN
|
||||
PROMPT 2 2 "Carica le tabelle con i tipi documento"
|
||||
END
|
||||
|
||||
/*GROUPBOX DLG_NULL 60 4
|
||||
BEGIN
|
||||
FLAG "H"
|
||||
PROMPT 2 4 " Installazione dati ditta"
|
||||
GROUP G_POSTINST
|
||||
END
|
||||
*/
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -11 -1 "~Conferma"
|
||||
|
@ -1,19 +1,18 @@
|
||||
#include <applicat.h>
|
||||
|
||||
#include <config.h>
|
||||
#include <isam.h>
|
||||
#include <mask.h>
|
||||
#include <inst.h>
|
||||
#include <modaut.h>
|
||||
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "bainst.h"
|
||||
#include "bainst32.h"
|
||||
|
||||
class TInstall_MG : public TInstallmodule_app
|
||||
{
|
||||
TMask * _m;
|
||||
protected:
|
||||
virtual bool load_default_data() const ;
|
||||
virtual int module_number() const {return 32;}
|
||||
virtual int module_number() const {return MGAUT;}
|
||||
virtual bool post_installer();
|
||||
|
||||
public:
|
||||
@ -22,8 +21,8 @@ public:
|
||||
|
||||
bool TInstall_MG::post_installer()
|
||||
{
|
||||
set_tab_app("mg0 -0");
|
||||
return TRUE;
|
||||
set_tab_app("mg0 -0");
|
||||
return TRUE;
|
||||
}
|
||||
bool TInstall_MG::load_default_data() const
|
||||
{
|
||||
|
@ -1,10 +1,6 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <config.h>
|
||||
#include <utility.h>
|
||||
#include <isam.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include <inst.h>
|
||||
#include <modaut.h>
|
||||
#include "bainst.h"
|
||||
#include "bainst34.h"
|
||||
|
||||
@ -12,7 +8,7 @@ class TInstall_EF : public TInstallmodule_app
|
||||
{
|
||||
protected:
|
||||
// virtual bool load_type() const ;
|
||||
virtual int module_number() const {return 34;}
|
||||
virtual int module_number() const {return EFAUT;}
|
||||
virtual bool post_installer();
|
||||
virtual bool modal() const {return FALSE;}
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <inst.h>
|
||||
#include <modaut.h>
|
||||
#include "bainst.h"
|
||||
|
||||
class TInstall_DB : public TInstallmodule_app
|
||||
{
|
||||
protected:
|
||||
virtual bool modal() const {return FALSE;}
|
||||
virtual int module_number() const {return 35;}
|
||||
virtual int module_number() const {return DBAUT;}
|
||||
virtual bool post_installer();
|
||||
|
||||
public:
|
||||
|
@ -1,16 +1,13 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <utility.h>
|
||||
#include <prefix.h>
|
||||
#include <isam.h>
|
||||
#include <tabutil.h>
|
||||
#include <inst.h>
|
||||
#include <modaut.h>
|
||||
#include "bainst.h"
|
||||
#include "bainst38.h"
|
||||
|
||||
class TInstall_SV : public TInstallmodule_app
|
||||
{
|
||||
protected:
|
||||
virtual int module_number() const {return 38;}
|
||||
virtual int module_number() const {return SVAUT;}
|
||||
virtual bool install_firm() {return TRUE;}
|
||||
virtual bool install_com();
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <inst.h>
|
||||
#include <modaut.h>
|
||||
#include "bainst.h"
|
||||
|
||||
class TInstall_MR : public TInstallmodule_app
|
||||
{
|
||||
protected:
|
||||
virtual bool modal() const {return FALSE;}
|
||||
virtual int module_number() const {return 39;}
|
||||
virtual int module_number() const {return MRAUT;}
|
||||
virtual bool post_installer();
|
||||
|
||||
public:
|
||||
|
@ -7,10 +7,10 @@ int main(int argc,char** argv)
|
||||
const int r = (argc > 1) ? (argv[1][1]-'0') : 0;
|
||||
switch (r)
|
||||
{
|
||||
case 3: ce0400(argc,argv); break;
|
||||
case 4: ce0500(argc,argv); break;
|
||||
case 8: ce0900(argc,argv); break;
|
||||
default: ce0100(argc,argv); break;
|
||||
case 3: ce0400(argc,argv); break; // Parametri ditta
|
||||
case 4: ce0500(argc,argv); break; // Anagrafica cespiti
|
||||
case 8: ce0900(argc,argv); break; // Conversione cespiti
|
||||
default: ce0100(argc,argv); break; // Tabelle cespiti
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ bool TConversione_ce_mask::already_converted(long ditta)
|
||||
TFilename ditce = prefix().get_studio();
|
||||
ditce.add("cesp/ditce");
|
||||
TExternisamfile oldfile(ditce,(bool) FALSE,(bool) FALSE);
|
||||
|
||||
for (err = oldfile.first(); err == NOERR; err = oldfile.next())
|
||||
{
|
||||
long d = oldfile.get_long("CACDD");
|
||||
@ -290,6 +291,7 @@ int TConversione_cespiti::conv_file(const TFilename& ofname, int nflogicnum)
|
||||
d.put(nflogicnum);
|
||||
|
||||
TExternisamfile oldfile(ofname,(bool) FALSE,(bool) FALSE);
|
||||
|
||||
TLocalisamfile* newfile = NULL;
|
||||
const TRectype& oldrec = oldfile.curr();
|
||||
TString s;
|
||||
@ -422,6 +424,7 @@ int TConversione_cespiti::conv_tab(const TFilename& ofname, const char* tab)
|
||||
long oldditta = -1, ditta = -1;
|
||||
TExternisamfile oldfile(ofname,(bool)FALSE,(bool)FALSE);
|
||||
|
||||
|
||||
TTable* newfile = NULL;
|
||||
TConfig config("ce0900.ini", tab);
|
||||
TAssoc_array& fieldlist = config.list_variables();
|
||||
@ -673,6 +676,7 @@ int TConversione_cespiti::conv_inifile(const TFilename& ofname, const char* ofpa
|
||||
if (err == NOERR)
|
||||
{
|
||||
TExternisamfile oldfile(ofname,(bool)FALSE,(bool)FALSE);
|
||||
|
||||
TLocalisamfile* newfile = new TLocalisamfile(nflogicnum);
|
||||
TConfig config("ce0900.ini", (const char*) ofpar);
|
||||
TAssoc_array& fieldlist = config.list_variables();
|
||||
@ -748,6 +752,7 @@ int TConversione_cespiti::conv_par(const TFilename& ofname, const char* ofpar, i
|
||||
long oldditta = -1;
|
||||
long ditta;
|
||||
TExternisamfile oldfile(ofname,(bool)FALSE,(bool)FALSE);
|
||||
|
||||
TConfig newconfig(which_config, "ce");
|
||||
TConfig config("ce0900.ini", (const char*) ofpar);
|
||||
TAssoc_array& fieldlist = config.list_variables();
|
||||
@ -886,4 +891,4 @@ int ce0900(int argc, char* argv[])
|
||||
TConversione_cespiti a ;
|
||||
a.run(argc, argv, "Conversione cespiti");
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -545,7 +545,7 @@ void TMov_emask::calc_plus_minus(int tipo, real& plus, real& minus) const
|
||||
|
||||
TRectype& movsem = rel.curr();
|
||||
TRectype& ammmv = rel.curr(LF_AMMMV);
|
||||
const TString idcespite = get(F_IDCESPITE);
|
||||
const TString& idcespite = get(F_IDCESPITE);
|
||||
movsem.put(MOVCE_IDCESPITE, idcespite);
|
||||
TString filtro;
|
||||
filtro << "(ANSI(DTMOV)>=\"" << inies.string(ANSI) << "\")";
|
||||
|
@ -9,7 +9,8 @@ int main(int argc,char** argv)
|
||||
switch(n)
|
||||
{
|
||||
case 1: ce2200(argc, argv); break; // Apertura nuovo esercizio
|
||||
case 2: ce2300(argc, argv); break; // Generazione movimenti contabili
|
||||
case 2: ce2300(argc, argv); break; // Collegamenti contabili
|
||||
case 3: ce2400(argc, argv); break; // Generazione movimenti contabili
|
||||
default: ce2100(argc, argv); break; // Calcolo ammortamenti
|
||||
}
|
||||
exit(0);
|
||||
|
1
ce/ce2.h
1
ce/ce2.h
@ -1,3 +1,4 @@
|
||||
int ce2100(int argc, char* argv[]);
|
||||
int ce2200(int argc, char* argv[]);
|
||||
int ce2300(int argc, char* argv[]);
|
||||
int ce2400(int argc, char* argv[]);
|
||||
|
@ -68,14 +68,14 @@ END
|
||||
|
||||
NUMBER F_GRUPPO 2
|
||||
BEGIN
|
||||
PROMPT 1 4 "Gruppo "
|
||||
PROMPT 1 4 "Gruppo "
|
||||
FLAGS "Z"
|
||||
FIELD CODTAB[5,6]
|
||||
END
|
||||
|
||||
STRING F_SPECIE 4
|
||||
BEGIN
|
||||
PROMPT 16 4 "Specie "
|
||||
PROMPT 12 4 "Specie "
|
||||
FLAGS "_"
|
||||
USE CCB
|
||||
JOIN %CAT ALIAS 400 INTO CODTAB=CODTAB[5,10]
|
||||
@ -97,9 +97,9 @@ BEGIN
|
||||
FIELD CODTAB[7,10]
|
||||
END
|
||||
|
||||
STRING F_DESC_GRSP 60 45
|
||||
STRING F_DESC_GRSP 60 50
|
||||
BEGIN
|
||||
PROMPT 31 4 ""
|
||||
PROMPT 26 4 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
|
@ -1620,7 +1620,7 @@ void TCespite::calc_amm_residui(bool is_valid)
|
||||
{
|
||||
_ammpro.put(AMMCE_PNOR, "100");
|
||||
_ammpro.zero(AMMCE_PANT); _ammpro.zero(AMMCE_PACC);
|
||||
_ammpro.put(AMMCE_MSG04, "X");
|
||||
_ammpro.put(AMMCE_MSG04, "X"); // Ammortamento totale
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1802,7 +1802,11 @@ void TCespite::agg_spe_man(bool is_valid)
|
||||
}
|
||||
|
||||
real speman = ccb.get(field);
|
||||
speman += vspmanu;
|
||||
if (tpspeman == 3)
|
||||
speman += vspmanu * 0.25; // 25%
|
||||
else
|
||||
speman += vspmanu * 0.05; // 5%
|
||||
|
||||
ccb.put(field, speman);
|
||||
ccb.put("D0", TDate(TODAY));
|
||||
|
||||
@ -1820,7 +1824,7 @@ bool TCespite::calc_amm(int tipo_sit, const TDate& data_limite, bool recalc_spe_
|
||||
log("* Inizio calcolo situazione %d cespite %s", tipo_sit, (const char*)idcespite);
|
||||
|
||||
#ifdef DBG
|
||||
if (tipo_sit == 1 && atol(idcespite) == 146L)
|
||||
if (tipo_sit == 1 && atol(idcespite) == 445L)
|
||||
{
|
||||
tipo_sit = 1; // Put your breakpoint here
|
||||
}
|
||||
|
349
ce/ce2300.cpp
349
ce/ce2300.cpp
@ -1,35 +1,364 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <modaut.h>
|
||||
#include <recarray.h>
|
||||
#include <relapp.h>
|
||||
#include <sheet.h>
|
||||
|
||||
class TCesp2cg_mask : public TAutomask
|
||||
#include "cespi.h"
|
||||
|
||||
#include "celib.h"
|
||||
#include "collces.h"
|
||||
|
||||
#include "ce2300a.h"
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// Ricerca per categoria su collces
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
class TCollces_sheet : public TBrowse_sheet
|
||||
{
|
||||
protected:
|
||||
virtual void get_row(long n, TToken_string& row);
|
||||
|
||||
public:
|
||||
TCollces_sheet(TCursor* cursor, TEdit_field* ef, TToken_string& sibling);
|
||||
};
|
||||
|
||||
void TCollces_sheet::get_row(long n, TToken_string& row)
|
||||
{
|
||||
TBrowse_sheet::get_row(n, row);
|
||||
const int gru = row.get_int(0);
|
||||
TString8 spe = row.get();
|
||||
switch(spe.len())
|
||||
{
|
||||
case 1: spe.right_just(2); break;
|
||||
case 3: spe.insert(" "); break;
|
||||
default: break;
|
||||
}
|
||||
const int cat = row.get_int();
|
||||
const TString& desc = ditta_cespiti().categoria(gru, spe, cat).get("S0");
|
||||
row.add(desc, 3);
|
||||
}
|
||||
|
||||
TCollces_sheet::TCollces_sheet(TCursor* cursor, TEdit_field* ef, TToken_string& sibling)
|
||||
: TBrowse_sheet(cursor, "CODGRUPPO|CODSPECIE|CODCAT|CODCAT", "Categorie",
|
||||
"Gruppo|Specie|Categoria|Descrizione@70", 0, ef, sibling)
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// Maschera query
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
class TCesp2cg_qmask : public TAutomask
|
||||
{
|
||||
TCursor* _curcoll;
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TCesp2cg_mask() : TAutomask("ce2300a") { }
|
||||
TCesp2cg_qmask(TRelation* rel);
|
||||
virtual ~TCesp2cg_qmask();
|
||||
};
|
||||
|
||||
bool TCesp2cg_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
bool TCesp2cg_qmask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_CODCAT:
|
||||
if (e == fe_button)
|
||||
{
|
||||
TEdit_field& ef = (TEdit_field&)o;
|
||||
TToken_string sibling;
|
||||
TCollces_sheet sht(_curcoll, &ef, sibling);
|
||||
if (!o.empty())
|
||||
{
|
||||
TRectype& rec = _curcoll->curr();
|
||||
rec.zero();
|
||||
rec.put(COLLCES_CODGRUPPO, get(F_GRUPPO));
|
||||
rec.put(COLLCES_CODSPECIE, get(F_SPECIE));
|
||||
rec.put(COLLCES_CODCAT, o.get());
|
||||
long sel = _curcoll->read();
|
||||
sht.select(sel);
|
||||
}
|
||||
if (sht.run() == K_ENTER)
|
||||
{
|
||||
TToken_string row = sht.row();
|
||||
o.set(row.get(2));
|
||||
set(F_DESCAT, row.get(3));
|
||||
send_key(K_ENTER, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case F_CODCAT2:
|
||||
return ditta_cespiti().on_category_event(o, e, jolly);
|
||||
case F_IDCESPITE:
|
||||
if (e == fe_close)
|
||||
{
|
||||
const TRectype& cesp = cache().get(LF_CESPI, o.get());
|
||||
if (cesp.empty())
|
||||
return error_box("Inserire un cespite valido");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
class TCesp2cg : public TSkeleton_application
|
||||
TCesp2cg_qmask::TCesp2cg_qmask(TRelation* rel) : TAutomask("ce2300a")
|
||||
{
|
||||
_curcoll = new TCursor(rel, "IDCESPITE=\"\"");
|
||||
}
|
||||
|
||||
TCesp2cg_qmask::~TCesp2cg_qmask()
|
||||
{
|
||||
delete _curcoll;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// Maschera principale
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
class TCesp2cg_emask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
void test_duplication(short g1, short g2);
|
||||
|
||||
public:
|
||||
TCesp2cg_emask() : TAutomask("ce2300b") { }
|
||||
};
|
||||
|
||||
void TCesp2cg::main_loop()
|
||||
// Se i due gruppi-conti-sottoconti sono uguali azzera il primo
|
||||
void TCesp2cg_emask::test_duplication(short g1, short g2)
|
||||
{
|
||||
TString16 s1, s2;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
s1 << get(g1+i) << ' ';
|
||||
s2 << get(g2+i) << ' ';
|
||||
}
|
||||
if (!s1.blank() && s1 == s2)
|
||||
{
|
||||
warning_box("Non si deve specificare lo stesso conto della riga precedente");
|
||||
for (int i = 0; i < 4; i++)
|
||||
reset(g1+i);
|
||||
}
|
||||
}
|
||||
|
||||
bool TCesp2cg_emask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
TCesp2cg_mask m;
|
||||
m.run();
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_CODCAT:
|
||||
case F_CODCAT2:
|
||||
if (e == fe_init)
|
||||
return ditta_cespiti().on_category_event(o, e, jolly);
|
||||
break;
|
||||
case F_TIPO:
|
||||
if (e == fe_modify || e == fe_close)
|
||||
{
|
||||
const int tipo = field(F_IDCESPITE).empty() ? 1 : 2;
|
||||
set(F_COMPL, tipo == get_int(F_TIPO) ? "X" : "");
|
||||
}
|
||||
break;
|
||||
case F_QANT_S:
|
||||
if (e == fe_modify || e == fe_close)
|
||||
test_duplication(F_QANT_G, F_QNOR_G);
|
||||
break;
|
||||
case F_QACC_S:
|
||||
if (e == fe_modify || e == fe_close)
|
||||
{
|
||||
test_duplication(F_QACC_G, F_QANT_G);
|
||||
test_duplication(F_QACC_G, F_QNOR_G);
|
||||
}
|
||||
break;
|
||||
case F_FANT_S:
|
||||
if (e == fe_modify || e == fe_close)
|
||||
test_duplication(F_FANT_G, F_FNOR_G);
|
||||
break;
|
||||
case F_FACC_S:
|
||||
if (e == fe_modify || e == fe_close)
|
||||
{
|
||||
test_duplication(F_FACC_G, F_FANT_G);
|
||||
test_duplication(F_FACC_G, F_FNOR_G);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// Programma principale
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
class TCesp2cg : public TRelation_application
|
||||
{
|
||||
TRelation* _rel;
|
||||
TMask* _qmsk;
|
||||
TMask* _emsk;
|
||||
|
||||
protected:
|
||||
virtual bool changing_mask(int mode) { return TRUE; }
|
||||
virtual TMask* get_mask(int mode);
|
||||
virtual TRelation* get_relation() const { return _rel; }
|
||||
|
||||
virtual void init_query_mode(TMask& m);
|
||||
virtual void init_query_insert_mode(TMask& m);
|
||||
virtual void init_insert_mode(TMask& m);
|
||||
virtual void init_modify_mode(TMask& m);
|
||||
|
||||
virtual bool user_create();
|
||||
virtual bool user_destroy();
|
||||
|
||||
public:
|
||||
const TRectype& curr_cat(const TMask& m) const;
|
||||
void init_mask(TMask& m) const;
|
||||
void copy_cat(TMask& m, const TRectype& cat) const;
|
||||
|
||||
TCesp2cg() : _rel(NULL), _qmsk(NULL), _emsk(NULL) { }
|
||||
};
|
||||
|
||||
bool TCesp2cg::user_create()
|
||||
{
|
||||
if (!has_module(CGAUT))
|
||||
{
|
||||
error_box("È necessario attivare il modulo contabilità");
|
||||
return FALSE;
|
||||
}
|
||||
_rel = new TRelation(LF_COLLCES);
|
||||
_qmsk = new TCesp2cg_qmask(_rel);
|
||||
_emsk = new TCesp2cg_emask;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TMask* TCesp2cg::get_mask(int mode)
|
||||
{
|
||||
return (mode == MODE_QUERY || mode == MODE_QUERYINS) ? _qmsk : _emsk;
|
||||
}
|
||||
|
||||
void TCesp2cg::init_query_mode(TMask& m)
|
||||
{
|
||||
ditta_cespiti().init_mask(m);
|
||||
m.show(-1);
|
||||
m.hide(-2);
|
||||
}
|
||||
|
||||
void TCesp2cg::init_query_insert_mode(TMask& m)
|
||||
{
|
||||
m.hide(-1);
|
||||
m.show(-2);
|
||||
}
|
||||
|
||||
// Compia nella maschera corrente i dati prelevati dalla categoria
|
||||
// sovrascrivendo quelli del cespite.
|
||||
void TCesp2cg::copy_cat(TMask& m, const TRectype& cat) const
|
||||
{
|
||||
const TRectype saverec = _rel->curr(); // Salvo record principale e ...
|
||||
_rel->curr() = cat; // ... gli scrivo sopra i dati della categoria
|
||||
// Carico tutti i campi a partire dalla quota normale in poi
|
||||
for (int i = m.id2pos(F_QNOR_G); i < m.fields(); i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
if (f.is_edit())
|
||||
((TLoadable_field&)f).autoload(*_rel);
|
||||
}
|
||||
_rel->curr() = saverec; // Ripristino record principale
|
||||
}
|
||||
|
||||
const TRectype& TCesp2cg::curr_cat(const TMask& m) const
|
||||
{
|
||||
const int gru = m.get_int(F_GRUPPO);
|
||||
const char* spe = m.get(F_SPECIE);
|
||||
int cat = m.get_int(F_CODCAT);
|
||||
if (cat == 0)
|
||||
cat = cache().get(LF_CESPI, m.get(F_IDCESPITE)).get_int(CESPI_CODCAT);
|
||||
return ditta_cespiti().categoria(gru, spe, cat);
|
||||
}
|
||||
|
||||
void TCesp2cg::init_mask(TMask& m) const
|
||||
{
|
||||
const int ese = m.get_int(F_ESERCIZIO);
|
||||
const int gru = m.get_int(F_GRUPPO);
|
||||
const char* spe = m.get(F_SPECIE);
|
||||
ditta_cespiti().set_attivita(ese, gru, spe);
|
||||
|
||||
const TRectype& cac = curr_cat(m);
|
||||
const bool materiali = cac.get_int("I0") == 0;
|
||||
m.field(F_FNOR_S).check_type(materiali ? CHECK_REQUIRED : CHECK_NORMAL);
|
||||
m.field(F_FNOR_D).check_type(materiali ? CHECK_REQUIRED : CHECK_NORMAL);
|
||||
m.enable(-3, materiali);
|
||||
}
|
||||
|
||||
|
||||
void TCesp2cg::init_insert_mode(TMask& m)
|
||||
{
|
||||
init_mask(m);
|
||||
|
||||
// Valori preimpostati "quasi" sempre buoni :-)
|
||||
m.set(F_TIPO, 1); m.set(F_TIPOTRAS, "T");
|
||||
|
||||
const TString& idcespite = m.get(F_IDCESPITE);
|
||||
if (!idcespite.blank())
|
||||
{
|
||||
const int gru = m.get_int(F_GRUPPO);
|
||||
const char* spe = m.get(F_SPECIE);
|
||||
const int cat = cache().get(LF_CESPI, idcespite).get_int(CESPI_CODCAT);
|
||||
TToken_string key; key.add(gru); key.add(spe); key.add(cat);
|
||||
const TRectype& coll = cache().get(LF_COLLCES, key);
|
||||
if (coll.get_bool(COLLCES_COMPL))
|
||||
{
|
||||
m.set(F_TIPO, 1);
|
||||
copy_cat(m, coll);
|
||||
}
|
||||
else
|
||||
m.set(F_TIPO, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void TCesp2cg::init_modify_mode(TMask& m)
|
||||
{
|
||||
init_mask(m);
|
||||
|
||||
const TString& idcespite = m.get(F_IDCESPITE);
|
||||
if (!idcespite.blank())
|
||||
{
|
||||
if (!m.get_bool(F_COMPL))
|
||||
{
|
||||
const int gru = m.get_int(F_GRUPPO);
|
||||
const char* spe = m.get(F_SPECIE);
|
||||
const int cat = cache().get(LF_CESPI, idcespite).get_int(CESPI_CODCAT);
|
||||
TToken_string key; key.add(gru); key.add(spe); key.add(cat);
|
||||
const TRectype& coll = cache().get(LF_COLLCES, key);
|
||||
if (coll.get_bool(COLLCES_COMPL))
|
||||
{
|
||||
m.set(F_TIPO, 1);
|
||||
copy_cat(m, coll);
|
||||
}
|
||||
else
|
||||
m.set(F_TIPO, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TCesp2cg::user_destroy()
|
||||
{
|
||||
delete _emsk;
|
||||
delete _qmsk;
|
||||
delete _rel;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int ce2300(int argc, char* argv[])
|
||||
{
|
||||
TCesp2cg a;
|
||||
a.run(argc, argv, "Trasferimento movimenti contabili");
|
||||
a.run(argc, argv, "Collegamenti contabili");
|
||||
return 0;
|
||||
}
|
||||
|
57
ce/ce2300a.h
57
ce/ce2300a.h
@ -1 +1,56 @@
|
||||
#define F_DITTA 101
|
||||
#define F_DITTA 101
|
||||
#define F_RAGSOC 102
|
||||
#define F_ESERCIZIO 103
|
||||
#define F_INIZIO_ES 104
|
||||
#define F_FINE_ES 105
|
||||
#define F_GRUPPO 106
|
||||
#define F_SPECIE 107
|
||||
#define F_DESC_GRSP 108
|
||||
|
||||
#define F_TIPO 110
|
||||
#define F_CODCAT 111
|
||||
#define F_DESCAT 112
|
||||
#define F_IDCESPITE 113
|
||||
#define F_DESCES 114
|
||||
#define F_TIPO2 115
|
||||
#define F_CODCAT2 116
|
||||
#define F_DESCAT2 117
|
||||
#define F_IDCESPITE2 118
|
||||
#define F_TIPOTRAS 119
|
||||
#define F_CENTRO_COS 120
|
||||
#define F_COMPL 121
|
||||
|
||||
#define F_IMM_G 201
|
||||
#define F_IMM_C 202
|
||||
#define F_IMM_S 203
|
||||
#define F_IMM_D 204
|
||||
|
||||
#define F_QNOR_G 205
|
||||
#define F_QNOR_C 206
|
||||
#define F_QNOR_S 207
|
||||
#define F_QNOR_D 208
|
||||
|
||||
#define F_QANT_G 209
|
||||
#define F_QANT_C 210
|
||||
#define F_QANT_S 211
|
||||
#define F_QANT_D 212
|
||||
|
||||
#define F_QACC_G 213
|
||||
#define F_QACC_C 214
|
||||
#define F_QACC_S 215
|
||||
#define F_QACC_D 216
|
||||
|
||||
#define F_FNOR_G 217
|
||||
#define F_FNOR_C 218
|
||||
#define F_FNOR_S 219
|
||||
#define F_FNOR_D 220
|
||||
|
||||
#define F_FANT_G 221
|
||||
#define F_FANT_C 222
|
||||
#define F_FANT_S 223
|
||||
#define F_FANT_D 224
|
||||
|
||||
#define F_FACC_G 225
|
||||
#define F_FACC_C 226
|
||||
#define F_FACC_S 227
|
||||
#define F_FACC_D 228
|
||||
|
222
ce/ce2300a.uml
222
ce/ce2300a.uml
@ -2,19 +2,233 @@
|
||||
|
||||
TOOLBAR "Toolbar" 0 -3 0 3
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BUTTON DLG_SAVEREC 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -11 ""
|
||||
PROMPT -16 -11 "~Registra"
|
||||
MESSAGE EXIT,K_SAVE
|
||||
PICTURE BMP_SAVEREC
|
||||
PICTURE BMP_SAVERECDN
|
||||
END
|
||||
|
||||
BUTTON DLG_NEWREC 10 2
|
||||
BEGIN
|
||||
PROMPT -26 -11 "~Nuovo"
|
||||
MESSAGE EXIT,K_INS
|
||||
PICTURE BMP_NEWREC
|
||||
PICTURE BMP_NEWRECDN
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 10 2
|
||||
BEGIN
|
||||
PROMPT -36 -11 "~Elimina"
|
||||
MESSAGE EXIT,K_DEL
|
||||
PICTURE BMP_DELREC
|
||||
PICTURE BMP_DELRECDN
|
||||
END
|
||||
|
||||
BUTTON DLG_FINDREC 10 2
|
||||
BEGIN
|
||||
PROMPT -46 -11 "Ri~cerca"
|
||||
MESSAGE EXIT,K_F9
|
||||
PICTURE 126
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -56 -11 "~Annulla"
|
||||
MESSAGE EXIT,K_ESC
|
||||
PICTURE 102
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -11 ""
|
||||
PROMPT -66 -11 "~Fine"
|
||||
MESSAGE EXIT,K_QUIT
|
||||
PICTURE BMP_QUIT
|
||||
PICTURE BMP_QUITDN
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Trasferimento a contabilità" -1 -1 78 18
|
||||
PAGE "Collegamenti contabili" -1 -1 78 18
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
BEGIN
|
||||
PROMPT 0 1 "@bParametri ditta"
|
||||
END
|
||||
|
||||
NUMBER F_DITTA 5
|
||||
BEGIN
|
||||
PROMPT 1 2 "Ditta "
|
||||
FLAGS "DF"
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 26 2 ""
|
||||
USE LF_NDITTE
|
||||
INPUT CODDITTA F_DITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER F_ESERCIZIO 4
|
||||
BEGIN
|
||||
PROMPT 1 3 "Esercizio "
|
||||
FLAGS "AZ"
|
||||
USE CCE
|
||||
JOIN ESC ALIAS 104 INTO CODTAB==CODTAB
|
||||
INPUT CODTAB F_ESERCIZIO
|
||||
DISPLAY "Codice esercizio" CODTAB
|
||||
DISPLAY "Inizio esercizio" 104@->D0
|
||||
DISPLAY "Fine esercizio" 104@->D1
|
||||
OUTPUT F_ESERCIZIO CODTAB
|
||||
OUTPUT F_INIZIO_ES 104@->D0
|
||||
OUTPUT F_FINE_ES 104@->D1
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
DATE F_INIZIO_ES
|
||||
BEGIN
|
||||
PROMPT 26 3 "Inizio "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
DATE F_FINE_ES
|
||||
BEGIN
|
||||
PROMPT 50 3 "Fine "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER F_GRUPPO 2
|
||||
BEGIN
|
||||
PROMPT 1 4 "Gruppo "
|
||||
FLAGS "PZ"
|
||||
FIELD CODGRUPPO
|
||||
KEY 1
|
||||
END
|
||||
|
||||
STRING F_SPECIE 4
|
||||
BEGIN
|
||||
PROMPT 16 4 "Specie "
|
||||
FLAGS "_P"
|
||||
USE CCB
|
||||
JOIN %CAT ALIAS 400 INTO CODTAB=CODTAB[5,10]
|
||||
INPUT CODTAB[1,4] F_ESERCIZIO SELECT
|
||||
INPUT CODTAB[5,6] F_GRUPPO
|
||||
INPUT CODTAB[7,10] F_SPECIE
|
||||
DISPLAY "Gruppo" CODTAB[5,6]
|
||||
DISPLAY "Specie" CODTAB[7,10]
|
||||
DISPLAY "Descrizione@50" 400@->S0
|
||||
OUTPUT F_GRUPPO CODTAB[5,6]
|
||||
OUTPUT F_SPECIE CODTAB[7,10]
|
||||
OUTPUT F_DESC_GRSP 400@->S0
|
||||
CHECKTYPE FORCED
|
||||
FIELD CODSPECIE
|
||||
KEY 1
|
||||
END
|
||||
|
||||
STRING F_DESC_GRSP 60 45
|
||||
BEGIN
|
||||
PROMPT 31 4 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
RADIOBUTTON F_TIPO 1 14
|
||||
BEGIN
|
||||
PROMPT 0 6 "Selezione"
|
||||
ITEM "1|Categorie"
|
||||
MESSAGE ENABLE,F_CODCAT|CLEAR,F_IDCESPITE|REQUIRED,F_CODCAT|NORMAL,F_IDCESPITE|"1",F_TIPO2
|
||||
ITEM "2|Cespiti"
|
||||
MESSAGE ENABLE,F_IDCESPITE|CLEAR,F_CODCAT|NORMAL,F_CODCAT|REQUIRED,F_IDCESPITE|"2",F_TIPO2
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
RADIOBUTTON F_TIPO2 1 14
|
||||
BEGIN
|
||||
PROMPT 0 6 "Selezione"
|
||||
FLAGS "P"
|
||||
ITEM "1|Categorie"
|
||||
MESSAGE ENABLE,F_CODCAT2|CLEAR,F_IDCESPITE2|REQUIRED,F_CODCAT2,NORMAL,F_IDCESPITE2
|
||||
ITEM "2|Cespiti"
|
||||
MESSAGE ENABLE,F_IDCESPITE2|CLEAR,F_CODCAT2|NORMAL,F_CODCAT2,REQUIRED,F_IDCESPITE2
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
|
||||
NUMBER F_CODCAT 2
|
||||
BEGIN
|
||||
PROMPT 16 7 ""
|
||||
FLAGS "BZ"
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD CODCAT
|
||||
KEY 1
|
||||
MESSAGE COPY,F_CODCAT2
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
NUMBER F_CODCAT2 2
|
||||
BEGIN
|
||||
PROMPT 16 7 ""
|
||||
FLAGS "BHZ"
|
||||
DRIVENBY F_GRUPPO
|
||||
DRIVENBY F_SPECIE
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD CODCAT
|
||||
MESSAGE COPY,F_CODCAT
|
||||
KEY 1
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
STRING F_DESCAT 70 54
|
||||
BEGIN
|
||||
PROMPT 22 7 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER F_IDCESPITE 10
|
||||
BEGIN
|
||||
PROMPT 16 8 ""
|
||||
FLAGS "Z"
|
||||
USE LF_COLLCES SELECT IDCESPITE!=""
|
||||
JOIN LF_CESPI INTO IDCESPITE==IDCESPITE
|
||||
INPUT CODGRUPPO F_GRUPPO SELECT
|
||||
INPUT CODSPECIE F_SPECIE SELECT
|
||||
INPUT IDCESPITE F_IDCESPITE
|
||||
DISPLAY "Cespite@10" IDCESPITE
|
||||
DISPLAY "Categoria" LF_CESPI->CODCAT
|
||||
DISPLAY "Descrizione@50" LF_CESPI->DESC
|
||||
OUTPUT F_IDCESPITE IDCESPITE
|
||||
OUTPUT F_DESCES LF_CESPI->DESC
|
||||
CHECKTYPE REQUIRED
|
||||
MESSAGE COPY,F_IDCESPITE2
|
||||
FIELD IDCESPITE
|
||||
KEY 1
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
NUMBER F_IDCESPITE2 10
|
||||
BEGIN
|
||||
PROMPT 16 8 ""
|
||||
FLAGS "HZ"
|
||||
USE LF_CESPI
|
||||
INPUT IDCESPITE F_IDCESPITE2
|
||||
COPY DISPLAY F_IDCESPITE
|
||||
COPY OUTPUT F_IDCESPITE
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD IDCESPITE
|
||||
MESSAGE COPY,F_IDCESPITE
|
||||
KEY 1
|
||||
GROUP 2
|
||||
WARNING "Inserire un cespite valido"
|
||||
END
|
||||
|
||||
STRING F_DESCES 50 47
|
||||
BEGIN
|
||||
PROMPT 29 8 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
|
232
ce/ce2400.cpp
Executable file
232
ce/ce2400.cpp
Executable file
@ -0,0 +1,232 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <execp.h>
|
||||
#include <progind.h>
|
||||
#include <relation.h>
|
||||
|
||||
#include "celib.h"
|
||||
#include "ce2101.h"
|
||||
#include "ce2400a.h"
|
||||
|
||||
#include "cespi.h"
|
||||
#include "movce.h"
|
||||
|
||||
class TCesp_tras_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
protected:
|
||||
void fill_dates();
|
||||
|
||||
public:
|
||||
TCesp_tras_mask() : TAutomask("ce2400a") { }
|
||||
};
|
||||
|
||||
void TCesp_tras_mask::fill_dates()
|
||||
{
|
||||
TSheet_field& s = sfield(F_DATE_CALC);
|
||||
TRelation rel("CCB");
|
||||
rel.add("%CAT", "CODTAB=CODTAB[5,10]");
|
||||
|
||||
TString expr;
|
||||
expr << "CODTAB[1,4]==" << get(F_ESERCIZIO);
|
||||
TCursor cur(&rel, expr);
|
||||
const long items = cur.items();
|
||||
cur.freeze();
|
||||
s.destroy();
|
||||
const TRectype& curr = rel.curr();
|
||||
const TRectype& cat = rel.curr(LF_TABCOM);
|
||||
bool some_empty = FALSE;
|
||||
for (cur = 0; cur.pos() < items; ++cur)
|
||||
{
|
||||
TToken_string& row = s.row(-1);
|
||||
const TString& data = curr.get("D0");
|
||||
some_empty |= data.blank();
|
||||
row.add(data);
|
||||
row.add(curr.get("CODTAB").mid(4,2));
|
||||
row.add(curr.get("CODTAB").mid(6,4));
|
||||
row.add(cat.get("S0"));
|
||||
}
|
||||
s.force_update();
|
||||
if (some_empty)
|
||||
{
|
||||
disable(F_CALC);
|
||||
set(F_CALC, "X");
|
||||
}
|
||||
else
|
||||
enable(F_CALC);
|
||||
}
|
||||
|
||||
bool TCesp_tras_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch(o.dlg())
|
||||
{
|
||||
case F_ESERCIZIO:
|
||||
if (e == fe_init || e == fe_modify)
|
||||
fill_dates();
|
||||
break;
|
||||
case F_DATE_CALC:
|
||||
if (e == se_query_add || e == se_query_del)
|
||||
return FALSE;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Iteratori
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
typedef bool (*RecordHandler)(TRelation& rel, void* jolly);
|
||||
|
||||
unsigned long scan_cursor(TCursor& cur, RecordHandler rh, void* jolly)
|
||||
{
|
||||
unsigned long processed = 0;
|
||||
const long items = cur.items();
|
||||
if (items > 0)
|
||||
{
|
||||
TProgind* pi = items < 16 ? NULL : new TProgind(items, "Elaborazione in corso...");
|
||||
|
||||
TRelation& rel = *cur.relation();
|
||||
cur.freeze();
|
||||
for (cur = 0; cur.pos() < items; ++cur)
|
||||
{
|
||||
if (pi)
|
||||
pi->addstatus(1);
|
||||
if (rh(rel, jolly))
|
||||
processed++;
|
||||
}
|
||||
|
||||
if (pi)
|
||||
delete pi;
|
||||
}
|
||||
return processed;
|
||||
}
|
||||
|
||||
unsigned long scan_file(int lf, RecordHandler rh, void* jolly)
|
||||
{
|
||||
TRelation rel(lf);
|
||||
TCursor cur(&rel);
|
||||
return scan_cursor(cur, rh, jolly);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Applicazione principale
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TCesp_tras : public TSkeleton_application
|
||||
{
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
|
||||
public:
|
||||
void calcolo(const TMask& m);
|
||||
void trasferimento(const TMask& m);
|
||||
};
|
||||
|
||||
void TCesp_tras::calcolo(const TMask& m)
|
||||
{
|
||||
TExternal_app a("ce2 -0 A");
|
||||
|
||||
TSheet_field& s = m.sfield(F_DATE_CALC);
|
||||
for (int i = 0; i < s.items(); i++)
|
||||
{
|
||||
TToken_string& row = s.row(i);
|
||||
const int anno = m.get_int(F_ESERCIZIO);
|
||||
const int gruppo = row.get_int(1);
|
||||
const TString4 specie = row.get();
|
||||
ditta_cespiti().set_attivita(anno, gruppo, specie);
|
||||
a.run();
|
||||
}
|
||||
}
|
||||
|
||||
struct TTras_data
|
||||
{
|
||||
int _anno;
|
||||
TDate _inizio, _fine;
|
||||
const TCespite* _cespite;
|
||||
};
|
||||
|
||||
static bool MovHandler(TRelation& rel, void* jolly)
|
||||
{
|
||||
const TTras_data& data = *(const TTras_data*)jolly;
|
||||
const TRectype& movce = rel.curr();
|
||||
|
||||
if (movce.get_bool(MOVCE_STAMPATO)) // Salta i movimenti già stampati su bollato
|
||||
return FALSE;
|
||||
|
||||
const TDate dtmov = movce.get(MOVCE_DTMOV);
|
||||
const TDate dtacq = data._cespite->get(CESPI_DTCOMP);
|
||||
if (dtmov < dtacq) // Ignora movimenti precedenti l'acquisizione del cespite
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool CespHandler(TRelation& rel, void* jolly)
|
||||
{
|
||||
const TCespite cespite(rel.curr());
|
||||
|
||||
TTras_data& data = *(TTras_data*)jolly;
|
||||
data._cespite = &cespite; // Inizializza cespite corrente
|
||||
|
||||
const TDate dtalien = cespite.get(CESPI_DTALIEN);
|
||||
if (dtalien.ok() && dtalien < data._inizio) // Escludi cespiti alienati
|
||||
return FALSE;
|
||||
|
||||
const TDate dtcomp = cespite.get(CESPI_DTCOMP);
|
||||
if (!dtcomp.ok() || dtcomp > data._fine) // Escludi cespiti non in funzione
|
||||
return FALSE;
|
||||
|
||||
const TRectype& cat = cespite.categoria();
|
||||
if (cat.get_bool("B0")) // Categoria non ammortizzabile
|
||||
return FALSE;
|
||||
|
||||
// Scansione di tutti i movimenti dell'anno relativi al cespite corrente
|
||||
TRelation rel_movce(LF_MOVCE);
|
||||
rel_movce.add(LF_MOVAM, "IDCESPITE==IDCESPITE|IDMOV==IDMOV|TPAMM==1"); // Solo situazione fiscale
|
||||
rel_movce.add(LF_AMMMV, "IDCESPITE==IDCESPITE|IDMOV==IDMOV|TPAMM==1");
|
||||
TRectype& movce = rel_movce.curr();
|
||||
movce.put(MOVCE_IDCESPITE, cespite.get(CESPI_IDCESPITE));
|
||||
TString expr;
|
||||
expr << "(ANSI(DTMOV)>=" << data._inizio.string(ANSI) << ")&&";
|
||||
expr << "(ANSI(DTMOV)<=" << data._fine.string(ANSI) << ")";
|
||||
TCursor cur_movce(&rel_movce, expr, 1, &movce, &movce);
|
||||
scan_cursor(cur_movce, MovHandler, jolly);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TCesp_tras::trasferimento(const TMask& m)
|
||||
{
|
||||
TTras_data data;
|
||||
data._anno = m.get_int(F_ESERCIZIO);
|
||||
data._inizio = m.get(F_INIZIO_ES);
|
||||
data._fine = m.get(F_FINE_ES);
|
||||
|
||||
scan_file(LF_CESPI, CespHandler, &data);
|
||||
}
|
||||
|
||||
void TCesp_tras::main_loop()
|
||||
{
|
||||
TDitta_cespiti& dc = ditta_cespiti();
|
||||
TCesp_tras_mask m;
|
||||
dc.init_mask(m);
|
||||
|
||||
if (m.run() == K_ENTER)
|
||||
{
|
||||
if (m.get_bool(F_CALC))
|
||||
calcolo(m);
|
||||
trasferimento(m);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int ce2400(int argc, char* argv[])
|
||||
{
|
||||
TCesp_tras a;
|
||||
a.run(argc, argv, "Trasferimento movimenti");
|
||||
return 0;
|
||||
}
|
17
ce/ce2400a.h
Executable file
17
ce/ce2400a.h
Executable file
@ -0,0 +1,17 @@
|
||||
#define F_DITTA 201
|
||||
#define F_RAGSOC 202
|
||||
#define F_ESERCIZIO 203
|
||||
#define F_INIZIO_ES 204
|
||||
#define F_FINE_ES 205
|
||||
|
||||
#define F_DATAREG 206
|
||||
#define F_DATACOM 207
|
||||
#define F_DATATRA 208
|
||||
#define F_CALC 209
|
||||
|
||||
#define F_DATE_CALC 200
|
||||
|
||||
#define F_DATA_CALC 101
|
||||
#define F_GRUPPO 102
|
||||
#define F_SPECIE 103
|
||||
#define F_DESC_GRSP 104
|
157
ce/ce2400a.uml
Executable file
157
ce/ce2400a.uml
Executable file
@ -0,0 +1,157 @@
|
||||
#include "ce2400a.h"
|
||||
|
||||
TOOLBAR "Toolbar" 0 -3 0 3
|
||||
|
||||
BUTTON DLG_ELABORA 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -11 "~Elabora"
|
||||
MESSAGE EXIT,K_ENTER
|
||||
PICTURE BMP_ELABORA
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -11 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Trasferimento movimenti" -1 -1 78 18
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
BEGIN
|
||||
PROMPT 0 1 "@bParametri ditta"
|
||||
END
|
||||
|
||||
NUMBER F_DITTA 5
|
||||
BEGIN
|
||||
PROMPT 1 2 "Ditta "
|
||||
FLAGS "DF"
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 26 2 ""
|
||||
USE LF_NDITTE
|
||||
INPUT CODDITTA F_DITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER F_ESERCIZIO 4
|
||||
BEGIN
|
||||
PROMPT 1 3 "Esercizio "
|
||||
FLAGS "Z"
|
||||
USE CCE
|
||||
JOIN ESC ALIAS 104 INTO CODTAB==CODTAB
|
||||
INPUT CODTAB F_ESERCIZIO
|
||||
DISPLAY "Codice esercizio" CODTAB
|
||||
DISPLAY "Inizio esercizio" 104@->D0
|
||||
DISPLAY "Fine esercizio" 104@->D1
|
||||
OUTPUT F_ESERCIZIO CODTAB
|
||||
OUTPUT F_INIZIO_ES 104@->D0
|
||||
OUTPUT F_FINE_ES 104@->D1
|
||||
OUTPUT F_DATATRA D0
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
DATE F_INIZIO_ES
|
||||
BEGIN
|
||||
PROMPT 26 3 "Inizio "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
DATE F_FINE_ES
|
||||
BEGIN
|
||||
PROMPT 50 3 "Fine "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
DATE F_DATATRA
|
||||
BEGIN
|
||||
PROMPT 1 4 "Data ultimo trasferimento movimenti "
|
||||
FLAGS "DG"
|
||||
MESSAGE EMPTY ENABLE,DLG_ELABORA
|
||||
MESSAGE DISABLE,DLG_ELABORA
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 3
|
||||
BEGIN
|
||||
PROMPT 0 7 "@bDate da assegnare ai movimenti"
|
||||
END
|
||||
|
||||
DATE F_DATAREG
|
||||
BEGIN
|
||||
PROMPT 1 8 "Data di registrazione "
|
||||
FLAGS "A"
|
||||
END
|
||||
|
||||
DATE F_DATACOM
|
||||
BEGIN
|
||||
PROMPT 41 8 "Data di competenza "
|
||||
FLAGS "A"
|
||||
END
|
||||
|
||||
BOOLEAN F_CALC
|
||||
BEGIN
|
||||
PROMPT 1 13 "Esegui calcolo ammortamenti prima di trasferire i movimenti"
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 1 14 "@bData esecuzione ultimo calcolo ammortamenti"
|
||||
END
|
||||
|
||||
SPREADSHEET F_DATE_CALC 78
|
||||
BEGIN
|
||||
PROMPT 1 15 ""
|
||||
FLAGS "D"
|
||||
ITEM "Data calcolo"
|
||||
ITEM "Gruppo"
|
||||
ITEM "Specie"
|
||||
ITEM "Descrizione@70"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
PAGE "Attività" -1 -1 60 5
|
||||
|
||||
DATE F_DATA_CALC
|
||||
BEGIN
|
||||
PROMPT 1 1 "Data esecuzione ultimo calcolo ammortamenti "
|
||||
END
|
||||
|
||||
NUMBER F_GRUPPO 2
|
||||
BEGIN
|
||||
PROMPT 1 2 "Gruppo "
|
||||
FLAGS "PZ"
|
||||
END
|
||||
|
||||
STRING F_SPECIE 4
|
||||
BEGIN
|
||||
PROMPT 16 2 "Specie "
|
||||
FLAGS "_"
|
||||
END
|
||||
|
||||
STRING F_DESC_GRSP 70 54
|
||||
BEGIN
|
||||
PROMPT 1 3 ""
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
@ -155,7 +155,7 @@ bool TRegistro_cespiti::attivita_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
calc_on = reg_on = FALSE;
|
||||
m.reset(F_CALCOLO);
|
||||
xvt_statbar_set("L'esercizio é stato chiuso");
|
||||
xvt_statbar_set("L'esercizio è stato chiuso");
|
||||
}
|
||||
else
|
||||
if (ccb.get_bool("B1"))
|
||||
@ -452,7 +452,7 @@ void TRegistro_cespiti::aggiorna_bollato()
|
||||
cursor.freeze();
|
||||
for (cursor = 0; cursor.pos() < items; ++cursor)
|
||||
{
|
||||
const TString16 idcespite = curr.get(MOVCE_IDCESPITE); //controlla che il cespite appartenga all'attivitá selezionata
|
||||
const TString16 idcespite = curr.get(MOVCE_IDCESPITE); //controlla che il cespite appartenga all'attività selezionata
|
||||
const TRectype& ces = cache().get(LF_CESPI, idcespite);
|
||||
if (ces.get_int(CESPI_CODCGRA) != _mask->get_int(F_GRUPPO))
|
||||
continue;
|
||||
|
@ -45,7 +45,11 @@ const TString& TLC_form::decode_group(const char* codtab, int mode)
|
||||
{
|
||||
const int order = mode > 0 ? mode : _order;
|
||||
_str = "@b";
|
||||
_str << (order==1 ? "Categoria" : "Impianto") << "@r " << codtab << ' ';
|
||||
if (mode > 0) // Riga
|
||||
_str << "@r" << (order==1 ? "Cat." : "Imp.") << codtab << ' ';
|
||||
else // Testata
|
||||
_str << (order==1 ? "Categoria" : "Impianto") << "@r " << codtab << ' ';
|
||||
|
||||
if (order == 1)
|
||||
{
|
||||
const TRectype& cat = ditta_cespiti().categoria(0, NULL, atoi(codtab));
|
||||
@ -226,12 +230,12 @@ void TLC_app::main_loop()
|
||||
if (!fi.blank())
|
||||
{
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << '(' << CESPI_CODIMP << ">=" << fi << ')';
|
||||
filter << '(' << CESPI_CODIMP << ">=\"" << fi << "\")";
|
||||
}
|
||||
if (!fi.blank())
|
||||
if (!ti.blank())
|
||||
{
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << '(' << CESPI_CODIMP << "<=" << ti << ')';
|
||||
filter << '(' << CESPI_CODIMP << "<=\"" << ti << "\")";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ SECTION HEADER ODD 10
|
||||
STRINGA F_CODDITTA
|
||||
BEGIN
|
||||
KEY "Codice ditta"
|
||||
PROMPT 1 2 "@bDitta@r "
|
||||
PROMPT 1 2 "@bDitta@r "
|
||||
PICTURE "#####"
|
||||
END
|
||||
|
||||
@ -166,15 +166,15 @@ BEGIN
|
||||
FIELD IDCESPITE
|
||||
END
|
||||
|
||||
STRING -1
|
||||
STRING -1 54
|
||||
BEGIN
|
||||
PROMPT 17 1 ""
|
||||
FIELD DESC
|
||||
END
|
||||
|
||||
STRINGA -1 65
|
||||
STRINGA -1 60
|
||||
BEGIN
|
||||
PROMPT 65 1 ""
|
||||
PROMPT 72 1 ""
|
||||
MESSAGE _INVCODTAB
|
||||
END
|
||||
|
||||
|
@ -41,7 +41,7 @@ SECTION HEADER ODD 12
|
||||
STRINGA F_CODDITTA
|
||||
BEGIN
|
||||
KEY "Codice ditta"
|
||||
PROMPT 1 2 "@bDitta@r "
|
||||
PROMPT 1 2 "@bDitta@r "
|
||||
PICTURE "#####"
|
||||
END
|
||||
|
||||
@ -233,15 +233,15 @@ BEGIN
|
||||
FIELD IDCESPITE
|
||||
END
|
||||
|
||||
STRING -1
|
||||
STRING -1 54
|
||||
BEGIN
|
||||
PROMPT 17 1 ""
|
||||
FIELD DESC
|
||||
END
|
||||
|
||||
STRINGA -1 65
|
||||
STRINGA -1 60
|
||||
BEGIN
|
||||
PROMPT 65 1 ""
|
||||
PROMPT 72 1 ""
|
||||
MESSAGE _INVCODTAB
|
||||
END
|
||||
|
||||
|
152
cg/cg1500.cpp
152
cg/cg1500.cpp
@ -92,7 +92,6 @@ class TStampa_bilanci : public TPrintapp
|
||||
TDate udata;
|
||||
};
|
||||
|
||||
cli_for* _cf;
|
||||
TSort * _sort;
|
||||
|
||||
TRelation* _rel;
|
||||
@ -102,7 +101,6 @@ class TStampa_bilanci : public TPrintapp
|
||||
TLocalisamfile* _com, * _pcn, * _mov, * _rmov, * _clifo, * _saldi, * _nditte,* _anag,* _caus;
|
||||
TIsamtempfile * _tmp_saldi_att, * _tmp_saldi_pass, * _tmp_saldi_conti_uno;
|
||||
TIsamtempfile * _tmp_saldi_costi, * _tmp_saldi_ricavi,* _tmp_saldi_conti_due;
|
||||
TTable* _esc;
|
||||
TParagraph_string* _d;
|
||||
const char* _buff;
|
||||
bool _noseparator; // Usa separatore delle migliaia o no?
|
||||
@ -139,7 +137,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;
|
||||
bool _print_exercise, _hide_clifo;
|
||||
int _stampa_mov_prov;
|
||||
|
||||
TString _cdc, _fsc;
|
||||
@ -944,8 +942,8 @@ bool TStampa_bilanci::bil_sez_contr()
|
||||
{
|
||||
compensa = _pcn->get_bool(PCN_COMPENS);
|
||||
dettaglio = !_pcn->get_bool(PCN_STSOTTBIL);
|
||||
tipo_conto = _pcn->get(PCN_TMCF)[0];
|
||||
indbil_conto = _pcn->get_int (PCN_INDBIL);
|
||||
tipo_conto = _pcn->get_char(PCN_TMCF);
|
||||
indbil_conto = _pcn->get_int(PCN_INDBIL);
|
||||
|
||||
if (indbil_conto <= 0) // Warning per Roberto!
|
||||
{
|
||||
@ -957,8 +955,7 @@ bool TStampa_bilanci::bil_sez_contr()
|
||||
if ( (tipo_conto == 'C') || (tipo_conto == 'F') )
|
||||
{
|
||||
saldo = ZERO;
|
||||
esiste_sc = ricerca_sottoc_clifo(g, c, compensa,
|
||||
indbil_conto, saldo);
|
||||
esiste_sc = ricerca_sottoc_clifo(g, c, compensa, indbil_conto, saldo);
|
||||
if (esiste_sc)
|
||||
{
|
||||
_gp = g;
|
||||
@ -1402,7 +1399,7 @@ bool TStampa_bilanci::bil_verifica()
|
||||
}
|
||||
if ( (s == 0) && (c != 0) ) //si tratta di un conto
|
||||
{
|
||||
tipo_conto = _pcn->get(PCN_TMCF)[0];
|
||||
tipo_conto = _pcn->get_char(PCN_TMCF);
|
||||
indbil_conto = _pcn->get_int(PCN_INDBIL);
|
||||
if ( (tipo_conto == 'C') || (tipo_conto == 'F') )
|
||||
{
|
||||
@ -2004,7 +2001,7 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin
|
||||
|
||||
//se saldo_finale < 0 verra' stampato con una A, se no con una D
|
||||
}
|
||||
else
|
||||
else // Bilancio di verifica all'ultima immissione
|
||||
{
|
||||
//Attenzione! Nel caso di "tutti i conti" devono scendere solo i cli/for movimentati!!!
|
||||
|
||||
@ -2084,7 +2081,7 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin
|
||||
saldo_conto += saldo_finale; // somma algebrica!!!
|
||||
|
||||
//scrivo il record relat. al sottoconto se non e' richiesto saldi di mastro
|
||||
if (_verifica != 2)
|
||||
if (_verifica != 2 && !_hide_clifo)
|
||||
{
|
||||
_tmp_saldi_att->zero();
|
||||
_tmp_saldi_att->put(SLD_GRUPPO,g);
|
||||
@ -2124,7 +2121,8 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin
|
||||
_tmp_saldi_att->put(SLD_PDARE,_mov_periodo_dare);
|
||||
_tmp_saldi_att->put(SLD_PAVERE,_mov_periodo_avere);
|
||||
_tmp_saldi_att->put(SLD_SALDO,saldo_finale);
|
||||
_tmp_saldi_att->put(SLD_DATAULMOV, _u_max);
|
||||
_tmp_saldi_att->put(SLD_DATAULMOV, _u_max);
|
||||
|
||||
_tmp_saldi_att->write();
|
||||
}
|
||||
}
|
||||
@ -2210,23 +2208,16 @@ void TStampa_bilanci::scrivi_record_conto(const real& prg_da, const real& prg_a,
|
||||
|
||||
void TStampa_bilanci::init_sort()
|
||||
{
|
||||
_cf = new cli_for;
|
||||
_sort = new TSort(sizeof(cli_for));
|
||||
cli_for cf;
|
||||
|
||||
_sort = new TSort(sizeof(cli_for));
|
||||
_sort->addsortkey ((char*)&(cf.tipocf)-(char*)&(cf.tipocf),1);
|
||||
_sort->addsortkey ((char*)&(cf.gruppo)-(char*)&(cf.tipocf),3);
|
||||
_sort->addsortkey ((char*)&(cf.conto)-(char*)&(cf.tipocf),3);
|
||||
if (_ordinamento == 1)
|
||||
{
|
||||
_sort->addsortkey ((char*)&(_cf->tipocf)-(char*)&(_cf->tipocf),1);
|
||||
_sort->addsortkey ((char*)&(_cf->gruppo)-(char*)&(_cf->tipocf),3);
|
||||
_sort->addsortkey ((char*)&(_cf->conto)-(char*)&(_cf->tipocf),3);
|
||||
_sort->addsortkey ((char*)&(_cf->codcf)-(char*)&(_cf->tipocf),6);
|
||||
}
|
||||
_sort->addsortkey ((char*)&(cf.codcf)-(char*)&(cf.tipocf),6);
|
||||
else if (_ordinamento == 2)
|
||||
{
|
||||
_sort->addsortkey ((char*)&(_cf->tipocf)-(char*)&(_cf->tipocf),1);
|
||||
_sort->addsortkey ((char*)&(_cf->gruppo)-(char*)&(_cf->tipocf),3);
|
||||
_sort->addsortkey ((char*)&(_cf->conto)-(char*)&(_cf->tipocf),3);
|
||||
_sort->addsortkey ((char*)&(_cf->ragsoc)-(char*)&(_cf->tipocf),50);
|
||||
}
|
||||
_sort->addsortkey ((char*)&(cf.ragsoc)-(char*)&(cf.tipocf),50);
|
||||
|
||||
_sort->init();
|
||||
}
|
||||
@ -2234,12 +2225,13 @@ void TStampa_bilanci::init_sort()
|
||||
void TStampa_bilanci::riempi_record(char t,int g,int c,long s,
|
||||
const char* rs,const real& sd,const real& sa,
|
||||
const real& md,const real& ma,const real& sf)
|
||||
{
|
||||
_cf->tipocf = t;
|
||||
sprintf(_cf->gruppo, "%03d", g);
|
||||
sprintf(_cf->conto, "%03d", c);
|
||||
sprintf(_cf->codcf, "%06ld", s);
|
||||
sprintf(_cf->ragsoc, "%s", rs);
|
||||
{
|
||||
cli_for cf;
|
||||
cf.tipocf = t;
|
||||
sprintf(cf.gruppo, "%03d", g);
|
||||
sprintf(cf.conto, "%03d", c);
|
||||
sprintf(cf.codcf, "%06ld", s);
|
||||
sprintf(cf.ragsoc, "%s", rs);
|
||||
if ( s == 999999L )
|
||||
{
|
||||
if ( (_datada == _dataini)||(_tipo_stampa1 != 1) )
|
||||
@ -2247,8 +2239,8 @@ void TStampa_bilanci::riempi_record(char t,int g,int c,long s,
|
||||
//modifica del 21/11/1995
|
||||
if (_tipo_stampa1 == 1 && _datada == _dataini)
|
||||
{
|
||||
_cf->saldodare = _saldo_ini_conto_dare;
|
||||
_cf->saldoavere = _saldo_ini_conto_avere;
|
||||
cf.saldodare = _saldo_ini_conto_dare;
|
||||
cf.saldoavere = _saldo_ini_conto_avere;
|
||||
}
|
||||
else
|
||||
//fine
|
||||
@ -2256,33 +2248,33 @@ void TStampa_bilanci::riempi_record(char t,int g,int c,long s,
|
||||
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
|
||||
if (app > ZERO) //va stampato in Dare
|
||||
{
|
||||
_cf->saldoavere = ZERO;
|
||||
_cf->saldodare = app;
|
||||
cf.saldoavere = ZERO;
|
||||
cf.saldodare = app;
|
||||
}
|
||||
else if (app < ZERO)
|
||||
{
|
||||
app = -app;
|
||||
_cf->saldodare = ZERO;
|
||||
_cf->saldoavere = app;
|
||||
cf.saldodare = ZERO;
|
||||
cf.saldoavere = app;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_datada > _dataini)
|
||||
{
|
||||
_cf->saldodare = sd;
|
||||
_cf->saldoavere = sa;
|
||||
cf.saldodare = sd;
|
||||
cf.saldoavere = sa;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_cf->saldodare = sd;
|
||||
_cf->saldoavere = sa;
|
||||
cf.saldodare = sd;
|
||||
cf.saldoavere = sa;
|
||||
}
|
||||
_cf->movdare = md;
|
||||
_cf->movavere = ma;
|
||||
_cf->saldofinale = sf;
|
||||
_cf->udata = _u_max;
|
||||
_sort->sort((const char*)_cf);
|
||||
cf.movdare = md;
|
||||
cf.movavere = ma;
|
||||
cf.saldofinale = sf;
|
||||
cf.udata = _u_max;
|
||||
_sort->sort((const char*)&cf);
|
||||
}
|
||||
|
||||
void TStampa_bilanci::leggi_clifo(const TArray& gccf)
|
||||
@ -2333,7 +2325,7 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf)
|
||||
nome = ragsoc.mid(30,20);
|
||||
cognome.trim(); nome.trim();
|
||||
ragsoc = cognome;
|
||||
ragsoc << " " << nome;
|
||||
ragsoc << ' ' << nome;
|
||||
}
|
||||
|
||||
TEsercizi_contabili ese;
|
||||
@ -2548,7 +2540,7 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf)
|
||||
|
||||
movdare = _mov_periodo_dare;
|
||||
movavere = _mov_periodo_avere;
|
||||
|
||||
|
||||
riempi_record(tipocf,g,c,codcf,ragsoc,saldodare,saldoavere,movdare,
|
||||
movavere,saldo_finale);
|
||||
tipocfp = tipocf;
|
||||
@ -2843,7 +2835,8 @@ bool TStampa_bilanci::preprocess_page(int file, int counter)
|
||||
_eof1 = _tmp_saldi_att->first();
|
||||
if (_eof1)
|
||||
return FALSE;
|
||||
else leggi_file_tmp();
|
||||
else
|
||||
leggi_file_tmp();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2933,7 +2926,9 @@ void TStampa_bilanci::postclose_print()
|
||||
else
|
||||
{
|
||||
if (_verifica == 3)
|
||||
delete _sort;
|
||||
{
|
||||
delete _sort; _sort = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete _tmp_saldi_att; _tmp_saldi_att = NULL;
|
||||
@ -3072,9 +3067,9 @@ void TStampa_bilanci::set_page(int file, int counter)
|
||||
{
|
||||
if (!_eof1)
|
||||
{
|
||||
if (_saldofinale_succ > 0)
|
||||
if (_saldofinale_succ >= ZERO)
|
||||
app = 'D';
|
||||
else if (_saldofinale_succ < 0)
|
||||
else
|
||||
{
|
||||
_saldofinale_succ = -_saldofinale_succ;
|
||||
app = 'A';
|
||||
@ -3132,29 +3127,25 @@ void TStampa_bilanci::set_page(int file, int counter)
|
||||
if (_descr_succ.len() > 30)
|
||||
set_row(++r, "@46g!@80g!@114g!");
|
||||
}
|
||||
else if (app == 'D')
|
||||
{
|
||||
else // Stampa estesa
|
||||
{
|
||||
set_row(r,"@1g%6ld",(const char*)_sottoconto_succ);
|
||||
if ((_saldoini_dare_succ != ZERO) || (_saldoini_avere_succ != ZERO) ||
|
||||
(_mov_dare_succ != ZERO) || (_mov_avere_succ != ZERO) ||
|
||||
(_saldofinale_succ != ZERO))
|
||||
set_row(r," %s",(const char*)udata);
|
||||
set_row(r,"@17g#a@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!",
|
||||
_d,&_saldoini_dare_succ,&_saldoini_avere_succ,
|
||||
&_mov_dare_succ,&_mov_avere_succ,&_saldofinale_succ);
|
||||
if (_descr_succ.len() > 30)
|
||||
set_row(++r, "@46g!@80g!@114g!@148g!");
|
||||
}
|
||||
else
|
||||
{
|
||||
set_row(r,"@1g%6ld",(const char*)_sottoconto_succ);
|
||||
if ((_saldoini_dare_succ != ZERO) || (_saldoini_avere_succ != ZERO) ||
|
||||
(_mov_dare_succ != ZERO) || (_mov_avere_succ != ZERO) ||
|
||||
(_saldofinale_succ != ZERO))
|
||||
set_row(r," %s",(const char*)udata);
|
||||
set_row(r,"@17g#a@46g!%r@64g%r@80g!%r@98g%r@114g!@132g%r@148g!",
|
||||
_d,&_saldoini_dare_succ,&_saldoini_avere_succ,
|
||||
&_mov_dare_succ,&_mov_avere_succ,&_saldofinale_succ);
|
||||
if (app == 'D')
|
||||
{
|
||||
set_row(r,"@17g#a@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!",
|
||||
_d,&_saldoini_dare_succ,&_saldoini_avere_succ,
|
||||
&_mov_dare_succ,&_mov_avere_succ,&_saldofinale_succ);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_row(r,"@17g#a@46g!%r@64g%r@80g!%r@98g%r@114g!@132g%r@148g!",
|
||||
_d,&_saldoini_dare_succ,&_saldoini_avere_succ,
|
||||
&_mov_dare_succ,&_mov_avere_succ,&_saldofinale_succ);
|
||||
}
|
||||
if (_descr_succ.len() > 30)
|
||||
set_row(++r, "@46g!@80g!@114g!@148g!");
|
||||
}
|
||||
@ -3163,9 +3154,9 @@ void TStampa_bilanci::set_page(int file, int counter)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_saldofinale > 0)
|
||||
if (_saldofinale >= ZERO)
|
||||
app = 'D';
|
||||
else if (_saldofinale < 0)
|
||||
else
|
||||
{
|
||||
app = 'A';
|
||||
_saldofinale = -_saldofinale;
|
||||
@ -3704,6 +3695,8 @@ const char* TStampa_bilanci::DescrizioneConto(int g, int c, long s, char tipocf)
|
||||
|
||||
bool TStampa_bilanci::user_create()
|
||||
{
|
||||
open_files(LF_TAB, 0);
|
||||
|
||||
_stampa_width = 132;
|
||||
_rel = new TRelation(LF_CLIFO);
|
||||
_cur = new TCursor (_rel,"",3);
|
||||
@ -3716,8 +3709,8 @@ bool TStampa_bilanci::user_create()
|
||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||
_anag = new TLocalisamfile(LF_ANAG);
|
||||
_caus = new TLocalisamfile(LF_CAUSALI);
|
||||
_esc = new TTable("ESC");
|
||||
_d = new TParagraph_string("",29);
|
||||
_sort = NULL;
|
||||
_tmp_saldi_att = NULL;
|
||||
_tmp_saldi_pass = NULL;
|
||||
_tmp_saldi_costi = NULL;
|
||||
@ -3740,7 +3733,6 @@ bool TStampa_bilanci::user_destroy()
|
||||
delete _nditte;
|
||||
delete _anag;
|
||||
delete _caus;
|
||||
delete _esc;
|
||||
delete _d;
|
||||
|
||||
if (_tmp_saldi_att) delete _tmp_saldi_att;
|
||||
@ -3788,6 +3780,7 @@ void TStampa_bilanci::leggi_pcon()
|
||||
|
||||
void TStampa_bilanci::stampa_un_bilancio(const TMask& m)
|
||||
{
|
||||
_prog = NULL;
|
||||
if (_bilancio == 1)
|
||||
{
|
||||
printer().footerlen(3);
|
||||
@ -3852,12 +3845,12 @@ void TStampa_bilanci::stampa_un_bilancio(const TMask& m)
|
||||
_clienti.destroy();
|
||||
_fornitori.destroy();
|
||||
leggi_pcon();
|
||||
crea_sort_clifo();
|
||||
crea_sort_clifo(); // Crea la sua _prog
|
||||
_sort->endsort();
|
||||
delete _cf;
|
||||
}
|
||||
}
|
||||
delete _prog;
|
||||
if (_prog)
|
||||
delete _prog;
|
||||
print();
|
||||
}
|
||||
|
||||
@ -3882,6 +3875,7 @@ bool TStampa_bilanci::set_print(int)
|
||||
_data = m.get(F_DATASTAMPA);
|
||||
_stampa_mov_prov = m.get_int(F_STAMPAMPROV);
|
||||
_quadratura = m.get_bool(F_QUADRATURA);
|
||||
_hide_clifo = m.get_bool(F_HIDE_CLIFO);
|
||||
_noseparator = m.get_bool(F_SEPARATOR);
|
||||
|
||||
if (m.field(F_DACDC).active() && (m.get(F_DACDC).not_empty() || m.get(F_ACDC).not_empty()))
|
||||
@ -4059,8 +4053,8 @@ void TStampa_bilanci::preprocess_header()
|
||||
//modifica del 20/04/1995
|
||||
if (_print_exercise)
|
||||
{
|
||||
TString d1(InizioEsercizio(_annoes).string());
|
||||
TString d2(FineEsercizio(_annoes).string());
|
||||
TString16 d1(InizioEsercizio(_annoes).string());
|
||||
TString16 d2(FineEsercizio(_annoes).string());
|
||||
set_header(r,"@84gEsercizio %s %s", (const char*)d1, (const char*)d2); /**/
|
||||
}
|
||||
r++;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#define F_DAFSC 127
|
||||
#define F_ACDC 128
|
||||
#define F_AFSC 129
|
||||
#define F_HIDE_CLIFO 130
|
||||
|
||||
#endif // __CG1500_H
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "cg1500.h"
|
||||
|
||||
TOOLBAR "" 0 -2 0 2
|
||||
TOOLBAR "" 0 -3 0 3
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
@ -253,9 +253,12 @@ RADIOBUTTON F_VERIFICA 27
|
||||
BEGIN
|
||||
PROMPT 2 1 "@bStampa bilancio di verifica "
|
||||
HELP "Tipo di bilancio di verifica"
|
||||
ITEM "1|Bilancio"
|
||||
ITEM "1|Bilancio"
|
||||
MESSAGE SHOW,F_HIDE_CLIFO
|
||||
ITEM "2|Saldi di mastro"
|
||||
MESSAGE HIDE,F_HIDE_CLIFO
|
||||
ITEM "3|Situazione C/F"
|
||||
MESSAGE HIDE,F_HIDE_CLIFO
|
||||
END
|
||||
|
||||
RADIOBUTTON F_STAMPAC 36
|
||||
@ -287,6 +290,11 @@ BEGIN
|
||||
FLAGS "DR"
|
||||
END
|
||||
|
||||
BOOLEAN F_HIDE_CLIFO
|
||||
BEGIN
|
||||
PROMPT 2 10 "Non stampare il dettaglio dei clienti/fornitori"
|
||||
END
|
||||
|
||||
LIST F_SITUAZIONE 11
|
||||
BEGIN
|
||||
PROMPT 2 10 "Tipo situazione "
|
||||
|
@ -175,9 +175,9 @@ TMask* TPrimanota_application::load_mask(int n)
|
||||
else
|
||||
{
|
||||
cgm.hide(CG_COMMESSA); cgm.hide(CG_FASE);
|
||||
cgm.hide(CG_DESC_CDC); cgm.hide(CG_DESC_FASE);
|
||||
cg.delete_column(CG_DESC_FASE); cg.delete_column(CG_DESC_CDC);
|
||||
cg.delete_column(CG_FASE); cg.delete_column(CG_COMMESSA);
|
||||
for (short id = 155; id <= 157; id++)
|
||||
cgm.hide(id); // Descrizioni commessa e fase
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -780,9 +780,11 @@ int TPrimanota_application::read(TMask& m)
|
||||
riga.add(conto.string(0x3)); // Contropartita 110-114
|
||||
riga.add(r.get(RMV_CODCMS)); // Commessa 115
|
||||
riga.add(r.get(RMV_FASCMS)); // Fase 116
|
||||
riga.add(cache().get("CMS", r.get(RMV_CODCMS), "S0")); // Desrizione Commessa 117
|
||||
riga.add(cache().get("FSC", r.get(RMV_FASCMS), "S0")); // Desrizione Fase 118
|
||||
|
||||
const char tipo = r.get_char(RMV_ROWTYPE);
|
||||
riga.add(tipo, CG_ROWTYPE-FIRST_FIELD); // Tipo di riga 117
|
||||
riga.add(tipo, CG_ROWTYPE-FIRST_FIELD); // Tipo di riga 119
|
||||
|
||||
disable_cgs_cells(i, tipo);
|
||||
}
|
||||
@ -836,6 +838,8 @@ int TPrimanota_application::read(TMask& m)
|
||||
c.add_to(riga, 4, 0x7); // Conto 105-110
|
||||
riga.add(r.get(RMI_CODCMS)); // Commessa 111
|
||||
riga.add(r.get(RMI_FASCMS)); // Fase 112
|
||||
riga.add(cache().get("CMS", r.get(RMI_CODCMS), "S0")); // Desrizione Commessa 113
|
||||
riga.add(cache().get("FSC", r.get(RMI_FASCMS), "S0")); // Desrizione Fase 114
|
||||
}
|
||||
|
||||
calcola_imp(); // Calcola totale imponibile ed imposte
|
||||
@ -925,7 +929,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
||||
row.get(); // Descrizione contropartita
|
||||
r.put(RMV_CODCMS, row.get()); // Commessa
|
||||
r.put(RMV_FASCMS, row.get()); // Fase
|
||||
r.put(RMV_ROWTYPE, row.get()); // Tipo riga
|
||||
r.put(RMV_ROWTYPE, row.get(CG_ROWTYPE-FIRST_FIELD)); // Tipo riga
|
||||
}
|
||||
}
|
||||
|
||||
@ -1510,8 +1514,8 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
||||
if (c.gruppo() > 0)
|
||||
c.add_to(riga, 4, 0x7); // Conto 105-110
|
||||
|
||||
add_not_empty(riga, 10, ini, RMI_CODCMS); // Commessa 111
|
||||
add_not_empty(riga, 11, ini, RMI_FASCMS); // Fase 112
|
||||
add_not_empty(riga, 10, ini, RMI_CODCMS); // Commessa 111
|
||||
add_not_empty(riga, 11, ini, RMI_FASCMS); // Fase 112
|
||||
|
||||
iva_notify(is, i, K_ENTER);
|
||||
}
|
||||
@ -1794,27 +1798,27 @@ bool TPrimanota_application::protected_record(TRectype& mov)
|
||||
bool ok = !TRelation_application::protected_record(mov);
|
||||
if (ok && autodeleting() == 0x3)
|
||||
{
|
||||
if (mov.get_bool(MOV_STAMPATO))
|
||||
{
|
||||
static long last_checked_numreg = 0L;
|
||||
const long numreg = mov.get_long(MOV_NUMREG);
|
||||
if (last_checked_numreg != numreg)
|
||||
{
|
||||
static long last_checked_numreg = 0L;
|
||||
const long numreg = mov.get_long(MOV_NUMREG);
|
||||
if (last_checked_numreg != numreg)
|
||||
{
|
||||
if (mov.get_bool(MOV_STAMPATO))
|
||||
{
|
||||
ok = yesno_box("Il movimento %ld e' gia' stato stampato sul libro giornale:\n"
|
||||
"si desidera eliminarlo ugualmente?", numreg);
|
||||
if (ok && mov.get_bool(MOV_REGST))
|
||||
{
|
||||
ok = yesno_box("Il movimento %ld e' gia' stato stampato sul bollato:\n"
|
||||
"si desidera eliminarlo ugualmente?", numreg);
|
||||
}
|
||||
if (ok && mov.get_bool(MOV_INVIATO))
|
||||
{
|
||||
ok = yesno_box("Il movimento %ld e' stato inviato ad un'altra contabilita':\n"
|
||||
"si desidera eliminarlo ugualmente?", numreg);
|
||||
}
|
||||
if (ok)
|
||||
last_checked_numreg = numreg;
|
||||
}
|
||||
if (ok && mov.get_bool(MOV_REGST))
|
||||
{
|
||||
ok = yesno_box("Il movimento %ld e' gia' stato stampato sul bollato:\n"
|
||||
"si desidera eliminarlo ugualmente?", numreg);
|
||||
}
|
||||
if (ok && mov.get_bool(MOV_INVIATO))
|
||||
{
|
||||
ok = yesno_box("Il movimento %ld e' stato inviato ad un'altra contabilita':\n"
|
||||
"si desidera eliminarlo ugualmente?", numreg);
|
||||
}
|
||||
if (ok)
|
||||
last_checked_numreg = numreg;
|
||||
}
|
||||
}
|
||||
return !ok;
|
||||
|
@ -70,7 +70,9 @@
|
||||
#define CG_DESCR 109
|
||||
#define CG_COMMESSA 115
|
||||
#define CG_FASE 116
|
||||
#define CG_ROWTYPE 117
|
||||
#define CG_DESC_CDC 117
|
||||
#define CG_DESC_FASE 118
|
||||
#define CG_ROWTYPE 119
|
||||
|
||||
|
||||
// Campi ripetuti sulla seconda pagina
|
||||
|
@ -356,6 +356,8 @@ BEGIN
|
||||
ITEM "Descrizione contropartita@30"
|
||||
ITEM "CDC / Commessa@20"
|
||||
ITEM "Fase@10"
|
||||
ITEM "Descrizione CDC/Commessa@30"
|
||||
ITEM "Descrizione Fase@30"
|
||||
ITEM "Tipo@4"
|
||||
END
|
||||
|
||||
|
@ -620,6 +620,8 @@ BEGIN
|
||||
ITEM "Descrizione Conto@30"
|
||||
ITEM "CDC/Commessa@20"
|
||||
ITEM "Fase@10"
|
||||
ITEM "Descrizione CDC/Commessa@30"
|
||||
ITEM "Descrizione Fase@30"
|
||||
END
|
||||
|
||||
CURRENCY F_IMPONIBILI 18
|
||||
@ -653,6 +655,8 @@ BEGIN
|
||||
ITEM "Descrizione contropartita@30"
|
||||
ITEM "CDC/Commessa@20"
|
||||
ITEM "Fase@10"
|
||||
ITEM "Descrizione CDC/Commessa@30"
|
||||
ITEM "Descrizione Fase@30"
|
||||
ITEM "Tipo@4"
|
||||
END
|
||||
|
||||
|
@ -194,8 +194,7 @@ int TMovimentoPN::registra(bool re, bool force)
|
||||
const TRectype& m = curr();
|
||||
const long numreg = m.get_long(MOV_NUMREG);
|
||||
|
||||
if (!re)
|
||||
_cg.renum_key(MOV_NUMREG, numreg);
|
||||
_cg.renum_key(MOV_NUMREG, numreg);
|
||||
err = _cg.write(re);
|
||||
if (err != NOERR)
|
||||
return err;
|
||||
@ -221,8 +220,7 @@ int TMovimentoPN::registra(bool re, bool force)
|
||||
r.put(RMI_TIPOATT, tipoatt);
|
||||
}
|
||||
|
||||
if (!re)
|
||||
_iva.renum_key(MOV_NUMREG, numreg);
|
||||
_iva.renum_key(MOV_NUMREG, numreg);
|
||||
err = _iva.write(re);
|
||||
if (err != NOERR)
|
||||
return err;
|
||||
|
@ -34,7 +34,6 @@ TClinton::TClinton(TToken_string& row, bool iva)
|
||||
set_fase(row.get((iva ? 112 : CG_FASE) - FIRST_FIELD));
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Funzioni di decodifica/calcolo
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -261,7 +260,7 @@ TSheet_field& TPrimanota_application::cgs() const
|
||||
{
|
||||
const TMask* m = _msk[_iva == nessuna_iva ? 1 : 2];
|
||||
CHECK(m, "Null cgs() mask");
|
||||
TSheet_field& s = (TSheet_field&)m->field(F_SHEETCG);
|
||||
TSheet_field& s = m->sfield(F_SHEETCG);
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -392,7 +391,9 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
|
||||
if (cg.cell_disabled(n, 5))
|
||||
{
|
||||
cg.disable_cell(n, CG_COMMESSA); // Commessa
|
||||
cg.disable_cell(n, CG_DESC_CDC);
|
||||
cg.disable_cell(n, CG_FASE); // Fase
|
||||
cg.disable_cell(n, CG_DESC_FASE);
|
||||
needs_update = TRUE;
|
||||
}
|
||||
|
||||
@ -459,24 +460,34 @@ int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
|
||||
if (conto.default_cdc(codcms, fascms))
|
||||
{
|
||||
row.add(codcms, CG_COMMESSA-FIRST_FIELD);
|
||||
row.add(cache().get("CMS", codcms, "S0"), CG_DESC_CDC-FIRST_FIELD);
|
||||
row.add(fascms, CG_FASE-FIRST_FIELD);
|
||||
row.add(cache().get("FSC", fascms, "S0"), CG_DESC_FASE-FIRST_FIELD);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
row.add(cms, CG_COMMESSA-FIRST_FIELD);
|
||||
row.add(cache().get("CMS", cms, "S0"), CG_DESC_CDC-FIRST_FIELD);
|
||||
row.add(fas, CG_FASE-FIRST_FIELD);
|
||||
row.add(cache().get("FSC", fas, "S0"), CG_DESC_FASE-FIRST_FIELD);
|
||||
}
|
||||
cg.enable_cell(n, CG_COMMESSA); // Commessa
|
||||
cg.enable_cell(n, CG_DESC_CDC);
|
||||
cg.enable_cell(n, CG_FASE); // Fase
|
||||
cg.enable_cell(n, CG_DESC_FASE);
|
||||
}
|
||||
else // Azzera commessa sui conti clifo
|
||||
{
|
||||
row.add("", CG_COMMESSA-FIRST_FIELD);
|
||||
row.add("", CG_DESC_CDC-FIRST_FIELD);
|
||||
row.add("", CG_FASE-FIRST_FIELD);
|
||||
row.add("", CG_DESC_FASE-FIRST_FIELD);
|
||||
cg.disable_cell(n, CG_COMMESSA); // Commessa
|
||||
cg.disable_cell(n, CG_DESC_CDC);
|
||||
cg.disable_cell(n, CG_FASE); // Fase
|
||||
cg.disable_cell(n, CG_DESC_FASE);
|
||||
}
|
||||
|
||||
row.add(tipo, CG_ROWTYPE-FIRST_FIELD);
|
||||
@ -517,7 +528,8 @@ HIDDEN bool can_remove(TToken_string& s)
|
||||
|
||||
void TPrimanota_application::cgs_pack()
|
||||
{
|
||||
TString_array& rows = cgs().rows_array();
|
||||
TSheet_field& s = cgs();
|
||||
TString_array& rows = s.rows_array();
|
||||
const bool pagamento = is_pagamento();
|
||||
const long numreg = curr_mask().get_long(F_NUMREG);
|
||||
|
||||
@ -531,7 +543,7 @@ void TPrimanota_application::cgs_pack()
|
||||
{
|
||||
ok = !partite().utilizzata(numreg, i+1);
|
||||
if (ok)
|
||||
cg_notify(cgs(), i, K_DEL);
|
||||
cg_notify(s, i, K_DEL);
|
||||
}
|
||||
if (ok)
|
||||
rows.destroy(i, TRUE);
|
||||
@ -562,7 +574,7 @@ real TPrimanota_application::calcola_saldo() const
|
||||
const bool pag = is_pagamento() && !_as400;
|
||||
|
||||
TString_array& rows = cgs().rows_array();
|
||||
for (int i = rows.items()-1; i >= 0; i--)
|
||||
for (int i = rows.last(); i >= 0; i--)
|
||||
{
|
||||
TToken_string& r = rows.row(i);
|
||||
importo = r;
|
||||
@ -768,7 +780,8 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
|
||||
// La commessa è vuota: controlliamo se era obbligatoria
|
||||
if (c.tipo() <= ' ' && *r.get(CG_COMMESSA-FIRST_FIELD) <= ' ')
|
||||
const TString80 cms = r.get(CG_COMMESSA-FIRST_FIELD);
|
||||
if (c.tipo() <= ' ' && cms.blank())
|
||||
{
|
||||
TToken_string k = c.string();
|
||||
const TRectype& pc = cache().get(LF_PCON, k);
|
||||
@ -1898,10 +1911,11 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
|
||||
|
||||
a._skip_giornale_check = FALSE;
|
||||
a._skip_bollato_check = FALSE;
|
||||
|
||||
if (!cache().get(LF_MOV, f.get()).empty())
|
||||
|
||||
const TRectype& mov = cache().get(LF_MOV, f.get());
|
||||
if (!mov.empty())
|
||||
|
||||
{
|
||||
const TLocalisamfile& mov = a._rel->lfile();
|
||||
bool ok = TRUE;
|
||||
|
||||
if (mov.get_bool(MOV_STAMPATO))
|
||||
@ -2993,4 +3007,3 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -922,11 +922,11 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
||||
if (anno > 0 && !numpart.blank() && m.page_enabled(2))
|
||||
{
|
||||
const int tmov = causale().tipomov();
|
||||
const TString desc(m.get(F_DESCR));
|
||||
const TString codpag(m.get(F_CODPAG));
|
||||
const TString codcaus(causale().codice());
|
||||
const TString& desc = m.get(F_DESCR);
|
||||
const TString& codpag = m.get(F_CODPAG);
|
||||
const TString8 codcaus = causale().codice();
|
||||
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
|
||||
const TString agente(m.get(FS_AGENTE));
|
||||
const TString& agente = m.get(FS_AGENTE);
|
||||
const char sezione = get_cgs_imp(0).sezione(); // Dare/Avere
|
||||
|
||||
TBill clifo;
|
||||
|
@ -327,15 +327,15 @@ BEGIN
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT CG_COMMESSA CODTAB
|
||||
OUTPUT 156 S0
|
||||
OUTPUT CG_DESC_CDC S0
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING 156 50 30
|
||||
STRING CG_DESC_CDC 50 30
|
||||
BEGIN
|
||||
PROMPT 32 13 ""
|
||||
USE CMS KEY 2
|
||||
INPUT S0 156
|
||||
INPUT S0 CG_DESC_CDC
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
COPY OUTPUT CG_COMMESSA
|
||||
@ -351,15 +351,15 @@ BEGIN
|
||||
DISPLAY "Codice@10" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT CG_FASE CODTAB
|
||||
OUTPUT 157 S0
|
||||
OUTPUT CG_DESC_FASE S0
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING 157 50 30
|
||||
STRING CG_DESC_FASE 50 30
|
||||
BEGIN
|
||||
PROMPT 32 14 ""
|
||||
USE FSC KEY 2
|
||||
INPUT S0 157
|
||||
INPUT S0 CG_DESC_FASE
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
COPY OUTPUT CG_FASE
|
||||
@ -369,7 +369,7 @@ END
|
||||
LIST CG_ROWTYPE 24
|
||||
BEGIN
|
||||
PROMPT 28 16 "Tipo riga "
|
||||
ITEM " |Sola contabilita'"
|
||||
ITEM " |Sola contabilità"
|
||||
ITEM "A|Abbuoni attivi"
|
||||
ITEM "C|Differenza cambi"
|
||||
ITEM "D|IVA detraibile"
|
||||
|
@ -249,15 +249,15 @@ BEGIN
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
DISPLAY "Decrizione@50" S0
|
||||
OUTPUT 111 CODTAB
|
||||
OUTPUT 156 S0
|
||||
OUTPUT 113 S0
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING 156 50 40
|
||||
STRING 113 50 40
|
||||
BEGIN
|
||||
PROMPT 32 12 ""
|
||||
USE CMS KEY 2
|
||||
INPUT S0 156
|
||||
INPUT S0 113
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
COPY OUTPUT 111
|
||||
@ -266,21 +266,22 @@ END
|
||||
|
||||
STRING 112 10
|
||||
BEGIN
|
||||
PROMPT 2 13 "Fase "
|
||||
PROMPT 2 13 "Fase "
|
||||
FLAGS "UZ"
|
||||
USE FSC
|
||||
INPUT CODTAB 112
|
||||
DISPLAY "Codice@10" CODTAB
|
||||
DISPLAY "Decrizione@50" S0
|
||||
OUTPUT 112 CODTAB
|
||||
OUTPUT 114 S0
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING 157 50 40
|
||||
STRING 114 50 40
|
||||
BEGIN
|
||||
PROMPT 32 13 ""
|
||||
USE FSC KEY 2
|
||||
INPUT S0 157
|
||||
INPUT S0 114
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Codice@20" CODTAB
|
||||
COPY OUTPUT 112
|
||||
|
@ -1158,6 +1158,10 @@ bool TListaMov_application::preprocess_page(int file,int counter)
|
||||
da.put(MOV_ANNOES, _annoes);
|
||||
a.put(MOV_ANNOES, _annoes);
|
||||
}
|
||||
|
||||
da.put(MOV_CODCAUS, _causale_ini);
|
||||
a.put(MOV_CODCAUS, _causale_fin);
|
||||
|
||||
if (_data_ini.ok())
|
||||
da.put(MOV_DATAREG, _data_ini);
|
||||
da.put(MOV_TIPO, _tipo_ini);
|
||||
@ -2067,10 +2071,13 @@ void TListaMov_application::imposta_parametri_stampa(const TMask& msk)
|
||||
{
|
||||
_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);
|
||||
_causale_ini = msk.get(F_DACODCAUS);
|
||||
_causale_fin = msk.get(F_ACODCAUS);
|
||||
|
||||
if (tipo=="C" || tipo=="F")
|
||||
{
|
||||
_codice_ini = atol(msk.get(F_CODICEINI));
|
||||
@ -2361,8 +2368,14 @@ void TListaMov_application::init_print(const TMask& msk)
|
||||
if (_data_ini.ok())
|
||||
_flags |= ST_DATA;
|
||||
_data_fin = msk.get(F_DATAFIN);
|
||||
_causale_ini = msk.get(F_DACODCAUS);
|
||||
if (_causale_ini != "")
|
||||
_flags |= ST_CAUSALE;
|
||||
if (_data_fin.ok())
|
||||
_flags |= ST_DATA;
|
||||
_causale_fin = msk.get(F_ACODCAUS);
|
||||
if (_causale_fin != "")
|
||||
_flags |= ST_CAUSALE;
|
||||
TString tipo = msk.get(F_TIPOELENCO);
|
||||
if ((tipo=="C")||(tipo=="F"))
|
||||
{
|
||||
|
@ -39,6 +39,10 @@
|
||||
#define F_DAFASE 135
|
||||
#define F_AFASE 136
|
||||
#define F_PRINTCDC 137
|
||||
#define F_DACODCAUS 139
|
||||
#define F_DADESCRCAUS 140
|
||||
#define F_ACODCAUS 141
|
||||
#define F_ADESCRCAUS 142
|
||||
|
||||
#define ST_DATA 0x0001
|
||||
#define ST_NUMERO 0x0002
|
||||
|
@ -220,19 +220,53 @@ BEGIN
|
||||
HELP "Indicare se cambiare pagina nel passaggio da cliente/fornitore a cliente/fornitore"
|
||||
END
|
||||
|
||||
/*
|
||||
BOOLEAN F_STAMPAMOVP
|
||||
BEGIN
|
||||
PROMPT 2 13 "Stampa movimenti provvisori "
|
||||
HELP "Indicare se stampare i movimenti provvisori"
|
||||
END
|
||||
*/
|
||||
|
||||
BOOLEAN F_SEPARATOR
|
||||
BEGIN
|
||||
PROMPT 2 13 "Non stampare i separatori delle migliaia"
|
||||
END
|
||||
|
||||
STRING F_DACODCAUS 3
|
||||
BEGIN
|
||||
PROMPT 2 15 "Da causale: "
|
||||
FLAGS "ZU"
|
||||
USE LF_CAUSALI SELECT REG!=""
|
||||
INPUT CODCAUS F_DACODCAUS
|
||||
DISPLAY "Cod." CODCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT F_DACODCAUS CODCAUS
|
||||
OUTPUT F_DADESCRCAUS DESCR
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN CG0 -4
|
||||
END
|
||||
|
||||
STRING F_DADESCRCAUS 50
|
||||
BEGIN
|
||||
PROMPT 22 15 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING F_ACODCAUS 3
|
||||
BEGIN
|
||||
PROMPT 2 16 "A causale: "
|
||||
FLAGS "ZU"
|
||||
USE LF_CAUSALI SELECT REG!=""
|
||||
INPUT CODCAUS F_ACODCAUS
|
||||
DISPLAY "Cod." CODCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT F_ACODCAUS CODCAUS
|
||||
OUTPUT F_ADESCRCAUS DESCR
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN CG0 -4
|
||||
STR_EXPR IF(#F_ACODCAUS!="",#F_ACODCAUS>=#F_DACODCAUS,1)
|
||||
WARNING "Indicare una causale valida successiva a quella iniziale"
|
||||
END
|
||||
|
||||
STRING F_ADESCRCAUS 50
|
||||
BEGIN
|
||||
PROMPT 22 16 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 71 5
|
||||
BEGIN
|
||||
PROMPT 2 18 "@bCDC / Commesse"
|
||||
|
@ -160,14 +160,13 @@ public:
|
||||
int _last_header; // prima riga di intestazione "libera"
|
||||
|
||||
bool _stampa_stesso_registro;
|
||||
bool _libro_giornale_iva_unico, _libro_cronologico, _stampa_intesta;
|
||||
bool _libro_giornale_iva_unico, _libro_cronologico, _stampa_intesta, _stampa_num_pag;
|
||||
// bool _gia_settata_riga_mov; // per la stampa no iva
|
||||
|
||||
TString80 _ragsoc, _paiva, _comunefis, _viafis;
|
||||
TString16 _provfis, _cap, _occfpi;
|
||||
TString80 _cofi;
|
||||
|
||||
TRecord_cache *_com;
|
||||
TLocalisamfile *_clifo,*_pconti,*_nditte,*_anag;
|
||||
|
||||
TLocalisamfile* _attiv; // da togliere in futuro (?)
|
||||
@ -266,7 +265,6 @@ bool TStampa_giornale::filter_func(const TRelation * r)
|
||||
recrmov.put("NUMREG", numreg);
|
||||
recrmov.put("NUMRIG", 1);
|
||||
|
||||
// Guy: non capisco bene come possano esistere movimenti senza la prima riga!
|
||||
if (r->lfile(LF_RMOV).read() != NOERR)
|
||||
{
|
||||
const long numreg2 = recrmov.get_long("NUMREG");
|
||||
@ -285,7 +283,7 @@ const TRectype& TStampa_giornale::look_com (const char* cod, const char* stato)
|
||||
{
|
||||
TString16 codice;
|
||||
codice << stato << '|' << cod;
|
||||
return _com->get(codice);
|
||||
return cache().get(LF_COMUNI, codice);
|
||||
}
|
||||
|
||||
const char* TStampa_giornale::get_descr_caus (const char * codcaus)
|
||||
@ -359,7 +357,6 @@ bool TStampa_giornale::user_create()
|
||||
|
||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||
_anag = new TLocalisamfile (LF_ANAG);
|
||||
_com = new TRecord_cache(LF_COMUNI);
|
||||
_clifo = new TLocalisamfile(LF_CLIFO);
|
||||
_pconti = new TLocalisamfile(LF_PCON);
|
||||
_attiv = new TLocalisamfile(LF_ATTIV); // da togliere
|
||||
@ -389,7 +386,6 @@ bool TStampa_giornale::user_destroy()
|
||||
delete _RecPartoDa;
|
||||
delete _RecArrivoA;
|
||||
|
||||
delete _com;
|
||||
delete _clifo; delete _pconti;
|
||||
delete _nditte; delete _anag;
|
||||
delete _tabreg;
|
||||
@ -706,10 +702,7 @@ int TStampa_giornale::set_headers()
|
||||
if (_stampa_intesta || !_stampa_definitiva)
|
||||
r = stampa_intestazione_ditta();
|
||||
else
|
||||
{
|
||||
set_header(r++, "");
|
||||
set_header(r++, "");
|
||||
}
|
||||
r += 2;
|
||||
|
||||
if (_stampa_definitiva)
|
||||
set_header(r++, "Codice libro: %s %s ",(const char *) _reg_cod, (const char *) _reg_descr);
|
||||
@ -769,8 +762,16 @@ void TStampa_giornale::preprocess_header()
|
||||
{
|
||||
int r = _last_header + 1;
|
||||
int pag = printer().getcurrentpage();
|
||||
TString256 riporto;
|
||||
real riporto_dare, riporto_avere;
|
||||
|
||||
if (_stampa_num_pag) // Stampa numero di pagina in alto a destra
|
||||
{
|
||||
TString16 numpag, riga;
|
||||
numpag.format("%d/%d", _data_a.year(), _pagina_da+pag);
|
||||
const int tab = _stampa_width - numpag.len();
|
||||
riga.format("@%dg%s", tab, (const char*)numpag);
|
||||
set_header(2, riga); // Sempre quasi sulla prima riga!
|
||||
}
|
||||
|
||||
// _gia_settato_ariportare = FALSE;
|
||||
|
||||
@ -791,6 +792,7 @@ void TStampa_giornale::preprocess_header()
|
||||
TString80 dare; real2currency(dare, riporto_dare);
|
||||
TString80 avere; real2currency(avere, riporto_avere);
|
||||
|
||||
TString256 riporto;
|
||||
riporto.format("@b@%dgRiporto: @%dg%c %17s @%dg%c@%dg%17s", // prima erano %15s
|
||||
_stampa_width == 132 ? SCRITTA : DARE198-11,
|
||||
_stampa_width == 132 ? TOTDARE132 : DARE198-2,
|
||||
@ -1574,19 +1576,15 @@ bool TStampa_giornale::controlla_mov_aep()
|
||||
bool TStampa_giornale::leggi_tabreg(const char * reg_cod, int reg_anno)
|
||||
{
|
||||
TString16 codtab;
|
||||
|
||||
// _ae = reg_anno;
|
||||
|
||||
codtab.format ("%04d%-3s", reg_anno, reg_cod);
|
||||
|
||||
_tabreg->zero();
|
||||
_tabreg->put("CODTAB", codtab);
|
||||
const bool ok = (_tabreg->read() == NOERR);
|
||||
|
||||
if (!ok) _tabreg->zero();
|
||||
const bool ok = _tabreg->read() == NOERR;
|
||||
if (!ok)
|
||||
_tabreg->zero();
|
||||
|
||||
_pagine_stampate = _tabreg->get_int("I1");
|
||||
_pagine_numerate = _tabreg->get_int("I2");
|
||||
_stampa_num_pag = _tabreg->get_bool("S11");
|
||||
// _stampa_ok = _tabreg->get_int("I8");
|
||||
_nprog_da = _tabreg->get_long ("I6");
|
||||
_tot_dare = _tabreg->get_real ("R1");
|
||||
|
@ -320,6 +320,7 @@ class TBalance : public TObject
|
||||
protected:
|
||||
bool find(const TBill& b, int esercizio,
|
||||
TImporto& si, TImporto& da, TImporto& av, TImporto& sf) const;
|
||||
int indicatore_bilancio(const TBill& b) const;
|
||||
|
||||
public:
|
||||
void read(int g, int c, long s, int esercizio, bool ignora_movap = FALSE);
|
||||
@ -382,13 +383,22 @@ bool TBalance::find(const TBill& b, int esercizio,
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
void TBalance::read(int gruppo, int conto, long sottoconto, int esercizio, bool ignora_movap)
|
||||
{
|
||||
const TBill zio(gruppo, conto, sottoconto);
|
||||
read(zio, esercizio, ignora_movap);
|
||||
}
|
||||
|
||||
int TBalance::indicatore_bilancio(const TBill& b) const
|
||||
{
|
||||
TString16 str;
|
||||
str.format("%d|%d", b.gruppo(), b.conto());
|
||||
const int ib = atoi(cache().get(LF_PCON, str, PCN_INDBIL));
|
||||
if (ib == 0)
|
||||
NFCHECK("Impossibile stabilire l'indicatore di bilancio");
|
||||
return ib;
|
||||
}
|
||||
|
||||
void TBalance::read(const TBill& b, int esercizio, bool ignora_movap)
|
||||
{
|
||||
TImporto si, sf, pd, pa;
|
||||
@ -401,28 +411,19 @@ void TBalance::read(const TBill& b, int esercizio, bool ignora_movap)
|
||||
|
||||
if (_saldo_ini.is_zero())
|
||||
{
|
||||
TLocalisamfile pcon(LF_PCON);
|
||||
TRectype& curr = pcon.curr();
|
||||
curr.put(PCN_GRUPPO, b.gruppo());
|
||||
curr.put(PCN_CONTO, b.conto());
|
||||
const int err = pcon.read();
|
||||
if (err == NOERR)
|
||||
{
|
||||
const int indbil = curr.get_int(PCN_INDBIL);
|
||||
if (indbil == 1 || indbil == 2 || indbil == 5)
|
||||
{
|
||||
TEsercizi_contabili esercizi;
|
||||
const int precedente = esercizi.pred(esercizio);
|
||||
if (precedente > 0 && find(b, precedente, si, pd, pa, sf))
|
||||
{
|
||||
_saldo_ini = si;
|
||||
_saldo_ini += pd;
|
||||
_saldo_ini += pa;
|
||||
}
|
||||
const int indbil = indicatore_bilancio(b);
|
||||
if (indbil == 1 || indbil == 2 || indbil == 5)
|
||||
{
|
||||
TEsercizi_contabili esercizi;
|
||||
const int precedente = esercizi.pred(esercizio);
|
||||
if (precedente > 0 && find(b, precedente, si, pd, pa, sf))
|
||||
{
|
||||
_saldo_ini = si;
|
||||
_saldo_ini += pd;
|
||||
_saldo_ini += pa;
|
||||
_saldo_ini += sf;
|
||||
}
|
||||
}
|
||||
else
|
||||
NFCHECK("Impossibile stabilire indicatore di bilancio");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -70,6 +70,7 @@ bool CG4100_App::set_parms()
|
||||
|
||||
void CG4100_App::main_loop()
|
||||
{
|
||||
|
||||
if (fexist("__sal__.sav"))
|
||||
warning_box("Un'operazione di riordino saldi si e' conclusa"
|
||||
" impropriamente. Si raccomanda di rieseguirla");
|
||||
@ -83,6 +84,7 @@ void CG4100_App::main_loop()
|
||||
|
||||
_msk = new TMask(_optype == 'S' ? "cg4100b" : "cg4100a");
|
||||
|
||||
|
||||
if (_optype == 'S')
|
||||
sort_sal();
|
||||
else
|
||||
@ -307,7 +309,6 @@ bool CG4100_App::sort_sal()
|
||||
|
||||
TSystemisamfile saldi(LF_SALDI); saldi.open(_excllock);
|
||||
TLocalisamfile rmov(LF_RMOV);
|
||||
TLocalisamfile causali(LF_CAUSALI);
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
TSaldo_agg sal;
|
||||
|
||||
@ -321,7 +322,6 @@ bool CG4100_App::sort_sal()
|
||||
"Riordino archivio saldi in corso\nLettura archivio movimenti...",
|
||||
FALSE,TRUE,30);
|
||||
|
||||
causali.zero();
|
||||
mov.setkey(1);
|
||||
rmov.first();
|
||||
sal.reset();
|
||||
@ -356,17 +356,15 @@ bool CG4100_App::sort_sal()
|
||||
mov.read();
|
||||
CHECK(mov.good(),"Archivi movimenti e righe inconsistenti");
|
||||
|
||||
causali.zero();
|
||||
const char* codcaus = mov.get(MOV_CODCAUS);
|
||||
|
||||
// Tipo saldo normale per default
|
||||
tsal = normale;
|
||||
if (*codcaus) // cerca causale per determinare il tipoo del saldo
|
||||
const TString& codcaus = mov.get(MOV_CODCAUS);
|
||||
if (codcaus.not_empty()) // cerca causale per determinare il tipo del saldo
|
||||
{
|
||||
causali.put(CAU_CODCAUS, codcaus);
|
||||
const int err = causali.read();
|
||||
if (err == NOERR)
|
||||
const TRectype& causale = cache().get(LF_CAUSALI, codcaus);
|
||||
if (!causale.empty())
|
||||
{
|
||||
const char ac = causali.get_char(CAU_MOVAP);
|
||||
const char ac = causale.get_char(CAU_MOVAP);
|
||||
if (ac == 'A')
|
||||
tsal = apertura;
|
||||
else
|
||||
@ -411,4 +409,3 @@ int cg4100(int argc, char* argv[])
|
||||
main_app.run(argc, argv, "Ricalcolo Saldi");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -10,17 +10,10 @@ void TLiquidazione_app::add_plafond(int month, const char* codatt, int type,
|
||||
real& howmuch, bool intra)
|
||||
{
|
||||
look_ppa(month,codatt,type);
|
||||
|
||||
TString att(codatt);
|
||||
|
||||
real r0 = _ppa_r->get_real("R0");
|
||||
real r1 = _ppa_r->get_real("R1");
|
||||
real r2 = _ppa_r->get_real("R2");
|
||||
|
||||
if (intra) r1 += howmuch;
|
||||
else r0 += howmuch;
|
||||
_ppa_r->put("R0",r0);
|
||||
_ppa_r->put("R1",r1);
|
||||
const char* field = intra ? "R1" : "R0";
|
||||
real r = _ppa_r->get(field);
|
||||
r += howmuch;
|
||||
_ppa_r->put(field, r);
|
||||
_ppa->rewrite();
|
||||
}
|
||||
|
||||
@ -36,7 +29,7 @@ void TLiquidazione_app::zero_plafond (int month, const char* codatt)
|
||||
}
|
||||
else
|
||||
{
|
||||
long rn = _ppa->recno();
|
||||
const long rn = _ppa->recno();
|
||||
|
||||
// se non c'e' quello del mese prima c'e' poco da fare,
|
||||
// si ricalcola tutto
|
||||
|
@ -211,28 +211,30 @@ const TRectype& TStampa_registri_app::look_comuni (const char* cod)
|
||||
|
||||
void TStampa_registri_app::get_dati_ditta()
|
||||
{
|
||||
/*
|
||||
TLocalisamfile nditte(LF_NDITTE);
|
||||
TLocalisamfile anag(LF_ANAG);
|
||||
TLocalisamfile unloc(LF_UNLOC);
|
||||
TString codanagr;
|
||||
TString tipoa;
|
||||
|
||||
nditte.zero();
|
||||
nditte.put(NDT_CODDITTA, get_firm());
|
||||
nditte.read();
|
||||
|
||||
if (nditte.bad()) nditte.zero();
|
||||
|
||||
codanagr = nditte.get(NDT_CODANAGR);
|
||||
tipoa = nditte.get(NDT_TIPOA);
|
||||
*/
|
||||
const TRectype& nditte = cache().get(LF_NDITTE, get_firm());
|
||||
_ragsoc = nditte.get(NDT_RAGSOC);
|
||||
|
||||
const char tipoa = nditte.get_char(NDT_TIPOA);
|
||||
const long codanagr = nditte.get_long(NDT_CODANAGR);
|
||||
/*
|
||||
TLocalisamfile anag(LF_ANAG);
|
||||
TString codanagr;
|
||||
TString tipoa;
|
||||
anag.setkey(1);
|
||||
anag.zero();
|
||||
anag.put (ANA_TIPOA, tipoa);
|
||||
anag.put (ANA_CODANAGR, codanagr);
|
||||
anag.read();
|
||||
if (anag.bad()) anag.zero();
|
||||
*/
|
||||
const TRectype& anag = cache().get(LF_ANAG, format("%c|%ld", tipoa, codanagr));
|
||||
|
||||
_cofi = anag.get(ANA_COFI);
|
||||
_paiva = anag.get(ANA_PAIV);
|
||||
@ -263,11 +265,16 @@ void TStampa_registri_app::get_dati_ditta()
|
||||
|
||||
if (_cod_un_loc)
|
||||
{
|
||||
/*
|
||||
TLocalisamfile unloc(LF_UNLOC);
|
||||
unloc.zero();
|
||||
unloc.put(ULC_CODDITTA, get_firm());
|
||||
unloc.put(ULC_CODULC, _cod_un_loc);
|
||||
unloc.read();
|
||||
if (unloc.read() == NOERR)
|
||||
*/
|
||||
const TRectype& unloc = cache().get(LF_UNLOC, format("%ld|%d", get_firm(), _cod_un_loc));
|
||||
if (!unloc.empty())
|
||||
{
|
||||
const TRectype& dep = look_comuni (unloc.get(ULC_COMULC));
|
||||
_comunefis = dep.get(COM_DENCOM);
|
||||
@ -365,6 +372,7 @@ void TStampa_registri_app::look_reg()
|
||||
_stampa_cred_pre = _tabreg->get_bool ("B4");
|
||||
_freq_riepilogo = _tabreg->get_char ("S9");
|
||||
_stampa_plafonds = _tabreg->get_char ("S10") == 'X';
|
||||
_stampa_num_pag = _tabreg->get_char ("S11") == 'X';
|
||||
}
|
||||
|
||||
bool TStampa_registri_app::compila_reg(const TMask& m)
|
||||
@ -459,6 +467,7 @@ bool TStampa_registri_app::compila_reg(const TMask& m)
|
||||
_stampa_ind_ditta = _tabreg->get_bool("B9");
|
||||
_stampa_ind_comp = _tabreg->get_bool("B5");
|
||||
_stampa_plafonds = _tabreg->get_char ("S10") == 'X';
|
||||
_stampa_num_pag = _tabreg->get_char ("S11") == 'X';
|
||||
_cod_un_loc = _tabreg->get_int ("I7");
|
||||
_mese_credito = _tabreg->get_int ("I8"); //campo nascosto sulla tabella dei registri: mese di stampa credito anno precedente
|
||||
_mese_ultima_liq = _tabreg->get_int ("I4");
|
||||
@ -2533,21 +2542,20 @@ print_action TStampa_registri_app::postprocess_page (int file, int counter)
|
||||
int TStampa_registri_app::stampa_intestazione()
|
||||
{
|
||||
int r = 1;
|
||||
TString codice_ditta;
|
||||
TString riga(_stampa_width);
|
||||
|
||||
get_dati_ditta();
|
||||
codice_ditta << get_firm();
|
||||
|
||||
set_header (r, "Ditta %s %s %s %s %s %s", (const char*)codice_ditta,
|
||||
riga.format("Ditta %ld %s %s %s %s %s", get_firm(),
|
||||
(const char*)_ragsoc, (const char*)_viafis,
|
||||
(const char*)_cap, (const char*)_comunefis,
|
||||
(const char*)_provfis);
|
||||
r++;
|
||||
|
||||
set_header (r++, riga);
|
||||
|
||||
if (_tipo_stampa == prova)
|
||||
{
|
||||
riga = "REGISTRO DI PROVA Data @>";
|
||||
riga.right_just(_stampa_width-6);
|
||||
riga.format("REGISTRO DI PROVA Data %s", TDate(TODAY).string());
|
||||
riga.right_just(_stampa_width);
|
||||
}
|
||||
|
||||
TString80 tmp;
|
||||
@ -2595,7 +2603,16 @@ void TStampa_registri_app::preprocess_header()
|
||||
else // se stampa di prova o su libro unico l'intestazione della ditta
|
||||
// va sempre stampata
|
||||
r = stampa_intestazione();
|
||||
|
||||
|
||||
if (_stampa_num_pag) // Stampa numero di pagina in alto a destra
|
||||
{
|
||||
TString16 numpag, riga;
|
||||
numpag.format("%d/%d", _annoes, _numini+printer().getcurrentpage());
|
||||
const int tab = _stampa_width - numpag.len();
|
||||
riga.format("@%dg%s", tab, (const char*)numpag);
|
||||
set_header(1, riga); // Sempre sulla prima riga!
|
||||
}
|
||||
|
||||
if (_tipo_stampa == libro_unico && !_intesta_vidi)
|
||||
{
|
||||
++_u_stampata;
|
||||
@ -3511,6 +3528,7 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m)
|
||||
cod_lib_un = _tabreg->get("S6");
|
||||
sca_vid = _tabreg->get_date("D1");
|
||||
_stampa_plafonds = _tabreg->get_char ("S10") == 'X';
|
||||
_stampa_num_pag = _tabreg->get_char ("S11") == 'X';
|
||||
_stampa_ind_ditta = _tabreg->get_bool("B9");
|
||||
_liquidazione = _tabreg->get_bool("B7");
|
||||
if (_tipo_stampa != prova)
|
||||
|
@ -48,7 +48,7 @@ class TStampa_registri_app : public TPrintapp
|
||||
bool _test;
|
||||
bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri, _auto_intraf, _stampa, _stampa_plafonds;
|
||||
bool _corrispettivi, _liquidazione, _stampa_ind_comp, _esiste_riga_iva, _stampa_cred_pre;
|
||||
bool _rif_vid, _intesta_vidi, _intesta_liq, _stampa_data_reg, _ok_vidi;
|
||||
bool _rif_vid, _intesta_vidi, _intesta_liq, _stampa_data_reg, _ok_vidi, _stampa_num_pag;
|
||||
bool _sosp_imposta, _riep_liq;
|
||||
bool _st_tot_fin;
|
||||
char _frequiva, _tipo_riepilogativo, _freq_riepilogo;
|
||||
|
@ -19,12 +19,14 @@ const int sizeH = 1024; //Lunghezza del record dell'HEADER
|
||||
|
||||
const int RIC_SIZE = 512;
|
||||
|
||||
const char* tracciato_AS = "cgtrc.ini";
|
||||
const char* tracciato_PC = "cgtrcpc.ini";
|
||||
const char* const tracciato_AS = "cgtrc.ini";
|
||||
const char* const tracciato_PC = "cgtrcpc.ini";
|
||||
|
||||
HIDDEN TString TEMP;
|
||||
|
||||
//ritorna falso se la causale non e' significativa
|
||||
/*
|
||||
|
||||
bool look_causale (const char* codcaus)
|
||||
{
|
||||
const TFixed_string caus(codcaus);
|
||||
@ -32,12 +34,12 @@ bool look_causale (const char* codcaus)
|
||||
return FALSE;
|
||||
return !caus.blank();
|
||||
}
|
||||
*/
|
||||
|
||||
bool format_if_zero(TString& field, int len)
|
||||
{
|
||||
if (real::is_natural(field))
|
||||
field.right_just(len, '0');
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1027,35 +1029,32 @@ const char* TTransfer_file::numero_civico(TString& indirizzo)
|
||||
return TEMP;
|
||||
}
|
||||
|
||||
const char* TTransfer_file::cerca_comune_cap(TString& field, const TString& localita)
|
||||
const char* TTransfer_file::cerca_comune_cap(const TString& field, const TString& localita)
|
||||
{
|
||||
TLocalisamfile comuni (LF_COMUNI);
|
||||
const TString80 dencom = localita;
|
||||
TString16 cap = field;
|
||||
bool trovato = FALSE;
|
||||
bool prima_volta = TRUE;
|
||||
|
||||
bool trovato = FALSE;
|
||||
bool prima_volta = TRUE;
|
||||
TEMP.cut(0);
|
||||
|
||||
TEMP = "";
|
||||
|
||||
if (cap.sub(2,3) == "1")
|
||||
if (cap[2] == '1')
|
||||
{
|
||||
cap = cap.sub(0,3);
|
||||
cap.cut(3);
|
||||
cap << "00";
|
||||
}
|
||||
|
||||
TString dencom = localita;
|
||||
|
||||
TLocalisamfile comuni (LF_COMUNI);
|
||||
comuni.setkey(3);
|
||||
comuni.zero();
|
||||
comuni.put(COM_CAPCOM, cap);
|
||||
|
||||
TRectype com (comuni.curr());
|
||||
const TRectype com(comuni.curr());
|
||||
|
||||
for (comuni.read(_isgteq); !comuni.eof(); comuni.next())
|
||||
{
|
||||
if (comuni.curr() != com) break;
|
||||
|
||||
TString denominazione (comuni.get(COM_DENCOM));
|
||||
|
||||
TString80 denominazione = comuni.get(COM_DENCOM);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (dencom[i] == denominazione[i])
|
||||
@ -5344,4 +5343,3 @@ int date2esc(const TDate& d, int* prevesc)
|
||||
*prevesc = esc.pred(anno);
|
||||
return anno;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ int pack(bool vis, int num, TString& name);
|
||||
int packfile(bool vis, int num, TString& name);
|
||||
|
||||
//const char* converti(TString& data);
|
||||
bool look_causale(const char* codcaus);
|
||||
//bool look_causale(const char* codcaus);
|
||||
bool format_if_zero(TString&, int);
|
||||
|
||||
class TRic_recfield : public TObject
|
||||
@ -266,7 +266,7 @@ public:
|
||||
void canc_file_dir_temp(const char* dir);
|
||||
void temp_dir(TString& orig,TString& dest,TString& sigle);
|
||||
|
||||
const char* cerca_comune_cap(TString& field,const TString& localita);
|
||||
const char* cerca_comune_cap(const TString& field,const TString& localita);
|
||||
const char* cerca_cap_comune(const TString& localita);
|
||||
const char* cerca_comune_den(const TString& field);
|
||||
void datafine_esprec(const int aep, TDate& datacomp);
|
||||
|
@ -1780,7 +1780,6 @@ static void somma(const TRectype& vec, TRectype& nuo, const char* field)
|
||||
nuo.put(field, totale);
|
||||
}
|
||||
|
||||
|
||||
void TPartita::sposta_riga(int from_row, TPartita& part, int to_row)
|
||||
{
|
||||
const TRiga_partite& row = riga(from_row);
|
||||
@ -1790,7 +1789,7 @@ void TPartita::sposta_riga(int from_row, TPartita& part, int to_row)
|
||||
int* address = new int[address_size];
|
||||
memset(address, 0, address_size*sizeof(int));
|
||||
|
||||
TToken_string knames(64);
|
||||
TToken_string knames(64); // Elenco dei campi della chiave 1 dei pagamenti
|
||||
knames.add(PART_TIPOCF);
|
||||
knames.add(PART_GRUPPO);
|
||||
knames.add(PART_CONTO);
|
||||
@ -1963,7 +1962,7 @@ TPartita* TPartite_array::find(const TRectype& r, bool create)
|
||||
zio.codclifo(), zio.tipo());
|
||||
}
|
||||
const int anno = r.get_int(PART_ANNO);
|
||||
const TString num(r.get(PART_NUMPART));
|
||||
const TString8 num = r.get(PART_NUMPART);
|
||||
return find(zio, anno, num, create);
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
23
|
||||
0
|
||||
$mov|91|91|341|0|Movimenti di prima nota|||
|
||||
$mov|0|0|357|0|Movimenti di prima nota|||
|
||||
|
@ -1,5 +1,5 @@
|
||||
23
|
||||
40
|
||||
44
|
||||
ANNOES|9|4|0|Codice esercizio
|
||||
NUMREG|3|7|0|Numero di operazione
|
||||
DATAREG|5|8|0|Data operazione
|
||||
@ -40,6 +40,10 @@ INVIVA|8|1|0|Inviata la parte IVA ad altra contabilita'
|
||||
SCARCON|8|1|0|Scaricata la contabilitá
|
||||
TNUMREG|3|7|0|Numero di registrazione temporaneo per ricezioni
|
||||
TOCFP|1|16|0|Codice occasionale temporaneo per ricezioni
|
||||
DPROVV|1|1|0|Documento originale PROVV
|
||||
DANNO|2|4|0|Documento originale ANNO
|
||||
DCODNUM|1|4|0|Documento originale CODNUM
|
||||
DNDOC|3|7|0|Documento originale NDOC
|
||||
3
|
||||
NUMREG|
|
||||
DATAREG+NUMREG|
|
||||
|
@ -67,7 +67,7 @@ void TConfig_application::save_mask(bool tosave)
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
TMask_field& f = mask->fld(i);
|
||||
if (f.dirty() && f.field())
|
||||
if (f.field())
|
||||
{
|
||||
const char* fname = f.field()->name();
|
||||
const TString& value = f.get();
|
||||
@ -81,14 +81,14 @@ void TConfig_application::save_mask(bool tosave)
|
||||
|
||||
if (postprocess_config_changed(_parag, fname, oldvl, value))
|
||||
{
|
||||
if (value[0] == ' ' || value.right(1) == " ")
|
||||
{
|
||||
TString val;
|
||||
val << '"' << value << '"';
|
||||
_cnf->set(fname, val, NULL, TRUE, index > -1 ? index : -1);
|
||||
}
|
||||
else
|
||||
_cnf->set(fname, value, NULL, TRUE, index > -1 ? index : -1);
|
||||
if (value[0] == ' ' || value.right(1) == " ")
|
||||
{
|
||||
TString val;
|
||||
val << '"' << value << '"';
|
||||
_cnf->set(fname, val, NULL, TRUE, index > -1 ? index : -1);
|
||||
}
|
||||
else
|
||||
_cnf->set(fname, value, NULL, TRUE, index > -1 ? index : -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -112,8 +112,8 @@ void TConfig_application::load_mask()
|
||||
oldvl = _cnf->get(fname,NULL, index > -1 ? index : -1);
|
||||
if (oldvl[0] == '"' && oldvl.right(1) == "\"")
|
||||
{
|
||||
oldvl.rtrim(1);
|
||||
oldvl.ltrim(1);
|
||||
oldvl.rtrim(1);
|
||||
oldvl.ltrim(1);
|
||||
}
|
||||
f.set(oldvl);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
// @cmember Ritorna la settimana dell'anno
|
||||
int week() const ;
|
||||
// @cmember Ritorna la settimana e l'anno considerando le settimane complete <p complete> o no
|
||||
void TDate::get_week_year(int &weekd, int &yeard, bool complete);
|
||||
void get_week_year(int &weekd, int &yeard, bool complete);
|
||||
// @cmember Aggiunge dei mesi
|
||||
void addmonth(int nmonth = 1);
|
||||
// @cmember Aggiunge degli anni
|
||||
|
@ -75,6 +75,8 @@
|
||||
#define DOC_CONTROEURO "CONTROEURO"
|
||||
#define DOC_CODCMS "CODCMS"
|
||||
#define DOC_FASCMS "FASCMS"
|
||||
#define DOC_NUMREG "NUMREG"
|
||||
#define DOC_NUMANT "NUMANT"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -553,8 +553,8 @@ TForm_item& TForm_item::find_field(const TString& id) const
|
||||
bool TForm_item::do_message(int num)
|
||||
{
|
||||
TToken_string& messaggio = message(num);
|
||||
if (messaggio.empty_items()) return FALSE;
|
||||
|
||||
if (messaggio.empty_items())
|
||||
return FALSE;
|
||||
TToken_string msg(16, ',');
|
||||
for (const char* m = messaggio.get(0); m; m = messaggio.get())
|
||||
{
|
||||
@ -1278,16 +1278,24 @@ bool TForm_number::update()
|
||||
if (read()) // valuta il campo
|
||||
{
|
||||
TForm_item::update();
|
||||
|
||||
real n = get(); // Trasforma la stringa in numero reale
|
||||
|
||||
const real oldn(get());
|
||||
const int nm = (_message.objptr(1) != NULL && oldn.is_zero()) ? 1 : 0;
|
||||
// Arrotonda intelligentemente il numero
|
||||
int round_dec = decimals();
|
||||
if (round_dec == 0 && width() > 9 && form().magic_currency()) // Magic currency?
|
||||
round_dec = TCurrency::get_firm_dec();
|
||||
n.round(round_dec);
|
||||
|
||||
do_message(nm);
|
||||
real n(get());
|
||||
n.round(decimals());
|
||||
if (_message.items() > 0)
|
||||
{
|
||||
const int nm = (_message.objptr(1) != NULL && n.is_zero()) ? 1 : 0;
|
||||
do_message(nm);
|
||||
n = get(); // Il numero potrebbe essere cambiato dal messaggio!
|
||||
n.round(round_dec);
|
||||
}
|
||||
|
||||
bool print = TRUE;
|
||||
|
||||
if (n.is_zero())
|
||||
{
|
||||
char sep = picture().find('E') >= 0 ? '.' :',';
|
||||
@ -1299,21 +1307,24 @@ bool TForm_number::update()
|
||||
|
||||
if (print)
|
||||
{
|
||||
TString80 s(get());
|
||||
const bool mc = form().magic_currency();
|
||||
if (mc)
|
||||
TString80 print_string;
|
||||
bool app_for = TRUE; // Apply format?
|
||||
if (form().magic_currency())
|
||||
{
|
||||
const real r = s;
|
||||
const bool b1 = picture() == "." || (picture().len() >= 9 && picture().find(',') < 0);
|
||||
const bool b2 = width() >= 9 && decimals() == 0;
|
||||
if (b1 || b2)
|
||||
real2currency(r, s);
|
||||
else
|
||||
apply_format(s);
|
||||
{
|
||||
real2currency(n, print_string);
|
||||
app_for = FALSE; // La stringa è già belle che formattata!
|
||||
}
|
||||
}
|
||||
else
|
||||
apply_format(s);
|
||||
put_paragraph(s);
|
||||
if (app_for)
|
||||
{
|
||||
print_string = n.string();
|
||||
apply_format(print_string);
|
||||
}
|
||||
put_paragraph(print_string);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1376,7 +1387,11 @@ void TForm_number::apply_format(TString& s) const
|
||||
s << d; // ... aggiungilo alla fine
|
||||
}
|
||||
}
|
||||
// else s = n.string();
|
||||
else
|
||||
{
|
||||
real n(s);
|
||||
s = n.stringa(width(), decimals());
|
||||
}
|
||||
}
|
||||
|
||||
void TForm_number::set_picture(const char *p)
|
||||
@ -1457,11 +1472,12 @@ bool TForm_currency::update()
|
||||
if (read()) // valuta il campo
|
||||
{
|
||||
TForm_item::update();
|
||||
|
||||
const real oldn(get());
|
||||
const int nm = (_message.objptr(1) != NULL && oldn.is_zero()) ? 1 : 0;
|
||||
|
||||
do_message(nm);
|
||||
|
||||
if (_message.items() > 0)
|
||||
{
|
||||
const int nm = (_message.objptr(1) != NULL && real::is_null(get())) ? 1 : 0;
|
||||
do_message(nm);
|
||||
}
|
||||
|
||||
if (!real::is_null(get()))
|
||||
{
|
||||
@ -1487,8 +1503,7 @@ bool TForm_currency::update()
|
||||
tail << v[i];
|
||||
v.cut(i);
|
||||
}
|
||||
const TCurrency cur = get_currency();
|
||||
const int zeroes_needed = cur.decimals();
|
||||
const int zeroes_needed = curr.decimals();
|
||||
if (zeroes_needed > 0)
|
||||
{
|
||||
int zeroes_missing = 0;
|
||||
|
522
include/inst.cpp
Executable file
522
include/inst.cpp
Executable file
@ -0,0 +1,522 @@
|
||||
#include <inst.h>
|
||||
#include <config.h>
|
||||
#include <prefix.h>
|
||||
#include <progind.h>
|
||||
#include "..\ba\bainsta.h"
|
||||
|
||||
// ********************************
|
||||
// classe TSystemtempfile
|
||||
// ********************************
|
||||
|
||||
|
||||
// classe provvisoria per i system file temporanei, ovvero file temporanei con
|
||||
// caricamento/scaricamento
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Importa un file ascii
|
||||
//
|
||||
// @rdesc Ritorna NOERR se l'operazione di lettura e' riuscita, altrimenti il codice di
|
||||
// di errore generato (vedi <t TIsamerr>).
|
||||
int TSystemtempfile::load(
|
||||
const char* from, // @parm Nome del file da importare
|
||||
char fs, // @parm Carattere separatore di campo (default <pipe>)
|
||||
char fd, // @parm Carattere delimitatore di campi (default '\\0')
|
||||
char rs, // @parm Carattere separatore di record (default '\\n')
|
||||
bool vis, // @parm Indica se visualizzare lo stato dell'operazione (default TRUE)
|
||||
bool extended) // @parm Indica se interpretare alcune stringhe come macro (default FALSE)
|
||||
|
||||
// @comm Se <p extended> e' TRUE e trova alcune stringhe col formato %stringa% (es. %frm%)
|
||||
// ne sostituisce i valori (es. ditta corrente).
|
||||
|
||||
// @xref <mf TSystemisamfile::dump>
|
||||
|
||||
{
|
||||
FILE* fl = fopen(from, "r");
|
||||
int err=NOERR;
|
||||
if (fl == NULL)
|
||||
{
|
||||
error_box("Non riesco ad aprire il file %s",from);
|
||||
return 2;
|
||||
}
|
||||
TRecnotype r = 0, e = 0, nitems = 0, nread = 0;
|
||||
TString16 firm, year, attprev("00000");
|
||||
|
||||
if (extended)
|
||||
{
|
||||
TDate d(TODAY);
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
|
||||
firm.format("%05ld", prefix().get_codditta());
|
||||
year.format("%04d", d.year());
|
||||
ditte.zero();
|
||||
ditte.put("CODDITTA", firm);
|
||||
if (ditte.read() == NOERR)
|
||||
attprev = ditte.get("CODATTPREV");
|
||||
}
|
||||
if (fl == NULL)
|
||||
{
|
||||
clearerr(fl);
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
char w[80];
|
||||
while ((fgets(w, 80, fl) != NULL))
|
||||
{
|
||||
if (strncmp(w, "[Data]", 6) == 0)
|
||||
{
|
||||
nitems = ftell(fl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fseek(fl, 0L, SEEK_END);
|
||||
nitems = ftell(fl) - nitems;
|
||||
fclose(fl);
|
||||
TScanner f(from);
|
||||
|
||||
//open();
|
||||
|
||||
TToken_string s(1024, fs);
|
||||
bool fixedlen = (fs == '\0');
|
||||
int nflds = curr().items();
|
||||
TArray fld(nflds);
|
||||
int len[MaxFields];
|
||||
TString sfd(3);
|
||||
TString s1(64);
|
||||
//bool lcf = FALSE;
|
||||
|
||||
if (f.paragraph("Header"))
|
||||
{
|
||||
f.equal();
|
||||
const long level = atol(f.line());
|
||||
if (level > get_std_level())
|
||||
error_box("L'archivio %s e' stato generato con gli archivi di livello %ld%/%ld.\n Il livello attuale e' %ld/%ld.\n Convertire gli archivi e ripetere l' operazione.",
|
||||
from, level/100, level%100, get_std_level()/100, get_std_level()%100);
|
||||
//lcf = getlcf(level);
|
||||
nflds = 0;
|
||||
TToken_string s2(f.line());
|
||||
int p = s2.find('=');
|
||||
if (p > 0)
|
||||
{
|
||||
s1 = s2.left(p);
|
||||
s2.ltrim(p+1);
|
||||
}
|
||||
else s1.cut(0);
|
||||
while (s1 == "Fields")
|
||||
{
|
||||
for (const char * fd = s2.get(); fd != NULL; fd = s2.get())
|
||||
{
|
||||
TToken_string wfd(fd, ',');
|
||||
fld.add(new TString(wfd.get()));
|
||||
len[nflds] = wfd.get_int();
|
||||
nflds++;
|
||||
}
|
||||
s2 = f.line();
|
||||
p = s2.find('=');
|
||||
if (p > 0)
|
||||
{
|
||||
s1 = s2.left(p);
|
||||
s2.ltrim(p+1);
|
||||
}
|
||||
else s1.cut(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < nflds; j++)
|
||||
{
|
||||
fld.add(TString(curr().fieldname(j)), j);
|
||||
const TString & wfld = (const TString & ) fld[j];
|
||||
len[j] = (curr().type(wfld) == _datefld) ? 10 : curr().length(wfld);
|
||||
}
|
||||
}
|
||||
if (!f.paragraph("Data"))
|
||||
{
|
||||
error_box("Formato dei dati non valido");
|
||||
//close();
|
||||
err = 1;
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (fd) sfd << fd;
|
||||
int last = NOERR;
|
||||
|
||||
s1.format("Imp. archivio %s\n%6ld records %6ld errori - %3d", filename(), r, e, last);
|
||||
TProgind p(nitems, s1, TRUE, TRUE, 70);
|
||||
s = f.line();
|
||||
while (s.not_empty() && !p.iscancelled())
|
||||
{
|
||||
if (extended)
|
||||
{
|
||||
int p, i;
|
||||
|
||||
while ((p = s.find("%yr%")) >= 0)
|
||||
for (i = 0; i < 4; i++) s[p + i] = year[i];
|
||||
while ((p = s.find("%frm%")) >= 0)
|
||||
for (i = 0; i < 5; i++) s[p + i] = firm[i];
|
||||
while ((p = s.find("%att%")) >= 0)
|
||||
for (i = 0; i < 5; i++) s[p + i] = attprev[i];
|
||||
}
|
||||
if ((r + e) % 50 == 0)
|
||||
{
|
||||
s1.format("Imp. archivio %s\n%6ld records %6ld errori - %3d", filename(), r, e, last);
|
||||
p.set_text(s1);
|
||||
}
|
||||
p.setstatus(nread + 1);
|
||||
nread += s.len() + 1;
|
||||
zero();
|
||||
if (fixedlen)
|
||||
{
|
||||
int pos = 0;
|
||||
for (int j = 0; j < nflds; j++)
|
||||
{
|
||||
s1 = s.mid(pos,len[j]);
|
||||
s1.rtrim();
|
||||
put((const TString&) fld[j], s1);
|
||||
pos += len[j];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s.restart();
|
||||
for (int j = 0; j < nflds; j++)
|
||||
{
|
||||
char* s2 = (char*) s.get();
|
||||
if (fd)
|
||||
{
|
||||
s2++;
|
||||
s2[strlen(s2) - 1] = '\0';
|
||||
}
|
||||
put((const TString&) fld[j], s2);
|
||||
}
|
||||
}
|
||||
if (write() == NOERR) r++;
|
||||
else
|
||||
{
|
||||
#ifdef DBG
|
||||
yesnofatal_box("Numero linea relativa all'errore: %ld",r+e+1);
|
||||
#endif
|
||||
e++;
|
||||
last = status();
|
||||
}
|
||||
s = f.line();
|
||||
}
|
||||
s1.format("Imp. archivio %s\n%6ld records %6ld errori - %3d", filename(), r, e, last);
|
||||
p.set_text(s1);
|
||||
//close();
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
|
||||
// @mfunc Esporta VERSO un file ascii.
|
||||
//
|
||||
// @rdesc Ritorna NOERR se l'operazione di esportazione e' riuscita, altrimenti il codice di
|
||||
// di errore generato (vedi <t TIsamerr>).
|
||||
int TSystemtempfile::dump(
|
||||
const char* to, // @parm Nome del file verso quale esportare
|
||||
int nkey, // @parm Numero della chiave di ordinamento con cui scaricare i dati (defualt 1)
|
||||
char fs, // @parm Carattere seperatore di campo (defualt <pipe>)
|
||||
char fd, // @parm Carattere delimitatore di campo (default '\\0')
|
||||
char rs, // @parm Carattere separatore di record (default '\\n')
|
||||
bool vis, // @parm Indica se visualizzare lo stato dell'operazione (defualt TRUE)
|
||||
bool withdeleted) // @parm Indica se scaricare anche i record cancellati (dafault FALSE)
|
||||
|
||||
// @xref <mf TSystemisamfile::load>
|
||||
|
||||
{
|
||||
FILE* f = fopen(to, "w");
|
||||
|
||||
if (f == NULL)
|
||||
{
|
||||
setstatus(2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (withdeleted) nkey = 0;
|
||||
int err = ferror(f);
|
||||
|
||||
//open(FALSE, nkey ? TRUE : FALSE);
|
||||
TString s(512);
|
||||
bool fixedlen = (fs == '\0');
|
||||
int nflds = curr().items();
|
||||
TArray fld(nflds);
|
||||
TBit_array rjust(nflds);
|
||||
int len[MaxFields];
|
||||
|
||||
for (int j = 0; j < nflds; j++)
|
||||
{
|
||||
fld.add(TString(curr().fieldname(j)), j);
|
||||
const TString & wfld = (const TString&) fld[j];
|
||||
const TFieldtypes t = curr().type(wfld);
|
||||
rjust.set(j, t == _intfld || t == _longfld || t == _realfld ||
|
||||
t == _wordfld || t == _intzerofld || t == _longzerofld);
|
||||
len[j] = (t == _datefld) ? 10 : curr().length(wfld);
|
||||
}
|
||||
TRecnotype i = 0;
|
||||
const TRecnotype nitems = nkey ? items() : filehnd()->d->EOD;
|
||||
s.format("Esportazione archivio %s", filename());
|
||||
TProgind p(nitems, s, TRUE, TRUE, 70);
|
||||
TString s1;
|
||||
|
||||
fprintf(f, "[Header]\nVersion=%ld", prefix().filelevel());
|
||||
for (int k = 0; k < nflds; k++)
|
||||
{
|
||||
if ((k % 10) == 0) fprintf(f, "\nFields=");
|
||||
else fprintf(f, "|");
|
||||
fprintf(f, "%s,%d", (const char *) (const TString&) fld[k], len[k]);
|
||||
}
|
||||
fprintf(f, "\n\n[Data]\n");
|
||||
if (nkey)
|
||||
{
|
||||
setkey(nkey);
|
||||
for ( first(); status() == NOERR && !p.iscancelled(); next(), i++)
|
||||
{
|
||||
p.setstatus(i + 1);
|
||||
s = "";
|
||||
for (j = 0; j < nflds; j++)
|
||||
{
|
||||
if (fixedlen)
|
||||
{
|
||||
s1 = get((const TString&)fld[j]);
|
||||
if (rjust[j]) s1.right_just(len[j]);
|
||||
else s1.left_just(len[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
s1 = "";
|
||||
if (j && fs) s1 << fs;
|
||||
if (fd) s1 << fd;
|
||||
s1 << get((const TString&)fld[j]);
|
||||
if (fd) s1 << fd;
|
||||
}
|
||||
s << s1;
|
||||
}
|
||||
fprintf(f, "%s%c", (const char*) s, rs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for (i = 0; i < nitems && !p.iscancelled(); i++)
|
||||
{
|
||||
zero();
|
||||
p.setstatus(i + 1);
|
||||
readat(i + 1);
|
||||
s="";
|
||||
if (withdeleted || curr().valid())
|
||||
{
|
||||
for (j = 0; j < nflds; j++)
|
||||
{
|
||||
if (fixedlen)
|
||||
{
|
||||
s1 = get((const TString&)fld[j]);
|
||||
if (rjust[j]) s1.right_just(len[j]);
|
||||
else s1.left_just(len[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
s1 = "";
|
||||
if (j && fs) s1 << fs;
|
||||
if (fd) s1 << fd;
|
||||
s1 << get((const TString&)fld[j]);
|
||||
if (fd) s1 << fd;
|
||||
}
|
||||
s << s1;
|
||||
}
|
||||
fprintf(f, "%s%c", (const char*) s, rs);
|
||||
}
|
||||
}
|
||||
}
|
||||
p.setstatus(nitems);
|
||||
//close();
|
||||
fclose(f);
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
|
||||
// ********************************
|
||||
// classe TStd_filename
|
||||
// ********************************
|
||||
|
||||
bool TStd_filename::check(bool verbose,const char * n)
|
||||
{
|
||||
if (n && *n)
|
||||
set(n);
|
||||
insert("STD\\");
|
||||
if (!exist())
|
||||
{
|
||||
*this = name();
|
||||
if (!exist())
|
||||
{
|
||||
insert("STD\\");
|
||||
insert(prefix().get_studio());
|
||||
if (!exist())
|
||||
{
|
||||
if (verbose)
|
||||
error_box("Non riesco a trovare il file: %s", (const char *)name());
|
||||
cut(0);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ********************************
|
||||
// classe TInstallmodule_app
|
||||
// ********************************
|
||||
|
||||
bool TInstallmodule_app::create()
|
||||
{
|
||||
if (modal())
|
||||
{
|
||||
TString16 maskname;
|
||||
maskname.format("bainst%02d",module_number());
|
||||
_m = new TMask(maskname);
|
||||
}
|
||||
else
|
||||
_m = NULL;
|
||||
|
||||
TConfig praw(CONFIG_INSTALL, "Main");
|
||||
_test_database = praw.get("TestDatabase","Main",-1,"Y") != "N";
|
||||
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
bool TInstallmodule_app::destroy()
|
||||
{
|
||||
if (_m) delete _m;
|
||||
return TSkeleton_application::destroy();
|
||||
}
|
||||
|
||||
bool TInstallmodule_app::preload_mask()
|
||||
{
|
||||
if (!test_database())
|
||||
{
|
||||
_m->set(F_DEFAULTSDATA," ");
|
||||
_m->disable(F_DEFAULTSDATA);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (load_default_data())
|
||||
_m->set(F_DEFAULTSDATA,"X");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TInstallmodule_app::some_to_load()
|
||||
{
|
||||
return _m->get_bool(F_DEFAULTSDATA);
|
||||
}
|
||||
|
||||
void TInstallmodule_app::main_loop()
|
||||
{
|
||||
bool ok =TRUE;
|
||||
|
||||
if (modal())
|
||||
{
|
||||
preload_mask();
|
||||
if (_m->run()!=K_QUIT)
|
||||
{
|
||||
if (some_to_load())
|
||||
{
|
||||
install_firm();
|
||||
install_com();
|
||||
}
|
||||
}
|
||||
else
|
||||
ok =FALSE;
|
||||
}
|
||||
if (ok)
|
||||
post_installer();
|
||||
}
|
||||
|
||||
bool TInstallmodule_app::install_firm()
|
||||
{
|
||||
// ciclo su ogni ditta
|
||||
TStd_filename txtfile(module_code());
|
||||
txtfile << "tab.txt";
|
||||
if (txtfile.check())
|
||||
{
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
for (ditte.first(); !ditte.eof() ; ditte.next())
|
||||
{
|
||||
const int newditta=ditte.get_int("CODDITTA");
|
||||
if (prefix().exist(newditta))
|
||||
{
|
||||
set_firm(newditta);
|
||||
TSystemisamfile tab(LF_TAB);
|
||||
tab.load(txtfile);
|
||||
}
|
||||
}
|
||||
// carica le tabelle nei file di default
|
||||
TLocalisamfile tampone(LF_TAB);
|
||||
TSystemtempfile tabstd(LF_TAB);
|
||||
TFilename stdtabname(prefix().get_studio());
|
||||
stdtabname << "STD\\lf0005.txt";
|
||||
tabstd.load(txtfile);
|
||||
tabstd.load(stdtabname);
|
||||
tabstd.set_autodel();
|
||||
TFilename tempfile;
|
||||
tempfile.temp();
|
||||
|
||||
// riconverte le macro delle date
|
||||
tabstd.dump(tempfile);
|
||||
TScanner scan(tempfile);
|
||||
FILE *dest=fopen((const char *)stdtabname,"w");
|
||||
while (TRUE) {
|
||||
TString &line=scan.line();
|
||||
if (line.empty()) break;
|
||||
|
||||
int pos=(line.find("-0000"));
|
||||
while (pos >= 0 )
|
||||
{
|
||||
line.overwrite("%yr%",pos+1);
|
||||
pos=(line.find("-0000"));
|
||||
}
|
||||
line << '\n' ;
|
||||
fputs((const char * )line,dest);
|
||||
}
|
||||
fclose(dest);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TInstallmodule_app::install_com()
|
||||
{
|
||||
bool ok=TRUE;
|
||||
TStd_filename txtfile(module_code());
|
||||
txtfile << "tabcom.txt";
|
||||
if (txtfile.check())
|
||||
{
|
||||
TSystemisamfile tabcom(LF_TABCOM);
|
||||
tabcom.load(txtfile);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void TInstallmodule_app::run(int argc, char* argv[])
|
||||
{
|
||||
TScanner scanner("prassi.aut");
|
||||
|
||||
const int m = module_number();
|
||||
for (int aut = 0; aut<=m; aut++)
|
||||
{
|
||||
scanner.line();
|
||||
}
|
||||
_modcode=scanner.token().left(2);
|
||||
_modname=scanner.token().mid(3);
|
||||
|
||||
TString title("Installazione ");
|
||||
title << module_name();
|
||||
TSkeleton_application::run(argc, argv,(const char* )title);
|
||||
}
|
||||
|
||||
|
||||
void TInstallmodule_app::set_tab_app(const char * appname)
|
||||
{
|
||||
TConfig ditta(CONFIG_DITTA);
|
||||
ditta.set_paragraph(module_code());
|
||||
ditta.set("TabApp",appname);
|
||||
}
|
||||
|
71
include/inst.h
Executable file
71
include/inst.h
Executable file
@ -0,0 +1,71 @@
|
||||
#ifndef __INST_H
|
||||
#define __INST_H
|
||||
|
||||
#ifndef __APPLICAT_H
|
||||
#include <applicat.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ISAM_H
|
||||
#include <isam.h>
|
||||
#endif
|
||||
|
||||
#ifndef __MASK_H
|
||||
#include <mask.h>
|
||||
#endif
|
||||
|
||||
// classe provvisoria per i system file temporanei, ovvero file temporanei con
|
||||
// caricamento/scaricamento
|
||||
class TSystemtempfile : public TIsamtempfile
|
||||
{
|
||||
public:
|
||||
//bool getlcf( long flev); // @parm livello archivi di partenza della convesione
|
||||
|
||||
int load(const char* from, char fs = '|', char fd = '\0', char rs = '\n', bool vis = TRUE, bool extended = FALSE) ;
|
||||
|
||||
int dump(const char* to, int nkey = 1, char fs = '|', char fd = '\0', char rs = '\n', bool vis = TRUE, bool withdeleted = FALSE);
|
||||
|
||||
TSystemtempfile(int logicnum) :
|
||||
TIsamtempfile(logicnum,NULL) {}
|
||||
};
|
||||
|
||||
class TStd_filename : public TFilename
|
||||
{
|
||||
public:
|
||||
bool check(bool verbose=FALSE,const char * name=NULL);
|
||||
~TStd_filename () {}
|
||||
TStd_filename () : TFilename(){}
|
||||
TStd_filename (const char * n) : TFilename(n){}
|
||||
};
|
||||
|
||||
class TInstallmodule_app: public TSkeleton_application
|
||||
{
|
||||
bool _is_first_inst , _test_database ;
|
||||
|
||||
protected:
|
||||
TMask * _m ;
|
||||
TString _modcode,_modname;
|
||||
|
||||
protected:
|
||||
void set_tab_app(const char * appname);
|
||||
bool test_database() {return _test_database;}
|
||||
const char * module_name() const {return _modname;}
|
||||
const char * module_code() const {return _modcode;}
|
||||
|
||||
virtual bool load_default_data() const { return TRUE;}
|
||||
virtual bool modal() const {return TRUE;}
|
||||
virtual int module_number() const pure;
|
||||
virtual bool preload_mask();
|
||||
virtual bool post_installer() {return TRUE;}
|
||||
virtual bool some_to_load();
|
||||
|
||||
virtual bool install_com() ; // setta i dati comuni
|
||||
virtual bool install_firm() ; // setta i dati ditta
|
||||
|
||||
virtual void main_loop() ;
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
public:
|
||||
void run(int argc, char* argv[]);
|
||||
};
|
||||
|
||||
#endif
|
@ -38,6 +38,7 @@
|
||||
#define PRAUT 36
|
||||
#define SVAUT 38
|
||||
#define MRAUT 39
|
||||
#define DLAUT 40
|
||||
#define ESAUT 47
|
||||
#define ENDAUT 48
|
||||
|
||||
|
@ -38,8 +38,12 @@
|
||||
#define MOV_DATA74TER "DATA74TER"
|
||||
#define MOV_CODPAG "CODPAG"
|
||||
#define MOV_INVIATO "INVIATO"
|
||||
#define MOV_INVIVA "INVIVA"
|
||||
#define MOV_SCARCON "SCARCON"
|
||||
#define MOV_INVIVA "INVIVA"
|
||||
#define MOV_SCARCON "SCARCON"
|
||||
#define MOV_DPROVV "DPROVV"
|
||||
#define MOV_DANNO "DANNO"
|
||||
#define MOV_DCODNUM "DCODNUM"
|
||||
#define MOV_DNDOC "DNDOC"
|
||||
|
||||
#define NUMREG_PROVVISORIO 999999L
|
||||
|
||||
|
@ -294,6 +294,8 @@ public:
|
||||
void set_column_width(const int col, const int width) const;
|
||||
// @cmember Setta il titolo della colonna
|
||||
void set_column_header(const int col, const TString& header) const;
|
||||
// @cmember Getta il titolo della colonna
|
||||
const char* get_column_header(const int col) const;
|
||||
// @cmember Setta l'allineamento di una colonna
|
||||
void set_column_justify(int col, bool right);
|
||||
// @cmember Permette di abilitare/disabilitare una singola cella
|
||||
@ -1441,8 +1443,12 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
case K_F9:
|
||||
if (_edit_field != NULL)
|
||||
{
|
||||
const bool spork = _edit_field->dirty(); // TBT
|
||||
|
||||
notify_change();
|
||||
copy_cell2field();
|
||||
|
||||
_edit_field->set_dirty(_cell_dirty = spork); // TBT
|
||||
}
|
||||
case K_F11:
|
||||
if (_check_enabled && active())
|
||||
@ -1469,6 +1475,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
sheet_mask().notify_focus_field(_edit_field->dlg());
|
||||
|
||||
ok = _edit_field->on_key(k);
|
||||
_cell_dirty = _edit_field->dirty(); // TBT
|
||||
|
||||
if (!ok && k == K_F9) // Ricerca non completata?
|
||||
{
|
||||
@ -2056,11 +2063,16 @@ void TSpreadsheet::set_column_header(const int col, const TString& header) cons
|
||||
{
|
||||
XI_OBJ* column = find_column(col);
|
||||
if (column)
|
||||
{
|
||||
xi_set_text(column, (char *)(const char *)header );
|
||||
//RCT r; xi_get_rect(column, &r);
|
||||
//xi_set_column_width(column, (r.right-r.left+1) / CHARX); // Force redraw
|
||||
}
|
||||
}
|
||||
|
||||
const char* TSpreadsheet::get_column_header(const int col) const
|
||||
{
|
||||
const char* txt = "";
|
||||
XI_OBJ* column = find_column(col);
|
||||
if (column)
|
||||
txt = xi_get_text(column, NULL, -1);
|
||||
return txt;
|
||||
}
|
||||
|
||||
void TSpreadsheet::set_column_justify(int col, bool right)
|
||||
@ -2740,6 +2752,13 @@ void TSheet_field::set_column_header( const int col, const TString& header ) con
|
||||
s->set_column_header(col, header);
|
||||
}
|
||||
|
||||
const char* TSheet_field::get_column_header( const int col) const
|
||||
{
|
||||
TSpreadsheet* s = (TSpreadsheet*)_ctl;
|
||||
return s->get_column_header(col);
|
||||
}
|
||||
|
||||
|
||||
void TSheet_field::set_column_justify(int col, bool right)
|
||||
{
|
||||
if (col < FIRST_FIELD)
|
||||
|
@ -235,6 +235,8 @@ public:
|
||||
void set_column_width( const int col, const int width ) const;
|
||||
// @cmember Setta il titolo della colonna
|
||||
void set_column_header( const int col, const TString& header ) const;
|
||||
// @cmember Getta il titolo della colonna
|
||||
const char* get_column_header(const int col) const;
|
||||
// @cmember Setta l'allineamento della colonna
|
||||
void set_column_justify(int col, bool right);
|
||||
// @cmember Setta il colore dello sfondo e del testo di una o tutte le righe
|
||||
|
@ -1146,16 +1146,13 @@ int TRelation_application::rewrite(const TMask& m)
|
||||
//
|
||||
// @rdesc Ritorna se il record e' stato eliminato
|
||||
bool TRelation_application::relation_remove()
|
||||
|
||||
// @comm Se la maschera e' in MODE_MOD non e' possibile cancellare il record e viene
|
||||
// emesso un <f CHECK> di errore.
|
||||
{
|
||||
CHECK(_mask->edit_mode(), "You can call remove in edit mode only");
|
||||
|
||||
TRelation& r = *get_relation();
|
||||
|
||||
r.restore_status();
|
||||
|
||||
if (protected_record(r))
|
||||
return message_box("Elemento non eliminabile");
|
||||
|
||||
@ -1163,7 +1160,7 @@ bool TRelation_application::relation_remove()
|
||||
{
|
||||
r.restore_status();
|
||||
const bool ok = remove();
|
||||
if (ok)
|
||||
if (ok || is_transaction())
|
||||
set_limits();
|
||||
else
|
||||
return error_box("Errore di cancellazione %d", r.status());
|
||||
@ -1181,21 +1178,24 @@ bool TRelation_application::protected_record(TRelation &r)
|
||||
|
||||
bool TRelation_application::remove()
|
||||
{
|
||||
TMask &m=*_mask;
|
||||
int err = get_relation()->remove();
|
||||
for (int i = 0; i < m.fields(); i++)
|
||||
if (err == NOERR)
|
||||
{
|
||||
if (m.fld(i).is_sheet())
|
||||
const int maxf = _mask->fields();
|
||||
for (int i = 0; i < maxf; i++)
|
||||
{
|
||||
TSheet_field& f = (TSheet_field& )m.fld(i);
|
||||
if (f.record() && !f.external_record())
|
||||
err |= f.record()->remove();
|
||||
if (mf.is_sheet())
|
||||
{
|
||||
TSheet_field& f = (TSheet_field&)mf;
|
||||
if (f.record()&& !f.external_record())
|
||||
err |= f.record()->remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (err == NOERR)
|
||||
{
|
||||
m.set_mode(NO_MODE);
|
||||
mask2mail(m);
|
||||
_mask->set_mode(NO_MODE);
|
||||
mask2mail(*_mask);
|
||||
}
|
||||
return err == NOERR;
|
||||
}
|
||||
@ -1285,7 +1285,7 @@ void TRelation_application::main_loop()
|
||||
if (k <= MAX_KEYS && find(k))
|
||||
modify_mode();
|
||||
else
|
||||
k = K_QUIT;
|
||||
k = K_QUIT; // Siamo sicuri? insert_mode()
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1325,12 +1325,13 @@ void TRelation_application::main_loop()
|
||||
if (trovato)
|
||||
{
|
||||
modify_mode();
|
||||
warning_box("Elemento gia' presente");
|
||||
if (is_transaction())
|
||||
{
|
||||
_curr_transaction=TRANSACTION_MODIFY;
|
||||
_curr_trans_mode = TM_INTERACTIVE; // switch to interactive mode
|
||||
// _curr_trans_mode = TM_INTERACTIVE; // Siamo sicuri???
|
||||
}
|
||||
else
|
||||
warning_box("Elemento gia' presente");
|
||||
}
|
||||
else
|
||||
insert_mode();
|
||||
@ -1644,7 +1645,8 @@ bool TRelation_application::load_transaction()
|
||||
_curr_trans_mode = toupper(cnf.get("Mode")[0]);
|
||||
_curr_trans_from = cnf.get("From");
|
||||
long firm = cnf.get_long("Firm");
|
||||
if (firm > 0 && firm != get_firm())
|
||||
if (firm > 0)
|
||||
|
||||
{
|
||||
bool ok = set_firm(firm);
|
||||
if (ok)
|
||||
@ -1887,4 +1889,3 @@ bool TRelation_application::mask2mail(const TMask& m)
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ bool TRepgen_mask::test_tipodoc_num(const TSheet_field &sheet_num ,const TShee
|
||||
}
|
||||
}
|
||||
if (!ok)
|
||||
return error_box("Il tipo '%s' non appartiene a nessuna delle numerazioni scelte",(const char * )tipo);
|
||||
return error_box("Il tipo '%s' non appartiene a nessuna delle numerazioni scelte",(const char*)tipo);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -781,29 +781,49 @@ void TMRP_repgen::set_buckets_description()
|
||||
TString descr;
|
||||
TDate fd = _m->get_date(F_DADATA);
|
||||
TDate td = _m->get_date(F_ADATA);
|
||||
TDate wd;
|
||||
|
||||
TConfig ini(CONFIG_DITTA, "mr");
|
||||
const bool week_complete = ini.get_bool("WEEKCOMPLETE");
|
||||
|
||||
int bucket_size = _m->get_int(F_BUCKET) * 7;
|
||||
if (bucket_size < 7) bucket_size = 7;
|
||||
|
||||
int weekd, yeard;
|
||||
|
||||
const short first_id = 3;
|
||||
const short last_id = 15;
|
||||
--fd;
|
||||
descr.format("\nAl %s", (const char*)fd);
|
||||
descr.format("\nAl %s", (const char*)fd);
|
||||
if (bucket_size == 7)
|
||||
{
|
||||
fd.get_week_year(weekd, yeard, week_complete);
|
||||
descr << "\nSett. " << weekd << ' ' << yeard;
|
||||
}
|
||||
_form->find_field('B', odd_page, first_id).set_col_head(descr);
|
||||
TDate wd;
|
||||
for (;fd <= td;)
|
||||
{
|
||||
++fd;
|
||||
descr.format("Da %s\nAl ",(const char*)fd);
|
||||
descr.format("Dal %s\nAl ", (const char*)fd);
|
||||
fd += bucket_size-1;
|
||||
wd = fd;
|
||||
descr << (const char*) fd;
|
||||
descr << (const char*)fd;
|
||||
const short id = first_id+_m->round_date(wd,FALSE)+1;
|
||||
if (id > last_id)
|
||||
continue;
|
||||
if (id >= last_id)
|
||||
break;
|
||||
if (bucket_size == 7)
|
||||
{
|
||||
wd.get_week_year(weekd, yeard, week_complete);
|
||||
descr << "\nSett. " << weekd << ' ' << yeard;
|
||||
}
|
||||
_form->find_field('B', odd_page, id).set_col_head(descr);
|
||||
}
|
||||
++td;
|
||||
descr.format("Dal %s", (const char*)td);
|
||||
descr.format("Dal %s", (const char*)wd);
|
||||
if (bucket_size == 7)
|
||||
{
|
||||
wd.get_week_year(weekd, yeard, week_complete);
|
||||
descr << "\n\nSett. " << weekd << ' ' << yeard;
|
||||
}
|
||||
_form->find_field('B', odd_page, last_id).set_col_head(descr);
|
||||
}
|
||||
|
||||
@ -994,12 +1014,12 @@ void TMRP_repgen::main_loop()
|
||||
const int fl = printer().formlen();
|
||||
|
||||
int rows[4]; // Righe orizzontali
|
||||
rows[0] = hh-3;
|
||||
rows[0] = hh-4;
|
||||
rows[1] = hh;
|
||||
rows[2] = fl;
|
||||
rows[3] = 0;
|
||||
_form->genera_intestazioni(odd_page, hh-2);
|
||||
_form->genera_fincatura(odd_page, hh-3, fl, rows);
|
||||
_form->genera_intestazioni(odd_page, hh-3);
|
||||
_form->genera_fincatura(odd_page, hh-4, fl, rows);
|
||||
|
||||
// stampa
|
||||
if (_form->cursor()->items() > 0)
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ed il carico articoli nel tempo ( non richiesta ma messa per completezza )
|
||||
|
||||
|
||||
USE 132
|
||||
USE LF_MRPREPORT
|
||||
JOIN LF_ANAMAG INTO CODART==CODART
|
||||
JOIN IMP ALIAS 201 INTO CODTAB==IMPIANTO
|
||||
JOIN LNP ALIAS 202 INTO CODTAB==LINEA
|
||||
|
111
mr/mr2100.cpp
111
mr/mr2100.cpp
@ -22,13 +22,13 @@
|
||||
// TMRP_record
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void TMRP_record::add_ref(TMRP_docref * ref, TMRP_docrefs ** refs)
|
||||
void TMRP_record::add_ref(TMRP_docref * ref, TMRP_docrefs* &refs)
|
||||
{
|
||||
if (ref)
|
||||
if (ref != NULL)
|
||||
{
|
||||
if (!*refs)
|
||||
*refs = new TMRP_docrefs();
|
||||
(*refs)->add(ref);
|
||||
if (refs == NULL)
|
||||
refs = new TMRP_docrefs();
|
||||
refs->add(ref);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,21 +42,21 @@ const real& TMRP_record::add_gross_req(const real & val, TMRP_internalref * ref)
|
||||
|
||||
const real& TMRP_record::add_gross_req(const real & val, TMRP_docref * ref)
|
||||
{
|
||||
add_ref(ref, &_requirements);
|
||||
add_ref(ref, _requirements);
|
||||
_gross_requirement += val;
|
||||
return _gross_requirement;
|
||||
}
|
||||
|
||||
const real& TMRP_record::add_sched_rec(const real & val, TMRP_docref * ref)
|
||||
{
|
||||
add_ref(ref, &_scheduls);
|
||||
add_ref(ref, _scheduls);
|
||||
_sched_receipts += val;
|
||||
return _sched_receipts;
|
||||
}
|
||||
|
||||
const real& TMRP_record::add_planned_ord(const real & val, TMRP_docref * ref)
|
||||
{
|
||||
add_ref(ref, &_plans);
|
||||
add_ref(ref, _plans);
|
||||
_planned_orders += val;
|
||||
return _planned_orders;
|
||||
}
|
||||
@ -613,18 +613,31 @@ TRiga_ordine& TRiga_ordine::operator=(TToken_string& r)
|
||||
TRiga_ordine& TRiga_ordine::operator+=(TRiga_ordine& r)
|
||||
{
|
||||
CHECK(compare(r) == 0, "Can't add incompatible order line");
|
||||
real qta = get(F_QUANTITA - FIRST_FIELD);
|
||||
qta += real(r.get(F_QUANTITA - FIRST_FIELD));
|
||||
qta.round(5);
|
||||
add(qta.is_zero() ? " " : qta.string(), F_QUANTITA - FIRST_FIELD);
|
||||
|
||||
const real q = r.get(F_QUANTITA - FIRST_FIELD);
|
||||
if (!q.is_zero())
|
||||
{
|
||||
real qta = get(F_QUANTITA - FIRST_FIELD);
|
||||
qta += q; qta.round(5);
|
||||
add(qta.is_zero() ? " " : qta.string(), F_QUANTITA - FIRST_FIELD);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
TRiga_ordine::TRiga_ordine(const TDate& datadoc, const TDate& datacons, long forn, const TMRP_line& line, int bucket, const real & price)
|
||||
TRiga_ordine::TRiga_ordine(const TDate& datadoc, const TDate& datacons, long forn, const TMRP_line& line, int bucket, const real& price)
|
||||
: TToken_string(128)
|
||||
{
|
||||
// Determino il tipo di ordine (PROD/ACQ)
|
||||
bool art_prod = FALSE;
|
||||
const TCodice_articolo& codart = line.articolo();
|
||||
const TRectype& rec=cache().get(LF_DIST, codart);
|
||||
if (rec.empty())
|
||||
art_prod = cache().get(LF_ANAMAG, codart).get_bool(ANAMAG_ARTPROD);
|
||||
else
|
||||
art_prod = rec.get_bool("ARTPROD");
|
||||
|
||||
add(" ",F_SELECTED - FIRST_FIELD);
|
||||
add("F",F_ORD_TYPE - FIRST_FIELD);
|
||||
add(art_prod ? "P" : "F", F_ORD_TYPE - FIRST_FIELD);
|
||||
add(datadoc.string(),F_DATADOC - FIRST_FIELD);
|
||||
add(datacons.string(),F_DATACONS - FIRST_FIELD);
|
||||
add(line.codclifor() ? line.codclifor() : forn, F_FORNITORE - FIRST_FIELD);
|
||||
@ -1210,50 +1223,47 @@ int TMatResMask::add_order_line(long forn, const TMRP_line& line, int bucket)
|
||||
|
||||
TSheet_field& s = sfield(F_ORDINI);
|
||||
TString_array& a = s.rows_array();
|
||||
real q(line.net_requirement(bucket));
|
||||
real q = line.net_requirement(bucket); // Fabbisogno netto
|
||||
TMRP_docrefs * pl_orders=NULL,*sc_orders=NULL;
|
||||
if (get_bool(F_RESCHEDULING))
|
||||
sc_orders = line.record(bucket).scheduls_refs();
|
||||
pl_orders = line.record(bucket).plans_refs();
|
||||
// le proposte di rescheduling sono da mettere su uno sheet a parte...
|
||||
int nref = pl_orders ? nref = pl_orders->items() : 0;
|
||||
real qtaplan;
|
||||
do {
|
||||
int nref = pl_orders != NULL ? pl_orders->items() : 0;
|
||||
real qtaplan; // Quantità da pianificare
|
||||
do
|
||||
{
|
||||
TRiga_ordine* r = new TRiga_ordine(datadoc, datacons, forn, line, bucket, ZERO);
|
||||
// Setta un codice numerazione (provvisorio) in base al tipo di ordine
|
||||
const char ot = *r->get(F_ORD_TYPE - FIRST_FIELD);
|
||||
r->add(get(ot == 'F' ? F_NUM_FORN : F_NUM_PROD) , F_DOCCODNUM - FIRST_FIELD);
|
||||
|
||||
nref--;
|
||||
if (nref >= 0)
|
||||
{
|
||||
const TString & codnum = pl_orders->get_ref(nref).codnumdoc();
|
||||
if (codnum == get(F_NUM_PROD)
|
||||
|| codnum == get(F_NUM_FORN))
|
||||
{
|
||||
const TString& codnum = pl_orders->get_ref(nref).codnumdoc();
|
||||
if (codnum == get(F_NUM_PROD) || codnum == get(F_NUM_FORN))
|
||||
{
|
||||
qtaplan = pl_orders->get_ref(nref).qta_residua();
|
||||
qtaplan.round(5);
|
||||
q.round(5);
|
||||
// if (qtaplan > q )
|
||||
// {
|
||||
qtaplan = q - qtaplan; // tengo solo in parte questo ordine ...
|
||||
r->add(pl_orders->get_ref(nref).annodoc() , F_DOCANNODOC - FIRST_FIELD);
|
||||
r->add(pl_orders->get_ref(nref).codnumdoc() , F_DOCCODNUM - FIRST_FIELD);
|
||||
r->add(pl_orders->get_ref(nref).numdoc() , F_DOCNUM - FIRST_FIELD);
|
||||
r->add(pl_orders->get_ref(nref).numrig() , F_DOCNRIGA - FIRST_FIELD);
|
||||
r->add(qtaplan.is_zero() ? " " : qtaplan.string(), F_QUANTITA - FIRST_FIELD);
|
||||
r->add(pl_orders->get_ref(nref).datacons().string() , F_DATACONS - FIRST_FIELD);
|
||||
r->add(pl_orders->get_ref(nref).datadoc().string(), F_DATADOC - FIRST_FIELD);
|
||||
// } else {
|
||||
// q = q - qtaplan; // genero solo una parte del nuovo ordine...
|
||||
// r->add(q.string() , F_QUANTITA - FIRST_FIELD);
|
||||
// qtaplan = ZERO;
|
||||
// }
|
||||
qtaplan = q - qtaplan; // tengo solo in parte questo ordine ...
|
||||
r->add(pl_orders->get_ref(nref).annodoc() , F_DOCANNODOC - FIRST_FIELD);
|
||||
r->add(pl_orders->get_ref(nref).codnumdoc() , F_DOCCODNUM - FIRST_FIELD);
|
||||
r->add(pl_orders->get_ref(nref).numdoc() , F_DOCNUM - FIRST_FIELD);
|
||||
r->add(pl_orders->get_ref(nref).numrig() , F_DOCNRIGA - FIRST_FIELD);
|
||||
r->add(qtaplan.is_zero() ? " " : qtaplan.string(), F_QUANTITA - FIRST_FIELD);
|
||||
r->add(pl_orders->get_ref(nref).datacons().string() , F_DATACONS - FIRST_FIELD);
|
||||
r->add(pl_orders->get_ref(nref).datadoc().string(), F_DATADOC - FIRST_FIELD);
|
||||
q = ZERO;
|
||||
} else
|
||||
r->add(" " , F_QUANTITA - FIRST_FIELD);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
r->add(q.is_zero() ? " " : q.string() , F_QUANTITA - FIRST_FIELD);
|
||||
qtaplan = ZERO;
|
||||
}
|
||||
// if ((nref >= 0 && (!qtaplan.is_zero() || get_bool(F_ALLORDERS))) || // correggo un vecchio ordine ...
|
||||
// (nref < 0 && !q.is_zero())) // ... o ne genero uno nuovo
|
||||
if ((nref >= 0 && (!qtaplan.is_zero() || get_bool(F_ALL_ORDERSCHANGES))) || // correggo un vecchio ordine ...
|
||||
(nref < 0 && !q.is_zero()) || // ... o ne genero uno nuovo
|
||||
get_bool(F_ALL_MRPLINES)) // ...o voglio tutte le righe
|
||||
@ -1269,7 +1279,8 @@ int TMatResMask::add_order_line(long forn, const TMRP_line& line, int bucket)
|
||||
// RIGA GIA' PRESENTE
|
||||
TRiga_ordine& riga = (TRiga_ordine&)a[pos];
|
||||
const TString & codnum = riga.get(F_DOCCODNUM - FIRST_FIELD);
|
||||
if (!(codnum != get(F_NUM_PROD) && codnum != get(F_NUM_FORN)))
|
||||
// if (!(codnum != get(F_NUM_PROD) && codnum != get(F_NUM_FORN)))
|
||||
if (codnum == get(F_NUM_PROD) || codnum == get(F_NUM_FORN)) // Guy was here!
|
||||
riga += *r;
|
||||
delete r;
|
||||
const TString & qta2or = riga.get(F_QUANTITA - FIRST_FIELD);
|
||||
@ -1459,6 +1470,7 @@ TMatResMask::TMatResMask() : TCalendar_mask("mr2100a"), _sel_color(sfield(F_ORDI
|
||||
{
|
||||
_condv = NULL;
|
||||
TSheet_field& sf = sfield(F_ORDINI);
|
||||
|
||||
livelli_giacenza().set_sheet_columns(sf, F_LIV1);
|
||||
|
||||
TConfig ini(CONFIG_DITTA, "mg");
|
||||
@ -1860,7 +1872,7 @@ bool TMatResPlanning::load_gross_requirements()
|
||||
|
||||
const int year_fr = date_fr.year() - (m.get_bool(F_DOC_YEAR_PREC) ? 1 : 0);
|
||||
const int year_to = date_to.year();
|
||||
const bool master = m.get(F_ORC_MASTER)[0] == 'M';
|
||||
const bool master = m.get(F_ORC_MASTER)[0] == 'M'; // Master Plan o Ordine Cliente
|
||||
// azzera l'array _requirements
|
||||
const bool nomag = m.get_bool(F_NOMAG);
|
||||
const bool nodep = m.get_bool(F_NODEP);
|
||||
@ -2389,6 +2401,7 @@ bool TMatResPlanning::build_orders()
|
||||
}
|
||||
for (int b = line.last_bucket(); b >= 0; b--)
|
||||
{
|
||||
/*
|
||||
const TMRP_record & rrr = line.record(b);
|
||||
const real r0 = line.gross_requirement(b);
|
||||
const real r1 = line.planned_orders(b);
|
||||
@ -2400,7 +2413,8 @@ bool TMatResPlanning::build_orders()
|
||||
line.planned_orders(b)>0 ||
|
||||
line.sched_receipts(b)>line.gross_requirement(b))
|
||||
m.add_order_line(forn, line, b);
|
||||
else
|
||||
else
|
||||
*/
|
||||
m.add_order_line(forn, line, b);
|
||||
}
|
||||
}
|
||||
@ -3040,6 +3054,16 @@ bool TMatResPlanning::emit_orders()
|
||||
rdoc.put(RDOC_DESCR, riga.get(sf.cid2index(F_DESCART)));
|
||||
if (!divide_by_date)
|
||||
rdoc.put(RDOC_DATACONS,datacon.string());
|
||||
|
||||
TString16 cod;
|
||||
if (forn > 0)
|
||||
{
|
||||
cod.format("F|%ld", forn);
|
||||
cod = cache().get(LF_CFVEN, cod, CFV_ASSFIS);
|
||||
}
|
||||
if (cod.empty())
|
||||
cod = cache().get(LF_ANAMAG, riga.get(sf.cid2index(F_ARTICOLO)), ANAMAG_CODIVA);
|
||||
rdoc.put(RDOC_CODIVA, cod);
|
||||
|
||||
riga.add("X",sf.cid2index(F_OK));
|
||||
}
|
||||
@ -3246,6 +3270,7 @@ void print_header(TPrinter& pr)
|
||||
row.put(format);
|
||||
pr.setheaderline(0,row);
|
||||
}
|
||||
|
||||
void print_footer(TPrinter& pr)
|
||||
{
|
||||
TPrintrow row;
|
||||
|
@ -26,7 +26,7 @@ class TMRP_record : public TObject
|
||||
TMRP_docrefs *_requirements; // gross.req. da documenti esterni
|
||||
TMRP_internalrefs *_internal_req; // gross.req. da esplosioni interne
|
||||
|
||||
void add_ref(TMRP_docref * ref, TMRP_docrefs ** refs);
|
||||
void add_ref(TMRP_docref * ref, TMRP_docrefs* &refs);
|
||||
public:
|
||||
const real& on_hand() const { return /*_on_hand <= ZERO ? ZERO :*/_on_hand ; }
|
||||
const real& net_requirement() const { return _net_requirement; }
|
||||
|
@ -217,6 +217,7 @@ bool TSave_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
else
|
||||
message_box("Controllare il tabulato eccezioni.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TPlann_sub_mask::on_field_event(o,e,jolly);
|
||||
}
|
||||
@ -457,10 +458,10 @@ static long table_items(const char* tab)
|
||||
|
||||
bool TPlanning_mask::elabora()
|
||||
{
|
||||
TSheet_field& s = sfield(F_ARTICOLI);
|
||||
clear_sheets();
|
||||
if (carica_documenti())
|
||||
{
|
||||
TSheet_field& s = sfield(F_ARTICOLI);
|
||||
fill_sheet();
|
||||
const bool some_lines=s.items() > 0;
|
||||
enable(-G_PREPROCESS, !some_lines);
|
||||
@ -970,7 +971,7 @@ int TPlanning_mask::insert_propose(bool verbose)
|
||||
{
|
||||
add_or_sub_propose(+1);
|
||||
const long new_rows=_proposed_articles.items();
|
||||
TSheet_field& sf = sfield(F_ARTICOLI);
|
||||
|
||||
TDate firstdate(get_date(F_ADATA));
|
||||
for (long new_row=0; new_row < new_rows; new_row++)
|
||||
{
|
||||
@ -1097,7 +1098,7 @@ void TPlanning_mask::add_or_sub_propose(char sign, bool scheduled)
|
||||
}
|
||||
TToken_string& artrow = sf.row(art_row);
|
||||
const int lastbuck = _proposed_articles[new_row].last_bucket();
|
||||
//TDate data_buck;
|
||||
|
||||
for (int nbucket=0; nbucket<=lastbuck ; nbucket++)
|
||||
{
|
||||
int b = bucket( _proposed_articles[new_row].time(nbucket).date() );
|
||||
@ -1224,21 +1225,22 @@ void TPlanning_mask::propose(int row)
|
||||
const bool useextrahours=get_bool(F_USEEXTRAHRS_MSP) ;
|
||||
set(F_USENONSTDLIN_CRP ,useextralines ? "X" : "");
|
||||
set(F_USEEXTRAHRS_CRP ,useextrahours ? "X" : "");
|
||||
if (get(F_RECALC_TYPE)=="1")
|
||||
const TString& rt = get(F_RECALC_TYPE);
|
||||
if (rt=="1")
|
||||
propose_1stJIT(_first_fit_logic,TRUE,TRUE, row);
|
||||
else if (get(F_RECALC_TYPE)=="1_INFH")
|
||||
else if (rt=="1_INFH")
|
||||
propose_1stJIT(_first_fit_logic,TRUE,FALSE, row);
|
||||
else if (get(F_RECALC_TYPE)=="1_INF")
|
||||
else if (rt=="1_INF")
|
||||
propose_1stJIT(_first_fit_logic,FALSE,FALSE, row);
|
||||
else if (get(F_RECALC_TYPE)=="JIT")
|
||||
else if (rt=="JIT")
|
||||
propose_1stJIT(_JIT_logic,TRUE,TRUE, row);
|
||||
else if (get(F_RECALC_TYPE)=="JIT_INFH")
|
||||
else if (rt=="JIT_INFH")
|
||||
propose_1stJIT(_JIT_logic,TRUE,FALSE, row);
|
||||
else if (get(F_RECALC_TYPE)=="JIT_INF")
|
||||
else if (rt=="JIT_INF")
|
||||
propose_1stJIT(_JIT_logic,FALSE,FALSE, row);
|
||||
else if (get(F_RECALC_TYPE)=="UNIL")
|
||||
else if (rt=="UNIL")
|
||||
propose_1stJIT(_uniform_logic,TRUE,FALSE, row);
|
||||
else if (get(F_RECALC_TYPE)=="UNI")
|
||||
else if (rt=="UNI")
|
||||
propose_1stJIT(_uniform_logic,FALSE,FALSE, row);
|
||||
// aggiorna lo sheet delle capacita'
|
||||
}
|
||||
@ -1655,7 +1657,7 @@ TCRP_line *TPlanning_mask::compute_capacity(TLinea_prod &lineaprod, bool useextr
|
||||
TMRP_calendar & cal = TMRP_time::get_calendar("", codlin);
|
||||
TMRP_calendar & cal_imp = TMRP_time::get_calendar(codimp);
|
||||
TMRP_calendar & cal_firm = TMRP_time::get_calendar();
|
||||
CHECK(_capacities.find(lineaprod,FALSE)==NULL,"Errore: impossibile ricalcolare la capacita' di una linea produttiva");
|
||||
CHECK(_capacities.find(lineaprod,FALSE)==NULL,"Errore: impossibile ricalcolare la capacità di una linea produttiva");
|
||||
|
||||
TCRP_line *crpline_lin,*crpline_imp,*crpline_firm;
|
||||
crpline_lin =_capacities.find(lineaprod, "", 0L,TRUE);
|
||||
@ -1691,13 +1693,13 @@ TCRP_line *TPlanning_mask::compute_capacity(TLinea_prod &lineaprod, bool useextr
|
||||
if (human > ZERO)
|
||||
{
|
||||
crpline_lin->capacity(b).set_human(human);
|
||||
crpline_imp->capacity(b).set_human(human+crpline_imp->capacity(b).human());
|
||||
crpline_firm->capacity(b).set_human(human+crpline_firm->capacity(b).human());
|
||||
// crpline_imp->capacity(b).set_human(human+crpline_imp->capacity(b).human());
|
||||
// crpline_firm->capacity(b).set_human(human+crpline_firm->capacity(b).human());
|
||||
}
|
||||
if (human_imp > ZERO)
|
||||
{
|
||||
crpline_imp->capacity(b).set_human(human_imp+crpline_imp->capacity(b).human());
|
||||
crpline_firm->capacity(b).set_human(human_imp+crpline_firm->capacity(b).human());
|
||||
// crpline_firm->capacity(b).set_human(human_imp+crpline_firm->capacity(b).human());
|
||||
}
|
||||
if (human_firm > ZERO)
|
||||
crpline_firm->capacity(b).set_human(human_firm+crpline_firm->capacity(b).human());
|
||||
@ -2058,6 +2060,16 @@ bool TPlanning_mask::do_test_art_row(int r, int first, int last, bool signal)
|
||||
// **********
|
||||
// calcola la giacenza proiettata
|
||||
TCodice_articolo codart(curr_row.get(sf.cid2index(F_ARTICOLO)));
|
||||
if (codart.blank()) // Controllo di DEBUG
|
||||
{
|
||||
if (signal)
|
||||
{
|
||||
error_box("Articolo nullo nella riga %d", r+1);
|
||||
signal = FALSE;
|
||||
}
|
||||
return signal;
|
||||
}
|
||||
|
||||
TArticolo_giacenza art(codart);
|
||||
TString16 liv;
|
||||
TString8 mag,imp,lin;
|
||||
@ -2328,7 +2340,7 @@ bool TPlanning_mask::test_load_row(int r, bool signal)
|
||||
TString err;
|
||||
TDate d = starting_date() + long(days_per_bucket() * (b-1));
|
||||
round_date(d);
|
||||
err << "Riga " << c+1 << ": capacita' superata al " << d;
|
||||
err << "Riga " << c+1 << ": capacità superata al " << d;
|
||||
beep();
|
||||
signal =FALSE;
|
||||
xvt_statbar_set(err);
|
||||
@ -2775,7 +2787,7 @@ bool TPlanning_mask::on_field_event(TOperable_field& o, TField_event e, long jol
|
||||
}
|
||||
break;
|
||||
case se_leave:
|
||||
if (nriga < righe)
|
||||
if (nriga >= 0 && nriga < righe)
|
||||
{
|
||||
const TToken_string &art_row= s.row(nriga);
|
||||
if (_curr_art_row != s.row(nriga))
|
||||
@ -2804,7 +2816,6 @@ bool TPlanning_mask::on_field_event(TOperable_field& o, TField_event e, long jol
|
||||
break;
|
||||
case F_LINEE:
|
||||
{
|
||||
TSheet_field& s = (TSheet_field&)o;
|
||||
switch(e)
|
||||
{
|
||||
case se_query_add:
|
||||
@ -3216,7 +3227,7 @@ void TPlanning_mask::init()
|
||||
sf.sheet_mask().hide(F_CODIMP);
|
||||
sf.sheet_mask().hide(F_DESCIMP);
|
||||
}
|
||||
_week_complete = ini.get_bool("WEEKCOMPLETE", "mr", -1, TRUE);
|
||||
_week_complete = ini.get_bool("WEEKCOMPLETE", "mr");
|
||||
_standard_for = ini.get_long("CODFOR", "mr");
|
||||
sfield(F_LINEE).disable();
|
||||
// sfield(F_TESTE).disable();
|
||||
@ -3759,7 +3770,7 @@ void TPlanning_app::main_loop()
|
||||
mask().disable(F_TIPOCV);
|
||||
mask().disable(F_CATVEN_CV);
|
||||
}
|
||||
while (mask().run()!=K_QUIT) ;
|
||||
while (mask().run()!=K_QUIT) ;
|
||||
}
|
||||
|
||||
int mr2200(int argc, char* argv[])
|
||||
|
@ -2,7 +2,7 @@
|
||||
// e la stampa scheduling del bucket suddiviso per linee
|
||||
|
||||
|
||||
USE 132 KEY 3
|
||||
USE LF_MRPREPORT KEY 3
|
||||
JOIN LF_ANAMAG INTO CODART==CODART
|
||||
JOIN IMP ALIAS 201 INTO CODTAB==IMPIANTO
|
||||
JOIN LNP ALIAS 202 INTO CODTAB==LINEA
|
||||
@ -73,103 +73,113 @@ SECTION BODY ODD 1 COLUMNWISE
|
||||
FIELD UM
|
||||
END
|
||||
|
||||
NUMERO 3 14 3
|
||||
NUMERO 3 14 2
|
||||
BEGIN
|
||||
SPECIAL STRINGA INTESTAZIONE "Bucket.0" "Bucket.0"
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
|
||||
KEY "Bucket Iniziale"
|
||||
PROMPT 10 1 ""
|
||||
PICTURE ".2"
|
||||
FIELD QTAFIRST
|
||||
END
|
||||
|
||||
NUMERO 4 14 3
|
||||
NUMERO 4 14 2
|
||||
BEGIN
|
||||
SPECIAL STRINGA INTESTAZIONE "Bucket.1" "Bucket.1"
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
|
||||
KEY "Bucket 1"
|
||||
PROMPT 11 1 ""
|
||||
PICTURE ".2"
|
||||
FIELD QTA1
|
||||
END
|
||||
|
||||
NUMERO 5 14 3
|
||||
NUMERO 5 14 2
|
||||
BEGIN
|
||||
SPECIAL STRINGA INTESTAZIONE "Bucket.2" "Bucket.2"
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
|
||||
KEY "Bucket 2"
|
||||
PROMPT 12 1 ""
|
||||
PICTURE ".2"
|
||||
FIELD QTA2
|
||||
END
|
||||
|
||||
NUMERO 6 14 3
|
||||
NUMERO 6 14 2
|
||||
BEGIN
|
||||
SPECIAL STRINGA INTESTAZIONE "Bucket.3" "Bucket.3"
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
|
||||
KEY "Bucket 3"
|
||||
PROMPT 13 1 ""
|
||||
PICTURE ".2"
|
||||
FIELD QTA3
|
||||
END
|
||||
|
||||
NUMERO 7 14 3
|
||||
NUMERO 7 14 2
|
||||
BEGIN
|
||||
SPECIAL STRINGA INTESTAZIONE "Bucket.4" "Bucket.4"
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
|
||||
KEY "Bucket 4"
|
||||
PROMPT 14 1 ""
|
||||
PICTURE ".2"
|
||||
FIELD QTA4
|
||||
END
|
||||
|
||||
NUMERO 8 14 3
|
||||
NUMERO 8 14 2
|
||||
BEGIN
|
||||
SPECIAL STRINGA INTESTAZIONE "Bucket.5" "Bucket.5"
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
|
||||
KEY "Bucket 5"
|
||||
PROMPT 15 1 ""
|
||||
PICTURE ".2"
|
||||
FIELD QTA5
|
||||
END
|
||||
|
||||
NUMERO 9 14 3
|
||||
NUMERO 9 14 2
|
||||
BEGIN
|
||||
SPECIAL STRINGA INTESTAZIONE "Bucket.6" "Bucket.6"
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
|
||||
KEY "Bucket 6"
|
||||
PROMPT 16 1 ""
|
||||
PICTURE ".2"
|
||||
FIELD QTA6
|
||||
END
|
||||
|
||||
NUMERO 10 14 3
|
||||
NUMERO 10 14 2
|
||||
BEGIN
|
||||
SPECIAL STRINGA INTESTAZIONE "Bucket.7" "Bucket.7"
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
|
||||
KEY "Bucket 7"
|
||||
PROMPT 17 1 ""
|
||||
PICTURE ".2"
|
||||
FIELD QTA7
|
||||
END
|
||||
|
||||
NUMERO 11 14 3
|
||||
NUMERO 11 14 2
|
||||
BEGIN
|
||||
SPECIAL STRINGA INTESTAZIONE "Bucket.8" "Bucket.8"
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
|
||||
KEY "Bucket 8"
|
||||
PROMPT 18 1 ""
|
||||
PICTURE ".2"
|
||||
FIELD QTA8
|
||||
END
|
||||
|
||||
NUMERO 12 14 3
|
||||
NUMERO 12 14 2
|
||||
BEGIN
|
||||
SPECIAL STRINGA INTESTAZIONE "Bucket.9" "Bucket.9"
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
|
||||
KEY "Bucket 9"
|
||||
PROMPT 19 1 ""
|
||||
PICTURE ".2"
|
||||
FIELD QTA9
|
||||
END
|
||||
END
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
// albero per le ricerche sulle dist
|
||||
static TDistinta_tree *_dist_tree=NULL;
|
||||
|
||||
TDistinta_tree &dist_tree()
|
||||
{
|
||||
if (!_dist_tree)
|
||||
@ -66,10 +67,19 @@ bool TMSP_form::validate(TForm_item &cf, TToken_string &cmd)
|
||||
return TForm::validate(cf,cmd);
|
||||
}
|
||||
|
||||
TCRP_form::TCRP_form(TIsamtempfile * report) :TForm("mr2200b")
|
||||
TCRP_form::TCRP_form(TIsamtempfile* report, TSheet_field& sf)
|
||||
: TForm("mr2200b")
|
||||
{
|
||||
TRelation* rel = relation();
|
||||
rel->replace(report);
|
||||
|
||||
// Modifica oppportunamente le intestazioni dei bucket
|
||||
TPrint_section& body = section('B', odd_page);
|
||||
for (word i = 2; i < body.fields(); i++)
|
||||
{
|
||||
TForm_item& fi = body.field(i);
|
||||
fi.set_col_head(sf.get_column_header(i+2));
|
||||
}
|
||||
|
||||
const int hh = 7;
|
||||
const int fl = printer().formlen();
|
||||
@ -81,48 +91,31 @@ TCRP_form::TCRP_form(TIsamtempfile * report) :TForm("mr2200b")
|
||||
rows[3] = 0;
|
||||
genera_intestazioni(odd_page, hh-2);
|
||||
genera_fincatura(odd_page, hh-3, fl, rows);
|
||||
|
||||
}
|
||||
|
||||
bool TCRP_form::validate(TForm_item &cf, TToken_string &cmd)
|
||||
{
|
||||
TString s;
|
||||
cmd.get(0,s);
|
||||
if (s=="_USER")
|
||||
TString val;
|
||||
cmd.get(0,val);
|
||||
if (val=="_USER")
|
||||
{
|
||||
TRelation* rel = relation();
|
||||
cmd.get(1,s);
|
||||
if (s=="CODART")
|
||||
cmd.get(1,val);
|
||||
if (val=="CODART")
|
||||
{
|
||||
TString val;
|
||||
const char type = rel->lfile().get("TIPO")[0];
|
||||
switch (toupper(type))
|
||||
const TRectype& curr = relation()->curr();
|
||||
const char type = curr.get_char("TIPO");
|
||||
switch (type)
|
||||
{
|
||||
case 'D':
|
||||
if (isupper(type))
|
||||
val << "Totale capacita'";
|
||||
else
|
||||
val << " Totale carico ";
|
||||
break;
|
||||
case 'I':
|
||||
if (isupper(type))
|
||||
val << " Capacita'";
|
||||
else
|
||||
val << " Carico";
|
||||
val << " impianto " << rel->lfile().get("IMPIANTO");
|
||||
break;
|
||||
case 'L':
|
||||
if (isupper(type))
|
||||
val << " Capacita'";
|
||||
else
|
||||
val << " Carico";
|
||||
val << " linea " << rel->lfile().get("LINEA");
|
||||
break;
|
||||
default:
|
||||
val << " Articolo ";
|
||||
val << rel->lfile().get("CODART");
|
||||
val << " " << rel->lfile(LF_ANAMAG).get("DESCR");
|
||||
break;
|
||||
case 'D': val = " Capacità totale"; break;
|
||||
case 'd': val = " Carico totale"; break;
|
||||
case 'I': val = " Capacità impianto "; val << curr.get("IMPIANTO"); break;
|
||||
case 'i': val = " Carico impianto "; val << curr.get("IMPIANTO"); break;
|
||||
case 'L': val = " Capacità linea "; val << curr.get("LINEA"); break;
|
||||
case 'l': val = " Carico linea "; val << curr.get("LINEA"); break;
|
||||
default:
|
||||
val = curr.get("CODART");
|
||||
val << " " << relation()->curr(LF_ANAMAG).get("DESCR");
|
||||
break;
|
||||
}
|
||||
cf.set(val);
|
||||
}
|
||||
@ -596,7 +589,7 @@ void TCRP_line::fill_capacity_row(TToken_string& row, char load_type, bool perce
|
||||
{
|
||||
row.add(codimp(),F_CODIMPCRP -FIRST_FIELD);
|
||||
row.add(codlin(),F_CODLINCRP -FIRST_FIELD);
|
||||
row.add("Capacita'",F_CODARTCRP -FIRST_FIELD);
|
||||
row.add("Capacità",F_CODARTCRP -FIRST_FIELD);
|
||||
|
||||
row.add(percent ? "%" : (load_type == '$' ? " $ " :( load_type == 'P' ? "Pz." : "ore")),F_LUM -FIRST_FIELD);
|
||||
|
||||
|
@ -88,7 +88,7 @@ class TCRP_form : public TForm
|
||||
protected:
|
||||
bool validate(TForm_item &cf, TToken_string &s);
|
||||
public:
|
||||
TCRP_form (TIsamtempfile * rep);
|
||||
TCRP_form (TIsamtempfile* rep, TSheet_field& sf);
|
||||
};
|
||||
|
||||
class TMSP_constraints : public TMRP_array
|
||||
|
102
mr/mr2202.cpp
102
mr/mr2202.cpp
@ -43,7 +43,6 @@ void TPlanning_mask::print_exceptions(TExceptions_array &excepts)
|
||||
|
||||
void TPlanning_mask::print_except_header(TPrinter& pr)
|
||||
{
|
||||
TString format;
|
||||
TPrintrow row;
|
||||
print_header(pr);
|
||||
row.put("@48G@BSTAMPA TABULATO ECCEZIONI DA M.S.P.");
|
||||
@ -55,7 +54,7 @@ void TPlanning_mask::print_except_header(TPrinter& pr)
|
||||
|
||||
void TPlanning_mask::print_articles(int from_col, int num_cols, const char * row_filter)
|
||||
{
|
||||
TString repname("mr2200");
|
||||
const char* repname = "mr2200";
|
||||
TSheet_field& sf = sfield(F_ARTICOLI);
|
||||
const int nrows=sf.items();
|
||||
|
||||
@ -63,7 +62,7 @@ void TPlanning_mask::print_articles(int from_col, int num_cols, const char * row
|
||||
TString8 codimp,codlin;
|
||||
TProgind pi(nrows, format("Stampa %s...",get_bool(F_MSCHEDULEPLAN)?
|
||||
"Master Schedule Plan":"pianificazione ordini"));
|
||||
char block='\0';
|
||||
|
||||
const int a_buck0 = sf.cid2index(F_BUCKET0);
|
||||
for (int r=0; r<nrows; r++)
|
||||
{
|
||||
@ -136,7 +135,7 @@ void TPlanning_mask::print_articles(int from_col, int num_cols, const char * row
|
||||
TDate fd(starting_date());
|
||||
TDate td = get_date(F_ADATA);
|
||||
const short first_id = 3;
|
||||
const short last_id = 14;
|
||||
const short last_id = 14;
|
||||
|
||||
if (num_cols == 0)
|
||||
num_cols = last_id - first_id;
|
||||
@ -188,23 +187,23 @@ void TPlanning_mask::print_articles(int from_col, int num_cols, const char * row
|
||||
|
||||
void TPlanning_mask::print_capacities()
|
||||
{
|
||||
TString repname("mr2200");
|
||||
TSheet_field& sf = sfield(F_LINEE);
|
||||
const int nrows=sf.items();
|
||||
|
||||
const char* repname = "mr2200";
|
||||
TIsamtempfile * report = new TIsamtempfile(LF_MRPREPORT,repname, TRUE, FALSE );
|
||||
TRectype &record=report->curr();
|
||||
|
||||
TString8 codimp,codlin;
|
||||
TString codart;
|
||||
|
||||
TSheet_field& sf = sfield(F_LINEE);
|
||||
const int nrows=sf.items();
|
||||
TProgind pi(nrows, format("Stampa %s...",(*get(F_LOADTYPE)=='M')?
|
||||
"carico macchina":"carico uomo"));
|
||||
const int a_buck0 = sf.cid2index(F_LBUCKET0);
|
||||
char block='\0';
|
||||
for (int r=0; r <nrows ; r++)
|
||||
{
|
||||
if (pi.iscancelled())
|
||||
return;
|
||||
TToken_string &row=sf.row(r);
|
||||
TRectype &record=report->curr();
|
||||
record.zero(' ');
|
||||
codimp=row.get(sf.cid2index(F_CODIMPCRP));
|
||||
codlin=row.get(sf.cid2index(F_CODLINCRP));
|
||||
@ -213,8 +212,8 @@ void TPlanning_mask::print_capacities()
|
||||
record.put("IMPIANTO", codimp);
|
||||
record.put("LINEA", codlin);
|
||||
record.put("CODART", codart);
|
||||
char type('D');
|
||||
if (!codart.blank())
|
||||
char type = 'D';
|
||||
if (!codart.blank() && codart != "Capacità" && codart != "Carico")
|
||||
type = 'A';
|
||||
else if (!codlin.blank())
|
||||
type = 'L';
|
||||
@ -230,34 +229,29 @@ void TPlanning_mask::print_capacities()
|
||||
TString16 campo;
|
||||
for (int b = LAST_BUCKET; b >= 0; b--)
|
||||
{
|
||||
switch(b)
|
||||
{
|
||||
case 0:
|
||||
campo = "QTAFIRST"; break;
|
||||
case LAST_BUCKET:
|
||||
campo = "QTALAST"; break;
|
||||
default:
|
||||
campo.format("QTA%d", b);
|
||||
}
|
||||
record.put(campo, row.get(sf.cid2index(F_LBUCKET0+b*2)));
|
||||
switch(b)
|
||||
{
|
||||
case 0: campo = "QTAFIRST"; break;
|
||||
case LAST_BUCKET: campo = "QTALAST"; break;
|
||||
default: campo.format("QTA%d", b); break;
|
||||
}
|
||||
record.put(campo, row.get(a_buck0+b));
|
||||
}
|
||||
report->write();
|
||||
pi.addstatus(1);
|
||||
}
|
||||
// delete report;
|
||||
// TIsamtempfile * report = new TIsamtempfile(LF_MRPREPORT,repname, FALSE, FALSE );
|
||||
TCRP_form form(report);
|
||||
// stampa
|
||||
TCRP_form form(report, sf);
|
||||
|
||||
if (form.cursor()->items() > 0)
|
||||
form.print();
|
||||
form.print();
|
||||
// report non va cancellato, poiche' ne viene fatta la sostituzione nella relazione del form
|
||||
// quindi la delete viene gia' fatta alla distruzione di _form
|
||||
}
|
||||
|
||||
|
||||
bool TPlanning_mask::find_exceptions(TExceptions_array &e, bool anticipi, bool posticipi, bool extra, bool stockbreak, bool codemiss, bool verbose)
|
||||
bool TPlanning_mask::find_exceptions(TExceptions_array &e, bool anticipi, bool posticipi, bool extra,
|
||||
bool stockbreak, bool codemiss, bool verbose)
|
||||
{
|
||||
|
||||
e.destroy();
|
||||
if (!get_bool(F_RESCHEDULING))
|
||||
{
|
||||
@ -338,34 +332,34 @@ void TMRP_line::reset_excepts()
|
||||
bool TMRP_line::find_ad_excepts(bool anticipi, bool posticipi, TExceptions_array &e)
|
||||
{
|
||||
bool some=FALSE;
|
||||
real totplan,movable,diff;
|
||||
// PER OGNI BUCKET ...
|
||||
int last(last_bucket()), first=0;
|
||||
const int last = last_bucket();
|
||||
int first = 0;
|
||||
for (int nbucket = 0; nbucket <= last; nbucket++)
|
||||
{
|
||||
const real & sr=sched_receipts(nbucket);
|
||||
const real & ro=resched_orders(nbucket);
|
||||
const real & uo=unsched_orders(nbucket);
|
||||
const real & pl=planned_orders(nbucket);
|
||||
totplan = planned_orders(nbucket) - sched_receipts(nbucket) - resched_orders(nbucket) + unsched_orders(nbucket);
|
||||
if (totplan.sign() > 0)
|
||||
const real& sr=sched_receipts(nbucket);
|
||||
const real& ro=resched_orders(nbucket);
|
||||
const real& uo=unsched_orders(nbucket);
|
||||
const real& pl=planned_orders(nbucket);
|
||||
real totplan = pl - sr - ro + uo;
|
||||
if (totplan > ZERO)
|
||||
{
|
||||
for (int pivot = first; totplan.sign() > 0 && pivot <= last; pivot++) if (nbucket != pivot)
|
||||
{
|
||||
const real & sr=sched_receipts(pivot);
|
||||
const real & ro=resched_orders(pivot);
|
||||
const real & uo=unsched_orders(pivot);
|
||||
const real & pl=planned_orders(pivot);
|
||||
movable = sched_receipts(pivot);
|
||||
const real& srp=sched_receipts(pivot);
|
||||
const real& rop=resched_orders(pivot);
|
||||
const real& uop=unsched_orders(pivot);
|
||||
const real& plp=planned_orders(pivot);
|
||||
real movable = srp;
|
||||
// vecchia logica : posticipo solo se non devo poi ripianificare il pivot
|
||||
//if (nbucket > pivot)
|
||||
// nuova logica: posticipo o anticipo solo se non devo poi ripianificare il pivot
|
||||
movable -= planned_orders(pivot);
|
||||
movable -= unsched_orders(pivot);
|
||||
if (movable.sign() > 0) //
|
||||
movable -= plp;
|
||||
movable -= uop;
|
||||
if (movable > ZERO) //
|
||||
{
|
||||
first = pivot;
|
||||
diff = fnc_min(movable, totplan);
|
||||
const real diff = fnc_min(movable, totplan);
|
||||
add_unsched_ord(pivot, diff);
|
||||
add_resched_ord(nbucket, diff);
|
||||
totplan -= diff;
|
||||
@ -376,7 +370,7 @@ bool TMRP_line::find_ad_excepts(bool anticipi, bool posticipi, TExceptions_array
|
||||
some = TRUE;
|
||||
}
|
||||
}
|
||||
if (movable.sign() <= 0) //
|
||||
if (movable <= ZERO) //
|
||||
first++;
|
||||
} // ..look for available sched. receipts to move
|
||||
}
|
||||
@ -442,7 +436,7 @@ void TMRP_line::print_exception(int from, int to, const real &diff, int header)
|
||||
}
|
||||
if (header <= 1)
|
||||
{
|
||||
prow.put(format("Ordini emessi con scadenza entro il @41g%s", (const char *)fromdate.string()));
|
||||
prow.put(format("Ordini emessi con scadenza entro il @41g%s", (const char*)fromdate.string()));
|
||||
pr.print(prow);
|
||||
prow.reset();
|
||||
// stampa dettaglio ordini
|
||||
@ -453,22 +447,22 @@ void TMRP_line::print_exception(int from, int to, const real &diff, int header)
|
||||
{
|
||||
TMRP_docref & docref = docrefs->get_ref(nref);
|
||||
prow.put(format("@2gDocumento %s %4d n.%8ld riga %d %s %s",
|
||||
(const char *)docref.codnumdoc(),docref.annodoc(),docref.numdoc(),docref.numrig(),
|
||||
(const char *)docref.qta_residua().string(18,3),(const char *)docref.um()));
|
||||
(const char*)docref.codnumdoc(),docref.annodoc(),docref.numdoc(),docref.numrig(),
|
||||
(const char*)docref.qta_residua().stringa(18,3),(const char*)docref.um()));
|
||||
pr.print(prow);
|
||||
prow.reset();
|
||||
}
|
||||
}
|
||||
code.add("1");
|
||||
TString um =cache().get(LF_UMART,code).get("UM");
|
||||
real v = abs(diff);
|
||||
const TString16 um =cache().get(LF_UMART,code).get("UM");
|
||||
const real v = abs(diff);
|
||||
prow.put(format("@2g%s %s %s", (from == to) ?
|
||||
(diff.sign()>0 ? "Eliminare " : "Aggiungere " ):
|
||||
(from < to ? "Posticipare" : "Anticipare "),
|
||||
(const char *)v.string(18,3), (const char *)um));
|
||||
(const char*)v.stringa(18,3), (const char *)um));
|
||||
if (from != to)
|
||||
{
|
||||
prow.put(format("@38gal %s", (const char *)todate.string()));
|
||||
prow.put(format("@38gal %s", (const char*)todate.string()));
|
||||
}
|
||||
pr.print(prow);
|
||||
}
|
||||
|
@ -23,14 +23,10 @@ protected:
|
||||
|
||||
bool TMSP_app::create()
|
||||
{
|
||||
if (TSkeleton_application::create())
|
||||
{
|
||||
openfiles();
|
||||
_m = new TMSP_mask();
|
||||
_m->field(F_MSCHEDULEPLAN).set("X");
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
openfiles();
|
||||
_m = new TMSP_mask();
|
||||
_m->field(F_MSCHEDULEPLAN).set("X");
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
int mr2300(int argc, char* argv[])
|
||||
|
@ -506,12 +506,13 @@ int TMRP_calendar::set_turni(const TDate& data, int mini, int maxi)
|
||||
|
||||
int TMRP_calendar::add_oreuomo(real & var,const TDate& date, bool max)
|
||||
{
|
||||
int minuti = 0L;
|
||||
long minuti = 0L;
|
||||
const int tm = max ? turni_max(date) : turni_min(date);
|
||||
for (int t = tm-1; t >= 0; t--)
|
||||
minuti += _lungturno[t] * _persturno[t] ;
|
||||
var +=(minuti / 60 );
|
||||
return minuti / 60 ;
|
||||
minuti += _lungturno[t] * _persturno[t];
|
||||
const int ore = int(minuti / 60L);
|
||||
var += ore;
|
||||
return ore;
|
||||
}
|
||||
|
||||
int TMRP_calendar::add_oreuomo_max(real & var,const TDate& date)
|
||||
|
@ -203,7 +203,7 @@ void TStampa_ordini::filter_for_number()
|
||||
t.put(DOC_DATADOC, _to_date);
|
||||
filter_expr << " && (PROVV==\"" << _provv << "\")";
|
||||
if (_anno != 0)
|
||||
filter_expr << " && (ANNO==\"" << _anno << "\")";
|
||||
filter_expr << " && (ANNO==\"" << _anno << "\")";
|
||||
filter_expr << " && (CODNUM==\"" << _codnum << "\")";
|
||||
}
|
||||
cur->setregion(f,t);
|
||||
@ -464,15 +464,15 @@ void TStampa_ordini::filter_for_clifo_agent()
|
||||
f.put(DOC_CODNUM, _codnum);
|
||||
if (_anno != 0)
|
||||
{
|
||||
f.put(DOC_PROVV, _provv);
|
||||
f.put(DOC_ANNO, _anno);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.format("(PROVV==\"%c\")&&", _provv);
|
||||
f.put(DOC_PROVV, _provv);
|
||||
f.put(DOC_ANNO, _anno);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.format("(PROVV==\"%c\")&&", _provv);
|
||||
filter_expr << s;
|
||||
}
|
||||
|
||||
|
||||
t = f;
|
||||
cur->setregion(f,t); // This is the region...
|
||||
|
||||
@ -512,7 +512,6 @@ void TStampa_ordini::filter_for_clifo_agent()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Filtro sulla data ordine...
|
||||
if (_from_date.ok())
|
||||
{
|
||||
@ -756,15 +755,15 @@ void TStampa_ordini::filter_for_articolo()
|
||||
f.put(RDOC_CODART, _from_art);
|
||||
if (_anno != 0)
|
||||
{
|
||||
f.put(DOC_PROVV, _provv);
|
||||
f.put(DOC_ANNO, _anno);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.format("(PROVV==\"%c\") &&", _provv);
|
||||
f.put(DOC_PROVV, _provv);
|
||||
f.put(DOC_ANNO, _anno);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.format("(PROVV==\"%c\") &&", _provv);
|
||||
filter_expr << s;
|
||||
}
|
||||
|
||||
|
||||
t = f;
|
||||
t.put(RDOC_CODART, _to_art);
|
||||
cur->setkey(2); // Questa chiave rende piu' veloce la costruzione se indicato un range di articoli
|
||||
@ -974,18 +973,18 @@ void TStampa_ordini::main_loop()
|
||||
|
||||
switch (_tipo)
|
||||
{
|
||||
case clifo:
|
||||
form_name = "or1100b";
|
||||
break;
|
||||
case agente:
|
||||
form_name = "or1100c";
|
||||
break;
|
||||
case articolo:
|
||||
form_name = "or1100d";
|
||||
break;
|
||||
default:
|
||||
form_name = "or1100a";
|
||||
break;
|
||||
case clifo:
|
||||
form_name = "or1100b";
|
||||
break;
|
||||
case agente:
|
||||
form_name = "or1100c";
|
||||
break;
|
||||
case articolo:
|
||||
form_name = "or1100d";
|
||||
break;
|
||||
default:
|
||||
form_name = "or1100a";
|
||||
break;
|
||||
}
|
||||
|
||||
_frm = new TOrdine_form(form_name);
|
||||
@ -993,19 +992,18 @@ void TStampa_ordini::main_loop()
|
||||
// Selezione cursore & filtro
|
||||
switch (_tipo)
|
||||
{
|
||||
case clifo:
|
||||
case agente:
|
||||
filter_for_clifo_agent();
|
||||
break;
|
||||
case articolo:
|
||||
filter_for_articolo();
|
||||
break;
|
||||
default:
|
||||
filter_for_number();
|
||||
break;
|
||||
case clifo:
|
||||
case agente:
|
||||
filter_for_clifo_agent();
|
||||
break;
|
||||
case articolo:
|
||||
filter_for_articolo();
|
||||
break;
|
||||
default:
|
||||
filter_for_number();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
const int hh = 6;
|
||||
const int fl = printer().formlen();
|
||||
|
||||
|
@ -44,7 +44,7 @@ END
|
||||
NUMERO 4 32
|
||||
BEGIN
|
||||
KEY "Intestazione stampa"
|
||||
PROMPT 40 2 "Stampa ordini per numero/data"
|
||||
PROMPT 40 2 "@bStampa ordini per numero/data"
|
||||
END
|
||||
|
||||
END //HEADER
|
||||
@ -58,7 +58,7 @@ BEGIN
|
||||
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
|
||||
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
|
||||
KEY "Descrizione documento"
|
||||
PROMPT 1 1 "@B"
|
||||
PROMPT 1 1 ""
|
||||
MESSAGE _STREXPR,CODNUM+"/"+NDOC+" del "+DATADOC
|
||||
END
|
||||
|
||||
@ -216,8 +216,7 @@ SECTION DET 2 0 0 FILE LF_RIGHEDOC
|
||||
VALUTA 105 15
|
||||
BEGIN
|
||||
PROMPT 5 1 "" // valore
|
||||
FIELD LF_RIGHEDOC->RIGAVALORE
|
||||
MESSAGE ADD, FL->205
|
||||
MESSAGE _ORDINE,VALORE|ADD,FL->205
|
||||
DRIVENBY 103
|
||||
// PICTURE "."
|
||||
END
|
||||
@ -225,8 +224,7 @@ SECTION DET 2 0 0 FILE LF_RIGHEDOC
|
||||
VALUTA 106 15
|
||||
BEGIN
|
||||
PROMPT 6 1 "" // Val residuo riga
|
||||
FIELD LF_RIGHEDOC->RIGAVALRES
|
||||
MESSAGE ADD, FL->206
|
||||
MESSAGE _ORDINE,VALRES|ADD,FL->206
|
||||
DRIVENBY 103
|
||||
// PICTURE "."
|
||||
END
|
||||
@ -240,14 +238,14 @@ SECTION DET 2 0 0 FILE LF_RIGHEDOC
|
||||
NUMBER 108 15
|
||||
BEGIN
|
||||
PROMPT 8 1 "" // Q.ta Ordinata
|
||||
FIELD LF_RIGHEDOC->QTA
|
||||
MESSAGE _ORDINE,QTA
|
||||
PICTURE "########@,@@@@@"
|
||||
END
|
||||
|
||||
NUMBER 109 15
|
||||
BEGIN
|
||||
PROMPT 9 1 "" // Q.ta Evasa
|
||||
FIELD LF_RIGHEDOC->QTAEVASA
|
||||
MESSAGE _ORDINE,QTAEVASA
|
||||
PICTURE "########@,@@@@@"
|
||||
END
|
||||
|
||||
@ -309,7 +307,7 @@ SECTION DET 2 0 0 FILE LF_RIGHEDOC
|
||||
BEGIN
|
||||
KEY "Valore Ordinato"
|
||||
PROMPT 5 1 ""
|
||||
FIELD LF_RIGHEDOC->RIGAVALORE
|
||||
MESSAGE _ORDINE,VALORE
|
||||
// PICTURE "."
|
||||
DRIVENBY 303
|
||||
FLAGS "H"
|
||||
@ -318,7 +316,7 @@ SECTION DET 2 0 0 FILE LF_RIGHEDOC
|
||||
BEGIN
|
||||
KEY "Valore Residuo"
|
||||
PROMPT 6 1 ""
|
||||
FIELD LF_RIGHEDOC->RIGAVALRES
|
||||
MESSAGE _ORDINE,VALRES
|
||||
// PICTURE "."
|
||||
DRIVENBY 303
|
||||
FLAGS "H"
|
||||
@ -335,16 +333,14 @@ SECTION DET 2 0 0 FILE LF_RIGHEDOC
|
||||
BEGIN
|
||||
KEY "Q.ta Ordinata"
|
||||
PROMPT 8 1 ""
|
||||
FIELD LF_RIGHEDOC->QTA
|
||||
MESSAGE _ORDINE,CONVUM|ADD,408
|
||||
MESSAGE _ORDINE,QTA|_ORDINE,CONVUM|ADD,408
|
||||
FLAGS "H"
|
||||
END
|
||||
NUMBER 309 15
|
||||
BEGIN
|
||||
KEY "Q.ta Evasa"
|
||||
PROMPT 9 1 ""
|
||||
FIELD LF_RIGHEDOC->QTAEVASA
|
||||
MESSAGE _ORDINE,CONVUM|ADD,409
|
||||
MESSAGE _ORDINE,QTAEVASA|_ORDINE,CONVUM|ADD,409
|
||||
FLAGS "H"
|
||||
END
|
||||
VALUTA 310 13
|
||||
|
@ -46,7 +46,7 @@ END
|
||||
NUMERO 4 40
|
||||
BEGIN
|
||||
KEY "Intestazione stampa"
|
||||
PROMPT 40 2 "Stampa ordini per cliente/fornitore"
|
||||
PROMPT 40 2 "@bStampa ordini per cliente/fornitore"
|
||||
END
|
||||
|
||||
END //HEADER
|
||||
@ -248,14 +248,14 @@ SECTION DOCUMENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_CLIFO->TIPOCF+LF_CLIFO->CODCF+
|
||||
BEGIN
|
||||
KEY "Valore Ordinato"
|
||||
PROMPT 5 1 ""
|
||||
FIELD LF_RIGHEDOC->RIGAVALORE
|
||||
MESSAGE _ORDINE,VALORE
|
||||
DRIVENBY 203
|
||||
END
|
||||
VALUTA 206 15
|
||||
BEGIN
|
||||
KEY "Valore Residuo"
|
||||
PROMPT 6 1 ""
|
||||
FIELD LF_RIGHEDOC->RIGAVALRES
|
||||
MESSAGE _ORDINE,VALRES
|
||||
DRIVENBY 203
|
||||
END
|
||||
STRINGA 207 4
|
||||
@ -270,12 +270,13 @@ SECTION DOCUMENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_CLIFO->TIPOCF+LF_CLIFO->CODCF+
|
||||
PROMPT 8 1 ""
|
||||
FIELD LF_RIGHEDOC->QTA
|
||||
PICTURE "#@,@@@"
|
||||
|
||||
END
|
||||
NUMBER 209 13
|
||||
BEGIN
|
||||
KEY "Q.ta Evasa"
|
||||
PROMPT 9 1 ""
|
||||
FIELD LF_RIGHEDOC->QTAEVASA
|
||||
MESSAGE _ORDINE,QTAEVASA
|
||||
PICTURE "########@,@@@@@"
|
||||
END
|
||||
VALUTA 210 13
|
||||
@ -348,7 +349,7 @@ SECTION DOCUMENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_CLIFO->TIPOCF+LF_CLIFO->CODCF+
|
||||
FIELD LF_RIGHEDOC->RIGAVALRES
|
||||
DRIVENBY 303
|
||||
FLAGS "H"
|
||||
MESSAGE _ORDINE,VALTABLE,VALRES|ADD,406
|
||||
MESSAGE _ORDINE,VALRES|_ORDINE,VALTABLE,VALRES|ADD,406
|
||||
END
|
||||
STRINGA 307 4
|
||||
BEGIN
|
||||
@ -362,16 +363,14 @@ SECTION DOCUMENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_CLIFO->TIPOCF+LF_CLIFO->CODCF+
|
||||
BEGIN
|
||||
KEY "Q.ta Ordinata"
|
||||
PROMPT 8 1 ""
|
||||
FIELD LF_RIGHEDOC->QTA
|
||||
MESSAGE _ORDINE,CONVUM|ADD,408
|
||||
MESSAGE _ORDINE,QTA|_ORDINE,CONVUM|ADD,408
|
||||
FLAGS "H"
|
||||
END
|
||||
NUMBER 309 13
|
||||
BEGIN
|
||||
KEY "Q.ta Evasa"
|
||||
PROMPT 9 1 ""
|
||||
FIELD LF_RIGHEDOC->QTAEVASA
|
||||
MESSAGE _ORDINE,CONVUM|ADD,409
|
||||
MESSAGE _ORDINE,QTAEVASA|_ORDINE,CONVUM|ADD,409
|
||||
FLAGS "H"
|
||||
END
|
||||
VALUTA 310 13
|
||||
@ -646,4 +645,3 @@ END // Fine sezione totale in valuta #4
|
||||
|
||||
END // End of Body
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ END
|
||||
NUMERO 4 40
|
||||
BEGIN
|
||||
KEY "Intestazione stampa"
|
||||
PROMPT 40 2 "Stampa ordini per agente"
|
||||
PROMPT 40 2 "@bStampa ordini per agente"
|
||||
END
|
||||
|
||||
END //HEADER
|
||||
@ -248,7 +248,7 @@ SECTION AGENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_DOC->CODAG
|
||||
BEGIN
|
||||
KEY "Valore Ordinato"
|
||||
PROMPT 5 1 ""
|
||||
FIELD LF_RIGHEDOC->RIGAVALORE
|
||||
MESSAGE _ORDINE,VALORE
|
||||
DRIVENBY 203
|
||||
// PICTURE "."
|
||||
END
|
||||
@ -256,7 +256,7 @@ SECTION AGENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_DOC->CODAG
|
||||
BEGIN
|
||||
KEY "Valore Residuo"
|
||||
PROMPT 6 1 ""
|
||||
FIELD LF_RIGHEDOC->RIGAVALRES
|
||||
MESSAGE _ORDINE,VALRES
|
||||
DRIVENBY 203
|
||||
// PICTURE "."
|
||||
END
|
||||
@ -272,12 +272,13 @@ SECTION AGENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_DOC->CODAG
|
||||
PROMPT 8 1 ""
|
||||
FIELD LF_RIGHEDOC->QTA
|
||||
PICTURE "#@,@@@"
|
||||
|
||||
END
|
||||
NUMBER 209 13
|
||||
BEGIN
|
||||
KEY "Q.ta Evasa"
|
||||
PROMPT 9 1 ""
|
||||
FIELD LF_RIGHEDOC->QTAEVASA
|
||||
MESSAGE _ORDINE,QTAEVASA
|
||||
PICTURE "########@,@@@@@"
|
||||
END
|
||||
VALUTA 210 13
|
||||
@ -358,7 +359,7 @@ SECTION AGENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_DOC->CODAG
|
||||
FIELD LF_RIGHEDOC->RIGAVALRES
|
||||
DRIVENBY 303
|
||||
FLAGS "H"
|
||||
MESSAGE _ORDINE,VALTABLE,VALRES|ADD,406
|
||||
MESSAGE _ORDINE,VALRES|_ORDINE,VALTABLE,VALRES|ADD,406
|
||||
END
|
||||
STRINGA 307 4
|
||||
BEGIN
|
||||
@ -372,8 +373,7 @@ SECTION AGENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_DOC->CODAG
|
||||
BEGIN
|
||||
KEY "Q.ta Ordinata"
|
||||
PROMPT 8 1 ""
|
||||
FIELD LF_RIGHEDOC->QTA
|
||||
MESSAGE _ORDINE,CONVUM|ADD,408
|
||||
MESSAGE _ORDINE,QTA|_ORDINE,CONVUM|ADD,408
|
||||
FLAGS "H"
|
||||
END
|
||||
NUMBER 309 13
|
||||
@ -381,7 +381,7 @@ SECTION AGENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_DOC->CODAG
|
||||
KEY "Q.ta Evasa"
|
||||
PROMPT 9 1 ""
|
||||
FIELD LF_RIGHEDOC->QTAEVASA
|
||||
MESSAGE _ORDINE,CONVUM|ADD,409
|
||||
MESSAGE _ORDINE,QTAEVASA|_ORDINE,CONVUM|ADD,409
|
||||
FLAGS "H"
|
||||
END
|
||||
VALUTA 310 13
|
||||
@ -665,4 +665,3 @@ END // Fine sezione totale in valuta #4
|
||||
|
||||
END // End of Body
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ END
|
||||
NUMERO 4 40
|
||||
BEGIN
|
||||
KEY "Intestazione stampa"
|
||||
PROMPT 40 2 "Stampa ordini per articolo"
|
||||
PROMPT 40 2 "@bStampa ordini per articolo"
|
||||
END
|
||||
|
||||
END //HEADER
|
||||
@ -188,8 +188,7 @@ SECTION ARTICOLI 1 0 0 FILE LF_RIGHEDOC GROUP ANNO+NDOC+CODVAL+DATACONS
|
||||
BEGIN
|
||||
KEY "Valore Ordinato"
|
||||
PROMPT 5 1 ""
|
||||
FIELD LF_RIGHEDOC->RIGAVALORE
|
||||
MESSAGE _ORDINE,VALTABLE,VALORD|ADD,405
|
||||
MESSAGE _ORDINE,VALORE|_ORDINE,VALTABLE,VALORD|ADD,405
|
||||
DRIVENBY 303
|
||||
// PICTURE "."
|
||||
FLAGS "H"
|
||||
@ -198,11 +197,10 @@ SECTION ARTICOLI 1 0 0 FILE LF_RIGHEDOC GROUP ANNO+NDOC+CODVAL+DATACONS
|
||||
BEGIN
|
||||
KEY "Valore Residuo"
|
||||
PROMPT 6 1 ""
|
||||
FIELD LF_RIGHEDOC->RIGAVALRES
|
||||
// PICTURE "."
|
||||
DRIVENBY 303
|
||||
FLAGS "H"
|
||||
MESSAGE _ORDINE,VALTABLE,VALRES|ADD,406
|
||||
MESSAGE _ORDINE,VALRES|_ORDINE,VALTABLE,VALRES|ADD,406
|
||||
END
|
||||
STRINGA 307 4
|
||||
BEGIN
|
||||
@ -216,16 +214,14 @@ SECTION ARTICOLI 1 0 0 FILE LF_RIGHEDOC GROUP ANNO+NDOC+CODVAL+DATACONS
|
||||
BEGIN
|
||||
KEY "Q.ta Ordinata"
|
||||
PROMPT 8 1 ""
|
||||
FIELD LF_RIGHEDOC->QTA
|
||||
MESSAGE _ORDINE,CONVUM|ADD,408
|
||||
MESSAGE _ORDINE,QTA|_ORDINE,CONVUM|ADD,408
|
||||
FLAGS "H"
|
||||
END
|
||||
NUMBER 309 13
|
||||
BEGIN
|
||||
KEY "Q.ta Evasa"
|
||||
PROMPT 9 1 ""
|
||||
FIELD LF_RIGHEDOC->QTAEVASA
|
||||
MESSAGE _ORDINE,CONVUM|ADD,409
|
||||
MESSAGE _ORDINE,QTAEVASA|_ORDINE,CONVUM|ADD,409
|
||||
FLAGS "H"
|
||||
END
|
||||
VALUTA 310 13
|
||||
@ -391,7 +387,7 @@ FLAGS "D"
|
||||
KEY "Unitá di misura"
|
||||
PROMPT 7 1 ""
|
||||
END
|
||||
|
||||
|
||||
NUMERO 508 15 5
|
||||
BEGIN
|
||||
KEY "Tot Q.ta ordinata"
|
||||
|
@ -67,13 +67,12 @@ bool TOrdine_form::genera_intestazione_supplementare(pagetype p, short y)
|
||||
|
||||
bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
||||
{
|
||||
const TString code(s.get(0));
|
||||
|
||||
if (code == "_ORDINE")
|
||||
if (strcmp(s.get(0), "_ORDINE") == 0)
|
||||
{
|
||||
TLocalisamfile& doc = cf.form().cursor()->file(LF_DOC);
|
||||
// TLocalisamfile& doc = cf.form().cursor()->file(LF_DOC);
|
||||
TDocumento& doc = (TDocumento&)cf.form().cursor()->curr(LF_DOC);
|
||||
//TLocalisamfile& rdoc = cf.form().cursor()->file(LF_RIGHEDOC);
|
||||
TRiga_documento& rdoc = (TRiga_documento&) cf.form().cursor()->file(LF_RIGHEDOC).curr();
|
||||
TRiga_documento& rdoc = (TRiga_documento&)cf.form().cursor()->curr(LF_RIGHEDOC);
|
||||
// Add custom messages here
|
||||
// All the following messages takes 1 parameter: the field number to set
|
||||
TString action(s.get(1));
|
||||
@ -217,7 +216,7 @@ bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
||||
{
|
||||
i_id--;
|
||||
s_id.format("%d",i_id);
|
||||
cf.find_field(s_id).set("Totali");
|
||||
cf.find_field(s_id).set("@bTotali");
|
||||
}
|
||||
}
|
||||
const int sn = tv.secnum();
|
||||
@ -338,12 +337,28 @@ bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
||||
}
|
||||
// Ignore any other command
|
||||
}
|
||||
}
|
||||
else
|
||||
if (action == "PREZZONS")
|
||||
} else
|
||||
if (action == "PREZZONS")
|
||||
{
|
||||
real pns = rdoc.prezzo(TRUE,FALSE); // Prezzo netto scontato
|
||||
cf.set(pns.string());
|
||||
} else
|
||||
if (action == "RAGSOC")
|
||||
{
|
||||
// Compone la ragione sociale (considera gli occasionali)
|
||||
// Il formato è il seguente: CODICE (OCFPI) RAGIONE_SOCIALE
|
||||
TString ws;
|
||||
const bool print_cod = s.get_int(2);
|
||||
TDocumento& documento = (TDocumento&)cf.form().cursor()->curr(LF_DOC);
|
||||
TCli_for& cli_for = documento.clifor();
|
||||
TOccasionale& cli_occ = documento.occas();
|
||||
const bool occasionale = cli_for.occasionale();
|
||||
if (print_cod)
|
||||
ws << cli_for.get("CODCF") << " ";
|
||||
if (occasionale)
|
||||
{
|
||||
real pns = rdoc.prezzo(TRUE,FALSE); // Prezzo netto scontato
|
||||
cf.set(pns.string());
|
||||
ws << "(" << cli_occ.get("CFPI") << ") " ;
|
||||
ws << cli_occ.get("RAGSOC");
|
||||
}
|
||||
else
|
||||
if (action == "RAGSOC")
|
||||
@ -368,27 +383,43 @@ bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
||||
cf.set(ws);
|
||||
}
|
||||
else
|
||||
if (action == "RESIDUO")
|
||||
{
|
||||
real qres = rdoc.qtaresidua(); // Quantita' residua
|
||||
cf.set(qres.string());
|
||||
if (action == "QTA")
|
||||
{
|
||||
cf.set(rdoc.quantita().string());
|
||||
} else
|
||||
if (action == "QTAEVASA")
|
||||
{
|
||||
cf.set(rdoc.qtaevasa().string());
|
||||
} else
|
||||
if (action == "RESIDUO")
|
||||
{
|
||||
cf.set(rdoc.qtaresidua().string());
|
||||
} else
|
||||
if (action == "VALORE")
|
||||
{
|
||||
cf.set(rdoc.valore(TRUE, AUTO_DECIMALS).string());
|
||||
} else
|
||||
if (action == "VALRES")
|
||||
{
|
||||
cf.set(rdoc.valore(FALSE, AUTO_DECIMALS).string());
|
||||
} else
|
||||
if (action == "GIACENZA")
|
||||
{
|
||||
real g = ZERO;
|
||||
const TString& codart = rdoc.get(RDOC_CODARTMAG);
|
||||
if (codart.not_empty() && _art_giac->read(codart) == NOERR)
|
||||
{
|
||||
const TDate oggi(TODAY);
|
||||
TString16 annoes; annoes.format("%04d", _esercizi->date2esc(oggi));
|
||||
const TString16 codmag(rdoc.get("CODMAG")); // Riferito al magazzino indicato sulla riga...
|
||||
const TString16 livello(_level > 0 ? rdoc.get(RDOC_LIVELLO) : "");
|
||||
g = _art_giac->disponibilita(annoes, codmag, livello, TRUE); // Giacenza attuale
|
||||
}
|
||||
else
|
||||
if (action == "GIACENZA")
|
||||
{
|
||||
real g = ZERO;
|
||||
const TString& codart = rdoc.get(RDOC_CODARTMAG);
|
||||
if (codart.not_empty() && _art_giac->read(codart) == NOERR)
|
||||
{
|
||||
const TDate oggi(TODAY);
|
||||
TString16 annoes; annoes.format("%04d", _esercizi->date2esc(oggi));
|
||||
const TString16 codmag(rdoc.get("CODMAG")); // Riferito al magazzino indicato sulla riga...
|
||||
const TString16 livello(_level > 0 ? rdoc.get(RDOC_LIVELLO) : "");
|
||||
g = _art_giac->disponibilita(annoes, codmag, livello, TRUE); // Giacenza attuale
|
||||
}
|
||||
cf.set(g.string());
|
||||
}
|
||||
cf.set(g.string());
|
||||
}
|
||||
|
||||
//Ignore any other command
|
||||
return TRUE;
|
||||
}
|
||||
return TForm::validate(cf, s);
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
33
|
||||
0
|
||||
$doc|0|0|448|0|Documenti di vendita|NDOC*3||
|
||||
$doc|0|0|462|0|Documenti di vendita|NDOC*3||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user