Ext.define('saas.view.money.verification.FormPanel', { extend: 'saas.view.core.form.FormPanel', xtype: 'money-verification-formpanel', controller: 'money-verification-formpanel', viewModel: 'money-verification-formpanel', viewName: 'money-verification-formpanel', caller: 'Verification', //字段属性 _title: '核销单', _idField: 'id', _codeField: 'vc_code', _statusField: 'vc_status', _statusCodeField: 'vc_statuscode', _auditmanField: 'vc_auditman', _auditdateField: 'vc_auditdate', _readUrl: '/api/money/verification/read', _saveUrl: '/api/money/verification/save', _auditUrl: '/api/money/verification/audit', _unAuditUrl: '/api/money/verification/unAudit', _deleteUrl: '/api/money/verification/delete', defatulType: 'receipts_offset_receivable', initComponent: function () { this.initEtcConfig(); this.callParent(arguments); }, initFormItems: function () { this.initEtcConfig(); var me = this, defaultItems = me.getAcitveItems(), FormUtil = saas.util.FormUtil; me.defaultItems = Ext.Array.clone(defaultItems); me.detailCount = 0; me.setLoading(true); saas.util.ViewUtil.getViewConfig(me.viewName) .then(function (cfg) { me.setLoading(false); let items = defaultItems || []; me.cusCfg = cfg; items = FormUtil.initItems(items); items = FormUtil.applyCusMainItemConfig(items, cfg); items = FormUtil.applyCusDetailItemConfig(items, cfg); me.configItems = items; items = FormUtil.applyDefaultItems(me, items); me.removeAll(); return me.addItems(items); }) .then(function (items) { me.fireEvent('afterSetItems', me, items); }) .then(function () { if(me.initId != 0) { FormUtil.loadData(me); }else { // 防止新增打开界面取两次编号 if(!me._loaded) { me._loaded = true; FormUtil.loadData(me); }else { let viewModel = me.getViewModel(); let code = viewModel.get(me._codeField); let detailGrids = me.query('detailGridField'); let o = {}; o[me._codeField] = code; let formData = {main: {}}; Ext.apply(formData.main, o); Ext.Array.each(detailGrids, function(grid, index) { let detno = 0; let detnoColumn = grid.detnoColumn; let datas = []; let emptyRows = grid.emptyRows; Ext.Array.each(new Array(emptyRows), function() { detno += 1; let data = {}; data[detnoColumn] = detno; datas.push(data); }) formData['detail' + index] = datas; }); me.initFormData(formData); me.fireEvent('load', me, formData); } } }) }, getAcitveItems: function () { var me = this, acitveType = me.acitveType || me.defatulType, etc = me.etc, acitveEtc = etc[acitveType], mainItems = acitveEtc.main, details = acitveEtc.details, base = etc.base, detail1 = etc.detail1, detail2 = etc.detail2, other = etc.other, items = []; base[0].defaultValue = acitveType; items = Ext.Array.merge(base, mainItems, (details[0] ? [detail1] : []), (details[1] ? [detail2] : []), other); me.viewName = 'money-verification-formpanel-' + acitveType; return items; }, initEtcConfig: function () { Ext.apply(this, { etc: { /** * 预收:receipts * 预付:prepaid * 应收:receivable * 应付:payable */ // base base: [{ xtype: 'combo', name: 'vc_kind', fieldLabel: '业务类型', allowBlank: false, editable: false, store: [ ['receipts_offset_receivable', '预收冲应收'], ['prepaid_offset_payable', '预付冲应付'], ['receivable_offset_payable', '应收冲应付'], ['receivable_to_receivable', '应收转应收'], ['payable_to_payable', '应付转应付'] ], listeners: { beforerender: function (f) { f.firstLoad = true; if (f.ownerCt.initId != 0) { f.setReadOnly(true); f.setDisabled(true); } } } }], detail1: { xtype: "detailGridField", name: 'detail1', storeModel: 'saas.model.money.Verification1', detnoColumn: 'vd_detno', deleteDetailUrl: '/api/money/verification/deleteDetail1', columnWidth: 1, columns: [{ text: 'ID', dataIndex: 'id', hidden: true }, { text: '来源ID', dataIndex: 'vd_slid', hidden: true }, { text: '来源单号', dataIndex: 'vd_slcode', width: 150, allowBlank: false, editor: { displayField: "display", editable: true, format: "", hideTrigger: false, maxLength: 100.0, minValue: null, positiveNum: false, queryMode: "local", store: null, valueField: "value", xtype: "oriOrderMutiDbfindTrigger" } }, { text: '业务类型', dataIndex: "vd_slkind", width: 110 }, { text: "单据日期", dataIndex: "vd_sldate", xtype: 'datecolumn', width: 110 }, { text: "单据金额(元)", xtype: 'numbercolumn', dataIndex: "vd_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: "vd_nowbalance", width: 150, 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: "vd_text1", text: "自定义字段1", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "vd_text2", text: "自定义字段2", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "vd_text3", text: "自定义字段3", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "vd_text4", text: "自定义字段4", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "vd_text5", text: "自定义字段5", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }] }, detail2: { xtype: "detailGridField", name: 'detail2', storeModel: 'saas.model.money.Verification2', detnoColumn: 'vcd_detno', deleteDetailUrl: '/api/money/verification/deleteDetail2', columnWidth: 1, columns: [{ text: 'ID', dataIndex: 'id', hidden: true }, { text: '来源ID', dataIndex: 'vcd_slid', hidden: true }, { text: '来源单号', dataIndex: 'vcd_slcode', width: 150, allowBlank: false, editor: { displayField: "display", editable: true, format: "", hideTrigger: false, maxLength: 100.0, minValue: null, positiveNum: false, queryMode: "local", store: null, valueField: "value", xtype: "oriOrderMutiDbfindTrigger" } }, { text: '业务类型', dataIndex: "vcd_slkind", width: 110 }, { text: "单据日期", dataIndex: "vcd_sldate", xtype: 'datecolumn', width: 110 }, { text: "单据金额(元)", xtype: 'numbercolumn', dataIndex: "vcd_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: "本次核销金额(元)", dataIndex: "vcd_nowbalance", xtype: 'numbercolumn', width: 150, 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); } }, { dataIndex: "vcdtext1", text: "自定义字段1", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "vcdtext2", text: "自定义字段2", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "vcdtext3", text: "自定义字段3", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "vcdtext4", text: "自定义字段4", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "vcdtext5", text: "自定义字段5", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }] }, other: [{ xtype: 'textfield', name: 'vc_remark', columnWidth: 1, fieldLabel: '备注' }, { 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: 'vc_auditman', fieldLabel: '审核人', readOnly: true }, { xtype: "datefield", name: "vc_auditdate", fieldLabel: "审核日期", readOnly: true }, { xtype: "textfield", name: "vc_text1", fieldLabel: "自定义字段1", hidden: true, initHidden: false }, { xtype: "textfield", name: "vc_text2", fieldLabel: "自定义字段2", hidden: true, initHidden: false }, { xtype: "textfield", name: "vc_text3", fieldLabel: "自定义字段3", hidden: true, initHidden: false }, { xtype: "textfield", name: "vc_text4", fieldLabel: "自定义字段4", hidden: true, initHidden: false }, { xtype: "textfield", name: "vc_text5", fieldLabel: "自定义字段5", hidden: true, initHidden: false }], // 预收冲应收 receipts_offset_receivable: { main: [{ xtype: 'hidden', fieldLabel: '客户名称', name: 'vc_custid', allowBlank: false, listeners: { change: 'clearDetails' } }, { fieldLabel: '客户编号', xtype: 'hidden', name: 'vc_custcode', }, { fieldLabel: '客户名称', xtype: 'customerDbfindTrigger', name: 'vc_custname', allowBlank: false }, { xtype: 'condbfindtrigger', fieldLabel: '币别汇率', allowBlank: false, dbType: 'currencyDbfindTrigger', dbfinds: [{ from: 'cr_name', to: 'vc_currency' }, { from: 'cr_rate', to: 'vc_rate' }], // listeners: { // change: 'clearDetails' // }, supFieldConfig: { xtype: 'numberfield', readOnly: false, defaultReadOnly: false, decimalPrecision: 6, vtype: 'positiveNumber', listeners: { change: function(f, v) { var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency'); f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency); } } }, }, { fieldLabel: '日期', xtype: 'datefield', defaultValue: new Date(), allowBlank: false, name: 'vc_date' },{ xtype: 'hidden', name: 'vc_amount1', thousandSeparator: ',', fieldLabel: '核销金额(元)' }, { xtype: "hidden", name: "vc_amount2", thousandSeparator: ',', fieldLabel: "未核销金额(元)" }], details: ['detail1', 'detail2'], other: ['other'] }, // 预付冲应付 prepaid_offset_payable: { main: [{ xtype: 'hidden', name: 'vc_vendid', fieldLabel: '供应商名称', allowBlank: false, listeners: { change: 'clearDetails' } }, { xtype: "hidden", name: "vc_vendcode", fieldLabel: "供应商编号" }, { xtype: "vendorDbfindTrigger", name: "vc_vendname", fieldLabel: "供应商名称", allowBlank: false }, { xtype: 'condbfindtrigger', fieldLabel: '币别汇率', allowBlank: false, dbType: 'currencyDbfindTrigger', dbfinds: [{ from: 'cr_name', to: 'vc_currency' }, { from: 'cr_rate', to: 'vc_rate' }], // listeners: { // change: 'clearDetails' // }, supFieldConfig: { xtype: 'numberfield', readOnly: false, defaultReadOnly: false, decimalPrecision: 6, vtype: 'positiveNumber', listeners: { change: function(f, v) { var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency'); f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency); } } }, }, { fieldLabel: '日期', xtype: 'datefield', defaultValue: new Date(), allowBlank: false, name: 'vc_date' }, { xtype: 'hidden', name: 'vc_amount1', thousandSeparator: ',', fieldLabel: '核销金额(元)' }, { xtype: "hidden", name: "vc_amount2", thousandSeparator: ',', fieldLabel: "未核销金额(元)" }], details: ['detail1', 'detail2'], other: ['other'] }, // 应收冲应付 receivable_offset_payable: { main: [{ fieldLabel: '客户名称', xtype: 'textfield', name: 'vc_custid', hidden: true, listeners: { change: 'clearDetail0' } }, { fieldLabel: '客户编号', xtype: 'textfield', name: 'vc_custcode', hidden: true }, { fieldLabel: '客户名称', xtype: 'customerDbfindTrigger', name: 'vc_custname', allowBlank: false }, { xtype: 'hidden', name: 'vc_vendid', fieldLabel: '供应商', listeners: { change: 'clearDetail1' } }, { xtype: "hidden", name: "vc_vendcode", fieldLabel: "供应商编号" }, { xtype: "vendorDbfindTrigger", name: "vc_vendname", fieldLabel: "供应商名称", allowBlank: false, dbfinds: [{ from: 'id', to: 'vc_vendid', ignore: true }, { from: 've_code', to: 'vc_vendcode' }, { from: 've_name', to: 'vc_vendname' }] }, { xtype: 'condbfindtrigger', fieldLabel: '币别汇率', allowBlank: false, dbType: 'currencyDbfindTrigger', dbfinds: [{ from: 'cr_name', to: 'vc_currency' }, { from: 'cr_rate', to: 'vc_rate' }], // listeners: { // change: 'clearDetails' // }, supFieldConfig: { xtype: 'numberfield', readOnly: false, defaultReadOnly: false, decimalPrecision: 6, vtype: 'positiveNumber', listeners: { change: function(f, v) { var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency'); f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency); } } }, }, { fieldLabel: '日期', xtype: 'datefield', defaultValue: new Date(), allowBlank: false, name: 'vc_date' },{ xtype: 'hidden', name: 'vc_amount1', thousandSeparator: ',', fieldLabel: '核销金额(元)' }, { xtype: "hidden", name: "vc_amount2", thousandSeparator: ',', fieldLabel: "未核销金额(元)" }], details: ['detail1', 'detail2'], other: ['other'] }, // 应收转应收 receivable_to_receivable: { main: [{ fieldLabel: '转出客户', xtype: 'textfield', name: 'vc_custid', hidden: true, listeners: { change: 'clearDetail0' } }, { fieldLabel: '转出客户编号', xtype: 'textfield', name: 'vc_custcode', hidden: true }, { fieldLabel: '转出客户', xtype: 'customerDbfindTrigger', name: 'vc_custname', allowBlank: false, }, { fieldLabel: '转入客户id', xtype: 'textfield', name: 'vc_turncustid', hidden: true }, { fieldLabel: '转入客户编号', xtype: 'textfield', name: 'vc_turncustcode', hidden: true }, { fieldLabel: '转入客户', xtype: 'customerDbfindTrigger', name: 'vc_turncustname', allowBlank: false, }, { xtype: 'condbfindtrigger', fieldLabel: '币别汇率', allowBlank: false, dbType: 'currencyDbfindTrigger', dbfinds: [{ from: 'cr_name', to: 'vc_currency' }, { from: 'cr_rate', to: 'vc_rate' }], // listeners: { // change: 'clearDetails' // }, supFieldConfig: { xtype: 'numberfield', readOnly: false, defaultReadOnly: false, decimalPrecision: 6, vtype: 'positiveNumber', listeners: { change: function(f, v) { var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency'); f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency); } } }, }, { fieldLabel: '日期', xtype: 'datefield', defaultValue: new Date(), allowBlank: false, name: 'vc_date' },{ xtype: 'hidden', name: 'vc_amount1', thousandSeparator: ',', fieldLabel: '核销金额(元)' }, { xtype: "hidden", name: "vc_amount2", thousandSeparator: ',', fieldLabel: "未核销金额(元)" }], details: ['detail1'], other: ['other'] }, // 应付转应付 payable_to_payable: { main: [{ fieldLabel: '转出供应商', xtype: 'textfield', name: 'vc_vendid', hidden: true, listeners: { change: 'clearDetail0' } }, { fieldLabel: '转出供应商编号', xtype: 'textfield', name: 'vc_vendcode', hidden: true }, { fieldLabel: '转出供应商', xtype: 'vendorDbfindTrigger', name: 'vc_vendname', allowBlank: false, }, { fieldLabel: '转入供应商id', xtype: 'textfield', name: 'vc_turnvendid', hidden: true }, { fieldLabel: '转入供应商编号', xtype: 'textfield', name: 'vc_turnvendcode', hidden: true }, { fieldLabel: '转入供应商', xtype: 'vendorDbfindTrigger', name: 'vc_turnvendname', allowBlank: false, }, { xtype: 'condbfindtrigger', fieldLabel: '币别汇率', allowBlank: false, dbType: 'currencyDbfindTrigger', dbfinds: [{ from: 'cr_name', to: 'vc_currency' }, { from: 'cr_rate', to: 'vc_rate' }], // listeners: { // change: 'clearDetails' // }, supFieldConfig: { xtype: 'numberfield', readOnly: false, defaultReadOnly: false, decimalPrecision: 6, vtype: 'positiveNumber', listeners: { change: function(f, v) { var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency'); f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency); } } }, },{ fieldLabel: '日期', xtype: 'datefield', defaultValue: new Date(), allowBlank: false, name: 'vc_date' }, { xtype: 'hidden', name: 'vc_amount1', thousandSeparator: ',', fieldLabel: '核销金额(元)' }, { xtype: "hidden", name: "vc_amount2", thousandSeparator: ',', fieldLabel: "未核销金额(元)" }], details: ['detail1'], other: ['other'] }, defaultConditions: { receipts_offset_receivable: ['ifnull(sl_currency,\'RMB\') = \'{vc_currency}\' and ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)<>0 and ifnull(sl_namount,0)<>0 ' + 'and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' + ' and ((sl_kind=\'收款单\') or ' + '( sl_id =(select sl_id from subledger where ifnull(sl_custid,0)={vc_custid} and sl_kind=\'期初余额\' ' + 'and sl_ym>=(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid) order by sl_ym limit 1)))', 'ifnull(sl_currency,\'RMB\') = \'{vc_currency}\' and ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0 ' + 'and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' + ' and (sl_kind in (\'出货单\',\'销售退货单\') or '+ '( sl_id =(select sl_id from subledger where ifnull(sl_custid,0)={vc_custid} and sl_kind=\'期初余额\' ' + 'and sl_ym>=(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid) order by sl_ym limit 1)))' ], prepaid_offset_payable: ['ifnull(sl_currency,\'RMB\') = \'{vc_currency}\' and ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)<>0 and ifnull(sl_namount,0)<>0 ' + 'and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' + ' and ((sl_kind=\'付款单\') or ' + '( sl_id =(select sl_id from subledger where ifnull(sl_vendid,0)={vc_vendid} and sl_kind=\'期初余额\'' + 'and sl_ym>=(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid) order by sl_ym limit 1)))', 'ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0' + 'and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' + ' and (sl_kind in (\'采购验收单\',\'采购验退单\') or (' + '( sl_id =(select sl_id from subledger where ifnull(sl_vendid,0)={vc_vendid} and sl_kind=\'期初余额\'' + 'and sl_ym>=(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid) order by sl_ym limit 1)))' ], receivable_offset_payable: ['ifnull(sl_currency,\'RMB\') = \'{vc_currency}\' and ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0 ' + 'and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' + ' and ((sl_kind in (\'出货单\',\'销售退货单\')) or ' + '( sl_id =(select sl_id from subledger where ifnull(sl_custid,0)={vc_custid} and sl_kind=\'期初余额\' ' + 'and sl_ym>=(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid) order by sl_ym limit 1)))', 'ifnull(sl_currency,\'RMB\') = \'{vc_currency}\' and ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0' + 'and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' + ' and (sl_kind in (\'采购验收单\',\'采购验退单\') or ' + '( sl_id =(select sl_id from subledger where ifnull(sl_vendid,0)={vc_vendid} and sl_kind=\'期初余额\' ' + 'and sl_ym>=(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid) order by sl_ym limit 1)))' ], receivable_to_receivable: ['ifnull(sl_currency,\'RMB\') = \'{vc_currency}\' and ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0 ' + 'and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' + ' and ((sl_kind in (\'出货单\',\'销售退货单\')) or' + '( sl_id =(select sl_id from subledger where ifnull(sl_custid,0)={vc_custid} and sl_kind=\'期初余额\' ' + 'and sl_ym>=(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid) order by sl_ym limit 1)))' ], payable_to_payable: ['ifnull(sl_currency,\'RMB\') = \'{vc_currency}\' and ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0' + 'and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' + ' and (sl_kind in (\'采购验收单\',\'采购验退单\') or ' + '( sl_id =(select sl_id from subledger where ifnull(sl_vendid,0)={vc_vendid} and sl_kind=\'期初余额\' ' + 'and sl_ym>=(select min(pd_detno) from periodsdetail where pd_status=0 and periodsdetail.companyid=subledger.companyid) order by sl_ym limit 1)))' ] } }, }); } });