public void SaveSaleBill(SaleBill saleBill) { foreach (var item in saleBill.Items) { var state = _dbContext.Entry(item).State; switch (state) { case EntityState.Detached: _dbContext.SaleBillItems.Add(item); break; case EntityState.Unchanged: break; case EntityState.Added: break; case EntityState.Deleted: break; case EntityState.Modified: break; default: break; } } _dbContext.SaveChanges(); }
private void aisinoDataGrid1_DataGridRowSelectionChanged(object sender, DataGridRowEventArgs e) { try { this.Grid1BH = e.get_CurrentRow().Cells["BH"].Value.ToString().Trim(); this.dataSet = this.djcfBLL.QueryXSDJMX(this.Grid1BH, this.djcfBLL.Pagesize, 1); this.aisinoDataGrid2.set_DataSource(this.dataSet); SaleBill bill = this.billBL.Find(this.Grid1BH); int count = this.aisinoDataGrid2.get_Rows().Count; for (int i = 0; i < count; i++) { string str = this.aisinoDataGrid2.get_Rows()[i].Cells["SLV"].Value.ToString(); string str2 = this.aisinoDataGrid2.get_Rows()[i].Cells["XH"].Value.ToString(); if (((str != null) && (str != "")) && (str != "中外合作油气田")) { string str3 = this.billBL.ShowSLV(bill, str2, str); if (str3 != "") { this.aisinoDataGrid2.get_Rows()[i].Cells["SLV"].Value = str3; } } } } catch (Exception exception) { HandleException.HandleError(exception); } }
public DetailSaleBillUserControl(SaleBill saleBill) { InitializeComponent(); this.saleBillViewModel = new SaleBillViewModel(saleBill); this.DataContext = saleBillViewModel; Load_DataGrid_SaleBillDetail(); }
private void aisinoDataGrid2_GoToPageEvent(object sender, GoToPageEventArgs e) { try { this.djhbBLL.HandleGoToPageMXEventArgs(e); if (this.aisinoDataGrid1.get_SelectedRows().Count > 0) { string xSDJBH = this.aisinoDataGrid1.get_SelectedRows()[0].Cells["BH"].Value.ToString(); this.aisinoDataGrid2.set_DataSource(this.djhbBLL.QueryXSDJMX(xSDJBH)); SaleBill bill = this.billBL.Find(xSDJBH); int count = this.aisinoDataGrid2.get_Rows().Count; for (int i = 0; i < count; i++) { string str2 = this.aisinoDataGrid2.get_Rows()[i].Cells["SLV"].Value.ToString(); string str3 = this.aisinoDataGrid2.get_Rows()[i].Cells["XH"].Value.ToString(); if (((str2 != null) && (str2 != "")) && (str2 != "中外合作油气田")) { string str4 = this.billBL.ShowSLV(bill, str3, str2); if (str4 != "") { this.aisinoDataGrid2.get_Rows()[i].Cells["SLV"].Value = str4; } } } } } catch (Exception exception) { HandleException.HandleError(exception); } }
public List <SaleBill> ConvertDBToList() { List <SaleBill> saleBills = new List <SaleBill>(); try { OpenConnection(); string queryString = @"Select * from PHIEUBANHANG Where isDelete = '0'"; SqlCommand command = new SqlCommand(queryString, conn); command.ExecuteNonQuery(); SqlDataAdapter adapter = new SqlDataAdapter(command); DataTable dataTable = new DataTable(); adapter.Fill(dataTable); for (int i = 0; i < dataTable.Rows.Count; i++) { SaleBill saleBill = new SaleBill(int.Parse(dataTable.Rows[i].ItemArray[0].ToString()), int.Parse(dataTable.Rows[i].ItemArray[1].ToString()), DateTime.Parse(dataTable.Rows[i].ItemArray[2].ToString()), long.Parse(dataTable.Rows[i].ItemArray[3].ToString()), int.Parse(dataTable.Rows[i].ItemArray[4].ToString())); saleBills.Add(saleBill); } return(saleBills); } catch { return(new List <SaleBill>()); } finally { CloseConnection(); } }
private void dataGridMXDJHBQ_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0) { this.BeforeMergeSelectedBH = this.dataGridMXDJHBQ[0, e.RowIndex].Value.ToString().Trim(); string s = PropertyUtil.GetValue("WBJK_DJHB_DATAGRID_HBMX_1"); int result = 1; int.TryParse(s, out result); this.aisinoDataGridq.set_DataSource(this.djhbBLL.QueryXSDJMX_1(this.BeforeMergeSelectedBH, 20, result)); SaleBill bill = this.billBL.Find(this.BeforeMergeSelectedBH); int count = this.aisinoDataGridq.get_Rows().Count; for (int i = 0; i < count; i++) { string str2 = this.aisinoDataGridq.get_Rows()[i].Cells["SLV"].Value.ToString(); string str3 = this.aisinoDataGridq.get_Rows()[i].Cells["XH"].Value.ToString(); if (((str2 != null) && (str2 != "")) && (str2 != "中外合作油气田")) { string str4 = this.billBL.ShowSLV(bill, str3, str2); if (str4 != "") { this.aisinoDataGridq.get_Rows()[i].Cells["SLV"].Value = str4; } } } } } catch (Exception exception) { HandleException.HandleError(exception); } }
public bool AddSaleBillToDatabase(SaleBill saleBill) { try { OpenConnection(); string queryString = "Insert Into PHIEUBANHANG Values(@id, @idCustomer, @date, @total, @isDelete)"; SqlCommand command = new SqlCommand(queryString, conn); command.Parameters.AddWithValue("@id", saleBill.IdSaleBill); command.Parameters.AddWithValue("@idCustomer", saleBill.IdCustomer); command.Parameters.AddWithValue("@date", saleBill.Date); command.Parameters.AddWithValue("@total", saleBill.Total); command.Parameters.AddWithValue("@isDelete", saleBill.IsDelete); int rs = command.ExecuteNonQuery(); if (rs != 1) { return(false); } else { return(true); } } catch (Exception e) { MessageBox.Show("Thêm thất bại!" + e, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } finally { CloseConnection(); } }
internal DJHBYL(DJHBdal djhbBLL, List <SaleBill> listBill, SaleBill mergedBill) { this.Initialize(); this.djhbBLL = djhbBLL; this.listBill = listBill; this.mergedBill = mergedBill; }
private void aisinoDataGrid2_GoToPageEvent(object sender, GoToPageEventArgs e) { try { this.djcfBLL.Pagesize = e.get_PageSize(); this.aisinoDataGrid2.set_DataSource(this.djcfBLL.QueryXSDJMX(this.Grid1BH, e.get_PageSize(), e.get_PageNO())); SaleBill bill = this.billBL.Find(this.Grid1BH); int count = this.aisinoDataGrid2.get_Rows().Count; for (int i = 0; i < count; i++) { string str = this.aisinoDataGrid2.get_Rows()[i].Cells["SLV"].Value.ToString(); string str2 = this.aisinoDataGrid2.get_Rows()[i].Cells["XH"].Value.ToString(); if (((str != null) && (str != "")) && (str != "中外合作油气田")) { string str3 = this.billBL.ShowSLV(bill, str2, str); if (str3 != "") { this.aisinoDataGrid2.get_Rows()[i].Cells["SLV"].Value = str3; } } } } catch (Exception exception) { HandleException.HandleError(exception); } }
public AddSaleBillForm(int saleBillId) { _service = ApplicationService.Instanse; InitializeComponent(); _saleBillId = saleBillId; saleBill = _service.GetSaleBill(_saleBillId); }
private void ToStyle(SaleBill bill) { if ((bill.KPZT != "N") && ((bill.KPZT == "A") || (bill.KPZT == "P"))) { this.toolStripButtonAdd.Enabled = false; this.toolStripButtonDel.Enabled = false; } }
public AddSaleBillForm() { _service = ApplicationService.Instanse; InitializeComponent(); _isAddingNew = true; saleBill = new SaleBill { BillNo = "新销售单", Items = new List <SaleBillItem>() }; }
public async Task <IActionResult> Create(int?id) { string CompId = User.Claims.Where(r => r.Type == "CompanyID").FirstOrDefault().Value; int CompID = Convert.ToInt32(CompId); if (id == null) { return(NotFound()); } SaleReturnVM model = new SaleReturnVM(); SaleBill saleBill = new SaleBill(); saleBill = await _context.SaleBill.Where(r => r.CompanyID == CompID).Include(r => r.Parties).FirstOrDefaultAsync(m => m.SaleBillID == id); if (saleBill == null) { return(NotFound()); } model.SaleBillID = saleBill.SaleBillID; model.BillDate_OldBill = saleBill.BillDate.ToString("d"); model.ContactNumber_OldBill = saleBill.ContactNumber; model.ContactPerson_OldBill = saleBill.ContactPerson; model.GrossTotal_OldBill = saleBill.GrossTotal; model.NetAmount_OldBill = saleBill.NetAmount; if (saleBill.PartiesID == null) { model.PartiesID = null; model.SR_S_1 = "Cash Sale"; } else { model.PartiesID = saleBill.PartiesID; model.SR_S_1 = saleBill.Parties.PartyName; } model.Remarks_OldBill = saleBill.Remarks; model.TDiscount_OldBill = saleBill.TDiscount; model.TotalQuantity_OldBill = saleBill.TotalQuantity; model.SaleBillItem_List = _context.SaleBillItem.Include(r => r.Item).Where(r => r.SaleBillID == id).ToList(); ViewData["Ids"] = _context.Bank.Where(r => r.CompanyID == CompID).Select(m => m.BankID).ToList(); ViewData["Name"] = _context.Bank.Where(r => r.CompanyID == CompID).Select(m => m.BankName).ToList(); ViewData["BankID"] = new SelectList(_context.Bank.Where(r => r.CompanyID == CompID), "BankID", "BankName"); ViewData["CurrencyID"] = new SelectList(_context.Currency, "CurrencyID", "CurrencyName", saleBill.CurrencyID); //ViewData["PartiesID"] = new SelectList(_context.Parties, "PartiesID", "PartyName", saleBill.PartiesID); ViewData["ItemID"] = new SelectList(_context.Item.Where(r => r.CompanyID == CompID), "ItemID", "ItemID"); ViewData["PartiesID"] = new SelectList(_context.Parties.Where(r => r.CompanyID == CompID), "PartiesID", "PartyName"); ViewData["SaleBillID"] = new SelectList(_context.PurchaseBill.Where(r => r.CompanyID == CompID), "SaleBillID", "SaleBillNo"); return(View(model)); }
public void AddSaleBill(SaleBill saleBill) { _dbContext.SaleBills.Add(saleBill); foreach (var item in saleBill.Items) { _dbContext.SaleBillItems.Add(item); } _dbContext.SaveChanges(); }
private void toolBtnHB_Click(object sender, EventArgs e) { try { MergerRemarkType noMergerRemark; List <string> list = new List <string>(); List <DataGridViewRow> list2 = new List <DataGridViewRow>(); foreach (DataGridViewRow row in (IEnumerable)this.aisinoDataGrid1.get_Rows()) { if (row.Selected) { list2.Add(row); list.Add(row.Cells["BH"].Value.ToString()); } } MergerType mType = this.radioButtonSimple.Checked ? MergerType.SimpleMerger : MergerType.ComplexMerger; if (this.checkBoxHBBZ.Checked) { noMergerRemark = this.checkBoxKBZ.Checked ? MergerRemarkType.DoMergerRemarkFill : MergerRemarkType.OnlyMergerRemark; } else { noMergerRemark = MergerRemarkType.NoMergerRemark; } List <SaleBill> listBill = new List <SaleBill>(); foreach (string str in list) { listBill.Add(this.billBL.Find(str)); } SaleBill mergedBill = new SaleBill(); string str2 = this.billBL.MergeSaleBill(listBill, mergedBill, mType, noMergerRemark); if (str2 == "0") { new DJHBYL(this.djhbBLL, listBill, mergedBill).ShowDialog(); this.aisinoDataGrid1.set_DataSource(this.djhbBLL.QueryXSDJ(this.DJmonth, this.DJtype, this.GFname, this.GFsh)); PropValue.KHSH = this.radioButtonMC.Checked ? "KH" : "SH"; PropValue.SimpleComplex = this.radioButtonSimple.Checked ? "Simple" : "Complex"; PropValue.IsMergeBZ = this.checkBoxHBBZ.Checked; PropValue.IsBlankBZAdd = this.checkBoxKBZ.Checked; if (this.aisinoDataGrid1.get_Rows().Count == 0) { this.aisinoDataGrid2.set_DataSource(this.djhbBLL.QueryXSDJMX("noexist")); } } else { MessageManager.ShowMsgBox(str2); } } catch (Exception exception) { HandleException.HandleError(exception); } }
public bool Delete(SaleBill saleBill) { if (saleBill == null) { return(false); } _saleBillRepository.Delete(saleBill); _saleBillDetailRepository.DeleteRange(saleBill.SaleBillDetails); return(true); }
public JDCXSDJEdite() { this.components = null; this.saleBillBL = SaleBillCtrl.Instance; this.bill = null; this.InvoiceKP = null; this.Initialize(); this.Text = "机动车单据添加"; this.initInvoice(); this.bill = new SaleBill(); this.bill.DJRQ = TaxCardValue.taxCard.GetCardClock(); }
private void aisinoDataGrid1_DataGridRowClickEvent(object sender, DataGridRowEventArgs e) { try { int num2; string str; string str2; string str3; this.CurrentBH = e.get_CurrentRow().Cells["BH"].Value.ToString(); this.aisinoDataGrid2.set_DataSource(this.djhyBLL.GetDJMX(this.CurrentBH, this.djhyBLL.Pagesize, this.djhyBLL.CurrentPage)); this.aisinoDataGrid3.set_DataSource(this.djhyBLL.GetYSDJ(this.CurrentBH, this.djhyBLL.Pagesize, this.djhyBLL.CurrentPage)); this.OriginalBH = this.aisinoDataGrid3.get_Rows()[0].Cells["BH"].Value.ToString(); this.aisinoDataGrid4.set_DataSource(this.djhyBLL.GetYSDJMX(this.OriginalBH, this.djhyBLL.Pagesize, this.djhyBLL.CurrentPage)); SaleBill bill = this.billBL.Find(this.CurrentBH); int count = this.aisinoDataGrid2.get_Rows().Count; for (num2 = 0; num2 < count; num2++) { str = this.aisinoDataGrid2.get_Rows()[num2].Cells["SLV"].Value.ToString(); str2 = this.aisinoDataGrid2.get_Rows()[num2].Cells["XH"].Value.ToString(); if (((str != null) && (str != "")) && (str != "中外合作油气田")) { str3 = this.billBL.ShowSLV(bill, str2, str); if (str3 != "") { this.aisinoDataGrid2.get_Rows()[num2].Cells["SLV"].Value = str3; } } } this.OriginalBH = this.aisinoDataGrid3.get_Rows()[0].Cells["YSBH"].Value.ToString(); SaleBill bill2 = this.billBL.Find(this.OriginalBH); int num3 = this.aisinoDataGrid4.get_Rows().Count; for (num2 = 0; num2 < num3; num2++) { str = this.aisinoDataGrid4.get_Rows()[num2].Cells["SLV"].Value.ToString(); str2 = this.aisinoDataGrid4.get_Rows()[num2].Cells["XH"].Value.ToString(); if (((str != null) && (str != "")) && (str != "中外合作油气田")) { str3 = this.billBL.ShowSLV(bill2, str2, str); if (str3 != "") { this.aisinoDataGrid4.get_Rows()[num2].Cells["SLV"].Value = str3; } } } } catch (Exception exception) { HandleException.HandleError(exception); } }
public HYXSDJEdite() { this.components = null; this.saleBillBL = SaleBillCtrl.Instance; this.bill = null; this.InvoiceKP = null; this.Initialize(); this.Text = "货运单据添加"; this.toolStripButtonDel.Enabled = false; this.bill = new SaleBill(); this.bill.DJRQ = TaxCardValue.taxCard.GetCardClock(); this.Init_SLV(); this.initdgFyxm(); this.initInvoice(); }
public SaleBillViewModel(SaleBill saleBill) { this.SaleBillId = saleBill.SaleBillId; this.Discount = saleBill.Discount; this.TotalMoney = saleBill.TotalMoney; this.CreatedDate = saleBill.CreatedDate; this.StaffId = saleBill.StaffId; this.Account = saleBill.Staff.Account; this.Note = saleBill.Note; this.IsAprroved = saleBill.IsAprroved; this.SaleBillDetailViewModels = new List <SaleBillDetailViewModel>(); foreach (var item in saleBill.SaleBillDetails) { var saleBillDetailViewModel = new SaleBillDetailViewModel(item); this.SaleBillDetailViewModels.Add(saleBillDetailViewModel); } }
public AddZKH(bool ContainTax, DataGridView dataGridMX1) { this.components = null; this.log = LogUtil.GetLogger <AddZKH>(); this.ContainTax = false; this.bill = null; this.selectIndex = 0; this.DiscountAdded = false; this.saleLogic = SaleBillCtrl.Instance; this.slv = 0.0; this.InitializeComponent(); this.dataGridMX = dataGridMX1; this.ContainTax = ContainTax; this.textBoxZKHS.Text = "1"; this.textBoxZKHS.Focus(); this.btnOK.Enabled = false; }
private void btnPrint_Click(object sender, RoutedEventArgs e) { try { DataTable ReDT = flag.Fill_DataGrid_join("SELECT Products.Name,Users.User_Name,SalesAction.Price,[Quantity_SaleAction],[TotalPrice],Unit,SalesAction.ID_Sale FROM [dbo].[SalesAction] inner join Products on Products.ID_Product=SalesAction.ID_Product inner join Sales on Sales.ID_Sale=SalesAction.ID_Sale inner join Users on Users.ID_User=Sales.ID_User where SalesAction.Exist='true' and Sales.ID_Sale ='" + txtSaleID.Text + "'"); Save(); SaleBill Bill = new SaleBill(); Bill.SetDataSource(ReDT); //CRReport.REPORT_WINDOW rewindow = new REPORT_WINDOW(); //rewindow.ReportVW.ViewerCore.ReportSource = Bill; //rewindow.Show(); Bill.PrintToPrinter(1, false, 0, 0); } catch (Exception ex) { flag.Con.Close(); MessageBox.Show(ex.Message); } }
private void aisinoDataGrid1_DataGridRowSelectionChanged(object sender, DataGridRowEventArgs e) { SaleBill bill = null; int num3; string xSDJBH = e.get_CurrentRow().Cells["BH"].Value.ToString().Trim(); this.aisinoDataGrid2.set_DataSource(this.djhbBLL.QueryXSDJMX(xSDJBH)); double round = 0.0; double num2 = 0.0; for (num3 = 0; num3 < this.aisinoDataGrid1.get_Rows().Count; num3++) { xSDJBH = this.aisinoDataGrid1.get_Rows()[num3].Cells["BH"].Value.ToString().Trim(); if (this.aisinoDataGrid1.get_Rows()[num3].Selected) { bill = this.billBL.Find(xSDJBH); round += bill.JEHJ; foreach (Goods goods in bill.ListGoods) { num2 += goods.SE; } } } int count = this.aisinoDataGrid2.get_Rows().Count; for (num3 = 0; num3 < count; num3++) { string str2 = this.aisinoDataGrid2.get_Rows()[num3].Cells["SLV"].Value.ToString(); string str3 = this.aisinoDataGrid2.get_Rows()[num3].Cells["XH"].Value.ToString(); if (((str2 != null) && (str2 != "")) && (str2 != "中外合作油气田")) { string str4 = this.billBL.ShowSLV(bill, str3, str2); if (str4 != "") { this.aisinoDataGrid2.get_Rows()[num3].Cells["SLV"].Value = str4; } } } round = SaleBillCtrl.GetRound(round, 2); num2 = SaleBillCtrl.GetRound(num2, 2); this.labHBJE.Text = "合计金额 " + round.ToString("0.00"); this.labHBSE.Text = "合计税额 " + num2.ToString("0.00"); }
public IActionResult CancelInvoice(SaleBill salBill, IEnumerable <SaleBillItem> SaleBillItem_List) { string CompId = User.Claims.Where(r => r.Type == "CompanyID").FirstOrDefault().Value; int CompID = Convert.ToInt32(CompId); salBill.SB_B_1 = true; salBill.CreatedBy = User.Identity.Name; salBill.CompanyID = CompID; int total = _context.SaleBillItem.Where(r => r.CompanyID == CompID).Where(r => r.SaleBillID == salBill.SaleBillID).Count(); for (int i = 0; i < total; i++) { SaleBillItem SBI = new SaleBillItem(); SBI = _context.SaleBillItem.Where(r => r.SaleBillID == salBill.SaleBillID).Where(r => r.SaleBillExtraBool == false).FirstOrDefault(); SBI.SaleBillExtraBool = true; _context.Update(SBI); _context.SaveChanges(); } _context.Update(salBill); _context.SaleTransaction.RemoveRange(_context.SaleTransaction.Where(x => x.SaleBillID == salBill.SaleBillID)); _context.CashFlow.RemoveRange(_context.CashFlow.Where(x => x.SaleBillID == salBill.SaleBillID)); _context.SaveChanges(); // Decreasing Item Quantity from ITEM Table decimal StockQuantity, final; foreach (var item in SaleBillItem_List) { Item itemObj = new Item(); itemObj = _context.Item.Where(r => r.ItemID == item.ItemID).SingleOrDefault(); StockQuantity = itemObj.Quantity; final = StockQuantity + item.Quantity; itemObj.Quantity = final; _context.Update(itemObj); _context.SaveChanges(); } // Decreasing Item Quantity from ITEM Table return(RedirectToAction("Index")); }
private void aisinoDataGrid2_GoToPageEvent(object sender, GoToPageEventArgs e) { this.djhyBLL.Pagesize = e.get_PageSize(); this.aisinoDataGrid2.set_DataSource(this.djhyBLL.GetDJMX(this.CurrentBH, e.get_PageSize(), e.get_PageNO())); SaleBill bill = this.billBL.Find(this.CurrentBH); int count = this.aisinoDataGrid2.get_Rows().Count; for (int i = 0; i < count; i++) { string str = this.aisinoDataGrid2.get_Rows()[i].Cells["SLV"].Value.ToString(); string str2 = this.aisinoDataGrid2.get_Rows()[i].Cells["XH"].Value.ToString(); if (((str != null) && (str != "")) && (str != "中外合作油气田")) { string str3 = this.billBL.ShowSLV(bill, str2, str); if (str3 != "") { this.aisinoDataGrid2.get_Rows()[i].Cells["SLV"].Value = str3; } } } }
private void aisinoDataGrid3_DataGridRowClickEvent(object sender, DataGridRowEventArgs e) { try { string str2; AisinoDataSet set; this.OriginalBH = e.get_CurrentRow().Cells["YSBH"].Value.ToString(); if (this.OriginalBH.Substring(this.OriginalBH.Length - 2) == "~0") { str2 = e.get_CurrentRow().Cells["BH"].Value.ToString(); set = this.djhyBLL.GetYSDJMX(str2, this.djhyBLL.Pagesize, this.djhyBLL.CurrentPage); this.aisinoDataGrid4.set_DataSource(set); } else { str2 = e.get_CurrentRow().Cells["BH"].Value.ToString(); set = this.djhyBLL.GetYSDJMX(str2, this.djhyBLL.Pagesize, this.djhyBLL.CurrentPage); this.aisinoDataGrid4.set_DataSource(set); } SaleBill bill = this.billBL.Find(this.OriginalBH); int count = this.aisinoDataGrid4.get_Rows().Count; for (int i = 0; i < count; i++) { string str3 = this.aisinoDataGrid4.get_Rows()[i].Cells["SLV"].Value.ToString(); string str4 = this.aisinoDataGrid4.get_Rows()[i].Cells["XH"].Value.ToString(); if (((str3 != null) && (str3 != "")) && (str3 != "中外合作油气田")) { string str5 = this.billBL.ShowSLV(bill, str4, str3); if (str5 != "") { this.aisinoDataGrid4.get_Rows()[i].Cells["SLV"].Value = str5; } } } } catch (Exception exception) { HandleException.HandleError(exception); } }
private void aisinoDataGrid1_DataGridRowClickEvent(object sender, DataGridRowEventArgs e) { try { this.SelectedBH = e.get_CurrentRow().Cells["BH"].Value.ToString().Trim(); this.aisinoDataGrid2.set_DataSource(this.hzBLL.QueryXSDJMX(this.SelectedBH, this.hzBLL.Pagesize, this.hzBLL.CurrentPage)); this.bill = this.billBL.Find(this.SelectedBH); int count = this.aisinoDataGrid2.get_Rows().Count; for (int i = 0; i < count; i++) { string str = this.aisinoDataGrid2.get_Rows()[i].Cells["SLV"].Value.ToString(); string str2 = this.aisinoDataGrid2.get_Rows()[i].Cells["XH"].Value.ToString(); if (((str != null) && (str != "")) && (str != "中外合作油气田")) { string str3 = this.billBL.ShowSLV(this.bill, str2, str); if (str3 != "") { this.aisinoDataGrid2.get_Rows()[i].Cells["SLV"].Value = str3; } } } string str4 = this.billBL.CollectDiscount(this.bill); if (str4 == "0") { this.DisplayZKHZH(); } else { this.aisinoDataGrid3.set_DataSource(this.hzBLL.QueryXSDJMX("NoExist", this.hzBLL.Pagesize, 1)); HandleException.Log.Error("该单据不可以进行折扣汇总:" + str4); MessageBoxHelper.Show(str4); } } catch (Exception exception) { HandleException.HandleError(exception); } }
private void aisinoDataGridq_GoToPageEvent(object sender, GoToPageEventArgs e) { int currentpage = e.get_PageNO(); int pagesize = e.get_PageSize(); this.aisinoDataGridq.set_DataSource(this.djhbBLL.QueryXSDJMX_1(this.BeforeMergeSelectedBH, pagesize, currentpage)); SaleBill bill = this.billBL.Find(this.BeforeMergeSelectedBH); int count = this.aisinoDataGridq.get_Rows().Count; for (int i = 0; i < count; i++) { string str = this.aisinoDataGridq.get_Rows()[i].Cells["SLV"].Value.ToString(); string str2 = this.aisinoDataGridq.get_Rows()[i].Cells["XH"].Value.ToString(); if (((str != null) && (str != "")) && (str != "中外合作油气田")) { string str3 = this.billBL.ShowSLV(bill, str2, str); if (str3 != "") { this.aisinoDataGridq.get_Rows()[i].Cells["SLV"].Value = str3; } } } }
public AddZKH(SaleBill bill, int selectIndex) { this.components = null; this.log = LogUtil.GetLogger <AddZKH>(); this.ContainTax = false; this.bill = null; this.selectIndex = 0; this.DiscountAdded = false; this.saleLogic = SaleBillCtrl.Instance; this.slv = 0.0; this.InitializeComponent(); this.textBoxZKHS.TextChanged += new EventHandler(this.textBoxZKHS_TextChanged); this.btnCancel.Click += new EventHandler(this.btnCancel_Click); this.btnOK.Click += new EventHandler(this.btnOK_Click); base.Load += new EventHandler(this.AddZkhDJ_Load); this.textBoxZKJE.TextChanged += new EventHandler(this.textBoxZKJE_TextChanged); this.textBoxZKL.TextChanged += new EventHandler(this.textBoxZKL_TextChanged); this.textBoxZKL.KeyDown += new KeyEventHandler(this.textBoxZKL_KeyDown); this.bill = bill; this.selectIndex = selectIndex; this.textBoxZKHS.Text = "1"; this.textBoxZKHS.Focus(); this.btnOK.Enabled = false; }
private static List <SaleBill> ERP_MES_JHD(Hashtable import) { RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString()); //RFC rfc = new RFC("SAPTest"); var lst = new List <SaleBill>(); //RFC调用函数名 string funcName = "ZWMS_JHD"; //传输传给RFC函数的DataSet DataSet ids = new DataSet(); //构建RFC传入表DataTable //返回数据的DataSet框架 DataSet ods = new DataSet(); //构建Export参数DataTable DataTable export = new DataTable(); export.TableName = "Export"; export.Columns.Add(new DataColumn("RTYPE", typeof(string))); //消息文本 export.Columns.Add(new DataColumn("RTMSG", typeof(string))); //消息文本 ods.Tables.Add(export); //构建RFC传出表DataTable DataTable odt1 = new DataTable(); odt1.TableName = "T_HEADER"; odt1.Columns.Add(new DataColumn("VBELN", typeof(string))); //交货 odt1.Columns.Add(new DataColumn("VSTEL", typeof(string))); //装运点/接收点 odt1.Columns.Add(new DataColumn("VKORG", typeof(string))); //销售机构 odt1.Columns.Add(new DataColumn("LFART", typeof(string))); //交货类型 //odt1.Columns.Add(new DataColumn("KOKRS", typeof(string)));//客户编号 odt1.Columns.Add(new DataColumn("WADAT", typeof(string))); //计划货物移动日期 odt1.Columns.Add(new DataColumn("LFDAT", typeof(string))); //交货日期 odt1.Columns.Add(new DataColumn("WBSTK", typeof(string))); //货物移动状态总计 ods.Tables.Add(odt1); DataTable odt2 = new DataTable(); odt2.TableName = "T_ITEM"; odt2.Columns.Add(new DataColumn("VBELN", typeof(string))); //交货 odt2.Columns.Add(new DataColumn("POSNR", typeof(string))); //交货项目 odt2.Columns.Add(new DataColumn("PSTYV", typeof(string))); //交货项目类别 odt2.Columns.Add(new DataColumn("WERKS", typeof(string))); //工厂 odt2.Columns.Add(new DataColumn("MATNR", typeof(string))); //物料号 odt2.Columns.Add(new DataColumn("LGORT", typeof(string))); //库存地点 odt2.Columns.Add(new DataColumn("CHARG", typeof(string))); //批号 odt2.Columns.Add(new DataColumn("LICHN", typeof(string))); //供应商的批次 odt2.Columns.Add(new DataColumn("KDMAT", typeof(string))); //客户物料 odt2.Columns.Add(new DataColumn("PRODH", typeof(string))); //产品层次 odt2.Columns.Add(new DataColumn("LFIMG", typeof(string))); //实际已交货量(按销售单位) odt2.Columns.Add(new DataColumn("VRKME", typeof(string))); //销售单位 ods.Tables.Add(odt2); //执行RFC函数 bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods); //根据RFC执行后返回的数据处理业务逻辑 //DataTable dt = ods.Tables["T_ITEM"]; foreach (DataRow h in ods.Tables["T_HEADER"].Rows) { var bill = new SaleBill(); try { string type = h["LFART"].ToString(); string state = h["WBSTK"].ToString(); bill.No = h["VBELN"].ToString(); bill.BillDate = DateTime.Now; bill.Location = h["VSTEL"].ToString(); bill.Org = h["VKORG"].ToString(); //bill.Location = h["LFART"].ToString(); DateTime planDate, deliveryDate; if (DateTime.TryParse(h["WADAT"].ToString(), out planDate)) { bill.PlanDate = Convert.ToDateTime(h["WADAT"].ToString()); } //else // bill.PlanDate = Convert.ToDateTime(h["WADAT"].ToString()); if (DateTime.TryParse(h["LFDAT"].ToString(), out deliveryDate)) { bill.DeliveryDate = Convert.ToDateTime(h["LFDAT"].ToString()); } //bill.State = h["WBSTK"].ToString(); foreach (DataRow i in ods.Tables["T_ITEM"].AsEnumerable().Where(p => h["VBELN"].ToString() == p["VBELN"].ToString())) { var billDtl = new SaleBillDetail() { Item = new Item { Code = i["MATNR"].ToString() }, ProjectNo = i["POSNR"].ToString(), Qty = Convert.ToDouble(i["LFIMG"] ?? 0), Unit = i["VRKME"].ToString(), Factory = i["WERKS"].ToString(), BatchNo = i["CHARG"].ToString(), LotNo = i["LICHN"].ToString(), Warehouse = i["LGORT"].ToString(), BillType = i["PSTYV"].ToString(), ProductLevel = i["PRODH"].ToString(), }; bill.SaleBillDetailList.Add(billDtl); } lst.Add(bill); } catch (Exception e) { continue; } } return(lst); }