车辆调度管理系统开发(九)

1、今日完成任务:

(1)结算明细:统计某年内单月所有车辆费用明细信息,可以生成报表

(2)单车月结算:记录所有车辆单月派车详细信息,统计车辆某月营业额、总公里数、邮费、过桥费、停车费、修理费、轮胎费、工资、毛利润等信息

(3)单车查询:按车牌号码统计该车所有派车单与月结算单信息,并生成报表

a.默认显示派车单的内容。

b.有派车单和月结算两个标签 ,用户点击“派车单”,显示某个车牌号码所有派车的相关信息,月结单信息隐藏;相应的,点击“月结算”标签,某个车牌号码的对应月结算信息显示,所有派车信息隐藏。

(4)已收款明细:按所属用车单位统计已收款的派车单信息,可以生成报表
(5)未收款明细:按所属用车单位统计未收款或未结清的派车单信息,可以生成报表

(6)车补贴查询:按出车日期统计驾驶员所获得补贴信息,可以生成报表

2、核心源码:

  1   protected void Import(object sender, EventArgs e)
  2     {
  3         if (dt.Rows.Count > 0)
  4         {
  5             string strFileName = "";
  6             try
  7             {
  8                 //创建工作薄
  9                 HSSFWorkbook wk = new HSSFWorkbook();
 10                 //创建一个名称为mySheet的表
 11                 ISheet tb = wk.CreateSheet("结算明细");
 12                 IRow row0 = tb.CreateRow(0);
 13                 ICell
 14                 cell0 = row0.CreateCell(0); cell0.SetCellValue("序号");
 15                 cell0 = row0.CreateCell(2); cell0.SetCellValue("营业额");
 16                 cell0 = row0.CreateCell(3); cell0.SetCellValue("总公里数");
 17                 cell0 = row0.CreateCell(4); cell0.SetCellValue("油费");
 18                 cell0 = row0.CreateCell(5); cell0.SetCellValue("过桥费");
 19                 cell0 = row0.CreateCell(6); cell0.SetCellValue("停车费");
 20                 cell0 = row0.CreateCell(7); cell0.SetCellValue("修理费");
 21                 cell0 = row0.CreateCell(8); cell0.SetCellValue("轮胎费");
 22                 cell0 = row0.CreateCell(9); cell0.SetCellValue("车补贴");
 23 
 24                 for (int j = 1; j <= dt.Rows.Count; j++)
 25                 {
 26                     IRow row = tb.CreateRow(j);
 27                     ICell cell;
 28                     cell = row.CreateCell(0); cell.SetCellValue(j.ToString());
 29                     cell = row.CreateCell(1); cell.SetCellValue(dt.Rows[j - 1]["sum(ReceivedFee)"].ToString());
 30                     cell = row.CreateCell(2); cell.SetCellValue(dt.Rows[j - 1]["sum(Mileage)"].ToString());
 31                     cell = row.CreateCell(3); cell.SetCellValue(dt.Rows[j - 1]["sum(OilCost)"].ToString());
 32                     cell = row.CreateCell(4); cell.SetCellValue(dt.Rows[j - 1]["sum(BridgeFee)"].ToString());
 33                     cell = row.CreateCell(5); cell.SetCellValue(dt.Rows[j - 1]["sum(ParkFee)"].ToString());
 34                     cell = row.CreateCell(6); cell.SetCellValue(dt.Rows[j - 1]["sum(RepairFee)"].ToString());
 35                     cell = row.CreateCell(7); cell.SetCellValue(dt.Rows[j - 1]["sum(TireCost)"].ToString());
 36                     cell = row.CreateCell(8); cell.SetCellValue(dt.Rows[j - 1]["sum(CarSubsidy)"].ToString());
 37                 }
 38                 ////创建一行,此行为第二行
 39 
 40                 string filename = Operations.datetime();
 41                 string path = Server.MapPath("~");
 42                 strFileName = path + "Download\" + filename + ".xls";
 43                 using (FileStream fs = File.OpenWrite(strFileName)) //打开一个xls文件,如果没有则自行创建,如果存在myxls.xls文件则在创建是不要打开该文件!
 44                 {
 45                     wk.Write(fs);   //向打开的这个xls文件中写入mySheet表并保存。
 46                     //  WebMessageBox.Show("已导出到:"+"c:\" + Operation.datetime() + ".xls");
 47                     fs.Close();
 48                     Response.Clear();
 49                     Response.ClearHeaders();
 50                     Response.Buffer = false;
 51                     Response.ContentType = "application/octet-stream";
 52                     Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename + ".xls");
 53                     Response.WriteFile(strFileName);
 54                     Response.Flush();
 55                     Response.End();
 56                 }
 57 
 58             }
 59 
 60             catch (Exception ex)
 61             {
 62 
 63                 WebMessageBox.Show(ex.Message);
 64             }
 65         }
 66     }
 67 
 68 
 69 
 70  private string bindcid(DataTable dt)
 71     {
 72 
 73         StringBuilder sb = new StringBuilder();
 74         sb.Append("<table border='0' cellpadding='5' cellspacing='0' class='r_con_table'><thead>");
 75         sb.Append("<tr><td nowrap='nowrap'>序号</td>");
 76         sb.Append("<td nowrap='nowrap'>营业额</td>");
 77         sb.Append("<td nowrap='nowrap'>总公里数</td>");
 78         sb.Append("<td nowrap='nowrap'>油费</td>");
 79         sb.Append("<td nowrap='nowrap'>过桥费</td>");
 80         sb.Append("<td nowrap='nowrap'>停车费</td>");
 81         sb.Append("<td nowrap='nowrap'>修理费</td>");
 82         sb.Append("<td nowrap='nowrap'>轮胎费</td>");
 83         sb.Append("<td nowrap='nowrap'>车补贴</td>");
 84         for (int i = (Convert.ToInt32(lblCurrentPage.Text) - 1) * 10; i < Convert.ToInt32(lblCurrentPage.Text) * 10 && i < dt.Rows.Count; i++)
 85         {
 86             sb.Append("<tr><td nowrap='nowrap'>" + (i + 1).ToString() + "</td>");
 87             sb.Append("<td nowrap='nowrap'> " + dt.Rows[i]["sum(ReceivedFee)"].ToString() + "</td>");
 88             sb.Append("<td nowrap='nowrap'> " + dt.Rows[i]["sum(Mileage)"].ToString() + "</td>");
 89             sb.Append("<td nowrap='nowrap'>" + dt.Rows[i]["sum(OilCost)"].ToString() + "</td>");
 90             sb.Append("<td nowrap='nowrap'>" + dt.Rows[i]["sum(BridgeFee)"].ToString() + "</td>");
 91             sb.Append("<td nowrap='nowrap'>" + dt.Rows[i]["sum(ParkFee)"].ToString() + "</td>");
 92             sb.Append("<td nowrap='nowrap'>" + dt.Rows[i]["sum(RepairFee)"].ToString() + "</td>");
 93             sb.Append("<td nowrap='nowrap'>" + dt.Rows[i]["sum(TireCost)"].ToString() + "</td>");
 94             sb.Append("<td nowrap='nowrap'>" + dt.Rows[i]["sum(CarSubsidy)"].ToString() + "</td>");
 95 
 96         }
 97         sb.Append("</tbody></table>");
 98         Label3.Text = sb.ToString();
 99         return sb.ToString();
100     }
View Code
单车查询的两个标签切换效果的jquery 代码:
 1 <script type="text/javascript">
 2     $(function () {
 3         $("#SelSettle").hide();
 4         $("#SelectByNum").show();
 5         $("#Label1").hide();
 6         $("#Labe3").show();
 7         $(".myyear").hide();
 8         $(".mymonth").hide();
 9         $("#LinkButton1").hide();
10         $("#LinkButton4").show();  
11         $(".form_datetime").datetimepicker({
12             format: "yyyy",
13             autoclose: true,
14             startView: 4,
15             minView: 4,
16             todayHighlight: true
17         });
18         $(".settle").click(function () {
19             $("#SelSettle").show();
20             $("#SelectByNum").hide();
21             $("#Label3").hide();
22             $("#Label1").show();
23             $(".myyear").show();
24             $(".mymonth").show();
25             $("#LinkButton1").show();
26             $("#LinkButton4").hide();
27         });
28         $(".send").click(function () {
29             $("#SelSettle").hide();
30             $("#SelectByNum").show();
31             $("#Label1").hide();
32             $("#Label3").show();
33             $(".myyear").hide();
34             $(".mymonth").hide();
35             $("#LinkButton1").hide();
36             $("#LinkButton4").show();            
37         });
38     });
39 </script>
View Code

3、遇到的问题:

暂无

4、解决的方法:

暂无 

5.截图

 

 

 

 

 

原文地址:https://www.cnblogs.com/yxgzdn/p/13489499.html