public List<AllOperation> GetAllOperation(DateTime from, DateTime to) { var bank = new BankOperationsRepository().GetBankOperations(from, to); var kassa = new KassaOperationRepository().GetKassaOperations(from, to); var all = new List<AllOperation>(); var alloperations = bank.Select(c => new AllOperation() { Id = c.Id, FlagOperation = c.FlagOperation, OperationType = c.OperationType, DocNum = c.DocNum, DocDate = c.DocDate, DocType = c.DocType, Contractor = c.Contractor, Summa = c.Summa, Osnovanie = c.Osnovanie, FlagBankOrKassa = BankOrKassa.Bank }) .Union(kassa.Select(c => new AllOperation() { FlagOperation = c.FlagOperation, OperationType = c.OperationType, DocNum = c.DocNum, DocDate = c.DocDate, DocType = null, Contractor = c.Contractor, Summa = c.Summa, Osnovanie = c.Osnovanie, FlagBankOrKassa = BankOrKassa.Kassa })).OrderBy(c => c.DocDate).ThenBy(c => c.DocNum).ToList(); return alloperations; }
public List<AllOperation> Find(string find) { var all = new List<AllOperation>(); decimal summa = 0; Decimal.TryParse(find, out summa); var bank = new BankOperationsRepository().GetAll().Where(c => c.Contractor.Contains(find) || c.DocNum == find || c.Summa == summa); var kassa = new KassaOperationRepository().GetAll().Where(c => c.Contractor.Contains(find) || c.DocNum == find || c.Summa == summa); var alloperations = bank.Select(c => new AllOperation() { Id = c.Id, FlagOperation = c.FlagOperation, OperationType = c.OperationType, DocNum = c.DocNum, DocDate = c.DocDate, DocType = c.DocType, Contractor = c.Contractor, Summa = c.Summa, Osnovanie = c.Osnovanie, FlagBankOrKassa = BankOrKassa.Bank }) .Union(kassa.Select(c => new AllOperation() { FlagOperation = c.FlagOperation, OperationType = c.OperationType, DocNum = c.DocNum, DocDate = c.DocDate, DocType = null, Contractor = c.Contractor, Summa = c.Summa, Osnovanie = c.Osnovanie, FlagBankOrKassa = BankOrKassa.Kassa })).OrderBy(c => c.DocDate).ThenBy(c => c.DocNum).ToList(); return alloperations; }
private void обороткаToolStripMenuItem1_Click(object sender, EventArgs e) { Stimulsoft.Report.StiConfig.LoadLocalization("ru.xml"); StiReport report = new StiReport(); StiOptions.Dictionary.BusinessObjects.MaxLevel = 0; report.Load(Path.Combine(Application.StartupPath, "Reports\\oborotka.mrt")); var opers = new KassaOperationRepository().GetKassaOperations(BeginDate, EndDate).ToList(); report.RegData("Operations", opers); report.Dictionary.Variables.Add("BeginDate", BeginDate); report.Dictionary.Variables.Add("EndDate", EndDate); var saldolist = new KassaOperationRepository().GetKassaOperations(BeginDate, EndDate).ToList(); decimal saldodebet, saldokredit; if (saldolist != null) { saldodebet = saldolist.Sum(c => c.SummaDebet); saldokredit = saldolist.Sum(c => c.SummaKredit); } else saldodebet = saldokredit = 0M; report.Dictionary.Variables.Add("SaldoDebet", saldodebet); report.Dictionary.Variables.Add("SaldoKredit", saldokredit); //report.ReportName = String.Format("Накладная №{0} от {1:dd-MM-yyyy}", order.Invoice.Num, order.Invoice.Data); //report.Design(); report.Show(true); }