public void refresh() { try { try { ldtPriceQuotation = loPriceQuotation.getAllData("ViewAll", "", ""); } catch { ldtPriceQuotation = null; } loSearches.lQuery = ""; GlobalFunctions.refreshGrid(ref dgvList, ldtPriceQuotation); viewDetails(); } catch (Exception ex) { throw ex; } }
private void cboPriceQuotation_SelectedIndexChanged(object sender, EventArgs e) { try { foreach (DataRow _dr in loPriceQuotation.getAllData("", cboPriceQuotation.SelectedValue.ToString(), "").Rows) { txtReference.Text = _dr["Reference"].ToString(); txtTerms.Text = _dr["Terms"].ToString(); dtpDueDate.Value = DateTime.Now.AddDays(double.Parse(txtTerms.Text)); cboSalesPerson.Text = _dr["Sales Person"].ToString(); txtInstructions.Text = _dr["Instructions"].ToString(); } if (lOperation == GlobalVariables.Operation.Add) { dgvDetailStockInventory.Rows.Clear(); foreach (DataRow _drDetails in loPriceQuotationDetail.getPriceQuotationDetails("", cboPriceQuotation.SelectedValue.ToString()).Rows) { int i = dgvDetailStockInventory.Rows.Add(); dgvDetailStockInventory.Rows[i].Cells["Id"].Value = ""; dgvDetailStockInventory.Rows[i].Cells["StockId"].Value = _drDetails["StockId"].ToString(); dgvDetailStockInventory.Rows[i].Cells["StockCode"].Value = _drDetails["Stock Code"].ToString(); dgvDetailStockInventory.Rows[i].Cells["StockDescription"].Value = _drDetails["Stock Description"].ToString(); dgvDetailStockInventory.Rows[i].Cells["Unit"].Value = _drDetails["Unit"].ToString(); dgvDetailStockInventory.Rows[i].Cells["LocationId"].Value = _drDetails["LocationId"].ToString(); dgvDetailStockInventory.Rows[i].Cells["Location"].Value = _drDetails["Location"].ToString(); dgvDetailStockInventory.Rows[i].Cells["SOQty"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Qty"].ToString())); dgvDetailStockInventory.Rows[i].Cells["QtyOut"].Value = "0.00"; dgvDetailStockInventory.Rows[i].Cells["QtyVariance"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Qty"].ToString())); dgvDetailStockInventory.Rows[i].Cells["UnitPrice"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Unit Price"].ToString())); dgvDetailStockInventory.Rows[i].Cells["DiscountId"].Value = _drDetails["DiscountId"].ToString(); dgvDetailStockInventory.Rows[i].Cells["Discount"].Value = _drDetails["Discount"].ToString(); dgvDetailStockInventory.Rows[i].Cells["DiscountAmount"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Discount Amount"].ToString())); dgvDetailStockInventory.Rows[i].Cells["TotalPrice"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Total Price"].ToString())); dgvDetailStockInventory.Rows[i].Cells["Remarks"].Value = _drDetails["Remarks"].ToString(); dgvDetailStockInventory.Rows[i].Cells["Status"].Value = "Add"; } } } catch { dgvDetailStockInventory.Rows.Clear(); } computeTotalAmount(); }
private void PriceQuotationDetailUI_Load(object sender, EventArgs e) { try { this.BackColor = Color.FromArgb(int.Parse(GlobalVariables.FormBackColor)); cboCustomer.DataSource = loCustomer.getAllData("ViewAll", "", ""); cboCustomer.DisplayMember = "Name"; cboCustomer.ValueMember = "Id"; cboCustomer.SelectedIndex = -1; try { cboSalesPerson.DataSource = loSalesPerson.getAllData("ViewAll", "", ""); cboSalesPerson.DisplayMember = "Name"; cboSalesPerson.ValueMember = "Id"; cboSalesPerson.SelectedIndex = -1; } catch { } if (lOperation == GlobalVariables.Operation.Edit) { foreach (DataRow _dr in loPriceQuotation.getAllData("", lPriceQuotationId, "").Rows) { txtId.Text = _dr["Id"].ToString(); dtpDate.Value = GlobalFunctions.ConvertToDate(_dr["Date"].ToString()); txtReference.Text = _dr["Reference"].ToString(); cboCustomer.Text = _dr["Customer"].ToString(); txtTerms.Text = _dr["Terms"].ToString(); txtInstructions.Text = _dr["Instructions"].ToString(); dtpValidUntil.Value = GlobalFunctions.ConvertToDate(_dr["Valid Until"].ToString()); cboSalesPerson.Text = _dr["Sales Person"].ToString(); dtpShipDate.Value = GlobalFunctions.ConvertToDate(_dr["Ship Date"].ToString()); txtShipVia.Text = _dr["Ship Via"].ToString(); txtTotalQty.Text = string.Format("{0:n}", decimal.Parse(_dr["Total Qty"].ToString())); txtTotalAmount.Text = string.Format("{0:n}", decimal.Parse(_dr["Total Amount"].ToString())); txtRemarks.Text = _dr["Remarks"].ToString(); foreach (DataRow _drDetails in loPriceQuotationDetail.getPriceQuotationDetails("", lPriceQuotationId).Rows) { int i = dgvDetail.Rows.Add(); dgvDetail.Rows[i].Cells["Id"].Value = _drDetails["Id"].ToString(); dgvDetail.Rows[i].Cells["StockId"].Value = _drDetails["StockId"].ToString(); dgvDetail.Rows[i].Cells["StockCode"].Value = _drDetails["Stock Code"].ToString(); dgvDetail.Rows[i].Cells["StockDescription"].Value = _drDetails["Stock Description"].ToString(); dgvDetail.Rows[i].Cells["Unit"].Value = _drDetails["Unit"].ToString(); dgvDetail.Rows[i].Cells["LocationId"].Value = _drDetails["LocationId"].ToString(); dgvDetail.Rows[i].Cells["Location"].Value = _drDetails["Location"].ToString(); dgvDetail.Rows[i].Cells["Qty"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Qty"].ToString())); dgvDetail.Rows[i].Cells["UnitPrice"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Unit Price"].ToString())); dgvDetail.Rows[i].Cells["DiscountId"].Value = _drDetails["DiscountId"].ToString(); dgvDetail.Rows[i].Cells["Discount"].Value = _drDetails["Discount"].ToString(); dgvDetail.Rows[i].Cells["DiscountAmount"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Discount Amount"].ToString())); dgvDetail.Rows[i].Cells["TotalPrice"].Value = string.Format("{0:n}", decimal.Parse(_drDetails["Total Price"].ToString())); dgvDetail.Rows[i].Cells["Remarks"].Value = _drDetails["Remarks"].ToString(); dgvDetail.Rows[i].Cells["Status"].Value = "Saved"; } computeTotalAmount(); } } else { foreach (DataRow _dr in loCommon.getNextTabelSequenceId("PriceQuotation").Rows) { txtId.Text = _dr[0].ToString(); } cboCustomer.Focus(); } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "PriceQuotationDetailUI_Load"); em.ShowDialog(); return; } }