영수증 삭제 및 일일 개수 추가
This commit is contained in:
@@ -27,27 +27,6 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getRecordExistTypeCount">
|
||||
select count(1) as count,
|
||||
ds.input_type,
|
||||
rhr.file_id,
|
||||
COALESCE(fc.file_id_count, 0) as file_id_count
|
||||
from daily_expense ds
|
||||
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||
left join
|
||||
receipt_has_record rhr on ds.id = rhr.receipt_type_id and rhr.is_deleted = false
|
||||
left join (
|
||||
select file_id,COUNT(*) AS file_id_count
|
||||
FROM receipt_has_record
|
||||
where is_deleted = false and type = 'EXPENSE'
|
||||
group by file_id
|
||||
) fc on fc.file_id = rhr.file_id
|
||||
where ds.is_deleted = false
|
||||
<if test="id != null and id != '0'">
|
||||
and ds.id = #{id}
|
||||
</if>
|
||||
group by ds.id,rhr.file_id,fc.file_id_count
|
||||
</select>
|
||||
<insert id="createDailyExpense" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into daily_expense (
|
||||
daily_record_seq, input_type, category, income_mark
|
||||
@@ -94,8 +73,9 @@
|
||||
update receipt_has_record set
|
||||
<include refid="common.fields.DeleteBaseSet"/>
|
||||
where is_deleted = false
|
||||
and type = 'EXPENSE'
|
||||
<if test="id != null and id != ''">
|
||||
and receipt_type_id = #{id}
|
||||
and receipt_type_id = #{id}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
|
||||
@@ -27,30 +27,6 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getRecordExistTypeCount">
|
||||
select count(1) as count,
|
||||
ds.input_type,
|
||||
rhr.file_id,
|
||||
COALESCE(fc.file_id_count, 0) as file_id_count
|
||||
from daily_income ds
|
||||
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||
left join
|
||||
receipt_has_record rhr on ds.id = rhr.receipt_type_id and rhr.is_deleted = false
|
||||
left join (
|
||||
select file_id,COUNT(*) AS file_id_count
|
||||
FROM receipt_has_record
|
||||
where is_deleted = false and type = 'INCOME'
|
||||
group by file_id
|
||||
) fc on fc.file_id = rhr.file_id
|
||||
where ds.is_deleted = false
|
||||
<if test="id != null and id != '0'">
|
||||
and ds.id = #{id}
|
||||
</if>
|
||||
group by ds.id,rhr.file_id,fc.file_id_count
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into daily_income (
|
||||
daily_record_seq, input_type, category, expense_mark
|
||||
@@ -98,8 +74,9 @@
|
||||
update receipt_has_record set
|
||||
<include refid="common.fields.DeleteBaseSet"/>
|
||||
where is_deleted = false
|
||||
and type = 'INCOME'
|
||||
<if test="id != null and id != ''">
|
||||
and receipt_type_id = #{id}
|
||||
and receipt_type_id = #{id}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
|
||||
@@ -17,4 +17,12 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="selectReceiptCount">
|
||||
select count(*)
|
||||
from receipt_has_record
|
||||
where created_by = #{userId}
|
||||
and created_at = CURRENT_DATE
|
||||
and type = #{inputType}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -206,6 +206,7 @@
|
||||
<!--/* 영수증 등록 s */-->
|
||||
<div id="modelOcr" style="display: none;">
|
||||
<section class="form-group">
|
||||
<input type="hidden" id="countOcr"/>
|
||||
<div class="segment-label">
|
||||
<p class="label-txt">
|
||||
영수증 첨부
|
||||
|
||||
@@ -248,10 +248,36 @@
|
||||
$('#modelOcr').hide();
|
||||
$('#btnOcr').removeClass('active');
|
||||
} else {
|
||||
$('#modelSelf').hide();
|
||||
$('#btnSelf').removeClass('active');
|
||||
$('#modelOcr').show();
|
||||
$('#btnOcr').addClass('active');
|
||||
ajaxUtil._ajaxSyncMethod(
|
||||
'/api/record/receipt/INCOME/count',
|
||||
{},
|
||||
(response) => { // 성공
|
||||
if(response < 3) {
|
||||
debugger
|
||||
$('#modelSelf').hide();
|
||||
$('#btnSelf').removeClass('active');
|
||||
$('#modelOcr').show();
|
||||
$('#btnOcr').addClass('active');
|
||||
$('#countOcr').val(response);
|
||||
}else{
|
||||
etUI.dialog.alert({
|
||||
title: '',
|
||||
message: '영수증은 일일 최대 3개 등록 가능합니다.',
|
||||
type: 'alert',
|
||||
callback: function () {
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
function (code, rstData) { // 실패
|
||||
console.log("error : ", code);
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
createVaild() {
|
||||
@@ -272,9 +298,17 @@
|
||||
);
|
||||
},
|
||||
addFileInput() {
|
||||
// 여기에서 파일 첨부 몇개인지 확인하고 하루 3개,,,, 총 6개씩,,,
|
||||
|
||||
|
||||
const countOcr = $('#countOcr').val();
|
||||
if(uploadedReceipt.length === 3 - countOcr ){
|
||||
etUI.dialog.alert({
|
||||
title: '',
|
||||
message: '영수증은 일일 최대 3개 등록 가능합니다.',
|
||||
type: 'alert',
|
||||
callback: function () {
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const fileInput = document.createElement('input');
|
||||
fileInput.type = 'file';
|
||||
@@ -385,8 +419,8 @@
|
||||
const receiptDataList = uploadedReceipt;
|
||||
if (!receiptDataList.length) {
|
||||
etUI.dialog.alert({
|
||||
title: '등록 실패',
|
||||
message: '등록할 영수증 데이터가 없습니다.',
|
||||
title: '',
|
||||
message: '최소 1개의 영수증을 등록해주셔야 합니다.',
|
||||
type: 'alert',
|
||||
callback: function () {
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user