Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
public partial class SupplierPrice : MyPage
{
protected void Page_Load(object sender, EventArgs e)
{
this.UCBeginDate.SelectDateTime = DateTime.Now.AddDays(1);
this.UCEndTime.SelectDateTime = DateTime.Now.AddDays(10);
MySession.CheckSession();
CheckPermission(PermissionHelper.PermissionCode.Offer);
hfSupplierID.Value = MySession.UserSupplierGroup.ToString();
DataRow drLast = Sdbo.ExecuteDataRow("SELECT TOP 1 A.PostTime,B.NickName FROM Supplier.PriceSheet A INNER JOIN Permission.UserInfo B ON A.CreateBy=B.UserID WHERE A.SupplierID='{0}' ORDER BY A.PostTime DESC", MySession.UserSupplierGroup);
if (drLast == null)
{
//lblLastPriceDate.Text = "无";
}
else
{
//lblLastPriceDate.Text = String.Format("{0} 提交于 {1}", drLast["NickName"], ((DateTime)drLast["PostTime"]).ToString("yyyy-MM-dd HH:mm:ss"));
}
//先看看临时表中有无该供应商的报价信息
DataTable dt = Sdbo.ExecuteDataTableProc("msp_GetSupplierPriceList", MySession.UserSupplierGroup);
DataRow drls = Sdbo.ExecuteDataRow("select * from Supplier.PriceSheetLS where SupplierID='{0}'", MySession.UserSupplierGroup);
StringBuilder sb = new StringBuilder();
if (drls == null)
{
foreach (DataRow dr in dt.Rows)
{
sb.Append("<tr>");
sb.Append(String.Format("<td>{0}</td>", dr["GoodsName"]));
sb.Append(String.Format("<td>{0}</td>", dr["Unit"]));
sb.Append(String.Format("<td>{0}</td>", dr["Price"]));
sb.Append(String.Format("<td goodsID='{0}' price='{1}'></td>", dr["GoodsID"], dr["Price"]));
sb.Append("<td class='center'></td>");
sb.Append("</tr>");
}
}
else
{
this.lbTSXX.Text = "提示:此次新报价为暂存数据,请进行提交";
//获取临时表的数据
DataTable dtLS = Sdbo.ExecuteDataTableProc("msp_GetSupplierPriceListLS", MySession.UserSupplierGroup);
foreach (DataRow dr in dt.Rows)
{
string nowprice = "0.00";
DataRow[] drsLast = dtLS.Select(String.Format("GoodsID='{0}'", dr["GoodsID"]));//获得临时表中的报价
if (drsLast != null)
{
nowprice = drsLast[0]["Price"].ToString();
}
sb.Append("<tr>");
sb.Append(String.Format("<td>{0}</td>", dr["GoodsName"]));
sb.Append(String.Format("<td>{0}</td>", dr["Unit"]));
sb.Append(String.Format("<td>{0}</td>", dr["Price"]));
sb.Append(String.Format("<td goodsID='{0}' price='{1}'></td>", dr["GoodsID"], nowprice));
sb.Append("<td class='center'></td>");
sb.Append("</tr>");
}
}
lblData.Text = sb.ToString();
BindHistory();
}
private void BindHistory()
{
string sql = @" select top 5 BeginTime,EndTime from Supplier.PriceSheet where BeginTime is not null and SupplierID='" + MySession.UserSupplierGroup + "' order by PostTime desc ";
DataTable dt = Sdbo.ExecuteDataTable(sql);
this.ddlHistoryTime.Items.Clear();
for (int i = 0; i < dt.Rows.Count; i++)
{
ddlHistoryTime.Items.Add(new ListItem(Convert.ToDateTime(dt.Rows[i]["BeginTime"]).AddDays(1).ToString("yyyy-MM-dd") + "到" + Convert.ToDateTime(dt.Rows[i]["EndTime"]).AddDays(1).ToString("yyyy-MM-dd"), ""));
}
}
}