From b8c361eacafeab455c49e8fda5353a52f39cc69f Mon Sep 17 00:00:00 2001 From: nik Date: Fri, 14 Apr 1995 16:14:11 +0000 Subject: [PATCH] Correzioni a mastrini registri liquidazione e progressivi IVA git-svn-id: svn://10.65.10.50/trunk@1252 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg0400a.uml | 16 +++--- cg/cg0400b.uml | 6 +-- cg/cg3200.cpp | 113 ++++++++++++++++++++++++++------------- cg/cg4300.cpp | 2 +- cg/cg4400.cpp | 140 +++++++++++++++++++++++++++++++++++++------------ 5 files changed, 195 insertions(+), 82 deletions(-) diff --git a/cg/cg0400a.uml b/cg/cg0400a.uml index b68305464..f786ebc8d 100755 --- a/cg/cg0400a.uml +++ b/cg/cg0400a.uml @@ -28,7 +28,7 @@ END NUMBER F_ANNO 4 BEGIN - PROMPT 3 3 "Anno liquidazione " + PROMPT 3 3 "Anno liquidazione " HELP "Anno di cui si effettua la liquidazione" FLAGS "A" CHECKTYPE REQUIRED @@ -36,7 +36,7 @@ END RADIOBUTTON F_TIPO 18 BEGIN - PROMPT 3 5 "Tipo progressivi " + PROMPT 3 5 "Tipo progressivi " HELP "Tipo di riepilogo da effettuare" ITEM "1|Vendite" MESSAGE HIDE,F_TIPOTABE|HIDE,F_TIPOTABEL|SHOW,F_TIPOTAB @@ -49,7 +49,7 @@ END RADIOBUTTON F_TIPO1 18 BEGIN - PROMPT 3 5 "Tipo progressivi " + PROMPT 3 5 "Tipo progressivi " HELP "Tipo di riepilogo da effettuare" ITEM "1|Vendite" MESSAGE HIDE,F_TIPOTABE|HIDE,F_TIPOTABEL|HIDE,F_TIPOTAB @@ -74,7 +74,7 @@ END STRING F_CODIVA 4 BEGIN - PROMPT 3 10 "Codice IVA " + PROMPT 3 10 "Codice IVA " HELP "Aliquota IVA da riepilogare" FLAGS "U" USE %IVA @@ -91,7 +91,7 @@ END RADIOBUTTON F_TIPOTAB 38 BEGIN - PROMPT 3 12 "Tipo tabella " + PROMPT 3 12 "Tipo tabella " HELP "Tipo di tabella da visualizzare" ITEM "1|Vendite in genere" ITEM "2|Vendite in sospensione d'imposta" @@ -99,7 +99,7 @@ END STRING F_ATTIVITA 5 BEGIN - PROMPT 3 10 "Codice attivita' " + PROMPT 3 10 "Codice attivita' " HELP "Codice dell'attivita' di cui si vuole il riepilogo" USE LF_ATTIV JOIN %AIS TO LF_ATTIV INTO CODTAB=CODATT @@ -114,7 +114,7 @@ END NUMBER F_TIPOTABEL 1 BEGIN - PROMPT 3 12 "Tipo tabella " + PROMPT 3 12 "Tipo tabella " HELP "Tipo di tabella da visualizzare" SHEET "Tipo|Descrizione@50" ITEM "1|Acquisti beni per rivendita" @@ -128,7 +128,7 @@ END NUMBER F_TIPOTABE 1 BEGIN - PROMPT 3 12 "Tipo tabella " + PROMPT 3 12 "Tipo tabella " HELP "Tipo di tabella da visualizzare" SHEET "Tipo|Descrizione@50" ITEM "1|Acquisti in genere" diff --git a/cg/cg0400b.uml b/cg/cg0400b.uml index 07c1755ba..d369d0fbf 100755 --- a/cg/cg0400b.uml +++ b/cg/cg0400b.uml @@ -27,9 +27,9 @@ END DATE F_DATASTAMPA BEGIN - PROMPT 3 4 "Data stampa " - HELP "Data in cui viene effettuata la stampa" - FLAGS "A" + PROMPT 3 4 "Data stampa " + HELP "Data in cui viene effettuata la stampa" + FLAGS "A" END NUMBER F_ANNO 4 diff --git a/cg/cg3200.cpp b/cg/cg3200.cpp index 827558815..bfe8e5687 100755 --- a/cg/cg3200.cpp +++ b/cg/cg3200.cpp @@ -34,18 +34,19 @@ class TMastrini_application : public TPrintapp friend bool sottoc_handler_ini (TMask_field& f, KEY k); friend bool sottoc_handler_fine (TMask_field& f, KEY k); - TDociva_array _b; - TRelation* _rel; - TMask* _msk; - TTable* _tabivd, * _tabtpd, * _tabreg, * _tabesc; - TLocalisamfile* _mov; - TLocalisamfile* _nditte; - TLocalisamfile* _unloc; - TLocalisamfile* _comuni; - TLocalisamfile* _clifo; - TLocalisamfile* _caus; + TDociva_array _b; + TRelation* _rel; + TMask* _msk; + TTable* _tabivd, * _tabtpd, * _tabreg, * _tabesc; + TLocalisamfile* _mov; + TLocalisamfile* _nditte; + TLocalisamfile* _unloc; + TLocalisamfile* _comuni; + TLocalisamfile* _clifo; + TLocalisamfile* _caus; TSaldo* _sld; - + TParagraph_string* _d18,* _d23,* _d30; + TDate _data_ini,_data_fine,_data_finese,_data_finesesucc,_ultima_data_reg; TDate _datareg,_datadoc,_data_inizioese,_datareg_stampa,_inizioes; int _cur1,_gruppo,_conto,_numcarat,_stampanum,_numivd,_annoiva; @@ -787,6 +788,8 @@ bool TMastrini_application::preprocess_page(int file, int counter) case LF_RMOV: { + //int rw = 1; + // Ricerca la contropartita di quel movimento TLocalisamfile& rmov = current_cursor()->file(LF_RMOV); @@ -869,37 +872,49 @@ bool TMastrini_application::preprocess_page(int file, int counter) _numgio = atol(_mov->curr().get(MOV_NUMGIO)); _descrizione = current_cursor()->curr(LF_RMOV).get(RMV_DESCR); - + if (_numcarat == 1) // Stampa 132 caratteri { if (_descrizione != "") { + *_d23 = (const char*) _descrizione; if (_descrizionemov != "") { - set_row (1,"@42g%.18s", (const char*) _descrizionemov); - set_row (1,"@61g%.23s", (const char*) _descrizione); + *_d18 = (const char*) _descrizionemov; + set_row(1, "@42g#a", _d18); + set_row(1, "@61g#a", _d23); } else if (_descrizionemov == "") - { - set_row (1,"@42g%.18s", (const char*) _descrcaus); - set_row (1,"@61g%.23s", (const char*) _descrizione); - } + { + *_d18 = (const char*) _descrcaus; + set_row(1, "@42g#a", _d18); + set_row(1, "@61g#a", _d23); + } } else if (_descrizione == "") if (_descrizionemov != "") { - set_row (1,"@42g%.18s", (const char*) _descrcaus); - set_row (1,"@61g%.23s", (const char*) _descrizionemov); + *_d23 = (const char*) _descrizionemov; + *_d18 = (const char*) _descrcaus; + set_row (1,"@42g#a", _d18); + set_row (1,"@61g#a", _d23); } else if (_descrizionemov == "") { conto(_gruppocontr,_contocontr,FALSE); TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr); - TString descr_contr = tc.descrizione(); - set_row (1,"@42g%.18s", (const char*) _descrcaus); + TString80 descr_contr = tc.descrizione(); + //set_row (1,"@42g%.18s", (const char*) _descrcaus); + //if (descr_contr != "Sconosciuto") + // set_row (1,"@61g%.23s", (const char*) descr_contr); + *_d18 = (const char*) _descrcaus; + set_row (1,"@42g#a", _d18); if (descr_contr != "Sconosciuto") - set_row (1,"@61g%.23s", (const char*) descr_contr); + { + *_d23 = (const char*) descr_contr; + set_row (1,"@61g#a", _d23); + } } } else @@ -907,22 +922,31 @@ bool TMastrini_application::preprocess_page(int file, int counter) { if (_descrizione != "") { + *_d30 = (const char*) _descrizione; if (_descrizionemov != "") { - set_row (1,"@46g%.23s", (const char*) _descrizionemov); - set_row (1,"@70g%.30s", (const char*) _descrizione); + *_d23 = (const char*) _descrizionemov; + set_row (1,"@46g#a", _d23); + set_row (1,"@70g#a", _d30); } else if (_descrizionemov == "") - { - set_row (1,"@46g%.23s", (const char*) _descrcaus); - set_row (1,"@70g%.30s", (const char*) _descrizione); - } + { + //set_row (1,"@46g%.23s", (const char*) _descrcaus); + //set_row (1,"@70g%.30s", (const char*) _descrizione); + *_d23 = (const char*) _descrcaus; + set_row(1, "@46g#a", _d23); + set_row(1, "@70g#a", _d30); + } } else if (_descrizione == "") if (_descrizionemov != "") { - set_row (1,"@46g%.23s", (const char*) _descrcaus); - set_row (1,"@70g%.30s", (const char*) _descrizionemov); + //set_row (1,"@46g%.23s", (const char*) _descrcaus); + //set_row (1,"@70g%.30s", (const char*) _descrizionemov); + *_d30 = (const char*) _descrizionemov; + *_d23 = (const char*) _descrcaus; + set_row (1,"@46g#a", _d23); + set_row (1,"@70g#a", _d30); } else if (_descrizionemov == "") @@ -930,9 +954,16 @@ bool TMastrini_application::preprocess_page(int file, int counter) conto(_gruppocontr,_contocontr,FALSE); TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr); TString descr_contr = tc.descrizione(); - set_row (1,"@46g%.23s", (const char*) _descrcaus); + //set_row (1,"@46g%.23s", (const char*) _descrcaus); + //if (descr_contr != "Sconosciuto") + // set_row (1,"@70g%.30s", (const char*) descr_contr); + *_d23 = (const char*) _descrcaus; + set_row (1,"@46g#a", _d23); if (descr_contr != "Sconosciuto") - set_row (1,"@70g%.30s", (const char*) descr_contr); + { + *_d30 = (const char*) descr_contr; + set_row (1,"@70g#a", _d30); + } } } @@ -2150,10 +2181,10 @@ int TMastrini_application::ricerca_gruppo(int start) else descriz2 = ""; - set_row(3,"@27g%-30s",(const char*) descrizione_gruppo()); - set_row(3,"@59g%-30s",(const char*) descrizione_conto()); + set_row(3,"@27g%-.30s",(const char*) descrizione_gruppo()); + set_row(3,"@59g%-.30s",(const char*) descrizione_conto()); - set_row(3,"@91g%-30s",(const char*) _descr); + set_row(3,"@91g%-.41s",(const char*) _descr); set_row(4, "@0gClasse@12g%c", _lettivd); set_row(4, "@14g%-8s",(const char*) _numrivd); if (_numivd != 0) @@ -2267,7 +2298,12 @@ bool TMastrini_application::user_create() _tabreg = new TTable (TAB_REG); _tabesc = new TTable (TAB_ESC); _sld = new TSaldo (); - + + _d18 = new TParagraph_string ("",18); + _d23 = new TParagraph_string ("",23); + _d30 = new TParagraph_string ("",30); + + _msk = new TMask("cg3200a"); _msk->set_handler(F_SOTTOCINI_CONTO, sottoc_handler_ini); _msk->set_handler(F_SOTTOCINI_CLIENTE, sottoc_handler_ini); @@ -2306,6 +2342,9 @@ bool TMastrini_application::user_destroy() delete _tabreg; delete _tabesc; delete _sld; + delete _d18; + delete _d23; + delete _d30; return TRUE; diff --git a/cg/cg4300.cpp b/cg/cg4300.cpp index 8cbf464d1..9d6537805 100755 --- a/cg/cg4300.cpp +++ b/cg/cg4300.cpp @@ -24,7 +24,7 @@ inline TLiquidazione_app& app() TLiquidazione_app::TLiquidazione_app() : _ditte(NULL), _selected(10000), -_year(4), _nomiditte(100), _firm_bookmark(-1) +_year(4), _nomiditte(100) { _isprint = _is_interactive = _canprint = TRUE; _isplafond = _printonly = _is_visliq = FALSE; diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index e68f92124..54b0d6635 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -1860,7 +1860,41 @@ bool CG4400_application::preprocess_page(int file, int counter) _datareg = mov.get_date(MOV_DATAREG); - if (_tipo_stampa != 3 && _liquidazione) + /* + if (_tipo_stampa != 3 && _liquidazione) + { + int da; + if (_tipo_stampa == 1) + da = _data_da.month(); + else da = 1; + int a = _datareg.month(); + for (int m = da; m < a; m++) + { + if (!_st_liq[m]) + if (stampo_liquidazione(m)) + { + _datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header (intestazione per la stampa liquidazione) + TFilename t; + t.temp("reg"); + if (_tipo_stampa == 1) + send_message('S', t, m); + else send_message('s', t, m); + TString80 nomef; nomef = t.path(); nomef << "\\" << t.name(); + if (fexist(nomef)) + { + _intesta_liq = TRUE; + merge_export_file(t,FALSE,TRUE); + printer().formfeed(); + _intesta_liq = FALSE; + reset_print(); + } + } + _st_liq[m] = TRUE; + } + } + */ + + if (_tipo_stampa != 3 && _liquidazione) { int da; if (_tipo_stampa == 1) @@ -1875,21 +1909,32 @@ bool CG4400_application::preprocess_page(int file, int counter) _datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header (intestazione per la stampa liquidazione) TFilename t; t.temp("reg"); - if (_tipo_stampa == 1) - send_message('S', t, m); - else send_message('s', t, m); - TString80 nomef; nomef = t.path(); nomef << "\\" << t.name(); - if (fexist(nomef)) + if (_scelta == B0_settato || _scelta == prosegui_stampa) + { + if (_tipo_stampa == 1) + send_message('S',t, m); + else send_message('s',t, m); + } + else //_scelta == prosegui_cal_stampa + { + if (_tipo_stampa == 1) + send_message('L', t, m); + else send_message('l', t, m); + } + //TString80 nomef; nomef = t.path(); nomef << "\\" << t.name(); + //if (fexist(nomef)) + if (fexist(t)) { - _intesta_liq = TRUE; + _intesta_liq = TRUE; + printer().footerlen(0); merge_export_file(t,FALSE,TRUE); printer().formfeed(); - _intesta_liq = FALSE; + _intesta_liq = FALSE; reset_print(); - } + } } - _st_liq[m] = TRUE; - } + _st_liq[m] = TRUE; + } } _datareg = mov.get_date(MOV_DATAREG); @@ -1899,6 +1944,7 @@ bool CG4400_application::preprocess_page(int file, int counter) { _auto_intraf = FALSE; printer().formfeed(); + printer().footerlen(5); } _dataregp = _datareg; @@ -2143,6 +2189,21 @@ void CG4400_application::scrivi_reg() else Tabreg.put("I8", (long)_datareg.month()); Tabreg.rewrite(); + } + + if (_tipo_stampa == 3) + { + TString16 cod = ""; + TTable lbu ("%LBU"); + + cod << _annoes << _codlib; + lbu.zero(); + lbu.put("CODTAB", cod); + if (lbu.read() == NOERR) + { + lbu.put("I0", (long) _fino_a_mese); + lbu.rewrite(); + } } } @@ -2361,12 +2422,14 @@ void CG4400_application::liq_b0_settato() if (_tipo_stampa == 1) send_message('S',f, _datareg.month()); else send_message('s',f, _datareg.month()); - TString80 nomef; - nomef = f.path(); nomef << "\\" << f.name(); - if (fexist(nomef)) + //TString80 nomef; + //nomef = f.path(); nomef << "\\" << f.name(); + //if (fexist(nomef)) + if (fexist(f)) { printer().formfeed(); _intesta_liq = TRUE; + printer().footerlen(0); merge_export_file(f,FALSE,TRUE); _intesta_liq = FALSE; } @@ -2421,6 +2484,7 @@ print_action CG4400_application::postprocess_page (int file, int counter) { printer().formfeed(); _intesta_liq = TRUE; + printer().footerlen(0); merge_export_file(_t,FALSE,TRUE); _intesta_liq = FALSE; } @@ -2507,7 +2571,6 @@ bool CG4400_application::set_print(int n) else _stampa_width = 198; if (_stampa_len != 0) printer().formlen(_stampa_len); - else printer().formlen(66); //Se stampa di prova l'utente indica data_da e data_a if (_tipo_stampa == 1) { @@ -2667,12 +2730,13 @@ void CG4400_application::no_movimenti() send_message('L', f, m); else send_message('l', f, m); } - TString80 nomef; - nomef = f.path(); nomef << "\\" << f.name(); - if (fexist(nomef)) + //TString80 nomef; + //nomef = f.path(); nomef << "\\" << f.name(); + //if (fexist(nomef)) + if (fexist(f)) { _intesta_liq = TRUE; - //if (m > da) printer().formfeed(); + printer().footerlen(0); merge_export_file(f,FALSE,TRUE); printer().formfeed(); _intesta_liq = FALSE; @@ -2699,7 +2763,7 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) _primast = _u_stampata; _ok_vidi = FALSE; _stampa_mese = 13; - _scelta = controlla_b0(); + //_scelta = controlla_b0(); TApplication::set_firm(_ditta); look_lia(); @@ -2711,14 +2775,17 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) TApplication::set_firm(__firm); return fatal_box("Finire di stampare registri anno precedente"); } - if (!_stampa_tutti_i_registri) - _cur->set_filterfunction(filter_func); if (!_stampa_tutti_i_registri) { + _scelta = controlla_b0(); + _cur->set_filterfunction(filter_func); ok = setta_mask(i); if (!ok) continue; if (_liquidazione) { + if (_tipo_stampa == 2 || _tipo_stampa == 4) + _size_header = _stampa_ind_ditta ? 8 : 6; + else _size_header = 8; clear_stliq(); _scelta = controlla_liquidazione(); if (_scelta == non_proseguire) @@ -2816,6 +2883,9 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) if (_liquidazione) { + if (_tipo_stampa == 2 || _tipo_stampa == 4) + _size_header = _stampa_ind_ditta ? 8 : 6; + else _size_header = 8; clear_stliq(); _scelta = controlla_liquidazione(); if (_scelta == non_proseguire) @@ -2848,8 +2918,9 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m) } } //for if (msg) - message_box("Ditta %ld: Nessun registro soddisfa i parametri indicati", _ditta); - } + if ( (_tipo_stampa != 3) || (_tipo_stampa == 3 && _fino_a_mese == 1) ) //il messaggio seguente, nel caso di stampa su libro unico, + message_box("Ditta %ld: nessun registro soddisfa i parametri indicati", _ditta); //viene gia' dato nell'handler (che scatta pero' se il mese di + } //stampa e' diverso da gennaio } } TApplication::set_firm(__firm); @@ -2873,12 +2944,14 @@ void CG4400_application::stampa_liq_mesi_succ() if (_tipo_stampa == 1) send_message('S',t, m); else send_message('s',t,m); - TString80 nomef; nomef = t.path(); nomef << "\\" << t.name(); - if (fexist(nomef)) + //TString80 nomef; nomef = t.path(); nomef << "\\" << t.name(); + //if (fexist(nomef)) + if (fexist(t)) { _intesta_liq = TRUE; - if (m > da) printer().formfeed(); - merge_export_file(t,FALSE,TRUE); + if (m > da) printer().formfeed(); + printer().footerlen(0); + merge_export_file(t,FALSE,TRUE); _intesta_liq = FALSE; } } @@ -2904,13 +2977,14 @@ void CG4400_application::send_message(char tipo, const TFilename& nome, int mese ss.add(tipo); ss.add(_data_stampa.string()); ss.add(nome); + ss.add(_size_header); ss.add("x"); - + TMessage liq (app, "RCL", ss); liq.send(); TExternal_app pn(app); - pn.run(); + pn.run(); } bool CG4400_application::set_ditte(TMask& m) @@ -3034,7 +3108,7 @@ int CG4400_application::stampa_intestazione() } riga.overwrite (format("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi)); set_header (r, riga); - + return r; } @@ -3116,7 +3190,7 @@ void CG4400_application::preprocess_header() set_header(r++,riga); set_header(r,""); } - else + else //non sto stampando la liquidazione { r++; set_header(r, riga); @@ -3200,7 +3274,7 @@ void CG4400_application::preprocess_header() set_header(r++, "@38gGeneralita'"); set_header(r, riga); - } + } } int cg4400 (int argc, char * argv[])