Commit 1c0ecab1 authored by Cheng C Yang's avatar Cheng C Yang

Fix Bug 23331

parent bce53a58
<div class="popover">
<div class="arrow"></div>
<div class="popover-content">
<div>
<table class="table table-responsive">
<tr>
<td>
<span translate="BillingContent"></span>
<input class="form-control input-width-small" id="certificationDateStart" ng-model="queryParams.certificationDateStart" />&nbsp;-&nbsp;
<input class="form-control input-width-small" id="certificationDateEnd" ng-model="queryParams.certificationDateEnd" />
</td>
</tr>
<tr>
<td>
<span translate="ApplicationSector"></span>
<input class="form-control input-width-middle" type="text" id="invoiceCode" ng-model="queryParams.invoiceCode" />
</td>
</tr>
<tr>
<td>
<span translate="ApplicationSector"></span>
<input class="form-control input-width-middle" type="text" id="invoiceNumber" ng-model="queryParams.invoiceNumber" />
</td>
</tr>
<tr>
<td>
<span translate="InvoiceCode"></span>
<input class="form-control input-width-middle" type="text" id="sellerTaxNumber" ng-model="queryParams.sellerTaxNumber" />
</td>
</tr>
<tr>
<td>
<span translate="InvoiceNumber"></span>
<input class="form-control input-width-small" type="text" id="amountStart" ng-model="queryParams.amountStart" onkeyup="PWC.inputNumberFormat(this);" />&nbsp;-&nbsp;
<input class="form-control input-width-small" type="text" id="amountEnd" ng-model="queryParams.amountEnd" onkeyup="PWC.inputNumberFormat(this);" />
</td>
</tr>
<tr>
<td>
<span translate="InvoiceFPLXQuery"></span>
<div class="ui-select-has-border input-width-middle">
<ui-select ng-model="InvoiceType.selected" search-enabled="false" style="text-align:left;" class="input-width-middle">
<ui-select-match>{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="item in invoiceTypeList | propsFilter: {name: $select.search}">
<div title="{{item.name}}" ng-bind-html="item.name"></div>
</ui-select-choices>
</ui-select>
</div>
</td>
</tr>
<tr>
<td>
<span translate="InvoiceRZJGQuery"></span>
<div class="ui-select-has-border input-width-middle">
<ui-select ng-model="CertificationStatus.selected" search-enabled="false" style="text-align: left; " class="input-width-middle">
<ui-select-match>{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="item in cetificationResultList | propsFilter: {name: $select.search}">
<div title="{{item.name}}" ng-bind-html="item.name"></div>
</ui-select-choices>
</ui-select>
</div>
</td>
</tr>
</table>
</div>
<div class="row">
<div style="float:right;margin-right:10px;">
<button class="btn btn-default btn-primary" ng-click="doDataFilter('')">
<span class="fa fa-chevron-down" aria-hidden="true"> </span> <span translate="Confirm"></span>
</button>
<button class="btn btn-default margin-right10" ng-click="doDataFilterReset()">
<span class="fa fa-times" aria-hidden="true"> </span> <span translate="Reset"></span>
</button>
</div>
</div>
</div>
</div>
vatModule.controller('VatPreviewProfitTableController', ['$rootScope','$scope', '$log','$filter', '$translate', '$timeout', 'SweetAlert', '$q', 'uiGridConstants', '$interval', 'vatPreviewService', 'browserService', 'vatSessionService', 'region', 'enums', 'vatExportService',
function ($rootScope,$scope, $log,$filter, $translate, $timeout, SweetAlert, $q, uiGridConstants, $interval, vatPreviewService, browserService, vatSessionService, region, enums, vatExportService) {
'use strict';
$scope.startDate = new Date(vatSessionService.project.year, 0, 1);
$scope.endDate = new Date(vatSessionService.project.year, 11, 31);
$scope.dateFormat = $translate.instant('dateFormat4YearMonthDay');
$scope.startMonth = vatSessionService.month;
$scope.endMonth = vatSessionService.month;
$scope.totalMoneyAmount = 0;
$scope.totalTaxAmount = 0;
$scope.pageSize = constant.vatPagesize;
var minDate = [1, vatSessionService.project.year];
// var minDate = moment().startOf('month').subtract(0, 'months');
var maxDate = [12, vatSessionService.project.year];
var setDate = [
[vatSessionService.month, vatSessionService.project.year],
[vatSessionService.month, vatSessionService.project.year]];
//发票类型
var invoiceTypeEnum = {
VATInvoice: $translate.instant('VATInvoice'),
FreightTransport: $translate.instant('FreightTransport'),
MotorVehicle: $translate.instant('MotorVehicle'),
AgriculturalProduct: $translate.instant('AgriculturalProduct')
};
$scope.monthList = [$translate.instant('Month01'),
$translate.instant('Month02'),
$translate.instant('Month03'),
$translate.instant('Month04'),
$translate.instant('Month05'),
$translate.instant('Month06'),
$translate.instant('Month07'),
$translate.instant('Month08'),
$translate.instant('Month09'),
$translate.instant('Month10'),
$translate.instant('Month11'),
$translate.instant('Month12')
];
//认证结果
$scope.cetificationResultList = [
{ id: 999, name: $translate.instant('AllTheItems') },
{ id: 1, name: $translate.instant('CertificationPass') },
{ id: 2, name: $translate.instant('CertificationNotPass') }
];
//发票类型
$scope.invoiceTypeList = [
{ id: 999, name: $translate.instant('AllTheItems') },
{ id: enums.invoiceType.VATInvoice, name: $translate.instant('VATInvoice') },
{ id: enums.invoiceType.FreightTransport, name: $translate.instant('FreightTransport') },
{ id: enums.invoiceType.MotorVehicle, name: $translate.instant('MotorVehicle') },
{ id: enums.invoiceType.AgriculturalProduct, name: $translate.instant('AgriculturalProduct') }
];
$scope.InvoiceType = {};
$scope.CertificationStatus = {};
//初始化期间
var initPeriods = function () {
var curMonth = new Date().getMonth() + 1;
$scope.queryParams = {
pageInfo: {},
periodStart: '',
periodEnd: ''
};
};
//从数据库中load数据
var loadProfitLossDataFromDB = function (pageIndex) {
initProfitLossPagination();
$scope.curProfitLossPage = pageIndex;
//初始化查询信息
$scope.queryParams.pageInfo = {
totalCount: $scope.queryProfitLossResult.pageInfo.totalCount,
pageIndex: pageIndex,
pageSize: $scope.queryProfitLossResult.pageInfo.pageSize,
totalPage: 0
};
$scope.queryParams.orgId = vatSessionService.project.organizationID;
$scope.getDataFromDatabase($scope.queryParams);
};
$scope.getDataFromDatabase = function (queryParams){
vatPreviewService.getPLStatementDataForDisplay(queryParams).success(function (data) {
if (data) {
// minDate = data.
var index = 1;
data.list.forEach(function (v) {
v.index = index++;
});
$scope.gridOptions.data = data.list;
$scope.queryProfitLossResult.pageInfo = data;
computeProfitLossPage();
$scope.ledgerName = data.list[0].ledgerName;
$scope.currencyCode = data.list[0].ledgerCurrencyCode;
$scope.status = data.list[0].status;
$scope.importDate = $filter('date')(data.list[0].date, "yyyy-MM-dd hh:mm:ss");
}
});
};
//点击任意一页加载数据事件
var loadIncomeInvoiceDataByPage = function (pageIndex) {
loadProfitLossDataFromDB(pageIndex);
};
//计算页数,创建分页栏
var computeProfitLossPage = function () {
if ($scope.queryProfitLossResult.pageInfo && $scope.queryProfitLossResult.pageInfo.total > 0) {
var totalPage = parseInt($scope.queryProfitLossResult.pageInfo.total / $scope.pageSize);
totalPage = $scope.queryProfitLossResult.pageInfo.totalCount % $scope.pageSize == 0 ? totalPage : totalPage + 1;
//计算本页记录数
if ($scope.queryProfitLossResult.pageInfo.pageNum === totalPage) {
$scope.curPageItemCount = $scope.queryProfitLossResult.pageInfo.total % $scope.pageSize;
}
else {
$scope.curPageItemCount = $scope.pageSize;
}
$scope.queryProfitLossResult.pageInfo.totalPage = totalPage;
var createPage = $("#totalInvoicePage").createPage({
pageCount: totalPage,
current: $scope.curProfitLossPage,
backFn: function (p) {
//单击回调方法,p是当前页码
loadIncomeInvoiceDataByPage(p);
}
});
$('#totalInvoicePage').css('display', 'inline-block');
} else {
//如果查询结果为0,则直接设置本页记录数为0
$scope.curPageItemCount = 0;
var createPage = $("#totalInvoicePage").createPage({
pageCount: 0,
current: $scope.curProfitLossPage,
backFn: function (p) {
//单击回调方法,p是当前页码
loadIncomeInvoiceDataByPage(p);
}
});
$('#totalInvoicePage').css('display', 'inline-block');
}
};
//初始化分页信息
var initProfitLossPagination = function () {
$scope.queryProfitLossResult = {
list: [],
pageInfo: {
totalCount: -1,
pageIndex: 1,
pageSize: constant.pagesize,
totalPage: 0,
}
}
$scope.curProfitLossPage = 1;
};
//将选择了的查询条件显示在grid上方
var doDataFilter = function (removeData) {
if ($scope.queryParams.periodStart > $scope.queryParams.periodEnd) {
$scope.queryParams.periodEnd = $scope.queryParams.periodStart;
}
//设置需要去掉的查询条件的值为空
if (!PWC.isNullOrEmpty(removeData)) {
var removeItem = removeData.split("|");
removeItem.forEach(function (v) {
$scope.queryParams[v] = null;
//如果去掉了发票代码的查询条件,则将查询条件设置为'',因为是字符串,设置为null会导致查询结果错误
if ($scope.queryParams.invoiceCode === null) {
$scope.queryParams.invoiceCode = '';
}
//如果去掉了发票号码的查询条件,则将查询条件设置为'',因为是字符串,设置为null会导致查询结果错误
if ($scope.queryParams.invoiceNumber === null) {
$scope.queryParams.invoiceNumber = '';
}
//如果去掉了供货方税号的查询条件,则将查询条件设置为'',因为是字符串,设置为null会导致查询结果错误
if ($scope.queryParams.sellerTaxNumber === null) {
$scope.queryParams.sellerTaxNumber = '';
}
if ($scope.queryParams.invoiceType === null) {
$scope.InvoiceType.selected = undefined;
}
if ($scope.queryParams.certificationStatus === null) {
$scope.CertificationStatus.selected = undefined;
}
});
}
//设置发票类型和认证结果
if ($scope.InvoiceType.selected !== undefined)
$scope.queryParams.invoiceType = $scope.InvoiceType.selected.id;
else
$scope.queryParams.invoiceType = null;
if ($scope.CertificationStatus.selected !== undefined)
$scope.queryParams.certificationStatus = $scope.CertificationStatus.selected.id;
else
$scope.queryParams.certificationStatus = null;
// 将查询条件加入到grid上方
var crits = $scope.queryParams;
//定义查询条件数组用于存放已选的查询条件
$scope.criteriaList = [];
var crit = [];
//认证日期
if (!PWC.isNullOrEmpty(crits.certificationDateStart) && !PWC.isNullOrEmpty(crits.certificationDateEnd)) {
if (new Date(crits.certificationDateStart.replace(/[\.-]/g, '/')) > new Date(crits.certificationDateEnd.replace(/[\.-]/g, '/'))) {
$scope.criteriaList = [];
SweetAlert.warning($translate.instant('InvoiceDateQueryError'));
return;
}
crit = new Object;
crit.name = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateStart + "-" + crits.certificationDateEnd;;
crit.fullName = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateStart + "-" + crits.certificationDateEnd;
crit.valueFrom = crits.certificationDateStart;
crit.valueTo = crits.certificationDateEnd;
crit.propertyName = "certificationDateStart|certificationDateEnd";
$scope.criteriaList.push(crit);
} else if (!PWC.isNullOrEmpty(crits.certificationDateStart) && PWC.isNullOrEmpty(crits.invoiceDateEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateStart + $translate.instant('After');
crit.fullName = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateStart + $translate.instant('After');
crit.valueFrom = crits.certificationDateStart;
crit.valueTo = crits.certificationDateEnd;
crit.propertyName = "certificationDateStart|certificationDateEnd";
$scope.criteriaList.push(crit);
}
else if (PWC.isNullOrEmpty(crits.certificationDateStart) && !PWC.isNullOrEmpty(crits.certificationDateEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateEnd + $translate.instant('Before');
crit.fullName = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateEnd + $translate.instant('Before');
crit.valueFrom = crits.certificationDateStart;
crit.valueTo = crits.certificationDateEnd;
crit.propertyName = "certificationDateStart|certificationDateEnd";
$scope.criteriaList.push(crit);
}
//发票代码
if (!PWC.isNullOrEmpty(crits.invoiceCode)) {
crit = new Object;
crit.name = $translate.instant('InvoiceFPDMQuery') + PWC.limitString(crits.invoiceCode, 10);
crit.fullName = $translate.instant('InvoiceFPDMQuery') + crits.invoiceCode;
crit.valueFrom = crits.invoiceCode;
crit.propertyName = "invoiceCode";
$scope.criteriaList.push(crit);
}
//发票号码
if (!PWC.isNullOrEmpty(crits.invoiceNumber)) {
crit = new Object;
crit.name = $translate.instant('InvoiceFPHMQuery') + PWC.limitString(crits.invoiceNumber, 10);
crit.fullName = $translate.instant('InvoiceFPHMQuery') + crits.invoiceNumber;
crit.valueFrom = crits.invoiceNumber;
crit.propertyName = "invoiceNumber";
$scope.criteriaList.push(crit);
}
//销方识别号
if (!PWC.isNullOrEmpty(crits.sellerTaxNumber)) {
crit = new Object;
crit.name = $translate.instant('InvoiceGHFSHQuery') + PWC.limitString(crits.sellerTaxNumber, 10);
crit.fullName = $translate.instant('InvoiceGHFSHQuery') + crits.sellerTaxNumber;
crit.valueFrom = crits.sellerTaxNumber;
crit.propertyName = "sellerTaxNumber";
$scope.criteriaList.push(crit);
}
//金额
if (!PWC.isNullOrEmpty(crits.amountStart) && !PWC.isNullOrEmpty(crits.amountEnd)) {
if (Number(crits.amountStart) > Number(crits.amountEnd)) {
SweetAlert.warning($translate.instant('AmountQueryError'));
return;
}
crit = new Object;
crit.name = $translate.instant('InvoiceJEQuery') + PWC.limitString(crits.amountStart, 5) + ' - ' + PWC.limitString(crits.amountEnd, 5);
crit.fullName = $translate.instant('InvoiceJEQuery') + crits.amountStart + ' - ' + crits.amountEnd;
crit.valueFrom = crits.amountStart;
crit.valueTo = crits.amountEnd;
crit.propertyName = "amountStart|amountEnd";
$scope.criteriaList.push(crit);
}
else if (!PWC.isNullOrEmpty(crits.amountStart) && PWC.isNullOrEmpty(crits.amountEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceJEQuery') + PWC.limitString(crits.amountStart, 5) + $translate.instant('MoreThan');
crit.fullName = $translate.instant('InvoiceJEQuery') + crits.amountStart + $translate.instant('MoreThan');
crit.valueFrom = crits.amountStart;
crit.valueTo = crits.amountEnd;
crit.propertyName = "amountStart|amountEnd";
$scope.criteriaList.push(crit);
}
else if (PWC.isNullOrEmpty(crits.amountStart) && !PWC.isNullOrEmpty(crits.amountEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceJEQuery') + PWC.limitString(crits.amountEnd, 5) + $translate.instant('LessThan');
crit.fullName = $translate.instant('InvoiceJEQuery') + crits.amountEnd + $translate.instant('LessThan');
crit.valueFrom = crits.amountStart;
crit.valueTo = crits.amountEnd;
crit.propertyName = "amountStart|amountEnd";
$scope.criteriaList.push(crit);
}
//税额
if (!PWC.isNullOrEmpty(crits.taxAmountStart) && !PWC.isNullOrEmpty(crits.taxAmountEnd)) {
if (Number(crits.taxAmountStart) > Number(crits.taxAmountEnd)) {
SweetAlert.warning($translate.instant('TaxAmountQueryError'));
return;
}
crit = new Object;
crit.name = $translate.instant('InvoiceSEQuery') + PWC.limitString(crits.taxAmountStart, 5) + ' - ' + PWC.limitString(crits.taxAmountEnd, 5);
crit.fullName = $translate.instant('InvoiceSEQuery') + crits.taxAmountStart + ' - ' + crits.taxAmountEnd;
crit.valueFrom = crits.taxAmountStart;
crit.valueTo = crits.taxAmountEnd;
crit.propertyName = "taxAmountStart|taxAmountEnd";
$scope.criteriaList.push(crit);
}
else if (!PWC.isNullOrEmpty(crits.taxAmountStart) && PWC.isNullOrEmpty(crits.taxAmountEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceSEQuery') + PWC.limitString(crits.taxAmountStart, 5) + $translate.instant('MoreThan');
crit.fullName = $translate.instant('InvoiceSEQuery') + crits.taxAmountStart + $translate.instant('MoreThan');
crit.valueFrom = crits.taxAmountStart;
crit.valueTo = crits.taxAmountEnd;
crit.propertyName = "taxAmountStart|taxAmountEnd";
$scope.criteriaList.push(crit);
}
else if (PWC.isNullOrEmpty(crits.taxAmountStart) && !PWC.isNullOrEmpty(crits.taxAmountEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceSEQuery') + PWC.limitString(crits.taxAmountEnd, 5) + $translate.instant('LessThan');
crit.fullName = $translate.instant('InvoiceSEQuery') + crits.taxAmountEnd + $translate.instant('LessThan');
crit.valueFrom = crits.taxAmountStart;
crit.valueTo = crits.taxAmountEnd;
crit.propertyName = "taxAmountStart|taxAmountEnd";
$scope.criteriaList.push(crit);
}
//发票类型
if (!PWC.isNullOrEmpty(crits.invoiceType)) {
crit = new Object;
crit.valueFrom = _.find($scope.invoiceTypeList, function (v) {
return v.id === crits.invoiceType;
}).name;
crit.name = $translate.instant('InvoiceFPLXQuery') + crit.valueFrom;
crit.fullName = $translate.instant('InvoiceFPLXQuery') + crit.valueFrom;
crit.propertyName = "invoiceType";
$scope.criteriaList.push(crit);
}
//认证结果
if (!PWC.isNullOrEmpty(crits.certificationStatus)) {
crit = new Object;
crit.valueFrom = _.find($scope.cetificationResultList, function (v) {
return v.id === crits.certificationStatus;
}).name;
crit.name = $translate.instant('InvoiceRZJGQuery') + crit.valueFrom;
crit.fullName = $translate.instant('InvoiceRZJGQuery') + crit.valueFrom;
crit.propertyName = "certificationStatus";
$scope.criteriaList.push(crit);
}
// add to Criteria List for display on top of the grid:
//********************************************************************************
var criteria = JSON.stringify($scope.queryParams);
if (browserService.isIE() || browserService.isEdge())
criteria = encodeURIComponent(criteria);
loadProfitLossDataFromDB(1);
if ($scope.criteriaList.length > 6) {
$scope.criteriaListFirstRow = $scope.criteriaList.slice(0, 6);
$scope.criteriaListSecondRow = $scope.criteriaList.slice(6, $scope.criteriaList.length);
}
else {
$scope.criteriaListFirstRow = $scope.criteriaList.slice(0, $scope.criteriaList.length);
}
$('.filter-button').popover("hide");
};
//去掉所有的查询条件,重新load数据
var doDataFilterReset = function () {
$scope.queryParams = {
pageInfo: {},
periodStart: '',
periodEnd: '',
certificationDateStart: null,
certificationDateEnd: null,
invoiceCode: '',
invoiceNumber: '',
sellerTaxNumber: '',
amountStart: null,
amountEnd: null,
invoiceType: null,
taxAmountStart: null,
taxAmountEnd: null,
certificationStatus: null
};
$scope.criteriaList = [];
$scope.queryParams.periodStart = $scope.startMonth;
$scope.queryParams.periodEnd = $scope.endMonth;
loadProfitLossDataFromDB(1);
$('.filter-button').popover("hide");
};
var prepareSummary = function () {
// do something before show popover
};
//在popover打开时执行事件
var showPopover = function () {
$timeout(function () {
initDatePickers();
}, 500);
};
//初始化时间控件
var initDatePickers = function () {
//认证开始时间
var ele1 = $("#certificationDateStart");
ele1.datepicker({
startDate: $scope.startDate,
endDate: $scope.endDate,
language: region,
autoclose: true,//选中之后自动隐藏日期选择框
clearBtn: true,//清除按钮
todayBtn: false,//今日按钮
format: $scope.dateFormat//日期格式,详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
});
ele1.datepicker("setDate", $scope.queryParams.certificationDateStart);
//认证结束时间
var ele2 = $("#certificationDateEnd");
ele2.datepicker({
startDate: $scope.startDate,
endDate: $scope.endDate,
language: region,
autoclose: true,//选中之后自动隐藏日期选择框
clearBtn: true,//清除按钮
todayBtn: false,//今日按钮
format: $scope.dateFormat//日期格式,详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
})
ele2.datepicker("setDate", $scope.queryParams.certificationDateEnd);
//初始化已选择的发票类型和认证结果
$scope.InvoiceType.selected = _.find($scope.invoiceTypeList, function (v) {
return v.id == $scope.queryParams.invoiceType;
})
$scope.CertificationStatus.selected = _.find($scope.cetificationResultList, function (v) {
return v.id == $scope.queryParams.certificationStatus;
})
};
//发票类型转换
$scope.typeToString = function (strType) {
var type = invoiceTypeEnum.VATInvoice;
switch (strType) {
case 1:
type = invoiceTypeEnum.VATInvoice;
break;
case 2:
type = invoiceTypeEnum.FreightTransport;
break;
case 3:
type = invoiceTypeEnum.MotorVehicle;
break;
case 4:
type = invoiceTypeEnum.AgriculturalProduct;
break;
default:
type = "";
}
return type;
};
//导出进项发票数据
var downloadPL = function () {
vatPreviewService.initExportPLStatementData($scope.queryParams).success(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, '利润表信息');
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
(function initialize() {
$log.debug('VatPreviewInputInvoiceController.ctor()...');
$('#input-invoice-period-picker').focus(function () {
$('.filter-button').popover("hide");
});
//初始化month-picker
$('#input-invoice-period-picker').rangePicker({
minDate: minDate,
maxDate: maxDate,
setDate: setDate,
months: $scope.monthList,//['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
ConfirmBtnText: $translate.instant('Confirm'),
CancelBtnText: $translate.instant('ButtonCancel')
})
.on('datePicker.done', function (e, result) {
//开始月份
var startMonth = result[0][1] * 100 + result[0][0];
//结束月份
var endMonth = result[1][1] * 100 + result[1][0];
$scope.startMonth = startMonth;
$scope.endMonth = endMonth;
$scope.queryParams.periodStart = startMonth;
$scope.queryParams.periodEnd = endMonth;
loadProfitLossDataFromDB(1);
});
$scope.gridOptions = {
rowHeight: constant.UIGrid.rowHeight,
selectionRowHeaderWidth: constant.UIGrid.rowHeight,
// expandableRowTemplate: '<div ui-grid="row.entity.subGridOptions" style="height:150px;"></div>',
virtualizationThreshold: 50,//默认加载50条数据,避免在数据展示时,只显示前面4条
enableSorting: false,
enableColumnMenus: false,
columnDefs: [
{
name: $translate.instant('ProjectName'),
cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.itemName}}<span></div>'
},
{
name: $translate.instant('CurrentPeriodAmount'),
headerCellClass:'rightHeader',
cellTemplate: '<div class="ui-grid-cell-contents" style="text-align: right"><span>{{row.entity.periodAmt | number:2}}<span></div>'
},
{
name: $translate.instant('ThisYearAccumulatedAmount'),
headerCellClass:'rightHeader',
cellTemplate: '<div class="ui-grid-cell-contents" style="text-align: right"><span>{{row.entity.ytdAmt | number:2}}</span></div>'
}
]
};
$scope.doDataFilter = doDataFilter;
$scope.doDataFilterReset = doDataFilterReset;
$scope.prepareSummary = prepareSummary;
$scope.showPopover = showPopover;
$scope.downloadPL = downloadPL;
initPeriods();
initProfitLossPagination();
//初始化查询条件-期间范围
$scope.queryParams.periodStart = vatSessionService.year * 100 + vatSessionService.month;
$scope.queryParams.periodEnd = vatSessionService.year * 100 + vatSessionService.month;
$scope.queryParams.orgId = vatSessionService.project.organizationID;
if($rootScope.currentLanguage === 'en-us'){
$('.periodInput')[0].style.left = "250px";
}else{
$('.periodInput')[0].style.left = "120px";
}
loadProfitLossDataFromDB(1);
})();
}
]);
<div class="vat-preview-profit-table" id="mainPreviewDiv">
<div class="top-area-wrapper" style="margin-top: 30px">
<!--<button class="filter-button"
atms-popover ng-mouseenter="prepareSummary()" ng-click="showPopover()"
popover-container="body" popover-auto-hide="true" data-overwrite="true"
use-optimized-placement-algorithm="true"
data-placement="bottom"
data-templateurl="/app/vat/preview/vat-preview-profit-loss/vat-preview-profit-loss-search.html">
<i class="fa fa-filter" aria-hidden="true"></i>
</button>-->
<span translate="ProfitLossTitle" class="text-bold"></span> &nbsp;&nbsp;|&nbsp;&nbsp;<span class="text-bold" translate="InvoiceQJ"></span>
<input type="text" class="form-control input-width-middle periodInput" style="position: relative; top: -30px; left: 130px;" id="input-invoice-period-picker" />
<span ng-click="downloadPL()" style="position: relative; top: -61px; left: 95%;"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'ExportBtn' | translate}}</span>
</div>
<div style="margin-bottom: 8px;margin-left: 30px">
{{'EnterpriseAccountSetName' | translate}}<span class="numAmount">{{ledgerName}}</span>&nbsp;&nbsp;&nbsp;
{{'EnterpriseAccountSetCurrency' | translate}}<span class="numAmount">{{currencyCode}}</span>&nbsp;&nbsp;&nbsp;
{{'IsCloseAccount' | translate}}<span class="numAmount">{{status}}</span>
{{'ImportTime' | translate}}<span class="numAmount">{{importDate| date:'yyyy-MM-dd hh:mm:ss'}}</span>
</div>
<div id="filterCriteriaDiv" style="max-width:98%;margin-bottom:2px;" ng-show="criteriaList.length>0">
<span class="text-bold margin-left20" translate="FilterCriteriaTags"></span>:
<span class="tag label label-default" ng-repeat="criteria in criteriaListFirstRow">
<span title="{{criteria.fullName}}">
{{criteria.name}}
</span>
<a><i class="remove glyphicon glyphicon-remove-sign glyphicon-white" ng-click="doDataFilter(criteria.propertyName)"></i></a>
</span>
<span ng-if="criteriaList.length>6"><br /></span>
<span ng-if="criteriaList.length>6" style="margin-left: 81px; margin-top: 19px; display: inline-block;"></span>
<span ng-if="criteriaList.length>6" class="tag label label-default" ng-repeat="criteria in criteriaListSecondRow">
<span title="{{criteria.fullName}}">
{{criteria.name}}
</span>
<a><i class="remove glyphicon glyphicon-remove-sign glyphicon-white" ng-click="doDataFilter(criteria.propertyName)"></i></a>
</span>
</div>
<div id="mainAreaDiv" class="main-area">
<div class="inputInvoiceGrid" ui-grid="gridOptions">
<div class="watermark" ng-show="!gridOptions.data.length"><span translate="NoDataAvailable"></span></div>
</div>
<div class="pagination-container">
<span>本页{{curPageItemCount}}条记录,共{{queryProfitLossResult.pageInfo.total}}条记录</span>
<div id="totalInvoicePage" class="common-pagination" style="display:none;">
</div>
</div>
</div>
</div>
vatModule.directive('vatPreviewProfitTable', ['$log', 'browserService', '$translate', 'region', '$timeout',
function ($log, browserService, $translate, region, $timeout) {
$log.debug('vatPreviewProfitTable.ctor()...');
return {
restrict: 'E',
templateUrl: '/app/vat/preview/vat-preview-profit-table/vat-preview-profit-table.html' + '?_=' + Math.random(),
scope: {},
controller: 'VatPreviewProfitTableController',
link: function ($scope, element) {
}
}
}
]);
\ No newline at end of file
@import "~/app-resources/less/theme.less";
.vat-preview-profit-table {
background-color: white;
height: 100%;
.numAmount {
padding: 0 3px;
height: 21px;
margin-left: 5px;
/* font-family: 'Arial'; */
font-weight: 600;
border-radius: 2px;
font-style: normal;
outline: none;
border: none;
min-width: 20px;
background-color: #DDDDDD;
color: #AA0000;
}
.top-area-wrapper {
height: 45px;
width: 98%;
margin: 0 20px;
.filter-button {
width: 30px;
margin-top: 16px;
}
.operation-wrapper {
margin: 15px 25px 10px 10px;
span {
cursor: pointer;
}
}
}
.filter-popup-wrapper {
display: none;
}
.margin-left20 {
margin-left: 20px;
}
/*******************************************/
/*Filter Criteria tags:*/
.tag {
font-size: 12px;
padding: .3em .4em .4em;
margin: 0 .1em;
a {
color: #bbb;
cursor: pointer;
opacity: 0.6;
margin: 0 0 0 .3em;
&:hover {
opacity: 1.0;
}
.glyphicon-white {
color: #fff;
margin-bottom: 2px;
}
}
.remove {
vertical-align: bottom;
top: 0;
}
}
/*Filter Criteria tags:*/
/*******************************************/
.main-area {
height: 100%;
margin: 0 20px;
.watermark {
position: absolute;
top: 50%;
transform: translateY(-50%);
opacity: .25;
font-size: 3em;
width: 100%;
text-align: center;
z-index: 1000;
}
.inputInvoiceGrid {
width: 100%;
height: calc(~'100% - 158px');
.ui-grid-header-cell-wrapper .ui-grid-header-cell-row .ui-grid-cell-contents {
height: 40px;
i {
display: none;
}
}
}
}
.form-control {
&:focus {
border-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
border: 1px solid #ccc;
}
}
.input-width-middle {
width: 217px;
}
}
.rightHeader{
text-align: right;
}
.popover {
min-width: 370px;
left: 119px !important;
.arrow {
left: 5% !important;
}
}
.popover-content {
td {
text-align: right;
padding: 6px;
span {
float: left;
}
}
.form-control {
display: inline-block;
&:focus {
border-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
border: 1px solid #ccc;
}
}
.input-width-small {
width: 100px;
}
.input-width-middle {
width: 217px;
}
}
<div class="popover">
<div class="arrow"></div>
<div class="popover-content">
<div>
<table class="table table-responsive">
<tr>
<td>
<span translate="InvoiceRZRQQuery"></span>
<input class="form-control input-width-small" id="certificationDateStart" ng-model="queryParams.certificationDateStart" />&nbsp;-&nbsp;
<input class="form-control input-width-small" id="certificationDateEnd" ng-model="queryParams.certificationDateEnd" />
</td>
</tr>
<tr>
<td>
<span translate="InvoiceFPDMQuery"></span>
<input class="form-control input-width-middle" type="text" id="invoiceCode" ng-model="queryParams.invoiceCode" />
</td>
</tr>
<tr>
<td>
<span translate="InvoiceFPHMQuery"></span>
<input class="form-control input-width-middle" type="text" id="invoiceNumber" ng-model="queryParams.invoiceNumber" />
</td>
</tr>
<tr>
<td>
<span translate="InvoiceGHFSHQuery"></span>
<input class="form-control input-width-middle" type="text" id="sellerTaxNumber" ng-model="queryParams.sellerTaxNumber" />
</td>
</tr>
<tr>
<td>
<span translate="InvoiceJEQuery"></span>
<input class="form-control input-width-small" type="text" id="amountStart" ng-model="queryParams.amountStart" onkeyup="PWC.inputNumberFormat(this);" />&nbsp;-&nbsp;
<input class="form-control input-width-small" type="text" id="amountEnd" ng-model="queryParams.amountEnd" onkeyup="PWC.inputNumberFormat(this);" />
</td>
</tr>
<tr>
<td>
<span translate="InvoiceSEQuery"></span>
<input class="form-control input-width-small" type="text" id="taxAmountStart" ng-model="queryParams.taxAmountStart" onkeyup="PWC.inputNumberFormat(this);" />&nbsp;-&nbsp;
<input class="form-control input-width-small" type="text" id="taxAmountEnd" ng-model="queryParams.taxAmountEnd" onkeyup="PWC.inputNumberFormat(this);" />
</td>
</tr>
<tr>
<td>
<span translate="InvoiceFPLXQuery"></span>
<div class="ui-select-has-border input-width-middle">
<ui-select ng-model="InvoiceType.selected" search-enabled="false" style="text-align:left;" class="input-width-middle">
<ui-select-match>{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="item in invoiceTypeList | propsFilter: {name: $select.search}">
<div title="{{item.name}}" ng-bind-html="item.name"></div>
</ui-select-choices>
</ui-select>
</div>
</td>
</tr>
<tr>
<td>
<span translate="InvoiceRZJGQuery"></span>
<div class="ui-select-has-border input-width-middle">
<ui-select ng-model="CertificationStatus.selected" search-enabled="false" style="text-align: left; " class="input-width-middle">
<ui-select-match>{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="item in cetificationResultList | propsFilter: {name: $select.search}">
<div title="{{item.name}}" ng-bind-html="item.name"></div>
</ui-select-choices>
</ui-select>
</div>
</td>
</tr>
</table>
</div>
<div class="row">
<div style="float:right;margin-right:10px;">
<button class="btn btn-default btn-primary" ng-click="doDataFilter('')">
<span class="fa fa-chevron-down" aria-hidden="true"> </span> <span translate="Confirm"></span>
</button>
<button class="btn btn-default margin-right10" ng-click="doDataFilterReset()">
<span class="fa fa-times" aria-hidden="true"> </span> <span translate="Reset"></span>
</button>
</div>
</div>
</div>
</div>
vatModule.controller('VatPreviewTheBalanceSheetController', ['$rootScope','$scope', '$log','$filter', '$translate', '$timeout', 'SweetAlert', '$q', 'uiGridConstants', '$interval', 'vatPreviewService', 'browserService', 'vatSessionService', 'region', 'enums', 'vatExportService',
function ($rootScope,$scope, $log,$filter, $translate, $timeout, SweetAlert, $q, uiGridConstants, $interval, vatPreviewService, browserService, vatSessionService, region, enums, vatExportService) {
'use strict';
$scope.startDate = new Date(vatSessionService.project.year, 0, 1);
$scope.endDate = new Date(vatSessionService.project.year, 11, 31);
$scope.dateFormat = $translate.instant('dateFormat4YearMonthDay');
$scope.startMonth = vatSessionService.month;
$scope.endMonth = vatSessionService.month;
$scope.totalMoneyAmount = 0;
$scope.totalTaxAmount = 0;
$scope.pageSize = constant.vatPagesize;
var minDate = [1, vatSessionService.project.year];
// var minDate = moment().startOf('month').subtract(0, 'months');
var maxDate = [12, vatSessionService.project.year];
var setDate = [
[vatSessionService.month, vatSessionService.project.year],
[vatSessionService.month, vatSessionService.project.year]];
//发票类型
var invoiceTypeEnum = {
VATInvoice: $translate.instant('VATInvoice'),
FreightTransport: $translate.instant('FreightTransport'),
MotorVehicle: $translate.instant('MotorVehicle'),
AgriculturalProduct: $translate.instant('AgriculturalProduct')
};
$scope.monthList = [$translate.instant('Month01'),
$translate.instant('Month02'),
$translate.instant('Month03'),
$translate.instant('Month04'),
$translate.instant('Month05'),
$translate.instant('Month06'),
$translate.instant('Month07'),
$translate.instant('Month08'),
$translate.instant('Month09'),
$translate.instant('Month10'),
$translate.instant('Month11'),
$translate.instant('Month12')
];
//认证结果
$scope.cetificationResultList = [
{ id: 999, name: $translate.instant('AllTheItems') },
{ id: 1, name: $translate.instant('CertificationPass') },
{ id: 2, name: $translate.instant('CertificationNotPass') }
];
//发票类型
$scope.invoiceTypeList = [
{ id: 999, name: $translate.instant('AllTheItems') },
{ id: enums.invoiceType.VATInvoice, name: $translate.instant('VATInvoice') },
{ id: enums.invoiceType.FreightTransport, name: $translate.instant('FreightTransport') },
{ id: enums.invoiceType.MotorVehicle, name: $translate.instant('MotorVehicle') },
{ id: enums.invoiceType.AgriculturalProduct, name: $translate.instant('AgriculturalProduct') }
];
$scope.InvoiceType = {};
$scope.CertificationStatus = {};
//初始化期间
var initPeriods = function () {
var curMonth = new Date().getMonth() + 1;
$scope.queryParams = {
pageInfo: {},
periodStart: '',
periodEnd: '',
orgId: ''
};
};
//从数据库中load数据
var loadBalanceSheetDataFromDB = function (pageIndex) {
initBalanceSheetPagination();
$scope.curBalanceSheetPage = pageIndex;
//初始化查询信息
$scope.queryParams.pageInfo = {
totalCount: $scope.queryBalanceSheetResult.pageInfo.totalCount,
pageIndex: pageIndex,
pageSize: $scope.queryBalanceSheetResult.pageInfo.pageSize,
totalPage: 0
};
$scope.queryParams.orgId = vatSessionService.project.organizationID;
$scope.getDataFromDatabase($scope.queryParams);
};
$scope.getDataFromDatabase = function (queryParams){
vatPreviewService.getBalanceSheetDataForDisplay(queryParams).success(function (data) {
if (data) {
// minDate = data.
var index = 1;
data.list.forEach(function (v) {
v.index = index++;
});
$scope.gridOptions.data = data.list;
$scope.queryBalanceSheetResult.pageInfo = data;
computeBalanceSheetPage();
$scope.ledgerName = data.list[0].ledgerName;
$scope.currencyCode = data.list[0].ledgerCurrencyCode;
$scope.status = data.list[0].status;
$scope.importDate = $filter('date')(data.list[0].date, "yyyy-MM-dd hh:mm:ss");
}
});
};
//点击任意一页加载数据事件
var loadIncomeInvoiceDataByPage = function (pageIndex) {
loadBalanceSheetDataFromDB(pageIndex);
};
//计算页数,创建分页栏
var computeBalanceSheetPage = function () {
if ($scope.queryBalanceSheetResult.pageInfo && $scope.queryBalanceSheetResult.pageInfo.total > 0) {
var totalPage = parseInt($scope.queryBalanceSheetResult.pageInfo.total / $scope.pageSize);
totalPage = $scope.queryBalanceSheetResult.pageInfo.totalCount % $scope.pageSize == 0 ? totalPage : totalPage + 1;
//计算本页记录数
if ($scope.queryBalanceSheetResult.pageInfo.pageNum === totalPage) {
$scope.curPageItemCount = $scope.queryBalanceSheetResult.pageInfo.total % $scope.pageSize;
}
else {
$scope.curPageItemCount = $scope.pageSize;
}
$scope.queryBalanceSheetResult.pageInfo.totalPage = totalPage;
var createPage = $("#totalInvoicePage").createPage({
pageCount: totalPage,
current: $scope.curBalanceSheetPage,
backFn: function (p) {
//单击回调方法,p是当前页码
loadIncomeInvoiceDataByPage(p);
}
});
$('#totalInvoicePage').css('display', 'inline-block');
} else {
//如果查询结果为0,则直接设置本页记录数为0
$scope.curPageItemCount = 0;
var createPage = $("#totalInvoicePage").createPage({
pageCount: 0,
current: $scope.curBalanceSheetPage,
backFn: function (p) {
//单击回调方法,p是当前页码
loadIncomeInvoiceDataByPage(p);
}
});
$('#totalInvoicePage').css('display', 'inline-block');
}
};
//初始化分页信息
var initBalanceSheetPagination = function () {
$scope.queryBalanceSheetResult = {
list: [],
pageInfo: {
totalCount: -1,
pageIndex: 1,
pageSize: constant.pagesize,
totalPage: 0,
}
}
$scope.curBalanceSheetPage = 1;
};
//将选择了的查询条件显示在grid上方
var doDataFilter = function (removeData) {
if ($scope.queryParams.periodStart > $scope.queryParams.periodEnd) {
$scope.queryParams.periodEnd = $scope.queryParams.periodStart;
}
//设置需要去掉的查询条件的值为空
if (!PWC.isNullOrEmpty(removeData)) {
var removeItem = removeData.split("|");
removeItem.forEach(function (v) {
$scope.queryParams[v] = null;
//如果去掉了发票代码的查询条件,则将查询条件设置为'',因为是字符串,设置为null会导致查询结果错误
if ($scope.queryParams.invoiceCode === null) {
$scope.queryParams.invoiceCode = '';
}
//如果去掉了发票号码的查询条件,则将查询条件设置为'',因为是字符串,设置为null会导致查询结果错误
if ($scope.queryParams.invoiceNumber === null) {
$scope.queryParams.invoiceNumber = '';
}
//如果去掉了供货方税号的查询条件,则将查询条件设置为'',因为是字符串,设置为null会导致查询结果错误
if ($scope.queryParams.sellerTaxNumber === null) {
$scope.queryParams.sellerTaxNumber = '';
}
if ($scope.queryParams.invoiceType === null) {
$scope.InvoiceType.selected = undefined;
}
if ($scope.queryParams.certificationStatus === null) {
$scope.CertificationStatus.selected = undefined;
}
});
}
//设置发票类型和认证结果
if ($scope.InvoiceType.selected !== undefined)
$scope.queryParams.invoiceType = $scope.InvoiceType.selected.id;
else
$scope.queryParams.invoiceType = null;
if ($scope.CertificationStatus.selected !== undefined)
$scope.queryParams.certificationStatus = $scope.CertificationStatus.selected.id;
else
$scope.queryParams.certificationStatus = null;
// 将查询条件加入到grid上方
var crits = $scope.queryParams;
//定义查询条件数组用于存放已选的查询条件
$scope.criteriaList = [];
var crit = [];
//认证日期
if (!PWC.isNullOrEmpty(crits.certificationDateStart) && !PWC.isNullOrEmpty(crits.certificationDateEnd)) {
if (new Date(crits.certificationDateStart.replace(/[\.-]/g, '/')) > new Date(crits.certificationDateEnd.replace(/[\.-]/g, '/'))) {
$scope.criteriaList = [];
SweetAlert.warning($translate.instant('InvoiceDateQueryError'));
return;
}
crit = new Object;
crit.name = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateStart + "-" + crits.certificationDateEnd;;
crit.fullName = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateStart + "-" + crits.certificationDateEnd;
crit.valueFrom = crits.certificationDateStart;
crit.valueTo = crits.certificationDateEnd;
crit.propertyName = "certificationDateStart|certificationDateEnd";
$scope.criteriaList.push(crit);
} else if (!PWC.isNullOrEmpty(crits.certificationDateStart) && PWC.isNullOrEmpty(crits.invoiceDateEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateStart + $translate.instant('After');
crit.fullName = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateStart + $translate.instant('After');
crit.valueFrom = crits.certificationDateStart;
crit.valueTo = crits.certificationDateEnd;
crit.propertyName = "certificationDateStart|certificationDateEnd";
$scope.criteriaList.push(crit);
}
else if (PWC.isNullOrEmpty(crits.certificationDateStart) && !PWC.isNullOrEmpty(crits.certificationDateEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateEnd + $translate.instant('Before');
crit.fullName = $translate.instant('InvoiceRZRQQuery') + crits.certificationDateEnd + $translate.instant('Before');
crit.valueFrom = crits.certificationDateStart;
crit.valueTo = crits.certificationDateEnd;
crit.propertyName = "certificationDateStart|certificationDateEnd";
$scope.criteriaList.push(crit);
}
//发票代码
if (!PWC.isNullOrEmpty(crits.invoiceCode)) {
crit = new Object;
crit.name = $translate.instant('InvoiceFPDMQuery') + PWC.limitString(crits.invoiceCode, 10);
crit.fullName = $translate.instant('InvoiceFPDMQuery') + crits.invoiceCode;
crit.valueFrom = crits.invoiceCode;
crit.propertyName = "invoiceCode";
$scope.criteriaList.push(crit);
}
//发票号码
if (!PWC.isNullOrEmpty(crits.invoiceNumber)) {
crit = new Object;
crit.name = $translate.instant('InvoiceFPHMQuery') + PWC.limitString(crits.invoiceNumber, 10);
crit.fullName = $translate.instant('InvoiceFPHMQuery') + crits.invoiceNumber;
crit.valueFrom = crits.invoiceNumber;
crit.propertyName = "invoiceNumber";
$scope.criteriaList.push(crit);
}
//销方识别号
if (!PWC.isNullOrEmpty(crits.sellerTaxNumber)) {
crit = new Object;
crit.name = $translate.instant('InvoiceGHFSHQuery') + PWC.limitString(crits.sellerTaxNumber, 10);
crit.fullName = $translate.instant('InvoiceGHFSHQuery') + crits.sellerTaxNumber;
crit.valueFrom = crits.sellerTaxNumber;
crit.propertyName = "sellerTaxNumber";
$scope.criteriaList.push(crit);
}
//金额
if (!PWC.isNullOrEmpty(crits.amountStart) && !PWC.isNullOrEmpty(crits.amountEnd)) {
if (Number(crits.amountStart) > Number(crits.amountEnd)) {
SweetAlert.warning($translate.instant('AmountQueryError'));
return;
}
crit = new Object;
crit.name = $translate.instant('InvoiceJEQuery') + PWC.limitString(crits.amountStart, 5) + ' - ' + PWC.limitString(crits.amountEnd, 5);
crit.fullName = $translate.instant('InvoiceJEQuery') + crits.amountStart + ' - ' + crits.amountEnd;
crit.valueFrom = crits.amountStart;
crit.valueTo = crits.amountEnd;
crit.propertyName = "amountStart|amountEnd";
$scope.criteriaList.push(crit);
}
else if (!PWC.isNullOrEmpty(crits.amountStart) && PWC.isNullOrEmpty(crits.amountEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceJEQuery') + PWC.limitString(crits.amountStart, 5) + $translate.instant('MoreThan');
crit.fullName = $translate.instant('InvoiceJEQuery') + crits.amountStart + $translate.instant('MoreThan');
crit.valueFrom = crits.amountStart;
crit.valueTo = crits.amountEnd;
crit.propertyName = "amountStart|amountEnd";
$scope.criteriaList.push(crit);
}
else if (PWC.isNullOrEmpty(crits.amountStart) && !PWC.isNullOrEmpty(crits.amountEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceJEQuery') + PWC.limitString(crits.amountEnd, 5) + $translate.instant('LessThan');
crit.fullName = $translate.instant('InvoiceJEQuery') + crits.amountEnd + $translate.instant('LessThan');
crit.valueFrom = crits.amountStart;
crit.valueTo = crits.amountEnd;
crit.propertyName = "amountStart|amountEnd";
$scope.criteriaList.push(crit);
}
//税额
if (!PWC.isNullOrEmpty(crits.taxAmountStart) && !PWC.isNullOrEmpty(crits.taxAmountEnd)) {
if (Number(crits.taxAmountStart) > Number(crits.taxAmountEnd)) {
SweetAlert.warning($translate.instant('TaxAmountQueryError'));
return;
}
crit = new Object;
crit.name = $translate.instant('InvoiceSEQuery') + PWC.limitString(crits.taxAmountStart, 5) + ' - ' + PWC.limitString(crits.taxAmountEnd, 5);
crit.fullName = $translate.instant('InvoiceSEQuery') + crits.taxAmountStart + ' - ' + crits.taxAmountEnd;
crit.valueFrom = crits.taxAmountStart;
crit.valueTo = crits.taxAmountEnd;
crit.propertyName = "taxAmountStart|taxAmountEnd";
$scope.criteriaList.push(crit);
}
else if (!PWC.isNullOrEmpty(crits.taxAmountStart) && PWC.isNullOrEmpty(crits.taxAmountEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceSEQuery') + PWC.limitString(crits.taxAmountStart, 5) + $translate.instant('MoreThan');
crit.fullName = $translate.instant('InvoiceSEQuery') + crits.taxAmountStart + $translate.instant('MoreThan');
crit.valueFrom = crits.taxAmountStart;
crit.valueTo = crits.taxAmountEnd;
crit.propertyName = "taxAmountStart|taxAmountEnd";
$scope.criteriaList.push(crit);
}
else if (PWC.isNullOrEmpty(crits.taxAmountStart) && !PWC.isNullOrEmpty(crits.taxAmountEnd)) {
crit = new Object;
crit.name = $translate.instant('InvoiceSEQuery') + PWC.limitString(crits.taxAmountEnd, 5) + $translate.instant('LessThan');
crit.fullName = $translate.instant('InvoiceSEQuery') + crits.taxAmountEnd + $translate.instant('LessThan');
crit.valueFrom = crits.taxAmountStart;
crit.valueTo = crits.taxAmountEnd;
crit.propertyName = "taxAmountStart|taxAmountEnd";
$scope.criteriaList.push(crit);
}
//发票类型
if (!PWC.isNullOrEmpty(crits.invoiceType)) {
crit = new Object;
crit.valueFrom = _.find($scope.invoiceTypeList, function (v) {
return v.id === crits.invoiceType;
}).name;
crit.name = $translate.instant('InvoiceFPLXQuery') + crit.valueFrom;
crit.fullName = $translate.instant('InvoiceFPLXQuery') + crit.valueFrom;
crit.propertyName = "invoiceType";
$scope.criteriaList.push(crit);
}
//认证结果
if (!PWC.isNullOrEmpty(crits.certificationStatus)) {
crit = new Object;
crit.valueFrom = _.find($scope.cetificationResultList, function (v) {
return v.id === crits.certificationStatus;
}).name;
crit.name = $translate.instant('InvoiceRZJGQuery') + crit.valueFrom;
crit.fullName = $translate.instant('InvoiceRZJGQuery') + crit.valueFrom;
crit.propertyName = "certificationStatus";
$scope.criteriaList.push(crit);
}
// add to Criteria List for display on top of the grid:
//********************************************************************************
var criteria = JSON.stringify($scope.queryParams);
if (browserService.isIE() || browserService.isEdge())
criteria = encodeURIComponent(criteria);
// countTotal();
loadBalanceSheetDataFromDB(1);
if ($scope.criteriaList.length > 6) {
$scope.criteriaListFirstRow = $scope.criteriaList.slice(0, 6);
$scope.criteriaListSecondRow = $scope.criteriaList.slice(6, $scope.criteriaList.length);
}
else {
$scope.criteriaListFirstRow = $scope.criteriaList.slice(0, $scope.criteriaList.length);
}
$('.filter-button').popover("hide");
};
//去掉所有的查询条件,重新load数据
var doDataFilterReset = function () {
$scope.queryParams = {
pageInfo: {},
periodStart: '',
periodEnd: '',
certificationDateStart: null,
certificationDateEnd: null,
invoiceCode: '',
invoiceNumber: '',
sellerTaxNumber: '',
amountStart: null,
amountEnd: null,
invoiceType: null,
taxAmountStart: null,
taxAmountEnd: null,
certificationStatus: null
};
$scope.criteriaList = [];
$scope.queryParams.periodStart = $scope.startMonth;
$scope.queryParams.periodEnd = $scope.endMonth;
loadBalanceSheetDataFromDB(1);
$('.filter-button').popover("hide");
};
var prepareSummary = function () {
// do something before show popover
};
//在popover打开时执行事件
var showPopover = function () {
$timeout(function () {
initDatePickers();
}, 500);
};
//初始化时间控件
var initDatePickers = function () {
//认证开始时间
var ele1 = $("#certificationDateStart");
ele1.datepicker({
startDate: $scope.startDate,
endDate: $scope.endDate,
language: region,
autoclose: true,//选中之后自动隐藏日期选择框
clearBtn: true,//清除按钮
todayBtn: false,//今日按钮
format: $scope.dateFormat//日期格式,详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
});
ele1.datepicker("setDate", $scope.queryParams.certificationDateStart);
//认证结束时间
var ele2 = $("#certificationDateEnd");
ele2.datepicker({
startDate: $scope.startDate,
endDate: $scope.endDate,
language: region,
autoclose: true,//选中之后自动隐藏日期选择框
clearBtn: true,//清除按钮
todayBtn: false,//今日按钮
format: $scope.dateFormat//日期格式,详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
})
ele2.datepicker("setDate", $scope.queryParams.certificationDateEnd);
//初始化已选择的发票类型和认证结果
$scope.InvoiceType.selected = _.find($scope.invoiceTypeList, function (v) {
return v.id == $scope.queryParams.invoiceType;
})
$scope.CertificationStatus.selected = _.find($scope.cetificationResultList, function (v) {
return v.id == $scope.queryParams.certificationStatus;
})
};
//导出进项发票数据
var downloadBS = function () {
vatPreviewService.initExportBalanceSheetData($scope.queryParams).success(function (data, status, headers) {
if(status===204){
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, '资产负债表信息');
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
(function initialize() {
$log.debug('VatPreviewInputInvoiceController.ctor()...');
$('#input-invoice-period-picker').focus(function () {
$('.filter-button').popover("hide");
});
//初始化month-picker
$('#input-invoice-period-picker').rangePicker({
minDate: minDate,
maxDate: maxDate,
setDate: setDate,
months: $scope.monthList,//['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
ConfirmBtnText: $translate.instant('Confirm'),
CancelBtnText: $translate.instant('ButtonCancel')
})
.on('datePicker.done', function (e, result) {
//开始月份
var startMonth = result[0][1] * 100 + result[0][0];
//结束月份
var endMonth = result[1][1] * 100 + result[1][0];
$scope.startMonth = startMonth;
$scope.endMonth = endMonth;
$scope.queryParams.periodStart = startMonth;
$scope.queryParams.periodEnd = endMonth;
loadBalanceSheetDataFromDB(1);
});
$scope.gridOptions = {
rowHeight: constant.UIGrid.rowHeight,
selectionRowHeaderWidth: constant.UIGrid.rowHeight,
// expandableRowTemplate: '<div ui-grid="row.entity.subGridOptions" style="height:150px;"></div>',
virtualizationThreshold: 50,//默认加载50条数据,避免在数据展示时,只显示前面4条
enableSorting: false,
enableColumnMenus: false,
enableHorizontalScrollbar : 1,
columnDefs: [
{
name: $translate.instant('ProjectName'),
cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.itemName}}<span></div>'
},
{
name: $translate.instant('EndingBalance'),
headerCellClass:'rightHeader',
cellTemplate: '<div class="ui-grid-cell-contents" style="text-align: right"><span>{{row.entity.endBal | number:2}}<span></div>'
},
{
name: $translate.instant('InitialBalance'),
headerCellClass:'rightHeader',
cellTemplate: '<div class="ui-grid-cell-contents" style="text-align: right"><span>{{row.entity.begBal | number:2}}</span></div>'
}
]
};
$scope.doDataFilter = doDataFilter;
$scope.doDataFilterReset = doDataFilterReset;
$scope.prepareSummary = prepareSummary;
$scope.showPopover = showPopover;
$scope.downloadBS = downloadBS;
initPeriods();
initBalanceSheetPagination();
//初始化查询条件-期间范围
$scope.queryParams.periodStart = vatSessionService.year * 100 + vatSessionService.month;
$scope.queryParams.periodEnd = vatSessionService.year * 100 + vatSessionService.month;
$scope.queryParams.orgId = vatSessionService.project.organizationID;
if($rootScope.currentLanguage === 'en-us'){
$('.periodInput')[0].style.left = "260px";
}else{
$('.periodInput')[0].style.left = "150px";
}
loadBalanceSheetDataFromDB(1);
})();
}
]);
<div class="vat-preview-the-balance-sheet" id="mainPreviewDiv">
<div class="top-area-wrapper" style="margin-top: 30px">
<!--<button class="filter-button"
atms-popover ng-mouseenter="prepareSummary()" ng-click="showPopover()"
popover-container="body" popover-auto-hide="true" data-overwrite="true"
use-optimized-placement-algorithm="true"
data-placement="bottom"
data-templateurl="/app/vat/preview/vat-preview-off-balance-sheet/vat-preview-off-balance-sheet-search.html">
<i class="fa fa-filter" aria-hidden="true"></i>
</button>-->
<span translate="OffBalanceSheetTitle" class="text-bold"></span> &nbsp;&nbsp;|&nbsp;&nbsp;<span class="text-bold" translate="InvoiceQJ"></span>
<input type="text" class="form-control input-width-middle periodInput" style="position: relative; top: -30px; left: 180px;" id="input-invoice-period-picker" />
<span ng-click="downloadBS()" style="position: relative; top: -61px; left: 95%;"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'ExportBtn' | translate}}</span>
</div>
<div style="margin-bottom: 8px;margin-left: 30px">
{{'EnterpriseAccountSetName' | translate}}<span class="numAmount">{{ledgerName}}</span>&nbsp;&nbsp;&nbsp;
{{'EnterpriseAccountSetCurrency' | translate}}<span class="numAmount">{{currencyCode}}</span>&nbsp;&nbsp;&nbsp;
{{'IsCloseAccount' | translate}}<span class="numAmount">{{status}}</span>
{{'ImportTime' | translate}}<span class="numAmount">{{importDate| date:'yyyy-MM-dd hh:mm:ss'}}</span>
</div>
<div id="filterCriteriaDiv" style="max-width:98%;margin-bottom:2px;" ng-show="criteriaList.length>0">
<span class="text-bold margin-left20" translate="FilterCriteriaTags"></span>:
<span class="tag label label-default" ng-repeat="criteria in criteriaListFirstRow">
<span title="{{criteria.fullName}}">
{{criteria.name}}
</span>
<a><i class="remove glyphicon glyphicon-remove-sign glyphicon-white" ng-click="doDataFilter(criteria.propertyName)"></i></a>
</span>
<span ng-if="criteriaList.length>6"><br /></span>
<span ng-if="criteriaList.length>6" style="margin-left: 81px; margin-top: 19px; display: inline-block;"></span>
<span ng-if="criteriaList.length>6" class="tag label label-default" ng-repeat="criteria in criteriaListSecondRow">
<span title="{{criteria.fullName}}">
{{criteria.name}}
</span>
<a><i class="remove glyphicon glyphicon-remove-sign glyphicon-white" ng-click="doDataFilter(criteria.propertyName)"></i></a>
</span>
</div>
<div id="mainAreaDiv" class="main-area">
<div class="inputInvoiceGrid" ui-grid="gridOptions">
<div class="watermark" ng-show="!gridOptions.data.length"><span translate="NoDataAvailable"></span></div>
</div>
<div class="pagination-container">
<span>本页{{curPageItemCount}}条记录,共{{queryBalanceSheetResult.pageInfo.total}}条记录</span>
<div id="totalInvoicePage" class="common-pagination" style="display:none;">
</div>
</div>
</div>
</div>
vatModule.directive('vatPreviewTheBalanceSheet', ['$log', 'browserService', '$translate', 'region', '$timeout',
function ($log, browserService, $translate, region, $timeout) {
$log.debug('vatPreviewTheBalanceSheet.ctor()...');
return {
restrict: 'E',
templateUrl: '/app/vat/preview/vat-preview-the-balance-sheet/vat-preview-the-balance-sheet.html' + '?_=' + Math.random(),
scope: {},
controller: 'VatPreviewTheBalanceSheetController',
link: function ($scope, element) {
}
}
}
]);
\ No newline at end of file
@import "~/app-resources/less/theme.less";
.vat-preview-the-balance-sheet {
background-color: white;
height: 100%;
.numAmount {
padding: 0 3px;
height: 21px;
margin-left: 5px;
/* font-family: 'Arial'; */
font-weight: 600;
border-radius: 2px;
font-style: normal;
outline: none;
border: none;
min-width: 20px;
background-color: #DDDDDD;
color: #AA0000;
}
.top-area-wrapper {
height: 45px;
width: 98%;
margin: 0 20px;
.filter-button {
width: 30px;
margin-top: 16px;
}
.operation-wrapper {
margin: 15px 25px 10px 10px;
span {
cursor: pointer;
}
}
}
.filter-popup-wrapper {
display: none;
}
.margin-left20 {
margin-left: 20px;
}
/*******************************************/
/*Filter Criteria tags:*/
.tag {
font-size: 12px;
padding: .3em .4em .4em;
margin: 0 .1em;
a {
color: #bbb;
cursor: pointer;
opacity: 0.6;
margin: 0 0 0 .3em;
&:hover {
opacity: 1.0;
}
.glyphicon-white {
color: #fff;
margin-bottom: 2px;
}
}
.remove {
vertical-align: bottom;
top: 0;
}
}
/*Filter Criteria tags:*/
/*******************************************/
.main-area {
height: 100%;
margin: 0 20px;
.watermark {
position: absolute;
top: 50%;
transform: translateY(-50%);
opacity: .25;
font-size: 3em;
width: 100%;
text-align: center;
z-index: 1000;
}
.inputInvoiceGrid {
width: 100%;
height: calc(~'100% - 158px');
.ui-grid-header-cell-wrapper .ui-grid-header-cell-row .ui-grid-cell-contents {
height: 40px;
i {
display: none;
}
}
}
}
.form-control {
&:focus {
border-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
border: 1px solid #ccc;
}
}
.input-width-middle {
width: 217px;
}
}
.rightHeader{
text-align: right;
}
.popover {
min-width: 370px;
left: 119px !important;
.arrow {
left: 5% !important;
}
}
.popover-content {
td {
text-align: right;
padding: 6px;
span {
float: left;
}
}
.form-control {
display: inline-block;
&:focus {
border-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
border: 1px solid #ccc;
}
}
.input-width-small {
width: 100px;
}
.input-width-middle {
width: 217px;
}
}
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