feat: fmSendSalaryStrip GridView 改用 ObjectDataSource

- SsmsDAC 新增 SelectSalaryStrip/SelectSalaryStripSum

- dsSSMS 改 ObjectDataSource;dsSSMSSum 移除,footer 改用 SsmsDAC
This commit is contained in:
2026-09-10 11:04:33 +08:00
parent b66279e5fa
commit 439e941268
4 changed files with 124 additions and 71 deletions
+8 -6
View File
@@ -69,12 +69,14 @@
OnClick="btnSSPYN_Click"></cc1:WButton></td>
</tr>
</table>
<asp:SqlDataSource ID="dsSSMS" runat="server"
ConnectionString="Data Source=(local);Initial Catalog=THINKYU_WEB;Persist Security Info=True;User ID=sa"
ProviderName="System.Data.SqlClient"></asp:SqlDataSource>
<asp:SqlDataSource ID="dsSSMSSum" runat="server"
ConnectionString="Data Source=(local);Initial Catalog=THINKYU_WEB;Persist Security Info=True;User ID=sa"
ProviderName="System.Data.SqlClient"></asp:SqlDataSource>
<asp:ObjectDataSource ID="dsSSMS" runat="server"
TypeName="SsmsDAC" SelectMethod="SelectSalaryStrip">
<SelectParameters>
<asp:Parameter Name="tableName" Type="String" />
<asp:Parameter Name="SSYMM" Type="DateTime" />
<asp:Parameter Name="SSPYN" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:Button ID="btnSend" runat="server" OnClick="btnSend_Click"
Text="S.發送" CssClass="button" AccessKey="S"
OnClientClick='if (confirm("是否確定發送薪資單郵件?")) {ShowProcessing(2000); return true;} else return false;' />
+21 -63
View File
@@ -50,42 +50,6 @@ public partial class forms_worker_fmSendSalaryStrip : Wellan.Web.UI.WUserControl
LEFT OUTER JOIN BPSNView B ON A.SSENO=B.BPENO
LEFT OUTER JOIN BPAA C ON A.SSPYN=C.BPPYN
LEFT OUTER JOIN BRML D ON B.BPBNK=D.BCNUM";
private string selectSum =
@"SELECT ISNULL(SUM(SSD01), 0) SSD01, ISNULL(SUM(SSD02), 0) SSD02, ISNULL(SUM(SSSRD), 0) SSSRD, ISNULL(SUM(SSP00), 0) SSP00,
ISNULL(SUM(SSP01), 0) SSP01, ISNULL(SUM(SSP02), 0) SSP02, ISNULL(SUM(SSP03), 0) SSP03, ISNULL(SUM(SSP04), 0) SSP04,
ISNULL(SUM(SSP05), 0) SSP05, ISNULL(SUM(SSP06), 0) SSP06, ISNULL(SUM(SSP07), 0) SSP07, ISNULL(SUM(SSP08), 0) SSP08,
ISNULL(SUM(SSP09), 0) SSP09, ISNULL(SUM(SSP10), 0) SSP10, ISNULL(SUM(SSP11), 0) SSP11, ISNULL(SUM(SSP12), 0) SSP12,
ISNULL(SUM(SSP13), 0) SSP13, ISNULL(SUM(SSP14), 0) SSP14, ISNULL(SUM(SSP15), 0) SSP15, ISNULL(SUM(SSP99), 0) SSP99,
ISNULL(SUM(SSS01), 0) SSS01, ISNULL(SUM(SSS02), 0) SSS02, ISNULL(SUM(SSS03), 0) SSS03, ISNULL(SUM(SSS04), 0) SSS04,
ISNULL(SUM(SSS05), 0) SSS05, ISNULL(SUM(SSS06), 0) SSS06, ISNULL(SUM(SSS07), 0) SSS07, ISNULL(SUM(SSS08), 0) SSS08,
ISNULL(SUM(SSS09), 0) SSS09, ISNULL(SUM(SSS10), 0) SSS10, ISNULL(SUM(SSS11), 0) SSS11, ISNULL(SUM(SSS12), 0) SSS12,
ISNULL(SUM(SSS13), 0) SSS13, ISNULL(SUM(SSS14), 0) SSS14, ISNULL(SUM(SSS15), 0) SSS15, ISNULL(SUM(SSS99), 0) SSS99,
ISNULL(SUM(SSH01), 0) SSH01, ISNULL(SUM(SSH02), 0) SSH02, ISNULL(SUM(SSH03), 0) SSH03, ISNULL(SUM(SSH04), 0) SSH04,
ISNULL(SUM(SSH05), 0) SSH05, ISNULL(SUM(SSH06), 0) SSH06, ISNULL(SUM(SSH07), 0) SSH07, ISNULL(SUM(SSH08), 0) SSH08,
ISNULL(SUM(SSH09), 0) SSH09, ISNULL(SUM(SSH10), 0) SSH10, ISNULL(SUM(SST01), 0) SST01, ISNULL(SUM(SST02), 0) SST02,
ISNULL(SUM(SST03), 0) SST03, ISNULL(SUM(SST04), 0) SST04, ISNULL(SUM(SST05), 0) SST05, ISNULL(SUM(SST06), 0) SST06,
ISNULL(SUM(SST07), 0) SST07, ISNULL(SUM(SST08), 0) SST08, ISNULL(SUM(SST09), 0) SST09, ISNULL(SUM(SST10), 0) SST10,
ISNULL(SUM(SST11), 0) SST11, ISNULL(SUM(SST12), 0) SST12, ISNULL(SUM(SST13), 0) SST13, ISNULL(SUM(SST14), 0) SST14,
ISNULL(SUM(SST15), 0) SST15, ISNULL(SUM(SST16), 0) SST16, ISNULL(SUM(SST17), 0) SST17, ISNULL(SUM(SST18), 0) SST18,
ISNULL(SUM(SST19), 0) SST19, ISNULL(SUM(SST20), 0) SST20, ISNULL(SUM(SST21), 0) SST21, ISNULL(SUM(SST22), 0) SST22,
ISNULL(SUM(SST23), 0) SST23, ISNULL(SUM(SST24), 0) SST24, ISNULL(SUM(SST25), 0) SST25, ISNULL(SUM(SSL01), 0) SSL01,
ISNULL(SUM(SSL02), 0) SSL02, ISNULL(SUM(SSL03), 0) SSL03, ISNULL(SUM(SSL04), 0) SSL04, ISNULL(SUM(SSL05), 0) SSL05,
ISNULL(SUM(SSP06 + SSP07 + SSP08 + SSP13 + SSP14), 0) OVERWORK,
ISNULL(SUM(SSP09 + SSP10 + SSP12), 0) OUTGOING,
ISNULL(SUM(SSP00 + SSP01 + SSP02 + SSP03 + SSP04 + SSP05 + SSP06 + SSP07 + SSP08 + SSP09 + SSP10 + SSP11 + SSP12 +
SSP13 + SSP14 + SSP15 + SSP99), 0) SSPLUS,
ISNULL(SUM(SSS01 + SSS02 + SSS09), 0) LEAVING,
ISNULL(SUM(SST01 + SST02 + SST03 + SST21 + SST22), 0) OVERWORKTIME,
ISNULL(SUM((SSP00 + SSP01 + SSP02 + SSP03 + SSP04 + SSP05 + SSP06 + SSP07 + SSP08 + SSP09 + SSP10 + SSP11 + SSP12 +
SSP13 + SSP14 + SSP15 + SSP99)
- (SSS01 + SSS02 + SSS03 + SSS04 + SSS05 + SSS06 + SSS07 + SSS08 + SSS09 + SSS10 + SSS11 + SSS12 + SSS13 +
SSS14 + SSS15 + SSS99)), 0) SSTOTAL,
ISNULL(SUM(SSS01 + SSS02 + SSS04 + SSS05 + SSS06 + SSS07 + SSS08 + SSS09 + SSS10 + SSS11 + SSS12 + SSS13 + SSS14 +
SSS15 + SSS99), 0) SSMINUS,
ISNULL(SUM(SSP01 + SSP02 + SSP03 + SSP04 + SSP05 + SSP06 + SSP07 + SSP08 + SSP09 + SSP10 + SSP11 + SSP12 + SSP13 +
SSP14 + SSP15 + SSP99), 0) TOTALPLUS,
ISNULL(SUM(SSH01 + SSH02 + SSH03), 0) EMPLOYER
FROM {0} A WHERE SSYMM=@SSYMM AND SSPYN=@SSPYN";
protected void Page_Load(object sender, EventArgs e)
{
@@ -102,11 +66,6 @@ public partial class forms_worker_fmSendSalaryStrip : Wellan.Web.UI.WUserControl
if (_BonusTimes == "")
_BonusTimes = "0";
dsSSMS.ConnectionString = ConnectionString;
dsSSMSSum.ConnectionString = ConnectionString;
dsSSMS.SelectCommand = String.Format(select, _tableName) + " WHERE SSYMM=@SSYMM AND SSPYN=@SSPYN ORDER BY SSENO ";
dsSSMSSum.SelectCommand = String.Format(selectSum, _tableName);
if (ForwardSource != "")
{
MultiView1.ActiveViewIndex = 1;
@@ -140,10 +99,9 @@ public partial class forms_worker_fmSendSalaryStrip : Wellan.Web.UI.WUserControl
_SSYMM = _SSYMM.AddDays(i);
s = _SSYMM.ToString(WGuard1.InvariantCulture);
dsSSMS.SelectParameters.Add("SSYMM", s);
dsSSMS.SelectParameters.Add("SSPYN", ddlSSPYN.SelectedValue);
dsSSMSSum.SelectParameters.Add("SSYMM", s);
dsSSMSSum.SelectParameters.Add("SSPYN", ddlSSPYN.SelectedValue);
dsSSMS.SelectParameters["tableName"].DefaultValue = _tableName;
dsSSMS.SelectParameters["SSYMM"].DefaultValue = s;
dsSSMS.SelectParameters["SSPYN"].DefaultValue = ddlSSPYN.SelectedValue;
if (_BonusTimes == "0")
{
@@ -582,42 +540,42 @@ public partial class forms_worker_fmSendSalaryStrip : Wellan.Web.UI.WUserControl
if (e.Row.RowType == DataControlRowType.Footer)
{
var param = new DataSourceSelectArguments();
var a = dsSSMSSum.Select(param) as DataView;
DataTable a = new SsmsDAC(Query).SelectSalaryStripSum(_tableName, _SSYMM, ddlSSPYN.SelectedValue);
DataRow ar = a.Rows[0];
e.Row.Cells[1].Text = "合計";
e.Row.Cells[1].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[2].Text = string.Format("{0:###,###,##0}", a[0]["SSP00"]); // 本薪
e.Row.Cells[2].Text = string.Format("{0:###,###,##0}", ar["SSP00"]); // 本薪
e.Row.Cells[2].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[3].Text = string.Format("{0:###,###,##0}", a[0]["SSP01"]); // 全勤獎金
e.Row.Cells[3].Text = string.Format("{0:###,###,##0}", ar["SSP01"]); // 全勤獎金
e.Row.Cells[3].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[4].Text = string.Format("{0:###,###,##0}", a[0]["OVERWORK"]);
e.Row.Cells[4].Text = string.Format("{0:###,###,##0}", ar["OVERWORK"]);
e.Row.Cells[4].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[5].Text = string.Format("{0:###,###,##0}", a[0]["OUTGOING"]);
e.Row.Cells[5].Text = string.Format("{0:###,###,##0}", ar["OUTGOING"]);
e.Row.Cells[5].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[6].Text = string.Format("{0:###,###,##0}", a[0]["SSP11"]);
e.Row.Cells[6].Text = string.Format("{0:###,###,##0}", ar["SSP11"]);
e.Row.Cells[6].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[7].Text = string.Format("{0:###,###,##0}", a[0]["SSP02"]);
e.Row.Cells[7].Text = string.Format("{0:###,###,##0}", ar["SSP02"]);
e.Row.Cells[7].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[8].Text = string.Format("{0:###,###,##0}", a[0]["SSP99"]);
e.Row.Cells[8].Text = string.Format("{0:###,###,##0}", ar["SSP99"]);
e.Row.Cells[8].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[9].Text = string.Format("{0:###,###,##0}", a[0]["SSP03"]);
e.Row.Cells[9].Text = string.Format("{0:###,###,##0}", ar["SSP03"]);
e.Row.Cells[9].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[10].Text = string.Format("{0:###,###,##0}", a[0]["SSP05"]);
e.Row.Cells[10].Text = string.Format("{0:###,###,##0}", ar["SSP05"]);
e.Row.Cells[10].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[12].Text = string.Format("{0:###,###,##0}", a[0]["SSPLUS"]);
e.Row.Cells[12].Text = string.Format("{0:###,###,##0}", ar["SSPLUS"]);
e.Row.Cells[12].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[13].Text = string.Format("{0:###,###,##0}", a[0]["LEAVING"]);
e.Row.Cells[13].Text = string.Format("{0:###,###,##0}", ar["LEAVING"]);
e.Row.Cells[13].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[14].Text = string.Format("{0:###,###,##0}", a[0]["SSS05"]);
e.Row.Cells[14].Text = string.Format("{0:###,###,##0}", ar["SSS05"]);
e.Row.Cells[14].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[15].Text = string.Format("{0:###,###,##0}", a[0]["SSS04"]);
e.Row.Cells[15].Text = string.Format("{0:###,###,##0}", ar["SSS04"]);
e.Row.Cells[15].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[16].Text = string.Format("{0:###,###,##0}", a[0]["SSS07"]);
e.Row.Cells[16].Text = string.Format("{0:###,###,##0}", ar["SSS07"]);
e.Row.Cells[16].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[17].Text = string.Format("{0:###,###,##0}", a[0]["SSS06"]);
e.Row.Cells[17].Text = string.Format("{0:###,###,##0}", ar["SSS06"]);
e.Row.Cells[17].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[18].Text = string.Format("{0:###,###,##0}", a[0]["SSS99"]);
e.Row.Cells[18].Text = string.Format("{0:###,###,##0}", ar["SSS99"]);
e.Row.Cells[18].HorizontalAlign = HorizontalAlign.Center;
}
}