Patch level : 12.0 620

Files correlati     : bs
Commento            : Aggiunta possibilità di modificare la data di importazione
This commit is contained in:
Mattia Tollari 2018-09-18 12:17:35 +02:00
parent 90e1ee3099
commit 8e3e201b2a
2 changed files with 52 additions and 3 deletions

View File

@ -27,6 +27,7 @@
#include <vector>
#include "bsutility.h"
#include "urldefid.h"
#define BS_DTULTAGG "DtUltAgg"
@ -138,8 +139,50 @@ bool TSknet_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
}
}
}
if (e == fe_button && o.dlg() == DLG_EDIT)
bss().clean();
if (e == fe_button)
{
if (o.dlg() == DLG_EDIT)
bss().clean();
else if(o.dlg() == DLG_RECALC)
{
static TMask m ("Reset data importazione", 1, 30, 5);
m.add_button_tool(DLG_OK, "~Conferma", TOOL_OK);
m.add_button_tool(DLG_CANCEL, "Annulla", TOOL_CANCEL);
// Avevo voglia di scrivere spaghetti code stamattina
int start = 101;
static const int date = start++, hours = start++, minutes = start++, seconds = start++;
m.add_date(date, 0, "Data", 1, 1);
m.add_string(hours, 0, "Ora ", 1, 2, 2);
m.add_string(minutes, 0, ":", 8, 2, 2);
m.add_string(seconds, 0, ":", 12, 2, 2);
time_t rt = time(NULL);
struct tm * now = localtime(&rt);
m.set(date, TDate(TODAY));
m.set(hours, now->tm_hour);
m.set(minutes, now->tm_min);
m.set(seconds, "00");
while (m.run() == K_ENTER)
{
if(yesno_box("Sei sicuro di voler resettare la data di importazione?"))
{
char new_date[50];
sprintf_s(new_date, sizeof(new_date),
"%d%02d%02d %02d:%02d:%02d.999",
m.get_date(date).year(),
m.get_date(date).month(),
m.get_date(date).day(),
m.get_int(hours),
m.get_int(minutes),
m.get_int(seconds));
ini_set_string(CONFIG_DITTA, "BS", "LAST_IMPORT", new_date);
break;
}
}
}
}
return true;
}

View File

@ -10,7 +10,13 @@ END
BUTTON DLG_EDIT 2 2
BEGIN
PROMPT 1 1 "Compatta DB"
PICTURE TOOL_PACK
PICTURE TOOL_WARNING
END
BUTTON DLG_RECALC 2 2
BEGIN
PROMPT 1 1 "Reset Data"
PICTURE TOOL_RECALC
END
#include <helpbar.h>