Patch level : 10.0

Files correlati     : ve0.exe
Ricompilazione Demo : [ ]
Commento            :
0001560: Errore Gestione archivi provvigioni
Ho creato un archivio provv. con codice numerico. Chiave Cliente-Articolo. Dopo averlo associato all'agente non riporta la % di provv.


git-svn-id: svn://10.65.10.50/trunk@20127 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2010-02-16 12:19:54 +00:00
parent 36e3e49f9b
commit b8295f883b
4 changed files with 56 additions and 98 deletions

@ -1,50 +1,25 @@
#include <config.h>
#include <tabutil.h>
#include <diction.h>
#include <utility.h>
#include "velib.h"
#include "condv.h"
#include "rcondv.h"
#include "sconti.h"
#ifndef __VEUML_H
#include "veuml.h"
#endif
#ifndef __VERIG_H
#include "verig.h"
#endif
#ifndef __VECONF_H
#include "veconf.h"
#endif
#ifndef __TABUTIL_H
#include <tabutil.h>
#endif
#ifndef __ANAMAG_H
#include "../mg/anamag.h"
#endif
#ifndef __VEINI_H
#include "veini.h"
#endif
#include "verig.h"
#include "veuml.h"
#ifndef __VELIB_H
#include "velib.h"
#endif
#ifndef __AGE_H
#include "../mg/anamag.h"
#include "../pr/agenti.h"
#endif
#ifndef __PER_H
#include "../pr/percprov.h"
#endif
bool TCond_vendita::set_sconto( const char * exp, bool signal )
{
bool valid= scontoexpr2perc(exp,signal,_sconto,_molt_sconto );
bool valid= scontoexpr2perc(exp,signal,_sconto,_molt_sconto);
if (_load_mask && _riga && _riga->id2pos(FR_SCONTO) >= 0 && _riga->field(FR_SCONTO).active())
_riga->set(FR_SCONTO, _sconto);
return valid;
@ -64,8 +39,8 @@ real TCond_vendita::normalize_valuta(const real & val, const char * val_rif)
if (valuta == valuta_rif)
return val;
const real cambio = _condv.get_real("CAMBIO");
const exchange_type controeuro = _condv.get_bool("CONTROEURO") ? _exchange_contro : _exchange_base;
const real cambio = _condv.get_real(CONDV_CAMBIO);
const exchange_type controeuro = _condv.get_bool(CONDV_CONTROEURO) ? _exchange_contro : _exchange_base;
TPrice normalized(val, valuta_rif, cambio, controeuro);
const real cambio_dest = _testa->get_real(F_CAMBIO);
const exchange_type controeuro_dest = _testa->get_bool(F_CONTROEURO) ? _exchange_contro : _exchange_base;
@ -124,13 +99,13 @@ bool TCond_vendita::cerca( int tiporicerca )
if (codcont.empty())
return FALSE;
_condv.put("TIPO", "C");
_condv.put(CONDV_TIPO, "C");
if(config_ditta.get_bool("GESCONCC", "ve"))
{
_condv.put("TIPOCF", clifo().tipo());
_condv.put("CODCF", clifo().codice());
_condv.put(CONDV_TIPOCF, clifo().tipo());
_condv.put(CONDV_CODCF, clifo().codice());
}
_condv.put("COD", codcont);
_condv.put(CONDV_COD, codcont);
}
break;
case A_LISTINI:
@ -139,7 +114,7 @@ bool TCond_vendita::cerca( int tiporicerca )
if (codlist.empty())
return FALSE;
_condv.put("TIPO", "L");
_condv.put(CONDV_TIPO, "L");
// Se in ditta h abilitata la gestione della categoria di vendita in chiave
// al listino, la carico con gioia
if( config_ditta.get_bool("GESLISCV", "ve"))
@ -153,8 +128,8 @@ bool TCond_vendita::cerca( int tiporicerca )
if (codcamp.empty())
return FALSE;
_condv.put("TIPO", "O");
_condv.put("COD", codcamp);
_condv.put(CONDV_TIPO, "O");
_condv.put(CONDV_COD, codcamp);
}
break;
}
@ -162,8 +137,8 @@ bool TCond_vendita::cerca( int tiporicerca )
{
// _rcondv.setkey( 2 );
const bool gest_scagl = _condv.get_bool("GESTSCAGL");
const TString16 seqricrighe( _condv.get( "SEQRIC" ) );
const bool gest_scagl = _condv.get_bool(CONDV_GESTSCAGL);
const TString16 seqricrighe( _condv.get(CONDV_SEQRIC));
bool found = FALSE;
@ -265,16 +240,9 @@ real TCond_vendita::get_percprovv(char tipoprovv, const TString & codpr, bool fi
break;
case 'V':
{
TString16 catven(testa().get(F_CATVEN));
const TString16 catven = testa().get(F_CATVEN);
if (catven.not_empty())
{
TTable cve("CVE");
cve.put("CODTAB", catven);
if (cve.read() == NOERR)
val = cve.get_real("R0");
}
val = real(cache().get("CVE", catven, "R0"));
}
break;
case 'O':
@ -285,12 +253,7 @@ real TCond_vendita::get_percprovv(char tipoprovv, const TString & codpr, bool fi
case '3':
case '4':
{
TTable apr("APR");
TString16 ord;
apr.put("CODTAB",codpr);
if (apr.read() == NOERR)
ord = apr.get("S3");
const TString16 ord = cache().get("APR", codpr, "S3");
int len = ord.len();
TString key;
@ -642,18 +605,16 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
_load_mask |= load_scagl_only && cv_um;
for (i = 0; percprovv.is_zero() && seqric[i] != '\0' && seqric[i] != '-'; i++)
{
TString16 codric;
TString16 codric;
if (isdigit(seqric[i]))
codric = age.get(format("CODRICPR%d", i+1));
codric = age.get(format("CODRICPR%d", i+1));
percprovv = get_percprovv(seqric[i], codric, true, age);
}
real percalt;
seqric = age.get(AGE_SEQALT);
for (i = 0; percalt.is_zero() && seqric[i] != '\0' && seqric[i] != '-'; i++)
{
TString16 codric;
TString16 codric;
if (isdigit(seqric[i]))
codric = age.get(format("CODALTPR%d", i+1));
percalt = get_percprovv(seqric[i], codric, true, age);
@ -685,10 +646,9 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
_load_mask |= load_scagl_only && cv_scagl;
_load_mask |= load_scagl_only && cv_um;
for (i = 0; percprovv.is_zero() && seqric[i] != '\0' && seqric[i] != '-'; i++)
{
TString16 codric;
if (isdigit(seqric[i]))
{
TString16 codric;
if (isdigit(seqric[i]))
codric = age.get(format("CODRICPR%d", i+1));
percprovv = get_percprovv(seqric[i], codric, false, age);
}
@ -696,9 +656,8 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
seqric = age.get(AGE_SEQALT);
for (i = 0; percalt.is_zero() && seqric[i] != '\0' && seqric[i] != '-'; i++)
{
TString16 codric;
if (isdigit(seqric[i]))
TString16 codric;
if (isdigit(seqric[i]))
codric = age.get(format("CODALTPR%d", i+1));
percalt = get_percprovv(seqric[i], codric, false, age);
}
@ -738,8 +697,7 @@ void TCond_vendita::update_omaggi(bool full)
if (full || qta != ZERO)
{
const TString80 codart_omaggio(_rcondv.get("CODARTOM"));
const TString80 codart_omaggio(_rcondv.get(RCONDV_CODARTOM));
if (tipo_riga[0] == '_')
{
TConfig cnf(CONFIG_STUDIO, "ve");
@ -748,7 +706,8 @@ void TCond_vendita::update_omaggi(bool full)
{
tipo_riga = "09";
cnf.set("TROMAGGI", tipo_riga);
warning_box("Il tipo riga omaggi non risultava impostato.\n L'applicazione usera' automaticamente il tipo %s", (const char*) tipo_riga);
warning_box(FR("Il tipo riga omaggi non risultava impostato.\nL'applicazione usera' automaticamente il tipo %s"),
(const char*) tipo_riga);
}
}
const real qbase = _rcondv.get_real("QBASE");
@ -756,9 +715,9 @@ void TCond_vendita::update_omaggi(bool full)
qta = ZERO;
else
{
qta /= _rcondv.get_real("QBASE");
qta /= _rcondv.get_real(RCONDV_QBASE);
qta.floor();
qta *= _rcondv.get_real("QOM");
qta *= _rcondv.get_real(RCONDV_QOM);
}
creata = codart_omaggio.not_empty() && tipo_riga.not_empty() && qta != ZERO;
@ -773,26 +732,26 @@ void TCond_vendita::update_omaggi(bool full)
TRiga_documento & r = doc.insert_row(current_doc_row + 1, tipo_riga);
r.generata();
TString16 codmag(_riga->get(FR_CODMAG)); codmag << _riga->get(FR_CODDEP);
r.put("CODMAG", codmag);
r.put("CODART", codart_omaggio);
r.put("UMQTA", _rcondv.get("UMOM"));
r.put("QTA", qta);
real prezzo(_rcondv.get("PROMAGGIO"));
const TString16 codval(_condv.get("CODVAL"));
const TString16 codiva_cli(doc.codesiva());
TString8 codmag(_riga->get(FR_CODMAG)); codmag << _riga->get(FR_CODDEP);
r.put(RDOC_CODMAG, codmag);
r.put(RDOC_CODART, codart_omaggio);
r.put(RDOC_UMQTA, _rcondv.get(RCONDV_UMOM));
r.put(RDOC_QTA, qta);
real prezzo(_rcondv.get(RCONDV_PROMAGGIO));
const TString4 codval(_condv.get(CONDV_CODVAL));
const TString4 codiva_cli(doc.codesiva());
if (codiva_cli.not_empty())
r.put("CODIVA", codiva_cli);
r.put(RDOC_CODIVA, codiva_cli);
else
r.put("CODIVA", _rcondv.get("CODIVA"));
r.put("ADDIVA", _rcondv.get("ADDIVA"));
r.put(RDOC_CODIVA, _rcondv.get(RCONDV_CODIVA));
r.put(RDOC_ADDIVA, _rcondv.get(RCONDV_ADDIVA));
sh.insert(current_doc_row, false);
r.autoload(sh);
sh.check_row(current_doc_row);
r.autosave(sh);
prezzo = normalize_valuta(prezzo, codval);
r.put("PREZZO", prezzo);
r.put(RDOC_PREZZO, prezzo);
r.autoload(sh);
if (!testa().is_omaggio_enabled())
{

@ -326,7 +326,7 @@ int TReport_doc::set_printed_status(TDocumento& doc) const
ini.set("Action", "MODIFY");
ini.set("Firm", prefix().get_codditta());
ini.set("Mode", "A");
TString8 paradoc; paradoc.format("%d", LF_DOC);
TString4 paradoc; paradoc.format("%d", LF_DOC);
ini.set_paragraph(paradoc);
ini.set(DOC_PROVV, doc.get(DOC_PROVV));
ini.set(DOC_ANNO, doc.get(DOC_ANNO));

@ -97,7 +97,7 @@ const TCausale& TContabilizzazione_analitica::rdoc2caus(const TRiga_documento& r
// Copiata dalla contabilizzazione ed eliminati riferimenti a tutte le variabili globali del cazzo
bool TContabilizzazione_analitica::search_costo_ricavo(const TRiga_documento& r, TBill& conto, bool riclassifica_fdr_fde)
{
TString16 clifo_key;
TString8 clifo_key;
clifo_key.format("%c|%ld", r.doc().get_char(DOC_TIPOCF), r.doc().get_long(DOC_CODCF));
const TRectype& cli_file = cache().get(LF_CLIFO, clifo_key);

@ -1561,7 +1561,7 @@ bool codart_handler(TMask_field& f, KEY key )
TCodice_articolo codart = f.get();
TRectype anamag = cache().get(LF_ANAMAG, codart); // anamag puo' cambiare
bool found = !anamag.empty();
TString16 umcorr;
TString4 umcorr;
if (found)
row_mask.set(FR_CODARTMAG, codart, true);
@ -1627,15 +1627,14 @@ bool codart_handler(TMask_field& f, KEY key )
if (mask.doc()[current_doc_row].is_omaggio())
{
static TString* dicitura_omaggio = NULL;
if (dicitura_omaggio == NULL)
static TString dicitura_omaggio;
if (dicitura_omaggio.empty())
{
TConfig c(CONFIG_STUDIO, "ve");
dicitura_omaggio = new TString(c.get("DESOMAGGI"));
if (dicitura_omaggio->blank())
*dicitura_omaggio = TR("(OMAGGIO)");
dicitura_omaggio = ini_get_string(CONFIG_STUDIO, "ve", "DESOMAGGI");
if (dicitura_omaggio.blank())
dicitura_omaggio = TR("(OMAGGIO)");
}
desc << ' ' << *dicitura_omaggio;
desc << ' ' << dicitura_omaggio;
}
if (lingua.not_empty())
{