public void GetSalesOrder() { SalesOrderHeader_Service SOH = new SalesOrderHeader_Service(); SOH.UseDefaultCredentials = true; SalesOrderResult = SOH.Read(dataGridView1.CurrentRow.Cells[0].Value.ToString()); tbInfo.Text = string.Format("{0} {1}{2}{3} {4}{5}{6}{7}{8}{9}{10}{11}{12} {13}{14}{15} {16}{17}{18} {19}", "Leveringskode:", SalesOrderResult.Shipment_Method_Code, Environment.NewLine, "Betalingsbet. kode:", SalesOrderResult.Payment_Method_Code, Environment.NewLine, SalesOrderResult.Ship_to_Name, Environment.NewLine, SalesOrderResult.Ship_to_Address, Environment.NewLine, SalesOrderResult.Ship_to_Address_2, Environment.NewLine, SalesOrderResult.Ship_to_Post_Code, SalesOrderResult.Ship_to_City, Environment.NewLine, "Ordrebeløb: ", Result[dataGridView1.CurrentRow.Index].Total_Kundeordrebeløb.ToString("N2"), Environment.NewLine, "Ordrevægt: ", Result[dataGridView1.CurrentRow.Index].VægtKundeordre.ToString("N2")); GetCommentLines(); }
public void GetSaletOrderHeaderData() { // Create Service Reference var service = new SalesOrderHeader_Service(); service.UseDefaultCredentials = true; // Create the Order header newOrder = new SalesOrderHeader(); newOrder = service.Read(orderno); orderno = newOrder.No; tbName.Text = newOrder.Sell_to_Customer_No; tbName2.Text = newOrder.Sell_to_Customer_Name; tbAddress.Text = newOrder.Sell_to_Address; tbAddress2.Text = newOrder.Sell_to_Address_2; tbPostCode.Text = newOrder.Sell_to_Post_Code; tbCity.Text = newOrder.Sell_to_City; tbPhone.Text = newOrder.Sell_to_Contact_Phone_No; tbEmail.Text = newOrder.Sell_to_Contact_E_Mail; tbExternalDoc.Text = newOrder.External_Document_No; mtbShipmentDate.Text = newOrder.Shipment_Date.ToShortDateString(); cbDeliverycode.Text = newOrder.Shipment_Method_Code; }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if ((keyData == Keys.Enter) && (dataGridView1.Focused)) { if (dataGridView1.CurrentRow == null) { return(true); } int CurIndex = dataGridView1.CurrentRow.Index; // kald edit formen med linjen som ref param. var salesline = newOrder.SalesLines[CurIndex]; decimal antal = newOrder.SalesLines[CurIndex].Quantity; decimal pris = newOrder.SalesLines[CurIndex].Unit_Price; decimal percent = newOrder.SalesLines[CurIndex].Line_Discount_Percent; fmEditSalesLine editsalesline = new fmEditSalesLine(); editsalesline.ShowDialog(ref antal, ref pris, ref percent, salesline.Description); // Create Service Reference var service = new SalesOrderHeader_Service(); service.UseDefaultCredentials = true; if (antal == 0) { if (MessageBox.Show("Vil du slette 0 linjen", "Slet Linjen?", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { service.Delete_SalesLines(newOrder.SalesLines[CurIndex].Key); newOrder = service.Read(orderno); } } else { salesline.Quantity = antal; if (salesline.Unit_Cost_LCY > pris) { if (MessageBox.Show(string.Format("Købsprisen på {0}kr. ligger under den angivende salgspris på {1}kr. Vil du fortsætte med den pris?", salesline.Unit_Cost_LCY, pris), "Prisadvarsel", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) { salesline.Unit_Price = pris; } } else { salesline.Unit_Price = pris; salesline.Line_Discount_Percent = percent; } } service.Update(ref newOrder); GetSalesOrderLineData(); if (dataGridView1.Rows.Count <= CurIndex) { CurIndex = dataGridView1.Rows.Count - 1; } if (dataGridView1.Rows.Count > 0) { dataGridView1.CurrentCell = dataGridView1.Rows[CurIndex].Cells[0]; } else { tbDescription.Text = ""; } return(true); } if (keyData == Keys.Escape) { //this.Close(); } return(base.ProcessCmdKey(ref msg, keyData)); }