public override void CacheAttached(PXCache sender) { List <string> values = new List <string>(); List <string> labels = new List <string>(); if (string.IsNullOrWhiteSpace(categoryAttribute)) { INSetup setup = PXSelect <INSetup> .Select(sender.Graph); if (setup != null) { INSetupExt setupExt = sender.Graph.Caches[typeof(INSetup)].GetExtension <INSetupExt>(setup); if (setupExt != null) { categoryAttribute = setupExt.UsrCategoryAttribute; } } } foreach (CSAttributeDetail detail in PXSelect <CSAttributeDetail, Where <CSAttributeDetail.attributeID, Equal <Required <CSAttributeDetail.attributeID> > >, OrderBy <Asc <CSAttributeDetail.sortOrder> > > .Select(sender.Graph, categoryAttribute)) //Replace with Const or Setting field? { values.Add(detail.ValueID); labels.Add(detail.Description); } this._AllowedValues = values.ToArray(); this._AllowedLabels = labels.ToArray(); }
public Closing() { GLSetup setup = GLSetup.Current; APSetup apSetup = APSetup.Select(); ARSetup arSetup = ARSetup.Select(); INSetup inSetup = INSetup.Select(); CASetup caSetup = CASetup.Select(); FASetup faSetup = FASetup.Select(); PRSetup prSetup = PRSetup.Select(); PXCache periodCache = Caches[typeof(FinPeriod)]; PXUIFieldAttribute.SetEnabled <FinPeriod.finPeriodID>(periodCache, null, false); PXUIFieldAttribute.SetEnabled <FinPeriod.descr>(periodCache, null, false); PXUIFieldAttribute.SetVisible <FinPeriod.aPClosed>(periodCache, null, apSetup != null); PXUIFieldAttribute.SetVisible <FinPeriod.aRClosed>(periodCache, null, arSetup != null); PXUIFieldAttribute.SetVisible <FinPeriod.iNClosed>(periodCache, null, inSetup != null); PXUIFieldAttribute.SetVisible <FinPeriod.cAClosed>(periodCache, null, caSetup != null); PXUIFieldAttribute.SetVisible <FinPeriod.fAClosed>(periodCache, null, faSetup != null); PXUIFieldAttribute.SetVisible <FinPeriod.pRClosed>(periodCache, null, prSetup != null); Caches[typeof(FinPeriod)].AllowInsert = false; Caches[typeof(FinPeriod)].AllowDelete = false; if (this.GetType() != typeof(Closing)) { ShowDocuments.SetCaption(PXMessages.LocalizeNoPrefix(GL.Messages.ShowDocumentsNonGL)); } }
protected virtual void ReasonCode_RowDeleting(PXCache sender, PXRowDeletingEventArgs e) { INSetup inSetup = INSetup.Select(); var rc = (ReasonCode)e.Row; if (rc != null && inSetup != null) { if (inSetup.ReceiptReasonCode == rc.ReasonCodeID || inSetup.PIReasonCode == rc.ReasonCodeID || inSetup.IssuesReasonCode == rc.ReasonCodeID || inSetup.AdjustmentReasonCode == rc.ReasonCodeID) { throw new PXException(Messages.ReasonCodeInUse); } } }
public static void Update(PXGraph graph, int?vendorID, int?vendorLocationID, string curyID, int?inventoryID, int?subItemID, string uom, decimal curyCost) { if (curyCost <= 0 || string.IsNullOrEmpty(uom) || vendorID == null || vendorLocationID == null) { return; } PXCache cache = graph.Caches[typeof(POVendorInventoryPriceUpdate)]; foreach (PXResult <InventoryItem, Vendor, Company> r in PXSelectJoin <InventoryItem, LeftJoinSingleTable <Vendor, On <Vendor.bAccountID, Equal <Required <Vendor.bAccountID> > >, CrossJoin <Company> >, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > . Select(graph, vendorID, inventoryID)) { InventoryItem item = r; Vendor vendor = r; Company company = r; if (item.InventoryID == null || vendor.BAccountID == null || (item.StkItem == true && subItemID == null)) { continue; } INSetup setup = PXSetupOptional <INSetup> .Select(graph); int?savedSubItemID = item.StkItem == true ? subItemID : null; POVendorInventoryPriceUpdate vendorPrice = (POVendorInventoryPriceUpdate)cache.CreateInstance(); vendorPrice.InventoryID = inventoryID; vendorPrice.SubItemID = savedSubItemID; vendorPrice.VendorID = vendorID; vendorPrice.VendorLocationID = vendorLocationID; vendorPrice.PurchaseUnit = uom; vendorPrice = (POVendorInventoryPriceUpdate)cache.Insert(vendorPrice); if (item.StkItem != true) { vendorPrice.SubItemID = savedSubItemID; } vendorPrice.CuryID = curyID; cache.Normalize(); vendorPrice.Active = true; vendorPrice.LastPrice = curyCost; } }
protected ContractProcessing(int?contractID) { if (contractID > 0) { this.graph = PXGraph.CreateInstance <ARInvoiceEntry>(); graph.FieldVerifying.AddHandler <ARInvoice.projectID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; }); this.contract = PXSelect <Contract, Where <Contract.contractID, Equal <Required <Contract.contractID> > > > .Select(graph, contractID); this.insetup = PXSelect <INSetup> .Select(graph); this.template = PXSelect <Contract, Where <Contract.contractID, Equal <Required <Contract.contractID> > > > .Select(graph, contract.TemplateID); this.schedule = PXSelect <ContractBillingSchedule> .Search <ContractBillingSchedule.contractID>(graph, contract.ContractID); if (contract.CustomerID != null) { if (schedule != null && schedule.AccountID != null) { customer = PXSelect <Customer, Where <Customer.bAccountID, Equal <Required <ContractBillingSchedule.accountID> > > > .Select(graph, schedule.AccountID); if (schedule.LocationID != null) { location = PXSelect <Location, Where <Location.bAccountID, Equal <Required <ContractBillingSchedule.accountID> >, And <Location.locationID, Equal <Required <ContractBillingSchedule.locationID> > > > > .Select(graph, customer.BAccountID, schedule.LocationID); } else { location = PXSelect <Location, Where <Location.locationID, Equal <Required <Customer.defLocationID> > > > .Select(graph, customer.DefLocationID); } } else { customer = PXSelect <Customer, Where <Customer.bAccountID, Equal <Required <Customer.bAccountID> > > > .Select(graph, contract.CustomerID); if (contract.LocationID != null) { location = PXSelect <Location, Where <Location.bAccountID, Equal <Required <ContractBillingSchedule.accountID> >, And <Location.locationID, Equal <Required <ContractBillingSchedule.locationID> > > > > .Select(graph, customer.BAccountID, contract.LocationID); } else { location = PXSelect <Location, Where <Location.locationID, Equal <Required <Customer.defLocationID> > > > .Select(graph, customer.DefLocationID); } } } SetupGraph(); } }
public Closing() { GLSetup setup = GLSetup.Current; APSetup apSetup = APSetup.Select(); ARSetup arSetup = ARSetup.Select(); INSetup inSetup = INSetup.Select(); CASetup caSetup = CASetup.Select(); FASetup faSetup = FASetup.Select(); PXCache periodCache = Caches[typeof(FinPeriod)]; PXUIFieldAttribute.SetEnabled <FinPeriod.finPeriodID>(periodCache, null, false); PXUIFieldAttribute.SetEnabled <FinPeriod.descr>(periodCache, null, false); PXUIFieldAttribute.SetVisible <FinPeriod.aPClosed>(periodCache, null, apSetup != null); PXUIFieldAttribute.SetVisible <FinPeriod.aRClosed>(periodCache, null, arSetup != null); PXUIFieldAttribute.SetVisible <FinPeriod.iNClosed>(periodCache, null, inSetup != null); PXUIFieldAttribute.SetVisible <FinPeriod.cAClosed>(periodCache, null, caSetup != null); PXUIFieldAttribute.SetVisible <FinPeriod.fAClosed>(periodCache, null, faSetup != null); Caches[typeof(FinPeriod)].AllowInsert = false; Caches[typeof(FinPeriod)].AllowDelete = false; }
public virtual IEnumerable close(PXAdapter adapter) { APSetup apSetup = APSetup.Select(); ARSetup arSetup = ARSetup.Select(); INSetup inSetup = INSetup.Select(); CASetup caSetup = CASetup.Select(); FASetup faSetup = FASetup.Select(); List <FinPeriod> list = new List <FinPeriod>(); bool YearClosed = true; foreach (FinPeriod period in adapter.Get()) { if (period.Selected == true) { if (period.Active != true) { throw new FiscalPeriodInactiveException(period.FinPeriodID); } if (Accessinfo.ScreenID == "GL.50.30.00") { if (apSetup != null && period.APClosed != true) { throw new PXException(Messages.PeriodOpenInAPModule); } if (arSetup != null && period.ARClosed != true) { throw new PXException(Messages.PeriodOpenInARModule); } if (caSetup != null && period.CAClosed != true) { throw new PXException(Messages.PeriodOpenInCAModule); } if (inSetup != null && PXAccess.FeatureInstalled <CS.FeaturesSet.distributionModule>() && period.INClosed != true) { throw new PXException(Messages.PeriodOpenInINModule); } if (faSetup != null && PXAccess.FeatureInstalled <CS.FeaturesSet.fixedAsset>() && period.FAClosed != true) { throw new PXException(Messages.PeriodOpenInFAModule); } } list.Add(period); } else { YearClosed = false; } } if (YearClosed) { if ((FinPeriod)NextFiscalYear.Select(list[list.Count - 1].FinYear) == null) { throw new PXException(Messages.NoPeriodsForNextYear); } } if (list.Count > 0) { StartClosePeriod(list); } return(adapter.Get()); }
public CSBoxMaint() { INSetup record = Setup.Current; }
protected virtual INTran[] CreateTransactions(POLandedCostDoc doc, POLandedCostDetail landedCostDetail, IEnumerable <LandedCostAllocationService.POLandedCostReceiptLineAdjustment> pOLinesToProcess) { var result = new List <INTran>(); var landedCostCode = GetLandedCostCode(landedCostDetail.LandedCostCodeID); var reasonCode = landedCostCode.ReasonCode; foreach (LandedCostAllocationService.POLandedCostReceiptLineAdjustment poreceiptline in pOLinesToProcess) { INTran intran = new INTran(); INTran origtran = LandedCostAllocationService.Instance.GetOriginalInTran(_pxGraph, poreceiptline.ReceiptLine.ReceiptNbr, poreceiptline.ReceiptLine.LineNbr); bool isDropShip = (poreceiptline.ReceiptLine.LineType == POLineType.GoodsForDropShip || poreceiptline.ReceiptLine.LineType == POLineType.NonStockForDropShip); // There is no INTran for non-stock if 'Update GL' setting is off. if (poreceiptline.ReceiptLine.IsNonStockItem() && origtran == null) { INSetup inSetup = PXSelectReadonly <INSetup> .Select(_pxGraph); if (inSetup.UpdateGL.Value == false) { continue; } } if (!isDropShip && origtran == null) { throw new PXException(AP.Messages.CannotFindINReceipt, poreceiptline.ReceiptLine.ReceiptNbr); } //Drop-Ships are considered non-stocks if (poreceiptline.ReceiptLine.IsStockItem()) { intran.TranType = INTranType.ReceiptCostAdjustment; } else { //Landed cost and PPV for non-stock items are handled in special way in the inventory. //They should create a GL Batch, but for convinience and unforminty this functionality is placed into IN module //Review this part when the functionality is implemented in IN module intran.IsCostUnmanaged = true; intran.TranType = INTranType.Adjustment; intran.InvtMult = 0; } intran.InventoryID = poreceiptline.ReceiptLine.InventoryID; intran.SubItemID = poreceiptline.ReceiptLine.SubItemID; intran.SiteID = poreceiptline.ReceiptLine.SiteID; intran.BAccountID = doc.VendorID; intran.BranchID = landedCostDetail.BranchID; if (isDropShip && intran.SiteID != null) { INSite invSite = INSite.PK.Find(_pxGraph, intran.SiteID); if (invSite.DropShipLocationID == null) { throw new PXException(SO.Messages.NoDropShipLocation, invSite.SiteCD); } intran.LocationID = invSite.DropShipLocationID; } else { intran.LocationID = poreceiptline.ReceiptLine.LocationID ?? origtran.LocationID; } intran.LotSerialNbr = poreceiptline.ReceiptLine.LotSerialNbr; intran.POReceiptType = poreceiptline.ReceiptLine.ReceiptType; intran.POReceiptNbr = poreceiptline.ReceiptLine.ReceiptNbr; intran.POReceiptLineNbr = poreceiptline.ReceiptLine.LineNbr; //tran.Qty = poreceiptline.ReceiptQty; intran.TranDesc = landedCostDetail.Descr; //tran.UnitCost = PXDBPriceCostAttribute.Round(inGraph.transactions.Cache, (decimal)(poreceiptline.ExtCost / poreceiptline.ReceiptQty)); intran.TranCost = poreceiptline.AllocatedAmt; intran.ReasonCode = reasonCode; if (origtran != null && origtran.DocType == INDocType.Issue) { intran.ARDocType = origtran.ARDocType; intran.ARRefNbr = origtran.ARRefNbr; intran.ARLineNbr = origtran.ARLineNbr; } if (!isDropShip) { intran.OrigDocType = origtran.DocType; intran.OrigTranType = origtran.TranType; intran.OrigRefNbr = origtran.RefNbr; } int?acctID = null; int?subID = null; intran.AcctID = landedCostDetail.LCAccrualAcct; intran.SubID = landedCostDetail.LCAccrualSub; GetLCVarianceAccountSub(ref acctID, ref subID, poreceiptline.ReceiptLine); intran.COGSAcctID = acctID; intran.COGSSubID = subID; result.Add(intran); } return(result.ToArray()); }