Commit 61bb997b authored by neo's avatar neo

[Bugfix] fixed some bugs

parent 300673ff
......@@ -2574,7 +2574,7 @@
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){
SweetAlert.error('报表提审中或审核已通过!');
SweetAlert.error('报表提审中!');
}else{
SweetAlert.swal({
title: "warning!",
......@@ -2700,35 +2700,56 @@
$scope.voucherFileID = evidence.fileID;
};
$scope.upLoadManual = function(){
var text= $(".li").find(".active").text();
$log.debug(text);
if(text == '海关专用缴款书' || text =='代扣代缴税收通用缴款书取数'){
var excelIo = new GC.Spread.Excel.IO();
$("#importExcellFile").modal('show');
}else{
SweetAlert.warning("仅支持海关专用缴款书或代扣代缴税收通用缴款书取数");
}
$scope.upLoadManual = function(){
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){
SweetAlert.error('报表提审中!');
}else{
var text= $(".li").find(".active").text();
$log.debug(text);
if(text == '海关专用缴款书' || text =='代扣代缴税收通用缴款书取数'){
var excelIo = new GC.Spread.Excel.IO();
$("#importExcellFile").modal('show');
}else{
SweetAlert.warning("仅支持海关专用缴款书或代扣代缴税收通用缴款书取数");
}
}
});
};
$scope.loadMyExcel = function(){
$scope.manualSpread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount: 1});
var excelIo = new GC.Spread.Excel.IO();
var excelFile = document.getElementById("fileDemo").files[0];
excelIo.open(excelFile, function(json) {
var workbookObj = json;
$scope.manualSpread.fromJSON(workbookObj);
}, function(e) {
alert(e.errorMessage);
if (e.errorCode === 2 /*noPassword*/ || e.errorCode === 3 /*invalidPassword*/ ) {
document.getElementById('password').onselect = null;
if($scope.file){
if($scope.hasManualLoad){
SweetAlert.warning("已载入文件,如需重新载入请先清空!");
}else{
$scope.manualSpread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount: 1});
var excelIo = new GC.Spread.Excel.IO();
var excelFile = $scope.file;
excelIo.open(excelFile, function(json) {
var workbookObj = json;
$scope.manualSpread.fromJSON(workbookObj);
}, function(e) {
alert(e.errorMessage);
if (e.errorCode === 2 /*noPassword*/ || e.errorCode === 3 /*invalidPassword*/ ) {
document.getElementById('password').onselect = null;
}
}, {
});
$scope.hasManualLoad = true;
}
}, {
});
}else{
SweetAlert.warning("请先选择文件!");
}
};
$scope.multiWrite = function(){
if($scope.hasManualLoad){
var manualSheet = $scope.manualSpread.getActiveSheet();
var currentSheet = $scope.spread.getActiveSheet()
currentSheet.options.isProtected=false;
......@@ -2740,30 +2761,43 @@
if (jsonTagInfo.isReadOnly)
continue;
var cellValue= manualSheet.getValue(rowIndex,columnIndex);
var cellString='';
if(typeof(cellValue) == "string") cellValue = cellValue.trim();
var r = /^00\d*|^\.\d+|\.$/;
if (typeof cellValue == "undefined" || cellValue == null || cellValue == "" || cellValue == "NaN")continue;
if (cellValue && (isNaN(cellValue) || r.test(cellValue))) {
SweetAlert.warning($translate.instant('CheckInputValueFormat'));
return;
cellString=cellValue;
} else if (cellValue && parseFloat(cellValue).toFixed(2) > 9999999999999) {
SweetAlert.warning($translate.instant('CheckInputValueLength'));
return;
}
cellValue = jsonTagInfo.dataType === 5 ? parseInt(cellValue): parseFloat(cellValue).toFixed(2);
var handInputModel = {
cellID: jsonTagInfo.cellID,
cellTemplateID: jsonTagInfo.cellTemplateID,
reportID: jsonTagInfo.reportID,
amount:cellValue
};
var handInputModel = {};
if(cellString){
handInputModel = {
cellID: jsonTagInfo.cellID,
cellTemplateID: jsonTagInfo.cellTemplateID,
reportID: jsonTagInfo.reportID,
keyinData: cellString
};
}else{
handInputModel = {
cellID: jsonTagInfo.cellID,
cellTemplateID: jsonTagInfo.cellTemplateID,
reportID: jsonTagInfo.reportID,
amount: cellValue
};
}
$scope.myConfirm(handInputModel);
}
}
}
}else{
SweetAlert.warning("文件未载入!");
}
};
......@@ -2772,7 +2806,7 @@
handInputModel.serviceTypeID = vatSessionService.project.serviceTypeID;
handInputModel.period = vatSessionService.month;
if (handInputModel.amount || handInputModel.name) {
if (handInputModel.amount || handInputModel.name || handInputModel.keyinData) {
//日志对象
logDto.ID = PWC.newGuid();
logDto.CreateTime = new Date();
......@@ -2796,10 +2830,16 @@
return $q.reject();
};
$scope.cleanManual = function(){
$scope.cleanManual = function(){
$scope.manualSpread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount: 1});
$('#ss').html('');
document.getElementById("fileDemo").value="";
$scope.hasManualLoad = false;
$scope.file = null;
};
$scope.closeManualModal = function () {
$scope.cleanManual();
$scope.modalInstance.dismiss('cancel');
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment