Commit 7d8bc877 by guanzhenshan

增加修改放款的功能

parent 39b13b19
......@@ -5129,7 +5129,7 @@ group by currency";
/// <returns></returns>
public List<dc_daily_receivable> ListReceivable(BtTableParameter parameter,string platform,DateTime start, DateTime end,int type,ref int total)
{
var sql = $"select platform,sum(amount_sale_pay) as amount_sale_pay,sum(amount_shipping) amount_shipping,sum(amount_refund) amount_refund,sum(amount_sale_shipping) amount_sale_shipping,sum(amount_platformfee) amount_platformfee,sum(amount_incoming) amount_incoming,sum(amount_other) amount_other from dc_daily_receivable where day>='{start.ToString("yyyy-MM-dd")}' and day<'{end.AddDays(1).ToString("yyyy-MM-dd")}'";
var sql = $"select max(id) id,platform,sum(amount_sale_pay) as amount_sale_pay,sum(amount_shipping) amount_shipping,sum(amount_refund) amount_refund,sum(amount_sale_shipping) amount_sale_shipping,sum(amount_platformfee) amount_platformfee,sum(amount_incoming) amount_incoming,sum(amount_other) amount_other from dc_daily_receivable where day>='{start.ToString("yyyy-MM-dd")}' and day<'{end.AddDays(1).ToString("yyyy-MM-dd")}'";
var sqlparam = new DynamicParameters();
var sql_start = $"select * from dc_daily_receivable where day='{start.ToString("yyyy-MM-dd")}'";
......@@ -5287,11 +5287,12 @@ group by currency";
/// 修改应收款其他金额
/// </summary>
/// <param name="id"></param>
/// <param name="otheramount">其他金额</param>
/// <param name="amount">调整金额</param>
/// <param name="uid">当前用户id</param>
/// <param name="username">当前用户名称</param>
/// <param name="type">1:其他金额,2:放款金额</param>
/// <returns></returns>
public string UpdateReceivable(int id,decimal otheramount,int uid,string username)
public string UpdateReceivable(int id,decimal amount,int uid,string username,int type)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
......@@ -5307,7 +5308,15 @@ group by currency";
return "找不到该记录。";
}
obj.amount_other = otheramount;
if (type == 1)
{
obj.amount_other = amount;
}
else if(type==2)
{
obj.amount_incoming = amount;
}
if (obj.platform.ToLower() == "ebay")
{
......@@ -5357,8 +5366,9 @@ group by currency";
//Ebay预收账款=期初预收余额+本期收款(订单付款金额)-发货金额-退款(未发货的)
if (obj.platform.ToLower() == "ebay")
{
obj.amount_start = m.amount_end;
obj.amount_end = obj.amount_start + obj.amount_sale_pay - obj.amount_shipping - obj.amount_refund;
obj.amount_end = obj.amount_start + obj.amount_sale_pay - obj.amount_shipping - obj.amount_refund+obj.amount_other;
obj.lastupdatetime = DateTime.Now;
obj.lastupdateuserid = uid;
obj.lastupdateusername = username;
......
......@@ -7199,7 +7199,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var obj = _service.ListReceivable(parameter, platform, start, end,type, ref total);
var list = obj.Select(a => new {
a.id,
id = start == end ?a.id:0,
a.platform,
day = start!=end? (start.ToString("yyyy-MM-dd") +"至"+ end.ToString("yyyy-MM-dd")) : start.ToString("yyyy-MM-dd"), //a.day.ToString("yyyy-MM-dd"),
amount_end = a.amount_end.ToString("N2"),
......@@ -7245,11 +7245,11 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="amount">金额</param>
/// <returns></returns>
[HttpPost]
public JsonResult UpdatePlatformReceivable(int id, decimal amount)
public JsonResult UpdatePlatformReceivable(int id, decimal amount,int type=1)
{
var user = HttpContextHelper.Current.User;
var result = new Services.FinanceReportServices().UpdateReceivable(id, amount,(user!=null? user.GetUid():0),(user!=null? user.GetUserName():""));
var result = new Services.FinanceReportServices().UpdateReceivable(id, amount,(user!=null? user.GetUid():0),(user!=null? user.GetUserName():""),type);
return Json(new {
success = string.IsNullOrEmpty(result),
......
......@@ -119,7 +119,12 @@
{ field: 'amount_start', title: '期初应收余额', width: '130', iscount: true },
{ field: 'amount_sale_shipping', title: '本期销售收入', width: '130', iscount: true },
{ field: 'amount_platformfee', title: '平台扣费', width: '110', iscount: true },
{ field: 'amount_incoming', title: '放款金额', width: '110', iscount: true },
{
field: 'amount_incoming', title: '放款金额', width: '110', iscount: true, formatter: function (idx, data) {
return '<span>' + data.amount_incoming + '</span><a style="margin-left:3px;" href="javascript:;" onclick="showmodel(' + data.id + ',\'' + data.day + '\',\'' + data.platform + '\',\'' + data.amount_incoming + '\',2);">编辑</a>';
}
},
{ field: 'amount_refund', title: '退款(已发货)', width: '130', iscount: true },
{
field: 'amount_other', title: '其他金额', width: '110', iscount: true, formatter: function (idx, data) {
......@@ -219,12 +224,17 @@
var _day;
var _platform;
var _amount;
var _t = 1;
function showmodel(i,d, p, m) {
function showmodel(i,d, p, m,t) {
_day = d;
_platform = p;
_amount = m;
if (t != undefined) {
_t = t;
}
layer.prompt({ title: p+" "+d+" 的其他金额", value: m }, function (text, index) {
layer.close(index);
SaveOther(i,text);
......@@ -237,7 +247,7 @@
$.submit({
url: '@Url.Content("~/Reports/Finance/UpdatePlatformReceivable")',
type:'POST',
paramData: 'id=' + id +'&amount='+val,
paramData: 'id=' + id +'&amount='+val+'&type='+_t,
func: function (result) {
if (result.success) {
layer.msg('提交成功!');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment