Patch level :10.0
Files correlati : Ricompilazione Demo : [ ] Commento :sistemati casini da riporto 3.2 git-svn-id: svn://10.65.10.50/trunk@17125 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
af76bbf855
commit
548faaf785
186
db/db0500.cpp
186
db/db0500.cpp
@ -1,7 +1,6 @@
|
||||
#include "dblib.h"
|
||||
|
||||
#include <automask.h>
|
||||
#include <date.h>
|
||||
#include <defmask.h>
|
||||
#include <execp.h>
|
||||
#include <modaut.h>
|
||||
@ -17,6 +16,160 @@
|
||||
|
||||
#include "db0500a.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// 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
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -386,7 +539,7 @@ bool TQuery_mask::copy_distinct(const TCodice_articolo& oldcode,
|
||||
for (int r = rdist.last_row(); r > 0; r = rdist.pred_row(r))
|
||||
{
|
||||
TRectype& row = rdist.row(r, false); // Rewriteable row
|
||||
const char row_type = row.get_char("TIPO");
|
||||
char row_type = row.get_char("TIPO");
|
||||
// Tento rigenerazione del codice solo su articoli e distinte
|
||||
if (row_type == 'A' || row_type == 'D')
|
||||
{
|
||||
@ -395,10 +548,13 @@ bool TQuery_mask::copy_distinct(const TCodice_articolo& oldcode,
|
||||
if (generate_subcode(oldcode, newcode, oldsub, newsub))
|
||||
{
|
||||
row.put("CODCOMP", newsub);
|
||||
if (row_type == 'A')
|
||||
copy_article(oldsub, newsub);
|
||||
// Controllo se la riga e' in realta' una distinta
|
||||
if (row_type == 'A' && !cache().get(LF_DIST, oldsub).empty())
|
||||
row_type = 'D';
|
||||
if (row_type == 'D')
|
||||
copy_distinct(oldsub, newsub, recursive);
|
||||
else
|
||||
copy_distinct(oldsub, newsub, recursive);
|
||||
copy_article(oldsub, newsub);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1215,17 +1371,17 @@ bool TDistinta_mask::on_field_event(TOperable_field& o, TField_event e, long jol
|
||||
}
|
||||
}
|
||||
break;
|
||||
case F_SORTA:
|
||||
if (e == fe_button)
|
||||
{
|
||||
TSheet_field& sheet = o.mask().sfield(F_SHEET);
|
||||
case F_SORTA:
|
||||
if (e == fe_button)
|
||||
{
|
||||
TSheet_field& sheet = o.mask().sfield(F_SHEET);
|
||||
|
||||
sheet.sort();
|
||||
sheet.force_update();
|
||||
}
|
||||
break;
|
||||
case DLG_MOV:
|
||||
if (e == fe_button)
|
||||
sheet.sort();
|
||||
sheet.force_update();
|
||||
}
|
||||
break;
|
||||
case DLG_MOV:
|
||||
if (e == fe_button)
|
||||
{
|
||||
if (app().has_module(MGAUT))
|
||||
{
|
||||
|
@ -331,8 +331,8 @@ public:
|
||||
// Setta le colonne dei campi livello codice di uno sheet in base alle abilitazioni
|
||||
void set_sheet_columns(TSheet_field &sht, short dlg) const;
|
||||
// costruisce il codice compatto e viceversa
|
||||
void pack_maskgrpcodes(TString & pc, const TMask & m, int field, int level);
|
||||
void pack_grpcode(TString & pc, const TString &codlev, const int levnum); // Inserisce il codice del gruppo del livello levnum in pc
|
||||
void pack_maskgrpcodes(TString & pc, const TMask & m, int field, int level) const;
|
||||
void pack_grpcode(TString & pc, const TString &codlev, const int levnum) const; // Inserisce il codice del gruppo del livello levnum in pc
|
||||
TString unpack_grpcode(const TString & pc, const int levnum) const ; // Estrae il codice del gruppo del livello levnum da pc
|
||||
// costruisce il codice della tabella di decodifica dei livelli
|
||||
TString build_tabcode(const TString & code, const int levnum) const ;
|
||||
|
@ -783,13 +783,13 @@ const TString & TCodice_livelli::picture(int levnum) const
|
||||
return(_picture[levnum-1]);
|
||||
}
|
||||
|
||||
void TCodice_livelli::pack_maskgrpcodes(TString & pc, const TMask & mask, int field1, int levnum)
|
||||
void TCodice_livelli::pack_maskgrpcodes(TString & pc, const TMask & mask, int field1, int levnum) const
|
||||
{
|
||||
for (int l=0 ; l<levnum; l++)
|
||||
pack_grpcode(pc,mask.get(field1+l),1+l);
|
||||
}
|
||||
|
||||
void TCodice_livelli::pack_grpcode(TString & pc, const TString &codlev, const int levnum)
|
||||
void TCodice_livelli::pack_grpcode(TString & pc, const TString &codlev, const int levnum) const
|
||||
{
|
||||
CHECK(levnum<=max_levels() && levnum>0,"I codici livello partono da 1") ;
|
||||
pc.overwrite(codlev.left(_code_length[levnum-1]),packed_length(levnum-1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user