{
  "Reports/Agreement": {
    "comment":"Agreement",
    "source_files_prefix":"Reports_Agreement",
    "layout": "report",
    "title": "Customer Agreement",
  //:if:client_portal:
    "actions": "B",
  //:else:
    "actions": "",
  //:endif:
    //"roles": { "client": {"CSYSADMIN":"*","CADMIN":"*"} },
    "menu":"reports",
    "description": "Generate Signed Customer Agreement",
    "template": "Agreement.ejs",
    "fields": [
      {"name":"cust_id","type":"bigint","datalock":{"cust_id":"cust_cust_id"},"nl":1,
          "control":"dropdown_L","actions": "B",
          "lov": { "sql": "agreement_code_cust_id", "datalock":{"cust_id":"cust_id"}, "blank": 1 },
          "validate": [ "Required" ],
          "default": "js:XExt.UndefinedBlank(_GET['cust_id'])",
          "caption":"Company Name"},
      {"name": "a_name","type": "varchar","length": 72,"nl": 1,
        "control": "textbox","actions": "B",
        "validate": [ "Required" ],
        "caption": "Signed By"
      },
      {"name":"a_dob","type":"date","nl": 1,
      "control":"date_mmddyy","actions":"B",
      "validate": [ "Required" ],
      "caption":"Date of Birth","controlstyle":"width:80px;","captionstyle":"width:80px;"},
      {"nl": 1,"control":"button","value":"Run Report","controlstyle": "padding:3px 8px;",
        "onclick": "jsh.XPage.RunReport();"},
      {"control":"button","value":"Test Job Queue","controlstyle": "padding:3px 8px;",
        "onclick": "jsh.XPage.TestQueue();"},
      {"control":"button","value":"Email to Cust","controlstyle": "padding:3px 8px;",
        "onclick": "jsh.XPage.RunQueue();"}
    ],
    "reportdata" : {
      "cms_agreement": { "sql": "select txt_body \"txt_body\" from {schema}.txt__tbl where txt_process='CMS' and txt_attrib='Client/Agreement'", "nodatalock": ["cust_id"] },
      "C":{
        "sql":"select cust_id \"cust_id\" from cust where cust_id=@cust_id %%%DATALOCKS%%%",
        "children":{
          "NTYPE":{
            "bindings":{"cust_id":"cust_id"},
            "sql":"select distinct note__tbl.cust_id \"cust_id\",note_type \"note_type\" from {schema}.note__tbl inner join cust on cust.cust_id=note__tbl.cust_id where note__tbl.cust_id=@cust_id %%%DATALOCKS%%%",
            "children":{
              "Note__model":{
              "bindings":{"cust_id":"cust_id","note_type": "note_type"},
              "sql":"agreement_report_note"
              }
            }
          }
        }
      }
    },
    "jobqueue": {
      "sql": "select 'CLIENT' as job_source,'C' as doc_scope,cust_id as doc_scope_id,'agreement_doc_scope' as doc_ctgr,'Customer Agreement' as doc_desc,cust_id from cust where cust_id=@cust_id %%%DATALOCKS%%%"
        //'C' as note_scope, cust_id as note_scope_id, 'S' as note_type, 'Test Note' note_body
        //'test@test.com' as email_to,null as email_cc,null as email_bcc,'RCVD' as email_txt_attrib,1 as email_attach
        //'+12223334444' as sms_to, 'Client/Welcome' as sms_txt_attrib
    }
  }
}