1997-10-21 12:55:51 +00:00
|
|
|
#include <mask.h>
|
|
|
|
#include <applicat.h>
|
|
|
|
#include <form.h>
|
1998-01-20 16:01:01 +00:00
|
|
|
#include <printer.h>
|
1997-10-27 11:06:32 +00:00
|
|
|
#include <progind.h>
|
|
|
|
|
1997-10-21 12:55:51 +00:00
|
|
|
#include "provv.h"
|
|
|
|
#include "pr1300a.h"
|
1997-10-27 11:06:32 +00:00
|
|
|
|
|
|
|
|
1997-10-21 12:55:51 +00:00
|
|
|
class TStampa_schedeprovv : public TSkeleton_application
|
|
|
|
{
|
1997-10-27 11:06:32 +00:00
|
|
|
|
|
|
|
TMask * _m;
|
|
|
|
void riporta_pagamenti(TCursor &cur);
|
|
|
|
|
1997-10-21 12:55:51 +00:00
|
|
|
protected:
|
|
|
|
virtual bool create();
|
|
|
|
virtual bool destroy();
|
|
|
|
virtual void main_loop();
|
|
|
|
};
|
|
|
|
|
|
|
|
bool TStampa_schedeprovv::create()
|
|
|
|
{
|
1997-10-27 11:06:32 +00:00
|
|
|
_m= new TMask ("pr1300a");
|
1997-10-21 12:55:51 +00:00
|
|
|
return TSkeleton_application::create();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TStampa_schedeprovv::destroy()
|
|
|
|
{
|
1997-10-27 11:06:32 +00:00
|
|
|
delete _m;
|
1997-10-21 12:55:51 +00:00
|
|
|
return TSkeleton_application::destroy();
|
|
|
|
}
|
|
|
|
|
1997-10-27 11:06:32 +00:00
|
|
|
void TStampa_schedeprovv::riporta_pagamenti(TCursor &cur)
|
|
|
|
{
|
|
|
|
if (cur.items()==0) return;
|
|
|
|
const TRelation * r=cur.relation();
|
|
|
|
TProgind barra(cur.items(),"Registro le provvigioni pagate");
|
|
|
|
for (int c=0; c<cur.items(); c++)
|
|
|
|
{
|
|
|
|
cur=c;
|
|
|
|
barra.setstatus(c);
|
|
|
|
// stampa definitiva: riporta le provvigioni maturate sulle provv. pagate
|
|
|
|
real val;
|
|
|
|
val=r->lfile().get_real(PROV_PROVVMAT);
|
|
|
|
if (!val.is_zero() &&
|
|
|
|
!r->lfile().get_bool(PROV_SALDATA)) // this should never happen!
|
|
|
|
{
|
|
|
|
r->lfile().reread(_lock);
|
|
|
|
val+=r->lfile().get_real(PROV_PROVVPAG);
|
|
|
|
r->lfile().put(PROV_PROVVPAG,val);
|
|
|
|
r->lfile().put(PROV_PROVVMAT,0);
|
|
|
|
if (val>=r->lfile().get_real(PROV_IMPPROVV))
|
|
|
|
r->lfile().put(PROV_SALDATA,"X");
|
|
|
|
r->lfile().rewrite();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-10-21 12:55:51 +00:00
|
|
|
void TStampa_schedeprovv::main_loop()
|
|
|
|
{
|
|
|
|
TForm frm("pr1300a");
|
1997-10-27 11:06:32 +00:00
|
|
|
|
1998-01-20 16:01:01 +00:00
|
|
|
const int hh = 7;
|
|
|
|
const int fh = 1;
|
|
|
|
const int fl = printer().formlen();
|
|
|
|
|
1997-10-21 12:55:51 +00:00
|
|
|
int rows[4]; // Righe orizzontali
|
1998-01-20 16:01:01 +00:00
|
|
|
rows[0] = hh-3;
|
|
|
|
rows[1] = hh;
|
|
|
|
rows[2] = fl-1;
|
1997-10-21 12:55:51 +00:00
|
|
|
rows[3] = 0;
|
1998-01-20 16:01:01 +00:00
|
|
|
frm.genera_intestazioni(odd_page, hh-2);
|
|
|
|
frm.genera_fincatura(odd_page, hh-3, fl-1, rows);
|
|
|
|
|
1997-10-21 12:55:51 +00:00
|
|
|
|
1997-10-27 11:06:32 +00:00
|
|
|
while (_m->run()!=K_QUIT)
|
1997-10-21 12:55:51 +00:00
|
|
|
{
|
|
|
|
|
1997-10-22 08:07:00 +00:00
|
|
|
// filtro e regione
|
1997-10-27 11:06:32 +00:00
|
|
|
if (_m->get(F_FILTRO).not_empty())
|
|
|
|
{
|
|
|
|
TString filter(PROV_SALDATA);
|
|
|
|
if (_m->get(F_FILTRO)[0]=='P')
|
|
|
|
filter << "==\"X\"" ;
|
|
|
|
else
|
|
|
|
filter << "!=\"X\"" ;
|
|
|
|
frm.cursor()->setfilter(filter);
|
|
|
|
} else
|
|
|
|
frm.cursor()->setfilter("");
|
1997-10-22 08:07:00 +00:00
|
|
|
|
1997-10-21 12:55:51 +00:00
|
|
|
TRectype start(LF_PROVV),end(LF_PROVV);
|
1997-10-27 11:06:32 +00:00
|
|
|
if (_m->get(F_DAAGE).not_empty())
|
|
|
|
start.put(PROV_CODAGE,_m->get(F_DAAGE));
|
|
|
|
if (_m->get(F_AAGE).not_empty())
|
|
|
|
end.put(PROV_CODAGE,_m->get(F_AAGE));
|
1997-10-21 12:55:51 +00:00
|
|
|
frm.cursor()->setregion(start,end);
|
|
|
|
// abilita le sezioni dei totali
|
1997-10-27 11:06:32 +00:00
|
|
|
frm.find_field('B',odd_page,"CLIENTI").show(!_m->get_bool(F_RAGGCLI));
|
|
|
|
frm.find_field('B',odd_page,"HCLIENTI").show(!_m->get_bool(F_RAGGDOC));
|
|
|
|
frm.find_field('B',odd_page,"DOCUMENTI").show(!_m->get_bool(F_RAGGDOC));
|
|
|
|
frm.find_field('B',odd_page,"HDOCUMENTI").show(!_m->get_bool(F_RAGGRATE));
|
|
|
|
frm.find_field('B',odd_page,"RATEDOC").show(!_m->get_bool(F_RAGGRATE));
|
1997-10-21 12:55:51 +00:00
|
|
|
frm.print();
|
1997-10-27 11:06:32 +00:00
|
|
|
if (_m->get(F_DEFINITIVA)[0]=='D')
|
|
|
|
{
|
|
|
|
riporta_pagamenti(*frm.cursor());
|
|
|
|
}
|
1997-10-21 12:55:51 +00:00
|
|
|
}
|
|
|
|
}
|
1997-09-25 08:12:57 +00:00
|
|
|
|
|
|
|
int pr1300(int argc, char** argv)
|
|
|
|
{
|
1997-10-21 12:55:51 +00:00
|
|
|
TStampa_schedeprovv a;
|
|
|
|
a.run(argc,argv,"Stampa schede di provvigione");
|
1997-09-25 08:12:57 +00:00
|
|
|
return 0;
|
|
|
|
}
|