protected virtual void Location_IsAPAccountSameAsMain_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { CR.Location record = (CR.Location)e.Row; if (record.IsAPAccountSameAsMain == false) { LocationAPAccountSub mainloc = APAccountSubLocation.Select(); record.VAPAccountID = mainloc.VAPAccountID; record.VAPSubID = mainloc.VAPSubID; record.VAPAccountLocationID = record.LocationID; LocationAPAccountSub copyloc = new LocationAPAccountSub(); copyloc.BAccountID = record.BAccountID; copyloc.LocationID = record.LocationID; copyloc.VAPAccountID = record.VAPAccountID; copyloc.VAPSubID = record.VAPSubID; BusinessAccount.Cache.Current = (BAccount)PXParentAttribute.SelectParent(sender, e.Row, typeof(BAccount)); APAccountSubLocation.Insert(copyloc); } if (record.IsAPAccountSameAsMain == true) { record.VAPAccountID = null; record.VAPSubID = null; BAccount baccount = (BAccount)PXParentAttribute.SelectParent(sender, e.Row, typeof(BAccount)); if (baccount != null) { record.VAPAccountLocationID = baccount.DefLocationID; } } }
public virtual void APSalesPriceFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { APSalesPriceFilter row = (APSalesPriceFilter)e.Row; Records.Cache.AllowInsert = row.VendorID != null && row.CuryID != null; Records.Cache.AllowUpdate = Records.Cache.AllowDelete = row.VendorID != null; Vendor vend = (Vendor)PXParentAttribute.SelectParent(sender, e.Row, typeof(Vendor)); if (vend != null) { PXUIFieldAttribute.SetEnabled <APSalesPriceFilter.curyID>(sender, e.Row, vend.CuryID == null || vend.AllowOverrideCury == true); } PXUIFieldAttribute.SetVisible <APSalesPrice.pendingBreakQty>(Records.Cache, null, row.PromotionalPrice == false); PXUIFieldAttribute.SetVisible <APSalesPrice.pendingPrice>(Records.Cache, null, row.PromotionalPrice == false); PXUIFieldAttribute.SetVisible <APSalesPrice.effectiveDate>(Records.Cache, null, row.PromotionalPrice == false); PXUIFieldAttribute.SetVisible <APSalesPrice.lastPrice>(Records.Cache, null, row.PromotionalPrice == false); PXUIFieldAttribute.SetVisible <APSalesPrice.lastBreakQty>(Records.Cache, null, row.PromotionalPrice == false); PXUIFieldAttribute.SetVisible <APSalesPrice.expirationDate>(Records.Cache, null, row.PromotionalPrice == true); PXUIFieldAttribute.SetEnabled <APSalesPrice.salesPrice>(Records.Cache, null, row.PromotionalPrice == true); PXUIFieldAttribute.SetEnabled <APSalesPrice.breakQty>(Records.Cache, null, row.PromotionalPrice == true); PXUIFieldAttribute.SetEnabled <APSalesPrice.lastDate>(Records.Cache, null, row.PromotionalPrice == true); PXUIFieldAttribute.SetEnabled(sender, e.Row, typeof(TM.OwnedFilter.ownerID).Name, e.Row == null || (bool?)sender.GetValue(e.Row, typeof(TM.OwnedFilter.myOwner).Name) == false); PXUIFieldAttribute.SetEnabled(sender, e.Row, typeof(TM.OwnedFilter.workGroupID).Name, e.Row == null || (bool?)sender.GetValue(e.Row, typeof(TM.OwnedFilter.myWorkGroup).Name) == false); update.SetEnabled(row.PromotionalPrice != true); }
protected virtual void RemoveChildReferences(ARDiscount discount) { void clearChildCaches() { foreach (var type in DiscountChildTypes()) { Caches[type].Clear(); } }; clearChildCaches(); try { PXParentAttribute.SetLeaveChildren <DiscountSequence.discountID>(this.Caches <DiscountSequence>(), null, false); Document.Cache.RaiseRowDeleted(discount); foreach (var type in DiscountChildTypes()) { Persist(type, PXDBOperation.Delete); } clearChildCaches(); } finally { PXParentAttribute.SetLeaveChildren <DiscountSequence.discountID>(this.Caches <DiscountSequence>(), null, true); } }
protected virtual void INTran_RowInserted(PXCache sender, PXRowInsertedEventArgs e) { INTran row = e.Row as INTran; if (row != null && (row.OrigModule == BatchModule.SO || row.OrigModule == BatchModule.PO)) { INRegister doc = (INRegister)PXParentAttribute.SelectParent(sender, e.Row, typeof(INRegister)); if (doc != null) { PXCache cache = issue.Cache; object copy = cache.CreateCopy(doc); doc.SOShipmentType = row.SOShipmentType; doc.SOShipmentNbr = row.SOShipmentNbr; doc.SOOrderType = row.SOOrderType; doc.SOOrderNbr = row.SOOrderNbr; doc.POReceiptType = row.POReceiptType; doc.POReceiptNbr = row.POReceiptNbr; if (!object.Equals(doc, cache.Current)) { cache.Update(doc); } else { if (cache.GetStatus(doc) == PXEntryStatus.Notchanged || cache.GetStatus(doc) == PXEntryStatus.Held) { cache.SetStatus(doc, PXEntryStatus.Updated); } cache.RaiseRowUpdated(doc, copy); } } } }
protected override IEnumerable SelectDelegate() { if (_Graph.Caches[typeof(TParentEntity)].Current != null) { if (!String.IsNullOrEmpty(Convert.ToString(_Graph.Caches[typeof(TParentEntity)].GetValue(_Graph.Caches[typeof(TParentEntity)].Current, typeof(TParentField).Name)))) { _Graph.Caches[typeof(TEntity)].Current = _Graph.Views["InventoryLotSerialContainer"].SelectSingle(); if (_Graph.Caches[typeof(TEntity)].Current != null) { PXParentAttribute.SetParent(_Graph.Caches[typeof(TEntity)], _Graph.Caches[typeof(TEntity)].Current, typeof(TParentEntity), _Graph.Caches[typeof(TParentEntity)].Current); } } else { _Graph.Caches[typeof(TEntity)].Current = null; } } else { _Graph.Caches[typeof(TEntity)].Current = null; } return(base.SelectDelegate()); }
protected override PMCommitment FromRecord(PXCache sender, object row) { SOMiscLine2 line = (SOMiscLine2)row; SOOrder order = (SOOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(SOOrder)); int sign = line.Operation == SOOperation.Issue ? 1 : -1; PMCommitment commitment = new PMCommitment(); commitment.Type = PMCommitmentType.Internal; commitment.CommitmentID = line.CommitmentID ?? Guid.NewGuid(); commitment.AccountGroupID = GetAccountGroup(sender, row); commitment.ProjectID = line.ProjectID; commitment.ProjectTaskID = line.TaskID; commitment.UOM = line.UOM; commitment.Qty = sign * line.OrderQty; commitment.Amount = sign * line.LineAmt; commitment.OpenQty = sign * line.UnbilledQty; commitment.OpenAmount = sign * line.UnbilledAmt; commitment.ReceivedQty = 0; commitment.InvoicedQty = 0; commitment.InvoicedAmount = 0; commitment.InvoicedIsReadonly = true; commitment.RefNoteID = order.NoteID; commitment.InventoryID = line.InventoryID ?? PMInventorySelectorAttribute.EmptyInventoryID; commitment.CostCodeID = line.CostCodeID ?? CostCodeAttribute.GetDefaultCostCode(); return(commitment); }
protected override decimal CalcLineTotal(PXCache sender, object row) { decimal CuryLineTotal = 0m; object document = PXParentAttribute.SelectParent(sender, row, _ParentType); object[] progressiveDetails = PXParentAttribute.SelectChildren(sender.Graph.Caches[typeof(PMProformaProgressLine)], document, _ParentType); object[] transactionDetails = PXParentAttribute.SelectChildren(sender.Graph.Caches[typeof(PMProformaTransactLine)], document, _ParentType); if (progressiveDetails != null) { foreach (object detrow in progressiveDetails) { CuryLineTotal += GetCuryTranAmt(sender.Graph.Caches[typeof(PMProformaProgressLine)], sender.Graph.Caches[typeof(PMProformaProgressLine)].ObjectsEqual(detrow, row) ? row : detrow) ?? 0m; } } if (transactionDetails != null) { foreach (object detrow in transactionDetails) { CuryLineTotal += GetCuryTranAmt(sender.Graph.Caches[typeof(PMProformaTransactLine)], sender.Graph.Caches[typeof(PMProformaTransactLine)].ObjectsEqual(detrow, row) ? row : detrow) ?? 0m; } } return(CuryLineTotal); }
protected override PMCommitment FromRecord(PXCache sender, object row) { POLineUOpen poline = (POLineUOpen)row; POOrder order = (POOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(POOrder)); PMCommitment commitment = new PMCommitment(); commitment.Type = PMCommitmentType.Internal; commitment.CommitmentID = poline.CommitmentID ?? Guid.NewGuid(); commitment.AccountGroupID = GetAccountGroup(sender, row); commitment.ProjectID = poline.ProjectID; commitment.ProjectTaskID = poline.TaskID; commitment.UOM = poline.UOM; commitment.Qty = poline.OrderQty; commitment.Amount = poline.ExtCost; commitment.OpenQty = poline.OpenQty; commitment.OpenAmount = poline.OpenAmt; commitment.ReceivedQty = poline.ReceivedQty; commitment.InvoicedQty = 0; commitment.InvoicedAmount = 0; commitment.InvoicedIsReadonly = true; commitment.RefNoteID = order.NoteID; commitment.InventoryID = poline.InventoryID ?? PMInventorySelectorAttribute.EmptyInventoryID; commitment.CostCodeID = poline.CostCodeID ?? CostCodeAttribute.GetDefaultCostCode(); return(commitment); }
protected override void Location_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { BAccount baccount = (BAccount)PXParentAttribute.SelectParent(sender, e.Row, typeof(BAccount)); PXUIFieldAttribute.SetEnabled <CR.Location.isAPAccountSameAsMain>(sender, e.Row, baccount != null && !object.Equals(baccount.DefLocationID, ((Location)e.Row).LocationID)); PXUIFieldAttribute.SetEnabled <CR.Location.isAPPaymentInfoSameAsMain>(sender, e.Row, baccount != null && !object.Equals(baccount.DefLocationID, ((Location)e.Row).LocationID)); base.Location_RowSelected(sender, e); }
public EPExpenseClaim GetParentClaim(string claimRefNbr) { EPExpenseClaimDetails receiptStub = new EPExpenseClaimDetails() { RefNbr = claimRefNbr }; return(PXParentAttribute.SelectParent <EPExpenseClaim>(Receipts.Cache, receiptStub)); }
private void SetParentChanged(PXCache sender, object Row) { object parent = PXParentAttribute.SelectParent(sender, Row); if (parent != null && lotserclass.Cache.GetStatus(parent) == PXEntryStatus.Notchanged) { lotserclass.Cache.SetStatus(parent, PXEntryStatus.Updated); } }
public virtual string GetHeaderMasterFinPeriodID(PXCache cache, object row) { if (HeaderFindingMode == HeaderFindingModes.Parent) { object parentRow = PXParentAttribute.SelectParent(cache, row, BqlCommand.GetItemType(HeaderMasterFinPeriodIDType)); return((string)BqlHelper.GetOperandValue(cache.Graph, parentRow, HeaderMasterFinPeriodIDType)); } return((string)BqlHelper.GetCurrentValue(cache.Graph, HeaderMasterFinPeriodIDType)); }
public ARDiscountMaint() { PXCache cache; foreach (var type in DiscountChildTypes()) { cache = Caches[type]; } PXParentAttribute.SetLeaveChildren <DiscountSequenceDetail.discountSequenceID>(this.Caches <DiscountSequenceDetail>(), null, false); PXParentAttribute.SetLeaveChildren <DiscountSequence.discountID>(this.Caches <DiscountSequence>(), null, true); }
public APDiscountMaint() { this.Filter.Cache.AllowInsert = false; this.Filter.Cache.AllowDelete = false; foreach (var childType in DiscountChildTypes()) { Views.Caches.Add(childType); } PXParentAttribute.SetLeaveChildren <DiscountSequenceDetail.discountSequenceID>(this.Caches <DiscountSequenceDetail>(), null, false); }
public static bool TryAggregateToFirstSuitableTran(PXCache sender, GLTran tran, IEnumerable <GLTran> summaryTrans) { foreach (GLTran summ_tran in summaryTrans) { PXParentAttribute.SetParent(sender, summ_tran, typeof(Batch), sender.Graph.Caches[typeof(Batch)].Current); GLTran copy_tran = PXCache <GLTran> .CreateCopy(summ_tran); copy_tran.CuryCreditAmt += tran.CuryCreditAmt; copy_tran.CreditAmt += tran.CreditAmt; copy_tran.CuryDebitAmt += tran.CuryDebitAmt; copy_tran.DebitAmt += tran.DebitAmt; if (tran.ZeroPost == false) { copy_tran.ZeroPost = false; } if ((copy_tran.CuryDebitAmt - copy_tran.CuryCreditAmt) > 0m && (copy_tran.DebitAmt - copy_tran.CreditAmt) < 0m || (copy_tran.CuryDebitAmt - copy_tran.CuryCreditAmt) < 0m && (copy_tran.DebitAmt - copy_tran.CreditAmt) > 0m) { continue; } PostGraph.NormalizeAmounts(copy_tran); if (copy_tran.CuryDebitAmt == 0m && copy_tran.CuryCreditAmt == 0m && copy_tran.DebitAmt == 0m && copy_tran.CreditAmt == 0m && copy_tran.ZeroPost != true) { sender.Delete(copy_tran); } else { if (!object.Equals(copy_tran.TranDesc, tran.TranDesc)) { copy_tran.TranDesc = Messages.SummaryTranDesc; } copy_tran.Qty = 0m; copy_tran.UOM = null; copy_tran.InventoryID = null; copy_tran.TranLineNbr = null; sender.Update(copy_tran); } return(true); } return(false); }
public virtual void APSalesPriceFilter_VendorID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { APSalesPriceFilter row = e.Row as APSalesPriceFilter; if (row != null) { Vendor vend = (Vendor)PXParentAttribute.SelectParent(sender, e.Row, typeof(Vendor)); if (vend != null) { row.CuryID = vend.CuryID; } } }
protected virtual void INTran_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Insert || (e.Operation & PXDBOperation.Command) == PXDBOperation.Update) { INRegister parent = (INRegister)PXParentAttribute.SelectParent(sender, e.Row); if (parent != null) { PXDefaultAttribute.SetPersistingCheck <INTran.toLocationID>(sender, e.Row, parent.TransferType == INTransferType.OneStep ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing); ((INTran)e.Row).ToSiteID = parent.ToSiteID; } } }
protected override bool EraseCommitment(PXCache sender, object row) { SOOrder order = (SOOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(SOOrder)); SOOrderType orderType = (SOOrderType)PXSelectorAttribute.Select <SOOrder.orderType>(sender.Graph.Caches[typeof(SOOrder)], order); if (order.Hold == true || order.Cancelled == true || orderType.CommitmentTracking != true || sender.GetValue(row, "TaskID") == null) { return(true); } else { return(GetAccountGroup(sender, row) == null); } }
protected virtual void _(Events.RowDeleted <APTran> e) { if (e.Row.TranType != APDocType.Prepayment || string.IsNullOrEmpty(e.Row.POOrderType) || string.IsNullOrEmpty(e.Row.PONbr)) { return; } var prepaidOrder = PXParentAttribute.SelectParent <POOrderPrepayment>(Base.Transactions.Cache, e.Row); if (prepaidOrder != null && !PXParentAttribute.SelectChildren(Base.Transactions.Cache, prepaidOrder, typeof(POOrderPrepayment)).Any()) { PrepaidOrders.Delete(prepaidOrder); } }
protected override bool EraseCommitment(PXCache sender, object row) { POLineUOpen poline = (POLineUOpen)row; POOrder order = (POOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(POOrder)); if (order.OrderType == POOrderType.Blanket || order.OrderType == POOrderType.StandardBlanket || order.Hold == true || order.Approved != true || order.Cancelled == true || poline.Cancelled == true || poline.TaskID == null) { return(true); } else { return(GetAccountGroup(sender, row) == null); } }
private void findParentAttribute(PXCache sender, object row) { if (_parentAttribute != null) { return; } foreach (PXEventSubscriberAttribute attr in sender.GetAttributesReadonly(row, _key.Name)) { if (attr is PXParentAttribute) { _parentAttribute = (PXParentAttribute)attr; break; } } }
protected virtual void FARegister_DocDate_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { FARegister reg = e.Row as FARegister; if (reg == null || reg.Origin != FARegister.origin.Adjustment) { return; } PXCache cache = sender.Graph.Caches <FATran>(); foreach (FATran tran in PXParentAttribute.SelectSiblings(cache, null, typeof(FARegister)).OfType <FATran>().Select(PXCache <FATran> .CreateCopy)) { tran.TranDate = reg.DocDate; cache.Update(tran); } }
public override INItemPlan DefaultValues(PXCache sender, INItemPlan plan_Row, object orig_Row) { string orderType = (string)sender.GetValue <POLine.orderType>(orig_Row); string orderNbr = (string)sender.GetValue <POLine.orderNbr>(orig_Row); int? inventoryID = (int?)sender.GetValue <POLine.inventoryID>(orig_Row); int? siteID = (int?)sender.GetValue <POLine.siteID>(orig_Row); bool? cancelled = (bool?)sender.GetValue <POLine.cancelled>(orig_Row); bool? completed = (bool?)sender.GetValue <POLine.completed>(orig_Row); if (orderType.IsNotIn(POOrderType.RegularOrder, POOrderType.DropShip, POOrderType.Blanket) || inventoryID == null || siteID == null || cancelled == true || completed == true) { return(null); } PXCache parentCache = sender.Graph.Caches[BqlCommand.GetItemType(_ParentNoteID)]; POOrder currentOrder = (POOrder)parentCache.Current; POOrder order = currentOrder?.OrderType == orderType && currentOrder.OrderNbr == orderNbr ? currentOrder : (POOrder)PXParentAttribute.SelectParent(sender, orig_Row, typeof(POOrder));; bool IsOnHold = IsOrderOnHold(order); string newPlanType; if (!TryCalcPlanType(sender, orig_Row, IsOnHold, out newPlanType)) { return(null); } plan_Row.PlanType = newPlanType; plan_Row.BAccountID = (int?)sender.GetValue <POLine.vendorID>(orig_Row); plan_Row.InventoryID = inventoryID; plan_Row.SubItemID = (int?)sender.GetValue <POLine.subItemID>(orig_Row); plan_Row.SiteID = siteID; plan_Row.PlanDate = (DateTime?)sender.GetValue <POLine.promisedDate>(orig_Row); plan_Row.PlanQty = (decimal?)sender.GetValue <POLine.baseOpenQty>(orig_Row); plan_Row.RefNoteID = (Guid?)parentCache.GetValue(order, _ParentNoteID.Name); plan_Row.Hold = IsOnHold; if (string.IsNullOrEmpty(plan_Row.PlanType)) { return(null); } return(plan_Row); }
private void updateOtherSiblings(PXCache sender, object row) { bool needRefresh = false; if (_parentAttribute == null) { return; } PXFieldState state = (PXFieldState)sender.GetStateExt(row, _FieldName); if (state.DataType != typeof(bool)) { return; } if ((bool?)sender.GetValue(row, _FieldName) == false) { return; } foreach (object sibling in PXParentAttribute.SelectSiblings(sender, row, _parentAttribute.ParentType)) { if (!sender.ObjectsEqual(sibling, row)) { if ((bool?)sender.GetValue(sibling, _FieldName) == true) { sender.SetValue(sibling, _FieldName, false); sender.Update(sibling); needRefresh = true; } } } if (needRefresh) { foreach (var kvp in sender.Graph.Views) { PXView view = kvp.Value; if (_BqlTable.IsAssignableFrom(view.GetItemType())) { view.RequestRefresh(); } } } }
protected override PMCommitment FromRecord(PXCache sender, object row) { SOLine4 line = (SOLine4)row; SOOrder order = (SOOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(SOOrder)); int sign = line.Operation == SOOperation.Issue ? 1 : -1; PMCommitment commitment = new PMCommitment(); commitment.Type = PMCommitmentType.Internal; commitment.CommitmentID = (Guid?)sender.GetValue(row, "CommitmentID") ?? Guid.NewGuid(); commitment.AccountGroupID = GetAccountGroup(sender, row); commitment.ProjectID = (int?)sender.GetValue(row, "ProjectID"); commitment.ProjectTaskID = (int?)sender.GetValue(row, "TaskID"); commitment.UOM = line.UOM; commitment.OrigQty = sign * line.OrderQty; commitment.OrigAmount = sign * (decimal?)sender.GetValue(row, "LineAmt"); commitment.Qty = sign * line.OrderQty; commitment.Amount = sign * (decimal?)sender.GetValue(row, "LineAmt"); if (order.Hold == true || order.Cancelled == true) { //Back Order put on Hold. commitment.OpenQty = 0; commitment.OpenAmount = 0; } else { commitment.OpenQty = sign * line.OpenQty; commitment.OpenAmount = sign * line.OpenAmt; } commitment.ReceivedQty = sign * line.ShippedQty; commitment.InvoicedQty = 0; commitment.InvoicedAmount = 0; commitment.InvoicedIsReadonly = true; commitment.RefNoteID = order.NoteID; commitment.InventoryID = line.InventoryID ?? PMInventorySelectorAttribute.EmptyInventoryID; return(commitment); }
protected override PMCommitment FromRecord(PXCache sender, object row) { POLine poline = (POLine)row; POOrder order = (POOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(POOrder)); PMCommitment commitment = new PMCommitment(); commitment.Type = PMCommitmentType.Internal; commitment.CommitmentID = poline.CommitmentID ?? Guid.NewGuid(); commitment.AccountGroupID = GetAccountGroup(sender, row); commitment.ProjectID = poline.ProjectID; commitment.ProjectTaskID = poline.TaskID; commitment.UOM = poline.UOM; if (poline.OrigExtCost == null) { commitment.OrigQty = poline.OrderQty; commitment.OrigAmount = poline.ExtCost + poline.RetainageAmt.GetValueOrDefault(); } else { commitment.OrigQty = poline.OrigOrderQty; commitment.OrigAmount = poline.OrigExtCost; } commitment.Qty = poline.OrderQty; commitment.Amount = poline.ExtCost + poline.RetainageAmt.GetValueOrDefault(); commitment.OpenQty = CalculateOpenQty(poline.OpenQty, poline.UnbilledQty); commitment.OpenAmount = CalculateOpenAmount(commitment.OpenQty, poline.OrderQty, poline.ExtCost, poline.UnbilledAmt); commitment.ReceivedQty = CalculateReceivedQty(poline.CompletedQty, poline.BilledQty); commitment.InvoicedQty = 0; commitment.InvoicedAmount = 0; commitment.InvoicedIsReadonly = true; commitment.RefNoteID = order.NoteID; commitment.InventoryID = poline.InventoryID ?? PMInventorySelectorAttribute.EmptyInventoryID; commitment.CostCodeID = poline.CostCodeID ?? CostCodeAttribute.GetDefaultCostCode(); return(commitment); }
public virtual void _(Events.FieldDefaulting <EPExpenseClaimDetails.corpCardID> e) { if (e.Row is EPExpenseClaimDetails row) { if (row.EmployeeID != null) { if (row.PaidWith != EPExpenseClaimDetails.paidWith.PersonalAccount) { var firstCreditCard = GetFirstCreditCardForEmployeeAlphabeticallySorted(row.EmployeeID.Value); var thereIsCreditCardForEmployee = firstCreditCard != null; if (thereIsCreditCardForEmployee) { var lastUsedCreditCard = GetLastUsedCreditCardForEmployee(row.EmployeeID.Value); var corpCardId = lastUsedCreditCard != null ? lastUsedCreditCard.CorpCardID : firstCreditCard.CorpCardID; if (row.RefNbr != null) { EPExpenseClaim claim = PXParentAttribute.SelectParent <EPExpenseClaim>(e.Cache, row); CashAccount cashAccount = CACorpCardsMaint.GetCardCashAccount(Base, corpCardId); if (cashAccount.CuryID != claim.CuryID) { corpCardId = null; } } e.Cache.SetValueExt <EPExpenseClaimDetails.corpCardID>(row, corpCardId); } } } } }
public virtual void ProcessPOCommitments(PMProject project) { foreach (PXResult <POLine, POOrder> res in polines.Select(project.ContractID)) { POLine poline = (POLine)res; POOrder order = (POOrder)res; PXParentAttribute.SetParent(polines.Cache, poline, typeof(POOrder), order); PMCommitmentAttribute.Sync(polines.Cache, poline); } foreach (APTran tran in aptran.Select(project.ContractID)) { POLine poline = new POLine(); poline.OrderType = tran.POOrderType; poline.OrderNbr = tran.PONbr; poline.LineNbr = tran.POLineNbr; poline = polines.Locate(poline); if (poline != null && poline.CommitmentID != null) { decimal sign = (tran.DrCr == DrCr.Debit) ? Decimal.One : Decimal.MinusOne; PMCommitment container = new PMCommitment(); container.CommitmentID = poline.CommitmentID; container.UOM = tran.UOM; container.InventoryID = tran.InventoryID; container.CostCodeID = tran.CostCodeID.GetValueOrDefault(CostCodeAttribute.GetDefaultCostCode()); container.InvoicedAmount = sign * tran.LineAmt.GetValueOrDefault(); container.InvoicedQty = sign * tran.Qty.GetValueOrDefault(); PMCommitmentAttribute.AddToInvoiced(polines.Cache, container); } } }
public virtual void ProcessSOCommitments(PMProject project) { foreach (PXResult <SOLine, SOOrder> res in solines.Select(project.ContractID)) { SOLine soline = (SOLine)res; SOOrder order = (SOOrder)res; PXParentAttribute.SetParent(solines.Cache, soline, typeof(SOOrder), order); PMCommitmentAttribute.Sync(solines.Cache, soline); } foreach (ARTran tran in artran.Select(project.ContractID)) { SOLine soline = new SOLine(); soline.OrderType = tran.SOOrderType; soline.OrderNbr = tran.SOOrderNbr; soline.LineNbr = tran.SOOrderLineNbr; soline = solines.Locate(soline); if (soline != null && soline.CommitmentID != null) { decimal sign = (tran.DrCr == DrCr.Credit) ? Decimal.One : Decimal.MinusOne; PMCommitment container = new PMCommitment(); container.CommitmentID = soline.CommitmentID; container.UOM = tran.UOM; container.InventoryID = tran.InventoryID; container.CostCodeID = tran.CostCodeID.GetValueOrDefault(CostCodeAttribute.GetDefaultCostCode()); container.InvoicedAmount = sign * tran.TranAmt.GetValueOrDefault(); container.InvoicedQty = sign * tran.Qty.GetValueOrDefault(); PMCommitmentAttribute.AddToInvoiced(solines.Cache, container); } } }
public POReceipt GetPOReceipt(PXCache cache) => PXParentAttribute.SelectParent <POReceipt>(cache, this);