protected CurrencyInfoWrapper ToCurrencyInfoWrapper(CurrencyInfo currencyInfo) { if (currencyInfo == null) return null; return new CurrencyInfoWrapper(currencyInfo); }
protected void Page_Load(object sender, EventArgs e) { product = SKUInfoProvider.GetSKUInfo(ProductID); // Mark selected tab UIContext.ProductTab = ProductTabEnum.VolumeDiscounts; EditedObject = product; if (product != null) { // Check site id CheckEditedObjectSiteID(product.SKUSiteID); // Load product currency productCurrency = CurrencyInfoProvider.GetMainCurrency(product.SKUSiteID); // Display product price lblProductPrice.Text = CurrencyInfoProvider.GetFormattedPrice(product.SKUPrice, productCurrency); } // Set unigrid properties SetUnigridProperties(); // Initialize the master page elements InitializeMasterPage(); }
protected void Page_Load(object sender, EventArgs e) { if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "Products.VolumeDiscounts")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "Products.VolumeDiscounts"); } productId = QueryHelper.GetInteger("productId", 0); product = SKUInfoProvider.GetSKUInfo(productId); EditedObject = product; if (product != null) { // Check site id CheckEditedObjectSiteID(product.SKUSiteID); // Load product currency productCurrency = CurrencyInfoProvider.GetMainCurrency(product.SKUSiteID); } // Set unigrid properties SetUnigridProperties(); // Initialize the master page elements InitializeMasterPage(); }
protected void Page_Load(object sender, EventArgs e) { product = SKUInfoProvider.GetSKUInfo(ProductID); // Setup help object options = new { helpName = "lnkProductEditHelp", helpUrl = UIContextHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK) }; ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options); EditedObject = product; if (product != null) { // Check site id CheckEditedObjectSiteID(product.SKUSiteID); // Load product currency productCurrency = CurrencyInfoProvider.GetMainCurrency(product.SKUSiteID); // Display product price headProductPriceInfo.Text = string.Format(GetString("com_sku_volume_discount.skupricelabel"), CurrencyInfoProvider.GetFormattedPrice(product.SKUPrice, productCurrency)); } // Set unigrid properties SetUnigridProperties(); // Initialize the master page elements InitializeMasterPage(); }
/// <summary> /// Sets data to database. /// </summary> protected void btnOK_Click(object sender, EventArgs e) { // Check permissions CheckConfigurationModification(); string errorMessage = ValidateForm(); // Check whether the main currency is being disabled CurrencyInfo main = CurrencyInfoProvider.GetMainCurrency(ConfiguredSiteID); if ((main != null) && (main.CurrencyID == mCurrencyId) && !chkCurrencyEnabled.Checked) { errorMessage = String.Format(GetString("ecommerce.disablemaincurrencyerror"), main.CurrencyDisplayName); } if (errorMessage == "") { // CurrencyName must be unique (configured site scope) CurrencyInfo currencyObj = CurrencyInfoProvider.GetCurrencyInfo(txtCurrencyName.Text.Trim(), SiteInfoProvider.GetSiteName(ConfiguredSiteID)); // If currencyName value is unique if ((currencyObj == null) || (currencyObj.CurrencyID == mCurrencyId)) { // If currencyName value is unique -> determine whether it is update or insert if ((currencyObj == null)) { // Get CurrencyInfo object by primary key currencyObj = CurrencyInfoProvider.GetCurrencyInfo(mCurrencyId); if (currencyObj == null) { // Create new item -> insert currencyObj = new CurrencyInfo(); currencyObj.CurrencySiteID = ConfiguredSiteID; currencyObj.CurrencyIsMain = false; } } currencyObj.CurrencyDisplayName = txtCurrencyDisplayName.Text.Trim(); currencyObj.CurrencyName = txtCurrencyName.Text.Trim(); currencyObj.CurrencyCode = txtCurrencyCode.Text.Trim(); currencyObj.CurrencyFormatString = txtFormatString.Text.Trim(); // Set null if not specified currencyObj.CurrencyRoundTo = ValidationHelper.GetInteger(txtCurrencyRoundTo.Text.Trim(), -1); currencyObj.CurrencyEnabled = chkCurrencyEnabled.Checked; CurrencyInfoProvider.SetCurrencyInfo(currencyObj); URLHelper.Redirect("Currency_Edit.aspx?currencyid=" + Convert.ToString(currencyObj.CurrencyID) + "&saved=1&siteId=" + SiteID); } else { // Show error message ShowError(GetString("Currency_Edit.CurrencyNameExists")); } } else { // Show error message ShowError(errorMessage); } }
protected void Page_Load(object sender, EventArgs e) { if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "Customers.Credit")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "Customers.Credit"); } // Get site id of credits main currency creditCurrencySiteId = ECommerceHelper.GetSiteID(CMSContext.CurrentSiteID, ECommerceSettings.USE_GLOBAL_CREDIT); // Get currency in which credit is expressed in currency = CurrencyInfoProvider.GetMainCurrency(creditCurrencySiteId); // Get customerId from url customerId = QueryHelper.GetInteger("customerid", 0); // Load customer info customerObj = CustomerInfoProvider.GetCustomerInfo(customerId); // Check if customer belongs to current site if (!CheckCustomerSiteID(customerObj)) { customerObj = null; } // Check, if edited customer exists EditedObject = customerObj; // Init unigrid UniGrid.HideControlForZeroRows = true; UniGrid.OnAction += new OnActionEventHandler(uniGrid_OnAction); UniGrid.OnExternalDataBound += new OnExternalDataBoundEventHandler(UniGrid_OnExternalDataBound); UniGrid.OrderBy = "EventDate DESC, EventName ASC"; UniGrid.WhereCondition = "EventCustomerID = " + customerId + " AND ISNULL(EventSiteID, 0) = " + creditCurrencySiteId; if (customerObj != null) { InitializeMasterPage(); // Configuring global records if (creditCurrencySiteId == 0) { // Show "using global settings" info message only if showing global store settings lblGlobalInfo.Visible = true; lblGlobalInfo.Text = GetString("com.UsingGlobalSettings"); } // Display customer total credit lblCredit.Text = GetString("CreditEvent_List.TotalCredit"); lblCreditValue.Text = GetFormatedTotalCredit(); } }
protected void Page_Load(object sender, EventArgs e) { // Get site id of credits main currency creditCurrencySiteId = ECommerceHelper.GetSiteID(SiteContext.CurrentSiteID, ECommerceSettings.USE_GLOBAL_CREDIT); // Get currency in which credit is expressed in currency = CurrencyInfoProvider.GetMainCurrency(creditCurrencySiteId); // Get customerId from url customerId = QueryHelper.GetInteger("customerid", 0); // Load customer info customerObj = CustomerInfoProvider.GetCustomerInfo(customerId); // Check if customer belongs to current site if (!CheckCustomerSiteID(customerObj)) { customerObj = null; } // Check, if edited customer exists EditedObject = customerObj; // Init unigrid UniGrid.HideControlForZeroRows = true; UniGrid.OnAction += uniGrid_OnAction; UniGrid.OnExternalDataBound += UniGrid_OnExternalDataBound; UniGrid.OrderBy = "EventDate DESC, EventName ASC"; UniGrid.WhereCondition = "EventCustomerID = " + customerId + " AND ISNULL(EventSiteID, 0) = " + creditCurrencySiteId; if (customerObj != null) { InitializeMasterPage(); // Configuring global credit if (creditCurrencySiteId == 0) { var site = SiteContext.CurrentSite; if (site != null) { // Show "using global credit" info message ShowInformation(string.Format(GetString("com.UsingGlobalSettings"), site.DisplayName, GetString("com.ui.creditevents"))); } } // Display customer total credit headTotalCredit.Text = string.Format(GetString("CreditEvent_List.TotalCredit"), GetFormattedTotalCredit()); } }
public void TestFormatWithFormatCFormatsUsingCurrentCurrencyWhenSpecifiedCurrencyDoesNotMatch() { Decimal amount = Random.RandomDecimal(); CurrencyInfo currencyInfo = CurrencyInfoProvider.Current.Get("GBP"); CultureInfo provider = new CultureInfo("De-de"); // No pound in Germany, nor any German speaking countries. Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-ca"); Financial financial = new Financial(currencyInfo, amount); List <String> expectedFormats = CultureInfoProvider.Current.FindByCurrency(currencyInfo).Select( mc => String.Format(mc, "{0:C}", amount)).ToList(); String actualFormat = String.Format(provider, "{0:C}", financial); CollectionAssert.Contains(expectedFormats, actualFormat); }
/// <summary> /// Implements call to Twofish method FindCurrency /// </summary> /// <param name="currencyInfo">id, appId</param> /// <param name="commmonKeyValue">Twofish REST service common values</param> /// <param name="baseAddress">Twofish REST service base address</param> /// <returns>XmlDocument document containing the list of currency's for the application</returns> public XmlDocument FindCurrency(CurrencyInfo currencyInfo, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress) { ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue); Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false); if (currencyInfo != null) { keyValues.Add("currency.id", currencyInfo.CurrencyId); keyValues.Add("currency.appId", currencyInfo.CurrencyAppId); } DebugLog("FindCurrency", keyValues); return(rest.GetXMLRequest("currency", keyValues)); }
public CurrencyInfo GetCurrency(string code) { CurrencyInfo info = null; DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Pay_Currencys WHERE LOWER(Code) = LOWER(@Code)"); this.database.AddInParameter(sqlStringCommand, "Code", DbType.String, code); using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { if (reader.Read()) { info = this.PopulateCurrencyFromDataReader(reader); } } return(info); }
protected void Page_Load(object sender, EventArgs e) { shippingOption = EditedObjectParent as ShippingOptionInfo; if (shippingOption != null) { CheckEditedObjectSiteID(shippingOption.ShippingOptionSiteID); currency = CurrencyInfoProvider.GetMainCurrency(shippingOption.ShippingOptionSiteID); } // Init unigrid gridElem.OnAction += gridElem_OnAction; gridElem.OnExternalDataBound += gridElem_OnExternalDataBound; gridElem.ZeroRowsText = GetString("com.ui.shippingcost.edit_nodata"); gridElem.GridView.AllowSorting = false; }
public void Print(CultureInfo canonical, CurrencyInfo fromConfiguration) { GlobalizationCurrencyInfo fromGlobalization = loadGlobalizationCurrency(canonical); DiffCollection diffs = fromGlobalization.Compare(fromConfiguration); if (diffs != null) { foreach (var diff in diffs) { AddRow(diff.PropertyName, diff.Configuration, diff.Globalization); } } MaybeWrite("discrepancies with System.Globalization"); }
public void TestUsdConversion() { CurrencyInfo usd = new CurrencyInfo("USD", "$", "{1}{0}"); CurrencyInfo eur = new CurrencyInfo("EUR", "€", "{1}{0}"); CurrencyExchangeConverter converter = new CurrencyExchangeConverter(usd); converter.AddRatio(eur, 0.75f); Currency currency = CurrencyProvider.GetCurrency(100, eur); Currency convertedCurrency = converter.Convert(currency, usd); Currency expectedCurrency = CurrencyProvider.GetCurrency(100 / 0.75m, usd); Assert.AreEqual(convertedCurrency.GetDecimalValue(), expectedCurrency.GetDecimalValue()); }
protected virtual void EPExpenseClaimDetails_EmployeeID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { var row = e.Row as EPExpenseClaimDetails; if (!IsCopyPasteContext && ((row.CuryTranAmt ?? 0) == 0)) { CurrencyInfo info = CurrencyInfoAttribute.SetDefaults <EPExpenseClaim.curyInfoID>(cache, row); if (info != null) { ((EPExpenseClaimDetails)e.Row).CuryID = info.CuryID; } } cache.SetDefaultExt <EPExpenseClaim.taxZoneID>(row); }
/// <summary> /// 更新币种 /// </summary> /// <param name="areaInfo"></param> /// <returns></returns> public CurrencyInfo Update(CurrencyInfo currencyInfo) { var cmd = DataCommandManager.CreateCustomDataCommandFromConfig("UpdateCurrency"); string sql = cmd.CommandText; cmd.SetParameterValue("@SysNo", currencyInfo.SysNo); cmd.SetParameterValue("@CurrencyName", currencyInfo.CurrencyName); cmd.SetParameterValue("@CurrencySymbol", currencyInfo.CurrencySymbol); cmd.SetParameterValue("@ExchangeRate", currencyInfo.ExchangeRate); cmd.SetParameterValue("@IsLocal", currencyInfo.IsLocal); cmd.SetParameterValue("@Status", currencyInfo.Status); cmd.SetParameterValue("@ListOrder", currencyInfo.ListOrder); cmd.ExecuteNonQuery(); return(currencyInfo); }
public CurrencyInfo Load(int sysNo) { DataCommand cmd = DataCommandManager.GetDataCommand("GetCurrency"); cmd.SetParameterValue("@SysNo", sysNo); DataSet ds = cmd.ExecuteDataSet(); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow row = ds.Tables[0].Rows[0]; CurrencyInfo currency = DataMapper.GetEntity <CurrencyInfo>(row); return(currency); } return(null); }
private void InsertDefaultValues() { Dictionary <String, String> currencies = CReadFromFileService.ReadFromFileAsDictionary(_path); CCurrencyGateway currencyGateway = new CCurrencyGateway(); foreach (var currency in currencies) { CurrencyInfo curInfo = new CurrencyInfo(); curInfo.Name = currency.Value; curInfo.Code = currency.Key; currencyGateway.Create(curInfo); } Upgrade(); }
public void Run() { CurrencyIsoCode currency = Currency.Code.Parse(CurrencyCode); CanonicalCultureAttribute attribute = ensureCanonical(currency); ICurrencyInfoProvider provider = new EmbeddedXmlProvider(); CurrencyInfo fromConfiguration = provider.Get(currency); Console.WriteLine(Environment.NewLine); new GlobalizationDiscrepanciesTable().Print(attribute.Culture(), fromConfiguration); FileInfo cache = Path.IsPathRooted(IsoFilePath) ? new FileInfo(IsoFilePath) : null; new IsoDiscrepanciesTable().Print(currency, cache); }
public static void validateAddCurrency(CurrencyInfo currencyInfo) { if (currencyInfo.StandardId == 0) { throw new DataValidationException($"StandardId does not exists"); } if (string.IsNullOrEmpty(currencyInfo.CurrencyName)) { throw new DataValidationException($"CurrencyName does not exists"); } if (string.IsNullOrEmpty(currencyInfo.CurrencySymbol)) { throw new DataValidationException($"CurrencySymbol does not exists"); } }
protected virtual void BaseFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e, string curyField, string baseField) { if (!FormatValue(e, sender.Graph.Culture)) { return; } CurrencyInfo info = GetCurrencyInfo(Documents.Current); if (info != null) { PopulatePrecision(currencyinfo.Cache, info); e.NewValue = Math.Round((decimal)e.NewValue, (int)(info.BasePrecision ?? (short)2), MidpointRounding.AwayFromZero); } }
public void BatchRegister(CurrencyInfo objCurrencyInfo) { string sql = null; List <DbParameter> parameterList = new List <DbParameter>(); sql = " update tbl_currency_info set OrgId=@OrgId, DeviceKindCode=@DeviceKindCode, DeviceModelCode=@DeviceModelCode " + " where DeviceNumber=@DeviceNumber and OrgId=0 and DeviceKindCode=0 and DeviceModelCode=0 "; parameterList.Add(new MySqlParameter("@DeviceNumber", objCurrencyInfo.DeviceNumber)); parameterList.Add(new MySqlParameter("@OrgId", objCurrencyInfo.OrgId)); parameterList.Add(new MySqlParameter("@DeviceKindCode", objCurrencyInfo.DeviceKindCode)); parameterList.Add(new MySqlParameter("@DeviceModelCode", objCurrencyInfo.DeviceModelCode)); DbHelper.ExecuteNonQuery(sql, CommandType.Text, parameterList.ToArray()); }
public int UpdateCurrencyInfo(CurrencyInfo _CurrencyInfo) { try { int result = 0; bool IsRecordExist; if (!string.IsNullOrWhiteSpace(_CurrencyInfo.CurrencyId)) { IsRecordExist = _IUoW.Repository <CurrencyInfo>().IsRecordExist(x => x.CurrencyId == _CurrencyInfo.CurrencyId); if (IsRecordExist) { var _oldCurrencyInfo = _IUoW.Repository <CurrencyInfo>().GetBy(x => x.CurrencyId == _CurrencyInfo.CurrencyId); var _oldCurrencyInfoForLog = ObjectCopier.DeepCopy(_oldCurrencyInfo); _oldCurrencyInfo.AuthStatusId = _CurrencyInfo.AuthStatusId = "U"; _oldCurrencyInfo.LastAction = _CurrencyInfo.LastAction = "EDT"; _oldCurrencyInfo.LastUpdateDT = _CurrencyInfo.LastUpdateDT = System.DateTime.Now; _CurrencyInfo.MakeBy = "mtaka"; result = _IUoW.Repository <CurrencyInfo>().Update(_oldCurrencyInfo); #region Testing Purpose #endregion #region Auth Log if (result == 1) { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; result = _IAuthLogService.AddAuthLog(_IUoW, _oldCurrencyInfoForLog, _CurrencyInfo, "EDT", "0001", "090101001", 1, "CurrencyInfo", "MTK_CP_CURRENCY_INFO", "CurrencyId", _CurrencyInfo.CurrencyId, "mtaka", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } #endregion if (result == 1) { _IUoW.Commit(); } return(result); } } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "UpdateCurrencyInfo(obj)", string.Empty); return(0); } }
private void ProcessDefaultPayments(List <APAdjust> defaultPayments, PayBillsFilter filter, CurrencyInfo currencyInfo, PaymentMethod paymentMethod) { try { var graph = PXGraph.CreateInstance <APPayBills>(); graph.CreatePayments(defaultPayments, filter, currencyInfo, paymentMethod); } finally { var payments = GetGeneratedPayments(defaultPayments); payments.ForEach(p => lienWaiverHoldPaymentService.HoldPaymentIfNeeded(p, LienWaiverSetup.Current.ShouldStopPayments)); Base.Caches <APPayment>().Persist(PXDBOperation.Update); } }
/// <summary> /// 创建币种 /// </summary> /// <param name="currencyInfo"></param> /// <returns></returns> public CurrencyInfo Create(CurrencyInfo currencyInfo) { DataCommand cmd = DataCommandManager.GetDataCommand("CreateCurrency"); cmd.SetParameterValue("@CurrencyName", currencyInfo.CurrencyName); cmd.SetParameterValue("@CurrencySymbol", currencyInfo.CurrencySymbol); cmd.SetParameterValue("@IsLocal", currencyInfo.IsLocal); cmd.SetParameterValue("@ExchangeRate", currencyInfo.ExchangeRate); cmd.SetParameterValue("@ListOrder", currencyInfo.ListOrder); cmd.SetParameterValue("@Status", currencyInfo.Status); cmd.ExecuteNonQuery(); currencyInfo.SysNo = (int)cmd.GetParameterValue("@SysNo"); //currencyInfo.CurrencyName = cmd.GetParameterValue("@CurrencyName").ToString(); return(currencyInfo); }
/// <summary> /// Returns order total /// </summary> /// <param name="inventoryType"></param> /// <returns></returns> private static CurrencyDTO GetCurrencyDTO(CurrencyInfo currency) { try { return(new CurrencyDTO { KenticoCurrencyID = currency.CurrencyID, CurrencyCode = currency.CurrencyCode }); } catch (Exception ex) { EventLogProvider.LogInformation("ShoppingCartHelper", "GetOrderTotal", ex.Message); return(null); } }
public PoloniexExchangeMarket(PoloniexExchange aExchangeInstance, ICurrencyIdentity aCurrency, GetWalletIDDelegate aGetWalletIDFunction, string aPairName) : base(aExchangeInstance) { MarketPairID = string.IsNullOrEmpty(aPairName) ? throw new ArgumentException("Poloniex pair name can not be null or empty") : aPairName; var lPoloniexBuyingTicker = GetPairTicker(aPairName, aCurrency.Ticker, out bool lIsBase); var lPoloniexBuyingName = aExchangeInstance.GetPoloniexCurrency(lPoloniexBuyingTicker)?.name ?? throw new Exception("market currency pair info not found"); SellingCurrencyInfo = aCurrency; BuyingCurrencyInfo = new CurrencyInfo(aGetWalletIDFunction) { Ticker = lPoloniexBuyingTicker, Name = lPoloniexBuyingName, Id = aGetWalletIDFunction?.Invoke(lPoloniexBuyingTicker) ?? 0 }; MarketBaseCurrencyInfo = lIsBase ? BuyingCurrencyInfo : SellingCurrencyInfo; MinimumTrade = 0.0001M; //This info I found it at the web }
private void displayDifferences(CultureCurrencyInfo fromGlobalization, CurrencyInfo fromConfiguration, IEnumerable <KeyValuePair <string, Pair> > differences, TextMessageWriter writer) { displayCultureInformation(writer, fromGlobalization, fromConfiguration); foreach (var diff in differences) { displayDifference(writer, diff); } writer.Flush(); WL(writer.ToString()); StringBuilder sb = writer.GetStringBuilder(); sb.Remove(0, sb.Length); RL(); }
protected virtual void CATransfer_InAccountID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { CATransfer transfer = e.Row as CATransfer; CashAccount cashaccountIn = (CashAccount)PXSelectorAttribute.Select <CATransfer.inAccountID>(sender, transfer); CurrencyInfo currinfo = PXSelect <CurrencyInfo, Where <CurrencyInfo.curyInfoID, Equal <Required <CATransfer.inCuryInfoID> >, And <CurrencyInfo.curyID, Equal <Required <CATransfer.inCuryID> > > > > .Select(this, transfer.InCuryInfoID, transfer.InCuryID); if (currinfo == null || cashaccountIn == null) { return; } if (currinfo.CuryID != cashaccountIn.CuryID) { currinfo.CuryID = cashaccountIn.CuryID; CuryInfo.Update(currinfo); } if (cashaccountIn?.CuryRateTypeID != null) { currinfo.CuryRateTypeID = cashaccountIn.CuryRateTypeID; } else { CMSetup cmsetup = PXSelect <CMSetup> .Select(this); if (!string.IsNullOrEmpty(cmsetup?.CARateTypeDflt)) { currinfo.CuryRateTypeID = cmsetup.CARateTypeDflt; } } sender.SetDefaultExt <CATransfer.inCuryID>(transfer); CuryInfo.Cache.RaiseFieldUpdated <CurrencyInfo.curyRateTypeID>(currinfo, null); if (cashaccountIn?.Reconcile != true) { transfer.ClearedIn = true; transfer.ClearDateIn = transfer.InDate; } else { transfer.ClearedIn = false; transfer.ClearDateIn = null; } CurrencyInfoAttribute.SetEffectiveDate <CATransfer.inDate, CATransfer.inCuryInfoID>(sender, e); }
/// <param name="roundingFunction"> /// The function that should be used for rounding transaction amounts. /// </param> /// <param name="isDraft"> /// Indicates whether the schedule to be created or reevaluated is a draft schedule. /// In particular, it affects whether credit line / deferral transactions would be /// generated for the schedule. /// </param> public SingleScheduleCreator( IDREntityStorage drEntityStorage, ISubaccountProvider subaccountProvider, IBusinessAccountProvider businessAccountProvider, IInventoryItemProvider inventoryItemProvider, IFinPeriodRepository finPeriodRepository, Func <decimal, decimal> roundingFunction, int?branchID, bool isDraft, Location location, CurrencyInfo currencyInfo) { if (drEntityStorage == null) { throw new ArgumentNullException(nameof(drEntityStorage)); } if (subaccountProvider == null) { throw new ArgumentNullException(nameof(subaccountProvider)); } if (businessAccountProvider == null) { throw new ArgumentNullException(nameof(businessAccountProvider)); } if (inventoryItemProvider == null) { throw new ArgumentNullException(nameof(inventoryItemProvider)); } if (roundingFunction == null) { throw new ArgumentNullException(nameof(roundingFunction)); } FinPeriodRepository = finPeriodRepository; _drEntityStorage = drEntityStorage; _subaccountProvider = subaccountProvider; _businessAccountProvider = businessAccountProvider; _inventoryItemProvider = inventoryItemProvider; _roundingFunction = roundingFunction; _isDraft = isDraft; _branchID = branchID; _location = location; _currencyInfo = currencyInfo; }
protected virtual void CuryRowInserting(PXCache sender, PXRowInsertingEventArgs e, List <Tuple <string, string> > fields, Dictionary <Type, string> topCuryInfoIDs) { string curyInfoName; if (sender.GetItemType() != GetDocumentMapping().Table&& topCuryInfoIDs.TryGetValue(sender.GetItemType(), out curyInfoName)) { CurrencyInfo info = new CurrencyInfo(); info = currencyinfo.Insert(info); currencyinfo.Cache.IsDirty = false; if (info != null) { sender.SetValue(e.Row, curyInfoName, info.CuryInfoID); sender.SetValue(e.Row, nameof(CurrencyInfo.curyID), info.CuryID); } } recalculateRowBaseValues(sender, e.Row, fields); }
public async Task <CurrencyInfo> GetSeriesOfExchangeRatesFromGivenPeriod(string currencyCode, DateTime startDate, DateTime endDate) { if (startDate > endDate) // swap dates if start date is greater than end date { DateTime temp = startDate; startDate = endDate; endDate = temp; } if (startDate < CurrencyExchangeRatesCollectionStartDate) { throw new ArgumentException( $"Start date cannot be earlier than {CurrencyExchangeRatesCollectionStartDate: d}"); } if (endDate > DateTime.Now) { throw new ArgumentException($"End date cannot be later than current date"); } TimeSpan givenPeriod = endDate - startDate; if (givenPeriod.Days > MaximumNumberOfDaysForDownloadingData) { throw new ArgumentException($"Given period cannot exceed {MaximumNumberOfDaysForDownloadingData} days"); } HttpResponseMessage response = await httpClient.GetAsync( $"exchangerates/rates/c/{currencyCode}/{startDate: yyyy-MM-dd}/{endDate: yyyy-MM-dd}/"); CurrencyInfo currencyData = null; if (response.IsSuccessStatusCode) { string body = await response.Content.ReadAsStringAsync(); ApiCurrency apiData = JsonConvert.DeserializeObject <ApiCurrency>(body); CurrencyProcessor currencyProcessor = new CurrencyProcessor(apiData); currencyData = new CurrencyInfo(currencyProcessor); } return(currencyData); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); var shippingOption = EditedObjectParent as ShippingOptionInfo; if (shippingOption != null) { CheckEditedObjectSiteID(shippingOption.ShippingOptionSiteID); currency = CurrencyInfoProvider.GetMainCurrency(shippingOption.ShippingOptionSiteID); } // Init unigrid gridElem.ZeroRowsText = GetString("com.ui.shippingcost.edit_nodata"); gridElem.GridView.RowDataBound += gridElem_RowDataBound; gridElem.GridView.AllowSorting = false; }
protected virtual void _(Events.FieldSelecting <Document, Document.curyID> e) { bool curyviewstate = Base.Accessinfo.CuryViewState; CurrencyInfo info = GetCurrencyInfo(e.Row); if (info != null) { if (!curyviewstate) { e.ReturnValue = info.CuryID; } else { e.ReturnValue = info.BaseCuryID; } } }
public BitfinexExchangeMarket(BitfinexExchange aExchangeInstance, ICurrencyIdentity aCurrency, GetWalletIDDelegate aGetWalletIDFunction, BitfinexPair aPair) : base(aExchangeInstance) { var lIsBaseCurrency = string.Equals(aPair.BaseCurrency.FullName, aCurrency.Name, StringComparison.OrdinalIgnoreCase); SellingCurrencyInfo = aCurrency; var lBuyingCurrencyTicker = lIsBaseCurrency ? aPair.DestinationCurrency.Name : aPair.BaseCurrency.Name; BuyingCurrencyInfo = new CurrencyInfo(aGetWalletIDFunction) { Ticker = lBuyingCurrencyTicker, Name = lIsBaseCurrency ? aPair.DestinationCurrency.FullName : aPair.BaseCurrency.FullName, Id = aGetWalletIDFunction?.Invoke(lBuyingCurrencyTicker) ?? 0 }; MarketPairID = aPair.MarketDetails.Pair; MarketBaseCurrencyInfo = lIsBaseCurrency ? SellingCurrencyInfo : BuyingCurrencyInfo; MinimumTrade = aPair.MarketDetails?.MinimumOrderSize ?? 0; }
private CurrencyListViewItemFeedData TransformInfoToFeed(CurrencyInfo currI) { string symbol = currI.Symbol; string name = currI.Name; var cc = currI.Quotes.Where(x => x.Currency == selectedCurrency); CurrencyLongTermValues cq = currI.Quotes.Where(x => x.Currency == selectedCurrency) .Select(y => y.LongeTermValues.Last()).FirstOrDefault(); decimal marketCap = cq.marketCap; decimal price = cq.price; decimal volume = cq.volume24; decimal percentage24 = currI.Quotes.Where(x => x.Currency == selectedCurrency) .Select(y => y.percentChange24).FirstOrDefault(); long tokens = currI.TotalSupply; DateTime dataValidity = currI.LastTimeUpdated; return(new CurrencyListViewItemFeedData(symbol, name, marketCap, price, volume, percentage24, tokens, dataValidity, selectedCurrency, currI.marketPairs, currI.TotalSupply)); }
private Currency ConvertFromMainCurrency(Currency input, CurrencyInfo target) { if (input == null) { throw new ArgumentNullException("Input is null, cannot convert"); } if (target == _mainCurrency) { return(input); } else { decimal value = input.GetDecimalValue() * (decimal)_ratios[target]; return(CurrencyProvider.GetCurrency(value, target)); } }
private static IList<CurrencyInfo> GetCurrencyInfos() { //var xDoc = XDocument.Load("http://www.nbrb.by/Services/XmlExRates.aspx?ondate=" + DateTime.Now.ToString("MM/dd/yyyy")); var xDoc = XDocument.Load(HostingEnvironment.MapPath("~/Content/XmlExRates.aspx_ondate=12_13_2015.xml")); var list = new List<CurrencyInfo>(); foreach (var item in xDoc.Elements().First().Elements()) { CurrencyInfo currencyInfo = new CurrencyInfo(); var charCode = item.Element("CharCode"); if (charCode != null) currencyInfo.CharCode = charCode.Value; var rate = item.Element("Rate"); if (rate != null) currencyInfo.Rate = double.Parse(rate.Value, CultureInfo.InvariantCulture); list.Add(currencyInfo); } return list; }
protected override void OnInit(EventArgs e) { base.OnInit(e); mEditedCurrency = EditedObject as CurrencyInfo; if (mEditedCurrency != null) { // Check if not editing object from another site CheckEditedObjectSiteID(mEditedCurrency.CurrencySiteID); } EditForm.OnItemValidation += EditForm_OnItemValidation; EditForm.OnBeforeDataLoad += EditForm_OnBeforeDataLoad; // Register check permissions EditForm.OnCheckPermissions += (s, args) => CheckConfigurationModification(); }
/// <summary> /// Cleare Function, The form will be reset here /// </summary> public void ClearFunction() { try { CurrencyBll BllCurrency = new CurrencyBll(); CurrencyInfo InfoCurrency = new CurrencyInfo(); isInEditMode = false; VoucherNumberGeneration(); FinancialYearDate(); dtpVoucherDate.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy"); dtpcheckdate.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy"); txtVoucherDate.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy"); btnDelete.Enabled = false; btnAgainRef.Enabled = false; cmbBankAccountFill(); cmbAccountNameFill(); txtAmount.Clear(); txtAmount.Enabled = true; txtcheckNo.Clear(); PrintCheck(); txtNarration.Clear(); dtblPartyBalance.Clear(); btnSave.Text = "Save"; if (!txtVoucherNo.ReadOnly) { txtVoucherNo.Focus(); } else { txtVoucherDate.Select(); } if (!btnAgainRef.Enabled) { txtAmount.ReadOnly = false; } else { txtAmount.ReadOnly = true; } if (PDCReceivableReportObj != null) { PDCReceivableReportObj.Close(); } if (PDCReceivableRegisterObj != null) { PDCReceivableRegisterObj.Close(); } } catch (Exception ex) { MessageBox.Show("PR4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
protected void Page_Load(object sender, EventArgs e) { if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Content", "ContentProduct.VolumeDiscounts")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "ContentProduct.VolumeDiscounts"); } if (this.Node != null) { if (!IsAuthorizedToModifyDocument()) { // Disable form editing disableEditing = true; // Show access denied message lblError.Text = String.Format(GetString("cmsdesk.notauthorizedtoeditdocument"), this.Node.NodeAliasPath); } // Get currency for discount value formatting sku = SKUInfoProvider.GetSKUInfo(productId); EditedObject = sku; if (sku != null) { // Check site ID CheckProductSiteID(sku.SKUSiteID); } productCurrency = CurrencyInfoProvider.GetMainCurrency(sku != null ? sku.SKUSiteID : Node.NodeSiteID); // Set action handler gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction); gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound); gridElem.WhereCondition = "VolumeDiscountSKUID = " + productId; // Set the master page actions element string[,] actions = new string[1, 10]; actions[0, 0] = HeaderActions.TYPE_LINKBUTTON; actions[0, 1] = GetString("Product_Edit_VolumeDiscount_List.NewItemCaption"); actions[0, 2] = (disableEditing ? "return false;" : "modalDialog('" + ResolveUrl("~/CMSModules/Ecommerce/Pages/Content/Product/Product_Edit_VolumeDiscount_Edit.aspx") + "?ProductID=" + productId + "&dialog=1', 'VolumeDiscounts', 500, 350);"); actions[0, 3] = null; actions[0, 4] = null; actions[0, 5] = GetImageUrl("Objects/Ecommerce_VolumeDiscount/add.png"); actions[0, 9] = (!disableEditing).ToString(); this.CurrentMaster.HeaderActions.Actions = actions; // Register modal dialog script ScriptHelper.RegisterDialogScript(this); } }
/// <summary> /// Gets and bulk updates currencies. Called when the "Get and bulk update currencies" button is pressed. /// Expects the CreateCurrency method to be run first. /// </summary> private bool GetAndBulkUpdateCurrencies() { // Prepare the parameters string where = "CurrencyName LIKE N'MyNewCurrency%'"; // Get the data DataSet currencies = CurrencyInfoProvider.GetCurrencies(where, null, 0, null); if (!DataHelper.DataSourceIsEmpty(currencies)) { // Loop through the individual items foreach (DataRow currencyDr in currencies.Tables[0].Rows) { // Create object from DataRow CurrencyInfo modifyCurrency = new CurrencyInfo(currencyDr); // Update the properties modifyCurrency.CurrencyDisplayName = modifyCurrency.CurrencyDisplayName.ToUpper(); // Update the currency CurrencyInfoProvider.SetCurrencyInfo(modifyCurrency); } return true; } return false; }
/// <summary> /// Creates currency. Called when the "Create currency" button is pressed. /// </summary> private bool CreateCurrency() { // Create new currency object CurrencyInfo newCurrency = new CurrencyInfo(); // Set the properties newCurrency.CurrencyDisplayName = "My new currency"; newCurrency.CurrencyName = "MyNewCurrency"; newCurrency.CurrencyCode = "MNC"; newCurrency.CurrencySiteID = CMSContext.CurrentSiteID; newCurrency.CurrencyEnabled = true; newCurrency.CurrencyFormatString = "{0:F} MNC"; newCurrency.CurrencyIsMain = false; // Create the currency CurrencyInfoProvider.SetCurrencyInfo(newCurrency); return true; }
/// <summary> /// Function to fill controls for update /// </summary> public void FillControls() { try { CurrencyInfo infoCurrency = new CurrencyInfo(); CurrencyBll BllCurrency = new CurrencyBll(); infoCurrency = BllCurrency.CurrencyView(decId); txtName.Text = infoCurrency.CurrencyName; txtSymbol.Text = infoCurrency.CurrencySymbol; txtSubUnit.Text = infoCurrency.SubunitName; txtDecimalPlaces.Text = infoCurrency.NoOfDecimalPlaces.ToString(); txtNarration.Text = infoCurrency.Narration; decCurrencyId = infoCurrency.CurrencyId; } catch (Exception ex) { MessageBox.Show("C4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Datagridview after calculation /// </summary> public void GridFill() { try { if (!isFormLoad) { string calculationMethod = string.Empty; SettingsInfo InfoSettings = new SettingsInfo(); SettingsBll BllSettings = new SettingsBll(); //--------------- Selection Of Calculation Method According To Settings ------------------// if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "FIFO") { calculationMethod = "FIFO"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Average Cost") { calculationMethod = "Average Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "High Cost") { calculationMethod = "High Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Low Cost") { calculationMethod = "Low Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Last Purchase Rate") { calculationMethod = "Last Purchase Rate"; } FinancialStatementBll bllFinancialStatement = new FinancialStatementBll(); DataTable dtbl1 = new DataTable(); CurrencyInfo InfoCurrency = new CurrencyInfo(); CurrencyBll BllCurrency = new CurrencyBll(); int inDecimalPlaces = InfoCurrency.NoOfDecimalPlaces; decimal dcClosingStock = bllFinancialStatement.StockValueGetOnDate(Convert.ToDateTime(txtTodate.Text), calculationMethod, false, false); dcClosingStock = Math.Round(dcClosingStock, inDecimalPlaces); //---------------------Opening Stock----------------------- decimal dcOpeninggStock = bllFinancialStatement.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true); decimal dcProfit = 0; DataSet dsetProfitAndLoss = new DataSet(); dsetProfitAndLoss = bllFinancialStatement.ProfitAndLossAnalysisUpToaDateForBalansheet(PublicVariables._dtFromDate, DateTime.Parse(txtTodate.Text)); DataTable dtblProfit = new DataTable(); dtblProfit = dsetProfitAndLoss.Tables[0]; for (int i = 0; i < dsetProfitAndLoss.Tables.Count; ++i) { dtbl1 = dsetProfitAndLoss.Tables[i]; decimal dcSum = 0; if (i == 0 || (i % 2) == 0) { if (dtbl1.Rows.Count > 0) { dcSum = decimal.Parse(dtbl1.Compute("Sum(Debit)", string.Empty).ToString()); } } else { if (dtbl1.Rows.Count > 0) { dcSum = decimal.Parse(dtbl1.Compute("Sum(Credit)", string.Empty).ToString()); } } } DateValidation objValidation = new DateValidation(); objValidation.DateValidationFunction(txtTodate); if (txtTodate.Text == string.Empty) txtTodate.Text = PublicVariables._dtToDate.ToString("dd-MMM-yyyy"); Font newFont = new Font(dgvTrailBalance.Font, FontStyle.Bold); DataSet DsetTrailbalance = new DataSet(); DataTable dtbl = new DataTable(); decimal dcTotalCredit = 0; decimal dcTotalDebit = 0; DateValidation objvalidation = new DateValidation(); objvalidation.DateValidationFunction(txtFromDate); if (txtFromDate.Text == string.Empty) { txtFromDate.Text = PublicVariables._dtFromDate.ToString("dd-MMM-yyyy"); } objvalidation.DateValidationFunction(txtTodate); if (txtTodate.Text == string.Empty) { txtTodate.Text = PublicVariables._dtToDate.ToString("dd-MMM-yyyy"); } DataTable dtblTrail = new DataTable(); DataTable dtblTrail1 = new DataTable(); DataTable dtblProfitAndLossAcc = new DataTable(); DataTable dtblProfitAndLossAcc1 = new DataTable(); DataSet dsTrial = new DataSet(); Font newfont = new Font(dgvTrailBalance.Font, FontStyle.Bold); dgvTrailBalance.Rows.Clear(); dsTrial = bllFinancialStatement.TrialBalance(DateTime.Parse(txtFromDate.Text), DateTime.Parse(txtTodate.Text), 0); dtblTrail = dsTrial.Tables[0]; dtblProfitAndLossAcc = dsTrial.Tables[1]; if (dgvTrailBalance.RowCount > 0) { dcTotalCredit = decimal.Parse(dtblTrail.Compute("Sum(credit)", string.Empty).ToString()); dcTotalDebit = decimal.Parse(dtblTrail.Compute("Sum(debit)", string.Empty).ToString()); } for (int i = 0; i < dtblTrail.Rows.Count; ++i) { dgvTrailBalance.Rows.Add(); if (Convert.ToDecimal(dtblTrail.Rows[i]["accountGroupId"].ToString()) != 6) { dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtAccountGroupId"].Value = dtblTrail.Rows[i]["accountGroupId"]; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["accountGroupName"].Value = dtblTrail.Rows[i]["name"]; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = dtblTrail.Rows[i]["OpeningBalance"]; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = dtblTrail.Rows[i]["Balance"]; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = dtblTrail.Rows[i]["credit"]; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = dtblTrail.Rows[i]["debit"]; dcTotalCredit += decimal.Parse(dtblTrail.Rows[i]["credit"].ToString()); dcTotalDebit += decimal.Parse(dtblTrail.Rows[i]["debit"].ToString()); } else { decimal decOpBalance = dcOpeninggStock + Convert.ToDecimal(dtblTrail.Rows[i]["OpBalance"].ToString()); decimal decBalance = dcOpeninggStock + Convert.ToDecimal(dtblTrail.Rows[i]["Balance1"].ToString()); string strOpBalance = string.Empty; string strBalance = string.Empty; if (decOpBalance < 0) { strOpBalance = Math.Round(decOpBalance, PublicVariables._inNoOfDecimalPlaces).ToString() + "Cr"; } else { strOpBalance = Math.Round(decOpBalance, PublicVariables._inNoOfDecimalPlaces).ToString() + "Dr"; } if (decBalance < 0) { strBalance = Math.Round(decBalance, PublicVariables._inNoOfDecimalPlaces).ToString() + "Cr"; } else { strBalance = Math.Round(decBalance, PublicVariables._inNoOfDecimalPlaces).ToString() + "Dr"; } dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtAccountGroupId"].Value = dtblTrail.Rows[i]["accountGroupId"]; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["accountGroupName"].Value = dtblTrail.Rows[i]["name"]; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = strOpBalance; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = strBalance; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = dtblTrail.Rows[i]["credit"]; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = dtblTrail.Rows[i]["debit"]; dcTotalCredit += decimal.Parse(dtblTrail.Rows[i]["credit"].ToString()); dcTotalDebit += decimal.Parse(dtblTrail.Rows[i]["debit"].ToString()); } } decimal OpeningProfit; dtblProfitAndLossAcc1 = dsTrial.Tables[2]; if (dgvTrailBalance.RowCount > 0) { decimal dcTotalCredit1 = decimal.Parse(dtblTrail.Compute("Sum(credit)", string.Empty).ToString()); decimal dcTotalDebit1 = decimal.Parse(dtblTrail.Compute("Sum(debit)", string.Empty).ToString()); OpeningProfit = dcTotalCredit1 + dcTotalDebit1; } DataSet DsetBalanceSheet = new DataSet(); DsetBalanceSheet = bllFinancialStatement.BalanceSheet(PublicVariables._dtFromDate, DateTime.Parse(txtTodate.Text)); DataTable dtblProf = new DataTable(); decimal dcProfitOpening = 0; dtblProf = DsetBalanceSheet.Tables[2]; decimal decProfitLedger = 0; if (dtblProf.Rows.Count > 0) { decProfitLedger = decimal.Parse(dtblProf.Compute("Sum(Balance)", string.Empty).ToString()); } DataTable dtblProfitLedgerOpening = new DataTable(); dtblProfitLedgerOpening = DsetBalanceSheet.Tables[3]; decimal decProfitLedgerOpening = 0; foreach (DataRow dRow in dtblProfitLedgerOpening.Rows) { decProfitLedgerOpening += decimal.Parse(dRow["Balance"].ToString()); } decimal decTotalProfitAndLoss = decProfitLedger; decimal OpeningProfit1; decimal openingBalance; dgvTrailBalance.Rows.Add(); dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtSlNo"].Value = " "; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["accountGroupName"].Value = "Profit and Loss"; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtAccountGroupId"].Value = "0"; openingBalance = Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["OpeningBalance"].ToString()); { if (openingBalance > 0) { dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = openingBalance + "Dr"; } else dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = (-1) * openingBalance + "Cr"; } dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtSlNo"].Value = dgvTrailBalance.Rows.Count.ToString(); dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Blue; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.Font = new Font(dgvTrailBalance.Font, FontStyle.Regular); dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = dtblProfitAndLossAcc.Rows[0]["credit"].ToString(); dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = dtblProfitAndLossAcc.Rows[0]["debit"].ToString(); OpeningProfit1 = (Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["OpeningBalance"].ToString())) + Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["debit"].ToString()) - Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["credit"].ToString()); { if (OpeningProfit1 > 0) { dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = decTotalProfitAndLoss + dcProfit + "Dr"; } else dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = (-1) * decTotalProfitAndLoss - dcProfit + "Cr"; }; dcTotalCredit = dcTotalCredit + Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["credit"].ToString()); dcTotalDebit = dcTotalDebit + Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["debit"].ToString()); //=================================Net profit and NetLoss transation for previousyear============== decimal decprofitLossbal = 0; decimal decbalance = 0; decimal decProfitAndLossOfPrevious = decProfitLedgerOpening; dgvTrailBalance.Rows.Add(); if (dcProfitOpening > 0) { dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = dcProfitOpening + "Dr"; decprofitLossbal = dcProfitOpening; } if (dcProfitOpening <= 0) { dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = (-1) * dcProfitOpening + "Cr"; decprofitLossbal = dcProfitOpening; } dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtSlNo"].Value = " "; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["accountGroupName"].Value = "Profit and Loss Opening"; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = "0.00Dr"; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Brown; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.Font = new Font(dgvTrailBalance.Font, FontStyle.Regular); dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtAccountGroupId"].Value = "0"; if (decProfitAndLossOfPrevious > 0) { dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = decProfitAndLossOfPrevious; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = "0.00"; decbalance = (decProfitAndLossOfPrevious); } if (decProfitAndLossOfPrevious <= 0) { dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = (-1) * (decProfitAndLossOfPrevious); dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = "0.00"; decbalance = ((decProfitAndLossOfPrevious)); } if (decbalance >= 0) { dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = decbalance + decprofitLossbal + "Dr"; } if (decbalance < 0) { decbalance = -(decbalance); dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = decbalance + decprofitLossbal + "Cr"; } dgvTrailBalance.Rows.Add(); dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtSlNo"].Value = " "; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["accountGroupName"].Value = "Total:"; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtSlNo"].Value = string.Empty; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Red; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.Font = new Font(dgvTrailBalance.Font, FontStyle.Bold); dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = dcTotalCredit; dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = dcTotalDebit; if (dgvTrailBalance.Columns.Count > 0) { dgvTrailBalance.Columns["credit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgvTrailBalance.Columns["debit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgvTrailBalance.Columns["openingBalance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgvTrailBalance.Columns["dgvtxtBalance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } dgvTrailBalance.ScrollBars = ScrollBars.Both; dgvTrailBalance.ClearSelection(); if (inCurrenRowIndex > 0 && dgvTrailBalance.Rows.Count > 0 && inCurrenRowIndex < dgvTrailBalance.Rows.Count) { if (dgvTrailBalance.Rows[inCurrenRowIndex].Cells[inCurrentColIndex].Visible) { dgvTrailBalance.CurrentCell = dgvTrailBalance.Rows[inCurrenRowIndex].Cells[inCurrentColIndex]; } else { dgvTrailBalance.CurrentCell = dgvTrailBalance.Rows[inCurrenRowIndex].Cells["debit"]; } dgvTrailBalance.CurrentCell.Selected = true; } inCurrenRowIndex = 0; } } catch (Exception ex) { MessageBox.Show("Tb:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public static Dictionary<CurrencyInfo, Decimal> MoneyConvert(CurrencyInfo baseCurrency) { if (baseCurrency == null) throw new ArgumentNullException("baseCurrency"); if (!_currencies.ContainsKey(baseCurrency.Abbreviation)) throw new ArgumentOutOfRangeException("baseCurrency", "Not found."); var result = new Dictionary<CurrencyInfo, Decimal>(); var rates = GetExchangeRates(); foreach (var ci in GetAll()) { if (baseCurrency.Title == ci.Title) { result.Add(ci, 1); continue; } var key = String.Format("{1}/{0}", baseCurrency.Abbreviation, ci.Abbreviation); if (!rates.ContainsKey(key)) continue; result.Add(ci, Math.Round(rates[key], 2)); } return result; }
protected void Page_Load(object sender, EventArgs e) { if (IsMultiStoreConfiguration) { CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "Ecommerce.GlobalShippingOptions.ShippingCosts"); } else { CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "Configuration.ShippingOptions.ShippingCosts"); } shippingOption = EditedObjectParent as ShippingOptionInfo; if (shippingOption != null) { CheckEditedObjectSiteID(shippingOption.ShippingOptionSiteID); currency = CurrencyInfoProvider.GetMainCurrency(shippingOption.ShippingOptionSiteID); } // Init unigrid gridElem.OnAction += gridElem_OnAction; gridElem.OnExternalDataBound += gridElem_OnExternalDataBound; gridElem.OnAfterRetrieveData += gridElem_OnAfterRetrieveData; gridElem.ZeroRowsText = GetString("com.ui.shippingcost.edit_nodata"); gridElem.GridView.AllowSorting = false; }
public static void SaveDefaultCurrencySettings(CurrencyInfo currency) { var tenantSettings = Global.TenantSettings; tenantSettings.DefaultCurrency = currency; SettingsManager.Instance.SaveSettings(tenantSettings, TenantProvider.CurrentTenantID); }
protected CurrencyRateInfoWrapper ToCurrencyRateInfoWrapper(CurrencyInfo currencyInfo, Decimal rate) { if (currencyInfo == null) return null; return new CurrencyRateInfoWrapper(currencyInfo, rate); }
/// <summary> /// Function to save /// </summary> public void SaveFunction() { try { CurrencyInfo infoCurrency = new CurrencyInfo(); CurrencyBll BllCurrency = new CurrencyBll(); infoCurrency.CurrencySymbol = txtSymbol.Text.Trim(); infoCurrency.CurrencyName = txtName.Text.Trim(); infoCurrency.SubunitName = txtSubUnit.Text.Trim(); infoCurrency.NoOfDecimalPlaces = Convert.ToInt32(txtDecimalPlaces.Text.Trim()); infoCurrency.Narration = txtNarration.Text.Trim(); infoCurrency.IsDefault = false; infoCurrency.Extra1 = string.Empty; infoCurrency.Extra2 = string.Empty; if (BllCurrency.CurrencyNameCheckExistence(txtName.Text.Trim(), txtSymbol.Text.Trim(), 0) == false) { decCurrency = BllCurrency.CurrencyAddwithIdentity(infoCurrency); Messages.SavedMessage(); Clear(); decIdForOtherForms = decCurrency; if (frmExchangeRateObj != null) { this.Close(); } } else { Messages.InformationMessage("Currency name already exist"); txtName.Focus(); } } catch (Exception ex) { MessageBox.Show("C1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
protected void Page_Load(object sender, EventArgs e) { editGrid.RowDataBound += editGrid_RowDataBound; btnOk.Click += (s, args) => Save(); // Get main currency mMainCurrency = CurrencyInfoProvider.GetMainCurrency(ConfiguredSiteID); rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname"); // Help image iconHelpGlobalExchangeRate.ToolTip = GetString("ExchangeTable_Edit.ExchangeRateHelp"); iconHelpMainExchangeRate.ToolTip = GetString("ExchangeTable_Edit.ExchangeRateHelp"); dtPickerExchangeTableValidFrom.SupportFolder = "~/CMSAdminControls/Calendar"; dtPickerExchangeTableValidTo.SupportFolder = "~/CMSAdminControls/Calendar"; // Use timezones for DateTimePickers CMS.Globalization.TimeZoneInfo tzi = TimeZoneHelper.GetTimeZoneInfo(MembershipContext.AuthenticatedUser, SiteContext.CurrentSite); dtPickerExchangeTableValidFrom.TimeZone = TimeZoneTypeEnum.Custom; dtPickerExchangeTableValidFrom.CustomTimeZone = tzi; dtPickerExchangeTableValidTo.TimeZone = TimeZoneTypeEnum.Custom; dtPickerExchangeTableValidTo.CustomTimeZone = tzi; // Get exchangeTable id from querystring mExchangeTableId = QueryHelper.GetInteger("exchangeid", 0); if (mExchangeTableId > 0) { exchangeTableObj = EditedObject as ExchangeTableInfo; if (exchangeTableObj != null) { // Check tables site id CheckEditedObjectSiteID(exchangeTableObj.ExchangeTableSiteID); LoadData(exchangeTableObj); // Fill editing form if (!RequestHelper.IsPostBack()) { // Show that the exchangeTable was created or updated successfully if (QueryHelper.GetString("saved", "") == "1") { // Show message ShowChangesSaved(); } } } // Init Copy from global link InitCopyFromGlobalLink(); // Check presence of main currency plcGrid.Visible = CheckMainCurrency(ConfiguredSiteID); plcRateFromGlobal.Visible = IsFromGlobalRateNeeded(); } // Creating a new exchange table else { if (!RequestHelper.IsPostBack()) { // Preset valid from date ExchangeTableInfo tableInfo = ExchangeTableInfoProvider.GetLastExchangeTableInfo(ConfiguredSiteID); if (tableInfo != null) { dtPickerExchangeTableValidFrom.SelectedDateTime = tableInfo.ExchangeTableValidTo; } } // Grids are visible only in edit mode plcGrid.Visible = false; } // Register bootstrap tooltip over help icons ScriptHelper.RegisterBootstrapTooltip(Page, ".info-icon > i"); }
protected void Page_Load(object sender, EventArgs e) { // Register JQuery ScriptHelper.RegisterJQuery(this); // Check permissions (only global admin can see this dialog) CurrentUserInfo ui = CMSContext.CurrentUser; if ((ui == null) || !ui.IsGlobalAdministrator) { // Redirect to access denied RedirectToAccessDenied(GetString("StoreSettings_ChangeCurrency.AccessDenied")); } int siteId = QueryHelper.GetInteger("siteId", CMSContext.CurrentSiteID); if (ui.IsGlobalAdministrator) { editedSiteId = (siteId <= 0) ? 0 : siteId; } else { editedSiteId = CMSContext.CurrentSiteID; } mainCurrency = CurrencyInfoProvider.GetMainCurrency(editedSiteId); // Load the UI this.CurrentMaster.Page.Title = "Ecommerce - Change main currency"; this.CurrentMaster.Title.TitleText = GetString("StoreSettings_ChangeCurrency.ChangeCurrencyTitle"); this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Ecommerce_Currency/object.png"); this.chkRecalculateFromGlobal.Text = GetString("StoreSettings_ChangeCurrency.ChangeSiteFromGlobal"); this.chkRecalculateFromGlobal.InputAttributes["onclick"] = "checkRecalculation()"; this.chkCredit.Text = GetString("StoreSettings_ChangeCurrency.ChangeCredit"); this.chkCredit.InputAttributes["onclick"] = "checkRecalculation()"; this.chkDocuments.Text = GetString("StoreSettings_ChangeCurrency.ChangeDocuments"); this.chkDocuments.InputAttributes["onclick"] = "checkRecalculation()"; this.chkExchangeRates.Text = GetString("StoreSettings_ChangeCurrency.ChangeExchangeRates"); this.chkExchangeRates.InputAttributes["onclick"] = "checkRecalculation()"; this.chkFlatDiscountsCoupons.Text = GetString("StoreSettings_ChangeCurrency.ChangeDiscountCoupons"); this.chkFlatDiscountsCoupons.InputAttributes["onclick"] = "checkRecalculation()"; this.chkFlatTaxes.Text = GetString("StoreSettings_ChangeCurrency.ChangeTaxes"); this.chkFlatTaxes.InputAttributes["onclick"] = "checkRecalculation()"; this.chkFlatVolumeDiscounts.Text = GetString("StoreSettings_ChangeCurrency.ChangeVolumeDiscounts"); this.chkFlatVolumeDiscounts.InputAttributes["onclick"] = "checkRecalculation()"; this.chkProductPrices.Text = GetString("StoreSettings_ChangeCurrency.ChangeProductPrices"); this.chkProductPrices.InputAttributes["onclick"] = "checkRecalculation()"; this.chkShipping.Text = GetString("StoreSettings_ChangeCurrency.ChangeShipping"); this.chkShipping.InputAttributes["onclick"] = "checkRecalculation()"; this.chkFreeShipping.Text = GetString("StoreSettings_ChangeCurrency.ChangeFreeShipping"); this.chkFreeShipping.InputAttributes["onclick"] = "checkRecalculation()"; this.chkOrders.Text = GetString("StoreSettings_ChangeCurrency.ChangeOrder"); this.chkOrders.InputAttributes["onclick"] = "checkRecalculation()"; this.btnCancel.Text = GetString("General.Cancel"); this.lblExchangeRate.Text = GetString("StoreSettings_ChangeCurrency.ExchangeRate"); this.lblRound.Text = GetString("StoreSettings_ChangeCurrency.Round"); this.btnOk.Text = GetString("General.OK"); this.imgHelp.ImageUrl = GetImageUrl("General/HelpSmall.png"); this.imgHelp.ToolTip = GetString("StoreSettings_ChangeCurrency.ExchangeRateHelp"); this.imgRoundHelp.ImageUrl = GetImageUrl("General/HelpSmall.png"); this.imgRoundHelp.ToolTip = GetString("StoreSettings_ChangeCurrency.ExchangeRateRoundHelp"); this.lblOldMainLabel.Text = GetString("StoreSettings_ChangeCurrency.OldMainCurrency"); this.lblNewMainCurrency.Text = GetString("StoreSettings_ChangeCurrency.NewMainCurrency"); if (mainCurrency != null) { // Set confirmation message for OK button this.btnOk.Attributes["onclick"] = "return confirm(" + ScriptHelper.GetString(GetString("StoreSettings_ChangeCurrency.Confirmation")) + ")"; this.lblOldMainCurrency.Text = HTMLHelper.HTMLEncode(mainCurrency.CurrencyDisplayName); } else { this.plcObjectsSelection.Visible = false; this.plcRecalculationDetails.Visible = false; this.plcOldCurrency.Visible = false; } this.currencyElem.AddSelectRecord = true; this.currencyElem.SiteID = editedSiteId; this.plcRecountDocuments.Visible = (editedSiteId != 0); this.plcRecalculateFromGlobal.Visible = (editedSiteId == 0); if (!URLHelper.IsPostback()) { if (QueryHelper.GetBoolean("saved", false)) { // Refresh the page ltlScript.Text = ScriptHelper.GetScript(@"var loc = wopener.location; if(!(/currencysaved=1/.test(loc))) { loc += '¤cysaved=1'; } wopener.location.replace(loc); window.close();"); lblInfo.Text = GetString("general.changessaved"); lblInfo.Visible = true; } } // Prepare checkRecalculation script parts for checkboxes which can be hidden string conditionalCheckboxesScript = ""; if(this.plcRecountDocuments.Visible) { conditionalCheckboxesScript = string.Format(@" tmp = jQuery('#{0}'); if(tmp.length == 1 && tmp[0].checked) {{recalcNeeded = true;}}", chkDocuments.ClientID); } if (this.plcRecalculateFromGlobal.Visible) { conditionalCheckboxesScript += string.Format(@" tmp = jQuery('#{0}'); if(tmp.length == 1 && tmp[0].checked) {{recalcNeeded = true;}}", chkRecalculateFromGlobal.ClientID); } // Init scripts string checkRecalculationScript = string.Format(@" function checkRecalculation(){{ var recalcNeeded = false; var tmp = jQuery('#{0}'); if(tmp.length == 1 && tmp[0].checked) {{recalcNeeded = true;}} tmp = jQuery('#{1}'); if(tmp.length == 1 && tmp[0].checked) {{recalcNeeded = true;}} tmp = jQuery('#{2}'); if(tmp.length == 1 && tmp[0].checked) {{recalcNeeded = true;}} tmp = jQuery('#{3}'); if(tmp.length == 1 && tmp[0].checked) {{recalcNeeded = true;}} tmp = jQuery('#{4}'); if(tmp.length == 1 && tmp[0].checked) {{recalcNeeded = true;}} tmp = jQuery('#{5}'); if(tmp.length == 1 && tmp[0].checked) {{recalcNeeded = true;}} tmp = jQuery('#{6}'); if(tmp.length == 1 && tmp[0].checked) {{recalcNeeded = true;}} tmp = jQuery('#{7}'); if(tmp.length == 1 && tmp[0].checked) {{recalcNeeded = true;}} tmp = jQuery('#{8}'); if(tmp.length == 1 && tmp[0].checked) {{recalcNeeded = true;}} {11} if(recalcNeeded) {{ jQuery('#{9}').parents('tr').show(); jQuery('#{10}').parents('tr').show(); }}else {{ jQuery('#{9}').parents('tr').hide(); jQuery('#{10}').parents('tr').hide(); }} }}", chkExchangeRates.ClientID, chkProductPrices.ClientID, chkFlatTaxes.ClientID, chkFlatDiscountsCoupons.ClientID, chkFlatVolumeDiscounts.ClientID, chkCredit.ClientID, chkShipping.ClientID, chkFreeShipping.ClientID, chkOrders.ClientID, txtEchangeRate.ClientID, txtRound.ClientID, conditionalCheckboxesScript); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "CheckRecalculationScript", checkRecalculationScript, true); ScriptHelper.RegisterStartupScript(this, typeof(string), "CheckRecalculationStartup", "checkRecalculation();", true); }
/// <summary> /// Function to Edit /// </summary> public void EditFunction() { try { CurrencyInfo infoCurrency = new CurrencyInfo(); CurrencyBll BllCurrency = new CurrencyBll(); infoCurrency.CurrencySymbol = txtSymbol.Text.Trim(); infoCurrency.CurrencyName = txtName.Text.Trim(); infoCurrency.SubunitName = txtSubUnit.Text.Trim(); infoCurrency.NoOfDecimalPlaces = Convert.ToInt32(txtDecimalPlaces.Text.Trim()); infoCurrency.Narration = txtNarration.Text.Trim(); infoCurrency.IsDefault = false; infoCurrency.Extra1 = String.Empty; infoCurrency.Extra2 = String.Empty; infoCurrency.CurrencyId = decId; if (BllCurrency.CurrencyNameCheckExistence(txtName.Text.Trim(), txtSymbol.Text.Trim(), decCurrencyId) == false) { BllCurrency.CurrencyEdit(infoCurrency); Messages.UpdatedMessage(); SearchClear(); Clear(); } else { Messages.InformationMessage("Currency name already exist"); txtName.Focus(); } } catch (Exception ex) { MessageBox.Show("C2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
protected void Page_Load(object sender, EventArgs e) { if (Node != null) { // Get currency for discount value formatting sku = SKUInfoProvider.GetSKUInfo(Node.NodeSKUID); EditedObject = sku; productCurrency = CurrencyInfoProvider.GetMainCurrency(sku != null ? sku.SKUSiteID : Node.NodeSiteID); if (sku != null) { // Check site ID CheckProductSiteID(sku.SKUSiteID); // Display product price lblProductPrice.Text = CurrencyInfoProvider.GetFormattedPrice(sku.SKUPrice, productCurrency); // Set action handler gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction); gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound); gridElem.WhereCondition = "VolumeDiscountSKUID = " + sku.SKUID; } // Set the master page actions element CurrentMaster.HeaderActions.ActionsList.Add(new HeaderAction { ControlType = HeaderActionTypeEnum.LinkButton, Text = GetString("Product_Edit_VolumeDiscount_List.NewItemCaption"), OnClientClick = "modalDialog('" + URLHelper.GetAbsoluteUrl("~/CMSModules/Ecommerce/Pages/Content/Product/Product_Edit_VolumeDiscount_Edit.aspx") + "?ProductID=" + sku.SKUID + "&modaldialog=1', 'VolumeDiscounts', 500, 350);", ImageUrl = GetImageUrl("Objects/Ecommerce_VolumeDiscount/add.png"), }); // Set help topic CurrentMaster.HeaderActions.HelpTopicName = "cms_ecommerce_products_volumediscounts"; // Register modal dialog script ScriptHelper.RegisterDialogScript(this); } // Mark selected tab UIContext.ProductTab = ProductTabEnum.VolumeDiscounts; }
/// <summary> /// Function to fill Datagridview /// </summary> public void Gridfill() { try { if (!isFormLoad) { DateValidation objValidation = new DateValidation(); objValidation.DateValidationFunction(txtFromDate); if (txtFromDate.Text == string.Empty) txtFromDate.Text = PublicVariables._dtFromDate.ToString("dd-MMM-yyyy"); objValidation.DateValidationFunction(txtToDate); if (txtToDate.Text == string.Empty) txtToDate.Text = PublicVariables._dtToDate.ToString("dd-MMM-yyyy"); Font newFont = new Font(dgvProfitAndLoss.Font, FontStyle.Bold); CurrencyInfo InfoCurrency = new CurrencyInfo(); CurrencyBll BllCurrency = new CurrencyBll(); InfoCurrency = BllCurrency.CurrencyView(1); int inDecimalPlaces = InfoCurrency.NoOfDecimalPlaces; dgvProfitAndLoss.Rows.Clear(); FinancialStatementBll bllFinancialStatement = new FinancialStatementBll(); DataTable dtblFinancial = new DataTable(); DataSet DsetProfitAndLoss = new DataSet(); SettingsInfo infoSettings = new SettingsInfo(); SettingsBll BllSettings = new SettingsBll(); //---------check calculation method if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "FIFO") { calculationMethod = "FIFO"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Average Cost") { calculationMethod = "Average Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "High Cost") { calculationMethod = "High Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Low Cost") { calculationMethod = "Low Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Last Purchase Rate") { calculationMethod = "Last Purchase Rate"; } DsetProfitAndLoss = bllFinancialStatement.ProfitAndLossAnalysis(DateTime.Parse(txtFromDate.Text), DateTime.Parse(txtToDate.Text)); //---- Opening Stock dgvProfitAndLoss.Rows.Add(); decimal dcOpeningStock = bllFinancialStatement.StockValueGetOnDate(DateTime.Parse(txtFromDate.Text), DateTime.Parse(txtToDate.Text), calculationMethod, true, false); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Opening Stock"; if (dcOpeningStock > 0) { dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = Math.Round(dcOpeningStock, inDecimalPlaces); } else { dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = -(Math.Round(dcOpeningStock, inDecimalPlaces)); } //Closing Stock decimal dcClosingStock = 0; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Closing Stock"; dcClosingStock = bllFinancialStatement.StockValueGetOnDate(DateTime.Parse(txtToDate.Text), calculationMethod, false, false); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = Math.Round(dcClosingStock, inDecimalPlaces); /// ---Purchase Account - Debit dtblFinancial = new DataTable(); dtblFinancial = DsetProfitAndLoss.Tables[0]; dgvProfitAndLoss.Rows.Add(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Purchase Accounts"; decimal dcPurchaseAccount = 0m; if (dtblFinancial.Rows.Count > 0) { foreach (DataRow rw in dtblFinancial.Rows) { decimal dcBalance = decimal.Parse(rw["Debit"].ToString().ToString()); dcPurchaseAccount += dcBalance; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId1"].Value = "11"; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcPurchaseAccount.ToString(); //---Sales Account -Credit dtblFinancial = new DataTable(); dtblFinancial = DsetProfitAndLoss.Tables[1]; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Sales Accounts"; decimal dcSalesAccount = 0m; if (dtblFinancial.Rows.Count > 0) { foreach (DataRow rw in dtblFinancial.Rows) { decimal dcBalance = decimal.Parse(rw["Credit"].ToString().ToString()); dcSalesAccount += dcBalance; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId2"].Value = "10"; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcSalesAccount.ToString(); dgvProfitAndLoss.Rows.Add(); dgvProfitAndLoss.Rows.Add(); //---Direct Expense dtblFinancial = new DataTable(); dtblFinancial = DsetProfitAndLoss.Tables[2]; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Direct Expenses"; decimal dcDirectExpense = 0m; if (dtblFinancial.Rows.Count > 0) { foreach (DataRow rw in dtblFinancial.Rows) { decimal dcBalance = Convert.ToDecimal(rw["Debit"].ToString()); dcDirectExpense += dcBalance; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId1"].Value = "13"; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcDirectExpense.ToString(); //----Direct Income dtblFinancial = new DataTable(); dtblFinancial = DsetProfitAndLoss.Tables[3]; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Direct Incomes"; decimal dcDirectIncoome = 0m; if (dtblFinancial.Rows.Count > 0) { foreach (DataRow rw in dtblFinancial.Rows) { decimal dcBalance = Convert.ToDecimal(rw["Credit"].ToString()); dcDirectIncoome += dcBalance; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId2"].Value = "12"; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcDirectIncoome.ToString(); dgvProfitAndLoss.Rows.Add(); dgvProfitAndLoss.Rows.Add(); dgvProfitAndLoss.Rows.Add(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = "_______________________"; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = "_______________________"; dgvProfitAndLoss.Rows.Add(); decimal dcTotalExpense = 0; decimal dcTotalIncome = 0; dcTotalExpense = dcOpeningStock + dcPurchaseAccount + dcDirectExpense; dcTotalIncome = dcClosingStock + dcSalesAccount + dcDirectIncoome; dcTotalExpense = Math.Round(dcTotalExpense, inDecimalPlaces); dcTotalIncome = Math.Round(dcTotalIncome, inDecimalPlaces); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].DefaultCellStyle.Font = newFont; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Total"; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Total"; decimal dcGrossProfit = 0; decimal dcGrossLoss = 0; if (dcTotalExpense > dcTotalIncome) { dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcTotalExpense.ToString(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcTotalExpense.ToString(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtIncome"].Value = "Gross Loss b/d "; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount2"].Value = dcTotalExpense - dcTotalIncome; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount2"].Style.ForeColor = Color.Red; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtIncome"].Style.ForeColor = Color.Red; dgvProfitAndLoss.Rows.Add(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Gross Loss b/d "; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcTotalExpense - dcTotalIncome; dcGrossLoss = dcTotalExpense - dcTotalIncome; } else { dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcTotalIncome.ToString(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcTotalIncome.ToString(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtExpenses"].Value = "Gross Profit c/d "; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount1"].Value = dcTotalIncome - dcTotalExpense; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount1"].Style.ForeColor = Color.Green; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtExpenses"].Style.ForeColor = Color.Green; dgvProfitAndLoss.Rows.Add(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Gross Profit c/d "; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcTotalIncome - dcTotalExpense; dcGrossProfit = dcTotalIncome - dcTotalExpense; } dgvProfitAndLoss.Rows.Add(); ///------Indirect Expense dtblFinancial = new DataTable(); dtblFinancial = DsetProfitAndLoss.Tables[4]; dgvProfitAndLoss.Rows.Add(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Indirect Expenses"; decimal dcIndirectExpense = 0; if (dtblFinancial.Rows.Count > 0) { foreach (DataRow rw in dtblFinancial.Rows) { decimal dcBalance = Convert.ToDecimal(rw["Debit"].ToString()); dcIndirectExpense += dcBalance; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId1"].Value = "15"; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcIndirectExpense.ToString(); ///---Indirect Income dtblFinancial = new DataTable(); dtblFinancial = DsetProfitAndLoss.Tables[5]; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Indirect Incomes"; decimal dcIndirectIncome = 0m; if (dtblFinancial.Rows.Count > 0) { foreach (DataRow rw in dtblFinancial.Rows) { decimal dcBalance = Convert.ToDecimal(rw["Credit"].ToString()); dcIndirectIncome += dcBalance; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId2"].Value = "14"; } dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcIndirectIncome.ToString(); //---- Calculating Grand total decimal dcGrandTotalExpense = dcGrossLoss + dcIndirectExpense; decimal dcGrandTotalIncome = dcGrossProfit + dcIndirectIncome; dgvProfitAndLoss.Rows.Add(); dgvProfitAndLoss.Rows.Add(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = "_______________________"; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = "_______________________"; dgvProfitAndLoss.Rows.Add(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Grand Total"; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Grand Total"; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].DefaultCellStyle.Font = newFont; if (dcGrandTotalExpense > dcGrandTotalIncome) { dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcGrandTotalExpense.ToString(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcGrandTotalExpense.ToString(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtIncome"].Value = "Net Loss "; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount2"].Value = dcGrandTotalExpense - dcGrandTotalIncome; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtIncome"].Style.ForeColor = Color.Red; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount2"].Style.ForeColor = Color.Red; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].DefaultCellStyle.Font = newFont; decgranExTotal = dcGrandTotalExpense; } else { dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcGrandTotalIncome.ToString(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcGrandTotalIncome.ToString(); dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtExpenses"].Value = "Net Profit"; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount1"].Value = dcGrandTotalIncome - dcGrandTotalExpense; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtExpenses"].Style.ForeColor = Color.Green; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount1"].Style.ForeColor = Color.Green; dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].DefaultCellStyle.Font = newFont; decgranIncTotal = dcGrandTotalIncome; } if (dgvProfitAndLoss.Columns.Count > 0) { dgvProfitAndLoss.Columns["dgvtxtAmount1"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgvProfitAndLoss.Columns["dgvtxtAmount2"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } if (inCurrenRowIndex >= 0 && dgvProfitAndLoss.Rows.Count > 0 && inCurrenRowIndex < dgvProfitAndLoss.Rows.Count) { if (dgvProfitAndLoss.Rows[inCurrenRowIndex].Cells[inCurrentColunIndex].Visible) { dgvProfitAndLoss.CurrentCell = dgvProfitAndLoss.Rows[inCurrenRowIndex].Cells[inCurrentColunIndex]; } else { dgvProfitAndLoss.CurrentCell = dgvProfitAndLoss.Rows[inCurrenRowIndex].Cells["dgvtxtExpenses"]; } dgvProfitAndLoss.CurrentCell.Selected = true; } inCurrenRowIndex = 0; } } catch (Exception ex) { MessageBox.Show("PAL :01" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
protected void Page_Load(object sender, EventArgs e) { editGrid.RowDataBound += new GridViewRowEventHandler(editGrid_RowDataBound); // Get main currency mMainCurrency = CurrencyInfoProvider.GetMainCurrency(this.ConfiguredSiteID); rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname"); // Control initializations lblExchangeTableValidFrom.Text = GetString("ExchangeTable_Edit.ExchangeTableValidFromLabel"); lblExchangeTableDisplayName.Text = GetString("ExchangeTable_Edit.ExchangeTableDisplayNameLabel"); lblExchangeTableValidTo.Text = GetString("ExchangeTable_Edit.ExchangeTableValidToLabel"); // Help image this.imgHelp.ImageUrl = GetImageUrl("General/HelpSmall.png"); this.imgHelp.ToolTip = GetString("ExchangeTable_Edit.ExchangeRateHelp"); this.imgHelpFromGlobal.ImageUrl = GetImageUrl("General/HelpSmall.png"); this.imgHelpFromGlobal.ToolTip = GetString("ExchangeTable_Edit.ExchangeRateHelp"); lblRates.Text = GetString("ExchangeTable_Edit.ExchangeRates"); btnOk.Text = GetString("General.OK"); dtPickerExchangeTableValidFrom.SupportFolder = "~/CMSAdminControls/Calendar"; dtPickerExchangeTableValidTo.SupportFolder = "~/CMSAdminControls/Calendar"; string currentTableTitle = GetString("ExchangeTable_Edit.NewItemCaption"); // Get exchangeTable id from querystring mExchangeTableId = QueryHelper.GetInteger("exchangeid", 0); if (mExchangeTableId > 0) { exchangeTableObj = ExchangeTableInfoProvider.GetExchangeTableInfo(mExchangeTableId); EditedObject = exchangeTableObj; if (exchangeTableObj != null) { // Check tables site id CheckEditedObjectSiteID(exchangeTableObj.ExchangeTableSiteID); // Set title currentTableTitle = exchangeTableObj.ExchangeTableDisplayName; LoadData(exchangeTableObj); // Fill editing form if (!RequestHelper.IsPostBack()) { // Show that the exchangeTable was created or updated successfully if (QueryHelper.GetString("saved", "") == "1") { lblInfo.Visible = true; lblInfo.Text = GetString("General.ChangesSaved"); } } } this.CurrentMaster.Title.TitleText = GetString("ExchangeTable_Edit.HeaderCaption"); this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Ecommerce_ExchangeTable/object.png"); // Init Copy from global link InitCopyFromGlobalLink(); } // Creating a new exchange table else { if (!RequestHelper.IsPostBack()) { // Preset valid from date ExchangeTableInfo tableInfo = ExchangeTableInfoProvider.GetLastExchangeTableInfo(this.ConfiguredSiteID); if (tableInfo != null) { dtPickerExchangeTableValidFrom.SelectedDateTime = tableInfo.ExchangeTableValidTo; } } // Grids are visible only in edit mode plcGrid.Visible = false; this.CurrentMaster.Title.TitleText = GetString("ExchangeTable_New.HeaderCaption"); this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Ecommerce_ExchangeTable/new.png"); } // Initializes page title breadcrumbs control string[,] breadcrumbs = new string[2, 3]; breadcrumbs[0, 0] = GetString("ExchangeTable_Edit.ItemListLink"); breadcrumbs[0, 1] = "~/CMSModules/Ecommerce/Pages/Tools/Configuration/ExchangeRates/ExchangeTable_List.aspx?siteId=" + SiteID; breadcrumbs[0, 2] = ""; breadcrumbs[1, 0] = currentTableTitle; breadcrumbs[1, 1] = ""; breadcrumbs[1, 2] = ""; this.CurrentMaster.Title.Breadcrumbs = breadcrumbs; this.CurrentMaster.Title.HelpTopicName = "new_rateexchange_rate_edit"; this.CurrentMaster.Title.HelpName = "helpTopic"; plcRateFromGlobal.Visible = IsFromGlobalRateNeeded(); // Check presence of main currency string currencyErr = CheckMainCurrency(ConfiguredSiteID); if (!string.IsNullOrEmpty(currencyErr)) { // Show message lblNoMainCurrency.Text = currencyErr; plcNoMainCurrency.Visible = true; plcRates.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { mShippingOptionId = QueryHelper.GetInteger("shippingoptionid", 0); mShippingOptionInfoObj = ShippingOptionInfoProvider.GetShippingOptionInfo(mShippingOptionId); EditedObject = mShippingOptionInfoObj; if (mShippingOptionInfoObj != null) { CheckEditedObjectSiteID(mShippingOptionInfoObj.ShippingOptionSiteID); currency = CurrencyInfoProvider.GetMainCurrency(mShippingOptionInfoObj.ShippingOptionSiteID); } // Init unigrid gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction); gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound); gridElem.OnAfterRetrieveData += new OnAfterRetrieveData(gridElem_OnAfterRetrieveData); gridElem.WhereCondition = "ShippingCostShippingOptionID = " + mShippingOptionId; gridElem.ZeroRowsText = GetString("com.ui.shippingcost.edit_nodata"); gridElem.GridView.AllowSorting = false; // Prepare the new shipping cost header action CurrentMaster.HeaderActions.AddAction(new HeaderAction() { Text = GetString("com.ui.shippingcost.edit_new"), RedirectUrl = ResolveUrl("ShippingOption_Edit_ShippingCosts_Edit.aspx?shippingCostShippingOptionId=" + mShippingOptionId + "&siteId=" + SiteID), ImageUrl = GetImageUrl("Objects/Ecommerce_ShippingOption/add.png"), ControlType = HeaderActionTypeEnum.Hyperlink }); }
/// <summary> /// Function to fill the grid /// </summary> public void GridFill() { try { CurrencyInfo InfoCurrency = new CurrencyInfo(); CurrencyBll BllCurrency = new CurrencyBll(); InfoCurrency = BllCurrency.CurrencyView(1); int inDecimalPlaces = InfoCurrency.NoOfDecimalPlaces; string calculationMethod = string.Empty; SettingsInfo InfoSettings = new SettingsInfo(); SettingsBll BllSettings = new SettingsBll(); //--------------- Selection Of Calculation Method According To Settings ------------------// if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "FIFO") { calculationMethod = "FIFO"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Average Cost") { calculationMethod = "Average Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "High Cost") { calculationMethod = "High Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Low Cost") { calculationMethod = "Low Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Last Purchase Rate") { calculationMethod = "Last Purchase Rate"; } // StockPostingSP spstock = new StockPostingSP(); StockPostingBll BllStockPosting = new StockPostingBll(); decimal decrackId = 0; DataSet dsstock = new DataSet(); List<DataTable> list = new List<DataTable>(); if (cmbRack.SelectedValue != null) { decrackId = Convert.ToDecimal(cmbRack.SelectedValue.ToString()); } list = BllStockPosting.StockReportGridFill1(txtproductName.Text, Convert.ToDecimal(cmbBrand.SelectedValue.ToString()), Convert.ToDecimal(cmbModel.SelectedValue.ToString()), (txtProductCode.Text), Convert.ToDecimal(cmbGodown.SelectedValue.ToString()), decrackId, Convert.ToDecimal(cmbSize.SelectedValue.ToString()), Convert.ToDecimal(cmbTax.SelectedValue.ToString()), Convert.ToDecimal(cmbProductgroup.SelectedValue.ToString()), txtBatchName.Text); if (list[0].Rows.Count > 0) { decimal decTotal = 0; for (int i = 0; i < list[0].Rows.Count; i++) { if (list[0].Rows[i]["stockvalue"].ToString() != string.Empty) { decTotal = decTotal + Convert.ToDecimal(list[0].Rows[i]["stockvalue"].ToString()); } } decTotal = Math.Round(decTotal, 2); txtTotal.Text = decTotal.ToString(); } else { txtTotal.Text = "0.00"; } dgvStockReport.DataSource = list[0]; //if (dtbl.Columns.Count > 0) //{ // dgvStockReport.Columns["stockvalue"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; //} } catch (Exception ex) { MessageBox.Show("STKR:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
protected void Page_Load(object sender, EventArgs e) { // Register JQuery ScriptHelper.RegisterJQuery(this); // Register bootstrap tooltip over help icons ScriptHelper.RegisterBootstrapTooltip(Page, ".info-icon > i"); // Check permissions (only global admin can see this dialog) var ui = MembershipContext.AuthenticatedUser; if ((ui == null) || !ui.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin)) { // Redirect to access denied RedirectToAccessDenied(GetString("StoreSettings_ChangeCurrency.AccessDenied")); } int siteId = QueryHelper.GetInteger("siteId", SiteContext.CurrentSiteID); if (ui.IsGlobalAdministrator) { editedSiteId = (siteId <= 0) ? 0 : siteId; } else { editedSiteId = SiteContext.CurrentSiteID; } mainCurrency = CurrencyInfoProvider.GetMainCurrency(editedSiteId); // Load the UI CurrentMaster.Page.Title = "Ecommerce - Change main currency"; chkRecalculateFromGlobal.InputAttributes["onclick"] = "checkRecalculation()"; chkCredit.InputAttributes["onclick"] = "checkRecalculation()"; chkExchangeRates.InputAttributes["onclick"] = "checkRecalculation()"; chkDiscounts.InputAttributes["onclick"] = "checkRecalculation()"; chkProductPrices.InputAttributes["onclick"] = "checkRecalculation()"; chkShipping.InputAttributes["onclick"] = "checkRecalculation()"; btnOk.Text = GetString("General.saveandclose"); imgHelp.ToolTip = GetString("StoreSettings_ChangeCurrency.ExchangeRateHelp"); imgRoundHelp.ToolTip = GetString("StoreSettings_ChangeCurrency.ExchangeRateRoundHelp"); if (mainCurrency != null) { // Set confirmation message for OK button btnOk.OnClientClick = "if (!OnButtonClicked()) { return false; }"; lblOldMainCurrency.Text = HTMLHelper.HTMLEncode(mainCurrency.CurrencyDisplayName); } else { plcObjectsSelection.Visible = false; plcRecalculationDetails.Visible = false; plcOldCurrency.Visible = false; } currencyElem.AddSelectRecord = true; currencyElem.SiteID = editedSiteId; plcRecalculateFromGlobal.Visible = (editedSiteId == 0); if (!URLHelper.IsPostback()) { if (QueryHelper.GetBoolean("saved", false)) { // Refresh the page ltlScript.Text = ScriptHelper.GetScript(@" var loc = wopener.location; if(!(/currencysaved=1/.test(loc))) { if(!(/siteId/.test(loc))) { loc += '?currencysaved=1'; } else { loc += '¤cysaved=1'; } } wopener.location.replace(loc); CloseDialog();"); ShowChangesSaved(); } } // Init script string checkRecalculationScript = @" function checkRecalculation(){ var recalcNeeded = false; var checkBoxes = $cmsj(" + "\"#recalculationDetail input[type='checkbox']\"" + @"); for(i = 0; i < checkBoxes.length; i++) { if(checkBoxes[i].checked) { recalcNeeded = true; break; } } if(recalcNeeded) { $cmsj('#" + txtEchangeRate.ClientID + @"').parents('.form-group').show(); $cmsj('#" + txtRound.ClientID + @"').parents('.form-group').show(); }else { $cmsj('#" + txtEchangeRate.ClientID + @"').parents('.form-group').hide(); $cmsj('#" + txtRound.ClientID + @"').parents('.form-group').hide(); } };"; string btnSubmitScript = @" function OnButtonClicked() { var checkedCheckboxies = $cmsj('#recalculationDetail input:checkbox:checked'); var result = true; if (checkedCheckboxies.length > 0) { result = confirm(" + ScriptHelper.GetString(GetString("StoreSettings_ChangeCurrency.Confirmation")) + @"); } return result; };"; ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "Scripts", checkRecalculationScript + btnSubmitScript, true); ScriptHelper.RegisterStartupScript(this, typeof(string), "CheckRecalculationStartup", "checkRecalculation();", true); }