public frmCostingBase(IConfigurationService configurationService, IWinSettingProvider winSettingProvider) : this() { _configurationService = configurationService; _winSettingProvider = winSettingProvider; CostingRate = new CostingRates(); }
public frmExcelCostingRates(ISupplierService supplierService, IWinSettingProvider winSettingProvider , ITransactionService costingServices, IJewelCalculation jewelCalculation) : this() { _winSettingProvider = winSettingProvider; _costingServices = costingServices; _jewelCalculation = jewelCalculation; Collection = new List <ConfigurationMaster>(); CostingRate = new CostingRates(); PurchaseTransactionItems = new List <JewelTransaction>(); _costingDetails = new CostingDetail(); cboCustomer.DataSource = supplierService.GetActiveSuppliers(); cboCustomer.SelectedIndex = -1; dtCosting.Value = DateTime.Now; }
void Calculate(DataGridView mapGrid, CostingRates costingRates, out List <JewelTransaction> jewelTransaction) { jewelTransaction = new List <JewelTransaction>(); var tranLookupKey = Guid.NewGuid(); foreach (var item in mapGrid.Rows) { var row = (DataGridViewRow)item; var jewelNo = row.GetCellValue(_columnjewelnumber); var tranDetails = _transactionServices.GetJewelTransactionsByJewelNo(jewelNo); var tran = new JewelTransaction { JewelTransactionRowId = tranLookupKey, TransactionType = ApprovalSelection ? TransactionType.ApprovalTransaction : TransactionType.MarketingTransaction, CostingDetail = new CostingDetail { Properties = costingRates }, CertificateNumber = tranDetails.CertificateNumber, CStonePcs = tranDetails.CStonePcs, CStoneWeight = tranDetails.CStoneWeight, DesignCode = tranDetails.DesignCode, JewelNumber = tranDetails.JewelNumber, JewelTransactionId = tranDetails.JewelTransactionId, JewelType = tranDetails.JewelType, KT = tranDetails.KT, MetalColor = tranDetails.MetalColor, JewelItemCategory = tranDetails.JewelItemCategory, MetalWeight = tranDetails.MetalWeight, Properties = tranDetails.Properties, StonePcs = tranDetails.StonePcs, StoneWeight = tranDetails.StoneWeight, TotalAmount = tranDetails.TotalAmount, TotalWeight = tranDetails.TotalWeight, TransactionDate = dtCosting.Value, TransactionPartyRef = ((Customer)cboCustomer.SelectedItem).CustomersCode, }; jewelTransaction.Add(tran); } _jewelCalculation.Calculate(costingRates, jewelTransaction); }
private void frmCostingRates_Load(object sender, EventArgs e) { #region Costing Form dgCostingFormat.EditingControlShowing += CostingGridEditingControlShowing; dgCostingFormat.CellValidated += OnCostingFormatCellValidated; dgCostingFormat.CellEndEdit += OnCostingFormatCellEndEdit; dgCostingFormat.CellValidating += OnCostingFormatCellValidating; dgCostingFormat.CellEnter += OnCostingFormatCellEnter; #endregion btnPrev.Click += OnPrevClick; btnSave.Click += onSaveClick; btnAddtoList.Click += OnAddtoListClick; btnClearGrid.Click += OnClearGridClick; btnClearAllItems.Click += OnClearAllItemsClick; CostingRate = (CostingRates)FormData; Collection = _configurationService.GetAllConfigurations(ItemCategory); // Configure and add a default row in the Consting grid; this is the ConsignementIn grid { ConfigDataGridView(dgCostingFormat); ResetDataGridView(dgCostingFormat); } }
bool VALIDATEDATAGRID(out CostingRates costingRates) { costingRates = new CostingRates(); decimal amount; if (Decimal.TryParse(txtStamping.Text, out amount) == false) { errorProvider.SetError(txtStamping, Resources.frmMemoOrder_VALIDATEDATAGRID_The_stamping_charges_is_invalid_); MessageBox.Show(Resources.frmMemoOrder_VALIDATEDATAGRID_The_stamping_charges_is_invalid_, Constants.ALERTMESSAGEHEADER); return(false); } AllErrors.Clear(); // Validate grid and form CostingRates foreach (var item in dgDataControl.Rows) { var row = (DataGridViewRow)item; decimal AmountValue; var IsAmount = Decimal.TryParse(row.GetCellValue(_columndgAmount), out AmountValue); var colName = row.GetCellValue(_columnCategory) + " " + row.GetCellValue(_columndgPartticulatrs) + row.GetCellValue(_columndgType); var msg = String.Format("Amount field is required for item '{0}'", colName); if (!IsAmount || AmountValue == 0.0M) { AllErrors.Add("InValisAmount" + Guid.NewGuid(), msg); } if (row.GetCellValue(_columnCategory) == ProductCategory.Labour.ToString()) { if (row.ValidateDependentProperties(_columndgMinimumAmount) == false) { AllErrors.Add("MinimumAmount" + Guid.NewGuid(), msg); } decimal MinAmountValue; Decimal.TryParse(row.GetCellValue(_columndgMinimumAmount), out MinAmountValue); } } if (AllErrors.Count > 0) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return(false); } // Create CostingRates Chart foreach (var item in dgDataControl.Rows) { var row = (DataGridViewRow)item; costingRates.CostingItems.Add(new CostingDetails { ProductCategory = row.GetParsedCellValue <ProductCategory>(_columnCategory), Particulars = row.GetCellValue(_columndgPartticulatrs), ConfigurationValue = row.GetCellValue(_columndgType), Amount = Decimal.Parse(row.GetCellValue(_columndgAmount)), MinimumAmount = row.GetParsedCellValue(_columndgMinimumAmount, defaultValue: 0.0M) }); costingRates.StampingRates = Convert.ToDecimal(txtStamping.Text); } CertificateRates certificateRate; dgCertificatesCostingRates.CreateCertificateRate(out certificateRate); costingRates.CertificateRate = certificateRate; return(true); }
void onbtnNextClick(object sender, EventArgs e) { if (dgvJewel.Rows.Count <= 0) { MessageBox.Show(Resources.frmMemoOrder_onbtnNextClick_Please_select_record_to_create_memo__); return; } btnPrev.Enabled = true; btnNext.Enabled = false; dgDataControl.Rows.Clear(); var CostingRate = new CostingRates(); dgDataControl.Rows.Clear(); foreach (DataGridViewRow dgvr in dgvJewel.Rows) { var JewelNumber = dgvr.GetCellValue(_columnjewelnumber); var Jewel = _transactionServices.GetJewelTransactionsByJewelNo(JewelNumber); if (Jewel != null) { var costingProperties = Jewel.CostingDetail.Properties.CostingItems; var metalItem = Jewel.Properties.ItemDetails.MetalDetail; var metalcostingItem = costingProperties.Where(r => r.ProductCategory == ProductCategory.Metal && r.Particulars == metalItem.MetalType); CostingRate.CostingItems.AddRange(metalcostingItem); var stoneItem = Jewel.Properties.ItemDetails.StoneDetail; var stonecostingItem = costingProperties .Where(r => r.ProductCategory == ProductCategory.Stone && stoneItem.StoneType == r.Particulars && stoneItem.StoneChart.StoneMetaDetailList.Any(c => c.StoneSieveSz == r.ConfigurationValue) ); CostingRate.CostingItems.AddRange(stonecostingItem); var csItem = Jewel.Properties.ItemDetails.ColorStoneDetail; var cscostingItem = costingProperties.Where(r => r.ProductCategory == ProductCategory.ColorStone && r.Particulars == csItem.ColorStoneType); CostingRate.CostingItems.AddRange(cscostingItem); var laborItem = Jewel.JewelType; var laborcostingItem = costingProperties.Where(r => r.ProductCategory == ProductCategory.Labour && r.Particulars == laborItem); CostingRate.CostingItems.AddRange(laborcostingItem); } } { grpStep1.Visible = false; grpStep2.Visible = true; } { grpStep1.SendToBack(); grpStep2.BringToFront(); } var bindingObject = (from list in CostingRate.CostingItems orderby list.ProductCategory select new { Category = list.ProductCategory, Product = list.ProductCategory, Description = list.Particulars, list.ConfigurationValue }).Distinct(); foreach (var item in bindingObject) { dgDataControl.Rows.Add(item.Category, item.Product, item.Description, item.ConfigurationValue, 0.000, 0.000); } dgCertificatesCostingRates.Rows.Clear(); dgCertificatesCostingRates.Rows.Add(1, 0, 0.00, 000.00); dgCertificatesCostingRates.Rows.Add(2, 0, 0.00, 000.00); dgCertificatesCostingRates.Rows.Add(3, 0, 99999999, 000.00); { dgDataControl.ReadOnly = false; btnSave.Enabled = true; } }