Patch level :10.0
Files correlati : Ricompilazione Demo : [ ] Commento : euroforesi git-svn-id: svn://10.65.10.50/branches/R_10_00@21387 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
152017b6ec
commit
24c95a52fc
@ -6,6 +6,7 @@
|
||||
#include <recset.h>
|
||||
|
||||
#include <cfven.h>
|
||||
#include "../ve/clifor.h"
|
||||
#include "../ve/condv.h"
|
||||
#include "../ve/rcondv.h"
|
||||
#include "../ve/velib.h"
|
||||
@ -64,6 +65,8 @@ TObject* TDoc_cache::key2obj(const char* key)
|
||||
doc->put(DOC_CODCF, _codcf);
|
||||
|
||||
doc->cli2doc(); //questo metodo riempie in automatico tutti i campi di testata collegati al cliente!
|
||||
|
||||
doc->put(DOC_CAUSMAG, doc->tipo().caus_mov()); //causale magazzino collegata al tipo
|
||||
}
|
||||
|
||||
return doc;
|
||||
@ -145,7 +148,7 @@ bool TEdit_rdocs_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
TToken_string& riga_sheet = sfield(o.dlg()).row(jolly); //riga nuova dello sheet
|
||||
const TString& codnum = get(F_CODNUM);
|
||||
riga_sheet.add(codnum, _pos_num);
|
||||
const int anno = get_int(F_ANNO);
|
||||
const int anno = get_date(F_DATADOC).year();
|
||||
riga_sheet.add(anno, _pos_anno);
|
||||
riga_sheet.add('D', _pos_provv);
|
||||
}
|
||||
@ -301,53 +304,40 @@ real TEdit_rdocs_mask::find_prezzo_articolo(const TString& codart) const
|
||||
//LISTINI: tipo=L|catven=catven|tipocf=|codcf=|cod=codlis|tiporiga=A|codriga=codart|um=um
|
||||
if (prezzo.is_zero())
|
||||
{
|
||||
TString query_list;
|
||||
query_list << "USE CONDV";
|
||||
query_list << "\nFROM TIPO=L";
|
||||
query_list << "\nTO TIPO=L";
|
||||
//usa una funzione automaggica dei clifor che raccatta il listino valido per il cliente in data del documento
|
||||
TCli_for clifor('C', codcf);
|
||||
const TString& codlist = clifor.find_listino_al(data_new_doc);
|
||||
//se trova un listino valido raccatta il prezzo dalla riga
|
||||
if (codlist.full())
|
||||
{
|
||||
TToken_string key_list;
|
||||
key_list.add("L");
|
||||
|
||||
TISAM_recordset recset_list(query_list);
|
||||
const long recset_list_items = recset_list.items();
|
||||
for (bool ok = recset_list.move_first(); ok; ok = recset_list.move_next())
|
||||
{
|
||||
const TDate dataini_l = recset_list.get(CONDV_VALIN).as_date();
|
||||
TDate datafin_l = recset_list.get(CONDV_VALFIN).as_date();
|
||||
if (!datafin_l.ok())
|
||||
datafin_l = data_new_doc;
|
||||
if (dataini_l <= data_new_doc && datafin_l >= data_new_doc)
|
||||
{
|
||||
TString4 codlist = recset_list.get(CONDV_COD).as_string();
|
||||
//la catven se c'è è del cliente
|
||||
TToken_string key_cfven;
|
||||
key_cfven.add("C");
|
||||
key_cfven.add(codcf);
|
||||
const TString& catven = cache().get(LF_CFVEN, key_cfven, CFV_CATVEN);
|
||||
|
||||
const bool gestum_list = recset_list.get(CONDV_GESTUM).as_string() == "X";
|
||||
key_list.add(catven);
|
||||
key_list.add("");
|
||||
key_list.add("");
|
||||
key_list.add(codlist);
|
||||
|
||||
TToken_string key_list;
|
||||
key_list.add("L");
|
||||
const bool gestum_list = cache().get(LF_CONDV, key_list, CONDV_GESTUM) == "X";
|
||||
|
||||
//la catven se c'è è del cliente
|
||||
TToken_string key_cfven;
|
||||
key_cfven.add("C");
|
||||
key_cfven.add(codcf);
|
||||
const TString& catven = cache().get(LF_CFVEN, key_cfven, CFV_CATVEN);
|
||||
key_list.add("A");
|
||||
key_list.add(codart);
|
||||
|
||||
key_list.add(catven);
|
||||
key_list.add("");
|
||||
key_list.add("");
|
||||
key_list.add(codlist);
|
||||
if (gestum_list)
|
||||
key_list.add(um);
|
||||
|
||||
key_list.add("A");
|
||||
key_list.add(codart);
|
||||
if (gestum_list)
|
||||
key_list.add(um);
|
||||
const TRectype& rec_listino = cache().get(LF_RCONDV, key_list);
|
||||
const real listino_prezzo = rec_listino.get_real(RCONDV_PREZZO);
|
||||
|
||||
const TRectype& rec_listino = cache().get(LF_RCONDV, key_list);
|
||||
const real listino_prezzo = rec_listino.get_real(RCONDV_PREZZO);
|
||||
if (!listino_prezzo.is_zero())
|
||||
{
|
||||
prezzo = listino_prezzo;
|
||||
break;
|
||||
}
|
||||
} //if (dataini_l <= data_new_doc...
|
||||
} //for (bool ok = recset_list.move_first()...
|
||||
if (!listino_prezzo.is_zero())
|
||||
prezzo = listino_prezzo;
|
||||
}
|
||||
} //if (prezzo.is_zero())...
|
||||
|
||||
//3) umart
|
||||
@ -357,6 +347,15 @@ real TEdit_rdocs_mask::find_prezzo_articolo(const TString& codart) const
|
||||
return prezzo;
|
||||
}
|
||||
|
||||
//funzione di ordinamento dello sheet in base al codart
|
||||
static int sort_by_codart(TSheet_field& s, int r1, int r2)
|
||||
{
|
||||
const int pos = s.cid2index(S_CODART);
|
||||
const char* a1 = s.cell(r1, pos);
|
||||
const char* a2 = s.cell(r2, pos);
|
||||
return strcmp(a1, a2);
|
||||
}
|
||||
|
||||
//riempie lo sheet in base ai parametri di testata
|
||||
void TEdit_rdocs_mask::fill_sheet()
|
||||
{
|
||||
@ -364,14 +363,13 @@ void TEdit_rdocs_mask::fill_sheet()
|
||||
TString query;
|
||||
query << "USE DOC KEY 2";
|
||||
query << "\nSELECT (CODNUM=#CODNUM)&&(DOCEVASO!=\"X\")";
|
||||
query << "\nFROM TIPOCF=C CODCF=#CODCF PROVV=D ANNO=#ANNO";
|
||||
query << "\nTO TIPOCF=C CODCF=#CODCF PROVV=D ANNO=#ANNO";
|
||||
query << "\nFROM TIPOCF=C CODCF=#CODCF PROVV=D";
|
||||
query << "\nTO TIPOCF=C CODCF=#CODCF PROVV=D";
|
||||
|
||||
TISAM_recordset recset(query);
|
||||
|
||||
recset.set_var("#CODCF", get_long(F_CODCF));
|
||||
recset.set_var("#CODNUM", get(F_CODNUM));
|
||||
recset.set_var("#ANNO", get(F_ANNO));
|
||||
|
||||
const long items = recset.items();
|
||||
const TRectype& rec = recset.cursor()->curr();
|
||||
@ -398,6 +396,7 @@ void TEdit_rdocs_mask::fill_sheet()
|
||||
}
|
||||
}
|
||||
|
||||
sf_righe.sort(sort_by_codart);
|
||||
sf_righe.force_update();
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
#define F_RAGSOC 302
|
||||
#define F_CODNUM 303
|
||||
#define F_DESNUM 304
|
||||
#define F_ANNO 305
|
||||
#define F_TIPODOC 306
|
||||
#define F_DESTIPO 307
|
||||
#define F_DATADOC 308
|
||||
|
@ -86,14 +86,6 @@ BEGIN
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 1 3 "Anno "
|
||||
FLAGS "A"
|
||||
CHECKTYPE REQUIRED
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 1 4 "Parametri degli eventuali documenti da creare"
|
||||
|
Loading…
x
Reference in New Issue
Block a user