|
@@ -72,13 +72,18 @@ DatePickerCellType.prototype.updateEditor = function (editorContext, cellStyle,
|
|
|
};
|
|
|
|
|
|
function resetTpTable() {
|
|
|
- const rate = $('#changeRate').val();
|
|
|
- const bqhs = ZhCalc.round(ZhCalc.mul(m_tp, 1+rate/100), 2);
|
|
|
- const jzbqhs = ZhCalc.round(ZhCalc.add(pre_tp_hs, bqhs), 2);
|
|
|
$('#tp_set').find('td').eq(1).text(ZhCalc.round(m_tp, 2));
|
|
|
$('#tp_set').find('td').eq(2).text(ZhCalc.round(ZhCalc.add(pre_tp, m_tp), 2));
|
|
|
- $('#rate_set').find('td').eq(1).text(bqhs !== 0 ? bqhs : '');
|
|
|
- $('#rate_set').find('td').eq(2).text(jzbqhs !== 0 ? jzbqhs : '');
|
|
|
+ if (materialTax) {
|
|
|
+ $('#rate_set').find('td').eq(1).text(ZhCalc.round(m_tax_tp, 2));
|
|
|
+ $('#rate_set').find('td').eq(2).text(ZhCalc.round(ZhCalc.add(m_tax_pre_tp, m_tax_tp), 2));
|
|
|
+ } else {
|
|
|
+ const rate = $('#changeRate').val();
|
|
|
+ const bqhs = ZhCalc.round(ZhCalc.mul(m_tp, 1+rate/100), 2);
|
|
|
+ const jzbqhs = ZhCalc.round(ZhCalc.add(pre_tp_hs, bqhs), 2);
|
|
|
+ $('#rate_set').find('td').eq(1).text(bqhs !== 0 ? bqhs : '');
|
|
|
+ $('#rate_set').find('td').eq(2).text(jzbqhs !== 0 ? jzbqhs : '');
|
|
|
+ }
|
|
|
}
|
|
|
function getPasteHint (str, row = '') {
|
|
|
let returnObj = str;
|
|
@@ -99,27 +104,6 @@ $(document).ready(() => {
|
|
|
autoFlashHeight();
|
|
|
const materialSpread = SpreadJsObj.createNewSpread($('#material-spread')[0]);
|
|
|
const materialSpreadSetting = {
|
|
|
- cols: [
|
|
|
- {title: '调差类型', colSpan: '1', rowSpan: '2', field: 't_type', hAlign: 1, width: 80, formatter: '@', readOnly: 'readOnly.isUsed', cellType: 'customizeCombo', comboItems: materialType.t_type, cellTypeKey: 1},
|
|
|
- {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isUsed'},
|
|
|
- {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 180, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
- {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
- {title: '规格', colSpan: '1', rowSpan: '2', field: 'spec', hAlign: 0, width: 180, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
- {title: '工料分类', colSpan: '1', rowSpan: '2', field: 'm_type', hAlign: 1, width: 60, readOnly: 'readOnly.isEdit', cellType: 'customizeCombo', comboItems: materialType.m_type, cellTypeKey: 2},
|
|
|
- {title: '本期应耗数量', colSpan: '1', rowSpan: '2', field: 'quantity', hAlign: 2, width: 100, type: 'Number', readOnly: true},
|
|
|
- {title: '基准价', colSpan: '1', rowSpan: '2', field: 'basic_price', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
- {title: '基准时间', colSpan: '1', rowSpan: '2', field: 'basic_times', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
- {title: '本期信息价|单价', colSpan: '3|1', rowSpan: '1|1', field: 'msg_tp', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.msg_tp'},
|
|
|
- {title: '|时间', colSpan: '|1', rowSpan: '|1', field: 'msg_times', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.remark'},
|
|
|
- {title: '|价差', colSpan: '|1', rowSpan: '|1', field: 'msg_spread', hAlign: 2, width: 60, type: 'Number', readOnly: true, getValue: 'getValue.msg_spread'},
|
|
|
- {title: '本期材料调差|上涨幅度(%)', colSpan: '4|1', rowSpan: '1|1', field: 'm_up_risk', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
- {title: '|下跌幅度(%)', colSpan: '|1', rowSpan: '|1', field: 'm_down_risk', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
- {title: '|有效价差', colSpan: '|1', rowSpan: '|1', field: 'm_spread', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.m_spread'},
|
|
|
- {title: '|调差金额', colSpan: '|1', rowSpan: '|1', field: 'm_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.m_tp'},
|
|
|
- {title: '截止上期调差金额', colSpan: '1', rowSpan: '2', field: 'pre_tp', hAlign: 2, width: 120, type: 'Number', readOnly: true},
|
|
|
- {title: '备注', colSpan: '1', rowSpan: '2', field: 'remark', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.remark'},
|
|
|
- {title: '是否汇总', colSpan: '1', rowSpan: '2', field: 'is_summary', hAlign: 1, width: 60, cellType: 'checkbox', readOnly: 'readOnly.isEdit'},
|
|
|
- ],
|
|
|
emptyRows: 0,
|
|
|
headRows: 2,
|
|
|
headRowHeight: [25, 25],
|
|
@@ -128,7 +112,49 @@ $(document).ready(() => {
|
|
|
font: '12px 微软雅黑',
|
|
|
readOnly: readOnly,
|
|
|
};
|
|
|
-
|
|
|
+ let materialSpreadSettingCols = [
|
|
|
+ {title: '调差类型', colSpan: '1', rowSpan: '2', field: 't_type', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isUsed', cellType: 'customizeCombo', comboItems: materialType.t_type, cellTypeKey: 1},
|
|
|
+ {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isUsed'},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 150, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '规格', colSpan: '1', rowSpan: '2', field: 'spec', hAlign: 0, width: 150, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '工料分类', colSpan: '1', rowSpan: '2', field: 'm_type', hAlign: 1, width: 60, readOnly: 'readOnly.isEdit', cellType: 'customizeCombo', comboItems: materialType.m_type, cellTypeKey: 2},
|
|
|
+ ];
|
|
|
+ if (materialTax) {
|
|
|
+ materialSpreadSettingCols.push({title: '税率', colSpan: '1', rowSpan: '2', field: 'm_tax', hAlign: 2, width: 50, type: 'Number', readOnly: 'readOnly.isEdit'});
|
|
|
+ }
|
|
|
+ materialSpreadSettingCols = _.concat(materialSpreadSettingCols, [
|
|
|
+ {title: '本期应耗数量', colSpan: '1', rowSpan: '2', field: 'quantity', hAlign: 2, width: 90, type: 'Number', readOnly: true},
|
|
|
+ {title: '基准价', colSpan: '1', rowSpan: '2', field: 'basic_price', hAlign: 2, width: 50, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '基准时间', colSpan: '1', rowSpan: '2', field: 'basic_times', hAlign: 0, width: 70, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '本期信息价|单价', colSpan: '3|1', rowSpan: '1|1', field: 'msg_tp', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.msg_tp'},
|
|
|
+ {title: '|时间', colSpan: '|1', rowSpan: '|1', field: 'msg_times', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.remark'},
|
|
|
+ {title: '|价差', colSpan: '|1', rowSpan: '|1', field: 'msg_spread', hAlign: 2, width: 60, type: 'Number', readOnly: true, getValue: 'getValue.msg_spread'},]
|
|
|
+ );
|
|
|
+ if (materialTax) {
|
|
|
+ materialSpreadSettingCols = _.concat(materialSpreadSettingCols, [
|
|
|
+ {title: '本期材料调差|上涨幅度(%)', colSpan: '5|1', rowSpan: '1|1', field: 'm_up_risk', hAlign: 2, width: 90, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '|下跌幅度(%)', colSpan: '|1', rowSpan: '|1', field: 'm_down_risk', hAlign: 2, width: 90, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '|有效价差', colSpan: '|1', rowSpan: '|1', field: 'm_spread', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.m_spread'},
|
|
|
+ {title: '|调差金额', colSpan: '|1', rowSpan: '|1', field: 'm_tp', hAlign: 2, width: 100, type: 'Number', readOnly: true, getValue: 'getValue.m_tp'},
|
|
|
+ {title: '|调差金额(材料税)', colSpan: '|1', rowSpan: '|1', field: 'm_tax_tp', hAlign: 2, width: 100, type: 'Number', readOnly: true, getValue: 'getValue.m_tax_tp'},
|
|
|
+ {title: '截止上期|调差金额', colSpan: '2|1', rowSpan: '1|1', field: 'pre_tp', hAlign: 2, width: 100, type: 'Number', readOnly: true},
|
|
|
+ {title: '|调差金额(材料税)', colSpan: '|1', rowSpan: '|1', field: 'tax_pre_tp', hAlign: 2, width: 100, type: 'Number', readOnly: true},
|
|
|
+ {title: '备注', colSpan: '1', rowSpan: '2', field: 'remark', hAlign: 0, width: 50, formatter: '@', readOnly: 'readOnly.remark'},
|
|
|
+ {title: '是否汇总', colSpan: '1', rowSpan: '2', field: 'is_summary', hAlign: 1, width: 60, cellType: 'checkbox', readOnly: 'readOnly.isEdit'}
|
|
|
+ ])
|
|
|
+ } else {
|
|
|
+ materialSpreadSettingCols = _.concat(materialSpreadSettingCols, [
|
|
|
+ {title: '本期材料调差|上涨幅度(%)', colSpan: '4|1', rowSpan: '1|1', field: 'm_up_risk', hAlign: 2, width: 90, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '|下跌幅度(%)', colSpan: '|1', rowSpan: '|1', field: 'm_down_risk', hAlign: 2, width: 90, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '|有效价差', colSpan: '|1', rowSpan: '|1', field: 'm_spread', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.m_spread'},
|
|
|
+ {title: '|调差金额', colSpan: '|1', rowSpan: '|1', field: 'm_tp', hAlign: 2, width: 100, type: 'Number', readOnly: true, getValue: 'getValue.m_tp'},
|
|
|
+ {title: '截止上期|调差金额', colSpan: '1|1', rowSpan: '1|1', field: 'pre_tp', hAlign: 2, width: 100, type: 'Number', readOnly: true},
|
|
|
+ {title: '备注', colSpan: '1', rowSpan: '2', field: 'remark', hAlign: 0, width: 50, formatter: '@', readOnly: 'readOnly.remark'},
|
|
|
+ {title: '是否汇总', colSpan: '1', rowSpan: '2', field: 'is_summary', hAlign: 1, width: 60, cellType: 'checkbox', readOnly: 'readOnly.isEdit'}
|
|
|
+ ])
|
|
|
+ }
|
|
|
+ materialSpreadSetting.cols = materialSpreadSettingCols;
|
|
|
const spCol = _.find(materialSpreadSetting.cols, {field: 'quantity'});
|
|
|
spCol.readOnly = true;
|
|
|
spCol.cellType = 'activeImageBtn';
|
|
@@ -192,6 +218,10 @@ $(document).ready(() => {
|
|
|
},
|
|
|
m_tp: function (data) {
|
|
|
return ZhCalc.round(ZhCalc.mul(materialCol.getValue.m_spread(data), data.quantity), 2);
|
|
|
+ },
|
|
|
+ m_tax_tp: function (data) {
|
|
|
+ const m_tp = ZhCalc.round(ZhCalc.mul(materialCol.getValue.m_spread(data), data.quantity), 2);
|
|
|
+ return data.m_tax ? ZhCalc.round(ZhCalc.mul(m_tp, (1+ZhCalc.div(data.m_tax, 100))), 2) : m_tp;
|
|
|
}
|
|
|
},
|
|
|
readOnly: {
|
|
@@ -257,6 +287,9 @@ $(document).ready(() => {
|
|
|
const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
postData(window.location.pathname + '/save', {type: 'del', id: select.id}, function (result) {
|
|
|
m_tp = result.m_tp;
|
|
|
+ if (materialTax) {
|
|
|
+ m_tax_tp = result.m_tax_tp;
|
|
|
+ }
|
|
|
resetTpTable();
|
|
|
const index = materialBillsData.indexOf(select);
|
|
|
materialBillsData.splice(index, 1);
|
|
@@ -391,21 +424,7 @@ $(document).ready(() => {
|
|
|
// return;
|
|
|
}
|
|
|
}
|
|
|
- if (col.field === 'm_up_risk') {
|
|
|
- // 只能输入正整数
|
|
|
- if (isNaN(validText)) {
|
|
|
- toastr.error('不能输入其它非数字类型字符');
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- return;
|
|
|
- }
|
|
|
- const num = parseFloat(validText);
|
|
|
- if (validText !== null && (num < 0 || num > 100 || !/^\d+$/.test(num))) {
|
|
|
- toastr.error('只能输入0-100的正整数');
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- if (col.field === 'm_down_risk') {
|
|
|
+ if (col.field === 'm_up_risk' || col.field === 'm_down_risk' || col.field === 'm_tax') {
|
|
|
// 只能输入正整数
|
|
|
if (isNaN(validText)) {
|
|
|
toastr.error('不能输入其它非数字类型字符');
|
|
@@ -430,6 +449,7 @@ $(document).ready(() => {
|
|
|
select.msg_spread = materialCol.getValue.msg_spread(select);
|
|
|
select.m_spread = materialCol.getValue.m_spread(select);
|
|
|
select.m_tp = materialCol.getValue.m_tp(select);
|
|
|
+ select.m_tax_tp = materialCol.getValue.m_tax_tp(select);
|
|
|
delete select.waitingLoading;
|
|
|
|
|
|
// console.log(select);
|
|
@@ -437,6 +457,9 @@ $(document).ready(() => {
|
|
|
// 更新至服务器
|
|
|
postData(window.location.pathname + '/save', { type:'update', updateData: select }, function (result) {
|
|
|
m_tp = result.m_tp;
|
|
|
+ if (materialTax) {
|
|
|
+ m_tax_tp = result.m_tax_tp;
|
|
|
+ }
|
|
|
resetTpTable();
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
// 判断如果是更改了编号,名称,单位,月信息价需要跟着改变值
|
|
@@ -466,6 +489,9 @@ $(document).ready(() => {
|
|
|
// 更新至服务器
|
|
|
postData(window.location.pathname + '/save', { type:'update', updateData: select }, function (result) {
|
|
|
m_tp = result.m_tp;
|
|
|
+ if (materialTax) {
|
|
|
+ m_tax_tp = result.m_tax_tp;
|
|
|
+ }
|
|
|
resetTpTable();
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
}, function () {
|
|
@@ -561,7 +587,7 @@ $(document).ready(() => {
|
|
|
// bPaste = false;
|
|
|
// continue;
|
|
|
}
|
|
|
- } else if (colSetting.field === 'm_up_risk' || colSetting.field === 'm_down_risk') {
|
|
|
+ } else if (colSetting.field === 'm_up_risk' || colSetting.field === 'm_down_risk' || colSetting.field === 'm_tax') {
|
|
|
if (validText !== null && (num < 0 || num > 100 || !/^\d+$/.test(num))) {
|
|
|
toastMessageUniq(getPasteHint(hint.riskCan, hintRow));
|
|
|
bPaste = false;
|
|
@@ -580,6 +606,7 @@ $(document).ready(() => {
|
|
|
materialData.msg_spread = materialCol.getValue.msg_spread(sortData[curRow]);
|
|
|
materialData.m_spread = materialCol.getValue.m_spread(sortData[curRow]);
|
|
|
materialData.m_tp = materialCol.getValue.m_tp(sortData[curRow]);
|
|
|
+ materialData.m_tax_tp = materialCol.getValue.m_tax_tp(sortData[curRow]);
|
|
|
data.push(materialData);
|
|
|
// rowData.push(curRow);
|
|
|
} else {
|
|
@@ -611,6 +638,9 @@ $(document).ready(() => {
|
|
|
// SpreadJsObj.reLoadSheetData(materialMonthSpread.getActiveSheet());
|
|
|
}
|
|
|
m_tp = result.m_tp;
|
|
|
+ if (materialTax) {
|
|
|
+ m_tax_tp = result.m_tax_tp;
|
|
|
+ }
|
|
|
resetTpTable();
|
|
|
// materialSpreadObj.refreshActn();
|
|
|
}, function () {
|
|
@@ -638,9 +668,9 @@ $(document).ready(() => {
|
|
|
sheet.resumePaint();
|
|
|
const static_cols = [
|
|
|
{title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 60, formatter: '@', readOnly: true},
|
|
|
- {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 140, formatter: '@', readOnly: true},
|
|
|
- {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: true},
|
|
|
- {title: '来源地', colSpan: '1', rowSpan: '2', field: 'origin', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 100, formatter: '@', readOnly: true},
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
|
|
|
+ {title: '来源地', colSpan: '1', rowSpan: '2', field: 'origin', hAlign: 0, width: 70, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
{title: '平均单价', colSpan: '1', rowSpan: '2', field: 'average_msg_tp', hAlign: 2, width: 60, type: 'Number', readOnly: true, getValue:'getValue.average_msg_tp'},
|
|
|
];
|
|
|
// 月信息价方法集合
|
|
@@ -797,6 +827,9 @@ $(document).ready(() => {
|
|
|
materialBillsData = result.materialBillsData;
|
|
|
SpreadJsObj.loadSheetData(materialSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialBillsData);
|
|
|
m_tp = result.m_tp;
|
|
|
+ if (materialTax) {
|
|
|
+ m_tax_tp = result.m_tax_tp;
|
|
|
+ }
|
|
|
resetTpTable();
|
|
|
}, function () {
|
|
|
select[col.field] = orgValue;
|
|
@@ -926,6 +959,9 @@ $(document).ready(() => {
|
|
|
materialBillsData = result.materialBillsData;
|
|
|
SpreadJsObj.loadSheetData(materialSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialBillsData);
|
|
|
m_tp = result.m_tp;
|
|
|
+ if (materialTax) {
|
|
|
+ m_tax_tp = result.m_tax_tp;
|
|
|
+ }
|
|
|
resetTpTable();
|
|
|
}, function () {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
@@ -1142,6 +1178,9 @@ $(document).ready(() => {
|
|
|
}
|
|
|
postData(window.location.pathname + '/save', { type:'expr', id: $('#materialbillsId').val(), expr: expr }, function (result) {
|
|
|
m_tp = result.m_tp;
|
|
|
+ if (materialTax) {
|
|
|
+ m_tax_tp = result.m_tax_tp;
|
|
|
+ }
|
|
|
resetTpTable();
|
|
|
const sheet = materialSpread.getActiveSheet();
|
|
|
const select = SpreadJsObj.getSelectObject(sheet);
|
|
@@ -1174,6 +1213,9 @@ $(document).ready(() => {
|
|
|
materialBillsData = data.materialBillsData;
|
|
|
SpreadJsObj.loadSheetData(materialSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialBillsData);
|
|
|
m_tp = data.m_tp;
|
|
|
+ if (materialTax) {
|
|
|
+ m_tax_tp = data.m_tax_tp;
|
|
|
+ }
|
|
|
resetTpTable();
|
|
|
$('#add-month').modal('hide');
|
|
|
});
|
|
@@ -1204,6 +1246,9 @@ $(document).ready(() => {
|
|
|
materialBillsData = data.materialBillsData;
|
|
|
SpreadJsObj.loadSheetData(materialSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialBillsData);
|
|
|
m_tp = data.m_tp;
|
|
|
+ if (materialTax) {
|
|
|
+ m_tax_tp = data.m_tax_tp;
|
|
|
+ }
|
|
|
resetTpTable();
|
|
|
$('#remove-month').modal('hide');
|
|
|
});
|