protected virtual IEnumerable Inquiry(PXAdapter adapter,
                                              [PXInt]
                                              [PXIntList(new int[] { 1, 2 }, new string[]
        {
            "Sales Prices",
            "Vendor Prices"
        })]
                                              int?inquiryID
                                              )
        {
            switch (inquiryID)
            {
            case 1:
                if (Item.Current != null)
                {
                    ARSalesPriceMaint graph = PXGraph.CreateInstance <ARSalesPriceMaint>();
                    graph.Filter.Current.InventoryID = Item.Current.InventoryID;
                    throw new PXRedirectRequiredException(graph, "Sales Prices");
                }
                break;

            case 2:
                if (Item.Current != null)
                {
                    APVendorPriceMaint graph = PXGraph.CreateInstance <APVendorPriceMaint>();
                    graph.Filter.Current.InventoryID = Item.Current.InventoryID;
                    throw new PXRedirectRequiredException(graph, "Vendor Prices");
                }
                break;
            }
            return(adapter.Get());
        }
Beispiel #2
0
 protected override void POLine_CuryUnitCost_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs args)
 {
     if (!SkipCostDefaulting && args.Row is POLine subcontractLine)
     {
         var subcontract = Document.Current;
         args.NewValue = GetCurrencyUnitCost(subcontract, subcontractLine, cache);
         if (subcontractLine.InventoryID != null && subcontract?.VendorID != null)
         {
             APVendorPriceMaint.CheckNewUnitCost <POLine, POLine.curyUnitCost>(
                 cache, subcontractLine, args.NewValue);
         }
     }
 }
Beispiel #3
0
        private decimal?GetCurrencyUnitCost(POOrder subcontract, POLine subcontractLine, PXCache cache)
        {
            if (subcontractLine.ManualPrice == true || subcontractLine.UOM == null ||
                subcontractLine.InventoryID == null || subcontract?.VendorID == null)
            {
                return(subcontractLine.CuryUnitCost.GetValueOrDefault());
            }
            var currencyInfo = currencyinfo.Search <CurrencyInfo.curyInfoID>(subcontract.CuryInfoID);

            return(APVendorPriceMaint.CalculateUnitCost(
                       cache, subcontractLine.VendorID, subcontract.VendorLocationID, subcontractLine.InventoryID,
                       subcontractLine.SiteID, currencyInfo, subcontractLine.UOM, subcontractLine.OrderQty,
                       subcontract.OrderDate.GetValueOrDefault(), subcontractLine.CuryUnitCost));
        }
Beispiel #4
0
        protected virtual IEnumerable showVendorPrices(PXAdapter adapter)
        {
            if (this.BAccount.Current != null)
            {
                APVendorPriceMaint  graph  = PXGraph.CreateInstance <APVendorPriceMaint>();
                APVendorPriceFilter filter = PXCache <APVendorPriceFilter> .CreateCopy(graph.Filter.Current);

                filter.VendorID = this.BAccount.Current.BAccountID;
                if (this.VendorCatalogue.Current != null)
                {
                    filter.InventoryID = this.VendorCatalogue.Current.InventoryID;
                }
                graph.Filter.Update(filter);
                graph.Filter.Select();
                throw new PXRedirectRequiredException(graph, Messages.ShowVendorPrices);
            }
            return(adapter.Get());
        }