Patch level :10.0

Files correlati     :lv2.exe
Ricompilazione Demo : [ ]
Commento            :
Implementata nella fatturazione, la gestione del tipo canone e relativi flag in testata


git-svn-id: svn://10.65.10.50/trunk@19009 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
rajitgill 2009-06-11 11:19:11 +00:00
parent 92c05aabaa
commit 5508c0a2a1
2 changed files with 357 additions and 226 deletions

View File

@ -129,23 +129,154 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
//flag per il calcolo sul valore convenzionale e sul fisso per dotazione iniziale
bool valconvcli = false;
bool fixdotin = false;
bool stmpelcons = contr.get_bool(LVCONDV_ELCONS);
bool stmpripcons = contr.get_bool(LVCONDV_RIPCONS);
bool elcons = contr.get_bool(LVCONDV_ELCONS);
bool rifbol = contr.get_bool(LVCONDV_RIFBOL);
if (doc.physical_rows()>0 && doc[1].is_descrizione())
{
if (stmpelcons)
if (elcons)
{
TRiga_documento& rout = doc[1];
rout.put(RDOC_DESCR, "COME DA ELENCO CONSEGNE");
rout.put(RDOC_DESCLUNGA, false);
rout.put(RDOC_DESCEST, "");
}
if (!stmpelcons && stmpripcons)
else
if (!rifbol)
doc.destroy_row(1,true);
}
const bool ragart = contr.get_bool(LVCONDV_RAGART); // leggo il flag di testata raggruppa su unico articolo
const int tipocan = contr.get_int(LVCONDV_TIPOCAN); // leggo il tipo canone
if (ragart)
{
real totmerc;
const int rows=doc.physical_rows();
for (int i=1; i<=rows; i++) //calcolo totale merce
{
const TRiga_documento& riga = doc[i];
if (riga.is_merce())
totmerc += riga.importo(true,false);
}
const int rigamerce = doc[1].is_descrizione()?2:1;
for (int i=rigamerce; i<=rows; i++)
doc.destroy_row(i);
TRiga_documento& riga=doc.new_row("01");
const TString80 codartcfg = ini_get_int(CONFIG_DITTA, "lv", "Codartcafix");
// istanzio una token string e poi una cache per estrarre l'unità di misura dell articolo in configurazione da UMART
TToken_string key;
key.add(codartcfg);
key.add(1);
const TRectype& umart = cache().get(LF_UMART,key);
const TString4 umcodart = umart.get(UMART_UM);
/* estraggo il codice IVA istanziando in primis una cache su CFVEN per analizzare il codice esenzione iva
del cliente in questione. Se è >0 imposto il codiva a tale valore, altrimenti se è uguale a 0 istanzio
un altra cache su ANAMAG e imposto il codiva uguale al codice iva dell articolo in questione */
key = doc.get(DOC_TIPOCF);
key.add(clifo);
const TRectype& cfven = cache().get(LF_CFVEN,key);
TString8 codiva = cfven.get(CFV_ASSFIS);
if (codiva.blank())
{
const TRectype& anamag = cache().get(LF_ANAMAG,codartcfg);
codiva = anamag.get(ANAMAG_CODIVA);
}
riga.put(RDOC_QTA,UNO);
riga.put(RDOC_UMQTA,umcodart);
riga.put(RDOC_PREZZO,totmerc);
riga.put(RDOC_CODART,codartcfg);
riga.put(RDOC_CODIVA,codiva);
break;
}
else
if (tipocan==1) //se è selezionato tipo canone = importo fisso
{
// estraggo il canone fisso e l'articolo in configurazione
const real canfis=contr.get_real(LVCONDV_CANFIX);
const TString80 codartcfg = ini_get_int(CONFIG_DITTA, "lv", "Codartfix");
// istanzio una token string e poi una cache per estrarre l'unità di misura dell articolo in configurazione da UMART
TToken_string key;
key.add(codartcfg);
key.add(1);
const TRectype& umart = cache().get(LF_UMART,key);
const TString4 umcodart = umart.get(UMART_UM);
/* estraggo il codice IVA istanziando in primis una cache su CFVEN per analizzare il codice esenzione iva
del cliente in questione. Se è >0 imposto il codiva a tale valore, altrimenti se è uguale a 0 istanzio
un altra cache su ANAMAG e imposto il codiva uguale al codice iva dell articolo in questione */
key = doc.get(DOC_TIPOCF);
key.add(clifo);
const TRectype& cfven = cache().get(LF_CFVEN,key);
TString8 codiva = cfven.get(CFV_ASSFIS);
if (codiva.blank())
{
const TRectype& anamag = cache().get(LF_ANAMAG,codartcfg);
codiva = anamag.get(ANAMAG_CODIVA);
}
const int rigamerce = doc[1].is_descrizione()?2:1;
TRiga_documento& fixrow=doc.insert_row(rigamerce, "01"); // creo una nuova riga in cima al documento e imposto i valori appena estratti
fixrow.put(RDOC_QTA,UNO);
fixrow.put(RDOC_UMQTA,umcodart);
fixrow.put(RDOC_PREZZO,canfis);
fixrow.put(RDOC_CODART,codartcfg);
fixrow.put(RDOC_CODIVA,codiva);
int tipocanfix = contr.get_int(LVCONDV_CANFIX);
const int rows = doc.physical_rows();
switch (tipocanfix)
{
case 0:
{
for (int k = rigamerce+1; k <= rows; k++)
{
doc.destroy_row(k);
}
}
break;
case 1:
{
for (int k = rigamerce+1; k <= rows; k++)
{
TRiga_documento& rout = doc[k];
rout.zero(RDOC_PREZZO);
}
}
break;
case 2:
{
for (int k = rigamerce+1; k <= rows; k++)
{
TRiga_documento& rout = doc[k];
rout.zero(RDOC_PREZZO);
rout.zero(RDOC_QTA);
}
}
break;
default:
break;
}
break;
}
else // se il tipo canone è impostato a nessuno o % sul valore convenzionale per cliente vado in ambedue i casi ad eseguire il ciclo che analizza i tipi forfait
{
//per ogni documento, scorro tutte le sue righe
for (int i = 1; i <= doc.physical_rows(); i++)
{
@ -360,12 +491,12 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
break;
case 5: //forfait = FISSO SU DOTAZIONE INIZIALE
{
// if (!fixdotin)
// {
// fixdotin=true;
// if (!fixdotin)
// {
// fixdotin=true;
rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_IMPFISART));
rout.put(RDOC_QTA, artlav.clifomag(annoes)[index].get_real("DOTIN"));
/* for (int h = doc.physical_rows(); h > i; h--)
/* for (int h = doc.physical_rows(); h > i; h--)
{
TRiga_documento& delrow = doc[h];
const TString80 codart=delrow.get(RDOC_CODART);
@ -374,7 +505,7 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
if (forfdotin == 5)
doc.destroy_row(h,true);
} */
// }
// }
}
break;
default:
@ -382,8 +513,8 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
}
}
}
}
}
}
//ADD_ROWS: per adesso un segnaposto
void TFatturazione_lavanderie::add_rows(TRiga_documento & rout, TRiga_documento & rin)

View File

@ -37,9 +37,9 @@
#define LVCONDV_STETITS "STETITS"
#define LVCONDV_STDDTPTS "STDDTPTS"
#define LVCONDV_IMPMINFAT "IMPMINFAT"
#define LVCONDV_CANFIX "IMPFIX"
#define LVCONDV_IMPFIX "IMPFIX"
#define LVCONDV_CANFIX "CANFIX"
#define LVCONDV_CANFIX "RAGART"
#define LVCONDV_RAGART "RAGART"
#define LVCONDV_PERCNOCONT "PERCNOCONT"
#define LVCONDV_PERCTOLPES "PERCTOLPES"
#define LVCONDV_RITAUDTTMP "RITAUDTTMP"