VendorCheck.js 6.6 KB

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