Patch level :4.0 436
Files correlati :cg7.exe Ricompilazione Demo : [ ] Commento :trasferimento proforma: aggiunti movimenti senza scadenziario. Funzioneranno? git-svn-id: svn://10.65.10.50/trunk@14107 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5e3b6ede2b
commit
97a328dcd6
100
cg/cg7200.cpp
100
cg/cg7200.cpp
@ -8,6 +8,7 @@
|
|||||||
#include <printer.h>
|
#include <printer.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <recarray.h>
|
#include <recarray.h>
|
||||||
|
#include <recset.h>
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <sort.h>
|
#include <sort.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
@ -267,7 +268,7 @@ class TInvioP : public TSkeleton_application
|
|||||||
bool _chiusa;
|
bool _chiusa;
|
||||||
real _importo;
|
real _importo;
|
||||||
TConfig* _configfile;
|
TConfig* _configfile;
|
||||||
TAssoc_array _fiscali,_sociali; //array che contengono i conti
|
TAssoc_array _fiscali,_sociali, _costi, _pagamenti; //array che contengono i conti
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool create(void);
|
virtual bool create(void);
|
||||||
@ -285,6 +286,8 @@ protected:
|
|||||||
bool cerca_conto(const TBill& bill, const TAssoc_array& assoc, const char tipoconto) const;
|
bool cerca_conto(const TBill& bill, const TAssoc_array& assoc, const char tipoconto) const;
|
||||||
bool cerca_fiscali(const TBill& bill) const;
|
bool cerca_fiscali(const TBill& bill) const;
|
||||||
bool cerca_sociali(const TBill& bill) const;
|
bool cerca_sociali(const TBill& bill) const;
|
||||||
|
int cerca_pagamento(const TBill& bill) const;
|
||||||
|
int cerca_costo(const TBill& bill) const;
|
||||||
bool test_swap(TCausale& caus, bool ritsoc) const;
|
bool test_swap(TCausale& caus, bool ritsoc) const;
|
||||||
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);
|
||||||
@ -860,6 +863,22 @@ bool TInvioP::cerca_conto(const TBill& bill, const TAssoc_array& assoc, const ch
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TInvioP::cerca_costo(const TBill& bill) const
|
||||||
|
{
|
||||||
|
if (cerca_conto(bill, _costi, 'C'))
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TInvioP::cerca_pagamento(const TBill& bill) const
|
||||||
|
{
|
||||||
|
if (cerca_conto(bill, _pagamenti, 'P'))
|
||||||
|
return 2;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool TInvioP::cerca_fiscali(const TBill& bill) const
|
bool TInvioP::cerca_fiscali(const TBill& bill) const
|
||||||
{
|
{
|
||||||
return cerca_conto(bill, _fiscali, 'F');
|
return cerca_conto(bill, _fiscali, 'F');
|
||||||
@ -950,7 +969,7 @@ real TInvioP::calcola_pagamento(TRectype& curpag_rec)
|
|||||||
}
|
}
|
||||||
totdoc = totale_documento(pn.curr()); //tot doc con ritenute fiscali + ritenute sociali (da stampare)
|
totdoc = totale_documento(pn.curr()); //tot doc con ritenute fiscali + ritenute sociali (da stampare)
|
||||||
} //if pn.iva_items()..
|
} //if pn.iva_items()..
|
||||||
else
|
else //movimento NON iva
|
||||||
{
|
{
|
||||||
for (int i = 0; i < pn.cg_items(); i++)
|
for (int i = 0; i < pn.cg_items(); i++)
|
||||||
{
|
{
|
||||||
@ -983,9 +1002,10 @@ real TInvioP::calcola_pagamento(TRectype& curpag_rec)
|
|||||||
|
|
||||||
} //end di else pn.iva_items()...
|
} //end di else pn.iva_items()...
|
||||||
|
|
||||||
real percentuale = imponibile / totdoc;
|
//calcolo finale del pagato
|
||||||
totpagato *= percentuale;
|
real percentuale = totpagato /totdoc;
|
||||||
totpagato.round(2);
|
totpagato = imponibile * percentuale;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return totpagato;
|
return totpagato;
|
||||||
@ -1021,6 +1041,7 @@ bool TInvioP::i_proforma_pagamenti()
|
|||||||
if (pi.iscancelled())
|
if (pi.iscancelled())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//pagamenti saldacontati! vedi l'else per quelli non saldacontati
|
||||||
const char tipomov = cur_rec.get(MOV_TIPOMOV)[0];
|
const char tipomov = cur_rec.get(MOV_TIPOMOV)[0];
|
||||||
if (tipomov == '3' || tipomov == '2' || tipomov == '6')
|
if (tipomov == '3' || tipomov == '2' || tipomov == '6')
|
||||||
{
|
{
|
||||||
@ -1092,7 +1113,74 @@ bool TInvioP::i_proforma_pagamenti()
|
|||||||
}//if curpag_items..
|
}//if curpag_items..
|
||||||
}//for curpart =..
|
}//for curpart =..
|
||||||
}//if curpart_items..
|
}//if curpart_items..
|
||||||
}//if tipomov..
|
|
||||||
|
}//if tipomov ==..
|
||||||
|
else //tocca ai pagamenti NON saldacontati (procedura analoga a quella della stampa del pagato)
|
||||||
|
{
|
||||||
|
const long numregcg = cur_rec.get_long(MOV_NUMREG);
|
||||||
|
|
||||||
|
//cerca un record di MOVANA che abbia numregcg = nreg;usa il nuovo metodo fighissimo..
|
||||||
|
//..con la isam query
|
||||||
|
TString& query = get_tmp_string();
|
||||||
|
query << "USE MOVANA KEY 3\n";
|
||||||
|
query << "FROM NUMREGCG=" << numregcg << "\n";
|
||||||
|
query << "TO NUMREGCG=" << numregcg;
|
||||||
|
|
||||||
|
TISAM_recordset movana(query);
|
||||||
|
const TRecnotype items = movana.items();
|
||||||
|
|
||||||
|
if (items > 0)
|
||||||
|
{
|
||||||
|
if (items > 1)
|
||||||
|
error_box(TR("Esiste piu' di un movimento analitico collegato al movimento contabile %ld"),numregcg);
|
||||||
|
|
||||||
|
movana.move_last(); //si posiziona sul record corretto
|
||||||
|
|
||||||
|
//crea il movana legato al mov
|
||||||
|
const TAnal_mov anal_mov(cur_rec);
|
||||||
|
const TRecord_array& anal_rows = anal_mov.body();
|
||||||
|
|
||||||
|
for (int j = 1; j <= anal_rows.rows(); j++) //scansiona righe analitiche..
|
||||||
|
{
|
||||||
|
const TRectype& anal_row = anal_rows[j];
|
||||||
|
|
||||||
|
//prende il conto sulla riga analitica e lo confronta con quelli della configurazione
|
||||||
|
const TString& conto_riga_analitica = anal_row.get(RMOVANA_CODCONTO);
|
||||||
|
const int gruppo_anal = atoi(conto_riga_analitica.left(3));
|
||||||
|
const int conto_anal = atoi(conto_riga_analitica.mid(3,3));
|
||||||
|
const long sottoconto_anal = atol(conto_riga_analitica.mid(6,6));
|
||||||
|
|
||||||
|
const TBill conto(gruppo_anal, conto_anal, sottoconto_anal);
|
||||||
|
int tipo = cerca_costo(conto) || cerca_pagamento(conto);
|
||||||
|
if (tipo > 0)
|
||||||
|
{
|
||||||
|
const char sezione = anal_row.get_char(RMOVANA_SEZIONE);
|
||||||
|
const real valore = anal_row.get_real(RMOVANA_IMPORTO);
|
||||||
|
TImporto imp(sezione, valore);
|
||||||
|
|
||||||
|
switch (tipo)
|
||||||
|
{
|
||||||
|
case 1:imp.normalize('D');break;
|
||||||
|
case 2:imp.normalize('A');break;
|
||||||
|
default:break;
|
||||||
|
}
|
||||||
|
_nregpag = numregcg;
|
||||||
|
_nregcosto = numregcg;
|
||||||
|
_importo = imp.valore();
|
||||||
|
_chiusa = true;
|
||||||
|
|
||||||
|
//e finalmente aggiunge il record al file di esportazione
|
||||||
|
TRecord_text recpag;
|
||||||
|
recpag.set_type("G");
|
||||||
|
trasfilepag->autoload(recpag, *movana.cursor());
|
||||||
|
trasfilepag->write(recpag);
|
||||||
|
} //if (tipo > 0..
|
||||||
|
|
||||||
|
} //for(j<anal_rows...
|
||||||
|
} //if(items>0...
|
||||||
|
|
||||||
|
} //else if tipomov ==..
|
||||||
|
|
||||||
}//for cur =..
|
}//for cur =..
|
||||||
}//if cur_items..
|
}//if cur_items..
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user