コード例 #1
0
 public virtual void addToProjects()
 {
     if (LienWaiverRecipientProjects.AskExt((graph, viewName) => PrepareDialogWindow(), true).IsPositive())
     {
         LienWaiverRecipientProjects.SelectMain().ForEach(MaintainLienWaiverRecipientsLinks);
         Base.Actions.PressSave();
     }
 }
コード例 #2
0
        private IEnumerable <VendorClass> GetAvailableVendorClasses()
        {
            var vendorClassIds = LienWaiverRecipients.SelectMain().Select(r => r.VendorClassId);

            return(SelectFrom <VendorClass>
                   .LeftJoin <EPEmployeeClass> .On <EPEmployeeClass.vendorClassID.IsEqual <VendorClass.vendorClassID> >
                   .Where <EPEmployeeClass.vendorClassID.IsNull>
                   .View.Select(Base).FirstTableItems.Where(vc => vc.VendorClassID.IsNotIn(vendorClassIds)));
        }
コード例 #3
0
 public virtual bool PrepareImportRow(string viewName, IDictionary keys, IDictionary values)
 {
     if (viewName.Equals(nameof(RelatedItems), StringComparison.InvariantCultureIgnoreCase) && !DontUpdateExistRecords)
     {
         if (_duplicateFinder == null)
         {
             var items = RelatedItems.SelectMain();
             _duplicateFinder = new DuplicatesSearchEngine <INRelatedInventory>(RelatedItems.Cache, GetAlternativeKeyFields(), items);
         }
         var duplicate = _duplicateFinder.Find(values);
         if (duplicate != null)
         {
             if (keys.Contains(nameof(INRelatedInventory.LineID)))
             {
                 keys[nameof(INRelatedInventory.LineID)] = duplicate.LineID;
             }
             else
             {
                 keys.Add(nameof(INRelatedInventory.LineID), duplicate.LineID);
             }
         }
     }
     return(true);
 }
コード例 #4
0
        public virtual IEnumerable Storages()
        {
            var result = new PXDelegateResult();

            result.IsResultSorted    = true;
            result.IsResultTruncated = Filter.Current.ExpandByLotSerialNbr == false;

            PXSelectBase <StoragePlaceStatus> byLocationSelect =
                new SelectFrom <StoragePlaceStatus>
                .Where <
                    StoragePlaceFilter.siteID.FromCurrent.NoDefault.IsEqual <StoragePlaceStatus.siteID>
                    .And <StoragePlaceStatus.qty.IsGreater <Zero> >
                    .And <
                        Not <FeatureInstalled <FeaturesSet.wMSCartTracking> >
                        .Or <StoragePlaceFilter.showLocations.FromCurrent.NoDefault.IsEqual <True> > .And <StoragePlaceStatus.isCart.IsEqual <False> >
                        .Or <StoragePlaceFilter.showCarts.FromCurrent.NoDefault.IsEqual <True> > .And <StoragePlaceStatus.isCart.IsEqual <True> > >
                    >
                .AggregateTo <
                    GroupBy <StoragePlaceStatus.siteCD>,
                    GroupBy <StoragePlaceStatus.storageCD>,
                    GroupBy <StoragePlaceStatus.isCart>,
                    GroupBy <StoragePlaceStatus.active>,
                    GroupBy <StoragePlaceStatus.inventoryCD>,
                    GroupBy <StoragePlaceStatus.subItemID>,
                    Sum <StoragePlaceStatus.qty> >
                .OrderBy <
                    StoragePlaceStatus.isCart.Asc,
                    StoragePlaceStatus.siteCD.Asc,
                    StoragePlaceStatus.storageCD.Desc,
                    StoragePlaceStatus.active.Desc,
                    StoragePlaceStatus.inventoryCD.Asc,
                    StoragePlaceStatus.subItemID.Asc,
                    StoragePlaceStatus.qty.Desc>
                .View(this);

            if (Filter.Current.StorageID != null)
            {
                byLocationSelect.WhereAnd <Where <StoragePlaceFilter.storageID.FromCurrent.IsEqual <StoragePlaceStatus.storageID> > >();
            }
            if (Filter.Current.InventoryID != null)
            {
                byLocationSelect.WhereAnd <Where <StoragePlaceFilter.inventoryID.FromCurrent.IsEqual <StoragePlaceStatus.inventoryID> > >();
            }
            if (Filter.Current.SubItemID != null)
            {
                byLocationSelect.WhereAnd <Where <StoragePlaceFilter.subItemID.FromCurrent.IsEqual <StoragePlaceStatus.subItemID> > >();
            }

            int startRow   = PXView.StartRow;
            int totalRows  = 0;
            var byLocation = Filter.Current.ExpandByLotSerialNbr == true
                                ? byLocationSelect.SelectMain()
                                : byLocationSelect.View.Select(PXView.Currents, PXView.Parameters, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows).RowCast <StoragePlaceStatus>().ToArray();

            if (byLocation.Length > 0 && Filter.Current.ExpandByLotSerialNbr == true)
            {
                PXSelectBase <StoragePlaceStatusExpanded> byLotSerialSelect =
                    new SelectFrom <StoragePlaceStatusExpanded>
                    .Where <
                        StoragePlaceFilter.siteID.FromCurrent.NoDefault.IsEqual <StoragePlaceStatusExpanded.siteID>
                        .And <StoragePlaceStatusExpanded.qty.IsGreater <Zero> >
                        >
                    .AggregateTo <
                        GroupBy <StoragePlaceStatusExpanded.siteCD>,
                        GroupBy <StoragePlaceStatusExpanded.storageCD>,
                        GroupBy <StoragePlaceStatusExpanded.active>,
                        GroupBy <StoragePlaceStatusExpanded.inventoryCD>,
                        GroupBy <StoragePlaceStatusExpanded.subItemID>,
                        GroupBy <StoragePlaceStatusExpanded.lotSerialNbr>,
                        Sum <StoragePlaceStatusExpanded.qty> >
                    .OrderBy <
                        StoragePlaceStatusExpanded.siteCD.Asc,
                        StoragePlaceStatusExpanded.storageCD.Desc,
                        StoragePlaceStatusExpanded.active.Desc,
                        StoragePlaceStatusExpanded.inventoryCD.Asc,
                        StoragePlaceStatusExpanded.subItemID.Asc,
                        StoragePlaceStatusExpanded.lotSerialNbr.Asc,
                        StoragePlaceStatusExpanded.qty.Desc>
                    .View(this);

                if (Filter.Current.StorageID != null)
                {
                    byLotSerialSelect.WhereAnd <Where <StoragePlaceFilter.storageID.FromCurrent.IsEqual <StoragePlaceStatusExpanded.storageID> > >();
                }
                if (Filter.Current.InventoryID != null)
                {
                    byLotSerialSelect.WhereAnd <Where <StoragePlaceFilter.inventoryID.FromCurrent.IsEqual <StoragePlaceStatusExpanded.inventoryID> > >();
                }
                if (Filter.Current.SubItemID != null)
                {
                    byLotSerialSelect.WhereAnd <Where <StoragePlaceFilter.subItemID.FromCurrent.IsEqual <StoragePlaceStatusExpanded.subItemID> > >();
                }
                if (Filter.Current.LotSerialNbr != null)
                {
                    byLotSerialSelect.WhereAnd <Where <StoragePlaceFilter.lotSerialNbr.FromCurrent.IsEqual <StoragePlaceStatusExpanded.lotSerialNbr> > >();
                }

                var byLotSerial =
                    byLotSerialSelect
                    .SelectMain()
                    .Select(
                        r => new StoragePlaceStatus
                {
                    SplittedIcon = r.SplittedIcon,
                    SiteID       = r.SiteID,
                    SiteCD       = r.SiteCD,
                    LocationID   = r.LocationID,
                    CartID       = null,
                    StorageID    = r.StorageID,
                    StorageCD    = r.StorageCD,
                    Descr        = r.Descr,
                    IsCart       = false,
                    Active       = r.Active,
                    InventoryID  = r.InventoryID,
                    InventoryCD  = r.InventoryCD,
                    SubItemID    = r.SubItemID,
                    LotSerialNbr = r.LotSerialNbr,
                    ExpireDate   = r.ExpireDate,
                    Qty          = r.Qty,
                    BaseUnit     = r.BaseUnit
                })
                    .ToArray();

                if (byLotSerial.Length > 0)
                {
                    int locationIdx            = 1;
                    int lotSerIdx              = 0;
                    StoragePlaceStatus current = byLocation[0];
                    result.Add(current);
                    while (locationIdx < byLocation.Length || lotSerIdx < byLotSerial.Length)
                    {
                        if (locationIdx >= byLocation.Length ||
                            lotSerIdx < byLotSerial.Length &&
                            current.SiteID == byLotSerial[lotSerIdx].SiteID &&
                            current.StorageID == byLotSerial[lotSerIdx].StorageID &&
                            current.InventoryID == byLotSerial[lotSerIdx].InventoryID &&
                            current.SubItemID == byLotSerial[lotSerIdx].SubItemID)
                        {
                            result.Add(byLotSerial[lotSerIdx]);
                            lotSerIdx++;
                        }
                        else
                        {
                            current = byLocation[locationIdx];
                            result.Add(current);
                            locationIdx++;
                        }
                    }
                }
                else
                {
                    result.AddRange(byLocation);
                }
            }
            else
            {
                result.AddRange(byLocation);
            }

            PXView.StartRow = 0;
            return(result);
        }
コード例 #5
0
 private bool DoesCheckContainReversedAdjustments(JointPayeePayment jointPayeePayment)
 {
     return(JointPayeePayments.SelectMain()
            .Any(jpp => jpp.JointAmountToPay < 0 && jpp.JointPayeeId == jointPayeePayment.JointPayeeId));
 }