private void _InitializeListViewBookings(Account pAccount, DateTime pBeginDate, DateTime pEndDate, OBookingTypes pBookingType) { lvBooking.Items.Clear(); lblAccountBalance.Text = String.Empty; if (pAccount != null) { _bookingsStock = ServicesProvider.GetInstance().GetAccountingServices().FindAllBookings(pAccount, pBeginDate, pEndDate, ((Currency) (cmbCurrencies.SelectedItem)).Id , pBookingType, ((Branch) cmbBranches.SelectedItem).Id); if (_bookingsStock.Count != 0) { foreach (BookingToView bookingToView in _bookingsStock) { ListViewItem listViewItem = new ListViewItem(bookingToView.Date.ToShortDateString()); if (bookingToView.Direction == OBookingDirections.Debit) { listViewItem.SubItems.Add(bookingToView.AmountInternal.GetFormatedValue(true)); listViewItem.SubItems.Add(""); } else { listViewItem.SubItems.Add(""); listViewItem.SubItems.Add(bookingToView.AmountInternal.GetFormatedValue(true)); } if (cmbCurrencies.Items.Count > 0) { listViewItem.SubItems.Add(bookingToView.ExchangeRate.ToString()); if (!bookingToView.ExchangeRate.HasValue) listViewItem.BackColor = Color.Red; listViewItem.SubItems.Add(bookingToView.ExternalAmount.GetFormatedValue(true)); } if (bookingToView.IsExported) listViewItem.ForeColor = Color.Gray; string purpose = string.Format("{0} {1} {2}", MultiLanguageStrings.GetString(Ressource.AccountView, bookingToView.EventCode + @".Text"), bookingToView.ContractCode, MultiLanguageStrings.GetString(Ressource.AccountView, bookingToView.AccountingLabel + @".Text")); listViewItem.SubItems.Add(purpose); lvBooking.Items.Add(listViewItem); } } if (((Currency) cmbCurrencies.SelectedItem).Id != 0) { Currency selectedcur = cmbCurrencies.SelectedItem as Currency; OCurrency balance = ServicesProvider.GetInstance().GetAccountingServices(). GetAccountBalance(pAccount.Id, selectedcur.Id, 0, null, 0, (cmbBranches.SelectedItem as Branch).Id); lblAccountBalance.Text = string.Format("{0} {1}", balance.GetFormatedValue(selectedcur.UseCents), selectedcur); } else { Currency selectedcur = new Currency(); foreach (var item in cmbCurrencies.Items) { if(((Currency) item).IsPivot) { selectedcur = (Currency) item; } } OCurrency balance = ServicesProvider.GetInstance().GetAccountingServices(). GetAccountBalance(pAccount.Id, 0, 0, null, 0, (cmbBranches.SelectedItem as Branch).Id); lblAccountBalance.Text = string.Format("{0} {1}", balance.GetFormatedValue(selectedcur.UseCents), selectedcur.Name); } } else _bookingsStock = null; }
private void cmbDisplayType_SelectedIndexChanged(object sender, EventArgs e) { _bookingType = (OBookingTypes)Enum.Parse(typeof(OBookingTypes), cmbDisplayType.SelectedValue.ToString()); _InitializeListViewBookings(_filterAccount, _filterBeginDate, _filterEndDate, _bookingType); }
public BookingToViewStock FindAllBookings(Account pAccount, DateTime pBeginDate, DateTime pEndDate, int currencyId, OBookingTypes pBookingType, int pBranchId) { return(_movementSetManagement.SelectBookings(pAccount, pBeginDate, pEndDate, currencyId, pBookingType, pBranchId)); }
public BookingToViewStock SelectBookings(Account pAccount, DateTime pBeginDate, DateTime pEndDate, int currencyId, OBookingTypes pBookingType, int pBranchId) { const string sqlQuery = "GetAccountBookings"; bool? isExported = null; switch (pBookingType) { case OBookingTypes.Exported: isExported = true; break; case OBookingTypes.NotExported: isExported = false; break; } using (SqlConnection conn = GetConnection()) using (OpenCbsCommand cmd = new OpenCbsCommand(sqlQuery, conn).AsStoredProcedure()) { cmd.AddParam("@beginDate",pBeginDate); cmd.AddParam("@endDate", pEndDate); cmd.AddParam("@account_id", pAccount.Id); cmd.AddParam("@currency_id", currencyId); cmd.AddParam("@is_exported", isExported); cmd.AddParam("@branch_id", pBranchId); using (OpenCbsReader reader = cmd.ExecuteReader()) { if (reader == null || reader.Empty) return new BookingToViewStock(pAccount); BookingToViewStock stock = new BookingToViewStock(pAccount); while (reader.Read()) { stock.Add(GetBooking(pAccount, reader)); } return stock; } } }
public BookingToViewStock FindAllBookings(Account pAccount, DateTime pBeginDate, DateTime pEndDate, int currencyId ,OBookingTypes pBookingType, int pBranchId) { return _movementSetManagement.SelectBookings(pAccount, pBeginDate, pEndDate, currencyId, pBookingType, pBranchId); }
private void cmbDisplayType_SelectedIndexChanged(object sender, EventArgs e) { _bookingType = (OBookingTypes)Enum.Parse(typeof(OBookingTypes), cmbDisplayType.SelectedValue.ToString()); _InitializeListViewBookings(_filterAccount, _filterBeginDate, _filterEndDate, _bookingType); }
private void _InitializeListViewBookings(Account pAccount, DateTime pBeginDate, DateTime pEndDate, OBookingTypes pBookingType) { lvBooking.Items.Clear(); lblAccountBalance.Text = String.Empty; if (pAccount != null) { _bookingsStock = ServicesProvider.GetInstance().GetAccountingServices().FindAllBookings(pAccount, pBeginDate, pEndDate, ((Currency)(cmbCurrencies.SelectedItem)).Id, pBookingType, ((Branch)cmbBranches.SelectedItem).Id); if (_bookingsStock.Count != 0) { foreach (BookingToView bookingToView in _bookingsStock) { ListViewItem listViewItem = new ListViewItem(bookingToView.Date.ToShortDateString()); if (bookingToView.Direction == OBookingDirections.Debit) { listViewItem.SubItems.Add(bookingToView.AmountInternal.GetFormatedValue(true)); listViewItem.SubItems.Add(""); } else { listViewItem.SubItems.Add(""); listViewItem.SubItems.Add(bookingToView.AmountInternal.GetFormatedValue(true)); } if (cmbCurrencies.Items.Count > 0) { listViewItem.SubItems.Add(bookingToView.ExchangeRate.ToString()); if (!bookingToView.ExchangeRate.HasValue) { listViewItem.BackColor = Color.Red; } listViewItem.SubItems.Add(bookingToView.ExternalAmount.GetFormatedValue(true)); } if (bookingToView.IsExported) { listViewItem.ForeColor = Color.Gray; } string purpose = string.Format("{0} {1} {2}", MultiLanguageStrings.GetString(Ressource.AccountView, bookingToView.EventCode + @".Text"), bookingToView.ContractCode, MultiLanguageStrings.GetString(Ressource.AccountView, bookingToView.AccountingLabel + @".Text")); listViewItem.SubItems.Add(purpose); lvBooking.Items.Add(listViewItem); } } if (((Currency)cmbCurrencies.SelectedItem).Id != 0) { Currency selectedcur = cmbCurrencies.SelectedItem as Currency; OCurrency balance = ServicesProvider.GetInstance().GetAccountingServices(). GetAccountBalance(pAccount.Id, selectedcur.Id, 0, null, 0, (cmbBranches.SelectedItem as Branch).Id); lblAccountBalance.Text = string.Format("{0} {1}", balance.GetFormatedValue(selectedcur.UseCents), selectedcur); } else { Currency selectedcur = new Currency(); foreach (var item in cmbCurrencies.Items) { if (((Currency)item).IsPivot) { selectedcur = (Currency)item; } } OCurrency balance = ServicesProvider.GetInstance().GetAccountingServices(). GetAccountBalance(pAccount.Id, 0, 0, null, 0, (cmbBranches.SelectedItem as Branch).Id); lblAccountBalance.Text = string.Format("{0} {1}", balance.GetFormatedValue(selectedcur.UseCents), selectedcur.Name); } } else { _bookingsStock = null; } }