Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@20923 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2b49469581
commit
a0803b776d
@ -156,7 +156,7 @@ bool TDocumenti_premio_msk::on_field_event(TOperable_field& o, TField_event e, l
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case S_CODART:
|
case S_CODART:
|
||||||
if (e == fe_modify)
|
if (e == fe_init || e == fe_modify)
|
||||||
{
|
{
|
||||||
//caricamento del prezzo in fase modifica codart: sequenza contratto->listino->umart
|
//caricamento del prezzo in fase modifica codart: sequenza contratto->listino->umart
|
||||||
//non è possibile mettere un prezzo a mano alla cazzo!
|
//non è possibile mettere un prezzo a mano alla cazzo!
|
||||||
@ -305,15 +305,18 @@ void TDocumenti_premio::read_rows(TMask& m)
|
|||||||
if (tipo == HARDY_TIPORIGA_MERCE || tipo.blank())
|
if (tipo == HARDY_TIPORIGA_MERCE || tipo.blank())
|
||||||
{
|
{
|
||||||
TToken_string& row = sheet.row(-1); //aggiunge una riga vuota
|
TToken_string& row = sheet.row(-1); //aggiunge una riga vuota
|
||||||
for (int i = sm.fields()-1; i >= 0; i--) //giro su tutti i campi della maschera di riga...
|
for (int j = sm.fields()-1; j >= 0; j--) //giro su tutti i campi della maschera di riga...
|
||||||
{
|
{
|
||||||
TMask_field& mf = sm.fld(i); //aggiunge solo quelli che hanno un field
|
TMask_field& mf = sm.fld(j); //aggiunge solo quelli che hanno un field
|
||||||
if ((mf.field() != NULL) && (mf.dlg() > 100)) //> 100 per evitare errori sui campi dlg_null
|
if ((mf.field() != NULL) && (mf.dlg() > 100)) //> 100 per evitare errori sui campi dlg_null
|
||||||
{
|
{
|
||||||
const int idx = sheet.cid2index(mf.dlg());
|
const int idx = sheet.cid2index(mf.dlg());
|
||||||
row.add(mf.field()->read(rec), idx);
|
row.add(mf.field()->read(rec), idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//aggiorna al volo la riga (serve per aggiornare il prezzo prendendolo dal listino cliente; funziona perchè legato alla on_field di S_CODART..
|
||||||
|
//..in modalità fe_init)
|
||||||
|
sheet.check_row(sheet.items()-1);
|
||||||
}
|
}
|
||||||
else if (tipo == HARDY_TIPORIGA_SOMMA)//se invece è la riga con le somme anticipate/maturate (solo 1 per contratto!) -> va messa in testata
|
else if (tipo == HARDY_TIPORIGA_SOMMA)//se invece è la riga con le somme anticipate/maturate (solo 1 per contratto!) -> va messa in testata
|
||||||
{
|
{
|
||||||
@ -322,8 +325,7 @@ void TDocumenti_premio::read_rows(TMask& m)
|
|||||||
m.set(F_ANTICIPATO, anticipato);
|
m.set(F_ANTICIPATO, anticipato);
|
||||||
m.set(F_RESO_STORICO, maturato);
|
m.set(F_RESO_STORICO, maturato);
|
||||||
}
|
}
|
||||||
|
} //for (int i = 1;...
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include <doc.h>
|
#include <doc.h>
|
||||||
#include <rdoc.h>
|
#include <rdoc.h>
|
||||||
|
|
||||||
|
#include "../mg/umart.h"
|
||||||
|
#include "../ve/condv.h"
|
||||||
#include "../ve/rcondv.h"
|
#include "../ve/rcondv.h"
|
||||||
|
|
||||||
#include "halib.h"
|
#include "halib.h"
|
||||||
@ -33,6 +35,7 @@ protected:
|
|||||||
void fill_sheet();
|
void fill_sheet();
|
||||||
|
|
||||||
int elabora_contratto(TToken_string* riga_sheet, TLog_report& log);
|
int elabora_contratto(TToken_string* riga_sheet, TLog_report& log);
|
||||||
|
real find_costo(const TString& codart, const TString& um) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
THardy_tied_mask();
|
THardy_tied_mask();
|
||||||
@ -170,6 +173,26 @@ void THardy_tied_mask::check_all(const bool checked)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
real THardy_tied_mask::find_costo(const TString& codart, const TString& um) const
|
||||||
|
{
|
||||||
|
const TRectype& rec_anamag = cache().get(LF_ANAMAG, codart);
|
||||||
|
real costo = rec_anamag.get_real(ANAMAG_ULTCOS1);
|
||||||
|
if (costo <= ZERO)
|
||||||
|
costo = rec_anamag.get_real(ANAMAG_COSTSTD);
|
||||||
|
|
||||||
|
if (costo <= ZERO)
|
||||||
|
{
|
||||||
|
TLocalisamfile umart(LF_UMART);
|
||||||
|
umart.put(UMART_CODART, codart);
|
||||||
|
umart.put(UMART_UM, um);
|
||||||
|
const int err_umart = umart.read();
|
||||||
|
if (err_umart == NOERR)
|
||||||
|
costo = umart.get_real(UMART_PREZZO) * 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
return costo;
|
||||||
|
}
|
||||||
|
|
||||||
//metodo base per l'elaborazione dei contratti pareggiati
|
//metodo base per l'elaborazione dei contratti pareggiati
|
||||||
int THardy_tied_mask::elabora_contratto(TToken_string* riga_sheet, TLog_report& log)
|
int THardy_tied_mask::elabora_contratto(TToken_string* riga_sheet, TLog_report& log)
|
||||||
{
|
{
|
||||||
@ -178,18 +201,43 @@ int THardy_tied_mask::elabora_contratto(TToken_string* riga_sheet, TLog_report&
|
|||||||
const int anno = riga_sheet->get_int(_pos_anno);
|
const int anno = riga_sheet->get_int(_pos_anno);
|
||||||
const TString& codnum = riga_sheet->get(_pos_codnum);
|
const TString& codnum = riga_sheet->get(_pos_codnum);
|
||||||
const long ndoc = riga_sheet->get_long(_pos_ndoc);
|
const long ndoc = riga_sheet->get_long(_pos_ndoc);
|
||||||
const TString4 tipodoc = riga_sheet->get(_pos_tipodoc);
|
|
||||||
|
|
||||||
//crea il contratto premi...
|
//crea il contratto premi...
|
||||||
TContratto_premi contratto_premi('D', anno, codnum, ndoc);
|
TContratto_premi contratto_premi('D', anno, codnum, ndoc);
|
||||||
//..e le sue righe
|
//..e le sue righe
|
||||||
TRecord_array& righe_contr_premi = contratto_premi.body();
|
TRecord_array& righe_contr_premi = contratto_premi.body();
|
||||||
|
|
||||||
|
//indicatore di errore complessivo!
|
||||||
|
int err = NOERR;
|
||||||
|
|
||||||
//cerca il listino cliente corrispondente..
|
//cerca il listino cliente corrispondente..
|
||||||
const TString4 listino_cliente = contratto_premi.get(DOC_CODCONT);
|
const TString4 listino_cliente = contratto_premi.get(DOC_CODCONT);
|
||||||
|
|
||||||
|
TToken_string key;
|
||||||
|
key.add("C"); //0
|
||||||
|
key.add(""); //1
|
||||||
|
key.add("C"); //2
|
||||||
|
key.add(codcf); //3
|
||||||
|
key.add(listino_cliente); //4
|
||||||
|
TLocalisamfile condv(LF_CONDV);
|
||||||
|
condv.put(CONDV_TIPO, key.get(0));
|
||||||
|
condv.put(CONDV_CATVEN, key.get(1));
|
||||||
|
condv.put(CONDV_TIPOCF, key.get(2));
|
||||||
|
condv.put(CONDV_CODCF, key.get(3));
|
||||||
|
condv.put(RCONDV_COD, key.get(4));
|
||||||
|
err = condv.read();
|
||||||
|
//se non lo trova (non dovrebbe MAI accadere, ma i listini cliente possono essere erroneamente accoppati via gestione contratti campo
|
||||||
|
if (err != NOERR)
|
||||||
|
{
|
||||||
|
TString msg;
|
||||||
|
msg.format("Il contratto premi %4d%s%7ld del cliente %6ld non ha un listino cliente associato !! Errore: %d",
|
||||||
|
anno, (const char*)codnum, ndoc, codcf, err);
|
||||||
|
log.log(2, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
//se lo trova scatta l'analisi delle righe listino cliente
|
||||||
TLocalisamfile rcondv(LF_RCONDV);
|
TLocalisamfile rcondv(LF_RCONDV);
|
||||||
|
|
||||||
int err = NOERR;
|
|
||||||
//e adesso scatta la ricerca dell'articolo del contratto premi dentro le righe del listino cliente...
|
//e adesso scatta la ricerca dell'articolo del contratto premi dentro le righe del listino cliente...
|
||||||
for (int i = righe_contr_premi.last_row(); i > 0 && err == NOERR; i = righe_contr_premi.pred_row(i))
|
for (int i = righe_contr_premi.last_row(); i > 0 && err == NOERR; i = righe_contr_premi.pred_row(i))
|
||||||
{
|
{
|
||||||
@ -200,14 +248,18 @@ int THardy_tied_mask::elabora_contratto(TToken_string* riga_sheet, TLog_report&
|
|||||||
const TString80 codart = riga.get(RDOC_CODART);
|
const TString80 codart = riga.get(RDOC_CODART);
|
||||||
const TString4 um = riga.get(RDOC_UMQTA);
|
const TString4 um = riga.get(RDOC_UMQTA);
|
||||||
//adesso gli tocca cercare lo stesso articolo (e UM) dentro le righe listino cliente per raccatare il prezzo
|
//adesso gli tocca cercare lo stesso articolo (e UM) dentro le righe listino cliente per raccatare il prezzo
|
||||||
rcondv.put(RCONDV_TIPO, 'C');
|
rcondv.put(RCONDV_TIPO, key.get(0));
|
||||||
rcondv.put(RCONDV_CATVEN, "");
|
rcondv.put(RCONDV_CATVEN, key.get(1));
|
||||||
rcondv.put(RCONDV_TIPOCF, 'C');
|
rcondv.put(RCONDV_TIPOCF, key.get(2));
|
||||||
rcondv.put(RCONDV_CODCF, codcf);
|
rcondv.put(RCONDV_CODCF, key.get(3));
|
||||||
rcondv.put(RCONDV_COD, listino_cliente);
|
rcondv.put(RCONDV_COD, key.get(4));
|
||||||
rcondv.put(RCONDV_TIPORIGA, 'A');
|
rcondv.put(RCONDV_TIPORIGA, 'A');
|
||||||
rcondv.put(RCONDV_CODRIGA, codart);
|
rcondv.put(RCONDV_CODRIGA, codart);
|
||||||
rcondv.put(RCONDV_UM, um);
|
|
||||||
|
//la u.m. ci va solo se il listino cliente ha la gestione u.m. (tanto per complicarsi la vita!)
|
||||||
|
const bool gestum_contr = cache().get(LF_CONDV, key, CONDV_GESTUM) == "X";
|
||||||
|
if (gestum_contr)
|
||||||
|
rcondv.put(RCONDV_UM, um);
|
||||||
|
|
||||||
err = rcondv.read(_isequal, _lock);
|
err = rcondv.read(_isequal, _lock);
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
@ -219,8 +271,18 @@ int THardy_tied_mask::elabora_contratto(TToken_string* riga_sheet, TLog_report&
|
|||||||
real prezzo = rcondv.get_real(RCONDV_PREZZO);
|
real prezzo = rcondv.get_real(RCONDV_PREZZO);
|
||||||
//aggiorna il prezzo con una formula ladresca...
|
//aggiorna il prezzo con una formula ladresca...
|
||||||
prezzo = prezzo - premio + ns_carico;
|
prezzo = prezzo - premio + ns_carico;
|
||||||
rcondv.put(RCONDV_PREZZO, prezzo);
|
|
||||||
|
|
||||||
|
//controlla di non avere un prezzo del cazzo!
|
||||||
|
const real costo = find_costo(codart, um);
|
||||||
|
if (prezzo < costo)
|
||||||
|
{
|
||||||
|
TString msg;
|
||||||
|
msg.format("Il prezzo dell'articolo %s e' inferiore alla meta' del costo !", (const char*)codart);
|
||||||
|
log.log(2, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcondv.put(RCONDV_PREZZO, prezzo);
|
||||||
|
|
||||||
err = rcondv.rewrite();
|
err = rcondv.rewrite();
|
||||||
if (err != NOERR)
|
if (err != NOERR)
|
||||||
{
|
{
|
||||||
@ -244,7 +306,7 @@ int THardy_tied_mask::elabora_contratto(TToken_string* riga_sheet, TLog_report&
|
|||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
{
|
{
|
||||||
const TTipo_documento& tipodoc = contratto_premi.tipo();
|
const TTipo_documento& tipodoc = contratto_premi.tipo();
|
||||||
const TString& stato_scaduto = tipodoc.stato_chiuso();
|
const char stato_scaduto = tipodoc.stato_chiuso();
|
||||||
|
|
||||||
contratto_premi.put(DOC_STATO, stato_scaduto);
|
contratto_premi.put(DOC_STATO, stato_scaduto);
|
||||||
err = contratto_premi.rewrite();
|
err = contratto_premi.rewrite();
|
||||||
@ -304,6 +366,7 @@ bool THardy_tied_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
|||||||
if (checked == 'X')
|
if (checked == 'X')
|
||||||
int err = elabora_contratto(riga, log);
|
int err = elabora_contratto(riga, log);
|
||||||
}
|
}
|
||||||
|
log.print_or_preview();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -355,6 +418,8 @@ void THardy_tied::main_loop()
|
|||||||
|
|
||||||
bool THardy_tied::create()
|
bool THardy_tied::create()
|
||||||
{
|
{
|
||||||
|
open_files(LF_DOC, LF_RIGHEDOC, LF_CONDV, LF_RCONDV, 0);
|
||||||
|
|
||||||
return TSkeleton_application::create();
|
return TSkeleton_application::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
projects/ha0.rc
Executable file
4
projects/ha0.rc
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
"9012" ICON DISCARDABLE "../res/exe.ico"
|
||||||
|
|
||||||
|
rcinclude ../../wx289/include/wx/msw/wx.rc
|
||||||
|
|
@ -338,10 +338,18 @@
|
|||||||
RelativePath="..\ha\ha0300.cpp"
|
RelativePath="..\ha\ha0300.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ha\ha0400.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\ha\ha0500.cpp"
|
RelativePath="..\ha\ha0500.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ha\halib.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Masks"
|
Name="Masks"
|
||||||
@ -355,6 +363,10 @@
|
|||||||
RelativePath="..\ha\ha0300a.uml"
|
RelativePath="..\ha\ha0300a.uml"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ha\ha0400a.uml"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\ha\ha0500a.uml"
|
RelativePath="..\ha\ha0500a.uml"
|
||||||
>
|
>
|
||||||
@ -376,6 +388,10 @@
|
|||||||
RelativePath="..\ha\ha0300a.h"
|
RelativePath="..\ha\ha0300a.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ha\ha0400a.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\ha\ha0500a.h"
|
RelativePath="..\ha\ha0500a.h"
|
||||||
>
|
>
|
||||||
@ -427,27 +443,8 @@
|
|||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="li0.rc"
|
RelativePath=".\ha0.rc"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
ResourceOutputFileName="..\Debug/li0.res"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\lib\vedoc.lib"
|
RelativePath="..\lib\vedoc.lib"
|
||||||
|
@ -451,6 +451,14 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Menu"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ps\ps1001.men"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\lib\AgaLib.lib"
|
RelativePath="..\lib\AgaLib.lib"
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user