protected virtual IEnumerable careconrecords() { List <CAReconMessage> listMessages = PXLongOperation.GetCustomInfo(this.UID) as List <CAReconMessage>; CAEnqFilter filter = Filter.Current; foreach (CARecon recon in PXSelectJoin <CARecon, InnerJoin <CashAccount, On <CashAccount.cashAccountID, Equal <CARecon.cashAccountID> >, InnerJoin <Account, On <Account.accountID, Equal <CashAccount.accountID>, And <Match <Account, Current <AccessInfo.userName> > > >, InnerJoin <Sub, On <Sub.subID, Equal <CashAccount.subID>, And <Match <Sub, Current <AccessInfo.userName> > > > > > >, Where2 <Where <CARecon.cashAccountID, Equal <Required <CAEnqFilter.accountID> >, Or <Required <CAEnqFilter.accountID>, IsNull> >, And2 <Where <CARecon.reconDate, GreaterEqual <Required <CAEnqFilter.startDate> >, Or <Required <CAEnqFilter.startDate>, IsNull> >, And <Where <CARecon.reconDate, LessEqual <Required <CAEnqFilter.endDate> >, Or <Required <CAEnqFilter.endDate>, IsNull> > > > >, OrderBy <Asc <CARecon.reconDate, Asc <CARecon.reconNbr> > > > .Select(this, filter.AccountID, filter.AccountID, filter.StartDate, filter.StartDate, filter.EndDate, filter.EndDate)) { TimeSpan timespan; Exception ex; if ((PXLongOperation.GetStatus(UID, out timespan, out ex) == PXLongRunStatus.Aborted || PXLongOperation.GetStatus(UID, out timespan, out ex) == PXLongRunStatus.Completed) && listMessages != null && listMessages.Count > 0) { for (int i = 0; i < listMessages.Count; i++) { CAReconMessage message = (CAReconMessage)listMessages[i]; if (message.KeyCashAccount == recon.CashAccountID && message.KeyReconNbr == recon.ReconNbr) { CAReconRecords.Cache.RaiseExceptionHandling <CARecon.reconNbr>(recon, recon.ReconNbr, new PXSetPropertyException(message.Message, message.ErrorLevel)); } } } yield return(recon); } }
public static void RunLongOperationKeepingCurrentMessages(PXGraph graph, PXToggleAsyncDelegate method) { Exception longOperationException = null; PXProcessingInfo currentInfo = PXLongOperation.GetCustomInfo() as PXProcessingInfo; try { method(); } catch (Exception e) { longOperationException = e; } try { PXLongOperation.WaitCompletion(graph.UID); } catch (Exception e) { if (longOperationException == null) { longOperationException = e; } } PXLongOperation.SetCustomInfo(currentInfo); if (longOperationException != null) { throw longOperationException; } }
protected virtual void GLVoucher_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { GLVoucher row = (GLVoucher)e.Row; if (e.Row == null) { return; } Dictionary <string, Dictionary <Guid, CAMessage> > listMessages = PXLongOperation.GetCustomInfo(this.UID) as Dictionary <string, Dictionary <Guid, CAMessage> >; PXLongRunStatus status = GetLongOperationStatus(); if ((status == PXLongRunStatus.Aborted || status == PXLongRunStatus.Completed) && listMessages != null) { string key = row.VoucherBatchNbr; if (listMessages.ContainsKey(key)) { CAMessage message; if (listMessages[key].TryGetValue(row.RefNoteID ?? Guid.Empty, out message)) { sender.RaiseExceptionHandling <GLVoucher.refNbr>(row, row.RefNbr, new PXSetPropertyException <GLVoucher.refNbr>(message.Message, message.ErrorLevel)); } } } }
protected virtual void GLVoucherBatch_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { GLVoucherBatch row = (GLVoucherBatch)e.Row; if (e.Row == null) { return; } Dictionary <string, Dictionary <Guid, CAMessage> > listMessages = PXLongOperation.GetCustomInfo(this.UID) as Dictionary <string, Dictionary <Guid, CAMessage> >; TimeSpan timespan; Exception ex; PXLongRunStatus status = PXLongOperation.GetStatus(this.UID, out timespan, out ex); if ((status == PXLongRunStatus.Aborted || status == PXLongRunStatus.Completed) && listMessages != null) { string key = row.VoucherBatchNbr; if (listMessages.ContainsKey(key)) { VouchersInBatch.View.AllowSelect = true; CAMessage message; if (listMessages[key].TryGetValue(Guid.Empty, out message)) { sender.RaiseExceptionHandling <GLVoucherBatch.voucherBatchNbr>(row, row.VoucherBatchNbr, new PXSetPropertyException <GLVoucherBatch.voucherBatchNbr>(message.Message, message.ErrorLevel)); } else { sender.RaiseExceptionHandling <GLVoucherBatch.voucherBatchNbr>(row, row.VoucherBatchNbr, new PXSetPropertyException <GLVoucherBatch.voucherBatchNbr>("Processed", PXErrorLevel.RowInfo)); } } else { VouchersInBatch.View.AllowSelect = false; } } else { VouchersInBatch.View.AllowSelect = false; PXUIFieldAttribute.SetEnabled(sender, null, status == PXLongRunStatus.NotExists); } DisableOnProcessing(status); if (row != null) { PXUIFieldAttribute.SetEnabled(sender, row, false); PXUIFieldAttribute.SetEnabled <GLVoucherBatch.selected>(sender, row, row.Released == false); PXUIFieldAttribute.SetEnabled <GLVoucherBatch.descr>(sender, row, row.Released == false); } PXUIFieldAttribute.SetEnabled <GLVoucherBatch.released>(sender, null, false); PXUIFieldAttribute.SetEnabled <GLVoucherBatch.voucherBatchNbr>(sender, null, false); PXUIFieldAttribute.SetEnabled <GLVoucherBatch.docCount>(sender, null, false); }
protected virtual void GLVoucherBatch_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { GLVoucherBatch row = (GLVoucherBatch)e.Row; if (row == null) { return; } Dictionary <string, Dictionary <Guid, CAMessage> > listMessages = PXLongOperation.GetCustomInfo(this.UID) as Dictionary <string, Dictionary <Guid, CAMessage> >; PXLongRunStatus status = GetLongOperationStatus(); if ((status == PXLongRunStatus.Aborted || status == PXLongRunStatus.Completed) && listMessages != null) { string key = row.VoucherBatchNbr; if (listMessages.ContainsKey(key)) { VouchersInBatch.View.AllowSelect = true; CAMessage message; if (listMessages[key].TryGetValue(Guid.Empty, out message)) { sender.RaiseExceptionHandling <GLVoucherBatch.voucherBatchNbr>(row, row.VoucherBatchNbr, new PXSetPropertyException <GLVoucherBatch.voucherBatchNbr>(message.Message, message.ErrorLevel)); } else { sender.RaiseExceptionHandling <GLVoucherBatch.voucherBatchNbr>(row, row.VoucherBatchNbr, new PXSetPropertyException <GLVoucherBatch.voucherBatchNbr>("Processed", PXErrorLevel.RowInfo)); } } else { VouchersInBatch.View.AllowSelect = false; } } else { VouchersInBatch.View.AllowSelect = false; } GLWorkBook workBook = WorkBook.Select(filter.Current.WorkBookID); bool active = workBook.Status == WorkBookStatus.Active; PXUIFieldAttribute.SetEnabled <GLVoucherBatch.selected>(sender, row, row.Released == false && active); PXUIFieldAttribute.SetEnabled <GLVoucherBatch.descr>(sender, row, row.Released == false && active); }
public virtual IEnumerable cATranListRecords() { CAEnqFilter filter = Filter.Current; List <PXResult <CATranExt, BAccountR> > result = new List <PXResult <CATranExt, BAccountR> >(); if (filter != null && filter.ShowSummary == true) { long?id = 0; int startRow = 0; int totalRows = 0; foreach (CADailySummary daily in CATranListSummarized.View.Select(null, null, new object[PXView.SortColumns.Length], PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, 0, ref totalRows)) { CATranExt tran = new CATranExt(); id++; tran.TranID = id; tran.CashAccountID = daily.CashAccountID; tran.TranDate = daily.TranDate; tran.CuryDebitAmt = daily.AmtReleasedClearedDr + daily.AmtReleasedUnclearedDr; tran.CuryCreditAmt = daily.AmtReleasedClearedCr + daily.AmtReleasedUnclearedCr; if (Filter.Current.IncludeUnreleased == true) { tran.CuryDebitAmt += daily.AmtUnreleasedClearedDr + daily.AmtUnreleasedUnclearedDr; tran.CuryCreditAmt += daily.AmtUnreleasedClearedCr + daily.AmtUnreleasedUnclearedCr; } tran.DayDesc = TM.EPCalendarFilter.CalendarTypeAttribute.GetDayName(((DateTime)tran.TranDate).DayOfWeek); result.Add(new PXResult <CATranExt, BAccountR>(tran, new BAccountR())); } } else { Dictionary <long, CAMessage> listMessages = PXLongOperation.GetCustomInfo(this.UID) as Dictionary <long, CAMessage>; PXSelectBase <CATranExt> cmd = new PXSelectJoin <CATranExt, LeftJoin <ARPayment, On <ARPayment.docType, Equal <CATranExt.origTranType>, And <ARPayment.refNbr, Equal <CATran.origRefNbr> > >, LeftJoin <BAccountR, On <BAccountR.bAccountID, Equal <CATranExt.referenceID> > > >, Where2 <Where <Current <CAEnqFilter.includeUnreleased>, Equal <boolTrue>, Or <CATran.released, Equal <boolTrue> > >, And <CATranExt.cashAccountID, Equal <Current <CAEnqFilter.accountID> >, And <CATranExt.tranDate, Between <Current <CAEnqFilter.startDate>, Current <CAEnqFilter.endDate> > > > >, OrderBy <Asc <CATranExt.tranDate, Asc <CATranExt.extRefNbr, Asc <CATranExt.tranID> > > > >(this); int startRow = 0; int totalRows = 0; foreach (PXResult <CATranExt, ARPayment, BAccountR> iRes in cmd.View.Select(null, null, new object[PXView.SortColumns.Length], PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, 0, ref totalRows)) { CATranExt tran = iRes; ARPayment payment = iRes; BAccountR baccount = iRes; tran.DayDesc = TM.EPCalendarFilter.CalendarTypeAttribute.GetDayName(((DateTime)tran.TranDate).DayOfWeek); tran.DepositNbr = payment.DepositNbr; tran.DepositType = payment.DepositType; if (listMessages != null) { CAMessage message; if (listMessages.TryGetValue(tran.TranID.Value, out message)) { if (message != null && message.Key == tran.TranID) { CATranListRecords.Cache.RaiseExceptionHandling <CATran.origRefNbr>(tran, tran.OrigRefNbr, new PXSetPropertyException(message.Message, message.ErrorLevel)); } } } result.Add(new PXResult <CATranExt, BAccountR>(tran, baccount)); } } decimal curBalance = 0; if (filter != null && filter.BegBal != null) { curBalance = (decimal)filter.BegBal; } PXView.ReverseOrder = false; foreach (PXResult <CATranExt, BAccountR> it in PXView.Sort(result)) { CATran tran = it; tran.BegBal = curBalance; tran.EndBal = tran.BegBal + tran.CuryDebitAmt - tran.CuryCreditAmt; curBalance = (decimal)tran.EndBal; CATranListRecords.Cache.Hold(tran); } return(result); }