protected void OnButtonPrintClicked(object sender, EventArgs e) { if (UoWGeneric.HasChanges && CommonDialogs.SaveBeforePrint(typeof(Expense), "квитанции")) { Save(); } var reportInfo = new QS.Report.ReportInfo { Title = String.Format("Квитанция №{0} от {1:d}", Entity.Id, Entity.Date), Identifier = "Cash.Expense", Parameters = new Dictionary <string, object> { { "id", Entity.Id } } }; var report = new QSReport.ReportViewDlg(reportInfo); TabParent.AddTab(report, this, false); }
private void CreateCommands() { SendCommand = new DelegateCommand( () => { var valid = new QSValidator <CommonCashTransferDocument>(Entity, new Dictionary <object, object>()); if (valid.RunDlgIfNotValid()) { return; } Entity.Send(Cashier); }, () => { return(Cashier != null && Entity.Status == CashTransferDocumentStatuses.New && Entity.Driver != null && Entity.Car != null && Entity.CashSubdivisionFrom != null && Entity.CashSubdivisionTo != null && Entity.ExpenseCategory != null && Entity.IncomeCategory != null && Entity.TransferedSum > 0); } ); SendCommand.CanExecuteChangedWith(Entity, x => x.Status, x => x.Driver, x => x.Car, x => x.CashSubdivisionFrom, x => x.CashSubdivisionTo, x => x.TransferedSum, x => x.ExpenseCategory, x => x.IncomeCategory ); ReceiveCommand = new DelegateCommand( () => { Entity.Receive(Cashier); }, () => { return(Cashier != null && Entity.Status == CashTransferDocumentStatuses.Sent && availableSubdivisionsForUser.Contains(Entity.CashSubdivisionTo) && Entity.Id != 0); } ); ReceiveCommand.CanExecuteChangedWith(Entity, x => x.Status, x => x.Id ); PrintCommand = new DelegateCommand( () => { var reportInfo = new QS.Report.ReportInfo { Title = String.Format($"Документ перемещения №{Entity.Id} от {Entity.CreationDate:d}"), Identifier = "Documents.CommonCashTransfer", Parameters = new Dictionary <string, object> { { "transfer_document_id", Entity.Id } } }; var report = new QSReport.ReportViewDlg(reportInfo); View.TabParent.AddTab(report, View, false); }, () => Entity.Id != 0 ); }