diff --git a/ba/ba0.cpp b/ba/ba0.cpp index 2be2de8c1..6bead72c6 100755 --- a/ba/ba0.cpp +++ b/ba/ba0.cpp @@ -1302,8 +1302,15 @@ bool TMenu_application::check_user() #endif TLocalisamfile users(LF_USER); - TString pwd; + // Se i dati sono gia' convertiti aggiunge filtro sui gruppi + if (users.curr().exist("ISGROUP")) + { + TEdit_field& e = m.efield(F_USER); + e.browse()->set_filter("ISGROUP!=\"X\""); + } + + TString pwd; bool ok = FALSE; for (int i = 0 ; i < 3 && !ok; i++) { diff --git a/ba/ba1100.cpp b/ba/ba1100.cpp index aa6c42146..e1dc56424 100755 --- a/ba/ba1100.cpp +++ b/ba/ba1100.cpp @@ -42,6 +42,7 @@ class TManutenzione_app : public TApplication long _level; long _history_firm; TRec_sheet* _rec; + FILE * _log; protected: virtual bool menu (MENU_TAG); @@ -65,6 +66,11 @@ protected: void put_history(const char* firm); void close_history(); void dump_trc(const char * dir, const bool des_too, const long modules); + void repair_file(int i); + void open_log(); + void write_log(const char * line); + void close_log(); + void save_file(const char * file); public: @@ -371,6 +377,51 @@ bool TManutenzione_app::destroy() // releasev e arrmask } +void TManutenzione_app::open_log() +{ + TFilename log; + + log << firm2dir(0L) << '/' << "conv.log"; + _log = fopen(log,"a"); + if (_log == NULL) + fatal_box("Non posso aprire il file di log della conversione(%s)", (const char *) log); +} + +void TManutenzione_app::save_file(const char * file) +{ + TFilename n(file); + const TFilename source_path(n.path()); + TFilename dest_path(source_path); + + n.ext("*"); + TString_array files_to_copy; + + list_files(n, files_to_copy); + dest_path << "sav"; + + if (!dest_path.exist()) + make_dir(dest_path); + + FOR_EACH_ARRAY_ROW_BACK(files_to_copy, row, fname) + { + TFilename source_file(*fname); + TFilename dest_file(dest_path); dest_file << '/' << (const char *) source_file.name(); + fcopy((const char *) source_file, dest_file); + } +} + + +void TManutenzione_app::write_log(const char * line) +{ + fprintf(_log,"%s\n", line); +} + +void TManutenzione_app::close_log() +{ + fclose(_log); +} + + void TManutenzione_app::insert_riga (long riga_sel, TToken_string& riga) { const int logicnum = int(riga_sel) + 1; @@ -722,7 +773,7 @@ void TManutenzione_app::delete_riga () r.put(logicnum); } -bool TManutenzione_app::recover(TSystemisamfile& f, int err) +ool TManutenzione_app::recover(TSystemisamfile& f, int err) { if (err == -60 || err == -64 || err == _ispatherr || (err > -600 && err <= -300)) @@ -732,6 +783,46 @@ bool TManutenzione_app::recover(TSystemisamfile& f, int err) return err == NOERR; } +void TManutenzione_app::repair_file(int i) +{ + TDir d; + TString80 s; + + d.get(i, _nolock, _nordir, _sysdirop); + + if (d.eod() == 0) + { + TFilename n(d.filename()); + + save_file(n); + remove(n); + n.ext("cdx"); remove(n); + n.ext("fpt"); remove(n); + s.format("File n. %d - %s : eliminato file errato", i, (const char *)d.filename()); + write_log(s); + } + else + { + d.get(i, _lock, _nordir, _sysdirop); + TFilename n(d.filename()); + save_file(n); + TExternisamfile ef(d.filename()); + + const RecDes* rd = ef.curr().rec_des(); + TTrec rec; rec.get(i); + const int oldreclen = rec.len(); + const int recsize = sizeof(RecDes); + memcpy(rec.rec(), rd, recsize); + rec.put(i); + + const int reclen = rec.len(); + d.set_len(reclen); + d.put(i, _nordir, _sysdirop); + s.format("File n. %d - %s : corretto tracciato da %d a %d bytes", i, (const char *)d.filename(), oldreclen, reclen); + write_log(s); + } +} + void TManutenzione_app::update_dir() { // Particolare significato dei flags oltre i 10000: @@ -806,6 +897,22 @@ void TManutenzione_app::update_dir() } } else + { + if (is_com) + { + if (old_is_firm && !movable_file(i) && d.eod() == 0L) + { + TString80 s; + TFilename n(d.filename()); + + save_file(n); + remove(n); + n.ext("cdx"); remove(n); + n.ext("fpt"); remove(n); + s.format("File n. %d - %s : eliminato file non utilizzato", i, (const char *)d.filename()); + write_log(s); + } + } if (i > 2 && is_firm == old_is_firm) { FILE * f = fopen(fs, "r"); @@ -815,7 +922,7 @@ void TManutenzione_app::update_dir() const long size = ftell(f); fclose(f); - if (size > 0L && d.len() > 0) + if (flags < 10000L && size > 0L && d.len() > 0) { TSystemisamfile b(i); int err = b.is_valid(); @@ -830,17 +937,19 @@ void TManutenzione_app::update_dir() } if (err != NOERR && flags < 10000L) { - KEY k = yesnocancel_box("Il file %d non puo' essere aperto: errore %d\n" - "Si desidera tentare il recupero dei dati?\n" - "Rispondendo No l'errore verra' ignorato.",i,err); - if (k == K_YES) + if (err == _istrcerr) + { + repair_file(i); + err = NOERR; + } + if (err != NOERR && flags < 10000L) { if (!recover(b, err)) - k = yesno_box("Impossibile recuperare i dati\n" - "Si desidera proseguire ugualmente?") ? K_NO : K_ESC; + { + s.format("File n. %d - %s : errore n.ro %d", i, (const char *)d.filename(), err); + write_log(s); + } } - if (k == K_ESC) - stop_run(); } } else @@ -860,6 +969,7 @@ void TManutenzione_app::update_dir() } } } + } d.get(i, _nolock, _nordir, _sysdirop); bool cmn_file = FALSE; @@ -1062,25 +1172,24 @@ void TManutenzione_app::convert_dir() if (err == -60 || err == -64) err=NOERR; // verif. d.get(i, _nolock, _nordir, _sysdirop); if (i > 2 && err != NOERR && ((is_com && d.is_com()) || (!is_com && d.is_firm()))) - { - KEY k = yesnocancel_box("Il file %d non puo' essere aperto: errore %d\n" - "Si desidera tentare il recupero dei dati?\n" - "Rispondendo Annulla il programma terminera'",i,err); - if (k == K_YES) + { + if (err == _istrcerr) { - if (!recover(b, err)) - k = yesno_box("Impossibile recuperare i dati\n" - "Si desidera proseguire ugualmente?") ? K_NO : K_ESC; + repair_file(i); + err = NOERR; } - if (k == K_ESC) - stop_run(); - else - continue; - } + if (err != NOERR) + { + if (!recover(b, err)) + { + s.format("File n. %d - %s : errore n.ro %d", i, (const char *)d.filename(), err); + write_log(s); + } + } //d.get(i, _nolock, _nordir, _sysdirop); bool to_create = (is_com ? d.is_com() : d.is_firm()); - const bool actual_create = to_create; +// const bool actual_create = to_create; // I files LF_PCON, LF_CAUS, LF_RCAUS, LF_CLIFO, LF_CFVEN, LF_INDSPED // vanno creati comunque nel direttorio COM, vuoti, (se non esistono gia'). @@ -1095,7 +1204,8 @@ void TManutenzione_app::convert_dir() if (!s.exist() && d.len() > 0) { TSystemisamfile f(i); - set_autoload_new_files(actual_create); +// set_autoload_new_files(actual_create); + set_autoload_new_files(FALSE); f.build(0L,rs); set_autoload_new_files(TRUE); // Anche se il file non esisteva, prosegue, perche' possono esserci conversioni @@ -1356,14 +1466,23 @@ void TManutenzione_app::update() TExternal_app app("bacnv 4 0"); app.run(); } */ - + + open_log(); + TString80 s; + s.format("Conversione del %s", (const char *) TDate(TODAY).string()); + write_log(s); + write_log(""); + s.format("Dati comuni"); + write_log(s); + write_log(""); + update_dir(); convert_dir(); TSystemisamfile ditte(LF_NDITTE); ditte.open(); - TString80 s("Conversione archivi ditte."); + s = "Conversione archivi ditte."; TProgind p(ditte.items() ? ditte.items() : 1, s, FALSE, TRUE, 70); @@ -1383,6 +1502,9 @@ void TManutenzione_app::update() { ditte.close(); set_firm(codditta); + write_log(""); + write_log(mxs); + write_log(""); update_dir(); convert_dir(); ditte.open(); @@ -1391,6 +1513,10 @@ void TManutenzione_app::update() } ditte.close(); + write_log("--------------------"); + write_log(""); + close_log(); + if (firm > 0) set_firm(firm); else prefix().set(pref); load_des(); diff --git a/ba/ba1100.h b/ba/ba1100.h index af1b564f8..268b9d31a 100755 --- a/ba/ba1100.h +++ b/ba/ba1100.h @@ -30,8 +30,6 @@ protected: virtual long get_items() const { return _items; } virtual void get_row(long n, TToken_string& r); - virtual bool on_key(KEY k); - public: TDir* dir() const { return _dir; } TTrec* rec() const { return _rec; } diff --git a/ba/ba1101.cpp b/ba/ba1101.cpp index 1e42433ca..0e3b5a06a 100755 --- a/ba/ba1101.cpp +++ b/ba/ba1101.cpp @@ -54,27 +54,6 @@ TDir_sheet::~TDir_sheet() } -bool TDir_sheet::on_key(KEY key) -{ - if (key > K_CTRL) - switch (key-K_CTRL) - { - case 'A': - key = K_F8; break; - case 'C': - key = K_F7; break; - case 'E': - key = K_DEL; break; - case 'I': - key = K_F6; break; - case K_F4: - key = K_ESC; break; - default: - break; - } - return TSheet::on_key(key); -} - void TDir_sheet::get_row(long n, TToken_string& l) { n++; diff --git a/ba/ba1300.cpp b/ba/ba1300.cpp index d1cab528d..90d15cc59 100755 --- a/ba/ba1300.cpp +++ b/ba/ba1300.cpp @@ -113,12 +113,19 @@ void TPackFiles_application::main_loop() TFilename f_name,d_name; TString cmd; TDir d; + TDir ds; for (int i = 2; i<=items; i++) // Skip LF_DIR { if (!_selsheet->checked(i-1)) continue; - d.get(i); - const long flags = d.flags(); + d.get(i); + if (d.len() == 0) + continue; // Skip files with flags over 10000 + const TString pref(prefix().name()); + prefix().set(""); + ds.get(i); + prefix().set(pref); + const long flags = ds.flags(); const int module = abs((int)flags); if (flags >= 10000L) continue; // Skip files with flags over 10000 @@ -131,7 +138,7 @@ void TPackFiles_application::main_loop() do { status = NOERR; - if (present) // Se il file c'e' prova a compattarlo + if (present && flags < 10000L) // Se il file c'e' prova a compattarlo { search_blanks(f); if (f.packfile() == NOERR) @@ -144,8 +151,8 @@ void TPackFiles_application::main_loop() if (!present || status == -60) { - if (!present && d.len() > 0 && has_module(module,CHK_DONGLE))// Se il file non esiste lo costruisce - f.build(0L); +// if (!present && d.len() > 0 && has_module(module,CHK_DONGLE))// Se il file non esiste lo costruisce +// f.build(0L); continue; // Se il file non esiste e non si ha il modulo abilitato evita inutili controlli } // Se le pack() hanno ritornato -60 ma il file esiste, allora prosegue con il prossimo diff --git a/ba/ba1400a.uml b/ba/ba1400a.uml index 0783611c9..89b8e1cac 100755 --- a/ba/ba1400a.uml +++ b/ba/ba1400a.uml @@ -83,7 +83,7 @@ ENDPAGE PAGE "Permessi" -1 -1 78 20 -TREE F_PERMESSI -3 -8 +TREE F_PERMESSI -3 -9 BEGIN PROMPT 0 1 "" END diff --git a/ba/ba1600.cpp b/ba/ba1600.cpp index 6336a74e9..9a1449734 100755 --- a/ba/ba1600.cpp +++ b/ba/ba1600.cpp @@ -1868,7 +1868,7 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc _stat((const char *)zipfile,&info); if (lasttime <= info.st_mtime) { - aborted = !yesno_box("Il file %s risulta già essere aggiornato. Vuoi rigenerarlo comunque?",(const char *)zipfile); + aborted = !yesno_box("Il file %s risulta già aggiornato.\nSi desidera rigenerarlo comunque?",(const char *)zipfile); } if (!aborted && !agg) { @@ -1881,7 +1881,7 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc { _stat((const char *)patchfile,&info); if (lasttime <= info.st_mtime) - aborted = !yesno_box("Il file di patch %s \nrisulta già aggiornato;\nprocedo comunque alla generazione di %s ?",(const char *)patchfile,(const char *)zipfile); + aborted = !yesno_box("Il file di patch %s \nrisulta già aggiornato.\nSi desidera procedere comunque alla generazione di %s ?",(const char *)patchfile,(const char *)zipfile); } } } diff --git a/ba/ba2.cpp b/ba/ba2.cpp index c0d01ed49..c30e1ab32 100755 --- a/ba/ba2.cpp +++ b/ba/ba2.cpp @@ -1,5 +1,4 @@ #include -#include #include "ba2.h" @@ -11,10 +10,8 @@ int main(int argc, char** argv) { case 1: ba2200(argc, argv); break; -#if XVT_OS == XVT_OS_SCOUNIX case 2: ba2300(argc, argv) ; break; -#endif case 3: ba2400(argc, argv) ; break; case 4: diff --git a/ba/ba2200.cpp b/ba/ba2200.cpp index f9ff72b09..20230b050 100755 --- a/ba/ba2200.cpp +++ b/ba/ba2200.cpp @@ -1,35 +1,112 @@ #include +#define XVT_INCL_NATIVE -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "ba2200.h" +#include "ba2201.h" + +struct TFile_info : public TObject +{ + TFilename _name; + long _size; + int _disk; + int _last_disk; +}; + +/////////////////////////////////////////////////////////// +// Archiving mask +/////////////////////////////////////////////////////////// + +class TArchive_mask : public TAutomask +{ +protected: + virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + +public: + TArchive_mask(); +}; + +TArchive_mask::TArchive_mask() : TAutomask("ba2200") +{ +#if XVT_OS == XVT_OS_WIN16 + TList_field& lf = (TList_field&)field(F_FLOPPY); + TToken_string codes, values; + TString4 str; + int k = 0; + for (int d = 0; d < 26; d++) + { + UINT t = ::GetDriveType(d); + if (t != 0) + { + str.format("%c:", d+'A'); + codes.add(str); + values.add(str); + TToken_string& message = *lf.message(k++, TRUE); + if (t == DRIVE_REMOVABLE) + message.format("DISABLE,%d", F_PATH); + else + message.format("ENABLE,%d", F_PATH); + } + } + lf.replace_items(codes, values); +#endif +} + +bool TArchive_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) +{ + switch (o.dlg()) + { + case F_PATH: + if (e == fe_modify) + { + TFilename path = o.get(); + if (path[1] == ':') + { + set(F_FLOPPY, path.left(2)); + o.set(path.mid(2)); + } + } + break; + case F_DITTA: + if (e == fe_modify || e == fe_init) + { + set(F_RAGSOC, (o.get() != "") ? "Tutte le ditte" : "Nessuna ditta"); + } + break; + case F_CODDITTA: + if (e == fe_modify) + { + if (o.empty()) + set(F_RAGSOC, o.active() ? "Tutte le ditte" : "Nessuna ditta"); + } + break; + case F_SALVA: + if (e == fe_button) + { + const long ditta = get_long(F_CODDITTA); + if (ditta > 0L && !prefix().exist(ditta)) + return error_box("La ditta %ld non esiste", ditta); + } + default: + break; + } + return TRUE; +} /////////////////////////////////////////////////////////// // Archiving application /////////////////////////////////////////////////////////// -class TArchive_app : public TSkeleton_application -{ - TArchive _arc; - -protected: - virtual bool create(); - virtual void main_loop(); - static bool test_firm(TMask_field& f, KEY k); - KEY query(int& mode, long& firm, char& floppy, TString& desc, bool& tmp, bool& zip) const; - -public: - void stop_job(); - - TArchive_app() {} - virtual ~TArchive_app() {} -}; - bool TArchive_app::create() { bool ok = TRUE; @@ -42,7 +119,7 @@ bool TArchive_app::create() if (u != user() && utenti.get_bool("CONNECTED")) { ok = error_box("L'archiviazione non puo' essere effettuata\n" - "se ci sono altri utenti collegati: %s", (const char*)u); + "se ci sono altri utenti collegati (%s)", (const char*)u); } } utenti.close(); @@ -53,25 +130,11 @@ bool TArchive_app::create() return ok; } -bool TArchive_app::test_firm(TMask_field& f, KEY k) +KEY TArchive_app::query(int& mode, long& firm, TFilename& floppy_path, TString& desc) const { - if (k == K_SPACE) - { - const long firm = f.mask().get_long(F_CODDITTA); - if (firm > 0 && !prefix().exist(firm)) - return f.error_box("La ditta %ld non esiste.", firm); - } - return TRUE; -} - -KEY TArchive_app::query(int& mode, long& firm, char& floppy, TString& desc, bool& temp, bool& zip) const -{ - TMask m("ba2200"); - - m.set_handler(F_SALVA,test_firm); + TArchive_mask m; const KEY k = m.run(); - if (k != K_QUIT) { mode = 0x0; @@ -91,50 +154,452 @@ KEY TArchive_app::query(int& mode, long& firm, char& floppy, TString& desc, bool if (m.get_bool(F_CESP)) mode |= 0x10; - floppy = m.get(F_FLOPPY)[0]; + floppy_path.format("%c:%c", toupper(m.get(F_FLOPPY)[0]), SLASH); + floppy_path.add(m.get(F_PATH)); + desc = m.get(F_DESCR); - temp = m.get_bool(F_TEMP); -#if XVT_OS == XVT_OS_WIN - zip = m.get_bool(F_ZIP); -#else - zip = TRUE; -#endif } return k; +} + +void TArchive_app::add_file(const TFilename& name) +{ + TFile_info* fi = new TFile_info; + fi->_name = name; + fi->_size = fsize(name); + fi->_disk = fi->_last_disk = 1; + _zip_list.add(fi); } -void TArchive_app::main_loop() -{ +bool TArchive_app::split_file(const TFilename& archive, unsigned long max_chunk) +{ + TFilename output(archive); + output.ext("z00"); + + int disk = 0; + unsigned long scritti = 0; + + FILE* i = fopen(archive, "rb"); + if (i == NULL) + return FALSE; + + FILE* o = fopen(output, "wb"); + + const int BUFSIZE = 1024*16; + TString buf(BUFSIZE); + char* buffer = buf.get_buffer(); + + bool ok = TRUE; + while (ok) + { + const size_t letti = fread(buffer, 1, BUFSIZE, i); + if (letti == 0) + break; + + if (scritti >= max_chunk) + { + fclose(o); + add_file(output); + + TString16 ext; ext.format("z%02d", ++disk); + output.ext(ext); + o = fopen(output, "wb"); + scritti = 0; + } + + ok = fwrite(buffer, letti, 1, o) > 0; + scritti += letti; + } + fclose(i); + fclose(o); + add_file(output); + + return ok; +} + +bool TArchive_app::zip_dir(const TFilename& name, unsigned long max_chunk) +{ + TFilename tmp; tmp.tempdir(); + tmp.add(name.name()); + tmp.ext("zip"); + + TFilename filenames = name; filenames.add("*.*"); + ofstream o("ziplist.txt"); + o << filenames << endl; + o.close(); + + TString msg; + msg << "Creazione del file temporaneo " << tmp << "..."; + + TIndwin waitw(100,msg,FALSE,FALSE); + TWait_cursor hourglass; + + TFilename cmd; + cmd << "zip.pif " << tmp << ' ' << "ziplist.txt" << " -j"; // -j NON salvare i path + TExternal_app app(cmd); + int err = app.run(FALSE, FALSE, FALSE, FALSE); + remove("ziplist.txt"); + + if (err == 0 && tmp.exist()) + { + if (!split_file(tmp, max_chunk)) + err = 1; + remove(tmp); + } + + return err == 0; +} + +bool TArchive_app::can_save_as(const TFilename& src, const TFilename& dst) const +{ + if (dst.exist()) + remove(dst); + long s = fsize(src); + return os_test_disk_free_space(dst.left(3), s); +} + +void TArchive_app::save_zip_files(const TFilename& floppy_path, const TString& desc, unsigned long max_chunk) +{ + // Assegna un disco di destinazione a tutti i files + int disk = 1; + unsigned long written = 0; + for (int i = 0; i < _zip_list.items(); i++) + { + TFile_info& fi = (TFile_info&)_zip_list[i]; + if (written > 0 && (written+fi._size) >= max_chunk) + { + disk++; + written = 0; + } + fi._disk = disk; + written += fi._size; + } + + bool ok = TRUE; + if (os_is_removable_drive(floppy_path.left(3))) + { + const char* msg = "Si desidera procedere con l'operazione di salvataggio?"; + if (disk == 1) + ok = yesno_box("Controllare che il primo disco sia nel drive %c:\n%s", floppy_path[0], msg); + else + ok = yesno_box("Preparare %d dischetti vuoti e controllare che il primo sia nel drive %c:\n%s", disk, floppy_path[0], msg); + if (!ok) + return; + } + + const TDate oggi(TODAY); + TFilename name; name = floppy_path; name.add("backup.ini"); + remove(name); + TConfig ini(name, "Main"); + ini.set("Date", oggi.string()); + ini.set("Description", desc); + ini.set("Disks", disk); + ini.set("Format", "zip"); + + TFilename last_name; + long size = 0; + for (i = 0; i < _zip_list.items(); i++) + { + const TFile_info& fi = (const TFile_info&)_zip_list[i]; + name = fi._name.name(); name.ext(""); + if (name != last_name) + { + ini.set("FirstDisk", fi._disk, name); + last_name = name; + size = 0; + } + ini.set("LastDisk", fi._disk); + ini.set("Size", size += fi._size); + } + ini.set_paragraph("Main"); // Forza scrittura ultimo paragrafo + + int curr_disk = 1; + + TProgind pi(_zip_list.items(), "Salvataggio dati in corso...", FALSE, TRUE); + for (i = 0; i < _zip_list.items(); i++) + { + pi.addstatus(1); + const TFile_info& fi = (const TFile_info&)_zip_list[i]; + if (fi._disk != curr_disk) + message_box("Inserire il disco vuoto n.%d", curr_disk = fi._disk); + TFilename dest; + dest = floppy_path; dest.add(fi._name.name()); + while(!can_save_as(fi._name, dest)) + { + if (!yesno_box("Sul disco %d non c'e' spazio sufficiente per il file %s" + "\nSi desidera sostituire il disco e ritentare?", curr_disk, (const char*)dest)) + return; + } + fcopy(fi._name, dest); + remove(fi._name); + } +} + +void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, const TString& desc) +{ + TPointer_array ditte; + if (firm == 0) + { + TLocalisamfile nditte(LF_NDITTE); + for (int err = nditte.first(); err == NOERR; err = nditte.next()) + { + const long f = nditte.get_long("CODDITTA"); + ditte.add_long(f); + } + } + else + ditte.add_long(firm); + + const TString16 old = prefix().name(); + prefix().set(NULL); // Libera tutti i lock + + long max_chunk = ~0; + if (os_is_removable_drive(floppy_path)) + { + message_box("Inserire un disco vuoto nel drive %c:", floppy_path[0]); + max_chunk = os_get_disk_size(floppy_path) - (1024L*64L); + } + + _zip_list.destroy(); + + bool ok = TRUE; + + TFilename name; + if (ok && (mode & 0x1)) + { + name = firm2dir(0); + ok = zip_dir(name, max_chunk); + } + + if (ok && (mode & 0x2)) + { + for (int i = 0; ok && i < ditte.items(); i++) + { + firm = ditte.get_long(i); + if (prefix().exist(firm)) + { + name = firm2dir(firm); + ok = zip_dir(name, max_chunk); + } + } + } + + if (ok && (mode & 0x4)) + { + name = firm2dir(-1); // __ptprf + name.add("config"); // Aggiungi configurazioni + ok = zip_dir(name, max_chunk); + } + + if (ok && (mode & 0x8)) + { + name = firm2dir(-1); // __ptprf + name.add("m770"); // Aggiungi 770 + ok = zip_dir(name, max_chunk); + } + + if (ok && (mode & 0x10)) + { + name = firm2dir(-1); // __ptprf + name.add("cesp"); // Aggiungi cespiti + ok = zip_dir(name, max_chunk); + } + + prefix().set(old); // Ripristina prefix + + if (ok) + save_zip_files(floppy_path, desc, max_chunk); + else + error_box("Si è verificato un errore di accesso al disco:\nVerificare lo spazio disponibile"); +} + +bool TArchive_app::read_paragraph(TConfig& ini, const char* para) +{ + const int first = ini.get_int("FirstDisk", para); + const int last = ini.get_int("LastDisk"); + const bool ok = first > 0 && last >= first; + if (ok) + { + TFilename dir; dir.tempdir(); + TString16 ext; + int e = 0; + for (int d = first; d <= last; d++) + { + TFile_info* fi = new TFile_info; + TFilename& name = fi->_name; + ext.format("z%02d", e++); + name = dir; name.add(para); name.ext(ext); + fi->_disk = d; + fi->_last_disk = last; + fi->_size = ini.get_int("Size"); + _zip_list.add(fi); + } + } + return ok; +} + +void TArchive_app::load_zip_files(const TFilename& floppy_path) +{ + TString msg; + TFilename dir; dir.tempdir(); + const int files = _zip_list.items(); + TProgind pi(files, "Ripristino dati in corso...", TRUE, TRUE); + int curr_disk = 1; + for (int i = 0; i < files; i++) + { + const TFile_info& info = (const TFile_info&)_zip_list[i]; + const int& disk = info._disk; + + msg = "Ripristino "; msg << info._name.name() << " in corso..."; + pi.set_text(msg); + pi.addstatus(1); + if (pi.iscancelled()) + break; + + if (os_is_removable_drive(floppy_path.left(3))) + { + if (disk != curr_disk) + { + message_box("Inserire il disco %d del backup", disk); + curr_disk = disk; + } + } + + TFilename src; src = floppy_path; src.add(info._name.name()); + TFilename dst; dst = dir; dst.add(info._name.name()); dst.ext("zip"); + while (!fcopy(src, dst, TRUE)) + if (!yesno_box("Si desidera ritentare?")) + return; + if (disk == info._last_disk) + { + TFilename exdir; + exdir = firm2dir(-1); exdir.add(dst.name()); exdir.ext(""); + + TString cmdline; + cmdline << "unzip.pif -o " << dst << " -d " << exdir; + + TExternal_app app(cmdline); + app.run(FALSE, FALSE, FALSE, FALSE); + } + } +} + +void TArchive_app::restore(int mode, long firm, const TFilename& floppy_path) +{ + _zip_list.destroy(); + + TFilename name; name = floppy_path; name.add("backup.ini"); + TConfig ini(name, "Main"); + ini.write_protect(); + + if (mode & 0x1) + read_paragraph(ini, "com"); + + if (mode & 0x2) + { + if (firm > 0) + { + TString16 para; para.format("%05lda", firm); + read_paragraph(ini, para); + } + else + { + TString_array para; + ini.list_paragraphs(para); + for (int i = 0; i < para.items(); i++) + { + const TString& n = para.row(i); + if (atol(n) > 0 && n.right(1) == "a") + read_paragraph(ini, n); + } + } + } + + if (mode & 0x4) + read_paragraph(ini, "config"); + + if (mode & 0x8) + read_paragraph(ini, "m770"); + + if (mode & 0x10) + read_paragraph(ini, "cesp"); + + const int tot = _zip_list.items(); + if (tot > 0) + { + TString fola; + fola = "Verranno ripristinati i seguenti archivi:\n"; + for (int i = 0; i < tot; i++) + { + const TFile_info& info = (const TFile_info&)_zip_list[i]; + if (info._disk == info._last_disk) + { + TFilename n = info._name.name(); + n.ext(""); + fola << n << ", "; + } + } + fola.rtrim(2); + fola << ".\nSi desidera continuare?"; + if (yesno_box(fola)) + { + const TString16 old = prefix().name(); + prefix().set(NULL); // Libera tutti i lock + load_zip_files(floppy_path); // Scompatta i files + prefix().set(old); // Ripristina prefix + } + } + else + warning_box("I dati richiesti non sono presenti sul backup"); +} + +void TArchive_app::interactive_mode() +{ KEY k; int mode; long firm; - char floppy; - TString desc(80); - bool temp; - bool zip; + TFilename floppy_path; + TString80 desc; - while ((k = query(mode, firm, floppy, desc, temp, zip)) != K_QUIT) - { + while ((k = query(mode, firm, floppy_path, desc)) != K_QUIT) + { if (mode) { if (k == K_SAVE) - { - if (zip) - _arc.zip(firm, floppy, desc); -#if XVT_OS == XVT_OS_WIN + { + const bool use_zip = TRUE; + if (use_zip) + backup(mode, firm, floppy_path, desc); else - _arc.backup(firm, floppy, desc); -#endif + { + TArchive arc; + arc.backup(mode, firm, floppy_path[0], desc); + } } else - { - if (zip) - _arc.unzip(firm, floppy, temp); -#if XVT_OS == XVT_OS_WIN + { + TFilename ini_name; ini_name = floppy_path; ini_name.add("backup.ini"); + if (os_is_removable_drive(floppy_path.left(3))) + message_box("Inserire il primo disco del backup nel drive %c", floppy_path[0]); + if (ini_name.exist()) + { + bool use_zip = FALSE; + { + TConfig ini(ini_name, "Main"); + ini.write_protect(); + use_zip = ini.get("Format").compare("zip", TRUE) == 0; + } + if (use_zip) + restore(mode, firm, floppy_path); + else + { + TArchive arc; + arc.restore(mode, firm, floppy_path[0], FALSE); + } + } else - _arc.restore(firm, floppy, temp); -#endif + error_box("Impossibile trovare il file %s", (const char*)ini_name); } } else @@ -142,6 +607,60 @@ void TArchive_app::main_loop() } } +void TArchive_app::batch_mode(const TString& cmd) +{ + const int mode = ~0; + const long firm = 0; + const TFilename floppy_path = cmd; + restore(mode, firm, floppy_path); +} + +void TArchive_app::main_loop() +{ + TString cmd; + + if (argc() > 2) + { + TFilename ini = argv(2); + if (ini.compare("/i", TRUE, 2) == 0) + { + ini.ltrim(2); + TConfig cfg(ini, "Main"); + cmd = cfg.get("Action"); + if (cmd.compare("Restore ", TRUE, 8) == 0) + { + cmd.ltrim(8); + cmd.trim(); + } + else + cmd.cut(0); + } + else + { + if (ini.exist()) + cmd = ini; + } + } + + if (cmd.empty()) + { + TMailbox mail; + TMessage* msg = mail.next_s("RESTORE"); + if (msg == NULL) + { + mail.restart(); + msg = mail.next_s("Restore"); + } + if (msg) + cmd = msg->body(); + } + + if (cmd.empty()) + interactive_mode(); + else + batch_mode(cmd); +} + int ba2200(int argc, char* argv[]) { TArchive_app a; diff --git a/ba/ba2200.h b/ba/ba2200.h index 469328386..ca2b3691d 100755 --- a/ba/ba2200.h +++ b/ba/ba2200.h @@ -2,15 +2,13 @@ #define F_RAGSOC 102 #define F_FLOPPY 104 #define F_DESCR 105 -#define F_TEMP 106 +#define F_PATH 106 #define F_SALVA 107 #define F_RIPR 108 -#define F_ZIP 109 - -#define F_ALL 110 -#define F_DITTA 111 -#define F_COM 112 -#define F_CONFIG 113 -#define F_770 114 -#define F_CESP 115 +#define F_ALL 109 +#define F_DITTA 110 +#define F_COM 111 +#define F_CONFIG 112 +#define F_770 113 +#define F_CESP 114 diff --git a/ba/ba2200.uml b/ba/ba2200.uml index a86e24fec..2cd99154b 100755 --- a/ba/ba2200.uml +++ b/ba/ba2200.uml @@ -1,45 +1,50 @@ #include "ba2200.h" -PAGE "Salvataggio / Ripristino archivi" -1 -1 72 12 +PAGE "Salvataggio / Ripristino archivi" -1 -1 72 10 -LIST F_FLOPPY 1 5 +LIST F_FLOPPY 1 3 BEGIN PROMPT 1 1 "Disco " - ITEM "A|A:" - ITEM "B|B:" + ITEM "A|A:" MESSAGE CLEAR,F_PATH + ITEM "B|B:" MESSAGE CLEAR,F_PATH +END + +STRING F_PATH 45 +BEGIN + PROMPT 15 1 "Percorso " END BOOLEAN F_DITTA BEGIN - PROMPT 20 1 "Dati ditta" - MESSAGE TRUE ENABLE,1@|"X",F_770 + PROMPT 1 2 "Dati ditta" + MESSAGE TRUE ENABLE,1@|"X",F_770|"X",F_CESP MESSAGE FALSE CLEAR,1@ END BOOLEAN F_COM BEGIN - PROMPT 20 2 "Dati comuni" + PROMPT 1 3 "Dati comuni" MESSAGE TRUE "X",F_CONFIG END BOOLEAN F_CONFIG BEGIN - PROMPT 20 3 "File di configurazione" + PROMPT 1 4 "File di configurazione" END BOOLEAN F_770 BEGIN - PROMPT 20 4 "Dati 770" + PROMPT 1 5 "Dati 770" END BOOLEAN F_CESP BEGIN - PROMPT 20 5 "Cespiti" + PROMPT 1 6 "Cespiti" END NUMBER F_CODDITTA 5 BEGIN - PROMPT 48 1 "Ditta " + PROMPT 15 2 "" USE LF_NDITTE INPUT CODDITTA F_CODDITTA DISPLAY "Codice" CODDITTA @@ -50,43 +55,21 @@ BEGIN GROUP 1 END -TEXT DLG_NULL +STRING F_RAGSOC 50 45 BEGIN - PROMPT 48 2 "Non specificata = Tutte" + PROMPT 24 2 "" + FLAGS "D" END BUTTON F_ALL 10 2 BEGIN - PROMPT 56 4 "~Tutti" - MESSAGE "X",F_DITTA|"X",F_COM|"X",F_CONFIG|"X",F_770|"X",F_CESP -END - -STRING F_RAGSOC 50 -BEGIN - PROMPT 1 6 "Ragione Sociale " - USE LF_NDITTE KEY 2 - INPUT RAGSOC F_RAGSOC - DISPLAY "Ragione Sociale@50" RAGSOC - DISPLAY "Codice@10" CODDITTA - COPY OUTPUT F_CODDITTA - CHECKTYPE NORMAL - GROUP 1 + PROMPT 58 4 "~Tutti" + MESSAGE "X",F_DITTA|"X",F_COM|"X",F_CONFIG|"X",F_770|"X",F_CESP|"",F_CODDITTA END STRING F_DESCR 50 BEGIN - PROMPT 1 7 "Descrizione " -END - -BOOLEAN F_ZIP -BEGIN - PROMPT 1 4 "Usare compressione compatibile PKZIP" -END - - -BOOLEAN F_TEMP -BEGIN - PROMPT 1 8 "Usare direttorio temporaneo durante il ripristino" + PROMPT 1 7 "Descrizione " END BUTTON F_SALVA 15 2 diff --git a/ba/ba2201.h b/ba/ba2201.h new file mode 100755 index 000000000..d4d706130 --- /dev/null +++ b/ba/ba2201.h @@ -0,0 +1,45 @@ +#ifndef __BA2201_H +#define __BA2201_H + +#ifndef __APPLICAT_H +#include +#endif + +#ifndef __CONFIG_H +class TConfig; +#endif + +class TArchive_app : public TSkeleton_application +{ + TArray _zip_list; + +protected: + virtual bool create(); + virtual void main_loop(); + KEY query(int& mode, long& firm, TFilename& floppy_path, TString& desc) const; + + bool split_file(const TFilename& archive, unsigned long max_chunk); + bool zip_dir(const TFilename& name, unsigned long max_chunk); + + bool read_paragraph(TConfig& ini, const char* para); + + void backup(int mode, long firm, const TFilename& floppy_path, const TString& desc); + void restore(int mode, long firm, const TFilename& floppy_path); + + void add_file(const TFilename& name); + void save_zip_files(const TFilename& floppy_path, const TString& desc, unsigned long max_chunk); + void load_zip_files(const TFilename& floppy_path); + + bool can_save_as(const TFilename& src, const TFilename& dst) const; + + void interactive_mode(); + void batch_mode(const TString& cmd); + +public: + void stop_job(); + + TArchive_app() {} + virtual ~TArchive_app() {} +}; + +#endif diff --git a/ba/ba2300.cpp b/ba/ba2300.cpp index f96b4d389..98adb59da 100755 --- a/ba/ba2300.cpp +++ b/ba/ba2300.cpp @@ -1,1030 +1,340 @@ -#include -#if XVT_OS == XVT_OS_SCOUNIX +#include +#include +#include +#include +#include -// EDIT Printer File -// Utility for printer configuration files editing -// by MB SEP 1993 - -#include -#include - -#define __BA2300_CPP +#include "ba2201.h" #include "ba2300.h" -FILE* mirror; -FILE* mirror2; -FILE* current; -FILE* printerlist; -FILE* codes; -FILE* names; -FILE* defcodes; -FILE* defnames; +/////////////////////////////////////////////////////////// +// Autoform tree +/////////////////////////////////////////////////////////// -int selprinter=1; - - -void build_list_file (FILE* inputfile, TFilename& outputfile) +class TAutoform_tree : public TString_tree { - FILE* printerlist; - TString junk; - int prog=0; + TConfig *_ini; + +protected: + virtual TImage* image(bool selected) const; - printerlist=fopen(outputfile, "w"); - fseek(inputfile, 0, SEEK_SET); - while (fgets(__tmp_string, 256, inputfile)) - { - junk=__tmp_string; - if (junk.find("[")!=-1 && junk.find("[Default]")==-1 && junk.find("[End of File]")==-1) - { - junk.ltrim(1); - junk.rtrim(2); - fprintf(printerlist, " ITEM \"%i|%s\"\n", prog++, (const char*)junk); - } - } - fclose(printerlist); +public: + TConfig& ini(); + void study(const char* module); + bool studied(const char* module) const; + bool forget(const char* module); + + TAutoform_tree(); + virtual ~TAutoform_tree(); +}; + +TConfig& TAutoform_tree::ini() +{ + if (_ini == NULL) + _ini = new TConfig(CONFIG_USER, "Autoform"); + return *_ini; } -bool seek_default_printer (FILE* inputfile, TString& newprinter, long* position, bool justafter) +void TAutoform_tree::study(const char* module) { - TString junk; + CHECK(module && *module, "Invalid module"); + TString4 varname; + varname.strncpy(module, 2); + varname.lower(); + TToken_string str(ini().get(varname), ','); + TString16 val = module; val.ltrim(2); + if (str.get_pos(val) < 0) + { + str.add(val); + ini().set(varname, str); + } +} - fseek(inputfile, 0, SEEK_SET); - fgets(__tmp_string, 256, inputfile); - junk=__tmp_string; - if (junk.find("[")!=-1) - { - if (junk.find("Default")!=-1) - { - fgets(__tmp_string, 256, inputfile); - junk=__tmp_string; - junk.rtrim(1); - } - else - { - junk.ltrim(1); - junk.rtrim(2); - } - newprinter=junk; - return seek_printer(inputfile, newprinter, position, justafter); +bool TAutoform_tree::studied(const char* module) const +{ + if (module && *module) + { + TString4 varname; + varname.strncpy(module, 2); + varname.lower(); + TToken_string str(((TAutoform_tree*)this)->ini().get(varname), ','); + TString16 val = module; val.ltrim(2); + return str.get_pos(val) >= 0; } return FALSE; } - -bool seek_printer (FILE* inputfile, TString& printer, long* position, bool justafter) -{ - TString junk; - long pos; - char* noteof; - - fseek(inputfile, 0, SEEK_SET); - do +bool TAutoform_tree::forget(const char* module) +{ + bool killed = FALSE; + if (module && *module) { - pos=ftell(inputfile); - noteof=fgets(__tmp_string, 256, inputfile); - junk=__tmp_string; - } - while (!((junk.find(printer)!=-1 && junk.find("[")!=-1) || !noteof)); - - if (!noteof) return FALSE; - else - if (justafter) + TString4 varname; + varname.strncpy(module, 2); + varname.lower(); + TToken_string str(ini().get(varname), ','); + TString16 val = module; val.ltrim(2); + int pos = str.get_pos(val); + if (pos >= 0) { - *position=ftell(inputfile); - return TRUE; - } - else - { - *position=pos; - fseek(inputfile, pos, SEEK_SET); - return TRUE; - } -} -bool erase_file (TFilename& filename) -{ - FILE* junkfile; - - if ((junkfile=fopen(filename, "r"))!=0) - { - fclose (junkfile); -#if XVT_OS == XVT_OS_SCOUNIX - sprintf (__tmp_string, "rm %s", (char*)filename); - system (__tmp_string); -#else - remove(filename); -#endif - return TRUE; - } else return FALSE; -} - -bool is_present (FILE* inputfile, TString& printer) -{ - TFilename mirror("mirror"); - TString junk; - FILE* printerlist; - bool found=FALSE; - - build_list_file (inputfile, mirror); - printerlist=fopen(mirror, "r"); - while (fgets(__tmp_string, 256, printerlist) && !found) - { - junk=__tmp_string; - if (junk.find(printer)!=-1) found=TRUE; - } - fclose(printerlist); - - return found; -} - -bool change_default_printer (TFilename& inputfilename, FILE* inputfile, TString& newdefprinter) -{ - FILE* mirror; - TFilename mirrorname("mirror"); - TString junk; - - if (is_present(inputfile, newdefprinter)) - { - mirror=fopen (mirrorname, "w"); - fseek (inputfile, 0, SEEK_SET); - fgets (__tmp_string, 256, inputfile); - junk=__tmp_string; - if (junk.find("[Default]")!=-1) - { - fputs(__tmp_string, mirror); - fgets(__tmp_string, 256, inputfile); - fgets(__tmp_string, 256, inputfile); - } - else fprintf(mirror, "[Default]\n"); - fprintf(mirror, "%s\n", (const char*)newdefprinter); - fputs(__tmp_string, mirror); - while (fgets(__tmp_string, 256, inputfile)) - fputs (__tmp_string, mirror); - fclose (mirror); - fclose (inputfile); - erase_file (inputfilename); - rename (mirrorname, inputfilename); - inputfile = fopen(inputfilename, "r"); - return TRUE; - } - else return FALSE; -} - -bool build_code_files (FILE* input, TFilename& outcdfile, TFilename& outnmfile, TString& printer) -{ - TString junk; - TToken_string j2; - long pos; - int i; - FILE *codes, *names; - - if (is_present(input, printer)) - { - codes=fopen(outcdfile, "w"); - names=fopen(outnmfile, "w"); - seek_printer (input, printer, &pos, TRUE); - for (i=0; i<7; i++) - fgets(__tmp_string, 256, input); - fgets(__tmp_string, 256, input); - junk=__tmp_string; - i=0; - while (junk.find("[")==-1) - { - junk.ltrim(14); - j2=junk; - j2.restart(); - fprintf(names, " ITEM \"%i|%s\"\n", i++, (char*)j2.get()); - fputs((char*)j2.get(), codes); - fgets(__tmp_string, 256, input); - junk=__tmp_string; - } - fclose (names); - fclose (codes); - return TRUE; - } - else return FALSE; -} - -void build_list_box (FILE* names, TMask& mask, short field) -{ - TString replace1, replace2, junk; - - replace1.cut(0); - replace2.cut(0); - while(fgets(__tmp_string, 256, names)) - { - if (__tmp_string[0]!='\n') - { - if (replace1.not_empty()) replace1 << '|'; - if (replace2.not_empty()) replace2 << '|'; - junk=__tmp_string; - junk.ltrim(8); - while (junk[0] && junk[0]!='|') - { - replace1 << junk[0]; - junk.ltrim(1); - } - junk.ltrim(1); - junk.rtrim(2); - replace2 << junk; + str.destroy(pos); + ini().set(varname, str); + killed = TRUE; } } - ((TList_field&)mask.field(field)).replace_items(replace1, replace2); + return killed; } -void place_codes_on_file (FILE* names, FILE* codes, FILE* output) -{ - TString name; - TString junk; - while (fgets(__tmp_string, 256, names)) +TImage* TAutoform_tree::image(bool selected) const +{ + if (!has_son()) { - name=__tmp_string; - item2prname(name, junk); - name.cut(0); - name << "Code = " << junk << "|"; - if (fgets(__tmp_string, 256, codes)) - if (!(__tmp_string=="\n"||__tmp_string=="")) - fprintf(output, "%s%s", (const char*)name, __tmp_string); - } + TString str; get_description(str); + str.cut(5); + if (studied(str)) + return get_res_image(BMP_FILECHK); + } + return TString_tree::image(selected); } -void item2prname (TString& item, TString& name) +TAutoform_tree::TAutoform_tree() : _ini(NULL) { - name=item; - name.ltrim(8); - name.rtrim(2); - if (name.not_empty()) - while (name[0]!='|') name.ltrim(1); - name.ltrim(1); } -bool seek_first_printer(FILE* input, TString& printer, long* pos, bool justafter) +TAutoform_tree::~TAutoform_tree() { - return seek_printer_no(input, 1, printer, pos, justafter); + if (_ini) delete _ini; } + +/////////////////////////////////////////////////////////// +// Autoform mask +/////////////////////////////////////////////////////////// -bool seek_printer_no(FILE* input, int number, TString& printer, long* pos, bool justafter) -{ - FILE* listfile; - TString junk; - char* noteof=0; - - if (number==0) return FALSE; - build_list_file(input, (TFilename)"mirror"); - listfile=fopen("mirror", "r"); - for (int i=0; i= 0; i--) + if (dir[i] == '/' || dir[i] == '\\' || dir[i] == ':') break; + + TFilename mask(dir.mid(i+1)); + dir.cut(i > 0 ? i+1 : 0); + + xvt_fsys_save_dir(); + + if (dir.not_empty()) { - TMask addmask(MSK_4); - TString junk; - int items; + DIRECTORY directory; xvt_fsys_convert_str_to_dir(dir.get_buffer(), &directory); + BOOLEAN ok = xvt_fsys_set_dir(&directory); + if (!ok) + return 0; + } - addmask.run(); - f.mask().set_focus(); - junk.cut(0); - items = ((TList_field&)((TMask&)f.mask()).field(MSK_23_NAMES)).items(); - junk << items << "|" << addmask.get(MSK_4_CODE); - ((TList_field&)((TMask&)f.mask()).field(MSK_23_NAMES)).add_item(junk); - junk = addmask.get(MSK_4_CODE); - epf.update_names_file (junk, items); - epf.fill_print_codes (f.mask()); - - } - return TRUE; -} - -bool codes_on_key (TMask_field& f, KEY key) -{ - TString junk; - int intjunk; - - if (key==K_TAB) - { - if (f.focusdirty()) - { - junk = f.mask().get(MSK_23_NAMES); - intjunk = atoi(junk); - epf.update_codes_file (f.mask().get(MSK_23_CODES), intjunk); - } - } - return TRUE; -} - -bool prev_on_key (TMask_field& f, KEY key) -{ - TString printer; - long pos; - - if (key==' ') - if (seek_printer_no(mirror, selprinter-1, printer, &pos)) + SLIST files = xvt_fsys_list_files(DIR_TYPE, mask.get_buffer(), TRUE); + const int count = xvt_slist_count(files); + + for (SLIST_ELT e = xvt_slist_get_first(files); e; e = xvt_slist_get_next(files, e)) + { + char* f = xvt_slist_get(files, e, NULL); + if (*f != '.' && f[1] != ':') { - selprinter--; - build_code_files (mirror, (TFilename)FILE_CODES, (TFilename)FILE_NAMES, printer); - names=fopen(FILE_NAMES, "r"); - build_list_box (names, f.mask(), MSK_23_NAMES); - fclose(names); - epf.set_current_printer(printer); - epf.fill_mask(f.mask(), TRUE); - epf.fill_print_codes(f.mask()); - } - f.mask().show(); - return TRUE; -} - -bool next_on_key (TMask_field& f, KEY key) -{ - TString printer; - long pos; - - if (key==' ') - if (seek_printer_no(mirror, selprinter+1, printer, &pos)) - { - selprinter++; - build_code_files (mirror, (TFilename)FILE_CODES, (TFilename)FILE_NAMES, printer); - names=fopen(FILE_NAMES, "r"); - build_list_box (names, f.mask(), MSK_23_NAMES); - fclose(names); - epf.set_current_printer(printer); - epf.fill_mask(f.mask(), TRUE); - epf.fill_print_codes(f.mask()); - } - f.mask().show(); - return TRUE; -} - - -// Methods -void EPF_Application::save_box(bool saveas) -{ - if (yesno_box("Il file corrente e' stato modificato: vuoi salvarlo?")) - save_file(saveas); -} - -int EPF_Application::accept_current_name(bool mode) -{ - FILE_SPEC filetoopen; - FL_STATUS junk; - TString typespec(EXTENSION); - char dirjunk[50]; - - // ritorna 0 se il file esiste - // 1 se il file non esiste - // 2 se l'operazioe e' stata interrotta - - - - get_dir(&_workdir); - strcpy(filetoopen.type, ( const char*)typespec); - filetoopen.dir=_workdir; - if (mode==OPEN) junk=open_file_dlg(&filetoopen, "Scegli un file di configurazione stampanti"); - else junk=save_file_dlg(&filetoopen, "Digita il nome del nuovo file"); - if (junk==FL_BAD || junk==FL_CANCEL) return 2; - if (mode==OPEN) _isnamed=TRUE; - dir_to_str(&(filetoopen.dir), dirjunk, 50); - _currentname.cut(0); - _currentname << dirjunk << '/' << filetoopen.name; - if (mode==OPEN) if ((current =fopen(_currentname, "r"))==NULL) return 1; - else - { - fclose(current ); - return 0; - } - else return 0; -} - -void EPF_Application::reset_mirror() -{ - erase_file(_mirrorname); - mirror =fopen(_mirrorname, "a+"); -} - -bool EPF_Application::create_box() -{ - return yesno_box("Il file specificato non esiste, vuoi crearlo?"); -} - -void EPF_Application::make_mirror() -{ - fseek(mirror , 0, SEEK_SET); - current =fopen(_currentname, "r"); - while (fgets(__tmp_string, 256, current )) - fputs(__tmp_string, mirror ); - fclose(current ); -} - -void EPF_Application::update_mirror (TMask& mask) -{ - TString linetoadd; - TFilename junk; - - - mirror2 =fopen(_mir2name, "w"); - fseek(mirror , 0, SEEK_SET); - - fgets(__tmp_string, 256, mirror ); - linetoadd=__tmp_string; - while (linetoadd.find(_currentprinter)==-1 || linetoadd.find("[")==-1) - { - fputs (__tmp_string, mirror2 ); - fgets (__tmp_string, 256, mirror ); - linetoadd=__tmp_string; - } - linetoadd.cut(0); - linetoadd << "[" << (char*)mask.get(MSK_23_LOGIC) << ']' << '\n'; - fprintf(mirror2 , "%s", (const char*)linetoadd); - linetoadd.cut(0); - linetoadd << "Printer type= " << (const char*)mask.get(MSK_23_TYPE) << '\n'; - fprintf(mirror2 , "%s", (const char*)linetoadd); - linetoadd.cut(0); - linetoadd << "Device name = " << (const char*)mask.get(MSK_23_PHYSIC) << '\n'; - fprintf(mirror2 , "%s", (const char*)linetoadd); - linetoadd.cut(0); - linetoadd << "Filter name = " << (const char*)mask.get(MSK_23_FILTER) << '\n'; - fprintf(mirror2 , "%s", (const char*)linetoadd); - linetoadd.cut(0); - linetoadd << "Normal = " << (const char*)mask.get(MSK_23_NORMAL) << '\n'; - fprintf(mirror2 , "%s", (const char*)linetoadd); - linetoadd.cut(0); - linetoadd << "Bold = " << (const char*)mask.get(MSK_23_BOLD) << '\n'; - fprintf(mirror2 , "%s", const (char*)linetoadd); - linetoadd.cut(0); - linetoadd << "Italic = " << (const char*)mask.get(MSK_23_ITALIC) << '\n'; - fprintf(mirror2 , "%s", (const char*)linetoadd); - linetoadd.cut(0); - linetoadd << "Underlined = " << (const char*)mask.get(MSK_23_UNDERLINED) << '\n'; - fprintf(mirror2 , "%s", (const char*)linetoadd); - - names=fopen(FILE_NAMES, "r"); - codes=fopen(FILE_CODES, "r"); - place_codes_on_file (names, codes, mirror2 ); - fgets(__tmp_string, 256, mirror ); - linetoadd=__tmp_string; - while(linetoadd.find("[")==-1) - { - fgets (__tmp_string, 256, mirror ); - linetoadd=__tmp_string; - } - fputs (__tmp_string, mirror2 ); - while (fgets(__tmp_string, 256, mirror )) - { - fputs (__tmp_string, mirror2 ); - } - -#if XVT_OS != XVT_OS_SCOUNIX - fflush(mirror2 ); -#endif - fclose(mirror2 ); - fclose(mirror ); - fclose(names); - fclose(codes); - junk=_mirrorname; - _mirrorname=_mir2name; - _mir2name=junk; - mirror =fopen(_mirrorname, "a+"); -} - -void EPF_Application::delete_printer () -{ - TString linetoadd; - TFilename junk; - - mirror2 =fopen(_mir2name, "w"); - fseek(mirror , 0, SEEK_SET); - - fgets(__tmp_string, 256, mirror ); - linetoadd=__tmp_string; - while (linetoadd.find(_currentprinter)==-1 || linetoadd.find("[")==-1) - { - fputs (__tmp_string, mirror2 ); - fgets (__tmp_string, 256, mirror ); - linetoadd=__tmp_string; - } - fgets(__tmp_string, 256, mirror ); - linetoadd=__tmp_string; - while(linetoadd.find("[")==-1) - { - fgets (__tmp_string, 256, mirror ); - linetoadd=__tmp_string; - } - fputs (__tmp_string, mirror2 ); - while (fgets(__tmp_string, 256, mirror )) - { - fputs (__tmp_string, mirror2 ); - } - -#if XVT_OS != XVT_OS_SCOUNIX - fflush(mirror2 ); -#endif - fclose(mirror2 ); - fclose(mirror ); - junk=_mirrorname; - _mirrorname=_mir2name; - _mir2name=junk; - mirror =fopen(_mirrorname, "a+"); -} - -void EPF_Application::save_file (bool saveas) -{ - int junk=0; - TString currents; - - if (!saveas) - { - if (!_haschanged) return; - if (!_isnamed) saveas=TRUE; - } - if (saveas) junk=accept_current_name (SAVE); - if (junk!=2) - { - fclose (current); - current = fopen (_currentname, "w"); - fseek(mirror , 0, SEEK_SET); - fgets(__tmp_string, 256, mirror ); - currents = __tmp_string; - if (currents.find("Default")==-1) - { - currents.ltrim(1); - currents.rtrim(2); - fprintf(current , "[Default]\n"); - fprintf(current , "%s\n", (char*)currents); - } - fseek(mirror , 0, SEEK_SET); - while (fgets(__tmp_string, 256, mirror )) - fputs(__tmp_string, current ); - fclose(current ); - fseek(mirror , 0, SEEK_END); - } -} - -bool EPF_Application::select_printer () -{ - TMask mask2(MSK_1); - int numb; - long pos; - - build_list_file(mirror, _plname); - printerlist=fopen(_plname, "r"); - build_list_box(printerlist, mask2, MSK_1_SELECTED); - mask2.run(); - _currentprinter=mask2.get(MSK_1_SELECTED); - numb=atoi(_currentprinter)+1; - seek_printer_no(mirror, numb, _currentprinter, &pos); - fclose(printerlist); - return (mask2.last_key()==K_ENTER ? TRUE : FALSE); -} - -void EPF_Application::set_field (TMask& mask, int fldid, char* str, bool inrun) -{ - mask.set(fldid, str); -} - -void EPF_Application::fill_mask (TMask& mask, bool inrun) // a ba2300 -{ - TString junk; - bool found=FALSE; - - fseek(mirror , 0, SEEK_SET); - while (fgets(__tmp_string, 256, mirror ) && !found) - { - junk=__tmp_string; - if (junk.find(_currentprinter)!=-1 && junk.find("[")!=-1) - { - found=TRUE; - set_field(mask, MSK_23_LOGIC, (const char *) _currentprinter, inrun); - fgets(__tmp_string, 256, mirror ); - junk=__tmp_string; - junk.ltrim(14); - junk.rtrim(1); - set_field(mask, MSK_23_TYPE, junk, inrun); - fgets(__tmp_string, 256, mirror ); - junk=__tmp_string; - junk.ltrim(14); - junk.rtrim(1); - set_field(mask, MSK_23_PHYSIC, (const char*)junk, inrun); - fgets(__tmp_string, 256, mirror ); - junk=__tmp_string; - junk.ltrim(14); - junk.rtrim(1); - set_field(mask, MSK_23_FILTER, (const char *)junk, inrun); - fgets(__tmp_string, 256, mirror ); - junk=__tmp_string; - junk.ltrim(14); - junk.rtrim(1); - set_field(mask, MSK_23_NORMAL, (const char *) junk, inrun); - fgets(__tmp_string, 256, mirror ); - junk=__tmp_string; - junk.ltrim(14); - junk.rtrim(1); - set_field(mask, MSK_23_BOLD, (const char *) junk, inrun); - fgets(__tmp_string, 256, mirror ); - junk=__tmp_string; - junk.ltrim(14); - junk.rtrim(1); - set_field(mask, MSK_23_ITALIC, (const char *) junk, inrun); - fgets(__tmp_string, 256, mirror ); - junk=__tmp_string; - junk.ltrim(14); - junk.rtrim(1); - set_field(mask, MSK_23_UNDERLINED, (const char *) junk, inrun); - } - } -} - -void EPF_Application::fill_print_codes (TMask& mask) -{ - TString junk; - int intjunk; - char* ok; - - junk=mask.get(MSK_23_NAMES); - intjunk=atoi(junk); - - codes=fopen(_cdname, "r"); - for (int i=0; i= 0; i--) + { + path = a.row(i); + _tree.goto_root(); + _tree.add_son(path.name()); + + path.add("*"); + list_dirs(path, b); + b.TArray::sort(compare_lessons); + for (int j = b.items()-1; j >= 0; j--) + { + path = b.row(j); + desc = path.name(); - if (_isopened && _currentprinter.find("** new file **")==-1) - { - TMask mask(MSK_3); - - selprinter=1; - seek_first_printer(mirror, _currentprinter, &pos); - build_code_files(mirror, _cdname, _nmname, _currentprinter); - names=fopen(_nmname, "r"); - build_list_box (names, mask, MSK_23_NAMES); - fclose(names); - build_list_file(mirror, _plname); - fill_print_codes (mask); - mask.set_handler(MSK_23_NAMES, names_on_key); - mask.set_handler(MSK_3_PREVIOUS, prev_on_key); - mask.set_handler(MSK_3_NEXT, next_on_key); - fill_mask(mask, TRUE); - mask.deactivate(); - mask.enable(MSK_23_NAMES); - mask.enable(MSK_3_PREVIOUS); - mask.enable(MSK_3_NEXT); - - mask.run(); - } else warning_box ("Nessun file aperto"); + path.add("backup.ini"); + TConfig ini(path, "Main"); + desc << " - " << ini.get("Description"); + if (desc.not_empty()) + { + _tree.add_son(desc); + _tree.goto_father(); + } + } + } } + tf.set_tree(&_tree); + _tree.goto_root(); + _tree.expand_all(); + tf.win().force_update(); +} + +bool TAutoform_mask::forget_lesson(TTree& tree, void* jolly, word flags) +{ + if (!tree.has_son()) + { + TAutoform_tree& at = (TAutoform_tree&)tree; + TString desc; at.get_description(desc); + desc.cut(5); + at.forget(desc); + } + return FALSE; +} + +void TAutoform_mask::reset_lesson() +{ + TTree_field& tf = tfield(F_TREE); + if (tf.goto_selected()) + { + if (_tree.goto_firstson()) + _tree.scan_depth_first(forget_lesson, NULL); + else + forget_lesson(_tree, NULL, 0); + tf.win().force_update(); + } +} + +bool TAutoform_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) +{ + switch (o.dlg()) + { + case F_PATH: + if (e == fe_init || e == fe_modify) + fill_tree(); break; - case DELETE_PRINTER: - if (_isopened) - { - _haschanged=TRUE; - build_list_file(mirror, _plname); - if (select_printer()) - delete_printer(); - } else warning_box ("Nessun file aperto"); + case DLG_RESET: + if (e == fe_button) + reset_lesson(); break; - default: + default: break; } - return TRUE; } -#endif +TAutoform_mask::TAutoform_mask() : TAutomask("ba2300") +{ + TConfig& ini = _tree.ini(); + set(F_PATH, ini.get("Path")); + set(F_STUDENT, ini.get("Student")); + set(F_SOLUTION, ini.get("Solution")); +} + +TAutoform_mask::~TAutoform_mask() +{ + TConfig& ini = _tree.ini(); + ini.set("Path", get(F_PATH)); + ini.set("Student", get(F_STUDENT)); + ini.set("Solution", get(F_SOLUTION)); +} + + +/////////////////////////////////////////////////////////// +// Autoform app +/////////////////////////////////////////////////////////// + +class TAutoform_app : public TArchive_app +{ +protected: + virtual void main_loop(); +}; + +void TAutoform_app::main_loop() +{ + TAutoform_mask msk; + if (msk.run() == K_ENTER) + { + TTree_field& tf = msk.tfield(F_TREE); + TAutoform_tree& tree = msk.tree(); + if (tf.goto_selected() && !tree.has_son()) + { + TString desc; tree.get_description(desc); + if (yesno_box("Si desidera caricare i dati\n%s?", (const char*)desc)) + { + desc.cut(5); + const short dlg = desc.right(1) == "I" ? F_STUDENT : F_SOLUTION; + const TFilename old_study = prefix().get_studio(); + TFilename study = msk.get(dlg); + if (study.empty()) + msk.set(dlg, study = old_study); + if (study != old_study) + prefix().set_studio(study); + restore(0x3, 0, msk.get(F_PATH)); + tree.study(desc); + } + } + } +} int ba2300(int argc, char* argv[]) { -#if XVT_OS == XVT_OS_SCOUNIX - epf.run(argc, argv, "Manutenzione stampanti"); -#endif + TAutoform_app app; + app.run(argc, argv, "Autoformazione"); return 0; } - diff --git a/ba/ba2300.h b/ba/ba2300.h index 1a198f7c0..6f92e6a16 100755 --- a/ba/ba2300.h +++ b/ba/ba2300.h @@ -1,67 +1,5 @@ -#define MSK_1_SELECTED 101 - -#define MSK_23_LOGIC 101 -#define MSK_23_PHYSIC 102 -#define MSK_23_FILTER 103 -#define MSK_23_TYPE 104 -#define MSK_23_NORMAL 105 -#define MSK_23_BOLD 106 -#define MSK_23_ITALIC 107 -#define MSK_23_UNDERLINED 108 -#define MSK_23_NAMES 111 -#define MSK_23_CODES 112 - -#define MSK_2_ADD 113 - -#define MSK_3_PREVIOUS 109 -#define MSK_3_NEXT 110 - -#define MSK_4_MESSAGE -1 // It is A Static Field! -#define MSK_4_CODE 101 - - -#define MSK_1 "ba2300a.msk" -#define MSK_2 "ba2300b.msk" -#define MSK_3 "ba2300c.msk" -#define MSK_4 "ba2300d.msk" - -#define FILE_PRINTERS "prn.epf" -#define MSK_PRINTERS prn.epf -#define MSK_NAMES nms.epf -#define FILE_NAMES "nms.epf" -#define FILE_DEF_NAMES "dnms.epf" -#define FILE_DEF_CODES "dcds.epf" -#define FILE_CODES "cds.epf" - -#ifdef __BA2300_CPP - -#define EXTENSION "ini" - -#define OPEN TRUE -#define SAVE FALSE - -#define NEW_FILE 14101 -#define OPEN_FILE 14102 -#define SAVE_FILE 14103 -#define SAVE_FILE_AS 14104 -#define QUIT_EPF 14105 -#define INSERT_PRINTER 1201 -#define MODIFY_PRINTER 1202 -#define SHOW_PRINTER 1204 -#define DELETE_PRINTER 1203 - -bool build_code_files (FILE* iput, TFilename& outcdfile, TFilename& outnmfile, TString& printer); -void build_list_box (FILE* names, TMask& mask, short field); -void build_list_file (FILE* inputfile, TFilename& outputfile); -bool change_default_printer (TFilename& inputfilename, FILE* inputfile, TString& newdefprinter); -bool erase_file (TFilename& filename); -bool is_present (FILE* inputfile, TString& printer); -void item2prname (TString& item, TString& mame); -void place_codes_on_file (FILE* names, FILE* codes, FILE* output); -bool seek_default_printer (FILE* inputfile, TString& newprinter, long* position, bool justafter=TRUE); -bool seek_first_printer (FILE* input, TString& printer, long* pos, bool justafter=TRUE); -bool seek_printer (FILE* inputfile, TString& printer, long* position, bool justafter=TRUE); -bool seek_printer_no (FILE* inputfile, int number, TString& printer, long* position, bool justafter=TRUE); - -#endif - +#define DLG_RESET 100 +#define F_PATH 101 +#define F_STUDENT 102 +#define F_SOLUTION 103 +#define F_TREE 150 diff --git a/ba/ba2300.uml b/ba/ba2300.uml new file mode 100755 index 000000000..470ee04cb --- /dev/null +++ b/ba/ba2300.uml @@ -0,0 +1,48 @@ +#include "ba2300.h" + +TOOLBAR "" 0 -2 0 3 + +BUTTON DLG_SELECT 10 2 +BEGIN + PROMPT -13 -11 "~Selezione" + MESSAGE EXIT,K_ENTER + PICTURE BMP_SELECT +END + +BUTTON DLG_RESET 20 2 +BEGIN + PROMPT -23 -11 "~Azzera" +END + +BUTTON DLG_QUIT 10 2 +BEGIN + PROMPT -33 -11 "" +END + +ENDPAGE + +PAGE "Autoformazione" 0 0 0 -3 + +STRING F_PATH 50 +BEGIN + PROMPT 1 1 "Cartella corsi " +END + +STRING F_STUDENT 50 +BEGIN + PROMPT 1 2 "Area studente " +END + +STRING F_SOLUTION 50 +BEGIN + PROMPT 1 3 "Area soluzioni " +END + +TREE F_TREE 78 -1 +BEGIN + PROMPT 1 4 "" +END + +ENDPAGE + +ENDMASK \ No newline at end of file diff --git a/ba/ba3100.cpp b/ba/ba3100.cpp index bca837a99..9b4672f86 100755 --- a/ba/ba3100.cpp +++ b/ba/ba3100.cpp @@ -470,7 +470,7 @@ bool TGeneric_table_app::valute_decimals_handler(TMask_field& f, KEY k) { // Se il cambio e' espresso in EURO metto in R10 il valore in lire cambio = 1936.27 / cambio; - cambio.round(2); + cambio.round(5); } m.set(VAL_CHANGE_OLD, cambio); } @@ -500,7 +500,7 @@ bool TGeneric_table_app::change_decimals_handler(TMask_field& f, KEY k) { // Se il cambio e' espresso in EURO metto in R10 il valore in lire cambio = 1936.27 / cambio; - cambio.round(2); + cambio.round(5); } m.set(FLD_TABCAM_R10, cambio); } diff --git a/ba/ba3300.cpp b/ba/ba3300.cpp index 7cb0d9a37..80dcaef04 100755 --- a/ba/ba3300.cpp +++ b/ba/ba3300.cpp @@ -253,8 +253,7 @@ static bool codditta_handler(TMask_field& field, KEY key) //m.field(F_ANNOREG).show(); //m.field(F_CODICEREG).show(); //} - app()._ragsoc = "SOCIETA' "; - app()._ragsoc << nditte.get(N_RAGSOC); + app()._ragsoc = nditte.get(N_RAGSOC); m.set(F_RAGSOC,app()._ragsoc); const TString16 tipoa = nditte.get(N_TIPOA); diff --git a/ba/ba3600.cpp b/ba/ba3600.cpp index 1dfcd62f1..4760cfbf5 100755 --- a/ba/ba3600.cpp +++ b/ba/ba3600.cpp @@ -13,8 +13,6 @@ #include "ba3600.h" #include "ba3601.h" -static TString256 tmp; - class TStampa_indici : public TPrint_application { struct ind_lib @@ -55,7 +53,8 @@ class TStampa_indici : public TPrint_application TString _ind_dta,_civ_dta,_cap_dta,_com_dta,_prov_dta; bool _ho_stampato_almeno_un_bollato; - + TString tmp; + public: // TPrint_application virtual bool user_create() ; virtual bool user_destroy(); diff --git a/ba/ba3700a.uml b/ba/ba3700a.uml index e6ec3b6c1..d0b042f3b 100755 --- a/ba/ba3700a.uml +++ b/ba/ba3700a.uml @@ -174,11 +174,11 @@ END SPREADSHEET F_SHEET_RPG BEGIN - PROMPT 0 11 "" + PROMPT 1 11 "" ITEM "N.ro giorni rata" ITEM "Percentuale" - ITEM "Tipo@1" - ITEM "Class.@1" + ITEM "Tipo@4" + ITEM "Class." ITEM "Descrizione@50" END diff --git a/ba/ba3a00.cpp b/ba/ba3a00.cpp index b0b258f3b..a80073191 100755 --- a/ba/ba3a00.cpp +++ b/ba/ba3a00.cpp @@ -90,7 +90,7 @@ void Stampa_condizioni_pagamento_application::print_header() reset_header (); set_header (soh++, ""); - set_header (soh++, "@bCONDIZIONI DI PAGAMENTO @r@109gData @< Pag. @#"); + set_header (soh++, "@bCONDIZIONI DI PAGAMENTO @r@107gData @> Pag. @#"); set_header (soh++, ""); set_header (soh++, "@47gTp @53gInizio @66gMese @73gGiorni@89gIntervallo@108gScadenze"); set_header (soh++, "Cod. @12gDescrizione @47gdoc.@53gcalcolo@66gcomm. @73gsc. fissa@92grate@103gNr. gg. %% Td. ult. cl."); diff --git a/ba/ba6100.cpp b/ba/ba6100.cpp index 3cd5fd2dc..2b69d9296 100755 --- a/ba/ba6100.cpp +++ b/ba/ba6100.cpp @@ -73,7 +73,7 @@ void TAnaprint_app::set_page(int file, int cnt) { if (_pr_what != nditte && file == LF_NDITTE) { - set_row(1,"@50g$[r]@pN$[n]@66g@S", FLD(LF_NDITTE,"CODDITTA","@@@@@"), + set_row(1,"@58g$[v]@pN$[n]@66g@S", FLD(LF_NDITTE,"CODDITTA","@@@@@"), FLD(LF_NDITTE,"RAGSOC")); set_row(2,""); } @@ -123,10 +123,20 @@ bool TAnaprint_app::preprocess_page(int file, int counter) _com = current_cursor()->curr(LF_ANAG).get("COMRES"); if (_com.empty()) _com = current_cursor()->curr(LF_ANAG).get("COMRF"); - _phone = current_cursor()->curr(LF_ANAG).get("PTELRF"); - _phone.trim(); - if (!_phone.empty()) _phone << '/'; - _phone << current_cursor()->curr(LF_ANAG).get("TELRF"); + if (_pr_what == nditte) + { + _phone = current_cursor()->curr(LF_NDITTE).get("PTEL"); + _phone.trim(); + if (!_phone.empty()) _phone << '/'; + _phone << current_cursor()->curr(LF_NDITTE).get("TEL"); + } + if (_phone.empty() || _pr_what != nditte) + { + _phone = current_cursor()->curr(LF_ANAG).get("PTELRF"); + _phone.trim(); + if (!_phone.empty()) _phone << '/'; + _phone << current_cursor()->curr(LF_ANAG).get("TELRF"); + } const TRectype& cc = look_com(_com); _com = cc.get("DENCOM"); @@ -290,7 +300,7 @@ bool TAnaprint_app::set_print(int) _pr_type = elenco; // cio' che e' blu collega al modulo anagrafiche _ana_link = enable_link("Collegamento archivio anagrafiche: ", 'b'); - _dit_link = enable_link("Collegamento archivio ditte: ", 'r'); + _dit_link = enable_link("Collegamento archivio ditte: ", 'v'); break; case BUT_BA6_SCHEDE: disable_links(); @@ -372,7 +382,7 @@ bool TAnaprint_app::set_print(int) break; case BUT_BA6_RUBRICHE: _ana_link = enable_link("Collegamento archivio anagrafiche: ", 'b'); - _dit_link = enable_link("Collegamento archivio ditte: ", 'r'); + _dit_link = enable_link("Collegamento archivio ditte: ", 'v'); _pr_type = rubriche; break; } diff --git a/ba/ba6100b.uml b/ba/ba6100b.uml index bd41c1709..89c38dbe6 100755 --- a/ba/ba6100b.uml +++ b/ba/ba6100b.uml @@ -11,11 +11,11 @@ BEGIN PROMPT 47 1 "Colonna" END -RADIOBUTTON RDB_BA6B_INDIR 23 +RADIOBUTTON RDB_BA6B_INDIR 34 BEGIN PROMPT 4 1 "Indirizzo" ITEM "1|Residenza" - ITEM "2|Domicilio fiscale" + ITEM "2|Domicilio fiscale/Sede legale" ITEM "3|Corrispondenza" HELP "Indicare l'indirizzo da includere nelle etichette" END diff --git a/ba/ba6101.cpp b/ba/ba6101.cpp index c7461c59b..662793aec 100755 --- a/ba/ba6101.cpp +++ b/ba/ba6101.cpp @@ -841,7 +841,7 @@ void TAnaprint_app::set_rubriche() if (_pr_what == nditte) { - set_row(1,"@b$[r]@pN@r$[n]@3j@50S", + set_row(1,"@b$[v]@pN@r$[n]@3j@50S", FLD(LF_NDITTE,"CODDITTA","@@@@@"), FLD(LF_NDITTE,"RAGSOC")); } @@ -879,12 +879,12 @@ void TAnaprint_app::set_elenco() FLD(LF_ANAG,"RAGSOC")); } if (_inclditte) - set_row(1,"@58g$[r]@pN$[n]@66g@S", + set_row(1,"@58g$[v]@pN$[n]@66g@S", FLD(LF_NDITTE,"CODDITTA","@@@@@"), FLD(LF_NDITTE,"RAGSOC")); break; case nditte: - set_row(1,"$[r]@pN$[n]@10g@S@50g@S @pN@3j@S", + set_row(1,"$[v]@pN$[n]@10g@S@50g@S @pN@3j@S", FLD(LF_NDITTE,"CODDITTA","@@@@@"), FLD(LF_NDITTE,"RAGSOC"), FLD(LF_NDITTE,"TIPOA"), @@ -918,7 +918,7 @@ void TAnaprint_app::set_headers() case anagiu: set_background("W1l{1 2 132 2}W4l{1 5 132 5}"); set_header(1,"@bELENCO PERSONE %s@82gStudio@96gData" - "@101g @< @110g Pag. @#", _pr_what == anafis ? "FISICHE" : + "@101g @> @112g Pag. @#", _pr_what == anafis ? "FISICHE" : "GIURIDICHE"); set_header(3,"@iCodice@58gCodice"); set_header(4,"@iAnagr. Ragione sociale/cognome e nome@58gDitta" @@ -928,7 +928,7 @@ void TAnaprint_app::set_headers() case nditte: set_background("W1l{1 2 132 2}W4l{1 5 132 5}"); set_header(1,"@bELENCO DITTE@82gStudio@96gData" - "@101g @< @110g Pag. @#"); + "@101g @> @112g Pag. @#"); set_header(3,"@iCodice@50gT"); set_header(4,"@iAnagr. Denominazione sociale@50gP Codice" "@61gRagione sociale/Cognome e nome"); @@ -943,14 +943,22 @@ void TAnaprint_app::set_headers() case anafis: case anagiu: set_background("W1l{1 2 132 2}W4l{1 4 132 4}"); - set_header(1,"@bRUBRICA PERSONE %s@40gStudio@53gData @< pag. @#", +#else + set_header(2,(const char*)sep); + set_header(4,(const char*)sep); +#endif + set_header(1,"@bRUBRICA PERSONE %s@40gStudio@53gData @> pag. @#", _pr_what == anagiu ? "GIURIDICHE" : "FISICHE"); set_header(3,"@iCodice Cognome e nome"); set_header(5,""); break; case nditte: set_background("W1l{1 2 132 2}W4l{1 4 132 4}"); - set_header(1,"@bRUBRICA DITTE@40gStudio@53gData @< pag. @#"); +#else + set_header(2,(const char*)sep); + set_header(4,(const char*)sep); +#endif + set_header(1,"@bRUBRICA DITTE@40gStudio@53gData @> pag. @#"); set_header(3,"@iCodice Cognome e nome"); set_header(5,""); break; diff --git a/ba/ba7100.cpp b/ba/ba7100.cpp index e8372d5a7..a3b1aea85 100755 --- a/ba/ba7100.cpp +++ b/ba/ba7100.cpp @@ -2,22 +2,25 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include -#include +#include +#include #define NO_MFC #include #include "ba7.h" #include "ba7100a.h" +#define NOT_TRANS -883 +#define NOT_GEST -884 /////////////////////////////////////////////////////////// // TConfig utilities @@ -86,7 +89,7 @@ bool TMail_box::logon(const char* ser, const char* usr, const char* pwd) { if (_connection) logoff(); - + if (!IsOk()) return error_box("Impossibile inizializzare il client POP3"); @@ -100,24 +103,27 @@ bool TMail_box::logon(const char* ser, const char* usr, const char* pwd) if (_connection != 0) { TString buf; + TString req; ReadLine(_connection, buf); if (buf[0] != '+') - return error_box("Il server POP3 %s non risponde", - (const char*)server); + return error_box("Il server POP3 %s non risponde\nRisultato : %s", + (const char*)server, (const char *)buf); - buf = "USER "; buf << user << '\n'; + buf = "USER "; buf << user << "\r\n"; WriteLine(_connection, buf); + req = buf; ReadLine(_connection, buf); if (buf[0] != '+') - return error_box("Il server POP3 %s non accetta l'utente %s", - (const char*)server, (const char*)user); + return error_box("Il server POP3 %s non accetta l'utente %s\nRichiesta : %sRisultato : %s", + (const char*)server, (const char*)user, (const char *) req, (const char *)buf); - buf = "PASS "; buf << password << '\n'; + buf = "PASS "; buf << password << "\r\n"; WriteLine(_connection, buf); + req = buf; ReadLine(_connection, buf); if (buf[0] != '+') - return error_box("Il server POP3 %s non accetta l'utente %s", - (const char*)server, (const char*)user); + return error_box("Il server POP3 %s non accetta la password dell'utente %s\nRichiesta : %sRisultato : %s", + (const char*)server, (const char*)user, (const char *) req, (const char *)buf); } else return error_box("Impossibile contattare il server POP3 %s", @@ -130,7 +136,7 @@ void TMail_box::logoff() { if (_connection) { - WriteLine(_connection, "QUIT\n"); + WriteLine(_connection, "QUIT\r\n"); RemoveConnection(_connection); _connection = NULL; } @@ -142,7 +148,7 @@ bool TMail_box::list(TString_array& a) if (ok) { TString buf; - buf = "LIST\n"; + buf = "LIST\r\n"; WriteLine(_connection, buf); ReadLine(_connection, buf); ok = buf[0] == '+'; @@ -197,21 +203,28 @@ int TMail_box::get(TMail_messages& m) m.add(msgptr); TMail_message& msg = *msgptr; - buf = "RETR "; buf << *row << '\n'; + buf = "RETR "; buf << *row << "\r\n"; WriteLine(_connection, buf); ReadLine(_connection, buf); bool ok = buf[0] == '+'; EncodingType encoding = enc_plain_text; bool in_body = FALSE; bool in_section = FALSE; + bool buf_already_read = FALSE; boundary.cut(0); + while (ok) - { - if (!ReadLine(_connection, buf)) + { + if (!buf_already_read) { - ok = FALSE; - break; // Unexpected EOF + if (!ReadLine(_connection, buf)) + { + ok = FALSE; + break; // Unexpected EOF + } } + else + buf_already_read = FALSE; if (buf[0] == '.') { buf.ltrim(1); @@ -345,6 +358,8 @@ int TMail_box::get(TMail_messages& m) { ReadLine(_connection, buf); bnd = buf.find("oundary="); + if (bnd < 0) + buf_already_read = TRUE; } if (bnd > 0) { @@ -367,7 +382,7 @@ bool TMail_box::remove(const char* id) if (ok) { TString buf; - buf << "DELE " << id << '\n'; + buf << "DELE " << id << "\r\n"; WriteLine(_connection, buf); ReadLine(_connection, buf); ok = buf[0] == '+'; @@ -436,7 +451,9 @@ TFilter_expr::TFilter_expr(TAutomask& m, int logicnum, const char* expr) class TMailer_mask : public TAutomask { long _timer_id; + long _secs; int _mail_semaphore; + TViswin * _vv; protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); @@ -452,7 +469,8 @@ protected: public: void test_delete(); int fill_messages(); - bool save_curr_line(); + bool exec_app(int & err, const char * appname, const char * msg); + bool save_curr_line(int & err); void save_all_lines(); void auto_save_all(); @@ -645,7 +663,38 @@ bool TMailer_mask::file2app(const TString& file, TString& app) const return ok; } -bool TMailer_mask::save_curr_line() +bool TMailer_mask::exec_app(int & err, const char * appname, const char * msg) +{ + TFilename tmp; tmp.temp(); + { + ofstream outf(tmp); + TString message(msg); + message.replace('\r', '\n'); + outf << message; + outf.close(); + } + + TString command_line(appname); + command_line << " /i" << tmp << " -u" << ::dongle().administrator(); + TExternal_app app(command_line); + err = app.run(); + os_sleep(1000); + bool ok = err == NOERR; + if (ok) + { + TConfig ini(tmp, "Transaction"); + ok = ini.get("Result") == "OK"; + if (ok) + err = 0; + else + err = ini.get_int("Error"); + } + + ::remove(tmp); + return ok; +} + +bool TMailer_mask::save_curr_line(int & err) { TMail_lock ml(this); @@ -656,30 +705,34 @@ bool TMailer_mask::save_curr_line() const TString& msg = m.get(F_BODY); if (msg.find("[Transaction]") < 0) + { + err = NOT_TRANS; return FALSE; // It's not a transaction + } + TFilename appname; - if (!file2app(m.get(F_SUBJECT), appname)) - return FALSE; // It hasn't a valid application - - TFilename tmp; tmp.temp(); - ofstream outf(tmp); - outf << msg; - outf.close(); - - const TString old_mailto = set_ini_var(CONFIG_INSTALL, "Main", "MailTo", ""); - - appname << " /i" << tmp << " -u" << ::dongle().administrator(); - TExternal_app app(appname); - bool ok = app.run() == NOERR; - if (ok) - { - TConfig ini(tmp, "Transaction"); - ok = ini.get("Result") == "OK"; + const TString& subj = m.get(F_SUBJECT); + if (!file2app(subj, appname)) // It hasn't a valid application + { + err = NOT_GEST; + return FALSE; } - ::remove(tmp); + const TString old_mailto = set_ini_var(CONFIG_INSTALL, "Main", "MailTo", ""); + bool ok = exec_app(err, appname, msg); + if (!ok && err == 204) + { + TString insmsg(msg); + int pos = insmsg.find("MODIFY"); + if (pos > 0) + { + insmsg.overwrite("INSERT", pos); + ok = exec_app(err, appname, insmsg); + } + } + if (ok) { if (m.is_running()) @@ -698,33 +751,83 @@ bool TMailer_mask::save_curr_line() if (old_mailto.not_empty()) set_ini_var(CONFIG_INSTALL, "Main", "MailTo", old_mailto); - return TRUE; + return ok; } void TMailer_mask::save_all_lines() -{ - TMail_lock ml(this); - TWait_cursor hourglass; +{ + CHECK(_vv == NULL,"Viswin already open ?"); + mail_lock(); + + TViswin viswin(NULL, "Registrazione documenti", FALSE, TRUE, TRUE); + viswin.open_modal(); + _vv = &viswin; TSheet_field& sf = sfield(F_MESSAGES); - TString body; + TString body, msg; + + time_t tempo; + time(&tempo); + const struct tm* d = localtime(&tempo); + msg.format("Inizio elaborazione: %02d-%02d-%04d %02d:%02d:%02d", + d->tm_mday, d->tm_mon+1, 1900+d->tm_year, + d->tm_hour, d->tm_min, d->tm_sec); + viswin.add_line(msg); + viswin.add_line(""); bool one_saved = FALSE; - FOR_EACH_SHEET_ROW(sf, nrow, row) if (*row->get(0) != 'X') + FOR_EACH_SHEET_ROW(sf, nrow, row) { - row->get(sf.cid2index(F_BODY), body); - if (body.find("[Transaction]") >= 0) + msg.format("Messaggio %d ", nrow+1); + if (*row->get(0) != 'X') { - sf.select(nrow); - one_saved |= save_curr_line(); + row->get(sf.cid2index(F_BODY), body); + if (body.find("[Transaction]") >= 0) + { + sf.select(nrow); + int err = 0; + const bool yes = save_curr_line(err); + if (yes) + { + msg << "elaborato con successo"; + one_saved = TRUE; + } + else + if (err == NOT_GEST) + { + TSheet_field& sf = sfield(F_MESSAGES); + TMask& m = sf.sheet_mask(); + msg << " definire il programma gestore del file " << m.get(F_SUBJECT); + } + else + msg << "non elaborato a causa di un errore (n.ro " << err << ")"; + } + else + msg << "ignorato in quanto transazione non riconosciuta"; } - } + else + msg << "ignorato in quanto già elaborato"; + viswin.add_line(msg); + } + + viswin.add_line(""); + viswin.add_line("Fine elaborazione"); + viswin.close_print(); + viswin.close_modal(); + mail_unlock(); + viswin.run(); + +#ifdef DBG if (one_saved && yesno_box("Si desidera eliminare i messaggi processati?")) - { +#else + if (one_saved) +#endif + { test_delete(); fill_messages(); } + _vv = NULL; } bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) @@ -734,7 +837,7 @@ bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly case F_TIMER: if (e == fe_init || e == fe_modify) { - if (_timer_id) + if (_timer_id != XVT_TIMER_ERROR) { xvt_timer_destroy(_timer_id); _timer_id = XVT_TIMER_ERROR; @@ -742,7 +845,8 @@ bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly const long minutes = atol(o.get()); if (minutes > 0) { - _timer_id = xvt_timer_create(win(), minutes * 60000L); + _timer_id = xvt_timer_create(win(), 1000L); + _secs = 0L; if (_timer_id == XVT_TIMER_ERROR) return error_box("Impossibile impostare il timer"); } @@ -765,8 +869,25 @@ bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly } break; case DLG_USER: - if (e == fe_button) - save_curr_line(); + if (e == fe_button) + { + int err = 0; + if (!save_curr_line(err)) + { + if (err == NOT_TRANS) + message_box("Messaggio ignorato in quanto transazione non riconosciuta"); + else + if (err == NOT_GEST) + { + TSheet_field& sf = sfield(F_MESSAGES); + TMask& m = sf.sheet_mask(); + error_box("Definire il programma gestore del file %s", (const char*)m.get(F_SUBJECT)); + } + else + message_box("Messaggio non elaborato a causa di un errore (n.ro %d)", err); + } + + } break; case DLG_SAVEREC: if (e == fe_button) @@ -849,9 +970,10 @@ void TMailer_mask::auto_save_all() { if (_mail_semaphore == 0) { - TMail_lock ml(this); + mail_lock(); test_delete(); fill_messages(); + mail_unlock(); if (!field(F_TIMER).empty()) save_all_lines(); } @@ -860,11 +982,23 @@ void TMailer_mask::auto_save_all() } void TMailer_mask::handler(WINDOW win, EVENT* ep) -{ +{ if (ep->type == E_TIMER) { if (ep->v.timer.id == _timer_id && _mail_semaphore == 0) - auto_save_all(); + { + _secs++; + if (_secs >= get_long(F_TIMER) * 60) + { + if (_vv) + _vv->stop_run(K_ESC); + else + { + _secs = 0L; + auto_save_all(); + } + } + } } TAutomask::handler(win, ep); } @@ -894,7 +1028,8 @@ void TMailer_mask::load() TMailer_mask::TMailer_mask() : TAutomask("ba7100a"), - _timer_id(XVT_TIMER_ERROR), _mail_semaphore(0) + _timer_id(XVT_TIMER_ERROR), _mail_semaphore(0), + _vv(NULL) { load(); if (user() != ::dongle().administrator()) diff --git a/ba/ba883.cpp b/ba/ba883.cpp index 04cd59624..b1a9a9ece 100755 --- a/ba/ba883.cpp +++ b/ba/ba883.cpp @@ -706,25 +706,19 @@ void TBenchmark_application::test_file_random() void TBenchmark_application::test_file_write() { initializing(); - - start_test("Scrittura/Modifica/Cancellazione"); - TTable tab("DIK"); - int err; - for (long n = 0; n < 200; n++) + TTable tab("GUY"); + + start_test("Scrittura della tabella GUY"); + + TString16 codtab; + int err = NOERR; + for (long n = 0; err == NOERR && n < 1000000L; n++) { - tab.zero(); - tab.put("CODTAB", "MIN"); - tab.put("S0", "BEG"); + codtab.format("%07ld", n); + tab.put("CODTAB", codtab); + tab.put("S0", codtab); err = tab.write(); - - tab.put("S0", "CAZ"); - err = tab.rewrite(); - - tab.zero(); - tab.put("CODTAB", "MIN"); - err = tab.remove(); - update_bar(n); } diff --git a/ba/bacnv.cpp b/ba/bacnv.cpp index 3d1909b17..86eb7948e 100755 --- a/ba/bacnv.cpp +++ b/ba/bacnv.cpp @@ -187,6 +187,7 @@ public: void convert_cap() const; void convert_uue() const; void convert_pim2prm() const; + void convert_riba_tcf() const; TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {} }; @@ -333,6 +334,10 @@ bool TConversione_archivi::menu(MENU_TAG) if (_codditta > 0) convert_pim2prm(); break; + case 18: + if (_codditta > 0) + convert_riba_tcf(); + break; default: break; } @@ -1635,6 +1640,25 @@ void TConversione_archivi::convert_pim2prm() const } } +// Aggiunge il tipo cliente C alle ricevute bancarie +void TConversione_archivi::convert_riba_tcf() const +{ + TLocalisamfile f(LF_EFFETTI); + TRectype& r = f.curr(); + long n = f.items(); + TProgind p(n, format("Conversione effetti ditta %ld", get_firm()), FALSE, TRUE, 70); + p.setstatus(1L); + for (int err = f.first(); err == NOERR; err = f.next()) + { + p.addstatus(1L); + if (r.get("TIPOCF").blank()) + { + r.put("TIPOCF","C"); + f.rewrite(); + } + } +} + /////////////////////////////////////////////////////////// // Programma di conversione archivi speciale /////////////////////////////////////////////////////////// @@ -1643,7 +1667,7 @@ int main(int argc,char** argv) { const int r = (argc > 1) ? abs(atoi(argv[1])) : 0; - if (r < 0 || r > 17) + if (r < 0 || r > 18) { error_box(usage); return 100; diff --git a/ba/bainst.cpp b/ba/bainst.cpp index 463d662eb..ce4365bc0 100755 --- a/ba/bainst.cpp +++ b/ba/bainst.cpp @@ -558,10 +558,12 @@ int main(int argc,char** argv) r=bainst31(argc, argv);// pre/post installazione vendite: else if (mod == "mg") r=bainst32(argc, argv);// pre/post installazione magazzino: + else if (mod == "ef") + r=bainst34(argc, argv);// pre/post installazione effetti: else if (mod == "sv") r=bainst38(argc, argv);// pre/post installazione statistiche: else if (mod == "db") - r=bainst35(argc, argv);// pre/post installazione DI.BA. + r=bainst35(argc, argv);// pre/post installazione distinta base: else if (mod == "mr") r=bainst39(argc, argv);// pre/post installazione MRP else diff --git a/ba/bainst.h b/ba/bainst.h index 69da44263..012fa55b5 100755 --- a/ba/bainst.h +++ b/ba/bainst.h @@ -9,6 +9,7 @@ int bainst17(int argc, char** argv); int bainst31(int argc, char** argv); int bainst32(int argc, char** argv); int bainst35(int argc, char** argv); +int bainst34(int argc, char** argv); int bainst38(int argc, char** argv); int bainst39(int argc, char** argv); diff --git a/ba/bainst.url b/ba/bainst.url index f756c9e4b..64aa58bf2 100755 --- a/ba/bainst.url +++ b/ba/bainst.url @@ -1,21 +1,7 @@ #include -/* ba1 -0 */ +/* bainst BA */ MENU TASK_MENUBAR SUBMENU MENU_FILE "~File" -/* ba1 -1 */ -MENUBAR MENU_BAR(1) - -MENU MENU_BAR(1) - SUBMENU MENU_FILE "~File" - -/* ba1 -1 */ -MENUBAR MENU_BAR(2) - -MENU MENU_BAR(2) - SUBMENU MENU_FILE "~File" - - - diff --git a/ba/bainst00.cpp b/ba/bainst00.cpp index 1faa3fb72..f4585fc5d 100755 --- a/ba/bainst00.cpp +++ b/ba/bainst00.cpp @@ -4,18 +4,21 @@ #include #include #include +#include #include "bainst.h" -#include "bainst07.h" +#include "bainst00.h" class TInstall_BA : public TInstallmodule_app { private: protected: - virtual bool modal() const {return FALSE;} + virtual bool modal() const {return TRUE;} virtual int module_number() const {return 0;} virtual bool install_firm() {return TRUE;} // no firm installation - virtual bool install_com() {return TRUE;} // no com installation +// virtual bool install_com() {return TRUE;} // no com installation + virtual bool install_com(); + virtual bool load_default_data() const ; virtual bool post_installer(); public: @@ -80,6 +83,26 @@ bool TInstall_BA::post_installer() return TRUE; } +bool TInstall_BA ::install_com() +{ + bool ok=TRUE; + TStd_filename txtfile; + if (txtfile.check(TRUE,"lfiva.txt")) + { + TSystemisamfile tabcom(LF_TABCOM); + tabcom.load((const char *)txtfile); + } + return ok; +} + +bool TInstall_BA ::load_default_data() const +{ + TTable iva("%IVA"); + const bool empty = iva.first() != NOERR; + + return empty; +} + int bainst00(int argc, char** argv) { TInstall_BA app; diff --git a/ba/bainst00.h b/ba/bainst00.h new file mode 100755 index 000000000..48caf7fda --- /dev/null +++ b/ba/bainst00.h @@ -0,0 +1,2 @@ +#include "bainsta.h" + diff --git a/ba/bainst00.uml b/ba/bainst00.uml new file mode 100755 index 000000000..da7c655b3 --- /dev/null +++ b/ba/bainst00.uml @@ -0,0 +1,21 @@ +#include "bainst00.h" + +PAGE "Installazione dati IVA" -1 -1 78 8 +// GROUP 1 = PRE-INSTALLATION +// GROUP 2 = POST-INSTALLATION + +BOOL F_DEFAULTSDATA +BEGIN + PROMPT 2 2 "Installa dati IVA" + GROUP 1 +END + +BUTTON DLG_OK 10 2 +BEGIN + PROMPT -11 -1 "~Conferma" + MESSAGE EXIT,K_ENTER + PICTURE BMP_OK +END + +ENDPAGE +ENDMASK diff --git a/ba/bainst07.cpp b/ba/bainst07.cpp index cbc1a1e46..e768018fd 100755 --- a/ba/bainst07.cpp +++ b/ba/bainst07.cpp @@ -15,29 +15,15 @@ private: bool CreaExeIni(const char * exename); protected: + virtual bool modal() const {return FALSE;} virtual int module_number() const {return 7;} virtual bool install_firm() {return TRUE;} // no firm installation - virtual bool install_com(); virtual bool post_installer(); public: virtual ~TInstall_CG () {} }; -bool TInstall_CG ::install_com() -{ - // modifica per morena da togliere appena c'e' tempo: - // installa fliva.txt che noin c'e' in STD dei programmi, - // quindi la cerca in area dati (come prima) - bool ok=TRUE; - TStd_filename txtfile; - if (txtfile.check(TRUE,"lfiva.txt")) - { - TSystemisamfile tabcom(LF_TABCOM); - tabcom.load((const char *)txtfile); - } - return ok; -} // crea il .ini per i files exe copiati nella directory di EASYCAMPO bool TInstall_CG ::CreaExeIni(const char * exename) diff --git a/ba/bainst34.cpp b/ba/bainst34.cpp new file mode 100755 index 000000000..523be8a2c --- /dev/null +++ b/ba/bainst34.cpp @@ -0,0 +1,49 @@ +#include +#include +#include +#include +#include +#include + +#include "bainst.h" +#include "bainst34.h" + +class TInstall_EF : public TInstallmodule_app +{ +protected: +// virtual bool load_type() const ; + virtual int module_number() const {return 34;} + virtual bool post_installer(); + virtual bool modal() const {return FALSE;} + +public: + virtual ~TInstall_EF () {} +}; + +bool TInstall_EF::post_installer() +{ + return TRUE; +} + +/*bool TInstall_EF::load_type() const +{ + TLocalisamfile f(LF_EFFETTI); + TRectype& r = f.curr(); + for (int err = f.first(); err == NOERR; err = f.next()) + { + if (r.get("TIPOCF").blank()) + { + r.put("TIPOCF","C"); + f.rewrite(); + } + } + + return TRUE; +} +*/ +int bainst34(int argc, char** argv) +{ + TInstall_EF app; + app.run(argc, argv); + return 0; +} \ No newline at end of file diff --git a/ba/bainst34.h b/ba/bainst34.h new file mode 100755 index 000000000..15b7865a5 --- /dev/null +++ b/ba/bainst34.h @@ -0,0 +1 @@ +#include "bainsta.h" diff --git a/ba/batbiva.uml b/ba/batbiva.uml index 612ed4519..7e4e9ba89 100755 --- a/ba/batbiva.uml +++ b/ba/batbiva.uml @@ -212,29 +212,30 @@ BEGIN ITEM "16|Acquisti non soggetti all'imposta effettuati dai terremotati" END -STRING FLD_TABIVA_S10 3 +STRING FLD_TABIVA_S10 4 BEGIN PROMPT 3 12 "Riga vendite prospetto IVA periodica " FIELD S10 FLAGS "U" SHEET "Riga|Descrizione@60" INPUT FLD_TABIVA_S10 - ITEM " |Nessuno" - ITEM "VP1|Ammontare complessivo operazioni attive" - ITEM "VP2|Ammontare complessivo operazioni intracomunitarie" + ITEM "|Nessuno" + ITEM "VP1|Operazioni attive" + ITEM "VP1A|Operazioni attive ed anche cessioni intracomunitarie" OUTPUT FLD_TABIVA_S10 END -STRING FLD_TABIVA_S11 3 +STRING FLD_TABIVA_S11 4 BEGIN PROMPT 3 13 "Riga acquisti prospetto IVA periodica " FIELD S11 FLAGS "U" SHEET "Riga|Descrizione@60" INPUT FLD_TABIVA_S11 - ITEM " |Nessuno" - ITEM "VP3|Ammontare complessivo operazioni passive" - ITEM "VP4|Ammontare complessivo operazioni intracomunitarie" + ITEM "|Nessuno" + ITEM "VP2|Operazioni passive" + ITEM "VP2A|Operazioni passive ed anche acquisti intracomunitari" + ITEM "VP3|Importazioni di oro e argento" OUTPUT FLD_TABIVA_S11 END diff --git a/ba/batbrgi.uml b/ba/batbrgi.uml index 4e7eeb715..999a2ae59 100755 --- a/ba/batbrgi.uml +++ b/ba/batbrgi.uml @@ -26,16 +26,16 @@ END STRING F_DESCR 50 BEGIN - PROMPT 1 4 "Denonimazione " + PROMPT 1 4 "Denominazione " FIELD S0 KEY 2 USE %RGI KEY 2 INPUT S0 F_DESCR DISPLAY "Descrizione @50" S0 - DISPLAY "Codice" CODTAB + DISPLAY "Codice@10" CODTAB COPY OUTPUT F_CODREG CHECKTYPE REQUIRED - WARNING "La denomonazione e' obbligatoria" + WARNING "La denominazione e' obbligatoria" END ENDPAGE diff --git a/ba/batbsta.uml b/ba/batbsta.uml index af2a0a739..f93fe9cf8 100755 --- a/ba/batbsta.uml +++ b/ba/batbsta.uml @@ -63,7 +63,14 @@ END STRING FLD_TABSTA_S7_TABVAL_S0 50 BEGIN PROMPT 24 8 "" - FLAGS "D" + USE %VAL KEY 2 + CHECKTYPE NORMAL + INPUT S0 FLD_TABSTA_S7_TABVAL_S0 + DISPLAY "Codice" CODTAB + DISPLAY "Valuta@50" S0 + OUTPUT FLD_TABSTA_S7 CODTAB + OUTPUT FLD_TABSTA_S7_TABVAL_S0 S0 + HELP "Valuta corrente dello stato" END STRING FLD_TABSTA_S2 10 diff --git a/ba/batbucs.uml b/ba/batbucs.uml index 34e530e34..265599be2 100755 --- a/ba/batbucs.uml +++ b/ba/batbucs.uml @@ -74,7 +74,7 @@ END STRING FLD_TABUCS_S6_COMUNI_DENCOM 50 BEGIN - PROMPT 1 9 "Nome " + PROMPT 1 9 "Denominazione " USE LF_COMUNI KEY 2 INPUT DENCOM FLD_TABUCS_S6_COMUNI_DENCOM #include diff --git a/ba/batbuid.uml b/ba/batbuid.uml index 2de49c4c2..4c72ad30a 100755 --- a/ba/batbuid.uml +++ b/ba/batbuid.uml @@ -75,7 +75,11 @@ END STRING FLD_TABUID_S6_COMUNI_DENCOM 50 BEGIN PROMPT 3 9 "Denominazione " - FLAGS "D" + USE LF_COMUNI KEY 2 + INPUT DENCOM FLD_TABUID_S6_COMUNI_DENCOM +#include + COPY OUTPUT FLD_TABUID_S6 + CHECKTYPE NORMAL END STRING FLD_TABUID_S6_COMUNI_PROVCOM 2 diff --git a/ba/batbuiv.uml b/ba/batbuiv.uml index e4c4d0f63..1c4cdc771 100755 --- a/ba/batbuiv.uml +++ b/ba/batbuiv.uml @@ -17,7 +17,7 @@ BEGIN USE %UIV INPUT CODTAB FLD_TABUIV_CODTAB DISPLAY "Codice" CODTAB - DISPLAY "Dizione@50" S0 + DISPLAY "Denominazione@50" S0 OUTPUT FLD_TABUIV_CODTAB CODTAB OUTPUT FLD_TABUIV_S0 S0 HELP "Inserire il codice dell'ufficio IVA" @@ -26,12 +26,12 @@ END STRING FLD_TABUIV_S0 40 BEGIN - PROMPT 3 3 "Dizione " + PROMPT 3 3 "Denominazione " FIELD %UIV->S0 KEY 2 USE %UIV KEY 2 INPUT S0 FLD_TABUIV_S0 - DISPLAY "Dizione@50" S0 + DISPLAY "Denominazione@50" S0 DISPLAY "Codice" CODTAB OUTPUT FLD_TABUIV_CODTAB CODTAB OUTPUT FLD_TABUIV_S0 S0 diff --git a/ba/batbure.uml b/ba/batbure.uml index 137c9ab2b..1dd36d00b 100755 --- a/ba/batbure.uml +++ b/ba/batbure.uml @@ -72,7 +72,7 @@ END STRING FLD_TABURE_S6_COMUNI_DENCOM 50 BEGIN - PROMPT 3 9 "Nome " + PROMPT 3 9 "Denominazione " USE LF_COMUNI KEY 2 INPUT DENCOM FLD_TABURE_S6_COMUNI_DENCOM #include diff --git a/ba/batbval.uml b/ba/batbval.uml index dd46ae143..2d1cba10e 100755 --- a/ba/batbval.uml +++ b/ba/batbval.uml @@ -109,13 +109,15 @@ BEGIN PROMPT 2 12 "Cambio " FIELD S4 FLAGS "U" + CHECKTYPE REQUIRED + WARINING "E' necessario specificare un cambio di riferimento" END NUMBER VAL_CHANGE_OLD 15 5 BEGIN - PROMPT 2 12 "Cambio " + PROMPT 2 80 "Cambio " FIELD R10 - FLAGS "HU" + FLAGS "D" END DATE VAL_LASTDATE diff --git a/cg/cgarea.men b/ba/cgarea.men similarity index 100% rename from cg/cgarea.men rename to ba/cgarea.men diff --git a/ba/fconv.ini b/ba/fconv.ini index 97d6ccfaa..0824b4551 100755 --- a/ba/fconv.ini +++ b/ba/fconv.ini @@ -37,5 +37,7 @@ ACNV(119)=77cnv 1 ACNV(13)=bacnv 16 [199517] ACNV(5)=bacnv 17 +[199518] +ACNV(31)=bacnv 18 [EOF] diff --git a/ba/level.dir b/ba/level.dir index 48682607a..0f07c33eb 100755 --- a/ba/level.dir +++ b/ba/level.dir @@ -1 +1 @@ -199517 +199518 diff --git a/cg/cg0.cpp b/cg/cg0.cpp index d6deb7d0c..80355fb9e 100755 --- a/cg/cg0.cpp +++ b/cg/cg0.cpp @@ -12,7 +12,7 @@ int main(int argc, char** argv) case 3: cg0400(argc,argv); break; // Progressivi IVA case 4: cg0500(argc,argv); break; // Causali contabili case 5: cg0600(argc,argv); break; // Tabelle contabii - default: cg0100(argc,argv); break; // Piano deoi conti + default: cg0100(argc,argv); break; // Piano dei conti } exit(0); return 0; diff --git a/cg/cg0200.cpp b/cg/cg0200.cpp index 25ed40959..90ab3cc44 100755 --- a/cg/cg0200.cpp +++ b/cg/cg0200.cpp @@ -4,11 +4,13 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -166,7 +168,7 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key) return ok; TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ; - if ( f.get().not_empty() && !clifo.empty() ) + if (f.get().not_empty() && !clifo.empty() ) { clifo.zero() ; const char t1 = msk.get(F_TIPOCF)[0]; @@ -183,8 +185,8 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key) if (clifo.good() && (t1 != t || s1 != s)) { - f.message_box("Partita iva gia' utilizzata per il codice %c/%ld", - t, s); + ok = f.error_box("Partita iva gia' utilizzata per il codice %c/%ld" + "\nsenza avere indicato il valore 4 nell'inserimento in allegato", t, s); } } @@ -504,7 +506,11 @@ int TClifo_application::read(TMask& m) riga.add(rec.get(IND_PFAX)); riga.add(rec.get(IND_FAX)); riga.add(rec.get(IND_IVARID)); - riga.add(rec.get(IND_CODIND)); + TString16 key(rec.get(IND_STATO)); key << "|" << rec.get(IND_COM); + const TRectype & com = cache().get(LF_COMUNI, key); + riga.add(com.get(COM_DENCOM)); +// riga.add(rec.get(IND_CODIND)); + indsp_sheet().row(i)=riga; // Load the sheets of CODINDDOC, CODINDSP, CODINDEFF. diff --git a/cg/cg0200.h b/cg/cg0200.h index 30ea0e17b..56fca7869 100755 --- a/cg/cg0200.h +++ b/cg/cg0200.h @@ -145,7 +145,7 @@ #define F_CONAIASS 242 #define F_REFERENTE 243 #define F_DESBANPR 244 -#define F_TIPODOCFAT 245 +#define F_TIPODOCFAT 245 #define F_CODCAUS 246 #define F_CODVALINTRA 247 #define F_DESVALINTRA 248 @@ -173,7 +173,6 @@ #define F_PFAXI 110 #define F_FAXI 111 #define F_IVARIDI 112 -//#define F_CODINDI 113 -#define F_DENCOMI 114 +#define F_DENCOMI 113 #endif // __CG0200_H diff --git a/cg/cg0200a.uml b/cg/cg0200a.uml index c5fdcc5f7..102575ec7 100755 --- a/cg/cg0200a.uml +++ b/cg/cg0200a.uml @@ -1098,12 +1098,13 @@ BEGIN ITEM "Localita@35" ITEM "CAP " ITEM "Stato" - ITEM "Comune " + ITEM "Cod.comune " ITEM "Prefisso tel." ITEM "Numero tel.@30" ITEM "Prefisso fax" ITEM "Numero fax@30" ITEM "Iva Rid." + ITEM "Comune@50" END NUMBER F_CODINDDOC 3 diff --git a/cg/cg0400.cpp b/cg/cg0400.cpp index 69b7050fd..946fb8425 100755 --- a/cg/cg0400.cpp +++ b/cg/cg0400.cpp @@ -5,7 +5,6 @@ #include #include #include -//#include #include #include "cg0.h" @@ -19,8 +18,6 @@ #include -HIDDEN TString80 TMP; - enum liste { visualizza=1, stampa=2, @@ -135,6 +132,8 @@ class TProgressivi_iva : public TPrintapp Importi _mesi[13]; liste _tipo_lista; + TString TMP; // Ex HIDDEN: bestie! + protected: static bool tipo_handler(TMask_field& f, KEY k); static bool selection_handler(TMask_field& f, KEY k); @@ -347,6 +346,11 @@ void TProgressivi_iva::look_pim() if (tipoiva == "VE") continue; //i codici iva di tipo "VE" //Fine //non devono essere stampati + bool soggetto = TRUE; + tabiva.put("CODTAB",codiva); + if (tabiva.read() == NOERR) + soggetto = tabiva.get("S1") != "NS"; // I non soggetti non vanno sempre considerati + reg.put("CODTAB",codreg); if (reg.read() != NOERR) reg.zero(); const bool corrisp = reg.get_bool("B0"); @@ -412,25 +416,29 @@ void TProgressivi_iva::look_pim() _gen1_array.add_riga(codiva,ZERO,ZERO,ZERO,ZERO,imponibile,imposta); break; case acq_amm_ultdetr: - { - real detr = imponibile * real(0.06); - if (_mese != 13) - _iva_array.add_riga(tipo,imponibile,imposta,detr); - if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13) - _iva1_array.add_riga(tipo,imponibile,imposta,detr); - } + if (soggetto) + { + const real detr = imponibile * real(0.06); + if (_mese != 13) + _iva_array.add_riga(tipo,imponibile,imposta,detr); + if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13) + _iva1_array.add_riga(tipo,imponibile,imposta,detr); + } break; + case acq_simp: + case vend_simp: + case cess_amm: case acq_beni_riv: - tabiva.put("CODTAB",codiva); - if (tabiva.read() == NOERR) - // I non soggetti non vanno considerati nel totale acq. beni rivendita - if (tabiva.get("S1") != "NS") - { - if (_mese != 13) - _iva_array.add_riga(tipo,imponibile,imposta,ZERO); - if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13) - _iva1_array.add_riga(tipo,imponibile,imposta,ZERO); - } + case acq_beni_ammort: + case acq_beni_ammort_nd: + case acq_beni_leasing: + if (soggetto) + { + if (_mese != 13) + _iva_array.add_riga(tipo,imponibile,imposta,ZERO); + if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13) + _iva1_array.add_riga(tipo,imponibile,imposta,ZERO); + } break; default: if (sosp_imp == normale || sosp_imp == nessuna) // Esclude quelli valevoli solo liq o solo vol.aff. dai riepiloghi altri dati @@ -482,17 +490,26 @@ void TProgressivi_iva::cerca_i_pim() codiva = codtab.mid(16,4); tipoiva = pim.get("S5"); - if (anno != _annoiva) continue; + if (anno != _annoiva) + continue; //Modifica del 12/07/1995 - if (tipoiva == "VE") continue; + if (tipoiva == "VE") + continue; //Fine if (_livelloprog == 1) //riepilogo per aliquota { codiva = codiva.trim(); - if (codiva != _codivamsk) continue; + if (codiva != _codivamsk) + continue; } + + // I non soggetti non vanno considerati + bool soggetto = TRUE; + tabiva.put("CODTAB",codiva); + if (tabiva.read() == NOERR) + soggetto = tabiva.get("S1") != "NS"; if (_livelloprog == 2) //riepilogo per attivita' { @@ -506,6 +523,14 @@ void TProgressivi_iva::cerca_i_pim() if (reg.read() != NOERR) reg.zero(); const bool corrisp = reg.get_bool("B0"); + if (_livelloprog == 1 && _tipoprog == 1 && _sospmsk == 2) // CM500309 + { + const bool sosp = reg.get_bool("B1"); + const int tipo_sosp = reg.get_int("I9"); + if (sosp && tipo_sosp > 1) + continue; + } + while (classify_pim(pim.curr(), imponibile, imposta, tipo, FALSE)) { switch(tipo) @@ -532,7 +557,8 @@ void TProgressivi_iva::cerca_i_pim() impos += imposta; } break; - case vend_simp: + case vend_simp: + if (!soggetto) break; if (_tipoprog == 2) break; //acquisti if (_sospmsk == 2) //nella maschera e' stato richiesto { //vendite in sospensione d'imposta @@ -582,6 +608,7 @@ void TProgressivi_iva::cerca_i_pim() } break; case acq_simp: + if (!soggetto) break; if (_tipoprog == 1) break; if (_tipo_aliq == 7) { @@ -590,18 +617,16 @@ void TProgressivi_iva::cerca_i_pim() } break; case acq_beni_riv: + if (!soggetto) break; if (_tipoprog == 1) break; - tabiva.put("CODTAB",codiva); - if (tabiva.read() == NOERR) - // I non soggetti non vanno considerati nel totale acq. beni rivendita - if (tabiva.get("S1") != "NS") - if (_tipo_attiv == 1) - { - impo += imponibile; - impos += imposta; - } + if (_tipo_attiv == 1) + { + impo += imponibile; + impos += imposta; + } break; case acq_beni_ammort: + if (!soggetto) break; if (_tipoprog == 1) break; if (_tipo_attiv == 2) { @@ -610,6 +635,7 @@ void TProgressivi_iva::cerca_i_pim() } break; case acq_beni_ammort_nd: + if (!soggetto) break; if (_tipoprog == 1) break; if (_tipo_attiv == 3) { @@ -618,6 +644,7 @@ void TProgressivi_iva::cerca_i_pim() } break; case acq_beni_leasing: + if (!soggetto) break; if (_tipoprog == 1) break; if (_tipo_attiv == 4) { @@ -626,6 +653,7 @@ void TProgressivi_iva::cerca_i_pim() } break; case acq_amm_ultdetr: + if (!soggetto) break; if (_tipoprog == 1) break; if (_tipo_attiv == 5) { @@ -634,6 +662,7 @@ void TProgressivi_iva::cerca_i_pim() } break; case cess_amm: + if (!soggetto) break; if (_tipoprog == 2) break; if (_livelloprog == 2) //Nel caso di vendite per attivita' il tipo costo/ricavo { //viene forzato a 4 => cessione beni ammortizzabili @@ -969,11 +998,7 @@ void TProgressivi_iva::prospetto_pagina(TGen_array& gen, TIva_array& iva) set_row(r++, "Totale generale IVA@24g%r@40g%r@62g%r@78g%r@100g%r@116g%r", &t_impov,&t_imposv,&t_impoa,&t_imposa,&t_impobd,&t_imposbd); r+=3; - int kk = r; - /* - set_row(r++, "ALTRI DATI RELATIVI ALLA DICHIARAZIONE@54gImponibile@74gImposta@91gDetrazione"); - r++; - */ + const int kk = r; // memorizza riga in cui scrivere "altri dati relativi alla dichiarazione" r+=2; st_riga = FALSE; @@ -1204,20 +1229,14 @@ void TProgressivi_iva::preprocess_header() int soh = 1; TString sep(132); TString ragsoc(50); - //TString attprev(5); TString16 descf; TLocalisamfile nditte(LF_NDITTE); nditte.zero(); nditte.put(NDT_CODDITTA, _codditta); if (nditte.read() == NOERR) - { ragsoc = nditte.get(NDT_RAGSOC); - //attprev = nditte.get(NDT_CODATTPREV); - } - //TString80 descr = desc_attivita(attprev); - TString80 descr = desc_attivita(_cod_att); reset_header(); @@ -1250,10 +1269,6 @@ void TProgressivi_iva::preprocess_header() const char* pro_des = _tipo_prog_reg == 'L' ? "liquidazione IVA" : "Volume Affari"; - /* - set_header (soh++, "Riepilogo progressivi IVA del periodo %s %d Cod. Att. %s %s", itom(_mese), _anno, (const char*) _cod_att, (const char*) descr); - set_header (soh++, (const char *) sep); - */ TString periodo; if (f == 'M') diff --git a/cg/cg1100.cpp b/cg/cg1100.cpp index 05a3387f6..5fb8af8dd 100755 --- a/cg/cg1100.cpp +++ b/cg/cg1100.cpp @@ -738,10 +738,10 @@ void CG1100_application::set_con_IV() } } } - set_row (_i,"@58g$[r]%3d$[n]", _gruppo); - set_row (_i,"@62g$[r]%3d$[n]", _conto); + set_row (_i,"@58g$[b]%3d$[n]", _gruppo); + set_row (_i,"@62g$[b]%3d$[n]", _conto); if (_sottoc != 0) - set_row (_i,"@66g$[r]%6ld$[n]", _sottoc); + set_row (_i,"@66g$[b]%6ld$[n]", _sottoc); set_row (_i,"@73g%.40s", (const char*) descr); if (sez_opp != '0') @@ -811,7 +811,7 @@ void CG1100_application::set_senza_IV_ana() _stampa_riga_vuota = FALSE; } - set_row (i, "$[r]@pn$[n] $[r]@pn$[n] $[r]@pn$[n]", + set_row (i, "$[b]@pn$[n] $[b]@pn$[n] $[b]@pn$[n]", FLD(LF_PCON, PCN_GRUPPO, "###"), FLD(LF_PCON,PCN_CONTO, "###"), FLD(LF_PCON, PCN_SOTTOCONTO, "######")); @@ -869,13 +869,13 @@ void CG1100_application::set_con_ana() set_row (_i,"@11g%s", (const char*) descrizione); } - set_row (_i,"@62g$[r]%3d$[n]", _gruppo); + set_row (_i,"@62g$[b]%3d$[n]", _gruppo); if (_conto != 0) - set_row (_i,"@66g$[r]%3d$[n]", _conto); + set_row (_i,"@66g$[b]%3d$[n]", _conto); if (_sottoc != 0) - set_row (_i,"@70g$[r]%6ld$[n]", _sottoc); + set_row (_i,"@70g$[b]%6ld$[n]", _sottoc); if (_gruppo > 99 || _conto > 99) set_row(_i,"@76g*"); @@ -896,7 +896,7 @@ void CG1100_application::set_senza_ana() { reset_row (1); - set_row (1, "$[r]@pn$[n] $[r]@pn$[n] $[r]@pn$[n]", + set_row (1, "$[b]@pn$[n] $[b]@pn$[n] $[b]@pn$[n]", FLD(LF_PCON, PCN_GRUPPO, "###"), FLD(LF_PCON,PCN_CONTO, "###"), FLD(LF_PCON, PCN_SOTTOCONTO, "######")); @@ -944,7 +944,7 @@ void CG1100_application::set_completa() reset_print (); - set_row (i, "$[r]@pn$[n] $[r]@pn$[n] $[r]@pn$[n]", + set_row (i, "$[b]@pn$[n] $[b]@pn$[n] $[b]@pn$[n]", FLD(LF_PCON, PCN_GRUPPO, "###"), FLD(LF_PCON,PCN_CONTO, "###"), FLD(LF_PCON, PCN_SOTTOCONTO, "######")); @@ -1224,11 +1224,11 @@ bool CG1100_application::set_print(int) if (tasto == K_ENTER) { _tipo_stampa = (stampe)_msk->get_int(F_SCELTA_STAMPA); - _salto_pag = _msk->get_bool (F_SALTO_PAGINA); - _data_stampa = _msk->get (F_DATA_STAMPA); + _salto_pag = _msk->get_bool(F_SALTO_PAGINA); + _data_stampa = _msk->get(F_DATA_STAMPA); // scegli_cur(); - enable_link("Collegamento Piano dei conti : ", 'r'); + enable_link("Collegamento Piano dei conti: ", 'b'); set_multiple_link(TRUE); _sez_stamp = ' '; diff --git a/cg/cg1200.cpp b/cg/cg1200.cpp index fb346fe1c..50dca1453 100755 --- a/cg/cg1200.cpp +++ b/cg/cg1200.cpp @@ -620,7 +620,7 @@ void TPrintclifo_app::header_rubriche() void TPrintclifo_app::set_elenco() { // body - set_row(1,"$[r]@1s$[n] $[r]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF), + set_row(1,"$[b]@1s$[n] $[b]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF), FLD(LF_CLIFO, CLI_CODCF,"@@@@@@"), &_name); set_row(2,"@9g#t@56g@s@63g#t @s @s", &_indir, FLD(LF_CLIFO, CLI_CAPCF), &_localita, FLD(-COMRF_ALIAS,COM_DENCOM), FLD(-COMRF_ALIAS,COM_PROVCOM)); @@ -638,7 +638,7 @@ void TPrintclifo_app::header_rubriche() //modifica del 27/04/1995 void TPrintclifo_app::set_elenco() { - set_row(1,"$[r]@1s$[n] $[r]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF), + set_row(1,"$[b]@1s$[n] $[b]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF), FLD(LF_CLIFO, CLI_CODCF,"@@@@@@"), &_name); set_row(2,"@9g#t@56g@s@63g#t", &_indir, FLD(LF_CLIFO, CLI_CAPCF),&_comprov); set_row(3,"@9g#t@90g#t@115g#t", &_telefono, &_fax, &_telex); @@ -655,7 +655,7 @@ void TPrintclifo_app::set_elenco() void TPrintclifo_app::set_rubriche() { // body - set_row(1,"$[r]@1s$[n] $[r]@pn$[n] #t", FLD(LF_CLIFO,CLI_TIPOCF), + set_row(1,"$[b]@1s$[n] $[b]@pn$[n] #t", FLD(LF_CLIFO,CLI_TIPOCF), FLD(LF_CLIFO,CLI_CODCF,"@@@@@@"), &_name); //set_row(1,"@60g#t@100g@s@106g#t@127g@s", &_indir, FLD(LF_CLIFO, CLI_CAPCF), // &_localita, FLD(-COMRF_ALIAS,COM_PROVCOM)); @@ -740,7 +740,7 @@ void TPrintclifo_app::set_vendite(int f, int c) set_header(11,"@9gRaggr. ordini @25gImporto Minimo @46gImporto Massimo @63gPriorita ev. @76gTipo Evasione"); set_header(12, (const char *)(TString(132).fill('-'))); - set_row(1,"$[r]@1s$[n] $[r]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF), + set_row(1,"$[b]@1s$[n] $[b]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF), FLD(LF_CLIFO, CLI_CODCF,"@@@@@@"), &_name); set_row(2,"@9g@2s @25g@2s @46g@2s @63g@2s @76g@2s @93g@2s @101g@3s @112g@n", @@ -897,7 +897,7 @@ bool TPrintclifo_app::set_print(int) if (_pr_type != etichette) { set_multiple_link(TRUE); - enable_link("Collegamento clienti e fornitori : ", 'r'); + enable_link("Collegamento clienti e fornitori : ", 'b'); } _sort = mask.get_int(RDB_CG12_SORT); @@ -988,7 +988,7 @@ bool TPrintclifo_app::ges_ven() bool TPrintclifo_app::user_create() { // set relation and cursors - _rel = new TRelation(LF_CLIFO); + _rel = new TRelation(LF_CLIFO); _rel->add(LF_COMUNI, "STATO==STATOCF|COM==COMCF", 1, 0, COMRF_ALIAS); _rel->add(LF_COMUNI, "STATO==STATONASC|COM==COMNASC", 1, 0, COMNASC_ALIAS); if (ges_ven()) diff --git a/cg/cg1300.cpp b/cg/cg1300.cpp index 2ff5a1f3a..3c691d066 100755 --- a/cg/cg1300.cpp +++ b/cg/cg1300.cpp @@ -6,8 +6,6 @@ #include #include #include -#include -#include #include #include @@ -23,35 +21,29 @@ #include "cg1308.h" #include "cglib01.h" -class TAgg_attiv : public TApplication +class TAgg_attiv : public TSkeleton_application { TLocalisamfile* _pcon,* _attiv; TTable* _reg; -public: +protected: virtual bool create(); virtual bool destroy(); - virtual bool menu(MENU_TAG m); + virtual void main_loop(); +public: void elabora_mov(); - - TAgg_attiv() {}; - virtual ~TAgg_attiv() {}; }; HIDDEN TAgg_attiv& app() { return (TAgg_attiv&)main_app(); } bool TAgg_attiv::create() { - TApplication::create(); - _pcon = new TLocalisamfile(LF_PCON); _attiv = new TLocalisamfile(LF_ATTIV); _reg = new TTable("REG"); - dispatch_e_menu (BAR_ITEM(1)); - - return TRUE; + return TSkeleton_application::create(); } bool TAgg_attiv::destroy() @@ -60,20 +52,17 @@ bool TAgg_attiv::destroy() delete _attiv; delete _reg; - return TApplication::destroy(); + return TSkeleton_application::destroy(); } -bool TAgg_attiv::menu(MENU_TAG m) +void TAgg_attiv::main_loop() { TMask msk("cg1300a"); - while (msk.run() == K_ENTER) { elabora_mov(); message_box("Aggiornamento completato"); - //return TRUE; } - return FALSE; } void TAgg_attiv::elabora_mov() @@ -163,7 +152,7 @@ int cg1300(int argc, char* argv[]) case 'T': { TAgg_tconto a; - a.run(argc, argv, "Aggiornamento tipo conto"); + a.run(argc, argv, "Aggiornamento tipo conto"); // cg1302 } break; case 'Z': diff --git a/cg/cg1300b.uml b/cg/cg1300b.uml index bfbc5cd22..5aa60b818 100755 --- a/cg/cg1300b.uml +++ b/cg/cg1300b.uml @@ -53,15 +53,15 @@ BEGIN CHECKTYPE REQUIRED END -RADIOBUTTON F_MODE 1 60 +RADIOBUTTON F_MODE 1 24 BEGIN PROMPT 1 6 "@bRiparti da " ITEM "U|Ultima stampa" - MESSAGE CLEAR,F_PROT + MESSAGE CLEAR,F_PROT ITEM "N|Numero specificato" - MESSAGE ENABLE,F_PROT + MESSAGE ENABLE,F_PROT ITEM "A|Inizio anno" - MESSAGE CLEAR,F_PROT + MESSAGE CLEAR,F_PROT END DATE F_DA diff --git a/cg/cg1302.cpp b/cg/cg1302.cpp index 594ffa4a3..828562b75 100755 --- a/cg/cg1302.cpp +++ b/cg/cg1302.cpp @@ -1,15 +1,20 @@ //**************************** //* Aggiornamento Tipo Conto * //**************************** + +#include + #include #include #include +#include "cg1300.h" #include "cg1302.h" #include "cglib01.h" const int TAgg_tconto::look_reg (const char* cod, int anno) { +/* TTable tab_reg("REG"); TString codtab; codtab.format("%4d%-3s", anno, cod); @@ -23,13 +28,18 @@ const int TAgg_tconto::look_reg (const char* cod, int anno) tipo_reg = 0; return tipo_reg; +*/ + TString16 codtab; + codtab.format("%4d%-3s", anno, cod); + int tipo_reg = cache().get("REG", codtab).get_int("I0"); + return tipo_reg; } bool TAgg_tconto::user_create() { _rel = new TRelation(LF_MOV); _rel->add(LF_RMOVIVA, "NUMREG=NUMREG",1); - _cur = new TCursor(_rel,"",1); + _cur = new TCursor(_rel, "", 1); add_cursor(_cur); add_file (LF_MOV); @@ -68,7 +78,7 @@ bool TAgg_tconto::set_print(int) void TAgg_tconto::postclose_print() { - message_box("Aggiornamento tipo conto completato"); + message_box("Aggiornamento tipo conto completato:\nE' necessario ricalcolare la liquidazione."); } bool TAgg_tconto::preprocess_page(int file,int counter) @@ -78,7 +88,7 @@ bool TAgg_tconto::preprocess_page(int file,int counter) TCursor* cur = current_cursor(); if (file == LF_MOV) { - TString16 reg = cur->curr().get(MOV_REG); + const TString& reg = cur->curr().get(MOV_REG); if (reg.empty()) return FALSE; } else if (file == LF_RMOVIVA) @@ -150,8 +160,7 @@ void TAgg_tconto::setta_intestazione() set_header (soh++, (const char*) sep); sep = ""; - sep << "Data @< Pag. @#"; - + sep << "Data @> Pag. @#"; sep.right_just(127); sep.overwrite ("AGGIORNAMENTO TIPO CONTO SU MOVIMENTI IVA - Lista errori"); diff --git a/cg/cg1303.cpp b/cg/cg1303.cpp index 3c27b921f..6b4ee0953 100755 --- a/cg/cg1303.cpp +++ b/cg/cg1303.cpp @@ -108,7 +108,7 @@ bool TAgg_nprot::rinumera_prot(char mode, long last_prot) } } - if (last_prot > 0) + if (last_prot > 0 && mode == 'N') { if (protiva != last_prot && uprotiva != last_prot) //sono alla fine del file return error_box("Non esiste la registrazione con protocollo %ld:\nrinumerazione non avvenuta", last_prot); diff --git a/cg/cg1305.cpp b/cg/cg1305.cpp index f79519682..a966b776e 100755 --- a/cg/cg1305.cpp +++ b/cg/cg1305.cpp @@ -1,5 +1,6 @@ // sistema il codice esercizio di tutti i movimenti - +#include +#include #include #include @@ -15,12 +16,10 @@ inline TAgg_codes& app() { return (TAgg_codes&) main_app(); } bool TAgg_codes::create() { - TApplication::create(); _mov = new TLocalisamfile(LF_MOV); _rmov = new TLocalisamfile(LF_RMOV); _rmoviva = new TLocalisamfile(LF_RMOVIVA); - dispatch_e_menu (BAR_ITEM(1)); - return TRUE; + return TSkeleton_application::create(); } bool TAgg_codes::destroy() @@ -29,19 +28,17 @@ bool TAgg_codes::destroy() delete _rmov; delete _rmoviva; - return TApplication::destroy(); + return TSkeleton_application::destroy(); } -bool TAgg_codes::menu(MENU_TAG m) +void TAgg_codes::main_loop() { TMask msk("cg1300d"); if (msk.run() == K_ENTER) - return calcola_codes(); - else - return FALSE; + calcola_codes(); } -bool TAgg_codes::calcola_codes() +void TAgg_codes::calcola_codes() { TLocalisamfile& mov = get_mov(); TEsercizi_contabili esercizi; @@ -73,7 +70,7 @@ bool TAgg_codes::calcola_codes() righe.read(riga); righeiva.read(rigaiva); righe.renum_key(RMV_ANNOES,newcodes); - s_codes = format("%04d",newcodes); + s_codes.format("%04d",newcodes); righeiva.renum_key(RMI_ANNOES,s_codes); if (err == NOERR) { @@ -85,7 +82,9 @@ bool TAgg_codes::calcola_codes() } } } - if (err != NOERR) warning_box("Aggiornamento codice esercizio interrotta. Rilevato errore %d in riscrittura",err); - else message_box("Aggiornamento codice esercizio completata. Modificati %ld movimenti.",modified_recs); - return FALSE; + if (err != NOERR) + warning_box("Aggiornamento codice esercizio interrotta. Rilevato errore %d in riscrittura",err); + else + message_box("Aggiornamento codice esercizio completata. Modificati %ld movimenti.\n" + "E' necessario procedere col ricalcolo saldi", modified_recs); } diff --git a/cg/cg1305.h b/cg/cg1305.h index a437ca3f4..71c9f0aef 100755 --- a/cg/cg1305.h +++ b/cg/cg1305.h @@ -1,24 +1,18 @@ #include -#include -#include -#include -#include +#include -class TAgg_codes : public TApplication +class TAgg_codes : public TSkeleton_application { - TLocalisamfile* _mov; - TLocalisamfile* _rmov; - TLocalisamfile* _rmoviva; - -public: + TLocalisamfile* _mov; + TLocalisamfile* _rmov; + TLocalisamfile* _rmoviva; + +protected: virtual bool create(); virtual bool destroy(); - virtual bool menu(MENU_TAG m); - - TLocalisamfile& get_mov() { return *_mov; } - - bool calcola_codes(); + virtual void main_loop(); - TAgg_codes() {}; - virtual ~TAgg_codes() {}; +public: + TLocalisamfile& get_mov() { return *_mov; } + void calcola_codes(); }; \ No newline at end of file diff --git a/cg/cg1500.cpp b/cg/cg1500.cpp index 8624ba0e1..7d44815e2 100755 --- a/cg/cg1500.cpp +++ b/cg/cg1500.cpp @@ -1411,33 +1411,51 @@ bool TStampa_bilanci::bil_verifica() saldi.put(SLD_SOTTOCONTO, s); if (saldi.read() == NOERR) { - real ss = saldi.get_real(SLD_SALDO); - if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5) - if (ss == ZERO && _annoes != 0) + const real ss = saldi.get_real(SLD_SALDO); + if (ss.is_zero()) + { + if (_annoes != 0 && (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5)) { - saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,s); + saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s); //modifica del 21/11/95 if (saldo_iniziale > ZERO) _saldo_ini_dare = saldo_iniziale; - else _saldo_ini_avere = -saldo_iniziale; + else + _saldo_ini_avere = -saldo_iniziale; //fine } + } + else + { + const char fsi = saldi.get_char(SLD_FLAGSALINI); + if (fsi == 'D') + { + saldo_iniziale = ss; + _saldo_ini_dare = ss; + } + else + { + saldo_iniziale = -ss; + _saldo_ini_avere = ss; + } + } } } } - if (!movimentato) //_mov_ap e' di sicuro FALSE - if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5) - if (_annoes != 0) - { - saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s); - //modifica del 21/11/95 - if (saldo_iniziale > ZERO) - _saldo_ini_dare = saldo_iniziale; - else _saldo_ini_avere = -saldo_iniziale; - //fine - if (_stampav == 1 && sld.significativo()) - movimentato = TRUE; - } + else // !movimentato -> _mov_ap e' di sicuro FALSE + { + if (_annoes != 0 && (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5)) + { + saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s); + //modifica del 21/11/95 + if (saldo_iniziale > ZERO) + _saldo_ini_dare = saldo_iniziale; + else _saldo_ini_avere = -saldo_iniziale; + //fine + if (_stampav == 1 && sld.significativo()) + movimentato = TRUE; + } + } } //if (movimentato) @@ -1747,8 +1765,11 @@ bool TStampa_bilanci::calcola(int g, int c, long s) conto_mov = TRUE; if (sezione == 'D') _mov_periodo_dare += importo; - else _mov_periodo_avere += importo; + else + _mov_periodo_avere += importo; _u_max = fnc_max(_u_max, data); + if (causap == 'A') + _mov_ap = TRUE; } //il saldo inizio es. e' dato dall'importo dare - importo avere di quei movimenti che hanno causale == apertura e data reg >= data inizio es. e <= data limite sup. @@ -1760,7 +1781,8 @@ bool TStampa_bilanci::calcola(int g, int c, long s) { if (sezione == 'D') _saldo_ini_dare += importo; - else _saldo_ini_avere += importo; + else + _saldo_ini_avere += importo; _u_max = fnc_max(_u_max, data); conto_mov = _mov_ap = TRUE; } @@ -1771,7 +1793,8 @@ bool TStampa_bilanci::calcola(int g, int c, long s) { if (sezione == 'D') _prg_prec_dare += importo; - else _prg_prec_avere += importo; + else + _prg_prec_avere += importo; _u_max = fnc_max(_u_max, data); conto_mov = TRUE; } @@ -1819,9 +1842,10 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin { if (movimentato) { - //modifica del 21/11/1995 if (_mov_ap) - saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere; + { + saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere; + } else { TLocalisamfile saldi(LF_SALDI); @@ -1835,32 +1859,51 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin { //se il saldo iniziale e' diverso da zero non lo devo considerare //perche' l'ho gia' considerato nella funzione calcola - real ss = saldi.get_real(SLD_SALDO); - if (ib == 1 || ib == 2 || ib == 5) - if (ss == ZERO && _annoes != 0) //competenza!!! + const real ss = saldi.get_real(SLD_SALDO); + if (ss.is_zero()) + { + if (_annoes != 0 && (ib == 1 || ib == 2 || ib == 5)) { saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,s); //modifica del 21/11/1995 if (saldo_iniziale > ZERO) _saldo_ini_dare = saldo_iniziale; - else _saldo_ini_avere = -saldo_iniziale; + else + _saldo_ini_avere = -saldo_iniziale; //fine } + } + else + { + const char fsi = saldi.get_char(SLD_FLAGSALINI); + if (fsi == 'D') + { + saldo_iniziale = ss; + _saldo_ini_dare = ss; + } + else + { + saldo_iniziale = -ss; + _saldo_ini_avere = ss; + } + } } } } - if (!movimentato) - if (ib == 1 || ib == 2 || ib == 5) - if (_annoes != 0) //cioe' se sto ragionando per competenza - { - saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s); - //modifica del 21/11/1995 - if (saldo_iniziale > ZERO) - _saldo_ini_dare = saldo_iniziale; - else _saldo_ini_avere = -saldo_iniziale; - //fine - movimentato = sld.significativo(); - } + else + { + if (_annoes != 0 && (ib == 1 || ib == 2 || ib == 5)) + { + saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s); + //modifica del 21/11/1995 + if (saldo_iniziale > ZERO) + _saldo_ini_dare = saldo_iniziale; + else + _saldo_ini_avere = -saldo_iniziale; + //fine + movimentato = sld.significativo(); + } + } } if (!movimentato) @@ -3214,16 +3257,15 @@ void TStampa_bilanci::stampa_riga_totali(int r) if (_saldo_finale_tot != ZERO) set_row(r,"@131g%c", app); } - else if (app == 'D') - { - set_row(r,"***@8gTOTALE GENERALE@46g!%r@64g%r@80g!%r@100g%r@114g!%r@148g!",&_saldo_dare_tot,&_saldo_avere_tot, - &_mov_dare_tot,&_mov_avere_tot,&_saldo_finale_tot); - } else { - set_row(r,"***@8gTOTALE GENERALE@46g!%r@64g%r@80g!%r@100g%r@114g!@132g%r@148g!",&_saldo_dare_tot,&_saldo_avere_tot, + if (app == 'D') + set_row(r,"***@8gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!",&_saldo_dare_tot,&_saldo_avere_tot, &_mov_dare_tot,&_mov_avere_tot,&_saldo_finale_tot); - } + else + set_row(r,"***@8gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!@132g%r@148g!",&_saldo_dare_tot,&_saldo_avere_tot, + &_mov_dare_tot,&_mov_avere_tot,&_saldo_finale_tot); + } } else { @@ -3248,22 +3290,20 @@ void TStampa_bilanci::stampa_riga_totali(int r) { if (app == 'D') { - set_row(r++,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@100g%r@114g!%r@148g!",&_saldo_dare_tot, - &_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot, - &_saldo_finale_tot); + set_row(r++,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!",&_saldo_dare_tot, + &_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot, &_saldo_finale_tot); } else { - set_row(r++,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@100g%r@114g!@132g%r@148g!",&_saldo_dare_tot, - &_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot, - &_saldo_finale_tot); + set_row(r++,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!@132g%r@148g!",&_saldo_dare_tot, + &_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot, &_saldo_finale_tot); } if ((_tipo_stampa1 == 1 && _datada == _dataini) || _tipo_stampa1 == 2) { if (_tipo_stampa1 == 2) - set_row(r,"@1g****** ********@17gTOTALE CON SALDI INIZIALI@46g!@80g!%r@100g%r@114g!@148g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); + set_row(r,"@1g****** ********@17gTOTALE CON SALDI INIZIALI@46g!@80g!%r@98g%r@114g!@148g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); else - set_row(r,"@1g****** ********@17gTOTALE CON MOVIM. DI APERTURA@46g!@80g!%r@100g%r@114g!@148g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); + set_row(r,"@1g****** ********@17gTOTALE CON MOVIM. DI APERTURA@46g!@80g!%r@98g%r@114g!@148g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); } } } @@ -3418,14 +3458,14 @@ void TStampa_bilanci::stampa_prima_colonna(int g, int c, long s, if (!_totali) { if (c != 0 && s == 0) - set_row(_i, "%-.44s @44g *** @49g%r @68g%c", desc, &saldo, dep); + set_row(_i, "%-.44s @44g @49g%r @68g%c", desc, &saldo, dep); else set_row(_i, "%-.48s @49g%r @68g%c", desc, &saldo, dep); } else if ( !(c == 0 && s == 0) ) //se cioe' non e' un gruppo { if (s == 0) //se e' un conto - set_row(_i, "%-.44s @44g *** @49g%r @68g%c", desc, &saldo, dep); + set_row(_i, "%-.44s @44g @49g%r @68g%c", desc, &saldo, dep); else set_row(_i, "%-.48s @49g%r @68g%c", desc, &saldo, dep); } @@ -3851,8 +3891,8 @@ int TStampa_bilanci::stampa_intestazione_ditta() (const char*)_provfis); r++; printer().setdate(_data); - riga = "Data @< Pag. @#"; - riga.right_just(_stampa_width-6); + riga = "Data @> Pag. @#"; + riga.right_just(_stampa_width-10); riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi)); set_header (r, "%s", (const char*) riga); diff --git a/cg/cg1500a.uml b/cg/cg1500a.uml index 1e3ca1a4d..77118eb27 100755 --- a/cg/cg1500a.uml +++ b/cg/cg1500a.uml @@ -2,14 +2,14 @@ TOOLBAR "" 0 20 0 2 -BUTTON DLG_OK 9 2 +BUTTON DLG_OK 10 2 BEGIN - PROMPT -12 -1 "" + PROMPT -12 -11 "" END -BUTTON DLG_QUIT 9 2 +BUTTON DLG_QUIT 10 2 BEGIN - PROMPT -22 -1 "" + PROMPT -22 -11 "" END ENDPAGE @@ -68,7 +68,7 @@ BEGIN MESSAGE HIDE,F_DATAA|RESET,F_DATAA|HIDE,F_SITUAZIONE|RESET,F_SITUAZIONE MESSAGE HIDE,F_ORDINAMENTO|RESET,F_ORDINAMENTO|HIDE,F_STAMPAC|RESET,F_STAMPAC MESSAGE HIDE,96|HIDE,97|HIDE,98|HIDE,99 - //MESSAGE HIDE,F_MODULO|RESET,F_MODULO + MESSAGE CLEAR,F_MODULO MESSAGE SHOW,F_STAMPA|K_SPACE,F_STAMPA ITEM "2|Bilancio di verifica" MESSAGE HIDE,F_STAMPA|RESET,F_STAMPA @@ -76,7 +76,7 @@ BEGIN MESSAGE HIDE,F_CODICI|RESET,F_CODICI|HIDE,F_SALDO|RESET,F_SALDO MESSAGE HIDE,F_STAMPAV|RESET,F_STAMPAV MESSAGE SHOW,F_VERIFICA|K_SPACE,F_VERIFICA|SHOW,F_STAMPA1|K_SPACE,F_STAMPA1 - //MESSAGE SHOW,F_MODULO|K_SPACE,F_MODULO + MESSAGE ENABLE,F_MODULO MESSAGE SHOW,96|SHOW,97|SHOW,98|SHOW,99 END @@ -174,12 +174,12 @@ BEGIN ITEM "3|Solo provvisori" END -LIST F_MODULO 8 +LIST F_MODULO 1 12 BEGIN PROMPT 2 12 "Dimensione modulo " HELP "Indicare il numero di caratteri del foglio (larghezza)" - ITEM "1|132 crt." - ITEM "2|198 crt." + ITEM "1|132 colonne" + ITEM "2|198 colonne" END BOOLEAN F_QUADRATURA diff --git a/cg/cg1700.cpp b/cg/cg1700.cpp index 235d816da..01cc973f6 100755 --- a/cg/cg1700.cpp +++ b/cg/cg1700.cpp @@ -119,8 +119,8 @@ int CG1700_application::stampa_intestazione_ditta() (const char*)_provfis); r++; printer().setdate(_data); - riga = "Data @< Pag. @#"; - riga.right_just(127); + riga = "Data @> Pag. @#"; + riga.right_just(125); riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi)); set_header (r, "%s", (const char*) riga); r++; @@ -269,6 +269,10 @@ bool CG1700_application::set_print(int) if (tasto == K_ENTER) { _data = _msk->get(F_DATASTAMPA); + TRectype dacaus(LF_CAUSALI), acaus(LF_CAUSALI); + dacaus.put("CODCAUS",_msk->get(F_DACAU)); + acaus.put("CODCAUS",_msk->get(F_ACAU)); + current_cursor()->setregion(dacaus, acaus); printer().footerlen(3); return TRUE; } diff --git a/cg/cg1700.h b/cg/cg1700.h index e0ec258bd..0df083dfc 100755 --- a/cg/cg1700.h +++ b/cg/cg1700.h @@ -1,9 +1,13 @@ #ifndef __CG1700_H #define __CG1700_H -#define F_CODDITTA 101 +#define F_CODDITTA 101 #define F_DATASTAMPA 102 -#define F_RAGSOC 104 +#define F_RAGSOC 104 +#define F_DACAU 105 +#define F_ACAU 106 +#define F_DDESCR 107 +#define F_ADESCR 108 #endif // __CG1700_H diff --git a/cg/cg1700a.uml b/cg/cg1700a.uml index 2ee56844d..df712d03d 100755 --- a/cg/cg1700a.uml +++ b/cg/cg1700a.uml @@ -1,18 +1,18 @@ #include "cg1700.h" -PAGE "Stampa causali" -1 -1 70 8 +PAGE "Stampa causali" -1 -1 70 9 NUMBER F_CODDITTA 5 BEGIN - PROMPT 1 1 "Ditta " - FLAGS "FRD" - USE LF_NDITTE KEY 1 - CHECKTYPE REQUIRED - INPUT CODDITTA F_CODDITTA - DISPLAY "Codice" CODDITTA - DISPLAY "Ragione sociale @50" RAGSOC - OUTPUT F_CODDITTA CODDITTA - OUTPUT F_RAGSOC RAGSOC + PROMPT 1 1 "Ditta " + FLAGS "FRD" + USE LF_NDITTE KEY 1 + CHECKTYPE REQUIRED + INPUT CODDITTA F_CODDITTA + DISPLAY "Codice" CODDITTA + DISPLAY "Ragione sociale @50" RAGSOC + OUTPUT F_CODDITTA CODDITTA + OUTPUT F_RAGSOC RAGSOC END STRING F_RAGSOC 50 @@ -28,6 +28,52 @@ BEGIN FLAGS "A" END +STRING F_DACAU 3 +BEGIN + PROMPT 1 6 "Da " + FLAGS "UZ" + USE LF_CAUSALI + INPUT CODCAUS F_DACAU + DISPLAY "Codice" CODCAUS + DISPLAY "Descrizione@60" DESCR + OUTPUT F_DACAU CODCAUS + OUTPUT F_DDESCR DESCR + CHECKTYPE SEARCH +END + +STRING F_DDESCR 50 43 +BEGIN + PROMPT 12 6 "Descrizione " + USE LF_CAUSALI KEY 2 + INPUT DESCR F_DDESCR + DISPLAY "Descrizione@60" DESCR + DISPLAY "Codice" CODCAUS + COPY OUTPUT F_DACAU + CHECKTYPE SEARCH +END + +STRING F_ACAU 3 +BEGIN + PROMPT 1 7 "A " + FLAGS "UZ" + COPY USE F_DACAU + INPUT CODCAUS F_ACAU + COPY DISPLAY F_DACAU + OUTPUT F_ACAU CODCAUS + OUTPUT F_ADESCR DESCR + CHECKTYPE SEARCH +END + +STRING F_ADESCR 50 43 +BEGIN + PROMPT 12 7 "Descrizione " + USE LF_CAUSALI KEY 2 + INPUT DESCR F_ADESCR + COPY DISPLAY F_DDESCR + COPY OUTPUT F_ACAU + CHECKTYPE SEARCH +END + BUTTON DLG_PRINT 10 2 BEGIN PROMPT -12 -1 "~Stampa" diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index eab18e21f..c5456ffd1 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -305,7 +305,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year) if (rcaus == NULL) continue; // Evita eventuali righe nulle const int nriga = rcaus->get_int(RCA_NRIGA); - if (nriga < 1) continue; // Considera solo righe reali (non riempimenti) + if (nriga <= 0) continue; // Considera solo righe reali (non riempimenti) TBill tc; causale().bill(nriga, tc); if (tc.gruppo() <= 0) continue; // Considera solo gruppi validi @@ -318,14 +318,16 @@ bool TPrimanota_application::read_caus(const char* cod, int year) } int err = 0; - if (tc.descrizione() == "Sconosciuto") err = 1; - else if (tc.sospeso()) err = 2; + if (tc.descrizione() == "Sconosciuto") + err = 1; else + if (tc.sospeso()) + err = 2; if (err) - { - error_box("Il conto della riga %d della causale e' %s", + { + error_box("Il conto della riga %d della causale e' %s", i, err == 1 ? "sconosciuto" : "sospeso"); - continue; + // continue; // Continua ugualmente } const char sezione = rcaus->get_char(RCA_SEZIONE); @@ -456,7 +458,6 @@ void TPrimanota_application::init_mask(TMask& m) disable_menu_item(M_FONT); read_caus(NULL, 0); // Setta campi obbligatori - fill_sheet(m); if (_iva == nessuna_iva) { @@ -491,7 +492,7 @@ void TPrimanota_application::init_mask(TMask& m) */ m.show(F_CODIVA, m.insert_mode()); // Codice IVA standard - + TSheet_field& is = ivas(); is.enable_column(2, _iva == iva_acquisti); // Tipo detrazione is.enable_column(4, !m.insert_mode()); // Tipo costo ricavo @@ -518,6 +519,8 @@ void TPrimanota_application::init_mask(TMask& m) // Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_DATACAMBIO (GROUP 3) const bool valuta = _ges_val && is_saldaconto() && causale().valuta(); m.show(-3, valuta); + + fill_sheet(m); // Riempe righe contabili coi conti della causale } void TPrimanota_application::init_query_mode(TMask& m) diff --git a/cg/cg2100o.uml b/cg/cg2100o.uml index 73a22cd1c..d5732450b 100755 --- a/cg/cg2100o.uml +++ b/cg/cg2100o.uml @@ -96,7 +96,7 @@ BEGIN USE LF_COMUNI KEY 2 INPUT DENCOM O_DENCOM DISPLAY "Denominazione@50" DENCOM - DISPLAY "Codice" COM + DISPLAY "Codice@10" COM COPY OUTPUT O_COMUNE CHECKTYPE NORMAL END @@ -160,9 +160,9 @@ BEGIN CHECKTYPE NORMAL END -BUTTON DLG_OK 9 2 +BUTTON DLG_OK 10 2 BEGIN - PROMPT -11 -1 "Conferma" + PROMPT -11 -1 "" END ENDPAGE diff --git a/cg/cg2100s.uml b/cg/cg2100s.uml index e5ded79ab..73cd69000 100755 --- a/cg/cg2100s.uml +++ b/cg/cg2100s.uml @@ -207,6 +207,7 @@ BEGIN OUTPUT S_DESCRCONTO DESCR CHECKTYPE REQUIRED WARNING "Contropartita assente" + ADD RUN cg0 -0 GROUP 2 END diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index 375834bd9..b16819469 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -101,7 +101,7 @@ real TPrimanota_application::totale_documento() // Certified 99% bool TPrimanota_application::suspended_handler(TMask_field& f, KEY k) { - if (f.to_check(k)) + if (f.to_check(k) && !f.empty()) { const TEdit_field& c = (const TEdit_field&)f; const TBrowse* b = c.browse(); @@ -628,6 +628,8 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k) const TBill c(r, 3, 0x0); if (!c.ok()) return f.error_box("Il conto della riga %d non e' completo", i+1); + if (m.insert_mode() && c.sospeso()) + return f.error_box("Il conto della riga %d e' sospeso", i+1); const TBill co(r, 10, 0x0); if (!co.empty() && !co.ok()) { @@ -978,8 +980,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k) if (row_type(row) != 'K') { cg.swap_rows(r, i); - cg.force_update(); - cg.select(i, FALSE); + cg.post_select(i); break; } } @@ -1629,8 +1630,7 @@ bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k) if ((k == K_TAB && f.focusdirty()) || (gruppo == 0 && conto == 0)) { TBill c(0, 0, codice, f.dlg() > 300 ? 'F' : 'C'); - c.find(); // Carica descrizione, gruppo e conto - m.set(f.dlg()+1, c.descrizione()); + c.find(); // Carica gruppo e conto if (c.ok()) { m.set(gid-1, c.tipo() == 'C' ? "C" : "F"); @@ -2155,16 +2155,24 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key) a._conto_ricavo.set(clifo.get_int(CLI_GRUPPORIC), clifo.get_int(CLI_CONTORIC), clifo.get_long(CLI_SOTTOCRIC)); + if (a._conto_ricavo.find()) + { + if (a._conto_ricavo.sospeso()) + { + f.error_box("Il conto di ricavo e' sospeso"); + a._conto_ricavo.set(0,0,0); + } + } const int alleg = clifo.get_int(CLI_ALLEG); TEdit_field& upi = m.efield(F_RIEPILOGO); upi.check_type(alleg == 3 ? CHECK_REQUIRED : CHECK_NORMAL); - const TString& oldpag = m.get(F_CODPAG); - if (m.is_running()) + if (f.focusdirty() && m.is_running()) { + const TString& oldpag = m.get(F_CODPAG); const TString& s = clifo.get(CLI_CODPAG); - if (/* s.not_empty() && */ s != oldpag) + if (s != oldpag) { TEdit_field& cp = m.efield(F_CODPAG); if (cp.active()) // Se il campo F_CODPAG e' attivo @@ -2494,12 +2502,12 @@ bool TPrimanota_application::ritsoc_handler(TMask_field& f, KEY key) bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key) { TMask& m = f.mask(); + TMask_field& cv = m.field(F_CORRVALUTA); if (key == K_ENTER && f.get().empty()) { - if (m.get(F_CORRVALUTA).not_empty()) + if (!cv.empty()) { - TMask_field& cv = m.field(F_CORRVALUTA); cv.set_focusdirty(); cv.on_hit(); } @@ -2511,17 +2519,19 @@ bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key) { f.set(m.get(F_IMPONIBILI)); f.set_dirty(); - m.reset(F_CORRVALUTA); + cv.set(""); key = K_TAB; } if (key == K_TAB && f.focusdirty()) { - if (m.get(F_CORRVALUTA).empty()) + if (cv.empty()) { - const TValuta cambio(m, F_VALUTAINTRA, SK_DATACAMBIO, F_CAMBIOINTRA, SK_CONTROEURO); - const real corrlit = f.get(); - real corrval = cambio.lit2val(corrlit); - m.set(F_CORRVALUTA, corrval); + const TExchange cambio(m.get(F_VALUTAINTRA), m.get_real(F_CAMBIOINTRA)); + TCurrency imp(real(f.get())); + imp.change_value(cambio); + cv.set(imp.string()); + if (m.field(F_CAMBIOINTRA).empty() && !cambio.is_firm_value()) // CM500208 + m.set(F_CAMBIOINTRA, cambio.get_base_change()); } } @@ -2544,24 +2554,29 @@ bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key) // Certified 99% bool TPrimanota_application::corrvaluta_handler(TMask_field& f, KEY key) { + TMask& m = f.mask(); + TMask_field& cl = m.field(F_CORRLIRE); + if (key == K_TAB && f.focusdirty()) { - TMask& m = f.mask(); - if (m.get(F_CORRLIRE).empty()) + if (cl.empty()) { - const TValuta cambio(m, F_VALUTAINTRA, SK_DATACAMBIO, F_CAMBIOINTRA, SK_CONTROEURO); - const real corrval = f.get(); - real corrlit = cambio.val2lit(corrval); - m.set(F_CORRLIRE, corrlit); + const TExchange cambio(m.get(F_VALUTAINTRA), m.get_real(F_CAMBIOINTRA)); + TCurrency imp(real(f.get()), cambio); + imp.change_to_firm_val(); + cl.set(imp.string()); + if (m.field(F_CAMBIOINTRA).empty() && !cambio.is_firm_value()) // CM500208 + m.set(F_CAMBIOINTRA, cambio.get_base_change()); } - } else + } + else + { if (key == K_ENTER && f.get().empty()) { - TMask_field& cl = f.mask().field(F_CORRLIRE); cl.set_dirty(); cl.on_hit(); } - + } return TRUE; } diff --git a/cg/cg2105.cpp b/cg/cg2105.cpp index f0adc74b0..658ad51f7 100755 --- a/cg/cg2105.cpp +++ b/cg/cg2105.cpp @@ -707,7 +707,7 @@ bool TGame_mask::numpart_handler(TMask_field& f, KEY k) for (int i = 0; i < sheet.items(); i++) { TToken_string& row = sheet.row(i); - if (anno == row.get_int(0)) // Se corrisponde l'anno e ... + if (anno == row.get_int(0)) // Se corrisponde l'anno e ... { const long dist = m.number_distance(key, row.get()); if (i == 0 || dist < min_dist) @@ -719,7 +719,7 @@ bool TGame_mask::numpart_handler(TMask_field& f, KEY k) } } } - sheet.select(best_match); // seleziona la partita + sheet.post_select(best_match); } } return TRUE; diff --git a/cg/cg21cg.uml b/cg/cg21cg.uml index 433ad593d..ac1689de2 100755 --- a/cg/cg21cg.uml +++ b/cg/cg21cg.uml @@ -170,7 +170,7 @@ BEGIN COPY OUTPUT 206 MESSAGE COPY,107 ADD RUN cg0 -1 C - CHECKTYPE NORMAL + CHECKTYPE SEARCH WARNING "Cliente inesistente sulla riga contabile" END @@ -188,7 +188,7 @@ BEGIN COPY OUTPUT 306 MESSAGE COPY,107 ADD RUN cg0 -1 F - CHECKTYPE NORMAL + CHECKTYPE SEARCH WARNING "Fornitore inesistente sulla riga contabile" END diff --git a/cg/cg21iva.uml b/cg/cg21iva.uml index 5dd6635c7..5208d7cdb 100755 --- a/cg/cg21iva.uml +++ b/cg/cg21iva.uml @@ -161,8 +161,6 @@ BEGIN INPUT CODCF 309 DISPLAY "Codice" CODCF DISPLAY "Ragione Sociale Fornitore@50" RAGSOC - OUTPUT 107 GRUPPO - OUTPUT 108 CONTO OUTPUT 309 CODCF OUTPUT 310 RAGSOC CHECKTYPE NORMAL @@ -202,7 +200,7 @@ BEGIN COPY OUTPUT 209 MESSAGE COPY,110 ADD RUN cg0 -1 C - CHECKTYPE NORMAL + CHECKTYPE SEARCH END STRING 310 50 @@ -219,7 +217,7 @@ BEGIN COPY OUTPUT 309 MESSAGE COPY,110 ADD RUN cg0 -1 F - CHECKTYPE NORMAL + CHECKTYPE SEARCH END LIST 105 1 51 diff --git a/cg/cg21sld.uml b/cg/cg21sld.uml index d886fafad..11f35f376 100755 --- a/cg/cg21sld.uml +++ b/cg/cg21sld.uml @@ -237,9 +237,9 @@ BEGIN ITEM "Non cancellabile" END -BUTTON FS_RESET 7 1 +BUTTON FS_RESET 8 1 BEGIN - PROMPT 1 -1 "Reset" + PROMPT 1 -1 "Rese~t" END ENDPAGE diff --git a/cg/cg2200.cpp b/cg/cg2200.cpp index 94493e036..4cc837d6f 100755 --- a/cg/cg2200.cpp +++ b/cg/cg2200.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include #include #include @@ -34,33 +35,232 @@ TString& add_plural(TString& s, long num, const char* name) return s; } -class TProvvisori_app : public TApplication -{ - TLocalisamfile* _sal; - TLocalisamfile* _cau; - TTable* _reg; - +class TProvvisori_msk : public TAutomask +{ char _provv; // Tipo provvisori da cancellare + TString16 _from_date, _to_date; // Range date da considerare TString16 _from_caus, _to_caus; // Causali movimenti da considerare + long _from_numreg, _to_numreg; // Range movimenti da considerare + + TRelation* _rel; + TCursor* _cur; + TCursor_sheet* _sheet; + bool _update_cursor; + + static TProvvisori_msk* _msk; + +protected: + virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + + static bool filter(const TRelation* rel); + void update_search(short id, const TString& fil); + +public: + TCursor& update_cursor(bool use_argv = FALSE); + TCursor_sheet* get_selection_sheet(); + TCursor& get_cursor() { return _cur ? *_cur : update_cursor(); } + void notify_update_needed() { _update_cursor = TRUE; } + + TProvvisori_msk(); + ~TProvvisori_msk(); +}; + +TProvvisori_msk* TProvvisori_msk::_msk = NULL; + +bool TProvvisori_msk::filter(const TRelation* rel) +{ + TProvvisori_msk& a = *_msk; + const TRectype& mov = rel->curr(); + + const char provv = mov.get_char(MOV_PROVVIS); + bool ok = (a._provv <= ' ' && provv > ' ') || (a._provv > ' ' && a._provv == provv); + + if (ok) + { + const char* caus = mov.get(MOV_CODCAUS); + ok = a._from_caus <= caus && (a._to_caus.empty() || a._to_caus >= caus); + } + + if (ok) + { + const long numreg = mov.get_long(MOV_NUMREG); + ok = numreg >= a._from_numreg && (a._to_numreg == 0 || numreg <= a._to_numreg); + } + + return ok; +} + +// Filtra il cursore in base ai campi della maschera o i parametri da linea di comando +TCursor& TProvvisori_msk::update_cursor(bool use_argv) +{ + _provv = ' '; + _from_date = _to_date = ""; + _from_caus = _to_caus = ""; + _from_numreg = _to_numreg = 0; + + if (!use_argv) + { + _provv = get(F_PROVV)[0]; + _from_date = get(F_FROMDATE); + _to_date = get(F_TODATE); + _from_caus = get(F_FROMCAUS); + _to_caus = get(F_TOCAUS); + _from_numreg = get_long(F_FROMREG); + _to_numreg = get_long(F_TOREG); + } + else + { + if (main_app().argc() > 2) + _provv = main_app().argv(2)[0]; + } + + if (_rel == NULL) + _rel = new TRelation(LF_MOV); + if (_cur == NULL) + _cur = new TCursor(_rel, "", 2); + + TRectype from_rec(LF_MOV), to_rec(LF_MOV); + if (_from_date.not_empty()) + from_rec.put(MOV_DATAREG, _from_date); + if (_to_date.not_empty()) + to_rec.put(MOV_DATAREG, _to_date); + + _cur->freeze(FALSE); + _cur->set_filterfunction(filter); + _cur->setregion(from_rec, to_rec); + _cur->items(); + _cur->freeze(TRUE); + + _update_cursor = FALSE; + + if (_sheet) + _sheet->uncheck(-1); // Annulla la selezione corrente + return *_cur; +} + +// Ritorma lo sheet con i movimenti selezionati +// Se non si seleziona nulla equivale ad aver selezionato tutto e torna NULL +// come quando non si fa nessuna selezione +// Aggiorna anche il campo F_SELECTED +TCursor_sheet* TProvvisori_msk::get_selection_sheet() +{ + if (_sheet && _update_cursor) + update_cursor(); // Update cursor and uncheck all selection + + const long total = get_cursor().items(); // Numero totale di movimenti provvisori + long sel_items = total; // Per default li considero tutti selezionati + if (_sheet) // Controllo se c'e' selezione parziale + sel_items = _sheet->checked(); + if (sel_items == 0L || sel_items > total) // Nessuna selezione = tutti selezionati + sel_items = total; + set(F_SELECTED, sel_items); // Aggiorno campo a video + + return sel_items < total ? _sheet : NULL; // Ritorno NULL se tutti selezionati +} + +void TProvvisori_msk::update_search(short id, const TString& fil) +{ + TBrowse* b = efield(id).browse(); + b->set_filter(fil); + b->cursor()->update(); +} + +bool TProvvisori_msk::on_field_event(TOperable_field& o, TField_event e, long jolly) +{ + switch (o.dlg()) + { + case F_PROVV: + if (e == fe_init || e == fe_modify) + { + TString16 fil = "PROVVIS"; + switch (o.get()[0]) + { + case 'C': fil << "=\"C\""; break; + case 'P': fil << "=\"P\""; break; + default : fil << "!=\"\""; break; + } + update_search(F_FROMDATE, fil); + update_search(F_TODATE, fil); + update_search(F_FROMREG, fil); + update_search(F_TOREG, fil); + notify_update_needed(); + } + break; + case F_FROMDATE: + case F_TODATE: + if (e == fe_modify) + { + notify_update_needed(); + } else + if (e == fe_close) + { + // Non è carino lasciare vuote le date se non si seleziona nulla esplicitamente + if (get(F_TODATE).empty() && get(F_FROMDATE).empty() && get_long(F_SELECTED) == 0L) + return error_box("E' necessario specificare almeno una data"); + } + break; + case DLG_SELECT: + if (e == fe_button) + { + if (_sheet == NULL) // Devo creare sheet di delezione + { + TBrowse* br = efield(F_FROMREG).browse(); // Copia intestazione dal campo della maschera! + TToken_string head = br->head(); head.insert("@1|"); // Aggiunge prima colonna di selezione + TToken_string flds = br->items(); flds.insert(" |"); // Aggiunge prima colonna vuota + _sheet = new TCursor_sheet(&get_cursor(), flds, "Selezione", head, 0, 1); + } + if (_update_cursor) // Aggiorna filtri cursore se necessario + update_cursor(); + _sheet->run(); // Mostra sheet di selezione + get_selection_sheet(); // Aggiorna F_SELECTED + return FALSE; + } + break; + default: + if (e == fe_modify) // Se viene modificato un campo qualsiasi ... + notify_update_needed(); // ... ricorda che devi aggiornare il cursore la prossima volta + break; + } + return TRUE; +} + +TProvvisori_msk::TProvvisori_msk() + : TAutomask("cg2200a"), _sheet(NULL), _rel(NULL), _cur(NULL), _update_cursor(TRUE) +{ + _msk = this; +} + +TProvvisori_msk::~TProvvisori_msk() +{ + _msk = NULL; + if (_sheet != NULL) + delete _sheet; + if (_cur) + delete _cur; + if (_rel) + delete _rel; +} + +class TProvvisori_app : public TSkeleton_application +{ TSaldo_agg _saldi; protected: // TApplication virtual bool create(); virtual bool destroy(); - virtual bool menu(MENU_TAG m); + virtual void main_loop(); protected: - static bool date_handler(TMask_field& f, KEY k); + TCursor& create_cursor(TMask* m); public: void inizia_saldi(const TRectype& mov); void aggiungi_saldi(const TRectype& rmov, bool lettura); void aggiorna_saldi(); - bool confirm_provv(TCursor& cur, TProgind& pi); - bool delete_provv(TCursor& cur, TProgind& pi); - static bool filter(const TRelation* rel); + bool confirm_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet= NULL); + bool delete_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet= NULL); void auto_delete(TCursor& cur); @@ -74,23 +274,13 @@ inline TProvvisori_app& app() bool TProvvisori_app::create() { - TApplication::create(); - - _cau = new TLocalisamfile(LF_CAUSALI); - _sal = new TLocalisamfile(LF_SALDI); - _reg = new TTable("REG"); - - dispatch_e_menu(BAR_ITEM(1)); - return TRUE; + open_files(LF_TAB, LF_MOV, LF_CAUSALI, LF_SALDI, NULL); + return TSkeleton_application::create(); } bool TProvvisori_app::destroy() { - delete _reg; - delete _sal; - delete _cau; - - return TApplication::destroy(); + return TSkeleton_application::destroy(); } void TProvvisori_app::inizia_saldi(const TRectype& r) @@ -100,14 +290,15 @@ void TProvvisori_app::inizia_saldi(const TRectype& r) _saldi.reset(); tiposal tsal = normale; - const TString& c = r.get(MOV_CODCAUS); + const TString16 c = r.get(MOV_CODCAUS); if (c.not_empty()) { - _cau->put(CAU_CODCAUS, c); - if (_cau->read() == NOERR) + const TRectype& cau = cache().get(LF_CAUSALI, c); + if (!cau.empty()) { - if (_cau->get_char(CAU_MOVAP) == 'A') tsal = apertura; - else if (_cau->get_char(CAU_MOVAP) == 'C') tsal = chiusura; + const char movap = cau.get_char(CAU_MOVAP); + if (movap == 'A') tsal = apertura; else + if (movap == 'C') tsal = chiusura; } } _saldi.set_tipo_saldo(tsal); @@ -133,13 +324,19 @@ void TProvvisori_app::aggiorna_saldi() _saldi.registra(); } -bool TProvvisori_app::confirm_provv(TCursor& cur, TProgind& pi) +bool TProvvisori_app::confirm_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet) { TLocalisamfile& mov = cur.file(LF_MOV); TLocalisamfile rmov(LF_RMOV); + + if (sheet && sheet->checked() == 0) + sheet = NULL; for (cur = 0; cur.pos() < cur.items(); ++cur) { + if (sheet && !sheet->checked(cur.pos())) + continue; + const long numreg = mov.get_long(MOV_NUMREG); inizia_saldi(mov.curr()); @@ -171,16 +368,22 @@ bool TProvvisori_app::confirm_provv(TCursor& cur, TProgind& pi) return TRUE; } -bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi) +bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet) { TLocalisamfile& mov = cur.file(LF_MOV); TLocalisamfile rmov(LF_RMOV); TLocalisamfile rmoviva(LF_RMOVIVA); - TString256 error; + if (sheet && sheet->checked() == 0) + sheet = NULL; + + TString error(256); for (cur = 0; cur.pos() < cur.items(); ++cur) - { + { + if (sheet && !sheet->checked(cur.pos())) + continue; + const long numreg = mov.get_long(MOV_NUMREG); mov.setkey(1); // Isam bug on remove with key != 1 @@ -223,6 +426,8 @@ bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi) { aggiorna_saldi(); pi.addstatus(1); + if (pi.iscancelled()) + return warning_box("Procedura interrotta dall'utente"); } else return error_box("Errore %d nella cancellazione della %s del movimento %ld", @@ -232,85 +437,32 @@ bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi) return TRUE; } - -bool TProvvisori_app::filter(const TRelation* rel) -{ - TProvvisori_app& a = app(); - const TRectype& mov = rel->curr(); - - const char provv = mov.get_char(MOV_PROVVIS); - bool ok = (a._provv <= ' ' && provv > ' ' || a._provv == provv); - - if (ok) - { - const char* caus = mov.get(MOV_CODCAUS); - ok = a._from_caus <= caus && a._to_caus >= caus; - } - - return ok; -} - -// Deve essere specificata almeno una data (inizio o fine) -bool TProvvisori_app::date_handler(TMask_field& f, KEY k) -{ - bool ok = TRUE; - if (k == K_ENTER && f.get().empty()) - { - const TMask& m = f.mask(); - if (m.get(F_TODATE).empty()) - ok = f.error_box("E' necessario specificare almeno una data"); - } - return ok; -} - void TProvvisori_app::auto_delete(TCursor& cur) { - _from_caus = ""; - _to_caus = "ZZZ"; - _provv = argv(2)[0]; - cur.set_filterfunction(filter); - const long total = cur.items(); - TProgind pi(total, "Cancellazione", FALSE, TRUE, 24); - - cur.freeze(TRUE); + TProgind pi(total, "Cancellazione movimenti provvisori", TRUE, TRUE); delete_provv(cur, pi); - cur.freeze(FALSE); } -bool TProvvisori_app::menu(MENU_TAG) +void TProvvisori_app::main_loop() { - TMask m("cg2200a"); - m.set_handler(F_FROMDATE, date_handler); - - TCursor& cur = *m.efield(F_FROMDATE).browse()->cursor(); + TProvvisori_msk m; if (argc() > 2) - { + { + TCursor& cur = m.update_cursor(TRUE); auto_delete(cur); - return FALSE; + return; } + m.reset(); while (TRUE) { - TRectype from(LF_MOV), to(LF_MOV); - cur.setregion(from, to); - cur.set_filterfunction(NULL); - - m.reset(); KEY key = m.run(); if (key != K_ENTER && key != K_DEL) break; TString16 from_d = m.get(F_FROMDATE); - TString16 to_d = m.get(F_TODATE); - - if (from_d.empty() && to_d.empty()) - { - error_box("E' nessario specificare almeno una data."); - continue; - } - if (key == K_ENTER) { const TDate da(from_d); @@ -319,70 +471,41 @@ bool TProvvisori_app::menu(MENU_TAG) if (da < lp) { from_d = lp.string(); - const bool ok = yesno_box("Il libro giornale e stato stampato il %s:\n" - "Si desidera modificare la data iniziale?", - (const char*)from_d); - if (!ok) continue; + error_box("Il libro giornale e stato stampato il %s:\n" + "La data inizio elaborazione deve essere almeno il %s", + (const char*)from_d, (const char*)from_d); + m.set(F_FROMDATE, from_d); + continue; } } - - if (from_d.not_empty()) - from.put(MOV_DATAREG, from_d); - const TString& from_r = m.get(F_FROMREG); - if (from_r.not_empty()) from.put(MOV_NUMREG, from_r); - - _from_caus = m.get(F_FROMCAUS); - - if (to_d.not_empty()) to.put(MOV_DATAREG, to_d); - - const TString& to_r = m.get(F_TOREG); - if (to_r.not_empty()) to.put(MOV_NUMREG, to_r); - - _to_caus = m.get(F_TOCAUS); - - _provv = m.get(F_PROVV)[0]; - - cur.setregion(from, to); - cur.set_filterfunction(filter); - - const TRecnotype total = cur.items(); - - + // Recupera sheet dei selezionati ed aggiorna F_SELECTED + TCursor_sheet* sheet = m.get_selection_sheet(); + const long total = m.get_long(F_SELECTED); + if (total <= 0) + { + warning_box("Nessun movimento selezionato"); + continue; + } + TString action(key == K_ENTER ? "conferma" : "cancellazione"); action << " di "; add_plural(action, total, "movimento"); - TString caption("E' stata richiesta la "); - caption << action << '.'; - - if (total > 0) - { - caption << "\nSi desidera continuare?"; - if (!yesno_box(caption)) continue; - } - else - { - warning_box("Nessun movimento nella selezione effettuata"); + TString caption; + caption << "E' stata richiesta la " << action << ".\nSi desidera continuare?"; + if (!yesno_box(caption)) continue; - } action[0] = toupper(action[0]); - TProgind pi(total, action, FALSE, TRUE, 24); - - cur.freeze(TRUE); + TProgind pi(total, action, TRUE, TRUE); if (key == K_ENTER) - confirm_provv(cur, pi); + confirm_provv(m.get_cursor(), pi, sheet); else - delete_provv(cur, pi); - - cur.freeze(FALSE); + delete_provv(m.get_cursor(), pi, sheet); } - - return FALSE; } - int cg2200(int argc, char** argv) { TProvvisori_app a; diff --git a/cg/cg2200.h b/cg/cg2200.h index f21622f59..b9364870b 100755 --- a/cg/cg2200.h +++ b/cg/cg2200.h @@ -7,3 +7,4 @@ #define F_TOREG 112 #define F_TOCAUS 113 #define F_TOCAUSDESC 114 +#define F_SELECTED 115 diff --git a/cg/cg2200a.uml b/cg/cg2200a.uml index 16c908d41..b9f188d27 100755 --- a/cg/cg2200a.uml +++ b/cg/cg2200a.uml @@ -1,19 +1,25 @@ #include "cg2200.h" -PAGE "Gestione Movimenti Provvisori" -1 -1 52 12 +PAGE "Gestione Movimenti Provvisori" -1 -1 52 14 -GROUPBOX DLG_NULL 50 4 +LIST F_PROVV 10 BEGIN - PROMPT 1 1 "Dalla data/causale" + PROMPT 1 0 "@bTipo movimenti provvisori " + ITEM "P|Contabili" + ITEM " |Tutti" + ITEM "C|Cespiti" +END + +GROUPBOX DLG_NULL 50 3 +BEGIN + PROMPT 1 1 "@bDalla data/Alla data" END DATE F_FROMDATE BEGIN - PROMPT 2 2 "Data " - HELP "Data del primo movimento provvisorio" + PROMPT 2 2 "Dal " USE LF_MOV KEY 2 SELECT PROVVIS!="" INPUT DATAREG F_FROMDATE - INPUT NUMREG F_FROMREG DISPLAY "Data@10" DATAREG DISPLAY "Numero@6" NUMREG DISPLAY "Causale" CODCAUS @@ -21,18 +27,26 @@ BEGIN DISPLAY "Tipo" PROVVIS DISPLAY "Descrizione@50" DESCR OUTPUT F_FROMDATE DATAREG - OUTPUT F_FROMREG NUMREG END -NUMBER F_FROMREG 5 +DATE F_TODATE BEGIN - PROMPT 32 2 "Operazione " - FLAGS "DR" + PROMPT 25 2 "Al " + COPY USE F_FROMDATE + INPUT DATAREG F_TODATE + INPUT NUMREG F_TOREG + COPY DISPLAY F_FROMDATE + OUTPUT F_TODATE DATAREG +END + +GROUPBOX DLG_NULL 50 4 +BEGIN + PROMPT 1 4 "@bDalla causale/Alla causale" END STRING F_FROMCAUS 3 BEGIN - PROMPT 2 3 "Causale " + PROMPT 2 5 "Dalla " FLAGS "U" USE LF_CAUSALI SELECT REG=="" INPUT CODCAUS F_FROMCAUS @@ -45,7 +59,7 @@ END STRING F_FROMCAUSDESC 50 30 BEGIN - PROMPT 16 3 "" + PROMPT 16 5 "" USE LF_CAUSALI KEY 2 SELECT REG=="" INPUT DESCR F_FROMCAUSDESC DISPLAY "Descrizione@60" DESCR @@ -53,31 +67,9 @@ BEGIN COPY OUTPUT F_FROMCAUS END -GROUPBOX DLG_NULL 50 4 -BEGIN - PROMPT 1 5 "Alla data/causale" -END - -DATE F_TODATE -BEGIN - PROMPT 2 6 "Data " - COPY USE F_FROMDATE - INPUT DATAREG F_TODATE - INPUT NUMREG F_TOREG - COPY DISPLAY F_FROMDATE - OUTPUT F_TODATE DATAREG - OUTPUT F_TOREG NUMREG -END - -NUMBER F_TOREG 5 -BEGIN - PROMPT 32 6 "Operazione " - FLAGS "DR" -END - STRING F_TOCAUS 3 BEGIN - PROMPT 2 7 "Causale " + PROMPT 2 6 "Alla " FLAGS "U" COPY USE F_FROMCAUS INPUT CODCAUS F_TOCAUS @@ -89,19 +81,52 @@ END STRING F_TOCAUSDESC 50 30 BEGIN - PROMPT 16 7 "" + PROMPT 16 6 "" COPY USE F_FROMCAUSDESC INPUT DESCR F_TOCAUSDESC COPY DISPLAY F_FROMCAUSDESC COPY OUTPUT F_TOCAUS END -LIST F_PROVV 10 +GROUPBOX DLG_NULL 50 3 BEGIN - PROMPT 2 9 "Tipo " - ITEM "P|Contabili" - ITEM " |Tutti" - ITEM "C|Cespiti" + PROMPT 1 8 "@bDal movimento/Al movimento" +END + +NUMBER F_FROMREG 5 +BEGIN + PROMPT 2 9 "Dal " + USE LF_MOV SELECT PROVVIS!="" + INPUT NUMREG F_FROMREG + DISPLAY "Numero@6" NUMREG + DISPLAY "Data@10" DATAREG + DISPLAY "Causale" CODCAUS + DISPLAY "Documento" NUMDOC + DISPLAY "Tipo" PROVVIS + DISPLAY "Descrizione@50" DESCR + OUTPUT F_FROMREG NUMREG + CHECKTYPE SEARCH +END + +NUMBER F_TOREG 5 +BEGIN + PROMPT 25 9 "Al " + COPY USE F_FROMREG + INPUT NUMREG F_TOREG + COPY DISPLAY F_FROMREG + OUTPUT F_TOREG NUMREG + CHECKTYPE SEARCH +END + +NUMBER F_SELECTED 7 +BEGIN + PROMPT 2 11 "Documenti selezionati " + FLAGS "D" +END + +BUTTON DLG_SELECT 10 2 +BEGIN + PROMPT -33 -3 "" END BUTTON DLG_OK 10 2 @@ -115,7 +140,6 @@ BEGIN MESSAGE EXIT,K_DEL END - BUTTON DLG_QUIT 10 2 BEGIN PROMPT -33 -1 "" diff --git a/cg/cg3100.cpp b/cg/cg3100.cpp index afd88c3f8..c0bcc90f8 100755 --- a/cg/cg3100.cpp +++ b/cg/cg3100.cpp @@ -1,6 +1,7 @@ // //Lista movimenti // +#include #include #include #include @@ -116,6 +117,8 @@ protected: virtual bool set_print(int m); void init_print(const TMask& m); + void print_intra(int& rr); + public: bool user_create(); @@ -146,7 +149,7 @@ HIDDEN inline TListaMov_application & app() bool annoes_handler(TMask_field& f, KEY k) { - if (k == K_TAB) + if (k == K_TAB && f.focusdirty()) { const int anno = atoi(f.get()); TEsercizi_contabili esc; @@ -713,7 +716,7 @@ void TListaMov_application::stampa_errori_iva(int* nr, const char* cod, const in set_row(++(*nr), "@11gCodice IVA sospeso"); if (_stampa_mess_alleg_iva) if (allc == 0 || allf == 0) - set_row(++(*nr), "@11gSul Codice IVA non e' stato attivato l'indicatore per allegato"); + set_row(++(*nr), "@11gSul Codice IVA non e' stato indicato un valore per allegato"); } else set_row(++(*nr), "@11gCodice IVA non presente in tabella"); @@ -1201,6 +1204,27 @@ bool TListaMov_application::preprocess_page(int file,int counter) return FALSE; } +void TListaMov_application::print_intra(int& rr) +{ + const TRectype& mov = current_cursor()->curr(LF_MOV); + const real corrval = mov.get(MOV_CORRVALUTA); + if (corrval != ZERO) + { + const TString16 codval = mov.get(MOV_CODVALI); + TString80 str; + + const TCurrency cl(mov.get_real(MOV_CORRLIRE)); + str = cl.string(TRUE); str.right_just(19); + set_row(rr,"Corr.in lire@14g%s", (const char*)str); + + const TCurrency cv(corrval, codval); + str = cv.string(TRUE); str.right_just(19); + set_row(rr,"@34gCorr.in valuta@49g%s", (const char*)str); + + set_row(rr++,"@70g%-3s", (const char*)codval); + } +} + print_action TListaMov_application::postprocess_page(int file,int count) { if (count) @@ -1265,15 +1289,7 @@ print_action TListaMov_application::postprocess_page(int file,int count) if (!_esiste_riga_iva && ! _nonesiste_riga_iva) stampa_errori_iva(&r, riga._codiva, riga._tipodet, riga._tipocr); } - real corrval = current_cursor()->file(LF_MOV).get_real(MOV_CORRVALUTA); - real corrlire = current_cursor()->file(LF_MOV).get_real(MOV_CORRLIRE); - TString vall (corrval.string("###.###.###.###,@@@")); - if (corrval != ZERO) - { - set_row(++r,"Corr.in lire@14g%r", &corrlire); - set_row(r,"@34gCorr.in valuta@49g%s", (const char*)vall); - set_row(r,"@70g%-3s", (const char *)_codval); - } + print_intra(r); if (_esiste_riga_iva) set_row(++r, "@11gPresenti righe IVA in una registrazione senza IVA"); if (_nonesiste_riga_iva) @@ -1348,15 +1364,7 @@ break; reset_print(); TCursor* cur = current_cursor(); int rr = 1; - real corrval = cur->file(LF_MOV).get_real(MOV_CORRVALUTA); - real corrlire = cur->file(LF_MOV).get_real(MOV_CORRLIRE); - if (corrval != ZERO) - { - TString vall (corrval.string("###.###.###.###,@@@")); - set_row(rr,"Corr.in lire@14g%r", &corrlire); - set_row(rr,"@34gCorr.in valuta@49g%s", (const char*) vall); - set_row(rr++,"@70g%-3s", (const char *)_codval); - } + print_intra(rr); _totdocumenti += _totdoc; TRecnotype pos, items; bool FINITO = FALSE; @@ -1919,12 +1927,10 @@ bool TListaMov_application::set_print(int m) _tipo_lista = fatture; break; case 'M': + default : masc = "cg3100a"; _tipo_lista = movimenti; break; - default: - NFCHECK("Specificare C o M"); - return FALSE; } TMask msk(masc); @@ -2272,11 +2278,8 @@ void TListaMov_application::preprocess_header() set_header (soh++, (const char*) sep); - //sep = "Studio "; - sep = ""; - sep << "Data @< Pag. @#"; - - sep.right_just(126); + sep.cut(0) << "Data @> Pag. @#"; + sep.right_just(122); switch (_tipo_lista) { diff --git a/cg/cg3100.h b/cg/cg3100.h index 89f36c47a..316d51cd0 100755 --- a/cg/cg3100.h +++ b/cg/cg3100.h @@ -34,6 +34,7 @@ #define F_RAGSOCFIN1 130 #define F_SEPARATOR 131 #define F_CODVAL 132 +#define F_DESVAL 133 #define ST_DATA 0x0001 #define ST_NUMERO 0x0002 diff --git a/cg/cg3100a.uml b/cg/cg3100a.uml index e7744f87e..1e455601f 100755 --- a/cg/cg3100a.uml +++ b/cg/cg3100a.uml @@ -240,10 +240,23 @@ BEGIN DISPLAY "Codice" CODTAB DISPLAY "Descrizione@50" S0 OUTPUT F_CODVAL CODTAB + OUTPUT F_DESVAL S0 CHECKTYPE NORMAL FLAGS "U" END +STRING F_DESVAL 50 +BEGIN + PROMPT 20 18 "" + USE %VAL KEY 2 + INPUT S0 F_DESVAL + DISPLAY "Descrizione@50" S0 + DISPLAY "Codice" CODTAB + COPY OUTPUT F_CODVAL + CHECKTYPE NORMAL +END + + ENDPAGE ENDMASK diff --git a/cg/cg3200.cpp b/cg/cg3200.cpp index 6d1257dc2..a8bd545a5 100755 --- a/cg/cg3200.cpp +++ b/cg/cg3200.cpp @@ -163,8 +163,8 @@ public: int ricerca_clifo(int riga); int ricerca_gruppo(int riga); - void calcola_progressivi(); - void calcola_progressivi_al(); + void calcola_progressivi(bool finali = FALSE); + void calcola_progressivi_al(const TDate& data); void stampa_progressivi(); int stampa_progressivi(int start_riga); void stampa_progre_riporto(); @@ -265,22 +265,14 @@ void TMastrini_application::process_link(int id, const char* txt) bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key) { + const TMask& m = f.mask(); const short id = f.dlg(); bool warning = FALSE; - const int gruppo = f.mask().get_int(F_GRUPPOINI); - - int conto; - if (id == F_SOTTOCINI_CONTO) - conto = f.mask().get_int(F_CONTOINI_CONTO); - else - if (id == F_SOTTOCINI_CLIENTE) - conto = f.mask().get_int(F_CONTOINI_CLIENTE); - else - if (id == F_SOTTOCINI_FORN) - conto = f.mask().get_int(F_CONTOINI_FORN); + const int gruppo = m.get_int(F_GRUPPOINI); + const int conto = m.get_int(F_CONTOINI_CONTO); - const long sottoconto = f.mask().get_long(id); + const long sottoconto = m.get_long(id); if ( key == K_ENTER ) { @@ -290,8 +282,8 @@ bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key) if (conto != 0 && gruppo == 0) return f.warning_box("Manca il GRUPPO"); } - - if (key == K_TAB && f.mask().is_running()) + + if (key == K_TAB && m.is_running()) { TString ds; if (id == F_SOTTOCINI_CONTO && (gruppo != 0 || conto != 0 || sottoconto != 0L)) @@ -352,29 +344,22 @@ bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key) } } } + return TRUE; } bool TMastrini_application::sottoc_handler_fine(TMask_field& f, KEY key) { + const TMask& m = f.mask(); const short id = f.dlg(); - int conto; TString ds; TString80 rs; bool warning; - const int gruppo = f.mask().get_int(F_GRUPPOFINE); + const int gruppo = m.get_int(F_GRUPPOFINE); + const int conto = m.get_int(F_CONTOFINE_CONTO); - if (id == F_SOTTOCFINE_CONTO) - conto = f.mask().get_int(F_CONTOFINE_CONTO); - else - if (id == F_SOTTOCFINE_CLIENTE) - conto = f.mask().get_int(F_CONTOFINE_CLIENTE); - else - if (id == F_SOTTOCFINE_FORN) - conto = f.mask().get_int(F_CONTOFINE_FORN); - - const long sottoconto = f.mask().get_long(id); + const long sottoconto = m.get_long(id); if ( key == K_ENTER ) { @@ -388,7 +373,7 @@ bool TMastrini_application::sottoc_handler_fine(TMask_field& f, KEY key) return FALSE; } - if ( key == K_TAB && f.mask().is_running()) + if ( key == K_TAB && m.is_running()) { if (id == F_SOTTOCFINE_CONTO && (gruppo != 0 || conto != 0 || sottoconto != 0L)) { @@ -535,30 +520,20 @@ bool TMastrini_application::contof_hnd (TMask_field& f, KEY k) if (gruppof == 0) return TRUE; + char tipo = f.mask().get(F_TIPOCF_INI)[0]; + int gruppoi = f.mask().get_int(F_GRUPPOINI); if (gruppoi < gruppof) return TRUE; int contof = f.mask().get_int(id); - int contoi; + int contoi = f.mask().get_int(F_CONTOINI_CONTO); - char tipo = f.mask().get(F_TIPOCF_INI)[0]; - - if (tipo == '\0') - contoi = f.mask().get_int(F_CONTOINI_CONTO); - else - if (tipo == 'C') - contoi = f.mask().get_int(F_CONTOINI_CLIENTE); - else - if (tipo == 'F') - contoi = f.mask().get_int(F_CONTOINI_FORN); - - if (contoi > contof) return f.error_box("Il conto di partenza deve essere inferiore o uguale al conto di arrivo"); } - + if (k == K_TAB && f.focusdirty() && f.mask().is_running()) { TLocalisamfile pconti (LF_PCON); @@ -931,7 +906,7 @@ void TMastrini_application::fai_stampa132() set_row (_rw,"@0g#t", &_dataregs); if (_stampanum == 1) - set_row (_rw,"@11g$[r]#7ld$[n]", &_numreg); + set_row (_rw,"@11g$[b]#7ld$[n]", &_numreg); else if (_stampanum == 2) { @@ -942,7 +917,7 @@ void TMastrini_application::fai_stampa132() set_row (_rw,"@30g#7t", &_numdoc); set_row (_rw,"@38g#3t", &_codcaus); - set_row (_rw,"@117g#3t #3t #6t", &_g_contr, &_c_contr, &_s_contr); + set_row (_rw,"@117g#t #t #t", &_g_contr, &_c_contr, &_s_contr); } void TMastrini_application::fai_stampa198() @@ -1015,7 +990,7 @@ void TMastrini_application::fai_stampa198() set_row (_rw,"@0g#t", &_dataregs); if (_stampanum == 1) { - set_row (_rw,"@11g$[r]#7ld$[n]", &_numreg); + set_row (_rw,"@11g$[b]#7ld$[n]", &_numreg); set_row (_rw,"@18g/#3d", &_numrig); } else if (_stampanum == 2) @@ -1028,7 +1003,7 @@ void TMastrini_application::fai_stampa198() // Stampa saldo movimenti set_row (_rw,"@151g#t", &_saldo_movimenti_str); - set_row (_rw,"@168g#3t #3t #6t", &_g_contr, &_c_contr, &_s_contr); + set_row (_rw,"@168g#t #t #t", &_g_contr, &_c_contr, &_s_contr); } void TMastrini_application::stampa_totali132() @@ -1485,8 +1460,8 @@ bool TMastrini_application::preprocess_page(int file, int counter) if (_tipostampa == 2) { // saldi_zero(); - calcola_progressivi(); - _totale_saldo = _totprogre_dare_al - _totprogre_avere_al; + calcola_progressivi(TRUE); + _totale_saldo = _saldo_progre_prec; } // else // _totale_saldo = 1.0; @@ -1624,7 +1599,7 @@ bool TMastrini_application::preprocess_page(int file, int counter) if (_stampa_mov_prov && provvis.trim().not_empty()) if (_numcarat == 1) - set_row(_rw, "@129gP"); + set_row(_rw, "@130gP"); else set_row(_rw, "@195gP"); @@ -2275,9 +2250,10 @@ print_action TMastrini_application::postprocess_page(int file, int counter) } print_action TMastrini_application::postprocess_print(int file, int counter) -{ +{ if (file == LF_SALDI) - { + { +/* Cazzata tremenda _msk->reset(F_TIPOCF_INI); _msk->reset(F_GRUPPOINI); @@ -2309,6 +2285,8 @@ print_action TMastrini_application::postprocess_print(int file, int counter) _msk->reset(F_DESCRFINE_CONTO); _msk->reset(F_DESCRFINE_CLIENTE); _msk->reset(F_DESCRFINE_FORN); +*/ + _msk->reset(-9); } return NEXT_PAGE; } @@ -2494,8 +2472,6 @@ bool TMastrini_application::set_print(int) ricerca_dati_ditta(); - int formato = _msk->get_int(F_FORMATO); // Molto scenografico! - if (_nummast == 1 || _nummast == 3) printer().footerlen(4); else @@ -2547,7 +2523,7 @@ bool TMastrini_application::set_print(int) } enable_print_menu(); - enable_link("Collegamento prima nota: ", 'r'); + enable_link("Collegamento prima nota: ", 'b'); return TRUE; } @@ -2810,7 +2786,7 @@ void TMastrini_application::crea_intestazione() set_header (7,"%s@19g%s@117g%s@131g%s", trans("Operazione"), trans("Documento"), trans("Contro"), trans("A")); if (_stampa_mov_prov) - set_header(7,"@129gM"); + set_header(7,"@130gM"); set_header (8, trans("Data")); if (_stampanum < 3) set_header (8,"@11g%s", trans("Numero")); @@ -2818,7 +2794,7 @@ void TMastrini_application::crea_intestazione() trans("Data"), trans("Numero"), trans("Cod.Causale"), trans("Descrizione"), trans("Dare"), trans("Avere"), trans("Partita"), trans("C")); if (_stampa_mov_prov) - set_header(8,"@129g%s", trans("P")); + set_header(8,"@130g%s", trans("P")); sep.fill('-'); set_header (9, (const char *) sep); } @@ -2994,13 +2970,13 @@ int TMastrini_application::crea_intestazione(int start_riga) set_row (r++,"%s@19g%s@117g%s@131g%s", trans("Operazione"), trans("Documento"), trans("Contro"), trans("A")); if (_stampa_mov_prov) - set_header(r-1,"@129g%s", trans("M")); + set_header(r-1,"@130g%s", trans("M")); set_row (r, trans("Data")); if (_stampanum < 3) set_row (r,"@11g%s", trans("Numero")); set_row (r++,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@95gDare@111gAvere@117gPartita@131gC"); if (_stampa_mov_prov) - set_header(r-1,"@129gP"); + set_header(r-1,"@130gP"); sep.fill('-'); set_row (r++,"@1g%s", (const char*)sep); } @@ -3130,7 +3106,7 @@ int TMastrini_application::stampa_progre_riporto(int start_riga) return r; } -void TMastrini_application::calcola_progressivi_al() +void TMastrini_application::calcola_progressivi_al(const TDate& data_fin) { long record,sottoc,annoes; int gruppo,conto; @@ -3183,17 +3159,21 @@ void TMastrini_application::calcola_progressivi_al() sottoc = rmov.get_long(RMV_SOTTOCONTO); if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc)) break; - else if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg < _data_ini)) //Legge movimenti con data < data iniziale - if (sezione == 'D') - _totale_prima_dare += importo; - else - _totale_prima_avere += importo; + else + { + //Legge movimenti con data > inizio esercizio e < data_fin + if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg <= data_fin)) + if (sezione == 'D') + _totale_prima_dare += importo; + else + _totale_prima_avere += importo; + } } // if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty()))) } rmov.readat(record); } -void TMastrini_application::calcola_progressivi() +void TMastrini_application::calcola_progressivi(bool finali) { /* fv 20/3/96: aggiustato per nuova struttura saldi - modificata ricerca * record scaricati e assegnazione dare/avere relativo - Controllare che @@ -3310,8 +3290,8 @@ void TMastrini_application::calcola_progressivi() } } } - - calcola_progressivi_al(); + + calcola_progressivi_al(finali ? _data_fine : _data_ini); //Calcolo dei progressivi precedenti: somma di tutti quei movimenti di rmov //che hanno la data di registrazione inferiore alla data di inizio stampa, @@ -3931,11 +3911,11 @@ void TMastrini_application::set_handlers(TMask* msk) const msk->set_handler(F_DATAFINE, data_fine); msk->set_handler(F_GRUPPOFINE, gruppo_hnd); msk->set_handler(F_CONTOINI_CONTO, contoi_hnd); - msk->set_handler(F_CONTOINI_CLIENTE, contoi_hnd); - msk->set_handler(F_CONTOINI_FORN, contoi_hnd); +// msk->set_handler(F_CONTOINI_CLIENTE, contoi_hnd); +// msk->set_handler(F_CONTOINI_FORN, contoi_hnd); msk->set_handler(F_CONTOFINE_CONTO, contof_hnd); - msk->set_handler(F_CONTOFINE_CLIENTE, contof_hnd); - msk->set_handler(F_CONTOFINE_FORN, contof_hnd); +// msk->set_handler(F_CONTOFINE_CLIENTE, contof_hnd); +// msk->set_handler(F_CONTOFINE_FORN, contof_hnd); msk->set_handler(F_SOTTOCINI_CONTO, sottoc_handler_ini); msk->set_handler(F_SOTTOCINI_CLIENTE, sottoc_handler_ini); diff --git a/cg/cg3200.h b/cg/cg3200.h index 6e3e908f1..3fe46d6c9 100755 --- a/cg/cg3200.h +++ b/cg/cg3200.h @@ -43,7 +43,6 @@ #define F_MEMORIZZA 500 #define F_NUMCARAT 501 #define F_NUMMAST 502 -#define F_FORMATO 503 #define F_CODDITTA 504 #define F_RAGSOC 505 #define F_SCELTE 506 diff --git a/cg/cg3200a.uml b/cg/cg3200a.uml index 0fb0016b3..482bb9b80 100755 --- a/cg/cg3200a.uml +++ b/cg/cg3200a.uml @@ -82,11 +82,11 @@ LIST F_TIPOCF_INI 25 BEGIN PROMPT 4 4 "Ricerca " ITEM " |Gruppo/conto/sottoconto" - MESSAGE HIDE,2@|HIDE,3@|RESET,2@|RESET,3@|RESET,1@|SHOW,1@|RESET,F_GRUPPOINI + MESSAGE HIDE,2@|HIDE,3@|SHOW,1@ ITEM "C|Clienti" - MESSAGE HIDE,1@|HIDE,3@|RESET,1@|RESET,3@|RESET,2@|SHOW,2@|RESET,F_GRUPPOINI + MESSAGE HIDE,1@|HIDE,3@|SHOW,2@ ITEM "F|Fornitori" - MESSAGE HIDE,1@|HIDE,2@|RESET,1@|RESET,2@|RESET,3@|SHOW,3@|RESET,F_GRUPPOINI + MESSAGE HIDE,1@|HIDE,2@|SHOW,3@ END NUMBER F_GRUPPOINI 3 @@ -98,58 +98,20 @@ END NUMBER F_CONTOINI_CONTO 3 BEGIN PROMPT 41 5 "" - USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="") + USE LF_PCON SELECT (CONTO!="")&&(SOTTOCONTO="") INPUT GRUPPO F_GRUPPOINI INPUT CONTO F_CONTOINI_CONTO DISPLAY "Gruppo" GRUPPO DISPLAY "Conto" CONTO DISPLAY "Descrizione@50" DESCR - OUTPUT F_GRUPPOINI GRUPPO - OUTPUT F_CONTOINI_CONTO CONTO - CHECKTYPE NORMAL - WARNING "Conto inesistente o mancante" -// MESSAGE DIRTY,F_SOTTOCINI_CONTO - VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CONTO - GROUP 1 9 -END - -NUMBER F_CONTOINI_CLIENTE 3 -BEGIN - PROMPT 41 5 "" - USE LF_PCON SELECT TMCF="C" - INPUT GRUPPO F_GRUPPOINI - INPUT CONTO F_CONTOINI_CLIENTE - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Descrizione@50" DESCR DISPLAY "Tipo" TMCF OUTPUT F_GRUPPOINI GRUPPO - OUTPUT F_CONTOINI_CLIENTE CONTO + OUTPUT F_CONTOINI_CONTO CONTO + OUTPUT F_TIPOCF_INI TMCF CHECKTYPE NORMAL - VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CLIENTE WARNING "Conto inesistente o mancante" - MESSAGE DIRTY,F_SOTTOCINI_CLIENTE - MESSAGE COPY,F_CONTOINI_CONTO - GROUP 2 9 -END - -NUMBER F_CONTOINI_FORN 3 -BEGIN - PROMPT 41 5 "" - USE LF_PCON SELECT TMCF="F" - INPUT GRUPPO F_GRUPPOINI - INPUT CONTO F_CONTOINI_FORN - DISPLAY "Gruppo" GRUPPO - DISPLAY "Conto" CONTO - DISPLAY "Descrizione@50" DESCR - OUTPUT F_GRUPPOINI GRUPPO - OUTPUT F_CONTOINI_FORN CONTO - CHECKTYPE NORMAL - VALIDATE REQIF_FUNC 1 F_SOTTOCINI_FORN - WARNING "Conto inesistente o mancante" - MESSAGE DIRTY,F_SOTTOCINI_FORN - MESSAGE COPY,F_CONTOINI_CONTO - GROUP 3 9 + VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CONTO + GROUP 9 END NUMBER F_SOTTOCINI_CONTO 6 @@ -255,11 +217,11 @@ LIST F_TIPOCF_FINE 25 BEGIN PROMPT 4 7 "Ricerca " ITEM " |Gruppo/conto/sottoconto" - MESSAGE HIDE,5@|HIDE,6@|RESET,5@|RESET,6@|RESET,4@|SHOW,4@|RESET,F_GRUPPOFINE + MESSAGE HIDE,5@|HIDE,6@|SHOW,4@ ITEM "C|Clienti" - MESSAGE HIDE,4@|HIDE,6@|RESET,4@|RESET,6@|RESET,5@|SHOW,5@|RESET,F_GRUPPOFINE + MESSAGE HIDE,4@|HIDE,6@|SHOW,5@ ITEM "F|Fornitori" - MESSAGE HIDE,4@|HIDE,5@|RESET,4@|RESET,5@|RESET,6@|SHOW,6@|RESET,F_GRUPPOFINE + MESSAGE HIDE,4@|HIDE,5@|SHOW,6@ END NUMBER F_GRUPPOFINE 3 @@ -271,21 +233,25 @@ END NUMBER F_CONTOFINE_CONTO 3 BEGIN PROMPT 41 8 "" - USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="") + USE LF_PCON SELECT (CONTO!="")&&(SOTTOCONTO="") /* &&(TMCF="") */ INPUT GRUPPO F_GRUPPOFINE INPUT CONTO F_CONTOFINE_CONTO DISPLAY "Gruppo" GRUPPO DISPLAY "Conto" CONTO DISPLAY "Descrizione@50" DESCR + DISPLAY "Tipo" TMCF OUTPUT F_GRUPPOFINE GRUPPO OUTPUT F_CONTOFINE_CONTO CONTO + OUTPUT F_TIPOCF_FINE TMCF CHECKTYPE NORMAL VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_CONTO WARNING "Conto inesistente o mancante" -// MESSAGE DIRTY,F_SOTTOCFINE_CONTO - GROUP 4 9 +// GROUP 4 9 + GROUP 9 END +/* + NUMBER F_CONTOFINE_CLIENTE 3 BEGIN PROMPT 41 8 "" @@ -324,6 +290,8 @@ BEGIN GROUP 6 9 END +*/ + NUMBER F_SOTTOCFINE_CONTO 6 BEGIN PROMPT 48 8 "" @@ -509,21 +477,14 @@ PAGE "Parametri" -1 -1 78 20 LIST F_NUMCARAT 10 BEGIN - PROMPT 4 2 "Numero caratteri " + PROMPT 4 1 "Numero caratteri " ITEM "1|132 crt." ITEM "2|198 crt." END -LIST F_FORMATO 23 -BEGIN - PROMPT 4 4 "Formato modulo di stampa " - ITEM "66|11 pollici (27,94 cm)" - ITEM "72|12 pollici (30,48 cm)" -END - LIST F_NUMMAST 10 BEGIN - PROMPT 4 6 "Numero mastrini per pagina " + PROMPT 4 2 "Numero mastrini per pagina " ITEM "1|Uno" ITEM "2|Due" ITEM "3|Continua" @@ -531,7 +492,7 @@ END SPREADSHEET F_SCELTE BEGIN - PROMPT 0 8 "" + PROMPT 0 4 "" ITEM "Anno" ITEM "Tipo@4" ITEM "Gr." diff --git a/cg/cg3400.cpp b/cg/cg3400.cpp index 4fec205dd..14b50f4c8 100755 --- a/cg/cg3400.cpp +++ b/cg/cg3400.cpp @@ -221,7 +221,6 @@ public: const char* get_descr_caus (const char * codcaus); const TRectype& look_com (const char* cod, const char* stato = ""); const TString& get_codiva_des(const char* codiva); - void get_date_aep(int aep, TDate* in, TDate* fin); void update_totals (char sezione, real& importo); void set_reg_filter(TMask& m); @@ -245,7 +244,7 @@ bool TStampa_giornale::filtra_reg(const TRelation * r) bool TStampa_giornale::filter_func(const TRelation * r) { - const TRectype& recmov = r->lfile().curr(); + const TRectype& recmov = r->curr(); // Scarto SEMPRE i provvisori const TString& provvis = recmov.get(MOV_PROVVIS); @@ -253,7 +252,8 @@ bool TStampa_giornale::filter_func(const TRelation * r) return FALSE; // Scarto i movimenti che hanno il registro ai soli fini della liquidazione - const tipo_sospensione ts = r->lfile("REG").get_bool("B1") ? (tipo_sospensione) r->lfile("REG").get_int("I9") : nessuna; + const TRectype& reg = r->lfile("REG").curr(); + const tipo_sospensione ts = reg.get_bool("B1") ? (tipo_sospensione) reg.get_int("I9") : nessuna; if (ts == liquidazione) return FALSE; @@ -261,7 +261,7 @@ bool TStampa_giornale::filter_func(const TRelation * r) if (!app()._libro_giornale_iva_unico) { const long numreg = recmov.get_long("NUMREG"); - TRectype& recrmov = r->lfile(LF_RMOV).curr(); + TRectype& recrmov = r->curr(LF_RMOV); recrmov.zero(); recrmov.put("NUMREG", numreg); recrmov.put("NUMRIG", 1); @@ -318,27 +318,28 @@ void TStampa_giornale::get_dati_ditta () _cofi = _anag->get(ANA_COFI); _paiva = _anag->get(ANA_PAIV); _comunefis = _anag->get(ANA_COMRF); + _cap = _anag->get(ANA_CAPRF); if (_comunefis.empty()) - _comunefis = _anag->get(ANF_COMRES); + _comunefis = _anag->get(ANF_COMRES); - const TRectype& dep = look_com (_comunefis); - - _comunefis = dep.get(COM_DENCOM); - _provfis = dep.get(COM_PROVCOM); - _cap = dep.get(COM_CAPCOM); + const TRectype& dep = look_com(_comunefis); + _comunefis = dep.get(COM_DENCOM); + _provfis = dep.get(COM_PROVCOM); + if (_cap.empty()) + _cap = dep.get(COM_CAPCOM); if (_comunefis.empty()) { - _viafis = _anag->get(ANA_INDRF); + _viafis = _anag->get(ANA_INDRF); _viafis.rtrim(); - _viafis << " " << _anag->curr().get (ANA_CIVRF); + _viafis << ' ' << _anag->curr().get (ANA_CIVRF); } else { - _viafis = _anag->get(ANA_INDRES); + _viafis = _anag->get(ANA_INDRES); _viafis.rtrim(); - _viafis << " " << _anag->get (ANA_CIVRES); + _viafis << ' ' << _anag->get (ANA_CIVRES); } } @@ -365,14 +366,14 @@ bool TStampa_giornale::user_create() _causali = new TDecoder(LF_CAUSALI, "DESCR"); _rel = new TRelation (LF_MOV); - _rel->add (LF_RMOV, "NUMREG=NUMREG"); - _rel->add (LF_RMOVIVA, "NUMREG=NUMREG"); - _rel->add ("REG", "CODTAB[1,4]=ANNOIVA|CODTAB[5,7]=REG"); + _rel->add (LF_RMOV, "NUMREG==NUMREG"); + _rel->add (LF_RMOVIVA, "NUMREG==NUMREG"); + _rel->add ("REG", "CODTAB[1,4]==ANNOIVA|CODTAB[5,7]==REG"); // CM500302 senza == si incasina con registri vuoti! _cur = new TCursor (_rel, "", 2); // usa la chiave 2: DATAREG+NUMREG - _RecPartoDa = new TRectype(_cur->file(LF_MOV).curr()); - _RecArrivoA = new TRectype(_cur->file(LF_MOV).curr()); + _RecPartoDa = new TRectype(_cur->curr()); + _RecArrivoA = new TRectype(_cur->curr()); add_cursor (_cur); @@ -405,9 +406,10 @@ void TStampa_giornale::aggiorna_mov() TLocalisamfile& mov = _cur->file(LF_MOV); long nprog = _nprog_da + 1; - const TRectype da(*_RecPartoDa); - const TRectype a(*_RecArrivoA); - _cur->setregion(da, a); +// const TRectype da(*_RecPartoDa); +// const TRectype a(*_RecArrivoA); +// _cur->setregion(da, a); + _cur->setregion(*_RecPartoDa, *_RecArrivoA); const long items = _cur->items(); TProgind prnd (items, "Aggiornamento movimenti ...", FALSE, TRUE); @@ -829,7 +831,7 @@ bool TStampa_giornale::preprocess_print(int file, int counter) _nuovo_mese = FALSE; _iva_array.destroy(); _nprog_mov = _nprog_da; - *_RecPartoDa = _cur->file(LF_MOV).curr(); + *_RecPartoDa = _cur->curr(); break; default: break; @@ -1518,7 +1520,8 @@ void TStampa_giornale::aggiorna_tabreg(int partito_da, int stampate) if (_tabreg->good()) { // _tabreg->put ("I8", (long)partito_da); // partito_da = -1 se stampa OK - _tabreg->put ("I1", (long)_pagine_stampate + stampate); // pagine stampate +// _tabreg->put ("I1", (long)_pagine_stampate + stampate); // pagine stampate + _tabreg->put ("I1", (long)_pagina_da + stampate); // pagine stampate _tabreg->put ("I6", _nprog_mov); // ultimo numero di riga _tabreg->put ("R1", _tot_dare_generale); _tabreg->put ("R2", _tot_avere_generale); @@ -1527,56 +1530,45 @@ void TStampa_giornale::aggiorna_tabreg(int partito_da, int stampate) } } -void TStampa_giornale::get_date_aep(int aep, TDate* in, TDate* fin) -{ - *in = TDate(1,1,aep); - *fin = TDate(31,12,aep); -} - -const int es_prec(const int es_corr) -{ - return es_corr-1; -} - bool TStampa_giornale::controlla_mov_aep() { TWait_cursor hourglass; - - const int aep = es_prec(_ae); - TDate inizio_ep, fine_ep; - - if (aep == 0) // = e' il primo esercizio - return TRUE; - else - get_date_aep(aep,&inizio_ep, &fine_ep); - TRectype da (LF_MOV); - TRectype a (LF_MOV); + TEsercizi_contabili esc; + const int aep = esc.pred(_ae); + TDate inizio_ep, fine_ep; + if (aep > 0) + { + inizio_ep = esc[aep].inizio(); + fine_ep = esc[aep].fine(); + } + else + return TRUE; // = e' il primo esercizio + + TRectype da(LF_MOV), a(LF_MOV); da.put(MOV_DATAREG, inizio_ep); a.put (MOV_DATAREG, fine_ep); - _cur->setregion(da, a); + _cur->setfilter(""); _cur->set_filterfunction(filter_func, TRUE); - // _cur->setfilter(format("ANNOES=%04d && STAMPATO!=\"X\"", aep)); + + const TRecnotype items = _cur->items(); + _cur->freeze(); + TProgind pi(items, "Controllo movimenti esercizio precedente", FALSE, TRUE); bool gia_stampati = TRUE; - for (*_cur = 0L ; _cur->ok(); ++(*_cur)) - { + for (*_cur = 0L ; _cur->pos() < items; ++(*_cur)) + { + pi.addstatus(1); gia_stampati = _cur->file().get_bool("STAMPATO"); if (!gia_stampati) break; // basta trovarne uno ancora da stampare } - - if (_cur->items() > 0L && !gia_stampati) - { - _cur->setfilter(""); - warning_box("Impossibile proseguire con la stampa:\n" - "Esistono movimenti nell'esercizio precedente\n" - "che non sono ancora stati stampati su bollato."); - return FALSE; - } - _cur->setfilter(""); - - return TRUE; + _cur->freeze(FALSE); + if (!gia_stampati) + error_box("Impossibile proseguire con la stampa:\n" + "Esistono movimenti nell'esercizio precedente\n" + "che non sono ancora stati stampati su bollato."); + return gia_stampati; } bool TStampa_giornale::leggi_tabreg(const char * reg_cod, int reg_anno) @@ -1636,9 +1628,11 @@ bool TStampa_giornale::data_a_hndl (TMask_field& f, KEY k) return TRUE; TEsercizi_contabili esc; + if (esc.date2esc(data_a) <= 0) + return f.error_box("La data non appartiene a nessun esercizio"); app()._ae_solare = data_a.year(); - app()._ae = esc.date2esc(data_a);//app()._ae_solare; + app()._ae = esc.date2esc(data_a); m.set(ANNO_ESER, app()._ae_solare); m.send_key(K_TAB, CODREG); @@ -1873,7 +1867,7 @@ bool TStampa_giornale::init_cursor() if (_cur->items() == 0L) { _cur->setfilter(""); - return warning_box ("Non ci sono movimenti da stampare nel periodo selezionato.\nLa stampa e' annullata"); + return warning_box("Non ci sono movimenti da stampare nel periodo selezionato.\nLa stampa e' annullata"); } return TRUE; @@ -1910,7 +1904,9 @@ bool TStampa_giornale::set_print(int) if (_stampa_definitiva) { TEsercizi_contabili esc; - _data_da = esc.esercizio(_ae).inizio();//TDate(1,1,_ae); + _ae_solare = _data_a.year(); + _ae = esc.date2esc(_data_a); + _data_da = esc[_ae].inizio(); // Controlla che non siano rimasti movimenti ancora da stampare dell'es.prec. if (_stampa_stesso_registro) diff --git a/cg/cg3600.cpp b/cg/cg3600.cpp index 45b731278..62dffd092 100755 --- a/cg/cg3600.cpp +++ b/cg/cg3600.cpp @@ -532,8 +532,9 @@ class TMastrino : public TObject TBill _conto; // Conto del mastrino int _esercizio; // Esercizio di riferimento (eventualmente 0) - TDate _da_data, _a_data; - TString _da_caus, _a_caus; + TDate _da_data, _a_data; // Date limite + TString _da_caus, _a_caus; // Causali limite + bool _provvis; // Includi provvisori real _pdare_ini, _pavere_ini; real _pdare_per, _pavere_per; @@ -555,7 +556,7 @@ public: void read(const TBill& conto, int annoes, const TDate& dd, const TDate& ad, - const TString& dc, const TString& ac); + const TString& dc, const TString& ac, bool provvis); void reread(); TRiga_mastrino& operator[](long n) const { return row(n); } @@ -607,8 +608,7 @@ TMastrino::TMastrino() if (_instances == 0L) { _rel = new TRelation(LF_RMOV); - _rel->add(LF_MOV, "NUMREG=NUMREG"); - _cur = new TCursor(_rel); + _rel->add(LF_MOV, "NUMREG==NUMREG"); _rmov = &_rel->lfile(); _mov = &_rel->lfile(LF_MOV); } @@ -662,7 +662,8 @@ long TMastrino::last(tipo_riga_mastrino tipo) const void TMastrino::read(const TBill& conto, int ae, const TDate& dd, const TDate& ad, - const TString& dc, const TString& ac) + const TString& dc, const TString& ac, + bool provvis) { TEsercizi_contabili esercizi; @@ -691,6 +692,7 @@ void TMastrino::read(const TBill& conto, const bool test_caus = !(dc.blank() && ac.blank()); _da_caus = dc; _a_caus = ac.blank() ? "zzz" : ac; // Se vuota sceglie la massima causale + _provvis = provvis; TDate max_data_reg = _a_data; long num_giorni = _a_data - inizio_esercizio + 1; @@ -706,11 +708,6 @@ void TMastrino::read(const TBill& conto, max_data_reg = esercizi[ae].fine(); } - TString caption(80); - caption.format("Caricamento mastrino %03d.%03d.%06ld", - _conto.gruppo(), _conto.conto(), _conto.sottoconto()); - TProgind pi(num_giorni, caption, FALSE, TRUE); - // Stima dimensione mastrino _riga.choose_step(num_giorni); @@ -736,10 +733,6 @@ void TMastrino::read(const TBill& conto, // limiti della stampa _pdare_per = _pavere_per = ZERO; - rmov_rec.zero(); - conto.put(rmov_rec); - rmov_rec.put(RMV_DATAREG, inizio_esercizio); - const TRecfield rmov_datareg (rmov_rec, RMV_DATAREG); const TRecfield rmov_numreg (rmov_rec, RMV_NUMREG); const TRecfield rmov_gruppo (rmov_rec, RMV_GRUPPO); @@ -756,22 +749,24 @@ void TMastrino::read(const TBill& conto, long num_rec = 0; const clock_t clock_start = clock(); #endif + + rmov_rec.zero(); + conto.put(rmov_rec); + TRectype darow(rmov_rec), arow(rmov_rec); + darow.put(RMV_DATAREG, inizio_esercizio); + arow.put(RMV_DATAREG, max_data_reg); + TCursor cur(&rel(), "", 2, &darow, &arow); + const TRecnotype totrows = cur.items(); + cur.freeze(); + + TString caption(80); + caption.format("Caricamento mastrino %03d.%03d.%06ld", + _conto.gruppo(), _conto.conto(), _conto.sottoconto()); + TProgind pi(totrows, caption, FALSE, TRUE); - TDate ultimo_giorno; // memorizza ultima data registrazione utilizzata - - for (int err = rel().read(_isgteq); err == NOERR; err = rel().next()) + for (cur = 0L; cur.pos() < totrows; ++cur) { - // Controlla di non aver superato la data limite - const TDate data_reg((const char*)rmov_datareg); - if (data_reg > max_data_reg) - break; - - // Controlla che il conto sia ancora quello selezionato - if (_conto.sottoconto() != long(rmov_sottoconto) || - _conto.conto() != int(rmov_conto) || - _conto.gruppo() != int(rmov_gruppo)) - break; - + pi.addstatus(1); #ifdef DBG num_rec++; if ((num_rec & 0x7F) == 0) @@ -786,23 +781,18 @@ void TMastrino::read(const TBill& conto, } #endif - // Ignora i movimenti provvisori - const char provvis = *(const char*)mov_provvis; - if (provvis > ' ') - continue; + // Ignora eventualmente i movimenti provvisori + if (!_provvis) + { + const char is_provvis = *(const char*)mov_provvis; + if (is_provvis > ' ') + continue; + } - const TDate data_corrente = _esercizio <= 0 ? data_reg : TDate((const char*)mov_datacomp); + const TDate data_corrente = _esercizio <= 0 ? rmov_datareg : TDate((const char*)mov_datacomp); if (data_corrente > _a_data) continue; - // Aggiorna la barra solo una volta al giorno - if (data_reg > ultimo_giorno) - { - const long giorno = data_reg - inizio_esercizio + 1; - pi.setstatus(giorno); - ultimo_giorno = data_reg; - } - const char sezione = *((const char*)rmov_sezione); const real importo((const char*)rmov_importo); @@ -833,19 +823,17 @@ void TMastrino::read(const TBill& conto, TRiga_mastrino* r = new TRiga_mastrino(riga_mastrino, rmov().recno(), mov().recno(), - _pdare_per, _pavere_per, data_reg); + _pdare_per, _pavere_per, rmov_datareg); _riga.append(r); } } - pi.setstatus(num_giorni); // Raramente arriva in fondo! } void TMastrino::reread() { - read(_conto, _esercizio, _da_data, _a_data, _da_caus, _a_caus); + read(_conto, _esercizio, _da_data, _a_data, _da_caus, _a_caus, _provvis); } - void TMastrino::position_rel(long n) { const TRiga_mastrino& r = row(n); @@ -1201,10 +1189,13 @@ TGrid_control::TGrid_control( fixed_columns = 1; XI_OBJ* itf = get_interface(parent); + + long list_attr = XI_ATR_ENABLED | XI_ATR_VISIBLE; + // if (_read_only) list_attr |= XI_ATR_NAVIGATE; XI_OBJ_DEF* listdef = xi_add_list_def(NULL, cid, rct.top, rct.left, rct.bottom-rct.top, - XI_ATR_ENABLED | XI_ATR_VISIBLE, + list_attr, NORMAL_COLOR, NORMAL_BACK_COLOR, // normal DISABLED_COLOR, DISABLED_BACK_COLOR, // disabled FOCUS_COLOR, // active @@ -1226,11 +1217,15 @@ TGrid_control::TGrid_control( l->scroll_bar_button = TRUE; l->white_space_color = MASK_DARK_COLOR; l->rule_color = MASK_DARK_COLOR; - + if (_read_only) + { l->single_select = TRUE; + } else + { l->active_back_color = FOCUS_BACK_COLOR; + } // Definizione della prima colonna (numero di riga) const long attr = XI_ATR_VISIBLE | XI_ATR_RJUST | XI_ATR_SELECTABLE; @@ -1463,11 +1458,13 @@ void TGrid_control::update_selection(XI_EVENT* xiev) { const bool is_curr = xiev->v.rec_request.data_rec == _cur_rec; if (_read_only) - { + { +/* if (is_curr) xiev->v.rec_request.attrib |= XI_ATR_SELECTED; else xiev->v.rec_request.attrib &= ~XI_ATR_SELECTED; +*/ } else xiev->v.rec_request.has_focus = is_curr; @@ -1550,6 +1547,8 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev) _cur_rec = rec; // Assegno subito il record corrente _grid->on_record_button(rec); #endif + if (_read_only) + refused = TRUE; } else { @@ -1557,6 +1556,7 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev) { const short cid = col2cid(xiev->v.select.column); _grid->on_dbl_cell(rec, cid); + refused = TRUE; } _cur_rec = rec; // Assegno solo ora il record corrente } @@ -2172,7 +2172,7 @@ public: void destroy(); void read(const TBill& conto, int annoes, const TDate& dd, const TDate& ad, - const TString& dc, const TString& ac); + const TString& dc, const TString& ac, bool provv); void reread(); TMastrino& mastrino() { return _mastrino; } @@ -2235,8 +2235,16 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell) const TRectype& mov = _mastrino.testata(rec); const int anno = _esercizi.date2esc(riga.data()); const int eser = mov.get_int(MOV_ANNOES); - const comp = anno != eser; - cell.set_icon(comp ? ICO_CHECK_ON : ICO_CHECK_OFF); + TString8 str; + if (anno != eser) + str = "C"; // Di competenza vecchia + if (mov.get(MOV_PROVVIS).not_empty()) + { + if (str.not_empty()) + str << '/'; + str << 'P'; + } + cell = str; } break; case 103: @@ -2257,20 +2265,6 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell) case 104: if (riga.tipo() == riga_mastrino) { -/* Invertire l'ordine - const TRectype& mov = _mastrino.testata(rec); - cell.set(mov.get(MOV_DESCR)); - if (cell.empty()) - { - const TRectype& rmov = _mastrino.riga(rec); - cell.set(rmov.get(RMV_DESCR)); - if (cell.empty()) - { - TBill uncle(rmov,TRUE); - cell.set(uncle.descrizione()); - } - } -*/ const TRectype& rmov = _mastrino.riga(rec); cell.set(rmov.get(RMV_DESCR)); if (cell.empty()) @@ -2480,10 +2474,10 @@ bool TMastrini_grid::on_resize_column(short cid, int new_size) void TMastrini_grid::read(const TBill& conto, int annoes, const TDate& dd, const TDate& ad, - const TString& dc, const TString& ac) + const TString& dc, const TString& ac, bool provv) { destroy(); - _mastrino.read(conto, annoes, dd, ad, dc, ac); + _mastrino.read(conto, annoes, dd, ad, dc, ac, provv); update(); update_mask(); } @@ -2838,10 +2832,12 @@ void TQuery_mask::do_query(TGrid_mask& gm) const TString& da_caus = get(F_DACAUSALE); const TString& a_caus = get(F_ACAUSALE); + + const bool provv = get_bool(F_PROVVIS); conto.set(gm, F_GRUPPO, F_CONTO, F_SOTTOCONTO, 0, F_DESSOTTOC); - gm.grid().read(conto, annoes, da_data, a_data, da_caus, a_caus); + gm.grid().read(conto, annoes, da_data, a_data, da_caus, a_caus, provv); gm.run(); } diff --git a/cg/cg3600.h b/cg/cg3600.h index 3e0349e51..260927a64 100755 --- a/cg/cg3600.h +++ b/cg/cg3600.h @@ -18,6 +18,8 @@ #define F_DADESCAUS 114 #define F_ACAUSALE 115 #define F_ADESCAUS 116 +#define F_PROVVIS 117 + #define F_MASTRINI 200 #define F_TOTRIG_SAL 201 #define F_TOTRIG_DAR 202 diff --git a/cg/cg3600a.uml b/cg/cg3600a.uml index 466dc12f0..633c8248e 100755 --- a/cg/cg3600a.uml +++ b/cg/cg3600a.uml @@ -201,7 +201,7 @@ BEGIN GROUP 3 4 END -GROUPBOX DLG_NULL 76 3 +GROUPBOX DLG_NULL 76 4 BEGIN PROMPT 1 10 "@bPeriodo" FLAGS "R" @@ -233,15 +233,20 @@ BEGIN WARNING "La data finale deve essere maggiore di quella iniziale" END +BOOLEAN F_PROVVIS +BEGIN + PROMPT 2 12 "Includi movimenti provvisori" +END + GROUPBOX DLG_NULL 76 4 BEGIN - PROMPT 1 13 "@bCausali" + PROMPT 1 14 "@bCausali" FLAGS "R" END STRING F_DACAUSALE 3 BEGIN - PROMPT 2 14 "Da causale " + PROMPT 2 15 "Da causale " FLAGS "UZ" USE LF_CAUSALI INPUT CODCAUS F_DACAUSALE @@ -257,7 +262,7 @@ END STRING F_DADESCAUS 50 BEGIN - PROMPT 23 14 "" + PROMPT 23 15 "" USE LF_CAUSALI KEY 2 INPUT DESCR F_DADESCAUS DISPLAY "Descrizione@50" DESCR @@ -269,7 +274,7 @@ END STRING F_ACAUSALE 3 BEGIN - PROMPT 2 15 "A causale " + PROMPT 2 16 "A causale " FLAGS "UZ" COPY USE F_DACAUSALE INPUT CODCAUS F_ACAUSALE @@ -284,7 +289,7 @@ END STRING F_ADESCAUS 50 BEGIN - PROMPT 23 15 "" + PROMPT 23 16 "" COPY USE F_DADESCAUS INPUT DESCR F_ADESCAUS COPY DISPLAY F_DADESCAUS diff --git a/cg/cg3600b.uml b/cg/cg3600b.uml index 2fbf9a60f..504cff482 100755 --- a/cg/cg3600b.uml +++ b/cg/cg3600b.uml @@ -4,7 +4,7 @@ TOOLBAR "" 0 20 0 0 BUTTON DLG_LINK 10 2 BEGIN - PROMPT -12 -11 "~Collega" + PROMPT -12 -11 "Colle~ga" PICTURE BMP_LINK END @@ -64,7 +64,7 @@ BEGIN PROMPT 1 2 "Mastrini" FLAGS "DM2" ITEM "Data Op. \nData Doc.@10" - ITEM "C@1" + ITEM "C/P" ITEM "Causale@20" ITEM "Descrizione@20" ITEM "Dare@15R" diff --git a/cg/cg3700.cpp b/cg/cg3700.cpp index 8210b541b..9eecf928a 100755 --- a/cg/cg3700.cpp +++ b/cg/cg3700.cpp @@ -685,7 +685,7 @@ void TLista_fatture::set_page(int file, int counter) { set_row(nriga,"@ld@12g@5,rs@18g@ld@29g@7,rs",FLD(LF_MOV,MOV_DATAREG),FLD(LF_MOV,MOV_PROTIVA), FLD(LF_MOV,MOV_DATADOC),FLD(LF_MOV,MOV_NUMDOC)); - set_row(nriga,"@37g@6,rn@44g#-18t@63g@3s@67g@2,rn",FLD(LF_MOV,MOV_CODCF),&_ragsoc,FLD(LF_MOV,MOV_REG), FLD(LF_MOV,MOV_MESELIQ)); + set_row(nriga,"@37g@6,rn@44g#-18.18t@63g@3s@67g@2,rn",FLD(LF_MOV,MOV_CODCF),&_ragsoc,FLD(LF_MOV,MOV_REG), FLD(LF_MOV,MOV_MESELIQ)); set_row(nriga,"@70g@2s@73g@15n",FLD(LF_MOV,MOV_TIPODOC),FLD(LF_MOV,MOV_TOTDOC)); set_row(nriga,"@125g@7,rn",FLD(LF_MOV,MOV_NUMREG)); } @@ -729,7 +729,6 @@ bool TLista_fatture::set_print(int m) default: break; } - while (msk.run() == K_ENTER) { _from_cf = msk.get_long(FLD_FROM_FOR); @@ -800,6 +799,7 @@ bool TLista_fatture::set_print(int m) // Ripristina la ditta pref.set_codditta(save_firm); + msk.reset(); } return FALSE; } diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 5b8addae6..6605e0b4d 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -57,7 +57,7 @@ bool TLiquidazione_app::recalc_all() _nditte->curr().put("CODDITTA",nomeditta.get_long(1)); _nditte->read(); _freqviva = nomeditta.get(3); - bool mens = _freqviva == "M"; + bool mens = _freqviva == "M"; // determina attivita' prevalente e istanzia cazzuole // per vedere che Kazzo di liquidazione calcolare @@ -103,8 +103,8 @@ bool TLiquidazione_app::recalc_all() } if (need_refresh && yesno_box("Alcuni mesi precedenti non " - "risultano ricalcolati. E' consigliabile il ricalcolo. " - "Si desidera eseguirlo?")) + "risultano ricalcolati. E' consigliabile il ricalcolo. " + "Si desidera eseguirlo?")) _recalc = ever; } @@ -185,7 +185,6 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) TToken_string atts; TToken_string cattivs; - // casini per stampa minchie in coda ai registri bool riepliq = _isregis ? _riepilogo : FALSE; @@ -228,7 +227,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) for (int tipoatt = 1; tipoatt <= (_mixed ? 2 : 1); tipoatt++) { - TString cattiv(codatt); bool waspla; + TString8 cattiv(codatt); bool waspla; cattiv << tipoatt; if (tipoatt == 1 && (waspla = look_pla(cattiv, FALSE))) @@ -421,8 +420,6 @@ bool TLiquidazione_app::update_att(int month, const char* codatt, // saranno solo quelli di dicembre per data <= 20/12; // il ricalcolo e' FORZATO da _recalc messo a one { - - look_plm(month, codatt, TRUE); bool ok = _plm->get_bool("B0"); if (_recalc_regis) @@ -561,9 +558,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) real esenti_b4 = 0.0; real esenti_b14 = 0.0; real vendite_vp1 = 0.0; - real vendite_vp2 = 0.0; + real vendite_vp1a = 0.0; + real acquisti_vp2 = 0.0; + real acquisti_vp2a = 0.0; real acquisti_vp3 = 0.0; - real acquisti_vp4 = 0.0; + real imposta_vp3 = 0.0; real esni_rimb = 0.0; // ci sommo tutti esenti e ni validi per rimborso real corr_CEE = 0.0; real corr_noCEE = 0.0; @@ -647,7 +646,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) // non viene applicato lo stesso metodo delle ditte normali perche' si deve // tenere conto della DATA74TER se presente. if (!_isviaggio) + { f.set_month(month == 13 ? 1 : month); + } if (year_int < 1998 || _recalc_regis) // Vecchia selezione o calcolo progoressivi per stampa registri bollati { @@ -664,25 +665,26 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) from.put(MOV_DATAREG, f); to.put(MOV_DATAREG, t); - _cur->setregion(from, to); + _cur->freeze(FALSE); + _cur->setregion(from, to); + const long items = _cur->items(); + _cur->freeze(); + *_cur = 0; - long items = _cur->items(); TString trueatt(codatt); int tipatt = atoi(trueatt.sub(5)); //trueatt = trueatt.left(5); trueatt.cut(5); -#ifdef DBG - TString msgdbg; - long freespace; -#endif for (; _cur->pos() < items; ++(*_cur)) { if ((_cur->pos() & 0x7F) == 0) { #ifdef DBG + TString msgdbg; + long freespace; msgdbg.format("Ricalcolo attivita': %ld/%ld",_cur->pos(),items); freespace = os_get_free_memory(); msgdbg << " Memoria libera: " << freespace/1024 << " Kbytes."; @@ -692,12 +694,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) } TDate date(_mov->get(MOV_DATAREG)); - const int liqmonth = _mov->get_int(MOV_MESELIQ); - TString16 reg = _mov->get("REG"); - bool isreg = look_reg(_mov->get("REG")); - TString16 tipodoc = _mov->get(MOV_TIPODOC); - bool corrisp = _reg->get_bool("B0"); - tiporeg tipomov = (tiporeg)_reg->get_long("I0"); + const int liqmonth = _mov->get_int(MOV_MESELIQ); + const TString8 reg = _mov->get("REG"); + const bool isreg = look_reg(_mov->get("REG")); + const TString8 tipodoc = _mov->get(MOV_TIPODOC); + const bool corrisp = _reg->get_bool("B0"); + const tiporeg tipomov = (tiporeg)_reg->get_long("I0"); // Controlla se la data del documento si riferisce all'anno precedente (PRORATA 1998) TDate datedoc(_mov->get(MOV_DATADOC)); @@ -765,18 +767,18 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) real nin_imp = 0.0; // imponibile non incassati real nin_iva = 0.0; // imposta non incassati - TString16 codiva = _iva->get("CODTAB"); - TString16 tipoiva = _iva->get("S1"); - TString16 tipoes_v = _iva->get("S2"); - TString16 tipoes_a = _iva->get("S9"); - TString16 iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11"); + TString8 codiva = _iva->get("CODTAB"); + TString8 tipoiva = _iva->get("S1"); + TString8 tipoes_v = _iva->get("S2"); + TString8 tipoes_a = _iva->get("S9"); + TString8 iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11"); int tipoagr = atoi(_iva->get("S4")); int tipoag = atoi(_iva->get("S5")); int tipopla = atoi(_iva->get("S3")); int tipodet = atoi(_rmoviva->get(RMI_TIPODET)); int isrimbinfr = _iva->get_bool("B3"); // vale per calcolo rimborso se ES o NI int ivarimb = !_iva->get_bool("B4"); // non escluso calcolo rimb. per al. media - TString tipocr_s = _rmoviva->get(RMI_TIPOCR); + TString8 tipocr_s = _rmoviva->get(RMI_TIPOCR); int tipocr = atoi(tipocr_s); real imponibile = _rmoviva->get_real(RMI_IMPONIBILE); const real imposta = _rmoviva->get_real(RMI_IMPOSTA); @@ -814,18 +816,24 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) if (iva_vpn.not_empty() && !fattrit) switch (tipomov) { - case vendita: // VP1 o VP2 - if (!corrisp) + case vendita: // VP1, VP1A + if (!corrisp && tipodoc != "AF" && (cau_intra || !cau_valintra) && + sosp_imp != normale && sosp_imp != liquidazione) { vendite_vp1 += imponibile; - if (cau_valintra && iva_vpn == "VP2") - vendite_vp2 += imponibile; + if (cau_valintra && iva_vpn == "VP1A") + vendite_vp1a += imponibile; } break; - case acquisto: // VP3 o VP4 - acquisti_vp3 += imponibile; - if (cau_intra && iva_vpn == "VP4") - acquisti_vp4 += imponibile; + case acquisto: // VP2, VP2A, VP3 + acquisti_vp2 += imponibile; + if (cau_intra && iva_vpn == "VP2A") + acquisti_vp2a += imponibile; + if (iva_vpn == "VP3") + { + acquisti_vp3 += imponibile; + imposta_vp3 += imposta; + } break; default: break; @@ -920,7 +928,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) { ammort_6 += imponibile; ammort_6_iva += imposta; - ult_detr += imponibile * real(DETRAZIONE_6PERCENTO); + // ult_detr += imponibile * real(DETRAZIONE_6PERCENTO); // CM500159 } else if (tipocr == 8) // Acquisto beni strum. acquisiti in leasing @@ -989,17 +997,20 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) { if (tipomov == vendita) { - if (tipoes_v == "B1") - esenti_b1 += imponibile; - else if (tipoes_v == "B2") - esenti_b2 += imponibile; - else if (tipoes_v == "B3") - esenti_b3 += imponibile; - else if (tipoes_v == "B4") - esenti_b4 += imponibile; - // se e' il caso sommare esenti per rimborso - if (isrimbinfr) - esni_rimb += imponibile; + if (sosp_imp != normale && sosp_imp != vol_affari) // CM500308 + { + if (tipoes_v == "B1") + esenti_b1 += imponibile; + else if (tipoes_v == "B2") + esenti_b2 += imponibile; + else if (tipoes_v == "B3") + esenti_b3 += imponibile; + else if (tipoes_v == "B4") + esenti_b4 += imponibile; + // se e' il caso sommare esenti per rimborso + if (isrimbinfr) + esni_rimb += imponibile; + } } else if (tipoes_a == "14") esenti_b14 += imponibile; @@ -1511,7 +1522,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) } // for per tabelle } while (_cur->next_match(LF_RMOVIVA)); - } // fine calcolo progressivi IVA + } // fine calcolo progressivi IVA if (!_recalc_regis) @@ -1722,9 +1733,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) _pum->put("R7", esenti_b14); _pum->put("R12", esni_rimb); _pum->put("R14", vendite_vp1); - _pum->put("R15", vendite_vp2); - _pum->put("R16", acquisti_vp3); - _pum->put("R17", acquisti_vp4); + _pum->put("R15", vendite_vp1a); + _pum->put("R16", acquisti_vp2); + _pum->put("R17", acquisti_vp2a); + _pum->put("R18", acquisti_vp3); + _pum->put("R19", imposta_vp3); _pam->put("R0", acquisti); _pam->put("R1", vendite); _pam->put("R6", assp_imp); @@ -1771,7 +1784,6 @@ void TLiquidazione_app::iva11_set_arr_phase_1(const TString& codatt) const bool is_vendita = tipomov == vendita; const bool is_acquisto = tipomov == acquisto; - const bool is_key = _iva11_arr.is_key(codatt); if (!is_key) // Aggiunge l'elemento se non c'e' _iva11_arr.add(codatt,(_Iva11Array*)new _Iva11Array,is_key); @@ -2691,7 +2703,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) if (_isviaggio) { // calcolo credito costo, debito mensile, perc. ripart. - perc_r = (a_mCEE * CENTO)/(a_mCEE + a_meCEE); perc_r.round(2); + perc_r = a_mCEE.is_zero() ? ZERO : (a_mCEE * CENTO)/(a_mCEE + a_meCEE); perc_r.round(2); real ivm = (c_mCEE * perc_r)/CENTO; ivm.round(ROUND_LIRA); real tc = (c_iCEE + ivm); real ta = (a_iCEE + a_mCEE); @@ -2701,7 +2713,10 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) // credito di costo { cred_cost = abs(bi); - cred_cost.round(ROUND_LIRA); + if (atoi(_year) < 2000) + cred_cost.round(ROUND_LIRA); + else + round_mille_lire(cred_cost); } else { @@ -2719,7 +2734,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) real perc; // percentuale di deducibilita' real iva_ded; // iva deducibile - perc = imp_agr2 /(imp_agr1 + imp_agr2); + perc = imp_agr2.is_zero() ? ZERO : imp_agr2 / (imp_agr1 + imp_agr2); perc.round(2); iva_ded = acq_noCEE * perc; iva_ded.round(ROUND_LIRA); @@ -2868,8 +2883,15 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) _pla->put("R8", prorata); _pla->rewrite(); if (look_lia(0l, TRUE)) - { - _lia->put("R5", cred_cost); + { + if (atoi(_year) >= 2000) + { + real cc = cred_cost; + round_mille_lire(cc); + _lia->put("R5", cc); + } + else + _lia->put("R5", cred_cost); _lia->rewrite(); } _year = yr; @@ -2994,7 +3016,8 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) || (month == 13 && !(_isbenzinaro && _gest4)) )) { const real interesse = interesse_trimestrale(_month); - real ivi = risultato.sign() > 0 ? (risultato * interesse / CENTO) : ZERO; + const real r = risultato - imposta_non_versata; // CM 26-09-2000 + real ivi = r.sign() > 0 ? (r * interesse / CENTO) : ZERO; ivi.ceil(ROUND_LIRA); _lim->put("R14", ivi); } diff --git a/cg/cg4302.cpp b/cg/cg4302.cpp index fec1c74a2..fefc47b98 100755 --- a/cg/cg4302.cpp +++ b/cg/cg4302.cpp @@ -111,28 +111,32 @@ bool TLiquidazione_app::is_date_ok(const TDate& d, int month, int liqmonth, int // selezionati. Vedi cg4301.cpp per maggiori informazioni // sul nuovo filtro di selezione movimenti. { - bool ok; if (year < 1998 || _recalc_regis) // Vecchia selezione o calcolo progressivi per stampa registri bollati { if (d.month() > month || d.year() != atoi(_year)) - return FALSE; + return ok = FALSE; if (month == 13) ok = d.month() <= month; - else - ok = d.month() == month; + else + { + if (_freqviva == "M") // Guy!!! + ok = d.month() == month; + else + ok = d.month() >= month-2 && d.month() <= month; + } } else // Nuova selezione dal 1998 in poi { - const int regmonth = d.month(); - const int regyear = d.year(); + const int regmonth = d.month(); + const int regyear = d.year(); if (month <= 12) ok = (regmonth == month && liqmonth == 0) || (liqmonth == month); else // Annuale, month == 13 - ok = (regyear == year && liqmonth != 12) || (regyear == year + 1 && liqmonth == 12); + ok = (regyear == year && liqmonth != 12) || (regyear == year + 1 && liqmonth == 12); } return ok; } @@ -519,8 +523,10 @@ bool TLiquidazione_app::look_lam(int m, bool create) bool TLiquidazione_app::look_pla(const char* a, bool create) { + _pla_r->zero(); + // forza il tipoatt a 1 - TString buf(a); + TString16 buf(a); buf.ltrim(); buf.rtrim(1); buf << "1"; diff --git a/cg/cg4303.cpp b/cg/cg4303.cpp index 4a77d0b9e..d126e3928 100755 --- a/cg/cg4303.cpp +++ b/cg/cg4303.cpp @@ -107,7 +107,7 @@ void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt) // Aggiorna il totale IVA periodica VP1 if (look_iva(ci->_codiva)) { - if (_iva->get("S10").not_empty()) // Solo VP1 ha senso coi corrispettivi... se c'è VP2 lo consideriamo in VP1 + if (_iva->get("S10").not_empty()) // Solo VP1 ha senso coi corrispettivi... se c'è VP1A lo consideriamo in VP1 { real vp1 = _pum->get_real("R14"); vp1 += imponibile; @@ -348,7 +348,7 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) // Aggiorna il totale IVA periodica VP1 if (look_iva(vv->_codiva)) { - if (_iva->get("S10").not_empty()) // Solo VP1 ha senso coi corrispettivi... se c'è VP2 lo consideriamo in VP1 + if (_iva->get("S10").not_empty()) // Solo VP1 ha senso coi corrispettivi... se c'è VP1A lo consideriamo in VP1 { real vp1 = _pum->get_real("R14"); vp1 += imponibile; @@ -409,7 +409,7 @@ void TLiquidazione_app::recalc_viaggio(int month, const char* codatt) a_mfCEE += _plm->get_real("R11"); // acquisti misti parte fuori CEE } // calcolo debito mensile da aggiornare su tabella POM - real perc_r = (a_mCEE * CENTO)/(a_mCEE + a_mfCEE); perc_r.round(2); + real perc_r = a_mCEE.is_zero() ? ZERO : (a_mCEE * CENTO)/(a_mCEE + a_mfCEE); perc_r.round(2); real ivm = (c_mCEE * perc_r)/CENTO; ivm.round(ROUND_LIRA); real tc = (c_CEE + ivm); real ta = (a_CEE + a_mCEE); diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index bfb2eef15..f9c1449c8 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -15,11 +15,11 @@ class _vDesc : public TObject { public: - TString _codiva; + TString4 _codiva; real _acq; real _vnd; real _viv; - _vDesc() : _codiva(5) {} + _vDesc() {} virtual ~_vDesc() {} }; @@ -425,7 +425,7 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt) d->_r8 = credito_costo_prec(month); // Solita minchiatina dell'arrotondamento alle 1000 lirette se siamo in annuale - if (month == 13) + if (month == 13 || atoi(_year) >= 2000) // CM500314 e CM500315 { round_mille_lire(d->_r0); round_mille_lire(d->_r1); @@ -437,7 +437,7 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt) round_mille_lire(d->_r8); } - d->_r7 = (d->_r4 * CENTO)/(d->_r4 + d->_r6); d->_r7.round(2); // percentuale + d->_r7 = d->_r4.is_zero() ? ZERO : (d->_r4 * CENTO)/(d->_r4 + d->_r6); d->_r7.round(2); // percentuale d->_r9 = (d->_r1 * d->_r7)/CENTO; if (month==13) @@ -554,12 +554,12 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool // se e' il dettaglio di una attivita' mista non stampa // gli acquisti, il perche' losalamadonna if (tipomov == acquisto && skip_acq) continue; - + // questi non vanno in liquidazione, i totali sono // gia' calcolati altrove if ((tipodet == 1 || tipodet == 3 || tipodet == 9) && !is_rit) continue; - + // se ha tutti gli importi nulli viene da un annullamento di // progressivi esistenti (achtung fatture con scontrino) if (tab->get_real("R0").is_zero() && @@ -649,8 +649,8 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool // Giochiamo sopra la particolarita' che se non e' un registro di corrispettivi // allora se R5 o R6 sono <> 0 significa che trattasi di documento FS, // che pertanto va stornato dal totale corrispettivi. (Cosi' volle Vladimiro) - real ifs(tab->get_real("R5")); // imp. fatture con scontrino - real vfs(tab->get_real("R6")); // iva fatture con scontrino + const real ifs(tab->get_real("R5")); // imp. fatture con scontrino + const real vfs(tab->get_real("R6")); // iva fatture con scontrino if (!corrisp) { if (sosp_imp != vol_affari) @@ -667,7 +667,6 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool } } - if (corrisp) { cvi -= cfi; @@ -834,7 +833,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool { d->_r11 = rt0; d->_r12 = rt1; d->_r13 = rt2; d->_r14 = rt3; - d->_s2 = rt4.string(); d->_s3 = rt5.string(); + d->_s2 = rt4.string(); d->_s3 = rt5.string(); } // aggiunge dati ptm @@ -946,8 +945,16 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool } // while (attivita') } // for (mese ok) - - + + // Cazzata orrenda ma necessaria CM500308 + if (issosp) + { + rt4 += d->_r7; rt5 += d->_r8; // Det 1 + rt4 += d->_r9; rt5 += d->_r10; // Det 3 + rt4 += real(d->_s0); rt5 += real(d->_s1); // Det 9 + d->_s2 = rt4.string(); d->_s3 = rt5.string(); + } + // annual follows in _arr if (month == 13 && ref != "ALL") { @@ -956,7 +963,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool if (look_pla(codatt)) { real v1 = _pla->get_real("R14"); - real v2(_pla->get("S1")); + real v2 = _pla->get_real("S1"); real ris = v1 + v2; real e1 = _pla->get_real("R1"); real e2 = _pla->get_real("R2"); @@ -987,7 +994,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool //if (pr != _prorata.current()) { // calcolo conguaglio -- se positivo e' a debito - if (pr > 0.0) + if (pr > ZERO) { topay = (iaq + ppg) * (pr / CENTO); round_mille_lire(topay); @@ -1009,7 +1016,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool dd->_f0 |= IS_PRORATA; dd->_r0 = ris; dd->_r1 = e1; - dd->_r2 = pr > 0.0 ? pr : 0.0 ; + dd->_r2 = pr > ZERO ? pr : ZERO ; dd->_r3 = co; dd->_r4 = e2; dd->_r5 = e3; @@ -1221,7 +1228,7 @@ void TLiquidazione_app::set_firm(_DescrItem& d) int soh = 1; if (!_isregis) { - set_header(soh++,"Ditta %s %s@109gData @<@125gPag. @#", + set_header(soh++,"Ditta %s %s@107gData @>@125gPag. @#", (const char*)(d._s0), (const char*)(d._s1)); set_header(soh++,""); } @@ -1302,7 +1309,7 @@ void TLiquidazione_app::set_att(_DescrItem& d) int soh = 1; if (!_isregis) { - set_header(soh++,"Ditta %s %s@109gData @<@125gPag. @#", + set_header(soh++,"Ditta %s %s@107gData @>@125gPag. @#", (const char*)(d._s0), (const char*)(d._s1)); set_header(soh++,""); } @@ -1665,12 +1672,9 @@ void TLiquidazione_app::set_pumpam(_DescrItem& d) if (!(d._r2.is_zero() && d._r3.is_zero())) { printed = TRUE; - real rn = d._r2 * real(DETRAZIONE_6PERCENTO); +// real rn = d._r2 * real(DETRAZIONE_6PERCENTO); // Detrazione obsoleta CM500344 set_row(row++, "Acquisto beni soggetti a detrazione (6%%)" - "@50g%r@69g%r@86g%r", - &(d._r2), - &(d._r3), - &rn); + "@50g%r@69g%r", &(d._r2), &(d._r3)); } if (!(spgn.is_zero() && spgn_iva.is_zero())) { @@ -1984,8 +1988,11 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw) if (debt_prec > ZERO) set_row(rw++,"@11gDebito o credito da liquidazione precedente@75g%r", &debt_prec); else - if (cred_prec > ZERO) + { + cred_prec -= rimborso; + if (cred_prec > ZERO) set_row(rw++,"@11gDebito o credito da liquidazione precedente@58g%r", &cred_prec); + } set_row(rw++,"%s@11gRimborsi%s@75g%r", _is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &rimborso); set_row(rw++,"@11gCredito IVA compensabile detratto@58g%r", &credito_utilizzato_iva); @@ -1995,15 +2002,6 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw) print_importo(rw++, "IVA dovuta o a credito per il periodo", cre_deb_per); -#ifdef DBG - TRACE("Risultato = %s +", risultato.string("###.###.###.###")); - TRACE("Crediti speciali = %s +", crediti_speciali.string("###.###.###.###")); - TRACE("Accantonamenti = %s +", acc_dec.string("###.###.###.###")); - TRACE("Versamenti = %s +", versamenti.string("###.###.###.###")); - TRACE("Vers int = %s +", vers_int.string("###.###.###.###")); - TRACE("IVA dov o cre = %s\n", cre_deb_per.string("###.###.###.###")); -#endif - if (crediti_speciali != ZERO || _is_visliq) set_row(rw++,"%s@11gCrediti speciali%s@58g%r", _is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &crediti_speciali); @@ -2272,18 +2270,19 @@ bool TLiquidazione_app::set_annual(_DescrItem& d) set_row(row++,""); if (year_int > 1997) { - const real perc_det = CENTO - d._r2; - const TString s(perc_det.string()); - + const real perc_det = CENTO - d._r2; + const TString16 s1 = perc_det.string(); + const TString16 s2 = d._r2.string(); set_row(row++, "%% PRO-RATA (%s%%) ed IVA non detraibile (%s%%)@69g%r", - (const char*) s, (const char*)(d._r2.string()), &(d._r6)); + (const char*)s1, (const char*)s2, &(d._r6)); + set_row(row++,"C1 - Operazioni esenti escluse da nr. 1 a 9 e 11 art. 10 @69g%r", &(d._r1)); set_row(row++,"C2 - Operazioni esenti di cui nr. 11 art. 10 @69g%r", &(d._r4)); set_row(row++,"C3 - Operazioni esenti da nr. 1 a 9 art. 10 @69g%r", &(d._r5)); set_row(row++,"C1A - Operazioni esenti di cui all'art.10 n. 27 quinquies @69g%r", &(d._r7)); set_row(row++,"@6gdi cui cessione beni ammortizzabili"); set_row(row++,"Volume d'affari @69g%r", &(d._r0)); - set_row(row++,"Detraibilita' @69g%r%%", &(perc_det)); + set_row(row++,"Detraibilita' @69g%r%%", &perc_det); } else { @@ -2293,7 +2292,7 @@ bool TLiquidazione_app::set_annual(_DescrItem& d) set_row(row++,"B2 - Operazioni esenti, di cui nr. 11 art. 10 @69g%r", &(d._r4)); set_row(row++,"B3 - Operazioni esenti da nr. 1 a 9 art. 10 @69g%r", &(d._r5)); set_row(row++,"Volume d'affari - B3 @69g%r", &(d._r0)); - set_row(row++,"Indetraibilita'@69g%r%%", &(d._r2)); + set_row(row++,"Indetraibilita'@69g%r%%", &(d._r2)); } /* Prorata delle mie brame... * chi e' il piu' sfatto del reame ? @@ -2699,7 +2698,7 @@ void TLiquidazione_app::set_acconto_p(_DescrItem& d) void TLiquidazione_app::set_acchead_p(_DescrItem& d) { reset_header(); - set_header(1,"Gestione IVA@109gData @<@125gPag. @#"); + set_header(1,"Gestione IVA@107gData @>@125gPag. @#"); set_header(3,sep); if (d._f0) // base anno in corso @@ -2749,7 +2748,7 @@ void TLiquidazione_app::set_deltab(_DescrItem& d, bool iscred) if (iscred) { // set header - set_header(1,"ELENCO DITTE A CREDITO@30g%s %s@109gData @<@125gPag. @#", + set_header(1,"ELENCO DITTE A CREDITO@30g%s %s@107gData @>@125gPag. @#", d._f0 == 13 ? "Annuale " : itom(d._f0), (const char*)_year); set_header(2,sep); set_header(3,"@40gF@60gImporto a"); @@ -2779,7 +2778,7 @@ void TLiquidazione_app::set_deltab(_DescrItem& d, bool iscred) else { // set header - set_header(1,"ELENCO DITTE A DEBITO@30g%s %s@109gData @<@125gPag. @#", + set_header(1,"ELENCO DITTE A DEBITO@30g%s %s@107gData @>@125gPag. @#", d._f0 == 13 ? "Annuale " : itom(d._f0), (const char*)_year); set_header(2,sep); set_header(3,"@40gF@60gImporto da@73gCodice@83gCod."); diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index 90200cee7..6637dc3ef 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -4,6 +4,7 @@ // Nemico ed Oscuro Messo di Malvagita'... #include #include +#include #include "cg4.h" #include "cg4400.h" @@ -39,7 +40,7 @@ inline TStampa_registri_app& app() { return (TStampa_registri_app&)main_app(); } bool TStampa_registri_app::filter_func (const TRelation * r) { - TLocalisamfile& mov = r->lfile(LF_MOV); + const TRectype& mov = r->curr(LF_MOV); TString16 codreg = mov.get(MOV_REG); TDate datareg = mov.get_date(MOV_DATAREG); int annoiva = mov.get_int(MOV_ANNOIVA); @@ -155,11 +156,12 @@ const char* TStampa_registri_app::desc_attivita(const TString& cod) attiv.put("CODATT", cod); if (attiv.read() == NOERR) TMP = attiv.get("DESCR"); - else TMP = ""; + else + TMP = ""; return TMP; } -TRectype& TStampa_registri_app::ricerca_cf(char tipocf, long codcf) +const TRectype& TStampa_registri_app::ricerca_cf(char tipocf, long codcf) { _clifo->zero(); _clifo->put(CLI_TIPOCF, tipocf); @@ -167,43 +169,44 @@ TRectype& TStampa_registri_app::ricerca_cf(char tipocf, long codcf) _clifo->read(); if (_clifo->bad()) _clifo->zero(); - return _clifo->curr(); } -TRectype& TStampa_registri_app::ricerca_occ(const char * occ) +const TRectype& TStampa_registri_app::ricerca_occ(const char* occ) { +/* TLocalisamfile occas (LF_OCCAS); occas.zero(); occas.put(OCC_CFPI, occ); occas.read(); if (occas.bad()) occas.zero(); - return occas.curr(); +*/ + return cache().get(LF_OCCAS, occ); } -TRectype& TStampa_registri_app::look_comuni (const TString& stato, const TString& cod) +const TRectype& TStampa_registri_app::look_comuni(const TString& stato, const TString& cod) { +/* _com->zero(); _com->put(COM_STATO, stato); _com->put(COM_COM, cod); _com->read(); if (_com->bad()) _com->zero(); - return _com->curr(); +*/ + TString16 key; + key << stato << '|' << cod; + return cache().get(LF_COMUNI, key); } -TRectype& TStampa_registri_app::look_comuni (const char* cod) -{ - _com->zero(); - _com->put(COM_COM, cod); - _com->read(); - if (_com->bad()) - _com->zero(); - - return _com->curr(); +const TRectype& TStampa_registri_app::look_comuni (const char* cod) +{ + const TString16 stato; + const TString16 comune = cod; + return look_comuni(stato, comune); } void TStampa_registri_app::get_dati_ditta() @@ -234,15 +237,17 @@ void TStampa_registri_app::get_dati_ditta() _cofi = anag.get(ANA_COFI); _paiva = anag.get(ANA_PAIV); _comunefis = anag.get(ANA_COMRF); + _cap = anag.get(ANA_CAPRF); if (_comunefis.empty()) _comunefis = anag.get(ANA_COMRES); + if (_cap.empty()) + _cap = anag.get(ANA_CAPRES); - TRectype dep = look_comuni (_comunefis); + const TRectype& dep = look_comuni (_comunefis); _comunefis = dep.get(COM_DENCOM); _provfis = dep.get(COM_PROVCOM); - _cap = dep.get(COM_CAPCOM); if (_comunefis.empty()) { _viafis = anag.get(ANA_INDRF); @@ -253,7 +258,7 @@ void TStampa_registri_app::get_dati_ditta() { _viafis = anag.get(ANA_INDRES); _viafis.rtrim(); - _viafis << " " << anag.get (ANA_CIVRES); + _viafis << ' ' << anag.get (ANA_CIVRES); } if (_cod_un_loc) @@ -264,13 +269,13 @@ void TStampa_registri_app::get_dati_ditta() unloc.read(); if (unloc.read() == NOERR) { - TRectype & dep =look_comuni (unloc.get(ULC_COMULC)); + const TRectype & dep =look_comuni (unloc.get(ULC_COMULC)); _comunefis = dep.get(COM_DENCOM); _provfis = dep.get(COM_PROVCOM); - _cap = dep.get(COM_CAPCOM); + _cap = unloc.get(ULC_CAPULC); _viafis = unloc.get(ULC_INDULC); _viafis.rtrim(); - _viafis << " " << unloc.get(ULC_CIVULC); + _viafis << ' ' << unloc.get(ULC_CIVULC); } } } @@ -434,13 +439,12 @@ bool TStampa_registri_app::compila_reg(const TMask& m) } if (_tipo_stampa == rif_giornale) //stampa con riferimenti al libro giornale { - TString16 datas; + TDate datas; bool good; - bool ok = cerca_libro_gio(datas,&good); - if (!ok) + bool found = cerca_libro_gio(datas, good); + if (!found || !good) { - if (!good) - warning_box ("Ditta %ld: la data indicata non deve essere superiore al %s (ultima data di stampa del libro giornale)", _ditta, (const char*)datas); + warning_box ("Ditta %ld: la data indicata non deve essere superiore al %s (ultima data di stampa del libro giornale)", _ditta, (const char*)datas.string()); return FALSE; } } @@ -487,16 +491,19 @@ bool TStampa_registri_app::compila_lib() return FALSE; } -bool TStampa_registri_app::cerca_libro_gio(TString& datas, bool* good) -{ +bool TStampa_registri_app::cerca_libro_gio(TDate& datas, bool& good) +{ +/* TString app(4); app.format("%04d", _annoes); - *good = TRUE; - TRecnotype rec = _tabreg->recno(); + good = FALSE; + bool found = FALSE; + + const TRecnotype rec = _tabreg->recno(); _tabreg->zero(); _tabreg->put ("CODTAB", app); - TRectype r (_tabreg->curr()); + const TRectype r (_tabreg->curr()); _tabreg->read(_isgteq); for (; !_tabreg->eof(); _tabreg->next()) { @@ -505,19 +512,35 @@ bool TStampa_registri_app::cerca_libro_gio(TString& datas, bool* good) tiporeg tipo_reg = (tiporeg)_tabreg->get_int("I0"); if (tipo_reg == giornale) //libro giornale { - const TDate& data = _tabreg->get_date("D3"); - if (data < _data_a) - { - datas = data; - *good = FALSE; - return FALSE; - } - _tabreg->readat(rec); - return TRUE; + datas = _tabreg->get_date("D3"); // Data ultima stampa +// if (datas < _data_a) + if (datas.month() < _data_a.month()) // CM000027 + good = FALSE; + else + good = TRUE; + found = TRUE; } } _tabreg->readat(rec); - return FALSE; + return found; +*/ + TRelation reg("REG"); + TRectype& curr = reg.curr(); + TString16 filter; + filter.format("%04d", _annoes); + curr.put("CODTAB", filter); + filter.format("I0=%d", giornale); + TCursor cur(®, filter, 1, &curr, &curr); + const bool found = cur.items() > 0; + good = FALSE; + if (found) + { + cur = 0L; + datas = curr.get_date("D3"); // Data ultima stampa + // good = datas >= _data_a; + good = datas.month() >= _data_a.month(); // CM000027 + } + return found; } bool TStampa_registri_app::is_mese_ok(int x, int month) @@ -548,10 +571,9 @@ bool TStampa_registri_app::mask_azzera (TMask_field& f, KEY k) bool TStampa_registri_app::mask_tipo_stampa(TMask_field& f, KEY k) { - TMask& m = f.mask(); - if (k == K_SPACE) { + TMask& m = f.mask(); int tipo_stampa = m.get_int(TIPO_STAMPA); if (tipo_stampa == 3) //stampa su libro unico { @@ -1198,19 +1220,19 @@ int TStampa_registri_app::riga_rmoviva() const int mese_liq = _cur->file(LF_MOV).get_int(MOV_MESELIQ); int nrec = 0; - TRecnotype nr = rmoviva.recno(); + const TRecnotype nr = rmoviva.recno(); while (ok) { nrec++; - TRectype iva (rmoviva.curr()); - tipodet = iva.get_int (RMI_TIPODET); - tipocr = iva.get_int (RMI_TIPOCR); + const TRectype& iva = rmoviva.curr(); + tipodet = iva.get_int(RMI_TIPODET); + tipocr = iva.get_int(RMI_TIPOCR); impo = iva.get_real(RMI_IMPONIBILE); impos = iva.get_real(RMI_IMPOSTA); codiva = iva.get(RMI_CODIVA); intra = iva.get_bool(RMI_INTRA); - tipoatt = iva.get_int("TIPOATT"); + tipoatt = iva.get_int(RMI_TIPOATT); _riga_rmi.add_riga(impo,impos,ZERO,ZERO,codiva,tipodet,tipocr,intra,tipoatt); @@ -1382,7 +1404,7 @@ bool TStampa_registri_app::controlla_mov() TRecnotype rec = _tabreg->recno(); for (mov.first(); !mov.eof(); mov.next()) { - TString16 reg = mov.get(MOV_REG); + const TString16 reg = mov.get(MOV_REG); if (reg.empty()) continue; //non e' un movimento iva TDate datareg = mov.get_date(MOV_DATAREG); if (_stampa_tutti_i_registri) @@ -1417,20 +1439,15 @@ tiporeg TStampa_registri_app::cerca_reg(const TString& c) return t; } +/* bool TStampa_registri_app::ventilazione(const char* iva) { - TTable tabiva ("%IVA"); - TString16 chiave = ""; - chiave << iva; - tabiva.put("CODTAB", chiave); - if (tabiva.read()==NOERR) - { - TString16 vent = tabiva.get("S1"); - if (vent == "VE") - return TRUE; - } - return FALSE; + const TString16 chiave = iva; + const TRectype& rec = cache().get("%IVA", chiave); + const TString& vent = rec.get("S1"); + return vent == "VE"; } +*/ int TStampa_registri_app::stampa_prospetto(int rr, bool print_prec) { @@ -2081,11 +2098,8 @@ bool TStampa_registri_app::preprocess_page(int file, int counter) if (_tipo_stampa != libro_unico && _liquidazione) { - int da; - if (_tipo_stampa == prova) - da = _data_da.month(); - else da = 1; - int a = _datareg.month(); + const int da = (_tipo_stampa == prova) ? _data_da.month() : 1; + const int a = _datareg.month(); for (int m = da; m < a; m++) { if (!_st_liq[m]) @@ -2201,7 +2215,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter) } else { - TRectype dep = ricerca_occ(ocfpi); + const TRectype& dep = ricerca_occ(ocfpi); ragsoc = dep.get (OCC_RAGSOC); viacf = dep.get (OCC_INDIR); civcf = dep.get (OCC_CIV); @@ -2209,7 +2223,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter) comcf = dep.get (OCC_COM); stacf = dep.get (OCC_STATO); } - TRectype com = look_comuni(stacf,comcf); + const TRectype& com = look_comuni(stacf,comcf); if (!com.empty()) { comune = com.get(COM_DENCOM); @@ -2511,7 +2525,7 @@ int TStampa_registri_app::stampa_intestazione() r++; if (_tipo_stampa == prova) { - riga = "REGISTRO DI PROVA Data @<"; + riga = "REGISTRO DI PROVA Data @>"; riga.right_just(_stampa_width-6); } @@ -2778,8 +2792,7 @@ void TStampa_registri_app::liq_other_case() //aggiusta il mese al trimestre a cui appartiene if (_frequiva == 'T') mese += 2 - ((mese-1) % 3); - - send_message(calc_reg ? 'R' : 'C', app, calc_reg ? _datareg.month()/*_fino_a_mese*/ : mese); + send_message(calc_reg ? 'R' : 'C', app, calc_reg ? _datareg.month() : mese); } } } @@ -3093,84 +3106,94 @@ void TStampa_registri_app::no_movimenti() //se la frequenza e' trimestrale //aggiusta il mese al trimestre a cui appartiene if (_frequiva == 'T') + { mese += 2 - ((mese-1) % 3); + if (calc) + { + send_message('R', app, mese-2); // Guy!!! + send_message('R', app, mese-1); // Guy!!! + } + } send_message(calc ? 'R' : 'C', app, calc ? a : mese); } if (_tipo_reg == riepilogativo || _liquidazione || _stampa_plafonds) { - for (int m = da; m <= a; m++) - { - if (_tipo_reg == riepilogativo) + for (int m = da; m <= a; m++) { - bool stsbol = FALSE; - if (_tipo_stampa != prova) //stampa su bollato - if (_u_data.ok()) - if (m <= _u_data.month()) stsbol = TRUE; - - if (!stsbol) //cioe' se il mese che sto considerando e' - //maggiore dell'ultima data di stampa del registro - if (_freq_riepilogo == 'M' || - (m == 3 || m == 6 || m == 9 || m == 12)) - { - _datareg = TDate(1, m, _annoes); - if (stampa_riepilogo(m)) - printer().formfeed(); - } - } - - // In prova va stampato per ogni mese (sia Mensile che Trimestrale; in bollato, solo per i mesi che ancora mancano) - const bool print_plafond_bollato = _tipo_stampa != prova && _u_data.ok() && m > _u_data.month(); - if (_stampa_plafonds && (_tipo_stampa == prova || print_plafond_bollato)) - { - if (! printer().isopen()) - printer().open(); - _datareg = TDate(1, m, _annoes); - if (stampa_plafonds(-1)) // Con -1 compone e stampa printrows all'istante - printer().formfeed(); - } - - //la funzione stampo_liquidazione non stampera' la liquidazione sul - //registro il cui mese di stampa ultima liq. e' > del mese in esame - //caso a parte il mese 12 (che posso ristampare 2 volte) - if (_liquidazione) - if (stampo_liquidazione(m)) + if (_tipo_reg == riepilogativo) { - if (_tipo_reg == riepilogativo) - { - if (!(_freq_riepilogo == 'M' || - (m == 3 || m == 6 || m == 9 || m == 12))) continue; - } - - if (! printer().isopen()) - printer().open(); - TFilename f; - f.temp("rgp"); - _datareg = TDate(1, m, _annoes); // serve alla preprocess_header - if (_scelta == B0_settato || _scelta == prosegui_stampa) - { - if (_tipo_stampa == prova) - send_message('S',f, m); - else - send_message('s',f, m); - } - else //_scelta == prosegui_cal_stampa - { - if (_tipo_stampa == prova) - send_message('L', f, m); - else - send_message('l', f, m); - } - if (fexist(f)) - { - _intesta_liq = TRUE; - merge_export_file(f,FALSE,TRUE); - printer().formfeed(); - _intesta_liq = FALSE; - remove(f); - } + bool stsbol = FALSE; + if (_tipo_stampa != prova) //stampa su bollato + if (_u_data.ok()) + if (m <= _u_data.month()) stsbol = TRUE; + + if (!stsbol) //cioe' se il mese che sto considerando e' + //maggiore dell'ultima data di stampa del registro + { + if (_freq_riepilogo == 'M' || + (m == 3 || m == 6 || m == 9 || m == 12)) + { + _datareg = TDate(1, m, _annoes); + if (stampa_riepilogo(m)) + printer().formfeed(); + } + } + } + + // In prova va stampato per ogni mese (sia Mensile che Trimestrale; + // in bollato, solo per i mesi che ancora mancano) + const bool print_plafond_bollato = _tipo_stampa != prova && (m == 1 || m > _u_data.month()); + if (_stampa_plafonds && (_tipo_stampa == prova || print_plafond_bollato)) + { + if (! printer().isopen()) + printer().open(); + _datareg = TDate(1, m, _annoes); + if (stampa_plafonds(-1)) // Con -1 compone e stampa printrows all'istante + printer().formfeed(); } - }//for + + //la funzione stampo_liquidazione non stampera' la liquidazione sul + //registro il cui mese di stampa ultima liq. e' > del mese in esame + //caso a parte il mese 12 (che posso ristampare 2 volte) + if (_liquidazione) + if (stampo_liquidazione(m)) + { + if (_tipo_reg == riepilogativo) + { + if (!(_freq_riepilogo == 'M' || + (m == 3 || m == 6 || m == 9 || m == 12))) continue; + } + + if (! printer().isopen()) + printer().open(); + TFilename f; + f.temp("rgp"); + _datareg = TDate(1, m, _annoes); // serve alla preprocess_header + if (_scelta == B0_settato || _scelta == prosegui_stampa) + { + if (_tipo_stampa == prova) + send_message('S',f, m); + else + send_message('s',f, m); + } + else //_scelta == prosegui_cal_stampa + { + if (_tipo_stampa == prova) + send_message('L', f, m); + else + send_message('l', f, m); + } + if (fexist(f)) + { + _intesta_liq = TRUE; + merge_export_file(f,FALSE,TRUE); + printer().formfeed(); + _intesta_liq = FALSE; + remove(f); + } + } + }//for } _tabreg->readat(rec); @@ -3293,7 +3316,7 @@ bool TStampa_registri_app::set_print(int n) _tipo_stampa = (tipo_stampa) m.get_int(TIPO_STAMPA); _stampa_width = m.get_int(STAMPA_WIDTH); _stampa_len = m.get_int(STAMPA_LEN); - _table = (_annoes > 1997) ? _tabprm : _tabpim; // Dal 1998 in poi utilizza i PRM e non i PIM + _table = (_annoes > 1997) ? _tabprm : _tabpim; // Dal 1998 in poi utilizza i PRM e non i PIM if (_stampa_width == 1) _stampa_width = 132; else _stampa_width = 198; @@ -3392,7 +3415,7 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m) if (!controlla_mov()) { TApplication::set_firm(__firm); - return fatal_box("Finire di stampare registri anno precedente"); + return error_box("Finire di stampare registri anno precedente"); } if (!_stampa_tutti_i_registri) { @@ -3487,14 +3510,13 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m) } if (_tipo_stampa == rif_giornale) //stampa con riferimenti al libro giornale { - TString16 d; + TDate d; bool good; - TRecnotype rec = _tabreg->recno(); - bool trovato = cerca_libro_gio(d, &good); - _tabreg->readat(rec); - if (!trovato) + bool trovato = cerca_libro_gio(d, good); + if (trovato) + one_printed = TRUE; + else continue; - else one_printed = TRUE; } if (_tipo_stampa == libro_unico) //stampa su libro unico { @@ -3587,8 +3609,6 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m) //Stampa registro riepilogativo bool TStampa_registri_app::stampa_riepilogo(int m) { - int a; - tiporeg tipo; TString80 chiave,ctab; TString16 codtab, codreg, creg, codatt, codiva; TRiga_array vect, vect_prec; @@ -3598,12 +3618,13 @@ bool TStampa_registri_app::stampa_riepilogo(int m) for (_tabreg->first(); !_tabreg->eof(); _tabreg->next()) // Scorre i registri { - tipo = (tiporeg)_tabreg->get_int("I0"); codtab = _tabreg->get("CODTAB"); - a = atoi(codtab.mid(0,4)); - + const int a = atoi(codtab.mid(0,4)); + if (a > _annoes) break; - + + const tiporeg tipo = (tiporeg)_tabreg->get_int("I0"); + if (a == _annoes && (tipo == vendita || tipo == acquisto)) { codreg = codtab.mid(4,3); @@ -3613,7 +3634,7 @@ bool TStampa_registri_app::stampa_riepilogo(int m) vect.destroy(); vect_prec.destroy(); vect_det.destroy(); - chiave = ""; + chiave.cut(0); chiave << _annoes << _tabreg->get("S8"); // Calcolo riepilogo del periodo e progressivi in caso di stampa su bollato @@ -3630,15 +3651,15 @@ bool TStampa_registri_app::stampa_riepilogo(int m) TTable* tabula = calc_prp ? _tabprp : _table ; tabula->zero(); tabula->put("CODTAB", chiave); - TRectype r (tabula->curr()); + const TRectype r(tabula->curr()); tabula->read(_isgteq); for (; !tabula->eof(); tabula->next()) { if (tabula->curr() != r) break; ctab = tabula->get("CODTAB"); - creg = ctab.mid(10,3); - int mese = atoi(ctab.mid(13,2)); - if (codreg == creg.trim() && mese == i) + creg = ctab.mid(10,3); creg.trim(); + const int mese = atoi(ctab.mid(13,2)); + if (codreg == creg && mese == i) { codiva = ctab.mid(16,4); int tipodet = atoi(ctab.mid(20,1)); @@ -3666,7 +3687,8 @@ bool TStampa_registri_app::stampa_riepilogo(int m) { if (!calc_prp && _tipo_stampa != prova) vect.add_riga(ZERO, ZERO, ZERO, impon,impos,impol,codiva); - if (mese == m) + + if (mese == m || (_frequiva == 'T' && mese >= m-2 && mese <= m)) // Guy!!! if (calc_prp) vect_prec.add_riga(impon,impos,impol,ZERO,ZERO,ZERO,codiva); else @@ -3678,7 +3700,7 @@ bool TStampa_registri_app::stampa_riepilogo(int m) { if (_tipo_stampa != prova) vect_det.add_riga(ZERO,ZERO,impon,impos,codiva,tipodet,0,TRUE); - if (mese == m) + if (mese == m || (_frequiva == 'T' && mese >= m-2 && mese <= m)) // Guy!!! vect_det.add_riga(impon,impos,ZERO,ZERO,codiva,tipodet,0,TRUE); } } diff --git a/cg/cg4400.h b/cg/cg4400.h index 526e8cfdf..5092afdf8 100755 --- a/cg/cg4400.h +++ b/cg/cg4400.h @@ -90,10 +90,10 @@ public: const char* tipo_attivita (); const char* descr_doc (); const char* descr_iva (const char*); - TRectype& ricerca_occ(const char*); - TRectype& ricerca_cf (char, long); - TRectype& look_comuni(const TString& stato, const TString& cod); - TRectype& look_comuni(const char* cod); + const TRectype& ricerca_occ(const char*); + const TRectype& ricerca_cf (char, long); + const TRectype& look_comuni(const TString& stato, const TString& cod); + const TRectype& look_comuni(const char* cod); TArray_sheet* get_ditte_sheet() { return _ditte; } int setta_riga (int, const TRigaiva&, real&, real&, real&, real&); int riga_rmoviva(); @@ -107,7 +107,7 @@ public: bool controlla_mov(); bool stampo_liquidazione(int); bool ventilazione(const char*); - bool cerca_libro_gio(TString&, bool*); + bool cerca_libro_gio(TDate&, bool&); bool look_reg (int, int, TString&, int, const char*, int*, long); bool look_regs(int, TString&, int, int*, long, TProgind*); bool stampa_totali_finali(); diff --git a/cg/cg4500.cpp b/cg/cg4500.cpp index 8cb7d3c31..3ce06498c 100755 --- a/cg/cg4500.cpp +++ b/cg/cg4500.cpp @@ -88,7 +88,7 @@ void TAp_eser::main_loop() anno = TabEs.get_int ("CODTAB"); inizio = TabEs.get_date("D0"); //data inizio es. in corso fine = TabEs.get_date("D1"); //data fine es. in corso - + msk.set(F_ANNO, anno); msk.set(F_DATAINIC, inizio.string()); msk.set(F_DATAFINC, fine.string()); diff --git a/cg/cg4600a.uml b/cg/cg4600a.uml index 723c57345..4c8a56d4c 100755 --- a/cg/cg4600a.uml +++ b/cg/cg4600a.uml @@ -25,13 +25,12 @@ END STRING F_CHIUSURA 3 BEGIN PROMPT 2 4 "Codice causale chiusura " - HELP "Codice causale che genera il movimento di chiusura" USE LF_CAUSALI KEY 1 SELECT MOVAP="C" FLAGS "UZ" + INPUT CODCAUS F_CHIUSURA DISPLAY "Codice" CODCAUS DISPLAY "Descrizione @50" DESCR OUTPUT F_CHIUSURA CODCAUS - INPUT CODCAUS F_CHIUSURA CHECKTYPE REQUIRED ADD RUN CG0 -4 END @@ -39,29 +38,29 @@ END STRING F_APERTURA 3 BEGIN PROMPT 2 5 "Codice causale apertura " - HELP "Codice causale che genera il movimento di apertura" USE LF_CAUSALI KEY 1 SELECT MOVAP="A" FLAGS "UZ" INPUT CODCAUS F_APERTURA COPY DISPLAY F_CHIUSURA OUTPUT F_APERTURA CODCAUS ADD RUN CG0 -4 + CHECKTYPE REQUIRED END -DATE F_DATAAP -BEGIN - PROMPT 36 4 "Data/Anno apertura " - HELP "Data in cui effettuare il movimento di apertura" - WARNING "Inserire una data non inferiore alla data di chiusura" - VALIDATE DATE_CMP_FUNC >= F_DATAC -END - DATE F_DATAC BEGIN - PROMPT 36 5 "Data/Anno chiusura " + PROMPT 36 4 "Data/Anno chiusura " HELP "Data in cui effettuare il movimento di chiusura" END +DATE F_DATAAP +BEGIN + PROMPT 36 5 "Data/Anno apertura " + HELP "Data in cui effettuare il movimento di apertura" + WARNING "Inserire una data non inferiore alla data di chiusura" + VALIDATE DATE_CMP_FUNC >= F_DATAC +END + NUMBER F_ANNOCH 4 BEGIN PROMPT 69 4 "" @@ -96,7 +95,7 @@ END GROUPBOX DLG_NULL 60 10 BEGIN - PROMPT 2 7 "Codici sottoconto" + PROMPT 2 7 "@bCodici sottoconto" END NUMBER F_BILCHG 3 @@ -104,7 +103,6 @@ BEGIN PROMPT 3 9 "Bilancio di chiusura " HELP "Codice conto di riepilogo del bilancio di chiusura" USE LF_PCON KEY 1 SELECT SOTTOCONTO!="" - CHECKTYPE REQUIRED DISPLAY "Gruppo" GRUPPO DISPLAY "Conto" CONTO DISPLAY "Sottoconto" SOTTOCONTO @@ -122,7 +120,6 @@ BEGIN PROMPT 44 9 "" HELP "Codice conto di riepilogo del bilancio di chiusura" COPY ALL F_BILCHG - CHECKTYPE REQUIRED END NUMBER F_BILCHS 6 @@ -139,7 +136,6 @@ BEGIN PROMPT 3 10 "Profitti e perdite " HELP "Codice conto di riepilogo del Profitti e perdite" COPY USE F_BILCHG - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG OUTPUT F_PROPERG GRUPPO OUTPUT F_PROPERC CONTO @@ -154,7 +150,6 @@ BEGIN PROMPT 44 10 "" HELP "Codice conto di riepilogo del Profitti e perdite" COPY USE F_BILCHG - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG COPY OUTPUT F_PROPERG COPY INPUT F_PROPERG @@ -173,7 +168,6 @@ BEGIN PROMPT 3 11 "Bilancio di apertura " HELP "Codice conto di riepilogo del Bilancio di apertura" COPY USE F_BILCHG - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG OUTPUT F_BILAPG GRUPPO OUTPUT F_BILAPC CONTO @@ -188,7 +182,6 @@ BEGIN PROMPT 44 11 "" HELP "Codice conto di riepilogo del Bilancio di apertura" COPY USE F_BILCHG - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG COPY OUTPUT F_BILAPG COPY INPUT F_BILAPG @@ -207,7 +200,6 @@ BEGIN PROMPT 3 12 "Utile d'esercizio c/to patrim. " HELP "Codice conto patrimoniale in cui ripilogare l'utile d'esercizio" USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="") - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG OUTPUT F_UTILPG GRUPPO OUTPUT F_UTILPC CONTO @@ -222,7 +214,6 @@ BEGIN PROMPT 44 12 "" HELP "Codice conto patrimoniale in cui ripilogare l'utile d'esercizio" COPY USE F_UTILPG - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG COPY OUTPUT F_UTILPG COPY INPUT F_UTILPG @@ -241,7 +232,6 @@ BEGIN PROMPT 3 13 "Perdita d'esercizio c/to patr. " HELP "Codice conto patrimoniale in cui ripilogare la perdita d'esercizio" USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="") - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG OUTPUT F_PERDPG GRUPPO OUTPUT F_PERDPC CONTO @@ -256,7 +246,6 @@ BEGIN PROMPT 44 13 "" HELP "Codice conto patrimoniale in cui ripilogare la perdita d'esercizio" COPY USE F_PERDPG - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG COPY OUTPUT F_PERDPG COPY INPUT F_PERDPG @@ -275,7 +264,6 @@ BEGIN PROMPT 3 14 "Utile d'esercizio c/to econom. " HELP "Codice conto economico in cui ripilogare l'utile d'esercizio" USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="") - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG OUTPUT F_UTILEG GRUPPO OUTPUT F_UTILEC CONTO @@ -290,7 +278,6 @@ BEGIN PROMPT 44 14 "" HELP "Codice conto economico in cui ripilogare l'utile d'esercizio" COPY USE F_UTILEG - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG COPY OUTPUT F_UTILEG COPY INPUT F_UTILEG @@ -309,7 +296,6 @@ BEGIN PROMPT 3 15 "Perdita d'esercizio c/to econ. " HELP "Codice conto economico in cui ripilogare la perdita d'esercizio" USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="") - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG OUTPUT F_PERDEG GRUPPO OUTPUT F_PERDEC CONTO @@ -325,7 +311,6 @@ BEGIN PROMPT 44 15 "" HELP "Codice conto economico in cui ripilogare la perdita d'esercizio" COPY USE F_PERDEG - CHECKTYPE REQUIRED COPY DISPLAY F_BILCHG COPY OUTPUT F_PERDEG COPY INPUT F_PERDEG diff --git a/cg/cg4900a.uml b/cg/cg4900a.uml index 40fd6888b..9d55db32b 100755 --- a/cg/cg4900a.uml +++ b/cg/cg4900a.uml @@ -1,27 +1,26 @@ #include "cg4900a.h" -PAGE "Visualizzazione liquidazione acconti" -1 -1 70 6 +PAGE "Visualizzazione liquidazione acconti" -1 -1 70 5 + + +NUMBER F_YEAR 4 +BEGIN + PROMPT 1 1 "Anno liquidazione " + FLAGS "A" + VALIDATE FIXLEN_FUNC 4 + CHECKTYPE REQUIRED +END NUMBER F_CODDITTA 5 BEGIN - PROMPT 1 1 "Codice ditta " + PROMPT 1 2 "Ditta " FLAGS "B" - HELP "Codice della ditta da attivare" END -STRING F_RAGSOC 50 30 +STRING F_RAGSOC 50 BEGIN - PROMPT 25 1 "Rag. soc. " + PROMPT 16 2 "" FLAGS "B" - HELP "Ragione sociale della ditta da selezionare" -END - -NUMBER F_YEAR 4 -BEGIN - PROMPT 1 2 "Anno liquidazione " - FLAGS "A" - VALIDATE FIXLEN_FUNC 4 - CHECKTYPE REQUIRED END BUTTON DLG_OK 10 2 diff --git a/cg/cg4a00.cpp b/cg/cg4a00.cpp index 9d7fa1d8c..7e2b4a96f 100755 --- a/cg/cg4a00.cpp +++ b/cg/cg4a00.cpp @@ -49,17 +49,16 @@ bool cau_filter2 (const TRelation *r) { bool rt = FALSE; const TRectype& rec = r->curr(LF_CAUSALI); - - if (rec.get(CAU_TIPODOC) == "FV") // Solo i tipi documento Fatture Vendita + const TString& tipo = rec.get(CAU_TIPODOC); + if (tipo == "FV" || tipo == "NC") // Solo i tipi documento Fatture Vendita { TTable& reg = (TTable&) r->lfile("REG"); TString16 cod; - cod << __anno; cod << rec.get(CAU_REG); reg.put("CODTAB", cod); - if (reg.read() == NOERR ) - rt = ! reg.get_bool("B1"); + if (reg.read() == NOERR) + rt = !reg.get_bool("B1"); } return rt; @@ -235,28 +234,24 @@ bool TGestAutoTrasp_mask::on_field_event(TOperable_field& o, TField_event e, lon if (e == fe_close) // Controllo sulla presenza dei codici causale nello spreadsheet { TSheet_field& sf = sfield(F_SHEET_CAUSALI); - TString16 c; - bool error = FALSE; - + bool error = TRUE; for (int i=0; i < sf.items(); i++) { TToken_string& tt = sf.row(i); - c = tt.get(F_CAUDEF - F_CAUMOV); - if (c.empty()) + const TString16 c = tt.get(F_CAUDEF - F_CAUMOV); + if (!c.blank()) { - error = TRUE; + error = FALSE; break; } } - - if (sf.items() == 0) - error = TRUE; - if (error) + { if (sf.items() == 0) - error_box("E' necessario indicare tutte le causali definitive per ogni causale del movimento in sospensione."); - else error_box("Non vi sono movimenti in sospensione da stornare nel periodo indicato."); + else + error_box("E' necessario indicare almeno una causale definitiva."); + } return !error; } @@ -377,7 +372,13 @@ void TGestAutoTrasp_mask::write_movs() // Scorre i movimenti selezionati sul registro in sospensione for (*_cur = 0L; _cur->pos() < cur_items && err == NOERR; ++(*_cur)) { - pi.addstatus(1L); + pi.addstatus(1); + + const TString16 cod_caus = curr_rec.get(MOV_CODCAUS); + const TString16 cod_caus_def = (TString&)_caudef[cod_caus]; + if (cod_caus_def.blank()) + continue; + mpn_sosp_rec = curr_rec; if (mpn_sosp.read(_isequal) == NOERR) { diff --git a/cg/cg4a00a.uml b/cg/cg4a00a.uml index 3b25cbe7d..7694f71b9 100755 --- a/cg/cg4a00a.uml +++ b/cg/cg4a00a.uml @@ -170,7 +170,7 @@ BEGIN OUTPUT F_DESCAUDEF DESCR[1,15] OUTPUT F_CAUDEFREG REG CHECKTYPE NORMAL - WARNING "La causale definitiva è obbligatoria" + WARNING "La causale definitiva e' obbligatoria" END STRING F_DESCAUDEF 15 @@ -191,12 +191,12 @@ BEGIN FLAGS "D" END -BUTTON DLG_OK 9 2 +BUTTON DLG_OK 10 2 BEGIN PROMPT -12 -1 "" END -BUTTON DLG_CANCEL 9 2 +BUTTON DLG_CANCEL 10 2 BEGIN PROMPT -22 -1 "" END diff --git a/cg/cg5300.cpp b/cg/cg5300.cpp index e2b10e241..10ec1cac0 100755 --- a/cg/cg5300.cpp +++ b/cg/cg5300.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include "cg5.h" @@ -273,11 +273,7 @@ void TParaliq_app::init_array(TMask& m, bool update) if (update) { sf.force_update(); - - TString16 freq; - _ditte->put(NDT_CODDITTA, newditta); - if (_ditte->read() == NOERR) - freq = _ditte->get(NDT_FREQVIVA); + TString16 freq = cache().get(LF_NDITTE,newditta).get(NDT_FREQVIVA); m.set(F_FREQ_VERS, freq); } } diff --git a/cg/cg5300a.uml b/cg/cg5300a.uml index a42c3a2f6..57e35d26f 100755 --- a/cg/cg5300a.uml +++ b/cg/cg5300a.uml @@ -73,13 +73,13 @@ BEGIN PROMPT 4 5 "Frequenza versamenti " HELP "Indicare la frequenza dei versamenti delle liquidazioni IVA" ITEM "M|Mensile" MESSAGE ENABLE,F_GELIDI - ITEM "T|Trimestrale" MESSAGE CLEAR,F_GELIDI + ITEM "T|Trimestrale" MESSAGE CLEAR,F_GELIDI FIELD S7 END BOOLEAN F_GELIDI BEGIN - PROMPT 45 5 "Liquidazione differita " + PROMPT 47 5 "Liquidazione differita " FIELD B1 END @@ -88,13 +88,12 @@ BEGIN PROMPT 4 6 "Credito di costo " HELP "Eventuale credito di costo dell'anno precedente" FIELD R5 - FLAGS "R" DRIVENBY F_CODVAL END BOOLEAN F_AGRMIN BEGIN - PROMPT 45 6 "Agricoltore minimo " + PROMPT 47 6 "Agricoltore minimo " FIELD B2 END @@ -111,7 +110,6 @@ BEGIN PROMPT 4 8 "Credito compensabile inizio anno " HELP "Eventuale credito di imposta dell'anno precedente" FIELD R0 - FLAGS "R" DRIVENBY F_CODVAL END @@ -119,7 +117,6 @@ CURRENCY F_CRED_RES 18 BEGIN PROMPT 4 9 "Credito in compensaz.utilizzato " FIELD R15 - FLAGS "R" DRIVENBY F_CODVAL NUM_EXPR #THIS<=#F_CRED_PREC WARNING "L'importo non puo' essere maggiore del Credito Precedente" @@ -127,7 +124,7 @@ END LISTBOX F_MESE_RES_AL 14 BEGIN - PROMPT 54 9 "A " + PROMPT 57 9 "A " ITEM "0|" FIELD I0 END diff --git a/cg/cg5400.cpp b/cg/cg5400.cpp index 73d16642b..ffe2883ee 100755 --- a/cg/cg5400.cpp +++ b/cg/cg5400.cpp @@ -4,22 +4,20 @@ #include #include #include -#include -#include #include #include "cg5.h" #include "cg5400.h" -class TRipristina_stampa : public TApplication +class TRipristina_stampa : public TSkeleton_application { enum TOperation { restore_reg, restore_inl }; TOperation _op; protected: // TApplication virtual bool create() ; - virtual bool menu(MENU_TAG); + virtual void main_loop(); public: void azzera_lim(int year, int month) const; @@ -33,8 +31,9 @@ public: // Azzera flag di stampato della liquidazione mensile dal mese dato in poi void TRipristina_stampa::azzera_lim(int year, int month) const { - TTable lim("LIM"); // Azzera i flag di stampa liquidazione - lim.put("CODTAB", format("%04d%02d", year, month)); + TTable lim("LIM"); // Azzera i flag di stampa liquidazione + TString16 cod; cod.format("%04d%02d", year, month); + lim.put("CODTAB", cod); for (int err = lim.read(_isgteq); err == NOERR; err = lim.next()) { if (atoi(lim.get("CODTAB").left(4)) != year) break; @@ -106,7 +105,8 @@ bool TRipristina_stampa::reg_restore(const TString& regist, cursor = 0L; const long nitems = cursor.items(); - TProgind p(nitems ? nitems : 1, format("Ripristino stampa del registro %s", (const char*)regist) , TRUE, TRUE, 70); + TString msg; msg.format("Ripristino stampa del registro %s", (const char*)regist); + TProgind p(nitems ? nitems : 1, msg , TRUE, TRUE); if (giornale) { @@ -137,7 +137,7 @@ bool TRipristina_stampa::reg_restore(const TString& regist, reg.put("I4", (long)mese); // Ultimo mese di stampa liquidazione if (reg.get_int("I8") >= mese) reg.zero("I8"); // Mese di ultima stampa credito precedente - // azzera_lim(year, mese+1); + // azzera_lim(year, mese+1); } } else @@ -147,7 +147,7 @@ bool TRipristina_stampa::reg_restore(const TString& regist, { reg.zero("I4"); reg.zero("I8"); - // azzera_lim(year, 1); + // azzera_lim(year, 1); } } @@ -190,8 +190,9 @@ bool TRipristina_stampa::inl_restore(const TString& lib, int year, int month) if (ok) // Se e' stato ripristinato almeno un indice e non ci sono stati errori { - TTable lbu("%LBU"); - lbu.put("CODTAB", format("%4d%s", year, (const char*)lib)); + TTable lbu("%LBU"); + TString16 cod; cod.format("%4d%s", year, (const char*)lib); + lbu.put("CODTAB", cod); ok = lbu.read() == NOERR; if (ok) { @@ -208,17 +209,13 @@ bool TRipristina_stampa::inl_restore(const TString& lib, int year, int month) bool TRipristina_stampa::create() { - TApplication::create(); - if (argc() > 2 && stricmp(argv(2), "INL") == 0) _op = restore_inl; - - dispatch_e_menu(BAR_ITEM(1)); - return TRUE; + return TSkeleton_application::create(); } -bool TRipristina_stampa::menu(MENU_TAG) +void TRipristina_stampa::main_loop() { TMask msk(_op == restore_inl ? "cg5400b" : "cg5400a") ; @@ -268,7 +265,6 @@ bool TRipristina_stampa::menu(MENU_TAG) else error_box("Gli archivi della ditta %ld non sono stati ancora generati", firm); msk.reset(); } - return FALSE; } int cg5400(int argc, char* argv[]) diff --git a/cg/cg5400a.uml b/cg/cg5400a.uml index bc0a85419..61fbfa597 100755 --- a/cg/cg5400a.uml +++ b/cg/cg5400a.uml @@ -49,7 +49,7 @@ BEGIN INPUT CODTAB[5,7] F_REG DISPLAY "Anno" CODTAB[1,4] DISPLAY "Codice" CODTAB[5,7] - DISPLAY "Descrizione @50" S0 + DISPLAY "Descrizione@50" S0 DISPLAY "Tipo" I0 OUTPUT F_YEAR CODTAB[1,4] OUTPUT F_REG CODTAB[5,7] @@ -78,10 +78,10 @@ END LIST F_TIPO 15 BEGIN FLAGS "HG" - ITEM "1|Vendite" MESSAGE SHOW,F_YEAR|HIDE,F_DAY - ITEM "2|Vendite" MESSAGE SHOW,F_YEAR|HIDE,F_DAY - ITEM "3|Riepilogativo" MESSAGE SHOW,F_YEAR|HIDE,F_DAY - ITEM "5|Giornale" MESSAGE HIDE,F_YEAR|SHOW,F_DAY + ITEM "1|Vendite" MESSAGE HIDE,F_DAY + ITEM "2|Vendite" MESSAGE HIDE,F_DAY + ITEM "3|Riepilogativo" MESSAGE HIDE,F_DAY + ITEM "5|Giornale" MESSAGE SHOW,F_DAY END NUMBER F_DAY 2 diff --git a/cg/cg5500.cpp b/cg/cg5500.cpp index 2be92672e..026188dc1 100755 --- a/cg/cg5500.cpp +++ b/cg/cg5500.cpp @@ -234,12 +234,16 @@ void Visliq_app::set_mask_freq(TMask& m) bool Visliq_app::sheet_action(TSheet_field& s, int r, KEY k) { + if (k == K_ENTER) + app()._sh_dirty = TRUE; // non si possono cancellare o aggiungere righe return (k != K_DEL && k != K_INS); } bool Visliq_app::vers_action(TSheet_field& s, int r, KEY k) { + if (k == K_ENTER) + app()._sv_dirty = TRUE; // non si possono cancellare o aggiungere righe return (k != K_DEL && k != K_INS); } @@ -259,7 +263,7 @@ const char* Visliq_app::link_handler(TMask& m, { group = -1; firstfoc = F_RIMBORSO; } else if (st.find("debito") >= 0 || st.find("credito") >= 0) { group = -2; firstfoc = F_RETTIFICA; } - else if (st.find("acconto") >= 0) + else if (st.find("cconto") >= 0) { group = -3; firstfoc = F_ACCONTO; } else if (st.find("Versamenti") >= 0) { group = -4; firstfoc = F_DELDATE; } @@ -273,7 +277,7 @@ const char* Visliq_app::link_handler(TMask& m, { group = -8; firstfoc = F_CREDSPEC; } m.show(group); - if (app()._is_annual && group != -4) + if (app()._is_annual && (group != -3 || app()._freqviva == "M")) m.disable(group); else { @@ -379,7 +383,9 @@ bool Visliq_app::sel_mese_sh1 (TMask_field& f, KEY k) if (sh.items() == 4) month *= 3; bool ok = FALSE; - if (m.dirty() || sh.sheet_mask().dirty()) + + //if (m.dirty() || sh.sheet_mask().dirty()) + if (m.field(F_CREDPREC).dirty() || app()._sh_dirty || app()._sv_dirty) { KEY k = yesnocancel_box("Registrazione modifiche effettuate?"); if (k == K_YES) @@ -446,7 +452,8 @@ bool Visliq_app::sel_mese_sh2 (TMask_field& f, KEY k) if (month > 12) return TRUE; bool ok = FALSE; - if (m.dirty()) + //if (m.dirty()) + if (m.field(F_CREDPREC).dirty() || app()._sh_dirty || app()._sv_dirty) { KEY k = yesnocancel_box("Registrazione modifiche effettuate?"); if (k == K_YES) @@ -670,7 +677,10 @@ bool Visliq_app::vis_one(int m) real acconto(0.0); if (m == 12 && look_del(12,7)) - acconto = _del->get_real("R0"); + acconto = _del->get_real("R0"); else + if (m == 13) + acconto = _lim->get_real("R11"); + msk.field(F_YEAR).set(nomem); msk.set(F_RIMBORSO, rimborso); @@ -1603,8 +1613,8 @@ void Visliq_app::read_general(TMask& m) _liq_rows = sh.rows_array(); m.field(F_CREDPREC).set_dirty(FALSE); - m.field(F_VISLIQ1).set_dirty(FALSE); - m.field(F_VISLIQ2).set_dirty(FALSE); + m.field(F_VISLIQ1).set_dirty(_sh_dirty=FALSE); + m.field(F_VISLIQ2).set_dirty(_sv_dirty=FALSE); } @@ -1653,13 +1663,6 @@ void Visliq_app::write_general(TMask& m) // risolve menata del dettaglio si'/no if (lfrommask) { -/* - tt_ln.add(shm.get(102),1); - tt_ln.add(shm.get(103),2); - tt_ln.add(shm.get(104),3); - tt_ln.add(shm.get(105),4); - tt_ln.add(shm.get(106),5); -*/ for (int i = 1; i <= 9; i++) tt_ln.add(shm.get(101+i),i); } @@ -1670,13 +1673,6 @@ void Visliq_app::write_general(TMask& m) if (vfrommask) { -/* - tt_vn.add(svm.get(102),1); - tt_vn.add(svm.get(103),2); - tt_vn.add(svm.get(104),3); - tt_vn.add(svm.get(105),4); - tt_vn.add(svm.get(106),5); -*/ for (int i = 1; i <= 5; i++) tt_vn.add(svm.get(101+i),i); } @@ -1951,8 +1947,8 @@ void Visliq_app::write_general(TMask& m) // m.dirty() deve ritornare FALSE m.field(F_CREDPREC).set_dirty(FALSE); - m.field(F_VISLIQ1).set_dirty(FALSE); - m.field(F_VISLIQ2).set_dirty(FALSE); + m.field(F_VISLIQ1).set_dirty(_sh_dirty=FALSE); + m.field(F_VISLIQ2).set_dirty(_sv_dirty=FALSE); } diff --git a/cg/cg5500.h b/cg/cg5500.h index ec6f8cd73..a50f25300 100755 --- a/cg/cg5500.h +++ b/cg/cg5500.h @@ -41,6 +41,7 @@ class Visliq_app : public TSkeleton_application TMask* _mask; bool _from_one; bool _is_annual; + bool _sh_dirty, _sv_dirty; const char* itoname(int m); diff --git a/cg/cg5500a.h b/cg/cg5500a.h index 592c40424..cccaa55ee 100755 --- a/cg/cg5500a.h +++ b/cg/cg5500a.h @@ -1,10 +1,10 @@ #define F_CODDITTA 151 #define F_RAGSOC 152 -#define F_MONTHS 103 -#define F_TRIMS 104 -#define F_YEAR 105 -#define F_VISLIQ1 106 -#define F_VISLIQ2 107 +#define F_MONTHS 153 +#define F_TRIMS 154 +#define F_YEAR 155 +#define F_VISLIQ1 156 +#define F_VISLIQ2 157 #define F_CREDPREC 158 #define F_VISFLQ 109 #define F_ACCONTO 110 diff --git a/cg/cg5500b.uml b/cg/cg5500b.uml index 2dd7dad7e..17c2b1226 100755 --- a/cg/cg5500b.uml +++ b/cg/cg5500b.uml @@ -50,7 +50,6 @@ END CURRENCY F_CREDPREC 15 BEGIN PROMPT 1 5 "Credito compensabile inizio anno " - PICTURE "." END SPREADSHEET F_VISLIQ1 78 diff --git a/cg/cg5500c.uml b/cg/cg5500c.uml index cf2bcce7f..3e3ddccf4 100755 --- a/cg/cg5500c.uml +++ b/cg/cg5500c.uml @@ -23,7 +23,7 @@ END ENDPAGE -PAGE "Visualizzazione liquidazione" -1 -1 77 20 +PAGE "Liquidazione" -1 -1 77 20 GROUPBOX DLG_NULL 79 3 BEGIN @@ -49,7 +49,6 @@ END CURRENCY F_CREDPREC 15 BEGIN PROMPT 1 4 "Credito compensabile inizio anno " - FLAGS "R" END SPREADSHEET F_VISLIQ1 78 5 diff --git a/cg/cg5700.cpp b/cg/cg5700.cpp index 6f2d7ecde..4c4cb39be 100755 --- a/cg/cg5700.cpp +++ b/cg/cg5700.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -15,7 +16,7 @@ class TDich_periodica_selfirm_mask : public TAutomask { TArray_sheet * _ditte; TString_array _nomiditte; - TString16 _freq; + char _freq; int _year; protected: @@ -24,9 +25,9 @@ protected: void build_ditte_sheet(); void set_mask_freq(); public: - const TString& get_freq() const { return _freq;} - const int get_year() const { return _year;} - const int get_period() const { return atoi(get(_freq == "M" ? F_MONTHS : F_TRIMS)); } + const char get_freq() const { return _freq; } + const int get_year() const { return _year; } + const int get_period() const { return atoi(get(_freq == 'M' ? F_MONTHS : F_TRIMS)); } virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); TDich_periodica_selfirm_mask(); virtual ~TDich_periodica_selfirm_mask(); @@ -39,7 +40,7 @@ TDich_periodica_selfirm_mask::TDich_periodica_selfirm_mask() : TAutomask("cg5700 TDate oggi(TODAY); _year = oggi.year(); - _freq = "M"; + _freq = 'M'; set_mask_freq(); @@ -54,7 +55,7 @@ TDich_periodica_selfirm_mask::~TDich_periodica_selfirm_mask() void TDich_periodica_selfirm_mask::build_nomiditte() { - TString fr(2); + TString fr, cod; TLocalisamfile dt(LF_NDITTE); TTable lia("%LIA"); @@ -62,27 +63,29 @@ void TDich_periodica_selfirm_mask::build_nomiditte() for (dt.first(); !dt.eof(); dt.next()) { - fr = "??"; - bool good = prefix().exist(dt.get_long("CODDITTA")); + const long codditta = dt.get_long("CODDITTA"); + bool good = prefix().exist(codditta); if (good) { - TString16 cod; cod.format("%05ld%d", dt.get_long("CODDITTA"),_year); + cod.format("%05ld%d", codditta, _year); lia.put("CODTAB", cod); if (lia.read() != NOERR) + { + fr = "??"; good = FALSE; + } else fr = lia.get("S7"); - } - else continue; - TToken_string* d = new TToken_string(64); - - d->add(dt.get("CODDITTA")); - d->add(dt.get("RAGSOC")); - d->add(fr); - - _nomiditte.add(d); + TToken_string* d = new TToken_string(64); + + d->add(codditta); + d->add(dt.get("RAGSOC")); + d->add(fr); + + _nomiditte.add(d); + } } } @@ -105,7 +108,7 @@ void TDich_periodica_selfirm_mask::build_ditte_sheet() void TDich_periodica_selfirm_mask::set_mask_freq() { - if (_freq == "M") + if (_freq == 'M') { show(F_MONTHS); hide(F_TRIMS); @@ -124,7 +127,7 @@ bool TDich_periodica_selfirm_mask::select_button() TToken_string& row = _ditte->row(_ditte->selected()); set(F_CODDITTA, row.get(0)); set(F_RAGSOC, row.get(1)); - _freq = row.get(2); + _freq = row.get_char(2); set_mask_freq(); return TRUE; } @@ -152,7 +155,7 @@ bool TDich_periodica_selfirm_mask::on_field_event(TOperable_field& o, TField_eve { set(F_CODDITTA, row.get(0)); set(F_RAGSOC, row.get(1)); - _freq = row.get(2); + _freq = row.get_char(2); set_mask_freq(); found = TRUE; } @@ -187,7 +190,7 @@ bool TDich_periodica_selfirm_mask::on_field_event(TOperable_field& o, TField_eve { set(F_CODDITTA, row.get(0)); set(F_RAGSOC, row.get(1)); - _freq = row.get(2); + _freq = row.get_char(2); set_mask_freq(); found = TRUE; break; @@ -224,7 +227,7 @@ protected: void search_versament(); void write_versament(); void read_iva_data(); - + public: void set_prospect(); void print_prospect(); @@ -234,7 +237,8 @@ public: virtual ~TDich_periodica_iva_mask() {}; }; -TDich_periodica_iva_mask::TDich_periodica_iva_mask(TDich_periodica_selfirm_mask *m) : TAutomask("cg5700b") +TDich_periodica_iva_mask::TDich_periodica_iva_mask(TDich_periodica_selfirm_mask *m) + : TAutomask("cg5700b") { _sf = m; } @@ -249,12 +253,12 @@ void TDich_periodica_iva_mask::search_versament() // Se esiste il versamento la visualizza, mantenendola disabilitata (eventuale SHIFT+F12) if (del.read() == NOERR) { - set(F_VP12_IMPORTO, del.get_real("R0")); - set(F_VP12_DATA, del.get_date("D0")); - set(F_VP12_ABI, del.get("S7")); - set(F_VP12_CAB, del.get("S8")); - set(F_VP12_CONCESSIONE, del.get("S9")); - set(F_VP12_STAMPATO, del.get_bool("B0")); + set(F_VP17_IMPORTO, del.get_real("R0")); + set(F_VP17_DATA, del.get_date("D0")); + set(F_VP17_ABI, del.get("S7")); + set(F_VP17_CAB, del.get("S8")); + set(F_VP17_CONCESSIONE, del.get("S9")); + set(F_VP17_STAMPATO, del.get_bool("B0")); } else enable(-G_VP12); @@ -270,11 +274,11 @@ void TDich_periodica_iva_mask::write_versament() const bool good = del.read() == NOERR; - del.put("R0", get(F_VP12_IMPORTO)); - del.put("D0", get(F_VP12_DATA)); - del.put("S7", get(F_VP12_ABI)); - del.put("S8", get(F_VP12_CAB)); - del.put("S9", get(F_VP12_CONCESSIONE)); + del.put("R0", get(F_VP17_IMPORTO)); + del.put("D0", get(F_VP17_DATA)); + del.put("S7", get(F_VP17_ABI)); + del.put("S8", get(F_VP17_CAB)); + del.put("S9", get(F_VP17_CONCESSIONE)); del.put("B0", TRUE); if (good) @@ -299,72 +303,101 @@ void TDich_periodica_iva_mask::read_iva_data() { lam.read(); - TString descrizione(lim.get("S0")); + TString descrizione(120); + descrizione = lim.get("S0"); descrizione << lim.get("S1"); const bool exclude_sign = descrizione.find("$$") >= 0 || descrizione.find(">>") >= 0; - real vp1 = ZERO; - real vp2 = ZERO; - real vp3 = ZERO; - real vp4 = ZERO; + real vp1 = ZERO; + real vp1a = ZERO; + real vp2 = ZERO; + real vp2a = ZERO; + real vp3 = ZERO; + real vp3i = ZERO; TTable pum("PUM"); key.format("%4d",_sf->get_year()); pum.put("CODTAB", key); + + const char f = _sf->get_freq(); + const int p = _sf->get_period(); - for (pum.first(); !pum.eof(); pum.next()) + for (int err = pum.read(_isgteq); err == NOERR; err = pum.next()) { key = pum.get("CODTAB"); const int anno = atoi(key.mid(0,4)); const int perd = atoi(key.mid(10,2)); - if (anno != _sf->get_year() || perd != _sf->get_period()) - continue; - vp1 += pum.get_real("R14"); - vp2 += pum.get_real("R15"); - vp3 += pum.get_real("R16"); - vp4 += pum.get_real("R17"); + if (anno != _sf->get_year()) + break; + + if (f == 'M') + { + if (perd != p) + continue; + } + else + { + if (perd < p-2 || perd > p) + continue; + } + + vp1 += pum.get_real("R14"); + vp1a += pum.get_real("R15"); + vp2 += pum.get_real("R16"); + vp2a += pum.get_real("R17"); + vp3 += pum.get_real("R18"); + vp3i += pum.get_real("R19"); } // Se espressi in lire o una valuta con 0 decimali, arrotonda alle 1000 TCurrency cur(vp1, get(F_CODVAL)); const int ndec = cur.decimals() == 0 ? -3 : cur.decimals(); - real rettifica = lim.get_real("R5"); + vp1.round(ndec); vp1a.round(ndec); vp2.round(ndec); vp2a.round(ndec); + vp3.round(ndec); vp3i.round(ndec); + + real rettifica = lim.get_real("R5"); // Rettifiche - real vp5 = lam.get_real("R0"); + real vp5 = lam.get_real("R0"); // Iva esigibile per il periodo if (rettifica > ZERO) vp5 += rettifica; - real vp6 = lam.get_real("R1"); + real vp6 = lam.get_real("R1"); // Iva che si detrae per il periodo if (rettifica < ZERO && !exclude_sign) vp6 += abs(rettifica); - - real vp7 = lam.get_real("R2") + lim.get_real("R1"); - - real vp8 = ZERO; - if (rettifica < ZERO && exclude_sign) - vp8 = abs(rettifica); - - real vp9 = lim.get_real("R14"); - - vp1.round(ndec); vp2.round(ndec); vp3.round(ndec); vp4.round(ndec); - vp5.round(ndec); vp6.round(ndec); vp7.round(ndec); vp8.round(ndec); - vp9.round(ndec); - - // I seguenti vengono giusti ed arrotondati bene di conseguenza - real vp10 = vp5 - (vp6+vp7+vp8) + vp9; - real vp11 = (vp6+vp7) - vp5; - - if (vp10 < ZERO) - vp10 = ZERO; - - if (vp11 < ZERO) - vp11 = ZERO; - set(F_VP1, vp1);set(F_VP2, vp2);set(F_VP3, vp3);set(F_VP4, vp4); - set(F_VP5, vp5);set(F_VP6, vp6);set(F_VP7, vp7);set(F_VP8, vp8); - set(F_VP9, vp9);set(F_VP10, vp10);set(F_VP11, vp11); + real vp7 = vp5 - vp6; // IVA a debito o credito per il periodo + real vp8 = lim.get("R17"); // Variazioni d'imposta periodi precedenti + real vp9 = lim.get("R18"); // IVA non versata da dichiarazioni precedenti + real vp10 = lam.get_real("R3") - lam.get_real("R2") + lim.get_real("R1"); // Debito o credito precedente + real vp11 = lim.get("R15"); // Credito IVA compensabile + real vp12 = lim.get_real("R0") + lim.get_real("R19") + lim.get_real("R11") + lim.get_real("R9"); + real vp13 = lim.get("R19"); // Crediti speciali + real vp14 = lim.get("R14"); // Interessi dovuti per liquidazione trimestrale + real vp15 = ZERO; + if (_sf->get_period() == 12) // Gli acconti ci sono solo a Dicembre + { + if (f == 'T') + { + // Chiave delle deleghe: DITTA|ANNO|MESE=12|TIPO=7 + key.format("%05ld%04d127", _sf->get_long(F_CODDITTA), _sf->get_year()); + const TRectype& delega = cache().get("%DEL", key); + if (delega.get_bool("B0")) // Se delega acconto stampata + vp15 = delega.get_real("R0"); + } + else + vp15 = lim.get_real("R11"); // Acconto versato + } + + real vp16 = lim.get_real("R0") + lim.get_real("R14"); // Importo da versare + if (vp16 < ZERO) vp16 = ZERO; + + set(F_VP1, vp1); set(F_VP1A, vp1a); set(F_VP2, vp2); set(F_VP2A, vp2a); + set(F_VP3, vp3); set(F_VP3I, vp3i); + set(F_VP5, vp5); set(F_VP6, vp6); set(F_VP7, vp7); + set(F_VP8, vp8); set(F_VP9, vp9); set(F_VP10, vp10); set(F_VP11, vp11); + set(F_VP12, vp12); set(F_VP13, vp13); set(F_VP14, vp14); set(F_VP15, vp15); set(F_VP16, vp16); } else error_box("Risultati liquidazione non presenti o da ricalcolare per il periodo richiesto."); @@ -379,7 +412,7 @@ void TDich_periodica_iva_mask::print_prospect() frm.find_field('B', odd_page, FF_CODVAL).set(get(F_CODVAL)); frm.find_field('B', odd_page, FF_YEAR).set(get(F_YEAR)); - const bool mens = _sf->get_freq() == "M"; + const bool mens = _sf->get_freq() == 'M'; TForm_item& sf1 = frm.find_field('B', odd_page, FF_MONTHS); TForm_item& sf2 = frm.find_field('B', odd_page, FF_TRIMS); @@ -389,11 +422,12 @@ void TDich_periodica_iva_mask::print_prospect() sf1.show(mens); sf2.show(!mens); - frm.find_field('B', odd_page, FF_IMPORTI).set(_is_euro ? "1" : " "); frm.find_field('B', odd_page, FF_VP1).set(get(F_VP1)); + frm.find_field('B', odd_page, FF_VP1A).set(get(F_VP1A)); frm.find_field('B', odd_page, FF_VP2).set(get(F_VP2)); + frm.find_field('B', odd_page, FF_VP2A).set(get(F_VP2A)); frm.find_field('B', odd_page, FF_VP3).set(get(F_VP3)); - frm.find_field('B', odd_page, FF_VP4).set(get(F_VP4)); + frm.find_field('B', odd_page, FF_VP3I).set(get(F_VP3I)); frm.find_field('B', odd_page, FF_VP5).set(get(F_VP5)); frm.find_field('B', odd_page, FF_VP6).set(get(F_VP6)); frm.find_field('B', odd_page, FF_VP7).set(get(F_VP7)); @@ -401,19 +435,24 @@ void TDich_periodica_iva_mask::print_prospect() frm.find_field('B', odd_page, FF_VP9).set(get(F_VP9)); frm.find_field('B', odd_page, FF_VP10).set(get(F_VP10)); frm.find_field('B', odd_page, FF_VP11).set(get(F_VP11)); + frm.find_field('B', odd_page, FF_VP12).set(get(F_VP12)); + frm.find_field('B', odd_page, FF_VP13).set(get(F_VP13)); + frm.find_field('B', odd_page, FF_VP14).set(get(F_VP14)); + frm.find_field('B', odd_page, FF_VP15).set(get(F_VP15)); + frm.find_field('B', odd_page, FF_VP16).set(get(F_VP16)); // Se è stato creato il versamento ora o se è stato giò stampato // allora lo stampa, altrimenti lo nasconde. - const bool b = _dirty_versament || get_bool(F_VP12_STAMPATO); - frm.find_field('B', odd_page, FF_VP12_STAMPATO).set(b ? "X" : " "); //Mostra nasconde il gruppo 12 + const bool b = _dirty_versament || get_bool(F_VP17_STAMPATO); + frm.find_field('B', odd_page, FF_VP17_STAMPATO).set(b ? "X" : " "); //Mostra nasconde il gruppo 17 if (b) { - frm.find_field('B', odd_page, FF_VP12_IMPORTO).set(get(F_VP12_IMPORTO)); - frm.find_field('B', odd_page, FF_VP12_DATA).set(get(F_VP12_DATA)); - frm.find_field('B', odd_page, FF_VP12_CONCESSIONE).set(get(F_VP12_CONCESSIONE)); - frm.find_field('B', odd_page, FF_VP12_ABI).set(get(F_VP12_ABI)); - frm.find_field('B', odd_page, FF_VP12_CAB).set(get(F_VP12_CAB)); + frm.find_field('B', odd_page, FF_VP17_IMPORTO).set(get(F_VP17_IMPORTO)); + frm.find_field('B', odd_page, FF_VP17_DATA).set(get(F_VP17_DATA)); + frm.find_field('B', odd_page, FF_VP17_CONCESSIONE).set(get(F_VP17_CONCESSIONE)); + frm.find_field('B', odd_page, FF_VP17_ABI).set(get(F_VP17_ABI)); + frm.find_field('B', odd_page, FF_VP17_CAB).set(get(F_VP17_CAB)); } TRectype f(LF_NDITTE); @@ -434,10 +473,9 @@ void TDich_periodica_iva_mask::set_prospect() set(F_CODDITTA, _sf->get(F_CODDITTA)); set(F_RAGSOC, _sf->get(F_RAGSOC)); - const TString& f = _sf->get_freq(); - - show(F_MONTHS, f == "M"); - show(F_TRIMS, f == "T"); + const char f = _sf->get_freq(); + show(F_MONTHS, f == 'M'); + show(F_TRIMS, f == 'T'); set(F_MONTHS, _sf->get(F_MONTHS)); set(F_TRIMS, _sf->get(F_TRIMS)); @@ -466,14 +504,14 @@ bool TDich_periodica_iva_mask::on_field_event(TOperable_field& o, TField_event e { switch (o.dlg()) { - case F_VP12_DATA: - case F_VP12_CONCESSIONE: - case F_VP12_ABI: - case F_VP12_CAB: + case F_VP17_DATA: + case F_VP17_CONCESSIONE: + case F_VP17_ABI: + case F_VP17_CAB: if (e == fe_modify) _dirty_versament = TRUE; break; - case F_VP12_IMPORTO: + case F_VP17_IMPORTO: if (e == fe_modify) { _dirty_versament = TRUE; @@ -513,7 +551,7 @@ bool TDich_periodica_iva_app::create() { _m1 = new TDich_periodica_selfirm_mask(); _m2 = new TDich_periodica_iva_mask(_m1); - open_files(LF_NDITTE, 0); + open_files(LF_TAB, LF_TABCOM, LF_NDITTE, 0); return TSkeleton_application::create(); } diff --git a/cg/cg5700.h b/cg/cg5700.h index 523d38859..48e2d6700 100755 --- a/cg/cg5700.h +++ b/cg/cg5700.h @@ -5,22 +5,29 @@ #define F_TRIMS 105 #define F_CODVAL 106 #define F_VP1 107 -#define F_VP2 108 -#define F_VP3 109 -#define F_VP4 110 -#define F_VP5 111 -#define F_VP6 112 -#define F_VP7 113 -#define F_VP8 114 -#define F_VP9 115 -#define F_VP10 116 -#define F_VP11 117 -#define F_VP12_DATA 118 -#define F_VP12_IMPORTO 119 -#define F_VP12_ABI 120 -#define F_VP12_CAB 121 -#define F_VP12_CONCESSIONE 122 -#define F_VP12_STAMPATO 123 +#define F_VP1A 108 +#define F_VP2 109 +#define F_VP2A 110 +#define F_VP3 111 +#define F_VP3I 112 +#define F_VP5 121 +#define F_VP6 122 +#define F_VP7 123 +#define F_VP8 124 +#define F_VP9 125 +#define F_VP10 126 +#define F_VP11 127 +#define F_VP12 128 +#define F_VP13 129 +#define F_VP14 130 +#define F_VP15 131 +#define F_VP16 132 +#define F_VP17_DATA 140 +#define F_VP17_IMPORTO 141 +#define F_VP17_ABI 142 +#define F_VP17_CAB 143 +#define F_VP17_CONCESSIONE 144 +#define F_VP17_STAMPATO 145 #define G_VP12 1 @@ -30,26 +37,34 @@ #define FF_MONTHS 104 #define FF_TRIMS 105 #define FF_CODVAL 106 + #define FF_VP1 107 -#define FF_VP2 108 -#define FF_VP3 109 -#define FF_VP4 110 -#define FF_VP5 111 -#define FF_VP6 112 -#define FF_VP7 113 -#define FF_VP8 114 -#define FF_VP9 115 -#define FF_VP10 116 -#define FF_VP11 117 -#define FF_VP12_DATA 118 -#define FF_VP12_IMPORTO 119 -#define FF_VP12_ABI 120 -#define FF_VP12_CAB 121 -#define FF_VP12_CONCESSIONE 122 -#define FF_VP12_STAMPATO 123 -#define FF_COFI 124 -#define FF_PAIVA 125 -#define FF_IMPORTI 126 +#define FF_VP1A 108 +#define FF_VP2 109 +#define FF_VP2A 110 +#define FF_VP3 111 +#define FF_VP3I 112 +#define FF_VP5 113 +#define FF_VP6 114 +#define FF_VP7 115 +#define FF_VP8 116 +#define FF_VP9 117 +#define FF_VP10 118 +#define FF_VP11 119 +#define FF_VP12 120 +#define FF_VP13 121 +#define FF_VP14 122 +#define FF_VP15 123 +#define FF_VP16 124 +#define FF_VP17_DATA 140 +#define FF_VP17_IMPORTO 141 +#define FF_VP17_ABI 142 +#define FF_VP17_CAB 143 +#define FF_VP17_CONCESSIONE 144 +#define FF_VP17_STAMPATO 145 + +#define FF_COFI 130 +#define FF_PAIVA 131 #define GF_VP12 1 diff --git a/cg/cg5700a.frm b/cg/cg5700a.frm index 14956594b..f6b2656ea 100755 --- a/cg/cg5700a.frm +++ b/cg/cg5700a.frm @@ -39,7 +39,7 @@ BEGIN KEY "Codice ditta" PROMPT 2 3 "Ditta " FIELD LF_NDITTE->CODDITTA - PICTURE "@@@@@" + //PICTURE "@@@@@" END STRINGA FF_RAGSOC 50 @@ -116,18 +116,10 @@ BEGIN FLAGS "H" END -LISTA FF_IMPORTI 21 -BEGIN - KEY "Importi espressi in" - PROMPT 2 8 "Importi espressi in " - ITEM " |lire" - ITEM "1|euro" -END - STRINGA 5 BEGIN KEY "VP1 - Descrizione" - PROMPT 2 10 "VP1 - Ammontare complessivo delle operazioni attive" + PROMPT 2 10 "VP1 - Operazioni attive (al netto dell'IVA)" END VALUTA FF_VP1 18 @@ -139,135 +131,232 @@ END STRINGA 6 BEGIN - KEY "VP2 - Descrizione" - PROMPT 2 11 "VP2 - di cui cessioni intracomunitarie" + KEY "VP1A - Descrizione" + PROMPT 2 11 "VP1A - di cui cessioni intracomunitarie" END -VALUTA FF_VP2 18 +VALUTA FF_VP1A 18 BEGIN - KEY "VP2 - Valore" + KEY "VP1A - Valore" PROMPT 60 11 "" DRIVENBY FF_CODVAL END STRINGA 7 BEGIN - KEY "VP3 - Descrizione" - PROMPT 2 12 "VP3 - Ammontare complessivo delle operazioni passive" + KEY "VP2 - Descrizione" + PROMPT 2 12 "VP2 - Operazioni passive (al netto dell'IVA)" END -VALUTA FF_VP3 18 +VALUTA FF_VP2 18 BEGIN - KEY "VP3 - Valore" + KEY "VP2 - Valore" PROMPT 60 12 "" DRIVENBY FF_CODVAL END STRINGA 8 BEGIN - KEY "VP4 - Descrizione" - PROMPT 2 13 "VP4 - di cui acquisti intracomunitari" + KEY "VP2A - Descrizione" + PROMPT 2 13 "VP2A - di cui acquisti intracomunitari" END -VALUTA FF_VP4 18 +VALUTA FF_VP2A 18 BEGIN - KEY "VP4 - Valore" + KEY "VP2A - Valore" PROMPT 60 13 "" DRIVENBY FF_CODVAL END +STRINGA 8 +BEGIN + KEY "VP3 - Descrizione" + PROMPT 2 14 "VP3 - Importazioni di oro e argento senza IVA alla dogana" +END + +VALUTA FF_VP3 18 +BEGIN + KEY "VP3 - Valore" + PROMPT 60 14 "" + DRIVENBY FF_CODVAL +END + +STRINGA 8 +BEGIN + KEY "VP3I - Descrizione" + PROMPT 2 15 " Imposta" +END + +VALUTA FF_VP3I 18 +BEGIN + KEY "VP3 - Imposta" + PROMPT 60 15 "" + DRIVENBY FF_CODVAL +END + STRINGA 9 BEGIN KEY "VP5 - Descrizione" - PROMPT 2 14 "VP5 - Ammontare complessivo dell'IVA a debito" + PROMPT 2 16 "VP5 - IVA esigibile per il periodo " END VALUTA FF_VP5 18 BEGIN KEY "VP5 - Valore" - PROMPT 60 14 "" + PROMPT 60 16 "" DRIVENBY FF_CODVAL END STRINGA 10 BEGIN KEY "VP6 - Descrizione" - PROMPT 2 15 "VP6 - Ammontare complessivo dell'IVA che si detrae" + PROMPT 2 17 "VP6 - IVA che si detrae per il periodo" END VALUTA FF_VP6 18 BEGIN KEY "VP6 - Valore" - PROMPT 60 15 "" + PROMPT 60 17 "" DRIVENBY FF_CODVAL END STRINGA 11 BEGIN KEY "VP7 - Descrizione" - PROMPT 2 16 "VP7 - IVA a credito del periodo precedente" + PROMPT 2 18 "VP7 - IVA a debito o credito per il periodo" END VALUTA FF_VP7 18 BEGIN KEY "VP7 - Valore" - PROMPT 60 16 "" + PROMPT 60 18 "" DRIVENBY FF_CODVAL END STRINGA 12 BEGIN KEY "VP8 - Descrizione" - PROMPT 2 17 "VP8 - Crediti d'imposta utilizzati" + PROMPT 2 19 "VP8 - Variazioni d'imposta periodi precedenti" END VALUTA FF_VP8 18 BEGIN KEY "VP8 - Valore" - PROMPT 60 17 "" + PROMPT 60 19 "" DRIVENBY FF_CODVAL END STRINGA 13 BEGIN KEY "VP9 - Descrizione" - PROMPT 2 18 "VP9 - Interessi dovuti per le liquidazioni trimestrali" + PROMPT 2 20 "VP9 - Iva non versata da dichiarazioni precedenti" END VALUTA FF_VP9 18 BEGIN KEY "VP9 - Valore" - PROMPT 60 18 "" + PROMPT 60 20 "" DRIVENBY FF_CODVAL END STRINGA 14 BEGIN KEY "VP10 - Descrizione" - PROMPT 2 19 "@bVP10 - IVA da versare" + PROMPT 2 21 "VP10 - Debito o credito dal periodo precedente" END VALUTA FF_VP10 18 BEGIN KEY "VP10 - Valore" - PROMPT 60 19 "" + PROMPT 60 21 "" DRIVENBY FF_CODVAL END STRINGA 15 BEGIN KEY "VP11 - Descrizione" - PROMPT 2 20 "@bVP11 - IVA a credito" + PROMPT 2 22 "VP11 - Credito IVA compensabile" END VALUTA FF_VP11 18 BEGIN KEY "VP11 - Valore" - PROMPT 60 20 "" + PROMPT 60 22 "" DRIVENBY FF_CODVAL END -LISTA FF_VP12_STAMPATO +STRINGA 15 +BEGIN + KEY "VP12 - Descrizione" + PROMPT 2 23 "VP12 - IVA dovuta o a credito per il periodo" +END + +VALUTA FF_VP12 18 +BEGIN + KEY "VP12 - Valore" + PROMPT 60 23 "" + DRIVENBY FF_CODVAL +END + +STRINGA 15 +BEGIN + KEY "VP13 - Descrizione" + PROMPT 2 24 "VP13 - Crediti speciali d'imposta detratti" +END + +VALUTA FF_VP13 18 +BEGIN + KEY "VP13 - Valore" + PROMPT 60 24 "" + DRIVENBY FF_CODVAL +END + +STRINGA 15 +BEGIN + KEY "VP14 - Descrizione" + PROMPT 2 25 "VP14 - Interessi dovuti per liquidazioni trimestrali" +END + +VALUTA FF_VP14 18 +BEGIN + KEY "VP14 - Valore" + PROMPT 60 25 "" + DRIVENBY FF_CODVAL +END + +STRINGA 15 +BEGIN + KEY "VP15 - Descrizione" + PROMPT 2 26 "VP15 - Acconto versato" +END + +VALUTA FF_VP15 18 +BEGIN + KEY "VP15 - Valore" + PROMPT 60 26 "" + DRIVENBY FF_CODVAL +END + +STRINGA 15 +BEGIN + KEY "VP16 - Descrizione" + PROMPT 2 27 "VP16 - Importo da versare" +END + +VALUTA FF_VP16 18 +BEGIN + KEY "VP16 - Valore" + PROMPT 60 27 "" + DRIVENBY FF_CODVAL +END + +STRINGA 30 +BEGIN + KEY "VP17 - Descrizione" + PROMPT 2 29 "VP17 - Estremi del versamento" +END + +LISTA FF_VP17_STAMPATO BEGIN KEY "Stampato" PROMPT 0 0 "" @@ -276,40 +365,40 @@ BEGIN ITEM "X| " MESSAGE SHOW,GF_VP12@ END -VALUTA FF_VP12_IMPORTO 18 +VALUTA FF_VP17_IMPORTO 18 BEGIN KEY "Importo" - PROMPT 2 22 "Importo versato " + PROMPT 2 30 "Importo versato " DRIVENBY FF_CODVAL - GROUP GF_VP12 + GROUP GF_VP17 END -DATA FF_VP12_DATA +DATA FF_VP17_DATA BEGIN KEY "Data versamento" - PROMPT 40 22 "Data versamento " - GROUP GF_VP12 + PROMPT 40 30 "Data versamento " + GROUP GF_VP17 END -STRINGA FF_VP12_CONCESSIONE 17 +STRINGA FF_VP17_CONCESSIONE 17 BEGIN KEY "Cod. Concessione" - PROMPT 2 23 "Cod. Concessione " - GROUP GF_VP12 + PROMPT 2 31 "Cod. Concessione " + GROUP GF_VP17 END -STRINGA FF_VP12_ABI 10 +STRINGA FF_VP17_ABI 10 BEGIN KEY "Cod. ABI" - PROMPT 40 23 "Cod. ABI " - GROUP GF_VP12 + PROMPT 40 31 "Cod. ABI " + GROUP GF_VP17 END -STRINGA FF_VP12_CAB 10 +STRINGA FF_VP17_CAB 10 BEGIN KEY "Cod. CAB" - PROMPT 40 24 "Cod. CAB " - GROUP GF_VP12 + PROMPT 40 32 "Cod. CAB " + GROUP GF_VP17 END END diff --git a/cg/cg5700b.uml b/cg/cg5700b.uml index 8ccbbfbcd..9c8d92115 100755 --- a/cg/cg5700b.uml +++ b/cg/cg5700b.uml @@ -1,48 +1,48 @@ #include "cg5700.h" -TOOLBAR "" 0 20 0 2 +TOOLBAR "" 0 -3 0 3 BUTTON DLG_PRINT 10 2 BEGIN - PROMPT -12 -1 "" + PROMPT -12 -11 "" MESSAGE EXIT, K_ENTER END BUTTON DLG_QUIT 10 2 BEGIN - PROMPT -22 -1 "" + PROMPT -22 -11 "" END ENDPAGE -PAGE "Dichiarazione periodica" -1 -1 78 20 +PAGE "VP 1-12" -1 -1 78 20 GROUPBOX DLG_NULL 79 4 BEGIN - PROMPT 0 1 "@bDitta corrente" + PROMPT 0 0 "@bDitta corrente" END NUMBER F_CODDITTA 5 BEGIN - PROMPT 2 2 "Codice " + PROMPT 2 1 "Codice " FLAGS "D" END STRING F_RAGSOC 50 BEGIN - PROMPT 16 2 "Rag. Soc. " + PROMPT 16 1 "Rag. Soc. " FLAGS "D" END NUMBER F_YEAR 4 BEGIN - PROMPT 2 3 "Anno " + PROMPT 2 2 "Anno " FLAGS "D" END LIST F_MONTHS 30 BEGIN - PROMPT 16 3 "Periodo " + PROMPT 16 2 "Periodo " ITEM "1|Gennaio" ITEM "2|Febbraio" ITEM "3|Marzo" @@ -60,12 +60,12 @@ END LIST F_TRIMS 30 BEGIN - PROMPT 16 3 "Periodo " + PROMPT 16 2 "Periodo " ITEM "3|1° Trimestre" ITEM "6|2° Trimestre" ITEM "9|3° Trimestre" ITEM "12|4° Trimestre" - FLAGS "H" + FLAGS "DH" END STRING F_CODVAL 3 @@ -76,144 +76,197 @@ END CURRENCY F_VP1 18 BEGIN - PROMPT 1 5 "VP1 - Ammontare complessivo operazioni attive " + PROMPT 1 4 "VP1 - Operazioni attive (al netto dell'IVA) " + DRIVENBY F_CODVAL + FLAGS "D" +END + +CURRENCY F_VP1A 18 +BEGIN + PROMPT 1 5 "VP1A - di cui cessioni intracomunitarie " DRIVENBY F_CODVAL FLAGS "D" END CURRENCY F_VP2 18 BEGIN - PROMPT 1 6 "VP2 - Di cui cessioni intracomunitarie " + PROMPT 1 6 "VP2 - Operazioni passive (al netto dell'IVA) " + DRIVENBY F_CODVAL + FLAGS "D" +END + +CURRENCY F_VP2A 18 +BEGIN + PROMPT 1 7 "VP2A - di cui acquisti intracomunitari " DRIVENBY F_CODVAL FLAGS "D" END CURRENCY F_VP3 18 BEGIN - PROMPT 1 7 "VP3 - Ammontare complessivo delle operazioni passive " + PROMPT 1 8 "VP3 - Importazioni di oro e argento senza IVA alla dogana " DRIVENBY F_CODVAL FLAGS "D" END -CURRENCY F_VP4 18 +CURRENCY F_VP3I 18 BEGIN - PROMPT 1 8 "VP4 - Di cui acquisti intracomunitari " + PROMPT 1 9 " Imposta " DRIVENBY F_CODVAL FLAGS "D" END CURRENCY F_VP5 18 BEGIN - PROMPT 1 9 "VP5 - Iva a debito del periodo " + PROMPT 1 10 "VP5 - Iva esigibile per il periodo " DRIVENBY F_CODVAL FLAGS "D" END CURRENCY F_VP6 18 BEGIN - PROMPT 1 10 "VP6 - Iva a credito del periodo " + PROMPT 1 11 "VP6 - Iva che si detrae per il periodo " DRIVENBY F_CODVAL FLAGS "D" END CURRENCY F_VP7 18 BEGIN - PROMPT 1 11 "VP7 - Iva credito periodo precedente " + PROMPT 1 12 "VP7 - Iva a debito o credito per il periodo " DRIVENBY F_CODVAL FLAGS "D" END CURRENCY F_VP8 18 BEGIN - PROMPT 1 12 "VP8 - Crediti d'imposta utilizzati " + PROMPT 1 14 "VP8 - Variazioni d'imposta periodi precedenti " DRIVENBY F_CODVAL FLAGS "D" END CURRENCY F_VP9 18 BEGIN - PROMPT 1 13 "VP9 - Interessi " + PROMPT 1 15 "VP9 - Iva non versata da dichiarazioni precedenti " DRIVENBY F_CODVAL FLAGS "D" END CURRENCY F_VP10 18 BEGIN - PROMPT 1 14 "VP10 - Iva da versare " + PROMPT 1 16 "VP10 - Debito o credito dal periodo precedente " DRIVENBY F_CODVAL FLAGS "D" END CURRENCY F_VP11 18 BEGIN - PROMPT 1 15 "VP11 - Iva a credito " + PROMPT 1 17 "VP11 - Credito IVA compensabile " + DRIVENBY F_CODVAL + FLAGS "D" +END + +CURRENCY F_VP12 18 +BEGIN + PROMPT 1 18 "VP12 - IVA dovuta o a credito del periodo " + DRIVENBY F_CODVAL + FLAGS "D" +END + +ENDPAGE + +PAGE "VP 13-17" -1 -1 78 20 + +CURRENCY F_VP13 18 +BEGIN + PROMPT 1 1 "VP13 - Crediti speciali d'imposta detratti " + DRIVENBY F_CODVAL + FLAGS "D" +END + +CURRENCY F_VP14 18 +BEGIN + PROMPT 1 2 "VP14 - Interessi dovuti per liquidazione trimestrale " + DRIVENBY F_CODVAL + FLAGS "D" +END + +CURRENCY F_VP15 18 +BEGIN + PROMPT 1 3 "VP15 - Acconto versato " + DRIVENBY F_CODVAL + FLAGS "D" +END + +CURRENCY F_VP16 18 +BEGIN + PROMPT 1 4 "VP16 - Importo da versare " DRIVENBY F_CODVAL FLAGS "D" END GROUPBOX DLG_NULL 79 5 BEGIN - PROMPT 0 16 "@bVP12 - Estremi del versamento" + PROMPT 0 16 "@bVP17 - Estremi del versamento" END -DATE F_VP12_DATA +DATE F_VP17_DATA BEGIN PROMPT 1 17 "Data " FLAGS "D" - GROUP G_VP12 + GROUP G_VP17 END -CURRENCY F_VP12_IMPORTO 18 +CURRENCY F_VP17_IMPORTO 18 BEGIN PROMPT 38 17 "Importo versato " FLAGS "DR" DRIVENBY F_CODVAL - GROUP G_VP12 + GROUP G_VP17 END -NUMBER F_VP12_ABI 5 +NUMBER F_VP17_ABI 5 BEGIN PROMPT 1 18 "Codice ABI " FIELD S7 FLAGS "DRZ" USE %BAN - INPUT CODTAB[1,5] F_VP12_ABI - INPUT CODTAB[6,10] F_VP12_CAB + INPUT CODTAB[1,5] F_VP17_ABI + INPUT CODTAB[6,10] F_VP17_CAB DISPLAY "Codice ABI" CODTAB[1,5] DISPLAY "Codice CAB" CODTAB[6,10] DISPLAY "Descrizione @50" S0 - OUTPUT F_VP12_ABI CODTAB[1,5] - OUTPUT F_VP12_CAB CODTAB[6,10] + OUTPUT F_VP17_ABI CODTAB[1,5] + OUTPUT F_VP17_CAB CODTAB[6,10] CHECKTYPE NORMAL WARNING "Banca assente" - GROUP G_VP12 + GROUP G_VP17 END -NUMBER F_VP12_CAB 5 +NUMBER F_VP17_CAB 5 BEGIN PROMPT 38 18 "Codice CAB " FLAGS "DRZ" - COPY ALL F_VP12_ABI + COPY ALL F_VP17_ABI CHECKTYPE NORMAL WARNING "Banca assente" - GROUP G_VP12 + GROUP G_VP17 END -NUMBER F_VP12_CONCESSIONE 3 +NUMBER F_VP17_CONCESSIONE 3 BEGIN PROMPT 1 19 "Concessione " FLAGS "DRZ" USE %UCC - INPUT CODTAB F_VP12_CONCESSIONE + INPUT CODTAB F_VP17_CONCESSIONE DISPLAY "Concessione " CODTAB[1,5] DISPLAY "Descrizione @50" S0 - OUTPUT F_VP12_CONCESSIONE CODTAB + OUTPUT F_VP17_CONCESSIONE CODTAB CHECKTYPE NORMAL WARNING "Concessione assente" - GROUP G_VP12 + GROUP G_VP17 END -BOOLEAN F_VP12_STAMPATO +BOOLEAN F_VP17_STAMPATO BEGIN PROMPT 38 19 "Stampato" FLAGS "D" diff --git a/cg/cg6100.cpp b/cg/cg6100.cpp index fbc850e56..09a80f962 100755 --- a/cg/cg6100.cpp +++ b/cg/cg6100.cpp @@ -1,18 +1,14 @@ // Ricezione automatica #include -#include -#include -#include #include -#include #include #include #include #include "cglib04.h" -class TRic_auto : public TApplication +class TRic_auto : public TSkeleton_application { TTransfer_file* _tras_file; @@ -27,11 +23,9 @@ class TRic_auto : public TApplication public: virtual bool create(); virtual bool destroy(); - virtual bool menu(MENU_TAG m); - virtual bool check_autorization() const - {return FALSE;} + virtual void main_loop(); + virtual bool check_autorization() const { return FALSE; } - bool main_loop(); void stato_trasferimento(TString& std); bool controlli_preliminari(); bool leggi_trasfer(); @@ -53,12 +47,12 @@ void TRic_auto::stato_trasferimento(TString& std) std = conf.get("FlStTra"); // dai parametri ditta } -bool TRic_auto::main_loop() +void TRic_auto::main_loop() { TString std = ""; if (!controlli_preliminari()) - return FALSE; + return; set_flag(); @@ -96,7 +90,7 @@ bool TRic_auto::main_loop() ::remove(dirtemp); if (!subj) - return FALSE; + return; } } @@ -104,7 +98,7 @@ bool TRic_auto::main_loop() if (std == "M") { - TString appname = "cg6 -5 M A"; // Lancio il programma di ricezione dei movimenti + const char* appname = "cg6 -5 M A"; // Lancio il programma di ricezione dei movimenti // con il parametro A perche' si tratta di ricezione TExternal_app a (appname); // in automatico a.run(); @@ -124,8 +118,6 @@ bool TRic_auto::main_loop() conf.set("FlStTra"," "); // dei parametri ditta message_box("Il trasferimento e' stato INTERAMENTE COMPLETATO"); } - - return FALSE; } bool TRic_auto::controlli_preliminari() @@ -357,15 +349,9 @@ bool TRic_auto::set_flag() bool TRic_auto::create() { - TApplication::create(); - _cancella_header = FALSE; - _tras_file = new TTransfer_file(_trasfer); - - dispatch_e_menu (BAR_ITEM(1)); - - return TRUE; + return TSkeleton_application::create(); } bool TRic_auto::destroy() @@ -382,16 +368,9 @@ bool TRic_auto::destroy() ::remove(header); } - return TApplication::destroy(); + return TSkeleton_application::destroy(); } -bool TRic_auto::menu(MENU_TAG m) -{ - if (m == BAR_ITEM(1)) - return main_loop(); - return FALSE; -} - int cg6100 (int argc, char* argv[]) { char p4 = '\0'; diff --git a/cg/cg6700.cpp b/cg/cg6700.cpp index 7edaa842a..4dc61884f 100755 --- a/cg/cg6700.cpp +++ b/cg/cg6700.cpp @@ -2729,7 +2729,7 @@ void TRic_ListaMov::aggiorna_mov() const bool first_time = mov.get("TOCFP")!="X"; if ((_tipodoc == "NC" || _tipodoc == "ST") && first_time) // swap sign only if it's first time { - _tot_doc = _tot_doc * -1; + _tot_doc = -_tot_doc; mov.put("TOCFP","X"); } diff --git a/cg/cg6903.cpp b/cg/cg6903.cpp index 23db22468..dcfcb0644 100755 --- a/cg/cg6903.cpp +++ b/cg/cg6903.cpp @@ -1,16 +1,18 @@ +#include +#include + #include "cg6903.h" -#include "cg6900a.h" +#include "cg6900a.h" + +#include +#include bool TRip_flag::create() { - TApplication::create(); - _mov = new TLocalisamfile (LF_MOV); _part = new TLocalisamfile (LF_PARTITE); - dispatch_e_menu (BAR_ITEM(1)); - - return TRUE; + return TSkeleton_application::create(); } bool TRip_flag::destroy() @@ -18,35 +20,31 @@ bool TRip_flag::destroy() delete _mov; delete _part; - return TApplication::destroy(); + return TSkeleton_application::destroy(); } -bool TRip_flag::set() +void TRip_flag::main_loop() { - TMask* msk = new TMask("cg6903a"); - KEY k; - - k = msk->run(); - + TMask msk("cg6903a"); + KEY k = msk.run(); if (k == K_ENTER) { - long ditta = msk->get_long(F_DITTAINV); - TDate datalim (msk->get(F_DATA)); - bool rippn = msk->get_bool(F_RIPPN); - bool ripiva = msk->get_bool(F_RIPIVA); - bool ripsc = msk->get_bool(F_RIPSC); + long ditta = msk.get_long(F_DITTAINV); + TDate datalim = msk.get(F_DATA); + bool rippn = msk.get_bool(F_RIPPN); + bool ripiva = msk.get_bool(F_RIPIVA); + bool ripsc = msk.get_bool(F_RIPSC); if (!prefix().exist(ditta)) { error_box("Libreria archivi ditta non presente su disco"); - return FALSE; + return; } if (!rippn && !ripiva && !ripsc) { - delete msk; - return FALSE; // Se non flaggo nessuno dei tre non ha - } // senso scorrere l'archivio. + return; // Se non flaggo nessuno dei tre non ha + } // senso scorrere l'archivio. set_firm(ditta); @@ -98,15 +96,5 @@ bool TRip_flag::set() delete _prog; } } - - delete msk; - return FALSE; } -bool TRip_flag::menu(MENU_TAG m) -{ - if (m == BAR_ITEM(1)) - return set(); - - return FALSE; -} diff --git a/cg/cg6903.h b/cg/cg6903.h index 3d3d39416..224039e21 100755 --- a/cg/cg6903.h +++ b/cg/cg6903.h @@ -2,30 +2,17 @@ #include #include -#include -#include #include -#include -#include "cg2.h" - -#include -#include - -class TRip_flag : public TApplication +class TRip_flag : public TSkeleton_application { TLocalisamfile* _mov; TLocalisamfile* _part; TProgind* _prog; public: - virtual bool check_autorization() const - {return FALSE;} + virtual bool check_autorization() const { return FALSE; } virtual bool create(); virtual bool destroy(); - virtual bool menu(MENU_TAG m); - - bool set(); - - TRip_flag() {} + virtual void main_loop(); }; diff --git a/cg/cg6903a.uml b/cg/cg6903a.uml index a6f8d88a0..28d7321e9 100755 --- a/cg/cg6903a.uml +++ b/cg/cg6903a.uml @@ -5,7 +5,7 @@ PAGE "Invio contabilita'" -1 -1 76 12 NUMBER F_DITTAINV 5 BEGIN PROMPT 2 1 "Codice ditta inviante " - USE %IND KEY 1 + USE %IND JOIN LF_NDITTE TO %IND INTO CODDITTA=CODTAB INPUT CODTAB F_DITTAINV DISPLAY "Ditta" CODTAB diff --git a/cg/cglib01.cpp b/cg/cglib01.cpp index e1707d153..d818caa5e 100755 --- a/cg/cglib01.cpp +++ b/cg/cglib01.cpp @@ -401,6 +401,7 @@ bool TRegistro::update(long protiva, const TDate& datareg) { TTable reg("REG"); updated = reg.rewrite(_rec) == NOERR; + cache().discard(_rec); // Forza rilettura registro in cache } return updated; @@ -593,7 +594,7 @@ void TBill::set_description(const char* d) if (_descrizione) *_descrizione = d; else - _descrizione = new TString80(d); + _descrizione = new TString(d); } } @@ -901,7 +902,7 @@ const TString& TBill::descrizione() const int TBill::tipo_cr() const { - if (_tipo_cr < 0) + if (_tipo_cr < 0) { TBill& myself = (TBill&)*this; myself.find(); @@ -909,6 +910,18 @@ int TBill::tipo_cr() const return _tipo_cr; } +bool TBill::sospeso() const +{ + if (_tipo_cr < 0) tipo_cr(); // trick to load _sospeso + return _sospeso; +} + +char TBill::sezione() const +{ + if (_sezione == ' ') tipo_cr(); // trick to load _sezione + return _sezione; +} + // Certified 99% (uses __tmp_string) const char* TBill::string(int mode) const { diff --git a/cg/cglib01.h b/cg/cglib01.h index 18367c301..d0914652f 100755 --- a/cg/cglib01.h +++ b/cg/cglib01.h @@ -134,7 +134,7 @@ public: class TCodiceIVA : public TRectype { - void copy(const TRectype & iva) { TRectype::operator =(iva); } + void copy(const TRectype & iva) { TRectype::operator =(iva); } public: // TObject virtual bool ok() const { return !empty(); } TCodiceIVA & operator =(const TCodiceIVA & iva) { copy(iva) ; return *this;} @@ -142,7 +142,7 @@ public: // TObject bool read(const char* codice); const TString& codice() const { return get("CODTAB"); } const TString& descrizione() const { return get("S0"); } - const real percentuale() const { return get_real("R0"); } + const real percentuale() const { return get_real("R0"); } const TString& tipo() const { return get("S1"); } int detraibilita() const { return get_int("I1"); } @@ -188,11 +188,11 @@ public: { set(g,c,s,t,d,r);} TBill(TToken_string& tgcsd, int from, int mode = 0) - : _descrizione(NULL) + : _descrizione(NULL), _sezione(' '), _sospeso(FALSE) { get(tgcsd, from, mode); } TBill(const TRectype& rec, bool contro = FALSE) - : _descrizione(NULL) + : _descrizione(NULL), _sezione(' '), _sospeso(FALSE) { get(rec, contro); } TBill(const TBill& b) @@ -224,8 +224,8 @@ public: int tipo_att(); bool read(TRectype& r); - bool sospeso() const { return _sospeso; } // _sospeso e' letto nella read() - char sezione() const { return _sezione; } + bool sospeso() const; + char sezione() const; void put(TRectype& r, bool contro = FALSE) const; bool get(const TRectype& r, bool contro = FALSE); diff --git a/cg/cglib04.cpp b/cg/cglib04.cpp index 0f6ffa1b4..bbc61e18a 100755 --- a/cg/cglib04.cpp +++ b/cg/cglib04.cpp @@ -14,16 +14,14 @@ #include "cglib04.h" #include "cgsaldac.h" -const int size = 256; //Lunghezza del record del TRASFER +const int sizeT = 256; //Lunghezza del record del TRASFER const int sizeH = 1024; //Lunghezza del record dell'HEADER -const char* const tracciato_AS = "cgtrc.ini"; -const char* const tracciato_PC = "cgtrcpc.ini"; - const int RIC_SIZE = 512; -HIDDEN char _isam_string[RIC_SIZE]; -HIDDEN char __dep[LEN_REC_HEAD]; +const char* tracciato_AS = "cgtrc.ini"; +const char* tracciato_PC = "cgtrcpc.ini"; + HIDDEN TString TEMP; //ritorna falso se la causale non e' significativa @@ -307,15 +305,19 @@ const char* TRic_recfield::operator =(const char* s) } TRic_recfield::operator const char*() const -{ +{ + static char* _isam_string = NULL; + if (_isam_string == NULL) + _isam_string = new char[RIC_SIZE]; + __getfieldbuff( _len, _type, _p, _isam_string); return _isam_string; } // Ritorna il record di controllo del trasfer const char* TTransfer_file::record() const -{ - return __dep; +{ + return (const char*)*_control_rec; } TTransfer_file::TTransfer_file(char scelta) @@ -326,8 +328,7 @@ TTransfer_file::TTransfer_file(char scelta) _numreg_p = 0L; _numreg_piva = 0L; _scelta = scelta; - _control_rec = new TFixed_string(__dep, LEN_REC_HEAD); - + _control_rec = new TString(LEN_REC_HEAD); if (scelta == 'S') _trc.leggi_modulo(tracciato_AS); else @@ -513,14 +514,14 @@ bool TTransfer_file::read_control_rec() fseek(_trasfer, 0L, SEEK_SET); // const word letti = fread((char*)(const char*)_control_rec,sizeof(char),sizeH,_trasfer); - const word letti = fread(__dep, sizeof(char), sizeH, _trasfer); + const word letti = fread(_control_rec->get_buffer(), sizeof(char), sizeH, _trasfer); _control_rec->cut(sizeH); if (_control_rec->len() > sizeH) NFCHECK("Non e' possibile allocare una stringa di %d in una stringa fissa di %d caratteri", _control_rec->len(),sizeH); - _tiporec = _control_rec->sub(0,2); + _tiporec = _control_rec->left(2); if (_tiporec == " 1") { @@ -553,7 +554,7 @@ bool TTransfer_file::read_control_rec_t() // va all'inizio del file fseek (_trasfer, 0L, SEEK_SET); - const word letti = fread((char*)(const char*)_control_rec_t,sizeof(char),size,_trasfer); + const word letti = fread((char*)(const char*)_control_rec_t,sizeof(char),sizeT,_trasfer); _tiporec = _control_rec_t.sub(0,2); @@ -790,20 +791,19 @@ void TTransfer_file::writeat(const char* str,int size,int fieldnum,const char* f int TTransfer_file::go2field(int fieldnum, const char* file, const long nrec, bool seek) { - TString key; - int pos_campo; - const int size = 256; + TString256 key; if (nrec < 0) readat(_curpos); // Mi posiziono all' inizio del record -else - readat(nrec); + else + readat(nrec); if (!file) key.format("%2s%d",(const char*)_curfile,fieldnum); else key.format("%2s%d", file, fieldnum); + int pos_campo = 0; if (_trc.is_key((const char *) key)) { TToken_string * data = (TToken_string *) _trc.objptr(key); @@ -957,33 +957,36 @@ char TTransfer_file::TipoConto(int g, int c) char tipo = ' '; if (g != 0 && c != 0) - { -/* - TLocalisamfile pcon (LF_PCON); - pcon.setkey(1); - pcon.zero(); - pcon.put(PCN_GRUPPO, g); - pcon.put(PCN_CONTO, c); - pcon.put(PCN_SOTTOCONTO, 0l); - if (pcon.read() == NOERR) - tipo = pcon.get_char(PCN_TMCF); -*/ - TString16 gcs; gcs.format("%d|%d|0", g, c); - tipo = cache().get(LF_PCON, gcs).get_char(PCN_TMCF); - - if (tipo <= ' ') // Se non lo trova sul piano dei conti standard, prova su quello temporaneo + { + bool found = FALSE; + + if (_tpcon != NULL) // Valido solo se si sta trasferendo anche il piano dei conti { - if (_tpcon != NULL) // Valido solo se si sta trasferendo anche il piano dei conti + _tpcon->put(PCN_GRUPPO, g); + _tpcon->put(PCN_CONTO, c); + _tpcon->put(PCN_SOTTOCONTO, 0l); + if (_tpcon->read() == NOERR) { - _tpcon->put(PCN_GRUPPO, g); - _tpcon->put(PCN_CONTO, c); - _tpcon->put(PCN_SOTTOCONTO, 0l); - if (_tpcon->read() == NOERR) - tipo = _tpcon->get_char(PCN_TMCF); + tipo = _tpcon->get_char(PCN_TMCF); + found = TRUE; + } + } + + if (!found) + { + TLocalisamfile pcon (LF_PCON); + pcon.setkey(1); + pcon.zero(); + pcon.put(PCN_GRUPPO, g); + pcon.put(PCN_CONTO, c); + pcon.put(PCN_SOTTOCONTO, 0l); + if (pcon.read() == NOERR) + { + tipo = pcon.get_char(PCN_TMCF); + found = TRUE; } } } - if (tipo < ' ') tipo = ' '; return tipo; @@ -1124,6 +1127,7 @@ void TTransfer_file::write_tmp_tabelle(TString& record, bool create) int logicnum; int campi_righe = 0; int num_riga = 1; + int gruppo,conto; sigla = record.mid(0,2); key.format("%2s%d", (const char*)sigla,numfield); @@ -1232,16 +1236,13 @@ void TTransfer_file::write_tmp_tabelle(TString& record, bool create) if (logicnum == LF_RCAUSALI && (fname == "GRUPPO" || fname == "CONTO") ) { - int gruppo,conto; - char tipo; - if (fname == "GRUPPO") gruppo = atoi(field); if (fname == "CONTO") { conto = atoi(field); - tipo = TipoConto(gruppo,conto); + char tipo = TipoConto(gruppo,conto); dep->put(RCA_TIPOCF, tipo); } } @@ -2602,8 +2603,7 @@ char TTransfer_file::what_is_this(TString& record,TString& tipo) { TRecnotype rec = _ttab->recno(); TIsamtempfile& ttab = *_ttab; - const word size = 256; - TString buffer(size); + TString buffer(sizeT); char caso = 'p'; @@ -2611,7 +2611,7 @@ char TTransfer_file::what_is_this(TString& record,TString& tipo) if (tipomov != 2 && tipomov != 4) { - TRic_recfield recf (ttab.curr(), "S0", 0, 256); + TRic_recfield recf (ttab.curr(), "S0", 0, sizeT); long nreg = atol(record.sub(2,8)); int nriga = atoi(record.sub(8,10)); @@ -3054,10 +3054,9 @@ bool TTransfer_file::ordina_trasfer(const char* orig) if (i == NULL) return error_box("Impossibile leggere il file %s", orig); - long dim_t = determina_dimensione(i); //Determina la dimensione del trasfer + const long dim_t = determina_dimensione(i); //Determina la dimensione del trasfer - const word size = 256; - TString buffer(size); + TString buffer(sizeT); int pos = 0; @@ -3067,20 +3066,20 @@ bool TTransfer_file::ordina_trasfer(const char* orig) tmptab.add(TEMP_TAB); _ttab = new TIsamtempfile(LF_TAB, tmptab, TRUE); - long cicli = dim_t / size; + long cicli = dim_t / sizeT; TProgind prog (cicli,"Ordinamento file TRASFER in corso\nPrego attendere",FALSE, TRUE); bool ok = TRUE; - TRic_recfield recf (_ttab->curr(), "S0", 0, size); + TRic_recfield recf (_ttab->curr(), "S0", 0, sizeT); - TString80 key; + TString80 key; TString16 app; while (ok) { - const word letti = fread((char*)(const char*)buffer, 1, size, i); - buffer.cut(256); + const word letti = fread((char*)(const char*)buffer, 1, sizeT, i); + buffer.cut(sizeT); // A causa di errori di invio da parte del sistema // a volte si possono riscontrare GPF. @@ -3090,14 +3089,14 @@ bool TTransfer_file::ordina_trasfer(const char* orig) // if (buffer[0] == ' ' && buffer[1] == ' ') // buffer.ltrim(); - ok = (letti == size); + ok = (letti == sizeT); if (!ok) break; prog.addstatus(1); - key = buffer.mid(0,15); + key = buffer.left(15); - if (buffer.mid(0,2) == "B1") + if (buffer.left(2) == "B1") { app = buffer.mid(28,7); // Modifica del 06-09-96 relativa all'allineamento app.trim(); // del numero di riferimento partita che per i file @@ -3109,7 +3108,6 @@ bool TTransfer_file::ordina_trasfer(const char* orig) } _ttab->put("CODTAB", key); - recf = buffer; int rc = _ttab->write(); @@ -3380,20 +3378,18 @@ void TTransfer_file::scrivi_header(const char* dest, const char* wflag) void TTransfer_file::scrivi_causali(long nrec) { - const word size = 256; - TString buffer(size); - TString16 trec; - bool create = TRUE; + TString buffer(sizeT); + bool create = TRUE; _prog = new TProgind (nrec,"Trasferimento Tabella Causali in corso\nPrego attendere",FALSE, TRUE, 1); - TRic_recfield recf (_ttab->curr(), "S0", 0, 256); + TRic_recfield recf (_ttab->curr(), "S0", 0, sizeT); _ttab->zero(); _ttab->put("CODTAB", "W1"); for (_ttab->read(); !_ttab->eof(); _ttab->next()) { - trec = (_ttab->get("CODTAB")).sub(0,2); + const TString& trec = (_ttab->get("CODTAB")).left(2); if (trec != "W1") break; @@ -3407,21 +3403,18 @@ void TTransfer_file::scrivi_causali(long nrec) void TTransfer_file::scrivi_clifo(long nrec) { - const word size = 256; - TString buffer(size); - TString16 trec; + TString buffer(sizeT); bool create = TRUE; _prog = new TProgind (nrec,"Trasferimento Anagrafica Clienti/Fornitori in corso\nPrego attendere",FALSE, TRUE, 1); - TRic_recfield recf (_ttab->curr(), "S0", 0, 256); + TRic_recfield recf (_ttab->curr(), "S0", 0, sizeT); _ttab->zero(); _ttab->put("CODTAB", "A1"); for (_ttab->read(); !_ttab->eof(); _ttab->next()) { - trec = (_ttab->get("CODTAB")).sub(0,2); - + const TString& trec = (_ttab->get("CODTAB")).left(2); if (trec != "A1") break; buffer = (const char*) recf; @@ -3435,21 +3428,18 @@ void TTransfer_file::scrivi_clifo(long nrec) // Scrive piano dei conti da SISTEMA void TTransfer_file::scrivi_pcon(long nrec) { - const word size = 256; - TString buffer(size); - TString16 trec; + TString buffer(sizeT); bool create = TRUE; _prog = new TProgind (nrec,"Trasferimento Anagrafica Piano dei Conti in corso\nPrego attendere",FALSE, TRUE, 1); - TRic_recfield recf (_ttab->curr(), "S0", 0, 256); + TRic_recfield recf (_ttab->curr(), "S0", 0, sizeT); _ttab->zero(); _ttab->put("CODTAB", "P1"); for (_ttab->read(); !_ttab->eof(); _ttab->next()) { - trec = (_ttab->get("CODTAB")).sub(0,2); - + const TString& trec = (_ttab->get("CODTAB")).left(2); if (trec[0] != 'P') break; buffer = (const char*) recf; @@ -3462,19 +3452,17 @@ void TTransfer_file::scrivi_pcon(long nrec) void TTransfer_file::scrivi_PN(long nrec) { - const word size = 256; - TString buffer(size); - TString16 trec; + TString buffer(sizeT); _prog = new TProgind (nrec,"Trasferimento Movimenti di Prima nota in corso\nPrego attendere",FALSE, TRUE, 1); - TRic_recfield recf (_ttab->curr(), "S0", 0, 256); + TRic_recfield recf (_ttab->curr(), "S0", 0, sizeT); _ttab->zero(); _ttab->put("CODTAB", "Z1"); for (_ttab->read(); !_ttab->eof(); _ttab->next()) { - trec = (_ttab->get("CODTAB")).sub(0,2); + const TString& trec = (_ttab->get("CODTAB")).left(2); if (trec != "Z1") break; @@ -3487,19 +3475,19 @@ void TTransfer_file::scrivi_PN(long nrec) void TTransfer_file::scrivi_IVA(long nrec) { - const word size = 256; - TString buffer(size); + TString buffer(sizeT); TString16 trec; _prog = new TProgind (nrec,"Trasferimento Movimenti Iva in corso\nPrego attendere",FALSE, TRUE, 1); - TRic_recfield recf (_ttab->curr(), "S0", 0, 256); + TRic_recfield recf (_ttab->curr(), "S0", 0, sizeT); _ttab->zero(); _ttab->put("CODTAB", "U1"); + for (_ttab->read(); !_ttab->eof(); _ttab->next()) { - trec = (_ttab->get("CODTAB")).sub(0,2); + trec = (_ttab->get("CODTAB")).left(2); if (trec != "U1") break; @@ -3512,9 +3500,7 @@ void TTransfer_file::scrivi_IVA(long nrec) void TTransfer_file::scrivi_SC(long nrec) { - const word size = 256; - TString buffer(size); - TString16 trec; + TString buffer(sizeT); _nregSC_p = -1; _numrigSC_p = -1; @@ -3523,13 +3509,13 @@ void TTransfer_file::scrivi_SC(long nrec) _prog = new TProgind (nrec,"Trasferimento Movimenti saldaconto in corso\nPrego attendere",FALSE, TRUE, 1); - TRic_recfield recf (_ttab->curr(), "S0", 0, 256); + TRic_recfield recf (_ttab->curr(), "S0", 0, sizeT); _ttab->zero(); _ttab->put("CODTAB", "B1"); for (_ttab->read(); !_ttab->eof(); _ttab->next()) { - trec = (_ttab->get("CODTAB")).sub(0,2); + const TString& trec = (_ttab->get("CODTAB")).left(2); if (trec != "B1") break; @@ -3832,7 +3818,8 @@ void TTransfer_file::write_righe_causali(TString& record) TString sigla,key,str; int numfield = 1; TMappa_trc& trc = mappa(); - + int gruppo,conto; + sigla = record.mid(0,2); key.format("%2s%d", (const char*)sigla,numfield); @@ -3855,9 +3842,6 @@ void TTransfer_file::write_righe_causali(TString& record) } if (fname == RCA_GRUPPO || fname == RCA_CONTO) { - int gruppo,conto; - char tipo; - if (fname == RCA_GRUPPO) { gruppo = atoi(field); @@ -3867,7 +3851,7 @@ void TTransfer_file::write_righe_causali(TString& record) { conto = atoi(field); field.format("%3d", conto); - tipo = TipoConto(gruppo,conto); + char tipo = TipoConto(gruppo,conto); _deprcaus->put(RCA_TIPOCF, tipo); } } @@ -4400,10 +4384,9 @@ void TTransfer_file::write_testata_movimenti(TString& record) void TTransfer_file::write_righe_contabili(TString& record) { - TString sigla,key; + TString16 sigla,key; int numfield = 1; TMappa_trc& trc = mappa(); - char tipo = '\0'; real importo = ZERO; int gruppo; @@ -4418,8 +4401,8 @@ void TTransfer_file::write_righe_contabili(TString& record) { int from = trc.from(key); int to = trc.to(key); - TString fname = trc.field_name(key); - TString field = record.sub(from-1,to); + TString16 fname = trc.field_name(key); + TString80 field = record.sub(from-1,to); int flag = trc.flag(key); int dec = trc.flag_bis(key); @@ -4472,9 +4455,9 @@ void TTransfer_file::write_righe_contabili(TString& record) } if (fname == RMV_CONTO || fname == RMV_CONTOC) { - int conto = atoi(field); + const int conto = atoi(field); field.format("%3d", conto); - tipo = TipoConto(gruppo,conto); + char tipo = TipoConto(gruppo,conto); if (fname == RMV_CONTO) _deprmov->put(RMV_TIPOC, tipo); if (fname == RMV_CONTOC) diff --git a/cg/cglib04.h b/cg/cglib04.h index cae8eb901..33f9baa3a 100755 --- a/cg/cglib04.h +++ b/cg/cglib04.h @@ -126,8 +126,7 @@ class TTransfer_file TMappa_trc _trc; TString _curfile; TString256 _control_rec_t; // Buffer per il record di controllo del trasfer - TFixed_string* _control_rec; // Buffer per il record di controllo -// TString _control_rec; // Buffer per il record di controllo dell'header + TString* _control_rec; // Buffer per il record di controllo TString256 _record; // Buffer per il record corrente TProgind* _prog; TIsamtempfile* _tcaus; diff --git a/cg/cgp1.cpp b/cg/cgp1.cpp index b687e08f2..1edc5646b 100755 --- a/cg/cgp1.cpp +++ b/cg/cgp1.cpp @@ -10,7 +10,7 @@ int main(int argc,char** argv) switch(n) { case 0: - cgp1100(argc, argv); break; + cgp1100(argc, argv); break; // Stampa mastrini per centro di costo case 1: cgp1200(argc, argv); break; default: diff --git a/cg/cgp1100.cpp b/cg/cgp1100.cpp index 742e38f8d..8bc1db066 100755 --- a/cg/cgp1100.cpp +++ b/cg/cgp1100.cpp @@ -121,6 +121,8 @@ public: void calcola_progressivi(); void calcola_progressivi_al(); + void calcola_cdc_al(real& dare, real& avere); + void stampa_progressivi(); int stampa_progressivi(int start_riga); void stampa_progre_riporto(); @@ -634,8 +636,7 @@ int TMastrini_application::date2esc(const TDate& d) bool TMastrini_application::almeno_un_record() { bool trovato=FALSE; - long record,sottoc; - int gruppo,conto; + long record; TDate datareg, datacomp; TLocalisamfile& rmov = current_cursor()->file(-RMOV_ALIAS); @@ -648,6 +649,19 @@ bool TMastrini_application::almeno_un_record() rmov.put(RMV_SOTTOCONTO, _sottoc); for (rmov.read(); !rmov.eof() ;rmov.next()) { + const int gruppo = rmov.get_int(RMV_GRUPPO); + const int conto = rmov.get_int(RMV_CONTO); + const long sottoc = rmov.get_long(RMV_SOTTOCONTO); + if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc)) + break; + + if (_cdc != 0) + { + const long cdc = rmov.get_long(RMV_CDC); + if (_cdc != cdc) + continue; + } + int annoes = rmov.get_int (RMV_ANNOES); long numreg = rmov.get_long(RMV_NUMREG); @@ -666,17 +680,11 @@ bool TMastrini_application::almeno_un_record() else datareg = datacomp; - gruppo = rmov.get_int(RMV_GRUPPO); - conto = rmov.get_int(RMV_CONTO); - sottoc = rmov.get_long(RMV_SOTTOCONTO); - if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc)) + if ( ((annoes==_annomsk) || (_annomsk==0)) && ((datareg>=_data_ini) && (datareg<=_data_fine)) && (_stampa_mov_prov || provvis.trim().empty())) + { + trovato = TRUE; break; - else - if ( ((annoes==_annomsk) || (_annomsk==0)) && ((datareg>=_data_ini) && (datareg<=_data_fine)) && (_stampa_mov_prov || provvis.trim().empty())) - { - trovato = TRUE; - break; - } + } } rmov.readat(record); } @@ -1450,12 +1458,9 @@ bool TMastrini_application::preprocess_page(int file, int counter) _saldo_progre_prec = ZERO; if (_tipostampa == 2) { -// saldi_zero(); calcola_progressivi(); _totale_saldo = _totprogre_dare_al - _totprogre_avere_al; } -// else -// _totale_saldo = 1.0; if ((_tipostampa == 1) || (_tipostampa == 2)) { @@ -1539,7 +1544,7 @@ bool TMastrini_application::preprocess_page(int file, int counter) _g_contr = rmov.get(RMV_GRUPPOC); _c_contr = rmov.get(RMV_CONTOC); _s_contr = rmov.get(RMV_SOTTOCONTOC); - _centrodicosto = rmov.get(RMV_NUMGIO); + _centrodicosto = rmov.get(RMV_CDC); // Se non ha il richiesto numero di centro di costo salta la stampa di questa riga di movimento if (_cdc != 0L && _cdc != atol(_centrodicosto)) @@ -3126,13 +3131,15 @@ void TMastrini_application::calcola_progressivi_al() long record,sottoc,annoes; int gruppo,conto; TDate datareg, datacomp; - TLocalisamfile & rmov = current_cursor()->file(-RMOV_ALIAS); + TLocalisamfile& rmov = current_cursor()->file(-RMOV_ALIAS); char sezione; real importo; TDate data; _totale_prima_dare = ZERO; - _totale_prima_avere = ZERO; + _totale_prima_avere = ZERO; + + _mov->zero(); record = rmov.recno(); rmov.zero(); @@ -3146,13 +3153,16 @@ void TMastrini_application::calcola_progressivi_al() sezione = rmov.get (RMV_SEZIONE)[0]; importo = rmov.get_real(RMV_IMPORTO); long numreg = rmov.get_long(RMV_NUMREG); - - _mov->setkey(1); - _mov->curr().zero(); - _mov->curr().put(MOV_NUMREG,numreg); - _mov->read(); - if (_mov->bad()) - _mov->zero(); + + if (_mov->get_long(MOV_NUMREG) != numreg) + { + _mov->setkey(1); + _mov->put(MOV_NUMREG,numreg); + _mov->read(); + if (_mov->bad()) + _mov->zero(); + } + // Se sono stati selezionati i movimenti di cassa considera la data di competenza e registrazione su di essi datacomp = !_movcas_print ? (_mov->curr().get(MOV_DATACOMP)) : rmov.get(RMV_DATAREG); TString provvis (_mov->curr().get(MOV_PROVVIS)); @@ -3175,11 +3185,93 @@ void TMastrini_application::calcola_progressivi_al() sottoc = rmov.get_long(RMV_SOTTOCONTO); if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc)) break; - else if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg < _data_ini)) //Legge movimenti con data < data iniziale - if (sezione == 'D') - _totale_prima_dare += importo; - else - _totale_prima_avere += importo; + + if (_cdc != 0) + { + const long cdc = rmov.get_long(RMV_CDC); + if (_cdc != cdc) + continue; + } + + //Legge movimenti con data < data iniziale + if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg < _data_ini)) + { + if (sezione == 'D') + _totale_prima_dare += importo; + else + _totale_prima_avere += importo; + } + } // if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty()))) + } + rmov.readat(record); +} + +void TMastrini_application::calcola_cdc_al(real& dare, real& avere) +{ + TLocalisamfile& rmov = current_cursor()->file(-RMOV_ALIAS); + const TRecnotype record = rmov.recno(); + rmov.zero(); + rmov.put(RMV_GRUPPO, _gruppo); + rmov.put(RMV_CONTO, _conto); + rmov.put(RMV_SOTTOCONTO, _sottoc); + + _mov->zero(); + dare = ZERO; + avere = ZERO; + + for (rmov.read();!rmov.eof() ;rmov.next()) + { + const int gruppo = rmov.get_int(RMV_GRUPPO); + const int conto = rmov.get_int(RMV_CONTO); + const long sottoc = rmov.get_long(RMV_SOTTOCONTO); + if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc)) + break; + + const long cdc = rmov.get_long(RMV_CDC); + if (_cdc != cdc) + continue; + + const char sezione = rmov.get(RMV_SEZIONE)[0]; + const real importo = rmov.get_real(RMV_IMPORTO); + const long numreg = rmov.get_long(RMV_NUMREG); + TDate datareg = rmov.get_date(RMV_DATAREG); + + if (_mov->get_long(MOV_NUMREG) != numreg) + { + _mov->setkey(1); + _mov->put(MOV_NUMREG,numreg); + _mov->read(); + if (_mov->bad()) + _mov->zero(); + } + + const TString& provvis = _mov->curr().get(MOV_PROVVIS); + + if (_stampa_mov_prov || (!_stampa_mov_prov && provvis.blank())) + { + // Se sono stati selezionati i movimenti di cassa considera la data di competenza e registrazione su di essi + const TDate datacomp = !_movcas_print ? (_mov->curr().get(MOV_DATACOMP)) : rmov.get(RMV_DATAREG); + + TDate data; + if (_annomsk == 0) + { + datareg = rmov.get_date(RMV_DATAREG); + data = _inizioes; + } + else + { + datareg = datacomp; + data = _data_inizioese; + } + + //Legge movimenti con data >= data iniziale + if (datareg >= _data_ini && datareg <= _data_fine) + { + if (sezione == 'D') + dare += importo; + else + avere += importo; + } } // if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty()))) } rmov.readat(record); @@ -3292,29 +3384,36 @@ void TMastrini_application::calcola_progressivi() saldo = _sld->saldofin_esprec(_anno_corrente,_gruppo,_conto,_sottoc,TRUE); saldi.readat(pos); - if (saldo> ZERO) + if (saldo >= ZERO) { progredare_eseprec = saldo; progdare_prec = saldo; } - else if (saldo < ZERO) - { - saldo = -saldo; - progreavere_eseprec = saldo; - progavere_prec = saldo; - } + else + { + saldo = -saldo; + progreavere_eseprec = saldo; + progavere_prec = saldo; + } } } } // If (!_movcas_print && !_cdc) calcola_progressivi_al(); + + // Calcola il saldo fino a data_fin per centro di costo + if (_cdc) + { + saldoini_attuale = ZERO; + calcola_cdc_al(progdare_attuale, progavere_attuale); + } //Calcolo dei progressivi precedenti: somma di tutti quei movimenti di rmov //che hanno la data di registrazione inferiore alla data di inizio stampa, //dei progressivi dell'anno esercizio precedente, e dei progressivi dei //movimenti scaricati dell'esercizio attuale. - _progredare = progredare_eseprec + _totale_prima_dare; + _progredare = progredare_eseprec + _totale_prima_dare; _progreavere = progreavere_eseprec + _totale_prima_avere; _saldo_progre_prec = _progredare - _progreavere; @@ -3331,12 +3430,12 @@ void TMastrini_application::calcola_progressivi() if (salini_attuale == 'D') _totprogre_dare_al += saldoini_attuale; - else if (salini_attuale == 'A') - _totprogre_avere_al += saldoini_attuale; + else + _totprogre_avere_al += saldoini_attuale; if (salfine_attuale == 'D') _totprogre_dare_al += saldofine_attuale; - else if (salfine_attuale == 'A') - _totprogre_avere_al += saldofine_attuale; + else + _totprogre_avere_al += saldofine_attuale; } else { @@ -3345,12 +3444,12 @@ void TMastrini_application::calcola_progressivi() if (salini_attuale == 'D') _totprogre_dare_al += saldoini_attuale; - else if (salini_attuale == 'A') - _totprogre_avere_al += saldoini_attuale; + else + _totprogre_avere_al += saldoini_attuale; if (salfine_attuale == 'D') _totprogre_dare_al += saldofine_attuale; - else if (salfine_attuale == 'A') - _totprogre_avere_al += saldofine_attuale; + else + _totprogre_avere_al += saldofine_attuale; } } diff --git a/cg/cgp1200.cpp b/cg/cgp1200.cpp index e4a489d06..8d11ae64f 100755 --- a/cg/cgp1200.cpp +++ b/cg/cgp1200.cpp @@ -1522,7 +1522,7 @@ bool TStampaBilanciCDC_application::bil_verifica() real mov_gruppo_dare, mov_gruppo_avere, prg_gruppo_dare, prg_gruppo_avere; bool esiste_conto = FALSE, esiste_sc = FALSE, movimentato = FALSE; - CHECK(_tmp_saldi_att == NULL, "Non posso riaprire cg01"); + CHECK(_tmp_saldi_att == NULL, "Non posso riaprire cg01.dbf"); _tmp_saldi_att = new TIsamtempfile(LF_SALDI, "cg01", TRUE, TRUE); _gp=-1; @@ -1553,10 +1553,10 @@ bool TStampaBilanciCDC_application::bil_verifica() c = _pcn->get_int (PCN_CONTO); s = _pcn->get_long(PCN_SOTTOCONTO); - if ( (((_cp != -1) && (c != _cp)) || ((_gp != -1) && (g != _gp))) && - esiste_sc ) + if ( (((_cp != -1) && (c != _cp)) || ((_gp != -1) && (g != _gp))) && esiste_sc ) { if (_verifica == 2) + { if (!((_stampav == 2) && (saldo_conto == 0))) { //modifica del 21/11/1995 @@ -1580,6 +1580,7 @@ bool TStampaBilanciCDC_application::bil_verifica() prg_gruppo_avere += prg_conto_avere; saldo_gruppo += saldo_conto; } + } //scrivo il record del conto; if ( (_verifica == 1)||( (_verifica == 2)&& (!((_stampav == 2)&&(saldo_conto == 0))) ) ) @@ -1597,8 +1598,9 @@ bool TStampaBilanciCDC_application::bil_verifica() prg_conto_dare = ZERO; prg_conto_avere = ZERO; } - if (_verifica == 2) - if ( ((_gp != -1) && (g != _gp)) && (!esiste_conto) ) + if (_verifica == 2 && (_gp != -1 && g != _gp)) + { + if (!esiste_conto) { _gp = g; _saldo_ini_gruppo_dare = ZERO; @@ -1609,8 +1611,7 @@ bool TStampaBilanciCDC_application::bil_verifica() prg_gruppo_dare = ZERO; prg_gruppo_avere = ZERO; } - if (_verifica == 2) - if ( ((_gp != -1) && (g != _gp)) && esiste_conto ) + else { //scrivo il record del gruppo scrivi_record_gruppo(prg_gruppo_dare,prg_gruppo_avere,mov_gruppo_dare, @@ -1625,12 +1626,14 @@ bool TStampaBilanciCDC_application::bil_verifica() prg_gruppo_dare = ZERO; prg_gruppo_avere = ZERO; } + } if ( (s == 0) && (c != 0) ) //si tratta di un conto { tipo_conto = _pcn->get(PCN_TMCF)[0]; indbil_conto = _pcn->get_int(PCN_INDBIL); if ( (tipo_conto == 'C') || (tipo_conto == 'F') ) - { // Per CLIENTI/FORNITORI lascio la lettura dal file dei saldi + { + // Per CLIENTI/FORNITORI lascio la lettura dal file dei saldi esiste_sc = ricerca_cf(g,c,tipo_conto,indbil_conto,saldo_finale,saldo_iniziale, mov_conto_dare,mov_conto_avere,prg_conto_dare,prg_conto_avere, saldo_conto); @@ -1688,6 +1691,7 @@ bool TStampaBilanciCDC_application::bil_verifica() saldo_finale = saldo_iniziale = ZERO; //saldi relativi a ciascun sottoconto _indbil = indbil_conto; + if (_tipo_stampa1 == 1) //bil. di verifica per data limite { //modifica del 21/11/95 @@ -1701,32 +1705,6 @@ bool TStampaBilanciCDC_application::bil_verifica() //modifica del 21/11/95 if (_mov_ap) saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere; - /* - else //discorso flag "movimentato" (video) - { - TLocalisamfile saldi(LF_SALDI); // W96SALDI - saldi.zero(); // Modifica SALDI per movimenti - saldi.put(SLD_ANNOES, _annoes); // scaricati del 05-06-96 - saldi.put(SLD_FLSCA, FALSE); // Ho aggiunto saldi.put(SLD_FLSCA, FALSE); - saldi.put(SLD_GRUPPO, g); // In questo modo considero il record con - saldi.put(SLD_CONTO, c); // la somma fra progressivi normali e scaricati - saldi.put(SLD_SOTTOCONTO, s); - if (saldi.read() == NOERR) - { - real ss = saldi.get_real(SLD_SALDO); - if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5) - if (ss == ZERO && _annoes != 0) - { - saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,s); - //modifica del 21/11/95 - if (saldo_iniziale > ZERO) - _saldo_ini_dare = saldo_iniziale; - else _saldo_ini_avere = -saldo_iniziale; - //fine - } - } - } - */ } if (!movimentato) //_mov_ap e' di sicuro FALSE if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5) @@ -1736,7 +1714,8 @@ bool TStampaBilanciCDC_application::bil_verifica() //modifica del 21/11/95 if (saldo_iniziale > ZERO) _saldo_ini_dare = saldo_iniziale; - else _saldo_ini_avere = -saldo_iniziale; + else + _saldo_ini_avere = -saldo_iniziale; //fine if (_stampav == 1 && sld.significativo()) movimentato = TRUE; @@ -1753,16 +1732,6 @@ bool TStampaBilanciCDC_application::bil_verifica() _nuovo_tot_saldo_d += _mov_periodo_dare; _nuovo_tot_saldo_a += _mov_periodo_avere; - //modifica del 21/11/1995 - /* - if (saldo_iniziale > ZERO) - _nuovo_tot_saldo_d += saldo_iniziale; - else - { - real app = -saldo_iniziale; - _nuovo_tot_saldo_a += app; - } - */ _nuovo_tot_saldo_d += _saldo_ini_dare; _nuovo_tot_saldo_a += _saldo_ini_avere; //fine @@ -1784,173 +1753,140 @@ bool TStampaBilanciCDC_application::bil_verifica() } //se saldo_finale < 0 verra' stampato con una A, se no con una D } -/* -else -{ - movimentato = sld.ultima_immissione_verifica(_annoes,g,c,s,indbil_conto,_stampa_mov_prov); - - //modifica del 31/03/95 - if (_stampa_mov_prov != 3) - { - if (movimentato) - saldo_iniziale = sld.saldoini(); - if (!movimentato) - { - if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5) - { - saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s,FALSE,TRUE); - if (_stampav == 1 && sld.significativo()) - movimentato = TRUE; - } - } - } - //fine modifica - - if (movimentato || _stampav != 1) - { - _mov_periodo_dare = sld.prgdare(); - _mov_periodo_avere = sld.prgavere(); - _prg_prec_dare = ZERO; - _prg_prec_avere = ZERO; - - saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere; - } -} -*/ -if (movimentato || _stampav != 1) - if (!(saldo_finale == ZERO && _stampav == 2)) -{ - esiste_sc = TRUE; - esiste_conto = TRUE; - - if (_tipo_stampa1 == 2) + if (movimentato || _stampav != 1) + if (!(saldo_finale == ZERO && _stampav == 2)) { - _nuovo_tot_saldo_d += _mov_periodo_dare; - _nuovo_tot_saldo_a += _mov_periodo_avere; - real nuovo = sld.saldoinisusaldi(); - if (nuovo > ZERO) - _nuovo_tot_saldo_d += nuovo; - else + esiste_sc = TRUE; + esiste_conto = TRUE; + + if (_tipo_stampa1 == 2) { - nuovo = -nuovo; - _nuovo_tot_saldo_a += nuovo; + _nuovo_tot_saldo_d += _mov_periodo_dare; + _nuovo_tot_saldo_a += _mov_periodo_avere; + real nuovo = sld.saldoinisusaldi(); + if (nuovo > ZERO) + _nuovo_tot_saldo_d += nuovo; + else + { + nuovo = -nuovo; + _nuovo_tot_saldo_a += nuovo; + } } - } - //modifica del 21/11/1995 - /* - if (saldo_iniziale < ZERO) - _saldo_ini_conto_avere += saldo_iniziale; - else - _saldo_ini_conto_dare += saldo_iniziale; - */ - if (_tipo_stampa1 == 1 && _datada == _dataini) - { - _saldo_ini_conto_dare += _saldo_ini_dare; - _saldo_ini_conto_avere += _saldo_ini_avere; - } - else //_tipo_stampa1 == 1 || _tipo_stampa1 == 2 - { + //modifica del 21/11/1995 + /* if (saldo_iniziale < ZERO) _saldo_ini_conto_avere += saldo_iniziale; else _saldo_ini_conto_dare += saldo_iniziale; - } - - mov_conto_dare += _mov_periodo_dare; - mov_conto_avere += _mov_periodo_avere; - prg_conto_dare += _prg_prec_dare; - prg_conto_avere += _prg_prec_avere; - saldo_conto += saldo_finale; // somma pitagorica - - //scrivo il record relat. al sottoconto se non e' richiesto saldi di mastro - if (_verifica != 2) - { - _tmp_saldi_att->zero(); - _tmp_saldi_att->put(SLD_GRUPPO,g); - _tmp_saldi_att->put(SLD_CONTO,c); - _tmp_saldi_att->put(SLD_SOTTOCONTO,s); - _tmp_saldi_att->put(SLD_FLAGSALINI,tipo_conto); - - if ( (_datada == _dataini) || (_tipo_stampa1 != 1) ) - { - //modifica del 21/11/1995 - if (_datada == _dataini && _tipo_stampa1 == 1) - { - //_tmp_saldi_att->put(SLD_PDARESCA,_saldo_ini_dare); - //_tmp_saldi_att->put(SLD_PAVERESCA,_saldo_ini_avere); - _tmp_saldi_att->put(SLD_PDAREPRO,_saldo_ini_dare); // W96SALDI del 05-06-96 - _tmp_saldi_att->put(SLD_PAVEREPRO,_saldo_ini_avere); - } - else - { - if (saldo_iniziale > ZERO) //va stampato in Dare - _tmp_saldi_att->put(SLD_PDAREPRO,saldo_iniziale); // W96SALDI del 05-06-96 - //_tmp_saldi_att->put(SLD_PDARESCA,saldo_iniziale); - else if (saldo_iniziale < ZERO) - { - saldo_iniziale = -saldo_iniziale; - //_tmp_saldi_att->put(SLD_PAVERESCA,saldo_iniziale); - _tmp_saldi_att->put(SLD_PAVEREPRO,saldo_iniziale); // W96SALDI del 05-06-96 - } - } - } - else if (_datada > _dataini) - { - //_tmp_saldi_att->put(SLD_PDARESCA,_prg_prec_dare); - //_tmp_saldi_att->put(SLD_PAVERESCA,_prg_prec_avere); - _tmp_saldi_att->put(SLD_PDAREPRO,_prg_prec_dare); // W96SALDI del 05-06-96 - _tmp_saldi_att->put(SLD_PAVEREPRO,_prg_prec_avere); - } - _tmp_saldi_att->put(SLD_PDARE,_mov_periodo_dare); - _tmp_saldi_att->put(SLD_PAVERE,_mov_periodo_avere); - _tmp_saldi_att->put(SLD_SALDO,saldo_finale); - _tmp_saldi_att->put(SLD_DATAULMOV,_u_max); - _tmp_saldi_att->write(); - } - _gp = g; - _cp = c; -} - -TRecnotype recnum = _pcn->recno(); -_pcn->next(); -if (_pcn->eof()) -{ - if ( (_verifica == 2) && esiste_conto ) - { - //modifica del 21/11/1995 + */ if (_tipo_stampa1 == 1 && _datada == _dataini) { - _saldo_ini_gruppo_dare += _saldo_ini_conto_dare; - _saldo_ini_gruppo_avere += _saldo_ini_conto_avere; + _saldo_ini_conto_dare += _saldo_ini_dare; + _saldo_ini_conto_avere += _saldo_ini_avere; } - else - //fine + else //_tipo_stampa1 == 1 || _tipo_stampa1 == 2 { - real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere; - if (app < ZERO) - _saldo_ini_gruppo_avere += app; - else - _saldo_ini_gruppo_dare += app; - } - mov_gruppo_dare += mov_conto_dare; - mov_gruppo_avere += mov_conto_avere; - prg_gruppo_dare += prg_conto_dare; - prg_gruppo_avere += prg_conto_avere; - saldo_gruppo += saldo_conto; + if (saldo_iniziale < ZERO) + _saldo_ini_conto_avere += saldo_iniziale; + else + _saldo_ini_conto_dare += saldo_iniziale; + } + + mov_conto_dare += _mov_periodo_dare; + mov_conto_avere += _mov_periodo_avere; + prg_conto_dare += _prg_prec_dare; + prg_conto_avere += _prg_prec_avere; + saldo_conto += saldo_finale; // somma pitagorica - scrivi_record_gruppo(prg_gruppo_dare,prg_gruppo_avere, - mov_gruppo_dare,mov_gruppo_avere,saldo_gruppo); + //scrivo il record relat. al sottoconto se non e' richiesto saldi di mastro + if (_verifica != 2) + { + _tmp_saldi_att->zero(); + _tmp_saldi_att->put(SLD_GRUPPO,g); + _tmp_saldi_att->put(SLD_CONTO,c); + _tmp_saldi_att->put(SLD_SOTTOCONTO,s); + _tmp_saldi_att->put(SLD_FLAGSALINI,tipo_conto); + + if ( (_datada == _dataini) || (_tipo_stampa1 != 1) ) + { + //modifica del 21/11/1995 + if (_datada == _dataini && _tipo_stampa1 == 1) + { + //_tmp_saldi_att->put(SLD_PDARESCA,_saldo_ini_dare); + //_tmp_saldi_att->put(SLD_PAVERESCA,_saldo_ini_avere); + _tmp_saldi_att->put(SLD_PDAREPRO,_saldo_ini_dare); // W96SALDI del 05-06-96 + _tmp_saldi_att->put(SLD_PAVEREPRO,_saldo_ini_avere); + } + else + { + if (saldo_iniziale > ZERO) //va stampato in Dare + _tmp_saldi_att->put(SLD_PDAREPRO,saldo_iniziale); // W96SALDI del 05-06-96 + //_tmp_saldi_att->put(SLD_PDARESCA,saldo_iniziale); + else if (saldo_iniziale < ZERO) + { + saldo_iniziale = -saldo_iniziale; + //_tmp_saldi_att->put(SLD_PAVERESCA,saldo_iniziale); + _tmp_saldi_att->put(SLD_PAVEREPRO,saldo_iniziale); // W96SALDI del 05-06-96 + } + } + } + else if (_datada > _dataini) + { + //_tmp_saldi_att->put(SLD_PDARESCA,_prg_prec_dare); + //_tmp_saldi_att->put(SLD_PAVERESCA,_prg_prec_avere); + _tmp_saldi_att->put(SLD_PDAREPRO,_prg_prec_dare); // W96SALDI del 05-06-96 + _tmp_saldi_att->put(SLD_PAVEREPRO,_prg_prec_avere); + } + _tmp_saldi_att->put(SLD_PDARE,_mov_periodo_dare); + _tmp_saldi_att->put(SLD_PAVERE,_mov_periodo_avere); + _tmp_saldi_att->put(SLD_SALDO,saldo_finale); + _tmp_saldi_att->put(SLD_DATAULMOV,_u_max); + _tmp_saldi_att->write(); + } + _gp = g; + _cp = c; } - if (esiste_sc) - if ( (_verifica == 1)||( (_verifica == 2)&& - (!((_stampav == 2)&&(saldo_conto == 0))) ) ) - scrivi_record_conto(prg_conto_dare,prg_conto_avere,mov_conto_dare, - mov_conto_avere,saldo_conto); -} -_pcn->readat(recnum); -} -return TRUE; + + TRecnotype recnum = _pcn->recno(); + _pcn->next(); + if (_pcn->eof()) + { + if ( (_verifica == 2) && esiste_conto ) + { + //modifica del 21/11/1995 + if (_tipo_stampa1 == 1 && _datada == _dataini) + { + _saldo_ini_gruppo_dare += _saldo_ini_conto_dare; + _saldo_ini_gruppo_avere += _saldo_ini_conto_avere; + } + else + //fine + { + real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere; + if (app < ZERO) + _saldo_ini_gruppo_avere += app; + else + _saldo_ini_gruppo_dare += app; + } + mov_gruppo_dare += mov_conto_dare; + mov_gruppo_avere += mov_conto_avere; + prg_gruppo_dare += prg_conto_dare; + prg_gruppo_avere += prg_conto_avere; + saldo_gruppo += saldo_conto; + + scrivi_record_gruppo(prg_gruppo_dare,prg_gruppo_avere, + mov_gruppo_dare,mov_gruppo_avere,saldo_gruppo); + } + if (esiste_sc) + if ( (_verifica == 1)||( (_verifica == 2)&& + (!((_stampav == 2)&&(saldo_conto == 0))) ) ) + scrivi_record_conto(prg_conto_dare,prg_conto_avere,mov_conto_dare, + mov_conto_avere,saldo_conto); + } + _pcn->readat(recnum); + } + return TRUE; } //bilancio di verifica per data limite @@ -1992,14 +1928,12 @@ bool TStampaBilanciCDC_application::calcola(int g, int c, long s) if (rmov.curr() != rec) break; - annoe = rmov.get_int(RMV_ANNOES); - data = rmov.get_date(RMV_DATAREG); - num_reg = rmov.get_long(RMV_NUMREG); + annoe = rmov.get_int(RMV_ANNOES); + data = rmov.get_date(RMV_DATAREG); + num_reg = rmov.get_long(RMV_NUMREG); - if (_cdc_cod != 0L) - if (_cdc_cod != rmov.get_long(RMV_NUMGIO)) - continue; - + if (_cdc_cod != 0L && _cdc_cod != rmov.get_long(RMV_CDC)) + continue; mov.setkey(1); mov.put(MOV_NUMREG, num_reg); @@ -2068,7 +2002,8 @@ bool TStampaBilanciCDC_application::calcola(int g, int c, long s) { if (sezione == 'D') _prg_prec_dare += importo; - else _prg_prec_avere += importo; + else + _prg_prec_avere += importo; _u_max = fnc_max(_u_max, data); conto_mov = TRUE; } @@ -2112,6 +2047,7 @@ bool TStampaBilanciCDC_application::ricerca_cf(int g,int c,char tipocf,int ib, r //modifica del 19/06. Vedi appunti per capire bool movimentato = calcola(g,c,s); +/* if (_stampa_mov_prov != 3) { if (movimentato) @@ -2140,25 +2076,32 @@ bool TStampaBilanciCDC_application::ricerca_cf(int g,int c,char tipocf,int ib, r //modifica del 21/11/1995 if (saldo_iniziale > ZERO) _saldo_ini_dare = saldo_iniziale; - else _saldo_ini_avere = -saldo_iniziale; + else + _saldo_ini_avere = -saldo_iniziale; //fine } } } } - if (!movimentato) + else + { if (ib == 1 || ib == 2 || ib == 5) if (_annoes != 0) //cioe' se sto ragionando per competenza { saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s); //modifica del 21/11/1995 - if (saldo_iniziale > ZERO) + if (saldo_iniziale >= ZERO) _saldo_ini_dare = saldo_iniziale; - else _saldo_ini_avere = -saldo_iniziale; + else + _saldo_ini_avere = -saldo_iniziale; //fine movimentato = sld.significativo(); } + } } +*/ + // Saldo iniziale è sempre nullo per centri di costo + _saldo_ini_dare = _saldo_ini_avere = saldo_iniziale = ZERO; if (!movimentato) continue; @@ -2196,58 +2139,58 @@ bool TStampaBilanciCDC_application::ricerca_cf(int g,int c,char tipocf,int ib, r //se saldo_finale < 0 verra' stampato con una A, se no con una D } - else - { - //Attenzione! Nel caso di "tutti i conti" devono scendere solo i cli/for movimentati!!! + else + { + //Attenzione! Nel caso di "tutti i conti" devono scendere solo i cli/for movimentati!!! - //modifica del 31/03/1995 - bool movimentato = sld.ultima_immissione_verifica(_annoes,g,c,s,ib,_stampa_mov_prov); - - if (_stampa_mov_prov != 3) - { - saldo_iniziale = sld.saldoini(); - if (!movimentato) - { - //if (_stampav == 1) - // continue; - //vado sui saldi con l'anno precedente e calcolo saldo_finale es.prec - //se esiste tale record e almeno un valore e' significativo (indipendentemente dal valore - //del saldo iniziale calcolato, allora metto a TRUE il flag movimentato - //solo se e' un conto patrimoniale - if (ib == 1 || ib == 2 || ib == 5) - { - saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s,FALSE); - movimentato = sld.significativo(); - } - } - } + //modifica del 31/03/1995 + bool movimentato = sld.ultima_immissione_verifica(_annoes,g,c,s,ib,_stampa_mov_prov); + if (_stampa_mov_prov != 3) + { + saldo_iniziale = sld.saldoini(); if (!movimentato) - continue; - //fine modifica 31/03/1995 - - _mov_periodo_dare = sld.prgdare(); - _mov_periodo_avere = sld.prgavere(); - _prg_prec_dare = ZERO; - _prg_prec_avere = ZERO; - - saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere; - - if (saldo_finale == ZERO) - if (_stampav == 2) - continue; - - _nuovo_tot_saldo_d += _mov_periodo_dare; - _nuovo_tot_saldo_a += _mov_periodo_avere; - real nuovo = sld.saldoinisusaldi(); - if (nuovo > ZERO) - _nuovo_tot_saldo_d += nuovo; - else { - nuovo = -nuovo; - _nuovo_tot_saldo_a += nuovo; - } + //if (_stampav == 1) + // continue; + //vado sui saldi con l'anno precedente e calcolo saldo_finale es.prec + //se esiste tale record e almeno un valore e' significativo (indipendentemente dal valore + //del saldo iniziale calcolato, allora metto a TRUE il flag movimentato + //solo se e' un conto patrimoniale + if (ib == 1 || ib == 2 || ib == 5) + { + saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s,FALSE); + movimentato = sld.significativo(); + } + } } + + if (!movimentato) + continue; + //fine modifica 31/03/1995 + + _mov_periodo_dare = sld.prgdare(); + _mov_periodo_avere = sld.prgavere(); + _prg_prec_dare = ZERO; + _prg_prec_avere = ZERO; + + saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere; + + if (saldo_finale == ZERO) + if (_stampav == 2) + continue; + + _nuovo_tot_saldo_d += _mov_periodo_dare; + _nuovo_tot_saldo_a += _mov_periodo_avere; + real nuovo = sld.saldoinisusaldi(); + if (nuovo > ZERO) + _nuovo_tot_saldo_d += nuovo; + else + { + nuovo = -nuovo; + _nuovo_tot_saldo_a += nuovo; + } + } esiste_sc = TRUE; @@ -2318,6 +2261,7 @@ bool TStampaBilanciCDC_application::ricerca_cf(int g,int c,char tipocf,int ib, r } } delete _lista; + _lista = NULL; return esiste_sc; } diff --git a/cg/cgpim.cpp b/cg/cgpim.cpp index 0ccff7e4f..939c6b9f2 100755 --- a/cg/cgpim.cpp +++ b/cg/cgpim.cpp @@ -5,7 +5,7 @@ // funzione per classificare i PIM e sommare tutto cio' che contengono #include "cgpim.h" -bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t, bool tipost) +bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool tipost) { static int last_checked = -1; diff --git a/cg/cgpim.h b/cg/cgpim.h index 6ef17d768..1aaa30f1a 100755 --- a/cg/cgpim.h +++ b/cg/cgpim.h @@ -82,6 +82,6 @@ const int MAX_TIPOREC = 19; // CONTENTA? ciao, f. :) // ----------------------------------------------------------- -bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t, bool ts); +bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool ts); #endif diff --git a/cg/cgsaldac.cpp b/cg/cgsaldac.cpp index 87c63342d..7edc10895 100755 --- a/cg/cgsaldac.cpp +++ b/cg/cgsaldac.cpp @@ -656,7 +656,7 @@ int TRiga_partite::read(TBaseisamfile& f, word op, word lock) // Certified 100% int TRiga_partite::write(TBaseisamfile& f) const { - const int err = is_fattura() ? TTree_rectype::write(f) : TRectype::write(f); + const int err = is_fattura() ? TTree_rectype::write(f) : TRectype::write(f); return err; } diff --git a/cg/lf0027.txt b/cg/lf0027.txt index a0e89b7e8..9bcf95604 100755 --- a/cg/lf0027.txt +++ b/cg/lf0027.txt @@ -10,7 +10,7 @@ A01|3|7|1|12|ERARIO C/ACQUISTI||D|| | A02|1|34|1||||D|F| | A02|2|60|||||A|| | A02|3|7|1|12|||A|| | -A03|1|34|||DEBITI V/FORNITORI||A|| | +A03|1|34|1||DEBITI V/FORNITORI||A|| | A03|2|60|||||D|| | A03|3|7|1|12|ERARIO C/ACQUISTI||D|| | A04|1|34|1||||A|F| | diff --git a/db/db1100.cpp b/db/db1100.cpp index 48d6a0c9a..2779392db 100755 --- a/db/db1100.cpp +++ b/db/db1100.cpp @@ -49,7 +49,7 @@ struct _ParmStruct int _year, _periods, _det_lev, _ordering; bool _last_qta, _vis_art, _vis_lav, _vis_vir, _vis_gho, - _fabbisogno, _no_fabbis_fin, + _fabbisogno, _no_fabbis_fin, _no_zero_ord, _val_magmb, _val_depmb, _newpage, _det_ord_for, _separate_dist, _separate_giac; char _liv_attenzione; @@ -87,7 +87,7 @@ protected: void calc_ordinato_fornitori(_ParmStruct *p, const char * codmag, const char * livello); void calcola_ordinato_documento(TRectype& rec); public: - const real ordinato_fornitori(const int p); // ritorna l'ordinato fornitori per il periodo indicato + const real & ordinato_fornitori(const int p); // ritorna l'ordinato fornitori per il periodo indicato const real get_scmin(const char * annoes, const char * codmag, const char * livello); real& static_disp(_ParmStruct* p, const char * codmag, const char * livello); TArticolo_giacenza_static(const char* codice = NULL); @@ -139,7 +139,7 @@ class TRiga_esplosione2print : public TRiga_esplosione real _ordfor; real _totordfor; TDate _dtacons; - TString _codmag; + TString8 _codmag; public: const TString& mag() const { return _codmag; } @@ -180,26 +180,31 @@ TRiga_esplosione2print::TRiga_esplosione2print(const TRiga_esplosione& re, const } /////////////////////////////////////////////////////////// -// _Dist2Explode +// TDist2Explode /////////////////////////////////////////////////////////// -class _Dist2Explode : public TObject +class TDist2Explode : public TObject { TCodice_articolo _cod; TString16 _livgiac; TCodice_um _um; - TString16 _mag; + TString8 _imp, _lin, _mag; real _qta; TDate _datacons; TDate _data_per; // Data limite del periodo del quale fa parte questa distinta da esplodere bool _acq_ven; + +protected: + void set(const TMask& msk); public: TRiga_esplosione* head_obj(); - void set(const TRiga_documento& r); - void set(TToken_string& t); + void set(const TRiga_documento& r, const TMask& msk); + void set(TToken_string& t, const TMask& msk); void set_cod(const char* c) { _cod = c; } - void set_liv(const char* l) { _livgiac = l;} - void set_mag(const char* m) { _mag = m;} + void set_liv(const char* l) { _livgiac = l; } + void set_imp(const char* i) { _imp = i; } + void set_lin(const char* l) { _lin = l; } + void set_mag(const char* m) { _mag = m; } void set_um (const char* u) { _um = u;} void set_qta(const real& q) { _qta = q;} void set_datacons(const TDate& d) { _datacons = d; } @@ -208,13 +213,15 @@ public: const TDate& datacons() { return _datacons;} const TDate& data_per() { return _data_per;} const bool& acqven() { return _acq_ven; } + const TString& imp() { return _imp; } + const TString& lin() { return _lin; } const TString& mag() { return _mag; } const TCodice_um& um() { return _um; } const TString& liv() { return _livgiac; } const TCodice_articolo& cod() { return _cod; } const char * key(); - _Dist2Explode () {}; - virtual ~_Dist2Explode() {}; + TDist2Explode () {}; + virtual ~TDist2Explode() {}; }; /////////////////////////////////////////////////////////// @@ -230,7 +237,7 @@ class TExplode_distinta_form : public TForm TAssoc_array _prodorder; // Righe dei residui (solo semilavorati/nodi) TAssoc_array _prodordert; // Righe dei residui (solo semilavorati/nodi) TAssoc_array _disponib; // Righe dei residui (solo semilavorati/nodi) - _Dist2Explode *_d; // Distinta corrente da esplodere + TDist2Explode *_d; // Distinta corrente da esplodere _ParmStruct *_p; // Struttura dei parametri int _curr_row; // Riga corrente della distinta esplosa da stampare @@ -246,7 +253,7 @@ protected: public: void print_explosion_rows(); void reset_rows(bool firsttime = TRUE); - void set_distinta(_Dist2Explode* dd) { _d = dd; } + void set_distinta(TDist2Explode* dd) { _d = dd; } void set_parameters(_ParmStruct* ps); void explode_and_print(); void reset_cache() { _art_cache.destroy(); } @@ -420,11 +427,11 @@ TArticolo_giacenza_static::TArticolo_giacenza_static(const TRectype& rec) { } -const real TArticolo_giacenza_static::ordinato_fornitori(const int p) +const real & TArticolo_giacenza_static::ordinato_fornitori(const int p) { // con p ==0 ritorna il totale ordinato fornitori - const real r = (real&)_ordinato_fornitori[p]; - return r; + const real * r = (real *)_ordinato_fornitori.objptr(p); + return r ? *r : ZERO; } const real TArticolo_giacenza_static::get_scmin(const char * annoes, const char * codmag, const char * livello) @@ -472,8 +479,7 @@ void TArticolo_giacenza_static::calcola_ordinato_documento(TRectype& rec) for (cur = 0L; cur.pos() < items; ++cur) { // Calcola la qta residua - if (pi) - pi->addstatus(1L); + if (pi) pi->addstatus(1L); TRectype& rec = cur.curr(); if (!rec.get_bool(RDOC_RIGAEVASA)) @@ -1057,6 +1063,10 @@ void TExplode_distinta_form::reset_rows(bool firsttime) void TExplode_distinta_form::explode_and_print() { // Explode & deflagrate... + + _distinta.clear_globals(); + _distinta.set_global("_IMPIANTO", _d->imp()); + _distinta.set_global("_LINEA", _d->lin()); if (!_distinta.set_root(_d->cod(), _d->um(), 1.0, _d->liv())) return; @@ -1165,12 +1175,18 @@ void TExplode_distinta_form::print_explosion_rows() // This is GoodStuff... browse all rows & print'em for (_curr_row=0; _curr_row_fabbisogno && _p->_no_zero_ord) + { + const real fabb = body.find_field(8).get(); + if (fabb.is_zero()) + continue; + } const word h = body.height(); + if (pr.rows_left() <= (h+1)) + pr.formfeed(); for (word j = 0; j < h; j++) pr.print(body.row(j)); } @@ -1189,68 +1205,73 @@ void TExplode_distinta_form::print_explosion_rows() } /////////////////////////////////////////////////////////// -// _Dist2Explode -// . +// TDist2Explode /////////////////////////////////////////////////////////// // // Implementation of base object used in skantacazz 2 be stored in a TAssoc_array so we can order it // -TRiga_esplosione * _Dist2Explode::head_obj() +TRiga_esplosione * TDist2Explode::head_obj() { - TQuantita qta(_cod, _um, real(1.00)); - TDistinta_tree tree; + TQuantita qta(_cod, _um, real(1.00)); tree.set_root(qta, liv()); - TRiga_esplosione * re = new TRiga_esplosione(tree); - - //re->set(_cod, _um, real(1.00)); - //re->set_tipo('A'); // La testata e' cmq un articolo... - //re->set_path(_cod); - //re->set_giacenza(liv()); - return re; } -void _Dist2Explode::set(const TRiga_documento& r) +void TDist2Explode::set(const TMask& msk) +{ + if (_imp.blank()) + _imp = msk.get(F_IMPIANTO); + if (_lin.blank()) + _lin = msk.get(F_LINEA); +} + +void TDist2Explode::set(const TRiga_documento& r, const TMask& msk) { _cod = r.get(RDOC_CODART); _livgiac = r.get(RDOC_LIVELLO); _um = r.get(RDOC_UMQTA); _mag = r.get(RDOC_CODMAG); + _imp = r.get(RDOC_IMPIANTO); + _lin = r.get(RDOC_LINEA); _qta = r.get_real("QTARES"); // Virtual field... must exist!! _datacons = r.get_date(RDOC_DATACONS); if (!_datacons.ok()) _datacons = r.doc().get_date(DOC_DATACONS); _acq_ven = r.doc().get(DOC_TIPOCF) == "F" ? TRUE : FALSE; _data_per = app().date_period(_datacons); + set(msk); } -void _Dist2Explode::set(TToken_string& t) +void TDist2Explode::set(TToken_string& t, const TMask& msk) { _cod = t.get(0); _livgiac = t.get(1); _livgiac << t.get(2); _livgiac << t.get(3); _livgiac << t.get(4); - _livgiac.trim(); - _mag.format("%3s", (const char*)t.get(5)); - _mag << t.get(6); + _livgiac.trim(); + _imp = t.get(5); + _lin = t.get(6); + _mag.format("%3s", (const char*)t.get(7)); + _mag << t.get(8); _mag.trim(); - _um = t.get(7); - _qta = t.get(8); - _datacons = t.get(10); - _acq_ven = t.get(11)[0] == 'X' ? TRUE : FALSE; + _um = t.get(9); + _qta = t.get(10); + _datacons = t.get(12); + _acq_ven = t.get(13)[0] == 'X' ? TRUE : FALSE; _data_per = app().date_period(_datacons); + set(msk); } -const char* _Dist2Explode::key() +const char* TDist2Explode::key() { - __key.format("%d%-20s%-15s%-2s%-5s", + __key.format("%3d%-20s%-15s%-2s%-5s%-5s%-5s", app().date2period(_datacons), (const char*)_cod, (const char*) _livgiac, - (const char*)_um, (const char*) _mag); - return (const char*) __key; + (const char*)_um, (const char*)_mag, (const char*)_imp, (const char*)_lin); + return (const char*)__key; } /////////////////////////////////////////////////////////////////// @@ -1308,10 +1329,8 @@ bool TEsplosione_distinta_app::check_articoli(TMask_field& f, KEY k) for (int i = 0; i < items; i++) if (i != selected && !s.row(i).empty_items()) // Articolo/unita' di misura gia' usata... chiede se gabolarli assieme... { - TCodice_articolo art; - TCodice_um u; - art = s.row(i).get(0); - u = s.row(i).get(7); + const TCodice_articolo art = s.row(i).get(0); + const TCodice_um u = s.row(i).get(7); if (articolo == art && um == u) { ok = f.yesno_box("L'articolo %s (UM %s) e' gia' stato utilizzato al rigo %d.\n" @@ -1354,6 +1373,8 @@ bool TEsplosione_distinta_app::create() _mask->set(F_VIRTUALI, "X"); if (!livelli_giacenza().enabled()) //TBI _mask->hide(F_SEPARATE_GIAC); + + rec_cache(LF_TAB).test_file_changes(FALSE); @@ -1380,6 +1401,8 @@ bool TEsplosione_distinta_app::create() const bool listini = conf.get_bool("GES", "ve", 1); _mask->enable(-G_LISTINO, listini); _mask->enable(F_CATVEN_LIST, listini && conf.get_bool("GESLISCV", "ve")); + _mask->set(F_IMPIANTO, conf.get("DEFAULT_CODIMP", "mr")); + _mask->set(F_LINEA, conf.get("DEFAULT_CODLIN", "mr")); _doc = new TDocumento; @@ -1452,11 +1475,13 @@ void TEsplosione_distinta_app::compile_list() TSheet_field& sa = (TSheet_field&) _mask->field(F_SHEETART); const int righe = sa.items(); - TProgind p(items+righe,"Estrazione distinte da esplodere...", FALSE, TRUE); + TProgind p(items+righe,"Estrazione distinte da esplodere...", TRUE, TRUE); c.freeze(); for (c = 0L; c.pos() < items; ++c) { p.addstatus(1); + if (p.iscancelled()) + break; if (doc.read(c.curr()) == NOERR) { const int rows = doc.rows(); @@ -1465,13 +1490,13 @@ void TEsplosione_distinta_app::compile_list() dist.put("CODDIST", doc[i].get(RDOC_CODART)); if (doc[i].is_articolo() && dist.read() == NOERR) // Aggiunge le righe che sono solo effettivamente articoli di magazzino e distinte { - _Dist2Explode * de = new _Dist2Explode; - de->set(doc[i]); + TDist2Explode * de = new TDist2Explode; + de->set(doc[i], *_mask); key = de->key(); const bool is_key = _dist_list.is_key(key); if (is_key) { - _Dist2Explode * dd = (_Dist2Explode*)_dist_list.objptr(key); + TDist2Explode * dd = (TDist2Explode*)_dist_list.objptr(key); // Check whether we've 2 convert in base UM... if (de->acqven()) // Se acquisto sottrae... de->qta() = dd->qta() - de->qta(); @@ -1492,13 +1517,13 @@ void TEsplosione_distinta_app::compile_list() p.addstatus(1L); if (!sa.row(i).empty_items()) { - _Dist2Explode * de = new _Dist2Explode; - de->set(sa.row(i)); + TDist2Explode * de = new TDist2Explode; + de->set(sa.row(i), *_mask); key = de->key(); const bool is_key = _dist_list.is_key(key); if (is_key) { - _Dist2Explode * dd = (_Dist2Explode*)_dist_list.objptr(key); + TDist2Explode * dd = (TDist2Explode*)_dist_list.objptr(key); // Check 2 see whether we've 2 convert in base UM... if (de->acqven()) // Se acquisto sottrae... de->qta() = dd->qta() - de->qta(); @@ -1611,7 +1636,7 @@ void TEsplosione_distinta_app::print() for (int i = 0 ; iset_distinta((_Dist2Explode*)_dist_list.objptr(chiave)); // Setta la distinta corrente + _form->set_distinta((TDist2Explode*)_dist_list.objptr(chiave)); // Setta la distinta corrente _form->explode_and_print(); // Esplode & Stampa sta distinta #ifdef DBG unsigned long h, m; @@ -1662,12 +1687,14 @@ void TEsplosione_distinta_app::main_loop() _parameters._periods = _mask->get_int(F_PERIODS); _parameters._det_lev = _mask->get_int(F_DETTAGLIO); _parameters._ordering = _mask->get_int(F_SORT); + if (_mask->get_bool(F_NOIGNORE)) _parameters._ordering *= -1; _parameters._vis_art = _mask->get_bool(F_ARTICOLI); _parameters._vis_vir = _mask->get_bool(F_VIRTUALI); _parameters._vis_lav = _mask->get_bool(F_LAVORAZIONI); _parameters._vis_gho = _mask->get_bool(F_GHOST); _parameters._fabbisogno= _mask->get_bool(F_FABBISOGNO); _parameters._no_fabbis_fin= _mask->get_bool(F_FABBISOGNO_FIN); + _parameters._no_zero_ord = _mask->get_bool(F_NOZEROORD); _parameters._sl_mag = _mask->get(F_SLMAG); _parameters._sl_mag << _mask->get(F_SLDEP); _parameters._mb_mag = _mask->get(F_MBMAG); _parameters._mb_mag << _mask->get(F_MBDEP); _parameters._val_magmb = _mask->get_bool(F_VALMAGMB); diff --git a/db/db1100a.frm b/db/db1100a.frm index ed604f110..4470e0a5a 100755 --- a/db/db1100a.frm +++ b/db/db1100a.frm @@ -145,17 +145,18 @@ BEGIN PICTURE "########,@@@@@" END -VALUTA 10 14 +VALUTA 10 15 BEGIN SPECIAL STRINGA INTESTAZIONE "@cValore" "Valore" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" KEY "Valore" PROMPT 10 1 "" + FLAGS "U" MESSAGE _DISTINTA,_VALORE END -VALUTA 11 14 +VALUTA 11 15 BEGIN SPECIAL STRINGA INTESTAZIONE "@cValore Unitario" "Valore Unitario" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" diff --git a/db/db1100a.h b/db/db1100a.h index 00ac52740..00acd1c75 100755 --- a/db/db1100a.h +++ b/db/db1100a.h @@ -41,19 +41,27 @@ #define F_INPRC4DISP 139 #define F_CATVEN_LIST 140 #define F_CODLIST 141 +#define F_NOIGNORE 142 +#define F_NOZEROORD 143 +#define F_IMPIANTO 144 +#define F_DESCIMP 145 +#define F_LINEA 146 +#define F_DESCLIN 147 #define F_CODDIS 101 #define F_LIV1 102 #define F_LIV2 103 #define F_LIV3 104 #define F_LIV4 105 -#define F_MAG 106 -#define F_DEP 107 -#define F_UMEXPR 108 -#define F_QTA 109 -#define F_DESCR 110 -#define F_DATACONS 111 -#define F_ACQUISTO 112 +#define F_IMP 106 +#define F_LIN 107 +#define F_MAG 108 +#define F_DEP 109 +#define F_UMEXPR 110 +#define F_QTA 111 +#define F_DESCR 112 +#define F_DATACONS 113 +#define F_ACQUISTO 114 #define GR_NUMDOC 1 #define GR_DATADOC 2 diff --git a/db/db1100a.uml b/db/db1100a.uml index 14de95da1..2d0ec44ee 100755 --- a/db/db1100a.uml +++ b/db/db1100a.uml @@ -177,32 +177,75 @@ END GROUPBOX DLG_NULL 30 6 BEGIN - PROMPT 1 11 "Esplodi" + PROMPT 1 10 "Esplodi" END BOOLEAN F_ARTICOLI BEGIN - PROMPT 2 12 "Articoli" + PROMPT 2 11 "Articoli" END BOOLEAN F_LAVORAZIONI BEGIN - PROMPT 2 13 "Lavorazioni" + PROMPT 2 12 "Lavorazioni" END BOOLEAN F_VIRTUALI BEGIN - PROMPT 2 14 "Distinte virtuali" + PROMPT 2 13 "Distinte virtuali" END BOOLEAN F_GHOST BEGIN - PROMPT 2 15 "Distinte non di produzione" + PROMPT 2 14 "Distinte non di produzione" +END + +GROUPBOX DLG_NULL 50 6 +BEGIN + PROMPT 32 10 "Default" +END + +STRING F_IMPIANTO 5 +BEGIN + PROMPT 33 11 "Impianto " + FLAGS "U" + USE IMP + INPUT CODTAB F_IMPIANTO + DISPLAY "Codice" CODTAB + DISPLAY "Desrizione@50" S0 + OUTPUT F_IMPIANTO CODTAB + OUTPUT F_DESCIMP S0 + CHECKTYPE NORMAL +END + +STRING F_DESCIMP 50 47 +BEGIN + PROMPT 33 12 "" + FLAGS "D" +END + +STRING F_LINEA 5 +BEGIN + PROMPT 33 13 "Linea " + FLAGS "U" + USE LNP + INPUT CODTAB F_LINEA + DISPLAY "Codice" CODTAB + DISPLAY "Desrizione@50" S0 + OUTPUT F_LINEA CODTAB + OUTPUT F_DESCLIN S0 + CHECKTYPE NORMAL +END + +STRING F_DESCLIN 50 47 +BEGIN + PROMPT 33 14 "" + FLAGS "D" END NUMBER F_SORT 1 BEGIN - PROMPT 2 17 "Ordina " + PROMPT 2 16 "Ordina " USE ORD INPUT CODTAB F_SORT DISPLAY "Codice ordinamento" CODTAB @@ -211,15 +254,21 @@ BEGIN OUTPUT F_SORTDESC S0 CHECKTYPE NORMAL FLAGS "U" - MESSAGE EMPTY "Immissione",F_SORTDESC + MESSAGE EMPTY "Immissione",F_SORTDESC|CLEAR,F_NOIGNORE + MESSAGE ENABLE,F_NOIGNORE END STRING F_SORTDESC 50 BEGIN - PROMPT 17 17 "" + PROMPT 17 16 "" FLAGS "D" END +BOOLEAN F_NOIGNORE +BEGIN + PROMPT 2 17 "Includi anche righe senza un ordinamento specificato" +END + LIST F_GROUPMODE 1 53 BEGIN PROMPT 2 18 "Raggruppa " @@ -234,6 +283,7 @@ END ENDPAGE PAGE "Disponibilita'" -1 -1 78 20 + BOOLEAN F_FABBISOGNO BEGIN PROMPT 2 2 "Calcola disponibilita'" @@ -241,10 +291,11 @@ BEGIN MESSAGE FALSE CLEAR,G_DISPONIB@|CLEAR,6@ END -GROUPBOX DLG_NULL 50 8 +GROUPBOX DLG_NULL 50 9 BEGIN PROMPT 2 2 "" END + LIST F_LIVATTENZ 26 BEGIN PROMPT 3 3 "Segnala giacenza " @@ -260,37 +311,44 @@ BEGIN GROUP G_DISPONIB END +BOOLEAN F_NOZEROORD +BEGIN + PROMPT 3 5 "Non stampare righe con fabbisogno nullo" + GROUP G_DISPONIB + FLAGS "D" +END + BOOLEAN F_ORCLI4DISP BEGIN - PROMPT 3 5 "Sottrai l'ordinato clienti" + PROMPT 3 6 "Sottrai l'ordinato clienti" // GROUP G_DISPONIB FLAGS "D" END BOOLEAN F_ORFOR4DISP BEGIN - PROMPT 3 6 "Aggiungi l'ordinato fornitori" + PROMPT 3 7 "Aggiungi l'ordinato fornitori" // GROUP G_DISPONIB FLAGS "D" END BOOLEAN F_INPRF4DISP BEGIN - PROMPT 3 7 "Aggiungi i finiti in produzione" + PROMPT 3 8 "Aggiungi i finiti in produzione" // GROUP G_DISPONIB FLAGS "D" END BOOLEAN F_INPRC4DISP BEGIN - PROMPT 3 8 "Sottrai i componenti in produzione" + PROMPT 3 9 "Sottrai i componenti in produzione" // GROUP G_DISPONIB FLAGS "D" END LISTBOX F_VALORIZZAZIONE 32 BEGIN - PROMPT 3 10 "" + PROMPT 3 11 "" ITEM "0|Non valorizzare" MESSAGE HIDE,G_LISTINO@ ITEM "1|Valorizza Ultimo costo" @@ -317,7 +375,7 @@ END STRING F_CATVEN_LIST 2 BEGIN - PROMPT 3 11 "Cat.vendita " + PROMPT 3 12 "Cat.vendita " USE CVE INPUT CODTAB F_CATVEN_LIST DISPLAY "Codice" CODTAB @@ -331,7 +389,7 @@ END STRING F_CODLIST 3 BEGIN - PROMPT 25 11 "Cod.listino " + PROMPT 25 12 "Cod.listino " USE LF_CONDV SELECT TIPO=="L" INPUT TIPO "L" INPUT CATVEN F_CATVEN_LIST @@ -348,12 +406,12 @@ END GROUPBOX DLG_NULL 50 6 BEGIN - PROMPT 2 12 "Disponibilita' & Valorizzazione" + PROMPT 2 13 "Disponibilita' & Valorizzazione" END STRING F_SLMAG 3 BEGIN - PROMPT 3 13 "Mag. semilavorati " + PROMPT 3 14 "Mag. semilavorati " FLAGS "U" USE MAG SELECT CODTAB[4,5]=="" INPUT CODTAB F_SLMAG @@ -366,7 +424,7 @@ END STRING F_SLDEP 2 BEGIN - PROMPT 32 13 "" + PROMPT 32 14 "" FLAGS "U" USE MAG SELECT (IF(#F_SLMAG!="";((CODTAB[1,3]==#F_SLMAG)&&(CODTAB[4,5]!=""));(CODTAB[4,5]!=""))) INPUT CODTAB[1,3] F_SLMAG SELECT @@ -382,7 +440,7 @@ END STRING F_MBMAG 3 BEGIN - PROMPT 3 14 "Mag. materiali base " + PROMPT 3 15 "Mag. materiali base " FLAGS "U" USE MAG SELECT CODTAB[4,5]=="" INPUT CODTAB F_MBMAG @@ -397,7 +455,7 @@ END STRING F_MBDEP 2 BEGIN - PROMPT 32 14 "" + PROMPT 32 15 "" FLAGS "U" USE MAG SELECT (IF(#F_MBMAG!="";((CODTAB[1,3]==#F_MBMAG)&&(CODTAB[4,5]!=""));(CODTAB[4,5]!=""))) INPUT CODTAB[1,3] F_MBMAG SELECT @@ -415,7 +473,7 @@ END BOOLEAN F_VALMAGMB BEGIN - PROMPT 3 15 "Usa magazzino in valorizzazione" + PROMPT 3 16 "Usa magazzino in valorizzazione" MESSAGE TRUE ENABLE,F_VALDEPMB MESSAGE FALSE CLEAR,F_VALDEPMB GROUP G_VALORIZZ @@ -423,16 +481,15 @@ END BOOLEAN F_VALDEPMB BEGIN - PROMPT 3 16 "Usa deposito in valorizzazione" + PROMPT 3 17 "Usa deposito in valorizzazione" GROUP G_DEPOSITI G_VALORIZZ END BOOLEAN F_DETORDFOR BEGIN - PROMPT 2 18 "Dettaglia ordinato fornitori" + PROMPT 3 19 "Dettaglia ordinato fornitori" END - ENDPAGE PAGE "Articoli" -1 -1 78 20 @@ -445,6 +502,8 @@ BEGIN ITEM "Liv2" ITEM "Liv3" ITEM "Liv4" + ITEM "Imp." + ITEM "Lin." ITEM "Mag." ITEM "Dep." ITEM "UM@3" @@ -535,9 +594,33 @@ BEGIN CHECKTYPE NORMAL END +STRING F_IMP 5 +BEGIN + PROMPT 2 6 "Impianto " + FLAGS "U" + USE IMP + INPUT CODTAB F_IMP + DISPLAY "Codice" CODTAB + DISPLAY "Desrizione@50" S0 + OUTPUT F_IMP CODTAB + CHECKTYPE NORMAL +END + +STRING F_LIN 5 +BEGIN + PROMPT 30 6 "Linea " + FLAGS "U" + USE LNP + INPUT CODTAB F_LIN + DISPLAY "Codice" CODTAB + DISPLAY "Desrizione@50" S0 + OUTPUT F_LIN CODTAB + CHECKTYPE NORMAL +END + STRING F_MAG 3 BEGIN - PROMPT 2 6 "Magazzino " + PROMPT 2 7 "Magazzino " FLAGS "U" USE MAG SELECT CODTAB[4,5]=="" INPUT CODTAB F_MAG @@ -549,7 +632,7 @@ END STRING F_DEP 2 BEGIN - PROMPT 20 6 "" + PROMPT 20 7 "" FLAGS "U" USE MAG SELECT (IF(#F_MAG!="";((CODTAB[1,3]==#F_MAG)&&(CODTAB[4,5]!=""));(CODTAB[4,5]!=""))) INPUT CODTAB[1,3] F_MAG SELECT @@ -564,7 +647,7 @@ END STRING F_UMEXPR 2 BEGIN - PROMPT 2 7 "Unita' di misura " + PROMPT 2 8 "Unita' di misura " USE LF_UMART KEY 2 SELECT CODART==#F_CODDIS JOIN LF_ANAMAG INTO CODART==CODART INPUT CODART F_CODDIS SELECT @@ -580,7 +663,7 @@ END NUMBER F_QTA 12 5 BEGIN - PROMPT 2 8 "Quantita' " + PROMPT 2 9 "Quantita' " CHECKTYPE REQUIRED END @@ -592,13 +675,13 @@ END DATE F_DATACONS BEGIN - PROMPT 2 9 "Data consegna " + PROMPT 2 10 "Data consegna " CHECKTYPE REQUIRED END BOOLEAN F_ACQUISTO BEGIN - PROMPT 2 10 "Acquisto" + PROMPT 2 11 "Acquisto" END BUTTON DLG_OK 10 2 diff --git a/db/db1300.cpp b/db/db1300.cpp index 64aee2967..f42448fef 100755 --- a/db/db1300.cpp +++ b/db/db1300.cpp @@ -23,6 +23,9 @@ protected: virtual const TRectype* find_child(const TCodice_articolo& art, int child) const; public: + bool add_head(const TCodice_articolo& art); + bool add_child(const TRectype& rec); + void add_branch(TDistinta_tree& dt); TXmas_tree(); @@ -42,6 +45,27 @@ const TRectype* TXmas_tree::find_child(const TCodice_articolo& art, int child) c return rec.empty() ? NULL : &rec; } +bool TXmas_tree::add_head(const TCodice_articolo& art) +{ + bool added = FALSE; + if (find_head(art).empty()) + { + TRectype& rec = _dist->curr(); + rec = cache().get(LF_DIST, art); + if (rec.empty()) + rec.put("CODDIST", art); + const int err = rec.write(*_dist); + added = err == NOERR; + } + return added; +} + +bool TXmas_tree::add_child(const TRectype& rec) +{ + int err = rec.write(*_rdist); + return err == NOERR; +} + void TXmas_tree::add_branch(TDistinta_tree& dt) { TString old_node; dt.curr_id(old_node); // Memorizza posizione @@ -53,15 +77,7 @@ void TXmas_tree::add_branch(TDistinta_tree& dt) break; // Inutile proseguire TCodice_um um; dt.curr_um(um); TCodice_articolo art; dt.curr_code(art); - if (find_head(art).empty()) - { - TRectype& rec = _dist->curr(); - rec = cache().get(LF_DIST, art); - if (rec.empty()) - rec.put("CODDIST", art); - int err = rec.write(*_dist); - CHECKD(err == NOERR, "Dist write error ", err); - } + add_head(art); dt.goto_father(); TCodice_articolo father; dt.curr_code(father); @@ -106,6 +122,8 @@ TXmas_tree::TXmas_tree() _rdist = new TIsamtempfile(LF_RDIST, NULL, TRUE, TRUE); _cache_rdist = new TRecord_cache(_rdist); _cache_rdist->test_file_changes(TRUE); + + set_qta_on_descr(TRUE); // Stampa anche le quantita } TXmas_tree::~TXmas_tree() @@ -282,6 +300,12 @@ class TImplosion_mask : public TAutomask protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + + int find_roots(const char* articolo, TAssoc_array& roots) const; + + void implode_slow(); + void implode_medium(); + void implode_fast(); public: void implode(); @@ -333,8 +357,54 @@ HIDDEN bool implode_callback(TTree& tree, void* jolly, word flags) return FALSE; } -void TImplosion_mask::implode() -{ +int TImplosion_mask::find_roots(const char* articolo, TAssoc_array& roots) const +{ + TRelation rel(LF_RDIST); + TCursor cur(&rel, "", 2); + TRectype only(LF_RDIST); + + TAssoc_array ass[2]; + int c = 0; // Array dei children = 0; fathers = 1 + ass[c].add(articolo, NULL); + + const char* cap = "Livello %d - Articoli %ld"; + TString caption; caption.format(cap, 0, 0L); + TIndwin iw(0, caption, TRUE, FALSE); + + for (int loop = 0; ass[c].items() > 0 && loop < 50; loop++) + { + if (iw.iscancelled()) + break; + caption.format(cap, loop, ass[c].items()); + iw.set_text(caption); + + FOR_EACH_ASSOC_OBJECT(ass[c], obj, key, item) + { + only.put("CODCOMP", key); + cur.setregion(only, only); + const TRecnotype items = cur.items(); + if (items > 0) + { + cur.freeze(TRUE); + for (cur = 0L; cur.pos() < cur.items(); ++cur) + { + const TString& father = cur.curr().get("CODDIST"); + ass[!c].add(father, NULL); + } + cur.freeze(FALSE); + } + else + roots.add(key); + } + ass[c].destroy(); // Distruggi i children + c = !c; // Scambia i children coi fathers + } + + return roots.items(); +} + +void TImplosion_mask::implode_slow() +{ TRelation rel(LF_DIST); TRectype dist_f(LF_DIST), dist_t(LF_DIST); dist_f.put("CODDIST", get(F_DA_ARTICOLO)); @@ -376,32 +446,34 @@ void TImplosion_mask::implode() TProgind pi(items, caption, TRUE, TRUE); TSheet_field& vars = sfield(F_VARS); + if (vars.items() == 0) vars.row(-1); // Crea almeno una riga vuota + const TRectype& curr = cur.curr(); TCodice_articolo articolo; TString livello; TCodgiac_livelli livgiac; - TDistinta_tree dt; - _xmas.destroy(); - TSheet_field& a = sfield(F_ARTS); + TString80 key; FOR_EACH_SHEET_ROW(a, r, row) { - TString80 key; key = row->get(1); - if (row->get_char(3) > ' ') + if (!key.blank()) { - key << '|' << row->get(3); - key << row->get(); - key << row->get(); - key << row->get(); - key.rtrim(); + if (row->get_char(3) > ' ') + { + key << '|' << row->get(3); + key << row->get(); + key << row->get(); + key << row->get(); + key.rtrim(); + } + _xmas.add(key, NULL); } - _xmas.add(key, NULL); - } - + } + for (cur = 0L; cur.pos() < items; ++cur) { #ifdef DBG @@ -416,9 +488,9 @@ void TImplosion_mask::implode() #else pi.addstatus(1); #endif - + if (pi.iscancelled()) break; - if (vars.items() == 0) vars.row(-1); // Crea almeno una riga vuota + // Scansione di tutte le righe abilitate FOR_EACH_SHEET_ROW(vars, r, row) { @@ -434,11 +506,174 @@ void TImplosion_mask::implode() dt.scan_depth_first(implode_callback, &_xmas); } } - pi.set_text("Espansione albero di implosione..."); - do_events(); - +} + +void TImplosion_mask::implode_medium() +{ + const TCodice_articolo da_art = get(F_DA_ARTICOLO); + const TCodice_articolo ad_art = get(F_AD_ARTICOLO); + + TSheet_field& a = sfield(F_ARTS); + FOR_EACH_SHEET_ROW(a, r, row) + { + const TCodice_articolo articolo = row->get(1); + if (articolo.blank()) + continue; + + TString livello; + if (row->get_char(3) > ' ') + { + livello = row->get(3); + livello << row->get(); + livello << row->get(); + livello << row->get(); + livello.rtrim(); + } + + TString key; + key = articolo; + if (livello.not_empty()) + key << '|' << livello; + _xmas.add(key, NULL); + + TAssoc_array roots; + const long items = find_roots(articolo, roots); + if (items > 0) + { + TString caption; + caption << "Esplosione di " << items << " articoli in corso..."; + TProgind pi(items, caption, TRUE, TRUE); + + TSheet_field& vars = sfield(F_VARS); + if (vars.items() == 0) vars.row(-1); // Crea almeno una riga vuota + + TDistinta_tree dt; + TCodgiac_livelli livgiac; + + FOR_EACH_ASSOC_OBJECT(roots, obj, key, item) + { +#ifdef DBG + if (pi.addstatus(1)) + { + unsigned long h, m; + TFile_cache::stats(h, m); + TString80 msg; + msg.format("Hits %lu - Misses %lu", h, m); + xvt_statbar_set(msg); + } +#else + pi.addstatus(1); +#endif + if (pi.iscancelled()) break; + + const TCodice_articolo articolo = key; + if (articolo < da_art) + continue; + if (ad_art.not_empty() && articolo > ad_art) + continue; + + // Scansione di tutte le righe abilitate + FOR_EACH_SHEET_ROW(vars, r, row) + { + dt.clear_globals(); + dt.set_global("_IMPIANTO", row->get(0)); + dt.set_global("_LINEA", row->get(1)); + dt.set_global("_MAGAZZINO", row->get(2)); + dt.set_global("_DEPOSITO", row->get(3)); + vars.check_row(r); + livgiac.pack_maskgrpcodes(livello, vars.sheet_mask(), 105, 4); + dt.set_root(articolo, "", 1.0, livello); + dt.scan_depth_first(implode_callback, &_xmas); + } + } + } + } +} + +void TImplosion_mask::implode_fast() +{ + TRelation rel(LF_RDIST); + TRectype only(LF_RDIST); + + TSheet_field& a = sfield(F_ARTS); + FOR_EACH_SHEET_ROW(a, r, row) + { + const TCodice_articolo articolo = row->get(1); + if (articolo.blank()) + continue; + + TString livello; + if (row->get_char(3) > ' ') + { + livello = row->get(3); + livello << row->get(); + livello << row->get(); + livello << row->get(); + livello.rtrim(); + } + + only.put("CODCOMP", articolo); + TCursor cur(&rel, "", 2, &only, &only); + const TRecnotype items = cur.items(); + if (items > 0) + { + cur.freeze(); + + TXmas_tree* tree = new TXmas_tree; + int child = 0; + for (cur = 0L; cur.pos() < items; ++cur) + { + TRectype& curr = cur.curr(); + if (livello.not_empty() && curr.get("LIVELLO") != livello) + continue; + + const TCodice_articolo father = curr.get("CODDIST"); + + curr.put("CODDIST", articolo); + curr.put("NRIG", ++child); + curr.put("TIPO", "A"); + curr.put("CODCOMP", father); + tree->add_child(curr); + } + + if (child > 0) + { + tree->add_head(articolo); + tree->set_root(articolo); + TString80 key = articolo; + if (livello.not_empty()) + key << '|' << livello; + _xmas.add(key, tree); + } + else + delete tree; + } + } +} + + +void TImplosion_mask::implode() +{ + _xmas.destroy(); + + if (get_bool(F_FASTIMPLODE)) + { + if (get_bool(F_ONLYONE)) + implode_fast(); + else + implode_medium(); + } + else + implode_slow(); + + TProgind pi(_xmas.items(), "Espansione albero di implosione..."); + + TCodice_articolo articolo; + TString livello; + FOR_EACH_ASSOC_OBJECT(_xmas, obj, key, item) if (item != NULL) { + pi.addstatus(1); TToken_string row(key); articolo = row.get(0); livello = row.get(); diff --git a/db/db1300a.h b/db/db1300a.h index f2d94eac4..7cc2d3fd9 100755 --- a/db/db1300a.h +++ b/db/db1300a.h @@ -22,5 +22,7 @@ #define F_DA_CATMER 221 #define F_A_CATMER 222 #define F_DA_ARTICOLO 225 -#define F_AD_ARTICOLO 226 +#define F_AD_ARTICOLO 226 +#define F_FASTIMPLODE 227 +#define F_ONLYONE 228 diff --git a/db/db2400.cpp b/db/db2400.cpp index d0a599483..a013b9ecf 100755 --- a/db/db2400.cpp +++ b/db/db2400.cpp @@ -56,6 +56,13 @@ real TValorizzazione_mask::valore(const TCodice_articolo& dis, const char* liv) real* val = (real*)_valori.objptr(cod); if (val == NULL) { + _tree.set_global("_IMPIANTO", get(F_IMPIANTO)); + _tree.set_global("_LINEA", get(F_LINEA)); + TString8 codmagdep; + add_magcode(codmagdep, get(F_CODMAG)); + add_depcode(codmagdep, get(F_CODDEP)); + _tree.set_global("_MAGDEP", codmagdep); + if (_tree.set_root(dis)) { TArray boom; @@ -130,7 +137,8 @@ void TValorizzazione_mask::elabora() _codlist = get(F_CODLIST); TRelation rel(LF_DIST); - TCursor cur(&rel, "", 1, &rec_from, &rec_to); + TCursor cur(&rel); + cur.setregion(rec_from, rec_to, 0x2); const long items = cur.items(); TProgind pi(items, "Valorizzazione in corso...", TRUE, TRUE); @@ -160,16 +168,13 @@ void TValorizzazione_mask::elabora() break; const TCodice_articolo art = cur.curr().get("CODDIST"); + const char tipo = _tree.get_type(art); + if (tipo != 'A') + continue; + const TPrice value(valore(art)); - - switch(_tree.get_type(art)) - { - case 'A': line = "$[r,w]"; break; - case 'L': line = "$[v,w]"; break; - case 'V': line = "$[b,w]"; break; - default : line = "$[n,w]"; break; - } - line << art << "$[n,w]"; + line.cut(0) << "$[r,w]" << art << "$[n,w]"; + line.left_just(33); TArticolo_giacenza articolo(art); diff --git a/db/db2400a.h b/db/db2400a.h index df5aefd0c..9841cc4be 100755 --- a/db/db2400a.h +++ b/db/db2400a.h @@ -4,8 +4,13 @@ #define F_TIPO 103 #define F_ANNOES 104 #define F_VALORIZZA 105 -#define F_DATA 106 -#define F_PREVIEW 110 +#define F_DATA 106 +#define F_CODMAG 107 +#define F_CODDEP 108 +#define F_IMPIANTO 109 +#define F_LINEA 110 + +#define F_PREVIEW 111 #define F_CATVEN_LIST 120 #define F_CODLIST 121 diff --git a/db/db2400a.uml b/db/db2400a.uml index c3e5183ff..6275c10a7 100755 --- a/db/db2400a.uml +++ b/db/db2400a.uml @@ -34,7 +34,7 @@ ENDPAGE PAGE "Valorizzazione" 0 0 80 19 -GROUPBOX DLG_NULL 34 4 +GROUPBOX DLG_NULL 74 4 BEGIN PROMPT 1 1 "@bSelezione" END @@ -67,6 +67,61 @@ BEGIN ADD RUN DB0 -4 END +STRING F_CODMAG 3 +BEGIN + FLAGS "U" + PROMPT 38 2 "Magazzino " + USE MAG SELECT CODTAB[4,5]="" + INPUT CODTAB F_CODMAG + DISPLAY "Magazzino" CODTAB + DISPLAY "Descrizione@50" S0 + OUTPUT F_CODMAG CODTAB + CHECKTYPE NORMAL +END + +STRING F_CODDEP 2 +BEGIN + FLAGS "U" + PROMPT 38 3 "Deposito " + USE MAG + INPUT CODTAB[1,3] F_CODMAG + INPUT CODTAB[4,5] F_CODDEP + DISPLAY "Magazzino" CODTAB[1,3] + DISPLAY "Deposito" CODTAB[4,5] + DISPLAY "Descrizione@50" S0 + OUTPUT F_CODMAG CODTAB[1,3] + OUTPUT F_CODDEP CODTAB[4,5] + CHECKTYPE NORMAL +END + +STRING F_IMPIANTO 5 +BEGIN + FLAGS "UF" + PROMPT 56 2 "Impianto " + USE IMP + INPUT CODTAB F_IMPIANTO + DISPLAY "Codice " CODTAB + DISPLAY "Descrizione@50" S0 + OUPUT F_IMPIANTO CODTAB + MESSAGE CHECK, F_LINEA + CHECKTYPE NORMAL +END + +STRING F_LINEA 5 +BEGIN + FLAGS "UF" + PROMPT 56 3 "Linea " + USE LNP + INPUT CODTAB F_LINEA + DISPLAY "Codice " CODTAB + DISPLAY "Descrizione@50" S0 + DISPLAY "Impianto" S6 + OUPUT F_LINEA CODTAB + OUPUT F_IMPIANTO S6 + CHECKTYPE NORMAL +END + + GROUPBOX DLG_NULL 34 5 BEGIN PROMPT 1 5 "@bParametri in ingresso" @@ -141,14 +196,14 @@ BEGIN CHECKTYPE NORMAL END -GROUPBOX DLG_NULL 34 4 +GROUPBOX DLG_NULL 34 5 BEGIN - PROMPT 41 1 "@bParametri in uscita" + PROMPT 41 5 "@bParametri in uscita" END LIST F_VALORIZZA 1 16 BEGIN - PROMPT 42 2 "Valorizza " + PROMPT 42 6 "Valorizza " ITEM "0|Costo standard" ITEM "1|Ultimo costo" ITEM "2|Prezzo vendita" @@ -156,7 +211,7 @@ END DATE F_DATA BEGIN - PROMPT 42 3 "Data elaborazione " + PROMPT 42 8 "Data elaborazione " FLAGS "A" END diff --git a/db/dblib.cpp b/db/dblib.cpp index 276a96d09..d367efbdc 100755 --- a/db/dblib.cpp +++ b/db/dblib.cpp @@ -48,7 +48,6 @@ real TQuantita::find_umbase(TCodice_um& um) code << _articolo << "|1"; const TString& new_um = cache().get(LF_UMART, code, UMART_UM); if (new_um.blank()) -// um = cache().get(LF_DIST, _articolo, UMART_UM); // Inutile, gia' contemplato prima! um = cache().get("LAV", _articolo, "S6"); else um = new_um; @@ -61,8 +60,7 @@ real TQuantita::find_umdist(TCodice_um& um) return um.blank() ? find_umbase(um) : get_factor(um); } -void TQuantita::set_articolo(const TString& art, - const TString& um) +void TQuantita::set_articolo(const TString& art, const TString& um) { _articolo = art; @@ -102,8 +100,8 @@ void TQuantita::convert(real& val, const TCodice_um& from_um, { const real mul = get_factor(from_um); const real div = get_factor(to_um); - val *= mul; - val /= div; + val *= mul; + val /= div; } } } @@ -519,18 +517,43 @@ real TDistinta_tree::curr_qta() const { _path.get(i, _tmp); _tmp.get(5, val); - if (i < last) +// if (i < last) + _tmp.get(0, art); + _tmp.get(4, um); + if (i > 0) { - _tmp.get(0, art); - _tmp.get(4, um); - qta.set(art, um, val); + qta.set_val(val); qta.convert2umdist(); - val = qta.val(); - } + val = qta.val(); + } + qta.set(art, um, ZERO); + int tprec = tot.precision(); + int vprec = val.precision(); + if (tprec + vprec > 15) + { + while (tprec + vprec > 16) + { + if (tprec > vprec) + --tprec; + else + --vprec; + } + tot.round(tprec); + val.round(vprec); + } +#ifdef DBG + TString s(tot.string()); + TString s1(val.string()); +#endif tot *= val; +#ifdef DBG + s = tot.string(); +#endif if (tot.is_zero()) break; } + if (tot.precision() > 15) + tot.round(15); return tot; } @@ -627,17 +650,15 @@ const TString& TDistinta_tree::describe(const TCodice_articolo& codart) const bool TDistinta_tree::describe(const TCodice_articolo& codart, TString& descr) const { -// descr = ((TDecoder&)_mag).decode(codart); descr = cache().get(LF_ANAMAG, codart, ANAMAG_DESCR); if (descr.not_empty()) return TRUE; -// descr = ((TDecoder&)_lav).decode(codart); descr = cache().get("LAV", codart, "S0"); if (descr.not_empty()) return TRUE; - const TRectype& rec = find_head(codart); + const TRectype& rec = cache().get(LF_DIST, codart); descr = rec.get("DESCR"); return !rec.empty(); } @@ -667,7 +688,7 @@ bool TDistinta_tree::get_description(TString& desc) const { TString16 giaclev; curr_giaclev(giaclev,l); if (!giaclev.empty() ) - desc << " " << livgiac().name(l) << " " << giaclev; + desc << ' ' << livgiac().name(l) << ' ' << giaclev; } if (get_qta_on_descr()) { @@ -704,12 +725,6 @@ TImage* TDistinta_tree::image(bool selected) const bool TDistinta_tree::restart() { -/* - _vars.destroy(); - _mag.destroy(); - _lav.destroy(); - rec_cache(LF_RDIST).destroy(); -*/ return shrink_all(); } @@ -823,29 +838,6 @@ bool TDistinta_tree::is_cyclic(const TToken_string& path) const return cyclic; } -/* -static int compare_rdist(const TObject** o1, const TObject** o2) -{ - const TRectype* r1 = (const TRectype*)(*o1); - const TRectype* r2 = (const TRectype*)(*o2); - TString16 field; - field << "SORT" << _sort_key; - long k1 = r1->get_long(field); - long k2 = r2->get_long(field); - if (k1 == 0 && k2 == 0) - { - k1 = r1->get_long("NRIG"); - k2 = r2->get_long("NRIG"); - } - else - { - if (k1 == 0) k1 = 100000000L; - if (k2 == 0) k2 = 100000000L; - } - return k1 == k2 ? 0 : (k1 > k2 ? +1 : -1); -} -*/ - static int compare_rdist_key(const TObject** o1, const TObject** o2) { TToken_string* s1 = (TToken_string*)(*o1); @@ -881,29 +873,6 @@ const TRectype* TDistinta_tree::find_child(const TCodice_articolo& father, int c return rec.empty() ? NULL : &rec; } -/* -// Attenzione cosi e' velocissimo ma non funziona! -// I puntatori si rifersicono ad elementi di cache rimuovibili! - -int TDistinta_tree::build_children_pointers(const TCodice_articolo& father, TPointer_array& children) const -{ - for (int nrig = 1; ; nrig++) - { - const TRectype* rec = find_child(father, nrig); - if (rec == NULL) - break; - children.add((TRectype*)rec); - } - const int total = children.items(); - if (total > 1 && _sort > 0) - { - _sort_key = _sort; - children.sort(compare_rdist); - } - return total; -} -*/ - int TDistinta_tree::build_children_list(const TCodice_articolo& father, TArray& children) const { TToken_string key(39, TREE_SEPARATOR); @@ -923,7 +892,7 @@ int TDistinta_tree::build_children_list(const TCodice_articolo& father, TArray& children.add(key); } const int total = children.items(); - if (total > 1 && _sort > 0) + if (total > 1 && _sort != 0) { children.sort((COMPARE_FUNCTION)compare_rdist_key); } @@ -946,7 +915,7 @@ bool TDistinta_tree::has_son() const // TString16 livgiac; curr_giaclev(livgiac); _curr = find_child(key, 1); // Se ci sono almeno due figli ed e' necessario ordinare - if ((_sort > 0) && find_child(key, 2) != NULL) + if (_sort != 0 && find_child(key, 2) != NULL) { TArray children; const int total = build_children_list(key, children); @@ -1036,7 +1005,7 @@ bool TDistinta_tree::has_rbrother() const const TCodice_articolo father(key); const int curr_nrig = curr_comp(key); - if (_sort > 0) + if (_sort != 0) { TArray children; const int last = build_children_list(father, children)-1; @@ -1089,7 +1058,7 @@ bool TDistinta_tree::has_lbrother() const const TCodice_articolo father(key); const int curr_nrig = curr_comp(key); - if (_sort > 0) + if (_sort != 0) { TArray children; const int last = build_children_list(father, children)-1; @@ -1218,7 +1187,6 @@ void TDistinta_tree::set_sort_key(int k) TTypeexp TDistinta_tree::get_var_type(const char* var) { -// const TString& vt = _vars.decode(var); const TString& vt = cache().get("VAR", var, "B0"); return vt.blank() ? _strexpr : _numexpr; } @@ -1557,7 +1525,7 @@ static bool explode_callback(TTree& node, void* jolly, word when) return FALSE; } - if (ep._sort_key > 0) + if (ep._sort_key > 0) // Se sort_key <= 0 accetta tutto comunque { const long sk = tree.curr_sort(); if (sk <= 0) @@ -1628,7 +1596,7 @@ int TDistinta_tree::explode(TArray& boom, ep._ignore_ghost = ep._filter.find('G') < 0; ep._stop_prod = sp; - set_sort_key (ep._sort_key); + set_sort_key (abs(ep._sort_key)); // Sort key puo' essere negativa per includere anche quelli senza! set_max_depth(ep._max_depth); set_ignore_ghost(ep._ignore_ghost); set_stop_prod(ep._stop_prod); @@ -1788,14 +1756,14 @@ TUm_tempo::TUm_tempo(char c) switch (c) { case 'M': // minutes - _ore=1/60; + _ore=1.0/60.0; break; case 'S': // seconds - _ore=1/60/60; + _ore=1.0/3600.0; break; case 'H': // hours default: - _ore=1; + _ore=1.0; break; } } diff --git a/ef/ef0100.cpp b/ef/ef0100.cpp index 0ce94fddb..84dee5c7a 100755 --- a/ef/ef0100.cpp +++ b/ef/ef0100.cpp @@ -31,6 +31,7 @@ protected: virtual bool get_next_key(TToken_string& key); virtual void init_modify_mode(TMask&); static bool handle_sheet(TMask_field& f, KEY); + static bool cambio_handler(TMask_field& f, KEY k); static bool codval_handler(TMask_field& f, KEY k); static bool contab_handler(TMask_field& f, KEY k); static bool fatt_handler(TMask_field& f, KEY k); @@ -280,6 +281,7 @@ bool TVariazione_effetti::user_create() _rel = new TRelation(LF_EFFETTI); _effetto = new TEffetto; _msk->set_handler(F_CODVAL, codval_handler); + _msk->set_handler(F_CAMBIO, cambio_handler); _msk->set_handler(F_EFFCONT, contab_handler); _msk->set_handler(F_SHEET_RIGHE, handle_sheet); righe_sheet().set_append(TRUE); @@ -332,11 +334,12 @@ bool TVariazione_effetti::handle_sheet(TMask_field &f, KEY k) bool TVariazione_effetti::codval_handler(TMask_field& f, KEY k) { TMask &m = f.mask(); - if (k == K_TAB && f.to_check(k, TRUE)) +// if (k == K_TAB && f.to_check(k, FALSE)) + if (f.to_check(k, TRUE)) { const TString & val = f.get(); // se non c'e valuta o se è lire disabilito i campi collegati - const bool valuta = (val.not_empty() && val != "LIT"); + const bool valuta = (val.not_empty() && val != TCurrency::get_firm_val()); m.enable(-1,valuta); TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_RIGHE); if (!valuta) @@ -358,6 +361,34 @@ bool TVariazione_effetti::codval_handler(TMask_field& f, KEY k) return TRUE; } +// handler che gestisce la modifica del cambio +bool TVariazione_effetti::cambio_handler(TMask_field& f, KEY k) +{ + TMask &m = f.mask(); + //if (k == K_TAB && f.to_check(k, TRUE)) + if (k == K_TAB && f.focusdirty()) + { + const real cambio = f.get(); + const TString& valuta = m.get(F_CODVAL); + TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_RIGHE); + int items = sf.items(); + real imp, impval; + // scandisco tutte le righe dello sheet e modifico gli importi in lire + for (int i = 0; i < items; i++) + { + TToken_string& row = sf.row(i); + impval = row.get(sf.cid2index(F_IMPEFFVAL)); + TCurrency val(impval, valuta, cambio); + val.change_to_firm_val(); + imp = val.get_num(); + row.add(imp.string(), sf.cid2index(F_IMPEFF)); + } + if (f.focusdirty()) + sf.force_update(); + } + return TRUE; +} + // handler che permette il controllo sulla abilitazione dei campi collegati // al codice valuta bool TVariazione_effetti::fatt_handler(TMask_field& f, KEY k) diff --git a/ef/ef0100a.uml b/ef/ef0100a.uml index 7a963e844..dd2f41855 100755 --- a/ef/ef0100a.uml +++ b/ef/ef0100a.uml @@ -164,12 +164,12 @@ BEGIN GROUP 1 END -NUMBER F_CAMBIO 15 5 +NUMBER F_CAMBIO 15 6 BEGIN PROMPT 1 8 "Cambio " FIELD CAMBIO FLAGS "RU" - PICTURE ".5" + PICTURE ".6" CHECKTYPE REQUIRED WARNING "E' stata specificata una valuta senza il cambio relativo" GROUP 1 diff --git a/ef/ef0101.cpp b/ef/ef0101.cpp index e9f28e35d..2401d9632 100755 --- a/ef/ef0101.cpp +++ b/ef/ef0101.cpp @@ -50,8 +50,9 @@ void TEffetto::put_key(TRectype& rec,char tipodist, long ndist, int nrigadist) } // ritorna la prossima chiave utilizzabile -long TEffetto::get_next_key(const long codcf) const +long TEffetto::get_next_key(const long /* codcf */) const { +/* Fantastica sequela di comandi inutili static long n = 0; if (n == 0) { @@ -69,6 +70,13 @@ long TEffetto::get_next_key(const long codcf) const } n++; return n; +*/ + long n = 1; + TLocalisamfile eff(LF_EFFETTI); + int err = eff.last(); + if (err == NOERR) + n += eff.get_long(EFF_NPROGTR); + return n; } // rinumera la chiave 1 (nprogtr) @@ -240,6 +248,28 @@ TToken_string* TEffetto::dati_fatt(long num, const bool valuta) return dati; } +// restituisce i dati relativi alle fatture a cui si riferisce l'effetto +// costruendo una TToken_string del tipo +// "codnum_fatt0|num_fatt0|anno_fatt0|codnum_fatt1|num_fatt1|anno_fatt1|..." +TToken_string* TEffetto::altridati_fatt(long num) +{ + TToken_string* dati= new TToken_string; + dati->cut(0); + + TLocalisamfile righe_eff(LF_REFFETTI); + righe_eff.put(REFF_NPROGTR, num); + righe_eff.read(); + int items = rows_r(); // prende il numero delle righe dell'effetto + for (int i = 1; i <= items; i++)// le legge tutte + { + dati->add(righe_eff.get(REFF_CODNUM));//prende il codice numerazione + dati->add(righe_eff.get(REFF_NFATT));//prende il numero + dati->add(righe_eff.get(REFF_ANNODOC));//prende il numero + righe_eff.next();// passa alla riga successiva + } + return dati; +} + const bool TEffetto::in_valuta() const { const TString16 val = get(EFF_CODVAL); diff --git a/ef/ef0101.h b/ef/ef0101.h index 384b9085e..84ee2f110 100755 --- a/ef/ef0101.h +++ b/ef/ef0101.h @@ -3,7 +3,7 @@ #ifndef __RECARRAY_H #include -#endif +#endif #include #include @@ -89,6 +89,8 @@ public: bool fatt(long num); // restituisce i dati relativi alle fatture a cui si riferisce l'effetto TToken_string* dati_fatt(long num, const bool valuta = FALSE); + // restituisce i dati codnum, ndoc, anno relativi alle fatture a cui si riferisce l'effetto + TToken_string* altridati_fatt(long num); // costruttore di default TEffetto(); // costuisce l'effetto con il record passato diff --git a/ef/ef0500.cpp b/ef/ef0500.cpp index 059c9a4f3..8094735fc 100755 --- a/ef/ef0500.cpp +++ b/ef/ef0500.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "ef0.h" #include "ef0301.h" @@ -114,6 +115,7 @@ class TRiba_file: public TFile_text { real _tot_importi; char _codice_moneta; + bool _tracciato_setif; protected: virtual void validate(TCursor& cur,TRecord_text &rec, TToken_string &val, TString& str); @@ -122,6 +124,8 @@ public: void set_tot_importi(const real& importo) { _tot_importi = importo; } void add_tot_importi(const real& importo) { _tot_importi += importo; } const real tot_importi() const { return _tot_importi; } + bool tracciato_setif() {return _tracciato_setif;} + void set_tracciato_setif(const bool tracciato_setif=TRUE) {_tracciato_setif = tracciato_setif;} TRiba_file(const TString& file_name, const TString& config_name); virtual ~TRiba_file() { } @@ -304,9 +308,15 @@ void TEmissione::header_rb() codtab << _rel->lfile().get(EFF_CODCABP); bnp.put("CODTAB", codtab); if (bnp.read() == NOERR && bnp.get_bool("B0")) + { rec.set_type("RB"); + _trasfile->set_tracciato_setif(TRUE); + } else + { rec.set_type("IB"); + _trasfile->set_tracciato_setif(FALSE); + } _trasfile->autoload(rec, *_cur); _trasfile->write(rec); } @@ -350,7 +360,6 @@ void TEmissione::inizializza_file() void TEmissione::record(THash_object& lavoro) { const TString& chiave = lavoro.key(); - if (chiave != "EF" && chiave !="RB") if (chiave !="EF" && chiave !="RB" && chiave != "IB") { TTracciato_record& oggetto = (TTracciato_record&)lavoro.obj(); @@ -587,7 +596,7 @@ TRiba_form::TRiba_form(const char* name): TForm() bool TRiba_form::validate(TForm_item &cf, TToken_string &s) { const TString16 code(s.get(0)); - TString80 valore; + TString valore; // Attenzione può essere molto lunga (descrizione di 5 righe) if (code == "_IMPORTO") { @@ -652,11 +661,11 @@ bool TRiba_form::validate(TForm_item &cf, TToken_string &s) for (int i = 0; i < elem; i+=3) { descfatt << dati->get(i); - descfatt << " "; + descfatt << ' '; descfatt << dati->get(i+1); - descfatt << " "; - cf.set(descfatt); + descfatt << '\n'; } + cf.set(descfatt); } // "!IMPFATT" se 1 sola fattura ne stampa l' importo if (in == "IMPFATT") @@ -854,23 +863,23 @@ bool TDistinta_form::validate(TForm_item &cf, TToken_string &s) TEffetto effetto(cursor()->file().curr()); //= eff.curr(); long num = effetto.numero(); TToken_string* dati = effetto.dati_fatt(num); - int elem = dati->items(); - TString descfatt; - TString in(s.get()); // prende il primo parametro, il codice del messaggio + const int elem = dati->items(); + TString80 in(s.get()); // prende il primo parametro, il codice del messaggio if (in[0]=='!') { in.ltrim(1); // "!DATIFATT" stampa numero e data fattura delle fatture a cui si riferisce l'effetto if (in == "DATIFATT") { + TString descfatt; for (int i = 0; i < elem; i+=3) { - descfatt << dati->get(i); - descfatt << " "; - descfatt << dati->get(i+1); - descfatt << " "; - cf.set(descfatt); + descfatt << dati->get(i); + descfatt << ' '; + descfatt << dati->get(i+1); + descfatt << '\n'; } + cf.set(descfatt); } } valore = cf.get(); @@ -1070,16 +1079,39 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr TLocalisamfile &eff = cur.file(); TEffetto effetto = eff.curr(); long num = effetto.numero(); - TToken_string* dati = effetto.dati_fatt(num); - int elem = dati->items(); TString descfatt; - for (int i = 0; i < elem; i+=3) + if (tracciato_setif()) { - descfatt << dati->get(i); - descfatt << " "; - descfatt << dati->get(i+1); - descfatt << " "; - } + TToken_string* dati = effetto.dati_fatt(num); + int elem = dati->items(); + for (int i = 0; i < elem; i+=3) + { + descfatt << dati->get(i); + descfatt << " "; + descfatt << dati->get(i+1); + descfatt << " "; + } + } + else + { + TToken_string* dati = effetto.altridati_fatt(num); + int elem = dati->items(); + for (int i = 0; i < elem; i+=3) + { + if (i!=0) + descfatt << "/"; + descfatt << dati->get(i); // codnum + descfatt << " "; + descfatt << dati->get(i+1); // numdoc + descfatt << " "; + TString16 anno = dati->get(i+2); // anno (2 cifre) + anno.trim(); + if (anno.len() > 2) + descfatt << anno.right(2); + else + descfatt << anno.rpad(2); + } + } int l = descfatt.len(); TString in(s.get()); if (in[0]=='!') @@ -1107,8 +1139,7 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr CHECK(in[0]=='!',"Macro _IMPORTO senza carattere '!'"); if (in=="!ADD") { -// real importo(str); - real importo = cur.curr(LF_EFFETTI).get(EFF_IMPORTO); + real importo = cur.curr(LF_EFFETTI).get(EFF_IMPORTO); if (_codice_moneta == 'E') importo *= 100.0; importo.round(0); diff --git a/ef/ef0800.cpp b/ef/ef0800.cpp index 2ed281261..ea2f7cf88 100755 --- a/ef/ef0800.cpp +++ b/ef/ef0800.cpp @@ -98,6 +98,9 @@ class TContabilizzazione_effetti_app : public TSkeleton_application error_type _error; // Errore rilevato durante l'elaborazione long _total_bills; // Totale distinte contabilizzate. int _cur_dist_row;// Numero di riga distinta corrente (per visualizzazione errore) + bool _dett_rate_att;// Dettaglia le rate su effetti attivi + bool _dett_rate_pas;// Dettaglia le rate su effetti passivi + protected: // TApplication // Compila la testata del movimento void compile_head_mov(); @@ -115,8 +118,12 @@ protected: // TApplication error_type search_clifo_bill(char tipo, const long codcf); // ritorna la sezione corretta per la riga di partita char sezione() const; + // Ordina le righe di un effetto + int sort_eff(TRecord_array& sorted); // aggiunge una riga all'array dei clienti da una riga effetto bool add_cg_row(const TEffetto& eff, const TRectype& reff, TArray& customers, TAssoc_array& banks, bool add_desc); + // somma ad una riga all'array dei clienti una riga effetto + void sum_cg_row(const TRectype& reff, TArray& customers, TAssoc_array& banks); // aggiunge le righe spese al movimento bool add_spese_rows(const real& spese); // aggiunge riga pagamento da riga effetto @@ -258,6 +265,8 @@ void TContabilizzazione_effetti_app::on_config_change() _cod_caus_pag = conf.get("CODCAUSPAG"); // implementare programma di gestione parametri effetti _desc_inc = conf.get("DESCINC", NULL, -1, "Distinta d'incasso"); _desc_pag = conf.get("DESCPAG", NULL, -1, "Ordine di pagamento"); + _dett_rate_att = conf.get_bool("DETRATATT"); // Dettaglio rate su effetti attivi + _dett_rate_pas = conf.get_bool("DETRATPAS"); // Dettaglio rate su effetti passivi const long trans = conf.get_long("DIFFCAMS"); if (trans > 0) @@ -331,6 +340,9 @@ void TContabilizzazione_effetti_app::main_loop() } _msk->set(F_DISTINTE, _dist_sheet->checked()); } + + _msk->set(F_DETT_RATE_ATT, _dett_rate_att ? "X" : ""); + _msk->set(F_DETT_RATE_PAS, _dett_rate_pas ? "X" : ""); while (_msk->run() == K_ENTER) { @@ -357,6 +369,10 @@ void TContabilizzazione_effetti_app::main_loop() error_box("La data operazione non appartiene a nessun esercizio"); continue; } + + _dett_rate_att = _msk->get_bool(F_DETT_RATE_ATT); + _dett_rate_pas = _msk->get_bool(F_DETT_RATE_PAS); + contabilize(); _msk->reset(F_DISTINTE); build_dist_sheet(); @@ -403,10 +419,7 @@ bool TContabilizzazione_effetti_app::add_cg_row(const TEffetto& eff, const TRect c_rec->put(RMV_DATAREG,_data_op); c_rec->put(RMV_NUMREG,numreg); c_rec->put(RMV_SEZIONE,_caus->sezione_clifo()); - c_rec->put(RMV_TIPOC,_cliente.tipo()); - c_rec->put(RMV_GRUPPO,_cliente.gruppo()); - c_rec->put(RMV_CONTO,_cliente.conto()); - c_rec->put(RMV_SOTTOCONTO,_cliente.sottoconto()); + _cliente.put(*c_rec); c_rec->put(RMV_ROWTYPE,"K"); TString80 desc; @@ -426,8 +439,8 @@ bool TContabilizzazione_effetti_app::add_cg_row(const TEffetto& eff, const TRect } desc << ' ' << reff.get(REFF_NFATT); if (_cliente.tipo() == 'C') - desc << " sc. " << eff.get(EFF_DATASCAD); - c_rec->put(RMV_DESCR, desc); + desc << " sc. " << eff.get(EFF_DATASCAD); + c_rec->put(RMV_DESCR, desc); if (add_desc) { TString80 head_desc = _movimento->curr().get(MOV_DESCR); @@ -436,7 +449,7 @@ bool TContabilizzazione_effetti_app::add_cg_row(const TEffetto& eff, const TRect } // setta i valori per la riga banca - TRectype b_r(*c_rec); + TRectype b_r(*c_rec); TString16 key; key.format("%3d%3d%6ld",_banca.gruppo(),_banca.conto(),_banca.sottoconto()); const bool is_present = banks.is_key(key); @@ -466,6 +479,24 @@ bool TContabilizzazione_effetti_app::add_cg_row(const TEffetto& eff, const TRect return !is_present; } +void TContabilizzazione_effetti_app::sum_cg_row(const TRectype& reff, TArray& customers, TAssoc_array& banks) +{ + const real imp = reff.get_real(REFF_IMPORTO); + + // setta i valori per la riga cliente + TRectype& c_rec = (TRectype&)customers[customers.last()]; + const real c_imp = imp + c_rec.get_real(RMV_IMPORTO); + c_rec.put(RMV_IMPORTO, c_imp); + + // setta i valori per la riga banca + TString16 key; + key.format("%3d%3d%6ld",_banca.gruppo(),_banca.conto(),_banca.sottoconto()); + TRectype& b_rec = (TRectype&)banks.find(key); + const real b_imp = b_rec.get_real(RMV_IMPORTO) + imp; // aggiorna l'importo per questa banca + b_rec.put(RMV_IMPORTO,b_imp); +} + + void TContabilizzazione_effetti_app::join_row(const TRectype& row) { const int n = _movimento->cg_items(); @@ -737,7 +768,7 @@ void TContabilizzazione_effetti_app::compile_head_mov() mov.put(MOV_NUMDOC,ndist); mov.put(MOV_TIPODOC,_caus->tipo_doc()); mov.put(MOV_CODCAUS,_caus->codice()); - mov.put(MOV_TIPOMOV,_caus->tipomov()); + mov.put(MOV_TIPOMOV,_caus->tipomov()); if (codval.not_empty()) { @@ -791,12 +822,9 @@ void TContabilizzazione_effetti_app::compile_riga_partita(TRiga_partite& riga, c { if (!((TRectype&)riga).exist(PART_CONTROEURO)) { - if (cambio > ZERO) - { - real cc = TCurrency::get_euro_change() / cambio; - cc.round(6); - riga.put(PART_CAMBIO, cc); - } + const TExchange chg(effetto.get(EFF_CODVAL), cambio, _exchange_contro); + const real cc = chg.get_base_change(); + riga.put(PART_CAMBIO, cc); } else riga.put(PART_CONTROEURO, TRUE); @@ -910,18 +938,20 @@ void TContabilizzazione_effetti_app::compile_saldac(const TEffetto& eff, } } // reperire il numero di rata (nrata) dalla riga effetto - int nrata = reff.get_int(REFF_NRATA); + const int nrata = reff.get_int(REFF_NRATA); char acc_sal = 'A'; if (partita->esiste(nriga,nrata)) // calcola se e' a saldo o in acconto della rata { acc_sal = reff.get_char(REFF_ACCSAL); - if (acc_sal != 'S') + if (acc_sal != 'S' && acc_sal != 'A') { +/* TRiga_scadenze& riga_scadenza = partita->rata(nriga,nrata); TImporto residuo_scadenza(riga_scadenza.residuo(FALSE)); if (residuo_scadenza.valore() <= reff.get_real(REFF_IMPORTO)) acc_sal = 'S'; else +*/ acc_sal = 'A'; // Potrebbe succedere che il ACCSAL sia vuoto } } @@ -946,16 +976,14 @@ void TContabilizzazione_effetti_app::compile_saldac(const TEffetto& eff, exchange_type et = eff.get_bool(EFF_CONTROEURO) ? _exchange_contro : _exchange_base; if (et == _exchange_contro) { - if (!((TRectype&)riga_part).exist(PART_CONTROEURO)) - { - if (cambio > ZERO) - { - cambio = TCurrency::get_euro_change() / cambio; - cambio.round(6); - et = _exchange_base; - } + if (!((TRectype&)riga_part).exist(PART_CONTROEURO)) + { + const TExchange chg(codval, cambio, et); + cambio = chg.get_base_change(); + et = _exchange_base; + riga_part.put(PART_CAMBIO, cambio); } - } + } const TValuta valuta_eff(codval, datacam, cambio, et); partita->modifica_pagamento(riga_pagamento, valuta_eff, @@ -1127,6 +1155,63 @@ bool TContabilizzazione_effetti_app::has_diffcam(const TEffetto& eff) const return yes; } +static void build_eff_key(const TRectype& row, TString& str, bool full = TRUE) +{ + int anno = row.get_int(REFF_ANNO); + if (anno <= 0) + anno = row.get_int(REFF_ANNODOC); + + TString16 part = row.get(REFF_NUMPART); + if (part.blank() || part == "0") + part = row.get(REFF_NFATT); + + int riga = row.get_int(REFF_NRIGA); + if (riga <= 0) + riga = 1; + + if (full) + { + const int rata = row.get_int(REFF_NRATA); + str.format("%04d|%s|%04d|%04d", anno, (const char*)part, riga, rata); + } + else + str.format("%04d|%s|%04d", anno, (const char*)part, riga); +} + +static int sort_eff_func(const TObject** o1, const TObject** o2) +{ + const TRectype& r1 = *((TRectype*)*o1); + const TRectype& r2 = *((TRectype*)*o2); + TString80 s1, s2; + build_eff_key(r1, s1); + build_eff_key(r2, s2); + return s2.compare(s1); +} + +int TContabilizzazione_effetti_app::sort_eff(TRecord_array& rows) +{ + rows.sort(sort_eff_func); // Ordina per anno/partita/fattura/rata + + // Raggruppa le righe riferite alla stessa rata + TString last_key, curr_key; + for (int i = rows.last_row(); i > 0; i--) + { + TRectype& row = rows[i]; + build_eff_key(row, curr_key); + if (curr_key == last_key) // Hanno la stessa rata per cui sommo e cancello l'ultima riga + { + real importo = rows[i+1].get(REFF_IMPORTO); + importo += row.get_real(REFF_IMPORTO); + row.put(REFF_IMPORTO, importo); + rows.destroy_row(i+1, TRUE); + } + else + last_key = curr_key; + } + + return rows.rows(); +} + void TContabilizzazione_effetti_app::contabilize_bill(const char tipo, const long numero) { TDistinta& distinta = *_distinta; @@ -1186,6 +1271,12 @@ void TContabilizzazione_effetti_app::contabilize_bill(const char tipo, const lon return; } } + + bool dettaglio_rate = FALSE; + if (_cliente.tipo() == 'C') + dettaglio_rate = _dett_rate_att; + else + dettaglio_rate = _dett_rate_pas; const int items = distinta.items(); // Perche' sul file effetti il numero riga distinta e' un long ?? @@ -1210,11 +1301,24 @@ void TContabilizzazione_effetti_app::contabilize_bill(const char tipo, const lon reset_bank = TRUE; // forza la ricerca del conto della banca ad ogni riga distinta } const bool force_break = !_trandiffcam.ok() && has_diffcam(eff); - - for (int n = 1; n <= eff.rows_r(); n++) + + TRecord_array sorted = ((TEffetto&)eff).righe(); + sort_eff(sorted); + + TString last_key, curr_key; + + for (int n = 1; n <= sorted.rows(); n++) { - const TRectype& riga = eff.row_r(n); - add_cg_row(eff, riga, customers, banks, FALSE); + const TRectype& riga = sorted[n]; + build_eff_key(riga, curr_key, FALSE); + + if (n == 1 || (dettaglio_rate && curr_key != last_key)) + { + add_cg_row(eff, riga, customers, banks, FALSE); + last_key = curr_key; + } + else + sum_cg_row(riga, customers, banks); if (_sc_enabled) compile_saldac(eff, riga, abbuoni_att, abbuoni_pas, differenze_cam, customers); @@ -1233,7 +1337,7 @@ void TContabilizzazione_effetti_app::contabilize_bill(const char tipo, const lon nrows += 2; if (nrows > 0 && force_break) // Se ci sono differenze cambio ... - nrows = CGROWS_LIMIT; // ... allora forza cambio movimento + nrows = CGROWS_LIMIT; // ... allora forza cambio movimento if (nrows >= CGROWS_LIMIT) // se sono arrivato al limite massimo, scrivo questo movimento { @@ -1280,7 +1384,7 @@ void TContabilizzazione_effetti_app::contabilize() const long cur_items = _dist_sheet->items(); // Quante distinte in totale ? TProgind p(cur_items, "Contabilizzazione effetti", FALSE, TRUE); for (long j = 0; j < cur_items; j++) - { + { p.setstatus(j+1); if (_dist_sheet->checked(j)) { @@ -1293,7 +1397,13 @@ void TContabilizzazione_effetti_app::contabilize() } } if (_total_bills > 0) + { + TConfig conf(CONFIG_DITTA, "ef"); + conf.set("DETRATATT", _dett_rate_att ? "X" : ""); + conf.set("DETRATPAS", _dett_rate_pas ? "X" : ""); + message_box("Totale effetti contabilizzati: %ld",_total_bills); + } } int ef0800 (int argc, char* argv[]) diff --git a/ef/ef0800a.h b/ef/ef0800a.h index 0393c5a13..0f10f8b6f 100755 --- a/ef/ef0800a.h +++ b/ef/ef0800a.h @@ -5,3 +5,5 @@ #define F_RESET 103 #define F_DATA_OP 104 #define F_FORCE 105 +#define F_DETT_RATE_ATT 106 +#define F_DETT_RATE_PAS 107 diff --git a/ef/ef0800a.uml b/ef/ef0800a.uml index c4a0a94d8..125b325db 100755 --- a/ef/ef0800a.uml +++ b/ef/ef0800a.uml @@ -25,6 +25,17 @@ BEGIN FLAGS "A" END +BOOLEAN F_DETT_RATE_ATT +BEGIN + PROMPT 2 5 "Dettaglio rate su effetti attivi" +END + +BOOLEAN F_DETT_RATE_PAS +BEGIN + PROMPT 2 6 "Dettaglio rate su effetti passivi" +END + + BUTTON DLG_OK 10 2 BEGIN PROMPT -12 -1 "" diff --git a/ef/riba.ini b/ef/riba.ini index 0662ddcfa..181c006a8 100755 --- a/ef/riba.ini +++ b/ef/riba.ini @@ -367,7 +367,7 @@ NAME(4)=RIFERIMENTI AL DEBITO SEGMENTO 2 TYPE(4)=STRINGA POSITION(4)=50 LENGTH(4)=40 -MESSAGE(4) = _FISSO,! +MESSAGE(4) = _FISSO,!2 NAME(5)=CAMPO BLANK TYPE(5)=FISSO diff --git a/include/archives.cpp b/include/archives.cpp index 64973ba85..5f03ccd99 100755 --- a/include/archives.cpp +++ b/include/archives.cpp @@ -166,12 +166,12 @@ int TArchive::build_backup_list(int mode, long firm, TString_array& fl) const // @mfunc Costruisce la lista delle directory da scompattare // -// @rdesc Ritorna il numero di direttori da ripristinare +// @rdesc Ritorna il numero di cartelle da ripristinare int TArchive::build_restore_list( int& mode, long firm, // @parm Ditta di cui effettuare il salvataggio char floppy, // @parm Floppy su cui effettuare il backup - TString_array& fl) const // @parm Nomi dei direttori da ripristinare + TString_array& fl) const // @parm Nomi dei cartella da ripristinare { fl.destroy(); @@ -259,7 +259,7 @@ bool TArchive::write_ini(TFilename& work, int disk, long tot, const char* desc, const int d = c.get_int("Disk"); if (d == disk) { - ok = yesno_box("Il disco %d contiene gia' un backup del direttorio %s del %s" + ok = yesno_box("Il disco %d contiene gia' un backup della cartella %s del %s" "\nSi desidera continuare?", disk, (const char*)parag, (const char*)c.get("Date")); } @@ -578,7 +578,7 @@ bool TArchive::restore( output = output.name(); output.ext("gal"); if (!yesno_box("Attenzione l'archivio sul disco %c: verra' ripristinato\n" - "nel direttorio %s. Continuare?", floppy, (const char*)work)) + "nella cartella %s. Continuare?", floppy, (const char*)work)) return FALSE; xvt_fsys_save_dir(); @@ -587,7 +587,7 @@ bool TArchive::restore( bool ok = chdir(work) == 0; if (!ok) { - ok = yesno_box("Non esiste il direttorio %s: si desidera crearlo?", (const char*)work); + ok = yesno_box("Non esiste la cartella %s: si desidera crearla?", (const char*)work); if (ok) { make_dir(work); @@ -606,12 +606,12 @@ bool TArchive::restore( { _arc = new ALArchive(output); - TAssoc_array subdirs; // Array dei sottodirettori da creare + TAssoc_array subdirs; // Array delle sottocartellle da creare TProgress_win w("Ripristino", this); ALEntryList list(w.monitor()); _arc->ReadDirectory(list); - // Naviga attraverso l'archivio e compone l'array dei sottodirettori da creare + // Naviga attraverso l'archivio e compone l'array delle cartelle da creare ALEntry *entry = list.GetFirstEntry(); TFilename path; @@ -625,7 +625,7 @@ bool TArchive::restore( entry = entry->GetNextEntry(); } - // Scorre la lista dei sottodirettori da creare + // Scorre la lista delle sottocartelle da creare for (TFilename* p = (TFilename*)subdirs.first_item(); p != NULL; p = (TFilename*)subdirs.succ_item()) { p->rtrim(1); // Strip trailing / @@ -681,7 +681,7 @@ void TArchive::stop_job() /////////////////////////////////////////////////////////// TProgress_win::TProgress_win(const char* title, TArchive* arc) - : TMask(title, 1, 60, 6), _arc(arc), _monitor(NULL) + : TMask(title, 1, 60, 5), _arc(arc), _monitor(NULL) { RCT rct; xvt_rect_set(&rct, CHARX, CHARY, 58*CHARX, 5*CHARY/2); diff --git a/include/archives.h b/include/archives.h index 5d0dcd108..34cf4aeed 100755 --- a/include/archives.h +++ b/include/archives.h @@ -58,6 +58,7 @@ protected: int build_backup_list(int mode, long firm, TString_array& fl) const; // @cmember Scrive il file backup.ini sul drive indicato bool write_ini(TFilename& name, int disk, long tot, const char* desc, char floppy) const; + // @cmember Costruisce la lista delle directory da scompattare int build_restore_list(int& mode, long firm, char floppy, TString_array& fl) const; diff --git a/include/bagn002.uml b/include/bagn002.uml index f2c56761c..8aab80af0 100755 --- a/include/bagn002.uml +++ b/include/bagn002.uml @@ -21,7 +21,7 @@ BEGIN OUTPUT F_RAGSOC RAGSOC CHECKTYPE REQUIRED WARNING "Ditta assente" - KEY 1 + ADD RUN ba4 -2 GROUP 1 END @@ -49,7 +49,7 @@ BEGIN DISPLAY "Ragione sociale@60" RAGSOC DISPLAY "Codice" CODDITTA COPY OUTPUT F_CODDITTA - KEY 2 + ADD RUN ba4 -2 GROUP 1 END diff --git a/include/currency.cpp b/include/currency.cpp index 3ca485751..4ed2d771c 100755 --- a/include/currency.cpp +++ b/include/currency.cpp @@ -43,6 +43,7 @@ public: const TString& get_base_val(); const TString& get_firm_val(); const TString& get_euro_val(); + void force_firm_val(const char* val); const char* expand_value(const char* val); const char* normalize_value(const char* val, const real& chg, exchange_type& et); @@ -192,6 +193,12 @@ const TString& TDowJones::get_euro_val() return _euro_val; } +void TDowJones::force_firm_val(const char* val) +{ + test_cache(); + _firm_val = val; +} + real TDowJones::exchange(const real& num, // Importo da convertire const char* frval, // Dalla valuta const real& frchg, // Dal cambio @@ -374,6 +381,11 @@ bool TExchange::same_value_as(const TExchange& exc) const return strcmp(_val, exc._val) == 0; } +bool TExchange::is_firm_value() const +{ + return DowJones.get_firm_val() == _val; +} + void TExchange::set(const char* val, const real& chg, exchange_type et) { val = DowJones.normalize_value(val, chg, et); @@ -447,7 +459,13 @@ const real& TCurrency::get_euro_change() exchange_type dummy; return DowJones.get_change("_EURO", dummy); } + +void TCurrency::force_firm_val(const char* val) +{ + DowJones.force_firm_val(val); +} + void TCurrency::force_value(const char* newval, const real& newchange, exchange_type newet) { _chg.set(newval, newchange, newet); @@ -577,7 +595,7 @@ bool TCurrency::is_base_value() const bool TCurrency::is_firm_value() const { - return get_firm_val() == get_value(); + return _chg.is_firm_value(); } TCurrency::TCurrency(const real& num, const char* val, const real& exchg, exchange_type et, bool price) diff --git a/include/currency.h b/include/currency.h index 4a813182f..d6a95a5c0 100755 --- a/include/currency.h +++ b/include/currency.h @@ -31,6 +31,7 @@ public: void set(const TRectype& rec); exchange_type get_type() const { return _et; } + bool is_firm_value() const; const char* get_value() const { return _val; } const real& get_change(exchange_type& et) const; @@ -62,7 +63,10 @@ public: static int get_euro_dec(bool price = FALSE); static const real& get_firm_change(exchange_type& ce); static const real& get_euro_change(); - + + // serve per la personalizzazione cgp4, per stampare il bilancio in euro + static void force_firm_val(const char* val); + void set_price(bool p) { _price = p; } bool is_price() const { return _price; } diff --git a/include/default.url b/include/default.url index 526a7f817..48458c596 100755 --- a/include/default.url +++ b/include/default.url @@ -156,6 +156,8 @@ image BMP_EMAIL QRESDIR"email.bmp" image BMP_DIR QRESDIR"dir.bmp" image BMP_DIRDN QRESDIR"dirdn.bmp" image BMP_FILE QRESDIR"file.bmp" +image BMP_STOP QRESDIR"stop.bmp" +image BMP_FILECHK QRESDIR"filechk.bmp" #scan #transparent $$$ diff --git a/include/form.cpp b/include/form.cpp index 63bf6d5f2..1522385a8 100755 --- a/include/form.cpp +++ b/include/form.cpp @@ -608,7 +608,7 @@ void TForm_item::send_message_to_group(const char * cmd,byte id,const TPrint_sec bool TForm_item::update() -{ +{ if (_prompt.right(1) == "#") { TString prompt(_prompt); @@ -1377,12 +1377,13 @@ void TForm_number::set_picture(const char *p) { TForm_string::set_picture(p); const int comma = picture().find(','); - if (comma > 0) set_decimals(picture().len() - comma -1); + if (comma > 0) + set_decimals(picture().len() - comma -1); } const char* TForm_number::example() const { - TString s("123456789120.00"); + TString s("1234567890.123456"); apply_format(s); return strcpy(__tmp_string, s); } @@ -1433,15 +1434,9 @@ TObject* TForm_currency::dup() const TCurrency TForm_currency::get_currency() const { - TString16 codval; - if (_driver) - codval = _driver->get(); - else - codval = form().get_curr_codval(); + const TString& codval = _driver ? _driver->get() : form().get_curr_codval(); const real n(get()); - TCurrency curr(n, codval); - curr.set_price(_flag.price != 0); - return curr; + return TCurrency(n, codval, ZERO, _exchange_undefined, _flag.price != 0); } bool TForm_currency::update() @@ -1462,9 +1457,8 @@ bool TForm_currency::update() // Niente apply_format(), la picture viene ignorata per i TForm_currency const bool dotted = picture().empty() || picture().find('.') >= 0; - TString v(curr.string(dotted)); - const int w = width(); - + TString80 v(curr.string(dotted)); + const int w = width() - (_section->columnwise() ? _prompt.len() : 0); if (w > v.len()) v.right_just(w); put_paragraph(v); diff --git a/include/isam.cpp b/include/isam.cpp index 9ed47f9e9..c0da17699 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -929,7 +929,7 @@ int TBaseisamfile::skip(TRecnotype nrec, word lockop) } _recno = _isamfile->RecNo = DB_recno(fhnd); if (curr().has_memo()) - curr().init_memo(_recno); + curr().init_memo(_recno, _isam_handle); return _lasterr; } @@ -943,7 +943,7 @@ int TBaseisamfile::_read(TRectype& rec, word op, word lockop) _lasterr = cisread(fhnd, getkey(), rec, op + lockop, _recno); if(rec.has_memo()) - rec.init_memo(_recno); + rec.init_memo(_recno, _isam_handle); if (_lasterr == NOERR) { @@ -989,7 +989,7 @@ int TBaseisamfile::_readat(TRectype& rec, TRecnotype nrec, word lockop) rec = (const char *) DB_getrecord(fhnd); _recno = DB_recno(fhnd); if(rec.has_memo()) - rec.init_memo(_recno); + rec.init_memo(_recno, _isam_handle); return _lasterr; } @@ -1033,7 +1033,7 @@ int TBaseisamfile::_write(const TRectype& rec) _recno = DB_recno(fhnd); if (_lasterr == NOERR && rec.has_memo()) - ((TRectype &)rec).write_memo( fhnd, _recno ); + ((TRectype &)rec).write_memo(_isam_handle, _recno ); return _lasterr; } @@ -1088,7 +1088,7 @@ int TBaseisamfile::_rewrite(const TRectype& rec) DB_unlock(fhnd); _recno = DB_recno(fhnd); if(_lasterr == NOERR && curr().has_memo( )) - ((TRectype &)rec).write_memo( fhnd, _recno ); + ((TRectype &)rec).write_memo(_isam_handle, _recno ); } return _lasterr; @@ -1118,7 +1118,7 @@ int TBaseisamfile::rewriteat(const TRectype& rec, TRecnotype nrec) _lasterr = get_error(_lasterr); _recno = DB_recno(fhnd); if(_lasterr == NOERR && curr().has_memo( )) - ((TRectype &)rec).write_memo( fhnd, _recno ); + ((TRectype &)rec).write_memo(_isam_handle, _recno ); return _lasterr; } @@ -1160,7 +1160,7 @@ int TBaseisamfile::_remove(const TRectype& rec) } if(_lasterr == NOERR && curr().has_memo()) - curr().memo_recno(); + curr().init_memo(); return _lasterr; } @@ -1343,15 +1343,19 @@ int TBaseisamfile::is_valid() { const int trcreclen = prefix().get_reclen(_logicnum); if (trcreclen > 0) + { err = NOERR; + if (DB_tagget(isam_handle) == -1) + err = _ispatherr; + else + { + const int dbfreclen = DB_reclen(isam_handle); + if (dbfreclen != trcreclen) + err = _istrcerr; + } + } else err = _isbadtrc; - if (DB_tagget(isam_handle) == -1) - err = _ispatherr; - - const int dbfreclen = DB_reclen(isam_handle); - if (dbfreclen != trcreclen) - err = _istrcerr; } if (isam_handle > 0) prefix().close_isamfile(isam_handle); @@ -2053,7 +2057,7 @@ int TSystemisamfile::update( memcpy(DB_getrecord(fhnd),nrec.string(),lenr); err=DB_add(fhnd); if ( err == NOERR && nrec.has_memo()) - nrec.write_memo(fhnd, DB_recno(fhnd)); + nrec.write_memo(ishandle, DB_recno(fhnd)); if (err != NOERR) err=get_error(err); setstatus(err); @@ -2603,11 +2607,91 @@ void TBaseisamfile::recover() { } +//////////////////////////////////////////////////////////// +// Memo data +//////////////////////////////////////////////////////////// + +void TMemo_data::init(TRecnotype recno, TIsam_handle file) +{ + CHECK(file != NULL || recno < 0, "Valid memo recno with NULL memo file"); + _recno = recno; + _isamfile = file; +} + +void TMemo_data::destroy() +{ + TString_array::destroy(); + _dirty.reset(); + _recno = RECORD_NON_FISICO; + _isamfile = NULL; +} + +void TMemo_data::copy(const TMemo_data& m) +{ + TString_array::operator=(m); + _dirty = m._dirty; + _recno = m._recno; + _isamfile = m._isamfile; +} //////////////////////////////////////////////////////////// -// TRectype +// TRectype //////////////////////////////////////////////////////////// +void TRectype::init(int logicnum) +{ + _logicnum = logicnum; + + CHECK(_logicnum < EXTERNAL_FILE,"Impossibile costruire un record di un file esterno"); + + if (openf[_logicnum - 1] != NULL) + { + _length = DB_reclen(openf[logicnum - 1]->fhnd); + has_memo_fld = rec_has_memo(rec_des()); + } + else + { + TDir wdir; + wdir.get(_logicnum, _nolock, _nordir, _sysdirop); + if (wdir.is_com()) + wdir.get(_logicnum, _nolock, _comdir, _sysdirop); + _length = wdir.len(); + has_memo_fld = _length > 0 && lf_has_memo(_logicnum); + } + _rec = new char [_length]; + *_tab = '\0'; + if (_length > 0) + { + zero(); + } + else + setempty(TRUE); + if(has_memo_fld) + init_memo(RECORD_NON_FISICO); +} + TRectype::TRectype(int logicnum) + : _memo_data(NULL) + +{ + bool has_memo_fld = FALSE; + + _logicnum = logicnum; + if (openf[_logicnum - 1] != NULL) + { + _length = DB_reclen(openf[logicnum - 1]->fhnd); + has_memo_fld = rec_has_memo(rec_des()); + *_tab = '\0'; + if (_length > 0) + { + zero(); + if (rec_has_memo(rec_des())) + init_memo(RECORD_NON_FISICO); + } + else + setempty(TRUE); +} + + TRectype::TRectype(int logicnum) : _memo_data(NULL), _memo_dirty(NULL) { @@ -2626,7 +2710,7 @@ TRectype::TRectype(int logicnum) } TRectype::TRectype(const TBaseisamfile* i) - : _memo_data(NULL), _memo_dirty(NULL) + : _memo_data(NULL) { _logicnum = i->num(); _length = prefix().get_reclen(_logicnum); @@ -2645,15 +2729,13 @@ TRectype::TRectype(const TBaseisamfile* i) TRectype::TRectype(const TRectype& r) : _logicnum(r._logicnum), - _memo_data(NULL), _memo_dirty(NULL) + _memo_data(NULL) { if (r._memo_data) { - init_memo(r._memo_recno); // ?? + init_memo(r._memo_recno, r._memo_data->file()); // qui *_memo_data = *r._memo_data; - CHECK(r._memo_dirty, "memo_dirty NULL con memo_data valido"); - *_memo_dirty= *r._memo_dirty; } _length = r.len(); _rec = new char [ _length ]; @@ -2665,9 +2747,10 @@ TRectype::TRectype(const TRectype& r) TRectype::~TRectype() { - if (_rec != NULL) delete _rec; - if (_memo_data != NULL ) delete _memo_data; - if (_memo_dirty != NULL ) delete _memo_dirty; + if (_rec != NULL) + delete _rec; + if (_memo_data != NULL ) + delete _memo_data; } void TRectype::unknown_field(const char* name) const @@ -2675,30 +2758,47 @@ void TRectype::unknown_field(const char* name) const NFCHECK("Il campo '%s' non appartiene al file %d", name, _logicnum); } -void TRectype::write_memo(int fhnd, const TRecnotype recno) +void TRectype::write_memo(TIsam_handle file, const TRecnotype recno) { - memo_recno(recno); CHECK( _memo_recno > 0, "Maiale! Non fare le GO con _recno < 0 " ); - DB_go( fhnd, _memo_recno ); - RecDes *r = rec_des( ); + TCodeb_handle cb_handle = prefix().get_handle(file); + DB_go( cb_handle, _memo_recno ); + const RecDes *r = rec_des( ); + TIsam_handle orig = _memo_data->file(); + if (orig && (fhnd != orig || recno != _memo_data->recno())) + { + TCodeb_handle cb_orig = prefix().get_handle(orig); + DB_go(cb_orig, _memo_data->recno()); + for(int i = r->NFields - 1; i >= 0; i--) + { + if (r->Fd[i].TypeF == _memofld) + { + if (_memo_data->objptr(i) == NULL) + { + const char* memo = DB_memoptr(cb_orig, r->Fd[i].Name); + if (memo && *memo) + _memo_data->add(memo, i); + } + _memo_data->set_dirty(i); + } + } + } for( int i = _memo_data->last( ); i > 0; i = _memo_data->pred( i ) ) - DB_memowrite( fhnd, r->Fd[ i ].Name, ( char * )( const char * )_memo_data->row( i ) ); - *this = (const char *) DB_getrecord(fhnd); - init_memo(recno); + { + if (_memo_data->is_dirty(i)) + DB_memowrite( cb_handle, r->Fd[ i ].Name, ( char * )( const char * )_memo_data->row( i ) ); + } + *this = (const char *) DB_getrecord(cb_handle); + init_memo(recno, file); } - -void TRectype::init_memo( const TRecnotype recno) +void TRectype::init_memo(TRecnotype recno, TIsam_handle file) { - memo_recno(recno); if (_memo_data == NULL) - _memo_data = new TString_array(); + _memo_data = new TMemo_data; else _memo_data->destroy(); - if (_memo_dirty == NULL) - _memo_dirty = new TBit_array(); - else - _memo_dirty->reset(); + _memo_data->init(recno, file); } void TRectype::settab(const char *tab) @@ -2809,7 +2909,7 @@ const char* TRectype::start(int nf) const return string() + rec_des()->Fd[nf].RecOff; } - +// Confronto tra record: Attenzione i campi vuoti di s non vengono confrontati! int TRectype::compare(const TSortable& s) const { const TRectype& br = (const TRectype&) s; @@ -2818,7 +2918,7 @@ int TRectype::compare(const TSortable& s) const if (br.empty()) return UNDEFINED; const RecDes& rd = *rec_des(); - for (int i = 0; i < items() ; i++) + for (int i = 0; i < rd.NFields; i++) { const char* b = br.start(i); const char* a = start(i); @@ -2835,6 +2935,45 @@ int TRectype::compare(const TSortable& s) const return 0; } +// Confronto stretto +bool TRectype::is_equal(const TRectype& r) const +{ + char* r1 = new char[_length]; + char* r2 = new char[_length]; + memcpy(r1, _rec, _length); + memcpy(r2, r._rec, _length); + browse_null(r1, _length); + browse_null(r2, _length); + + if (has_memo()) + { + const RecDes& rd = *rec_des(); + for(int i = rd.NFields - 1; i >= 0; i--) + { + if (rd.Fd[i].TypeF == _memofld) + { + memset(r1+rd.Fd[i].RecOff, ' ', rd.Fd[i].Len); + memset(r2+rd.Fd[i].RecOff, ' ', rd.Fd[i].Len); + } + } + } + bool yes = memcmp(r1, r2, _length) == 0; + delete r1; + delete r2; + + if (yes && has_memo()) + { + const RecDes& rd = *rec_des(); + for(int i = rd.NFields - 1; yes && i >= 0; i--) + { + if (rd.Fd[i].TypeF == _memofld) + yes = get(rd.Fd[i].Name) == r.get(rd.Fd[i].Name); + } + } + return yes; +} + + TFieldtypes TRectype::type(const char* fieldname) const { const RecDes* recd = rec_des(); @@ -2910,22 +3049,25 @@ const TString& TRectype::get(const char* fieldname) const { const RecDes* recd = rec_des(); const int index = findfld(recd, fieldname); - if ( _memo_data->objptr( index ) && (*_memo_dirty)[ index ] ) + if ( _memo_data->objptr( index )) return _memo_data->row( index ); if( _memo_recno >= 0L ) { - TFilename fname; - int lnum = num(); - TIsam_handle isam_handle = prefix().open_isamfile(lnum, fname); - TCodeb_handle cb_handle = prefix().get_handle(isam_handle); - CHECKD(cb_handle >= 0, "Can't read memo from file ", lnum); - DB_go(cb_handle, _memo_recno ); - _memo_data->add( DB_memoptr(cb_handle, fieldname ), index ); - prefix().close_isamfile(isam_handle); + int orig = _memo_data->file(); + if (orig) + { + TCodeb_handle cb_handle = prefix().get_handle(orig); + DB_go(orig->fhnd, _memo_data->recno()); + _memo_data->add(DB_memoptr(orig, fieldname), index); + CHECKD(cb_handle >= 0, "Can't read memo from file ", lnum); + DB_go(cb_handle, _memo_recno ); + } + else + NFCHECK("Valid memo recno with null memo file"); } else - _memo_data->add( "", index ); - return _memo_data->row( index ); + _memo_data->add("", index); + return _memo_data->row(index); } return get_str(fieldname); } @@ -2974,7 +3116,7 @@ bool TRectype::get_memo( { TToken_string memo( get( fieldname ), '\n' ); const int last = memo.items( ); - for( int i = 0; i < last; i ++ ) + for(int i = 0; i < last; i++) { TString m(memo.get(i)); const int l = m.len() > 0 ? m.len()-1 : 0; @@ -3086,8 +3228,8 @@ void TRectype::put_str(const char* fieldname, const char* val) } if(ft == _memofld) { - _memo_dirty->set(nf); _memo_data->add(val, nf); + _memo_data->set_dirty(nf); } else { @@ -3161,10 +3303,8 @@ TRectype& TRectype::operator =(const TRectype& rec) memcpy(_rec, rec._rec, _length); // Copy contents if (rec._memo_data) { - init_memo(rec._memo_recno);// ?? + init_memo(rec._memo_data->recno(), rec._memo_data->file()); *_memo_data = *rec._memo_data; - CHECK(rec._memo_dirty, "memo_dirty NULL con memo_data valido"); - *_memo_dirty= *rec._memo_dirty; } strcpy(_tab, rec._tab); setempty(rec.empty()); // Copy emptiness status diff --git a/include/isam.h b/include/isam.h index f2fef86a6..872ca3f6e 100755 --- a/include/isam.h +++ b/include/isam.h @@ -35,6 +35,27 @@ class TBaseisamfile; class TLocalisamfile; class TRecfield; +class TMemo_data : public TString_array +{ + TBit_array _dirty; + TRecnotype _recno; + TIsam_handle _isamfile; + +public: + void destroy(); + void init(TRecnotype recno, isdef* file); + TRecnotype recno() const { return _recno; } + TIsam_handle file() const { return _isamfile; } + void copy(const TMemo_data& m); + bool is_dirty(int i) const { return _dirty[i]; } + void set_dirty(int i, bool d = TRUE) { _dirty.set(i, d); } + + TMemo_data& operator=(const TMemo_data& m) { copy(m); return *this; } + TMemo_data(const TMemo_data& m) { copy(m); } + TMemo_data() : _recno(RECORD_NON_FISICO), _isamfile(NULL) { } + virtual ~TMemo_data() { } +}; + // @doc EXTERNAL // @class TRectype | Classe per la definizione del tipo di record del file @@ -62,9 +83,7 @@ protected: // @cmember:(INTERNAL) Indentificatore della tabella char _tab[5]; // @cmember:(INTERNAL) Campo "COD" della tabella - TBit_array* _memo_dirty; - TString_array* _memo_data; - TRecnotype _memo_recno; + TMemo_data* _memo_data; // @access Protected Member protected: @@ -228,13 +247,14 @@ public: // @cmember Ritorna l'espressione della chiave numero

const char* key(int numkey = 1) const; // @cmember Ritorna se si tratta di un record valido - bool ok() const + virtual bool ok() const { return _rec != NULL; } + // @cmember Ritorna TRUE se sono uguali + bool is_equal(const TRectype& r) const; - virtual void init_memo(const TRecnotype recno = RECORD_NON_FISICO); - virtual void write_memo(int fhnd, const TRecnotype recno); + virtual void init_memo(const TRecnotype recno = RECORD_NON_FISICO, TIsam_handle file = 0); + virtual void write_memo(TIsam_handle file, const TRecnotype recno); bool has_memo() const { return _memo_data != NULL; } - void memo_recno (const TRecnotype recno = RECORD_NON_FISICO) { _memo_recno = recno; } // Gestione posta elettronica virtual void fill_transaction(TConfig& cfg, int row = 0) const; diff --git a/include/mask.cpp b/include/mask.cpp index 9fecf8f66..da7de6713 100755 --- a/include/mask.cpp +++ b/include/mask.cpp @@ -339,7 +339,7 @@ bool TMask::can_be_closed() const if (is_running()) { bool ok = TRUE; - if ((edit_mode() || insert_mode()) && dirty()) + if ((edit_mode() || insert_mode()) && dirty() && id2pos(DLG_QUIT) < 0) ok = yesno_box("Annullare i dati inseriti?"); if (ok) ((TMask*)this)->stop_run(K_FORCE_CLOSE); @@ -2059,17 +2059,19 @@ void TTimed_box::start_run() _timer_id=xvt_timer_create(win(),_timer_delay); TMask::start_run(); } + void TTimed_box::handler(WINDOW win, EVENT* ep) { if (ep->type == E_TIMER && ep->v.timer.id==_timer_id) - { - send_key(K_SPACE,DLG_OK); - } + send_key(K_SPACE, _button_id); TMask::handler(win, ep); } TTimed_box::~TTimed_box() -{} +{ + if (_timer_id != XVT_TIMER_ERROR) + xvt_timer_destroy(_timer_id); +} TTimed_breakbox::TTimed_breakbox(const char * message,int seconds,int x,int y) : TTimed_box("Richiesta di interruzione",message,seconds,DLG_OK,x,y) @@ -2081,3 +2083,42 @@ TTimed_breakbox::TTimed_breakbox(const char * message,int seconds,int x,int y) TTimed_breakbox::~TTimed_breakbox() {} + + + + + + + + +// @doc INTERNAL + +// @mfunc costruttore di copia +TYesnoallnone_box::TYesnoallnone_box(const char * message, int default_key) + : TMask("Richiesta",1,40,8) + +{ + // costruisce una maschera run time + add_memo(FIRST_FIELD, 0, "", 1, 0,-1,-3); + set(FIRST_FIELD, message); + disable(FIRST_FIELD); + add_button(DLG_OK, 0, "Tutti", -14, -1, 8, 2,"",0); + add_button(FIRST_FIELD+1, 0, "Si", -24, -1, 8, 2,"",0).set_exit_key(K_YES); + add_button(FIRST_FIELD+2, 0, "No", -34, -1, 8, 2,"",0).set_exit_key(K_NO); + add_button(DLG_CANCEL, 0, "Nessuno", -44, -1, 8, 2,"",0); + switch (default_key) + { + case K_ENTER: + first_focus(DLG_OK); break; + case K_ESC: + first_focus(DLG_CANCEL); break; + case K_NO: + first_focus(FIRST_FIELD+2); break; + default: + first_focus(FIRST_FIELD+1); + } +} + + +TYesnoallnone_box::~TYesnoallnone_box() +{} diff --git a/include/mask.h b/include/mask.h index 917d66ca2..247747145 100755 --- a/include/mask.h +++ b/include/mask.h @@ -453,6 +453,12 @@ public: ~TTimed_breakbox(); }; +class TYesnoallnone_box: public TMask +{ +public: + TYesnoallnone_box(const char * message, int default_key = K_YES); + ~TYesnoallnone_box(); +}; #endif // __MASK_H diff --git a/include/maskfld.cpp b/include/maskfld.cpp index 0086876d7..0152471e7 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -1500,7 +1500,7 @@ const char* TEditable_field::reformat(const char* data) const void TEditable_field::set(const char* data) { _str = reformat(data); - const TString& val = raw2win(_str); + const char* val = raw2win(_str); set_window_data(val); const TMask& m = mask(); @@ -2246,32 +2246,14 @@ bool TBrowse::do_link(bool insert) if (_insert[0] == 'M') { -/* TString nm(_insert.mid(1)); if (nm.compare("tb", 2, TRUE) == 0) // Programma gestione tabelle { - const char* module = ((TTable&)_cursor->file()).module(); -<<<<<<< maskfld.cpp - app = "ba3 -0 "; - if (stricmp(module,"ba") !=0 ) - { -<<<<<<< maskfld.cpp - TConfig c(CONFIG_STUDIO, module); - app = c.get("TabPrg"); - if (app.empty()) - app = "ba3 -0"; - } - nm.ltrim(2); - app << ' ' << nm; + _cursor->file().get_relapp(app); } - else - { - // Programma generico di browse/edit (caduto in disuso) - app = "ba3 -3 "; - app << nm << ' ' << _cursor->file().num(); - } -*/ - _cursor->file().get_relapp(app); + else // Programma generico di browse/edit + app.format("ba3 -3 %s %d", (const char*)nm, _cursor->file().num()); + // Obbligatorio usare la format globale } else { @@ -2346,6 +2328,8 @@ bool TBrowse::do_link(bool insert) { TConfig ini(msg, "Transaction"); _rec = ini.get_long("Record"); + if (_rec > 0 || !insert) // Modifica o cancellazione + _cursor->update(); // Forza ricalcolo cursore if (_rec >= 0) { _cursor->file().readat(_rec); @@ -4229,8 +4213,8 @@ int TList_field::items() const void TList_field::add_item( const char* s) // @parm Voci da aggiungere - // @comm Se il parametro

e' passato con il formato di una vengono - // aggiunte tante voci quanti sono gli elementi. + // @comm Se il parametro

e' passato con il formato di una + // composta da codice|descrizione { TToken_string t(s); TString item(t.get()); diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 4836096ba..25f03f23e 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -263,8 +263,8 @@ public: byte dirty() const { return owner().dirty(); } // @cmember Permette di indicare se e' stata modificata una cella dello spreadsheet - void set_dirty(byte spork = TRUE) - { owner().set_dirty(spork); } + void set_dirty(bool spork = TRUE) + { owner().set_dirty(spork); _row_dirty = spork; _cell_dirty = spork;} // @cmember Ritorna il valore della variabile active bool active() const @@ -703,7 +703,6 @@ void TSpreadsheet::set_focus_cell(int riga, int colonna) { _cur_rec = rec; _cur_row = riga; -/* Guy! str2mask(_cur_rec); */ _row_dirty = FALSE; } _edit_field = col2field(_cur_col = colonna); // qui @@ -753,7 +752,8 @@ int TSpreadsheet::insert( if (update_sheet) { xi_cell_request(_obj); - post_select(r); + if (_selection_posted < 0) + post_select(r); } } else @@ -1068,7 +1068,8 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) { // if (test_focus_change()) { - int rec = -1; + int rec = -1; + _cell_dirty = FALSE; if (items() > 0 && !owner().append()) { @@ -1386,7 +1387,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) notify(_cur_rec, K_DEL)) { int rec = _cur_rec; - _row_dirty = FALSE; + _row_dirty = _cell_dirty = FALSE; destroy(rec); if (rec < items()) str2mask(rec); @@ -1399,12 +1400,13 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) } refused = TRUE; _check_enabled = TRUE; // Re-enable checks - } + } break; case K_CTRL + '+': // ********* insert line if (test_focus_change()) { int rec = -1; + _cell_dirty = _row_dirty = FALSE; if (items() > 0 && !owner().append()) { @@ -1424,7 +1426,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) _check_enabled = FALSE; if (_cell_dirty) off_cell_handler(); - + notify_change(); // CM500244 const KEY k = edit(_cur_rec); if (k == K_ENTER) _row_dirty = TRUE; @@ -1670,11 +1672,12 @@ void TSpreadsheet::select(int rec, int col, bool scrollto) _cur_col = find_enabled_column(rec, 1, +1); _cur_rec = rec; _cur_row = row; - _edit_field = _cur_col > 0 ? col2field(_cur_col) : NULL; + _edit_field = _cur_col > 0 ? col2field(_cur_col) : NULL; str2mask(_cur_rec); _row_dirty = FALSE; } + notify(rec, K_TAB); } @@ -1697,7 +1700,7 @@ void TSpreadsheet::on_idle() const int next_row = _selection_posted; _selection_posted = -1; if (next_row < items()) - select(next_row, FALSE); + select(next_row, 1, FALSE); } } @@ -1939,8 +1942,6 @@ void TSpreadsheet::swap_rows( const int fromindex, const int toindex) _property.swap(fromindex, toindex); } - - void TSpreadsheet::set_column_width(const int col, const int width) const { XI_OBJ* column = find_column(col); @@ -2064,12 +2065,15 @@ void TSpreadsheet::set_columns_order(TToken_string* order) for (int index = 0; index < num_cols; index++) { const short cid = index ? FIRST_FIELD + index - 1 : 0; - XI_OBJ* col = find_column(cid); + XI_OBJ* col = cid ? find_column(cid) : column[0]; if (col) { - idx++; - if (index >= fixed) - xi_move_column(col, idx); + if (index >= fixed) + { + const int cur_pos = xi_obj_to_idx(col); + if (cur_pos != index) + xi_move_column(col, index); + } RCT rct; xi_get_rect(col, (XinRect *) &rct); if (_default_width[index] != rct.right - rct.left) @@ -2439,8 +2443,9 @@ int TSheet_field::items() const int TSheet_field::selected() const { TSpreadsheet* s = (TSpreadsheet*)_ctl; + int sel = s != NULL ?(int)s->selected() : -1; - return s != NULL ?(int)s->selected() : -1; + return sel; } void TSheet_field::set_notify(SPREADSHEET_NOTIFY n) @@ -2671,6 +2676,12 @@ void TSheet_field::select(int r, int c , bool scrollto) s->select(r, c, scrollto); } +void TSheet_field::post_select(int r) +{ + TSpreadsheet* s = (TSpreadsheet*)_ctl; + s->post_select(r); +} + void TSheet_field::set_focus_cell(int riga, int colonna) { TSpreadsheet* s = (TSpreadsheet*)_ctl; diff --git a/include/msksheet.h b/include/msksheet.h index 7dc544356..78f14e22d 100755 --- a/include/msksheet.h +++ b/include/msksheet.h @@ -157,6 +157,8 @@ public: void select(int r, bool scrollto = FALSE); // @cmember Seleziona la riga

e la colonna

come quella corrente void select(int r, int c, bool scrollto = FALSE); + // @cmember Prenota la selezione della riga

+ void post_select(int r); // @cmember Vuota tutto lo spreadsheet virtual void reset(); diff --git a/include/multirec.cpp b/include/multirec.cpp index c1e3e678d..6acb30ab1 100755 --- a/include/multirec.cpp +++ b/include/multirec.cpp @@ -291,6 +291,7 @@ int TMultiple_rectype::loaded_rows(int logicnum) const } // @mfunc confronta due record multipli +// Affidabilità 95% int TMultiple_rectype::compare(const TSortable& s) const { int res = TRectype::compare(s); @@ -315,6 +316,28 @@ int TMultiple_rectype::compare(const TSortable& s) const return res; } +// @mfunc controlla se due record multipli sono uguali +// Affidabilità 100% +bool TMultiple_rectype::is_equal(const TMultiple_rectype& m) const +{ + bool yes = TRectype::is_equal(m); + for (int i = 0; yes && i < _nfiles; i++) + { + const int logicnum = _logicnums[i]; + TRecord_array & r = body(logicnum); + TRecord_array & r1 = m.body(logicnum); + yes = r.rows() == r1.rows(); + if (yes && r.rows() > 0 && r1.rows() > 0) + { + for (int j = r.last_row(), k = r1.last_row(); yes && j > 0 && k > 0; j = r.pred_row(j), k = r1.pred_row(k)) + { + yes = (j == k) && r[j].is_equal(r1[k]); + } + } + } + return yes; +} + int TMultiple_rectype::remove(TBaseisamfile & f) const { int err = NOERR; diff --git a/include/multirec.h b/include/multirec.h index 889d6e11b..36e7ed3b9 100755 --- a/include/multirec.h +++ b/include/multirec.h @@ -127,6 +127,8 @@ public: virtual void fill_transaction(TConfig& cfg, int row = 0) const; + bool is_equal(const TMultiple_rectype& r) const; + //************************** // @cmember costruttore dal numero del file TMultiple_rectype(int hfn); diff --git a/include/os_win16.cpp b/include/os_win16.cpp index d369eadce..bb9415d19 100755 --- a/include/os_win16.cpp +++ b/include/os_win16.cpp @@ -685,7 +685,7 @@ bool os_test_network_version() TToken_string v((const char *)lpBuffer,'.'); int subver=atoi(v.get(2)); if (subver >=1111 && subver <=1115) - return error_box("La versione %s del driver di rete '%s' contiene un bug riconosciuto da Microsoft. Consultare la documentazione sul sito AGA per eliminare questo inconveniente.",(const char *)lpBuffer, VREDIRNAME); + return error_box("La versione %s del driver di rete '%s' contiene un errore riconosciuto da Microsoft.\nConsultare il vostro tecnico per aggiornare il sistema operativo.",(const char *)lpBuffer, VREDIRNAME); else return TRUE; } diff --git a/include/printapp.cpp b/include/printapp.cpp index 8321ab36b..1c479c6d8 100755 --- a/include/printapp.cpp +++ b/include/printapp.cpp @@ -1048,9 +1048,9 @@ void TPrint_application::print() _repeat_print = FALSE; int ncopies = printer().n_copies(); - // never print multiple copies if printer is viswin - // only application may repeat printing by setting _repeat_print - int nc = printer().printtype() == screenvis ? 1 : ncopies; + // never print multiple copies if printer is viswin + // only application may repeat printing by setting _repeat_print + int nc = printer().printtype() == screenvis ? 1 : ncopies; // NULL cursor passed only prints once // pre and post process do everything @@ -1060,7 +1060,7 @@ void TPrint_application::print() //************************************************ while (nc--) { - int cnt = 0; + int cnt = 0; bool ok = TRUE; do { if (preprocess_print (0, cnt)) @@ -1082,26 +1082,26 @@ void TPrint_application::print() } else { - // cursor exists ********************************************* - while (nc--) - { - (*_cur) = 0l; - _cur->freeze (TRUE); - - if (_cur->items () >= _wthr && - (_force_progind || printer ().printtype () != screenvis)) - _prind = new TProgind (_cur->items (), _wmess, _wcancel, _wbar, 35); - print_tree (_pr_tree); - _cur->freeze (FALSE); - - if (_prind) + // cursor exists ********************************************* + while (nc--) + { + (*_cur) = 0l; + _cur->freeze (TRUE); + + if (_cur->items () >= _wthr && + (_force_progind || printer ().printtype () != screenvis)) + _prind = new TProgind (_cur->items (), _wmess, _wcancel, _wbar, 35); + print_tree (_pr_tree); + _cur->freeze (FALSE); + + if (_prind) { delete _prind; _prind = NULL; } - } - // **************************************************************** - } + } + // **************************************************************** + } if (!_repeat_print) { if (printer().isopen ()) diff --git a/include/progind.cpp b/include/progind.cpp index 89e186e89..d9c20f18a 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -37,13 +37,13 @@ TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div) const word lines = measure_text(testo, maxlen); int hor = maxlen+3; if (hor > 78) hor = 78; - int ver = lines+3; + int ver = lines+1; ver += bar ? 2 : 0; ver += cancel ? 2 : 0; set_win(create_interface(TASK_WIN, -1, -1, hor, ver, TITLE_TEXT, this, FALSE)); - _text = new TMultiline_control(win(), DLG_NULL, 1, 1, hor-2, lines+1, 512, "CD", ""); + _text = new TMultiline_control(win(), DLG_NULL, 1, 0, hor-2, lines+1, 512, "CD", ""); _text->set_read_only(); set_text(testo); diff --git a/include/progind.h b/include/progind.h index b8ae74206..4a296c120 100755 --- a/include/progind.h +++ b/include/progind.h @@ -89,7 +89,7 @@ public: void set_text(const char* t); // @cmember Costruttore - TIndwin(long max, const char* txt, bool cancel = TRUE, bool bar = TRUE, int div = 16); + TIndwin(long max, const char* txt, bool cancel = TRUE, bool bar = TRUE, int div = 60); // @cmember Distruttore virtual ~TIndwin(); }; diff --git a/include/real.cpp b/include/real.cpp index 8964c5c67..06d3b76eb 100755 --- a/include/real.cpp +++ b/include/real.cpp @@ -165,22 +165,36 @@ char *real::string ( } // Childish algorithm faster and more accurate than powl(10.0, pow) -HIDDEN long double ipow10(int pow) +HIDDEN void ipow10(int pow, double& m, double& d) { - long double n = 1.0; + m = d = 1.0; if (pow > 0) { for (int i = pow; i > 0; i--) - n *= 10.0; + { + m *= 10.0; + d *= 0.1; + } } else { for (int i = pow; i < 0; i++) - n *= 0.1; - } - return n; + { + m *= 0.1; + d *= 10.0; + } + } } +int real::precision() const +{ + const TFixed_string s(string()); + const int d = s.find('.'); + const int p = d < 0 ? 0 : (s.len()-d-1); + return p; +} + + // @doc EXTERNAL // @mfunc real& | real | round | Arrotonda al numero di decimali passati @@ -192,66 +206,68 @@ real& real::round ( // @flag 0 | Arrotonda al decimale // @flag = 0 | Arrotonda all'intero // @flag 0 | Arrotonda al valore passato (es. -3 arrotonda alle mille) -{ - long double p; - if (prec != 0) - { - p = ipow10(prec); - _dec *= p; +{ + if (abs(prec) < 20) + { + double m, d; + if (prec != 0) + { + ipow10(prec, m, d); + _dec *= m; + } + + if (_dec >= 0.0) + _dec = floorl(_dec + 0.5); + else + _dec = ceill(_dec - 0.5); + + if (prec != 0) + _dec *= d; } - - if (_dec >= 0.0) - _dec = floorl(_dec + 0.5); - else - _dec = ceill(_dec - 0.5); - - if (prec != 0) - _dec /= p; - return *this; } real& real::ceil (int prec) { - long double p = 1.0; + double m, d; if (prec != 0) { - p = ipow10(prec); - _dec *= p; + ipow10(prec, m, d); + _dec *= m; } _dec = ceill(_dec); if (prec != 0) - _dec /= p; + _dec *= d; return *this; } real& real::floor (int prec) { - long double p = 1.0; + double m, d; if (prec != 0) { - p = ipow10(prec); - _dec *= p; + ipow10(prec, m, d); + _dec *= m; } _dec = floorl(_dec); if (prec != 0) - _dec /= p; + _dec *= d; return *this; } real& real::trunc(int prec) { - long double p = 1.0; + double m, d; if (prec != 0) { - p = ipow10(prec); - _dec *= p; + ipow10(prec, m, d); + _dec *= m; } _dec = floorl(_dec); if (prec != 0) - _dec /= p; + _dec *= d; return *this; } @@ -558,9 +574,9 @@ istream & operator >> ( } -int real ::precision () +int real::precision() const { - return dprec (ptr ()); + return dprec(ptr()); } // @doc EXTERNAL @@ -575,16 +591,19 @@ real & real ::round ( // @flag = 0 | Arrotonda all'intero // @flag 0 | Arrotonda al valore passato (es. -3 arrotonda alle mille) { - if (prec < 0) + if (abs(prec < 20)) { - const double p = ::pow (10.0, -prec); - divdfd (ptr (), ptr (), p); - dround (ptr (), ptr (), 0); - muldfd (ptr (), ptr (), p); - trail(); + if (prec < 0) + { + const double p = ::pow (10.0, -prec); + divdfd (ptr (), ptr (), p); + dround (ptr (), ptr (), 0); + muldfd (ptr (), ptr (), p); + trail(); + } + else + dround (ptr (), ptr (), prec); } - else - dround (ptr (), ptr (), prec); return *this; } diff --git a/include/real.h b/include/real.h index d9d3c2e06..4eb2d6711 100755 --- a/include/real.h +++ b/include/real.h @@ -67,6 +67,8 @@ public: // @cmember Ritorna la stringa con il formato passato char* string(const char* picture) const; + // @cmember Ritorna la precisione del reale (numero di decimali) + int precision() const; // @cmember Controlla se si tratta di un reale uguale 0 (TRUE se 0) bool is_zero() const { return _dec == 0.0; } @@ -204,7 +206,7 @@ public: char* string(const char* picture) const; // @cmember Ritorna la precisione del reale (numero di decimali) - int precision() ; + int precision() const; // @cmember Controlla se si tratta di un reale uguale 0 (TRUE se 0) bool is_zero() const; // @cmember Ritorna il segno del reale diff --git a/include/recarray.cpp b/include/recarray.cpp index ca8136d95..77c2ac877 100755 --- a/include/recarray.cpp +++ b/include/recarray.cpp @@ -555,7 +555,8 @@ const TObject& TFile_cache::query(const char* code) const char* val = _code.get(); if (val) curr.put(rf.Name, val); -// else NFCHECK("Valore del campo chiave %s non specificato per la cache", rf.Name); + else + curr.zero(rf.Name); } f.setkey(_key); _error = f.read(); @@ -751,6 +752,7 @@ bool TDB_cache::discard(int file, const char* key) { return rec_cache(file).discard(key); } + bool TDB_cache::discard(const char *table, const char* key) { CHECK(table && *table, "Invalid Table code"); @@ -766,6 +768,23 @@ bool TDB_cache::discard(const char *table, const char* key) return rec_cache(file).discard(tabkey); } +bool TDB_cache::discard(const TRectype& curr) +{ + const int file = curr.num(); + const RecDes* recd = curr.rec_des(); // Descrizione del record della testata + const KeyDes& kd = recd->Ky[0]; // Elenco dei campi della chiave 1 + + TToken_string code; + for (int i = 0; i < kd.NkFields; i++) // Riempie la chiave selezionata + { + const int nf = kd.FieldSeq[i] % MaxFields; + const RecFieldDes& rf = recd->Fd[nf]; + const char* val = curr.get(rf.Name); + code.add(val); + } + return discard(file, code); +} + TDB_cache& cache() { static TDB_cache* _frate_cercone = NULL; diff --git a/include/recarray.h b/include/recarray.h index 72b2fcfe9..e2da1d851 100755 --- a/include/recarray.h +++ b/include/recarray.h @@ -243,6 +243,7 @@ public: bool discard(int file, const char* key); bool discard(const char *table, const char* key); + bool discard(const TRectype& rec); void flush(int file) { rec_cache(file).flush(); } const TRectype& get(int file, const char* key) diff --git a/include/relapp.cpp b/include/relapp.cpp index ec8589918..05732748b 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -661,12 +661,13 @@ int TRelation_application::delete_mode() for (TString80 tok = inplist.get(fi); tok.not_empty(); tok = inplist.get(), fi++) { const TString16 fn = fldlist.get(fi); + const TFieldref fr(fn, 0); if (*tok == '"') { str = tok; str.ltrim(1); str.rtrim(1); - rec_from.put(fn, str); - rec_to.put(fn, str); + fr.write(str, rec_from); + fr.write(str, rec_to); } else { @@ -675,16 +676,16 @@ int TRelation_application::delete_mode() { str = sht.get(id+delta); if (str.not_empty()) - rec_from.put(fn, str); + fr.write(str, rec_from); str = sht.get(id+2*delta); if (str.not_empty()) - rec_to.put(fn, str); + fr.write(str, rec_to); } else { str = _mask->get(id); - rec_from.put(fn, str); - rec_to.put(fn, str); + fr.write(str, rec_from); + fr.write(str, rec_to); } } } @@ -1169,7 +1170,7 @@ void TRelation_application::main_loop() } } - if (_curr_transaction.not_empty()) + if (is_transaction()) ini2query_mask(); do @@ -1229,7 +1230,7 @@ void TRelation_application::main_loop() case K_SAVE: if (save(FALSE)) { - if (_autoins_caller.not_empty() || _curr_transaction.not_empty()) + if (_autoins_caller.not_empty() || is_transaction()) { k = K_QUIT; } @@ -1255,7 +1256,7 @@ void TRelation_application::main_loop() { modify_mode(); warning_box("Elemento gia' presente"); - if (_curr_transaction.not_empty()) + if (is_transaction()) { _curr_transaction=TRANSACTION_MODIFY; _curr_trans_mode = TM_INTERACTIVE; // switch to interactive mode @@ -1277,7 +1278,7 @@ void TRelation_application::main_loop() if (relation_remove()) { query_mode(); - if (_autoins_caller.not_empty() || _curr_transaction.not_empty()) + if (_autoins_caller.not_empty() || is_transaction()) { if (_lnflag) _recins = 0; k = K_QUIT; @@ -1334,8 +1335,8 @@ void TRelation_application::main_loop() TMessage msg(autoins_caller(), _lnflag ? MSG_LN : MSG_AI, num); msg.send(); } - - if (_curr_transaction.not_empty()) + + if (is_transaction()) { TConfig ini(_trans_ini.row(_trans_counter), "Transaction"); ini.set("Record", _recins); @@ -1593,7 +1594,7 @@ bool TRelation_application::load_transaction() void TRelation_application::ini2query_mask() { - if (_curr_transaction.not_empty()) + if (is_transaction()) { TConfig ini(_trans_ini.row(_trans_counter), format("%d", get_relation()->lfile().num())); ini2mask(ini, *_mask, TRUE); @@ -1602,7 +1603,7 @@ void TRelation_application::ini2query_mask() void TRelation_application::ini2insert_mask() { - if (_curr_transaction.not_empty()) + if (is_transaction()) { TConfig ini(_trans_ini.row(_trans_counter), format("%d", get_relation()->lfile().num())); ini2mask(ini, *_mask, FALSE); diff --git a/include/relapp.h b/include/relapp.h index c1e27b8d3..316bf3d85 100755 --- a/include/relapp.h +++ b/include/relapp.h @@ -245,6 +245,8 @@ public: // @cmember Ritorna se e' stato chiamato col messaggio di link byte lnflag() const { return _lnflag;} + // @cmember Ritorna TRUE se e' una transazione + bool is_transaction() const { return _curr_transaction.not_empty(); } // @cmember Costruttore TRelation_application(); diff --git a/include/relation.cpp b/include/relation.cpp index 52969ac1c..061c21b4a 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -633,7 +633,13 @@ int TRelation::position_rels( if (rd._forced[kk]) eq = f_fr == f_ex; else + { eq = f_fr.compare(f_ex, f_ex.len()) == 0; + + // Becca anche 000001=1 + if (!eq && real::is_natural(f_fr) && real::is_natural(f_ex)) + eq = atol(f_fr) == atol(f_ex); + } } rd._first_match = eq; if (eq) @@ -1020,9 +1026,11 @@ TRecnotype TCursor::buildcursor(TRecnotype rp) { if (DB_index_eof(fhnd)) break; const char* s0 = DB_index_getkey(fhnd); - if (l && (strncmp(to(), s0, l) < 0)) break; + if (l && (strncmp(to(), s0, l) < 0)) + break; const TRecnotype recno = DB_index_recno(fhnd); - if (recno == oldrecno) break; // means that no more keys are available + if (recno == oldrecno) + break; // means that no more keys are available oldrecno=recno; if (pagecnt == CMAXELPAGE) { @@ -1231,6 +1239,7 @@ TRecnotype TCursor::update() return totrec; } + HIDDEN void matildator(const TRectype& oldrec, int key, bool tilde, TString& str) { if (tilde) @@ -1415,7 +1424,7 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop) TLocalisamfile& curfile = file(); const TRecnotype curpos = curfile.recno(); if (changed()) - _totrec = update(); + update(); if (err != NOERR) { @@ -1546,7 +1555,7 @@ int TCursor::lock( TRecnotype TCursor::operator =(const TRecnotype pos) { if (changed()) - _totrec = update(); + update(); CHECKD(pos >= 0 && pos <= _totrec, "Bad cursor position : ", pos); _pos = pos; readrec(); @@ -1557,7 +1566,7 @@ TRecnotype TCursor::operator =(const TRecnotype pos) TRecnotype TCursor::operator +=(const TRecnotype npos) { if (changed()) - _totrec = update(); + update(); _pos += npos; if (_pos > _totrec) @@ -1572,7 +1581,7 @@ TRecnotype TCursor::operator +=(const TRecnotype npos) TRecnotype TCursor::items() { if (changed()) - _totrec = update(); + update(); return _totrec; } @@ -2656,8 +2665,9 @@ int TSortedfile::last(word lockop) // @mfunc Si posiziona sul successivo record del file (vedi ) int TSortedfile::next(word lockop ) { - _curs->succ_item(); int err = _curs->pos() < _curs->items() ? NOERR : _iseof; + if (err == NOERR) + _curs->succ_item(); setstatus(err); return err; } @@ -2820,8 +2830,8 @@ TSortedfile::TSortedfile(int logicnum, TRelation* rel, const char* ordexpr, cons if (!rel) _rel = new TRelation(logicnum); else - _rel=rel; - _curs = new TSorted_cursor(_rel,ordexpr,"",nkey); + _rel = rel; + _curs = new TSorted_cursor(_rel, ordexpr, "", nkey); if (&curr()!=&(_curs->file().curr())) _curs->file().set_curr(&curr()); diff --git a/include/relation.h b/include/relation.h index 0d1d25226..f666659d8 100755 --- a/include/relation.h +++ b/include/relation.h @@ -262,9 +262,6 @@ class TCursor : public TContainer // @cmember:(INTERNAL) Nome del file indice TFilename _indexname; - // @cmember:(INTERNAL) Crea (o aggiorna) effettivamente l'indice del cursore - TRecnotype update(); - // @access Protected Member protected: // @cmember Apre il file di indice @@ -410,7 +407,10 @@ public: bool has_filter() const { return _filter.not_empty() || _filterfunction; } bool has_simple_filter() const; - + + // @cmember:(INTERNAL) Crea (o aggiorna) effettivamente l'indice del cursore + TRecnotype update(); + // @cmember Salva la posizione attuale di tutti i file del cursore void save_status() { _if->save_status(); } diff --git a/include/rmov.h b/include/rmov.h index 3dc1fbdc4..b8765a5ac 100755 --- a/include/rmov.h +++ b/include/rmov.h @@ -18,6 +18,8 @@ #define RMV_SOTTOCONTOC "SOTTOCONTC" #define RMV_ROWTYPE "ROWTYPE" +// Centro di costo +#define RMV_CDC "NUMGIO" // To be removed soon #define RMV_NUMGIO "NUMGIO" #define RMV_RCONTR "RCONTR" diff --git a/include/scanner.cpp b/include/scanner.cpp index e70e7f0ad..4bc751fad 100755 --- a/include/scanner.cpp +++ b/include/scanner.cpp @@ -12,7 +12,7 @@ TScanner::TScanner(const char* filename) : _pushed(FALSE), _line(0), _token(128), _key(2), _buffer(1024*16), _tmp(1024*8) { - setbuf(_buffer.get_buffer(), _buffer.size()); + setbuf((char*)(const char*)_buffer, _buffer.size()); open(filename, ios::in | ios::nocreate, filebuf::sh_read); if (fail()) fatal_box("Impossibile leggere il file '%s'", filename); diff --git a/include/sheet.cpp b/include/sheet.cpp index 47a5ea5c2..9183502bf 100755 --- a/include/sheet.cpp +++ b/include/sheet.cpp @@ -1,3 +1,4 @@ +#define XI_INTERNAL #include #include @@ -866,7 +867,12 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev) _save_columns_order = TRUE; break; case XIE_COL_SIZE: - _save_columns_order = TRUE; + { + if (_obj->v.list->hsb_win) + _save_columns_order = TRUE; + else + refused = TRUE; // Non permetto il resize in assenza di scroll bar orizzontale + } break; case XIE_BUTTON: if (xiev->v.xi_obj->type == XIT_LIST) @@ -1125,7 +1131,26 @@ bool TSheet::on_key(KEY key) if (id2pos(DLG_SELECT) >= 0) stop_run(K_ENTER); break; - default: + default: + key -= K_CTRL; + if (key >= 'A' && key <= 'Z') + { + for (int i = fields()-1; i >= 0; i--) + { + TMask_field& f = fld(i); + if (f.active() && f.is_kind_of(CLASS_BUTTON_FIELD)) + { + TButton_field& b = (TButton_field&)f; + if (b.virtual_key() == key) + { + f.on_key(K_SPACE); + if (b.exit_key() > 0) + stop_run(b.exit_key()); + return TRUE; + } + } + } + } break; } diff --git a/include/urldefid.h b/include/urldefid.h index d255d0771..e6a3dc04d 100755 --- a/include/urldefid.h +++ b/include/urldefid.h @@ -85,6 +85,8 @@ #define BMP_DIRDN 168 #define BMP_FILE 169 #define BMP_STOP 170 - +#define BMP_FILECHK 171 #endif +/* @END */ + diff --git a/include/utility.cpp b/include/utility.cpp index 4e790d571..e47a4e1b4 100755 --- a/include/utility.cpp +++ b/include/utility.cpp @@ -54,7 +54,8 @@ bool fcopy( if (letti < size) break; } - if (!ok) error_box("Errore di scrittura: probabile disco pieno!"); + if (!ok) + error_box("Errore di scrittura: controllare lo spazio libero sul disco!"); fclose(o); fclose(i); @@ -122,13 +123,11 @@ bool make_dir( // jolly) passata. // // @rdesc Ritorna il numero di file che soddisfano la condizione passata (numero di elementi -// della token string) +// di result) int list_files( const char* filelist, // @parm Stringa contenente la maschera di estrazione TString_array& result) // @parm Array da riempire con la lista dei file - // @comm Per comodita' la lista desiderata vine anch'essa messa in

in quanto e' - // gia' costruita { TFilename dir(filelist); for (int i = dir.len()-1; i >= 0; i--) @@ -345,59 +344,59 @@ const char *esc( int base; if (s1) - while (*s1) - { - if (*s1 == '\\') - { - s1++; - switch (tolower(*s1)) - { - case 'b' : *s2++ = '\b'; break; - case 'e' : *s2++ = '\033'; break; - case 'f' : *s2++ = '\f'; break; - case 'n' : *s2++ = '\n'; break; - case 'r' : *s2++ = '\r'; break; - case 't' : *s2++ = '\t'; break; - default : - { - if (isdigit(*s1)) - { - if (*s1 == '0') - { - s1++; - if (tolower(*s1) == 'x') - { - s1++; - base = 16; - } - else base = 8; - } - else base = 10; - *s2 = 0; - char c = tolower(*s1); - while (isdigit(c) || (base == 16 && c >= 'a' && c <= 'f')) - { - *s2 *= base; - if (isdigit(*s1)) *s2 += (*s1 - 48); - else *s2 += (*s1 - 'a' + 10) & 0x0F; - s1++; - c = tolower(*s1); - } - s2++; s1--; - } - else *s2++ = *s1; - } - } - } - else - if (*s1 == '^') - { - s1++; - *s2++ = (tolower(*s1) - 'a' + 1); - } - else *s2++ = *s1 ; - s1++; - } + while (*s1) + { + if (*s1 == '\\') + { + s1++; + switch (tolower(*s1)) + { + case 'b' : *s2++ = '\b'; break; + case 'e' : *s2++ = '\033'; break; + case 'f' : *s2++ = '\f'; break; + case 'n' : *s2++ = '\n'; break; + case 'r' : *s2++ = '\r'; break; + case 't' : *s2++ = '\t'; break; + default : + { + if (isdigit(*s1)) + { + if (*s1 == '0') + { + s1++; + if (tolower(*s1) == 'x') + { + s1++; + base = 16; + } + else base = 8; + } + else base = 10; + *s2 = 0; + char c = tolower(*s1); + while (isdigit(c) || (base == 16 && c >= 'a' && c <= 'f')) + { + *s2 *= base; + if (isdigit(*s1)) *s2 += (*s1 - 48); + else *s2 += (*s1 - 'a' + 10) & 0x0F; + s1++; + c = tolower(*s1); + } + s2++; s1--; + } + else *s2++ = *s1; + } + } + } + else + if (*s1 == '^') + { + s1++; + *s2++ = (tolower(*s1) - 'a' + 1); + } + else *s2++ = *s1 ; + s1++; + } *s2 = '\0'; return(__tmp_string); } diff --git a/include/validate.cpp b/include/validate.cpp index 5721fde56..c8dcd97ff 100755 --- a/include/validate.cpp +++ b/include/validate.cpp @@ -143,9 +143,13 @@ HIDDEN bool _pi_val(TMask_field& f, KEY) bool ok = pi_check (stato, pi); if (!ok) { - if(f.dirty()) + if (f.dirty()) { - ok = f.yesno_box("Partita IVA errata, la accetto ugualmente?"); + bool len_error = TRUE; + if (stato.blank() || stato == "IT") + len_error = pi.len() != 11; + const char* msg = len_error ? "Lunghezza p" : "P"; + ok = f.yesno_box("%sartita IVA errata, la accetto ugualmente?", msg); if (ok) f.set_dirty(FALSE); } else ok = TRUE; // Era gia' errata e la ho accettata diff --git a/include/varrec.cpp b/include/varrec.cpp index 0fa460a59..e30d939f8 100755 --- a/include/varrec.cpp +++ b/include/varrec.cpp @@ -160,7 +160,7 @@ void TVariable_rectype::unknown_field(const char* name) const TRectype::unknown_field(name); } -void TVariable_rectype::write_memo(int file, const TRecnotype recno) +void TVariable_rectype::write_memo(TIsam_handle file, const TRecnotype recno) { if (_memo_fld.not_empty()) { @@ -204,9 +204,9 @@ void TVariable_rectype::remove_field(const char * fieldname) void TVariable_rectype::set_variables(TExpression * e) const { - const int items = e->numvar(); - for (int i = 0; i < items; i++) - e->setvar(i, get(e->varname(i))); + const int items = e->numvar(); + for (int i = 0; i < items; i++) + e->setvar(i, get(e->varname(i))); } void TVariable_rectype::set_memo_fld( const char * fieldname) @@ -221,9 +221,9 @@ void TVariable_rectype::set_memo_fld( const char * fieldname) _memo_fld.cut(0); } -void TVariable_rectype::init_memo( const TRecnotype recno) +void TVariable_rectype::init_memo(TRecnotype recno, TIsam_handle file) { - TRectype::init_memo(recno); + TRectype::init_memo(recno, file); if (recno != RECORD_NON_FISICO) _memo_fld_to_load = _memo_fld.not_empty(); } diff --git a/include/varrec.h b/include/varrec.h index eadc34e18..62c01b6eb 100755 --- a/include/varrec.h +++ b/include/varrec.h @@ -137,8 +137,8 @@ public: void set_memo_fld(const char * fieldname); void reset_memo_fld() { set_memo_fld(NULL); } - virtual void init_memo(const TRecnotype recno = RECORD_NON_FISICO); - virtual void write_memo(int file, const TRecnotype recno); + virtual void init_memo(const TRecnotype recno = RECORD_NON_FISICO, TIsam_handle file = 0); + virtual void write_memo(TIsam_handle file, const TRecnotype recno); virtual void add_field(TVariable_field * f); virtual void remove_field(const char * fieldname = NULL); diff --git a/include/viswin.cpp b/include/viswin.cpp index 5769a2190..5f7fa83cb 100755 --- a/include/viswin.cpp +++ b/include/viswin.cpp @@ -245,7 +245,8 @@ void TViswin::exec_link() { TPrint_application& papp = (TPrint_application&)main_app(); papp.repeat_print(); - papp.current_cursor()->freeze(FALSE); +// papp.current_cursor()->freeze(FALSE); + papp.current_cursor()->update(); xvt_statbar_refresh (); stop_run(K_ENTER); } @@ -2327,14 +2328,17 @@ void TViswin::add_line (const char *l) _txt.append (l); const long tot = _txt.lines(); const bool visible = (tot - origin().y) <= _textrows; - if (visible || (tot & 0xF) == 0) + if (visible) { EVENT ev; ev.type = E_USER; - ev.v.user.id = visible ? E_ADDLINE_ONSCREEN : E_ADDLINE; + ev.v.user.id = E_ADDLINE_ONSCREEN; xvt_win_dispatch_event (win(), &ev); - do_events (); } + else + set_scroll_max (MAXLEN - 1, tot-1); + if ((tot & 0xF) == 0) + do_events (); } } diff --git a/m770/770.cpp b/m770/770.cpp index 1ed577ac2..01eb38a22 100755 --- a/m770/770.cpp +++ b/m770/770.cpp @@ -1,30 +1,16 @@ #include -#include -#include "770.h" -#define usage "Error - usage : %s -{0|1|2|3|4|5} [params]" +#include "770.h" int main(int argc,char** argv) { - const int n = (argc > 1) ? atoi(argv[1]+1) : -1; + const int n = (argc > 1) ? atoi(argv[1]+1) : 0; switch(n) { - case 0: - SchedaPerc(argc,argv); break; case 1: collega_vers_rit(argc,argv); break; - case 2: - // cg1300(argc,argv); break; - case 3: - // cg1400(argc,argv); break; - case 4: - // cg1500(argc,argv); break; - case 5: - // cg1600(argc,argv); break; - case 6: - // cg1700(argc,argv); break; default: - error_box(usage, argv[0]); break; + SchedaPerc(argc,argv); break; } return n < 0; diff --git a/m770/770100.cpp b/m770/770100.cpp index 389e3a895..2e05ae962 100755 --- a/m770/770100.cpp +++ b/m770/770100.cpp @@ -19,82 +19,27 @@ // Token_string pilota per relazione tra l'informazione e la // sua posizione nello sheet, ogni riga individua uno sheet diverso const char* PILOT_SHEET[] = { - "DATAPAG|COMPENSO|SPESA|IMPONIBILE|PERC|RITLORDA|CONTROBB|DETFAMIL|GIOLAVDIP|DETLAVDIP|TOTDET|RITENUTA|NETTO|SOMNSRIT|AMMLORDO|QUOTAPROV|IMPNETTO|COMNETTO|NUMVERS", - "DATAPAG|COMPENSO|IMPCPA|IMPONIBILE|PERC|RITENUTA|SPESA|SOMREGCONV|NETTO|SOMNSRIT|AMMLORDO|QUOTAPROV|IMPNETTO|COMNETTO|NUMVERS", - "DATAPAG|COMPENSO|SPESA|IMPONIBILE|PERC|RITENUTA|SOMREGCONV|ALQIMP10|CTSSNPERC|CTSSNCOMP|COD10|NETTO|SOMNSRIT|AMMLORDO|QUOTAPROV|IMPNETTO|COMNETTO|NUMVERS", - "DATAPAG|COMPENSO|IMPONIBILE|PERC|RITENUTA|UTPAGATI|RITUTPAG|UTSPETT|RITUTSPE|NQUOTE|NETTO|SOMNSRIT|AMMLORDO|QUOTAPROV|IMPNETTO|COMNETTO|NUMVERS"}; + "DATAPAG|COMPENSO|SPESA|IMPONIBILE|PERC|RITENUTA|SOMREGCONV|ALQIMP10|CTSSNPERC|CTSSNCOMP|COD10|NETTO|SOMNSRIT|AMMLORDO|QUOTAPROV|IMPNETTO|COMNETTO|NUMVERS", + "DATAPAG|COMPENSO|IMPCPA|IMPONIBILE|PERC|RITENUTA|SPESA|SOMREGCONV|NETTO|SOMNSRIT|AMMLORDO|QUOTAPROV|IMPNETTO|COMNETTO|NUMVERS", + }; -// Items per causale quadro C -const int NUM_ITEMS_C = 8; -const char* ITEMS_C[] = { - "A|indenn. e compensi erogati ai prest. lavoro dipendente.....", - "B|somme corrisp. a titolo di borsa di studio o di assegno....", - "C|indenn., gett. di pres. altri comp. corrisp. dallo Stato...", - "D|indenn., percep. per cariche elettive di cui all'art. 114..", - "E|rendite vital. e rendite a tempo determ., a tit. oneroso...", - "F|prestaz. comunque erogate in forma di trattam. periodico...", - "G|ass. period. alla cui prod. concor. né capitale né lavoro..", - "H|compensi corrisp. ai lav. imp. in lavori socialm. utili...."}; +// Items per causale quadro SC +const char* ITEMS_SC[] = { + "A|A", "B|B", "C|C", "D|D", "E|E", "F|F", "G|G", "H|H", "I|I", + "K|K", "L|L", "M|M", "N|N", "P|P", "Q|Q", "R|R", "S|S", "T|T", NULL }; -// Items per causale quadro D -const int NUM_ITEMS_D = 13; -const char* ITEMS_D[] = { - "A|prestaz. di lav. auton. nell'eserc. di arti o prof. abit...", - "B|utiliz. econom., da parte dell'autore o dell'inventore,....", - "C|a titolo di utili deriv. da contrat. di ass. in partecip...", - "D|a titolo di utili spett. ai soci prom. ed ai soci fondat...", - "E|per la levata di protesti cambiari da parte dei segr. com..", - "F|utiliz. econom., da parte di sogg. diverso dall'autore o...", - "G|indenn. corrisp. per la cessaz. dei rapporti di agenzia....", - "H|indenn. corrisp. per la cessaz. da funzioni notarili", - "I|indenn. di trasf. o di rimb. forfet. di spese spettanti....", - "L|prestaz. di lavoro autonomo non esercitate abitualmente", - "M|prestaz. rese dagli sportivi con contratto di lav. autonomo", - "N|indenn. corrisp. per la cessaz. di attività sportiva prof..", - "T|altro titolo diverso dai precedenti"}; +// Items per causale quadro SE +const char* ITEMS_SE[] = { + "A|A", "B|B", "C|C", "D|D", "E|E", "F|F", "G|G", "T|T", NULL }; -// Items per causale quadro Dbis -const int NUM_ITEMS_DB = 8; -const char* ITEMS_DB[] = { - "A|prestaz. di lav. auton. ..... iscritti in albi senza cassa", - "B|prestaz. rese da amministrat., sindaci e revis. di soc.....", - "C|prestaz. rese da collab. a giornali, riviste, enciclop.....", - "D|prestaz. rese da partecipanti a collegi e commissioni", - "E|prestaz. di collab. coord. e contin. diversi da quelli.....", - "F|indenn. corrisp. per la cessaz. di rapp.. ass. a tass. sep.", - "G|provvigioni degli incaricati per le vendite a domicilio", - "T|altro titolo diverso dai precedenti"}; +// Items per causale quadro SF +const char* ITEMS_SF[] = { + "A|A", "B|B", "C|C", "D|D", "E|E", "F|F", "G|G", "H|H", "I|I", + "L|L", "M|M", "N|N", "P|P", "Q|Q", "R|R", "S|S", "T|T", NULL }; -// Items per causale quadro D1 -const int NUM_ITEMS_D1 = 5; -const char* ITEMS_D1[] = { - "A|Agente o rappresentante di commercio monomandatario", - "B|Agente o rappresentate plurimandatario", - "C|Commissionario", - "D|Mediatore", - "E|Procacciatore d'affari"}; - -// Items per causale quadro E -const int NUM_ITEMS_E = 5; -const char* ITEMS_E[] = { - "A|redditi di capitale corrisp. a sogg. resid. non eserc......", - "B|prov. corrisp. a stabili organiz. estere di impr. resid....", - "C|comp. per avviamento commerc. assogg. alla rit. a tit. acc.", - "D|contrib. degli enti pubbl. e premi corrisp. dall'Unione....", - "E|interessi, premi e altri frutti dei tit. obbligaz. emessi.."}; - -// Items per causale quadro E1 -const int NUM_ITEMS_E1 = 4; -const char* ITEMS_E1[] = { - "A|somme deriv. dal riscatto di contratti di assic. sulla vita", - "B|capitali corrisp. in dipend... per i quali rit. del 12,50..", - "C|capitali corrisp. in dipend. di contr. di assic. sulla vita", - "D|capitali corrisp. in dipend. di contr. di capitalizzazione"}; - -// Items per causale quadro G -const int NUM_ITEMS_G = 1; -const char* ITEMS_G[] = { - " |Niente"}; +// Items per causale quadro SG +const char* ITEMS_SG[] = { + "A|A", "B|B", "C|C", "D|D", "E|E", NULL }; HIDDEN TString80 __tmp; @@ -1068,27 +1013,27 @@ TSheet_field& TSchedaPercipienti::pag_sheet_enabled(TMask& m, bool force_enable) // istanza reference sheet a disposizione TSheet_field& s_C = (TSheet_field&)m.field(F_PAGAMENTI_C); - TSheet_field& s_D = (TSheet_field&)m.field(F_PAGAMENTI_D); - TSheet_field& s_DB = (TSheet_field&)m.field(F_PAGAMENTI_DB); - TSheet_field& s_G = (TSheet_field&)m.field(F_PAGAMENTI_G); + TSheet_field& s_E = (TSheet_field&)m.field(F_PAGAMENTI_C); + TSheet_field& s_F = (TSheet_field&)m.field(F_PAGAMENTI_D); + TSheet_field& s_G = (TSheet_field&)m.field(F_PAGAMENTI_D); // forza la disabilitazione di tutti se richiesta // l'abilitazionein base al quadro if (force_enable) { s_C.hide(); - s_D.hide(); - s_DB.hide(); + s_E.hide(); + s_F.hide(); s_G.hide(); } // valorizzo reference sheet abilitato if (s_C.shown()) s = &s_C; - if (s_D.shown()) - s = &s_D; - if (s_DB.shown()) - s = &s_DB; + if (s_E.shown()) + s = &s_E; + if (s_F.shown()) + s = &s_F; if (s_G.shown()) s = &s_G; @@ -1231,7 +1176,7 @@ int TSchedaPercipienti::token_dlg(const char* t) const const char* TSchedaPercipienti::pilot_sheet() const { // reperisco sheet attivo - TSheet_field& s = pag_sheet_enabled(TheMask()); + TSheet_field& s = pag_sheet_enabled(TheMask()); // individuo la testata giusta char* columns; @@ -1240,8 +1185,9 @@ const char* TSchedaPercipienti::pilot_sheet() const { case F_PAGAMENTI_C : columns = (char*)PILOT_SHEET[0]; break; case F_PAGAMENTI_D : columns = (char*)PILOT_SHEET[1]; break; - case F_PAGAMENTI_DB : columns = (char*)PILOT_SHEET[2]; break; - case F_PAGAMENTI_G : columns = (char*)PILOT_SHEET[3]; break; +// esistevano nel vecchio caso +// case F_PAGAMENTI_DB : columns = (char*)PILOT_SHEET[2]; break; +// case F_PAGAMENTI_G : columns = (char*)PILOT_SHEET[3]; break; default : break; } @@ -1926,11 +1872,11 @@ Pag_struct& TSchedaPercipienti::calcola_riga_pag(Pag_struct& s, return s; } -TSheet_field& TSchedaPercipienti::enable_pag_sheet(TMask& m, TString16& quadro) const +TSheet_field& TSchedaPercipienti::enable_pag_sheet(TMask& m, const TString& quadro) const { TSheet_field* s = NULL; - - TSheet_field& s_C = (TSheet_field&)m.field(F_PAGAMENTI_C); +// procedura originale +/* TSheet_field& s_C = (TSheet_field&)m.field(F_PAGAMENTI_C); if (quadro == "C") { s_C.show(); @@ -1961,6 +1907,23 @@ TSheet_field& TSchedaPercipienti::enable_pag_sheet(TMask& m, TString16& quadro) s = &s_G; } else s_G.hide(); +*/ + + TSheet_field& s_C = (TSheet_field&)m.field(F_PAGAMENTI_C); + if (quadro == "SC" || quadro == "SE") + { + s_C.show(); + s = &s_C; + } + else s_C.hide(); + + TSheet_field& s_F = (TSheet_field&)m.field(F_PAGAMENTI_D); + if (quadro == "SF" || quadro == "SG") + { + s_F.show(); + s = &s_F; + } + else s_F.hide(); // abilito sheet di default nel caso il quadro non fosse uno dei previsti if (s == NULL) @@ -2033,7 +1996,7 @@ void TSchedaPercipienti::set_pag_handler(TSheet_field& s) const s.sheet_mask().set_handler(DLG_AZZERAPAG, pag_azzera); } -void TSchedaPercipienti::build_causqua_items(TMask& m, TString16& quadro) const +void TSchedaPercipienti::build_causqua_items(TMask& m, const TString& quadro) const { // reference al campo causale quadro TEdit_field& f_causqua = m.efield(F_CAUSQUA); @@ -2042,27 +2005,18 @@ void TSchedaPercipienti::build_causqua_items(TMask& m, TString16& quadro) const // rimuovo tutti gli items Items.destroy(); // genero i nuovi items - if (quadro == "C") - for (int i=0; iCODCAUS PROMPT 0 1 "" - USE %CA7 SELECT (I0!="1015")&&((S1="C")||(S1="D")||(S1="DB")||(S1="D1")||(S1="E")||(S1="E1")||(S1="G")) + USE %CA7 CHECKTYPE REQUIRED INPUT CODTAB F_CODCAUS DISPLAY "Cod." CODTAB @@ -58,12 +58,10 @@ BEGIN DISPLAY "Descrizione @35" S0 DISPLAY "Cod.trib." I0 DISPLAY "Art.bil." I3 - DISPLAY "C.C" S6 - DISPLAY "C.D" S2 - DISPLAY "C.Db" S7 - DISPLAY "C.D1" S3 - DISPLAY "C.E" S8 - DISPLAY "C.E1" S9 + DISPLAY "C.SC" S2 + DISPLAY "C.SE" S3 + DISPLAY "C.SF" S8 + DISPLAY "C.SG" S9 DISPLAY "T.S." S4 OUTPUT F_CODCAUS CODTAB OUTPUT F_CODTRIB I0 @@ -77,13 +75,11 @@ BEGIN OUTPUT F_PERC_ASS_INPS R2 OUTPUT F_PERC_COMMIT_INPS R3 OUTPUT F_CASSA_PREV R5 - OUTPUT F_TABCAUSQUAC S6 - OUTPUT F_TABCAUSQUAD S2 - OUTPUT F_TABCAUSQUADB S7 - OUTPUT F_TABCAUSQUAD1 S3 - OUTPUT F_TABCAUSQUAE S8 - OUTPUT F_TABCAUSQUAE1 S9 - OUTPUT F_TABFLAGTS S4 + OUTPUT F_TABCAUSQUASC S2 + OUTPUT F_TABCAUSQUASE S3 + OUTPUT F_TABCAUSQUASF S8 + OUTPUT F_TABCAUSQUASG S9 + OUTPUT F_FLAGTS S4 FLAGS "Z" WARNING "Manca la causale" ADD RUN 773mod -3 %CA7 @@ -226,55 +222,9 @@ END TEXT DLG_NULL BEGIN PROMPT 1 7 "@bPagamenti" -END +END SPREADSHEET F_PAGAMENTI_C 79 5 -BEGIN - PROMPT 0 8 "" - ITEM "Data@10" - ITEM "Compenso@15" - ITEM "Spese@15" - ITEM "Imponibile@15" - ITEM "% R.a." - ITEM "Ritenuta lorda@15" - ITEM "Con.obbligatori@15" - ITEM "Det.ca.famiglia@15" - ITEM "gg det." - ITEM "Det.lav.dipend.@15" - ITEM "Tot.detrazioni@15" - ITEM "Ritenuta@15" - ITEM "Compenso netto@15" - ITEM "Som.non sog.rit@15" - ITEM "Ammontare lordo@15" - ITEM "Quota provvig.@15" - ITEM "Imp.netto rit.@15" - ITEM "Comp.netto rit.@15" - ITEM "Numver@5" - FLAGS "H" -END - -SPREADSHEET F_PAGAMENTI_D 79 5 -BEGIN - PROMPT 0 8 "" - ITEM "Data@10" - ITEM "Compenso@15" - ITEM "CPA@15" - ITEM "Imponibile@15" - ITEM "% R.a." - ITEM "Ritenuta@15" - ITEM "Spese@15" - ITEM "Somme reg.conv.@15" - ITEM "Compenso netto@15" - ITEM "Som.non sog.rit@15" - ITEM "Ammontare lordo@15" - ITEM "Quota provvig.@15" - ITEM "Imp.netto rit.@15" - ITEM "Comp.netto rit.@15" - ITEM "Numver@5" - FLAGS "H" -END - -SPREADSHEET F_PAGAMENTI_DB 79 5 BEGIN PROMPT 0 8 "" ITEM "Data@10" @@ -296,22 +246,20 @@ BEGIN ITEM "Comp.netto rit.@15" ITEM "Numver@5" FLAGS "H" -END +END -SPREADSHEET F_PAGAMENTI_G 79 5 +SPREADSHEET F_PAGAMENTI_D 79 5 BEGIN PROMPT 0 8 "" ITEM "Data@10" - ITEM "Compenso@15" + ITEM "Compenso@15" + ITEM "CPA@15" ITEM "Imponibile@15" ITEM "% R.a." - ITEM "Ritenuta@15" - ITEM "Utili pagati@15" - ITEM "Rit.ut.pagati@15" - ITEM "Utili spet.@15" - ITEM "Rit.ut.spet.@15" - ITEM "N°quote" - ITEM "Totale@15" + ITEM "Ritenuta@15" + ITEM "Spese@15" + ITEM "Somme reg.conv.@15" + ITEM "Compenso netto@15" ITEM "Som.non sog.rit@15" ITEM "Ammontare lordo@15" ITEM "Quota provvig.@15" @@ -319,7 +267,56 @@ BEGIN ITEM "Comp.netto rit.@15" ITEM "Numver@5" FLAGS "H" -END +END + + +//SPREADSHEET F_PAGAMENTI_DB 79 5 inutilizzato con i nuovi quadri (12/07/00) +//BEGIN +// PROMPT 0 8 "" +// ITEM "Data@10" +// ITEM "Compenso@15" +// ITEM "Spese@15" +// ITEM "Imponibile@15" +// ITEM "% R.a." +// ITEM "Ritenuta lorda@15" +// ITEM "Con.obbligatori@15" +// ITEM "Det.ca.famiglia@15" +// ITEM "gg det." +// ITEM "Det.lav.dipend.@15" +// ITEM "Tot.detrazioni@15" +// ITEM "Ritenuta@15" +// ITEM "Compenso netto@15" +// ITEM "Som.non sog.rit@15" +// ITEM "Ammontare lordo@15" +// ITEM "Quota provvig.@15" +// ITEM "Imp.netto rit.@15" +// ITEM "Comp.netto rit.@15" +// ITEM "Numver@5" +// FLAGS "H" +//END + +//SPREADSHEET F_PAGAMENTI_G 79 5 inutilizzato con i nuovi quadri (12/07/00) +//BEGIN +// PROMPT 0 8 "" +// ITEM "Data@10" +// ITEM "Compenso@15" +// ITEM "Imponibile@15" +// ITEM "% R.a." +// ITEM "Ritenuta@15" +// ITEM "Utili pagati@15" +// ITEM "Rit.ut.pagati@15" +// ITEM "Utili spet.@15" +// ITEM "Rit.ut.spet.@15" +// ITEM "N°quote" +// ITEM "Totale@15" +// ITEM "Som.non sog.rit@15" +// ITEM "Ammontare lordo@15" +// ITEM "Quota provvig.@15" +// ITEM "Imp.netto rit.@15" +// ITEM "Comp.netto rit.@15" +// ITEM "Numver@5" +// FLAGS "H" +//END TEXT DLG_NULL BEGIN @@ -407,53 +404,32 @@ BEGIN END // MAI VISUALIZZATO -STRING F_TABCAUSQUAC 1 +STRING F_TABCAUSQUASC 1 BEGIN PROMPT 80 80 "" FLAGS "H" END // MAI VISUALIZZATO -STRING F_TABCAUSQUAD 1 +STRING F_TABCAUSQUASE 1 BEGIN PROMPT 80 80 "" FLAGS "H" END // MAI VISUALIZZATO -STRING F_TABCAUSQUADB 1 +STRING F_TABCAUSQUASF 1 BEGIN PROMPT 80 80 "" FLAGS "H" END // MAI VISUALIZZATO -STRING F_TABCAUSQUAD1 1 +STRING F_TABCAUSQUASG 1 BEGIN PROMPT 80 80 "" FLAGS "H" END - -// MAI VISUALIZZATO -STRING F_TABCAUSQUAE 1 -BEGIN - PROMPT 80 80 "" - FLAGS "H" -END - -// MAI VISUALIZZATO -STRING F_TABCAUSQUAE1 1 -BEGIN - PROMPT 80 80 "" - FLAGS "H" -END - -// MAI VISUALIZZATO -STRING F_TABFLAGTS 1 -BEGIN - PROMPT 80 80 "" - FLAGS "H" -END // MAI VISUALIZZATO (ma da registrare) CURRENCY F_TOTRIT 15 @@ -483,9 +459,9 @@ ENDPAGE ENDMASK -#include "770100c.uml" +#include "770100f.uml" #include "770100e.uml" -#include "770100f.uml" -#include "770100g.uml" +//#include "770100c.uml" inutilizz. con i nuovi quadri (12/07/00) +//#include "770100g.uml" inutilizz. con i nuovi quadri (12/07/00) #include "770100d.uml" diff --git a/m770/770100d.uml b/m770/770100d.uml index e0ffc425c..0485d4ed4 100755 --- a/m770/770100d.uml +++ b/m770/770100d.uml @@ -29,7 +29,7 @@ BEGIN INPUT 103 ITEM " |Nessuno" ITEM "T|Tesoreria" - ITEM "C|Concessione" + ITEM "C|F24" OUTPUT 103 OUTPUT 71 FLAGS "UG" diff --git a/m770/770100e.uml b/m770/770100e.uml index 0d00ff8db..b0433924a 100755 --- a/m770/770100e.uml +++ b/m770/770100e.uml @@ -1,4 +1,5 @@ -// m70100e.uml - masksheet riga pagamento quadri D,D1,E,E1 +// m70100e.uml - masksheet riga pagamento quadri D,D1,E,E1 +// con l'ultima versione dei quadri si utilizza con SF SG (tanto per complicarci la vita) PAGE "Pagamento " -1 -1 50 19 diff --git a/m770/770100f.uml b/m770/770100f.uml index b6b0f545d..35a638881 100755 --- a/m770/770100f.uml +++ b/m770/770100f.uml @@ -1,4 +1,5 @@ // m70100f.uml - masksheet riga pagamento quadri Dbis +// con l'ultima versione dei quadri si utilizza con SC SE (incasiniamoci) PAGE "Pagamento " -1 -1 50 19 diff --git a/m770/770102.cpp b/m770/770102.cpp index 663356c60..28492b265 100755 --- a/m770/770102.cpp +++ b/m770/770102.cpp @@ -3,7 +3,7 @@ #include "770102.h" #include -HIDDEN TString80 tmp1, tmp2; +HIDDEN TString80 tmp1, tmp2; void TSchedaPercipienti::init_mask(TMask& m) { @@ -18,7 +18,7 @@ void TSchedaPercipienti::init_mask(TMask& m) { case pagamento: case occasionale: - // Compilo riga di pagamento SOLO SE NON ce ne sono gia'.. + // Compilo riga di pagamento SOLO SE NON ce ne sono gia'.. if ( (tipo_coll() == pagamento && _rel->pag_items() == 0) || tipo_coll() == occasionale ) @@ -39,41 +39,41 @@ void TSchedaPercipienti::init_mask(TMask& m) rpag.put("DATAPAG", _coll._datadoc); rpag.put("COMPENSO", compenso); rpag.put("SPESA", spese); - // Update spreadsheet + // Update spreadsheet rec2row(pags.row(0), rpag, 0); // ricalcolo riga pagamento - TString16 codcau(m.get(F_CODCAUS)); - TTable cau("%ca7"); - cau.zero(); - cau.put("CODTAB", codcau); - if (cau.read() != NOERR) - warning_box("Causale non presente in tabella"); - const real h_PercAssImp = cau.get_real("R4"); - const real h_PercCassaPrev = cau.get_real("R5"); - const real h_PercRitenuta = cau.get_real("R0"); - const real h_PercInps = cau.get_real("R1"); - const real h_PercAssImpInps = cau.get_real("R2"); - const real h_PercCommitInps = cau.get_real("R3"); - Pag_struct c; - Pag_struct s; - TToken_string& t = pags.row(0); - from_sheet_to_struct(t, s); - calcola_riga_pag(s, - c, - TRUE, - h_PercAssImp, - h_PercCassaPrev, - h_PercRitenuta, - h_PercInps, - h_PercAssImpInps, - h_PercCommitInps); - from_struct_to_sheet(s, t); - // forzo ridisegno sheet + TString16 codcau(m.get(F_CODCAUS)); + TTable cau("%ca7"); + cau.zero(); + cau.put("CODTAB", codcau); + if (cau.read() != NOERR) + warning_box("Causale non presente in tabella"); + const real h_PercAssImp = cau.get_real("R4"); + const real h_PercCassaPrev = cau.get_real("R5"); + const real h_PercRitenuta = cau.get_real("R0"); + const real h_PercInps = cau.get_real("R1"); + const real h_PercAssImpInps = cau.get_real("R2"); + const real h_PercCommitInps = cau.get_real("R3"); + Pag_struct c; + Pag_struct s; + TToken_string& t = pags.row(0); + from_sheet_to_struct(t, s); + calcola_riga_pag(s, + c, + TRUE, + h_PercAssImp, + h_PercCassaPrev, + h_PercRitenuta, + h_PercInps, + h_PercAssImpInps, + h_PercCommitInps); + from_struct_to_sheet(s, t); + // forzo ridisegno sheet pags.force_update(); } } default: - // per evitare di riscrivere tutto dopo registra + // per evitare di riscrivere tutto dopo registra _coll._tipo_coll = nessuno; break; } @@ -89,9 +89,9 @@ bool TSchedaPercipienti::vers_notify(TSheet_field& s, int r, KEY k) // Inserimento riga case K_INS: // Impedisce inserimento di nuove righe - return FALSE; - -// Inizio modifica riga + return FALSE; + +// Inizio modifica riga case K_SPACE: { // Pulisco descrizioni luogo e tipo versamento (solo se non gia' indicati!) @@ -117,18 +117,18 @@ bool TSchedaPercipienti::pags_notify(TSheet_field& s, int r, KEY k) switch(k) { - // Inserimento riga + // Inserimento riga case K_INS: - // Impedisce inserimento di nuove righe - return FALSE; + // Impedisce inserimento di nuove righe + return FALSE; - // Inizio modifica riga + // Inizio modifica riga case K_SPACE: { break; } - // Fine modifica di una riga + // Fine modifica di una riga case K_ENTER: break; @@ -198,8 +198,8 @@ bool TSchedaPercipienti::my_empty_items(TToken_string& r, bool vers) rr = r.get(token_pos("DATAPAG")); rr.trim(); if (rr.not_empty()) - return FALSE; - } + return FALSE; + } return TRUE; @@ -248,19 +248,19 @@ void TSchedaPercipienti::load_pag_sheet(const long numvers) // numero di riga dell'array-sheet. Viene incrementato // solo quando si trovano pagamenti 'giusti' (cioe' solo // quando si aggiungono elementi all'array-sheet) - iNumRigaAS = 0; + iNumRigaAS = 0; for ( i = 0; i < pag.items(); i++) { TToken_string* d = new TToken_string(64); TToken_string& riga = pag.row(i); - // Scarto le righe non significative + // Scarto le righe non significative if (my_empty_items(riga, FALSE)) continue; const long nvers = riga.get_long(token_pos("NUMVERS")); - // "Se il pagamento e' gia' stato selezionato DA UN ALTRO versamento - // NON si deve vedere! " + // "Se il pagamento e' gia' stato selezionato DA UN ALTRO versamento + // NON si deve vedere! " if (nvers > 0 && nvers != numvers) continue; @@ -282,7 +282,7 @@ void TSchedaPercipienti::load_pag_sheet(const long numvers) d->add(nvers); // 5 numero versamento collegato _pags->add(*d); // aggiungo la riga nell'array_sheet - // Setto il bit alla posizione numpag e metto la X + // Setto il bit alla posizione numpag e metto la X if (nvers == numvers) { _selected.set(npag); @@ -333,7 +333,7 @@ bool TSchedaPercipienti::vers_attached(const long numvers) for (int j = 0; j < _pags->items(); j++) { - // Leggo NUMVERS + // Leggo NUMVERS TToken_string& riga = _pags->row(j); numv = riga.get_long(AS_POS_NVER); @@ -406,7 +406,7 @@ bool TSchedaPercipienti::pag_azzera(TMask_field& f, KEY k) if (k == K_SPACE) { Pag_struct s; - app().from_struct_to_mask(app().clear_struct(s), f.mask()); + app().from_struct_to_mask(app().clear_struct(s), f.mask()); } return TRUE; } @@ -457,18 +457,18 @@ bool TSchedaPercipienti::pag_select (TMask_field& f, KEY k) long numvers = get_numvers(f); long numpag = 0L; int nriga = 0; - // 13.7.95 Ricalcola la ritenuta, azzerando contenuto precedente - real ritenuta = ZERO; + // 13.7.95 Ricalcola la ritenuta, azzerando contenuto precedente + real ritenuta = ZERO; TBit_array& selected = app()._selected; selected.reset(); - // Costruisce array_sheet dei pagamenti + // Costruisce array_sheet dei pagamenti app().load_pag_sheet(numvers); TNikArray_sheet& ASpags = *app()._pags; - // seleziona e aggiungi alle gia' selezionate + // seleziona e aggiungi alle gia' selezionate if (ASpags.run() == K_ENTER) { for (int j = 0; j < ASpags.items(); j++) @@ -536,19 +536,19 @@ void TSchedaPercipienti::work_tipoluogo(TMask_field& f) // perchè non appartenendo alla riga // non viene disabilitato nella "rec2row" if (v1015) - m.disable(F_CAB); + m.disable(F_CAB); else - m.enable(F_CAB); - + m.enable(F_CAB); + if (tipo == 'B') { - // ABI e CAB + // ABI e CAB m.show (-6); // abilita progressivo vers.banca if (!v1015) - m.enable(SM_PROGRBANCA); + m.enable(SM_PROGRBANCA); } else { @@ -611,8 +611,8 @@ bool TSchedaPercipienti::abicab_hndl(TMask_field& f, KEY k) for (int i=0; i 5) + // controllo se codice CAB supera le 5 cifre + if (i > 5) { f.reset(); return f.warning_box("Codice CAB non valido"); @@ -722,52 +722,32 @@ bool TSchedaPercipienti::check_causale(TMask_field& f, KEY k) TMask& m = f.mask(); TString16 cod_qua(m.get(F_CODQUA)); - // abilito il flag TS solo se causale di quadro C - if (m.get(F_CODQUA) == "C") - m.enable(F_FLAGTS); - else - m.disable(F_FLAGTS); - // creo run-time gli items per la causale quadro - app().build_causqua_items(m, cod_qua); - + app().build_causqua_items(m, cod_qua); + if (k == K_TAB && m.is_running()) { // leggo causale indicata TFixed_string cod_caus(f.get(),3); - // controllo se causale di quadro C o E1 che il percipiente sia fisico - - char tipo = m.get(F_TIPOA)[0]; - if (cod_qua == "C" || cod_qua == "E1") - if (tipo == 'G') - return f.warning_box("Con il quadro C o E1 e' possibile l'immissione" - " per le sole persone fisiche"); - // cose da fare solo se viene modificato il codice causale if (f.to_check(k)) { - // forzo causale quadro con il valore in tabella - TEdit_field& f_causqua = m.efield(F_CAUSQUA); - f_causqua.reset(); - if (cod_qua == "C") - f_causqua.set(m.get(F_TABCAUSQUAC)); - if (cod_qua == "D") - f_causqua.set(m.get(F_TABCAUSQUAD)); - if (cod_qua == "DB") - f_causqua.set(m.get(F_TABCAUSQUADB)); - if (cod_qua == "D1") - f_causqua.set(m.get(F_TABCAUSQUAD1)); - if (cod_qua == "E") - f_causqua.set(m.get(F_TABCAUSQUAE)); - if (cod_qua == "E1") - f_causqua.set(m.get(F_TABCAUSQUAE1)); - // forzo flag TS con valore in tabella - TString16 tabflagts = m.get(F_TABFLAGTS); - m.set(F_FLAGTS, tabflagts); - // attiva sheet pagamenti in base al quadro - app().activate_pag_sheet(m); + // forzo causale quadro con il valore in tabella + TEdit_field& f_causqua = m.efield(F_CAUSQUA); + f_causqua.reset(); + if (cod_qua == "SC") + f_causqua.set(m.get(F_TABCAUSQUASC)); + if (cod_qua == "SE") + f_causqua.set(m.get(F_TABCAUSQUASE)); + if (cod_qua == "SF") + f_causqua.set(m.get(F_TABCAUSQUASF)); + if (cod_qua == "SG") + f_causqua.set(m.get(F_TABCAUSQUASG)); + + // attiva sheet pagamenti in base al quadro + app().activate_pag_sheet(m); } } @@ -776,127 +756,127 @@ bool TSchedaPercipienti::check_causale(TMask_field& f, KEY k) bool TSchedaPercipienti::pag_standard_handler(TMask_field& f, KEY k) { - static Pag_struct s; - static Pag_struct c; - static Pag_struct nullpag; - app().clear_struct(nullpag); - - // reperisco dati documento - TMask& mm = app().curr_mask(); - const bool d_forzatura = mm.get_bool(F_FORCED); + static Pag_struct s; + static Pag_struct c; + static Pag_struct nullpag; + app().clear_struct(nullpag); + + // reperisco dati documento + TMask& mm = app().curr_mask(); + const bool d_forzatura = mm.get_bool(F_FORCED); TString16 d_codqua(mm.get(F_CODQUA)); - - // eseguo calcolo solo per K_TAB (singolo campo), - // oppure per K_ENTER, ma solo per il primo campo, - // questo per migliorare le prestazioni - if (f.to_check(k)) + + // eseguo calcolo solo per K_TAB (singolo campo), + // oppure per K_ENTER, ma solo per il primo campo, + // questo per migliorare le prestazioni + if (f.to_check(k)) { - if (k == K_TAB || (k == K_ENTER && f.dlg() == 101)) - { - - // reperisco valori nascosti compilati dalla tabella causali - const real h_PercAssImp = mm.get_real(F_QUOTAIMP); - const real h_PercCassaPrev = mm.get_real(F_CASSA_PREV); - const real h_PercRitenuta = mm.get_real(F_PERRIT); - const bool h_FlagInps = mm.get_bool(F_FLAG_INPS); - const real h_PercInps = mm.get_real(F_PERC_INPS); - const real h_PercAssImpInps = mm.get_real(F_PERC_ASS_INPS); - const real h_PercCommitInps = mm.get_real(F_PERC_COMMIT_INPS); - - // inizializzo struttura calcolati - app().clear_struct(c); - - // riempimento struttura pagamento - app().from_mask_to_struct(f.mask(), s); - - // non proseguo se riga vuota - if (s == c) return TRUE; - - // richiamo calcolo di riga - app().calcola_riga_pag(s, - c, - FALSE, - h_PercAssImp, - h_PercCassaPrev, - h_PercRitenuta, - h_PercInps, - h_PercAssImpInps, - h_PercCommitInps); - - // riporto valori a maschera - app().from_struct_to_mask(s, f.mask()); - } + if (k == K_TAB || (k == K_ENTER && f.dlg() == 101)) + { + + // reperisco valori nascosti compilati dalla tabella causali + const real h_PercAssImp = mm.get_real(F_QUOTAIMP); + const real h_PercCassaPrev = mm.get_real(F_CASSA_PREV); + const real h_PercRitenuta = mm.get_real(F_PERRIT); + const bool h_FlagInps = mm.get_bool(F_FLAG_INPS); + const real h_PercInps = mm.get_real(F_PERC_INPS); + const real h_PercAssImpInps = mm.get_real(F_PERC_ASS_INPS); + const real h_PercCommitInps = mm.get_real(F_PERC_COMMIT_INPS); + + // inizializzo struttura calcolati + app().clear_struct(c); + + // riempimento struttura pagamento + app().from_mask_to_struct(f.mask(), s); + + // non proseguo se riga vuota + if (s == c) return TRUE; + + // richiamo calcolo di riga + app().calcola_riga_pag(s, + c, + FALSE, + h_PercAssImp, + h_PercCassaPrev, + h_PercRitenuta, + h_PercInps, + h_PercAssImpInps, + h_PercCommitInps); + + // riporto valori a maschera + app().from_struct_to_mask(s, f.mask()); + } // eseguo controlli solo per K_ENTER - // utilizzando i valori memorizzati nelle strutture statiche + // utilizzando i valori memorizzati nelle strutture statiche if (k == K_ENTER) - { + { - // non proseguo se riga vuota - if (s == nullpag) return TRUE; - - // reperisco nome campo su record - const TString& name = f.field()->name(); - - // controllo data pagamento - if (name == "DATAPAG") - if (!s.datapag.ok() && (s.compenso != ZERO || s.spesa != ZERO)) - return f.error_box("Data pagamento non indicata"); - - // controllo compenso e/o spese - if (name == "COMPENSO" || name == "SPESA") - if (s.compenso == ZERO && s.spesa == ZERO) - return f.error_box("Compenso o spese non indicati"); - - // controllo imponibile - if (name == "IMPONIBILE") - if (d_codqua != "E1" && abs(s.imponibile) > abs(s.compenso)) - return f.error_box("Imponibile maggiore del compenso"); - - // controllo ritenuta - if (name == "RITENUTA" && !d_forzatura) - if (s.ritenuta != c.ritenuta) - return f.error_box("Ritenuta diversa da importo calcolato"); - - // controllo detrazioni lavoro dipendente - if (name == "DETLAVDIP") - if (s.detlavdip == ZERO && s.giolavdip != 0) - return f.error_box("Detrazioni lavoro dipendente non indicate"); - - // controllo CPA - if (name == "IMPCPA") - { - if (d_codqua != "D" && s.impcpa != ZERO) - return f.error_box("CPA valido solo per causali con quadro D"); - if (abs(s.impcpa) > abs(s.compenso)) - return f.error_box("CPA maggiore del compenso"); - } - - // controllo somme reg.conv. - if (name == "SOMREGCONV") - { - if ((d_codqua != "D" && d_codqua != "DB") && s.somregconv != ZERO) - return f.error_box("Somme reg.conv. valido solo per causali con quadro D e Dbis"); - if (!app()._soggnres && s.somregconv != ZERO) - return f.error_box("Somme reg.conv. valido solo se percipiente non residente"); - } - - // controllo contributo 10% percipiente - if (name == "CTSSNPERC" && !d_forzatura) - if (s.ctssnperc != c.ctssnperc) - return f.error_box("Contributo Inps percipiente diverso da importo calcolato"); - - // controllo contributo 10% complessivo - if (name == "CTSSNCOMP" && !d_forzatura) - if (s.ctssncomp != c.ctssncomp) - return f.error_box("Contributo Inps complessivo diverso da importo calcolato"); - - // controllo numero quote - if (name == "NQUOTE" && !d_forzatura) - if (s.nquote == ZERO) - return f.error_box("Numero quote non indicate"); - } + // non proseguo se riga vuota + if (s == nullpag) return TRUE; + + // reperisco nome campo su record + const TString& name = f.field()->name(); + + // controllo data pagamento + if (name == "DATAPAG") + if (!s.datapag.ok() && (s.compenso != ZERO || s.spesa != ZERO)) + return f.error_box("Data pagamento non indicata"); + + // controllo compenso e/o spese + if (name == "COMPENSO" || name == "SPESA") + if (s.compenso == ZERO && s.spesa == ZERO) + return f.error_box("Compenso o spese non indicati"); + + // controllo imponibile + if (name == "IMPONIBILE") + if (d_codqua != "E1" && abs(s.imponibile) > abs(s.compenso)) + return f.error_box("Imponibile maggiore del compenso"); + + // controllo ritenuta + if (name == "RITENUTA" && !d_forzatura) + if (s.ritenuta != c.ritenuta) + return f.error_box("Ritenuta diversa da importo calcolato"); + + // controllo detrazioni lavoro dipendente + if (name == "DETLAVDIP") + if (s.detlavdip == ZERO && s.giolavdip != 0) + return f.error_box("Detrazioni lavoro dipendente non indicate"); + + // controllo CPA + if (name == "IMPCPA") + { + if ((d_codqua != "SF" && d_codqua != "SG") && s.impcpa != ZERO) + return f.error_box("CPA valido solo per causali con quadro SF e SG"); + if (abs(s.impcpa) > abs(s.compenso)) + return f.error_box("CPA maggiore del compenso"); + } + + // controllo somme reg.conv. + if (name == "SOMREGCONV") + { +// if ((d_codqua != "SC" && d_codqua != "SE") && s.somregconv != ZERO) nell'ultima versione dei quadri le SOMREGCONV valgono per tutti i tipi di quadro (SC,SE,SF,SG) +// return f.error_box("Somme reg.conv. valido solo per causali con quadro SC e SE"); 12/07/2000 + if (!app()._soggnres && s.somregconv != ZERO) + return f.error_box("Somme reg.conv. valido solo se percipiente non residente"); + } + + // controllo contributo 10% percipiente + if (name == "CTSSNPERC" && !d_forzatura) + if (s.ctssnperc != c.ctssnperc) + return f.error_box("Contributo Inps percipiente diverso da importo calcolato"); + + // controllo contributo 10% complessivo + if (name == "CTSSNCOMP" && !d_forzatura) + if (s.ctssncomp != c.ctssncomp) + return f.error_box("Contributo Inps complessivo diverso da importo calcolato"); + + // controllo numero quote + if (name == "NQUOTE" && !d_forzatura) + if (s.nquote == ZERO) + return f.error_box("Numero quote non indicate"); + } } return TRUE; diff --git a/m770/770102.h b/m770/770102.h index 20d4053a4..7b11c4a2c 100755 --- a/m770/770102.h +++ b/m770/770102.h @@ -22,42 +22,42 @@ #endif // Id della maschera di edit dello sheet versamenti -#define F_VERS_1015 101 -#define F_DATAVERS 102 -#define F_LUOVERS 103 -#define F_TIPOVERS 104 -#define F_ABI 105 // abi e cab -#define F_CAB 72 -#define SM_PROGRBANCA 107 -#define F_RITVERS 108 +#define F_VERS_1015 101 +#define F_DATAVERS 102 +#define F_LUOVERS 103 +#define F_TIPOVERS 104 +#define F_ABI 105 // abi e cab +#define F_CAB 72 +#define SM_PROGRBANCA 107 +#define F_RITVERS 108 // Posizioni nell'array-sheet dei pagamenti -const int AS_POS_RITPAG = 3; -const int AS_POS_NRIGA = 4; -const int AS_POS_NVER = 5; +const int AS_POS_RITPAG = 3; +const int AS_POS_NRIGA = 4; +const int AS_POS_NVER = 5; #define COLONNE_SIGNIFICATIVE_SPREADSHEET_VERSAMENTI 8 class TSchedaPercipienti : public TRelation_application { private: - bool _from_modify; - TLink770 _coll; - TSchedaPE* _rel; - TMask* _msk[2]; - long _codanagr; - TString16 _tipoa; - TString80 _ragsoc; - int _nproga; - int _mode; - TLocalisamfile* _per, *_scper, *_rver, *_rpag; - long _rigavers; - long _lastvers, _lastpag; - long _numreg; // NUMREG inviato dalla 1. nota - int _anno_dic; // anno dichiarazione + bool _from_modify; + TLink770 _coll; + TSchedaPE* _rel; + TMask* _msk[2]; + long _codanagr; + TString16 _tipoa; + TString80 _ragsoc; + int _nproga; + int _mode; + TLocalisamfile* _per, *_scper, *_rver, *_rpag; + long _rigavers; + long _lastvers, _lastpag; + long _numreg; // NUMREG inviato dalla 1. nota + int _anno_dic; // anno dichiarazione bool _soggnres; // flag soggetto non residente (usato per controlli) - // Collegamento versamento->pagamenti + // Collegamento versamento->pagamenti TBit_array _selected; TNikArray_sheet* _pags; @@ -65,7 +65,7 @@ class TSchedaPercipienti : public TRelation_application real _tot_vers, _tot_rit; private: - TString80 get_ragsoc(const char* tipoa, const long codanagr); + TString80 get_ragsoc(const char* tipoa, const long codanagr); static void work_tipoluogo(TMask_field& f); // controlla che il versamento abbia collegato almeno un pagamento @@ -76,7 +76,7 @@ class TSchedaPercipienti : public TRelation_application static bool codanagr_handler (TMask_field& f, KEY key); static bool nprog_handler (TMask_field& f, KEY key); - // Handler del documento + // Handler del documento static bool check_handler(TMask_field& f, KEY key); static bool check_causale(TMask_field& f, KEY k); static bool check_compensi(TMask_field& f, KEY k); @@ -84,7 +84,7 @@ class TSchedaPercipienti : public TRelation_application static bool check_competenza(TMask_field& f, KEY k); static bool forced_handler(TMask& m, KEY key); - // Handler del versamento + // Handler del versamento static bool vers_notify(TSheet_field& s, int r, KEY key); static bool vers1015_handler(TMask_field& f, KEY key); static bool tipo_hndl(TMask_field& f, KEY key); @@ -94,10 +94,10 @@ class TSchedaPercipienti : public TRelation_application // Handler del pagamento static bool pags_notify(TSheet_field& s, int r, KEY key); - static bool pag_azzera(TMask_field& f, KEY key); - static bool pag_standard_handler(TMask_field& f, KEY key); - - // collegamento pagamenti a versamenti + static bool pag_azzera(TMask_field& f, KEY key); + static bool pag_standard_handler(TMask_field& f, KEY key); + + // collegamento pagamenti a versamenti static bool pag_select(TMask_field& f, KEY key); static bool compilato_vers(TMask_field& f); static long get_numvers (TMask_field& f); @@ -117,7 +117,7 @@ class TSchedaPercipienti : public TRelation_application // restitiusce la maschera di modifica/inserimento TMask& TheMask() const; - // restitiusce lo sheet pagamenti attivato + // restitiusce lo sheet pagamenti attivato TSheet_field& pag_sheet_enabled(TMask& m, bool force_enable=FALSE) const; // attiva lo sheet pagamenti in base al quadro bool activate_pag_sheet(TMask& m); @@ -138,11 +138,11 @@ class TSchedaPercipienti : public TRelation_application // riempe la maschera di sheet dalla struttura pagamento void from_struct_to_mask(Pag_struct& s, TMask& m); // abilita lo sheet pagamenti in base al quadro - TSheet_field& enable_pag_sheet(TMask& m, TString16& quadro) const; + TSheet_field& enable_pag_sheet(TMask& m, const TString& quadro) const; // aggancia handler allo sheet passato void set_pag_handler(TSheet_field& s) const; // genera gli items per la causale quadro - void build_causqua_items(TMask& m, TString16& quadro) const; + void build_causqua_items(TMask& m, const TString& quadro) const; // azzera struttura pagamento Pag_struct& clear_struct(Pag_struct& s); // calcola una riga di pagamento dove è la struttura con i dati, @@ -150,19 +150,19 @@ class TSchedaPercipienti : public TRelation_application // consente di forzare la sostituzione dei valori di riga // con i calcolati anche se sono diversi da zero Pag_struct& calcola_riga_pag(Pag_struct& s, - Pag_struct& c, - bool force, - const real h_PercAssImp, - const real h_PercCassaPrev, - const real h_PercRitenuta, - const real h_PercInps, - const real h_PercAssImpInps, - const real h_PercCommitInps); + Pag_struct& c, + bool force, + const real h_PercAssImp, + const real h_PercCassaPrev, + const real h_PercRitenuta, + const real h_PercInps, + const real h_PercAssImpInps, + const real h_PercCommitInps); protected: - virtual bool user_create(); - virtual bool user_destroy(); - virtual TRelation* get_relation() const { return _rel; } + virtual bool user_create(); + virtual bool user_destroy(); + virtual TRelation* get_relation() const { return _rel; } virtual TMask* get_mask(int mode); virtual bool changing_mask(int mode); virtual void init_query_mode (TMask&); @@ -173,29 +173,29 @@ class TSchedaPercipienti : public TRelation_application virtual int write(const TMask& m); virtual int read(TMask& m); virtual void on_config_change(); - - void init_mask(TMask&); - TMask* load_mask(int n); + + void init_mask(TMask&); + TMask* load_mask(int n); void fill_sheet(TMask&); bool scrivi_dati_per(TRectype& rec); void mask2rel(const TMask& m); void rec2row(TToken_string& r, TRectype& rec, int row); void update_lasts(TMask& m); - void attach_pag_vers (int pag, long numvers); - void detach_pag_vers (int pag); - void new_row(TSheet_field& ver_pag, int r, bool vers); + void attach_pag_vers (int pag, long numvers); + void detach_pag_vers (int pag); + void new_row(TSheet_field& ver_pag, int r, bool vers); bool my_empty_items(TToken_string& r, bool versamenti); int anno_dic() const { return _anno_dic; } public: - bool _flag_cg; + bool _flag_cg; void load_pag_sheet(const long numvers); - TTipo_coll tipo_coll() const { return _coll._tipo_coll; } - void compila_testata(TMask& m); - bool coll_variazione() const; - bool coll_datanum() const { return _coll._datadoc.not_empty() && _coll._numdoc.not_empty(); } - bool esiste_perc(TMask& m, const char* coda=NULL); + TTipo_coll tipo_coll() const { return _coll._tipo_coll; } + void compila_testata(TMask& m); + bool coll_variazione() const; + bool coll_datanum() const { return _coll._datadoc.not_empty() && _coll._numdoc.not_empty(); } + bool esiste_perc(TMask& m, const char* coda=NULL); TSheet_field& pags() const; TSheet_field& vers() const; diff --git a/m770/770200a.uml b/m770/770200a.uml index 9ca71ac75..95bbc8ab5 100755 --- a/m770/770200a.uml +++ b/m770/770200a.uml @@ -56,7 +56,7 @@ BEGIN INPUT F_LUOGO ITEM " |Nessuno" ITEM "T|Tesoreria" - ITEM "C|Concessione" + ITEM "C|F24" OUTPUT F_LUOGO OUTPUT 71 FLAGS "U" diff --git a/m770/771230.cpp b/m770/771230.cpp index a97175fa5..df49d8206 100755 --- a/m770/771230.cpp +++ b/m770/771230.cpp @@ -20,6 +20,8 @@ #include "rpag.h" #include "scperc.h" +TString _quadronuovo; + /////////////////////////////////////////////////////////// // Righe pagamento delle schede percipienti /////////////////////////////////////////////////////////// @@ -738,7 +740,7 @@ void TQuadroC_E2::genera_righe(TRighe_pagamento& righe) const TRectype& rec = prospe1.curr(); bool first = TRUE; - for (char caus = 'C'; caus <= 'D'; caus++) + for (char caus = 'C'; caus <= 'E'; caus++) { const TRectype* riga = righe.prospetto_e1(caus); if (riga != NULL) @@ -792,7 +794,7 @@ void TQuadroC_E2::generazione() TCursor cur(&rel, NULL, 1, &rec, &rec); - TString16 filter; filter.format("(%d->S1=\"%s\")", LF_TABCOM, (const char*) _quadro); + TString16 filter; filter.format("(%d->S1=\"%s\")", LF_TABCOM, (const char*) _quadronuovo); cur.setfilter(filter, TRUE); const int anno770 = anno_770(); @@ -1117,17 +1119,6 @@ bool TQuadroC_E2::prospetto_e1_notify(TSheet_field& s, int r, KEY k) return ok; } -/* -void TQuadroC_E2::reset_prospetto_e1() const -{ - if (_mskp == NULL) - return; - TSheet_field& s = (TSheet_field&)_mskp->field(F_PROSPETTO); - s.row(0) = "C"; - s.row(1) = "D"; -} -*/ - void TQuadroC_E2::read_prospetto_e1() const { if (_mskp == NULL) @@ -1136,7 +1127,7 @@ void TQuadroC_E2::read_prospetto_e1() const TLocalisamfile prosp(LF_PROSPE1); TRectype& curr = prosp.curr(); curr.put("CODDITTA", _codditta); - for (int r = 0; r < 2; r++) + for (int r = 0; r < 3; r++) { TToken_string& row = s.row(r); row.cut(0); @@ -1159,7 +1150,7 @@ int TQuadroC_E2::write_prospetto_e1() const TSheet_field& s = (TSheet_field&)_mskp->field(F_PROSPETTO); TLocalisamfile prosp(LF_PROSPE1); TRectype& curr = prosp.curr(); - for (int r = 0; r < 2; r++) + for (int r = 0; r < 3; r++) { TToken_string& row = s.row(r); real compenso = row.get(1); @@ -1194,22 +1185,34 @@ int quadriC_E2(int argc, char* argv[]) taitol << "Riepilogo "; const char * nome_quadro = argv[2]; if (strnicmp(nome_quadro, "C", 1) == 0) - taitol << "SC"; + taitol << "C"; else if (strnicmp(nome_quadro, "DB", 2) == 0) taitol << "SG"; else if (strnicmp(nome_quadro, "D1", 2) == 0) - taitol << "SH"; + { + _quadronuovo = "SE"; + taitol << "SE"; + } else if (strnicmp(nome_quadro, "D", 1) == 0) - taitol << "SF"; + { + _quadronuovo = "SC"; + taitol << "SC"; + } else if (strnicmp(nome_quadro, "E1", 2) == 0) - taitol << "SQ"; + { + _quadronuovo = "SG"; + taitol << "SG"; + } else if (strnicmp(nome_quadro, "E", 1) == 0) - taitol << "SP"; + { + _quadronuovo = "SF"; + taitol << "SF"; + } else taitol << nome_quadro; diff --git a/m770/771230d.uml b/m770/771230d.uml index 06ec2ce63..a9eebdc9d 100755 --- a/m770/771230d.uml +++ b/m770/771230d.uml @@ -9,7 +9,7 @@ END ENDPAGE -PAGE "Riepilogo SF" -1 -1 78 18 +PAGE "Riepilogo SC" -1 -1 78 18 GROUPBOX DLG_NULL 78 5 BEGIN @@ -121,7 +121,7 @@ PAGE "RIGA 1" -1 -1 58 12 NUMBER 101 2 BEGIN PROMPT 1 1 "Codice causale " - USE %CA7 SELECT ((I0!="1015")&&(S1="D")) + USE %CA7 SELECT ((I0!="1015")&&(S1="SC")) INPUT CODTAB 101 DISPLAY "Codice" CODTAB DISPLAY "Descrizione@35" S0 @@ -150,19 +150,24 @@ BEGIN FLAGS "U" SHEET "Cod.|Descrizione@256" INPUT 103 - ITEM "A|per prestazioni di lavoro autonomo rientranti nell'esercizio di arti o professione abituale" - ITEM "B|per l'utilizzazione economica, da parte dell'autore o inventore, di opere dell'ingegno, di brevetti industriali e di processi, formule o informazioni relativi ad esperienze acquisite in campo industriale, commerciale o scientifico" - ITEM "C|a titolo di utili derivanti da contratti di associazioni in partecipazione e da contratti di cointeressenza, quando l'apporto e' costituito esclusivamente dalla prestazione di lavoro" - ITEM "D|a titolo di utili spettanti ai soci promotori ed ai soci fondatori delle societa' di capitali" - ITEM "E|per la levata di protesti cambiari da parte di segretari comunali" - ITEM "F|per l'utilizzazione economica da parte di sogg. diverso dall'autore o dall'inventore, di opere dell'ingegno, di brevetti industriali e di processi, formule o informazioni relativi ad esperienze acquisite in campo ind., comm, scient." - ITEM "G|a titolo di indennita' corrisposte per la cessazione di rapporti di agenzia delle persone fisiche" - ITEM "H|a titolo di indennita' corrisposte per la cessazione da funzioni notarili" - ITEM "I|a titolo di indennita' di trasferta o di rimborso forfetario di spese spettanti a soggetti che svolgono attivita' sportiva dilettantistica di cui alla legge 25 marzo 1986, n. 80" - ITEM "L|per prestazioni di lavoro autonomo non esercitate abitualmente" - ITEM "M|per prestazioni rese dagli sportivi con contratto di lavoro autonomo" - ITEM "N|a titolo di indennita' corrisposte per la cessazione di attivita' sportiva professionale" - ITEM "T|altro titolo diverso dai precedenti" + ITEM "A|per prestazioni di lavoro autonomo rientranti nell'esercizio di arte o professione abituale" + ITEM "B|per prestazioni rese da amministratori, sindaci e revisori di societá, associazione ed altri enti con o senza personalitá giuridica" + ITEM "C|per prestazioni rese da collaboratori a giornali, riviste, enciclopedie e simili (che non costituiscono diritti d'autore)" + ITEM "D|per prestazioni rese da partecipanti a collegi e commissioni" + ITEM "E|per prestazioni rese nell'ambito di rapporti di collaborazione coordinata e continuativa diversi da quelli sopra elencati" + ITEM "F|per indennitá corrisposte per la cessazione di rapporti di collaborazione coordinata e continuativa, assoggettabili a tassazione separata" + ITEM "G|per l'utilizzazione economica, da parte dell'autore o dell'inventore, di opere dell'ingegno, di brevetti industriali e di processi, formule o informazioni relativi ad esperienze acquisite in campo industriale, commerciale o scientifico" + ITEM "H|a titolo di utili derivanti da contratti di associazione in partecipazione e da contratti di cointeressenza, quando l'apporto é costituito esclusivamente dalla prestazione di lavoro" + ITEM "I|a titolo di utili spettanti ai soci promotori ed ai soci fondatori delle societá di capitali" + ITEM "K|per la levata di protesti cambiari da parte di segretari comunali" + ITEM "L|per prestazioni rese dagli sportivi con contratto di lavoro autonomo" + ITEM "M|a titolo di indennitá corrisposte per la cessazione di attivitá sportiva professionale" + ITEM "N|a titolo di indennitá corrisposte per la cessazione dei rapporti di agenzia delle persone fisiche" + ITEM "P|a titolo di indennitá corrisposte per la cessazione da funzioni notarili" + ITEM "Q|per l'utilizzazione economica, da parte di soggetto diverso dall'autore o dall'inventore, di opere dell'ingegno, di brevetti industriali e di processi, formule e informazioni relativi ad esperienze acquisite in campo indust., commer. o scient." + ITEM "R|per prestazioni di lavoro autonomo non esercitate abitualmente" + ITEM "S|a titolo di indennitá di trasferta o di rimborso forfetario di spese spettanti a soggetti che svolgono attivitá sportiva dilettantistica di cui alla L n. 80 del 1986" + ITEM "T|per altro titolo diverso dai precedenti" OUTPUT 103 WANING "La causale deve essere compresa tra A ed T" FIELD CAUSALE diff --git a/m770/771230d1.uml b/m770/771230d1.uml index 3cb22f7dc..de3bc6d91 100755 --- a/m770/771230d1.uml +++ b/m770/771230d1.uml @@ -9,7 +9,7 @@ END ENDPAGE -PAGE "Riepilogo SH" -1 -1 78 18 +PAGE "Riepilogo SE" -1 -1 78 18 GROUPBOX DLG_NULL 78 5 BEGIN @@ -121,7 +121,7 @@ PAGE "RIGA 1" -1 -1 58 11 NUMBER 101 2 BEGIN PROMPT 1 1 "Codice causale " - USE %CA7 SELECT ((I0!="1015")&&(S1="D1")) + USE %CA7 SELECT ((I0!="1015")&&(S1="SE")) INPUT CODTAB 101 DISPLAY "Codice" CODTAB DISPLAY "Descrizione@35" S0 @@ -150,11 +150,14 @@ BEGIN FLAGS "U" SHEET "Cod.|Descrizione@256" INPUT 103 - ITEM "A|Agente o rappresentante di commercio monomandatario" - ITEM "B|Agente o rappresentante plurimandatario" - ITEM "C|Commissionario" - ITEM "D|Mediatore" - ITEM "E|Procacciatore di affari" + ITEM "A|agente o rappresentante di commercio monomandatario" + ITEM "B|agente o rappresentante plurimandatario" + ITEM "C|commissionario" + ITEM "D|mediatore" + ITEM "E|procacciatore di affari" + ITEM "F|incaricato per le vendite a domicilio" + ITEM "G|incaricato per la vendita porta a porta e per la vendita ambulante di giornali quotidiani e periodici (L.25 febbraio 1987, n.67)" + ITEM "T|altro soggetto diverso dai precedenti" OUTPUT 103 WANING "La causale deve essere compresa tra A ed E" FIELD CAUSALE diff --git a/m770/771230e.uml b/m770/771230e.uml index 966b6e12a..2413f39a4 100755 --- a/m770/771230e.uml +++ b/m770/771230e.uml @@ -9,7 +9,7 @@ END ENDPAGE -PAGE "Riepilogo SP" -1 -1 78 18 +PAGE "Riepilogo SF" -1 -1 78 18 GROUPBOX DLG_NULL 78 5 BEGIN @@ -120,7 +120,7 @@ PAGE "RIGA 1" -1 -1 60 10 NUMBER 101 2 BEGIN PROMPT 1 1 "Codice causale " - USE %CA7 SELECT ((I0!="1015")&&(S1="E")) + USE %CA7 SELECT ((I0!="1015")&&(S1="SF")) INPUT CODTAB 101 DISPLAY "Codice" CODTAB DISPLAY "Descrizione@35" S0 @@ -141,11 +141,23 @@ BEGIN FLAGS "U" SHEET "Cod.|Descrizione@256" INPUT 102 - ITEM "A|redditi di capitale corrisposti a soggetti residenti non esercenti attivita' di impresa commerciale assoggettati alla ritenuta a titolo di acconto, compresa la differenza fra la somma percepita alla scadenza e quella data a mutuo o deposito" - ITEM "B|proventi corrisposti a stabili organizzazioni estere di imprese residenti non apprtenenti all'impresa erogante assoggettati a ritenuta a titolo di acconto" - ITEM "C|compensi per avviamento commerciale assoggettati alla ritenuta a titolo di acconto di cui all'art. 28, primo comma, del D.P.R. n. 600 del 1973" - ITEM "D|contributo degli enti pubblici e premi corrisposti dall'Unione nazionale incremento razze equine (UNIRE) e dalla federazione italiana sport equestri (FSE) assoggettati alla ritenuta a titolo di acconto" - ITEM "E|interessi, premi e altri frutti dei titoli obbligazionari emessi da Enti territoriali e assoggettati alla ritenuta a titolo di acconto del 12,50% di cui all'art. 35, comma 6, del L. 23 dicembre 1994, n. 724" + ITEM "A|redditi di capitale corrisposti a soggetti residenti non esercenti attivitá d'impresa comerciale, assoggettati alla ritenuta a titolo d'acconto di cui all'art.26, ultimo comma del D.P.R. n.600 del 1973" + ITEM "B|proventi corrisposti a stabili organizzazioni estere di imprese residenti, non appartenenti all'impresa erogante, assoggettabili alla ritenuta d'acconto nella misura del 12,50 o del 27 per cento (art.26,ultimo comma,del D.P.R.600 del 1973)" + ITEM "C|compensi per avviamento commerciale assoggettati alla ritenuta a titolo di acconto di cui all'art.28, primo comma, del D.P.R. n.600 del 1973" + ITEM "D|contributi degli enti pubblici e privati e premi corrisposti dall'Unione nazionale incremento razze equine (UNIRE) e dalla Federazione italiana sport equestri (FISE), assoggettati alla rit. d'acc. di cui all'art.28,secondo comma,DPR600 del 1973" + ITEM "E|proventi di cui all'art.41, comma 1, lettere g-bis e g-ter, del Tuir, assoggettati a ritenuta a titolo d'acconto o non assoggetati a ritenuta, percepiti da soggetti non esercenti attivitá d'impresa, ai sensi dell'art.26,comma3-bis,DPR600 del 1973" + ITEM "F|proventi di cui all'art.41, comma 1, lett. g-bis, del Tuir, divenuti esigibili dal 1 gennaio al 18 agosto 1999, per i quali non é stata resa l'opzione di cui all'art.2, comma 5, del D.Lgs. n.259 del 1999" + ITEM "G|proventi derivanti da mutui, depositi e conti correnti diversi da quelli bancari e postali, ad eccezione dei proventi derivanti da prestiti di denaro" + ITEM "H|interessi ed altri proventi derivanti da depositi e conti correnti bancari e postali" + ITEM "I|rendite perpetue e prestazioni annuali perpetue" + ITEM "L|prestazioni di fideiussioni e di ogni altra garanzia" + ITEM "M|proventi derivanti da operazioni di pronti contro termine e di riporto su titoli e valute" + ITEM "N|proventi derivanti da operazioni di mutuo di titoli garantito" + ITEM "P|certificati di deposito emessi da banche a decorrere dal 1 luglio 1998" + ITEM "Q|certificati di deposito e buoni fruttiferi emessi da banche fino al 30 giugno 1998 (art.6 della L. 26 aprile 1982, n.181; art.4 del D.M. 5 dicembre 1997, n.494" + ITEM "R|altri redditi di capitale, diversi da quelli individuati nei codici da G a Q, per i quali é stata applicata una aliquota ridotta o pari a zero in applicazione di accordi internazionali e di convenzioni bilaterali per evitare la doppia imposizione" + ITEM "S|somme corrisposte a soggetti residenti negli Stati esteri indicati nei D.M. del 04/09/1996, del 25/03/1998, del 16/12/1998 e del 10/06/1999, per i quali hanno trovato applicazioni le disposizioni dell'art.9, commi 1 e 4, del D.Lgs. n.461 del 1997" + ITEM "T|interessi ed altri proventi derivanti da finanziamenti effettuati da soggetti non residenti e raccolti dalla societá costituita ai sensi del'art.13 della L. 23 dicembre 1998, n.448, per la cartolarizzazione dei crediti INPS" OUTPUT 102 WANING "La causale deve essere compresa tra A ed E" FIELD CAUSALE diff --git a/m770/771230e1.uml b/m770/771230e1.uml index 29e74abd4..28ac81b1f 100755 --- a/m770/771230e1.uml +++ b/m770/771230e1.uml @@ -14,7 +14,7 @@ END ENDPAGE -PAGE "Riepilogo SQ" -1 -1 78 18 +PAGE "Riepilogo SG" -1 -1 78 18 GROUPBOX DLG_NULL 78 5 BEGIN @@ -126,7 +126,7 @@ PAGE "RIGA 1" -1 -1 58 12 NUMBER 101 2 BEGIN PROMPT 1 1 "Causale " - USE %CA7 SELECT ((I0!="1015")&&(S1="E1")) + USE %CA7 SELECT ((I0!="1015")&&(S1="SG")) INPUT CODTAB 101 DISPLAY "Codice" CODTAB DISPLAY "Descrizione@45" S0 @@ -145,7 +145,7 @@ END STRING 102 35 BEGIN PROMPT 20 1 "" - USE %CA7 KEY 2 SELECT ((I0!="1015")&&(S1="E1")) + USE %CA7 KEY 2 SELECT ((I0!="1015")&&(S1="SG")) INPUT S0 102 DISPLAY "Descrizione@45" S0 DISPLAY "Codice" CODTAB @@ -159,8 +159,11 @@ BEGIN FLAGS "U" SHEET "Cod.|Descrizione@256" INPUT 103 - ITEM "A|somme derivanti da riscatto di contratti di assicurazione sulla vita" - ITEM "B|capitali corrisposti in dipendenza di contratti di soggetti che esercitano attivita' commerciali (omissis...)" + ITEM "A|somme derivanti dal riscatto di contratti di assicurazione sulla vita" + ITEM "B|capitali corrisposti in dipendenza di contratti di assicurazione sulla vita e contratti di capitalizzazione corrisposti a soggetti che esercitano attivitá commerciali per i quali la ritenuta del 12,50% si applica a titolo d'acconto" + ITEM "C|capitoli corrisposti in dipendenza di contratti di assicurazione sulla vita, ivi compresi i capitali corrisposti ai sensi del D.Lgs. 21/04/1993, n.124, e dell'art.1, comma 5, della L. 28 febbraio 1997, n.30" + ITEM "D|capitali corrisposti in dipendenza di contratti di capitalizzazione" + ITEM "E|rendite corrisposte per conto della assicurazione invaliditá, vecchiaia e superstiti Svizzera (AVS) assoggettate a ritenuta unica del 5% ai sensi dell'art.76 della L. 30 dicembre 1991, n.413" OUTPUT 103 WANING "La causale deve essere specificata" FIELD CAUSALE diff --git a/m770/771310.cpp b/m770/771310.cpp index 4103a9298..a3caad7c5 100755 --- a/m770/771310.cpp +++ b/m770/771310.cpp @@ -27,8 +27,8 @@ class M71310_application : public TRelation_application TGenera* _app; TConfig* _cnf; int _anno; - bool _registra; - TRiporti _rip; + bool _registra; + TRiporti _rip; protected: virtual bool user_create(); @@ -45,8 +45,8 @@ class M71310_application : public TRelation_application virtual bool remove(); void build_note(const TMask& m); void set_field_note(TMask& m); - bool changed_anno_dic(TMask& m); - real arrotonda(const TMask& m); + bool changed_anno_dic(TMask& m); + real arrotonda(const TMask& m); static bool generazione (TMask_field& f, KEY k); static bool genera_para (TMask_field& f, KEY k); static bool tipo (TMask_field& f, KEY k); @@ -114,7 +114,7 @@ bool M71310_application::mese(TMask_field& f , KEY k) int mese = f.mask().get_int(F_QLMESEPAG); if (mese == 0) - return f.error_box("Il mese di pagamento deve essere indicato obbligatoriamente"); + return f.error_box("Il mese di pagamento deve essere indicato obbligatoriamente"); } return TRUE; } @@ -149,7 +149,7 @@ bool M71310_application::cod_tributo(TMask_field& f , KEY k) { int tributo = f.mask().get_int(F_QLCODTRIB); if (tributo == 0) - return f.error_box("Il codice tributo deve essere indicato obbligatoriamente"); + return f.error_box("Il codice tributo deve essere indicato obbligatoriamente"); } return TRUE; } @@ -178,13 +178,13 @@ bool M71310_application::tipo(TMask_field& f , KEY k) TString16 luogo = m.get(F_QLLUOVERS); if (tipo.not_empty() && luogo.not_empty()) - if (tipo == "D" && luogo == "T") - { - m.reset(-G_DISTINTA_TESORERIA); - m.disable(-G_DISTINTA_TESORERIA); - } - else - m.enable(-G_DISTINTA_TESORERIA); + if (tipo == "D" && luogo == "T") + { + m.reset(-G_DISTINTA_TESORERIA); + m.disable(-G_DISTINTA_TESORERIA); + } + else + m.enable(-G_DISTINTA_TESORERIA); } return TRUE; } @@ -198,13 +198,13 @@ bool M71310_application::luogo(TMask_field& f , KEY k) TString16 luogo = m.get(F_QLLUOVERS); if (tipo.not_empty()) - if (tipo == "D" && luogo == "T") - { - m.reset(-G_DISTINTA_TESORERIA); - m.disable(-G_DISTINTA_TESORERIA); - } - else - m.enable(-G_DISTINTA_TESORERIA); + if (tipo == "D" && luogo == "T") + { + m.reset(-G_DISTINTA_TESORERIA); + m.disable(-G_DISTINTA_TESORERIA); + } + else + m.enable(-G_DISTINTA_TESORERIA); } return TRUE; } @@ -225,7 +225,7 @@ bool M71310_application::artbil_hnd(TMask_field& f , KEY k) // Se il focus e' sull'ultimo campo prima di F_ABI if (fld.dlg() == F_ARTBIL) { -// WINDOW win; +// WINDOW win; // Determina chi ce lo dovrebbe avere dopo.. if (tipo == 'B') { @@ -262,14 +262,7 @@ void M71310_application::init_insert_mode(TMask& m) m.enable (F_QLRITEFF); m.enable (F_QLRITVER); m.enable (F_QLRSS); - //m.enable (F_QLNOTE); - m.enable (F_NOTEA); - m.enable (F_NOTEB); - m.enable (F_NOTEC); - m.enable (F_NOTED); - m.enable (F_NOTEE); - m.enable (F_NOTEF); - m.enable (F_NOTEG); + m.enable (-G_NOTE); } void M71310_application::init_query_mode(TMask& m) @@ -281,14 +274,7 @@ void M71310_application::init_query_mode(TMask& m) m.disable(F_QLRITEFF); m.disable(F_QLRITVER); m.disable(F_QLRSS); - //m.disable(F_QLNOTE); - m.disable(F_NOTEA); - m.disable(F_NOTEB); - m.disable(F_NOTEC); - m.disable(F_NOTED); - m.disable(F_NOTEE); - m.disable(F_NOTEF); - m.disable(F_NOTEG); + m.disable (-G_NOTE); } void M71310_application::init_modify_mode(TMask& m) @@ -302,112 +288,32 @@ void M71310_application::init_modify_mode(TMask& m) m.enable (F_QLRITEFF); m.enable (F_QLRITVER); m.enable (F_QLRSS); - //m.enable (F_QLNOTE); - m.enable (F_NOTEA); - m.enable (F_NOTEB); - m.enable (F_NOTEC); - m.enable (F_NOTED); - m.enable (F_NOTEE); - m.enable (F_NOTEF); - m.enable (F_NOTEG); + m.enable (-G_NOTE); } void M71310_application::set_field_note(TMask& m) { - TString note = _rel->lfile().get(QUL_QLNOTE); - - if (note != "") - { - char A,B,C,D,E,F,G; - - int p = note.len() - 1; - - A = note[0]; - if (p >= 1) - B = note[1]; - if (p >= 2) - C = note[2]; - if (p >= 3) - D = note[3]; - if (p >= 4) - E = note[4]; - if (p >= 5) - F = note[5]; - if (p >= 6) - G = note[6]; - - if (A == 'A') - m.set(F_NOTEA, "X"); - - if (B == 'B') - m.set(F_NOTEB, "X"); - - if (C == 'C') - m.set(F_NOTEC, "X"); - - if (D == 'D') - m.set(F_NOTED, "X"); - - if (E == 'E') - m.set(F_NOTEE, "X"); - - if (F == 'F') - m.set(F_NOTEF, "X"); - - if (G == 'G') - m.set(F_NOTEG, "X"); - } + const TString& note = _rel->lfile().get(QUL_QLNOTE); + for (int i = note.len()-1; i >= 0; i--) if (note[i] > ' ') + { + const short dlg = F_NOTEA + int(note[i] - 'A'); + m.set(dlg, "X"); + } } void M71310_application::build_note(const TMask& m) { - char A = m.get(F_NOTEA)[0]; - char B = m.get(F_NOTEB)[0]; - char C = m.get(F_NOTEC)[0]; - char D = m.get(F_NOTED)[0]; - char E = m.get(F_NOTEE)[0]; - char F = m.get(F_NOTEF)[0]; - char G = m.get(F_NOTEG)[0]; - - TString16 note; - - if (A == 'X') - note[0] = 'A'; - else - note[0] = ' '; - - if (B == 'X') - note[1] = 'B'; - else - note[1] = ' '; - - if (C == 'X') - note[2] = 'C'; - else - note[2] = ' '; - - if (D == 'X') - note[3] = 'D'; - else - note[3] = ' '; - - if (E == 'X') - note[4] = 'E'; - else - note[4] = ' '; - - if (F == 'X') - note[5] = 'F'; - else - note[5] = ' '; - - if (G == 'X') - note[6] = 'G'; - else - note[6] = ' '; - - note [7] = '\0'; - + int index = 0; + TString note; note.spaces(20); + for (short dlg = F_NOTEA; dlg <= F_NOTEZ; dlg++) if (m.id2pos(dlg) > 0) + { + if (!m.get(dlg).blank()) + { + char letter = 'A' + dlg - F_NOTEA; + note[index] = letter; + } + index++; + } _rel->lfile().put(QUL_QLNOTE, note); } @@ -487,7 +393,7 @@ bool M71310_application::user_destroy() int m71310(int argc, char* argv[]) { M71310_application a; - a.run(argc, argv, "Riepilogo SL/SK"); + a.run(argc, argv, "Riepilogo ST"); return 0; } diff --git a/m770/771310.h b/m770/771310.h index e4d9067a9..d6262b46f 100755 --- a/m770/771310.h +++ b/m770/771310.h @@ -18,27 +18,43 @@ #define F_QLNOTE 116 #define F_GENERA 117 #define F_ANNODIC 118 -#define F_NOTEA 119 -#define F_NOTEB 120 -#define F_NOTEC 121 -#define F_NOTED 122 -#define F_NOTEE 123 -#define F_NOTEF 124 -#define F_NOTEG 125 + #define F_PARAMETRI 126 -#define F_QUADRO 130 -#define F_ABI 131 -#define F_CAB 132 -#define F_NPROG 133 +#define F_QUADRO 130 +#define F_ABI 131 +#define F_CAB 132 +#define F_NPROG 133 -#define FH_ABISERIE 135 -#define FH_CAB 136 -#define FH_NUMERO 137 -#define FH_NPROG 138 +#define FH_ABISERIE 135 +#define FH_CAB 136 +#define FH_NUMERO 137 +#define FH_NPROG 138 -#define F_CCQUIETANZA 139 -#define G_ABICAB 7 -#define G_DISTINTA 8 -#define G_CC 9 -#define G_DISTINTA_TESORERIA 10 // v. handler di tipo vers. +#define F_CCQUIETANZA 139 +#define G_ABICAB 7 +#define G_DISTINTA 8 +#define G_CC 9 +#define G_DISTINTA_TESORERIA 10 // v. handler di tipo vers. + +#define G_NOTE 2 +#define F_NOTEA 265 +#define F_NOTEB 266 +#define F_NOTEC 267 +#define F_NOTED 268 +#define F_NOTEE 269 +#define F_NOTEF 270 +#define F_NOTEG 271 +#define F_NOTEH 272 +#define F_NOTEK 275 +#define F_NOTEL 276 +#define F_NOTEM 277 +#define F_NOTEN 278 +#define F_NOTEP 280 +#define F_NOTEQ 281 +#define F_NOTER 282 +#define F_NOTES 283 +#define F_NOTET 284 +#define F_NOTEU 285 +#define F_NOTEW 287 +#define F_NOTEZ 290 diff --git a/m770/771310a.uml b/m770/771310a.uml index 89b5d293b..5ade1e4e2 100755 --- a/m770/771310a.uml +++ b/m770/771310a.uml @@ -1,4 +1,3 @@ -// 771310a.uml - Quadro L #include "771310.h" TOOLBAR "" 0 18 0 4 @@ -15,9 +14,9 @@ END #include ENDPAGE -PAGE "Riepilogo SL/SK" -1 -1 78 18 +PAGE "Riepilogo ST" -1 -1 78 18 -GROUPBOX DLG_NULL 78 3 +GROUPBOX DLG_NULL 78 4 BEGIN PROMPT 1 0 "" END @@ -26,7 +25,7 @@ NUMBER F_CODDITTA 5 BEGIN PROMPT 3 1 "Ditta " FLAGS "RDG" - USE LF_NDITTE KEY 1 + USE LF_NDITTE FIELD LF_QUAL->CODDITTA CHECKTYPE REQUIRED INPUT CODDITTA F_CODDITTA @@ -42,20 +41,20 @@ BEGIN FLAGS "D" END -GROUPBOX DLG_NULL 78 7 -BEGIN - PROMPT 0 5 "" -END - NUMBER F_ANNODIC 4 BEGIN - PROMPT 52 3 "Anno dichiarazione " + PROMPT 52 2 "Anno dichiarazione " +END + +GROUPBOX DLG_NULL 78 7 +BEGIN + PROMPT 1 3 "" END NUMBER F_QLANNOPAG 4 BEGIN - PROMPT 2 6 "Anno pagamento " - USE LF_QUAL KEY 1 SELECT ((CODDITTA=#F_CODDITTA) && (QLAP=#F_ANNODIC)) + PROMPT 2 4 "Anno pagamento " + USE LF_QUAL SELECT ((CODDITTA=#F_CODDITTA)&&(QLAP=#F_ANNODIC)) INPUT CODDITTA F_CODDITTA INPUT QLAP F_QLANNOPAG DISPLAY "A.P." QLAP @@ -70,7 +69,7 @@ BEGIN DISPLAY "Serie/ABI" QLSERIE DISPLAY "Numero/CAB@11" QLNUMERO DISPLAY "Rss" QLRSS - DISPLAY "Note@7" QLNOTE + DISPLAY "Note@20" QLNOTE OUTPUT F_QLDATAVERS QLDV OUTPUT F_QLMESEPAG QLMP OUTPUT F_QLANNOPAG QLAP @@ -85,7 +84,6 @@ BEGIN OUTPUT F_QLNUMERO QLNUMERO OUTPUT F_CCQUIETANZA QLNUMERO FIELD LF_QUAL->QLAP - FLAGS "R" VALIDATE FIXLEN_FUNC 4 WARNING "L'anno deve essere indicato per esteso" KEY 1 @@ -93,7 +91,7 @@ END LIST F_QLMESEPAG 2 13 BEGIN - PROMPT 45 6 "Mese pagamento " + PROMPT 45 4 "Mese pagamento " FIELD LF_QUAL->QLMP ITEM " |Indefinito" FLAGS "M" @@ -102,16 +100,16 @@ END DATE F_QLDATAVERS BEGIN - PROMPT 2 7 "Data versamento " + PROMPT 2 5 "Data versamento " FIELD LF_QUAL->QLDV KEY 1 END LIST F_QLLUOVERS 11 BEGIN - PROMPT 45 7 "Luogo versamento " + PROMPT 45 5 "Luogo versamento " ITEM " |Nessuno" - ITEM "C|Concessione" + ITEM "C|F24" ITEM "T|Tesoreria" FIELD LF_QUAL->QLLV KEY 1 @@ -119,7 +117,7 @@ END LIST F_QLTIPOVERS 15 BEGIN - PROMPT 2 8 "Tipo versamento " + PROMPT 2 6 "Tipo versamento " ITEM " |Nessuno" MESSAGE HIDE,G_ABICAB@|HIDE,G_DISTINTA@|HIDE,G_CC@ ITEM "B|Delega bancaria" @@ -134,7 +132,7 @@ END NUMBER F_QLCODTRIB 4 BEGIN - PROMPT 45 8 "Codice tributo " + PROMPT 45 6 "Codice tributo " FIELD LF_QUAL->QLCT KEY 1 CHECKTYPE REQUIRED @@ -142,44 +140,44 @@ END NUMBER F_ARTBIL 2 BEGIN - PROMPT 2 9 "Articolo di bilancio " + PROMPT 2 7 "Articolo di bilancio " FIELD LF_QUAL->QLAB KEY 1 END TEXT DLG_NULL BEGIN - PROMPT 2 10 "Serie " + PROMPT 2 8 "Serie " GROUP G_DISTINTA G_DISTINTA_TESORERIA END TEXT DLG_NULL BEGIN - PROMPT 45 10 "Numero " + PROMPT 45 8 "Numero " GROUP G_DISTINTA END TEXT DLG_NULL BEGIN - PROMPT 45 10 "Quietanza " + PROMPT 45 8 "Quietanza " GROUP G_CC END TEXT DLG_NULL BEGIN - PROMPT 2 10 "Codice ABI " + PROMPT 2 8 "Codice ABI " GROUP G_ABICAB END TEXT DLG_NULL BEGIN - PROMPT 45 10 "Codice CAB " + PROMPT 45 8 "Codice CAB " GROUP G_ABICAB END STRING F_QLSERIE 5 BEGIN - PROMPT 23 10 "" + PROMPT 23 8 "" FIELD LF_QUAL->QLSERIE GROUP G_DISTINTA G_DISTINTA_TESORERIA KEY 1 @@ -187,7 +185,7 @@ END STRING F_QLNUMERO 11 BEGIN - PROMPT 62 10 "" + PROMPT 62 8 "" FIELD LF_QUAL->QLNUMERO GROUP G_DISTINTA KEY 1 @@ -195,7 +193,7 @@ END STRING F_CCQUIETANZA 11 BEGIN - PROMPT 62 10 "" + PROMPT 62 8 "" FIELD LF_QUAL->QLNUMERO GROUP G_CC KEY 1 @@ -203,7 +201,7 @@ END NUMBER F_ABI 5 BEGIN - PROMPT 23 10 "" + PROMPT 23 8 "" FIELD LF_QUAL->QLSERIE FLAGS "Z" GROUP G_ABICAB @@ -212,7 +210,7 @@ END NUMBER F_CAB 5 BEGIN - PROMPT 62 10 "" + PROMPT 62 8 "" FIELD LF_QUAL->QLNUMERO[1,5] FLAGS "Z" GROUP G_ABICAB @@ -221,7 +219,7 @@ END NUMBER F_NPROG 6 BEGIN - PROMPT 68 10 "" + PROMPT 68 8 "" FIELD LF_QUAL->QLNUMERO[6,11] FLAGS "Z" GROUP G_ABICAB @@ -230,58 +228,52 @@ END LIST F_QUADRO 2 BEGIN - PROMPT 0 12 "Codice quadro " + PROMPT 0 10 "Codice quadro " HELP "Inserire il codice quadro" ITEM "| " - ITEM "A|A" - ITEM "B|B" - ITEM "B1|B1" - ITEM "C|C" - ITEM "D|D" - ITEM "DB|DB" - ITEM "D1|D1" - ITEM "E|E" - ITEM "E1|E1" - ITEM "G|G" - ITEM "G1|G1" + ITEM "SC|SC" + ITEM "SE|SE" + ITEM "SF|SF" + ITEM "SG|SG" + ITEM "ST|ST" FIELD LF_QUAL->QLCODQUA END TEXT DLG_NULL BEGIN - PROMPT 0 13 "Somme assoggettate a ritenuta:" + PROMPT 0 11 "Somme assoggettate a ritenuta:" END TEXT DLG_NULL BEGIN - PROMPT 0 14 "Rit. Effettuate" + PROMPT 0 12 "Rit. Effettuate" END CURRENCY F_QLRITEFF 15 BEGIN - PROMPT 0 15 "" + PROMPT 0 13 "" FIELD LF_QUAL->QLRITEFF END TEXT DLG_NULL BEGIN - PROMPT 17 14 "Importo versato" + PROMPT 17 12 "Importo versato" END CURRENCY F_QLRITVER 15 BEGIN - PROMPT 17 15 "" + PROMPT 17 13 "" FIELD LF_QUAL->QLRITVER END TEXT DLG_NULL BEGIN - PROMPT 37 14 "RSS" + PROMPT 37 12 "RSS" END LIST F_QLRSS 7 BEGIN - PROMPT 34 15 "" + PROMPT 34 13 "" ITEM " |Nessuna" ITEM "1|VA" ITEM "2|SA" @@ -289,44 +281,129 @@ BEGIN FIELD LF_QUAL->QLRSS END -TEXT DLG_NULL +GROUPBOX DLG_NULL 78 4 BEGIN - PROMPT 58 14 "Note" + PROMPT 1 14 "Note" END BOOLEAN F_NOTEA BEGIN - PROMPT 45 15 "A" + PROMPT 2 15 "A" + GROUP G_NOTE END BOOLEAN F_NOTEB BEGIN - PROMPT 50 15 "B" + PROMPT 7 15 "B" + GROUP G_NOTE END BOOLEAN F_NOTEC BEGIN - PROMPT 55 15 "C" + PROMPT 12 15 "C" + GROUP G_NOTE END BOOLEAN F_NOTED BEGIN - PROMPT 60 15 "D" + PROMPT 17 15 "D" + GROUP G_NOTE END BOOLEAN F_NOTEE BEGIN - PROMPT 65 15 "E" + PROMPT 22 15 "E" + GROUP G_NOTE END BOOLEAN F_NOTEF BEGIN - PROMPT 70 15 "F" + PROMPT 27 15 "F" + GROUP G_NOTE END BOOLEAN F_NOTEG BEGIN - PROMPT 75 15 "G" + PROMPT 32 15 "G" + GROUP G_NOTE +END + +BOOLEAN F_NOTEH +BEGIN + PROMPT 37 15 "H" + GROUP G_NOTE +END + +BOOLEAN F_NOTEK +BEGIN + PROMPT 42 15 "K" + GROUP G_NOTE +END + +BOOLEAN F_NOTEL +BEGIN + PROMPT 47 15 "L" + GROUP G_NOTE +END + +BOOLEAN F_NOTEM +BEGIN + PROMPT 52 15 "M" + GROUP G_NOTE +END + +BOOLEAN F_NOTEN +BEGIN + PROMPT 57 15 "N" + GROUP G_NOTE +END + +BOOLEAN F_NOTEP +BEGIN + PROMPT 62 15 "P" + GROUP G_NOTE +END + +BOOLEAN F_NOTEQ +BEGIN + PROMPT 67 15 "Q" + GROUP G_NOTE +END + +BOOLEAN F_NOTER +BEGIN + PROMPT 72 15 "R" + GROUP G_NOTE +END + +BOOLEAN F_NOTES +BEGIN + PROMPT 2 16 "S" + GROUP G_NOTE +END + +BOOLEAN F_NOTET +BEGIN + PROMPT 7 16 "T" + GROUP G_NOTE +END + +BOOLEAN F_NOTEU +BEGIN + PROMPT 12 16 "U" + GROUP G_NOTE +END + +BOOLEAN F_NOTEW +BEGIN + PROMPT 17 16 "W" + GROUP G_NOTE +END + +BOOLEAN F_NOTEZ +BEGIN + PROMPT 22 16 "Z" + GROUP G_NOTE END ENDPAGE diff --git a/m770/772100.cpp b/m770/772100.cpp index a3298761c..f4e941607 100755 --- a/m770/772100.cpp +++ b/m770/772100.cpp @@ -1,21 +1,22 @@ // 772100.cpp - Stampa schede percipienti + #include #include #include #include #include #include -#include #include -#include -#include "scperc.h" + +#include "perc.h" #include "rpag.h" #include "rver.h" +#include "scperc.h" + #include #include #include #include -#include "perc.h" #include #include diff --git a/m770/773400.cpp b/m770/773400.cpp index 3c22fff5e..cfc8d6512 100755 --- a/m770/773400.cpp +++ b/m770/773400.cpp @@ -12,7 +12,7 @@ // 21.12.95 i codici quadro con 1015 sono C-E1 (= tolto E2) (nf) // la perc. r.a. non e' piu' obbligatoria (nf) // -// 14.5.96 Modifiche per dichiarazione 96 (nf) +// 14.5.96 Modifiche per dichiarazione 96 (nf) // class Tab770_application : public Tab_application @@ -22,9 +22,9 @@ class Tab770_application : public Tab_application TString _tabname; protected: - bool IsCausali() const { return _tabname == "%CA7"; } - void SetDefaultValueCausali(TMask& m); - void init_mask(TMask& m); + bool IsCausali() const { return _tabname == "%CA7"; } + void SetDefaultValueCausali(TMask& m); + void init_mask(TMask& m); public: bool user_create(); virtual void init_modify_mode(TMask& m); @@ -50,9 +50,8 @@ HIDDEN bool codqua_handler(TMask_field& f, KEY k) TString16 quad(m.get(F_QUADRCE2)); quad.trim(); quad.upper(); - if (quad != "C" && quad != "D" && quad != "E" && quad != "E1" && - quad != "D1") - return f.warning_box("Con il codice tributo 1015 si possono indicare solo i quadri C-D-D1-E-E1"); + if (quad != "SC" && quad != "SE" && quad != "SF" && quad != "SG") + return f.error_box("Con il codice tributo 1015 si possono indicare solo i quadri SC-SE-SF-SG"); } } return TRUE; @@ -65,11 +64,13 @@ HIDDEN bool codtrib_handler(TMask_field& f, KEY k) TMask& m = f.mask(); const int trib = atoi(f.get()); - if (trib == 1015) { + if (trib == 1015) + { m.hide(F_QUADRAT); m.show(F_QUADRCE2); } - else { + else + { m.hide(F_QUADRCE2); m.show(F_QUADRAT); } @@ -100,7 +101,7 @@ void Tab770_application::SetDefaultValueCausali(TMask& m) sPercAss.trim(); if (sPercAss.empty()) - m.set(F_PERASS, "100.00"); // % ass. imponibile + m.set(F_PERASS, "100.00"); // % ass. imponibile } void Tab770_application::init_mask(TMask& m) @@ -139,7 +140,7 @@ bool Tab770_application::user_create() bool Tab770_application::firm_change_enabled() const { - return FALSE; + return FALSE; } m73400(int argc, char* argv[]) diff --git a/m770/774100.cpp b/m770/774100.cpp index 4671334b9..f73040704 100755 --- a/m770/774100.cpp +++ b/m770/774100.cpp @@ -49,15 +49,12 @@ bool TVersamenti::find (TSchedaP& sc, const long numvers) // l'anno della data-pagamento == annodic E // il pagamento e' collegato ad un versamento (non importa quale) bool filter_func (const TRelation* rel) -{ - TDate datapag; - int anno,annod; - long nvers; - - annod = this_genera->_annodic; - datapag = rel->lfile().get(PAG_DATAPAG); - nvers = rel->lfile().get_long(PAG_NUMVERS); - anno = datapag.year(); +{ + const TRectype& rec = rel->curr(); + const TDate datapag = rec.get(PAG_DATAPAG); + const int anno = datapag.year(); + const int annod = this_genera->_annodic; + const long nvers = rec.get_long(PAG_NUMVERS); return anno == annod && nvers > 0L; } @@ -90,11 +87,11 @@ void TGenera::causale(int causale) _codqua = ""; ca7.zero(); - dep = format("%02d", causale); + dep.format("%02d", causale); ca7.put("CODTAB", dep); if (ca7.read() == NOERR) { - _codqua = ca7.get ("S1"); + _codqua = ca7.get("S1"); _artbil = ca7.get_int("I3"); _codtrib = ca7.get_int("I0"); } @@ -102,15 +99,10 @@ void TGenera::causale(int causale) bool TGenera::set(const long codditta, TConfig* cnf, const char* section) { - TString16 filt; - TRelation rel(LF_RPAG); - int causale; - bool ok_gen; - this_genera = this; - // controllo presenza causale 1015 - causale = atoi(cnf->get("CoCa1015", section)); + // controllo presenza causale 1015 + const int causale = atoi(cnf->get("CoCa1015", section)); if (causale) { if (!causale1015(causale)) @@ -130,7 +122,8 @@ bool TGenera::set(const long codditta, TConfig* cnf, const char* section) _annodic = (int)cnf->get_long(ANNO_SEL, section); // preparo cursore su righe di versamento - filt.format("CODDITTA=%ld", codditta); + TRelation rel(LF_RPAG); + TString filt; filt.format("CODDITTA=%ld", codditta); TCursor cur(&rel,filt,1); cur.set_filterfunction (filter_func); @@ -139,8 +132,9 @@ bool TGenera::set(const long codditta, TConfig* cnf, const char* section) // generazione versamenti quadro L // (se ritorna una richiesta di fine non prosegue con l'arrotondamento) - if (ok_gen = genera_riga(&cur)) - arrotonda(); + bool ok_gen = genera_riga(&cur); + if (ok_gen) + arrotonda(); return ok_gen; } @@ -154,17 +148,17 @@ int TGenera::controllo_parametri() const int rc = base.read(); if (rc == NOERR) { - TString appname; - appname.format("776mod -4 %c",_liv); - + TString appname; + appname.format("776mod -4 %c",_liv); + TExternal_app a (appname); a.run(); TMailbox m; TMessage* msg = m.next_s(""); int subj; - // 1 => uscito con Registra - // 0 => uscito con Quit + // 1 => uscito con Registra + // 0 => uscito con Quit if (msg != NULL) { subj = atoi(msg->body()); @@ -204,22 +198,25 @@ bool TGenera::azzera_quadroL() for (int i = 0; i < cl_items; i++, ++(*cl)) { - progn.addstatus(1); + progn.addstatus(1); TString quadro(2); - + // solo quelli dell'anno dichiarazione - if (fl.get_int(QUL_QLAP) != _annodic) - continue; + if (fl.get_int(QUL_QLAP) != _annodic) + continue; -// solo quelli di quadri C/D/DB/D1/E/E1/G - quadro = fl.get(QUL_QLCODQUA); - if (quadro != "C" && quadro != "D" && quadro != "DB" && - quadro != "D1" && quadro != "E" && quadro != "E1" && quadro != "G") - continue; -// rimozione record +// solo quelli di quadri SC/SE/SF/SG + quadro = fl.get(QUL_QLCODQUA); + if (quadro != "SC" && quadro != "SE" && quadro != "SF" && quadro != "SG") + continue; + +// rimozione record fl.remove(); } + delete cl; // Cazzone: te li eri dimenticati + delete rl; + return TRUE; } @@ -261,7 +258,7 @@ void TGenera::dati_rver(TLocalisamfile& rver,TSchedaP& sch, long numvers) _numero.cut(5); } else - _sNprog = ""; + _sNprog = ""; // riporto gli estremi sulla riga di versamento @@ -287,7 +284,7 @@ void TGenera::dati_rver(TLocalisamfile& rver,TSchedaP& sch, long numvers) _sNprog = rver.get(VER_PROGBANC); _sNprog.trim(); if (_tipover == DELEGA_BANCARIA && _sNprog != "000000") - _numero << _sNprog; + _numero << _sNprog; } } @@ -311,13 +308,10 @@ void TGenera::arrotonda() TString16 filt; real importo = ZERO; - TRelation* rl; - TCursor* cl; - filt.format("CODDITTA=%ld", _codditta); - rl = new TRelation(LF_QUAL); - cl = new TCursor(rl,filt,1); + TRelation* rl = new TRelation(LF_QUAL); + TCursor* cl = new TCursor(rl,filt,1); TRecnotype cl_items = cl->items(); cl->freeze(); @@ -330,12 +324,15 @@ void TGenera::arrotonda() for (int i = 0; i < cl_items; i++, ++(*cl)) { - progn.addstatus(1); + progn.addstatus(1); importo = fl.get_real(QUL_QLRITVER); importo = round_770(importo); fl.put(QUL_QLRITVER, importo); fl.rewrite(); } + + delete cl; + delete rl; } bool TGenera::genera_riga(TCursor* cur) @@ -350,8 +347,7 @@ bool TGenera::genera_riga(TCursor* cur) bool gia_fatto = FALSE; TString perc,percp; - (*cur) = 0L; - TRecnotype items_rpag = cur->items(); + const TRecnotype items_rpag = cur->items(); TString scritta(60); scritta.format("Generazione versamenti per la ditta %ld", _codditta); TProgind progn(items_rpag, scritta, FALSE, TRUE); @@ -367,11 +363,14 @@ bool TGenera::genera_riga(TCursor* cur) nprogp = 9999; TSchedaP scheda_prec; + + cur->freeze(); + (*cur) = 0L; for (int i = 0; i < items_rpag; i++, ++(*cur), progn.addstatus(1)) { // Leggo i dati su RPAG TDate datapag(cur->curr().get(PAG_DATAPAG)); - _mesepag = datapag.month();; + _mesepag = datapag.month(); _annopag = datapag.year(); riteff = cur->curr().get_real(PAG_RITENUTA); numvers = cur->curr().get_long(PAG_NUMVERS); @@ -392,8 +391,7 @@ bool TGenera::genera_riga(TCursor* cur) // Se e' tributo1015 posso evitare di controllare il codice quadro if (!_ver1015) { - if (_codqua != "C" && _codqua != "D" && _codqua != "DB" && - _codqua != "D1" && _codqua != "E" && _codqua != "E1" && _codqua != "G") + if (_codqua != "SC" && _codqua != "SE" && _codqua != "SF" && _codqua != "SG") continue; } else @@ -457,8 +455,9 @@ bool TGenera::genera_riga(TCursor* cur) } _righe_gia_presenti->set(scheda_corr,numvers); } - - return TRUE; + cur->freeze(FALSE); + + return TRUE; } @@ -491,13 +490,13 @@ bool TGenera_versamenti::menu(MENU_TAG m) TConfig cnf_user(CONFIG_USER); if (m == BAR_ITEM(1)) - { + { codditta_prec = get_firm_770(); while ((codditta = cnf_user.get_long(DITTE_SEL, _section, i++)) != 0L) { set_firm_770(codditta); if (!_genera->set(codditta, _cnf, _section)) - break; + break; } set_firm_770(codditta_prec); return FALSE; diff --git a/m770/776.cpp b/m770/776.cpp index 9e7c3e855..78cf640a0 100755 --- a/m770/776.cpp +++ b/m770/776.cpp @@ -1,16 +1,11 @@ #include -#include #include "776.h" -#define usage "Error - usage : %s -{0|1} [params]" - int main(int argc,char** argv) { - const int n = (argc > 1) ? atoi(argv[1]+1) : -1; + const int n = (argc > 1) ? atoi(argv[1]+1) : 0; switch(n) { - case 0: - MenuQuadri(argc,argv); break; case 1: ImmissioneDichiarazioni(argc,argv); break; case 2: @@ -22,7 +17,7 @@ int main(int argc,char** argv) case 5: Estinti(argc, argv); break; default: - error_box(usage, argv[0]); break; + MenuQuadri(argc,argv); break; } return n < 0; diff --git a/m770/776100.cpp b/m770/776100.cpp index 9c814d1cb..a4d325cf1 100755 --- a/m770/776100.cpp +++ b/m770/776100.cpp @@ -56,7 +56,7 @@ class TManutenzione_quadri : public TSkeleton_application void enphasize(TString& qcomp, TMask& m); void inibith(TString& qric, TMask& m); - const char* make_prompt(int i, stile st = grassetto); + const char* make_prompt(TMask_field& f, stile st); bool query_mask(); @@ -210,112 +210,29 @@ bool TManutenzione_quadri::destroy() } -const char* TManutenzione_quadri::make_prompt(int i, stile vivid) -{ - if (vivid == sottolineato) - __tmp = "@u"; - - if (vivid == grassetto) - __tmp = "@b"; - - if (vivid == piano) - __tmp = ""; - - switch (i) { - case 0: - __tmp << "Quadro A" ; - break; - case 1: - __tmp << "Quadro A1" ; - break; - case 2: - __tmp << "Quadro A2"; - break; - case 3: - __tmp << "Quadro A3" ; - break; - case 4: - __tmp << "Quadro B" ; - break; - case 5: - __tmp << "Quadro B1"; - break; - case 6: - //__tmp << "Quadro C" ; - __tmp << "Riepilogo SC" ; - break; - case 7: - //__tmp << "Quadro D" ; - __tmp << "Riepilogo SF" ; - break; - case 8: - //__tmp << "Quadro D1"; - __tmp << "Riepilogo SH"; - break; - case 9: - //__tmp << "Quadro E" ; - __tmp << "Riepilogo SP" ; - break; - case 10: - //__tmp << "Quadro E1"; - __tmp << "Riepilogo SQ"; - break; - case 11: - __tmp << "Quadro E2"; - break; - case 12: - __tmp << "Quadro F" ; - break; - case 13: - __tmp << "Quadro F1"; - break; - case 14: - __tmp << "Quadro F2"; - break; - case 15: - __tmp << "Quadro G" ; - break; - case 16: - __tmp << "Quadro G1"; - break; - case 17: - __tmp << "Quadro H" ; - break; - case 18: - __tmp << "Quadro I" ; - break; - case 19: - //__tmp << "Quadro L" ; - __tmp << "Riepilogo SL/SK" ; - break; - case 20: - __tmp << "Quadro N" ; - break; - case 21: - __tmp << "Quadro P" ; - break; - case 22: - __tmp << "Quadro Q" ; - break; - case 23: - __tmp << "Quadro R" ; - break; - case 24: - __tmp << "Quadro S" ; - break; - case 25: - __tmp << "Quadro T" ; - break; - case 26: - __tmp << "Quadro Ab"; - break; - case 27: - //__tmp << "Quadro Db"; - __tmp << "Riepilogo SG"; - break; - default: - break; +const char* TManutenzione_quadri::make_prompt(TMask_field& f, stile vivid) +{ + __tmp.cut(0); + + switch(vivid) + { + case sottolineato: __tmp = "@u"; break; + case grassetto : __tmp = "$[b]"; break; + default : __tmp.cut(0); break; } + + TString prompt = f.prompt(); + if (prompt[0] == '@') + prompt.ltrim(2); + else + { + if (prompt[0] == '$') + { + int pos = prompt.find(']'); + prompt.ltrim(pos+1); + } + } + __tmp << prompt; return __tmp; } @@ -341,19 +258,19 @@ void TManutenzione_quadri::inibith(TString& qric, TMask& m) // Il quadro L non ha il flag di compilato sul base. void TManutenzione_quadri::enphasize(TString& qcomp,TMask& m) { - int start_dlg = DLG_NULL_A; - const char* prompt; - int dlg = 0; - // quadri fino al quadro U non compreso for (int i = 0; i < (NUM_QUADRI-1); i++) { if (qcomp[i] != _qcomp_prev[i]) { - dlg = start_dlg + (i * 2); - prompt = make_prompt(i, qcomp[i] == 'X' ? grassetto : piano); - m.field(dlg).set_prompt(prompt); - _qcomp_prev[i] = qcomp[i]; + const short dlg = DLG_NULL_A + (i * 2); + if (m.id2pos(dlg) > 0) + { + TMask_field& f = m.field(dlg); + const char* prompt = make_prompt(f, qcomp[i] == 'X' ? grassetto : piano); + f.set_prompt(prompt); + _qcomp_prev[i] = qcomp[i]; + } } } } @@ -427,14 +344,6 @@ bool TManutenzione_quadri::hide_menu(TMask_field& f, KEY k) f.mask().set_caption("Manutenzione dichiarazione"); return TRUE; } - if (f.mask().field(B_C).shown()) // cancel da menu - { // stampe dichiarazioni - f.mask().hide(-MENU_STAMPEDICH); - f.mask().show(-MENU_STAMPE); - f.mask().first_focus(DLG_STOPREC_STQD); - f.mask().set_caption("Stampe"); - return TRUE; - } return FALSE; } return TRUE; diff --git a/m770/776100b.uml b/m770/776100b.uml index 421a6db41..580f25a0f 100755 --- a/m770/776100b.uml +++ b/m770/776100b.uml @@ -291,51 +291,23 @@ END // Prima colonna // -TEXT DLG_NULL_C -BEGIN - PROMPT 5 10 "Riepilogo SC " - GROUP MENU_MAIN MENU_MAIN_VIS -END - -BUTTON DLG_STOPREC_C 1 1 -BEGIN - PROMPT 1 10 "" - PICTURE 123 - MESSAGE RUN,771MOD,-5,C|K_TAB,RILEGGI_QUADRI - GROUP MENU_MAIN MENU_MAIN_VIS -END - TEXT DLG_NULL_D BEGIN - PROMPT 5 11 "Riepilogo SF " + PROMPT 5 12 "Riepilogo SC" GROUP MENU_MAIN MENU_MAIN_VIS END BUTTON DLG_STOPREC_D 1 1 BEGIN - PROMPT 1 11 "" + PROMPT 1 12 "" PICTURE 123 MESSAGE RUN,771MOD,-5,D|K_TAB,RILEGGI_QUADRI GROUP MENU_MAIN MENU_MAIN_VIS END -TEXT DLG_NULL_DB -BEGIN - PROMPT 5 12 "Riepilogo SG " - GROUP MENU_MAIN MENU_MAIN_VIS -END - -BUTTON DLG_STOPREC_DB 1 1 -BEGIN - PROMPT 1 12 "" - PICTURE 123 - MESSAGE RUN,771MOD,-5,DB|K_TAB,RILEGGI_QUADRI - GROUP MENU_MAIN MENU_MAIN_VIS -END - TEXT DLG_NULL_D1 BEGIN - PROMPT 5 13 "Riepilogo SH " + PROMPT 5 13 "Riepilogo SE" GROUP MENU_MAIN MENU_MAIN_VIS END @@ -349,7 +321,7 @@ END TEXT DLG_NULL_E BEGIN - PROMPT 5 14 "Riepilogo SP " + PROMPT 5 14 "Riepilogo SF" GROUP MENU_MAIN MENU_MAIN_VIS END @@ -363,7 +335,7 @@ END TEXT DLG_NULL_E1 BEGIN - PROMPT 5 15 "Riepilogo SQ " + PROMPT 5 15 "Riepilogo SG" GROUP MENU_MAIN MENU_MAIN_VIS END @@ -377,7 +349,7 @@ END TEXT DLG_NULL_L BEGIN - PROMPT 5 16 "Riepilogo SL/SK " + PROMPT 5 16 "Riepilogo ST" GROUP MENU_MAIN MENU_MAIN_VIS END @@ -1127,57 +1099,26 @@ END // Fine seconda colonna //Prima colonna -TEXT T_C -BEGIN - PROMPT COL1 ROW1 "Riepilogo SC" - FLAGS "H" - GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS -END - -BUTTON B_C 1 1 -BEGIN - PROMPT 1 ROW1 "" - PICTURE 123 - MESSAGE RUN,772MOD,-5,SC,D|K_TAB,RILEGGI_QUADRI - FLAGS "H" - GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS -END TEXT T_D BEGIN - PROMPT COL1 ROW2 "Riepilogo SF" + PROMPT COL1 ROW3 "Riepilogo SC" FLAGS "H" GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS END BUTTON B_D 1 1 BEGIN - PROMPT 1 ROW2 "" + PROMPT 1 ROW3 "" PICTURE 123 - MESSAGE RUN,772MOD,-5,SF,D|K_TAB,RILEGGI_QUADRI + MESSAGE RUN,772MOD,-5,SC,D|K_TAB,RILEGGI_QUADRI FLAGS "H" GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS END -TEXT T_DB -BEGIN - PROMPT COL1 ROW3 "Riepilogo SG" - FLAGS "H" - GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS -END - -BUTTON B_DB 1 1 -BEGIN - PROMPT 1 ROW3 "" - PICTURE 123 - FLAGS "H" - MESSAGE RUN,772MOD,-5,SG,D|K_TAB,RILEGGI_QUADRI - GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS -END - TEXT T_D1 BEGIN - PROMPT COL1 ROW4 "Riepilogo SH" + PROMPT COL1 ROW4 "Riepilogo SE" FLAGS "H" GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS END @@ -1187,13 +1128,13 @@ BEGIN PROMPT 1 ROW4 "" PICTURE 123 FLAGS "H" - MESSAGE RUN,772MOD,-5,SH,D|K_TAB,RILEGGI_QUADRI + MESSAGE RUN,772MOD,-5,SE,D|K_TAB,RILEGGI_QUADRI GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS END TEXT T_E BEGIN - PROMPT COL1 ROW5 "Riepilogo SP" + PROMPT COL1 ROW5 "Riepilogo SF" FLAGS "H" GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS END @@ -1202,14 +1143,14 @@ BUTTON B_E 1 1 BEGIN PROMPT 1 ROW5 "" PICTURE 123 - MESSAGE RUN,772MOD,-5,SP,D|K_TAB,RILEGGI_QUADRI + MESSAGE RUN,772MOD,-5,SF,D|K_TAB,RILEGGI_QUADRI FLAGS "H" GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS END TEXT T_E1 BEGIN - PROMPT COL1 ROW6 "Riepilogo SQ" + PROMPT COL1 ROW6 "Riepilogo SG" FLAGS "H" GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS END @@ -1218,14 +1159,14 @@ BUTTON B_E1 1 1 BEGIN PROMPT 1 ROW6 "" PICTURE 123 - MESSAGE RUN,772MOD,-5,SQ,D|K_TAB,RILEGGI_QUADRI + MESSAGE RUN,772MOD,-5,SG,D|K_TAB,RILEGGI_QUADRI FLAGS "H" GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS END TEXT T_L BEGIN - PROMPT COL1 ROW7 "Riepilogo SL/SK" + PROMPT COL1 ROW7 "Riepilogo ST" FLAGS "H" GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS END @@ -1235,7 +1176,7 @@ BUTTON B_L 1 1 BEGIN PROMPT 1 ROW7 "" PICTURE 123 - MESSAGE RUN,772MOD,-5,SL/SK,D|K_TAB,RILEGGI_QUADRI + MESSAGE RUN,772MOD,-5,ST,D|K_TAB,RILEGGI_QUADRI FLAGS "H" GROUP MENU_STAMPEDICH MENU_STAMPEDICH_VIS END diff --git a/m770/776500a.uml b/m770/776500a.uml index 1c1680469..d77d1485f 100755 --- a/m770/776500a.uml +++ b/m770/776500a.uml @@ -94,7 +94,7 @@ END RADIOBUTTON F_LUOVERS 25 BEGIN PROMPT 2 8 "Luogo versamento " - ITEM "C|Concessione" + ITEM "C|F24" ITEM "T|Tesoreria" FIELD LF_BASE->LUOVERS END @@ -158,4 +158,4 @@ END ENDPAGE -ENDMASK \ No newline at end of file +ENDMASK diff --git a/m770/777200.cpp b/m770/777200.cpp index 4f1d3a093..09b2e93b0 100755 --- a/m770/777200.cpp +++ b/m770/777200.cpp @@ -46,9 +46,8 @@ protected: int first(); int next(); - void transfer_section(TPrint_section& body, - TRecordDylog& rec, - TTrasferimentoDylog& file); + void transfer_section(TPrint_section& body, TRecordDylog& rec, + TTrasferimentoDylog& file, int extra_offset = 0); char log2rec(int num, int& rpm) const; protected: @@ -84,21 +83,8 @@ public: // TRecordDylog /////////////////////////////////////////////////////////// -class TCacheDylog : public TObject -{ - TArray _files; - TAssoc_array _tables; - -public: - const TRectype& get(int num, const char* key); - const TRectype& get(int num, long key); - void destroy(); - - TCacheDylog() { } - virtual ~TCacheDylog() { } -} _cacheDylog; - -const int REC_SIZE = 940; +const int REC_SIZE = 940; // Lunghezza intero record +const int HDR_SIZE = 35; // Lunghezza testata record class TRecordDylog : public TObject { @@ -115,13 +101,12 @@ public: const TRecordDylog& operator=(const TRecordDylog& rec) { _buffer = rec._buffer; return *this; } - const TString& tipo_record() const { return _buffer.left(2); } void tipo_record(const char* tipo); bool valid() const; TRecordDylog(); - TRecordDylog(const char* tipo); + TRecordDylog(const char* tipo, const char* cfdich); TRecordDylog(const TRecordDylog& rec); virtual ~TRecordDylog(); }; @@ -145,7 +130,7 @@ public: virtual bool ok() const; - const char* default_name() const { return "TRA77099"; } + const char* default_name() const { return "TRA77000"; } TTrasferimentoDylog& operator<<(const TRecordDylog& rec) { write(rec); return *this; } @@ -169,11 +154,10 @@ public: // TFormDylog /////////////////////////////////////////////////////////// -void TFormDylog::transfer_section(TPrint_section& body, - TRecordDylog& rec, - TTrasferimentoDylog& file) +void TFormDylog::transfer_section(TPrint_section& body, TRecordDylog& rec, + TTrasferimentoDylog& file, int extra_offset) { - TToken_string trc(16, ','); + TToken_string trc(32, ','); TString80 str; TCursor& cur = *cursor(); @@ -191,12 +175,13 @@ void TFormDylog::transfer_section(TPrint_section& body, const char tipo = trc[0]; const int pos = trc.get_int(1); const int len = trc.get_int(); - rec.set(str, tipo, pos, len); + rec.set(str, tipo, pos + HDR_SIZE + extra_offset, len); } } } } +// Obsoleto bool TFormDylog::compatible(const TRectype& r1, const TRectype& r2) { if (r1.empty() || r2.empty()) @@ -239,6 +224,7 @@ void TFormDylog::add_rec(TRectype& r1, const TRectype& r2) } } +// Obsoleto long TFormDylog::raggruppa_c() { TCursor& cur = *cursor(); @@ -274,7 +260,7 @@ int TFormDylog::first() cur = 0; bool ok = cur.ok(); - if (cur.file().num() == LF_QUAC) + if (cur.file().num() == LF_QUAC) // Obsoleto { if (ok) { @@ -292,7 +278,7 @@ int TFormDylog::next() TCursor& cur = *cursor(); bool ok; - if (cur.file().num() == LF_QUAC) + if (cur.file().num() == LF_QUAC) // Obsoleto { _index++; ok = _index < _records.items(); @@ -321,24 +307,42 @@ long TFormDylog::trasfer(long codditta, TTrasferimentoDylog& file, const char* t filter.zero(); filter.put(BSE_CODDITTA, codditta); cur.setregion(filter, filter); + + const TRectype& ditta = cache().get(LF_NDITTE, codditta); + TString16 codanagr; codanagr << ditta.get_char(NDT_TIPOA) << '|' << ditta.get_long(NDT_CODANAGR); + const TRectype& pers = cache().get(LF_ANAG, codanagr); + const TString16 cfdich = pers.get(ANA_COFI); + + const char* td = NULL; + switch (tipo[1]) + { + case 'C': td = "C0"; break; + case 'E': td = "E0"; break; + case 'T': td = "T0"; break; + default : break; + } const long items = cur.items(); if (items > 0) // Se c'e almeno un record ... { cur.freeze(TRUE); // Per efficienza congela il cursore - int err = first(); // Deve sempre tornare NOERR - CHECKS(err == NOERR, "Invalid cursor ", tipo); - - TPrint_section& head = section('H', first_page); TPrint_section& body = section('B', odd_page); for (; err == NOERR; err = next()) { // Inizializza record col primo modulo - TRecordDylog rec(tipo); - transfer_section(head, rec, file); + TRecordDylog rec(td, cfdich); transfer_section(body, rec, file); + + // Il quadro T0 contiene un array di 8 sotto-record da azzerare per la Dylog! + if (stricmp(td, "T0") == 0) + { + cur.curr().zero(); + for (int i = 1; i < 8; i++) + transfer_section(body, rec, file, i*108); + } + file << rec; } @@ -355,7 +359,7 @@ TFormDylog::TFormDylog(const char* name) switch (TForm::cursor()->file().num()) { - case LF_QUAC: key = "CODDITTA|TIPOA|216@->RAGSOC|CODANAGR|CODCAUS|PERC"; + case LF_QUAC: key = "CODDITTA|TIPOA|216@->RAGSOC|CODANAGR|CODCAUS|PERC"; break; // Obsoleto case LF_QUAD: key = "CODDITTA|216@->RAGSOC|TIPOA|CODANAGR"; break; default : break; } @@ -381,14 +385,9 @@ TFormDylog& TTracciatiDylog::form(const char* quadro) const char* name; switch(quadro[1]) { - case 'C': name = "77qc"; break; - case 'F': name = "77qd"; break; - case 'G': name = "77qdb"; break; - case 'H': name = "77qd1"; break; - case 'K': name = "77qsk"; break; - case 'L': name = "77ql"; break; - case 'P': name = "77qe"; break; - case 'Q': name = "77qe1"; break; + case 'C': name = "77qsc"; break; + case 'E': name = "77qse"; break; + case 'T': name = "77qst"; break; default : name = NULL; break; } @@ -416,33 +415,6 @@ TTracciatiDylog::~TTracciatiDylog() destroy(); // Non viene mai chiamato! } -/////////////////////////////////////////////////////////// -// TCacheDylog -/////////////////////////////////////////////////////////// - -const TRectype& TCacheDylog::get(int num, const char* key) -{ - TRecord_cache* rc = (TRecord_cache*)_files.objptr(num); - if (rc == NULL) - { - rc = new TRecord_cache(num); - _files.add(rc, num); - } - return rc->get(key); -} - -const TRectype& TCacheDylog::get(int num, long key) -{ - TString16 str; str << key; - return get(num, str); -} - -void TCacheDylog::destroy() -{ - _files.destroy(); - _tables.destroy(); -} - /////////////////////////////////////////////////////////// // TRecordDylog /////////////////////////////////////////////////////////// @@ -469,7 +441,7 @@ void TRecordDylog::set(const char* val, char tipo, int pos, int len) { int aaaa, mm, gg; sscanf(str, "%d-%d-%d", &gg, &mm, &aaaa); - str.format("%04d%02d%02d", aaaa, mm, gg); + str.format("%02d%02d%04d", gg, mm, aaaa); lenstr = 8; } else // Controlla numeri reali @@ -483,6 +455,8 @@ void TRecordDylog::set(const char* val, char tipo, int pos, int len) str = "0"; lenstr = 1; } + else + str.rtrim(3); } else // Controlla booleani if (len == 1 && lenstr <= 1 && (str[0] == 'X' || str[0] <= ' ')) @@ -495,7 +469,8 @@ void TRecordDylog::set(const char* val, char tipo, int pos, int len) if (lenstr > len) { #ifdef DBG - NFCHECK("Campo troppo lungo: %s (max. %d)", val, len); + if (tipo == 'N') + NFCHECK("Campo troppo lungo: %s (max. %d)", val, len); #endif str.cut(lenstr = len); } @@ -506,15 +481,15 @@ void TRecordDylog::set(const char* val, char tipo, int pos, int len) else str.left_just(len); } - _buffer.overwrite(str, pos-1); + _buffer.overwrite(str, pos); } bool TRecordDylog::valid() const { - if (tipo_record().blank()) + if (_buffer[0] != 'P') return FALSE; - if (_buffer.right(3) != "A\r\n") + if (_buffer[1] == ' ' || _buffer[2] == ' ') return FALSE; return TRUE; @@ -523,12 +498,12 @@ bool TRecordDylog::valid() const void TRecordDylog::tipo_record(const char* tipo) { _buffer.spaces(REC_SIZE); - if (tipo && *tipo) - { - _buffer[0] = tipo[0]; - _buffer[1] = tipo[1]; + _buffer[0] = 'P'; // Linea Prassi + if (tipo && *tipo) + { + _buffer[1] = tipo[0]; + _buffer[2] = tipo[1]; } - _buffer.overwrite("A\r\n", REC_SIZE-3); } TRecordDylog::TRecordDylog() @@ -536,9 +511,11 @@ TRecordDylog::TRecordDylog() tipo_record(NULL); } -TRecordDylog::TRecordDylog(const char* tipo) +TRecordDylog::TRecordDylog(const char* tipo, const char* cf) { tipo_record(tipo); + if (cf && *cf) + set(cf, 'A', 3, 16); // Codice fiscale dichiarante } TRecordDylog::TRecordDylog(const TRecordDylog& rec) : _buffer(rec._buffer) @@ -696,20 +673,9 @@ bool TTrasferimentoDylog::split(const char* path) while (read(rec)) { - const TString& tipo_rec = rec.tipo_record(); - if (tipo_rec == "AA" || tipo_rec == "ZZ") - continue; - - const int pos = tipo_rec[1] - 'A'; - if (pos >= 0 && pos < 26) - { - outfile << rec; - totale[pos]++; - written++; - pi.addstatus(1); - } - else - error_box("Tipo record non riconosciuto: %c", tipo_rec); + outfile << rec; + written++; + pi.addstatus(1); if (magnetic && written > records_per_disk) break; @@ -803,22 +769,21 @@ void TTransferDylog_app::main_loop() da_rec.put(BSE_CODDITTA, m.get(F_DADITTA)); a_rec.put(BSE_CODDITTA, m.get(F_ADITTA)); - TString filter; - filter << "ANNODIC==" << anno_dic(); - TCursor cur_base(&rel_base, filter, 1, &da_rec, &a_rec); + TCursor cur_base(&rel_base, "", 1, &da_rec, &a_rec); TProgind pi(cur_base.items(), "Generazione file di trasferimento", FALSE, TRUE); cur_base.freeze(); for (cur_base = 0; cur_base.ok(); ++cur_base) { + pi.addstatus(1); const TRectype& base = cur_base.curr(); const long codditta = base.get_long(BSE_CODDITTA); - pi.addstatus(1); - t.append_quadro("SC", codditta, pi); - t.append_quadro("SF", codditta, pi); - t.append_quadro("SG", codditta, pi); - t.append_quadro("SH", codditta, pi); - t.append_quadro("SL", codditta, pi); + if (codditta > 0) // Strano, ma puo' succedere + { + t.append_quadro("SC", codditta, pi); + t.append_quadro("SE", codditta, pi); + t.append_quadro("ST", codditta, pi); + } } pi.close_modal(); diff --git a/m770/77qsc.frm b/m770/77qsc.frm new file mode 100755 index 000000000..1e6daac89 --- /dev/null +++ b/m770/77qsc.frm @@ -0,0 +1,401 @@ +USE 62 +JOIN 9 INTO CODDITTA=CODDITTA +JOIN 6 TO 9 ALIAS 206 INTO TIPOA=TIPOA CODANAGR=CODANAGR +JOIN 6 ALIAS 216 INTO TIPOA=TIPOA CODANAGR=CODANAGR +JOIN 8 TO 216@ ALIAS 218 INTO CODANAGR=CODANAGR +JOIN 13 TO 218@ ALIAS 313 INTO STATO=="" COM==COMNASC +JOIN 13 TO 216@ ALIAS 413 INTO STATO==STATORES COM==COMRES +JOIN 13 TO 216@ ALIAS 513 INTO STATO=="" COM==COMRF +JOIN %STA TO 216@ ALIAS 104 INTO CODTAB=STATORES +END + +DESCRIPTION +BEGIN + 62->* "Quadro SC 770" + 9->* "Ditte" + 6->* "Anagrafica persone fisiche e giuridiche" + 8->* "Anagrafica persone fisiche" + 206@->* "Anagrafica persone fisiche e giuridiche" + 216@->* "Anagrafica persone fisiche e giuridiche" + 218@->* "Anagrafica persone fisiche" + 313@->* "Comune nascita" + 413@->* "Comune residenza" + 513@->* "Comune residenza fiscale" +END + +GENERAL +BEGIN + OFFSET 0 0 + FONT "Roman 17cpi" + SIZE 12 + CA "X" + IN 3 3 + FI 130 +END + +SECTION HEADER FIRST 18 + +STRINGA 1 +BEGIN + KEY "CODICE FISCALE" + PROMPT 55 8 "" + FIELD 206@->COFI + SPECIAL STRING TRASFER "SF0101" "" + SPECIAL STRING DYLOG "AN,3,16" "" +END + +STRINGA 13 +BEGIN + KEY "CODICE FISCALE DICHIARANTE" + PROMPT 88 8 "" + SPECIAL STRING DYLOG "AN,19,16" "" +END + +NUMBER 14 +BEGIN + KEY "NUM. FOGLIO" + PROMPT 123 8 "" +END + +END + +SECTION HEADER ODD 4 +// Header pagine 2 e 3 +END + +SECTION HEADER LAST 5 +// Header ultima pagina +END + + +SECTION BODY ODD 10 + +LISTA 99 +BEGIN + KEY "Tipo anagrafica" + PROMPT 1 1 "" + FIELD TIPOA + ITEM "F| " MESSAGE SHOW,1@|HIDE,2@|"1",98 + ITEM "G| " MESSAGE SHOW,2@|HIDE,1@|"2",98 +END + +STRINGA 98 +BEGIN + KEY "Tipo anagrafica 1/2" + SPECIAL STRING DYLOG "NU,16,1" "" +END + +STRINGA 1 +BEGIN + KEY "COD.FIS" + PROMPT 10 1 "" + FIELD 216@->COFI + SPECIAL STRING TRASFER "SF0201" "" + SPECIAL STRING DYLOG "AN,0,16" "" +END + +STRINGA 2 +BEGIN + KEY "COGNOME" + PROMPT 42 1 "" + FIELD 216@->RAGSOC[1,30] + GROUP 1 + SPECIAL STRING TRASFER "SF0202" "" + SPECIAL STRING DYLOG "AN,17,24" "" +END + +STRINGA 3 +BEGIN + KEY "NOME" + PROMPT 22 3 "" + FIELD 216@->RAGSOC[31,50] + GROUP 1 + SPECIAL STRING TRASFER "SF0203" "" + SPECIAL STRING DYLOG "AN,41,20" "" +END + +STRINGA 102 +BEGIN + KEY "RAGSOC GIURIDICHE" + PROMPT 42 1 "" + FIELD 216@->RAGSOC + GROUP 2 + SPECIAL STRING TRASFER "SF0202" "" + SPECIAL STRING DYLOG "AN,151,60" "" +END + +STRINGA 4 +BEGIN + KEY "SESSO" + PROMPT 57 3 "" + FIELD 218@->SESSO + GROUP 1 + SPECIAL STRING TRASFER "SF0204" "" + SPECIAL STRING DYLOG "AN,69,1" "" +END + +STRINGA 5 +BEGIN + KEY "DATA NASCITA" + PROMPT 63 3 "" + FIELD 218@->DATANASC + PICTURE "##^ ##^ ####" + GROUP 1 + SPECIAL STRING TRASFER "SF0205" "" + SPECIAL STRING DYLOG "NU,61,8" "" +END + +STRINGA 6 +BEGIN + KEY "COMUNE DI NASCITA" + PROMPT 79 3 "" + FIELD 313@->DENCOM + GROUP 1 + SPECIAL STRING TRASFER "SF0206" "" + SPECIAL STRING DYLOG "AN,70,21" "" +END + +STRINGA 7 +BEGIN + KEY "PROV DI NASCITA" + PROMPT 126 3 "" + FIELD 313@->PROVCOM + GROUP 1 + SPECIAL STRING TRASFER "SF0207" "" + SPECIAL STRING DYLOG "AN,91,2" "" +END + +STRINGA 8 +BEGIN + KEY "COMUNE DI RESIDENZA FISCALE" + PROMPT 25 5 "" + FIELD 513@->DENCOM + MESSAGE EMPTY ENABLE,3@|DISABLE,4@ + MESSAGE ENABLE,4@|DISABLE,3@|COPY,208 + SPECIAL STRING TRASFER "SF0208" "" + SPECIAL STRING DYLOG "AN,93,21" "" + GROUP 1 +END + +STRINGA 80 +BEGIN + KEY "COMUNE DI RESIDENZA" + PROMPT 25 5 "" + FIELD 413@->DENCOM + GROUP 1 3 + SPECIAL STRING TRASFER "SF0208" "" + SPECIAL STRING DYLOG "AN,128,21" "" + MESSAGE COPY,208 +END + +STRINGA 9 +BEGIN + KEY "PROV. RESIDENZA" + PROMPT 71 5 "" + FIELD 513@->PROVCOM + FIELD 413@->PROVCOM + SPECIAL STRING TRASFER "SF0209" "" + SPECIAL STRING DYLOG "AN,149,2" "" + MESSAGE COPY,209 + GROUP 1 +END + +STRINGA 101 +BEGIN + KEY "VIA RES." + FIELD 216@->INDRES[1,35] + FLAGS "H" + MESSAGE COPY,10 +END + +STRINGA 102 +BEGIN + KEY "NUM.CIV DI RESIDENZA" + FLAGS "H" + FIELD 216@->CIVRES + MESSAGE APPEND,10 +END + +STRINGA 10 +BEGIN + KEY "VIA RES. + NUMCIVRES" + PROMPT 78 5 "" + GROUP 1 3 + SPECIAL STRING TRASFER "SF0210" "" + SPECIAL STRING DYLOG "AN,116,35" "" + MESSAGE COPY,210 +END + +STRINGA 103 +BEGIN + KEY "VIA RES. FISC." + FIELD 216@->INDRF[1,35] + FLAGS "H" + MESSAGE COPY,100 +END + +STRINGA 104 +BEGIN + KEY "NUM.CIV DI RESIDENZA FISC." + FLAGS "H" + FIELD 216@->CIVRF + MESSAGE APPEND,100 +END + +STRINGA 100 +BEGIN + KEY "VIA RF + NUMCIVRF" + PROMPT 78 5 "" + GROUP 4 + SPECIAL STRING DYLOG "AN,248,35" "" + GROUP 1 + MESSAGE COPY,210 +END + +LISTA 11 +BEGIN + KEY "FLAG DI NON RESIDENTE" + PROMPT 10 7 "" + ITEM "| " MESSAGE HIDE,5@|"0",97 + ITEM "X|X" MESSAGE SHOW,5@|"1",97 + FIELD 216@->SOGGNRES + SPECIAL STRING TRASFER "SF0211" "" +END + +NUMBER 97 +BEGIN + SPECIAL STRING DYLOG "NU,304,1" "" +END + +STRINGA 208 +BEGIN + KEY "COMUNE DI RESIDENZA GIURIDICHE" + GROUP 2 + SPECIAL STRING DYLOG "AN,211,21" "" +END + +STRINGA 209 +BEGIN + KEY "PROV. RESIDENZA GIURIDICHE" + GROUP 2 + SPECIAL STRING DYLOG "AN,232,2" "" +END + +STRINGA 210 +BEGIN + KEY "INDIRIZZO GIURIDICHE" + GROUP 2 + SPECIAL STRING DYLOG "AN,234,35" "" +END + +STRINGA 12 +BEGIN + KEY "STATO ESTERO DI RES." + PROMPT 14 7 "" + FIELD 104@->S0 + GROUP 5 + SPECIAL STRING TRASFER "SF0212" "" + SPECIAL STRING DYLOG "AN,270,35" "" +END + +STRINGA 13 +BEGIN + KEY "CODICE STATO ESTERO DI RES." + PROMPT 75 7 "" + FIELD 216@->STATORES + GROUP 5 + SPECIAL STRING TRASFER "SF0213" "" + SPECIAL STRING DYLOG "NU,305,3" "" +END + +STRINGA 14 +BEGIN + KEY "CODICE FISCALE ESTERO" + PROMPT 90 7 "" + FIELD 216@->COFIEST + GROUP 5 + SPECIAL STRING TRASFER "SF0214" "" + SPECIAL STRING DYLOG "AN,308,20" "" +END + +STRINGA 15 +BEGIN + KEY "CAUSALE" + PROMPT 13 9 "" + FIELD CAUSALE + SPECIAL STRING TRASFER "SF0215" "" + SPECIAL STRING DYLOG "AN,328,1" "" +END + +NUMBER 16 +BEGIN + KEY "TOTALE" + PROMPT 27 9 "" + FIELD TOTALE + PICTURE "###.###.###^^^" + SPECIAL STRING TRASFER "SF0216" "" + SPECIAL STRING DYLOG "NU,329,11" "" +END + +NUMBER 17 +BEGIN + KEY "SOMME NON SOGGETTE A RITENUTA" + PROMPT 47 9 "" + FIELD SOMME + PICTURE "###.###.###^^^" + SPECIAL STRING TRASFER "SF0217" "" + SPECIAL STRING DYLOG "NU,340,11" "" +END + +NUMBER 18 +BEGIN + KEY "SOMREGCONV" + PROMPT 66 9 "" + FIELD SOMREGCONV + PICTURE "###.###.###^^^" + SPECIAL STRING TRASFER "SF0218" "" + SPECIAL STRING DYLOG "NU,351,11" "" +END + +NUMBER 19 +BEGIN + KEY "IMPONIBILE" + PROMPT 88 9 "" + FIELD IMPONIBILE + PICTURE "###.###.###^^^" + SPECIAL STRING TRASFER "SF0219" "" + SPECIAL STRING DYLOG "NU,362,11" "" +END + +NUMBER 20 +BEGIN + KEY "IMPORTO" + PROMPT 109 9 "" + FIELD IMPORTO + PICTURE "###.###.###^^^" + SPECIAL STRING TRASFER "SF0220" "" + SPECIAL STRING DYLOG "NU,373,11" "" +END + +NUMBER 21 +BEGIN + KEY "RITENUTE SOSPESE" + PROMPT 109 9 "" +// FIELD IMPORTO + PICTURE "###.###.###^^^" + SPECIAL STRING TRASFER "SF0221" "" + SPECIAL STRING DYLOG "NU,384,11" "" +END + +END + +SECTION FOOTER LAST 3 + +STRINGA 2 +BEGIN + KEY "FIRMA a 3 righe vuote dal body" + PROMPT 84 3 "" + FIELD 206@->RAGSOC +END + +END diff --git a/m770/77qse.frm b/m770/77qse.frm new file mode 100755 index 000000000..673c03ba6 --- /dev/null +++ b/m770/77qse.frm @@ -0,0 +1,249 @@ +USE 63 +JOIN 6 TO 63 ALIAS 106 INTO TIPOA=TIPOA CODANAGR=CODANAGR +JOIN 8 TO 6 ALIAS 108 INTO CODANAGR=CODANAGR +JOIN 13 TO 108@ ALIAS 113 INTO STATO=="" COM==COMNASC +JOIN 13 TO 106@ ALIAS 213 INTO STATO==STATORES COM==COMRES +END + +DESCRIPTION +BEGIN + 63->* "Quadro SE 770" + 6->* "Anagrafica persone fisiche e giuridiche" + 8->* "Anagrafica persone fisiche" + 13->* "Comuni" +END + +GENERAL +BEGIN + OFFSET 0 0 + FONT "Roman 17cpi" + SIZE 12 + CA "X" + IN 3 3 + FI 130 +END + +SECTION BODY ODD 2 + +LISTA 98 +BEGIN + KEY "Tipo anagrafica" + FIELD 106@->TIPOA + ITEM "F| " MESSAGE ENABLE,1@|DISABLE,2@|"1",99 + ITEM "G| " MESSAGE ENABLE,2@|DISABLE,1@|"2",99 +END + +STRINGA 99 +BEGIN + KEY "Tipo numerico anagrafica" + SPECIAL STRINGA DYLOG "NU,16,1" "" +END + +STRINGA 1 +BEGIN + KEY "COD.FIS" + PROMPT 9 2 "" + FIELD 106@->COFI + SPECIAL STRINGA TRASFER "SC0201" "" + SPECIAL STRINGA DYLOG "AN,0,16" "" +END + +STRING 2 +BEGIN + KEY "COGNOME" + PROMPT 42 2 "" + FIELD 106@->RAGSOC[1,30] + SPECIAL STRINGA TRASFER "SC0202" "" + SPECIAL STRINGA DYLOG "AN,17,24" "" + GROUP 1 +END + +STRING 3 +BEGIN + KEY "NOME" + PROMPT 79 2 "" + FIELD 106@->RAGSOC[31,50] + SPECIAL STRINGA TRASFER "SC0203" "" + SPECIAL STRINGA DYLOG "AN,41,20" "" + GROUP 1 +END + +STRING 4 +BEGIN + KEY "SESSO" + PROMPT 126 2 "" + FIELD 108@->SESSO + SPECIAL STRINGA TRASFER "SC0205" "" + SPECIAL STRINGA DYLOG "AN,69,1" "" +END + +STRING 5 +BEGIN + KEY "DATA NASCITA" + PROMPT 112 2 "" + FIELD 108@->DATANASC + SPECIAL STRINGA TRASFER "SC0204" "" + SPECIAL STRINGA DYLOG "NU,61,8" "" +END + +STRING 6 +BEGIN + KEY "COMUNE DI NASCITA" + PROMPT 9 4 "" + FIELD 113@->DENCOM + SPECIAL STRINGA TRASFER "SC0206" "" + SPECIAL STRINGA DYLOG "AN,70,21" "" + GROUP 1 +END + +STRING 7 +BEGIN + KEY "PROV DI NASCITA" + PROMPT 46 4 "" + FIELD 113@->PROVCOM + SPECIAL STRINGA TRASFER "SC0207" "" + SPECIAL STRINGA DYLOG "AN,91,2" "" + GROUP 1 +END + +STRING 8 +BEGIN + KEY "COMUNE DI RESIDENZA" + PROMPT 52 4 "" + FIELD 213@->DENCOM + SPECIAL STRINGA TRASFER "SC0208" "" + SPECIAL STRINGA DYLOG "AN,93,21" "" + GROUP 1 +END + +STRING 9 +BEGIN + KEY "PROV. RESIDENZA" + PROMPT 88 4 "" + FIELD 213@->PROVCOM + SPECIAL STRINGA TRASFER "SC0209" "" + SPECIAL STRINGA DYLOG "AN,114,2" "" +END + +STRING 101 +BEGIN + KEY "VIA RES." + PROMPT 93 4 "" + FIELD 106@->INDRES[1,30] + FLAGS "H" + MESSAGE COPY,10 + MESSAGE COPY,210 +END + +STRING 102 +BEGIN + KEY "NUM.CIV" + PROMPT 93 4 "" + FLAGS "H" + FIELD 106@->CIVRES + MESSAGE APPEND,10 + MESSAGE APPEND,210 +END + +STRING 10 +BEGIN + KEY "VIA RES. + numcivres" + PROMPT 93 4 "" + SPECIAL STRINGA TRASFER "SC0210" "" + SPECIAL STRINGA DYLOG "AN,116,35" "" + GROUP 1 +END + +STRING 202 +BEGIN + KEY "RAGIONE SOCIALE" + PROMPT 42 2 "" + FIELD 106@->RAGSOC + SPECIAL STRINGA DYLOG "AN,151,60" "" + GROUP 2 +END + +STRING 208 +BEGIN + KEY "COMUNE DI RESIDENZA FISCALE" + PROMPT 52 4 "" + FIELD 213@->DENCOM + SPECIAL STRINGA DYLOG "AN,211,21" "" + GROUP 2 +END + +STRING 209 +BEGIN + KEY "PROV. RESIDENZA FISCALE" + PROMPT 88 4 "" + FIELD 213@->PROVCOM + SPECIAL STRINGA DYLOG "AN,232,2" "" + GROUP 2 +END + +STRING 210 +BEGIN + KEY "VIA RES. + numcivres" + PROMPT 93 4 "" + SPECIAL STRINGA DYLOG "AN,234,35" "" + GROUP 2 +END + +STRINGA 11 +BEGIN + KEY "CAUSALE Quadro SE" + PROMPT 10 1 "" + FIELD CAUSALE + SPECIAL STRINGA DYLOG "AN,269,1" "" +END + +NUMBER 12 +BEGIN + KEY "AMMONTARE LORDO CORRISPOSTO" + PROMPT 37 6 "" + FIELD TOTALE + SPECIAL STRINGA DYLOG "NU,270,11" "" +END + +NUMBER 13 +BEGIN + KEY "SPESE ANTICIPATE" + PROMPT 37 6 "" + FIELD SPESEANT + SPECIAL STRINGA DYLOG "NU,281,11" "" +END + +NUMBER 14 +BEGIN + KEY "QUOTA PROVVIGIONI" + PROMPT 37 6 "" + FIELD QUOTAPRO + SPECIAL STRINGA DYLOG "NU,292,11" "" +END + +NUMBER 15 +BEGIN + KEY "IMPONIBILE" + PROMPT 37 6 "" + FIELD IMPONIBILE + SPECIAL STRINGA DYLOG "NU,303,11" "" +END + +NUMBER 16 +BEGIN + KEY "RITENUTEOPERATE" + PROMPT 37 6 "" + FIELD IMPORTO + SPECIAL STRINGA DYLOG "NU,314,11" "" +END + +NUMBER 17 +BEGIN + KEY "RITENUTE SOSPESE" + PROMPT 37 6 "" + SPECIAL STRINGA DYLOG "NU,325,11" "" +END + +END + + diff --git a/m770/77qst.frm b/m770/77qst.frm new file mode 100755 index 000000000..ca3a245d8 --- /dev/null +++ b/m770/77qst.frm @@ -0,0 +1,135 @@ +USE 42 +END + +DESCRIPTION +BEGIN + 41->* "Quadro ST 770" +END + +GENERAL +BEGIN + OFFSET 0 0 + FONT "Roman 17cpi" + SIZE 12 + CA "X" + IN 3 3 + FI 130 +END + +SECTION BODY ODD 2 + +NUMERO 1 +BEGIN + KEY "MESE RIFERIMENTO" + PROMPT 9 2 "" + FIELD QLMP + SPECIAL STRINGA DYLOG "NU,0,2" "" +END + +NUMERO 1 +BEGIN + KEY "ANNO RIFERIMENTO" + PROMPT 42 2 "" + FIELD QLAP[3,4] + SPECIAL STRINGA DYLOG "NU,2,2" "" +END + +NUMERO 2 +BEGIN + KEY "RITENUTE" + PROMPT 79 2 "" + FIELD QLRITEFF + SPECIAL STRINGA DYLOG "NU,4,11" "" +END + +NUMERO 3 +BEGIN + KEY "RITENUTE NON VERSATE PER ECCESSO" + PROMPT 79 2 "" + SPECIAL STRINGA DYLOG "NU,15,11" "" +END + +NUMERO 4 +BEGIN + KEY "RITENUTE NON VERSATE PER RESTITUZIONI" + PROMPT 79 2 "" + SPECIAL STRINGA DYLOG "NU,26,11" "" +END + +NUMERO 5 +BEGIN + KEY "RITENUTE NON VERSATE PER CREDITI" + PROMPT 79 2 "" + SPECIAL STRINGA DYLOG "NU,37,11" "" +END + +NUMERO 6 +BEGIN + KEY "TOTALE IMPORTO VERSATO" + PROMPT 79 2 "" + FIELD QLRITVER + SPECIAL STRINGA DYLOG "NU,48,11" "" +END + +STRINGA 8 +BEGIN + KEY "NOTE" + PROMPT 79 2 "" + FIELD QLNOTE + SPECIAL STRINGA DYLOG "AN,70,20" "" +END + +STRINGA 10 +BEGIN + KEY "CODICE TRIBUTO" + PROMPT 79 2 "" + FIELD QLCT + SPECIAL STRINGA DYLOG "AN,91,4" "" +END + +STRINGA 11 +BEGIN + KEY "ARTICOLO" + PROMPT 79 2 "" + FIELD QLAB + SPECIAL STRINGA DYLOG "AN,95,2" "" +END + +NUMERO 12 +BEGIN + KEY "Codice regione" + SPECIAL STRINGA DYLOG "NU,97,2" "" +END + +LISTA 130 +BEGIN + KEY "Concessione/Tesoreria/F24" + ITEM "|" + MESSAGE "",13 + ITEM "C|Concessione" + MESSAGE "F",13 + ITEM "F|F24" + MESSAGE "F",13 + ITEM "T|TESORERIA" + MESSAGE "T",13 + FIELD QLLV +END + +STRINGA 13 +BEGIN + KEY "Tesoreria/F24" + PROMPT 79 2 "" + SPECIAL STRINGA DYLOG "AN,99,1" "" +END + +NUMERO 14 +BEGIN + KEY "DATA VERSAMENTO" + PROMPT 79 2 "" + FIELD QLDV + SPECIAL STRINGA DYLOG "NU,100,8" "" +END + +END + + diff --git a/m770/77sr.cpp b/m770/77sr.cpp index 102349abe..42eb942e9 100755 --- a/m770/77sr.cpp +++ b/m770/77sr.cpp @@ -39,16 +39,13 @@ TStampa_riepilogo::TStampa_riepilogo(const char * riepilogo) bool TStampa_riepilogo::create() { TString form_name; - - form_name = "77sr"; - if (_riepilogo == "SL/SK") - form_name << "SL"; - else - form_name << _riepilogo; + form_name << "77sr" << _riepilogo; form_name.lower(); + _frm = new TForm(form_name); // fatal_box automaGico se il form non esiste... _msk = new TMask("77sr"); // La maschera est unica. _msk->set_caption(titolo()); + { TConfig conf(CONFIG_USER, "77"); _currfirm = conf.get_long(DITTA_770, "77"); diff --git a/m770/77srsc.frm b/m770/77srsc.frm index ceb7a2aa5..b7318da6e 100755 --- a/m770/77srsc.frm +++ b/m770/77srsc.frm @@ -1,201 +1,123 @@ -USE 61 -JOIN %CA7 TO 61 ALIAS 14 INTO CODTAB=CODCAUS +USE 62 JOIN 9 INTO CODDITTA=CODDITTA -JOIN 6 TO 9 ALIAS 116 INTO TIPOA=TIPOA CODANAGR=CODANAGR -JOIN 6 TO 61 ALIAS 216 INTO TIPOA=TIPOA CODANAGR=CODANAGR -JOIN 8 TO 216@ ALIAS 218 INTO CODANAGR=CODANAGR +JOIN 6 TO 9 ALIAS 206 INTO TIPOA=TIPOA CODANAGR=CODANAGR +JOIN 6 ALIAS 216 INTO TIPOA=TIPOA CODANAGR=CODANAGR +JOIN 8 TO 216@ ALIAS 218 INTO CODANAGR=CODANAGR JOIN 13 TO 218@ ALIAS 313 INTO STATO=="" COM==COMNASC JOIN 13 TO 216@ ALIAS 413 INTO STATO==STATORES COM==COMRES +JOIN 13 TO 216@ ALIAS 513 INTO STATO=="" COM==COMRF +JOIN %STA TO 216@ ALIAS 104 INTO CODTAB=STATORES END - DESCRIPTION BEGIN - 61->* "Riepilogo SC" - 9->* "Ditte" - 6->* "Anagrafica persone fisiche e giuridiche" - 8->* "Anagrafica persone fisiche" - 216@->* "Anagrafica persone fisiche e giuridiche" - 218@->* "Anagrafica persone fisiche" - 313@->* "Comuni" - 413@->* "Comuni" +62->* "Quadro D 770" +9->* "Ditte" +6->* "Anagrafica persone fisiche e giuridiche" +8->* "Anagrafica persone fisiche" +206@->* "Anagrafica persone fisiche e giuridiche" +216@->* "Anagrafica persone fisiche e giuridiche" +218@->* "Anagrafica persone fisiche" +313@->* "Comune nascita" +413@->* "Comune residenza" +513@->* "Comune residenza fiscale" END - GENERAL BEGIN - OFFSET 0 0 +OFFSET 0 0 END - SECTION HEADER ODD 6 - STRINGA 1 40 1 BEGIN - KEY "nome ditta" - PROMPT 1 1 "Ditta: " - FIELD 9->RAGSOC +KEY "nome ditta" +PROMPT 1 1 "Ditta: " +FIELD 9->RAGSOC END - STRINGA 2 10 BEGIN - KEY "Data" - PROMPT 106 1 "Data " - MESSAGE _TODAY +KEY "Data" +PROMPT 106 1 "Data " +MESSAGE _TODAY END - NUMERO 3 7 BEGIN - KEY "Nr. pagina" - PROMPT 122 1 "Pagina " - MESSAGE _PAGENO +KEY "Nr. pagina" +PROMPT 122 1 "Pagina " +MESSAGE _PAGENO END - NUMERO 4 40 BEGIN - KEY "Intestazione stampa" - PROMPT 55 2 "Stampa riepilogo SC" +KEY "Intestazione stampa" +PROMPT 55 2 "Stampa riepilogo SC" END - END - -SECTION BODY ODD 2 COLUMNWISE - -STRING 1 50 -BEGIN +SECTION BODY ODD 2 COLUMWISE +STRINGA 1 50 +BEGIN SPECIAL STRINGA INTESTAZIONE "Ragione Sociale" "Ragione Sociale" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "Ragione Sociale" + KEY "RAGSOC GIURIDICHE" PROMPT 1 1 "" FIELD 216@->RAGSOC END -STRINGA 2 5 +STRINGA 2 15 BEGIN - SPECIAL STRINGA INTESTAZIONE "Caus." "Caus." + SPECIAL STRINGA INTESTAZIONE "@cCausale" "Causale" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "CAUSALE riepilogo SC" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "CAUSALE" PROMPT 2 1 "" FIELD CAUSALE END - -STRING 3 5 +NUMBER 3 14 BEGIN - SPECIAL STRINGA INTESTAZIONE "Tass." "Tass." + SPECIAL STRINGA INTESTAZIONE "@cTotale" "Tot." SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "FLAG TASSAZIONE SEPARATA" + KEY "TOTALE" PROMPT 3 1 "" - FIELD TASSAZIONE + FIELD TOTALE + PICTURE "###.###.###^^^" END - -VALUTA 4 14 +NUMBER 4 15 BEGIN - SPECIAL STRINGA INTESTAZIONE "@CAmm. lordo" "Amm. lordo" - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "AMMONTARE LORDO CORRISPOSTO" - PROMPT 4 1 "" - PICTURE "###.###.###^^^" - FIELD AMMLORDO -END - -VALUTA 5 14 -BEGIN - SPECIAL STRINGA INTESTAZIONE "@CContributi" "Contributi" - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "CONTRIBUTI OBBLIGATORI" - PROMPT 5 1 "" - PICTURE "###.###.###^^^" - FIELD CONTROBB -END - -VALUTA 6 14 -BEGIN - SPECIAL STRINGA INTESTAZIONE "Somme non sogg" "Somme non sogg" + SPECIAL STRINGA INTESTAZIONE "Somme non sogg." "Somme non sogg." SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" KEY "SOMME NON SOGGETTE A RITENUTA" - PROMPT 6 1 "" - PICTURE "###.###.###^^^" - FIELD SOMNONSOGG + PROMPT 4 1 "" + FIELD SOMME + PICTURE "###.###.###^^^" END - -VALUTA 7 14 +NUMBER 5 15 BEGIN - SPECIAL STRINGA INTESTAZIONE "@CImponibile" "Imponibile" + SPECIAL STRINGA INTESTAZIONE "Som. Reg. Conv." "Som. Reg. Conv" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "SOMREGCONV" + PROMPT 5 1 "" + FIELD SOMREGCONV + PICTURE "###.###.###^^^" +END +NUMBER 6 14 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cImponibile" "Imponibile" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" KEY "IMPONIBILE" - PROMPT 7 1 "" - PICTURE "###.###.###^^^" - FIELD IMPONIBILE + PROMPT 6 1 "" + FIELD IMPONIBILE + PICTURE "###.###.###^^^" END - -VALUTA 8 14 +NUMBER 7 14 BEGIN - SPECIAL STRINGA INTESTAZIONE "@CImposta" "Imposta" + SPECIAL STRINGA INTESTAZIONE "@cImporto" "Importo" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "IMPOSTA" - PROMPT 8 1 "" - PICTURE "###.###.###^^^" - FIELD IMPOSTA + KEY "IMPORTO" + PROMPT 7 1 "" + FIELD IMPORTO + PICTURE "###.###.###^^^" END - -VALUTA 9 14 -BEGIN - SPECIAL STRINGA INTESTAZIONE "@CDetr. fam." "Detr. fam." - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "DETRAZIONI PER CARICHI DI FAMIGLIA" - PROMPT 9 1 "" - PICTURE "###.###.###^^^" - FIELD DETCARFAM END - -NUMBER 10 6 -BEGIN - SPECIAL STRINGA INTESTAZIONE "Gg.det" "Gg.det" - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "NUMERO GIORNI DETRAZIONI PER LAVORO DIPENDENTE" - PROMPT 10 1 "" - FIELD GGLAVDIP -END - -VALUTA 11 14 -BEGIN - SPECIAL STRINGA INTESTAZIONE "@CDetr. lav." "Detr. lav." - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "DETRAZIONI PER LAVORO DIPENDENTE" - PROMPT 11 1 "" - PICTURE "###.###.###^^^" - FIELD DETLAVDIP -END - -VALUTA 12 14 -BEGIN - SPECIAL STRINGA INTESTAZIONE "@CTot. detr." "Tot. detr." - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "TOTALE DETRAZIONI" - PROMPT 12 1 "" - PICTURE "###.###.###^^^" - FIELD TOTDET -END - -VALUTA 13 14 -BEGIN - SPECIAL STRINGA INTESTAZIONE "Ritenute" "Ritenute" - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "RITENUTE OPERATE" - PROMPT 13 1 "" - PICTURE "###.###.###^^^" - FIELD RITENUTE -END - -END - diff --git a/m770/77srse.frm b/m770/77srse.frm new file mode 100755 index 000000000..50bcd8f95 --- /dev/null +++ b/m770/77srse.frm @@ -0,0 +1,120 @@ +USE 63 +JOIN 9 INTO CODDITTA=CODDITTA +JOIN 6 TO 9 ALIAS 106 INTO TIPOA=TIPOA CODANAGR=CODANAGR +JOIN 6 ALIAS 216 INTO TIPOA=TIPOA CODANAGR=CODANAGR +JOIN 8 TO 216@ ALIAS 218 INTO CODANAGR=CODANAGR +JOIN 13 TO 218@ ALIAS 313 INTO STATO=="" COM==COMNASC +JOIN 13 TO 216@ ALIAS 413 INTO STATO==STATORES COM==COMRES +JOIN 13 TO 216@ ALIAS 513 INTO STATO=="" COM==COMRF +END +DESCRIPTION +BEGIN +63->* "Quadro D1 770" +9->* "Ditte" +6->* "Anagrafica persone fisiche e giuridiche" +8->* "Anagrafica persone fisiche" +216@->* "Anagrafica persone fisiche e giuridiche" +218@->* "Anagrafica persone fisiche" +313@->* "Comune nascita" +413@->* "Comune residenza" +513@->* "Comune residenza fiscale" +END +GENERAL +BEGIN +OFFSET 0 0 +END +SECTION HEADER ODD 6 +STRINGA 1 40 1 +BEGIN +KEY "nome ditta" +PROMPT 1 1 "Ditta: " +FIELD 9->RAGSOC +END +STRINGA 2 10 +BEGIN +KEY "Data" +PROMPT 106 1 "Data " +MESSAGE _TODAY +END +NUMERO 3 7 +BEGIN +KEY "Nr. pagina" +PROMPT 122 1 "Pagina " +MESSAGE _PAGENO +END +NUMERO 4 40 +BEGIN +KEY "Intestazione stampa" +PROMPT 55 2 "Stampa riepilogo SE" +END +END +SECTION BODY ODD 2 COLUMNWISE +STRINGA 1 50 +BEGIN +SPECIAL STRINGA INTESTAZIONE "Ragione sociale" "Ragione sociale" +SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" +SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" +KEY "RAGSOC GIURIDICHE" +PROMPT 1 1 "" +FIELD 216@->RAGSOC +END +STRING 2 5 +BEGIN +SPECIAL STRINGA INTESTAZIONE "Caus." "Caus." +SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" +SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" +KEY "CAUSALE" +PROMPT 2 1 "" +FIELD CAUSALE +END +NUMBER 3 14 +BEGIN +SPECIAL STRINGA INTESTAZIONE "@CTotale" "Totale" +SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" +SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" +KEY "TOTALE" +PROMPT 3 1 "" +FIELD TOTALE +PICTURE "###.###.###^^^" +END +NUMBER 4 14 +BEGIN +SPECIAL STRINGA INTESTAZIONE "Spes. Ant." "Spes. Ant." +SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" +SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" +KEY "SPESE ANTICIPATE" +PROMPT 4 1 "" +FIELD SPESEANT +PICTURE "###.###.###^^^" +END +NUMBER 5 14 +BEGIN +SPECIAL STRINGA INTESTAZIONE "Quaota Provv." "quaota Provv." +SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" +SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" +KEY "QUOTA PROVVIGIONI" +PROMPT 5 1 "" +FIELD QUOTAPRO +PICTURE "###.###.###^^^" +END +NUMBER 6 14 +BEGIN +SPECIAL STRINGA INTESTAZIONE "@CImponibile" "Imponibile" +SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" +SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" +KEY "IMPONIBILE" +PROMPT 6 1 "" +FIELD IMPONIBILE +PICTURE "###.###.###^^^" +END +NUMBER 7 14 +BEGIN +SPECIAL STRINGA INTESTAZIONE "Rit. Op." "Rit. Op." +SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" +SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" +KEY "RITENUTE OPERATE" +PROMPT 7 1 "" +FIELD IMPORTO +PICTURE "###.###.###^^^" +END +END diff --git a/m770/77srsf.frm b/m770/77srsf.frm index 356694823..8e1f4c519 100755 --- a/m770/77srsf.frm +++ b/m770/77srsf.frm @@ -1,141 +1,120 @@ -USE 62 -JOIN 9 INTO CODDITTA=CODDITTA -JOIN 6 TO 9 ALIAS 206 INTO TIPOA=TIPOA CODANAGR=CODANAGR -JOIN 6 ALIAS 216 INTO TIPOA=TIPOA CODANAGR=CODANAGR -JOIN 8 TO 216@ ALIAS 218 INTO CODANAGR=CODANAGR +USE 64 +JOIN 9 INTO CODDITTA=CODDITTA +JOIN 6 TO 9 ALIAS 106 INTO TIPOA=TIPOA CODANAGR=CODANAGR +JOIN 6 ALIAS 216 INTO TIPOA=TIPOA CODANAGR=CODANAGR +JOIN 8 TO 216@ ALIAS 218 INTO CODANAGR=CODANAGR JOIN 13 TO 218@ ALIAS 313 INTO STATO=="" COM==COMNASC JOIN 13 TO 216@ ALIAS 413 INTO STATO==STATORES COM==COMRES JOIN 13 TO 216@ ALIAS 513 INTO STATO=="" COM==COMRF -JOIN %STA TO 216@ ALIAS 104 INTO CODTAB=STATORES END - DESCRIPTION BEGIN - 62->* "Quadro D 770" - 9->* "Ditte" - 6->* "Anagrafica persone fisiche e giuridiche" - 8->* "Anagrafica persone fisiche" - 206@->* "Anagrafica persone fisiche e giuridiche" - 216@->* "Anagrafica persone fisiche e giuridiche" - 218@->* "Anagrafica persone fisiche" - 313@->* "Comune nascita" - 413@->* "Comune residenza" - 513@->* "Comune residenza fiscale" +64->* "Quadro E 770" +9->* "Ditte" +6->* "Anagrafica persone fisiche e giuridiche" +8->* "Anagrafica persone fisiche" +216@->* "Anagrafica persone fisiche e giuridiche" +218@->* "Anagrafica persone fisiche" +313@->* "Comune nascita" +413@->* "Comune residenza" END - GENERAL BEGIN - OFFSET 0 0 +OFFSET 0 0 END - - SECTION HEADER ODD 6 - STRINGA 1 40 1 BEGIN - KEY "nome ditta" - PROMPT 1 1 "Ditta: " - FIELD 9->RAGSOC +KEY "nome ditta" +PROMPT 1 1 "Ditta: " +FIELD 9->RAGSOC END - STRINGA 2 10 BEGIN - KEY "Data" - PROMPT 106 1 "Data " - MESSAGE _TODAY +KEY "Data" +PROMPT 106 1 "Data " +MESSAGE _TODAY END - NUMERO 3 7 BEGIN - KEY "Nr. pagina" - PROMPT 122 1 "Pagina " - MESSAGE _PAGENO +KEY "Nr. pagina" +PROMPT 122 1 "Pagina " +MESSAGE _PAGENO END - NUMERO 4 40 BEGIN - KEY "Intestazione stampa" - PROMPT 55 2 "Stampa riepilogo SF" +KEY "Intestazione stampa" +PROMPT 55 2 "Stampa riepilogo SF" END - END - -SECTION BODY ODD 2 COLUMWISE - +SECTION BODY ODD 2 COLUMNWISE STRINGA 1 50 BEGIN - SPECIAL STRINGA INTESTAZIONE "Ragione Sociale" "Ragione Sociale" - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "RAGSOC GIURIDICHE" - PROMPT 1 1 "" - FIELD 216@->RAGSOC +SPECIAL STRINGA INTESTAZIONE "@CRagione Sociale" "Ragione Sociale" +SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" +SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" +KEY "RAGSOC GIURIDICHE" +PROMPT 1 1 "" +FIELD 216@->RAGSOC +GROUP 2 END - -STRINGA 2 15 +STRING 2 5 BEGIN - SPECIAL STRINGA INTESTAZIONE "@cCausale" "Causale" - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "CAUSALE" - PROMPT 2 1 "" - FIELD CAUSALE +SPECIAL STRINGA INTESTAZIONE "Caus." "Caus." +SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" +SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" +KEY "CAUSALE" +PROMPT 2 1 "" +FIELD CAUSALE END - NUMBER 3 14 BEGIN - SPECIAL STRINGA INTESTAZIONE "@cTotale" "Tot." - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "TOTALE" - PROMPT 3 1 "" - FIELD TOTALE - PICTURE "###.###.###^^^" -END - -VALUTA 4 15 -BEGIN - SPECIAL STRINGA INTESTAZIONE "Somme non sogg." "Somme non sogg." - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "SOMME NON SOGGETTE A RITENUTA" - PROMPT 4 1 "" - FIELD SOMME - PICTURE "###.###.###^^^" -END - -VALUTA 5 15 -BEGIN - SPECIAL STRINGA INTESTAZIONE "Som. Reg. Conv." "Som. Reg. Conv" - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "SOMREGCONV" - PROMPT 5 1 "" - FIELD SOMREGCONV - PICTURE "###.###.###^^^" -END - -VALUTA 6 14 -BEGIN - SPECIAL STRINGA INTESTAZIONE "@cImponibile" "Imponibile" + SPECIAL STRINGA INTESTAZIONE "@CImponibile" "Imponibile" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" KEY "IMPONIBILE" - PROMPT 6 1 "" - FIELD IMPONIBILE + PROMPT 3 1 "" + FIELD IMPONIBILE PICTURE "###.###.###^^^" END - -VALUTA 7 14 +NUMBER 4 14 BEGIN - SPECIAL STRINGA INTESTAZIONE "@cImporto" "Importo" + SPECIAL STRINGA INTESTAZIONE "@CAliquota" "Aliquota" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "ALIQUOTA" + PROMPT 4 1 "" + FIELD PERC + PICTURE "##@,@@" +END +NUMBER 5 14 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@CImporto" "Importo" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" KEY "IMPORTO" - PROMPT 7 1 "" - FIELD IMPORTO - PICTURE "###.###.###^^^" + PROMPT 5 1 "" + FIELD IMPORTO + PICTURE "###.###.###^^^" +END +NUMBER 6 14 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@CNetto" "Netto" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "NETTO" + PROMPT 6 1 "" + FIELD NETTO + PICTURE "###.###.###^^^" +END +NUMBER 7 14 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@CSomme" "Somme" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "SOMME" + PROMPT 7 1 "" + FIELD SOMME + PICTURE "###.###.###^^^" END - END - diff --git a/m770/77srsg.frm b/m770/77srsg.frm index 82a834190..e12856f45 100755 --- a/m770/77srsg.frm +++ b/m770/77srsg.frm @@ -1,153 +1,164 @@ -USE 120 -JOIN 9 INTO CODDITTA=CODDITTA -JOIN 6 TO 9 ALIAS 106 INTO TIPOA=TIPOA CODANAGR=CODANAGR -JOIN 6 ALIAS 216 INTO TIPOA=TIPOA CODANAGR=CODANAGR -JOIN 8 TO 216@ ALIAS 218 INTO CODANAGR=CODANAGR -JOIN 13 TO 218@ ALIAS 313 INTO STATO=="" COM==COMNASC -JOIN 13 TO 216@ ALIAS 413 INTO STATO==STATORES COM==COMRES -JOIN 13 TO 216@ ALIAS 513 INTO STATO=="" COM==COMRF -JOIN %STA TO 216@ ALIAS 104 INTO CODTAB=STATORES +USE 65 +JOIN 9 INTO CODDITTA=CODDITTA +JOIN 6 TO 9 ALIAS 106 INTO TIPOA=TIPOA CODANAGR=CODANAGR +JOIN 6 ALIAS 216 INTO TIPOA=TIPOA CODANAGR=CODANAGR +JOIN 8 TO 216@ ALIAS 218 INTO CODANAGR=CODANAGR +JOIN 13 TO 218@ ALIAS 313 INTO STATO=="" COM==COMNASC +JOIN 13 TO 216@ ALIAS 413 INTO STATO==STATORES COM==COMRES +JOIN 13 TO 216@ ALIAS 513 INTO STATO=="" COM==COMRF +JOIN 89 ALIAS 189 INTO CODDITTA==CODDITTA CODCAUS=="C" +JOIN 89 ALIAS 289 INTO CODDITTA==CODDITTA CODCAUS=="D" END - DESCRIPTION BEGIN - 120->* "Quadro D bis 770" - 9->* "Ditte" - 6->* "Anagrafica persone fisiche e giuridiche" - 8->* "Anagrafica persone fisiche" - 216@->* "Anagrafica persone fisiche e giuridiche" - 218@->* "Anagrafica persone fisiche (percipiente)" - 313@->* "Comune nascita" - 413@->* "Comune residenza" - 513@->* "Comune residenza fiscale" +65->* "Quadro E1 770" +9->* "Ditte" +6->* "Anagrafica persone fisiche e giuridiche" +8->* "Anagrafica persone fisiche" +216@->* "Anagrafica persone fisiche e giuridiche" +218@->* "Anagrafica persone fisiche" +313@->* "Comune nascita" +413@->* "Comune residenza" +189->* "Riga 1 del prospetto e1" +289->* "Riga 2 del prospetto e1" END - GENERAL BEGIN - OFFSET 0 0 +OFFSET 0 0 END - SECTION HEADER ODD 6 - STRINGA 1 40 1 BEGIN - KEY "nome ditta" - PROMPT 1 1 "Ditta: " - FIELD 9->RAGSOC +KEY "nome ditta" +PROMPT 1 1 "Ditta: " +FIELD 9->RAGSOC END - STRINGA 2 10 BEGIN - KEY "Data" - PROMPT 106 1 "Data " - MESSAGE _TODAY +KEY "Data" +PROMPT 106 1 "Data " +MESSAGE _TODAY END - NUMERO 3 7 BEGIN - KEY "Nr. pagina" - PROMPT 122 1 "Pagina " - MESSAGE _PAGENO +KEY "Nr. pagina" +PROMPT 122 1 "Pagina " +MESSAGE _PAGENO END - NUMERO 4 40 BEGIN - KEY "Intestazione stampa" - PROMPT 55 2 "Stampa riepilogo SG" +KEY "Intestazione stampa" +PROMPT 55 2 "Stampa riepilogo SG" END - END - SECTION BODY ODD 2 COLUMNWISE - STRINGA 1 50 BEGIN - SPECIAL STRINGA INTESTAZIONE "Ragione Sociale" "Ragione Sociale" + SPECIAL STRINGA INTESTAZIONE "@CRagione Sociale" "Ragione Sociale" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" KEY "RAGSOC GIURIDICHE" PROMPT 1 1 "" FIELD 216@->RAGSOC GROUP 2 END - -STRINGA 2 5 +STRING 2 5 BEGIN - SPECIAL STRINGA INTESTAZIONE "Caus." "Caus." + SPECIAL STRINGA INTESTAZIONE "@cCaus." "Caus." SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" KEY "CAUSALE" PROMPT 2 1 "" FIELD CAUSALE END - -VALUTA 3 14 +NUMBER 3 14 BEGIN - SPECIAL STRINGA INTESTAZIONE "@CTotale" "Totale" + SPECIAL STRINGA INTESTAZIONE "@CSomme" "Somme" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "TOTALE" + KEY "Somme" PROMPT 3 1 "" - FIELD TOTALE + FIELD SOMME PICTURE "###.###.###^^^" END - -VALUTA 4 14 +NUMBER 4 14 BEGIN - SPECIAL STRINGA INTESTAZIONE "Somm. non sogg. iva" "Somm. non sogg. iva" + SPECIAL STRINGA INTESTAZIONE "@CAmmontare" "Ammontare" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "SOMME NON SOGGETTE A RITENUTA" + KEY "Ammontare" PROMPT 4 1 "" - FIELD SOMME + FIELD AMMONTARE PICTURE "###.###.###^^^" END - -VALUTA 5 14 +NUMBER 5 14 BEGIN - SPECIAL STRINGA INTESTAZIONE "Somm. reg. conv." "Som. reg.conv." + SPECIAL STRINGA INTESTAZIONE "@cAliquota" "Aliquota" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "SOMREGCONV" + KEY "ALIQUOTA" PROMPT 5 1 "" - FIELD SOMREGCONV - PICTURE "###.###.###^^^" + FIELD PERC + PICTURE "##@,@@" END - -VALUTA 6 14 -BEGIN - SPECIAL STRINGA INTESTAZIONE "@CImponibile" "Imponibile" - SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" - SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "IMPONIBILE" - PROMPT 6 1 "" - FIELD IMPONIBILE - PICTURE "###.###.###^^^" -END - -VALUTA 7 14 +NUMBER 6 14 BEGIN SPECIAL STRINGA INTESTAZIONE "@CImporto" "Importo" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "IMPORTO" - PROMPT 7 1 "" - FIELD IMPORTO - PICTURE "###.###.###^^^" + KEY "Importo" + PROMPT 6 1 "" + FIELD IMPORTO + PICTURE "###.###.###^^^" END - -VALUTA 8 14 +NUMBER 7 14 BEGIN - SPECIAL STRINGA INTESTAZIONE "Contributo 10%" "Contributo 10%" + SPECIAL STRINGA INTESTAZIONE "@CNetto" "Netto" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - KEY "Contributo del 10%" - PROMPT 8 1 "" - FIELD CONTR10 + KEY "Netto" + PROMPT 7 1 "" + FIELD NETTO + PICTURE "###.###.###^^^" +END +NUMERO 8 14 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@CAmm. Compl." "Amm. Compl." + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "AMMONTARE COMPLESSIVO" + PROMPT 8 1 "" + FIELD 189@->COMPENSO + PICTURE "###.###.###^^^" +END +NUMERO 9 14 +BEGIN + SPECIAL STRINGA INTESTAZIONE "Imponibile" "Imponibile" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "IMPONIBILE" + PROMPT 9 1 "" + FIELD 189@->IMPONIBILE + PICTURE "###.###.###^^^" +END +NUMERO 10 14 +BEGIN + SPECIAL STRINGA INTESTAZIONE "Rit. Op." "Rit. Op." + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "RITENUTE OPERATE" + PROMPT 10 1 "" + FIELD 189@->RITENUTA + PICTURE "###.###.###^^^" +END +NUMERO 11 14 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cCompenso" "Compenso" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "AMMONTARE COMPLESSIVO" + PROMPT 11 1 "" + FIELD 289@->COMPENSO + PICTURE "###.###.###^^^" END - END - - - - diff --git a/m770/77srst.frm b/m770/77srst.frm new file mode 100755 index 000000000..67fb16e4d --- /dev/null +++ b/m770/77srst.frm @@ -0,0 +1,198 @@ +USE 42 +JOIN 9 INTO CODDITTA=CODDITTA +JOIN 6 TO 9 ALIAS 106 INTO TIPOA=TIPOA CODANAGR=CODANAGR +END + +DESCRIPTION +BEGIN + 42->* "Quadro L" + 9->* "Anagrafica ditte" +END + +GENERAL +BEGIN + OFFSET 0 0 +END + +SECTION HEADER ODD 6 + +STRINGA 1 40 1 +BEGIN + KEY "nome ditta" + PROMPT 1 1 "Ditta: " + FIELD 9->RAGSOC +END + +STRINGA 2 10 +BEGIN + KEY "Data" + PROMPT 106 1 "Data " + MESSAGE _TODAY +END + +NUMERO 3 7 +BEGIN + KEY "Nr. pagina" + PROMPT 122 1 "Pagina " + MESSAGE _PAGENO +END + +NUMERO 4 40 +BEGIN + KEY "Intestazione stampa" + PROMPT 55 2 "Stampa riepilogo ST" +END + +END + +SECTION BODY ODD 2 COLUMNWISE + +DATA 1 12 +BEGIN + KEY "Data versamento" + SPECIAL STRINGA INTESTAZIONE "@cData ver." "Data ver." + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + PROMPT 1 1 "" + FIELD 42->QLDV +END + +LISTA 2 10 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cMese rif." "Mese rif." + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Mese rif." + PROMPT 2 1 "" + FIELD 42->QLMP + ITEM " | " + ITEM "1|Gennaio" + ITEM "2|Febbraio" + ITEM "3|Marzo" + ITEM "4|Aprile" + ITEM "5|Maggio" + ITEM "6|Giugno" + ITEM "7|Luglio" + ITEM "8|Agosto" + ITEM "9|Settembre" + ITEM "10|Ottobre" + ITEM "11|Novembre" + ITEM "12|Dicembre" +END + +LISTA 3 11 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cLuogo ver." "Luogo ver." + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Luogo Versamento" + PROMPT 3 1 "" + FIELD 42->QLLV + ITEM " | " + ITEM "C|F24" + ITEM "T|Tesoreria" +END + +LISTA 4 14 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cTipo ver." "Tipo ver." + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Tipo versamento" + PROMPT 4 1 "" + FIELD 42->QLTV + ITEM " | " + ITEM "B|Del. bancaria" + ITEM "C|C/C postale" + ITEM "D|Distinta" +END + +NUMERO 5 7 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cCod. T." "Cod. T." + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Codice tributo" + PROMPT 5 1 "" + FIELD 42->QLCT +END + +NUMERO 6 9 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cArt. Bil." "Art. Bil." + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Articolo di bilancio" + PROMPT 6 1 "" + FIELD 42->QLAB +END + +STRINGA 7 7 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cCod. q." "Cod. q." + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Codice quadro" + PROMPT 7 1 "" + FIELD 42->QLCODQUA +END + +STRINGA 8 5 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cSerie" "Serie" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "SERIE" + PROMPT 8 1 "" + FIELD 42->QLSERIE +END + +NUMERO 9 15 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cRit. effettuate" "Rit. effettuate" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Ritenute effettuate" + PROMPT 9 1 "" + FIELD 42->QLRITEFF + PICTURE "###.###.###.###^^^" +END + +NUMERO 10 15 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cImp. Versato" "Imp. Versato" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Importo versato" + PROMPT 10 1 "" + FIELD 42->QLRITVER + PICTURE "###.###.###.###^^^" +END + +LISTA 11 3 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cRSS" "RSS" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "RSS" + PROMPT 11 1 "" + ITEM " | " + ITEM "1|VA" + ITEM "2|SA" + ITEM "3|SI" + FIELD 42->QLRSS +END + +STRINGA 12 7 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@cNote" "Note" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Note" + PROMPT 12 1 "" + FIELD 42->QLNOTE +END + +END + + diff --git a/m770/batbca7.uml b/m770/batbca7.uml index 655df0a8b..2a1a93d3d 100755 --- a/m770/batbca7.uml +++ b/m770/batbca7.uml @@ -51,15 +51,13 @@ LIST F_QUADRCE2 2 BEGIN PROMPT 1 3 "Codice quadro " HELP "Inserire il codice quadro" - ITEM "C|C" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|DISABLE,F_IC|RESET,GR_NOCAUC@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSC|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "D|D" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|ENABLE,TCF_PERCASSPREV|RESET,GR_NOCAUD@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSD|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "D1|D1" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_NOCAUD1@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSD1|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "E|E" + ITEM "SC|SC" + MESSAGE ENABLE,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|ENABLE,TCF_PERCASSPREV|RESET,GR_NOCAUD@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSD|SHOW,F_DESCR1|HIDE,F_DESCR2 + ITEM "SE|SE" + MESSAGE ENABLE,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_NOCAUD1@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSD1|SHOW,F_DESCR1|HIDE,F_DESCR2 + ITEM "SF|SF" MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_NOCAUE@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSE|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "E1|E1" + ITEM "SG|SG" MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_NOCAUE1@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSE1|SHOW,F_DESCR1|HIDE,F_DESCR2 MESSAGE COPY,F_CODQUA WARNING "Manca il codice quadro" @@ -70,44 +68,14 @@ LIST F_QUADRAT 2 BEGIN PROMPT 1 3 "Codice quadro " HELP "Inserire il codice quadro" - ITEM "A|A" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "AB|AB" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "A1|A1" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "A2|A2" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "A3|A3" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "B|B" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "B1|B1" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "C|C" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,GR_NOCAUC@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSC|ENABLE,F_IC|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "D|D" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|ENABLE,TCF_PERCASSPREV|RESET,GR_NOCAUD@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSD|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "DB|DB" - MESSAGE ENABLE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_NOCAUDB@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSDB|DISABLE,TCF_CAUSD|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "D1|D1" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_NOCAUD1@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSD1|DISABLE,TCF_CAUSD|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "E|E" + ITEM "SC|SC" + MESSAGE ENABLE,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|ENABLE,TCF_PERCASSPREV|RESET,GR_NOCAUD@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSD|SHOW,F_DESCR1|HIDE,F_DESCR2 + ITEM "SE|SE" + MESSAGE ENABLE,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_NOCAUD1@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSD1|DISABLE,TCF_CAUSD|SHOW,F_DESCR1|HIDE,F_DESCR2 + ITEM "SF|SF" MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_NOCAUE@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSE|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "E1|E1" + ITEM "SG|SG" MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_NOCAUE1@|DISABLE,GR_CAUDD1@|ENABLE,TCF_CAUSE1|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "E2|E2" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|HIDE,F_DESCR1|SHOW,F_DESCR2 - ITEM "F|F" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "F1|F1" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "F2|F2" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|HIDE,F_DESCR1|SHOW,F_DESCR2 - ITEM "G|G" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|SHOW,F_DESCR1|HIDE,F_DESCR2 - ITEM "G1|G1" - MESSAGE CLEAR,TCF_BINPS|K_SPACE,TCF_BINPS|RESET,G_ICTS@|DISABLE,G_ICTS@|RESET,TCF_PERCASSPREV|DISABLE,TCF_PERCASSPREV|RESET,GR_CAUDD1@|DISABLE,GR_CAUDD1@|SHOW,F_DESCR1|HIDE,F_DESCR2 MESSAGE COPY,F_QUADRCE2 MESSAGE COPY,F_CODQUA WARNING "Manca il codice quadro" @@ -117,25 +85,11 @@ END LIST F_CODQUA 2 BEGIN PROMPT 1 3 "" - ITEM "A|A" - ITEM "AB|AB" - ITEM "A1|A1" - ITEM "A2|A2" - ITEM "A3|A3" - ITEM "B|B" - ITEM "B1|B1" - ITEM "C|C" - ITEM "D|D" - ITEM "DB|DB" - ITEM "D1|D1" - ITEM "E|E" - ITEM "E1|E1" - ITEM "E2|E2" - ITEM "F|F" - ITEM "F1|F1" - ITEM "F2|F2" - ITEM "G|G" - ITEM "G1|G1" + ITEM "SC|SC" + ITEM "SE|SE" + ITEM "SF|SF" + ITEM "SG|SG" + ITEM "ST|ST" FLAGS "H" FIELD LF_TABCOM->S1 END @@ -160,63 +114,30 @@ BEGIN MESSAGE COPY,F_DESCR1,1,22 END -STRING TCF_CAUSC 1 -BEGIN - PROMPT 1 5 "Causale C " - SHEET "Codice|Descrizione@60" - INPUT TCF_CAUSC - ITEM " | " - ITEM "A|indenn. e compensi erogati ai prest. lavoro dipendente....." - ITEM "B|somme corrisp. a titolo di borsa di studio o di assegno...." - ITEM "C|indenn., gett. di pres. altri comp. corrisp. dallo Stato..." - ITEM "D|indenn., percep. per cariche elettive di cui all'art. 114.." - ITEM "E|rendite vital. e rendite a tempo determ., a tit. oneroso..." - ITEM "F|prestaz. comunque erogate in forma di trattam. periodico..." - ITEM "G|ass. period. alla cui prod. concor. né capitale né lavoro.." - ITEM "H|compensi corrisp. ai lav. imp. in lavori socialm. utili...." - OUTPUT TCF_CAUSC - OUTPUT TCF_CAUSC_DESCR - FIELD LF_TABCOM->S6 - FLAGS "D" - GROUP GR_CAUDD1 - GROUP GR_NOCAUD - GROUP GR_NOCAUDB - GROUP GR_NOCAUD1 - GROUP GR_NOCAUE - GROUP GR_NOCAUE1 -END - -STRING TCF_CAUSC_DESCR 60 -BEGIN - PROMPT 16 5 "" - FLAGS "D" - GROUP GR_CAUDD1 - GROUP GR_NOCAUD - GROUP GR_NOCAUDB - GROUP GR_NOCAUD1 - GROUP GR_NOCAUE - GROUP GR_NOCAUE1 -END - STRING TCF_CAUSD 1 BEGIN - PROMPT 1 6 "Causale D " - SHEET "Codice|Descrizione@60" + PROMPT 1 6 "Causale SC " + SHEET "Codice|Descrizione@250" INPUT TCF_CAUSD ITEM " | " - ITEM "A|prestaz. di lav. auton. nell'eserc. di arti o prof. abit..." - ITEM "B|utiliz. econom., da parte dell'autore o dell'inventore,...." - ITEM "C|a titolo di utili deriv. da contrat. di ass. in partecip..." - ITEM "D|a titolo di utili spett. ai soci prom. ed ai soci fondat..." - ITEM "E|per la levata di protesti cambiari da parte dei segr. com.." - ITEM "F|utiliz. econom., da parte di sogg. diverso dall'autore o..." - ITEM "G|indenn. corrisp. per la cessaz. dei rapporti di agenzia...." - ITEM "H|indenn. corrisp. per la cessaz. da funzioni notarili" - ITEM "I|indenn. di trasf. o di rimb. forfet. di spese spettanti...." - ITEM "L|prestaz. di lavoro autonomo non esercitate abitualmente" - ITEM "M|prestaz. rese dagli sportivi con contratto di lav. autonomo" - ITEM "N|indenn. corrisp. per la cessaz. di attività sportiva prof.." - ITEM "T|altro titolo diverso dai precedenti" + ITEM "A|per prestazioni di lavoro autonomo rientranti nell'esercizio di arte o professione abituale" + ITEM "B|per prestazioni rese da amministratori, sindaci e revisori di societá, associazione ed altri enti con o senza personalitá giuridica" + ITEM "C|per prestazioni rese da collaboratori a giornali, riviste, enciclopedie e simili (che non costituiscono diritti d'autore)" + ITEM "D|per prestazioni rese da partecipanti a collegi e commissioni" + ITEM "E|per prestazioni rese nell'ambito di rapporti di collaborazione coordinata e continuativa diversi da quelli sopra elencati" + ITEM "F|per indennitá corrisposte per la cessazione di rapporti di collaborazione coordinata e continuativa, assoggettabili a tassazione separata" + ITEM "G|per l'utilizzazione economica, da parte dell'autore o dell'inventore, di opere dell'ingegno, di brevetti industriali e di processi, formule o informazioni relativi ad esperienze acquisite in campo industriale, commerciale o scientifico" + ITEM "H|a titolo di utili derivanti da contratti di associazione in partecipazione e da contratti di cointeressenza, quando l'apporto é costituito esclusivamente dalla prestazione di lavoro" + ITEM "I|a titolo di utili spettanti ai soci promotori ed ai soci fondatori delle societá di capitali" + ITEM "K|per la levata di protesti cambiari da parte di segretari comunali" + ITEM "L|per prestazioni rese dagli sportivi con contratto di lavoro autonomo" + ITEM "M|a titolo di indennitá corrisposte per la cessazione di attivitá sportiva professionale" + ITEM "N|a titolo di indennitá corrisposte per la cessazione dei rapporti di agenzia delle persone fisiche" + ITEM "P|a titolo di indennitá corrisposte per la cessazione da funzioni notarili" + ITEM "Q|per l'utilizzazione economica, da parte di soggetto diverso dall'autore o dall'inventore, di opere dell'ingegno, di brevetti industriali e di processi, formule e informazioni relativi ad esperienze acquisite in campo indust., commer. o scient." + ITEM "R|per prestazioni di lavoro autonomo non esercitate abitualmente" + ITEM "S|a titolo di indennitá di trasferta o di rimborso forfetario di spese spettanti a soggetti che svolgono attivitá sportiva dilettantistica di cui alla L n. 80 del 1986" + ITEM "T|per altro titolo diverso dai precedenti" OUTPUT TCF_CAUSD OUTPUT TCF_CAUSD_DESCR FIELD LF_TABCOM->S2 @@ -229,7 +150,7 @@ BEGIN GROUP GR_NOCAUE1 END -STRING TCF_CAUSD_DESCR 60 +STRING TCF_CAUSD_DESCR 250 60 BEGIN PROMPT 16 6 "" FLAGS "D" @@ -241,55 +162,20 @@ BEGIN GROUP GR_NOCAUE1 END -STRING TCF_CAUSDB 1 -BEGIN - PROMPT 1 7 "Causale DB " - SHEET "Codice|Descrizione@60" - INPUT TCF_CAUSDB - ITEM " | " - ITEM "A|prestaz. di lav. auton. ..... iscritti in albi senza cassa" - ITEM "B|prestaz. rese da amministrat., sindaci e revis. di soc....." - ITEM "C|prestaz. rese da collab. a giornali, riviste, enciclop....." - ITEM "D|prestaz. rese da partecipanti a collegi e commissioni" - ITEM "E|prestaz. di collab. coord. e contin. diversi da quelli....." - ITEM "F|indenn. corrisp. per la cessaz. di rapp.. ass. a tass. sep." - ITEM "G|provvigioni degli incaricati per le vendite a domicilio" - ITEM "T|altro titolo diverso dai precedenti" - OUTPUT TCF_CAUSDB - OUTPUT TCF_CAUSDB_DESCR - FIELD LF_TABCOM->S7 - FLAGS "D" - GROUP GR_CAUDD1 - GROUP GR_NOCAUC - GROUP GR_NOCAUD - GROUP GR_NOCAUD1 - GROUP GR_NOCAUE - GROUP GR_NOCAUE1 -END - -STRING TCF_CAUSDB_DESCR 60 -BEGIN - PROMPT 16 7 "" - FLAGS "D" - GROUP GR_CAUDD1 - GROUP GR_NOCAUC - GROUP GR_NOCAUD - GROUP GR_NOCAUD1 - GROUP GR_NOCAUE - GROUP GR_NOCAUE1 -END - STRING TCF_CAUSD1 1 BEGIN - PROMPT 1 8 "Causale D1 " - SHEET "Codice|Descrizione@60" + PROMPT 1 8 "Causale SE " + SHEET "Codice|Descrizione@250" INPUT TCF_CAUSD1 ITEM " | " - ITEM "A|Agente o rappresentante di commercio monomandatario" - ITEM "B|Agente o rappresentate plurimandatario" - ITEM "C|Commissionario" - ITEM "D|Mediatore" - ITEM "E|Procacciatore d'affari" + ITEM "A|agente o rappresentante di commercio monomandatario" + ITEM "B|agente o rappresentante plurimandatario" + ITEM "C|commissionario" + ITEM "D|mediatore" + ITEM "E|procacciatore di affari" + ITEM "F|incaricato per le vendite a domicilio" + ITEM "G|incaricato per la vendita porta a porta e per la vendita ambulante di giornali quotidiani e periodici (L.25 febbraio 1987, n.67)" + ITEM "T|altro soggetto diverso dai precedenti" OUTPUT TCF_CAUSD1 OUTPUT TCF_CAUSD1_DESCR FIELD LF_TABCOM->S3 @@ -302,7 +188,7 @@ BEGIN GROUP GR_NOCAUE1 END -STRING TCF_CAUSD1_DESCR 60 +STRING TCF_CAUSD1_DESCR 250 60 BEGIN PROMPT 16 8 "" FLAGS "D" @@ -316,15 +202,27 @@ END STRING TCF_CAUSE 1 BEGIN - PROMPT 1 9 "Causale E " - SHEET "Codice|Descrizione@60" + PROMPT 1 9 "Causale SF " + SHEET "Codice|Descrizione@250" INPUT TCF_CAUSE ITEM " | " - ITEM "A|redditi di capitale corrisp. a sogg. resid. non eserc......" - ITEM "B|prov. corrisp. a stabili organiz. estere di impr. resid...." - ITEM "C|comp. per avviamento commerc. assogg. alla rit. a tit. acc." - ITEM "D|contrib. degli enti pubbl. e premi corrisp. dall'Unione...." - ITEM "E|interessi, premi e altri frutti dei tit. obbligaz. emessi.." + ITEM "A|redditi di capitale corrisposti a soggetti residenti non esercenti attivitá d'impresa comerciale, assoggettati alla ritenuta a titolo d'acconto di cui all'art.26, ultimo comma del D.P.R. n.600 del 1973" + ITEM "B|proventi corrisposti a stabili organizzazioni estere di imprese residenti, non appartenenti all'impresa erogante, assoggettabili alla ritenuta d'acconto nella misura del 12,50 o del 27 per cento (art.26,ultimo comma,del D.P.R.600 del 1973)" + ITEM "C|compensi per avviamento commerciale assoggettati alla ritenuta a titolo di acconto di cui all'art.28, primo comma, del D.P.R. n.600 del 1973" + ITEM "D|contributi degli enti pubblici e privati e premi corrisposti dall'Unione nazionale incremento razze equine (UNIRE) e dalla Federazione italiana sport equestri (FISE), assoggettati alla rit. d'acc. di cui all'art.28,secondo comma,DPR600 del 1973" + ITEM "E|proventi di cui all'art.41, comma 1, lettere g-bis e g-ter, del Tuir, assoggettati a ritenuta a titolo d'acconto o non assoggetati a ritenuta, percepiti da soggetti non esercenti attivitá d'impresa, ai sensi dell'art.26,comma3-bis,DPR600 del 1973" + ITEM "F|proventi di cui all'art.41, comma 1, lett. g-bis, del Tuir, divenuti esigibili dal 1 gennaio al 18 agosto 1999, per i quali non é stata resa l'opzione di cui all'art.2, comma 5, del D.Lgs. n.259 del 1999" + ITEM "G|proventi derivanti da mutui, depositi e conti correnti diversi da quelli bancari e postali, ad eccezione dei proventi derivanti da prestiti di denaro" + ITEM "H|interessi ed altri proventi derivanti da depositi e conti correnti bancari e postali" + ITEM "I|rendite perpetue e prestazioni annuali perpetue" + ITEM "L|prestazioni di fideiussioni e di ogni altra garanzia" + ITEM "M|proventi derivanti da operazioni di pronti contro termine e di riporto su titoli e valute" + ITEM "N|proventi derivanti da operazioni di mutuo di titoli garantito" + ITEM "P|certificati di deposito emessi da banche a decorrere dal 1 luglio 1998" + ITEM "Q|certificati di deposito e buoni fruttiferi emessi da banche fino al 30 giugno 1998 (art.6 della L. 26 aprile 1982, n.181; art.4 del D.M. 5 dicembre 1997, n.494" + ITEM "R|altri redditi di capitale, diversi da quelli individuati nei codici da G a Q, per i quali é stata applicata una aliquota ridotta o pari a zero in applicazione di accordi internazionali e di convenzioni bilaterali per evitare la doppia imposizione" + ITEM "S|somme corrisposte a soggetti residenti negli Stati esteri indicati nei D.M. del 04/09/1996, del 25/03/1998, del 16/12/1998 e del 10/06/1999, per i quali hanno trovato applicazioni le disposizioni dell'art.9, commi 1 e 4, del D.Lgs. n.461 del 1997" + ITEM "T|interessi ed altri proventi derivanti da finanziamenti effettuati da soggetti non residenti e raccolti dalla societá costituita ai sensi del'art.13 della L. 23 dicembre 1998, n.448, per la cartolarizzazione dei crediti INPS" OUTPUT TCF_CAUSE OUTPUT TCF_CAUSE_DESCR FIELD LF_TABCOM->S8 @@ -337,7 +235,7 @@ BEGIN GROUP GR_NOCAUE1 END -STRING TCF_CAUSE_DESCR 60 +STRING TCF_CAUSE_DESCR 250 60 BEGIN PROMPT 16 9 "" FLAGS "D" @@ -351,14 +249,15 @@ END STRING TCF_CAUSE1 1 BEGIN - PROMPT 1 10 "Causale E1 " - SHEET "Codice|Descrizione@60" + PROMPT 1 10 "Causale SG " + SHEET "Codice|Descrizione@250" INPUT TCF_CAUSE1 ITEM " | " - ITEM "A|somme deriv. dal riscatto di contratti di assic. sulla vita" - ITEM "B|capitali corrisp. in dipend... per i quali rit. del 12,50.." - ITEM "C|capitali corrisp. in dipend. di contr. di assic. sulla vita" - ITEM "D|capitali corrisp. in dipend. di contr. di capitalizzazione" + ITEM "A|somme derivanti dal riscatto di contratti di assicurazione sulla vita" + ITEM "B|capitali corrisposti in dipendenza di contratti di assicurazione sulla vita e contratti di capitalizzazione corrisposti a soggetti che esercitano attivitá commerciali per i quali la ritenuta del 12,50% si applica a titolo d'acconto" + ITEM "C|capitoli corrisposti in dipendenza di contratti di assicurazione sulla vita, ivi compresi i capitali corrisposti ai sensi del D.Lgs. 21/04/1993, n.124, e dell'art.1, comma 5, della L. 28 febbraio 1997, n.30" + ITEM "D|capitali corrisposti in dipendenza di contratti di capitalizzazione" + ITEM "E|rendite corrisposte per conto della assicurazione invaliditá, vecchiaia e superstiti Svizzera (AVS) assoggettate a ritenuta unica del 5% ai sensi dell'art.76 della L. 30 dicembre 1991, n.413" OUTPUT TCF_CAUSE1 OUTPUT TCF_CAUSE1_DESCR FIELD LF_TABCOM->S9 @@ -371,7 +270,7 @@ BEGIN GROUP GR_NOCAUE END -STRING TCF_CAUSE1_DESCR 60 +STRING TCF_CAUSE1_DESCR 250 60 BEGIN PROMPT 16 10 "" FLAGS "D" diff --git a/m770/f42.dir b/m770/f42.dir index 7d19fa4a8..cc2c5e798 100755 --- a/m770/f42.dir +++ b/m770/f42.dir @@ -1,3 +1,3 @@ 42 1 -m770/quadrol|0|0|91|4|Quadro L modello 770|#9|| +m770/quadrol|0|0|104|0|Quadro L modello 770|#9|| diff --git a/m770/f42.trr b/m770/f42.trr index a0406003b..a82f6cb3d 100755 --- a/m770/f42.trr +++ b/m770/f42.trr @@ -14,7 +14,7 @@ QLCODQUA|1|2|0| QLRITEFF|4|18|0| QLRITVER|4|18|0| QLRSS|1|2|0| -QLNOTE|1|7|0| +QLNOTE|1|20|0| 2 CODDITTA+QLAP+QLMP+QLDV+QLLV+QLTV+QLCT+QLAB+QLSERIE+QLNUMERO| CODDITTA+QLDV+QLAP+QLMP+QLLV+QLTV+QLCT+QLAB+QLSERIE+QLNUMERO| diff --git a/mg/f114.trr b/mg/f114.trr index 2a8df4a4f..4278e44a5 100755 --- a/mg/f114.trr +++ b/mg/f114.trr @@ -8,10 +8,10 @@ UM|1|2|0|Unita' di misura QUANT|4|15|5|Quantita' VALORE|4|18|3|Valore NRIGA|2|4|0|Numeratore sheet -ULTCOS1|4|15|5|Ulitmo costo alla chisura -ULTCOS2|4|15|5|Penultimo costo alla cgisura -COSTSTD|4|15|3|Costo standard alla chisura -COSTOMEDIO|4|15|5|Costo medio (VACQ/ACQ) alla chiusura +ULTCOS1|4|15|5|Ulitmo costo alla chiusura +ULTCOS2|4|15|5|Penultimo costo alla chiusura +COSTSTD|4|15|3|Costo standard alla chiusura +COSTOMEDIO|4|15|5|Costo medio (VACQ/ACQ) alla chiusura PRZLIST|4|15|3|Prezzo di listino alla chiusura CODLISTINO|1|3|0|Codice listino usato in chiusura CATVEN|1|3|0|Cat vendita del listino diff --git a/mg/mg1100.uml b/mg/mg1100.uml index a12a6bd9d..ff8418269 100755 --- a/mg/mg1100.uml +++ b/mg/mg1100.uml @@ -21,7 +21,7 @@ BEGIN KEY 1 3 4 USE LF_MOVMAG INPUT NUMREG F_NUMREG - DISPLAY "N.reg." NUMREG + DISPLAY "N.reg.@7" NUMREG DISPLAY "Anno" ANNOES DISPLAY "Data reg. @10" DATAREG DISPLAY "Data comp.@10" DATACOMP diff --git a/mg/mg1100a.uml b/mg/mg1100a.uml index fc983b0f7..268d018a1 100755 --- a/mg/mg1100a.uml +++ b/mg/mg1100a.uml @@ -148,7 +148,7 @@ END //Livelli giacenza STRING F_LIV1 10 BEGIN - PROMPT 2 8 "Livello 1 " + PROMPT 2 8 "Livello giacenza 1 " FLAGS "U" USE GCG JOIN FCG ALIAS ALIAS_FCG INTO CODTAB==CODTAB[1,1] @@ -167,7 +167,7 @@ END STRING F_LIV2 10 BEGIN FLAGS "U" - PROMPT 40 8 "Livello 2 " + PROMPT 40 8 "Livello giacenza 2 " // Non mettere FLAGS "D" perchè disabiliterebbe tutta la colonna COPY USE F_LIV1 INPUT CODTAB[1,1] "2" @@ -183,7 +183,7 @@ END STRING F_LIV3 10 BEGIN FLAGS "U" - PROMPT 2 9 "Livello 3 " + PROMPT 2 9 "Livello giacenza 3 " COPY USE F_LIV1 INPUT CODTAB[1,1] "3" INPUT CODTAB[2,12] F_LIV3 @@ -198,7 +198,7 @@ END STRING F_LIV4 10 BEGIN FLAGS "U" - PROMPT 40 9 "Livello 4 " + PROMPT 40 9 "Livello giacenza 4 " COPY USE F_LIV1 INPUT CODTAB[1,1] "4" INPUT CODTAB[2,12] F_LIV4 diff --git a/mg/mg1400.cpp b/mg/mg1400.cpp index 53fd32f83..9ca13f99f 100755 --- a/mg/mg1400.cpp +++ b/mg/mg1400.cpp @@ -212,8 +212,8 @@ public: bool TApp_openclose::create() { - TConfig c(CONFIG_DITTA); - _msk = new TMask_openclose(!c.get_bool("RIPORD")); + TConfig c(CONFIG_DITTA); + _msk = new TMask_openclose(!c.get_bool("RIPORD")); _anamag = new TLocalisamfile(LF_ANAMAG); _umart = new TLocalisamfile(LF_UMART); _mag = new TLocalisamfile(LF_MAG); @@ -266,7 +266,7 @@ void TApp_openclose::compila_movimento(TMov_mag& currmov, TArticolo_giacenza& ar case CAUS_A_QTA: // Movimentazione solo quantità case CAUS_A_VAL: // Movimentazione solo valore { - qta = rec.get_real(MAG_GIAC) + rec.get_real(MAG_ACL) - rec.get_real(MAG_INCL); // ??corretta da AcL, IncL e InProdF ?? + qta = rec.get_real(MAG_GIAC) + rec.get_real(MAG_ACL) - rec.get_real(MAG_INCL); // ??corretta da AcL, IncL e InProdF ?? if (!_valorizza_comp) qta += rec.get_real(MAG_PRODFIN)-rec.get_real(MAG_PRODCOMP); if (caus != CAUS_A_QTA) diff --git a/mg/mg3300.cpp b/mg/mg3300.cpp index bad108643..d23ee7446 100755 --- a/mg/mg3300.cpp +++ b/mg/mg3300.cpp @@ -17,6 +17,7 @@ class TForm_schedemag : public TForm_stampemg TString16 _anno_prec; bool _magazzino_chiuso; bool _sottocatmer; + bool _sudd_mag; TDate _data_inizio, _data_fine; TToken_string *_rmov_sortexp; @@ -159,12 +160,12 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s) return TRUE; } if (subcode=="DADATA") - { + { cf.set(_data_inizio.string()); return TRUE; } if (subcode=="ADATA") - { + { cf.set(_data_fine.string()); return TRUE; } @@ -237,10 +238,13 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s) } else // Stampa per magazzini { - TLocalisamfile& rmm = relation()->lfile(LF_RMOVMAG); + TSortedfile& rmm = (TSortedfile&)relation()->lfile(LF_RMOVMAG); const TRecnotype oldpos = rmm.recno(); TString80 old_art; - old_art << rmm.get(RMOVMAG_CODART); old_art << '|' << rmm.get(RMOVMAG_LIVGIAC); + old_art << rmm.get(RMOVMAG_CODART); + old_art << '|' << rmm.get(RMOVMAG_LIVGIAC); + old_art << '|' << rmm.get(RMOVMAG_CODMAG); + const int err = rmm.next(); if (err == NOERR) // Se non sono sull'ultimo record ... { @@ -254,7 +258,9 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s) { // Se la prossima data e' >= della corrente verifico se cambio articolo TString80 new_art; - new_art << rmm.get(RMOVMAG_CODART); new_art << '|' << rmm.get(RMOVMAG_LIVGIAC); + new_art << rmm.get(RMOVMAG_CODART); + new_art << '|' << rmm.get(RMOVMAG_LIVGIAC); + new_art << '|' << rmm.get(RMOVMAG_CODMAG); yes = old_art != new_art; } } @@ -269,17 +275,62 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s) if (!_magazzino_chiuso) // mag precedente non chiuso, mancano i saldi di apertura { TLocalisamfile mag_annoprec(LF_MAG); - mag_annoprec.curr() = cursor()->curr(LF_MAG); - mag_annoprec.put(MAG_ANNOES, _anno_prec); - if (mag_annoprec.read() == NOERR) // Ho trovato un saldo precedente + TString codmag, codart, livello; + + const bool stampa_perart = relation()->lfile().num() == LF_ANAMAG; + if (stampa_perart) // Stampa per articoli { - const real saldoprec = mag_annoprec.get_real(nomecampo_scheda()); - if (!saldoprec.is_zero()) + const TRectype& rmovmag = cursor()->curr(LF_RMOVMAG); // Record collegato a LF_ANAMAG + codmag = rmovmag.get(RMOVMAG_CODMAG); + codart = rmovmag.get(RMOVMAG_CODART); + livello = rmovmag.get(RMOVMAG_LIVGIAC); + } + else + { + // Nella stampa per magazzini al momento del saldo sono avanti di un passo rispetto a dove mi serve + if (cursor()->pos() > 0L) { - real currsaldo = cf.get(); - currsaldo += saldoprec; // Sommo il saldo precedente al campo corrente - cf.set(currsaldo.string()); + --(*cursor()); + const TRectype& rmovmag = cursor()->curr(LF_RMOVMAG); // Record principale + codmag = rmovmag.get(RMOVMAG_CODMAG); + codart = rmovmag.get(RMOVMAG_CODART); + livello = rmovmag.get(RMOVMAG_LIVGIAC); + ++(*cursor()); } + } + + mag_annoprec.put(MAG_ANNOES, _anno_prec); + mag_annoprec.put(MAG_CODMAG, codmag); + mag_annoprec.put(MAG_CODART, codart); + mag_annoprec.put(MAG_LIVELLO, livello); + if (_sudd_mag) // Se e' una stampa dettagliata per magazzino + { + mag_annoprec.setkey(2); + if (mag_annoprec.read() == NOERR) // Ho trovato un saldo precedente del magazzino in questione + { + const real saldoprec = mag_annoprec.get_real(nomecampo_scheda()); + if (!saldoprec.is_zero()) + { + real currsaldo = cf.get(); + currsaldo += saldoprec; // Sommo il saldo precedente al campo corrente + cf.set(currsaldo.string()); + } + } + } + else + { + // Calcolo la somma dei saldi di tutti i magazzini + mag_annoprec.setkey(1); + real currsaldo = cf.get(); + for (int r = 1; ; r++) + { + mag_annoprec.put(MAG_NRIGA, r); + if (mag_annoprec.read() != NOERR) + break; + const real saldoprec = mag_annoprec.get_real(nomecampo_scheda()); + currsaldo += saldoprec; // Sommo il saldo precedente al campo corrente + } + cf.set(currsaldo.string()); } } #ifdef DBG @@ -369,6 +420,8 @@ void TForm_schedemag::setdett_permag(bool sudd_dep,bool show_dett,int livart,int _tolivart=livart ? livart :livelli_articolo().last_level() ; _tolivgiac=livgiac ? livgiac :livelli_giacenza().last_level(); + + _sudd_mag = TRUE; // E' una stampa suddvisa per magazzini } @@ -464,6 +517,8 @@ void TForm_schedemag::setdett_perart(bool percatmer,bool sottocatmer,int livart, } // settaggio raggruppamenti codice sulla scheda ragg_exprs(livart,livgiac); + + _sudd_mag = sudd_mag; // E' una stampa suddvisa per magazzini? if (sudd_mag) { *_rmov_raggcond << "+CODMAG[1,3]"; @@ -552,9 +607,9 @@ TForm_schedemag::~TForm_schedemag() // mg3300 Stampa class TStampa_schede_mag : public TSkeleton_application { - TStampemg_mask * _mask; - TCursor * _cur; + static TStampemg_mask * _mask; // static so they are visible from filter function TForm_schedemag *_form; // to be moved into TPrint_application + TCursor * _cur; int _codicees; bool _raggmag; @@ -562,7 +617,7 @@ protected: virtual bool create(); virtual bool destroy(); virtual void main_loop(); - virtual void on_firm_change(); + static bool negatives_only(const TRelation* rel); void setprint_perarticoli(); void setprint_permagazzini(); @@ -575,11 +630,16 @@ public: TStampa_schede_mag() {} }; -void TStampa_schede_mag::on_firm_change() -{ - -} +TStampemg_mask* TStampa_schede_mag::_mask = NULL; +bool TStampa_schede_mag::negatives_only(const TRelation* rel) +{ + const TString codart = rel->curr(LF_ANAMAG).get(ANAMAG_CODART); + const int anno = _mask->get_int(F_ANNOES); + TArticolo_giacenza artgiac(codart); + const real giac = artgiac.giacenza_anno(NULL, NULL, anno); + return giac < ZERO; +} void TStampa_schede_mag::setprint_permagazzini() { @@ -622,21 +682,17 @@ void TStampa_schede_mag::setprint_permagazzini() // filtering from/to ART darec.put("CODART",_mask->get(F_DAART)); arec.put("CODART",_mask->get(F_AART)); + // filtering ONLY NEGATIVES if (_mask->get(F_FILTRO)[0]=='N') { - TForm_subsection &s=((TForm_subsection &)_form->find_field('B',odd_page,"MOVS_PRECEDENTI")); - TString cond; - cond << '(' << s.condition() << ")&&(STR("<< LF_MAG << "->" << _form->nomecampo_scheda() << "<0))"; - s.setcondition(cond,_strexpr); - TForm_subsection &s2=((TForm_subsection &)_form->find_field('B',odd_page,"MOVS_INTERESSATI")); - cond.cut(0) << '(' << s2.condition() << ")&&(STR("<< LF_MAG << "->" << _form->nomecampo_scheda() << "<0))"; - s2.setcondition(cond,_strexpr); + _cur->set_filterfunction(negatives_only, TRUE); } + // prepare cursor to print.... ((TSorted_cursor *)_cur)->change_order(_form->rmov_sortexp()); if (cfilter.not_empty()) - cfilter.cut(cfilter.len()-2); + cfilter.rtrim(2); TLocalisamfile *mag=new TLocalisamfile(LF_MAG); mag->setkey(2); @@ -680,17 +736,13 @@ void TStampa_schede_mag::setprint_perarticoli() TDate d1(_mask->get(F_ADATA)); filter << "(ANSI(110->DATAREG)<=" <<'"' << d1.string(ANSI) << "\")&&" ; } + // filtering ONLY NEGATIVES if (_mask->get(F_FILTRO)[0]=='N') { - TForm_subsection &s=((TForm_subsection &)_form->find_field('B',odd_page,"MOVS_PRECEDENTI")); - TString cond; - cond << '(' << s.condition() << ")&&(STR("<< LF_MAG << "->" << _form->nomecampo_scheda() << "<0))"; - s.setcondition(cond,_strexpr); - TForm_subsection &s2=((TForm_subsection &)_form->find_field('B',odd_page,"MOVS_INTERESSATI")); - cond.cut(0) << '(' << s2.condition() << ")&&(STR("<< LF_MAG << "->" << _form->nomecampo_scheda() << "<0))"; - s2.setcondition(cond,_strexpr); + _cur->set_filterfunction(negatives_only); } + // Imposta i livelli di dettaglio della scheda int tolivelloart=_mask->get_int(F_TOLIVELLOART); int tolivellogiac=_mask->get_int(F_TOLIVELLOGIAC); @@ -749,13 +801,14 @@ void TStampa_schede_mag::setprint_perarticoli() TString mag_joinexp; mag_joinexp << "ANNOES==" << _mask->get(F_ANNOES) << "|CODMAG==CODMAG|CODART==CODART|LIVELLO==LIVGIAC"; _cur->relation()->replace(mag,2,mag_joinexp); + + if (cfilter.not_empty()) + cfilter.rtrim(2); - if (cfilter.not_empty()) cfilter.cut(cfilter.len()-2); _cur->setfilter(cfilter); _cur->setregion(darec,arec,0x2); } - void TStampa_schede_mag::main_loop() { while (_mask->run() == K_ENTER) diff --git a/mg/mg3300a.frm b/mg/mg3300a.frm index adbcea6fe..4cb1bd5a3 100755 --- a/mg/mg3300a.frm +++ b/mg/mg3300a.frm @@ -104,7 +104,7 @@ SECTION HEADER ODD 5 END NUMBER 9 12 BEGIN - PROMPT 74 4 "Valore" + PROMPT 78 4 "Valore" END STRINGA 5 146 BEGIN @@ -341,7 +341,7 @@ SECTION BODY ODD 0 END STRINGA 101 12 - BEGIN + BEGIN PROMPT 27 1 "" FIELD LF_RMOVMAG->UM END @@ -438,10 +438,10 @@ SECTION BODY ODD 0 PICTURE "###.##@,@##" MESSAGE _USER,ADDQTA,FF_SALDO_GRMOV END - NUMBER FF_VALORE_MOV 12 + NUMBER FF_VALORE_MOV 15 BEGIN PROMPT 69 1 "" - PICTURE "###.###.##@" + PICTURE "###.###.###.##@" MESSAGE _USER,ADDVAL,FF_VALORE_GRMOV END NUMBER 100 12 @@ -472,10 +472,10 @@ SECTION BODY ODD 0 PICTURE "###.##@,@##" MESSAGE ADD,FF_SALDO_GART END - NUMBER FF_VALORE_GRMOV 12 + NUMBER FF_VALORE_GRMOV 15 BEGIN PROMPT 69 1 "" - PICTURE "###.###.##@" + PICTURE "###.###.###.##@" MESSAGE ADD,FF_VALORE_GART END END // TOTALI scheda per articolo @@ -535,10 +535,10 @@ SECTION BODY ODD 0 PROMPT 46 1 "" PICTURE "###.##@,@##" END - NUMBER FF_VALORE_GART 12 + NUMBER FF_VALORE_GART 15 BEGIN PROMPT 69 1 "" - PICTURE "###.###.##@" + PICTURE "###.###.###.##@" END END // TOTALI scheda per articolo diff --git a/mg/mg3300b.frm b/mg/mg3300b.frm index 02b85558c..60379839c 100755 --- a/mg/mg3300b.frm +++ b/mg/mg3300b.frm @@ -95,11 +95,11 @@ SECTION HEADER ODD 5 END NUMBER 8 12 BEGIN - PROMPT 57 4 "Prezzo" + PROMPT 62 4 "Prezzo" END - NUMBER 9 12 + NUMBER 9 15 BEGIN - PROMPT 71 4 "Valore" + PROMPT 78 4 "Valore" END STRINGA 5 146 BEGIN @@ -251,6 +251,12 @@ SECTION BODY ODD 2 BEGIN FLAGS "H" END + + NUMBER FF_CANPRINTSALDOPREC 6 + BEGIN + FLAGS "H" + MESSAGE _USER,CANPRINTSALDOPREC + END SECTION MOVS_PRECEDENTI 1 0 0 STREXPR LF_MOVMAG->DATAREG<"" NUMBER 103 30 @@ -262,29 +268,6 @@ SECTION BODY ODD 2 END SECTION MOVS_INTERESSATI 1 0 0 STREXPR LF_MOVMAG->DATAREG>="" - SECTION STAMPASALDOPREC 1 1 1 NUMEXPR (#FF_STAMPASALDOPREC==0)&&(#FF_QUANTRIGA!=0) - NUMBER 100 18 - BEGIN - PROMPT 8 1 "Saldo precedente :" - END - NUMBER FF_SALDOPREC 12 - BEGIN - PROMPT 31 1 "" - PICTURE "###.##@,@##" - MESSAGE _USER,SALDOPREC|ADD,FF_SALDO_GART - END - NUMBER 101 12 - BEGIN - FLAGS "H" - MESSAGE RESET,FF_SALDOPREC |INC,FF_STAMPASALDOPREC - END - STRINGA 102 12 - BEGIN - PROMPT 27 1 "" - FIELD LF_UMART->UM - END - END // stampa saldo precedente - STRINGA 100 30 BEGIN PROMPT 1 1 ">>>" @@ -317,6 +300,29 @@ SECTION BODY ODD 2 END END // sezione movimento di competenza END // loop movimento + + SECTION STAMPASALDOPREC 1 1 1 NUMEXPR (#FF_STAMPASALDOPREC==0)&&(#FF_CANPRINTSALDOPREC!=0) + NUMBER 100 18 + BEGIN + PROMPT 8 1 "Saldo precedente :" + END + NUMBER FF_SALDOPREC 12 + BEGIN + PROMPT 31 1 "" + PICTURE "###.##@,@##" + MESSAGE _USER,SALDOPREC|ADD,FF_SALDO_GART + END + NUMBER 101 12 + BEGIN + FLAGS "H" + MESSAGE RESET,FF_SALDOPREC |INC,FF_STAMPASALDOPREC + END + STRINGA 102 12 + BEGIN + PROMPT 27 1 "" + FIELD LF_UMART->UM + END + END // stampa saldo precedente SECTION TOTALI_MOV 1 2 2 NUMEXPR #FF_SALDO_MOV!=0 NUMBER FF_NUM_MOV 32 @@ -350,10 +356,10 @@ SECTION BODY ODD 2 PICTURE "###.##@,@##" MESSAGE _USER,ADDQTA,FF_SALDO_GART END - NUMBER FF_VALORE_MOV 12 + NUMBER FF_VALORE_MOV 15 BEGIN PROMPT 69 2 "" - PICTURE "###.###.##@" + PICTURE "###.###.###.##@" MESSAGE _USER,ADDVAL,FF_VALORE_GART END NUMBER 100 12 @@ -381,10 +387,10 @@ SECTION BODY ODD 2 PROMPT 46 1 "" PICTURE "###.##@,@##" END - NUMBER FF_VALORE_GART 12 + NUMBER FF_VALORE_GART 15 BEGIN PROMPT 69 1 "" - PICTURE "###.###.##@" + PICTURE "###.###.###.##@" END END // TOTALI scheda per articolo END // loop RMOVMAG raggruppate diff --git a/mg/mg3500.cpp b/mg/mg3500.cpp index fdc1eb110..c9a541590 100755 --- a/mg/mg3500.cpp +++ b/mg/mg3500.cpp @@ -3,6 +3,7 @@ #include "mglib.h" #include "mg3500.h" #include "mg3frm.h" +#include "../cg/cglib01.h" // mg3500 Stampa @@ -84,7 +85,8 @@ void TStampa_storgiac::main_loop() TString cfilter,joinexp, espr; cfilter.format("%d->NRIGA!=0", LF_STOMAG); //Considera l'articolo solo se ha almeno una riga di storico... - joinexp << "ANNOESRIF==" << _mask->get(F_ANNOES) << "|CODART==CODART"; + TString16 es ; es.format("\"%04d\"", _mask->get_int(F_ANNOES)); + joinexp << "ANNOESRIF==" << es << "|CODART==CODART"; _form = new TForm_storgiac("mg3500", ""); _cur = _form->cursor(); @@ -171,7 +173,13 @@ void TStampa_storgiac::main_loop() break; default: break; - } + } + + TEsercizi_contabili esercizi; + const int cod_es_prec = esercizi.pred(_mask->get_int(F_ANNOES)); + TString16 es_prec ; es_prec.format("%04d", cod_es_prec); + + _form->find_field('H',odd_page,4).set(es_prec); _cur->relation()->replace(new TLocalisamfile(LF_STOMAG),1,joinexp); _cur->setfilter(cfilter,TRUE); _cur->setregion(darec,arec); diff --git a/mg/mg3500.frm b/mg/mg3500.frm index 7c63e2b20..788967bb4 100755 --- a/mg/mg3500.frm +++ b/mg/mg3500.frm @@ -49,10 +49,10 @@ BEGIN MESSAGE _PAGENO END -NUMERO 4 32 +STRING 4 44 BEGIN KEY "Intestazione stampa" - PROMPT 28 2 "Stampa storico rimanenze" + PROMPT 19 2 "Stampa storico rimanenze - Esercizio " END STRINGA 5 80 @@ -144,17 +144,17 @@ SECTION BODY ODD 0 KEY "ANNO" PROMPT 2 1 " Anno" END - STRINGA 15 12 + STRINGA 15 15 BEGIN KEY "QUANT" - PROMPT 4 1 "Quantità( " + PROMPT 4 1 " Quantità( " FIELD LF_UMART->UM END VALUTA 16 18 BEGIN KEY "VALORE UNITARIO" PROMPT 5 1 ") Valore un." - FALGS "U" + FLAGS "U" END VALUTA 17 18 BEGIN @@ -174,11 +174,11 @@ SECTION BODY ODD 0 PROMPT 2 1 "" FIELD LF_STOMAG->ANNOES END - NUMERO 15 12 + NUMERO 15 15 BEGIN KEY "QUANT" PROMPT 4 1 "" - PICTURE "###.###,@@@@@" + PICTURE "#.###.###,@@@@@" FIELD LF_STOMAG->QUANT MESSAGE ADD,115 END @@ -210,11 +210,11 @@ SECTION BODY ODD 0 KEY "ANNO" PROMPT 2 1 "Totale" END - NUMERO 115 12 + NUMERO 115 15 BEGIN KEY "QUANT" PROMPT 4 1 "" - PICTURE "###.###,@@@@@" + PICTURE "#.####.###,@@@@@" END VALUTA 116 18 BEGIN @@ -244,7 +244,7 @@ SECTION BODY ODD 0 KEY "" PROMPT 2 1 "Totale " END - STRINGA 43 12 + STRINGA 43 15 BEGIN PROMPT 4 1 "" END @@ -272,7 +272,7 @@ SECTION BODY ODD 0 KEY "" PROMPT 2 1 "@BTotale " END - STRINGA 53 12 + STRINGA 53 15 BEGIN PROMPT 4 1 "" END diff --git a/mg/mg3500.uml b/mg/mg3500.uml index d562302f3..beb421680 100755 --- a/mg/mg3500.uml +++ b/mg/mg3500.uml @@ -3,81 +3,81 @@ PAGE "Stampa storico rimanenze" -1 -1 70 12 LISTBOX F_ORDINE 25 BEGIN - FLAGS "G" + FLAGS "G" PROMPT 2 1 "Ordinamento " - ITEM "C|codice" - MESSAGE SHOW,G_CODART@|HIDE,G_DESART@|HIDE,G_GRMERC@|HIDE,G_SGRMERC@|HIDE,G_RAGGFIS@ - ITEM "D|descrizione" - MESSAGE SHOW,G_DESART@|HIDE,G_CODART@|HIDE,G_GRMERC@|HIDE,G_SGRMERC@|HIDE,G_RAGGFIS@ - ITEM "M|Gruppo merceologico" - MESSAGE SHOW,G_CODART@|HIDE,G_DESART@|SHOW,G_GRMERC@|HIDE,G_SGRMERC@|HIDE,G_RAGGFIS@ - ITEM "S|Sottogruppo merceologico" - MESSAGE SHOW,G_CODART@|HIDE,G_DESART@|SHOW,G_GRMERC@|SHOW,G_SGRMERC@|HIDE,G_RAGGFIS@ - ITEM "R|Raggruppamento fiscale" - MESSAGE SHOW,G_CODART@|HIDE,G_DESART@|SHOW,G_RAGGFIS@|HIDE,G_GRMERC@|HIDE,G_SGRMERC@ + ITEM "C|codice" + MESSAGE SHOW,G_CODART@|HIDE,G_DESART@|HIDE,G_GRMERC@|HIDE,G_SGRMERC@|HIDE,G_RAGGFIS@ + ITEM "D|descrizione" + MESSAGE SHOW,G_DESART@|HIDE,G_CODART@|HIDE,G_GRMERC@|HIDE,G_SGRMERC@|HIDE,G_RAGGFIS@ + ITEM "M|Gruppo merceologico" + MESSAGE SHOW,G_CODART@|HIDE,G_DESART@|SHOW,G_GRMERC@|HIDE,G_SGRMERC@|HIDE,G_RAGGFIS@ + ITEM "S|Sottogruppo merceologico" + MESSAGE SHOW,G_CODART@|HIDE,G_DESART@|SHOW,G_GRMERC@|SHOW,G_SGRMERC@|HIDE,G_RAGGFIS@ + ITEM "R|Raggruppamento fiscale" + MESSAGE SHOW,G_CODART@|HIDE,G_DESART@|SHOW,G_RAGGFIS@|HIDE,G_GRMERC@|HIDE,G_SGRMERC@ END NUMBER F_ANNOES 4 BEGIN - FLAGS "A" - PROMPT 2 2 "Codice es. " - USE ESC - INPUT CODTAB F_ANNOES - DISPLAY "Esercizio" CODTAB - DISPLAY "Dal@12" D0 + FLAGS "Z" + PROMPT 2 2 "Codice eserc. " + USE ESC + INPUT CODTAB F_ANNOES + DISPLAY "Esercizio" CODTAB + DISPLAY "Dal@12" D0 DISPLAY "Al@12" D1 - OUTPUT F_ANNOES CODTAB - CHECKTYPE NORMAL + OUTPUT F_ANNOES CODTAB + CHECKTYPE REQUIRED ADD NONE END STRING F_DAART 20 BEGIN PROMPT 2 4 "Dall'articolo " - FLAGS "U" - USE LF_ANAMAG - INPUT CODART F_DAART + FLAGS "U" + USE LF_ANAMAG + INPUT CODART F_DAART DISPLAY "Codice@20" CODART - DISPLAY "Descr@50" DESCR - OUTPUT F_DAART CODART + DISPLAY "Descr@50" DESCR + OUTPUT F_DAART CODART CHECKTYPE NORMAL - GROUP G_CODART + GROUP G_CODART END STRING F_AART 20 BEGIN PROMPT 2 5 "all'articolo " - FLAGS "U" - COPY USE F_DAART - INPUT CODART F_AART - COPY DISPLAY F_DAART - OUTPUT F_AART CODART + FLAGS "U" + COPY USE F_DAART + INPUT CODART F_AART + COPY DISPLAY F_DAART + OUTPUT F_AART CODART CHECKTYPE NORMAL - GROUP G_CODART + GROUP G_CODART END STRING F_DADES 50 BEGIN PROMPT 2 4 "Dall'articolo " - FLAGS "U" - USE LF_ANAMAG KEY 2 - INPUT DESCR F_DADES - DISPLAY "Descr@50" DESCR + FLAGS "U" + USE LF_ANAMAG KEY 2 + INPUT DESCR F_DADES + DISPLAY "Descr@50" DESCR DISPLAY "Codice@20" CODART - OUTPUT F_DADES DESCR + OUTPUT F_DADES DESCR CHECKTYPE NORMAL - GROUP G_DESART + GROUP G_DESART END STRING F_ADES 50 BEGIN PROMPT 2 5 "all'articolo " - FLAGS "U" - COPY USE F_DADES - INPUT DESCR F_ADES - COPY DISPLAY F_DADES - OUTPUT F_ADES DESCR + FLAGS "U" + COPY USE F_DADES + INPUT DESCR F_ADES + COPY DISPLAY F_DADES + OUTPUT F_ADES DESCR CHECKTYPE NORMAL - GROUP G_DESART + GROUP G_DESART END STRING F_DAGRMERC 3 diff --git a/mg/mg4100.cpp b/mg/mg4100.cpp index 54930f907..341654080 100755 --- a/mg/mg4100.cpp +++ b/mg/mg4100.cpp @@ -131,7 +131,7 @@ void TStampa_listamov::setprint_x_mov() arec.zero(); if (_mask->get(F_ORDINE)=="N") { - sortexp = _mask->get_bool(F_INVERTI) ? "NUMREG-|CODART|NRIG" : "NUMREG|CODART|NRIG" ; + sortexp = _mask->get_bool(F_INVERTI) ? "NUMREG-|NRIG" : "NUMREG|NRIG" ; _form->find_field('B',odd_page,"HEADER_DATA").disable(); // trova il record iniziale E finale if (cur.key() == 1) @@ -147,7 +147,7 @@ void TStampa_listamov::setprint_x_mov() } else { - sortexp.cut(0) << LF_MOVMAG << "->DATAREG" << (_mask->get_bool(F_INVERTI) ? "-" : "") << "|NUMREG|CODART|NRIG"; + sortexp.cut(0) << LF_MOVMAG << "->DATAREG" << (_mask->get_bool(F_INVERTI) ? "-" : "") << "|NUMREG|NRIG"; _form->find_field('B',odd_page,"HEADER_DATA").show(); // trova il record iniziale E finale if (_mask->get(F_DADATA).not_empty()) diff --git a/mg/mg4100.frm b/mg/mg4100.frm index 7d04a9429..fcf76d204 100755 --- a/mg/mg4100.frm +++ b/mg/mg4100.frm @@ -1,6 +1,6 @@ #define FF_DATAMOV 555 -USE LF_RMOVMAG BY NUMREG CODART NRIG +USE LF_RMOVMAG BY NUMREG NRIG JOIN LF_MOVMAG TO LF_RMOVMAG INTO NUMREG==NUMREG JOIN %CAU TO 110 INTO CODTAB==CODCAUS JOIN LF_ANAMAG TO LF_RMOVMAG INTO CODART==CODART diff --git a/mg/mg4200.cpp b/mg/mg4200.cpp index a576d889d..7fbeef851 100755 --- a/mg/mg4200.cpp +++ b/mg/mg4200.cpp @@ -102,7 +102,7 @@ bool TForm_inventario::validate(TForm_item &cf, TToken_string &s) TArticolo_giacenza_loadable &TForm_inventario::curr_art() { - TString newcode(relation()->lfile(LF_ANAMAG).curr().get(ANAMAG_CODART)); + TString80 newcode(relation()->lfile(LF_ANAMAG).curr().get(ANAMAG_CODART)); if (_curr_art==NULL || newcode != _curr_art->codice()) { if (_curr_art) delete _curr_art; diff --git a/mg/mglib02.cpp b/mg/mglib02.cpp index fcfa54708..2214c3da9 100755 --- a/mg/mglib02.cpp +++ b/mg/mglib02.cpp @@ -451,7 +451,7 @@ int TArticolo_giacenza::find_storico(TRecord_array& rsto, const char * codmag, i { const int last = rsto.last_row(); - if (last > 0 && from <= last) + if (last > 0 && from < last) { const int codmag_len = codmag ? strlen(codmag) : 0; @@ -624,8 +624,8 @@ bool TArticolo_giacenza::riporta_saldi(const char * oldes, const char* newes, co rec.zero(MAG_SCARTI); if (!riporta_ordinato()) { - rec.zero(MAG_ORDF); rec.zero(MAG_VALORDF); - rec.zero(MAG_ORDC); rec.zero(MAG_VALORDC); + rec.zero(MAG_ORDF); rec.zero(MAG_VALORDF); + rec.zero(MAG_ORDC); rec.zero(MAG_VALORDC); } } @@ -991,8 +991,9 @@ void TArticolo_giacenza::copia_storico(TRecord_array& nrstorico,const char * ann int last = nrstorico.last_row(); int codmag_len = (codmag && *codmag) ? strlen(codmag) : 0; + int last_old = rstorico.last_row(); - for (int i = rstorico.last_row(); i > 0; i--) + for (int i = 1; i <= last_old; i++) { const TRectype& rst = rstorico[i]; if (codmag_len == 0 || rst.get(STOMAG_CODMAG).compare(codmag, codmag_len) == 0) @@ -1002,7 +1003,7 @@ void TArticolo_giacenza::copia_storico(TRecord_array& nrstorico,const char * ann newrec.put(STOMAG_NRIGA,++last); nrstorico.insert_row(newrec); } - } + } } HIDDEN int sort_storico(const TObject ** a, const TObject ** b) @@ -1017,6 +1018,11 @@ HIDDEN int sort_storico(const TObject ** a, const TObject ** b) return res; } +HIDDEN int sort_storico_rev(const TObject ** a, const TObject ** b) +{ + return -sort_storico(a, b); +} + void TArticolo_giacenza::add_storico(TRecord_array& nrstorico,const char * annoes,const char * codmag, const real & qta, const real & prz) { //CHECK(annorif && *annorif,"Add_storico: Indicare l'anno esercizio dello storico"); @@ -1066,6 +1072,7 @@ void TArticolo_giacenza::agg_storicoLIFO(const char * annoes, const char * codma TRecord_array nuovo_storico(storico(nuovoanno)); copia_storico(nuovo_storico, annoes, codmag); + nuovo_storico.sort(sort_storico_rev); if (giacenza <= ZERO) giacenza=ZERO; @@ -1133,6 +1140,7 @@ void TArticolo_giacenza::agg_storicoFIFO(const char * annoes, const char * codma TRecord_array nuovo_storico(storico(nuovoanno)); copia_storico(nuovo_storico, annoes, codmag); + nuovo_storico.sort(sort_storico_rev); real qta; @@ -1158,10 +1166,14 @@ void TArticolo_giacenza::agg_storicoFIFO(const char * annoes, const char * codma // aggiunge la quota dell'anno in corso // qta=giacenza-rim; qta = min(giacenza, acq); - TPrice prz; - if (!acq.is_zero()) - prz.set_num(valacq/acq); - add_storico(nuovo_storico, annoes, codmag, qta, prz.get_num()); + if (qta != ZERO) + { + TPrice prz; + + if (!acq.is_zero()) + prz.set_num(valacq/acq); + add_storico(nuovo_storico, annoes, codmag, qta, prz.get_num()); + } nuovo_storico.pack(); nuovo_storico.sort(sort_storico); @@ -1227,15 +1239,15 @@ void TArticolo_giacenza::put_costo_standard(const real& costo) } // calcola la giacenza corretta dai campi Conto Lavoro e Produzione -real TArticolo_giacenza::giacenza_corretta(const TRectype & rec ,bool giac_eff,bool valorizza_componenti) const +real TArticolo_giacenza::giacenza_corretta(const TRectype& rec,bool giac_eff,bool valorizza_componenti) const { CHECK(rec.num() == LF_MAG, "Il record passato deve essere di LF_MAG"); real giacenza(rec.get_real(MAG_GIAC)); if (giac_eff) { - giacenza += rec.get_real(MAG_INCL); - giacenza -= rec.get_real(MAG_ACL); - giacenza += valorizza_componenti ? ZERO : (rec.get_real(MAG_PRODFIN)-rec.get_real(MAG_PRODCOMP)); + giacenza -= rec.get_real(MAG_INCL); + giacenza += rec.get_real(MAG_ACL); + giacenza += valorizza_componenti ? 0 : (rec.get_real(MAG_PRODFIN)-rec.get_real(MAG_PRODCOMP)); } return giacenza; } diff --git a/mg/mgtabcom.txt b/mg/mgtabcom.txt index 81d71ba11..57dd2531b 100755 --- a/mg/mgtabcom.txt +++ b/mg/mgtabcom.txt @@ -1,42 +1,48 @@ [Header] -Version=199516 +Version=199517 Fields=COD,3|CODTAB,25|S0,70|S1,70|S2,70|S3,70|S4,20|S5,20|S6,5|S7,5 -Fields=S8,5|S9,5|I0,7|I1,7|I2,7|I3,7|I4,7|I5,7|I6,7|I7,7 -Fields=I8,7|I9,7|I10,7|I11,7|I12,7|I13,7|I14,7|R0,18|R1,18|R2,18 -Fields=R3,18|R4,18|R5,18|R6,18|R7,18|R8,18|R9,18|R10,18|R11,18|R12,18 -Fields=R13,18|R14,18|R15,18|R16,18|R17,18|R18,18|R19,18|D0,10|D1,10|D2,10 -Fields=D3,10|D4,10|B0,1|B1,1|B2,1|B3,1|B4,1|B5,1|B6,1|B7,1 -Fields=B8,1|B9,1|FPC,1 +Fields=S8,5|S9,5|S10,5|S11,5|I0,7|I1,7|I2,7|I3,7|I4,7|I5,7 +Fields=I6,7|I7,7|I8,7|I9,7|I10,7|I11,7|I12,7|I13,7|I14,7|R0,18 +Fields=R1,18|R2,18|R3,18|R4,18|R5,18|R6,18|R7,18|R8,18|R9,18|R10,18 +Fields=R11,18|R12,18|R13,18|R14,18|R15,18|R16,18|R17,18|R18,18|R19,18|D0,10 +Fields=D1,10|D2,10|D3,10|D4,10|B0,1|B1,1|B2,1|B3,1|B4,1|B5,1 +Fields=B6,1|B7,1|B8,1|B9,1|FPC,1 [Data] -CAU|RIMI|Esistenza Iniziale||+10 0 0 0 0 0 0 0 0 0 +10 0||||C|C||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|ORCL|Ordine da Cliente||0 0 0 0 0 +10 0 0 0 0 0 0 0||||P|V||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|ORFO|Ordine a Fornitore||0 0 0 0 0 0 +10 0 0 0 0 0 0||||C|V||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|ACQL|Acquisto materiale senza ordine||+1+10 0 0 0 0 0 0 0 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|ACQO|Acquisto da ordine||+1+10 0 0 0 -10 0 0 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|VENL|Vendita senza ordine||-10 0 +10 0 0 0 0 0 0 0 0 0||||P|S||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|VENO|Vendita da ordine||-10 0 +10 -10 0 0 0 0 0 0 0||||P|S||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|REAO|Reso su acquisto in ordine||-1-10 0 0 0 +10 0 0 0 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|REAL|Reso su acquisto senza ordine||-1-10 0 0 0 0 0 0 0 0 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|REVO|Reso su vendita da ordine||+10 0 -10 +10 0 0 0 0 0 0 0||||P|C||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|REVL|Reso su vendita senza ordine||+10 0 -10 0 0 0 0 0 0 0 0 0||||P|C||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|PRAL|Programma di produzione a conto lavoro||0 0 +10 0 0 0 0 +10 0 0 0 0||||L|V||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|CFAL|Carico prodotti finiti da produzione a C.L.||+10 0 0 0 0 0 0 -10 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|IMAC|Impegno componenti a conto lavoro||0 0 0 0 +10 0 0 0 +10 0 0 0||||L|V||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|SCAL|Scarico componenti per produzione a conto lavoro||-10 0 0 0 0 0 0 0 -10 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|RCAL|Reso componenti non utilizzati a conto lavoro||+10 0 0 -10 0 0 0 0 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|RFAL|Consegna prodotti finiti da rilavorare a C.L.||-10 0 0 0 0 0 0 +10 0 0 0 0||||P|S||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|CAR|Carico magazzino||+10 +10 0 0 0 0 0 0 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|SCAR|Scarico magazzino||-10 0 0 +10 0 0 0 0 0 0 0 0||||P|S||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|TRASF|Trasferimento tra magazzini (SCAR)+(CAR)||-10 0 0 +10 0 0 0 0 0 0 0 0||||P|V||CAR||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|PICL|Programma per produzione in conto lavoro||0 0 0 0 0 0 0 +10 0 +10 0 0||||C|V||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|CCIL|Carico componenti per produzione in conto lavoro||+10 0 0 0 0 0 +10 0 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|CFCL|Carico finiti da produzione in conto lavoro||+10 0 0 0 0 0 0 0 0 -10 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|SCCL|Scarico componenti da in conto lavoro||-10 0 0 0 0 0 -10 0 0 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|VICL|Consegna prodotti finiti in conto lavoro||-10 0 0 0 0 0 -10 0 0 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|PRPR|Programma di produzione||0 0 +10 0 0 0 0 0 0 +10 0 0||||C|V||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|IMCO|Impegno componenti||0 0 0 0 +10 0 0 0 +10 0 0 0||||C|V||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|CFPR|Carico articoli da produzione||+10 0 0 0 0 0 0 0 0 -10 0 0||||P|C||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|SCCI|Scarico componenti da impegno di produzione||-10 0 0 0 0 0 0 0 -10 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||| | | |||||||| -CAU|MOVQ|Movimentazione quantita||+10 0 0 0 0 0 0 0 0 0 +10 0||||C|C|||||||||||||||||||||||||||||||||||||||||||X| | |||||||| -CAU|MOVV|Movimentazione valore||+10 0 0 0 0 0 0 0 0 0 +10 0||||C|C||||||||||||||||||||||||||||||||||||||||||| |X| |||||||| +CAU|ACQL|Acquisto materiale senza ordine||+1+10 0 0 0 0 0 0 0 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|ACQO|Acquisto da ordine||+1+10 0 0 0 -10 0 0 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|CACL|A conto lavorazione||-10 0 0 0 0 0 0 +10 0 0 0 0||||P|S||||||||||||||||||||||||||||||||||||||||||||| | | | ||||||| +CAU|CAR|Carico magazzino||+10 +10 0 0 0 0 0 0 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|CCIL|Carico componenti per produzione in conto lavoro||+10 0 0 0 0 0 +10 0 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|CFAL|Carico prodotti finiti da produzione a C.L.||+10 0 0 0 0 0 0 -10 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|CFCL|Carico finiti da produzione in conto lavoro||+10 0 0 0 0 0 0 0 0 -10 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|CFPR|Carico articoli da produzione||+10 0 0 0 0 0 0 0 0 -10 0 0||||P|C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|CICL|Carico in conto lavorazione||+10 0 0 0 0 0 +10 0 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| | | | ||||||| +CAU|CIPC|In produzione componenti||+10 0 0 0 0 0 0 0 +10 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| | | | ||||||| +CAU|CIPF|In produzione finiti||-10 0 0 0 0 0 0 0 0 +10 0 0||||P|S||||||||||||||||||||||||||||||||||||||||||||| | | | ||||||| +CAU|IMAC|Impegno componenti a conto lavoro||0 0 0 0 +10 0 0 0 +10 0 0 0||||L|V||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|IMCO|Impegno componenti||0 0 0 0 +10 0 0 0 +10 0 0 0||||C|V||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|MOVQ|Movimentazione quantita||+10 0 0 0 0 0 0 0 0 0 +10 0||||C|C|||||||||||||||||||||||||||||||||||||||||||||X| | | | | | | | | | +CAU|MOVV|Movimentazione valore||+10 0 0 0 0 0 0 0 0 0 +10 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| |X| | | | | | | | | +CAU|MQTA|Movimentazione quantitá||+10 0 0 0 0 0 0 0 0 0 +10 0||||C|C|||||||||||||||||||||||||||||||||||||||||||||X| | | ||||||| +CAU|MVAL|Movimentazione valore||+10 0 0 0 0 0 0 0 0 0 +10 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| |X| | ||||||| +CAU|ORCL|Ordine da Cliente||0 0 0 0 0 +10 0 0 0 0 0 0 0||||P|V||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|ORFO|Ordine a Fornitore||0 0 0 0 0 0 +10 0 0 0 0 0 0||||C|V||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|PICL|Programma per produzione in conto lavoro||0 0 0 0 0 0 0 +10 0 +10 0 0||||C|V||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|PRAL|Programma di produzione a conto lavoro||0 0 +10 0 0 0 0 +10 0 0 0 0||||L|V||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|PRPR|Programma di produzione||0 0 +10 0 0 0 0 0 0 +10 0 0||||C|V||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|RCAL|Reso componenti non utilizzati a conto lavoro||+10 0 0 -10 0 0 0 0 0 0 0 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|REAL|Reso su acquisto senza ordine||-1-10 0 0 0 0 0 0 0 0 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|REAO|Reso su acquisto in ordine||-1-10 0 0 0 +10 0 0 0 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|REVL|Reso su vendita senza ordine||+10 0 -10 0 0 0 0 0 0 0 0 0||||P|C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|REVO|Reso su vendita da ordine||+10 0 -10 +10 0 0 0 0 0 0 0||||P|C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|RFAL|Consegna prodotti finiti da rilavorare a C.L.||-10 0 0 0 0 0 0 +10 0 0 0 0||||P|S||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|RIMI|Esistenza Iniziale||+10 0 0 0 0 0 0 0 0 0 +10 0||||C|C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|SCAL|Scarico componenti per produzione a conto lavoro||-10 0 0 0 0 0 0 0 -10 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|SCAR|Scarico magazzino||-10 0 0 +10 0 0 0 0 0 0 0 0||||P|S||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|SCCI|Scarico componenti da impegno di produzione||-10 0 0 0 0 0 0 0 -10 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|SCCL|Scarico componenti da in conto lavoro||-10 0 0 0 0 0 -10 0 0 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|TRASF|Trasferimento tra magazzini (SCAR)+(CAR)||-10 0 0 +10 0 0 0 0 0 0 0 0||||P|V||CAR||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|VENL|Vendita senza ordine||-10 0 +10 0 0 0 0 0 0 0 0 0||||P|S||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|VENO|Vendita da ordine||-10 0 +10 -10 0 0 0 0 0 0 0||||P|S||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +CAU|VICL|Consegna prodotti finiti in conto lavoro||-10 0 0 0 0 0 -10 0 0 0 0 0||||C|S||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | diff --git a/mr/mr2100.cpp b/mr/mr2100.cpp index 436e21349..fa3e6b9ec 100755 --- a/mr/mr2100.cpp +++ b/mr/mr2100.cpp @@ -226,15 +226,15 @@ debug = 1; } // approssima in base al lotto minimo; prevede valori negativi -real TMRP_line::sizeup_net_requirement(int i, const real &val) +real TMRP_line::sizeup_net_requirement(int i, const real &val, const real & oldnet) { - real req(ZERO); // Azzera net requirement - if (val < ZERO) + real req(oldnet); // Azzera net requirement + if (val + oldnet < ZERO) { - req = -val; // Rende positiva la richiesta effettiva + req = -(val + oldnet); // Rende positiva la richiesta effettiva real lm,li; - lotti_riordino(lm,li); + lotti_riordino(lm,li); if (req > lm) // Se la richiesta supera il lotto minimo { if (li > ZERO) @@ -248,6 +248,7 @@ real TMRP_line::sizeup_net_requirement(int i, const real &val) } else req = lm; // Forza la richiesta almeno al lotto minimo + req += oldnet; } set_net_req(i, req); return req; @@ -458,6 +459,16 @@ TMRP_lines::~TMRP_lines() #define COMPARE_DATF -8 // data documento + data di consegna + articolo + fornitore #define COMPARE_ATFD -9 // #define COMPARE_ADTF -10 // +#define COMPARE_TCFA -11 // +#define COMPARE_TCAF -12 // +#define COMPARE_TFAC -13 // +#define COMPARE_TFCA -14 // +#define COMPARE_TAFC -15 // +#define COMPARE_TACF -16 // +#define COMPARE_CTFA -17 // data di consegna + data documento + fornitore + articolo +#define COMPARE_CATF -18 // data di consegna + data documento + articolo + fornitore +#define COMPARE_ATFC -19 // +#define COMPARE_ACTF -20 // class TRiga_ordine : public TToken_string { @@ -511,6 +522,18 @@ int TRiga_ordine::compare(const TToken_string& riga, int level, bool ascending) short fields_DATF[] = {F_DATADOC, F_DATACONS, F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4, F_ORD_TYPE, F_FORNITORE}; short fields_ATFD[] = {F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4, F_ORD_TYPE, F_FORNITORE, F_DATADOC, F_DATACONS}; short fields_ADTF[] = {F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4, F_ORD_TYPE, F_DATADOC, F_DATACONS, F_FORNITORE}; + + short fields_TFAC[] = {F_ORD_TYPE, F_FORNITORE, F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4, F_DATACONS, F_DATADOC}; + short fields_TFCA[] = {F_ORD_TYPE, F_FORNITORE, F_DATACONS, F_DATADOC, F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4}; + short fields_TCFA[] = {F_ORD_TYPE, F_DATACONS, F_DATADOC, F_FORNITORE, F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4}; + short fields_TCAF[] = {F_ORD_TYPE, F_DATACONS, F_DATADOC, F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4, F_FORNITORE}; + short fields_TAFC[] = {F_ORD_TYPE, F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4, F_FORNITORE, F_DATACONS, F_DATADOC}; + short fields_TACF[] = {F_ORD_TYPE, F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4, F_DATACONS, F_DATADOC, F_FORNITORE}; + short fields_CTFA[] = {F_DATACONS, F_DATADOC, F_ORD_TYPE, F_FORNITORE, F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4}; + short fields_CATF[] = {F_DATACONS, F_DATADOC, F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4, F_ORD_TYPE, F_FORNITORE}; + short fields_ATFC[] = {F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4, F_ORD_TYPE, F_FORNITORE, F_DATACONS, F_DATADOC}; + short fields_ACTF[] = {F_ARTICOLO, F_LIV1, F_LIV2, F_LIV3, F_LIV4, F_ORD_TYPE, F_DATACONS, F_DATADOC, F_FORNITORE}; + for (int i = 0; i < 9 && cmp == 0; i++) { switch (level) @@ -525,6 +548,17 @@ int TRiga_ordine::compare(const TToken_string& riga, int level, bool ascending) case COMPARE_DATF: f=fields_DATF[i]; break; case COMPARE_ADTF: f=fields_ADTF[i]; break; case COMPARE_ATFD: f=fields_ATFD[i]; break; + + case COMPARE_TFAC: f=fields_TFAC[i]; break; + case COMPARE_TFCA: f=fields_TFCA[i]; break; + case COMPARE_TCFA: f=fields_TCFA[i]; break; + case COMPARE_TCAF: f=fields_TCAF[i]; break; + case COMPARE_TACF: f=fields_TACF[i]; break; + case COMPARE_TAFC: f=fields_TAFC[i]; break; + case COMPARE_CTFA: f=fields_CTFA[i]; break; + case COMPARE_CATF: f=fields_CATF[i]; break; + case COMPARE_ACTF: f=fields_ACTF[i]; break; + case COMPARE_ATFC: f=fields_ATFC[i]; break; default: NFCHECK("Ordinamento sconosciuto"); break; @@ -615,9 +649,6 @@ TRiga_ordine::TRiga_ordine(const TDate& datadoc, const TDate& datacons, long for add(line.description(),F_DESCART - FIRST_FIELD); } - - - /////////////////////////////////////////////////////////// // TMRP_docref / TMRP_docrefs /////////////////////////////////////////////////////////// @@ -667,7 +698,6 @@ char TMRP_docref::statodoc() return get_doc().get_char(DOC_STATO); } - TMRP_docref::TMRP_docref(int anno, const char * codnum,long numdoc,int nriga, const char *um, const real & qta, const real &prz) { @@ -686,7 +716,6 @@ TObject* TMRP_docref::dup() const return o; } - TObject* TMRP_internalref::dup() const { TMRP_internalref * o = new TMRP_internalref(*this); @@ -849,6 +878,9 @@ protected: void print_exceptions(TExceptions_array &excepts); bool print_exceptions(TMask &m); bool print_planning(TMask &m); + + bool ask_save(); + void save_orders(TAssoc_array& docs); public: virtual void main_loop(); @@ -1164,11 +1196,6 @@ int TMatResMask::add_order_line(long forn, const TMRP_line& line, int bucket) plan_time = line.time(bucket); else line.lead_time(bucket, plan_time, TRUE); -// if (line.sons() == 0) // Sottrai alle foglie il bonus -// { -// plan_time.sub_time(get_int(F_XTRA_LDTIME)); -// deliv_time.sub_time(get_int(F_XTRA_LDTIME)); -// } plan_time.sub_time(get_int(F_XTRA_PLTIME)); TDate datadoc = plan_time.date(); @@ -1220,8 +1247,11 @@ int TMatResMask::add_order_line(long forn, const TMRP_line& line, int bucket) r->add(q.is_zero() ? " " : q.string() , F_QUANTITA - FIRST_FIELD); qtaplan = ZERO; } - if ((nref >= 0 && (!qtaplan.is_zero() || get_bool(F_ALLORDERS))) || // correggo un vecchio ordine ... - (nref < 0 && !q.is_zero())) // ... o ne genero uno nuovo +// if ((nref >= 0 && (!qtaplan.is_zero() || get_bool(F_ALLORDERS))) || // correggo un vecchio ordine ... +// (nref < 0 && !q.is_zero())) // ... o ne genero uno nuovo + if ((nref >= 0 && (!qtaplan.is_zero() || get_bool(F_ALL_ORDERSCHANGES))) || // correggo un vecchio ordine ... + (nref < 0 && !q.is_zero()) || // ... o ne genero uno nuovo + get_bool(F_ALL_MRPLINES)) // ...o voglio tutte le righe { int cmp = -1; if (nref >= 0 && qtaplan < ZERO) @@ -1238,8 +1268,21 @@ int TMatResMask::add_order_line(long forn, const TMRP_line& line, int bucket) riga += *r; delete r; const TString & qta2or = riga.get(F_QUANTITA - FIRST_FIELD); - if (qta2or[0]==' ' && !get_bool(F_ALLORDERS)) + if (qta2or[0]==' ' && ! + ((nref >= 0 && get_bool(F_ALL_ORDERSCHANGES)) // correzione .. + || get_bool(F_ALL_MRPLINES))) // ... o voglio tutte le righe + { + // riabilita i campi del doc + s.enable_cell(pos, F_ORD_TYPE - FIRST_FIELD); + s.enable_cell(pos, F_DATADOC - FIRST_FIELD); + s.enable_cell(pos, F_DATACONS - FIRST_FIELD); + s.enable_cell(pos, F_FORNITORE - FIRST_FIELD); + s.enable_cell(pos, F_MAGAZZINO - FIRST_FIELD); + s.enable_cell(pos, F_DEPOSITO - FIRST_FIELD); + s.enable_cell(pos, F_CODIMP - FIRST_FIELD); + s.enable_cell(pos, F_CODLIN - FIRST_FIELD); a.destroy(pos); // no null rows if not desired + } } else { @@ -1270,7 +1313,7 @@ int TMatResMask::add_order_line(long forn, const TMRP_line& line, int bucket) } } else - delete r; + delete r; } while (nref >= 0 /*&& q > ZERO*/); return pos; } @@ -1304,12 +1347,34 @@ static int order_compareTAFD(TSheet_field &s,int i1,int i2) static int order_compareTADF(TSheet_field &s,int i1,int i2) { return order_compare(s,i1,i2,COMPARE_TADF);} +static int order_compareCTFA(TSheet_field &s,int i1,int i2) +{ return order_compare(s,i1,i2,COMPARE_CTFA);} +static int order_compareCATF(TSheet_field &s,int i1,int i2) +{ return order_compare(s,i1,i2,COMPARE_CATF);} +static int order_compareATFC(TSheet_field &s,int i1,int i2) +{ return order_compare(s,i1,i2,COMPARE_ATFC);} +static int order_compareACTF(TSheet_field &s,int i1,int i2) +{ return order_compare(s,i1,i2,COMPARE_ACTF);} +static int order_compareTFAC(TSheet_field &s,int i1,int i2) +{ return order_compare(s,i1,i2,COMPARE_TFAC);} +static int order_compareTFCA(TSheet_field &s,int i1,int i2) +{ return order_compare(s,i1,i2,COMPARE_TFCA);} +static int order_compareTCFA(TSheet_field &s,int i1,int i2) +{ return order_compare(s,i1,i2,COMPARE_TCFA);} +static int order_compareTCAF(TSheet_field &s,int i1,int i2) +{ return order_compare(s,i1,i2,COMPARE_TCAF);} +static int order_compareTAFC(TSheet_field &s,int i1,int i2) +{ return order_compare(s,i1,i2,COMPARE_TAFC);} +static int order_compareTACF(TSheet_field &s,int i1,int i2) +{ return order_compare(s,i1,i2,COMPARE_TACF);} + void TMatResMask::sort_orders() { TWait_cursor clessidra; TSheet_field& s = sfield(F_ORDINI); TSheet_field& a = s; - switch (-get_int(F_SORT)) + int choose = -(get_int(F_SORT)+ (get_bool(F_DATE_SORT_ORDER) ? 10 : 1)); + switch (choose) { case COMPARE_ATFD: a.sort(order_compareATFD); break; case COMPARE_ADTF: a.sort(order_compareADTF); break; @@ -1321,6 +1386,17 @@ void TMatResMask::sort_orders() case COMPARE_TADF: a.sort(order_compareTADF); break; case COMPARE_TDAF: a.sort(order_compareTDAF); break; case COMPARE_TDFA: a.sort(order_compareTDFA); break; + + case COMPARE_ATFC: a.sort(order_compareATFC); break; + case COMPARE_ACTF: a.sort(order_compareACTF); break; + case COMPARE_CTFA: a.sort(order_compareCTFA); break; + case COMPARE_CATF: a.sort(order_compareCATF); break; + case COMPARE_TFAC: a.sort(order_compareTFAC); break; + case COMPARE_TFCA: a.sort(order_compareTFCA); break; + case COMPARE_TAFC: a.sort(order_compareTAFC); break; + case COMPARE_TACF: a.sort(order_compareTACF); break; + case COMPARE_TCAF: a.sort(order_compareTCAF); break; + case COMPARE_TCFA: a.sort(order_compareTCFA); break; default: return; } @@ -1431,8 +1507,8 @@ TRisalita_mask::TRisalita_mask(TMRP_line* line, const TDate &fromdate, const TDa // if (extraleadtime && line->sons() == 0) // dtime.sub_time(extraleadtime); // const TDate &d = dtime.date(); - const TDate &d = line->record(b).time().date(); - if ((isbuck0 || d >= fromdate)) + const TDate &d = line->record(b).time().date(); + if (isbuck0 || d >= fromdate) { set(F_FABB_DADATA, isbuck0 ? "" : fromdate); set(F_FABB_ADATA, todate); @@ -1623,7 +1699,7 @@ int TRisalita_mask::add_internal_ref(const TMRP_internalref &iref) qta.convert2umbase(); qtareq = qtareq - qta.val(); qtareq.round(5); - qtareq = qtareq - qtaplan; + // qtareq = qtareq - qtaplan; r.add(cache().get(LF_DOC,dockey).get(DOC_DATADOC),F_DATADOC - FIRST_FIELD); // data del documento di rif. r.add(docref->annodoc() , F_DOCANNODOC - FIRST_FIELD); r.add(docref->codnumdoc() , F_DOCCODNUM - FIRST_FIELD); @@ -1655,7 +1731,7 @@ int TRisalita_mask::add_internal_ref(const TMRP_internalref &iref) r.add(qta.um(),F_UM - FIRST_FIELD); // aggiunge il fabbisogno qta.convert2umbase(); - q = iref.qta() / totreq * qta.val(); + q = iref.qta() * qta.val() / totreq; r.add(q.string(), F_FABBISOGNO - FIRST_FIELD); a.add(r); @@ -2080,7 +2156,8 @@ bool TMatResPlanning::load_planned_orders() TMRP_docref * docref = new TMRP_docref(doc.get_int(DOC_ANNO), codnum, docnum, numriga, um, q.val(), prz); const TMRP_time t(consegna, 0, imp, lin); - if (has_confirmed_status(doc, a.row(sheetrow))) + if (has_confirmed_status(doc, a.row(sheetrow)) || + (codnum != m.get(F_NUM_PROD) && codnum != m.get(F_NUM_FORN))) line->add_sched_rec(t, q.val(), docref); else line->add_planned_ord(t, q.val(), docref); @@ -2171,7 +2248,7 @@ bool TMatResPlanning::gross2net_logic(TMRP_line &curr_article, int bucket) { TMRP_time lead_time, xlead_time; curr_article.lead_time(bucket, lead_time, use_leadtime); - int xtradays = m.get_int(F_XTRA_LDTIME); + const int xtradays = m.get_int(F_XTRA_LDTIME); if (xtradays) { xlead_time = lead_time; @@ -2183,6 +2260,11 @@ bool TMatResPlanning::gross2net_logic(TMRP_line &curr_article, int bucket) tmpreal = net_req * curr_article.qta_son(o); if (tmpreal > ZERO) { + if (article_son.articolo() == "21014F") + { + const real qta = tmpreal; + } + TMRP_internalref * iref = new TMRP_internalref( &curr_article, bucket, tmpreal); if (xtradays && curr_article.sons()) article_son.add_gross_req(xlead_time, tmpreal, iref); @@ -2271,6 +2353,8 @@ bool TMatResPlanning::build_orders() line.planned_orders(b)>0 || line.sched_receipts(b)>line.gross_requirement(b)) m.add_order_line(forn, line, b); + else + m.add_order_line(forn, line, b); } } } @@ -2708,6 +2792,53 @@ return 0; return 0; } +void TMatResPlanning::save_orders(TAssoc_array& docs) +{ + TMatResMask& m = *_mask; + + FOR_EACH_ASSOC_OBJECT(docs, hash, str, obj) + { + TDocumento& doc = (TDocumento&)*obj; + int err; + if (doc.get_long(DOC_NDOC)) + { + // riscrittura; elimina righe con qta zero + if (!m.get_bool(F_ALL_ORDERSCHANGES)) + for (int numriga = doc.physical_rows(); numriga >0 ; numriga--) + { + if (doc[numriga].get_real(RDOC_QTA).is_zero()) + doc.destroy_row(numriga, TRUE); + } + err = doc.rewrite(); + } + else + // generazione + err = doc.write(); + if (err != NOERR) + doc.read(); // unlock + } + + docs.destroy(); +} + +bool TMatResPlanning::ask_save() +{ + TMatResMask& m = *_mask; + TSheet_field& sf = m.sfield(F_ORDINI); + + int tot = 0; + FOR_EACH_SHEET_ROW(sf, r, row) + { + TToken_string& riga = *row; + if (*riga.get(0) == 'X') + tot++; + } + + bool yes = TRUE; + if (tot > 0) + yes = yesno_box("Si desidera elaborare %d righe?", tot); + return yes; +} /////////// finished: 90% /////////// tested : 90% @@ -2726,8 +2857,18 @@ bool TMatResPlanning::emit_orders() int docf = 0, docp = 0; TAssoc_array docs; TToken_string key; + int ignore_docdate_too_soon = 0; + int ignore_duedate_lt_docdate = 0; + + if (!ask_save()) + return FALSE; + + TProgind pi(sf.items(), "Generazione ordini", FALSE, TRUE); + FOR_EACH_SHEET_ROW(sf, r, row) { + pi.addstatus(1); + TToken_string& riga = *row; if (*riga.get(0) == 'X') { @@ -2745,10 +2886,20 @@ bool TMatResPlanning::emit_orders() if (qta.is_zero()) continue; if (datadoc < today && newdoc) - if (!noyes_box("Riga %d: data di emissione del documento (%s) inferiore a quella odierna. Confermi ?",r+1,(const char *)datadoc.string())) + if (ignore_docdate_too_soon != K_ENTER && ignore_docdate_too_soon != K_ESC) + { + TYesnoallnone_box b(format("Riga %d: data di emissione del documento (%s) inferiore a quella odierna. Confermi ?",r+1,(const char *)datadoc.string()), K_NO); + ignore_docdate_too_soon = b.run(); + } + if (ignore_docdate_too_soon == K_NO || ignore_docdate_too_soon == K_ESC) continue; if (datacon < datadoc && newdoc) - if (!noyes_box("Riga %d: data di consegna (%s) inferiore a quella di emissione del documento (%s). Confermi ?",r+1,(const char *)datacon.string(), (const char *)datadoc.string())) + if (ignore_duedate_lt_docdate != K_ENTER && ignore_duedate_lt_docdate != K_ESC) + { + TYesnoallnone_box b(format("Riga %d: data di consegna (%s) inferiore a quella di emissione del documento (%s). Confermi ?",r+1,(const char *)datacon.string(), (const char *)datadoc.string()), K_NO); + ignore_duedate_lt_docdate = b.run(); + } + if (ignore_duedate_lt_docdate == K_NO || ignore_duedate_lt_docdate == K_ESC) continue; if (forn == 0L && newdoc) { @@ -2767,12 +2918,17 @@ bool TMatResPlanning::emit_orders() key.add(datadoc.string()); key.add(divide_by_date ? datacon.string() : " "); key.add(divide_by_art ? riga.get(sf.cid2index(F_ARTICOLO)) : " "); - } else { + } + else + { key.format("%c%ld",prod ? 'P':'F',numdoc); } TDocumento* doc = (TDocumento*)docs.objptr(key); if (doc == NULL) { + if (docs.items() >= 200) + save_orders(docs); + const TString& codnum = m.get(prod ? F_NUM_PROD : F_NUM_FORN ); const TString& tipdoc = m.get(prod ? F_TIPO_PROD: F_TIPO_FORN ); doc = new TDocumento('D', datadoc.year(), codnum, 0); @@ -2791,7 +2947,10 @@ bool TMatResPlanning::emit_orders() if (ok) { if (prod) + { + testata.put(DOC_TIPOCF, "F"); // Il fornitore 0 sono io docp++; + } else { testata.put(DOC_TIPOCF, "F"); @@ -2832,61 +2991,26 @@ bool TMatResPlanning::emit_orders() } } } - - const int tot = int(docs.items()); - TString d1(tipo_doc_prod.riferimento().blank() ? tipo_doc_prod.descrizione() : tipo_doc_prod.riferimento()); - TString d2(tipo_doc_forn.riferimento().blank() ? tipo_doc_forn.descrizione() : tipo_doc_forn.riferimento()); - if (d1 == d2) + save_orders(docs); + + if (sf.items()) { - d1 = "Ordini di produzione"; - d2 = "Ordini di acquisto"; - } - if (tot > 0 && yesno_box("Confermare la generazione di\n" - "%d %s e di\n" - "%d %s ?", - docp, (const char *)d1, - docf, (const char *)d2)) - { - TProgind pi(tot, "Generazione ordini", FALSE, TRUE); - FOR_EACH_ASSOC_OBJECT(docs, hash, str, obj) - { - pi.addstatus(1); - TDocumento& doc = (TDocumento&)*obj; - int err; - if (doc.get_long(DOC_NDOC)) - { - // riscrittura; elimina righe con qta zero - for (int numriga = doc.physical_rows(); numriga >0 ; numriga--) - { - if (doc[numriga].get_real(RDOC_QTA).is_zero()) - doc.destroy_row(numriga, TRUE); - } - err = doc.rewrite(); - } - else - // generazione - err = doc.write(); - if (err != NOERR) - doc.read(); // unlock - } FOR_EACH_SHEET_ROW_BACK(sf, r, row) { - if (*row->get(sf.cid2index(F_SELECTED)) == 'X' && *row->get(sf.cid2index(F_OK))=='X') + if ((*row->get(sf.cid2index(F_SELECTED)) == 'X' && *row->get(sf.cid2index(F_OK))=='X') + || real(row->get(sf.cid2index(F_QUANTITA))).is_zero()) { - if (m.get_bool(F_ALLORDERS)) - { + if (m.get_bool(F_ALL_ORDERSCHANGES)) row->add("", sf.cid2index(F_QUANTITA)); - sf.force_update(r); - } else - sf.destroy(r); + sf.destroy(r, FALSE); } } - - m.enable(DLG_SAVEREC, sf.items() > 0); + sf.force_update(); } + m.enable(DLG_SAVEREC, sf.items() > 0); - return tot > 0; + return TRUE; } void TMatResPlanning::compute() @@ -3067,6 +3191,7 @@ void print_footer(TPrinter& pr) int mr2100(int argc, char* argv[]) { TMatResPlanning a; + a.run(argc, argv, "Material Requirements Planning"); return 0; } diff --git a/mr/mr2100.h b/mr/mr2100.h index 3734de485..eabf405a8 100755 --- a/mr/mr2100.h +++ b/mr/mr2100.h @@ -177,7 +177,7 @@ public: const real& set_net_req(int i, const real& val); const real& add_resched_ord(int i, const real& val); const real& add_unsched_ord(int i, const real& val); - real sizeup_net_requirement(int i, const real& val); + real sizeup_net_requirement(int i, const real& val, const real& oldnet = ZERO); real& giacenza_attuale(real&) const; real& giacenza_attuale(real&, const TDate & data_attuale) const; diff --git a/mr/mr2100a.h b/mr/mr2100a.h index efb844176..ef2296f40 100755 --- a/mr/mr2100a.h +++ b/mr/mr2100a.h @@ -42,6 +42,7 @@ #define F_OP_AGRMERC 236 #define F_OF_DAGRMERC 237 #define F_OF_AGRMERC 238 +#define F_DATE_SORT_ORDER 239 //#define F_NUMBERBYCLI 240 //#define F_NUMBERBYWEEK 241 #define F_DIVIDEBYDATE 242 @@ -49,8 +50,9 @@ #define F_DAYXBUCK 244 #define F_XTRA_LDTIME 245 #define F_XTRA_PLTIME 246 -#define F_ALLORDERS 250 +#define F_ALL_ORDERSCHANGES 250 #define F_DISABLESAVE 251 +#define F_ALL_MRPLINES 252 // campi senza default sul profilo #define F_YEAR 301 diff --git a/mr/mr2100a.uml b/mr/mr2100a.uml index dc1156f30..5b6fe70f1 100755 --- a/mr/mr2100a.uml +++ b/mr/mr2100a.uml @@ -203,14 +203,21 @@ ENDPAGE PAGE "Genera" -1 -1 78 20 -BOOL F_ALLORDERS +BOOL F_ALL_ORDERSCHANGES BEGIN PROMPT 2 2 "Mostra tutte le righe d'ordine" GROUP G_PREPROCESS + MESSAGE TRUE ENABLE,F_ALL_MRPLINES + MESSAGE FALSE CLEAR,F_ALL_MRPLINES +END +BOOL F_ALL_MRPLINES +BEGIN + PROMPT 2 3 "Mostra tutte le righe elaborate" + GROUP G_PREPROCESS END BOOL F_DISABLESAVE BEGIN - PROMPT 2 3 "Solo monitoraggio (registrazione disabilitata)" + PROMPT 2 4 "Solo monitoraggio (registrazione disabilitata)" GROUP G_PREPROCESS END @@ -512,12 +519,16 @@ END BOOLEAN F_SORT_ORDER BEGIN - PROMPT 44 4 "Inverso" + PROMPT 13 5 "Inverso" END -BUTTON F_RESORT_ORDINI 10 1 +BOOLEAN F_DATE_SORT_ORDER BEGIN - PROMPT 62 4 "Riordina" + PROMPT 30 5 "Data di consegna" +END +BUTTON F_RESORT_ORDINI 10 2 +BEGIN + PROMPT 64 4 "Riordina" END SPREADSHEET F_ORDINI diff --git a/mr/mr2200.cpp b/mr/mr2200.cpp index 7597e5e35..72a79186b 100755 --- a/mr/mr2200.cpp +++ b/mr/mr2200.cpp @@ -586,11 +586,13 @@ bool TPlanning_mask::carica_documenti() TMSP_constraint* line; if (tn & _Doc_vincoli) - { + { + line = _constraints.find(cli, art, liv, imp, lin, mag, TRUE); line->set_mastercode_check(two_level && !distinta_master(art)); - } else { - line = _articles. find(cli, art, liv, imp, lin, mag, magc, TRUE); + } + else { + line = _articles.find(cli, art, liv, imp, lin, mag, magc, TRUE); } if (line->description().empty()) @@ -1030,7 +1032,7 @@ void TPlanning_mask::add_or_sub_propose(char sign, bool scheduled) constraint->fill_sheet_row(artrow, *this,TRUE); artrow.add(predrow.get_long(F_PRIORITA-FIRST_FIELD), F_PRIORITA-FIRST_FIELD); artrow.add(get(F_TIPOCF),F_TIPOCF_SHEET-FIRST_FIELD); - artrow.add(predrow.get_long(F_CLIENTE-FIRST_FIELD), F_CLIENTE-FIRST_FIELD); + artrow.add(a.codclifor(), F_CLIENTE-FIRST_FIELD); artrow.add(a.codimp(), F_CODIMP-FIRST_FIELD); artrow.add(a.codlin(), F_CODLIN-FIRST_FIELD); TString8 str=a.codmagdep().left(3); @@ -1505,8 +1507,14 @@ bool TPlanning_mask::general_review(bool check_machine, bool check_human, bool u mrpline.set_net_req(bucket,art_per_buck); } while (nbucket <= upper_buck) - { - TMRP_line* new_article = find_propose(mrpline.codclifor(), mrpline.articolo(), mrpline.livgiac(), + { + long codclifor = mrpline.codclifor() ; + if (is_acq_planning() && codclifor == 0L) + { + TArticolo art(mrpline.articolo()); + codclifor = art.get_long(ANAMAG_CODFORN); + } + TMRP_line* new_article = find_propose(codclifor, mrpline.articolo(), mrpline.livgiac(), mrpline.codimp() , mrpline.codlin(), mrpline.codmagdep(), mrpline.codmagdep_coll(), TRUE); curr_arts = art_per_buck; if (logic == _uniform_logic) @@ -1824,8 +1832,8 @@ bool TPlanning_mask::gross2net(TMSP_mode mode, bool lotsizing) //if (bucket == 0) giacres += mrpline.planned_orders(bucket); giacres += mrpline.sched_receipts(bucket); - if (lotsizing) - netreq = mrpline.sizeup_net_requirement(bucket, giacres); + if (lotsizing) + netreq = mrpline.sizeup_net_requirement(bucket, giacres, netreq); else { netreq = -giacres; diff --git a/mr/mr2200.h b/mr/mr2200.h index 5cee2daf3..3b513219a 100755 --- a/mr/mr2200.h +++ b/mr/mr2200.h @@ -135,6 +135,7 @@ public: bool sortCRPsheet(); void init(); + virtual bool is_acq_planning() { return FALSE;} TPlanning_mask(); virtual ~TPlanning_mask() { } }; diff --git a/or/or1100.cpp b/or/or1100.cpp index ec0f5823c..4def3aed7 100755 --- a/or/or1100.cpp +++ b/or/or1100.cpp @@ -773,7 +773,7 @@ void TStampa_ordini::filter_for_articolo() s << lev_str << "|"; if (mag_str.not_empty()) s << mag_str << "|"; - s << "DATACONS"; + s << "ANNO|NDOC|DATACONS"; // MODIFICARO DA CRISTINA AGGIUNTO ANNO + NDOC cur->change_order(s); // Setta l'ordine diff --git a/or/or1100ap.h b/or/or1100ap.h new file mode 100755 index 000000000..d89caa452 --- /dev/null +++ b/or/or1100ap.h @@ -0,0 +1,100 @@ +// Defines per maschera e form + +#define F_TIPO 101 +#define F_CODNUM 102 +#define F_ANNO 103 +#define F_PROVV 104 +#define F_DATA_O_NUM 105 +#define F_NDOCFROM 106 +#define F_NDOCTO 107 +#define F_EMISFROM 108 +#define F_EMISTO 109 +#define F_TIPOCF 110 +#define F_CFFROM 111 +#define F_CFTO 112 +#define F_CONSFROM 113 +#define F_CONSTO 114 +#define F_ARTFROM 117 +#define F_ARTTO 118 +#define F_AGEFROM 119 +#define F_AGETO 120 +#define F_DETTAGLIO 121 +#define F_STATOORD 122 +#define F_STATORORD 123 +#define F_DETAIL_LEV 124 +#define F_RAGG_PER_ART 125 +#define F_RAGG_CLI 126 +#define F_GIAC1 127 +#define F_GIAC1_DES 128 +#define F_GIAC1_FROM 129 +#define F_GIAC1_TO 130 +#define F_GIAC2 131 +#define F_GIAC2_DES 132 +#define F_GIAC2_FROM 133 +#define F_GIAC2_TO 134 +#define F_GIAC3 135 +#define F_GIAC3_DES 136 +#define F_GIAC3_FROM 137 +#define F_GIAC3_TO 138 +#define F_GIAC4 139 +#define F_GIAC4_DES 140 +#define F_GIAC4_FROM 141 +#define F_GIAC4_TO 142 +#define F_DETAIL_MAG 143 +#define F_DETAIL_DEP 144 +#define F_MAGFROM 145 +#define F_MAGTO 146 +#define F_DEPFROM 147 +#define F_DEPTO 148 +#define F_DETAIL_BY_DOC 149 +#define F_DETAIL_BY_CLI 150 +#define F_PRINTSPESE 151 +#define F_PRINTPREST 152 +#define F_PRINTSCONTI 153 +#define F_PRINTOMAGGI 154 +#define F_PRINTDESCR 155 +#define F_OPZ_VALORE 156 +#define F_OPZ_PREZZO 157 +#define F_OPZ_RESIDUO 158 +#define F_OPZ_GIACENZA 159 +#define F_FORCE_EVASE 160 +#define F_CATMERFROM 161 +#define F_CATMERTO 162 + +#define GR_CLIFO 1 +#define GR_NUM 2 +#define GR_ART 3 +#define GR_AGE 4 +#define GR_NDOC 5 +#define GR_DATA 6 +#define GR_TUTTI 7 +#define GR_MAG 8 +#define GR_RAGG 9 +#define GR_GIAC 10 +#define GR_DETAIL 11 +#define GR_DETAILART 12 +#define GR_PRINT 13 +#define GR_CATMER 14 + +// Defines per forms +#define G_DETTAGLIO 1 +#define G_TOTALE 2 +#define G_TOTALEART 3 + +#define BODY_COL_1 1 +#define BODY_COL_2 2 +#define BODY_COL_3 3 +#define BODY_COL_4 4 +#define BODY_COL_5 5 +#define BODY_COL_6 6 +#define BODY_COL_7 7 +#define BODY_COL_8 8 +#define BODY_COL_9 9 +#define BODY_COL_10 10 +#define BODY_COL_11 11 +#define BODY_COL_12 12 + +#define BODY_CODVAL 53 +#define BODY_TOTVALORD 55 +#define BODY_TOTVALRES 56 + diff --git a/or/or1100ap.uml b/or/or1100ap.uml new file mode 100755 index 000000000..32596d687 --- /dev/null +++ b/or/or1100ap.uml @@ -0,0 +1,703 @@ +#include "or1100ap.h" + +TOOLBAR "" 0 20 0 4 + +BUTTON DLG_PRINT 10 2 +BEGIN + PROMPT -12 -1 "" +END + +BUTTON DLG_QUIT 10 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE + +PAGE "Stampa ordini" -1 -1 78 21 + +RADIOBUTTON F_TIPO 30 +BEGIN + PROMPT 2 1 "Tipo stampa" + ITEM "0|Numero/Data" + MESSAGE DISABLE,GR_TUTTI@|HIDE,GR_AGE@|SHOW,GR_CLIFO@|ENABLE,F_DATA_O_NUM|ENABLE,F_DETTAGLIO|" ",F_DETTAGLIO|CLEAR,GR_DETAIL@|"X",F_OPZ_VALORE|CLEAR,GR_DETAILART@|HIDE,GR_CATMER@ + ITEM "1|Cliente/Fornitore" + MESSAGE DISABLE,GR_TUTTI@|HIDE,GR_AGE@|SHOW,GR_CLIFO@|ENABLE,GR_CLIFO@|DISABLE,F_DATA_O_NUM|"D", F_DATA_O_NUM|ENABLE,F_DETTAGLIO|" ",F_DETTAGLIO|CLEAR,GR_DETAIL@|CLEAR,GR_DETAILART@|SHOW,GR_CATMER@ + ITEM "2|Agente" + MESSAGE DISABLE,GR_TUTTI@|HIDE,GR_CLIFO@|SHOW,GR_AGE@|ENABLE,GR_AGE@|DISABLE,F_DATA_O_NUM|"D", F_DATA_O_NUM|ENABLE,F_DETTAGLIO|" ",F_DETTAGLIO|CLEAR,GR_DETAIL@|CLEAR,GR_DETAILART@|ENABLE,F_DETAIL_BY_CLI|HIDE,GR_CATMER@ + ITEM "3|Articolo" + MESSAGE DISABLE,GR_TUTTI@|HIDE,GR_AGE@|SHOW,GR_CLIFO@|DISABLE,F_DATA_O_NUM|"D", F_DATA_O_NUM|DISABLE,F_DETTAGLIO|"X",F_DETTAGLIO|ENABLE,GR_CLIFO@|ENABLE,GR_ART@|ENABLE,GR_DETAILART@|ENABLE,GR_DETAIL@|DISABLE,F_DETAIL_BY_DOC|HIDE,GR_CATMER@ +END + +GROUPBOX DLG_NULL 40 6 +BEGIN + PROMPT 35 1 "Ordine" +END + +STRING F_CODNUM 4 +BEGIN + PROMPT 36 2 "Codice Num. " + FLAG "U" + USE %NUM SELECT I1==3 + INPUT CODTAB F_CODNUM + DISPLAY "Cod. Num." CODTAB + DISPLAY "Descrizione@50" S0 + OUTPUT F_CODNUM CODTAB + CHECKTYPE REQUIRED +END + +NUMBER F_ANNO 4 +BEGIN + PROMPT 65 2 "Anno " +// CHECKTYPE REQUIRED +END + +LIST F_PROVV 12 +BEGIN + PROMPT 36 3 "Tipo numerazione " + ITEM "D|Definitiva" + ITEM "P|Provvisoria" +END + +LISTBOX F_DATA_O_NUM 20 +BEGIN + PROMPT 36 4 "Selezione su " + ITEM "N|Numero documento" + MESSAGE HIDE,GR_DATA@|SHOW,GR_NDOC@|REQUIRED,F_ANNO + ITEM "D|Data documento" + MESSAGE SHOW,GR_DATA@|HIDE,GR_NDOC@|NORMAL,F_ANNO +END + +NUMBER F_NDOCFROM 7 +BEGIN + PROMPT 36 5 "Dal " + USE 33 + JOIN 20 INTO CODCF=CODCF TIPOCF=TIPOCF + JOIN 13 TO 20 INTO COM=COMCF + INPUT PROVV F_PROVV SELECT + INPUT ANNO F_ANNO SELECT + INPUT CODNUM F_CODNUM SELECT + INPUT NDOC F_NDOCFROM + DISPLAY "Data@10" DATADOC + DISPLAY "Numero@7" NDOC + DISPLAY "Cliente/Fornitore@40" 20->RAGSOC + DISPLAY "Comune@20" 13->DENCOM + OUTPUT F_NDOCFROM NDOC + CHECKTYPE NORMAL + GROUP GR_NDOC +END + +NUMBER F_NDOCTO 7 +BEGIN + PROMPT 62 5 "Al " + USE 33 + JOIN 20 INTO CODCF=CODCF TIPOCF=TIPOCF + JOIN 13 TO 20 INTO COM=COMCF + INPUT PROVV F_PROVV SELECT + INPUT ANNO F_ANNO SELECT + INPUT CODNUM F_CODNUM SELECT + INPUT NDOC F_NDOCTO + DISPLAY "Data@10" DATADOC + DISPLAY "Numero@7" NDOC + DISPLAY "Cliente/Fornitore@40" 20->RAGSOC + DISPLAY "Comune@20" 13->DENCOM + OUTPUT F_NDOCTO NDOC + GROUP GR_NDOC + CHECKTYPE NORMAL +END + +DATE F_EMISFROM +BEGIN + PROMPT 36 5 "Dal " + GROUP GR_DATA +END + +DATE F_EMISTO +BEGIN + PROMPT 59 5 "Al " + GROUP GR_DATA +END + +GROUPBOX DLG_NULL 30 4 +BEGIN + PROMPT 2 7 "Cliente" + GROUP GR_CLIFO +END + +LIST F_TIPOCF 1 11 +BEGIN + PROMPT 3 8 "Tipo C/F " + ITEM "C|Clienti" + ITEM "F|Fornitori" + GROUP GR_CLIFO +END + +NUMBER F_CFFROM 6 +BEGIN + PROMPT 3 9 "Dal " + USE LF_CLIFO KEY 1 + INPUT TIPOCF F_TIPOCF SELECT + INPUT CODCF F_CFFROM + DISPLAY "Codice@6R" CODCF + DISPLAY "Ragione sociale@50" RAGSOC + OUTPUT F_CFFROM CODCF + CHECKTYPE NORMAL + GROUP GR_TUTTI GR_CLIFO +END + +NUMBER F_CFTO 6 +BEGIN + PROMPT 19 9 "Al " + USE LF_CLIFO KEY 1 + INPUT TIPOCF F_TIPOCF SELECT + INPUT CODCF F_CFTO + DISPLAY "Codice@6R" CODCF + DISPLAY "Ragione sociale@50" RAGSOC + OUTPUT F_CFTO CODCF + CHECKTYPE NORMAL + GROUP GR_TUTTI GR_CLIFO +END + +GROUPBOX DLG_NULL 30 4 +BEGIN + PROMPT 2 7 "Agente" + GROUP GR_TUTTI GR_AGE +END + +STRING F_AGEFROM 6 +BEGIN + PROMPT 3 8 "Dal " + FLAGS "U" + USE LF_AGENTI + INPUT CODAGE F_AGEFROM + DISPLAY "Codice" CODAGE + DISPLAY "Descr@50" RAGSOC + OUTPUT F_AGEFROM CODAGE + GROUP GR_TUTTI GR_AGE +END + +STRING F_AGETO 6 +BEGIN + PROMPT 3 9 "Al " + FLAGS "U" + COPY USE F_AGEFROM + INPUT CODAGE F_AGETO + COPY DISPLAY F_AGEFROM + OUTPUT F_AGETO CODAGE + GROUP GR_TUTTI GR_AGE +END + +GROUPBOX DLG_NULL 40 4 +BEGIN + PROMPT 35 7 "Data consegna" +END + +DATE F_CONSFROM +BEGIN + PROMPT 36 8 "Dal " +END + +DATE F_CONSTO +BEGIN + PROMPT 36 9 "Al " +END + + +BOOLEAN F_DETTAGLIO +BEGIN + PROMPT 3 11 "Dettaglio righe" +END + +BOOLEAN F_DETAIL_BY_CLI +BEGIN + PROMPT 37 11 "Ordina per cliente" + FLAGS "D" + GROUP GR_TUTTI +END + +LIST F_STATOORD 6 +BEGIN + PROMPT 3 12 "Tipo ordini " + ITEM "T|Tutti" + ITEM "E|Evasi" + ITEM "A|Aperti" +END + +BOOLEAN F_DETAIL_BY_DOC +BEGIN + PROMPT 37 12 "Dettaglio per documento" + FLAGS "D" + MESSAGE TRUE DISABLE,GR_DETAILART@ + MESSAGE FALSE ENABLE,GR_DETAILART@ + GROUP GR_DETAIL +END + +LIST F_STATORORD 6 +BEGIN + PROMPT 3 13 "Tipo righe ordini " + FLAGS "D" + GROUP GR_DETAIL + ITEM "T|Tutte" + MESSAGE DISABLE, F_FORCE_EVASE + ITEM "E|Evase" + MESSAGE ENABLE, F_FORCE_EVASE + ITEM "A|Aperte" + MESSAGE DISABLE, F_FORCE_EVASE +END + +NUMBER F_DETAIL_LEV 1 +BEGIN + PROMPT 37 13 "Livello dettaglio " + FLAGS "D" + GROUP GR_DETAILART + USE FCG + INPUT CODTAB F_DETAIL_LEV + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione livello@50" S0 + OUTPUT F_DETAIL_LEV CODTAB + CHECKTYPE NORMAL +END + +BOOLEAN F_FORCE_EVASE +BEGIN + PROMPT 3 14 "Stampa righe evase con residuo" + FLAGS "D" +END + +LIST F_RAGG_PER_ART 12 +BEGIN + PROMPT 37 14 "Periodo raggruppamento " + ITEM "0|Giornaliero" + ITEM "1|1 mese" + ITEM "2|2 mesi" + ITEM "3|3 mesi" + ITEM "4|4 mesi" + FLAGS "D" + GROUP GR_DETAILART +END + +GROUPBOX DLG_NULL 30 4 +BEGIN + PROMPT 2 15 "Articolo" +END + +STRING F_ARTFROM 20 +BEGIN + PROMPT 3 16 "Dal " + FLAGS "DU" + USE LF_ANAMAG + INPUT CODART F_ARTFROM + DISPLAY "Codice@20" CODART + DISPLAY "Descrizione@50" DESCR + OUTPUT F_ARTFROM CODART + ADD RUN ve2 -3 + GROUP GR_DETAIL GR_ART +END + +STRING F_ARTTO 20 +BEGIN + PROMPT 3 17 "Al " + FLAGS "DU" + USE LF_ANAMAG + INPUT CODART F_ARTTO + DISPLAY "Codice@20" CODART + DISPLAY "Descrizione@50" DESCR + OUTPUT F_ARTTO CODART + ADD RUN ve2 -3 + GROUP GR_DETAIL GR_ART +END + +GROUPBOX DLG_NULL 14 4 +BEGIN + PROMPT 35 15 "Cat. merc." + GROUP GR_CATMER +END + +STRING F_CATMERFROM 3 +BEGIN + PROMPT 36 16 "Dalla " + FLAGS "DU" + FIELD CODTAB[1,3] + KEY 1 + USE GMC SELECT CODTAB[4,5]=="" + INPUT CODTAB F_CATMERFROM + DISPLAY "Gruppo" CODTAB[1,3] + DISPLAY "Descrizione gruppo@50" S0 + OUTPUT F_CATMERFROM CODTAB[1,3] +// OUTPUT F_DESGRU S0 + CHECKTYPE NORMAL + GROUP GR_CATMER +END + +STRING F_CATMERTO 3 +BEGIN + PROMPT 36 17 "Alla " + FLAGS "DU" + FIELD CODTAB[1,3] + KEY 1 + USE GMC SELECT CODTAB[4,5]=="" + INPUT CODTAB F_CATMERTO + DISPLAY "Gruppo" CODTAB[1,3] + DISPLAY "Descrizione gruppo@50" S0 + OUTPUT F_CATMERTO CODTAB[1,3] +// OUTPUT F_DESGRU S0 + CHECKTYPE NORMAL + GROUP GR_CATMER +END + +BOOLEAN F_DETAIL_MAG +BEGIN + PROMPT 51 16 "Dettaglia magazzini" + FLAGS "D" + GROUP GR_DETAILART +END + +BOOLEAN F_DETAIL_DEP +BEGIN + PROMPT 51 17 "Dettaglia depositi" + FLAGS "D" + GROUP GR_DETAILART +END + +BOOLEAN F_OPZ_VALORE +BEGIN + PROMPT 3 19 "Visualizza colonne valori" +END + +BOOLEAN F_OPZ_PREZZO +BEGIN + PROMPT 3 20 "Visualizza colonna prezzo" + GROUP GR_DETAIL GR_ART +END + +BOOLEAN F_OPZ_RESIDUO +BEGIN + PROMPT 37 19 "Visualizza colonna residuo" + GROUP GR_DETAIL GR_ART +END + +BOOLEAN F_OPZ_GIACENZA +BEGIN + PROMPT 37 20 "Visualizza colonna giacenza" + GROUP GR_DETAIL GR_ART +END + +ENDPAGE + + +PAGE "Avanzate" -1 -1 78 20 + +GROUPBOX DLG_NULL 74 10 +BEGIN + PROMPT 1 1 "Livelli di giacenza" +END + +STRING F_GIAC1 1 +BEGIN + PROMPT 3 2 "1. " + FLAGS "D" + USE FCG + INPUT CODTAB[1,1] F_GIAC1 + OUTPUT F_GIAC1_DES S0 + CHECKTYPE NORMAL +END + +STRING F_GIAC1_DES 60 +BEGIN + PROMPT 12 2 "" + FLAGS "D" +END + +STRING F_GIAC1_FROM 24 +BEGIN + PROMPT 12 3 "Da " + FLAGS "D" + KEY 1 + USE GCG SELECT CODTAB[1,1]=#F_GIAC1 + JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1] + INPUT CODTAB[1,1] F_GIAC1 + INPUT CODTAB[2,25] F_GIAC1_FROM + DISPLAY "N.Liv." CODTAB[1,1] + DISPLAY "Livello@20 " 500@->S0 + DISPLAY "Codice@23" CODTAB[2,25] + DISPLAY "Descrizione@50 " GCG->S0 + OUTPUT F_GIAC1_FROM CODTAB[2,25] + CHECKTYPE SEARCH + GROUP GR_DETAIL GR_GIAC +END + +STRING F_GIAC1_TO 23 +BEGIN + PROMPT 47 3 "A " + FLAGS "D" + KEY 1 + USE GCG SELECT CODTAB[1,1]=#F_GIAC1 + JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1] + INPUT CODTAB[1,1] F_GIAC1 + INPUT CODTAB[2,25] F_GIAC1_TO + DISPLAY "N.Liv." CODTAB[1,1] + DISPLAY "Livello@20 " 500@->S0 + DISPLAY "Codice@23" CODTAB[2,25] + DISPLAY "Descrizione@50 " GCG->S0 + OUTPUT F_GIAC1_TO CODTAB[2,25] + CHECKTYPE SEARCH + GROUP GR_DETAIL GR_GIAC +END + +STRING F_GIAC2 1 +BEGIN + PROMPT 3 4 "2. " + FLAGS "D" + USE FCG + INPUT CODTAB[1,1] F_GIAC2 + OUTPUT F_GIAC2_DES S0 + CHECKTYPE NORMAL +END + +STRING F_GIAC2_DES 60 +BEGIN + PROMPT 12 4 "" + FLAGS "D" +END + +STRING F_GIAC2_FROM 23 +BEGIN + PROMPT 12 5 "Da " + FLAGS "D" + KEY 1 + USE GCG SELECT CODTAB[1,1]=#F_GIAC2 + JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1] + INPUT CODTAB[1,1] F_GIAC2 + INPUT CODTAB[2,25] F_GIAC2_FROM + DISPLAY "N.Liv." CODTAB[1,1] + DISPLAY "Livello@20 " 500@->S0 + DISPLAY "Codice@23" CODTAB[2,25] + DISPLAY "Descrizione@50 " GCG->S0 + OUTPUT F_GIAC2_FROM CODTAB[2,25] + CHECKTYPE SEARCH + GROUP GR_DETAIL GR_GIAC +END + +STRING F_GIAC2_TO 23 +BEGIN + PROMPT 47 5 "A " + FLAGS "D" + KEY 1 + USE GCG SELECT CODTAB[1,1]=#F_GIAC2 + JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1] + INPUT CODTAB[1,1] F_GIAC2 + INPUT CODTAB[2,25] F_GIAC2_TO + DISPLAY "N.Liv." CODTAB[1,1] + DISPLAY "Livello@20 " 500@->S0 + DISPLAY "Codice@23" CODTAB[2,25] + DISPLAY "Descrizione@50 " GCG->S0 + OUTPUT F_GIAC2_TO CODTAB[2,25] + CHECKTYPE SEARCH + GROUP GR_DETAIL GR_GIAC +END + +STRING F_GIAC3 1 +BEGIN + PROMPT 3 6 "3. " + USE FCG + INPUT CODTAB[1,1] F_GIAC3 + OUTPUT F_GIAC3_DES S0 + CHECKTYPE NORMAL + FLAGS "D" +END + +STRING F_GIAC3_DES 60 +BEGIN + PROMPT 12 6 "" + FLAGS "D" +END + +STRING F_GIAC3_FROM 23 +BEGIN + PROMPT 12 7 "Da " + FLAGS "D" + KEY 1 + USE GCG SELECT CODTAB[1,1]=#F_GIAC3 + JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1] + INPUT CODTAB[1,1] F_GIAC3 + INPUT CODTAB[2,25] F_GIAC3_FROM + DISPLAY "N.Liv." CODTAB[1,1] + DISPLAY "Livello@20 " 500@->S0 + DISPLAY "Codice@23" CODTAB[2,25] + DISPLAY "Descrizione@50 " GCG->S0 + OUTPUT F_GIAC3_FROM CODTAB[2,25] + CHECKTYPE SEARCH + GROUP GR_DETAIL GR_GIAC +END + +STRING F_GIAC3_TO 23 +BEGIN + PROMPT 47 7 "A " + FLAGS "D" + KEY 1 + USE GCG SELECT CODTAB[1,1]=#F_GIAC3 + JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1] + INPUT CODTAB[1,1] F_GIAC3 + INPUT CODTAB[2,25] F_GIAC3_TO + DISPLAY "N.Liv." CODTAB[1,1] + DISPLAY "Livello@20 " 500@->S0 + DISPLAY "Codice@23" CODTAB[2,25] + DISPLAY "Descrizione@50 " GCG->S0 + OUTPUT F_GIAC3_TO CODTAB[2,25] + CHECKTYPE SEARCH + GROUP GR_DETAIL GR_GIAC +END + +STRING F_GIAC4 1 +BEGIN + PROMPT 3 8 "4. " + USE FCG + INPUT CODTAB[1,1] F_GIAC4 + OUTPUT F_GIAC4_DES S0 + CHECKTYPE NORMAL + FLAGS "D" +END + +STRING F_GIAC4_DES 60 +BEGIN + PROMPT 12 8 "" + FLAGS "D" +END + +STRING F_GIAC4_FROM 23 +BEGIN + PROMPT 12 9 "Da " + FLAGS "D" + KEY 1 + USE GCG SELECT CODTAB[1,1]=#F_GIAC4 + JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1] + INPUT CODTAB[1,1] F_GIAC4 + INPUT CODTAB[2,25] F_GIAC4_FROM + DISPLAY "N.Liv." CODTAB[1,1] + DISPLAY "Livello@20 " 500@->S0 + DISPLAY "Codice@23" CODTAB[2,25] + DISPLAY "Descrizione@50 " GCG->S0 + OUTPUT F_GIAC4_FROM CODTAB[2,25] + CHECKTYPE SEARCH + GROUP GR_DETAIL GR_GIAC +END + +STRING F_GIAC4_TO 23 +BEGIN + PROMPT 47 9 "A " + FLAGS "D" + KEY 1 + USE GCG SELECT CODTAB[1,1]=#F_GIAC4 + JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1] + INPUT CODTAB[1,1] F_GIAC4 + INPUT CODTAB[2,25] F_GIAC4_TO + DISPLAY "N.Liv." CODTAB[1,1] + DISPLAY "Livello@20 " 500@->S0 + DISPLAY "Codice@23" CODTAB[2,25] + DISPLAY "Descrizione@50 " GCG->S0 + OUTPUT F_GIAC4_TO CODTAB[2,25] + GROUP GR_DETAIL GR_GIAC + GROUP GR_DETAIL +END + +BOOLEAN F_PRINTSPESE +BEGIN + PROMPT 2 12 "Includi le righe spese" + GROUP GR_PRINT +END + +BOOLEAN F_PRINTPREST +BEGIN + PROMPT 2 13 "Includi le righe prestazioni" + GROUP GR_PRINT +END + +BOOLEAN F_PRINTDESCR +BEGIN + PROMPT 2 14 "Includi le righe descrizione" + GROUP GR_PRINT +END + +BOOLEAN F_PRINTSCONTI +BEGIN + PROMPT 36 12 "Includi le righe sconti" + GROUP GR_PRINT +END + +BOOLEAN F_PRINTOMAGGI +BEGIN + PROMPT 36 13 "Includi le righe omaggio" + GROUP GR_PRINT +END + +GROUPBOX DLG_NULL 32 4 +BEGIN + PROMPT 1 16 "Magazzino" + GROUP GR_PRINT +END + +STRING F_MAGFROM 3 +BEGIN + PROMPT 3 17 "Dal " + FLAGS "DU" + USE MAG SELECT CODTAB[4,5]=="" + INPUT CODTAB F_MAGFROM + DISPLAY "Codice " CODTAB[1,3] + DISPLAY "Denominazione mag.@50 " S0 + OUTPUT F_MAGFROM CODTAB[1,3] + CHECKTYPE NORMAL + GROUP GR_DETAIL GR_MAG +END + +STRING F_MAGTO 3 +BEGIN + PROMPT 3 18 "Al " + FLAGS "DU" + USE MAG SELECT CODTAB[4,5]=="" + INPUT CODTAB F_MAGTO + DISPLAY "Codice " CODTAB[1,3] + DISPLAY "Denominazione mag.@50 " S0 + OUTPUT F_MAGTO CODTAB[1,3] + CHECKTYPE NORMAL + GROUP GR_DETAIL GR_MAG +END + +GROUPBOX DLG_NULL 40 4 +BEGIN + PROMPT 35 16 "Deposito" +END + +STRING F_DEPFROM 2 +BEGIN + PROMPT 36 17 "Dal " + FLAGS "DU" + USE MAG SELECT CODTAB[4,5]!="" + INPUT CODTAB[1,3] F_MAGFROM + INPUT CODTAB[4,5] F_DEPFROM + DISPLAY "Codice " CODTAB + DISPLAY "Denominazione dep.@50 " S0 + OUTPUT F_MAGFROM CODTAB[1,3] + OUTPUT F_DEPFROM CODTAB[4,5] + CHECKTYPE NORMAL + GROUP GR_DETAIL GR_MAG +END + +STRING F_DEPTO 2 +BEGIN + PROMPT 36 18 "Al " + FLAGS "DU" + USE MAG SELECT CODTAB[4,5]!="" + INPUT CODTAB[1,3] F_MAGTO + INPUT CODTAB[4,5] F_DEPTO + DISPLAY "Codice " CODTAB + DISPLAY "Denominazione mag.@50 " S0 + OUTPUT F_MAGTO CODTAB[1,3] + OUTPUT F_DEPTO CODTAB[4,5] + CHECKTYPE NORMAL + GROUP GR_DETAIL GR_MAG +END + +ENDPAGE + +ENDMASK + diff --git a/or/or1100b.frm b/or/or1100b.frm index f8d68df88..d11f8d6d8 100755 --- a/or/or1100b.frm +++ b/or/or1100b.frm @@ -205,6 +205,7 @@ SECTION DOCUMENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_CLIFO->TIPOCF+LF_CLIFO->CODCF+ DRIVENBY 103 MESSAGE _ORDINE,VALTABLE,VALORD FLAGS "D" +// PICTURE "." END VALUTA 106 15 @@ -215,10 +216,11 @@ SECTION DOCUMENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_CLIFO->TIPOCF+LF_CLIFO->CODCF+ DRIVENBY 103 MESSAGE _ORDINE,VALTABLE,VALRES FLAGS "D" +// PICTURE "." END - SECTION RIGHEDOC 2 1 1 FILE LF_RIGHEDOC GROUP NDOC // changes into CODART grouping + SECTION RIGHEDOC 2 1 1 FILE LF_RIGHEDOC GROUP ANNO+NDOC // changes into CODART grouping FLAGS "D" // Da abilitare solo su dettaglio righe NUMBER 201 10 diff --git a/or/or1100bp.frm b/or/or1100bp.frm new file mode 100755 index 000000000..033881abf --- /dev/null +++ b/or/or1100bp.frm @@ -0,0 +1,685 @@ +// Form per la stampa ordini per cliente/fornitore +#include "or1100a.h" +// Cursor sorting on main file is set also in application +USE LF_RIGHEDOC BY LF_DOC->TIPOCF LF_DOC->CODCF LF_DOC->OCFPI ANNO CODNUM NDOC CODART DATACONS +JOIN LF_DOC INTO CODNUM==CODNUM ANNO==ANNO PROVV==PROVV NDOC==NDOC +JOIN LF_ANAMAG INTO CODART==CODART +JOIN LF_CLIFO TO LF_DOC INTO TIPOCF==TIPOCF CODCF==CODCF +END + +DESCRIPTION +BEGIN +END + + +GENERAL +BEGIN + OFFSET 0 0 +END + + +SECTION HEADER ODD 6 + +STRINGA 1 40 1 +BEGIN + KEY "nome ditta" + PROMPT 1 1 "Ditta " + MESSAGE _DITTA, !RAGSOC +END + +STRINGA 2 10 +BEGIN + KEY "Data" + PROMPT 76 1 "Data " + MESSAGE _TODAY +END + +NUMERO 3 7 +BEGIN + KEY "Nr. pagina" + PROMPT 92 1 "Pagina " + MESSAGE _PAGENO +END + +NUMERO 4 40 +BEGIN + KEY "Intestazione stampa" + PROMPT 25 2 "@b Stampa ordini pianificati e pianificati/confermati" +END + +END //HEADER + + +SECTION BODY ODD 4 COLUMNWISE + +NUMBER BODY_COL_1 10 +BEGIN + SPECIAL STRINGA INTESTAZIONE "Codice" "Codice" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "X " "Fincatura sinistra e destra" + KEY "Codice" + PROMPT 1 1 "@B" + FIELD LF_DOC->CODCF + MESSAGE _ORDINE,VALTABLE,RESET + PICTURE "########" +END + +STRING BODY_COL_2 40 +BEGIN + SPECIAL STRINGA INTESTAZIONE "Descrizione" "Descrizione" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA " X" "Fincatura sinistra e destra" + KEY "Descrizione Rag Soc" + PROMPT 2 1 "" + MESSAGE _ORDINE,RAGSOC,0 +END + +STRINGA BODY_COL_3 4 +BEGIN + SPECIAL STRINGA INTESTAZIONE "Val." "Val." + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Codice Valuta" + PROMPT 3 1 "" +END + + + +VALUTA BODY_COL_5 15 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@CValore" "Valore" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Valore" + DRIVENBY BODY_COL_3 + PROMPT 5 1 "" +END + +VALUTA BODY_COL_6 15 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@CVal.Residuo" "Val.Residuo" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Valore Residuo" + DRIVENBY BODY_COL_3 + PROMPT 6 1 "" +END + +STRINGA BODY_COL_7 4 +BEGIN + SPECIAL STRINGA INTESTAZIONE "UM" "UM" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Unita' di misura" // Solo intestazione + FLAGS "H" + PROMPT 7 1 "" + GROUP G_DETTAGLIO +END + +STRINGA BODY_COL_8 15 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@CFabbisogno" "Fabbisogno" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Q.ta Ordinata" // Solo intestazione + FLAGS "H" + PROMPT 8 1 "" + GROUP G_DETTAGLIO +END + +STRINGA BODY_COL_9 15 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@COrdinato" "Ordinato" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Q.ta Evasa" // Solo intestazione + FLAGS "H" + PROMPT 9 1 "" + GROUP G_DETTAGLIO +END + +STRINGA BODY_COL_10 13 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@CPr. scontato" "Prezzo un. scontato" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Prezzo un. scontato" // Solo intestazione + FLAGS "H" + PROMPT 10 1 "" + GROUP G_DETTAGLIO +END + +STRINGA BODY_COL_11 15 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@CDa ordinare" "Da ordinare" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Residuo" // Solo intestazione + FLAGS "H" + PROMPT 11 1 "" + GROUP G_DETTAGLIO +END + +STRINGA BODY_COL_12 15 +BEGIN + SPECIAL STRINGA INTESTAZIONE "@CGiac. Att." "Giacenza attuale" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Giacenza attuale" // Solo intestazione + FLAGS "H" + PROMPT 12 1 "" + GROUP G_DETTAGLIO +END + + +DATA BODY_COL_4 10 +BEGIN + SPECIAL STRINGA INTESTAZIONE "Dat. cons." "Dat. cons." + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" + KEY "Data consegna documento" + PROMPT 13 1 "" +END + +// Raggruppamento righe documenti per lo stesso cli/fo +SECTION DOCUMENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_CLIFO->TIPOCF+LF_CLIFO->CODCF+LF_DOC->OCFPI + + NUMBER 101 10 + BEGIN + PROMPT 1 1 "" + FLAGS "H" + MESSAGE RESET,G_TOTALEART@ + END + + STRING 102 40 2 + BEGIN + KEY "Descrizione documento" + PROMPT 2 1 "" + MESSAGE _STREXPR,"*Doc. "+LF_DOC->CODNUM+"/"+LF_DOC->ANNO+"-"+LF_DOC->NDOC+" del "+LF_DOC->DATADOC + FLAGS "D" + END + + STRING 103 4 + BEGIN + KEY "Codice Valuta" + PROMPT 3 1 "" + FIELD LF_DOC->CODVAL + FLAGS "D" + END + + + + VALUTA 105 15 + BEGIN + KEY "Valore Ordinato" + PROMPT 5 1 "" + FIELD LF_DOC->TOTVALORE + DRIVENBY 103 + MESSAGE _ORDINE,VALTABLE,VALORD + FLAGS "D" +// PICTURE "." + END + + VALUTA 106 15 + BEGIN + KEY "Valore Residuo" + PROMPT 6 1 "" + FIELD LF_DOC->TOTVALRES + DRIVENBY 103 + MESSAGE _ORDINE,VALTABLE,VALRES + FLAGS "D" +// PICTURE "." + END + + DATA 104 10 + BEGIN + KEY "Data consegna documento" + PROMPT 10 1 "" + FLAGS "D" + FIELD LF_DOC->DATACONS + END + + + SECTION RIGHEDOC 2 1 1 FILE LF_RIGHEDOC GROUP NDOC // changes into CODART grouping + FLAGS "D" // Da abilitare solo su dettaglio righe + + NUMBER 201 10 + BEGIN + PROMPT 1 1 "" + END + STRING 202 40 2 + BEGIN + KEY "Descrizione articolo" + PROMPT 2 1 "" + MESSAGE _STREXPR,"**Art. "+LF_RIGHEDOC->CODART+" "+LF_ANAMAG->DESCR + END + STRING 203 4 + BEGIN + KEY "Codice Valuta" + PROMPT 3 1 "" + END + DATA 204 10 + BEGIN + KEY "Data consegna articolo" + PROMPT 13 1 "" + FIELD LF_RIGHEDOC->DATACONS + END + VALUTA 205 15 + BEGIN + KEY "Valore Ordinato" + PROMPT 5 1 "" + FIELD LF_RIGHEDOC->RIGAVALORE + DRIVENBY 203 +// PICTURE "." + END + VALUTA 206 15 + BEGIN + KEY "Valore Residuo" + PROMPT 6 1 "" + FIELD LF_RIGHEDOC->RIGAVALRES + DRIVENBY 203 +// PICTURE "." + END + STRINGA 207 4 + BEGIN + KEY "Unita' di misura" + PROMPT 7 1 "" + FIELD LF_RIGHEDOC->UMQTA + END + NUMBER 208 15 + BEGIN + KEY "Q.ta Ordinata" + PROMPT 8 1 "" + FIELD LF_RIGHEDOC->QTA + PICTURE "########@,@@@@@" + END + NUMBER 209 15 + BEGIN + KEY "Q.ta Evasa" + PROMPT 9 1 "" + FIELD LF_RIGHEDOC->QTAEVASA + PICTURE "########@,@@@@@" + END + VALUTA 210 13 + BEGIN + KEY "Pr. Scontato" + PROMPT 10 1 "" + MESSAGE _ORDINE,PREZZONS +// PICTURE "." + DRIVENBY 203 + FLAGS "U" + END + NUMBER 211 15 + BEGIN + PROMPT 11 1 "" // Residuo + PICTURE "########@,@@@@@" + MESSAGE _ORDINE,RESIDUO + END + NUMBER 212 15 + BEGIN + PROMPT 12 1 "" // Giacenza attuale + PICTURE "########@,@@@@@" + MESSAGE _ORDINE,GIACENZA + END + END // END SECTION RIGHEDOC + + // Ecco la sezione per il resto + + SECTION RIGHEART 1 0 0 FILE LF_RIGHEDOC GROUP CODVAL+CODART+DATACONS + FLAGS "D" + NUMBER 301 10 + BEGIN + PROMPT 1 1 "" + FLAGS "H" + END + STRING 302 40 2 + BEGIN + KEY "Descrizione" + PROMPT 2 1 "" + MESSAGE _ORDINE,DESCRIZIONE|COPY,402 + FLAGS "H" + END + STRING 303 4 + BEGIN + KEY "Codice Valuta" + PROMPT 3 1 "" + FIELD LF_DOC->CODVAL + MESSAGE COPY,403 + FLAGS "H" + END + DATA 304 10 + BEGIN + KEY "Data consegna articolo" + PROMPT 13 1 "" + FIELD LF_RIGHEDOC->DATACONS + MESSAGE COPY,404 + FLAGS "H" + END + VALUTA 305 15 + BEGIN + KEY "Valore Ordinato" + PROMPT 5 1 "" + FIELD LF_RIGHEDOC->RIGAVALORE + MESSAGE _ORDINE,VALTABLE,VALORD|ADD,405 +// PICTURE "." + DRIVENBY 303 + FLAGS "H" + END + VALUTA 306 15 + BEGIN + KEY "Valore Residuo" + PROMPT 6 1 "" + FIELD LF_RIGHEDOC->RIGAVALRES +// PICTURE "." + DRIVENBY 303 + FLAGS "H" + MESSAGE _ORDINE,VALTABLE,VALRES|ADD,406 + END + STRINGA 307 4 + BEGIN + KEY "Unita' di misura" + PROMPT 7 1 "" + FIELD LF_RIGHEDOC->UMQTA + MESSAGE _ORDINE,SELECTUM|COPY,407 + FLAGS "H" + END + NUMBER 308 15 + BEGIN + KEY "Q.ta Ordinata" + PROMPT 8 1 "" + FIELD LF_RIGHEDOC->QTA + MESSAGE _ORDINE,CONVUM|ADD,408 + FLAGS "H" + END + NUMBER 309 15 + BEGIN + KEY "Q.ta Evasa" + PROMPT 9 1 "" + FIELD LF_RIGHEDOC->QTAEVASA + MESSAGE _ORDINE,CONVUM|ADD,409 + FLAGS "H" + END + VALUTA 310 13 + BEGIN + KEY "Prezzo non scontato" + PROMPT 10 1 "" + MESSAGE _ORDINE,PREZZONS|COPY,410 + DRIVENBY 303 + FLAGS "HU" + END + NUMBER 311 15 + BEGIN + KEY " Residuo" + PROMPT 11 1 "" + MESSAGE _ORDINE,RESIDUO|_ORDINE,CONVUM|ADD,411 + FLAGS "H" + END + NUMBER 312 15 + BEGIN + KEY "Giacenza attuale" + PROMPT 12 1 "" + MESSAGE _ORDINE,GIACENZA|COPY,412 + FLAGS "H" + END + END // END SECTION RIGHEART + + // Totalizers for previous section + NUMBER 401 10 + BEGIN + PROMPT 1 1 "" + FLAGS "D" + END + STRING 402 40 2 + BEGIN + KEY "Descrizione" + PROMPT 2 1 "" + FLAGS "D" + END + STRING 403 4 + BEGIN + KEY "Codice Valuta" + PROMPT 3 1 "" + FLAGS "D" + END + DATA 404 10 + BEGIN + KEY "Data consegna articolo" + PROMPT 13 1 "" + FLAGS "D" + END + VALUTA 405 15 + BEGIN + KEY "Valore Ordinato" + PROMPT 5 1 "" +// PICTURE "." + FLAGS "D" + DRIVENBY 403 + GROUP G_TOTALEART + END + VALUTA 406 15 + BEGIN + KEY "Valore Residuo" + PROMPT 6 1 "" +// PICTURE "." + FLAGS "D" + DRIVENBY 403 + GROUP G_TOTALEART + END + STRINGA 407 4 + BEGIN + KEY "Unita' di misura" + PROMPT 7 1 "" + FLAGS "D" + GROUP G_TOTALEART + END + NUMBER 408 15 + BEGIN + KEY "Q.ta Ordinata" + PROMPT 8 1 "" + PICTURE "########@,@@@@@" + FLAGS "D" + GROUP G_TOTALEART + END + NUMBER 409 15 + BEGIN + KEY "Q.ta Evasa" + PROMPT 9 1 "" + PICTURE "########@,@@@@@" + FLAGS "D" + GROUP G_TOTALEART + END + VALUTA 410 13 + BEGIN + KEY "Pr. non scontato" + PROMPT 10 1 "" +// PICTURE "." + DRIVENBY 403 + FLAGS "DU" + GROUP G_TOTALEART + END + NUMBER 411 15 + BEGIN + KEY "Residuo" + PROMPT 11 1 "" + PICTURE "########@,@@@@@" + FLAGS "D" + GROUP G_TOTALEART + END + NUMBER 412 15 + BEGIN + KEY "Giac. attuale" + PROMPT 12 1 "" + PICTURE "########@,@@@@@" + FLAGS "D" + GROUP G_TOTALEART + END + +END // END SECTION DOCUMENTI + +// Sezioni di totalizzazione per Valuta (4, shown & hidden at runtime by VALTABLE messages in application code) + +SECTION TOTVAL1 3 0 1 GROUP +FLAGS "D" + NUMBER 51 10 + BEGIN + PROMPT 1 1 "" + END + + STRING 52 40 + BEGIN + PROMPT 2 1 "" + END + + STRINGA 53 4 + BEGIN + KEY "Codice valuta #1" + PROMPT 3 1 "" + END + + DATA 54 10 + BEGIN + PROMPT 13 1 "" + END + + VALUTA 55 15 + BEGIN + KEY "Tot Valore Ordinato per cli/fo" + PROMPT 5 1 "" +// PICTURE "." + DRIVENBY 53 + END + + VALUTA 56 15 + BEGIN + KEY "Tot Valore Residuo per cli/fo" + PROMPT 6 1 "" +// PICTURE "." + DRIVENBY 53 + END +END // Fine sezione totale in valuta #1 + + +SECTION TOTVAL2 1 0 1 GROUP +FLAGS "D" + NUMBER 61 10 + BEGIN + PROMPT 1 1 "" + END + + STRING 62 40 + BEGIN + PROMPT 2 1 "" + END + + STRINGA 63 4 + BEGIN + KEY "Codice valuta #2" + PROMPT 3 1 "" + END + + DATA 64 10 + BEGIN + PROMPT 13 1 "" + END + + VALUTA 65 15 + BEGIN + KEY "Tot Valore Ordinato per cli/fo" + PROMPT 5 1 "" +// PICTURE "." + DRIVENBY 63 + END + + VALUTA 66 15 + BEGIN + KEY "Tot Valore Residuo per cli/fo" + PROMPT 6 1 "" +// PICTURE "." + DRIVENBY 63 + END +END // Fine sezione totale in valuta #2 + + +SECTION TOTVAL3 1 0 1 GROUP +FLAGS "D" + NUMBER 71 10 + BEGIN + PROMPT 1 1 "" + END + + STRING 72 40 + BEGIN + PROMPT 2 1 "" + END + + STRINGA 73 4 + BEGIN + KEY "Codice valuta #3" + PROMPT 3 1 "" + END + + DATA 74 10 + BEGIN + PROMPT 13 1 "" + END + + VALUTA 75 15 + BEGIN + KEY "Tot Valore Ordinato per cli/fo" + PROMPT 5 1 "" +// PICTURE "." + DRIVENBY 73 + END + + VALUTA 76 15 + BEGIN + KEY "Tot Valore Residuo per cli/fo" + PROMPT 6 1 "" +// PICTURE "." + DRIVENBY 73 + END +END // Fine sezione totale in valuta #3 + +SECTION TOTVAL4 1 0 1 GROUP +FLAGS "D" + NUMBER 81 10 + BEGIN + PROMPT 1 1 "" + END + + STRING 82 40 + BEGIN + PROMPT 2 1 "" + END + + STRINGA 83 4 + BEGIN + KEY "Codice valuta #4" + PROMPT 3 1 "" + END + + DATA 84 10 + BEGIN + PROMPT 13 1 "" + END + + VALUTA 85 15 + BEGIN + KEY "Tot Valore Ordinato per cli/fo" + PROMPT 5 1 "" +// PICTURE "." + DRIVENBY 83 + END + + VALUTA 86 15 + BEGIN + KEY "Tot Valore Residuo per cli/fo" + PROMPT 6 1 "" +// PICTURE "." + DRIVENBY 83 + END +END // Fine sezione totale in valuta #4 + +END // End of Body + + diff --git a/or/or1100c.frm b/or/or1100c.frm index 647d0c5f5..1d3b9ea59 100755 --- a/or/or1100c.frm +++ b/or/or1100c.frm @@ -221,7 +221,7 @@ SECTION AGENTI 2 1 1 FILE LF_RIGHEDOC GROUP LF_DOC->CODAG END // Raggruppamento righe stesso documento - SECTION RIGHEDOC 2 1 1 FILE LF_RIGHEDOC GROUP NDOC + SECTION RIGHEDOC 2 1 1 FILE LF_RIGHEDOC GROUP ANNO+NDOC FLAGS "D" // Da abilitare solo su dettaglio righe NUMBER 201 10 BEGIN diff --git a/or/or1100d.frm b/or/or1100d.frm index fc3bf3687..5bda62345 100755 --- a/or/or1100d.frm +++ b/or/or1100d.frm @@ -1,7 +1,7 @@ // Form per la stampa ordini per articolo #include "or1100a.h" // Cursor sorting on main file is set also in application -USE LF_RIGHEDOC BY CODART CODNUM NDOC CODART DATACONS +USE LF_RIGHEDOC BY CODART LIVELLO CODMAG ANNO NDOC DATACONS JOIN LF_DOC INTO CODNUM==CODNUM ANNO==ANNO PROVV==PROVV NDOC==NDOC JOIN LF_ANAMAG INTO CODART==CODART END @@ -146,9 +146,16 @@ END // Raggruppamento righe documenti per lo stesso codice articolo SECTION ARTMAIN 2 1 1 FILE LF_RIGHEDOC GROUP CODART -SECTION ARTICOLI 1 0 0 FILE LF_RIGHEDOC GROUP CODVAL+DATACONS - FLAGS "D" - NUMBER 301 10 + STRING 201 20 + BEGIN + FLAGS "H" + PROMPT 1 1 "" + MESSAGE RESET,G_TOTALEART@ + END + +SECTION ARTICOLI 1 0 0 FILE LF_RIGHEDOC GROUP ANNO+NDOC+CODVAL+DATACONS +// FLAGS "D" + NUMBER 301 20 BEGIN PROMPT 1 1 "" FLAGS "H" diff --git a/or/or1100p.cpp b/or/or1100p.cpp new file mode 100755 index 000000000..a341167f5 --- /dev/null +++ b/or/or1100p.cpp @@ -0,0 +1,1063 @@ +// Stampa ordini +#include +#include +#include +#include "orlib.h" +#include "or1100ap.h" + +// Tipi di stampa per selezionare il form +enum tipo_stampa { + numero, // or1100a.frm + clifo, // or1100b.frm + agente, // or1100c.frm + articolo // or1100d.frm +}; + +// Tipi di ordinamento +enum tipo_ord { + num_doc, // ordinamento per numero documento + data_doc // ordinamento per data documento +}; + +// Applicazione di stampa + +class TStampa_ordini : public TSkeleton_application +{ + TMask * _m; + TOrdine_form * _frm; + TTable * _fcg; + tipo_stampa _tipo; + TCodgiac_livelli *_codgiac; + TAssoc_array _tipi_riga; // Cache dei tipi riga attivati: tipo M, S, P, C, O D + TString _codnum; + int _anno; + char _provv, _tipocf, + _TEA_ord, _TEA_rord; // Tipi ordini/righe 'T'utti/'E'vasi/'A'perti + tipo_ord _order; + bool _detail_rows, _detail_doc, _detail_cli, _detail_mag, _detail_dep, + _pr_spese, _pr_prest, _pr_sconti, _pr_omaggi, _pr_descr, + _opz_valore, _opz_prezzo, _opz_residuo, _opz_giacenza, + _force_evase; + int _detail_level; //0..4 0 = Articoli 4 = FCG #4 Maximum detail level + TString _from_age, _to_age, + _from_art, _to_art, + _from_cat, _to_cat, + _from_mag, _to_mag, + _from_dep, _to_dep; + TString_array + _from_giac, _to_giac; + long _from_ndoc, _to_ndoc, + _from_cf, _to_cf; + TDate _from_date, _to_date, + _from_cons, _to_cons; + TArray _file; + +protected: + static bool stato_handler(TMask_field& f, KEY k); + static bool detail_handler(TMask_field& f, KEY k); + virtual bool create(); + virtual bool destroy(); + virtual void main_loop(); + void set_totvaluta_items(); + void filter_for_number(); + void filter_for_clifo_agent(); + void filter_for_articolo(); +public: + TStampa_ordini() {}; + virtual ~TStampa_ordini() {}; +}; + +inline TStampa_ordini& app() { return (TStampa_ordini&) main_app();} + +bool TStampa_ordini::stato_handler(TMask_field& f, KEY k) +{ + if (f.to_check(k)) + { + TMask& m = f.mask(); + const char v = f.get()[0]; + const bool b = m.get_bool(F_DETTAGLIO); + if (v == 'E' && b) // Se si seleziona la stampa degli ordini totalmente evasi ha senso stampare solo le righe evase, cioe' tutte + { + m.set(F_STATORORD, "T"); + m.disable(F_STATORORD); + } + else + if (b) // Qualsiasi altro tipo di stampa dettaglio righe puo' essere selezionata + m.enable(F_STATORORD); + } + return TRUE; +} + +bool TStampa_ordini::detail_handler(TMask_field& f, KEY k) +{ + if (k == K_SPACE) + { + TMask& m = f.mask(); + const bool b = m.get_bool(F_DETTAGLIO); + const tipo_stampa tipo = (tipo_stampa) m.get_int(F_TIPO); + + if (tipo != numero) + { + m.enable(-GR_DETAIL,b); + m.enable(F_STATOORD,!b); + m.reset(-GR_PRINT); + m.disable(-GR_PRINT); + //if (tipo != articolo) + // m.set(F_DETAIL_BY_DOC, !b ? "" : "X"); + } + else + { + m.enable(-GR_ART,b); + m.enable(-GR_MAG,b); + m.enable(-GR_PRINT, b); + m.enable(F_STATORORD,b); + m.enable(F_DETAIL_BY_DOC, b); + //m.enable(F_STATOORD); + } + m.enable(F_STATOORD,!b); + if (tipo != articolo) + m.set(F_DETAIL_BY_DOC, !b ? "" : "X"); + if (!b) + { + m.reset(F_FORCE_EVASE); + m.disable(F_FORCE_EVASE); + } + m.enable(-GR_CATMER,b && tipo == clifo); + } + return TRUE; +} + +bool TStampa_ordini::create() +{ + open_files(LF_OCCAS, LF_CLIFO, LF_INDSP, LF_CFVEN, LF_UMART, LF_MAG, LF_STOMAG, LF_MOVMAG, LF_RMOVMAG, LF_RIGHEDOC, 0); + _m = new TMask ("or1100ap"); + //_m->set_handler(F_STATOORD, stato_handler); + _m->set_handler(F_DETTAGLIO, detail_handler); + _fcg = new TTable("FCG"); + _codgiac = new TCodgiac_livelli; + if (!_codgiac->enabled()) + { + _m->disable(F_DETAIL_LEV); + _m->hide(-GR_GIAC); + } + + short id = F_GIAC1; + for (_fcg->first(); _fcg->good(); _fcg->next(), id+=4) + _m->set(id, _fcg->get("CODTAB")); + + // Carica i tipi riga dalla tabella TRI + TTable tri ("%TRI"); + for (tri.first(); !tri.eof(); tri.next()) + { + TString* ss = new TString(tri.get("CODTAB")); + _tipi_riga.add(tri.get("S7"), ss); + } + + return TSkeleton_application::create(); +} + +bool TStampa_ordini::destroy() +{ + delete _m; + delete _fcg; + delete _codgiac; + return TSkeleton_application::destroy(); +} + +// Abilita disabilita i campi per i totali in valuta presenti alla fine del body +// per quel che riguarda le stampe per cli/fo/agenti/articoli +void TStampa_ordini::set_totvaluta_items() +{ + TString16 sec_name; + + for (int i = 1; i<=4; i++) + { + sec_name = "TOTVAL"; + sec_name << i; + TForm_subsection& asec = (TForm_subsection&)_frm->find_field('B', odd_page, sec_name); + short id = BODY_TOTVALORD + ((i-1) * 10); + asec.printsection().find_field(id).show(_opz_valore); + asec.printsection().find_field(id + 1).show(_opz_valore); + } +} + +void TStampa_ordini::filter_for_number() +{ + CHECK(_frm, "Form non valido"); + + TCursor* cur = _frm->cursor(); + + cur->setkey(_order == num_doc ? 1 : 3); // Selezione per numero doc o data emissione + + TRectype f(LF_DOC), t(LF_DOC); + TString filter_expr,s, lev_str, mag_str; + + filter_expr << "(TIPOCF==\"" << _tipocf << "\")"; + if (_order == num_doc) + { + f.put(DOC_PROVV, _provv); + f.put(DOC_ANNO, _anno); + f.put(DOC_CODNUM, _codnum); + t = f; + f.put(DOC_NDOC, _from_ndoc); + t.put(DOC_NDOC, _to_ndoc); + } + else + { + f.put(DOC_DATADOC, _from_date); + t.put(DOC_DATADOC, _to_date); + filter_expr << " && (PROVV==\"" << _provv << "\")"; + if (_anno != 0) + filter_expr << " && (ANNO==\"" << _anno << "\")"; + filter_expr << " && (CODNUM==\"" << _codnum << "\")"; + } + cur->setregion(f,t); + + // Imposta l'ordine CODNUM+ANNO+PROVV+NDOC+CODART+LIVELLO+CODMAG+DATACONS + // nel caso si voglia il dettaglio all'interno del singolo documento, per liv.giac e cod.mag. + // In tal caso viene sostituito LF_RIGHEDOC nella relazione con un TSortedfile siffatto + if (_detail_rows && !_detail_doc) + { + s << "CODNUM|ANNO|PROVV|NDOC|CODART|"; + + if (_detail_level > 0) + lev_str.format("LIVELLO[1,%d]",_codgiac->packed_length(_detail_level)); + if (_detail_mag) + mag_str.format("CODMAG[1,3]"); + if (_detail_dep) + mag_str.format("CODMAG"); + + if (lev_str.not_empty()) + s << lev_str << "|"; + if (mag_str.not_empty()) + s << mag_str << "|"; + s << "DATACONS"; + + TSortedfile *rdoc = new TSortedfile(LF_RIGHEDOC,NULL,s,"",1); + cur->relation()->replace(rdoc,1,"CODNUM==CODNUM|ANNO==ANNO|PROVV==PROVV|NDOC==NDOC"); + + TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "RIGHEART"); + ssec.enable(); + TString cond(ssec.condition()); + if (lev_str.not_empty()) + cond << "+" << lev_str; + if (mag_str.not_empty()) + cond << "+" << mag_str; + ssec.setcondition(cond, _strexpr); + } + + if (_TEA_ord == 'E') + filter_expr << " && (DOCEVASO==\"X\")"; + else + if (_TEA_ord == 'A') + filter_expr << " && (DOCEVASO!=\"X\")"; + + if (!_detail_rows) + { + // In caso di dettaglio per righe non va settato il filtro per dataconsegnain quanto + // già impostato sulla sottosezione (vedi sotto) + if (_from_cons.ok()) + { + filter_expr << "&&"; + s.format("(ANSI(DATACONS)>=\"%s\")", + (const char*)_from_cons.string(ANSI)); + filter_expr << s; + } + if (_to_cons.ok()) + { + filter_expr << "&&"; + s.format("(ANSI(DATACONS)<=\"%s\")", + (const char*)_to_cons.string(ANSI)); + filter_expr << s; + } + } + + cur->setfilter(filter_expr); + + if (_detail_rows) + { + for (short i = BODY_COL_7; i<=BODY_COL_12; i++) + _frm->find_field('B', odd_page, i).show(); + _frm->find_field('B', odd_page, "DET").show(); // Visualizza la sottosezione + TForm_subsection& ssec = (TForm_subsection&)_frm->find_field('B', odd_page, "RIGHE"); // Sottosezione padre + + // Applica filtri alla sezione + TString cond; + + // Aggiunge filtro sui tipi di riga + s.format("((%d->TIPORIGA==\"%s\")", LF_RIGHEDOC, (const char*)(TString&)_tipi_riga["M"]); + cond << s; + + if (_pr_spese) + { + s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["S"]); + cond << s; + } + + if (_pr_prest) + { + s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["P"]); + cond << s; + } + + if (_pr_sconti) + { + s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["C"]); + cond << s; + } + + if (_pr_omaggi) + { + s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["O"]); + cond << s; + } + + if (_pr_descr) + { + s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["D"]); + cond << s; + } + + cond << ")"; + + // TBI: stampa righe di sconto testata od esenzione. Siccome non sono righe fisiche + // credo sara' necessario implementarle con un messaggio nella validate... + + // Applica il filtro per righe evase/aperte + s = ""; + if (_TEA_rord == 'E') + s.format("&&(%d->RIGAEVASA==\"X\")",LF_RIGHEDOC); + else + if (_TEA_rord == 'A') + s.format("&&(%d->RIGAEVASA!=\"X\")",LF_RIGHEDOC); + + cond << s; + + s = ""; + if (_force_evase) + s.format("&&(%d->QTAEVASA != %d->QTA)", LF_RIGHEDOC, LF_RIGHEDOC); + cond << s; + + // Setta i range per la data di consegna + if (_from_cons.ok()) + { + if (cond.not_empty()) + cond << "&&"; + s.format("(ANSI(%d->DATACONS)>=\"%s\")", + LF_RIGHEDOC, (const char*)_from_cons.string(ANSI)); + cond << s; + } + if (_to_cons.ok()) + { + if (cond.not_empty()) + cond << "&&"; + s.format("(ANSI(%d->DATACONS)<=\"%s\")", + LF_RIGHEDOC, (const char*)_to_cons.string(ANSI)); + cond << s; + } + + // Setta i range per il codice magazzino + if (_from_mag.not_empty()) + { + if (cond.not_empty()) + cond << "&&"; + s.format("(%d->CODMAG>=\"%s\")", + LF_RIGHEDOC, (const char*)_from_mag); + cond << s; + } + if (_to_mag.not_empty()) + { + if (cond.not_empty()) + cond << "&&"; + s.format("(%d->CODMAG<=\"%s\")", + LF_RIGHEDOC, (const char*)_to_mag); + cond << s; + } + + // Setta i range per il codice articolo + if (_from_art.not_empty()) + { + if (cond.not_empty()) + cond << "&&"; + s.format("(%d->CODART>=\"%s\")", + LF_RIGHEDOC, (const char*)_from_art); + cond << s; + } + if (_to_art.not_empty()) + { + if (cond.not_empty()) + cond << "&&"; + s.format("(%d->CODART<=\"%s\")", + LF_RIGHEDOC, (const char*)_to_art); + cond << s; + } + + s.format("&&(%d->CODART!=\"\")", LF_RIGHEDOC); + cond << s; + + if (cond.not_empty()) + ssec.setcondition(cond, _strexpr); + + if (!_detail_doc) + { + TForm_subsection& ss = (TForm_subsection&)_frm->find_field('B', odd_page, "RIGHE"); + TPrint_section& ps = ss.printsection(); + for (short j = BODY_COL_1; j <= BODY_COL_12; j++) + { + ps.find_field(j + 100).disable(); + ps.find_field(j + 400).enable(); + } + } + } + + // Abilitazione intestazioni di colonna + _frm->find_field('B', odd_page, BODY_COL_5).show(_opz_valore); + _frm->find_field('B', odd_page, BODY_COL_6).show(_opz_valore); + _frm->find_field('F', last_page, BODY_COL_5+200).show(_opz_valore); + _frm->find_field('F', last_page, BODY_COL_6+200).show(_opz_valore); + _frm->find_field('B', odd_page, BODY_COL_10).show(_opz_prezzo); + _frm->find_field('B', odd_page, BODY_COL_11).show(_opz_residuo); + _frm->find_field('B', odd_page, BODY_COL_12).show(_opz_giacenza); + + // Abilitazione delle righe + const short id = !_detail_doc && _detail_rows ? 400 : 100; + TForm_subsection& ssec = (TForm_subsection&)_frm->find_field('B', odd_page, "RIGHE"); // Sottosezione padre + ssec.printsection().find_field(BODY_COL_5 + id).show(_opz_valore); + ssec.printsection().find_field(BODY_COL_6 + id).show(_opz_valore); + ssec.printsection().find_field(BODY_COL_10 + id).show(_opz_prezzo); + ssec.printsection().find_field(BODY_COL_11 + id).show(_opz_residuo); + ssec.printsection().find_field(BODY_COL_12 + id).show(_opz_giacenza); +} + +void TStampa_ordini::filter_for_clifo_agent() +{ + CHECK(_frm, "Form non valido"); + + const bool is_for_cli = _tipo == clifo; + + TString s, ws,lev_str, mag_str; + TSorted_cursor* cur = (TSorted_cursor*)_frm->cursor(); + + if (_detail_rows && !_detail_doc) // Cambia l'ordinamento se si vuol dettagliare per articolo e non per documento + { + if (_detail_level > 0) + lev_str.format("LIVELLO[1,%d]",_codgiac->packed_length(_detail_level)); + if (_detail_mag) + mag_str.format("CODMAG[1,3]"); + if (_detail_dep) + mag_str.format("CODMAG"); + + if (!is_for_cli) + s.format("%d->CODAG|",LF_DOC); + if (is_for_cli || _detail_cli) + { + ws.format("%d->TIPOCF|%d->CODCF|%d->OCFPI|",LF_DOC, LF_DOC, LF_DOC); + s << ws; + } + s << "CODART|"; + if (lev_str.not_empty()) + s << lev_str << "|"; + if (mag_str.not_empty()) + s << mag_str << "|"; + s << "DATACONS"; + cur->change_order(s); + } + //Mo setto li filtri, altrimenti stampa tutto er file de' righe documento + TRectype f(LF_RIGHEDOC), t(LF_RIGHEDOC); + TString filter_expr; + + f.put(DOC_CODNUM, _codnum); + if (_anno != 0) + { + f.put(DOC_PROVV, _provv); + f.put(DOC_ANNO, _anno); + } + else + { + s.format("(PROVV==\"%c\")&&", _provv); + filter_expr << s; + } + + t = f; + cur->setregion(f,t); // This is the region... + + s.format("(%d->TIPOCF==\"",LF_DOC); + filter_expr << s << _tipocf << "\")"; // Nel caso di stampa per agenti e' sempre "C" + + s.format("&&(%d->CODART!=\"\")", LF_RIGHEDOC); + filter_expr << s; + + // Filtro su Cli/Fo od agente + if (is_for_cli) + { + if (_from_cf > 0L) + { + s.format("&&(STR(NUM(%d->CODCF)>=%ld))", LF_DOC, _from_cf); + filter_expr << s; + } + + if (_to_cf > 0L) + { + s.format("&&(STR(NUM(%d->CODCF)<=%ld))", LF_DOC, _to_cf); + filter_expr << s; + } + } + else + { + if (_from_age.not_empty()) + { + s.format("&&(%d->CODAG>=\"%s\")", LF_DOC, (const char*)_from_age); + filter_expr << s; + } + + if (_to_age.not_empty()) + { + s.format("&&(%d->CODAG<=\"%s\")", LF_DOC, (const char*)_to_age); + filter_expr << s; + } + } + + + // Filtro sulla data ordine... + if (_from_date.ok()) + { + s.format("&&(ANSI(%d->DATADOC)>=\"%s\")", LF_DOC, + (const char*)_from_date.string(ANSI)); + filter_expr << s; + } + if (_to_date.ok()) + { + s.format("&&(ANSI(%d->DATADOC)<=\"%s\")", LF_DOC, + (const char*)_to_date.string(ANSI)); + filter_expr << s; + } + + // Filtro sulla data consegna... + if (_from_cons.ok()) + { + s.format("&&(ANSI(DATACONS)>=\"%s\")", + (const char*)_from_cons.string(ANSI)); + filter_expr << s; + } + if (_to_cons.ok()) + { + s.format("&&(ANSI(DATACONS)<=\"%s\")", + (const char*)_to_cons.string(ANSI)); + filter_expr << s; + } + + if (_detail_rows) + { + // Setta i range per il codice articolo + if (_from_art.not_empty()) + { + s.format("&&(%d->CODART>=\"%s\")", + LF_RIGHEDOC, (const char*)_from_art); + filter_expr << s; + } + if (_to_art.not_empty()) + { + filter_expr << "&&"; + s.format("(%d->CODART<=\"%s\")", + LF_RIGHEDOC, (const char*)_to_art); + filter_expr << s; + } + + //Setta i range per la categoria merceologica + if (_from_cat.not_empty()) + { + s.format("&&(%d->GRMERC[1,3]>=\"%s\")",LF_ANAMAG, (const char*)_from_cat); + filter_expr << s; + } + if (_to_cat.not_empty()) + { + filter_expr << "&&"; + s.format("(%d->GRMERC[1,3]<=\"%s\")",LF_ANAMAG, (const char*)_to_cat); + filter_expr << s; + } + + // Setta i range per i livelli di giacenza (da 1 a 4) + if (_detail_level > 0) + for (int lev=1, index=0; lev <= _detail_level; lev++) + { + if (!_codgiac->enabled(lev)) + continue; + TString& from = (TString&) _from_giac[index]; + TString& to = (TString&) _to_giac[index++]; + const int starts = _codgiac->code_start(lev); + const int ends = starts+_codgiac->code_length(lev); + if (from.not_empty()) + { + s.format("&&(%d->LIVELLO[%d,%d]>=\"%s\")", + LF_RIGHEDOC,starts,ends,(const char*)from); + filter_expr << s; + } + if (to.not_empty()) + { + s.format("&&(%d->LIVELLO[%d,%d]<=\"%s\")", + LF_RIGHEDOC,starts,ends,(const char*)to); + filter_expr << s; + } + } + // Setta i range per il codice magazzino (deposito incluso) + if (_from_mag.not_empty()) + { + s.format("&&(%d->CODMAG>=\"%s\")", + LF_RIGHEDOC, (const char*)_from_mag); + filter_expr << s; + } + if (_to_mag.not_empty()) + { + s.format("&&(%d->CODMAG<=\"%s\")", + LF_RIGHEDOC, (const char*)_to_mag); + filter_expr << s; + } + } + + s = ""; + if (!_detail_rows) + { + if (_TEA_ord == 'E') + s.format("&&(%d->DOCEVASO==\"X\")",LF_DOC); + else + if (_TEA_ord == 'A') + s.format("&&(%d->DOCEVASO!=\"X\")",LF_DOC); + } + else + { + if (_TEA_rord == 'E') + s.format("&&(%d->RIGAEVASA==\"X\")",LF_RIGHEDOC); + else + if (_TEA_rord == 'A') + s.format("&&(%d->RIGAEVASA!=\"X\")",LF_RIGHEDOC); + + if (_force_evase) + s << "&&(" << LF_RIGHEDOC << ">QTAEVASA != " << LF_RIGHEDOC << "->QTA)"; + } + + if (s.not_empty()) + filter_expr << s; + + cur->setfilter(filter_expr,TRUE,2); + + // Alla fine setta i campi da vedere + if (!is_for_cli && _detail_cli) + { + // Solo stampa per agenti: se si e' settato il distinguo per clienti + // mostra l'intestazione prima di ogni cambio cliente + TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "HCLIENTI"); + ssec.enable(); + } + + if (!_detail_rows || _detail_doc) // Stampa distinguendo per documento e non per righe articolo... + { + TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "DOCUMENTI"); + if (!is_for_cli) + ssec.enable(); // Se stampa per agenti e dettaglia documenti per cliente abilita la sezione + else + { // Se stampa per cli/fo abilita i campi corrispondenti al distinguo per documento (valuta, residuo evaso ecc...) + ssec.printsection().find_field(BODY_COL_1 + 100).show(); + for (short id = BODY_COL_2 + 100; id <= (BODY_COL_6 + 100); id++) + ssec.printsection().find_field(id).enable(); + } + // Deve essere abilitata ma nascosta, per eseguire i raggruppamenti sulle righe + TForm_subsection& dsec = (TForm_subsection&) _frm->find_field('B', odd_page, "RIGHEDOC"); + dsec.enable(); + dsec.hide(); + } + + // In qualsiasi caso va fatta questa abilitazione + bool is_art = _detail_rows && !_detail_doc; + + ((TForm_subsection&) _frm->find_field('B', odd_page, "DOCUMENTI")).printsection().find_field(BODY_COL_5 + 100).enable(_opz_valore && !is_art); + ((TForm_subsection&) _frm->find_field('B', odd_page, "DOCUMENTI")).printsection().find_field(BODY_COL_6 + 100).enable(_opz_valore && !is_art); + + if (_detail_rows) // Stampa dettaglio righe... + { + for (short i = BODY_COL_7; i<=BODY_COL_12; i++) + _frm->find_field('B', odd_page, i).show(); // Aggiunge le colonne di dettaglio + // dulcis in fundo (Dulcinea mia adorata), si abilita la sezione RIGHEART + // anziche' RIGHEDOC nel qual caso sia stato specificato il raggruppamento per Articoli (e sotto-opzioni) + if (!_detail_doc) // Se la stampa deve distinguere e dettagliare per articoli e non per documenti... + { + TString cond; + TForm_item& ff = _frm->find_field('B', odd_page, "RIGHEDOC"); + ff.y() = 1; + + if (!is_for_cli) // Abilita la sottosezione principale se stampa per agenti + { + TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "ARTCLI"); + ssec.enable(); + ssec.printsection().find_field(BODY_COL_5 + 400).enable(_opz_valore); + ssec.printsection().find_field(BODY_COL_6 + 400).enable(_opz_valore); + ssec.printsection().find_field(BODY_COL_10 + 400).enable(_opz_prezzo); + ssec.printsection().find_field(BODY_COL_11 + 400).enable(_opz_residuo); + ssec.printsection().find_field(BODY_COL_12 + 400).enable(_opz_giacenza); + + if (_detail_cli) // Se e' abilitata la distinzione per clienti setta l'espressione di raggruppamento + { + cond = ssec.condition(); + cond << "+" << LF_CLIFO << "->TIPOCF+" << LF_CLIFO << "->CODCF+" << LF_DOC << "->OCFPI"; + ssec.setcondition(cond, _strexpr); + } + } + + // Setta la condizione di raggruppamento principale per articoli (comune alla stampa per cli/fo e per agenti) + TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "RIGHEART"); + ssec.enable(); + cond = ssec.condition(); + if (lev_str.not_empty()) + cond << "+" << lev_str; + if (mag_str.not_empty()) + cond << "+" << mag_str; + ssec.setcondition(cond, _strexpr); + + if (is_for_cli) + { // I seguenti campi non necessitano di abilitazione se la stampa e' per agente + TForm_subsection& dsec = (TForm_subsection&) _frm->find_field('B', odd_page, "DOCUMENTI"); + for (short id = BODY_COL_1 + 400; id <= (BODY_COL_12 + 400); id++) + dsec.printsection().find_field(id).enable(); + dsec.printsection().find_field(BODY_COL_5 + 400).enable(_opz_valore); + dsec.printsection().find_field(BODY_COL_6 + 400).enable(_opz_valore); + dsec.printsection().find_field(BODY_COL_10 + 400).enable(_opz_prezzo); + dsec.printsection().find_field(BODY_COL_11 + 400).enable(_opz_residuo); + dsec.printsection().find_field(BODY_COL_12 + 400).enable(_opz_giacenza); + } + } + else + { + _frm->find_field('B', odd_page, "RIGHEDOC").enable(); // Abilita la sezione di dettaglio righe PER DOCUMENTO + TForm_subsection& rd = (TForm_subsection&) _frm->find_field('B', odd_page, "RIGHEDOC"); + rd.printsection().find_field(BODY_COL_5 + 200).enable(_opz_valore); + rd.printsection().find_field(BODY_COL_6 + 200).enable(_opz_valore); + rd.printsection().find_field(BODY_COL_10 + 200).enable(_opz_prezzo); + rd.printsection().find_field(BODY_COL_11 + 200).enable(_opz_residuo); + rd.printsection().find_field(BODY_COL_12 + 200).enable(_opz_giacenza); + } + } + // Abilitazione intestazioni di colonna + _frm->find_field('B', odd_page, BODY_COL_5).show(_opz_valore); + _frm->find_field('B', odd_page, BODY_COL_6).show(_opz_valore); + _frm->find_field('B', odd_page, BODY_COL_10).show(_opz_prezzo); + _frm->find_field('B', odd_page, BODY_COL_11).show(_opz_residuo); + _frm->find_field('B', odd_page, BODY_COL_12).show(_opz_giacenza); + + set_totvaluta_items(); +} + +void TStampa_ordini::filter_for_articolo() +{ + CHECK(_frm, "Form non valido"); + + TString s, ws,lev_str, mag_str; + TSorted_cursor* cur = (TSorted_cursor*)_frm->cursor(); + + if (_detail_level > 0) + lev_str.format("LIVELLO[1,%d]",_codgiac->packed_length(_detail_level)); + if (_detail_mag) + mag_str.format("CODMAG[1,3]"); + if (_detail_dep) + mag_str.format("CODMAG"); + + s << "CODART|"; + if (lev_str.not_empty()) + s << lev_str << "|"; + if (mag_str.not_empty()) + s << mag_str << "|"; + s << "DATACONS"; + cur->change_order(s); // Setta l'ordine + + + TRectype f(LF_RIGHEDOC), t(LF_RIGHEDOC); + TString filter_expr; + + f.put(DOC_CODNUM, _codnum); + f.put(RDOC_CODART, _from_art); + if (_anno != 0) + { + f.put(DOC_PROVV, _provv); + f.put(DOC_ANNO, _anno); + } + else + { + s.format("(PROVV==\"%c\") &&", _provv); + filter_expr << s; + } + + t = f; + t.put(RDOC_CODART, _to_art); + cur->setkey(2); // Questa chiave rende piu' veloce la costruzione se indicato un range di articoli + cur->setregion(f,t); // This is the region... + + s.format("(%d->TIPOCF==\"",LF_DOC); + filter_expr << s << _tipocf << "\")"; // Nel caso di stampa per agenti e' sempre "C" + + s.format("&&(%d->CODART!=\"\")", LF_RIGHEDOC); + filter_expr << s; + + // Filtro su Cli/Fo + if (_from_cf > 0L) + { + s.format("&&(STR(NUM(%d->CODCF)>=%ld))", LF_DOC, _from_cf); + filter_expr << s; + } + + if (_to_cf > 0L) + { + s.format("&&(STR(NUM(%d->CODCF)<=%ld))", LF_DOC, _to_cf); + filter_expr << s; + } + // Filtro sulla data ordine... + if (_from_date.ok()) + { + s.format("&&(ANSI(%d->DATADOC)>=\"%s\")", LF_DOC, + (const char*)_from_date.string(ANSI)); + filter_expr << s; + } + if (_to_date.ok()) + { + s.format("&&(ANSI(%d->DATADOC)<=\"%s\")", LF_DOC, + (const char*)_to_date.string(ANSI)); + filter_expr << s; + } + + // Filtro sulla data consegna... + if (_from_cons.ok()) + { + s.format("&&(ANSI(DATACONS)>=\"%s\")", + (const char*)_from_cons.string(ANSI)); + filter_expr << s; + } + if (_to_cons.ok()) + { + s.format("&&(ANSI(DATACONS)<=\"%s\")", + (const char*)_to_cons.string(ANSI)); + filter_expr << s; + } + + // Setta i range per i livelli di giacenza (da 1 a 4) + if (_detail_level > 0) + for (int lev=1, index=0; lev <= _detail_level; lev++) + { + if (!_codgiac->enabled(lev)) + continue; + TString& from = (TString&) _from_giac[index]; + TString& to = (TString&) _to_giac[index++]; + const int starts = _codgiac->code_start(lev); + const int ends = starts+_codgiac->code_length(lev); + if (from.not_empty()) + { + s.format("&&(%d->LIVELLO[%d,%d]>=\"%s\")", + LF_RIGHEDOC,starts,ends,(const char*)from); + filter_expr << s; + } + if (to.not_empty()) + { + s.format("&&(%d->LIVELLO[%d,%d]<=\"%s\")", + LF_RIGHEDOC,starts,ends,(const char*)to); + filter_expr << s; + } + } + // Setta i range per il codice magazzino (deposito incluso) + if (_from_mag.not_empty()) + { + s.format("&&(%d->CODMAG>=\"%s\")", + LF_RIGHEDOC, (const char*)_from_mag); + filter_expr << s; + } + if (_to_mag.not_empty()) + { + s.format("&&(%d->CODMAG<=\"%s\")", + LF_RIGHEDOC, (const char*)_to_mag); + filter_expr << s; + } + + s = ""; + if (_TEA_rord == 'E') + s.format("&&(%d->RIGAEVASA==\"X\")",LF_RIGHEDOC); + else + if (_TEA_rord == 'A') + s.format("&&(%d->RIGAEVASA!=\"X\")",LF_RIGHEDOC); + + if (s.not_empty()) + filter_expr << s; + + + cur->setfilter(filter_expr,TRUE,2); // Setta il filtro e serra i ranghi + + // Setta la condizione di raggruppamento principale per articoli + TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "ARTMAIN"); + ssec.enable(); + s = ssec.condition(); + if (lev_str.not_empty()) + s << "+" << lev_str; + if (mag_str.not_empty()) + s << "+" << mag_str; + ssec.setcondition(s, _strexpr); + + for (short id = BODY_COL_1 + 400; id <= (BODY_COL_12 + 400); id++) + _frm->find_field('B',odd_page,id).enable(); + + // Abilitazione intestazioni di colonna + _frm->find_field('B', odd_page, BODY_COL_5).show(_opz_valore); + _frm->find_field('B', odd_page, BODY_COL_6).show(_opz_valore); + _frm->find_field('B', odd_page, BODY_COL_10).show(_opz_prezzo); + _frm->find_field('B', odd_page, BODY_COL_11).show(_opz_residuo); + _frm->find_field('B', odd_page, BODY_COL_12).show(_opz_giacenza); + + // Abilitazione intestazioni di riga + TForm_subsection& asec = (TForm_subsection&)_frm->find_field('B', odd_page, "ARTMAIN"); // Sottosezione padre + asec.printsection().find_field(BODY_COL_5 + 400).show(_opz_valore); + asec.printsection().find_field(BODY_COL_6 + 400).show(_opz_valore); + asec.printsection().find_field(BODY_COL_10 + 400).show(_opz_prezzo); + asec.printsection().find_field(BODY_COL_11 + 400).show(_opz_residuo); + asec.printsection().find_field(BODY_COL_12 + 400).show(_opz_giacenza); + + set_totvaluta_items(); +} + +void TStampa_ordini::main_loop() +{ + TString form_name; + + while (_m->run()!=K_QUIT) + { + // selezione tipo di stampa per il form appropriato + _tipo = (tipo_stampa) _m->get_int(F_TIPO); + _codnum = _m->get(F_CODNUM); + _provv = _m->get(F_PROVV)[0]; + _anno = _m->get_int(F_ANNO); + _order = _m->get(F_DATA_O_NUM)[0] == 'N' ? num_doc : data_doc; + _from_ndoc = _m->get_long(F_NDOCFROM); + _to_ndoc = _m->get_long(F_NDOCTO); + _from_date = _m->get_date(F_EMISFROM); + _to_date = _m->get_date(F_EMISTO); + _from_cons = _m->get_date(F_CONSFROM); + _to_cons = _m->get_date(F_CONSTO); + _from_age = _m->get(F_AGEFROM); + _to_age = _m->get(F_AGETO); + _from_cf = _m->get_long(F_CFFROM); + _to_cf = _m->get_long(F_CFTO); + _from_mag = _m->get(F_MAGFROM); + _to_mag = _m->get(F_MAGTO); + _from_dep = _m->get(F_DEPFROM); + _to_dep = _m->get(F_DEPTO); + if (_from_mag.not_empty()) + _from_mag.left_just(3); + if (_to_mag.not_empty()) + _to_mag.left_just(3); + _from_mag << _from_dep; + _to_mag << _to_dep; + + _from_art = _m->get(F_ARTFROM); + _to_art = _m->get(F_ARTTO); + _from_cat = _m->get(F_CATMERFROM); + _to_cat = _m->get(F_CATMERTO); + + _from_giac.destroy(); + _to_giac.destroy(); + _from_giac.add(_m->get(F_GIAC1_FROM),0); + _to_giac.add(_m->get(F_GIAC1_TO),0); + _from_giac.add(_m->get(F_GIAC2_FROM),1); + _to_giac.add(_m->get(F_GIAC2_TO),1); + _from_giac.add(_m->get(F_GIAC3_FROM),2); + _to_giac.add(_m->get(F_GIAC3_TO),2); + _from_giac.add(_m->get(F_GIAC4_FROM),3); + _to_giac.add(_m->get(F_GIAC4_TO),3); + + if (!_from_date.ok()) + _from_date = botime; + if (!_to_date.ok()) + _to_date = eotime; + _tipocf = _m->get(F_TIPOCF)[0]; + _detail_rows = _m->get_bool(F_DETTAGLIO); + _detail_doc = _m->get_bool(F_DETAIL_BY_DOC); + _detail_cli = _m->get_bool(F_DETAIL_BY_CLI); + _detail_mag = _m->get_bool(F_DETAIL_MAG); + _detail_dep = _m->get_bool(F_DETAIL_DEP); + _detail_level = _m->get_int(F_DETAIL_LEV); + + _pr_spese = _m->get_bool(F_PRINTSPESE); + _pr_prest = _m->get_bool(F_PRINTPREST); + _pr_sconti = _m->get_bool(F_PRINTSCONTI); + _pr_omaggi = _m->get_bool(F_PRINTOMAGGI); + _pr_descr = _m->get_bool(F_PRINTDESCR); + + _opz_valore = _m->get_bool(F_OPZ_VALORE); + _opz_prezzo = _m->get_bool(F_OPZ_PREZZO); + _opz_residuo = _m->get_bool(F_OPZ_RESIDUO); + _opz_giacenza = _m->get_bool(F_OPZ_GIACENZA); + + _force_evase = _m->get_bool(F_FORCE_EVASE); + + _TEA_ord = _m->get(F_STATOORD)[0]; + _TEA_rord = _m->get(F_STATORORD)[0]; + + switch (_tipo) + { + case clifo: + form_name = "or1100bp"; + break; + case agente: + form_name = "or1100c"; + break; + case articolo: + form_name = "or1100d"; + break; + default: + form_name = "or1100a"; + break; + } + + _frm = new TOrdine_form(form_name); + _frm->set_options(_detail_level, _detail_mag, _detail_dep); + // Selezione cursore & filtro + switch (_tipo) + { + case clifo: + case agente: + filter_for_clifo_agent(); + break; + case articolo: + filter_for_articolo(); + break; + default: + filter_for_number(); + break; + } + + + const int hh = 6; + const int fl = printer().formlen(); + + int rows[4]; // Righe orizzontali + rows[0] = hh-2; + rows[1] = hh; + rows[2] = fl; + rows[3] = 0; + _frm->genera_intestazioni(odd_page, hh-1); + _frm->genera_fincatura(odd_page, hh-2, fl, rows); + + // Crea il cursore + if (_frm->cursor()->items() > 0) + { + // Sostituzione curr del cursore + TCursor* cur = _frm->cursor(); + TDocumento *doc = new TDocumento; // Don't delete! + + cur->file(LF_DOC).set_curr(doc); + cur->file(LF_RIGHEDOC).set_curr(new TRiga_documento(doc));// Don't delete! + + // stampa + _frm->print(); + } + delete _frm; + } +} + +int or1100(int argc, char** argv) +{ + TStampa_ordini a; + a.run(argc,argv,"Stampa ordini"); + return 0; +} diff --git a/or/or1p.cpp b/or/or1p.cpp new file mode 100755 index 000000000..a9ca765af --- /dev/null +++ b/or/or1p.cpp @@ -0,0 +1,23 @@ +#include +#include + +#include "or1p.h" + +const char* const usage = "Errore - uso : %s -{0|1|2}"; + +int main(int argc,char** argv) +{ + const int n = argc > 1 ? atoi(argv[1]+1) : -1; + + switch (n) + { + case 0: + or1100(argc,argv); break; // stampe ordini clifor personalizz. cover + + default: + error_box(usage, argv[0]); + } + exit(0); + return 0; +} + diff --git a/or/or1p.h b/or/or1p.h new file mode 100755 index 000000000..b2cd3ac86 --- /dev/null +++ b/or/or1p.h @@ -0,0 +1,7 @@ +#ifndef __OR1_H +#define __OR1_H + +int or1100(int argc, char** argv); + +#endif // __OR1_H + diff --git a/or/or1p.url b/or/or1p.url new file mode 100755 index 000000000..b0848c0b5 --- /dev/null +++ b/or/or1p.url @@ -0,0 +1,20 @@ +#include + +/* or1 -0 Stampe ordini */ + +MENU TASK_MENUBAR + SUBMENU MENU_FILE "~File" + +/* or1 -1 Stampa dettaglio disponbilita' articoli*/ +MENUBAR MENU_BAR(1) + +MENU MENU_BAR(1) + SUBMENU MENU_FILE "~File" + +/* or1 -2 Stampa statistiche sui tempi di consegna*/ +MENUBAR MENU_BAR(2) + +MENU MENU_BAR(2) + SUBMENU MENU_FILE "~File" + + diff --git a/pr/pr1300.cpp b/pr/pr1300.cpp index 451f88594..65ec572a1 100755 --- a/pr/pr1300.cpp +++ b/pr/pr1300.cpp @@ -6,7 +6,60 @@ #include "provv.h" #include "pr1300a.h" +#include "..\ve\velib.h" +class TStampa_schedeprovv_form : public TForm +{ + TString80 _basecalcolo; + TPagamento _pagamento; +protected: + virtual bool validate(TForm_item &, TToken_string &); +public: + void set_basecalcolo(const TString80& s) { _basecalcolo = s; } + TStampa_schedeprovv_form(const char* name); + virtual ~TStampa_schedeprovv_form(){}; +}; + +TStampa_schedeprovv_form::TStampa_schedeprovv_form(const char* name): TForm() +{ + read(name); +} + +bool TStampa_schedeprovv_form::validate(TForm_item &cf, TToken_string &s) +{ + const TString code(s.get(0)); + + if (code == "_BASECALCOLO") + { + real valore; + if (_basecalcolo.empty()) + { + const real cambio = TForm::find_field('B', odd_page, 666).get(); + valore = TForm::cursor()->relation()->curr().get_real(PROV_IMPRATA)*cambio; + } + else + { + const int nriga = TForm::cursor()->relation()->curr().get_int(PROV_NRIGA); + if (nriga == 1) + { + TDocumento doc(TForm::cursor()->relation()->curr(LF_DOC)); + _pagamento = doc.pagamento(); + real importo = doc.get(_basecalcolo); + if (doc.tipo().nota_credito()) + importo = -importo; + _pagamento.set_total(importo,0,0); + _pagamento.set_rate_auto(); + } + const int nrata = TForm::cursor()->relation()->curr().get_int(PROV_NRATA); + if (nrata <= _pagamento.n_rate() && nrata > 0) + valore = _pagamento.importo_rata(nrata-1); + else + valore = ZERO; + } + cf.set(valore.string()); + } + return TForm::validate(cf, s); +} class TStampa_schedeprovv : public TSkeleton_application { @@ -22,7 +75,12 @@ protected: bool TStampa_schedeprovv::create() { - _m= new TMask ("pr1300a"); + _m= new TMask ("pr1300a"); + open_files(LF_CFVEN, LF_DOC, LF_RIGHEDOC, LF_CONDV, LF_RCONDV, LF_ANAMAG, + LF_SCONTI, LF_UMART, LF_TAB, LF_TABCOM, LF_CLIFO, LF_INDSP, + LF_OCCAS, LF_PCON, LF_MOVMAG, LF_RMOVMAG, LF_MAG, LF_SVRIEP, + LF_AGENTI, LF_PERCPROV, LF_ATTIV, LF_CAUSALI, 0); + return TSkeleton_application::create(); } @@ -65,7 +123,7 @@ void TStampa_schedeprovv::riporta_pagamenti(TCursor &cur) void TStampa_schedeprovv::main_loop() { - TForm frm("pr1300a"); + TStampa_schedeprovv_form frm("pr1300a"); const int hh = 7; const int fh = 1; @@ -86,35 +144,75 @@ void TStampa_schedeprovv::main_loop() // filtro e regione TString filter; - if (_m->get(F_FILTRO).not_empty()) - { - filter = PROV_SALDATA; - if (_m->get(F_FILTRO)[0]=='P') - filter << "==\"X\"" ; - else - filter << "!=\"X\"" ; - } - const TString & tipodoc = _m->get(F_TIPODOC); - if (tipodoc.not_empty()) + if (_m->get(F_FILTRO).not_empty()) + { + filter = PROV_SALDATA; + if (_m->get(F_FILTRO)[0]=='P') + filter << "==\"X\"" ; + else + filter << "!=\"X\"" ; + } + if (_m->get_bool(F_NOZERO)) + { + bool not_empty = filter.not_empty(); + if (not_empty) { - frm.cursor()->relation()->add(LF_DOC, "CODNUM==CODNUM|ANNO==ANNO|PROVV==\"D\"|NDOC==NDOC"); - bool not_empty = filter.not_empty(); + filter.insert("("); + filter << ") && ("; + } + filter << "(" << PROV_IMPPRDOC << "!= 0)"; + if (not_empty) + filter << ")"; + } + if (_m->get(F_DADATA).not_empty() || _m->get(F_ADATA).not_empty()) + { + TDate datam; + bool not_empty = filter.not_empty(); + if (not_empty) + { + filter.insert("("); + filter << ") && ("; + } + if (_m->get(F_DADATA).not_empty()) + { + datam = _m->get_date(F_DADATA); + filter << "(ANSI(" << PROV_DATADOC << ")>=\"" << datam.string(ANSI) << "\")"; + if (_m->get(F_ADATA).not_empty()) + filter << " && "; + } + if (_m->get(F_ADATA).not_empty()) + { + datam = _m->get_date(F_ADATA); + filter << "(ANSI(" << PROV_DATADOC << ")<=\"" << datam.string(ANSI) << "\")"; + } + if (not_empty) + filter << ")"; + } + + // aggiungo comunque il file alla relazione perche' mi serve avere il documento sempre + frm.cursor()->relation()->add(LF_DOC, "CODNUM==CODNUM|ANNO==ANNO|PROVV==\"D\"|NDOC==NDOC"); + + const TString & tipodoc = _m->get(F_TIPODOC); + if (tipodoc.not_empty()) + { + //frm.cursor()->relation()->add(LF_DOC, "CODNUM==CODNUM|ANNO==ANNO|PROVV==\"D\"|NDOC==NDOC"); + bool not_empty = filter.not_empty(); - if (not_empty) - { - filter.insert("("); - filter << ") && ("; - } - - filter << LF_DOC << "->TIPODOC == \"" << tipodoc << "\""; - - if (not_empty) - filter << ")"; - - frm.cursor()->setfilter(filter, TRUE); + if (not_empty) + { + filter.insert("("); + filter << ") && ("; } - else - frm.cursor()->setfilter(filter); + + filter << LF_DOC << "->TIPODOC == \"" << tipodoc << "\""; + + if (not_empty) + filter << ")"; + + frm.cursor()->setfilter(filter, TRUE); + } + else + frm.cursor()->setfilter(filter); TRectype start(LF_PROVV),end(LF_PROVV); if (_m->get(F_DAAGE).not_empty()) @@ -122,6 +220,9 @@ void TStampa_schedeprovv::main_loop() if (_m->get(F_AAGE).not_empty()) end.put(PROV_CODAGE,_m->get(F_AAGE)); frm.cursor()->setregion(start,end); + + frm.set_basecalcolo(_m->get(F_FORMULA)); + // abilita le sezioni dei totali frm.find_field('B',odd_page,"CLIENTI").show(!_m->get_bool(F_RAGGCLI)); frm.find_field('B',odd_page,"HCLIENTI").show(!_m->get_bool(F_RAGGDOC)); diff --git a/pr/pr1300a.frm b/pr/pr1300a.frm index 83b87b7ac..99a7ae824 100755 --- a/pr/pr1300a.frm +++ b/pr/pr1300a.frm @@ -320,8 +320,8 @@ SECTION CLIENTI 2 0 0 FILE LF_PROVV GROUP CODAGE BEGIN KEY "IMPORTO rata" PROMPT 4 1 "" - DRIVENBY 3 - MESSAGE _NUMEXPR,LF_PROVV->IMPRATA*#666 + PICTURE "###.###.###.###" + MESSAGE _BASECALCOLO MESSAGE ADD,203 END VALUTA 104 14 @@ -399,8 +399,8 @@ SECTION CLIENTI 2 0 0 FILE LF_PROVV GROUP CODAGE BEGIN KEY "IMPORTO rata" PROMPT 4 1 "" - DRIVENBY 3 - MESSAGE _NUMEXPR, LF_PROVV->IMPRATA*#666 + PICTURE "###.###.###.###" + MESSAGE _BASECALCOLO MESSAGE ADD,203 END VALUTA 104 14 diff --git a/pr/pr1300a.h b/pr/pr1300a.h index 161ddbb57..41b23be09 100755 --- a/pr/pr1300a.h +++ b/pr/pr1300a.h @@ -6,3 +6,9 @@ #define F_FILTRO 106 #define F_DEFINITIVA 107 #define F_TIPODOC 108 +#define F_DADATA 109 +#define F_ADATA 110 +#define F_NOZERO 111 +#define F_FORMULA 112 +#define F_D_FORMULA 113 +#define F_PROFILO 200 \ No newline at end of file diff --git a/pr/pr1300a.uml b/pr/pr1300a.uml index 6a879e8f9..b9ace31fd 100755 --- a/pr/pr1300a.uml +++ b/pr/pr1300a.uml @@ -1,6 +1,6 @@ #include "pr1300a.h" -PAGE "Stampa schede di provvigione" -1 -1 78 13 +PAGE "Stampa schede di provvigione" -1 -1 78 20 STRING F_DAAGE 5 BEGIN @@ -36,7 +36,7 @@ END LIST F_FILTRO 30 BEGIN - PROMPT 35 3 "Stampo " + PROMPT 35 3 "Stampo " ITEM "|tutte le provvigioni" ITEM "D|solo le provv. da pagare" ITEM "P|solo le provv. gia' pagate" @@ -61,6 +61,11 @@ BEGIN PROMPT 2 7 "Raggruppo le rate" END +BOOL F_NOZERO +BEGIN + PROMPT 35 7 "Non stampare doc. con provvigione nulla" +END + STRING F_TIPODOC 4 BEGIN PROMPT 2 9 "Tipo doc. " @@ -74,6 +79,42 @@ BEGIN FLAG "UP" END +DATE F_DADATA +BEGIN + PROMPT 2 11 "Da data " +END + +DATE F_ADATA +BEGIN + PROMPT 35 11 "A data " +END + +STRING F_FORMULA 10 +BEGIN + PROMPT 2 13 "Stampa " + USE %FRD + FLAG "U" + CHECKTYPE NORMAL + INPUT CODTAB F_FORMULA + DISPLAY "Codice@10" CODTAB + DISPLAY "Descrizione@50" S0 + OUTPUT F_FORMULA CODTAB + OUTPUT F_D_FORMULA S0 +END + +STRING F_D_FORMULA 50 +BEGIN + PROMPT 25 13 "" + FLAG "D" +END + +STRING F_PROFILO 50 +BEGIN + PROMPT 2 15 "Profilo " + PSELECT + //MESSAGE K_SPACE,F_ORDINAMENTO|K_SPACE,F_VAL2PRINT +END + BUTTON DLG_OK 10 2 BEGIN PROMPT -12 -1 "" diff --git a/sc/pec.frm b/sc/pec.frm index a2131121b..0c9fd4639 100755 --- a/sc/pec.frm +++ b/sc/pec.frm @@ -4,62 +4,54 @@ JOIN 13 INTO STATO==STATOCF COM==COMCF END DESCRIPTION BEGIN - 20->* "Clienti/Fornitori" - 13->* "Comuni" +20->* "Clienti/Fornitori" +13->* "Comuni" END - GENERAL BEGIN - OFFSET 0 0 - FONT "Courier New" - SIZE 7 - GRID "+++++++++-|" +OFFSET 0 0 +FONT "Courier New" +SIZE 7 +GRID "+++++++++-|" END - SECTION GRAPHICS ODD 0 - FIGURA 500 BEGIN - KEY "" - PROMPT 0 0 "" +KEY "" +PROMPT 0 0 "" END - END SECTION HEADER ODD 12 STRINGA 1 BEGIN - KEY "Spettabile/Egregio" - PROMPT 2 1 "Spettabile" +KEY "Spettabile/Egregio" +PROMPT 2 1 "Spettabile" END - NUMERO 104 BEGIN - KEY "Numero EC" - PROMPT 50 1 "Estratto conto n." +KEY "Numero EC" +PROMPT 50 1 "Estratto conto n." END - NUMERO 218 BEGIN - KEY "Pagina" - PROMPT 73 1 "Pag." +KEY "Pagina" +PROMPT 73 1 "Pag." END STRINGA 3 BEGIN - KEY "Codice cliente/fornitore" - PROMPT 2 2 "" - FIELD CODCF +KEY "Codice cliente/fornitore" +PROMPT 2 2 "" +FIELD CODCF END - STRINGA 4 BEGIN - KEY "Ragione sociale" - PROMPT 8 2 "" - FIELD RAGSOC +KEY "Ragione sociale" +PROMPT 8 2 "" +FIELD RAGSOC END - STRINGA 5 BEGIN KEY "Indirizzo" @@ -68,7 +60,6 @@ BEGIN MESSAGE COPY,7 FIELD INDCF END - STRINGA 6 BEGIN KEY "Numero civico" @@ -77,27 +68,23 @@ BEGIN MESSAGE APPEND,7 FIELD CIVCF END - STRINGA 7 BEGIN - KEY "Indirizzo completo" - PROMPT 2 3 "" +KEY "Indirizzo completo" +PROMPT 2 3 "" END - STRINGA 8 BEGIN - KEY "C.A.P." - PROMPT 2 4 "C.A.P. " - FIELD CAPCF +KEY "C.A.P." +PROMPT 2 4 "C.A.P. " +FIELD CAPCF END - STRINGA 9 BEGIN - KEY "Localita'" - PROMPT 26 4 "" - FIELD LOCALITACF +KEY "Localita'" +PROMPT 26 4 "" +FIELD LOCALITACF END - STRINGA 10 BEGIN KEY "Comune" @@ -106,7 +93,6 @@ BEGIN MESSAGE COPY,12 FIELD 13->DENCOM END - STRINGA 11 BEGIN KEY "Provincia" @@ -115,13 +101,11 @@ BEGIN MESSAGE APPEND,12 FIELD 13->PROVCOM END - STRINGA 12 BEGIN - KEY "Comune completo" - PROMPT 2 5 "" +KEY "Comune completo" +PROMPT 2 5 "" END - STRINGA 13 BEGIN KEY "Prefisso telefonico" @@ -130,7 +114,6 @@ BEGIN MESSAGE COPY,15 FIELD PTEL END - STRINGA 14 BEGIN KEY "Telefono" @@ -139,55 +122,46 @@ BEGIN MESSAGE APPEND,15 FIELD TEL END - STRINGA 15 BEGIN - KEY "Telefono completo" - PROMPT 2 6 "Telefono " +KEY "Telefono completo" +PROMPT 2 6 "Telefono " END - STRINGA 101 BEGIN - KEY "Luogo d'invio" - PROMPT 2 7 "" +KEY "Luogo d'invio" +PROMPT 2 7 "" END - DATA 102 BEGIN - KEY "Data d'invio" - PROMPT 52 7 "" - FORMAT "1444-" +KEY "Data d'invio" +PROMPT 52 7 "" +FORMAT "1444-" END - STRINGA 103 40 3 BEGIN - KEY "Testo fisso" - PROMPT 2 8 "" - FLAGS "M" +KEY "Testo fisso" +PROMPT 2 8 "" +FLAGS "M" END - STRINGA 16 BEGIN - KEY "SECONDA RAG SOC" - PROMPT 1 1 "" - FLAGS "H" - FIELD 20->RAGSOC[1,20] +KEY "SECONDA RAG SOC" +PROMPT 1 1 "" +FLAGS "H" +FIELD 20->RAGSOC[1,20] END - STRINGA 0 BEGIN - KEY " " +KEY " " END - END - SECTION HEADER LAST 1 - STRINGA 100 BEGIN - KEY "Flags generali VALUTA|FINCATURA" - PROMPT 0 0 "|2|" - FLAGS "DH" +KEY "Flags generali VALUTA|FINCATURA" +PROMPT 0 0 "|2|" +FLAGS "DH" END STRINGA 301 @@ -224,11 +198,8 @@ BEGIN PROMPT 2 1 "*** Riporto" FLAGS "DH" END - END - SECTION BODY ODD 1 COLUMNWISE - STRINGA 201 4 BEGIN KEY "Codice causale" @@ -238,7 +209,6 @@ BEGIN SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" END - STRINGA 202 22 1 BEGIN KEY "Descrizione" @@ -247,7 +217,15 @@ BEGIN SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" END - +STRINGA 203 3 +BEGIN + KEY "Valuta" + PROMPT 2 1 "" + SPECIAL STRINGA INTESTAZIONE "Val" "Val" + SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" + SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" +FLAGS "H" +END DATA 205 10 BEGIN KEY "Data documento" @@ -257,7 +235,6 @@ BEGIN SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" FORMAT "1444-" END - NUMERO 206 8 BEGIN KEY "Numero protocollo" @@ -267,7 +244,6 @@ BEGIN SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" END - STRINGA 207 8 BEGIN KEY "Numero documento" @@ -285,9 +261,7 @@ BEGIN SPECIAL STRINGA INTESTAZIONE "Tot.documento" "Totale documento" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - PICTURE "###.###.###.###" END - DATA 209 10 BEGIN KEY "Data scadenza" @@ -298,47 +272,47 @@ BEGIN FORMAT "1444-" END -NUMERO 210 17 +VALUTA 210 17 BEGIN KEY "Dare" PROMPT 8 1 "" + DRIVENBY 203 SPECIAL STRINGA INTESTAZIONE "Dare" "Dare" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - PICTURE "###.###.###.###" END -NUMERO 211 17 +VALUTA 211 17 BEGIN KEY "Avere" PROMPT 9 1 "" + DRIVENBY 203 SPECIAL STRINGA INTESTAZIONE "Avere" "Avere" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - PICTURE "###.###.###.###" END -NUMERO 212 17 +VALUTA 212 17 BEGIN KEY "Scaduto" PROMPT 10 1 "" + DRIVENBY 203 SPECIAL STRINGA INTESTAZIONE "Scaduto" "Scaduto" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - PICTURE "###.###.###.###" END -NUMERO 213 17 +VALUTA 213 17 BEGIN KEY "Esposto" PROMPT 11 1 "" + DRIVENBY 203 SPECIAL STRINGA INTESTAZIONE "Esposto" "Esposto" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - PICTURE "###.###.###.###" END -NUMERO 215 17 +VALUTA 215 17 BEGIN KEY "Importi in lire" PROMPT 12 1 "" @@ -346,7 +320,6 @@ BEGIN SPECIAL STRINGA INTESTAZIONE "Imp. in lire" "Importi in lire" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - PICTURE "###.###.###.###" END NUMERO 216 17 @@ -357,7 +330,7 @@ BEGIN SPECIAL STRINGA INTESTAZIONE "Cambio" "Cambio" SPECIAL NUMERO OFFSET "0" "Offset iniziale campo" SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra" - PICTURE "###.###.###.###" + PICTURE "###.###,@@@@@@" END DATA 217 10 @@ -425,20 +398,20 @@ END STRINGA 402 BEGIN - KEY "Descrizione totale scaduto" - PROMPT 0 2 "Scaduto al " +KEY "Descrizione totale scaduto" +PROMPT 0 2 "Scaduto al " END STRINGA 403 BEGIN - KEY "Descrizione totale esposto" - PROMPT 0 3 "Totale esposto" +KEY "Descrizione totale esposto" +PROMPT 0 3 "Totale esposto" END STRINGA 404 BEGIN - KEY "Descrizione totale importi in lire" - PROMPT 0 4 "Totale in lire " +KEY "Descrizione totale importi in lire" +PROMPT 0 4 "Totale in lire " END STRINGA 405 diff --git a/sc/sc0101.cpp b/sc/sc0101.cpp index 56deed0ca..3e878ed93 100755 --- a/sc/sc0101.cpp +++ b/sc/sc0101.cpp @@ -1155,7 +1155,7 @@ bool TSaldaconto_app::valuta_handler(TMask_field& f, KEY k) if (k == K_TAB && f.to_check(k, TRUE)) { TMask& m = f.mask(); - const TString val = f.get(); + const TString& val = f.get(); const bool full = val.not_empty(); if (full) @@ -1187,6 +1187,7 @@ bool TSaldaconto_app::valuta_handler(TMask_field& f, KEY k) else { TPay_mask& pm = (TPay_mask&)m; + m.set(S_CODVAL, val); // Copia codice valuta a pagina 2 pm.attiva_valuta(full); // Dis/abilita campi gestione valuta } } diff --git a/sc/sc2100.cpp b/sc/sc2100.cpp index 0c3102ef1..321f47432 100755 --- a/sc/sc2100.cpp +++ b/sc/sc2100.cpp @@ -206,35 +206,6 @@ void TEC_row::reset_uguali() void TEC_row::set_imp(TForm_item& fi, const real& imp, const char* cod_val) const { -/* - if (valuta) - { - const TString& old_picture = fi.picture(); - TString80 new_picture; - - if (old_picture.empty()) - { - new_picture = valuta ? ".3" : "."; - } - else - { - new_picture = old_picture; - if (old_picture.find(',') > 0) - new_picture << ".@@@"; - else - new_picture << ",@@@"; - } - const int w = fi.width(); - int exceed = w - new_picture.len(); - if (exceed<0 && w>0) - { - exceed=::abs(exceed); - new_picture = new_picture.mid(exceed,new_picture.len()-exceed); - } - fi.set_picture(new_picture); - } - fi.set(imp.string()); -*/ const TCurrency cur(imp, cod_val); fi.set(cur.string()); } @@ -251,9 +222,7 @@ void TEC_row::print_on(TPrint_section& body) TEC_form& form = (TEC_form&)body.form(); const bool show_value = form.in_valuta() && in_valuta(); - const char* cod_valuta = "_FIRM"; - if (show_value) - cod_valuta = valuta().codice(); + const char* cod_valuta = valuta().codice(); TForm_item& campo_valuta = body.find_field(PEC_VALUTA); campo_valuta.set(cod_valuta); @@ -319,7 +288,7 @@ void TEC_row::print_on(TPrint_section& body) TForm_item& lire = body.find_field(PEC_IMPLIRE); // lire.set(_importo_lire.string()); - set_imp(lire, _importo_lire, "_FIRM"); // In generale va espresso nella valuta della ditta + set_imp(lire, _importo_lire, ""); // In generale va espresso nella valuta della ditta TForm_item& cambio = body.find_field(PEC_CAMBIO); cambio.set(_valuta.cambio().string()); diff --git a/sc/sc2200.cpp b/sc/sc2200.cpp index 625673d6a..dcf9c14a5 100755 --- a/sc/sc2200.cpp +++ b/sc/sc2200.cpp @@ -124,8 +124,8 @@ public: bool scad_changed(char tipo, int gruppo, int conto, long codcf, int anno, TString& nump); // Totalizza i pagamenti non assegnati per la partita corrente (NB si spera che siano tutti nella stessa valuta) bool in_cache(const TString& k); // ritorna vero se ci sono gia' non assegnati in _uns_cache; - void look_in_cache(real& a, real& b, TAssoc_array& uns, TAssoc_array& unsnc, TString& k); - void calcola_unassigned(TString& k); + void look_in_cache(real& a, real& b, real& c, TAssoc_array& uns, TAssoc_array& unsnc, TAssoc_array& unsins, TString& k); + void calcola_unassigned(const TString& k); void calcola_pagamenti(real& imp_scad, int riga, int rata, TBill& bill); // calcola i pagamenti effettuati per questa rata e il residuo eventuale TStampaScadenzario(); @@ -142,21 +142,18 @@ HIDDEN void print_real(TString& dest, const real& num, const char* val) bool TStampaScadenzario::filter_func(const TRelation *r) { +/* // Filtro per rate saldate: se e' saldata e' ok solo quando // e' abilitato il flag; se non e' saldata va sempre bene. -/* - const TRectype& scad = r->curr(LF_SCADENZE); - const bool saldata = scad.get_bool(SCAD_PAGATA); - const bool ok = !saldata || (saldata && app()._ratesald); -*/ bool ok = app()._ratesald; if (!ok) { const TRectype& scad = r->curr(); ok = !scad.get_bool(SCAD_PAGATA); } - return ok; +*/ + return TRUE; } void TStampaScadenzario::check_add_key_to_tl(tipo_pe p, int t) @@ -240,65 +237,78 @@ bool TStampaScadenzario::scad_changed(char tipo, int gruppo, int conto, long cod bool TStampaScadenzario::in_cache(const TString& k) { - bool rt = FALSE; TAssoc_array& uns = (TAssoc_array&) _uns_cache[0]; TAssoc_array& unsnc = (TAssoc_array&) _uns_cache[1]; - if (uns.is_key(k) || unsnc.is_key(k)) rt = TRUE; + TAssoc_array& unsins = (TAssoc_array&) _uns_cache[2]; + bool rt = uns.is_key(k) || unsnc.is_key(k) || unsins.is_key(k); return rt; } -void TStampaScadenzario::calcola_unassigned(TString& k) +void TStampaScadenzario::calcola_unassigned(const TString& k) // Calcola i pagamenti non assegnati normali, e quelli riferiti a note di credito // ovvero quelli con tipo di movimento 2. Vanno percio' tenuti separati due totali: // _uns_cache[0] per i non assegnati normali, utilizzato per i pagamenti; // _uns_cache[1] per i non assegnati, riferiti a note di credito, da scalare all'importo in scadenza { - TAssoc_array& uns = (TAssoc_array&) _uns_cache[0]; - TAssoc_array& unsnc = (TAssoc_array&) _uns_cache[1]; - TRecord_array& ra = _p->unassigned(); - real a,b; - a = ZERO; - b = ZERO; + TAssoc_array& uns = (TAssoc_array&) _uns_cache[0]; + TAssoc_array& unsnc = (TAssoc_array&) _uns_cache[1]; + TAssoc_array& unsins = (TAssoc_array&) _uns_cache[2]; + real a,b,c; + + TRecord_array& ra = _p->unassigned(); for (int r = ra.last_row(); r > 0; r = ra.pred_row(r)) { const TRectype& rec = ra.row(r); const TRiga_partite& sum = _p->riga(rec.get_int(PAGSCA_NRIGP)); - const char * field = (_stvaluta && sum.in_valuta() ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO); - if (sum.get_int(PART_TIPOMOV) == 2) // Is it a credit note ? - b += rec.get_real(field); - else - a += rec.get_real(field); + const char* field = (_stvaluta && sum.in_valuta() ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO); + + const tipo_movimento tm = (tipo_movimento)sum.get_int(PART_TIPOMOV); + switch (tm) + { + case tm_nota_credito : b += rec.get_real(field); break; // Is it a credit note? + case tm_insoluto : c += rec.get_real(field); break; // Is unsolved? + case tm_pagamento_insoluto: c -= rec.get_real(field); break; // Is unsolved payed? + default : a += rec.get_real(field); break; + } } + if (a != ZERO) // Aggiungilo a TAssoc_array dei non assegnati uns.add(k,a,TRUE); if (b != ZERO) // Aggiungilo a TAssoc_array delle note di credito unsnc.add(k,b,TRUE); + if (c != ZERO) // Aggiungilo a TAssoc_array degli insoluti + unsins.add(k,c,TRUE); } -void TStampaScadenzario::look_in_cache(real& a, real& b, TAssoc_array& uns, TAssoc_array& unsnc, TString& k) +void TStampaScadenzario::look_in_cache(real& a, real& b, real& c, + TAssoc_array& uns, TAssoc_array& unsnc, TAssoc_array& unsins, + TString& k) //Estrae dai tassoc_array i valori, relativi alla partita corrente, di uns e unsnc, mettendoli in a e b { - a = ZERO; b = ZERO; TRiga_partite& rp = _p->riga(_p->first()); - k << rp.get_char(PART_TIPOCF) << rp.get_int(PART_GRUPPO) ; + k << rp.get_char(PART_TIPOCF) << rp.get_int(PART_GRUPPO); k << rp.get_int(PART_CONTO) << rp.get_long(PART_SOTTOCONTO); k << rp.get_int(PART_ANNO); k << rp.get(PART_NUMPART); + + a = b = c = ZERO; if (uns.is_key(k)) a = (real&)uns[k]; if (unsnc.is_key(k)) b = (real&)unsnc[k]; + if (unsins.is_key(k)) c = (real&)unsins[k]; } void TStampaScadenzario::calcola_pagamenti(real& imp_scad, int riga, int rata, TBill& bill) { TAssoc_array& uns = (TAssoc_array&) _uns_cache[0]; TAssoc_array& unsnc = (TAssoc_array&) _uns_cache[1]; + TAssoc_array& unsins = (TAssoc_array&) _uns_cache[2]; + TRiga_scadenze& rs = _p->rata(riga,rata); const char ssez = _p->riga(riga).sezione(); const char* field = (_stvaluta && rs.in_valuta()) ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO; const char* sfield = (_stvaluta && rs.in_valuta()) ? SCAD_IMPORTOVAL : SCAD_IMPORTO; - TImporto work_imp, - totalep, // Totale dei pagamenti + TImporto totalep, // Totale dei pagamenti scdz; // Importo in scadenza scdz += TImporto(ssez,rs.get_real(sfield)); totalep += rs.importo_pagato(_stvaluta); // Quanto e' stato pagato per questa scadenza? @@ -307,13 +317,13 @@ void TStampaScadenzario::calcola_pagamenti(real& imp_scad, int riga, int rata, T const TRectype pag = rs.row(p); // 2 : nota di credito const TRiga_partite& sum = _p->riga(p); // 3,4,6 : incasso/pagamento/abbuono/pag.insoluto/diff.cambio/rit.prof const char sez = sum.sezione(); - const int tipomov = sum.get_int(PART_TIPOMOV); + const tipo_movimento tipomov = (tipo_movimento)sum.get_int(PART_TIPOMOV); // se tipomov e' 2 (Nota di credito assegnata) // storna da scdz. In entrambi i casi si ha l'operatore +=, perche' nel TImporto e' gia' // compresa la sezione opposta - if (tipomov == 2) + if (tipomov == tm_nota_credito) { - work_imp = TImporto(sez,pag.get_real(field)); + const TImporto work_imp = TImporto(sez,pag.get_real(field)); scdz += work_imp; totalep -= work_imp; } @@ -328,12 +338,12 @@ void TStampaScadenzario::calcola_pagamenti(real& imp_scad, int riga, int rata, T scdz.normalize(norm); _w_imp_pag = totalep.valore(); imp_scad = scdz.valore(); - real a,b; - TString k; k.cut(0); - look_in_cache(a,b,uns,unsnc,k); + real a,b,c; + TString k; + look_in_cache(a,b,c,uns,unsnc,unsins,k); if (b > ZERO) // Scala le note di credito dalle scadenze { - real gap = (b > imp_scad ? imp_scad : b); + const real gap = b > imp_scad ? imp_scad : b; imp_scad -= gap; b -= gap; if (b > ZERO) @@ -343,9 +353,9 @@ void TStampaScadenzario::calcola_pagamenti(real& imp_scad, int riga, int rata, T } if (a > ZERO && imp_scad > _w_imp_pag) { - // Lo scalare dei non assegnati e' progressivo a partire dalla rata piu' vecchia. - // Se ce n'e' in piu' vengono ignorati. - real gap = (a > imp_scad ? imp_scad : a); + // Lo scalare dei non assegnati e' progressivo a partire dalla rata piu' vecchia. + // Se ce n'e' in piu' vengono ignorati. + const real gap = a > imp_scad ? imp_scad : a; _w_imp_pag += gap; a -= gap; if (a > ZERO) @@ -353,6 +363,17 @@ void TStampaScadenzario::calcola_pagamenti(real& imp_scad, int riga, int rata, T else uns.remove(k); // Free some space when 0 reached } + if (c > ZERO) + { + const real gap = c > _w_imp_pag ? _w_imp_pag : c; + _w_imp_pag -= gap; + c -= gap; + if (c > ZERO) + unsins.add(k,c,TRUE); + else + unsins.remove(k); // Free some space when 0 reached + } + _w_imp_res = imp_scad - _w_imp_pag; } @@ -388,19 +409,6 @@ bool TStampaScadenzario::preprocess_page(int file, int counter) } if (file == LF_SCADENZE && !_end_printed) { -/* - TCursor_sheet& cs = _m->cur_sheet(); // Sheet di selezione (CLI/FO/PCON) - TCursor* c = cs.cursor(); - TRectype& rec = c->curr(); - if (_tipost == clienti || _tipost == fornitori) - rec = current_cursor()->curr(LF_CLIFO); - else - if (_tipost == altri) - rec = current_cursor()->curr(LF_PCON); - - if (!cs.checked(c->read(_isequal))) // Se non e' stato selezionato salta alla prossima scdz - return FALSE; -*/ TBill bill(rc); if (!_m->selected(bill)) return FALSE; @@ -442,9 +450,17 @@ bool TStampaScadenzario::preprocess_page(int file, int counter) } } calcola_pagamenti(imp_scad,nrigap,nratap, bill); - if (_w_imp_res == ZERO && ! _ratesald - || imp_scad == ZERO) // Se la rata e' stata saldata e non e' abilitato il flag di stampa - return FALSE; // oppure l'importo in scadenza e' 0 allora salta alla prossima scadenza + + // Se la rata e' stata saldata e non e' abilitato il flag di stampa + // oppure l'importo in scadenza e' 0 allora salta alla prossima scadenza + + /* + if (_w_imp_res == 0.0 && !_ratesald || imp_scad == 0.0) + return FALSE; // + */ + if (!_ratesald && _w_imp_res == 0.0) + return FALSE; + _annopart.format("%d",annop); _annopart.ltrim(2); _rimdir=""; @@ -477,7 +493,7 @@ bool TStampaScadenzario::preprocess_page(int file, int counter) if (file==LF_CLIFO) { - TString xxx(current_cursor()->curr(LF_CLIFO).get(CLI_RAGSOC)); + TString80 xxx(current_cursor()->curr(LF_CLIFO).get(CLI_RAGSOC)); *_ragsoc = xxx.strip_d_spaces(); } if (file ==LF_PCON) @@ -669,7 +685,10 @@ bool TStampaScadenzario::user_create() _des_conto = new TParagraph_string("",17); _tl.add(new TAssoc_array);_tl.add(new TAssoc_array);_tl.add(new TAssoc_array); - _uns_cache.add(new TAssoc_array);_uns_cache.add(new TAssoc_array); + _uns_cache.add(new TAssoc_array); // Pagamenti + _uns_cache.add(new TAssoc_array); // Note di credito + _uns_cache.add(new TAssoc_array); // Insoluti + TConfig conf (CONFIG_DITTA,"cg"); _m = new TSelection_ext_mask("sc2200a"); _m->enable(F_VALUTA,conf.get_bool("GesVal")); @@ -1031,20 +1050,29 @@ void TStampaScadenzario::print_rows_riepilogo(int& nriga, bool type, TAssoc_arra as.sort(); for (int i=0; i < items; i++) { - TString k (as.row(i)); - TString val(k.right(3)); - TString value; + const TString& k = as.row(i); real& v = (real&)t[k]; + if (v.is_zero()) + continue; + + TString16 val = k.right(3); const int tipo = k[0]-'0'; const char ult = k[1]; - - const bool stampa_in_valuta = _stvaluta && val != " "; - - print_real(value, v, stampa_in_valuta ? val : "_FIRM"); - if (v != ZERO) - set_row(nriga++,"@0g!@3g%s@25g!@27g%c@32g!@34g%s@39g!@42g%18s@60g!", - tipi_tab[tipo], ult, (const char*) val, (const char*) value); + TString80 ult_class; + if (ult > ' ') + { + const char cod[3] = { tipo+'0', ult, '\0' }; + ult_class = cache().get("%CLR", cod).get("S0"); + ult_class.cut(27); + } + + const bool stampa_in_valuta = _stvaluta && !val.blank(); + TString80 value; + print_real(value, v, stampa_in_valuta ? val : "_FIRM"); + set_row(nriga++,"@0g! %s@25g! %s@55g! %s@61g!@64g%18s@82g!", + tipi_tab[tipo], (const char*)ult_class, (const char*)val, (const char*)value); + // Cerca la valuta "val" nell'assoc array dei totali per il prospetto if (tot.is_key(val)) { @@ -1061,24 +1089,24 @@ void TStampaScadenzario::print_riepilogo(int &nriga, bool type) // Setta le righe di stampa per lo schema riepilogativo con ordinamento primario per data // Con type == 1 stampa il riepilogo del periodo; viceversa quello del mese. { - TString s(61); + TString s(83); TAssoc_array totali; // Assoc array per i totali distinti per valuta TString_array as; - s.fill('-'); + s.fill('-', 83); nriga++; set_row(nriga++,"%s",(const char *)s); if (!type) { if (_ordata) { - set_row(nriga++,"@0g!@2g%s@60g!",itom(_cur_data.month())); + set_row(nriga++,"@0g! %s@82g!",itom(_cur_data.month())); set_row(nriga++,"%s",(const char*)s); } } else { set_row(nriga,"!@5gTotali dal %s al ",_datai.string(brief)); - set_row(nriga++,"%s@60g!",_dataf.string(brief)); + set_row(nriga++,"%s@82g!",_dataf.string(brief)); set_row(nriga++,"%s",(const char *)s); } print_rows_riepilogo(nriga, type, totali); @@ -1098,12 +1126,12 @@ void TStampaScadenzario::print_riepilogo(int &nriga, bool type) { if (i == 0) set_row(nriga++,"%s",(const char *)s); // Se c'e' almeno un totale != 0 allora stampa il separe' - set_row(nriga++,"!@34g%s@42g%18s@60g!",(const char*) val, (const char*) value); + set_row(nriga++,"@55g! %s@61g!@64g%18s@82g!",(const char*) val, (const char*) value); } else { - if (val == " ") val = "LIT"; - set_row(nriga++,"! Partite pareggiate in %s. @60g!",(const char*) val); + if (val.blank()) val = "LIT"; + set_row(nriga++,"! Partite pareggiate in %s. @82g!",(const char*) val); } } set_row(nriga++,"%s",(const char *)s); diff --git a/sv/sv1200.ini b/sv/sv1200.ini index 74f4b71f8..e7b1895bd 100755 --- a/sv/sv1200.ini +++ b/sv/sv1200.ini @@ -3,3 +3,5 @@ GRMERC[1,3](1)=Gruppo Merceologico GRMERC[1,3](2)=GMC|GRMERC[1,3]|S0 GRMERC[4,5](1)=Sottogruppo Merceologico GRMERC[4,5](2)=GMC|GRMERC|S0 +GRMERC(1)=Cat.Merc. +GRMERC(2)=GMC|GRMERC|S0 diff --git a/ve/f33.dir b/ve/f33.dir index 29dcb8f49..0003454cd 100755 --- a/ve/f33.dir +++ b/ve/f33.dir @@ -1,4 +1,3 @@ 33 0 $doc|0|0|418|0|Documenti di vendita|NDOC*3|| - diff --git a/ve/fatacq.src b/ve/fatacq.src index dde87b8e7..b928b5846 100755 --- a/ve/fatacq.src +++ b/ve/fatacq.src @@ -167,12 +167,13 @@ NHANDLER=0 NGROUPS=10 1=1000 2=100 -3=400 -4=500 -5=600 -6=700 -7=830 -8=1400 -9=1900 -10=2900 +3=200 +4=400 +5=500 +6=600 +7=700 +8=830 +9=1400 +10=1900 +11=2900 diff --git a/ve/ve0100.cpp b/ve/ve0100.cpp index f940050b9..5c7fa3d1e 100755 --- a/ve/ve0100.cpp +++ b/ve/ve0100.cpp @@ -104,16 +104,25 @@ void TMotore_application::init_modify_mode( TMask& m ) // Non dare messaggi inutili durante la cancellazione automatica if (autodeleting() != 0x3) { - const bool no_mod = !doc().modificabile(); + const bool transaction = is_transaction(); + const bool no_mod = !doc().modificabile() && !transaction; const bool no_del = !doc().cancellabile(); if (no_del || no_mod) { if (key != __last_key) - { - warning_box(format("Documento non %s%s%s.", - (no_mod ? "modificabile":""), - (no_mod && no_del ? " ne' ":""), - (no_del ? "cancellabile":""))); + { + TString msg; + msg.format("Documento non %s%s%s.", (no_mod ? "modificabile":""), + (no_mod && no_del ? " ne' ":""), (no_del ? "cancellabile":"")); + if (transaction) + { + TTimed_box box("Attenzione", msg, 5, DLG_OK, 32, 5); + + box.add_button(DLG_OK, 0, "", -11, -1, 10, 2); + box.run(); + } + else + warning_box(msg); } } if (no_mod) @@ -308,19 +317,30 @@ void TMotore_application::sheet2ini(TSheet_field &sheet,TConfig& ini) // scrive le righe degli sheet associati TString16 defpar; TString str(80); - TMask &m = sheet.mask(); + TDocumento_mask &m = (TDocumento_mask &)sheet.mask(); for (int r = 1 ; r <= sheet.items(); r++) { TString16 defpar = format("%d,%d",LF_RIGHEDOC,r); - const TMask& sm = sheet.sheet_mask(); + const TMask * sm = m.riga_mask(r-1); - for (int sf = 0; sf < sm.fields(); sf++) + for (int sf = 0; sf < sm->fields(); sf++) { - TMask_field& campo = sm.fld(sf); + TMask_field& campo = sm->fld(sf); if (campo.shown() && campo.field()) { str = sheet.row(r-1).get(sheet.cid2index(campo.dlg())); if (str.empty()) str = " "; + const word field_class = campo.class_id(); + if (field_class == CLASS_MEMO_FIELD || + field_class == CLASS_ZOOM_FIELD) + { + int p; + while ((p = str.find('\n', 0)) >= 0) + { + str.overwrite("\\", p); + str.insert("n", p+1); + } + } TString16 dbfname=campo.field()->name(); ini.set(campo.field()->name(), str ,defpar); } @@ -362,9 +382,33 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query) TAssoc_array& var = ini.list_variables(); FOR_EACH_ASSOC_STRING(var, obj, key, val) { - if (stricmp(key, RDOC_NRIGA) != 0) // Ignora il numero riga .. - if (stricmp(key, RDOC_TIPORIGA) != 0) // ... ed il tipo riga - rec.put(key, val); + if (stricmp(key, RDOC_DESCR) == 0) // Trattamento speciale per la descrizione + { + const TString s(esc(val)); + int split_pos = s.find('\n'); + const int descr_len = rec.length("DESCR"); + if (split_pos < 0 && s.len() > descr_len) + split_pos = descr_len; + if (split_pos > descr_len) + split_pos = descr_len; + if (split_pos > 0) + { + rec.put( "DESCR", s.left(split_pos)); + rec.put("DESCLUNGA", "X"); + rec.put("DESCEST", s.mid(split_pos)); + } + else + { + rec.put("DESCR", s); + rec.put("DESCLUNGA", ""); + rec.zero("DESCEST"); + } + + } + else + if (stricmp(key, RDOC_NRIGA) != 0) // Ignora il numero riga .. + if (stricmp(key, RDOC_TIPORIGA) != 0) // ... ed il tipo riga + rec.put(key, val); } // solo la insert chiama la post_insert necessaria alla disabilitazione verifichiamo // l'autoload ?? diff --git a/ve/ve0100b.uml b/ve/ve0100b.uml index e896445c6..c90d902fa 100755 --- a/ve/ve0100b.uml +++ b/ve/ve0100b.uml @@ -127,6 +127,11 @@ BEGIN PROMPT 10 15 "" FLAGS "HR" END +STRING F_CODVAL_ELAB 4 +BEGIN + PROMPT 10 25 "" + FLAGS "HR" +END NUMBER F_NDOC_ELAB 6 BEGIN diff --git a/ve/ve0100b1.h b/ve/ve0100b1.h index 4dbc7e2f0..e57928d71 100755 --- a/ve/ve0100b1.h +++ b/ve/ve0100b1.h @@ -19,5 +19,6 @@ #define F_UMQTA 119 #define F_QTA 120 #define F_NUMDOCRIF 127 +#define F_CODVAL_ELAB 128 #define GRP_ART 2 \ No newline at end of file diff --git a/ve/ve0200e.uml b/ve/ve0200e.uml index 9036d58c9..0d3265f7f 100755 --- a/ve/ve0200e.uml +++ b/ve/ve0200e.uml @@ -162,82 +162,12 @@ BEGIN OUTPUT F_IVASTORNO CODTAB END -ENDPAGE - -PAGE "Distinta Base" 1 1 60 14 - -BOOLEAN F_EXPLODEDB +BOOLEAN F_CHECKPREVCONT BEGIN - PROMPT 2 2 "Esplosione distinte" - MESSAGE FALSE CLEAR,8@ - MESSAGE TRUE ENABLE,8@ - FIELD EXPLODEDB -END - -GROUPBOX DLG_NULL 78 14 -BEGIN -PROMPT 1 4 "Parametri esplosione" + PROMPT 2 16 "Controlla che i documenti precedenti siano contabilizzati" + FIELD CHECKPREVCONT END -LISTBOX F_VALCOMP 15 -BEGIN - PROMPT 2 6 "Calcolo valore su " - ITEM " |Prodotto finito" - ITEM "X|Componenti" - FIELD VALCOMP - GROUP 8 -END - -LISTBOX F_TIPOESPL 20 -BEGIN - PROMPT 2 8 "Tipo esplosione " - ITEM " |Scalare" - ITEM "X|Materiali di base" - FIELD TIPOESPL - GROUP 8 -END - -BOOLEAN F_RAGGART -BEGIN - PROMPT 2 10 "Raggruppo articoli uguali" - FIELD RAGGART - GROUP 8 -END - -NUMBER F_LIVELLO 3 -BEGIN - PROMPT 2 12 "Livello esplosione " - FIELD LIVESPL - GROUP 8 -END - -NUMBER F_ORDDB 3 -BEGIN - PROMPT 2 14 "Ordinamento distinta " - USE ORD - INPUT CODTAB F_ORDDB - DISPLAY "Codice" CODTAB - DISPLAY "Descrizione@50" S0 - OUTPUT F_ORDDB CODTAB - OUTPUT F_DESORDDB S0 - FIELD ORDDB - CHECKTYPE NORMAL - GROUP 8 -END - -STRING F_DESORDDB 47 -BEGIN - PROMPT 30 14 "" - FLAGS "D" -END - -BOOLEAN F_ELRORIG -BEGIN - PROMPT 2 16 "Elimino la riga originale" - FIELD ELRORIG - GROUP 8 -END - ENDPAGE diff --git a/ve/ve0200g.uml b/ve/ve0200g.uml index a952a88be..e1423bb29 100755 --- a/ve/ve0200g.uml +++ b/ve/ve0200g.uml @@ -23,7 +23,7 @@ BEGIN MESSAGE TRUE ENABLE,8@ FIELD EXPLODEDB END - + GROUPBOX DLG_NULL 78 14 BEGIN PROMPT 1 4 "Parametri esplosione" @@ -59,14 +59,14 @@ BEGIN FIELD RAGGART GROUP 8 END - + NUMBER F_LIVELLO 3 BEGIN PROMPT 2 12 "Livello esplosione " FIELD LIVESPL GROUP 8 END - + NUMBER F_ORDDB 3 BEGIN PROMPT 2 14 "Ordinamento distinta " @@ -80,24 +80,24 @@ BEGIN CHECKTYPE NORMAL GROUP 8 END - + STRING F_DESORDDB 47 BEGIN PROMPT 30 14 "" FLAGS "D" END - + BOOLEAN F_ELRORIG BEGIN PROMPT 2 16 "Elimino la riga originale" FIELD ELRORIG GROUP 8 END - + ENDPAGE PAGE "Articoli" 1 1 60 14 - + GROUPBOX DLG_NULL 78 3 BEGIN PROMPT 1 2 "" @@ -107,10 +107,10 @@ BOOLEAN F_CHK_USER1 BEGIN PROMPT 2 2 "Campo libero 1" MESSAGE FALSE CLEAR,11@ - MESSAGE TRUE ENABLE,11@ + MESSAGE TRUE ENABLE,11@ FIELD CHK_USER[1] END - + STRING F_PROMPT_USER1 20 BEGIN PROMPT 2 3 "Prompt " @@ -129,24 +129,24 @@ BEGIN FIELD TYPE_USER[1] GROUP 11 END - + NUMBER F_LEN_USER1 2 BEGIN PROMPT 45 3 "Lunghezza " FIELD LEN_USER[1] - GROUP 11 + GROUP 11 FLAGS "U" NUM_EXPR (#THIS_FIELD>0)&&(#THIS_FIELD<=20) WARNING "La lunghezza del campo deve essere maggiore di 0 e non puo' superare 20 caratteri" END - + STRING F_DEC_USER1 2 BEGIN PROMPT 58 3 "Decimali " FIELD DEC_USER[1] GROUP 11 END - + GROUPBOX DLG_NULL 78 3 BEGIN PROMPT 1 5 "" @@ -156,10 +156,10 @@ BOOLEAN F_CHK_USER2 BEGIN PROMPT 2 5 "Campo libero 2" MESSAGE FALSE CLEAR,12@ - MESSAGE TRUE ENABLE,12@ + MESSAGE TRUE ENABLE,12@ FIELD CHK_USER[2] END - + STRING F_PROMPT_USER2 20 BEGIN PROMPT 2 6 "Prompt " @@ -178,7 +178,7 @@ BEGIN FIELD TYPE_USER[2] GROUP 12 END - + NUMBER F_LEN_USER2 2 BEGIN PROMPT 45 6 "Lunghezza " @@ -188,14 +188,14 @@ BEGIN NUM_EXPR (#THIS_FIELD>0)&&(#THIS_FIELD<=20) WARNING "La lunghezza del campo deve essere maggiore di 0 e non puo' superare 20 caratteri" END - + STRING F_DEC_USER2 2 BEGIN PROMPT 58 6 "Decimali " FIELD DEC_USER[2] GROUP 12 END - + GROUPBOX DLG_NULL 78 3 BEGIN PROMPT 1 8 "" @@ -205,10 +205,10 @@ BOOLEAN F_CHK_USER3 BEGIN PROMPT 2 8 "Campo libero 3" MESSAGE FALSE CLEAR,13@ - MESSAGE TRUE ENABLE,13@ + MESSAGE TRUE ENABLE,13@ FIELD CHK_USER[3] END - + STRING F_PROMPT_USER3 20 BEGIN PROMPT 2 9 "Prompt " @@ -227,7 +227,7 @@ BEGIN FIELD TYPE_USER[3] GROUP 13 END - + NUMBER F_LEN_USER3 2 BEGIN PROMPT 45 9 "Lunghezza " @@ -237,14 +237,14 @@ BEGIN NUM_EXPR (#THIS_FIELD>0)&&(#THIS_FIELD<=20) WARNING "La lunghezza del campo deve essere maggiore di 0 e non puo' superare 20 caratteri" END - + STRING F_DEC_USER3 2 BEGIN PROMPT 58 9 "Decimali " FIELD DEC_USER[3] GROUP 13 END - + GROUPBOX DLG_NULL 78 3 BEGIN PROMPT 1 11 "" @@ -254,10 +254,10 @@ BOOLEAN F_CHK_USER4 BEGIN PROMPT 2 11 "Campo libero 4" MESSAGE FALSE CLEAR,14@ - MESSAGE TRUE ENABLE,14@ + MESSAGE TRUE ENABLE,14@ FIELD CHK_USER[4] END - + STRING F_PROMPT_USER4 20 BEGIN PROMPT 2 12 "Prompt " @@ -276,7 +276,7 @@ BEGIN FIELD TYPE_USER[4] GROUP 14 END - + NUMBER F_LEN_USER4 2 BEGIN PROMPT 45 12 "Lunghezza " @@ -286,14 +286,14 @@ BEGIN NUM_EXPR (#THIS_FIELD>0)&&(#THIS_FIELD<=20) WARNING "La lunghezza del campo deve essere maggiore di 0 e non puo' superare 20 caratteri" END - + STRING F_DEC_USER4 2 BEGIN PROMPT 58 12 "Decimali " FIELD DEC_USER[4] GROUP 14 END - + GROUPBOX DLG_NULL 78 3 BEGIN PROMPT 1 14 "" @@ -303,10 +303,10 @@ BOOLEAN F_CHK_USER5 BEGIN PROMPT 2 14 "Campo libero 5" MESSAGE FALSE CLEAR,15@ - MESSAGE TRUE ENABLE,15@ + MESSAGE TRUE ENABLE,15@ FIELD CHK_USER[5] END - + STRING F_PROMPT_USER5 20 BEGIN PROMPT 2 15 "Prompt " @@ -325,7 +325,7 @@ BEGIN FIELD TYPE_USER[5] GROUP 15 END - + NUMBER F_LEN_USER5 2 BEGIN PROMPT 45 15 "Lunghezza " @@ -335,18 +335,18 @@ BEGIN NUM_EXPR (#THIS_FIELD>0)&&(#THIS_FIELD<=20) WARNING "La lunghezza del campo deve essere maggiore di 0 e non puo' superare 20 caratteri" END - + STRING F_DEC_USER5 2 BEGIN PROMPT 58 15 "Decimali " FIELD DEC_USER[5] GROUP 15 END - + ENDPAGE PAGE "Articoli" 1 1 60 14 - + GROUPBOX DLG_NULL 78 3 BEGIN PROMPT 1 2 "" @@ -356,10 +356,10 @@ BOOLEAN F_CHK_USER6 BEGIN PROMPT 2 2 "Campo libero 6" MESSAGE FALSE CLEAR,16@ - MESSAGE TRUE ENABLE,16@ + MESSAGE TRUE ENABLE,16@ FIELD CHK_USER[6] END - + STRING F_PROMPT_USER6 20 BEGIN PROMPT 2 3 "Prompt " @@ -378,7 +378,7 @@ BEGIN FIELD TYPE_USER[6] GROUP 16 END - + NUMBER F_LEN_USER6 2 BEGIN PROMPT 45 3 "Lunghezza " @@ -388,14 +388,14 @@ BEGIN NUM_EXPR (#THIS_FIELD>0)&&(#THIS_FIELD<=20) WARNING "La lunghezza del campo deve essere maggiore di 0 e non puo' superare 20 caratteri" END - + STRING F_DEC_USER6 2 BEGIN PROMPT 58 3 "Decimali " FIELD DEC_USER[6] GROUP 16 END - + GROUPBOX DLG_NULL 78 3 BEGIN PROMPT 1 5 "" @@ -405,10 +405,10 @@ BOOLEAN F_CHK_USER7 BEGIN PROMPT 2 5 "Campo libero 7" MESSAGE FALSE CLEAR,17@ - MESSAGE TRUE ENABLE,17@ + MESSAGE TRUE ENABLE,17@ FIELD CHK_USER[7] END - + STRING F_PROMPT_USER7 20 BEGIN PROMPT 2 6 "Prompt " @@ -427,7 +427,7 @@ BEGIN FIELD TYPE_USER[7] GROUP 17 END - + NUMBER F_LEN_USER7 2 BEGIN PROMPT 45 6 "Lunghezza " @@ -437,14 +437,14 @@ BEGIN NUM_EXPR (#THIS_FIELD>0)&&(#THIS_FIELD<=20) WARNING "La lunghezza del campo deve essere maggiore di 0 e non puo' superare 20 caratteri" END - + STRING F_DEC_USER7 2 BEGIN PROMPT 58 6 "Decimali " FIELD DEC_USER[7] GROUP 17 END - + GROUPBOX DLG_NULL 78 3 BEGIN PROMPT 1 8 "" @@ -454,10 +454,10 @@ BOOLEAN F_CHK_USER8 BEGIN PROMPT 2 8 "Campo libero 8" MESSAGE FALSE CLEAR,18@ - MESSAGE TRUE ENABLE,18@ + MESSAGE TRUE ENABLE,18@ FIELD CHK_USER[8] END - + STRING F_PROMPT_USER8 20 BEGIN PROMPT 2 9 "Prompt " @@ -476,7 +476,7 @@ BEGIN FIELD TYPE_USER[8] GROUP 18 END - + NUMBER F_LEN_USER8 2 BEGIN PROMPT 45 9 "Lunghezza " @@ -486,14 +486,14 @@ BEGIN NUM_EXPR (#THIS_FIELD>0)&&(#THIS_FIELD<=20) WARNING "La lunghezza del campo deve essere maggiore di 0 e non puo' superare 20 caratteri" END - + STRING F_DEC_USER8 2 BEGIN PROMPT 58 9 "Decimali " FIELD DEC_USER[8] GROUP 18 END - + GROUPBOX DLG_NULL 78 3 BEGIN PROMPT 1 11 "" @@ -503,10 +503,10 @@ BOOLEAN F_CHK_USER9 BEGIN PROMPT 2 11 "Campo libero 9" MESSAGE FALSE CLEAR,19@ - MESSAGE TRUE ENABLE,19@ + MESSAGE TRUE ENABLE,19@ FIELD CHK_USER[9] -END - +END + STRING F_PROMPT_USER9 20 BEGIN PROMPT 2 12 "Prompt " @@ -525,7 +525,7 @@ BEGIN FIELD TYPE_USER[9] GROUP 19 END - + NUMBER F_LEN_USER9 2 BEGIN PROMPT 45 12 "Lunghezza " @@ -535,14 +535,14 @@ BEGIN NUM_EXPR (#THIS_FIELD>0)&&(#THIS_FIELD<=20) WARNING "La lunghezza del campo deve essere maggiore di 0 e non puo' superare 20 caratteri" END - + STRING F_DEC_USER9 2 BEGIN PROMPT 58 12 "Decimali " FIELD DEC_USER[9] GROUP 19 END - + GROUPBOX DLG_NULL 78 3 BEGIN PROMPT 1 14 "" @@ -552,10 +552,10 @@ BOOLEAN F_CHK_USER10 BEGIN PROMPT 2 14 "Campo libero 10" MESSAGE FALSE CLEAR,20@ - MESSAGE TRUE ENABLE,20@ + MESSAGE TRUE ENABLE,20@ FIELD CHK_USER[10] END - + STRING F_PROMPT_USER10 20 BEGIN PROMPT 2 15 "Prompt " @@ -574,7 +574,7 @@ BEGIN FIELD TYPE_USER[10] GROUP 20 END - + NUMBER F_LEN_USER10 2 BEGIN PROMPT 45 15 "Lunghezza " @@ -584,14 +584,14 @@ BEGIN NUM_EXPR (#THIS_FIELD>0)&&(#THIS_FIELD<=20) WARNING "La lunghezza del campo deve essere maggiore di 0 e non puo' superare 20 caratteri" END - + STRING F_DEC_USER10 2 BEGIN PROMPT 58 15 "Decimali " FIELD DEC_USER[10] GROUP 20 END - + ENDPAGE ENDMASK diff --git a/ve/ve1100.cpp b/ve/ve1100.cpp index 12b74bd2a..9265c1703 100755 --- a/ve/ve1100.cpp +++ b/ve/ve1100.cpp @@ -10,9 +10,6 @@ #include #include #include -#include -#include -#include #include #include @@ -1169,6 +1166,12 @@ void TStampaDoc_application::print_selected() if (!_is_lista) { cur.setregion(darec, arec); + if (!order_by_num) + { + TString80 filter; + filter.format("(CODNUM==\"%s\")&&(PROVV==\"%c\")", (const char*)_codnum, _provv); + cur.setfilter(filter); + } const long items = cur.items(); behaviour whattodo = go; bool first_inst = TRUE; diff --git a/ve/ve2200.cpp b/ve/ve2200.cpp index 99c3ec93d..0de714b6c 100755 --- a/ve/ve2200.cpp +++ b/ve/ve2200.cpp @@ -1,8 +1,10 @@ -#include +#include #include -#include -#include #include +#include +#include +#include +#include #include #include "ve2200.h" @@ -44,9 +46,11 @@ class TCondizioni_vendita: public TRelation_application { static bool handle_datacam(TMask_field &, KEY); // handler del campo DATACAM (data cambio) static bool handle_valfin(TMask_field &, KEY); // handler del campo VALFIN (data fine validità) static bool handle_codsucc(TMask_field &, KEY); // handler del campo CODSUCC (codice successivo) + static bool handle_copy(TMask_field &, KEY); // handler del bottone copia - virtual void init_query_mode(TMask& m) { m.disable(BTN_RIGHE); } - virtual void init_insert_mode(TMask& m) {init_query_mode(m); } + virtual void init_query_mode(TMask& m); + virtual void init_insert_mode(TMask& m); + virtual void init_modify_mode(TMask& m); virtual int read(TMask &); // metodo usato per leggere il record dal file virtual int write(const TMask &); // metodo usato per scrivere il record sul file virtual int rewrite(const TMask &); // metodo usato per aggiornare il record sul file @@ -60,11 +64,49 @@ class TCondizioni_vendita: public TRelation_application { }; +class TMask_copy: public TAutomask +{ + public: + virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + TMask_copy(const TMask& m); +}; +bool TMask_copy::on_field_event(TOperable_field& o, TField_event e, long jolly) +{ + return TRUE; +} + +TMask_copy::TMask_copy(const TMask& m) : TAutomask("ve2200c") +{ + enable(F_L_CATVEN,m.field(F_L_CATVEN).enabled()); + set(F_TIPO,m.get(F_TIPO)); +} + + + + TCondizioni_vendita &app() { // funzione che ritorna il riferimento alla classe principale dell'applicazione return (TCondizioni_vendita &)main_app(); } + +void TCondizioni_vendita::init_query_mode(TMask& m) +{ + m.disable(BTN_RIGHE); + m.disable(BTN_COPIA); +} + +void TCondizioni_vendita::init_insert_mode(TMask& m) +{ + init_query_mode(m); +} + +void TCondizioni_vendita::init_modify_mode(TMask& m) +{ + m.enable(BTN_RIGHE); + m.enable(BTN_COPIA); +} + bool TCondizioni_vendita::user_create() { bool gotcha= FALSE; // booleano di avvenuta inizializzazione @@ -157,6 +199,7 @@ bool TCondizioni_vendita::user_create() { _msk->set_handler(handle_mask); // imposta l'handler generale della maschera _msk->set_handler(F_DATACAM, handle_datacam); // imposta l'handler per il campo della data del cambio _msk->set_handler(F_VALFIN, handle_valfin); // imposta l'handler per il campo di fine validità + _msk->set_handler(BTN_COPIA, handle_copy); // imposta l'handler per il bottone Copia if (!_gest_um) _msk->disable(F_GESTUM); // disabilita condizionalmente il booleano di gestione delle unità di misura if (!_gest_sca) { @@ -317,6 +360,62 @@ bool TCondizioni_vendita::remove() { +bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k) +{ + if (k==K_SPACE) + { + TMask& msk = b.mask(); + TMask_copy m(msk); // gli passo la maschera del bottone copia (cioé la maschera principale ve2200x) + if (m.run()==K_ENTER) + { + TRelation rel(LF_RCONDV); // creo un relazione sul file delle righe delle condizioni di vendita + TRectype rec(LF_RCONDV); // creo il record che usa nel filtro; case in base al tipo documentovendita + rec.put("TIPO",m.get(F_TIPO)); + TString16 newcode; //var stringa in cui mettere il nuovo codice del listino/contratto/offerta + + switch(m.get(F_TIPO)[0]) + { + case 'L': + rec.put("CATVEN",m.get(F_L_CATVEN)); + rec.put("COD",m.get(F_L_COD)); + newcode = msk.get(F_L_COD); + break; + case 'C': + rec.put("TIPOCF",m.get(F_C_TIPOCF)); + rec.put("CODCF",m.get(F_C_CODCF)); + rec.put("COD",m.get(F_C_COD)); + newcode = msk.get(F_C_COD); + break; + case 'O': + rec.put("COD",m.get(F_O_COD)); + newcode = msk.get(F_O_COD); + break; + + default: break; + } + + TCursor curs(&rel,"",1,&rec,&rec); //creo anche il cursore della relazione, con chiave 1(codice) e record iniz. e fin. uguali nel filtro + const long items = curs.items(); // metto in items il numero di elementi del cursore + curs.freeze(); + TProgind bar(items,"Scansione righe di origine"); //barra di avanzamento + + for (curs=0; curs.pos() < items; ++curs) + { + bar.addstatus(1); + curs.curr().put("COD", newcode); + int err = rel.write(); + if (err == _isreinsert && m.get(F_OVERWRITE)) + { + rel.rewrite(); + } + } + + } + } + return TRUE; +} + + int ve2200(int argc, char* argv[]) { TCondizioni_vendita a; diff --git a/ve/ve2200c.uml b/ve/ve2200c.uml new file mode 100755 index 000000000..2e947ee1c --- /dev/null +++ b/ve/ve2200c.uml @@ -0,0 +1,188 @@ +#include "ve2200x.h" + +PAGE "Copia" -1 -1 70 9 + +GROUPBOX DLG_NULL -1 6 +BEGIN + PROMPT 2 0 "@BCondizioni di vendita d'origine" + FLAGS "R" +END + +LIST F_TIPO 1 10 +BEGIN + PROMPT 100 100 "" + FLAGS "DUPG" + ITEM "L|Listini" + MESSAGE SHOW,1@|HIDE,2@|HIDE,3@ + ITEM "C|Contratti" + MESSAGE SHOW,2@|HIDE,1@|HIDE,3@ + ITEM "O|Offerte" + MESSAGE SHOW,3@|HIDE,1@|HIDE,2@ +END + + + +/////////////// LISTINI ///////////////// (GROUP 1) + +// campo riservato ai listini +STRING F_L_CATVEN 2 +BEGIN + GROUP 1 + PROMPT 3 1 "Cat. vendita " + FLAGS "U" + USE CVE + INPUT CODTAB F_L_CATVEN + DISPLAY "Cat." CODTAB + DISPLAY "Descrizione@50" S0 + OUTPUT F_L_CATVEN CODTAB + OUTPUT F_L_DESVEN S0 + CHECKTYPE FORCED +END + +// campo riservato ai listini +STRING F_L_DESVEN 40 +BEGIN + GROUP 1 + PROMPT 24 1 "" + FLAGS "D" +END + + +// codice del nuovo listino (e parametri relativi) +STRING F_L_COD 3 +BEGIN + GROUP 1 + PROMPT 3 2 "Cod. listino " + FLAGS "U" + GROUP 10 + USE LF_CONDV + INPUT TIPO F_TIPO SELECT + INPUT CATVEN F_L_CATVEN SELECT + INPUT COD F_L_COD + DISPLAY "C.V." CATVEN + DISPLAY "Codice" COD + DISPLAY "Descrizione@50" DESCR + DISPLAY "Valuta" CODVAL + DISPLAY "Fine validita'" VALFIN + OUTPUT F_TIPO TIPO + OUTPUT F_L_CATVEN CATVEN + OUTPUT F_L_COD COD + OUTPUT F_DESCR DESCR + CHECKTYPE REQUIRED +END + + +////////////// CONTRATTI /////////////////// (GROUP 2) + +// campo riservato ai contratti +LIST F_C_TIPOCF 10 +BEGIN + GROUP 2 + PROMPT 3 1 "Tipo " + FLAGS "D" + ITEM "C|Cliente" + ITEM "F|Fornitore" +END + +// campo riservato ai contratti +STRING F_C_CODCF 6 +BEGIN + GROUP 2 + PROMPT 3 2 "Codice " + FLAGS "U" + USE LF_CLIFO + INPUT TIPOCF F_C_TIPOCF SELECT + INPUT CODCF F_C_CODCF + DISPLAY "C/F" TIPOCF + DISPLAY "Codice" CODCF + DISPLAY "Ragione sociale@50" RAGSOC + OUTPUT F_C_TIPOCF TIPOCF + OUTPUT F_C_CODCF CODCF + OUTPUT F_C_DESCF RAGSOC + CHECKTYPE REQUIRED +END + +// campo riservato ai contratti +STRING F_C_DESCF 80 43 +BEGIN + GROUP 2 + PROMPT 24 2 "" + FLAGS "D" +END + +// campo riservato ai contratti +STRING F_C_COD 3 +BEGIN + GROUP 2 + PROMPT 3 3 "Contratto N. " + FLAGS "U" + GROUP 10 + USE LF_CONDV + INPUT TIPO F_TIPO SELECT + INPUT TIPOCF F_C_TIPOCF SELECT + INPUT CODCF F_C_CODCF + INPUT COD F_C_COD + DISPLAY "C/F" TIPOCF + DISPLAY "Codice" CODCF + DISPLAY "Numero" COD + DISPLAY "Descrizione@50" DESCR + OUTPUT F_TIPO TIPO + OUTPUT F_C_TIPOCF TIPOCF + OUTPUT F_C_CODCF CODCF + OUTPUT F_C_COD COD + OUTPUT F_DESCR DESCR + CHECKTYPE REQUIRED +END + + +/////////// OFFERTE ///////////////// (GROUP 3) + +// campo riservato alle offerte +STRING F_O_COD 3 +BEGIN + GROUP 3 + PROMPT 3 1 "Cod. offerta " + FLAGS "U" + GROUP 10 + USE LF_CONDV + INPUT TIPO F_TIPO SELECT + INPUT COD F_O_COD + DISPLAY "Codice" COD + DISPLAY "Descrizione@50" DESCR + OUTPUT F_TIPO TIPO + OUTPUT F_O_COD COD + OUTPUT F_DESCR DESCR + CHECKTYPE REQUIRED +END + + +////////////// COMUNI ////////////// + +// campo descrizione comune +STRING F_DESCR 50 +BEGIN + PROMPT 3 4 "Descrizione " + FLAGS "D" +END + +////////////// BOTTONI ///////////// + +//boolean di abilitazione all'overwrite su copia +BOOLEAN F_OVERWRITE +BEGIN + PROMPT 2 6 "Sovrascrivere record gia' presenti in caso di copia" +END + +BUTTON DLG_OK 10 2 +BEGIN + PROMPT -12 -1 "" +END + +BUTTON DLG_CANCEL 10 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE + +ENDMASK diff --git a/ve/ve2200x.h b/ve/ve2200x.h index 689ae3b8d..cfa652050 100755 --- a/ve/ve2200x.h +++ b/ve/ve2200x.h @@ -39,3 +39,5 @@ // pulsante di lancio dell'edit delle righe #define BTN_RIGHE 161 +#define BTN_COPIA 162 +#define F_OVERWRITE 163 diff --git a/ve/ve2200x.uml b/ve/ve2200x.uml index 7744e1477..80aaa1fa2 100755 --- a/ve/ve2200x.uml +++ b/ve/ve2200x.uml @@ -1,4 +1,3 @@ -#include #include "ve2200x.h" TOOLBAR "" 0 19 0 3 @@ -11,10 +10,20 @@ BEGIN MESSAGE K_F5 END +// bottone di lancio dell'applicazione per copiare listini,contratti e offerte +BUTTON BTN_COPIA 10 1 +BEGIN + PROMPT -26 -3 "C~opia" + FLAGS "D" +END + #include ENDPAGE + + + PAGE "Cond. di vendita" 0 0 70 19 GROUPBOX DLG_NULL 75 8 diff --git a/ve/ve2300x.uml b/ve/ve2300x.uml index c659f63b8..878edc6ec 100755 --- a/ve/ve2300x.uml +++ b/ve/ve2300x.uml @@ -320,7 +320,7 @@ BEGIN INPUT UM F_R_UM INPUT NSCAGL F_R_NSCAGL DISPLAY "Tipo" TIPORIGA - DISPLAY "Codice@20" CODRIGA + DISPLAY "Codice@40" CODRIGA DISPLAY "U.M." UM DISPLAY "N.S." NSCAGL OUTPUT F_R_TIPORIGA TIPORIGA @@ -345,7 +345,7 @@ BEGIN INPUT CODRIGA F_R_CODRIGA_A INPUT NSCAGL F_R_NSCAGL DISPLAY "Tipo" TIPORIGA - DISPLAY "Codice@20" CODRIGA + DISPLAY "Codice@40" CODRIGA DISPLAY "N.S." NSCAGL OUTPUT F_R_TIPORIGA TIPORIGA OUTPUT F_R_CODRIGA_R CODRIGA[1,5] @@ -367,7 +367,7 @@ BEGIN INPUT UM F_R_UM INPUT NSCAGL F_R_NSCAGL DISPLAY "Tipo" TIPORIGA - DISPLAY "Codice@20" CODRIGA + DISPLAY "Codice@40" CODRIGA DISPLAY "U.M." UM DISPLAY "N.S." NSCAGL OUTPUT F_R_TIPORIGA TIPORIGA diff --git a/ve/ve2400.cpp b/ve/ve2400.cpp index 1db40ea96..7242cca2e 100755 --- a/ve/ve2400.cpp +++ b/ve/ve2400.cpp @@ -1,9 +1,8 @@ -#include +#include +#include #include #include #include -#include -#include #include #include @@ -31,6 +30,7 @@ class TMask_anamag: public TMask { static bool handle_livart(TMask_field &, KEY); // handler dei campi codice articolo (livelli) static bool handle_anno(TMask_field &, KEY); // handler del campo anno delle giacenze static bool handle_stoanno(TMask_field &, KEY); // handler del campo anno delle giacenze + static bool handle_stoanno_row(TMask_field &, KEY); // handler del campo anno delle giacenze sulle righe static bool handle_sheet_um(TMask_field &, KEY); // handler dello sheet delle unità di misura static bool notify_sheet_um(TSheet_field & s, int r, KEY k); // notify dello sheet delle unità di misura static bool handle_sheet_deslin(TMask_field &, KEY); // handler dello sheet delle descrizioni in lingua @@ -127,23 +127,27 @@ void TMask_anamag::set_parametered_fields() // Abilita la pagina delle giacenze const bool gestmag = app().has_module(MGAUT) && magazzini().gestmag(); - // sheet giacenze - set_handler(F_ANNO, gestmag ? handle_anno : NULL); - set_handler(F_SHEETGIAC, gestmag ? handle_sheetgiac : NULL); - sfield(F_SHEETGIAC).set_notify(gestmag ? notify_sheet_giac : NULL); - sfield(F_SHEETGIAC).set_userget(gestmag ? sheetgiac_get : NULL); - sfield(F_SHEETGIAC).set_userput(gestmag ? sheetgiac_put : NULL); - sfield(F_SHEETGIAC).sheet_mask().set_handler(F_VALGIAC, gestmag ? handle_sheet_giac_valgiac : NULL); - // sheet storico - set_handler(F_SHEETSTOMAG, gestmag ? handle_sheetstomag : NULL); - sfield(F_SHEETSTOMAG).set_notify(gestmag ? notify_sheet_sto : NULL); - sfield(F_SHEETSTOMAG).set_userget(gestmag ? sheetsto_get : NULL); - sfield(F_SHEETSTOMAG).set_userput(gestmag ? sheetsto_put : NULL); - - TMask& stomask = sfield(F_SHEETSTOMAG).sheet_mask(); - stomask.set_handler(F_STOVAL, gestmag ? handle_sheet_stomag_stoval : NULL); + if (gestmag) + { +// sheet giacenze + set_handler(F_ANNO, handle_anno ); + set_handler(F_SHEETGIAC, handle_sheetgiac); + sfield(F_SHEETGIAC).set_notify(notify_sheet_giac); + sfield(F_SHEETGIAC).set_userget(sheetgiac_get); + sfield(F_SHEETGIAC).set_userput(sheetgiac_put); + sfield(F_SHEETGIAC).sheet_mask().set_handler(F_VALGIAC, handle_sheet_giac_valgiac); +// sheet storico + set_handler(F_SHEETSTOMAG, handle_sheetstomag); + sfield(F_SHEETSTOMAG).set_notify(notify_sheet_sto); + sfield(F_SHEETSTOMAG).set_userget(sheetsto_get); + sfield(F_SHEETSTOMAG).set_userput(sheetsto_put); + TMask& stomask = sfield(F_SHEETSTOMAG).sheet_mask(); + + stomask.set_handler(F_STOVAL, handle_sheet_stomag_stoval); + stomask.set_handler(F_STOANNOES, handle_stoanno_row); - set_handler(F_STOANNO, gestmag ? handle_stoanno : NULL); + set_handler(F_STOANNO, handle_stoanno); + } // setta i campi della maschera per la pagina giacenze TSheet_field &fld_stomag= (TSheet_field &)field(F_SHEETSTOMAG); @@ -528,11 +532,21 @@ bool TMask_anamag::handle_stoanno(TMask_field &fld, KEY k) fld_stomag.force_update(); } else - mask.last_annosto=mask.get_int(F_STOANNORIF); + mask.last_annosto=mask.get_int(F_STOANNORIF); + if (fld.focusdirty()) + TEsercizi_contabili::update(); } + return TRUE; } +bool TMask_anamag::handle_stoanno_row(TMask_field &fld, KEY k) +{ + if (k == K_TAB && fld.focusdirty()) + TEsercizi_contabili::update(); + + return TRUE; +} bool TMask_anamag::handle_sheet_um(TMask_field &fld, KEY k) { @@ -905,6 +919,7 @@ bool TMask_anamag::notify_sheet_sto(TSheet_field &s, int r, KEY k) break; case (K_ENTER): // fine modifica + newanno=(s.cell(r,s.cid2index(F_STOANNOES))); newcodmag=(s.cell(r,s.cid2index(F_STOCODMAG))); diff --git a/ve/ve2400.uml b/ve/ve2400.uml index c8dd976ab..149f10eba 100755 --- a/ve/ve2400.uml +++ b/ve/ve2400.uml @@ -1,7 +1,7 @@ #include "ve2400.h" -TOOLBAR "" 0 20 60 2 - #include +TOOLBAR "" 0 -2 0 2 +#include ENDPAGE PAGE "Codici" 0 0 70 20 @@ -970,11 +970,12 @@ BEGIN FLAGS "UP" USE ESC INPUT CODTAB F_ANNO - DISPLAY "Codice" CODTAB - DISPLAY "Dal@10" D0 - DISPLAY "Al@10" D1 + DISPLAY "Codice@10" CODTAB + DISPLAY "Dal@16" D0 + DISPLAY "Al@16" D1 OUTPUT F_ANNO CODTAB - CHECKTYPE NORMAL + CHECKTYPE NORMAL + ADD RUN cg0 -5 ESC END STRING F_ANNORIF 4 // anno usato per il write dell'annata precedente @@ -1071,11 +1072,12 @@ BEGIN FLAGS "UP" USE ESC INPUT CODTAB F_STOANNO - DISPLAY "Codice" CODTAB - DISPLAY "Dal@10" D0 - DISPLAY "Al@10" D1 + DISPLAY "Codice@10" CODTAB + DISPLAY "Dal@16" D0 + DISPLAY "Al@16" D1 OUTPUT F_STOANNO CODTAB CHECKTYPE NORMAL + ADD RUN cg0 -5 ESC END STRING F_STOANNORIF 4 // anno usato per il write dell'annata precedente diff --git a/ve/ve2400d.uml b/ve/ve2400d.uml index 1d0c88a43..b56e1abd1 100755 --- a/ve/ve2400d.uml +++ b/ve/ve2400d.uml @@ -1,4 +1,4 @@ -TOOLBAR "" 0 20 60 2 +TOOLBAR "" 0 -2 0 2 BUTTON DLG_OK 9 2 BEGIN diff --git a/ve/ve2400e.uml b/ve/ve2400e.uml index 2ce313a80..3cc585e34 100755 --- a/ve/ve2400e.uml +++ b/ve/ve2400e.uml @@ -1,4 +1,4 @@ -TOOLBAR "" 0 20 60 2 +TOOLBAR "" 0 -2 0 2 BUTTON DLG_OK 9 2 BEGIN @@ -60,6 +60,7 @@ BEGIN OUTPUT F_STOANNOES CODTAB CHECKTYPE REQUIRED PICTURE "9999" + ADD RUN cg0 -5 ESC END NUMBER F_STOQUANT 15 5 diff --git a/ve/ve3300.cpp b/ve/ve3300.cpp index 26838996d..5e0570498 100755 --- a/ve/ve3300.cpp +++ b/ve/ve3300.cpp @@ -69,6 +69,7 @@ bool TLCO_form::validate(TForm_item &cf, TToken_string &s) TLCO_form::TLCO_form(const char* name) : TForm(name) { + _umart = new TLocalisamfile (LF_UMART); set_magic_currency(TRUE); } diff --git a/ve/ve5100.cpp b/ve/ve5100.cpp index 708296a8e..f5b620630 100755 --- a/ve/ve5100.cpp +++ b/ve/ve5100.cpp @@ -120,7 +120,7 @@ void TDeletedoc_app::backup_delete_doc(int op, int who) if (op & 0x2) { err = _tdoc->write(doc.curr()); - const int rows = documento.rows(); + const int rows = documento.physical_rows(); // Memorizza le righe del documento sui file temporanei for (int x = 1; err == NOERR && x <= rows; x++) err = _trdoc->write(documento[x]); @@ -177,7 +177,7 @@ void TDeletedoc_app::backup_delete_doc(int op, int who) } else error_box("Errore %d scrivendo sui files temporanei." - " La cancellazione dei documenti chiuse non verra' effettuata.",err); + " La cancellazione dei documenti chiusi non verra' effettuata.",err); } if (op & 0x2) delete_tmp_files(); // Physical remove of tmp files diff --git a/ve/ve5200.uml b/ve/ve5200.uml index d30aa591f..366ee9d47 100755 --- a/ve/ve5200.uml +++ b/ve/ve5200.uml @@ -112,6 +112,7 @@ BEGIN DISPLAY "Provv" PROVV DISPLAY "Tipo" TIPODOC DISPLAY "N.Doc. " NDOC + DISPLAY "Data Doc. " DATADOC DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC OUTPUT F_DANUMERO NDOC CHECKTYPE SEARCH diff --git a/ve/ve6100.cpp b/ve/ve6100.cpp index 5b1be4131..70ecefe98 100755 --- a/ve/ve6100.cpp +++ b/ve/ve6100.cpp @@ -105,7 +105,7 @@ bool TContabilizzazione_app::handle_data_range(TMask_field& f, KEY k) f.error_box("L'intervallo tra le date non puo' eccedere i 15 giorni."); return FALSE; } - if (F_DATA_FIN) + if (f.dlg() == F_DATA_FIN) m.set(F_DATA_REG,f.get()); } if (f.focusdirty()) @@ -246,7 +246,7 @@ bool TContabilizzazione_app::create() { TApplication::create(); open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_OCCAS, LF_INDSP, LF_CFVEN, - LF_DOC, LF_RIGHEDOC, LF_ANAMAG, LF_MOVMAG, LF_RMOVMAG, + LF_DOC, LF_RIGHEDOC, LF_ANAMAG, LF_MOVMAG, LF_RMOVMAG, LF_PROVV, LF_PCON, LF_CONDV, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_ATTIV, LF_CAUSALI, 0); _msk = new TMask("ve6100a"); _msk->set_handler(F_CODICE_ELAB,handle_cod_eld); @@ -336,19 +336,22 @@ void TContabilizzazione_app::contabilize() msg << _data_fine.string(); TLista_documenti lista_in,lista_out; - TProgind p(cur_items,msg,FALSE,TRUE); - const TRectype& cur_rec = doc_cur.curr(); - for (doc_cur = 0; doc_cur.pos() < cur_items; ++doc_cur) - { - p.addstatus(1); - // controlla che il tipo documento e lo stato siano coerenti con la ELD selezionata - if (nums.find(cur_rec.get("CODNUM")) >= 0 && doc_tipo_stato_ok(cur_rec)) - { - TDocumento* doc = new TDocumento; - if (doc->read(doc_cur.curr()) == NOERR) // legge il documento - lista_in.add(doc); // Viene aggiunto alla lista dei documenti - else - delete doc; + if (cur_items > 0) // if inutile tanto per provocare la chiusura della TProgind + { + TProgind p(cur_items,msg,FALSE,TRUE); + const TRectype& cur_rec = doc_cur.curr(); + for (doc_cur = 0; doc_cur.pos() < cur_items; ++doc_cur) + { + p.addstatus(1); + // controlla che il tipo documento e lo stato siano coerenti con la ELD selezionata + if (nums.find(cur_rec.get("CODNUM")) >= 0 && doc_tipo_stato_ok(cur_rec)) + { + TDocumento* doc = new TDocumento; + if (doc->read(doc_cur.curr()) == NOERR) // legge il documento + lista_in.add(doc); // Viene aggiunto alla lista dei documenti + else + delete doc; + } } } cont.elabora(lista_in,lista_out,_data_reg); diff --git a/ve/ve6200.cpp b/ve/ve6200.cpp index aac70d31a..a93ecca87 100755 --- a/ve/ve6200.cpp +++ b/ve/ve6200.cpp @@ -3,88 +3,204 @@ #include #include "velib.h" - #include "ve6200a.h" +#include + class TFatturazione_bolle_app : public TSkeleton_application { -protected: // TApplication + TString4 _default_selection; + +protected: + virtual bool create(); virtual void main_loop(); + + bool process(TIndwin& iw, TFatturazione_bolle& eld, TLista_documenti& din, const TDate& data_elab); + void process_by_cli(const TMask& m); + void process_by_doc(const TMask& m); }; +bool TFatturazione_bolle_app::create() +{ + open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_OCCAS, LF_INDSP, LF_CFVEN, + LF_DOC, LF_RIGHEDOC, LF_ANAMAG, LF_MOVMAG, LF_RMOVMAG, LF_CONDV, LF_SVRIEP, + LF_AGENTI, LF_PERCPROV, LF_CAUSALI, 0); + + TConfig cfg(CONFIG_DITTA, "ve"); + _default_selection = cfg.get("FATBOLSEL"); + + return TSkeleton_application::create(); +} + +bool TFatturazione_bolle_app::process(TIndwin& iw, TFatturazione_bolle& eld, + TLista_documenti& din, const TDate& data_elab) +{ + // Crea documenti di output + TLista_documenti dout; + bool ok = eld.elabora(din, dout, data_elab); + if (ok) + { + TString msg; + msg << din.items() << " documenti raggruppati in " << dout.items(); + iw.set_text(msg); // Messaggio sul cliente + do_events(); // Attende visualizzazione + + int err = dout.write(); // Scrive documenti di output + if (err == NOERR) + { + err = din.rewrite(); // Aggiorna stato dei documenti di input + if (err != NOERR) + ok = error_box("Errore %d durante la scrittura dei documenti raggruppati!", err); + } + else + ok = error_box("Errore %d durante l'aggiornamento dei documenti da raggruppare!", err); + } + else + { + const long codcli = din[0].get_long(DOC_CODCF); + ok = error_box("I documenti relativi al cliente %ld non sono stati elaborati.", + codcli); + } + return ok; +} + +void TFatturazione_bolle_app::process_by_cli(const TMask& m) +{ + TIndwin iw(0, "Inizializzazione ...\n ", TRUE, FALSE, 60); + + const TDate data_elab = m.get(F_DATA_ELAB); + const int anno = data_elab.year(); + + const long dc = m.get_long(F_CODICE_CLIFO_DA); + const long ac = m.get_long(F_CODICE_CLIFO_A); + const int da = m.get_int(F_CODICE_AGENTE_DA); + const int aa = m.get_int(F_CODICE_AGENTE_A); + const TString16 dz(m.get(F_CODICE_ZONA_DA)); + const TString16 az(m.get(F_CODICE_ZONA_A)); + + const TDate dd = m.get(F_DATA_DOCUMENTO_DA); + TString st_da = m.get(F_DATA_DOCUMENTO_A); + const TDate ad = st_da.not_empty() ? (const char*)st_da : data_elab; + const TString& codnum = m.get(F_CODICE_NUMERAZIONE); + const long dn = m.get_long(F_NUMERO_DOCUMENTO_DA); + const long an = m.get_long(F_NUMERO_DOCUMENTO_A); + + TFatturazione_bolle eld(m.get(F_CODICE_ELAB)); + TToken_string tipidoc(24), statidoc(10); + eld.tipi_validi(tipidoc); + eld.stati_validi(statidoc); + + TLista_clienti clienti; + const int tot_cli = clienti.leggi(dc, ac, da, aa, dz, az); + + TString msg(80); + for (int c = 0; c < tot_cli && !iw.iscancelled(); c++) + { + const long codcli = clienti[c]; // Codice cliente in esame + msg = "Elaborazione dei documenti del cliente "; + msg << codcli << " ..."; + iw.set_text(msg); // Messaggio sul cliente + do_events(); // Attende visualizzazione + + TLista_documenti din; // Legge tutti i documenti di input + din.read('D', 'C', codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an); + if (din.items() > 0 && !iw.iscancelled()) + { + bool ok = process(iw, eld, din, data_elab); + if (!ok) // In caso di errore termina qui l'elaborazione. + break; + } + } +} + +void TFatturazione_bolle_app::process_by_doc(const TMask& m) +{ + TIndwin iw(0, "Inizializzazione ...\n ", TRUE, FALSE, 60); + + const TDate data_elab = m.get(F_DATA_ELAB); + const int anno = data_elab.year(); + long dc = m.get_long(F_CODICE_CLIFO_DA); + long ac = m.get_long(F_CODICE_CLIFO_A); + + const int da = m.get_int(F_CODICE_AGENTE_DA); + const int aa = m.get_int(F_CODICE_AGENTE_A); + const TString8 dz(m.get(F_CODICE_ZONA_DA)); + const TString8 az(m.get(F_CODICE_ZONA_A)); + + const TDate dd = m.get(F_DATA_DOCUMENTO_DA); + TDate ad = m.get(F_DATA_DOCUMENTO_A); + if (!ad.ok()) ad = data_elab; + + const TString& codnum = m.get(F_CODICE_NUMERAZIONE); + const long dn = m.get_long(F_NUMERO_DOCUMENTO_DA); + const long an = m.get_long(F_NUMERO_DOCUMENTO_A); + + TFatturazione_bolle eld(m.get(F_CODICE_ELAB)); + TToken_string tipidoc(24), statidoc(10); + eld.tipi_validi(tipidoc); + eld.stati_validi(statidoc); + + TLista_clienti clienti; + const int tot_cli = clienti.leggi(dc, ac); + + TString msg(80); + for (int c = 0; c < tot_cli && !iw.iscancelled(); c++) + { + const long codcli = clienti[c]; // Codice cliente in esame + msg = "Elaborazione dei documenti del cliente "; + msg << codcli << " ..."; + iw.set_text(msg); // Messaggio sul cliente + do_events(); // Attende visualizzazione + + TLista_documenti din, dout; // Legge tutti i documenti di input + din.read('D', 'C', codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an); + + for (int i = din.items()-1; i >= 0; i--) + { + const TDocumento& doc = din[i]; + + bool to_del = FALSE; + const int agente = doc.get_int(DOC_CODAG); + if (agente > 0) + { + if (da > 0 && agente < da) to_del = TRUE; + if (aa > 0 && agente > aa) to_del = TRUE; + } + const TString8 zona = doc.get(DOC_ZONA); + if (zona.not_empty()) + { + if (dz.not_empty() && zona < dz) to_del = TRUE; + if (az.not_empty() && zona > az) to_del = TRUE; + } + if (to_del) + din.destroy(i); + } + if (din.items() > 0 && !iw.iscancelled()) + { + bool ok = process(iw, eld, din, data_elab); + if (!ok) // In caso di errore termina qui l'elaborazione. + break; + } + } +} + void TFatturazione_bolle_app::main_loop() { - open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_OCCAS, LF_INDSP, LF_CFVEN, LF_DOC, LF_RIGHEDOC, LF_ANAMAG, LF_MOVMAG, LF_RMOVMAG, LF_CONDV, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, 0); TMask m("ve6200a"); + m.set(F_SELEZIONE, _default_selection); + while (m.run() == K_ENTER) { - TIndwin iw(48, "Inizializzazione ...\n ", TRUE, FALSE, 48); - - const TDate data_elab = m.get(F_DATA_ELAB); - const int anno = data_elab.year(); - - const long dc = m.get_long(F_CODICE_CLIFO_DA); - const long ac = m.get_long(F_CODICE_CLIFO_A); - const long da = m.get_long(F_CODICE_AGENTE_DA); - const long aa = m.get_long(F_CODICE_AGENTE_A); - const long dz = m.get_long(F_CODICE_ZONA_DA); - const long az = m.get_long(F_CODICE_ZONA_A); - - const TDate dd = m.get(F_DATA_DOCUMENTO_DA); - TString st_da = m.get(F_DATA_DOCUMENTO_A); - const TDate ad = st_da.not_empty() ? (const char*)st_da : data_elab; - const TString& codnum = m.get(F_CODICE_NUMERAZIONE); - const long dn = m.get_long(F_NUMERO_DOCUMENTO_DA); - const long an = m.get_long(F_NUMERO_DOCUMENTO_A); - - TFatturazione_bolle eld(m.get(F_CODICE_ELAB)); - TToken_string tipidoc(24), statidoc(10); - eld.tipi_validi(tipidoc); - eld.stati_validi(statidoc); - - TLista_clienti clienti; - const int tot_cli = clienti.leggi(dc, ac, da, aa, dz, az); - - TString msg(80); - for (int c = 0; c < tot_cli && !iw.iscancelled(); c++) - { - const long codcli = clienti[c]; // Codice cliente in esame - msg = "Elaborazione dei documenti del cliente "; - msg << codcli << " ..."; - iw.set_text(msg); // Messaggio sul cliente - do_events(); // Attende visualizzazione - - TLista_documenti din, dout; // Legge tutti i documenti di input - din.read('D', 'C', codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an); - if (din.items() == 0) - continue; - - // Crea documenti di output - bool ok = eld.elabora(din, dout, data_elab); - if (ok) - { - msg << '\n' << din.items() << " documenti raggruppati in " << dout.items(); - iw.set_text(msg); // Messaggio sul cliente - do_events(); // Attende visualizzazione - - int err = dout.write(); // Scrive documenti di output - if (err == NOERR) - { - err = din.rewrite(); // Aggiorna stato dei documenti di input - if (err != NOERR) - ok = error_box("Errore %d durante la scrittura dei documenti raggruppati!", err); - } - else - ok = error_box("Errore %d durante l'aggiornamento dei documenti da raggruppare!", err); - } - else - { - ok = error_box("I documenti relativi al cliente %ld non sono stati elaborati.", - codcli); - } - if (!ok) // In case di errore ... - break; // ... termina qui l'elaborazione. + const TString& select_from = m.get(F_SELEZIONE); + if (select_from != _default_selection) + { + TConfig cfg(CONFIG_DITTA, "ve"); + cfg.set("FATBOLSEL", _default_selection = select_from); } + if (select_from == "D") + process_by_doc(m); + else + process_by_cli(m); } } diff --git a/ve/ve6200a.h b/ve/ve6200a.h index 53625747a..38ab889a3 100755 --- a/ve/ve6200a.h +++ b/ve/ve6200a.h @@ -1,4 +1,4 @@ -// Include file per ve6000.uml +// Include file per ve6200a.uml #define F_DATA_ELAB 101 #define F_CODICE_CLIFO_DA 102 @@ -16,3 +16,5 @@ #define F_ANNO_ELAB 114 #define F_CODICE_NUMERAZIONE 115 #define F_DESCR_ELAB 116 +#define F_ORDINAMENTO_2 117 +#define F_SELEZIONE 118 diff --git a/ve/ve6200a.uml b/ve/ve6200a.uml index a711e3759..e99ebe52a 100755 --- a/ve/ve6200a.uml +++ b/ve/ve6200a.uml @@ -1,10 +1,10 @@ #include "ve6200a.h" -PAGE "Fatturazione" -1 -1 70 15 +PAGE "Fatturazione" -1 -1 70 16 GROUPBOX DLG_NULL 68 4 BEGIN - PROMPT 1 0 "Elaborazione differita" + PROMPT 1 0 "@bElaborazione" END STRING F_CODICE_ELAB 8 @@ -50,14 +50,14 @@ BEGIN FLAG "D" END -GROUPBOX DLG_NULL 68 10 +GROUPBOX DLG_NULL 68 11 BEGIN - PROMPT 1 4 "Estremi dei documenti da elaborare:" + PROMPT 1 4 "@bEstremi dei documenti da elaborare:" END RADIOBUTTON F_ORDINAMENTO 16 BEGIN - PROMPT 3 5 "Ordinamento per" + PROMPT 3 5 "@bOrdinamento per" ITEM "C|Clienti" MESSAGE ENABLE,1@|CLEAR,2@|CLEAR,3@ ITEM "A|Agenti" @@ -66,6 +66,25 @@ BEGIN MESSAGE CLEAR,1@|CLEAR,2@|ENABLE,3@ END +RADIOBUTTON F_ORDINAMENTO_2 16 +BEGIN + PROMPT 3 5 "@bSelezione per" + ITEM "A|Agenti" + MESSAGE ENABLE,1@|ENABLE,2@|CLEAR,3@|COPY,F_ORDINAMENTO + ITEM "Z|Zone" + MESSAGE ENABLE,1@|CLEAR,2@|ENABLE,3@|COPY,F_ORDINAMENTO + FLAGS "H" +END + +RADIOBUTTON F_SELEZIONE 16 +BEGIN + PROMPT 3 10 "@bSelezione da" + ITEM "C|Clienti" + MESSAGE SHOW,F_ORDINAMENTO|HIDE,F_ORDINAMENTO_2|K_SPACE,F_ORDINAMENTO + ITEM "D|Documenti" + MESSAGE HIDE,F_ORDINAMENTO|SHOW,F_ORDINAMENTO_2|K_SPACE,F_ORDINAMENTO_2 +END + NUMBER F_CODICE_CLIFO_DA 6 BEGIN PROMPT 20 6 "da codice cliente " diff --git a/ve/ve6300.cpp b/ve/ve6300.cpp index e2d12f70b..0c02bf46b 100755 --- a/ve/ve6300.cpp +++ b/ve/ve6300.cpp @@ -316,8 +316,10 @@ void TGenerazioneEffetti_app::add_to_group_list(TDocumento* doc) void TGenerazioneEffetti_app::build_group_key(TString& key, TDocumento* doc) { - long cli = doc->get_long(DOC_CODCF); - TString16 val(doc->get(DOC_CODVAL)); + const long cli = doc->get_long(DOC_CODCF); + TString16 val; + if (doc->in_valuta()) + val = doc->get(DOC_CODVAL); // campi obbligatori key.format("%7ld%3s",cli,(const char*)val); @@ -325,7 +327,6 @@ void TGenerazioneEffetti_app::build_group_key(TString& key, TDocumento* doc) if (_group_by_date) { TString16 d(doc->get(DOC_DATAINSC)); - if (d.empty()) d = doc->get(DOC_DATADOC); key << d; diff --git a/ve/veconf.h b/ve/veconf.h index 988c668f2..f1f2bea5a 100755 --- a/ve/veconf.h +++ b/ve/veconf.h @@ -103,6 +103,7 @@ #define F_RICERCAAN4 109 #define F_SCONTO_LORDO 110 #define F_IVASTORNO 111 +#define F_CHECKPREVCONT 112 // Campi per ve0200f.uml #define F_IMPSPINC1 101 diff --git a/ve/velib.h b/ve/velib.h index a125ba84b..6f028a47c 100755 --- a/ve/velib.h +++ b/ve/velib.h @@ -747,10 +747,10 @@ protected: static bool codval_handler( TMask_field& f, KEY key ); void user_set_handler( int fieldid, int index); - TVariable_mask* riga_mask(int numriga); void reset_masks(const TString& tipo_doc); public: + TVariable_mask* riga_mask(int numriga); virtual bool on_key(KEY key); TDocumento& doc() { return _doc; } @@ -769,6 +769,7 @@ public: static bool num_handler( TMask_field& f, KEY key ); static bool tip_handler( TMask_field& f, KEY key ); static bool numdocrif_search_handler( TMask_field& f, KEY key ); + static bool datadocrif_handler(TMask_field& f, KEY key); TDocumento_mask(const char* tipodoc); virtual ~TDocumento_mask(); @@ -792,6 +793,7 @@ public: int add(TDocumento* doc) { return _documenti.add(doc); } int add(const TDocumento& doc) { return _documenti.add(doc); } + int destroy(int i, bool pack = TRUE) { return _documenti.destroy(i, pack); } const TDocumento& operator[] (int n) const { return doc(n); } TDocumento& operator[] (int n) { return (TDocumento&)_documenti[n]; } @@ -844,7 +846,7 @@ public: int ordina_per_agente(); int ordina_per_zona(); - int leggi(long dc, long ac, long da = 0, long aa = 0, long dz = 0, long az = 0); + int leggi(long dc, long ac, long da = 0, long aa = 0, const char * dz = "", const char * az = ""); long operator[] (int n) const { return clifo(n).codice(); } int items() const { return _clifo.items(); } @@ -1059,7 +1061,8 @@ class TContabilizzazione : public TElaborazione // velib04b *_cco; // tabella categorie contabili TRelation *_clifo; // relazione dei clienti e fornitori + cfven TViswin* _viswin; // Visualizzazione log di elaborazione - TBill _conto_errato; + TBill _conto_errato; + bool _check_prev_cont; // Controllare se il documento precedente e' stato contabilizzato protected: // Carica i parametri dalla configurazione diff --git a/ve/velib03.cpp b/ve/velib03.cpp index 076768e5e..c3e0ce281 100755 --- a/ve/velib03.cpp +++ b/ve/velib03.cpp @@ -1724,7 +1724,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const for (int i = rows; i > 0; i--) { - TRiga_documento & r = myself.row(i); + TRiga_documento& r = myself.row(i); if ((r.is_merce() || r.is_omaggio()) && !r.is_checked() && r.get("CODARTMAG") != NULL_CODART) { const TString & codart = r.get("CODART"); @@ -1739,7 +1739,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const } r.checked(); } - if (is_ordine() && r.is_evadibile()) + if (r.is_evadibile() && is_ordine()) { docevaso &= r.get_bool(RDOC_RIGAEVASA); const TDate dcons = r.get(RDOC_DATACONS); @@ -2749,10 +2749,12 @@ TRectype & TDocumento::operator =(const char * r) } TRecord_array& TDocumento::body(int logicnum) const -{ +{ + const bool reset_data_cons = loaded_rows(logicnum) == 0; + TRecord_array& r = TMultiple_rectype::body(logicnum); - if (is_ordine()) + if (reset_data_cons && is_ordine()) { TDate datacons(get_date(DOC_DATACONS)); for (int i = r.rows(); i > 0; i--) @@ -2985,7 +2987,7 @@ void TDocumento::update_conai() bool TDocumento::is_evaso() const { - bool ok = is_ordine() || is_generic(); + bool ok = is_ordine() || is_bolla() || is_generic(); for (int r = 1; ok && r <= physical_rows(); r++) { const TRiga_documento& riga = physical_row(r); @@ -2996,8 +2998,7 @@ bool TDocumento::is_evaso() const } bool TDocumento::is_nota_credito() const -{ - const TString16 codcaus(tipo().causale()); +{ bool swap = FALSE; // Controlla prima l'esistenza del flag nota-credito sul tipo documento; @@ -3005,6 +3006,8 @@ bool TDocumento::is_nota_credito() const if (tipo().nota_credito()) swap = TRUE; else + { + const TString16 codcaus(tipo().causale()); if (codcaus.not_empty()) { TLocalisamfile caus(LF_CAUSALI); @@ -3013,6 +3016,7 @@ bool TDocumento::is_nota_credito() const const char sez = c.sezione_clifo(); swap = ((c.reg().iva() == iva_vendite) ^ (sez == 'D')); } + } return swap; } diff --git a/ve/velib04.cpp b/ve/velib04.cpp index 4bded19e1..7a6267f0a 100755 --- a/ve/velib04.cpp +++ b/ve/velib04.cpp @@ -200,10 +200,10 @@ TLista_clifo::TClifo::TClifo(const TRectype& rec) read(tipo, codice); } -int TLista_clifo::leggi(long dc, long ac, long da, long aa, long dz, long az) +int TLista_clifo::leggi(long dc, long ac, long da, long aa, const char * dz, const char * az) { TRelation clifo(LF_CLIFO); - clifo.add(LF_CFVEN, "TIPOCF=TIPOCF|CODCF=CODCF"); + clifo.add(LF_CFVEN, "TIPOCF==TIPOCF|CODCF==CODCF"); TRectype start(LF_CLIFO), stop(LF_CLIFO); @@ -223,18 +223,20 @@ int TLista_clifo::leggi(long dc, long ac, long da, long aa, long dz, long az) if (filter.not_empty()) filter << "&&"; filter << '(' << LF_CFVEN << "->" << CLI_CODAG << "<=" << aa << ')'; } - if (dz > 0) + if (dz && (*dz !='\0')) { if (filter.not_empty()) filter << "&&"; - filter << '(' << LF_CFVEN << "->" << CLI_CODZONA << ">=" << dz << ')'; + filter << '(' << LF_CFVEN << "->" << CLI_CODZONA << ">=\"" << dz << "\")"; } - if (az > 0) + if (az && (*az !='\0')) { if (filter.not_empty()) filter << "&&"; - filter << '(' << LF_CFVEN << "->" << CLI_CODZONA << "<=" << az << ')'; + filter << '(' << LF_CFVEN << "->" << CLI_CODZONA << "<=\"" << az << "\")"; } - TCursor cur(&clifo, filter, 1, &start, &stop); + TCursor cur(&clifo, "", 1, &start, &stop); + if (filter.not_empty()) + cur.setfilter(filter, TRUE); const TRectype& cli = cur.curr(); const TRectype& ven = cur.curr(LF_CFVEN); for (cur = 0; cur.ok(); ++cur) @@ -243,9 +245,14 @@ int TLista_clifo::leggi(long dc, long ac, long da, long aa, long dz, long az) _clifo.add(c); } - if (dc > 0 || ac > 0) ordina_per_codice(); else - if (da > 0 || aa > 0) ordina_per_agente(); else - if (dz > 0 || az > 0) ordina_per_zona(); + if (dc > 0 || ac > 0) + ordina_per_codice(); + else + if (da > 0 || aa > 0) + ordina_per_agente(); + else + if ((dz && (*dz !='\0')) || (az && (*dz !='\0'))) + ordina_per_zona(); return _clifo.items(); } diff --git a/ve/velib04a.cpp b/ve/velib04a.cpp index 5537ce94b..a5b7c7bfe 100755 --- a/ve/velib04a.cpp +++ b/ve/velib04a.cpp @@ -256,8 +256,17 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do const TString16 tipo_cli(cfven.get(CFV_TIPODOCFAT)); TRecfield td(d, DOC_TIPODOC); // Uso il TRecfield per scavalcare tutti gli automatismi +#ifdef DBG + real tot = d.totale_doc(); +#endif td = tipo_cli.empty() ? tipo_out : tipo_cli; + TString16 sconto(d.get(DOC_SCONTOPERC)); + d.put(DOC_SCONTOPERC, sconto); +#ifdef DBG + tot = d.totale_doc(); +#endif } return ok; } + \ No newline at end of file diff --git a/ve/velib04b.cpp b/ve/velib04b.cpp index a509a61de..78b56bc38 100755 --- a/ve/velib04b.cpp +++ b/ve/velib04b.cpp @@ -67,7 +67,7 @@ public: // ricalcola le righe di contabilita' dalle righe iva presenti // e verifica la quadratura del movimento. Ritorna TRUE se il movimento e' scrivibile bool movement_ok() ; - bool recalc_cg_rows(const TString & descr_cr, TCausale* caus = NULL); + int recalc_cg_rows(const TString & descr_cr, TCausale* caus = NULL); TMovimentoPN_VE(bool valuta) : _valuta(valuta) {}; virtual ~TMovimentoPN_VE() {} }; @@ -393,7 +393,7 @@ bool TMovimentoPN_VE::movement_ok() return TRUE; } -bool TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale* caus) +int TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale* caus) { const int righe = iva_items(); bool external_caus = TRUE; @@ -414,7 +414,7 @@ bool TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale* caus) enter_row(i, descr_cr); } bool ok = TRUE; - if (_caus->intra()) + if (_caus->intra() && _caus->iva() == iva_acquisti) { TBill c; _caus->bill(8, c); ok = c.ok(); @@ -424,6 +424,8 @@ bool TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale* caus) const char rowtype = 'F'; set_cg_rec(-1, real2imp(head.get_real(MOV_RITFIS), rowtype), c, d, rowtype); } + else + return 2; } if (_caus->tipomov() == 1) // Elimina eventuali righe vuote dalle fatture @@ -441,7 +443,7 @@ bool TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale* caus) delete _caus; _caus = NULL; } - return ok && movement_ok(); + return ok && movement_ok() ? 0 : 1; } // TIVA_element @@ -458,7 +460,7 @@ public: real& iva() { return _iva;} // Iva real& ali() { return _ali;} // Aliquota % TString& cod_iva() { return _cod_iva;} - void zero(){ _imp = 0.0; _iva = 0.0; _ali = 0.0; _cod_iva = "";} + void zero() { _imp = _iva = _ali = ZERO; _cod_iva.cut(0); } virtual TObject* dup() const { return new TIVA_element(*this); } TIVA_element& operator = (TIVA_element& a); TIVA_element() { zero(); } @@ -672,7 +674,7 @@ bool TContabilizzazione::load_parameters() _spin_cod = conf.get("SPINCODIVA","ve"); _spbo_cod = conf.get("SPBOCODIVA","ve"); -// _loaded = TRUE; + _check_prev_cont = conf.get_bool("CHECKPREVCONT","ve"); return TRUE; } @@ -691,11 +693,10 @@ error_type TContabilizzazione::get_next_reg_num(long& nr) _error = no_error; TLocalisamfile& mov = _movimento->lfile(); nr = 1L; - if (!mov.empty()) + if (mov.last() == NOERR) { - mov.last(); - nr = mov.get_long(MOV_NUMREG) + 1L; - if (mov.status() != NOERR || nr < 1) + nr += mov.get_long(MOV_NUMREG); + if (nr <= 0) // Quando mai succede? _error = nr_reg_error; } return _error; @@ -746,10 +747,10 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc) TCodice_numerazione cod_num(doc.numerazione()); // calcola il numero documento aggiungendo l'eventuale prefisso/postfisso. - TString numdoc(cod_num.complete_num(doc.numero())); + TString16 numdoc(cod_num.complete_num(doc.numero())); if (acquisto) { - TString numdocrif(doc.get(DOC_NUMDOCRIF)); + TString16 numdocrif(doc.get(DOC_NUMDOCRIF)); if (numdocrif.not_empty()) numdoc = numdocrif; } @@ -763,7 +764,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc) // Istanzia la causale del documento corrente... const TTipo_documento& tipo = doc.tipo(); - TString codcaus(tipo.causale()); + TString16 codcaus(tipo.causale()); TToken_string key; key.add(doc.get(DOC_TIPOCF)); @@ -791,10 +792,10 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc) // per reperire il tipo documento ed il tipo movimento // reperisce la descrizione dal tipo documento e la completa con la data documento ed il // numero documento - TString descr(tipo.riferimento()); + TString80 descr(tipo.riferimento()); if (descr.empty()) descr = tipo.descrizione(); - TString80 rif(doc.get(DOC_NUMDOCRIF)); + const TString16 rif = doc.get(DOC_NUMDOCRIF); const bool use_rif = _caus->iva() == iva_acquisti && rif.not_empty(); if (use_rif) { @@ -819,8 +820,8 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc) long ult_prot; if (_nump_iva == 1) // Reperisce l'ultimo numero di protocollo dal registro IVA { - ult_prot = registro.protocol() +1; - if (ult_prot < 1) + ult_prot = registro.protocol() + 1; + if (ult_prot <= 0) { _error = ultprot_error; return _error; @@ -830,7 +831,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc) ult_prot = doc.numero(); // Reperisce la valuta TDate datacam(doc.get_date(DOC_DATACAMBIO)); - TString codval(doc.valuta()); + TString16 codval(doc.valuta()); real cambio(doc.cambio()); codval.trim(); if (!doc.in_valuta()) @@ -856,9 +857,9 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc) } // Dati del cliente... - TString tipocf(doc.get(DOC_TIPOCF)); + TString16 tipocf(doc.get(DOC_TIPOCF)); long codcf = doc.get_long(DOC_CODCF); - TString occas; + TString80 occas; { TLocalisamfile& cli_file = _clifo->lfile(); cli_file.put(CLI_TIPOCF,tipocf); cli_file.put(CLI_CODCF,codcf); @@ -884,7 +885,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc) } // Codice pagamento - TString codpag(doc.get(DOC_CODPAG)); + TString16 codpag(doc.get(DOC_CODPAG)); if (sc_enabled() || codpag.not_empty()) // La condizione di pagamento va controllata { // se e' abilitato il saldaconto o se e' stata inserita _cpg->put("CODTAB",codpag); @@ -1046,7 +1047,7 @@ error_type TContabilizzazione::search_costo_ricavo(TBill& conto, const TRiga_doc if (skip_art_related) continue; const bool is_fis = tok == "RF"; TTable * tab = is_fis ? _rfa : _gmc; - TString codtab(_anamag->get(is_fis ? ANAMAG_RAGGFIS : ANAMAG_GRMERC)); + TString16 codtab(_anamag->get(is_fis ? ANAMAG_RAGGFIS : ANAMAG_GRMERC)); if (tok == "GM" && codtab.len() > 3) codtab.cut(3); // gli ultimi 2 si riferiscono al sottogruppo. tab->put("CODTAB",codtab); @@ -1065,7 +1066,7 @@ error_type TContabilizzazione::search_costo_ricavo(TBill& conto, const TRiga_doc const bool is_cve = tok == "CV"; if (is_cve && !is_cli) continue; // se e' un fornitore salta questa condizione TTable* t = is_cve ? _cve : _cco; - TString cod(is_cve ? r.doc().get(DOC_CATVEN) : ""); + TString16 cod(is_cve ? r.doc().get(DOC_CATVEN) : EMPTY_STRING); if (cod.empty()) { if (skip_clifo) continue; // se non aveva trovato il cliente salta al prossimo @@ -1139,7 +1140,7 @@ error_type TContabilizzazione::search_costo_ricavo(TBill& conto, const TRiga_doc } // end of switch if (good()) { - if (conto.sottoconto() == 0 || !conto.find()) + if (conto.ok() == 0 || !conto.find()) { _conto_errato = conto; _error = conto_error; @@ -1153,12 +1154,12 @@ error_type TContabilizzazione::add_iva_row(const TBill& conto, const TRiga_docum { TIVA_element el_tmp; const TCodiceIVA& tiva = r.iva(); - TString cod(tiva.codice()); + TString16 cod(tiva.codice()); const char tipo = conto.tipo(); const int gr = conto.gruppo(); const int co = conto.conto(); const long so = conto.sottoconto(); - TString key; + TString80 key; const char tipo_r = r.tipo().tipo(); const bool sconto_lordo = tipo_r != 'C' && _contsclor && _sco_perc_bill.ok(); bool exists; @@ -1234,22 +1235,22 @@ error_type TContabilizzazione::add_iva_row(const TBill& conto, const TRiga_docum else // Any other kind of row... { //el.add(r,sconto_lordo,ndec); // Inserisce la riga IVA al netto o al lordo dello sconto - real iimmpp; - + real iimmpp, iivvaa; if (!sconto_lordo) // Al netto dello sconto iimmpp = r.imponibile() * p; else iimmpp = r.importo(FALSE,FALSE,ndec) * p; // Imponibile della riga al lordo dello sconto - iimmpp.round(ndec); - el.imp() += iimmpp; - el.iva() += tiva.imposta(iimmpp,ndec); - - el.ali() = tiva.percentuale(); - el.cod_iva() = tiva.codice(); - - - _righe_iva.add(key,el,exists); // Le righe di sconto le aggiorna dopo + iivvaa = tiva.imposta(iimmpp,ndec); + + if (!iimmpp.is_zero() || !iivvaa.is_zero()) + { + el.imp() += iimmpp; + el.iva() += iivvaa; + el.ali() = tiva.percentuale(); + el.cod_iva() = tiva.codice(); + _righe_iva.add(key,el,exists); // Le righe di sconto le aggiorna dopo + } if (r.doc().tipo().calcolo_lordo()) // Si ricorda che calcolo_lordo() e fattura_commerciale() sono esclusivi. { @@ -1299,7 +1300,7 @@ void TContabilizzazione::calculate_spese(real& spese, real& sp_iva, int ndec, bo const TBill& zio = is_incasso ? (is_cli ? _spin_billv : _spin_billa) : (is_cli ? _spbo_billv : _spbo_billa); TCodiceIVA sp_cod((is_incasso ? (codiva_es.not_empty() ? codiva_es : (const TString &) _spin_cod) : (const TString &) _spbo_cod)); TIVA_element el_tmp; - TString key; + TString80 key; if (zio.ok()) { @@ -1350,7 +1351,8 @@ error_type TContabilizzazione::adjust_sconto_rows(TDocumento& doc) TIVA_element el_tmp; TAssoc_array& aa = doc.tabella_iva(); TRiepilogo_iva * riep; - TString cod,key; // Codice IVA corrente + TString16 cod; // Codice IVA corrente + TString80 key; real sconto,iva; const int ndec = doc.in_valuta() ? 3 : 0; @@ -1605,22 +1607,22 @@ error_type TContabilizzazione::create_total_doc_row(TDocumento& doc) _error = conto_error; } - TString descr; - descr = head.get(MOV_DESCR);// La descrizione della riga di totale documento la prende dalla testata + TString descr = head.get(MOV_DESCR);// La descrizione della riga di totale documento la prende dalla testata - TRectype& first_iva_row = _movimento->iva(0); - const char tc = first_iva_row.get_char(RMI_TIPOC); - const int grc = first_iva_row.get_int(RMI_GRUPPO); - const int coc = first_iva_row.get_int(RMI_CONTO); - const long soc =first_iva_row.get_long(RMI_SOTTOCONTO); + TConto contro; + if (_movimento->iva_items()) + { + TRectype& first_iva_row = _movimento->iva(0); + contro.get(first_iva_row); + } + rec_cg.put(RMV_ANNOES,annoes);rec_cg.put(RMV_NUMREG,numreg); const char sezione = _caus->sezione(1); rec_cg.put(RMV_NUMRIG,1); rec_cg.put(RMV_SEZIONE, sezione); // qui rec_cg.put(RMV_DATAREG,datareg); rec_cg.put(RMV_TIPOC,tipocf); rec_cg.put(RMV_GRUPPO,gruppo);rec_cg.put(RMV_CONTO,conto); rec_cg.put(RMV_SOTTOCONTO,codcf); rec_cg.put(RMV_DESCR,descr); - rec_cg.put(RMV_TIPOCC,tc); rec_cg.put(RMV_GRUPPOC,grc); - rec_cg.put(RMV_CONTOC,coc);rec_cg.put(RMV_SOTTOCONTOC,soc); + contro.put(rec_cg, TRUE); rec_cg.put(RMV_IMPORTO,totdoc); rec_cg.put(RMV_ROWTYPE,"T"); return _error; @@ -1671,7 +1673,7 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc) codiva2 = r.get(RDOC_CODIVA); // Save... for (int j=0; j < MAX_IVA_SLICES; j++) { - real perc(tabella_ripartizione.row(j).get(0)); + real perc = tabella_ripartizione.row(j).get(0); perc /= 100.0; codiva1 = tabella_ripartizione.row(j).get(1); @@ -1719,8 +1721,17 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc) { const TString descr_cr(doc.clifor().get(CLI_RAGSOC)); - if (!_movimento->recalc_cg_rows(descr_cr, _caus)) - _error = movement_error; + switch (_movimento->recalc_cg_rows(descr_cr, _caus)) + { + case 1 : + _error = movement_error; + break; + case 2 : + _error = cau_ritintra_error; + break; + default : + break; + } } return _error; } @@ -1728,7 +1739,7 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc) error_type TContabilizzazione::change_doc_status(TDocumento& doc) // Cambia lo stato del documento { - doc.stato(get("S4")[0]); + doc.stato(get_char("S4")); if (doc.rewrite() != NOERR) _error = chg_stat_error; return _error; @@ -1737,7 +1748,7 @@ error_type TContabilizzazione::change_doc_status(TDocumento& doc) error_type TContabilizzazione::write_scadenze(TDocumento& doc) // Scrive le scadenze. Liberamente tratto da cg2104.cpp. { - TRectype& head = _movimento->lfile().curr(); + TRectype& head = _movimento->curr(); const long nreg = head.get_long(MOV_NUMREG); // const real change(head.get_real(MOV_CAMBIO)); @@ -1759,13 +1770,13 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc) if (anno > 0 && !numpart.blank()) { const int tmov = _caus->tipomov(); - const TString desc(head.get(MOV_DESCR)); - const TString codcaus(_caus->codice()); - const TString v(head.get(MOV_CODVAL)); + const TString80 desc(head.get(MOV_DESCR)); + const TString4 codcaus(_caus->codice()); + const TString4 v(head.get(MOV_CODVAL)); const TDate d(head.get_date(MOV_DATACAM)); const real c(head.get_real(MOV_CAMBIO)); const TValuta cambio(v, d, c); // verificare - const TString agente(doc.get(DOC_CODAG)); + const TString8 agente(doc.get(DOC_CODAG)); const int ndec = doc.decimals(); const char sezione = _movimento->cg(0).get_char(RMV_SEZIONE); // Dare/Avere @@ -1850,8 +1861,8 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc) //real val1 = totimponibili * change; TCurrency_documento val2(pagtotimposte); val2.change_to_firm_val(); TCurrency_documento val3(pagtotspese); val3.change_to_firm_val(); - TCurrency_documento val1(td); val1.change_to_firm_val(); val1 -= val2 - val3; - // Cosi' corregge eventuali scompensi di poche lirette + TCurrency_documento val1(td); val1.change_to_firm_val(); val1 -= val2 + val3; + // Cosi' corregge eventuali scompensi di poche lirette pag.set_total_valuta(pagtotimponibili, pagtotimposte, pagtotspese, val1, val2, val3); } else @@ -1897,12 +1908,11 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc) } partita.put(PART_IMPORTO, imponibile); partita.put(PART_IMPORTOVAL, imponibile_val); -// totimposte.change_to_firm_val(); partita.put(PART_IMPOSTA, imposte); partita.put(PART_SPESE, totspese.get_num()); partita.elimina_rata(-1); // Elimina tutte le rate eventuali - const TString abipr(doc.get(DOC_CODABIP)), cabpr(doc.get(DOC_CODCABP)), + const TString8 abipr(doc.get(DOC_CODABIP)), cabpr(doc.get(DOC_CODCABP)), abi(doc.get(DOC_CODABIA)), cab(doc.get(DOC_CODCABA)); const int nr = pag.n_rate(); @@ -1936,36 +1946,91 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc) // Attenzione: le note di credito possono avere in testata valori negativi! Qui vanno positivi. partita.put(PART_IMPTOTDOC, abs(totdoc)); partita.put(PART_IMPTOTVAL, abs(totdocval)); + + // Attenzione: l'importo giusto viene poi aggiornato dalla modifica pagamento + partita.zero(PART_IMPORTO); + partita.zero(PART_IMPORTOVAL); + const TDate datadocrif = doc.get_date(DOC_DATADOCRIF); + const TString16 numdocrif = doc.get(DOC_NUMDOCRIF); for (int p = newgame->prima_fattura(); p > 0 && p < nuova_riga; p++) { const TRiga_partite& fatt = newgame->riga(p); - for (int r = 1; r <= fatt.rate(); r++) + const TDate datadoc = fatt.get(PART_DATADOC); + const TString16 numdoc = fatt.get(PART_NUMDOC); + if (datadoc.year() == datadocrif.year() && numdoc == numdocrif) + break; + } + if (p > 0 && p < nuova_riga) + { + TPagamento& pag = doc.pagamento(); + + TCurrency_documento totdoc(abs(totdoc), doc); + TCurrency_documento totspese(abs(doc.spese()), doc); + TCurrency_documento totimposte(abs(doc.imposta(TRUE)), doc); + TCurrency_documento totimponibili = totdoc - totspese - totimposte; + if (in_valuta) + { + TCurrency_documento val2(totimposte); val2.change_to_firm_val(); + TCurrency_documento val3(totspese); val3.change_to_firm_val(); + TCurrency_documento val1(totdoc); val1.change_to_firm_val(); val1 -= val2+val3; + // Cosi' corregge eventuali scompensi di poche lirette + pag.set_total_valuta(totimponibili, totimposte, totspese, val1, val2, val3); + } + else + pag.set_total(totimponibili, totimposte, totspese); + pag.set_rate_auto(); + + const TRiga_partite& fatt = newgame->riga(p); + for (int r = 1; r <= fatt.rate() && r <= pag.n_rate(); r++) { const TRiga_scadenze& rata = fatt.rata(r); - if (!rata.chiusa(TRUE)) + const real imprata = rata.residuo(FALSE).valore(); + const real imprataval = rata.residuo(TRUE).valore(); + real importo_rata_lit = pag.importo_rata(r-1, FALSE); + real importo_rata_val = in_valuta ? pag.importo_rata(r-1, TRUE) : importo_rata_lit; + real delta_lit = importo_rata_lit - imprata; + real delta_val = in_valuta ? importo_rata_val - imprataval : ZERO; + // Controlla se l'importo della nota di credito supera quello della fattura + if (delta_lit > ZERO || delta_val > ZERO) + { + // Detrae l'eccedenza dalla rata corrente e la sposta nella rata successiva + importo_rata_lit -= delta_lit; + importo_rata_val -= delta_val; + + if (r == pag.n_rate()) + { + // Crea eventuale ultima rata mancante + pag.add_rata(); + } + else + { + // Incrementa importo rata + delta_lit += pag.importo_rata(r, FALSE); + delta_val += pag.importo_rata(r, TRUE); + } + const TDate oggi(TODAY); + const int tiporata = pag.tipo_rata(r-1); + pag.set_rata(r, delta_val, delta_lit, oggi, tiporata, "", FALSE); + } + if (!importo_rata_lit.is_zero() || (in_valuta && !importo_rata_val.is_zero())) { - const TImporto residuo = rata.residuo(TRUE); - TImporto pagval = residuoval; - const bool saldo = pagval.valore() >= residuo.valore(); - if (saldo) - pagval.valore() = residuo.valore(); - residuoval -= pagval; - TRectype pag = newgame->pagamento(p, r, nuova_riga); + pag.put(PAGSCA_IMPORTO, importo_rata_lit); if (in_valuta) { - pag.put(PAGSCA_IMPORTOVAL, pagval.valore()); - cambio.val2lit(pagval); //verificare - pag.put(PAGSCA_IMPORTO, pagval.valore()); - } + pag.put(PAGSCA_IMPORTOVAL, importo_rata_val); + residuoval -= TImporto(sezione, importo_rata_val); + } else - pag.put(PAGSCA_IMPORTO, pagval.valore()); + residuoval -= TImporto(sezione, importo_rata_lit); + pag.put(PAGSCA_ACCSAL, "A"); newgame->modifica_pagamento(pag, cambio, TRUE); } } } + if (!residuoval.is_zero()) { // Pagamento non assegnato @@ -2479,7 +2544,7 @@ error_type TContabilizzazione::write_intra(TDocumento& doc) const TRectype& rec_anamag = cchh.get(LF_ANAMAG, rr.get(RDOC_CODARTMAG)); commag = cchh.get("MAG", codmag, "S5"); // Comune del magazzino nomenclatura = rec_anamag.get(ANAMAG_CLASSDOG); - paeseorig = !is_cessione ? rec_anamag.get(ANAMAG_PAESE) : ""; // Campo solo per Acquisti + paeseorig = !is_cessione ? rec_anamag.get(ANAMAG_PAESE) : EMPTY_STRING; // Campo solo per Acquisti provincia = is_cessione ? rec_anamag.get(ANAMAG_PROV) : cchh.get(LF_COMUNI, commag, "PROVCOM"); key.add(nomenclatura); key.add(paeseorig); @@ -2589,9 +2654,11 @@ void TContabilizzazione::aggiorna_saldi(bool n) { const TRectype& r = mv->cg(i); TImporto import(r.get_char("SEZIONE"), r.get_real("IMPORTO")); - - TBill conto; conto.get(r); - _saldo.aggiorna(conto, import, TRUE); + if (!import.is_zero()) + { + TBill conto; conto.get(r); + _saldo.aggiorna(conto, import, TRUE); + } } _saldo.registra(); @@ -2680,6 +2747,10 @@ void TContabilizzazione::display_error(TDocumento& doc) msg.format("Nessuna riga iva contabile e' stata trovata relativamente al documento %s/%ld." "Verificare l'esistenza dei vari codici riga inseriti.",(const char*)numerazione,numero); break; + case cau_ritintra_error: + msg.format("Conto per il'IVA intracomunitaria errato o mancante." + "Verificarlo sulla causale alla voce ritenute fiscali.\n"); + break; case conto_error: msg.format("Rilevato un conto di costo/ricavo inesistente relativamente al documento %s/%ld." "Verificare l'esistenza del conto %c %d %d %ld associato alle righe.", @@ -2801,7 +2872,7 @@ static void link_handler(int n, const char* descr) } } -bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc_out, +bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& /* doc_out */, const TDate& data_elab, bool interattivo) { TString msg; @@ -2821,10 +2892,18 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc p.setlinkhandler(link_handler); _viswin = new TViswin(NULL, "Contabilizzazione documenti", FALSE, TRUE, TRUE); _viswin->open_modal(); - + + const clock_t start_time = clock(); + + long txt_scrolled = -1; const int items = doc_in.items(); // Numero dei documenti in questa elaborazione - for (int i = 0; i < items ; i++) // Scorriamo tutti i documenti nella lista + for (int i = 0; i < items; i++) // Scorriamo tutti i documenti nella lista { + if (_viswin->frozen()) + break; + + const long txt_pos = _viswin->lines(); + TDocumento& doc = doc_in[i]; msg = "Elaborazione documento "; msg << doc.anno() << ' '; @@ -2832,9 +2911,24 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc msg << doc.numero(); _viswin->add_line(msg); + if (i > 0) + { + const clock_t time = (clock() - start_time) / CLOCKS_PER_SEC; + if (time > 0) + { + TString80 stats; + const int min = int(time / 60L); + const int sec = int(time % 60L); + stats.format(" (docs=%d time=%d:%02d docs/min=%ld)", i, min, sec, long(i*60L)/time); + msg << stats; + } + } + xvt_statbar_set(msg); + do_events(); + _movimento = new TMovimentoPN_VE(doc.in_valuta()); - if (_can_write && !prev_contabilized(doc)) + if (_can_write && _check_prev_cont && !prev_contabilized(doc)) _error = cont_seq_error; if (good()) @@ -2858,8 +2952,8 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc if (good()) { _total_docs++; - change_doc_status(doc); aggiorna_saldi(TRUE); + change_doc_status(doc); msg = "Generazione Movimento "; msg << "$[b,w]" << _movimento->curr().get(MOV_NUMREG) << "$[n,w]"; @@ -2867,7 +2961,8 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc _viswin->add_line(msg); } } - } + } + if (!good()) { display_error(doc); @@ -2895,6 +2990,12 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc _viswin->add_line(msg); } } + if (txt_scrolled < 0) + { + txt_scrolled = txt_pos; + _viswin->goto_pos(txt_pos, 0); + do_events(); + } } _viswin->add_line(""); @@ -2904,9 +3005,20 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc _caus = NULL; } delete _movimento; + + // Let's free some valuable space + if (!interattivo) + doc_in.destroy(i, FALSE); } _viswin->close_print(); _viswin->close_modal(); + if (!interattivo) + { + if (_viswin->frozen()) + message_box("Contabilizzazione interrotta dall'utente"); + else + message_box("Contabilizzazione terminata"); + } _viswin->run(); delete _viswin; _viswin = NULL; diff --git a/ve/velib04c.cpp b/ve/velib04c.cpp index 457b4874b..a478c9ef8 100755 --- a/ve/velib04c.cpp +++ b/ve/velib04c.cpp @@ -296,13 +296,17 @@ long TGenerazione_effetti::group_bills(TAssoc_array& group_array) _error = codpag_error; display_error(doc); return 0L; - } + } + real tot = doc.totale_doc(); + doc.put(DOC_CODPAG, codpag); //placeholder const TCurrency_documento totale_fatt(doc.totale_doc(), doc); const bool valuta = doc.in_valuta(); const real change = doc.cambio(); const TDate datafatt = doc.get_date(DOC_DATADOC); const bool is_nota_credito = doc.is_nota_credito(); + const long numdocrif = doc.get_long(DOC_NUMDOCRIF); + const int annodocrif = doc.get_date(DOC_DATADOCRIF).year(); // Qui il controllo sul residuo da pagare per il documento corrente non va effettuato, // proprio perchè si sta effettuando un raggruppamento di effetti; eventuali documenti @@ -315,7 +319,7 @@ long TGenerazione_effetti::group_bills(TAssoc_array& group_array) calc_pagamento(doc); TPagamento& pag = doc.pagamento(); - const int numrate = pag.n_rate( ); + int numrate = pag.n_rate( ); if (numrate <= 0) { _error = scadenze_error; @@ -358,23 +362,68 @@ long TGenerazione_effetti::group_bills(TAssoc_array& group_array) } // aggiorna totale effetto (testata) TEffetto& effetto=(TEffetto&)_effetti_array[n+offset-1]; + const int rows = effetto.rows_r(); + importo = effetto.get_real(EFF_IMPORTO); imprata = pag.importo_rata(n-1,FALSE); + imprataval = valuta ? pag.importo_rata(n-1,TRUE) : ZERO; + if (is_nota_credito) + { + // Cerca fattura da pagare con la nota di credito + for (int r = 1; r <= rows; r++) + { + const int annoeff = effetto.row_r(r).get_int(REFF_ANNODOC); + const long codeff = effetto.row_r(r).get_long(REFF_NFATT); + if (annoeff == annodocrif && codeff == numdocrif) + break; + } + if (r <= rows) // Se l'ha trovata ... + { + const real importo_rata_lit = effetto.row_r(r).get(REFF_IMPORTO); + const real importo_rata_val = valuta ? effetto.row_r(r).get_real(REFF_IMPORTOVAL) : ZERO; + real delta_lit = imprata - importo_rata_lit; + real delta_val = valuta ? imprataval - importo_rata_val : ZERO; + // Controlla se l'importo della nota di credito supera quello della fattura + if (delta_lit > ZERO || delta_val > ZERO) + { + // Detrae l'eccedenza dalla rata corrente e la sposta nella rata successiva + imprata -= delta_lit; + imprataval -= delta_val; + + if (n == numrate) + { + // Crea eventuale ultima rata mancante + pag.add_rata(); + numrate++; + } + else + { + // Incrementa importo rata + delta_lit += pag.importo_rata(n, FALSE); + delta_val += pag.importo_rata(n, TRUE); + } + const TDate oggi(TODAY); + const int tiporata = pag.tipo_rata(n-1); + pag.set_rata(n, delta_val, delta_lit, oggi, tiporata, "", FALSE); + } + } + else + break; // Esce dal ciclo delle rate + imprata = -imprata; + imprataval = -imprataval; + } + // Aggiorna importi in lire/valuta dell'effetto importo += imprata; effetto.put(EFF_IMPORTO,importo); if (valuta) { importoval = effetto.get_real(EFF_IMPORTOVAL); - imprataval = pag.importo_rata(n-1,TRUE); - if (is_nota_credito) - imprataval = -imprataval; importoval += imprataval; effetto.put(EFF_IMPORTOVAL,importoval); } // Crea la nuova riga di questo effetto - const int rows = effetto.rows_r(); TRectype& riga = effetto.row_r(rows+1,TRUE); // reffetto.put(REFF_NPROGTR,nprog); riga.put(REFF_NRIGATR,rows+1); @@ -386,6 +435,8 @@ long TGenerazione_effetti::group_bills(TAssoc_array& group_array) riga.put(REFF_NFATT,numdoc); riga.put(REFF_IMPFATT,totale_fatt.get_num()); riga.put(REFF_IMPORTO,imprata); + riga.put(REFF_ANNO, annodocrif); + riga.put(REFF_NUMPART, numdocrif); if (valuta) { riga.put(REFF_IMPFATTVAL,totale_fatt.get_num()); @@ -411,7 +462,7 @@ long TGenerazione_effetti::group_bills(TAssoc_array& group_array) if (_can_write) { xvt_statbar_set("Scrittura effetti raggruppati in corso..."); - do_events(); + do_events(); if (write_groups() == no_error) { tot = _effetti_array.items(); @@ -577,6 +628,9 @@ void TGenerazione_effetti::generate_bill(TDocumento& doc) // bill in inglese sig reffetto.put(REFF_ANNODOC,anno); reffetto.put(REFF_CODNUM,codnum); reffetto.put(REFF_NFATT,nfatt); + reffetto.put(REFF_ANNO, doc.get_date(DOC_DATADOCRIF).year()); + reffetto.put(REFF_NUMPART, doc.get(DOC_NUMDOCRIF)); + importo = pag.importo_rata(i,FALSE); effetto.put(EFF_IMPORTO,importo); reffetto.put(REFF_IMPFATT,totale_fatt.get_num()); diff --git a/ve/velib06.cpp b/ve/velib06.cpp index b6f28802e..2b1a7d070 100755 --- a/ve/velib06.cpp +++ b/ve/velib06.cpp @@ -61,15 +61,14 @@ TDocumento_mask::TDocumento_mask(const char* td) configura_sheet(*_sheet); ((TVariable_sheet_field*)_sheet)->set_getmask( ss_getmask ); - if (id2pos( F_OCCASEDIT ) > 0 ) - set_handler( F_OCCASEDIT, occas_handler ); - set_handler( F_CODCF, clifo_handler ); if (_doc.tipo().clifo_optional()) { field(F_CODCF).check_type(CHECK_NORMAL); field(F_RAGSOC).check_type(CHECK_NORMAL); } + set_handler( F_OCCASEDIT, occas_handler ); + set_handler( F_CODCF, clifo_handler ); set_handler( F_CODPAG, condpag_hndl ); set_handler( F_DATAINSC, condpag_hndl ); set_handler( F_CODNOTE, note_hndl ); @@ -81,6 +80,8 @@ TDocumento_mask::TDocumento_mask(const char* td) set_handler( F_CODCAMP, codcamp_handler ); set_handler( F_CODVAL, codval_handler ); set_handler( F_CODVAL1, codval_handler ); + set_handler( F_NUMDOCRIF, datadocrif_handler); + set_handler( F_DATADOCRIF, datadocrif_handler); set_handler( DLG_ELABORA, elabora_handler ); set_handler( DLG_PRINT, print_handler ); @@ -955,7 +956,7 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key ) riga.put("CODMAG", s); riga.autoload(ss); ss.check_row(r); - ss.select(r, 1); + // ss.select(r, 1); // Ma serve a qualcosa? } else if ( key == K_TAB ) // ingresso nella riga @@ -1316,7 +1317,7 @@ bool TElabora_mask::article_filter(const TRelation* rel) void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione) { TString filter(80); - filter.format("(TIPOCF==\"%s\")&&(CODCF==\"%s\")", (const char *)get(F_TIPOCF_ELAB), (const char *)get(F_CODCF_ELAB)); + filter.format("(TIPOCF==\"%s\")&&(CODCF==\"%s\")&&(CODVAL==\"%s\")", (const char *)get(F_TIPOCF_ELAB), (const char *)get(F_CODCF_ELAB), (const char *)get(F_CODVAL_ELAB)); const TString16 tipo(get(F_TIPODOC_ELAB)); TElaborazione * e = curr_elab(); const bool to_elab = get_bool(F_TYPE); @@ -1555,6 +1556,7 @@ TElabora_mask::TElabora_mask(TDocumento_mask * main_mask) set(F_ANNO_ELAB, _main->get(F_ANNO)); set(F_TIPOCF_ELAB, _main->get(F_TIPOCF)); set(F_CODCF_ELAB, _main->get(F_CODCF)); + set(F_CODVAL_ELAB, _main->get(F_CODVAL)); } bool TDocumento_mask::elabora_handler( TMask_field& f, KEY key ) @@ -1768,3 +1770,4 @@ bool TDocumento_mask::codval_handler( TMask_field& f, KEY key ) return TRUE; } + diff --git a/ve/velib06a.cpp b/ve/velib06a.cpp index b9e474824..791f5c237 100755 --- a/ve/velib06a.cpp +++ b/ve/velib06a.cpp @@ -1,4 +1,6 @@ +#include #include +#include #include #include #include @@ -22,6 +24,8 @@ #include "sconti.h" #endif +#include "../cg/cg2103.h" + #ifndef __MGLIB_H #include "../mg/mglib.h" #endif @@ -35,6 +39,7 @@ #include "../mg/deslin.h" #include "../mg/umart.h" #include "velib.h" + #define MAX_VIS_RATE 5 bool totdoc_hndl( TMask_field& field, KEY key ) @@ -178,10 +183,31 @@ bool data_hndl( TMask_field& field, KEY key ) } if (key == K_ENTER || field.to_check(key)) { - TDate datadoc(m.get(F_DATADOC)); + const TDate datadoc(m.get(F_DATADOC)); if (!datadoc.ok()) return field.error_box("La data documento deve essere comunque indicata."); - + + TEsercizi_contabili esc; + if (esc.date2esc(datadoc) <= 0) + return field.error_box("La data documento non appartiene ad un esercizio valido."); + if (main_app().has_module(CGAUT)) + { + const TTipo_documento& td = m.doc().tipo(); + TString16 codcaus = td.causale(); + if (codcaus.empty()) + { + const TRectype& clifo = m.doc().clifor().vendite(); + codcaus = clifo.get("CODCAUS"); + } + if (codcaus.not_empty()) + { + const int year = datadoc.year(); + TCausale caus; + if (!caus.read(codcaus, year)) + return FALSE; // L'errore viene segnalato nella read + } + } + const TCodice_numerazione codnum(m.get(F_CODNUM)); if (codnum.dont_test_datadoc()) return TRUE; // Non devo fare altri test @@ -239,7 +265,7 @@ bool iva_handler( TMask_field& f, KEY key ) f.check(); } - if (key == K_ENTER && f.focusdirty() && f.get().empty()) + if (key == K_ENTER && /*f.focusdirty() &&*/ f.get().empty()) { TMask & row_mask = f.mask(); const int r = f.mask().get_sheet()->selected() + 1; @@ -601,7 +627,7 @@ bool codartmag_handler( TMask_field& f, KEY key ) bool liv_handler( TMask_field& f, KEY key ) { - bool ok = TRUE; + bool ok = TRUE; TDocumento_mask & mask=(TDocumento_mask &) f.mask().get_sheet()->mask(); if (key == K_TAB && f.focusdirty() && !f.get().empty()) @@ -617,57 +643,57 @@ bool liv_handler( TMask_field& f, KEY key ) static bool checkgiac = 3; if (checkgiac > 2) { - TConfig c(CONFIG_DITTA); - checkgiac = c.get_bool("LIVPERART", "ve"); + TConfig c(CONFIG_DITTA); + checkgiac = c.get_bool("LIVPERART", "ve"); } if (mask.is_running() && checkgiac) { - TLocalisamfile fl(LF_MAG); - fl.setkey(2); - TRectype & r = fl.curr(); - TMask& row_mask = f.mask(); + TLocalisamfile fl(LF_MAG); + fl.setkey(2); + TRectype & r = fl.curr(); + TMask& row_mask = f.mask(); TEsercizi_contabili esc; const int annoes = esc.date2esc(mask.get_date(F_DATADOC)); - - r.put(MAG_ANNOES, annoes); - TString16 codmag(row_mask.get(FR_CODMAG)); - codmag.left_just(3); - codmag << row_mask.get(FR_CODDEP); - r.put(MAG_CODMAG, codmag); - const TString80 codart(row_mask.get(FR_CODART)); - - r.put(MAG_CODART, codart); - TString liv; - - for (int l = 0 ; l <= f.dlg() - FR_LIV1; l++) - mask.doc().livelli().pack_grpcode(liv,row_mask.get(FR_LIV1+l),l+1); + r.put(MAG_ANNOES, annoes); + TString16 codmag(row_mask.get(FR_CODMAG)); + + codmag.left_just(3); + codmag << row_mask.get(FR_CODDEP); + r.put(MAG_CODMAG, codmag); + const TString80 codart(row_mask.get(FR_CODART)); + + r.put(MAG_CODART, codart); + TString liv; + + for (int l = 0 ; l <= f.dlg() - FR_LIV1; l++) + mask.doc().livelli().pack_grpcode(liv,row_mask.get(FR_LIV1+l),l+1); - r.put(MAG_LIVELLO, liv); - - TRectype new_rec(r); - if (fl.read() != NOERR) - { - ok = yesno_box("Il codice di giacenza %s non e' legato all' articolo. Devo legarlo", (const char *)f.get()); - if (ok) - { - fl.setkey(1); - r = new_rec; - r.put("NRIGA", 999); - int nriga = 1; - if (fl.read(_isgteq) == NOERR) - fl.prev(); - if (codart == fl.get("CODART")) - nriga = fl.get_int("NRIGA")+1; + r.put(MAG_LIVELLO, liv); + + TRectype new_rec(r); + if (fl.read() != NOERR) + { + ok = yesno_box("Il codice di giacenza %s non e' legato all' articolo. Devo legarlo", (const char *)f.get()); + if (ok) + { + fl.setkey(1); + r = new_rec; + r.put("NRIGA", 999); + int nriga = 1; + if (fl.read(_isgteq) == NOERR) + fl.prev(); + if (codart == fl.get("CODART")) + nriga = fl.get_int("NRIGA")+1; new_rec.put("NRIGA", nriga); - const int err = new_rec.write(fl); - if (err != NOERR) - ok = error_box("Non sono riuscito a legare il codice di giacenza. Errore %d", err); - } - } - } + const int err = new_rec.write(fl); + if (err != NOERR) + ok = error_box("Non sono riuscito a legare il codice di giacenza. Errore %d", err); + } + } + } } - + if (f.to_check(key, TRUE)) { if (f.dlg() < FR_LIV4) @@ -1032,6 +1058,23 @@ bool TDocumento_mask::numdocrif_search_handler(TMask_field& f, KEY key) m.stop_run(K_AUTO_ENTER); } } - + return TRUE; } + + +bool TDocumento_mask::datadocrif_handler(TMask_field& f, KEY key) +{ + if (key == K_ENTER && f.empty()) + { + const TDocumento_mask& m = (const TDocumento_mask&)f.mask(); + if (m.get_bool(F_RAGGREFF)) + { + const TDocumento& doc = m.doc(); + if (doc.is_nota_credito()) + return f.error_box("E' necessario specificare data e numero documento di riferimento\n" + "quando si desidera generare effetti raggruppati"); + } + } + return TRUE; +} \ No newline at end of file diff --git a/ve/vetabcom.txt b/ve/vetabcom.txt index 9147b13a3..8d49e0304 100755 --- a/ve/vetabcom.txt +++ b/ve/vetabcom.txt @@ -11,12 +11,12 @@ Fields=B6,1|B7,1|B8,1|B9,1|FPC,1 [Data] CTR|RES|Reso a fornitore|||||||||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | CTR|VEN|Vendita|||||||||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | -ELD|CONT|Contabilizzazione fatture||F01 NAC|TC|5|F01|F01|32|F01|3|||3||||||||||||||||||||||||||||||||||||||||X| |X| | | | | | | | -ELD|CONTACQ|Contabilizzazione Fatture d'Acquisto||A01 NDF||5|A01|A01|22|A01|3|||3||3|||||||||||||||||||||||||||||||||||||| | | | | | | | | | | -ELD|CONTFAA|Contabilizzazione Fatture Accompagnatorie||FAA||5|FAA|FAA|3|FAA|3|||3||3|||||||||||||||||||||||||||||||||||||| | | | | | | | | | | -ELD|EFF1|generazione effetti||F01||3|F01|F01|2|F01|3|||5|||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +ELD|CONT|Contabilizzazione fatture||F01 NAC|TC|5|F01|F01|44|F01|5|||3||||||||||||||||||||||||||||||||||||||||X| |X| | | | | | | | +ELD|CONTACQ|Contabilizzazione Fatture d'Acquisto||A01 NDF||5|A01|A01|22|A01|5|||3||3|||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +ELD|CONTFAA|Contabilizzazione Fatture Accompagnatorie||FAA||5|FAA|FAA|4|FAA|5|||3||3|||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +ELD|EFF1|generazione effetti||F01 NAC FAA||4||F01|222|F01|4|||5|||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | ELD|FAT1|Fatture differite| XXXXXX XXX|B01|FB|3||F01|2|F01|1|||2|||||||||||||||||||||||||||||||||||||||| |X| | | | | | | | | -ELD|ORDC|bollettazione ordini||ORC||3|ORC|B01|2|B01|1|||1||1|||||||||||||||||||||||||||||||||||||| | | | | | | | |X| | +ELD|ORDC|bollettazione ordini||ORC||3|ORC|B01|2|B01|1|||1||1|||||||||||||||||||||||||||||||||||||| | | | | | | | |X| | FRD|BASESCONTO|Importo di riferimento per gli sconti|SOMMA("IMPONIBILE()","(TIPO()!='S')&&(TIPO()!='C')")||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | FRD|BOLLI|Spese bolli|BOLLI(_TOTDOC, 1, 0)||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | FRD|IMPONIBILI|Totale imponibili|IMPONIBILI(1)||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | @@ -38,10 +38,10 @@ FRR|IMPLS|Importo lordo riga scontato|IMPORTO(1,1)||||||||||||||||||||||||||0.00 FRR|IMPNN|Importo netto non scontato|IMPORTO()||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | FRR|IMPNS|Importo netto della riga|IMPORTO(1)||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | FRR|IMPOSTA|Imposta riga|IVA()||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | -FRR|PREZZOLN|Prezzo lordo non scontato|PREZZO(0, 1)||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X| | | | | | |X| | | -FRR|PREZZOLS|Prezzo lordo scontato|PREZZO(1, 1)||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X| | | | | | |X| | | -FRR|PREZZONN|Prezzo netto non scontato|PREZZO()||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X| | | | | | |X| | | -FRR|PREZZONS|Prezzo netto scontato|PREZZO(1)||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X| | | | | | |X| | | +FRR|PREZZOLN|Prezzo lordo non scontato|PREZZO(0, 1)||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | +FRR|PREZZOLS|Prezzo lordo scontato|PREZZO(1, 1)||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | +FRR|PREZZONN|Prezzo netto non scontato|PREZZO()||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | +FRR|PREZZONS|Prezzo netto scontato|PREZZO(1)||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | FRR|PROVVF|Provvigione fissa|IF(NUM(IMPFISUN=="X");IMPFISSO*QTA;IMPFISSO)||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X|X| | FRR|PROVVR|Provvigione riga|PROVV()||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | FRR|SCONTOR|Sconto riga|SCONTO()||||||||||||||||||||||||||0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000|0.00000||||||X|X| | | | | |X| | | @@ -68,7 +68,7 @@ TIP|BACQ|Bolla di acquisto||12 1 159 1|| TIP|BOF|bolla fornitore||12 1 159 1||BOLLAF|vebolbmp||2||REAL||||1||||||||||||||||||||||||||||||||||||||| |X| | | | | | | | | TIP|F01|Fattura||12 1 159 1||FATTURAC|VEFATbmp|V01|||||||2||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | TIP|FAA|Fattura Accompagnatoria||12 1 159 1||FATTURAA|veacc|V01|2||VENL||||2||||||||||||||||||||||||||||||||||||||| |X| | | | | | | | | -TIP|NAC|Nota di accredito cliente||12 1 159 1||fatturac|vefatbmp|V02|||||||2||2||||||||||||||||||||||||||||||||||||| | | | | | | | | |X|X +TIP|NAC|Nota di accredito cliente||12 1 159 1||fatturac|vefatbmp|V02|||||||2||2||||||||||||||||||||||||||||||||||||| | | | | | | |X| | |X TIP|NDF|Nota di debito fornitore||12 1 159 1||fatacq|vefatbmp|A03|||||||2||2||||||||||||||||||||||||||||||||||||| | | | | | | | | | | TIP|ORC|Ordine Cliente|ordine cliente|12 1 159 1||ORDINEC|vebolbmp||2||ORCL||||3||||||||||||||||||||||||||||||||||||||| |X| | | | | | | | | TIP|ORF|Ordine Fornitore||12 1 159 1||ORDINEF|vebolbmp||2||ORFO||||3||||||||||||||||||||||||||||||||||||||| |X| | | | | | | | | @@ -81,6 +81,5 @@ TRI|06|Prestazioni|||||||P||||||||||||||||||||||||||||||||||||||||||||| | | | | TRI|07|Sconto ad importo|||||||C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | TRI|08|Sconto percentuale|||||||C||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | TRI|09|Riga omaggio|||||||O||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | -TRI|13|Merce con provvigione fissa|||||||M||||||||||||||||||||||||||||||||||||||||||||||||||||||| -TRI|14|Merce con ricerca per codice corrispondente|||||||M||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | - +TRI|13|Merce con provvigione fissa|||||||M||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | | +TRI|14|Merce con ricerca per codice corrispondente|||||||M||||||||||||||||||||||||||||||||||||||||||||| | | | | | | | | | |