You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
796 lines
32 KiB
796 lines
32 KiB
<!DOCTYPE html>
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
|
<head>
|
|
<th:block th:include="include :: header('新增国税发票')" />
|
|
<th:block th:include="include :: bootstrap-editable-css"/>
|
|
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
|
|
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
|
|
<th:block th:include="include :: datetimepicker-css" />
|
|
<style>
|
|
.other-container {
|
|
width: 90%;
|
|
height: 200px;
|
|
margin: auto;
|
|
}
|
|
.other {
|
|
margin-top: 20px;
|
|
}
|
|
h4 {
|
|
display: inline-block;
|
|
margin-right: 20px;
|
|
}
|
|
.modal-body{
|
|
height: 550px;
|
|
}
|
|
iframe{
|
|
width: 100%;
|
|
height: 500px;
|
|
frameborder: 0;
|
|
border: 0;
|
|
display: inline-block;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body class="white-bg">
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
<form class="form-horizontal m" id="form-taxInvoiceInfo-add">
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">发票编号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="taxInvoiceCode" class="form-control" type="text" required>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">发票号码:</label>
|
|
<div class="col-sm-8">
|
|
<input name="taxInvoiceNumber" class="form-control" type="text" required>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">送货单号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="deliveryNoteNumber" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required ">客户代码:</label>
|
|
<div class="col-sm-8">
|
|
<select name="enterpriseCode" class="form-control m-b" required>
|
|
<option value="">所有</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">客户名称:</label>
|
|
<div class="col-sm-8">
|
|
<input name="enterpriseName" class="form-control m-b" type="text" required readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">合同号码:</label>
|
|
<div class="col-sm-8">
|
|
<input name="contractNumber" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">付款条件:</label>
|
|
<div class="col-sm-8">
|
|
<input name="paymentTerm" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">开票日期:</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group date">
|
|
<input name="billingDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">运输方式:</label>
|
|
<div class="col-sm-8">
|
|
<input name="transportWay" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">运输工具:</label>
|
|
<div class="col-sm-8">
|
|
<input name="transportMeans" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">离境日期:</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group date">
|
|
<input name="departureDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">出口海关:</label>
|
|
<div class="col-sm-8">
|
|
<input name="exportCustoms" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">币别:</label>
|
|
<div class="col-sm-8">
|
|
<select name="billCommonCurrency" class="form-control m-b" th:with="type=${@dict.getType('sys_coin_class')}">
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">件数:</label>
|
|
<div class="col-sm-8">
|
|
<input name="packagesNumber" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">抵运国(地区):</label>
|
|
<div class="col-sm-8">
|
|
<input name="arrivalArea" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">指运港:</label>
|
|
<div class="col-sm-8">
|
|
<input name="portOfDestination" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">提运单号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="hoistingNumber" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">发票印字版号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="printVersionNumber" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">备注:</label>
|
|
<div class="col-sm-8">
|
|
<input name="billRemarks" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">国税发票编号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="taxInvoiceNo" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">是否收到款:</label>
|
|
<div class="col-sm-8">
|
|
<select name="getmoneyFlag" class="form-control m-b" th:with="type=${@dict.getType('sys_whether')}">
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div style="width:100%;height:1px;border-top:solid lightgrey 1px;margin-top:50px;padding:50px 0 0 0px;">
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">全部数量:</label>
|
|
<div class="col-sm-8">
|
|
<input name="totalQuantity" class="form-control" type="text" >
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">全部金额:</label>
|
|
<div class="col-sm-8">
|
|
<input name="totalMoney" class="form-control" type="text" >
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">全部金额(大写):</label>
|
|
<div class="col-sm-8">
|
|
<input name="totalMoneyUpCase" class="form-control" type="text" >
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="other-container">
|
|
<div class="other">
|
|
<h4>选择产品信息</h4>
|
|
<a class="btn btn-primary" onclick="showProductModal()"><i class="fa fa-plus"></i> 选择产品</a>
|
|
<div class="col-sm-12 select-table table-striped">
|
|
<table id="addProductTable" style="white-space:nowrap"></table>
|
|
</div>
|
|
</div>
|
|
<div class="modal inmodal" id="productInfoModal"
|
|
role="dilog" aria-hidden="true">
|
|
|
|
<!-- 查询成品资料-->
|
|
<div class="modal-dialog" style="width: 1000px;background-color: #FFFFFF">
|
|
|
|
<div class="modal-content" style="background-color: #FFFFFF">
|
|
|
|
<div class="modal-body">
|
|
<div class="container-div">
|
|
<div class="row">
|
|
<div class="col-sm-12 search-collapse">
|
|
<form id="productFormId">
|
|
<div class="select-list">
|
|
<ul>
|
|
<li>
|
|
<label>成品代码:</label>
|
|
<input type="text" name="finishProductCode"/>
|
|
</li>
|
|
<li>
|
|
<label>成品名称:</label>
|
|
<input type="text" name="finishProductName"/>
|
|
</li>
|
|
<li>
|
|
<li>
|
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('productFormId','productTable')"><i
|
|
class="fa fa-search"></i> 搜索</a>
|
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('productFormId','productTable')"><i
|
|
class="fa fa-refresh"></i> 重置</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="col-sm-12 select-table table-striped">
|
|
<table id="productTable" style="white-space:nowrap"></table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<a class="btn btn-warning btn-rounded" onclick="addProductToTable()">确认添加</a>
|
|
<a class="btn btn-primary btn-rounded" onclick="closeProductModal()">关闭</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<th:block th:include="include :: footer" />
|
|
<th:block th:include="include :: datetimepicker-js" />
|
|
<th:block th:include="include :: select2-js"/>
|
|
<th:block th:include="include :: bootstrap-table-editable-js"/>
|
|
<script th:inline="javascript">
|
|
var prefix = ctx + "taxInvoice/taxInvoiceInfo"
|
|
var prefixTaxInvoiceProduct = ctx + "taxInvoice/taxInvoiceProduct"
|
|
var prefixfinishproduct = ctx + "system/finishproduct";
|
|
|
|
var inventoryUnitDatas = [[${@dict.getType('sys_unit_class')}]];
|
|
var whetherStopDatas = [[${@dict.getType('sys_whether')}]];
|
|
var productionCategoryDatas = [[${@dict.getType('sys_production_category')}]];
|
|
var finishProductCategoryDatas = [[${@dict.getType('sys_finish_product_category')}]];
|
|
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
|
|
|
|
let userName = [[${@permission.getPrincipalProperty('userName')}]];
|
|
// console.log(userName)
|
|
|
|
$("#form-taxInvoiceInfo-add").validate({
|
|
focusCleanup: true
|
|
});
|
|
|
|
function submitHandler() {
|
|
let getData=$('#addProductTable').bootstrapTable('getData', true)
|
|
if(getData.length > 0){
|
|
if ($.validate.form()) {
|
|
//确认添加选中的成品数据
|
|
confirmProduct();
|
|
$.operate.save(prefix + "/add", $('#form-taxInvoiceInfo-add').serialize());
|
|
}
|
|
} else {
|
|
$.modal.alertWarning("未选择产品,请选择!")
|
|
}
|
|
}
|
|
|
|
$("input[name='billingDate']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true,
|
|
todayBtn: true,
|
|
todayHighlight: true,
|
|
startDate:new Date(),
|
|
initialDate: new Date()
|
|
});
|
|
|
|
$("input[name='departureDate']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true,
|
|
todayBtn: true,
|
|
todayHighlight: true,
|
|
startDate:new Date(),
|
|
initialDate: new Date()
|
|
});
|
|
|
|
$("input[name='billingDate']").datetimepicker("setDate", new Date());
|
|
$("input[name='departureDate']").datetimepicker("setDate", new Date());
|
|
|
|
$(function () {
|
|
|
|
//获取客户信息并自动填入数据
|
|
getCustomerListToForm();
|
|
|
|
//初始化添加产品表
|
|
$('#addProductTable').bootstrapTable({
|
|
pagination: true,
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
clickToSelect: true,//点击行选中
|
|
paginationDetailHAlign: ' hiddenDetailInfo',
|
|
height: 250,
|
|
uniqueId: 'finishProductCode',
|
|
onEditableSave: function (field, row, oldValue, $el) {
|
|
$('#addProductTable').bootstrapTable('updateRow',{index: row.id, row: row});
|
|
getTotal();
|
|
},
|
|
queryParams: function (params) {
|
|
//console.log("123");
|
|
var curParams = {
|
|
// 传递参数查询参数
|
|
pageSize: params.limit,
|
|
pageNum: params.offset / params.limit + 1,
|
|
// enterpriseCode: data[0].enterpriseCode
|
|
|
|
};
|
|
// console.log(data[0].enterpriseCode)
|
|
return curParams
|
|
},
|
|
columns: [
|
|
// {
|
|
// checkbox: true
|
|
// },
|
|
{
|
|
title: '操作',
|
|
align: 'center',
|
|
formatter: function (value, row, index) {
|
|
var actions = [];
|
|
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeProductData(\'' + row.finishProductCode + '\')" ><i class="fa fa-remove"></i>删除</a>');
|
|
return actions.join('');
|
|
}
|
|
},
|
|
{
|
|
field: 'finishProductCode',
|
|
title: '成品代码'
|
|
},
|
|
{
|
|
field: 'finishProductName',
|
|
title: '成品名称'
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'inventoryUnit',
|
|
title: '单位',
|
|
formatter: function (value, row, index) {
|
|
return $.table.selectDictLabel(inventoryUnitDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'commonCurrency',
|
|
title: '币别',
|
|
editable: {
|
|
type: 'select',
|
|
title: '币别',
|
|
emptytext: '币别',
|
|
source: function() {
|
|
let result = [];
|
|
for (let i = 0;i<commonCurrencyDatas.length;i++) {
|
|
result.push({value: commonCurrencyDatas[i].dictValue,text: commonCurrencyDatas[i].dictLabel})
|
|
}
|
|
return result;
|
|
},
|
|
validate: function (value) {
|
|
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'processPrice',
|
|
title: '单价',
|
|
editable: {
|
|
type: 'text',
|
|
title: '单价',
|
|
emptytext: '单价',
|
|
validate: function (v) {
|
|
if (isNaN(v)) return '单价必须是数字';
|
|
if (v<=0) return '单价必须是正数';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'quantity',
|
|
title: '数量',
|
|
editable: {
|
|
type: 'text',
|
|
title: '数量',
|
|
emptytext: '数量',
|
|
validate: function (v) {
|
|
if (isNaN(v)) return '数量必须是数字';
|
|
var ex = /^[1-9]\d*$/;
|
|
if (!ex.test(v)) return '数量必须是正整数';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'amountOfMoney',
|
|
title: '金额',
|
|
editable: {
|
|
type: 'text',
|
|
title: '金额',
|
|
emptytext: '金额',
|
|
validate: function (value) {
|
|
|
|
}
|
|
},
|
|
formatter:function(value, row, index) {
|
|
let total = row.processPrice * row.quantity;
|
|
row.amountOfMoney = row.processPrice * row.quantity;
|
|
return total.toFixed(2);
|
|
}
|
|
}]
|
|
})
|
|
|
|
//显示产品信息
|
|
showProductData();
|
|
|
|
})
|
|
|
|
//获取客户信息并自动填入数据
|
|
function getCustomerListToForm() {
|
|
$.ajax({
|
|
url: prefix + "/getCustomerList",
|
|
type: "POST",
|
|
success: function (res) {
|
|
//console.log(res)
|
|
if (res.length > 0) {
|
|
customerListData = res;
|
|
//alert(JSON.stringify(data));
|
|
for (let i in customerListData) {
|
|
$("select[name='enterpriseCode']").append("<option value='" + customerListData[i].enterpriseCode + "'>" + customerListData[i].enterpriseCode + "</option>");
|
|
}
|
|
$("select[name='enterpriseCode']").change(function () {
|
|
var code = $(this).val();
|
|
for (let i=0;i<customerListData.length;i++) {
|
|
if (customerListData[i].enterpriseCode == code) {
|
|
$("input[name='enterpriseName']").val(customerListData[i].enterpriseName);
|
|
}
|
|
}
|
|
})
|
|
|
|
} else {
|
|
$.modal.msgError(res.msg);
|
|
}
|
|
},
|
|
error: function () {
|
|
$.modal.msgError("后台出错啦!");
|
|
|
|
}
|
|
})
|
|
}
|
|
|
|
//显示产品信息
|
|
function showProductData() {
|
|
var options = {
|
|
id: 'productTable',
|
|
url: prefixfinishproduct + "/list",
|
|
showRefresh: false,
|
|
showToggle: false,
|
|
clickToSelect: true,
|
|
modalName: "产品资料",
|
|
columns: [{
|
|
checkbox: true
|
|
},
|
|
{
|
|
field: 'finishProductId',
|
|
title: '成品id',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'customerNumber',
|
|
title: '客户料号'
|
|
},
|
|
{
|
|
field: 'typeMachine',
|
|
title: '机种'
|
|
},
|
|
{
|
|
field: 'finishProductName',
|
|
title: '成品名称'
|
|
},
|
|
{
|
|
field: 'enterpriseCode',
|
|
title: '客户代码'
|
|
},
|
|
{
|
|
field: 'enterpriseName',
|
|
title: '客户名称'
|
|
},
|
|
{
|
|
field: 'inventoryUnit',
|
|
title: '库存单位',
|
|
formatter: function(value, row, index) {
|
|
return $.table.selectDictLabel(inventoryUnitDatas, value);
|
|
},
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'versionNumber',
|
|
title: '版本号'
|
|
},
|
|
{
|
|
field: 'finishProductCode',
|
|
title: '成品代码'
|
|
},
|
|
{
|
|
field: 'safetyStock',
|
|
title: '安全库存',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'stockUnitWeight',
|
|
title: '单位重量',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'gpItemSelection',
|
|
title: 'GP项选择',
|
|
formatter: function(value, row, index) {
|
|
return $.table.selectDictLabel(gpItemSelectionDatas, value);
|
|
},
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'inPlantCode',
|
|
title: '厂内编码'
|
|
},
|
|
{
|
|
field: 'whetherStop',
|
|
title: '料号是否停用',
|
|
formatter: function(value, row, index) {
|
|
return $.table.selectDictLabel(whetherStopDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'createrName',
|
|
title: '创建人',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'ordinalName',
|
|
title: '半成品对应完工工序名',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'originalNumber',
|
|
title: '原成品料号',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'customsName',
|
|
title: '海关名称',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'defaultWarehouse',
|
|
title: '默认仓库'
|
|
},
|
|
{
|
|
field: 'materialCategory',
|
|
title: '类别',
|
|
formatter: function(value, row, index) {
|
|
return $.table.selectDictLabel(materialCategoryDatas, value);
|
|
},
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'productionCategory',
|
|
title: '生产类别',
|
|
formatter: function(value, row, index) {
|
|
return $.table.selectDictLabel(productionCategoryDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'finishProductCategory',
|
|
title: '所属类别',
|
|
formatter: function(value, row, index) {
|
|
return $.table.selectDictLabel(finishProductCategoryDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'customerEngineer',
|
|
title: '客户工程师'
|
|
},
|
|
{
|
|
field: 'productDescription',
|
|
title: '产品描述',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'maximumInventory',
|
|
title: '最高库存',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'productPrice',
|
|
title: '产品售价',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'componentName',
|
|
title: '组件名称',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'createrTime',
|
|
title: '创建日期',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'ordinalNumber',
|
|
title: '半成品对应完工工序号',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'defaultLocation',
|
|
title: '默认位置',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'hsNumber',
|
|
title: 'HS号',
|
|
visible: false
|
|
|
|
},
|
|
{
|
|
field: 'kesNumber',
|
|
title: '科恩仕料号'
|
|
}]
|
|
};
|
|
$.table.init(options);
|
|
}
|
|
|
|
/*产品内容*/
|
|
//点击按钮显示产品信息模态框
|
|
function showProductModal() {
|
|
if ($.validate.form()) {
|
|
$("#productInfoModal").modal("show");
|
|
} else {
|
|
$.modal.alertWarning("请填写必填项");
|
|
}
|
|
}
|
|
|
|
//关闭产品信息模态框
|
|
function closeProductModal() {
|
|
$("#productInfoModal").modal("hide");
|
|
}
|
|
|
|
//表中添加选中的产品信息
|
|
function addProductToTable() {
|
|
var data = $("#productTable").bootstrapTable("getSelections");
|
|
var count = $('#addProductTable').bootstrapTable('getData').length;
|
|
var taxInvoiceCode = $("input[name='taxInvoiceCode']").val();
|
|
var taxInvoiceNumber = $("input[name='taxInvoiceNumber']").val();
|
|
// console.log(data);
|
|
// console.log(count);
|
|
for (i = 0; i < data.length; i++) {
|
|
let finishProduct = $('#addProductTable').bootstrapTable('getRowByUniqueId', data[i].finishProductCode);
|
|
if (finishProduct != null) {
|
|
alert(finishProduct.finishProductName + "已存在,不可重复添加!");
|
|
continue;
|
|
}
|
|
$("#addProductTable").bootstrapTable('insertRow', {
|
|
index: count + i,
|
|
row: {
|
|
taxInvoiceCode: taxInvoiceCode,
|
|
taxInvoiceNumber: taxInvoiceNumber,
|
|
finishProductCode: data[i].finishProductCode,
|
|
finishProductName: data[i].finishProductName,
|
|
specificationModel: data[i].specificationModel,
|
|
inventoryUnit: data[i].inventoryUnit,
|
|
commonCurrency: '',
|
|
quantity: '',
|
|
processPrice: '',
|
|
amountOfMoney: ''
|
|
}
|
|
});
|
|
}
|
|
$("#productTable").bootstrapTable("uncheckAll");
|
|
closeProductModal();
|
|
}
|
|
|
|
//确认添加选中的产品数据
|
|
function confirmProduct() {
|
|
let data = JSON.stringify($('#addProductTable').bootstrapTable('getData', true));
|
|
|
|
let datalist=$('#addProductTable').bootstrapTable('getData', true)
|
|
if (datalist.length > 0) {
|
|
$.ajax({
|
|
url: prefixTaxInvoiceProduct + '/add',
|
|
type: "POST",
|
|
data: {
|
|
data: data
|
|
},
|
|
dataType: "json",
|
|
success: function (resp) {
|
|
// console.log(data)
|
|
console.log(resp)
|
|
}
|
|
|
|
})
|
|
}
|
|
}
|
|
|
|
//添加表格内删除产品信息
|
|
function removeProductData(finishProductCode){
|
|
var ids = [];
|
|
ids.push(finishProductCode);
|
|
$('#addProductTable').bootstrapTable("remove",{
|
|
field:'finishProductCode',
|
|
values:ids
|
|
})
|
|
$("#addProductTable").bootstrapTable('refresh');
|
|
getTotal();
|
|
}
|
|
|
|
//计算全部数量、金额、大写
|
|
function getTotal() {
|
|
let getDataAll = $('#addProductTable').bootstrapTable('getData', true);
|
|
// console.log(getDataAll)
|
|
var totalQuantity = 0;
|
|
var totalMoney = 0.00;
|
|
for (let i = 0;i<getDataAll.length;i++) {
|
|
// console.log(getDataAll[i])
|
|
totalQuantity = Math.floor(totalQuantity + Number(getDataAll[i].quantity));
|
|
totalMoney = totalMoney + getDataAll[i].amountOfMoney;
|
|
}
|
|
$("input[name='totalQuantity']").val(totalQuantity)
|
|
$("input[name='totalMoney']").val(totalMoney.toFixed(2))
|
|
$.ajax({
|
|
url: prefix + '/getMoneyUpCase',
|
|
type: 'post',
|
|
data: {
|
|
totalMoney: totalMoney
|
|
},
|
|
success: function (res) {
|
|
// console.log(res)
|
|
$("input[name='totalMoneyUpCase']").val(res)
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|