Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@17636 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
157b2c8f3b
commit
e1946f1bf2
165
db/db0500.cpp
165
db/db0500.cpp
@ -16,6 +16,9 @@
|
||||
|
||||
#include "db0500a.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TMov_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
class TMov_mask : public TAutomask
|
||||
{
|
||||
TArticolo _art;
|
||||
@ -202,159 +205,6 @@ bool TMov_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TMov_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
class TMov_mask : public TAutomask
|
||||
{
|
||||
TArticolo _art;
|
||||
TSheet_field * _sh;
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TMov_mask(const char * codice, TSheet_field * s) : TAutomask("db0500d"), _art(codice), _sh(s) {}
|
||||
virtual ~TMov_mask() { }
|
||||
};
|
||||
|
||||
bool TMov_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_TIPOVAL:
|
||||
if (e == fe_init || e == fe_modify)
|
||||
{
|
||||
const int tipo = o.mask().get_int(F_TIPOVAL);
|
||||
real val;
|
||||
real cos;
|
||||
real lav;
|
||||
|
||||
switch (tipo)
|
||||
{
|
||||
case 1 : // Costo
|
||||
case 2 : // Complessivo
|
||||
{
|
||||
const int rows = _sh->items();
|
||||
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
TToken_string row = _sh->row(i);
|
||||
const TString4 tipo = row.get(_sh->cid2index(F_TIPOCOMP));
|
||||
if (tipo == "A")
|
||||
{
|
||||
TArticolo comp(row.get(_sh->cid2index(F_CODART)));
|
||||
real qta(row.get(_sh->cid2index(F_EXPR)));
|
||||
real calo = comp.get_real(ANAMAG_USER1);
|
||||
|
||||
if (calo == ZERO) calo = UNO;
|
||||
|
||||
const real prezzo = comp.get_real(ANAMAG_ULTCOS1) * calo;
|
||||
cos += prezzo * qta;
|
||||
}
|
||||
else
|
||||
if (tipo == "L")
|
||||
{
|
||||
TLavorazione lab(row.get(_sh->cid2index(F_CODLAV)));
|
||||
real qta(row.get(_sh->cid2index(F_EXPR)));
|
||||
|
||||
lav += (lab.prezzo() * qta);
|
||||
}
|
||||
}
|
||||
|
||||
lav *= (CENTO - o.mask().get_real(F_SCONTO))/CENTO;
|
||||
cos += lav;
|
||||
val = cos;
|
||||
|
||||
if (tipo == 2)
|
||||
val *= (UNO + _art.get_real(ANAMAG_PERCRIC)/CENTO);
|
||||
}
|
||||
break;
|
||||
case 3 : // Peso + Mandopera a peso
|
||||
{
|
||||
real peso;
|
||||
real val_mat;
|
||||
real val_lav;
|
||||
const int rows = _sh->items();
|
||||
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
TToken_string row = _sh->row(i);
|
||||
const TString4 tipo = row.get(_sh->cid2index(F_TIPOCOMP));
|
||||
if (tipo == "A")
|
||||
{
|
||||
TArticolo comp(row.get(_sh->cid2index(F_CODART)));
|
||||
const TString8 um(row.get(_sh->cid2index(F_UMEXPR)));
|
||||
real qta(row.get(_sh->cid2index(F_EXPR)));
|
||||
real calo = comp.get_real(ANAMAG_USER1);
|
||||
|
||||
if (calo == ZERO) calo = UNO;
|
||||
|
||||
const real prezzo = comp.get_real(ANAMAG_ULTCOS1) * calo;
|
||||
val_mat += prezzo * qta;
|
||||
if (um.starts_with("GR"))
|
||||
peso += qta;
|
||||
}
|
||||
else
|
||||
if (tipo == "L")
|
||||
{
|
||||
TLavorazione lav(row.get(_sh->cid2index(F_CODLAV)));
|
||||
|
||||
val_lav += lav.prezzo();
|
||||
}
|
||||
}
|
||||
val = val_mat + val_lav * peso * (CENTO - o.mask().get_real(F_SCONTO))/CENTO;
|
||||
cos = val ;
|
||||
val = cos * (CENTO + _art.get_real(ANAMAG_PERCRIC))/CENTO;
|
||||
}
|
||||
break;
|
||||
case 4 : // Peso + Mandopera a prezzo
|
||||
{
|
||||
real val_mat;
|
||||
real val_lav;
|
||||
const int rows = _sh->items();
|
||||
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
TToken_string row = _sh->row(i);
|
||||
const TString4 tipo = row.get(_sh->cid2index(F_TIPOCOMP));
|
||||
if (tipo == "A")
|
||||
{
|
||||
TArticolo comp(row.get(_sh->cid2index(F_CODART)));
|
||||
real qta(row.get(_sh->cid2index(F_EXPR)));
|
||||
|
||||
real calo = comp.get_real(ANAMAG_USER1);
|
||||
|
||||
if (calo == ZERO) calo = UNO;
|
||||
|
||||
const real prezzo = comp.get_real(ANAMAG_ULTCOS1) * calo;
|
||||
val_mat += prezzo * qta;
|
||||
}
|
||||
else
|
||||
if (tipo == "L")
|
||||
{
|
||||
TLavorazione lav(row.get(_sh->cid2index(F_CODLAV)));
|
||||
real qta(row.get(_sh->cid2index(F_EXPR)));
|
||||
|
||||
val_lav += lav.prezzo() * qta;
|
||||
}
|
||||
}
|
||||
val = val_mat + val_lav * (CENTO - o.mask().get_real(F_SCONTO))/CENTO;
|
||||
cos = val ;
|
||||
val = cos * (CENTO + _art.get_real(ANAMAG_PERCRIC))/CENTO;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
o.mask().set(F_PREZZOM, cos.string());
|
||||
o.mask().set(F_PREZZOV, val.string());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TDistinta_app
|
||||
@ -1644,13 +1494,12 @@ bool TDistinta_mask::on_field_event(TOperable_field& o, TField_event e, long jol
|
||||
|
||||
FOR_EACH_ASSOC_OBJECT(arts, obj, key, item)
|
||||
{
|
||||
const real costo = * (real *)item;
|
||||
|
||||
if (articolo.lock_and_prompt(key))
|
||||
{
|
||||
if (articolo.read(key, _isequal, _testandlock))
|
||||
{
|
||||
const real costo = * (real *)item;
|
||||
articolo.put(ANAMAG_ULTCOS1, costo);
|
||||
articolo.rewrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user