diff --git a/ca/ca0500.cpp b/ca/ca0500.cpp index 340271d13..e6a9cd2e8 100755 --- a/ca/ca0500.cpp +++ b/ca/ca0500.cpp @@ -1,9 +1,11 @@ // gestione files Contabilita' Analitica: CENTRI DI COSTO #include +#include #include #include "calib01.h" #include "ca0500a.h" +#include "cdc.h" //////////////////////////////////////////////////////////////////////// //MASCHERA @@ -31,6 +33,7 @@ protected: virtual void init_modify_mode(TMask& mask); virtual void init_insert_mode(TMask& mask); + virtual bool protected_record(TRectype& record); virtual TSimple_anal_msk* create_mask() const { return new TCdC_anal_msk; } virtual bool user_create(); }; @@ -42,6 +45,23 @@ bool TCdC_app::filtered() const return TAnal_app::filtered(); } +//non si può eliminare un cdc se esso appare in un saldo analitico dell'anno in corso o dell'anno precedente +bool TCdC_app::protected_record(TRectype& record) +{ + TString query; + query << "USE SALDANA\nSELECT COSTO==#COSTO\nFROM ANNO=#ANNO\n"; + const TString cdc = record.get(CDC_CODCOSTO); + const TDate today(TODAY); + const long anno = today.year(); + + TISAM_recordset saldana_recset(query); + saldana_recset.set_var("#COSTO", TVariant(cdc)); + saldana_recset.set_var("#ANNO", TVariant(anno - 1)); + + const long items = saldana_recset.items(); + return items > 0; +} + void TCdC_app::init_modify_mode(TMask& mask) { const short id = ((TCdC_anal_msk &)mask).get_field_id(_maxlev - 1, 1); diff --git a/ca/ca0600.cpp b/ca/ca0600.cpp index 87f3b83fc..8987b6a32 100755 --- a/ca/ca0600.cpp +++ b/ca/ca0600.cpp @@ -1,5 +1,6 @@ // gestione files Contabilita' Analitica: COMMESSE #include +#include #include #include "calib01.h" @@ -36,10 +37,11 @@ class TCms_app : public TAnal_app protected: virtual const char * extra_modules() const {return "cm";} //funziona anche con autorizzazione CM - virtual bool filtered() const; + virtual bool filtered() const; virtual void init_modify_mode(TMask& mask); virtual void init_insert_mode(TMask& mask); + virtual bool protected_record(TRectype& record); virtual TSimple_anal_msk* create_mask() const { return new TCms_anal_msk; } virtual bool user_create(); }; @@ -51,6 +53,23 @@ bool TCms_app::filtered() const return TAnal_app::filtered(); } +//non si può eliminare una commessa se essa appare in un saldo analitico dell'anno in corso o dell'anno precedente +bool TCms_app::protected_record(TRectype& record) +{ + TString query; + query << "USE SALDANA\nSELECT COMMESSA==#COMMESSA\nFROM ANNO=#ANNO\n"; + const TString commessa = record.get(COMMESSE_CODCMS); + const TDate today(TODAY); + const long anno = today.year(); + + TISAM_recordset saldana_recset(query); + saldana_recset.set_var("#COMMESSA", TVariant(commessa)); + saldana_recset.set_var("#ANNO", TVariant(anno - 1)); + + const long items = saldana_recset.items(); + return items > 0; +} + void TCms_app::init_modify_mode(TMask& mask) { const short id = ((TCms_anal_msk &)mask).get_field_id(_maxlev - 1 , 1); diff --git a/ca/ca0700.cpp b/ca/ca0700.cpp index e3797df52..b712e4336 100755 --- a/ca/ca0700.cpp +++ b/ca/ca0700.cpp @@ -1,10 +1,12 @@ // gestione files Contabilita' Analitica: FASI #include +#include #include #include "calib01.h" #include "calibmsk.h" #include "ca0700a.h" +#include "fasi.h" //////////////////////////////////////////////////////////////////////// //MASCHERA @@ -43,7 +45,7 @@ protected: virtual const char * extra_modules() const {return "cm";} //funziona anche con autorizzazione CM virtual bool filtered() const; - + virtual bool protected_record(TRectype& record); virtual TSimple_anal_msk* create_mask() const { return new TFsc_anal_msk; } virtual bool user_create(); }; @@ -55,6 +57,40 @@ bool TFsc_app::filtered() const return TAnal_app::filtered(); } +//non si può eliminare una fase se essa appare in un saldo analitico dell'anno in corso o dell'anno precedente +bool TFsc_app::protected_record(TRectype& record) +{ + TString query; + query << "USE SALDANA\nSELECT (FASE==#FASE)"; + //controlla se le fasi sono figlie delle commesse o dei centri di costo o semplici figlie di nessuno + const TString& fath_fasi = ca_config().get("FathFasi"); + + if (fath_fasi == "CMS") + query << "&&(COMMESSA==#COMMESSA)"; + + if (fath_fasi == "CDC") + query << "&&(COSTO==#COSTO)"; + + query << "\nFROM ANNO=#ANNO"; + + const TString fase = record.get(FASI_CODFASE); + const TDate today(TODAY); + const long anno = today.year(); + const TString codcmsfas = record.get(FASI_CODCMSFAS); + + TISAM_recordset saldana_recset(query); + + saldana_recset.set_var("#FASE", TVariant(fase)); + saldana_recset.set_var("#ANNO", TVariant(anno - 1)); + if (fath_fasi == "CMS") + saldana_recset.set_var("#COMMESSA", TVariant(codcmsfas)); + if (fath_fasi == "CDC") + saldana_recset.set_var("#COSTO", TVariant(codcmsfas)); + + const long items = saldana_recset.items(); + return items > 0; +} + bool TFsc_app::user_create() { const TMultilevel_code_info& mci = ca_multilevel_code_info(LF_FASI); diff --git a/ca/ca3800.cpp b/ca/ca3800.cpp index 1974069c1..8afbf5e3d 100755 --- a/ca/ca3800.cpp +++ b/ca/ca3800.cpp @@ -189,7 +189,8 @@ protected: public: void set_filter(const TPrint_bilancio_cms_mask& msk, const TString& curr_fase); TPrint_bilancio_cms_rep(const char* rep_name, const TString& prefix, const int depth, - const bool show_fasi, const bool show_cdc); + const bool show_fasi, const bool show_cdc, + const bool show_cms_descr, const bool show_cms_date); }; bool TPrint_bilancio_cms_rep::get_usr_val(const TString& name, TVariant& var) const @@ -214,8 +215,9 @@ void TPrint_bilancio_cms_rep::set_filter(const TPrint_bilancio_cms_mask& msk, co } TPrint_bilancio_cms_rep::TPrint_bilancio_cms_rep(const char* rep_name, const TString& prefix, - const int depth, const bool show_fasi, const bool show_cdc) - :TCRPA_report(rep_name, prefix, depth, show_fasi, show_cdc) + const int depth, const bool show_fasi, const bool show_cdc, + const bool show_cms_descr, const bool show_cms_date) + :TCRPA_report(rep_name, prefix, depth, show_fasi, show_cdc, show_cms_descr, show_cms_date) { } @@ -256,13 +258,17 @@ void TPrint_bilancio_cms::main_loop() const bool group_cdc = tipostampa == 8; const bool show_cdc = use_cdc && cdc.empty(); + //descrizioni + const bool show_cms_descr = mask.get_bool(F_SHOW_CMS_DESCR); + const bool show_cms_date = mask.get_bool(F_SHOW_CMS_DATE); + if (path.empty()) { path = mask.get_report_class(); } //crea il report in base ai parametri (tipo report,struttura,profondita' di stampa) - TPrint_bilancio_cms_rep rep(path, prefix, depth, show_fasi, show_cdc); + TPrint_bilancio_cms_rep rep(path, prefix, depth, show_fasi, show_cdc, show_cms_descr, show_cms_date); //se e' una stampa di tipo fasi riassunte (crpa special edition) deve fare lo scanning di tutte le fasi.. //..singolarmente e stampare un report per ogni fase.Senno' stampa un solo report @@ -328,3 +334,19 @@ int ca3800(int argc, char* argv[]) a.run(argc, argv, TR("Stampa bilancio di commessa")); return 0; } + +//Istruzioni per i programmi ca3800 e ca3900 +//------------------------------------------ +// CA_3800 +// Gestore maschera ca3800 (Analisi Bilancio di Commessa) +// Creatore del report e dell'applicazione + +// CA_3801 +// Gestore dei report a colonne variabili (stampa in base a struttura scelta per il PCONANA). Serve solo per ca3800. + +// CA_3883 +// Gestore del recordset per il calcolo dei valori da mettere sulle stampe (è il nucleo dei programmi ca3800 e ca3900) + +// CA_3900 +// Gestore maschera ca3900 (Stima ricavi di competenza) +// Creatore del report e dell'applicazione \ No newline at end of file diff --git a/ca/ca3800.uml b/ca/ca3800.uml index 55859bdfd..5a2881786 100755 --- a/ca/ca3800.uml +++ b/ca/ca3800.uml @@ -1,7 +1,9 @@ #include "ca3883a.h" TOOLBAR "topbar" 0 0 0 2 + #include + ENDPAGE PAGE "Stampa bilancio commessa" 0 2 0 0 @@ -45,15 +47,25 @@ END BOOLEAN F_INCLUDE_DOCUMENTI BEGIN - PROMPT 1 4 "Includere documenti non contabilizzati (di tipo ordine)" + PROMPT 1 4 "Includere documenti inevasi e/o non contabilizzati" END DATE F_DATASTAMPA BEGIN - PROMPT 2 6 "Data stampa " + PROMPT 0 6 "Data stampa " FLAGS "A" END +BOOLEAN F_SHOW_CMS_DESCR +BEGIN + PROMPT 25 6 "Mostrare descr. commesse" +END + +BOOLEAN F_SHOW_CMS_DATE +BEGIN + PROMPT 53 6 "Mostrare date commesse" +END + GROUPBOX DLG_NULL 76 7 BEGIN PROMPT 0 7 "@bParametri" @@ -134,7 +146,7 @@ END ENDPAGE -PAGE "Istruzioni" 0 2 0 0 +PAGE "Istruzioni" -1 -1 78 20 GROUPBOX DLG_NULL 78 9 BEGIN @@ -148,7 +160,7 @@ END TEXT -1 BEGIN - PROMPT 1 3 " e finale dell'esercizio stesso. Solo il campo data è modificabile, accettando" + PROMPT 1 3 " e finale dell'esercizio stesso. Solo il campo 'alla data' è modificabile, accettando" END TEXT -1 @@ -188,9 +200,9 @@ END TEXT -1 BEGIN - PROMPT 1 12 " non contabilizzati di tipo ordine con data inclusa nell'intervallo selezionato" + PROMPT 1 12 " non contabilizzati e gli ordini inevasi con data inclusa nell'intervallo selezionato" END ENDPAGE -ENDMASK +ENDMASK \ No newline at end of file diff --git a/ca/ca3800a.rep b/ca/ca3800a.rep index 61b2464ce..7ae4d4a05 100755 --- a/ca/ca3800a.rep +++ b/ca/ca3800a.rep @@ -20,9 +20,11 @@ #REPORT.PAGE - - - + + + + + TIPOSTIMA
  • @@ -30,9 +32,9 @@
  • - + - + "MARGINE CONTRIBUZIONE" @@ -173,11 +175,19 @@ - IF(#H4.3=0;DESCRIZ;"") + DESCRIZ - + + + DATAINI + + + + DATAFINE + + FASE - #STAMPAFASI @ + #STAMPAFASI @ EMPTY= IF #THIS HIDE ELSE @@ -185,9 +195,9 @@ ELSE THEN - + CDC - #STAMPACDC @ + #STAMPACDC @ EMPTY= IF #THIS HIDE ELSE @@ -195,20 +205,20 @@ ELSE THEN - + ROUND(AVANZAMENTO;0) - + MESSAGE ADD,F4.69 MESSAGE ADD,F3.69 - + #RICAVI-#COSTI MESSAGE ADD,F4.169 MESSAGE ADD,F3.169 - + #RICAVI @ EMPTY= IF @@ -226,7 +236,7 @@ ROUND THEN #THIS ! - + - - - - - - - - - - - - - + + + + + + + + + + + + +
    @@ -43,10 +43,10 @@ MESSAGE RESET,F1.105 MESSAGE RESET,F1.106 MESSAGE RESET,F1.107 MESSAGE RESET,F1.108 - + - + @@ -74,7 +74,7 @@ MESSAGE RESET,F2.108 ANNO - +
    - + CODCMS - + DESCRIZ - - - + + + #COS_BDG MESSAGE ADD,F3.101 - + #COS_MAT MESSAGE ADD,F3.102 - + #101 @ \ legge il budget 0 = IF \ se 0 per evitare la divisione per 0 mette 100 nella % 100 @@ -146,11 +146,11 @@ ELSE THEN #THIS ! - + #RIC_BDG MESSAGE ADD,F3.104 - + #103 @ #104 @ * @@ -159,18 +159,18 @@ THEN #THIS ! MESSAGE ADD,F3.105 - + #RIC_MAT MESSAGE ADD,F3.106 - + #105 @ #106 @ - #THIS ! MESSAGE ADD,F3.107 - + #105 @ #102 @ - @@ -178,7 +178,7 @@ THEN MESSAGE ADD,F3.108 - + #105 @ 0 @@ -198,7 +198,7 @@ THEN
    - + @@ -209,13 +209,13 @@ THEN
    - + - - - - - + + + + + #101 @ 0 = IF 100 @@ -232,12 +232,12 @@ ELSE THEN #THIS ! - - - - - - + + + + + + #105 @ 0 = @@ -257,7 +257,7 @@ THEN
    - + H2.101 @@ -272,25 +272,25 @@ THEN H2.102 - + - +
    - + H3.101 @@ -359,16 +359,16 @@ THEN
  • - - + +