sid 목록 가져오기 기능 . 일부 수정
This commit is contained in:
@@ -63,6 +63,7 @@ namespace FPJ0000
|
||||
int grp2cnt = 0;
|
||||
int spanStart = 0;
|
||||
int spanStart2 = -1;
|
||||
int cnt = 0;
|
||||
|
||||
this.fpSpread1_Sheet1.RowCount = 0;
|
||||
this.fpSpread1.SuspendLayout();
|
||||
@@ -71,15 +72,16 @@ namespace FPJ0000
|
||||
sum3 += dr.amt;
|
||||
if (first)
|
||||
{
|
||||
grp1 = dr.ItemGroup;
|
||||
grp2 = dr.option1;
|
||||
grp1 = dr.ItemGroup.Trim();
|
||||
grp2 = dr.option1.Trim();
|
||||
|
||||
//한줄추가한다
|
||||
this.fpSpread1_Sheet1.Rows.Add(this.fpSpread1_Sheet1.RowCount, 1);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 0].Value = grp1;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 0].Value = grp1;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].Value = grp2;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].Value = dr.ItemSupply;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].Value = dr.amt;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
|
||||
sum = dr.amt;
|
||||
sum2 = dr.amt;
|
||||
first = false;
|
||||
@@ -87,11 +89,40 @@ namespace FPJ0000
|
||||
}
|
||||
else
|
||||
{
|
||||
if (grp1 != dr.ItemGroup)
|
||||
if (grp1 != dr.ItemGroup.Trim())
|
||||
{
|
||||
//소계를 추가한다
|
||||
|
||||
//소계항목이 남아있다면?
|
||||
if (grp2cnt > 1)
|
||||
{
|
||||
this.fpSpread1_Sheet1.Rows.Add(this.fpSpread1_Sheet1.RowCount, 1);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 0].Value = "";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].Value = "소계(" + grp2 + ")";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].Value = "";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].Value = sum2;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].BackColor = Color.FromArgb(240, 240, 240);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].BackColor = Color.FromArgb(240, 240, 240);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].BackColor = Color.FromArgb(240, 240, 240);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
|
||||
grp2cnt = 0;
|
||||
|
||||
//소분류가 변경되었으므로 처음 줄부터 지금 줄까지 스팬을 건다
|
||||
if (spanStart2 != -1)
|
||||
{
|
||||
var spanRows3 = (this.fpSpread1_Sheet1.RowCount - spanStart2 - 1);
|
||||
if (spanRows3 > 1)
|
||||
{
|
||||
this.fpSpread1_Sheet1.Cells[spanStart2, 1].RowSpan = spanRows3;
|
||||
this.fpSpread1_Sheet1.Cells[spanStart2, 1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//중분류 합계를 추가한다
|
||||
this.fpSpread1_Sheet1.Rows.Add(this.fpSpread1_Sheet1.RowCount, 1);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 0].Value = "소계(" + grp1 + ")";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 0].Value = "합계(" + grp1 + ")";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].Value = "";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].Value = "";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].Value = sum;
|
||||
@@ -109,12 +140,12 @@ namespace FPJ0000
|
||||
spanStart2 = this.fpSpread1_Sheet1.RowCount;
|
||||
sum = 0;
|
||||
sum2 = 0;
|
||||
grp1 = dr.ItemGroup;
|
||||
grp2 = dr.option1;
|
||||
grp1 = dr.ItemGroup.Trim();
|
||||
grp2 = dr.option1.Trim();
|
||||
|
||||
}
|
||||
|
||||
if (grp2 != dr.option1)
|
||||
if (grp2 != dr.option1.Trim())
|
||||
{
|
||||
//소계를 추가한다
|
||||
//그룹이 바뀌엇지만 항목이 1보다 클 때 처맇낟
|
||||
@@ -125,9 +156,10 @@ namespace FPJ0000
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].Value = "소계(" + grp2 + ")" ;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].Value = "";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].Value = sum2;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].BackColor = Color.FromArgb(220, 220, 220);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].BackColor = Color.FromArgb(220, 220, 220);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].BackColor = Color.FromArgb(220, 220, 220);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].BackColor = Color.FromArgb(240, 240, 240);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].BackColor = Color.FromArgb(240, 240, 240);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].BackColor = Color.FromArgb(240, 240, 240);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
|
||||
grp2cnt = 0;
|
||||
|
||||
//소분류가 변경되었으므로 처음 줄부터 지금 줄까지 스팬을 건다
|
||||
@@ -139,24 +171,22 @@ namespace FPJ0000
|
||||
this.fpSpread1_Sheet1.Cells[spanStart2, 1].RowSpan = spanRows3;
|
||||
this.fpSpread1_Sheet1.Cells[spanStart2, 1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
spanStart2 = this.fpSpread1_Sheet1.RowCount;
|
||||
sum2 = 0;
|
||||
grp2 = dr.option1;
|
||||
|
||||
grp2 = dr.option1.Trim();
|
||||
grp2cnt = 1;
|
||||
}
|
||||
else grp2cnt += 1;
|
||||
|
||||
this.fpSpread1_Sheet1.Rows.Add(this.fpSpread1_Sheet1.RowCount, 1);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 0].Value = grp1;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 0].Value = grp1;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].Value = grp2;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].Value = dr.ItemSupply;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].Value = dr.amt;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
|
||||
cnt++;
|
||||
|
||||
sum += dr.amt;
|
||||
sum2 += dr.amt;
|
||||
@@ -164,11 +194,39 @@ namespace FPJ0000
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//소계항목이 남아있다면?
|
||||
if (grp2cnt > 1)
|
||||
{
|
||||
this.fpSpread1_Sheet1.Rows.Add(this.fpSpread1_Sheet1.RowCount, 1);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 0].Value = "";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].Value = "소계(" + grp2 + ")";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].Value = "";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].Value = sum2;
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].BackColor = Color.FromArgb(240, 240, 240);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].BackColor = Color.FromArgb(240, 240, 240);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].BackColor = Color.FromArgb(240, 240, 240);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
|
||||
grp2cnt = 0;
|
||||
|
||||
//소분류가 변경되었으므로 처음 줄부터 지금 줄까지 스팬을 건다
|
||||
if (spanStart2 != -1)
|
||||
{
|
||||
var spanRows3 = (this.fpSpread1_Sheet1.RowCount - spanStart2 - 1);
|
||||
if (spanRows3 > 1)
|
||||
{
|
||||
this.fpSpread1_Sheet1.Cells[spanStart2, 1].RowSpan = spanRows3;
|
||||
this.fpSpread1_Sheet1.Cells[spanStart2, 1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//마지막 중분류 소계를 추가한다
|
||||
|
||||
this.fpSpread1_Sheet1.Rows.Add(this.fpSpread1_Sheet1.RowCount, 1);
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 0].Value = "소계(" + grp1 + ")";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 0].Value = "합계(" + grp1 + ")";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 1].Value = "";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].Value = "";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].Value = sum;
|
||||
@@ -184,6 +242,7 @@ namespace FPJ0000
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 2].Value = "";
|
||||
this.fpSpread1_Sheet1.Cells[this.fpSpread1_Sheet1.RowCount - 1, 3].Value = sum3;
|
||||
this.fpSpread1_Sheet1.Rows[this.fpSpread1_Sheet1.RowCount - 1].BackColor = Color.LightSkyBlue;
|
||||
|
||||
this.fpSpread1.ResumeLayout();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user