From cedc40849a037550c6d1bcf7ac3ee94e8c3d51ee Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 14 Jun 2005 11:13:08 +0000 Subject: [PATCH] Patch level : 2.2 Files correlati : ca3 Ricompilazione Demo : [ ] Commento : Iniziata stampa bilanci di analitica git-svn-id: svn://10.65.10.50/trunk@13195 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ca/ca3300.cpp | 135 +++++++++++++++++++++++++++++++++++------------ ca/ca3300a.h | 1 + ca/ca3300a.uml | 138 +++++++++++++++++++++++-------------------------- 3 files changed, 167 insertions(+), 107 deletions(-) diff --git a/ca/ca3300.cpp b/ca/ca3300.cpp index bece561d2..3e4f4177e 100755 --- a/ca/ca3300.cpp +++ b/ca/ca3300.cpp @@ -15,15 +15,87 @@ class TPrint_bilancio_ca_mask : public TAutomask { protected: - bool on_field_event(TOperable_field& o, TField_event e, long jolly) {return true;} - void create_page2(); - int create_page2_sheet(int lf, int& y, short& dlg, bool required); + virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + const TString& get_compatible_library() const; + bool test_compatible_report(); + + void create_sheet(); + int create_sheet_sheet(int lf, int& y, short& dlg, bool required); public: TPrint_bilancio_ca_mask(); virtual ~TPrint_bilancio_ca_mask() {} }; -int TPrint_bilancio_ca_mask::create_page2_sheet(int lf, int& y, short& dlg, bool required) +const TString& TPrint_bilancio_ca_mask::get_compatible_library() const +{ + TString& lib = get_tmp_string(); + lib = "ca3300"; + const char stp = get(F_STAMPAMPROV)[0]; + const char bil = get(F_BILANCIO)[0]; + lib << (stp == 'R' ? 'r' : 'n'); // Raffronto o No? + lib << (bil == 'V' ? 'v' : 'c'); // Verifica o sezioni Contrapposte + return lib; +} + +bool TPrint_bilancio_ca_mask::test_compatible_report() +{ + TFilename lib = get_compatible_library(); + const TString& name = get(F_REPORT); + bool ok = name.not_empty(); + if (ok) + { + TReport rep; + ok = rep.load(name); + if (ok) + { + TToken_string& libraries = rep.get_libraries(); + ok = libraries.get_pos(lib) >= 0; + } + } + if (!ok) + { + set(F_REPORT, lib); + lib.ext("rep"); + ok = lib.custom_path(); + } + return ok; +} + +bool TPrint_bilancio_ca_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) +{ + switch (o.dlg()) + { + case F_BILANCIO: + case F_STAMPAMPROV: + if (e == fe_init || e == fe_modify) + test_compatible_report(); + break; + case F_REPORT: + if (e == fe_button) + { + const TString8 lib = get_compatible_library(); + TFilename path = o.get(); + if (select_custom_file(path, "rep", lib)) + { + path = path.name(); + path.ext(""); + o.set(path); + } + } else + if (e == fe_close) + { + if (!test_compatible_report()) + return error_box("Impossibile trovare un report compatibile"); + } + break; + default: + break; + } + return true; +} + + +int TPrint_bilancio_ca_mask::create_sheet_sheet(int lf, int& y, short& dlg, bool required) { TSheet_field& sf = sfield(F_RIGHE); TMask& sm = sf.sheet_mask(); @@ -68,7 +140,7 @@ int TPrint_bilancio_ca_mask::create_page2_sheet(int lf, int& y, short& dlg, bool return h; } -void TPrint_bilancio_ca_mask::create_page2() +void TPrint_bilancio_ca_mask::create_sheet() { TSheet_field& sf = sfield(F_RIGHE); TMask& sm = sf.sheet_mask(); @@ -88,27 +160,27 @@ void TPrint_bilancio_ca_mask::create_page2() if (level == "CDC") // Crea centro di costo { if (fasinfo.parent() == LF_CDC) - create_page2_sheet(LF_FASI, y, dlg, fsc_req); + create_sheet_sheet(LF_FASI, y, dlg, fsc_req); else { const bool cdc_req = ini.get_bool("CdcRequired"); - create_page2_sheet(LF_CDC, y, dlg, cdc_req); + create_sheet_sheet(LF_CDC, y, dlg, cdc_req); } } else if (level == "CMS") // Crea commessa { if (fasinfo.parent() == LF_COMMESSE) - create_page2_sheet(LF_FASI, y, dlg, fsc_req); + create_sheet_sheet(LF_FASI, y, dlg, fsc_req); else { const bool cms_req = ini.get_bool("CmsRequired"); - create_page2_sheet(LF_COMMESSE, y, dlg, cms_req); + create_sheet_sheet(LF_COMMESSE, y, dlg, cms_req); } } } if (fasinfo.levels() > 0 && fasinfo.parent() <= 0) - create_page2_sheet(LF_FASI, y, dlg, fsc_req); + create_sheet_sheet(LF_FASI, y, dlg, fsc_req); for (short id = S_CDC12+100; id >= S_CDC1+100; id--) { @@ -136,8 +208,8 @@ TPrint_bilancio_ca_mask::TPrint_bilancio_ca_mask() const int logicnum = use_pdcc ? LF_PCON : LF_PCONANA; - const int nfields = ca_create_fields(*this, 0, logicnum, 2, 10, F_CDC1_INI, F_DES1_INI, 0x0, "#DACONTO"); - ca_create_fields(*this, 0, logicnum, 2, 16, F_CDC1_FIN, F_DES1_FIN, 0x0, "#ACONTO"); + const int nfields = ca_create_fields(*this, 1, logicnum, 2, 1, F_CDC1_INI, F_DES1_INI, 0x0, "#DACONTO"); + ca_create_fields(*this, 1, logicnum, 2, 7, F_CDC1_FIN, F_DES1_FIN, 0x0, "#ACONTO"); for (int i = 0; i < nfields; i++) { @@ -149,42 +221,37 @@ TPrint_bilancio_ca_mask::TPrint_bilancio_ca_mask() aconto.check_type(CHECK_NORMAL); } // creazione dei campi della seconda pagina della maschera - create_page2(); + create_sheet(); } +//////////////////////////////////////////////////////// +// Reports +//////////////////////////////////////////////////////// + +class TReport_bilancio_ca : public TAnal_report +{ +public: + TReport_bilancio_ca(const char* name) { load(name); } +}; //////////////////////////////////////////////////////// // APPLICAZIONE //////////////////////////////////////////////////////// class TPrint_bilancio_ca : public TSkeleton_application { - TPrint_bilancio_ca_mask * _mask; - -protected: - bool create(); - bool destroy(); - public: virtual void main_loop(); }; -bool TPrint_bilancio_ca::create() -{ - _mask = new TPrint_bilancio_ca_mask; - return TSkeleton_application::create(); -} - -bool TPrint_bilancio_ca::destroy() -{ - delete _mask; - return TSkeleton_application::destroy(); -} - void TPrint_bilancio_ca::main_loop() { - while (_mask->run() == K_ENTER) + TPrint_bilancio_ca_mask mask; + while (mask.run() != K_QUIT) { - //costruzione del ciclo di scansione principale in base ai parametri della maschera + TReport_book book; + TReport_bilancio_ca rep(mask.get(F_REPORT)); + book.add(rep); + book.print_or_preview(); } } @@ -193,4 +260,4 @@ int ca3300(int argc, char* argv[]) TPrint_bilancio_ca a; a.run(argc, argv, TR("Stampa bilancio")); return 0; -} \ No newline at end of file +} diff --git a/ca/ca3300a.h b/ca/ca3300a.h index 791f062d7..c5af24e3f 100755 --- a/ca/ca3300a.h +++ b/ca/ca3300a.h @@ -25,6 +25,7 @@ #define F_DES1_FIN 376 #define F_DES12_FIN 391 +#define F_SELECT 394 #define F_REPORT 395 //sheet di pagina 2 diff --git a/ca/ca3300a.uml b/ca/ca3300a.uml index 76d219899..d4744400b 100755 --- a/ca/ca3300a.uml +++ b/ca/ca3300a.uml @@ -2,12 +2,12 @@ TOOLBAR "" 0 -3 0 3 -BUTTON DLG_OK 10 2 +BUTTON DLG_PRINT 12 2 BEGIN PROMPT -12 -11 "" END -BUTTON DLG_QUIT 10 2 +BUTTON DLG_QUIT 12 2 BEGIN PROMPT -22 -11 "" END @@ -16,9 +16,14 @@ ENDPAGE PAGE "Stampa bilancio" -1 -1 76 16 +GROUPBOX DLG_NULL 78 3 +BEGIN + PROMPT 1 0 "@bDitta" +END + NUMBER F_CODDITTA 5 BEGIN - PROMPT 2 1 "Ditta " + PROMPT 2 1 "Codice " FLAGS "FRD" USE LF_NDITTE KEY 1 CHECKTYPE REQUIRED @@ -29,23 +34,15 @@ BEGIN OUTPUT F_RAGSOC RAGSOC END -STRING F_RAGSOC 50 +STRING F_RAGSOC 58 BEGIN - PROMPT 2 2 "Ragione sociale " + PROMPT 19 1 "" FLAGS "D" END -DATE F_DATASTAMPA -BEGIN - PROMPT 48 1 "Data stampa " - HELP "Data che verra' stampata sul bilancio" - FLAGS "A" -END - NUMBER F_ANNO 4 BEGIN - PROMPT 2 3 "Codice esercizio " - HELP "Esercizio di cui si vuole ottenere il bilancio" + PROMPT 2 3 "Codice esercizio " USE ESC INPUT CODTAB F_ANNO DISPLAY "Codice" CODTAB @@ -53,105 +50,86 @@ BEGIN DISPLAY "Data fine esercizio" D1 OUTPUT F_ANNO CODTAB FLAGS "Z" - CHECKTYPE NORMAL - WARNING "L'esercizio non esiste" + CHECKTYPE REQUIRED + WARNING "Esercizio assente" ADD RUN cg0 -5 esc - MESSAGE EMPTY SHOW,6@|HIDE,7@|K_SPACE,F_STAMPA - MESSAGE HIDE,6@|SHOW,7@|K_SPACE,F_STAMPA + MESSAGE K_SPACE,F_STAMPA END -LIST F_BILANCIO 22 +DATE F_DATASTAMPA BEGIN - PROMPT 2 4 "Tipo bilancio" - HELP "Indicare il tipo di bilancio da stampare" - ITEM "1|A sezioni contrapposte" - MESSAGE HIDE,4@|RESET,4@|SHOW,3@ - ITEM "2|Di verifica" - MESSAGE SHOW,4@|HIDE,3@|K_SPACE,F_STAMPA + PROMPT 52 3 "Data di stampa " + FLAGS "A" END -LIST F_STAMPA 22 +RADIOBUTTON F_BILANCIO 1 28 BEGIN - PROMPT 41 4 "Tipo stampa" - HELP "Indicare il tipo di stampa" + PROMPT 2 4 "@bBilancio" + ITEM "C|A sezioni contrapposte" + MESSAGE HIDE,4@|SHOW,3@ + ITEM "V|Di verifica" + MESSAGE SHOW,4@|HIDE,3@ +END + +LIST F_STAMPAMPROV 11 +BEGIN + PROMPT 12 4 "" + ITEM "P|Preventivo" + ITEM "C|Consuntivo" + ITEM "R|Raffronto" +END + +RADIUOBUTTON F_STAMPA 26 +BEGIN + PROMPT 31 4 "@bStampa" ITEM "1|Per date limite" - MESSAGE SHOW,5@|K_SPACE,F_BILANCIO + MESSAGE ENABLE,5@ ITEM "2|All'ultima immissione" - MESSAGE HIDE,5@|RESET,5@ + MESSAGE CLEAR,5@ END -GROUPBOX DLG_NULL 40 3 +GROUPBOX DLG_NULL 20 4 BEGIN - PROMPT 0 5 "@bData operazione" - GROUP 6 -END - -GROUPBOX DLG_NULL 40 3 -BEGIN - PROMPT 0 5 "@bData competenza" - GROUP 7 + PROMPT 58 4 "@bData di competenza" END DATE F_DATADA BEGIN - PROMPT 2 6 "Dal " - HELP "Data dalla quale iniziare la stampa" + PROMPT 59 5 "Dal " GROUP 4 5 END DATE F_DATAA BEGIN - PROMPT 20 6 "Al " + PROMPT 59 6 "Al " GROUP 5 END -LIST F_STAMPAMPROV 20 -BEGIN - PROMPT 41 6 "Bilancio " - ITEM "1|Preventivo" - ITEM "2|Consuntivo" - ITEM "3|Raffronto" - GROUP 3 -END - LIST F_STAMPAV 20 BEGIN - PROMPT 41 6 "Tipo stampa" + PROMPT 2 8 "Selezione conti " ITEM "1|Movimentati" - ITEM "2|Con saldo <> da 0" + ITEM "2|Con saldo non nullo" ITEM "3|Tutti" GROUP 4 END BOOLEAN F_CODICI BEGIN - PROMPT 2 8 "Non stampare codici conti " - HELP "Indicare se non si devono stampare i codici dei conti" + PROMPT 42 8 "Non stampare codici conti " GROUP 4 END -GROUPBOX DLG_NULL 78 6 +STRING F_REPORT 256 66 BEGIN - PROMPT 0 9 "@bDa:" + PROMPT 2 9 "Report " + FLAGS "B" + CHECKTYPE REQUIRED END -GROUPBOX DLG_NULL 78 6 +SPREADSHEET F_RIGHE BEGIN - PROMPT 0 15 "@bA:" -END - -STRING F_REPORT 256 64 -BEGIN - PROMPT 1 21 "Report " -END - -ENDPAGE - -PAGE "Selezioni" -1 -1 74 20 - -SPREADSHEET F_RIGHE -1 -2 -BEGIN - PROMPT 0 2 "" + PROMPT 0 10 "" ITEM "Cdc 1" ITEM "Cdc 2" ITEM "Cdc 3" @@ -168,6 +146,20 @@ END ENDPAGE +PAGE "Selezioni" -1 -1 74 20 + +GROUPBOX DLG_NULL 78 6 +BEGIN + PROMPT 1 0 "@bDa:" +END + +GROUPBOX DLG_NULL 78 6 +BEGIN + PROMPT 1 6 "@bA:" +END + +ENDPAGE + ENDMASK PAGE "Riga" -1 -1 78 19