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 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();
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// 获取某个客户的所有还有余额的付款单
        /// </summary>
        /// <returns></returns>
        public QueryResultList <CustomerPayment> GetAllRemains(string customerID)
        {
            CustomerPaymentSearchCondition con = new CustomerPaymentSearchCondition();

            con.CustomerID = customerID;
            con.HasRemain  = true;
            return(GetItems(con));
        }
コード例 #4
0
        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());
        }
コード例 #5
0
        protected override List <CustomerPayment> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            IQueryable <CustomerPayment> ret = dc.GetTable <CustomerPayment>();

            if (search is SheetSearchCondition)
            {
                SheetSearchCondition con = search as SheetSearchCondition;
                if (con.SheetDate != null)
                {
                    ret = ret.Where(item => item.SheetDate >= con.SheetDate.Begin && item.SheetDate <= con.SheetDate.End);
                }
                if (con.LastActiveDate != null)
                {
                    ret = ret.Where(item => item.LastActiveDate >= con.LastActiveDate.Begin && item.LastActiveDate <= con.LastActiveDate.End);
                }
                if (con.SheetNo != null && con.SheetNo.Count > 0)
                {
                    ret = ret.Where(item => con.SheetNo.Contains(item.ID));
                }
                if (con.States != null && con.States.Count > 0)
                {
                    ret = ret.Where(item => con.States.Contains(item.State));
                }
            }
            if (search is CustomerPaymentSearchCondition)
            {
                CustomerPaymentSearchCondition con = search as CustomerPaymentSearchCondition;
                if (!string.IsNullOrEmpty(con.CustomerID))
                {
                    ret = ret.Where(item => item.CustomerID == con.CustomerID);
                }
                if (con.PaymentTypes != null && con.PaymentTypes.Count > 0)
                {
                    ret = ret.Where(item => con.PaymentTypes.Contains(item.ClassID));
                }
                if (con.HasRemain != null)
                {
                    if (con.HasRemain.Value)
                    {
                        ret = ret.Where(item => item.Assigned < item.Amount);
                    }
                    else
                    {
                        ret = ret.Where(item => item.Assigned >= item.Amount);
                    }
                }
            }
            List <CustomerPayment> sheets = ret.ToList();

            return(sheets);
        }
コード例 #6
0
 protected override List <object> GetDataSource()
 {
     if (SearchCondition == null)
     {
         CustomerPaymentSearchCondition con = new CustomerPaymentSearchCondition();
         con.LastActiveDate = new DateTimeRange(DateTime.Today.AddYears(-1), DateTime.Now);
         con.PaymentTypes   = new List <CustomerPaymentType>();
         con.PaymentTypes.Add(CustomerPaymentType.Customer);
         _Sheets = (new CustomerPaymentBLL(AppSettings.Current.ConnStr)).GetItems(con).QueryObjects;
     }
     else
     {
         _Sheets = (new CustomerPaymentBLL(AppSettings.Current.ConnStr)).GetItems(SearchCondition).QueryObjects;
     }
     return(FilterData());
 }
コード例 #7
0
 private void chkShowAll_CheckedChanged(object sender, EventArgs e)
 {
     if (SearchCondition != null)
     {
         CustomerPaymentSearchCondition cpsc = SearchCondition as CustomerPaymentSearchCondition;
         if (cpsc != null)
         {
             if (!chkShowAll.Checked)
             {
                 cpsc.HasRemain = false;
             }
             else
             {
                 cpsc.HasRemain = null;
             }
         }
         ReFreshData();
     }
 }