{
  "pluginname": "Asset",
  "systemplugin": "0",
  "version": "1.0",
  "table_def": [
    {
      "name": "asset",
      "fields": [
        {
          "name": "assetnumber",
          "type": "varchar(40)",
          "other": "NOT NULL"
        },
        {
          "name": "assetname",
          "type": "varchar(20)",
          "other": "NOT NULL"
        },
        {
          "name": "product",
          "type": "varchar(20)",
          "other": "NOT NULL"
        },
        {
          "name": "purchasedate",
          "type": "date",
          "other": "NOT NULL"
        },
        {
          "name": "warranty",
          "type": "tinyint",
          "other": "NOT NULL"
        },
        {
          "name": "warrantyexpirydate",
          "type": "date"
        },
        {
          "name": "cost",
          "type": "int",
          "other": "NOT NULL"
        },
        {
          "name": "location",
          "type": "varchar(20)",
          "other": "NOT NULL"
        },
        {
          "name": "type",
          "type": "varchar(20)",
          "other": "NOT NULL"
        },
        {
          "name": "usedby",
          "type": "varchar(20)",
          "other": "NOT NULL"
        },
        {
          "name": "managedby",
          "type": "varchar(20)",
          "other": "NOT NULL"
        },
        {
          "name": "assetcondition",
          "type": "varchar(20)",
          "other": "NOT NULL"
        },
        {
          "name": "vendor",
          "type": "varchar(30)",
          "other": "NOT NULL"
        },
        {
          "name": "company",
          "type": "varchar(30)",
          "other": "NOT NULL"
        },
        {
          "name": "lastauditdate",
          "type": "date"
        }
      ]
    }
  ],
  "sqlcommands_oninstall": [],
  "form": {
    "name": "Asset",
    "formtype": "Default",
    "title": "Asset Entry Form",
    "icon": "mif-stack",
    "saveButton": "true",
    "cancelButton": "true",
	"savecustomid":"savast",
	"getrecordcustomid":"getast",
    "flex_row": "true",
    "flex_justify": "start",
    "field": [
      {
        "name": "assetnumber",
        "label": "Asset Number",
        "fieldtype": "s",
        "type": "text",
        "required": "Yes",
        "allownull": "0",
        "maxlength": "40",
        "jsonArrayBuild": "0"
      },
      {
        "name": "assetname",
        "label": "Asset Name",
        "fieldtype": "s",
        "type": "text",
        "required": "Yes",
        "allownull": "0",
        "maxlength": "20",
        "jsonArrayBuild": "0"
      },
      {
        "name": "purchasedate",
        "label": "Purchase Date",
        "fieldtype": "s",
        "type": "datepicker",
        "required": "Yes",
        "allownull": "0",
        "jsonArrayBuild": "0"
      },
      {
        "name": "warranty",
        "label": "Warranty",
        "fieldtype": "n",
        "type": "select",
        "option": "1:Yes,0:No",
        "required": "Yes",
        "allownull": "0",
        "jsonArrayBuild": "0"
      },
      {
        "name": "warrantyexpirydate",
        "label": "Warranty Expiry Date",
        "fieldtype": "d",
        "type": "text",
        "allownull": "1",
        "jsonArrayBuild": "0"
      },
      {
        "name": "cost",
        "label": "Cost",
        "fieldtype": "n",
        "type": "text",
        "required": "Yes",
        "allownull": "0",
        "jsonArrayBuild": "0"
      },
      {
        "name": "location",
        "label": "Location",
        "fieldtype": "s",
        "type": "select3",
        "option": "SELECT DISTINCT location FROM asset ORDER BY location",
        "required": "Yes",
        "allownull": "0",
        "maxlength": "20",
        "jsonArrayBuild": "0"
      },
      {
        "name": "type",
        "label": "Type",
        "fieldtype": "s",
        "type": "select3",
        "option": "SELECT DISTINCT type FROM asset ORDER BY type",
        "required": "Yes",
        "allownull": "0",
        "maxlength": "20",
        "jsonArrayBuild": "0"
      },
      {
        "name": "usedby",
        "label": "Used By",
        "fieldtype": "s",
        "type": "text",
        "required": "Yes",
        "allownull": "0",
        "maxlength": "20",
        "jsonArrayBuild": "0"
      },
      {
        "name": "managedby",
        "label": "Managed By",
        "fieldtype": "s",
        "type": "text",
        "required": "Yes",
        "allownull": "0",
        "maxlength": "20",
        "jsonArrayBuild": "0"
      },
      {
        "name": "assetcondition",
        "label": "Condition",
        "fieldtype": "s",
        "type": "select",
        "option": "Good,Need Maintanence,Out of Use",
        "required": "Yes",
        "allownull": "0",
        "maxlength": "20",
        "jsonArrayBuild": "0"
      },
      {
        "name": "product",
        "label": "Product",
        "fieldtype": "s",
        "type": "text",
        "required": "Yes",
        "allownull": "0",
        "maxlength": "20",
        "jsonArrayBuild": "0"
      },
      {
        "name": "vendor",
        "label": "Vendor",
        "fieldtype": "s",
        "type": "text",
        "required": "Yes",
        "allownull": "0",
        "maxlength": "30",
        "jsonArrayBuild": "0"
      },
      {
        "name": "lastauditdate",
        "label": "Last Audit Date",
        "fieldtype": "d",
        "type": "datepicker",
        "required": "No",
        "allownull": "1",
        "jsonArrayBuild": "0"
      },
      {
        "name": "company",
        "label": "Company",
        "fieldtype": "s",
        "type": "text",
        "required": "Yes",
        "allownull": "0",
        "maxlength": "30",
        "jsonArrayBuild": "0"
      }
    ]
  },
  "form_html": "",
  "navbutton": [
    {
      "customid": "ast",
      "caption": "Asset",
      "icon": "mif-stack",
      "btntype": "ribbon-button",
      "btnorder": "2",
      "onclick": "initializePlugin()"
    }
  ],
  "script": "",
  "formbuttons": [
    {
      "name": "addNewAsset",
      "icon": "mif-plus",
      "onclick": "showNewForm('asset')"
    },{
      "name": "AssetList",
	  "caption":"Asset List",
      "icon": "mif-stack",
      "onclick": "getTableFromSqlStatement('astlst')"
    }
  ],
  "sqlstatement": [
    {
      "customid": "getast",
      "name": "Get Asset",
	  "sql":{"action":"Get Row","validate":"users status>=1","outputto":"html","output":"edit","param":"ID","tbl":"asset","fld":"id,assetnumber,assetname,purchasedate,warranty,warrantyexpirydate,cost,location,type,usedby,managedby,assetcondition,product,vendor,lastauditdate,company","fldtype":"u,s,s,d,n,d,n,s,s,s,s,s,s,s,d,s","whr":"id='||ID||'"}
    },{
      "customid": "savast",
      "name": "Save Asset",
	  "sql":{"action":"Save Table","validate":"users status>=1","outputto":"html","output":"res","command":"insertorupdate","param":"ID,assetnumber,assetname,purchasedate,warranty,warrantyexpirydate,cost,location,type,usedby,managedby,assetcondition,product,vendor,lastauditdate,company","tbl":"asset","fld":"assetnumber,assetname,purchasedate,warranty,warrantyexpirydate,cost,location,type,usedby,managedby,assetcondition,product,vendor,lastauditdate,company","fldtype":"s,s,d,n,d,n,s,s,s,s,s,s,s,d,s","value":"||assetnumber||,||assetname||,||purchasedate||,||warranty||,||warrantyexpirydate||,||cost||,||location||,||type||,||usedby||,||managedby||,||assetcondition||,||product||,||vendor||,||lastauditdate||,||company||","whr":"id='||ID||'","successmsg":"Saving Successful","failuremsg":"Saving Failed"}
    },{
      "customid": "astlst",
      "name": "Asset List",
	  "sql":{"action":"Get Table","formname":"asset","validate":"users status>=1","outputto":"html","output":"table","tbl":"asset","fld":"assetnumber,assetname,purchasedate,cost,warrantyexpirydate,location,assetcondition,usedby,managedby,lastauditdate","button":[{"name":"Good","sqlid":"astlst","whr":"assetcondition='Good'"},{"name":"Need Maintanence","sqlid":"astlst","whr":"assetcondition='Need Maintanence'"},{"name":"Out of Use","sqlid":"astlst","whr":"assetcondition='Out of Use'"}]},
	  "header":"Asset No.,Asset name,Purchase Date,Cost,Warranty Expiry Date,Location,Asset Condition,Used By,Managed By,Last Audit Date",
	  "filter": "0",
      "edit_record": "1",
      "delete_record": "0",
      "restore_record": "0"
    }
  ]
}