Milgiorie a gestione schede percipienti

git-svn-id: svn://10.65.10.50/branches/R_10_00@22871 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2013-06-20 13:23:00 +00:00
parent 0acd0807c0
commit ad0a49b16a
4 changed files with 63 additions and 42 deletions

View File

@ -515,32 +515,36 @@ void TSchedaPercipienti::agg_pagamenti(const TRectype& sch, const TDate& pag_dal
}
}
bool schede(const TRelation& rel, void* pJolly)
static TDate _pag_dal;
static bool schede(const TRelation& rel, void* pJolly)
{
const TRectype& sch = rel.curr();
TSchedaPercipienti* schper = (TSchedaPercipienti *) pJolly;
TMask mp("Aggiorna pagamenti", 1, 20, 4);
mp.add_date(101, 0, "Data minimima pagamenti ", 1, 1);
const bool ok = mp.run() == K_ENTER;
if (ok)
{
const TDate pag_dal = mp.get(101);
schper->agg_pagamenti(sch, pag_dal);
}
return ok;
schper->agg_pagamenti(sch, _pag_dal);
return true;
}
bool TSchedaPercipienti::aggpag_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TLocalisamfile fsch(LF_SCPERC);
TRectype from(LF_SCPERC);
from.put("CODDITTA", get_firm_770());
TRelation rel(LF_SCPERC);
TCursor c(&rel, "", 1, &from, &from);
c.scan(schede, &app(), TR("Aggiornamento schede"));
TMask mp(TR("Aggiorna pagamenti"), 1, 32, 6);
mp.add_date(101, 0, PR("Data iniziale "), 1, 1);
mp.add_button(DLG_OK, 0, "", -12, -1, 9, 2);
mp.add_button(DLG_CANCEL, 0, "", -22, -1, 9, 2);
const bool ok = mp.run() == K_ENTER;
if (ok)
{
_pag_dal = mp.get(101);
TLocalisamfile fsch(LF_SCPERC);
TRectype from(LF_SCPERC);
from.put("CODDITTA", get_firm_770());
TRelation rel(LF_SCPERC);
TCursor c(&rel, "", 1, &from, &from);
c.scan(schede, &app(), TR("Aggiornamento schede"));
}
}
return true;
}

View File

@ -70,7 +70,7 @@ TCursor* TVersa_rit::meik_curs(TRelation* rel)
{
const long codditta = get_firm_770();
TString16 filt; filt.format("CODDITTA=%ld", codditta);
return new TCursor(rel, filt);
return new TSorted_cursor(rel, "6->RAGSOC", filt);
}
bool TVersa_rit::create()
@ -127,10 +127,10 @@ bool TVersa_rit::create()
_sheet_perc = new TCursor_sheet(_cur,
" |TIPOA|CODANAGR|6->RAGSOC",
" |TIPOA|CODANAGR|6->RAGSOC|6->COFI|6->PAIV",
"Selezione percipienti",
"@1|Tipo|Codice|Ragione sociale@50",
8, 3);
"@1|Tipo|Codice|Ragione sociale@50|Codice Fiscale@16|Partita IVA@12",
8, 1);
_schede = new TArray_sheet(3, 3, -3, -3,
"Selezione schede",
"@1|T|Codice|Scheda n.|Data@10|Ragione@50");
@ -231,7 +231,7 @@ bool TVersa_rit::abicab_hndl(TMask_field& f, KEY k)
const TString& park = f.get();
for (int i=0; park[i]; i++)
if (!isdigit(park[i]))
return f.warning_box("Il codice ABI/CAB deve essere numerico");
return f.error_box(TR("Il codice ABI/CAB deve essere numerico"));
}
return TRUE;
}

View File

@ -1,6 +1,6 @@
#include "770200a.h"
PAGE "Versamento ritenute" -1 -1 75 15
PAGE "Versamento ritenute" -1 -1 75 12
GROUPBOX DLG_NULL 74 3
BEGIN
@ -158,20 +158,16 @@ END
CURRENCY F_VERSATO 15
BEGIN
PROMPT 2 10 "Importo versato "
PROMPT 2 9 "Importo versato "
WARNING "Manca l'importo versato"
CHECKTYPE REQUIRED
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
ENDPAGE
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -22 -1 ""
END
TOOLBAR "top" 0 0 0 2
#include <stdbar.h>
ENDPAGE

View File

@ -26,7 +26,7 @@
///////////////////////////////////////////////////////////
// Codice fiscale di Sirio spa
#define CF_PRODUTTORE "00909290355"
#define CF_PRODUTTORE "04879210963"
const int ANNO_DIC = 2012;
@ -213,8 +213,8 @@ class TTrasferimento770 : public TObject
bool _save_headers;
protected:
void riepiloga_ss(const TRecord770& rec, TArray& riep_ss) const;
void riepiloga_sx(const TRecord770& rec, TArray& riep_sx) const;
bool riepiloga_ss(const TRecord770& rec, TArray& riep_ss) const;
bool riepiloga_sx(const TRecord770& rec, TArray& riep_sx) const;
public:
bool open(const char* path = "", char mode = 'r', int volume = 0);
@ -235,6 +235,7 @@ public:
TRecnotype conta_certificazioni() const;
bool casella_prospetto_st() const;
bool casella_prospetto_sx() const;
bool append_record_b();
long append_quadro(const char* quadro, long codditta, TProgind& pi);
@ -1317,6 +1318,23 @@ bool TTrasferimento770::casella_prospetto_st() const
return nr > 0;
}
bool TTrasferimento770::casella_prospetto_sx() const
{
// Il quadro SX sono le ritenute versate in eccesso
TString query;
query.format("USE %d\nSELECT QLAP=%d\nFROM CODDITTA=%ld\nTO CODDITTA=%ld",
LF_QUADRO_ST, ANNO_DIC, _cod_ditta, _cod_ditta);
TISAM_recordset recset(query);
bool found = false;
for (bool ok = recset.move_first(); ok && !found; ok = recset.move_next())
{
const real verecc = recset.get("QLRITVEREC").as_real();
found = !verecc.is_zero();
}
return found;
}
bool TTrasferimento770::append_record_b()
{
bool ok = false;
@ -1365,12 +1383,13 @@ bool TTrasferimento770::append_record_b()
rec.set(75, 1); // Reazione della dichiarazione (sezione I)
rec.set(76, 0); // Comunicazioni relative a certificazioni lavoro dipendente
const int autonomi = conta_certificazioni();
const bool prosp_s = casella_prospetto_st();
const bool prosp_st = casella_prospetto_st();
const bool prosp_sx = casella_prospetto_sx();
rec.set(77, autonomi);
rec.set(78, autonomi > 0); // casella prospetto SS
rec.set(79, prosp_s); // casella prospetto ST
rec.set(79, prosp_st); // casella prospetto ST
rec.set(80, false); // casella prospetto SV
rec.set(81, prosp_s); // casella prospetto SX
rec.set(81, prosp_sx); // casella prospetto SX
rec.set(82, false); // casella prospetto SY
rec.set(94, 1); // Firma del dichiarante
@ -1415,11 +1434,11 @@ long TTrasferimento770::append_quadro(const char* quadro, long codditta, TProgin
return items;
}
void TTrasferimento770::riepiloga_ss(const TRecord770& rec, TArray& riep_ss) const
bool TTrasferimento770::riepiloga_ss(const TRecord770& rec, TArray& riep_ss) const
{
TString8 code;
real val;
for (int i = 0; rec.np_get_real(i, code, val); i++) if (code.starts_with("AU"))
for (int i = 0; rec.np_get_real(i, code, val); i++) if (code.starts_with("AU") && !val.is_zero())
{
const TString& key = code.right(3);
const int num = atoi(key);
@ -1435,13 +1454,14 @@ void TTrasferimento770::riepiloga_ss(const TRecord770& rec, TArray& riep_ss) con
*r += val;
}
}
return !riep_ss.empty();
}
void TTrasferimento770::riepiloga_sx(const TRecord770& rec, TArray& riep_sx) const
bool TTrasferimento770::riepiloga_sx(const TRecord770& rec, TArray& riep_sx) const
{
TString8 code;
real val;
for (int i = 0; rec.np_get_real(i, code, val); i++) if (code.starts_with("ST"))
for (int i = 0; rec.np_get_real(i, code, val); i++) if (code.starts_with("ST") && !val.is_zero())
{
const int rig = atoi(code.mid(2,3));
const int col = atoi(code.mid(5,3));
@ -1456,6 +1476,7 @@ void TTrasferimento770::riepiloga_sx(const TRecord770& rec, TArray& riep_sx) con
*r += val;
}
}
return !riep_sx.empty();
}