From f631dc637c7a0a61682e7020fbb00d5594363631 Mon Sep 17 00:00:00 2001 From: nik Date: Mon, 29 May 1995 16:03:19 +0000 Subject: [PATCH] Correzioni a mastrini e chiusure e bilanci git-svn-id: svn://10.65.10.50/trunk@1407 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg3100.cpp | 21 ++++---- cg/cg4600.cpp | 127 ++++++++++++++++++++++++++++++------------------- cg/cglib01.cpp | 4 +- 3 files changed, 90 insertions(+), 62 deletions(-) diff --git a/cg/cg3100.cpp b/cg/cg3100.cpp index 7b8a75e7f..9d83d9996 100755 --- a/cg/cg3100.cpp +++ b/cg/cg3100.cpp @@ -62,7 +62,6 @@ HIDDEN const char* err_msg[] = {"La data operazione non appartiene a nessun eser "Indicato codice C/F per allegato non presente in anagrafica", "Codice cliente/fornitore non presente in anagrafica"}; - class TListaMov_application : public TPrintapp { friend bool filter_func (const TRelation *); @@ -98,6 +97,7 @@ class TListaMov_application : public TPrintapp bool _settata_prima_riga, _causale_gia_stampata,_mov_di_sola_iva; int _cur1,_cur2,_cur2b,_cur3,_cur4,_decidi,_tipod,_controllo_mov_errati; int _numero_riga, _alleg, _tiporegistro, _tipocr, _scelta_stampa, _nr, _n; + int _provvis; liste _tipo_lista; word _flags; @@ -112,7 +112,7 @@ protected: public: - bool user_create() ; + bool user_create(); bool user_destroy(); bool segnala_errori_primariga(); bool segnala_errori_ogniriga(); @@ -825,7 +825,8 @@ void TListaMov_application::set_page(int file, int count) set_row (_n, "@103greg @3s",FLD(LF_MOV,MOV_REG)); set_row (_n, "@111gpr @5n",FLD(LF_MOV,MOV_PROTIVA)); } - else set_row (_n, "@103gMov.Provvisorio"); + else if (_provvis == 2 && (prov == 'P' || prov == 'N')) + set_row (_n, "@103gMov.Provvisorio"); if (ae != annoese) if (_annoes == 0) //se non indicato l'anno nella maschera set_row (_n, "@120gcomp @4n", FLD(LF_MOV,MOV_ANNOES)); @@ -876,7 +877,6 @@ void TListaMov_application::stampa_intestazione() bool TListaMov_application::preprocess_page(int file,int counter) { - TCursor* cur = current_cursor(); if (counter) return TRUE; @@ -2070,8 +2070,7 @@ bool TListaMov_application::set_print(int m) _data_ini = msk.get(F_DATAINI); _data_fin = msk.get(F_DATAFIN); _numreg_fin = atoi(msk.get(F_NUMEROFIN)); - //bool provvis = msk.get_bool(F_STAMPAMOVP); - int provvis = msk.get_int(F_STAMPAMOVP); + _provvis = msk.get_int(F_STAMPAMOVP); if (_decidi == 1) { select_cursor(_cur1); @@ -2080,11 +2079,11 @@ bool TListaMov_application::set_print(int m) _curr1->setfilter("(PROVVIS=\"\")"); else _curr1->setfilter(""); */ - if (provvis == 1) //normale + if (_provvis == 1) //normale _curr1->setfilter("(PROVVIS=\"\")"); - else if (provvis == 2) //globale + else if (_provvis == 2) //globale _curr1->setfilter(""); - else _curr1->setfilter("(PROVVIS!=\"\")"); //solo provvisori + else _curr1->setfilter("(PROVVIS!=\"\")"); //solo provvisori fl = &(current_cursor()->file(LF_MOV)); TRectype da (fl->curr()); TRectype a (fl->curr()); @@ -2106,9 +2105,9 @@ bool TListaMov_application::set_print(int m) else _curr2->setfilter(""); */ - if (provvis == 1) //normale + if (_provvis == 1) //normale _curr2->setfilter("(PROVVIS=\"\")"); - else if (provvis == 2) //globale + else if (_provvis == 2) //globale _curr2->setfilter(""); else _curr2->setfilter("(PROVVIS!=\"\")"); //solo provvisori fl = &(current_cursor()->file(LF_MOV)); diff --git a/cg/cg4600.cpp b/cg/cg4600.cpp index d671a7760..701fdb018 100755 --- a/cg/cg4600.cpp +++ b/cg/cg4600.cpp @@ -89,26 +89,38 @@ bool mask_datac (TMask_field& f, KEY k) TDate scarico = TabEs.get_date("D2"); TabEs.prev(); TDate iniziop = TabEs.get_date("D0"); - TDate finep = TabEs.get_date("D1"); - if (f.get() < finep) + TDate finep = TabEs.get_date("D1"); + TDate data = f.get(); + + TString istr = inizio.string(); + TString fstr = fine.string(); + + TString ipstr = iniziop.string(); + TString fpstr = finep.string(); + + TString scastr = scarico.string(); + + TString datastr = f.get(); + + if (data < finep) { f.warning_box ("La data di chiusura non puo' essere inferiore alla data di fine esercizio precedente"); return FALSE; } - if (f.get() > fine) + if (data > fine) { f.warning_box ("La data di chiusura non puo' essere superiore alla data di fine esercizio in corso"); return FALSE; } - if ( scarico.ok() && (f.get() <= scarico) ) + if ( scarico.ok() && (data <= scarico) ) { f.warning_box ("La data di chiusura non puo' essere inferiore o uguale alla data di scarico"); return FALSE; } - if ( (f.get() >= inizio) && (f.get() <= fine) ) //la data di chiusura e' cioe' relativa all'esercizio in corso + if ( (data >= inizio) && (data <= fine) ) //la data di chiusura e' cioe' relativa all'esercizio in corso anno = fine.year(); -else if ( (f.get() >= iniziop) && (f.get() <= finep) ) //la data di chiusura e' cioe' relativa all'esercizio precedente - anno = finep.year(); + else if ( (data >= iniziop) && (data <= finep) ) //la data di chiusura e' cioe' relativa all'esercizio precedente + anno = finep.year(); TabReg.zero(); annos = format ("%04d", anno); @@ -123,7 +135,7 @@ else if ( (f.get() >= iniziop) && (f.get() <= finep) ) //la data di chiusura e' if (tiporeg == 5) { TDate datast = TabReg.get_date("D3"); - if (f.get() < datast.string()) + if (data < datast.string()) { ok = FALSE; break; @@ -156,26 +168,38 @@ bool mask_dataap (TMask_field& f, KEY k) TabEs.prev(); TDate iniziop = TabEs.get_date("D0"); TDate finep = TabEs.get_date("D1"); - if (f.get() < inizio) + TDate data = f.get(); + + TString istr = inizio.string(); + TString fstr = fine.string(); + + TString ipstr = iniziop.string(); + TString fpstr = finep.string(); + + TString scastr = scarico.string(); + + TString datastr = f.get(); + + if (data < inizio) { f.warning_box ("La data di apertura non puo' essere inferiore alla data di inizio esercizio in corso"); return FALSE; } - if (f.get() > fine) + if (data > fine) { f.warning_box ("La data di apertura non puo' essere superiore alla data di fine esercizio in corso"); return FALSE; } - if ( scarico.ok() && (f.get() <= scarico) ) + if ( scarico.ok() && (data <= scarico) ) { f.warning_box ("La data di apertura non puo' essere inferiore o uguale alla data di scarico"); return FALSE; } - if ( (f.get() >= inizio) && (f.get() <= fine) ) //la data di apertura e' cioe' relativa all'esercizio in corso + if ( (data >= inizio) && (data <= fine) ) //la data di apertura e' cioe' relativa all'esercizio in corso anno = fine.year(); -else if( (f.get() >= iniziop) && (f.get() <= finep) ) //la data di apertura e' cioe' relativa all'esercizio precedente - anno = finep.year(); + else if( (data >= iniziop) && (data <= finep) ) //la data di apertura e' cioe' relativa all'esercizio precedente + anno = finep.year(); TabReg.zero(); annos = format ("%04d", anno); @@ -190,7 +214,7 @@ else if( (f.get() >= iniziop) && (f.get() <= finep) ) //la data di apertura e' c if (tiporeg == 5) { TDate datast = TabReg.get_date("D3"); - if (f.get() < datast) + if (data < datast) { ok = FALSE; break; @@ -547,41 +571,44 @@ void CG4600_application::rmov_proper(int anno,long numrig,TDate& datareg,TRectyp char sezione = ' '; real totale = tot_saldo; - rmov.zero(); - rmov.put(RMV_ANNOES, anno); - rmov.put(RMV_NUMREG, _numreg); - rmov.put(RMV_NUMRIG, numrig); - rmov.put(RMV_DATAREG, datareg); - rmov.put(RMV_GRUPPO, tc.gruppo()); - rmov.put(RMV_CONTO, tc.conto()); - rmov.put(RMV_SOTTOCONTO, tc.sottoconto()); - - if (totale > ZERO) - { - sez_rmov = 'A'; - sezione = 'D'; - } - else - if (totale < ZERO) - { - sez_rmov = 'D'; - sezione = 'A'; - totale = -totale; - } - - if (sezione_opposta) + if (totale != ZERO) { - rmov.put(RMV_SEZIONE, sez_rmov); - _sld->aggiorna(tc,TImporto(sez_rmov,totale)); //Aggiorno anche i saldi con - // l'oggetto TSaldo_agg + rmov.zero(); + rmov.put(RMV_ANNOES, anno); + rmov.put(RMV_NUMREG, _numreg); + rmov.put(RMV_NUMRIG, numrig); + rmov.put(RMV_DATAREG, datareg); + rmov.put(RMV_GRUPPO, tc.gruppo()); + rmov.put(RMV_CONTO, tc.conto()); + rmov.put(RMV_SOTTOCONTO, tc.sottoconto()); + + if (totale > ZERO) + { + sez_rmov = 'A'; + sezione = 'D'; + } + else + if (totale < ZERO) + { + sez_rmov = 'D'; + sezione = 'A'; + totale = -totale; + } + + if (sezione_opposta) + { + rmov.put(RMV_SEZIONE, sez_rmov); + _sld->aggiorna(tc,TImporto(sez_rmov,totale)); //Aggiorno anche i saldi con + // l'oggetto TSaldo_agg + } + else + { + rmov.put(RMV_SEZIONE, sezione); + _sld->aggiorna(tc,TImporto(sezione,totale)); //Aggiorno anche i saldi con + //l'oggetto TSaldo_agg + } + rmov.put(RMV_IMPORTO, totale); } -else -{ - rmov.put(RMV_SEZIONE, sezione); - _sld->aggiorna(tc,TImporto(sezione,totale)); //Aggiorno anche i saldi con - //l'oggetto TSaldo_agg -} -rmov.put(RMV_IMPORTO, totale); } void CG4600_application::costi() @@ -1040,7 +1067,9 @@ void CG4600_application::chiudi_attivita() //sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil); sale.ultima_immissione_bilancio(_annoesch,g,c,s,indbil, 1); _saldo = sale.saldo(); - + + TString sldstr = _saldo.string(); + if (_saldo == ZERO) continue; if (j >= MAX || _saldi->eof()) diff --git a/cg/cglib01.cpp b/cg/cglib01.cpp index fb0ed4afb..c3901ec6e 100755 --- a/cg/cglib01.cpp +++ b/cg/cglib01.cpp @@ -338,10 +338,10 @@ bool TSaldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDat // continue; // Modifica del 03-03-1995 - TCaus cau(_codcaus); + TCaus cau(_codcaus); if (_codcaus.not_empty()) - if (cau.chiusura() || cau.apertura()) + if (cau.chiusura()) //|| cau.apertura()) continue; /*