6 Коміти 79e2e07b19 ... 0d6a8b973c

Автор SHA1 Опис Дата
  hokky 0d6a8b973c 240722-1800-Kim 4 місяців тому
  hokky 8a5e1ab70a 240722-1759-Kim 4 місяців тому
  hokky b69d5bc6f2 240722-0857-Kim 4 місяців тому
  hokky 1f05a766c3 240722-0855-Kim 4 місяців тому
  hokky fa7afcb46d 240722-0843-Kim 4 місяців тому
  hokky e0b7eb8d23 240721-2133-Kim 4 місяців тому

+ 19 - 9
dabory/para/erp/ko_KR/form/form-b/purch/purch.json

@@ -10,6 +10,16 @@
     },
 
     "HeadSelectOptions": [
+        {
+            "Value": "new",
+            "Caption": "추가",
+            "Parameter": ""
+        },
+        {
+            "Value": "save-and-new",
+            "Caption": "저장후 추가",
+            "Parameter": ""
+        },
         {
             "Value": "copy-to-another",
             "Caption": "발주에서 매입으로 복사",
@@ -44,7 +54,7 @@
     "FormVars": [
         {
             "SaveButton": "저장",
-            "AddNewBdButton": "",
+            "AddNewBdButton": "항목추가",
             "AutoSlipNo": "매입번호*(자동채번 없슴)",
             "PurchDate": "매입일자*",
             "StockDate": "수불일자*",
@@ -125,10 +135,10 @@
             "StockDate": "required",
             "PorderNo": "",
             "Status": "",
-            "Supplier": "",
+            "Supplier": "required",
             "Contact": "",
-            "DealType": "",
-            "VatType": "",
+            "DealType": "required",
+            "VatType": "required",
             "VatTypeRate": "",
             "Delivery": "",
             "PayTerms": "",
@@ -139,15 +149,15 @@
             "RefNo": "",
             "IsClosed": "",
             "OurContact": "",
-            "SgroupName": "",
-            "UserName": ""
+            "SgroupName": "required",
+            "UserName": "required"
         }
     ],
 
     "// ListVars": "ListVars[0]-Caption, ListVars[1]-Size(%), ListVars[2]-align",
     "ListVars": [
         {
-            "$Radio": "$Radio",
+            "$Radio": "",
             "$Check": "$Check",
             "ItemCode": "품목코드#",
             "ItemName": "품명#",
@@ -165,7 +175,7 @@
             "PorderMemo": "품목설명(M)"
         },
         {
-            "$Radio": "3",
+            "$Radio": "",
             "$Check": "3",
             "ItemCode": "10",
             "ItemName": "30",
@@ -183,7 +193,7 @@
             "PorderMemo": "10"
         },
         {
-            "$Radio": "center",
+            "$Radio": "",
             "$Check": "center",
             "ItemCode": "left",
             "ItemName": "left",

+ 18 - 4
dabory/para/erp/ko_KR/form/form-b/sales/sales.json

@@ -80,7 +80,11 @@
             "Status": "상황",
             "Supplier": "매출업체*",
             "Contact": "업체담당자",
+<<<<<<< HEAD
+            "DealType": "거래구분*",
+=======
             "DealType": "거래구분",
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             "VatType": "부가세*",
             "VatTypeRate": "부가세율",
             "Delivery": "납품기한",
@@ -90,8 +94,13 @@
             "Column2": "컬럼2#",
             "Remarks": "비고",
             "IsClosed": "수주종결",
+<<<<<<< HEAD
+            "SgroupName": "영업부서*",
+            "UserName": "사용자명*"
+=======
             "SgroupName": "영업부서#",
             "UserName": "사용자명#"
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
         },
         {
             "SaveButton": "left",
@@ -149,7 +158,11 @@
             "Status": "",
             "Supplier": "required",
             "Contact": "",
+<<<<<<< HEAD
+            "DealType": "required",
+=======
             "DealType": "",
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             "VatType": "required",
             "VatTypeRate": "",
             "Delivery": "",
@@ -159,8 +172,8 @@
             "Column2": "",
             "Remarks": "",
             "IsClosed": "",
-            "SgroupName": "",
-            "UserName": ""
+            "SgroupName": "required",
+            "UserName": "required"
         }
     ],
 
@@ -179,7 +192,10 @@
             "VatAmt": "세액*",
             "SumAmt": "합계금액*",
             "StdSalesPrc": "표준매출가#",
+<<<<<<< HEAD
+=======
             "DeliDate": "확정납기일*",
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             "Ref1": "참고1",
             "Ref2": "참고2",
             "SorderMemo": "품목설명(M)"
@@ -197,7 +213,6 @@
             "VatAmt": "10",
             "SumAmt": "10",
             "StdSalesPrc": "10",
-            "DeliDate": "8",
             "Ref1": "15",
             "Ref2": "15",
             "SorderMemo": "10"
@@ -215,7 +230,6 @@
             "VatAmt": "decimal('sales_amt')",
             "SumAmt": "decimal('sales_amt')",
             "StdSalesPrc": "decimal('sales_prc')",
-            "DeliDate": "YYYY-MM-DD",
             "Ref1": "right",
             "Ref2": "right",
             "SorderMemo": "left"

+ 26 - 2
resources/views/front/dabory/erp/purchase/porder.blade.php

@@ -350,7 +350,7 @@
 <script src="{{ csset('/js/modals-controller/b-type/common.js') }}"></script>
     <script>
         window.onload = async function () {
-            hdPage = [];
+            ThumbArr = [];
             make_dynamic_table_css('.porder-table', make_dynamic_table_px(formB['ListVars']['Size']))
 
             $('#porder-date').val(date_to_sting(new Date()))
@@ -536,7 +536,11 @@
         }
 
         async function add_td_last_tap_out($this, id) {
+<<<<<<< HEAD
+            Btype.btn_act_save('#porder-form #frm', async function () {
+=======
             Btype.btn_act_save('#squote-form #frm', async function () {
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
                 let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
                 let index = $(tr).prevAll().length
 
@@ -721,8 +725,16 @@
                 VatRate: vat_rate,
                 VatName: vat_name,
                 SgroupName: window.User['SgroupName'],
+<<<<<<< HEAD
+                TotalQty : String(Number(total_qty) - 0)
+            }
+
+            if (typeof first_thumb !== 'undefined') {
+                parameter.FirstThumb = first_thumb;
+=======
                 TotalQty : String(Number(total_qty) - 0),
                 FirstThumb : first_thumb
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             }
 
             if (id < 0) {
@@ -1143,6 +1155,13 @@
             bd_page[index].PorderPrc = item.PurchPrc
             bd_page[index].StdPurchPrc = item.PurchPrc// override_amt_calc_txt_is_changed();
             bd_page[index].TurboThumb = item.TurboThumb
+<<<<<<< HEAD
+
+            if (!ThumbArr) { // item 받아왔을 때만 bd_page에 TurboThumb 저장
+                bd_page[index].TurboThumb = item.TurboThumb
+            }
+=======
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 
             if (bd_page[index].Id === 0) {
                 $(tr).children('td:eq(16)').find('textarea').val(item.ItemMemo)
@@ -1161,9 +1180,14 @@
             Btype.set_slip_no_btn_disabled()
 
             let hd_page = response.data.HdPage[0]
-            hdPage = hd_page;
             bd_page = response.data.BdPage ?? []
 
+            let thumb = response.data.HdPage[0]['FirstThumb']
+
+            if(!thumb){
+                ThumbArr = thumb;
+            }
+
             $('#Id').val(hd_page.Id)
             $('#auto-slip-no-txt').val(hd_page.PorderNo)
             $('#porder-date').val(moment(to_date(hd_page.PorderDate)).format('YYYY-MM-DD'))

+ 304 - 128
resources/views/front/dabory/erp/purchase/purch.blade.php

@@ -7,7 +7,7 @@
         <div class="col-xl-12">
             <div class="mb-1 pt-2 text-right">
                 <button type="button" hidden
-                    class="btn btn-success btn-open-modal item-modal-btn"
+                    class="btn btn-success btn-open-modal window item-modal-btn"
                     data-target="item"
                     data-clicked="Btype.get_item_id"
                     data-variable="itemModal">
@@ -45,16 +45,17 @@
                         <div class="col-12 col-md-4 col-lg card-header-item">
                             <div class="card card card-primary mb-3 mb-md-2 mb-lg-0 border-light" style="height: 310px">
                                 <div class="card-header p-0 mb-2">
+                                    {{-- <p class="card-title p-1 ml-2">주요 정보</p> --}}
                                 </div>
                                 <div class="card-body">
                                     <input type="hidden" id="Id" name="Id" value="0">
                                     <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0 overflow-hidden text-nowrap">{{ $formB['FormVars']['Title']['AutoSlipNo'] }}</label>
                                         <div class="col-12 d-flex p-0">
-                                            <button id="auto-slip-no-btn" class="btn-dark border-white rounded overflow-hidden col-3 text-center text-white text-nowrap radius-r0"
-                                                onclick="get_last_slip_no(this)">
-                                                <span class="icon-cogs"></span>
-                                            </button>
+                                        {{--     <button id="auto-slip-no-btn" class="btn-dark border-white rounded overflow-hidden col-3 text-center text-white text-nowrap radius-r0"--}}
+                                        {{--        onclick="get_last_slip_no(this)">--}}
+                                        {{--        <span class="icon-cogs"></span>--}}
+                                        {{--    </button>--}}
                                             <input type="text" id="auto-slip-no-txt" class="rounded w-100 radius-l0" autocomplete="off" disabled
                                                    maxlength="{{ $formB['FormVars']['MaxLength']['AutoSlipNo'] }}"
                                                 {{ $formB['FormVars']['Required']['AutoSlipNo'] }}>
@@ -72,17 +73,41 @@
                                                maxlength="{{ $formB['FormVars']['MaxLength']['StockDate'] }}"
                                             {{ $formB['FormVars']['Required']['StockDate'] }}>
                                     </div>
-                                    <div class="form-group d-flex flex-column mb-2">
+                                    {{-- <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['PorderNo'] }}</label>
                                         <input class="rounded w-100" type="text" id="porder-no-txt" disabled
                                                maxlength="{{ $formB['FormVars']['MaxLength']['PorderNo'] }}"
                                             {{ $formB['FormVars']['Required']['PorderNo'] }}>
+                                    </div>--}}
+
+                                    <div class="form-group d-flex flex-column mb-2">
+                                        <label class="m-0 ">{{ $formB['FormVars']['Title']['Supplier'] }}</label>
+                                        <div class="d-flex">
+                                            <input type="text" id="supplier-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off"
+                                            onkeydown="company_model_show_cell_enter_key(event, 'BB')"
+                                                   maxlength="{{ $formB['FormVars']['MaxLength']['Supplier'] }}"
+                                                {{ $formB['FormVars']['Required']['Supplier'] }}>
+                                            <button type="button"
+                                                class="btn-dark rounded btn-open-modal border-0 radius-l0 col-3 window company-modal-btn"
+                                                data-target="company"
+                                                data-clicked="get_override_supplier_id"
+                                                data-variable="companyModal">
+                                                <i class="icon-folder-open"></i>
+                                            </button>
+                                        </div>
                                     </div>
-                                    <div class="form-group d-flex flex-column">
+
+                                    <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['Status'] }}</label>
-                                        <input type="text" id="status-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off" disabled
-                                               maxlength="{{ $formB['FormVars']['MaxLength']['Status'] }}"
+                                        <select class="rounded w-100" data-closed="0" id="status-select" onchange="Btype.set_is_closed_val(this)"
+                                                maxlength="{{ $formB['FormVars']['MaxLength']['Status'] }}"
                                             {{ $formB['FormVars']['Required']['Status'] }}>
+                                            @foreach ($codeTitle['status']['porder'] as $key => $status)
+                                                <option value="{{ $status['Code'] }}">
+                                                    {{ $status['Title'] }}
+                                                </option>
+                                            @endforeach
+                                        </select>
                                     </div>
                                 </div>
                             </div>
@@ -90,36 +115,28 @@
                         <div class="col-12 col-md-4 col-lg card-header-item">
                             <div class="card card card-info mb-3 mb-md-2 mb-lg-0 border-light" style="height: 310px">
                                 <div class="card-header p-0 mb-2">
+                                    {{-- <p class="card-title p-1 ml-2">거래구분 / 세율</p> --}}
                                 </div>
                                 <div class="card-body">
                                     <div class="form-group d-flex flex-column mb-2">
-                                        <label class="m-0">{{ $formB['FormVars']['Title']['DealType'] }}</label>
-                                        <input type="text" id="deal-type-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off" disabled
-                                               maxlength="{{ $formB['FormVars']['MaxLength']['DealType'] }}"
+                                        <label class="m-0 ">{{ $formB['FormVars']['Title']['DealType'] }}</label>
+                                        <select class="rounded w-100" id="deal-type-select"
+                                                maxlength="{{ $formB['FormVars']['MaxLength']['DealType'] }}"
                                             {{ $formB['FormVars']['Required']['DealType'] }}>
-                                        {{-- <select class="rounded w-100" id="deal-type-select" disabled>
-                                            <option value=""></option>
-                                        </select> --}}
-                                    </div>
-                                    <div class="form-group d-flex flex-column mb-2">
-                                        <label class="m-0 ">{{ $formB['FormVars']['Title']['Supplier'] }}</label>
-                                        <input type="text" id="supplier-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off" disabled
-                                               maxlength="{{ $formB['FormVars']['MaxLength']['Supplier'] }}"
-                                            {{ $formB['FormVars']['Required']['Supplier'] }}>
+                                        </select>
                                     </div>
+
                                     <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['Contact'] }}</label>
-                                        <input class="rounded w-100" id="supplier-contact-txt" type="text" disabled
+                                        <input class="rounded w-100" id="supplier-contact-txt" type="text"
                                                maxlength="{{ $formB['FormVars']['MaxLength']['Contact'] }}"
                                             {{ $formB['FormVars']['Required']['Contact'] }}>
                                     </div>
                                     <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['VatType'] }}</label>
-                                        <input type="text" id="vat-type-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off" disabled
-                                               maxlength="{{ $formB['FormVars']['MaxLength']['VatType'] }}"
+                                        <select class="rounded w-100" id="vat-type-select" onchange="set_vat_type_rate(this)"
+                                                maxlength="{{ $formB['FormVars']['MaxLength']['VatType'] }}"
                                             {{ $formB['FormVars']['Required']['VatType'] }}>
-                                        <select class="rounded w-100" id="vat-type-select" onchange="set_vat_type_rate(this)" hidden disabled>
-                                            <option value=""></option>
                                         </select>
                                     </div>
                                     <div class="form-group d-flex flex-column">
@@ -140,48 +157,46 @@
 
                                     <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['Delivery'] }}</label>
-                                        <input type="text" id="delivery-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off" disabled
-                                               maxlength="{{ $formB['FormVars']['MaxLength']['Delivery'] }}"
-                                            {{ $formB['FormVars']['Required']['Delivery'] }}>
-                                        {{-- <select class="rounded w-100" id="delivery-select" disabled>
-                                            <option value=""></option>
-                                        </select> --}}
+                                        <select class="rounded w-100" id="delivery-select"
+                                                maxlength="{{ $formB['FormVars']['MaxLength']['Delivery'] }}"
+                                            {{ $formB['FormVars']['Required']['Delivery'] }}></select>
                                     </div>
                                     <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['PayTerms'] }}</label>
-                                        <input type="text" id="payTerms-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off" disabled
-                                               maxlength="{{ $formB['FormVars']['MaxLength']['PayTerms'] }}"
-                                            {{ $formB['FormVars']['Required']['PayTerms'] }}>
-                                        {{-- <select class="rounded w-100" id="payTerms-select" disabled>
-                                            <option value=""></option>
-                                        </select> --}}
+                                        <select class="rounded w-100" id="payTerms-select"
+                                                maxlength="{{ $formB['FormVars']['MaxLength']['PayTerms'] }}"
+                                            {{ $formB['FormVars']['Required']['PayTerms'] }}></select>
                                     </div>
                                     <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['Destination'] }}</label>
-                                        <input type="text" id="destination-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off" disabled
-                                               maxlength="{{ $formB['FormVars']['MaxLength']['Destination'] }}"
-                                            {{ $formB['FormVars']['Required']['Destination'] }}>
-                                        {{-- <select class="rounded w-100" id="destination-select" disabled>
-                                            <option value=""></option>
-                                        </select> --}}
+                                        <select class="rounded w-100" id="destination-select"
+                                                maxlength="{{ $formB['FormVars']['MaxLength']['Destination'] }}"
+                                            {{ $formB['FormVars']['Required']['Destination'] }}></select>
                                     </div>
-                                    <div class="form-group d-flex flex-column mb-2">
+                                    {{--<div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['Column1'] }}</label>
                                         <input type="text" id="column1-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off" disabled
                                                maxlength="{{ $formB['FormVars']['MaxLength']['Column1'] }}"
                                             {{ $formB['FormVars']['Required']['Column1'] }}>
-                                        {{-- <select class="rounded w-100" id="column1-select" disabled>
+                                        <select class="rounded w-100" id="column1-select" disabled>
                                             <option value=""></option>
-                                        </select> --}}
-                                    </div>
-                                    <div class="form-group d-flex flex-column">
+                                        </select>
+                                    </div>--}}
+                                    {{--<div class="form-group d-flex flex-column">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['Column2'] }}</label>
                                         <input type="text" id="column2-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off" disabled
                                                maxlength="{{ $formB['FormVars']['MaxLength']['Column2'] }}"
                                             {{ $formB['FormVars']['Required']['Column2'] }}>
-                                        {{-- <select class="rounded w-100" id="column2-select" disabled>
+                                        <select class="rounded w-100" id="column2-select" disabled>
                                             <option value=""></option>
-                                        </select> --}}
+                                        </select>
+                                    </div>--}}
+                                    <!-- 참고번호 -->
+                                    <div class="form-group d-flex flex-column mb-2">
+                                        <label class="m-0">{{ $formB['FormVars']['Title']['RefNo'] }}</label>
+                                        <input class="rounded w-100" type="text" id="ref-no-txt"
+                                               maxlength="{{ $formB['FormVars']['MaxLength']['RefNo'] }}"
+                                            {{ $formB['FormVars']['Required']['RefNo'] }}>
                                     </div>
                                 </div>
                             </div>
@@ -197,18 +212,12 @@
                                         <textarea style="height: 85px" class="rounded w-100 bg-white" id="remarks-txt-area" role="button" readonly></textarea>
                                         <div class="fr-view" id="remarks-preview" hidden></div>
                                     </div>
-                                    <div class="form-group d-flex flex-column mb-2">
-                                        <label class="m-0">{{ $formB['FormVars']['Title']['RefNo'] }}</label>
-                                        <input class="rounded w-100" type="text" id="ref-no-txt" disabled
-                                               maxlength="{{ $formB['FormVars']['MaxLength']['RefNo'] }}"
-                                            {{ $formB['FormVars']['Required']['RefNo'] }}>
-                                    </div>
                                     <div class="form-group d-flex flex-column" hidden>
                                         <input hidden type="text" id="is-not-stock-io-txt" class="rounded w-100 radius-r0" autocomplete="off" disabled>
                                     </div>
                                     <div class="form-group d-flex flex-column">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['IsClosed'] }}</label>
-                                        <input class="rounded" type="checkbox" id="is-closed-check" value="1" disabled
+                                        <input class="rounded" type="checkbox" id="is-closed-check" value="1"
                                                maxlength="{{ $formB['FormVars']['MaxLength']['IsClosed'] }}"
                                             {{ $formB['FormVars']['Required']['IsClosed'] }}>
                                     </div>
@@ -222,12 +231,10 @@
                                 <div class="card-body">
                                     <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['SgroupName'] }}</label>
-                                        <input type="text" id="sgroup-name-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off" disabled
-                                               maxlength="{{ $formB['FormVars']['MaxLength']['SgroupName'] }}"
+                                        <select class="rounded w-100" data-closed="0" id="sgroup-id-select"
+                                                maxlength="{{ $formB['FormVars']['MaxLength']['SgroupName'] }}"
                                             {{ $formB['FormVars']['Required']['SgroupName'] }}>
-                                        {{-- <select class="rounded w-100" data-closed="0" id="sgroup-id-select" disabled>
-                                            <option value=""></option>
-                                        </select> --}}
+                                        </select>
                                     </div>
                                     <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['UserName'] }}</label>
@@ -237,12 +244,11 @@
                                     </div>
                                     <div class="form-group d-flex flex-column ">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['OurContact'] }}</label>
-                                        <input type="text" id="our-contact-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off" disabled
-                                               maxlength="{{ $formB['FormVars']['MaxLength']['OurContact'] }}"
+                                        <select class="rounded w-100" data-closed="0" id="our-contact-select"
+                                                maxlength="{{ $formB['FormVars']['MaxLength']['OurContact'] }}"
                                             {{ $formB['FormVars']['Required']['OurContact'] }}>
-                                        {{-- <select class="rounded w-100" data-closed="0" id="our-contact-select" disabled>
                                             <option value=""></option>
-                                        </select> --}}
+                                        </select>
                                     </div>
                                 </div>
                             </div>
@@ -388,19 +394,48 @@
 <script src="{{ csset('/js/modals-controller/b-type/common.js') }}"></script>
     <script>
         window.onload = async function () {
+            ThumbArr = [];
             make_dynamic_table_css('.purch-table', make_dynamic_table_px(formB['ListVars']['Size']))
             // slip-search cache 사용
             // Btype.set_slip_cache_data();
 
             Btype.set_slip_no_btn_disabled()
+
+            // 매입일자, 수불일자 가져오기
             $('#purch-date').val(date_to_sting(new Date()))
             $('#stock-date').val(date_to_sting(new Date()))
 
-            // if (! isEmpty(pickCacheData['query'])) {
-            //     let query = JSON.parse(pickCacheData['query'])
-            //     await Btype.fetch_slip_form_book(query['QueryVars']['FilterValue']);
+            let sgroup_pick = await get_api_data('sgroup-pick', { Page: [ { Id:  parseInt(window.User['SgroupId']) } ] });
+            window.User['SgroupName'] = sgroup_pick['data']['Page'][0]['SgroupName'];
+
+            //storage_name, branch_name 받아오기
+            Btype.get_storage_name_and_branch_name()
+
+            // 백엔드 작업완료시 주석 해제
+                // slipInit = await Btype.get_slip_form_init()
+                // slipInit = @json($slipFormInitCacheData);
+                // formB['SlipCommonSetup'] = slipInit['SlipCommonSetup']
+                // console.log('slipInit : ', slipInit);
+                // await Btype.create_deal_type_select_box_options(slipInit.DealTypePage)
+                // await Btype.create_vat_type_select_box_options(slipInit.VatRatePage)
+                // await Btype.create_sgroup_select_box_options(slipInit.SgroupPage)
+                // await create_etc_select_box_options(slipInit)
+            // 백엔드 작업완료시 주석 해제
+
+            $('#user-txt').val(window.User['NickName'])
+
+            // if (formB['SlipCommonSetup']['IsNewRecAutoSlipNo']) {
+                $('.is-new-rec-auto-slip-no').text('자동채번')
+                $('#auto-slip-no-txt').prop('disabled', true)
+                // get_last_slip_no()
             // }
 
+
+            if (! isEmpty(pickCacheData['query'])) {
+                let query = JSON.parse(pickCacheData['query'])
+                await Btype.fetch_slip_form_book(query['QueryVars']['FilterValue']);
+            }
+
             $('.purch-act').on('click', function () {
                 // console.log($(this).data('value'))
                 switch( $(this).data('value') ) {
@@ -576,19 +611,80 @@
         }
 
         function get_parameter() {
+            // const deal_name = slipInit['DealTypePage'].filter(page => page['Id'] === Number($('#deal-type-select').val()))[0]['DealName']
+            // const vat_rate = $('#vat-type-select').find('option:selected').data('vatrate')
+            // const vat_name = slipInit['VatRatePage'].filter(page => page['Id'] === Number($('#vat-type-select').val()))[0]['VatName']
+
+            let first_item = ''
+            let first_thumb = ''
+            if (bd_page.length > 0) {
+                const first_purch = bd_page[0]
+                first_item = first_purch['ItemCode'] + '_' + first_purch['ItemName']
+                if (first_purch['SubName']) {
+                    first_item += '_' + first_purch['SubName']
+                }
+                first_item += '(' + bd_page.length + ')'
+
+                if(first_purch['TurboThumb']){
+                    first_thumb = first_purch['TurboThumb']
+                }
+            }
+            const itmtot_amt = bd_page.reduce((accumulator, bd) => {
+                return accumulator + parseFloat(bd.PurchSupply) + parseFloat(bd.PurchVat) // 합계금액 (공급가액 + 세액)
+            }, 0)
+
+            const total_qty = bd_page.reduce((accumulator, bd) => {
+                return accumulator + parseFloat(bd.PurchQty)
+            }, 0)
+
             let id = parseInt($(`#frm`).find(`input[name="Id"]`).val());
             let parameter = {
+                // Id: id,
+                // CreatedOn: get_now_time_stamp(),
+                // UpdatedOn: get_now_time_stamp(),
+                // PorderId: parseInt($('#porder-no-txt').data('id')),
+                // PurchNo: $('#auto-slip-no-txt').val(),
+                // PurchDate: moment(new Date($('#purch-date').val())).format('YYYYMMDD'),
+                // StockDate: moment(new Date($('#stock-date').val())).format('YYYYMMDD'),
+                // UserId: window.User['UserId'],
+                // Remarks: $('#remarks-txt-area').val(),
+                // Ip: window.User['Ip'],
+                // IsNotStockIo: $('#is-not-stock-io-txt').val(),
                 Id: id,
                 CreatedOn: get_now_time_stamp(),
                 UpdatedOn: get_now_time_stamp(),
-                PorderId: parseInt($('#porder-no-txt').data('id')),
+                SorderId: parseInt($('#sorder-no-txt').data('id')),
                 PurchNo: $('#auto-slip-no-txt').val(),
-                PurchDate: moment(new Date($('#purch-date').val())).format('YYYYMMDD'),
+                PurchDate: moment(new Date($('#sales-date').val())).format('YYYYMMDD'),
                 StockDate: moment(new Date($('#stock-date').val())).format('YYYYMMDD'),
+                DealTypeId: parseInt($('#deal-type-select').val()),
+                SgroupId: parseInt($('#sgroup-id-select').val()),
+                BranchId: window.User['BranchId'],
+                StorageId: window.User['StorageId'],
+                BuyerId: parseInt($('#supplier-txt').data('id')),
+                VatRateId: parseInt($('#vat-type-select').val()),
+                BuyerContact: $('#supplier-txt').data('contact'),
+                PayTerms: $('#payTerms-select').val(),
+                Destination: $('#destination-select').val(),
+                Delivery: $('#delivery-select').val(),
+                Status: $('#status-select').val(),
+                IsClosed: $('#is-closed-check:checked').val() ?? '0',
                 UserId: window.User['UserId'],
                 Remarks: $('#remarks-txt-area').val(),
+                Ip: window.User['Ip'],
                 IsNotStockIo: $('#is-not-stock-io-txt').val(),
-                Ip: window.User['Ip']
+
+
+                FirstItem: first_item,
+                ItmtotAmt: String(itmtot_amt),
+                // DiscountAmt: '0',
+                TotalAmt: String(Number(itmtot_amt) - 0),
+                DealName: deal_name,
+                VatRate: vat_rate,
+                VatName: vat_name,
+                SgroupName: window.User['SgroupName'],
+                // FirstThumb : first_thumb,
+                TotalQty : String(Number(total_qty) - 0)
             }
             if (id < 0) {
                 parameter = { Id: id }
@@ -612,21 +708,26 @@
             $('#supplier-contact-txt').val($('#supplier-txt').data('contact'))
         }
 
-        // async function create_etc_select_box_options() {
-        //     let delivery = create_options(await get_select_box_options_data('etc-page', 'select_name="납품기한"'))
-        //     let payTerms = create_options(await get_select_box_options_data('etc-page', 'select_name="지불조건"'))
-        //     let destination = create_options(await get_select_box_options_data('etc-page', 'select_name="납품장소"'))
-        //     let our_contact = create_options(await get_select_box_options_data('etc-page', 'select_name="발주담당자"'))
-        //     let column1 = create_options(await get_select_box_options_data('etc-page', 'select_name="공란1"'))
-        //     let column2 = create_options(await get_select_box_options_data('etc-page', 'select_name="공란2"'))
-
-        //     $('#delivery-select').append(delivery);
-        //     $('#payTerms-select').append(payTerms);
-        //     $('#destination-select').append(destination);
-        //     $('#our-contact-select').append(our_contact);
-        //     $('#column1-select').append(column1);
-        //     $('#column2-select').append(column2);
-        // }
+        async function create_etc_select_box_options() {
+            // let delivery = create_options(await get_select_box_options_data('etc-page', 'select_name="납품기한"'))
+            // let payTerms = create_options(await get_select_box_options_data('etc-page', 'select_name="지불조건"'))
+            // let destination = create_options(await get_select_box_options_data('etc-page', 'select_name="납품장소"'))
+            // let our_contact = create_options(await get_select_box_options_data('etc-page', 'select_name="발주담당자"'))
+            // let column1 = create_options(await get_select_box_options_data('etc-page', 'select_name="공란1"'))
+            // let column2 = create_options(await get_select_box_options_data('etc-page', 'select_name="공란2"'))
+
+            let delivery = create_options(data.EtcDeliveryPage)
+            let payTerms = create_options(data.EtcPayTermPage)
+            let destination = create_options(data.EtcDestinationPage)
+            let our_contact = create_options(data.EtcOurContactPage)
+
+            $('#delivery-select').append(delivery);
+            $('#payTerms-select').append(payTerms);
+            $('#destination-select').append(destination);
+            $('#our-contact-select').append(our_contact);
+            // $('#column1-select').append(column1);
+            // $('#column2-select').append(column2);
+        }
 
         function set_vat_type_rate($this, msg = true) {
             let vate_rate = $($this).find('option:selected').data('viewvatrate');
@@ -644,19 +745,41 @@
         }
 
         function get_bd_parameter(bd) {
+            //let discount_rate = Btype.discount_rate_calc(parseInt(minusComma(bd.CurrSalesPrc)) * parseInt(minusComma(bd.salesQty)), parseInt(bd.SalesSum));
             let id = parseInt(bd.Id);
 
             let parameter = {
+                // Id: id,
+                // CreatedOn: get_now_time_stamp(),
+                // UpdatedOn: get_now_time_stamp(),
+                // PurchId: parseInt(bd.PurchId),
+                // SeqNo: bd.SeqNo,
+                // PurchQty: String(bd.PurchQty),
+                // PurchSupply: String(bd.PurchSupply),
+                // PurchVat: String(bd.PurchVat),
+                // PurchSum: String(bd.PurchSum),
+                // CostPrc: String(bd.CostPrc),
+                // Ip: window.User['Ip']
+
                 Id: id,
                 CreatedOn: get_now_time_stamp(),
                 UpdatedOn: get_now_time_stamp(),
-                PurchId: parseInt(bd.PurchId),
+                SalesId: parseInt(bd.SalesId),
                 SeqNo: bd.SeqNo,
-                PurchQty: String(bd.PurchQty),
-                PurchSupply: String(bd.PurchSupply),
-                PurchVat: String(bd.PurchVat),
-                PurchSum: String(bd.PurchSum),
-                CostPrc: String(bd.CostPrc),
+                ItemId: parseInt(bd.ItemId),
+                PurchQty: String(bd.SalesQty),
+                CostPrc: String(bd.SorderPrc),
+                PurchSupply: String(bd.SalesSupply),
+                PurchVat: String(bd.SalesVat),
+                PurchSum: String(bd.SalesSum),
+                // ConfirmDate: isEmpty(bd.ConfirmDate) ? '' : moment(bd.ConfirmDate).format('YYYYMMDD'),
+                // DeliDate: isEmpty(bd.DeliDate) ? '' : moment(bd.DeliDate).format('YYYYMMDD'),
+                // DiscountRate: String(discount_rate),
+                CurrPurchPrc: String(bd.CurrPurchPrc),
+                CurrSalesPrc: String(bd.CurrSalesPrc),
+                Ref1: bd.Ref1,
+                Ref2: bd.Ref2,
+                PorderMemo: bd.PorderMemo,
                 Ip: window.User['Ip']
             }
 
@@ -691,13 +814,13 @@
             let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
             let index = $(tr).prevAll().length
 
-            if (bd_page[index].PorderBdId == 0) {
-                iziToast.error({
-                    title: 'Error',
-                    message: @json(_e('Action failed')),
-                });
-                return;
-            };
+            // if (bd_page[index].PorderBdId == 0) {
+            //     iziToast.error({
+            //         title: 'Error',
+            //         message: @json(_e('Action failed')),
+            //     });
+            //     return;
+            // };
 
             // 필수텍스트가 안비어있으고 fouces out == 다음 tr 추가
             if (! dom_required_check($(tr).find(`input`))) {
@@ -771,7 +894,7 @@
                 // 품목코드, 수량, 단가, 공급가액, 세액, 합계금액
                 html.push (
                 `<tr>
-                    <td class="text-${formB.ListVars['Align'].$Radio} px-import-0">
+                    <td class="text-${formB.ListVars['Align'].$Radio} px-import-0" ${formB.ListVars['Hidden'].$Radio}>
                         <input name="bd-cursor-state" type="radio" value="1" tabindex="-1"
                         class="text-${formB.ListVars['Align'].$Radio}"
                         onclick="Btype.bd_cursor_click(this)">
@@ -783,11 +906,14 @@
                     <td onkeydown="Btype.enterPressedinCell(event)"
                         class="text-${formB.ListVars['Align'].ItemCode}" ${formB.ListVars['Hidden'].ItemCode}
                         >
-                        <input type="text" class="text-${formB.ListVars['Align'].ItemCode} border-0 bg-white" value="${bd.ItemCode}" disabled
+                        <input type="text" class="text-${formB.ListVars['Align'].ItemCode} border-0 bg-white" value="${bd.ItemCode}" readonly
                         onchange="Btype.check_the_checkbox_when_changing(this)">
                     </td>
-                    <td
-                        class="text-${formB.ListVars['Align'].ItemName}" ${formB.ListVars['Hidden'].ItemName}>${bd.ItemName}
+                    <td onkeydown="Btype.enterPressedinCell(event, 2)"
+                        class="text-${formB.ListVars['Align'].ItemName}" ${formB.ListVars['Hidden'].ItemName}
+                        >
+                        <input type="text" class="text-${formB.ListVars['Align'].ItemName} border-0 bg-white" value="${bd.ItemName}" readonly
+                        onchange="Btype.check_the_checkbox_when_changing(this)" required>
                     </td>
                     <td
                         class="text-${formB.ListVars['Align'].SubName}" ${formB.ListVars['Hidden'].SubName}>${bd.SubName}
@@ -798,7 +924,7 @@
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].PurchQty}" ${formB.ListVars['Hidden'].PurchQty}
                         >
-                        <input type="text" class="text-${formB.ListVars['Align'].PurchQty} border-0 bg-white" value="${format_conver_for(bd.PurchQty, formB.ListVars['Format'].PurchQty)}" disabled
+                        <input type="text" class="text-${formB.ListVars['Align'].PurchQty} border-0 bg-white" value="${format_conver_for(bd.PurchQty, formB.ListVars['Format'].PurchQty)}" readonly
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="override_amt_calc_txt_is_changed()"
                         required>
@@ -806,14 +932,14 @@
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].PorderPrc}" ${formB.ListVars['Hidden'].PorderPrc}
                         >
-                        <input type="text" class="text-${formB.ListVars['Align'].PorderPrc} border-0 bg-white" value="${format_conver_for(bd.PorderPrc, formB.ListVars['Format'].PorderPrc)}" disabled
+                        <input type="text" class="text-${formB.ListVars['Align'].PorderPrc} border-0 bg-white" value="${format_conver_for(bd.PorderPrc, formB.ListVars['Format'].PorderPrc)}" readonly
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="override_amt_calc_txt_is_changed()">
                     </td>
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].SupplyAmt}" ${formB.ListVars['Hidden'].SupplyAmt}
                         >
-                        <input type="text" class="text-${formB.ListVars['Align'].SupplyAmt} border-0 bg-white" value="${format_conver_for(bd.PurchSupply, formB.ListVars['Format'].SupplyAmt)}" disabled
+                        <input type="text" class="text-${formB.ListVars['Align'].SupplyAmt} border-0 bg-white" value="${format_conver_for(bd.PurchSupply, formB.ListVars['Format'].SupplyAmt)}" readonly
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="override_custom_supply_amt_or_vat_amt()"
                         required>
@@ -821,16 +947,15 @@
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].VatAmt}" ${formB.ListVars['Hidden'].VatAmt}
                         >
-                        <input type="text" class="text-${formB.ListVars['Align'].VatAmt} border-0 bg-white" value="${format_conver_for(bd.PurchVat, formB.ListVars['Format'].VatAmt)}" disabled
+                        <input type="text" class="text-${formB.ListVars['Align'].VatAmt} border-0 bg-white" value="${format_conver_for(bd.PurchVat, formB.ListVars['Format'].VatAmt)}" readonly
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="override_custom_supply_amt_or_vat_amt()"
                         required>
                     </td>
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
-                        onfocusout="add_td_last_tap_out(this, ${bd.Id})"
                         class="text-${formB.ListVars['Align'].SumAmt}" ${formB.ListVars['Hidden'].SumAmt}
                         >
-                        <input type="text" class="text-${formB.ListVars['Align'].SumAmt} border-0 bg-white" value="${format_conver_for(bd.PurchSum, formB.ListVars['Format'].SumAmt)}" disabled
+                        <input type="text" class="text-${formB.ListVars['Align'].SumAmt} border-0 bg-white" value="${format_conver_for(bd.SalesSum, formB.ListVars['Format'].SumAmt)}" readonly
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="override_custom_sum_amt()"
                         required>
@@ -842,26 +967,28 @@
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].DeliDate}" ${formB.ListVars['Hidden'].DeliDate}
                         >
-                        <input type="date" class="text-${formB.ListVars['Align'].DeliDate} border-0 bg-white" value="${isEmpty(bd.DeliDate) ? '' : moment(bd.DeliDate).format(formB.ListVars['Format'].DeliDate)}" disabled
+                        <input type="date" class="text-${formB.ListVars['Align'].DeliDate} border-0 bg-white" value="${isEmpty(bd.DeliDate) ? '' : moment(bd.DeliDate).format(formB.ListVars['Format'].DeliDate)}" readonly
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="save_data_when_entering_text()">
                     </td>
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].Ref1}" ${formB.ListVars['Hidden'].Ref1}
                         >
-                        <input type="text" class="text-${formB.ListVars['Align'].Ref1} border-0 bg-white" value="${bd.Ref1}" disabled
+                        <input type="text" class="text-${formB.ListVars['Align'].Ref1} border-0 bg-white" value="${bd.Ref1}" readonly
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="save_data_when_entering_text()">
                     </td>
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].Ref2}" ${formB.ListVars['Hidden'].Ref2}
                         >
-                        <input type="text" class="text-${formB.ListVars['Align'].Ref2} border-0 bg-white" value="${bd.Ref2}" disabled
+                        <input type="text" class="text-${formB.ListVars['Align'].Ref2} border-0 bg-white" value="${bd.Ref2}" readonly
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="save_data_when_entering_text()">
                     </td>
                     <td
-                        class="text-${formB.ListVars['Align'].PorderMemo}" ${formB.ListVars['Hidden'].PorderMemo}>${bd.PorderMemo}
+                        class="text-${formB.ListVars['Align'].PorderMemo}" ${formB.ListVars['Hidden'].PorderMemo}>
+                        <textarea style="max-height: 30px;" class="rounded w-100 bg-white memo-textarea" id="memo-textarea-${bd.Id}"
+                            ondblclick="Btype.dblclick_memo_textarea(this, ${bd.Id})" role="button" readonly>${bd.PorderMemo}</textarea>
                     </td>
                 </tr>` )
             });
@@ -884,7 +1011,7 @@
 
             let html =
             `<tr>
-                <td class="text-${formB.ListVars['Align'].$Radio} px-import-0">
+                <td class="text-${formB.ListVars['Align'].$Radio} px-import-0" ${formB.ListVars['Hidden'].$Radio}>
                     <input name="bd-cursor-state" type="radio" value="1" tabindex="-1"
                     class="text-${formB.ListVars['Align'].$Radio}"
                     id="bd-cursor-state-${last_bd_id_inc}"
@@ -897,12 +1024,15 @@
                 <td onkeydown="Btype.enterPressedinCell(event)"
                     class="text-${formB.ListVars['Align'].ItemCode}" ${formB.ListVars['Hidden'].ItemCode}
                     >
-                    <input type="text" class="text-${formB.ListVars['Align'].ItemCode} border-0 bg-white" value=""
+                    <input type="text" class="text-${formB.ListVars['Align'].ItemCode} border-0 bg-white" readonly
                     onchange="Btype.check_the_checkbox_when_changing(this)"
-                    id="item-code-${last_bd_id_inc}">
+                    id="item-code-${last_bd_id_inc}" required>
                 </td>
-                <td
-                    class="text-${formB.ListVars['Align'].ItemName}" ${formB.ListVars['Hidden'].ItemName}>
+                <td onkeydown="Btype.enterPressedinCell(event, 2)"
+                    class="text-${formB.ListVars['Align'].ItemName}" ${formB.ListVars['Hidden'].ItemName}
+                    >
+                    <input type="text" class="text-${formB.ListVars['Align'].ItemName} border-0 bg-white" readonly
+                    onchange="Btype.check_the_checkbox_when_changing(this)" required>
                 </td>
                 <td
                     class="text-${formB.ListVars['Align'].SubName}" ${formB.ListVars['Hidden'].SubName}>
@@ -913,7 +1043,7 @@
                 <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                     class="text-${formB.ListVars['Align'].PurchQty}" ${formB.ListVars['Hidden'].PurchQty}
                     >
-                    <input type="text" class="text-${formB.ListVars['Align'].PurchQty} border-0 bg-white"
+                    <input type="text" class="text-${formB.ListVars['Align'].PurchQty} border-0 bg-white" readonly
                     onchange="Btype.check_the_checkbox_when_changing(this)"
                     onfocusout="override_amt_calc_txt_is_changed()"
                     required>
@@ -921,14 +1051,15 @@
                 <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                     class="text-${formB.ListVars['Align'].PorderPrc}" ${formB.ListVars['Hidden'].PorderPrc}
                     >
-                    <input type="text" class="text-${formB.ListVars['Align'].PorderPrc} border-0 bg-white"
+                    <input type="text" class="text-${formB.ListVars['Align'].PorderPrc} border-0 bg-white" readonly
                     onchange="Btype.check_the_checkbox_when_changing(this)"
-                    onfocusout="override_amt_calc_txt_is_changed()">
+                    onfocusout="override_amt_calc_txt_is_changed()"
+                    required>
                 </td>
                 <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                     class="text-${formB.ListVars['Align'].SupplyAmt}" ${formB.ListVars['Hidden'].SupplyAmt}
                     >
-                    <input type="text" class="text-${formB.ListVars['Align'].SupplyAmt} border-0 bg-white"
+                    <input type="text" class="text-${formB.ListVars['Align'].SupplyAmt} border-0 bg-white" readonly
                     onchange="Btype.check_the_checkbox_when_changing(this)"
                     onfocusout="override_custom_supply_amt_or_vat_amt()"
                     required>
@@ -936,7 +1067,7 @@
                 <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                     class="text-${formB.ListVars['Align'].VatAmt}" ${formB.ListVars['Hidden'].VatAmt}
                     >
-                    <input type="text" class="text-${formB.ListVars['Align'].VatAmt} border-0 bg-white"
+                    <input type="text" class="text-${formB.ListVars['Align'].VatAmt} border-0 bg-white" readonly
                     onchange="Btype.check_the_checkbox_when_changing(this)"
                     onfocusout="override_custom_supply_amt_or_vat_amt()"
                     required>
@@ -964,19 +1095,22 @@
                 <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                     class="text-${formB.ListVars['Align'].Ref1}" ${formB.ListVars['Hidden'].Ref1}
                     >
-                    <input type="text" class="text-${formB.ListVars['Align'].Ref1} border-0 bg-white"
+                    <input type="text" class="text-${formB.ListVars['Align'].Ref1} border-0 bg-white" readonly
                     onchange="Btype.check_the_checkbox_when_changing(this)"
                     onfocusout="save_data_when_entering_text()">
                 </td>
                 <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
+                    data-last=true onfocusout="add_td_last_tap_out(this, ${last_bd_id_inc})"
                     class="text-${formB.ListVars['Align'].Ref2}" ${formB.ListVars['Hidden'].Ref2}
                     >
-                    <input type="text" class="text-${formB.ListVars['Align'].Ref2} border-0 bg-white"
+                    <input type="text" class="text-${formB.ListVars['Align'].Ref2} border-0 bg-white" readonly
                     onchange="Btype.check_the_checkbox_when_changing(this)"
                     onfocusout="save_data_when_entering_text()">
                 </td>
                 <td
-                    class="text-${formB.ListVars['Align'].PorderMemo}" ${formB.ListVars['Hidden'].PorderMemo}>
+                    class="text-${formB.ListVars['Align'].PurchMemo}" ${formB.ListVars['Hidden'].PurchMemo}>
+                    <textarea style="max-height: 30px;" class="rounded w-100 bg-white memo-textarea"
+                        ondblclick="Btype.dblclick_memo_textarea(this, ${last_bd_id_inc})" id="memo-textarea-${last_bd_id_inc}" role="button" readonly></textarea>
                 </td>
             </tr>`;
 
@@ -1011,6 +1145,42 @@
             })
         }
 
+        function set_item_data_to_textbox(item) {
+            let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
+            $(tr).children('td:eq(2)').find('input').val(item.ItemCode)
+            $(tr).children('td:eq(3)').find('input').val(item.ItemName)
+            $(tr).children('td:eq(4)').text(item.SubName)
+            $(tr).children('td:eq(5)').text(item.CountUnit)
+            $(tr).children('td:eq(6)').find('input').val()
+            $(tr).children('td:eq(7)').find('input').val(parseFloat(item.PurchPrc).toFixed(window.User['PurchPrcPoint'])) //표준매입가
+            $(tr).children('td:eq(10)').text(parseFloat(item.SalesPrc).toFixed(window.User['PurchPrcPoint']))
+            let index = $(tr).prevAll().length;
+            bd_page[index].ItemId = item.Id
+            bd_page[index].ItemCode = item.ItemCode
+            bd_page[index].ItemName = item.ItemName
+            bd_page[index].SubName = item.SubName
+            bd_page[index].CountUnit = item.CountUnit
+            bd_page[index].SorderPrc = item.PurchPrc
+            bd_page[index].CurrPurchPrc = item.PurchPrc
+            bd_page[index].CurrSalesPrc = item.SalesPrc // override_amt_calc_txt_is_changed();
+
+            if (!ThumbArr) { // item 받아왔을 때만 bd_page에 TurboThumb 저장
+                bd_page[index].TurboThumb = item.TurboThumb
+            }
+
+            if (bd_page[index].Id === 0) {
+                $(tr).children('td:eq(16)').find('textarea').val(item.ItemMemo)
+                bd_page[index].PorderMemo = item.ItemMemo
+            }
+
+            // if (bd_page[index].Id === 0) {
+            //     $(tr).children('td:eq(16)').find('textarea').val(item.ItemMemo)
+            //     bd_page[index].SalesMemo = item.ItemMemo
+            // }
+
+            return $(tr).children('td:eq(6)').find('input')
+        }
+
         function update_hd_ui(response) {
             if (isEmpty(response.data) || response.data.apiStatus) {
                 $('#modal-slip').modal('hide');
@@ -1020,6 +1190,11 @@
 
             let hd_page = response.data.HdPage[0]
             bd_page = response.data.BdPage ?? []
+            let thumb = response.data.HdPage[0]['FirstThumb']
+
+            if(!thumb){
+                ThumbArr = thumb;
+            }
             // console.log(bd_page)
 
             $('#Id').val(hd_page.Id)
@@ -1081,5 +1256,6 @@
         const pickCacheData = {!! json_encode($pickCacheData) !!};
         var formB = {!! json_encode($formB) !!};
         var bd_page = [];
+        slipInit = null;
     </script>
 @endsection

+ 215 - 15
resources/views/front/dabory/erp/revenue/sales.blade.php

@@ -7,7 +7,7 @@
         <div class="col-xl-12">
             <div class="mb-1 pt-2 text-right">
                 <button type="button" hidden
-                    class="btn btn-success btn-open-modal item-modal-btn"
+                    class="btn btn-success btn-open-modal window item-modal-btn"
                     data-target="item"
                     data-clicked="Btype.get_item_id"
                     data-variable="itemModal">
@@ -45,6 +45,7 @@
                         <div class="col-12 col-md-4 col-lg card-header-item">
                             <div class="card card card-primary mb-3 mb-md-2 mb-lg-0 border-light" style="height: 310px">
                                 <div class="card-header p-0 mb-2">
+                                    {{-- <p class="card-title p-1 ml-2">주요 정보</p> --}}
                                 </div>
                                 <div class="card-body">
                                     <input type="hidden" id="Id" name="Id" value="0">
@@ -94,6 +95,7 @@
                         <div class="col-12 col-md-4 col-lg card-header-item">
                             <div class="card card card-info mb-3 mb-md-2 mb-lg-0 border-light" style="height: 310px">
                                 <div class="card-header p-0 mb-2">
+                                    {{-- <p class="card-title p-1 ml-2">거래구분 / 세율</p> --}}
                                 </div>
                                 <div class="card-body">
                                     <div class="form-group d-flex flex-column mb-2">
@@ -204,8 +206,12 @@
                                 <div class="card-body">
                                     <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0">{{ $formB['FormVars']['Title']['SgroupName'] }}</label>
+<<<<<<< HEAD
+                                        <select class="rounded w-100" data-closed="0" id="sgroup-id-select"
+=======
                                             {{ $formB['FormVars']['Required']['SgroupName'] }}
                                             <select class="rounded w-100" data-closed="0" id="sgroup-id-select"
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
                                                 maxlength="{{ $formB['FormVars']['MaxLength']['SgroupName'] }}"
                                             {{ $formB['FormVars']['Required']['SgroupName'] }}>
                                         </select>
@@ -237,7 +243,6 @@
                                     <button class="btn btn-sm btn-primary sales-bd-act" data-parameter="{{ $formB['BodySelectOptions'][0]['ParameterName'] ?? '' }}" data-value="{{ $formB['BodySelectOptions'][0]['Value'] }}">
                                             {{ $formB['BodySelectOptions'][0]['Caption'] }}
                                     </button>
-
                                     @include('front.dabory.erp.partial.select-btn-options', [
                                         'selectBtns' => array_slice($formB['BodySelectOptions'], 1),
                                         'eventClassName' => 'sales-bd-act'
@@ -248,7 +253,6 @@
                                     <button class="btn btn-sm btn-primary sales-bd-act" data-value="add">
                                         {{ $formB['FormVars']['Title']['AddNewBdButton'] }}
                                     </button>
-
                                     @include('front.dabory.erp.partial.select-btn-options', [
                                         'selectBtns' => $formB['BodySelectOptions'],
                                         'eventClassName' => 'sales-bd-act'
@@ -360,7 +364,10 @@
 <script src="{{ csset('/js/modals-controller/b-type/common.js') }}"></script>
     <script>
         window.onload = async function () {
+            ThumbArr = [];
             make_dynamic_table_css('.sales-table', make_dynamic_table_px(formB['ListVars']['Size']))
+<<<<<<< HEAD
+=======
 
             var test = Btype.get_storage_name_and_branch_name()
             console.log();
@@ -407,11 +414,52 @@
             });
 
             Btype.set_slip_no_btn_disabled()
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             $('#sales-date').val(date_to_sting(new Date()))
             $('#stock-date').val(date_to_sting(new Date()))
+            Btype.get_storage_name_and_branch_name()
+            let sgroup_pick = await get_api_data('sgroup-pick', { Page: [ { Id:  parseInt(window.User['SgroupId']) } ] });
+            window.User['SgroupName'] = sgroup_pick['data']['Page'][0]['SgroupName'];
+
+<<<<<<< HEAD
+            slipInit = await Btype.get_slip_form_init()
+            // slipInit = @json($slipFormInitCacheData);
+            formB['SlipCommonSetup'] = slipInit['SlipCommonSetup']
+            await Btype.create_deal_type_select_box_options(slipInit.DealTypePage)
+            await Btype.create_vat_type_select_box_options(slipInit.VatRatePage)
+            await Btype.create_sgroup_select_box_options(slipInit.SgroupPage)
+            await create_etc_select_box_options(slipInit)
+            $('#user-txt').val(window.User['NickName'])
+
+            if (formB['SlipCommonSetup']['IsNewRecAutoSlipNo']) {
+                $('.is-new-rec-auto-slip-no').text('자동채번')
+                $('#auto-slip-no-txt').prop('disabled', true)
+                // get_last_slip_no()
+            }
+
+            if (formB['SlipCommonSetup']['IsLastSlipGet']) {
+                // slip-search cache 사용
+                Btype.set_slip_cache_data();
+
+                if (! isEmpty(pickCacheData['query'])) {
+                    let query = JSON.parse(pickCacheData['query'])
+                    await Btype.fetch_slip_form_book(query['QueryVars']['FilterValue']);
+                }
+            }
+
+            $('#sales-table-body').on('click', 'tr', function() {
+                // Find the input element with name="bd-cursor-state" within the clicked row
+                const $bdCursorStateInput = $(this).find('input[name="bd-cursor-state"]');
+                if ($bdCursorStateInput.length) {
+                    $($bdCursorStateInput).prop('checked', true)
+                    Btype.bd_cursor_click($bdCursorStateInput)
+                }
+            });
+            Btype.set_slip_no_btn_disabled()
 
+=======
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             $('.sales-act').on('click', function () {
-                // console.log($(this).data('value'))
                 switch( $(this).data('value') ) {
                     case 'save': Btype.btn_act_save('#sales-form #frm'); break;
                     case 'new': btn_act_new(); break;
@@ -439,9 +487,21 @@
                 $('#modal-memo2').find('#memo-textarea').val($('#remarks-txt-area').val())
                 $('#modal-memo2').modal('show')
             });
-
             activate_button_group()
+        }
+
+        function set_company_data_to_textbox(company) {
+            get_override_supplier_id(company.Id)
+            return $('.save-button')
+        }
+
+        // start body act btn
+        function override_btn_bd_act_multi_update() {
+            Btype.btn_bd_act_multi_update('.sales-table')
+        }
 
+        function override_btn_bd_act_multi_delete() {
+            Btype.btn_bd_act_multi_delete('.sales-table')
         }
 
         async function override_seq_no_up_down(move) {
@@ -472,6 +532,8 @@
             $('#up-btn').prop('disabled', false);
         }
 
+<<<<<<< HEAD
+=======
 
         function save_data_when_entering_text() {
             let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
@@ -487,12 +549,17 @@
         function override_btn_bd_act_multi_update() {
             Btype.btn_bd_act_multi_update('.sales-table')
         }
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 
-        function override_btn_bd_act_multi_delete() {
-            Btype.btn_bd_act_multi_delete('.sales-table')
+        function save_data_when_entering_text() {
+            let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
+            let index = $(tr).prevAll().length
+            // bd_page[index].ConfirmDate = $(tr).children('td:eq(12)').find('input').val()
+            // bd_page[index].DeliDate = $(tr).children('td:eq(13)').find('input').val()
+            bd_page[index].Ref1 = $(tr).children('td:eq(14)').find('input').val()
+            bd_page[index].Ref2 = $(tr).children('td:eq(15)').find('input').val()
         }
 
-
         async function btn_bd_act_add() {
             console.log('btn_bd_act_add');
             if (parseInt($(`#frm`).find(`input[name="Id"]`).val()) == 0) {
@@ -528,12 +595,19 @@
         }
 
         function btn_act_new() {
+<<<<<<< HEAD
+            data_init()
+            if (formB['SlipCommonSetup']['IsNewRecAutoSlipNo']) {
+                get_last_slip_no()
+            }
+=======
             console.log('btn_act_new');
             data_init()
 
             // if (formB['SlipCommonSetup']['IsNewRecAutoSlipNo']) {
                 get_last_slip_no()
             // }
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
         }
 
         function btn_act_copy_to_another(parameter_name) {
@@ -592,6 +666,15 @@
                     first_thumb = first_sales['TurboThumb']
                 }
             }
+<<<<<<< HEAD
+            const itmtot_amt = bd_page.reduce((accumulator, bd) => {
+                return accumulator + parseFloat(bd.SalesSupply) + parseFloat(bd.SalesVat) // 합계금액 (공급가액 + 세액)
+            }, 0)
+
+            const total_qty = bd_page.reduce((accumulator, bd) => {
+                return accumulator + parseFloat(bd.SalesQty)
+            }, 0)
+=======
             // console.log('first_sales : ', bd_page[0]);
             const itmtot_amt = bd_page.reduce((accumulator, bd) => {
                 // return accumulator + parseFloat(bd.SalesSupply) + parseFloat(bd.SalesVat) // 합계금액 (공급가액 + 세액)
@@ -601,6 +684,7 @@
             // const total_qty = bd_page.reduce((accumulator, bd) => {
             //     return accumulator + parseFloat(bd.PorderQty)
             // }, 0)
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             let id = parseInt($(`#frm`).find(`input[name="Id"]`).val());
             let parameter = {
                 Id: id,
@@ -634,8 +718,17 @@
                 VatRate: vat_rate,
                 VatName: vat_name,
                 SgroupName: window.User['SgroupName'],
+<<<<<<< HEAD
+                // FirstThumb : first_thumb,
+                TotalQty : String(Number(total_qty) - 0)
+            }
+
+            if (typeof first_thumb !== 'undefined') {
+                parameter.FirstThumb = first_thumb;
+=======
                 //TotalQty : String(Number(total_qty) - 0),
                 FirstThumb : first_thumb
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             }
             if (id < 0) {
                 parameter = { Id: id }
@@ -644,9 +737,12 @@
             } else {
                 delete parameter.UpdatedOn;
             }
+<<<<<<< HEAD
+=======
 
             console.log('save : ', parameter);
 
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             return parameter;
         }
 
@@ -723,6 +819,8 @@
             $('#our-contact-select').html(our_contact);
         }
 
+<<<<<<< HEAD
+=======
         // function set_vat_type_rate($this, msg = true) {
         //     let vate_rate = $($this).find('option:selected').data('viewvatrate');
         //     console.log('vate_rate : ', vate_rate);
@@ -731,6 +829,7 @@
         //     if (parseInt($(`#frm`).find(`input[name="Id"]`).val()) == 0 || ! msg) return;
         // }
 
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
         function set_vat_type_rate($this, msg = true) {
             let vate_rate = $($this).find('option:selected').data('viewvatrate');
             $('#vat-type-rate-text').val(vate_rate + '%')
@@ -747,6 +846,7 @@
         }
 
         function get_bd_parameter(bd) {
+            //let discount_rate = Btype.discount_rate_calc(parseInt(minusComma(bd.CurrSalesPrc)) * parseInt(minusComma(bd.salesQty)), parseInt(bd.SalesSum));
             let id = parseInt(bd.Id);
 
             let parameter = {
@@ -755,13 +855,27 @@
                 UpdatedOn: get_now_time_stamp(),
                 SalesId: parseInt(bd.SalesId),
                 SeqNo: bd.SeqNo,
+                ItemId: parseInt(bd.ItemId),
                 SalesQty: String(bd.SalesQty),
+                CostPrc: String(bd.SorderPrc),
                 SalesSupply: String(bd.SalesSupply),
                 SalesVat: String(bd.SalesVat),
                 SalesSum: String(bd.SalesSum),
+<<<<<<< HEAD
+                // ConfirmDate: isEmpty(bd.ConfirmDate) ? '' : moment(bd.ConfirmDate).format('YYYYMMDD'),
+                // DeliDate: isEmpty(bd.DeliDate) ? '' : moment(bd.DeliDate).format('YYYYMMDD'),
+                // DiscountRate: String(discount_rate),
+                CurrPurchPrc: String(bd.CurrPurchPrc),
+                CurrSalesPrc: String(bd.CurrSalesPrc),
+                Ref1: bd.Ref1,
+                Ref2: bd.Ref2,
+                SorderMemo: bd.SorderMemo,
+                Ip: window.User['Ip']
+=======
                 CostPrc: String(bd.CostPrc),
                 Ip: window.User['Ip'],
                 FirstThumb: bd.TurboThumb
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             }
 
             if (id < 0) {
@@ -771,7 +885,6 @@
             } else {
                 delete parameter.UpdatedOn;
             }
-
             return parameter;
         }
 
@@ -795,6 +908,26 @@
             Btype.btn_act_save('#sales-form #frm', async function () {
                 let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
                 let index = $(tr).prevAll().length
+<<<<<<< HEAD
+                // if (bd_page[index].SorderBdId == 0) {
+                //     console.log('bd_page[index] : ', bd_page[index]);
+                //     iziToast.error({
+                //         title: 'Error',
+                //         message: @json(_e('Action failed')),
+                //     });
+                //     return;
+                // };
+
+                // 필수텍스트가 안비어있으고 focus out == 다음 tr 추가
+                if (bd_page[index].ItemId != 0 && ! dom_required_check($(tr).find(`input`))) {
+                    if ($($this).data('last')) {
+                        let seq_no = await Btype.get_last_seq_no('sales', $('#auto-slip-no-txt').val())
+                        bd_page[index].SeqNo = seq_no;
+                    }
+                    Btype.call_bd_act_api([ get_bd_parameter(bd_page[index]) ], function (page) {
+                        bd_page[index].Id = page[0].Id;
+
+=======
 
                 if (bd_page[index].SorderBdId == 0) {
                     iziToast.error({
@@ -813,6 +946,7 @@
                     Btype.call_bd_act_api([ get_bd_parameter(bd_page[index]) ], function (page) {
                         bd_page[index].Id = page[0].Id;
 
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
                         body_act_success_callback($this, tr);
                         Btype.check_the_checkbox_when_changing($this, false)
                     });
@@ -837,11 +971,11 @@
             let std_sales_price = $(tr).children('td:eq(11)')
 
             $(qty).val( format_conver_for(minusComma($(qty).val()), formB.ListVars['Format'].SalesQty) )
-            $(prc).val( format_conver_for(minusComma($(prc).val()), formB.ListVars['Format'].SorderPrc) )
+            $(prc).val( format_conver_for(minusComma($(prc).val()), formB.ListVars['Format'].SorderPrc) ) // 수주단가
             $(supply_amt).val( format_conver_for(minusComma($(supply_amt).val()), formB.ListVars['Format'].SupplyAmt) )
             $(vat_amt).val( format_conver_for(minusComma($(vat_amt).val()), formB.ListVars['Format'].VatAmt) )
             $(sum_amt).val( format_conver_for(minusComma($(sum_amt).val()), formB.ListVars['Format'].SumAmt) )
-            $(std_sales_price).text( format_conver_for(minusComma($(std_sales_price).text()), formB.ListVars['Format'].SorderPrc) )
+            $(std_sales_price).text( format_conver_for(minusComma($(std_sales_price).text()), formB.ListVars['Format'].SorderPrc) ) // 표준 매출가
 
             if ($($this).data('last')) {
                 add_tr();
@@ -940,7 +1074,11 @@
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].SorderPrc}" ${formB.ListVars['Hidden'].SorderPrc}
                         >
+<<<<<<< HEAD
+                        <input type="text" class="text-${formB.ListVars['Align'].SorderPrc} border-0 bg-white" value="${format_conver_for(bd.CostPrc, formB.ListVars['Format'].SorderPrc)}" readonly
+=======
                         <input type="text" class="text-${formB.ListVars['Align'].SorderPrc} border-0 bg-white" value="${format_conver_for(bd.SorderPrc, formB.ListVars['Format'].SorderPrc)}" readonly
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="override_amt_calc_txt_is_changed()"
                         require>
@@ -964,7 +1102,11 @@
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].SumAmt}" ${formB.ListVars['Hidden'].SumAmt}
                         >
+<<<<<<< HEAD
+                        <input type="text" class="text-${formB.ListVars['Align'].SumAmt} border-0 bg-white" value="${format_conver_for(bd.SalesSum, formB.ListVars['Format'].SumAmt)}" readonly
+=======
                         <input type="text" class="text-${formB.ListVars['Align'].SumAmt} border-0 bg-white" value="${format_conver_for(bd.SorderSum, formB.ListVars['Format'].SumAmt)}" readonly
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="override_custom_sum_amt()"
                         required>
@@ -972,6 +1114,8 @@
                     <td
                         class="text-${formB.ListVars['Align'].StdSalesPrc}" ${formB.ListVars['Hidden'].StdSalesPrc}>${format_conver_for(bd.StdSalesPrc, formB.ListVars['Format'].StdSalesPrc)}
                     </td>
+<<<<<<< HEAD
+=======
 
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].DeliDate}" ${formB.ListVars['Hidden'].DeliDate}
@@ -981,6 +1125,7 @@
                         onfocusout="save_data_when_entering_text()"
                         required>
                     </td>
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].Ref1}" ${formB.ListVars['Hidden'].Ref1}
                         >
@@ -997,7 +1142,11 @@
                         onfocusout="save_data_when_entering_text()">
                     </td>
                     <td
+<<<<<<< HEAD
+                        class="text-${formB.ListVars['Align'].SorderMemo}" ${formB.ListVars['Hidden'].SorderMemo}>
+=======
                         class="text-${formB.ListVars['Align'].SorderMemo}" ${formB.ListVars['Hidden'].SordderMemo}>
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
                         <textarea style="max-height: 30px;" class="rounded w-100 bg-white memo-textarea" id="memo-textarea-${bd.Id}"
                             ondblclick="Btype.dblclick_memo_textarea(this, ${bd.Id})" role="button" readonly>${bd.SorderMemo}</textarea>
                     </td>
@@ -1010,7 +1159,6 @@
             $('#SumTotal').val(format_conver_for(sum_total, formB.ListVars['Format'].SumAmt));
 
             document.getElementById('sales-table-body').innerHTML = html.join('');
-
         }
 
         async function add_tr() {
@@ -1093,6 +1241,8 @@
                 <td
                     class="text-${formB.ListVars['Align'].StdSalesPrc}" ${formB.ListVars['Hidden'].StdSalesPrc}>
                 </td>
+<<<<<<< HEAD
+=======
                 <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                     class="text-${formB.ListVars['Align'].DeliDate}" ${formB.ListVars['Hidden'].DeliDate}
                     >
@@ -1102,6 +1252,7 @@
                     onfocusout="save_data_when_entering_text()"
                     required>
                 </td>
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
                 <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                     class="text-${formB.ListVars['Align'].Ref1}" ${formB.ListVars['Hidden'].Ref1}
                     >
@@ -1110,14 +1261,17 @@
                     onfocusout="save_data_when_entering_text()">
                 </td>
                 <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
+                    data-last=true onfocusout="add_td_last_tap_out(this, ${last_bd_id_inc})"
                     class="text-${formB.ListVars['Align'].Ref2}" ${formB.ListVars['Hidden'].Ref2}
                     >
                     <input type="text" class="text-${formB.ListVars['Align'].Ref2} border-0 bg-white" readonly
                     onchange="Btype.check_the_checkbox_when_changing(this)"
                     onfocusout="save_data_when_entering_text()">
                 </td>
-                <td
+                 <td
                     class="text-${formB.ListVars['Align'].SorderMemo}" ${formB.ListVars['Hidden'].SorderMemo}>
+                    <textarea style="max-height: 30px;" class="rounded w-100 bg-white memo-textarea"
+                        ondblclick="Btype.dblclick_memo_textarea(this, ${last_bd_id_inc})" id="memo-textarea-${last_bd_id_inc}" role="button" readonly></textarea>
                 </td>
             </tr>`;
 
@@ -1128,6 +1282,7 @@
             }, 100);
 
             bd_page.push({
+
                 cursorId: last_bd_id_inc,
                 Id: 0,
                 ItemId: 0,
@@ -1153,6 +1308,40 @@
         }
 
         function set_item_data_to_textbox(item) {
+<<<<<<< HEAD
+            let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
+            $(tr).children('td:eq(2)').find('input').val(item.ItemCode)
+            $(tr).children('td:eq(3)').find('input').val(item.ItemName)
+            $(tr).children('td:eq(4)').text(item.SubName)
+            $(tr).children('td:eq(5)').text(item.CountUnit)
+            $(tr).children('td:eq(6)').find('input').val()
+            // $(tr).children('td:eq(7)').find('input').val(parseFloat(item.PurchPrc).toFixed(window.User['PurchPrcPoint']))
+            // $(tr).children('td:eq(11)').text(parseFloat(item.SalesPrc).toFixed(window.User['PurchPrcPoint']))
+            $(tr).children('td:eq(7)').find('input').val(parseFloat(item.PurchPrc).toFixed(window.User['SalesPrcPoint'])) //표준매출가
+            $(tr).children('td:eq(10)').text(parseFloat(item.SalesPrc).toFixed(window.User['SalesPrcPoint']))
+            let index = $(tr).prevAll().length;
+            bd_page[index].ItemId = item.Id
+            bd_page[index].ItemCode = item.ItemCode
+            bd_page[index].ItemName = item.ItemName
+            bd_page[index].SubName = item.SubName
+            bd_page[index].CountUnit = item.CountUnit
+            bd_page[index].SorderPrc = item.SalesPrc
+            bd_page[index].CurrPurchPrc = item.PurchPrc
+            bd_page[index].CurrSalesPrc = item.SalesPrc // override_amt_calc_txt_is_changed();
+
+            if (!ThumbArr) { // item 받아왔을 때만 bd_page에 TurboThumb 저장
+                bd_page[index].TurboThumb = item.TurboThumb
+            }
+
+            if (bd_page[index].Id === 0) {
+                $(tr).children('td:eq(16)').find('textarea').val(item.ItemMemo)
+                bd_page[index].SorderMemo = item.ItemMemo
+            }
+
+            // if (bd_page[index].Id === 0) {
+            //     $(tr).children('td:eq(16)').find('textarea').val(item.ItemMemo)
+            //     bd_page[index].SalesMemo = item.ItemMemo
+=======
             console.log('item : ', item);
             let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
             // $(tr).children('td:eq(2)').find('input').val(item.ItemCode)
@@ -1175,6 +1364,7 @@
             // if (bd_page[index].Id === 0) {
             //     $(tr).children('td:eq(16)').find('textarea').val(item.ItemMemo)
             //     bd_page[index].PorderMemo = item.ItemMemo
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             // }
 
             return $(tr).children('td:eq(6)').find('input')
@@ -1187,22 +1377,32 @@
                 $('#modal-slip').modal('hide');
                 return;
             }
+            console.log(response);
             Btype.set_slip_no_btn_disabled()
 
             let hd_page = response.data.HdPage[0]
             bd_page = response.data.BdPage ?? []
+<<<<<<< HEAD
+            let thumb = response.data.HdPage[0]['FirstThumb']
+
+            if(!thumb){
+                ThumbArr = thumb;
+            }
+
+=======
             console.log('response : ', response);
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             $('#Id').val(hd_page.Id)
             $('#auto-slip-no-txt').val(hd_page.SalesNo)
             $('#sales-date').val(moment(to_date(hd_page.SalesDate)).format('YYYY-MM-DD'))
             $('#stock-date').val(moment(to_date(hd_page.StockDate)).format('YYYY-MM-DD'))
             $('#sorder-no-txt').val(hd_page.SorderNo)
             $('#sorder-no-txt').data('id', hd_page.SorderId)
-            $('#status-txt').val(hd_page.Status)
+            $('#status-select').val(hd_page.Status)
 
             $('#deal-type-txt').val(format_conver_for(hd_page.DealCode, "deal_type('deal-type')"))
             $('#supplier-txt').val(hd_page.CompanyName)
-            $('#supplier-txt').data('id', hd_page.SupplierId)
+            $('#supplier-txt').data('id', hd_page.BuyerId)
             $('#supplier-txt').data('contact', hd_page.BuyerContact)
             $('#supplier-contact-txt').val(hd_page.BuyerContact)
 

+ 28 - 4
resources/views/front/dabory/erp/revenue/sorder.blade.php

@@ -56,7 +56,7 @@
                                         {{-- <button id="auto-slip-no-btn" class="btn-dark border-white rounded overflow-hidden col-3 text-center text-white text-nowrap radius-r0"--}}
                                         {{-- onclick="get_last_slip_no(this)">--}}
                                         {{--  <span class="icon-cogs"></span>--}}
-                                            </button>
+                                        {{--    </button>--}}
                                             <input type="text" id="auto-slip-no-txt" class="rounded w-100 radius-l0" autocomplete="off" disabled
                                                    maxlength="{{ $formB['FormVars']['MaxLength']['AutoSlipNo'] }}"
                                                 {{ $formB['FormVars']['Required']['AutoSlipNo'] }}>
@@ -327,6 +327,10 @@
 <script src="{{ csset('/js/modals-controller/b-type/common.js') }}"></script>
     <script>
         window.onload = async function () {
+<<<<<<< HEAD
+            ThumbArr = [];
+=======
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             //await Btype.fetch_slip_form_book(query['QueryVars']['FilterValue']);
             make_dynamic_table_css('.sorder-table', make_dynamic_table_px(formB['ListVars']['Size']))
 
@@ -512,7 +516,11 @@
         }
 
         async function add_td_last_tap_out($this, id) {
+<<<<<<< HEAD
+            Btype.btn_act_save('#sorder-form #frm', async function () {
+=======
             Btype.btn_act_save('#squote-form #frm', async function () {
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
                 let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
                 let index = $(tr).prevAll().length
 
@@ -520,7 +528,10 @@
                 if (bd_page[index].ItemId != 0 && ! dom_required_check($(tr).find(`input`))) {
                     if ($($this).data('last')) {
                         let seq_no = await Btype.get_last_seq_no('sorder', $('#auto-slip-no-txt').val())
+<<<<<<< HEAD
+=======
                         console.log('seq_no : ', seq_no);
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
                         bd_page[index].SeqNo = seq_no;
                     }
 
@@ -528,7 +539,10 @@
                         bd_page[index].Id = page[0].Id;
                         body_act_success_callback($this, tr);
                         Btype.check_the_checkbox_when_changing($this, false)
+<<<<<<< HEAD
+=======
                         // Btype.btn_act_save('#sorder-form #frm');
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
                     });
                 } else {
                     iziToast.error({
@@ -678,7 +692,10 @@
                     first_item += '_' + first_sorder['SubName']
                 }
                 first_item += '(' + bd_page.length + ')'
-                first_thumb = first_sorder['TurboThumb']
+
+                if(first_sorder['TurboThumb']){
+                    first_thumb = first_sorder['TurboThumb']
+                }
             }
             const itmtot_amt = bd_page.reduce((accumulator, bd) => {
                 return accumulator + parseFloat(bd.SorderSupply) + parseFloat(bd.SorderVat) // 합계금액 (공급가액 + 세액)
@@ -735,7 +752,10 @@
                 delete parameter.UpdatedOn;
             }
 
+<<<<<<< HEAD
+=======
             console.log('save : ', parameter)
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             return parameter;
         }
 
@@ -1143,7 +1163,7 @@
             bd_page[index].CurrPurchPrc = item.PurchPrc
             bd_page[index].CurrSalesPrc = item.SalesPrc// override_amt_calc_txt_is_changed();
 
-            if (hdPage['FirstThumb'] == '') {
+            if (!ThumbArr) { // item 받아왔을 때만 bd_page에 TurboThumb 저장
                 bd_page[index].TurboThumb = item.TurboThumb
             }
 
@@ -1163,8 +1183,12 @@
             Btype.set_slip_no_btn_disabled()
 
             let hd_page = response.data.HdPage[0]
-            hdPage = hd_page;
             bd_page = response.data.BdPage ?? []
+            let thumb = response.data.HdPage[0]['FirstThumb']
+
+            if(!thumb){
+                ThumbArr = thumb;
+            }
 
             $('#Id').val(hd_page.Id)
             $('#auto-slip-no-txt').val(hd_page.SorderNo)

+ 4 - 0
resources/views/front/dabory/erp/sales/squote.blade.php

@@ -860,7 +860,11 @@
             $(tr).children('td:eq(3)').find('input').val(item.ItemName)
             $(tr).children('td:eq(4)').text(item.SubName)
             $(tr).children('td:eq(5)').text(item.CountUnit)
+<<<<<<< HEAD
+            $(tr).children('td:eq(6)').find('input').val()
+=======
             $(tr).children('td:eq(6)').find('input').val(0)
+>>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
             $(tr).children('td:eq(7)').find('input').val(parseFloat(item.PurchPrc).toFixed(window.User['PurchPrcPoint']))
             $(tr).children('td:eq(11)').text(parseFloat(item.SalesPrc).toFixed(window.User['PurchPrcPoint']))
 

+ 1 - 10
resources/views/front/dabory/erp/stock/tab/genio-correct.blade.php

@@ -551,7 +551,7 @@
             }
 
             GenioCorrect.add_td_last_tap_out = async function ($this, id) {
-                Btype.btn_act_save('#squote-form #frm', async function () {
+                Btype.btn_act_save('#genio-form #frm', async function () {
                     let tr = $('#correct-tab').find(`input[name='bd-cursor-state']:checked`).closest('tr')
                     let index = $(tr).prevAll().length
                     // 필수텍스트가 안비어있으고 fouces out == 다음 tr 추가
@@ -566,15 +566,6 @@
                             GenioCorrect.custom_body_act_success_callback($this, tr);
                             Btype.check_the_checkbox_when_changing($this, false, 'GenioCorrect')
                         }, 'GenioCorrect');
-
-                        let itemCodeInput = $(tr).find(`input[type="text"]`).first();
-                        let itemNameInput = $(tr).find(`input[type="text"]`).eq(1);
-                        if (itemCodeInput.length > 0) {
-                            Btype.set_slip_no_btn_disabled(itemCodeInput)
-                            Btype.set_slip_no_btn_disabled(itemNameInput)
-                            // $(firstTextInput).addClass('border-0 bg-white')
-                            // $(firstTextInput).prop('readonly', true)
-                        }
                     } else {
                         iziToast.error({
                             title: 'Error',