FormPanelController.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. Ext.define('saas.view.money.othreceipts.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.money-othreceipts-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. //放大镜赋值关系 以及 tpl模板
  8. 'dbfindtrigger[name=or_custname]': {
  9. beforerender: function (f) {
  10. Ext.apply(f, {
  11. dataUrl: '/api/document/customer/dbfind',
  12. addXtype: 'document-customer-formpanel',
  13. addTitle: '客户资料',
  14. defaultCondition: "cu_statuscode='OPEN'",
  15. dbfinds: [{
  16. from: 'id',
  17. to: 'or_custid',ignore:true
  18. }, {
  19. from: 'cu_code',
  20. to: 'or_custcode'
  21. }, {
  22. from: 'cu_name',
  23. to: 'or_custname'
  24. }],
  25. dbtpls: [{
  26. field: 'cu_code',
  27. width: 100
  28. }, {
  29. field: 'cu_name',
  30. width: 100
  31. }],
  32. dbSearchFields: [{
  33. emptyText: '输入客户编号或客户名称',
  34. xtype: "textfield",
  35. name: "search",
  36. getCondition: function (v) {
  37. return "(upper(cu_code) like '%"+v.toUpperCase()+"%' or upper(cu_name) like '%"+v.toUpperCase()+"%')";
  38. },
  39. allowBlank: true,
  40. columnWidth: 0.25
  41. }],
  42. dbColumns:[
  43. {
  44. "text": "客户ID",
  45. "flex": 0,
  46. "dataIndex": "id",
  47. "width": 0,
  48. "xtype": "",
  49. "items": null
  50. },{
  51. "text": "客户编号",
  52. "flex": 1,
  53. "dataIndex": "cu_code",
  54. "width": 100,
  55. "xtype": "",
  56. "items": null
  57. }, {
  58. "text": "客户名称",
  59. "flex": 1,
  60. "dataIndex": "cu_name",
  61. "xtype": "",
  62. "items": null
  63. }, {
  64. "text": "客户类型",
  65. "flex": 1,
  66. "dataIndex": "cu_type",
  67. "width": 200,
  68. "xtype": "",
  69. "items": null
  70. }, {
  71. "text": "业务员编号",
  72. "flex": 1,
  73. "dataIndex": "cu_sellercode",
  74. "width": 100
  75. }, {
  76. "text": "业务员",
  77. "flex": 1,
  78. "dataIndex": "cu_sellername",
  79. "width": 100
  80. }, {
  81. "text": "税率",
  82. "flex": 1,
  83. "dataIndex": "cu_taxrate",
  84. "width": 100,
  85. xtype: 'numbercolumn',
  86. align:'end'
  87. }, {
  88. "text": "承付天数",
  89. "flex": 1,
  90. "dataIndex": "cu_promisedays",
  91. "width": 100,
  92. xtype: 'numbercolumn',
  93. align:'end',
  94. renderer : function(v) {
  95. return Ext.util.Format.number(v, '0');
  96. }
  97. }, {
  98. "text": "额度",
  99. "flex": 1,
  100. "dataIndex": "cu_credit",
  101. "width": 100,
  102. xtype: 'numbercolumn',
  103. align:'end'
  104. }, {
  105. "text": "客户地址",
  106. "flex": 2,
  107. "dataIndex": "ca_address",
  108. "width": 300
  109. }]
  110. });
  111. }
  112. },
  113. //放大镜赋值关系 以及 tpl模板
  114. 'dbfindtrigger[name=or_bankname]': {
  115. beforerender: function (f) {
  116. Ext.apply(f, {
  117. dataUrl: '/api/document/bankinformation/list',
  118. addXtype: 'other-bankinformation',
  119. addTitle: '资金账户',
  120. dbfinds: [{
  121. from: 'bk_bankcode',
  122. to: 'or_bankcode'
  123. }, {
  124. from: 'bk_bankname',
  125. to: 'or_bankname'
  126. }, {
  127. from: 'id',
  128. to: 'or_bankid',ignore:true
  129. }],
  130. // defaultCondition: "bk_statuscode='OPEN'",
  131. dbtpls: [{
  132. field: 'bk_bankcode',
  133. width: 100
  134. }, {
  135. field: 'bk_bankname',
  136. width: 100
  137. }],
  138. dbSearchFields: [{
  139. emptyText: '查找资金账户',
  140. xtype: "textfield",
  141. name: "search",
  142. getCondition: function (v) {
  143. return "(upper(bk_bankcode) like '%"+v.toUpperCase()+"%' or upper(bk_bankname) like '%"+v.toUpperCase()+"%')";
  144. },
  145. allowBlank: true,
  146. columnWidth: 0.25
  147. }],
  148. dbColumns: [{
  149. "text": "账户ID",
  150. "flex": 0,
  151. "dataIndex": "id",
  152. "width": 0,
  153. "xtype": ""
  154. }, {
  155. "text": "资金账户",
  156. "flex": 1,
  157. "dataIndex": "bk_bankcode",
  158. "width": 120,
  159. "xtype": ""
  160. }, {
  161. "text": "账户名称",
  162. "flex": 1,
  163. "dataIndex": "bk_bankname",
  164. "width": 150,
  165. "xtype": ""
  166. }, {
  167. "text": "账户类别",
  168. "flex": 1,
  169. "dataIndex": "bk_type",
  170. "width": 120,
  171. "xtype": ""
  172. }, {
  173. "text": "账户余额",
  174. "flex": 1,
  175. "dataIndex": "bk_thisamount",
  176. "width": 120,
  177. xtype: 'numbercolumn',
  178. }, {
  179. "text": "建帐日期",
  180. "flex": 1,
  181. "dataIndex": "bk_date",
  182. "width": 120,
  183. "xtype": "datecolumn"
  184. }]
  185. });
  186. }
  187. }
  188. });
  189. },
  190. onSave: function() {
  191. var me = this,
  192. form = me.getView(),
  193. viewModel = me.getViewModel(),
  194. store1 = viewModel.get('detail0').detailStore;
  195. var valid = form.isValid();
  196. if(!valid) {
  197. saas.util.BaseUtil.showToast(form.invalidText);
  198. return false;
  199. }
  200. var sum_nowbalance = store1.sum('ord_nowbalance'); // 金额合计
  201. viewModel.set('or_amount',sum_nowbalance);
  202. me.save();
  203. }
  204. });