1169 lines
42 KiB
Plaintext
1169 lines
42 KiB
Plaintext
<!-- #include virtual = "include/header.asp" -->
|
|
<!-- #include virtual = "include/left.asp" -->
|
|
<%
|
|
dim tmpstr
|
|
dim Query
|
|
dim i
|
|
dim user_name(4) '현재 사용자,0:사원코드, 1:이름,2:직급,3:전화번호, 4:부서코드(명)
|
|
dim Max_Width
|
|
dim title
|
|
dim target_name '발급대상자 이름
|
|
dim Curr_date '오늘날짜
|
|
dim Company(6)
|
|
dim cnt
|
|
dim Gap(21) '1:프로젝트 코드, 2:지출목적, 3:지출일자, 4:지출방법, 5:공급가액, 6:부가세액, 7:총액, 8:거래처, 9:프로젝트코드, 10:품의서 문서번호
|
|
' 11:직접비예산, 12:누적집행금액, 13:차액, 14::추가 사유, 21::지급일자
|
|
dim krc_no
|
|
dim pay_type(5)
|
|
dim db_table_name
|
|
dim title_type
|
|
dim p_depart
|
|
dim hangmok, sebu, p_method_nm
|
|
dim del_reason
|
|
del_reason = ""
|
|
|
|
db_table_name = "문서내용"
|
|
title="지 출 결 의 서"
|
|
title_type = mid(replace(title," ",""), 1, 2)
|
|
|
|
Max_Width =650
|
|
Curr_date = year(date) & "년 " & month(date) & "월 " & day(date) & "일"
|
|
|
|
pay_type(1) = "카드/현금"
|
|
pay_type(2) = "세금계산서"
|
|
pay_type(3) = "인보이스"
|
|
pay_type(4) = "인건비"
|
|
'''''과거 지난기록 가져오기
|
|
krc_no=request("krc_no")
|
|
if krc_no <> "" then
|
|
query = "select * from " & db_table_name
|
|
query = query & " where 문서번호 = '" & krc_no & "'"
|
|
adors.open query, adoconn, adopenstatic, adlockreadonly
|
|
gap(1) = adors("target1")
|
|
gap(2) = ViewWord(adors("target2"))
|
|
gap(3) = adors("target3")
|
|
gap(4) = adors("target4")
|
|
gap(5) = adors("target5")
|
|
gap(6) = adors("target6")
|
|
gap(7) = adors("target7")
|
|
gap(8) = adors("target8")
|
|
gap(9) = adors("p_sn")
|
|
gap(10) = adors("target9")
|
|
hangmok = adors("target11")
|
|
sebu = adors("target12")
|
|
gap(11) = adors("target13")
|
|
gap(12) = adors("target14")
|
|
gap(13) = adors("target15")
|
|
gap(14) = ViewWord(adors("target17"))
|
|
gap(15) = adors("target16")
|
|
gap(16) = adors("target18")
|
|
if adors("target19") <> "" Then
|
|
gap(17) = Split(adors("target19"), "|")(0)
|
|
gap(18) = Split(adors("target19"), "|")(1)
|
|
gap(19) = Split(adors("target19"), "|")(2)
|
|
End If
|
|
gap(20) = adors("remark20")
|
|
gap(21) = adors("remark19")
|
|
|
|
del_reason = adors("del_reason")
|
|
|
|
if adors("문서제목") = "지출결의서" then
|
|
title="지 출 결 의 서"
|
|
title_type = mid(replace(title," ",""), 1, 2)
|
|
end If
|
|
|
|
adoRs.close
|
|
end if
|
|
|
|
p_sn = request("p_sn")
|
|
p_child_sn = request("p_child_sn")
|
|
|
|
if p_sn <> "" then
|
|
query = " SELECT TOP 1 p_subject, p_method_nm "
|
|
query = query & " FROM V_PROJECT_METHOD "
|
|
query = query & " WHERE p_sn = '"&p_sn&"' "
|
|
if p_child_sn <> "" then
|
|
query = query & " AND p_child_sn = '" & p_child_sn & "' "
|
|
end if
|
|
adoRs.open Query, adoconn,1
|
|
|
|
' response.Write "Query : " & query & "<BR>"
|
|
p_subject = adors("p_subject")
|
|
p_method_nm = adors("p_method_nm")
|
|
adors.close
|
|
end if
|
|
|
|
''//===============
|
|
''회사 회사명, 사업자등록번호, 대표자명, 주소 가져오기
|
|
Query = "select * from company"
|
|
adoRs.open Query, adoconn,adopenstatic, adlockreadonly
|
|
Company(1) = adors("com_name")
|
|
Company(2) = adors("사업자등록번호")
|
|
Company(3) = adors("대표자명")
|
|
Company(4) = adors("주소")
|
|
Company(5) = adors("법인등록번호")
|
|
Company(6) = adors("회사대표전화번호")
|
|
adoRs.close
|
|
|
|
''///===============
|
|
''로그인 사용자 정보
|
|
user_name(0) = Session("User_Number")
|
|
Query = "SELECT p_name, p_team_name, p_rank_name, p_tel3 FROM project2.dbo.V_Person WHERE p_no = '" & user_name(0) & "'"
|
|
adoRs.open Query, adoconn,adopenstatic, adlockreadonly
|
|
user_name(1) = adoRs("p_name") '이름
|
|
user_name(2) = adoRs("p_rank_name") '직위 코드
|
|
user_name(3) = adoRs("p_tel3") '직통 전화
|
|
user_name(4) = adoRs("p_team_name") '부서코드
|
|
adoRs.close
|
|
|
|
|
|
p_depart = Session("Depart_Code")
|
|
|
|
if (p_depart = 0) or (p_depart >= 20 and p_depart <= 95) then
|
|
d_cost_type = "research"
|
|
ElseIf p_depart = 17 Then
|
|
d_cost_type = "dp"
|
|
ElseIf p_depart = 18 Then
|
|
d_cost_type = "support"
|
|
ElseIf p_depart = 19 Then
|
|
d_cost_type = "support"
|
|
else
|
|
d_cost_type = "field"
|
|
end if
|
|
|
|
'response.write "d_cost_type : " & d_cost_type & "<br>"
|
|
%>
|
|
|
|
<div class="content-wrapper">
|
|
<style>
|
|
.imgPreviewItem{
|
|
width:20%;
|
|
height:150px;
|
|
border: 1px solid #ccc;
|
|
box-shadow: 1px 1px 2px 1px #b9b9b9;
|
|
justify-content: center;
|
|
align-items: center;
|
|
cursor:pointer;
|
|
}
|
|
.imgPreviewItem > img{
|
|
max-height: 100%;
|
|
max-width: 100%;
|
|
}
|
|
.popover{
|
|
max-width:none;
|
|
}
|
|
.imgView{
|
|
max-height: 800px;
|
|
max-width: 800px;
|
|
}
|
|
.blink {
|
|
-webkit-animation: blink 0.3s linear infinite;
|
|
}
|
|
@keyframes blink {
|
|
/*0% 부터 100% 까지*/
|
|
0% { color:#C25E5E; border-color:#9DED85; }
|
|
5% { color:#C05683; border-color:#2DDAA7; }
|
|
10% { color:#A45EAA; border-color:#00C2C3; }
|
|
15% { color:#656EC9; border-color:#00A5CE; }
|
|
20% { color:#007CD3; border-color:#0085C1; }
|
|
25% { color:#0085C1; border-color:#007CD3; }
|
|
30% { color:#00A5CE; border-color:#656EC9; }
|
|
35% { color:#00C2C3; border-color:#A45EAA; }
|
|
40% { color:#2DDAA7; border-color:#C05683; }
|
|
55% { color:#9DED85; border-color:#C05683; }
|
|
60% { color:#2DDAA7; border-color:#A45EAA; }
|
|
65% { color:#00C2C3; border-color:#656EC9; }
|
|
70% { color:#00A5CE; border-color:#007CD3; }
|
|
75% { color:#0085C1; border-color:#0085C1; }
|
|
80% { color:#007CD3; border-color:#00A5CE; }
|
|
85% { color:#656EC9; border-color:#00C2C3; }
|
|
100% { color:#A45EAA; border-color:#2DDAA7; }
|
|
/*from부터 to 까지
|
|
from {color:#00a0e9;}
|
|
to {color:#000;}
|
|
*/
|
|
}
|
|
.attach_file_preview{
|
|
display:flex;
|
|
flex-direction:column;
|
|
justify-content:center;
|
|
align-items:center;
|
|
width:100%;
|
|
overflow:hidden;
|
|
padding:10px;
|
|
box-sizing:border-box;
|
|
text-align:center;
|
|
}
|
|
.attach_file_ext{
|
|
font-weight:bold;
|
|
color:#666;
|
|
font-size:14px;
|
|
}
|
|
.attach_file_name{
|
|
display:block;
|
|
max-width:100%;
|
|
overflow:hidden;
|
|
text-overflow:ellipsis;
|
|
white-space:nowrap;
|
|
font-size:11px;
|
|
color:#333;
|
|
}
|
|
.attach_upload_loading{
|
|
display:none;
|
|
position:fixed;
|
|
top:0;left:0;right:0;bottom:0;
|
|
background:rgba(255,255,255,0.7);
|
|
z-index:10000;
|
|
flex-direction:column;
|
|
justify-content:center;
|
|
align-items:center;
|
|
}
|
|
.attach_upload_loading.active{
|
|
display:flex;
|
|
}
|
|
.attach_upload_spinner{
|
|
width:50px;
|
|
height:50px;
|
|
border:5px solid #ccc;
|
|
border-top:5px solid #333;
|
|
border-radius:50%;
|
|
animation:attach_spin 1s linear infinite;
|
|
}
|
|
@keyframes attach_spin{
|
|
0%{ transform:rotate(0deg); }
|
|
100%{ transform:rotate(360deg); }
|
|
}
|
|
.attach_upload_text{
|
|
margin-top:10px;
|
|
font-size:14px;
|
|
color:#333;
|
|
}
|
|
</style>
|
|
<!-- Content Wrapper. Contains page content -->
|
|
<!-- Content Header (Page header) -->
|
|
<div class="content-header">
|
|
<h1>문서 작성</h1>
|
|
</div>
|
|
<!-- /.content-header -->
|
|
<!-- Main content -->
|
|
<div class="content-body">
|
|
<div class="content">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<form method='post' name='frm_money' enctype='multipart/form-data'>
|
|
<input type="hidden" name="title_type" value='<%=title_type%>' >
|
|
<input type="hidden" name="d_cost_type" value='<%=d_cost_type%>' >
|
|
<input type="hidden" name="krc_no" value='<%=krc_no%>'>
|
|
<input type="hidden" name="k_company" value=''>
|
|
<input type="hidden" name="d_krc_no" value=''>
|
|
<input type="hidden" name="print_type" value='1'>
|
|
<input type="hidden" name="expence_taxtype" value=''>
|
|
<input type="hidden" name="expence_item" value=''>
|
|
<div style="position: absolute; left: 680px; top: 100px; z-index: 10;display:none;" id="del_reason_div">
|
|
<table border="0" cellspacing="0" cellpadding="5" width="270" bgcolor="#AAFA82">
|
|
<tr align="center" height="35">
|
|
<td>
|
|
<< 반려자가 남긴 사유 >>
|
|
</td>
|
|
</tr>
|
|
<tr align="center" height="35">
|
|
<td>
|
|
<textarea name="del_reason" cols="42" rows="5" readonly class="tahoma"><%=ViewWord(del_reason)%></textarea>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<table width="800px" cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class='py-2'>
|
|
<font class="brown"><%=title_type%>결의서 작성페이지입니다. 프로젝트명에 특수문자를 사용하실 수 없습니다.</font>
|
|
<button type="button" class="float-right blink" onclick="window.open('/approval/pdf/220929_세금계산서 지출결의서 작성안내(최종).pdf')"><i class="fas fa-question"></i></button>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" style="padding:10;border-left:1px solid #dedede;border-right:1px solid #dedede;">
|
|
<table class="table table-sm table-sm2 table-bordered table-head tr-colors">
|
|
<tr height="24">
|
|
<td align="center" colspan="4" style="font-size:12px;">하기의 프로젝트(업무)와 관련하여 <%=title_type%>을 결의하오니 승인하여 주시기 바랍니다. </td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" align="center" >프로젝트 명</td>
|
|
<td colspan="3" width="35%" >
|
|
<input type="text" class="align-middle" style="width:calc(100% - 45px);" name="p_subject" id="Text1" value='<%=p_subject%>' readonly>
|
|
<button type="button" class="btn btn-sm btn-default align-middle" onclick="winnewoepn('txt_prj_name','txt_p_sn');"><i class="fas fa-search"></i></button>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="15%" align="center" >프로젝트 번호</td>
|
|
<td width="35%" >
|
|
<input type="text" class="gray" style="width:210;" name="p_sn" id="p_sn" value='<%=p_sn%>' readonly />
|
|
</td>
|
|
<td width="15%" align="center" >조사 방법</td>
|
|
<td width="35%" colspan="3">
|
|
<input type="hidden" class="gray" style="width:210;" id="p_child_sn" name="p_child_sn" value="" />
|
|
<input type="text" class="gray" style="width:210;" id="p_method_nm" name="p_method_nm" value="" readonly/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" align="center" >비용항목</td>
|
|
<td width="35%" >
|
|
<select name="hangmok" id="hangmok" tabindex="4" ><!--== 비용항목 ==-->
|
|
</select>
|
|
<% If d_cost_type = "dp" Or d_cost_type = "support" Then%>
|
|
<select id="changeHang"><!--== 비용항목 ==-->
|
|
<option value="">항목변경</option>
|
|
<option value="support">운영</option>
|
|
<option value="research">연구</option>
|
|
<option value="field">실사</option>
|
|
</select>
|
|
<% End If %>
|
|
</td>
|
|
<td width="15%" align="center" >세부내용</td>
|
|
<td width="35%" >
|
|
<select name="sebu" id="sebu" tabindex="4"><!--== 세부내용 ==-->
|
|
</select>
|
|
<label class="ml-2 d-none" for="boolgong"><input type="checkbox" id="boolgong" /> 불공여부</label>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="15%" align="center" >증빙일자</td>
|
|
<td width="35%" >
|
|
<input type="text" class="selectDate" style="width:150;text-align:right;cursor:pointer;" name="expence_date" id="expence_date" value="" readonly>
|
|
</td>
|
|
<td width="15%" align="center" >증빙서류</td>
|
|
<td width="35%" >
|
|
<select name="expence_way" id="expence_way" tabindex="4" onchange="bugaNoChange()">
|
|
<%for i=1 to 4%>
|
|
<% if pay_type(i) <> "" Then %>
|
|
<option value="<%=pay_type(i)%>"><%=pay_type(i)%></option>
|
|
<% End If %>
|
|
<%next%>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" align="center" >공급가액</td>
|
|
<td width="35%" >
|
|
<input type="text" id="val_supply" class="gray" style="width:150;text-align:right;" OnKeyup="OnlyNumber(this);check_comma(this.value,'1');" name="expence_money" value=''> 원
|
|
</td>
|
|
<td width="15%" align="center" class='expence_sum_td' rowspan="2"><%=title_type%>총액</td>
|
|
<td width="35%" rowspan="2" class='expence_sum_td'>
|
|
<input type="text" class="gray" style="width:150;text-align:right;" name="expence_sum" id="expence_sum" readonly value=''> 원
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" align="center" >부가세액</td>
|
|
<td width="35%" >
|
|
<input type="text" class="gray" style="width:150;text-align:right;" OnKeyup="OnlyNumber(this);check_comma(this.value,'2');" name="expence_vat" id="expence_vat" value='0' readonly> 원
|
|
</td>
|
|
<td width="15%" align="center" class='expence_num_td d-none'>증빙번호</td>
|
|
<td width="35%" class='expence_num_td d-none'>
|
|
<input type="text" class="gray" style="width:150;text-align:left;" name="expence_num" id="expence_num" value='' readonly />
|
|
<button type="button" id="taxBtn" class="btn btn-primary btn-sm py-0 border-0" style="height: 21px;margin-top: -3px;"><i class="fas fa-search"></i></button>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" align="center" >거래처</td>
|
|
<td width="35%" >
|
|
<input type="text" class="gray" style="width:100%;" name="expence_company" value='<%=gap(8)%>'>
|
|
<input type="hidden" name="expence_company_num" value=''>
|
|
</td>
|
|
<td width="15%" align="center" >입금계좌</td>
|
|
<td width="35%" >첨부파일 참조</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" align="center" valign="middle">지급일자</td>
|
|
<td>
|
|
<input type="text" class="selectPaymentDate" style="width:150;text-align:right;cursor:pointer;" name="payment_date" id="payment_date" value="" readonly>
|
|
</td>
|
|
<td width="15%" align="left" colspan="3" style="color:royalblue;">* 지급일자는 회사의 비용 지급 기준에 맞춰 작성(월별 비용 마감 안내 메일 확인)<br>
|
|
예외적으로 지급일자 변경이 필요한 경우 비고란에 사유 기재</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" align="center" class="align-middle">증빙첨부</td>
|
|
<td colspan="3">
|
|
<button type="button" class="btn btn-sm btn-primary" onclick="addDocAttach();">추가</button>
|
|
<input type="file" accept="image/*,.zip,.pdf,.hwp,.doc,.docx,.xls,.xlsx,.ppt,.pptx" id="doc_attach" multiple="multiple" class="d-none"/>
|
|
<input type="file" name="doc_attach" multiple="multiple" class="d-none" />
|
|
</td>
|
|
</tr>
|
|
<tr id="imgPreviews" style="display:none;">
|
|
<td colspan="4">
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr id="expenseTotal">
|
|
<td>
|
|
<table class="table table-sm table-sm2 table-bordered tr-colors border-top">
|
|
<tr height="30px;">
|
|
<td align="center" >비용항목</td>
|
|
<td align="center" >직접비예산</td>
|
|
<td align="center" >누적집행금액</td>
|
|
<td align="center" >지출금액(VAT 별도)</td>
|
|
<td align="center" >차액</td>
|
|
<td align="center" class="tit_left tit_right">비고</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" >
|
|
<input type="text" name="hangmok_list" id="hangmok_list" style="width:100px;" value="" readonly>
|
|
</td>
|
|
<td align="center" >
|
|
<input type="text" name="est" id="est" style="width:100px;text-align:right;" value="" readonly> 원
|
|
</td>
|
|
<td align="center" >
|
|
<input type="text" name="act_sum" id="act_sum" style="width:100px;text-align:right;" value="" readonly> 원
|
|
</td>
|
|
<td align="center" >
|
|
<input type="text" name="expence_money_list" id="expence_money_list" style="width:100px;text-align:right;" value="" readonly> 원
|
|
</td>
|
|
<td align="center" >
|
|
<input type="text" name="gab_cha" id="gab_cha" style="width:100px;text-align:right;" value="" readonly> 원
|
|
</td>
|
|
<td align="center" >
|
|
<input type="text" name="memo" id="memo" style="width:100px;" value="" readonly>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<table class="table table-sm table-sm2 table-bordered tr-colors border-top">
|
|
<tr>
|
|
<td align="center" class="align-middle" width="15%">사용내역(상세내역 작성필수)</td>
|
|
<td align="center" >
|
|
<TEXTAREA rows="5" cols="80" name="expence_reason" id="expence_reason" style="width:100%;height:80;"></TEXTAREA>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<table id="minus_expence" class="table table-sm table-sm2 table-bordered tr-colors border-top" style="display:none;">
|
|
<tr>
|
|
<td align="center" class="align-middle" width="15%">추가 사유</td>
|
|
<td align="center" >
|
|
<TEXTAREA rows="5" cols="80" name="minus_expence_reason" id="minus_expence_reason" style="width:100%;height:80;"></TEXTAREA>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr <% If krc_no <> "" and p_child_sn = "" then%> style="display:none;" <% End If %>>
|
|
<td style="padding:10 0 0 0;" align="center">
|
|
<button type="button" class="btn btn-primary" onclick="goPrint();">입력하기</button>
|
|
<button type="button" class="btn btn-info" onclick="history.back(-1);">취소하기</button>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<div id="dupNumDialog" style="display:none;">
|
|
<table class="table table-sm table-sm2 table-bordered table-head tr-colors">
|
|
<thead>
|
|
<tr>
|
|
<td class='text-center align-middle'>문서번호</td>
|
|
<td class='text-center align-middle'>프로젝트코드</td>
|
|
<td class='text-center align-middle'>프로젝트명</td>
|
|
<td class='text-center align-middle'>공급가액</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</form>
|
|
<canvas id="pdf-canvas" width="400" class="d-none"></canvas>
|
|
<div class="attach_upload_loading" id="attachUploadLoading">
|
|
<div class="attach_upload_spinner"></div>
|
|
<div class="attach_upload_text">업로드 중입니다...</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- /.content -->
|
|
<!-- REQUIRED SCRIPTS -->
|
|
<script>
|
|
var dupListLength = 0;
|
|
var dupNumDialog = $("#dupNumDialog").dialog({
|
|
autoOpen: false,
|
|
modal: true,
|
|
resizable: false,
|
|
height: 420,
|
|
width: 840,
|
|
title: '중복 증빙 번호 목록'
|
|
});
|
|
|
|
dupNumDialog.dialog("option", "position", {
|
|
my: 'center',
|
|
at: 'center',
|
|
of: window
|
|
});
|
|
|
|
var fileArray = [];
|
|
var ajaxRes = null;
|
|
var AmountTotal = 0;
|
|
var TaxTotal = 0;
|
|
var TotalAmount = 0;
|
|
var MaxAmountTotal = 0;
|
|
var MaxTaxTotal = 0;
|
|
function winnewoepn(actval,actval2){
|
|
var url = "/project_list/project_list_2014.asp";
|
|
url = url + "?d_cost_type=" + document.frm_money.d_cost_type.value;
|
|
|
|
window.open(url,"wins","left=50, top=50, menubar=no, location=no, status=no, toolbar=no, width=850, height=600, scrollbars=yes ,resizable=no");
|
|
}
|
|
|
|
function goPrint() {//프린트 하기
|
|
var vat_check_boolean = vat_check();
|
|
if (vat_check_boolean == false) {
|
|
alert("부가세를 다시 검토하세요.");
|
|
return false;
|
|
}
|
|
var p_subject = document.frm_money.p_subject.value;
|
|
p_subject = p_subject.replace(/&/gi, '@NPER@');
|
|
|
|
var hangmok = document.frm_money.hangmok.value;
|
|
var sebu = document.frm_money.sebu.value;
|
|
var expence_date = document.frm_money.expence_date.value;
|
|
var expence_way = document.frm_money.expence_way.value;
|
|
var expence_money = document.frm_money.expence_money.value;
|
|
var expence_sum = document.frm_money.expence_sum.value;
|
|
var expence_vat = document.frm_money.expence_vat.value;
|
|
var expence_num = document.frm_money.expence_num.value;
|
|
var expence_company = document.frm_money.expence_company.value;
|
|
var expence_reason = document.frm_money.expence_reason.value;
|
|
|
|
var est = document.frm_money.est.value;
|
|
var act_sum = document.frm_money.act_sum.value;
|
|
var gab_cha = document.frm_money.gab_cha.value;
|
|
var minus_expence_reason = document.frm_money.minus_expence_reason.value;
|
|
|
|
var p_sn = document.frm_money.p_sn.value;
|
|
var title_type = document.frm_money.title_type.value;
|
|
|
|
var d_cost_type = ($("#changeHang option:selected").val() || "") != "" ? $("#changeHang option:selected").val() : document.frm_money.d_cost_type.value;
|
|
|
|
var krc_no = document.frm_money.krc_no.value;
|
|
var payment_date = document.frm_money.payment_date.value;
|
|
|
|
if (p_sn.substring(0, 4) != '9999') {
|
|
if (p_subject == "") {
|
|
alert("프로젝트를 선택하십시오!");
|
|
return;
|
|
} else if (hangmok == "") {
|
|
alert("항목을 선택하세요!");
|
|
return;
|
|
} else if (sebu == "") {
|
|
alert("세부내용을 선택하세요!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
if (expence_money == "") {
|
|
alert("공급가액을 입력하세요!");
|
|
return;
|
|
} else if (expence_company == "") {
|
|
alert("거래처를 입력하세요!");
|
|
return;
|
|
} else if (expence_date == "") {
|
|
alert("증빙일자를 입력하세요!");
|
|
return;
|
|
}
|
|
|
|
if (gab_cha.replace(/,/gi, "") < 0 && !document.frm_money.minus_expence_reason.value.replace(/(^\s*)|(\s*$)/gi, "")) {
|
|
alert("차액이 - 입니다. 차액의 사유를 추가사유란에 반드시 적어주시기 바랍니다.");
|
|
return;
|
|
}
|
|
|
|
if(expence_way == "세금계산서"){
|
|
if(MaxAmountTotal < +(expence_money.replace(/,/gi, ''))){
|
|
alert("입력가능한 공급가액을 초과하였습니다.\n"+commify(MaxAmountTotal)+" 원 이하로 입력해주세요");
|
|
return;
|
|
}
|
|
if(MaxTaxTotal < +(expence_vat.replace(/,/gi, ''))){
|
|
alert("입력가능한 부가세액을 초과하였습니다.\n"+commify(MaxTaxTotal)+" 원 이하로 입력해주세요");
|
|
return;
|
|
}
|
|
}
|
|
|
|
for (var i=0;i<expence_reason.length;i++)
|
|
{
|
|
var uniCode = expence_reason.charCodeAt(i);
|
|
if(uniCode == 13 && expence_reason.charCodeAt(i+1) == 10){
|
|
expence_reason = expence_reason.replace(expence_reason.charAt(i)+expence_reason.charAt(i+1),"<br>");
|
|
}
|
|
}
|
|
if (expence_reason.indexOf("#") > -1 || expence_reason.indexOf("$") > -1 || expence_reason.indexOf("%") > -1 ||
|
|
expence_reason.indexOf("&") > -1 || expence_reason.indexOf("\"") > -1 || expence_reason.indexOf("'") > -1) {
|
|
alert("특수 문자를 입력하면 안됩니다. (#,$,%,&,',\")를 제거하고 다시 작성해주세요");
|
|
return false;
|
|
}
|
|
|
|
var agt = navigator.userAgent.toLowerCase();
|
|
var txt = expence_reason;
|
|
|
|
for (var i = 0; i < txt.length; i++) {
|
|
var uniCode = txt.charCodeAt(i);
|
|
if (agt.indexOf("msie") != -1) {
|
|
if ((uniCode == 13 && txt.charCodeAt(i + 1) == 10)) {
|
|
txt = txt.replace(txt.charAt(i) + txt.charAt(i + 1), "<br>");
|
|
}
|
|
} else if (agt.indexOf("chrome") != -1) {
|
|
if (uniCode == 10) {
|
|
txt = txt.replace(txt.charAt(i), "<br>");
|
|
}
|
|
}
|
|
}
|
|
|
|
expence_reason = txt;
|
|
|
|
var txt = minus_expence_reason;
|
|
for (var i = 0; i < txt.length; i++) {
|
|
var uniCode = txt.charCodeAt(i);
|
|
if (agt.indexOf("msie") != -1) {
|
|
if ((uniCode == 13 && txt.charCodeAt(i + 1) == 10)) {
|
|
txt = txt.replace(txt.charAt(i) + txt.charAt(i + 1), "<br>");
|
|
}
|
|
} else if (agt.indexOf("chrome") != -1) {
|
|
if (uniCode == 10) {
|
|
txt = txt.replace(txt.charAt(i), "<br>");
|
|
}
|
|
}
|
|
}
|
|
|
|
minus_expence_reason = txt;
|
|
|
|
if(dupListLength > 0){
|
|
if(!confirm("동일한 증빙번호로 등록된 문서가 있습니다.\n그래도 등록하시겠습니까?")){
|
|
alert("취소되었습니다.");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
if (expence_way == "세금계산서" && expence_num == "") {
|
|
alert("지출방법이 세금계산서이므로 증빙번호를 입력하셔야 합니다. ");
|
|
return false;
|
|
}
|
|
if (expence_way == "인보이스" && expence_num == "") {
|
|
alert("지출방법이 인보이스이므로 증빙번호를 입력하셔야 합니다. ");
|
|
return false;
|
|
}
|
|
|
|
document.frm_money.p_subject.value = p_subject;
|
|
document.frm_money.d_cost_type.value = d_cost_type;
|
|
document.frm_money.hangmok.value = hangmok;
|
|
document.frm_money.sebu.value = sebu;
|
|
document.frm_money.expence_date.value = expence_date;
|
|
document.frm_money.expence_way.value = expence_way;
|
|
document.frm_money.expence_money.value = expence_money;
|
|
document.frm_money.expence_sum.value = expence_sum;
|
|
document.frm_money.expence_vat.value = expence_vat;
|
|
document.frm_money.expence_num.value = expence_num;
|
|
document.frm_money.expence_company.value = expence_company;
|
|
document.frm_money.expence_reason.value = expence_reason;
|
|
document.frm_money.est.value = est;
|
|
document.frm_money.act_sum.value = act_sum;
|
|
document.frm_money.gab_cha.value = gab_cha;
|
|
document.frm_money.p_sn.value = p_sn;
|
|
document.frm_money.title_type.value = title_type;
|
|
document.frm_money.minus_expence_reason.value = minus_expence_reason;
|
|
document.frm_money.d_krc_no.value = krc_no;
|
|
document.frm_money.payment_date.value = payment_date;
|
|
|
|
if($("#boolgong").prop("checked") == true){
|
|
$("input[name=expence_taxtype]").val("4");
|
|
}
|
|
|
|
var form = document.frm_money;
|
|
|
|
|
|
var fdt = new DataTransfer();
|
|
fileArray.forEach(function(f){
|
|
fdt.items.add(f);
|
|
});
|
|
$("input[name='doc_attach']")[0].files = fdt.files;
|
|
|
|
var url = "doc_expense_print_2014.asp";
|
|
window.open("" ,"doc_expense_print_2014","left=50 ,top=0, menubar=no, location=no ,status=no ,toolbar=no ,width=800, height=850 ,scrollbars=yes ,resizable=yes");
|
|
form.action =url;
|
|
form.method="post";
|
|
form.target = "doc_expense_print_2014";
|
|
form.submit();
|
|
}
|
|
|
|
|
|
function check_comma(txt,txt2) {
|
|
txt = allTrim(txt);
|
|
|
|
for(var i=0;i<txt.length;i++){
|
|
txt = txt.replace(',','')
|
|
txt = txt.replace(' ','')
|
|
}
|
|
|
|
if(eval(txt2)==1){
|
|
var d_cost_type = ($("#changeHang option:selected").val() || "") != "" ? $("#changeHang option:selected").val() : document.frm_money.d_cost_type.value;
|
|
document.frm_money.expence_money.value = allTrim(commify(txt));
|
|
$('#expence_money_list').val($("#val_supply").val());
|
|
if ($('#est').val() != "" && d_cost_type != "dp" && d_cost_type != "support") {
|
|
tmp_gab_cha = $('#est').val().replace(/,/gi, '') - $('#act_sum').val().replace(/,/gi, '') - $('#expence_money_list').val().replace(/,/gi, '');
|
|
document.frm_money.gab_cha.value = allTrim(commify(tmp_gab_cha));
|
|
if (tmp_gab_cha < 0) {
|
|
document.getElementById('minus_expence').style.display = "";
|
|
}
|
|
else {
|
|
document.getElementById('minus_expence').style.display = "none";
|
|
}
|
|
}
|
|
}else if(eval(txt2)==2){//#####부가세액
|
|
document.frm_money.expence_vat.value = allTrim(commify(txt));
|
|
}else if(eval(txt2)==3){//######직접비예산
|
|
document.frm_money.est.value = allTrim(commify(txt));
|
|
}else if(eval(txt2)==4){//######누적집행금액
|
|
document.frm_money.act_sum.value = allTrim(commify(txt));
|
|
}else if(eval(txt2)==5) {//######차액
|
|
document.frm_money.gab_cha.value = allTrim(commify(txt));
|
|
}
|
|
|
|
var expence_money = document.frm_money.expence_money.value;
|
|
var expence_vat = document.frm_money.expence_vat.value;
|
|
|
|
for(var i=0;i<expence_money.length;i++){
|
|
expence_money = expence_money.replace(',','')
|
|
expence_money = expence_money.replace(' ','')
|
|
}
|
|
for(var i=0;i<expence_vat.length;i++){
|
|
expence_vat = expence_vat.replace(',','')
|
|
expence_vat = expence_vat.replace(' ','')
|
|
}
|
|
|
|
if (expence_money == ""){
|
|
txt = expence_vat;
|
|
}else if(expence_vat == ""){
|
|
txt = expence_money;
|
|
}else{
|
|
txt = eval(expence_money) + eval(expence_vat);
|
|
}
|
|
document.frm_money.expence_sum.value = allTrim(commify(txt));
|
|
}
|
|
|
|
function hangmokchange(p_sn1, p_method_nm, p_child_sn) {
|
|
document.frm_money.p_sn.value = p_sn1;
|
|
|
|
if (p_sn1.substr(0, 4) != "9999") {
|
|
$("#p_child_sn").val(p_child_sn);
|
|
$("#p_method_nm").val(p_method_nm);
|
|
ajaxCallJsonTemp("doc_expense_ajax_dcost.asp", { command: "hangmok" }, null, "post", "hangmokreturnFunc()");
|
|
} else {
|
|
alert("일반 및 공통경비를 제외하고 선택하세요.");
|
|
}
|
|
}
|
|
|
|
function sebureturnFunc() {
|
|
$("#minus_expence_reason").val("");
|
|
$("#sebu option").remove();
|
|
$("#sebu").append(ajaxRes);
|
|
}
|
|
|
|
function hangmokreturnFunc() {
|
|
$("#hangmok option").remove();
|
|
$("#sebu option").remove();
|
|
$("#hangmok_list").val("");
|
|
$("#est").val("");
|
|
$("#act_sum").val("");
|
|
$("#expence_money_list").val("");
|
|
$("#gab_cha").val("");
|
|
$("#hangmok").append(ajaxRes);
|
|
$("#val_supply").trigger("keyup");
|
|
$("#expence_vat").trigger("keyup");
|
|
}
|
|
|
|
function moneyreturnFunc(type) {
|
|
if (type == '1') {
|
|
check_comma(ajaxRes, '3');
|
|
|
|
var p_child_sn = $("#p_child_sn").val();
|
|
|
|
if ($('#hangmok').val() == "49" || $('#hangmok').val() == "52" || $('#hangmok').val() == "55"){
|
|
//#####세부내용 기준
|
|
ajaxCallJsonTemp("doc_expense_ajax_dcost.asp", { command: "act", hangmok: $("#hangmok option:selected").val(), p_sn: document.frm_money.p_sn.value, p_child_sn: p_child_sn, sebu: $("#sebu option:selected").val() }, null, "post", "moneyreturnFunc(2)");
|
|
}else{
|
|
//#####비용항목 기준
|
|
ajaxCallJsonTemp("doc_expense_ajax_dcost.asp", { command: "act", hangmok: $("#hangmok option:selected").val(), p_sn: document.frm_money.p_sn.value, p_child_sn: p_child_sn, sebu: "" }, null, "post", "moneyreturnFunc(2)");
|
|
}
|
|
|
|
}else if(type == '2'){
|
|
if (ajaxRes != null) {
|
|
check_comma(ajaxRes,'4');
|
|
}else{
|
|
$('#act_sum').val('0');
|
|
}
|
|
if ($('#expence_money_list').val() != "") {
|
|
tmp_gab_cha = ($('#est').val().replace(/,/gi, '') - $('#act_sum').val().replace(/,/gi, '') - $('#expence_money_list').val().replace(/,/gi, ''));
|
|
check_comma(String(tmp_gab_cha),'5');
|
|
}
|
|
}
|
|
}
|
|
|
|
function bugaNoChange() {
|
|
if($("#expence_way").val() == "카드/현금" || $("#expence_way").val() == "인건비") {
|
|
$("#expence_sum").val($("#val_supply").val());
|
|
$("#boolgong").parent().addClass("d-none");
|
|
$("#boolgong").prop("checked", false);
|
|
$("#expence_num").val("");
|
|
$(".expence_num_td").addClass("d-none");
|
|
$(".expence_sum_td").attr("rowspan", "2");
|
|
}else if($("#expence_way").val() == "세금계산서") {
|
|
$("#boolgong").parent().removeClass("d-none");
|
|
$(".expence_num_td").removeClass("d-none");
|
|
$(".expence_sum_td").attr("rowspan", "1");
|
|
$("#expence_num").val("");
|
|
$("#expence_num").attr("readonly", true);
|
|
$("#taxBtn").removeClass("d-none");
|
|
}else if($("#expence_way").val() == "인보이스"){
|
|
$("#expence_sum").val($("#val_supply").val());
|
|
$("#boolgong").parent().addClass("d-none");
|
|
$("#boolgong").prop("checked", false);
|
|
$(".expence_num_td").removeClass("d-none");
|
|
$(".expence_sum_td").attr("rowspan", "1");
|
|
$("#expence_num").val("");
|
|
$("#expence_num").attr("readonly", false);
|
|
$("#taxBtn").addClass("d-none");
|
|
}
|
|
}
|
|
|
|
function ajaxCallJsonTemp(url, obj, target, method, func, exceptionfunc, errorfunc){
|
|
$.ajax({
|
|
url: url,
|
|
type: method,
|
|
data: obj,
|
|
async: false,
|
|
success: function(response, textStatus, jqXHR){
|
|
if(typeof response == "object"){
|
|
ajaxRes = response;
|
|
eval(func);
|
|
}else if(typeof response == "string"){
|
|
if(response == "success"){
|
|
eval(func);
|
|
}else if(response.length > 0){
|
|
ajaxRes = response;
|
|
eval(func);
|
|
}else{
|
|
if(errorfunc){
|
|
eval(errorfunc);
|
|
}else{
|
|
alert("exception...");
|
|
}
|
|
}
|
|
}
|
|
},error:function(){
|
|
alert("Web Service Error.");
|
|
}
|
|
});
|
|
}
|
|
|
|
$(function () {
|
|
currentMenu("/approval/doc_select.asp", "");
|
|
|
|
var d_cost_type = document.frm_money.d_cost_type.value;
|
|
if (d_cost_type == "support") {
|
|
$("#expenseTotal").css("display", "none");
|
|
}
|
|
$(".selectDate").datepicker();
|
|
$(".selectPaymentDate").datepicker();
|
|
|
|
// UI 깨짐 방지 (Chrome 자동 번역)
|
|
$('.ui-datepicker').addClass('notranslate');
|
|
|
|
//#####비용항목
|
|
$('#hangmok').on("change click", function () {
|
|
ajaxCallJsonTemp("doc_expense_ajax_dcost.asp", { command: "sebu", hangmok: $("#hangmok option:selected").val() }, null, "post", "sebureturnFunc()");
|
|
});
|
|
|
|
//#####세부내용
|
|
$('#sebu').on("change click", function () {
|
|
//#####연구팀이 아니면 조사방법에 따른 수행계획서 코드
|
|
var p_child_sn = $("#p_child_sn").val();
|
|
var d_cost_type = ($("#changeHang option:selected").val() || "") != "" ? $("#changeHang option:selected").val() : document.frm_money.d_cost_type.value;
|
|
if ($('#hangmok').val() == "49" || $('#hangmok').val() == "52" || $('#hangmok').val() == "55")
|
|
{
|
|
//#####세부내용 기준
|
|
$('#hangmok_list').val($("#sebu option:selected").text());
|
|
if (d_cost_type != "support") {
|
|
ajaxCallJsonTemp("doc_expense_ajax_dcost.asp", { command: "est", hangmok: $("#hangmok option:selected").val(), p_sn: document.frm_money.p_sn.value, p_child_sn: p_child_sn, sebu: $("#sebu option:selected").val() }, null, "post", "moneyreturnFunc(1)");
|
|
}
|
|
}else{
|
|
//#####비용항목 기준
|
|
$('#hangmok_list').val($("#hangmok option:selected").text());
|
|
if (d_cost_type != "support") {
|
|
ajaxCallJsonTemp("doc_expense_ajax_dcost.asp", { command: "est", hangmok: $("#hangmok option:selected").val(), p_sn: document.frm_money.p_sn.value, p_child_sn: p_child_sn, sebu: "" }, null, "post", "moneyreturnFunc(1)");
|
|
}
|
|
}
|
|
});
|
|
|
|
$("#changeHang").on("change", function(){
|
|
var selType = $(this).children("option:selected").val();
|
|
ajaxCallJsonTemp("doc_expense_ajax_dcost.asp", { command: "hangmok", d_cost_type: selType }, null, "post", "hangmokreturnFunc()");
|
|
if(selType == "support" || selType == ""){
|
|
$("#expenseTotal").css("display", "none");
|
|
}else{
|
|
$("#expenseTotal").css("display", "");
|
|
}
|
|
});
|
|
<% if krc_no <> "" and p_sn <> "" and p_child_sn <> "" Then %>
|
|
hangmokchange("<%= p_sn%>", "<%=p_method_nm%>", "<%=p_child_sn%>");
|
|
if("<%=gap(15)%>" != "<%=d_cost_type%>"){
|
|
$("#changeHang").val("<%=gap(15)%>").change();
|
|
}
|
|
//dim Gap(15) '1:프로젝트 코드, 2:지출목적, 3:지출일자, 4:지출방법, 5:공급가액, 6:부가세액, 7:총액, 8:거래처, 9:프로젝트코드, 10:품의서 문서번호
|
|
// ' 11:직접비예산, 12:누적집행금액, 13:차액, 14::추가 사유
|
|
$("#hangmok").val("<%=hangmok%>").change();
|
|
$("#sebu").val("<%=sebu%>").change();
|
|
$("#expence_date").val("<%=gap(3)%>");
|
|
$("#expence_way").val("<%=gap(4)%>").change();
|
|
$("input[name=expence_money]").val("<%=gap(5)%>").keyup();
|
|
$("input[name=expence_vat]").val("<%=gap(6)%>").keyup();
|
|
$("#expence_reason").val("<%=gap(2)%>".replaceAll('<br>', "\r\n"));
|
|
$("#minus_expence_reason").val("<%=gap(14)%>".replaceAll('<br>', "\r\n"));
|
|
$("#expence_num").val("<%=gap(16)%>");
|
|
$("input[name=expence_company_num]").val("<%=gap(17)%>");
|
|
$("input[name=expence_taxtype]").val("<%=gap(18)%>");
|
|
if("<%=gap(18)%>" == "4"){
|
|
$("#boolgong").prop("checked", true);
|
|
}
|
|
$("input[name=expence_item]").val("<%=gap(19)%>");
|
|
$("input[name=k_company]").val("<%=gap(20)%>");
|
|
$("#payment_date").val("<%=gap(21)%>");
|
|
<% End If %>
|
|
|
|
$("#expence_num").on("blur", function(){
|
|
if($("#expence_way").children("option:selected").val() == "인보이스"){
|
|
dupNumChk();
|
|
}
|
|
});
|
|
|
|
$("#doc_attach").on("change", function(e){
|
|
if(e.target.files.length > 0){
|
|
$("#attachUploadLoading").addClass("active");
|
|
processDocAttachFiles(e.target.files, 0);
|
|
}
|
|
});
|
|
|
|
$(document).on("click", ".imgPreviewItem", function(){
|
|
var idx = +$(this).data("idx");
|
|
if(confirm("선택하신 첨부파일을 삭제하시겠습니까?")){
|
|
$(this).popover('dispose');
|
|
fileArray.splice(idx, 1);
|
|
imgPreviewSetting(fileArray);
|
|
}
|
|
});
|
|
|
|
$("#taxBtn").on("click", function(){
|
|
if($("input[name=p_child_sn]").val() == ""){
|
|
alert("프로젝트 선택 후 이용해주세요.");
|
|
return false;
|
|
}
|
|
var NTSConfirmNum = $("#expence_num").val();
|
|
var projectCompany = "";
|
|
$.ajax({
|
|
url: "doc_expense_ajax_dcost.asp",
|
|
type: "POST",
|
|
async: false,
|
|
data: {"command":"projectCompany", "p_sn":$("input[name=p_sn]").val()},
|
|
success: function(ret){
|
|
projectCompany = ret;
|
|
}
|
|
});
|
|
window.open("./doc_expense_taxList.asp?cutmenu=1&company=" + projectCompany + (NTSConfirmNum != "" ? ("&NTSConfirmNum=" + NTSConfirmNum) : ""), "", "left=150, top=150, menubar=no, location=no, status=no, toolbar=no, width=1330px, height=580px, scrollbars=yes ,resizable=no");
|
|
});
|
|
|
|
$("#boolgong").on("click", function(){
|
|
if($(this).prop("checked") == true){
|
|
$("#expence_vat").val("0");
|
|
$("#expence_vat").trigger("keyup");
|
|
|
|
MaxAmountTotal = AmountTotal + TaxTotal;
|
|
MaxTaxTotal = 0;
|
|
|
|
$("#val_supply").val(MaxAmountTotal);
|
|
$("#val_supply").trigger("keyup");
|
|
}else{
|
|
MaxAmountTotal = AmountTotal;
|
|
MaxTaxTotal = TaxTotal;
|
|
|
|
$("#expence_vat").val(MaxTaxTotal);
|
|
$("#expence_vat").trigger("keyup");
|
|
|
|
$("#val_supply").val(MaxAmountTotal);
|
|
$("#val_supply").trigger("keyup");
|
|
}
|
|
});
|
|
});
|
|
|
|
function dupNumChk(){
|
|
var p_child_sn = $("#p_child_sn").val();
|
|
var expence_num = $("#expence_num").val();
|
|
if(expence_num != "" && p_child_sn == ""){
|
|
alert("먼저 프로젝트를 선택해주세요.");
|
|
$("#expence_num").val("");
|
|
return false;
|
|
}
|
|
if(expence_num != "" && p_child_sn != ""){
|
|
ajaxCallJsonTemp("doc_expense_ajax_dcost.asp", { command: "dupnum", p_child_sn: p_child_sn, expence_num: expence_num }, null, "post", "dupNumreturnFunc()");
|
|
}
|
|
}
|
|
|
|
function dupNumreturnFunc(){
|
|
var retJson = JSON.parse(ajaxRes);
|
|
dupListLength = retJson.length;
|
|
if(retJson.length > 0){
|
|
if($.grep(retJson, function(o, i){ return o.chk == "1"; }).length > 0){
|
|
alert("같은 프로젝트에 이미 작성된 증빙번호 입니다.\n참고하신 후 작성해주시기 바랍니다.");
|
|
}
|
|
var tmpHTML = "";
|
|
$.each(retJson, function(i, o){
|
|
tmpHTML += "<tr>";
|
|
tmpHTML += "<td><button type='button' onclick='window.open(\"/ess/doc_expense_print_2014.asp?d_no=" + o.d_no + "&view_chk=1&x=1\",\"\",\"left=0,top=0,width=850,height=940,scrollbars=yes,resizable=yes\");' class='btn btn-block btn-secondary btn-sm'>" + o.d_no + "</button></td>";
|
|
tmpHTML += "<td class='text-center align-middle'>" + o.p_child_sn + "</td>";
|
|
tmpHTML += "<td class='text-left align-middle'>" + o.p_subject + "</td>";
|
|
tmpHTML += "<td class='text-right align-middle'>" + commify(o.cost) + " 원</td>";
|
|
tmpHTML += "</tr>";
|
|
});
|
|
$("#dupNumDialog > table > tbody").html(tmpHTML);
|
|
dupNumDialog.dialog("open");
|
|
}
|
|
}
|
|
|
|
function addDocAttach(){
|
|
$("#doc_attach").click();
|
|
}
|
|
|
|
function processDocAttachFiles(files, idx){
|
|
if(idx >= files.length){
|
|
imgPreviewSetting(fileArray);
|
|
$("#attachUploadLoading").removeClass("active");
|
|
return;
|
|
}
|
|
if(files[idx].type == "application/pdf"){
|
|
pdfToImg(files[idx], function(){
|
|
processDocAttachFiles(files, idx + 1);
|
|
});
|
|
}else{
|
|
fileArray.push(files[idx]);
|
|
processDocAttachFiles(files, idx + 1);
|
|
}
|
|
}
|
|
|
|
function imgPreviewSetting(files){
|
|
if(files.length > 0){
|
|
var tmpHTML = "";
|
|
tmpHTML = "<div id='imgPreviewDiv' class='d-flex'></div>";
|
|
$("#imgPreviews").children("td").html(tmpHTML);
|
|
$.each(files, function(i, f){
|
|
var $item = $("<div>", {
|
|
"class": "d-flex p-1 m-1 imgPreviewItem",
|
|
"data-idx": i
|
|
});
|
|
$("#imgPreviewDiv").append($item);
|
|
if(f.type.indexOf("image/") == 0){
|
|
var previewId = "preview_" + (i + 1);
|
|
$item.append($("<img>", { src: "", alt: "attach", id: previewId }));
|
|
var reader = new FileReader();
|
|
reader.onload = function(e){
|
|
$("#" + previewId).attr("src", e.target.result);
|
|
$("#" + previewId).parent().popover({
|
|
html: true,
|
|
trigger: "hover",
|
|
container: "body",
|
|
placement: "right",
|
|
content: function () { return "<img class='imgView' src='" + e.target.result + "' />"; }
|
|
});
|
|
}
|
|
reader.readAsDataURL(f);
|
|
}else{
|
|
var dotIdx = f.name.lastIndexOf(".");
|
|
var fileExt = dotIdx > -1 ? f.name.substring(dotIdx + 1).toUpperCase() : "FILE";
|
|
var $filePreview = $("<div>", { "class": "attach_file_preview" });
|
|
$filePreview.append($("<span>", { "class": "attach_file_ext" }).text(fileExt));
|
|
$filePreview.append($("<span>", { "class": "attach_file_name" }).text(f.name));
|
|
$item.append($filePreview);
|
|
}
|
|
});
|
|
$("#imgPreviews").show();
|
|
}else{
|
|
$("#imgPreviews").hide();
|
|
}
|
|
}
|
|
|
|
function pdfToImg(file, callback){
|
|
var pdf_url = URL.createObjectURL(file);
|
|
var pdfTask = PDFJS.getDocument({ url: pdf_url });
|
|
pdfTask.onPassword = passwordCB;
|
|
pdfTask.promise.then(function(pdf_doc) {
|
|
pdfGetPage(pdf_doc, 1, pdf_doc.numPages, callback);
|
|
}).catch(function(error) {
|
|
alert(error.message);
|
|
if(callback){ callback(); }
|
|
});
|
|
}
|
|
|
|
function passwordCB(passwordFunc, reason){
|
|
if (reason === 1) { // need a password
|
|
var new_password = prompt('암호를 입력해주세요.');
|
|
} else { // Invalid password
|
|
var new_password = prompt('암호가 일치하지 않습니다!\n다시 입력해주세요.');
|
|
}
|
|
passwordFunc(new_password);
|
|
}
|
|
|
|
function pdfGetPage(pdf_doc, currentPage, pdfMaxPage, callback){
|
|
pdf_doc.getPage(currentPage).then(function(page){
|
|
var scale = 1.5;
|
|
var viewport = page.getViewport(scale);
|
|
var canvas = $("#pdf-canvas")[0];
|
|
var context = canvas.getContext('2d');
|
|
canvas.width = Math.floor(viewport.width);
|
|
canvas.height = Math.floor(viewport.height);
|
|
canvas.style.width = Math.floor(viewport.width) + "px";
|
|
canvas.style.height = Math.floor(viewport.height) + "px";
|
|
var renderContext = {
|
|
canvasContext: context,
|
|
viewport: viewport
|
|
};
|
|
page.render(renderContext).then(function(){
|
|
var imgDataUrl = canvas.toDataURL('image/jpeg', 1.0);
|
|
var blobBin = atob(imgDataUrl.split(',')[1]); // base64 데이터 디코딩
|
|
var array = [];
|
|
for (var i = 0; i < blobBin.length; i++) {
|
|
array.push(blobBin.charCodeAt(i));
|
|
}
|
|
var file = new File([new Uint8Array(array)], "tmpfile.jpg", {type: 'image/jpeg'});
|
|
fileArray.push(file);
|
|
if(pdfMaxPage > currentPage){
|
|
pdfGetPage(pdf_doc, currentPage + 1, pdfMaxPage, callback);
|
|
}else{
|
|
if(callback){ callback(); }
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
function movePage(){
|
|
setTimeout(function(){
|
|
if(confirm("결재요청이 완료되었습니다.\n초기화면으로 돌아가시겠습니까?")){
|
|
location.href="doc_list.asp?title=신규 지출결의서";
|
|
}
|
|
}, 500);
|
|
}
|
|
</script>
|
|
</div>
|
|
<!-- /.content-wrapper -->
|
|
<!-- #include virtual = "include/footer.asp" --> |