Exemple #1
0
 private void BarInvoiceXS_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Invoices.XS.SearchXSDetail f = new Book.UI.Invoices.XS.SearchXSDetail();
     if (f.ShowDialog(this) == DialogResult.OK)
     {
         if (f.selectItems.Count > 0)
         {
             this.txt_InvoiceXSId.EditValue = f.selectItems[0].InvoiceId;
         }
         Model.BGProductDepotOutDetail detail;
         foreach (var item in f.selectItems)
         {
             detail = new Book.Model.BGProductDepotOutDetail();
             detail.BGProductDepotOutDetailId = Guid.NewGuid().ToString();
             detail.BGHandbookId          = item.HandbookId;
             detail.BGHandbookProductId   = item.HandbookProductId;
             detail.BGHandbookProductName = this.bGHandbookDetail1Manager.SelectProName(detail.BGHandbookId, detail.BGHandbookProductId);
             detail.CustomerProductName   = item.Product == null ? null : item.Product.CustomerProductName;
             detail.InvoiceCGProductName  = item.Product == null ? null : item.Product.ToString();
             detail.ProductUnit           = item.InvoiceProductUnit;
             detail.Quantity = item.InvoiceXSDetailQuantity;
             this._bGProductDepotOut.Detail.Add(detail);
         }
     }
     this.gridControl1.RefreshDataSource();
     f.Dispose();
     GC.Collect();
 }
Exemple #2
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();
        }