Patch level :4.0 564
Files correlati :cg7.exe Ricompilazione Demo : [ ] Commento :corretta esportazione pagamenti come da segnalazioni enrichetta git-svn-id: svn://10.65.10.50/trunk@14610 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4bdbd2c7c5
commit
58edc77986
@ -1,28 +1,15 @@
|
|||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <assoc.h>
|
|
||||||
#include <automask.h>
|
|
||||||
#include <currency.h>
|
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <filetext.h>
|
#include <filetext.h>
|
||||||
#include <msksheet.h>
|
|
||||||
#include <printer.h>
|
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <recarray.h>
|
#include <recarray.h>
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#include <relation.h>
|
|
||||||
#include <sort.h>
|
|
||||||
#include <utility.h>
|
|
||||||
|
|
||||||
#include "cg7.h"
|
#include "cg7.h"
|
||||||
#include "cg7200a.h"
|
#include "cg7200a.h"
|
||||||
#include "cglib01.h"
|
|
||||||
#include "cg2101.h"
|
#include "cg2101.h"
|
||||||
#include "cg2103.h"
|
#include "cg2103.h"
|
||||||
#include "cgsaldac.h"
|
|
||||||
|
|
||||||
#include <mov.h>
|
|
||||||
#include <rmov.h>
|
|
||||||
#include <rmoviva.h>
|
|
||||||
#include <pagsca.h>
|
#include <pagsca.h>
|
||||||
#include <partite.h>
|
#include <partite.h>
|
||||||
|
|
||||||
@ -30,6 +17,10 @@
|
|||||||
#include "../ca/movana.h"
|
#include "../ca/movana.h"
|
||||||
#include "../ca/rmovana.h"
|
#include "../ca/rmovana.h"
|
||||||
|
|
||||||
|
#include <doc.h>
|
||||||
|
#include <rdoc.h>
|
||||||
|
|
||||||
|
|
||||||
class TInvioP_file: public TFile_text
|
class TInvioP_file: public TFile_text
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -292,6 +283,7 @@ protected:
|
|||||||
real calcola_pagamento(TRectype& curpag_rec);
|
real calcola_pagamento(TRectype& curpag_rec);
|
||||||
bool sottrai_iva(TMovimentoPN& pn, const TRectype& rigaiva);
|
bool sottrai_iva(TMovimentoPN& pn, const TRectype& rigaiva);
|
||||||
void stringa_grcosot(TRecord_text& recrighe, const TString& zio);
|
void stringa_grcosot(TRecord_text& recrighe, const TString& zio);
|
||||||
|
long calcola_fattura_originale(long nreg) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const real get_importo() {return _importo;};
|
const real get_importo() {return _importo;};
|
||||||
@ -947,6 +939,9 @@ real TInvioP::calcola_pagamento(TRectype& curpag_rec)
|
|||||||
//dichiariamo una serie di simpatici real utilizzati in seguito
|
//dichiariamo una serie di simpatici real utilizzati in seguito
|
||||||
real totdoc,imponibile,imposta;
|
real totdoc,imponibile,imposta;
|
||||||
|
|
||||||
|
const real ritfis = pn.curr().get_real(MOV_RITFIS);
|
||||||
|
totpagato += ritfis;
|
||||||
|
|
||||||
//Le ritenute sociali invece vanno testate con la test_swap..
|
//Le ritenute sociali invece vanno testate con la test_swap..
|
||||||
const real ritsoc = curpag_rec.get_real(PAGSCA_RITSOC);
|
const real ritsoc = curpag_rec.get_real(PAGSCA_RITSOC);
|
||||||
|
|
||||||
@ -1027,6 +1022,47 @@ real TInvioP::calcola_pagamento(TRectype& curpag_rec)
|
|||||||
return totpagato;
|
return totpagato;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long TInvioP::calcola_fattura_originale(long nreg) const
|
||||||
|
{
|
||||||
|
//prende il movimento del pagamento
|
||||||
|
const TRectype& mov = cache().get(LF_MOV, nreg);
|
||||||
|
|
||||||
|
TToken_string key;
|
||||||
|
key.add(mov.get(MOV_DCODNUM));
|
||||||
|
key.add(mov.get(MOV_DANNO));
|
||||||
|
key.add(mov.get(MOV_DPROVV));
|
||||||
|
key.add(mov.get(MOV_DNDOC));
|
||||||
|
//crea il documento da cui deriva tale movimento (per il CSA e' in genere una fattura)
|
||||||
|
|
||||||
|
TRecord_array doc(key, LF_RIGHEDOC);
|
||||||
|
for (int i = 1; i <= doc.rows(); i++)
|
||||||
|
{
|
||||||
|
const TRectype& rdoc = doc.row(i);
|
||||||
|
const TString& dacodnum = rdoc.get(RDOC_DACODNUM);
|
||||||
|
if (dacodnum.full())
|
||||||
|
{
|
||||||
|
const TRectype& num_rec = cache().get("%NUM", dacodnum);
|
||||||
|
if (num_rec.get_bool("B3"))
|
||||||
|
{
|
||||||
|
key = rdoc.get(RDOC_DAPROVV);
|
||||||
|
key.add(rdoc.get(RDOC_DAANNO));
|
||||||
|
key.add(dacodnum);
|
||||||
|
key.add(rdoc.get(RDOC_DANDOC));
|
||||||
|
//cerca da quale documento deriva la fattura (la prima riga che trova e' ok)
|
||||||
|
const TRectype& original_doc = cache().get(LF_DOC, key);
|
||||||
|
//se trova il documento origine (per il CSA e' in genere una FDR) -> prende il suo nreg..
|
||||||
|
//..come nreg da ritornare (attenzione che se il doc originale non e' stato contabilizzato..
|
||||||
|
//..nreg diventa 0!)
|
||||||
|
if (!original_doc.empty())
|
||||||
|
nreg = original_doc.get_long(DOC_NUMREG);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nreg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TInvioP::i_proforma_pagamenti()
|
bool TInvioP::i_proforma_pagamenti()
|
||||||
{
|
{
|
||||||
TInvioP_file* trasfilepag = apri_file("pagament");
|
TInvioP_file* trasfilepag = apri_file("pagament");
|
||||||
@ -1065,17 +1101,17 @@ bool TInvioP::i_proforma_pagamenti()
|
|||||||
{
|
{
|
||||||
TRelation relpart(LF_PARTITE);
|
TRelation relpart(LF_PARTITE);
|
||||||
TRectype da(LF_PARTITE);
|
TRectype da(LF_PARTITE);
|
||||||
da.put(PART_NREG, cur.curr().get(MOV_NUMREG));
|
da.put(PART_NREG, cur_rec.get(MOV_NUMREG));
|
||||||
TCursor curpart(&relpart, "", 2, &da, &da);
|
TCursor curpart(&relpart, "", 2, &da, &da);
|
||||||
const long curpart_items = curpart.items();
|
const long curpart_items = curpart.items();
|
||||||
if (curpart_items != 0)
|
if (curpart_items != 0)
|
||||||
{
|
{
|
||||||
curpart.freeze();
|
curpart.freeze();
|
||||||
TRectype& curpart_rec = curpart.curr();
|
TRectype& curpart_rec = curpart.curr();
|
||||||
for (curpart = 0; curpart.pos() < curpart_items; ++(curpart))
|
|
||||||
{
|
|
||||||
TRelation relpag(LF_PAGSCA);
|
TRelation relpag(LF_PAGSCA);
|
||||||
TRectype da(LF_PAGSCA);
|
TRectype da(LF_PAGSCA);
|
||||||
|
for (curpart = 0; curpart.pos() < curpart_items; ++(curpart))
|
||||||
|
{
|
||||||
da.put(PAGSCA_TIPOC, curpart_rec.get(PART_TIPOCF));
|
da.put(PAGSCA_TIPOC, curpart_rec.get(PART_TIPOCF));
|
||||||
da.put(PAGSCA_GRUPPO, curpart_rec.get(PART_GRUPPO));
|
da.put(PAGSCA_GRUPPO, curpart_rec.get(PART_GRUPPO));
|
||||||
da.put(PAGSCA_CONTO, curpart_rec.get(PART_CONTO));
|
da.put(PAGSCA_CONTO, curpart_rec.get(PART_CONTO));
|
||||||
@ -1117,11 +1153,12 @@ bool TInvioP::i_proforma_pagamenti()
|
|||||||
keypart.add(curpart_rec.get(PART_CONTO));
|
keypart.add(curpart_rec.get(PART_CONTO));
|
||||||
keypart.add(curpart_rec.get(PART_SOTTOCONTO));
|
keypart.add(curpart_rec.get(PART_SOTTOCONTO));
|
||||||
keypart.add(pagame.get_hashobj()->key());
|
keypart.add(pagame.get_hashobj()->key());
|
||||||
const TRectype& partita = cache().get(LF_PARTITE, keypart);
|
const TRectype& fattura = cache().get(LF_PARTITE, keypart);
|
||||||
_nregpag = cur.curr().get_long(MOV_NUMREG);
|
_nregpag = cur_rec.get_long(MOV_NUMREG);
|
||||||
_nregcosto = partita.get_long(PART_NREG);
|
//deve cercare la prima registrazione da cui deriva il pagamento..
|
||||||
|
_nregcosto = calcola_fattura_originale(fattura.get_long(PART_NREG));
|
||||||
_importo = *cp;
|
_importo = *cp;
|
||||||
_chiusa = partita.get_bool(PART_CHIUSA);
|
_chiusa = fattura.get_bool(PART_CHIUSA);
|
||||||
TRecord_text recpag;
|
TRecord_text recpag;
|
||||||
recpag.set_type("G");
|
recpag.set_type("G");
|
||||||
trasfilepag->autoload(recpag, curpag);
|
trasfilepag->autoload(recpag, curpag);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user