protected override List <object> GetDataSource() { CustomerPaymentSearchCondition cpsc = new CustomerPaymentSearchCondition(); cpsc.PaymentTypes = new List <CustomerPaymentType>(); cpsc.PaymentTypes.Add(CustomerPaymentType.Supplier); cpsc.States = new List <SheetState>(); cpsc.States.Add(SheetState.Approved); cpsc.HasRemain = true; _CustomerPayments = (new CustomerPaymentBLL(AppSettings.Current.ConnStr)).GetItems(cpsc).QueryObjects; CustomerReceivableSearchCondition crsc = new CustomerReceivableSearchCondition(); crsc.Settled = false; crsc.ReceivableTypes = new List <CustomerReceivableType>(); crsc.ReceivableTypes.Add(CustomerReceivableType.SupplierReceivable); crsc.ReceivableTypes.Add(CustomerReceivableType.SupplierOtherReceivable); _CustomerReceivables = (new CustomerReceivableBLL(AppSettings.Current.ConnStr)).GetItems(crsc).QueryObjects; CompanyBLL bll = new CompanyBLL(AppSettings.Current.ConnStr); if (SearchCondition == null) { CustomerSearchCondition con = new CustomerSearchCondition(); con.ClassID = CompanyClass.Supplier; _Customers = bll.GetItems(con).QueryObjects; } else { _Customers = bll.GetItems(SearchCondition).QueryObjects; } List <object> records = FilterData(); return(records); }
private void ShowReceivables(string customerID) { CompanyBLL bll = new CompanyBLL(AppSettings.Current.ConnStr); CustomerReceivableSearchCondition con = new CustomerReceivableSearchCondition(); con.CustomerID = customerID; con.ReceivableTypes = new List <CustomerReceivableType>(); if (PaymentType == CustomerPaymentType.Customer) { con.ReceivableTypes.Add(CustomerReceivableType.CustomerOtherReceivable); con.ReceivableTypes.Add(CustomerReceivableType.CustomerReceivable); } else { con.ReceivableTypes.Add(CustomerReceivableType.SupplierOtherReceivable); con.ReceivableTypes.Add(CustomerReceivableType.SupplierReceivable); } con.Settled = false; List <CustomerReceivable> items = (new CustomerReceivableBLL(AppSettings.Current.ConnStr)).GetItems(con).QueryObjects; if (items != null && items.Count > 0) { items = (from item in items orderby item.CreateDate ascending, item.SheetID ascending select item).ToList(); foreach (CustomerReceivable cr in items) { if (cr.Remain > 0) //只核销金额为正的应收或应付 { int row = GridView.Rows.Add(); ShowItemInGridViewRow(GridView.Rows[row], cr); } } } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { if (dataGridView1.Columns[e.ColumnIndex].Name == "colReceivable") { CompanyInfo c = dataGridView1.Rows[e.RowIndex].Tag as CompanyInfo; View.FrmCustomerReceivableView frm = new View.FrmCustomerReceivableView(); CustomerReceivableSearchCondition con = new CustomerReceivableSearchCondition(); con.CustomerID = c.ID; con.ReceivableTypes = new List <CustomerReceivableType>(); con.ReceivableTypes.Add(CustomerReceivableType.SupplierOtherReceivable); con.ReceivableTypes.Add(CustomerReceivableType.SupplierReceivable); con.Settled = false; frm.SearchCondition = con; frm.Text = string.Format("{0} 应付款明细", c.Name); frm.ShowDialog(); } if (dataGridView1.Columns[e.ColumnIndex].Name == "colPrepay") { CompanyInfo c = dataGridView1.Rows[e.RowIndex].Tag as CompanyInfo; View.FrmCustomerPaymentView frm = new View.FrmCustomerPaymentView(); CustomerPaymentSearchCondition con = new CustomerPaymentSearchCondition(); con.CustomerID = c.ID; con.PaymentTypes = new List <CustomerPaymentType>(); con.PaymentTypes.Add(CustomerPaymentType.Supplier); con.States = new List <SheetState>(); con.States.Add(SheetState.Approved); con.HasRemain = true; frm.SearchCondition = con; frm.Text = string.Format("{0} 付款流水明细", c.Name); frm.ShowDialog(); } } }
private void ShowAssigns() { ItemsGrid.Rows.Clear(); if (UpdatingItem == null) { return; } List <CustomerPaymentAssign> assigns = (new CustomerPaymentBLL(AppSettings.Current.ConnStr)).GetAssigns((UpdatingItem as CustomerPayment).ID).QueryObjects; if (assigns != null && assigns.Count > 0) { CustomerReceivableSearchCondition con = new CustomerReceivableSearchCondition(); con.ReceivableIDS = assigns.Select(it => it.ReceivableID).ToList(); List <CustomerReceivable> crs = (new CustomerReceivableBLL(AppSettings.Current.ConnStr)).GetItems(con).QueryObjects; if (crs != null && crs.Count > 0) { foreach (CustomerPaymentAssign assign in assigns) { CustomerReceivable cr = crs.FirstOrDefault(it => it.ID == assign.ReceivableID); int row = ItemsGrid.Rows.Add(); ItemsGrid.Rows[row].Tag = assign; ItemsGrid.Rows[row].Cells["colSheetID"].Value = cr.SheetID; ItemsGrid.Rows[row].Cells["colClassID"].Value = CustomerReceivableTypeDescription.GetDescription(cr.ClassID); ItemsGrid.Rows[row].Cells["colAssign"].Value = assign.Amount.Trim(); } } int rowTotal = ItemsGrid.Rows.Add(); ItemsGrid.Rows[rowTotal].Cells["colSheetID"].Value = "合计"; ItemsGrid.Rows[rowTotal].Cells["colAssign"].Value = assigns.Sum(item => item.Amount).Trim(); } }
public override CommandResult Delete(CompanyInfo info) { StackOutSheetSearchCondition con = new StackOutSheetSearchCondition(); con.CustomerID = info.ID; List <StackOutSheet> items = (new StackOutSheetBLL(RepoUri)).GetItems(con).QueryObjects; if (items != null && items.Count > 0) { return(new CommandResult(ResultCode.Fail, string.Format("不能删除客户 {0} 的资料,系统中已经存在此客户的送货单", info.Name))); } IUnitWork unitWork = ProviderFactory.Create <IUnitWork>(RepoUri); CustomerPaymentSearchCondition con1 = new CustomerPaymentSearchCondition() { CustomerID = info.ID }; List <CustomerPayment> cps = ProviderFactory.Create <IProvider <CustomerPayment, string> >(RepoUri).GetItems(con1).QueryObjects; if (cps != null && cps.Count > 0) { foreach (CustomerPayment cp in cps) { ProviderFactory.Create <IProvider <CustomerPayment, string> >(RepoUri).Delete(cp, unitWork); } } CustomerOtherReceivableSearchCondition con2 = new CustomerOtherReceivableSearchCondition() { CustomerID = info.ID }; List <CustomerOtherReceivable> cds = ProviderFactory.Create <IProvider <CustomerOtherReceivable, string> >(RepoUri).GetItems(con2).QueryObjects; if (cds != null && cds.Count > 0) { foreach (CustomerOtherReceivable cd in cds) { ProviderFactory.Create <IProvider <CustomerOtherReceivable, string> >(RepoUri).Delete(cd, unitWork); } } CustomerReceivableSearchCondition con3 = new CustomerReceivableSearchCondition() { CustomerID = info.ID }; List <CustomerReceivable> crs = ProviderFactory.Create <IProvider <CustomerReceivable, Guid> >(RepoUri).GetItems(con3).QueryObjects; if (crs != null && crs.Count > 0) { foreach (CustomerReceivable cr in crs) { ProviderFactory.Create <IProvider <CustomerReceivable, Guid> >(RepoUri).Delete(cr, unitWork); } } ProviderFactory.Create <IProvider <CompanyInfo, string> >(RepoUri).Delete(info, unitWork); return(unitWork.Commit()); }
/// <summary> /// 获取某个单据的所有付款明细 /// </summary> /// <param name="paymentID"></param> /// <returns></returns> public QueryResultList <CustomerPaymentAssign> GetAssigns(string sheetNo) { CustomerReceivableSearchCondition con1 = new CustomerReceivableSearchCondition() { SheetID = sheetNo, }; List <CustomerReceivable> items = (new CustomerReceivableBLL(RepoUri)).GetItems(con1).QueryObjects; if (items != null && items.Count > 0) { CustomerPaymentAssignSearchCondition con = new CustomerPaymentAssignSearchCondition(); con.ReceivableIDs = items.Select(it => it.ID).ToList(); return(ProviderFactory.Create <IProvider <CustomerPaymentAssign, Guid> >(RepoUri).GetItems(con)); } return(new QueryResultList <CustomerPaymentAssign>(ResultCode.Fail, "没有找到记录", null)); }
protected override List <CustomerReceivable> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search) { IQueryable <CustomerReceivable> ret = dc.GetTable <CustomerReceivable>(); if (search is CustomerReceivableSearchCondition) { CustomerReceivableSearchCondition con = search as CustomerReceivableSearchCondition; if (con.CreateDate != null) { ret = ret.Where(item => item.CreateDate >= con.CreateDate.Begin && item.CreateDate <= con.CreateDate.End); } if (con.ReceivableTypes != null && con.ReceivableTypes.Count > 0) { ret = ret.Where(item => con.ReceivableTypes.Contains(item.ClassID)); } if (con.ReceivableIDS != null && con.ReceivableIDS.Count > 0) { ret = ret.Where(item => con.ReceivableIDS.Contains(item.ID)); } if (!string.IsNullOrEmpty(con.CustomerID)) { ret = ret.Where(item => item.CustomerID == con.CustomerID); } if (!string.IsNullOrEmpty(con.OrderID)) { ret = ret.Where(item => item.OrderID == con.OrderID); } if (!string.IsNullOrEmpty(con.SheetID)) { ret = ret.Where(item => item.SheetID == con.SheetID); } if (con.Settled != null) { if (con.Settled.Value) { ret = ret.Where(item => item.Haspaid == item.Amount); } else { ret = ret.Where(item => item.Haspaid < item.Amount); } } } return(ret.ToList()); }
protected override List <object> GetDataSource() { CustomerReceivableSearchCondition con1 = new CustomerReceivableSearchCondition(); con1.ReceivableTypes = new List <CustomerReceivableType>(); con1.ReceivableTypes.Add(CustomerReceivableType.CustomerOtherReceivable); _Receivables = new CustomerReceivableBLL(AppSettings.Current.ConnStr).GetItems(con1).QueryObjects; if (SearchCondition == null) { CustomerOtherReceivableSearchCondition con = new CustomerOtherReceivableSearchCondition(); con.LastActiveDate = new DateTimeRange(DateTime.Today.AddYears(-1), DateTime.Now); _Sheets = (new CustomerOtherReceivableBLL(AppSettings.Current.ConnStr)).GetItems(con).QueryObjects; } else { _Sheets = (new CustomerOtherReceivableBLL(AppSettings.Current.ConnStr)).GetItems(SearchCondition).QueryObjects; } return(FilterData()); }
private void chkShowAll_CheckedChanged(object sender, EventArgs e) { if (SearchCondition != null) { CustomerReceivableSearchCondition cpsc = SearchCondition as CustomerReceivableSearchCondition; if (cpsc != null) { if (!chkShowAll.Checked) { cpsc.Settled = false; } else { cpsc.Settled = null; } } ReFreshData(); } }
protected override void DoNullify(CustomerOtherReceivable info, IUnitWork unitWork, DateTime dt, string opt) { CustomerReceivableSearchCondition con = new CustomerReceivableSearchCondition(); con.SheetID = info.ID; List <CustomerReceivable> items = new CustomerReceivableBLL(RepoUri).GetItems(con).QueryObjects; if (items != null && items.Count > 0) { CustomerReceivable cr = items.FirstOrDefault(it => it.ClassID == CustomerReceivableType.CustomerOtherReceivable); if (cr != null) { CustomerPaymentAssignSearchCondition con1 = new CustomerPaymentAssignSearchCondition(); con1.ReceivableIDs = new List <Guid>(); con1.ReceivableIDs.Add(cr.ID); List <CustomerPaymentAssign> assigns = (new CustomerPaymentAssignBLL(RepoUri)).GetItems(con1).QueryObjects; if (assigns != null && assigns.Count > 0) { bool allSuccess = true; foreach (CustomerPaymentAssign assign in assigns) { CommandResult ret = (new CustomerPaymentAssignBLL(AppSettings.Current.ConnStr)).UndoAssign(assign); if (ret.Result != ResultCode.Successful) { allSuccess = false; } } if (!allSuccess) { throw new Exception("某些应收核销项删除失败,请手动删除这些应收核销项后再继续\"作废\"的操作"); } } ProviderFactory.Create <IProvider <CustomerReceivable, Guid> >(RepoUri).Delete(cr, unitWork); //删除应收 } } base.DoNullify(info, unitWork, dt, opt); }