protected virtual void DocumentSelection_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e) { ARRegister documentAsRegister = e.Row as ARRegister; if (documentAsRegister != null && documentAsRegister.Voided == false && documentAsRegister.Scheduled == false) { ARReleaseProcess.UpdateARBalances(this, documentAsRegister, -documentAsRegister.OrigDocAmt); documentAsRegister.Scheduled = true; documentAsRegister.ScheduleID = Schedule_Header.Current.ScheduleID; ARReleaseProcess.UpdateARBalances(this, documentAsRegister, documentAsRegister.OrigDocAmt); } DocumentSelection document = e.Row as DocumentSelection; if (document != null && !string.IsNullOrWhiteSpace(document.DocType) && !string.IsNullOrWhiteSpace(document.RefNbr) && PXSelectorAttribute.Select <DocumentSelection.refNbr>(cache, document) == null) { cache.RaiseExceptionHandling <DocumentSelection.refNbr>( document, document.RefNbr, new PXSetPropertyException(AP.Messages.ReferenceNotValid)); Document_Detail.Cache.Remove(document); } }
public override void Persist() { foreach (DocumentSelection b in Document_Detail.Cache.Updated) { ARReleaseProcess.UpdateARBalances(this, b, -b.OrigDocAmt); if (b.Voided == false) { b.Scheduled = true; b.ScheduleID = Schedule_Header.Current.ScheduleID; Document_Detail.Cache.Update(b); } ARReleaseProcess.UpdateARBalances(this, b, b.OrigDocAmt); } foreach (DocumentSelection b in Document_Detail.Cache.Deleted) { ARReleaseProcess.UpdateARBalances(this, b, -b.OrigDocAmt); PXDBDefaultAttribute.SetDefaultForUpdate <DocumentSelection.scheduleID>(Document_Detail.Cache, b, false); b.Voided = true; b.OpenDoc = false; b.Scheduled = false; b.ScheduleID = null; Document_Detail.Cache.SetStatus(b, PXEntryStatus.Updated); Document_Detail.Cache.Update(b); ARReleaseProcess.UpdateARBalances(this, b, b.OrigDocAmt); } base.Persist(); }
public virtual void CreateWriteOff(ReasonCode reasonCode, string WOSubCD, DateTime?WODate, string WOFinPeriodID, ARRegister ardoc) { Int32?WOAccountID = reasonCode.AccountID; if (WOAccountID == null) { throw new ArgumentNullException("WOAccountID"); } if (WOSubCD == null) { throw new ArgumentNullException("WOSubCD"); } this.Clear(); customer.Current = null; _CustomerID = ardoc.CustomerID; ARPayment payment = new ARPayment(); payment.BranchID = ardoc.BranchID; payment = PXCache <ARPayment> .CreateCopy(this.Document.Insert(payment)); payment.CustomerID = ardoc.CustomerID; payment.CustomerLocationID = ardoc.CustomerLocationID; payment.AdjDate = WODate; payment.AdjFinPeriodID = WOFinPeriodID; payment.DocDate = WODate; payment.FinPeriodID = WOFinPeriodID; payment.CuryID = ardoc.CuryID; payment.ARAccountID = WOAccountID; payment.Hold = false; payment.DocDesc = reasonCode.Descr; payment = this.Document.Update(payment); this.Document.Cache.SetValueExt <ARPayment.aRSubID>(payment, WOSubCD); ARAdjust adj = new ARAdjust(); adj.AdjdDocType = ardoc.DocType; adj.AdjdRefNbr = ardoc.RefNbr; adj = this.Adjustments.Insert(adj); Document.Current.CuryDocBal += (decimal)adj.CuryAdjgAmt; Document.Current.DocBal += (decimal)adj.AdjAmt; Document.Current.CuryOrigDocAmt += (decimal)adj.CuryAdjgAmt; Document.Current.OrigDocAmt += (decimal)adj.AdjAmt; ARReleaseProcess.UpdateARBalances(this, Document.Current, adj.AdjAmt); if (Document.Cache.GetStatus(Document.Current) == PXEntryStatus.Notchanged) { Document.Cache.SetStatus(Document.Current, PXEntryStatus.Updated); } this.Actions.PressSave(); }
public override void UpdateARBalances(PXCache cache, object newRow, object oldRow) { if (oldRow != null) { ARInvoice oldARRow = Document.Cache.GetMain((Document)oldRow) as ARInvoice; ARReleaseProcess.UpdateARBalances(cache.Graph, (ARInvoice)oldARRow, -((ARInvoice)oldARRow).OrigDocAmt); } if (newRow != null) { ARInvoice newARRow = Document.Cache.GetMain((Document)newRow) as ARInvoice; ARReleaseProcess.UpdateARBalances(cache.Graph, (ARInvoice)newARRow, ((ARInvoice)newARRow).OrigDocAmt); } }
public override void UpdateARBalances(PXCache cache, Object newRow, Object oldRow) { if (oldRow != null) { SOOrder oldSORow = Document.Cache.GetMain((Document)oldRow) as SOOrder; ARReleaseProcess.UpdateARBalances(cache.Graph, oldSORow, -(oldSORow).UnbilledOrderTotal, -(oldSORow.OpenOrderTotal)); } if (newRow != null) { SOOrder newSORow = Document.Cache.GetMain((Document)newRow) as SOOrder; ARReleaseProcess.UpdateARBalances(cache.Graph, newSORow, (newSORow).UnbilledOrderTotal, newSORow.OpenOrderTotal); } }
protected virtual void DocumentSelection_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e) { ARRegister ap = e.Row as ARRegister; if (ap != null && ap.Voided == false && ap.Scheduled == false) { ARReleaseProcess.UpdateARBalances(this, ap, -ap.OrigDocAmt); ap.Scheduled = true; ap.ScheduleID = Schedule_Header.Current.ScheduleID; ARReleaseProcess.UpdateARBalances(this, ap, ap.OrigDocAmt); } }
public virtual void CreateWriteOff(ReasonCode reasonCode, string WOSubCD, DateTime?WODate, string WOFinPeriodID, ARRegister ardoc) { Int32?WOAccountID = reasonCode.AccountID; if (WOAccountID == null) { throw new ArgumentNullException("WOAccountID"); } if (WOSubCD == null) { throw new ArgumentNullException("WOSubCD"); } this.Clear(); customer.Current = null; _CustomerID = ardoc.CustomerID; ARInvoice payment = new ARInvoice(); payment.BranchID = ardoc.BranchID; payment = PXCache <ARInvoice> .CreateCopy(this.Document.Insert(payment)); payment.CustomerID = ardoc.CustomerID; payment.CustomerLocationID = ardoc.CustomerLocationID; payment.DocDate = WODate; payment.FinPeriodID = WOFinPeriodID; payment.CuryID = ardoc.CuryID; payment.ARAccountID = WOAccountID; payment.Hold = false; payment.AdjCntr = -1; payment.DocDesc = reasonCode.Descr; payment = this.Document.Update(payment); this.Document.Cache.SetValueExt <ARInvoice.aRSubID>(payment, WOSubCD); ARAddressAttribute.DefaultRecord <ARInvoice.billAddressID>(Document.Cache, payment); ARContactAttribute.DefaultRecord <ARInvoice.billContactID>(Document.Cache, payment); ARAdjust adj = new ARAdjust(); adj.AdjgDocType = ardoc.DocType; adj.AdjgRefNbr = ardoc.RefNbr; adj.AdjNbr = payment.AdjCntr; adj.AdjdCuryInfoID = Document.Current.CuryInfoID; adj.AdjdOrigCuryInfoID = Document.Current.CuryInfoID; adj = this.Adjustments.Insert(adj); Document.Current.CuryDocBal += (decimal)adj.CuryAdjdAmt; Document.Current.DocBal += (decimal)adj.AdjAmt; Document.Current.CuryOrigDocAmt += (decimal)adj.CuryAdjdAmt; Document.Current.OrigDocAmt += (decimal)adj.AdjAmt; ARReleaseProcess.UpdateARBalances(this, Document.Current, adj.AdjAmt); Document.Cache.MarkUpdated(Document.Current); this.Actions.PressSave(); }