Patch level : 10.0 316
Files correlati : pe0.exe Ricompilazione Demo : [ ] Commento : Preventivazione (CRPA) git-svn-id: svn://10.65.10.50/trunk@18890 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
273fe07c1d
commit
ffc76e3eab
118
pe/pe0400.cpp
118
pe/pe0400.cpp
@ -806,6 +806,8 @@ int TGestione_preventivo_app::write( const TMask& m )
|
|||||||
const TString k = doc.get(DOC_K);
|
const TString k = doc.get(DOC_K);
|
||||||
int max_level = 0;
|
int max_level = 0;
|
||||||
const int rows = doc.physical_rows();
|
const int rows = doc.physical_rows();
|
||||||
|
TArray valori;
|
||||||
|
TArray costi;
|
||||||
|
|
||||||
for (int r = 1; r <= rows; r++)
|
for (int r = 1; r <= rows; r++)
|
||||||
{
|
{
|
||||||
@ -814,9 +816,60 @@ int TGestione_preventivo_app::write( const TMask& m )
|
|||||||
if (max_level < level)
|
if (max_level < level)
|
||||||
max_level = level;
|
max_level = level;
|
||||||
}
|
}
|
||||||
for (int i = 1 ; i <= rows; i++)
|
for (int i = rows ; i > 0; i--)
|
||||||
if (doc[i].get_int(RDOC_LEVEL) == max_level && doc[i].get(RDOC_K).blank())
|
{
|
||||||
doc[i].put(RDOC_K, k);
|
TRiga_documento & row = (TRiga_documento &)doc[i];
|
||||||
|
const int level = row.get_int(RDOC_LEVEL);
|
||||||
|
|
||||||
|
if (level == max_level && row.get(RDOC_K).blank())
|
||||||
|
row.put(RDOC_K, k);
|
||||||
|
if (i == rows || level >= doc[i + 1].get_int(RDOC_LEVEL))
|
||||||
|
{
|
||||||
|
const real importo = row.importo(true, false);
|
||||||
|
|
||||||
|
for (int i = level - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
real * r = (real *) valori.objptr(i);
|
||||||
|
|
||||||
|
if (r == NULL)
|
||||||
|
{
|
||||||
|
r = new real;
|
||||||
|
valori.add(r, i);
|
||||||
|
}
|
||||||
|
*r += importo;
|
||||||
|
}
|
||||||
|
|
||||||
|
const real costo = row.get_real(RDOC_QTA) * row.get_real(RDOC_COSTO);
|
||||||
|
|
||||||
|
for (int i = level - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
real * r = (real *) costi.objptr(i);
|
||||||
|
|
||||||
|
if (r == NULL)
|
||||||
|
{
|
||||||
|
r = new real;
|
||||||
|
costi.add(r, i);
|
||||||
|
}
|
||||||
|
*r += costo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
real * r = (real *) valori.objptr(level);
|
||||||
|
|
||||||
|
if (r != NULL)
|
||||||
|
{
|
||||||
|
row.put(RDOC_VALV, *r);
|
||||||
|
*r = ZERO;
|
||||||
|
}
|
||||||
|
r = (real *) costi.objptr(level);
|
||||||
|
if (r != NULL)
|
||||||
|
{
|
||||||
|
row.put(RDOC_VALC, *r);
|
||||||
|
*r = ZERO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return TMotore_application::write(m);
|
return TMotore_application::write(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -827,6 +880,8 @@ int TGestione_preventivo_app::rewrite( const TMask& m )
|
|||||||
const TString k = doc.get(DOC_K);
|
const TString k = doc.get(DOC_K);
|
||||||
int max_level = 0;
|
int max_level = 0;
|
||||||
const int rows = doc.physical_rows();
|
const int rows = doc.physical_rows();
|
||||||
|
TArray valori;
|
||||||
|
TArray costi;
|
||||||
|
|
||||||
for (int r = 1; r <= rows; r++)
|
for (int r = 1; r <= rows; r++)
|
||||||
{
|
{
|
||||||
@ -835,9 +890,60 @@ int TGestione_preventivo_app::rewrite( const TMask& m )
|
|||||||
if (max_level < level)
|
if (max_level < level)
|
||||||
max_level = level;
|
max_level = level;
|
||||||
}
|
}
|
||||||
for (int i = 1 ; i <= rows; i++)
|
for (int i = rows ; i > 0; i--)
|
||||||
if (doc[i].get_int(RDOC_LEVEL) == max_level && doc[i].get(RDOC_K).blank())
|
{
|
||||||
doc[i].put(RDOC_K, k);
|
TRiga_documento & row = (TRiga_documento &)doc[i];
|
||||||
|
const int level = row.get_int(RDOC_LEVEL);
|
||||||
|
|
||||||
|
if (level == max_level && row.get(RDOC_K).blank())
|
||||||
|
row.put(RDOC_K, k);
|
||||||
|
if (i == rows || level >= doc[i + 1].get_int(RDOC_LEVEL))
|
||||||
|
{
|
||||||
|
const real importo = row.importo(true, false);
|
||||||
|
|
||||||
|
for (int i = level - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
real * r = (real *) valori.objptr(i);
|
||||||
|
|
||||||
|
if (r == NULL)
|
||||||
|
{
|
||||||
|
r = new real;
|
||||||
|
valori.add(r, i);
|
||||||
|
}
|
||||||
|
*r += importo;
|
||||||
|
}
|
||||||
|
|
||||||
|
const real costo = row.get_real(RDOC_QTA) * row.get_real(RDOC_COSTO);
|
||||||
|
|
||||||
|
for (int i = level - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
real * r = (real *) costi.objptr(i);
|
||||||
|
|
||||||
|
if (r == NULL)
|
||||||
|
{
|
||||||
|
r = new real;
|
||||||
|
costi.add(r, i);
|
||||||
|
}
|
||||||
|
*r += costo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
real * r = (real *) valori.objptr(level);
|
||||||
|
|
||||||
|
if (r != NULL)
|
||||||
|
{
|
||||||
|
row.put(RDOC_VALV, *r);
|
||||||
|
*r = ZERO;
|
||||||
|
}
|
||||||
|
r = (real *) costi.objptr(level);
|
||||||
|
if (r != NULL)
|
||||||
|
{
|
||||||
|
row.put(RDOC_VALC, *r);
|
||||||
|
*r = ZERO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return TMotore_application::rewrite(m);
|
return TMotore_application::rewrite(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user