| | |
| | | } |
| | | } |
| | | |
| | | .table-col-1, .table-col-2, .table-col-3, .table-col-4 { |
| | | .ant-table colgroup > col.ant-table-selection-col { |
| | | width: 40px!important; |
| | | } |
| | | } |
| | | .table-col-5, .table-col-6, .table-col-7 { |
| | | .ant-table colgroup > col.ant-table-selection-col { |
| | | width: 50px!important; |
| | | } |
| | | } |
| | | |
| | | /* 设置iconfont标签font-family */ |
| | | [class^="icon-"],[class*=" icon-"] { |
| | | font-family: "iconfont"; |
| | |
| | | {datatype === 'statistics' ? <EditTable actions={['edit', 'move', 'del']} data={plot.colors || []} columns={ramp ==='true' ? rampStatColorColumns : statColorColumns} onChange={this.changeColor}/> : null} |
| | | {datatype !== 'statistics' ? <EditTable actions={['edit']} data={plot.colors || []} columns={ramp ==='true' ? rampColorColumns : colorColumns} onChange={this.changeColor}/> : null} |
| | | {plot.chartType === 'bar' && plot.datatype === 'query' ? <div className="mk-bar-colors"> |
| | | <p>柱形颜色:可根据柱图序号设置颜色。注:使用自定义图形设置或多根柱图时无效</p> |
| | | <p>柱形颜色:可根据柱图序号设置颜色(请设置柱形宽度)。注:使用自定义图形设置或多根柱图时无效。</p> |
| | | <div className="bar-color-add"><PlusOutlined onClick={this.addbarColor}/></div> |
| | | <EditTable actions={['edit', 'move', 'del']} data={plot.barcolors || []} columns={barColorColumns} onChange={this.changebarColor}/> |
| | | </div> : null} |
| | |
| | | } |
| | | |
| | | return ( |
| | | <div className={`normal-table-columns ${config.setting.laypage} ${config.wrap.tableType} ${config.wrap.mode || ''} table-vertical-${config.wrap.vertical || ''}`} id={tableId}> |
| | | <div className={`normal-table-columns ${config.setting.laypage} ${config.wrap.tableType} ${config.wrap.mode || ''} table-vertical-${config.wrap.vertical || ''} table-col-${columns.length}`} id={tableId}> |
| | | <div className="col-control"> |
| | | <FieldsComponent config={config} type="columns" /> |
| | | <CopyOutlined title="复制显示列" onClick={this.copycolumn} /> |
| | |
| | | const columns = this.handlecolumns(this.state.columns, fields, config) |
| | | |
| | | return ( |
| | | <div className={`normal-table-columns ${config.setting.laypage} ${config.wrap.tableType} ${config.wrap.mode || ''} table-vertical-${config.wrap.vertical || ''}`} id={tableId}> |
| | | <div className={`normal-table-columns ${config.setting.laypage} ${config.wrap.tableType} ${config.wrap.mode || ''} table-vertical-${config.wrap.vertical || ''} table-col-${columns.length}`} id={tableId}> |
| | | <div className="col-control"> |
| | | <CopyOutlined title="复制显示列" onClick={this.copycolumn} /> |
| | | <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> |
| | |
| | | barcolors[item[plot.Xaxis]] = plot.barcolors[i].color |
| | | } |
| | | }) |
| | | } else { |
| | | barcolors = null |
| | | } |
| | | |
| | | const ds = new DataSet() |
| | |
| | | |
| | | if (plot.$colors) { |
| | | let limit = chartColors.length |
| | | _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => { |
| | | if (barcolors[label]) { |
| | | return barcolors[label] |
| | | } else if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | |
| | | if (barcolors) { |
| | | _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => { |
| | | if (barcolors[label]) { |
| | | return barcolors[label] |
| | | } else if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } else { |
| | | _chart.color(`${_typefield}`, (key) => { |
| | | if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | _chart.color(_typefield) |
| | | } |
| | |
| | | |
| | | if (plot.$colors) { |
| | | let limit = chartColors.length |
| | | _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => { |
| | | if (barcolors[label]) { |
| | | return barcolors[label] |
| | | } else if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | if (barcolors) { |
| | | _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => { |
| | | if (barcolors[label]) { |
| | | return barcolors[label] |
| | | } else if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } else { |
| | | _chart.color(`${_typefield}`, (key) => { |
| | | if (plot.$colors.has(key)) { |
| | | return plot.$colors.get(key) |
| | | } else { |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | _chart.color(_typefield) |
| | | } |
| | |
| | | remarkVisible: false, |
| | | attachments: 0, |
| | | title: '', |
| | | delItems: [], |
| | | orgcode: '', |
| | | orgname: '', |
| | | status: '' // 新建时,empty、change、saved |
| | | } |
| | | |
| | |
| | | |
| | | window.GLOB.CacheVoucher.delete(config.uuid) |
| | | let type = config.wrap.type || 'createVoucher' |
| | | |
| | | type = 'checkVoucher' |
| | | |
| | | this.setState({ |
| | | config: fromJS(config).toJS(), |
| | |
| | | |
| | | this.setState({ book: data, vouDate }, () => { |
| | | this.loadData() |
| | | this.getVoucher() |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (!config.wrap.supModule || config.wrap.supModule !== MenuID) return |
| | | if (id !== this.state.BID || id !== '') { |
| | | this.setState({ BID: id, BData: data }, () => { |
| | | this.setState({ BID: id }, () => { |
| | | this.getVoucher() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | loadData = () => { |
| | | const { book, config } = this.state |
| | | const { book, config, type } = this.state |
| | | |
| | | if (!book) return |
| | | |
| | |
| | | } |
| | | |
| | | let typeOptions = res.char || [] |
| | | if (type === 'createVoucher') { |
| | | let charInt = typeOptions[0] ? typeOptions[0].voucher_char_int + 1 : 1 |
| | | |
| | | this.setState({ |
| | | typeOptions: typeOptions, |
| | | charType: typeOptions[0] ? typeOptions[0].voucher_class : '', |
| | | charName: typeOptions[0] ? typeOptions[0].voucher_char : '', |
| | | charInt: typeOptions[0] ? typeOptions[0].voucher_char_int : '', |
| | | }) |
| | | this.setState({ |
| | | typeOptions: typeOptions, |
| | | charType: typeOptions[0] ? typeOptions[0].voucher_class : '', |
| | | charName: typeOptions[0] ? typeOptions[0].voucher_char : '', |
| | | charInt: charInt, |
| | | orgcode: res.orgcode, |
| | | orgname: res.orgname, |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | typeOptions: typeOptions |
| | | }) |
| | | } |
| | | |
| | | let names = {} |
| | | let supplier = [] |
| | |
| | | let inventory = [] |
| | | let employee = [] |
| | | let cash_flow = [] |
| | | let others = [] |
| | | |
| | | res.sup && res.sup.forEach(item => { |
| | | names[item.sup_type_code] = item.sup_type_name |
| | |
| | | cash_flow.push({value: item.cash_flow_code, label: item.cash_flow_name}) |
| | | }) |
| | | |
| | | res.others && res.others.forEach(item => { |
| | | others.push({value: item.sup_acc_code, label: item.sup_acc_name, parentId: item.sup_acc_type}) |
| | | }) |
| | | |
| | | let message = { |
| | | subjects: res.subjects || [], |
| | | names: names, |
| | |
| | | currency: res.currency || [], |
| | | employee: employee, |
| | | cash_flow: cash_flow, |
| | | orgcode: res.orgcode, |
| | | orgname: res.orgname, |
| | | others: others, |
| | | account_code: res.account_code, |
| | | account_year_code: res.account_year_code |
| | | } |
| | |
| | | } |
| | | |
| | | getVoucher = () => { |
| | | const { BID, type } = this.state |
| | | // const { book, BID, type } = this.state |
| | | const { book, type } = this.state |
| | | |
| | | if (!BID || type === 'createVoucher' || type === 'createTemp') return |
| | | // if (!book || !BID || type === 'createVoucher' || type === 'createTemp') return |
| | | if (!book || type === 'createVoucher' || type === 'createTemp') return |
| | | |
| | | let param = { |
| | | func: 's_get_fcc_voucher', |
| | | BID: BID |
| | | BID: book.id, |
| | | // ID: BID |
| | | ID: '20230207175535042UOMRLECLIVPKOBU7L2N' |
| | | } |
| | | |
| | | let data = [ |
| | | {remark: '提现', subjectscode: '1001', subjectsname: '库存现金', debtor: 124, creditor: ''}, |
| | | {remark: '购入固定资产', subjectscode: '1001', subjectsname: '库存现金', debtor: '', creditor: 124}, |
| | | {remark: '转结销售成本', subjectscode: '1001', subjectsname: '库存现金', debtor: -524, creditor: ''}, |
| | | {remark: '提现', subjectscode: '1001', subjectsname: '库存现金', debtor: 34, creditor: '', i: Math.random()}, |
| | | ] |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (!res.status) { |
| | |
| | | return |
| | | } |
| | | |
| | | let data = [] |
| | | if (res.voucher) { |
| | | data = res.voucher.map(line => { |
| | | line.uuid = line.subject_id || '' |
| | | |
| | | if (line.direction_type === 'credit') { |
| | | line.credit = line.net_amount || 0 |
| | | line.debit = '' |
| | | } else { |
| | | line.debit = line.net_amount || 0 |
| | | line.credit = '' |
| | | } |
| | | |
| | | line.unitratio = line.foreign_unitratio || 0 |
| | | line.exratecode = line.foreign_exratecode || '' |
| | | line.exratename = line.foreign_exratename || '' |
| | | line.local_currency = line.local_exratecode || '' |
| | | |
| | | if (line.unitratio && line.foreign_amount) { |
| | | line.foreign_currency_type = 'Y' |
| | | } |
| | | |
| | | if (line.net_unitprice && line.fcc_count) { |
| | | line.count_type = 'Y' |
| | | } |
| | | |
| | | if (line.sup) { |
| | | line.supAccounts = line.sup.map(cell => { |
| | | cell.uuid = cell.sup_id |
| | | return cell |
| | | }) |
| | | } |
| | | |
| | | return line |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | tbdata: fromJS(data).toJS() |
| | | vouDate: res.fibvoucherdate ? moment(res.fibvoucherdate, 'YYYY-MM-DD') : null, |
| | | charType: res.voucher_class, |
| | | charName: res.voucher_char, |
| | | charInt: res.voucher_char_int, |
| | | orgcode: res.orgcode, |
| | | orgname: res.orgname, |
| | | tbdata: fromJS(data).toJS(), |
| | | status: 'saved' |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | triggersave = (t) => { |
| | | const { tbdata, delItems } = this.state |
| | | const { tbdata } = this.state |
| | | |
| | | let err = '' |
| | | let tip = '' |
| | | let list = [] |
| | | let _Items = [...delItems] |
| | | |
| | | tbdata.forEach((line, index) => { |
| | | if (err) return |
| | | if (line.type === 'total') { |
| | | if (line.debtor !== line.creditor) { |
| | | if (line.debit !== line.credit) { |
| | | err = '借贷不平衡!' |
| | | } |
| | | return |
| | |
| | | |
| | | let _index = index + 1 |
| | | |
| | | if (!line.remark && !line.subjectscode && !line.debtor && line.debtor !== 0 && !line.creditor && line.creditor !== 0) { |
| | | if (!line.subject_voucher_text && !line.subject_code && !line.debit && line.debit !== 0 && !line.credit && line.credit !== 0) { |
| | | if (_index === 1) { |
| | | err = '第1行不可为空。' |
| | | } else if (line.$origin) { |
| | | _Items.push(line) |
| | | } |
| | | |
| | | return |
| | | } |
| | | |
| | | if (!line.remark) { |
| | | if (!line.subject_voucher_text) { |
| | | err = `第${_index}行,摘要不可为空。` |
| | | } else if (!line.subjectscode) { |
| | | } else if (!line.subject_code) { |
| | | err = `第${_index}行,科目不可为空。` |
| | | } else if (!line.debtor && line.debtor !== 0 && !line.creditor && line.creditor !== 0) { |
| | | } else if (!line.debit && line.debit !== 0 && !line.credit && line.credit !== 0) { |
| | | err = `第${_index}行,请输入金额。` |
| | | } else if (line.debtor === 0 || line.creditor === 0) { |
| | | } else if (line.debit === 0 || line.credit === 0) { |
| | | err = `第${_index}行,金额不能为0。` |
| | | } else if (line.foreign_currency_type === 'Y' && !line.origin) { |
| | | } else if (line.foreign_currency_type === 'Y' && !line.foreign_amount) { |
| | | err = `第${_index}行,原币不可为空或为0。` |
| | | } else if (line.sup_accounting) { |
| | | line.sup_accounting.split(',').forEach(item => { |
| | | if (!line[item]) { |
| | | } else if (line.sup_accounting && !line.supAccounts) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } else if (line.sup_accounting && line.supAccounts) { |
| | | line.supAccounts.forEach(item => { |
| | | if (item.sup_acc_type === 'supplier') { |
| | | if (!item.suppliercode || !item.suppliername) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'customer') { |
| | | if (!item.customercode || !item.customername) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'department') { |
| | | if (!item.co_pro_code || !item.co_pro_name) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'project') { |
| | | if (!item.projectcode || !item.projectname) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'inventory') { |
| | | if (!item.productcode || !item.productname) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'employee') { |
| | | if (!item.workercode || !item.workername) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (item.sup_acc_type === 'cash_flow') { |
| | | if (!item.cash_flow_code || !item.cash_flow_name) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | } else if (!item.sup_acc_type || !item.sup_acc_code || !item.sup_acc_name) { |
| | | err = `第${_index}行,请选择辅助核算。` |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (line.count_type === 'Y' && !err) { |
| | | if (!line.count) { |
| | | if (!line.fcc_count) { |
| | | tip += `第${_index}行,数量为空或为0!;` |
| | | } else if (line.price) { |
| | | if (line.debtor && line.debtor !== line.count * line.price) { |
| | | } else if (line.net_unitprice) { |
| | | if (line.debit && line.debit !== line.fcc_count * line.net_unitprice) { |
| | | tip += `第${_index}行,数量和金额不匹配!;` |
| | | } else if (line.creditor && line.creditor !== line.count * line.price) { |
| | | } else if (line.credit && line.credit !== line.fcc_count * line.net_unitprice) { |
| | | tip += `第${_index}行,数量和金额不匹配!;` |
| | | } |
| | | } |
| | |
| | | confirm({ |
| | | content: tip + '确认要保存吗?', |
| | | onOk() { |
| | | _this.voucherSave(list, _Items, t) |
| | | _this.voucherSave(list, t) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | this.voucherSave(list, _Items, t) |
| | | this.voucherSave(list, t) |
| | | } |
| | | } |
| | | |
| | | voucherSave = (list, items, t) => { |
| | | const { config, charInt, charType, vouDate, book, remark, charName, attachments, title } = this.state |
| | | voucherSave = (list, t) => { |
| | | const { data, config, charInt, charType, vouDate, book, remark, charName, attachments, title, orgcode, orgname } = this.state |
| | | |
| | | if (!book) { |
| | | notification.warning({ |
| | |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let message = window.GLOB.CacheVoucher.get(config.uuid) || {} |
| | | |
| | | let param = { |
| | | func: 's_fcc_voucher_addupt', |
| | |
| | | account_year_code: book.account_year_code || '', |
| | | voucher_type: config.wrap.voucherType || '', |
| | | voucher_type_text: config.wrap.voucherTypeText || '', |
| | | orgcode: message.orgcode || '', |
| | | orgname: message.orgname || '', |
| | | orgcode: orgcode || '', |
| | | orgname: orgname || '', |
| | | voucher_class: charType, |
| | | years: book.years, |
| | | business_type: config.wrap.businessType || '', |
| | |
| | | FullName: sessionStorage.getItem('Full_Name') || '', |
| | | attachments_int: attachments, |
| | | sup_data: '', |
| | | subject_data: '' |
| | | subject_data: '', |
| | | attachments_data: '' |
| | | } |
| | | |
| | | // subject_id,subject_voucher_code,voucher_lp,subject_code,subject_name |
| | | // ,subject_voucher_text,fcc_count,net_unitprice,unit,net_amount,direction_type |
| | | // id,deleted |
| | | // 附件列表 |
| | | |
| | | // subject_id,subject_voucher_code,voucher_lp,subject_code,subject_name,subject_voucher_text,fcc_count,net_unitprice,unit,net_amount,direction_type |
| | | // ,exratecode,exratename,unitratio,sup_accounting ,direction_type_count,src_amount,deleted,local_exratecode |
| | | |
| | | // sup_id,sup_voucher_code,sup_voucher_lp,voucher_sup_lp,sup_subject_code,sup_subject_name,sup_voucher_text,sup_direction_type,sup_net_amount,customercode,customername,suppliercode,suppliername,co_pro_code,co_pro_name,workercode,workername,project_code,project_name,productcode,productname,cash_flow_code,cash_flow_name,sup_acc_code_01,sup_acc_name_01,sup_acc_code_02,sup_acc_name_02,sup_acc_code_03,sup_acc_name_03,sup_acc_code_04,sup_acc_name_04,sup_acc_code_05,sup_acc_name_05,sup_acc_code_06,sup_acc_name_06,sup_acc_code_07,sup_acc_name_07,sup_acc_code_08,sup_acc_name_08,sup_acc_code_09,sup_acc_name_09,sup_acc_code_10,sup_acc_name_10,sup_bid |
| | | |
| | | // sup_id,sup_voucher_code,sup_voucher_lp,voucher_sup_lp,sup_subject_code,sup_subject_name,sup_voucher_text,sup_direction_type,sup_net_amount,customercode,customername,suppliercode,suppliername,co_pro_code,co_pro_name,workercode,workername,project_code,project_name,productcode,productname,cash_flow_code,cash_flow_name,sup_acc_code,sup_acc_name,sup_acc_type,sup_bid,deleted |
| | | // 辅助科目行id,新增时空,凭证行号空,辅助科目行号空,科目编码,科目名称,辅助科目摘要空,方向'debit'、'credit',行金额,客户编码,客户名称,供应商编码,供应商名称,部门编码,部门名称,职员编码,职员名称,项目编码,项目名称,产品编码,产品名称,现金编码,现金名称,自定义科目编码,自定义科目名称,辅助科目类型,凭证行ID,删除标记 |
| | | |
| | | let sup_data = [] |
| | | let voucherMap = new Map() |
| | | let supMap = new Map() |
| | | |
| | | data.forEach(item => { |
| | | voucherMap.set(item.uuid, item) |
| | | |
| | | if (item.sup_accounting && item.supAccounts) { |
| | | item.supAccounts.forEach(cell => { |
| | | if (!cell.sup_acc_type) return |
| | | |
| | | let _cell = {...cell} |
| | | |
| | | _cell.sup_voucher_code = item.subject_voucher_code || '' |
| | | _cell.sup_voucher_lp = item.voucher_lp || '' |
| | | _cell.sup_subject_code = item.subject_code || '' |
| | | _cell.sup_subject_name = item.subject_name || '' |
| | | _cell.sup_bid = item.uuid || '' |
| | | _cell.sup_direct = item.debit ? 'debit' : 'credit' |
| | | _cell.sup_net_amount = item.debit || item.credit |
| | | |
| | | supMap.set(item.uuid + cell.sup_acc_type, _cell) |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let subject_data = list.map(item => { |
| | | let count = item.count_type === 'Y' |
| | | let curr = item.foreign_currency_type === 'Y' |
| | | if (item.sup_accounting) { |
| | | item.sup_accounting.split(',').forEach(n => { |
| | | |
| | | let direct = item.debit ? 'debit' : 'credit' |
| | | |
| | | if (voucherMap.has(item.uuid)) { |
| | | voucherMap.delete(item.uuid) |
| | | } |
| | | if (item.sup_accounting && item.supAccounts) { |
| | | item.supAccounts.forEach(n => { |
| | | if (supMap.has(item.uuid + n.sup_acc_type)) { |
| | | supMap.delete(item.uuid + n.sup_acc_type) |
| | | } |
| | | |
| | | sup_data.push(`'${n.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${n.voucher_sup_lp || ''}','${item.subject_code}','${item.subject_name}','${n.sup_voucher_text || ''}','${direct}',${item.debit || item.credit},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${item.uuid}',0`) |
| | | }) |
| | | } |
| | | sup_data.push(`${item.uuid},sup_voucher_code,sup_voucher_lp,voucher_sup_lp,sup_subject_code,sup_subject_name,sup_voucher_text,sup_direction_type,sup_net_amount,customercode,customername,suppliercode,suppliername,co_pro_code,co_pro_name,workercode,workername,project_code,project_name,productcode,productname,cash_flow_code,cash_flow_name,sup_acc_code_01,sup_acc_name_01,sup_acc_code_02,sup_acc_name_02,sup_acc_code_03,sup_acc_name_03,sup_acc_code_04,sup_acc_name_04,sup_acc_code_05,sup_acc_name_05,sup_acc_code_06,sup_acc_name_06,sup_acc_code_07,sup_acc_name_07,sup_acc_code_08,sup_acc_name_08,sup_acc_code_09,sup_acc_name_09,sup_acc_code_10,sup_acc_name_10,sup_bid`) |
| | | return `${item.uuid},'','','${item.subjectscode}','${item.subjectsname}','${item.remark}',${count ? item.count || 0 : 0},${count ? item.price || 0 : 0},'${item.unit}',${item.debtor || item.creditor},'${item.debtor ? 'debit' : 'credit'}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debtor ? 1 : -1},${curr ? item.origin || 0 : 0},0,'${item.local_currency || ''}'` |
| | | return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}'` |
| | | }) |
| | | |
| | | items.forEach(item => { |
| | | voucherMap.forEach(item => { |
| | | let count = item.count_type === 'Y' |
| | | let curr = item.foreign_currency_type === 'Y' |
| | | subject_data.push(`${item.uuid},'','','${item.subjectscode}','${item.subjectsname}','${item.remark}',${count ? item.count || 0 : 0},${count ? item.price || 0 : 0},'${item.unit}',${item.debtor || item.creditor},'${item.debtor ? 'debit' : 'credit'}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debtor ? 1 : -1},${curr ? item.origin || 0 : 0},1,'${item.local_currency || ''}'`) |
| | | let direct = item.debit ? 'debit' : 'credit' |
| | | |
| | | subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}'`) |
| | | }) |
| | | |
| | | supMap.forEach(n => { |
| | | sup_data.push(`'${n.uuid}','${n.sup_voucher_code}','${n.sup_voucher_lp}','${n.voucher_sup_lp || ''}','${n.sup_subject_code}','${n.sup_subject_name}','${n.sup_voucher_text || ''}','${n.sup_direct}',${n.sup_net_amount},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${n.sup_bid}',1`) |
| | | }) |
| | | |
| | | param.subject_data = window.btoa(window.encodeURIComponent(subject_data.join(';un'))) |
| | | |
| | | if (param) { |
| | | return |
| | | } |
| | | param.sup_data = window.btoa(window.encodeURIComponent(sup_data.join(';un'))) |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (!res.status) { |
| | |
| | | status: 'empty', |
| | | remark: '', |
| | | tbdata: [], |
| | | delItems: [], |
| | | charInt: charInt + 1 |
| | | }) |
| | | MKEmitter.emit('cleartable', config.uuid) |
| | | } else { |
| | | this.setState({ |
| | | status: 'saved', |
| | | delItems: [], |
| | | data: fromJS(list).toJS() |
| | | }) |
| | | } |
| | | }) |
| | |
| | | this.setState({remark: val, remarkVisible: false}) |
| | | } |
| | | |
| | | dataChange = (data, item) => { |
| | | if (item) { |
| | | this.setState({ |
| | | status: 'change', |
| | | tbdata: data, |
| | | delItems: [...this.state.delItems, item] |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | status: 'change', |
| | | tbdata: data |
| | | }) |
| | | } |
| | | dataChange = (data) => { |
| | | this.setState({ |
| | | status: 'change', |
| | | tbdata: data |
| | | }) |
| | | } |
| | | |
| | | changeAttach = (val) => { |
| | |
| | | this.setState({attachments: _val}) |
| | | } |
| | | |
| | | triggermore = () => { |
| | | |
| | | } |
| | | |
| | | triggerclose = () => { |
| | | |
| | | } |
| | | |
| | | render() { |
| | | const { type, status, loading, config, typeOptions, charType, charInt, data, vouDate, username, remark, remarkVisible, attachments, title } = this.state |
| | | |
| | |
| | | <Button className="add-background header-btn" disabled={status === 'empty'} onClick={() => this.triggersave('add')}>保存并新增</Button> |
| | | <Button className="add-background header-btn" disabled={status === 'empty' || status === 'saved'} onClick={() => this.triggersave()}>保存</Button> |
| | | <Button className="print-background header-btn" disabled={status !== 'saved'} onClick={this.triggerprint}>打印</Button> |
| | | <Button className="out-background header-btn" onClick={this.triggerprint}>更多</Button> |
| | | <Button className="out-background header-btn" onClick={this.triggermore}>更多</Button> |
| | | </div> : null} |
| | | {type === 'checkVoucher' ? <div className="voucher-header"> |
| | | <Button className="add-background header-btn" disabled={status === 'empty' || status === 'saved'} onClick={() => this.triggersave()}>保存</Button> |
| | | <Button className="print-background header-btn" disabled={status !== 'saved'} onClick={this.triggerprint}>打印</Button> |
| | | <Button className="out-background header-btn" onClick={this.triggerclose}>关闭</Button> |
| | | </div> : null} |
| | | <div className="voucher-body"> |
| | | {type === 'createVoucher' ? <div className="pre-wrap"> |
| | | {type === 'createVoucher' || type === 'checkVoucher' ? <div className="pre-wrap"> |
| | | <div className="voucher-code"> |
| | | <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({charType: val, charName: option.props.charName, charInt: option.props.charint})}> |
| | | {typeOptions.map(option => |
| | |
| | | |
| | | class Accounting extends React.Component { |
| | | state = { |
| | | subAccounts: [], |
| | | record: null |
| | | subAccounts: [] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { data, tableId } = this.props |
| | | let subAccounts = data.sup_accounting.split(',') |
| | | let subAccounts = fromJS(data.supAccounts).toJS() |
| | | let msg = window.GLOB.CacheVoucher.get(tableId) || {} |
| | | let names = msg.names || {} |
| | | |
| | | subAccounts = subAccounts.map(n => { |
| | | let item = { |
| | | field: n, |
| | | label: names[n] || n, |
| | | initval: data[n] || '', |
| | | options: [] |
| | | } |
| | | |
| | | if (msg[n]) { |
| | | item.options = msg[n] |
| | | subAccounts = subAccounts.map(item => { |
| | | if (msg[item.field]) { |
| | | item.options = msg[item.field] |
| | | } else if (msg.others) { |
| | | item.options = msg.others.filter(cell => cell.parentId === item.field) |
| | | } else { |
| | | item.options = [] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({subAccounts: subAccounts, record: fromJS(data).toJS()}) |
| | | this.setState({subAccounts: subAccounts}) |
| | | } |
| | | |
| | | selectChange = (val, item) => { |
| | | this.setState({record: {...this.state.record, [item.field]: val || ''}}) |
| | | selectChange = (option, key) => { |
| | | this.setState({ |
| | | subAccounts: fromJS(this.state.subAccounts).toJS().map(cell => { |
| | | if (key === cell.field) { |
| | | cell.value = option.props.value |
| | | cell.name = option.props.name |
| | | } |
| | | return cell |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | getFields() { |
| | |
| | | defaultValue={item.initval} |
| | | dropdownMatchSelectWidth={false} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(val) => this.selectChange(val, item)} |
| | | onChange={(val, option) => this.selectChange(option, item.field)} |
| | | > |
| | | {item.options.map((option, i) => |
| | | <Select.Option key={i} value={option.value}>{option.label}</Select.Option> |
| | | <Select.Option key={i} name={option.label} value={option.value}>{option.label}</Select.Option> |
| | | )} |
| | | </Select> |
| | | </Form.Item> |
| | |
| | | } |
| | | |
| | | confirm = () => { |
| | | const { subAccounts, record } = this.state |
| | | const { data } = this.props |
| | | const { subAccounts } = this.state |
| | | |
| | | let empty = '' |
| | | subAccounts.forEach(item => { |
| | | if (!empty && !record[item.field]) { |
| | | if (!empty && !item.value) { |
| | | empty = item.label |
| | | } |
| | | }) |
| | |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | this.props.confirm(record) |
| | | let line = fromJS(data).toJS() |
| | | let account = {} |
| | | |
| | | subAccounts.forEach(item => { |
| | | if (item.field === 'supplier') { |
| | | account[item.field] = {suppliercode: item.value, suppliername: item.name} |
| | | } else if (item.field === 'customer') { |
| | | account[item.field] = {customercode: item.value, customername: item.name} |
| | | } else if (item.field === 'department') { |
| | | account[item.field] = {co_pro_code: item.value, co_pro_name: item.name} |
| | | } else if (item.field === 'project') { |
| | | account[item.field] = {projectcode: item.value, projectname: item.name} |
| | | } else if (item.field === 'inventory') { |
| | | account[item.field] = {productcode: item.value, productname: item.name} |
| | | } else if (item.field === 'employee') { |
| | | account[item.field] = {workercode: item.value, workername: item.name} |
| | | } else if (item.field === 'cash_flow') { |
| | | account[item.field] = {cash_flow_code: item.value, cash_flow_name: item.name} |
| | | } else { |
| | | account[item.field] = {sup_acc_code: item.value, sup_acc_name: item.name} |
| | | } |
| | | }) |
| | | |
| | | line.supAccounts = line.supAccounts.map(item => { |
| | | if (account[item.field]) { |
| | | item = {...item, ...account[item.field]} |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.props.confirm(line) |
| | | } |
| | | } |
| | | |
| | |
| | | let line = {...record} |
| | | line[col.field] = value |
| | | |
| | | if (col.field === 'debtor') { |
| | | line.creditor = '' |
| | | if (isNaN(line.debtor)) { |
| | | line.debtor = '' |
| | | if (col.field === 'debit') { |
| | | line.credit = '' |
| | | if (isNaN(line.debit)) { |
| | | line.debit = '' |
| | | } |
| | | } else { |
| | | line.debtor = '' |
| | | if (isNaN(line.creditor)) { |
| | | line.creditor = '' |
| | | line.debit = '' |
| | | if (isNaN(line.credit)) { |
| | | line.credit = '' |
| | | } |
| | | } |
| | | |
| | | if (line.count_type === 'Y' && line.count) { |
| | | if (line.debtor) { |
| | | line.price = Math.round(line.debtor / line.count * 10000) / 10000 |
| | | } else if (line.creditor) { |
| | | line.price = Math.round(line.creditor / line.count * 10000) / 10000 |
| | | if (line.count_type === 'Y' && line.fcc_count) { |
| | | if (line.debit) { |
| | | line.net_unitprice = Math.round(line.debit / line.fcc_count * 10000) / 10000 |
| | | } else if (line.credit) { |
| | | line.net_unitprice = Math.round(line.credit / line.fcc_count * 10000) / 10000 |
| | | } |
| | | } |
| | | |
| | | if (line.foreign_currency_type === 'Y' && line.origin) { |
| | | if (line.debtor) { |
| | | line.unitratio = Math.round(line.debtor / line.origin * 100000) / 100000 |
| | | } else if (line.creditor) { |
| | | line.unitratio = Math.round(line.creditor / line.origin * 100000) / 100000 |
| | | if (line.foreign_currency_type === 'Y' && line.foreign_amount) { |
| | | if (line.debit) { |
| | | line.unitratio = Math.round(line.debit / line.foreign_amount * 100000) / 100000 |
| | | } else if (line.credit) { |
| | | line.unitratio = Math.round(line.credit / line.foreign_amount * 100000) / 100000 |
| | | } |
| | | } |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | | |
| | | setTimeout(() => { |
| | | if (col.field === 'debtor' && (line.debtor || line.debtor === 0)) { |
| | | if (col.field === 'debit' && (line.debit || line.debit === 0)) { |
| | | MKEmitter.emit('nextLine', col, record) |
| | | } else if (col.field === 'creditor') { |
| | | } else if (col.field === 'credit') { |
| | | MKEmitter.emit('nextLine', col, record) |
| | | } else { |
| | | let cl = {remark: 'subjectscode', subjectscode: 'debtor', debtor: 'creditor'} |
| | | let cl = {subject_voucher_text: 'subject_code', subject_code: 'debit', debit: 'credit'} |
| | | MKEmitter.emit('tdFocus', cl[col.uuid] + record.uuid) |
| | | } |
| | | }, 50) |
| | |
| | | |
| | | if (record.type === 'total') return |
| | | |
| | | if (col.field === 'subjectscode') { |
| | | if (col.field === 'subject_code') { |
| | | this.setState({editing: true}, () => { |
| | | let node = document.getElementById(col.uuid + record.uuid) |
| | | node && node.click() |
| | |
| | | if (value !== record[col.field]) { |
| | | let line = {...record, [col.field]: value} |
| | | |
| | | if (col.field === 'debtor') { |
| | | line.creditor = '' |
| | | if (isNaN(line.debtor)) { |
| | | line.debtor = '' |
| | | if (col.field === 'debit') { |
| | | line.credit = '' |
| | | if (isNaN(line.debit)) { |
| | | line.debit = '' |
| | | } |
| | | } else { |
| | | line.debtor = '' |
| | | if (isNaN(line.creditor)) { |
| | | line.creditor = '' |
| | | line.debit = '' |
| | | if (isNaN(line.credit)) { |
| | | line.credit = '' |
| | | } |
| | | } |
| | | |
| | | if (line.count_type === 'Y' && line.count) { |
| | | if (line.debtor) { |
| | | line.price = Math.round(line.debtor / line.count * 10000) / 10000 |
| | | } else if (line.creditor) { |
| | | line.price = Math.round(line.creditor / line.count * 10000) / 10000 |
| | | if (line.count_type === 'Y' && line.fcc_count) { |
| | | if (line.debit) { |
| | | line.net_unitprice = Math.round(line.debit / line.fcc_count * 10000) / 10000 |
| | | } else if (line.credit) { |
| | | line.net_unitprice = Math.round(line.credit / line.fcc_count * 10000) / 10000 |
| | | } |
| | | } |
| | | |
| | | if (line.foreign_currency_type === 'Y' && line.origin) { |
| | | if (line.debtor) { |
| | | line.unitratio = Math.round(line.debtor / line.origin * 100000) / 100000 |
| | | } else if (line.creditor) { |
| | | line.unitratio = Math.round(line.creditor / line.origin * 100000) / 100000 |
| | | if (line.foreign_currency_type === 'Y' && line.foreign_amount) { |
| | | if (line.debit) { |
| | | line.unitratio = Math.round(line.debit / line.foreign_amount * 100000) / 100000 |
| | | } else if (line.credit) { |
| | | line.unitratio = Math.round(line.credit / line.foreign_amount * 100000) / 100000 |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | let line = {...record, ...option.props.extra} |
| | | |
| | | if (record.sup_accounting && !line.sup_accounting) { |
| | | record.sup_accounting.split(',').forEach(item => { |
| | | line[item] = '' |
| | | line.supAccounts = [] |
| | | |
| | | if (line.sup_accounting) { |
| | | let msg = window.GLOB.CacheVoucher.get(col.tableId) || {} |
| | | let names = msg.names || {} |
| | | |
| | | line.supAccounts = line.sup_accounting.split(',').map(item => { |
| | | return { |
| | | uuid: Utils.getguid(), |
| | | sup_acc_type: item, |
| | | field: item, |
| | | label: names[item] || item, |
| | | initval: '' |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | this.setState({visible: true}) |
| | | }, 100) |
| | | } else if (line.count_type === 'Y') { |
| | | this.setState({counting: true, value: line.count || 0}, () => { |
| | | this.setState({counting: true, value: line.fcc_count || 0}, () => { |
| | | let node = document.getElementById(col.uuid + record.uuid + 'count') |
| | | node && node.select() |
| | | }) |
| | |
| | | } else { |
| | | this.setState({editing: false, visible: false, counting: false, priceing: false}) |
| | | setTimeout(() => { |
| | | MKEmitter.emit('tdFocus', 'debtor' + record.uuid) |
| | | MKEmitter.emit('tdFocus', 'debit' + record.uuid) |
| | | }, 50) |
| | | } |
| | | } |
| | |
| | | this.setState({editing: false, visible: false}) |
| | | |
| | | if (res.count_type === 'Y') { |
| | | this.setState({counting: true, value: res.count || 0}, () => { |
| | | this.setState({counting: true, value: res.fcc_count || 0}, () => { |
| | | let node = document.getElementById(col.uuid + res.uuid + 'count') |
| | | node && node.select() |
| | | }) |
| | | } else { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('tdFocus', 'debtor' + res.uuid) |
| | | MKEmitter.emit('tdFocus', 'debit' + res.uuid) |
| | | }, 50) |
| | | } |
| | | } |
| | |
| | | record.count_type = '' |
| | | record.foreign_currency_type = '' |
| | | record.mnemonic_code = '' |
| | | record.subjectscode = '' |
| | | record.subjectsname = '' |
| | | record.sup_accounting.split(',').forEach(item => { |
| | | record[item] = '' |
| | | }) |
| | | |
| | | record.subject_code = '' |
| | | record.subject_name = '' |
| | | record.sup_accounting = '' |
| | | record.supAccounts = [] |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, record) |
| | | |
| | |
| | | const { col, record } = this.props |
| | | e.stopPropagation() |
| | | |
| | | this.setState({counting: true, value: record.count || 0}, () => { |
| | | this.setState({counting: true, value: record.fcc_count || 0}, () => { |
| | | let node = document.getElementById(col.uuid + record.uuid + 'count') |
| | | node && node.select() |
| | | }) |
| | |
| | | const { col, record } = this.props |
| | | e.stopPropagation() |
| | | |
| | | this.setState({priceing: true, value: record.price || 0}, () => { |
| | | this.setState({priceing: true, value: record.net_unitprice || 0}, () => { |
| | | let node = document.getElementById(col.uuid + record.uuid + 'price') |
| | | node && node.select() |
| | | }) |
| | |
| | | const { value } = this.state |
| | | |
| | | let line = {...record} |
| | | line.count = value || 0 |
| | | line.fcc_count = value || 0 |
| | | |
| | | if (isNaN(line.count)) { |
| | | line.count = 0 |
| | | if (isNaN(line.fcc_count)) { |
| | | line.fcc_count = 0 |
| | | } |
| | | |
| | | this.countChange(line) |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | | |
| | | this.setState({counting: false, priceing: true, value: line.price || 0}, () => { |
| | | this.setState({counting: false, priceing: true, value: line.net_unitprice || 0}, () => { |
| | | let node = document.getElementById(col.uuid + record.uuid + 'price') |
| | | node && node.select() |
| | | }) |
| | |
| | | this.setState({counting: false}) |
| | | |
| | | let line = {...record} |
| | | line.count = value || 0 |
| | | line.fcc_count = value || 0 |
| | | |
| | | if (isNaN(line.count)) { |
| | | line.count = 0 |
| | | if (isNaN(line.fcc_count)) { |
| | | line.fcc_count = 0 |
| | | } |
| | | |
| | | this.countChange(line) |
| | |
| | | const { value } = this.state |
| | | |
| | | let line = {...record} |
| | | line.price = value || 0 |
| | | line.net_unitprice = value || 0 |
| | | |
| | | if (isNaN(line.price)) { |
| | | line.price = 0 |
| | | if (isNaN(line.net_unitprice)) { |
| | | line.net_unitprice = 0 |
| | | } |
| | | |
| | | this.countChange(line) |
| | |
| | | |
| | | this.setState({priceing: false}) |
| | | setTimeout(() => { |
| | | MKEmitter.emit('tdFocus', 'debtor' + record.uuid) |
| | | MKEmitter.emit('tdFocus', 'debit' + record.uuid) |
| | | }, 50) |
| | | } |
| | | |
| | |
| | | this.setState({priceing: false}) |
| | | |
| | | let line = {...record} |
| | | line.price = value || 0 |
| | | line.net_unitprice = value || 0 |
| | | |
| | | if (isNaN(line.price)) { |
| | | line.price = 0 |
| | | if (isNaN(line.net_unitprice)) { |
| | | line.net_unitprice = 0 |
| | | } |
| | | |
| | | this.countChange(line) |
| | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | | |
| | | if (line.exratename === 'CNY') { |
| | | this.setState({curring: false, origining: true, value: line.origin || 0}, () => { |
| | | this.setState({curring: false, origining: true, value: line.foreign_amount || 0}, () => { |
| | | let node = document.getElementById(col.uuid + record.uuid + 'origin') |
| | | node && node.select() |
| | | }) |
| | |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, line) |
| | | |
| | | this.setState({ratioing: false, origining: true, value: line.origin || 0}, () => { |
| | | this.setState({ratioing: false, origining: true, value: line.foreign_amount || 0}, () => { |
| | | let node = document.getElementById(col.uuid + record.uuid + 'origin') |
| | | node && node.select() |
| | | }) |
| | |
| | | const { col, record } = this.props |
| | | e.stopPropagation() |
| | | |
| | | this.setState({origining: true, value: record.origin || 1}, () => { |
| | | this.setState({origining: true, value: record.foreign_amount || 1}, () => { |
| | | let node = document.getElementById(col.uuid + record.uuid + 'origin') |
| | | node && node.select() |
| | | }) |
| | |
| | | const { value } = this.state |
| | | |
| | | let line = {...record} |
| | | line.origin = value || 0 |
| | | line.foreign_amount = value || 0 |
| | | |
| | | if (isNaN(line.origin)) { |
| | | line.origin = 0 |
| | | if (isNaN(line.foreign_amount)) { |
| | | line.foreign_amount = 0 |
| | | } |
| | | |
| | | this.currencyChange(line) |
| | |
| | | this.setState({origining: false}) |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('tdFocus', 'debtor' + record.uuid) |
| | | MKEmitter.emit('tdFocus', 'debit' + record.uuid) |
| | | }, 50) |
| | | } |
| | | |
| | |
| | | this.setState({origining: false}) |
| | | |
| | | let line = {...record} |
| | | line.origin = value || 0 |
| | | line.foreign_amount = value || 0 |
| | | |
| | | if (isNaN(line.origin)) { |
| | | line.origin = 0 |
| | | if (isNaN(line.foreign_amount)) { |
| | | line.foreign_amount = 0 |
| | | } |
| | | |
| | | this.currencyChange(line) |
| | |
| | | } |
| | | |
| | | countChange = (line) => { |
| | | if (line.count && line.price) { |
| | | if (line.creditor) { |
| | | line.creditor = Math.round(line.count * line.price * 100) / 100 |
| | | if (line.fcc_count && line.net_unitprice) { |
| | | if (line.credit) { |
| | | line.credit = Math.round(line.fcc_count * line.net_unitprice * 100) / 100 |
| | | } else { |
| | | line.debtor = Math.round(line.count * line.price * 100) / 100 |
| | | line.debit = Math.round(line.fcc_count * line.net_unitprice * 100) / 100 |
| | | } |
| | | |
| | | if (line.foreign_currency_type === 'Y' && line.origin) { |
| | | if (line.debtor) { |
| | | line.unitratio = Math.round(line.debtor / line.origin * 100000) / 100000 |
| | | } else if (line.creditor) { |
| | | line.unitratio = Math.round(line.creditor / line.origin * 100000) / 100000 |
| | | if (line.foreign_currency_type === 'Y' && line.foreign_amount) { |
| | | if (line.debit) { |
| | | line.unitratio = Math.round(line.debit / line.foreign_amount * 100000) / 100000 |
| | | } else if (line.credit) { |
| | | line.unitratio = Math.round(line.credit / line.foreign_amount * 100000) / 100000 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | currencyChange = (line) => { |
| | | if (line.unitratio && line.origin) { |
| | | if (line.creditor) { |
| | | line.creditor = Math.round(line.unitratio * line.origin * 100) / 100 |
| | | if (line.unitratio && line.foreign_amount) { |
| | | if (line.credit) { |
| | | line.credit = Math.round(line.unitratio * line.foreign_amount * 100) / 100 |
| | | } else { |
| | | line.debtor = Math.round(line.unitratio * line.origin * 100) / 100 |
| | | line.debit = Math.round(line.unitratio * line.foreign_amount * 100) / 100 |
| | | } |
| | | |
| | | if (line.count_type === 'Y' && line.count) { |
| | | if (line.debtor) { |
| | | line.price = Math.round(line.debtor / line.count * 10000) / 10000 |
| | | } else if (line.creditor) { |
| | | line.price = Math.round(line.creditor / line.count * 10000) / 10000 |
| | | if (line.count_type === 'Y' && line.fcc_count) { |
| | | if (line.debit) { |
| | | line.net_unitprice = Math.round(line.debit / line.fcc_count * 10000) / 10000 |
| | | } else if (line.credit) { |
| | | line.net_unitprice = Math.round(line.credit / line.fcc_count * 10000) / 10000 |
| | | } |
| | | } |
| | | } |
| | |
| | | let colSpan = 1 |
| | | let extra = null |
| | | |
| | | if (col.field === 'remark') { |
| | | let val = record.remark || '' |
| | | if (col.field === 'subject_voucher_text') { |
| | | let val = record.subject_voucher_text || '' |
| | | |
| | | if (record.type === 'total') { |
| | | children = <div className="content-wrap" style={{lineHeight: '60px'}}>合计: {val}</div> |
| | |
| | | children = <div className="content-wrap" onClick={this.focus}>{val}</div> |
| | | } |
| | | } |
| | | } else if (col.field === 'subjectscode') { |
| | | } else if (col.field === 'subject_code') { |
| | | if (record.type === 'total') { |
| | | colSpan = 0 |
| | | } else { |
| | |
| | | children = <> |
| | | <Select |
| | | showSearch |
| | | defaultValue={record.subjectscode || ''} |
| | | defaultValue={record.subject_code || ''} |
| | | dropdownClassName="edit-table-dropdown" |
| | | id={col.uuid + record.uuid} |
| | | onBlur={this.onSelectBlur} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onSelect={this.onSelectChange} |
| | | > |
| | | {subjects.map((item, i) => (<Select.Option key={i} extra={item} value={item.subjectscode}>{item.subjectscode + ' ' + item.subjectsname}</Select.Option>))} |
| | | {subjects.map((item, i) => (<Select.Option key={i} extra={item} value={item.subject_code}>{item.subject_code + ' ' + item.subject_name}</Select.Option>))} |
| | | </Select> |
| | | <Popover overlayClassName="subject-pop-wrap" placement="bottom" title="" visible={visible} content={<Accounting confirm={this.confirm} cancel={this.cancel} tableId={col.tableId} data={record}/>}> |
| | | <span className="pop-anchor"></span> |
| | |
| | | </> |
| | | } else { |
| | | let val = '' |
| | | if (record.subjectscode) { |
| | | val = (record.subjectscode || '') + ' ' + (record.subjectsname || '') |
| | | if (record.subject_code) { |
| | | val = (record.subject_code || '') + ' ' + (record.subject_name || '') |
| | | |
| | | record.sup_accounting && record.sup_accounting.split(',').forEach(item => { |
| | | if (record[item]) { |
| | | val += '_' + record[item] |
| | | } |
| | | }) |
| | | if (record.sup_accounting && record.supAccounts) { |
| | | record.supAccounts.forEach(item => { |
| | | if (item.sup_acc_type === 'supplier') { |
| | | val += item.suppliercode ? '_' + item.suppliercode : '' |
| | | } else if (item.sup_acc_type === 'customer') { |
| | | val += item.customercode ? '_' + item.customercode : '' |
| | | } else if (item.sup_acc_type === 'department') { |
| | | val += item.co_pro_code ? '_' + item.co_pro_code : '' |
| | | } else if (item.sup_acc_type === 'project') { |
| | | val += item.projectcode ? '_' + item.projectcode : '' |
| | | } else if (item.sup_acc_type === 'inventory') { |
| | | val += item.productcode ? '_' + item.productcode : '' |
| | | } else if (item.sup_acc_type === 'employee') { |
| | | val += item.workercode ? '_' + item.workercode : '' |
| | | } else if (item.sup_acc_type === 'cash_flow') { |
| | | val += item.cash_flow_code ? '_' + item.cash_flow_code : '' |
| | | } else if (item.sup_acc_code) { |
| | | val += '_' + item.sup_acc_code |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | let countNode = null |
| | |
| | | countNode = <div className="count-wrap"> |
| | | <span style={{marginRight: '5px'}} onClick={(e) => e.stopPropagation()}> |
| | | <span>数量:</span> |
| | | <span><InputNumber precision={4} className="inner-input" id={col.uuid + record.uuid + 'count'} defaultValue={record.count || 0} onChange={(val) => this.onChange(val)} onPressEnter={this.countPress} onBlur={this.countBlur}/></span> |
| | | <span><InputNumber precision={4} className="inner-input" id={col.uuid + record.uuid + 'count'} defaultValue={record.fcc_count || 0} onChange={(val) => this.onChange(val)} onPressEnter={this.countPress} onBlur={this.countBlur}/></span> |
| | | </span> |
| | | <span onClick={this.editPrice}> |
| | | <span>单价:</span> |
| | | <span>{record.price || 0}</span> |
| | | <span>{record.net_unitprice || 0}</span> |
| | | </span> |
| | | </div> |
| | | } else if (priceing) { |
| | | countNode = <div className="count-wrap"> |
| | | <span style={{marginRight: '5px'}} onClick={this.editCount}> |
| | | <span>数量:</span> |
| | | <span>{record.count || 0}</span> |
| | | <span>{record.fcc_count || 0}</span> |
| | | </span> |
| | | <span onClick={(e) => e.stopPropagation()}> |
| | | <span>单价:</span> |
| | | <span><InputNumber precision={4} className="inner-input" id={col.uuid + record.uuid + 'price'} defaultValue={record.price || 0} onChange={(val) => this.onChange(val)} onPressEnter={this.pricePress} onBlur={this.priceBlur}/></span> |
| | | <span><InputNumber precision={4} className="inner-input" id={col.uuid + record.uuid + 'price'} defaultValue={record.net_unitprice || 0} onChange={(val) => this.onChange(val)} onPressEnter={this.pricePress} onBlur={this.priceBlur}/></span> |
| | | </span> |
| | | </div> |
| | | } else { |
| | | countNode = <div className="count-wrap"> |
| | | <span style={{marginRight: '5px'}} onClick={this.editCount}> |
| | | <span>数量:</span> |
| | | <span>{record.count || 0}</span> |
| | | <span>{record.fcc_count || 0}</span> |
| | | </span> |
| | | <span onClick={this.editPrice}> |
| | | <span>单价:</span> |
| | | <span>{record.price || 0}</span> |
| | | <span>{record.net_unitprice || 0}</span> |
| | | </span> |
| | | </div> |
| | | } |
| | |
| | | </span> |
| | | <span onClick={this.editOrigin}> |
| | | <span>原币:</span> |
| | | <span>{record.origin || 0}</span> |
| | | <span>{record.foreign_amount || 0}</span> |
| | | </span> |
| | | </div> |
| | | } else if (ratioing) { |
| | |
| | | </span> |
| | | <span onClick={this.editOrigin}> |
| | | <span>原币:</span> |
| | | <span>{record.origin || 0}</span> |
| | | <span>{record.foreign_amount || 0}</span> |
| | | </span> |
| | | </div> |
| | | } else if (origining) { |
| | |
| | | </span> |
| | | <span onClick={(e) => e.stopPropagation()}> |
| | | <span>原币:</span> |
| | | <span><InputNumber precision={2} className="inner-input" id={col.uuid + record.uuid + 'origin'} defaultValue={record.origin || 0} onChange={(val) => this.onChange(val)} onPressEnter={this.originPress} onBlur={this.originBlur}/></span> |
| | | <span><InputNumber precision={2} className="inner-input" id={col.uuid + record.uuid + 'origin'} defaultValue={record.foreign_amount || 0} onChange={(val) => this.onChange(val)} onPressEnter={this.originPress} onBlur={this.originBlur}/></span> |
| | | </span> |
| | | </div> |
| | | } else { |
| | |
| | | </span> |
| | | <span onClick={this.editOrigin}> |
| | | <span>原币:</span> |
| | | <span>{record.origin || 0}</span> |
| | | <span>{record.foreign_amount || 0}</span> |
| | | </span> |
| | | </div> |
| | | } |
| | |
| | | </div> |
| | | } |
| | | } |
| | | } else if (col.field === 'debtor') { |
| | | } else if (col.field === 'debit') { |
| | | if (editing) { |
| | | children = <InputNumber id={col.uuid + record.uuid} precision={2} defaultValue={record.debtor} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | children = <InputNumber id={col.uuid + record.uuid} precision={2} defaultValue={record.debit} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | } else { |
| | | let val = record.debtor |
| | | let val = record.debit |
| | | let down = false |
| | | let vals = [] |
| | | if (!isNaN(val) && val !== '') { |
| | |
| | | <span>{vals[4] || ''}</span> <span>{vals[3] || ''}</span> <span>{vals[2] || ''}</span> <span>{vals[1] || ''}</span> <span className="last">{vals[0] || ''}</span> |
| | | </div> |
| | | } |
| | | } else if (col.field === 'creditor') { |
| | | } else if (col.field === 'credit') { |
| | | extra = <CloseOutlined onClick={this.delRecord}/> |
| | | |
| | | if (editing) { |
| | | children = <InputNumber id={col.uuid + record.uuid} precision={2} defaultValue={record.creditor} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | children = <InputNumber id={col.uuid + record.uuid} precision={2} defaultValue={record.credit} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | } else { |
| | | let val = record.creditor |
| | | let val = record.credit |
| | | let down = false |
| | | let vals = [] |
| | | if (!isNaN(val) && val !== '') { |
| | |
| | | let columns = [ |
| | | { |
| | | title: '摘要', |
| | | dataIndex: 'remark', |
| | | key: 'remark', |
| | | dataIndex: 'subject_voucher_text', |
| | | key: 'subject_voucher_text', |
| | | width: '22%', |
| | | onCell: record => ({ |
| | | record, |
| | | col: {uuid: 'remark', field: 'remark', tableId: config.uuid}, |
| | | col: {uuid: 'subject_voucher_text', field: 'subject_voucher_text', tableId: config.uuid}, |
| | | }) |
| | | }, |
| | | { |
| | | title: '会计科目', |
| | | dataIndex: 'subjectscode', |
| | | key: 'subjectscode', |
| | | dataIndex: 'subject_code', |
| | | key: 'subject_code', |
| | | width: '34%', |
| | | onCell: record => ({ |
| | | record, |
| | | col: {uuid: 'subjectscode', field: 'subjectscode', tableId: config.uuid}, |
| | | col: {uuid: 'subject_code', field: 'subject_code', tableId: config.uuid}, |
| | | }) |
| | | }, |
| | | { |
| | |
| | | <span>百</span> <span>十</span> <span>元</span> <span>角</span> <span className="last">分</span> |
| | | </div> |
| | | </>), |
| | | dataIndex: 'debtor', |
| | | key: 'debtor', |
| | | dataIndex: 'debit', |
| | | key: 'debit', |
| | | width: '22%', |
| | | onCell: record => ({ |
| | | record, |
| | | col: {uuid: 'debtor', field: 'debtor', tableId: config.uuid}, |
| | | col: {uuid: 'debit', field: 'debit', tableId: config.uuid}, |
| | | }) |
| | | }, |
| | | { |
| | |
| | | <span>百</span> <span>十</span> <span>元</span> <span>角</span> <span className="last">分</span> |
| | | </div> |
| | | </>), |
| | | dataIndex: 'creditor', |
| | | key: 'creditor', |
| | | dataIndex: 'credit', |
| | | key: 'credit', |
| | | width: '22%', |
| | | onCell: record => ({ |
| | | record, |
| | | col: {uuid: 'creditor', field: 'creditor', tableId: config.uuid}, |
| | | col: {uuid: 'credit', field: 'credit', tableId: config.uuid}, |
| | | }) |
| | | } |
| | | ] |
| | |
| | | let _data = data.map((item, i) => { |
| | | // item.uuid = Utils.getguid() |
| | | item.index = i |
| | | item.$origin = true |
| | | |
| | | return item |
| | | }) |
| | | |
| | | if (_data.length < 4) { |
| | | for (let i = _data.length - 1; i < 4; i++) { |
| | | _data.push({uuid: Utils.getguid(), index: i + 1, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''}) |
| | | _data.push({uuid: Utils.getguid(), index: i + 1, subject_voucher_text: '', subject_code: '', subject_name: '', debit: '', credit: ''}) |
| | | } |
| | | } |
| | | return _data |
| | |
| | | |
| | | getTotalLine = (data) => { |
| | | let totalLine = {uuid: Utils.getguid(), type: 'total'} |
| | | let debtor = '' |
| | | let creditor = '' |
| | | let debit = '' |
| | | let credit = '' |
| | | |
| | | data.forEach(item => { |
| | | if (!isNaN(item.debtor) && item.debtor !== '') { |
| | | if (debtor === '') { |
| | | debtor = 0 |
| | | if (!isNaN(item.debit) && item.debit !== '') { |
| | | if (debit === '') { |
| | | debit = 0 |
| | | } |
| | | |
| | | debtor += item.debtor |
| | | } else if (!isNaN(item.creditor) && item.creditor !== '') { |
| | | if (debtor === '') { |
| | | debtor = 0 |
| | | debit += item.debit |
| | | } else if (!isNaN(item.credit) && item.credit !== '') { |
| | | if (debit === '') { |
| | | debit = 0 |
| | | } |
| | | if (creditor === '') { |
| | | creditor = 0 |
| | | if (credit === '') { |
| | | credit = 0 |
| | | } |
| | | creditor += item.creditor |
| | | credit += item.credit |
| | | } |
| | | }) |
| | | |
| | | totalLine.debtor = debtor |
| | | totalLine.creditor = creditor |
| | | totalLine.debit = debit |
| | | totalLine.credit = credit |
| | | |
| | | totalLine.remark = this.changeMoneyToChinese(debtor) |
| | | totalLine.subject_voucher_text = this.changeMoneyToChinese(debit) |
| | | |
| | | return totalLine |
| | | } |
| | |
| | | if (col.tableId !== tableId) return |
| | | |
| | | if (record.index < edData.length - 2) { |
| | | MKEmitter.emit('tdFocus', 'remark' + edData[record.index + 1].uuid) |
| | | MKEmitter.emit('tdFocus', 'subject_voucher_text' + edData[record.index + 1].uuid) |
| | | } else { |
| | | let _data = fromJS(edData).toJS() |
| | | let line = {uuid: Utils.getguid(), index: _data.length - 1, remark: record.remark || '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''} |
| | | let line = {uuid: Utils.getguid(), index: _data.length - 1, subject_voucher_text: record.subject_voucher_text || '', subject_code: '', subject_name: '', debit: '', credit: ''} |
| | | |
| | | _data.splice(_data.length - 1, 0, line) |
| | | |
| | | this.setState({edData: _data}, () => { |
| | | MKEmitter.emit('tdFocus', 'remark' + line.uuid) |
| | | MKEmitter.emit('tdFocus', 'subject_voucher_text' + line.uuid) |
| | | }) |
| | | this.props.onChange(_data) |
| | | } |
| | |
| | | if (tid !== tableId) return |
| | | |
| | | let _data = fromJS(edData).toJS() |
| | | let line = {uuid: Utils.getguid(), index: 0, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''} |
| | | let line = {uuid: Utils.getguid(), index: 0, subject_voucher_text: '', subject_code: '', subject_name: '', debit: '', credit: ''} |
| | | |
| | | _data.splice(record.index, 0, line) |
| | | _data = _data.map((item, index) => { |
| | |
| | | |
| | | if (_data.length < 4) { |
| | | for (let i = _data.length; i < 4; i++) { |
| | | _data.push({uuid: Utils.getguid(), index: 0, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''}) |
| | | _data.push({uuid: Utils.getguid(), index: 0, subject_voucher_text: '', subject_code: '', subject_name: '', debit: '', credit: ''}) |
| | | } |
| | | } |
| | | |
| | |
| | | _data.push(this.getTotalLine(_data)) |
| | | |
| | | this.setState({edData: _data}) |
| | | this.props.onChange(_data, record.$origin ? record : null) |
| | | this.props.onChange(_data) |
| | | } |
| | | |
| | | changeRecord = (tableId, record) => { |
| | |
| | | _data.pop() |
| | | |
| | | if (record.index === _data.length - 1) { |
| | | _data.push({uuid: Utils.getguid(), index: record.index + 1, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''}) |
| | | _data.push({uuid: Utils.getguid(), index: record.index + 1, subject_voucher_text: '', subject_code: '', subject_name: '', debit: '', credit: ''}) |
| | | } |
| | | |
| | | _data.push(this.getTotalLine(_data)) |
| | |
| | | |
| | | render() { |
| | | const { setting, statFValue, lineMarks, data } = this.props |
| | | const { selectedRowKeys, activeIndex, pickup, tableId, pageOptions } = this.state |
| | | const { selectedRowKeys, activeIndex, pickup, tableId, pageOptions, columns } = this.state |
| | | |
| | | // 设置表格选择属性:单选、多选、不可选 |
| | | let rowSelection = null |
| | |
| | | } |
| | | |
| | | return ( |
| | | <div className={`normal-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || ''}`} id={tableId}> |
| | | <div className={`normal-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || 'middle'} table-col-${columns.length}`} id={tableId}> |
| | | {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && data && data.length > 0 ? |
| | | <Switch title="收起" className="main-pickup" checkedChildren="开" unCheckedChildren="关" checked={pickup} onChange={this.pickupChange} /> : null |
| | | } |
| | |
| | | size={setting.size || 'middle'} |
| | | bordered={setting.bordered !== 'false'} |
| | | rowSelection={rowSelection} |
| | | columns={this.state.columns} |
| | | columns={columns} |
| | | dataSource={_data} |
| | | loading={loading} |
| | | scroll={{ x: '100%', y: height }} |
| | |
| | | |
| | | render() { |
| | | const { setting, pickup, statFValue } = this.props |
| | | const { selectedRowKeys, lineMarks, activeIndex, pageOptions } = this.state |
| | | const { selectedRowKeys, lineMarks, activeIndex, pageOptions, columns } = this.state |
| | | |
| | | let components = { |
| | | body: {} |
| | |
| | | } |
| | | |
| | | return ( |
| | | <div className={'normal-data-table mingke-table ' + (height ? 'fixed-height' : '')}> |
| | | <div className={'normal-data-table mingke-table ' + (height ? 'fixed-height' : '') + ` table-col-${columns.length}`}> |
| | | <Table |
| | | components={components} |
| | | size={setting.size || 'middle'} |
| | | style={style} |
| | | bordered={setting.bordered !== 'false'} |
| | | rowSelection={rowSelection} |
| | | columns={this.state.columns} |
| | | columns={columns} |
| | | dataSource={_data} |
| | | rowClassName={(record) => { |
| | | let className = '' |