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

View File

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

View File

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

View File

@ -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 // 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) 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)); 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); const TRectype& cli_file = cache().get(LF_CLIFO, clifo_key);

View File

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