Exemplo n.º 1
0
        private static void RegenerateStatements(PrintParameters pars, List <DetailsResult> statements)
        {
            var process        = PXGraph.CreateInstance <StatementCycleProcessBO>();
            var cycle          = process.CyclesList.SelectSingle(pars.StatementCycleId);
            var customerSelect = new PXSelect <Customer, Where <Customer.bAccountID, Equal <Required <DetailsResult.customerID> > > >(process);

            int             i         = 0;
            List <Customer> customers = new List <Customer>();

            foreach (DetailsResult res in statements)
            {
                if (ARStatementProcess.CheckForUnprocessedPPD(process, pars.StatementCycleId, pars.StatementDate, res.CustomerID))
                {
                    PXFilteredProcessing <DetailsResult, PrintParameters> .SetError(i,
                                                                                    new PXSetPropertyException(Messages.UnprocessedPPDExists, PXErrorLevel.RowError));
                }
                else
                {
                    Customer customer = customerSelect.SelectSingle(res.CustomerID);
                    if (customer != null)
                    {
                        customers.Add(customer);
                    }
                }
                i++;
            }

            if (cycle == null || customers.Any() == false)
            {
                return;
            }
            StatementCycleProcessBO.RegenerateStatements(process, cycle, customers);
        }
Exemplo n.º 2
0
		protected virtual void ARStatementCycle_RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
		{
			if (e.Row != null)
			{
				ARStatementCycle row = e.Row as ARStatementCycle;

				row.NextStmtDate = ARStatementProcess.CalcStatementDateBefore(
					sender.Graph,
					this.Accessinfo.BusinessDate.Value, 
					row.PrepareOn, 
					row.Day00, 
					row.Day01,
					row.DayOfWeek);

				if (row.LastStmtDate.HasValue && row.NextStmtDate <= row.LastStmtDate)
				{
					row.NextStmtDate = ARStatementProcess.CalcNextStatementDate(
						sender.Graph,
						row.LastStmtDate.Value, 
						row.PrepareOn, 
						row.Day00, 
						row.Day01,
						row.DayOfWeek);
				}
			}
		}
Exemplo n.º 3
0
        public virtual IEnumerable recreateLast(PXAdapter adapter)
        {
            ARStatementCycle row = ARStatementCycleRecord.Current;

            if (row != null)
            {
                if (ARStatementProcess.CheckForUnprocessedPPD(this, row.StatementCycleId, row.LastStmtDate, null))
                {
                    throw new PXSetPropertyException(Messages.UnprocessedPPDExists);
                }

                if (row.LastStmtDate != null)
                {
                    PXLongOperation.StartOperation(this, delegate() { StatementCycleProcessBO.RegenerateLastStatement(CreateInstance <StatementCycleProcessBO>(), row); });
                }
            }

            return(adapter.Get());
        }