public ActionResult InvoiceManage(int invoiceType, bool?forReceiveOrPay) { InvoiceManageViewModel vm = new InvoiceManageViewModel(); vm.SearchCondition = new InvoiceSearchCondition(); vm.SearchCondition.Target = invoiceType; vm.SearchCondition.ProjectID = base.UserInfo.ProjectID; vm.ForReceiveOrPay = forReceiveOrPay ?? false; vm.InvoiceTypes = ApplicationConfigHelper.GetApplicationConfigs(WebConstants.INVOICETYPE).Select(i => new SelectListItem() { Value = i.ID.ToString(), Text = i.Name }); if (invoiceType == 0) { vm.Customers = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID).Select(c => new SelectListItem() { Value = c.CustomerID.ToString(), Text = c.CustomerName }); } else { vm.Shippers = ApplicationConfigHelper.GetProjectShippers(base.UserInfo.ProjectID).Select(s => new SelectListItem() { Value = s.ShipperID.ToString(), Text = s.Name }); } vm.SearchCondition.EstimateDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); vm.SearchCondition.EndEstimateDate = vm.SearchCondition.EstimateDate.Value.AddMonths(1).AddDays(-1); return(View(vm)); }
public ActionResult InvoiceManage(InvoiceManageViewModel vm) { if (base.UserInfo.UserType == 2) { vm.SearchCondition.ProjectUserCustomerIDs = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID).Select(c => c.CustomerID); } var GetInvoicesByConditionResponse = new InvoiceService().GetInvoicesByCondition(new GetInvoicesByConditionRequest() { SearchCondition = vm.SearchCondition }); if (GetInvoicesByConditionResponse.IsSuccess) { vm.Invoices = GetInvoicesByConditionResponse.Result; vm.InvoiceTypes = ApplicationConfigHelper.GetApplicationConfigs(WebConstants.INVOICETYPE).Select(i => new SelectListItem() { Value = i.ID.ToString(), Text = i.Name }); if (vm.SearchCondition.Target == 0) { vm.Customers = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID).Select(c => new SelectListItem() { Value = c.CustomerID.ToString(), Text = c.CustomerName }); } else { vm.Shippers = ApplicationConfigHelper.GetProjectShippers(base.UserInfo.ProjectID).Select(s => new SelectListItem() { Value = s.ShipperID.ToString(), Text = s.Name }); } return(View(vm)); } return(Error(GetInvoicesByConditionResponse.Exception.Message)); }