From a033380b88a576becca44aab1857c86bcef6223c Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 12 Jun 1997 16:14:15 +0000 Subject: [PATCH] Riaggiunto il definitivo git-svn-id: svn://10.65.10.50/trunk@4632 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ve/velib06.cpp | 419 ------------------------------------------------- 1 file changed, 419 deletions(-) delete mode 100755 ve/velib06.cpp diff --git a/ve/velib06.cpp b/ve/velib06.cpp deleted file mode 100755 index e2ed19334..000000000 --- a/ve/velib06.cpp +++ /dev/null @@ -1,419 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "..\ve\velib.h" -#include "..\ve\sconti.h" -#include "..\ve\veconf.h" - - -const real CENTO=real(100.0); - - -bool TCondizione_vendita:: ricerca(const char * codice, const real & qta) -{ - int tiporic; - switch (_condv.get_char("TIPO")) { - case 'L': - tiporic=A_LISTINI; - break; - case 'C': - tiporic=A_CONTRATTI; - break; - case 'O': - tiporic=A_OFFERTE; - break; - } - return cerca(tiporic,codice, qta); -} - - -bool TCondizione_vendita::cerca( int tiporicerca, const char * codriga , const real & qta) -{ - if( config_ditta().get_bool( "GES", "ve", tiporicerca ) ) - { - _condv.setkey( 1 ); - - if (_condv.get("COD").empty()) - return FALSE; - switch( tiporicerca ) - { - case A_CONTRATTI: - { - } - break; - case A_LISTINI: - { - _condv.put("TIPOCF", ""); - _condv.put("CODCF", ""); - if( !config_ditta().get_bool("GESLISCV", "ve")) - _condv.put("CATVEN", ""); - } - break; - case A_OFFERTE: - { - } - break; - } - if( _condv.read( ) == NOERR ) - { - // si posiziona sulla riga - const bool gest_scagl = _condv.get_bool("GESTSCAGL"); - const TString16 seqricrighe( _condv.get( "SEQRIC" ) ); - bool found = FALSE; - - for( int i = 0; !found && i < seqricrighe.len( ); i ++ ) - { - _rcondv.zero( ); - _rcondv.put( "TIPO", _condv.get( "TIPO")); - _rcondv.put( "CATVEN", _condv.get( "CATVEN")); - _rcondv.put( "TIPOCF", _condv.get( "TIPOCF")); - _rcondv.put( "CODCF", _condv.get( "CODCF")); - _rcondv.put("COD", _condv.get("COD")); - if (gest_scagl) - _rcondv.put("NSCAGL", 1); - - char ricerca = seqricrighe[ i ]; - _rcondv.put( "TIPORIGA", ricerca ); - switch( ricerca ) - { - case 'A': - { - _rcondv.put( "CODRIGA", codriga); - if (_rcondv.read() != NOERR && - _rcondv.prev() == NOERR && - _rcondv.get("TIPORIGA")[0] == 'A') - { - const TString cod_found(_rcondv.get("CODRIGA")); - return cod_found.compare(codriga, cod_found.len()) == 0; - } - } - break; - case 'R': - _rcondv.put("CODRIGA", anamag().get( "RAGGFIS")); - _rcondv.read(); - break; - case 'S': - { - _rcondv.put( "CODRIGA", anamag().get("GRMERC")); - _rcondv.read( ); - } - break; - case 'G': - { - _rcondv.put( "CODRIGA", anamag().get("GRMERC").left(3)); - _rcondv.read( ); - } - break; - default: - break; - } - found = _rcondv.good(); - } - // individua lo scaglione corretto in base alla quantita' - if (found && gest_scagl) - { - TRectype rec(_rcondv.curr()); - int last_scagl = 0; - int scagl = _rcondv.get_int("NSCAGL"); - real qta_lim(_rcondv.get_real("QLIM")); - while (_rcondv.good() && scagl > last_scagl && qta_lim > ZERO && qta > qta_lim) - { - if (_rcondv.next() == NOERR) - { - last_scagl = scagl; - scagl = _rcondv.get_int("NSCAGL"); - qta_lim =_rcondv.get_real("QLIM"); - rec = _rcondv.curr(); - } - } - _rcondv.read(rec); - } - _prezzo = _rcondv.get_real("PREZZO"); - return found; - } - } - // Ricerca fallita - return FALSE; -} - -/*void TCondizione_vendita::ricerca(bool load_um_only, bool load_scagl_only) -{ - TString codart = anamag().get( "CODART" ); - const TString codriga = riga().get( FR_CODART ); - - _ivarid = _clifo->get_bool(LF_CFVEN, "IVARID"); - _load_mask = !load_um_only && !load_scagl_only; - - if(anamag().bad() || codriga != codart ) - { - anamag().setkey(1); - anamag().put("CODART", codriga); - if (anamag().read() != NOERR) - { - set _prezzo(ZERO); - set_sconto(""); - set_iva(""); - set_provv(ZERO); - return; - } - } - codart = umart().get( "CODART" ); - const TString16 umriga(riga().get(FR_UMQTA)); - const TString16 um(umart().get("UM")); - if (umart().bad() || codart != codriga || um != umriga) - { - umart().setkey(2); - umart().put("CODART", codriga); - umart().put("UM", um); - if (umart().read != NOERR) - umart().zero(); - } - - const bool found_condv = cerca(A_CONTRATTI) || cerca(A_OFFERTE) || cerca(A_LISTINI); - const bool cv_scagl = get_bool("GESTSCAGL"); - const bool cv_um = get_bool("GESTUM"); - - if (found_condv) - { - _load_mask |= load_scagl_only && cv_scagl; - _load_mask |= load_um_only && cv_um; - set_prezzo(_rcondv.get_real("PREZZO"), get("CODVAL")); - _load_mask = !load_um_only && !load_scagl_only; - } - else -// if (full_load) - set_prezzo(umart().get_real("PREZZO")); - - -// if (full_load) -// { - if (_ivarid) - set_iva(anamag().get("CODIVAR")); - else - set_iva(anamag().get("CODIVA")); -// } - - const char gestione = config_ditta().get_char( "GESSCORIGA", "ve" ); - const bool sco_scagl = config_ditta().get_bool("GESCOSCA", "ve"); - const bool sco_um_gest = config_ditta().get_bool("GESSCORIGAUM", "ve"); - -// if (!full_load && gestione != 'A' && !sco_scagl) -// { -// if (gestione == 'L' && found_condv) -// set_sconto(_rcondv.get("SCONTO")); -//} -// else - { - switch (gestione) - { - case 'N': - // Sconti di riga non gestiti - set_sconto(""); - break; - case 'L': - // Percentuale su contratti/offerte/listini/anagrafica - if (found_condv) - { - _load_mask |= load_scagl_only && cv_scagl; - _load_mask |= load_um_only && cv_um; - set_sconto(_rcondv.get("SCONTO")); - _load_mask = !load_um_only && !load_scagl_only; - } - else - set_sconto(anamag().get("SCONTO")); - break; - case 'A': - { - // Posiziono l'anagrafica - const char rigakey = config_ditta().get_char( "SCORIGAKEY", "ve" ); - - _sconti.setkey(1); - _sconti.put("TIPO", "R"); - if( config_ditta().get_bool("GESSCORIGACV", "ve")) - _sconti.put("CODCAT", clifo().get(LF_CFVEN, "CATVEN")); - if (sco_um_gest) - _sconti.put("UM", riga().get( FR_UMQTA)); - _sconti.put("TIPORIGA", rigakey); - - if (sco_scagl) - _sconti.put("NSCAGL", 1); - - switch (rigakey) - { - case 'A': - _sconti.put("CODART", codriga); - _sconti.read(); - break; - case 'R': - _sconti.put("CODART", anamag().get("RAGGFIS")); - _sconti.read(); - break; - case 'C': - { - _sconti.put( "CODART", anamag().get("GRMERC")); - _sconti.read( ); - } - break; - case 'L': - { - _sconti.put("CODART", anamag().get("GRMERC").left(3)); - _sconti.read(); - } - break; - default: - error_box("Tipo di chiave righe sconti '%c' non valida!", rigakey); - break; - } - - const bool found = _sconti.good(); - - if (found && sco_scagl) - { - TRectype rec(_sconti.curr()); - int last_scagl = 0; - int scagl = _sconti.get_int("NSCAGL"); - const real qta(riga().get_real(FR_QTA)); - real qta_lim(_sconti.get_real("QLIM")); - - while (_sconti.good() && scagl > last_scagl && qta_lim > ZERO && qta > qta_lim) - { - if (_sconti.next() == NOERR) - { - last_scagl = scagl; - scagl = _sconti.get_int("NSCAGL"); - qta_lim =_sconti.get_real("QLIM"); - rec = _sconti.curr(); - } - } - _rcondv.read(rec); - } - if (!found) - _sconti.zero(); - _load_mask |= load_scagl_only && sco_scagl; - _load_mask |= load_scagl_only && sco_um_gest; - set_sconto(_sconti.get("SCONTO")); - _load_mask = !load_um_only && !load_scagl_only; - } - break; - case 'C': - set_sconto(clifo().get(LF_CFVEN, "SCONTO")); - break; - default: - error_box("Tipo di gestione sconti '%c' non valido!", gestione ); - break; - } - } - - if (riga() && riga().get("PERCPROVV") >= 0 && riga().field(FR_PERCPROV).active()) - { - const TString16 codage(testa().get(f_CODAG)); - - if (codage.not_empty()) - { - TTable age("AGE"); - - age.put("CODTAB", codage); - if (age.read() == NOERR) - { - char tipoprovv = age.get("S6")[0]; - - if (tipoprovv <= ' ') - tipoprovv = config_ditta().get_char( "AGETIPOPERC", "ve" ); - -// if (!full_load) -// { -// if (tipoprovv == 'L' && found_condv) -// set_provv(_rcondv.get_real("PERCPROVV")); -// } -// else - { - switch (tipoprovv) - { - case 'A': - set_provv(age.get_real("R0")); - break; - case 'C': - set_provv(real(clifo().get(LF_CFVEN, "PERCPROVV"))); - break; - case 'L': - if (found_condv) - { - _load_mask |= load_scagl_only && sco_scagl; - _load_mask |= load_scagl_only && sco_um_gest; - set_provv(_rcondv.get_real("PERCPROVV")); - } - else - set_provv(anamag().get_real("PERCPROVV")); - break; - case 'V': - { - TString16 catven(testa().get("CATVEN")); - - if (catven.empty()) - catven = clifo().get(LF_CFVEN, "CATVEN"); - - if (catven.not_empty()) - { - TTable cve("CVE"); - - cve.put("CODART", codage); - if (cve.read() == NOERR) - set_provv(cve.get_real("R0")); - } - } - break; - default: - error_box("Tipo di gestione provvigioni '%c' non valido!", tipoprovv ); - break; - } - } - } - } - } -} -*/ - -void TCondizione_vendita::put_condv(const char *tipocv,const char *codicecv,const char *catven,const char *tipocf,const char *codcf) -{ - _condv.put("TIPO",tipocv); - _condv.put("CATVEN",catven); - _condv.put("TIPOCF",tipocf); - _condv.put("CODCF",codcf); - _condv.put("COD",codicecv); -} - -void TCondizione_vendita::put_listino(const char * codlist,const char *catven) -{ - if( !config_ditta().get_bool("GESLISCV", "ve")) - put_condv("L",codlist,"","",""); - else - put_condv("L",codlist,catven,"",""); -} -void TCondizione_vendita::put_contratto(const char * codcontr,const char *tipocf,const char *codcf) -{ - put_condv("C",codcontr,"",tipocf,codcf); -} -void TCondizione_vendita::put_offerta(const char * codoff) -{ - put_condv("C",codoff,"","",""); -} - - -TCondizione_vendita::TCondizione_vendita(TConfig * ditta, - TLocalisamfile * anamag, TLocalisamfile * umart) - : _condv(LF_CONDV), _rcondv(LF_RCONDV), - _sconti( LF_SCONTI ), - _anamag(anamag), _umart(umart), _config_ditta(ditta), _ivarid(FALSE) -{ -} - - - - -