Patch level :10.0
Files correlati : Ricompilazione Demo : [ ] Commento :adesso genera dalla anagrafica git-svn-id: svn://10.65.10.50/trunk@19358 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
cb700e75f9
commit
2a4f005d77
@ -24,5 +24,7 @@
|
||||
#define RCONDV_CODLOTTO "CODLOTTO"
|
||||
#define RCONDV_ARTES "ARTES"
|
||||
#define RCONDV_DATAULTAUM "DATAULTAUM"
|
||||
#define RCONDV_PRZSTO "PRZSTO"
|
||||
#define RCONDV_DATAPRZSTO "DATAPRZSTO"
|
||||
|
||||
#endif
|
||||
|
123
ve/ve2500.cpp
123
ve/ve2500.cpp
@ -6,6 +6,7 @@
|
||||
#include <relapp.h>
|
||||
|
||||
#include "../mg/anamag.h"
|
||||
#include "../mg/umart.h"
|
||||
#include "condv.h"
|
||||
#include "rcondv.h"
|
||||
|
||||
@ -78,18 +79,19 @@ void TGestione_listini_semplice_mask_genera::copia_listino()
|
||||
const TString& ori_codlis = get(F_COD);
|
||||
const real ricarico = get_real(F_RICARICO);
|
||||
|
||||
//vanno fuori dall'if(get_bool(F_COPIATESTA)) perchè rec_ori_testata serve in seguito! (che schifo!)
|
||||
TToken_string key;
|
||||
key.add("L");
|
||||
key.add(ori_catven);
|
||||
key.add("");
|
||||
key.add("");
|
||||
key.add(ori_codlis);
|
||||
const TRectype& rec_ori_testata = cache().get(LF_CONDV, key);
|
||||
|
||||
//TESTATA
|
||||
//se richiesto mette nei campi della maschera principale i dati di testata
|
||||
if (get_bool(F_COPIATESTA))
|
||||
{
|
||||
TToken_string key;
|
||||
key.add("L");
|
||||
key.add(ori_catven);
|
||||
key.add("");
|
||||
key.add("");
|
||||
key.add(ori_codlis);
|
||||
const TRectype& rec_ori_testata = cache().get(LF_CONDV, key);
|
||||
|
||||
//magico metodino per scrivere sui campi della maschera principale (testata nuovo listino) i dati della testata..
|
||||
//..del listino originale (senza usare una lunghissima serie di set su ogni campo!)
|
||||
FOR_EACH_MASK_FIELD((*_main_mask), i, f)
|
||||
@ -118,8 +120,16 @@ void TGestione_listini_semplice_mask_genera::copia_listino()
|
||||
TSheet_field& sf_righe = _main_mask->sfield(F_L_RIGHE);
|
||||
TMask& msk = sf_righe.sheet_mask();
|
||||
//record corrente del recordset
|
||||
const TRectype& riga_corrente = righe_listino.cursor()->curr();
|
||||
TRectype& riga_corrente = righe_listino.cursor()->curr();
|
||||
TString80 val;
|
||||
|
||||
//alcune date utili nelle righe
|
||||
TDate data_ult_aum = _main_mask->get_date(F_L_VALINI);
|
||||
if (!data_ult_aum.ok())
|
||||
data_ult_aum = TDate(TODAY);
|
||||
TDate data_prz_storico = rec_ori_testata.get_date(CONDV_VALIN);
|
||||
if (!data_prz_storico.ok())
|
||||
data_prz_storico = data_ult_aum - 1L;
|
||||
//scorre tutte le righe listino del recordset e le sbatte nello sheet della maschera principale
|
||||
for (bool ok = righe_listino.move_first(); ok; ok = righe_listino.move_next())
|
||||
{
|
||||
@ -144,8 +154,14 @@ void TGestione_listini_semplice_mask_genera::copia_listino()
|
||||
val = fr->read(riga_corrente);
|
||||
if (fr->name() == RCONDV_PREZZO && !ricarico.is_zero()) //gestione del ricarico sul listino
|
||||
{
|
||||
const real prezzo = riga_corrente.get_real(RCONDV_PREZZO) * (1 + ricarico / CENTO);
|
||||
val = prezzo.string();
|
||||
const real old_prezzo = riga_corrente.get_real(RCONDV_PREZZO);
|
||||
const real new_prezzo = old_prezzo * (1 + ricarico / CENTO);
|
||||
val = new_prezzo.string();
|
||||
//aggiorna i campi direttamente sul record, in modo che quando saranno incontrati successivamente,...
|
||||
//..saranno già a posto senza dover rifare tutti i ragionamenti sul ricarico
|
||||
riga_corrente.put(RCONDV_DATAULTAUM, data_ult_aum);
|
||||
riga_corrente.put(RCONDV_PRZSTO, old_prezzo);
|
||||
riga_corrente.put(RCONDV_DATAPRZSTO, data_prz_storico);
|
||||
}
|
||||
row.add(val, sf_righe.cid2index(f->dlg()));
|
||||
}
|
||||
@ -162,6 +178,91 @@ void TGestione_listini_semplice_mask_genera::copia_listino()
|
||||
//----------------------------
|
||||
void TGestione_listini_semplice_mask_genera::crea_da_anamag()
|
||||
{
|
||||
//prende i dati dalla maschera per crearsi una query di generazione righe sheet
|
||||
TString query;
|
||||
query << "USE ANAMAG\n";
|
||||
//incasinatissima SELECT
|
||||
TString select;
|
||||
|
||||
//è stato selezionato il gruppo/sottogruppo merceologico?
|
||||
TString8 grmerc;
|
||||
if (!field(F_GRMERC).empty())
|
||||
{
|
||||
grmerc.format("%-3s%-2s", (const char*)get(F_GRMERC),(const char*)get(F_SOTGRMERC));
|
||||
grmerc.rtrim();
|
||||
select << "(GRMERC=#GRMERC)";
|
||||
}
|
||||
//è stato selezionato il raggruppamento fiscale?
|
||||
const TString& raggfis = get(F_RAGFIS);
|
||||
if (raggfis.full())
|
||||
{
|
||||
if (select.full())
|
||||
select << "&&";
|
||||
select << "(RAGGFIS=#RAGGFIS)";
|
||||
}
|
||||
if (select.full())
|
||||
query << "SELECT " << select << "\n";
|
||||
|
||||
//parte FROM/TO comune
|
||||
query << "FROM CODART=#DACODART\n";
|
||||
query << "TO CODART=#ACODART\n";
|
||||
|
||||
TISAM_recordset recset(query);
|
||||
recset.set_var("#DACODART", get(F_DACODART));
|
||||
recset.set_var("#ACODART", get(F_ACODART));
|
||||
if (grmerc.full())
|
||||
recset.set_var("#GRMERC", grmerc);
|
||||
if (raggfis.full())
|
||||
recset.set_var("#RAGGFIS", raggfis);
|
||||
|
||||
const long recset_items = recset.items();
|
||||
TProgind pi(recset_items, TR("Importazione righe da anagrafica..."), true, true);
|
||||
|
||||
//fase riempimento sheet maschera principale
|
||||
TSheet_field& sf_righe = _main_mask->sfield(F_L_RIGHE);
|
||||
|
||||
const bool gest_um = _main_mask->get_bool(F_L_GESTUM);
|
||||
TRecord_array arr_art_um(LF_UMART, UMART_NRIGA);
|
||||
const bool gest_sco = _main_mask->get_bool(F_L_GESTSCO);
|
||||
//per ogni riga del recordset va ad aggiornare lo sheet sulla maschera (aggiunge la riga)
|
||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
|
||||
const TString& codart = recset.get("CODART").as_string();
|
||||
TRectype* key = new TRectype(LF_UMART);
|
||||
key->put(UMART_CODART, codart);
|
||||
arr_art_um.read(key);
|
||||
const int num_um = gest_um ? arr_art_um.rows() : 1;
|
||||
|
||||
for (int u = 1; u <= num_um; u++)
|
||||
{
|
||||
TToken_string& row = sf_righe.row(-1);
|
||||
row.add('A', 0);
|
||||
row.add(codart, 1);
|
||||
row.add(recset.get("DESCR").as_string(), 2);
|
||||
const TRectype& rec_umart = arr_art_um.row(u);
|
||||
row.add(rec_umart.get(UMART_PREZZO), 3);
|
||||
//se attivata gestione unità di misura...
|
||||
if (gest_um)
|
||||
row.add(rec_umart.get(UMART_UM), 4);
|
||||
|
||||
row.add(recset.get("SCONTO").as_string(), 7);
|
||||
if (gest_sco)
|
||||
{
|
||||
const TString& codiva = recset.get("CODIVA").as_string();
|
||||
if (codiva.full())
|
||||
{
|
||||
row.add("X", 8);
|
||||
row.add(codiva, 9);
|
||||
}
|
||||
}
|
||||
|
||||
row.add(recset.get("PERCPROVV").as_string(), 18);
|
||||
}
|
||||
} //for(bool ok=...
|
||||
sf_righe.force_update();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user