1996-06-18 16:15:45 +00:00
|
|
|
// Stampa condizioni di pagamento
|
|
|
|
#include <printapp.h>
|
|
|
|
#include <mask.h>
|
|
|
|
#include <tabutil.h>
|
|
|
|
#include <utility.h>
|
|
|
|
|
|
|
|
#include <nditte.h>
|
|
|
|
#include "ba3a00a.h"
|
|
|
|
|
|
|
|
class Stampa_condizioni_pagamento_application : public TPrintapp
|
|
|
|
{
|
|
|
|
TRelation *_rel; // Relazione di lavoro...
|
|
|
|
int _cur; // Identificatori dei cursori di lavoro...
|
|
|
|
TMask *_msk;
|
|
|
|
TString _mese_com; // Contiene Si o No se e' mese commerciale
|
|
|
|
TString _inizio_cal; // Contiene "Data fattura", "Fine mese" o "Da impostare"
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual bool user_create() ;
|
|
|
|
virtual bool user_destroy();
|
|
|
|
virtual bool set_print(int);
|
|
|
|
|
|
|
|
virtual bool preprocess_page (int,int);
|
|
|
|
virtual print_action postprocess_page (int,int);
|
|
|
|
|
|
|
|
virtual void set_page(int,int);
|
|
|
|
void print_header();
|
|
|
|
void set_page_cpg();
|
|
|
|
|
|
|
|
Stampa_condizioni_pagamento_application() {};
|
|
|
|
};
|
|
|
|
|
|
|
|
bool Stampa_condizioni_pagamento_application::preprocess_page(int file, int counter)
|
|
|
|
{
|
|
|
|
TRectype &rc = current_cursor()->curr(LF_TABCOM);
|
|
|
|
const bool ms_cm = rc.get_bool("B0");
|
|
|
|
_inizio_cal = rc.get("S1");
|
|
|
|
|
|
|
|
if (ms_cm ) _mese_com = "Si";
|
|
|
|
else _mese_com = "No";
|
|
|
|
|
|
|
|
if (_inizio_cal == "F") _inizio_cal = "Data fattura";
|
|
|
|
else
|
|
|
|
if (_inizio_cal == "M") _inizio_cal = "Fine mese";
|
|
|
|
else
|
|
|
|
if (_inizio_cal == "I") _inizio_cal = "Da impostare";
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
print_action Stampa_condizioni_pagamento_application::postprocess_page(int file, int counter)
|
|
|
|
{
|
|
|
|
TPrintrow pr;
|
|
|
|
TTable rpg("%RPG");
|
|
|
|
TRectype &rc = current_cursor()->curr(LF_TABCOM);
|
|
|
|
TString codtab1(rc.get("CODTAB")), codtab2, ultcl,st;
|
|
|
|
int nrata, giorni=0, td;
|
|
|
|
real perc;
|
|
|
|
rpg.zero(); rpg.put("CODTAB",codtab1);
|
|
|
|
rpg.read(_isgteq);
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
codtab2 = rpg.get("CODTAB");
|
|
|
|
nrata = atoi(codtab2.right(3)) +1;
|
|
|
|
codtab2.cut(codtab2.len()-3);
|
|
|
|
if (codtab1 == codtab2)
|
|
|
|
{
|
|
|
|
giorni = giorni + rpg.get_int("I0");
|
|
|
|
td = rpg.get_int("I1");
|
|
|
|
ultcl = rpg.get("S1");
|
|
|
|
perc = rpg.get_real("R0");
|
|
|
|
st.format("%3d %4d %6s %2d %3s", nrata, giorni, perc.string(3,2), td, (const char*)ultcl);
|
|
|
|
pr.reset();
|
|
|
|
pr.put(st,100,st.len());
|
|
|
|
printer().print(pr);
|
|
|
|
rpg.next();
|
|
|
|
}
|
|
|
|
} while (codtab1 == codtab2 && rpg.good());
|
|
|
|
|
|
|
|
return NEXT_PAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Stampa_condizioni_pagamento_application::print_header()
|
|
|
|
// Setta le righe dell'intestazione
|
|
|
|
{
|
|
|
|
int soh = 1;
|
|
|
|
const long firm = get_firm();
|
|
|
|
|
|
|
|
reset_header ();
|
|
|
|
|
|
|
|
set_header (soh++, "");
|
2000-10-03 13:45:12 +00:00
|
|
|
set_header (soh++, "@bCONDIZIONI DI PAGAMENTO @r@107gData @> Pag. @#");
|
1996-06-18 16:15:45 +00:00
|
|
|
set_header (soh++, "");
|
2001-04-30 14:22:43 +00:00
|
|
|
set_header (soh++, "@47gTipo@53gInizio@66gMese@73gGiorni@89gIntervallo@108gScadenze@118gTipo@123gUlter.");
|
|
|
|
set_header (soh++, "Cod.@12gDescrizione@47gdoc.@53gcalcolo@66gcomm.@73gsc. fissa@92grate@103gNr. gg. %% @118grata@123gclass.");
|
1996-06-18 16:15:45 +00:00
|
|
|
set_header(soh,"");
|
1996-07-30 11:03:50 +00:00
|
|
|
set_background(format("W2l{1,3,132,3}l{1,%d,132,%d}", soh, soh));
|
1996-06-18 16:15:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Stampa_condizioni_pagamento_application::set_page_cpg()
|
|
|
|
{
|
|
|
|
set_row(1,"");
|
|
|
|
set_row(2,"@b@5s@12g@35s@r",FLD("%CPG","CODTAB"),FLD("%CPG","S0"));
|
|
|
|
set_row(2,"@48g@2s@53g#8t",FLD("%CPG","S4"),&_inizio_cal);
|
|
|
|
set_row(2,"@66g#2t",&_mese_com);
|
|
|
|
set_row(2,"@73g@2s @77g@2s @81g@2s",FLD("%CPG","I0"),FLD("%CPG","I1"),FLD("%CPG","I2"));
|
|
|
|
set_row(2,"@93g@2s",FLD("%CPG","I3"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Stampa_condizioni_pagamento_application::set_page(int file, int counter)
|
|
|
|
{
|
|
|
|
print_header();
|
|
|
|
set_page_cpg();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Stampa_condizioni_pagamento_application::set_print(int)
|
|
|
|
{
|
|
|
|
bool rt = FALSE;
|
|
|
|
const KEY tasto = _msk->run();
|
|
|
|
if (tasto == K_ENTER)
|
|
|
|
{
|
|
|
|
TRectype from(_rel->lfile().curr()); from.zero();
|
|
|
|
from.put("COD","CPG");
|
|
|
|
TRectype to (from);
|
|
|
|
TString da,a;
|
|
|
|
|
|
|
|
reset_files();
|
|
|
|
reset_print();
|
|
|
|
add_file(LF_TABCOM);
|
|
|
|
da = _msk->get(F_INIZIO);
|
|
|
|
a = _msk->get(F_FINE);
|
|
|
|
|
|
|
|
if (da.not_empty()) from.put("CODTAB",da);
|
|
|
|
if (a.not_empty()) to.put("CODTAB",a);
|
2000-05-05 15:25:49 +00:00
|
|
|
get_cursor(_cur)->setregion (from, to, 0x2);
|
1996-06-18 16:15:45 +00:00
|
|
|
rt = TRUE;
|
|
|
|
}
|
|
|
|
return rt;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Stampa_condizioni_pagamento_application::user_create()
|
|
|
|
{
|
|
|
|
_msk = new TMask("ba3a00a");
|
|
|
|
_rel = new TRelation("%CPG");
|
|
|
|
_cur = add_cursor(new TCursor(_rel));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Stampa_condizioni_pagamento_application::user_destroy()
|
|
|
|
{
|
|
|
|
delete _rel;
|
|
|
|
delete _msk;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ba3a00 (int argc, char* argv[])
|
|
|
|
{
|
|
|
|
|
|
|
|
Stampa_condizioni_pagamento_application a;
|
|
|
|
|
|
|
|
a.run(argc, argv, "Stampa condizioni di pagamento");
|
|
|
|
return 0;
|
|
|
|
}
|