public static TurnOverReportCollection GetTurnOverReportSpecial(AccountantEntity accountEntity, DateTime from, DateTime to) { EntityModelContainer context = GetContext(); TurnOverReportCollection result = new TurnOverReportCollection(); //Cheque Payments Pay var queryChequePaymentPay = context.ChequePayments.Where( i => i.PayerId == accountEntity.Id && i.PayDate >= from && i.PayDate <= to && i.Status == (int)ChequeStatus.Unkown ); foreach (var item in queryChequePaymentPay) { result.Add(new TurnOverReportItem() { PageNumber = item.PaymentDocument.DocumentSerial.ToString(), Date = item.PayDate, PageTitle = "بابت شماره برگه " + item.PaymentDocument.DocumentSerial + "به خاطر پرداخت چک", PageDescription = item.Description, Credit = 0, Debit = item.Value }); } return result; }
private void btnSearch_Click(object sender, EventArgs e) { try { _accountant = GetCurrentAccountant(); _from = GetFromDate(); _to = GetToDate(); if (ValidateQuery(_accountant, _from, _to)) { turnOverReportCollection = DataLayer.GetTurnOverReport(_accountant, _from, _to); grvItems.DataSource = turnOverReportCollection.Items; if (turnOverReportCollection.Items.Length > 0) { lblCredit.Text = string.Format("{0:0,0 ریال }", turnOverReportCollection.CreditSum); lblDebit.Text = string.Format("{0:0,0 ریال }", turnOverReportCollection.DebitSum); lblRemaining.Text = string.Format("{0:0,0 ریال }", turnOverReportCollection.Remaining); } else { Methods.ShowStandardMsgBox(FormMessageType.Error, "خطا", "موردی یافت نشد."); lblCredit.Text = string.Format("{0:0,0 ریال }", 0); lblDebit.Text = string.Format("{0:0,0 ریال }", 0); lblRemaining.Text = string.Format("{0:0,0 ریال }", 0); } } } catch (Exception exp) { Logger.Log(exp, "TurnOverReport - Query"); Methods.ShowStandardMsgBox(FormMessageType.Error, "خطا", "در حین گرفتن گزارش خطایی رخ داد."); } }
public static TurnOverReportCollection GetTurnOverReport(AccountantEntity accountEntity, DateTime from, DateTime to) { if (accountEntity.Id == 67) return GetTurnOverReportSpecial(accountEntity, from, to); EntityModelContainer context = GetContext(); TurnOverReportCollection result = new TurnOverReportCollection(); TurnOverReportItem[] chequePayment = GetTurnOverChequePayment(accountEntity, from, to); foreach (var item in chequePayment) result.Add(item); TurnOverReportItem[] moneyPayment = GetTurnOverMoneyPayment(accountEntity, from, to); foreach (var item in moneyPayment) result.Add(item); TurnOverReportItem[] chequeReception = GetTurnOverChequeReception(accountEntity, from, to); foreach (var item in chequeReception) result.Add(item); TurnOverReportItem[] moneyReception = GetTurnOverMoneyReception(accountEntity, from, to); foreach (var item in moneyReception) result.Add(item); TurnOverReportItem[] visit = GetTurnOverVisit(accountEntity, from, to); foreach (var item in visit) result.Add(item); TurnOverReportItem[] visitInsurance = GetTurnOverVisitInsurance(accountEntity, from, to); foreach (var item in visitInsurance) result.Add(item); return result; }