Exemple #1
0
        protected virtual void INSite_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            INAcctSubDefault.Required(sender, e);
            INSite row = (INSite)e.Row;

            if (row != null)
            {
                viewRestrictionGroups.SetEnabled(row.SiteCD != null);

                foreach (INLocation deletedLocation in location.Cache.Cached)
                {
                    PXEntryStatus rowStatus = location.Cache.GetStatus(deletedLocation);
                    if (rowStatus == PXEntryStatus.Deleted || rowStatus == PXEntryStatus.InsertedDeleted)
                    {
                        if (deletedLocation.LocationID == row.ReceiptLocationID)
                        {
                            sender.RaiseExceptionHandling <INSite.receiptLocationID>(row, deletedLocation.LocationCD, new PXSetPropertyException(ErrorMessages.ForeignRecordDeleted));
                        }
                        if (deletedLocation.LocationID == row.ShipLocationID)
                        {
                            sender.RaiseExceptionHandling <INSite.shipLocationID>(row, deletedLocation.LocationCD, new PXSetPropertyException(ErrorMessages.ForeignRecordDeleted));
                        }
                        if (deletedLocation.LocationID == row.ReturnLocationID)
                        {
                            sender.RaiseExceptionHandling <INSite.returnLocationID>(row, deletedLocation.LocationCD, new PXSetPropertyException(ErrorMessages.ForeignRecordDeleted));
                        }
                        if (deletedLocation.LocationID == row.DropShipLocationID)
                        {
                            sender.RaiseExceptionHandling <INSite.dropShipLocationID>(row, deletedLocation.LocationCD, new PXSetPropertyException(ErrorMessages.ForeignRecordDeleted));
                        }
                    }
                }
            }
        }
Exemple #2
0
 protected virtual void INPostClass_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
 {
     if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Delete)
     {
         return;
     }
     INAcctSubDefault.Required(sender, e);
 }
        protected virtual void INSite_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            INAcctSubDefault.Required(sender, e);
            if (e.Operation.Command().IsIn(PXDBOperation.Insert, PXDBOperation.Update))
            {
                var site = (INSite)e.Row;
                if (site.OverrideInvtAccSub != true)
                {
                    PXDefaultAttribute.SetPersistingCheck <INSite.invtAcctID>(sender, e.Row, PXPersistingCheck.Nothing);
                    PXDefaultAttribute.SetPersistingCheck <INSite.invtSubID>(sender, e.Row, PXPersistingCheck.Nothing);
                }
                if (site.ReceiptLocationIDOverride == true || site.ShipLocationIDOverride == true)
                {
                    List <PXDataFieldParam> prm = new List <PXDataFieldParam>();
                    if (site.ReceiptLocationIDOverride == true)
                    {
                        prm.Add(new PXDataFieldAssign(typeof(INItemSite.dfltReceiptLocationID).Name, PXDbType.Int, site.ReceiptLocationID));
                    }
                    if (site.ShipLocationIDOverride == true)
                    {
                        prm.Add(new PXDataFieldAssign(typeof(INItemSite.dfltShipLocationID).Name, PXDbType.Int, site.ShipLocationID));
                    }
                    prm.Add(new PXDataFieldRestrict(typeof(INItemSite.siteID).Name, PXDbType.Int, site.SiteID));
                    PXDatabase.Update <INItemSite>(prm.ToArray());
                }

                if (site.Active != true)
                {
                    bool cantDeactivateSite = (INRegister)
                                              PXSelect <INRegister,
                                                        Where <INRegister.released, NotEqual <True>,
                                                               And <Where <INRegister.siteID, Equal <Current <INSite.siteID> >,
                                                                           Or <INRegister.toSiteID, Equal <Current <INSite.siteID> > > > > > >
                                              .SelectSingleBound(this, new [] { e.Row }) != null;

                    cantDeactivateSite = cantDeactivateSite || (INTran)
                                         PXSelect <INTran,
                                                   Where <INTran.released, NotEqual <True>,
                                                          And <Where <INTran.siteID, Equal <Current <INSite.siteID> >,
                                                                      Or <INTran.toSiteID, Equal <Current <INSite.siteID> > > > > > >
                                         .SelectSingleBound(this, new [] { e.Row }) != null;

                    if (cantDeactivateSite)
                    {
                        sender.RaiseExceptionHandling <INSite.active>(e.Row, null, new PXSetPropertyException(Messages.CantDeactivateSite));
                    }
                }
            }
        }
Exemple #4
0
        protected override void InventoryItem_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            base.InventoryItem_RowSelected(sender, e);

            InventoryItem row = (InventoryItem)e.Row;

            if (row == null)
            {
                return;
            }

            PXUIFieldAttribute.SetEnabled <InventoryItem.cOGSSubID>(sender, row, (postclass.Current != null && postclass.Current.COGSSubFromSales == false));
            PXUIFieldAttribute.SetEnabled <InventoryItem.stdCstVarAcctID>(sender, row, row?.ValMethod == INValMethod.Standard);
            PXUIFieldAttribute.SetEnabled <InventoryItem.stdCstVarSubID>(sender, row, row?.ValMethod == INValMethod.Standard);
            PXUIFieldAttribute.SetEnabled <InventoryItem.stdCstRevAcctID>(sender, row, row?.ValMethod == INValMethod.Standard);
            PXUIFieldAttribute.SetEnabled <InventoryItem.stdCstRevSubID>(sender, row, row?.ValMethod == INValMethod.Standard);
            PXUIFieldAttribute.SetEnabled <InventoryItem.pendingStdCost>(sender, row, row?.ValMethod == INValMethod.Standard);
            PXUIFieldAttribute.SetEnabled <InventoryItem.pendingStdCostDate>(sender, row, row?.ValMethod == INValMethod.Standard);
            PXUIFieldAttribute.SetVisible <InventoryItem.defaultSubItemOnEntry>(sender, null, insetup.Current.UseInventorySubItem == true);
            PXUIFieldAttribute.SetEnabled <POVendorInventory.isDefault>(this.VendorItems.Cache, null, true);
            INAcctSubDefault.Required(sender, new PXRowSelectedEventArgs(row));

            PXUIFieldAttribute.SetVisible <InventoryItem.defaultSubItemOnEntry>(sender, null, insetup.Current.UseInventorySubItem == true);

            Boxes.Cache.AllowInsert = row.PackageOption != INPackageOption.Manual && PXAccess.FeatureInstalled <FeaturesSet.autoPackaging>();
            Boxes.Cache.AllowUpdate = row.PackageOption != INPackageOption.Manual && PXAccess.FeatureInstalled <FeaturesSet.autoPackaging>();
            Boxes.Cache.AllowSelect = PXAccess.FeatureInstalled <FeaturesSet.autoPackaging>();

            if (row.PackageOption == INPackageOption.Quantity)
            {
                PXUIFieldAttribute.SetEnabled <InventoryItem.packSeparately>(Item.Cache, Item.Current, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.qty>(Boxes.Cache, null, true);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.uOM>(Boxes.Cache, null, true);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxQty>(Boxes.Cache, null, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxWeight>(Boxes.Cache, null, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxVolume>(Boxes.Cache, null, false);
            }
            else if (row.PackageOption == INPackageOption.Weight)
            {
                PXUIFieldAttribute.SetEnabled <InventoryItem.packSeparately>(Item.Cache, Item.Current, true);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.qty>(Boxes.Cache, null, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.uOM>(Boxes.Cache, null, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxQty>(Boxes.Cache, null, true);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxWeight>(Boxes.Cache, null, true);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxVolume>(Boxes.Cache, null, false);
            }
            else if (row.PackageOption == INPackageOption.WeightAndVolume)
            {
                PXUIFieldAttribute.SetEnabled <InventoryItem.packSeparately>(Item.Cache, Item.Current, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.qty>(Boxes.Cache, null, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.uOM>(Boxes.Cache, null, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxQty>(Boxes.Cache, null, true);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxWeight>(Boxes.Cache, null, true);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxVolume>(Boxes.Cache, null, true);
            }
            else if (row.PackageOption == INPackageOption.Manual)
            {
                Boxes.Cache.AllowSelect = false;
                PXUIFieldAttribute.SetEnabled <InventoryItem.packSeparately>(Item.Cache, Item.Current, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.qty>(Boxes.Cache, null, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.uOM>(Boxes.Cache, null, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxQty>(Boxes.Cache, null, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxWeight>(Boxes.Cache, null, false);
                PXUIFieldAttribute.SetVisible <INItemBoxEx.maxVolume>(Boxes.Cache, null, false);
            }

            if (PXAccess.FeatureInstalled <FeaturesSet.autoPackaging>())
            {
                ValidatePackaging(row);
            }

            FieldsDependOnStkItemFlag(sender, row);

            var  hasChildObject = sender.GetValueExt <InventoryItem.hasChild>(row);
            bool hasChild       = ((hasChildObject is PXFieldState s) ? (bool?)s.Value : (bool?)hasChildObject) == true;

            sender.Adjust <PXUIFieldAttribute>().For <InventoryItem.itemClassID>(a => a.Enabled = !hasChild)
            .SameFor <InventoryItem.stkItem>()
            .SameFor <InventoryItem.baseUnit>()
            .SameFor <InventoryItem.decimalBaseUnit>()
            .SameFor <InventoryItem.purchaseUnit>()
            .SameFor <InventoryItem.decimalPurchaseUnit>()
            .SameFor <InventoryItem.salesUnit>()
            .SameFor <InventoryItem.decimalSalesUnit>();
        }
Exemple #5
0
        protected virtual void INPostClass_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            PXUIFieldAttribute.SetEnabled <INPostClass.cOGSSubMask>(sender, e.Row, (e.Row != null && ((INPostClass)e.Row).COGSSubFromSales == false));

            INAcctSubDefault.Required(sender, e);
        }
 protected virtual void INSite_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
 {
     INAcctSubDefault.Required(sender, e);
     viewRestrictionGroups.SetEnabled(e.Row != null && ((INSite)e.Row).SiteCD != null);
 }
Exemple #7
0
 protected virtual void INPostClass_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
 {
     INAcctSubDefault.Required(sender, e);
 }