diff --git a/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs b/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs
index e3d61b5..7bc83ff 100644
--- a/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs
+++ b/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs
@@ -105,6 +105,16 @@ public partial class PDDInvoiceViewModel : BindableBaseEx, IDialogAware, IDispos
if (order.OrderTime < StartTime || EndTime < order.OrderTime) return false;
return true;
}
+ ///
+ /// 获取筛选后的数据
+ ///
+ ///
+ private IEnumerable GetFilterOrders()
+ {
+ return OrdersView.Cast();
+ }
+
+
partial void InitBrowser();
partial void InitBrowserDetail();
/// 列表增删时订阅/退订订单勾选状态,用于刷新表头全选状态
@@ -365,7 +375,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx, IDialogAware, IDispos
if (_isUpdatingSelectAll) return;
if (value == true)
{
- foreach (var order in Orders)
+ foreach (var order in GetFilterOrders())
{
if (order.IsInvoiced == false)
{
@@ -441,7 +451,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx, IDialogAware, IDispos
return;
}
- var targets = OrdersView.Cast().Where(o => o.IsSelected && !o.IsInvoiced).ToList();
+ var targets = GetFilterOrders().Where(o => o.IsSelected && !o.IsInvoiced).ToList();
if (targets.Count == 0)
{
BaseMsgWindow.ShowError("请先勾选需要开票的订单");
@@ -522,7 +532,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx, IDialogAware, IDispos
BottomMsg = $"正在批量开票:{i}/{targets.Count},当前订单:{order.order_sn}";
ProgressValue = i;
SelectedOrder = order;
- BatchInvoiceChanged?.Invoke(this, OrdersView.Cast().ToList().IndexOf(order));
+ BatchInvoiceChanged?.Invoke(this, GetFilterOrders().ToList().IndexOf(order));
bool ok = false;
if (EnvironmentHelper.IsTest)
{
@@ -586,8 +596,8 @@ public partial class PDDInvoiceViewModel : BindableBaseEx, IDialogAware, IDispos
///
private void StatisticsInvoiceAmount()
{
- InvoicedAmountTotal = OrdersView.Cast().Where(a => a.IsInvoiced).Sum(a => a.order_amount) / 100m;
- UninvoicedAmountTotal = OrdersView.Cast().Where(a => a.IsInvoiced == false).Sum(a => a.order_amount) / 100m;
+ InvoicedAmountTotal = GetFilterOrders().Where(a => a.IsInvoiced).Sum(a => a.order_amount) / 100m;
+ UninvoicedAmountTotal = GetFilterOrders().Where(a => a.IsInvoiced == false).Sum(a => a.order_amount) / 100m;
}
#endregion