//////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// internal void UserControl_Loaded() { try { DailyInitialCash dailyInitialCash = getDailyInitialCashByDate(DateTime.Today); if (dailyInitialCash != null) { dailyInitialCashManager.textBox_initialCashAmount.DoubleValue = dailyInitialCash.Amount; } else { dailyInitialCashManager.textBox_initialCashAmount.DoubleValue = 0; } double totalIncome = 0; SellingCash sellingCash_request = new SellingCash(); sellingCash_request.Date = DateTime.Today; List <SellingCash> listSellingCash = paymentManagerImpl.getSellingCash(sellingCash_request); foreach (SellingCash sellingCash_a in listSellingCash) { totalIncome += sellingCash_a.Amount; } SellingInvoice sellingInvoice_request = new SellingInvoice(); sellingInvoice_request.Date = DateTime.Today; List <SellingInvoice> listSellingInvoice = sellingInvoiceManagerImpl.getInvoice(sellingInvoice_request); foreach (SellingInvoice sellingInvoice_a in listSellingInvoice) { totalIncome -= sellingInvoice_a.ReferrerCommision; } dailyInitialCashManager.textBox_totalIncome.Text = totalIncome.ToString("#,##0.00"); double totalExpences = 0; BuyingCash buyingCash_request = new BuyingCash(); buyingCash_request.Date = DateTime.Today; List <BuyingCash> listBuyingCash = paymentManagerImpl.getBuyingCash(buyingCash_request); foreach (BuyingCash buyingCash_a in listBuyingCash) { totalExpences += buyingCash_a.Amount; } Expense expense_request = new Expense(); expense_request.Date = DateTime.Today; List <Expense> listExpense = expenseManagerImpl.get(expense_request); foreach (Expense expense_a in listExpense) { totalExpences += expense_a.Amount; } dailyInitialCashManager.textBox_totalExpences.Text = totalExpences.ToString("#,##0.00"); dailyInitialCashManager.textBox_finalCashAmount.Text = getFinalCashAmount(Convert.ToDouble(dailyInitialCashManager.textBox_initialCashAmount.Text), totalIncome, totalExpences, Convert.ToDouble(string.IsNullOrWhiteSpace(dailyInitialCashManager.textBox_otherWidthraw.Text) ? "0" : dailyInitialCashManager.textBox_otherWidthraw.Text)).ToString("#,##0.00"); } catch (Exception) { } }