protected override decimal?GetCuryTranAmt(PXCache sender, object row, string TaxCalcType = "I") { PMProformaLine line = (PMProformaLine)row; if (IsRetainedTaxes(sender.Graph)) { return(line.CuryRetainage); } return(0m); }
public virtual void InvalidateTax(PMProformaLine row, PMProformaLine oldRow) { if (Base.Document.Current != null && IsExternalTax(Base.Document.Current.TaxZoneID)) { if (row.AccountID != oldRow.AccountID || row.InventoryID != oldRow.InventoryID || row.LineTotal != oldRow.LineTotal || row.TaxCategoryID != oldRow.TaxCategoryID || row.Description != oldRow.Description) { Base.Document.Current.IsTaxValid = false; } } }
public virtual void InvalidateTax(PMProformaLine row, PMProformaLine oldRow) { if (Base.Document.Current != null) { if (row.AccountID != oldRow.AccountID || row.InventoryID != oldRow.InventoryID || row.LineTotal != oldRow.LineTotal || row.TaxCategoryID != oldRow.TaxCategoryID || row.Description != oldRow.Description) { InvalidateExternalTax(Base.Document.Current); } } }
public override void RowUpdated(PXCache sender, PXRowUpdatedEventArgs e) { base.RowUpdated(sender, e); PMProformaLine row = e.Row as PMProformaLine; PMProformaLine oldRow = e.OldRow as PMProformaLine; if (_TaxCalc == TaxCalc.Calc && row != null && oldRow != null) { if (row.TaxCategoryID == oldRow.TaxCategoryID && row.CuryLineTotal == oldRow.CuryLineTotal && row.CuryRetainage != oldRow.CuryRetainage) { CalcTaxes(sender, e.Row, PXTaxCheck.Line); } } }
public virtual void RecalculateDraftInvoicesAmount(PMProject project, ProjectBalance pb) { var selectProforma = new PXSelectJoinGroupBy <PMProformaLine, InnerJoin <Account, On <PMProformaLine.accountID, Equal <Account.accountID> > >, Where <PMProformaLine.projectID, Equal <Required <PMProformaLine.projectID> >, And <PMProformaLine.released, Equal <False> > >, Aggregate <GroupBy <PMProformaLine.projectID, GroupBy <PMProformaLine.taskID, GroupBy <PMProformaLine.accountID, GroupBy <PMProformaLine.inventoryID, GroupBy <PMProformaLine.costCodeID, Sum <PMProformaLine.lineTotal> > > > > > > >(this); var selectInvoice = new PXSelectJoinGroupBy <ARTran, InnerJoin <Account, On <ARTran.accountID, Equal <Account.accountID> > >, Where <ARTran.projectID, Equal <Required <ARTran.projectID> >, And <ARTran.released, Equal <False> > >, Aggregate <GroupBy <ARTran.tranType, GroupBy <ARTran.projectID, GroupBy <ARTran.taskID, GroupBy <ARTran.accountID, GroupBy <ARTran.inventoryID, GroupBy <ARTran.costCodeID, Sum <ARTran.tranAmt> > > > > > > > >(this); var selectRevenueBudget = new PXSelect <PMRevenueBudget, Where <PMRevenueBudget.projectID, Equal <Required <PMRevenueBudget.projectID> >, And <PMRevenueBudget.type, Equal <GL.AccountType.income> > > >(this); var revenueBudget = selectRevenueBudget.Select(project.ContractID); foreach (PXResult <PMProformaLine, Account> res in selectProforma.Select(project.ContractID)) { PMProformaLine line = (PMProformaLine)res; Account account = (Account)res; int?inventoryID = PMInventorySelectorAttribute.EmptyInventoryID; foreach (PMRevenueBudget rev in revenueBudget) { foreach (PMRevenueBudget budget in revenueBudget) { if (budget.TaskID == line.TaskID && line.InventoryID == budget.InventoryID) { inventoryID = line.InventoryID; } } } PMBudgetAccum invoiced = new PMBudgetAccum(); invoiced.Type = GL.AccountType.Income; invoiced.ProjectID = line.ProjectID; invoiced.ProjectTaskID = line.TaskID; invoiced.AccountGroupID = account.AccountGroupID; invoiced.InventoryID = inventoryID; invoiced.CostCodeID = line.CostCodeID.GetValueOrDefault(CostCodeAttribute.GetDefaultCostCode()); invoiced = Budget.Insert(invoiced); invoiced.InvoicedAmount += line.LineTotal.GetValueOrDefault(); if (line.IsPrepayment == true) { invoiced.PrepaymentInvoiced += line.LineTotal.GetValueOrDefault(); } } foreach (PXResult <ARTran, Account> res in selectInvoice.Select(project.ContractID)) { ARTran line = (ARTran)res; Account account = (Account)res; int?inventoryID = PMInventorySelectorAttribute.EmptyInventoryID; foreach (PMRevenueBudget rev in revenueBudget) { foreach (PMRevenueBudget budget in revenueBudget) { if (budget.TaskID == line.TaskID && line.InventoryID == budget.InventoryID) { inventoryID = line.InventoryID; } } } PMBudgetAccum invoiced = new PMBudgetAccum(); invoiced.Type = GL.AccountType.Income; invoiced.ProjectID = line.ProjectID; invoiced.ProjectTaskID = line.TaskID; invoiced.AccountGroupID = account.AccountGroupID; invoiced.InventoryID = inventoryID; invoiced.CostCodeID = line.CostCodeID.GetValueOrDefault(CostCodeAttribute.GetDefaultCostCode()); invoiced = Budget.Insert(invoiced); invoiced.InvoicedAmount += line.TranAmt.GetValueOrDefault() * ARDocType.SignAmount(line.TranType); } }