private void CreateObj()
        {
            if (FromDate.SelectedDate == null || ToDate.SelectedDate == null)
            {
                MessageBox.Show("Please select from date and to date correctly..");
                return;
            }
            BillingDataDataContext db = new BillingDataDataContext();
            var c = (Client)this.ClientListCombo.SelectedItem;

            invoice = db.AccountStatements.Where(x => x.ClientCode == c.CLCODE && x.TransactionDate <= ToDate.SelectedDate && x.TransactionDate >= FromDate.SelectedDate).OrderBy(y => y.TransactionDate).ToList();
            AccountStatement carryOverDueRecord = new AccountStatement();

            carryOverDueRecord.Id                  = "";
            carryOverDueRecord.TypeOfRecord        = "Carry";
            carryOverDueRecord.Remark              = "PreviousDue/CarryOverDue";
            carryOverDueRecord.TransactionDate     = FromDate.SelectedDate ?? DateTime.Today;
            carryOverDueRecord.PayAmount           = db.CarryOverDue(FromDate.SelectedDate, c.CLCODE);
            carryOverDueRecord.TotalRecievedAmount = 0;
            invoice.Add(carryOverDueRecord);
            rs.Value = invoice;
            AccountStatementViewer.LocalReport.DataSources.Clear();
            AccountStatementViewer.LocalReport.DataSources.Add(rs);
            List <ReportParameter> repParams = new List <ReportParameter>();

            repParams.Add(new ReportParameter("CompanyName", Configs.Default.CompanyName));
            repParams.Add(new ReportParameter("ComapnyPhoneNo", Configs.Default.CompanyPhone));
            repParams.Add(new ReportParameter("CompanyAddress", Configs.Default.CompanyAddress));
            repParams.Add(new ReportParameter("CompanyEmail", Configs.Default.CompanyEmail));
            repParams.Add(new ReportParameter("CompanyFax", Configs.Default.CompanyFax));
            repParams.Add(new ReportParameter("ToDate", ((DateTime)ToDate.SelectedDate).ToString("dd-MMM-yyyy")));
            repParams.Add(new ReportParameter("FromDate", ((DateTime)FromDate.SelectedDate).ToString("dd-MMM-yyyy")));
            double?billedamountsum      = this.invoice.Select(y => y.PayAmount).Sum();
            double?amountRecivedsum     = this.invoice.Select(y => y.TotalRecievedAmount).Sum();
            double?TotalSum             = billedamountsum - amountRecivedsum;
            List <PaymentEntry> entries = db.PaymentEntries.Where(x => x.ClientCode == c.CLCODE && x.Date <= (ToDate.SelectedDate ?? DateTime.Today) && x.Date >= (FromDate.SelectedDate ?? DateTime.Today)).ToList();
            // List<PaymentEntry> entries = db.PaymentEntries.Where(x => x.ClientCode == c.CLCODE && x.DebitNote != null && x.Date <= (ToDate.SelectedDate ?? DateTime.Today) && x.Date >= (FromDate.SelectedDate ?? DateTime.Today)).ToList();
            double totalTDS   = 0;
            double totalDNote = 0;

            if (entries.Count > 0)
            {
                totalTDS   = entries.Select(x => x.TDS).Sum();
                totalDNote = entries.Select(x => x.DebitNote).Sum();
            }
            repParams.Add(new ReportParameter("TotalTDS", String.Format("{0:F2}", totalTDS)));
            repParams.Add(new ReportParameter("TotalDiscount", String.Format("{0:F2}", totalDNote)));
            string sumS = String.Format("{0:F2}", TotalSum ?? 0);

            repParams.Add(new ReportParameter("TotalSum", sumS));
            repParams.Add(new ReportParameter("ClientName", c.CLNAME));
            repParams.Add(new ReportParameter("ClientAddress", c.ADDRESS));
            repParams.Add(new ReportParameter("ClientPhoneNo", c.CONTACTNO));
            AccountStatementViewer.LocalReport.SetParameters(repParams);
            AccountStatementViewer.ShowExportButton = true;
            AccountStatementViewer.RefreshReport();
        }
コード例 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (FromDate.SelectedDate == null || ToDate.SelectedDate == null)
            {
                MessageBox.Show("Please select from date and to date correctly..");
                return;
            }
            BillingDataDataContext db = new BillingDataDataContext();
            string type;

            if (InvoiceRadio.IsChecked == true)
            {
                type = "Invoice";
            }
            else
            {
                type = "Payment";
            }
            var source = db.AccountStatementFulls.Where(x => x.TransactionDate >= FromDate.SelectedDate && x.TransactionDate <= ToDate.SelectedDate && x.TypeOfRecord == type).OrderBy(y => y.TransactionDate);
            List <AccountStatementFull> reportSource = source.ToList();

            if (type == "Invoice")
            {
                List <Invoice> invoiceList           = db.Invoices.Where(x => x.Date >= FromDate.SelectedDate && x.Date <= ToDate.SelectedDate).ToList();
                List <AccountStatementFull> AccSTats = source.ToList();
                AccSTats.ForEach(x =>
                {
                    Invoice inv = invoiceList.SingleOrDefault(y => y.BillId == x.Id);
                    if (inv != null)
                    {
                        x.PayAmount = x.PayAmount + inv.PreviousDue;
                    }
                });
                reportSource = AccSTats;
            }
            rs.Value = reportSource;
            List <ReportParameter> repParams = new List <ReportParameter>();

            repParams.Add(new ReportParameter("ToDate", ((DateTime)ToDate.SelectedDate).ToString("dd-MMM-yyyy")));
            repParams.Add(new ReportParameter("FromDate", ((DateTime)FromDate.SelectedDate).ToString("dd-MMM-yyyy")));
            repParams.Add(new ReportParameter("Type", type));
            AccountStatementViewer.LocalReport.DataSources.Clear();
            AccountStatementViewer.LocalReport.DataSources.Add(rs);
            AccountStatementViewer.LocalReport.SetParameters(repParams);
            AccountStatementViewer.ShowExportButton = true;
            AccountStatementViewer.RefreshReport();
        }
コード例 #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (FromDate.SelectedDate == null || ToDate.SelectedDate == null)
            {
                MessageBox.Show("Please select from date and to date correctly..");
                return;
            }
            BillingDataDataContext db   = new BillingDataDataContext();
            var            source       = db.Expenses.Where(x => x.Date >= FromDate.SelectedDate && x.Date <= ToDate.SelectedDate);
            List <Expense> reportSource = source.ToList();

            rs.Value = reportSource;
            AccountStatementViewer.LocalReport.DataSources.Clear();
            AccountStatementViewer.LocalReport.DataSources.Add(rs);
            AccountStatementViewer.ShowExportButton = true;
            AccountStatementViewer.RefreshReport();
        }
コード例 #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (FromDate.SelectedDate == null || ToDate.SelectedDate == null)
            {
                MessageBox.Show("Please select from date and to date correctly..");
                return;
            }
            Client selectedClient     = ClientListCombo.SelectedItem as Client;
            BillingDataDataContext db = new BillingDataDataContext();
            var source = db.ClientReportViews.Where(x => x.BookingDate >= FromDate.SelectedDate && x.BookingDate <= ToDate.SelectedDate);

            if (ShowSelectedClientCheck.IsChecked == true)
            {
                source = source.Where(x => x.CustCode == selectedClient.CLCODE);
            }
            List <ClientReportView> reportSource = source.ToList();

            rs.Value = reportSource;
            AccountStatementViewer.LocalReport.DataSources.Clear();
            AccountStatementViewer.LocalReport.DataSources.Add(rs);
            AccountStatementViewer.ShowExportButton = true;
            AccountStatementViewer.RefreshReport();
        }
 private void ClientListCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     AccountStatementViewer.LocalReport.DataSources.Clear();
     AccountStatementViewer.RefreshReport();
 }