public DishonourReversalExcelImportViewModel(ReceiptBatchType receiptBatchType, int receiptBatchId) { batchType = receiptBatchType; receiptBatchID = receiptBatchId; reasonCodes = DishonourReversalFunctions.GetReasonCodes(batchType); Browse = new DelegateCommand(OnBrowse); Upload = new DelegateCommand(OnUpload); Save = new DelegateCommand(OnSave); Delete = new DelegateCommand(OnDelete); OpenExcelTemplate = new DelegateCommand(OnOpenExcelTemplate); Title = batchType.ToString() + " Receipts Excel Import"; IconFileName = "Excel.jpg"; UIConfirmation = new InteractionRequest<ConfirmationWindowViewModel>(); if (batchType == ReceiptBatchType.Dishonour) { excelTemplateFileName = "DishonourReceiptImportTemplate.xlsx"; } else { excelTemplateFileName = "ReversalReceiptImportTemplate.xlsx"; } }
public DDCCStatusChangeViewModel(ReceiptBatchType batchtype) { batchType = batchtype; LodgeDate = DateTime.Today; IsInternalCompanySelected = true; receipts.Utilities.GetDDCCFileLocations(batchtype, out fileLocation, out archiveLocation); isLocationChanged = false; Browse = new DelegateCommand<string>(OnBrowse); Refresh = new DelegateCommand(OnRefresh); Lodge = new DelegateCommand(OnLodge); ReceiptBatchSelected = new DelegateCommand<ObservableCollection<object>>(OnReceiptBatchSelected); OnRefresh(); IconFileName = "Forward.jpg"; Title = "Lodge" + Regex.Replace(batchType.ToString(), "[A-Z]", " $0") + " Batch"; RaisePropertyChanged("RemitterColumnCaption"); LockTableName = "ReceiptBatch"; }
public NewReceiptViewModel(ReceiptBatchType receiptbatchType, int receiptBatchID, int batchStatus, int receiptid = 0) { batchType = receiptbatchType; receiptID = receiptid; ApplyToList = BatchTypeFunctions.GetApplyToList((int)batchType); LockTableName = "ReceiptBatch"; LockUniqueIdentifier = receiptBatchID.ToString(); isReceiptEditable = batchStatus == (int)ReceiptBatchStatus.Created && IsLocked; try { Save = new DelegateCommand<string>(OnSave); Search = new DelegateCommand(OnSearch); OtherCharge = new DelegateCommand(OnOtherCharge); CalculateBalance = new DelegateCommand(OnCalculateBalance); ResetAllocation = new DelegateCommand<bool?>(SearchOpenItems); UIConfirmation = new InteractionRequest<ConfirmationWindowViewModel>(); Popup = new InteractionRequest<PopupWindow>(); SetReceiptDefaults(receiptBatchID); SetIcon(); if (receiptID > 0) { isReceiptLoading = true; Receipt = ReceiptFunctions.Get(receiptID); AmountReceived = receipt.GrossAmountReceived; receiptApplyTo = (ReceiptApplyTo)Enum.Parse(typeof(ReceiptApplyTo), receipt.ApplyToTypeID.ToString()); if (receipt.CashReceiptDetails != null && receipt.CashReceiptDetails.Count > 0) { Receipt.ChequeReceiptDetail = new ChequeReceiptDetail { PaymentTypeID = 0 }; PaymentType = receipt.CashReceiptDetails.FirstOrDefault().PaymentTypeID; } else if (receipt.ChequeReceiptDetail != null) { PaymentType = receipt.ChequeReceiptDetail.PaymentTypeID; } if (receiptApplyTo == ReceiptApplyTo.Quote) { ApplyToObjectID = receipt.QuoteID; } else if (receiptApplyTo != ReceiptApplyTo.Suspense) { switch (receiptApplyTo) { case ReceiptApplyTo.Contract: ApplyToObjectID = receipt.ContractID; break; case ReceiptApplyTo.Client: ApplyToObjectID = business.ContractFunctions.GetClientID(receipt.ContractID.GetValueOrDefault()); break; case ReceiptApplyTo.Invoice: ApplyToObjectID = business.InvoiceFunctions.GetInvoiceNo(receipt.InvoiceAssetId.GetValueOrDefault()); break; } } if (batchType == ReceiptBatchType.DirectDebit) { DDCCAccountID = receipt.DirectDebitReceiptDetails.FirstOrDefault().BankDetail.BankDetailsId; } else if(batchType == ReceiptBatchType.CreditCard) { DDCCAccountID = receipt.CreditCardReceiptDetails.FirstOrDefault().BankDetail.BankDetailsId; } isReceiptLoading = false; } RaisePropertyChanged("BatchType"); RaisePropertyChanged("IsReceiptEditable"); RaisePropertyChanged("DDCCAccountNoLabelCaption"); RaisePropertyChanged("IsReceiptinEditMode"); } catch (Exception ex) { ExceptionLogger.WriteLog(ex); ShowErrorMessage("Error occurred while initializing Add Receipt Screen", "Add Receipt - Error"); IsBusy = false; } }
public void OnNavigatedTo(NavigationContext navigationContext) { _EventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Start); receiptBatchType = (ReceiptBatchType)Convert.ToInt32(navigationContext.Parameters["BatchType"]); batchID = Convert.ToInt32(navigationContext.Parameters["BatchID"]); ReceiptBatch = ReceiptBatchFunctions.Get(batchID, true); LoadReceiptDetails(batchID); LockUniqueIdentifier = batchID.ToString(); receiptID = 0; BatchType = navigationContext.Parameters["BatchType"] + " Batch"; RaisePropertyChanged("NewReceiptIcon"); RaisePropertyChanged("EditReceiptIcon"); RaisePropertyChanged("DeleteReceiptIcon"); RaisePropertyChanged("IsReceiptSelected"); RaisePropertyChanged("IsBatchPosted"); RaisePropertyChanged("IsDateRangeApplicable"); RaisePropertyChanged("StatusForwardText"); RaisePropertyChanged("StatusBackwardText"); RaisePropertyChanged("IsStatusForwardVisible"); RaisePropertyChanged("IsStatusBackwardVisible"); RaisePropertyChanged("IsStatusForwardAllowed"); RaisePropertyChanged("IsExcelImportVisible"); RaisePropertyChanged("IsReceiptCreated"); RaisePropertyChanged("EditToolTipText"); RaisePropertyChanged("DDCCAcountNoCaption"); _EventAggregator.GetEvent<NavigationChanged>().Publish(Shared.ReceiptNavigation.NavigatingToPath); _EventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Stop); RaisePropertyChanged("IsDDCCBatch"); RaisePropertyChanged("IsCashChequeBatch"); RaisePropertyChanged("IsAddMultipleVisible"); RaisePropertyChanged("IsDishonourReversalBatch"); RaisePropertyChanged("IsAssignReasonVisible"); RaisePropertyChanged("LinkedReceiptIDCaption"); RaisePropertyChanged("ReceiptDateCaption"); RaisePropertyChanged("IsDishonourBatch"); RaisePropertyChanged("IsEditVisible"); }
public NewDishonourReversalViewModel(ReceiptBatchType receiptbatchType, int batchID, int batchStatus, int receiptid = 0) { Receipt receipt, reAllocationReceipt; batchType = receiptbatchType; ReceiptBatchID = batchID; BatchStatus = batchStatus; receiptID = receiptid; LockTableName = "ReceiptBatch"; LockUniqueIdentifier = batchID.ToString(); isReceiptEditable = batchStatus == (int)ReceiptBatchStatus.Created && IsLocked; try { ReasonCodes = DishonourReversalFunctions.GetReasonCodes(batchType); BankAccountID = ReceiptBatchFunctions.Get(ReceiptBatchID).BankAccountID.GetValueOrDefault(); Search = new DelegateCommand(OnSearch); Save = new DelegateCommand<string>(OnSave); ResetAllocation = new DelegateCommand(OnResetAllocation); UIConfirmation = new InteractionRequest<ConfirmationWindowViewModel>(); Popup = new InteractionRequest<PopupWindow>(); SetIcon(); if (receiptID > 0) { receipt = ReceiptFunctions.Get(receiptID); ReceiptDate = receipt.ReceiptDate; Receipt = new Receipt(); Reference = receipt.Reference; if (batchType == ReceiptBatchType.Dishonour) { OriginalReceiptID = receipt.DishonourReceiptDetail.DishonouredReceiptID; reasonSelected = receipt.DishonourReceiptDetail.ReasonCodeID.GetValueOrDefault(); } else if (batchType == ReceiptBatchType.Reversals) { reasonSelected = receipt.ReversalReceiptDetail.ReasonCodeID.GetValueOrDefault(); if (receipt.ReversalReceiptDetail.ReversalTypeID == (int)ReversalTypes.Reversal) { OriginalReceiptID = receipt.ReversalReceiptDetail.LinkedReceiptID.GetValueOrDefault(); ReAllocationReceiptID = DishonourReversalFunctions.GetReAllocationReceiptID(receiptID); if (reAllocationReceiptID.HasValue) { reAllocationReceipt = ReceiptFunctions.Get(reAllocationReceiptID.Value, false); if (reAllocationReceipt.ApplyToTypeID == (int)ReceiptApplyTo.Contract) { ReturnValue = new Tuple<int, int?, string>((int)ReAllocateReceiptTo.Contract, reAllocationReceipt.ContractID, reAllocationReceipt.Reference); } else if (reAllocationReceipt.ApplyToTypeID == (int)ReceiptApplyTo.Quote) { ReturnValue = new Tuple<int, int?, string>((int)ReAllocateReceiptTo.Quote, reAllocationReceipt.QuoteID, reAllocationReceipt.Reference); } else { ReturnValue = new Tuple<int, int?, string>((int)ReAllocateReceiptTo.Suspense, reAllocationReceipt.ContractID, reAllocationReceipt.Reference); } } } else { ReAllocationReceiptID = receiptID; if (receipt.ApplyToTypeID == (int)ReceiptApplyTo.Contract) { ReturnValue = new Tuple<int, int?, string>((int)ReAllocateReceiptTo.Contract, receipt.ContractID, receipt.Reference); } else if (receipt.ApplyToTypeID == (int)ReceiptApplyTo.Quote) { ReturnValue = new Tuple<int, int?, string>((int)ReAllocateReceiptTo.Quote, receipt.QuoteID, receipt.Reference); } else { ReturnValue = new Tuple<int, int?, string>((int)ReAllocateReceiptTo.Suspense, receipt.ContractID, receipt.Reference); } receiptID = receipt.ReversalReceiptDetail.LinkedReceiptID.GetValueOrDefault(); receipt = ReceiptFunctions.Get(receiptID); Reference = receipt.Reference; OriginalReceiptID = receipt.ReversalReceiptDetail.LinkedReceiptID; IsResetAllocation = true; } } } else { SetReceiptDefaults(ReceiptBatchID); } RaisePropertyChanged("BatchType"); RaisePropertyChanged("IsReceiptSelected"); RaisePropertyChanged("IsSuspense"); RaisePropertyChanged("IsReceiptEditable"); RaisePropertyChanged("AmountAppliedCaption"); RaisePropertyChanged("IsReceiptinEditMode"); RaisePropertyChanged("IsReversalBatch"); } catch (Exception ex) { ExceptionLogger.WriteLog(ex); ShowErrorMessage("Error occurred while initializing Add Receipt Screen", "Add Receipt - Error"); } finally { IsBusy = false; } }
public DishonourReversalReceiptExcelImport(ReceiptBatchType batchType, int receiptBatchID) { InitializeComponent(); DishonourReversalExcelImportViewModel = new DishonourReversalExcelImportViewModel(batchType, receiptBatchID); }
public DDCCStatusChange(ReceiptBatchType batchType) { InitializeComponent(); DDCCStatusChangeViewModel = new DDCCStatusChangeViewModel(batchType); }