git-svn-id: svn://10.65.10.50/branches/R_10_00@23078 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
215823a913
commit
c1f34b5518
151
cg/cg1311.cpp
Normal file
151
cg/cg1311.cpp
Normal file
@ -0,0 +1,151 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <progind.h>
|
||||
#include <recarray.h>
|
||||
#include <recset.h>
|
||||
#include <relation.h>
|
||||
#include <reputils.h>
|
||||
#include <sheet.h>
|
||||
|
||||
#include <mov.h>
|
||||
#include <nditte.h>
|
||||
#include <partite.h>
|
||||
#include <rmov.h>
|
||||
|
||||
class TXRef_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event fe, long jolly);
|
||||
void test_rmov();
|
||||
|
||||
public:
|
||||
TXRef_mask(const char* title);
|
||||
};
|
||||
|
||||
void TXRef_mask::test_rmov()
|
||||
{
|
||||
TLog_report log;
|
||||
|
||||
TFast_isamfile mov(LF_MOV);
|
||||
TFast_isamfile part(LF_PARTITE); part.setkey(2);
|
||||
|
||||
TString msg;
|
||||
TISAM_recordset rmov_set("USE RMOV");
|
||||
const TRectype& rmov = rmov_set.cursor()->curr();
|
||||
TProgress_monitor pm(rmov_set.items(), TR("Scansione righe contabili"));
|
||||
for (bool ok = rmov_set.move_first(); ok; ok = rmov_set.move_next())
|
||||
{
|
||||
if (!pm.add_status(1))
|
||||
break;
|
||||
const long numreg = rmov.get_long(RMV_NUMREG);
|
||||
const int numrig = rmov.get_int(RMV_NUMRIG);
|
||||
|
||||
msg.format(FR("Riga %3d del movimento %7ld del %s: "), numrig, numreg, (const char*)rmov.get(RMV_DATAREG));
|
||||
|
||||
if (numreg != mov.get_long(MOV_NUMREG))
|
||||
{
|
||||
mov.put(MOV_NUMREG, numreg);
|
||||
if (mov.read() != NOERR)
|
||||
mov.zero();
|
||||
}
|
||||
if (numreg != mov.get_long(MOV_NUMREG))
|
||||
{
|
||||
msg << TR("manca il record di testata");
|
||||
log.log(2, msg);
|
||||
}
|
||||
if (rmov.get_char(RMV_ROWTYPE) == 'K')
|
||||
{
|
||||
part.put(PART_NREG, numreg);
|
||||
part.put(PART_NUMRIG, numrig);
|
||||
if (part.read() != NOERR)
|
||||
{
|
||||
msg << TR("manca il record di saldaconto");
|
||||
log.log(2, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.preview();
|
||||
}
|
||||
|
||||
bool TXRef_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case DLG_USER:
|
||||
if (e == fe_button)
|
||||
{
|
||||
TArray_sheet sheet(-1, -1, 70, 20, TR("Scelta ditta"), HR("Codice|Ragione Sociale@50"));
|
||||
TToken_string row;
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
|
||||
FOR_EACH_FILE_RECORD(ditte)
|
||||
{
|
||||
const long cod = ditte.get_long(NDT_CODDITTA);
|
||||
if (prefix().exist(cod))
|
||||
{
|
||||
row.cut(0);
|
||||
row.add(cod);
|
||||
row.add(ditte.get(NDT_RAGSOC));
|
||||
|
||||
const long pos = sheet.add(row);
|
||||
if (cod == prefix().get_codditta())
|
||||
sheet.select(pos);
|
||||
}
|
||||
}
|
||||
if (sheet.run() == K_ENTER)
|
||||
set(DLG_USER, sheet.row().get(0), 0x3);
|
||||
return false;
|
||||
}
|
||||
if (e == fe_modify || e == fe_close)
|
||||
{
|
||||
const long cod = atol(o.get());
|
||||
if (prefix().exist(cod))
|
||||
prefix().set_codditta(cod);
|
||||
else
|
||||
return error_box(FR("La ditta %05ld non è attivata per la contabilità"), cod);
|
||||
}
|
||||
break;
|
||||
case DLG_SELECT:
|
||||
if (e == fe_button)
|
||||
{
|
||||
test_rmov();
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
TXRef_mask::TXRef_mask(const char* title) : TAutomask(title, 1, 30, 5)
|
||||
{
|
||||
add_number(DLG_USER, 0, TR("Codice ditta "), 1, 1, 5, "BUF");
|
||||
add_button(DLG_SELECT, 0, "", -12, -1, 10, 2);
|
||||
add_button(DLG_QUIT, 0, "", -22, -1, 10, 2);
|
||||
set_handlers();
|
||||
}
|
||||
|
||||
|
||||
class TXRef_check: public TSkeleton_application
|
||||
{
|
||||
public:
|
||||
const char* app_name() const { return TR("Controllo integrità archivi"); }
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
void TXRef_check::main_loop()
|
||||
{
|
||||
open_files(LF_CLIFO, LF_NDITTE, LF_PCON, LF_MOV, LF_RMOV, LF_RMOVIVA,
|
||||
LF_PARTITE, LF_SCADENZE, LF_PAGSCA, 0);
|
||||
|
||||
TXRef_mask m(app_name());
|
||||
while (m.run() != K_QUIT);
|
||||
}
|
||||
|
||||
void xref_check(int argc, char* argv[])
|
||||
{
|
||||
TXRef_check ez;
|
||||
ez.run(argc, argv, ez.app_name());
|
||||
}
|
@ -805,13 +805,6 @@ void TPrimanota_application::init_insert_mode(TMask& m)
|
||||
init_mask(m);
|
||||
m.first_focus(_firstfocus);
|
||||
|
||||
if (m.get_long(F_NUMREG) <= 0)
|
||||
{
|
||||
const long nreg = _msk[0]->get_long(F_CC_NUMREG);
|
||||
if (nreg > 0)
|
||||
m.set(F_NUMREG, nreg);
|
||||
}
|
||||
|
||||
if (causale().reg().agenzia_viaggi())
|
||||
m.set(F_DATA74TER, m.get(F_DATAREG));
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#define F_DATACOMP 116
|
||||
#define F_ANNOIVA 117
|
||||
#define F_NUMDOCEXT 130
|
||||
#define F_CC_NUMREG 163
|
||||
|
||||
#define F_CLIFO 128
|
||||
#define F_CLIENTE 151
|
||||
|
@ -2198,7 +2198,7 @@ bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
|
||||
TEdit_field& numreg = m.efield(F_NUMREG);
|
||||
TString16 filter; if (cau.full()) filter << MOV_CODCAUS << "==\"" << cau << '"';
|
||||
numreg.browse()->set_filter(filter);
|
||||
|
||||
|
||||
const TipoIVA i = app().cau2IVA(cau, ann); // Cerca causale e suo tipo
|
||||
if (i != iva_errata)
|
||||
return suspended_handler(f, key); // Controlla sospensione
|
||||
|
@ -1075,11 +1075,14 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
const int tipatt = trueatt[5] - '0';
|
||||
trueatt.cut(5);
|
||||
|
||||
TString pimsg; pimsg << TR("Ricalcolo attività ") << trueatt << " (mese " << month << ')';
|
||||
TProgind pi(items, pimsg, false, true);
|
||||
TString pimsg;
|
||||
pimsg << TR("Ricalcolo attività ") << trueatt << " (" << TR("mese ")
|
||||
<< (month > 12 ? "13" : itom(month)) << ')';
|
||||
|
||||
TProgress_monitor pi(items, pimsg, false);
|
||||
for (; _cur->pos() < items; ++(*_cur))
|
||||
{
|
||||
if (!pi.setstatus(_cur->pos()))
|
||||
if (!pi.set_status(_cur->pos()))
|
||||
break;
|
||||
|
||||
TDate date = _mov->get(MOV_DATAREG);
|
||||
@ -1100,7 +1103,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (_mov->get_long(MOV_NUMREG) == 21438)
|
||||
if (_mov->get_long(MOV_NUMREG) >= 132)
|
||||
int cazzone = 1;
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,7 @@ TInv_cont::TInv_cont(char mov) : _scelta(toupper(mov))
|
||||
bool TInv_cont::messaggio_hnd(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB)
|
||||
return message_box("Rilevato STATO DI RIPARTENZA: il trasferimento ripartira' automaticamente");
|
||||
return message_box("Rilevato STATO DI RIPARTENZA: il trasferimento ripartirà automaticamente");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -623,12 +623,12 @@ bool TInv_cont::controlli()
|
||||
{
|
||||
if (_esiste_ditta && !_esiste_record)
|
||||
return error_box(FR("Rilevato stato di ripartenza con dati contradditori:\n"
|
||||
"Ditta %ld in tabella studio per invio senza record."), _ditta);
|
||||
"Ditta %ld in tabella %%INS per invio senza record HEADER."), _ditta);
|
||||
|
||||
if (!_esiste_ditta && _esiste_record)
|
||||
{
|
||||
return error_box("Rilevato stato di ripartenza con dati contradditori:\n"
|
||||
"esiste un record senza nessuna ditta in %%INS.");
|
||||
"esiste un record HEADER senza nessuna ditta in %%INS.");
|
||||
}
|
||||
|
||||
if (_esiste_ditta && _esiste_record)
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <diction.h>
|
||||
#include <dongle.h>
|
||||
#include <recarray.h>
|
||||
#include <recset.h>
|
||||
|
||||
#include <causali.h>
|
||||
#include <clifo.h>
|
||||
@ -134,13 +135,13 @@ bool gestione_IVAxCassa(const TDate& data_mov, long firm)
|
||||
return yes;
|
||||
}
|
||||
|
||||
static bool mov_has_imposte(const TRectype& mov)
|
||||
static tipo_movimento get_tipo_movimento(const TRectype& mov)
|
||||
{
|
||||
const char tipocf = mov.get_char(MOV_TIPO);
|
||||
if (tipocf == 'C' || tipocf == 'F')
|
||||
tipo_movimento tm = (tipo_movimento)mov.get_int(MOV_TIPOMOV);
|
||||
if (tm == tm_nessuno)
|
||||
{
|
||||
tipo_movimento tm = (tipo_movimento)mov.get_int(MOV_TIPOMOV);
|
||||
if (tm == tm_nessuno)
|
||||
const char tipocf = mov.get_char(MOV_TIPO);
|
||||
if (tipocf == 'C' || tipocf == 'F')
|
||||
{
|
||||
const TString& tipodoc = mov.get(MOV_TIPODOC);
|
||||
if (tipodoc == "FV" || tipodoc == "FA")
|
||||
@ -148,15 +149,23 @@ static bool mov_has_imposte(const TRectype& mov)
|
||||
if (tipodoc == "NC")
|
||||
tm = tm_nota_credito;
|
||||
}
|
||||
return tm == tm_fattura || tm == tm_nota_credito;
|
||||
}
|
||||
|
||||
return false;
|
||||
return tm;
|
||||
}
|
||||
|
||||
static bool mov_has_imposte(const TRectype& mov)
|
||||
{
|
||||
const tipo_movimento tm = get_tipo_movimento(mov);
|
||||
return tm == tm_fattura || tm == tm_nota_credito;
|
||||
}
|
||||
|
||||
bool is_split_payment(const TRectype& mov)
|
||||
{
|
||||
if (mov_has_imposte(mov) && mov.get_int(MOV_ANNOIVA) >= 2015 && mov.get_real(MOV_RITFIS).is_zero())
|
||||
bool yes = false;
|
||||
if (mov.get_char(MOV_TIPO) != 'C')
|
||||
return yes;
|
||||
|
||||
if (mov.get_int(MOV_ANNOIVA) >= 2015 && mov.get_real(MOV_RITFIS).is_zero() && mov_has_imposte(mov))
|
||||
{
|
||||
const TRectype& clifo = cache().get_rec(LF_CLIFO, "C", mov.get(MOV_CODCF));
|
||||
if (clifo.get_bool(CLI_SPLITPAY)) // Ente pubblico con split payment
|
||||
@ -164,10 +173,23 @@ bool is_split_payment(const TRectype& mov)
|
||||
const TRectype& rcs = cache().get(LF_CAUSALI, mov.get(MOV_CODCAUS));
|
||||
const int rsi = rcs.get_int(CAU_REGSPIVA); // Regime speciale IVA
|
||||
if (rsi != 13 && rsi != 50 && rsi != 51) // No reverse charge!
|
||||
return true;
|
||||
yes = true;
|
||||
|
||||
if (yes && get_tipo_movimento(mov) == tm_nota_credito) // Controlla le N.C.
|
||||
{
|
||||
if (mov.get_bool(MOV_LIQDIFF))
|
||||
yes = false;
|
||||
else
|
||||
{
|
||||
TISAM_recordset par("USE PART KEY 2 SELECT ANNO<2015\nFROM NREG=#NR\nTO NREG=#NR");
|
||||
par.set_var("#NR", mov.get_long(MOV_NUMREG));
|
||||
if (!par.empty()) // Se la nota si rifersice a partite vecchie non ha lo split payment
|
||||
yes = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return yes;
|
||||
}
|
||||
|
||||
bool is_IVA_diff(const TRectype& mov)
|
||||
|
Loading…
x
Reference in New Issue
Block a user