From 8932c11b051c41b9bd8aa5237cf5a2702808eafa Mon Sep 17 00:00:00 2001 From: luca Date: Thu, 14 Jul 2005 17:47:24 +0000 Subject: [PATCH] Patch level :2.2 nopatch Files correlati : Ricompilazione Demo : [ ] Commento :stampa rendiconto: comincia a stampare qualcosa di giusto (senza esagerare) git-svn-id: svn://10.65.10.50/trunk@13275 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ca/ca3700.cpp | 78 ++++++++++++-------- ca/ca3700a.rep | 197 +++++++++++++++---------------------------------- 2 files changed, 107 insertions(+), 168 deletions(-) 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 @@ - Rendiconto + Rendiconto CA
@@ -48,183 +48,106 @@ MESSAGE RESET,F1.102
- CODCONTO + CONTO - MESSAGE RESET,F2.101 -MESSAGE RESET,F2.102 -MESSAGE RESET,F2.201 -MESSAGE RESET,F2.202 - - + - - - - CODCONTO + CONTO CA_FORMAT_CONTO - + - MESSAGE ISAMREAD,PCONANA,CODCONTO=CODCONTO,DESCR + MESSAGE ISAMREAD,PCONANA,CODCONTO=CONTO,DESCR - - - - - - - - - - - - - SALDOINI:DARE - MESSAGE COPY,B1.103 - - - - SALDOINI:AVERE - #THIS @ -DUP -0 E; IF - -1 * - "B1.103" +! -ELSE - DROP -THEN - -
-
- DATACOMP + + + + + + + + + + + + + + +
- + + CODNUM + + + ANNO + + + NUMRD + + DATACOMP - MESSAGE COPY,F3.131 - - NUMREG + + NUMDOCRIF - - - NUMRIG + + DATADOCRIF - - DESCR + + DESC - - MOVANA.DATADOC + + NRIGA - - MOVANA.NUMDOC + + DESCRIGA - - MOVANA.CODCAUS + + DANDOC - - MESSAGE ISAMREAD,CAUS,CODCAUS=MOVANA.CODCAUS,DESCR + + FATTURATO - - IMPORTO - "RMOVANA.SEZIONE" @ -"A" = -IF -0 #THIS ! -ELSE -#THIS @ -"B1.103" -+! -THEN - - - MESSAGE ADD,F2.101 - + + MATURATO - - IMPORTO - "RMOVANA.SEZIONE" @ -"D" = -IF -0 #THIS ! -ELSE -#THIS @ --1 * -"B1.103" -+! -THEN - - MESSAGE ADD,F2.102 - - - - MESSAGE COPY,F3.103 + + IMPEGNATO
- + - + - + - + - + + + + #101+#H2.201 - + #102+#H2.202 - + #201-#202
-
- - - - - - -
- USE RMOVANA KEY 2 -JOIN MOVANA INTO NUMREG==NUMREG - : 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 -; - - + USE 1000 \ No newline at end of file