2009-03-10 16:26:05 +00:00
# include <progind.h>
2009-03-20 17:48:18 +00:00
# include <config.h>
2009-03-11 14:11:30 +00:00
2009-03-10 16:26:05 +00:00
# include "lvlib.h"
# include "lv2500a.h"
2009-04-02 16:32:58 +00:00
# include "cfven.h"
2009-03-11 14:11:30 +00:00
# include "lvcondv.h"
# include "lvrcondv.h"
2009-04-02 16:32:58 +00:00
# include "rdoc.h"
2009-03-10 16:26:05 +00:00
2009-03-11 14:11:30 +00:00
# include "../ve/ve6200.h"
# include "../ve/ve6200a.h"
2009-03-10 16:26:05 +00:00
///////////////////////////////////////////////////////////
// TFatturazione_lavanderie
///////////////////////////////////////////////////////////
class TFatturazione_lavanderie : public TFatturazione_bolle
{
2009-03-10 17:56:23 +00:00
TDate _data_elab ;
2009-03-10 16:26:05 +00:00
protected :
2009-03-31 16:12:06 +00:00
virtual void add_rows ( TRiga_documento & rout , TRiga_documento & rin ) ;
virtual void create_row ( TDocumento & doc_out , const TRiga_documento & rin ) ;
2009-03-11 01:17:10 +00:00
virtual void pre_process_input ( TLista_documenti & doc_in ) { }
virtual void post_process_input ( TLista_documenti & doc_out ) { }
virtual void post_process_output ( TLista_documenti & doc_out ) ;
virtual bool da_raggruppare ( const TRiga_documento & rin ) ;
2009-03-31 16:12:06 +00:00
virtual bool doc_raggruppabili ( const TDocumento & doc_in , const TDocumento & doc_out , TToken_string & campi ) const ;
2009-03-11 01:17:10 +00:00
virtual bool doc_raggruppabile ( const TDocumento & doc ) const { return true ; }
2009-03-12 23:00:29 +00:00
virtual bool gestione_riferimenti ( ) const { return true ; }
virtual bool riferimenti_in_testa ( ) const { return true ; }
2009-03-31 15:42:36 +00:00
virtual TRiga_documento & find_or_create_row ( TDocumento & doc_out , const TRiga_documento & rin , const char lavtype ) ;
2009-03-11 01:17:10 +00:00
2009-03-10 16:26:05 +00:00
public :
virtual bool elabora ( TLista_documenti & doc_in , TLista_documenti & doc_out ,
const TDate & data_elab , bool interattivo = false ) ;
2009-03-10 17:56:23 +00:00
2009-03-11 01:17:10 +00:00
TFatturazione_lavanderie ( const char * cod ) ;
~ TFatturazione_lavanderie ( ) { }
2009-03-10 16:26:05 +00:00
} ;
TFatturazione_lavanderie : : TFatturazione_lavanderie ( const char * cod )
: TFatturazione_bolle ( cod )
2009-03-11 01:17:10 +00:00
{
}
2009-03-31 16:12:06 +00:00
bool TFatturazione_lavanderie : : doc_raggruppabili ( const TDocumento & doc_in , const TDocumento & doc_out , TToken_string & campi ) const
{
if ( doc_in . ha_riga_esenzione ( ) ! = doc_out . ha_riga_esenzione ( ) )
return false ;
bool ok = true ;
TString campo ;
for ( const char * c = campi . get ( 0 ) ; c & & ok ; c = campi . get ( ) )
{
if ( strncmp ( c , " CODABI " , 6 ) = = 0 | | strncmp ( c , " CODCAB " , 6 ) = = 0 )
{
long cod = doc_in . get_long ( c ) ;
ok & = ( cod = = doc_out . get_long ( c ) ) ;
}
else
{
campo = doc_in . get ( c ) ;
ok & = campo = = doc_out . get ( c ) ;
}
}
return ok ;
}
2009-03-11 01:17:10 +00:00
bool TFatturazione_lavanderie : : da_raggruppare ( const TRiga_documento & rin )
2009-03-10 16:26:05 +00:00
{
2009-03-30 16:18:50 +00:00
/* const long clifo = rin.doc().get_long(DOC_CODCF);
2009-03-11 01:17:10 +00:00
const int indsped = rin . doc ( ) . get_int ( DOC_CODINDSP ) ;
TLaundry_contract contr ( clifo , indsped , _data_elab ) ;
const TString80 codart = rin . get ( RDOC_CODART ) ;
const TRectype & rcont = contr . row ( codart ) ;
const int tipoforf = rcont . get_int ( LVRCONDV_TIPOFORF ) ;
2009-03-20 17:48:18 +00:00
// return tipoforf > 1; // Test originale
if ( tipoforf > 1 )
return true ;
// Da qui in poi e' sottinteso tipoforf == 1
if ( ini_get_int ( CONFIG_DITTA , " lv " , " TipoPr " ) = = 1 )
return false ;
// Test GUY
const TString8 causale = rin . get ( RDOC_CODAGG1 ) ;
const TRectype & cau = cache ( ) . get ( " &CAU " , causale ) ;
if ( cau . get_bool ( " B1 " ) )
{
const TCausale_magazzino & con = cached_causale_magazzino ( cau . get ( " S2 " ) ) ;
if ( con . sgn ( s_dottm ) ) // Causale di incremento sotazione temporanea
return true ;
}
if ( cau . get_bool ( " B4 " ) ) // Causale di rotto
2009-03-30 16:18:50 +00:00
return true ; */
2009-03-20 17:48:18 +00:00
return false ;
2009-03-10 16:26:05 +00:00
}
2009-03-11 01:17:10 +00:00
void TFatturazione_lavanderie : : post_process_output ( TLista_documenti & doc_out )
2009-03-10 16:26:05 +00:00
{
2009-03-11 01:17:10 +00:00
for ( int id = 0 ; id < doc_out . items ( ) ; id + + )
{
TDocumento & doc = doc_out [ id ] ;
const long clifo = doc . get_long ( DOC_CODCF ) ;
const int indsped = doc . get_int ( DOC_CODINDSP ) ;
TLaundry_contract contr ( clifo , indsped , _data_elab ) ;
2009-04-02 16:32:58 +00:00
for ( int i = 1 ; i < = doc . physical_rows ( ) ; i + + )
2009-03-11 01:17:10 +00:00
{
TRiga_documento & rout = doc [ i ] ;
const TString80 codart = rout . get ( RDOC_CODART ) ;
const TRectype & rcont = contr . row ( codart ) ;
const TString4 tipodot = rcont . get ( LVRCONDV_NOLCIC ) ;
const TString4 artcli = rcont . get ( LVRCONDV_VCARTCLI ) ;
real dot ;
TArticolo_lavanderie artlav ( codart , ' C ' , clifo , indsped ) ;
if ( tipodot = = " I " )
dot = artlav . get_real ( " DOTIN " ) ;
else
dot = artlav . get_real ( " DOTOD " ) ;
const int tipoforf = rcont . get_int ( LVRCONDV_TIPOFORF ) ;
switch ( tipoforf )
{
case 0 :
break ;
case 1 :
{
2009-04-02 16:32:58 +00:00
// rout.put(RDOC_QTA, UNO);
2009-03-11 01:17:10 +00:00
rout . put ( RDOC_PREZZO , rcont . get_real ( LVRCONDV_IMPFISART ) ) ;
// gestione in base codice per valore fisso ??? tolta la scelta dell'articolo o del cliente
}
break ;
2009-04-02 16:32:58 +00:00
case 2 :
2009-03-11 01:17:10 +00:00
{
int tipolist = contr . get_int ( LVCONDV_TIPOLIS ) ;
if ( tipolist = = 0 )
rout . put ( RDOC_PREZZO , rcont . get_real ( LVRCONDV_PREZZO ) ) ;
else
{
TString query ;
query < < " USE UMART KEY 2 \n "
< < " FROM " < < " CODART=#CODART UM=#UM \n "
< < " TO " < < " TCODART=#CODART UM=#UM \n " ;
2009-04-02 16:32:58 +00:00
TISAM_recordset recset ( query ) ;
2009-03-11 01:17:10 +00:00
recset . set_var ( " #CODART " , clifo ) ;
recset . set_var ( " #UM " , rcont . get ( LVRCONDV_UM ) ) ;
rout . put ( RDOC_PREZZO , recset . get ( UMART_PREZZO ) . as_real ( ) ) ;
}
rout . put ( RDOC_QTA , dot ) ;
}
break ;
2009-04-02 16:32:58 +00:00
case 3 :
2009-03-11 01:17:10 +00:00
{
2009-04-02 16:32:58 +00:00
const real qta = rout . get ( RDOC_QTA ) ;
const real consumo = qta * rout . get_real ( RDOC_PREZZO ) ;
const real ciclaggio = dot * rcont . get_real ( LVRCONDV_PREZZO ) * rcont . get_real ( LVRCONDV_MINCIC ) ;
if ( consumo < ciclaggio )
{
const bool cicl2rig = contr . get_bool ( LVCONDV_CICLAGGIO ) ;
const real cicl = rcont . get_real ( LVRCONDV_MINCIC ) * dot ;
if ( cicl2rig )
{
TRiga_documento & congrow = doc . insert_row ( + + i , " 01 " ) ;
doc . copy_data ( congrow , rout ) ;
congrow . put ( RDOC_DESCR , " Pareggio minimo fatturabile " ) ;
rout . put ( RDOC_QTA , cicl - qta ) ;
congrow . put ( RDOC_PREZZO , rcont . get_real ( LVRCONDV_PREZZO ) ) ;
}
else
{
rout . put ( RDOC_QTA , cicl ) ;
rout . put ( RDOC_PREZZO , rcont . get_real ( LVRCONDV_PREZZO ) ) ;
}
}
2009-03-11 01:17:10 +00:00
}
break ;
2009-04-02 16:32:58 +00:00
case 4 :
2009-03-11 01:17:10 +00:00
{
rout . put ( RDOC_PREZZO , rcont . get_real ( LVRCONDV_VALCONV ) ) ;
rout . put ( RDOC_QTA , dot * rcont . get_real ( LVRCONDV_FORFPERCL ) ) ;
}
break ;
2009-04-02 16:32:58 +00:00
case 5 :
2009-03-11 01:17:10 +00:00
{
rout . put ( RDOC_PREZZO , rcont . get_real ( LVRCONDV_PREZZO ) ) ;
rout . put ( RDOC_QTA , dot ) ;
}
break ;
default :
break ;
}
}
}
2009-03-10 17:56:23 +00:00
2009-03-11 01:17:10 +00:00
}
2009-03-10 16:26:05 +00:00
2009-03-30 16:18:50 +00:00
2009-03-11 01:17:10 +00:00
void TFatturazione_lavanderie : : add_rows ( TRiga_documento & rout , TRiga_documento & rin )
{
2009-03-30 16:18:50 +00:00
/*const TString8 causale = rin.get(RDOC_CODAGG1);
2009-03-10 16:26:05 +00:00
const TRectype & cau = cache ( ) . get ( " &CAU " , causale ) ;
2009-03-20 17:48:18 +00:00
const TCausale_magazzino & rit = cached_causale_magazzino ( cau . get ( " S1 " ) ) ;
const TCausale_magazzino & con = cached_causale_magazzino ( cau . get ( " S2 " ) ) ; //movimento o meno la dotazione temporanea/odierna a seconda di cosa prevede la causale
const long clifo = rin . doc ( ) . get_long ( DOC_CODCF ) ;
const int indsped = rin . doc ( ) . get_int ( DOC_CODINDSP ) ;
TLaundry_contract contr ( clifo , indsped , _data_elab ) ;
if ( cau . get_bool ( " B4 " ) & & contr . get_int ( LVCONDV_ADDCAPROT ) ) // Guardo se <20> una causale di rotto e se <20> abilitato nella testata del contratto la fatturazione dei rotti
2009-03-10 17:56:23 +00:00
{
2009-03-20 17:48:18 +00:00
const real qta = rit . sgn ( s_consmese ) * rin . get_real ( RDOC_QTA ) ;
rout . put ( RDOC_PREZZO , contr . get_int ( LVCONDV_PREZROT ) ) ;
rout . add ( RDOC_QTA , qta ) ;
2009-03-11 01:17:10 +00:00
}
2009-03-20 17:48:18 +00:00
else
2009-03-11 01:17:10 +00:00
{
2009-03-20 17:48:18 +00:00
if ( cau . get_bool ( " B0 " ) )
{
const real qta = rit . sgn ( s_consmese ) * rin . get_real ( RDOC_QTA ) ;
rout . add ( RDOC_QTA , qta ) ;
}
if ( cau . get_bool ( " B1 " ) )
{
const real qta = con . sgn ( s_consmese ) * rin . get_real ( RDOC_QTA ) ;
rout . add ( RDOC_QTA , qta ) ;
}
2009-03-30 16:18:50 +00:00
} */
}
2009-03-20 17:48:18 +00:00
2009-03-31 15:42:36 +00:00
TRiga_documento & TFatturazione_lavanderie : : find_or_create_row ( TDocumento & doc_out , const TRiga_documento & rin , const char lavtype )
2009-03-30 16:18:50 +00:00
{
2009-03-31 15:42:36 +00:00
const TString80 codart = rin . get ( RDOC_CODARTMAG ) ;
2009-03-30 16:18:50 +00:00
int r ;
for ( r = doc_out . physical_rows ( ) ; r > 0 ; r - - )
{
const char tipo = doc_out [ r ] . get_char ( " LVTYPE " ) ;
const TString & cod = doc_out [ r ] . get ( RDOC_CODARTMAG ) ;
if ( cod = = codart & & tipo = = lavtype )
break ;
}
if ( r < = 0 )
{
TRiga_documento & row = doc_out . new_row ( " 01 " ) ;
2009-03-31 15:42:36 +00:00
doc_out . copy_data ( row , rin ) ;
row . zero ( RDOC_CODAGG1 ) ;
row . zero ( RDOC_QTA ) ;
row . zero ( RDOC_QTAGG1 ) ;
2009-03-30 16:18:50 +00:00
row . put ( " LVTYPE " , lavtype ) ;
r = row . get_int ( RDOC_NRIGA ) ;
}
2009-03-20 17:48:18 +00:00
2009-03-30 16:18:50 +00:00
return doc_out [ r ] ;
2009-03-20 17:48:18 +00:00
2009-03-10 16:26:05 +00:00
}
void TFatturazione_lavanderie : : create_row ( TDocumento & doc_out , const TRiga_documento & rin )
{
2009-03-30 16:18:50 +00:00
const TString8 causale = rin . get ( RDOC_CODAGG1 ) ;
2009-03-11 01:17:10 +00:00
const TRectype & cau = cache ( ) . get ( " &CAU " , causale ) ;
2009-03-30 16:18:50 +00:00
const long clifo = rin . doc ( ) . get_long ( DOC_CODCF ) ;
const int indsped = rin . doc ( ) . get_int ( DOC_CODINDSP ) ;
TLaundry_contract contr ( clifo , indsped , _data_elab ) ;
const TString80 codart = rin . get ( RDOC_CODARTMAG ) ;
const real qta = rin . get_real ( RDOC_QTA ) ;
const real qta1 = rin . get_real ( RDOC_QTAGG1 ) ;
2009-04-02 16:32:58 +00:00
const TRectype & rcont = contr . row ( codart ) ;
const int tipoprezzo = ini_get_int ( CONFIG_DITTA , " lv " , " TipoPr " ) ;
real prezzo = rin . get_real ( RDOC_PREZZO ) ;
if ( tipoprezzo = = 0 )
{
if ( rcont . empty ( ) )
{
TArticolo & art = cached_article ( codart ) ;
const TString & um = rin . get ( RDOC_UMQTA ) ;
const int index = art . find_um ( um ) ;
if ( index > = 0 )
prezzo = art . um ( ) [ index ] . get_real ( UMART_PREZZO ) ;
2009-03-11 01:17:10 +00:00
2009-04-02 16:32:58 +00:00
}
else
prezzo = rcont . get_real ( LVRCONDV_PREZZO ) ;
}
2009-03-30 16:18:50 +00:00
// Guardo se <20> una causale di rotto e se <20> abilitato nella testata del contratto la fatturazione dei rotti
2009-03-31 15:42:36 +00:00
if ( cau . get_bool ( " B3 " ) & & contr . get_int ( LVCONDV_ADDCAPROT ) & & ! qta1 . is_zero ( ) )
2009-03-30 16:18:50 +00:00
{
2009-03-31 15:42:36 +00:00
TRiga_documento & rd = find_or_create_row ( doc_out , rin , ' D ' ) ;
2009-03-30 16:18:50 +00:00
rd . add ( RDOC_QTA , qta1 ) ;
rd . put ( RDOC_PREZZO , contr . row ( codart ) . get_real ( LVRCONDV_PREZDAN ) ) ;
}
2009-04-02 16:32:58 +00:00
if ( cau . get_bool ( " B0 " ) & & ! qta1 . is_zero ( ) ) // movimenta ritirato
2009-03-11 01:17:10 +00:00
{
const TCausale_magazzino & rit = cached_causale_magazzino ( cau . get ( " S1 " ) ) ;
2009-04-02 16:32:58 +00:00
const real sgnrit = rit . sgn ( s_consmese ) ;
if ( ! sgnrit . is_zero ( ) )
{
TRiga_documento & rr = find_or_create_row ( doc_out , rin , ' C ' ) ;
rr . add ( RDOC_QTA , sgnrit * qta1 ) ;
rr . put ( RDOC_PREZZO , prezzo ) ;
}
2009-03-11 01:17:10 +00:00
}
2009-03-30 16:18:50 +00:00
if ( cau . get_bool ( " B1 " ) & & ! qta . is_zero ( ) ) // movimenta consegnato
2009-03-11 01:17:10 +00:00
{
const TCausale_magazzino & con = cached_causale_magazzino ( cau . get ( " S2 " ) ) ;
2009-03-31 15:42:36 +00:00
2009-03-30 16:18:50 +00:00
const real sgntmp = con . sgn ( s_dottm ) ;
if ( ! sgntmp . is_zero ( ) & & contr . get_bool ( LVCONDV_DOTTMPPRZD ) )
{
2009-03-31 15:42:36 +00:00
TRiga_documento & rt = find_or_create_row ( doc_out , rin , ' T ' ) ;
2009-03-30 16:18:50 +00:00
rt . add ( RDOC_QTA , sgntmp * qta ) ;
rt . put ( RDOC_PREZZO , contr . row ( codart ) . get_real ( LVRCONDV_PRZDTTMP ) ) ;
}
2009-03-31 15:42:36 +00:00
const real sgndotin = con . sgn ( s_dotin ) ;
if ( ! sgndotin . is_zero ( ) )
{
TRiga_documento & rc = find_or_create_row ( doc_out , rin , ' I ' ) ;
rc . add ( RDOC_QTA , sgndotin * qta ) ;
2009-04-02 16:32:58 +00:00
rc . put ( RDOC_PREZZO , prezzo ) ;
2009-03-31 15:42:36 +00:00
}
const real sgncons = con . sgn ( s_consmese ) ;
if ( ! sgncons . is_zero ( ) )
2009-03-30 16:18:50 +00:00
{
2009-03-31 15:42:36 +00:00
TRiga_documento & rc = find_or_create_row ( doc_out , rin , ' C ' ) ;
rc . add ( RDOC_QTA , sgncons * qta ) ;
2009-04-02 16:32:58 +00:00
rc . put ( RDOC_PREZZO , prezzo ) ;
2009-03-30 16:18:50 +00:00
}
2009-03-11 01:17:10 +00:00
}
2009-03-30 16:18:50 +00:00
2009-03-10 16:26:05 +00:00
}
bool TFatturazione_lavanderie : : elabora ( TLista_documenti & doc_in , TLista_documenti & doc_out ,
const TDate & data_elab , bool interattivo )
{
2009-03-11 01:17:10 +00:00
_data_elab = data_elab ;
return TFatturazione_bolle : : elabora ( doc_in , doc_out , data_elab , interattivo ) ;
2009-03-10 16:26:05 +00:00
}
///////////////////////////////////////////////////////////
// TFatturazione_msk
///////////////////////////////////////////////////////////
class TFatturazione_msk : public TAutomask
{
protected :
virtual bool on_field_event ( TOperable_field & o , TField_event e , long jolly ) { return true ; }
public :
TFatturazione_msk ( ) ;
} ;
TFatturazione_msk : : TFatturazione_msk ( ) : TAutomask ( " lv2500a " )
{
}
///////////////////////////////////////////////////////////
// TFatturazione_lav_app
///////////////////////////////////////////////////////////
class TFatturazione_lav_app : public TSkeleton_application
{
protected :
virtual void main_loop ( ) ;
} ;
void TFatturazione_lav_app : : main_loop ( )
{
TFatturazione_msk msk ;
2009-04-02 16:32:58 +00:00
const TString4 mskzona = msk . get ( F_CODZONA ) ;
const TString4 mskcat = ( F_CODCATC ) ;
2009-03-11 01:17:10 +00:00
TLocalisamfile doc ( LF_DOC ) ;
TLocalisamfile rdoc ( LF_RIGHEDOC ) ;
2009-03-10 16:26:05 +00:00
while ( msk . run ( ) ! = K_QUIT )
{
TString query ;
2009-04-02 16:32:58 +00:00
//&&(BETWEEN(DATADOC,#DADATA,#ADATA))&&(STATO==\"2\")&&(TIPODOC==\"B01\")
query < < " USE DOC KEY 3 SELECT (TIPOCF== \" C \" ) \n "
2009-03-31 16:12:06 +00:00
< < " BY TIPOCF CODCF DATADOC \n "
2009-03-11 01:17:10 +00:00
< < " FROM " < < " DATADOC=#DADATA PROVV=D ANNO=#ANNO \n "
< < " TO " < < " DATADOC=#ADATA PROVV=D ANNO=#ANNO \n " ;
2009-03-31 16:12:06 +00:00
// query << "USE DOC KEY 2 SELECT BETWEEN(DATADOC,#DADATA,#ADATA)&&STATO==\"2\")&&(TIPODOC==\"B01\")\n"
2009-03-11 01:17:10 +00:00
// << "FROM " << "TIPOCF=C PROVV=D ANNO=#ANNO DATADOC=#DADATA \n"
// << "TO " << "TIPOCF=C PROVV=D ANNO=#ANNO DATADOC=#ADATA \n";
2009-03-10 16:26:05 +00:00
TISAM_recordset recset ( query ) ;
2009-03-31 16:12:06 +00:00
TDate al = msk . get_date ( F_ADATA ) ;
if ( ! al . ok ( ) )
al = msk . get_date ( F_DATAFAT ) ;
TDate dal = msk . get_date ( F_DADATA ) ;
const long year = al . year ( ) ;
if ( ! dal . ok ( ) )
{
dal . set_day ( 1 ) ;
dal . set_month ( 1 ) ;
dal . set_year ( year ) ;
}
recset . set_var ( " #DADATA " , dal ) ;
recset . set_var ( " #ADATA " , al ) ;
recset . set_var ( " #ANNO " , year ) ;
2009-03-10 16:26:05 +00:00
2009-03-11 01:17:10 +00:00
TFatturazione_lavanderie elab ( msk . get ( F_COD_ELAB ) ) ;
2009-03-10 16:26:05 +00:00
TLista_documenti docsin ;
TLista_documenti docsout ;
long lastcli = 0 ;
const int period = msk . get_int ( F_PERFAT ) ;
const TDate datafat = msk . get_date ( F_DATAFAT ) ;
long indsped ;
2009-03-11 01:17:10 +00:00
for ( bool ok = recset . move_first ( ) ; ok ; ok = recset . move_next ( ) )
2009-03-10 16:26:05 +00:00
{
2009-03-11 01:17:10 +00:00
const long clifo = recset . get ( DOC_CODCF ) . as_int ( ) ;
2009-03-10 16:26:05 +00:00
2009-03-11 01:17:10 +00:00
if ( clifo ! = lastcli )
2009-03-10 16:26:05 +00:00
{
if ( docsin . items ( ) ! = 0 )
{
2009-03-11 01:17:10 +00:00
elab . elabora ( docsin , docsout , datafat ) ;
2009-03-10 16:26:05 +00:00
docsout . write ( ) ;
docsout . destroy ( - 1 ) ;
docsin . rewrite ( ) ;
docsin . destroy ( - 1 ) ;
}
2009-03-11 01:17:10 +00:00
lastcli = clifo ;
2009-03-10 16:26:05 +00:00
}
2009-04-02 16:32:58 +00:00
TToken_string key ;
key . add ( ' C ' ) ;
key . add ( clifo ) ;
const TRectype & clienti = cache ( ) . get ( LF_CFVEN , key ) ;
bool cliok = elab . is_document_ok ( recset . cursor ( ) - > curr ( ) ) ;
if ( cliok )
{
if ( mskzona . full ( ) )
{
const TString & codzona = clienti . get ( CFV_CODZONA ) ;
cliok = ( codzona = = mskzona ) ;
}
if ( cliok & & mskcat . full ( ) )
{
const TString & codcat = clienti . get ( CFV_CODCATC ) ;
cliok = ( codcat = = mskcat ) ;
}
}
if ( cliok )
2009-03-10 16:26:05 +00:00
{
2009-03-11 01:17:10 +00:00
indsped = recset . get ( DOC_CODINDSP ) . as_int ( ) ;
TLaundry_contract contr ( clifo , indsped , datafat ) ;
const int contrper = contr . get_int ( LVCONDV_PERFAT ) ;
2009-03-10 16:26:05 +00:00
2009-03-11 01:17:10 +00:00
if ( contrper < = period )
2009-03-10 16:26:05 +00:00
docsin . add ( new TDocumento ( recset . cursor ( ) - > curr ( ) ) ) ;
}
}
if ( docsin . items ( ) ! = 0 )
{
2009-03-11 01:17:10 +00:00
elab . elabora ( docsin , docsout , datafat ) ;
2009-03-10 16:26:05 +00:00
docsout . write ( ) ;
docsout . destroy ( - 1 ) ;
docsin . rewrite ( ) ;
docsin . destroy ( - 1 ) ;
}
}
}
int lv2500 ( int argc , char * argv [ ] )
{
TFatturazione_lav_app a ;
a . run ( argc , argv , " Fatturazione lavanderie " ) ;
return TRUE ;
}