WebEnabled property for inventory items  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

WebEnabled property for inventory items

Postby Mark Shipman » Fri Jul 10, 2020 10:23 am

Working with the JiwaFinancials.Jiwa.JiwaApplication.Entities.Inventory class in Jiwa 7.2.1.0.

From Visual Studio, we cannot see the WebEnabled property of an Inventory entity. Looking at the definition of the class from meta-data (F12), we see:

Code: Select all
#region Assembly JiwaApplication, Version=7.2.1.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c
// Y:\ZDevelop\Jiwa7\WooCommerce\WooCommercePlugin\WooCommercePlugin\bin\Debug\JiwaApplication.dll
#endregion

using JiwaFinancials.Jiwa.JiwaApplication;
using JiwaFinancials.Jiwa.JiwaApplication.Entities;
using JiwaFinancials.Jiwa.JiwaApplication.Entities.GeneralLedger;
using JiwaFinancials.Jiwa.JiwaApplication.Entities.Inventory;
using JiwaFinancials.Jiwa.JiwaApplication.Inventory.Warehouse;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Xml.Serialization;

namespace JiwaFinancials.Jiwa.JiwaApplication.Entities.Inventory
{
    [CLSCompliant(true)]
    [XmlType("Inventory", Namespace = "JiwaFinancials.Jiwa.JiwaApplication.Entities.Inventory")]
    public class Inventory : Entity
    {
        public Inventory();

        public Account WriteOnLedger { get; }
        [XmlIgnore]
        public bool WorkInProgressLedgerSpecified { get; set; }
        public Account WorkInProgressLedger { get; }
        [XmlIgnore]
        public bool WriteOffLedgerSpecified { get; set; }
        public Account WriteOffLedger { get; }
        [XmlIgnore]
        public bool InventoryValueLedgerSpecified { get; set; }
        public Account InventoryValueLedger { get; }
        [XmlIgnore]
        public bool UseExpiryDateSpecified { get; set; }
        public bool UseExpiryDate { get; set; }
        [XmlIgnore]
        public bool BOMTypeSpecified { get; set; }
        public InventoryBOMTypes BOMType { get; set; }
        [XmlIgnore]
        public bool IsBackorderableSpecified { get; set; }
        public bool IsBackorderable { get; set; }
        [XmlIgnore]
        public bool SalesmanCostSpecified { get; set; }
        public decimal SalesmanCost { get; set; }
        [XmlIgnore]
        public bool RRPSpecified { get; set; }
        public decimal RRP { get; set; }
        [XmlIgnore]
        public bool WriteOnLedgerSpecified { get; set; }
        public Account CostPriceAdjustmentsLedger { get; }
        [XmlIgnore]
        public bool CostPriceAdjustmentsLedgerSpecified { get; set; }
        public Account COGSVarianceLedger { get; }
        public InventoryStatuses Status { get; set; }
        [XmlIgnore]
        public bool QuantityB2BBackOrdersSpecified { get; set; }
        public decimal QuantityB2BBackOrders { get; set; }
        [XmlIgnore]
        public bool QuantitySOHAvailableSpecified { get; set; }
        public decimal QuantitySOHAvailable { get; set; }
        [XmlIgnore]
        public bool QuantitySOHOnShelfSpecified { get; set; }
        public decimal QuantitySOHOnShelf { get; set; }
        [XmlIgnore]
        public bool QuantityOtherBackOrdersSpecified { get; set; }
        [XmlIgnore]
        public bool DefaultPriceSpecified { get; set; }
        public decimal QuantityOtherBackOrders { get; set; }
        public string Aux2 { get; set; }
        [XmlIgnore]
        public bool COGSMovementLedgerSpecified { get; set; }
        public Account COGSMovementLedger { get; }
        [XmlIgnore]
        public bool COGSExpectedAssetLedgerSpecified { get; set; }
        public Account ExpectedAssetLedger { get; }
        [XmlIgnore]
        public bool ExpectedLiabilityLedgerSpecified { get; set; }
        public Account ExpectedLiabilityLedger { get; }
        [XmlIgnore]
        public bool COGSVarianceLedgerSpecified { get; set; }
        public decimal SearchQuantity { get; set; }
        public decimal DefaultPrice { get; set; }
        [XmlIgnore]
        public bool DiscountableSpecified { get; set; }
        public string PartNoDashDescription { get; }
        public string InventoryID { get; set; }
        public string PartNo { get; set; }
        public string Description { get; set; }
        public bool Discountable { get; set; }
        [XmlIgnore]
        public bool DecimalPlacesSpecified { get; set; }
        public decimal LCost { get; set; }
        [XmlIgnore]
        public bool LCostSpecified { get; set; }
        public decimal Cubic { get; set; }
        [XmlIgnore]
        public bool CubicSpecified { get; set; }
        public decimal Weight { get; set; }
        [XmlIgnore]
        public bool WeightSpecified { get; set; }
        public int DecimalPlaces { get; set; }
        public bool IsPhysical { get; set; }
        public string Units { get; set; }
        public decimal MinimumGP { get; set; }
        public string GSTAdjustmentInwardsID { get; set; }
        public string GSTAdjustmentOutwardsID { get; set; }
        public string GSTInwardsID { get; set; }
        [XmlIgnore]
        public bool MinimumGPSpecified { get; set; }
        public bool SellPriceIsIncTax { get; set; }
        [XmlIgnore]
        public bool IsSerialSpecified { get; set; }
        public bool IsSerial { get; set; }
        public string GSTOutwardsID { get; set; }
        [XmlIgnore]
        public bool IsPhysicalSpecified { get; set; }

        public static List<Inventory> MultiSelectSearch(Manager Manager, System.Windows.Forms.Form OwnerForm, string FilterString = "", string PretypedKeys = "", bool ShowQuantityInSearchResults = false, bool ShowSSCMatrixInSearch = false, JiwaApplication.Inventory.Warehouse.LogicalWarehouse Warehouse = null);
// Balance removed for brevity...


Is there another class we should use to see the WebEnabled property exposed?

Many thanks,
Mark Shipman
Mark Shipman
Software Developer
Mark Shipman
Occasional Contributor
Occasional Contributor
 
Posts: 21
Joined: Mon Mar 02, 2020 1:44 pm
Location: Auckland, New Zealand

Re: WebEnabled property for inventory items  Topic is solved

Postby DannyC » Fri Jul 10, 2020 10:38 am

Rather than using en entity (which is a trimmed down version of whatever object you're using) you can grab the full class like this:

Code: Select all
JiwaFinancials.Jiwa.JiwaInventory.Inventory inventory = manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaInventory.Inventory>(null);


Then you can just go
Code: Select all
inventory.WebEnabled
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: WebEnabled property for inventory items

Postby SBarnes » Fri Jul 10, 2020 12:07 pm

Be aware that there is a difference between the inventory item in JiwaFinancials.Jiwa.JiwaApplication.Entities.Inventory and the one in JiwaFinancials.Jiwa.JiwaInventory.Inventory, the first is pretty basic object for reading data from IN_Main and may not have all properties associated with inventory and the second and the one Danny showed you how to get is the full blown business object that controls all the business logic associated with a product.

Basically use entity object for quick reads of data and the latter for manipulation or a lot of data.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: WebEnabled property for inventory items

Postby Mark Shipman » Fri Jul 10, 2020 12:15 pm

Thank you!
Mark Shipman
Software Developer
Mark Shipman
Occasional Contributor
Occasional Contributor
 
Posts: 21
Joined: Mon Mar 02, 2020 1:44 pm
Location: Auckland, New Zealand

Re: WebEnabled property for inventory items

Postby Mike.Sheen » Fri Jul 10, 2020 12:44 pm

Fun fact: The inventory entity class started out with 5 properties - RecID (InventoryID), PartNo, Description, DefaultPrice, LastCost.

It's been slowly expanding over time, hence why some properties are not present - but as mentioned by Stuart, it was intended to be a small lightweight class for reading the bare essentials of an inventory item in a performant way.

If using the Inventory business logic to read the full item is too slow for you (in case your iterating through 1000's of items), then an ad-hoc SQL query will be your next option.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: WebEnabled property for inventory items

Postby SBarnes » Fri Jul 10, 2020 1:44 pm

The other option if you like less code would be to use ORMLite see viewtopic.php?f=26&t=783&p=2787&hilit=ormlite#p2787 and use IN_MAIN out of the service model namespace if you prefer an ORM
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests