| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518 |
- Ext.define('saas.view.money.recBalance.FormPanel', {
- extend: 'saas.view.core.form.FormPanel',
- xtype: 'money-recbalance-formpanel',
- controller: 'money-recbalance-formpanel',
- viewModel: 'money-recbalance-formpanel',
- viewName: 'money-recbalance-formpanel',
- caller: 'RecBalance',
- //字段属性
- _title: '收款单',
- _idField: 'id',
- _codeField: 'rb_code',
- _statusField: 'rb_status',
- _statusCodeField: 'rb_statuscode',
- _auditmanField: 'rb_auditman',
- _auditdateField: 'rb_auditdate',
- _readUrl: '/api/money/recbalance/read',
- _saveUrl: '/api/money/recbalance/save',
- _auditUrl: '/api/money/recbalance/audit',
- _unAuditUrl: '/api/money/recbalance/unAudit',
- _deleteUrl: '/api/money/recbalance/delete',
- initId: 0,
- initComponent: function () {
- Ext.apply(this, {
- defaultItems: [{
- xtype: 'hidden',
- name: 'id',
- fieldLabel: 'id'
- }, {
- xtype: 'hidden',
- name: 'rb_custid',
- fieldLabel: '客户ID'
- }, {
- xtype: 'hidden',
- name: 'rb_kind',
- fieldLabel: '单据类型',
- defaultValue: '收款单',
- readOnly: true
- }, {
- xtype: 'hidden',
- name: 'rb_custcode',
- fieldLabel: '客户编号'
- }, {
- xtype: "customerDbfindTrigger",
- name: "rb_custname",
- fieldLabel: "客户名称",
- allowBlank: false,
- listeners: {
- change: 'clearDetails'
- }
- }, {
- xtype: "numberfield",
- name: "cu_leftamount",
- fieldLabel: "总欠款",
- thousandSeparator: ',',
- ignore: true,
- readOnly: true
- }, {
- xtype: 'hidden',
- name: 'rb_rbdamount',
- fieldLabel: '本次核销金额(元)',
- thousandSeparator: ','
- }, {
- xtype: 'hidden',
- name: 'rb_rdamount',
- fieldLabel: '本次付款金额(元)',
- thousandSeparator: ','
- }, {
- xtype: "datefield",
- name: "rb_date",
- fieldLabel: "日期",
- defaultValue: new Date(),
- allowBlank: false
- }, {
- xtype: "textfield",
- name: "rb_manname",
- fieldLabel: "收款人",
- defaultValue: saas.util.BaseUtil.getCurrentUser().realname
- }, {
- xtype: "numberfield",
- name: "rb_discounts",
- fieldLabel: "整单折扣",
- hidden: true
- }, {
- xtype: 'numberfield',
- name: 'rb_preamount',
- fieldLabel: '本次预收款',
- readOnly: true
- }, {
- xtype: 'hidden',
- name: 'rb_havebalance',
- fieldLabel: '已核销金额(元)'
- }, {
- xtype: "detailGridField",
- name: 'detail1',
- storeModel: 'saas.model.money.RecBalance1',
- detnoColumn: 'rd_detno',
- deleteDetailUrl: '/api/money/recbalance/deleteDetail1',
- columns: [{
- text: 'ID',
- dataIndex: 'id',
- hidden: true
- }, {
- text: '期间',
- dataIndex: 'rd_ym',
- defaultValue: Ext.Date.format(new Date(), 'Ym'),
- width: 110,
- hidden: true
- }, {
- text: '资金账户ID',
- dataIndex: 'rd_bankid',
- editor: {
- xtype: 'numberfield'
- },
- hidden: true
- }, {
- text: '资金账户编号',
- dataIndex: 'rd_bankcode',
- editor: {
- xtype: 'textfield'
- },
- hidden: true
- }, {
- text: '资金账户',
- dataIndex: 'rd_bankname',
- allowBlank: false,
- width: 200,
- editor: {
- xtype: 'bandinfoDbfindTrigger'
- }
- }, {
- text: "收款金额(元)",
- xtype: 'numbercolumn',
- dataIndex: "rd_amount",
- width: 110.0,
- allowBlank: false,
- editor: {
- xtype: "numberfield",
- decimalPrecision: 2
- },
- renderer: function(v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- },
- summaryType: 'sum',
- summaryRenderer: function(v, d, f, m) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- }
- }, {
- text: "结算方式",
- dataIndex: "rd_paymethod",
- width: 150.0,
- editor: {
- xtype: 'combo',
- queryMode: 'local',
- displayField: 'display',
- valueField: 'value',
- store: Ext.create('Ext.data.Store', {
- fields: ['value', 'display'],
- data: [{
- value: "信用卡",
- display: "信用卡"
- }, {
- value: "支票",
- display: "支票"
- }, {
- value: "汇票",
- display: "汇票"
- }, {
- value: "现金",
- display: "现金"
- }, {
- value: "银行转账",
- display: "银行转账"
- }, {
- value: "支付宝转账",
- display: "支付宝转账"
- }, {
- value: "微信转账",
- display: "微信转账"
- }]
- })
- }
- }, {
- text: "结算号",
- dataIndex: "rd_paycode",
- editor: {
- xtype: 'textfield'
- }
- }, {
- text: "备注",
- dataIndex: "rd_remark",
- width: 250,
- editor: {
- xtype: 'textfield'
- }
- }, {
- dataIndex: "rd_text1",
- text: "自定义字段1",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "rd_text2",
- text: "自定义字段2",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "rd_text3",
- text: "自定义字段3",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "rd_text4",
- text: "自定义字段4",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "rd_text5",
- text: "自定义字段5",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }]
- }, {
- xtype: "detailGridField",
- name: 'detail2',
- storeModel: 'saas.model.money.RecBalance2',
- detnoColumn: 'rbd_detno',
- allowEmpty: true,
- deleteDetailUrl: '/api/money/recbalance/deleteDetail2',
- columns: [{
- text: 'ID',
- dataIndex: 'id',
- hidden: true
- }, {
- text: '期间',
- dataIndex: 'rbd_ym',
- editor: {
- xtype: 'numberfield'
- },
- hidden: true
- }, {
- text: '来源ID',
- dataIndex: 'rbd_slid',
- editor: {
- xtype: 'numberfield'
- },
- hidden: true
- }, {
- text: '来源单号',
- dataIndex: 'rbd_slcode',
- width: 200,
- editor: {
- displayField: "display",
- editable: true,
- format: "",
- hideTrigger: false,
- maxLength: 100.0,
- minValue: null,
- positiveNum: false,
- queryMode: "local",
- store: null,
- valueField: "value",
- xtype: "oriOrderMutiDbfindTrigger",
- listeners: {
- beforetriggerclick: 'custnamechange'
- }
- }
- }, {
- text: "业务类型",
- dataIndex: "rbd_slkind",
- width: 110
- }, {
- text: "单据日期",
- dataIndex: "rbd_sldate",
- xtype: 'datecolumn',
- width: 110
- }, {
- text: "单据金额(元)",
- xtype: 'numbercolumn',
- dataIndex: "rbd_amount",
- width: 110,
- renderer: function(v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- },
- summaryType: 'sum',
- summaryRenderer: function(v, d, f, m) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- }
- }, {
- text: "已核销金额(元)",
- xtype: 'numbercolumn',
- dataIndex: "sl_yamount",
- width: 120,
- ignore: true,
- renderer: function(v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- },
- summaryType: 'sum',
- summaryRenderer: function(v, d, f, m) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- }
- }, {
- text: "未核销金额(元)",
- xtype: 'numbercolumn',
- dataIndex: "sl_namount",
- width: 120,
- ignore: true,
- renderer: function(v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- },
- summaryType: 'sum',
- summaryRenderer: function(v, d, f, m) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- }
- }, {
- text: "本次核销金额(元)",
- xtype: 'numbercolumn',
- dataIndex: "rbd_nowbalance",
- width: 140,
- editor: {
- xtype: "numberfield",
- decimalPrecision: 2
- },
- allowBlank: false,
- renderer: function(v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- },
- summaryType: 'sum',
- summaryRenderer: function(v, d, f, m) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- }
- }, {
- dataIndex: "rbd_text1",
- text: "自定义字段1",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "rbd_text2",
- text: "自定义字段2",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "rbd_text3",
- text: "自定义字段3",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "rbd_text4",
- text: "自定义字段4",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "rbd_text5",
- text: "自定义字段5",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }]
- }, {
- xtype: 'textfield',
- name: 'rb_remark',
- fieldLabel: '备注',
- columnWidth: 1
- }, {
- xtype: "hidden",
- name: "creatorId",
- fieldLabel: "录入人ID",
- readOnly: true
- }, {
- xtype: "textfield",
- name: "creatorName",
- fieldLabel: "录入人",
- readOnly: true
- }, {
- xtype: "datefield",
- name: "createTime",
- fieldLabel: "录入日期",
- readOnly: true,
- defaultValue: new Date()
- }, {
- xtype: "hidden",
- name: "updaterId",
- fieldLabel: "更新人ID",
- readOnly: true
- }, {
- xtype: "hidden",
- name: "updaterName",
- fieldLabel: "更新人",
- readOnly: true
- }, {
- xtype: "hidden",
- name: "updateTime",
- fieldLabel: "更新日期",
- readOnly: true,
- defaultValue: new Date()
- }, {
- xtype: 'textfield',
- name: 'rb_auditman',
- fieldLabel: '审核人',
- readOnly: true
- }, {
- xtype: "datefield",
- name: "rb_auditdate",
- fieldLabel: "审核日期",
- readOnly: true
- }, {
- xtype: "textfield",
- name: "rb_text1",
- fieldLabel: "自定义字段1",
- hidden: true,
- initHidden: false
- }, {
- xtype: "textfield",
- name: "rb_text2",
- fieldLabel: "自定义字段2",
- hidden: true,
- initHidden: false
- }, {
- xtype: "textfield",
- name: "rb_text3",
- fieldLabel: "自定义字段3",
- hidden: true,
- initHidden: false
- }, {
- xtype: "textfield",
- name: "rb_text4",
- fieldLabel: "自定义字段4",
- hidden: true,
- initHidden: false
- }, {
- xtype: "textfield",
- name: "rb_text5",
- fieldLabel: "自定义字段5",
- hidden: true,
- initHidden: false
- }],
- });
- this.callParent(arguments);
- },
- beforeAudit: function () {
- var form = this,
- idField = form._idField,
- controller = form.getController(),
- viewModel = form.getViewModel(),
- id = viewModel.get(idField);
- store1 = viewModel.get('detail0').detailStore,
- store2 = viewModel.get('detail1').detailStore;
- // 已保存过的单据不进行此项校验
- if (id) {
- return true;
- }
- var sum_rd_amount = store1.sum('rd_amount'); // 付款金额合计
- var rb_discounts = viewModel.get('rb_discounts'); // 折扣金额
- var sum_rbd_nowbalance = store2.sum('rbd_nowbalance'); // 本次核销金额合计
- var flag = sum_rd_amount + rb_discounts - sum_rbd_nowbalance;
- viewModel.set("rb_preamount", flag);
- if (flag != 0) {
- var t = flag > 0 ? '大' : '小';
- saas.util.BaseUtil.showConfirm('提示', '付款金额' + t + '于本次核销金额,是否仍要保存并审核?')
- .then(function (y) {
- if (y == 'yes') {
- controller.audit();
- }
- });
- } else {
- controller.audit();
- }
- return false;
- }
- });
|