Commit 71675f61 authored by stone's avatar stone

【feat】增值税台账功能

parent 730ab31a
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
WHENEVER OSERROR EXIT FAILURE ROLLBACK;
spool vat_account_tmp.log
PROMPT
PROMPT CREATING TABLE TRAIN_CONFIG
PROMPT ============================
PROMPT
--增值税台账临时表
CREATE TABLE vat_account_tmp(
vct_id NUMBER,
session_id NUMBER,
invoice_hd_id NUMBER,
invoice_line_id NUMBER,
contract_id NUMBER,
cashflow_id NUMBER,
invoice_kind VARCHAR2(100),
tax_apply_month VARCHAR2(10),
invoice_date DATE,
invoice_number VARCHAR2(100),
invoice_tax_amount NUMBER,
apply_flag VARCHAR2(10),
tenant_name VARCHAR2(1000),
contract_number VARCHAR2(100),
acr_tax_amount NUMBER,
journal_tax_amount NUMBER,
journal_month VARCHAR2(10),
journal_date DATE,
journal_num VARCHAR2(100),
times VARCHAR2(100),
due_date DATE,
due_amount NUMBER,
principal NUMBER,
interest NUMBER,
tax_amount NUMBER,
created_by NUMBER default -1 not null,
creation_date DATE default sysdate not null,
last_updated_by NUMBER default -1 not null,
last_update_date DATE default sysdate not NULL
);
ALTER TABLE vat_account_tmp ADD DESCRIPTION VARCHAR2(1000);
ALTER TABLE vat_account_tmp ADD cf_item NUMBER;
CREATE SEQUENCE vat_account_tmp_s;
SPOOL OFF
EXIT
\ No newline at end of file
...@@ -14,12 +14,12 @@ SELECT h.period_year, ...@@ -14,12 +14,12 @@ SELECT h.period_year,
h.period_num, h.period_num,
h.internal_period_num, h.internal_period_num,
h.journal_date, h.journal_date,
h.journal_num, h.sbo_num journal_num,
reference3 contract_number, reference3 contract_number,
reference4 bp_code, reference1 bp_code,
(SELECT BP_NAME (SELECT BP_NAME
FROM hls_bp_master FROM hls_bp_master
WHERE bp_code = reference4 WHERE bp_code = reference1
AND ROWNUM = 1) bp_name, AND ROWNUM = 1) bp_name,
l.journal_header_id, l.journal_header_id,
(SELECT hi.invoice_date (SELECT hi.invoice_date
...@@ -108,6 +108,7 @@ SELECT h.period_year, ...@@ -108,6 +108,7 @@ SELECT h.period_year,
h.je_transaction_code h.je_transaction_code
FROM hls_journal_header h, hls_journal_detail l FROM hls_journal_header h, hls_journal_detail l
WHERE h.journal_header_id = l.journal_header_id WHERE h.journal_header_id = l.journal_header_id
and h.sbo_num is not null
AND h.je_transaction_code IN AND h.je_transaction_code IN
('HL_SALES_TAX_ACT_NEW', 'HL_CSH_CONSOLIDATION_DALAY') ('HL_SALES_TAX_ACT_NEW', 'HL_CSH_CONSOLIDATION_DALAY')
and( (trunc(h.journal_date)<=trunc(to_date('2020-01-31','yyyy-mm-dd')) and h.description='MANUAL_IMPORT')or(trunc(h.journal_date)>trunc(to_date('2020-01-31','yyyy-mm-dd')))) and( (trunc(h.journal_date)<=trunc(to_date('2020-01-31','yyyy-mm-dd')) and h.description='MANUAL_IMPORT')or(trunc(h.journal_date)>trunc(to_date('2020-01-31','yyyy-mm-dd'))))
...@@ -121,7 +122,7 @@ SELECT h.period_year, ...@@ -121,7 +122,7 @@ SELECT h.period_year,
GROUP BY l.reference1, GROUP BY l.reference1,
reference3, reference3,
reference4, reference4,
h.journal_num, h.sbo_num,
l.cashflow_id, l.cashflow_id,
l.journal_header_id, l.journal_header_id,
h.je_transaction_code, h.je_transaction_code,
...@@ -136,12 +137,12 @@ SELECT h.period_year, ...@@ -136,12 +137,12 @@ SELECT h.period_year,
h.period_num, h.period_num,
h.internal_period_num, h.internal_period_num,
h.journal_date, h.journal_date,
h.journal_num, h.sbo_num journal_num,
reference3 contract_number, reference3 contract_number,
reference4 bp_code, reference1 bp_code,
(SELECT BP_NAME (SELECT BP_NAME
FROM hls_bp_master FROM hls_bp_master
WHERE bp_code = reference4 WHERE bp_code = reference1
AND ROWNUM = 1) bp_name, AND ROWNUM = 1) bp_name,
l.journal_header_id, l.journal_header_id,
(SELECT hi.invoice_date (SELECT hi.invoice_date
...@@ -168,7 +169,7 @@ SELECT h.period_year, ...@@ -168,7 +169,7 @@ SELECT h.period_year,
AND ROWNUM = 1) AND ROWNUM = 1)
due_amount, due_amount,
(SELECT principal (SELECT due_amount
FROM con_contract_cashflow FROM con_contract_cashflow
WHERE contract_id = l.source_doc_id WHERE contract_id = l.source_doc_id
AND cf_item = 2 AND cf_item = 2
...@@ -204,6 +205,7 @@ SELECT h.period_year, ...@@ -204,6 +205,7 @@ SELECT h.period_year,
h.je_transaction_code h.je_transaction_code
FROM hls_journal_header h, hls_journal_detail l FROM hls_journal_header h, hls_journal_detail l
WHERE h.journal_header_id = l.journal_header_id WHERE h.journal_header_id = l.journal_header_id
and h.sbo_num is not null
AND h.je_transaction_code = 'LEASE_INCEPT' AND h.je_transaction_code = 'LEASE_INCEPT'
AND l.je_template_ln_id = 8797 AND l.je_template_ln_id = 8797
and( (trunc(h.journal_date)<=trunc(to_date('2020-01-31','yyyy-mm-dd')) and h.description='MANUAL_IMPORT')or(trunc(h.journal_date)>trunc(to_date('2020-01-31','yyyy-mm-dd')))) and( (trunc(h.journal_date)<=trunc(to_date('2020-01-31','yyyy-mm-dd')) and h.description='MANUAL_IMPORT')or(trunc(h.journal_date)>trunc(to_date('2020-01-31','yyyy-mm-dd'))))
...@@ -227,7 +229,6 @@ SELECT h.period_year, ...@@ -227,7 +229,6 @@ SELECT h.period_year,
<bm:query-field name="bp_name" queryExpression="t1.bp_name = ${@bp_name}"/> <bm:query-field name="bp_name" queryExpression="t1.bp_name = ${@bp_name}"/>
<bm:query-field name="journal_date" queryExpression="to_char(t1.journal_date,'yyyy-mm-dd') = ${@journal_date}"/> <bm:query-field name="journal_date" queryExpression="to_char(t1.journal_date,'yyyy-mm-dd') = ${@journal_date}"/>
<bm:query-field name="invoice_date" queryExpression="to_char(t1.invoice_date,'yyyy-mm-dd') = ${@invoice_date}"/> <bm:query-field name="invoice_date" queryExpression="to_char(t1.invoice_date,'yyyy-mm-dd') = ${@invoice_date}"/>
<bm:query-field name="invoice_kind" queryExpression="to_char(t1.invoice_kind,'yyyy-mm-dd') = ${@invoice_kind}"/>
</bm:query-fields> </bm:query-fields>
</bm:model> </bm:model>
...@@ -14,12 +14,12 @@ SELECT h.period_year, ...@@ -14,12 +14,12 @@ SELECT h.period_year,
h.period_num, h.period_num,
h.internal_period_num, h.internal_period_num,
h.journal_date, h.journal_date,
h.journal_num, h.sbo_num journal_num,
reference3 contract_number, reference3 contract_number,
reference4 bp_code, reference1 bp_code,
(SELECT BP_NAME (SELECT BP_NAME
FROM hls_bp_master FROM hls_bp_master
WHERE bp_code = reference4 WHERE bp_code = reference1
AND ROWNUM = 1) bp_name, AND ROWNUM = 1) bp_name,
l.journal_header_id, l.journal_header_id,
(SELECT hi.invoice_date (SELECT hi.invoice_date
...@@ -108,6 +108,7 @@ SELECT h.period_year, ...@@ -108,6 +108,7 @@ SELECT h.period_year,
h.je_transaction_code h.je_transaction_code
FROM hls_journal_header h, hls_journal_detail l FROM hls_journal_header h, hls_journal_detail l
WHERE h.journal_header_id = l.journal_header_id WHERE h.journal_header_id = l.journal_header_id
and h.sbo_num is not null
AND h.je_transaction_code IN AND h.je_transaction_code IN
('HL_SALES_TAX_ACT_NEW', 'HL_CSH_CONSOLIDATION_DALAY') ('HL_SALES_TAX_ACT_NEW', 'HL_CSH_CONSOLIDATION_DALAY')
and( (trunc(h.journal_date)<=trunc(to_date('2020-01-31','yyyy-mm-dd')) and h.description='MANUAL_IMPORT')or(trunc(h.journal_date)>trunc(to_date('2020-01-31','yyyy-mm-dd')))) and( (trunc(h.journal_date)<=trunc(to_date('2020-01-31','yyyy-mm-dd')) and h.description='MANUAL_IMPORT')or(trunc(h.journal_date)>trunc(to_date('2020-01-31','yyyy-mm-dd'))))
...@@ -121,7 +122,7 @@ SELECT h.period_year, ...@@ -121,7 +122,7 @@ SELECT h.period_year,
GROUP BY l.reference1, GROUP BY l.reference1,
reference3, reference3,
reference4, reference4,
h.journal_num, h.sbo_num,
l.cashflow_id, l.cashflow_id,
l.journal_header_id, l.journal_header_id,
h.je_transaction_code, h.je_transaction_code,
...@@ -136,12 +137,12 @@ SELECT h.period_year, ...@@ -136,12 +137,12 @@ SELECT h.period_year,
h.period_num, h.period_num,
h.internal_period_num, h.internal_period_num,
h.journal_date, h.journal_date,
h.journal_num, h.sbo_num journal_num,
reference3 contract_number, reference3 contract_number,
reference4 bp_code, reference1 bp_code,
(SELECT BP_NAME (SELECT BP_NAME
FROM hls_bp_master FROM hls_bp_master
WHERE bp_code = reference4 WHERE bp_code = reference1
AND ROWNUM = 1) bp_name, AND ROWNUM = 1) bp_name,
l.journal_header_id, l.journal_header_id,
(SELECT hi.invoice_date (SELECT hi.invoice_date
...@@ -168,7 +169,7 @@ SELECT h.period_year, ...@@ -168,7 +169,7 @@ SELECT h.period_year,
AND ROWNUM = 1) AND ROWNUM = 1)
due_amount, due_amount,
(SELECT principal (SELECT due_amount
FROM con_contract_cashflow FROM con_contract_cashflow
WHERE contract_id = l.source_doc_id WHERE contract_id = l.source_doc_id
AND cf_item = 2 AND cf_item = 2
...@@ -204,6 +205,7 @@ SELECT h.period_year, ...@@ -204,6 +205,7 @@ SELECT h.period_year,
h.je_transaction_code h.je_transaction_code
FROM hls_journal_header h, hls_journal_detail l FROM hls_journal_header h, hls_journal_detail l
WHERE h.journal_header_id = l.journal_header_id WHERE h.journal_header_id = l.journal_header_id
and h.sbo_num is not null
AND h.je_transaction_code = 'LEASE_INCEPT' AND h.je_transaction_code = 'LEASE_INCEPT'
AND l.je_template_ln_id = 8797 AND l.je_template_ln_id = 8797
and( (trunc(h.journal_date)<=trunc(to_date('2020-01-31','yyyy-mm-dd')) and h.description='MANUAL_IMPORT')or(trunc(h.journal_date)>trunc(to_date('2020-01-31','yyyy-mm-dd')))) and( (trunc(h.journal_date)<=trunc(to_date('2020-01-31','yyyy-mm-dd')) and h.description='MANUAL_IMPORT')or(trunc(h.journal_date)>trunc(to_date('2020-01-31','yyyy-mm-dd'))))
...@@ -228,7 +230,5 @@ SELECT h.period_year, ...@@ -228,7 +230,5 @@ SELECT h.period_year,
<bm:query-field name="journal_date" queryExpression="to_char(t1.journal_date,'yyyy-mm-dd') = ${@journal_date}"/> <bm:query-field name="journal_date" queryExpression="to_char(t1.journal_date,'yyyy-mm-dd') = ${@journal_date}"/>
<bm:query-field name="base_period" queryExpression="to_char(t1.journal_date,'yyyymm') &lt; ${@base_period}"/> <bm:query-field name="base_period" queryExpression="to_char(t1.journal_date,'yyyymm') &lt; ${@base_period}"/>
<bm:query-field name="invoice_date" queryExpression="to_char(t1.invoice_date,'yyyy-mm-dd') = ${@invoice_date}"/> <bm:query-field name="invoice_date" queryExpression="to_char(t1.invoice_date,'yyyy-mm-dd') = ${@invoice_date}"/>
<bm:query-field name="invoice_kind" queryExpression="to_char(t1.invoice_kind,'yyyy-mm-dd') = ${@invoice_kind}"/>
</bm:query-fields> </bm:query-fields>
</bm:model> </bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: ZLF
$Date: 2015-1-21 下午3:09:38
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select * from (
SELECT t.contract_id,
t.invoice_hd_id,
(SELECT v.code_value_name
FROM sys_code_values_v v
WHERE v.code = 'ACR510_INVOICE_KIND'
AND v.code_value = t.invoice_kind)invoice_kind_n,
t.cashflow_id,
t.tax_apply_month invoice_month,
t.invoice_date,
t.invoice_number,
t.invoice_tax_amount total_amount,
t.apply_flag for_invoice_flag,
t.tenant_name bp_name,
t.contract_number,
t.acr_tax_amount return_tax_amount,
t.journal_tax_amount amount_cr,
t.journal_month je_month,
t.journal_date je_date,
t.journal_num,
t.times,
t.due_date,
t.due_amount,
t.principal,
t.interest,
t.tax_amount vat_due_amount,
t.created_by,
t.creation_date,
t.last_updated_by,
t.last_update_date
FROM vat_account_tmp t
WHERE t.session_id=${/session/@session_id}
) t1
#WHERE_CLAUSE#
-- order by invoice_hd_id
]]></bm:query-sql>
</bm:operation>
<bm:operation name="update">
<bm:update-sql><![CDATA[
BEGIN
acr_invoice_pkg.vat_account_data_process(p_base_period => ${@base_period},
p_session_id => ${/session/@session_id},
p_user_id => ${/session/@user_id} );
END;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
<bm:data-filters>
<!-- <bm:data-filter enforceOperations="query" expression="to_char(t1.invoice_date,'yyyymm') = ${@base_period}"/>-->
</bm:data-filters>
<bm:query-fields>
<bm:query-field name="contract_number" queryExpression="t1.contract_number = ${@contract_number}"/>
<bm:query-field name="bp_name" queryExpression="t1.bp_name = ${@bp_name}"/>
<!-- <bm:query-field name="journal_date" queryExpression="to_char(t1.journal_date,'yyyy-mm-dd') = ${@journal_date}"/>-->
<bm:query-field name="invoice_date" queryExpression="to_char(t1.invoice_date,'yyyy-mm-dd') = ${@invoice_date}"/>
<bm:query-field name="invoice_kind" queryExpression="t1.invoice_kind = ${@invoice_kind}"/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
$Author: zhuxianfei $Author: stone
$Date: 2018-12-24 下午2:20:47 $Date: 2020-04-16 下午2:20:47
$Revision: 1.0 $Revision: 1.0
$Purpose: $Purpose:
--> -->
...@@ -9,26 +9,71 @@ ...@@ -9,26 +9,71 @@
<a:view> <a:view>
<a:link id="con_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" <a:link id="con_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/> modelaction="update"/>
<a:link id="process_vat_account_data_link" model="rpt.RPT555.con_je_vat_total_query" modelaction="update"/>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
window['${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) { // stopDymanicAutoQuery('${/parameter/@layout_code}', 'G_SUM_RESULT', 'con_contract');
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
var form_ds_id = '${/parameter/@layout_code}_F_QUERY__ds'; var form_ds_id = '${/parameter/@layout_code}_F_QUERY__ds';
if(ds.id == form_ds_id){ if(ds.id==form_ds_id) {
record.set('base_period',new Date().format('yyyymm').toString()); if (name == 'base_period') {
record.set('base_period_n',new Date().format('yyyy-mm').toString()); if (value != old_value) {
var detail_mask = Ext.getBody();
var base_peroids = $(form_ds_id).getAt(0).get('base_period');
Leaf.Masker.mask(detail_mask, '正在查询中。。。');
Leaf.request({
url: $('process_vat_account_data_link').getUrl(),
para: {
base_period: base_peroids,
tmp_date: new Date()
},
success: function () {
Leaf.Masker.unmask(detail_mask);
},
failure: function () {
Leaf.Masker.unmask(detail_mask);
},
error: function () {
Leaf.Masker.unmask(detail_mask);
},
scope: this
});
}
}
} }
}; };
// window['${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
// var form_ds_id = '${/parameter/@layout_code}_F_QUERY__ds';
// if(ds.id == form_ds_id){
// record.set('base_period',new Date().format('yyyymm').toString());
// record.set('base_period_n',new Date().format('yyyy-mm').toString());
//
// }
// };
//查询时调用 //查询时调用
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) { window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
var grid_ds_id_before= get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BEFORE_RESULT', 'con_contract'); var form_ds_id = '${/parameter/@layout_code}_F_QUERY__ds';
var grid_ds_id_current= get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_CURRENT_RESULT', 'con_contract'); if($(form_ds_id).getAt(0).get('base_period')){
//debugger var grid_ds_id_before= get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BEFORE_RESULT', 'con_contract');
if(ds.id==grid_ds_id_before){ var grid_ds_id_current= get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_CURRENT_RESULT', 'con_contract');
ds.setQueryUrl('${/request/@context_path}/autocrud/rpt.RPT555.con_je_vat_query/query'); var grid_ds_id_total= get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SUM_RESULT', 'con_contract');
}else if(ds.id==grid_ds_id_current){ if(ds.id==grid_ds_id_before){
ds.setQueryUrl('${/request/@context_path}/autocrud/rpt.RPT555.con_je_vat_current_query/query'); ds.setQueryUrl('${/request/@context_path}/autocrud/rpt.RPT555.con_je_vat_query/query');
} }else if(ds.id==grid_ds_id_current){
ds.setQueryUrl('${/request/@context_path}/autocrud/rpt.RPT555.con_je_vat_current_query/query');
}else if(ds.id==grid_ds_id_total) {
//先进行数据的处理
ds.setQueryUrl('${/request/@context_path}/autocrud/rpt.RPT555.con_je_vat_total_query/query');
}
}else{
// $L.showInfoMessage("提示",'基准期间不能为空');
return;
}
}; };
]]></script> ]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
......
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