Patch level : 2.2
Files correlati : ve0 Ricompilazione Demo : [ ] Commento : Corretta proposta della commessa sulle spese a percentuale git-svn-id: svn://10.65.10.50/trunk@13752 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2ee558e8c1
commit
0b64b3ae0f
@ -134,8 +134,8 @@ int TLista_documenti::read(char provv, char tipocf, long clifo, int anno,
|
|||||||
_documenti.destroy();
|
_documenti.destroy();
|
||||||
for (cur = 0; cur.ok(); ++cur)
|
for (cur = 0; cur.ok(); ++cur)
|
||||||
{
|
{
|
||||||
const TString16 tipodoc = head.get(DOC_TIPODOC);
|
const TString4 tipodoc = head.get(DOC_TIPODOC);
|
||||||
const TString16 statodoc = head.get(DOC_STATO);
|
const TString4 statodoc = head.get(DOC_STATO);
|
||||||
bool match = FALSE;
|
bool match = FALSE;
|
||||||
|
|
||||||
for (int i = tipidoc.items()-1; i>=0; i--)
|
for (int i = tipidoc.items()-1; i>=0; i--)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#include <tabutil.h>
|
|
||||||
#include "velib.h"
|
#include "velib.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////
|
||||||
@ -248,11 +247,9 @@ int TDocumentoEsteso::readat(TBaseisamfile& file, TRecnotype nrec, word lockop)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec)
|
TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec)
|
||||||
: TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1)
|
: TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1)
|
||||||
{
|
{
|
||||||
// _iva = new TTable("%IVA");
|
|
||||||
// Inizializza i parametri di default
|
// Inizializza i parametri di default
|
||||||
_parm.qta_lit = 3; _parm.qta_val = 3;
|
_parm.qta_lit = 3; _parm.qta_val = 3;
|
||||||
}
|
}
|
||||||
|
@ -22,16 +22,10 @@
|
|||||||
#include "veuml.h"
|
#include "veuml.h"
|
||||||
#include "veuml1.h"
|
#include "veuml1.h"
|
||||||
#include "veini.h"
|
#include "veini.h"
|
||||||
|
|
||||||
#include "sconti.h"
|
#include "sconti.h"
|
||||||
|
|
||||||
#include "doc.h"
|
|
||||||
#include "rdoc.h"
|
|
||||||
|
|
||||||
|
|
||||||
class TOriginal_row_mask : public TAutomask
|
class TOriginal_row_mask : public TAutomask
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||||
virtual bool on_key(KEY key);
|
virtual bool on_key(KEY key);
|
||||||
@ -299,7 +293,7 @@ int TDocumento_mask::insert_anal_fields(TMask& m, int page, int lf, int& y,
|
|||||||
{
|
{
|
||||||
case LF_COMMESSE: fieldname = DOC_CODCMS; break;
|
case LF_COMMESSE: fieldname = DOC_CODCMS; break;
|
||||||
case LF_FASI : fieldname = DOC_FASCMS; break;
|
case LF_FASI : fieldname = DOC_FASCMS; break;
|
||||||
default : fieldname = DOC_CODCOSTO; break;
|
default : fieldname = DOC_CODCOSTO; break;
|
||||||
}
|
}
|
||||||
TFieldref* f = (TFieldref*)fld.field();
|
TFieldref* f = (TFieldref*)fld.field();
|
||||||
f->set_name(fieldname);
|
f->set_name(fieldname);
|
||||||
|
164
ve/velib06a.cpp
164
ve/velib06a.cpp
@ -1369,95 +1369,89 @@ bool sppr_handler( TMask_field& f, KEY key )
|
|||||||
|
|
||||||
if (key == K_TAB && (f.focusdirty() || row_mask.get(FR_DESCR).empty()))
|
if (key == K_TAB && (f.focusdirty() || row_mask.get(FR_DESCR).empty()))
|
||||||
{
|
{
|
||||||
const int pos = row_mask.id2pos(FR_PREZZO);
|
const TRectype& curr = ((TEdit_field&)f).browse()->cursor()->curr();
|
||||||
|
/*
|
||||||
if (pos >= 0)
|
const TString& cod = curr.get("COD");
|
||||||
|
char tiposp = RIGA_SPESEDOC;
|
||||||
|
if (cod == "PRS")
|
||||||
|
tiposp = RIGA_PRESTAZIONI; else
|
||||||
|
if (cod == "RSS")
|
||||||
|
tiposp = RIGA_RISORSE; else
|
||||||
|
if (cod == "ATR")
|
||||||
|
tiposp = RIGA_ATTREZZATURE;
|
||||||
|
const TSpesa_prest sp(row_mask.get(FR_CODART), tiposp);
|
||||||
|
*/
|
||||||
|
const TSpesa_prest sp(curr);
|
||||||
|
|
||||||
|
const int pos = row_mask.id2pos(FR_PREZZO);
|
||||||
|
if (pos >= 0 && !sp.empty())
|
||||||
{
|
{
|
||||||
TMask & mask = row_mask.get_sheet()->mask();
|
const char tipo = sp.tipo();
|
||||||
TEdit_field & e = (TEdit_field &) f;
|
const bool qta_val_fl = tipo == 'Q';
|
||||||
TRelation * r = e.browse()->cursor()->relation();
|
const bool perc_fl = tipo == 'P';
|
||||||
const TString16 cod = r->curr().get("COD");
|
int pos = row_mask.id2pos(FR_UMQTASP);
|
||||||
char tipo = RIGA_SPESEDOC;
|
|
||||||
|
|
||||||
if (cod == "PRS")
|
|
||||||
tipo = RIGA_PRESTAZIONI;
|
|
||||||
else
|
|
||||||
if (cod == "RSS")
|
|
||||||
tipo = RIGA_RISORSE;
|
|
||||||
else
|
|
||||||
if (cod == "ATR")
|
|
||||||
tipo = RIGA_ATTREZZATURE;
|
|
||||||
|
|
||||||
TSpesa_prest sp(row_mask.get(FR_CODART), tipo);
|
if (pos >= 0)
|
||||||
if (!sp.empty())
|
row_mask.fld(pos).enable(!perc_fl);
|
||||||
|
pos = row_mask.id2pos(FR_PREZZO);
|
||||||
|
if (pos >= 0)
|
||||||
|
row_mask.fld(pos).enable(!perc_fl);
|
||||||
|
pos = row_mask.id2pos(FR_SCONTO);
|
||||||
|
if (pos >= 0)
|
||||||
|
row_mask.fld(pos).enable(!perc_fl);
|
||||||
|
pos = row_mask.id2pos(FR_QTA);
|
||||||
|
if (pos >= 0)
|
||||||
{
|
{
|
||||||
const char tipo = sp.tipo();
|
row_mask.fld(pos).show(!perc_fl);
|
||||||
const bool qta_val_fl = tipo == 'Q';
|
row_mask.fld(pos).enable(qta_val_fl);
|
||||||
const bool perc_fl = tipo == 'P';
|
|
||||||
short pos = row_mask.id2pos(FR_UMQTASP);
|
|
||||||
|
|
||||||
if (pos >= 0)
|
|
||||||
row_mask.fld(pos).enable(!perc_fl);
|
|
||||||
pos = row_mask.id2pos(FR_PREZZO);
|
|
||||||
if (pos >= 0)
|
|
||||||
row_mask.fld(pos).enable(!perc_fl);
|
|
||||||
pos = row_mask.id2pos(FR_SCONTO);
|
|
||||||
if (pos >= 0)
|
|
||||||
row_mask.fld(pos).enable(!perc_fl);
|
|
||||||
pos = row_mask.id2pos(FR_QTA);
|
|
||||||
if (pos >= 0)
|
|
||||||
{
|
|
||||||
row_mask.fld(pos).show(!perc_fl);
|
|
||||||
row_mask.fld(pos).enable(qta_val_fl);
|
|
||||||
}
|
|
||||||
pos = row_mask.id2pos(FR_PERCSP);
|
|
||||||
if (pos >= 0)
|
|
||||||
{
|
|
||||||
row_mask.fld(pos).show(perc_fl);
|
|
||||||
row_mask.fld(pos).enable(perc_fl);
|
|
||||||
}
|
|
||||||
if (!perc_fl)
|
|
||||||
{
|
|
||||||
const real cambio = mask.get_real(F_CAMBIO);
|
|
||||||
real prezzo = sp.prezzo();
|
|
||||||
const TString& doc_valuta = mask.get(F_CODVAL);
|
|
||||||
const bool controeuro = mask.get_bool(F_CONTROEURO);
|
|
||||||
|
|
||||||
sppr_calc(sp, doc_valuta, cambio, prezzo, controeuro ? _exchange_contro : _exchange_base);
|
|
||||||
row_mask.set(FR_PREZZO, prezzo);
|
|
||||||
|
|
||||||
}
|
|
||||||
const int posiva = row_mask.id2pos(FR_CODIVA);
|
|
||||||
if (posiva >= 0)
|
|
||||||
iva_handler(row_mask.fld(posiva), 0);
|
|
||||||
|
|
||||||
if (row_mask.id2pos(FR_CDC1) >= 0)
|
|
||||||
{
|
|
||||||
const TString80 cdc(sp.cdc());
|
|
||||||
const TString80 cms(sp.cms());
|
|
||||||
const TString80 fase(sp.fase());
|
|
||||||
|
|
||||||
for (short i = FR_CDC1; i <= FR_CDC12; i++)
|
|
||||||
{
|
|
||||||
const pos = row_mask.id2pos(i);
|
|
||||||
|
|
||||||
if (pos >=0)
|
|
||||||
{
|
|
||||||
TEdit_field & e = (TEdit_field &) row_mask.fld(pos);
|
|
||||||
const TFieldref * fr = e.field();
|
|
||||||
|
|
||||||
if (fr->name() == "CODCOSTO")
|
|
||||||
e.set(cdc.sub(fr->from(), fr->to()));
|
|
||||||
else
|
|
||||||
if (fr->name() == "CODCMS")
|
|
||||||
e.set(cms.sub(fr->from(), fr->to()));
|
|
||||||
else
|
|
||||||
if (fr->name() == "FASCMS")
|
|
||||||
e.set(fase.sub(fr->from(), fr->to()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
pos = row_mask.id2pos(FR_PERCSP);
|
||||||
|
if (pos >= 0)
|
||||||
|
{
|
||||||
|
row_mask.fld(pos).show(perc_fl);
|
||||||
|
row_mask.fld(pos).enable(perc_fl);
|
||||||
|
}
|
||||||
|
if (!perc_fl)
|
||||||
|
{
|
||||||
|
const TMask& mask = row_mask.get_sheet()->mask();
|
||||||
|
const real cambio = mask.get_real(F_CAMBIO);
|
||||||
|
real prezzo = sp.prezzo();
|
||||||
|
const TString& doc_valuta = mask.get(F_CODVAL);
|
||||||
|
const bool controeuro = mask.get_bool(F_CONTROEURO);
|
||||||
|
|
||||||
|
sppr_calc(sp, doc_valuta, cambio, prezzo, controeuro ? _exchange_contro : _exchange_base);
|
||||||
|
row_mask.set(FR_PREZZO, prezzo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const int posiva = row_mask.id2pos(FR_CODIVA);
|
||||||
|
if (posiva >= 0)
|
||||||
|
iva_handler(row_mask.fld(posiva), 0);
|
||||||
|
|
||||||
|
if (row_mask.id2pos(FR_CDC1) >= 0)
|
||||||
|
{
|
||||||
|
const TString80 cdc(sp.cdc());
|
||||||
|
const TString80 cms(sp.cms());
|
||||||
|
const TString80 fase(sp.fase());
|
||||||
|
|
||||||
|
for (short i = FR_CDC1; i <= FR_CDC12; i++)
|
||||||
|
{
|
||||||
|
const pos = row_mask.id2pos(i);
|
||||||
|
if (pos >=0)
|
||||||
|
{
|
||||||
|
TEdit_field& e = (TEdit_field&)row_mask.fld(pos);
|
||||||
|
const TFieldref& fr = *e.field();
|
||||||
|
|
||||||
|
if (fr.name() == RDOC_CODCOSTO)
|
||||||
|
e.set(cdc.sub(fr.from(), fr.to()));
|
||||||
|
else
|
||||||
|
if (fr.name() == RDOC_CODCMS)
|
||||||
|
e.set(cms.sub(fr.from(), fr.to()));
|
||||||
|
else
|
||||||
|
if (fr.name() == RDOC_FASCMS)
|
||||||
|
e.set(fase.sub(fr.from(), fr.to()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user