Commit 3e78a96c authored by 陆正友's avatar 陆正友

进项导入(经租)

parent ed728dc3
......@@ -11,13 +11,23 @@
<bm:query-sql>
<![CDATA[
select *
from (select c.contract_id, c.contract_number, c.contract_name
from (select c.contract_id,
c.contract_number,
c.contract_name,
c.business_type,
(SELECT description
FROM HLS_BUSINESS_TYPE_V a
WHERE a.business_type = c.business_type) business_type_n
from con_contract c
where c.data_class = 'NORMAL'
and c.contract_status IN ('REPURING','ETING','INCEPT','PENDING')
and c.business_type <>'LEASEBACK'
and not exists (select 1 from acp_invoice_ln an where an.contract_id=c.contract_id and an.confirmation_status in('APPROVING','APPROVED'))
) V
and c.contract_status IN
('REPURING', 'ETING', 'INCEPT', 'PENDING')
and c.business_type <> 'LEASEBACK'
and not exists
(select 1
from acp_invoice_ln an
where an.contract_id = c.contract_id
and an.confirmation_status in ('APPROVING', 'APPROVED'))) V
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
......@@ -27,6 +37,9 @@
<bm:field name="contract_number" forDisplay="true" forQuery="true" prompt="ACR310.CONTRACT_NUMBER"/>
<bm:field name="contract_name" forDisplay="true" forQuery="true" prompt="ACR310.CONTRACT_NAME"/>
<bm:field name="contract_id"/>
<bm:field name="business_type_n" forDisplay="true" forQuery="true" prompt="业务类型"/>
<bm:field name="business_type" forDisplay="true" forQuery="true" prompt="业务类型"/>
</bm:fields>
<!-- <bm:fields>-->
<!-- <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" forDisplay="true" forQuery="true" physicalName="contract_number" prompt="ACR310.CONTRACT_NUMBER"/>-->
......@@ -36,5 +49,8 @@
<bm:query-fields>
<bm:query-field field="contract_number" queryOperator="like"/>
<bm:query-field field="contract_name" queryOperator="like"/>
<bm:query-field field="business_type_n" queryOperator="like"/>
<bm:query-field field="business_type" queryOperator="like"/>
</bm:query-fields>
</bm:model>
......@@ -8,6 +8,8 @@
<a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="ap_invoice_import_detail_link1"
url="${/request/@context_path}/modules/acp/ACP522/ap_invoice_import_detail.lview"/>
<a:link id="jz_invoice_import_detail_link1"
url="${/request/@context_path}/modules/acp/ACP522/jz_invoice_import_detail.lview"/>
<script><![CDATA[
function invoice_inf_process(dataset, record, name, value, oldvalue) {
......@@ -61,22 +63,39 @@
}
}
function acp522_save() {
var record=$('acp522_acp_invoice_import_detail_ds').getCurrentRecord();
if(record.get('business_type')=='LEASE'){
if($('acp522_acp_invoice_import_detail_ds').validate()){
$('ap_invoice_import_scanning').close();
var record=$('acp522_acp_invoice_import_detail_ds').getCurrentRecord();
var record_id=record.id;
var ds_id=record.ds.id
// var record = $(ds_id).findById(record_id);
var ds_id=record.ds.id;
console.log(record.get('business_type'));
var param = record.data;
param['function_usage'] = 'MODIFY';
param['function_code'] = 'ACP522I';
param['contract_id'] = record.get('contract_id');
//param['business_type'] = record.get('business_type');
param['url_title'] = '进项发票详情';
param['winId'] = 'aaaaa';
hls_doc_get_layout_code('hn9040_project_get_layout_code_link_id', param, 'ap_invoice_import_detail_link1', ds_id);
}
}else{
if($('acp522_acp_invoice_import_detail_ds').validate()){
$('ap_invoice_import_scanning').close();
var record=$('acp522_acp_invoice_import_detail_ds').getCurrentRecord();
var record_id=record.id;
var ds_id=record.ds.id;
var param = record.data;
param['function_usage'] = 'MODIFY';
param['function_code'] = 'ACP522J';
param['contract_id'] = record.get('contract_id');
//param['business_type'] = record.get('business_type');
param['url_title'] = '进项发票详情(经租)';
param['winId'] = 'bbbbb';
hls_doc_get_layout_code('hn9040_project_get_layout_code_link_id', param, 'jz_invoice_import_detail_link1', ds_id);
}
}
}
function acp522_back() {
$('ap_invoice_import_scanning').close();
......@@ -94,6 +113,7 @@
<a:map from="contract_number" to="contract_number"/>
<a:map from="contract_name" to="contract_name"/>
<a:map from="contract_id" to="contract_id"/>
<a:map from="business_type" to="business_type"/>
</a:mapping>
</a:field>
</a:fields>
......
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true"
trace="true">
<a:init-procedure>
<a:model-query defaultWhereClause="t1.user_id=${/session/@user_id}" model="basic.sys_session_info"
rootPath="user_name_path"/>
</a:init-procedure>
<a:view>
<a:link id="acp_invoice_inf_import_link" model="acp.ACP522.acp_invoice_inf_import" modelaction="update"/>
<a:link id="acp_invoice_inf_import_total_link" model="acp.ACP522.acp_invoice_inf_import_total" modelaction="update"/>
<a:link id="acp_invoice_inf_import_submit_link" model="acp.ACP522.acp_invoice_inf_import" modelaction="execute"/>
<script src="${/request/@context_path}/javascripts/calculate.js" type="text/javascript"/>
<script><![CDATA[
//移除前事件(grid,attach,gridbox,table)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_brfore_remove'] = function (ds, record, bp_seq) {
return true;
};
Leaf.onReady(function () {
var first = document.getElementsByClassName("item-input-wrap");
var second = first[2].getElementsByClassName('item-textField');
var third = second[0];
third.setAttribute('placeholder', '注:扫描时请将鼠标光标放在此处。。。');
third.style.backgroundColor = '#FF7744';
});
//新增时调用(grid,table,gridBox)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_add'] = function (ds, record, config_records, bp_seq) {
record.set("created_by_n", '${/model/user_name_path/record/@user_desc}');
record.set("created_by", '${/session/@user_id}');
record.set("update_date", new Date());
};
//提交审批
window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function () {
debugger;
var hd_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'acp_invoice_ln');
var hd_record = $(hd_id).getAt(0);
var lease_item_amount = hd_record.get('lease_item_amount');
if ($(ds_id).getAll().dirty) {
return;
}
if ($(ds_id).validate()) {
debugger;
var records = $(ds_id).getAll();
if (records.length < 1) {
Leaf.showMessage('提示', '未查询到发票信息,请添加发票信息!');
return;
}
var sum = 0;
var sum_tax = 0;
var net_lease_item_amount = hd_record.get('net_lease_item_amount') || 0;
for (var i = 0; i < records.length; i++) {
if (records[i].dirty) {
Leaf.showMessage('${l:HLS.PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
return;
}
var tempa = records[i].get('total_amount') || 0;
var tempb = plus((records[i].get('net_amount') || 0), (records[i].get('tax_amount') || 0));
if (tempa != tempb) {
Leaf.showMessage('提示', '发票明细行存在价税合计不等于不含税金额和税额之和!');
return;
}
var r = records[i];
var d = r.get(name);
var n = records[i].get('total_amount') || 0;
if (!isNaN(n)) {
sum = plus(sum, n);
}
// 营业外收入或营业外支出科目金额超过1,请联系系统管理员!
if (!isNaN(records[i].get('tax_amount') || 0)) {
sum_tax = plus((records[i].get('tax_amount') || 0), (sum_tax || 0));
}
//校验重复发票号码 add by 26887cz 2021-09-07
for (var j = i + 1; j < records.length; j++) {
if (records[i].get('invoice_number') == records[j].get('invoice_number')) {
Leaf.showMessage('提示', '发票号码重复,请重新扫描输入!');
return;
}
}
}
if (sum != lease_item_amount) {
Leaf.showMessage('提示', '本次发票明细含税总计不等于该合同设备价!');
return;
}
var diff = ((net_lease_item_amount + sum_tax - lease_item_amount) > 0 ? (net_lease_item_amount + sum_tax - lease_item_amount) : (lease_item_amount - sum_tax - net_lease_item_amount));
// if (diff > 1) {
// Leaf.showMessage('提示', '营业外收入或营业外支出科目金额超过1,请联系系统管理员!');
// return;
// }
Leaf.showConfirm('${l:HLS.PROMPT}', '确定提交审批吗?', function () {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
Leaf.request({
url: $('acp_invoice_inf_import_submit_link').getUrl(),
para: {
contract_id: hd_record.get('contract_id')
},
success: function (res) {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$('${/parameter/@winid}').close();
},
failure: function () {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
});
}
};
//更新时调用
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function (ds, record, name, value, old_value, bp_seq) {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
var acp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'acp_invoice_ln');
var record = $(ds_id).getAt(0);
if (name == 'invoice' && value && record.get('contract_id')) {
var contract_id = record.get('contract_id');
var strs = value.split(',');
var invoice_type = strs[1];
var invoice_code = strs[2];
var invoice_number = strs[3];
var net_amount = strs[4];
var invoice_date = strs[5];
var total_amount =strs[4];
//检验设备价格需要大于不含税金额
if (strs.length == 9) {
//校验重复发票号码 add by 26887cz 2021-09-07
var acr_records = $(acp_ds_id).getAll();
for (var i = 0; i < acr_records.length; i++) {
if (acr_records[i].get("invoice_number") == invoice_number) {
Leaf.showMessage('提示', '发票号码重复,请重新扫描!');
setTimeout(function () {
record.set('invoice', '');
}, 50);
return;
}
}
Leaf.request({
url: $('acp_invoice_inf_import_link').getUrl(),
para: {
invoice_type: invoice_type,
invoice_code: invoice_code,
invoice_number: invoice_number,
net_amount: net_amount,
invoice_date: invoice_date,
contract_id: contract_id
},
success: function () {
Leaf.SideBar.show({
msg: '导入成功',
duration: 2000
}
);
setTimeout(function () {
record.set('invoice', '');
}, 50);
$(acp_ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}');
$(acp_ds_id).query();
}, failure: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
error: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
scope: this
});
} else if (strs.length == 8) {
//校验重复发票号码 add by 26887cz 2021-09-07
var acr_records = $(acp_ds_id).getAll();
for (var i = 0; i < acr_records.length; i++) {
if (acr_records[i].get("invoice_number") == invoice_number) {
Leaf.showMessage('提示', '发票号码重复,请重新扫描!');
setTimeout(function () {
record.set('invoice', '');
}, 50);
return;
}
}
Leaf.request({
url: $('acp_invoice_inf_import_total_link').getUrl(),
para: {
invoice_type: invoice_type,
invoice_code: invoice_code,
invoice_number: invoice_number,
total_amount: total_amount,
invoice_date: invoice_date,
contract_id: contract_id
},
success: function () {
Leaf.SideBar.show({
msg: '导入成功',
duration: 2000
}
);
setTimeout(function () {
record.set('invoice', '');
}, 50);
$(acp_ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}');
$(acp_ds_id).query();
}, failure: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
error: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
scope: this
});
} else if (strs.length == 7) {
//校验重复发票号码 add by 26887cz 2021-09-07
var acr_records = $(acp_ds_id).getAll();
for (var i = 0; i < acr_records.length; i++) {
if (acr_records[i].get("invoice_number") == invoice_number) {
Leaf.showMessage('提示', '发票号码重复,请重新扫描!');
setTimeout(function () {
record.set('invoice', '');
}, 50);
return;
}
}
Leaf.request({
url: $('acp_invoice_inf_import_link').getUrl(),
para: {
invoice_type: invoice_type,
invoice_code: invoice_code,
invoice_number: invoice_number,
net_amount: net_amount,
invoice_date: invoice_date,
contract_id: contract_id
},
success: function () {
Leaf.SideBar.show({
msg: '导入成功',
duration: 2000
}
);
setTimeout(function () {
record.set('invoice', '');
}, 50);
$(acp_ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}');
$(acp_ds_id).query();
}, failure: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
error: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
scope: this
});
}else {
Leaf.showMessage('提示', '发票信息有错误,请重新扫描!');
setTimeout(function () {
record.set('invoice', '');
}, 50);
}
}
};
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
</a:view>
</a:screen>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment