Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
DataCenter_Core2.1_20190520
Commits
bcb8ee53
Commit
bcb8ee53
authored
Sep 05, 2019
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加ebay paypal收入明细导入的表格格式化方法
parent
434dfc18
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
506 additions
and
0 deletions
+506
-0
dc_base_income_ebay_paypal.cs
Bailun.DC.Models/dc_base_income_ebay_paypal.cs
+243
-0
FinanceController.cs
Bailun.DC.Web/Areas/Reports/Controllers/FinanceController.cs
+263
-0
No files found.
Bailun.DC.Models/dc_base_income_ebay_paypal.cs
0 → 100644
View file @
bcb8ee53
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.DC.Models
{
/// <summary>
/// ebay收入报告明细
/// </summary>
public
class
dc_base_income_ebay_paypal
{
/// <summary>
///
/// </summary>
public
int
id
{
get
;
set
;
}
/// <summary>
/// 帐号id
/// </summary>
public
int
account_id
{
get
;
set
;
}
/// <summary>
/// 帐号名称
/// </summary>
public
string
account_name
{
get
;
set
;
}
/// <summary>
/// 报告时间
/// </summary>
public
DateTime
record_time
{
get
;
set
;
}
/// <summary>
/// 时区
/// </summary>
public
string
time_zone
{
get
;
set
;
}
/// <summary>
/// 名称
/// </summary>
public
string
name
{
get
;
set
;
}
/// <summary>
/// 类型
/// </summary>
public
string
type
{
get
;
set
;
}
/// <summary>
/// 状态
/// </summary>
public
string
status
{
get
;
set
;
}
/// <summary>
/// 币种
/// </summary>
public
string
currency
{
get
;
set
;
}
/// <summary>
/// 总额
/// </summary>
public
decimal
gross
{
get
;
set
;
}
/// <summary>
/// 费用
/// </summary>
public
decimal
fee
{
get
;
set
;
}
/// <summary>
/// 净额
/// </summary>
public
decimal
net
{
get
;
set
;
}
/// <summary>
/// 发件人邮箱
/// </summary>
public
string
from_email
{
get
;
set
;
}
/// <summary>
/// 收件人邮箱
/// </summary>
public
string
to_email
{
get
;
set
;
}
/// <summary>
/// 交易号
/// </summary>
public
string
transaction_id
{
get
;
set
;
}
/// <summary>
/// 收货地址
/// </summary>
public
string
shipping_address
{
get
;
set
;
}
/// <summary>
/// 地址状态
/// </summary>
public
string
address_status
{
get
;
set
;
}
/// <summary>
/// 物品名称
/// </summary>
public
string
item_title
{
get
;
set
;
}
/// <summary>
/// 物品号
/// </summary>
public
string
item_id
{
get
;
set
;
}
/// <summary>
/// 运费和手续费金额
/// </summary>
public
decimal
shipping_handling_amount
{
get
;
set
;
}
/// <summary>
/// 保险金额
/// </summary>
public
decimal
insurance_amount
{
get
;
set
;
}
/// <summary>
/// 营业税
/// </summary>
public
decimal
sales_tax
{
get
;
set
;
}
/// <summary>
/// 选项名称1
/// </summary>
public
string
option_name1
{
get
;
set
;
}
/// <summary>
/// 选项值1
/// </summary>
public
string
option_value1
{
get
;
set
;
}
/// <summary>
/// 选项名称2
/// </summary>
public
string
option_name2
{
get
;
set
;
}
/// <summary>
/// 选项值2
/// </summary>
public
string
option_value2
{
get
;
set
;
}
/// <summary>
/// 参考交易号
/// </summary>
public
string
reference_txn_id
{
get
;
set
;
}
/// <summary>
/// 账单号
/// </summary>
public
string
invoice_number
{
get
;
set
;
}
/// <summary>
/// 自定义号码
/// </summary>
public
string
custom_number
{
get
;
set
;
}
/// <summary>
/// 数量
/// </summary>
public
int
quantity
{
get
;
set
;
}
/// <summary>
/// 收据号
/// </summary>
public
string
receipt_id
{
get
;
set
;
}
/// <summary>
/// 余额
/// </summary>
public
decimal
balance
{
get
;
set
;
}
/// <summary>
/// 地址第一行
/// </summary>
public
string
address_line1
{
get
;
set
;
}
/// <summary>
/// 地址第2行/区/临近地区
/// </summary>
public
string
address_line2
{
get
;
set
;
}
/// <summary>
/// 城镇/城市
/// </summary>
public
string
town
{
get
;
set
;
}
/// <summary>
/// 省/市/自治区/直辖市/特别行政区
/// </summary>
public
string
province
{
get
;
set
;
}
/// <summary>
/// 邮政编码
/// </summary>
public
string
postal_code
{
get
;
set
;
}
/// <summary>
/// 国家/地区
/// </summary>
public
string
country
{
get
;
set
;
}
/// <summary>
/// 联系电话号码
/// </summary>
public
string
contact_phone_number
{
get
;
set
;
}
/// <summary>
/// 主题
/// </summary>
public
string
subject
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
note
{
get
;
set
;
}
/// <summary>
/// 国家/地区代码
/// </summary>
public
string
country_code
{
get
;
set
;
}
/// <summary>
/// 引起余额变动
/// </summary>
public
string
balance_impact
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
DateTime
createtime
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
createuserid
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
createusername
{
get
;
set
;
}
}
}
Bailun.DC.Web/Areas/Reports/Controllers/FinanceController.cs
View file @
bcb8ee53
...
...
@@ -5,6 +5,10 @@ using System.Data;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Bailun.DC.Models
;
using
Bailun.ServiceFabric.Authorize
;
using
Bailun.ServiceFabric.Core.Extension
;
using
Bailun.ServiceFabric.Core.Extension.HttpContext
;
using
Bailun.ServiceFabric.Extension
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Configuration
;
...
...
@@ -4489,6 +4493,265 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
#
endregion
#
endregion
#
region
Ebay
收入报告分析
/// <summary>
/// Ebay收入报告明细
/// </summary>
/// <returns></returns>
public
ActionResult
ListEbayIncome
()
{
return
View
();
}
/// <summary>
/// Ebay收入报告明细
/// </summary>
/// <param name="parameter"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="account"></param>
/// <returns></returns>
[
BailunAuthentication
(
LoginMode
.
Enforce
)]
public
string
ListEbayIncomeJson
(
BtTableParameter
parameter
,
DateTime
start
,
DateTime
end
,
string
account
)
{
var
companyid
=
HttpContextHelper
.
Current
?.
User
?.
GetCompanyId
().
ToInt32
();
return
""
;
}
/// <summary>
/// 导入Ebay收入明细
/// </summary>
/// <returns></returns>
public
JsonResult
UploadEbayIncome
(
int
companyid
,
int
isChs
)
{
if
(
Request
.
Form
.
Files
.
Count
==
0
)
{
return
Json
(
new
{
success
=
false
,
msg
=
"请上传文件!"
});
}
var
file
=
Request
.
Form
.
Files
[
0
];
var
index
=
file
.
FileName
.
IndexOf
(
"||"
);
var
accountname
=
file
.
FileName
.
Substring
(
index
+
2
,
file
.
FileName
.
Length
-
(
index
+
2
));
var
objAccount
=
Services
.
CommonServices
.
GetCompanyAccount
(
accountname
,
companyid
);
if
(
objAccount
==
null
)
{
return
Json
(
new
{
success
=
false
,
msg
=
"找不到该账户,请确认账户是否正确"
,
});
}
Dictionary
<
string
,
DataTable
>
dic
=
Base
.
NpolHelper
.
ExcelToDataTable
(
file
.
OpenReadStream
(),
file
.
FileName
,
true
);
if
(
dic
.
Count
>
0
)
{
var
tb
=
dic
.
FirstOrDefault
();
var
list
=
new
List
<
dc_base_income_ebay_paypal
>();
var
service
=
new
Services
.
FinanceReportServices
();
var
listRate
=
new
List
<
Tuple
<
string
,
decimal
>>();
for
(
var
i
=
0
;
i
<
tb
.
Value
.
Rows
.
Count
;
i
++)
{
var
row
=
tb
.
Value
.
Rows
[
i
];
try
{
if
(
isChs
==
1
)
{
list
.
Add
(
FormatTableRowForChs
(
objAccount
,
row
));
}
else
{
list
.
Add
(
FormatTableRowForEnglish
(
objAccount
,
row
));
}
}
catch
(
Exception
ex
)
{
return
Json
(
new
{
success
=
false
,
msg
=
"第"
+
(
i
+
1
)
+
"行出现异常,异常信息:"
+
ex
.
Message
});
}
}
}
return
Json
(
""
);
}
#
region
Private
/// <summary>
/// 格式化ebay收入 中文字段
/// </summary>
/// <param name="account">帐号信息</param>
/// <param name="row">表格行信息</param>
/// <returns></returns>
private
dc_base_income_ebay_paypal
FormatTableRowForChs
(
dc_base_company_account
account
,
DataRow
row
)
{
var
Date
=
row
[
"日期"
];
var
Time
=
row
[
"时间"
];
var
Gross
=
row
[
"总额"
];
var
Fee
=
row
[
"费用"
];
var
Net
=
row
[
"净额"
];
var
PostageandPackagingAmount
=
row
[
"运费和手续费金额"
];
var
InsuranceAmount
=
row
[
"保险金额"
];
var
VAT
=
row
[
"营业税"
];
var
Quantity
=
row
[
"数量"
];
var
Balance
=
row
[
"余额"
];
var
m
=
new
dc_base_income_ebay_paypal
()
{
record_time
=
DateTime
.
Parse
(
Date
+
" "
+
Time
),
account_id
=
account
.
account_id
,
account_name
=
account
.
account_name
,
time_zone
=
row
[
"时区"
].
ToString
(),
name
=
row
[
"名称"
].
ToString
(),
type
=
row
[
"类型"
].
ToString
(),
status
=
row
[
"状态"
].
ToString
(),
currency
=
row
[
"币种"
].
ToString
(),
gross
=
decimal
.
Parse
(
Gross
.
ToString
()),
fee
=
decimal
.
Parse
(
Fee
.
ToString
()),
net
=
decimal
.
Parse
(
Net
.
ToString
()),
from_email
=
row
[
"发件人邮箱地址"
].
ToString
(),
to_email
=
row
[
"收件人邮箱地址"
].
ToString
(),
transaction_id
=
row
[
"交易号"
].
ToString
(),
shipping_address
=
row
[
"收货地址"
].
ToString
(),
address_status
=
row
[
"地址状态"
].
ToString
(),
item_title
=
row
[
"物品名称"
].
ToString
(),
item_id
=
row
[
"物品号"
].
ToString
(),
shipping_handling_amount
=
decimal
.
Parse
(
PostageandPackagingAmount
.
ToString
()),
insurance_amount
=
decimal
.
Parse
(
InsuranceAmount
.
ToString
()),
sales_tax
=
decimal
.
Parse
(
VAT
.
ToString
()),
option_name1
=
row
[
"选项 1 名称"
].
ToString
(),
option_value1
=
row
[
"选项 1 值"
].
ToString
(),
option_name2
=
row
[
"选项 2 名称"
].
ToString
(),
option_value2
=
row
[
"选项 2 值"
].
ToString
(),
reference_txn_id
=
row
[
"参考交易号"
].
ToString
(),
invoice_number
=
row
[
"账单号"
].
ToString
(),
custom_number
=
row
[
"自定义号码"
].
ToString
(),
quantity
=
int
.
Parse
(
Quantity
.
ToString
()),
receipt_id
=
row
[
"收据号"
].
ToString
(),
balance
=
decimal
.
Parse
(
Balance
.
ToString
()),
address_line1
=
row
[
"地址第1行"
].
ToString
(),
address_line2
=
row
[
"地址第2行/区/临近地区"
].
ToString
(),
town
=
row
[
"城镇/城市"
].
ToString
(),
province
=
row
[
"省/市/自治区/直辖市/特别行政区"
].
ToString
(),
postal_code
=
row
[
"邮政编码"
].
ToString
(),
country
=
row
[
"国家/地区"
].
ToString
(),
contact_phone_number
=
row
[
"联系电话号码"
].
ToString
(),
subject
=
row
[
"主题"
].
ToString
(),
note
=
row
[
"备注"
].
ToString
(),
country_code
=
row
[
"国家/地区代码"
].
ToString
(),
balance_impact
=
row
[
"引起余额变动"
].
ToString
(),
createtime
=
DateTime
.
Now
,
createuserid
=
0
,
createusername
=
"引起余额变动"
,
};
return
m
;
}
private
dc_base_income_ebay_paypal
FormatTableRowForEnglish
(
dc_base_company_account
account
,
DataRow
row
)
{
var
Date
=
row
[
"Date"
];
var
Time
=
row
[
"Time"
];
var
Gross
=
row
[
"Gross"
];
var
Fee
=
row
[
"Fee"
];
var
Net
=
row
[
"Net"
];
var
PostageandPackagingAmount
=
row
[
"Postage and Packaging Amount"
];
//运费和手续费金额
var
ShippingandHandlingAmount
=
row
[
"Shipping and Handling Amount"
];
//运费和手续费金额
var
InsuranceAmount
=
row
[
"Insurance Amount"
];
var
VAT
=
row
[
"VAT"
];
//营业税
var
SalesTax
=
row
[
"Sales Tax"
];
//营业税
var
Quantity
=
row
[
"Quantity"
];
var
Balance
=
row
[
"Balance"
];
var
m
=
new
dc_base_income_ebay_paypal
()
{
record_time
=
DateTime
.
Parse
(
Date
+
" "
+
Time
),
account_id
=
account
.
account_id
,
account_name
=
account
.
account_name
,
time_zone
=
row
[
"TimeZone"
].
ToString
(),
name
=
row
[
"Name"
].
ToString
(),
type
=
row
[
"Type"
].
ToString
(),
status
=
row
[
"Status"
].
ToString
(),
currency
=
row
[
"Currency"
].
ToString
(),
gross
=
decimal
.
Parse
(
Gross
.
ToString
()),
fee
=
decimal
.
Parse
(
Fee
.
ToString
()),
net
=
decimal
.
Parse
(
Net
.
ToString
()),
from_email
=
row
[
"From Email Address"
].
ToString
(),
to_email
=
row
[
"To Email Address"
].
ToString
(),
transaction_id
=
row
[
"Transaction ID"
].
ToString
(),
shipping_address
=
row
[
"Shipping Address"
].
ToString
(),
address_status
=
row
[
"Address Status"
].
ToString
(),
item_title
=
row
[
"Item Title"
].
ToString
(),
item_id
=
row
[
"Item ID"
].
ToString
(),
shipping_handling_amount
=
decimal
.
Parse
(
ShippingandHandlingAmount
==
null
?
PostageandPackagingAmount
.
ToString
()
:
ShippingandHandlingAmount
.
ToString
()),
insurance_amount
=
decimal
.
Parse
(
InsuranceAmount
.
ToString
()),
sales_tax
=
decimal
.
Parse
(
SalesTax
==
null
?
VAT
.
ToString
()
:
SalesTax
.
ToString
()),
option_name1
=
row
[
"Option 1 Name"
].
ToString
(),
option_value1
=
row
[
"Option 1 Value"
].
ToString
(),
option_name2
=
row
[
"Option 2 Name"
].
ToString
(),
option_value2
=
row
[
"Option 2 Value"
].
ToString
(),
reference_txn_id
=
row
[
"Reference Txn ID"
].
ToString
(),
invoice_number
=
row
[
"Invoice Number"
].
ToString
(),
custom_number
=
row
[
"Custom Number"
].
ToString
(),
quantity
=
int
.
Parse
(
Quantity
.
ToString
()),
receipt_id
=
row
[
"Receipt ID"
].
ToString
(),
balance
=
decimal
.
Parse
(
Balance
.
ToString
()),
address_line1
=
row
[
"Address Line 1"
].
ToString
(),
address_line2
=
row
[
"Address Line 2/District/Neighborhood"
].
ToString
(),
town
=
row
[
"Town/City"
].
ToString
(),
province
=
row
[
"State/Province/Region/County/Territory/Prefecture/Republic"
].
ToString
(),
postal_code
=
row
[
"Zip/Postal Code"
].
ToString
(),
country
=
row
[
"Country"
].
ToString
(),
contact_phone_number
=
row
[
"Contact Phone Number"
].
ToString
(),
subject
=
row
[
"Subject"
].
ToString
(),
note
=
row
[
"Note"
].
ToString
(),
country_code
=
row
[
"Country Code"
].
ToString
(),
balance_impact
=
row
[
"Balance Impact"
].
ToString
(),
createtime
=
DateTime
.
Now
,
createuserid
=
0
,
createusername
=
""
,
};
return
m
;
}
#
endregion
#
endregion
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment