Patch level : 12.0 1000

Files correlati     : cg4.exe
Commento            :

Corretta liquidazione fatture per cassa quando si liquidano nel periodo precedente e hanno pagamenti anche nei mesi successivi
This commit is contained in:
Alessandro Bonazzi 2020-10-03 21:34:45 +02:00
parent eb1c368e74
commit 3d42cc92b4

View File

@ -782,17 +782,17 @@ static void LOG_IVA_DIFF(const TRectype& id)
cantwrite_box(name); cantwrite_box(name);
fopen_s(&f, name, "w"); fopen_s(&f, name, "w");
} }
if (f != NULL) if (f != nullptr)
fprintf(f, "NUMREG\tNUMRIG\tNUMPRO\tNUMREGP\tDATAPAG\t \tGen\tFeb\tMar\tApr\tMag\tGiu\tLug\tAgo\tSet\tOtt\tNov\tDic\n"); fprintf(f, "NUMREG\tNUMRIG\tNUMPRO\tNUMREGP\tDATAPAG\t \tGen\tFeb\tMar\tApr\tMag\tGiu\tLug\tAgo\tSet\tOtt\tNov\tDic\n");
} }
if (f != NULL) if (f != nullptr)
{ {
TToken_string msg(255, '\t'); TToken_string msg(255, '\t');
msg.add(id.get(RMI_NUMREG)); msg.add(id.get(RMI_NUMREG));
msg.add(id.get(RMI_NUMRIG)); msg.add(id.get(RMI_NUMRIG));
msg.add(id.get("NUMPRO")); msg.add(id.get(ID_NUMPRO));
msg.add(id.get("NUMREGP")); msg.add(id.get(ID_NUMREGP));
msg.add(id.get("DATAREGP")); msg.add(id.get(ID_DATAREGP));
for (int i = id.get_int("MESELIQ"); i > 0; i--) for (int i = id.get_int("MESELIQ"); i > 0; i--)
msg.add(" "); msg.add(" ");
msg.add(id.get_real(RMI_IMPOSTA).stringa(0,2)); msg.add(id.get_real(RMI_IMPOSTA).stringa(0,2));
@ -1201,6 +1201,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
arrpart.add_numreg(numreg); arrpart.add_numreg(numreg);
const TPartita* p = arrpart.first(); const TPartita* p = arrpart.first();
const int row = p ? p->mov2rig(numreg, 0) : 0; const int row = p ? p->mov2rig(numreg, 0) : 0;
game_found = row > 0; game_found = row > 0;
if (game_found && !id_chiusa) if (game_found && !id_chiusa)
{ {
@ -1520,7 +1521,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
if (diff_totr == ZERO) if (diff_totr == ZERO)
continue; continue;
TDate datafat= _mov->get_date(MOV_DATAREG); TDate datafat = _mov->get_date(MOV_DATAREG);
long numreg = _rmoviva->get_long(RMI_NUMREG); long numreg = _rmoviva->get_long(RMI_NUMREG);
sezfat = tipomov == vendita ? 'D' : 'A'; sezfat = tipomov == vendita ? 'D' : 'A';
@ -1540,7 +1541,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
datafat = datareg; datafat = datareg;
id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG)); id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG));
id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG)); id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG));
id.put("NUMPRO", 0); id.put(ID_NUMPRO, 0);
id.put(PART_TIPOMOV, tm); id.put(PART_TIPOMOV, tm);
CHECKD(rmi_tipoatt > 0, "Invalid tipo att ", rmi_tipoatt); CHECKD(rmi_tipoatt > 0, "Invalid tipo att ", rmi_tipoatt);
id.put("TIPOATT", rmi_tipoatt); id.put("TIPOATT", rmi_tipoatt);
@ -1593,13 +1594,13 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
datapag = rp.get(PART_DATADOC); datapag = rp.get(PART_DATADOC);
if (!datapag.ok()) if (!datapag.ok())
datapag = rp.get(PART_DATAPAG); datapag = rp.get(PART_DATAPAG);
if (datapag < datafat) if (datapag < datafat && datapag.month() != liqmonth)
datapag = datafat; datapag = datafat;
} }
else else
datapag = _mov->get_date(MOV_DATAINC) ; datapag = _mov->get_date(MOV_DATAINC) ;
bool ok = is_month_ok(liqmonth == 0 ? datapag.month() : liqmonth, month) && (atoi(_year) == datapag.year()); bool ok = is_month_ok(datapag.month(), month) && (atoi(_year) == datapag.year());
if (ok) if (ok)
{ {
@ -1607,13 +1608,13 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG)); id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG));
id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG)); id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG));
CHECKD(nrigp > 0, "Invalid NRIGP ", nrigp); CHECKD(nrigp > 0, "Invalid NRIGP ", nrigp);
id.put("NUMPRO", min(nrigp, 999)); id.put(ID_NUMPRO, min(nrigp, 999));
if (id.read(_isequal, _lock) != NOERR) if (id.read(_isequal, _lock) != NOERR)
{ {
id.zero(); id.zero();
id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG)); id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG));
id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG)); id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG));
id.put("NUMPRO", min(nrigp, 999)); id.put(ID_NUMPRO, min(nrigp, 999));
if (id.write() != NOERR) if (id.write() != NOERR)
error_box("Errore %d in creazione record IVADIFF", id.status()); error_box("Errore %d in creazione record IVADIFF", id.status());
} }