Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Build-Portable.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
setlocal

cd /d "%~dp0"
set "SIPOS_DEFAULT_LABEL=Beta-1.5.1"
set "SIPOS_DEFAULT_LABEL=Beta-1.5.2"

echo.
echo SIPOS Portable Builder
Expand Down
6 changes: 6 additions & 0 deletions Forms/FormDados.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ private void AddRangeSelectionCheckBox()

private void chkRangeSelection_CheckedChanged(object sender, EventArgs e)
{
Mediator.rangeAtivo = chkRangeSelection.Checked;

if (chkRangeSelection.Checked)
{
monthCalendar.MaxSelectionCount = 62;
Expand Down Expand Up @@ -147,6 +149,10 @@ private void monthCalendar_DateChanged(object sender, DateRangeEventArgs e)
{
dateProcess(1);

// B-1.5.2: expor o intervalo atual ao motor Modelar
Mediator.rangeInicio = monthCalendar.SelectionStart.Date;
Mediator.rangeFim = monthCalendar.SelectionEnd.Date;

// B-1.3.2: com o modo início/fim ativo, os dias de interrupção derivam do
// intervalo selecionado no calendário; caso contrário mantém-se a regra
// clássica do sábado (fim-de-semana = 2 dias de interrupção).
Expand Down
23 changes: 19 additions & 4 deletions Forms/FormExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,28 @@ private void btn_ExportWord_Click(object sender, EventArgs e)
{
try
{
if (Mediator.osDay.DayOfWeek == DayOfWeek.Tuesday) // CASO A O.S. seja de TERÇA, ou seja, ESCALA DE SERVIÇO seja QUARTA-FEIRA
string modeloBase = Mediator.osDay.DayOfWeek == DayOfWeek.Tuesday
? Mediator.fPathModelQuarta // O.S. de TERÇA => ESCALA DE SERVIÇO de QUARTA-FEIRA
: Mediator.fPathModelSemana; // O.S. nos outros dias de semana

string destino = Mediator.fPathOSWord + @"\" + txtBox_ExportDocName.Text + ".doc";

// B-1.5.2 (opt-in): se existir um programa Modelar gravado ao lado do
// SIPOS.exe, a exportação é executada pelo motor Modelar (multi-dia,
// substituição por bloco). Sem esse ficheiro, o fluxo clássico corre
// exatamente como sempre.
ProgramaModelar programa = ProgramaModelar.Carregar(ProgramaModelar.CaminhoPorOmissao());
if (programa != null)
{
Word_Processor.CreateWordDocument(Mediator.fPathModelQuarta, Mediator.fPathOSWord + @"\" + txtBox_ExportDocName.Text + ".doc");
List<DateTime> dias = Mediator.rangeAtivo
? PlaneadorDeDias.DiasDoIntervalo(Mediator.rangeInicio, Mediator.rangeFim)
: PlaneadorDeDias.DiasDeEscala(Mediator.osDay);

ModelarMotorWord.Executar(programa, dias, modeloBase, destino);
}
else // CASO A O.S. seja noutros dias de semana
else
{
Word_Processor.CreateWordDocument(Mediator.fPathModelSemana, Mediator.fPathOSWord + @"\" + txtBox_ExportDocName.Text + ".doc");
Word_Processor.CreateWordDocument(modeloBase, destino);
}


Expand Down
Loading