Patch level :4.0 580

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :sistemate paranoie enrichettiche relative a pagamenti doppi e ritenute mancanti. Da testare


git-svn-id: svn://10.65.10.50/trunk@14690 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2006-12-22 16:08:13 +00:00
parent dc39749783
commit 35b4a82f59
2 changed files with 31 additions and 30 deletions

View File

@ -9,6 +9,7 @@
#include "cg7200a.h"
#include "cg2101.h"
#include "cg2103.h"
#include "cgsaldac.h"
#include <pagsca.h>
#include <partite.h>
@ -541,7 +542,6 @@ bool TInvioP::i_proforma_righe(TCursor& cur, TInvioP_file* trasfilerighe)
//..tali righe che non avevano commessa!)
const long conti_importi_items = conti_importi.items();
TString workstring; //stringa di lavoro che serve nel ciclo sotto
for (int i = 0; i < conti_importi_items; i++)
{
if (!conti_importi.importo(i).is_zero())
@ -641,7 +641,7 @@ bool TInvioP::i_proforma_righe(TCursor& cur, TInvioP_file* trasfilerighe)
const long analrigheiva_items = analmov.body().rows();
for (i = 1; i <= analrigheiva_items; i++)
for (int i = 1; i <= analrigheiva_items; i++)
{
//scanning delle righe analitiche per estrarne i conti e controllare se compaiono nell'assoc_array..
//..dei conti riempito con i conti trovati nelle righe iva
@ -934,32 +934,34 @@ real TInvioP::calcola_pagamento(TRectype& curpag_rec)
pn.curr().put(MOV_NUMREG, nreg);
if (pn.read() == NOERR)
{
const TRectype& movfat = pn.curr();
//dichiariamo una serie di simpatici real utilizzati in seguito
real totdoc,imponibile,imposta;
real totdoc,imponibile;
const real ritfis = pn.curr().get_real(MOV_RITFIS);
totpagato += ritfis;
//Le ritenute sociali invece vanno testate con la test_swap..
const real ritsoc = curpag_rec.get_real(PAGSCA_RITSOC);
if (!ritsoc.is_zero())
{
const TRectype& mov = pn.curr();
TCausale caus(mov.get(MOV_CODCAUS));
const bool swapt = test_swap(caus, false); // Totale invertito ?
const bool swaps = test_swap(caus, true); // Ritenute sociali invertite ?
if (swapt ^ swaps) // Somma ritenute sociali con segno
totpagato -= ritsoc;
else
totpagato += ritsoc;
}
//Movimenti CON SALDACONTO
//se movimento IVA..
if (pn.iva_items() > 0)
{
real imposta;
const TRectype& movfat = pn.curr();
const real ritfis = movfat.get_real(MOV_RITFIS);
totpagato += ritfis;
//Le ritenute sociali invece vanno testate con la test_swap..
real ritsoc = curpag_rec.get_real(PAGSCA_RITSOC);
ritsoc += movfat.get_real(MOV_RITSOC);
if (!ritsoc.is_zero())
{
const TRectype& mov = pn.curr();
TCausale caus(mov.get(MOV_CODCAUS));
const bool swapt = test_swap(caus, false); // Totale invertito ?
const bool swaps = test_swap(caus, true); // Ritenute sociali invertite ?
if (swapt ^ swaps) // Somma ritenute sociali con segno
totpagato -= ritsoc;
else
totpagato += ritsoc;
}
for (int i = 0; i < pn.iva_items(); i++)
{
const TRectype& rmoviva = pn.iva(i);
@ -990,9 +992,9 @@ real TInvioP::calcola_pagamento(TRectype& curpag_rec)
TImporto importo(rmov.get_char(RMV_SEZIONE), rmov.get_real(RMV_IMPORTO));
importo.normalize('D');
if (conto.tipo() > ' ')
if (conto.tipo() > ' ') //e' un conto cliente/fornitore...
totdoc -= importo.valore();
else
else //..e' un conto normale
{
if (cerca_fiscali(conto) || cerca_sociali(conto))
totdoc -= importo.valore(); //valore da stampare nella colonna Tot.fattura con ritenute
@ -1091,13 +1093,12 @@ bool TInvioP::i_proforma_pagamenti()
TRectype& cur_rec = cur.curr();
for (cur = 0; cur.pos() < cur_items; ++(cur))
{
pi.addstatus(1);
if (pi.iscancelled())
if (!pi.addstatus(1))
break;
//pagamenti saldacontati! vedi l'else per quelli non saldacontati
const char tipomov = cur_rec.get(MOV_TIPOMOV)[0];
if (tipomov == '3' || tipomov == '2' || tipomov == '6')
const tipo_movimento tipomov = (tipo_movimento)cur_rec.get_int(MOV_TIPOMOV);
if (tipomov == tm_pagamento || tipomov == tm_nota_credito || tipomov == tm_pagamento_insoluto)
{
TRelation relpart(LF_PARTITE);
TRectype da(LF_PARTITE);
@ -1170,7 +1171,7 @@ bool TInvioP::i_proforma_pagamenti()
}//if curpart_items..
}//if tipomov ==..
else //tocca ai pagamenti NON saldacontati (procedura analoga a quella della stampa del pagato)
if (tipomov == tm_nessuno) //tocca ai pagamenti NON saldacontati (procedura analoga a quella della stampa del pagato)
{
const long numregcg = cur_rec.get_long(MOV_NUMREG);

View File

@ -90,7 +90,7 @@ BEGIN
PROMPT 40 12 "Data finale "
END
BUTTON F_RIPRISTINA 20
BUTTON F_RIPRISTINA 20 2
BEGIN
PROMPT 2 14 "Annulla invio"
MESSAGE SHOW,F_DATARIPRISTINO|ENABLE,F_DATARIPRISTINO