Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleCreditMemo.bjs
1 {
2     "id": "roo-file-4",
3     "name": "Pman.Dialog.XtupleCreditMemo",
4     "parent": "",
5     "title": "",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleCreditMemo.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "|show": "function () {\n       this.layout.getRegion('center').showPanel(0);\n}"
11             },
12             ".builderCfg": "{\"cols\":[{\"table\":\"cohead\",\"column\":\"cohead_number\",\"columnshort\":\"cohead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Order#\"},{\"table\":\"cohead\",\"column\":\"cohead_cust_id\",\"columnshort\":\"cohead_cust_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"cust_id\",\"deps\":[{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_active\",\"columnshort\":\"cust_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_custtype_id\",\"columnshort\":\"cust_custtype_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_salesrep_id\",\"columnshort\":\"cust_salesrep_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_commprcnt\",\"columnshort\":\"cust_commprcnt\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_creditlmt\",\"columnshort\":\"cust_creditlmt\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_creditrating\",\"columnshort\":\"cust_creditrating\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_financecharge\",\"columnshort\":\"cust_financecharge\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_backorder\",\"columnshort\":\"cust_backorder\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_partialship\",\"columnshort\":\"cust_partialship\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_terms_id\",\"columnshort\":\"cust_terms_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_discntprcnt\",\"columnshort\":\"cust_discntprcnt\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_balmethod\",\"columnshort\":\"cust_balmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_ffshipto\",\"columnshort\":\"cust_ffshipto\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_shipform_id\",\"columnshort\":\"cust_shipform_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_shipvia\",\"columnshort\":\"cust_shipvia\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_blanketpos\",\"columnshort\":\"cust_blanketpos\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_shipchrg_id\",\"columnshort\":\"cust_shipchrg_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_creditstatus\",\"columnshort\":\"cust_creditstatus\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_comments\",\"columnshort\":\"cust_comments\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_ffbillto\",\"columnshort\":\"cust_ffbillto\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_usespos\",\"columnshort\":\"cust_usespos\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_number\",\"columnshort\":\"cust_number\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_dateadded\",\"columnshort\":\"cust_dateadded\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_exported\",\"columnshort\":\"cust_exported\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_emaildelivery\",\"columnshort\":\"cust_emaildelivery\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_ediemail\",\"columnshort\":\"cust_ediemail\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_edisubject\",\"columnshort\":\"cust_edisubject\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_edifilename\",\"columnshort\":\"cust_edifilename\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_ediemailbody\",\"columnshort\":\"cust_ediemailbody\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_autoupdatestatus\",\"columnshort\":\"cust_autoupdatestatus\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_autoholdorders\",\"columnshort\":\"cust_autoholdorders\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_edicc\",\"columnshort\":\"cust_edicc\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_ediprofile_id\",\"columnshort\":\"cust_ediprofile_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_preferred_warehous_id\",\"columnshort\":\"cust_preferred_warehous_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_curr_id\",\"columnshort\":\"cust_curr_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_creditlmt_curr_id\",\"columnshort\":\"cust_creditlmt_curr_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_cntct_id\",\"columnshort\":\"cust_cntct_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_corrcntct_id\",\"columnshort\":\"cust_corrcntct_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_soemaildelivery\",\"columnshort\":\"cust_soemaildelivery\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_soediemail\",\"columnshort\":\"cust_soediemail\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_soedisubject\",\"columnshort\":\"cust_soedisubject\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_soedifilename\",\"columnshort\":\"cust_soedifilename\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_soediemailbody\",\"columnshort\":\"cust_soediemailbody\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_soedicc\",\"columnshort\":\"cust_soedicc\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_soediprofile_id\",\"columnshort\":\"cust_soediprofile_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_gracedays\",\"columnshort\":\"cust_gracedays\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_ediemailhtml\",\"columnshort\":\"cust_ediemailhtml\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_soediemailhtml\",\"columnshort\":\"cust_soediemailhtml\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_taxzone_id\",\"columnshort\":\"cust_taxzone_id\",\"ctype\":\"int4\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Customer\",\"display\":\"cohead_cust_id_cust_name\"},{\"table\":\"cohead\",\"column\":\"cohead_custponumber\",\"columnshort\":\"cohead_custponumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer PO#\"},{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"},{\"table\":\"cohead\",\"column\":\"cohead_warehous_id\",\"columnshort\":\"cohead_warehous_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"warehous_id\",\"deps\":[{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_code\",\"columnshort\":\"warehous_code\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_descrip\",\"columnshort\":\"warehous_descrip\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_fob\",\"columnshort\":\"warehous_fob\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_active\",\"columnshort\":\"warehous_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_counttag_prefix\",\"columnshort\":\"warehous_counttag_prefix\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_counttag_number\",\"columnshort\":\"warehous_counttag_number\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_bol_prefix\",\"columnshort\":\"warehous_bol_prefix\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_bol_number\",\"columnshort\":\"warehous_bol_number\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_shipping\",\"columnshort\":\"warehous_shipping\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_useslips\",\"columnshort\":\"warehous_useslips\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_usezones\",\"columnshort\":\"warehous_usezones\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_aislesize\",\"columnshort\":\"warehous_aislesize\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_aislealpha\",\"columnshort\":\"warehous_aislealpha\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_racksize\",\"columnshort\":\"warehous_racksize\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_rackalpha\",\"columnshort\":\"warehous_rackalpha\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_binsize\",\"columnshort\":\"warehous_binsize\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_binalpha\",\"columnshort\":\"warehous_binalpha\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_locationsize\",\"columnshort\":\"warehous_locationsize\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_locationalpha\",\"columnshort\":\"warehous_locationalpha\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_enforcearbl\",\"columnshort\":\"warehous_enforcearbl\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_default_accnt_id\",\"columnshort\":\"warehous_default_accnt_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_shipping_commission\",\"columnshort\":\"warehous_shipping_commission\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_cntct_id\",\"columnshort\":\"warehous_cntct_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_addr_id\",\"columnshort\":\"warehous_addr_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_transit\",\"columnshort\":\"warehous_transit\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_shipform_id\",\"columnshort\":\"warehous_shipform_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_shipvia_id\",\"columnshort\":\"warehous_shipvia_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_shipcomments\",\"columnshort\":\"warehous_shipcomments\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_costcat_id\",\"columnshort\":\"warehous_costcat_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_sitetype_id\",\"columnshort\":\"warehous_sitetype_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_taxzone_id\",\"columnshort\":\"warehous_taxzone_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"whsinfo\",\"column\":\"cohead_warehous_id_warehous_sequence\",\"columnshort\":\"warehous_sequence\",\"ctype\":\"int4\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Warehouse\",\"display\":\"cohead_warehous_id_warehous_descrip\"},{\"table\":\"cohead\",\"column\":\"cohead_shipto_id\",\"columnshort\":\"cohead_shipto_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"shipto_id\",\"deps\":[{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_cust_id\",\"columnshort\":\"shipto_cust_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_name\",\"columnshort\":\"shipto_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_salesrep_id\",\"columnshort\":\"shipto_salesrep_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_comments\",\"columnshort\":\"shipto_comments\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_shipcomments\",\"columnshort\":\"shipto_shipcomments\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_shipzone_id\",\"columnshort\":\"shipto_shipzone_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_shipvia\",\"columnshort\":\"shipto_shipvia\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_commission\",\"columnshort\":\"shipto_commission\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_shipform_id\",\"columnshort\":\"shipto_shipform_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_shipchrg_id\",\"columnshort\":\"shipto_shipchrg_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_active\",\"columnshort\":\"shipto_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_default\",\"columnshort\":\"shipto_default\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_num\",\"columnshort\":\"shipto_num\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_ediprofile_id\",\"columnshort\":\"shipto_ediprofile_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_cntct_id\",\"columnshort\":\"shipto_cntct_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_addr_id\",\"columnshort\":\"shipto_addr_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_taxzone_id\",\"columnshort\":\"shipto_taxzone_id\",\"ctype\":\"int4\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to\",\"display\":\"cohead_shipto_id_shipto_name\"},{\"table\":\"cohead\",\"column\":\"cohead_shiptoname\",\"columnshort\":\"cohead_shiptoname\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to name\"},{\"table\":\"cohead\",\"column\":\"cohead_shiptoaddress1\",\"columnshort\":\"cohead_shiptoaddress1\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to address\"},{\"table\":\"cohead\",\"column\":\"cohead_shiptoaddress2\",\"columnshort\":\"cohead_shiptoaddress2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to address(2)\"},{\"table\":\"cohead\",\"column\":\"cohead_shiptoaddress3\",\"columnshort\":\"cohead_shiptoaddress3\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to address(3)\"},{\"table\":\"cohead\",\"column\":\"cohead_shiptoaddress4\",\"columnshort\":\"cohead_shiptoaddress4\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to address(4)\"},{\"table\":\"cohead\",\"column\":\"cohead_shiptoaddress5\",\"columnshort\":\"cohead_shiptoaddress5\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to address(5)\"},{\"table\":\"cohead\",\"column\":\"cohead_salesrep_id\",\"columnshort\":\"cohead_salesrep_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"salesrep_id\",\"deps\":[{\"table\":\"salesrep\",\"column\":\"cohead_salesrep_id_salesrep_active\",\"columnshort\":\"salesrep_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cohead_salesrep_id_salesrep_number\",\"columnshort\":\"salesrep_number\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cohead_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cohead_salesrep_id_salesrep_commission\",\"columnshort\":\"salesrep_commission\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cohead_salesrep_id_salesrep_method\",\"columnshort\":\"salesrep_method\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cohead_salesrep_id_salesrep_emp_id\",\"columnshort\":\"salesrep_emp_id\",\"ctype\":\"int4\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Staff I.C.\",\"display\":\"cohead_salesrep_id_salesrep_name\"},{\"table\":\"cohead\",\"column\":\"cohead_terms_id\",\"columnshort\":\"cohead_terms_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"terms_id\",\"deps\":[{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_code\",\"columnshort\":\"terms_code\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_type\",\"columnshort\":\"terms_type\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_duedays\",\"columnshort\":\"terms_duedays\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_discdays\",\"columnshort\":\"terms_discdays\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_discprcnt\",\"columnshort\":\"terms_discprcnt\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_cutoffday\",\"columnshort\":\"terms_cutoffday\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_ap\",\"columnshort\":\"terms_ap\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_ar\",\"columnshort\":\"terms_ar\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\",\"display\":\"cohead_terms_id_terms_descrip\"},{\"table\":\"cohead\",\"column\":\"cohead_ordercomments\",\"columnshort\":\"cohead_ordercomments\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Order Comments\"},{\"table\":\"cohead\",\"column\":\"cohead_shipcomments\",\"columnshort\":\"cohead_shipcomments\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Shipment Comments\"},{\"table\":\"cohead\",\"column\":\"cohead_curr_id\",\"columnshort\":\"cohead_curr_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"curr_id\",\"deps\":[{\"table\":\"curr_symbol\",\"column\":\"cohead_curr_id_curr_base\",\"columnshort\":\"curr_base\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cohead_curr_id_curr_name\",\"columnshort\":\"curr_name\",\"ctype\":\"varchar\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cohead_curr_id_curr_symbol\",\"columnshort\":\"curr_symbol\",\"ctype\":\"varchar\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cohead_curr_id_curr_abbr\",\"columnshort\":\"curr_abbr\",\"ctype\":\"varchar\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Currency\",\"display\":\"cohead_curr_id_curr_symbol\"},{\"table\":\"cohead\",\"column\":\"cohead_shipto_cntct_id\",\"columnshort\":\"cohead_shipto_cntct_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"cntct_id\",\"deps\":[{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_crmacct_id\",\"columnshort\":\"cntct_crmacct_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_addr_id\",\"columnshort\":\"cntct_addr_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_first_name\",\"columnshort\":\"cntct_first_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_last_name\",\"columnshort\":\"cntct_last_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_honorific\",\"columnshort\":\"cntct_honorific\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_initials\",\"columnshort\":\"cntct_initials\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_active\",\"columnshort\":\"cntct_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_fax\",\"columnshort\":\"cntct_fax\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_email\",\"columnshort\":\"cntct_email\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_webaddr\",\"columnshort\":\"cntct_webaddr\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_notes\",\"columnshort\":\"cntct_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_title\",\"columnshort\":\"cntct_title\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_number\",\"columnshort\":\"cntct_number\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_middle\",\"columnshort\":\"cntct_middle\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_suffix\",\"columnshort\":\"cntct_suffix\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_owner_username\",\"columnshort\":\"cntct_owner_username\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_shipto_cntct_id_cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to Contact\",\"display\":\"cohead_shipto_cntct_id_cntct_name\"},{\"table\":\"cohead\",\"column\":\"cohead_billto_cntct_id\",\"columnshort\":\"cohead_billto_cntct_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"cntct_id\",\"deps\":[{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_crmacct_id\",\"columnshort\":\"cntct_crmacct_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_addr_id\",\"columnshort\":\"cntct_addr_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_first_name\",\"columnshort\":\"cntct_first_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_last_name\",\"columnshort\":\"cntct_last_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_honorific\",\"columnshort\":\"cntct_honorific\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_initials\",\"columnshort\":\"cntct_initials\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_active\",\"columnshort\":\"cntct_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_fax\",\"columnshort\":\"cntct_fax\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_email\",\"columnshort\":\"cntct_email\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_webaddr\",\"columnshort\":\"cntct_webaddr\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_notes\",\"columnshort\":\"cntct_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_title\",\"columnshort\":\"cntct_title\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_number\",\"columnshort\":\"cntct_number\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_middle\",\"columnshort\":\"cntct_middle\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_suffix\",\"columnshort\":\"cntct_suffix\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_owner_username\",\"columnshort\":\"cntct_owner_username\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cohead_billto_cntct_id_cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Bill To (name)\",\"display\":\"cohead_billto_cntct_id_cntct_name\"},{\"table\":\"cohead\",\"column\":\"cohead_taxzone_id\",\"columnshort\":\"cohead_taxzone_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"taxzone_id\",\"deps\":[{\"table\":\"taxzone\",\"column\":\"cohead_taxzone_id_taxzone_code\",\"columnshort\":\"taxzone_code\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"taxzone\",\"column\":\"cohead_taxzone_id_taxzone_descrip\",\"columnshort\":\"taxzone_descrip\",\"ctype\":\"text\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Tax Zone\",\"display\":\"cohead_taxzone_id_taxzone_descrip\"},{\"table\":\"cohead\",\"column\":\"cohead_taxtype_id\",\"columnshort\":\"cohead_taxtype_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"taxtype_id\",\"deps\":[{\"table\":\"taxtype\",\"column\":\"cohead_taxtype_id_taxtype_name\",\"columnshort\":\"taxtype_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"taxtype\",\"column\":\"cohead_taxtype_id_taxtype_descrip\",\"columnshort\":\"taxtype_descrip\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"taxtype\",\"column\":\"cohead_taxtype_id_taxtype_sys\",\"columnshort\":\"taxtype_sys\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Tax Type\",\"display\":\"cohead_taxtype_id_taxtype_descrip\"}],\"cols_ex\":[\"cohead_cust_id_cust_name\",\"cohead_warehous_id_warehous_descrip\",\"cohead_shipto_id_shipto_name\",\"cohead_salesrep_id_salesrep_name\",\"cohead_terms_id_terms_descrip\",\"cohead_curr_id_curr_symbol\",\"cohead_shipto_cntct_id_cntct_name\",\"cohead_billto_cntct_id_cntct_name\",\"cohead_taxzone_id_taxzone_descrip\",\"cohead_taxtype_id_taxtype_descrip\"],\"table\":\"cohead\",\"xtype\":\"LayoutDialog\",\"|xns\":\"Roo\"}",
13             "closable": true,
14             "collapsible": false,
15             "height": 450,
16             "modal": true,
17             "resizable": true,
18             "title": "Edit / Create Credit Memo",
19             "width": 950,
20             "xtype": "LayoutDialog",
21             "|xns": "Roo",
22             "items": [
23                 {
24                     "|xns": "Roo",
25                     "xtype": "LayoutRegion",
26                     "*prop": "center",
27                     "alwaysShowTabs": true,
28                     "tabPosition": "top"
29                 },
30                 {
31                     "listeners": {
32                         "activate": "function (_self)\n{\n    // we need to reload to find out the subtotal.\n    if (!_this.data || !_this.data.cmhead_id) {\n        return;\n    }\n    \n    new Pman.Request({\n        method : 'GET',\n        url : baseURL + '/Roo/cmhead',\n        params : { \n            _id : _this.data.cmhead_id\n        },\n        success : function(res) {\n            // update the items and tax values...?\n\n            _this.form.findField('cmhead_taxfree_value').setValue(res.data.cmhead_taxfree_value);\n            _this.form.findField('cmhead_tax_value').setValue(res.data.cmhead_tax_value * 1);            \n            _this.form.findField('cmhead_taxable_value').setValue(res.data.cmhead_taxable_value * 1);  \n            _this.form.findField('cmhead_misc_per').update();\n            _this.form.findField('cmhead_total').recalc();\n        \n        }\n    });\n}"
33                     },
34                     "region": "center",
35                     "title": "Credit Details",
36                     "xtype": "ContentPanel",
37                     "|xns": "Roo",
38                     "items": [
39                         {
40                             "listeners": {
41                                 "|actioncomplete": "function(_self,action)\n{\n    if (action.type == 'setdata') {\n        _this.saveBtn.show();\n        \n        if (_this.data.cmhead_id) {\n           this.load({ method: 'GET', params: { '_id' : _this.data.cmhead_id }});\n           \n           return;\n        }\n        _this.dialog.setTitle(\"Add New Credit Memo\");\n       \n        _this.form.findField('cmhead_docdate').setValue(new Date());\n        \n       return;\n    }\n    if (action.type == 'load') {\n         \n        _this.data = action.result.data;\n        \n        if(_this.data.cmhead_posted){\n            _this.saveBtn.hide();\n        }\n        _this.dataloading = true;\n        if (_this.data.cmhead_shipto_cntct_id == _this.data.cmhead_billto_cntct_id) {\n            this.findField('_shipto_same').setValue(1);\n                      Roo.log('set shipto 1');\n        } else {\n//          this.findField('_shipto_same').setValue(0);\n                      Roo.log('set shipto 0');\n          }\n        _this.dataloading = false;          \n        \n        \n        this.findField('billto_address').update();\n//        this.findField('shipto_address').update();        \n        _this.dialog.setTitle(\"Edit Credit Memo Order - \" + this.findField('cmhead_number').getValue());\n        \n      _this.form.findField('cmhead_misc_per').update();\n        _this.form.findField('cmhead_total').recalc();\n        return;\n    }\n    if (action.type =='submit') {\n    \n\n        var id = _this.form.findField('cmhead_id').getValue() * 1;\n        if (id < 1) {\n\n            _this.data.cmhead_id = action.result.data.cmhead_id;\n             this.load({ method: 'GET', params: { '_id' : _this.data.cmhead_id }});\n            return;\n        }\n    \n        _this.dialog.hide();\n        \n         if (_this.callback) {\n            _this.callback.call(_this, _this.form.getValues());\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
42                                 "|rendered": "function (form)\n{\n    _this.form= form;\n}\n",
43                                 "actionfailed": "function (_self, action)\n{\n    if (action.failureType == 'client') {\n        Roo.MessageBox.alert(\"Error\", \"Fill in all the required fields\");\n    }\n    if (action.failureType == 'server') {    \n        Roo.log(action);\n        Roo.MessageBox.alert(\"Error\", action.result.errorMsg);\n    }\n    _this.dialog.layout.getRegion('center').showPanel(0);\n}"
44                             },
45                             "method": "POST",
46                             "style": "margin:10px;",
47                             "xtype": "Form",
48                             "|url": "baseURL + '/Roo/cmhead.php'",
49                             "|xns": "Roo.form",
50                             "items": [
51                                 {
52                                     "xtype": "Column",
53                                     "|xns": "Roo.form",
54                                     "width": "435",
55                                     "items": [
56                                         {
57                                             "labelWidth": 120,
58                                             "legend": "Credit",
59                                             "style": "width:420px",
60                                             "xtype": "FieldSet",
61                                             "|xns": "Roo.form",
62                                             "items": [
63                                                 {
64                                                     "labelWidth": 100,
65                                                     "width": 410,
66                                                     "xtype": "Column",
67                                                     "|xns": "Roo.form",
68                                                     "items": [
69                                                         {
70                                                             "allowBlank": true,
71                                                             "emptyText": "Automatic",
72                                                             "fieldLabel": "Ref #",
73                                                             "name": "cmhead_number",
74                                                             "readOnly": true,
75                                                             "width": 150,
76                                                             "xtype": "TextField",
77                                                             "|xns": "Roo.form"
78                                                         },
79                                                         {
80                                                             "editable": false,
81                                                             "fieldLabel": "Customer",
82                                                             "name": "cmhead_cust_id_cust_name",
83                                                             "readOnly": true,
84                                                             "width": 300,
85                                                             "xtype": "TextField",
86                                                             "|xns": "Roo.form"
87                                                         },
88                                                         {
89                                                             "allowBlank": false,
90                                                             "displayField": "location_name",
91                                                             "editable": true,
92                                                             "emptyText": "select location",
93                                                             "fieldLabel": "Return stock to",
94                                                             "forceSelection": true,
95                                                             "hiddenName": "cmhead_location_id",
96                                                             "listWidth": 400,
97                                                             "loadingText": "Searching...",
98                                                             "minChars": 2,
99                                                             "name": "cmhead_location_id_location_name",
100                                                             "pageSize": 200,
101                                                             "qtip": "Select terms",
102                                                             "queryParam": "query[location_name]",
103                                                             "selectOnFocus": true,
104                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> {location_descrip}</div>",
105                                                             "triggerAction": "all",
106                                                             "typeAhead": true,
107                                                             "valueField": "location_id",
108                                                             "width": 300,
109                                                             "xtype": "ComboBox",
110                                                             "|xns": "Roo.form",
111                                                             "items": [
112                                                                 {
113                                                                     "listeners": {
114                                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n     o.params.location_netable = 1;\n     o.params._notinternalcompany = 1;\n     o.params.location_restrict = 0;\n}\n"
115                                                                     },
116                                                                     "*prop": "store",
117                                                                     "remoteSort": true,
118                                                                     "xtype": "Store",
119                                                                     "|sortInfo": "{ direction : 'ASC', field: 'location_name' }",
120                                                                     "|xns": "Roo.data",
121                                                                     "items": [
122                                                                         {
123                                                                             "*prop": "proxy",
124                                                                             "method": "GET",
125                                                                             "xtype": "HttpProxy",
126                                                                             "|url": "baseURL + '/Roo/location.php'",
127                                                                             "|xns": "Roo.data"
128                                                                         },
129                                                                         {
130                                                                             "*prop": "reader",
131                                                                             "id": "location_id",
132                                                                             "root": "data",
133                                                                             "totalProperty": "total",
134                                                                             "xtype": "JsonReader",
135                                                                             "|fields": "[{'name':'location_id','type':'int'},'location_name']",
136                                                                             "|xns": "Roo.data"
137                                                                         }
138                                                                     ]
139                                                                 }
140                                                             ]
141                                                         },
142                                                         {
143                                                             "allowBlank": false,
144                                                             "fieldLabel": "Date",
145                                                             "format": "Y-m-d",
146                                                             "name": "cmhead_docdate",
147                                                             "width": 100,
148                                                             "xtype": "DateField",
149                                                             "|xns": "Roo.form"
150                                                         },
151                                                         {
152                                                             "displayField": "salesrep_name",
153                                                             "editable": false,
154                                                             "emptyText": "Select salesrep",
155                                                             "fieldLabel": "Staff I.C.",
156                                                             "forceSelection": true,
157                                                             "hiddenName": "cmhead_salesrep_id",
158                                                             "listWidth": 400,
159                                                             "loadingText": "Searching...",
160                                                             "minChars": 2,
161                                                             "name": "cmhead_salesrep_id_salesrep_name",
162                                                             "pageSize": 20,
163                                                             "qtip": "Select salesrep",
164                                                             "queryParam": "query[salesrep_name]",
165                                                             "selectOnFocus": true,
166                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>",
167                                                             "triggerAction": "all",
168                                                             "typeAhead": true,
169                                                             "valueField": "salesrep_id",
170                                                             "width": 300,
171                                                             "xtype": "ComboBox",
172                                                             "|xns": "Roo.form",
173                                                             "items": [
174                                                                 {
175                                                                     "listeners": {
176                                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
177                                                                     },
178                                                                     "*prop": "store",
179                                                                     "remoteSort": true,
180                                                                     "xtype": "Store",
181                                                                     "|sortInfo": "{ direction : 'ASC', field: 'salesrep_name' }",
182                                                                     "|xns": "Roo.data",
183                                                                     "items": [
184                                                                         {
185                                                                             "*prop": "proxy",
186                                                                             "xtype": "HttpProxy",
187                                                                             "method": "GET",
188                                                                             "|xns": "Roo.data",
189                                                                             "|url": "baseURL + '/Roo/salesrep.php'"
190                                                                         },
191                                                                         {
192                                                                             "*prop": "reader",
193                                                                             "id": "salesrep_id",
194                                                                             "root": "data",
195                                                                             "totalProperty": "total",
196                                                                             "xtype": "JsonReader",
197                                                                             "|fields": "[{'name':'salesrep_id','type':'int'},'salesrep_name']",
198                                                                             "|xns": "Roo.data"
199                                                                         }
200                                                                     ]
201                                                                 }
202                                                             ]
203                                                         },
204                                                         {
205                                                             "fieldLabel": "Comments",
206                                                             "height": 80,
207                                                             "name": "cmhead_comments",
208                                                             "width": 300,
209                                                             "xtype": "TextArea",
210                                                             "|xns": "Roo.form"
211                                                         }
212                                                     ]
213                                                 }
214                                             ]
215                                         }
216                                     ]
217                                 },
218                                 {
219                                     "style": "margin-left:10px",
220                                     "width": 450,
221                                     "xtype": "Column",
222                                     "|xns": "Roo.form",
223                                     "items": [
224                                         {
225                                             "xtype": "FieldSet",
226                                             "|xns": "Roo.form",
227                                             "legend": "Price Details",
228                                             "style": "width:420px",
229                                             "labelWidth": "50",
230                                             "items": [
231                                                 {
232                                                     "labelAlign": "right",
233                                                     "labelWidth": 300,
234                                                     "width": 420,
235                                                     "xtype": "Column",
236                                                     "|xns": "Roo.form",
237                                                     "items": [
238                                                         {
239                                                             "labelAlign": "right",
240                                                             "labelWidth": 300,
241                                                             "width": 500,
242                                                             "xtype": "Row",
243                                                             "|xns": "Roo.form",
244                                                             "items": [
245                                                                 {
246                                                                     "allowDecimals": true,
247                                                                     "cls": "roo-align-right",
248                                                                     "decimalPrecision": 3,
249                                                                     "fieldLabel": "Taxable Value",
250                                                                     "name": "cmhead_taxable_value",
251                                                                     "readOnly": true,
252                                                                     "width": 100,
253                                                                     "xtype": "NumberField",
254                                                                     "|xns": "Roo.form"
255                                                                 },
256                                                                 {
257                                                                     "allowDecimals": true,
258                                                                     "cls": "roo-align-right",
259                                                                     "decimalPrecision": 3,
260                                                                     "fieldLabel": "Tax Free Value",
261                                                                     "name": "cmhead_taxfree_value",
262                                                                     "readOnly": true,
263                                                                     "width": 100,
264                                                                     "xtype": "NumberField",
265                                                                     "|xns": "Roo.form"
266                                                                 }
267                                                             ]
268                                                         },
269                                                         {
270                                                             "labelAlign": "top",
271                                                             "labelSeparator": "&nbsp;",
272                                                             "width": 500,
273                                                             "xtype": "Row",
274                                                             "|xns": "Roo.form",
275                                                             "items": [
276                                                                 {
277                                                                     "allowBlank": false,
278                                                                     "displayField": "curr_name",
279                                                                     "editable": false,
280                                                                     "emptyText": "Select Currency",
281                                                                     "fieldLabel": "Currency",
282                                                                     "forceSelection": true,
283                                                                     "hiddenName": "cmhead_curr_id",
284                                                                     "listWidth": 400,
285                                                                     "loadingText": "Searching...",
286                                                                     "minChars": 2,
287                                                                     "name": "cmhead_curr_id_curr_name",
288                                                                     "pageSize": 20,
289                                                                     "qtip": "Select Currency",
290                                                                     "queryParam": "query[curr_name]",
291                                                                     "selectOnFocus": true,
292                                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>",
293                                                                     "triggerAction": "all",
294                                                                     "typeAhead": true,
295                                                                     "valueField": "curr_id",
296                                                                     "width": 285,
297                                                                     "xtype": "ComboBox",
298                                                                     "|xns": "Roo.form",
299                                                                     "items": [
300                                                                         {
301                                                                             "listeners": {
302                                                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n   \n}\n"
303                                                                             },
304                                                                             "*prop": "store",
305                                                                             "remoteSort": true,
306                                                                             "xtype": "Store",
307                                                                             "|sortInfo": "{ direction : 'ASC', field: 'curr_symbol' }",
308                                                                             "|xns": "Roo.data",
309                                                                             "items": [
310                                                                                 {
311                                                                                     "*prop": "proxy",
312                                                                                     "xtype": "HttpProxy",
313                                                                                     "method": "GET",
314                                                                                     "|xns": "Roo.data",
315                                                                                     "|url": "baseURL + '/Roo/curr_symbol.php'"
316                                                                                 },
317                                                                                 {
318                                                                                     "*prop": "reader",
319                                                                                     "id": "curr_id",
320                                                                                     "root": "data",
321                                                                                     "totalProperty": "total",
322                                                                                     "xtype": "JsonReader",
323                                                                                     "|fields": "[{'name':'curr_id','type':'int'},'curr_symbol']",
324                                                                                     "|xns": "Roo.data"
325                                                                                 }
326                                                                             ]
327                                                                         }
328                                                                     ]
329                                                                 },
330                                                                 {
331                                                                     "listeners": {
332                                                                         "keyup": "function (_self, e)\n{\n    _this.form.findField('cmhead_total').recalc();\n}"
333                                                                     },
334                                                                     "allowDecimals": true,
335                                                                     "cls": "roo-align-right",
336                                                                     "decimalPrecision": 3,
337                                                                     "fieldLabel": "Freight",
338                                                                     "name": "cmhead_freight",
339                                                                     "width": 100,
340                                                                     "xtype": "NumberField",
341                                                                     "|xns": "Roo.form"
342                                                                 }
343                                                             ]
344                                                         },
345                                                         {
346                                                             "labelAlign": "top",
347                                                             "labelSeparator": "&nbsp;",
348                                                             "width": 500,
349                                                             "xtype": "Row",
350                                                             "|xns": "Roo.form",
351                                                             "items": [
352                                                                 {
353                                                                     "fieldLabel": "Discount Description",
354                                                                     "name": "cmhead_misc_descrip",
355                                                                     "width": 230,
356                                                                     "xtype": "TextField",
357                                                                     "|xns": "Roo.form"
358                                                                 },
359                                                                 {
360                                                                     "listeners": {
361                                                                         "keyup": "function (_self, e)\n{\n    var m = _this.form.findField('cmhead_misc');\n    var pv =  _this.form.findField('cmhead_value').getValue();\n    var n = this.getValue();\n    var discount = parseInt(n * pv * 0.01);\n    m.setValue(discount * -1.000);\n     \n    \n    _this.form.findField('cmhead_total').recalc();\n    var val = discount * -1.0;\n     if (val > 0) {\n        _this.form.findField('cohead_misc_descrip').setValue(\"Discount of \" + val.toFixed(1)+'%');\n    }\n}"
362                                                                     },
363                                                                     "allowDecimals": true,
364                                                                     "cls": "roo-align-right",
365                                                                     "decimalPrecision": 1,
366                                                                     "fieldLabel": "%",
367                                                                     "name": "cmhead_misc_per",
368                                                                     "width": 35,
369                                                                     "xtype": "NumberField",
370                                                                     "|update": "function() {\n    var m = _this.form.findField('cmhead_misc_per');\n    var pv =  parseFloat(_this.form.findField('cmhead_taxfree_value').getValue()) + \n            parseFloat(_this.form.findField('cmhead_taxable_value').getValue()) ;\n    var discount = parseFloat(_this.form.findField('cmhead_misc').getValue());\n    \n    if (discount > 0.0) {\n        this.setValue(0);        \n        return;\n    }\n    if (pv < 0) {\n        this.setValue(0);        \n        return;\n    }\n    var val = ((discount) / pv) * -100;\n    \n    //Roo.log(\"update discount?\" + val);\n    this.setValue(val.toFixed(1));\n    \n     if (val > 0.0) {\n        _this.form.findField('cmhead_misc_descrip').setValue(\"Discount of \" + val.toFixed(1)+'%');\n    \n    }\n    \n   \n}\n",
371                                                                     "|xns": "Roo.form"
372                                                                 },
373                                                                 {
374                                                                     "listeners": {
375                                                                         "keyup": "function (_self, e)\n{\n   _this.form.findField('cmhead_misc_per').update();\n    _this.form.findField('cmhead_total').recalc();\n}"
376                                                                     },
377                                                                     "allowDecimals": true,
378                                                                     "cls": "roo-align-right",
379                                                                     "decimalPrecision": 3,
380                                                                     "fieldLabel": "&nbsp;",
381                                                                     "name": "cmhead_misc",
382                                                                     "width": 100,
383                                                                     "xtype": "NumberField",
384                                                                     "|xns": "Roo.form"
385                                                                 }
386                                                             ]
387                                                         },
388                                                         {
389                                                             "labelAlign": "top",
390                                                             "labelSeparator": "&nbsp;",
391                                                             "width": 500,
392                                                             "xtype": "Row",
393                                                             "|xns": "Roo.form",
394                                                             "items": [
395                                                                 {
396                                                                     "listeners": {
397                                                                         "select": "function (combo, record, index)\n{\n    _this.form.findField('cmhead_tax_value').setValue(\n        record.data.taxzone_rate * _this.form.findField('cmhead_taxable_value').getValue()\n    );\n}"
398                                                                     },
399                                                                     "allowBlank": false,
400                                                                     "displayField": "taxzone_descrip",
401                                                                     "editable": false,
402                                                                     "emptyText": "Select tax zone",
403                                                                     "fieldLabel": "Tax Zone",
404                                                                     "forceSelection": true,
405                                                                     "hiddenName": "cmhead_taxzone_id",
406                                                                     "listWidth": 400,
407                                                                     "loadingText": "Searching...",
408                                                                     "minChars": 2,
409                                                                     "name": "cmhead_taxzone_id_taxzone_descrip",
410                                                                     "pageSize": 20,
411                                                                     "qtip": "Select tax zone",
412                                                                     "queryParam": "query[taxzone_descrip]",
413                                                                     "selectOnFocus": true,
414                                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{taxzone_descrip}</b> </div>",
415                                                                     "triggerAction": "all",
416                                                                     "typeAhead": true,
417                                                                     "valueField": "taxzone_id",
418                                                                     "width": 285,
419                                                                     "xtype": "ComboBox",
420                                                                     "|xns": "Roo.form",
421                                                                     "items": [
422                                                                         {
423                                                                             "listeners": {
424                                                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    \n    o.params.with_date = _this.form.findField('cmhead_docdate').getValue().format('Y-m-d');\n    Roo.log(\"with date?\" + o.params.with_date);\n    \n    \n}\n"
425                                                                             },
426                                                                             "*prop": "store",
427                                                                             "remoteSort": true,
428                                                                             "xtype": "Store",
429                                                                             "|sortInfo": "{ direction : 'ASC', field: 'taxzone_descrip' }",
430                                                                             "|xns": "Roo.data",
431                                                                             "items": [
432                                                                                 {
433                                                                                     "*prop": "proxy",
434                                                                                     "method": "GET",
435                                                                                     "xtype": "HttpProxy",
436                                                                                     "|url": "baseURL + '/Roo/taxzone.php'",
437                                                                                     "|xns": "Roo.data"
438                                                                                 },
439                                                                                 {
440                                                                                     "*prop": "reader",
441                                                                                     "id": "taxzone_id",
442                                                                                     "root": "data",
443                                                                                     "totalProperty": "total",
444                                                                                     "xtype": "JsonReader",
445                                                                                     "|fields": "[{'name':'taxzone_id','type':'int'},'taxzone_descrip']",
446                                                                                     "|xns": "Roo.data"
447                                                                                 }
448                                                                             ]
449                                                                         }
450                                                                     ]
451                                                                 },
452                                                                 {
453                                                                     "allowDecimals": true,
454                                                                     "cls": "roo-align-right",
455                                                                     "decimalPrecision": 3,
456                                                                     "fieldLabel": "Tax",
457                                                                     "name": "cmhead_tax_value",
458                                                                     "readOnly": true,
459                                                                     "width": 100,
460                                                                     "xtype": "NumberField",
461                                                                     "|xns": "Roo.form"
462                                                                 }
463                                                             ]
464                                                         },
465                                                         {
466                                                             "labelAlign": "right",
467                                                             "labelWidth": 300,
468                                                             "width": 500,
469                                                             "xtype": "Row",
470                                                             "|xns": "Roo.form",
471                                                             "items": [
472                                                                 {
473                                                                     "allowDecimals": true,
474                                                                     "cls": "roo-align-right",
475                                                                     "decimalPrecision": 3,
476                                                                     "fieldLabel": "Total",
477                                                                     "name": "cmhead_total",
478                                                                     "readOnly": true,
479                                                                     "width": 100,
480                                                                     "xtype": "NumberField",
481                                                                     "|recalc": "function() {\n    var vals = _this.form.getValues();\n    this.setValue(\n        (1*vals.cmhead_taxable_value) + \n        (1*vals.cmhead_taxfree_value) + \n        (1*vals.cmhead_freight) + \n        (1*vals.cmhead_tax_value) + \n        (1*vals.cmhead_misc)\n    );\n}\n",
482                                                                     "|xns": "Roo.form"
483                                                                 }
484                                                             ]
485                                                         }
486                                                     ]
487                                                 }
488                                             ]
489                                         },
490                                         {
491                                             "legend": "Billing",
492                                             "style": "width:420px",
493                                             "xtype": "FieldSet",
494                                             "|xns": "Roo.form",
495                                             "items": [
496                                                 {
497                                                     "xtype": "Column",
498                                                     "|xns": "Roo.form",
499                                                     "width": "420",
500                                                     "labelWidth": "50",
501                                                     "items": [
502                                                         {
503                                                             "listeners": {
504                                                                 "beforeselect": "function (combo, record, index)\n{\n    // set _this.data values ..\n    \n    // just add everything...\n    for(var i in record.data) {\n      //  Roo.log('cmhead_billto_cntct_id_' + i +' ='  + record.data[i]);\n        _this.data['cmhead_billto_cntct_id_' + i] = record.data[i];\n    }\n\n    _this.form.findField('billto_address').update();\n    \n \n}",
505                                                                 "add": "function (combo)\n{\n  \n  Pman.Dialog.XtupleQuickContact.show( \n            {\n              _id : id,\n              customer_id : _this.form.findField('cmhead_cust_id').getValue()\n            },\n            \n            function (data) {\n               \n                for(var i in  data) {\n                    \n                    _this.data['cmhead_billto_cntct_id_' + i] =  data[i];\n                }\n                \n                _this.form.findField('billto_address').update();\n                // fill in the select box..\n                _this.form.setValues( {\n                    cmhead_billto_cntct_id : data.cntct_id,\n                    cmhead_billto_cntct_id_cntct_name : data.cntct_first_name + ' '+ \n                            data.cntct_last_name\n                    \n                });\n            }\n        );\n        //  Pman.Dialog.XtupleCustomer.show(\n            //{ cust_id : _this.form.findField('cohead_cust_id').getValue() }, \n            //function(data) {\n        // refresh the data in the pulldown..\n    //    }); \n\n}"
506                                                             },
507                                                             "allowBlank": false,
508                                                             "alwaysQuery": true,
509                                                             "displayField": "cntct_name",
510                                                             "editable": true,
511                                                             "emptyText": "Select Contact",
512                                                             "fieldLabel": "Bill To (select)",
513                                                             "forceSelection": true,
514                                                             "hiddenName": "cmhead_billto_cntct_id",
515                                                             "listWidth": 400,
516                                                             "loadingText": "Searching...",
517                                                             "minChars": 2,
518                                                             "name": "cmhead_billto_cntct_id_cntct_name",
519                                                             "pageSize": 20,
520                                                             "qtip": "Select Contact",
521                                                             "queryParam": "query[cntct_name]",
522                                                             "selectOnFocus": true,
523                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cntct_name}</b> {cntct_addr_id_addr_line1}</div>",
524                                                             "triggerAction": "all",
525                                                             "typeAhead": true,
526                                                             "valueField": "cntct_id",
527                                                             "width": 300,
528                                                             "xtype": "ComboBox",
529                                                             "|xns": "Roo.form",
530                                                             "items": [
531                                                                 {
532                                                                     "listeners": {
533                                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params._customer_id = _this.data.cmhead_cust_id;\n}\n"
534                                                                     },
535                                                                     "*prop": "store",
536                                                                     "remoteSort": true,
537                                                                     "xtype": "Store",
538                                                                     "|sortInfo": "{ direction : 'ASC', field: 'cntct_name' }",
539                                                                     "|xns": "Roo.data",
540                                                                     "items": [
541                                                                         {
542                                                                             "*prop": "proxy",
543                                                                             "xtype": "HttpProxy",
544                                                                             "method": "GET",
545                                                                             "|xns": "Roo.data",
546                                                                             "|url": "baseURL + '/Roo/cntct.php'"
547                                                                         },
548                                                                         {
549                                                                             "*prop": "reader",
550                                                                             "id": "cntct_id",
551                                                                             "root": "data",
552                                                                             "totalProperty": "total",
553                                                                             "xtype": "JsonReader",
554                                                                             "|fields": "[{'name':'cntct_id','type':'int'},'cntct_name']",
555                                                                             "|xns": "Roo.data"
556                                                                         }
557                                                                     ]
558                                                                 }
559                                                             ]
560                                                         },
561                                                         {
562                                                             "listeners": {
563                                                                 "render": "function (_self)\n{\n   Roo.log(this.el)\n   \n   \n   \n   this.el.on('click', function() { \n       var id = _this.form.findField('cmhead_billto_cntct_id').getValue();\n        Pman.Dialog.XtupleQuickContact.show( \n            {\n              _id : id,\n              customer_id : _this.form.findField('cmhead_cust_id').getValue()\n            },\n            \n            function (data) {\n            \n                for(var i in  data) {\n                    \n                    _this.data['cmhead_billto_cntct_id_' + i] =  data[i];\n                }\n                \n                _this.form.findField('billto_address').update();\n                // fill in the select box..\n                _this.form.setValues( {\n                    cmhead_billto_cntct_id : data.cntct_id,\n                    cmhead_billto_cntct_id_cntct_name : data.cntct_first_name + ' '+ \n                            data.cntct_last_name\n                });\n            }\n        );\n     });\n}"
564                                                             },
565                                                             "fieldLabel": "or enter Address",
566                                                             "name": "billto_address",
567                                                             "readOnly": true,
568                                                             "xtype": "TextArea",
569                                                             "|update": "function() {\n\n    var c = ['first_name', 'last_name' ] ;\n    var a = [ 'line1', 'line2', 'line3', 'city', 'state', 'country' ];\n    var v = [];\n    Roo.each(c, function(e) {\n        if (_this.data['cmhead_billto_cntct_id_cntct_' +e] &&\n            _this.data['cmhead_billto_cntct_id_cntct_' +e].length) {\n            v.push(_this.data['cmhead_billto_cntct_id_cntct_' +e]);\n        }\n    });\n    Roo.each(a, function(e) {\n        if (_this.data['cmhead_billto_cntct_id_cntct_addr_id_addr_' +e] &&\n            _this.data['cmhead_billto_cntct_id_cntct_addr_id_addr_' +e].length) {\n            v.push(_this.data['cmhead_billto_cntct_id_cntct_addr_id_addr_' +e]);\n        }\n    });\n    this.setValue(v.join(\"\\n\"));\n}\n",
570                                                             "|xns": "Roo.form"
571                                                         }
572                                                     ]
573                                                 }
574                                             ]
575                                         }
576                                     ]
577                                 },
578                                 {
579                                     "name": "cmhead_id",
580                                     "xtype": "Hidden",
581                                     "|xns": "Roo.form"
582                                 },
583                                 {
584                                     "name": "cmhead_billto_addr_id",
585                                     "xtype": "Hidden",
586                                     "|xns": "Roo.form"
587                                 },
588                                 {
589                                     "name": "cmhead_posted",
590                                     "xtype": "Hidden",
591                                     "|xns": "Roo.form"
592                                 },
593                                 {
594                                     "name": "cmhead_cust_id",
595                                     "xtype": "Hidden",
596                                     "|xns": "Roo.form"
597                                 },
598                                 {
599                                     "name": "taxzone_rate",
600                                     "xtype": "Hidden",
601                                     "|xns": "Roo.form"
602                                 },
603                                 {
604                                     "name": "has_item",
605                                     "xtype": "Hidden",
606                                     "|xns": "Roo.form"
607                                 }
608                             ]
609                         }
610                     ]
611                 },
612                 {
613                     "listeners": {
614                         "deactivate": "function (_self)\n{\n    if(_this.grid){\n        _this.grid.stopEditing();\n    }\n}",
615                         "activate": "function (_self)\n{\n\n    _this.panel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('cmhead_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the order first, before adding items\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    if (_this.grid) {\n        _this.grid.ds.load({});\n    }\n\n}"
616                     },
617                     "background": true,
618                     "fitContainer": true,
619                     "fitToframe": true,
620                     "region": "center",
621                     "tableName": "coitem",
622                     "title": "Credit Items",
623                     "xtype": "GridPanel",
624                     "|xns": "Roo",
625                     "items": [
626                         {
627                             "listeners": {
628                                 "|render": "function() \n{\n    _this.grid = this; \n    _this.hasQuery = 0;\n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.ds.load({});\n    }\n}",
629                                 "afteredit": "function (e)\n{\n    //Roo.log('afteredit');\n    //Roo.log(e);\n    \n    if (e.field == 'item_number' || e.originalValue == e.value) {\n        // afterselect handles this...\n        return;\n    }\n    var r = e.record;\n    \n    if ( r && r.data.cmitem_id) {\n        // as we disable update to the display on the ajax callback to \n        // allow editing flow to continue, and not refresh - we can only update\n        // these values after something has actually been edited.\n         r.set('coitem_id', r.data.cmitem_id);\n    }\n    \n    var rate = 0;\n    if(r.data.cmitem_taxtype_id_taxtype_name == 'Taxable' ){\n        rate = _this.form.findField('taxzone_rate').getValue();\n    }\n    if(e.field == 'cmitem_tax_unitprice'){\n        r.set('cmitem_unitprice', r.data.cmitem_tax_unitprice * 1 / (1 + rate * 1));\n//        fields.push('cmitem_unitprice');\n    }\n    if(e.field == 'cmitem_unitprice'){\n        r.set('cmitem_tax_unitprice', r.data.cmitem_unitprice * (1 + rate * 1) );\n//        fields.push('cmitem_tax_unitprice');\n    }\n    if(e.field == 'cmitem_taxtype_id'){\n        r.set('cmitem_tax_unitprice', r.data.cmitem_unitprice * (1 + rate * 1) );\n//        fields.push('cmitem_tax_unitprice');\n                \n    }\n    r.set('cmitem_tax_listprice', r.data.cmitem_item_listprice * (1 + rate * 1) );\n//    fields.push('cmitem_tax_listprice');\n    r.set('cmitem_line_value', r.data.cmitem_qtycredit * r.data.cmitem_unitprice );\n//    fields.push('cmitem_line_value');\n    r.set('cmitem_line_tax_value', r.data.cmitem_qtycredit * r.data.cmitem_tax_unitprice );\n//    fields.push('cmitem_line_tax_value'); \n    \n//    fields.push('cmitem_id');\n    \n    _this.hasQuery += 1;\n    \n     var doupdate = function() { \n       if (!_this.itemsUpdating) {\n            Roo.log('doupdate...');\n            \n            _this.hasQuery -= 1;\n            r.commit();\n            return;\n        }\n        doupdate.defer(1000);\n    }\n    \n    doupdate();\n    \n    \n}",
630                                 "beforeedit": "function (e)\n{\n    // we can only edit if nothing is assigned to shipping or invoices..\n    if (_this.form.findField('cmhead_posted').getValue() == 'true') {\n        Roo.MessageBox.alert(\"Error\", \"credit memo is already posted\");\n        e.cancel = true;\n        return;\n    }\n    \n    return;\n    \n    // seems below logic is useless...!!!!\n    var rec = e.record;\n\n    if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0) {\n        Roo.MessageBox.alert(\"Error\", \"That item has been shipped or invoices - void the shipments/invoices first\");\n        e.cancel = true;\n        return;\n    }\n    \n    if (rec.data.coitem_subnumber * 1 > 0) {\n        Roo.log(\"Edit container event\");\n        Roo.log(e); // if it's a tab.. \n\n        \n        switch(e.field) {\n            // allow editing of source / destination..\n            case 'coitem_shipto_id':\n            case 'coitem_location_src':            \n                return;\n            default : \n                break;\n        }\n        Roo.MessageBox.alert(\"Error\", \"That is a kit item, edit the container.\");\n        e.cancel = true;\n        return;\n    }\n    // zero off values..\n    //if (e.field == 'coitem_qtyord' && rec.data.coitem_qtyord == 0) {\n    //        e.value ='';\n    //    }\n    //    if (e.field == 'coitem_custprice' && rec.data.coitem_qtyord == 0.0) {\n    //        e.value ='';\n    //    }\n    \n    if (rec.data.item_type == 'K' && e.field == 'item_number') {\n        // you can not change the product type on kits' as it messing things up..\n        Roo.MessageBox.alert(\"Error\", \"That is a kit item,if you need to change it, delete it first.\");\n        e.cancel = true;\n        return;\n    }\n    \n}",
631                                 "celldblclick": "function (_self, rowIndex, columnIndex, e)\n{\n    var rec = this.ds.getAt(rowIndex);\n    var di = this.cm.getDataIndex(columnIndex);\n    if (di != 'avail_qty') {\n        return;\n    }\n    Pman.Dialog.XtupleInvHistory.show({\n        itemsite_item_id_item_number   : rec.data.item_number,\n       // itemsite_item_id_item_descript1 : rec.data.item_descrip1,\n        location_name : rec.data.coitem_location_src_location_name,\n        location_descrip : rec.data.coitem_location_src_location_descrip,\n        \n        invhist_transdate : _this.form.findField('cohead_targetdate').getValue() \n    }); \n    \n}",
632                                 "rowclass": "function (gridview, rowcfg)\n{\n    if (rowcfg.record.data.coitem_status == 'C' &&\n        rowcfg.record.data.shipitem_shipped * 1 < 1) {\n        \n        rowcfg.rowClass = 'strikethrough';\n    }\n     if (rowcfg.record.data.coitem_status == 'X'  ) {\n        \n        rowcfg.rowClass = 'strikethrough';\n    }\n   // Roo.log(rowcfg);\n//    shipitem_shipped\n}"
633                             },
634                             "*prop": "grid",
635                             "autoExpandColumn": "cmitem_comments",
636                             "clicksToEdit": 1,
637                             "loadMask": true,
638                             "xtype": "EditorGrid",
639                             "|loadAvail": "function() {\n    \n    return; //not used.\n       \n     var q = [];\n    this.ds.each(  function(r) {\n    \n        // only update if we do not have the details.\n        if (r.data.avail_qty == 0) {\n        \n        }\n        q.push( { \n            item : r.data.item_number, \n            loc: r.data.coitem_location_src_location_name,\n            id: r.data.coitem_linenumber + (r.data.coitem_subnumber ? ('.' + r.data.coitem_subnumber) : '')\n         } );\n    });\n    \n    // needs to be a post to allow long lists of products..\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/itemloc',\n        method : 'POST',\n        mask : \"Loading available qty\",\n        maskel : _this.grid.view.el,\n        params : {\n            _availqty : Roo.encode(q),\n            curr_id : _this.form.findField('cohead_curr_id').getValue()\n        },\n        success : function(d) \n        {\n            _this.grid.ds.each(function(r) { \n                 var id = r.data.coitem_linenumber + (r.data.coitem_subnumber ? ('.' + r.data.coitem_subnumber) : '');\n            \n            \n                if (typeof(d.data[id]) == 'undefined') {\n                    return;\n                }\n                r.set('avail_qty', d.data[id].qty);\n                if (r.data.coitem_unitcost_in_order_cur * 1.0 < 0.1) {\n                    r.set('coitem_unitcost_in_order_cur', d.data[id].unitcost);\n                }\n            \n            });\n        \n        }\n    });\n    \n        \n                \n}\n",
640                             "|xns": "Roo.grid",
641                             "items": [
642                                 {
643                                     "listeners": {
644                                         "tabend": "function (_self)\n{\n    _this.addItemBtn.fireEvent('click', _this.addItemBtn);\n}",
645                                         "beforeeditnext": "function (eventdata)\n{\n    return;\n    // this does not work, as the reload effect cancels editng.\n    var rec = _this.grid.ds.getAt(eventdata.cell[0]);\n    if (rec.data.coitem_subnumber *1 < 0 ) {\n        return;\n    }\n    var r = eventdata.cell[0] + 1;\n\n    while (true) {\n        if (r > _this.grid.ds.getCount()-1 ) {\n            eventdata.cell = false;\n            return;\n        }\n        rec =  _this.grid.ds.getAt(r);\n        if (rec.data.coitem_subnumber *1 < 0 ) {\n           eventdata.cell = [ r, eventdata.cell[1] ];\n           return;\n        }\n        r++;\n    }\n    \n    \n \n\n}"
646                                     },
647                                     "*prop": "sm",
648                                     "enter_is_tab": true,
649                                     "xtype": "CellSelectionModel",
650                                     "|xns": "Roo.grid"
651                                 },
652                                 {
653                                     "listeners": {
654                                         "|beforeload": "function (_self,o) {\n\n    try {\n       this.removeAll();\n   } catch (e) { }\n   \n    Roo.log(_this.data);\n    if (!_this.data || !_this.data.cmhead_id) {\n        return false;\n    }\n    o.params = o.params || {};\n    Roo.log(_this.data);\n    o.params.cmitem_cmhead_id = _this.data.cmhead_id;\n    o.params.limit = 999;\n    \n}",
655                                         "update": "function (_self, rec, operation)\n{\n   \n   if (operation !=  Roo.data.Record.COMMIT) {\n       return;\n   }\n   \n   // row has been updated..\n   // if the qty + item has been filled in, we should try and save it..\n    if (!(rec.data.cmitem_itemsite_id * 1) || !(rec.data.cmitem_qtycredit*1) || !(rec.data.cmitem_unitprice*1)) {\n        Roo.log('not saving - row not completed');\n        return;\n    }\n\n    if (_this.itemsUpdating) {\n        Roo.log('currently updating?');\n        return;\n    }\n    _this.itemsUpdating = true;\n\n\n    Roo.log('Running update');   \n    \n    new Pman.Request({\n        url : baseURL+'/Roo/Cmitem',\n        method : 'POST',\n        \n        params : rec.data,\n        success: function(res)\n        {\n            Roo.log('GOT success');\n            // update the data...\n            if (rec.data.item_type == 'K') {\n                 _this.itemsUpdating = false; \n                _this.grid.ds.load({});\n                return;\n            }\n            if (_this.grid.activeEditor) {\n                 rec.editing = true;\n             } \n            rec.set('cmitem_id', res.data.cmitem_id);\n            \n            _this.itemsUpdating = false; \n            \n            if(_this.hasQuery != 0){\n                 \n                return;\n            }\n            \n            rec.dirty = false;\n            delete rec.modified;\n            \n            _this.grid.loadAvail();\n            \n        },\n        failure : function(res)\n        {\n            Roo.MessageBox.alert(res.message);\n            _this.itemsUpdating = false;\n        }\n        \n        \n    });\n    \n    \n   \n   \n   \n}",
656                                         "load": "function (_self, records, options)\n{\n    // need to fetch availablity from master data..\n    // build a list of what to ask..\n    Roo.log(records);\n    // query: ITEM CODE - LOCATION\n    \n    //_this.grid.loadAvail.defer(100, _this.grid);\n    var rate = 0;\n        \n    Roo.each(records, function(r){\n        rate = 0;\n        if(r.data.cmitem_taxtype_id == r.data.cmitem_taxable_id ){\n            rate = _this.form.findField('taxzone_rate').getValue();\n        }\n        r.set('cmitem_tax_unitprice', r.data.cmitem_unitprice * (1 + rate * 1));\n        r.set('cmitem_tax_listprice', r.data.cmitem_item_listprice * (1 + rate * 1));\n        r.set('cmitem_line_tax_value', r.data.cmitem_line_value * (1 + rate * 1));\n    })    \n    \n}"
657                                     },
658                                     "*prop": "dataSource",
659                                     ".builderCfg": "{\"cols\":[{\"table\":\"coitem\",\"column\":\"coitem_linenumber\",\"columnshort\":\"coitem_linenumber\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Item#\"},{\"table\":\"coitem\",\"column\":\"coitem_itemsite_id\",\"columnshort\":\"coitem_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"itemsite_id\",\"deps\":[{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_item_id\",\"columnshort\":\"itemsite_item_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warehous_id\",\"columnshort\":\"itemsite_warehous_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_qtyonhand\",\"columnshort\":\"itemsite_qtyonhand\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_reorderlevel\",\"columnshort\":\"itemsite_reorderlevel\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordertoqty\",\"columnshort\":\"itemsite_ordertoqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cyclecountfreq\",\"columnshort\":\"itemsite_cyclecountfreq\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastcount\",\"columnshort\":\"itemsite_datelastcount\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastused\",\"columnshort\":\"itemsite_datelastused\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_loccntrl\",\"columnshort\":\"itemsite_loccntrl\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_safetystock\",\"columnshort\":\"itemsite_safetystock\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_minordqty\",\"columnshort\":\"itemsite_minordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_multordqty\",\"columnshort\":\"itemsite_multordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_leadtime\",\"columnshort\":\"itemsite_leadtime\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_abcclass\",\"columnshort\":\"itemsite_abcclass\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_issuemethod\",\"columnshort\":\"itemsite_issuemethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_controlmethod\",\"columnshort\":\"itemsite_controlmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_active\",\"columnshort\":\"itemsite_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_plancode_id\",\"columnshort\":\"itemsite_plancode_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costcat_id\",\"columnshort\":\"itemsite_costcat_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_eventfence\",\"columnshort\":\"itemsite_eventfence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_sold\",\"columnshort\":\"itemsite_sold\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_stocked\",\"columnshort\":\"itemsite_stocked\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_freeze\",\"columnshort\":\"itemsite_freeze\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_id\",\"columnshort\":\"itemsite_location_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparams\",\"columnshort\":\"itemsite_useparams\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparamsmanual\",\"columnshort\":\"itemsite_useparamsmanual\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_soldranking\",\"columnshort\":\"itemsite_soldranking\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createpr\",\"columnshort\":\"itemsite_createpr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location\",\"columnshort\":\"itemsite_location\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_comments\",\"columnshort\":\"itemsite_location_comments\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_notes\",\"columnshort\":\"itemsite_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_perishable\",\"columnshort\":\"itemsite_perishable\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_nnqoh\",\"columnshort\":\"itemsite_nnqoh\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoabcclass\",\"columnshort\":\"itemsite_autoabcclass\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup\",\"columnshort\":\"itemsite_ordergroup\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_disallowblankwip\",\"columnshort\":\"itemsite_disallowblankwip\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_maxordqty\",\"columnshort\":\"itemsite_maxordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_mps_timefence\",\"columnshort\":\"itemsite_mps_timefence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createwo\",\"columnshort\":\"itemsite_createwo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warrpurc\",\"columnshort\":\"itemsite_warrpurc\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoreg\",\"columnshort\":\"itemsite_autoreg\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costmethod\",\"columnshort\":\"itemsite_costmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_value\",\"columnshort\":\"itemsite_value\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup_first\",\"columnshort\":\"itemsite_ordergroup_first\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_supply_itemsite_id\",\"columnshort\":\"itemsite_supply_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_planning_type\",\"columnshort\":\"itemsite_planning_type\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_wosupply\",\"columnshort\":\"itemsite_wosupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_posupply\",\"columnshort\":\"itemsite_posupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_lsseq_id\",\"columnshort\":\"itemsite_lsseq_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cosdefault\",\"columnshort\":\"itemsite_cosdefault\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopr\",\"columnshort\":\"itemsite_createsopr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopo\",\"columnshort\":\"itemsite_createsopo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_dropship\",\"columnshort\":\"itemsite_dropship\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyord\",\"columnshort\":\"coitem_qtyord\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Qty\"},{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"},{\"table\":\"coitem\",\"column\":\"coitem_price\",\"columnshort\":\"coitem_price\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Price\"},{\"table\":\"coitem\",\"column\":\"coitem_custprice\",\"columnshort\":\"coitem_custprice\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust Price\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyreturned\",\"columnshort\":\"coitem_qtyreturned\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#Returned\"},{\"table\":\"coitem\",\"column\":\"coitem_prcost\",\"columnshort\":\"coitem_prcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"prcost?\"},{\"table\":\"coitem\",\"column\":\"coitem_price_uom_id\",\"columnshort\":\"coitem_price_uom_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"uom_id\",\"deps\":[{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_name\",\"columnshort\":\"uom_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_descrip\",\"columnshort\":\"uom_descrip\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_item_weight\",\"columnshort\":\"uom_item_weight\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Unit of\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}],\"cols_ex\":[\"coitem_price_uom_id_uom_descrip\"],\"table\":\"coitem\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
660                                     "remoteSort": true,
661                                     "xtype": "Store",
662                                     "|sortInfo": "{ field : 'cmitem_linenumber', direction: 'ASC' }",
663                                     "|xns": "Roo.data",
664                                     "items": [
665                                         {
666                                             "*prop": "proxy",
667                                             "method": "GET",
668                                             "xtype": "HttpProxy",
669                                             "|url": "baseURL + '/Roo/Cmitem.php'",
670                                             "|xns": "Roo.data"
671                                         },
672                                         {
673                                             "|xns": "Roo.data",
674                                             "xtype": "JsonReader",
675                                             "totalProperty": "total",
676                                             "root": "data",
677                                             ".builderCfg": "{\"cols\":[{\"table\":\"coitem\",\"column\":\"coitem_linenumber\",\"columnshort\":\"coitem_linenumber\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Item#\"},{\"table\":\"coitem\",\"column\":\"coitem_itemsite_id\",\"columnshort\":\"coitem_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"itemsite_id\",\"deps\":[{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_item_id\",\"columnshort\":\"itemsite_item_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warehous_id\",\"columnshort\":\"itemsite_warehous_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_qtyonhand\",\"columnshort\":\"itemsite_qtyonhand\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_reorderlevel\",\"columnshort\":\"itemsite_reorderlevel\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordertoqty\",\"columnshort\":\"itemsite_ordertoqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cyclecountfreq\",\"columnshort\":\"itemsite_cyclecountfreq\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastcount\",\"columnshort\":\"itemsite_datelastcount\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastused\",\"columnshort\":\"itemsite_datelastused\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_loccntrl\",\"columnshort\":\"itemsite_loccntrl\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_safetystock\",\"columnshort\":\"itemsite_safetystock\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_minordqty\",\"columnshort\":\"itemsite_minordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_multordqty\",\"columnshort\":\"itemsite_multordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_leadtime\",\"columnshort\":\"itemsite_leadtime\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_abcclass\",\"columnshort\":\"itemsite_abcclass\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_issuemethod\",\"columnshort\":\"itemsite_issuemethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_controlmethod\",\"columnshort\":\"itemsite_controlmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_active\",\"columnshort\":\"itemsite_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_plancode_id\",\"columnshort\":\"itemsite_plancode_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costcat_id\",\"columnshort\":\"itemsite_costcat_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_eventfence\",\"columnshort\":\"itemsite_eventfence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_sold\",\"columnshort\":\"itemsite_sold\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_stocked\",\"columnshort\":\"itemsite_stocked\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_freeze\",\"columnshort\":\"itemsite_freeze\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_id\",\"columnshort\":\"itemsite_location_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparams\",\"columnshort\":\"itemsite_useparams\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparamsmanual\",\"columnshort\":\"itemsite_useparamsmanual\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_soldranking\",\"columnshort\":\"itemsite_soldranking\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createpr\",\"columnshort\":\"itemsite_createpr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location\",\"columnshort\":\"itemsite_location\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_comments\",\"columnshort\":\"itemsite_location_comments\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_notes\",\"columnshort\":\"itemsite_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_perishable\",\"columnshort\":\"itemsite_perishable\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_nnqoh\",\"columnshort\":\"itemsite_nnqoh\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoabcclass\",\"columnshort\":\"itemsite_autoabcclass\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup\",\"columnshort\":\"itemsite_ordergroup\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_disallowblankwip\",\"columnshort\":\"itemsite_disallowblankwip\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_maxordqty\",\"columnshort\":\"itemsite_maxordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_mps_timefence\",\"columnshort\":\"itemsite_mps_timefence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createwo\",\"columnshort\":\"itemsite_createwo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warrpurc\",\"columnshort\":\"itemsite_warrpurc\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoreg\",\"columnshort\":\"itemsite_autoreg\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costmethod\",\"columnshort\":\"itemsite_costmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_value\",\"columnshort\":\"itemsite_value\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup_first\",\"columnshort\":\"itemsite_ordergroup_first\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_supply_itemsite_id\",\"columnshort\":\"itemsite_supply_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_planning_type\",\"columnshort\":\"itemsite_planning_type\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_wosupply\",\"columnshort\":\"itemsite_wosupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_posupply\",\"columnshort\":\"itemsite_posupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_lsseq_id\",\"columnshort\":\"itemsite_lsseq_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cosdefault\",\"columnshort\":\"itemsite_cosdefault\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopr\",\"columnshort\":\"itemsite_createsopr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopo\",\"columnshort\":\"itemsite_createsopo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_dropship\",\"columnshort\":\"itemsite_dropship\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyord\",\"columnshort\":\"coitem_qtyord\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Qty\"},{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"},{\"table\":\"coitem\",\"column\":\"coitem_price\",\"columnshort\":\"coitem_price\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Price\"},{\"table\":\"coitem\",\"column\":\"coitem_custprice\",\"columnshort\":\"coitem_custprice\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust Price\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyreturned\",\"columnshort\":\"coitem_qtyreturned\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#Returned\"},{\"table\":\"coitem\",\"column\":\"coitem_prcost\",\"columnshort\":\"coitem_prcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"prcost?\"},{\"table\":\"coitem\",\"column\":\"coitem_price_uom_id\",\"columnshort\":\"coitem_price_uom_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"uom_id\",\"deps\":[{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_name\",\"columnshort\":\"uom_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_descrip\",\"columnshort\":\"uom_descrip\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_item_weight\",\"columnshort\":\"uom_item_weight\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Unit of\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}],\"cols_ex\":[\"coitem_price_uom_id_uom_descrip\"],\"table\":\"coitem\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
678                                             "*prop": "reader",
679                                             "id": "id",
680                                             "|fields": "[\n    {\n        'name': 'coitem_linenumber',\n        'type': 'int'\n    },\n    {\n        'name': 'coitem_itemsite_id',\n        'type': 'int'\n    },\n    {\n        'name': 'coitem_qtyord'\n    },\n    {\n        'name': 'coitem_unitcost'\n    },\n    {\n        'name': 'coitem_price'\n    },\n    {\n        'name': 'coitem_custprice'\n    },\n    {\n        'name': 'coitem_qtyreturned'\n    },\n    {\n        'name': 'coitem_prcost'\n    },\n    {\n        'name': 'coitem_price_uom_id',\n        'type': 'int'\n    },\n    {\n        'name': 'coitem_qtyreserved'\n    }\n]"
681                                         }
682                                     ]
683                                 },
684                                 {
685                                     "*prop": "toolbar",
686                                     "xtype": "Toolbar",
687                                     "|xns": "Roo",
688                                     "items": [
689                                         {
690                                             "listeners": {
691                                                 "|click": "function()\n{\n    \n    \n    if (_this.form.findField('cmhead_posted').getValue() == 'true') {\n        Roo.MessageBox.alert(\"Error\", \"credit memo is already posted\");\n        return;\n    }\n    // work out last \n       // work out last \n                var grid = _this.grid;\n                var last = 0;\n                \n                _this.grid.ds.each(function(r) {\n                    last = r.data.cmitem_linenumber;\n                });\n                \n                last++;\n                grid.stopEditing();\n                var nr = _this.grid.ds.reader.newRow({\n                    cmitem_linenumber : last,\n                    item_number : '',\n                    item_descrip1 : '',\n                    cmitem_cmhead_id : _this.form.findField('cmhead_id').getValue(),\n                    cmitem_comments : '',\n                    cmitem_taxtype_id : _this.data.default_taxtype_id,\n                    cmitem_taxtype_id_taxtype_name : 'Taxable'\n                });\n                grid.stopEditing();\n                grid.ds.insert(grid.ds.getCount(), nr); \n                grid.startEditing(grid.ds.getCount()-1, 1); // type..\n}\n",
692                                                 "render": "function (_self)\n{\n    _this.addItemBtn = _self;\n}"
693                                             },
694                                             "cls": "x-btn-text-icon",
695                                             "text": "Add",
696                                             "xtype": "Button",
697                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
698                                             "|xns": "Roo.Toolbar"
699                                         },
700                                         {
701                                             "listeners": {
702                                                 "click": "function (_self, e)\n{\n    \n    var last = 1;    \n    _this.grid.ds.each(function(r) {\n        last = r.data.cmitem_linenumber +1;\n\n    \n    });\n    \n    var grid = _this.grid;\n    var ct  =    _this.grid.ds.getCount();\r\n    var lastrow = ct ?  _this.grid.ds.getAt(ct-1)  : false;\r\n         \r\n    var cmhead_cust_id = _this.form.findField('cmhead_cust_id').getValue();\n    var cmhead_id = _this.form.findField('cmhead_id').getValue();\n    \n    Pman.Dialog.XtupleSalesProductList.show( {cohead_cust_id : cmhead_cust_id, cmhead_id : cmhead_id} , function(res) {\n    \n        Roo.log(res);\n        grid.stopEditing();\n\n        if (lastrow) {\n            var lr = lastrow;\n            if (!lr.data.cmitem_itemsite_id) {\n                lr.set('cmitem_itemsite_id', res.item_itemsite_id_itemsite_id);\n                lr.set('item_number',  res.item_number);\n                lr.set('item_descrip1', res.item_descrip1);                                \n                lr.set('cmitem_comments', res.item_descrip1);\n                lr.set('cmitem_cmhead_id', _this.form.findField('cmhead_id').getValue());\n                return;\n            }\n        }\n        var rate = _this.form.findField('taxzone_rate').getValue();\r\n         var nr = grid.ds.reader.newRow({\n                    cmitem_linenumber : last,\n                    cmitem_itemsite_id : res.item_itemsite_id_itemsite_id,\n                    item_number :  res.item_number,\n                    item_descrip1 : res.item_descrip1 ,\n                    cmitem_cmhead_id : _this.form.findField('cmhead_id').getValue(),\n                    cmitem_comments : res.item_descrip1,\n                    cmitem_tax_listprice : res.item_price * ( 1 + rate * 1),\n                    cmitem_item_listprice : res.item_price,\n                    cmitem_tax_unitprice : res.item_price * ( 1 + rate * 1),\n                    cmitem_unitprice : res.item_price,\n                    cmitem_qtycredit : 1,\n                    cmitem_line_value : res.item_price,\n                    cmitem_line_tax_value : res.item_price * ( 1 + rate * 1)\n                    \n                });\n        grid.ds.insert(grid.ds.getCount(), nr);\n        \n        var ar = grid.ds.getAt(grid.ds.getCount() - 1);\n        ar.commit();\n        \n   }); \n}"
703                                             },
704                                             "cls": "x-btn-text-icon",
705                                             "text": "Find Products",
706                                             "xtype": "Button",
707                                             "|icon": "rootURL + '/Pman/templates/images/search.gif'",
708                                             "|xns": "Roo.Toolbar"
709                                         },
710                                         {
711                                             "listeners": {
712                                                 "click": "function ()\n{\n    var cmhead_id = 1 * _this.form.findField('cmhead_id').getValue();\n    if (!cmhead_id) {\n        Roo.MessageBox.alert(\"Error\", \"Save credit memo first!\");\n        return;\n    \n    }\n    \n    new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 600000,\n        params : {\n            _group : 'cmhead',\n            _name : 'items',\n            'cmhead_id:number' : cmhead_id,\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });   \n            \n   \n}"
713                                             },
714                                             "cls": "x-btn-text-icon",
715                                             "text": "Download Excel",
716                                             "xtype": "Button",
717                                             "|icon": "rootURL + '/Pman/templates/images/spreadsheet.gif'",
718                                             "|xns": "Roo.Toolbar"
719                                         },
720                                         {
721                                             "listeners": {
722                                                 "|click": "function (_self, e)\n{\n   \n    if (_this.form.findField('cmhead_posted').getValue() == 'true') {\n        Roo.MessageBox.alert(\"Error\", \"credit memo is already posted\");\n        return;\n    }\n   \n    Pman.Dialog.Image.show(\n       {\n            _url : baseURL + '/Xtuple/Import/CreditMemo',\n            onid : _this.form.findField('cmhead_id').getValue()\n        \n       },\n       function (res) {\n            _this.grid.ds.load({});\r\n       }\n   );\n}",
723                                                 "render": "function (_self)\n{\n    _this.uploadBtn = _self;\n}"
724                                             },
725                                             "cls": "x-btn-text-icon",
726                                             "text": "Upload Excel",
727                                             "xtype": "Button",
728                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
729                                             "|xns": "Roo.Toolbar"
730                                         },
731                                         {
732                                             "xtype": "Fill",
733                                             "|xns": "Roo.Toolbar"
734                                         },
735                                         {
736                                             "listeners": {
737                                                 "|click": "function()\n{\n     _this.grid.stopEditing();\n    // check that no shipments or invoices are done..\n if (_this.form.findField('cmhead_posted').getValue() == 'true') {\n        Roo.MessageBox.alert(\"Error\", \"credit memo is already posted\");\n        return;\n    }\n                                            // check that no shipments or invoices are done..\n    var rc = _this.grid.getSelectionModel().getSelectedCell();\n    \n    var rec = _this.grid.ds.getAt(rc[0]);\n    \n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete that line?\", function(r)\n    {\n        if (r != 'yes') {\n            return;\n        }\n        remove();\n    });\n    \n    if (!rec.data.cmitem_id) {\n        _this.grid.ds.remove(rec);\n        return;\n    }\n    function remove()\n    {\n        new  Pman.Request({\n            url : baseURL + '/Roo/cmitem',\n            method : 'POST',\n            params : {\n                _delete : rec.data.cmitem_id\n            \n            },\n            success : function() {\n                if (rec.data.item_type == 'K') {\n                    _this.grid.ds.load({});\n                    return;\n                }\n                _this.grid.ds.remove(rec);\n            }\n        \n        });\n    }\n\n    \n    \n}\n        "
738                                             },
739                                             "cls": "x-btn-text-icon",
740                                             "text": "Delete",
741                                             "xtype": "Button",
742                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
743                                             "|xns": "Roo.Toolbar"
744                                         }
745                                     ]
746                                 },
747                                 {
748                                     "*prop": "colModel[]",
749                                     ".builderCfg": "{\"table\":\"coitem\",\"column\":\"coitem_linenumber\",\"columnshort\":\"coitem_linenumber\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Item#\"}",
750                                     "dataIndex": "cmitem_linenumber",
751                                     "header": "Item#",
752                                     "width": 60,
753                                     "xtype": "ColumnModel",
754                                     "|renderer": "function(v,x,r) {\n\n    if (r.data.coitem_subnumber * 1 > 0) {\n         return String.format('{0}.{1}', v,r.data.coitem_subnumber);\n     }\n     return String.format('{0}', v);\n  }",
755                                     "|xns": "Roo.grid"
756                                 },
757                                 {
758                                     "*prop": "colModel[]",
759                                     "dataIndex": "item_number",
760                                     "header": "Item Code",
761                                     "width": 75,
762                                     "xtype": "ColumnModel",
763                                     "|renderer": "function(v) { return String.format('{0}', v); }",
764                                     "|xns": "Roo.grid",
765                                     "items": [
766                                         {
767                                             "|xns": "Roo.grid",
768                                             "xtype": "GridEditor",
769                                             "*prop": "editor",
770                                             "items": [
771                                                 {
772                                                     "listeners": {
773                                                         "beforeselect": "function (combo, record, index)\n{\n  // set _this.data values ..\n  var ar = _this.grid.activeEditor.record;\n  //Roo.log('beforeselect');\n  \n  var rate = _this.form.findField('taxzone_rate').getValue();\n  \n  (function() { \n    \n    ar.set('item_descrip1', record.data.itemsite_item_id_item_descrip1);\n    ar.set('cmitem_comments', record.data.itemsite_item_id_item_descrip1);        \n    ar.set('cmitem_tax_listprice', record.data.item_listprice * ( 1 + rate * 1) );\n    ar.set('cmitem_item_listprice', record.data.item_listprice * 1);\n    ar.set('cmitem_tax_unitprice', record.data.item_price * ( 1 + rate * 1) );\n    ar.set('cmitem_unitprice', record.data.item_price * 1);\n    ar.set('cmitem_qtycredit', 1);\n    ar.set('cmitem_line_value', record.data.item_price * ar.data.cmitem_qtycredit);\n    ar.set('cmitem_line_tax_value', ar.data.cmitem_tax_unitprice * ar.data.cmitem_qtycredit);\n    ar.set('cmitem_itemsite_id', record.data.itemsite_id);\n    ar.set('item_number', record.data.itemsite_item_id_item_number);\n    ar.set('item_type', record.data.itemsite_item_id_item_type);\n    ar.set('avail_qty', 0);\n  //  ar.updateFields = ['All'];\n    ar.commit();\n  }).defer(100);\n  \n}"
774                                                     },
775                                                     "*prop": "field",
776                                                     "allowBlank": false,
777                                                     "displayField": "itemsite_item_id_item_number",
778                                                     "editable": true,
779                                                     "emptyText": "Select item",
780                                                     "forceSelection": true,
781                                                     "hiddenName": "itemsite_item_id_item_number",
782                                                     "listWidth": 400,
783                                                     "loadingText": "Searching...",
784                                                     "minChars": 2,
785                                                     "name": "item_number",
786                                                     "pageSize": 20,
787                                                     "qtip": "Select item",
788                                                     "queryParam": "query[number]",
789                                                     "selectOnFocus": true,
790                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{itemsite_item_id_item_number}</b> ${item_price:toFixed(2)}- {itemsite_item_id_item_descrip1} </div>",
791                                                     "triggerAction": "all",
792                                                     "typeAhead": false,
793                                                     "valueField": "item_number",
794                                                     "xtype": "ComboBox",
795                                                     "|xns": "Roo.form",
796                                                     "items": [
797                                                         {
798                                                             "listeners": {
799                                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    o.params.customer_id = _this.form.findField('cmhead_cust_id').getValue();\n    o.params['query[cmhead_id]'] = _this.form.findField('cmhead_id').getValue();\n    //o.params.shipto_cust_id = _this.data.cohead_cust_id;\n    // set more here\n}\n"
800                                                             },
801                                                             "*prop": "store",
802                                                             "remoteSort": true,
803                                                             "xtype": "Store",
804                                                             "|sortInfo": "{ direction : 'ASC', field: 'item_number' }",
805                                                             "|xns": "Roo.data",
806                                                             "items": [
807                                                                 {
808                                                                     "*prop": "proxy",
809                                                                     "method": "GET",
810                                                                     "xtype": "HttpProxy",
811                                                                     "|url": "baseURL + '/Roo/itemsite.php'",
812                                                                     "|xns": "Roo.data"
813                                                                 },
814                                                                 {
815                                                                     "*prop": "reader",
816                                                                     "id": "shipto_id",
817                                                                     "root": "data",
818                                                                     "totalProperty": "total",
819                                                                     "xtype": "JsonReader",
820                                                                     "|fields": "[{'name':'item_id','type':'int'},'item_number']",
821                                                                     "|xns": "Roo.data"
822                                                                 }
823                                                             ]
824                                                         }
825                                                     ]
826                                                 }
827                                             ]
828                                         }
829                                     ]
830                                 },
831                                 {
832                                     "*prop": "colModel[]",
833                                     "dataIndex": "cmitem_comments",
834                                     "header": "Item Description",
835                                     "width": "150.00",
836                                     "xtype": "ColumnModel",
837                                     "|renderer": "function(v,x,r) { \n\n    if (!v.length) {\n        r.set('cmitem_comments', r.data.item_descrip1);\n        v = r.data.item_descrip1;\n    }\n    if (v && v.length > 49) {\n        return String.format('<span style=\"color:orange\" qtip=\"line may be too long to print\">{0}</span>', v);\n    }\n    return String.format('{0}', v); \n        \n}",
838                                     "|xns": "Roo.grid",
839                                     "items": [
840                                         {
841                                             "|xns": "Roo.grid",
842                                             "xtype": "GridEditor",
843                                             "*prop": "editor",
844                                             "items": [
845                                                 {
846                                                     "*prop": "field",
847                                                     "allowBlank": false,
848                                                     "xtype": "TextField",
849                                                     "|xns": "Roo.form"
850                                                 }
851                                             ]
852                                         }
853                                     ]
854                                 },
855                                 {
856                                     "*prop": "colModel[]",
857                                     "align": "right",
858                                     "dataIndex": "cmitem_qtycredit",
859                                     "header": "Qty",
860                                     "width": 50,
861                                     "xtype": "ColumnModel",
862                                     "|renderer": "function(v)\n{\n    return String.format('{0}', v ? parseInt(v) : '');\n}",
863                                     "|xns": "Roo.grid",
864                                     "items": [
865                                         {
866                                             "*prop": "editor",
867                                             "xtype": "GridEditor",
868                                             "|xns": "Roo.grid",
869                                             "items": [
870                                                 {
871                                                     "listeners": {
872                                                         "focus": "function (_self)\n{\n    if (this.value == 0) {\n        this.el.dom.value = '';\n    }\n}"
873                                                     },
874                                                     "*prop": "field",
875                                                     "allowDecimals": false,
876                                                     "decimalPrecision": 0,
877                                                     "minValue": 1,
878                                                     "style": "text-align:right",
879                                                     "xtype": "NumberField",
880                                                     "|xns": "Roo.form"
881                                                 }
882                                             ]
883                                         }
884                                     ]
885                                 },
886                                 {
887                                     "*prop": "colModel[]",
888                                     ".builderCfg": "{\"table\":\"coitem\",\"column\":\"coitem_linenumber\",\"columnshort\":\"coitem_linenumber\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Item#\"}",
889                                     "align": "right",
890                                     "dataIndex": "cmitem_tax_listprice",
891                                     "header": "List Price w. tax",
892                                     "width": 80,
893                                     "xtype": "ColumnModel",
894                                     "|renderer": "function(v,x,r)\n{\n //   var rate = _this.form.findField('taxzone_rate').getValue();\n //   v = v * (1 + rate * 1);\n \n    return String.format('{0}', v ? parseFloat(v).toFixed(2) : '');\n}",
895                                     "|xns": "Roo.grid"
896                                 },
897                                 {
898                                     "*prop": "colModel[]",
899                                     "align": "right",
900                                     "dataIndex": "cmitem_taxtype_id",
901                                     "header": "Taxed",
902                                     "width": 50,
903                                     "xtype": "ColumnModel",
904                                     "|renderer": "function(v,x,r) { return String.format('{0}', r.data.cmitem_taxtype_id_taxtype_name); }",
905                                     "|xns": "Roo.grid",
906                                     "items": [
907                                         {
908                                             "|xns": "Roo.grid",
909                                             "xtype": "GridEditor",
910                                             "*prop": "editor",
911                                             "items": [
912                                                 {
913                                                     "*prop": "field",
914                                                     "allowBlank": false,
915                                                     "displayField": "taxtype_name",
916                                                     "editable": false,
917                                                     "emptyText": "Select Tax Type",
918                                                     "forceSelection": true,
919                                                     "hiddenName": "cmitem_taxtype_id",
920                                                     "listWidth": 400,
921                                                     "loadingText": "Searching...",
922                                                     "minChars": 2,
923                                                     "name": "cmitem_taxtype_id_taxtype_name",
924                                                     "pageSize": 20,
925                                                     "qtip": "Select taxtype",
926                                                     "queryParam": "query[taxtype_id]",
927                                                     "selectOnFocus": true,
928                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{taxtype_name}</b> </div>",
929                                                     "triggerAction": "all",
930                                                     "typeAhead": true,
931                                                     "valueField": "taxtype_id",
932                                                     "width": 285,
933                                                     "xtype": "ComboBox",
934                                                     "|xns": "Roo.form",
935                                                     "items": [
936                                                         {
937                                                             "listeners": {
938                                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    \n/*    o.params.with_date = _this.form.findField('cohead_orderdate').getValue().format('Y-m-d'); \n    Roo.log(\"with date?\" + o.params.with_date);*/\n    \n    \n}\n"
939                                                             },
940                                                             "*prop": "store",
941                                                             "remoteSort": true,
942                                                             "xtype": "Store",
943                                                             "|sortInfo": "{ direction : 'ASC', field: 'taxtype_name' }",
944                                                             "|xns": "Roo.data",
945                                                             "items": [
946                                                                 {
947                                                                     "*prop": "proxy",
948                                                                     "method": "GET",
949                                                                     "xtype": "HttpProxy",
950                                                                     "|url": "baseURL + '/Roo/taxtype.php'",
951                                                                     "|xns": "Roo.data"
952                                                                 },
953                                                                 {
954                                                                     "*prop": "reader",
955                                                                     "id": "taxtype_id",
956                                                                     "root": "data",
957                                                                     "totalProperty": "total",
958                                                                     "xtype": "JsonReader",
959                                                                     "|fields": "[{'name':'taxtype_id','type':'int'},'taxtype_name']",
960                                                                     "|xns": "Roo.data"
961                                                                 }
962                                                             ]
963                                                         }
964                                                     ]
965                                                 }
966                                             ]
967                                         }
968                                     ]
969                                 },
970                                 {
971                                     "*prop": "colModel[]",
972                                     "align": "right",
973                                     "dataIndex": "cmitem_tax_unitprice",
974                                     "header": "Unit Price w. tax",
975                                     "width": 90,
976                                     "xtype": "ColumnModel",
977                                     "|renderer": "function(v,x,r)\n{\n    return String.format('{0}', v ? parseFloat(v).toFixed(2) : '');\n}",
978                                     "|xns": "Roo.grid",
979                                     "items": [
980                                         {
981                                             "|xns": "Roo.grid",
982                                             "xtype": "GridEditor",
983                                             "*prop": "editor",
984                                             "items": [
985                                                 {
986                                                     "listeners": {
987                                                         "focus": "function (_self)\n{\n    if (this.value == 0.0) {\n        this.el.dom.value = '';\n    }\n}"
988                                                     },
989                                                     "*prop": "field",
990                                                     "decimalPrecision": 2,
991                                                     "minValue": 0,
992                                                     "style": "text-align:right",
993                                                     "xtype": "NumberField",
994                                                     "|xns": "Roo.form"
995                                                 }
996                                             ]
997                                         }
998                                     ]
999                                 },
1000                                 {
1001                                     "*prop": "colModel[]",
1002                                     "align": "right",
1003                                     "dataIndex": "cmitem_unitprice",
1004                                     "header": "Unit Price",
1005                                     "width": 75,
1006                                     "xtype": "ColumnModel",
1007                                     "|renderer": "function(v)\n{\n    return String.format('{0}', v ? parseFloat(v).toFixed(2) : '');\n}",
1008                                     "|xns": "Roo.grid",
1009                                     "items": [
1010                                         {
1011                                             "|xns": "Roo.grid",
1012                                             "xtype": "GridEditor",
1013                                             "*prop": "editor",
1014                                             "items": [
1015                                                 {
1016                                                     "listeners": {
1017                                                         "focus": "function (_self)\n{\n    if (this.value == 0.0) {\n        this.el.dom.value = '';\n    }\n}"
1018                                                     },
1019                                                     "*prop": "field",
1020                                                     "decimalPrecision": 2,
1021                                                     "minValue": 0,
1022                                                     "style": "text-align:right",
1023                                                     "xtype": "NumberField",
1024                                                     "|xns": "Roo.form"
1025                                                 }
1026                                             ]
1027                                         }
1028                                     ]
1029                                 },
1030                                 {
1031                                     "*prop": "colModel[]",
1032                                     "align": "right",
1033                                     "dataIndex": "cmitem_line_value",
1034                                     "header": "Total",
1035                                     "width": 75,
1036                                     "xtype": "ColumnModel",
1037                                     "|renderer": "function(v)\n{\n    return String.format('{0}', v ? parseFloat(v).toFixed(2) : '');\n}",
1038                                     "|xns": "Roo.grid"
1039                                 },
1040                                 {
1041                                     "*prop": "colModel[]",
1042                                     "align": "right",
1043                                     "dataIndex": "cmitem_line_tax_value",
1044                                     "header": "Total w. tax",
1045                                     "width": 80,
1046                                     "|renderer": "function(v,x,r)\n{\n    return String.format('{0}', v ? parseFloat(v).toFixed(2) : '');\n}",
1047                                     "|xns": "Roo.grid"
1048                                 }
1049                             ]
1050                         }
1051                     ]
1052                 },
1053                 {
1054                     "listeners": {
1055                         "|activate": "function() {\n    _this.cpanel = this;\n    \n    var id = _this.form.findField('cmhead_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Error\", \"save the credit memo first!\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    if (_this.cgrid) {\n        _this.cgrid.footer.onClick('first');\n    }\n}"
1056                     },
1057                     "background": true,
1058                     "fitContainer": true,
1059                     "fitToframe": true,
1060                     "region": "center",
1061                     "tableName": "checkitem",
1062                     "title": "Miscellaneous Check",
1063                     "xtype": "GridPanel",
1064                     "|xns": "Roo",
1065                     "items": [
1066                         {
1067                             "listeners": {
1068                                 "|render": "function() \n{\n    _this.cgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.cpanel.active) {\n       this.footer.onClick('first');\n    }\n}"
1069                             },
1070                             "*prop": "grid",
1071                             "autoExpandColumn": "checkitem_checkhead_id_checkhead_notes",
1072                             "loadMask": true,
1073                             "xtype": "Grid",
1074                             "|xns": "Roo.grid",
1075                             "items": [
1076                                 {
1077                                     "listeners": {
1078                                         "beforeload": "function (_self, options)\n{\n    options.params = options.params || {};\n    options.params.checkitem_cmnumber = _this.form.findField('cmhead_number').getValue();\n}"
1079                                     },
1080                                     "*prop": "dataSource",
1081                                     "remoteSort": true,
1082                                     "xtype": "Store",
1083                                     "|sortInfo": "{ field : 'checkitem_id', direction: 'DESC' }",
1084                                     "|xns": "Roo.data",
1085                                     "items": [
1086                                         {
1087                                             "*prop": "proxy",
1088                                             "method": "GET",
1089                                             "xtype": "HttpProxy",
1090                                             "|url": "baseURL + '/Roo/checkitem.php'",
1091                                             "|xns": "Roo.data"
1092                                         },
1093                                         {
1094                                             "*prop": "reader",
1095                                             "id": "id",
1096                                             "root": "data",
1097                                             "totalProperty": "total",
1098                                             "xtype": "JsonReader",
1099                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'type',\n        'type': 'int'\n    },\n    {\n        'name': 'leader',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_name',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_email',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_role',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_active',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_deleted_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'leader_firstname',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_lastname',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_name_facebook',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_url_blog',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_url_twitter',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_url_linkedin',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_crm_lead_percentage',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_crm_industry_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_crm_updated_action_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_crm_created_action_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_crm_type_id',\n        'type': 'int'\n    }\n]",
1100                                             "|xns": "Roo.data"
1101                                         }
1102                                     ]
1103                                 },
1104                                 {
1105                                     "*prop": "footer",
1106                                     "displayInfo": true,
1107                                     "displayMsg": "Displaying check item{0} - {1} of {2}",
1108                                     "emptyMsg": "No check item found",
1109                                     "pageSize": 25,
1110                                     "xtype": "PagingToolbar",
1111                                     "|xns": "Roo"
1112                                 },
1113                                 {
1114                                     "*prop": "colModel[]",
1115                                     "dataIndex": "checkitem_docdate",
1116                                     "header": "Date",
1117                                     "width": 75,
1118                                     "xtype": "ColumnModel",
1119                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
1120                                     "|xns": "Roo.grid"
1121                                 },
1122                                 {
1123                                     "*prop": "colModel[]",
1124                                     "dataIndex": "checkitem_bankaccnt_id_bankaccnt_name",
1125                                     "header": "Bank Account",
1126                                     "width": 100,
1127                                     "xtype": "ColumnModel",
1128                                     "|renderer": "function(v) { return String.format('{0}', v ? v : ''); }",
1129                                     "|xns": "Roo.grid"
1130                                 },
1131                                 {
1132                                     "*prop": "colModel[]",
1133                                     "dataIndex": "checkitem_checkhead_id_checkhead_for",
1134                                     "header": "Memo",
1135                                     "width": 75,
1136                                     "xtype": "ColumnModel",
1137                                     "|renderer": "function(v) { return String.format('{0}', v ? v : ''); }",
1138                                     "|xns": "Roo.grid"
1139                                 },
1140                                 {
1141                                     "*prop": "colModel[]",
1142                                     "dataIndex": "checkitem_checkhead_id_checkhead_notes",
1143                                     "header": "Notes",
1144                                     "width": 100,
1145                                     "xtype": "ColumnModel",
1146                                     "|renderer": "function(v) { return String.format('{0}', v ? v : ''); }",
1147                                     "|xns": "Roo.grid"
1148                                 },
1149                                 {
1150                                     "*prop": "colModel[]",
1151                                     "align": "right",
1152                                     "dataIndex": "checkitem_curr_id_curr_name",
1153                                     "header": "Currency",
1154                                     "width": 75,
1155                                     "xtype": "ColumnModel",
1156                                     "|renderer": "function(v) { return String.format('{0}', v ? v : ''); }",
1157                                     "|xns": "Roo.grid"
1158                                 },
1159                                 {
1160                                     "*prop": "colModel[]",
1161                                     "align": "right",
1162                                     "dataIndex": "checkitem_amount",
1163                                     "header": "Amount",
1164                                     "width": 75,
1165                                     "xtype": "ColumnModel",
1166                                     "|renderer": "function(v) { return String.format('{0}', v ? parseFloat(v).toFixed(2) : ''); }",
1167                                     "|xns": "Roo.grid"
1168                                 }
1169                             ]
1170                         }
1171                     ]
1172                 },
1173                 {
1174                     "listeners": {
1175                         "|activate": "function() {\n    _this.apanel = this;\n    if (_this.agrid) {\n        _this.agrid.footer.onClick('first');\n    }\n}"
1176                     },
1177                     "background": false,
1178                     "fitContainer": true,
1179                     "fitToframe": true,
1180                     "region": "center",
1181                     "tableName": "invchead",
1182                     "title": "Applications",
1183                     "xtype": "GridPanel",
1184                     "|xns": "Roo",
1185                     "items": [
1186                         {
1187                             "listeners": {
1188                                 "|render": "function() \n{\n    _this.agrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.apanel.active) {\n       this.footer.onClick('first');\n    }\n}"
1189                             },
1190                             "*prop": "grid",
1191                             "autoExpandColumn": "arapply_target_docnumber",
1192                             "loadMask": true,
1193                             "xtype": "Grid",
1194                             "|xns": "Roo.grid",
1195                             "items": [
1196                                 {
1197                                     "listeners": {
1198                                         "beforeload": "function (_self,o) {\n\n    try {\n       this.removeAll();\n    } catch (e) { }\n\n    if (!_this.data || !_this.data.cmhead_id) {\n        return false;\n    }\n    o.params = o.params || {};\n    \n    o.params._application = _this.data.cmhead_id\n    \n}"
1199                                     },
1200                                     "*prop": "dataSource",
1201                                     "remoteSort": true,
1202                                     "xtype": "Store",
1203                                     "|sortInfo": "{ field : 'arapply_id', direction: 'ASC' }",
1204                                     "|xns": "Roo.data",
1205                                     "items": [
1206                                         {
1207                                             "*prop": "proxy",
1208                                             "method": "GET",
1209                                             "xtype": "HttpProxy",
1210                                             "|url": "baseURL + '/Roo/Arapply.php'",
1211                                             "|xns": "Roo.data"
1212                                         },
1213                                         {
1214                                             "|xns": "Roo.data",
1215                                             "xtype": "JsonReader",
1216                                             "totalProperty": "total",
1217                                             "root": "data",
1218                                             "*prop": "reader",
1219                                             "id": "id",
1220                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'type',\n        'type': 'int'\n    },\n    {\n        'name': 'leader',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_name',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_email',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_role',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_active',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_deleted_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'leader_firstname',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_lastname',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_name_facebook',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_url_blog',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_url_twitter',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_url_linkedin',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_crm_lead_percentage',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_crm_industry_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_crm_updated_action_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_crm_created_action_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_crm_type_id',\n        'type': 'int'\n    }\n]"
1221                                         }
1222                                     ]
1223                                 },
1224                                 {
1225                                     "*prop": "footer",
1226                                     "displayInfo": true,
1227                                     "displayMsg": "Displaying application{0} - {1} of {2}",
1228                                     "emptyMsg": "No application found",
1229                                     "pageSize": 25,
1230                                     "xtype": "PagingToolbar",
1231                                     "|xns": "Roo"
1232                                 },
1233                                 {
1234                                     "*prop": "colModel[]",
1235                                     "dataIndex": "arapply_id",
1236                                     "header": "ID",
1237                                     "width": 75,
1238                                     "xtype": "ColumnModel",
1239                                     "|renderer": "function(v) { return String.format('{0}', v); }",
1240                                     "|xns": "Roo.grid"
1241                                 },
1242                                 {
1243                                     "*prop": "colModel[]",
1244                                     "dataIndex": "arapply_distdate",
1245                                     "header": "Date",
1246                                     "width": 100,
1247                                     "xtype": "ColumnModel",
1248                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
1249                                     "|xns": "Roo.grid"
1250                                 },
1251                                 {
1252                                     "*prop": "colModel[]",
1253                                     "dataIndex": "arapply_target_doctype",
1254                                     "header": "Target Doctype",
1255                                     "width": 100,
1256                                     "xtype": "ColumnModel",
1257                                     "|renderer": "function(v) { return String.format('{0}', v); }",
1258                                     "|xns": "Roo.grid"
1259                                 },
1260                                 {
1261                                     "*prop": "colModel[]",
1262                                     "dataIndex": "arapply_target_docnumber",
1263                                     "header": "Target Docnumber",
1264                                     "width": 100,
1265                                     "xtype": "ColumnModel",
1266                                     "|renderer": "function(v) { return String.format('{0}', v); }",
1267                                     "|xns": "Roo.grid"
1268                                 },
1269                                 {
1270                                     "*prop": "colModel[]",
1271                                     "dataIndex": "arapply_curr_id_curr_name",
1272                                     "header": "Currency",
1273                                     "width": 75,
1274                                     "xtype": "ColumnModel",
1275                                     "|renderer": "function(v) { return String.format('{0}', v); }",
1276                                     "|xns": "Roo.grid"
1277                                 },
1278                                 {
1279                                     "*prop": "colModel[]",
1280                                     "dataIndex": "arapply_applied",
1281                                     "header": "Applied",
1282                                     "width": 75,
1283                                     "xtype": "ColumnModel",
1284                                     "|renderer": "function(v) { return String.format('{0}', v); }",
1285                                     "|xns": "Roo.grid"
1286                                 }
1287                             ]
1288                         }
1289                     ]
1290                 },
1291                 {
1292                     "listeners": {
1293                         "|activate": "function() {\n    _this.hpanel = this;\n    if (_this.hgrid) {\n        _this.hgrid.footer.onClick('first');\n    }\n}"
1294                     },
1295                     ".builderCfg": "{\"cols\":[{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}],\"cols_ex\":[\"remarks\"],\"table\":\"events\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
1296                     "background": true,
1297                     "fitContainer": true,
1298                     "fitToframe": true,
1299                     "region": "center",
1300                     "tableName": "events",
1301                     "title": "History",
1302                     "xtype": "GridPanel",
1303                     "|xns": "Roo",
1304                     "items": [
1305                         {
1306                             "listeners": {
1307                                 "|render": "function() \n{\n    _this.hgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.hpanel.active) {\n       this.footer.onClick('first');\n    }\n}",
1308                                 "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
1309                             },
1310                             "*prop": "grid",
1311                             ".builderCfg": "{\"cols\":[{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}],\"cols_ex\":[\"remarks\"],\"table\":\"events\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
1312                             "autoExpandColumn": "remarks",
1313                             "loadMask": true,
1314                             "xtype": "Grid",
1315                             "|xns": "Roo.grid",
1316                             "items": [
1317                                 {
1318                                     "listeners": {
1319                                         "beforeload": "function (_self, options)\n{\n    options.params._related_on_table = 'cmhead';\n    options.params._related_on_id = _this.form.findField('cmhead_id').getValue();\n    \n}"
1320                                     },
1321                                     "*prop": "dataSource",
1322                                     "remoteSort": true,
1323                                     "xtype": "Store",
1324                                     "|sortInfo": "{ field : 'event_when', direction: 'DESC' }",
1325                                     "|xns": "Roo.data",
1326                                     "items": [
1327                                         {
1328                                             "*prop": "proxy",
1329                                             "method": "GET",
1330                                             "xtype": "HttpProxy",
1331                                             "|url": "baseURL + '/Roo/events.php'",
1332                                             "|xns": "Roo.data"
1333                                         },
1334                                         {
1335                                             "|xns": "Roo.data",
1336                                             "xtype": "JsonReader",
1337                                             "totalProperty": "total",
1338                                             "root": "data",
1339                                             ".builderCfg": "{\"cols\":[{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}],\"cols_ex\":[\"remarks\"],\"table\":\"events\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
1340                                             "*prop": "reader",
1341                                             "id": "id",
1342                                             "|fields": "[\n    {\n        'name': 'event_when',\n        'type': 'date'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    }\n]"
1343                                         }
1344                                     ]
1345                                 },
1346                                 {
1347                                     "*prop": "footer",
1348                                     "xtype": "PagingToolbar",
1349                                     "pageSize": 25,
1350                                     "displayInfo": true,
1351                                     "displayMsg": "Displaying events{0} - {1} of {2}",
1352                                     "emptyMsg": "No events found",
1353                                     "|xns": "Roo"
1354                                 },
1355                                 {
1356                                     "*prop": "colModel[]",
1357                                     ".builderCfg": "{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
1358                                     "dataIndex": "event_when",
1359                                     "header": "Changed",
1360                                     "width": 120,
1361                                     "xtype": "ColumnModel",
1362                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
1363                                     "|xns": "Roo.grid"
1364                                 },
1365                                 {
1366                                     "*prop": "colModel[]",
1367                                     ".builderCfg": "{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
1368                                     "dataIndex": "action",
1369                                     "header": "action",
1370                                     "width": 120,
1371                                     "xtype": "ColumnModel",
1372                                     "|renderer": "function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); }",
1373                                     "|xns": "Roo.grid"
1374                                 },
1375                                 {
1376                                     "*prop": "colModel[]",
1377                                     ".builderCfg": "{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
1378                                     "dataIndex": "ipaddr",
1379                                     "header": "IP address",
1380                                     "width": 120,
1381                                     "xtype": "ColumnModel",
1382                                     "|renderer": "function(v) { return String.format('{0}', v); }",
1383                                     "|xns": "Roo.grid"
1384                                 },
1385                                 {
1386                                     "*prop": "colModel[]",
1387                                     ".builderCfg": "{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
1388                                     "dataIndex": "person_id_name",
1389                                     "header": "Who",
1390                                     "width": 120,
1391                                     "xtype": "ColumnModel",
1392                                     "|renderer": "function(v) { return String.format('{0}', v); }",
1393                                     "|xns": "Roo.grid"
1394                                 },
1395                                 {
1396                                     "*prop": "colModel[]",
1397                                     ".builderCfg": "{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}",
1398                                     "dataIndex": "remarks",
1399                                     "header": "Notes",
1400                                     "width": 200,
1401                                     "xtype": "ColumnModel",
1402                                     "|renderer": "function(v) { return String.format('{0}', v); }",
1403                                     "|xns": "Roo.grid"
1404                                 }
1405                             ]
1406                         }
1407                     ]
1408                 },
1409                 {
1410                     "listeners": {
1411                         "click": "function (_self, e)\n{\n      if (_this.grid)  _this.grid.stopEditing();\n    _this.dialog.hide();\n}"
1412                     },
1413                     "*prop": "buttons[]",
1414                     "text": "Cancel",
1415                     "xtype": "Button",
1416                     "|xns": "Roo"
1417                 },
1418                 {
1419                     "listeners": {
1420                         "click": "function (_self, e)\n{\n  // do some checks?\n       if (_this.grid)  _this.grid.stopEditing();\n      if (_this.form.findField('cmhead_posted').getValue() == 'true') {\n          Roo.MessageBox.alert(\"Error\", \"credit memo is already posted\");\n          return;\n      }\n      var loose = false;\n      var ar = [];\n      if (_this.grid && _this.grid.ds) {\n          _this.grid.ds.each(function(rec) {\n              if (!(rec.data.cmitem_itemsite_id * 1) || !(rec.data.cmitem_qtycredit*1) || !(rec.data.cmitem_unitprice*1)) {\n                  loose = true;\n                  return true;\n              } \n              ar.push(rec);\n              \n          });\n          if (loose) {\n              Roo.MessageBox.alert(\"Error\", \"Some lines do not have product/qty/price set\");\n              return;\n          }    \n      }\n      if(ar.length){\n          _this.form.findField('has_item').setValue(ar.length);\n      } \n  \n      _this.form.doAction(\"submit\");\n}",
1421                         "render": "function (_self)\n{\n_this.saveBtn = _self;\n}"
1422                     },
1423                     "*prop": "buttons[]",
1424                     "text": "Save",
1425                     "xtype": "Button",
1426                     "|xns": "Roo"
1427                 }
1428             ]
1429         }
1430     ],
1431     "permname": "",
1432     "modOrder": "001"
1433 }