From 1b4f6faaaebcaf2346aa2012177e2f22e4f20116 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 16 Mar 1995 08:50:33 +0000 Subject: [PATCH] Prime implementazioni git-svn-id: svn://10.65.10.50/trunk@1130 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- sc/sc1.cpp | 2 +- sc/sc1.url | 10 +++ sc/sc1100.cpp | 202 +++++++++++++++++++++++-------------------------- sc/sc1100.h | 2 + sc/sc1100a.uml | 43 +++++++++++ sc/sc1200.cpp | 43 ++++++++++- sc/sc1200.h | 2 + sc/sc1200a.uml | 55 ++++++++++++++ 8 files changed, 245 insertions(+), 114 deletions(-) create mode 100755 sc/sc1.url create mode 100755 sc/sc1100.h create mode 100755 sc/sc1100a.uml create mode 100755 sc/sc1200.h create mode 100755 sc/sc1200a.uml diff --git a/sc/sc1.cpp b/sc/sc1.cpp index 47af2147e..43d901aa2 100755 --- a/sc/sc1.cpp +++ b/sc/sc1.cpp @@ -1,7 +1,7 @@ #include #include -#include "sp1.h" +#include "sc1.h" int main(int argc,char** argv) { diff --git a/sc/sc1.url b/sc/sc1.url new file mode 100755 index 000000000..91afa033f --- /dev/null +++ b/sc/sc1.url @@ -0,0 +1,10 @@ +#include + +MENU TASK_MENUBAR + SUBMENU MENU_FILE "~File" + +MENUBAR MENU_BAR(1) + +MENU MENU_BAR(1) + SUBMENU MENU_FILE "~File" + diff --git a/sc/sc1100.cpp b/sc/sc1100.cpp index 129387d60..fbdb6d784 100755 --- a/sc/sc1100.cpp +++ b/sc/sc1100.cpp @@ -1,42 +1,28 @@ #include -#include +#include +#include +#include #include #include +#include +#include +#include + #include "sc1100.h" -TString& add_plural(TString& s, long num, const char* name) -{ - const TFixed_string n(name); - const char last = n[n.len()-1]; - - if (num < 1) - { - s << "nessun"; - if (toupper(last) == 'A' || toupper(n[0]) == 'Z' || - toupper(n[0]) == 'S' && strchr("aeiouAEIOU", n[1]) == NULL) - s << tolower(last); - s << ' ' << name; - } - else - { - s << num << ' ' << name; - if (num > 1) - s[s.len()-1] = (last == 'a') ? 'e' : 'i'; - } - - return s; -} - class TDeletepart_app : public TApplication -{ +{ + static TDate _datalimite; protected: virtual bool create(); virtual bool destroy(); virtual bool menu(MENU_TAG m); + static bool partchiuseal(const TRelation *r); public: TDeletepart_app() {}; + ~TDeletepart_app() {}; }; bool TDeletepart_app::create() @@ -51,108 +37,106 @@ bool TDeletepart_app::destroy() return TApplication::destroy(); } +bool TDeletepart_app::partchiuseal(const TRelation *r) +{ + return (r->lfile().get_bool(PART_CHIUSA) && (r->lfile().get_date(PART_DATAREG) <= _datalimite)); +} + bool TDeletepart_app::menu(MENU_TAG) { TMask m("sc1100a"); - TCursor& cur = *m.efield(F_TODATE).browse()->cursor(); - TLocalisamfile& partite = cur.file(LF_PART); - TLocalisamfile scadenze(LF_SCAD); + TRelation partite(LF_PARTITE); + TCursor cur(&partite); + TLocalisamfile scadenze(LF_SCADENZE); + while (m.run() != K_QUIT) - { - TRecnotype last = cur.items()-1; - partite.zero(); - const char* s = m.get(F_TODATE); - if (*s) - { - partite.put(MOV_DATAREG, s); - partite.put(MOV_NUMREG, m.get(F_TOREG)); - last = cur.read(); - } + { + _datalimite = m.get(F_DATE); + cur.set_filterfunction(partchiuseal); + TRecnotype last = cur.items()-1; const TRecnotype first = cur.read(); - const TRecnotype total = 0; + TRecnotype total = 0; int lastanno = -1; TString16 lastpart = ""; for (cur = 0; cur.pos() <= last; ++cur) { - if (lastanno != partite.get_int(??annopart??) || - lastpart != partite.get(??CODPART??); - { - total++; - lastanno = partite.get_int(??annopart??); - lastpart = partite.get(??CODPART??); - } - } - TString80 caption("Cancellazione di "); - add_plural(caption, total, "partite"); + if (lastanno != cur.curr().get_int(PART_ANNO) || + lastpart != cur.curr().get(PART_NUMPART)); + { + total++; + lastanno = cur.curr().get_int(PART_ANNO); + lastpart = cur.curr().get(PART_NUMPART); + } + } + TString80 caption("Cancellazione di "); + + caption.add_plural(total, "cur.curr()"); + if (!yesno_box(caption) || total < 1) + continue; + + TProgind pi(total, caption, FALSE, TRUE, 24); + + cur.freeze(); + lastanno = -1; + int err = NOERR; + for (cur = 0; cur.pos() <= last; ++cur) + { + const int anno = cur.curr().get_int(PART_ANNO); + const TString16 partita = cur.curr().get(PART_NUMPART); - if (!yesno_box(caption) || total < 1) - continue; - - TProgind pi(total, caption, FALSE, TRUE, 24); - - cur.freeze(); - lastanno = -1; - for (cur = 0; cur.pos() <= last; ++cur) + err = cur.lock(); + if (err == NOERR && (lastanno != cur.curr().get_int(PART_ANNO) || + lastpart != cur.curr().get(PART_NUMPART))); + { + for (int rig = 1; err == NOERR; rig++) { - const int anno = partite.get_int(??anno??); - const int partita = partite.get(??codpart??); - - int err = cur.lock(); - if (err == NOERR && (lastanno != partite.get_int(??annopart??) || - lastpart != partite.get(??CODPART??))); - { - for (int rig = 1; err == NOERR; rig++) - { - scadenze.put(??anno??, lastanno); - scadenze.put(??codpart??, lastpart); - scadenze.put(??nrig??, rig); - if (scadenze.read(_isequal, _lock) == NOERR) - err = scadenze.remove(); - if (err != NOERR) - caption.format("riga scadenza %d", rig); - } - pi.addstatus(1); - lastanno = partite.get_int(??annopart??); - lastpart = partite.get(??CODPART??); - } - if (err == NOERR) - { - const TRecnotype n = partite.recno(); - partite.setkey(1); // Isam bug on remove with key != 1 - partite.readat(n); - err = partite.remove(); - if (err != NOERR) - caption = "riga %d"; - } - else - { - error_box("Errore %d nella cancellazione della %s della partita %d/%s", - err, (const char*)caption, anno, partita); - break; - } - } - for (int rig = 1; lastanno > 0 && err == NOERR; rig++) - { - scadenze.put(??anno??, lastanno); - scadenze.put(??codpart??, lastpart); - scadenze.put(??nrig??, rig); - if (scadenze.read(_isequal, _lock) == NOERR) + scadenze.put(PART_ANNO, lastanno); + scadenze.put(PART_NUMPART, lastpart); + scadenze.put(PART_NRIGA, rig); + if (scadenze.read(_isequal, _lock) == NOERR) err = scadenze.remove(); if (err != NOERR) caption.format("riga scadenza %d", rig); } - cur.freeze(FALSE); + pi.addstatus(1); + lastanno = cur.curr().get_int(PART_ANNO); + lastpart = cur.curr().get(PART_NUMPART); } - - return FALSE; + if (err == NOERR) + { + err = cur.file().remove(); + if (err != NOERR) + caption = "riga %d"; + } + else + { + error_box("Errore %d nella cancellazione della %s della partita %d/%s", + err, (const char*)caption, anno, partita); + break; + } + } + for (int rig = 1; lastanno > 0 && err == NOERR; rig++) + { + scadenze.put(SCAD_ANNO, lastanno); + scadenze.put(SCAD_NUMPART, lastpart); + scadenze.put(SCAD_NRATA, rig); + if (scadenze.read(_isequal, _lock) == NOERR) + err = scadenze.remove(); + if (err != NOERR) + caption.format("riga scadenza %d", rig); + } + cur.freeze(FALSE); } + + return FALSE; +} - int cg2200(int argc, char** argv) - { - TDeletepart_app a; - a.run(argc, argv, "Eliminazione partita chiuse"); - return 0; - } +int sc1100(int argc, char** argv) +{ + TDeletepart_app a; + a.run(argc, argv, "Eliminazione partita chiuse"); + return 0; +} diff --git a/sc/sc1100.h b/sc/sc1100.h new file mode 100755 index 000000000..d40693871 --- /dev/null +++ b/sc/sc1100.h @@ -0,0 +1,2 @@ + +#define F_DATE 101 \ No newline at end of file diff --git a/sc/sc1100a.uml b/sc/sc1100a.uml new file mode 100755 index 000000000..82225b8b2 --- /dev/null +++ b/sc/sc1100a.uml @@ -0,0 +1,43 @@ +#include "sc1100.h" + +PAGE "Eliminazione Partite Chiuse" -1 -1 42 9 + +TEXT DLG_NULL 40 3 +BEGIN + PROMPT 1 1 "Attenzione " +END + +TEXT DLG_NULL +BEGIN + PROMPT 19 1 "ATTENZIONE" +END + +TEXT DLG_NULL +BEGIN + PROMPT 2 3 "La cancellazione della partite puo' richiedere" +END + +TEXT DLG_NULL +BEGIN + PROMPT 6 4 "tempo. Siate certi di voler proseguire." +END + +DATE F_DATE +BEGIN + PROMPT 2 6 "Eliminare le partite sino al " + HELP "Data Sino a cui eliminare le partite" + CHECKTYPE REQUIRED + WARNING "Si deve specificare la data sino a cui eliminare le partite chiuse" +END + +BUTTON DLG_OK 10 2 +BEGIN + PROMPT -12 -1 "" +END + +BUTTON DLG_QUIT 10 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE diff --git a/sc/sc1200.cpp b/sc/sc1200.cpp index c38366af5..26a3df28c 100755 --- a/sc/sc1200.cpp +++ b/sc/sc1200.cpp @@ -2,9 +2,12 @@ #include #include #include +#include +#include +#include - - +#include "sc1200.h" + class TCreatepart_app : public TApplication { protected: @@ -29,7 +32,39 @@ bool TCreatepart_app::destroy() } bool TCreatepart_app::menu(MENU_TAG) -{ +{ + TMask m("sc1200a"); + TRelation saldi(LF_SALDI); + TLocalisamfile conti(LF_CONTI); + + saldi.zero(); + while (m.run() != K_QUIT) + { + const int anno = m.get_int(F_ANNO); + + saldi.put(SLD_ANNO, anno); + TCursor cur(&saldi, "", 1, saldi.curr(), saldi.curr()); + const int items = cur.items(); + long npart = 0L; + + if (items > 0) + { + for (cur = 0 ; cur.pos() < items; cur++) + { + if (is_clifo(cur.curr().get_int(SLD_GRUPPO), cur.curr().get_int(SLD_CONTO)) + { + TSaldo s(????); + Timporto saldo(s.saldo??); + + if (saldo != ZERO) + { + } + } + } + } + else + message_box("Nessun saldo presente per l'anno %d", anno); + return FALSE; } @@ -37,6 +72,6 @@ bool TCreatepart_app::menu(MENU_TAG) int sc1200(int argc, char** argv) { TCreatepart_app a; - a.run(argc, argv, "Apertura scadenze da saldi"); + a.run(argc, argv, "Apertura scadenze da saldi contabili"); return 0; } diff --git a/sc/sc1200.h b/sc/sc1200.h new file mode 100755 index 000000000..bea726d85 --- /dev/null +++ b/sc/sc1200.h @@ -0,0 +1,2 @@ + +#define F_ANNO 101 \ No newline at end of file diff --git a/sc/sc1200a.uml b/sc/sc1200a.uml new file mode 100755 index 000000000..ebcb9188e --- /dev/null +++ b/sc/sc1200a.uml @@ -0,0 +1,55 @@ +#include "sc1200.h" + +PAGE "Apertura partite da saldi contabili" -1 -1 47 10 + +TEXT DLG_NULL +BEGIN + PROMPT 18 1 "ATTENZIONE" +END + +TEXT DLG_NULL +BEGIN + PROMPT 2 3 "La generazione della partite puo' richiedere" +END + +TEXT DLG_NULL +BEGIN + PROMPT 5 4 "tempo. Siate certi di voler proseguire." +END + +NUMBER F_ANNO 4 +BEGIN + PROMPT 3 6 "Anno di esercizio " + USE ESC + INPUT CODTAB F_ANNO + DISPLAY "Anno Esercizio" CODTAB + DISPLAY "Data inizio esercizio" D0 + DISPLAY "Data fine esercizio " D1 + OUTPUT F_ANNO CODTAB + CHECKTYPE REQUIRED + HELP "Anno di esercizio del quale si desidera la generazione delle partite" + WARNING "L' anno di esercizio e' obbligatorio" +END + +TEXT DLG_NULL +BEGIN + PROMPT 2 3 "La generazione delle partite puo' richiedere" +END + +TEXT DLG_NULL +BEGIN + PROMPT 5 4 "tempo. Siate certi di voler proseguire." +END + +BUTTON DLG_OK 9 2 +BEGIN + PROMPT -12 -1 "Conferma" +END + +BUTTON DLG_QUIT 9 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE +ENDMASK