|
|
|
|
|
|
|
|
|
define(function (require, exports, module) {
|
|
|
|
|
//引入业务类基类
|
|
|
|
|
let BaseBiz = require('apps/rht/base/rhtBiz');
|
|
|
|
|
let rhtComm = require('apps/rht/comm/rhtComm');
|
|
|
|
|
|
|
|
|
|
//引入业务服务
|
|
|
|
|
let Service = require('./wsl160126service');
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 定义业务类对象
|
|
|
|
|
* @param vm 界面相关ViewModule
|
|
|
|
|
*/
|
|
|
|
|
function Biz(vm) {
|
|
|
|
|
//继承第一步,构造继承
|
|
|
|
|
BaseBiz.call(this, vm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//继承第二步,方法继承
|
|
|
|
|
inherits(Biz, BaseBiz);
|
|
|
|
|
|
|
|
|
|
//控制是否允许删除明细 0-否 1-是(允许)
|
|
|
|
|
let Isdel = "0";
|
|
|
|
|
let Isadd = "0";
|
|
|
|
|
let IsMdKwMng = rhtComm.getRhtOptionValue(Store.logOn.orgCode,'STK','IsMdKwMng','1');
|
|
|
|
|
|
|
|
|
|
//新增行后处理,默认值已经处理
|
|
|
|
|
Biz.prototype.afterNewRow = function (dataSrc, newRow) {
|
|
|
|
|
if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) {
|
|
|
|
|
let InOrgCode = rhtComm.GetInOrgCode(Store.logOn.orgCode).message;
|
|
|
|
|
newRow.setColumnValue('InOrgCode', InOrgCode);
|
|
|
|
|
}
|
|
|
|
|
if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) {
|
|
|
|
|
let masterRow = this.dsMaster.currentRow;
|
|
|
|
|
let LyBillNo = TypeUtil.toString(masterRow['LyBillNo']);
|
|
|
|
|
if ((LyBillNo.length > 0) && (Isadd == "0")) {
|
|
|
|
|
Isadd = "1";
|
|
|
|
|
this.dsDetail.deleteRow(newRow);
|
|
|
|
|
Isadd = "0";
|
|
|
|
|
Store.messager.err('按原单返还时不允许增加新数据!');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.super('afterNewRow', dataSrc, newRow);
|
|
|
|
|
};
|
|
|
|
|
//保存前校验 计算主表合计数量等字段
|
|
|
|
|
Biz.prototype.beforeSave = function () {
|
|
|
|
|
let curRow = this.dsMaster.currentRow;
|
|
|
|
|
if(curRow){
|
|
|
|
|
let LyCount = 0.0;
|
|
|
|
|
let STotal = 0.0;
|
|
|
|
|
let YhTotal = 0.0;
|
|
|
|
|
let SsTotal = 0.0;
|
|
|
|
|
let XTaxTotal = 0.0;
|
|
|
|
|
let StlCurrSsTotal = 0.0;
|
|
|
|
|
|
|
|
|
|
for(let i=0;i<this.dsDetail.rows.length;i++){
|
|
|
|
|
let row = this.dsDetail.rows[i];
|
|
|
|
|
LyCount = LyCount + TypeUtil.toFloat(row['LyCount']);
|
|
|
|
|
STotal = STotal + TypeUtil.toFloat(row['STotal']);
|
|
|
|
|
YhTotal = YhTotal + TypeUtil.toFloat(row['YhTotal']);
|
|
|
|
|
SsTotal = SsTotal + TypeUtil.toFloat(row['SsTotal']);
|
|
|
|
|
XTaxTotal = XTaxTotal + TypeUtil.toFloat(row['XTaxTotal']);
|
|
|
|
|
StlCurrSsTotal = StlCurrSsTotal + TypeUtil.toFloat(row['StlCurrSsTotal']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
curRow.setColumnValue('LyCount',LyCount);
|
|
|
|
|
curRow.setColumnValue('STotal',STotal);
|
|
|
|
|
curRow.setColumnValue('YhTotal',YhTotal);
|
|
|
|
|
curRow.setColumnValue('SsTotal',SsTotal);
|
|
|
|
|
curRow.setColumnValue('XTaxTotal',XTaxTotal);
|
|
|
|
|
curRow.setColumnValue('StlCurrSsTotal',StlCurrSsTotal);
|
|
|
|
|
}
|
|
|
|
|
return this.super('beforeSave');
|
|
|
|
|
};
|
|
|
|
|
//行删除前的校验
|
|
|
|
|
Biz.prototype.beforeDeleteRow=function(dataSrc, newRow){
|
|
|
|
|
if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) {
|
|
|
|
|
let masterRow = this.dsMaster.currentRow;
|
|
|
|
|
let LyBillNo = TypeUtil.toString(masterRow['LyBillNo']);
|
|
|
|
|
if ((LyBillNo.length > 0) && (Isdel == "0") && (newRow['PluId'] > 0)) {
|
|
|
|
|
Store.messager.err('按原单返还时不允许删除原领用单数据!');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
//明细行单行提交触发的校验
|
|
|
|
|
Biz.prototype.dataRowValidate = function (dataSrc, dr) {
|
|
|
|
|
if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) {
|
|
|
|
|
let masterRow = this.dsMaster.currentRow;
|
|
|
|
|
let LyCount = TypeUtil.toFloat(dr['LyCount']);
|
|
|
|
|
let PackUnit = TypeUtil.toString(dr['PackUnit']);
|
|
|
|
|
let PluCode = dr ? TypeUtil.toString(dr['PluCode']) : '';
|
|
|
|
|
let LyBillNo = masterRow ? TypeUtil.toString(masterRow['LyBillNo']) : '';
|
|
|
|
|
let ToSerialNo = TypeUtil.toString(dr['ToSerialNo']);
|
|
|
|
|
if (PluCode.length <= 0) {
|
|
|
|
|
return "商品编码不能为空!";
|
|
|
|
|
}
|
|
|
|
|
if (LyCount <= 0) {
|
|
|
|
|
return "返还数量应该大于0!";
|
|
|
|
|
}
|
|
|
|
|
if (PackUnit == "") {
|
|
|
|
|
dr.setColumnValue('PackCount', "0");
|
|
|
|
|
}
|
|
|
|
|
if (LyBillNo.length > 0){
|
|
|
|
|
let ret= Service.getSlideMenuData("DoOnMasterRule","ChkBillBody",LyBillNo,ToSerialNo,"","","");
|
|
|
|
|
if (ret.result !== 1) {
|
|
|
|
|
return "获取内部领用单:"+LyBillNo+"的明细失败";
|
|
|
|
|
}
|
|
|
|
|
if (ret.data === null) {
|
|
|
|
|
return "按原单返还时不允许增加或修改原领用单数据!";
|
|
|
|
|
}
|
|
|
|
|
if (ret.data.PluId !== undefined){
|
|
|
|
|
if ((dr['DepId'] != ret.data.DepId) || (dr['PluId'] != ret.data.PluId)
|
|
|
|
|
|| (dr['LyCount'] != ret.data.LyCount) || (dr['Price'] != ret.data.Price)
|
|
|
|
|
|| (dr['PluType'] != ret.data.PluType) || (dr['SsTotal'] != ret.data.SsTotal)){
|
|
|
|
|
return "按原单返还时不允许修改原领用单数据!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description 数据发生变化时调用
|
|
|
|
|
* @param dataSrc 数据集
|
|
|
|
|
* @param dr 数据行
|
|
|
|
|
* @param dc 数据列
|
|
|
|
|
*/
|
|
|
|
|
Biz.prototype.fieldChanged = function (dataSrc, dr, dc) {
|
|
|
|
|
let self = this;
|
|
|
|
|
let currentRow = self.dsMaster.currentRow;
|
|
|
|
|
if (currentRow === null) return false;
|
|
|
|
|
if (dataSrc.uiObjCode === this.dsMaster.uiObjCode) {
|
|
|
|
|
switch (dc.fieldName) {
|
|
|
|
|
case 'LyBillNo':
|
|
|
|
|
this.fieldChangedLyBillNo(dataSrc, dr, dc);
|
|
|
|
|
break;
|
|
|
|
|
case 'FkTotal':
|
|
|
|
|
this.fieldChangedFkTotal(dataSrc, dr, dc);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) {
|
|
|
|
|
switch (dc.fieldName) {
|
|
|
|
|
case 'PluCode':
|
|
|
|
|
this.fieldChangedPluCode(dataSrc, dr, dc);
|
|
|
|
|
break;
|
|
|
|
|
case 'SglCount':
|
|
|
|
|
this.fieldChangedSglCount(dataSrc, dr, dc);
|
|
|
|
|
break;
|
|
|
|
|
case 'PackCount':
|
|
|
|
|
this.fieldChangedPackCount(dataSrc, dr, dc);
|
|
|
|
|
break;
|
|
|
|
|
case 'Price':
|
|
|
|
|
this.fieldChangedPrice(dataSrc, dr, dc);
|
|
|
|
|
break;
|
|
|
|
|
case 'YhTotal':
|
|
|
|
|
this.fieldChangedYhTotal(dataSrc, dr, dc);
|
|
|
|
|
break;
|
|
|
|
|
case 'SsTotal':
|
|
|
|
|
this.fieldChangedSsTotal(dataSrc, dr, dc);
|
|
|
|
|
break;
|
|
|
|
|
case 'XTaxRate':
|
|
|
|
|
this.fieldChangedXTaxRate(dataSrc, dr, dc);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.super('fieldChanged');
|
|
|
|
|
};
|
|
|
|
|
//LyBillNo 字段变化执行事件
|
|
|
|
|
Biz.prototype.fieldChangedLyBillNo = function (dataSrc, dr, dc) {
|
|
|
|
|
let self = this;
|
|
|
|
|
let currentRow = self.dsMaster.currentRow;
|
|
|
|
|
let sRefBillNo = TypeUtil.toString(currentRow['LyBillNo']);
|
|
|
|
|
let CkCode = currentRow ? TypeUtil.toString(currentRow['CkCode']) : '';
|
|
|
|
|
if (CkCode.length == 0) {
|
|
|
|
|
dr.setColumnError('CkCode', "请先输入仓库!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (sRefBillNo === ''){
|
|
|
|
|
//清空明细表
|
|
|
|
|
Isdel = "1";
|
|
|
|
|
this.dsDetail.deleteAll();
|
|
|
|
|
Isdel = "0";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//调用服务端插件获取主表信息
|
|
|
|
|
let ret= Service.getSlideMenuData("DoOnMasterRule","LyBillNo",sRefBillNo,"","","","");
|
|
|
|
|
if (ret.result !== 1) {
|
|
|
|
|
dr.setColumnError(dc.fieldName, ret.message);
|
|
|
|
|
dr.setColumnText('LyBillNo', '');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//如果没有结果报错并结束
|
|
|
|
|
if (ret.data === null){
|
|
|
|
|
dr.setColumnError(dc.fieldName, "未获取到参照单据:"+ret.message);
|
|
|
|
|
dr.setColumnText('LyBillNo', '');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
//主表字段赋值
|
|
|
|
|
dr.setColumnText('DepCode', ret.data.DepCode);
|
|
|
|
|
dr.setColumnValue('SkTotal', ret.data.SkTotal);
|
|
|
|
|
dr.setColumnValue('PriceType', ret.data.PriceType);
|
|
|
|
|
|
|
|
|
|
//明细表字段赋值
|
|
|
|
|
//首先清空明细表
|
|
|
|
|
|
|
|
|
|
Isdel = "1";
|
|
|
|
|
this.dsDetail.deleteAll();
|
|
|
|
|
Isdel = "0";
|
|
|
|
|
|
|
|
|
|
//循环插入记录
|
|
|
|
|
Isadd = "1";
|
|
|
|
|
for(let i = 0; i <= ret.data.Bodys.length - 1; i++){
|
|
|
|
|
let drdetail = this.dsDetail.addRow();
|
|
|
|
|
drdetail.setColumnValue('ToSerialNo', ret.data.Bodys[i].SerialNo);
|
|
|
|
|
drdetail.setColumnValue('DepId',ret.data.Bodys[i].DepId);
|
|
|
|
|
drdetail.setColumnValue('DepCode',ret.data.Bodys[i].DepCode);
|
|
|
|
|
drdetail.setColumnValue('DepName',ret.data.Bodys[i].DepName);
|
|
|
|
|
drdetail.setColumnValue('PluId', ret.data.Bodys[i].PluId);
|
|
|
|
|
drdetail.setColumnValue('PluCode', ret.data.Bodys[i].PluCode);
|
|
|
|
|
drdetail.setColumnValue('PluName', ret.data.Bodys[i].PluName);
|
|
|
|
|
drdetail.setColumnValue('BarCode',ret.data.Bodys[i].BarCode);
|
|
|
|
|
drdetail.setColumnValue('Spec',ret.data.Bodys[i].Spec);
|
|
|
|
|
drdetail.setColumnValue('Unit',ret.data.Bodys[i].Unit);
|
|
|
|
|
drdetail.setColumnValue('ExPluCode',ret.data.Bodys[i].ExPluCode);
|
|
|
|
|
drdetail.setColumnValue('ExPluName',ret.data.Bodys[i].ExPluName);
|
|
|
|
|
drdetail.setColumnValue('PackUnit',ret.data.Bodys[i].PackUnit);
|
|
|
|
|
drdetail.setColumnValue('PackQty',ret.data.Bodys[i].PackQty);
|
|
|
|
|
drdetail.setColumnValue('PackCount',ret.data.Bodys[i].PackCount);
|
|
|
|
|
drdetail.setColumnValue('SglCount',ret.data.Bodys[i].SglCount);
|
|
|
|
|
drdetail.setColumnValue('LyCount',ret.data.Bodys[i].LyCount);
|
|
|
|
|
drdetail.setColumnValue('Price',ret.data.Bodys[i].Price);
|
|
|
|
|
drdetail.setColumnValue('STotal',ret.data.Bodys[i].STotal);
|
|
|
|
|
drdetail.setColumnValue('YhTotal',ret.data.Bodys[i].YhTotal);
|
|
|
|
|
drdetail.setColumnValue('SsTotal',ret.data.Bodys[i].SsTotal);
|
|
|
|
|
drdetail.setColumnValue('XTaxRate',ret.data.Bodys[i].XTaxRate);
|
|
|
|
|
drdetail.setColumnValue('XTaxTotal',ret.data.Bodys[i].XTaxTotal);
|
|
|
|
|
drdetail.setColumnText('PluType',ret.data.Bodys[i].PluType);
|
|
|
|
|
drdetail.setColumnText('KwCode',ret.data.Bodys[i].KwCode);
|
|
|
|
|
drdetail.setColumnValue('Remark',ret.data.Bodys[i].Remark);
|
|
|
|
|
drdetail.setColumnValue('CkPrice',ret.data.Bodys[i].CkPrice);
|
|
|
|
|
drdetail.setColumnValue('CkSsTotal',ret.data.Bodys[i].CkSsTotal);
|
|
|
|
|
}
|
|
|
|
|
Isadd = "0";
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
//FkTotal 字段变化执行事件
|
|
|
|
|
Biz.prototype.fieldChangedFkTotal = function (dataSrc, dr, dc) {
|
|
|
|
|
let self = this;
|
|
|
|
|
let currentRow = self.dsMaster.currentRow;
|
|
|
|
|
let FkTotal = TypeUtil.toFloat(currentRow['FkTotal']);
|
|
|
|
|
if (FkTotal < 0) {
|
|
|
|
|
dr.setColumnError(dc.fieldName, "押金返还金额不能小于0");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
//PluCode 字段变化执行事件
|
|
|
|
|
Biz.prototype.fieldChangedPluCode = function (dataSrc, dr, dc) {
|
|
|
|
|
let self = this;
|
|
|
|
|
let currentRow = self.dsMaster.currentRow;
|
|
|
|
|
let PluId = dr['PluId'];
|
|
|
|
|
let PluCode = dr['PluCode'];
|
|
|
|
|
let DepCode = currentRow['DepCode'];
|
|
|
|
|
let CkCode = currentRow['CkCode'];
|
|
|
|
|
let PriceType = currentRow['PriceType'];
|
|
|
|
|
if (PluCode.length > 0){
|
|
|
|
|
dr.setColumnValue('PackUnit', "");
|
|
|
|
|
dr.setColumnValue('PackQty', "0");
|
|
|
|
|
let JSONObject={psPluCode:PluCode,psYwType:"1610"};
|
|
|
|
|
let retPacket= Service.getSlideMenuData("pubsysBaseBL","GetDefaultPluPackUnitByYwType",JSONObject,PluCode,"","","");
|
|
|
|
|
if (retPacket.result === 1) {
|
|
|
|
|
if (retPacket.data != null) {
|
|
|
|
|
dr.setColumnValue('PackUnit', retPacket.data.Unit);
|
|
|
|
|
dr.setColumnValue('PackQty', retPacket.data.Qty);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dr.setColumnValue("PackCount", "0");
|
|
|
|
|
dr.setColumnText("SglCount", "0");
|
|
|
|
|
dr.setColumnValue('CkPrice', "0");
|
|
|
|
|
|
|
|
|
|
let InOrgCode = rhtComm.GetInOrgCode(Store.logOn.orgCode).message;
|
|
|
|
|
JSONObject={OrgCode:InOrgCode,PluCode:PluCode,DepCode:DepCode};
|
|
|
|
|
let retdep = Service.getSlideMenuData("pubsysBaseBL","UQryPluDepInfo",JSONObject,"","","","");
|
|
|
|
|
if (retdep.result === 1) {
|
|
|
|
|
if (retdep.data != null) {
|
|
|
|
|
dr.setColumnValue('DepId', retdep.data.DepID);
|
|
|
|
|
dr.setColumnValue('DepCode', retdep.data.DepCode);
|
|
|
|
|
dr.setColumnValue('DepName', retdep.data.DepName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
dr.setColumnError(dc.fieldName, retdep.message);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
dr.setColumnText('YhTotal', "0");
|
|
|
|
|
if (IsMdKwMng == "1"){
|
|
|
|
|
JSONObject={CurInOrgCode:InOrgCode,CkCode:CkCode,PluID:PluId};
|
|
|
|
|
let retKwCode = Service.getSlideMenuData("pubsysBaseBL","GetPluKw",JSONObject,"","","","");
|
|
|
|
|
if (retKwCode.result === 1) {
|
|
|
|
|
if (retKwCode.data != null) {
|
|
|
|
|
dr.setColumnValue('KwCode', retKwCode.data.KwCode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
dr.setColumnError(dc.fieldName, retKwCode.message);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let ret= Service.getSlideMenuData("DoOnDetailCalcRule","PluCode","",PluCode,InOrgCode,"","");
|
|
|
|
|
if (ret.result !== 1) {
|
|
|
|
|
dr.setColumnError(dc.fieldName, ret.message);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (ret.data != null) {
|
|
|
|
|
if (PriceType == "0"){
|
|
|
|
|
dr.setColumnText('Price', ret.data.PfPrice);
|
|
|
|
|
}
|
|
|
|
|
if (PriceType == "2"){
|
|
|
|
|
dr.setColumnText('Price', ret.data.Price);
|
|
|
|
|
}
|
|
|
|
|
dr.setColumnText('CkPrice', ret.data.Price);
|
|
|
|
|
dr.setColumnText("SglCount", "0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
//SglCount 字段变化执行事件
|
|
|
|
|
Biz.prototype.fieldChangedSglCount = function (dataSrc, dr, dc) {
|
|
|
|
|
let PackQty = TypeUtil.toFloat(dr['PackQty']);
|
|
|
|
|
let PackCount = TypeUtil.toFloat(dr['PackCount']);
|
|
|
|
|
let SglCount = TypeUtil.toFloat(dr['SglCount']);
|
|
|
|
|
let Price = TypeUtil.toFloat(dr['Price']);
|
|
|
|
|
let YhTotal = TypeUtil.toFloat(dr['YhTotal']);
|
|
|
|
|
let XTaxRate = TypeUtil.toFloat(dr['XTaxRate']);
|
|
|
|
|
let CkPrice = TypeUtil.toFloat(dr['CkPrice']);
|
|
|
|
|
let LyCount =0.0;
|
|
|
|
|
let SsTotal =0.0;
|
|
|
|
|
LyCount = (PackCount * PackQty) + SglCount;
|
|
|
|
|
SsTotal = (LyCount*Price).round(2)-YhTotal;
|
|
|
|
|
|
|
|
|
|
dr.setColumnValue("LyCount", LyCount);
|
|
|
|
|
dr.setColumnValue("STotal", (LyCount*Price).round(2));
|
|
|
|
|
dr.setColumnValue("SsTotal", SsTotal);
|
|
|
|
|
dr.setColumnValue("XTaxTotal", (SsTotal*(XTaxRate/100/(1+XTaxRate/100))).round(2));
|
|
|
|
|
dr.setColumnValue("CkSsTotal", (LyCount*CkPrice).round(2));
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
//PackCount 字段变化执行事件
|
|
|
|
|
Biz.prototype.fieldChangedPackCount = function (dataSrc, dr, dc) {
|
|
|
|
|
let PackQty = TypeUtil.toFloat(dr['PackQty']);
|
|
|
|
|
let PackCount = TypeUtil.toFloat(dr['PackCount']);
|
|
|
|
|
let SglCount = TypeUtil.toFloat(dr['SglCount']);
|
|
|
|
|
let Price = TypeUtil.toFloat(dr['Price']);
|
|
|
|
|
let YhTotal = TypeUtil.toFloat(dr['YhTotal']);
|
|
|
|
|
let XTaxRate = TypeUtil.toFloat(dr['XTaxRate']);
|
|
|
|
|
let CkPrice = TypeUtil.toFloat(dr['CkPrice']);
|
|
|
|
|
let LyCount =0.0;
|
|
|
|
|
let SsTotal =0.0;
|
|
|
|
|
LyCount = (PackCount * PackQty) + SglCount;
|
|
|
|
|
SsTotal = (LyCount*Price).round(2)-YhTotal;
|
|
|
|
|
|
|
|
|
|
dr.setColumnValue("LyCount", LyCount);
|
|
|
|
|
dr.setColumnValue("STotal", (LyCount*Price).round(2));
|
|
|
|
|
dr.setColumnValue("SsTotal", SsTotal);
|
|
|
|
|
dr.setColumnValue("XTaxTotal", (SsTotal*(XTaxRate/100/(1+XTaxRate/100))).round(2));
|
|
|
|
|
dr.setColumnValue("CkSsTotal", (LyCount*CkPrice).round(2));
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
//Price 字段变化执行事件
|
|
|
|
|
Biz.prototype.fieldChangedPrice = function (dataSrc, dr, dc) {
|
|
|
|
|
let LyCount = TypeUtil.toFloat(dr['LyCount']);
|
|
|
|
|
let Price = TypeUtil.toFloat(dr['Price']);
|
|
|
|
|
let YhTotal = TypeUtil.toFloat(dr['YhTotal']);
|
|
|
|
|
let XTaxRate = TypeUtil.toFloat(dr['XTaxRate']);
|
|
|
|
|
let SsTotal =0.0;
|
|
|
|
|
SsTotal = (LyCount*Price).round(2)-YhTotal;
|
|
|
|
|
|
|
|
|
|
dr.setColumnValue("STotal", (LyCount*Price).round(2));
|
|
|
|
|
dr.setColumnValue("SsTotal", SsTotal);
|
|
|
|
|
dr.setColumnValue("XTaxTotal", (SsTotal*(XTaxRate/100/(1+XTaxRate/100))).round(2));
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
//YhTotal 字段变化执行事件
|
|
|
|
|
Biz.prototype.fieldChangedYhTotal = function (dataSrc, dr, dc) {
|
|
|
|
|
let YsTotal = TypeUtil.toFloat(dr['STotal']);
|
|
|
|
|
let YhTotal = TypeUtil.toFloat(dr['YhTotal']);
|
|
|
|
|
let XTaxRate = TypeUtil.toFloat(dr['XTaxRate']);
|
|
|
|
|
let SsTotal =0.0;
|
|
|
|
|
SsTotal = YsTotal-YhTotal;
|
|
|
|
|
|
|
|
|
|
dr.setColumnValue("SsTotal", YsTotal-YhTotal);
|
|
|
|
|
dr.setColumnValue("XTaxTotal", (SsTotal*(XTaxRate/100/(1+XTaxRate/100))).round(2));
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
//SsTotal 字段变化执行事件
|
|
|
|
|
Biz.prototype.fieldChangedSsTotal = function (dataSrc, dr, dc) {
|
|
|
|
|
let LyCount = TypeUtil.toFloat(dr['LyCount']);
|
|
|
|
|
let SsTotal = TypeUtil.toFloat(dr['SsTotal']);
|
|
|
|
|
let XTaxRate = TypeUtil.toFloat(dr['XTaxRate']);
|
|
|
|
|
let Price = 0.0;
|
|
|
|
|
if (LyCount == 0){
|
|
|
|
|
Price = 0;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
Price = ((SsTotal/LyCount)+0.00004).round(4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dr.setColumnValue("Price", Price);
|
|
|
|
|
dr.setColumnValue("STotal", (LyCount*Price).round(2));
|
|
|
|
|
dr.setColumnValue("SsTotal", (LyCount*Price).round(2)-SsTotal);
|
|
|
|
|
dr.setColumnValue("XTaxTotal", (SsTotal*(XTaxRate/100/(1+XTaxRate/100))).round(2));
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
//XTaxRate 字段变化执行事件
|
|
|
|
|
Biz.prototype.fieldChangedXTaxRate = function (dataSrc, dr, dc) {
|
|
|
|
|
let XTaxRate = TypeUtil.toFloat(dr['XTaxRate']);
|
|
|
|
|
let SsTotal = TypeUtil.toFloat(dr['SsTotal']);
|
|
|
|
|
dr.setColumnValue("XTaxTotal", (SsTotal*(XTaxRate/100/(1+XTaxRate/100))).round(2));
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
return Biz;
|
|
|
|
|
});
|