bug fixed
This commit is contained in:
@@ -19,6 +19,7 @@ namespace rmutr_report.Controllers
|
||||
{
|
||||
this._setting = setting;
|
||||
}
|
||||
|
||||
[HttpPost, Route("reports/teaching_fee_extra/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetTeachingFeeExtraReport([FromRoute] string type,
|
||||
@@ -197,52 +198,75 @@ namespace rmutr_report.Controllers
|
||||
foreach (var teaching in _teaching_fee_extra.data)
|
||||
{
|
||||
var countrow = teaching.datadetail.Count;
|
||||
if (teaching.course != "รวมทั้งสิ้น")
|
||||
{
|
||||
ws.Cell(row, 2).Value = teaching.course;
|
||||
ws.Cell(row, 3).Value = null;
|
||||
ws.Cell(row, 4).Value = teaching.number_of_hours1;
|
||||
ws.Cell(row, 5).Value = teaching.number_of_weeks1;
|
||||
ws.Cell(row, 6).Value = teaching.amount1;
|
||||
ws.Cell(row, 7).Value = teaching.number_of_hours2;
|
||||
ws.Cell(row, 8).Value = teaching.number_of_weeks2;
|
||||
ws.Cell(row, 9).Value = teaching.amount2;
|
||||
ws.Cell(row, 10).Value = teaching.total_amount;
|
||||
//ws.Range(ws.Cell(row, col), ws.Cell(row+x+1, col)).Merge().Value = teaching.major;
|
||||
if (countrow == 1)
|
||||
{
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + x, col)).Merge().Value = teaching.major;
|
||||
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row, col)).Merge().Value = teaching.major;
|
||||
}
|
||||
|
||||
if (countrow == 2)
|
||||
{
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + y, col)).Merge().Value = teaching.major;
|
||||
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + 1, col)).Merge().Value = teaching.major;
|
||||
}
|
||||
|
||||
if (countrow == 3)
|
||||
{
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + z, col)).Merge().Value = teaching.major;
|
||||
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + 2, col)).Merge().Value = teaching.major;
|
||||
}
|
||||
|
||||
if (countrow == 4)
|
||||
{
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + 4, col)).Merge().Value = teaching.major;
|
||||
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + 3, col)).Merge().Value = teaching.major;
|
||||
}
|
||||
|
||||
if (countrow == 5)
|
||||
{
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + 5, col)).Merge().Value = teaching.major;
|
||||
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + 4, col)).Merge().Value = teaching.major;
|
||||
}
|
||||
|
||||
if (countrow == 6)
|
||||
{
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + 5, col)).Merge().Value = teaching.major;
|
||||
}
|
||||
|
||||
if (countrow == 7)
|
||||
{
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + 6, col)).Merge().Value = teaching.major;
|
||||
}
|
||||
if (countrow == 8)
|
||||
{
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + 7, col)).Merge().Value = teaching.major;
|
||||
}
|
||||
if (countrow == 9)
|
||||
{
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + 8, col)).Merge().Value = teaching.major;
|
||||
}
|
||||
if (countrow == 10)
|
||||
{
|
||||
ws.Range(ws.Cell(row, col), ws.Cell(row + 9, col)).Merge().Value = teaching.major;
|
||||
}
|
||||
foreach (var datadetail in teaching.datadetail)
|
||||
{
|
||||
if (datadetail.course != "รวมทั้งสิ้น")
|
||||
{
|
||||
ws.Cell(row, 2).Value = datadetail.course;
|
||||
ws.Cell(row, 3).Value = null;
|
||||
ws.Cell(row, 4).Value = datadetail.number_of_hours1;
|
||||
ws.Cell(row, 5).Value = datadetail.number_of_weeks1;
|
||||
ws.Cell(row, 6).Value = datadetail.amount1;
|
||||
ws.Cell(row, 7).Value = datadetail.number_of_hours2;
|
||||
ws.Cell(row, 8).Value = datadetail.number_of_weeks2;
|
||||
ws.Cell(row, 9).Value = datadetail.amount2;
|
||||
ws.Cell(row, 10).Value = datadetail.total_amount;
|
||||
//ws.Range(ws.Cell(row, col), ws.Cell(row+x+1, col)).Merge().Value = teaching.major;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontName =
|
||||
"TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.Vertical =
|
||||
XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.Bold = true;
|
||||
//ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.Bold = true;
|
||||
if (datadetail.is_color == true)
|
||||
{
|
||||
ws.Cell(row, 2).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||
ws.Cell(row, 3).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||
ws.Cell(row, 4).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||
@@ -253,6 +277,24 @@ namespace rmutr_report.Controllers
|
||||
ws.Cell(row, 9).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||
ws.Cell(row, 10).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
||||
ws.Cell(row, 11).Style.Fill.BackgroundColor = XLColor.White;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.Bold = true;
|
||||
}
|
||||
|
||||
if (datadetail.is_color == false)
|
||||
{
|
||||
ws.Cell(row, 2).Style.Fill.BackgroundColor = XLColor.White;
|
||||
ws.Cell(row, 3).Style.Fill.BackgroundColor = XLColor.White;
|
||||
ws.Cell(row, 4).Style.Fill.BackgroundColor = XLColor.White;
|
||||
ws.Cell(row, 5).Style.Fill.BackgroundColor = XLColor.White;
|
||||
ws.Cell(row, 6).Style.Fill.BackgroundColor = XLColor.White;
|
||||
ws.Cell(row, 7).Style.Fill.BackgroundColor = XLColor.White;
|
||||
ws.Cell(row, 8).Style.Fill.BackgroundColor = XLColor.White;
|
||||
ws.Cell(row, 9).Style.Fill.BackgroundColor = XLColor.White;
|
||||
ws.Cell(row, 10).Style.Fill.BackgroundColor = XLColor.White;
|
||||
ws.Cell(row, 11).Style.Fill.BackgroundColor = XLColor.White;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.Bold = false;
|
||||
}
|
||||
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 10)).Style.Border.RightBorder =
|
||||
@@ -271,18 +313,64 @@ namespace rmutr_report.Controllers
|
||||
row++;
|
||||
}
|
||||
|
||||
if (teaching.course == "รวมทั้งสิ้น")
|
||||
// else if (datadetail.is_color == false && datadetail.course != "รวมทั้งสิ้น")
|
||||
// {
|
||||
// ws.Cell(row, 2).Value = datadetail.course;
|
||||
// ws.Cell(row, 3).Value = null;
|
||||
// ws.Cell(row, 4).Value = datadetail.number_of_hours1;
|
||||
// ws.Cell(row, 5).Value = datadetail.number_of_weeks1;
|
||||
// ws.Cell(row, 6).Value = datadetail.amount1;
|
||||
// ws.Cell(row, 7).Value = datadetail.number_of_hours2;
|
||||
// ws.Cell(row, 8).Value = datadetail.number_of_weeks2;
|
||||
// ws.Cell(row, 9).Value = datadetail.amount2;
|
||||
// ws.Cell(row, 10).Value = datadetail.total_amount;
|
||||
// //ws.Range(ws.Cell(row, col), ws.Cell(row+x+1, col)).Merge().Value = teaching.major;
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontName =
|
||||
// "TH SarabunPSK";
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontSize = 16;
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.Vertical =
|
||||
// XLAlignmentVerticalValues.Center;
|
||||
// //ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.Bold = true;
|
||||
// ws.Cell(row, 2).Style.Fill.BackgroundColor = XLColor.White;
|
||||
// ws.Cell(row, 3).Style.Fill.BackgroundColor = XLColor.White;
|
||||
// ws.Cell(row, 4).Style.Fill.BackgroundColor = XLColor.White;
|
||||
// ws.Cell(row, 5).Style.Fill.BackgroundColor = XLColor.White;
|
||||
// ws.Cell(row, 6).Style.Fill.BackgroundColor = XLColor.White;
|
||||
// ws.Cell(row, 7).Style.Fill.BackgroundColor = XLColor.White;
|
||||
// ws.Cell(row, 8).Style.Fill.BackgroundColor = XLColor.White;
|
||||
// ws.Cell(row, 9).Style.Fill.BackgroundColor = XLColor.White;
|
||||
// ws.Cell(row, 10).Style.Fill.BackgroundColor = XLColor.White;
|
||||
// ws.Cell(row, 11).Style.Fill.BackgroundColor = XLColor.White;
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.OutsideBorder =
|
||||
// XLBorderStyleValues.Thin;
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 10)).Style.Border.RightBorder =
|
||||
// XLBorderStyleValues.Thin;
|
||||
// ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
// ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
// ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Range(ws.Cell(row, 4), ws.Cell(row, 10)).Style.NumberFormat.SetFormat("#,#");
|
||||
// row++;
|
||||
// }
|
||||
else if (datadetail.course == "รวมทั้งสิ้น")
|
||||
{
|
||||
//ws.Cell(row2, 2).Value = datadetail.teacher;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 3)).Merge().Value = teaching.course;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 3)).Merge().Value = datadetail.course;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 3)).Merge();
|
||||
ws.Cell(row, 4).Value = teaching.number_of_hours1;
|
||||
ws.Cell(row, 5).Value = teaching.number_of_weeks1;
|
||||
ws.Cell(row, 6).Value = teaching.amount1;
|
||||
ws.Cell(row, 7).Value = teaching.number_of_hours2;
|
||||
ws.Cell(row, 8).Value = teaching.number_of_weeks2;
|
||||
ws.Cell(row, 9).Value = teaching.amount2;
|
||||
ws.Cell(row, 10).Value = teaching.total_amount;
|
||||
ws.Cell(row, 4).Value = datadetail.number_of_hours1;
|
||||
ws.Cell(row, 5).Value = datadetail.number_of_weeks1;
|
||||
ws.Cell(row, 6).Value = datadetail.amount1;
|
||||
ws.Cell(row, 7).Value = datadetail.number_of_hours2;
|
||||
ws.Cell(row, 8).Value = datadetail.number_of_weeks2;
|
||||
ws.Cell(row, 9).Value = datadetail.amount2;
|
||||
ws.Cell(row, 10).Value = datadetail.total_amount;
|
||||
ws.Cell(row, 11).Value = null;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontName =
|
||||
"TH SarabunPSK";
|
||||
@@ -309,43 +397,39 @@ namespace rmutr_report.Controllers
|
||||
ws.Range(ws.Cell(row, 4), ws.Cell(row, 10)).Style.NumberFormat.SetFormat("#,#");
|
||||
row++;
|
||||
}
|
||||
foreach (var datadetail in teaching.datadetail)
|
||||
{
|
||||
|
||||
ws.Cell(row, 2).Value = datadetail.teacher;
|
||||
ws.Cell(row, 3).Value = datadetail.teaching_rate;
|
||||
ws.Cell(row, 4).Value = datadetail.number_of_hours1;
|
||||
ws.Cell(row, 5).Value = datadetail.number_of_weeks1;
|
||||
ws.Cell(row, 6).Value = datadetail.amount1;
|
||||
ws.Cell(row, 7).Value = datadetail.number_of_hours2;
|
||||
ws.Cell(row, 8).Value = datadetail.number_of_weeks2;
|
||||
ws.Cell(row, 9).Value = datadetail.amount2;
|
||||
ws.Cell(row, 10).Value = datadetail.total_amount;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontName =
|
||||
"TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.Vertical =
|
||||
XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 10)).Style.Border.RightBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 4), ws.Cell(row, 10)).Style.NumberFormat.SetFormat("#,#");
|
||||
row++;
|
||||
|
||||
// ws.Cell(row, 2).Value = datadetail.course;
|
||||
// ws.Cell(row, 3).Value = datadetail.teaching_rate;
|
||||
// ws.Cell(row, 4).Value = datadetail.number_of_hours1;
|
||||
// ws.Cell(row, 5).Value = datadetail.number_of_weeks1;
|
||||
// ws.Cell(row, 6).Value = datadetail.amount1;
|
||||
// ws.Cell(row, 7).Value = datadetail.number_of_hours2;
|
||||
// ws.Cell(row, 8).Value = datadetail.number_of_weeks2;
|
||||
// ws.Cell(row, 9).Value = datadetail.amount2;
|
||||
// ws.Cell(row, 10).Value = datadetail.total_amount;
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontName =
|
||||
// "TH SarabunPSK";
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontSize = 16;
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.Vertical =
|
||||
// XLAlignmentVerticalValues.Center;
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.OutsideBorder =
|
||||
// XLBorderStyleValues.Thin;
|
||||
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 10)).Style.Border.RightBorder =
|
||||
// XLBorderStyleValues.Thin;
|
||||
// ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
// ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Range(ws.Cell(row, 4), ws.Cell(row, 10)).Style.NumberFormat.SetFormat("#,#");
|
||||
// row++;
|
||||
}
|
||||
|
||||
}
|
||||
// foreach (var teaching in _teaching_fee_extra.data)
|
||||
// {
|
||||
@@ -476,7 +560,6 @@ namespace rmutr_report.Controllers
|
||||
// row++;
|
||||
// //row2++;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
|
||||
@@ -15,21 +15,22 @@ namespace rmutr_report.Models
|
||||
|
||||
public class teaching_fee_extra_detail
|
||||
{
|
||||
public string course { get; set; }
|
||||
public decimal? number_of_hours1 { get; set; }
|
||||
public decimal? number_of_weeks1 { get; set; }
|
||||
public decimal? amount1 { get; set; }
|
||||
public decimal? number_of_hours2 { get; set; }
|
||||
public decimal? number_of_weeks2 { get; set; }
|
||||
public decimal? amount2 { get; set; }
|
||||
public decimal? total_amount { get; set; }
|
||||
// public string course { get; set; }
|
||||
// public decimal? number_of_hours1 { get; set; }
|
||||
// public decimal? number_of_weeks1 { get; set; }
|
||||
// public decimal? amount1 { get; set; }
|
||||
// public decimal? number_of_hours2 { get; set; }
|
||||
// public decimal? number_of_weeks2 { get; set; }
|
||||
// public decimal? amount2 { get; set; }
|
||||
// public decimal? total_amount { get; set; }
|
||||
public string major { get; set; }
|
||||
public List<teaching_fee_extra_datadetail> datadetail { get; set; }
|
||||
}
|
||||
|
||||
public class teaching_fee_extra_datadetail
|
||||
{
|
||||
public string teacher { get; set; }
|
||||
public bool? is_color { get; set; }
|
||||
public string course { get; set; }
|
||||
public string teaching_rate { get; set; }
|
||||
public decimal? number_of_hours1 { get; set; }
|
||||
public decimal? number_of_weeks1 { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user