Esempio n. 1
0
        private void simBtnAdd_Click(object sender, EventArgs e)
        {
            Invoices.ChooseProductForm f = new Invoices.ChooseProductForm();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (Invoices.ChooseProductForm.ProductList != null && Invoices.ChooseProductForm.ProductList.Count > 0)
                {
                    foreach (Model.Product product in Invoices.ChooseProductForm.ProductList)
                    {
                        Model.AcInvoiceXOBillDetail detail = new Book.Model.AcInvoiceXOBillDetail();
                        detail.AcInvoiceXOBillDetailId = Guid.NewGuid().ToString();
                        //detail.InvoiceXODetailId = item.InvoiceXSDetailId;
                        detail.ProductId = product.ProductId;
                        detail.Product   = product;
                        //detail.Invoice = item.Invoice;
                        //detail.InvoiceId = item.InvoiceId;
                        detail.AcInvoiceXOBillId  = this._acInvoiceXoBill.AcInvoiceXOBillId;
                        detail.InvoiceProductUnit = detail.Product.SellUnit == null ? null : detail.Product.SellUnit.CnName;
                        //detail.InvoiceAllowance = decimal.Parse((item.InvoiceAllowance == null ? 0 : item.InvoiceAllowance.Value).ToString());
                        //detail.InvoiceXODetaiInQuantity = (item.InvoiceXSDetailQuantity - (item.InvoiceXSDetailFPQuantity == null ? 0 : item.InvoiceXSDetailFPQuantity.Value)) < 0 ? 0 : (item.InvoiceXSDetailQuantity - (item.InvoiceXSDetailFPQuantity == null ? 0 : item.InvoiceXSDetailFPQuantity.Value));
                        //detail.InvoiceXODetailPrice = item.InvoiceXSDetailPrice == null ? 0 : item.InvoiceXSDetailPrice.Value;
                        //detail.InvoiceXODetailMoney = global::Helper.DateTimeParse.GetSiSheWuRu(decimal.Parse(detail.InvoiceXODetaiInQuantity.ToString()) * detail.InvoiceXODetailPrice.Value - detail.InvoiceAllowance.Value, BL.V.SetDataFormat.XSJEXiao.Value);

                        //detail.InvoiceCOIdNote = new BL.InvoiceXOManager().SelectCusXOIdByPrimaryId(item.InvoiceXOId);
                        this._acInvoiceXoBill.Details.Add(detail);
                    }
                }
                if (Invoices.ChooseProductForm.ProductList == null || Invoices.ChooseProductForm.ProductList.Count == 0)
                {
                    Model.AcInvoiceXOBillDetail detail = new Book.Model.AcInvoiceXOBillDetail();
                    detail.AcInvoiceXOBillDetailId = Guid.NewGuid().ToString();
                    detail.ProductId          = (f.SelectedItem as Model.Product).ProductId;
                    detail.Product            = f.SelectedItem as Model.Product;
                    detail.AcInvoiceXOBillId  = this._acInvoiceXoBill.AcInvoiceXOBillId;
                    detail.InvoiceProductUnit = detail.Product.SellUnit == null ? null : detail.Product.SellUnit.CnName;

                    this._acInvoiceXoBill.Details.Add(detail);
                }
                this.gridControl1.RefreshDataSource();
                this.UpdateMoneyFields();
            }
        }
Esempio n. 2
0
 private void simbtnAppend_Click(object sender, EventArgs e)
 {
     //厦门方面要求选择Invoice单
     Invoices.ZX.ChooseInvoiceForm form = new Book.UI.Invoices.ZX.ChooseInvoiceForm();
     if (form.ShowDialog(this) == DialogResult.OK)
     {
         if (form.Key != null && form.Key.Count > 0)
         {
             List <string> idlist = this._acInvoiceXoBill.Details.Select(d => d.InvoiceXODetailId).ToList();
             foreach (Model.InvoicePackingDetail item in form.Key)
             {
                 if (!idlist.Contains(item.InvoiceXODetailId))
                 {
                     Model.AcInvoiceXOBillDetail detail = new Book.Model.AcInvoiceXOBillDetail();
                     detail.AcInvoiceXOBillDetailId = Guid.NewGuid().ToString();
                     detail.InvoiceXODetailId       = item.InvoiceXODetailId;
                     detail.ProductId         = item.ProductId;
                     detail.Product           = item.Product;
                     detail.InvoicePacking    = item.InvoicePacking;
                     detail.InvoicePackingId  = item.InvoicePackingId;
                     detail.AcInvoiceXOBillId = this._acInvoiceXoBill.AcInvoiceXOBillId;
                     if (item.InvoiceXODetail != null)
                     {
                         detail.InvoiceAllowance = decimal.Parse((item.InvoiceXODetail.InvoiceAllowance == null ? 0 : item.InvoiceXODetail.InvoiceAllowance.Value).ToString());
                     }
                     detail.InvoiceXODetaiInQuantity = (item.PackingNum - (item.HasFPQuantity == null ? 0 : item.HasFPQuantity.Value)) < 0 ? 0 : (item.PackingNum - (item.HasFPQuantity == null ? 0 : item.HasFPQuantity.Value));
                     detail.InvoiceXODetailPrice     = item.UnitPrice == null ? 0 : item.UnitPrice.Value;
                     detail.InvoiceXODetailMoney     = global::Helper.DateTimeParse.GetSiSheWuRu(decimal.Parse(detail.InvoiceXODetaiInQuantity.ToString()) * detail.InvoiceXODetailPrice.Value - detail.InvoiceAllowance.Value, BL.V.SetDataFormat.XSJEXiao.Value);
                     this._acInvoiceXoBill.Details.Add(detail);
                 }
             }
             this.gridControl1.RefreshDataSource();
         }
     }
     form.Dispose();
     GC.Collect();
 }
Esempio n. 3
0
        //选择出货单
        private void simbtnAppend_Click(object sender, EventArgs e)
        {
            //SelectInvoiceXOListForm form = new SelectInvoiceXOListForm();
            //if (form.ShowDialog(this) == DialogResult.OK)
            //{
            //    if (form.SelectItems == null || form.SelectItems.Count == 0)
            //        form.SelectItems.Add(form.SelectItem);
            //    this._acInvoiceXoBill.Details = (this._acInvoiceXoBill.Details.Union(from i in form.SelectItems
            //                                                                         select new Model.AcInvoiceXOBillDetail()
            //                                                                         {
            //                                                                             AcInvoiceXOBillDetailId = Guid.NewGuid().ToString(),
            //                                                                             AcInvoiceXOBillId = this._acInvoiceXoBill.AcInvoiceXOBillId,
            //                                                                             InvoiceId = i.InvoiceId,
            //                                                                             InvoiceXODetailMoney = i.InvoiceHeji,
            //                                                                             InvoiceXODetailTaxMoney = i.InvoiceTotal,
            //                                                                             InvoiceXODetailTax = i.InvoiceTax,
            //                                                                         }).ToList<Model.AcInvoiceXOBillDetail>());
            //}
            //this.calcTaxRateMoney.Value = (from i in this._acInvoiceXoBill.Details select i.InvoiceXODetailTax.Value).Sum();
            //this.calcHeJiMoney.Value = (from i in this._acInvoiceXoBill.Details select i.InvoiceXODetailMoney.Value).Sum();
            //this.calcZongMoney.Value = (from i in this._acInvoiceXoBill.Details select i.InvoiceXODetailTaxMoney.Value).Sum();

            //this.bindingSourceDetails.DataSource = this._acInvoiceXoBill.Details;
            //this.gridControl1.RefreshDataSource();
            //form.Dispose();
            //GC.Collect();
            Invoices.XS.SearchXSDetail f = new Book.UI.Invoices.XS.SearchXSDetail();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                if (f.selectItems.Count > 0)
                {
                    List <string> idlist = this._acInvoiceXoBill.Details.Select(d => d.InvoiceXODetailId).ToList();

                    foreach (Model.InvoiceXSDetail item in f.selectItems)
                    {
                        if (!idlist.Contains(item.InvoiceXSDetailId))
                        {
                            Model.AcInvoiceXOBillDetail detail = new Book.Model.AcInvoiceXOBillDetail();
                            detail.AcInvoiceXOBillDetailId = Guid.NewGuid().ToString();
                            detail.InvoiceXODetailId       = item.InvoiceXSDetailId;
                            detail.ProductId                = item.ProductId;
                            detail.Product                  = item.Product;
                            detail.Invoice                  = item.Invoice;
                            detail.InvoiceId                = item.InvoiceId;
                            detail.AcInvoiceXOBillId        = this._acInvoiceXoBill.AcInvoiceXOBillId;
                            detail.InvoiceAllowance         = decimal.Parse((item.InvoiceAllowance == null ? 0 : item.InvoiceAllowance.Value).ToString());
                            detail.InvoiceXODetaiInQuantity = (item.InvoiceXSDetailQuantity - (item.InvoiceXSDetailFPQuantity == null ? 0 : item.InvoiceXSDetailFPQuantity.Value)) < 0 ? 0 : (item.InvoiceXSDetailQuantity - (item.InvoiceXSDetailFPQuantity == null ? 0 : item.InvoiceXSDetailFPQuantity.Value));
                            detail.InvoiceXODetailPrice     = item.InvoiceXSDetailPrice == null ? 0 : item.InvoiceXSDetailPrice.Value;
                            detail.InvoiceXODetailMoney     = global::Helper.DateTimeParse.GetSiSheWuRu(decimal.Parse(detail.InvoiceXODetaiInQuantity.ToString()) * detail.InvoiceXODetailPrice.Value - detail.InvoiceAllowance.Value, BL.V.SetDataFormat.XSJEXiao.Value);

                            //detail.InvoiceXODetailTax = item.InvoiceXSDetailTax == null ? 0 : item.InvoiceXSDetailTax.Value;
                            //detail.InvoiceXODetailTaxMoney = item.InvoiceXSDetailTaxMoney == null ? 0 : item.InvoiceXSDetailTaxMoney.Value;
                            //detail.InvoiceXODetailTaxPrice = item.InvoiceXSDetailTaxPrice == null ? 0 : item.InvoiceXSDetailTaxPrice.Value;

                            this._acInvoiceXoBill.Details.Add(detail);
                        }
                    }

                    ///  this.calcTaxRateMoney.Value = (from i in this._acInvoiceXoBill.Details select i.InvoiceXODetailTax.Value).Sum();
                    //this.calcHeJiMoney.Value = (from i in this._acInvoiceXoBill.Details select i.InvoiceXODetailMoney.Value).Sum();
                    //this.calcZongMoney.Value = (from i in this._acInvoiceXoBill.Details select i.InvoiceXODetailTaxMoney.Value).Sum();
                    //this.calcTaxRate.Value = f.selectItems[0].Invoice.InvoiceTaxrate == null ? 0 : decimal.Parse(f.selectItems[0].Invoice.InvoiceTaxrate.ToString());
                    //this.TaxType.SelectedIndex = f.selectItems[0].Invoice.TaxCaluType == null ? 0 : f.selectItems[0].Invoice.TaxCaluType.Value;
                    //this.bindingSourceDetails.DataSource = this._acInvoiceXoBill.Details;
                    this.gridControl1.RefreshDataSource();
                    //  this.UpdateMoneyFields();
                }
            }
            f.Dispose();
            GC.Collect();
        }