diff --git a/ca/ca3.cpp b/ca/ca3.cpp index bdb134dc5..1ce6882d6 100755 --- a/ca/ca3.cpp +++ b/ca/ca3.cpp @@ -13,6 +13,7 @@ int main(int argc, char** argv) //case 4: ca3500(argc, argv); break; // stampa scheda CdC/Commessa/Fase case 5: ca3600(argc, argv); break; // stampa pagato per CdC/Commessa/Fase case 6: ca3700(argc, argv); break; //stampa rendiconto + case 7: ca3800(argc, argv); break; //stampa bilancio di commessa per esercizio case 8: ca3900(argc, argv); break; // generazione movimenti perfetti ma casuali default: ca3100(argc, argv); break; // stampa movimenti } diff --git a/ca/ca3.h b/ca/ca3.h index dc0bb6f84..8fc9cb14d 100755 --- a/ca/ca3.h +++ b/ca/ca3.h @@ -8,6 +8,7 @@ int ca3300(int argc, char* argv[]); //int ca3500(int argc, char* argv[]); int ca3600(int argc, char* argv[]); int ca3700(int argc, char* argv[]); +int ca3800(int argc, char* argv[]); int ca3900(int argc, char* argv[]); #endif // __CA3_H diff --git a/ca/ca3800.cpp b/ca/ca3800.cpp new file mode 100755 index 000000000..0deb6a068 --- /dev/null +++ b/ca/ca3800.cpp @@ -0,0 +1,213 @@ +#include +#include +#include +#include + +#include "ca3.h" +#include "ca3800.h" +#include "calib01.h" +#include "calib02.h" + +//////////////////////////////////////////////////////// +// MASCHERA +//////////////////////////////////////////////////////// +class TPrint_bilancio_cms_mask : public TAnal_report_mask +{ +protected: + virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + const TString& get_report_class() const; + bool test_compatible_report(); + +public: + TPrint_bilancio_cms_mask(); + virtual ~TPrint_bilancio_cms_mask() {} +}; + +const TString& TPrint_bilancio_cms_mask::get_report_class() const +{ + TString& classe = get_tmp_string(); + classe = "ca3800a"; + return classe; +} + +bool TPrint_bilancio_cms_mask::test_compatible_report() +{ + const TString& cls = get_report_class(); + const TString& name = get(F_REPORT); + bool ok = name.not_empty(); + if (ok) + { + TReport rep; + ok = rep.load(name); + if (ok) + { + const TString& classe = rep.get_class(); + ok = classe == cls; + } + } + if (!ok) + { + set(F_REPORT, cls); + TFilename path = cls; + path.ext("rep"); + ok = path.custom_path(); + } + return ok; +} + +bool TPrint_bilancio_cms_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) +{ + switch (o.dlg()) + { + case F_REPORT: + if (e == fe_button) + { + const TString8 lib = get_report_class(); + 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(TR("Impossibile trovare un report compatibile")); + } + break; + default: + break; + } + return TAnal_report_mask::on_field_event(o, e, jolly); +} + + +TPrint_bilancio_cms_mask::TPrint_bilancio_cms_mask() + :TAnal_report_mask("ca3800") +{ +} + + +/////////////////////////////////////////////////////////////// +// RECORDSET +/////////////////////////////////////////////////////////////// +class TPrint_bilancio_cms_recordset : public TRecordset +{ + TArray _righe; + TRecnotype _curr; + TArray _colonne; + +private: + int _anno; + +protected: + virtual TRecnotype items() const { return _righe.items(); } + virtual bool move_to(TRecnotype pos); + virtual TRecnotype current_row() const { return _curr; } + virtual void requery(); + virtual const TString& query_text() const { return EMPTY_STRING; } + virtual unsigned int columns() const { return _colonne.items(); } + virtual const TRecordset_column_info& column_info(unsigned int column) const { return (TRecordset_column_info&) _colonne[column]; } + virtual const TVariant& get(unsigned int column) const; + virtual const TVariant& get(const char* column_name) const; + +public: + virtual void set_filter(const TPrint_bilancio_cms_mask& msk); +}; + + +bool TPrint_bilancio_cms_recordset::move_to(TRecnotype pos) +{ + _curr = pos; + return pos >= 0 && pos < items(); +} + +void TPrint_bilancio_cms_recordset::requery() +{ +} + +const TVariant& TPrint_bilancio_cms_recordset::get(unsigned int column) const +{ + return NULL_VARIANT; +} + +const TVariant& TPrint_bilancio_cms_recordset::get(const char* column_name) const +{ + return NULL_VARIANT; +} + + +void TPrint_bilancio_cms_recordset::set_filter(const TPrint_bilancio_cms_mask& msk) +{ + _anno = msk.get_int(F_ESERCIZIO); +} + +//////////////////////////////////////////////////////// +// REPORT +//////////////////////////////////////////////////////// +class TPrint_bilancio_cms_rep : public TAnal_report +{ + +protected: + virtual bool set_recordset(); + virtual bool get_usr_val(const TString& name, TVariant& var) const; + +public: + void set_filter(const TPrint_bilancio_cms_mask& msk); +}; + +bool TPrint_bilancio_cms_rep::get_usr_val(const TString& name, TVariant& var) const +{ + return TAnal_report::get_usr_val(name, var); +} + +bool TPrint_bilancio_cms_rep::set_recordset() +{ + TPrint_bilancio_cms_recordset* rs = new TPrint_bilancio_cms_recordset(); + return TAnal_report::set_recordset(rs); +} + +void TPrint_bilancio_cms_rep::set_filter(const TPrint_bilancio_cms_mask& msk) +{ + TPrint_bilancio_cms_recordset* recset = new TPrint_bilancio_cms_recordset(); + + recset->set_filter(msk); + TAnal_report::set_recordset(recset); +} + +//////////////////////////////////////////////////////// +// APPLICAZIONE +//////////////////////////////////////////////////////// +class TPrint_bilancio_cms : public TSkeleton_application +{ +public: + virtual void main_loop(); +}; + +void TPrint_bilancio_cms::main_loop() +{ + TPrint_bilancio_cms_mask mask; + while (mask.run() == K_ENTER) + { + //report e book dei report + TReport_book book; + TString path = mask.get(F_REPORT); + if (path.empty()) + path = "ca3800a"; + TPrint_bilancio_cms_rep rep; + rep.load(path); + + rep.set_filter(mask); //fa la set filter sulla commessa in corso + book.add(rep); + book.print_or_preview(); //stampa il book dei report + } +} + +int ca3800(int argc, char* argv[]) +{ + TPrint_bilancio_cms a; + a.run(argc, argv, TR("Stampa bilancio di commessa")); + return 0; +} diff --git a/ca/ca3800.h b/ca/ca3800.h new file mode 100755 index 000000000..f079bdd73 --- /dev/null +++ b/ca/ca3800.h @@ -0,0 +1,14 @@ +#ifndef __CA3800_H +#define __CA3800_H + +#define F_DITTA 101 +#define F_RAGSOC 102 +#define F_DATASTAMPA 103 +#define F_ESERCIZIO 104 +#define F_REPORT 105 +#define F_INIZIO_ES 106 +#define F_FINE_ES 107 +#define F_TIPOSTAMPA 108 + +#endif // __CA3800_H + diff --git a/ca/ca3800.uml b/ca/ca3800.uml new file mode 100755 index 000000000..c278e6e5c --- /dev/null +++ b/ca/ca3800.uml @@ -0,0 +1,92 @@ +#include "ca3800.h" + +TOOLBAR "" 0 -3 0 2 + +BUTTON DLG_PRINT 10 2 +BEGIN + PROMPT -12 -1 "~Stampa" + MESSAGE EXIT,K_ENTER +END + +BUTTON DLG_QUIT 10 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE + +PAGE "Stampa bilancio commessa" -1 -1 0 -3 + +GROUPBOX DLG_NULL 74 4 +BEGIN + PROMPT 0 1 "" +END + +NUMBER F_DITTA 5 +BEGIN + PROMPT 1 2 "Ditta " + FLAGS "DF" +END + +STRING F_RAGSOC 50 +BEGIN + PROMPT 20 2 "" + USE LF_NDITTE + INPUT CODDITTA F_DITTA + OUTPUT F_RAGSOC RAGSOC + CHECKTYPE NORMAL + FLAGS "D" +END + +NUMBER F_ESERCIZIO 4 +BEGIN + PROMPT 1 3 "Esercizio " + FLAGS "AZ" + USE CCE + JOIN ESC ALIAS 104 INTO CODTAB==CODTAB + INPUT CODTAB F_ESERCIZIO + DISPLAY "Codice esercizio" CODTAB + DISPLAY "Inizio esercizio" 104@->D0 + DISPLAY "Fine esercizio" 104@->D1 + OUTPUT F_ESERCIZIO CODTAB + OUTPUT F_INIZIO_ES 104@->D0 + OUTPUT F_FINE_ES 104@->D1 + CHECKTYPE REQUIRED +END + +DATE F_INIZIO_ES +BEGIN + PROMPT 20 3 "Inizio " + FLAGS "D" +END + +DATE F_FINE_ES +BEGIN + PROMPT 44 3 "Fine " + FLAGS "D" +END + +DATE F_DATASTAMPA +BEGIN + PROMPT 2 5 "Data stampa " + FLAGS "A" +END + +RADIOBUTTON F_TIPOSTAMPA 22 +BEGIN + PROMPT 2 7 "Tipo di stima" + FLAGS "Z" + ITEM "X|Tempo" + ITEM " |Costi" +END + +STRING F_REPORT 256 64 +BEGIN + PROMPT 1 20 "Report " + FLAGS "B" + CHECKTYPE REQUIRED +END + +ENDPAGE + +ENDMASK diff --git a/ca/ca3800a.rep b/ca/ca3800a.rep new file mode 100755 index 000000000..86928e79d --- /dev/null +++ b/ca/ca3800a.rep @@ -0,0 +1,363 @@ + + + Bilancio commessa CA + +
+ + + + #SYSTEM.RAGSOC + + + #SYSTEM.DATE + + + #REPORT.PAGE + + + + + + + + + + + + + + + + + + + +
+
+ MESSAGE RESET,F1.101 +MESSAGE RESET,F1.102 + + + + + + + #COSTO + CA_FORMAT_COSTO + + + + MESSAGE ISAMREAD,CDC,CODCOSTO=#COSTO,DESCRIZ + + + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,ANNO + + + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,REGIVA + + + + #COMMESSA + CA_FORMAT_COMMESSA + + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,DESCRIZ + + + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,DATAINIZIO + + + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,RENDIC + + + + + #FASE + CA_FORMAT_FASE + + + + MESSAGE ISAMREAD,FASI,CODFASE=#FASE,DESCRIZ + + + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,DATAFINE + + + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,CHIUSA + + + + + + #PIANO + + + + + #DACONTO + CA_FORMAT_CONTO + + + + + #ACONTO + CA_FORMAT_CONTO + + + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,DATAPROR + + + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,PROROGA + + + + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,CODCF + + + + MESSAGE ISAMREAD,CLIFO,TIPOCF=C!CODCF=#101,RAGSOC + +
+
+ CONTO + + MESSAGE RESET,F2.101 +MESSAGE RESET,F2.102 +MESSAGE RESET,F2.103 + + + CONTO + CA_FORMAT_CONTO + + + + MESSAGE ISAMREAD,PCONANA,CODCONTO=CONTO,DESCR + + + + + + + #VARIAZIONE + #THIS @ \ prende il proprio valore +"F1." \ decide il campo destinazione in base al valore di INDBIL,che gli viene passato dal programma.. +300 \ ..i campi della somma vanno da 301 a 304 in base a valore INDBIL (che varia da 1 a 4) +#INDBIL @ ++ \ somma valore INDBIL a 300 ++ \ somma F1. a valore INDBIL ++! \ esegue la ADD sul campo di destinazione + + + + + #PREVENTIVO + #THIS @ \ prende il proprio valore +"F1." \ decide il campo destinazione in base al valore di INDBIL,che gli viene passato dal programma.. +300 \ ..i campi della somma vanno da 301 a 304 in base a valore INDBIL (che varia da 1 a 4) +#INDBIL @ ++ \ somma valore INDBIL a 300 ++ \ somma F1. a valore INDBIL ++! \ esegue la ADD sul campo di destinazione + + +
+
+ CODNUM+ANNO+NUMRD + + + +
+
+
+ HIDDEN!='X' + + NUMREG + + + NUMREGCG + + + DATA + + + NUMDOCRIF + + + DATADOCRIF + + + + DESC + + + NRIGA + + + + DESCRIGA + + + DOCORIG + + + FATTURATO + MESSAGE ADD,F2.101 + + + MATURATO + MESSAGE ADD,F2.102 + + + IMPEGNATO + MESSAGE ADD,F2.103 + + + + CODNUM + + + + ANNO + + + + NUMRD + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #103-#101 + + + + #103-#102 + + + + #F1.111-#103 + + + + + + + + + + + + + +
+
+ + + + + + + + + + MESSAGE ADD,F1.101 + + + + MESSAGE ADD,F1.102 + + + + MESSAGE ADD,F1.103 + + + + #103-#101 + + + + #103-#102 + + + + #H2.103-#103 + +
+
+ 0 #B1.100 ! +
+ USE 1000 + \ No newline at end of file