Patch level : 2.2 no patch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Riportate le patch fino alla 172


git-svn-id: svn://10.65.10.50/trunk@12526 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2004-11-30 22:02:59 +00:00
parent 36b0e86e8b
commit 6fce3dd611
200 changed files with 5179 additions and 3856 deletions

View File

@ -1399,6 +1399,8 @@ HIDDEN bool study_handler(TMask_field& f, KEY k)
bool TMenu_application::choose_study()
{
disable_menu_item(MENU_ITEM(4));
TMask m(TR("Scelta studio"), 1, 62, 4);
m.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
@ -1419,6 +1421,9 @@ bool TMenu_application::choose_study()
else
stop_run(); // Termina applicazione
}
enable_menu_item(MENU_ITEM(4));
return ok;
}

View File

@ -318,7 +318,12 @@ bool TMenuitem::perform_program() const
const bool install_app = _action.starts_with("ba1 -6", TRUE);
if (install_app && sys_dll_changed())
dispatch_e_char(cur_win(), K_QUIT);
{
WINDOW w = cur_win();
if (w != NULL_WIN)
dispatch_e_char(w, K_QUIT);
}
printer_destroy(); // Forza rilettura parametri della stampante
}
@ -661,40 +666,39 @@ bool TMenu::can_be_transparent(const TImage& i) const
TImage& TMenu::image(const char* name)
{
TTimed_image* image = (TTimed_image*)_images.objptr(name);
if (image == NULL)
TTimed_image* img = (TTimed_image*)_images.objptr(name);
if (img == NULL)
{
TFilename realname;
const char* ext[3] = { "jpg", "gif", "bmp" };
for (int i = 0; i < 3; i++)
bool bFound = false;
for (int i = 0; i < 3 && !bFound; i++)
{
realname = name;
realname << '.' << ext[i];
realname.custom_path();
if (realname.exist())
break;
realname.ext(ext[i]);
bFound = realname.custom_path();
}
if (realname.exist())
if (bFound)
{
if (_images.items() == 0)
_default_bmp = name; // Store default bitmap name
image = new TTimed_image(realname);
if (can_be_transparent(*image))
image->convert_transparent_color(MASK_BACK_COLOR);
_images.add(name, image);
img = new TTimed_image(realname);
if (can_be_transparent(*img))
img->convert_transparent_color(MASK_BACK_COLOR);
_images.add(name, img);
}
else
{
image = (TTimed_image*)_images.objptr(_default_bmp);
if (image == NULL)
img = (TTimed_image*)&image(_default_bmp);
if (img == NULL)
fatal_box(FR("Impossibile trovare l'immagine %s"), (const char*)_default_bmp);
}
if (_images.items() > 3)
{
TString worst_bmp;
clock_t worst_time = image->touch(); // Impedisco di cancellare la prossima
clock_t worst_time = img->touch(); // Impedisco di cancellare la prossima
_images.restart();
for (THash_object* o = _images.get_hashobj(); o; o = _images.get_hashobj())
{
@ -711,8 +715,8 @@ TImage& TMenu::image(const char* name)
_images.remove(worst_bmp);
}
}
image->touch();
return *image;
img->touch();
return *img;
}
void TMenu::reload_images()

View File

@ -7,25 +7,25 @@ int main(int argc, char** argv)
switch (r)
{
case 1:
ba3200(argc,argv); break; //Stampa tabelle
ba3200(argc,argv); break;
case 2:
ba3300(argc,argv); break; //Stampa fogli libri bollati
ba3300(argc,argv); break;
case 3:
ba3400(argc,argv); break; //Programma di test per le maschere
ba3400(argc,argv); break;
case 4:
ba3500(argc,argv); break; //Tabelle libro unico
ba3500(argc,argv); break;
case 5:
ba3600(argc,argv); break; //Stampa indici libro unico
ba3600(argc,argv); break;
case 6:
ba3700(argc,argv); break; //Condizioni di pagamento
ba3700(argc,argv); break;
case 7:
ba3800(argc,argv); break; //Stampa tabelle IV direttiva CEE
ba3800(argc,argv); break;
case 8:
ba3900(argc,argv); break; //Gestione indici libro unico
ba3900(argc,argv); break;
case 9:
ba3a00(argc,argv); break; //Stampa condizioni di pagamento
ba3a00(argc,argv); break;
default:
ba3100(argc,argv); break; //Gestione tabelle
ba3100(argc,argv); break;
}
exit(0);
return 0;

View File

@ -12,6 +12,7 @@
#include "batbdel.h"
#include "batbval.h"
#include "batbver.h"
#include "batbnoc.h"
#include "batbnot.h"
#define REG_JOURNAL 5
@ -22,8 +23,8 @@
#define TAB_REGISTRI "REG"
#define TAB_VALUTE "%VAL"
#define TAB_VERSAMENTI "%VER"
// #define TAB_MAGAZZINI "MAG" // Spostato in mg0 -0
#define TAB_GRMERC "GMC"
#define TAB_NOMENCOMB "%NOC"
#define TAB_NOTECLI "%NOT"
class TGeneric_table_app : public TTable_application
@ -55,6 +56,7 @@ protected:
static bool codcab_handler(TMask_field& f, KEY k);
static bool codmag_handler(TMask_field& f, KEY k);
static bool codgmc_handler(TMask_field& f, KEY k);
static bool codnoc_handler(TMask_field& f, KEY k);
static bool desnot_handler(TMask_field& f, KEY k);
void fragment_string();
@ -587,6 +589,18 @@ bool TGeneric_table_app::codgmc_handler(TMask_field& f, KEY k)
return TRUE;
}
bool TGeneric_table_app::codnoc_handler(TMask_field& f, KEY k)
{
if (f.to_check(k))
{
TString8 str; str << atoi(f.get());
if (str.len() < f.size())
str.right_just(f.size(), '0');
f.set(str);
}
return true;
}
bool TGeneric_table_app::desnot_handler(TMask_field& f, KEY k)
{
if (k == K_ENTER)
@ -639,12 +653,12 @@ bool TGeneric_table_app::user_create()
if (name == TAB_BANCHE)
mask.set_handler(102, codcab_handler);
// if (name == TAB_MAGAZZINI) // Spostato in mg0 -0
// mask.set_handler(101, codmag_handler);
if (name == TAB_GRMERC)
mask.set_handler(101, codgmc_handler);
if (name == TAB_NOMENCOMB)
mask.set_handler(NOC_CODICE2, codnoc_handler);
if (name == TAB_NOTECLI)
mask.set_handler(F_NOT_DESC, desnot_handler);
}

View File

@ -1,107 +1,531 @@
//Programma per stampa report tabelle
// ba3200 Stampa tabelle
//
// legge un file con estensione .rpt che descrive la stampa.
// Vedi file leggimi.txt per il formato del file
//
#include <applicat.h>
#include <relation.h>
#include <reprint.h>
#include <mask.h>
#include <printapp.h>
#include <tabutil.h>
#include <utility.h>
///////////////////////////////////////////////////////////
// TTable_report
///////////////////////////////////////////////////////////
#include <nditte.h>
class TTable_report : public TReport
#include "ba3.h"
#include "ba3200.h"
#define FOOTER_LEN 4 // se non ridefinito nel .rpt
class BA3200_application : public TPrintapp
{
TString _tabname;
TFilename _rptname;
TScanner *_rpt;
TFilename _maskname;
TMask *_msk;
TRelation *_rel;
TCursor *_cur;
int _logicnum;
TString_array _string_roman, _string_compound;
TString_array _field_roman, _field_compound;
bool _stampa_registri;
bool _stampa_ca7; //tabella causali 770
bool _tabella_comune;
protected:
virtual bool execute_prescript();
TString& get_rpt_name(TString& t) const;
TString& get_mask_name(TString& t) const;
void destroy_objects();
public:
virtual bool user_create() ;
virtual bool user_destroy() ;
virtual bool set_print(int) ;
virtual void set_page(int, int);
virtual bool preprocess_page (int, int);
virtual bool preprocess_print(int file, int counter);
void set_headers();
void set_rows();
void set_footers();
void set_translations();
void set_relations();
BA3200_application(): _rpt(NULL), _msk(NULL), _rel(NULL), _cur(NULL) {}
virtual ~BA3200_application() {}
};
bool TTable_report::execute_prescript()
TString& BA3200_application::get_mask_name(TString& t) const
{
TFilename msk = filename().name();
msk.ext(""); msk.lower();
TMask m(msk);
CHECK(_rel,"Can't use a NULL relation to retrieve table module");
TTable& tab = (TTable&) _rel->lfile(_tabname);
TString8 m = _tabname;
if (m[0] == '%')
m.ltrim(1);
const bool ok = m.run() == K_ENTER;
if (ok)
t = tab.module();
t << "st" << m;
t.upper();
return t;
}
TString& BA3200_application::get_rpt_name(TString& t) const
{
CHECK(_rel,"Can't use a NULL relation to retrieve table module");
TTable& tab = (TTable&) _rel->lfile(_tabname);
TString16 m = _tabname;
if (m[0] == '%') m.ltrim(1);
t = tab.module();
t << "tb" << m;
t.upper();
return t;
}
bool BA3200_application::set_print(int)
{
TRectype from(_rel->lfile().curr()); from.zero();
TRectype to (from);
if (_msk->run() == K_ENTER)
{
TRectype rec_fr(LF_TAB), rec_to(LF_TAB);
for (int i = 0; i < m.fields(); i++)
const int campi_maschera = _msk->fields();
for (int i = 0; i < campi_maschera; i++)
{
const TMask_field& fld = m.fld(i);
const TFieldref* fr = fld.field();
if (fr != NULL)
const TMask_field& campo_maschera = _msk->fld(i);
const char* val = campo_maschera.get();
if (*val)
{
if (fld.in_group(1))
fr->write(fld.get(), rec_fr);
if (fld.in_group(2))
fr->write(fld.get(), rec_to);
const TFieldref* campo_ref = campo_maschera.field();
if (campo_ref != NULL && campo_ref->ok())
{
TDate d;
const bool is_date_field = campo_maschera.class_id() == CLASS_DATE_FIELD;
if (is_date_field)
d=val;
if (campo_maschera.in_group(1)) campo_ref->write(is_date_field ? d.string(ANSI) : val, from);
else
if (campo_maschera.in_group(2)) campo_ref->write(is_date_field ? d.string(ANSI) : val, to);
}
}
}
TString use = recordset()->query_text();
const TString& cod_fr = rec_fr.get("CODTAB");
if (cod_fr.not_empty())
use << "\nFROM CODTAB='" << cod_fr << '\'';
_cur->setregion (from, to);
const TString& cod_to = rec_to.get("CODTAB");
if (cod_to.not_empty())
use << "\nTO CODTAB='" << cod_to << '\'';
set_headers();
return TRUE;
}
return FALSE;
}
set_recordset(use);
void BA3200_application::set_page (int , int )
{
_string_roman.destroy();
_field_roman.destroy();
_string_compound.destroy();
_field_compound.destroy();
set_rows();
}
bool BA3200_application::preprocess_page(int , int)
{
const int items = _field_roman.items();
if (items > 0)
{
for (int i = 0; i < items; i++)
{
TString& fn = _field_roman.row(i);
TFieldref fld(fn, 0);
TString& s = _string_roman.row(i);
const int n = atoi(fld.read(*_rel));
s = itor(n);
}
}
const int compound = _field_compound.items();
if (compound > 0)
// Scorre le righe settate
for (int i = 0; i < compound; i++)
{
TToken_string f(_field_compound.row(i),'+'); // campo composto
TString& s = _string_compound.row(i); // riga da stampare
s.cut(0); // Reset the row...
bool compile_row = TRUE;
const int cmp_items = f.items();
// Scorre gli elementi della riga
for (int j = 0; j < cmp_items; j++)
{
// compone la stringa totale
TString xx(f.get(j));
if (xx[0] != '"') // se non e' una costante stringa legge il valore
{
TFieldref fld(xx,0);
xx = fld.read(*_rel);
if (xx.empty()) compile_row = FALSE;
else compile_row = TRUE;
}
else
{
xx.ltrim(1);xx.rtrim(1);
}
if (compile_row)
s << xx; // appende alla stringa il valore ricavato (se il campo e' vuoto non appende nemmeno la stringa fissa)
}
}
// Stampa tabella registri. Calcolo: pagine residue = pagine - stampate
if (_stampa_registri)
{
const int pagine = _cur->file().get_int("I2");
const int stampate = _cur->file().get_int("I1");
const int residue = pagine - stampate;
if (residue > 0)
set_row(1, "@126g%4d", residue);
else
set_row(1, "@126g%4s", " ");
}
return TRUE;
}
void BA3200_application::set_headers()
{
TString NomeTabella, sep, formato_intesta, testo_intesta;
int LungRiga, riga_intesta=0, last_riga=1;
TToken_string line;
TString256 riga;
reset_header ();
_rpt->paragraph("Headers");
// Leggo la lunghezza della riga (usata per centrare l'intestazione)
line = _rpt->line();
LungRiga = line.get_int();
riga.spaces(LungRiga);
// Senno' nella stampa a 80 non ci sta ditta e data
// Leggo il nome della tabella
line = _rpt->line();
NomeTabella = line.get();
// Sulla prima riga di intestazione metto la ditta, la data e la pagina
if (!_tabella_comune)
{
const long codditta = get_firm();
TString80 ragsoc;
TLocalisamfile nditte(LF_NDITTE);
nditte.zero();
nditte.put(NDT_CODDITTA, codditta);
if (nditte.read() == NOERR)
{
ragsoc = nditte.get(NDT_RAGSOC);
if (LungRiga < 100) ragsoc.cut(40);
}
riga.overwrite(format(FR("Ditta %4ld %s"), codditta,(const char *)ragsoc));
}
if (_stampa_ca7)
{
TDate d (_msk->get(F_DATASTAMPA));
printer().setdate(d);
}
riga.overwrite (FR("Data @> Pag. @#"), riga.len()-25);
set_header (last_riga++, "%s", (const char *)riga);
// Centro il nome della tabella
// Per la stampa registri non va centrato.
// Lo lascio anche per le altre stampe
// if (_stampa_registri)
NomeTabella.left_just (LungRiga);
/* else
NomeTabella.center_just (LungRiga); */
if (_stampa_ca7)
NomeTabella.center_just (LungRiga);
set_header (last_riga++, "@b%s", (const char *)NomeTabella);
// Aggiungo una riga vuota per separare prima intestazione
//sep.fill ('-', LungRiga);
//set_header (last_riga, "%s", (const char *)sep);
line = _rpt->line();
while ( (line != "") && (line[0] != '[') )
{
riga_intesta = atoi (line.get());
formato_intesta = line.get();
testo_intesta = (const char *) line.get();
if (riga_intesta)
set_header (last_riga+riga_intesta, (const char *)formato_intesta,
(const char *)testo_intesta);
line = _rpt->line();
}
if (riga_intesta) last_riga += riga_intesta;
last_riga++;
//set_header (last_riga, (const char *)sep);
sep.fill(' ');
set_header (last_riga, (const char *)sep);
set_background(format("W2l{1,3,%d,3}l{1,%d,%d,%d}", LungRiga, last_riga, LungRiga, last_riga));
}
void BA3200_application::set_rows()
{
TToken_string line;
TFieldref campo;
int from = 0, to= 0,riga_record;
TString formato_campo, picture;
const char * name = "";
_rpt->paragraph("Rows");
line = _rpt->line();
while ( (line != "") && (line[0] != '[') )
{
riga_record = line.get_int();
TString s(line.get());
int logicnum = _logicnum;
const bool is_compound = s.find('+') >= 0; // Controlla se e' una stringa composta (usare #t nel formato)
if (!is_compound)
{
campo = s;
from = campo.from();
to = campo.to();
name = campo.name();
if (campo.file() != 0)
logicnum = campo.file();
}
formato_campo = line.get();
formato_campo.trim();
formato_campo.lower();
const int p = formato_campo.find("@m");
if (p != -1 && !is_compound)
{
formato_campo.cut(p);
formato_campo << "#t";
_string_roman.add("");
_field_roman.add(s);
const int last = _string_roman.items() - 1;
set_row (riga_record, formato_campo, _string_roman.objptr(last));
}
else if (!is_compound)
{
if (formato_campo.find("@pn") >= 0)
picture = line.get();
else
picture = "";
if (to == -1)
if (picture != "")
set_row (riga_record, formato_campo, FLD(logicnum,name,picture) );
else
set_row (riga_record, formato_campo, FLD(logicnum,name) );
else
set_row (riga_record, formato_campo, FLD(logicnum,name,from,to) );
}
else
{
_string_compound.add("");
_field_compound.add(s);
const int last = _string_compound.items() - 1;
//versione speciale per la stampa della tabella Note clienti!
if (_tabname == "%NOT")
{
//deve costruire la stampa tenendo conto anche dei return
TString stringone;
TRectype& rec = current_cursor()->curr();
TString4 fieldname;
for (int i = 0; i < 6; i++)
{
fieldname.format("S%d", i);
stringone << rec.get(fieldname);
}
stringone.replace((char)0xB6, '\n');
TParagraph_string para(stringone, 75);
for (int r = 0; r < para.items(); r++)
set_row(riga_record + r, "@3g%s", para.get());
//mette a TRUE la variabile _force_setpage delle printapp in modo da richiamare la set_rows() ad ogni cambio record
force_setpage();
}
else
set_row (riga_record, formato_campo, _string_compound.objptr(last));
}
line = (const char *) _rpt->line();
}
}
void BA3200_application::set_footers()
{
TToken_string line;
int footer_len, riga;
TString formato, testo;
reset_footer();
_rpt->paragraph("Footers");
line = _rpt->line();
footer_len = line.get_int();
if (footer_len != 0)
{
printer().footerlen(footer_len);
line = _rpt->line();
}
while ( (line != "") && (line[0] != '[') )
{
riga = line.get_int();
formato = line.get();
testo = line.get();
set_footer (riga, (const char *)formato, (const char*)testo);
line = _rpt->line();
}
}
void BA3200_application::set_translations()
{
TString campo, from, to;
TToken_string line;
int logicnum;
_rpt->paragraph("Translations");
line = _rpt->line();
while ( (line != "") && (line[0] != '[') )
{
logicnum = line.get_int();
campo = line.get();
from = line.get();
to = line.get();
set_translation (logicnum, (char*)(const char *)campo, (char*)(const char *)from, (char*)(const char *)to);
line = _rpt->line();
}
}
void BA3200_application::set_relations()
{
TToken_string line("", ';');
TString tab(16), expr(40);
int key, linkto, alias, logicnum;
_rpt->paragraph("Relations");
line = _rpt->line();
while ( (line != "") && (line[0] != '[') )
{
tab = line.get();
logicnum = atoi(tab);
expr = line.get();
key = line.get_int();
if (key == 0) key = 1;
linkto = line.get_int();
alias = line.get_int();
if (logicnum > 0)
_rel->add(logicnum, expr, key, linkto, alias);
else
_rel->add(tab, expr, key, linkto, alias);
line = _rpt->line();
}
}
bool BA3200_application::user_create()
{
bool ok=TRUE;
_tabname = argv(2);
_tabname.upper();
_tabella_comune = (_tabname[0] == '%');
// Flag per la stampa tabella registri
_stampa_registri = (_tabname == "REG");
_stampa_ca7 = (_tabname == "%CA7");
_rel = new TRelation (_tabname);
_cur = new TCursor (_rel);
TString16 t;
t = _tabname.right(3);
_maskname << get_mask_name(t) << ".msk";
if (!_maskname.exist())
ok = error_box(FR("Impossibile aprire la maschera di stampa %s"), (const char *)_maskname);
else
_msk = new TMask (_maskname) ;
if (ok)
{
t = _tabname.right(3);
_rptname << get_rpt_name(t) << ".rpt" ;
if (!_rptname.exist())
ok = error_box(FR("Impossibile aprire il report di stampa %s"), (const char *)_rptname);
else
{
_rpt = new TScanner(_rptname);
add_cursor (_cur);
add_file (_tabname);
_logicnum = _cur->file().num();
reset_print ();
printer().footerlen (FOOTER_LEN);
for (int i=1; i <= FOOTER_LEN; i++) set_footer(i, "%s", " ");
#ifdef DBG1
set_fillchar ('.');
#endif
set_relations();
}
}
if (!ok)
destroy_objects() ;
return ok;
}
///////////////////////////////////////////////////////////
// TTable_reporter
///////////////////////////////////////////////////////////
class TTable_reporter : public TSkeleton_application
{
protected:
virtual void main_loop();
public:
bool get_rpt_name(TFilename& rptname) const;
};
bool TTable_reporter::get_rpt_name(TFilename& rptname) const
bool BA3200_application::preprocess_print(int file, int counter)
{
TTable tab(argv(2));
rptname = tab.module();
rptname << "st" << tab.get("COD");
rptname.ext("rep");
rptname.lower();
set_headers();
set_footers();
set_translations();
return TRUE;
}
return rptname.custom_path();
void BA3200_application::destroy_objects()
{
if (_msk) delete _msk;
// if (_cur) delete _cur; // Deleted by printapp!
if (_rel) delete _rel;
}
void TTable_reporter::main_loop()
bool BA3200_application::user_destroy()
{
TFilename rptname;
if (get_rpt_name(rptname))
{
while (true)
{
TTable_report rep; rep.load(rptname);
TReport_book book;
if (book.add(rep))
book.print_or_preview();
else
break;
}
}
else
error_box(FR("Manca il file %s"), (const char *)rptname);
destroy_objects() ;
return TRUE;
}
int ba3200(int argc, char* argv[])
{
TTable_reporter app;
app.run(argc, argv, TR("Stampa Report Tabelle"));
{
BA3200_application a;
a.run(argc, argv, TR("Stampa tabella"));
return 0;
}
}

View File

@ -8,9 +8,9 @@ int main(int argc,char** argv)
switch (r)
{
case 1:
ba4200(argc,argv) ; break;
ba4200(argc,argv) ; break; //Anagrafica persone fisiche e giuridiche
case 2:
ba4300(argc,argv) ; break;
ba4300(argc,argv) ; break; //Ditte
case 3:
ba4400(argc,argv) ; break;
case 4:
@ -18,7 +18,7 @@ int main(int argc,char** argv)
case 5:
ba4600(argc,argv) ; break;
default:
ba4100(argc,argv) ; break;
ba4100(argc,argv) ; break; //Tabella Comuni
break;
}
exit(0);

View File

@ -206,6 +206,27 @@ bool TTable_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
if (e == se_query_add || e == se_query_del)
return false;
break;
case F_FLD_TO:
if (e == fe_button)
{
const int logicnum = son_logicnum();
if (logicnum >= LF_USER)
{
TArray_sheet sheet(-1, -1, 24, 20, TR("Selezione"), HR("Nome@12|Lunghezza"));
const RecDes& rd = prefix().get_recdes(logicnum);
TToken_string row;
for (int i = 0; i < rd.NFields; i++)
{
row = rd.Fd[i].Name;
row.add(rd.Fd[i].Len);
sheet.add(row);
}
sheet.rows_array().sort();
if (sheet.run() == K_ENTER)
o.set(sheet.row(-1).get(0));
}
}
break;
default:
break;
}
@ -283,6 +304,8 @@ protected:
void add_field_to_sheet(const char* fld, bool update);
void add_field_to_sheet(bool update = true);
void add_asterisk_to_sheet();
bool ask_vars(const char* maskname, TRecordset& recset) const;
TRecordset* new_recordset() const;
bool edit_file_in_tree();
static int sort_fields(const TObject** r1, const TObject** r2);
@ -295,7 +318,6 @@ protected:
void tree2isam(TString_array& a);
void sheet2sql();
void sheet2isam();
void edit_query();
bool select_query();
bool load_tables_tree(TXmlItem& tables);
@ -305,9 +327,10 @@ protected:
bool save_tables_tree(TXmlItem& xml);
bool save_fields_sheet(TXmlItem& xml);
public:
void edit_query();
void save_as(TRecordsetExportFormat fmt);
public:
bool load_query();
bool save_query();
bool save_if_needed();
@ -599,7 +622,9 @@ static bool sql_tree_handler(TTree& tree, void* jolly, word flags)
if (from.get_pos(rn->id()) < 0)
{
from.add(rn->id());
from.add(rn->name());
if (rn->alias().not_empty())
from << " AS " << rn->alias();
FOR_EACH_ARRAY_ROW(join, i, row)
{
@ -695,8 +720,12 @@ void TQuery_mask::sheet2sql()
{
if (multiple)
{
field.insert(".");
field.insert(row->get(0)); // Table name
const TString& tab = row->get(0);
if (!tab.blank())
{
field.insert(".");
field.insert(tab); // Table name
}
}
select.add(field); // Column name only
@ -709,12 +738,12 @@ void TQuery_mask::sheet2sql()
expr_to = row->get(6); expr_to.trim();
if (expr_from.not_empty() || expr_to.not_empty())
{
if (expr_from.not_empty() && expr_from[0] != '\'' && !isdigit(expr_from[0]))
if (expr_from.not_empty() && isalpha(expr_from[0]))
{
expr_from.insert("'");
expr_from << '\'';
}
if (expr_to.not_empty() && expr_to[0] != '\'' && !isdigit(expr_to[0]))
if (expr_to.not_empty() && isalpha(expr_to[0]))
{
expr_to.insert("'");
expr_to << '\'';
@ -771,30 +800,108 @@ void TQuery_mask::sheet2isam()
fs.set_focusdirty(false); // Evita di scatenare eventi inutili
}
void TQuery_mask::edit_query()
bool TQuery_mask::ask_vars(const char* maskname, TRecordset& recset) const
{
if (recset.variables().items() == 0)
return true;
TFilename fname = maskname; fname.ext("msk");
KEY key = K_QUIT;
if (!fname.custom_path())
return recset.ask_variables(true);
TMask m(maskname);
TVariant var;
for (int i = m.fields()-1; i >= 0; i--)
{
TMask_field& f = m.fld(i);
const TFieldref* ref = f.field();
if (ref != NULL)
{
TString name = ref->name();
if (name[0] != '#')
name.insert("#");
const TVariant& var = recset.get_var(name);
if (!var.is_null())
f.set(var.as_string());
}
}
key = m.run();
const bool ok = key != K_QUIT && key != K_ESC;
if (ok)
{
// Rendi visibili tutte le variabili utente al report
for (int i = m.fields()-1; i >= 0; i--)
{
TMask_field& f = m.fld(i);
const TFieldref* ref = f.field();
if (ref != NULL)
{
switch (f.class_id())
{
case CLASS_CURRENCY_FIELD:
case CLASS_REAL_FIELD:
var = real(f.get());
break;
case CLASS_DATE_FIELD:
var = TDate(f.get());
break;
default:
var = f.get();
break;
}
TString name = ref->name();
if (name[0] != '#')
name.insert("#");
recset.set_var(name, var, true);
}
}
}
return ok;
}
TRecordset* TQuery_mask::new_recordset() const
{
const TString& sql = get(F_SQL);
TRecordset* rex = NULL;
if (sql.starts_with("SELECT "))
rex = new TSQL_recordset(sql);
else
rex = new TISAM_recordset(sql);
if (rex->columns() > 0)
if (!ask_vars(get(F_CODICE), *rex))
{
delete rex;
rex = NULL;
}
if (rex != NULL && rex->columns() == 0)
{
warning_box(TR("Nessuna riga risultato"));
delete rex;
rex = NULL;
}
return rex;
}
void TQuery_mask::edit_query()
{
TRecordset* rex = new_recordset();
if (rex != NULL)
{
TRecordset_sheet sht(*rex);
sht.run();
delete rex;
}
else
warning_box(TR("Nessuna riga risultato"));
delete rex;
}
void TQuery_mask::save_as(TRecordsetExportFormat fmt)
{
TRecordset* rex = new_recordset();
if (rex == NULL)
return;
xvt_fsys_save_dir();
TFilename path; path.tempdir();
@ -818,24 +925,11 @@ void TQuery_mask::save_as(TRecordsetExportFormat fmt)
{
xvt_fsys_convert_dir_to_str(&fs.dir, path.get_buffer(), path.size());
path.add(fs.name);
const TString& sql = get(F_SQL);
TRecordset* rex = NULL;
if (sql.starts_with("SELECT "))
rex = new TSQL_recordset(sql);
else
rex = new TISAM_recordset(sql);
bool ok = rex->items() > 0;
if (ok)
{
ok = rex->save_as(path, fmt);
if (ok)
xvt_sys_goto_url(path, "open");
}
delete rex;
if (rex->save_as(path, fmt))
xvt_sys_goto_url(path, "open");
}
delete rex;
}
bool TQuery_mask::get_qry_path(TFilename& path) const
@ -1342,6 +1436,37 @@ bool TSQL_recordset_app::create()
_msk = new TQuery_mask;
xvt_sys_sleep(500); // Lasciamo il tempo di leggere il titolo
if (argc() > 2)
{
_msk->set(F_CODICE, argv(2));
_msk->load_query();
if (argc() > 3)
switch (argv(3)[0])
{
case 'H' :
_msk->save_as(fmt_html);
break;
case 'T' :
_msk->save_as(fmt_text);
break;
case 'X' :
_msk->save_as(fmt_silk);
break;
case 'C' :
_msk->save_as(fmt_campo);
break;
default :
_msk->save_as(fmt_html);
break;
}
else
_msk->edit_query();
return FALSE;
}
return TSkeleton_application::create();
}

View File

@ -17,6 +17,9 @@
#define F_MOVEUP 401
#define F_MOVEDN 402
#define F_FLD_FROM 101
#define F_FLD_TO 102
#define F_FATHER 201
#define F_FATHER_ALIAS 202
#define F_SON 203

View File

@ -1,21 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Generatore Query</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--<link rel="stylesheet" href="./stili/stile_l.css">-->
</head>
<!-- frames -->
<frameset rows="80,*" border="0">
<frame name="uno" src="ba8200a_alto.html" frameborder="no" noresize>
<frame name="due" src="ba8200a_corpo.html" frameborder="no" noresize>
</frameset>
<body>
</body>
</html>

View File

@ -110,6 +110,7 @@ BEGIN
ITEM "Grp.@3"
ITEM "Da@30"
ITEM "A@30"
FL "|"
END
BUTTON F_MOVEUP 2 2
@ -216,7 +217,6 @@ PAGE "CampiQuery" -1 -1 60 13
STRING 101 12
BEGIN
PROMPT 1 0 "Tabella "
CHECKTYPE REQUIRED
END
STRING 102 50

View File

@ -1,62 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Generatore Query</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../stili/stile_p.css">
</head>
<script>
function apri(lnk){
window.open(lnk,'','top=10, left=10, width=500, height=600, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no');
}
</script>
<body marginwidth="0" marginheight="0" topmargin="3" leftmargin="5" class="bodyframe">
<!-- Tabella contenitore principale -->
<table border="0" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<!-- Tabella titolo principale -->
<table border="0" align="center" width="100%" cellpadding="0" cellspacing="0">
<!-- <tr><td class="titolo1" colspan="2"><a href="../index.html" target="_new"><img src=../images/home.jpg border=0 alt=Home page></a>&nbsp;&nbsp;Zone</td></tr>-->
<tr><td class="titolo1" colspan="2"><a href="../index.html" target="_new"><img src=../images/home.jpg border=0 alt=Home page></a>Generatore Query</td></tr>
<!-- <tr><td><br></td></tr>-->
<tr>
<td>
<table border="0" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="30"></td>
<td align="left">
<!--<a href="ba8200a_corpo.html#uno" target="due"><img src="./images/pagina1.gif" border="0"></a><a href="ba4100a_corpo.html#due" target="due"><img src="./images/pagina2.gif" border="0"></a><a href="ba8200a_corpo.html#tre" target="due"><img src="./images/pagina3.gif" border="0"></a></td>-->
</tr>
</table>
</td>
<!--
</tr>
<tr>
-->
<td>
<table border="0" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="right"><a href="#" onclick="return apri('../pages/tastiera.html');"><img src="../images/tastiera.gif" border="0"></a></td>
<td align="right" width="35"><a href="#" onclick="return apri('../pages/mouse.html');"><img src="../images/mouse.gif" border="0"></a></td>
<td width="60"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@ -1,34 +0,0 @@
<html>
<head>
<title>Generatore Query</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../stili/stile_p.css">
</head>
<body bgcolor="#ffffff" leftmargin="5">
<div align="justify">
<h2>Introduzione</h2>
<p>
Questa applicazione permette di generare <a href="ba8200sql.html#select">query sql</a> sul database di campo, visualizzare
i risultati delle medesime ed esportarli in vari formati.<br/>
Le query possono essere salvate per poter essere riutilizzate in un momento
successivo oppure per essere collegate al programma <a href="ba8300a.html" target="_parent">generatore di report</a>.
</p>
<h2>Come iniziare</h2>
<p>
Vogliamo realizzare una query esemplificativa che visualizzi il cosiddetto "mastrino" del conto 1.1.1.
In altre parole vogliamo selezionare dalle righe dei movimenti contabili tutte quelle che contengono il conto desiderato.
<p><b>Assegnazione del nome - </b>
Come prima cosa dobbiamo assegnare un nome ed una descrizione alla nostra query, scrivendoli nelle prime due caselle di testo in alto,
ad esempio: "ProvaMastrino" e "Mastrino di prova del conto 1.1.1"</p>
<p><b>Selezione delle tabelle - </b>
A questo punto premiamo il bottone "Tabella" per selezionare la tabella principale della query. Possiamo scrivere direttamente "RMOV"
nella casella Tabella e premere il bottone "Conferma", oppure possiamo premere il bottone di selezione associato e scegliere la tabella desiderata dall'elenco.
A questo punto dobbiamo collegare le tesate dei movimenti contabili alle loro righe: premiamo nuovamente "Tabella" e colleghiamo "MOV".
Nella parte inferiore dovrebbero venire proposti i campi di collegamento "NUMREG". Normalmente i campi di collegamento compariranno automaticamente, ma e' possibile variarli in caso di necessita'.
</p>
</div>
</body>
</html>

View File

@ -68,15 +68,16 @@ ENDMASK
PAGE "Fields" -1 -1 68 6
STRING 101 12
STRING F_FLD_FROM 12
BEGIN
PROMPT 1 1 "Campo "
FLAGS "D"
END
STRING 102 12
STRING F_FLD_TO 12
BEGIN
PROMPT 1 2 "Campo "
FLAGS "B"
END
BUTTON DLG_OK 10 2

File diff suppressed because it is too large Load Diff

View File

@ -828,7 +828,9 @@ bool TReport_mask::select_query()
bool ok = select_custom_file(path, "qry");
if (ok)
{
TXmlItem item; item.Load(path);
TXmlItem item;
item.Load(path);
const TXmlItem* sql = item.FindFirst("sql");
ok = sql != NULL;
if (ok)

View File

@ -1,21 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Generatore Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--<link rel="stylesheet" href="./stili/stile_l.css">-->
</head>
<!-- frames -->
<frameset rows="80,*" border="0">
<frame name="uno" src="ba8300a_alto.html" frameborder="no" noresize>
<frame name="due" src="ba8300a_corpo.html" frameborder="no" noresize>
</frameset>
<body>
</body>
</html>

View File

@ -1,62 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Generatore Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../stili/stile_p.css">
</head>
<script>
function apri(lnk){
window.open(lnk,'','top=10, left=10, width=500, height=600, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no');
}
</script>
<body marginwidth="0" marginheight="0" topmargin="3" leftmargin="5" class="bodyframe">
<!-- Tabella contenitore principale -->
<table border="0" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<!-- Tabella titolo principale -->
<table border="0" align="center" width="100%" cellpadding="0" cellspacing="0">
<!-- <tr><td class="titolo1" colspan="2"><a href="../index.html" target="_new"><img src=../images/home.jpg border=0 alt=Home page></a>&nbsp;&nbsp;Zone</td></tr>-->
<tr><td class="titolo1" colspan="2"><a href="../index.html" target="_new"><img src=../images/home.jpg border=0 alt=Home page></a>Generatore Report</td></tr>
<!-- <tr><td><br></td></tr>-->
<tr>
<td>
<table border="0" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="30"></td>
<td align="left">
<!--<a href="ba8300a_corpo.html#uno" target="due"><img src="./images/pagina1.gif" border="0"></a><a href="ba4100a_corpo.html#due" target="due"><img src="./images/pagina2.gif" border="0"></a><a href="ba8300a_corpo.html#tre" target="due"><img src="./images/pagina3.gif" border="0"></a></td>-->
</tr>
</table>
</td>
<!--
</tr>
<tr>
-->
<td>
<table border="0" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="right"><a href="#" onclick="return apri('../pages/tastiera.html');"><img src="../images/tastiera.gif" border="0"></a></td>
<td align="right" width="35"><a href="#" onclick="return apri('../pages/mouse.html');"><img src="../images/mouse.gif" border="0"></a></td>
<td width="60"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@ -1,18 +0,0 @@
<html>
<head>
<title>Generatore Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../stili/stile_p.css">
</head>
<body bgcolor="#ffffff" leftmargin="5">
<h2>Introduzione</h2>
<div align="justify">
Questa applicazione permette di realizzare report di stampa partendo da <a href="ba8200sql.html#select">query sql</a> sul database di campo.<br>
Tali query possono essere costruite utilizzando l'apposito <a href="ba8300a.html" target="_parent">generatore di query</a>
oppure possono essere inserite manualmente o copiate da altre applicazioni che supportino il linguaggio <a href="ba8200sql.html">SQL</a>.
</div>
</body>
</html>

View File

@ -100,7 +100,7 @@ BEGIN
PROMPT 1 10 "@bSorgente"
END
STRING F_SOURCE2 80 46
ZOOM F_SOURCE2 80 46
BEGIN
PROMPT 1 14 "@bSorgente alternativa "
END

View File

@ -1,6 +1,6 @@
#include "ba8300.h"
PAGE "Sezione" -1 -1 50 16
PAGE "Sezione" -1 -1 52 16
LISTBOX F_TYPE 1 8
BEGIN
@ -80,7 +80,7 @@ BEGIN
FLAGS "H"
END
MEMO F_CONDITION 48 3
MEMO F_CONDITION 48 6
BEGIN
// Visibile sezioni con livello > 0
PROMPT 1 6 "Condizione"

View File

@ -322,6 +322,7 @@ class TReport_window : public TField_window
char _type;
int _level;
PNT _dpi;
bool _draw_bg;
int _dragging;
TPoint _pt_drag_start;
@ -329,7 +330,8 @@ class TReport_window : public TField_window
RCT _rct_drag;
TReport_image_cache _images;
int _default_row_height;
static TArray _clipboard;
protected:
@ -338,6 +340,7 @@ protected:
virtual bool on_key(KEY k);
protected:
void draw_bg();
void draw_grid();
void snap(TPoint& pnt, bool shift) const;
void snap(TRectangle& pnt, bool shift) const;
@ -521,10 +524,11 @@ void TReport_window::snap(TRectangle& rct, bool shift) const
#define POPUP_CLEAR 20887
#define POPUP_ZOOMIN 20888
#define POPUP_ZOOMOUT 20889
#define POPUP_SELALL 20890
#define POPUP_UNSELALL 20891
#define POPUP_PROPERTIES 20892
#define POPUP_NEWFIELD 20893
#define POPUP_BACKGROUND 20890
#define POPUP_SELALL 20891
#define POPUP_UNSELALL 20892
#define POPUP_PROPERTIES 20893
#define POPUP_NEWFIELD 20894
bool TReport_window::on_key(KEY k)
{
@ -603,6 +607,7 @@ void TReport_window::popup_menu()
const bool ful = curr_section().items() > 0;
const bool sel = ful && get_selection_rect(rct) != 0;
const bool clp = _clipboard.items() > 0;
const bool sbg = curr_section().level() > 0 || curr_section().type() != 'B';
menu[ 0].tag = POPUP_CUT; menu[ 0].text = (char*)TR("Taglia"); menu[0].enabled = sel;
menu[ 1].tag = POPUP_COPY; menu[ 1].text = (char*)TR("Copia"); menu[1].enabled = sel;
@ -612,12 +617,15 @@ void TReport_window::popup_menu()
menu[ 5].tag = -1; menu[ 5].separator = true;
menu[ 6].tag = POPUP_ZOOMIN; menu[ 6].text = (char*)TR("Zoom +"); menu[6].enabled = _dpi.v < 300;
menu[ 7].tag = POPUP_ZOOMOUT; menu[ 7].text = (char*)TR("Zoom -"); menu[7].enabled = _dpi.v > 48;
menu[ 8].tag = -1; menu[ 8].separator = true;
menu[ 9].tag = POPUP_SELALL; menu[ 9].text = (char*)TR("Seleziona tutto"); menu[ 9].enabled = ful;
menu[10].tag = POPUP_UNSELALL; menu[10].text = (char*)TR("Deseleziona tutto"); menu[10].enabled = ful;
menu[11].tag = -1; menu[11].separator = true;
menu[12].tag = POPUP_PROPERTIES; menu[12].text = "Proprieta'"; menu[12].enabled = true;
menu[13].tag = POPUP_NEWFIELD; menu[13].text = "Nuovo"; menu[13].enabled = true;
menu[ 8].tag = POPUP_BACKGROUND; menu[ 8].text = (char*)TR("Mostra sfondo");
menu[ 8].enabled = menu[8].checkable = sbg; menu[8].checked = sbg && _draw_bg;
menu[ 9].tag = -1; menu[ 9].separator = true;
menu[10].tag = POPUP_SELALL; menu[10].text = (char*)TR("Seleziona tutto"); menu[10].enabled = ful;
menu[11].tag = POPUP_UNSELALL; menu[11].text = (char*)TR("Deseleziona tutto"); menu[11].enabled = ful;
menu[12].tag = -1; menu[12].separator = true;
menu[13].tag = POPUP_PROPERTIES; menu[13].text = "Proprieta'"; menu[13].enabled = true;
menu[14].tag = POPUP_NEWFIELD; menu[14].text = "Nuovo"; menu[14].enabled = true;
_pt_drag_start = dev2log(_pt_click);
xvt_menu_popup(menu, win(), _pt_click, XVT_POPUP_CENTER, 0);
@ -898,6 +906,10 @@ void TReport_window::handler(WINDOW win, EVENT* ep)
case POPUP_ZOOMOUT:
do_zoom(-24, true);
break;
case POPUP_BACKGROUND:
_draw_bg = !_draw_bg;
force_update();
break;
case POPUP_SELALL:
{
TReport_section& rs = curr_section();
@ -1023,8 +1035,6 @@ void TReport_window::draw_grid()
{
const int k = 100;
clear(COLOR_WHITE);
const TReport_section& rs = curr_section();
int x = rs.width();
int y = rs.height();
@ -1110,6 +1120,7 @@ void TReport_window::draw_broken_paper(const TReport_field& rf)
void TReport_window::draw_field(const TReport_field& rf)
{
RCT r; TWindow::log2dev(rf.get_rect(), r);
int rad = 0;
if (rf.radius() > 0)
{
@ -1171,7 +1182,7 @@ void TReport_window::draw_field(const TReport_field& rf)
xvt_dwin_set_font(win(), rf.font().get_xvt_font(*this));
set_color(rf.fore_color(), rf.back_color());
TString str = rf.picture();
advanced_draw_paragraph(*this, str, r, rf.horizontal_alignment(), rf.vertical_alignment());
advanced_draw_paragraph(*this, str, r, rf.horizontal_alignment(), rf.vertical_alignment(), _default_row_height);
}
break;
default :
@ -1205,7 +1216,7 @@ void TReport_window::draw_field(const TReport_field& rf)
str << rf.id();
else
str = rf.field();
advanced_draw_paragraph(*this, str, r, rf.horizontal_alignment(), rf.vertical_alignment());
advanced_draw_paragraph(*this, str, r, rf.horizontal_alignment(), rf.vertical_alignment(), _default_row_height);
break;
}
@ -1230,10 +1241,53 @@ void TReport_window::draw_field(const TReport_field& rf)
}
}
void TReport_window::draw_bg()
{
const TReport_section& rs = curr_section();
if (_draw_bg && (rs.level() > 0 || rs.type() != 'B'))
{
const TReport_section* back = _report->find_section('B', 0);
if (back != NULL && back->items() > 0)
{
int offset_y = 0;
if (rs.type() == 'F')
{
offset_y = back->height() - rs.height();
}
else
{
const int lev = rs.type() == 'B' ? _report->find_max_level('H') : rs.level()-1;
for (int i = lev; i > 0; i--)
{
const TReport_section* h = _report->find_section('H', i);
if (h != NULL)
offset_y += h->compute_size().y/100;
}
}
update_thumb(origin().x, origin().y + offset_y);
for (int i = 0; i < back->items(); i++)
{
const TReport_field& rf = back->field(i);
draw_field(rf);
}
update_thumb(origin().x, origin().y - offset_y);
}
}
}
void TReport_window::update()
{
clear(COLOR_WHITE);
draw_grid(); // Disegna griglia
draw_bg();
const TRectangle rect_riga(0,0,1000,100);
RCT rct_riga; TWindow::log2dev(rect_riga, rct_riga);
_default_row_height = rct_riga.bottom - rct_riga.top;
const TReport_section& rs = curr_section();
for (int i = 0; i < rs.items(); i++)
{
@ -1250,7 +1304,7 @@ int TReport_window::lpi() const
TReport_window::TReport_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner)
: TField_window(x, y, dx, dy, parent, owner), _dragging(0), _report(NULL), _type('B'), _level(1)
: TField_window(x, y, dx, dy, parent, owner), _dragging(0), _report(NULL), _type('B'), _level(1), _draw_bg(false)
{
_dpi.h = _dpi.v = 96;
_pixmap = true;

View File

@ -212,6 +212,10 @@ void TFormer_mask::parse_field_line(const TString& line, TReport_field& rf) cons
pic.strip("\"");
pic.insert(rf.picture());
rf.set_picture(pic);
const int len = pic.len() * 100;
const int field_len = rf.get_rect().width();
if (len > 400 && len < field_len)
rf.set_width(len);
}
} else
if (head.starts_with("PR"))
@ -249,18 +253,22 @@ void TFormer_mask::import_general(TScanner& scan, TReport& rep)
TToken_string exclude(50, ',');
exclude = line.after('"');
exclude.strip("\""); exclude.trim();
TString cond, codart;
cond << "(34.TIPORIGA='" << exclude.get(0) << "\')";
codart = exclude.get(1);
if (!codart.blank())
const TString4 tipo = exclude.get(0);
if (!tipo.blank())
{
cond.insert("(");
cond << "&&(34.CODART?='" << codart << "')";
cond << ')';
TString cond;
cond << "(34.TIPORIGA='" << tipo << "\')";
TString codart = exclude.get(1);
if (!codart.blank())
{
cond.insert("(");
cond << "&&(34.CODART?='" << codart << "')";
cond << ')';
}
if (expr.not_empty())
expr << "||";
expr << cond;
}
if (expr.not_empty())
expr << "||";
expr << cond;
} else
if (line.starts_with("QTA_DECIMALS"))
{

View File

@ -40,8 +40,7 @@ Item_06 = "Banche", "ba3 -0 %ban", ""
Item_07 = "Codici statistici", "ba3 -0 %stt", ""
Item_08 = "Cariche sociali", "ba3 -0 %crs", ""
Item_09 = "Vecchi cod.Attivita'", "ba3 -0 %ois", ""
Item_10 = "Stati esteri", "ba3 -0 %sta", ""
Item_11 = "Gestione profili deleghe e distinte", "ba2 -0", ""
Item_10 = "Stati", "ba3 -0 %sta", ""
[MENU_003]
Caption = "Stampa tabelle"
@ -57,7 +56,7 @@ Item_06 = "Banche", "ba3 -1 %ban", ""
Item_07 = "Codici statistici", "ba3 -1 %stt", ""
Item_08 = "Cariche sociali", "ba3 -1 %crs", ""
Item_09 = "Vecchi cod.Attivita'", "ba3 -1 %ois", ""
Item_10 = "Stati esteri", "ba3 -1 %sta", ""
Item_10 = "Stati", "ba3 -1 %sta", ""
[MENU_011]
Caption = "Tabelle ministeriali"

View File

@ -38,7 +38,7 @@ END
STRING NOC_CODICE2 2
BEGIN
PROMPT 21 3 ""
FLAGS "Z"
// FLAGS "Z"
COPY ALL NOC_CODICE1
FIELD CODTAB[5,6]
KEY 1

View File

@ -6,7 +6,7 @@ TOOLBAR "" 0 20 0 2
ENDPAGE
PAGE "Stati esteri" -1 -1 78 13
PAGE "Stati" -1 -1 78 13
GROUPBOX DLG_NULL 75 7
BEGIN

View File

@ -20,17 +20,16 @@ Tabella versamenti ed interessi IVA
[Rows]
2|CODTAB[1,4]|@2g@4s
2|CODTAB[5,6]|@7g@2s
2|R0|@14g@5,rs
2|R1|@29g@5,rs
2|R2|@44g@5,rs
2|R3|@56g@5,rs
2|R4|@70g@5,rs
3|R11|@15g@5,rs
3|R12|@44g@5,rs
4|R5|@14g@15,rpn|###.###.###.###
4|R6|@34g@15,rpn|###.###.###.###
4|R7|@60g@15,rpn|###.###.###.###
5|R8|@14g@15,rpn|###.###.###.###
5|R9|@34g@15,rpn|###.###.###.###
5|R10|@60g@15,rpn|###.###.###.###
2|R0|@14g@pn|###,@@
2|R1|@29g@pn|###,@@
2|R2|@44g@pn|###,@@
2|R3|@56g@pn|###,@@
2|R4|@70g@pn|###,@@
3|R11|@15g@pn|###,@@
3|R12|@44g@pn|###,@@
4|R5|@14g@pn|###.###.###,@@
4|R6|@34g@pn|###.###.###,@@
4|R7|@60g@pn|###.###.###,@@
5|R8|@14g@pn|###.###.###,@@
5|R9|@34g@pn|###.###.###,@@
5|R10|@60g@pn|###.###.###,@@

View File

@ -5,7 +5,5 @@ Module = 0
Item_01 = "Contabilita' generale", <cgmenu.men>
Item_02 = "Gestione cespiti", <cemenu.men>
Item_03 = "Gestione percipienti", <77menu.men>
Item_04 = "Contabilita analitica", <procomm.men>
Item_05 = "Bilanci e Analisi", <abmenu.men>
Item_06 = "Elenchi Intracomunitari", <inmenu.men>
Item_04 = "Elenchi Intracomunitari", <inmenu.men>

BIN
ce/ce00.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

View File

@ -758,7 +758,7 @@ void TAnacespi::init_mask(TMask& m)
const bool mat_only = _emask->tipo_cespite() == tc_materiale;
m.show(F_LEASING, mat_only);
m.show(F_ANNIRIC, mat_only);
m.show(F_ANNIRIC, true); // m.show(F_ANNIRIC, mat_only); // Sempre visibile
m.show(F_USATO, mat_only);
m.show(F_AMMPROP, dc.ammortamento_proporzionale());
}

View File

@ -231,10 +231,11 @@ END
NUMBER F_ANNIRIC 3
BEGIN
PROMPT 40 15 "Anni di durata del leasing "
PROMPT 40 15 "Durata in anni "
FLAGS "U"
FIELD ANNIRIC
CHECKTYPE REQUIRED
WARNING "È neccessario specificare la durata del leasing"
WARNING "È neccessario specificare la durata"
END
BOOLEAN F_USATO

View File

@ -118,6 +118,8 @@ bool TMov_qmask::on_field_event(TOperable_field& o, TField_event e, long jolly)
switch (o.dlg())
{
case F_ESERCIZIO:
if ((e == fe_close || e == fe_modify) && efield(F_INIZIO_ES).empty())
return error_box("Inserire un esercizio valido");
case F_GRUPPO:
case F_SPECIE:
calcola_stato_attivita();
@ -747,7 +749,7 @@ const char* TMovicespi::get_next_key()
real num = 1;
TLocalisamfile cespi(LF_MOVCE);
if (cespi.last() == NOERR)
num = cespi.get_real(MOVCE_IDMOV) + 1;
num += cespi.get_real(MOVCE_IDMOV);
return format("%d|%s", F_IDMOV, num.string());
}
@ -785,8 +787,10 @@ void TMovicespi::calc_residuo(long numreg)
// Prima cerca movimenti con importo identico ...
for (cur = 0L; cur.pos() < items; ++cur)
{
const char segno = movce.get_char(MOVCE_SEGNO);
real imp = movce.get_real(segno == '-' ? MOVCE_IMPVEN : MOVCE_CSTO);
// const char segno = movce.get_char(MOVCE_SEGNO);
real imp = movce.get_real(MOVCE_IMPVEN);
if (imp.is_zero())
imp = movce.get_real(MOVCE_CSTO);
if (imp > ZERO) // Cerca una riga con lo stesso importo
{
for (int r = 0; r < s.items(); r++)
@ -809,8 +813,10 @@ void TMovicespi::calc_residuo(long numreg)
{
if (ignore.is_key(movce.get(MOVCE_IDMOV)))
continue;
const char segno = movce.get_char(MOVCE_SEGNO);
real imp = movce.get_real(segno == '-' ? MOVCE_IMPVEN : MOVCE_CSTO);
// const char segno = movce.get_char(MOVCE_SEGNO);
real imp = movce.get_real(MOVCE_IMPVEN);
if (imp.is_zero())
imp = movce.get_real(MOVCE_CSTO);
for (int r = 0; r < s.items() && imp > ZERO; r++)
{
TToken_string& row = s.row(r);

View File

@ -1775,46 +1775,49 @@ void TCespite::agg_spe_man(bool is_valid)
return;
log(TR("- Aggiornamento spese di manutenzione"));
TDitta_cespiti& cce = ditta_cespiti();
TString16 field; // Nome del campo da incrementare
const real vspmanu = _salpro.get(SALCE_VSPMANU);
if (vspmanu > ZERO)
{
TDitta_cespiti& cce = ditta_cespiti();
TString16 field; // Nome del campo da incrementare
const int tpspeman = get_int(CESPI_TPSPEMAN);
if (tpspeman == 2 || (tpspeman == 4 && !cce.esente_art14()))
field = "R2"; else
if (tpspeman == 3)
field = "R3";
const real vspmanu = _salpro.get_real(SALCE_VSPMANU);
if (field.not_empty() && vspmanu > ZERO)
{
int es;
TString4 gr, sp;
cce.get_attivita(es, gr, sp);
TString16 key;
key.format("%04d%s%s", es, (const char*)gr, (const char*)sp);
TTable ccb("CCB");
ccb.put("CODTAB", key);
const int err = ccb.read();
if (err != NOERR)
{
ccb.zero();
ccb.put("CODTAB", key);
}
real speman = ccb.get_real(field);
const int tpspeman = get_int(CESPI_TPSPEMAN);
if (tpspeman == 2 || (tpspeman == 4 && !cce.esente_art14()))
field = "R2"; else
if (tpspeman == 3)
speman += vspmanu * 0.25; // 25%
else
speman += vspmanu * 0.05; // 5%
ccb.put(field, speman);
ccb.put("D0", TDate(TODAY));
field = "R3";
if (field.not_empty())
{
int es;
TString4 gr, sp;
cce.get_attivita(es, gr, sp);
TString16 key;
key.format("%04d%s%s", es, (const char*)gr, (const char*)sp);
if (err == NOERR)
ccb.rewrite();
else
ccb.write();
TTable ccb("CCB");
ccb.put("CODTAB", key);
const int err = ccb.read();
if (err != NOERR)
{
ccb.zero();
ccb.put("CODTAB", key);
}
real speman = ccb.get_real(field);
if (tpspeman == 3)
speman += vspmanu * 0.25; // 25%
else
speman += vspmanu * 0.05; // 5%
ccb.put(field, speman);
ccb.put("D0", TDate(TODAY));
if (err == NOERR)
ccb.rewrite();
else
ccb.write();
}
}
}
@ -1825,7 +1828,7 @@ bool TCespite::calc_amm(int tipo_sit, const TDate& data_limite, bool recalc_spe_
log(FR("* Inizio calcolo situazione %d cespite %s"), tipo_sit, (const char*)idcespite);
#ifdef DBG
if (tipo_sit == 1 && atol(idcespite) == 1080L)
if (tipo_sit == 1 && atol(idcespite) == 2208L)
{
tipo_sit = 1; // Put your breakpoint here
}

View File

@ -245,7 +245,7 @@ void TRegistro_cespiti::main_loop()
bool show_pages = TRUE; // Abilita numerazione pagine
TString16 codtab;
codtab.format("%4d%s", datafine.year(), (const char*)_mask->get(F_CODREG));
codtab.format("%4d%s", datainizio.year(), (const char*)_mask->get(F_CODREG));
const TRectype& registro = cache().get("REG", codtab);
if (!registro.empty())
{
@ -479,7 +479,8 @@ void TRegistro_cespiti::aggiorna_bollato()
if (reg.read() == NOERR)
{
long pagine = reg.get_int("I1");
pagine += printer().getcurrentpage();
pagine += printer().getcurrentpage() - 1; //correzione necessaria perche' questa istruzione aggiunge
//una pagina (e' quella su cui sarebbe pronta a stampare)
reg.put("I1", pagine); // Aggiorna pagine stampate
reg.put("D3", oggi); // Aggiorna data di stampa
reg.rewrite();

View File

@ -146,6 +146,6 @@ void TECUP_app::main_loop()
int ce3700(int argc, char* argv[])
{
TECUP_app app;
app.run(argc, argv, TR("Cespiti uso promisquo"));
app.run(argc, argv, TR("Cespiti uso promiscuo"));
return 0;
}

View File

@ -30,7 +30,7 @@ SECTION HEADER ODD 9
STRINGA -1
BEGIN
KEY "Titolo"
PROMPT 1 1 "@bELENCO CESPITI USO PROMISQUO"
PROMPT 1 1 "@bELENCO CESPITI USO PROMISCUO"
END
STRINGA F_CODDITTA

View File

@ -14,7 +14,7 @@ END
ENDPAGE
PAGE "Cespiti uso promisquo" -1 -1 78 6
PAGE "Cespiti uso promiscuo" -1 -1 78 6
GROUPBOX DLG_NULL 78 6
BEGIN

View File

@ -131,9 +131,9 @@ BEGIN
ADD RUN AB0 -1
END
STRING FLD_CM1_DESCRANALISI 40 36
STRING FLD_CM1_DESCRANALISI 40 34
BEGIN
PROMPT 38 5 ""
PROMPT 40 5 ""
USE LF_ABPCON KEY 2
INPUT DESCRIZ FLD_CM1_DESCRANALISI
DISPLAY "Descrizione@40" DESCRIZ[1,40]

View File

@ -665,6 +665,9 @@ int TCaus_app::read(TMask& m)
r.put(RCA_CODCAUS, m.get(F_COD_CAUS));
_rcaus_rec->read(r);
load_rcaus(m);
_tipo_des = no_descr; //assegnazione necessaria per forzare il ricaricamento delle descrizioni
fill_sheet(m);
const TString& tpd = m.get(F_TIPO_DOC);
@ -689,6 +692,8 @@ void TCaus_app::load_rcaus(TMask& m)
const TString16 cod(_rel->lfile().get(RCA_CODCAUS));
TString d, da(50);
ss().destroy();
const int last = _rcaus_rec->last_row();
for (int i = 1; i <= last; i++)
{
@ -724,7 +729,7 @@ bool TCaus_app::fill_sheet(TMask& m)
tpr = reg.get_int("I0");
}
// carico le descrizioni fisse nell'array Righe_rcaus
compila_array(tpd,tpm,tpr,m770);

View File

@ -11,6 +11,7 @@
#include "cg2100.h"
#include "cg2102.h"
#include "cg21sld.h"
#include "../in/inlib01.h"
// Nomi dei campi
#include <clifo.h>
@ -82,6 +83,7 @@ TMask* TPrimanota_application::load_mask(int n)
m->set_handler(F_RITSOC, ritsoc_handler);
m->set_handler(F_CORRISPETTIVO, corrlire_handler);
m->set_handler(F_CORRVALUTA, corrvaluta_handler);
m->set_handler(F_DATAINTRA, dataintra_handler);
m->set_handler(F_CODIVA, main_codiva_handler);
m->set_handler(F_OCCASEDIT, occas_handler);
m->set_handler(F_SOLAIVA, solaiva_handler);
@ -497,6 +499,8 @@ void TPrimanota_application::init_mask(TMask& m)
// Show/Hide campi valuta: F_VALUTAINTRA, F_CAMBIOINTRA, F_CORRISPETTIVO, F_CORRVAL (GROUP 4)
m.show(-4, causale().valintra());
m.show(F_DATAINTRA, causale().intra());
if (causale().soloiva())
m.set(F_SOLAIVA, "X", TRUE); // Propone movimento di sola iva
@ -1777,67 +1781,126 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action)
if (!fexist("in0.exe"))
return FALSE;
const bool bModify = xvt_str_compare_ignoring_case(action, "Modify") == 0;
TFilename intrini;
intrini.tempdir();
intrini.add("ActIntra.ini");
TString appname;
TConfig intro(intrini, "Transaction");
if (action == "Modify")
{
TString16 key;
key << m.get(F_NUMREG);
const TRectype & intra = cache().get(LF_INTRA, key);
if (intra.empty())
action = "Insert";
}
intro.set("Action", action);
TString str; // Stringa jolly di lavoro
str.format("%d", LF_INTRA);
intro.set_paragraph(str);
intro.set("NUMREG", m.get(F_NUMREG));
intro.set("DATAREG", m.get(F_DATAREG));
if (m.field(F_CLIENTE).shown())
bool call_rettifiche = false;
const TDate datareg = m.get(F_DATAREG);
const TDate dataint = m.get(F_DATAINTRA);
if (dataint < datareg)
{
intro.set("TIPOMOV", "C");
intro.set("TIPOCF", "C");
intro.set("CODCF", m.get(F_CLIENTE));
}
const TIntra_frequency freq;
const char tipo = iva() == iva_acquisti ? 'A' : 'C';
call_rettifiche = freq.compare_periodo(dataint, datareg, tipo) < 0;
}
if (call_rettifiche)
{
const TIntra_frequency freq;
const char tipo = iva() == iva_acquisti ? 'B' : 'D';
TRelation rel(LF_RIEPRETT);
TRectype& curr = rel.curr();
curr.put("TIPO", tipo);
curr.put("ANNO", datareg.year());
curr.put("PERIODO", freq.date2periodo(datareg, tipo));
TCursor cur(&rel, "", 1, &curr, &curr);
const TRecnotype items = cur.items();
cur.freeze();
long last_rett = 0;
for (cur = 0; cur.pos() < items; ++cur)
{
const long n = curr.get_long("NUMRIG");
if (n > last_rett)
last_rett = n;
if (curr.get_long("NUMREG") == m.get_long(F_NUMREG))
return curr.edit(0, NULL, "in0 -6");
}
intro.set("Action", "Insert");
TString str; // Stringa jolly di lavoro
str.format("%d", LF_RIEPRETT);
intro.set_paragraph(str);
intro.set("TIPO", tipo == 'B' ? "B" : "D");
intro.set("ANNO", datareg.year());
intro.set("PERIODO", freq.date2periodo(datareg, tipo));
intro.set("NUMRIG", last_rett+1);
intro.set("ANNORETT", dataint.year());
intro.set("PERETT", freq.date2periodo(dataint, tipo));
intro.set("STATO", m.get(F_STATOPAIV));
intro.set("PIVA", tipo == 'B' ? m.get(F_PIVAFORNITORE) : m.get(F_PIVACLIENTE));
intro.set("NUMREG", m.get(F_NUMREG));
appname << "in0 -6 /i" << intrini;
}
else
{
intro.set("TIPOMOV", "A");
intro.set("TIPOCF", "F");
intro.set("CODCF", m.get(F_FORNITORE));
}
if (bModify)
{
TString16 key;
key << m.get(F_NUMREG);
const TRectype & intra = cache().get(LF_INTRA, key);
if (intra.empty())
action = "Insert";
}
intro.set("Action", action);
TString str; // Stringa jolly di lavoro
str.format("%d", LF_INTRA);
intro.set_paragraph(str);
intro.set("NUMREG", m.get(F_NUMREG));
intro.set("DATAREG", m.get(F_DATAREG));
// Controlla flag sulla causale
const bool valintra = causale().valintra();
if (valintra)
{
intro.set("CODVAL", m.get(F_VALUTAINTRA));
intro.set("CAMBIO", m.get(F_CAMBIOINTRA));
}
if (m.field(F_CLIENTE).shown())
{
intro.set("TIPOMOV", "C");
intro.set("TIPOCF", "C");
intro.set("CODCF", m.get(F_CLIENTE));
}
else
{
intro.set("TIPOMOV", "A");
intro.set("TIPOCF", "F");
intro.set("CODCF", m.get(F_FORNITORE));
}
// Controlla flag sulla causale
const bool valintra = causale().valintra();
if (valintra)
{
intro.set("CODVAL", m.get(F_VALUTAINTRA));
intro.set("CAMBIO", m.get(F_CAMBIOINTRA));
}
// Inserisci il totale documento solo in inserimento!
if (action == "Insert")
{
real totdoc = m.get_real(valintra ? F_CORRISPETTIVO : F_IMPONIBILI);
if (test_swap(FALSE))
totdoc = -totdoc;
intro.set("TOTDOC", totdoc.string());
}
else
intro.remove("TOTDOC"); // Evita di cambiare il valore preesistente
// Inserisci il totale documento solo in inserimento!
if (xvt_str_compare_ignoring_case(action, "Insert") == 0)
{
real totdoc = m.get_real(valintra ? F_CORRISPETTIVO : F_IMPONIBILI);
if (test_swap(FALSE))
totdoc = -totdoc;
intro.set("TOTDOC", totdoc.string());
}
else
intro.remove("TOTDOC"); // Evita di cambiare il valore preesistente
intro.set_paragraph(""); // Flush
str = "in0 -4 /i"; str << intrini;
TExternal_app app(str);
bool ok = app.run() == 0;
appname << "in0 -4 /i" << intrini;
}
bool ok = false;
if (!appname.empty())
{
intro.set_paragraph(""); // Flush pending writes
TExternal_app app(appname);
ok = app.run() == 0;
}
::remove(intrini);
return ok;
}

View File

@ -57,6 +57,7 @@
#define F_REGST 144
#define F_DIFFERITA 145
#define F_ADJUST_PRORATA 146
#define F_DATAINTRA 147
#define F_GRUPPO 180
#define F_CONTO 181
#define F_SOTTOCONTO 182

View File

@ -545,7 +545,7 @@ END
STRING F_VALUTAINTRA 3
BEGIN
PROMPT 1 17 "Valuta intracom. "
PROMPT 1 17 "Cambio intracom. "
FIELD CODVALI
FLAGS "UZ"
GROUP 4
@ -563,13 +563,19 @@ END
NUMBER F_CAMBIOINTRA 15 6
BEGIN
PROMPT 39 17 "Cambio intracomun. "
PROMPT 25 17 ""
FIELD CAMBIOI
FLAGS "U"
GROUP 4
PICTURE ".6"
END
DATE F_DATAINTRA
BEGIN
PROMPT 43 17 "Data competenza intra "
FIELD DATACOMPI
END
CURRENCY F_CORRISPETTIVO 18
BEGIN
PROMPT 1 18 "Corrispettivo "

View File

@ -790,13 +790,17 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
}
}
// La commessa è vuota: controlliamo se era obbligatoria
const TString80 cms = r.get(CG_COMMESSA-FIRST_FIELD);
if (c.tipo() <= ' ' && cms.blank() && c.required_cdc())
if (c.tipo() <= ' ')
{
TToken_string k = c.string(); k.replace('|', ' ');
return f.error_box(FR("Il codice commessa è obbligatorio per il conto %s della riga %d"),
(const char*)k, i+1);
// Se la commessa è vuota: controlliamo se era obbligatoria
const int col = CG_COMMESSA-FIRST_FIELD;
const TString80 cms = r.get(col);
if (cms.blank() && cg.cell_enabled(i, col) && c.required_cdc())
{
TToken_string k = c.string(); k.replace('|', ' ');
return f.error_box(FR("Il codice commessa è obbligatorio per il conto %s della riga %d"),
(const char*)k, i+1);
}
}
}
}
@ -2046,8 +2050,6 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
{
// Riempie a mano i campi necessari nel caso non sia stato usata la ricerca F9
m.set(F_DATAREG, mov.get(MOV_DATAREG), TRUE);
// DATACOMP new way
// m.set(F_DATACOMP, mov.get("DATACOMP"), TRUE);
m.set(F_CODCAUS, mov.get(MOV_CODCAUS));
f.set_focusdirty(FALSE);
@ -2961,6 +2963,19 @@ HIDDEN void inventa_cambio_intra(TMask& m)
}
}
// Handler of F_DATAINTRA
// Certified 99%
bool TPrimanota_application::dataintra_handler(TMask_field& f, KEY key)
{
// Se la data INTRA e' vuota allora copiala dalla data di competenza normale
if (key == K_ENTER && f.empty())
{
f.set(f.mask().get(F_DATAREG));
}
return true;
}
// Handler of F_CORRLIRE
// Certified 99%
bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key)

View File

@ -116,6 +116,7 @@ class TPrimanota_application : public TRelation_application
static bool ritfis_handler(TMask_field& f, KEY key);
static bool ritsoc_handler(TMask_field& f, KEY key);
static bool main_codiva_handler(TMask_field& f, KEY key);
static bool dataintra_handler(TMask_field& f, KEY key);
static bool corrlire_handler(TMask_field& f, KEY key);
static bool corrvaluta_handler(TMask_field& f, KEY key);
static bool occas_code_handler(TMask_field& f, KEY key);

View File

@ -817,7 +817,7 @@ bool TPrimanota_application::read_scadenze(TMask& m)
set_pagamento(codpag, datadoc.string());
TPagamento& pag = pagamento();
const bool in_valuta = m.get(SK_VALUTA).not_empty();
const bool in_valuta = ::is_true_value(m.get(SK_VALUTA));
const real totale = m.get_real(in_valuta ? SK_TOTDOCVAL : F_TOTALE);
if (totale != partita.importo(in_valuta).valore())

View File

@ -1871,9 +1871,6 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
oldpag.get_real(PAGSCA_RITENUTE).is_zero() &&
oldpag.get_real(PAGSCA_RITSOC).is_zero();
/*
TPay_mask m(this, nuovo ? MODE_INS : MODE_MOD);
*/
// We must create masks on the heap
static TPay_mask* pm = NULL;
if (pm == NULL)

View File

@ -2008,7 +2008,7 @@ void TListaMov_application::filtra_cursore_provvisori(TCursor* cur) const
{
case 1: filter = "(PROVVIS=\"\")"; break; //normale
case 2: filter = ""; break; //globale
default: filter = "(PROVVIS=\"\")"; break; //solo provvisori
default: filter = "(PROVVIS!=\"\")"; break; //solo provvisori
}
cur->setfilter(filter);
}

View File

@ -39,6 +39,36 @@ bool TDouble_fatt_mask::on_field_event(TOperable_field& o, TField_event e, long
}
//===========================================================================================
//Dichiarazione APPLICAZIONE; necessaria qui per farla conoscere al form
class TDouble_fatt_form;
class TDouble_fatt : public TSkeleton_application
{
TAssoc_array _movimenti; //assocarray con tutti i movimenti
TPointer_array _duplicati;
TDouble_fatt_mask* _mask;
TDouble_fatt_form* _form;
bool _print_again;
protected:
virtual void main_loop();
virtual bool create();
virtual bool destroy();
static bool mov_callback(const TRelation& rel, void* pJolly);
void store_mov(const TRectype& mov);
public:
void print_again() { _print_again = true; }
};
TDouble_fatt& app() {return (TDouble_fatt&) main_app(); }
//===============================================================================================
//form
class TDouble_fatt_form : public TForm
@ -71,6 +101,11 @@ bool TDouble_fatt_form::process_link(int id, const char * lnk)
TRectype mov(LF_MOV);
mov.put(MOV_NUMREG, lnk);
mov.edit(); //fighissimo modo per lanciare l'editor del record (programma scelto in automatico!!)
if (yesno_box(TR("Si desidera aggiornare la stampa?")))
{
dispatch_e_char(cur_win(), K_ESC); //chiude l'anteprima di stampa
app().print_again();
}
return true;
}
@ -180,27 +215,6 @@ TDouble_fatt_form::~TDouble_fatt_form()
//===============================================================================================
//Applicazione
class TDouble_fatt : public TSkeleton_application
{
TAssoc_array _movimenti; //assocarray con tutti i movimenti
TPointer_array _duplicati;
TDouble_fatt_mask* _mask;
TDouble_fatt_form* _form;
protected:
virtual void main_loop();
virtual bool create();
virtual bool destroy();
static bool mov_callback(const TRelation& rel, void* pJolly);
void store_mov(const TRectype& mov);
public:
};
bool TDouble_fatt::create()
{
_mask = new TDouble_fatt_mask;
@ -292,23 +306,26 @@ void TDouble_fatt::main_loop()
while (_mask->run() == K_ENTER)
{
TRelation rel(LF_MOV);
do
{
_print_again = false;
TRelation rel(LF_MOV);
TRectype darec(LF_MOV), arec(LF_MOV);
const TDate dataini(1,1,_mask->get_date(F_DADATA).year()-1);
const TDate datafin(31,12,_mask->get_date(F_ADATA).year()+1);
TRectype darec(LF_MOV), arec(LF_MOV);
const TDate dataini(1,1,_mask->get_date(F_DADATA).year()-1);
const TDate datafin(31,12,_mask->get_date(F_ADATA).year()+1);
darec.put(MOV_DATAREG, dataini);
arec.put(MOV_DATAREG, datafin);
darec.put(MOV_DATAREG, dataini);
arec.put(MOV_DATAREG, datafin);
TCursor cur(&rel, "TIPO=='F'", 2, &darec, &arec);
_movimenti.destroy();
_duplicati.destroy();
scan_cursor(cur, "Ricerca fatture doppie...", mov_callback, this);
if (_duplicati.items() > 0)
_form->print(*_mask);
TCursor cur(&rel, "TIPO=='F'", 2, &darec, &arec);
_movimenti.destroy();
_duplicati.destroy();
scan_cursor(cur, "Ricerca fatture doppie...", mov_callback, this);
if (_duplicati.items() > 0)
_form->print(*_mask);
} while(_print_again);
}
}

View File

@ -2126,8 +2126,6 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
set_row(_r, "@70g%r", &totdoc);
else
set_row(_r, "@78g%r", &totdoc);
//*****aggiornamento del totale documento progressivo
_totdoc_prog += totdoc;
if (_tipo_stampa == prova) //in caso di stampa di prova
{
@ -2180,7 +2178,10 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
riga = i;
}
}
//progressivi righe iva azzerati
_progr_doc = 0;
_progr_impn = 0;
_progr_imps = 0;
const TRecnotype nrec = riga_rmoviva();
if (nrec > 0L)
{
@ -2193,15 +2194,11 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
if (_stampa_width == 132)
{
set_row(rr, "@85g%r", &riga._imponibile);
//*****aggiornamento del totale imponibile progressivo
_totimpn_prog += riga._imponibile;
set_row(rr, "@101g%4s",(const char*)riga._codiva);
if (_tipo_reg == acquisto)
set_row(rr, "@106g%d", riga._tipodet);
set_row(rr, "@107g%r", &riga._imposta);
//*****aggiornamento del totale imposta progressivo
_totimps_prog += riga._imposta;
set_row(rr, "@123g%d", riga._tipocr);
if (_tipoatt == "E" && _tipo_reg != acquisto)
@ -2212,23 +2209,35 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
else //stampa a 198
{
set_row(rr, "@93g%r", &riga._imponibile);
//*****aggiornamento del totale imponibile progressivo
_totimpn_prog += riga._imponibile;
set_row(rr, "@109g%4s",(const char*)riga._codiva);
if (_tipo_reg == acquisto)
set_row(rr, "@114g%d", riga._tipodet);
set_row(rr, "@116g%r", &riga._imposta);
//*****aggiornamento del totale imposta progressivo
_totimps_prog += riga._imposta;
if (_tipoatt == "E" && _tipo_reg != acquisto)
set_row(rr, "@132g%d", riga._tipoatt);
set_row(rr, "@134g%d", riga._tipocr);
if (_tipo_stampa == rif_giornale) //stampa con riferimento al libro giornale
set_row(rr, "@136g%7ld", numgio);
}
}
}
//*****Calcolo dei progressivi (un casino mondiale!!!)
_progr_impn += riga._imponibile;
_progr_imps += riga._imposta;
}
//*****aggiornamento del totale documento,imponibile e imposta progressivi
const real totdoc = mov.get_real(MOV_TOTDOC);
_progr_doc = totdoc;
if (_rows_left > 0)
{
_totdoc_prog += _progr_doc; //progressivo totale documento
_totimpn_prog += _progr_impn; // " imponibile
_totimps_prog += _progr_imps; // " imposta
}
_riga_rmi.destroy();
}
@ -2366,14 +2375,12 @@ print_action TStampa_registri_app::postprocess_page (int file, int counter)
}
}
}
if (!counter)
else
{
bool FINITO = FALSE;
TRecnotype pos = _cur->pos();
long items = _cur->items();
FINITO = (pos == items-1);
const TRectype& mov = _cur->curr(LF_MOV);
const TRecnotype pos = _cur->pos();
const long items = _cur->items();
const bool FINITO = (pos == items-1);
if ( FINITO )
{
liq_other_case();
@ -2384,7 +2391,6 @@ print_action TStampa_registri_app::postprocess_page (int file, int counter)
}
else
{
TLocalisamfile& mov = _cur->file(LF_MOV);
_cur->save_status();
++(*_cur);
_dataregs = mov.get_date(MOV_DATAREG);
@ -2400,7 +2406,7 @@ print_action TStampa_registri_app::postprocess_page (int file, int counter)
return REPEAT_PAGE;
}
}
}
}
}
return NEXT_PAGE;
}
@ -2617,10 +2623,18 @@ void TStampa_registri_app::preprocess_header()
if (_riporti_stampati)
{
if (_stampa_width == 132)
set_header(r++, FR("@0gRiporto progressivi@70g%s@85g%s@107g%s"), _totdoc_prog.stringa(15,2), _totimpn_prog.stringa(15,2), _totimps_prog.stringa(15,2));
set_header(r++, FR("@0gRiporto progressivi@70g%15s@85g%15s@107g%15s"),
_totdoc_prog.string(".2"), _totimpn_prog.string(".2"), _totimps_prog.string(".2"));
if (_stampa_width == 198)
set_header(r++, FR("@0gRiporto progressivi@78g%s@93g%s@116g%s"), _totdoc_prog.stringa(15,2), _totimpn_prog.stringa(15,2), _totimps_prog.stringa(15,2));
set_header(r++, FR("@0gRiporto progressivi@78g%15s@93g%15s@116g%15s"),
_totdoc_prog.string(".2"), _totimpn_prog.string(".2"), _totimps_prog.string(".2"));
if (_rows_left == 0)
{
_totdoc_prog += _progr_doc;
_totimpn_prog += _progr_impn;
_totimps_prog += _progr_imps;
}
set_header(r++, riga);
_totali_stampati = false;
}
@ -2637,10 +2651,13 @@ void TStampa_registri_app::preprocess_footer()
TString riga(_stampa_width);
riga.fill('-');
set_footer(r++, riga);
if (_stampa_width == 132)
set_footer(r++, FR("@0gTotale progressivi@70g%s@85g%s@107g%s"), _totdoc_prog.stringa(15,2), _totimpn_prog.stringa(15,2), _totimps_prog.stringa(15,2));
set_footer(r++, FR("@0gTotale progressivi@70g%15s@85g%15s@107g%15s"),
_totdoc_prog.string(".2"), _totimpn_prog.string(".2"), _totimps_prog.string(".2"));
if (_stampa_width == 198)
set_footer(r++, FR("@0gTotale progressivi@78g%s@93g%s@116g%s"), _totdoc_prog.stringa(15,2), _totimpn_prog.stringa(15,2), _totimps_prog.stringa(15,2));
set_footer(r++, FR("@0gTotale progressivi@78g%15s@93g%15s@116g%15s"),
_totdoc_prog.string(".2"), _totimpn_prog.string(".2"), _totimps_prog.string(".2"));
set_footer(r++, riga);
_riporti_stampati = true;
@ -2649,6 +2666,14 @@ void TStampa_registri_app::preprocess_footer()
_riporti_stampati = false;
}
void TStampa_registri_app::on_page_printed(int file)
{
if (file == LF_MOV)
{
_rows_left = printer().rows_left();
}
}
bool TStampa_registri_app::stampo_liquidazione(int mese)
{
//test tradotti alla lettera da AS/400
@ -3258,6 +3283,7 @@ bool TStampa_registri_app::set_print(int n)
_totdoc_prog = 0;
_totimpn_prog = 0;
_totimps_prog = 0;
_rows_left = 69;
_riporti_stampati = false;
_totali_stampati = false;

View File

@ -63,6 +63,8 @@ class TStampa_registri_app : public TPrintapp
int _stampa_len, _stampa_mese, _size_header;
real _totale_doc, _credito;
real _totdoc_prog, _totimpn_prog, _totimps_prog; //totali progressivi
real _progr_doc, _progr_impn, _progr_imps; //progressivi movimenti (servono x totali progressivi)
word _rows_left; //flag di controllo per i progressivi a cavallo del salto pagina
TString _codreg, _desc_lib, _codatt, _attivita, _tipoatt;
TString _tipodoc, _descr_doc, _codlib, _codice_vidi;
TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis;
@ -153,6 +155,7 @@ public:
virtual print_action postprocess_page (int, int);
virtual void preprocess_header();
virtual void preprocess_footer();
virtual void on_page_printed(int file);
TStampa_registri_app() : TPrintapp(), _ditte(NULL), _selected(10000), _nomiditte(100), _test(FALSE) {}
virtual ~TStampa_registri_app() {}

View File

@ -877,6 +877,16 @@ int TBill::tipo_cr() const
return _tipo_cr;
}
int TBill::indicatore_bilancio() const
{
TString16 str;
str.format("%d|%d", gruppo(), conto());
const int ib = atoi(cache().get(LF_PCON, str, PCN_INDBIL));
if (ib == 0)
NFCHECK("Impossibile stabilire l'indicatore di bilancio");
return ib;
}
bool TBill::sospeso() const
{
if (_tipo_cr < 0) tipo_cr(); // trick to load _sospeso

View File

@ -222,6 +222,7 @@ public:
const TString& descrizione() const;
int tipo_cr() const;
void tipo_cr(int tcr) { _tipo_cr = tcr; }
int indicatore_bilancio() const;
int tipo_att();
bool read(TRectype& r);

View File

@ -622,7 +622,7 @@ public:
const TString& TTab_conti::build_key(const TBill& c, int anno, bool scar) const
{
static TString80 key;
TString& key = get_tmp_string(23);
key.format("%4d%3d%3d%6ld%c", anno, c.gruppo(), c.conto(), c.sottoconto(), scar ? 'X' : '\0');
return key;
}
@ -959,7 +959,7 @@ bool TBalance::find(const TBill& b, int esercizio,
{
CHECK(b.sottoconto() > 0L, "Sottoconto mancante");
TString key(30);
TString80 key;
key.format("%d||%d|%d|%ld", esercizio, b.gruppo(), b.conto(), b.sottoconto());
const TRectype & saldi = cache().get(LF_SALDI, key);
const bool ok = !saldi.empty();

View File

@ -224,7 +224,6 @@ Flags = ""
Item_01 = "Estrazione versamenti", "cg4 -2 -D", "F"
Item_02 = "Gestione versamenti", "ba3 -0 %del", ""
Item_03 = "Stampa versamenti", "cg1 -3", "F"
Item_04 = "Gestione profili deleghe e distinte", "ba2 -0", ""
[CGMENU_023]
Caption = "Stampe di contabilita`"

View File

@ -60,7 +60,7 @@ void TPagamento::set_inizio(const TDate& d, bool rispetta_date)
_datadoc = d;
_inizio = d;
_inited = TRUE;
_inited = true;
// aggiusta _inizio secondo INSCAD; vedi mese commerciale etc.
if (_inscad == 'M')
_inizio.set_end_month();
@ -75,7 +75,7 @@ void TPagamento::set_inizio(const TDate& d, bool rispetta_date)
next_scad(data, scad_rata(0), _mcomm, 0);
bool dummy;
recalc_rate(0, FALSE, NULL, NULL, data.string(), NULL, NULL, _rdiff, _mcomm, dummy);
recalc_rate(0, false, NULL, NULL, data.string(), NULL, NULL, _rdiff, _mcomm, dummy);
}
void TPagamento::set_intervallo_rate(int in)
@ -83,7 +83,7 @@ void TPagamento::set_intervallo_rate(int in)
if (_mcomm && (in % 30) != 0)
{
if (yesno_box("E' specificato \"mese commerciale\". Si desidera annullarlo?"))
_mcomm = FALSE;
_mcomm = false;
else
return;
}
@ -93,12 +93,12 @@ void TPagamento::set_intervallo_rate(int in)
ts.add(in, 0);
}
_int_rate = in;
_dirty = TRUE;
_dirty = true;
}
void TPagamento::set_mese_commerciale(bool v, int& sscad)
{
_dirty = FALSE;
_dirty = false;
if (_mcomm == v) return;
if (sscad < 0) sscad = 30;
@ -110,7 +110,7 @@ void TPagamento::set_mese_commerciale(bool v, int& sscad)
void TPagamento::set_rate_differenziate(int v)
{
_dirty = FALSE;
_dirty = false;
if ((int(_rdiff) ^ v) == 2) return;
if (v == 2 && (100 % n_rate()) == 0)
@ -123,12 +123,12 @@ void TPagamento::set_rate_differenziate(int v)
}
}
_rdiff = (v != 2);
_dirty = TRUE;
_dirty = true;
}
void TPagamento::set_tipo_prima_rata(int v, int sscad)
{
_dirty = FALSE;
_dirty = false;
if (_tpr == v) return;
if (!_inited)
@ -142,7 +142,7 @@ void TPagamento::set_tipo_prima_rata(int v, int sscad)
tt.add(tipo_rata(i-1),2);
tt.add(ulc_rata(i-1),5);
}
_rate.destroy(0, TRUE);
_rate.destroy(0, true);
}
else if ( _tpr < 4 && v > 3)
{
@ -183,14 +183,14 @@ void TPagamento::set_tipo_prima_rata(int v, int sscad)
}
}
_tpr = v;
_dirty = TRUE;
_dirty = true;
}
void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
{
if (n <= 0) return;
_dirty = FALSE;
_dirty = false;
const int nr = n_rate();
const int first = _tpr < 4 ? 0 : 1;
@ -208,24 +208,24 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
if (_inited || (!_inited && rdiff == 1)) // se e' inited rdiff e' 2 per forza
{
real tot = _inited ? importo_da_dividere(FALSE) : CENTO;
real tot = _inited ? importo_da_dividere(false) : CENTO;
real oot;
if (inv)
oot = importo_da_dividere(TRUE);
oot = importo_da_dividere(true);
if (nact == 1)
{
if (_inited)
{
set_imprata(first, tot, FALSE);
if (inv) set_imprata(first, oot, TRUE);
set_imprata(first, tot, false);
if (inv) set_imprata(first, oot, true);
}
set_percrata(first, CENTO);
if (_inited && _tpr > 0 && _tpr < 4)
{
set_imprata(first, importo_rata(first,FALSE) + importo_da_non_dividere(FALSE), FALSE);
set_imprata(first, importo_rata(first,false) + importo_da_non_dividere(false), false);
if (inv)
set_imprata(first, importo_rata(first,TRUE) + importo_da_non_dividere(TRUE), TRUE);
set_imprata(first, importo_rata(first,true) + importo_da_non_dividere(true), true);
}
i = first + 1; // per rimozione successiva
}
@ -265,12 +265,12 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
}
if (_inited)
{
set_imprata (i, div, FALSE);
rem -= importo_rata(i,FALSE);
set_imprata (i, div, false);
rem -= importo_rata(i,false);
if (inv)
{
set_imprata (i, oiv, TRUE);
oem -= importo_rata(i,TRUE);
set_imprata (i, oiv, true);
oem -= importo_rata(i,true);
}
}
else
@ -279,24 +279,24 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
}
if (_inited && _tpr > 0 && _tpr < 4)
{
set_imprata(0, importo_rata(0,FALSE) + importo_da_non_dividere(FALSE), FALSE);
set_imprata(0, importo_rata(0,false) + importo_da_non_dividere(false), false);
if (inv)
set_imprata(0, importo_rata(0,TRUE) + importo_da_non_dividere(TRUE), TRUE);
set_imprata(0, importo_rata(0,true) + importo_da_non_dividere(true), true);
}
if (rem != ZERO || oem != ZERO)
{
if (_inited)
{
real r(importo_rata(first,FALSE) + rem);
real r(importo_rata(first,false) + rem);
real oldr;
if (inv) oldr = importo_rata(first,TRUE) + oem;
set_imprata(first, r, FALSE);
if (inv) set_imprata(first, oldr, TRUE);
if (inv) oldr = importo_rata(first,true) + oem;
set_imprata(first, r, false);
if (inv) set_imprata(first, oldr, true);
if (_inited && _tpr > 0 && _tpr < 4)
{
r -= importo_da_non_dividere(FALSE);
if (inv) oldr -= importo_da_non_dividere(TRUE);
r -= importo_da_non_dividere(false);
if (inv) oldr -= importo_da_non_dividere(true);
}
set_percrata(first, CENTO * r / tot);
}
@ -314,15 +314,15 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
// e' selezionato UGUALI: devo: lasciare la prima
// rata com'e' (a meno che non ce ne sia una sola) e
// suddividere il resto dell'importo tra le altre
real rfirst = _inited ? importo_rata(0,FALSE) : perc_rata(0);
real rfirst = _inited ? importo_rata(0,false) : perc_rata(0);
real ofirst;
if (inv)
ofirst = importo_rata(0,TRUE);
ofirst = importo_rata(0,true);
if (_inited && _tpr > 0 && _tpr < 4)
{
rfirst -= importo_da_non_dividere(FALSE);
rfirst -= importo_da_non_dividere(false);
if (inv)
ofirst -= importo_da_non_dividere(TRUE);
ofirst -= importo_da_non_dividere(true);
}
real rest = tot - (_tpr >= 4 ? ZERO : rfirst);
real oest;
@ -357,11 +357,11 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
}
if (_inited)
{
set_imprata (i, div, FALSE);
set_imprata (i, div, false);
rem -= div;
if (inv)
{
set_imprata (i, oiv, TRUE);
set_imprata (i, oiv, true);
oem -= oiv;
}
}
@ -373,13 +373,13 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
{
if (_inited)
{
real r(importo_rata(first,FALSE) + rem);
real r(importo_rata(first,false) + rem);
real oldr;
if (inv) oldr = importo_rata(first,TRUE) + oem;
set_imprata(first, r, FALSE);
if (inv) set_imprata(first, oldr, TRUE);
if (inv) oldr = importo_rata(first,true) + oem;
set_imprata(first, r, false);
if (inv) set_imprata(first, oldr, true);
if (_inited && _tpr > 0 && _tpr < 4)
r -= importo_da_non_dividere(FALSE);
r -= importo_da_non_dividere(false);
set_percrata(first, CENTO * r / tot);
}
else
@ -416,7 +416,7 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
if (i != 0 && scd == 0)
scd = _int_rate;
#endif
set_rata(i, real(p), scd, (i < nr ? tipo_rata(i) : tipo_rata(nr-1)), FALSE);
set_rata(i, real(p), scd, (i < nr ? tipo_rata(i) : tipo_rata(nr-1)), false);
}
}
// erase remaining
@ -424,12 +424,12 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
if (_inited)
{
set_inizio(_datadoc, TRUE);
set_inizio(_datadoc, true);
adjust_perc(rdiff, inv);
}
adjust_fixed_scad();
_dirty = TRUE;
_dirty = true;
}
@ -490,7 +490,7 @@ void TPagamento::set_default_type(int type, bool change_existing)
TToken_string& tt = rata(i);
tt.add(type, 2);
}
_dirty = TRUE;
_dirty = true;
}
}
@ -504,15 +504,15 @@ void TPagamento::set_default_ulc(const char* ulc, bool change_existing)
TToken_string& tt = rata(i);
tt.add(ulc, 5);
}
_dirty = TRUE;
_dirty = true;
}
}
void TPagamento::remove_rata(int i)
{
// non fa nessun ricalcolo, si limita ad impacchettare se necessario
_rate.destroy(i, TRUE);
_dirty = TRUE;
_rate.destroy(i, true);
_dirty = true;
}
void TPagamento::remove_rate_from(int i)
@ -520,7 +520,7 @@ void TPagamento::remove_rate_from(int i)
// elimina dall'ultima a quella indicata (compresa)
for (int j = n_rate() - 1; j >= i; j--)
_rate.destroy(j);
_dirty = TRUE;
_dirty = true;
}
@ -529,7 +529,7 @@ TToken_string& TPagamento::add_rata()
// rata vuota, con -1 sulla scadenza per segnalare
TToken_string* tt = new TToken_string("-1| | | | | | | ");
_rate.add(tt);
_dirty = TRUE;
_dirty = true;
return *tt;
}
@ -547,7 +547,7 @@ TToken_string& TPagamento::add_rata(real perc, int day, int type, const char* ul
tt->add(""); // importo lire
_rate.add(tt);
_dirty = TRUE;
_dirty = true;
return *tt;
}
@ -576,7 +576,7 @@ TToken_string& TPagamento::set_rata (int index, real perc, int day, int type,
else
{
_rate.add(tt,index);
_dirty = TRUE;
_dirty = true;
}
return *tt;
}
@ -659,7 +659,7 @@ TToken_string& TPagamento::set_rata(int index, const real& impval, const real& i
else
{
_rate.add(tt, index);
_dirty = TRUE;
_dirty = true;
}
return *tt;
}
@ -699,7 +699,7 @@ word TPagamento::validate() const
tot.round(_roundlit);
// serve per fatture in valuta, onde evitare cazzi e canguri
real tmax = importo_da_dividere(FALSE) + importo_da_non_dividere(FALSE);
real tmax = importo_da_dividere(false) + importo_da_non_dividere(false);
tmax.round(_roundlit);
if (tot != tmax) res |= P_TOTNCLIT;
@ -717,7 +717,7 @@ word TPagamento::validate() const
tot.round(_roundval);
// serve per fatture in valuta, onde evitare cazzi e canguri
real tmax = importo_da_dividere(TRUE) + importo_da_non_dividere(TRUE);
real tmax = importo_da_dividere(true) + importo_da_non_dividere(true);
tmax.round(_roundval);
if (tot != tmax)
@ -763,7 +763,7 @@ void TPagamento::strerr(word err, TString& s)
s << "- l'importo dato e' superiore al massimo possibile\n";
if (err & P_TOTNCLIT)
{
const real tot = importo_da_dividere(FALSE) + importo_da_non_dividere(FALSE);
const real tot = importo_da_dividere(false) + importo_da_non_dividere(false);
real imp;
for (int i = 0; i < n_rate(); i++)
imp += tlit_rata(i);
@ -774,7 +774,7 @@ void TPagamento::strerr(word err, TString& s)
}
if (err & P_TOTNCVAL)
{
const real tot = importo_da_dividere(TRUE) + importo_da_non_dividere(TRUE);
const real tot = importo_da_dividere(true) + importo_da_non_dividere(true);
real imp;
for (int i = 0; i < n_rate(); i++)
imp += tval_rata(i);
@ -815,7 +815,7 @@ const char* TPagamento::desc_tpr() const
const char* TPagamento::desc_tipo(int tipo, char ulc, bool* ok) const
{
const char* o = "";
if (ok != NULL) *ok = TRUE;
if (ok != NULL) *ok = true;
if (ulc > ' ')
{
const char key[3] = { tipo+'0', toupper(ulc), '\0' };
@ -826,7 +826,7 @@ const char* TPagamento::desc_tipo(int tipo, char ulc, bool* ok) const
if (err == NOERR)
o = clr.get("S0"); // Bravo merlo: <clr> e' locale!
else if (ok != NULL)
*ok = FALSE;
*ok = false;
*/
o = cache().get("%CLR", key).get("S0");
}
@ -844,7 +844,7 @@ const char* TPagamento::desc_tipo(int tipo, char ulc, bool* ok) const
case 7: o = "Tratta accettata"; break;
case 8: o = "Rapporti interban. diretti"; break;
case 9: o = "Bonifici"; break;
default: if (ok != NULL) *ok = FALSE; break;
default: if (ok != NULL) *ok = false; break;
}
}
return o;
@ -858,7 +858,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
// parametri: tutti i const char* possono essere NULL, il che vuol dire
// che i dati corrispondenti non sono stati modificati;
// se new_value non e' NULL puo' essere la percentuale (e
// allora is_perc_modified e' TRUE) o l'importo. Non e'
// allora is_perc_modified e' true) o l'importo. Non e'
// possibile modificare entrambi; se succede viene data
// priorita' alla percentuale.
{
@ -896,7 +896,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
ss.add(typ,2);
tt.add(ulc,5);
ss.add(ulc,5);
need_recalc = TRUE;
need_recalc = true;
// no error is possible
}
}
@ -914,7 +914,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
TToken_string& ss = (TToken_string&)srate[k];
tt.add(ulc,5);
ss.add(ulc,5);
need_recalc = TRUE;
need_recalc = true;
// no error is possible
}
}
@ -953,7 +953,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
next_scad(ddd,scad_rata(j), mcomm,j);
ttt.add(ddd.string(),3);
sss.add(ddd.string(),3);
need_recalc = TRUE;
need_recalc = true;
}
}
else
@ -973,22 +973,22 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
TToken_string& ss = (TToken_string&)srate[row];
tt.add(sc,0);
ss.add(sc,0);
need_recalc = TRUE;
need_recalc = true;
}
}
if (new_value != NULL)
{
need_recalc = TRUE;
need_recalc = true;
// questa la subappaltiamo, per evitare l'inferno
return change_value(row, real(new_value), rdiff, is_perc_modified, mcomm, TRUE);
return change_value(row, real(new_value), rdiff, is_perc_modified, mcomm, true);
}
if (new_lire != NULL)
{
need_recalc = TRUE;
need_recalc = true;
// questa pure la subappaltiamo, sempre per evitare l'inferno
return change_value(row, real(new_lire), rdiff, is_perc_modified, mcomm, FALSE);
return change_value(row, real(new_lire), rdiff, is_perc_modified, mcomm, false);
}
}
else // i != row modified
@ -1050,9 +1050,9 @@ word TPagamento::change_value(int rata, real user_val, int rdiff, bool is_perc,
// e si e' modificato l'importo in valuta
adjust_perc_imp(is_perc, rdiff, valuta);
// se era in valuta e ho modificato le percentuali aggiustalo anche in lire
if (valuta && is_perc) adjust_perc_imp(is_perc, rdiff, FALSE);
if (valuta && is_perc) adjust_perc_imp(is_perc, rdiff, false);
}
_dirty = TRUE;
_dirty = true;
}
return err;
@ -1080,7 +1080,7 @@ word TPagamento::change_value_differenziate(int row, real user_val, bool is_perc
to_subtract = importo_da_non_dividere(v);
real user_div = user_val - to_subtract;
const int first = _tpr > 3 ? 1 : 0;
_rdiff = TRUE;
_rdiff = true;
if (!sign_ok(user_div, row))
return P_NEG;
@ -1122,7 +1122,7 @@ word TPagamento::change_value_uguali(int row, real user_val, bool is_perc, bool
real remainder = to_share - user_div;
const int tok_ind = is_perc ? 1 : (v ? 4 : 7);
const int first = _tpr > 3 ? 1 : 0;
_rdiff = FALSE;
_rdiff = false;
if (!sign_ok(user_div, row))
return P_NEG;
@ -1218,7 +1218,7 @@ word TPagamento::change_value_uguali(int row, real user_val, bool is_perc, bool
word TPagamento::change_value_uguali_prossima(int row, real user_val, bool is_perc, bool v)
{
_rdiff = TRUE;
_rdiff = true;
// uguali finche' possibile da row in poi; residuo su first
// importi totali, da non suddividere, da suddividere
real to_share = is_perc ? CENTO : importo_da_dividere(v);
@ -1264,7 +1264,7 @@ word TPagamento::change_value_uguali_prossima(int row, real user_val, bool is_pe
word TPagamento::change_value_uguali_possible(int row, real user_val, bool is_perc, bool v)
{
_rdiff = TRUE;
_rdiff = true;
// uguali finche' possibile da row in poi; residuo come rata a parte
real to_share = is_perc ? CENTO : importo_da_dividere(v);
real to_subtract = ZERO;
@ -1469,15 +1469,15 @@ void TPagamento::adjust_perc_imp(bool is_perc, int rdiff, bool v)
bool TPagamento::read(TTable* t, TTable* r)
{
// puo' chiamarla chiunque
bool istnew = FALSE;
bool istnew = false;
if (t == NULL)
{
t = new TTable("%CPG");
istnew = TRUE;
istnew = true;
}
_rate.destroy();
t->zero(); t->put("CODTAB", _code);
if (t->read() != NOERR) return FALSE;
if (t->read() != NOERR) return false;
// set everything
@ -1499,11 +1499,11 @@ bool TPagamento::read(TTable* t, TTable* r)
_inizio.set_day(30);
// leggi rate e scadenze
bool isrnew = FALSE;
bool isrnew = false;
if (r == NULL)
{
r = new TTable("%RPG");
isrnew = TRUE;
isrnew = true;
}
TString16 s;
@ -1529,7 +1529,7 @@ bool TPagamento::read(TTable* t, TTable* r)
if (istnew) delete t;
if (isrnew) delete r;
return TRUE;
return true;
}
@ -1686,9 +1686,7 @@ const real& TPagamento::importo_da_non_dividere(bool v) const
void TPagamento::set_total(const real& ib, const real& im, const real& sp)
{
_in_valuta = FALSE;
// _cambio = 1.0;
_in_valuta = false;
_firstr = _secndr = ZERO; // Azzera importi in valuta
init_total(ib, im, sp, NULL); // setta regolarmente totali in lire
}
@ -1696,22 +1694,17 @@ void TPagamento::set_total(const real& ib, const real& im, const real& sp)
void TPagamento::set_total_valuta(const real& ib, const real& im, const real& sp, const real& c,
const real& ibl, const real& iml, const real& spl, const char* codval)
{
CHECKS(codval && *codval && TCurrency::get_firm_val() != codval, "Valuta non valida ", codval);
CHECKS(is_true_value(codval), "Valuta non valida ", codval);
const bool era_valuta = _in_valuta;
_in_valuta = TRUE;
/*
_cambio = c;
if (_cambio.sign() <= 0)
_cambio = real(1.0);
*/
_in_valuta = true;
// setta regolarmente totali in lire
init_total(ibl, iml, spl, NULL);
// ripeti tutto con la valuta
init_total(ib, im, sp, codval);
if (!era_valuta && _in_valuta)
adjust_perc_imp(TRUE, _rdiff, TRUE);
adjust_perc_imp(true, _rdiff, true);
}
void TPagamento::init_total(const real& ib, const real& im, const real& sp, const char* codval)
@ -1735,7 +1728,7 @@ void TPagamento::init_total(const real& ib, const real& im, const real& sp, cons
ibp = ib; ibp.round(round);
imp = im; imp.round(round);
spp = sp; spp.round(round);
_inited = TRUE;
_inited = true;
// istanzia _firstr e _secndr a seconda di _tpr
switch(_tpr)
@ -1781,7 +1774,7 @@ void TPagamento::set_sheet(TSheet_field& sf, int sscad)
if (_tpr > 3)
add_rata(ZERO, sscad <= 0 ? 0 : sscad, _def_tpr, _def_ulc);
add_rata(CENTO, sscad <= 0 ? (_tpr < 4 ? 0 : 30) : sscad, _def_tpr, _def_ulc);
_dirty = TRUE;
_dirty = true;
}
if (_inited)
@ -1814,7 +1807,7 @@ void TPagamento::set_sheet(TSheet_field& sf, int sscad)
}
for (int d = sf.items()-1; d >= i; d--)
sf.destroy(d, FALSE);
sf.destroy(d, false);
sf.enable_column(2, in_valuta());
}
@ -1839,7 +1832,7 @@ void TPagamento::set_sheet(TSheet_field& sf, int sscad)
}
for (int d = sf.items()-1; d >= i; d--)
sf.destroy(d, FALSE);
sf.destroy(d, false);
}
const bool abilita = _tpr <= 3;
@ -1973,9 +1966,9 @@ void TPagamento::adjust_refused_scad()
TPagamento::TPagamento(const char* codtab, const char* data) :
_code(codtab), _imponval(0.0), _imposval(0.0), _speseval(0.0),
_imponlit(0.0), _imposlit(0.0), _speselit(0.0), _new(FALSE), _mcomm(FALSE), // _cambio(1.0),
_rdiff(FALSE), _tpr(0), _dirty(FALSE), _inited(FALSE), _roundlit(0), _roundval(3), _int_rate(30),
_def_tpr(1), _def_ulc(""), _was_tpr4(FALSE), _in_valuta(FALSE), _tipocf('C'), _codcf(0L)
_imponlit(0.0), _imposlit(0.0), _speselit(0.0), _new(false), _mcomm(false), // _cambio(1.0),
_rdiff(false), _tpr(0), _dirty(false), _inited(false), _roundlit(0), _roundval(3), _int_rate(30),
_def_tpr(1), _def_ulc(""), _was_tpr4(false), _in_valuta(false), _tipocf('C'), _codcf(0L)
{
_fixd[0] = _fixd[1] = _fixd[2] = 0;
if (data != NULL && *data)
@ -1985,5 +1978,5 @@ TPagamento::TPagamento(const char* codtab, const char* data) :
_datadoc = _inizio;
if (_code.blank() || !read())
_new = TRUE;
_new = true;
}

View File

@ -10,7 +10,7 @@ bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool t
static int last_checked = -1;
// parse CODTAB of pim record
TString ctab = pimr.get("CODTAB");
const TString80 ctab = pimr.get("CODTAB");
const int tipocr = atoi(ctab.mid(15,1)); // tipo costo_ricavo
const int tipodet = atoi(ctab.mid(20,1)); // tipo detraibilita'
@ -21,7 +21,7 @@ bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool t
const bool rimb = pimr.get_bool("B3");
const bool ricl = pimr.get_bool("B4");
TString tipoiva = pimr.get("S5");
const TString4 tipoiva = pimr.get("S5");
// cominciamo cosi'
imp = ZERO; iva = ZERO;

View File

@ -1,3 +1,3 @@
21
0
$saldi|0|0|143|0|Saldi|NCF+NCON||
$saldi|0|0|143|0|Saldi|||

View File

@ -6,13 +6,13 @@ CONTO|2|3|0|Conto
SOTTOCONTO|3|6|0|Sottoconto
FLSCA|8|1|0|Saldi di movimenti scaricati
FLAGSALINI|1|1|0|Saldo iniziale in <D>are, <A>vere
SALDO|4|18|2|Saldo iniziale
SALDO|4|18|3|Saldo iniziale
FLAGSALFIN|1|1|0|Saldo di chiusura in <D>are, <A>vere
SALDOFIN|4|18|2|Saldo di chiusura
PDARE|4|18|2|Progressivo dare
PAVERE|4|18|2|Progressivo avere
PDAREPRO|4|18|2|Progressivo dare movimenti provvisori
PAVEREPRO|4|18|2|Progressivo avere movimenti provvisori
SALDOFIN|4|18|3|Saldo di chiusura
PDARE|4|18|3|Progressivo dare
PAVERE|4|18|3|Progressivo avere
PDAREPRO|4|18|3|Progressivo dare movimenti provvisori
PAVEREPRO|4|18|3|Progressivo avere movimenti provvisori
DATAULMOV|5|8|0|Data ultimo movimento
NUMULTMOV|3|7|0|Numero operazione dell'ultimo movimento
2

View File

@ -1,3 +1,3 @@
23
0
$mov|0|0|357|0|Movimenti di prima nota|||
$mov|0|0|365|0|Movimenti di prima nota|||

View File

@ -1,5 +1,5 @@
23
44
45
ANNOES|9|4|0|Codice esercizio
NUMREG|3|7|0|Numero di operazione
DATAREG|5|8|0|Data operazione
@ -33,6 +33,7 @@ CODVALI|1|3|0|Codice valuta intra-comunitaria
CAMBIOI|4|15|6|Cambio della valuta intra-comunitaria
CORRLIRE|4|18|3|Corrispettivo in lire intra-comunitario
CORRVALUTA|4|18|3|Corrispettivo in valuta intra-comunitario
DATACOMPI|5|8|0|Data di competenza intra-comunitaria
OCFPI|1|16|0|Codice cliente / fornitore occasionale
CODPAG|1|4|0|Codice pagamento
INVIATO|8|1|0|Inviato ad altra contabilita'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

View File

@ -503,7 +503,7 @@ void TSchedacdc::main_loop()
relrmov.add(LF_MOV, "NUMREG==NUMREG");
// filtro
TString filtro = "";
if (_codes != 0)
if (_codes > 0)
filtro.format("ANNOES==%d", _codes);
if (dacdc.not_empty())
{
@ -603,7 +603,11 @@ void TSchedacdc::main_loop()
}
}
aggiorna_totali(importo, datareg);
if (datareg >= _dataini && datareg <= _datafin)
bool da_stampare = !_dataini.ok() || datareg >= _dataini;
if (da_stampare)
da_stampare = !_datafin.ok() || datareg <= _datafin;
if ( da_stampare)
print_movimento(sortcur);
}
if (num > 0)

View File

@ -48,7 +48,7 @@ BEGIN
OUTPUT F_ANNO CODTAB
FLAGS "RZ"
ADD RUN cg0 -5 esc
CHECKTYPE REQUIRED
CHECKTYPE NORMAL
WARNING "Codice esercizio obbligatorio"
END

View File

@ -7,7 +7,7 @@ int main(int argc, char** argv)
const int op = argc < 2 ? 0 : argv[1][1]-'0';
switch (op)
{
// case 1: cm1200(argc,argv); break; //
case 1: cm1100(argc,argv); break; //..per adesso c'e' solo lui...
default: cm1100(argc,argv); break; //stampa pagato per commessa
}
exit(0);

View File

@ -11,6 +11,7 @@
#include <rmoviva.h>
#include "..\cg\cgsaldac.h"
#include "..\cg\cg2103.h"
#include "..\ve\velib.h"
#include "cm1100a.h"
@ -73,6 +74,8 @@ void TPag_per_cms_configmask::config_setter(TSheet_field& sf, const char* paragr
{
TConfig config("cm1100.ini", paragrafo);
config.remove_all(); //svuota il paragrafo sul .ini prima di ricompilarlo (se non si facesse
//non si riuscirebbero ad ammazzare le righe sul .ini
FOR_EACH_SHEET_ROW (sf, i, row)
{
TToken_string conto("", '.');
@ -130,15 +133,21 @@ public:
long _codforn;
TDate _datapag;
TCurrency _importopagato;
TCurrency _importopagato_prec;
TString _descrpagamento;
TString _numfat;
TDate _datafat;
long _protiva;
TCurrency _totfat;
long _nreg;
TBill _conto; //gruppocontosottoconto
TString _commessa;
TString _fase;
TCurrency _importocommessa;
TPag_per_cms_struct() : _tipo(0), _codforn(0), _nreg(0) { }
TPag_per_cms_struct() : _tipo(0), _codforn(0), _nreg(0), _protiva(0) { }
};
bool TPag_per_cms_struct::_ordina_forn = false;
@ -159,17 +168,21 @@ int TPag_per_cms_struct::compare(const TSortable& s) const
}
else
{
cmp = _commessa.compare(pcs._commessa);
cmp = _commessa.compare(pcs._commessa); //ordinamento per commessa
if (cmp == 0)
{
cmp = _tipo - pcs._tipo;
cmp = _fase.compare(pcs._fase); //sotto-ordinamento per fase
if (cmp == 0)
{
//caso pagamento o costo non saldacontato
if (_tipo == 0)
cmp = _nreg - pcs._nreg;
else
cmp = _conto.compare(pcs._conto);
cmp = _tipo - pcs._tipo; //sotto-sotto-ordinamento per tipo pagamento
if (cmp == 0)
{
//caso pagamento o costo non saldacontato
if (_tipo == 0)
cmp = _nreg - pcs._nreg;
else
cmp = _conto.compare(pcs._conto);
}
}
}
}
@ -190,20 +203,24 @@ class TPag_per_cms_form : public TForm
TArray& _righe; //puntatore all'arrayone dei pagamenti
int _curr_pag; //pagamento corrente
TAssoc_array _tot_fatt; //assoc_array contenente i movimenti che generano i pagamenti
TCurrency _totpagcms; //totale pagamenti sulla commessa
TCurrency _totfatcms; //totale fatture per commessa
TCurrency _totpagcms, _totpagfsc; //totale pagamenti sulla commessa e sulla fase
protected:
virtual long records() const {return _righe.items();}
virtual bool validate(TForm_item &cf, TToken_string &s);
const TString& prev_cms() const;
const TString& prev_fsc() const;
const long prev_forn() const;
const TString& next_cms() const;
// const TString& next_cms() const;
int prev_type () const;
const TPag_per_cms_struct& curr() const { return(TPag_per_cms_struct&)_righe[_curr_pag]; }
void print_title (const char * title);
void stampa_totali();
void stampa_totali_fase();
void azzera_totali();
void azzera_totali_fase();
public:
void print(const TMask& m);
@ -219,6 +236,14 @@ const TString& TPag_per_cms_form::prev_cms() const
return prev._commessa;
}
const TString& TPag_per_cms_form::prev_fsc() const
{
if (_curr_pag <= 0)
return EMPTY_STRING;
const TPag_per_cms_struct& prev = (const TPag_per_cms_struct&)_righe[_curr_pag-1];
return prev._fase;
}
const long TPag_per_cms_form::prev_forn() const
{
if (_curr_pag <= 0)
@ -227,13 +252,13 @@ const long TPag_per_cms_form::prev_forn() const
return prev._codforn;
}
const TString& TPag_per_cms_form::next_cms() const
/*const TString& TPag_per_cms_form::next_cms() const
{
if (_curr_pag >= _righe.last())
return EMPTY_STRING;
const TPag_per_cms_struct& next = (const TPag_per_cms_struct&)_righe[_curr_pag+1];
return next._commessa;
}
}*/
int TPag_per_cms_form::prev_type() const
{
@ -254,42 +279,89 @@ void TPag_per_cms_form::print_title (const char * title)
void TPag_per_cms_form::azzera_totali()
{
_tot_fatt.destroy();
_totfatcms = ZERO; //azzera il totale pagamenti della commessa per non sommarlo alla commessa successiva
_totpagcms = ZERO;
}
void TPag_per_cms_form::stampa_totali()
{
stampa_totali_fase();
TPrintrow pr;
TString80 str;
TCurrency tot;
if (TPag_per_cms_struct::_ordina_forn)
pr.put("@bTotali per fornitore", 21);
else
pr.put("@bTotali per commessa", 21);
FOR_EACH_ASSOC_OBJECT(_tot_fatt, h, k, obj)
{
const TPag_per_cms_residual* imp = (const TPag_per_cms_residual*)obj;
tot += imp->_fatt;
}
const int tipo = prev_type(); //astruso modo per poter stampare il totale imputato nel caso di movimenti..
str = tipo > 0 ? _totpagcms.string(true) : tot.string(true); //..senza doc di vendita;si deve usare il tipo prec..
str.right_just(15);
pr.put(str, 102);
str = _totpagcms.string(true);
str.right_just(15);
pr.put(str, 117);
/* const TCurrency residuo = _totfatcms - _totpagcms;
if (!residuo.is_zero())
{
str = residuo.string(true);
str.right_just(15);
pr.put(str, 132);
}*/ //****non serve piu'
printer().print(pr);
azzera_totali();
}
void TPag_per_cms_form::azzera_totali_fase()
{
_tot_fatt.destroy();
_totpagfsc = ZERO;
}
void TPag_per_cms_form::stampa_totali_fase()
{
TPrintrow pr;
pr.put("@bTotali per fase", 21);
TString80 str;
TCurrency tot;
FOR_EACH_ASSOC_OBJECT(_tot_fatt, h, k, obj)
{
const TPag_per_cms_residual* imp = (const TPag_per_cms_residual*)obj;
tot += imp->_fatt;
}
TString80 str;
str = tot.string(true);
const int tipo = prev_type(); //astruso modo per poter stampare il totale imputato nel caso di movimenti..
str = tipo > 0 ? _totpagfsc.string(true) : tot.string(true); //..senza doc di vendita;si deve usare il tipo prec..
str.right_just(15); //x' l'ultima riga utile per la stampa tot e' quella prima di quella corrente
pr.put(str, 102);
str = _totpagfsc.string(true);
str.right_just(15);
pr.put(str, 83);
str = _totpagcms.string(true);
str.right_just(15);
pr.put(str, 100);
pr.put(str, 117);
const TCurrency residuo = tot - _totpagcms;
/* const TCurrency residuo = tot - _totpagfsc;
if (!residuo.is_zero())
{
str = residuo.string(true);
str.right_just(15);
pr.put(str, 116);
}
pr.put(str, 132);
}*/ //****non serve piu'
_totfatcms += tot;
_totpagcms += _totpagfsc;
printer().print(pr);
azzera_totali();
//stampa solo se != zero almeno una cifra
if (!tot.is_zero() || !_totpagfsc.is_zero())
printer().print(pr);
azzera_totali_fase();
}
bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
@ -324,7 +396,7 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
{
const TString& cms = curr()._commessa;
cambio = cms != prev_cms();
titolo = cms;
titolo << cms << " " << cache().get("CMS", cms, "S0");
}
if (cambio)
@ -338,6 +410,28 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
if (titolo.not_empty())
print_title(titolo);
}
return true;
}
if (s == "_CODFSC")
{
bool cambio = false;
TString80 titolo;
const TString& fsc = curr()._fase;
cambio = fsc != prev_fsc();
titolo << fsc << " " << cache().get("FSC", fsc, "S0");
if (cambio)
{
if (_curr_pag > 0)
stampa_totali_fase();
if (titolo.not_empty())
{
titolo.insert(" ");
print_title(titolo);
}
}
else
{
const int tipo = curr()._tipo;
@ -345,10 +439,10 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
{
switch (tipo)
{
case 1:print_title("Costi");break;
case 2:print_title("Pagamenti");break;
case 3:print_title("Ritenute Fiscali");break;
case 4:print_title("Ritenute Sociali");break;
case 1:print_title(" Costi");break;
case 2:print_title(" Pagamenti");break;
case 3:print_title(" Ritenute Fiscali");break;
case 4:print_title(" Ritenute Sociali");break;
default:break;
}
}
@ -367,6 +461,7 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
{
mov = new TPag_per_cms_residual;
mov->_fatt = curr()._importocommessa;
mov->_pag = curr()._importopagato_prec;
_tot_fatt.add(str, mov); //agginge nreg ed importo all'array dei totali
}
return true;
@ -402,36 +497,60 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
return true;
}
if (s == "_DESCGRCOST")
{
cf.set(curr()._conto.descrizione());
return true;
}
if (s == "_DESCRPAG")
{
cf.set(curr()._descrpagamento);
return true;
}
if (s == "_CODFORN")
if (s == "_NFAT")
{
TString80 str;
if (TPag_per_cms_struct::_ordina_forn)
str << curr()._commessa;
else
{
if (curr()._codforn > 0)
str.format("%6ld", curr()._codforn);
}
cf.set(curr()._numfat);
return true;
}
if (s == "_DATAFAT")
{
cf.set(curr()._datafat.string());
return true;
}
if (s == "_PROTIVA")
{
TString str;
str << curr()._protiva;
cf.set(str);
return true;
}
if (s == "_TOTDOC")
if (s == "_TOTFAT")
{
cf.set(curr()._importocommessa.get_num().string());
cf.set(curr()._totfat.get_num().string());
return true;
}
if (s == "_TOTIMP")
{
const int tipo = curr()._tipo;
if (tipo > 0) //caso pagamenti senza documento di vendita (deve essere = a _TOTPAG)
cf.set(curr()._importopagato.get_num().string());
else
cf.set(curr()._importocommessa.get_num().string()); //caso pagamenti da documento vendita
return true;
}
if (s == "_TOTPAG")
{
cf.set(curr()._importopagato.get_num().string());
_totpagcms += curr()._importopagato;
_totpagfsc += curr()._importopagato;
TString8 str;
str << curr()._nreg;
@ -444,18 +563,60 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
if (s == "_TOTRES")
{
TString8 str;
str << curr()._nreg;
TCurrency residuo;
TPag_per_cms_residual* mov = (TPag_per_cms_residual*) _tot_fatt.objptr(str);
if (mov != NULL)
residuo = mov->_fatt - mov->_pag; //residuo = totale movimento - quanto e' stato finora pagato del movimento
cf.set(residuo.get_num().string());
const int tipo = curr()._tipo;
if (tipo == 0)
{
TCurrency residuo = curr()._importocommessa - curr()._importopagato_prec;
cf.set(residuo.get_num().string());
}
else
cf.set("");
return true;
}
if (s == "_CODFORN")
{
TString80 str;
if (!TPag_per_cms_struct::_ordina_forn)
str << curr()._codforn;
cf.set(str);
return true;
}
if (s == "_CODCMS_B")
{
TString80 str;
if (TPag_per_cms_struct::_ordina_forn)
str << curr()._commessa;
cf.set(str);
return true;
}
if (s == "_DESFORN")
{
TString80 str;
if (!TPag_per_cms_struct::_ordina_forn)
{
const long forn = curr()._codforn;
if (forn > 0)
{
TString16 key;
key.format("F|%ld", forn);
str << " " << cache().get(LF_CLIFO, key, CLI_RAGSOC);
}
}
cf.set(str);
}
if (s == "_DESCMS_B")
{
TString80 str;
if (TPag_per_cms_struct::_ordina_forn)
str << cache().get("CMS", curr()._commessa, "S0");
cf.set(str);
}
return TForm::validate(cf,s);
}
@ -496,6 +657,7 @@ void TPag_per_cms_form::print(const TMask& m)
_curr_pag = 0;
azzera_totali();
azzera_totali_fase();
//aggiunge una riga vuota (ppcs vuoto) per forzare il totale dell'ultima commessa
TPag_per_cms_struct* ppcs = new TPag_per_cms_struct;
_righe.add(ppcs);
@ -543,8 +705,15 @@ protected:
bool cerca_fiscali(const TBill& bill) const;
bool cerca_sociali(const TBill& bill) const;
void add_importo(TAssoc_array& assoc, const TRectype& rmov) const;
int cerca_riga_fattura_origine(const TPartita& match, const TRectype& riga_pag);
real calcola_pagato_prec(const TPartita& match, const int riga_fatt, const TRectype& riga_pag);
void crea_righe_stampa(TAssoc_array& assoc, const int tipo);
real totale_documento(const TRectype& mov) const;
bool test_swap(TCausale& caus, bool ritsoc) const;
public:
void scan_pags();
void scan_movs();
@ -623,17 +792,104 @@ bool TPag_per_cms::cms_in_range(const TString& codcms, const TString& codfase) c
return true;
}
// Controlla sulla causale se il segno del totale documento (ritsoc=FALSE)
// o quello delle ritenute sociali (ritsoc=TRUE) e' invertito rispetto al normale
bool TPag_per_cms::test_swap(TCausale& caus, bool ritsoc) const
{
const char sez = ritsoc ? caus.sezione_ritsoc() : caus.sezione_clifo();
const bool s = (caus.iva() == iva_vendite) ^ (sez == 'D');
return s;
}
// Calcola il totale del documento tenendo conto del segno della prima riga e di quella delle
// ritenute sociali sulla causale
real TPag_per_cms::totale_documento(const TRectype& mov) const
{
real tot = mov.get_real(MOV_TOTDOC); // Legge totale
const real ritfis = mov.get_real(MOV_RITFIS);
tot += ritfis; // Somma ritenute fiscali
const real ritsoc = mov.get_real(MOV_RITSOC);
if (!ritsoc.is_zero())
{
TCausale caus(mov.get(MOV_CODCAUS));
const bool swapt = test_swap(caus, false); // Totale invertito ?
const bool swaps = test_swap(caus, true); // Ritenute sociali invertite ?
if (swapt ^ swaps) // Somma ritenute sociali con segno
tot -= ritsoc;
else
tot += ritsoc;
}
return tot;
}
int TPag_per_cms::cerca_riga_fattura_origine(const TPartita& match, const TRectype& riga_pag)
{
//scansione delle righe partita passata, precedenti alla riga_pag
const int k = riga_pag.get_int(PART_NRIGA);
for (int i = match.pred(k); i > 0; i = match.pred(i))
{
const TRiga_partite& riga_part = match.riga(i);
if (riga_part.is_fattura())
{
for (int j = riga_part.rate(); j > 0; j--)
{
if (match.esiste(i, j, k)) //se esiste il pagamento k della rata j della riga partita i contenente la fattura
return i;
}
}
}
return 0;
}
real TPag_per_cms::calcola_pagato_prec(const TPartita& match, const int riga_fatt, const TRectype& riga_pag)
{
real pagato = ZERO;
if (riga_fatt > 0)
{
const int k = riga_pag.get_int(PART_NRIGA);
const TDate data_rif = riga_pag.get(_campodata); //data di riferimento selezionata sulla maschera
const TRiga_partite& riga_part = match.riga(riga_fatt);
for (int i = riga_part.rate(); i > 0; i--)
{
TRiga_scadenze& sc = riga_part.rata(i);
for (int j = sc.last(); j > 0; j = sc.pred(j))
{
const TRiga_partite& pag = match.riga(j);
const TDate datapag = pag.get_date(_campodata);
const long cmp = datapag - data_rif;
//la riga pagamento e' da considerare quando ha data anteriore a quella di riferimento oppur
//ha data uguale ma numero di registrazione inferiore (insomma, il pagamento e' precedente
//a quello di riga_pag)
if (cmp < 0 || (cmp == 0 && j <= k))
{
pagato += pag.get_real(PAGSCA_IMPORTO);
}
}
}
}
return pagato;
}
//prepara l'assoc con tutte le righe da mandare in stapa per quanto riguarda i movimenti con
//saldaconto (siano essi con o senza iva)
void TPag_per_cms::find_commesse(const long nreg, const TRectype& riga_pag)
{
TMovimentoPN pn;
pn.curr().put(MOV_NUMREG, nreg);
if (pn.read() == NOERR)
{
real totdoc_cms;
real totdoc;
TAssoc_array commesse;
const TRectype& movfat = pn.curr();
//se movimento iva..
real totdoc_cms;
real totdoc, totdoc_netto;
TAssoc_array commesse;
//Movimenti CON SALDACONTO
//se movimento IVA..
if (pn.iva_items() > 0)
{
for (int i = 0; i < pn.iva_items(); i++)
@ -641,15 +897,22 @@ void TPag_per_cms::find_commesse(const long nreg, const TRectype& riga_pag)
const TRectype& rmoviva = pn.iva(i);
const TString& codcms = rmoviva.get(RMI_CODCMS);
const TString& codfase = rmoviva.get(RMI_FASCMS);
if (cms_in_range(codcms, codfase))
const TBill conto(rmoviva);
if (cms_in_range(codcms, codfase) && conto.indicatore_bilancio() != 5)
{
TToken_string cms_fsc = codcms;
if (codfase.not_empty())
cms_fsc.add(codfase);
const real importo = rmoviva.get_real(RMI_IMPONIBILE);
real imposta = rmoviva.get_real(RMI_IMPOSTA);
real* imp = (real*)commesse.objptr(codcms);
real* imp = (real*)commesse.objptr(cms_fsc);
if (imp == NULL)
{
imp = new real;
commesse.add(codcms, imp);
commesse.add(cms_fsc, imp);
}
*imp += importo;
totdoc_cms += importo;
@ -676,50 +939,93 @@ void TPag_per_cms::find_commesse(const long nreg, const TRectype& riga_pag)
}
}
totdoc = pn.curr().get_real(MOV_TOTDOC);
totdoc = totale_documento(pn.curr()); //tot doc con ritenute fiscali + ritenute sociali (da stampare)
totdoc_netto = pn.curr().get_real(MOV_TOTDOC); //questo si usa solo per il calcolo del residuo
}
else //..movimento NON iva
else //..movimento NON iva (sempre con saldaconto)
{
for (int i = 0; i < pn.cg_items(); i++)
{
const TRectype& rmov = pn.cg(i);
const TBill conto(rmov);
if (conto.tipo() > ' ')
continue;
if (cerca_fiscali(conto) || cerca_sociali(conto))
continue;
TImporto importo(rmov.get_char(RMV_SEZIONE), rmov.get_real(RMV_IMPORTO));
importo.normalize('D');
if (conto.tipo() > ' ')
{
totdoc -= importo.valore();
totdoc_netto -= importo.valore(); //valore per il calcolo del residuo
continue;
}
if (cerca_fiscali(conto) || cerca_sociali(conto))
{
totdoc -= importo.valore(); //valore da stampare nella colonna Tot.fattura con ritenute
continue;
}
const TString& codcms = rmov.get(RMV_CODCMS);
const TString& codfase = rmov.get(RMV_FASCMS);
if (cms_in_range(codcms,codfase))
if (cms_in_range(codcms,codfase) && conto.indicatore_bilancio() != 5)
{
real* imp = (real*)commesse.objptr(codcms);
TToken_string cms_fsc = codcms;
if (codfase.not_empty())
cms_fsc.add(codfase);
real* imp = (real*)commesse.objptr(cms_fsc);
if (imp == NULL)
{
imp = new real;
commesse.add(codcms, imp);
commesse.add(cms_fsc, imp);
}
*imp += importo.valore();
totdoc_cms += importo.valore();
}
totdoc += importo.valore();
}
}
const real totpagato = riga_pag.get_real(PART_IMPORTO);
const real percentuale = totpagato / totdoc;
//parte comune a movimenti IVA e non (vengono anche qui considerate le ritenute fiscali
//e sociali perche' possono essere state inserite direttamente nella partita e non nel movimento
//(quindi non si puo' in questo caso applicare la totale_documento()
//Le ritenute fiscali vanno sempre sommate..
real totpagato = riga_pag.get_real(PART_IMPORTO) + riga_pag.get_real(PART_RITENUTE);
//Le ritenute sociali invece vanno testate con la test_swap..
const real ritsoc = riga_pag.get_real(PART_RITSOC);
if (!ritsoc.is_zero())
{
const TRectype& mov = pn.curr();
TCausale caus(mov.get(MOV_CODCAUS));
const bool swapt = test_swap(caus, false); // Totale invertito ?
const bool swaps = test_swap(caus, true); // Ritenute sociali invertite ?
if (swapt ^ swaps) // Somma ritenute sociali con segno
totpagato -= ritsoc;
else
totpagato += ritsoc;
}
const real percentuale = totpagato / totdoc_netto;
//calcolo del residuo (solo movimenti saldacontati)
//mi servono,dalla riga partita che viene passata,i valori dei campi per la chiave del
//file delle scadenze
const TPartita match(riga_pag);
//ci serve la riga di fattura che origina la nostra riga pagamento
const int riga_fatt = cerca_riga_fattura_origine(match, riga_pag);
//quanto era stato pagato del documento prima della attuale riga_pag
const real totpagato_prec = calcola_pagato_prec(match, riga_fatt, riga_pag);
const real perc_prec = totpagato_prec / totdoc_netto;
TGeneric_distrib distributore(totdoc_cms * percentuale, TCurrency::get_firm_dec());
TGeneric_distrib distributore_prec(totdoc_cms * perc_prec, TCurrency::get_firm_dec());
{
FOR_EACH_ASSOC_OBJECT(commesse, h, k, imp)
{
const real& impcms = *(real*)imp;
distributore.add(impcms);
distributore_prec.add(impcms); //distributore di importo pagato sulle commesse
}
}
@ -727,15 +1033,25 @@ void TPag_per_cms::find_commesse(const long nreg, const TRectype& riga_pag)
{
const real& impcms = *(real*)imp;
TPag_per_cms_struct* ppcs = new TPag_per_cms_struct;
// campi del pagamento
ppcs->_tipo = 0; //movimenti da saldaconto
ppcs->_codforn = riga_pag.get_long(PART_SOTTOCONTO);
ppcs->_datapag = riga_pag.get_date(_campodata);
ppcs->_importopagato.set_num(distributore.get()); //pagamento nella partita
ppcs->_importopagato_prec.set_num(distributore_prec.get()); //pagamenti precedenti al
ppcs->_descrpagamento = riga_pag.get(PART_DESCR);
// campi della fattura
ppcs->_nreg = nreg;
ppcs->_numfat = movfat.get(MOV_NUMDOC);
ppcs->_datafat = movfat.get_date(MOV_DATADOC);
ppcs->_protiva = movfat.get_long(MOV_PROTIVA);
ppcs->_totfat = totdoc; //questo e' quello che viene stampato in Tot.fattura
TToken_string cms_fsc = k;
ppcs->_commessa = k;
ppcs->_commessa = cms_fsc.get(0);
ppcs->_fase = cms_fsc.get(1);
ppcs->_importocommessa.set_num(impcms); //importo da pagare scritto sulla fattura
_righe.add(ppcs); //aggiunge il pagamento all'array dei pagamenti
@ -749,6 +1065,8 @@ void TPag_per_cms::add_importo(TAssoc_array& assoc, const TRectype& rmov) const
TToken_string chiave;
conto.add_to(chiave, 0);
chiave.add(rmov.get(RMV_CODCMS));
chiave.add(rmov.get(RMV_FASCMS));
chiave.add(rmov.get(RMV_NUMREG));
TImporto* importo = (TImporto*)assoc.objptr(chiave);
if (importo == NULL)
@ -763,6 +1081,7 @@ void TPag_per_cms::add_importo(TAssoc_array& assoc, const TRectype& rmov) const
*importo += imp;
}
//prepara gli oggetti (_righecosti,_righepagamenti) contenenti le righe dei pagamenti senza saldaconto
void TPag_per_cms::find_commesse_cg(const long nreg)
{
TMovimentoPN pn;
@ -774,6 +1093,7 @@ void TPag_per_cms::find_commesse_cg(const long nreg)
const TRectype& rmov = pn.cg(i);
const TString& codcms = rmov.get(RMV_CODCMS);
const TString& codfase = rmov.get(RMV_FASCMS);
if (cms_in_range(codcms,codfase))
{
const TBill conto(rmov);
@ -877,8 +1197,8 @@ bool TPag_per_cms::part_callback(const TRelation& rel, void* pJolly)
TPag_per_cms* app = (TPag_per_cms*)pJolly;
const TRectype& riga_part_pag = rel.curr();
const long nreg = app->find_movimento(riga_part_pag);
if (nreg > 0)
const long nreg = app->find_movimento(riga_part_pag); //prima cerco un movimento della fattura...
if (nreg > 0) //..se ne trovo almeno uno cerco la commessa corrispondente
app->find_commesse(nreg, riga_part_pag);
return true;
}
@ -891,10 +1211,12 @@ void TPag_per_cms::scan_pags()
TRectype darec(LF_PARTITE);
TRectype arec(LF_PARTITE);
darec.put(PART_TIPOCF, 'F');
arec.put(PART_TIPOCF, 'F');
darec.put(PART_GRUPPO, 0);
darec.put(PART_CONTO, 0);
arec = darec;
if (dacodfor > 0)
darec.put(PART_SOTTOCONTO, dacodfor);
if (acodfor >= acodfor)
if (acodfor >= dacodfor)
arec.put(PART_SOTTOCONTO, acodfor);
TString filtro = "(TIPOMOV>=\"3\")"; //deve essere un pagamento a fornitore!!!
@ -941,7 +1263,7 @@ void TPag_per_cms::scan_movs()
if (dataini.ok())
darec.put(MOV_DATAREG, dataini);
if (datafin.ok())
arec.put(MOV_DATAREG, dataini);
arec.put(MOV_DATAREG, datafin);
}
else
{
@ -988,14 +1310,15 @@ void TPag_per_cms::crea_righe_stampa(TAssoc_array& assoc, const int tipo)
TPag_per_cms_struct* ppcs = new TPag_per_cms_struct;
ppcs->_tipo = tipo; //movimenti di costo/pagamento
ppcs->_codforn = 0;
// ppcs->_datapag = riga_pag.get_date(_campodata);
ppcs->_datapag = cache().get(LF_MOV, tok.get(5), MOV_DATACOMP);
ppcs->_importopagato.set_num(imp.valore()); //pagamento nella partita
ppcs->_nreg = 0;
ppcs->_nreg = tok.get_long(5);
ppcs->_commessa = tok.get(3);
ppcs->_fase = tok.get(4);
ppcs->_conto.get(tok, 0);
ppcs->_descrpagamento = ppcs->_conto.descrizione();
ppcs->_descrpagamento = cache().get(LF_MOV, tok.get(5), MOV_DESCR);
_righe.add(ppcs); //aggiunge il pagamento all'array dei pagamenti e lo spedisce in stampa
}
@ -1034,9 +1357,19 @@ void TPag_per_cms::main_loop()
}
TPag_per_cms_struct::_ordina_forn = _mask->get_bool(F_ORDINAMENTO);
_righe.destroy(); //azzera l'arrayone dei pagamenti
_righe.destroy(); //azzera gli arrayoni dei pagamenti e roba simile
_righecosti.destroy();
_righepagamenti.destroy();
_righefiscali.destroy();
_righesociali.destroy();
scan_pags();
scan_movs();
//se c'e' un filtro sui fornitori, non si fa lo scan dei movimenti senza saldaconto
const long dacodfor = _mask->get_long(F_DACODFOR);
const long acodfor = _mask->get_long(F_ACODFOR);
if (dacodfor == 0 && acodfor == 0)
scan_movs();
if (_righe.items() > 0)
{

View File

@ -15,11 +15,12 @@
#define FR_HO_ACODFOR 23
#define FR_HO_ADESFOR 24
#define FR_HO_FORNCMS 25
#define FR_HO_FORNCMSDES 26
#define FR_HL_CODCMS 30
#define FR_BO_TIPORIGA 31
#define FR_BO_DESC 32
#define FR_BO_TIPORIGA 32
#define FR_BO_DESC 33

View File

@ -2,12 +2,12 @@
SECTION GRAPHICS ODD
LINEA -1 132 1
LINEA -1 196 1
BEGIN
PROMPT 1 7 "@b"
END
LINEA -1 132 1
LINEA -1 196 1
BEGIN
PROMPT 1 9 "@b"
END
@ -27,14 +27,14 @@ END
STRINGA -1
BEGIN
KEY "Data"
PROMPT 115 1 "Data "
PROMPT 180 1 "Data "
MESSAGE _TODAY
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
PROMPT 50 2 "@bPAGATO PER COMMESSA / FORNITORE"
PROMPT 70 2 "@bPAGATO PER COMMESSA / FORNITORE"
END
DATA FR_HO_DATAINI
@ -55,22 +55,22 @@ BEGIN
PROMPT 1 4 "@bDa comm.@r "
END
STRINGA FR_HO_DADESC 35
STRINGA FR_HO_DADESC 60
BEGIN
KEY "da descr commessa"
PROMPT 30 4 ""
PROMPT 31 4 ""
END
STRINGA FR_HO_ACDC
BEGIN
KEY "a codice commessa"
PROMPT 66 4 "@bA comm.@r "
PROMPT 96 4 "@bA comm.@r "
END
STRINGA FR_HO_ADESC 35
STRINGA FR_HO_ADESC 60
BEGIN
KEY "a descr commessa"
PROMPT 93 4 ""
PROMPT 125 4 ""
END
STRINGA FR_HO_DACFSC
@ -79,7 +79,7 @@ BEGIN
PROMPT 1 5 "@bDa fase@r "
END
STRINGA FR_HO_DADESFSC 43
STRINGA FR_HO_DADESFSC
BEGIN
KEY "da descrizione fase"
PROMPT 20 5 ""
@ -88,13 +88,13 @@ END
STRINGA FR_HO_ACFSC
BEGIN
KEY "a codice fase"
PROMPT 66 5 "@bA fase@r "
PROMPT 96 5 "@bA fase@r "
END
STRINGA FR_HO_ADESFSC
BEGIN
KEY "a descrizione fase"
PROMPT 81 5 ""
PROMPT 114 5 ""
END
STRINGA FR_HO_DACODFOR
@ -103,7 +103,7 @@ BEGIN
PROMPT 1 6 "@bDal forn.@r "
END
STRINGA FR_HO_DADESFOR 48
STRINGA FR_HO_DADESFOR
BEGIN
KEY "da ragsoc"
PROMPT 17 6 ""
@ -112,15 +112,17 @@ END
STRINGA FR_HO_ACODFOR
BEGIN
KEY "a codice fornitore"
PROMPT 66 6 "@bAl forn.@r "
PROMPT 96 6 "@bAl forn.@r "
END
STRINGA FR_HO_ADESFOR
BEGIN
KEY "a ragsoc"
PROMPT 84 6 ""
PROMPT 111 6 ""
END
//------Legenda campi--------//
STRINGA -1
BEGIN
KEY "numero registrazione"
@ -139,44 +141,74 @@ BEGIN
PROMPT 22 8 "@bDescrizione pagamento"
END
STRINGA FR_HO_FORNCMS
STRINGA -1
BEGIN
KEY "codice fornitore"
PROMPT 63 8 "@b"
KEY "numero fattura"
PROMPT 62 8 "@bN. doc"
END
STRINGA -1
BEGIN
KEY "data fattura"
PROMPT 70 8 "@bData doc"
END
STRINGA -1
BEGIN
KEY "protocollo iva"
PROMPT 82 8 "@bProt."
END
STRINGA -1
BEGIN
KEY "totale fattura"
PROMPT 85 8 "@bTotale fattura"
PROMPT 92 8 "@bTot.fattura"
END
STRINGA -1
BEGIN
KEY "totale imputato"
PROMPT 106 8 "@bTot.imputato"
END
STRINGA -1
BEGIN
KEY "totale pagamento"
PROMPT 101 8 "@bTotale pagamento"
PROMPT 120 8 "@bTot.pagamento"
END
STRINGA -1
BEGIN
KEY "totale residuo"
PROMPT 118 8 "@bTotale residuo"
PROMPT 137 8 "@bTot.residuo"
END
STRINGA FR_HO_FORNCMS
BEGIN
KEY "codice fornitore"
PROMPT 150 8 "@b"
END
STRINGA FR_HO_FORNCMSDES
BEGIN
KEY "descrizione fornitore"
PROMPT 168 8 "@b"
END
END // section header odd
// riga con solo il codice commessa ed una riga vuota
SECTION HEADER LAST 3
SECTION HEADER LAST 2
STRINGA FR_HL_CODCMS
BEGIN
KEY "codice commessa"
KEY "codice+descrizione"
PROMPT 1 2 "@b"
END
END //section header last
// riga di stampa (utilizzata per ogni gruppo/conto/sottoconto e per tutti i totali)
// riga di stampa (utilizzata per ogni tipo di riga pagamento e per tutti i totali)
SECTION BODY ODD 1
STRINGA -1
@ -205,26 +237,38 @@ BEGIN
FLAGS "H"
END
STRINGA -1
BEGIN
KEY "codice fase"
PROMPT 1 1 ""
MESSAGE _CODFSC
END
NUMERO -1 7
BEGIN
KEY "numero registrazione"
PROMPT 1 1 ""
MESSAGE _NREG
GROUP 1
END
DATA -1
BEGIN
KEY "data pagamento"
PROMPT 10 1 ""
PROMPT 9 1 ""
MESSAGE _DATAPAG
GROUP 1
END
STRINGA FR_BO_DESC 40
BEGIN
KEY "descrizione pagamento"
PROMPT 20 1 ""
MESSAGE _DESCRPAG
END
NUMERO -1 3
BEGIN
KEY "gruppo"
PROMPT 3 1 ""
PROMPT 62 1 ""
MESSAGE _GRUPPO
GROUP 2
END
@ -232,7 +276,7 @@ END
NUMERO -1 3
BEGIN
KEY "conto"
PROMPT 7 1 ""
PROMPT 66 1 ""
MESSAGE _CONTO
GROUP 2
END
@ -240,48 +284,97 @@ END
NUMERO -1 6
BEGIN
KEY "sottoconto"
PROMPT 11 1 ""
PROMPT 70 1 ""
MESSAGE _SOTTOCONTO
GROUP 2
END
STRINGA FR_BO_DESC 40
STRINGA -1 26
BEGIN
KEY "descrizione pagamento"
PROMPT 22 1 ""
MESSAGE _DESCRPAG
KEY "descrizione gr/co/sottoc"
PROMPT 77 1 ""
MESSAGE _DESCGRCOST
GROUP 2
END
STRINGA -1
BEGIN
KEY "codice fornitore/commessa"
PROMPT 63 1 ""
MESSAGE _CODFORN
GROUP 1
KEY "numero fattura"
PROMPT 62 1 ""
MESSAGE _NFAT
END
DATA -1
BEGIN
KEY "data fattura"
PROMPT 70 1 ""
MESSAGE _DATAFAT
END
NUMERO -1 5
BEGIN
PROMPT 82 1 ""
MESSAGE _PROTIVA
END
VALUTA -1 15
BEGIN
KEY "totale fattura"
PROMPT 84 1 ""
MESSAGE _TOTDOC
GROUP 1
PROMPT 88 1 ""
MESSAGE _TOTFAT
END
VALUTA -1 15
BEGIN
KEY "totale pagamento"
PROMPT 101 1 ""
KEY "totale imputato"
PROMPT 103 1 ""
MESSAGE _TOTIMP
END
VALUTA -1 15
BEGIN
KEY "totale pagato"
PROMPT 118 1 ""
MESSAGE _TOTPAG
END
VALUTA -1 15
BEGIN
KEY "totale residuo"
PROMPT 117 1 ""
PROMPT 133 1 ""
MESSAGE _TOTRES
END
STRINGA -1 7
BEGIN
KEY "codice fornitore"
PROMPT 150 1 ""
MESSAGE _CODFORN
GROUP 1
END
STRINGA -1 20
BEGIN
KEY "codice commessa"
PROMPT 150 1 ""
MESSAGE _CODCMS_B
END
STRINGA -1 37
BEGIN
KEY "descrizione fornitore"
PROMPT 158 1 ""
MESSAGE _DESFORN
GROUP 1
END
STRINGA -1 25
BEGIN
KEY "descrizione commessa"
PROMPT 171 1 ""
MESSAGE _DESCMS_B
END
STRINGA -1
BEGIN
KEY "avanza 1 pagamento"

View File

@ -30,7 +30,7 @@ END
RADIOBUTTON F_TIPODATA 76
BEGIN
PROMPT 2 2 "Tipologia di data"
PROMPT 2 2 "Estrazione per data di: "
ITEM "0|Registrazione"
ITEM "1|Documento"
ITEM "2|Pagamento"
@ -95,6 +95,8 @@ BEGIN
COPY DISPLAY F_DACDC
OUTPUT F_ACDC CODTAB
CHECKTYPE SEARCH
STR_EXPR (#F_ACDC=="")||(#F_ACDC>=#F_DACDC)
WARNING "Il codice commessa finale non puo' essere inferiore a quello iniziale"
END
STRING F_AFSC 10
@ -106,6 +108,8 @@ BEGIN
COPY DISPLAY F_DAFSC
OUTPUT F_AFSC CODTAB
CHECKTYPE SEARCH
STR_EXPR (#F_AFSC=="")||(#F_AFSC>=#F_DAFSC)
WARNING "Il codice fase finale non puo' essere inferiore a quello iniziale"
END
GROUPBOX DLG_NULL 78 4
@ -150,6 +154,8 @@ BEGIN
OUTPUT F_ACODFOR CODCF
OUTPUT F_ADESFOR RAGSOC
CHECKTYPE NORMAL
NUM_EXPR (#F_ACODFOR==0)||(#F_ACODFOR>=#F_DACODFOR)
WARNING "Il codice fornitore finale non puo' essere inferiore a quello iniziale"
END
STRING F_ADESFOR 50

View File

@ -41,6 +41,7 @@ struct _ParmStruct
seltype _selections;
expltype _explosion;
valtype _valorization;
bool _advanced_val;
TExplosion_grouping _group_by;
TString_array _numerazioni;
TString16 _anno_es, _catven, _codlist, _from_num, _to_num, _sl_mag, _mb_mag; // Ma perche'...
@ -327,118 +328,131 @@ inline TEsplosione_distinta_app& app() { return (TEsplosione_distinta_app&)main_
///////////////////////////////////////////////////////////////////
// Callback & funzione per valorizzazione nodi
///////////////////////////////////////////////////////////////////
static real valorizza(const TRiga_esplosione& re, const _CallBackStruct* c)
static real valorizza_nodo(TDistinta_tree & node, _CallBackStruct & c)
{
CHECK(c, "Invalid parameter struct passed");
real total;
TString80 dis(re.articolo());
TString16 liv(re.giacenza());
TAssoc_array* valori = c._a;
TToken_string path;
node.curr_id(path);
real * valore = (real *) valori->objptr(path);
if (valore != NULL)
return *valore;
if (dis.not_empty())
{
TAssoc_array* valori = c->_a;
_ParmStruct * pp = c->_p;
TString80 cod(dis);
if (liv.not_empty())
cod << ',' << liv;
real* val = (real*)valori->objptr(cod);
if (val == NULL)
{
const char tipo = re.tipo();
switch (tipo)
{
case 'A':
{
const TArticolo_giacenza art(dis);
TString& annoes = pp->_anno_es;
TString& catven = pp->_catven;
TString& codlist = pp->_codlist;
TString16 codmag;
if (pp->_val_magmb) // Se non c'e' _val_magmb non c'e' nemmeno _val_depmb
{ // Quindi codmag rimane a zero e la valorizzazione viene fatta su tutti i mag.
codmag = pp->_mb_mag;
if (!pp->_val_depmb && codmag.len() > 3)
codmag.cut(3); // se non deve valorizzare sul deposito lo accorciamo
}
switch (pp->_valorization)
{
case last_cost: total = art.ultimo_costo(annoes); break;
case last2cost: total = art.media_costi(annoes); break;
case std_cost: total = art.costo_standard(annoes); break;
case average_cost: total = art.costo_medio(annoes, codmag, liv); break;
case pond_cost: total = art.costo_mediopond(annoes, codmag, liv); break;
case LIFO_annuale: total = art.LIFO_annuale(annoes, codmag, liv); break;
case FIFO_annuale: total = art.FIFO_annuale(annoes, codmag, liv); break;
case LIFO_storico: total = art.LIFO(annoes, codmag, liv); break;
case FIFO_storico: total = art.FIFO(annoes, codmag, liv); break;
case prezzo_listino: total = art.prezzo_listino(annoes, catven, codlist); break;
default: NFCHECK("Tipo valorizzazione errato: %d", pp->_valorization);
}
}
break;
case 'L':
{
const TLavorazione lav(dis);
total = lav.prezzo();
}
break;
case 'V':
{
total = real(cache().get(LF_DIST, dis, "PREZZO"));
}
break;
default :
NFCHECK("L'articolo %s non esiste", (const char*)dis);
}
valori->add(cod, total);
}
else
total = *val;
}
return total;
}
static bool valorizza_nodo(TTree& node, void* jolly, word when)
{
if (when == SCAN_PRE_ORDER)
{
TArray exploded;
TToken_string __path;
_CallBackStruct* c = (_CallBackStruct*) jolly;
TAssoc_array* valori = c->_a;
TDistinta_tree& dist_node = (TDistinta_tree&) node;
dist_node.curr_id(__path);
if (dist_node.goto_firstson())
{
dist_node.explode(exploded, TRUE, RAGGR_EXP_BASE);
dist_node.goto_node(__path);
const int items = exploded.items(); // Se 0 siamo su di una foglia...
real totale; // Somma dei valori di tutti i materiali di base sottostanti
for (int i = 0; i < items; i++)
{
TRiga_esplosione& re = (TRiga_esplosione&) exploded[i];
// Valore per questa riga (NB si sta calcolando il valore unitario dei componenti di UNA distinta)
// ed intanto memorizza i valori dei singoli materiali di base in cache
// Per i materiali di base si memorizza soltanto il cod.articolo+liv.giac
totale += re.val() * valorizza(re, c);
}
// Memorizza nell'array il valore di questo nodo memorizzato in total
// La chiave per questo nodo e' tutto il path dalla radice...(comprensivo di livello di gaicenza)
real* val = (real*)valori->objptr(__path);
if (val == NULL)
valori->add(__path, totale);
}
_ParmStruct * pp = c._p;
real totale;
TCodice_articolo codart;
TString16 liv;
TCodice_um um;
real qta = node.curr_qta();
TString& annoes = pp->_anno_es;
TString& catven = pp->_catven;
TString16 codmag;
TString& codlist = pp->_codlist;
const bool dettagliata = pp->_advanced_val;
bool valorizzato = FALSE;
const char tipo = node.curr_type();
real valore_un;
node.curr_um(um);
node.curr_code(codart);
node.curr_giaclev(liv);
if (pp->_val_magmb) // Se non c'e' _val_magmb non c'e' nemmeno _val_depmb
{ // Quindi codmag rimane a zero e la valorizzazione viene fatta su tutti i mag.
codmag = pp->_mb_mag;
if (!pp->_val_depmb && codmag.len() > 3)
codmag.cut(3); // se non deve valorizzare sul deposito lo accorciamo
}
return FALSE;
if (dettagliata && tipo == 'A')
{
TArticolo_giacenza & art = TExplode_distinta_form::cache_articoli().art(codart);
const int art_tipo = art.get_int(ANAMAG_VALDIST);
if (art_tipo > 0)
{
const TDate inizio_val = art.get_date(ANAMAG_DATAVDIST);
if (pp->_obs_date >= inizio_val)
{
valorizzato = TRUE;
switch ((valtype) art_tipo)
{
case last_cost: valore_un = art.ultimo_costo(annoes); break;
case last2cost: valore_un = art.media_costi(annoes); break;
case std_cost: valore_un = art.costo_standard(annoes); break;
case average_cost: valore_un = art.costo_medio(annoes, codmag, liv); break;
case pond_cost: valore_un = art.costo_mediopond(annoes, codmag, liv); break;
case LIFO_annuale: valore_un = art.LIFO_annuale(annoes, codmag, liv); break;
case FIFO_annuale: valore_un = art.FIFO_annuale(annoes, codmag, liv); break;
case LIFO_storico: valore_un = art.LIFO(annoes, codmag, liv); break;
case FIFO_storico: valore_un = art.FIFO(annoes, codmag, liv); break;
case prezzo_listino: valore_un = art.prezzo_listino(annoes, catven, codlist); break;
default: NFCHECK("Tipo valorizzazione errato: %d", (valtype) art_tipo);
}
valore_un = art.convert_to_um(valore_un, um);
}
}
}
if (!valorizzato)
{
if (node.has_son())
{
for (bool ok = node.goto_firstson(); ok ; ok = node.goto_rbrother())
valore_un += valorizza_nodo(node, c);
node.goto_father();
}
else
{
switch (tipo)
{
case 'A':
{
TArticolo_giacenza & art = TExplode_distinta_form::cache_articoli().art(codart);
const valtype val = pp->_valorization;
switch (val)
{
case last_cost: valore_un = art.ultimo_costo(annoes); break;
case last2cost: valore_un = art.media_costi(annoes); break;
case std_cost: valore_un = art.costo_standard(annoes); break;
case average_cost: valore_un = art.costo_medio(annoes, codmag, liv); break;
case pond_cost: valore_un = art.costo_mediopond(annoes, codmag, liv); break;
case LIFO_annuale: valore_un = art.LIFO_annuale(annoes, codmag, liv); break;
case FIFO_annuale: valore_un = art.FIFO_annuale(annoes, codmag, liv); break;
case LIFO_storico: valore_un = art.LIFO(annoes, codmag, liv); break;
case FIFO_storico: valore_un = art.FIFO(annoes, codmag, liv); break;
case prezzo_listino: valore_un = art.prezzo_listino(annoes, catven, codlist); break;
default: NFCHECK("Tipo valorizzazione errato: %d", val); break;
}
valore_un = art.convert_to_um(valore_un, um);
}
break;
case 'L':
{
TLavorazione lav(codart);
valore_un = lav.prezzo();
}
break;
case 'D':
valore_un = real(cache().get(LF_DIST, codart, "PREZZO"));
break;
case 'V':
NFCHECK("L'articolo %s porca COVER", (const char*)codart);
break;
default :
NFCHECK("L'articolo %s non esiste", (const char*)codart);
break;
}
}
}
valori->add(path, valore_un);
const real valore_totale = valore_un * qta;
return valore_totale;
}
/////////////////////////////////////////////////////////////
@ -1170,23 +1184,12 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
// Il valore lo calcola per qualsiasi tipo riga
if (_p->_valorization > no_val)
{
if (re.mat_base())
{
k = re.articolo();
if (re.giacenza().not_empty())
k << ',' << re.giacenza();
}
else
k = re.path(); // I nodi sono cachati con tutto il path in modo da essere univoci
k = re.path(); // I nodi sono cachati con tutto il path in modo da essere univoci
if (_valori.objptr(k) == NULL)
r = ZERO;
r2p->set_unitary_value(ZERO);
else
r = *(real*)_valori.objptr(k);
if (re.mat_base())
r2p->set_unitary_value(r);
else
r2p->set_unitary_value(r / re.val());
r2p->set_unitary_value(*((real*)_valori.objptr(k)));
if (_p->_fabbisogno)
r = r2p->unitary_value() * r2p->qta2order();
@ -1265,7 +1268,7 @@ void TExplode_distinta_form::explode_and_print()
setter._p = _p; //
setter._a = &_valori; //
_distinta.set_root(_d->cod(), "", 1.0, _d->liv());
_distinta.scan_depth_first(valorizza_nodo, &setter);
valorizza_nodo(_distinta, setter);
}
// Ora scorre l'array locale delle righe esplosione, settando quello
@ -1868,6 +1871,7 @@ void TEsplosione_distinta_app::main_loop()
_parameters._selections = (seltype) _mask->get_int(F_TIPOSEL);
_parameters._explosion = (expltype) _mask->get_int(F_STAMPA);
_parameters._valorization = (valtype) _mask->get_int(F_VALORIZZAZIONE);
_parameters._advanced_val = _mask->get_bool(F_ADVANCED_EXPL);
_parameters._group_by = (TExplosion_grouping) _mask->get_int(F_GROUPMODE);
_parameters._year = _mask->get_int(F_ANNO);
_parameters._from_num = _mask->get(F_NUMFROM);

View File

@ -50,6 +50,7 @@
#define F_LINEA 148
#define F_DESCLIN 149
#define F_SORTFOR 150
#define F_ADVANCED_EXPL 151
#define F_CODDIS 101
#define F_LIV1 102

View File

@ -361,48 +361,39 @@ END
LISTBOX F_VALORIZZAZIONE 32
BEGIN
PROMPT 3 12 ""
PROMPT 1 12 ""
ITEM "0|Non valorizzare"
MESSAGE HIDE,G_LISTINO@
MESSAGE HIDE,G_LISTINO@|CLEAR,F_ADVANCED_EXPL
ITEM "1|Valorizza Ultimo costo"
MESSAGE HIDE,G_LISTINO@
MESSAGE HIDE,G_LISTINO@|ENABLE,F_ADVANCED_EXPL
ITEM "2|Valorizza Costo medio"
MESSAGE HIDE,G_LISTINO@
MESSAGE HIDE,G_LISTINO@|ENABLE,F_ADVANCED_EXPL
ITEM "10|Prezzo listino"
MESSAGE SHOW,G_LISTINO@
MESSAGE SHOW,G_LISTINO@|ENABLE,F_ADVANCED_EXPL
ITEM "3|Valorizza Costo medio ponderato"
MESSAGE HIDE,G_LISTINO@
MESSAGE HIDE,G_LISTINO@|ENABLE,F_ADVANCED_EXPL
ITEM "4|Valorizza Media ultimi 2 costi"
MESSAGE HIDE,G_LISTINO@
MESSAGE HIDE,G_LISTINO@|ENABLE,F_ADVANCED_EXPL
ITEM "5|Valorizza Costo standard"
MESSAGE HIDE,G_LISTINO@
MESSAGE HIDE,G_LISTINO@|ENABLE,F_ADVANCED_EXPL
ITEM "6|Valorizza LIFO annuale"
MESSAGE HIDE,G_LISTINO@
MESSAGE HIDE,G_LISTINO@|ENABLE,F_ADVANCED_EXPL
ITEM "7|Valorizza LIFO storico"
MESSAGE HIDE,G_LISTINO@
MESSAGE HIDE,G_LISTINO@|ENABLE,F_ADVANCED_EXPL
ITEM "8|Valorizza FIFO annuale"
MESSAGE HIDE,G_LISTINO@
MESSAGE HIDE,G_LISTINO@|ENABLE,F_ADVANCED_EXPL
ITEM "9|Valorizza FIFO storico"
MESSAGE HIDE,G_LISTINO@
MESSAGE HIDE,G_LISTINO@|ENABLE,F_ADVANCED_EXPL
END
STRING F_CATVEN_LIST 2
BOOLEAN F_ADVANCED_EXPL
BEGIN
PROMPT 57 12 "Cat.vendita "
USE CVE
INPUT CODTAB F_CATVEN_LIST
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione @50" S0
DISPLAY "Provvigione" R0
DISPLAY "Gruppo" I1
DISPLAY "Conto" I2
OUTPUT F_CATVEN_LIST CODTAB
GROUP G_LISTINO
PROMPT 38 12 "Dettagliata "
END
STRING F_CODLIST 3
BEGIN
PROMPT 39 12 "Cod.listino "
PROMPT 52 12 "Cod.listino "
USE LF_CONDV SELECT TIPO=="L"
INPUT TIPO "L"
INPUT CATVEN F_CATVEN_LIST
@ -417,6 +408,19 @@ BEGIN
GROUP G_LISTINO
END
STRING F_CATVEN_LIST 2
BEGIN
PROMPT 72 12 "Cat.vendita "
USE CVE
INPUT CODTAB F_CATVEN_LIST
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione @50" S0
DISPLAY "Provvigione" R0
DISPLAY "Gruppo" I1
DISPLAY "Conto" I2
OUTPUT F_CATVEN_LIST CODTAB
GROUP G_LISTINO
END
GROUPBOX DLG_NULL 50 6
BEGIN
PROMPT 2 13 "Disponibilita' & Valorizzazione"

View File

@ -1,9 +1,7 @@
#include <applicat.h>
#include <currency.h>
#include <filetext.h>
#include <form.h>
#include <mask.h>
#include <relation.h>
#include <printer.h>
#include <progind.h>
@ -57,10 +55,9 @@ protected:
bool ok_write(void);
void aggiorna_rb(TCursor*);
void aggiorna_dist(TCursor*);
bool test_record_type(const TString& key) const;
public:
int base_no() const { return _base_page_no; }
const TMask& msk() const { return *_msk; }
const TRelation& firm_rel() const { return *_firmrel; }
@ -831,6 +828,17 @@ bool TDistinta_form::validate(TForm_item &cf, TToken_string &s)
valore = _firmrel->curr().get("RAGSOC");
valore.strip_d_spaces();
cf.set(valore);
} else
if (in == "CFPI")
{
valore = _firmrel->curr(LF_ANAG).get("PAIV");
valore.trim();
if (valore.empty())
{
valore = _firmrel->curr(LF_ANAG).get("COFI");
valore.trim();
}
cf.set(valore);
}
}
valore = cf.get();
@ -1022,9 +1030,20 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr
const int indice = atoi(in);
valore = string.get(indice-1);
}
} else
if (in == "CFPI")
{
const TRectype& curr = app().firm_rel().curr(LF_ANAG);
valore = curr.get("PAIV");
valore.trim();
if (valore.empty())
{
valore = curr.get("COFI");
valore.trim();
}
}
else
CHECKS (TRUE,"Sotto-Macro _DITTA non definita",(const char *)in);
else
CHECKS(FALSE, "Sotto-Macro _DITTA non definita: ",(const char *)in);
}
else if (code == "_DEBITORE")
{
@ -1105,8 +1124,10 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr
valore = clifo_1.get("PAIV");
valore.trim();
if (valore.empty())
{
valore = clifo_1.get("COFI");
valore.trim();
valore.trim();
}
}
else
CHECKS (TRUE,"Sotto-Macro _DEBITORE non definita",(const char *)in);
@ -1226,4 +1247,4 @@ int ef0500(int argc, char* argv[])
TEmissione a ;
a.run(argc, argv, TR("Emissione Effetti e Distinte"));
return 0;
}
}

View File

@ -345,7 +345,7 @@ ENDPAGE
ENDMASK
PAGE "Rate" -1 -1 60 9
PAGE "Rate" -1 -1 60 10
NUMBER F_RIGADIST 4
BEGIN
@ -427,9 +427,9 @@ BEGIN
FLAGS "D"
END
BUTTON F_PAGA 10 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 "~Paga"
PROMPT -13 -1 ""
END
BUTTON DLG_CANCEL 10 2
@ -437,9 +437,9 @@ BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_OK 10 2
BUTTON F_PAGA 10 2
BEGIN
PROMPT -33 -1 ""
PROMPT -33 -1 "~Paga"
END
ENDPAGE

View File

@ -416,7 +416,13 @@ MESSAGE(4) = _FISSO,!2
NAME(5)=CAMPO BLANK
TYPE(5)=FISSO
POSITION(5)=90
LENGTH(5)=30
LENGTH(5)=10
NAME(6)=PARTITA IVA O CODICE FISCALE CREDITORE
TYPE(6)=STRINGA
POSITION(6)=100
LENGTH(6)=16
MESSAGE(6)= _DITTA,!CFPI
[RECORD 51]
NAME(0)=CAMPO BLANK

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,6 +1,6 @@
<html>
<head>
<title>CAMPO by P@rtners</title>
<title>OneRed by DoubleOne</title>
</head>

View File

@ -1,7 +1,7 @@
<html>
<head>
<title>P@artners</title>
<title>DoubleOne</title>
<link rel="stylesheet" href="../stili/stile.css">
</head>

View File

@ -1,6 +1,6 @@
<HTML>
<HEAD>
<TITLE>CAMPO by P@rtners</TITLE>
<TITLE>OneRed by DoubleOne</TITLE>
<link rel="stylesheet" href="../stili/stile.css">
<SCRIPT language=JavaScript>
@ -32,7 +32,7 @@ function flipImage(theButton, theAction)
<a href="javascript:history.back();"><img src="../images/indietro.jpg" border="0" alt="Indietro"></a>
<a href="javascript:history.go();"><img src="../images/avanti.jpg" border="0" alt="Avanti"></a>
</td>
<!-- <td colspan=4 height=60>CAMPO by P@rtners<BR></td> -->
<!-- <td colspan=4 height=60>OneRed by DoubleOne<BR></td> -->
<td colspan=4 height=60 align="right"><img src="../images/titolo.gif"></td>
</TR>

View File

@ -2,7 +2,7 @@
<html>
<head>
<title>P@rtners</title>
<title>DoubleOne</title>
<link rel="stylesheet" href="../stili/stile.css">
</head>

View File

@ -1,7 +1,7 @@
<html>
<head>
<title>P@rtners</title>
<title>DoubleOne</title>
<link rel="stylesheet" href="../stili/stile.css">
</head>

View File

@ -1,7 +1,7 @@
<html>
<head>
<title>P@rtners</title>
<title>DoubleOne</title>
<link rel="stylesheet" href="../stili/stile.css">
</head>

View File

@ -1,7 +1,7 @@
<html>
<head>
<title>P@rtners</title>
<title>DoubleOne</title>
<link rel="stylesheet" href="../stili/stile.css">
</head>

View File

@ -1,7 +1,7 @@
<html>
<head>
<title>P@rtners</title>
<title>DoubleOne</title>
<link rel="stylesheet" href="../stili/stile.css">
</head>

View File

@ -1,3 +1,3 @@
135
0
$rieprett|||157|0|Riepiloghi e rettifiche INTRA|||
$rieprett|||164|0|Riepiloghi e rettifiche INTRA|||

View File

@ -1,5 +1,5 @@
135
24
25
TIPO|7|1|0|Acquisti o Cessioni [A,C]
ANNO|2|4|0|Anno
PERIODO|9|2|0|Periodo (Mese[1,12] / Trimestre[1,4] / Anno [1.,1])
@ -24,5 +24,6 @@ PERETT|9|2|0|Periodo rettificato
NUMRETT|3|7|0|Riga rettificata
SEGNORETT|1|1|0|Segno della rettifica
FREQUENZA|1|1|0|Frequenza (<M>ensile, <T>rimestrale, <A>nnuale)
NUMREG|3|7|0|Eventuale movimento di prima nota collegato
1
TIPO+ANNO+PERIODO+NUMRIG|

View File

@ -103,8 +103,9 @@ bool TImmissione_mask::on_field_event(TOperable_field& o, TField_event e, long j
{
set(F_NUM_DOC, mov.get(MOV_NUMDOC));
set(F_DATA_DOC, mov.get(MOV_DATADOC));
set(F_DATA_INT, mov.get(MOV_DATACOMPI));
const TString16 caus(mov.get(MOV_CODCAUS));
const TString& caus = mov.get(MOV_CODCAUS);
const TCausale c(caus);
if (!c.intra())
return error_box(FR("La causale %s del movimento contabile %s non e' intracomunitaria"),
@ -282,8 +283,17 @@ bool TImmissione_mask::on_sheet_field_event(TOperable_field& o, TField_event e,
{
switch (o.dlg())
{
case F_NOMENCLATURA1:
case F_NOMENCLATURA2:
if (e == fe_modify)
{
TString4 str; str = o.get();
if (str.len() != 2)
{
str.format("%02d", atoi(str));
o.set(str);
}
}
case F_NOMENCLATURA1:
case F_NOMENCLATURA3:
if (e == fe_close)
{

View File

@ -5,7 +5,8 @@
#define F_DATA_DOC 304
#define F_NUM_DOC 305
#define F_DATA_REG 307
#define F_DATA_REG 306
#define F_DATA_INT 307
#define F_TIPO_MOV 308
#define F_TIPO_CF 310

View File

@ -53,13 +53,13 @@ END
DATA F_DATA_DOC
BEGIN
PROMPT 32 3 "Documento: data "
PROMPT 32 3 "Documento: numero "
FLAGS "D"
END
DATA F_NUM_DOC
BEGIN
PROMPT 61 3 "Numero "
PROMPT 63 3 "Data "
FLAGS "D"
END
@ -71,9 +71,15 @@ BEGIN
FIELD DATAREG
END
DATA F_DATA_INT
BEGIN
PROMPT 49 4 "Data di competenza "
FLAGS "D"
END
LIST F_TIPO_MOV 1 12
BEGIN
PROMPT 49 4 "Tipo movimento "
PROMPT 1 5 "Tipo movimento "
ITEM "C|Cessione"
MESSAGE "C",F_TIPO_CF
ITEM "A|Acquisto"
@ -83,7 +89,7 @@ END
LISTA F_TIPO_CF 1 10
BEGIN
PROMPT 1 5 ""
PROMPT 1 6 ""
FLAGS "D"
ITEM "C|Cliente"
ITEM "F|Fornitore"
@ -92,7 +98,7 @@ END
NUMBER F_CLIFO 5
BEGIN
PROMPT 16 5 ""
PROMPT 16 6 ""
USE LF_CLIFO
INPUT TIPOCF F_TIPO_CF SELECT
INPUT CODCF F_CLIFO
@ -111,7 +117,7 @@ END
STRING F_RAGSOC 50
BEGIN
PROMPT 26 5 ""
PROMPT 26 6 ""
USE LF_CLIFO KEY 2
INPUT TIPOCF F_TIPO_CF SELECT
INPUT RAGSOC F_RAGSOC
@ -125,13 +131,13 @@ END
STRING F_STATO 2
BEGIN
PROMPT 1 6 "Stato CEE "
PROMPT 1 7 "Stato CEE "
FLAGS "D"
END
STRING F_PARTITA_IVA 12
BEGIN
PROMPT 49 6 "Partita IVA "
PROMPT 49 7 "Partita IVA "
USE LF_CLIFO KEY 5
INPUT TIPOCF F_TIPO_CF SELECT
INPUT STATOPAIV F_STATO
@ -146,20 +152,20 @@ END
CURRENCY F_TOT_DOC 18
BEGIN
PROMPT 1 7 "Totale documento da controllare "
PROMPT 1 8 "Totale documento da controllare "
FIELD TOTDOC
END
CURRENCY F_TOT_IMM 18
BEGIN
PROMPT 1 8 "Totale documento immesso "
PROMPT 1 9 "Totale documento immesso "
FIELD TOTDOCIMM
FLAGS "D"
END
STRING F_VALUTA 3
BEGIN
PROMPT 66 7 "Valuta "
PROMPT 66 8 "Valuta "
FLAGS "U"
USE %VAL
INPUT CODTAB F_VALUTA
@ -174,14 +180,14 @@ END
NUMBER F_CAMBIO 18 6
BEGIN
PROMPT 53 8 "Cambio "
PROMPT 53 9 "Cambio "
CHECKTYPE REQUIRED
FIELD CAMBIO
END
SPREADSHEET F_RIGHE
BEGIN
PROMPT 0 9 ""
PROMPT 0 10 ""
ITEM "Ammontare\nOperaz.@18"
ITEM "Ammontare\nValuta@18"
ITEM "Natura\nTransaz.@7"
@ -257,10 +263,9 @@ BEGIN
WARNING "Nomenclatura combinata assente"
END
NUMBER F_NOMENCLATURA2 2
STRING F_NOMENCLATURA2 2
BEGIN
PROMPT 67 3 ""
FLAGS "Z"
COPY ALL F_NOMENCLATURA1
MESSAGE DIRTY,F_NOMENCLATURA3
VALIDATE REQIF_FUNC 1 F_NOMENCLATURA3

View File

@ -46,8 +46,17 @@ bool TRiepiloghi_mask::on_field_event(TOperable_field& o, TField_event e, long j
field(F_PROV).check_type(chk);
}
break;
case F_NOMENCLATURA1:
case F_NOMENCLATURA2:
if (e == fe_modify)
{
TString4 str; str = o.get();
if (str.len() != 2)
{
str.format("%02d", atoi(str));
o.set(str);
}
}
case F_NOMENCLATURA1:
case F_NOMENCLATURA3:
if (e == fe_close && !query_mode())
{

View File

@ -237,10 +237,9 @@ BEGIN
WARNING "Nomenclatura combinata assente"
END
NUMBER F_NOMENCLATURA2 2
STRING F_NOMENCLATURA2 2
BEGIN
PROMPT 22 10 ""
FLAGS "Z"
COPY ALL F_NOMENCLATURA1
FIELD NOMENCL[5,6]
VALIDATE REQIF_FUNC 1 F_NOMENCLATURA3

View File

@ -70,6 +70,17 @@ bool TRettifiche_mask::on_field_event(TOperable_field& o, TField_event e, long j
m.field(F_VALORE_STAT).check_type(chk);
}
break;
case F_NOMENCLATURA2:
if (e == fe_modify)
{
TString4 str; str = o.get();
if (str.len() != 2)
{
str.format("%02d", atoi(str));
o.set(str);
}
}
break;
case O_NUM_RIG:
if ((e == fe_init || e == fe_modify) && !o.empty())
{

View File

@ -34,9 +34,10 @@
#define F_SEGNO 220
#define F_NATURA_TRANS 221
#define F_NOMENCLATURA1 222
#define F_AMMONTARE 223
#define F_AMM_VALUTA 224
#define F_VALUTA 225
#define F_VALORE_STAT 226
#define F_AMMONTARE 223
#define F_AMM_VALUTA 224
#define F_VALUTA 225
#define F_VALORE_STAT 226
#define F_NOMENCLATURA2 227
#define F_NOMENCLATURA3 228
#define F_NUMREG 229

View File

@ -160,7 +160,7 @@ END
STRING O_NATURA_TRANS 1
BEGIN
PROMPT 2 7 "Natura transazione "
PROMPT 2 7 "Natura transazione "
FLAGS "DU"
END
@ -170,10 +170,10 @@ BEGIN
FLAGS "DZ"
END
NUMBER O_NOMENCLATURA2 2
STRING O_NOMENCLATURA2 2
BEGIN
PROMPT 58 7 ""
FLAGS "DZ"
FLAGS "D"
END
NUMBER O_NOMENCLATURA3 2
@ -184,7 +184,7 @@ END
CURRENCY O_AMMONTARE 18
BEGIN
PROMPT 2 8 "Ammontare "
PROMPT 2 8 "Ammontare "
FLAGS "D"
END
@ -203,7 +203,7 @@ END
CURRENCY O_VALORE_STAT 18
BEGIN
PROMPT 2 9 "Valore statistico "
PROMPT 2 9 "Valore statistico "
FLAGS "D"
END
@ -326,7 +326,7 @@ END
STRING F_NATURA_TRANS 1
BEGIN
PROMPT 2 15 "Natura transazione "
PROMPT 2 15 "Natura transazione "
FLAGS "U"
USE %INT
INPUT CODTAB F_NATURA_TRANS
@ -357,10 +357,9 @@ BEGIN
WARNING "Nomenclatura combinata assente"
END
NUMBER F_NOMENCLATURA2 2
STRING F_NOMENCLATURA2 2
BEGIN
PROMPT 58 15 ""
FLAGS "Z"
COPY ALL F_NOMENCLATURA1
VALIDATE REQIF_FUNC 1 F_NOMENCLATURA3
MESSAGE DIRTY,F_NOMENCLATURA3
@ -388,7 +387,7 @@ END
CURRENCY F_AMMONTARE 18
BEGIN
PROMPT 2 16 "Ammontare "
PROMPT 2 16 "Ammontare "
FIELD AMMLIRE
END
@ -414,10 +413,17 @@ END
CURRENCY F_VALORE_STAT 18
BEGIN
PROMPT 2 17 "Valore statistico "
PROMPT 2 17 "Valore statistico "
FIELD VALSTAT
END
NUMBER F_NUMREG 7
BEGIN
PROMPT 53 17 "Numero movimento "
FIELD NUMREG
FLAGS "D"
END
ENDPAGE
ENDMASK

View File

@ -9,7 +9,89 @@
#include "inlib01.h"
#include "in0500a.h"
#include <mov.h>
///////////////////////////////////////////////////////////
// TIntra_frequency
///////////////////////////////////////////////////////////
char TIntra_frequency::frequenza(int a, char t) const
{
const TDate d(TODAY);
if (a <= 0)
a = d.year();
switch (t)
{
case 'A': break;
case 'C': break;
case 'B': t = 'A'; break; // Rettifiche su Acquisti
case 'D': t = 'C'; break; // Rettifiche su Cessioni
default : break;
}
if (a < d.year())
{
TLocalisamfile riep(LF_RIEPRETT);
riep.put("TIPO", (char)t);
riep.put("ANNO", a);
if (riep.read(_isgteq) == NOERR)
{
if (riep.get_char("TIPO") == t && riep.get_int("ANNO") == a)
{
const char freq = riep.get_char("FREQUENZA");
if (freq != '\0')
return freq;
}
}
}
return (t == 'A') ? _freq_acq : _freq_ces;
}
int TIntra_frequency::date2periodo(const TDate& d, char tipo) const
{
const char freq = frequenza(d.year(), tipo);
if (freq == 'A')
return 1;
const int month = d.month();
if (freq == 'T')
return (month / 3) + 1;
return month;
}
int TIntra_frequency::compare_periodo(const TDate& dtcomp, const TDate& dtreg, char tipo) const
{
int cmp = dtcomp.year() - dtreg.year();
if (cmp == 0)
{
const int pc = date2periodo(dtcomp, tipo);
const int pr = date2periodo(dtreg, tipo);
cmp = pc - pr;
}
return cmp;
}
void TIntra_frequency::update()
{
const long firm = prefix().get_codditta();
const TRectype& ditta = cache().get(LF_NDITTE, firm);
_freq_ces = ditta.get_char("FREQCES");
_freq_acq = ditta.get_char("FREQACQ");
if (_freq_ces <= ' ') _freq_ces = 'T';
if (_freq_acq <= ' ') _freq_acq = 'T';
}
TIntra_frequency::TIntra_frequency()
{
update();
}
///////////////////////////////////////////////////////////
// TIntra_mask
// Maschera generica con dati utili a tutte quelle intra
///////////////////////////////////////////////////////////
@ -18,12 +100,7 @@ void TIntra_mask::on_firm_change()
{
if (is_running())
TAutomask::on_firm_change();
long firm = prefix().get_codditta();
const TRectype& ditta = cache().get(LF_NDITTE, firm);
_freq_ces = ditta.get_char("FREQCES");
_freq_acq = ditta.get_char("FREQACQ");
if (_freq_ces <= ' ') _freq_ces = 'T';
if (_freq_acq <= ' ') _freq_acq = 'T';
_freq.update();
}
short TIntra_mask::type_field() const
@ -44,55 +121,15 @@ char TIntra_mask::tipo() const
char TIntra_mask::frequenza(int a, char t) const
{
const TDate d(TODAY);
if (a <= 0)
{
if (a <= 0)
a = anno();
if (a <= 0)
a = d.year();
}
switch (t)
{
case 'B': t = 'A'; break; // Rettifiche su Acquisti
case 'D': t = 'C'; break; // Rettifiche su Cessioni
default : t = tipo(); break;
}
if (a < d.year())
{
TLocalisamfile riep(LF_RIEPRETT);
riep.put("TIPO", (char)t);
riep.put("ANNO", a);
if (riep.read(_isgteq) == NOERR)
{
if (riep.get_char("TIPO") == t && riep.get_int("ANNO") == a)
{
const char freq = riep.get_char("FREQUENZA");
if (freq != '\0')
return freq;
}
}
}
return (t == 'A') ? _freq_acq : _freq_ces;
if (t < 'A' || t > 'D')
t = tipo();
return _freq.frequenza(a, t);
}
int TIntra_mask::date2periodo(const TDate & d)
{
const char freq = frequenza(d.year());
if (freq == 'A')
return 1;
const int month = d.month();
if (freq == 'T')
return (month / 3) + 1;
return month;
}
int TIntra_mask::date2periodo(const TDate& d) const
{ return _freq.date2periodo(d, tipo()); }
const char* TIntra_mask::periodo_str() const
{
@ -318,11 +355,12 @@ bool TGenerazione_mask::genera_riepiloghi()
const int anno_r = anno();
const int peri = periodo();
int da_mese, a_mese;
const char freq = frequenza(anno_r);
const char freq = frequenza(anno_r, tipo);
if (is_riepilogo(tipo, anno_r, peri) && !yesno_box("Attenzione esiste gia' il riepilogo\nper il periodo indicato, si desidera continuare"))
return FALSE;
if (is_riepilogo(tipo, anno_r, peri) &&
!yesno_box(TR("Attenzione esiste gia' il riepilogo\nper il periodo indicato, si desidera continuare")))
return false;
switch (freq)
{
case 'T':
@ -337,18 +375,28 @@ bool TGenerazione_mask::genera_riepiloghi()
break;
}
// Range delle date di competenza (o registrazione) intra
const TDate da_data(1, da_mese, anno_r);
const TDate a_data(TDate::last_day(a_mese, anno_r), a_mese, anno_r);
// Range delle date di registrazione intra
const TDate filtro_da_data(1, 1, anno_r-1);
const TDate filtro_a_data(31,12, anno_r+1);
TRectype filter_da(LF_INTRA), filter_a(LF_INTRA);
filter_da.put("DATAREG", da_data);
filter_a.put("DATAREG", a_data);
filter_da.put("DATAREG", filtro_da_data);
filter_a.put("DATAREG", filtro_a_data);
TRelation rel(LF_INTRA);
rel.add(LF_RINTRA, "NUMREG==NUMREG");
rel.add(LF_MOV, "NUMREG==NUMREG");
const TRectype& head = rel.curr(LF_INTRA);
const TRectype& row = rel.curr(LF_RINTRA);
const TRectype& mov = rel.curr(LF_MOV);
TString filter; filter << "TIPOMOV==\"" << tipo << '"';
TCursor cur(&rel, filter, 2, &filter_da, &filter_a);
TCursor cur(&rel, filter, 2, &filter_da, &filter_a); // Cursore ordinato per data
const long items = cur.items();
if (items > 0)
{
@ -359,11 +407,18 @@ bool TGenerazione_mask::genera_riepiloghi()
pi.addstatus(1);
if (pi.iscancelled())
return warning_box(TR("Operazione annullata"));
bool rowok = rel.is_first_match(LF_RINTRA);
while (rowok)
TDate datacomp = mov.get(MOV_DATACOMPI);
if (!datacomp.ok())
datacomp = head.get_date(MOV_DATAREG);
if (datacomp >= da_data && datacomp <= a_data)
{
_riep.add(rel.curr(LF_RINTRA), rel.curr());
rowok = rel.next_match(LF_RINTRA);
bool rowok = rel.is_first_match(LF_RINTRA);
while (rowok)
{
_riep.add(row, head);
rowok = rel.next_match(LF_RINTRA);
}
}
}
}
@ -373,7 +428,7 @@ bool TGenerazione_mask::genera_riepiloghi()
const int riepiloghi = _riep.sort();
if (riepiloghi > 0)
{
TProgind pi(riepiloghi, TR("Scrittura riepiloghi intra..."), FALSE, TRUE);
TProgind pi(riepiloghi, TR("Scrittura riepiloghi intra..."), false, TRUE);
TLocalisamfile riep(LF_RIEPRETT);
riep.put("TIPO", tipo);
riep.put("ANNO", anno_r);

View File

@ -5,11 +5,25 @@
#include <automask.h>
#endif
class TIntra_mask : public TAutomask
class TIntra_frequency : public TObject
{
char _freq_ces, _freq_acq;
public:
char frequenza(int anno, char tipo) const;
int date2periodo(const TDate& d, char tipo) const;
int compare_periodo(const TDate& dtcomp, const TDate& dtreg, char tipo) const;
void update();
TIntra_frequency();
virtual ~TIntra_frequency() { }
};
class TIntra_mask : public TAutomask
{
protected:
TIntra_frequency _freq;
virtual void on_firm_change();
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
@ -18,10 +32,10 @@ protected:
virtual int anno() const pure;
public:
int date2periodo(const TDate & d);
char tipo() const;
char frequenza(int anno = 0, char tipo = '\0') const;
int periodo() const;
char frequenza(int anno = 0, char tipo = '\0') const;
int date2periodo(const TDate& d) const;
const char* periodo_str() const;
TIntra_mask(const char* name);

View File

@ -400,7 +400,6 @@ class TAVM
protected:
bool get_token(istream& instr, TString& str) const;
AVM_opcode token2opcode(const TString& str) const;
void log_error(const char* str);
int compare_tos_nos();
int find_matching(const TBytecode& bytecode, AVM_opcode op1, AVM_opcode op2 = avm_nop) const;
void execute(const TAVM_op& op);
@ -410,6 +409,7 @@ protected:
int compile_user_word(const char* n);
public:
void log_error(const char* str);
const TString& get_last_error() const { return _last_error; }
bool compile(istream& instr, TBytecode& bc);
@ -657,7 +657,7 @@ bool TAVM::compile(istream& instr, TBytecode& bytecode)
{
_last_error.cut(0) << "Unknown WORD: " << str;
log_error(_last_error);
return false;
// return false; // Non e' un errore gravissimo!
}
}
return true;
@ -1096,6 +1096,12 @@ TAVM& TAlex_virtual_machine::avm()
return *_avm;
}
void TAlex_virtual_machine::log_error(const char* str)
{
if (_avm != NULL)
_avm->log_error(str);
}
const TString& TAlex_virtual_machine::get_last_error() const
{
if (_avm != NULL)

View File

@ -37,7 +37,9 @@ public:
virtual bool set_usr_val(const TString& name, const TVariant& var);
virtual void include_libraries(bool reload = false);
void log_error(const char* msg);
const TString& get_last_error() const;
bool compile(istream& instr, TBytecode& bc);
bool compile(const char* cmd, TBytecode& bc);
bool execute(const TBytecode& bc);

View File

@ -229,7 +229,7 @@ TArray::~TArray()
if (ok())
{
destroy();
delete _data;
delete [] _data;
}
}

View File

@ -78,7 +78,8 @@ public:
// @cmember Ritorna l'oggetto che precede quello corrente
TObject* operator-- ()
{ return pred_item( ); };
virtual ~TContainer() { }
};
// @doc EXTERNAL

Some files were not shown because too many files have changed in this diff Show More