1996-09-17 12:39:43 +00:00
// ------------------------------------------------------------
// Calcolo liquidazioni
// Part 5: stampa
// fv 21-1-94
// ------------------------------------------------------------
2001-05-01 08:17:07 +00:00
# include <currency.h>
2008-03-11 16:48:19 +00:00
# include <recarray.h>
1996-09-17 12:39:43 +00:00
# include <utility.h>
# include "cg4300.h"
2008-03-11 16:48:19 +00:00
# include <attiv.h>
1996-09-17 12:39:43 +00:00
// flags per annuale
# define IS_PRORATA 0x0001
// minchietta per prospetto ventilazione
class _vDesc : public TObject
{
public :
2000-10-03 13:45:12 +00:00
TString4 _codiva ;
1996-09-17 12:39:43 +00:00
real _acq ;
real _vnd ;
real _viv ;
2000-10-03 13:45:12 +00:00
_vDesc ( ) { }
1996-09-17 12:39:43 +00:00
virtual ~ _vDesc ( ) { }
} ;
2002-02-26 16:20:19 +00:00
const char * const sep =
1996-09-17 12:39:43 +00:00
" ------------------------------------------------------------------ "
" ------------------------------------------------------------------ " ;
void TLiquidazione_app : : set_page ( int file , int cnt )
{
_DescrItem & d = ( _DescrItem & ) _descr_arr [ cnt ] ;
set_auto_ff ( FALSE ) ;
reset_print ( ) ;
switch ( d . _flags )
{
case CHG_PARMS :
set_att ( d ) ;
break ;
case SET_FIRM :
set_firm ( d ) ;
break ;
1998-04-30 15:59:34 +00:00
case PIS_ROW :
1996-09-17 12:39:43 +00:00
case PIM_ROW :
2008-03-11 15:08:43 +00:00
case PIS_ROW_D :
case PIM_ROW_D :
case PIS_ROW_DI :
case PIM_ROW_DI :
1996-09-17 12:39:43 +00:00
set_pim ( d ) ;
break ;
1998-04-30 15:59:34 +00:00
case PIS_HEAD :
1996-09-17 12:39:43 +00:00
case PIM_HEAD :
2008-03-11 15:08:43 +00:00
case PIS_HEAD_D :
case PIM_HEAD_D :
case PIS_HEAD_DI :
case PIM_HEAD_DI :
1996-09-17 12:39:43 +00:00
set_pim_head ( d ) ;
break ;
case MISC_LIQ :
set_pumpam ( d ) ;
break ;
case TOT_ROW :
set_plm ( d ) ;
break ;
2008-03-11 15:08:43 +00:00
case TOT_ROW_D :
case TOT_ROW_DI :
set_plm_diff ( d ) ;
break ;
1996-09-17 12:39:43 +00:00
case PLAFOND :
set_plafond ( d ) ;
break ;
case VENTILA :
set_ventila ( d ) ;
break ;
case REGAGR :
set_regagr ( d ) ;
break ;
case REGVIA :
set_viaggio ( d ) ;
break ;
case THE_END :
set_grand ( d ) ;
break ;
2001-05-01 08:17:07 +00:00
case LIQACC :
if ( atoi ( _year ) > = 2000 )
set_liqacc_2000 ( d ) ;
else
set_liqacc_1999 ( d ) ;
1996-09-17 12:39:43 +00:00
break ;
case ACCONTO :
set_acconto_p ( d ) ;
break ;
case ACCHEAD :
set_acchead_p ( d ) ;
break ;
case DELDEB :
2007-09-17 15:33:04 +00:00
set_deltab ( d , false ) ;
1996-09-17 12:39:43 +00:00
break ;
case DELCRED :
2007-09-17 15:33:04 +00:00
set_deltab ( d , true ) ;
1996-09-17 12:39:43 +00:00
break ;
2008-03-11 15:08:43 +00:00
default :
break ;
1996-09-17 12:39:43 +00:00
}
}
print_action TLiquidazione_app : : postprocess_page ( int file , int cnt )
{
if ( _descr_arr . items ( ) = = 0 | | cnt = = _descr_arr . items ( ) - 1 )
return NEXT_PAGE ;
return REPEAT_PAGE ;
}
bool TLiquidazione_app : : preprocess_page ( int file , int cnt )
{
return _descr_arr . items ( ) ! = 0 ;
}
// ----------------------------------------------------------------
// Print description
// ----------------------------------------------------------------
void TLiquidazione_app : : describe_att ( int month , const char * codatt ,
bool isresult , char flags )
{
TToken_string atts ( codatt ) ;
if ( _isprint & & _canprint )
{
describe_name ( month , atts , flags ) ;
if ( atts . items ( ) = = 1 & & _isplafond )
describe_plafond ( month , codatt ) ;
if ( atts . items ( ) = = 1 & & _isvent )
describe_ventilation ( month , codatt ) ;
if ( atts . items ( ) = = 1 & & _isagricolo )
describe_agricolo ( month , codatt ) ;
if ( atts . items ( ) = = 1 & & _isviaggio )
describe_viaggio ( month , codatt ) ;
1998-04-30 15:59:34 +00:00
describe_pims ( month , codatt , FALSE ) ;
if ( atoi ( _year ) > 1997 ) // Descrive anche i PIS se esistono
describe_pims ( month , codatt , TRUE ) ;
1996-09-17 12:39:43 +00:00
if ( atts . items ( ) = = 1 )
describe_consistence ( codatt ) ;
}
}
void TLiquidazione_app : : describe_name ( int month , TToken_string & codatts , char flags )
{
_DescrItem * d = new _DescrItem ( CHG_PARMS ) ;
d - > _s0 = _nditte - > curr ( ) . get ( " CODDITTA " ) ;
d - > _s1 = _nditte - > curr ( ) . get ( " RAGSOC " ) ;
2008-03-11 16:48:19 +00:00
if ( atoi ( _year ) > 2007 )
{
const TString16 codateco = _nditte - > curr ( LF_ATTIV ) . get ( ATT_CODATECO ) ;
d - > _s2 = codateco ;
}
else
d - > _s2 = _nditte - > curr ( LF_ATTIV ) . get ( " CODATT " ) ;
1996-09-17 12:39:43 +00:00
d - > _s3 = codatts . items ( ) = = 1 ? ( const char * ) _nditte - > curr ( LF_ATTIV ) . get ( " DESCR " ) : " " ;
d - > _s4 = _freqviva ;
d - > _f1 = month ;
d - > _f2 = _isbenzinaro ;
d - > _f3 = ( word ) flags ;
if ( _mixed & & codatts . items ( ) = = 1 )
d - > _f0 = atoi ( codatts . mid ( 5 ) ) ;
else d - > _f0 = 0 ;
_descr_arr . add ( d ) ;
}
void TLiquidazione_app : : describe_firm ( int month )
{
if ( ! _isprint | | ! _canprint ) return ;
_DescrItem * d = new _DescrItem ( SET_FIRM ) ;
d - > _s0 = _nditte - > curr ( ) . get ( " CODDITTA " ) ;
d - > _s1 = _nditte - > curr ( ) . get ( " RAGSOC " ) ;
d - > _s2 = _freqviva ;
d - > _f1 = month ;
_descr_arr . add ( d ) ;
}
void TLiquidazione_app : : describe_liqacc ( )
{
if ( ! _isprint | | ! _canprint ) return ;
if ( ! look_lia ( ) ) return ;
if ( _lia - > get ( " S8 " ) ! = " A " ) return ;
_DescrItem * d = new _DescrItem ( LIQACC ) ;
d - > _r0 = _lia - > get_real ( " R7 " ) ;
d - > _r1 = _lia - > get_real ( " R13 " ) ;
d - > _r2 = _lia - > get_real ( " R14 " ) ;
d - > _r3 = _lia - > get_real ( " R9 " ) ;
d - > _r4 = _lia - > get_real ( " R10 " ) ;
d - > _r5 = _lia - > get_real ( " R8 " ) ;
d - > _r6 = _lia - > get_real ( " R12 " ) ;
d - > _r7 = _lia - > get_real ( " R11 " ) ;
d - > _r8 = _lia - > get_real ( " R4 " ) ;
2008-03-11 15:08:43 +00:00
d - > _r29 = _lia - > get_real ( " R29 " ) ;
2009-05-26 10:23:47 +00:00
d - > _r33 = _lia - > get_real ( " R33 " ) ;
1996-09-17 12:39:43 +00:00
TToken_string ff ( _lia - > get ( " S1 " ) , ' ! ' ) ;
real cre_pre ( ff . get ( 0 ) ) ;
real acq_intr ( ff . get ( 1 ) ) ;
d - > _r9 = cre_pre ;
d - > _r10 = acq_intr ;
_descr_arr . add ( d ) ;
}
void TLiquidazione_app : : describe_plafond ( int month , const char * codatt )
{
TString att ( codatt ) ;
// prepara la descrizione del riepilogo da stampare e lo accoda
real t1 , t2 , t3 ;
_DescrItem * d = new _DescrItem ( PLAFOND ) ;
1996-09-17 17:33:43 +00:00
if ( month = = 13 )
look_pla ( codatt ) ;
1996-09-17 12:39:43 +00:00
for ( int jj = 1 ; jj < = 3 ; jj + + ) // three types of plafond
{
t1 = 0.0 ; t2 = 0.0 ; t3 = 0.0 ;
1998-08-25 17:57:12 +00:00
if ( month < 13 )
{
look_ppa ( _freqviva = = " M " ? month : next_trim ( month ) - 2 , codatt , jj ) ;
t3 = _ppa - > get_real ( " R2 " ) ;
}
1996-09-17 12:39:43 +00:00
for ( int m = 1 ; m < = month & & m < 13 ; m + + )
{
if ( is_month_ok ( m , month ) & & look_ppa ( m , codatt , jj ) )
{
t1 + = _ppa - > get_real ( " R0 " ) ;
t2 + = _ppa - > get_real ( " R1 " ) ;
}
}
switch ( jj )
{
case 1 :
1996-09-17 17:33:43 +00:00
d - > _r0 = t1 ; d - > _r1 = t2 ;
d - > _r2 = month < 13 ? t3 : _pla - > get_real ( " R5 " ) ;
1996-09-17 12:39:43 +00:00
break ;
case 2 :
1996-09-17 17:33:43 +00:00
d - > _r3 = t1 ; d - > _r4 = t2 ;
d - > _r5 = month < 13 ? t3 : _pla - > get_real ( " R6 " ) ;
1996-09-17 12:39:43 +00:00
break ;
case 3 :
1996-09-17 17:33:43 +00:00
d - > _r6 = t1 ; d - > _r7 = t2 ;
d - > _r8 = month < 13 ? t3 : _pla - > get_real ( " R7 " ) ;
1996-09-17 12:39:43 +00:00
break ;
}
} // for tipo esenzione plafond
_descr_arr . add ( d ) ;
// bookmark
}
void TLiquidazione_app : : describe_ventilation ( int month , const char * codatt )
{
if ( ! _isvent | | _isagricolo | | _isviaggio ) return ;
_DescrItem * d = new _DescrItem ( VENTILA ) ;
TString att ( codatt ) ;
look_plm ( month , att ) ;
for ( _pim - > first ( ) ; ! _pim - > eof ( ) ; _pim - > next ( ) )
{
if ( strcmp ( * _pim_codatt , att ) ! = 0 )
continue ;
look_reg ( * _pim_codreg ) ;
look_iva ( * _pim_codiva ) ;
int tipocr = atoi ( * _pim_tipocr ) ;
int tipodet = atoi ( * _pim_tipodet ) ;
int mese = atoi ( * _pim_mese ) ;
bool corrisp = _reg - > get_bool ( " B0 " ) ;
real imponibile = _pim - > get_real ( " R0 " ) ;
real imposta = _pim - > get_real ( " R1 " ) ;
tiporeg tipomov = ( tiporeg ) _reg - > get_long ( " I0 " ) ;
TString tipoiva = _iva - > get ( " S1 " ) ;
1997-10-23 09:34:10 +00:00
if ( _year ! = * _pim_anno | | ( month = = 13 & & mese < 13 ) )
continue ;
1996-09-17 12:39:43 +00:00
if ( imponibile . is_zero ( ) & & imposta . is_zero ( ) ) continue ;
// questi non vanno in liquidazione, i totali sono
// gia' calcolati altrove
if ( tipodet = = 1 | | ( tipodet = = 3 & & tipocr = = 5 ) | | tipodet = = 9 )
continue ;
// questi non si devono vedere perche' so' bbrutti
if ( tipoiva = = " NS " | | tipoiva = = " ES " | | tipoiva = = " NI " )
continue ;
if ( mese < = month )
{
if ( tipocr = = 1 & & tipomov = = acquisto )
{
// somma agli acquisti
_vDesc * vd = NULL ;
for ( int i = 0 ; i < d - > _arr . items ( ) ; i + + )
{
_vDesc * vv = ( _vDesc * ) & ( d - > _arr [ i ] ) ;
if ( strcmp ( vv - > _codiva , * _pim_codiva ) = = 0 )
{ vd = vv ; break ; }
}
if ( vd = = NULL ) { vd = new _vDesc ; }
vd - > _acq + = ( imponibile + imposta ) ;
d - > _r0 + = ( imponibile + imposta ) ;
if ( vd - > _codiva . empty ( ) )
{
vd - > _codiva = * _pim_codiva ;
d - > _arr . add ( vd ) ;
}
}
else if ( ( is_month_ok ( mese , month ) | | month = = 13 ) & & corrisp
& & _pim - > get_bool ( " B1 " ) & &
tipocr = = 0 & & tipomov = = vendita )
// non sono sicurissimo della above condition
{
// somma alle vendite
_vDesc * vd = NULL ;
for ( int i = 0 ; i < d - > _arr . items ( ) ; i + + )
{
_vDesc * vv = ( _vDesc * ) & ( d - > _arr [ i ] ) ;
if ( strcmp ( vv - > _codiva , * _pim_codiva ) = = 0 )
{ vd = vv ; break ; }
}
if ( vd = = NULL ) { vd = new _vDesc ; }
1997-07-04 07:26:29 +00:00
vd - > _vnd + = imponibile ;
vd - > _viv + = imposta ;
1996-09-17 12:39:43 +00:00
d - > _r1 + = imponibile + imposta ;
if ( vd - > _codiva . empty ( ) )
{
vd - > _codiva = * _pim_codiva ;
d - > _arr . add ( vd ) ;
}
}
}
1997-11-20 13:29:47 +00:00
}
d - > _r0 = _pam - > get_real ( " R2 " ) ; // Totale acquisti
d - > _r1 = _pam - > get_real ( " R3 " ) ; // Totale vendite
1996-09-17 12:39:43 +00:00
if ( d - > _r1 . is_zero ( ) | | d - > _r0 . is_zero ( ) )
delete d ;
else
1997-07-04 07:26:29 +00:00
{
// Questo e' il fantastico moltiplicatore
d - > _r2 = d - > _r1 / d - > _r0 ;
1996-09-17 12:39:43 +00:00
_descr_arr . add ( d ) ;
1997-07-04 07:26:29 +00:00
}
1996-09-17 12:39:43 +00:00
}
void TLiquidazione_app : : describe_agricolo ( int month , const char * codatt )
{
2001-05-01 08:17:07 +00:00
_DescrItem * d = new _DescrItem ( REGAGR ) ;
1996-09-17 12:39:43 +00:00
1997-11-03 11:41:00 +00:00
if ( _isagr98 ) // Setta l'array interno con tutti gli items relativi alla tabella PIA
{
TArray & agr_array = d - > _arr ;
for ( _pia - > first ( ) ; ! _pia - > eof ( ) ; _pia - > next ( ) ) // Scorre i progressivi agricoli
{
if ( strcmp ( ( const char * ) * _pia_codatt , codatt ) = = 0 & &
1997-12-24 09:40:34 +00:00
is_month_plain ( atoi ( * _pia_mese ) ) & & _year = = * _pia_anno ) // E sono gia' in ordine di codice...
1997-11-03 11:41:00 +00:00
{
_DescrItem * p = new _DescrItem ( PROGAGR ) ;
p - > _r0 = _pia - > get_real ( " R0 " ) ; // Imponibile
p - > _r1 = _pia - > get_real ( " R1 " ) ; // Imposta
p - > _s0 = * _pia_codord ; // Codice iva ordinario
p - > _s1 = * _pia_codcom ; // Codice iva compensazione
1997-11-24 17:34:50 +00:00
if ( p - > _r0 ! = ZERO | | p - > _r1 ! = ZERO )
agr_array . add ( p ) ; // Aggiunge il fottuto item agricolo
1997-11-03 11:41:00 +00:00
}
}
}
1997-11-18 09:19:58 +00:00
for ( int mese = month = = 13 ? 13 : 1 ; mese < = month ; mese + + )
{
if ( ! is_month_ok ( mese , month ) )
continue ;
if ( ! look_plm ( mese , codatt ) )
continue ;
1996-09-17 12:39:43 +00:00
1997-11-18 09:19:58 +00:00
d - > _r0 + = _plm - > get_real ( " R5 " ) ;
d - > _r1 + = _plm - > get_real ( " R6 " ) ;
d - > _r2 + = _plm - > get_real ( " R7 " ) ;
d - > _r3 + = _plm - > get_real ( " R8 " ) ;
d - > _r4 + = _plm - > get_real ( " R9 " ) ;
d - > _r5 + = _plm - > get_real ( " R10 " ) ;
d - > _r6 + = _plm - > get_real ( " R11 " ) ;
d - > _r7 + = _pum - > get_real ( " R10 " ) ;
d - > _r8 + = _pum - > get_real ( " R11 " ) ;
d - > _r11 + = _plm - > get_real ( " R13 " ) ;
}
1996-12-12 12:29:31 +00:00
// Aggiungo anche questi per comodita' futura.
1996-12-06 08:19:03 +00:00
// in caso di ditta a regime agricolo
1996-12-06 13:54:26 +00:00
// alias:
1996-12-06 08:19:03 +00:00
// _r9 mantiene la percentuale (gia' arrotondata!)
// _r10 mantiene l'iva detraibile calcolata!
2001-05-01 08:17:07 +00:00
d - > _r9 = d - > _r8 / ( d - > _r7 + d - > _r8 ) ;
1996-12-06 08:19:03 +00:00
d - > _r9 . round ( 2 ) ;
1997-11-03 11:41:00 +00:00
d - > _r10 = d - > _r6 * d - > _r9 ;
1996-12-06 08:19:03 +00:00
d - > _r9 * = CENTO ;
2001-05-01 08:17:07 +00:00
round_alla_lira ( d - > _r10 , TRUE ) ;
1996-12-06 08:19:03 +00:00
1996-09-17 12:39:43 +00:00
_descr_arr . add ( d ) ;
}
void TLiquidazione_app : : describe_viaggio ( int month , const char * codatt )
{
if ( ! look_lim ( month ) ) return ;
_DescrItem * d = new _DescrItem ( REGVIA ) ;
1997-11-18 09:19:58 +00:00
for ( int mese = month = = 13 ? 13 : 1 ; mese < = month ; mese + + )
{
if ( ! is_month_ok ( mese , month ) | | ! look_plm ( mese , codatt ) )
continue ;
d - > _r0 + = _plm - > get_real ( " R5 " ) ; // corrispettivi CEE
d - > _r1 + = _plm - > get_real ( " R9 " ) ; // corrispettivi misti CEE
d - > _r2 + = _plm - > get_real ( " R6 " ) ; // corrispettivi fuori CE
d - > _r3 + = _plm - > get_real ( " R7 " ) ; // acquisti CEE
d - > _r4 + = _plm - > get_real ( " R10 " ) ; // acquisti misti parte CEE
d - > _r5 + = _plm - > get_real ( " R8 " ) ; // acquisti fuori CEE
d - > _r6 + = _plm - > get_real ( " R11 " ) ; // acquisti misti parte fuori CEE
}
1996-09-17 12:39:43 +00:00
// credito di costo precedente (CHECK annuale)
d - > _r8 = credito_costo_prec ( month ) ;
1996-12-09 08:34:51 +00:00
// Solita minchiatina dell'arrotondamento alle 1000 lirette se siamo in annuale
2000-10-03 13:45:12 +00:00
if ( month = = 13 | | atoi ( _year ) > = 2000 ) // CM500314 e CM500315
1996-12-09 08:34:51 +00:00
{
2002-02-26 16:20:19 +00:00
round_imposta ( d - > _r0 ) ;
round_imposta ( d - > _r1 ) ;
round_imposta ( d - > _r2 ) ;
round_imposta ( d - > _r3 ) ;
round_imposta ( d - > _r4 ) ;
round_imposta ( d - > _r5 ) ;
round_imposta ( d - > _r6 ) ;
round_imposta ( d - > _r8 ) ;
1996-12-09 08:34:51 +00:00
}
1996-12-30 09:53:17 +00:00
2000-10-03 13:45:12 +00:00
d - > _r7 = d - > _r4 . is_zero ( ) ? ZERO : ( d - > _r4 * CENTO ) / ( d - > _r4 + d - > _r6 ) ; d - > _r7 . round ( 2 ) ; // percentuale
1996-12-30 09:53:17 +00:00
d - > _r9 = ( d - > _r1 * d - > _r7 ) / CENTO ;
2001-05-01 08:17:07 +00:00
if ( month = = 13 )
2002-02-26 16:20:19 +00:00
round_imposta ( d - > _r9 ) ;
1996-12-09 08:34:51 +00:00
else
2001-05-01 08:17:07 +00:00
round_alla_lira ( d - > _r9 ) ;
1996-12-30 09:53:17 +00:00
1996-12-09 08:34:51 +00:00
// Calcola l'iva a debito, visto che servira' anche nel calcolo liquidazione (solo annuale)
const real aliva = aliquota_agvia ( ) ;
const real alcnt = aliva + CENTO ;
d - > _r10 = ( d - > _r0 + d - > _r9 ) - ( d - > _r3 + d - > _r4 + d - > _r8 ) ; // base imponibile lorda
if ( d - > _r10 . sign ( ) > 0 )
{
2001-05-01 08:17:07 +00:00
// d->_r11 = (d->_r10/(alcnt/CENTO)) * (aliva/CENTO); // iva dovuta
d - > _r11 = d - > _r10 * aliva / alcnt ; // iva dovuta
1997-01-30 16:39:10 +00:00
if ( month = = 13 )
2002-02-26 16:20:19 +00:00
round_imposta ( d - > _r11 ) ;
2001-05-01 08:17:07 +00:00
else
round_alla_lira ( d - > _r11 , TRUE ) ;
1996-12-09 08:34:51 +00:00
}
1996-09-17 12:39:43 +00:00
_descr_arr . add ( d ) ;
}
1998-04-30 15:59:34 +00:00
void TLiquidazione_app : : describe_pims ( int month , const char * codatt , const bool describe_pis )
1996-09-17 12:39:43 +00:00
// le si passa una tokenstring (o un codatt) e lei, da brava, calcola
// cumulando per tutte le attivita' nominatele
// ogni riga riguarda un codiva ma tutti i registri
// se il mese e' 13 si guarda tutto l'anno
// se si tratta di una sola attivita' in att. mista evidenziata o servizievole,
// stampa solo vendite e corrispettivi
1998-04-30 15:59:34 +00:00
// L'ultimo parametro serve per calcolare i PIS (progressivi del periodo successivo)
1996-09-17 12:39:43 +00:00
{
TToken_string atts ( codatt ) ;
TString ref ( atts . items ( ) = = 1 ? codatt : " ALL " ) ;
const char * tmpatt ;
int last = _descr_arr . last ( ) ;
2008-03-11 15:08:43 +00:00
bool issosp = false ;
2009-05-26 10:23:47 +00:00
real t0 , t1 , t2 , t3 , t4 , t5 , t26 , t27 , t28 , t29 , t30 , t31 , t32 , t33 ;
1999-04-06 15:34:39 +00:00
real rt0 , rt1 , rt2 , rt3 , rt4 , rt5 ;
1996-11-20 15:02:44 +00:00
real autodafe , autodafe_iva , art40 , art40_iva ;
2008-03-11 15:08:43 +00:00
real diffimp , diffiva , diffincimp , diffinciva ;
2009-05-26 10:23:47 +00:00
real diffimp_acq , diffiva_acq , diffincimp_acq , diffinciva_acq ;
1996-09-17 12:39:43 +00:00
bool skip_acq = atts . items ( ) = = 1 & & _mixed ;
// descrittore riga autodafe'
_DescrItem * ads = NULL ;
// descrittore riga iva dovuta ag. viaggio'
_DescrItem * iads = NULL ;
1998-04-30 15:59:34 +00:00
// Seleziona la tabella corretta: PIM o PIS e l'identificatore
TTable * tab = describe_pis ? _pis : _pim ;
const word PIM_PIS = describe_pis ? PIS_ROW : PIM_ROW ;
1996-09-17 12:39:43 +00:00
// questa cazzata serve per far apparire l'intestazione delle colonne
// anche se le colonne non ci sono; in tal modo si ottiene una peggior
// chiarezza, una peggiore efficienza, una gran rottura di coglioni,
// ma risulta identico al dio Sistema.
2008-03-11 15:08:43 +00:00
_DescrItem * hea = NULL ;
_DescrItem * head = NULL ;
_DescrItem * headi = NULL ;
_DescrItem * tot = NULL ;
_DescrItem * totd = NULL ;
_DescrItem * totdi = NULL ;
int totpos = 0 ;
1998-04-30 15:59:34 +00:00
1997-02-19 08:53:29 +00:00
// Assoc array per memorizzare i corrispettivi da scorporare. Tali corrispettivi verranno
// aggiunti alla fine del ciclo, scorrendo tutte le righe generate.
TAssoc_array corr_ann ;
_CorrItem cx ;
bool is_key ;
1996-09-17 12:39:43 +00:00
1998-04-30 15:59:34 +00:00
// Never mind the bollox
TString codtab , codreg , codiva , activity , anno ;
int mese ;
1996-09-17 12:39:43 +00:00
while ( ( tmpatt = atts . get ( ) ) ! = NULL )
{
TString att ( tmpatt ) ;
1998-04-30 15:59:34 +00:00
for ( tab - > first ( ) ; ! tab - > eof ( ) ; tab - > next ( ) )
1996-09-17 12:39:43 +00:00
{
_DescrItem * d = NULL ;
// compute
1998-04-30 15:59:34 +00:00
codtab = tab - > get ( " CODTAB " ) ;
anno = codtab . mid ( 0 , 4 ) ;
activity = codtab . mid ( 4 , 6 ) ;
codreg = codtab . mid ( 10 , 3 ) ;
mese = atoi ( codtab . mid ( 13 , 2 ) ) ;
codiva = codtab . mid ( 16 , 4 ) ;
bool ok = look_reg ( codreg ) ;
ok | = look_iva ( codiva ) ;
1996-09-17 12:39:43 +00:00
if ( ! ok ) continue ;
tiporeg tipomov = ( tiporeg ) _reg - > get_long ( " I0 " ) ;
bool corrisp = _reg - > get_bool ( " B0 " ) ;
TString tipoiva = _iva - > get ( " S1 " ) ;
1998-04-30 15:59:34 +00:00
int tipodet = atoi ( codtab . mid ( 20 , 1 ) ) ;
TString other = tab - > get ( " S4 " ) ;
TToken_string s1 ( tab - > get ( " S1 " ) , ' ! ' ) ; // Imponibile/iva fatture in ritardo
1997-10-22 12:24:43 +00:00
real rit_imp ( s1 . get ( 0 ) ) ;
real rit_iva ( s1 . get ( 1 ) ) ;
2008-03-11 15:08:43 +00:00
2009-05-26 10:23:47 +00:00
// if (tipomov == vendita)
// {
2008-03-11 15:08:43 +00:00
diffimp = _pim - > get_real ( " R26 " ) ;
diffiva = _pim - > get_real ( " R27 " ) ;
diffincimp = _pim - > get_real ( " R28 " ) ;
diffinciva = _pim - > get_real ( " R29 " ) ;
2009-05-26 10:23:47 +00:00
diffimp_acq = _pim - > get_real ( " R30 " ) ;
diffiva_acq = _pim - > get_real ( " R31 " ) ;
diffincimp_acq = _pim - > get_real ( " R32 " ) ;
diffinciva_acq = _pim - > get_real ( " R33 " ) ;
// }
2008-03-11 15:08:43 +00:00
1997-10-22 12:24:43 +00:00
const bool is_rit = tipodet ! = 0 & & month = = 13 & & rit_imp ! = 0.0 ; //Se fattura in ritardo con tipo detr. != 0 e si sta calcolando l'annuale
1999-04-06 15:34:39 +00:00
const tipo_sospensione sosp_imp = _reg - > get_bool ( " B1 " ) ? ( tipo_sospensione ) _reg - > get_int ( " I9 " ) : nessuna ;
1999-04-16 12:02:04 +00:00
issosp | = ( sosp_imp ! = nessuna ) ; // Setta il flag di presenza registri in sospensione (qualsiasi tipo: normale, vol_affari, liquidazione)
1999-04-06 15:34:39 +00:00
1996-09-17 12:39:43 +00:00
// ACHTUNG! Corrispettivi da ventileer possono ventilare
// ad un altro codiva; in tal caso si scrive quello
if ( corrisp & & ! other . empty ( ) )
{
look_iva ( other ) ;
codiva = other ;
}
// se e' corrispettivo da ventilare non
// scrivo un cannolo ripieno visto che e' stato ventilato
1998-04-30 15:59:34 +00:00
if ( tipomov = = vendita & & tipoiva = = " VE " & & ! describe_pis ) continue ;
1996-09-17 12:39:43 +00:00
// se e' il dettaglio di una attivita' mista non stampa
// gli acquisti, il perche' losalamadonna
if ( tipomov = = acquisto & & skip_acq ) continue ;
2000-10-03 13:45:12 +00:00
1996-09-17 12:39:43 +00:00
// questi non vanno in liquidazione, i totali sono
// gia' calcolati altrove
1997-10-22 12:24:43 +00:00
if ( ( tipodet = = 1 | | tipodet = = 3 | | tipodet = = 9 ) & & ! is_rit )
1996-09-17 12:39:43 +00:00
continue ;
2000-10-03 13:45:12 +00:00
1996-09-17 12:39:43 +00:00
// se ha tutti gli importi nulli viene da un annullamento di
// progressivi esistenti (achtung fatture con scontrino)
1998-04-30 15:59:34 +00:00
if ( tab - > get_real ( " R0 " ) . is_zero ( ) & &
tab - > get_real ( " R1 " ) . is_zero ( ) & &
tab - > get_real ( " R2 " ) . is_zero ( ) & &
tab - > get_real ( " R5 " ) . is_zero ( ) & &
2009-09-10 10:53:25 +00:00
tab - > get_real ( " R6 " ) . is_zero ( ) & &
tab - > get_real ( " R26 " ) . is_zero ( ) & &
tab - > get_real ( " R27 " ) . is_zero ( ) & &
tab - > get_real ( " R28 " ) . is_zero ( ) & &
tab - > get_real ( " R29 " ) . is_zero ( ) & &
tab - > get_real ( " R30 " ) . is_zero ( ) & &
tab - > get_real ( " R31 " ) . is_zero ( ) & &
tab - > get_real ( " R32 " ) . is_zero ( ) & &
tab - > get_real ( " R33 " ) . is_zero ( ) )
1996-09-17 12:39:43 +00:00
continue ;
1998-04-30 15:59:34 +00:00
if ( activity = = att & & is_month_plain ( mese ) & & _year = = anno )
1996-09-17 12:39:43 +00:00
{
// vedi se c'e' gia' un item corrispondente
2007-01-03 17:07:40 +00:00
int i ;
for ( i = last + 1 ; i < _descr_arr . items ( ) ; i + + )
1996-09-17 12:39:43 +00:00
{
2008-03-11 15:08:43 +00:00
_DescrItem * wd = ( _DescrItem * ) & _descr_arr [ i ] ;
if ( wd - > _flags = = PIM_PIS & &
wd - > _s0 = = ref & &
wd - > _s1 = = codiva )
{
d = wd ;
1996-09-17 12:39:43 +00:00
break ;
2008-03-11 15:08:43 +00:00
}
if ( wd - > _flags = = TOT_ROW )
break ;
if ( wd - > _flags = = PIM_PIS & &
wd - > _s0 = = ref & &
wd - > _s1 > codiva )
break ;
1996-09-17 12:39:43 +00:00
}
2008-03-11 15:08:43 +00:00
if ( d = = NULL )
1996-09-17 12:39:43 +00:00
{
2008-03-11 15:08:43 +00:00
bool isfirst = ( hea = = NULL ) ;
if ( isfirst )
{
hea = new _DescrItem ( describe_pis ? PIS_HEAD : PIM_HEAD ) ;
hea - > _f0 = skip_acq ; // cosi' non compare nemmeno la colonnina! contento?
hea - > _f1 = true ;
_descr_arr . insert ( hea , i + + ) ;
tot = new _DescrItem ( TOT_ROW ) ;
totpos = _descr_arr . insert ( tot , i ) ;
}
else
totpos + + ;
1998-04-30 15:59:34 +00:00
d = new _DescrItem ( PIM_PIS ) ;
2008-03-11 15:08:43 +00:00
d - > _f0 = isfirst ;
d - > _s0 = ref ;
d - > _s1 = codiva ;
_descr_arr . insert ( d , i ) ;
1996-09-17 12:39:43 +00:00
}
if ( tipomov = = acquisto )
{
1997-10-22 12:24:43 +00:00
// Ci sono anche le fatture in ritardo (solo in annuale)! Con tipo detraibilita' 1,3,9
1999-04-06 15:34:39 +00:00
if ( sosp_imp ! = vol_affari )
{
d - > _r4 + = is_rit ? rit_imp : tab - > get_real ( " R0 " ) ;
d - > _r5 + = is_rit ? rit_iva : tab - > get_real ( " R1 " ) ;
t4 + = is_rit ? rit_imp : tab - > get_real ( " R0 " ) ;
t5 + = is_rit ? rit_iva : tab - > get_real ( " R1 " ) ;
}
// Totalizza anche quelli valevoli per vol. affari.
if ( sosp_imp ! = liquidazione )
{
rt4 + = is_rit ? rit_imp : tab - > get_real ( " R0 " ) ;
rt5 + = is_rit ? rit_iva : tab - > get_real ( " R1 " ) ;
}
1996-09-17 12:39:43 +00:00
}
else // vendita
{
1997-02-19 08:53:29 +00:00
is_key = corr_ann . is_key ( codiva ) ;
cx . _totale = 0 ;
_CorrItem & ca = is_key ? ( _CorrItem & ) corr_ann [ codiva ] : cx ;
1999-04-06 15:34:39 +00:00
if ( sosp_imp ! = vol_affari )
ca . _totale + = tab - > get_real ( tipoiva = = " VE " ? " R2 " : " R3 " ) ; // Se e' codice IVA da Vent. stiamo scorrendo i PIS: va stampato il lordo dei progressivi successivi
if ( sosp_imp ! = liquidazione )
ca . _totale_vf + = tab - > get_real ( tipoiva = = " VE " ? " R2 " : " R3 " ) ;
1997-02-19 08:53:29 +00:00
if ( ! is_key ) // se non c'e' lo aggiunge
{
ca . _aliquota = _iva - > get_real ( " R0 " ) / CENTO ; // Se e' nuovo setta l'aliquota
corr_ann . add ( codiva , ca ) ;
}
1996-09-17 12:39:43 +00:00
// vedi corrispettivi veri e falsi
1998-04-30 15:59:34 +00:00
real cvi = tab - > get_real ( " R0 " ) ; // imp. totale
real cvv = tab - > get_real ( " R1 " ) ; // iva totale
real cfi = tab - > get_real ( " R13 " ) ; // imp. falsi corrispettivi
real cfv = tab - > get_real ( " R14 " ) ; // iva falsi corrispettivi
1997-10-23 09:34:10 +00:00
// MI3404...
1996-09-17 12:39:43 +00:00
// Giochiamo sopra la particolarita' che se non e' un registro di corrispettivi
// allora se R5 o R6 sono <> 0 significa che trattasi di documento FS,
1997-10-23 09:34:10 +00:00
// che pertanto va stornato dal totale corrispettivi. (Cosi' volle Vladimiro)
2000-10-03 13:45:12 +00:00
const real ifs ( tab - > get_real ( " R5 " ) ) ; // imp. fatture con scontrino
const real vfs ( tab - > get_real ( " R6 " ) ) ; // iva fatture con scontrino
1996-09-17 12:39:43 +00:00
if ( ! corrisp )
{
1999-04-06 15:34:39 +00:00
if ( sosp_imp ! = vol_affari )
{
d - > _r2 - = ifs ; // tolgo FS dai corrispettivi
d - > _r3 - = vfs ;
t2 - = ifs ; // idem per i totali
t3 - = vfs ;
}
if ( sosp_imp ! = liquidazione )
{
rt2 - = ifs ;
rt3 - = vfs ;
}
1996-09-17 12:39:43 +00:00
}
1998-04-30 15:59:34 +00:00
1996-11-20 15:02:44 +00:00
if ( corrisp )
1996-09-17 12:39:43 +00:00
{
cvi - = cfi ;
cvv - = cfv ;
}
if ( corrisp )
{
// usa R0 e R1 visto che la ventilazione e' gia'
// stata calcolata
1999-04-06 15:34:39 +00:00
if ( sosp_imp ! = vol_affari )
{
d - > _r2 + = ( cvi /* - ifs */ ) ; // tolgo FS dai corrispettivi
d - > _r3 + = ( cvv /* - vfs */ ) ;
d - > _r0 + = ifs ; // aggiungo FS alle vendite
d - > _r1 + = vfs ;
t2 + = ( cvi /* - ifs */ ) ; // idem per i totali
t3 + = ( cvv /* - vfs */ ) ; // non sono molto convinto ma vogliono cio'
t0 + = ifs ; // ...avevo ragione e infatti l'ho cambiato
t1 + = vfs ;
}
if ( sosp_imp ! = liquidazione )
{
rt2 + = cvi ;
rt3 + = cvv ;
rt0 + = ifs ;
rt1 + = vfs ;
}
1996-09-17 12:39:43 +00:00
}
if ( ! corrisp | | ( ! cfv . is_zero ( ) | | ! cfi . is_zero ( ) ) )
{
real adf , adi ; // autofatture non residenti art. 17
1997-12-01 16:14:48 +00:00
real va7i , va7v ; // ammontare art 40 c. 5/6/8
1996-09-17 12:39:43 +00:00
1998-04-30 15:59:34 +00:00
real vendi = corrisp ? cfi : tab - > get_real ( " R0 " ) ;
real vendv = corrisp ? cfv : tab - > get_real ( " R1 " ) ;
1996-09-17 12:39:43 +00:00
// si scorporano solo per l'annuale, altrimenti
// vengono normalmente considerati nelle vendite
if ( month = = 13 )
{
1998-04-30 15:59:34 +00:00
TToken_string kr ( tab - > get ( " S0 " ) , ' ! ' ) ;
1997-12-01 16:14:48 +00:00
va7i = kr . get ( 0 ) ;
va7v = kr . get ( 1 ) ;
1998-04-30 15:59:34 +00:00
adf = tab - > get_real ( " R7 " ) ;
adi = tab - > get_real ( " R8 " ) ;
1996-09-17 12:39:43 +00:00
}
1999-04-06 15:34:39 +00:00
if ( sosp_imp ! = vol_affari )
{
d - > _r0 + = vendi - adf - va7i ;
d - > _r1 + = vendv - adi - va7v ;
t0 + = vendi /* - adf */ ;
t1 + = vendv /* - adi */ ;
}
if ( sosp_imp ! = liquidazione )
{
rt0 + = vendi ;
rt1 + = vendv ;
}
1996-09-17 12:39:43 +00:00
autodafe + = adf ;
autodafe_iva + = adi ;
1997-12-01 16:14:48 +00:00
art40 + = va7i ;
art40_iva + = va7v ;
1996-09-17 12:39:43 +00:00
}
}
2009-05-26 10:23:47 +00:00
// if (tipomov == vendita)
// {
2009-09-10 10:53:25 +00:00
if ( ! diffimp . is_zero ( ) | | ! diffiva . is_zero ( ) | |
! diffimp_acq . is_zero ( ) | | ! diffiva_acq . is_zero ( ) )
2008-03-11 15:08:43 +00:00
{
const word id = describe_pis ? PIS_ROW_D : PIM_ROW_D ;
int j ;
d = NULL ;
for ( j = totpos + 1 ; j < _descr_arr . items ( ) ; j + + )
{
_DescrItem * wd = ( _DescrItem * ) & _descr_arr [ j ] ;
const bool found = wd - > _flags = = id & & wd - > _s0 = = ref ;
if ( found & & wd - > _s1 = = codiva )
{
d = wd ;
break ;
}
if ( wd - > _flags = = TOT_ROW_D )
break ;
if ( found & & wd - > _s1 > codiva )
break ;
}
if ( d = = NULL )
{
const bool isfirst = head = = NULL ;
if ( isfirst )
{
head = new _DescrItem ( describe_pis ? PIS_HEAD_D : PIM_HEAD_D ) ;
_descr_arr . insert ( head , j + + ) ;
head - > _f0 = false ;
head - > _f1 = true ;
totd = new _DescrItem ( TOT_ROW_D ) ;
_descr_arr . insert ( totd , j ) ;
}
d = new _DescrItem ( id ) ;
_descr_arr . insert ( d , j ) ;
d - > _f0 = isfirst ;
d - > _s0 = ref ;
d - > _s1 = codiva ;
}
d - > _r26 + = diffimp ;
d - > _r27 + = diffiva ;
t26 + = diffimp ;
t27 + = diffiva ;
2009-05-26 10:23:47 +00:00
d - > _r30 + = diffimp_acq ;
d - > _r31 + = diffiva_acq ;
t30 + = diffimp_acq ;
t31 + = diffiva_acq ;
2008-03-11 15:08:43 +00:00
}
2009-09-10 10:53:25 +00:00
if ( ! diffincimp . is_zero ( ) | | ! diffinciva . is_zero ( ) | |
! diffincimp_acq . is_zero ( ) | | ! diffinciva_acq . is_zero ( ) )
2008-03-11 15:08:43 +00:00
{
const word id = describe_pis ? PIS_ROW_DI : PIM_ROW_DI ;
int j ;
d = NULL ;
for ( j = totpos + 1 ; j < _descr_arr . items ( ) ; j + + )
{
_DescrItem * wd = ( _DescrItem * ) & _descr_arr [ j ] ;
const bool found = wd - > _flags = = id & & wd - > _s0 = = ref ;
if ( found & & wd - > _s1 = = codiva )
{
d = wd ;
break ;
}
if ( wd - > _flags = = TOT_ROW_DI )
break ;
if ( found & & wd - > _s1 > codiva )
break ;
}
if ( d = = NULL )
{
const bool isfirst = headi = = NULL ;
if ( isfirst )
{
headi = new _DescrItem ( describe_pis ? PIS_HEAD_DI : PIM_HEAD_DI ) ;
_descr_arr . insert ( headi , j + + ) ;
headi - > _f0 = false ;
headi - > _f1 = true ;
totdi = new _DescrItem ( TOT_ROW_DI ) ;
_descr_arr . insert ( totdi , j ) ;
}
d = new _DescrItem ( id ) ;
_descr_arr . insert ( d , j ) ;
d - > _f0 = isfirst ;
d - > _s0 = ref ;
d - > _s1 = codiva ;
}
d - > _r28 + = diffincimp ;
d - > _r29 + = diffinciva ;
t28 + = diffincimp ;
t29 + = diffinciva ;
2009-05-26 10:23:47 +00:00
d - > _r32 + = diffincimp_acq ;
d - > _r33 + = diffinciva_acq ;
t32 + = diffincimp_acq ;
t33 + = diffinciva_acq ;
2008-03-11 15:08:43 +00:00
}
2009-05-26 10:23:47 +00:00
// }
1996-09-17 12:39:43 +00:00
}
1998-04-30 15:59:34 +00:00
} // End of _pim cycle
1997-04-18 11:21:16 +00:00
1997-02-19 08:53:29 +00:00
real impc , ivac ; // Aggiunge lo scorporo dei corrispettivi
const int ditems = _descr_arr . items ( ) ;
1997-10-22 12:24:43 +00:00
for ( int i = last + 1 ; i < ditems ; i + + ) // scorre le righe memorizzate
1997-02-19 08:53:29 +00:00
{
_DescrItem & dd = ( _DescrItem & ) _descr_arr [ i ] ;
1998-04-30 15:59:34 +00:00
if ( corr_ann . is_key ( dd . _s1 ) & & dd . _flags = = PIM_PIS & & dd . _s0 = = ref ) // Se esiste il codice iva corrispondente sull'array corrispettivi
1997-02-19 08:53:29 +00:00
{
_CorrItem & cc = ( _CorrItem & ) corr_ann [ dd . _s1 ] ;
lordo2netto ( cc . _totale , impc , ivac , cc . _aliquota ) ;
dd . _r2 + = impc ; // allora effettua lo scorporo e aggiorna i totali
dd . _r3 + = ivac ;
t2 + = impc ;
t3 + = ivac ;
1999-04-06 15:34:39 +00:00
// Calcola lo scorporo per quelli comprensivi/validi per Vol.affari
lordo2netto ( cc . _totale_vf , impc , ivac , cc . _aliquota ) ;
rt2 + = impc ;
rt3 + = ivac ;
1997-02-19 08:53:29 +00:00
}
}
1997-04-18 11:21:16 +00:00
corr_ann . destroy ( ) ;
1996-09-17 12:39:43 +00:00
look_plm ( month , att ) ;
2001-05-01 08:17:07 +00:00
const real iva74t = _pom - > get_real ( " R13 " ) ;
if ( ! describe_pis & & iva74t > ZERO )
1996-09-17 12:39:43 +00:00
{
if ( iads = = NULL ) iads = new _DescrItem ( PIM_ROW ) ;
iads - > _s0 = " 74TER " ; // cosi' vollero
iads - > _s1 = " IVA " ; // cosi' vollero
iads - > _s2 = " dovuta - 74 ter " ; // cosi' vollero
iads - > _r1 + = iva74t ;
t1 + = iva74t ;
1999-04-06 15:34:39 +00:00
rt1 + = iva74t ;
2008-03-11 15:08:43 +00:00
iads - > _f0 = false ;
1996-09-17 12:39:43 +00:00
}
1998-04-30 15:59:34 +00:00
} // fine while (codatt)
1996-11-20 15:02:44 +00:00
1998-04-30 15:59:34 +00:00
if ( ! describe_pis & & ( art40 . sign ( ) > 0 | | art40_iva . sign ( ) > 0 ) )
1997-02-19 08:53:29 +00:00
{
1996-11-20 15:02:44 +00:00
_DescrItem * ads = new _DescrItem ( PIM_ROW ) ;
ads - > _s0 = ref ;
1997-12-01 16:14:48 +00:00
ads - > _s1 = " VA7 " ;
1996-11-20 15:02:44 +00:00
ads - > _r0 = art40 ;
ads - > _r1 = art40_iva ;
2008-03-11 15:08:43 +00:00
ads - > _f0 = false ;
_descr_arr . insert ( ads , totpos + + ) ;
1996-11-20 15:02:44 +00:00
}
1998-04-30 15:59:34 +00:00
if ( ! describe_pis & & ( autodafe . sign ( ) > 0 | | autodafe_iva . sign ( ) > 0 ) )
1996-09-17 12:39:43 +00:00
{
_DescrItem * ads = new _DescrItem ( PIM_ROW ) ;
ads - > _s0 = ref ;
1996-11-20 15:02:44 +00:00
ads - > _s1 = " AF " ; // cosi' vollero, inoltre non e' piu' A35 ma AF, come sul dio sistema
1996-09-17 12:39:43 +00:00
ads - > _r0 = autodafe ;
ads - > _r1 = autodafe_iva ;
2008-03-11 15:08:43 +00:00
ads - > _f0 = false ;
_descr_arr . insert ( ads , totpos + + ) ;
1996-09-17 12:39:43 +00:00
}
// ag. viaggio: iva dovuta 74 ter la vogliono in mezzo ai progressivi
2008-03-11 15:08:43 +00:00
if ( iads ! = NULL )
_descr_arr . insert ( iads , totpos + + ) ;
1996-09-17 12:39:43 +00:00
1998-04-30 15:59:34 +00:00
// prepara una bella riga di totali
2008-03-11 15:08:43 +00:00
if ( tot ! = NULL )
{
tot - > _r0 = t0 ; tot - > _r1 = t1 ;
tot - > _r2 = t2 ; tot - > _r3 = t3 ;
tot - > _r4 = t4 ; tot - > _r5 = t5 ;
}
if ( totd ! = NULL )
{
totd - > _r26 = t26 ;
totd - > _r27 = t27 ;
2009-05-26 10:23:47 +00:00
totd - > _r30 = t30 ;
totd - > _r31 = t31 ;
2008-03-11 15:08:43 +00:00
}
if ( totdi ! = NULL )
{
totdi - > _r28 = t28 ;
totdi - > _r29 = t29 ;
2009-05-26 10:23:47 +00:00
totdi - > _r32 = t32 ;
totdi - > _r33 = t33 ;
2008-03-11 15:08:43 +00:00
}
1999-04-06 15:34:39 +00:00
// Totali progressivi da registri, comprensivi dei valori per calcolo vol affari.
2008-03-11 15:08:43 +00:00
if ( tot ! = NULL & & issosp ) // Setta i valori (e la conseguente stampa della riga) solo se presenti registri in sospensione
1999-04-06 15:34:39 +00:00
{
2008-03-11 15:08:43 +00:00
tot - > _r11 = rt0 ; tot - > _r12 = rt1 ;
tot - > _r13 = rt2 ; tot - > _r14 = rt3 ;
tot - > _s2 = rt4 . string ( ) ; tot - > _s3 = rt5 . string ( ) ;
1999-04-06 15:34:39 +00:00
}
1996-09-17 12:39:43 +00:00
1998-04-30 15:59:34 +00:00
// aggiunge dati ptm
_DescrItem * t = new _DescrItem ( MISC_LIQ ) ;
t - > _f2 = atoi ( _year ) > 1997 ? describe_pis : TRUE ; //isfirst; // per il form feed o meno alla fine
if ( ! describe_pis )
{
1996-09-17 12:39:43 +00:00
TToken_string ttm ( " 0|0|0 " ) ;
1998-04-30 15:59:34 +00:00
1997-10-23 09:34:10 +00:00
const bool annual = month = = 13 ;
const int limit = annual ? 13 : month ;
int m = annual ? month : 1 ;
for ( ; m < = limit ; m + + )
1996-09-17 12:39:43 +00:00
{
if ( ! is_month_ok ( m , month ) ) continue ;
1998-04-30 15:59:34 +00:00
1996-09-17 12:39:43 +00:00
atts . restart ( ) ;
while ( ( tmpatt = atts . get ( ) ) ! = NULL )
{
TString att ( tmpatt ) ;
look_plm ( m , att ) ;
real ad1 , ad2 ;
2010-02-19 14:52:39 +00:00
if ( tot = = NULL )
2008-03-11 15:08:43 +00:00
{
2010-02-19 14:52:39 +00:00
tot = new _DescrItem ( TOT_ROW ) ;
_descr_arr . insert ( tot , - 1 ) ;
2008-03-11 15:08:43 +00:00
}
2010-02-19 14:52:39 +00:00
tot - > _r6 + = _pom - > get_real ( " R0 " ) ; // acq. intracomunitari
tot - > _r7 + = _pom - > get_real ( " R1 " ) ; // inded. art 19
tot - > _r8 + = _pom - > get_real ( " R2 " ) ; // IVA su inded. art. 19
1996-09-17 12:39:43 +00:00
t - > _r0 + = _pom - > get_real ( " R3 " ) ; // acq. ammortizz. detr
t - > _r1 + = _pom - > get_real ( " R4 " ) ; // IVA acq. ammort. detr
t - > _r2 + = _pum - > get_real ( " R2 " ) ; // ammort. detr. 6%
t - > _r3 + = _pum - > get_real ( " R3 " ) ; // IVA ammort detr. 6%
t - > _r4 + = _pom - > get_real ( " R5 " ) ; // acq. beni rivendita
t - > _r5 + = _pom - > get_real ( " R6 " ) ; // IVA acq. beni rivendita
t - > _r6 + = _pom - > get_real ( " R7 " ) ; // acq. leasing
t - > _r7 + = _pom - > get_real ( " R8 " ) ; // IVA acq. leasing
t - > _r8 + = _pum - > get_real ( " R0 " ) ; // cessioni beni ammort.
t - > _r9 + = _pum - > get_real ( " R1 " ) ; // IVA su cessioni ammort.
t - > _r10 + = _pum - > get_real ( " R4 " ) ; // tot. esenti IVA
1997-12-24 09:40:34 +00:00
if ( ! annual ) // Se non siamo in annuale prende il prorata su doc. acq. anno precedente
{
t - > _r12 + = _plm - > get_real ( " R14 " ) ;
t - > _r13 = _plm - > get_real ( " R4 " ) ; // percentuale prorata anno precedente
1999-04-06 15:34:39 +00:00
t - > _r14 + = _plm - > get_real ( " R15 " ) ;
t - > _r15 = _plm - > get_real ( " R16 " ) ; // percentuale prorata 2 anni addietro
1997-12-24 09:40:34 +00:00
}
1999-04-06 15:34:39 +00:00
t - > _r11 + = _plm - > get_real ( " R2 " ) - _plm - > get_real ( " R14 " ) - _plm - > get_real ( " R15 " ) ; // pro-rata indetraibile sui doc. acq. anno attuale
1997-12-24 09:40:34 +00:00
// in caso di liq. annuale prende il totale (tutto R2)
1996-09-17 12:39:43 +00:00
ad1 = real ( ttm . get ( 1 ) ) ;
ad2 = real ( ttm . get ( 2 ) ) ;
ad1 + = _pom - > get_real ( " R11 " ) ;
ad2 + = _pom - > get_real ( " R12 " ) ;
1997-12-24 09:40:34 +00:00
ttm . add ( _plm - > get ( " R12 " ) , 0 ) ; // % pro-rata anno corrente
1996-09-17 12:39:43 +00:00
ttm . add ( ad1 . string ( ) , 1 ) ; // imp. acq. amm. indetr.
ttm . add ( ad2 . string ( ) , 2 ) ; // IVA acq. amm. indetr
t - > _s0 = ttm ;
1998-04-30 15:59:34 +00:00
1999-04-06 15:34:39 +00:00
t - > _f0 = _prorata . percentuale ( _year ) ! = INVALID_PRORATA & & ( month ! = 13 ) ; // flag per segnalare l'esistenza
2010-02-19 14:52:39 +00:00
tot - > _r9 + = _pom - > get_real ( " R9 " ) ; // acq. inded. su ricavi esenti
tot - > _r10 + = _pom - > get_real ( " R10 " ) ; // IVA acq. inded. su ricavi esenti
// passaggi interni
real aipip ( tot - > _s0 ) ; // progressivo ...
real aipivp ( tot - > _s1 ) ; // ... (che mazzata sulle palle...)
aipip + = _pum - > get_real ( " R8 " ) ; // acq. inded. per pass. int
aipivp + = _pum - > get_real ( " R9 " ) ; // IVA acq. inded. per pass. int
tot - > _s0 = aipip . string ( ) ; // risbatto ...
tot - > _s1 = aipivp . string ( ) ; // ..
1998-04-30 15:59:34 +00:00
1996-09-17 12:39:43 +00:00
// spese generali.
real spgnp ( t - > _s2 ) ; // progressivo ...
real spgnvp ( t - > _s3 ) ; // ... (che doppia mazzata sulle palle...)
spgnp + = _pam - > get_real ( " R10 " ) ; // spese generali.
spgnvp + = _pam - > get_real ( " R11 " ) ; // IVA spese generali.
t - > _s2 = spgnp . string ( ) ; // risbatto ...
t - > _s3 = spgnvp . string ( ) ; // ..
1998-04-30 15:59:34 +00:00
1999-04-06 15:34:39 +00:00
// sospensione imposta: non piu' due palle, ma QUATTRO...
// caro Ferdinando... ora son divenute ben OTTO...
// grazie all'iva ad esigibilita' differita da pagare/de"TRARRE"
1996-09-17 12:39:43 +00:00
TToken_string tt ( t - > _s4 ) ;
real aqsi ( tt . get ( 0 ) ) ;
real aqsv ( tt . get ( 1 ) ) ;
real vnsi ( tt . get ( 2 ) ) ;
real vnsv ( tt . get ( 3 ) ) ;
1999-04-06 15:34:39 +00:00
real aqli ( tt . get ( 4 ) ) ;
real aqlv ( tt . get ( 5 ) ) ;
real vnli ( tt . get ( 6 ) ) ;
real vnlv ( tt . get ( 7 ) ) ;
1998-04-30 15:59:34 +00:00
1996-09-17 12:39:43 +00:00
aqsi + = _pam - > get_real ( " R6 " ) ;
aqsv + = _pam - > get_real ( " R7 " ) ;
vnsi + = _pam - > get_real ( " R8 " ) ;
vnsv + = _pam - > get_real ( " R9 " ) ;
1999-04-06 15:34:39 +00:00
aqli + = _pam - > get_real ( " R12 " ) ;
aqlv + = _pam - > get_real ( " R13 " ) ;
vnli + = _pam - > get_real ( " R14 " ) ;
vnlv + = _pam - > get_real ( " R15 " ) ;
1998-04-30 15:59:34 +00:00
1996-09-17 12:39:43 +00:00
tt = " " ;
tt . add ( aqsi . string ( ) ) ;
tt . add ( aqsv . string ( ) ) ;
tt . add ( vnsi . string ( ) ) ;
tt . add ( vnsv . string ( ) ) ;
1999-04-06 15:34:39 +00:00
tt . add ( aqli . string ( ) ) ;
tt . add ( aqlv . string ( ) ) ;
tt . add ( vnli . string ( ) ) ;
tt . add ( vnlv . string ( ) ) ;
1996-09-17 12:39:43 +00:00
t - > _s4 = tt ;
1998-04-30 15:59:34 +00:00
1996-09-17 12:39:43 +00:00
} // while (attivita')
} // for (mese ok)
2000-10-03 13:45:12 +00:00
// Cazzata orrenda ma necessaria CM500308
2008-03-11 15:08:43 +00:00
if ( tot ! = NULL & & issosp )
2000-10-03 13:45:12 +00:00
{
2008-03-11 15:08:43 +00:00
rt4 + = tot - > _r7 ; rt5 + = tot - > _r8 ; // Det 1
rt4 + = tot - > _r9 ; rt5 + = tot - > _r10 ; // Det 3
rt4 + = real ( tot - > _s0 ) ; rt5 + = real ( tot - > _s1 ) ; // Det 9
tot - > _s2 = rt4 . string ( ) ; tot - > _s3 = rt5 . string ( ) ;
2000-10-03 13:45:12 +00:00
}
1996-09-17 12:39:43 +00:00
// annual follows in _arr
if ( month = = 13 & & ref ! = " ALL " )
{
// tutte quelle cose che vanno alla liquidazione annuale, come il
// calcolo del prorata o del nuovo plafond o ....
if ( look_pla ( codatt ) )
{
2001-05-01 08:17:07 +00:00
real v1 = _pla - > get_real ( " R14 " ) ; // Totale imponibile vendite
real v2 = _pla - > get_real ( " S1 " ) ; // Volume d'affari II attivit<69>
1996-09-17 12:39:43 +00:00
real ris = v1 + v2 ;
2001-05-01 08:17:07 +00:00
real e1 = _pla - > get_real ( " R1 " ) ; // Totale vendite esenti C1
real e2 = _pla - > get_real ( " R2 " ) ; // Totale vendite esenti C2
real e3 = _pla - > get_real ( " R3 " ) ; // Totale vendite esenti C3
real e4 = _pla - > get_real ( " R15 " ) ; // Totale vendite esenti C1A
real e5 = _pla - > get_real ( " R16 " ) ; // Totale vendite beni ammortizzabili esenti C3
real e6 = _pla - > get_real ( " R17 " ) ; // Totale vendite beni ammortizzabili esenti C1A
real bam = _pla - > get_real ( " R4 " ) ; // Cessione beni ammortizzabili
1996-09-17 12:39:43 +00:00
real iaq = _pla - > get_real ( " R11 " ) ; // IVA acquisti
real ppg = _pla - > get_real ( " R12 " ) ; // pro-rata pagato
2000-05-05 15:25:49 +00:00
1996-09-17 12:39:43 +00:00
// calcola nuovo prorata per ogni attivita' (miste: 1+2)
2001-05-01 08:17:07 +00:00
real pr ;
1999-04-06 15:34:39 +00:00
if ( atoi ( _year ) > 1997 ) // Calcolo dal 1998 in poi
{
2001-05-01 08:17:07 +00:00
const real rsa = ris - ( e3 - e5 ) - ( e4 - e6 ) ;
1999-04-06 15:34:39 +00:00
const real rsn = rsa - e1 ;
if ( ! rsa . is_zero ( ) )
pr = CENTO - ( ( rsn / rsa ) * CENTO ) ; // Percentuale di indetraibilita: reciproco della percentuale di detraibilita'
}
else
{
if ( ! ris . is_zero ( ) )
pr = ( e1 / ris ) * CENTO ;
}
2001-05-01 08:17:07 +00:00
pr . round ( 0 ) ;
1999-04-06 15:34:39 +00:00
1996-09-17 12:39:43 +00:00
real co = 0.0 ;
real topay = 0.0 ;
1998-04-30 15:59:34 +00:00
//if (pr != _prorata.current())
1996-09-17 12:39:43 +00:00
{
// calcolo conguaglio -- se positivo e' a debito
2000-10-03 13:45:12 +00:00
if ( pr > ZERO )
1996-10-01 14:50:33 +00:00
{
topay = ( iaq + ppg ) * ( pr / CENTO ) ;
2002-02-26 16:20:19 +00:00
round_imposta ( topay ) ;
1996-10-01 14:50:33 +00:00
}
1996-09-17 12:39:43 +00:00
co = topay - ppg ;
2002-02-26 16:20:19 +00:00
round_imposta ( co ) ;
1996-09-17 12:39:43 +00:00
}
1998-04-30 15:59:34 +00:00
1996-09-17 12:39:43 +00:00
_DescrItem * dd = new _DescrItem ( ANNUAL ) ;
1998-04-30 15:59:34 +00:00
2001-05-01 08:17:07 +00:00
// MonsterFish: arrotonda alle 1000 LIRE C1,C2,C3,C1A
2002-02-26 16:20:19 +00:00
round_imposta ( e1 ) ;
round_imposta ( e2 ) ;
round_imposta ( e3 ) ;
round_imposta ( e4 ) ;
round_imposta ( e5 ) ;
round_imposta ( e6 ) ;
round_imposta ( bam ) ;
round_imposta ( ris ) ;
2001-05-01 08:17:07 +00:00
// segna flag prorata
if ( ( e1 + e2 + e3 + e4 ) > ZERO )
1996-09-17 12:39:43 +00:00
dd - > _f0 | = IS_PRORATA ;
dd - > _r0 = ris ;
dd - > _r1 = e1 ;
2001-05-01 08:17:07 +00:00
dd - > _r2 = pr > ZERO ? pr : ZERO ;
1996-09-17 12:39:43 +00:00
dd - > _r3 = co ;
dd - > _r4 = e2 ;
dd - > _r5 = e3 ;
dd - > _r6 = topay ;
1999-04-06 15:34:39 +00:00
dd - > _r7 = e4 ;
2001-05-01 08:17:07 +00:00
dd - > _r8 = e5 ;
dd - > _r9 = e6 ;
1996-09-17 12:39:43 +00:00
t - > _arr . add ( dd ) ;
}
}
}
1998-04-30 15:59:34 +00:00
_descr_arr . add ( t ) ;
1996-09-17 12:39:43 +00:00
}
2002-05-08 16:25:49 +00:00
void TLiquidazione_app : : describe_liq ( int month , const char * codatts , _DescrItem * di )
1996-09-17 12:39:43 +00:00
{
2002-05-08 16:25:49 +00:00
if ( ! _isprint | | ! _canprint )
return ;
1996-09-17 12:39:43 +00:00
2002-05-08 16:25:49 +00:00
if ( ! look_lim ( month ) )
return ;
1996-09-17 12:39:43 +00:00
_DescrItem * d = new _DescrItem ( THE_END ) ;
// gli diamo la stessa struttura di LIM
2002-02-26 16:20:19 +00:00
d - > _r0 = _lim - > get_real ( " R0 " ) ; // Risultato
d - > _r1 = _lim - > get_real ( " R1 " ) ; // Rimborso
d - > _r2 = _lim - > get_real ( " R2 " ) ;
d - > _r3 = _lim - > get_real ( " R3 " ) ;
d - > _r4 = _lim - > get_real ( " R4 " ) ;
d - > _r5 = _lim - > get_real ( " R5 " ) ; // rettifiche
d - > _r6 = _lim - > get_real ( " R6 " ) ;
d - > _r7 = _lim - > get_real ( " R14 " ) ;
d - > _r9 = _lim - > get_real ( " R9 " ) ;
2008-03-11 15:08:43 +00:00
d - > _r29 = _lim - > get_real ( " R29 " ) ;
2009-05-26 10:23:47 +00:00
d - > _r33 = _lim - > get_real ( " R33 " ) ;
1999-04-26 15:58:05 +00:00
if ( atoi ( _year ) < = 1997 ) // Dal 1998 in poi il conguaglio prorata non va stampato, ma conglobato nell'iva acquisti
2002-02-26 16:20:19 +00:00
d - > _r10 = _lim - > get_real ( " R7 " ) ; // totale conguaglio prorata
1996-09-17 12:39:43 +00:00
TToken_string tt ( 80 ) ;
2002-02-26 16:20:19 +00:00
tt . add ( _lam - > get_real ( " R0 " ) . string ( ) ) ; // IVA Vendite
tt . add ( _lam - > get_real ( " R1 " ) . string ( ) ) ; // IVA Acquisti
tt . add ( _lam - > get_real ( " R2 " ) . string ( ) ) ; // Credito precedente
tt . add ( _lam - > get_real ( " R3 " ) . string ( ) ) ; // Debito precedente
tt . add ( _lam - > get_real ( " R4 " ) . string ( ) ) ;
1996-09-17 12:39:43 +00:00
2000-05-05 15:25:49 +00:00
d - > _s0 = tt ;
2002-02-26 16:20:19 +00:00
d - > _s1 = _lim - > get_real ( " R11 " ) . string ( ) ; // Acc. dec.
d - > _s2 = _lim - > get_real ( " R12 " ) . string ( ) ;
d - > _s3 = _lim - > get_real ( " R13 " ) . string ( ) ;
1996-09-17 12:39:43 +00:00
// descrizione rettifiche
if ( month < 13 )
{
2000-05-05 15:25:49 +00:00
d - > _s4 = _lim - > get ( " S0 " ) ;
d - > _s5 = _lim - > get ( " S1 " ) ;
d - > _s6 = _lim - > get ( " S2 " ) ;
1996-09-17 12:39:43 +00:00
}
2001-05-01 08:17:07 +00:00
d - > _r11 = _lim - > get_real ( " R10 " ) ; // tasso di interesse (Non arrotondare!)
2000-05-05 15:25:49 +00:00
2002-02-26 16:20:19 +00:00
d - > _r15 = _lim - > get_real ( " R15 " ) ; // Credito utilizzato IVA
d - > _r16 = _lim - > get_real ( " R16 " ) ; // Credito utilizzato F24
d - > _r17 = _lim - > get_real ( " R17 " ) ; // Variazioni d'imposta
d - > _r18 = _lim - > get_real ( " R18 " ) ; // Imposta non versata
d - > _r19 = _lim - > get_real ( " R19 " ) ; // Crediti speciali
1996-09-17 12:39:43 +00:00
2000-05-05 15:25:49 +00:00
d - > _f1 = is_first_month ( month ) ;
1996-09-17 12:39:43 +00:00
1996-12-19 16:14:33 +00:00
// rispettiamo tutte le casistiche per i versamenti se non siamo in visualizzazione
// analogamente in Visualizzazione ma solo nel caso dell'annuale.
// In tutti gli altri casi va a cercare la delega
d - > _r8 = ( _month = = 13 | | ! _is_visliq ) ? _lim - > get_real ( " R8 " ) : versamenti_IVA ( _month , " 1 " ) ;
2002-05-08 16:25:49 +00:00
if ( _month = = 13 )
{
const int anno_prossimo = atoi ( _year ) + 1 ;
if ( look_lia ( 0l , FALSE , anno_prossimo ) )
d - > _r20 = _lia - > get_real ( " R0 " ) ; // Credito da riportare all'anno prossimo
}
1996-09-17 12:39:43 +00:00
// aggiunge eventuale satellite per rimborso infraannuale
if ( di ! = NULL )
{
if ( d - > _r0 . sign ( ) < 0 )
d - > _arr . add ( di ) ;
1998-04-30 15:59:34 +00:00
else
delete di ;
1996-09-17 12:39:43 +00:00
}
if ( ! _is_visliq )
{
_DescrItem * dv = describe_deleghe ( month ) ;
if ( dv ! = NULL ) d - > _arr . add ( dv ) ;
}
_descr_arr . add ( d ) ;
}
_DescrItem * TLiquidazione_app : : describe_deleghe ( int month )
{
_stampa_vers = _stampa_acc = FALSE ;
if ( _lim - > get_real ( " R0 " ) > ZERO )
{
real iva = _lim - > get_real ( " R0 " ) + _lim - > get_real ( " R14 " ) ;
1997-01-30 16:39:10 +00:00
if ( month = = 13 )
2002-02-26 16:20:19 +00:00
round_imposta ( iva ) ;
2001-05-01 08:17:07 +00:00
if ( iva > = iva_da_riportare ( _month ) )
1996-09-17 12:39:43 +00:00
_stampa_vers = TRUE ;
}
_stampa_acc = ( month = = 12 & & ( _freqviva = = " M " | | ( _isbenzinaro & & _gest4 ) ) )
| | ( month = = 13 & & _freqviva = = " T " & & ! ( _isbenzinaro & & _gest4 ) ) ;
if ( ! _stampa_vers & & ! ( _stampa_acc & & look_del ( 12 , 7 ) ) ) return NULL ;
_DescrItem * d = new _DescrItem ( DELEGA ) ;
d - > _f0 = 0 ;
//prospettino versamento
if ( _stampa_vers ) //solo se sono a debito
if ( look_del ( month , month = = 13 ? 2 : 1 ) )
{
if ( _del - > get_bool ( " B0 " ) )
{
1998-04-30 15:59:34 +00:00
//_del->S2 descr. ufficio iva/concessione
//_del->S1 descrizione banca
d - > _s0 = _del - > get ( " S9 " ) ; // Cod Ufficio concessione
d - > _s1 = _del - > get ( " S7 " ) ; // Cod ABI
d - > _s2 = _del - > get ( " S8 " ) ; // Cod CAB
1996-09-17 12:39:43 +00:00
d - > _r0 = _del - > get_real ( " R0 " ) ;
d - > _d0 = _del - > get_date ( " D0 " ) ;
} // altrimenti lascia tutto in bianco e ci scriveranno i dati a mano
}
2001-05-01 08:17:07 +00:00
1996-09-17 12:39:43 +00:00
//prospettino acconto
if ( ( month = = 12 & & ( _freqviva = = " M " | | ( _isbenzinaro & & _gest4 ) ) )
| | ( month = = 13 & & _freqviva = = " T " & & ! ( _isbenzinaro & & _gest4 ) ) )
if ( look_del ( 12 , 7 ) ) //sia che sia a debito che a credito
{
d - > _s4 = " ACC " ;
TToken_string t ;
if ( _del - > get_bool ( " B0 " ) )
{
1998-04-30 15:59:34 +00:00
//_del->S2 descr. ufficio iva/concessione
//_del->S1 descrizione banca
t . add ( _del - > get ( " S9 " ) ) ; // Cod Conc
t . add ( _del - > get ( " S7 " ) ) ; // Cod ABI
t . add ( _del - > get ( " S8 " ) ) ; // Cod CAB
1996-09-17 12:39:43 +00:00
t . add ( _del - > get_real ( " R0 " ) . string ( ) ) ;
t . add ( _del - > get ( " D0 " ) ) ;
}
d - > _s5 = t ;
}
return d ;
}
void TLiquidazione_app : : describe_consistence ( const char * codatt )
{
// controlla eventuali condizioni di conflitto con le normative
// per la ditta e crea i messaggi appropriati
// tutte le condizioni sono valutate sull'esercizio precedente
int pryear = atoi ( _year ) - 1 ;
TString att = codatt ;
_pla - > zero ( ) ;
* _pla_ditta = get_firm ( ) ;
* _pla_anno = pryear ;
* _pla_codatt = att ;
if ( _pla - > read ( ) = = NOERR )
{
real va = _pla - > get_real ( " R0 " ) ;
// 1) consistenza volume d'affari <-> frequenza versamenti
// deve essere: trimestrale ammesso solo se < 360.000.000
// per servizi, < 1.000.000.000 per altre imprese
// a meno che non sia benzinaro che ha diritto comunque
if ( _freqviva = = " T " & & ! _isbenzinaro )
{
bool err = FALSE ;
if ( _isservizio ) err = va > SOGLIA_TRIM_SERVIZI ;
else err = va > SOGLIA_TRIM_ALTRE ;
if ( err )
2003-03-20 12:25:48 +00:00
describe_error ( TR ( " Incoerenza volume affari/frequenza versamenti " ) ,
1996-09-17 12:39:43 +00:00
att ) ;
}
}
}
void TLiquidazione_app : : describe_error ( const char * err , const char * codatt )
{
if ( ! _isprint | | ! _canprint | | ( _isregis & & _isfinal ) ) return ;
_errors . add ( new _ErrItem ( err , codatt , _nditte - > curr ( ) . get ( " CODDITTA " ) ) ) ;
}
// ----------------------------------------------------------------
// Setrows
// ----------------------------------------------------------------
void TLiquidazione_app : : set_firm ( _DescrItem & d )
{
TString tim_title ( 80 ) ;
2003-03-20 12:25:48 +00:00
tim_title < < TR ( " Liquidazione IVA " ) ;
1996-09-17 12:39:43 +00:00
if ( d . _f1 = = 13 )
2003-03-20 12:25:48 +00:00
tim_title < < format ( FR ( " : Riepilogo Annuale %s " ) , ( const char * ) _year ) ;
1996-09-17 12:39:43 +00:00
else
{
if ( d . _s2 = = " T " )
2003-03-20 12:25:48 +00:00
tim_title < < format ( FR ( " del %d<> Trimestre %s " ) , d . _f1 / 3 , ( const char * ) _year ) ;
1996-09-17 12:39:43 +00:00
else
2003-03-20 12:25:48 +00:00
tim_title < < format ( FR ( " del mese di %s %s " ) , itom ( d . _f1 ) ,
1996-09-17 12:39:43 +00:00
( const char * ) _year ) ;
}
reset_header ( ) ;
int soh = 1 ;
if ( ! _isregis )
{
2003-03-20 12:25:48 +00:00
set_header ( soh + + , FR ( " Ditta %s %s@107gData @>@125gPag. @# " ) ,
1996-09-17 12:39:43 +00:00
( const char * ) ( d . _s0 ) , ( const char * ) ( d . _s1 ) ) ;
set_header ( soh + + , " " ) ;
}
set_header ( soh + + , sep ) ;
2003-03-20 12:25:48 +00:00
set_header ( soh + + , FR ( " %s@102gFrequenza %s " ) ,
1996-09-17 12:39:43 +00:00
( const char * ) tim_title ,
2003-03-20 12:25:48 +00:00
d . _s2 = = " T " ? TR ( " Trimestrale " ) : TR ( " Mensile " ) ) ;
1996-09-17 12:39:43 +00:00
set_header ( soh + + , sep ) ;
set_header ( soh + + , " " ) ;
// notify errors if any
int j = 0 ;
2007-01-03 17:07:40 +00:00
int i ;
for ( i = 0 ; i < _errors . items ( ) ; i + + )
1996-09-17 12:39:43 +00:00
{
_ErrItem & s = ( _ErrItem & ) _errors [ i ] ;
if ( s . _att = = " ALL " & & s . _firm = = d . _s0 )
{ j + + ; set_row ( i + 3 , " @5g@b*** %s ***@r " , ( const char * ) s . _err ) ; }
}
if ( j ) set_row ( i + 3 , " " ) ;
}
void TLiquidazione_app : : set_att ( _DescrItem & d )
{
// set header
TString tim_title ( 78 ) ;
TString att_title ( 48 ) ;
// Bookmark
TString book_name ( d . _s3 ) ;
char flags = ( char ) d . _f3 ;
2003-03-20 12:25:48 +00:00
if ( flags = = ' 1 ' ) book_name < < TR ( " (servizi) " ) ;
else if ( flags = = ' 2 ' ) book_name < < TR ( " (altre) " ) ;
else if ( flags = = ' M ' ) book_name = TR ( " Riepilogo att. mista " ) ;
else if ( flags = = ' Q ' ) book_name = TR ( " Riepilogo quater " ) ;
1996-09-17 12:39:43 +00:00
if ( _firm_bookmark = = - 1 )
_firm_bookmark = set_bookmark ( d . _s1 ) ;
_att_bookmark = set_bookmark ( book_name , _firm_bookmark ) ;
2003-03-20 12:25:48 +00:00
tim_title < < TR ( " Liquidazione IVA " ) ;
1996-09-17 12:39:43 +00:00
if ( d . _f1 = = 13 )
{
if ( d . _s4 = = " T " & & ! ( d . _f2 ) ) // trimestrale e non benzinaro
2003-03-20 12:25:48 +00:00
tim_title < < format ( FR ( " : Riepilogo Annuale %s " ) , ( const char * ) _year ) ;
1996-09-17 12:39:43 +00:00
else
2003-03-20 12:25:48 +00:00
tim_title < < format ( FR ( " : Dichiarazione Annuale %s " ) , ( const char * ) _year ) ;
1996-09-17 12:39:43 +00:00
}
else
{
if ( d . _s4 = = " T " )
2003-03-20 12:25:48 +00:00
tim_title < < format ( FR ( " del %d<> Trimestre %s " ) , d . _f1 / 3 , ( const char * ) _year ) ;
1996-09-17 12:39:43 +00:00
else
2003-03-20 12:25:48 +00:00
tim_title < < format ( FR ( " del mese di %s %s " ) , itom ( d . _f1 ) ,
1996-09-17 12:39:43 +00:00
( const char * ) _year ) ;
}
TString tipatt ;
if ( d . _f0 > 0 )
2003-03-20 12:25:48 +00:00
tipatt . format ( d . _f0 = = 1 ? TR ( " SERVIZI " ) : TR ( " ALTRE ATTIVITA' " ) ) ;
1996-09-17 12:39:43 +00:00
if ( d . _s3 . empty ( ) )
{
2003-03-20 12:25:48 +00:00
att_title = flags = = ' M ' ? TR ( " Riepilogo attivita' mista " ) :
TR ( " Riepilogo quater " ) ;
1996-09-17 12:39:43 +00:00
// att_title << d._s2;
}
else
2003-03-20 12:25:48 +00:00
att_title = format ( FR ( " Attivita' %s %s %s " ) ,
1996-09-17 12:39:43 +00:00
( const char * ) ( d . _s2 ) ,
( const char * ) ( d . _s3 ) ,
( const char * ) tipatt ) ;
reset_header ( ) ;
int soh = 1 ;
if ( ! _isregis )
{
2003-03-20 12:25:48 +00:00
set_header ( soh + + , FR ( " Ditta %s %s@107gData @>@125gPag. @# " ) ,
1996-09-17 12:39:43 +00:00
( const char * ) ( d . _s0 ) , ( const char * ) ( d . _s1 ) ) ;
set_header ( soh + + , " " ) ;
}
set_header ( soh + + , sep ) ;
set_header ( soh + + , " %s@55g%s " , ( const char * ) tim_title , ( const char * ) att_title ) ;
set_header ( soh + + , sep ) ;
set_header ( soh + + , " " ) ;
// notify errors if any
int j = 0 ;
for ( int i = 0 ; i < _errors . items ( ) ; i + + )
{
_ErrItem & s = ( _ErrItem & ) _errors [ i ] ;
if ( d . _s2 = = s . _att & & s . _firm = = d . _s0 )
{ j + + ; set_row ( i + 10 , " @5g@b*** %s ***@r " , ( const char * ) s . _err ) ; }
}
if ( j ) set_auto_ff ( TRUE ) ;
}
void TLiquidazione_app : : set_plafond ( _DescrItem & d )
{
1999-04-26 15:58:05 +00:00
// In caso di stampa liquidazione da stampa registri, il prospetto plafond
// complessivo va evidenziato in testa; solo nel caso di trimestrali.
if ( _isregis & & _freqviva = = " M " ) return ;
1996-09-17 12:39:43 +00:00
2003-03-20 12:25:48 +00:00
set_bookmark ( TR ( " Quadro plafond " ) , _att_bookmark ) ;
1996-09-17 12:39:43 +00:00
1999-04-06 15:34:39 +00:00
real r1 = d . _r1 + d . _r0 ;
real r2 = d . _r4 + d . _r3 ;
real r3 = d . _r7 + d . _r6 ;
real disponibile = d . _r2 + d . _r5 + d . _r8 ;
real riporto = disponibile - r1 - r2 - r3 ;
1996-09-17 12:39:43 +00:00
set_print_zero ( TRUE ) ;
2003-03-20 12:25:48 +00:00
set_row ( 1 , TR ( " QUADRO RELATIVO ALLA DISPONIBILITA' ED ALL'UTILIZZO "
" MENSILE DEI PLAFONDS " ) ) ;
1996-09-17 12:39:43 +00:00
1999-04-06 15:34:39 +00:00
set_row ( 2 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 3 , FR ( " @31gDisponibile@48g%r " ) , & ( disponibile ) ) ;
set_row ( 4 , TR ( " Art. 8 1<> comma lettere a-b " ) ) ;
set_row ( 5 , FR ( " Utilizzato all'interno@48g%r " ) , & ( d . _r0 ) ) ;
set_row ( 6 , FR ( " Utilizzato per l'importazione@48g%r " ) , & ( d . _r1 ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( 7 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 8 , TR ( " Art. 8bis 1<> comma " ) ) ;
set_row ( 9 , FR ( " Utilizzato all'interno@48g%r " ) , & ( d . _r3 ) ) ;
set_row ( 10 , FR ( " Utilizzato per l'importazione@48g%r " ) , & ( d . _r4 ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( 11 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 12 , TR ( " Art. 9 1<> comma " ) ) ;
set_row ( 13 , FR ( " Utilizzato all'interno@48g%r " ) , & ( d . _r6 ) ) ;
set_row ( 14 , FR ( " Utilizzato per l'importazione@48g%r " ) , & ( d . _r7 ) ) ;
set_row ( 15 , FR ( " @31gRiporto@48g%r " ) , & ( riporto ) ) ;
1996-09-17 12:39:43 +00:00
set_print_zero ( FALSE ) ;
set_auto_ff ( ) ;
}
2001-05-01 08:17:07 +00:00
void TLiquidazione_app : : set_liqacc_1999 ( _DescrItem & d )
1996-09-17 12:39:43 +00:00
{
real r1 = d . _r0 + d . _r1 + d . _r2 + d . _r4 ;
1997-10-23 09:34:10 +00:00
//real r2 = d._r5 + d._r10;
real r2 = d . _r5 ; //MI2258 (A me sembra una cagata, ma con certa gente non si riesce a parlare)
1996-09-17 12:39:43 +00:00
real r3 = r2 + d . _r9 + d . _r7 ;
if ( ( d . _r3 ) . sign ( ) > 0 ) r1 + = d . _r3 ;
else r3 + = abs ( d . _r3 ) ;
set_row ( 1 , " " ) ; set_row ( 2 , " " ) ; set_row ( 3 , " " ) ; set_row ( 4 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 5 , FR ( " @11gCALCOLO ACCONTO SU OPERAZIONI EFFETTUATE " ) ) ;
2001-05-01 08:17:07 +00:00
1996-09-17 12:39:43 +00:00
set_row ( 6 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 7 , FR ( " @72gCredito@90gDebito " ) ) ; set_row ( 8 , " " ) ;
1996-09-17 12:39:43 +00:00
if ( ! _isdiffacc )
2003-03-20 12:25:48 +00:00
set_row ( 9 , FR ( " @11gIva sulle operazioni annotate fino al 20 Dicembre@81g%r " ) , & ( d . _r0 ) ) ;
2000-05-05 15:25:49 +00:00
else
2003-03-20 12:25:48 +00:00
set_row ( 9 , FR ( " @11gIva sulle operazioni di vendita@81g%r " ) , & ( d . _r0 ) ) ;
1996-09-17 12:39:43 +00:00
int i = 10 ;
if ( ! _isdiffacc )
{
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @11gIva su operazioni fino al 20 Dic., ma non fatturate@81g%r " ) , & ( d . _r1 ) ) ;
set_row ( i + + , FR ( " @11gIva su operazioni fino al 20 Dic., ma non annotate@81g%r " ) , & ( d . _r2 ) ) ;
1996-09-17 12:39:43 +00:00
}
2003-03-20 12:25:48 +00:00
set_row ( i , FR ( " @11gRettifiche iva a debito " ) ) ;
1996-09-17 12:39:43 +00:00
if ( d . _r3 . sign ( ) > 0 )
set_row ( i , " @81g%r " , & ( d . _r3 ) ) ;
i + + ;
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @11gIva chiesta a rimborso@81g%r " ) , & ( d . _r4 ) ) ;
set_row ( i + + , FR ( " @11gRISULTATO@81g%r " ) , & r1 ) ;
1996-09-17 12:39:43 +00:00
if ( ! _isdiffacc )
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @11gIva sugli acquisti annotati fino al 20 Dicembre@64g%r " ) , & r2 ) ;
2000-05-05 15:25:49 +00:00
else
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @11gIva sulle operazioni di acquisto@64g%r " ) , & r2 ) ;
1996-09-17 12:39:43 +00:00
if ( d . _r6 ! = ZERO )
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @11gmeno perc. di prorata pari a lire %r " ) , & ( d . _r6 ) ) ;
set_row ( i + + , FR ( " @11gCredito precedente@64g%r " ) , & ( d . _r9 ) ) ;
set_row ( i , FR ( " @11gRettifiche iva a credito " ) ) ;
1996-09-17 12:39:43 +00:00
if ( ( d . _r3 ) . sign ( ) < = 0 )
{
real ab = abs ( d . _r3 ) ;
set_row ( i , " @64g%r " , & ab ) ;
}
i + + ;
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @11gRISULTATO@64g%r " ) , & r3 ) ;
1996-09-17 12:39:43 +00:00
if ( ( d . _r8 ) . sign ( ) < 0 )
{
real ab = abs ( d . _r8 ) ;
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @23gCREDITO DA EVIDENZIARE@64g%r " ) , & ab ) ;
1996-09-17 12:39:43 +00:00
}
else if ( ( d . _r8 ) . sign ( ) > 0 & & d . _r8 > _ver - > get ( I_ACCONTOIVA ) )
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @23gACCONTO DA VERSARE@81g%r " ) , & ( d . _r8 ) ) ;
1996-09-17 12:39:43 +00:00
else if ( ( d . _r8 ) . sign ( ) > 0 & & d . _r8 < = _ver - > get ( I_ACCONTOIVA ) )
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @23gACCONTO DA NON VERSARE@64g%r " ) , & ( d . _r8 ) ) ;
1996-09-17 12:39:43 +00:00
set_auto_ff ( ) ;
}
2001-05-01 08:17:07 +00:00
void TLiquidazione_app : : set_liqacc_2000 ( _DescrItem & d )
{
set_row ( 1 , " " ) ; set_row ( 2 , " " ) ; set_row ( 3 , " " ) ; set_row ( 4 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 5 , FR ( " @11gCALCOLO ACCONTO SU OPERAZIONI EFFETTUATE " ) ) ;
2001-05-01 08:17:07 +00:00
if ( ! _isdiffacc )
2003-03-20 12:25:48 +00:00
set_row ( 5 , TR ( " FINO AL 20 DICEMBRE " ) ) ;
2001-05-01 08:17:07 +00:00
set_row ( 6 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 7 , FR ( " @72gCredito@90gDebito " ) ) ; set_row ( 8 , " " ) ;
2001-05-01 08:17:07 +00:00
if ( d . _r3 > ZERO )
d . _r0 + = d . _r3 ; // Aggiungi rettifiche a debito
2008-03-11 15:08:43 +00:00
int i = 9 ;
2001-05-01 08:17:07 +00:00
if ( ! _isdiffacc )
2008-03-11 15:08:43 +00:00
{
set_row ( i + + , FR ( " @11gIva esigibile fino al 20/12@81g%r " ) , & d . _r0 ) ;
if ( d . _r29 > ZERO )
set_row ( i + + , FR ( " @11gIVA a liquidazione differita incassata fino al 20/12@75g%r " ) , & d . _r29 ) ;
2009-05-26 10:23:47 +00:00
if ( d . _r33 > ZERO )
set_row ( i + + , FR ( " @11gIVA a liquidazione differita pagata fino al 20/12@64g%r " ) , & d . _r33 ) ;
2008-03-11 15:08:43 +00:00
}
2001-05-01 08:17:07 +00:00
else
2008-03-11 15:08:43 +00:00
{
set_row ( i + + , FR ( " @11gIva sulle operazioni di vendita@81g%r " ) , & d . _r0 ) ;
if ( d . _r29 > ZERO )
set_row ( i + + , FR ( " @11gIVA a liquidazione differita incassata@75g%r " ) , & d . _r29 ) ;
2009-05-26 10:23:47 +00:00
if ( d . _r33 > ZERO )
set_row ( i + + , FR ( " @11gIVA a liquidazione differita pagata@64g%r " ) , & d . _r33 ) ;
2008-03-11 15:08:43 +00:00
}
2001-05-01 08:17:07 +00:00
if ( ! _isdiffacc )
{
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @11gIva esigibile fino al 20/12 di cui non fatturata@81g%r " ) , & d . _r1 ) ;
set_row ( i + + , FR ( " @11gIva esigibile fino al 20/12 di cui non annotata@81g%r " ) , & d . _r2 ) ;
2001-05-01 08:17:07 +00:00
}
if ( d . _r3 < ZERO )
d . _r5 - = d . _r3 ; // Aggiungi rettifiche a credito
if ( ! _isdiffacc )
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @11gIva che si detrae fino al 20/12@64g%r " ) , & d . _r5 ) ;
2001-05-01 08:17:07 +00:00
else
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @11gIva sulle operazioni di acquisto@64g%r " ) , & d . _r5 ) ;
2001-05-01 08:17:07 +00:00
2003-03-20 12:25:48 +00:00
set_row ( i , FR ( " @11gIVA a debito/credito per il periodo " ) ) ;
2001-05-01 08:17:07 +00:00
real iva_dov_cre = d . _r0 + d . _r1 + d . _r2 - d . _r5 ;
if ( iva_dov_cre > = ZERO )
set_row ( i + + , " @81g%r " , & iva_dov_cre ) ;
else
{
const real tmp = - iva_dov_cre ;
set_row ( i + + , " @64g%r " , & tmp ) ;
}
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @11gDebito/Credito da periodo precedente@64g%r " ) , & d . _r9 ) ;
2001-05-01 08:17:07 +00:00
2003-03-20 12:25:48 +00:00
set_row ( i , FR ( " @11gIVA Dovuta o a Credito " ) ) ;
2001-05-01 08:17:07 +00:00
const real risultato = iva_dov_cre - d . _r9 ;
2004-01-28 12:05:33 +00:00
if ( risultato > = ZERO )
set_row ( i + + , " @81g%r " , & risultato ) ;
2001-05-01 08:17:07 +00:00
else
{
const real tmp = - risultato ;
2004-01-28 12:05:33 +00:00
set_row ( i + + , " @64g%r " , & tmp ) ;
2001-05-01 08:17:07 +00:00
}
// Acconto
if ( d . _r8 < ZERO )
{
const real ab = abs ( d . _r8 ) ;
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @23gCREDITO DA EVIDENZIARE@64g%r " ) , & ab ) ;
2001-05-01 08:17:07 +00:00
}
else if ( d . _r8 > ZERO )
{
const real acconto_minimo = _ver - > get ( I_ACCONTOIVA ) ;
if ( d . _r8 > acconto_minimo )
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @23gACCONTO DA VERSARE@81g%r " ) , & d . _r8 ) ;
2001-05-01 08:17:07 +00:00
else
2003-03-20 12:25:48 +00:00
set_row ( i + + , FR ( " @23gACCONTO DA NON VERSARE@81g%r " ) , & d . _r8 ) ;
2001-05-01 08:17:07 +00:00
}
set_auto_ff ( ) ;
}
1996-09-17 12:39:43 +00:00
void TLiquidazione_app : : set_pim_head ( _DescrItem & d )
{
2008-03-11 15:08:43 +00:00
int r = 1 ;
if ( d . _flags = = PIM_HEAD )
2003-03-20 12:25:48 +00:00
set_bookmark ( TR ( " Riepilogo progressivi " ) , _att_bookmark ) ;
2008-03-11 15:08:43 +00:00
else
{
set_row ( r + + , " " ) ;
if ( d . _flags = = PIM_HEAD_D )
{
set_row ( r + + , TR ( " Fatture a liquidazione differita " ) ) ;
set_bookmark ( TR ( " Riepilogo progressivi a liquidazione differita " ) , _att_bookmark ) ;
}
else
if ( d . _flags = = PIM_HEAD_DI )
{
set_row ( r + + , TR ( " Fatture a liquidazione differita incassate " ) ) ;
set_bookmark ( TR ( " Riepilogo progressivi a liquidazione differita incassati " ) , _att_bookmark ) ;
}
else // PIS_HEAD
{
if ( d . _flags = = PIS_HEAD )
{
set_row ( r + + , TR ( " Di cui da periodo successivo " ) ) ;
set_row ( r + + , " " ) ;
set_bookmark ( TR ( " Riepilogo progressivi successivi " ) , _att_bookmark ) ;
}
else
if ( d . _flags = = PIS_HEAD_D )
{
set_row ( r + + , TR ( " Fatture a liquidazione differita " ) ) ;
set_bookmark ( TR ( " Riepilogo progressivi successivi a liquidazione differita " ) , _att_bookmark ) ;
}
else
if ( d . _flags = = PIS_HEAD_DI )
{
set_row ( r + + , TR ( " Fatture a liquidazione differita incassate " ) ) ;
set_bookmark ( TR ( " Riepilogo progressivi successivi a liquidazione differita incassati " ) , _att_bookmark ) ;
}
}
set_row ( r + + , " " ) ;
}
1996-09-17 12:39:43 +00:00
if ( d . _f0 )
{
2008-03-11 15:08:43 +00:00
if ( d . _flags = = PIM_HEAD | | d . _flags = = PIS_HEAD )
{
set_row ( r + + , FR ( " Cod.@41gVENDITE@71gCORRISPETTIVI " ) ) ;
set_row ( r + + , FR ( " IVA Descrizione@30gImponibile@49gImposta@63gImponibile@82gImposta " ) ) ;
set_row ( r , " " ) ;
}
/* else
{
set_row ( r + + , FR ( " Cod.@41gVENDITE " ) ) ;
set_row ( r + + , FR ( " IVA Descrizione@30gImponibile@49gImposta " ) ) ;
} */
1996-09-17 12:39:43 +00:00
}
else
{
2008-03-11 15:08:43 +00:00
if ( d . _flags = = PIM_HEAD | | d . _flags = = PIS_HEAD )
{
set_row ( r + + , FR ( " Cod.@41gVENDITE@71gCORRISPETTIVI@106gACQUISTI " ) ) ;
set_row ( r + + , FR ( " IVA Descrizione@30gImponibile@49gImposta@63gImponibile "
" @82gImposta@96gImponibile@115gImposta " ) ) ;
set_row ( r , " " ) ;
}
/* else
{
set_row ( r + + , FR ( " Cod.@41gVENDITE " ) ) ;
set_row ( r + + , FR ( " IVA Descrizione@30gImponibile@49gImposta " ) ) ;
} */
1996-09-17 12:39:43 +00:00
}
}
void TLiquidazione_app : : set_pim ( _DescrItem & d )
{
// succede con le autocazzate non residenti non movimentate eccetera
1996-12-04 09:14:38 +00:00
const bool a = ( d . _r0 + d . _r1 ) = = ZERO ;
const bool b = ( d . _r2 + d . _r3 ) = = ZERO ;
const bool c = ( d . _r4 + d . _r5 ) = = ZERO ;
2008-03-11 15:08:43 +00:00
const bool e = ( d . _r26 + d . _r27 ) = = ZERO ;
const bool f = ( d . _r28 + d . _r29 ) = = ZERO ;
2009-05-26 10:23:47 +00:00
const bool g = ( d . _r30 + d . _r31 ) = = ZERO ;
const bool h = ( d . _r32 + d . _r33 ) = = ZERO ;
1996-12-04 09:14:38 +00:00
2009-05-26 10:23:47 +00:00
if ( a & & b & & c & & e & & f & & g & & h )
1996-09-17 12:39:43 +00:00
return ;
int rw = 1 ;
1996-11-20 15:02:44 +00:00
if ( d . _s1 = = " AF " ) //Il dio sistema colpisce ancora, non va bene A35, ma AF...
2003-03-20 12:25:48 +00:00
d . _s2 = TR ( " Artt.17c3/74c1 " ) ; // La descrizione non la metto uguale perche' cosi e' piu' fika
1997-12-01 16:14:48 +00:00
else if ( d . _s1 = = " VA7 " ) // Sempre per merito del dio sistema ho dovuto aggiungere VA7.
2003-03-20 12:25:48 +00:00
d . _s2 = TR ( " Art.40c5/6/8 a.i. " ) ;
1996-09-17 12:39:43 +00:00
else if ( d . _s0 = = " 74TER " )
rw + + ;
else
{
look_iva ( d . _s1 ) ;
d . _s2 = _iva - > get ( " S0 " ) ;
if ( d . _s2 . len ( ) > 19 ) d . _s2 . cut ( 19 ) ;
}
2008-03-11 15:08:43 +00:00
if ( d . _flags = = PIM_ROW | | d . _flags = = PIS_ROW )
{
set_row ( rw + + , " %4s %s@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r " ,
( const char * ) d . _s1 , ( const char * ) d . _s2 ,
& ( d . _r0 ) , & ( d . _r1 ) , & ( d . _r2 ) , & ( d . _r3 ) , & ( d . _r4 ) , & ( d . _r5 ) ) ;
}
else
if ( d . _flags = = PIM_ROW_D | | d . _flags = = PIS_ROW_D )
{
2009-05-26 10:23:47 +00:00
set_row ( rw + + , " %4s %s@25g%r@41g%r@91g%r@107g%r " ,
2008-03-11 15:08:43 +00:00
( const char * ) d . _s1 , ( const char * ) d . _s2 ,
2009-05-26 10:23:47 +00:00
& ( d . _r26 ) , & ( d . _r27 ) , & ( d . _r30 ) , & ( d . _r31 ) ) ;
2008-03-11 15:08:43 +00:00
}
else
if ( d . _flags = = PIM_ROW_DI | | d . _flags = = PIS_ROW_DI )
{
2009-05-26 10:23:47 +00:00
set_row ( rw + + , " %4s %s@25g%r@41g%r@91g%r@107g%r " ,
2008-03-11 15:08:43 +00:00
( const char * ) d . _s1 , ( const char * ) d . _s2 ,
2009-05-26 10:23:47 +00:00
& ( d . _r28 ) , & ( d . _r29 ) , & ( d . _r32 ) , & ( d . _r33 ) ) ;
2008-03-11 15:08:43 +00:00
}
}
void TLiquidazione_app : : set_plm_diff ( _DescrItem & d )
{
int rw = 1 ;
set_row ( rw + + , " " ) ; set_row ( rw + + , " " ) ;
if ( d . _flags = = TOT_ROW_D )
2009-05-26 10:23:47 +00:00
set_row ( rw + + , FR ( " Totale@25g%r@41g%r@91g%r@107g%r " ) , & ( d . _r26 ) , & ( d . _r27 ) , & ( d . _r30 ) , & ( d . _r31 ) ) ;
2008-03-11 15:08:43 +00:00
else
2009-05-26 10:23:47 +00:00
set_row ( rw + + , FR ( " Totale@25g%r@41g%r@91g%r@107g%r " ) , & ( d . _r28 ) , & ( d . _r29 ) , & ( d . _r32 ) , & ( d . _r33 ) ) ;
2008-03-11 15:08:43 +00:00
set_row ( rw + + , " " ) ;
1996-09-17 12:39:43 +00:00
}
void TLiquidazione_app : : set_plm ( _DescrItem & d )
{
int rw = 1 ;
if ( ! ( d . _r0 . is_zero ( ) & &
d . _r1 . is_zero ( ) & &
d . _r2 . is_zero ( ) & &
d . _r3 . is_zero ( ) & &
d . _r4 . is_zero ( ) & &
d . _r5 . is_zero ( ) ) )
{
set_row ( rw + + , " " ) ; set_row ( rw + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " Totale@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( d . _r0 ) ,
& ( d . _r1 ) ,
& ( d . _r2 ) ,
& ( d . _r3 ) ,
& ( d . _r4 ) ,
& ( d . _r5 ) ) ;
set_row ( rw + + , " " ) ;
}
if ( ! ( d . _r7 . is_zero ( ) & & d . _r8 . is_zero ( ) ) )
{
2008-03-11 16:48:19 +00:00
set_row ( rw + + , FR ( " Totale acquisti indeducibili per art.19@91g%r@107g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( d . _r7 ) , & ( d . _r8 ) ) ;
}
if ( ! ( d . _r9 . is_zero ( ) & & d . _r10 . is_zero ( ) ) )
{
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " Totale acquisti indeducibili su ricavi esenti@91g%r@107g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( d . _r9 ) ,
& ( d . _r10 ) ) ;
}
real acq_pint ( d . _s0 ) ;
real acq_pint_iva ( d . _s1 ) ;
if ( ! ( acq_pint . is_zero ( ) & & acq_pint_iva . is_zero ( ) ) )
{
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " Totale acquisti indeducibili per passaggi interni@91g%r@107g%r " ) ,
1996-09-17 12:39:43 +00:00
& acq_pint ,
& acq_pint_iva ) ;
}
real tot1 = d . _r7 + d . _r4 + d . _r9 + acq_pint ;
real tot2 = d . _r8 + d . _r5 + d . _r10 + acq_pint_iva ;
if ( tot1 ! = d . _r4 | | tot2 ! = d . _r5 )
{
// i corrispettivi finiscono nelle vendite
d . _r0 + = d . _r2 ;
d . _r1 + = d . _r3 ;
d . _r2 = ZERO ;
d . _r3 = ZERO ;
// per ora lascio r2 e r3 anche se sono sempre 0
set_row ( rw + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " Totale Generale IVA@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( d . _r0 ) ,
& ( d . _r1 ) ,
& ( d . _r2 ) ,
& ( d . _r3 ) ,
& tot1 ,
& tot2 ) ;
}
1999-04-06 15:34:39 +00:00
// Stampa il totale progressivo da registri, comprensivo dei movimenti valevoli per il calcolo vol. affari.
real pr_imp ( d . _s2 ) ;
real pr_iva ( d . _s3 ) ;
if ( ! ( d . _r11 . is_zero ( ) & &
d . _r12 . is_zero ( ) & &
d . _r13 . is_zero ( ) & &
d . _r14 . is_zero ( ) & &
pr_imp . is_zero ( ) & &
pr_iva . is_zero ( ) ) )
{
set_row ( rw + + , " " ) ; set_row ( rw + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " Totale Prog. da registri@25g%r@41g%r@58g%r@74g%r@91g%r@107g%r " ) ,
1999-04-06 15:34:39 +00:00
& ( d . _r11 ) ,
& ( d . _r12 ) ,
& ( d . _r13 ) ,
& ( d . _r14 ) ,
& ( pr_imp ) ,
& ( pr_iva ) ) ;
set_row ( rw + + , " " ) ;
}
1996-09-17 12:39:43 +00:00
}
void TLiquidazione_app : : set_pumpam ( _DescrItem & d )
{
bool printed = FALSE ;
// d._f1 dice se c'era qualcosa sopra nella stessa pagina
real spgn ( d . _s2 ) ;
real spgn_iva ( d . _s3 ) ;
TToken_string tt ( d . _s4 ) ; // Token String
TToken_string dp ( d . _s0 ) ; // Due Palle
real aqsi ( tt . get ( 0 ) ) ;
real aqsv ( tt . get ( 1 ) ) ;
real vnsi ( tt . get ( 2 ) ) ;
real vnsv ( tt . get ( 3 ) ) ;
1999-04-06 15:34:39 +00:00
real aqli ( tt . get ( 4 ) ) ;
real aqlv ( tt . get ( 5 ) ) ;
real vnli ( tt . get ( 6 ) ) ;
real vnlv ( tt . get ( 7 ) ) ;
1996-09-17 12:39:43 +00:00
real ammindi ( dp . get ( 1 ) ) ;
real ammindv ( dp . get ( 2 ) ) ;
int row = 5 ;
if ( ! ( aqsi . is_zero ( ) & & aqsv . is_zero ( ) ) )
{
printed = TRUE ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " Acquisti in sospensione di imposta@50g%r@69g%r " ) ,
1996-09-17 12:39:43 +00:00
& aqsi ,
& aqsv ) ;
}
if ( ! ( vnsi . is_zero ( ) & & vnsv . is_zero ( ) ) )
{
printed = TRUE ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " Vendite in sospensione di imposta@50g%r@69g%r " ) ,
1996-09-17 12:39:43 +00:00
& vnsi ,
& vnsv ) ;
}
1999-04-06 15:34:39 +00:00
if ( ! ( aqli . is_zero ( ) & & aqlv . is_zero ( ) ) )
{
printed = TRUE ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " IVA ad esigibilit<69> differ. da detrarre nel periodo@50g%r@69g%r " ) ,
1999-04-06 15:34:39 +00:00
& aqli ,
& aqlv ) ;
}
if ( ! ( vnli . is_zero ( ) & & vnlv . is_zero ( ) ) )
{
printed = TRUE ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " IVA ad esigibilit<69> differ. da pagare nel periodo@50g%r@69g%r " ) ,
1999-04-06 15:34:39 +00:00
& vnli ,
& vnlv ) ;
}
1996-09-17 12:39:43 +00:00
if ( ! ( d . _r8 . is_zero ( ) & & d . _r9 . is_zero ( ) ) )
{
printed = TRUE ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " Cessione beni ammortizzabili@50g%r@69g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( d . _r8 ) ,
& ( d . _r9 ) ) ;
}
if ( ! ( d . _r4 . is_zero ( ) & & d . _r5 . is_zero ( ) ) )
{
printed = TRUE ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " Acquisto beni destinati alla rivendita@50g%r@69g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( d . _r4 ) ,
& ( d . _r5 ) ) ;
}
if ( ! ( ammindi . is_zero ( ) & & ammindv . is_zero ( ) ) )
{
printed = TRUE ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " Acquisto beni ammortizzabili IVA indetraibile@50g%r@69g%r " ) ,
1996-09-17 12:39:43 +00:00
& ammindi ,
& ammindv ) ;
}
if ( ! ( d . _r0 . is_zero ( ) & & d . _r1 . is_zero ( ) ) )
{
printed = TRUE ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " Acquisto beni ammortizzabili IVA detraibile@50g%r@69g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( d . _r0 ) ,
& ( d . _r1 ) ) ;
}
if ( ! ( d . _r6 . is_zero ( ) & & d . _r7 . is_zero ( ) ) )
{
printed = TRUE ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " Altri beni strumentali acquisiti in leasing@50g%r@69g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( d . _r6 ) ,
& ( d . _r7 ) ) ;
}
if ( ! ( d . _r2 . is_zero ( ) & & d . _r3 . is_zero ( ) ) )
{
printed = TRUE ;
2000-10-03 13:45:12 +00:00
// real rn = d._r2 * real(DETRAZIONE_6PERCENTO); // Detrazione obsoleta CM500344
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " Acquisto beni soggetti a detrazione (6%%) "
" @50g%r@69g%r " ) , & ( d . _r2 ) , & ( d . _r3 ) ) ;
1996-09-17 12:39:43 +00:00
}
if ( ! ( spgn . is_zero ( ) & & spgn_iva . is_zero ( ) ) )
{
printed = TRUE ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " Spese generali@50g%r@69g%r " ) ,
1996-09-17 12:39:43 +00:00
& spgn ,
& spgn_iva ) ;
}
1999-04-06 15:34:39 +00:00
// Prorata...
int yy = atoi ( _year ) ;
1996-09-17 12:39:43 +00:00
if ( d . _f0 )
1997-12-24 09:40:34 +00:00
{
1999-04-06 15:34:39 +00:00
printed = TRUE ;
1996-09-17 12:39:43 +00:00
1999-04-06 15:34:39 +00:00
if ( yy > 1997 ) // prorata 1998
{
real prc ( dp . get ( 0 ) ) ;
real rprc = CENTO - prc ;
TString ss ( rprc . string ( ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " %% PRO-RATA (%s%%) ed IVA non detraibile (%s%%)@69g%r " ) ,
1999-04-06 15:34:39 +00:00
( const char * ) ss , ( const char * ) prc . string ( ) , & ( d . _r11 ) ) ;
1999-05-24 13:34:11 +00:00
yy - = 2 ;
1999-04-06 15:34:39 +00:00
if ( d . _r13 ! = INVALID_PRORATA & & d . _r12 ! = ZERO )
1998-04-30 15:59:34 +00:00
{
1999-04-06 15:34:39 +00:00
rprc = CENTO - d . _r13 ;
ss = rprc . string ( ) ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " %% PRO-RATA %d (%s%%) ed IVA non detraibile (%s%%)@69g%r " ) ,
1999-04-06 15:34:39 +00:00
yy , ( const char * ) ss , ( const char * ) d . _r13 . string ( ) , & ( d . _r12 ) ) ;
1998-04-30 15:59:34 +00:00
}
1999-04-06 15:34:39 +00:00
else
if ( ! _isfinal & & d . _r13 = = INVALID_PRORATA_ASSERT )
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " Impossibile reperire la %% PRO-RATA relativa all'anno %d. " ) , yy ) ;
1999-04-06 15:34:39 +00:00
yy - - ;
if ( d . _r15 ! = INVALID_PRORATA & & d . _r14 ! = ZERO )
1997-12-24 09:40:34 +00:00
{
1999-04-06 15:34:39 +00:00
rprc = CENTO - d . _r15 ;
ss = rprc . string ( ) ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " %% PRO-RATA %d (%s%%) ed IVA non detraibile (%s%%)@69g%r " ) ,
1999-04-06 15:34:39 +00:00
yy , ( const char * ) ss , ( const char * ) d . _r15 . string ( ) , & ( d . _r14 ) ) ;
1997-12-24 09:40:34 +00:00
}
1999-04-06 15:34:39 +00:00
else
if ( ! _isfinal & & d . _r15 = = INVALID_PRORATA_ASSERT )
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " Impossibile reperire la %% PRO-RATA relativa all'anno %d. " ) , yy ) ;
1999-04-06 15:34:39 +00:00
}
else
{
1999-04-26 15:58:05 +00:00
real prc ( dp . get ( 0 ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " %% PRO-RATA ed IVA non detraibile (%s%%)@69g%r " ) ,
1999-04-26 15:58:05 +00:00
( const char * ) prc . string ( ) , & ( d . _r11 ) ) ;
1997-12-24 09:40:34 +00:00
}
1996-09-17 12:39:43 +00:00
}
// items vari per dichiarazione annuale
for ( int i = 0 ; i < d . _arr . items ( ) ; i + + )
{
_DescrItem & dd = ( _DescrItem & ) d . _arr [ i ] ;
printed | = set_annual ( dd ) ;
}
if ( printed )
{
2003-03-20 12:25:48 +00:00
set_bookmark ( TR ( " Altri dati " ) , _att_bookmark ) ;
1996-09-17 12:39:43 +00:00
set_row ( 1 , " " ) ;
set_row ( 2 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 3 , FR ( " ALTRI DATI RELATIVI ALLA DICHIARAZIONE@55gimponibile "
" @77gimposta@91gdetrazione " ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( 4 , " " ) ;
1998-04-30 15:59:34 +00:00
set_row ( row + + , " " ) ;
set_row ( row , " " ) ;
1996-09-17 12:39:43 +00:00
}
1997-10-23 09:34:10 +00:00
else
1996-09-17 12:39:43 +00:00
set_row ( 1 , " " ) ;
// form feed
1998-04-30 15:59:34 +00:00
if ( d . _f2 )
set_auto_ff ( TRUE ) ;
1996-09-17 12:39:43 +00:00
}
2000-05-05 15:25:49 +00:00
void TLiquidazione_app : : set_grand_1999 ( _DescrItem & d , int & rw )
1996-09-17 12:39:43 +00:00
{
real & risultato = d . _r0 ;
real & rimborso = d . _r1 ;
real & cred_cost = d . _r2 ;
real & deb_mens = d . _r3 ;
real & rettifiche = d . _r5 ;
real & detrazioni = d . _r6 ;
real & interessi = d . _r7 ;
real & versamenti = d . _r8 ;
real & vers_int = d . _r9 ;
real & conguaglio = d . _r10 ;
TToken_string tt ( d . _s0 ) ;
real iva_vend ( tt . get ( 0 ) ) ;
real iva_acq ( tt . get ( 1 ) ) ;
real cred_prec ( tt . get ( 2 ) ) ;
real debt_prec ( tt . get ( 3 ) ) ;
1998-04-30 15:59:34 +00:00
real cred_trasf ( tt . get ( 4 ) ) ; cred_trasf = - cred_trasf ;
1996-09-17 12:39:43 +00:00
real acc_dec ( d . _s1 ) ;
real res_cred ( d . _s2 ) ;
real res_debt ( d . _s3 ) ;
real rett_debt ( 0.0 ) ;
real rett_cred ( 0.0 ) ;
real & interesse = d . _r11 ;
if ( rettifiche . sign ( ) > 0 ) rett_debt = rettifiche ;
if ( rettifiche . sign ( ) < 0 ) rett_cred = - rettifiche ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @66gCredito@84gDebito " ) ) ; set_row ( rw + + , " " ) ;
set_row ( rw + + , FR ( " @11gIva sulle operazioni di vendita@75g%r " ) , & iva_vend ) ;
set_row ( rw + + , FR ( " %s@11gRettifiche IVA a debito%s@75g%r " ) ,
1996-09-17 12:39:43 +00:00
_is_visliq ? " $[r] " : " " , _is_visliq ? " $[n] " : " " , & rett_debt ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " %s@11gIva chiesta a rimborso%s@75g%r " ) ,
1996-09-17 12:39:43 +00:00
_is_visliq ? " $[r] " : " " , _is_visliq ? " $[n] " : " " , & rimborso ) ;
// conguaglio prorata
if ( conguaglio . sign ( ) > 0 )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gConguaglio pro-rata@75g%r " ) , & conguaglio ) ;
1996-09-17 12:39:43 +00:00
// debito liq. precedente < 50000
if ( debt_prec > ZERO )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gDebito da liquidazione precedente@75g%r " ) , & debt_prec ) ;
1996-09-17 12:39:43 +00:00
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gRISULTATO@75g%r " ) , & res_debt ) ;
set_row ( rw + + , FR ( " @11gIva ammessa in detrazione@58g%r " ) , & iva_acq ) ;
1996-09-17 12:39:43 +00:00
if ( _isannual | | d . _f1 )
1998-04-30 15:59:34 +00:00
{
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gCredito inizio anno@58g%r " ) , & cred_prec ) ;
1998-04-30 15:59:34 +00:00
if ( cred_trasf ! = ZERO )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gCredito trasferito @58g%r " ) , & cred_trasf ) ;
1998-04-30 15:59:34 +00:00
}
1996-09-17 12:39:43 +00:00
else
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gCredito precedente@58g%r " ) , & cred_prec ) ;
1996-09-17 12:39:43 +00:00
if ( ! acc_dec . is_zero ( ) )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " %s@11gVersamento acconto dicembre%s@58g%r " ) ,
1996-09-17 12:39:43 +00:00
_is_visliq ? " $[r] " : " " , _is_visliq ? " $[n] " : " " , & acc_dec ) ;
if ( ! detrazioni . is_zero ( ) )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gUlteriori detrazioni@58g%r " ) , & detrazioni ) ;
1996-09-17 12:39:43 +00:00
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " %s@11gRettifiche IVA a credito%s@58g%r " ) ,
1996-09-17 12:39:43 +00:00
_is_visliq ? " $[r] " : " " , _is_visliq ? " $[n] " : " " , & rett_cred ) ;
1996-12-19 16:14:33 +00:00
// versamenti effettuati
if ( ! versamenti . is_zero ( ) & & ( _month = = 13 | | ! _is_visliq ) )
{
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gVersamenti effettuati@58g%r " ) , & versamenti ) ;
1996-09-17 12:39:43 +00:00
}
1996-12-19 16:14:33 +00:00
// versamenti integrativi
if ( ! vers_int . is_zero ( ) & & ! _is_visliq )
{
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gVersamenti integrativi@58g%r " ) , & vers_int ) ;
1996-12-19 16:14:33 +00:00
}
1996-09-17 12:39:43 +00:00
if ( conguaglio . sign ( ) < 0 )
{
real cg = conguaglio ;
cg = - cg ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gConguaglio pro-rata@58g%r " ) , & cg ) ;
1996-09-17 12:39:43 +00:00
}
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gRISULTATO@58g%r " ) , & res_cred ) ;
1996-09-17 12:39:43 +00:00
// se non c'e' nulla da versare stampa solo una riga vuota
// Serve, non toglierla, stronzo.
if ( risultato . is_zero ( ) )
set_row ( rw + + , " " ) ;
else
{
if ( risultato . sign ( ) < 0 )
{
real iva = abs ( risultato ) ;
1997-01-30 16:39:10 +00:00
if ( _isannual | | _isriepilogo )
2002-02-26 16:20:19 +00:00
round_imposta ( iva ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @23gCREDITO ATTUALE@58g%r " ) , & iva ) ;
1996-12-04 09:14:38 +00:00
if ( _is_visliq )
{ // se chiamata dalla visualizzazione mette 2 righe vuote se non vi sono interessi
// poiche' con le rettifiche a credito/debito posso volerle visualizzare
set_row ( rw + + , " " ) ;
set_row ( rw + + , " " ) ;
}
1996-09-17 12:39:43 +00:00
}
else
{
1997-01-30 16:39:10 +00:00
if ( _month = = 13 )
2002-02-26 16:20:19 +00:00
round_imposta ( interessi ) ;
1996-09-17 12:39:43 +00:00
real iva = risultato + interessi ;
1997-01-30 16:39:10 +00:00
if ( _isannual | | _isriepilogo )
2002-02-26 16:20:19 +00:00
round_imposta ( iva ) ;
1996-09-17 12:39:43 +00:00
if ( ! iva . is_zero ( ) )
{
if ( ! interessi . is_zero ( ) )
{
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @23gIVA DOVUTA@75g%r " ) , & risultato ) ;
set_row ( rw + + , FR ( " @23gInteresse @33g%6.2r @41g%%@75g%r " ) , & interesse , & interessi ) ;
1996-09-17 12:39:43 +00:00
}
1996-12-04 09:14:38 +00:00
else
if ( _is_visliq )
{ // vedi sopra...
set_row ( rw + + , " " ) ;
set_row ( rw + + , " " ) ;
}
2001-05-01 08:17:07 +00:00
if ( iva > = iva_da_riportare ( _month ) )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @23gIVA DA VERSARE@75g%r " ) , & iva ) ;
1996-09-17 12:39:43 +00:00
else
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @23gIVA A DEBITO DA NON VERSARE@75g%r " ) , & iva ) ;
1996-09-17 12:39:43 +00:00
}
}
}
1996-12-19 16:14:33 +00:00
if ( _is_visliq & & _month ! = 13 )
1996-09-17 12:39:43 +00:00
{
// stampa versamenti (anche 0) ad uso visualizzazione liquidazione IVA
2000-05-05 15:25:49 +00:00
rw + + ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11g$[r]Versamenti effettuati$[n]@58g%r " ) , & versamenti ) ;
1996-09-17 12:39:43 +00:00
set_row ( rw + + , " " ) ;
set_row ( rw + + , " " ) ;
}
if ( ! _is_visliq )
{
// descrizione rettifiche
2000-05-05 15:25:49 +00:00
if ( d . _s4 . not_empty ( ) | | d . _s5 . not_empty ( ) )
1996-09-17 12:39:43 +00:00
{
rw + + ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11g@bDESCRIZIONE RETTIFICHE@r " ) ) ;
1996-09-17 12:39:43 +00:00
rw + + ;
2000-05-05 15:25:49 +00:00
if ( d . _s4 . not_empty ( ) ) { set_row ( rw + + , " @11g%t " , & ( d . _s4 ) ) ; }
if ( d . _s5 . not_empty ( ) ) { set_row ( rw + + , " @11g%t " , & ( d . _s5 ) ) ; }
1996-09-17 12:39:43 +00:00
}
}
2000-05-05 15:25:49 +00:00
}
void TLiquidazione_app : : print_importo ( int rw , const char * prompt , real imp , bool red )
{
int tab = 75 ;
if ( imp < ZERO )
{ imp = - imp ; tab = 58 ; }
TString256 str ;
str < < " @11g " ;
if ( red ) str < < " $[r] " ;
str < < prompt ;
if ( red ) str < < " $[n] " ;
str < < ' @ ' < < tab < < " g%r " ;
set_row ( rw , str , & imp ) ;
}
void TLiquidazione_app : : set_grand_2000 ( _DescrItem & d , int & rw )
{
2002-05-08 16:25:49 +00:00
const real & risultato = d . _r0 ;
const real & rimborso = d . _r1 ;
const real & cred_cost = d . _r2 ;
const real & deb_mens = d . _r3 ;
const real & rettifiche = d . _r5 ;
const real & detrazioni = d . _r6 ;
const real & interessi = d . _r7 ;
const real & versamenti = d . _r8 ;
const real & vers_int = d . _r9 ;
2008-03-11 15:08:43 +00:00
const real & diffinc_iva = d . _r29 ;
2009-05-26 10:23:47 +00:00
const real & diffinc_iva_acq = d . _r33 ;
2000-05-05 15:25:49 +00:00
TToken_string tt ( d . _s0 ) ;
real iva_vend ( tt . get ( 0 ) ) ;
real iva_acq ( tt . get ( 1 ) ) ;
real cred_prec ( tt . get ( 2 ) ) ;
real debt_prec ( tt . get ( 3 ) ) ;
real cred_trasf ( tt . get ( 4 ) ) ; cred_trasf = - cred_trasf ;
real acc_dec ( d . _s1 ) ;
real res_cred ( d . _s2 ) ;
real res_debt ( d . _s3 ) ;
real rett_debt ( 0.0 ) ;
real rett_cred ( 0.0 ) ;
real & interesse = d . _r11 ;
real & credito_utilizzato_iva = d . _r15 ;
real & credito_utilizzato_f24 = d . _r16 ;
real & variazioni_imposta = d . _r17 ;
real & imposta_non_versata = d . _r18 ;
real & crediti_speciali = d . _r19 ;
if ( rettifiche . sign ( ) > 0 ) rett_debt = rettifiche ;
if ( rettifiche . sign ( ) < 0 ) rett_cred = - rettifiche ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @66gCredito@84gDebito " ) ) ; set_row ( rw + + , " " ) ;
2000-05-05 15:25:49 +00:00
// Se sono in visualizzazione stampo i due importi separati, altrimenti li sommo
if ( ! _is_visliq )
iva_vend + = rett_debt ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gIVA esigibile per il periodo@75g%r " ) , & iva_vend ) ;
2008-03-11 15:08:43 +00:00
if ( diffinc_iva ! = ZERO )
set_row ( rw + + , FR ( " @11gIVA a liquidazione differita incassata@75g%r " ) , & diffinc_iva ) ;
2000-05-05 15:25:49 +00:00
if ( _is_visliq )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11g$[r]Rettifiche IVA a debito$[n]@75g%r " ) , & rett_debt ) ; // Rettifiche modificabili
2000-05-05 15:25:49 +00:00
// Se sono in visualizzazione stampo i due importi separati, altrimenti li sommo
if ( ! _is_visliq )
iva_acq + = rett_cred ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gIva che si detrae per il periodo@58g%r " ) , & iva_acq ) ;
2009-05-26 10:23:47 +00:00
if ( diffinc_iva_acq ! = ZERO )
set_row ( rw + + , FR ( " @11gIVA a liquidazione differita pagata@58g%r " ) , & diffinc_iva_acq ) ;
2000-05-05 15:25:49 +00:00
if ( _is_visliq )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11g$[r]Rettifiche IVA a credito$[n]@58g%r " ) , & rett_cred ) ;
2000-05-05 15:25:49 +00:00
2009-05-26 10:23:47 +00:00
real iva_deb_cred = iva_vend - iva_acq + diffinc_iva - diffinc_iva_acq ;
2000-05-05 15:25:49 +00:00
if ( _is_visliq )
iva_deb_cred + = rett_debt - rett_cred ;
2003-03-20 12:25:48 +00:00
print_importo ( rw + + , TR ( " IVA a debito o a credito per il periodo " ) , iva_deb_cred ) ;
2000-05-05 15:25:49 +00:00
rw + + ;
2003-03-20 12:25:48 +00:00
print_importo ( rw + + , TR ( " Variazioni d'imposta " ) , variazioni_imposta , _is_visliq ) ;
print_importo ( rw + + , TR ( " Imposta non versata " ) , imposta_non_versata , _is_visliq ) ;
2000-05-05 15:25:49 +00:00
// debito liq. precedente < 50000
if ( debt_prec > ZERO )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gDebito o credito da liquidazione precedente@75g%r " ) , & debt_prec ) ;
2000-05-05 15:25:49 +00:00
else
2000-10-03 13:45:12 +00:00
{
cred_prec - = rimborso ;
if ( cred_prec > ZERO )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gDebito o credito da liquidazione precedente@58g%r " ) , & cred_prec ) ;
2000-10-03 13:45:12 +00:00
}
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " %s@11gRimborsi%s@75g%r " ) ,
2000-05-05 15:25:49 +00:00
_is_visliq ? " $[r] " : " " , _is_visliq ? " $[n] " : " " , & rimborso ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gCredito IVA compensabile detratto@58g%r " ) , & credito_utilizzato_iva ) ;
2000-05-05 15:25:49 +00:00
real cre_deb_per = risultato + crediti_speciali + acc_dec + vers_int ;
if ( _month = = 13 ) cre_deb_per + = versamenti ;
2003-03-20 12:25:48 +00:00
print_importo ( rw + + , TR ( " IVA dovuta o a credito per il periodo " ) , cre_deb_per ) ;
2000-05-05 15:25:49 +00:00
if ( crediti_speciali ! = ZERO | | _is_visliq )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " %s@11gCrediti speciali%s@58g%r " ) ,
2000-05-05 15:25:49 +00:00
_is_visliq ? " $[r] " : " " , _is_visliq ? " $[n] " : " " , & crediti_speciali ) ;
if ( _freqviva = = " T " & & interessi ! = ZERO )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gInteressi dovuti per liquidazioni trimestrali %6.2r%%@75g%r " ) , & interesse , & interessi ) ;
2000-05-05 15:25:49 +00:00
else
{
if ( _is_visliq )
rw + + ;
}
if ( ! acc_dec . is_zero ( ) )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " %s@11gAcconto versato%s@58g%r " ) ,
2000-05-05 15:25:49 +00:00
_is_visliq ? " $[r] " : " " , _is_visliq ? " $[n] " : " " , & acc_dec ) ;
else
{
if ( _is_visliq )
rw + + ;
}
// versamenti effettuati
if ( ! versamenti . is_zero ( ) & & ( _month = = 13 | | ! _is_visliq ) )
{
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gVersamenti effettuati@58g%r " ) , & versamenti ) ;
2000-05-05 15:25:49 +00:00
}
else
{
if ( _is_visliq )
rw + + ;
}
// versamenti integrativi
if ( ! vers_int . is_zero ( ) & & ! _is_visliq )
{
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gVersamenti integrativi@58g%r " ) , & vers_int ) ;
2000-05-05 15:25:49 +00:00
}
else
{
if ( _is_visliq )
rw + + ;
}
const real iva = risultato + interessi ;
2001-05-01 08:17:07 +00:00
if ( iva > ZERO )
2000-05-05 15:25:49 +00:00
{
2001-05-01 08:17:07 +00:00
if ( iva > = iva_da_riportare ( _month ) )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @23gIMPORTO DA VERSARE@75g%r " ) , & iva ) ;
2000-05-05 15:25:49 +00:00
else
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @23gIMPORTO DA NON VERSARE@75g%r " ) , & iva ) ;
2000-05-05 15:25:49 +00:00
}
else
{
if ( _isannual )
{
2002-05-08 16:25:49 +00:00
const real & credito = d . _r20 ;
if ( credito > ZERO )
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11gCREDITO RIPORTATO NELL'ANNO SUCCESSIVO@58g%r " ) , & credito ) ;
2000-05-05 15:25:49 +00:00
}
if ( _is_visliq )
rw + + ;
}
if ( _is_visliq & & _month ! = 13 )
{
rw + + ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11g$[r]Descrizione$[n] " ) ) ;
2000-05-05 15:25:49 +00:00
// stampa versamenti (anche 0) ad uso visualizzazione liquidazione IVA
rw + + ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11g$[r]Versamenti effettuati$[n]@58g%r " ) , & versamenti ) ;
2000-05-05 15:25:49 +00:00
set_row ( rw + + , " " ) ;
set_row ( rw + + , " " ) ;
}
if ( ! _is_visliq )
{
// descrizione rettifiche
if ( d . _s6 . not_empty ( ) )
{
rw + + ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @11g@bDESCRIZIONE RETTIFICHE@r " ) ) ;
2000-05-05 15:25:49 +00:00
rw + + ;
if ( d . _s6 . not_empty ( ) ) { set_row ( rw + + , " @11g%t " , & ( d . _s6 ) ) ; }
}
}
}
2002-02-26 16:20:19 +00:00
static void imp2string ( const real & n , TString & str )
{
if ( ! n . is_zero ( ) )
{
const TCurrency c ( n ) ;
str = c . string ( TRUE ) ;
str . right_just ( 15 ) ;
}
else
str . spaces ( 15 ) ;
}
2000-05-05 15:25:49 +00:00
void TLiquidazione_app : : set_grand ( _DescrItem & d )
{
2003-03-20 12:25:48 +00:00
set_bookmark ( TR ( " Riepilogativo liquidazione " ) , _firm_bookmark ) ;
2000-05-05 15:25:49 +00:00
set_row ( 1 , " " ) ; set_row ( 2 , " " ) ; set_row ( 3 , " " ) ; set_row ( 4 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 5 , FR ( " @11g@bCALCOLO LIQUIDAZIONE D'IMPOSTA@r " ) ) ;
2000-05-05 15:25:49 +00:00
set_row ( 6 , " " ) ;
int rw = 7 ;
const bool new_print = atoi ( _year ) > = 2000 ;
if ( new_print )
set_grand_2000 ( d , rw ) ;
else
set_grand_1999 ( d , rw ) ;
1996-09-17 12:39:43 +00:00
// rapportini per rimborso infraannuale
// non si stampano se la stampa serve per la visualizz.
1997-10-23 09:34:10 +00:00
// solo in st.di prova in coda ai registri deve scendere
1996-09-17 12:39:43 +00:00
// il prospetto di rimborso
1997-10-23 09:34:10 +00:00
// sempre (cioe' in bollato e in prova) deve scendere
// il prospettino versamento
1996-09-17 12:39:43 +00:00
if ( d . _arr . items ( ) > 0 & & ! _is_visliq )
{
for ( int i = 0 ; i < d . _arr . items ( ) ; i + + )
{
_DescrItem & di = ( _DescrItem & ) d . _arr [ i ] ;
if ( di . _flags = = RIMBORSO )
{
if ( ! _isregis | | ( _isregis & & ! _isfinal ) )
{
set_print_zero ( TRUE ) ;
set_row ( rw + + , " " ) ;
set_row ( rw + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_bookmark ( TR ( " Prospetto di rimborso " ) , _firm_bookmark ) ;
1996-09-17 12:39:43 +00:00
2003-03-20 12:25:48 +00:00
set_row ( rw + + , TR ( " PROSPETTO DI RIMBORSO " ) ) ;
1996-09-17 12:39:43 +00:00
if ( di . _f0 )
{
// esenti e non imponibili
set_row ( rw + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , TR ( " 1) Soggetto con quota di operazioni esenti e non "
" imponibili superiore al 25%% " ) ) ;
1996-09-17 12:39:43 +00:00
2001-05-01 08:17:07 +00:00
real perc = di . _r0 * CENTO / di . _r1 ; perc . round ( 0 ) ;
1996-09-17 12:39:43 +00:00
TString sep ( strlen ( REAL_PICTURE ) + 2 ) ; sep . fill ( ' - ' ) ;
set_row ( rw + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @26gTotale operazioni esenti e non imp.@66g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( di . _r0 ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @66g%t x 100 = %3r%% " ) , & sep , & perc ) ;
set_row ( rw + + , FR ( " @26gVolume di affari lordo@66g%r " ) , & ( di . _r1 ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( rw + + , " " ) ;
}
if ( di . _f1 )
{
set_row ( rw + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , TR ( " 2) Soggetto con acquisti ad aliquota media "
" superiore a quella delle vendite " ) ) ;
1996-09-17 12:39:43 +00:00
TString sep ( strlen ( REAL_PICTURE ) + 2 ) ; sep . fill ( ' - ' ) ;
set_row ( rw + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @26gTotale imposte sugli acquisti@66g%r " ) , & ( di . _r5 ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( rw + + , " @66g%t x 100 = %5.2r%% " , & sep , & ( di . _r7 ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @26gTotale imponibili sugli acquisti@66g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( di . _r3 ) ) ;
set_row ( rw + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @26gTotale imposte sulle vendite@66g%r " ) , & ( di . _r4 ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( rw + + , " @66g%t x 100 = %5.2r%% " , & sep , & ( di . _r6 ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @26gTotale imponibili sulle vendite@66g%r " ) , & ( di . _r2 ) ) ;
1996-09-17 12:39:43 +00:00
}
set_print_zero ( FALSE ) ;
}
}
// prospettino versamento
else if ( di . _flags = = DELEGA )
{
int rr = rw ;
int cont = 10 ;
if ( di . _s4 = = " ACC " )
{
TToken_string ac ( di . _s5 ) ;
if ( ! ac . empty_items ( ) & & _stampa_vers )
cont = 14 ;
}
if ( rw < ( printer ( ) . formlen ( ) - cont ) )
rw = printer ( ) . formlen ( ) - cont ;
1998-04-30 15:59:34 +00:00
for ( int i = rr ; i < rw ; i + + )
set_row ( i , " " ) ;
1996-09-17 12:39:43 +00:00
2003-03-20 12:25:48 +00:00
set_bookmark ( TR ( " Riepilogo versamenti " ) , _firm_bookmark ) ;
1996-09-17 12:39:43 +00:00
TString dt = di . _d0 . string ( ) ;
2002-02-26 16:20:19 +00:00
TString vr ; imp2string ( di . _r0 , vr ) ;
1996-09-17 12:39:43 +00:00
1998-04-30 15:59:34 +00:00
if ( di . _s4 = = " ACC " ) // Acconto
1996-09-17 12:39:43 +00:00
{
TToken_string ac ( di . _s5 ) ;
if ( ! ac . empty_items ( ) )
{
1998-04-30 15:59:34 +00:00
TString dt ( ac . get ( 4 ) ) ;
real app ( ac . get ( 3 ) ) ;
2002-02-26 16:20:19 +00:00
TString vr ; imp2string ( app , vr ) ;
1998-04-30 15:59:34 +00:00
TString con ( ac . get ( 0 ) ) ;
TString abi ( ac . get ( 1 ) ) ;
TString cab ( ac . get ( 2 ) ) ;
2002-02-26 16:20:19 +00:00
2003-03-20 12:25:48 +00:00
set_row ( rw + + , TR ( " - ACCONTO DICEMBRE - " ) ) ;
set_row ( rw , FR ( " Versamento di %s effettuato il %s " ) ,
1996-09-17 12:39:43 +00:00
( const char * ) vr ,
( const char * ) dt ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @68gCod Conc.: %3s " ) , ( const char * ) con ) ;
set_row ( rw + + , FR ( " @68gCod. ABI: %5s Cod. CAB o Cod. Dipendenza: %5s " ) , ( const char * ) abi , ( const char * ) cab ) ;
1996-09-17 12:39:43 +00:00
}
}
1998-04-30 15:59:34 +00:00
if ( _stampa_acc & & _stampa_vers )
set_row ( rw + + , " - SALDO - " ) ;
1996-09-17 12:39:43 +00:00
if ( _stampa_vers )
{
2003-03-20 12:25:48 +00:00
set_row ( rw , FR ( " Versamento di %s effettuato il %s " ) ,
1996-09-17 12:39:43 +00:00
( const char * ) vr ,
( const char * ) dt ) ;
2003-03-20 12:25:48 +00:00
set_row ( rw + + , FR ( " @68gCod Conc.: %3s " ) , ( const char * ) di . _s0 ) ;
set_row ( rw + + , FR ( " @68gCod. ABI: %5s Cod. CAB o Cod. Dipendenza: %5s " ) , ( const char * ) di . _s1 , ( const char * ) di . _s2 ) ;
1996-09-17 12:39:43 +00:00
}
}
}
}
if ( ! _is_visliq ) set_auto_ff ( TRUE ) ;
else set_auto_ff ( FALSE ) ;
_firm_bookmark = - 1 ;
}
bool TLiquidazione_app : : set_annual ( _DescrItem & d )
{
// chiamata internamente a set_pims
bool ret = FALSE ;
int row = get_maxrow ( ) + 1 ;
if ( row = = 1 ) row = 4 ;
if ( d . _f0 & IS_PRORATA )
{
// non lo ha stampato prima se annuale, perche' vladimiro il nefido
// pretende l'assurdo aggiornamento della perc. a quella nuova
2007-01-03 17:07:40 +00:00
const int year_int = atoi ( _year ) ;
1996-09-17 12:39:43 +00:00
1997-10-23 09:34:10 +00:00
row + + ;
2003-03-20 12:25:48 +00:00
set_row ( + + row , year_int > 1997 ? TR ( " CALCOLO DELLA PERCENTUALE DI DETRAIBILITA' " ) : TR ( " CALCOLO DELLA PERCENTUALE DI INDETRAIBILITA' " ) ) ;
1996-09-17 12:39:43 +00:00
row + + ;
2003-03-20 12:25:48 +00:00
set_bookmark ( TR ( " Calcolo pro-rata " ) , _att_bookmark ) ;
1996-09-17 12:39:43 +00:00
ret = TRUE ;
set_print_zero ( TRUE ) ;
set_row ( row + + , " " ) ;
1999-04-06 15:34:39 +00:00
if ( year_int > 1997 )
{
2000-10-03 13:45:12 +00:00
const real perc_det = CENTO - d . _r2 ;
const TString16 s1 = perc_det . string ( ) ;
const TString16 s2 = d . _r2 . string ( ) ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " %% PRO-RATA (%s%%) ed IVA non detraibile (%s%%)@69g%r " ) ,
2000-10-03 13:45:12 +00:00
( const char * ) s1 , ( const char * ) s2 , & ( d . _r6 ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " C1 - Operazioni esenti escluse da nr. 1 a 9 e 11 art. 10 @69g%r " ) , & ( d . _r1 ) ) ;
set_row ( row + + , FR ( " C2 - Operazioni esenti di cui nr. 11 art. 10 @69g%r " ) , & ( d . _r4 ) ) ;
set_row ( row + + , FR ( " C3 - Operazioni esenti da nr. 1 a 9 art. 10 @69g%r " ) , & ( d . _r5 ) ) ;
set_row ( row + + , FR ( " @6gdi cui cessione beni ammortizzabili @69g%r " ) , & ( d . _r8 ) ) ;
set_row ( row + + , FR ( " C1A - Operazioni esenti di cui all'art.10 n. 27 quinquies @69g%r " ) , & ( d . _r7 ) ) ;
set_row ( row + + , FR ( " @6gdi cui cessione beni ammortizzabili @69g%r " ) , & ( d . _r9 ) ) ;
set_row ( row + + , FR ( " Volume d'affari @69g%r " ) , & ( d . _r0 ) ) ;
set_row ( row + + , FR ( " Detraibilita' @69g%r%% " ) , & perc_det ) ;
1999-04-06 15:34:39 +00:00
}
else
{
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " %% PRO-RATA ed IVA non detraibile (%s%%)@69g%r " ) ,
1999-04-06 15:34:39 +00:00
( const char * ) ( d . _r2 . string ( ) ) , & ( d . _r6 ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( row + + , FR ( " B1 - Operazioni esenti, escluse da nr. 1 a 9 e 11 art. 10 @69g%r " ) , & ( d . _r1 ) ) ;
set_row ( row + + , FR ( " B2 - Operazioni esenti, di cui nr. 11 art. 10 @69g%r " ) , & ( d . _r4 ) ) ;
set_row ( row + + , FR ( " B3 - Operazioni esenti da nr. 1 a 9 art. 10 @69g%r " ) , & ( d . _r5 ) ) ;
set_row ( row + + , FR ( " Volume d'affari - B3 @69g%r " ) , & ( d . _r0 ) ) ;
set_row ( row + + , FR ( " Indetraibilita'@69g%r%% " ) , & ( d . _r2 ) ) ;
1999-04-06 15:34:39 +00:00
}
1996-09-17 12:39:43 +00:00
set_print_zero ( FALSE ) ;
}
return ret ;
}
void TLiquidazione_app : : set_ventila ( _DescrItem & d )
{
if ( d . _arr . items ( ) = = 0 | | d . _r0 . is_zero ( ) )
return ;
2003-03-20 12:25:48 +00:00
set_bookmark ( TR ( " Prospetto ventilazione " ) , _att_bookmark ) ;
1996-09-17 12:39:43 +00:00
2003-03-20 12:25:48 +00:00
set_row ( 1 , FR ( " @54gPROSPETTO VENTILAZIONE " ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( 2 , " " ) ;
set_row ( 3 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 4 , FR ( " @10gTotale acquisti destinati alla rivendita@55g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( d . _r0 ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( 5 , FR ( " @10gTotale dei corrispettivi da ventilare@55g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( d . _r1 ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( 6 , FR ( " @10gMoltiplicatore@59g%3.9r " ) , & ( d . _r2 ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( 7 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 8 , FR ( " @10gCod. " ) ) ;
set_row ( 9 , FR ( " @10gIVA@17gDescrizione@48gAcquisti "
" @65gImponibile vendite@89gImposta vendite " ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( 10 , " " ) ;
int row = 11 ;
real t1 , t2 , t3 ;
2000-05-05 15:25:49 +00:00
TString80 s0 ;
2007-01-03 17:07:40 +00:00
int i ;
for ( i = 0 ; i < d . _arr . items ( ) ; i + + )
1996-09-17 12:39:43 +00:00
{
_vDesc & vd = ( _vDesc & ) d . _arr [ i ] ;
look_iva ( vd . _codiva ) ;
2000-05-05 15:25:49 +00:00
s0 = _iva - > get ( " S0 " ) ; s0 . cut ( 23 ) ;
1999-10-22 10:00:18 +00:00
set_row ( row + i , " @8g%5s@17g%-23s@41g%r@68g%r@89g%r " ,
1996-09-17 12:39:43 +00:00
( const char * ) vd . _codiva ,
( const char * ) s0 ,
& ( vd . _acq ) ,
& ( vd . _vnd ) ,
& ( vd . _viv ) ) ;
t1 + = vd . _acq ;
t2 + = vd . _vnd ;
t3 + = vd . _viv ;
}
set_row ( row + i + 1 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( row + i + 2 , FR ( " @10gTotale@41g%r@68g%r@89g%r " ) ,
1996-09-17 12:39:43 +00:00
& t1 , & t2 , & t3 ) ;
set_auto_ff ( TRUE ) ;
}
2001-05-01 08:17:07 +00:00
static void real2string ( const real & r , TString & str )
{
TCurrency cur ( r ) ;
str = cur . string ( TRUE ) ;
}
1996-09-17 12:39:43 +00:00
void TLiquidazione_app : : set_regagr ( _DescrItem & d )
{
set_print_zero ( TRUE ) ;
1997-12-24 09:40:34 +00:00
2001-05-01 08:17:07 +00:00
const bool is1998 = atoi ( _year ) > = 1998 ;
CHECK ( is1998 = = _isagr98 , " Mucca pazza! " ) ;
1997-12-24 09:40:34 +00:00
1996-09-17 12:39:43 +00:00
real & agr_1 = d . _r0 ;
real & agr_2 = d . _r1 ;
real & agr_3 = d . _r2 ;
real & agr_4 = d . _r3 ;
real & agr_5 = d . _r4 ;
real & agr_6 = d . _r5 ;
real & agr_7 = d . _r6 ;
real & agr_1i = d . _r7 ;
real & agr_2i = d . _r8 ;
1996-12-06 08:19:03 +00:00
real & pdetr = d . _r9 ;
real & ivadt = d . _r10 ;
1997-11-03 11:41:00 +00:00
real & iva_detIA = d . _r11 ;
1996-09-17 12:39:43 +00:00
real ara = agr_5 + agr_6 ;
real arn = agr_3 + agr_4 ;
1997-05-14 10:47:21 +00:00
real agr_ven = agr_1 + agr_2 ;
1997-12-24 09:40:34 +00:00
real ivadt_amm = agr_3 + ivadt + ( is1998 ? iva_detIA : agr_1 ) ;
1996-09-17 12:39:43 +00:00
2003-03-20 12:25:48 +00:00
set_bookmark ( TR ( " Prospetto regime agricolo " ) , _att_bookmark ) ;
1997-11-03 11:41:00 +00:00
int r = 1 ;
2003-03-20 12:25:48 +00:00
set_row ( r + + , FR ( " @50gPROSPETTO REGIME AGRICOLO " ) ) ;
1997-11-03 11:41:00 +00:00
set_row ( r + + , " " ) ;
// percentuale detraibilita'
2003-03-20 12:25:48 +00:00
set_row ( r + + , FR ( " Iva vendite beni I parte Tabella A @56g%r " ) , & agr_1 ) ;
1997-11-03 11:41:00 +00:00
set_row ( r + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( r + + , FR ( " Iva vendite beni diversi da I parte Tabella A @56g%r " ) , & agr_2 ) ;
1997-11-03 11:41:00 +00:00
set_row ( r + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( r + + , FR ( " Totale iva sulle operazioni di vendita @56g%r " ) , & agr_ven ) ;
1997-11-03 11:41:00 +00:00
set_row ( r + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( r + + , FR ( " Iva acquisti in regime agricolo@56g%r " ) , & ara ) ;
1997-11-03 11:41:00 +00:00
set_row ( r + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( r + + , FR ( " Iva acquisti per operazioni diverse I parte Tabella A@56g%r " ) , & arn ) ;
set_row ( r + + , FR ( " ... di cui beni ammortizzabili@56g%r " ) , & agr_4 ) ;
1997-11-03 11:41:00 +00:00
set_row ( r + + , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( r + + , FR ( " Iva acquisti ad uso promiscuo@56g%r " ) , & agr_7 ) ;
1997-05-14 10:47:21 +00:00
TString dn , riga ;
if ( agr_1i ! = ZERO )
2001-05-01 08:17:07 +00:00
{
real2string ( agr_1i , riga ) ;
dn < < riga < < " + " ;
}
real2string ( agr_2i , riga ) ;
1997-05-14 10:47:21 +00:00
dn < < riga ;
int ln = max ( riga . len ( ) , dn . len ( ) ) + 2 ;
int corr = ln % 2 = = 0 ? 0 : 1 ;
TString middle ( ln ) ; middle . fill ( ' - ' ) ;
int xl = 71 - riga . len ( ) / 2 ;
int times_sign = xl + ln / 2 + 3 ; // per allineare i segni moltiplicativi
2001-05-01 08:17:07 +00:00
middle < < " @ " < < times_sign < < " gx 100 = " < < pdetr . string ( " . " ) < < " % " ;
1997-05-14 10:47:21 +00:00
1997-11-03 11:41:00 +00:00
set_row ( r + + , " " ) ;
set_row ( r + + , " @56g%r " , & agr_2i ) ;
2003-03-20 12:25:48 +00:00
riga . format ( FR ( " Percentuale delle operazioni diverse@%dg%%s " ) , xl - corr - ln / 2 ) ;
1997-11-03 11:41:00 +00:00
set_row ( r + + , riga , ( const char * ) middle ) ;
1997-05-14 10:47:21 +00:00
corr = dn . len ( ) % 2 = = 0 ? 0 : 1 ;
riga . format ( " @%dg%%s " , xl - corr - dn . len ( ) / 2 ) ;
1997-11-03 11:41:00 +00:00
set_row ( r + + , riga , ( const char * ) dn ) ;
1997-05-14 10:47:21 +00:00
2001-05-01 08:17:07 +00:00
real2string ( agr_7 , riga ) ;
1997-05-14 10:47:21 +00:00
dn = " 100 " ;
ln = max ( riga . len ( ) , dn . len ( ) ) + 2 ;
xl = 71 - riga . len ( ) / 2 ;
corr = ln % 2 = = 0 ? 0 : 1 ;
middle . fill ( ' - ' , ln ) ;
2001-05-01 08:17:07 +00:00
middle < < " @ " < < times_sign < < " gx " < < pdetr . string ( " . " ) ;
middle < < " = " < < TCurrency ( ivadt ) . string ( TRUE ) ;
1997-05-14 10:47:21 +00:00
1997-11-03 11:41:00 +00:00
set_row ( r + + , " " ) ;
2001-05-01 08:17:07 +00:00
set_row ( r + + , " @56g%r " , & agr_7 ) ;
2003-03-20 12:25:48 +00:00
riga . format ( FR ( " Iva ammessa in detrazione sugli acquisti promiscui@%dg%%s " ) , xl - corr - ln / 2 ) ;
1997-11-03 11:41:00 +00:00
set_row ( r + + , riga , ( const char * ) middle ) ;
1997-05-14 10:47:21 +00:00
corr = dn . len ( ) % 2 = = 0 ? 0 : 1 ;
riga . format ( " @%dg%%s " , xl - corr - dn . len ( ) / 2 ) ;
1997-11-03 11:41:00 +00:00
set_row ( r + + , riga , ( const char * ) dn ) ;
set_row ( r + + , " " ) ;
1997-12-24 09:40:34 +00:00
if ( is1998 )
1997-11-03 11:41:00 +00:00
{
2003-03-20 12:25:48 +00:00
set_row ( r + + , FR ( " Iva ammessa in detrazione I parte tabella A@56g%r " ) , & iva_detIA ) ;
1997-11-03 11:41:00 +00:00
set_row ( r + + , " " ) ;
}
2003-03-20 12:25:48 +00:00
set_row ( r + + , FR ( " Totale iva ammessa in detrazione@56g%r " ) , & ivadt_amm ) ;
1996-09-17 12:39:43 +00:00
1997-11-24 17:34:50 +00:00
// Last pain...
TArray & agr_array = d . _arr ;
const int pia_items = agr_array . items ( ) ;
if ( pia_items ) // Se non siamo ancora nel 1998 questo vale 0, ossia non vi sono items.
{
real t1 , t2 ; // Totale imponibile/imposta
TString des ; // Descrizione codice iva ordinario
real al ; // Aliquota IVA
r + = 2 ;
// Stampa l' intestazione...
2003-03-20 12:25:48 +00:00
set_row ( r + + , FR ( " Codice IVA@45gAliquota IVA@73gCodice IVA@88gAliquota IVA " ) ) ;
set_row ( r + + , FR ( " Ordinario@45gOrdinaria@61gImponibile@73gCompensazione@88gCompensazione@108gImposta " ) ) ;
1997-11-24 17:34:50 +00:00
set_row ( r + + , " " ) ;
for ( int i = 0 ; i < pia_items ; i + + )
{
_DescrItem & di = ( _DescrItem & ) agr_array [ i ] ;
if ( di . _flags ! = PROGAGR )
continue ;
look_iva ( di . _s0 ) ;
2000-05-05 15:25:49 +00:00
des = _iva - > get ( " S0 " ) ; des . cut ( 25 ) ;
1997-11-24 17:34:50 +00:00
al = _iva - > get_real ( " R0 " ) ;
set_row ( r , " %4s %-25s@48g%s %% " , ( const char * ) di . _s0 , ( const char * ) des , al . string ( " #@,@@ " ) ) ;
set_row ( r , " @56g%r@75g%4s " , & di . _r0 , ( const char * ) di . _s1 ) ;
look_iva ( di . _s1 ) ;
al = _iva - > get_real ( " R0 " ) ;
set_row ( r + + , " @92g%s %%@100g%r " , al . string ( " #@,@@ " ) , & di . _r1 ) ;
t1 + = di . _r0 ;
t2 + = di . _r1 ;
}
// ... ed il totale minchiativo
r + + ;
2003-03-20 12:25:48 +00:00
set_row ( r + + , FR ( " Totale@56g%r@100g%r " ) , & t1 , & t2 ) ;
1997-11-24 17:34:50 +00:00
}
1996-09-17 12:39:43 +00:00
set_auto_ff ( TRUE ) ;
set_print_zero ( FALSE ) ;
}
void TLiquidazione_app : : set_viaggio ( _DescrItem & d )
{
// the longest & stronzest
// Nel corso della scrittura di questa funzione
// Berlusconi + Fini + Bossi hanno vinto le elezioni
// ... lungo commento cancellato
real & corr_CEE = d . _r0 ;
real & corr_misCEE = d . _r1 ;
real & corr_noCEE = d . _r2 ;
real & acq_CEE = d . _r3 ;
real & acq_misCEE = d . _r4 ;
real & acq_noCEE = d . _r5 ;
real & acq_misnoCEE = d . _r6 ;
1996-12-09 08:34:51 +00:00
real & perc_r = d . _r7 ;
1996-09-17 12:39:43 +00:00
real & cred_cos = d . _r8 ;
1996-12-09 08:34:51 +00:00
real & ivm = d . _r9 ;
1996-09-17 12:39:43 +00:00
real tc = ( corr_CEE + ivm ) ;
real ta = ( acq_CEE + acq_misCEE ) ;
1996-12-09 08:34:51 +00:00
real & bi = d . _r10 ;
real & dovuta = d . _r11 ;
1996-09-17 12:39:43 +00:00
real tcc = corr_CEE + corr_noCEE + corr_misCEE ;
real tco = acq_CEE + acq_noCEE + acq_misCEE + acq_misnoCEE ;
real tma = acq_CEE + acq_misCEE ;
set_print_zero ( TRUE ) ;
2003-03-20 12:25:48 +00:00
set_bookmark ( FR ( " Prospetto 74 ter " ) , _att_bookmark ) ;
1996-09-17 12:39:43 +00:00
set_row ( 1 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 2 , FR ( " @54gRIEPILOGO 74 TER " ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( 3 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 4 , FR ( " Ammontare dei corrispettivi relativi a viaggi eseguiti "
" interamente nella CEE .....................@100g%r " ) , & ( corr_CEE ) ) ;
set_row ( 5 , FR ( " Ammontare dei corrispettivi relativi a viaggi misti (dentro "
" e fuori CEE) ......................... @100g%r " ) , & ( corr_misCEE ) ) ;
set_row ( 6 , FR ( " Ammontare dei corrispettivi relativi a viaggi eseguiti "
" interamente fuori CEE ..................... @100g%r " ) , & ( corr_noCEE ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( 7 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 8 , FR ( " @56gTotale corrispettivi@100g%r " ) , & tcc ) ;
1996-09-17 12:39:43 +00:00
set_row ( 9 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 10 , FR ( " Ammontare dei costi relativi a viaggi interamente "
" svolti nella CEE ............................... @100g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( acq_CEE ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( 11 , FR ( " Ammontare dei costi relativi a viaggi misti (per la "
" parte CEE) ................................... @100g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( acq_misCEE ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( 12 , FR ( " Ammontare dei costi relativi a viaggi interamente "
" svolti fuori CEE ............................... @100g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( acq_noCEE ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( 13 , FR ( " Ammontare dei costi relativi a viaggi misti (per la "
" parte fuori CEE) .............................@100g%r " ) ,
1996-09-17 12:39:43 +00:00
& ( acq_misnoCEE ) ) ;
set_row ( 14 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 15 , FR ( " @64gTotale costi@100g%r " ) , & tco ) ;
1996-09-17 12:39:43 +00:00
set_row ( 16 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 17 , TR ( " DETERMINAZIONE CORRISPETTIVI IMPONIBILI "
" RELATIVI A VIAGGI MISTI " ) ) ;
1996-09-17 12:39:43 +00:00
set_row ( 18 , " " ) ;
// la bella frazioncina della percentuale di ripartizione
2001-05-01 08:17:07 +00:00
TString tmp ; real2string ( acq_misCEE , tmp ) ;
1996-09-17 12:39:43 +00:00
TString up = tmp ;
up < < " x 100 " ;
TString dn = tmp ;
2001-05-01 08:17:07 +00:00
real2string ( acq_misnoCEE , tmp ) ;
1996-09-17 12:39:43 +00:00
dn < < " + " < < tmp ;
int ln = max ( up . len ( ) , dn . len ( ) ) + 2 ;
TString den ( ln ) ; den . fill ( ' - ' ) ;
up . center_just ( ln ) ; dn . center_just ( ln ) ;
// la bella frazioncina degli imponibili viaggi misti
2001-05-01 08:17:07 +00:00
TString tmp2 ; real2string ( corr_misCEE , tmp2 ) ;
TString up2 = tmp2 ;
const TString16 perc_r_str = perc_r . string ( " ###,@@ " ) ;
up2 < < " x " < < perc_r_str ;
1996-09-17 12:39:43 +00:00
TString dn2 = " 100 " ;
int ln2 = max ( up2 . len ( ) , 3 ) + 2 ;
TString den2 ( ln2 ) ; den2 . fill ( ' - ' ) ;
up2 . center_just ( ln2 ) ; dn2 . center_just ( ln2 ) ;
// la gran frazionazza centrata e stupenda
int tot = 35 + ln + ln2 ;
int rem1 = ( 100 - tot ) / 2 ; if ( rem1 < 0 ) rem1 = 0 ;
int pos1 = rem1 + 13 ;
int rem2 = pos1 + den . len ( ) + 11 ;
int pos2 = rem2 + 20 ;
set_row ( 19 , format ( " @%dg%%t@%dg%%t " , pos1 , pos2 ) ,
& up , & up2 ) ;
2003-03-20 12:25:48 +00:00
set_row ( 20 , format ( FR ( " @%dgPerc. rip. = %%t = %%t; @%dg "
" Imp. viaggi misti = %%t = @100g%%r " ) ,
1996-09-17 12:39:43 +00:00
rem1 , rem2 ) ,
2001-05-01 08:17:07 +00:00
& den , & perc_r_str , & den2 , & ivm ) ;
1996-09-17 12:39:43 +00:00
set_row ( 21 , format ( " @%dg%%t@%dg%%t " , pos1 , pos2 ) ,
& dn , & dn2 ) ;
real tmr = corr_CEE + ivm ;
// whew, come dicono su Topolino
2001-05-01 08:17:07 +00:00
real2string ( corr_CEE , tmp ) ;
1996-09-17 12:39:43 +00:00
up = " ( " ; up < < tmp < < " + " ;
2001-05-01 08:17:07 +00:00
real2string ( ivm , tmp ) ;
1996-09-17 12:39:43 +00:00
up < < tmp < < " ) " ;
den . fill ( ' . ' , 59 - up . len ( ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( 23 , FR ( " Ammontare dei corrispettivi imponibili@40g%t %t@100g%r " ) ,
1996-09-17 12:39:43 +00:00
& up , & den , & tmr ) ;
// se e' l'annuale non ha senso altro
if ( d . _f1 ) return ;
2001-05-01 08:17:07 +00:00
real2string ( acq_CEE , tmp ) ;
1996-09-17 12:39:43 +00:00
up = " ( " ; up < < tmp < < " + " ;
2001-05-01 08:17:07 +00:00
real2string ( acq_misCEE , tmp ) ;
1996-09-17 12:39:43 +00:00
up < < tmp < < " ) " ;
den . fill ( ' . ' , 59 - up . len ( ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( 24 , FR ( " Ammontare dei costi deducibili@40g%t %t@100g%r " ) ,
1996-09-17 12:39:43 +00:00
& up , & den , & tma ) ;
den . fill ( ' . ' , 60 ) ;
2003-03-20 12:25:48 +00:00
set_row ( 25 , FR ( " Credito di costo precedente @40g%t@100g%r " ) , & den , & ( cred_cos ) ) ;
1996-09-17 12:39:43 +00:00
2001-05-01 08:17:07 +00:00
real2string ( tmr , tmp ) ;
1996-09-17 12:39:43 +00:00
up = " [ " ; up < < tmp < < " - ( " ;
2001-05-01 08:17:07 +00:00
real2string ( tma , tmp ) ;
1996-09-17 12:39:43 +00:00
up < < tmp < < " + " ;
2001-05-01 08:17:07 +00:00
real2string ( d . _r8 , tmp ) ;
1996-09-17 12:39:43 +00:00
up < < tmp < < " )] " ;
den . fill ( ' . ' , 59 - up . len ( ) ) ;
2003-03-20 12:25:48 +00:00
set_row ( 26 , FR ( " Base imponibile lorda@40g%t %t@100g%r " ) , & up , & den , & bi ) ;
1996-09-17 12:39:43 +00:00
set_row ( 27 , " " ) ;
2001-05-01 08:17:07 +00:00
if ( bi > ZERO )
1996-09-17 12:39:43 +00:00
{
2001-05-01 08:17:07 +00:00
const real aliva = aliquota_agvia ( ) ;
const real alcnt = aliva + CENTO ;
1996-09-17 12:39:43 +00:00
2001-05-01 08:17:07 +00:00
real2string ( bi , tmp ) ;
1996-09-17 12:39:43 +00:00
up = tmp ;
2001-05-01 08:17:07 +00:00
up < < " x " < < aliva . string ( " ###,@@ " ) ;
dn = alcnt . string ( " ###,@@ " ) ;
1996-09-17 12:39:43 +00:00
ln = max ( up . len ( ) , 3 ) + 2 ;
den . fill ( ' - ' , ln ) ;
up . center_just ( ln ) ; dn . center_just ( ln ) ;
tmp . fill ( ' . ' , 59 - den . len ( ) ) ;
set_row ( 28 , " @40g%t " , & up ) ;
2003-03-20 12:25:48 +00:00
set_row ( 29 , FR ( " IVA A DEBITO@40g%t %t@100g%r " ) , & den , & tmp , & dovuta ) ;
1996-09-17 12:39:43 +00:00
set_row ( 30 , " @40g%t " , & dn ) ;
}
else if ( bi . sign ( ) < 0 )
{
bi = abs ( bi ) ;
set_row ( 28 , " " ) ;
2003-03-20 12:25:48 +00:00
set_row ( 29 , FR ( " CREDITO DI COSTO DA RIPORTARE@100g%r " ) , & bi ) ;
1996-09-17 12:39:43 +00:00
}
set_print_zero ( FALSE ) ;
set_auto_ff ( TRUE ) ;
}
void TLiquidazione_app : : set_acconto_p ( _DescrItem & d )
{
const char * errmsg [ 3 ] = {
2003-03-20 12:25:48 +00:00
{ TR ( " manca la tabella risultati liquidazione per l'anno corrente " ) } ,
{ TR ( " manca la tabella risultati liquidazione per l'anno precedente " ) } ,
{ TR ( " manca la tabella dichiarazione annuale per l'anno precedente " ) } } ;
1996-09-17 12:39:43 +00:00
1997-10-23 09:34:10 +00:00
set_row ( 1 , " %t@7g%t " , & ( d . _s0 ) , & ( d . _s1 ) ) ;
if ( d . _f2 )
set_row ( 1 , " @50g@b*** %s ***@r " , errmsg [ d . _f2 - 1 ] ) ;
else
1996-09-17 12:39:43 +00:00
{
1997-10-23 09:34:10 +00:00
if ( d . _f0 ) // base anno in corso
1996-09-17 12:39:43 +00:00
{
1997-10-23 09:34:10 +00:00
if ( d . _f1 ) // stampa base di calcolo
{
set_row ( 1 , " @58g%r@74g%r@96g%r@122g%s " , & ( d . _r3 ) ,
1996-09-17 12:39:43 +00:00
& ( d . _r2 ) , & ( d . _r1 ) , d . _f3 ? " Si " : " No " ) ;
1997-10-23 09:34:10 +00:00
}
else
set_row ( 1 , " @62g%r@91g%s " , & ( d . _r1 ) , d . _f3 ? " Si " : " No " ) ;
}
else //metodo storico
{
if ( d . _f1 & & ( d . _r0 ) . sign ( ) > 0 ) // stampa base di calcolo
set_row ( 1 , " @58g%r@88g%r " , & ( d . _r0 ) , & ( d . _r1 ) ) ;
else
set_row ( 1 , " @87g%r " , & ( d . _r1 ) ) ;
1996-09-17 12:39:43 +00:00
}
}
}
void TLiquidazione_app : : set_acchead_p ( _DescrItem & d )
{
reset_header ( ) ;
2003-03-20 12:25:48 +00:00
set_header ( 1 , FR ( " Gestione IVA@107gData @>@125gPag. @# " ) ) ;
1996-09-17 12:39:43 +00:00
set_header ( 3 , sep ) ;
if ( d . _f0 ) // base anno in corso
{
2003-03-20 12:25:48 +00:00
set_header ( 2 , FR ( " @40gCALCOLO ACCONTI IVA DICEMBRE %s "
" (base anno in corso) " ) , ( const char * ) _year ) ;
1996-09-17 12:39:43 +00:00
if ( d . _f1 ) // stampa base calcolo
{
2003-03-20 12:25:48 +00:00
set_header ( 4 , FR ( " @58g------- Base di calcolo ------- " ) ) ;
set_header ( 5 , FR ( " Ditta@7gDenominazione@62gDebito@78gCredito "
" @94gACCONTO calcolato@115gLiq. differita " ) ) ;
1996-09-17 12:39:43 +00:00
set_header ( 6 , sep ) ;
set_header ( 7 , " " ) ;
}
else
{
2003-03-20 12:25:48 +00:00
set_header ( 4 , FR ( " Ditta@7gDenominazione@60gACCONTO calcolato "
" @84gLiq. differita " ) ) ;
1996-09-17 12:39:43 +00:00
set_header ( 5 , sep ) ;
set_header ( 6 , " " ) ;
}
}
else
{
2003-03-20 12:25:48 +00:00
set_header ( 2 , FR ( " @40gCALCOLO ACCONTI IVA DICEMBRE %s " ) , ( const char * ) _year ) ;
1996-09-17 12:39:43 +00:00
set_header ( 5 , sep ) ;
set_header ( 6 , " " ) ;
if ( d . _f1 )
2003-03-20 12:25:48 +00:00
set_header ( 4 , FR ( " Ditta@7gDenominazione@58gBase di calcolo "
" @86gACCONTO calcolato " ) ) ;
1996-09-17 12:39:43 +00:00
else
2003-03-20 12:25:48 +00:00
set_header ( 4 , FR ( " Ditta@7gDenominazione@85gACCONTO calcolato " ) ) ;
1996-09-17 12:39:43 +00:00
}
}
// ---------------------------------------------------------------------
// Tabulato deleghe
// ---------------------------------------------------------------------
void TLiquidazione_app : : set_deltab ( _DescrItem & d , bool iscred )
{
reset_header ( ) ;
int rw = 1 ;
static bool credpr ;
if ( iscred )
{
// set header
2003-03-20 12:25:48 +00:00
set_header ( 1 , FR ( " ELENCO DITTE A CREDITO@30g%s %s@107gData @>@125gPag. @# " ) ,
d . _f0 = = 13 ? TR ( " Annuale " ) : itom ( d . _f0 ) , ( const char * ) _year ) ;
1996-09-17 12:39:43 +00:00
set_header ( 2 , sep ) ;
2003-03-20 12:25:48 +00:00
set_header ( 3 , FR ( " @40gF@60gImporto a " ) ) ;
set_header ( 4 , FR ( " Cod.@8gDenominazione@40gR@62gcredito " ) ) ;
1996-09-17 12:39:43 +00:00
set_header ( 5 , sep ) ;
set_header ( 6 , " " ) ;
// set rows
for ( int i = 0 ; i < d . _arr . items ( ) ; i + + )
{
TToken_string & tt = ( TToken_string & ) ( d . _arr ) [ i ] ;
TString cod ( tt . get ( 0 ) ) ;
TParagraph_string rgs ( tt . get ( 1 ) , 30 ) ;
TString diocantaro ( rgs . get ( 0 ) ) ;
TString frq ( tt . get ( 2 ) ) ;
real tp ( tt . get ( 3 ) ) ;
real in ( tt . get ( 4 ) ) ;
tp - = in ;
tp = - tp ;
set_row ( rw + + , " %-5s@8g%-30s@40g%1s@54g%r " ,
( const char * ) cod , ( const char * ) diocantaro ,
( const char * ) frq , & tp ) ;
for ( int i = 1 ; i < rgs . items ( ) ; i + + )
set_row ( rw + + , " @8g%-30s " , ( const char * ) rgs . get ( i ) ) ;
}
}
else
{
// set header
2003-03-20 12:25:48 +00:00
set_header ( 1 , FR ( " ELENCO DITTE A DEBITO@30g%s %s@107gData @>@125gPag. @# " ) ,
d . _f0 = = 13 ? TR ( " Annuale " ) : itom ( d . _f0 ) , ( const char * ) _year ) ;
1996-09-17 12:39:43 +00:00
set_header ( 2 , sep ) ;
2003-03-20 12:25:48 +00:00
set_header ( 3 , FR ( " @40gF@60gImporto da@73gCodice@83gCod. " ) ) ;
set_header ( 4 , FR ( " Cod.@8gDenominazione@40gR Numero telefonico@63gversare Banca Dip. Con. " ) ) ;
1996-09-17 12:39:43 +00:00
set_header ( 5 , sep ) ;
set_header ( 6 , " " ) ;
// set rows
for ( int i = 0 ; i < d . _arr . items ( ) ; i + + )
{
TToken_string & tt = ( TToken_string & ) ( d . _arr ) [ i ] ;
TString cod ( tt . get ( 0 ) ) ;
TParagraph_string rgs ( tt . get ( 1 ) , 30 ) ;
TString diocantaro ( rgs . get ( 0 ) ) ;
TString frq ( tt . get ( 2 ) ) ;
real tp ( tt . get ( 3 ) ) ;
real in ( tt . get ( 4 ) ) ;
TString abi ( tt . get ( 5 ) ) ;
TString cab ( tt . get ( 6 ) ) ;
TString con ( tt . get ( 7 ) ) ;
TString tel ( tt . get ( 8 ) ) ;
if ( ! tel . blank ( ) )
tel < < ' / ' ;
tel < < tt . get ( 9 ) ;
TString desc ( tt . get ( 10 ) ) ;
set_row ( rw + + , " %-5s@8g%-30s@40g%1s %s @55g%r %5s %5s %3s %-.45s " ,
( const char * ) cod , ( const char * ) diocantaro , ( const char * ) frq ,
( const char * ) tel , & tp , ( const char * ) abi ,
( const char * ) cab , ( const char * ) con , ( const char * ) desc ) ;
for ( int i = 1 ; i < rgs . items ( ) ; i + + )
set_row ( rw + + , " @8g%-30s " , ( const char * ) rgs . get ( i ) ) ;
}
}
set_auto_ff ( TRUE ) ;
}