万材erp项目
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.
 
 
 
 

864 lines
36 KiB

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改国税发票')" />
<th:block th:include="include :: datetimepicker-css" />
<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">
<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-edit" th:object="${taxInvoiceInfo}">
<input name="taxInvoiceId" th:field="*{taxInvoiceId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label" is-required>发票编号:</label>
<div class="col-sm-8">
<input name="taxInvoiceCode" th:field="*{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" th:field="*{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" th:field="*{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" th:field="*{enterpriseCode}" 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" th:field="*{enterpriseName}" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">合同号码:</label>
<div class="col-sm-8">
<input name="contractNumber" th:field="*{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" th:field="*{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" th:value="*{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" th:field="*{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" th:field="*{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" th:value="*{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" th:field="*{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}" th:field="*{billCommonCurrency}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">件数:</label>
<div class="col-sm-8">
<input name="packagesNumber" th:field="*{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" th:field="*{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" th:field="*{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" th:field="*{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" th:field="*{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" th:field="*{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" th:field="*{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}" th:field="*{getmoneyFlag}"></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>
<!--<div class="form-group">
<label class="col-sm-3 control-label">备用一:</label>
<div class="col-sm-8">
<input name="standbyOne" th:field="*{standbyOne}" 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="standbyTwo" th:field="*{standbyTwo}" 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>&nbsp;选择成品</a>
<a class="btn btn-danger" onclick="removeProduct()" ><i class="fa fa-plus"></i>&nbsp;删除成品</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-6 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>
<label>客户代码:</label>
<input type="text" name="enterpriseCode"/>
</li>
<li>
<label>客户名称:</label>
<input type="text" name="enterpriseName"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('productFormId','productTable')"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('productFormId','productTable')"><i
class="fa fa-refresh"></i>&nbsp;重置</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 getData = [[${taxInvoiceInfo}]];
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')}]];
$("#form-taxInvoiceInfo-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.modal.confirm("确认以上修改吗?", function (){
//修改成品数据
updateProduct();
$.operate.save(prefix + "/edit", $('#form-taxInvoiceInfo-edit').serialize());
})
}
}
$("input[name='billingDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true,
todayBtn: true,
todayHighlight: true
});
$("input[name='departureDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true,
todayBtn: true,
todayHighlight: true
});
$(function (){})
$(function () {
//获取客户信息并自动填入数据
getCustomerListToForm();
$('#addProductTable').bootstrapTable("refresh")
//初始化添加产品表
$('#addProductTable').bootstrapTable({
url: prefixTaxInvoiceProduct + "/list",
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();
},
onLoadSuccess: function (data) {
//计算全部数量、金额、大写
getTotal();
},
queryParams: function (params) {
//console.log("123");
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
// enterpriseCode: data[0].enterpriseCode
taxInvoiceCode: getData.taxInvoiceCode,
taxInvoiceNumber: getData.taxInvoiceNumber
};
// console.log(data[0].enterpriseCode)
return curParams
},
columns: [
{
checkbox: true
},
{
field: 'taxInvoiceProductId',
title: '发票产品id',
visible: false
},
{
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();
})
//获取客户信息并自动填入数据
var customerListData = []
function getCustomerListToForm() {
$.ajax({
url: ctx + "system/customer/list",
type: "POST",
success: function (res) {
//console.log(res)
if (res.rows.length > 0) {
customerListData = res.rows;
//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']").val(getData.enterpriseCode).trigger("change")
$("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);
$("input[name='contactNumber']").val(customerListData[i].contactNumber);
}
}
})
} else {
$.modal.msgError(res.msg);
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
})
}
/*成品内容*/
//点击按钮显示成品信息模态框
function showProductModal() {
if ($.validate.form()) {
$("#productInfoModal").modal("show");
} else {
$.modal.alertWarning("请填写必填项");
}
}
//关闭成品信息模态框
function closeProductModal() {
$("#productInfoModal").modal("hide");
}
//显示产品信息
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 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(taxInvoiceCode);
// console.log(taxInvoiceNumber);
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 updateProduct() {
var list = $("#addProductTable").bootstrapTable('getData');
// console.log(list);
for (let i = 0;i<list.length;i++) {
list[i].taxInvoiceCode = $("input[name='taxInvoiceCode']").val();
list[i].taxInvoiceNumber = $("input[name='taxInvoiceNumber']").val();
}
let data = JSON.stringify($('#addProductTable').bootstrapTable('getData', true));
let dataLength = $('#addProductTable').bootstrapTable('getData', true)
if (dataLength.length > 0) {
//添加
$.ajax({
url: prefixTaxInvoiceProduct + '/add',
type: "POST",
data: {
data: data
},
dataType: "json",
success: function (resp) {
// console.log(resp)
$("#addProductTable").bootstrapTable('refresh');
}
})
//修改
$.ajax({
url: prefixTaxInvoiceProduct + '/updateProduct',
type: "POST",
data: {
data: JSON.stringify(data)
},
dataType: "json",
success: function (resp) {
// console.log(data)
// console.log(JSON.stringify(data))
// console.log(resp)
$("#addProductTable").bootstrapTable('refresh');
}
})
}
}
// 删除成品
function removeProduct() {
var addProductTableData = $("#addProductTable").bootstrapTable("getSelections");
// console.log(addProductTableData)
var ids = [];
for (let i = 0;i < addProductTableData.length;i++) {
ids.push(addProductTableData[i].taxInvoiceProductId)
}
// console.log(ids)
// console.log(ids.toString())
// console.log(JSON.stringify(ids))
if (addProductTableData.length > 0) {
$.modal.confirm("是否确认要删除选中的产品?" +
"确认后将直接删除", function (){
$.ajax({
url: prefixTaxInvoiceProduct + "/remove",
type: "POST",
data: {
ids: ids.toString()
},
success: function (res) {
// console.log(ids)
// console.log(res)
$.modal.msgSuccess("删除成功")
$("#addProductTable").bootstrapTable('refreshOptions', {pageNumber: 1}); // pageNumber:1, 指定页码为第1页
$("#addProductTable").bootstrapTable('refresh');
getTotal();
}
})
})
} else {
alert("请选择需要删除的数据")
}
}
//计算全部数量、金额、大写
function getTotal() {
var getDataAll = $("#addProductTable").bootstrapTable('getData');
// 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>