public decimal GetExchangeRate(string currencyCode) { int officeId = CurrentSession.GetOfficeId(); decimal exchangeRate = Transaction.GetExchangeRate(officeId, currencyCode); return(exchangeRate); }
public long Save(long tranId, DateTime valueDate, int storeId, string partyCode, int priceTypeId, string referenceNumber, string data, string statementReference, string attachmentsJSON) { if (!StockTransaction.IsValidStockTransactionByTransactionMasterId(tranId)) { throw new InvalidOperationException(Resources.Warnings.InvalidStockTransaction); } if (!StockTransaction.IsValidPartyByTransactionMasterId(tranId, partyCode)) { throw new InvalidOperationException(Resources.Warnings.InvalidParty); } Collection <StockDetail> details = CollectionHelper.GetStockMasterDetailCollection(data, storeId); if (!this.ValidateDetails(details, tranId)) { return(0); } Collection <Attachment> attachments = CollectionHelper.GetAttachmentCollection(attachmentsJSON); int officeId = CurrentSession.GetOfficeId(); int userId = CurrentSession.GetUserId(); long loginId = CurrentSession.GetLogOnId(); return(Data.Transactions.Return.PostTransaction(tranId, valueDate, officeId, userId, loginId, storeId, partyCode, priceTypeId, referenceNumber, statementReference, details, attachments)); }
public override void OnControlLoad(object sender, EventArgs e) { string accountNumber = this.Page.Request["AccountNumber"]; DateTime from = Conversion.TryCastDate(this.Page.Request["From"]); DateTime to = Conversion.TryCastDate(this.Page.Request["To"]); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); Collection <KeyValuePair <string, object> > parameter1 = new Collection <KeyValuePair <string, object> >(); parameter1.Add(new KeyValuePair <string, object>("@OfficeId", officeId.ToString(CultureInfo.InvariantCulture))); parameter1.Add(new KeyValuePair <string, object>("@AccountNumber", accountNumber)); Collection <KeyValuePair <string, object> > parameter2 = new Collection <KeyValuePair <string, object> >(); parameter2.Add(new KeyValuePair <string, object>("@From", from)); parameter2.Add(new KeyValuePair <string, object>("@To", to)); parameter2.Add(new KeyValuePair <string, object>("@UserId", userId.ToString(CultureInfo.InvariantCulture))); parameter2.Add(new KeyValuePair <string, object>("@AccountNumber", accountNumber)); parameter2.Add(new KeyValuePair <string, object>("@OfficeId", officeId.ToString(CultureInfo.InvariantCulture))); using (Report report = new Report()) { report.AddParameterToCollection(parameter1); report.AddParameterToCollection(parameter2); report.RunningTotalText = Titles.RunningTotal; report.ResourceAssembly = Assembly.GetAssembly(typeof(GLAdviceReport)); report.Path = "~/Modules/Finance/Reports/Source/Transactions.AccountStatement.xml"; report.AutoInitialize = true; this.Placeholder1.Controls.Add(report); } }
private static ApplicationDateModel GetApplicationDates() { int officeId = CurrentSession.GetOfficeId(); Collection <ApplicationDateModel> applicationDates = ApplicationStateHelper.GetApplicationDates(); bool persist = false; if (applicationDates == null || applicationDates.Count.Equals(0)) { applicationDates = Data.Frequency.GetApplicationDates(); persist = true; } else { for (int i = 0; i < applicationDates.Count; i++) { if (applicationDates[i].NewDayStarted) { int modelOfficeId = applicationDates[i].OfficeId; applicationDates.Remove(applicationDates[i]); applicationDates.Add(Data.Frequency.GetApplicationDates(modelOfficeId)); persist = true; } } } if (persist) { ApplicationStateHelper.SetApplicationDates(applicationDates); } return(applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId))); }
public static IEnumerable <Entities.Core.Menu> GetRootMenuCollection(string path) { int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); string culture = CurrentSession.GetCulture().TwoLetterISOLanguageName; return(Factory.Get <Entities.Core.Menu>("SELECT * FROM policy.get_menu(@0, @1, @2) WHERE parent_menu_id=core.get_root_parent_menu_id(@3) ORDER BY menu_id;", userId, officeId, culture, path)); }
public void Reject(long tranId, string reason) { int officeId = CurrentSession.GetOfficeId(); int userId = CurrentSession.GetUserId(); long loginId = CurrentSession.GetLogOnId(); const int verificationStatusId = -3; Transaction.Verify(tranId, officeId, userId, loginId, verificationStatusId, reason); }
public override void OnControlLoad(object sender, EventArgs e) { int officeId = CurrentSession.GetOfficeId(); this.TitleLiteral.Text = Resources.Titles.SalesByMonthInThousands; //this.SalesByMonthGridView.Attributes.Add("style", "display:none;"); this.SalesByMonthGridView.DataSource = Data.Reports.SalesByMonth.GetSalesByOffice(officeId); this.SalesByMonthGridView.DataBind(); }
public static IEnumerable <Entities.Core.Menu> GetMenuCollection(string path, short level) { string relativePath = path; int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); string culture = CurrentSession.GetCulture().TwoLetterISOLanguageName; return(Factory.Get <Entities.Core.Menu>("SELECT * FROM policy.get_menu(@0, @1, @2) WHERE parent_menu_id=(SELECT menu_id FROM core.menus WHERE url=@3) AND level=@4 ORDER BY menu_id;", userId, officeId, culture, relativePath, level)); }
private long PostTransaction(string partyCode, string currencyCode, decimal amount, decimal debitExchangeRate, decimal creditExchangeRate, string referenceNumber, string statementReference, int costCenterId, int cashRepositoryId, DateTime?postedDate, int bankAccountId, string bankInstrumentCode, string bankTransactionCode) { int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); long loginId = CurrentSession.GetLogOnId(); long transactionMasterID = Data.Transactions.Receipt.PostTransaction(userId, officeId, loginId, partyCode, currencyCode, amount, debitExchangeRate, creditExchangeRate, referenceNumber, statementReference, costCenterId, cashRepositoryId, postedDate, bankAccountId, bankInstrumentCode, bankTransactionCode); return(transactionMasterID); }
public static long Add(string book, DateTime valueDate, string partyCode, int priceTypeId, Collection <StockDetail> details, string referenceNumber, string statementReference, Collection <long> transactionIdCollection, Collection <Attachment> attachments) { StockMaster stockMaster = new StockMaster(); stockMaster.PartyCode = partyCode; stockMaster.PriceTypeId = priceTypeId; long nonGlStockMasterId = NonGlStockTransaction.Add(book, valueDate, CurrentSession.GetOfficeId(), CurrentSession.GetUserId(), CurrentSession.GetLogOnId(), referenceNumber, statementReference, stockMaster, details, transactionIdCollection, attachments); return(nonGlStockMasterId); }
private void BindGrid() { DateTime date = Conversion.TryCastDate(this.dateTextBox.Text); int factor = Conversion.TryCastInteger(this.factorInputText.Value); int officeId = CurrentSession.GetOfficeId(); using (DataTable table = Data.Reports.RetainedEarnings.GetRetainedEarningStatementDataTable(date, officeId, factor)) { this.grid.DataSource = table; this.grid.DataBind(); } }
public Collection <ListItem> GetCashRepositories() { Collection <ListItem> values = new Collection <ListItem>(); int officeId = CurrentSession.GetOfficeId(); foreach (CashRepository cashRepository in CashRepositories.GetCashRepositories(officeId)) { values.Add(new ListItem(cashRepository.CashRepositoryName, cashRepository.CashRepositoryId.ToString(CultureInfo.InvariantCulture))); } return(values); }
private void BindGrid() { DateTime from = Conversion.TryCastDate(this.fromDateTextBox.Text); DateTime to = Conversion.TryCastDate(this.toDateTextBox.Text); decimal factor = Conversion.TryCastDecimal(this.factorInputText.Value); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); this.cashflowStatementGridView.DataSource = Data.Reports.CashFlow.GetDirectCashFlowStatement(from, to, userId, officeId, factor); this.cashflowStatementGridView.DataBind(); }
private void BindGridView() { DateTime from = Conversion.TryCastDate(this.fromDateTextBox.Text); DateTime to = Conversion.TryCastDate(this.toDateTextBox.Text); int userId = CurrentSession.GetUserId(); string accountNumber = this.accountNumberInputText.Value; int officeId = CurrentSession.GetOfficeId(); this.statementGridView.DataSource = Data.Reports.AccountStatement.GetAccountStatement(from, to, userId, accountNumber, officeId); this.statementGridView.DataBound += this.StatementGridViewDataBound; this.statementGridView.DataBind(); }
public Collection <ListItem> GetSalesTaxes(string tranBook) { int officeId = CurrentSession.GetOfficeId(); Collection <ListItem> values = new Collection <ListItem>(); foreach (Net.Entities.Core.SalesTax salesTax in SalesTax.GetSalesTaxes(tranBook, officeId)) { values.Add(new ListItem(salesTax.SalesTaxCode, salesTax.SalesTaxId.ToString(CultureInfo.InvariantCulture))); } return(values); }
public bool Save(Collection <Data.Models.Reorder> details) { if (details == null) { throw new ArgumentNullException("details"); } long loginId = CurrentSession.GetLogOnId(); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); return(Data.Transactions.Reorder.Save(loginId, userId, officeId, details)); }
public static IEnumerable <Entities.Core.Menu> GetMenuCollection(int parentMenuId, short level) { int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); string culture = CurrentSession.GetCulture().TwoLetterISOLanguageName; if (parentMenuId > 0) { return(Factory.Get <Entities.Core.Menu>("SELECT * FROM policy.get_menu(@0, @1, @2) WHERE parent_menu_id=@3 AND level=@4 ORDER BY menu_id;", userId, officeId, culture, parentMenuId, level)); } return(Factory.Get <Entities.Core.Menu>("SELECT * FROM policy.get_menu(@0, @1, @2) WHERE parent_menu_id is null ORDER BY menu_id;", userId, officeId, culture)); }
public override void OnControlLoad(object sender, EventArgs e) { this.CreateHeader(this.Placeholder1); if (Data.OpeningInventory.Exists(CurrentSession.GetOfficeId())) { this.CreateMessage(this.Placeholder1); return; } this.CreateGridView(this.Placeholder1); this.CreateSaveButton(this.Placeholder1); }
private void BindGrid() { DateTime previousTerm = Conversion.TryCastDate(this.previousPeriodDateTextBox.Text); DateTime currentTerm = Conversion.TryCastDate(this.currentPeriodDateTextBox.Text); int factor = Conversion.TryCastInteger(this.factorInputText.Value); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); using (DataTable table = Data.Reports.BalanceSheet.GetBalanceSheet(previousTerm, currentTerm, userId, officeId, factor)) { this.grid.DataSource = table; this.grid.DataBind(); } }
private void BindGrid() { DateTime from = Conversion.TryCastDate(this.fromDateTextBox.Text); DateTime to = Conversion.TryCastDate(this.toDateTextBox.Text); decimal factor = Conversion.TryCastDecimal(this.factorInputText.Value); bool compact = this.ShowCompact(); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); this.plAccountGridView.DataSource = Data.Reports.ProfitAndLossAccount.GetPLAccount(from, to, userId, officeId, compact, factor); this.plAccountGridView.DataBind(); }
public Collection <ListItem> GetStores() { int officeId = CurrentSession.GetOfficeId(); Collection <ListItem> values = new Collection <ListItem>(); IEnumerable <Store> stores = Stores.GetStores(officeId); foreach (Store store in stores) { values.Add(new ListItem(store.StoreName, store.StoreId.ToString(CultureInfo.InvariantCulture))); } return(values); }
private void AddGridView() { int officeId = CurrentSession.GetOfficeId(); using (GridView grid = new GridView()) { grid.GridLines = GridLines.None; this.CreateColumns(grid); grid.DataSource = Data.Transactions.Reorder.GetReorderView(officeId); grid.ID = "ReorderGrid"; grid.AutoGenerateColumns = false; grid.DataBind(); this.Placeholder1.Controls.Add(grid); } }
public Collection <ListItem> GetCashRepositoriesByAccountNumber(string accountNumber) { Collection <ListItem> values = new Collection <ListItem>(); if (AccountHelper.IsCashAccount(accountNumber)) { int officeId = CurrentSession.GetOfficeId(); foreach (CashRepository cashRepository in CashRepositories.GetCashRepositories(officeId)) { values.Add(new ListItem(cashRepository.CashRepositoryName, cashRepository.CashRepositoryCode)); } } return(values); }
public bool InitializeEODOperation() { if (!CurrentSession.IsAdmin()) { return(false); } int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); Data.EODOperation.Initialize(userId, officeId); this.ForceLogOff(officeId); return(true); }
private void SuggestDateReload() { int officeId = CurrentSession.GetOfficeId(); Collection <ApplicationDateModel> applicationDates = ApplicationStateHelper.GetApplicationDates(); if (applicationDates != null) { ApplicationDateModel model = applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId)); if (model != null) { applicationDates.Add(new ApplicationDateModel(model.OfficeId, model.Today, model.MonthStartDate, model.MonthEndDate, model.QuarterStartDate, model.QuarterEndDate, model.FiscalHalfStartDate, model.FiscalHalfEndDate, model.FiscalYearStartDate, model.FiscalYearEndDate, true)); applicationDates.Remove(model); ApplicationStateHelper.SetApplicationDates(applicationDates); } } }
public static long Add(DateTime valueDate, int storeId, bool isCredit, int paymentTermId, string partyCode, int agentId, int priceTypeId, Collection <StockDetail> details, int shipperId, string shippingAddressCode, decimal shippingCharge, int costCenterId, string referenceNumber, string statementReference, Collection <Attachment> attachments, bool nonTaxable) { StockMaster stockMaster = new StockMaster(); stockMaster.PartyCode = partyCode; stockMaster.IsCredit = isCredit; stockMaster.PaymentTermId = paymentTermId; stockMaster.PriceTypeId = priceTypeId; stockMaster.ShipperId = shipperId; stockMaster.ShippingAddressCode = shippingAddressCode; stockMaster.ShippingCharge = shippingCharge; stockMaster.SalespersonId = agentId; stockMaster.StoreId = storeId; long transactionMasterId = GlTransaction.Add("Sales.Direct", valueDate, CurrentSession.GetOfficeId(), CurrentSession.GetUserId(), CurrentSession.GetLogOnId(), costCenterId, referenceNumber, statementReference, stockMaster, details, attachments, nonTaxable); return(transactionMasterId); }
private void BindGrid() { DateTime from = Conversion.TryCastDate(this.fromDateTextBox.Text); DateTime to = Conversion.TryCastDate(this.toDateTextBox.Text); decimal factor = Conversion.TryCastDecimal(this.factorInputText.Value); bool compact = this.ShowCompact(); bool changeSide = this.ChangeSideWhenNegative(); bool includeZeroBalanceAccounts = this.IncludeZeroBalanceAccounts(); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); using (DataTable table = Data.Reports.TrialBalance.GetTrialBalance(from, to, userId, officeId, compact, factor, changeSide, includeZeroBalanceAccounts)) { this.trialBalanceGridView.DataSource = table; this.trialBalanceGridView.DataBind(); } }
private void ForceLogOff() { int officeId = CurrentSession.GetOfficeId(); Collection <ApplicationDateModel> applicationDates = ApplicationStateHelper.GetApplicationDates(); if (applicationDates != null) { ApplicationDateModel model = applicationDates.FirstOrDefault(c => c.OfficeId.Equals(officeId)); if (model != null) { if (model.ForcedLogOffTimestamp != null) { if (model.ForcedLogOffTimestamp <= DateTime.Now && model.ForcedLogOffTimestamp >= CurrentSession.GetSignInTimestamp()) { RequestLogOnPage(); } } } } }
private new void Initialize() { int officeId = CurrentSession.GetOfficeId(); EODStatus status = Data.EODOperation.GetStatus(officeId); if (status != null) { this.ValueDateLiteral.Text = @"(" + status.ValueDate.ToShortDateString() + @")"; if (status.Initialized) { this.InitializeButton.Attributes.Add("class", "ui blue disabled button"); this.PerformEODButton.Attributes.Add("class", "ui red button"); return; } this.InitializeButton.Attributes.Add("class", "ui blue button"); this.PerformEODButton.Attributes.Add("class", "ui red disabled button"); } }
public long Save(DateTime valueDate, string referenceNumber, string statementReference, List <StockAdjustmentDetail> models) { foreach (var model in models) { if (model.TransferType == TransactionType.Credit) { decimal existingQuantity = Data.Helpers.Items.CountItemInStock(model.ItemCode, model.UnitName, model.StoreName); if (existingQuantity < model.Quantity) { throw new MixERPException(string.Format(CultureInfo.CurrentCulture, Errors.InsufficientStockWarning, Conversion.TryCastInteger(existingQuantity), model.UnitName, model.ItemName)); } } } int officeId = CurrentSession.GetOfficeId(); int userId = CurrentSession.GetUserId(); long loginId = CurrentSession.GetLogOnId(); return(Data.Transactions.StockAdjustment.Add(officeId, userId, loginId, valueDate, referenceNumber, statementReference, models.ToCollection())); }