예제 #1
0
        //选择PackingList
        private void bar_ChoosePackingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this.action != "view")
            {
                ChoosePackingListForm f = new ChoosePackingListForm();
                if (f.ShowDialog(this) == DialogResult.OK && f.SelectItem != null)
                {
                    this.txt_CustomerName.EditValue = f.SelectItem.CustomerFullName;
                    this.txt_ADDRESS.EditValue      = f.SelectItem.CustomerAddress;
                    this.txt_PerSS.Text             = f.SelectItem.PerSS;
                    this.date_Sailing.EditValue     = f.SelectItem.SailingOnOrAbout;
                    this.lue_From.EditValue         = f.SelectItem.FromPortId;
                    this.lue_TO.EditValue           = f.SelectItem.ToPortId;

                    //2020年1月5日22:42:35
                    this.txt_PackingListOf.EditValue    = f.SelectItem.PackingListOf;
                    this.txt_Attn.EditValue             = f.SelectItem.Attn;
                    this.btne_ShippedBy.EditValue       = f.SelectItem.ShippedBy;
                    this.txt_ShippedByAddress.EditValue = f.SelectItem.ShippedByAddress;
                    this.btne_ShipTo.EditValue          = f.SelectItem.ShipTo;
                    this.txt_ShipToAddress.EditValue    = f.SelectItem.ShipToAddress;

                    this.packingInvoiceHeader.Details = new List <Model.PackingInvoiceDetail>();
                    Model.PackingInvoiceDetail detail;
                    foreach (var item in f.SelectItem.Details)
                    {
                        detail = new Book.Model.PackingInvoiceDetail();
                        detail.PackingInvoiceDetailId = Guid.NewGuid().ToString();
                        detail.PackingInvoiceHeader   = this.packingInvoiceHeader;
                        detail.ProductId = item.ProductId;
                        detail.Product   = item.Product;
                        detail.PONo      = item.PONo;
                        detail.Quantity  = item.Quantity;
                        if (item.InvoiceXODetail != null)
                        {
                            detail.UnitPrice         = item.InvoiceXODetail.InvoiceXODetailPrice;
                            detail.Amount            = detail.Quantity * detail.UnitPrice;
                            detail.InvoiceXODetail   = item.InvoiceXODetail;
                            detail.InvoiceXODetailId = item.InvoiceXODetailId;
                        }
                        else
                        {
                            detail.UnitPrice = 0;
                            detail.Amount    = 0;
                        }

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

                    CombineSameItem();
                }
            }
        }
예제 #2
0
        //选择PackingList
        private void bar_ChoosePackingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this.action != "view")
            {
                ChoosePackingListForm f = new ChoosePackingListForm();
                if (f.ShowDialog(this) == DialogResult.OK && f.SelectItem != null)
                {
                    this.ncc_Customer.EditValue     = this.packingInvoiceHeader.Customer = f.SelectItem.Customer = new BL.CustomerManager().Get(f.SelectItem.CustomerId);
                    this.txt_CustomerName.EditValue = f.SelectItem.CustomerFullName;
                    this.txt_ADDRESS.EditValue      = f.SelectItem.CustomerAddress;
                    //this.txt_CustomerName.Text = f.SelectItem.Customer.CustomerFullName;
                    //this.txt_ADDRESS.Text = f.SelectItem.Customer.CustomerAddress;
                    this.txt_TradingCondition.EditValue = f.SelectItem.Customer.TradingCondition;
                    this.txt_PerSS.Text         = f.SelectItem.PerSS;
                    this.date_Sailing.EditValue = f.SelectItem.SailingOnOrAbout;
                    this.lue_From.EditValue     = f.SelectItem.FromPortId;
                    this.lue_TO.EditValue       = f.SelectItem.ToPortId;
                    this.txt_MarkNos.Text       = f.SelectItem.MarkNos;
                    this.cob_Unit.Text          = f.SelectItem.Unit;

                    this.packingInvoiceHeader.Details = new List <Model.PackingInvoiceDetail>();
                    Model.PackingInvoiceDetail detail;
                    foreach (var item in f.SelectItem.Details)
                    {
                        detail = new Book.Model.PackingInvoiceDetail();
                        detail.PackingInvoiceDetailId = Guid.NewGuid().ToString();
                        detail.PackingInvoiceHeader   = this.packingInvoiceHeader;
                        detail.ProductId = item.ProductId;
                        detail.Product   = item.Product;
                        detail.PONo      = item.PONo;
                        detail.Quantity  = item.Quantity;
                        if (item.InvoiceXODetail != null)
                        {
                            detail.UnitPrice         = item.InvoiceXODetail.InvoiceXODetailPrice;
                            detail.Amount            = detail.Quantity * detail.UnitPrice;
                            detail.InvoiceXODetail   = item.InvoiceXODetail;
                            detail.InvoiceXODetailId = item.InvoiceXODetailId;
                        }

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

                    CombineSameItem();
                }
            }
        }