private void BindAversiData() { var helper = new AversiHelper(_file, _unitPricePct, _taxRate); var table = new DS_Aversi.T_ImportDataTable(); helper.Fill(table); foreach (var row in table) { if (row.IsNAM_MATNull() || row.NAM_MAT.Trim().Length == 0) { continue; } var newRow = ds_Import.PurchaseOrderDetail.NewPurchaseOrderDetailRow(); newRow.ReceivedQty = row.NUM_KRIT; newRow.UnitPrice = row.ZAK_PRI; newRow.TaxRate = _taxRate / 100m; newRow.ListPrice = MathHelper.AddPct(row.PRICE, _taxRate);//გასარკვევია შედის თუ არა პსპ-ში დღგ... newRow.ProductCurrencyCode = GlobalVariable.MyCompanyConditionalUnitCurrencyCode; if (!row.IsSERIANull()) { newRow.Serie = row.SERIA; } if (!row.IsDAT_GOODNull()) { newRow.ValidDate = row.DAT_GOOD; } if (!row.IsPRONAMENull()) { newRow.BrandName = row.PRONAME; } if (!row.IsNAM_CONGNull()) { newRow.CountryName = row.NAM_CONG; } newRow.MedicamentName = row.NAM_MAT.Trim(); ds_Import.PurchaseOrderDetail.AddPurchaseOrderDetailRow(newRow); } }
public void Translate(DS_PSP.T_DBFDataTable table) { foreach (var row in table) { if (!row.IsNAME_GEONull()) { row.NAME_GEO = GeoConvertHelper.Convert(row.NAME_GEO, GeoConvertHelper.PSP, GeoConvertHelper.Unicode); } if (!row.IsNAME_MANUFNull()) { row.NAME_MANUF = GeoConvertHelper.Convert(row.NAME_MANUF, GeoConvertHelper.PSP, GeoConvertHelper.Unicode); } if (!row.IsCOUNTRYNull()) { row.COUNTRY = GeoConvertHelper.Convert(row.COUNTRY, GeoConvertHelper.PSP, GeoConvertHelper.Unicode); } //შესასყიდი ფასი row._UNIT_PRICE_USD = (_UnitPricePct == 0m ? MathHelper.RemoveAddedPct(row.SUM_USD, _TaxRate) : MathHelper.RemoveAddedPct(MathHelper.AddPct(row.SUM_USD_D, _UnitPricePct), _TaxRate)); row._UNIT_PRICE_GEL = (_UnitPricePct == 0m ? MathHelper.RemoveAddedPct(row.SUM_LAR, _TaxRate) : MathHelper.RemoveAddedPct(MathHelper.AddPct(row.SUM_LAR_D, _UnitPricePct), _TaxRate)); if (!row.IsVADANull()) { int year; int month; var vada = row.VADA.Split('/'); if (vada.Length == 2) { int.TryParse(vada[1].Trim(), out year); int.TryParse(vada[0].Trim(), out month); if (year >= DateTimeHelper.MinDate.Year && year <= DateTimeHelper.MaxDate.Year && month > 0 && month < 13) { row._VADA = new DateTime(year, month, 1); } } } } }
public void InitNewValues() { if (!_IsAllowedChangePrice) { return; } try { Application.DoEvents(); Cursor = Cursors.WaitCursor; var rate = CurrencyRate; if (rate <= 0m) { XtraMessageBox.Show(this, "ვალუტის კურსი არ დაფიქსირდა ან ვალუტა არ გაქვთ არჩეული ფილტრში.", "გაფრთხილება", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } view.BeginDataUpdate(); foreach (var rowHandle in view.GetSelectedRows()) { var row = (DS_Product.VW_ProductRow)view.GetDataRow(rowHandle); var isChanged = false; if (chkNewPriceFromStandardCost.Checked) { row.NewListPrice = MathHelper.AddPct(row.StandardCost, row.TaxRate * 100m) * (1m + spinNewPriceFromStandardCost.Value); isChanged = true; } else if (chkNewListPrice.Checked) { row.NewListPrice = row.ListPrice * (1m + spinNewListPrice.Value); isChanged = true; } else { row.NewListPrice = row.ListPrice; } row._NewListPrice = row.NewListPrice * row.ProductCurrencyRate / rate; if (chkNewDealerPrice.Checked) { row.NewDealerPrice = row.DealerPrice * (1m + spinNewDealerPrice.Value); isChanged = true; } else { row.NewDealerPrice = row.DealerPrice; } row._NewDealerPrice = row.NewDealerPrice * row.ProductCurrencyRate / rate; if (chkNewDiscountPct.Checked) { row.NewDiscountPct = spinNewDiscountPct.Value; isChanged = true; } else { row.NewDiscountPct = row.DiscountPct; } row.IsChanged = isChanged; } } catch (Exception ex) { XtraMessageBox.Show(this, string.Format("შეცდომა ფასების ცვლილებისას.\n{0}", ex.Message), "შეცდომა", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { view.EndDataUpdate(); Cursor = Cursors.Default; } }