protected override List <DashboardAR> GetCache(DashboardFilter filter) { DateTime firstOfMonth = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); filter.DateTo = filter.DateTo < firstOfMonth ? filter.DateTo : firstOfMonth; filter.DateFrom = new DateTime(filter.DateFrom.Year, filter.DateFrom.Month, 1); return(DashboardQueries.GetAR(filter.DateFrom, filter.DateTo, DashboardARs.Refresh(filter.DateFrom))); }
private void Window_Loaded(object sender, RoutedEventArgs e) { contrDashProvList.FillData(); //prodProvs List <Color> listColorsProd = DashboardQueries.GetProdProvColors(); List <List <int> > listDataProd = DashboardQueries.GetProdProvs(contrDashProdProvs.DateStart, contrDashProdProvs.DateEnd); contrDashProdProvs.FillData(Lans.g(this, "Production by Prov"), 1000, listColorsProd, listDataProd); //A/R List <Color> listColorsAR = new List <Color>(); listColorsAR.Add(Colors.Firebrick); List <DashboardAR> listDashARIn = DashboardARs.Refresh(contrDashAR.DateStart); if (listDashARIn.Count == 0) { //Make a guess as to how long the user might have to wait. double agingInMilliseconds = Ledgers.GetAgingComputationTime(); //Aging will be run a total of 13 times. agingInMilliseconds = agingInMilliseconds * 13; TimeSpan timeSpan = TimeSpan.FromMilliseconds(agingInMilliseconds); string timeEstimate = ""; if (timeSpan.Minutes > 0) { timeEstimate += timeSpan.Minutes + " " + Lans.g(this, "minutes and") + " "; } timeEstimate += timeSpan.Seconds + " " + Lans.g(this, "seconds"); MessageBoxResult result = MessageBox.Show(Lans.g(this, "A one-time routine needs to be run that will take about") + "\r\n" + timeEstimate + ". " + Lans.g(this, "Continue?"), "", MessageBoxButton.OKCancel); if (result != MessageBoxResult.OK) { Close(); return; } } List <DashboardAR> listDashAROut = DashboardQueries.GetAR(contrDashAR.DateStart, contrDashAR.DateEnd, listDashARIn); List <List <int> > listDataAR = new List <List <int> >(); //1 dimensional for now. listDataAR.Add(listDashAROut.OrderBy(x => x.DateCalc).Select(x => (int)x.BalTotal).ToList()); contrDashAR.FillData(Lans.g(this, "Accounts Receivable"), 1000, listColorsAR, listDataAR); //ProdInc contrDashProdInc.FillData(); //new pat List <Color> listColorsNP = new List <Color>(); listColorsNP.Add(Colors.Chocolate); List <List <int> > listDataNP = DashboardQueries.GetNewPatients(contrDashNewPat.DateStart, contrDashNewPat.DateEnd); contrDashNewPat.FillData(Lans.g(this, "New Patients"), 1, listColorsNP, listDataNP); }
private void menuItemResetAR_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to refresh your AR reports? This could take a long time.", "Continue?", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } if (dashboardTabControl.HasUnsavedChanges) { if (MessageBox.Show("You have unsaved changes. Click OK to continue and discard changes.", "Discard Changes?", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } } DashboardARs.Truncate(); RefreshData(true); AddDefaultTabs(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { contrDashProvList.FillData(); //prodProvs List <Color> listColorsProd = DashboardQueries.GetProdProvColors(); List <List <int> > listDataProd = DashboardQueries.GetProdProvs(contrDashProdProvs.DateStart, contrDashProdProvs.DateEnd); contrDashProdProvs.FillData(Lans.g(this, "Production by Prov"), 1000, listColorsProd, listDataProd); //A/R List <Color> listColorsAR = new List <Color>(); listColorsAR.Add(Colors.Firebrick); List <DashboardAR> listDashAR = DashboardARs.Refresh(contrDashAR.DateStart); if (listDashAR.Count == 0) { MessageBoxResult result = MessageBox.Show(Lans.g(this, "A one-time routine needs to be run that will take a few moments."), "", MessageBoxButton.OKCancel); if (result != MessageBoxResult.OK) { Close(); return; } } List <List <int> > listDataAR = DashboardQueries.GetAR(contrDashAR.DateStart, contrDashAR.DateEnd, listDashAR); contrDashAR.FillData(Lans.g(this, "Accounts Receivable"), 1000, listColorsAR, listDataAR); //ProdInc contrDashProdInc.FillData(); //new pat List <Color> listColorsNP = new List <Color>(); listColorsNP.Add(Colors.Chocolate); List <List <int> > listDataNP = DashboardQueries.GetNewPatients(contrDashNewPat.DateStart, contrDashNewPat.DateEnd); contrDashNewPat.FillData(Lans.g(this, "New Patients"), 1, listColorsNP, listDataNP); }