diff --git a/ca/ca3700.cpp b/ca/ca3700.cpp index dbff84f42..61da6d1ef 100755 --- a/ca/ca3700.cpp +++ b/ca/ca3700.cpp @@ -254,7 +254,7 @@ public: virtual void set_filter(const TPrint_rendiconto_ca_mask& msk, int cms_row); TPrint_rendiconto_ca_recordset(const TString& sql) : TISAM_recordset(sql) { _tmp = NULL;} - ~TPrint_rendiconto_ca_recordset() { delete _tmp; } + ~TPrint_rendiconto_ca_recordset() {} }; @@ -311,12 +311,16 @@ bool TPrint_rendiconto_ca_recordset::mov_filter(const TRelation* rel) void TPrint_rendiconto_ca_recordset::set_custom_filter(TCursor& cur) const { - //filtro sui conti selezionati sulla maschera - TRectype darec(cur.curr()), arec(cur.curr()); - darec.put(RMOVANA_CODCONTO, _daconto); - darec.put(RMOVANA_DATACOMP, _dadata); - arec.put(RMOVANA_CODCONTO, _aconto); - arec.put(RMOVANA_DATACOMP, _adata); + //crea un file temporaneo che non viene distrutto ad inizio stampa effettiva +// TExternisamfile* tmp = new TExternisamfile(dbf, trr); + relation()->replace(_tmp); //sostituisce il vero file rmovana con quello temporaneo + + //filtro sul file esterno (_tmp, cio� 1000) sui conti selezionati sulla maschera + TRectype darec(cur.curr()), arec(cur.curr()); //curr perch� � il file externisamfile + darec.put("CONTO", _daconto); + darec.put("DATA", _dadata); + arec.put("CONTO", _aconto); + arec.put("DATA", _adata); cur.setregion(darec, arec); myself = this; @@ -408,9 +412,10 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons { //scegli i campi da mettere _tmp->curr().put("CONTO", rmovana.get(RMOVANA_CODCONTO)); //conto + _tmp->curr().put("ANNO", movana.get(MOVANA_ANNOES)); //anno _tmp->curr().put("CODNUM", movana.get(MOVANA_DCODNUM)); //codnum del documento che origina il movana _tmp->curr().put("DATA", movana.get(MOVANA_DATAREG)); //data del movana - _tmp->curr().put("NUMREG", movana.get(MOVANA_NUMREG)); + _tmp->curr().put("NUMRD", movana.get(MOVANA_NUMREG)); _tmp->curr().put("NUMDOCRIF", movana.get(MOVANA_DNDOC)); _tmp->curr().put("DATADOCRIF", movana.get(MOVANA_DATADOC)); _tmp->curr().put("DESC", movana.get(MOVANA_DESCR)); //??veramente non si sa?? @@ -441,14 +446,27 @@ void TPrint_rendiconto_ca_recordset::crea_righe_rmovana() //i parametri del filtro sulla maschera TRectype da_rmovana(LF_RMOVANA); da_rmovana.put(RMOVANA_CODCONTO, _daconto); - da_rmovana.put(RMOVANA_DATACOMP, _dadata); TRectype a_rmovana(LF_RMOVANA); a_rmovana.put(RMOVANA_CODCONTO, _aconto); - a_rmovana.put(RMOVANA_DATACOMP, _adata); TString filtro; + + if (_dadata.ok()) + filtro << "(ANSI(DATACOMP)>=" << _dadata.date2ansi() << ")"; + if (_adata.ok()) + { + if (filtro.not_empty()) + filtro << "&&"; + + filtro << "(ANSI(DATACOMP)<=" << _adata.date2ansi() << ")"; + } + if (_codcosto.not_empty()) + { + if (filtro.not_empty()) + filtro << "&&"; filtro << "(" << RMOVANA_CODCCOSTO << "==\"" << _codcosto << "\")"; + } if (_codcms.not_empty()) { if (filtro.not_empty()) @@ -529,7 +547,9 @@ void TPrint_rendiconto_ca_recordset::crea_righe_rdoc(const TPrint_rendiconto_ca_ TString filtro = filtro_date; if (filtro.not_empty()) filtro << "&&"; - filtro << "(CODNUM==" << codnum << ")"; + filtro << "(CODNUM==\"" << codnum << "\")"; + filtro << "&&(PROVV==\"" << "D" << "\")"; + TCursor cur_doc(&rel_doc, filtro, 1, &dadoc, &adoc); const long doc_items = cur_doc.items(); @@ -540,8 +560,10 @@ void TPrint_rendiconto_ca_recordset::crea_righe_rdoc(const TPrint_rendiconto_ca_ TDocumento doc(cur_doc.curr()); TAnal_mov mov; cont_anal.elabora(doc, 0, NULL, false, mov); - for (int i = 1; i <= mov.rows(); i++) - salva_rmovana(mov.body()[i], mov); + for (int j = 1; j <= mov.rows(); j++) + { + salva_rmovana(mov.body()[j], mov); + } } } @@ -553,11 +575,12 @@ void TPrint_rendiconto_ca_recordset::crea_trr(const TFilename& trr) const { ofstream of(trr); of << 1000 << endl; - of << 13 << endl; + of << 14 << endl; of << "CONTO|1|20|0|Conto analitico" << endl; + of << "ANNO|9|4|0|Anno" << endl; of << "CODNUM|1|4|0|Numerazione documento" << endl; of << "DATA|5|8|0|Data movimento o documento" << endl; - of << "NUMREG|3|7|0|Numero registrazione o documento" << endl; + of << "NUMRD|3|7|0|Numero registrazione o documento" << endl; of << "NUMDOCRIF|1|7|0|Numero documento riferimento" << endl; of << "DATADOCRIF|5|8|0|Data documento riferimento" << endl; of << "DESC|1|50|0|Descrizione movimento o documento" << endl; @@ -568,15 +591,16 @@ void TPrint_rendiconto_ca_recordset::crea_trr(const TFilename& trr) const of << "MATURATO|4|18|5|Maturato" << endl; of << "IMPEGNATO|4|18|5|Impegnato" << endl; of << 1 << endl; - of << "CONTO+CODNUM+DATA+NUMREG" << endl; + of << "CONTO+CODNUM+DATA+NUMRD" << endl; } void TPrint_rendiconto_ca_recordset::set_filter(const TPrint_rendiconto_ca_mask& msk, int cms_row) { //se esiste il file temporano con tracciato persomalizzato lo cancella e lo ricrea vuoto - TFilename trr; - trr.temp("rendy"); - TFilename dbf(trr); + TFilename trr; //file tracciato record + trr.tempdir(); + trr.add("rendy"); + TFilename dbf(trr); //file dati trr.ext("trr"); dbf.ext("dbf"); @@ -646,20 +670,12 @@ bool TPrint_rendiconto_ca_rep::set_recordset(const TString& sql) void TPrint_rendiconto_ca_rep::set_filter(const TPrint_rendiconto_ca_mask& msk, int cms_row) { - const int tipoconti = 1; //stronzata per poter compilare inizialmente - TPrint_rendiconto_ca_recordset* recset = NULL; - const char* query ="USE RMOVANA KEY 2\nJOIN MOVANA INTO NUMREG==NUMREG"; - switch (tipoconti) - { - case 1: - recset = new TPrint_rendiconto_ca_recordset(query); - break; - default: - recset = new TPrint_rendiconto_ca_recordset(query); - break; - } + const char* query ="USE 1000\nJOIN MOVANA INTO NUMREG==NUMRD\nJOIN RMOVANA INTO NUMREG==NUMRD NUMRIG==NRIGA"; //\nJOIN DOC INTO PROVV=='D' ANNO==ANNO CODNUM==CODNUM"; + + recset = new TPrint_rendiconto_ca_recordset(query); + recset->set_filter(msk, cms_row); TAnal_report::set_recordset(recset); } diff --git a/ca/ca3700a.rep b/ca/ca3700a.rep index 0cee84872..90e4fc282 100755 --- a/ca/ca3700a.rep +++ b/ca/ca3700a.rep @@ -1,6 +1,6 @@ <report libraries="ve1300" name="ca3700a" lpi="8" class="ca3700a"> - <description>Rendiconto</description> + <description>Rendiconto CA</description> <font face="Courier New" size="8" /> <section type="Head" height="6.5"> <font italic="1" face="Courier New" bold="1" size="8" /> @@ -48,183 +48,106 @@ MESSAGE RESET,F1.102</prescript> </field> </section> <section repeat="1" type="Head" level="2" height="4.5"> - <groupby>CODCONTO</groupby> + <groupby>CONTO</groupby> <font italic="1" face="Courier New" size="8" /> - <prescript description="H2 PRESCRIPT">MESSAGE RESET,F2.101 -MESSAGE RESET,F2.102 -MESSAGE RESET,F2.201 -MESSAGE RESET,F2.202 -</prescript> - <field type="Testo" width="6" pattern="1" text="Conto:"> + <field x="1" type="Stringa" bg_color="#C0C0C0" width="23"> <font italic="1" face="Courier New" bold="1" size="8" /> - </field> - <field x="7" type="Stringa" width="23" pattern="1"> - <font italic="1" face="Courier New" bold="1" size="8" /> - <source>CODCONTO</source> + <source>CONTO</source> <prescript description="H2.0 PRESCRIPT">CA_FORMAT_CONTO</prescript> </field> - <field x="31" type="Stringa" width="50" pattern="1"> + <field x="24" type="Stringa" bg_color="#C0C0C0" width="50"> <font italic="1" face="Courier New" bold="1" size="8" /> - <prescript description="H2.0 PRESCRIPT">MESSAGE ISAMREAD,PCONANA,CODCONTO=CODCONTO,DESCR</prescript> + <prescript description="H2.0 PRESCRIPT">MESSAGE ISAMREAD,PCONANA,CODCONTO=CONTO,DESCR</prescript> </field> - <field x="13" y="1.5" type="Testo" align="center" width="11" pattern="1" text="N.Reg.F;Riga" /> - <field x="25" y="1.5" type="Testo" width="11" pattern="1" text="Descrizione" /> - <field x="52" y="1.5" type="Testo" width="10" pattern="1" text="Data Doc." /> - <field x="64" y="1.5" type="Testo" width="6" pattern="1" text="N.Doc." /> - <field x="73" y="1.5" type="Testo" width="7" pattern="1" text="Causale" /> - <field x="115" y="1.5" type="Testo" align="right" width="4" pattern="1" text="Dare" /> - <field x="130" y="1.5" type="Testo" align="right" width="5" pattern="1" text="Avere" /> - <field x="138" y="1.5" type="Testo" align="right" width="14" pattern="1" text="Saldo" /> - <field border="1" x="1" y="2.5" type="Linea" width="168" height="0" pattern="1" /> - <field x="80" y="3" type="Testo" width="25" pattern="1" text="Progressivo precedente" /> - <field x="1" y="1.5" type="Testo" align="center" width="10" id="121" pattern="1" text="Data" /> - <field x="104" y="3" type="Valuta" align="right" width="15" id="201" pattern="1" hide_zero="1" text="###.###.###,@@"> - <source>SALDOINI:DARE</source> - <postscript description="H2.201 POSTSCRIPT">MESSAGE COPY,B1.103 -</postscript> - </field> - <field x="120" y="3" type="Valuta" align="right" width="15" id="202" pattern="1" hide_zero="1" text="###.###.###,@@"> - <source>SALDOINI:AVERE</source> - <prescript description="H2.202 PRESCRIPT">#THIS @ -DUP -0 E; IF - -1 * - "B1.103" +! -ELSE - DROP -THEN</prescript> - </field> - </section> - <section type="Head" level="3"> - <groupby>DATACOMP</groupby> + <field x="30.5" y="1.5" type="Testo" width="20" pattern="1" text="Doc. clienteF;fornitore" /> + <field x="107" y="1.5" type="Testo" align="center" width="12" pattern="1" text="Riferimento" /> + <field x="120" y="1.5" type="Testo" width="20" pattern="1" text="Avanzamento costiF;ricavi" /> + <field x="20" y="2.5" type="Testo" align="center" width="10" pattern="1" text="Data" /> + <field x="30.5" y="2.5" type="Testo" align="center" width="6" pattern="1" text="Numero" /> + <field x="40" y="2.5" type="Testo" align="center" width="10" pattern="1" text="Data" /> + <field x="51" y="2.5" type="Testo" width="25" pattern="1" text="Descrizione testata" /> + <field x="78" y="2.5" type="Testo" width="4" pattern="1" text="Riga" /> + <field x="83" y="2.5" type="Testo" width="15" pattern="1" text="Descrizione riga" /> + <field x="107" y="2.5" type="Testo" align="center" width="12" pattern="1" text="OrdineF;Bolla" /> + <field x="120" y="2.5" type="Testo" align="right" width="15" pattern="1" text="Fatturato" /> + <field x="136" y="2.5" type="Testo" align="right" width="15" pattern="1" text="Maturato" /> + <field x="152" y="2.5" type="Testo" align="right" width="15" pattern="1" text="Impegnato" /> + <field border="1" x="1" y="3.5" type="Linea" width="168" height="0" pattern="1" /> + <field x="1" y="2.5" type="Testo" width="11" id="121" pattern="1" text="Rif.Contabile" /> </section> <section type="Body" /> <section type="Body" level="1"> - <field x="1" type="Data" width="11" pattern="1"> + <field x="1" type="Stringa" align="right" width="4" pattern="1"> + <source>CODNUM</source> + </field> + <field x="6" type="Numero" align="right" width="4" pattern="1"> + <source>ANNO</source> + </field> + <field x="11" type="Numero" align="right" width="7" pattern="1"> + <source>NUMRD</source> + </field> + <field x="20" type="Data" width="10" pattern="1"> <source>DATACOMP</source> - <postscript description="B1.0 POSTSCRIPT">MESSAGE COPY,F3.131</postscript> </field> - <field x="13" type="Numero" align="right" width="7" pattern="1"> - <source>NUMREG</source> + <field x="31" type="Stringa" width="7" pattern="1"> + <source>NUMDOCRIF</source> </field> - <field x="20" type="Testo" width="1" pattern="1" text="F;" /> - <field x="21" type="Numero" align="right" width="3" pattern="1"> - <source>NUMRIG</source> + <field x="40" type="Data" width="10" pattern="1"> + <source>DATADOCRIF</source> </field> - <field x="25" type="Stringa" dynamic_height="1" width="25" height="2" pattern="1"> - <source>DESCR</source> + <field x="51" type="Stringa" dynamic_height="1" width="25" height="2" pattern="1"> + <source>DESC</source> </field> - <field x="52" type="Data" width="11" pattern="1"> - <source>MOVANA.DATADOC</source> + <field x="78" type="Numero" align="right" width="3" pattern="1"> + <source>NRIGA</source> </field> - <field x="64" type="Stringa" width="7" pattern="1"> - <source>MOVANA.NUMDOC</source> + <field x="82" type="Stringa" dynamic_height="1" width="25" height="2" pattern="1"> + <source>DESCRIGA</source> </field> - <field x="73" type="Stringa" width="3" pattern="1"> - <source>MOVANA.CODCAUS</source> + <field x="110" type="Numero" align="right" width="7" pattern="1"> + <source>DANDOC</source> </field> - <field x="77" type="Stringa" dynamic_height="1" width="25" height="2" pattern="1"> - <prescript description="B1.0 PRESCRIPT">MESSAGE ISAMREAD,CAUS,CODCAUS=MOVANA.CODCAUS,DESCR</prescript> + <field x="120" type="Valuta" align="right" width="15" pattern="1" hide_zero="1" text="###.###.###,@@"> + <source>FATTURATO</source> </field> - <field x="104" type="Valuta" align="right" width="15" id="101" pattern="1" hide_zero="1" text="###.###.###,@@"> - <source>IMPORTO</source> - <prescript description="B1.101 PRESCRIPT">"RMOVANA.SEZIONE" @ -"A" = -IF -0 #THIS ! -ELSE -#THIS @ -"B1.103" -+! -THEN - -</prescript> - <postscript description="B1.101 POSTSCRIPT">MESSAGE ADD,F2.101 -</postscript> + <field x="136" type="Valuta" align="right" width="15" pattern="1" hide_zero="1" text="###.###.###,@@"> + <source>MATURATO</source> </field> - <field x="120" type="Valuta" align="right" width="15" id="102" pattern="1" hide_zero="1" text="###.###.###,@@"> - <source>IMPORTO</source> - <prescript description="B1.102 PRESCRIPT">"RMOVANA.SEZIONE" @ -"D" = -IF -0 #THIS ! -ELSE -#THIS @ --1 * -"B1.103" -+! -THEN -</prescript> - <postscript description="B1.102 POSTSCRIPT">MESSAGE ADD,F2.102 -</postscript> - </field> - <field x="137" type="Valuta" align="right" width="15" id="103" pattern="1" hide_zero="1" text="###.###.###,@@"> - <postscript description="B1.103 POSTSCRIPT">MESSAGE COPY,F3.103</postscript> + <field x="152" type="Valuta" align="right" width="15" pattern="1" hide_zero="1" text="###.###.###,@@"> + <source>IMPEGNATO</source> </field> </section> <section type="Foot" /> <section type="Foot" level="1" /> <section type="Foot" level="2" height="4"> <field border="1" x="1" y="0.5" type="Linea" width="168" height="0" pattern="1" /> - <field x="82" y="1" type="Testo" width="22" pattern="1" text="Totali periodo:"> + <field x="85" y="1" type="Testo" width="35" pattern="1" text="Totale fatturato, maturato, impegnato E;E;E;"> <font face="Courier New" bold="1" size="8" /> </field> - <field x="82" y="2.5" type="Testo" width="22" pattern="1" text="Totali progressivi:"> + <field x="85" y="2.5" type="Testo" width="35" pattern="1" text="Da fatturare, maturare, impegnare E;E;E;"> <font face="Courier New" bold="1" size="8" /> </field> - <field x="104" y="1" type="Valuta" align="right" width="15" id="101" pattern="1" text="###.###.###,@@"> + <field x="120" y="1" type="Valuta" align="right" width="15" id="101" pattern="1" text="###.###.###,@@"> <font face="Courier New" bold="1" size="8" /> </field> - <field x="120" y="1" type="Valuta" align="right" width="15" id="102" pattern="1" text="###.###.###,@@"> + <field x="136" y="1" type="Valuta" align="right" width="15" id="102" pattern="1" text="###.###.###,@@"> <font face="Courier New" bold="1" size="8" /> </field> - <field x="104" y="2.5" type="Valuta" align="right" width="15" id="201" pattern="1" text="###.###.###,@@"> + <field x="152" y="1" type="Valuta" align="right" width="15" id="103" pattern="1" text="###.###.###,@@"> + <font face="Courier New" bold="1" size="8" /> + </field> + <field x="120" y="2.5" type="Valuta" align="right" width="15" id="201" pattern="1" text="###.###.###,@@"> <font face="Courier New" bold="1" size="8" /> <source>#101+#H2.201</source> </field> - <field x="120" y="2.5" type="Valuta" align="right" width="15" id="202" pattern="1" text="###.###.###,@@"> + <field x="136" y="2.5" type="Valuta" align="right" width="15" id="202" pattern="1" text="###.###.###,@@"> <font face="Courier New" bold="1" size="8" /> <source>#102+#H2.202</source> </field> - <field x="137" y="2.5" type="Valuta" align="right" width="15" id="203" pattern="1" text="###.###.###,@@"> + <field x="152" y="2.5" type="Valuta" align="right" width="15" id="203" pattern="1" text="###.###.###,@@"> <font face="Courier New" bold="1" size="8" /> <source>#201-#202</source> </field> </section> - <section type="Foot" level="3" height="2.5"> - <font italic="1" face="Courier New" size="8" /> - <field x="154" y="0.5" type="Testo" width="2" pattern="1" text="al" /> - <field x="137" y="0.5" type="Valuta" align="right" width="15" id="103" pattern="1" hide_zero="1" text="###.###.###,@@"> - <font italic="1" face="Courier New" bold="1" size="8" /> - </field> - <field x="157" y="0.5" type="Data" width="11" id="131" pattern="1" /> - </section> - <sql>USE RMOVANA KEY 2 -JOIN MOVANA INTO NUMREG==NUMREG</sql> - <prescript description="PRESCRIPT">: SCAMBIA_CAMPI ( F1 F2 -- ) - VARIABLE _X1 \ coordinate del campo F1 - VARIABLE _Y1 - VARIABLE _X2 \ coordinate del campo F2 - VARIABLE _Y2 - - 2DUP \ duplica i campi F1 F2 sullo stack - GET_POS \ prende le coordinate del campo F2 - _Y2 ! \ e le mette in _Y2 e _X2 - _X2 ! - GET_POS \ prende le coordinate del campo F1 - _Y1 ! \ e le mette in _Y1 e _X1 - _X1 ! - - _X1 @ \ legge le coordinate di F1 - _Y1 @ - ROT - SET_POS \ mette le coord in F2 - - _X2 @ - _Y2 @ - ROT - SET_POS -; - -</prescript> + <sql>USE 1000</sql> </report> \ No newline at end of file