CustomerCheck.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. Ext.define('saas.view.money.report.CustomerCheckCheck', {
  2. extend: 'saas.view.core.report.ReportPanel',
  3. xtype: 'monry-report-customercheck',
  4. controller: 'money-report-customercheck',
  5. viewModel: 'money-report-customercheck',
  6. viewName: 'money-report-customercheck',
  7. // groupField: 'pi_custname',
  8. listUrl: '/api/money/report/customercheck',
  9. defaultCondition: null,
  10. reportTitle: '客户对账单',
  11. QueryWidth: 0.4,
  12. autoLoad: false,
  13. //筛选:客户、日期(必填)
  14. searchItems: [{
  15. xtype: 'customerDbfindTrigger',
  16. name: 'pi_custname',
  17. fieldLabel: '客户名称',
  18. columnWidth: 0.2,
  19. listeners: {
  20. beforequery: function(f) {
  21. return !!f.value;
  22. }
  23. }
  24. }, {
  25. xtype: 'condatefield',
  26. name: 'pi_date',
  27. fieldLabel: '单据日期',
  28. columnWidth: 0.4
  29. }],
  30. reportColumns: [{
  31. text: 'id',
  32. dataIndex: 'pi_id',
  33. hidden: true
  34. }, {
  35. text: '单据日期',
  36. dataIndex: 'pi_date',
  37. xtype: 'datecolumn',
  38. width: 110
  39. }, {
  40. text: '单号',
  41. dataIndex: 'pi_inoutno',
  42. width: 150
  43. }, {
  44. text: '序号',
  45. dataIndex: 'pd_pdno',
  46. exportFormat: 'Integer',
  47. xtype: 'numbercolumn',
  48. width: 80
  49. }, {
  50. text: '物料编号',
  51. width: 150,
  52. dataIndex: 'pr_code'
  53. }, {
  54. text: '品牌',
  55. dataIndex: 'pr_brand',
  56. width: 200
  57. }, {
  58. text: '名称',
  59. dataIndex: 'pr_detail',
  60. width: 200
  61. }, {
  62. text: '型号',
  63. dataIndex: 'pr_orispeccode',
  64. width: 200
  65. }, {
  66. text: '规格',
  67. dataIndex: 'pr_spec',
  68. width: 150
  69. }, {
  70. text: '数量',
  71. xtype: 'numbercolumn',
  72. exportFormat: 'Quantity',
  73. dataIndex: 'qty',
  74. width: 110,
  75. renderer: function(v) {
  76. var arr = (v + '.').split('.');
  77. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  78. var format = '0.' + xr.join('');
  79. return Ext.util.Format.number(v, format);
  80. }
  81. }, {
  82. text: '单位',
  83. dataIndex: 'pd_unit',
  84. width: 80
  85. }, {
  86. text: '单价(元)',
  87. dataIndex: 'pd_orderprice',
  88. exportFormat: 'Price',
  89. xtype: 'numbercolumn',
  90. width: 110,
  91. renderer: function(v) {
  92. var arr = (v + '.').split('.');
  93. var xr = (new Array(arr[1].length > 4 ? 4 : arr[1].length)).fill('0');
  94. var format = '0,000.' + xr.join('');
  95. return Ext.util.Format.number(v, format);
  96. }
  97. }, {
  98. text: '税率',
  99. dataIndex: 'pd_taxrate',
  100. exportFormat: 'Integer',
  101. xtype: 'numbercolumn',
  102. width: 80,
  103. renderer: function(v) {
  104. return Ext.util.Format.number(v, '0');
  105. }
  106. }, {
  107. text: '金额(元)',
  108. xtype: 'numbercolumn',
  109. exportFormat: 'Amount',
  110. width: 110,
  111. dataIndex: 'pd_total',
  112. renderer : function(v) {
  113. var arr = (v + '.').split('.');
  114. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  115. var format = '0,000.' + xr.join('');
  116. return Ext.util.Format.number(v, format);
  117. },
  118. // summaryType: 'sum',
  119. // summaryRenderer: function(v) {
  120. // var arr = (v + '.').split('.');
  121. // var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  122. // var format = '0,000.' + xr.join('');
  123. // return Ext.util.Format.number(v, format);
  124. // }
  125. }, {
  126. text: '不含税单价(元)',
  127. width: 150,
  128. dataIndex: 'pd_netprice',
  129. exportFormat: 'Price',
  130. xtype: 'numbercolumn',
  131. renderer: function(v) {
  132. var arr = (v + '.').split('.');
  133. var xr = (new Array(arr[1].length > 4 ? 4 : arr[1].length)).fill('0');
  134. var format = '0,000.' + xr.join('');
  135. return Ext.util.Format.number(v, format);
  136. }
  137. }, {
  138. text: '不含税金额(元)',
  139. width: 150,
  140. xtype: 'numbercolumn',
  141. exportFormat: 'Amount',
  142. dataIndex: 'pd_nettotal',
  143. renderer : function(v) {
  144. var arr = (v + '.').split('.');
  145. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  146. var format = '0,000.' + xr.join('');
  147. return Ext.util.Format.number(v, format);
  148. }
  149. // summaryType: 'sum',
  150. // summaryRenderer: function(v) {
  151. // var arr = (v + '.').split('.');
  152. // var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  153. // var format = '0,000.' + xr.join('');
  154. // return Ext.util.Format.number(v, format);
  155. // }
  156. }, {
  157. text: '单据类型',
  158. dataIndex: 'pi_class',
  159. width: 110
  160. }, {
  161. text: '期初应收',
  162. dataIndex: 'beginamount',
  163. hidden: true,
  164. width: 0,
  165. summaryType: 'cus',
  166. }, {
  167. text: '增加应收',
  168. dataIndex: 'nowamount',
  169. hidden: true,
  170. width: 0,
  171. summaryType: 'cus',
  172. }, {
  173. text: '增加预收',
  174. dataIndex: 'nowpay',
  175. hidden: true,
  176. width: 0,
  177. summaryType: 'cus',
  178. }, {
  179. text: '应收余额',
  180. dataIndex: 'nowbalance',
  181. hidden: true,
  182. width: 0,
  183. summaryType: 'cus',
  184. }],
  185. listeners: {
  186. afterrender: function(panel) {
  187. panel.setLoadButtonDisabled(true);
  188. },
  189. beforequery: function(panel) {
  190. var form = panel.items.items[0];
  191. var values = form.getValues();
  192. var pi_custname = values.pi_custname;
  193. if(!pi_custname) {
  194. saas.util.BaseUtil.showErrorToast('请先选择【<span style="color: red;">客户名称</span>】');
  195. return false;
  196. }
  197. return true;
  198. }
  199. },
  200. setLoadButtonDisabled: function (disabled) {
  201. var panel = this,
  202. grid = panel.down('grid'),
  203. p = grid.down('pagingtoolbar'),
  204. bs = p.query('button'),
  205. loadButton = Ext.Array.findBy(bs, function (b) {
  206. return b.iconCls == 'x-tbar-loading';
  207. });
  208. if (loadButton) {
  209. loadButton.setDisabled(disabled);
  210. }
  211. },
  212. applyParams: function (p) {
  213. var me = this,
  214. viewModel = me.getViewModel(),
  215. formData = viewModel.get('form'),
  216. ym = formData.ym;
  217. return Ext.Object.merge(p, {
  218. ym: ym
  219. });
  220. }
  221. });