Commit efca51dc by guanzhenshan

退款页面增加付款时间筛选

parent 4536b31a
...@@ -3911,45 +3911,69 @@ namespace Bailun.DC.Services ...@@ -3911,45 +3911,69 @@ namespace Bailun.DC.Services
#endregion #endregion
var sql = "select platform_type,bailun_account,website,origin_order_id,amount_refund_rmb,amount_refund_usd,refund_time from dc_base_crm_refund where is_deleted=0 and is_freeze=0 "; var sql = "select t1.platform_type,t1.bailun_account,t1.website,t1.origin_order_id,t1.amount_refund_rmb,t1.amount_refund_usd,t1.refund_time from dc_base_crm_refund t1 ";
if (paytimestart.HasValue || paytimeend.HasValue)
{
sql += " join (select origin_order_id from dc_base_oms_order where company_id=1 ";
if (paytimestart.HasValue)
{
sql += " and paid_time>=@paytimestart";
sqlparam.Add("paytimestart", paytimestart.Value);
}
if (paytimeend.HasValue)
{
sql += " and paid_time<@paytimeend";
sqlparam.Add("paytimeend",paytimeend.Value.AddDays(1));
}
sql += ") t2 on t1.origin_order_id=t2.origin_order_id";
}
sql += " where t1.is_deleted=0 and t1.is_freeze=0 ";
if (start.HasValue) if (start.HasValue)
{ {
sql += " and refund_time>=@start"; sql += " and t1.refund_time>=@start";
sqlparam.Add("start", start.Value); sqlparam.Add("start", start.Value);
} }
if (end.HasValue) if (end.HasValue)
{ {
sql += " and refund_time<@end"; sql += " and t1.refund_time<@end";
sqlparam.Add("end", end.Value.AddDays(1)); sqlparam.Add("end", end.Value.AddDays(1));
} }
if (companyid.HasValue && companyid.Value != 0) if (companyid.HasValue && companyid.Value != 0)
{ {
sql += " and company_id="+companyid.Value; sql += " and t1.company_id="+companyid.Value;
} }
if (!string.IsNullOrWhiteSpace(platform)) if (!string.IsNullOrWhiteSpace(platform))
{ {
sql += " and platform_type=@platform_type"; sql += " and t1.platform_type=@platform_type";
sqlparam.Add("platform_type", platform); sqlparam.Add("platform_type", platform);
} }
if (!string.IsNullOrEmpty(website)) if (!string.IsNullOrEmpty(website))
{ {
sql += " and website=@website"; sql += " and t1.website=@website";
sqlparam.Add("website", website); sqlparam.Add("website", website);
} }
if (!string.IsNullOrEmpty(orderno)) if (!string.IsNullOrEmpty(orderno))
{ {
sql += " and origin_order_id=@orderno"; sql += " and t1.origin_order_id=@orderno";
sqlparam.Add("orderno", orderno); sqlparam.Add("orderno", orderno);
} }
if (!string.IsNullOrEmpty(parameter.sort)) if (!string.IsNullOrEmpty(parameter.sort))
{ {
sql += " order by refund_time desc"; sql += " order by t1." + parameter.sort + " " + parameter.order;
}
else
{
sql += " order by t1.refund_time desc";
} }
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
...@@ -4042,39 +4066,59 @@ namespace Bailun.DC.Services ...@@ -4042,39 +4066,59 @@ namespace Bailun.DC.Services
//} //}
#endregion #endregion
var sql = "select platform_type,bailun_account,website,origin_order_id,amount_refund_rmb,amount_refund_usd,refund_time from dc_base_crm_refund where is_deleted=0 and is_freeze=0 "; var sql = "select t1.platform_type,t1.bailun_account,t1.website,t1.origin_order_id,t1.amount_refund_rmb,t1.amount_refund_usd,t1.refund_time from dc_base_crm_refund t1 ";
if (paytimestart.HasValue || paytimeend.HasValue)
{
sql += " join (select origin_order_id from dc_base_oms_order where company_id=1 ";
if (paytimestart.HasValue)
{
sql += " and paid_time>=@paytimestart";
sqlparam.Add("paytimestart", paytimestart.Value);
}
if (paytimeend.HasValue)
{
sql += " and paid_time<@paytimeend";
sqlparam.Add("paytimeend", paytimeend.Value.AddDays(1));
}
sql += ") t2 on t1.origin_order_id=t2.origin_order_id";
}
sql += " where t1.is_deleted=0 and t1.is_freeze=0 ";
if (start.HasValue) if (start.HasValue)
{ {
sql += " and refund_time>=@start"; sql += " and t1.refund_time>=@start";
sqlparam.Add("start", start.Value); sqlparam.Add("start", start.Value);
} }
if (end.HasValue) if (end.HasValue)
{ {
sql += " and refund_time<@end"; sql += " and t1.refund_time<@end";
sqlparam.Add("end", end.Value.AddDays(1)); sqlparam.Add("end", end.Value.AddDays(1));
} }
if (companyid.HasValue && companyid.Value != 0) if (companyid.HasValue && companyid.Value != 0)
{ {
sql += " and company_id=" + companyid.Value; sql += " and t1.company_id=" + companyid.Value;
} }
if (!string.IsNullOrWhiteSpace(platform)) if (!string.IsNullOrWhiteSpace(platform))
{ {
sql += " and platform_type=@platform_type"; sql += " and t1.platform_type=@platform_type";
sqlparam.Add("platform_type", platform); sqlparam.Add("platform_type", platform);
} }
if (!string.IsNullOrEmpty(website)) if (!string.IsNullOrEmpty(website))
{ {
sql += " and website=@website"; sql += " and t1.website=@website";
sqlparam.Add("website", website); sqlparam.Add("website", website);
} }
if (!string.IsNullOrEmpty(orderno)) if (!string.IsNullOrEmpty(orderno))
{ {
sql += " and origin_order_id=@orderno"; sql += " and t1.origin_order_id=@orderno";
sqlparam.Add("orderno", orderno); sqlparam.Add("orderno", orderno);
} }
...@@ -4090,9 +4134,7 @@ namespace Bailun.DC.Services ...@@ -4090,9 +4134,7 @@ namespace Bailun.DC.Services
return obj.AsList(); return obj.AsList();
} }
} }
...@@ -4170,39 +4212,59 @@ namespace Bailun.DC.Services ...@@ -4170,39 +4212,59 @@ namespace Bailun.DC.Services
//} //}
#endregion #endregion
var sql = "select sum(amount_refund_rmb) amount_refund_rmb,sum(amount_refund_usd) amount_refund_usd from dc_base_crm_refund where is_deleted=0 and is_freeze=0 "; var sql = "select sum(t1.amount_refund_rmb) amount_refund_rmb,sum(t1.amount_refund_usd) amount_refund_usd from dc_base_crm_refund t1 ";
if (paytimestart.HasValue || paytimeend.HasValue)
{
sql += " join (select origin_order_id from dc_base_oms_order where company_id=1 ";
if (paytimestart.HasValue)
{
sql += " and paid_time>=@paytimestart";
sqlparam.Add("paytimestart", paytimestart.Value);
}
if (paytimeend.HasValue)
{
sql += " and paid_time<@paytimeend";
sqlparam.Add("paytimeend", paytimeend.Value.AddDays(1));
}
sql += ") t2 on t1.origin_order_id=t2.origin_order_id";
}
sql += " where t1.is_deleted=0 and t1.is_freeze=0 ";
if (start.HasValue) if (start.HasValue)
{ {
sql += " and refund_time>=@start"; sql += " and t1.refund_time>=@start";
sqlparam.Add("start", start.Value); sqlparam.Add("start", start.Value);
} }
if (end.HasValue) if (end.HasValue)
{ {
sql += " and refund_time<@end"; sql += " and t1.refund_time<@end";
sqlparam.Add("end", end.Value.AddDays(1)); sqlparam.Add("end", end.Value.AddDays(1));
} }
if (companyid.HasValue && companyid.Value != 0) if (companyid.HasValue && companyid.Value != 0)
{ {
sql += " and company_id=" + companyid.Value; sql += " and t1.company_id=" + companyid.Value;
} }
if (!string.IsNullOrWhiteSpace(platform)) if (!string.IsNullOrWhiteSpace(platform))
{ {
sql += " and platform_type=@platform_type"; sql += " and t1.platform_type=@platform_type";
sqlparam.Add("platform_type", platform); sqlparam.Add("platform_type", platform);
} }
if (!string.IsNullOrEmpty(website)) if (!string.IsNullOrEmpty(website))
{ {
sql += " and website=@website"; sql += " and t1.website=@website";
sqlparam.Add("website", website); sqlparam.Add("website", website);
} }
if (!string.IsNullOrEmpty(orderno)) if (!string.IsNullOrEmpty(orderno))
{ {
sql += " and origin_order_id=@orderno"; sql += " and t1.origin_order_id=@orderno";
sqlparam.Add("orderno", orderno); sqlparam.Add("orderno", orderno);
} }
......
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
<option value="">选择帐号</option> <option value="">选择帐号</option>
</select> </select>
</div>*@ </div>*@
@*<div class="form-group"> <div class="form-group">
<label>付款时间</label> <label>付款时间</label>
<input id="paystart" name="paystart" type="text" class="form-control" style="width:130px;" value="" placeholder="付款开始时间" /> <input id="paystart" name="paystart" type="text" class="form-control" style="width:130px;" value="" placeholder="付款开始时间" />
<span>至</span> <span>至</span>
<input id="payend" name="payend" type="text" class="form-control" style="width:130px;" value="" placeholder="付款结束时间" /> <input id="payend" name="payend" type="text" class="form-control" style="width:130px;" value="" placeholder="付款结束时间" />
</div>*@ </div>
<div class="form-group"> <div class="form-group">
<label>退款时间</label> <label>退款时间</label>
<input id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"))" placeholder="退款开始时间" /> <input id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"))" placeholder="退款开始时间" />
......
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