先把後臺的代碼展示出來,有註釋的,業務就是銷售合同列表的增刪改查
財務銷售合同實體類
/**
* 財務銷售合同實體類
* @author Liany
*/
public class SalesContract implements Serializable{
private static final long serialVersionUID = 1L;
//主鍵
private String id;
//客戶ID 外鍵
private String customerId;
//客戶單位名稱
private String unitName;
//合同金額
private BigDecimal money;
//已收合同金額
private BigDecimal acceptMoney;
//備註
private String remark;
//創建人
private String createName;
//創建時間
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date createDate;
//修改人
private String modifyName;
//修改時間
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date modifyDate;
//刪除標識
private String deleteFlag;
//備用字段1
private String rev1;
//備用字段2
private String rev2;
//備用字段3
private String rev3;
//合同名稱
private String contractName;
//合同編號
private String contractNo;
//簽訂時間
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date signDate;
//省內省外標識 0 省內 1 省外
private String provinceOrOutside;
//城市
private String area;
//負責人
private String responsiblePerson;
//客戶類別
private String customerCategory;
//結存(剩餘應收合同金額)
private String unAcceptMoney;
//已開票金額
private String invoicedAmount;
//已收金額總和
private BigDecimal sumAcceptMoney;
//客戶姓名
private String customerName;
//記錄回款記錄的條數
private String detallCount;
//記錄合同附件的條數
private String certificateCount;
//記錄開票記錄的條數
private String salesInvoicingCount;
//省略getter和setter
}
財務銷售合同數據訪問接口層
/**
* 財務銷售合同數據訪問接口層
* @author Liany
* @since 2020/04/13
*/
public interface SalesContractDao{
/**
* 添加一條財務銷售合同記錄
* @param elemType 財務銷售合同對象
* @return int 執行成功的數量
* @throws DataAccessException
*/
void addFinancialSalesContract(SalesContract financialSalesContract);
/**
* 查詢所有財務銷售合同記錄
* @return 財務銷售合同對象集
* @throws DataAccessException
*/
public List<SalesContract> queryFinancialSalesContractList(PageBounds bounds, Map<String, Object> parameter);
/**
* 修改銷售合同列表
* @param financialSalesContract
*/
void editFinancialSalesContract(SalesContract financialSalesContract);
/**
* 根據id刪除銷售合同
* @param id
*/
void delFinancialSalesContractById(String id);
/**
* 根據id查詢銷售合同
* @param id
* @return
*/
SalesContract selFinancialSalesContractById(String id);
}
財務銷售合同mapper文件
在resource/mapper/finance/SalesContractMapper.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yhzn.dao.finance.SalesContractDao">
<resultMap id="BaseResultMap" type="com.yhzn.model.finance.SalesContract">
<id column="ID" property="id" jdbcType="VARCHAR" />
<result column="CUSTOMER_ID" property="customerId" jdbcType="VARCHAR" />
<result column="UNIT_NAME" property="unitName" jdbcType="VARCHAR" />
<result column="ACCEPT_MONEY" property="acceptMoney" jdbcType="VARCHAR" />
<result column="REMARK" property="remark" jdbcType="VARCHAR" />
<result column="CREATE_NAME" property="createName" jdbcType="VARCHAR" />
<result column="CREATE_DATE" property="createDate" jdbcType="DATE" />
<result column="MODIFY_NAME" property="modifyName" jdbcType="VARCHAR" />
<result column="MODIFY_DATE" property="modifyDate" jdbcType="DATE" />
<result column="DELETE_FLAG" property="deleteFlag" jdbcType="DECIMAL" />
<result column="REV1" property="rev1" jdbcType="VARCHAR" />
<result column="REV2" property="rev2" jdbcType="VARCHAR" />
<result column="REV3" property="rev3" jdbcType="VARCHAR" />
<result column="CONTRACT_NAME" property="contractName" jdbcType="VARCHAR" />
<result column="CONTRACT_NO" property="contractNo" jdbcType="VARCHAR" />
<result column="SIGN_DATE" property="signDate" jdbcType="DATE" />
<result column="PROVINCE_OR_OUTSIDE" property="provinceOrOutside" jdbcType="VARCHAR" />
<result column="INVOICED_AMOUNT" property="invoicedAmount" jdbcType="VARCHAR" />
<result column="MONEY" property="money" jdbcType="VARCHAR" />
<result column="RESPONSIBLE_PERSON" property="responsiblePerson" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID, CUSTOMER_ID, UNIT_NAME, ACCEPT_MONEY, REMARK, CREATE_NAME,
CREATE_DATE,
MODIFY_NAME, MODIFY_DATE, DELETE_FLAG, REV1, REV2, REV3, CONTRACT_NAME,
CONTRACT_NO,
SIGN_DATE,PROVINCE_OR_OUTSIDE,INVOICED_AMOUNT,MONEY,RESPONSIBLE_PERSON<!-- ,CUSTOMER_CATEGORY -->
</sql>
<select id="queryFinancialSalesContractList" parameterType="map"
resultType="com.yhzn.model.finance.SalesContract">
SELECT
nvl((select SUM(fd.ACCEPT_MONEY) from FINANCIAL_SALES_DETALL fd where fd.ACCEPT_ID = fs.ID),'0') as sumAcceptMoney,
fs.money - nvl((select SUM(fe.ACCEPT_MONEY) from FINANCIAL_SALES_DETALL fe where fe.ACCEPT_ID = fs.ID),'0') as unAcceptMoney,
nvl((select SUM(fi.INVOICED_AMOUNT) from FINANCLAL_SALES_INVOICING fi where fi.CONTRACT_ID = fs.ID),'0') as invoicedAmount,
(select co.UNIT_NAME from CUSTOMER_INFO co where co.ID = fs.CUSTOMER_ID) as unitName,
(select co.AREA from CUSTOMER_INFO co where co.ID = fs.CUSTOMER_ID) as area,
(select co.NAME from CUSTOMER_INFO co where co.ID = fs.CUSTOMER_ID) as customerName,
(select co.TYPE from CUSTOMER_INFO co where co.ID = fs.CUSTOMER_ID) as customerCategory,
(SELECT count( id ) FROM FINANCIAL_SALES_DETALL where ACCEPT_ID=fs.ID) as detallCount,
(SELECT count( id ) FROM CERTIFICATE where CONTRACT_ID=fs.ID) as certificateCount,
(SELECT count( id ) FROM FINANCLAL_SALES_INVOICING where CONTRACT_ID=fs.ID) as salesInvoicingCount,
fs.ID,
fs.CUSTOMER_ID,
fs.ACCEPT_MONEY,
fs.REMARK,
fs.CREATE_NAME,
fs.CREATE_DATE,
fs.MODIFY_NAME,
fs.MODIFY_DATE,
fs.DELETE_FLAG,
fs.REV1,
fs.REV2,
fs.REV3,
fs.CONTRACT_NAME,
fs.CONTRACT_NO,
fs.SIGN_DATE,
fs.PROVINCE_OR_OUTSIDE,
fs.INVOICED_AMOUNT,
fs.MONEY,
fs.RESPONSIBLE_PERSON
FROM
FINANCIAL_SALES_CONTRACT fs
where 1=1
<if test="customerId!=null and customerId!=''">
and fs.CUSTOMER_ID like '%${customerId}%'
</if>
<if test="city!=null and city!=''">
and fs.CITY like '%${city}%'
</if>
<if test="contractName!=null and contractName!=''">
and fs.CONTRACT_NAME like '%${contractName}%'
</if>
<if test="responsiblePerson!=null and responsiblePerson!=''">
and fs.RESPONSIBLE_PERSON like '%${responsiblePerson}%'
</if>
<if test="customerCategory!=null and customerCategory!=''">
and EXISTS(SELECT co.TYPE FROM CUSTOMER_INFO co WHERE co.ID = fs.CUSTOMER_ID and co.TYPE = #{customerCategory,jdbcType=VARCHAR})
</if>
<if test="beginDate != null and beginDate != ''">
and fs.SIGN_DATE<![CDATA[>=]]>to_date(#{beginDate},'yyyy-mm-dd')
</if>
<if test="endDate != null and endDate != ''">
and fs.SIGN_DATE <![CDATA[<]]>to_date(#{endDate},'yyyy-mm-dd')
</if>
<if test='jcMoney=="0"'>
and fs.money - nvl((select SUM(fe.ACCEPT_MONEY) from FINANCIAL_SALES_DETALL fe where fe.ACCEPT_ID = fs.ID),'0') > 0
</if>
order by fs.CREATE_DATE desc
</select>
<select id="selFinancialSalesContractById" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List" />
from FINANCIAL_SALES_CONTRACT
where ID = #{id,jdbcType=VARCHAR}
</select>
<delete id="delFinancialSalesContractById" parameterType="java.lang.String">
delete from FINANCIAL_SALES_CONTRACT
where ID = #{id,jdbcType=VARCHAR}
</delete>
<insert id="addFinancialSalesContract" parameterType="com.yhzn.model.finance.SalesContract">
insert into FINANCIAL_SALES_CONTRACT
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="customerId != null">
CUSTOMER_ID,
</if>
<if test="unitName != null">
UNIT_NAME,
</if>
<if test="acceptMoney != null">
ACCEPT_MONEY,
</if>
<if test="remark != null">
REMARK,
</if>
<if test="createName != null">
CREATE_NAME,
</if>
<if test="createDate != null">
CREATE_DATE,
</if>
<if test="modifyName != null">
MODIFY_NAME,
</if>
<if test="modifyDate != null">
MODIFY_DATE,
</if>
<if test="deleteFlag != null">
DELETE_FLAG,
</if>
<if test="rev1 != null">
REV1,
</if>
<if test="rev2 != null">
REV2,
</if>
<if test="rev3 != null">
REV3,
</if>
<if test="contractName != null">
CONTRACT_NAME,
</if>
<if test="contractNo != null">
CONTRACT_NO,
</if>
<if test="signDate != null">
SIGN_DATE,
</if>
<if test="provinceOrOutside != null">
PROVINCE_OR_OUTSIDE,
</if>
<if test="invoicedAmount != null">
INVOICED_AMOUNT,
</if>
<if test="money != null">
MONEY,
</if>
<if test="responsiblePerson != null">
RESPONSIBLE_PERSON,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
#{customerId,jdbcType=VARCHAR},
</if>
<if test="unitName != null">
#{unitName,jdbcType=VARCHAR},
</if>
<if test="acceptMoney != null">
#{acceptMoney,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createName != null">
#{createName,jdbcType=VARCHAR},
</if>
<if test="createDate != null">
#{createDate,jdbcType=DATE},
</if>
<if test="modifyName != null">
#{modifyName,jdbcType=VARCHAR},
</if>
<if test="modifyDate != null">
#{modifyDate,jdbcType=DATE},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=DECIMAL},
</if>
<if test="rev1 != null">
#{rev1,jdbcType=VARCHAR},
</if>
<if test="rev2 != null">
#{rev2,jdbcType=VARCHAR},
</if>
<if test="rev3 != null">
#{rev3,jdbcType=VARCHAR},
</if>
<if test="contractName != null">
#{contractName,jdbcType=VARCHAR},
</if>
<if test="contractNo != null">
#{contractNo,jdbcType=VARCHAR},
</if>
<if test="signDate != null">
#{signDate,jdbcType=DATE},
</if>
<if test="provinceOrOutside != null">
#{provinceOrOutside,jdbcType=VARCHAR},
</if>
<if test="invoicedAmount != null">
#{invoicedAmount,jdbcType=VARCHAR},
</if>
<if test="money != null">
#{money,jdbcType=VARCHAR},
</if>
<if test="responsiblePerson != null">
#{responsiblePerson,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="editFinancialSalesContract" parameterType="com.yhzn.model.finance.SalesContract">
update FINANCIAL_SALES_CONTRACT
<set>
<if test="customerId != null">
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR},
</if>
<if test="unitName != null">
UNIT_NAME = #{unitName,jdbcType=VARCHAR},
</if>
<if test="acceptMoney != null">
ACCEPT_MONEY = #{acceptMoney,jdbcType=VARCHAR},
</if>
<if test="remark != null">
REMARK = #{remark,jdbcType=VARCHAR},
</if>
<if test="createName != null">
CREATE_NAME = #{createName,jdbcType=VARCHAR},
</if>
<if test="createDate != null">
CREATE_DATE = #{createDate,jdbcType=DATE},
</if>
<if test="modifyName != null">
MODIFY_NAME = #{modifyName,jdbcType=VARCHAR},
</if>
<if test="modifyDate != null">
MODIFY_DATE = #{modifyDate,jdbcType=DATE},
</if>
<if test="deleteFlag != null">
DELETE_FLAG = #{deleteFlag,jdbcType=DECIMAL},
</if>
<if test="rev1 != null">
REV1 = #{rev1,jdbcType=VARCHAR},
</if>
<if test="rev2 != null">
REV2 = #{rev2,jdbcType=VARCHAR},
</if>
<if test="rev3 != null">
REV3 = #{rev3,jdbcType=VARCHAR},
</if>
<if test="contractName != null">
CONTRACT_NAME = #{contractName,jdbcType=VARCHAR},
</if>
<if test="contractNo != null">
CONTRACT_NO = #{contractNo,jdbcType=VARCHAR},
</if>
<if test="signDate != null">
SIGN_DATE = #{signDate,jdbcType=DATE},
</if>
<if test="provinceOrOutside != null">
PROVINCE_OR_OUTSIDE = #{provinceOrOutside,jdbcType=VARCHAR},
</if>
<if test="invoicedAmount != null">
INVOICEDAMOUNT = #{invoicedAmount,jdbcType=VARCHAR},
</if>
<if test="money != null">
MONEY = #{money,jdbcType=VARCHAR},
</if>
<if test="responsiblePerson != null">
RESPONSIBLE_PERSON = #{responsiblePerson,jdbcType=VARCHAR},
</if>
</set>
where ID = #{id,jdbcType=VARCHAR}
</update>
</mapper>
銷售合同服務Service接口層
/**
* 銷售合同服務接口層
* @author Liany
*
*/
public interface SalesContractService{
/**
* 添加一條銷售合同記錄
* @param aFinancePurchaseContract 添加的財務採購合同對象
*/
Map<String,Object> addFinancialSalesContract(SalesContract FinancialSalesContract,User user);
/**
* 分頁查詢銷售合同信息列表
* @param bounds
* @param parameter
* @return
*/
List<SalesContract> queryFinancialSalesContractList(PageBounds bounds, Map<String, Object> parameter);
/**
* 修改銷售合同信息
* @param financePurchaseContract
* @param user
*/
Map<String,Object> updateFinancialSalesContract(SalesContract financialSalesContract,User user);
/**
* 根據id查詢銷售合同詳情
* @param id
* @return
*/
SalesContract selFinancialSalesContractById(String id);
/**
* 根據id刪除銷售合同
* @param id
* @param user
*/
void delFinancialSalesContractById(String id,User user);
/*
* 根據銷售合同id計算出剩餘應收金額
* @param id
* @return
*//*
String selUnAcceptMoney(String acceptId,User user);*/
}
銷售合同服務Service接口層實現類
/**
* 銷售合同service實現類
* @author Liany
*
*/
@Service
public class SalesContractServiceImpl implements SalesContractService{
@Autowired
private SalesContractDao financialSalesContractDao;
/**
* 添加銷售合同的service實現類的方法
*/
@Override
public Map<String, Object> addFinancialSalesContract(SalesContract financialSalesContract, User user) {
// 設置用戶id
financialSalesContract.setId(UUID.randomUUID().toString().replace("-", ""));
financialSalesContract.setCreateName(user.getUserName());
financialSalesContract.setCreateDate(new Date());
// financialSalesContract.setSignDate(new Date());
financialSalesContract.setDeleteFlag(CoreConst.NO_DEL);//刪除標識
Map<String, Object> map = new HashMap<String, Object>();
try {
financialSalesContractDao.addFinancialSalesContract(financialSalesContract);
map.put("status", "200");
map.put("msg", "保存成功");
} catch (Exception e) {
map.put("status", "400");
map.put("msg", "保存失敗");
}
return map;
}
/**
* 查詢用戶列表的service實現類的方法
*/
@Override
public List<SalesContract> queryFinancialSalesContractList(PageBounds bounds,Map<String, Object> parameter) {
return financialSalesContractDao.queryFinancialSalesContractList(bounds, parameter);
}
/**
* 修改用戶的service實現類的方法
*/
@Override
public Map<String, Object> updateFinancialSalesContract(SalesContract financialSalesContract, User user) {
financialSalesContract.setModifyName(user.getModifyName());
financialSalesContract.setModifyDate(user.getModifyDate());
// financialSalesContract.setSignDate(new Date());
financialSalesContract.setDeleteFlag(CoreConst.NO_DEL);
Map<String,Object> map = new HashMap<String,Object>();
try {
financialSalesContractDao.editFinancialSalesContract(financialSalesContract);
map.put("status", "200");
map.put("msg", "修改成功");
} catch (Exception e) {
map.put("status", "400");
map.put("msg", "修改失敗");
}
return map;
}
/**
* 根據用戶的id查詢用戶的service實現類的方法
*/
@Override
public SalesContract selFinancialSalesContractById(String id) {
SalesContract financialSalesContract = financialSalesContractDao.selFinancialSalesContractById(id);
return financialSalesContract;
}
/**
* 根據id刪除用戶的service實現類的方法
*/
@Override
public void delFinancialSalesContractById(String id, User user) {
financialSalesContractDao.delFinancialSalesContractById(id);
}
/**
* 根據銷售合同id計算出剩餘應收金額
*/
/*@Override
public String selUnAcceptMoney(String acceptId, User user) {
String unAcceptMoney = financialSalesContractDao.selUnAcceptMoney(acceptId);
return unAcceptMoney;
}*/
}
銷售合同服務Controller實現類
/**
* 銷售合同控制層
* @author liany
*/
@Controller
@RequestMapping("/financialSalesContract")
public class SalesContractController {
// 銷售合同服務接口
@Autowired
private SalesContractService salesContractService;
//日誌管理接口
@Autowired
private SysLogService sysLogService;
//字典管理接口
@Autowired
private SysDictService sysDictService;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
/**
* 加載銷售合同管理頁面
*
* @return
*/
@RequestMapping(value = "/salesContract", method = RequestMethod.GET)
public String finance() {
return "/financemanage/accounts/salesContract";
}
/**
* 新增銷售合同信息
* @param person
* @param request
* @return
* @throws IOException
*/
@RequestMapping(value="/addFinancialSalesContract",method= RequestMethod.POST)
@ResponseBody
public Map<String,Object> addFinancialSalesContract(SalesContract salesContract,HttpServletRequest request) throws IOException{
//獲取登錄人信息
User user= (User) request.getSession().getAttribute("user");
//日誌類型,操作人,操作內容,操作人IP,操作方法
//FinancialSalesContractService.insertSysLog("新增",user.getTrueName(),"新增人員信息: "+FinancialSalesContractService.getName(),user.getLoginIp(),"/person/addPerson");
Map<String,Object> map = new HashMap<String,Object>();
salesContractService.addFinancialSalesContract(salesContract, user);
//新增人員信息
return map;
}
/**
* 查詢銷售合同列表
* @param request
* @return
*/
@RequestMapping(value="/queryFinancialSalesContractList", method = RequestMethod.POST)
@ResponseBody
public PageUtil queryFinancialSalesContractList(HttpServletRequest request){
//獲取登錄人信息
User user= (User) request.getSession().getAttribute("user");
//日誌類型,操作人,操作內容,操作人IP,操作方法
sysLogService.insertSysLog("查詢",user.getTrueName(),"查詢人員信息列表 ",user.getLoginIp(),"/financialSalesContract/queryFinancialSalesContractList");
int page = Integer.parseInt(request.getParameter("page"));
int rows = Integer.parseInt(request.getParameter("rows"));
String city = request.getParameter("city");//城市 模糊查詢的時候需要用到
String contractName = request.getParameter("contractName");//合同名稱
String responsiblePerson = request.getParameter("responsiblePerson");//創建人
String customerId = request.getParameter("customerId");//客戶單位名稱
String customerCategory = request.getParameter("customerCategory");//客戶單位名稱
String jcMoney = request.getParameter("jcMoney");//結存
String beginDate = request.getParameter("beginDate");//簽訂開始時間
String endDate = request.getParameter("endDate");//簽訂結束時間
Map<String,Object> parameter = new HashMap<String,Object>();
parameter.put("city", city);
parameter.put("contractName",contractName);
parameter.put("responsiblePerson",responsiblePerson);
parameter.put("customerCategory",customerCategory);
parameter.put("jcMoney",jcMoney);
parameter.put("beginDate",beginDate);
parameter.put("endDate",endDate);
parameter.put("customerId",customerId);
PageBounds bounds = new PageBounds(page , rows );
List<SalesContract> list = salesContractService.queryFinancialSalesContractList(bounds, parameter);
// 獲得結果集條總數
int total = ((PageList<SalesContract>) list).getPaginator().getTotalCount();
// 頁面列表展示
PageUtil result = new PageUtil();
result.setRows(list);
result.setTotal(total);
return result;
}
/**
* 修改銷售合同信息
* @param person
* @param request
* @return
*/
@RequestMapping(value="/editFinancialSalesContract",method= RequestMethod.POST)
@ResponseBody
public Map<String,Object> editFinancialSalesContract(SalesContract financialSalesContract,HttpServletRequest request){
Map<String,Object> map = new HashMap<String,Object>();
//獲取登錄人信息
User user= (User)request.getSession().getAttribute("user");
//日誌類型,操作人,操作內容,操作人IP,操作方法
sysLogService.insertSysLog("修改",user.getTrueName(),"修改人員信息: "+financialSalesContract.getModifyName(),user.getLoginIp(),"/financialSalesContract/editFinancialSalesContract");
//changePerson(person,request);
salesContractService.updateFinancialSalesContract(financialSalesContract, user);
map.put("success", 1);
return map;
}
/**
* 根據id查詢銷售合同信息
* @param id
* @return
*/
@RequestMapping(value="selFinancialSalesContractById")
@ResponseBody
public SalesContract selFinancialSalesContractById(String id){
return salesContractService.selFinancialSalesContractById(id);
}
/**
* 根據id刪除銷售合同信息
* @param id
* @param request
* @param financialSalesContract
* @return
*/
@RequestMapping(value="delFinancialSalesContractById")
@ResponseBody
public Map<String,Object> delFinancialSalesContractById(String id,HttpServletRequest request,SalesContract financialSalesContract){
Map<String,Object> map = new HashMap<String,Object>();
//獲取登錄人信息
User user= (User)request.getSession().getAttribute("user");
// //日誌類型,操作人,操作內容,操作人IP,操作方法
sysLogService.insertSysLog("修改",user.getTrueName(),"修改人員信息: "+financialSalesContract.getModifyName(),user.getLoginIp(),"/FinancialSalesContract/editFinancialSalesContract");
// //changePerson(person,request);
salesContractService.delFinancialSalesContractById(id, user);
map.put("success", 1);
return map;
}
}
銷售合同列表的jsp頁面代碼:有點長...
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set>
<%
String acceptId = request.getParameter("acceptId");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>銷售合同列表頁面</title>
<link rel="stylesheet" type="text/css"
href="${ctx }/resource/plugins/easyui-me/columns.css">
<link rel="stylesheet" type="text/css"
href="${ctx }/resource/plugins/easyui-me/style.css">
<link rel="stylesheet" type="text/css"
href="${ctx }/resource/plugins/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css"
href="${ctx }/resource/css/pur_supplier.css">
<script type="text/javascript"
src="${ctx }/resource/plugins/easyui/jquery.min.js"></script>
<script type="text/javascript"
src="${ctx }/resource/plugins/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"
src="${ctx }/resource/plugins/easyui-me/common.js"></script>
<script type="text/javascript"
src="${ctx }/resource/plugins/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript"
src="${ctx }/resource/js/dateFormatter.js"></script>
</head>
<body>
<!--panel:面板 -->
<div class="panel">
<!-- easyui-dialog:easyui對話框 display:規定元素應該生成的框的類型。 display:none 此元素不會被顯示。 easyui-combobox:easyui下拉框 easyui-textbox:easyui時間框 -->
<!-- datagarid的formatter屬性
formatter:function(value,row,index){}
formatter 屬於列參數,表示對於當前列的數據進行格式化操作,它是一個函數,有三個參數,分別是value,row,index
value:表示當前單元格中的值
row:表示當前行
index:表示當前行的下標
可以使用return返回想要的數據顯示在單元格中 -->
<div id="dlg" class="easyui-dialog" style="display:none;width:600px; height: 440px;top:10px; padding: 5px 10px;" closed="true" buttons="#dlg-buttons">
<%-- 新增彈出框 begin --%>
<form id="customerForm" method="post">
<table border="0" width="100%" cellpadding="0">
<tr height="35px;">
<td width="30%" height="35px;" align="right">客戶單位名稱:</td>
<td width="70%" align="left"><input name="customerId" id="addUnitName" class="easyui-combobox" style="width: 86%;" required="true" /></td>
</tr>
<!-- <tr height="35px;">
<td width="30%" height="35px;" align="right">城市:</td>
<td width="70%" align="left"><input name="city" id="addCity" class="easyui-combobox" style="width: 86%;" required="true" /></td>
</tr> -->
<tr height="35px;">
<td width="30%" height="35px;" align="right">負責人:</td>
<td width="70%" align="left"><input name="responsiblePerson" id="addResponsiblePerson" class="easyui-combobox" style="width: 86%;" required="true" /></td>
</tr>
<tr height="35px;">
<td width="30%" height="35px;" align="right">合同金額:</td>
<td width="70%" align="left"><input type="text" name="money" id="addMoney" required="true" class="easyui-numberbox" size="50px" style="width: 84%;"/>元</td>
</tr>
<tr height="35px;">
<td width="30%" height="35px;" align="right">合同名稱:</td>
<td width="70%" align="left"><input name="contractName" class="easyui-textbox" size="50px" style="width: 86%;" /></td>
</tr>
<tr height="35px;">
<td width="30%" height="35px;" align="right">合同編號:</td>
<td width="70%" align="left"><input name="contractNo" class="easyui-textbox" size="35px" style="width: 86%;" /></td>
</tr>
<tr height="35px;">
<td width="30%" height="35px;" align="right">簽訂時間:</td>
<td width="70%" align="left"><input name="signDate" id="signDate" class="easyui-datebox" size="35px" style="width: 86%;" /></td>
</tr>
</tr>
<tr height="80px;">
<td width="30%" height="35px;" align="right">備註:</td>
<td width="70%" align="left"><input class="easyui-textbox" data-options="multiline:true" size="35px" style="height:150px;width:200px;" name="remark"></td>
</tr>
</table>
</form>
</div>
<%-- 新增彈出框 end --%>
<%-- 修改彈出框 begin --%>
<div id="editDlg" class="easyui-dialog" style="display:none;width:600px; height: 440px;top:10px; padding: 5px 10px;" closed="true" buttons="#dlg-buttons">
<form id="editCustomerForm" method="post">
<table border="0" width="100%" cellpadding="0">
<tr height="35px;">
<td width="30%" height="35px;" align="right">客戶單位名稱:</td>
<td width="70%" align="left"><input name="customerId" id="editUnitName" class="easyui-combobox" size="35px" required="true" style="width: 86%;" /></td>
</tr>
<!-- <tr height="35px;">
<td width="30%" height="35px;" align="right">城市:</td>
<td width="70%" align="left"><input name="city" id="editCity" class="easyui-combobox" style="width: 86%;" required="true" /></td>
</tr> -->
<tr height="35px;">
<td width="30%" height="35px;" align="right">負責人:</td>
<td width="70%" align="left"><input name="responsiblePerson" id="editResponsiblePerson" class="easyui-combobox" style="width: 86%;" required="true" /></td>
</tr>
<tr height="35px;">
<td width="30%" height="35px;" align="right">合同金額:</td>
<td width="70%" align="left"><input type="text" name="money" id="money" class="easyui-numberbox" size="50px" style="width: 84%;"/>元</td>
</tr>
<tr height="35px;">
<td width="30%" height="35px;" align="right">合同名稱:</td>
<td width="70%" align="left"><input name="contractName" id="editContractName" class="easyui-textbox" size="35px" style="width: 86%;" /></td>
</tr>
<tr height="35px;">
<td width="30%" height="35px;" align="right">合同編號:</td>
<td width="70%" align="left"><input name="contractNo" id="contractNo" class="easyui-textbox" size="35px" style="width: 86%;" /></td>
</tr>
<tr height="35px;">
<td width="30%" height="35px;" align="right">簽訂時間:</td>
<td width="70%" align="left"><input name="signDate" id="editSignDate" class="easyui-datebox" size="35px" style="width: 86%;" /></td>
</tr>
</tr>
<tr height="80px;">
<td width="30%" height="35px;" align="right">備註:</td>
<td width="70%" align="left"><input class="easyui-textbox" data-options="multiline:true" size="35px" style="height:150px;width:200px;" name="remark" id="remark"></td>
</tr>
</table>
</form>
</div>
<%-- 修改彈出框end --%>
<div class="panel">
<!-- 返回面板(panel)頭部對象 -->
<div class="panel-header" data-options="region:'north' " border="0" cellspacing="8" cellpadding="0" style="height: 60px;padding: 10px;overflow: hidden;width:98.5%">
<form action="" name="QueryForm" id="QueryForm">
客戶單位名稱:<input name="customerId" id="searchCustomerId" class="easyui-combobox"/>
城市:<input type="text" name="city" id="searchCity" class="easyui-combobox"/>
合同名稱:<input type="text" name=""contractName"" id="contractNameId" class="easyui-textbox"/>
負責人:<input type="text" name="responsiblePerson" id="searchResponsiblePerson" class="easyui-combobox"/>
<br>
<br>
客戶類別:<input type="text" name="customerCategory" id="searchCustomerCategory" class="easyui-combobox"/>
結存條件<select id="jcMoney" name="jcMoney" class="easyui-combobox" style="width:150px;">
<option value="0">結存大於0</option>
<option value="1" selected>所有</option>
</select>
<!-- <a class="actions search easyui-linkbutton" iconCls="icon-search">搜索</a>
<a class="actions print easyui-linkbutton" iconCls="icon-print">導出</a> -->
簽訂時間:<input class="easyui-datebox" name="beginDate" id="f_beginDate" />至 <input class="easyui-datebox" name="endDate" id="f_endDate" />
<td style="text-align: left;" colspan="6">
<button class="easyui-linkbutton" type="button" iconCls="icon-search" style="height: 24px;margin-left: 3px;" onclick="queryFun()">查詢</button>
<button class="easyui-linkbutton" type="button" iconCls="icon-redo" style="height: 24px;margin-left:3px;" onclick="empty()">重置</button>
</td>
</form>
</div>
<hr>
<!-- 表格需要用js進行渲染 -->
<table id="dg">
</table>
<div id="ReceGridToolbar" style="display: none;">
<shiro:hasPermission name="pay:add">
<a class="actions add easyui-linkbutton " iconCls="icon-add"
plain="true">新建</a>
</shiro:hasPermission>
<shiro:hasPermission name="pay:edit">
<a class="actions edit easyui-linkbutton " iconCls="icon-edit"
plain="true">編輯</a>
</shiro:hasPermission>
<shiro:hasPermission name="pay:delete">
<a class="actions delete easyui-linkbutton " iconCls="icon-remove"
plain="true">刪除</a>
</shiro:hasPermission>
</div>
</div>
<script>
//查詢條件
function queryFun() {
var queryParameter = $('#dg').datagrid("options").queryParams;
/* 根據合同名稱查詢 */
queryParameter.contractName = $("#contractNameId").val();
/* 根據城市查詢 */
queryParameter.city = $("#searchCity").combobox("getText");
/* 根據負責人查詢 */
queryParameter.responsiblePerson = $("#searchResponsiblePerson").combobox("getText");
/* 根據客戶單位名稱查詢 */
queryParameter.customerId = $("#searchCustomerId").combobox("getValue");
/* 根據客戶類別查詢 */
queryParameter.customerCategory = $("#searchCustomerCategory").combobox("getText");
/* 根據結存條件查詢 */
queryParameter.jcMoney = $("#jcMoney").combobox("getValue");
/* 根據簽訂時間查詢 */
queryParameter.beginDate = $("#f_beginDate").datebox("getValue");
/* 根據簽訂時間查詢 */
queryParameter.endDate = $("#f_endDate").datebox("getValue");
$("#dg").datagrid("reload");
}
//重置
function empty() {
$('#QueryForm').form('clear');
}
$(document).ready(function() {
$('#dg').datagrid({
title : '銷售合同列表',
nowrap : false, /* 設置爲 true,則把數據顯示在一行裏。設置爲 true 可提高加載性能。 */
locale : "zh_CN",
iconCls : 'icon-save', /* 添加按鈕 */
striped : true, /* 設置爲 true,則把行條紋化。(即奇偶行使用不同背景色) */
collapsible : true,/*可摺疊的內容塊*/
scrollbarSize : 0, /* 滾動條寬度(當滾動條是垂直的時候)或者滾動條的高度(當滾動條是水平的時候) */
height : $(window).height() - 150,
url : '${ctx}/financialSalesContract/queryFinancialSalesContractList',/*查詢的銷售合同列表的方法*/
rownumbers : true, /* 設置爲 true,則顯示帶有行號的列 */
pagination : true, //表示在datagrid設置分頁
singleSelect : true,/*easyUI的datagrid設置了singleSelect=true(即單選),取消複選框的選中狀態*/
columns : [ [
{
field : 'unitName',
title : '客戶單位名稱',
width : '12%',
align : 'center'
},{
field : 'customerName',
title : '客戶姓名',
width : '4%',
align : 'center'
}, {
field : 'area',
title : '城市',
width : '5%',
align : 'center'
}, {
field : 'money',
title : '合同金額',
width : '5%',
align : 'center'
}, {
field : 'sumAcceptMoney',
title : '已收合同金額',
width : '5%',
align : 'center',
/* formatter : function(value, row, index) {
var num = row.sumAcceptMoney==undefined || row.sumAcceptMoney == "" || row.sumAcceptMoney == ''?0:row.sumAcceptMoney;
if(num <=0){
return 0;
}else{
return num;
}
} */
},{
field : 'unAcceptMoney',
title : '結存',
width : '5%',
align : 'center',
},{
field : 'invoicedAmount',
title : '已開票金額',
width : '5%',
align : 'center',
},{
field : 'contractName',
title : '合同名稱',
width : '10%',
align : 'center'
}, {
field : 'contractNo',
title : '合同編號',
align : 'center',
width : '8%'
},{
field : 'responsiblePerson',
title : '負責人',
align : 'center',
width : '5%'
},{
field : 'customerCategory',
title : '客戶類別',
align : 'center',
width : '4%'
},{
field : 'signDate',
title : '簽訂時間',
width : '6%',
align : 'center',
/* datagarid的formatter屬性
formatter 屬於列參數,表示對於當前列的數據進行格式化操作,它是一個函數,有三個參數,分別是value,row,index
value:表示當前單元格中的值
row:表示當前行
index:表示當前行的下標
可以使用return返回想要的數據顯示在單元格中
*/
formatter : function(value, row, index) {
var str = "";
if ("" != row.signDate && null != row.signDate) {
return new Date(row.signDate).format("yyyy-MM-dd");
}
return str;
}
},
{
field : 'remark',
title : '備註',
width : '11%',
align : 'center'
}, {
field : 'caozuo',
title : '操作',
width : '15%',
align : 'center',
formatter : function(value, row, index) {
var str="";
var acceptId = row.id;
var contractId = row.id;
if(row.id=="unAcceptMoneyy"){
str='';
}else{
str += "<a style='color:blue' href='javascript:void(0)' title='回款記錄' onclick='linkForm('" + acceptId + "')'>回款記錄<span>('" + row.detallCount + "')</span> </a>";
str += "<a style='color:blue' href='javascript:void(0)' title='合同附件' onclick='certificateForm('" + contractId + "')'>合同附件<span>('" + row.certificateCount + "')</span> </a>";
str += "<a style='color:blue' href='javascript:void(0)' title='開票記錄' onclick='salesInvoicingForm('" + contractId + "')'>開票記錄<span>('" + row.salesInvoicingCount + "')</span></a>";
}
return str;
}
} ] ],
toolbar : '#ReceGridToolbar',
})
var PaygridPanel = $('#dg').datagrid("getPanel");
PaygridPanel.on("click", "a.edit", function() {
var rows = $('#dg').datagrid('getSelections'); /* 獲取數據表格的行 */
if (rows.length <= 0) {
$.messager.alert('提示', '請選擇要修改的行', 'error');
} else if (rows.length > 1) {
$.messager.alert('提示', '只能選擇一條數據進行修改', 'error');
} else if (rows.length == 1) {
var id = rows[0].id;
editCustomerForm(id);
}
}).on("click", "a.add", function() {
$("#customerForm").form('clear'); /* 清空form表單 */
customerForm(); /* 添加方法 */
}).on("click", "a.delete", function() {
var rows = $('#dg').datagrid('getSelections');
if (rows.length <= 0) {
$.messager.alert('提示', '請選擇要刪除的行', 'error');
} else if (rows.length > 1) {
$.messager.alert('提示', '只能選擇一條數據進行修改', 'error');
} else if (rows.length == 1) {
$.messager.confirm("提示", "您確定要刪除此數據?", function(r) {
if (r) {
var id = rows[0].id;
delCustomerForm(id);
/*數據表格重載*/
$("#dg").datagrid("reload");
}
});
}
}).on("click", "a.chakan", function() {
var row = $('#dg').datagrid('getSelected');
var purNo = row.purNo;
qingdan(purNo);
});
// 搜索按鈕事件
/* var contractName = $("#contractName");
var city = $("#searchCity");
var responsiblePerson = $("#searchResponsiblePerson");
var beginDate = $("#f_beginDate");
var endDate = $("#f_endDate");
var customerId = $("#serarchCustomerId");
console.log(responsiblePerson.combobox("getText"));
console.log(city.combobox("getText"));
$("#Search").on('click', function() {
$('#dg').datagrid("load", {
city : "%" + city.combobox("getText") + "%",
contractName : "%" + contractName.val() + "%",
customerId : "%" + customerId.combobox("getText") + "%",
responsiblePerson : "%" + responsiblePerson.combobox("getText") + "%",
beginDate : beginDate.datebox("getValue"),
endDate : endDate.datebox("getValue")
});
}); */
// 重置事件
/* var form = $("#customerForm");
$("#Reset").on('click', function() {
form.form('clear');
// 清除查詢參數
$('#dg').datagrid("load", {});
}); */
});
$('#dg').datagrid({
onLoadSuccess: function(data) {
var rows = $('#dg').datagrid('getRows') //獲取當前的數據行
var ptotal = 0 //計算開票金額的總和
var invo = 0 //計算已收合同金額的總和
var sumMoney = 0;//計算合同金額總和
var un =0 //計算結存總和
/* sumAcceptMoney */
for(var i = 0; i < rows.length; i++) {
ptotal += parseFloat(rows[i]['invoicedAmount']);
invo += parseFloat(rows[i]['sumAcceptMoney']);
sumMoney += parseFloat(rows[i]['money']);
un += parseFloat(rows[i]['unAcceptMoney']);
}
if(isNaN(ptotal)){
ptotal='0'
}
if(isNaN(invo)){
invo='0'
}
if(isNaN(sumMoney)){
sumMoney='0'
}
if(isNaN(un)){
un='0'
}
//新增一行顯示統計信息
$('#dg').datagrid('appendRow', {
id:'unAcceptMoneyy',
area: '<b>合計:</b>',
invoicedAmount:ptotal,
sumAcceptMoney:invo,
money:sumMoney,
unAcceptMoney:un
});
},
rowStyler: function(index, row) {
if(row.area == '<b>合計:</b>') {
return 'background-color:#EAEAEA;color:blue';
}
}
});
function linkForm(acceptId) {
var content = "<iframe src='${ctx}/salesDetails/salesDetailsPage?acceptId=" + acceptId + "' width='100%' height='98%' frameborder='0' scrolling='0'></iframe>";
// 創建窗口
var dialog = $("<div/>").dialog(
{
content : content,
title :'回款記錄詳情',
height : '90%',
width : '99%',
modal : true,
onClose : function() {
// 窗口關閉的同時銷燬此窗口
$(this).dialog("destroy");
},
buttons: [{
iconCls: 'icon-back',
text: '返回',
handler: function() {
//關閉窗口
dialog.dialog("close");
//刷新數據表格
$("#dg").datagrid("reload");
}
}]
});
}
function certificateForm(contractId) {
var content = "<iframe src='${ctx}/certificate/certificatePage?contractId=" + contractId + "' width='100%' height='98%' frameborder='0' scrolling='0'></iframe>";
// 創建窗口
var dialog = $("<div/>").dialog(
{
content : content,
title :'合同附件',
height : '90%',
width : '100%',
modal : true,
onClose : function() {
// 窗口關閉的同時銷燬此窗口
$(this).dialog("destroy");
},
buttons: [{
iconCls: 'icon-back',
text: '返回',
handler: function() {
//關閉窗口
dialog.dialog("close");
//刷新數據表格
$("#dg").datagrid("reload");
}
}]
});
}
function salesInvoicingForm(contractId) {
var content = "<iframe src='${ctx}/salesInvoicing/salesInvoicingPage?contractId=" + contractId + "' width='100%' height='98%' frameborder='0' scrolling='0'></iframe>";
// 創建窗口
var dialog = $("<div/>").dialog(
{
content : content,
title :'開票記錄詳情',
height : '90%',
width : '100%',
modal : true,
onClose : function() {
// 窗口關閉的同時銷燬此窗口
$(this).dialog("destroy");
},
buttons: [{
iconCls: 'icon-back',
text: '返回',
handler: function() {
//關閉窗口
dialog.dialog("close");
//刷新數據表格
$("#dg").datagrid("reload");
}
}]
});
}
function qingdan(purNo) {
// 創建窗口
var dialog = $("<div/>").dialog(
{
href : '../purchase/purSupplier/' + purNo,
title : "詳情",
height : '90%',
width : '80%',
modal : true,
onClose : function() {
// 窗口關閉的同時銷燬此窗口
$(this).dialog("destroy");
},
buttons : [ {
iconCls : 'icon-back',
text : '返回',
handler : function() {
//關閉窗口
dialog.dialog("close");
}
} ]
});
}
//獲取客戶公司名稱下拉框值
$.ajax({
type : "get",
url : "${ctx}/customer/customerCompanyCombobox",
async : false,
success : function(data) {
$("#addUnitName").combobox({ //往下拉框塞值
data : data,
valueField : "id", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
//獲取客戶公司名稱修改下拉框數據
$.ajax({
type : "get",
url : "${ctx}/customer/customerCompanyCombobox",
async : false,
success : function(data) {
$("#editUnitName").combobox({ //往下拉框塞值
data : data,
valueField : "id", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
//獲取城市下拉框值
$.ajax({
type : "get",
url : "${ctx}/sysDict/getDictList?parentKey=CSDM",
async : false,
success : function(data) {
var jso = JSON.parse(data);
$("#addCity").combobox({ //往下拉框塞值
data : jso,
valueField : "text", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
//修改城市下拉框值
$.ajax({
type : "get",
url : "${ctx}/sysDict/getDictList?parentKey=CSDM",
async : false,
success : function(data) {
var jso = JSON.parse(data);
$("#editCity").combobox({ //往下拉框塞值
data : jso,
valueField : "text", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
//獲取條件查詢的城市下拉框
$.ajax({
type:"get",
url:"${ctx}/sysDict/getDictList?parentKey=CSDM",
async : false,
success : function(data) {
var jo = JSON.parse(data);
$("#searchCity").combobox({ //往下拉框塞值
data : jo,
valueField : "id", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
//獲取條件查詢的客戶單位名稱
$.ajax({
type : "get",
url : "${ctx}/customer/customerCompanyCombobox",
async : false,
success : function(data) {
$("#searchCustomerId").combobox({ //往下拉框塞值
data : data,
valueField : "id", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
//獲取負責人下拉框
$.ajax({
type : "get",
url : "${ctx}/sysDict/getDictList?parentKey=FZR",
async : false,
success : function(data) {
var jso = JSON.parse(data);
$("#addResponsiblePerson").combobox({ //往下拉框塞值
data : jso,
valueField : "text", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
//獲取負責人的修改下拉框
$.ajax({
type : "get",
url : "${ctx}/sysDict/getDictList?parentKey=FZR",
async : false,
success : function(data) {
var jso = JSON.parse(data);
$("#editResponsiblePerson").combobox({ //往下拉框塞值
data : jso,
valueField : "text", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
//獲取條件查詢的負責人下拉框
$.ajax({
type : "get",
url : "${ctx}/sysDict/getDictList?parentKey=FZR",
async : false,
success : function(data) {
var jso = JSON.parse(data);
$("#searchResponsiblePerson").combobox({ //往下拉框塞值
data : jso,
valueField : "text", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
//獲取客戶類別下拉框
$.ajax({
type : "get",
url : "${ctx}/sysDict/getDictList?parentKey=HYLBDM",
async : false,
success : function(data) {
var jso = JSON.parse(data);
$("#addCustomerCategory").combobox({ //往下拉框塞值
data : jso,
valueField : "text", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
//獲取修改的客戶類別下拉框
$.ajax({
type : "get",
url : "${ctx}/sysDict/getDictList?parentKey=HYLBDM",
async : false,
success : function(data) {
var jso = JSON.parse(data);
$("#editCustomerCategory").combobox({ //往下拉框塞值
data : jso,
valueField : "text", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
//獲取條件查詢的客戶類別下拉框
$.ajax({
type : "get",
url : "${ctx}/sysDict/getDictList?parentKey=HYLBDM",
async : false,
success : function(data) {
var jso = JSON.parse(data);
$("#searchCustomerCategory").combobox({ //往下拉框塞值
data : jso,
valueField : "text", //value值
textFild : "text" //文本值
});
},
error : function(data) {}
})
/* 新增彈出框 */
function customerForm() {
/* 給jsp的簽訂時間設置當前時間 */
$('#signDate').datebox('setValue',myformatter(new Date));
var win = $('#dlg').dialog({ //創建彈出框
width : '500',
height : '600',
modal : true, //遮罩層
title : '添加銷售合同',
shadow : true, //陰影
buttons : [ { //
text : '提交',
iconCls : 'icon-ok',
handler : function() {
if ($("#customerForm").form('validate')) { /* 進行表單驗證 */
var formData = document.getElementById("customerForm"); /* 通過id獲取到用戶表單 */
var data = new FormData(formData); /* 創建一個新的表單數據 */
$.ajax({
type : "post",
url : "${ctx}/financialSalesContract/addFinancialSalesContract",
data : data,
async : false, /* 是否同步 */
contentType : false,
processData : false,
success : function(data) {
$("#dlg").dialog('close'); /* 關閉對話框 */
$("#dg").datagrid("reload"); /* 重載表格 */
$.messager.show({
title : '消息提示',
msg : '保存成功',
timeout : 2000,
showType : 'slide'
});
}
});
}
}
}, {
text : '關閉',
iconCls : 'icon-no',
handler : function() {
$("#dlg").dialog('close');
}
}]
});
win.dialog('open'); //打開添加對話框
win.window('center'); //使Dialog居中顯示
}
/* 修改彈出框 */
function editCustomerForm(id) {
/* 修改之前先要根據id查詢出銷售合同信息,然後再把這些數據顯示出來 */
$.ajax({
type : "post",
url : "${ctx}/financialSalesContract/selFinancialSalesContractById?id=" + id,
async : false,
contentType : false,
processData : false,
success : function(data) {
$("#money").textbox('setValue', data.money);
$("#editUnitName").combobox('setValue', data.customerId);
$("#editCity").combobox('setValue', data.city);
$("#acceptMoney").textbox("setValue", data.acceptMoney);
$("#editContractName").textbox("setValue", data.contractName);
$("#contractNo").textbox("setValue", data.contractNo);
$("#editResponsiblePerson").combobox('setValue', data.responsiblePerson);
$("#editCustomerCategory").combobox('setValue', data.customerCategory);
var time = myformatter(data.signDate);
$("#editSignDate").datebox("setValue", time);
$("#remark").textbox("setValue", data.remark);
},
error : function(data) {}
})
var win = $('#editDlg').dialog({ //創建彈出框
width : '500',
height : '600',
modal : true, //遮罩層
title : '修改銷售合同',
shadow : true, //陰影
buttons : [ { //按鈕
text : '提交',
iconCls : 'icon-ok',
handler : function() {
$.messager.confirm('提示', '您確定要修改嗎', function(t) {
if (t) {
if ($("#editCustomerForm").form('validate')) {
var formData = document.getElementById("editCustomerForm");
var data = new FormData(formData);
/* 修改的時候需要把id set進去 */
data.set("id", id);
data.get("id");
$.ajax({
type : "post",
url : "${ctx}/financialSalesContract/editFinancialSalesContract",
data : data,
async : false,
contentType : false,
processData : false,
success : function(data) {
$("#editDlg").dialog('close');
$("#dg").datagrid("reload");
$.messager.show({
title : '消息提示',
msg : '修改成功',
timeout : 2000,
showType : 'slide'
});
}
});
}
}
});
}
}, {
text : '關閉',
iconCls : 'icon-no',
handler : function() {
$("#editDlg").dialog('close');
}
}
]
});
win.dialog('open'); //打開添加對話框
win.window('center'); //使Dialog居中顯示
}
//時間格式化
function myformatter(date) {
var date = new Date(date);
var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1);
var hor = date.getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
return date.getFullYear() + '-' + month + '-' + day
}
function delCustomerForm(id) {
$.ajax({
type : "get",
url : "${ctx}/financialSalesContract/delFinancialSalesContractById?id=" + id,
async : false,
contentType : false,
processData : false,
success : function(data) {
$.messager.show({
title : '消息提示',
msg : '刪除成功',
timeout : 2000,
showType : 'slide'
});
},
error : function(data) {}
})
}
</script>
</body>
</html>
銷售合同添加操作頁面
銷售合同修改操作頁面
銷售合同查詢列表