You've already forked lazarus-ccr
tvplanit: Fix calculation of month count needed for TVpGanttView.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8458 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -884,12 +884,25 @@ end;
|
|||||||
function TVpGanttView.GetNumMonths: Integer;
|
function TVpGanttView.GetNumMonths: Integer;
|
||||||
var
|
var
|
||||||
dm1, dm2: Integer;
|
dm1, dm2: Integer;
|
||||||
|
y1, m1, d1: Word;
|
||||||
|
y2, m2, d2: Word;
|
||||||
begin
|
begin
|
||||||
if (FStartDate <> NO_DATE) then
|
if (FStartDate <> NO_DATE) then
|
||||||
begin
|
begin
|
||||||
|
DecodeDate(FStartDate, y1, m1, d1);
|
||||||
|
DecodeDate(FEndDate, y2, m2, d2);
|
||||||
|
if (y1 = y2) then
|
||||||
|
Result := m2 - m1 + 1
|
||||||
|
else
|
||||||
|
Result := 13 - m1 + m2 + (y2 - y1 - 1)*12;
|
||||||
|
{
|
||||||
|
else
|
||||||
|
Result := (y2 - y1 - 1) * 12;
|
||||||
dm1 := trunc(StartOfTheMonth(FStartDate));
|
dm1 := trunc(StartOfTheMonth(FStartDate));
|
||||||
dm2 := trunc(StartOfTheMonth(FEndDate));
|
dm2 := trunc(StartOfTheMonth(FEndDate)) + 1;
|
||||||
|
writeln(datetostr(dm1), ' ', datetostr(dm2));
|
||||||
Result := MonthsBetween(dm1, dm2) + 1;
|
Result := MonthsBetween(dm1, dm2) + 1;
|
||||||
|
}
|
||||||
end else
|
end else
|
||||||
Result := 0;
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
@ -1268,6 +1281,9 @@ begin
|
|||||||
x1 := FixedColWidth;
|
x1 := FixedColWidth;
|
||||||
y1 := 0;
|
y1 := 0;
|
||||||
y2 := FTotalColHeaderHeight;
|
y2 := FTotalColHeaderHeight;
|
||||||
|
|
||||||
|
if n > 1 then
|
||||||
|
begin
|
||||||
dm := FStartDate;
|
dm := FStartDate;
|
||||||
for i := 0 to n - 1 do
|
for i := 0 to n - 1 do
|
||||||
begin
|
begin
|
||||||
@ -1287,6 +1303,13 @@ begin
|
|||||||
dm := IncMonth(dm, 1);
|
dm := IncMonth(dm, 1);
|
||||||
x1 := x2;
|
x1 := x2;
|
||||||
end;
|
end;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
nDays := DayOf(FEndDate) - DayOf(FStartDate) + 1;
|
||||||
|
x2 := x1 + nDays * ColWidth;
|
||||||
|
FMonthRecords[0].Rect := Rect(x1, y1, x2, y2);
|
||||||
|
FMonthRecords[0].Date := FStartDate;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpGanttView.RenderToCanvas(RenderCanvas: TCanvas; RenderIn: TRect;
|
procedure TVpGanttView.RenderToCanvas(RenderCanvas: TCanvas; RenderIn: TRect;
|
||||||
|
Reference in New Issue
Block a user