예제 #1
0
        private void AddDataRows()
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    Model.PCPGOnlineCheckDetail detail = null;
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.PCPGOnlineCheckDetail();
                        detail.PCPGOnlineCheckDetailId = Guid.NewGuid().ToString();
                        detail.PCPGOnlineCheckId       = this._pcpgoc.PCPGOnlineCheckId;
                        detail.Product   = new BL.ProductManager().Get(product.ProductId);
                        detail.ProductId = product.ProductId;
                        detail.PCPGOnlineCheckDetailDate = DateTime.Now;
                        detail.PCPGOnlineCheckDetailTime = DateTime.Now;

                        this._pcpgoc.Details.Add(detail);
                    }
                    this.bsPCPGOnlineCheckDetail.Position = this.bsPCPGOnlineCheckDetail.IndexOf(detail);
                    this.gridControl1.RefreshDataSource();
                }
            }
            f.Dispose();
            System.GC.Collect();
        }
예제 #2
0
        private void simpleButtonAppend_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this.invoice.Details.Count > 0 && string.IsNullOrEmpty(this.invoice.Details[0].ProductId))
                {
                    this.invoice.Details.RemoveAt(0);
                }
                Model.InvoicePODetail detail = null;

                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail                           = new Book.Model.InvoicePODetail();
                        detail.Invoice                   = this.invoice;
                        detail.InvoicePODetailId         = Guid.NewGuid().ToString();
                        detail.Product                   = product;
                        detail.ProductId                 = product.ProductId;
                        detail.InvoicePODetailJCQuantity = 0;
                        detail.InvoicePODetailWHQuantity = 0;
                        detail.InvoicePODetailYHQuantity = 0;
                        detail.InvoicePODetailNote       = "";
                        if (detail.Product.DepotUnit != null)
                        {
                            detail.InvoiceProductUnit = detail.Product.DepotUnit.ToString();
                        }
                        this.invoice.Details.Add(detail);
                    }
                }
                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.InvoicePODetail();
                    detail.InvoicePODetailId         = Guid.NewGuid().ToString();
                    detail.Product                   = f.SelectedItem as Model.Product;;
                    detail.ProductId                 = detail.Product.ProductId;
                    detail.InvoicePODetailJCQuantity = 0;
                    detail.InvoicePODetailWHQuantity = 0;
                    detail.InvoicePODetailYHQuantity = 0;
                    detail.InvoicePODetailNote       = "";
                    if (detail.Product.DepotUnit != null)
                    {
                        detail.InvoiceProductUnit = detail.Product.DepotUnit.ToString();
                    }
                    this.invoice.Details.Add(detail);
                }
                this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
            }
            f.Dispose();
            GC.Collect();
        }
예제 #3
0
        private void simpleButtonAppend_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this.invoice.Details.Count > 0 && this.invoice.Details[0] != null && string.IsNullOrEmpty(this.invoice.Details[0].ProductId))
                {
                    this.invoice.Details.RemoveAt(0);
                }
                Model.InvoiceCJDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail                         = new Book.Model.InvoiceCJDetail();
                        detail.Inumber                 = this.invoice.Details.Count + 1;
                        detail.InvoiceCJDetailId       = Guid.NewGuid().ToString();
                        detail.Invoice                 = this.invoice;
                        detail.Product                 = product;
                        detail.ProductId               = product.ProductId;
                        detail.InvoiceCJDetailQuantity = 1;
                        detail.InvoiceCJDetailPrice    = detail.Product.NewestCost == null ? 0 : detail.Product.NewestCost.Value;
                        detail.InvoiceCJDetailMoney    = detail.InvoiceCJDetailPrice;
                        detail.InvoiceCJDetailNote     = "";

                        detail.InvoiceProductUnit = detail.Product.DepotUnit == null ? null : detail.Product.DepotUnit.CnName;
                        this.invoice.Details.Add(detail);
                    }
                }
                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail                         = new Book.Model.InvoiceCJDetail();
                    detail.Inumber                 = this.invoice.Details.Count + 1;
                    detail.InvoiceCJDetailId       = Guid.NewGuid().ToString();
                    detail.Invoice                 = this.invoice;
                    detail.Product                 = f.SelectedItem as Model.Product;
                    detail.ProductId               = (f.SelectedItem as Model.Product).ProductId;
                    detail.InvoiceCJDetailQuantity = 1;
                    detail.InvoiceCJDetailPrice    = detail.Product.NewestCost == null ? 0 : detail.Product.NewestCost.Value;
                    detail.InvoiceCJDetailMoney    = detail.InvoiceCJDetailPrice;
                    detail.InvoiceCJDetailNote     = "";
                    detail.InvoiceProductUnit      = detail.Product.DepotUnit == null ? null : detail.Product.DepotUnit.CnName;
                    this.invoice.Details.Add(detail);
                }
                this.gridControl1.RefreshDataSource();
                this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
                // this.bindingSource2.DataSource = this.productManager.Select();
            }
            f.Dispose();
            System.GC.Collect();
        }
예제 #4
0
        private void simpleButton_Appent_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this._depotIn.Details.Count > 0 && string.IsNullOrEmpty(this._depotIn.Details[0].ProductId))
                {
                    this._depotIn.Details.RemoveAt(0);
                }
                Model.DepotInDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.DepotInDetail();
                        detail.DepotInDetailId = Guid.NewGuid().ToString();
                        detail.Inumber         = this._depotIn.Details.Count + 1;
                        detail.DepotInId       = this._depotIn.DepotInId;
                        detail.Product         = product;
                        detail.ProductId       = product.ProductId;
                        detail.ProductUnit     = product.DepotUnit == null ? "" : product.DepotUnit.CnName;
                        detail.Description     = product.ProductDescription;
                        this._depotIn.Details.Add(detail);
                    }
                }
                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.DepotInDetail();
                    detail.DepotInDetailId = Guid.NewGuid().ToString();
                    detail.Inumber         = this._depotIn.Details.Count + 1;
                    detail.DepotInId       = this._depotIn.DepotInId;
                    detail.Product         = f.SelectedItem as Model.Product;
                    detail.ProductId       = (f.SelectedItem as Model.Product).ProductId;
                    detail.ProductUnit     = (f.SelectedItem as Model.Product).DepotUnit == null ? "" : (f.SelectedItem as Model.Product).DepotUnit.CnName;
                    detail.Description     = (f.SelectedItem as Model.Product).ProductDescription;
                    this._depotIn.Details.Add(detail);
                }
                this.gridControl1.RefreshDataSource();
                this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail);
            }
            f.Dispose();
            System.GC.Collect();
        }
예제 #5
0
        private void simple_Append_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this._produceOtherReturnMaterial.Details.Count > 0 && this._produceOtherReturnMaterial.Details[0] != null && string.IsNullOrEmpty(this._produceOtherReturnMaterial.Details[0].ProductId))
                {
                    this._produceOtherReturnMaterial.Details.RemoveAt(0);
                }
                Model.ProduceOtherReturnDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.ProduceOtherReturnDetail();
                        detail.ProduceOtherReturnDetailId   = Guid.NewGuid().ToString();
                        detail.ProduceOtherReturnMaterialId = this._produceOtherReturnMaterial.ProduceOtherReturnMaterialId;
                        detail.Product     = this.productManager.Get(product.ProductId);
                        detail.ProductId   = product.ProductId;
                        detail.ProductUnit = product.DepotUnit.ToString();
                        detail.Quantity    = 0;
                        this._produceOtherReturnMaterial.Details.Add(detail);
                    }
                }

                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.ProduceOtherReturnDetail();
                    detail.ProduceOtherReturnDetailId   = Guid.NewGuid().ToString();
                    detail.ProduceOtherReturnMaterialId = this._produceOtherReturnMaterial.ProduceOtherReturnMaterialId;
                    detail.Product     = this.productManager.Get((f.SelectedItem as Model.Product).ProductId);
                    detail.ProductId   = detail.Product.ProductId;
                    detail.ProductUnit = (f.SelectedItem as Model.Product).DepotUnit.ToString();
                    detail.Quantity    = 0;
                    this._produceOtherReturnMaterial.Details.Add(detail);
                }

                this.bindingSourceProduceOtherReturnDetail.Position = this.bindingSourceProduceOtherReturnDetail.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
            }
            f.Dispose();
            System.GC.Collect();
        }
예제 #6
0
        private void simpleButton1_Click_1(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this._produceOtherMaterial.Details.Count > 0 && this._produceOtherMaterial.Details[0] != null && string.IsNullOrEmpty(this._produceOtherMaterial.Details[0].ProductId))
                {
                    this._produceOtherMaterial.Details.RemoveAt(0);
                }
                Model.ProduceOtherMaterialDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.ProduceOtherMaterialDetail();
                        detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString();
                        detail.Product                      = this.productManager.Get(product.ProductId);
                        detail.ProductId                    = product.ProductId;
                        detail.ProductSpecification         = detail.Product.ProductSpecification;
                        detail.OtherMaterialQuantity        = 0;
                        detail.OtherMaterialALLUserQuantity = 0;
                        detail.ProductStock                 = detail.Product.StocksQuantity;
                        if (!detail.Product.ProduceMaterialDistributioned.HasValue)
                        {
                            detail.Product.ProduceMaterialDistributioned = 0;
                        }
                        if (!detail.Product.OtherMaterialDistributioned.HasValue)
                        {
                            detail.Product.OtherMaterialDistributioned = 0;
                        }
                        detail.Distributioned = detail.Product.ProduceMaterialDistributioned + detail.Product.OtherMaterialDistributioned;
                        detail.Inumber        = this._produceOtherMaterial.Details.Count + 1;
                        this._produceOtherMaterial.Details.Add(detail);
                    }
                }

                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.ProduceOtherMaterialDetail();
                    detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString();
                    detail.Product                      = this.productManager.Get((f.SelectedItem as Model.Product).ProductId);
                    detail.ProductId                    = detail.Product.ProductId;
                    detail.ProductSpecification         = detail.Product.ProductSpecification;
                    detail.OtherMaterialQuantity        = 0;
                    detail.OtherMaterialALLUserQuantity = 0;
                    detail.ProductStock                 = detail.Product.StocksQuantity;
                    if (!detail.Product.ProduceMaterialDistributioned.HasValue)
                    {
                        detail.Product.ProduceMaterialDistributioned = 0;
                    }
                    if (!detail.Product.OtherMaterialDistributioned.HasValue)
                    {
                        detail.Product.OtherMaterialDistributioned = 0;
                    }
                    detail.Distributioned = detail.Product.ProduceMaterialDistributioned + detail.Product.OtherMaterialDistributioned;
                    detail.Inumber        = this._produceOtherMaterial.Details.Count + 1;
                    this._produceOtherMaterial.Details.Add(detail);
                }
                this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
            }
            f.Dispose();
            System.GC.Collect();
        }
예제 #7
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this._produceOtherCompact.Details.Count > 0 && this._produceOtherCompact.Details[0] != null && string.IsNullOrEmpty(this._produceOtherCompact.Details[0].ProductId))
                {
                    this._produceOtherCompact.Details.RemoveAt(0);
                }
                Model.ProduceOtherCompactDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.ProduceOtherCompactDetail();
                        detail.OtherCompactDetailId = Guid.NewGuid().ToString();
                        detail.Product           = this.productManager.Get(product.ProductId);
                        detail.ProductId         = product.ProductId;
                        detail.OtherCompactCount = 0;
                        detail.OtherCompactPrice = 0;
                        detail.InDepotCount      = 0;
                        detail.ProductUnit       = product.DepotUnit == null ? null : product.DepotUnit.CnName;
                        detail.OtherCompactMoney = 0;
                        Model.BomParentPartInfo bompar = this.bomParentPartInfoManager.Get(product);
                        if (bompar != null)
                        {
                            foreach (Model.BomComponentInfo comm in this.bomComponentInfoManager.Select(bompar))
                            {
                                Model.ProduceOtherCompactMaterial mater = new Model.ProduceOtherCompactMaterial();
                                mater.ProduceOtherCompactMaterialId = Guid.NewGuid().ToString();
                                mater.Product         = comm.Product;
                                mater.ProductId       = comm.ProductId;
                                mater.ProductUnit     = comm.Unit;
                                mater.ProduceQuantity = 0;
                                mater.ParentProduct   = product;
                                mater.ParentProductId = product.ProductId;

                                this._produceOtherCompact.DetailMaterial.Add(mater);
                            }
                        }

                        // detail.Inumber = this._produceOtherMaterial.Details.Count + 1;
                        //detail.ProductUnit = detail.Product.MainUnit == null ? null : detail.Product.MainUnit.CnName;
                        detail.ProductSpecification = product.ProductSpecification;
                        detail.Inumber = this._produceOtherCompact.Details.Count + 1;
                        this._produceOtherCompact.Details.Add(detail);
                    }
                }

                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.ProduceOtherCompactDetail();
                    detail.OtherCompactDetailId = Guid.NewGuid().ToString();
                    detail.Product           = this.productManager.Get((f.SelectedItem as Model.Product).ProductId);
                    detail.ProductId         = detail.Product.ProductId;
                    detail.OtherCompactCount = 0;
                    detail.OtherCompactPrice = 0;
                    detail.InDepotCount      = 0;
                    detail.OtherCompactMoney = 0;
                    detail.ProductUnit       = detail.Product.DepotUnit == null ? null : detail.Product.DepotUnit.CnName;
                    Model.BomParentPartInfo bompar = this.bomParentPartInfoManager.Get(detail.Product);
                    if (bompar != null)
                    {
                        foreach (Model.BomComponentInfo comm in this.bomComponentInfoManager.Select(bompar))
                        {
                            Model.ProduceOtherCompactMaterial mater = new Model.ProduceOtherCompactMaterial();
                            mater.ProduceOtherCompactMaterialId = Guid.NewGuid().ToString();
                            mater.Product         = comm.Product;
                            mater.ProductId       = comm.ProductId;
                            mater.ProductUnit     = comm.Unit;
                            mater.ProduceQuantity = 0;
                            mater.ParentProduct   = product;
                            mater.ParentProductId = product.ProductId;
                            this._produceOtherCompact.DetailMaterial.Add(mater);
                        }
                    }

                    // detail.Inumber = this._produceOtherMaterial.Details.Count + 1;
                    //detail.ProductUnit = detail.Product.MainUnit == null ? null : detail.Product.MainUnit.CnName;
                    detail.ProductSpecification = (f.SelectedItem as Model.Product).ProductSpecification;
                    detail.Inumber = this._produceOtherCompact.Details.Count + 1;
                    this._produceOtherCompact.Details.Add(detail);
                }

                this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                //this.bindingSourceMaterial.Position = this.bindingSourceMaterial.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
                this.gridControl2.RefreshDataSource();
            }
            f.Dispose();
            System.GC.Collect();

            //if (f.ShowDialog(this) == DialogResult.OK)
            //{
            //    Model.Product product = f.SelectedItem as Model.Product;
            //    Model.ProduceOtherCompactDetail detail = new Book.Model.ProduceOtherCompactDetail();
            //    detail.OtherCompactDetailId = Guid.NewGuid().ToString();
            //    detail.Product = f.SelectedItem as Model.Product;
            //    detail.ProductId = (f.SelectedItem as Model.Product).ProductId;
            //    detail.OtherCompactCount = 0;
            //    detail.OtherCompactPrice = 0;
            //    detail.InDepotCount = 0;
            //    detail.OtherCompactMoney = 0;
            //    //detail.ProductUnit = detail.Product.MainUnit == null ? null : detail.Product.MainUnit.CnName;
            //    detail.ProductSpecification = (f.SelectedItem as Model.Product).ProductSpecification;
            //    this._produceOtherCompact.Details.Add(detail);
            //    this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
            //    this.gridControl1.RefreshDataSource();

            //}
        }
예제 #8
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this._produceOtherInDepot.Details.Count > 0 && this._produceOtherInDepot.Details[0] != null && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId))
                {
                    this._produceOtherInDepot.Details.RemoveAt(0);
                }
                Model.ProduceOtherInDepotDetail detail = null;
                if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.ProduceOtherInDepotDetail();
                        detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString();
                        // detail.Inumber = this._produceMaterial.Details.Count + 1;
                        detail.Product                 = this.productManager.Get(product.ProductId);
                        detail.ProductId               = detail.Product.ProductId;
                        detail.ProductGuige            = (f.SelectedItem as Model.Product).ProductSpecification;
                        detail.ProduceQuantity         = 0;
                        detail.ProducePrice            = 0;
                        detail.ProduceMoney            = 0;
                        detail.ProcessPrice            = 0;
                        detail.ProduceInDepotQuantity  = 0;
                        detail.ProduceTransferQuantity = 0;
                        if (detail.Product.DepotUnit != null)
                        {
                            detail.ProductUnit = detail.Product.DepotUnit.CnName;
                        }
                        this._produceOtherInDepot.Details.Add(detail);
                    }
                }
                if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.ProduceOtherInDepotDetail();
                    Model.Product product = f.SelectedItem as Model.Product;
                    //  detail.Inumber = this._produceOtherInDepot.Details.Count + 1;
                    detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString();
                    detail.Product                 = this.productManager.Get(product.ProductId);
                    detail.ProductId               = detail.Product.ProductId;
                    detail.ProductGuige            = detail.Product.ProductSpecification;
                    detail.ProduceQuantity         = 0;
                    detail.ProducePrice            = 0;
                    detail.ProduceMoney            = 0;
                    detail.ProcessPrice            = 0;
                    detail.ProduceInDepotQuantity  = 0;
                    detail.ProduceTransferQuantity = 0;
                    if (detail.Product.DepotUnit != null)
                    {
                        detail.ProductUnit = detail.Product.DepotUnit.CnName;
                    }
                    this._produceOtherInDepot.Details.Add(detail);
                    //this.bindingSourceProductId.DataSource = productManager.Select();
                }
                this.gridControl1.RefreshDataSource();
                this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                f.Dispose();
                GC.Collect();
            }
        }
예제 #9
0
        private void simpleButtonAppend_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (this.invoice.Details.Count > 0 && string.IsNullOrEmpty(this.invoice.Details[0].ProductId))
                {
                    this.invoice.Details.RemoveAt(0);
                }
                Model.InvoiceXTDetail detail = null;
                if (Book.UI.Invoices.ChooseProductForm.ProductList != null || Book.UI.Invoices.ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in Book.UI.Invoices.ChooseProductForm.ProductList)
                    {
                        detail = new Book.Model.InvoiceXTDetail();
                        detail.InvoiceXTDetailId = Guid.NewGuid().ToString();
                        detail.Product           = product;
                        detail.ProductId         = product.ProductId;
                        detail.Invoice           = this.invoice;
                        detail.Inumber           = this.invoice.Details.Count + 1;
                        //detail.InvoiceId = this.invoice.InvoiceId;
                        detail.InvoiceXTDetailDiscount     = decimal.Zero;
                        detail.InvoiceXTDetailDiscountRate = 0;
                        detail.InvoiceXTDetailMoney0       = decimal.Zero;
                        detail.InvoiceXTDetailMoney1       = decimal.Zero;
                        detail.InvoiceXTDetailNote         = "";
                        detail.InvoiceXTDetailPrice        = decimal.Zero;
                        detail.InvoiceXTDetailQuantity     = 1;
                        detail.InvoiceXTDetailTax          = decimal.Zero;
                        detail.InvoiceXTDetailTaxRate      = 0;
                        detail.InvoiceXTDetailZS           = false;
                        detail.InvoiceProductUnit          = detail.Product.SellUnit == null ? null : detail.Product.SellUnit.CnName;
                        this.invoice.Details.Add(detail);
                    }
                }

                if (Book.UI.Invoices.ChooseProductForm.ProductList == null || Book.UI.Invoices.ChooseProductForm.ProductList.Count == 0)
                {
                    detail = new Book.Model.InvoiceXTDetail();
                    detail.InvoiceXTDetailId = Guid.NewGuid().ToString();
                    Model.Product product = f.SelectedItem as Model.Product;
                    detail.Product   = product;
                    detail.ProductId = product.ProductId;
                    detail.Invoice   = this.invoice;
                    detail.Inumber   = this.invoice.Details.Count + 1;
                    //detail.InvoiceId = this.invoice.InvoiceId;
                    detail.InvoiceXTDetailDiscount     = decimal.Zero;
                    detail.InvoiceXTDetailDiscountRate = 0;
                    detail.InvoiceXTDetailMoney0       = decimal.Zero;
                    detail.InvoiceXTDetailMoney1       = decimal.Zero;
                    detail.InvoiceXTDetailNote         = "";
                    detail.InvoiceXTDetailPrice        = decimal.Zero;
                    detail.InvoiceXTDetailQuantity     = 1;
                    detail.InvoiceXTDetailTax          = decimal.Zero;
                    detail.InvoiceXTDetailTaxRate      = 0;
                    detail.InvoiceXTDetailZS           = false;
                    detail.InvoiceProductUnit          = detail.Product.SellUnit == null ? null : detail.Product.SellUnit.CnName;
                    this.invoice.Details.Add(detail);
                }
                this.gridControl1.RefreshDataSource();
                this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
                f.Dispose();
                System.GC.Collect();
            }
        }