{
  "formId": "itemmaster",
  "entity": "Item",
  "title": "Item Master",

  "codeDefine": {
    "selectorFieldId": "CodeCategoryId",
    "selectorPicklistJSON": "CodeCategory",
    "generationTypeFieldId": "CodeDefineGenerationType",
    "codeFieldId": "ItemCode",
    "keyFieldsApi": "Inventory.Item.MetaKeyFields"
  },

  "pages": [
    {
      "pageId": "overview",
      "pageName": "Overview",
      "isDynamic": true
    },
    {
      "pageId": "Classification",
      "pageName": "Classification",
      "sections": [
        {
          "sectionId": "header",
          "sectionName": "Item Identity",
          "layout": { "columns": 12 },
          "fields": [
            { "Name": "ItemId",                       "Type": "number", "PostData": true,  "DefaultValue": 0, "IsVisible": false },
            { "Name": "CodeDefineGenerationType",     "Type": "number", "PostData": false, "DefaultValue": 1, "IsVisible": false },
            { "Name": "CodeCategoryId",               "Type": "number", "PostData": true,  "DefaultValue": 0, "IsVisible": false },
            {
              "Name": "CodeCategoryCategoryName", "Type": "string",
              "Label": "Item.Code.Category", "PlaceHolder": "Select Category",
              "PicklistJSON": "CodeCategory", "PicklistTitle": "CategoryName",
              "LinkId": "CodeCategoryId", "Required": true,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemCode", "Type": "string",
              "Label": "Item.Code", "PlaceHolder": "Enter Code",
              "PicklistJSON": "itemmastercode", "PicklistTitle": "Code",
              "LinkId": "ItemId", "isKeyField": true, "AddNew": true,
              "RequireBasedOnFieldName": "CodeDefineGenerationType",
              "RequireBasedOnFieldValue": [1],
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemName", "Type": "string",
              "Label": "Item.Name", "PlaceHolder": "Enter Name", "Required": true,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemShortName", "Type": "string",
              "Label": "Item.Short.Name", "PlaceHolder": "Enter Short Name",
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemDescription", "Type": "textarea",
              "Label": "Item.Description", "PlaceHolder": "Enter Description",
              "layout": { "colSpan": 8 }
            }
          ]
        },
        {
          "sectionId": "classification",
          "sectionName": "Classification",
          "layout": { "columns": 12 },
          "fields": [
            { "Name": "ItemTypeId",   "Type": "number", "PostData": true, "DefaultValue": 0, "IsVisible": false },
            {
              "Name": "ItemTypeName", "Type": "string",
              "Label": "Item.Type", "PlaceHolder": "Select Type",
              "PicklistJSON": "GCMName", "PicklistTitle": "Name", "PicklistCriteria": "ItemType",
              "LinkId": "ItemTypeId", "Required": true,
              "layout": { "colSpan": 4 }
            },
            { "Name": "CategoryId",   "Type": "number", "PostData": true, "DefaultValue": 0, "IsVisible": false },
            {
              "Name": "CategoryName", "Type": "string",
              "Label": "Item.Category", "PlaceHolder": "Select Category",
              "PicklistJSON": "ItemCategory", "PicklistTitle": "Name",
              "LinkId": "CategoryId",
              "layout": { "colSpan": 4 }
            },
            { "Name": "ItemGroupId",   "Type": "number", "PostData": true, "DefaultValue": 0, "IsVisible": false },
            {
              "Name": "ItemGroupName", "Type": "string",
              "Label": "Item.Group", "PlaceHolder": "Select Group",
              "PicklistJSON": "ItemGroup", "PicklistTitle": "Name",
              "LinkId": "ItemGroupId",
              "layout": { "colSpan": 4 }
            },
            { "Name": "ItemBrandId",   "Type": "number", "PostData": true, "DefaultValue": 0, "IsVisible": false },
            {
              "Name": "ItemBrandName", "Type": "string",
              "Label": "Item.Brand", "PlaceHolder": "Select Brand",
              "PicklistJSON": "ItemBrand", "PicklistTitle": "Name",
              "LinkId": "ItemBrandId",
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemStatus", "Type": "number",
              "Label": "Item.Status",
              "PickLists": [{"key": 0, "value": "Active"}, {"key": 1, "value": "Inactive"}],
              "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemIsStockPosting", "Type": "number",
              "Label": "Item.Stock.Posting",
              "PickLists": [{"key": 0, "value": "No"}, {"key": 1, "value": "Yes"}],
              "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            }
          ]
        }
      ]
    },
    {
      "pageId": "Purchase",
      "pageName": "Purchase",
      "sections": [
        {
          "sectionId": "purchase",
          "sectionName": "Purchase Details",
          "layout": { "columns": 12 },
          "fields": [
            {
              "Name": "ItemIsPurchasable", "Type": "number",
              "Label": "Item.Is.Purchasable",
              "PickLists": [{"key": 0, "value": "No"}, {"key": 1, "value": "Yes"}],
              "DefaultValue": 1,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemPurchaseRate", "Type": "number",
              "Label": "Item.Purchase.Rate", "PlaceHolder": "0.00", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemMinimumStock", "Type": "number",
              "Label": "Item.Min.Stock", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemMaximumStock", "Type": "number",
              "Label": "Item.Max.Stock", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemReorderLevel", "Type": "number",
              "Label": "Item.Reorder.Level", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemLeadTime", "Type": "number",
              "Label": "Item.Lead.Time", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            }
          ]
        }
      ]
    },
    {
      "pageId": "Sales",
      "pageName": "Sales",
      "sections": [
        {
          "sectionId": "sales",
          "sectionName": "Sales Details",
          "layout": { "columns": 12 },
          "fields": [
            {
              "Name": "ItemIsSaleableItem", "Type": "number",
              "Label": "Item.Is.Saleable",
              "PickLists": [{"key": 0, "value": "No"}, {"key": 1, "value": "Yes"}],
              "DefaultValue": 1,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemSalesRate", "Type": "number",
              "Label": "Item.Sales.Rate", "PlaceHolder": "0.00", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemDiscountPercentage", "Type": "number",
              "Label": "Item.Discount%", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemMRP", "Type": "number",
              "Label": "Item.MRP", "PlaceHolder": "0.00", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            }
          ]
        }
      ]
    },
    {
      "pageId": "UnitPack",
      "pageName": "Unit & Pack",
      "sections": [
        {
          "sectionId": "uom",
          "sectionName": "Units of Measure",
          "layout": { "columns": 12 },
          "fields": [
            { "Name": "PurchaseUOMId", "Type": "number", "PostData": true, "DefaultValue": 0, "IsVisible": false },
            {
              "Name": "PurchaseUOMName", "Type": "string",
              "Label": "Purchase.UOM", "PlaceHolder": "Select Purchase Unit",
              "PicklistJSON": "UOM", "PicklistTitle": "Name",
              "LinkId": "PurchaseUOMId", "Required": true,
              "layout": { "colSpan": 4 }
            },
            { "Name": "StockUOMId", "Type": "number", "PostData": true, "DefaultValue": 0, "IsVisible": false },
            {
              "Name": "StockUOMName", "Type": "string",
              "Label": "Stock.UOM", "PlaceHolder": "Select Stock Unit",
              "PicklistJSON": "UOM", "PicklistTitle": "Name",
              "LinkId": "StockUOMId", "Required": true,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemConversionFactor", "Type": "number",
              "Label": "Conversion.Factor", "PlaceHolder": "1", "DefaultValue": 1,
              "layout": { "colSpan": 4 }
            }
          ]
        }
      ]
    },
    {
      "pageId": "Planning",
      "pageName": "Planning",
      "sections": [
        {
          "sectionId": "planning",
          "sectionName": "Manufacturing Lead Time",
          "layout": { "columns": 12 },
          "fields": [
            {
              "Name": "ItemIsMakeOrBuy", "Type": "number",
              "Label": "Make.Or.Buy",
              "PickLists": [{"key": 0, "value": "Make"}, {"key": 1, "value": "Buy"}],
              "DefaultValue": 1,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemFixedLeadTime", "Type": "number",
              "Label": "Setup.Time", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 3 }
            },
            {
              "Name": "ItemLeadTimeLotSize", "Type": "number",
              "Label": "Lot.Size", "PlaceHolder": "1", "DefaultValue": 1,
              "layout": { "colSpan": 3 }
            },
            {
              "Name": "ItemVariableLeadTime", "Type": "number",
              "Label": "Cycle.Time", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 3 }
            },
            {
              "Name": "ItemVariableQuantity", "Type": "number",
              "Label": "Cycle.Qty", "PlaceHolder": "1", "DefaultValue": 1,
              "layout": { "colSpan": 3 }
            },
            {
              "Name": "ItemManufacturingLeadTime", "Type": "number",
              "Label": "Mfr.Lead.Time", "ReadOnly": true, "PostData": false,
              "layout": { "colSpan": 4 }
            }
          ]
        },
        {
          "sectionId": "processing",
          "sectionName": "Processing Lead Time",
          "layout": { "columns": 12 },
          "fields": [
            {
              "Name": "ItemPreprocessingLeadTime", "Type": "number",
              "Label": "Pre-processing", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemProcessingLeadTime", "Type": "number",
              "Label": "Processing", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemPostprocessingLeadTime", "Type": "number",
              "Label": "Post-processing", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemLeadTimeOffSet", "Type": "number",
              "Label": "Total.Lead.Time", "ReadOnly": true, "PostData": false,
              "layout": { "colSpan": 4 }
            }
          ]
        }
      ]
    },
    {
      "pageId": "DutyTax",
      "pageName": "Duty & Tax",
      "sections": [
        {
          "sectionId": "tax",
          "sectionName": "Tax Configuration",
          "layout": { "columns": 12 },
          "fields": [
            {
              "Name": "ItemGSTType", "Type": "combobox", "Label": "GST.Type",
              "PostData": true, "DefaultValue": 0,
              "PickLists": [
                {"key": 0, "value": "GST"},
                {"key": 1, "value": "Nil Rated"},
                {"key": 2, "value": "Exempted"},
                {"key": 3, "value": "Non GST"}
              ],
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemITCType", "Type": "combobox", "Label": "ITC.Type",
              "PostData": true, "DefaultValue": 0,
              "PickLists": [
                {"key": 0, "value": "Input ITC"},
                {"key": 1, "value": "Capital Goods ITC"},
                {"key": 2, "value": "Service ITC"},
                {"key": 3, "value": "No ITC"}
              ],
              "layout": { "colSpan": 4 }
            }
          ]
        }
      ]
    },
    {
      "pageId": "Quality",
      "pageName": "Quality & Service",
      "sections": [
        {
          "sectionId": "quality",
          "sectionName": "Inspection & Warranty",
          "layout": { "columns": 12 },
          "fields": [
            {
              "Name": "ItemInspectionType", "Type": "number",
              "Label": "Inspection.Type",
              "PickLists": [
                {"key": 0, "value": "None"},
                {"key": 1, "value": "Visual"},
                {"key": 2, "value": "Lab"}
              ],
              "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemIsWarrantyApplicable", "Type": "number",
              "Label": "Warranty.Applicable",
              "PickLists": [{"key": 0, "value": "No"}, {"key": 1, "value": "Yes"}],
              "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemWarrantyPeriod", "Type": "number",
              "Label": "Warranty.Period.(Months)", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemComprehensiveMonths", "Type": "number",
              "Label": "Comprehensive.Months", "PlaceHolder": "0", "DefaultValue": 0,
              "layout": { "colSpan": 4 }
            },
            {
              "Name": "ItemNonComprehensiveMonths", "Type": "number",
              "Label": "Non-Comprehensive.Months", "ReadOnly": true, "PostData": false,
              "layout": { "colSpan": 4 }
            }
          ]
        }
      ]
    },
    {
      "pageId": "Store",
      "pageName": "Store",
      "sections": [
        {
          "sectionId": "store",
          "sectionName": "Store Mapping",
          "layout": { "columns": 12 },
          "fields": [
            { "Name": "OrganizationUnitId", "Type": "number", "PostData": true, "DefaultValue": 0, "IsVisible": false },
            {
              "Name": "OrganizationUnitName", "Type": "string",
              "Label": "Organization.Unit", "PlaceHolder": "Select Organization Unit",
              "PicklistJSON": "OrganizationUnit", "PicklistTitle": "Name",
              "LinkId": "OrganizationUnitId",
              "layout": { "colSpan": 6 }
            }
          ],
          "grid": {
            "fieldId": "ItemStockDTO",
            "entity": "ItemStock",
            "allowAdd": true,
            "allowDelete": true,
            "IsAddrowRequired": false,
            "IsCheckBoxRequired": true,
            "isStore": true,
            "CheckBoxField": "checkBox",
            "SLNOField": "PatternDetailSlNo",
            "columns": [
              { "Name": "ItemStockStockOnHand", "Type": "number",   "PostData": true, "IsVisible": false, "DefaultValue": 0 },
              { "Name": "checkBox",             "Type": "checkbox", "PostData": true, "IsVisible": false, "DefaultValue": 1 },
              { "Name": "StoreId",              "Type": "number",   "PostData": true,  "DefaultValue": -1, "IsVisible": false },
              { "Name": "StoreName",            "Type": "picklist", "Label": "Store",       "Width": 320, "PostData": false, "IsVisible": true,
                "PicklistDetail": { "PicklistUrl": "BINnumber", "PicklistDisplayText": "BinNumber", "PicklistSearchFields": "BinNumber", "LinkId": "StoreId,StoreName", "PlaceHolder": "Select Store", "PicklistSelection": "Id", "PicklistTitle": "BinNumber", "ColumnWidth": "600", "ColumnType": "string,string", "Multiple": false, "AddNew": false, "Width": 300, "MaxLength": 20 } },
              { "Name": "ItemStockRol",         "Type": "number",   "Label": "ROL",         "DefaultValue": 0,  "Width": 100 },
              { "Name": "SKUId",                "Type": "number",   "PostData": true, "IsVisible": false, "DefaultValue": -1 },
              { "Name": "UOMId",                "Type": "number",   "PostData": true, "IsVisible": false, "DefaultValue": -1 },
              { "Name": "CycleClassId",         "Type": "number",   "PostData": true,       "DefaultValue": -1, "IsVisible": false },
              { "Name": "CycleClass",           "Type": "picklist", "Label": "Cycle.Class", "Width": 180, "PostData": false, "IsVisible": true,
                "PicklistDetail": { "PicklistUrl": "CycleClass", "PicklistDisplayText": "CycleClasso", "PicklistSearchFields": "CycleClasso", "LinkId": "CycleClassId,CycleClass", "PlaceHolder": "Select Cycle Class", "PicklistSelection": "Id", "PicklistTitle": "CycleClasso", "ColumnWidth": "600", "ColumnType": "string,string", "Multiple": false, "AddNew": false, "Width": 160, "MaxLength": 20 } },
              { "Name": "BinId",                "Type": "number",   "PostData": true,       "DefaultValue": -1, "IsVisible": false },
              { "Name": "ItemStockBinNumber",   "Type": "picklist", "Label": "Bin",         "Width": 320,       "IsVisible": true,
                "PicklistDetail": { "PicklistUrl": "BINnumber", "PicklistDisplayText": "BinNumber", "PicklistSearchFields": "BinNumber", "LinkId": "BinId,ItemStockBinNumber", "PlaceHolder": "Enter The BIN Number", "PicklistSelection": "Id", "PicklistTitle": "BinNumber", "ColumnWidth": "600", "ColumnType": "string,string", "Multiple": false, "AddNew": true, "Width": 300, "MaxLength": 20 } }
            ]
          }
        }
      ]
    },
    {
      "pageId": "Alias",
      "pageName": "Alias",
      "sections": [
        {
          "sectionId": "alias",
          "sectionName": "Item Aliases",
          "layout": { "columns": 12 },
          "fields": [],
          "grid": {
            "fieldId": "ItemAliasDTOs",
            "entity": "ItemAlias",
            "allowAdd": true,
            "allowDelete": true,
            "columns": [
              { "Name": "ItemAliasId",    "Type": "number",   "PostData": true,  "DefaultValue": 0, "IsVisible": false },
              { "Name": "AliasItemName",  "Type": "string",   "Label": "Alias.Name",   "PlaceHolder": "Enter Alias", "Width": 200 },
              { "Name": "Description",    "Type": "string",   "Label": "Description",  "PlaceHolder": "Enter Description", "Width": 200 },
              { "Name": "DrawingNumber",  "Type": "string",   "Label": "Drawing.No",   "PlaceHolder": "Enter Drawing No",  "Width": 150 },
              { "Name": "CatalogueNumber","Type": "string",   "Label": "Catalogue.No", "PlaceHolder": "Enter Catalogue No","Width": 150 },
              { "Name": "ItemGroupId",    "Type": "number",   "PostData": true,  "DefaultValue": 0, "IsVisible": false },
              { "Name": "ItemGroupName",  "Type": "picklist", "Label": "Group",        "Width": 330, "IsVisible": true,
                "PicklistDetail": { "PicklistUrl": "ItemGroup", "PicklistDisplayText": "Code,Name", "PicklistSearchFields": "Code,Name", "LinkId": "ItemGroupId,ItemGroupName", "PlaceHolder": "Select Group", "PicklistSelection": "Id", "PicklistTitle": "Name", "ColumnWidth": "250,350", "ColumnType": "string,string", "Multiple": false, "AddNew": false, "Width": 300, "MaxLength": 20 } },
              { "Name": "Quantity",       "Type": "number",   "Label": "Qty.Per",      "DefaultValue": 1, "Width": 80 }
            ]
          }
        }
      ]
    }
  ],

  "quickActions": [
    {
      "actionId": "changeStatus",
      "label": "Change Status",
      "fields": [
        {
          "Name": "ItemStatus", "Type": "combobox", "Label": "New Status",
          "PickLists": [{"key": 0, "value": "Active"}, {"key": 1, "value": "Inactive"}]
        }
      ],
      "api": "Inventory.Item.ChangeStatus"
    }
  ],

  "rules": [
    {
      "id": "mfr-leadtime",
      "scope": "implementation",
      "type": "calculate",
      "trigger": ["ItemFixedLeadTime", "ItemLeadTimeLotSize", "ItemVariableLeadTime", "ItemVariableQuantity"],
      "formula": "({ItemFixedLeadTime}/{ItemLeadTimeLotSize}) + ({ItemVariableLeadTime}/{ItemVariableQuantity})",
      "target": "ItemManufacturingLeadTime",
      "targetReadOnly": true
    },
    {
      "id": "processing-leadtime",
      "scope": "implementation",
      "type": "calculate",
      "trigger": ["ItemPreprocessingLeadTime", "ItemProcessingLeadTime", "ItemPostprocessingLeadTime"],
      "formula": "{ItemPreprocessingLeadTime} + {ItemProcessingLeadTime} + {ItemPostprocessingLeadTime}",
      "target": "ItemLeadTimeOffSet",
      "targetReadOnly": true
    },
    {
      "id": "warranty-balance",
      "scope": "implementation",
      "type": "calculate",
      "trigger": ["ItemWarrantyPeriod", "ItemComprehensiveMonths"],
      "formula": "{ItemWarrantyPeriod} - {ItemComprehensiveMonths}",
      "target": "ItemNonComprehensiveMonths",
      "targetReadOnly": true
    }
  ],

  "serverValidations": [],

  "api": {
    "save":   "Inventory.Item.Save",
    "update": "Inventory.Item.Save",
    "delete": "Inventory.Item.Delete",
    "get":    "Inventory.Item.Get"
  }
}
