Patch level :10.0
Files correlati : Ricompilazione Demo : [ ] Commento : aggiunta la gestione dei codarti inesistenti (figa un casino!) git-svn-id: svn://10.65.10.50/trunk@19361 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b307763864
commit
6d42b8894a
@ -6,6 +6,7 @@
|
||||
#include <relapp.h>
|
||||
|
||||
#include "../mg/anamag.h"
|
||||
#include "../mg/codcorr.h"
|
||||
#include "../mg/umart.h"
|
||||
#include "condv.h"
|
||||
#include "rcondv.h"
|
||||
@ -459,7 +460,7 @@ bool TGestione_listini_semplice_mask::on_field_event(TOperable_field &o, TField_
|
||||
return error_box(TR("Non è possibile inserire lo stesso articolo più di una volta!"));
|
||||
}
|
||||
break;
|
||||
case DLG_CREA:
|
||||
case DLG_CREA: //copia / generazione listino
|
||||
if (e == fe_button)
|
||||
{
|
||||
TGestione_listini_semplice_mask_genera mask_gen(this); //gli passa la maschera principale
|
||||
@ -467,6 +468,41 @@ bool TGestione_listini_semplice_mask::on_field_event(TOperable_field &o, TField_
|
||||
mask_gen.crea_listino();
|
||||
}
|
||||
break;
|
||||
case DLG_COMPATTA: //eliminazione delle righe con articoli inesistenti!
|
||||
if (e == fe_button)
|
||||
{
|
||||
TSheet_field& sf_righe = sfield(F_L_RIGHE);
|
||||
FOR_EACH_SHEET_ROW_BACK(sf_righe, r, row) //deve andare all'indietro per minimizzare il riordino righe
|
||||
{
|
||||
if (row->get_char(2) <= ' ') //le righe senza descrizione sono sbagliate (è obbligatoria per articoli ecc.)
|
||||
{
|
||||
bool kill_row = true;
|
||||
if (row->get_char(0) == 'A') //solo se è un articolo tenta di recuperarlo con il codice alternativo..(mah?)
|
||||
{
|
||||
TLocalisamfile file_codcorr(LF_CODCORR);
|
||||
file_codcorr.setkey(2);
|
||||
file_codcorr.put(CODCORR_CODARTALT, row->get(1));
|
||||
int err = file_codcorr.read();
|
||||
//se miracolosamente trova il record con il vecchio codart come codartalt...
|
||||
if (err == NOERR)
|
||||
{
|
||||
const TString& new_codart = file_codcorr.get(CODCORR_CODART); //il nuovo codart c'è x' è in key 1
|
||||
const TString& new_descr = cache().get(LF_ANAMAG, new_codart, ANAMAG_DESCR);
|
||||
if (!new_descr.blank())
|
||||
{
|
||||
row->add(new_codart, 1);
|
||||
row->add(new_descr, 2);
|
||||
kill_row = false;
|
||||
}
|
||||
}
|
||||
} //if(row->get_char(0)..
|
||||
if (kill_row)
|
||||
sf_righe.destroy(r, false);
|
||||
}
|
||||
}
|
||||
sf_righe.force_update();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -501,7 +537,7 @@ protected:
|
||||
virtual int rewrite(const TMask& m);
|
||||
virtual bool remove();
|
||||
|
||||
const TString80 find_descr(TToken_string& row);
|
||||
const TString& find_descr(TToken_string& row);
|
||||
|
||||
public:
|
||||
virtual TRelation *get_relation() const { return _rel; }
|
||||
@ -577,28 +613,24 @@ void TGestione_listini_semplice::save_rows()
|
||||
}
|
||||
}
|
||||
|
||||
const TString80 TGestione_listini_semplice::find_descr(TToken_string& row)
|
||||
const TString& TGestione_listini_semplice::find_descr(TToken_string& row)
|
||||
{
|
||||
TString80 descr;
|
||||
const char tiporiga = row.get_char(0);
|
||||
const TString& codriga = row.get(1);
|
||||
switch (tiporiga)
|
||||
{
|
||||
case 'A':
|
||||
descr = cache().get(LF_ANAMAG, codriga, ANAMAG_DESCR);
|
||||
break;
|
||||
return cache().get(LF_ANAMAG, codriga, ANAMAG_DESCR);
|
||||
case 'G':
|
||||
case 'S':
|
||||
descr = cache().get("GMC", codriga, "S0");
|
||||
break;
|
||||
return cache().get("GMC", codriga, "S0");
|
||||
case 'R':
|
||||
descr = cache().get("RFA", codriga, "S0");
|
||||
break;
|
||||
return cache().get("RFA", codriga, "S0");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return descr;
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
bool TGestione_listini_semplice::protected_record(TRectype& rec)
|
||||
@ -666,7 +698,7 @@ int TGestione_listini_semplice::read(TMask& m)
|
||||
const int codice = f->dlg();
|
||||
if (codice == F_CODRIGA_A || codice == F_CODRIGA_G || codice == F_CODRIGA_S || codice == F_CODRIGA_R)
|
||||
{
|
||||
const TString80 descr = find_descr(row);
|
||||
TString80 descr = find_descr(row);
|
||||
row.add(descr, 2);
|
||||
}
|
||||
} //if(fr!=NULL)
|
||||
|
@ -67,6 +67,7 @@
|
||||
|
||||
//bottoni
|
||||
#define DLG_CREA 501
|
||||
#define DLG_COMPATTA 502
|
||||
|
||||
|
||||
|
||||
|
@ -10,6 +10,12 @@ BEGIN
|
||||
PICTURE TOOL_IMPORT
|
||||
END
|
||||
|
||||
BUTTON DLG_COMPATTA 2 2
|
||||
BEGIN
|
||||
PROMPT 11 -1 "Co~mpatta"
|
||||
PICTURE TOOL_PACK
|
||||
END
|
||||
|
||||
#include <cancelbar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
Loading…
x
Reference in New Issue
Block a user