Correzione errore MI1102: stampa condizioni di pagamento.
git-svn-id: svn://10.65.10.50/trunk@3016 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e808aad33e
commit
0b8116a024
@ -3,7 +3,7 @@
|
||||
|
||||
#include "ba3.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1|2|3|4|5}"
|
||||
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7|8|9}"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
@ -30,6 +30,8 @@ int main(int argc, char** argv)
|
||||
rt = ba3800(argc,argv) ; break;
|
||||
case 8:
|
||||
rt = ba3900(argc,argv) ; break;
|
||||
case 9:
|
||||
rt = ba3a00(argc,argv) ; break;
|
||||
default:
|
||||
error_box(usage, argv[0]) ; break;
|
||||
}
|
||||
|
1
ba/ba3.h
1
ba/ba3.h
@ -10,5 +10,6 @@ int ba3600(int argc, char* argv[]);
|
||||
int ba3700(int argc, char* argv[]);
|
||||
int ba3800(int argc, char* argv[]);
|
||||
int ba3900(int argc, char* argv[]);
|
||||
int ba3a00(int argc, char* argv[]);
|
||||
|
||||
#endif // __BA3_H
|
||||
|
@ -62,3 +62,12 @@ MENUBAR MENU_BAR(8)
|
||||
MENU MENU_BAR(8)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/*
|
||||
* ba3 -9
|
||||
*/
|
||||
|
||||
MENUBAR MENU_BAR(9)
|
||||
|
||||
MENU MENU_BAR(9)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
|
179
ba/ba3a00.cpp
Executable file
179
ba/ba3a00.cpp
Executable file
@ -0,0 +1,179 @@
|
||||
// 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 ();
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
ditte.zero();
|
||||
ditte.put(NDT_CODDITTA, firm);
|
||||
ditte.read();
|
||||
if (ditte.bad()) ditte.zero();
|
||||
|
||||
TString s;
|
||||
TString256 rw;
|
||||
TString NomeTabella("CONDIZIONI DI PAGAMENTO");
|
||||
s = ditte.get(NDT_RAGSOC);
|
||||
|
||||
rw.spaces(131);
|
||||
rw.overwrite(format("Ditta %4ld %s", firm,(const char *)s));
|
||||
rw.overwrite ("Data @< Pag. @#", rw.len()-22);
|
||||
set_header (soh++, "%s", (const char *)rw);
|
||||
NomeTabella.left_just (132);
|
||||
set_header (soh++, "");
|
||||
set_header (soh++, "@b%s", (const char *)NomeTabella);
|
||||
set_header (soh++, "");
|
||||
set_header (soh++, "@47gTp @53gInizio @66gMese @73gGiorni@89gIntervallo@108gScadenze");
|
||||
set_header (soh++, "Cod. @12gDescrizione @47gdoc.@53gcalcolo@66gcomm. @73gsc. fissa@92grate@103gNr. gg. %% Td. ult. cl.");
|
||||
set_header(soh,"");
|
||||
set_background(format("W2l{1,4,132,4}l{1,%d,132,%d}", soh, soh));
|
||||
}
|
||||
|
||||
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);
|
||||
get_cursor(_cur)->setregion (from, to);
|
||||
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;
|
||||
}
|
6
ba/ba3a00a.h
Executable file
6
ba/ba3a00a.h
Executable file
@ -0,0 +1,6 @@
|
||||
|
||||
#define F_INIZIO 101
|
||||
#define F_FINE 102
|
||||
|
||||
|
||||
|
43
ba/ba3a00a.uml
Executable file
43
ba/ba3a00a.uml
Executable file
@ -0,0 +1,43 @@
|
||||
|
||||
#include "ba3a00a.h"
|
||||
|
||||
PAGE "Stampa condizioni di pagamento" -1 -1 35 6
|
||||
STRING F_INIZIO 4
|
||||
BEGIN
|
||||
PROMPT 2 1 "Da codice "
|
||||
FLAGS "UZ"
|
||||
HELP "Inserire il codice da cui iniziare la stampa. Se in bianco vuol dire dall'inizio"
|
||||
FIELD CODTAB
|
||||
USE %CPG
|
||||
INPUT CODTAB F_INIZIO
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_INIZIO CODTAB
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING F_FINE 4
|
||||
BEGIN
|
||||
PROMPT 2 3 "A codice "
|
||||
FLAGS "UZ"
|
||||
HELP "Inserire il codice di fine. Se in bianco vuol dire l'ultimo"
|
||||
FIELD CODTAB
|
||||
COPY USE F_INIZIO
|
||||
INPUT CODTAB F_FINE
|
||||
COPY DISPLAY F_INIZIO
|
||||
OUTPUT F_FINE CODTAB
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user