migrate to new git

This commit is contained in:
2025-08-29 01:27:25 +08:00
parent 946eb9961e
commit af2c152ef6
8623 changed files with 1000453 additions and 1 deletions

View File

@@ -0,0 +1,303 @@
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" EnableEventValidation="false" CodeFile="index.aspx.cs" Inherits="admin_accounting_index" %>
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
<div class="mb-2 mb-sm-0">
<a href="news_reg.aspx" class="btn btn-primary">
<i class="mdi mdi-plus"></i>新增
</a>
<%-- <a @click="deleteAll" class="btn btn-outline-danger" title="刪除勾選的資料" ><i class="mdi mdi-trash-can"></i> 刪除勾選</a>--%>
</div>
<div class="">
<asp:LinkButton ID="excel" runat="server" CssClass="btn btn-outline-success" OnClick="excel_Click"><span class="fa-solid fa-file-excel"></span> 匯出Excel</asp:LinkButton>
</div>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" runat="Server">
<%--<link href="<%=ResolveUrl("~/js/vuetify_ez.css")%>" rel="stylesheet" />--%>
<script>
Vue.filter('timeString', function (value, myFormat) {
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
});
let VueApp=new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
options: { multiSort: false },
data_table: {
loading: true,
list: [],
selected: [],
singleSelect: false,
count: 0,
page: 1,
pageSize: 10,
header: [
//
{ text: '單據日期', value: 'uptime', },
{ text: '收支類別', value: 'category_Txt'},
{ text: '收支帳戶', value: 'kinds2Txt'},
{ text: '收支項目', value: 'kindsTxt'},
{ text: '未稅金額', value: 'price' },
{ text: '稅額', value: 'tax' },
{ text: '總額', value: 'total' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' },
],
footer:{
showFirstLastPage: true,
itemsPerPageOptions:[5,10,20,30],
},
},
search: {
kind: '',
kind2: '',
uptime1: '',
uptime2: '',
category: '',
activity_num_txt: '',
mem_num_txt: '',
debtor: '',
},
order_total_price: 0,
order_total_tax: 0,
order_amount: 0,
}
},
watch: {
options: {
handler() {
this.getDefault()
},
deep: true,
},
},
methods: {
getDefault(clearpage = false) {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: itemsPerPage
};
this.data_table.loading = true
this.order_total_price = 0;
this.order_total_tax = 0;
this.order_amount = 0;
axios
.post(HTTP_HOST + 'api/accounting/GetList', this.search, { params: params })
.then(response => {
this.data_table.list = response.data.list
this.data_table.count = response.data.count;
this.data_table.loading = false
if (this.data_table.list.length > 0) {
for (var i = 0; i < this.data_table.list.length; i++) {
if (this.data_table.list[i].category == 1) //收入
this.order_total_price += parseInt(this.data_table.list[i].price);
else if (this.data_table.list[i].category == 2) //支出
this.order_total_price -= parseInt(this.data_table.list[i].price);
//this.order_total_tax += parseInt(this.data_table.list[i].tax);
if (this.data_table.list[i].category == 1) //收入
this.order_amount += parseInt(this.data_table.list[i].total);
else if (this.data_table.list[i].category == 2) //支出
this.order_amount -= parseInt(this.data_table.list[i].total);
}
}
})
.catch(error => console.log(error))
},
editItem(item) {
console.log("edit", item);
},
deleteItem(item) {
if (confirm('是否確定刪除此筆資料?')) {
const index = this.data_table.list.indexOf(item)
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/accounting/' + item.num)
.then(response => {
console.log("del", item);
this.data_table.list.splice(index, 1);
this.data_table.count = this.data_table.list.length
})
.catch(error => console.log(error))
}
}
},
deleteAll() {
if (confirm('是否確定刪除已勾選的資料?')) {
axios
.delete(HTTP_HOST + 'api/accounting/Delete/' + this.data_table.selected.map(x => x.num))
.then(response => {
//console.log("delAll");
//for (var i = 0; i < this.data_table.selected.length; i++) {
// const index = this.data_table.list.indexOf(this.data_table.selected[i]);
// this.data_table.list.splice(index, 1);
//}
//this.data_table.selected = [];
//this.data_table.count = this.data_table.list.length
location.reload();
})
.catch(error => console.log(error))
}
},
btn_search() {
this.getDefault(true)
},
btn_all() {
clearObjProps(this.search);
this.btn_search()
},
},
computed: {
pageCount() {
return Math.ceil(this.data_table.count / this.data_table.pageSize)
},
},
filters: {
currency: function (value) {
return value == null || value === "" ? "" :
('$' + parseFloat(value).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").replace(".00", ""));
},
}
})
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<uc1:alert runat="server" ID="L_msg" Text="" />
<div id="content" class="container-md">
<v-data-table
v-model="data_table.selected"
:items="data_table.list"
:search-props="search"
item-key="num"
:options.sync="options"
:headers="data_table.header"
:footer-props="data_table.footer"
:server-items-length="data_table.count"
:loading="data_table.loading"
:single-select="data_table.singleSelect"
show-select
hide-default-footer
:page.sync="data_table.page"
:items-per-page.sync="data_table.pageSize"
class="elevation-1">
<template #item.uptime="{ item }" >
{{ item.uptime|timeString('YYYY/MM/DD') }}
</template>
<template v-slot:item.price="{ item }">
{{item.price | currency }}
</template>
<template v-slot:item.tax="{ item }">
{{item.tax | currency }}
</template>
<template v-slot:item.total="{ item }">
{{item.total | currency }}
</template>
<template #item.slot_btn="{ item }">
<a :href="'news_reg.aspx?num='+item.num" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-magnify"></i>查看</a>
<%-- <a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a> --%>
</template>
<template v-slot:body.append>
<tr>
<td colspan="4" ></td>
<td class="text-start">合計</td>
<td class="text-start"> {{order_total_price | currency }}</td>
<td class="text-start"> </td>
<td class="text-start"> {{order_amount | currency }}</td>
</tr>
</template>
</v-data-table>
<v-container>
<v-row class="align-baseline" wrap>
<v-col cols="12" md="9">
<v-pagination
v-model="data_table.page"
:length="pageCount">
</v-pagination>
</v-col>
<v-col class="text-truncate text-right" cols="12" md="2">
共 {{ data_table.count }} 筆, 頁數:
</v-col>
<v-col cols="6" md="1">
<v-text-field
v-model="data_table.page"
type="number"
hide-details
dense
min="1"
:max="pageCount"
@input="data_table.page = parseInt($event, 10)"
></v-text-field>
</v-col>
</v-row>
</v-container>
</div>
<div id="print_data">
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" runat="Server">
<div id="search_panel" alt="查詢公告資料">
<div class="mb-3">
<label class="form-label">單據日期</label>
<div class="input-group">
<asp:TextBox ID="s_uptime1" runat="server" TextMode="Date" CssClass="form-control" autocomplete="off" v-model="search.uptime1"></asp:TextBox>
<span class="input-group-text">~</span>
<asp:TextBox ID="s_uptime2" runat="server" TextMode="Date" CssClass="form-control" autocomplete="off" v-model="search.uptime2"></asp:TextBox>
</div>
</div>
<div class="mb-3">
<label class="form-label">收支類別</label>
<asp:DropDownList ID="s_category" runat="server" CssClass="form-select" v-model="search.category" >
<asp:ListItem Value="" Text="請選擇"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="mb-3">
<label class="form-label">收支帳戶</label>
<asp:DropDownList ID="s_kind2" runat="server" CssClass="form-select" v-model="search.kind2" >
<asp:ListItem Value="" Text="請選擇"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="mb-3">
<label class="form-label">收支項目</label>
<asp:DropDownList ID="s_kind" runat="server" CssClass="form-select" v-model="search.kind" >
<asp:ListItem Value="" Text="請選擇"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="mb-3">
<label class="form-label">相關活動</label>
<input type="text" v-model="search.activity_num_txt" class="form-control" placeholder="可輸入關鍵字查詢">
</div>
<div class="mb-3">
<label class="form-label">內部負責人 </label>
<input type="text" v-model="search.mem_num_txt" class="form-control" placeholder="可輸入關鍵字查詢">
</div>
<div class="mb-3">
<label class="form-label">外部負責人 </label>
<input type="text" v-model="search.debtor" class="form-control" placeholder="可輸入關鍵字查詢">
</div>
<div class="mb-3 p-2 border-top">
<a @click="btn_search" class="btn btn-outline-primary"><i class="mdi mdi-filter"></i> 搜尋</a>
<a class="btn btn-outline-secondary" @click="btn_all"><i class="mdi mdi-filter-remove"></i> 所有資料</a>
</div>
</div>
</asp:Content>

View File

@@ -0,0 +1,156 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.IO;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Spreadsheet;
using System.Linq;
public partial class admin_accounting_index : MyWeb.config
{
private Model.ezEntities _db = new Model.ezEntities();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InitEnumsOptions<Model.accounting.type>(s_category); //收支類別
BuildKind();
}
}
#region
public void BuildKind()
{
s_kind.Items.Clear();
s_kind.Items.Add(new ListItem("請選擇", ""));
buildMultiKind(s_kind, "accounting_kind", 0, "", 1, Model.accounting.KindLevelMax);
s_kind2.Items.Clear();
s_kind2.Items.Add(new ListItem("請選擇", ""));
buildMultiKind(s_kind2, "accounting_kind2", 0, "", 1, Model.accounting.KindLevelMax);
}
#endregion
#region Excel
protected void excel_Click(object sender, EventArgs e)
{
var memoryStream = new MemoryStream();
using (var doc = SpreadsheetDocument.Create(memoryStream, SpreadsheetDocumentType.Workbook))
{
var wb = doc.AddWorkbookPart();
wb.Workbook = new Workbook();
var sheets = wb.Workbook.AppendChild(new Sheets());
//建立第一個頁籤
var ws = wb.AddNewPart<WorksheetPart>();
ws.Worksheet = new Worksheet();
sheets.Append(new Sheet()
{
Id = wb.GetIdOfPart(ws),
SheetId = 1,
Name = "收支"
});
//設定欄寬
var cu = new Columns();
cu.Append(
new Column { Min = 1, Max = 1, Width = 15, CustomWidth = true },
new Column { Min = 2, Max = 4, Width = 10, CustomWidth = true },
new Column { Min = 5, Max = 5, Width = 20, CustomWidth = true },
new Column { Min = 6, Max = 7, Width = 10, CustomWidth = true }
);
ws.Worksheet.Append(cu);
//建立資料頁
var sd = new SheetData();
ws.Worksheet.AppendChild(sd);
//第一列資料
var tr = new Row();
tr.Append(
new Cell() { CellValue = new CellValue("單據日期"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("收支類別"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("收支帳戶"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("收支項目"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("未稅金額"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("稅額"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue("總額"), DataType = CellValues.String }
);
sd.AppendChild(tr);
//查詢要匯出的資料
var qry = _db.accountings.AsEnumerable();
if (!isStrNull(s_category.SelectedValue))
qry = qry.Where(o => o.category == Convert.ToInt32(s_category.SelectedValue));
if (!isStrNull(s_kind.SelectedValue))
qry = qry.Where(o => o.kind == Convert.ToInt32(s_kind.SelectedValue));
if (!isStrNull(s_kind2.SelectedValue))
qry = qry.Where(o => o.kind2 == Convert.ToInt32( s_kind2.SelectedValue));
if (!isStrNull(s_uptime1.Text) && isDate(s_uptime1.Text))
qry = qry.Where(o => o.uptime >= Convert.ToDateTime(s_uptime1.Text));
if (!isStrNull(s_uptime2.Text) && isDate(s_uptime2.Text))
qry = qry.Where(o => o.uptime < Convert.ToDateTime(s_uptime2.Text).AddDays(1));
qry = qry.OrderByDescending(o => o.num);
var list = qry.ToList();
if (list.Count > 0)
{
foreach (var item in list)
{
//新增資料列
tr = new Row();
tr.Append(
new Cell() { CellValue = new CellValue(item.uptime.HasValue? item.uptime.Value.ToString("yyyy/MM/dd"):""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.category.HasValue ? GetEnumsDescription((Model.accounting.type)Val(item.category.Value)):""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.kind2.HasValue ? item.accounting_kind2.kind : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.kind.HasValue ? item.accounting_kind.kind : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.price.HasValue ? ValMoney(item.price.Value) : "0"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.tax.HasValue ? ValMoney(item.tax.Value) : "0"), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(ValMoney((item.price.HasValue ? item.price.Value : 0) +(item.tax.HasValue ? item.tax.Value : 0))), DataType = CellValues.String }
);
sd.AppendChild(tr);
}
}
//儲存文件(如果有要儲實體的檔案在upload才需要)
//wb.Workbook.Save();
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Accounting, (int)Model.admin_log.Status.Excel, admin_log.LogViewBtn(list.Select(x => (x.uptime.HasValue ? x.uptime.Value.ToString("yyyy/MM/dd") : "") + (x.kind2.HasValue ? x.accounting_kind2.kind : "")).ToList()));
}
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=收支.xlsx");
HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
HttpContext.Current.Response.BinaryWrite(memoryStream.ToArray());
HttpContext.Current.Response.End();
}
#endregion
}

View File

@@ -0,0 +1,90 @@
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="kind_reg.aspx.cs" Inherits="admin_accounting_kind_reg" %>
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
<asp:Content ID="Content1" ContentPlaceHolderID="footer_script" runat="Server">
<link href="../../App_Script/bootstrap_toggle/css/bootstrap-toggle.min.css" rel="stylesheet" />
<script src="../../App_Script/bootstrap_toggle/js/bootstrap-toggle.min.js"></script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
<nav class="mb-1">
<asp:LinkButton ID="ImageButton4" runat="server" CausesValidation="False" OnClick="ImageButton4_Click" CssClass="btn btn-primary"><i class="mdi mdi-plus"></i> 新增主分類</asp:LinkButton>
</nav>
<nav class="mb-1">
<asp:Button ID="edit" runat="server" Text="修改" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary" />
<asp:Button ID="add" runat="server" Text="新增" Visible="false" OnClick="add_Click" CssClass="btn btn-primary" />
<asp:PlaceHolder ID="down_table" runat="server">
<asp:LinkButton ID="ImageButton5" runat="server" OnClick="ImageButton5_Click" CssClass="btn btn-outline-secondary" CausesValidation="False"><i class="mdi mdi-arrow-down-right"></i> 建立下一層選項</asp:LinkButton>
<asp:LinkButton ID="ImageButton6" runat="server" OnClientClick="return msgconfirm('是否確定刪除這筆資料?<br>注意!資料刪除後將一併刪除此資料的子選項!',this);" OnClick="ImageButton6_Click" CssClass="btn btn-outline-secondary"><i class="mdi mdi-trash-can"></i> 刪除</asp:LinkButton>
</asp:PlaceHolder>
</nav>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<uc1:alert runat="server" ID="L_msg" Text="" />
<div id="content" class="container-fluid pb-4">
<div class="row">
<div class="col-sm-4">
<div class="card shadow-sm my-2" id="sec1">
<div class="card-header">選擇分類</div>
<div class="card-body">
<asp:TreeView ID="TreeView2" runat="server" CssClass="aspxTree" ImageSet="Arrows"
SkipLinkText="" ShowLines="false" EnableTheming="False" ShowExpandCollapse="True">
</asp:TreeView>
</div>
</div>
</div>
<div class="col-sm-8">
<asp:Panel ID="table" runat="server" CssClass="card shadow-sm my-2">
<div class="card-header">
<div>
<asp:Label ID="start" runat="server" CssClass="text-danger" Display="Dynamic"></asp:Label>
</div>
<div>
<asp:Label ID="title_msg" runat="server" CssClass="" ForeColor=""></asp:Label>
</div>
</div>
<div class="card-body form-horizontal label-sm-right " role="form">
<div>
<div class="form-text text-muted">以下 * 欄位為必填欄位</div>
</div>
<div class="row mb-1">
<label class="col-sm-2 col-lg-3 col-form-label">* 分類名稱</label>
<div class="col-sm-10 col-lg-9">
<asp:TextBox ID="item_name" runat="server" CssClass="form-control" MaxLength="100" placeholder="請輸入分類名稱"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="item_name" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row mb-1">
<label class="col-sm-2 col-lg-3 col-form-label">會計科目編號</label>
<div class="col-sm-10 col-lg-9">
<asp:TextBox ID="title" runat="server" CssClass="form-control" MaxLength="100" placeholder="請輸入會計科目編號"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="title" Visible="false" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row mb-1">
<label class="col-sm-2 col-lg-3 col-form-label">備註</label>
<div class="col-sm-10 col-lg-9">
<asp:TextBox ID="demo" runat="server" CssClass="form-control" TextMode="MultiLine" Rows="3" placeholder="請輸入備註"></asp:TextBox>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-md-offset-2 col-sm-9 col-md-10">
<asp:HiddenField ID="HiddenField1" runat="server" />
</div>
</div>
</div>
</asp:Panel>
</div>
</div>
</div>
</asp:Content>

View File

@@ -0,0 +1,312 @@
using System;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Linq;
using System.Data.Entity.Infrastructure;
public partial class admin_accounting_kind_reg : MyWeb.config
{
DataTable treeDt = new DataTable();
const int LevelMax = Model.accounting.KindLevelMax; //分類層數
private Model.ezEntities _db = new Model.ezEntities();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) {
BuildTreeView();
if (!isStrNull(Request["num"]))
{
int _num = Val(Request["num"]);
var prod = _db.accounting_kind.AsEnumerable().Where(q => q.num == _num).OrderBy(q => q.kind).FirstOrDefault();
if (prod != null)
{
title_msg.Text = "修改<span class=\"text-primary\">【" + prod.kind + "】</span>的分類名稱";
item_name.Text = prod.kind;
title.Text = prod.title;
demo.Text = prod.demo;
HiddenField1.Value = prod.kind;
}
else
{
Response.Redirect(Request.Url.AbsolutePath );
}
edit.Visible = true;
add.Visible = false;
down_table.Visible = true;
start.Visible = false;
}
else
{
table.Visible = false;
down_table.Visible = false;
if (Convert.ToString(Request["msg"]) == "A") { start.Text = "【資料修改成功】"; }
else if (Convert.ToString(Request["msg"]) == "B") { start.Text = "【資料新增成功】"; }
else if (Convert.ToString(Request["msg"]) == "C") { start.Text = "【資料刪除成功】"; }
else { start.Text = "【請點選下方欲新增、修改或刪除的分類】"; }
}
}
}
#region
protected void TreeTopology()
{
MyWeb.sql sql = new MyWeb.sql();
OleDbConnection sqlConn = sql.conn(db, p_name);
try
{
sqlConn.Open();
OleDbCommand sqlCmd = new OleDbCommand("", sqlConn);
sqlCmd.CommandText = "SELECT num,kind,root FROM accounting_kind ORDER BY kind,root, range";
treeDt = sql.dataTable(sqlCmd);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
sqlConn.Close();
sqlConn.Dispose();
}
}
public void BuildTreeView()
{
TreeView2.Nodes.Clear();
TreeTopology();
BuildChild(0, TreeView2.Nodes);
treeDt.Dispose();
}
public void BuildChild(int RootUid, TreeNodeCollection Nodes, int Level=1)
{
DataTable dt = treeDt;
foreach (DataRow row in dt.Rows)
{
if (row["root"].ToString() == RootUid.ToString())
{
TreeNode NewNode = new TreeNode();
if (Convert.ToString(Request["num"]) == row["num"].ToString() & HiddenField1.Value != "AddMainItem")
{
NewNode.Text = "<b><span style=\"color:blue\">" + row["kind"].ToString() + "</span></b>";
if (Level +1 > LevelMax)
{
ImageButton5.Visible = false;
}
}
else
{
NewNode.Text = row["kind"].ToString();
}
NewNode.NavigateUrl = Request.Url.AbsolutePath + "?num=" + row["num"].ToString() ;
NewNode.Expand();
Nodes.Add(NewNode);
if (Level + 1 <= LevelMax)
{
BuildChild((int)row["num"], NewNode.ChildNodes, Level + 1);
}
}
}
}
#endregion
#region
protected void ImageButton5_Click(object sender, EventArgs e)
{
title_msg.Text = "於<span class=\"text-primary\">【" + HiddenField1.Value + "】</span>分類下,新增次分類";
item_name.Text = "";
title.Text = "";
demo.Text = "";
add.Visible = true;
edit.Visible = false;
down_table.Visible = false;
start.Visible = false;
}
protected void ImageButton4_Click(object sender, EventArgs e)
{
title_msg.Text = "<span class=\"text-primary\">於根目錄下,新增主分類</span>";
table.Visible = true;
item_name.Text = "";
title.Text = "";
demo.Text = "";
add.Visible = true;
edit.Visible = false;
down_table.Visible = false;
start.Visible = false;
HiddenField1.Value = "AddMainItem";
BuildTreeView();
}
#endregion
#region
protected void edit_Click(object sender, EventArgs e)
{
L_msg.Text = "";
int _num = Val(Request["num"]);
try
{
Model.accounting_kind accounting_kind = _db.accounting_kind.Where(q => q.num == _num).FirstOrDefault();//修改
if (accounting_kind != null)
{
accounting_kind.kind = item_name.Text;
accounting_kind.title = title.Text;
accounting_kind.demo = demo.Text;
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Accounting, (int)Model.admin_log.Status.Update, "分類(收支項目)" + item_name.Text);
L_msg.Type = alert_type.success;
L_msg.Text = "操作成功";
}
else
{
L_msg.Type = alert_type.danger;
L_msg.Text = "無此資料";
}
}
catch (DbUpdateConcurrencyException)
{
L_msg.Type = alert_type.danger;
L_msg.Text = "Error";
throw;
}
BuildTreeView();
}
#endregion
#region
protected void add_Click(object sender, EventArgs e)
{
L_msg.Text = "";
int range = 1;
int root = 0;
if (HiddenField1.Value != "AddMainItem")
{
root = Convert.ToInt32(Request["num"]);
}
try
{
var prod = _db.accounting_kind.AsEnumerable().Where(q => q.root == root).OrderByDescending(q => q.range).FirstOrDefault();
if (prod != null)
if (prod.range.HasValue)
range = prod.range.Value + 1;
Model.accounting_kind accounting_kind = new Model.accounting_kind();//新增
accounting_kind.kind = item_name.Text;
accounting_kind.title = title.Text;
accounting_kind.root = root;
accounting_kind.range = range;
accounting_kind.demo = demo.Text;
_db.accounting_kind.Add(accounting_kind);
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Accounting, (int)Model.admin_log.Status.Insert, "分類(收支項目)" + item_name.Text);
L_msg.Type = alert_type.success;
L_msg.Text = "操作成功";
}
catch (DbUpdateConcurrencyException)
{
throw;
}
BuildTreeView();
}
#endregion
#region
protected void ImageButton6_Click(object sender, EventArgs e)
{
int num = Val(Request["num"]);
del_product(num);
var prod = _db.accounting_kind.AsEnumerable().Where(q => q.num == num).FirstOrDefault(); //刪除該筆資料
if (prod != null)
{
_db.accounting_kind.Remove(prod);
_db.SaveChanges(); //執行
}
Del_Ohter_Items(Val(Request["num"]));
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Accounting, (int)Model.admin_log.Status.Delete, "分類(收支項目)" + item_name.Text);
Response.Redirect(Request.Url.AbsolutePath + "?msg=C");
}
public void Del_Ohter_Items(int d_num)
{
var prod = _db.accounting_kind.AsEnumerable().Where(q => q.root == d_num).ToList();
if (prod.Count > 0)
{
foreach (var row in prod)
{
del_product(row.num);
Del_Ohter_Items(row.num);
}
//查詢結果全部刪除
_db.accounting_kind.RemoveRange(prod);
_db.SaveChanges();
}
}
public void del_product(int num)
{
var prod = _db.accountings.AsEnumerable().Where(q => q.kind == num).ToList();
if (prod.Count > 0)
{
////查詢結果全部刪除
//_db.accountings.RemoveRange(prod);
//_db.SaveChanges();
//清空分類
foreach (var item in prod)
item.kind = null;
_db.SaveChanges();
}
}
#endregion
}

View File

@@ -0,0 +1,116 @@
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="kind_reg2.aspx.cs" Inherits="admin_accounting_kind_reg2" %>
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
<asp:Content ID="Content1" ContentPlaceHolderID="footer_script" runat="Server">
<link href="../../App_Script/bootstrap_toggle/css/bootstrap-toggle.min.css" rel="stylesheet" />
<script src="../../App_Script/bootstrap_toggle/js/bootstrap-toggle.min.js"></script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
<nav class="mb-1">
<asp:LinkButton ID="ImageButton4" runat="server" CausesValidation="False" OnClick="ImageButton4_Click" CssClass="btn btn-primary"><i class="mdi mdi-plus"></i> 新增主分類</asp:LinkButton>
</nav>
<nav class="mb-1">
<asp:Button ID="edit" runat="server" Text="修改" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary" />
<asp:Button ID="add" runat="server" Text="新增" Visible="false" OnClick="add_Click" CssClass="btn btn-primary" />
<asp:PlaceHolder ID="down_table" runat="server">
<asp:LinkButton ID="ImageButton5" runat="server" OnClick="ImageButton5_Click" CssClass="btn btn-outline-secondary" CausesValidation="False"><i class="mdi mdi-arrow-down-right"></i> 建立下一層選項</asp:LinkButton>
<asp:LinkButton ID="ImageButton6" runat="server" OnClientClick="return msgconfirm('是否確定刪除這筆資料?<br>注意!資料刪除後將一併刪除此資料的子選項!',this);" OnClick="ImageButton6_Click" CssClass="btn btn-outline-secondary"><i class="mdi mdi-trash-can"></i> 刪除</asp:LinkButton>
</asp:PlaceHolder>
</nav>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<uc1:alert runat="server" ID="L_msg" Text="" />
<div id="content" class="container-md pb-4">
<div class="row">
<div class="col-sm-4">
<div class="card shadow-sm my-2" id="sec1">
<div class="card-header">選擇分類</div>
<div class="card-body">
<asp:TreeView ID="TreeView2" runat="server" CssClass="aspxTree" ImageSet="Arrows"
SkipLinkText="" ShowLines="false" EnableTheming="False" ShowExpandCollapse="True">
</asp:TreeView>
</div>
</div>
</div>
<div class="col-sm-8">
<asp:Panel ID="table" runat="server" CssClass="card shadow-sm my-2">
<div class="card-header">
<div>
<asp:Label ID="start" runat="server" CssClass="text-danger" Display="Dynamic"></asp:Label>
</div>
<div>
<asp:Label ID="title_msg" runat="server" CssClass="" ForeColor=""></asp:Label>
</div>
</div>
<div class="card-body form-horizontal label-sm-right " role="form">
<div>
<div class="form-text text-muted">以下 * 欄位為必填欄位</div>
</div>
<div class="row mb-1">
<label class="col-sm-2 col-lg-3 col-form-label">* 分類名稱</label>
<div class="col-sm-10 col-lg-9">
<asp:TextBox ID="item_name" runat="server" CssClass="form-control" MaxLength="100" placeholder="請輸入分類名稱"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="item_name" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row mb-1">
<label class="col-sm-2 col-lg-3 col-form-label">會計科目編號</label>
<div class="col-sm-10 col-lg-9">
<asp:TextBox ID="title" runat="server" CssClass="form-control" MaxLength="100" placeholder="請輸入會計科目編號"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="title" Visible="false" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row mb-1">
<label class="col-sm-2 col-lg-3 col-form-label">分行名稱</label>
<div class="col-sm-10 col-lg-9">
<asp:TextBox ID="bank_name" runat="server" CssClass="form-control" MaxLength="100" placeholder="請輸入分行名稱"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="bank_name" Visible="false" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row mb-1">
<label class="col-sm-2 col-lg-3 col-form-label">戶名</label>
<div class="col-sm-10 col-lg-9">
<asp:TextBox ID="bank_code" runat="server" CssClass="form-control" MaxLength="100" placeholder="請輸入戶名"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="bank_code" Visible="false" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row mb-1">
<label class="col-sm-2 col-lg-3 col-form-label">帳號</label>
<div class="col-sm-10 col-lg-9">
<asp:TextBox ID="bank_id" runat="server" CssClass="form-control" MaxLength="100" placeholder="請輸入帳號"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="bank_id" Visible="false" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row mb-1">
<label class="col-sm-2 col-lg-3 col-form-label"></label>
<div class="col-sm-10 col-lg-9">
<asp:CheckBox ID="record_payment" runat="server" Text="報名收款帳戶​" />
</div>
</div>
<div class="row mb-1">
<label class="col-sm-2 col-lg-3 col-form-label">備註</label>
<div class="col-sm-10 col-lg-9">
<asp:TextBox ID="demo" runat="server" CssClass="form-control" TextMode="MultiLine" Rows="3" placeholder="請輸入備註"></asp:TextBox>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-md-offset-2 col-sm-9 col-md-10">
<asp:HiddenField ID="HiddenField1" runat="server" />
</div>
</div>
</div>
</asp:Panel>
</div>
</div>
</div>
</asp:Content>

View File

@@ -0,0 +1,326 @@
using System;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Linq;
using System.Data.Entity.Infrastructure;
public partial class admin_accounting_kind_reg2 : MyWeb.config
{
DataTable treeDt = new DataTable();
const int LevelMax = Model.accounting.KindLevelMax2; //分類層數
private Model.ezEntities _db = new Model.ezEntities();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) {
BuildTreeView();
if (!isStrNull(Request["num"]))
{
int _num = Val(Request["num"]);
var prod = _db.accounting_kind2.AsEnumerable().Where(q => q.num == _num).FirstOrDefault();
if (prod != null)
{
title_msg.Text = "修改<span class=\"text-primary\">【" + prod.kind + "】</span>的分類名稱";
item_name.Text = prod.kind;
title.Text = prod.title;
bank_name.Text = prod.bank_name;
bank_code.Text = prod.bank_code;
bank_id.Text = prod.bank_id;
record_payment.Checked = !isStrNull(prod.record_payment) && prod.record_payment.Equals("Y");
demo.Text = prod.demo;
HiddenField1.Value = prod.kind;
}
else
{
Response.Redirect(Request.Url.AbsolutePath );
}
edit.Visible = true;
add.Visible = false;
down_table.Visible = true;
start.Visible = false;
}
else
{
table.Visible = false;
down_table.Visible = false;
if (Convert.ToString(Request["msg"]) == "A") { start.Text = "【資料修改成功】"; }
else if (Convert.ToString(Request["msg"]) == "B") { start.Text = "【資料新增成功】"; }
else if (Convert.ToString(Request["msg"]) == "C") { start.Text = "【資料刪除成功】"; }
else { start.Text = "【請點選下方欲新增、修改或刪除的分類】"; }
}
}
}
#region
protected void TreeTopology()
{
MyWeb.sql sql = new MyWeb.sql();
OleDbConnection sqlConn = sql.conn(db, p_name);
try
{
sqlConn.Open();
OleDbCommand sqlCmd = new OleDbCommand("", sqlConn);
sqlCmd.CommandText = "SELECT num,kind,root FROM accounting_kind2 ORDER BY kind,root, range";
treeDt = sql.dataTable(sqlCmd);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
sqlConn.Close();
sqlConn.Dispose();
}
}
public void BuildTreeView()
{
TreeView2.Nodes.Clear();
TreeTopology();
BuildChild(0, TreeView2.Nodes);
treeDt.Dispose();
}
public void BuildChild(int RootUid, TreeNodeCollection Nodes, int Level=1)
{
DataTable dt = treeDt;
foreach (DataRow row in dt.Rows)
{
if (row["root"].ToString() == RootUid.ToString())
{
TreeNode NewNode = new TreeNode();
if (Convert.ToString(Request["num"]) == row["num"].ToString() & HiddenField1.Value != "AddMainItem")
{
NewNode.Text = "<b><span style=\"color:blue\">" + row["kind"].ToString() + "</span></b>";
if (Level +1 > LevelMax)
{
ImageButton5.Visible = false;
}
}
else
{
NewNode.Text = row["kind"].ToString();
}
NewNode.NavigateUrl = Request.Url.AbsolutePath + "?num=" + row["num"].ToString() ;
NewNode.Expand();
Nodes.Add(NewNode);
if (Level + 1 <= LevelMax)
{
BuildChild((int)row["num"], NewNode.ChildNodes, Level + 1);
}
}
}
}
#endregion
#region
protected void ImageButton5_Click(object sender, EventArgs e)
{
title_msg.Text = "於<span class=\"text-primary\">【" + HiddenField1.Value + "】</span>分類下,新增次分類";
item_name.Text = "";
title.Text = "";
demo.Text = "";
bank_name.Text = "";
bank_code.Text = "";
bank_id.Text = "";
add.Visible = true;
edit.Visible = false;
down_table.Visible = false;
start.Visible = false;
record_payment.Checked = false;
}
protected void ImageButton4_Click(object sender, EventArgs e)
{
title_msg.Text = "<span class=\"text-primary\">於根目錄下,新增主分類</span>";
table.Visible = true;
item_name.Text = "";
title.Text = "";
demo.Text = "";
bank_name.Text = "";
bank_code.Text = "";
bank_id.Text = "";
record_payment.Checked =false;
add.Visible = true;
edit.Visible = false;
down_table.Visible = false;
start.Visible = false;
HiddenField1.Value = "AddMainItem";
BuildTreeView();
}
#endregion
#region
protected void edit_Click(object sender, EventArgs e)
{
L_msg.Text = "";
int _num = Val(Request["num"]);
try
{
Model.accounting_kind2 accounting_kind2 = _db.accounting_kind2.Where(q => q.num == _num).FirstOrDefault();//修改
if (accounting_kind2 != null)
{
accounting_kind2.kind = item_name.Text;
accounting_kind2.title = title.Text;
accounting_kind2.demo = demo.Text;
accounting_kind2.bank_name = bank_name.Text;
accounting_kind2.bank_code = bank_code.Text;
accounting_kind2.bank_id = bank_id.Text;
accounting_kind2.record_payment = record_payment.Checked?"Y":"";
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Accounting, (int)Model.admin_log.Status.Update, "分類(收支帳戶)" + item_name.Text);
L_msg.Type = alert_type.success;
L_msg.Text = "操作成功";
}
else
{
L_msg.Type = alert_type.danger;
L_msg.Text = "無此資料";
}
}
catch (DbUpdateConcurrencyException)
{
L_msg.Type = alert_type.danger;
L_msg.Text = "Error";
throw;
}
BuildTreeView();
}
#endregion
#region
protected void add_Click(object sender, EventArgs e)
{
L_msg.Text = "";
int range = 1;
int root = 0;
if (HiddenField1.Value != "AddMainItem")
{
root = Convert.ToInt32(Request["num"]);
}
try
{
var prod = _db.accounting_kind2.AsEnumerable().Where(q => q.root == root).OrderByDescending(q => q.range).FirstOrDefault();
if (prod != null)
if (prod.range.HasValue)
range = prod.range.Value + 1;
Model.accounting_kind2 accounting_kind2 = new Model.accounting_kind2();//新增
accounting_kind2.kind = item_name.Text;
accounting_kind2.title = title.Text;
accounting_kind2.root = root;
accounting_kind2.range = range;
accounting_kind2.demo = demo.Text;
accounting_kind2.bank_name = bank_name.Text;
accounting_kind2.bank_code = bank_code.Text;
accounting_kind2.bank_id = bank_id.Text;
accounting_kind2.record_payment = record_payment.Checked ? "Y" : "";
_db.accounting_kind2.Add(accounting_kind2);
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Accounting, (int)Model.admin_log.Status.Insert, "分類(收支帳戶)" + item_name.Text);
L_msg.Type = alert_type.success;
L_msg.Text = "操作成功";
}
catch (DbUpdateConcurrencyException)
{
throw;
}
BuildTreeView();
}
#endregion
#region
protected void ImageButton6_Click(object sender, EventArgs e)
{
int num = Val(Request["num"]);
del_product(num);
var prod = _db.accounting_kind2.AsEnumerable().Where(q => q.num == num).FirstOrDefault(); //刪除該筆資料
if (prod != null)
{
_db.accounting_kind2.Remove(prod);
_db.SaveChanges(); //執行
}
Del_Ohter_Items(Val(Request["num"]));
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Accounting, (int)Model.admin_log.Status.Delete, "分類(收支帳戶)" + item_name.Text);
Response.Redirect(Request.Url.AbsolutePath + "?msg=C");
}
public void Del_Ohter_Items(int d_num)
{
var prod = _db.accounting_kind2.AsEnumerable().Where(q => q.root == d_num).ToList();
if (prod.Count > 0)
{
foreach (var row in prod)
{
del_product(row.num);
Del_Ohter_Items(row.num);
}
//查詢結果全部刪除
_db.accounting_kind2.RemoveRange(prod);
_db.SaveChanges();
}
}
public void del_product(int num)
{
var prod = _db.accountings.AsEnumerable().Where(q => q.kind2 == num).ToList();
if (prod.Count > 0)
{
////查詢結果全部刪除
//_db.accountings.RemoveRange(prod);
//_db.SaveChanges();
//清空分類
foreach (var item in prod)
item.kind2 = null;
_db.SaveChanges();
}
}
#endregion
}

View File

@@ -0,0 +1,706 @@
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="news_reg.aspx.cs" Inherits="admin_accounting_new_reg" ValidateRequest="false" %>
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="footer_script" runat="Server">
<script>
let VueApp = new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
this_id: '<%= Request["num"] %>',
options: {},
optionsDetail: { multiSort: false },
search_dialog: {
controls: {
search1: {
id: 'search1',
title: '收支項目',
text_prop: 'kind',
value_prop: 'num',
keys: [
{ id: 'kind', title: '項目名稱', value: '' },
],
api_url: HTTP_HOST + 'api/accounting/GetTitleKindList',
columns: [
{ id: 'kind', title: '項目名稱', value: '' },
],
selected: {},
select(t) {
console.log("select search1", t);
}
}, search2: {
id: 'search2',
title: '收支帳戶',
text_prop: 'kind',
value_prop: 'num',
keys: [
{ id: 'kind', title: '帳戶名稱', value: '' },
],
api_url: HTTP_HOST + 'api/accounting/GetAccountKindList',
columns: [
{ id: 'kind', title: '帳戶名稱', value: ''},
],
selected: {},
select(t) {
console.log("select search2", t);
}
},
search3: {
id: 'search3',
title: '相關活動',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '活動名稱', value: '' },
{ id: 'kindTxt', title: '活動分類' },
],
api_url: HTTP_HOST + 'api/activity/GetList',
columns: [
{ id: 'subject', title: '活動名稱' },
{ id: 'kindTxt', title: '活動分類' },
],
selected: {},
select(t) {
console.log("select search3", t);
}
},
search4: {
id: 'search4',
title: '人員',
text_prop: 'u_name',
value_prop: 'num',
keys: [
{ id: 'm_number', title: '編號', value: '' },
{ id: 'u_name', title: '姓名', value: '' },
{ id: 'sex', title: '性別', value: '' },
],
api_url: HTTP_HOST + 'api/member/GetList',
columns: [
{ id: 'm_number', title: '編號' },
{ id: 'u_name', title: '姓名' },
{ id: 'sex', title: '性別' },
],
selected: {},
select(t) {
console.log("select search4", t);
}
},
},
show: false,
current: {},
list: [],
count: 0,
page:1,
loading: false,
footer: {
showFirstLastPage: true,
disableItemsPerPage: true,
itemsPerPageAllText: '',
itemsPerPageText:'',
},
},
snackbar: {
show: false,
text: "",
},
total: '<%= _t %>',
//檔案上傳
filePath: '<%= ResolveUrl( Model.accounting.Dir) %>/',
filerules: [
value => !value || value.size < 2000000 || '檔案限制 2 MB 以內',
value => !!value || '檔案必填',
],
searchDetail: '',
headersDetail: [
{ text: '檔案名稱', value: 'pic1', sortable: false },
{ text: '', value: 'actions', sortable: false, width: "200px" },
],
desserts: [],
desserts_count: 0,
editedIndex: -1,
editedItem: {
id: 0,
num: 0,
accounting_num: 0,
pic1: '',
pic1_name: '',
pic1push: [],
},
defaultItem: {
id: 0,
num: 0,
accounting_num: 0,
pic1: '',
pic1_name: '',
pic1push: [],
},
}
},
mounted() {
this.search_dialog.current = this.search_dialog.controls.search1
//console.log("mounted");
},
watch: {
options: {
handler() {
this.search_get()
console.log("watch2", this.search_dialog, this.search_dialog.page);
},
deep: true,
},
optionsDetail: {
handler() {
this.initialize();
},
deep: true,
},
},
methods: {
search_show(curr) {
//console.log("btn_click:", curr, curr.api_url);
this.search_dialog.current = curr;
this.search_clear()
//this.search_get()//清除完自動會重抓, 故取消
this.search_dialog.show = true;
},
search_clear() {
if (!this.search_dialog.current.keys) return;
this.search_dialog.current.keys.forEach((t, i) => { t.value = '' })
this.search_get()
},
search_get() {
if (!this.search_dialog.current.keys) return;
let api_url = this.search_dialog.current.api_url;
let keys = this.search_dialog.current.keys;
//const { page, itemsPerPage } = this.options
//const { sortBy, sortDesc, page, itemsPerPage } = this.options
this.search_dialog.page = this.options.page??1
let params = { page: this.search_dialog.page, pageSize: 10 };//url params
var search = {};//post body
keys.forEach((t, i) => {
search[t.id] = t.value;
});
console.log("search_get", api_url, search, params, this.options);
this.search_dialog.loading = true
axios.post(api_url, search, { params: params })
.then(response => {
this.search_dialog.list = response.data.list
this.search_dialog.count = response.data.count
this.search_dialog.loading = false
})
.catch(error => {
console.log(error)
this.search_dialog.list = []
this.search_dialog.count = 0
this.search_dialog.loading = false
this.snackbar.text = "錯誤:" + error
this.snackbar.show=true
})
},
search_headers() {
if (!this.search_dialog.current.columns) return;
r = [];
this.search_dialog.current.columns.forEach((t, i) => {
r.push({
text: t.title,
align: 'start',
sortable: false,
value: t.id,
})
})
return r
},
search_select(row) {
let curr = this.search_dialog.current;
let target = $(`[data-search-control=${curr.id}]`);
curr.selected = row;
target.children("input.search-text").val(curr.selected[curr.text_prop])//text
target.children("input:hidden").val(curr.selected[curr.value_prop])//value
if (curr.select instanceof Function) {
curr.select(row);
}
this.search_dialog.show = false;
},
initialize() {
if (this.this_id != '') {
const { sortBy, sortDesc, page, itemsPerPage } = this.optionsDetail
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: page, pageSize: itemsPerPage,
};
var searchItemDetail = {
accounting_num: this.this_id,
}
axios
.post(HTTP_HOST + 'api/accounting/GetAccFiles', searchItemDetail, { params: params })
.then(response => {
this.desserts = response.data.list
this.desserts_count = response.data.count
})
.catch(
error => console.log(error)
)
}
},
cancel() {
this.spliceNullData();
this.close();
},
spliceNullData() {
//if new data ,then splice it
if (this.editedItem.num == 0) {
for (var i = 0; i < this.desserts.map(x => x.id).length; i++) {
if (this.desserts[i].id == this.editedItem.id) {
this.desserts.splice(i, 1); break;
}
}
}
},
close() {
setTimeout(() => {
this.editedItem = $.extend(true, {}, this.defaultItem);
this.editedIndex = -1;
}, 300)
},
addNew() {
this.spliceNullData();
//addObj.id = this.desserts.length + 1;
var keysArr = [];
for (var i = 0; i < this.desserts.map(x => x.id).length; i++) {
//console.log(this.desserts[i].id)
keysArr.push(parseInt(this.desserts[i].id));
}
var _c = Math.max.apply(null, keysArr);
const addObj = $.extend(true, {}, this.defaultItem);
addObj.id = (isFinite(_c) ? _c : 0) + 1;
this.desserts.unshift(addObj);
this.editItem(addObj);
},
editItem(item) {
this.editedIndex = this.desserts.indexOf(item);
this.editedItem = $.extend(true, {}, item);
}, save() {
if (this.editedIndex > -1) {
if (this.this_id != '') {
if (this.editedItem.pic1push != null) {
var reader = new FileReader();
reader.onload = function (e) {
if (e.total <= 2000000) {
//上傳檔案
const formData = new FormData();
formData.append('file-to-upload', VueApp.editedItem.pic1push)
axios
.post(HTTP_HOST + 'api/accounting/uploadFiles', formData, {
Headers: {
'Content-Type': 'multipart/form-data'
}
})
.then(response => {
if (response.data != "") {
//寫入
var accounting_files = {
accounting_num: VueApp.this_id,
pic1: response.data,
pic1_name: VueApp.editedItem.pic1push.name,
}
axios
.post(HTTP_HOST + 'api/accounting/SaveFileData', accounting_files)
.then(response => {
VueApp.editedItem.num = response.data;
VueApp.editedItem.pic1 = accounting_files.pic1;
VueApp.editedItem.pic1_name = accounting_files.pic1_name;
Object.assign(VueApp.desserts[VueApp.editedIndex], VueApp.editedItem)
VueApp.close()
})
.catch(
error => console.log(error)
)
}
})
.catch(
error => {
console.log(error)
VueApp.snackbar.text = "錯誤:" + error.response.data.message
VueApp.snackbar.show = true
}
)
} else {
VueApp.snackbar.text = "檔案限制 2 MB 以內";
VueApp.snackbar.show = true
}
}
reader.readAsDataURL(this.editedItem.pic1push);
}
else {
this.snackbar.text = "請選擇檔案";
this.snackbar.show = true
}
} else {
this.snackbar.text = "庫存資料錯誤";
this.snackbar.show = true
}
}
},
deleteItem(item) {
if (confirm('確定要刪除此筆資料嗎?')) {
const index = this.desserts.indexOf(item);
if (item.num > 0) {
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/accounting/DeleteFilesItem/' + item.num)
.then(response => {
console.log("del", item);
this.desserts.splice(index, 1)
this.desserts_count = this.desserts_count - 1;
})
.catch(error => console.log(error))
}
} else {
this.desserts.splice(index, 1)
}
}
},
isPhoto(name) {
const n = name.split('.')[1];
const type = new Array("jpg", "jpeg", "gif", "png", "bmp");
return type.indexOf(n) > -1 ? true : false
},
},
computed: {
}, filters: {
currency: function (value) {
return value == null || value === "" ? "" :
('$' + parseFloat(value).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").replace(".00", ""));
},
}
})
$('#<%= price.ClientID %>').on("change", function () {
getTotalPrice();
})
$('#<%= tax.ClientID %>').on("change", function () {
getTotalPrice();
})
function getTotalPrice() {
const _pp = ($('#<%= price.ClientID %>').val() != null && $('#<%= price.ClientID %>').val() != "") ? parseFloat($('#<%= price.ClientID %>').val()) :0 ;
const _tt = ($('#<%= tax.ClientID %>').val() != null && $('#<%= tax.ClientID %>').val() != "") ? parseFloat($('#<%= tax.ClientID %>').val()) : 0;
let _tp = _pp + _tt;
_tp = ('$' + parseFloat(_tp).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").replace(".00", ""));
$('#totalPrice').text(_tp);
}
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
<div class="scroll-nav nav nav-tabs mb-2 mb-sm-0 d-none d-sm-flex">
</div>
<div class="">
<asp:Button ID="add" runat="server" Text="送出" OnClick="add_Click" CssClass="btn btn-primary" />
<asp:Button ID="edit" runat="server" Text="修改備註" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary" />
<asp:Button ID="goback" runat="server" Text="回列表" Visible="false" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" />
</div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<uc1:alert runat="server" ID="L_msg" Text="" />
<div id="content" class="container-md">
<div class="card shadow-sm my-3">
<div class="card-header py-0">
<nav class="navbar py-0">
<div class="nav nav-tabs">
<button class="nav-link active" id="sec2-tab1" data-bs-toggle="tab" data-bs-target="#sec2-page1"
type="button" role="tab" aria-controls="home" aria-selected="true">
收支管理</button>
<button class="nav-link" id="sec2-tab2" data-bs-toggle="tab" data-bs-target="#sec2-page2"
type="button" role="tab" aria-controls="profile" aria-selected="false">
檔案上傳</button>
</div>
</nav>
</div>
<asp:Panel ID="cardBodyPanel" runat="server" CssClass="card-body">
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active " id="sec2-page1" role="tabpanel" aria-labelledby="sec2-tab1">
<div>
<div class="form-text text-muted">以下 * 欄位為必填欄位</div>
</div>
<div class="row mb-1 label-sm-right " :class="{readonly : this_id !='' }">
<label class="col-sm-2 col-lg-1 col-form-label">單據日期 *</label>
<div class="col-sm-10 col-lg-3">
<asp:TextBox ID="uptime" runat="server" CssClass="form-control " TextMode="Date" autocomplete="off" data-date-format="yyyy-mm-dd"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" ControlToValidate="uptime" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">收支類別 *</label>
<div class="col-sm-10 col-lg-3">
<asp:DropDownList ID="category" CssClass="form-select" runat="server" data-int="Y">
<asp:ListItem Value="" Text="請選擇"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="category"
ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">收支帳戶 *</label>
<div class="col-sm-10 col-lg-3">
<div class="input-group mb-3" data-search-control="search2" @click="search_show(search_dialog.controls.search2)">
<input class="form-control search-text" type="text" readonly
id="kind2_txt" runat="server" placeholder="收支帳戶" value="">
<asp:HiddenField ID="kind2" runat="server" Value="" />
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="kind2_txt" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row mb-1 label-sm-right " :class="{readonly : this_id !='' }">
<label class="col-sm-2 col-lg-1 col-form-label">收支項目 *</label>
<div class="col-sm-10 col-lg-3">
<div class="input-group mb-3" data-search-control="search1" @click="search_show(search_dialog.controls.search1)">
<input class="form-control search-text" type="text" readonly
id="kind_txt" runat="server" placeholder="收支項目" value="">
<asp:HiddenField ID="kind" runat="server" Value="" />
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" ControlToValidate="kind_txt" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">相關活動</label>
<div class="col-sm-10 col-lg-3">
<div class="input-group mb-3" data-search-control="search3" @click="search_show(search_dialog.controls.search3)">
<input class="form-control search-text" type="text" readonly
id="activity_num_txt" runat="server" placeholder="相關活動" value="">
<asp:HiddenField ID="activity_num" runat="server" Value="" />
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</div>
</div>
<div class="row mb-1 label-sm-right " :class="{readonly : this_id !='' }">
<label class="col-sm-2 col-lg-1 col-form-label">未稅金額 *</label>
<div class="col-sm-10 col-lg-3">
<asp:TextBox ID="price" MaxLength="7" runat="server" CssClass="form-control" placeholder="請輸入未稅金額"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate="price" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ControlToValidate="price" Display="Dynamic" SetFocusOnError="true" ErrorMessage="只能輸入數字" ValidationGroup="Required" ID="RegularExpressionValidator3" runat="server" ValidationExpression="^(\d+)?$" />
</div>
<label class="col-sm-2 col-lg-1 col-form-label">稅額 *</label>
<div class="col-sm-10 col-lg-3">
<asp:TextBox ID="tax" MaxLength="7" runat="server" CssClass="form-control" placeholder="請輸入稅額"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" ControlToValidate="tax" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ControlToValidate="tax" Display="Dynamic" SetFocusOnError="true" ErrorMessage="只能輸入數字" ValidationGroup="Required" ID="RegularExpressionValidator1" runat="server" ValidationExpression="^(\d+)?$" />
</div>
<label class="col-sm-2 col-lg-1 col-form-label">總額</label>
<div class="col-sm-10 col-lg-3 pt-2">
<span id="totalPrice">{{total | currency}}</span>
</div>
</div>
<div class="row mb-1 label-sm-right " :class="{readonly : this_id !='' }">
<label class="col-sm-2 col-lg-1 col-form-label">內部負責人 *</label>
<div class="col-sm-10 col-lg-3">
<div class="input-group mb-3" data-search-control="search4" @click="search_show(search_dialog.controls.search4)">
<input class="form-control search-text" type="text" readonly
id="mem_num_txt" runat="server" placeholder="人員" value="" >
<asp:HiddenField ID="mem_num" runat="server" Value="" />
<button class="btn btn-outline-secondary" type="button" >
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="mem_num_txt"
ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">外部負責人</label>
<div class="col-sm-10 col-lg-3">
<asp:TextBox ID="debtor" MaxLength="20" runat="server" CssClass="form-control" placeholder="請輸入外部負責人"></asp:TextBox>
</div>
</div>
<hr />
<div class="row mb-1">
<label class="col-form-label">摘要</label>
<div class="">
<asp:TextBox ID="excerpt" runat="server" Rows="5" TextMode="MultiLine" CssClass="form-control" placeholder="請輸入摘要(可入傳票)"></asp:TextBox>
</div>
</div>
<hr />
<div class="row mb-1">
<label class="col-form-label">備註</label>
<div class="">
<asp:TextBox ID="demo" runat="server" Rows="5" TextMode="MultiLine" CssClass="form-control" placeholder="請輸入備註"></asp:TextBox>
</div>
</div>
<div class="row mb-1">
<asp:Panel ID="timePanel1" runat="server" CssClass="col-12 text-right text-primary" Visible="false">建檔時間:<asp:Literal ID="reg_time" runat="server"></asp:Literal></asp:Panel>
</div>
</div>
<div class="tab-pane fade giftItems label-sm-right" id="sec2-page2" role="tabpanel" aria-labelledby="sec2-tab2">
<v-card class="mx-auto mt-10" outlined v-if="this_id!=''">
<v-data-table
hide-default-header
:headers="headersDetail"
:items="desserts"
<%-- :search="searchDetail"--%>
:options.sync="optionsDetail" class="elevation-1" fixed-header height="550px"
<%-- :server-items-length="desserts_count"--%>
>
<v-divider inset></v-divider>
<template v-slot:top>
<v-toolbar flat color="white">
<div class="d-flex w-100">
<%--<v-text-field v-model="searchDetail" append-icon="mdi-magnify" label="查詢" dense outlined single-line hide-details></v-text-field>--%>
<v-btn
color="primary"
class="ml-2 white--text"
@click="addNew">
<v-icon dark>mdi-plus</v-icon>新增
</v-btn>
</div>
</v-toolbar>
<div class="form-text text-muted ml-5">檔案限制 2 MB 以內僅接受jpg、png、pdf格式</div>
</template>
<template v-slot:item.pic1="{ item }" :cols="12" >
<div class="input-group mb-3" v-if="item.id === editedItem.id">
<v-file-input v-model="editedItem.pic1push"
required :rules="filerules" accept="image/png, image/jpeg, application/pdf"
show-size label="請選擇檔案"
truncate-length="25">
</v-file-input>
</div>
<template v-else>
<template v-if="isPhoto(item.pic1)">
<a :href="filePath+item.pic1" target="_blank" >
<v-img
max-height="138"
max-width="250"
:lazy-src="filePath+item.pic1"
:src="filePath+item.pic1"
:alt="item.pic1_name"
></v-img>
</a>
</template>
<template v-else>
<v-btn
outlined color="primary" class="ma-2" elevation="3" download
:href="filePath+item.pic1"
>
{{item.pic1_name}}
<v-icon right dark >mdi-cloud-download</v-icon>
</v-btn>
</template>
</template>
</template>
<template v-slot:item.actions="{ item }">
<div v-if="item.id === editedItem.id">
<v-icon color="red" class="mr-3" @click="cancel">
mdi-window-close
</v-icon>
<v-icon color="green" @click="save">
mdi-content-save
</v-icon>
</div>
<div v-else>
<v-icon color="red" @click="deleteItem(item)">
mdi-delete
</v-icon>
</div>
</template>
</v-data-table>
</v-card>
<div class="mx-auto" v-else >
<p class="lead">請先儲存收支管理後再新增檔案上傳</p>
</div>
</div>
</div>
</asp:Panel>
</div>
<v-dialog v-model="search_dialog.show" max-width="500px">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
查詢:{{search_dialog.current.title}}
<v-btn icon @click="search_dialog.show=false"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text >
<v-row>
<v-col v-for="item in search_dialog.current.keys"
:cols="search_dialog.current.keys.length>1?6:12" >
<v-text-field v-model="item.value" :label="item.title"></v-text-field>
</v-col>
<v-col cols="12" class="text-end">
<v-btn color="primary" elevation="0" @click="search_get()">查詢</v-btn>
<v-btn elevation="0" @click="search_clear()">清除條件</v-btn>
</v-col>
</v-row>
<v-data-table
:headers="search_headers()"
:items="search_dialog.list"
:footer-props="search_dialog.footer"
:items-per-page="10"
:server-items-length="search_dialog.count"
:page.sync="search_dialog.page"
:options.sync="options"
@click:row="search_select"
></v-data-table>
</v-card-text>
<v-card-actions>
</v-card-actions>
</v-card>
</v-dialog>
<v-snackbar
v-model="snackbar.show"
timeout="2000"
>
{{ snackbar.text }}
<template v-slot:action="{ attrs }">
<v-btn
text
v-bind="attrs"
@click="snackbar.show = false"
>
關閉
</v-btn>
</template>
</v-snackbar>
</div>
</asp:Content>

View File

@@ -0,0 +1,221 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Globalization;
public partial class admin_accounting_new_reg : MyWeb.config
{
private Model.ezEntities _db = new Model.ezEntities();
public float _t = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InitEnumsOptions<Model.accounting.type>(category); //收支類別
if (isStrNull(Request["num"]))
{
uptime.Text = DateTime.Now.ToString("yyyy-MM-dd");
}
else
{
int _num = Val(Request["num"]);
var qry = _db.accountings.AsEnumerable();
var prod = qry.Where(q => q.num == _num).FirstOrDefault();
if (prod != null)
{
try
{
foreach (Control obj in cardBodyPanel.Controls)
{
if (obj is TextBox)
{
var ObjValue = prod.GetType().GetProperty(obj.ID).GetValue(prod, null);
if (!isStrNull(ObjValue))
{
var textBox = (TextBox)obj;
if (textBox.TextMode == TextBoxMode.Date)
{
textBox.Text = Convert.ToDateTime(ObjValue).ToString("yyyy-MM-dd");
}
else
{
textBox.Text = ObjValue.ToString();
}
}
}
else if (obj is DropDownList && ((DropDownList)obj).SelectedIndex == 0)
{
var ObjValue = prod.GetType().GetProperty(obj.ID).GetValue(prod, null);
if (!isStrNull(ObjValue))
{
var dropDown = (DropDownList)obj;
dropDown.SelectedValue = ObjValue.ToString();
}
}
}
}
catch (Exception ex)
{
}
if (prod.kind.HasValue)
{
kind_txt.Value = prod.accounting_kind.kind.ToString();
kind.Value = prod.kind.ToString();
}
if (prod.kind2.HasValue)
{
kind2_txt.Value = prod.accounting_kind2.kind.ToString();
kind2.Value = prod.kind2.ToString();
}
if (prod.activity_num.HasValue)
{
activity_num_txt.Value = prod.activity.subject.ToString();
activity_num.Value = prod.activity_num.ToString();
}
if (prod.mem_num.HasValue)
{
mem_num_txt.Value = prod.member.u_name.ToString();
mem_num.Value = prod.mem_num.ToString();
}
if (prod.reg_time.HasValue)
{
timePanel1.Visible = true;
reg_time.Text = prod.reg_time.Value.ToString("yyyy/MM/dd HH:mm:ss");
}
_t = ((prod.price.HasValue) ? ValFloat(prod.price.Value) : 0) + ((prod.tax.HasValue) ? ValFloat(prod.tax.Value) : 0);
edit.Visible = true;
goback.Visible = true;
add.Visible = false;
}
else
{
Response.Redirect("index.aspx");
}
}
}
}
protected void goback_Click(object sender, EventArgs e)
{
Response.Redirect("index.aspx?page=" + Convert.ToString(Request["page"]));
}
#region
protected void add_Click(object sender, EventArgs e)
{
if (Page.IsValid) {
L_msg.Text = "";
Model.accounting accounting = new Model.accounting();
if (!isStrNull(uptime.Text)) { accounting.uptime = ValDate(uptime.Text); }
accounting.category = Val(category.SelectedValue);
if (!isStrNull(kind.Value)) { accounting.kind = Val(kind.Value); }
if (!isStrNull(kind2.Value)) { accounting.kind2 = Val(kind2.Value); }
if (!isStrNull(tax.Text)) { accounting.tax = Val(tax.Text); }
if (!isStrNull(price.Text)) { accounting.price = ValFloat(price.Text); }
if (!isStrNull(activity_num.Value)) { accounting.activity_num = Val(activity_num.Value); }
if (!isStrNull(mem_num.Value)) { accounting.mem_num = Val(mem_num.Value); }
accounting.debtor = debtor.Text;
accounting.demo = demo.Text;
accounting.excerpt = excerpt.Text;
accounting.reg_time = DateTime.Now;
try
{
_db.accountings.Add(accounting);
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Accounting, (int)Model.admin_log.Status.Insert, uptime.Text + kind2_txt.Value);
Response.Redirect("index.aspx");
}
catch (Exception ex)
{
L_msg.Text = ex.Message;
L_msg.Type = alert_type.danger;
//L_msg.Text = "操作失敗";
}
}
}
#endregion
#region
protected void edit_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
L_msg.Text = "";
int _num = Val(Request["num"]);
Model.accounting accounting = _db.accountings.Where(q => q.num == _num).FirstOrDefault();
if (accounting != null)
{
//if (!isStrNull(uptime.Text)) { accounting.uptime = ValDate(uptime.Text); }
//accounting.category = Val(category.SelectedValue);
//if (!isStrNull(kind.Value)) { accounting.kind = Val(kind.Value); }
//if (!isStrNull(kind2.Value)) { accounting.kind2 = Val(kind2.Value); }
//if (!isStrNull(tax.Text)) { accounting.tax = Val(tax.Text); }
//if (!isStrNull(price.Text)) { accounting.price = ValFloat(price.Text); }
//if (!isStrNull(activity_num.Value)) { accounting.activity_num = Val(activity_num.Value); }
//if (!isStrNull(mem_num.Value)) { accounting.mem_num = Val(mem_num.Value); }
//accounting.debtor = debtor.Text;
accounting.demo = demo.Text;
accounting.excerpt = excerpt.Text;
}
try
{
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Accounting, (int)Model.admin_log.Status.Update, uptime.Text+ kind2_txt.Value);
Response.Redirect("index.aspx?page=" + Convert.ToString(Request["page"]));
}
catch (Exception ex)
{
L_msg.Type = alert_type.danger;
//L_msg.Text = ex.InnerException.Message;
L_msg.Text = "操作失敗";
}
}
}
#endregion
}