/// <summary> /// Update a InvoicePackingDetail. /// </summary> public void Update(Model.InvoicePackingDetail invoicePackingDetail) { // // todo: add other logic here. // accessor.Update(invoicePackingDetail); }
/// <summary> /// Insert a InvoicePackingDetail. /// </summary> public void Insert(Model.InvoicePackingDetail invoicePackingDetail) { // // todo:add other logic here // accessor.Insert(invoicePackingDetail); }
private void gridView3_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e.Column.Name == "gridColumnCheck") { Model.InvoicePackingDetail detail = this.gridView3.GetRow(e.RowHandle) as Model.InvoicePackingDetail; if ((bool)e.Value) { this.Key.Add(detail); } else { for (int i = 0; i < Key.Count; i++) { if (Key[i].InvoicePackingDetailId == detail.InvoicePackingDetailId) { this.Key.RemoveAt(i); break; } } this.checkAll.Checked = false; this.gridControl2.RefreshDataSource(); } } this.gridView3.PostEditor(); this.gridView3.UpdateCurrentRow(); }
/// <summary> /// 移除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton2_Click(object sender, EventArgs e) { if (this.bindingSourceDetail.Count < 1) { return; } Model.InvoicePackingDetail detail = this.bindingSourceDetail.Current as Model.InvoicePackingDetail; this._invoicePacking.Details.Remove(detail); this.bindingSourceDetail.Position = this.bindingSourceDetail.Count - 1; this.gridControl1.RefreshDataSource(); double amount = 0; foreach (Model.InvoicePackingDetail model in this._invoicePacking.Details) { amount += Convert.ToDouble(model.Amount); } this.txt_TotalAmount.Text = amount.ToString(); }
public void TiGuiExists(Model.InvoicePackingDetail model) { if (this.ExistsPrimary(model.InvoicePackingDetailId)) { //设置KEY值 string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, DateTime.Now.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, DateTime.Now.Year, DateTime.Now.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, DateTime.Now.ToString("yyyy-MM-dd")); string sequencekey = string.Format(invoiceKind); SequenceManager.Increment(sequencekey_y); SequenceManager.Increment(sequencekey_m); SequenceManager.Increment(sequencekey_d); SequenceManager.Increment(sequencekey); model.InvoicePackingDetailId = this.GetId(DateTime.Now); TiGuiExists(model); //throw new Helper.InvalidValueException(Model.Product.PRO_Id); } }
/// <summary> /// 添加客户订单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton1_Click(object sender, EventArgs e) { XS.SearcharInvoiceXSForm f = new Book.UI.Invoices.XS.SearcharInvoiceXSForm(); Model.CustomerProducts cp = null; if (f.ShowDialog(this) == DialogResult.OK) { if (f.key != null && f.key.Count > 0) { Model.CustomerMarks mark = null; Model.InvoicePackingDetail packingDetail = null; //if (this._invoicePacking.Details != null && this._invoicePacking.Details.Count > 1) //Id = 65 + this._invoicePacking.Details.Count; foreach (Model.InvoiceXODetail detail in f.key) { if (this._invoicePacking.Details.Where(d => d.InvoiceXODetailId == detail.InvoiceXODetailId).ToList().Count > 0) { MessageBox.Show("已存在相同的訂單!", this.Text, MessageBoxButtons.OK); continue; } packingDetail = new Book.Model.InvoicePackingDetail(); //packingDetail.InvoicePackingDetailId = this._invoicePackingDetailManager.GetId(); //this._invoicePackingDetailManager.TiGuiExists(packingDetail); packingDetail.InvoicePackingDetailId = Guid.NewGuid().ToString(); packingDetail.InvoicePackingId = this._invoicePacking.InvoicePackingId; packingDetail.HandbookId = detail.HandbookId; packingDetail.HandbookProductId = detail.HandbookProductId; packingDetail.Product = detail.Product; packingDetail.ProductId = detail.ProductId; packingDetail.Customer = detail.Invoice.Customer; packingDetail.CustomerId = detail.Invoice.CustomerId; packingDetail.XOCustomer = detail.Invoice.xocustomer; packingDetail.XOCustomerId = detail.Invoice.xocustomerId; packingDetail.UnitPrice = detail.InvoiceXODetailPrice; packingDetail.InvoiceXOQuantity = detail.InvoiceXODetailQuantity0 == null ? 0 : detail.InvoiceXODetailQuantity0; packingDetail.PackingNum = packingDetail.InvoiceXOQuantity; packingDetail.HasFPQuantity = 0; packingDetail.Amount = Convert.ToDecimal(packingDetail.PackingNum) * packingDetail.UnitPrice; packingDetail.InvoiceXOId = detail.InvoiceId; packingDetail.InvoiceXODetailId = detail.InvoiceXODetailId; packingDetail.ProductUnit = detail.InvoiceProductUnit; packingDetail.WeightUnit = "KGS"; packingDetail.PriceUnit = "USD"; packingDetail.BGHandBookProduct = new BL.BGHandbookDetail1Manager().SelectProName(detail.HandbookId, detail.HandbookProductId); if (detail.Invoice.CustomerMarks != null && this._invoicePacking.Marks.Where(d => d.CustomerMarksName == detail.Invoice.CustomerMarks).ToList().Count < 1) { mark = new Book.Model.CustomerMarks(); mark.CustomerMarksId = Guid.NewGuid().ToString(); mark.InvoicePackingId = this._invoicePacking.InvoicePackingId; mark.CustomerMarksName = detail.Invoice.CustomerMarks; this._invoicePacking.Marks.Add(mark); } if (packingDetail.Product != null && !(string.IsNullOrEmpty(packingDetail.Product.CustomerProductName)) && !(string.IsNullOrEmpty(packingDetail.Product.CustomerId))) { cp = new BL.CustomerProductsManager().SelectByCustomerProductProceId(packingDetail.ProductId); } if (cp != null) { packingDetail.BLong = cp.BLong; packingDetail.BWidth = cp.BWide; packingDetail.BHeight = cp.BHigh; packingDetail.UnitJWeight = cp.JWeight; packingDetail.UnitMWeight = cp.MWeight; packingDetail.UnitCaiji = cp.Caiji; packingDetail.UnitNum = cp.PackingSpecification; if (packingDetail.UnitNum > packingDetail.InvoiceXOQuantity) { packingDetail.BoxNum = 1; packingDetail.AllJweight = Math.Round((double)(packingDetail.UnitJWeight * packingDetail.InvoiceXOQuantity / packingDetail.UnitNum), 4); packingDetail.AllMWeight = Math.Round((double)(packingDetail.UnitMWeight * packingDetail.InvoiceXOQuantity / packingDetail.UnitNum), 4); packingDetail.AllCaiji = Math.Round((double)(packingDetail.UnitCaiji * packingDetail.InvoiceXOQuantity / packingDetail.UnitNum), 4); packingDetail.PackingNum = packingDetail.InvoiceXOQuantity == null ? 0 : packingDetail.InvoiceXOQuantity; packingDetail.Amount = Convert.ToDecimal(packingDetail.PackingNum) * packingDetail.UnitPrice; } else { packingDetail.BoxNum = Convert.ToInt32(Math.Truncate(Convert.ToDouble(detail.InvoiceXODetailQuantity0 / packingDetail.UnitNum))); packingDetail.AllJweight = packingDetail.UnitJWeight * packingDetail.BoxNum; packingDetail.AllMWeight = packingDetail.UnitMWeight * packingDetail.BoxNum; packingDetail.AllCaiji = packingDetail.UnitCaiji * packingDetail.BoxNum; packingDetail.PackingNum = (packingDetail.UnitNum * packingDetail.BoxNum) == null ? packingDetail.InvoiceXOQuantity : packingDetail.UnitNum * packingDetail.BoxNum; packingDetail.Amount = Convert.ToDecimal(packingDetail.PackingNum) * packingDetail.UnitPrice; } } //if (packingDetail.UnitNum == 0 || packingDetail.UnitNum == null) //{ // MessageBox.Show("請設置該產品的成箱數量!\r" + (packingDetail.Product == null ? null : packingDetail.Product), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); // //return; //} //else //{ // packingDetail.BoxNum = (int)(detail.InvoiceXODetailQuantity0 / this.PackingSpecification); // //packingDetail.HandPackingId = Convert.ToChar(Id).ToString() + " 1" + "-" + packingDetail.BoxNum.ToString(); // packingDetail.PackingNum = this.PackingSpecification * packingDetail.BoxNum; // packingDetail.AllJweight = packingDetail.UnitJWeight * packingDetail.BoxNum; // packingDetail.AllMWeight = packingDetail.UnitMWeight * packingDetail.BoxNum; // packingDetail.AllCaiji = packingDetail.UnitCaiji * packingDetail.BoxNum; //} this._invoicePacking.Details.Add(packingDetail); if (packingDetail.UnitNum > 0 && packingDetail.InvoiceXOQuantity % packingDetail.UnitNum != 0 && packingDetail.UnitNum < packingDetail.InvoiceXOQuantity) { Model.InvoicePackingDetail invoicePackingDetail = new Book.Model.InvoicePackingDetail(); //invoicePackingDetail.InvoicePackingDetailId = this._invoicePackingDetailManager.GetId(); //this._invoicePackingDetailManager.TiGuiExists(invoicePackingDetail); invoicePackingDetail.InvoicePackingDetailId = Guid.NewGuid().ToString(); invoicePackingDetail.InvoicePackingId = this._invoicePacking.InvoicePackingId; invoicePackingDetail.HandbookId = detail.HandbookId; invoicePackingDetail.HandbookProductId = detail.HandbookProductId; invoicePackingDetail.Product = packingDetail.Product; invoicePackingDetail.ProductId = packingDetail.ProductId; invoicePackingDetail.Customer = packingDetail.Customer; invoicePackingDetail.CustomerId = packingDetail.CustomerId; invoicePackingDetail.XOCustomer = packingDetail.XOCustomer; invoicePackingDetail.XOCustomerId = packingDetail.XOCustomerId; invoicePackingDetail.UnitPrice = packingDetail.UnitPrice; invoicePackingDetail.InvoiceXOQuantity = detail.InvoiceXODetailQuantity0 == null ? 0 : detail.InvoiceXODetailQuantity0; invoicePackingDetail.PackingNum = invoicePackingDetail.InvoiceXOQuantity % packingDetail.UnitNum; invoicePackingDetail.HasFPQuantity = 0; invoicePackingDetail.Amount = Convert.ToDecimal(invoicePackingDetail.PackingNum) * invoicePackingDetail.UnitPrice; invoicePackingDetail.ProductUnit = packingDetail.ProductUnit; invoicePackingDetail.BoxNum = 1; invoicePackingDetail.BLong = packingDetail.BLong; invoicePackingDetail.BWidth = packingDetail.BWidth; invoicePackingDetail.BHeight = packingDetail.BHeight; invoicePackingDetail.UnitJWeight = Math.Round((double)(packingDetail.UnitJWeight * invoicePackingDetail.PackingNum / packingDetail.UnitNum), 4); invoicePackingDetail.UnitMWeight = Math.Round((double)(packingDetail.UnitMWeight * invoicePackingDetail.PackingNum / packingDetail.UnitNum), 4); invoicePackingDetail.UnitCaiji = Math.Round((double)(packingDetail.UnitCaiji * invoicePackingDetail.PackingNum / packingDetail.UnitNum), 4); invoicePackingDetail.AllJweight = invoicePackingDetail.UnitJWeight; invoicePackingDetail.AllMWeight = invoicePackingDetail.UnitMWeight; invoicePackingDetail.AllCaiji = invoicePackingDetail.UnitCaiji; invoicePackingDetail.WeightUnit = "KGS"; invoicePackingDetail.PriceUnit = "USD"; invoicePackingDetail.BGHandBookProduct = packingDetail.BGHandBookProduct; this._invoicePacking.Details.Add(invoicePackingDetail); } } } double amount = 0; foreach (var item in this._invoicePacking.Details) { amount += Convert.ToDouble(item.Amount); } this.txt_TotalAmount.Text = amount.ToString(); this.bindingSourceDetail.DataSource = _invoicePacking.Details; this.gridControl1.RefreshDataSource(); this.bindingSourceDetail.MoveLast(); } }
public void Update(Model.InvoicePackingDetail e) { this.Update <Model.InvoicePackingDetail>(e); }
public void Insert(Model.InvoicePackingDetail e) { this.Insert <Model.InvoicePackingDetail>(e); }
private void Validate(Model.InvoicePackingDetail detail) { }