31 Commits ce722376f5 ... 19e5c8fe26

Author SHA1 Message Date
  hokky 19e5c8fe26 240726-1758-Kim 3 months ago
  hokky da81986091 240726-1755-Kim 3 months ago
  hokky 06cb676be7 Merge branch 'master' of http://git.daboryhost.com:10880/dabory/dbrerp 3 months ago
  hokky e414bdcba0 commit 3 months ago
  wngur6076 14bb5a3546 t 3 months ago
  wngur6076 53767b43d2 Merge remote-tracking branch 'refs/remotes/origin/master' 3 months ago
  wngur6076 a4e21516ec t 3 months ago
  hokky edbcf8eea1 commit 3 months ago
  hokky b2083c3018 240725-2245-Kim 4 months ago
  hokky d0ab34a665 240725-2234-Kim 4 months ago
  hokky fa4ebfb0c7 240725-2222-Kim 4 months ago
  hokky 06f19aaf8d 240725-1808-Kim 4 months ago
  hokky 23e73ef686 240725-1358-Kim 4 months ago
  hokky 0649af7831 240725-1342-Kim 4 months ago
  hokky 1444ec47c8 240725-1341-Kim 4 months ago
  hokky b0eadbb8f8 240725-1206-Kim 4 months ago
  hokky 38380b4f4c 240724-2241-Kim 4 months ago
  hokky b7ddfdf4a5 240724-2222-Kim 4 months ago
  hokky fcd00e75ee 240724-1930-Kim 4 months ago
  hokky e06177bbef 240724-1856-Kim 4 months ago
  hokky df2eb28cbf 240724-1844-Kim 4 months ago
  hokky 87a14dcf15 240724-1842-Kim 4 months ago
  hokky 35eed37f7b 240724-1802-Kim 4 months ago
  hokky 3e6561a1a9 240724-1758-Kim 4 months ago
  hokky fbc6655b62 240724-1749-Kim 4 months ago
  EricKIm 6ad909c65c 240724-1744-Kim 4 months ago
  hokky cfbf486472 240724-1735-Kim 4 months ago
  hokky 0b20719fe1 240723-2247-Kim 4 months ago
  wngur6076 d9aadb7d10 t 4 months ago
  wngur6076 47adf5ca6f Merge remote-tracking branch 'refs/remotes/origin/master' 4 months ago
  wngur6076 f832725863 t 4 months ago

BIN
.DS_Store


+ 4 - 2
app/Http/Controllers/Front/Dabory/Erp/Purchase/PurchController.php

@@ -16,6 +16,8 @@ class PurchController extends Controller
         try {
             $formB = new FormB(request('bpa'));
             $purchModal = (new Modal('/search/slip-search/purch/purch'))->getData();
+            $porderModal = (new Modal('/search/slip-search/purch/porder'))->getData();
+            // dd($porderModal);
             $companyModal = (new Modal('/search/company-search/supplier'))->getData();
             $itemModal = (new Modal('/search/item-search/supplier'))->getData();
         } catch (ParameterException $e) {
@@ -28,6 +30,7 @@ class PurchController extends Controller
         $slipFormInitCacheData = Utils::getSlipFormInitCache(
             $formB->getData()['formB']['QueryVars']['QueryName']
         );
+        // dd($slipFormInitCacheData);
         $pickCacheData = Utils::getParamCache($menuCode,
             $formB->getData()['formB']['General']['PickApi'],
             $formB->getData()['formB']['QueryVars']['QueryName']);
@@ -40,8 +43,7 @@ class PurchController extends Controller
             array_merge(
                 compact('menuCode'),
                 $formB->getData(),
-                compact('purchModal',
-                    'companyModal', 'itemModal'),
+                compact('purchModal','companyModal', 'itemModal', 'porderModal'),
                 compact('pickCacheData', 'slipCacheData', 'slipFormInitCacheData'),
             )
         )->with('codeTitle', [ "deal_type('deal-type')", "status('porder')" ]);

+ 1 - 3
app/Http/Controllers/Front/Dabory/Erp/Revenue/SalesController.php

@@ -24,11 +24,9 @@ class SalesController extends Controller
 
         // pick api para(cache) 얻는 함수
         $menuCode = Utils::bpaDecoding(request('bpa'))['menu_code'];
-
         $slipFormInitCacheData = Utils::getSlipFormInitCache(
             $formB->getData()['formB']['QueryVars']['QueryName']
         );
-
         $pickCacheData = Utils::getParamCache($menuCode,
             $formB->getData()['formB']['General']['PickApi'],
             $formB->getData()['formB']['QueryVars']['QueryName']);
@@ -45,6 +43,6 @@ class SalesController extends Controller
                     'companyModal', 'itemModal'),
                 compact('pickCacheData', 'slipCacheData', 'slipFormInitCacheData'),
             )
-        )->with('codeTitle', [ "deal_type('deal-type')", "status('sales')" ]);
+            )->with('codeTitle', [ "deal_type('deal-type')", "status('sales')" ]);
     }
 }

+ 21 - 0
app/helpers.php

@@ -6,6 +6,27 @@ use Illuminate\Support\Str;
 use Jenssegers\Agent\Agent as Agent;
 use Unirest\Request;
 
+function getHashSorderNo($sorderNo)
+{
+    $sorderNoExplode = explode('-', $sorderNo);
+    return $sorderNoExplode[0] . '-' . generate4DigitHash($sorderNo);
+}
+
+function generate4DigitHash($input)
+{
+    // Generate a SHA-256 hash
+    $hash = hash('sha256', $input);
+
+    // Convert hash to base 10 and get the first 4 digits
+    $decimalHash = base_convert($hash, 16, 10);
+
+    // Truncate or pad to ensure it's 4 digits long
+    $fourDigitHash = substr($decimalHash, 0, 4);
+
+    // Ensure it's always 4 digits
+    return str_pad($fourDigitHash, 4, '0', STR_PAD_LEFT);
+}
+
 function detect($view)
 {
     $agent = new Agent();

+ 14 - 6
dabory/para/erp/ko_KR/form/form-a/company.json

@@ -24,7 +24,8 @@
     "FormVars": [
         {
             "SaveButton": "저장",
-            "TaxNo": "등록번호*",
+            "CompanyNo": "업체 등록번호*(판매회원코드)",
+            "TaxNo": "사업자 등록번호",
             "CompanyName": "업체명*",
             "CompanyClass": "거래분류(개인/매출/매입)*",
             "CgroupId": "업체구분*",
@@ -43,10 +44,12 @@
             "DealItem": "종목",
             "Sort": "구분",
             "Remarks": "메모",
-            "IsDealEnd": "거래종료"
+            "IsDealEnd": "거래종료",
+            "SellerId": "판매회원"
         },
         {
             "SaveButton": "",
+            "CompanyNo": "left",
             "TaxNo": "left",
             "CompanyName": "left",
             "CompanyClass": "left",
@@ -66,10 +69,12 @@
             "DealItem": "left",
             "Sort": "left",
             "Remarks": "left",
-            "IsDealEnd": "left"
+            "IsDealEnd": "left",
+            "SellerId": "left"
         },
         {
             "SaveButton": "0",
+            "CompanyNo": "20",
             "TaxNo": "20",
             "CompanyName": "64",
             "CompanyClass": "2",
@@ -89,11 +94,13 @@
             "DealItem": "128",
             "Sort": "2",
             "Remarks": "1000",
-            "IsDealEnd": "0"
+            "IsDealEnd": "0",
+            "SellerId": "0"
         },
         {
             "SaveButton": "",
-            "TaxNo": "required",
+            "CompanyNo": "required",
+            "TaxNo": "",
             "CompanyName": "required",
             "CompanyClass": "required",
             "CgroupId": "required",
@@ -112,7 +119,8 @@
             "DealItem": "",
             "Sort": "",
             "Remarks": "",
-            "IsDealEnd": ""
+            "IsDealEnd": "",
+            "SellerId": "disabled"
         }
     ],
     "CompanyClassOptions": [

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

@@ -55,27 +55,27 @@
         {
             "SaveButton": "저장",
             "AddNewBdButton": "항목추가",
-            "AutoSlipNo": "매입번호*(자동채번 없슴)",
+            "AutoSlipNo": "매입번호*(자동채번)",
             "PurchDate": "매입일자*",
             "StockDate": "수불일자*",
-            "PorderNo": "발주번호#",
-            "Status": "상황#",
-            "Supplier": "매입업체#",
-            "Contact": "업체담당자#",
-            "DealType": "거래구분#",
-            "VatType": "부가세#",
-            "VatTypeRate": "부가세율#",
-            "Delivery": "납품기한#",
-            "PayTerms": "지불조건#",
+            "PorderNo": "발주번호*",
+            "Status": "상황",
+            "Supplier": "매입업체*",
+            "Contact": "업체담당자",
+            "DealType": "거래구분",
+            "VatType": "부가세*",
+            "VatTypeRate": "부가세율",
+            "Delivery": "납품기한",
+            "PayTerms": "지불조건",
             "Destination": "납품장소#",
             "Column1": "컬럼1#",
             "Column2": "컬럼2#",
             "Remarks": "비고",
-            "RefNo": "참고번호#",
-            "IsClosed": "발주종결#",
-            "OurContact": "발주담당자#",
-            "SgroupName": "영업부서#",
-            "UserName": "사용자명#"
+            "RefNo": "참고번호",
+            "IsClosed": "발주종결",
+            "OurContact": "발주담당자",
+            "SgroupName": "영업부서*",
+            "UserName": "사용자명*"
         },
         {
             "SaveButton": "left",

+ 23 - 6
dabory/para/erp/ko_KR/form/form-post/post/banner.json

@@ -41,6 +41,17 @@
         }
     ],
 
+    "Pc8Options": [
+        {
+            "Value": "main",
+            "Caption": "메인"
+        },
+        {
+            "Value": "main-mobile",
+            "Caption": "모바일"
+        }
+    ],
+
     "DisplayVars": {
         "Width": "800",
         "Chunk": "7"
@@ -60,7 +71,8 @@
             "PostTypeId": "구분",
             "Pc6": "시작일자*",
             "Pc7": "종료일자*",
-            "MediaId": "이미지"
+            "MediaId": "이미지",
+            "Pc8": "장치구분"
         },
         {
             "SaveButton": "center",
@@ -74,7 +86,8 @@
             "PostTypeId": "SortOptions",
             "Pc6": "YYYY-MM-DD",
             "Pc7": "YYYY-MM-DD",
-            "MediaId": "center"
+            "MediaId": "center",
+            "Pc8": "Pc8Options"
         },
         {
             "SaveButton": "",
@@ -88,7 +101,8 @@
             "PostTypeId": "2",
             "Pc6": "1000",
             "Pc7": "1000",
-            "MediaId": "1000"
+            "MediaId": "1000",
+            "Pc8": "2"
         },
         {
             "SaveButton": "",
@@ -102,7 +116,8 @@
             "PostTypeId": "required",
             "Pc6": "required",
             "Pc7": "required",
-            "MediaId": ""
+            "MediaId": "",
+            "Pc8": "required"
         },
         {
             "SaveButton": "",
@@ -116,7 +131,8 @@
             "PostTypeId": "postType",
             "Pc6": "date",
             "Pc7": "date",
-            "MediaId": "media"
+            "MediaId": "media",
+            "Pc8": "select"
         },
         {
             "SaveButton": "",
@@ -130,7 +146,8 @@
             "PostTypeId": "number",
             "Pc6": "string",
             "Pc7": "string",
-            "MediaId": "number"
+            "MediaId": "number",
+            "Pc8": "string"
         }
     ]
 }

+ 2 - 2
dabory/para/erp/ko_KR/list/list-form-balance/item-fngoods.json

@@ -75,8 +75,8 @@
             "Code": "품목 코드",
             "Name": "품명",
             "Name2": "서브명",
-            "Balance": "재고",
-            "Balance2": "불량재고"
+            "Balance": "(마감)월말재고",
+            "Balance2": "불량(마감)월말재고"
         },
         {
             "No": "5",

+ 6 - 3
dabory/para/erp/ko_KR/list/list-type1/post/banner-input.json

@@ -211,7 +211,8 @@
             "C9": "p6시작일자",
             "C10": "p7종료일자",
             "C11": "media썸네일",
-            "C12": "상태"
+            "C12": "상태",
+            "C13": "장치구분"
         },
         {
             "$Radio": "2",
@@ -228,7 +229,8 @@
             "C9": "8",
             "C10": "8",
             "C11": "12",
-            "C12": "5"
+            "C12": "5",
+            "C13": "5"
         },
         {
             "$Radio": "center",
@@ -245,7 +247,8 @@
             "C9": "center",
             "C10": "center",
             "C11": "$_ThumbNail",
-            "C12": "status('post-banner')"
+            "C12": "status('post-banner')",
+            "C13": "center"
         }
     ]
 }

+ 1 - 1
dabory/para/erp/ko_KR/list/list-type1/shop-order/sorder-pro-total-list.json

@@ -300,7 +300,7 @@
             "C2": "$_ThumbNail",
             "C3": "center",
             "C4": "center|^center|^center",
-            "C5": "decimal('sales_prc')|^decimal('sales_amt')",
+            "C5": "x2|^decimal('sales_amt')",
             "C6": "decimal('sales_amt')",
             "C7": "center",
             "C8": "status('sorder')|^situation('sorder')"

+ 20 - 2
public/dabory/widget/banner-popup/dabory-banner-popup.css

@@ -112,7 +112,7 @@
 
 .dabory-multipopup-box .dabory-slider .dabory-pagination-item-text {
     display: table-cell !important;
-    padding: 0 4px !important !important;
+    padding: 0 4px !important;
     font-size: 11px !important;
     line-height: 17px !important;
     color: #828282 !important;
@@ -286,6 +286,24 @@
 }
 
 @media (max-width: 767.98px) {
+
+    .swiper-slide {
+        background-size: cover !important;
+        background-position: center !important;
+    }
+
+    .swiper-slide div {
+        padding: 10px;
+    }
+
+    .swiper-slide strong {
+        font-size: 1.2em;
+    }
+
+    .swiper-slide p {
+        font-size: 1em;
+    }
+
     .dabory-multipopup {
         max-width: 300px !important;
         left: 20px !important;
@@ -297,7 +315,7 @@
 
     .dabory-slider img {
         max-width: 300px !important;
-        height: auto;
+        height: auto !important;
     }
 
     .dabory-multipopup-btn-item_todayclose {

+ 10 - 4
public/dabory/widget/banner-popup/dabory-banner-popup.js

@@ -2,7 +2,6 @@
     $.fn.bannerPopup = async function(options) {
         const opts = $.extend({}, $.fn.bannerPopup.defaults, options)
         const langJson = await loadLangJson.call(this, opts['basePath'], opts['langType'])
-
         callBannerApi.call(this, opts, langJson)
     };
 
@@ -18,7 +17,7 @@
 
     function callBannerApi(opts, langJson) {
         const self = this
-
+        const connectionDevice = opts['connectionDevice'];
         $.fn.dataLinker.localApi('list-type1-book', {
             "Book": [
                 {
@@ -45,10 +44,17 @@
                     }
                 }
             ]
+
         }, function (response) {
             const bannerList = response['Book'][0]['Page']
             if (bannerList) {
-                bannerList['Setup'] = JSON.parse(response['Book'][1]['Page'][0]['C1'])
+                if(connectionDevice == 'desktop'){
+
+                    bannerList['Setup'] = JSON.parse(response['Book'][1]['Page'][0]['C1'])
+                }else{
+                    bannerList['Setup'] = JSON.parse(response['Book'][1]['Page'][1]['C1'])
+                }
+                opts['width'] = bannerList['Setup']['Width']
                 opts['left'] = bannerList[0]['C7']
                 opts['top'] = bannerList[0]['C8']
 
@@ -201,7 +207,7 @@
         width: 650,
         langType: 'ko',
         basePath: '/dabory/widget/banner-popup',
-        hide: true,
+        hide: true
     };
 
 }(jQuery));

+ 3 - 0
public/js/utils/lib.js

@@ -143,6 +143,9 @@ function rand(min, max) {
 
 function format_decimal(val, number) {
     let format = decimal_convert(number);
+    // 소수점 버린다.
+    return numeral(Math.floor(val).toFixed(number)).format(format);
+    // 소수점 반올림.
     return numeral(parseFloat(val).toFixed(number)).format(format);
 }
 

+ 76 - 4
resources/views/front/dabory/erp/master-data/company.blade.php

@@ -29,6 +29,13 @@
                                 <div class="card card card-primary mb-3 mb-md-0 border-light">
                                 {{-- <div class="card-header p-1 mb-2"> 핵심정보 </div> --}}
                                     <div class="card-body">
+                                    <div class="form-group mb-3" {{ $formA['FormVars']['Hidden']['CompanyNo'] }}>
+                                        <label class = "m-0">{{ $formA['FormVars']['Title']['CompanyNo'] }}</label>
+                                        <br>
+                                        <input type="text" id="company-no-txt" data-copy="true" class="rounded w-100"
+                                               maxlength="{{ $formA['FormVars']['MaxLength']['CompanyNo'] }}"
+                                            {{ $formA['FormVars']['Required']['CompanyNo'] }}>
+                                    </div>
                                     <div class="form-group mb-3" {{ $formA['FormVars']['Hidden']['TaxNo'] }}>
                                         <label class = "m-0">{{ $formA['FormVars']['Title']['TaxNo'] }}</label>
                                         <br>
@@ -77,6 +84,24 @@
                                             {{ $formA['FormVars']['Required']['CgroupId'] }}>
                                         </select>
                                     </div>
+                                    <div class="form-group flex-column mb-3" id="seller-id-div" style="display: block;">
+                                        <label class="m-0" {{ $formA['FormVars']['Required']['SellerId'] }}>
+                                            {{ $formA['FormVars']['Title']['SellerId'] }}
+                                        </label>
+                                        <div class="d-flex">
+                                            <input type="text" id="seller-txt" data-id="1" class="rounded w-100 radius-r0" autocomplete="off"
+                                                   onkeydown="company_model_show_cell_enter_key(event, '', 'CompanyForm')"
+                                                   maxlength="{{ $formA['FormVars']['MaxLength']['SellerId'] }}"
+                                                {{ $formA['FormVars']['Required']['SellerId'] }}>
+                                            <button type="button" {{ $formA['FormVars']['Required']['SellerId'] === 'hidden' ? 'hidden' : '' }}
+                                            class="btn-dark rounded btn-open-modal border-0 radius-l0 col-3 CompanyForm company-modal-btn"
+                                                    data-target="company"
+                                                    data-clicked="CompanyForm.fetch_seller"
+                                                    data-variable="companyModal">
+                                                <i class="icon-folder-open"></i>
+                                            </button>
+                                        </div>
+                                    </div>
                                     <div class="form-group mb-3" {{ $formA['FormVars']['Hidden']['MainContact'] }}>
                                         <label class = "m-0">{{ $formA['FormVars']['Title']['MainContact'] }}</label>
                                         <br>
@@ -183,6 +208,7 @@
                                                    maxlength="{{ $formA['FormVars']['MaxLength']['DealItem'] }}"
                                                 {{ $formA['FormVars']['Required']['DealItem'] }}>
                                         </div>
+
                                     </div>
                                 </div>
                             </div>
@@ -234,6 +260,19 @@
             }
         });
 
+        $('#cgroup-id-select').on('change', function(){
+            const val = $(this).val()
+            switch (val) {
+                case '1':
+                case '2':
+                    $('#seller-id-div').show()
+                    break;
+                default:
+                    $('#seller-id-div').hide()
+                    break;
+            }
+        })
+
         $('#full-name-txt').on('click', function(){
             var companyName = $('#company-name-txt').val();
             if(companyName){
@@ -278,20 +317,48 @@
             $('#company-form').find('#cgroup-id-select').append(cgroup_id_select);
         }
 
-        CompanyForm.fetch_company = async function  (id) {
-            let response = await get_api_data(CompanyForm.formA['General']['PickApi'], {
+        CompanyForm.pick = async function (id) {
+            return await get_api_data(CompanyForm.formA['General']['PickApi'], {
                 Page: [ { Id: id } ]
             })
+        }
+
+        CompanyForm.fetch_company = async function  (id) {
+            const response = await CompanyForm.pick(id)
 
             CompanyForm.set_company_ui(response)
         }
 
+        CompanyForm.fetch_seller = async function  (id) {
+            const response = await CompanyForm.pick(id)
+
+            if (isEmpty(response.data) || response.data.apiStatus) {
+                $('#modal-company').modal('hide')
+                return
+            }
+
+            const seller = response.data.Page[0]
+            $('#company-form').find('#seller-txt').val(seller['CompanyName'])
+            $('#company-form').find('#seller-txt').data('id', seller['Id'])
+            $('#modal-company').modal('hide')
+        }
+
         CompanyForm.parameter = function () {
+            let sellerId = $('#company-form').find('#seller-txt').data('id')
+            switch ($('#cgroup-id-select').val()) {
+                case '3':
+                case '4':
+                case '5':
+                    sellerId = $('#company-form').find('#Id').val()
+                    break;
+            }
+
             let id = Number( $('#company-form').find('#Id').val());
             let parameter = {
                 Id: id,
                 CreatedOn: get_now_time_stamp(),
                 UpdatedOn: get_now_time_stamp(),
+                CompanyNo: $('#company-form').find('#company-no-txt').val(),
                 TaxNo: $('#company-form').find('#tax-no-txt').val(),
                 CompanyName: $('#company-form').find('#company-name-txt').val(),
                 CompanyClass: $('#company-form').find('#company-class-select').val(),
@@ -310,6 +377,7 @@
                 Addr2: $('#company-form').find('#addr2-txt').val(),
                 BizType: $('#company-form').find('#biz-type-txt').val(),
                 DealItem: $('#company-form').find('#deal-item-txt').val(),
+                SellerId: Number(sellerId),
 
                 Remarks: $('#remarks-preview').html(),
                 IsDealEnd: $('#is-deal-end-check:checked').val() ?? '0',
@@ -323,12 +391,12 @@
             } else {
                 delete parameter.UpdatedOn;
             }
-            // console.log(parameter)
+            console.log(parameter)
 
             return parameter;
         }
 
-        CompanyForm.set_company_ui = function (response) {
+        CompanyForm.set_company_ui = async function (response) {
             if (isEmpty(response.data) || response.data.apiStatus) {
                 $('#modal-company').modal('hide');
                 return;
@@ -338,6 +406,7 @@
 
             $('#company-form').find('#Id').val(company.Id)
 
+            $('#company-form').find('#company-no-txt').val(company.CompanyNo)
             $('#company-form').find('#tax-no-txt').val(company.TaxNo)
             $('#company-form').find('#company-name-txt').val(company.CompanyName)
             $('#company-form').find('#cgroup-id-select').val(company.CgroupId)
@@ -361,6 +430,9 @@
             $('#company-form').find('#remarks-preview').html(company.Remarks)
             $('#company-form').find('#is-deal-end-check').prop('checked', company.IsDealEnd == '1')
 
+            await CompanyForm.fetch_seller(company.SellerId)
+
+            $('#company-form').find('#cgroup-id-select').trigger('change')
             $('#modal-company').modal('hide');
         }
 

+ 203 - 132
resources/views/front/dabory/erp/purchase/purch.blade.php

@@ -73,12 +73,6 @@
                                                maxlength="{{ $formB['FormVars']['MaxLength']['StockDate'] }}"
                                             {{ $formB['FormVars']['Required']['StockDate'] }}>
                                     </div>
-                                    {{-- <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>
@@ -98,17 +92,21 @@
                                     </div>
 
                                     <div class="form-group d-flex flex-column mb-2">
-                                        <label class="m-0">{{ $formB['FormVars']['Title']['Status'] }}</label>
-                                        <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>
+                                        <label class="m-0">{{ $formB['FormVars']['Title']['PorderNo'] }}</label>
+                                        <div class="d-flex">
+                                            <input type="text" class="rounded w-100 radius-r0" id="porder-no-txt"
+                                                maxlength="{{ $formB['FormVars']['MaxLength']['PorderNo'] }}"
+                                                {{ $formB['FormVars']['Required']['PorderNo'] }}>
+                                                <button type="button"
+                                                class="btn-dark rounded btn-open-modal border-0 radius-l0 col-3 window sorder-modal-btn"
+                                                data-target="slip"
+                                                data-clicked="get_porder_no"
+                                                data-variable="porderModal">
+                                                <i class="icon-folder-open"></i>
+                                            </button>
+                                            </div>
                                     </div>
+
                                 </div>
                             </div>
                         </div>
@@ -139,12 +137,27 @@
                                             {{ $formB['FormVars']['Required']['VatType'] }}>
                                         </select>
                                     </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']['VatTypeRate'] }}</label>
                                         <input type="text" id="vat-type-rate-text" class="rounded w-100" autocomplete="off" value="" disabled
                                                maxlength="{{ $formB['FormVars']['MaxLength']['VatTypeRate'] }}"
                                             {{ $formB['FormVars']['Required']['VatTypeRate'] }}>
                                     </div>
+
+                                    <div class="form-group d-flex flex-column mb-2">
+                                        <label class="m-0">{{ $formB['FormVars']['Title']['Status'] }}</label>
+                                        <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>
                         </div>
@@ -385,6 +398,7 @@
 
 @section('modal')
     @include('front.outline.static.slip', ['moealSetFile' => $purchModal])
+    @include('front.outline.static.slip', ['moealSetFile' => $porderModal])
     @include('front.outline.static.company', ['moealSetFile' => $companyModal])
     @include('front.outline.static.item', ['moealSetFile' => $itemModal])
     @include('front.outline.static.memo2')
@@ -404,32 +418,29 @@
             // 매입일자, 수불일자 가져오기
             $('#purch-date').val(date_to_sting(new Date()))
             $('#stock-date').val(date_to_sting(new Date()))
-
-            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);
 
-            // 백엔드 작업완료시 주석 해제
-                // 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)
-            // 백엔드 작업완료시 주석 해제
+            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'])
+            console.log('NickName: ', window.User['NickName']);
 
-            // if (formB['SlipCommonSetup']['IsNewRecAutoSlipNo']) {
+            let sgroup_pick = await get_api_data('sgroup-pick', { Page: [ { Id:  parseInt(window.User['SgroupId']) } ] });
+            window.User['SgroupName'] = sgroup_pick['data']['Page'][0]['SgroupName'];
+
+            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'])
@@ -437,11 +448,10 @@
             }
 
             $('.purch-act').on('click', function () {
-                // console.log($(this).data('value'))
                 switch( $(this).data('value') ) {
                     case 'save': Btype.btn_act_save('#purch-form #frm'); break;
-                    // case 'new': btn_act_new(); break;
-                    // case 'save-and-new': Btype.btn_act_save_and_new(); break;
+                    case 'new': btn_act_new(); break;
+                    case 'save-and-new': Btype.btn_act_save_and_new(); break;
                     case 'copy-to-another': btn_act_copy_to_another(str_replace_hyphen($(this).data('parameter'), '/')); break;
                     case 'delete': Btype.btn_act_del('#purch-form #frm'); break;
                 }
@@ -507,16 +517,24 @@
 
 
         async function btn_bd_act_add() {
-            if (parseInt($(`#frm`).find(`input[name="Id"]`).val()) == 0) {
-                iziToast.error({
-                    title: 'Error',
-                    message: @json(_e('Action failed')),
-                });
-                return;
-            }
-            if (! Btype.last_item_added_check('#purch-table-body')) {
-                add_tr();
-            }
+            Btype.btn_act_save('#sales-form #frm', async function () {
+                if (parseInt($(`#frm`).find(`input[name="Id"]`).val()) == 0) {
+                    iziToast.error({
+                        title: 'Error',
+                        message: @json(_e('Action failed')),
+                    });
+                    return;
+                }
+                if (! Btype.last_item_added_check('#sales-table-body')) {
+                    add_tr();
+                }
+            });
+        }
+
+        // 발주번호 찾기 -> 발주번호 입력
+        function get_porder_no(id){
+            $('#porder-no-txt').val(id)
+	        $('#modal-slip').modal('hide');
         }
 
         function btn_bd_act_body_copy(parameter_name) {
@@ -540,63 +558,10 @@
         }
 
         function btn_act_new() {
-            bd_page = [];
-            $(`#frm`).find(`input[name="Id"]`).val(0)
-            $('.save-button').prop('disabled', false)
-
-            $('#auto-slip-no-txt').val('')
-            // Btype.set_slip_no_btn_abled()
-            $('#purch-date').val(date_to_sting(new Date()))
-            $('#stock-date').val(date_to_sting(new Date()))
-            $('#porder-no-txt').val('')
-            $('#porder-no-txt').data('id', 0)
-            $('#status-txt').val('')
-
-            // select_box_first_selected('#deal-type-select')
-            $('#deal-type-txt').val('')
-            $('#supplier-txt').val('')
-            $('#supplier-txt').data('id', 0)
-            $('#supplier-txt').data('contact', '')
-            $('#supplier-contact-txt').val('')
-            $('#vat-type-txt').val('')
-            $('#vat-type-select').html(`<option value=""></option>`);
-            $('#vat-type-rate-text').val('')
-
-            $('#delivery-txt').val('')
-            $('#payTerms-txt').val('')
-            $('#destination-txt').val('')
-            $('#column1-txt').val('')
-            $('#column2-txt').val('')
-            // select_box_first_selected('#delivery-select')
-            // select_box_first_selected('#payTerms-select')
-            // select_box_first_selected('#destination-select')
-            // select_box_first_selected('#column1-select')
-            // select_box_first_selected('#column2-select')
-
-            $('#remarks-txt-area').val('')
-            $('#remarks-preview').html('')
-            $('#ref-no-txt').val('')
-            $('#is-not-stock-io-txt').val('')
-            $('#is-closed-check').prop('checked', false)
-
-            $('#sgroup-name-txt').val('')
-            // select_box_first_selected('#sgroup-name-select')
-            $('#user-txt').val('')
-            $('#our-contact-txt').val('')
-            // select_box_first_selected('#our-contact-select')
-
-            $('#StorageName').val('')
-            $('#BranchName').val('')
-
-            // table body 초기화
-            table_head_check_box_reset('#purch-table-head')
-            $('#purch-table-body').html('');
-
-            // footer 합계 초기화
-            $('#QtyTotal').val('')
-            $('#SupplyTotal').val('')
-            $('#VatTotal').val('')
-            $('#SumTotal').val('')
+            data_init()
+            if (formB['SlipCommonSetup']['IsNewRecAutoSlipNo']) {
+                get_last_slip_no()
+            }
         }
 
         function btn_act_copy_to_another(parameter_name) {
@@ -611,10 +576,12 @@
         }
 
         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']
-
+            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']
+            console.log('deal_name : ', deal_name);
+            console.log('vat_rate : ', vat_rate);
+            console.log('vat_name : ', vat_name);
             let first_item = ''
             let first_thumb = ''
             if (bd_page.length > 0) {
@@ -649,19 +616,18 @@
                 // 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(),
                 SorderId: parseInt($('#sorder-no-txt').data('id')),
                 PurchNo: $('#auto-slip-no-txt').val(),
-                PurchDate: moment(new Date($('#sales-date').val())).format('YYYYMMDD'),
+                PurchDate: moment(new Date($('#purch-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')),
+                SupplierId: parseInt($('#supplier-txt').data('id')),
                 VatRateId: parseInt($('#vat-type-select').val()),
                 BuyerContact: $('#supplier-txt').data('contact'),
                 PayTerms: $('#payTerms-select').val(),
@@ -674,7 +640,6 @@
                 Ip: window.User['Ip'],
                 IsNotStockIo: $('#is-not-stock-io-txt').val(),
 
-
                 FirstItem: first_item,
                 ItmtotAmt: String(itmtot_amt),
                 // DiscountAmt: '0',
@@ -683,9 +648,13 @@
                 VatRate: vat_rate,
                 VatName: vat_name,
                 SgroupName: window.User['SgroupName'],
-                // FirstThumb : first_thumb,
                 TotalQty : String(Number(total_qty) - 0)
             }
+
+            if (typeof first_thumb !== 'undefined') {
+                parameter.FirstThumb = first_thumb;
+            }
+
             if (id < 0) {
                 parameter = { Id: id }
             } else if (id > 0) {
@@ -697,6 +666,74 @@
             return parameter;
         }
 
+        function data_init() {
+            bd_page = [];
+            $(`#frm`).find(`input[name="Id"]`).val(0)
+            $('.save-button').prop('disabled', false)
+
+            $('#auto-slip-no-txt').val('')
+            Btype.set_slip_no_btn_abled()
+            $('#purch-date').val(date_to_sting(new Date()))
+            $('#stock-date').val(date_to_sting(new Date()))
+            $('#supplier-txt').val('')
+            $('#supplier-txt').data('id', 0)
+            $('#supplier-txt').data('contact', '')
+            $('#supplier-contact-txt').val('')
+
+            select_box_first_selected('#deal-type-select')
+            select_box_first_selected('#vat-type-select')
+            $('#vat-type-select').trigger('change');
+            select_box_first_selected('#status-select')
+            $('#status-select').data('closed', 0)
+            select_box_first_selected('#sgroup-id-select')
+            select_box_first_selected('#delivery-select')
+            select_box_first_selected('#payTerms-select')
+            select_box_first_selected('#destination-select')
+            $('#ref-no-txt').val('')
+            $('#remarks-txt-area').val('')
+            $('#remarks-preview').html('')
+            $('#porder-no-txt').val('')
+            $('#porder-no-txt').data('id', 0)
+            $('#is-closed-check').prop('checked', false)
+
+            $('#status-txt').val('')
+
+            // $('#vat-type-txt').val('')
+            // $('#vat-type-select').html(`<option value=""></option>`);
+            // $('#vat-type-rate-text').val('')
+
+            $('#delivery-txt').val('')
+            $('#payTerms-txt').val('')
+            $('#destination-txt').val('')
+            $('#column1-txt').val('')
+            $('#column2-txt').val('')
+
+            // select_box_first_selected('#column1-select')
+            // select_box_first_selected('#column2-select')
+            $('#is-not-stock-io-txt').val('')
+
+
+            $('#sgroup-name-txt').val('')
+            select_box_first_selected('#sgroup-name-select')
+            // $('#user-txt').val('')
+            $('#our-contact-txt').val('')
+            select_box_first_selected('#our-contact-select')
+
+            $('#StorageName').val('')
+            $('#BranchName').val('')
+
+            // table body 초기화
+            table_head_check_box_reset('#purch-table-head')
+            $('#purch-table-body').html('');
+
+            // footer 합계 초기화
+            $('#QtyTotal').val('')
+            $('#SupplyTotal').val('')
+            $('#VatTotal').val('')
+            $('#SumTotal').val('')
+        }
+
+
         async function get_last_slip_no($this) {
             Btype.set_slip_no_btn_disabled()
             let response = await Btype.get_last_slip_no('purch');
@@ -708,14 +745,14 @@
             $('#supplier-contact-txt').val($('#supplier-txt').data('contact'))
         }
 
-        async function create_etc_select_box_options() {
+        async function create_etc_select_box_options(data) {
             // 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"'))
-
+            console.log
             let delivery = create_options(data.EtcDeliveryPage)
             let payTerms = create_options(data.EtcPayTermPage)
             let destination = create_options(data.EtcDestinationPage)
@@ -731,17 +768,18 @@
 
         function set_vat_type_rate($this, msg = true) {
             let vate_rate = $($this).find('option:selected').data('viewvatrate');
+            console.log();
             $('#vat-type-rate-text').val(vate_rate + '%')
 
             if (parseInt($(`#frm`).find(`input[name="Id"]`).val()) == 0 || ! msg) return;
-            // call_act_api(get_parameter(), function() { });
+            Btype.call_act_api(get_parameter(), function() { });
 
-            // if (isEmpty(bd_page)) return;
+            if (isEmpty(bd_page)) return;
 
-            // let data = bd_update_due_to_vat_rate_change();
-            // Btype.call_bd_act_api(data, function() {
-            //     create_bd_page();
-            // })
+            let data = bd_update_due_to_vat_rate_change();
+            Btype.call_bd_act_api(data, function() {
+                create_bd_page();
+            })
         }
 
         function get_bd_parameter(bd) {
@@ -841,6 +879,32 @@
                     message: @json(_e('(*)Required item(s) omitted')),
                 });
             }
+            scrollToTop();
+        }
+
+        function body_act_success_callback($this, tr) {
+            // 합계 계산
+            amt_total_calc();
+
+            let qty = $(tr).children('td:eq(6)').find('input')
+            let prc = $(tr).children('td:eq(7)').find('input')
+            let supply_amt = $(tr).children('td:eq(8)').find('input')
+            let vat_amt = $(tr).children('td:eq(9)').find('input')
+            let sum_amt = $(tr).children('td:eq(10)').find('input')
+            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) ) // 수주단가
+            $(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) ) // 표준 매출가
+
+            if ($($this).data('last')) {
+                add_tr();
+                $($this).data('last', false)
+            }
+            iziToast.success({ title: 'Success', message: $('#action-completed').text() });
         }
 
         function override_amt_calc_txt_is_changed() {
@@ -907,7 +971,7 @@
                         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}" readonly
-                        onchange="Btype.check_the_checkbox_when_changing(this)">
+                        onchange="Btype.check_the_checkbox_when_changing(this)" required>
                     </td>
                     <td onkeydown="Btype.enterPressedinCell(event, 2)"
                         class="text-${formB.ListVars['Align'].ItemName}" ${formB.ListVars['Hidden'].ItemName}
@@ -934,7 +998,8 @@
                         >
                         <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()">
+                        onfocusout="override_amt_calc_txt_is_changed()"
+                        require>
                     </td>
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].SupplyAmt}" ${formB.ListVars['Hidden'].SupplyAmt}
@@ -1187,7 +1252,7 @@
                 return;
             }
             Btype.set_slip_no_btn_disabled()
-
+            console.log(response);
             let hd_page = response.data.HdPage[0]
             bd_page = response.data.BdPage ?? []
             let thumb = response.data.HdPage[0]['FirstThumb']
@@ -1211,17 +1276,17 @@
             $('#supplier-txt').data('contact', hd_page.SupplierContact)
             $('#supplier-contact-txt').val(hd_page.SupplierContact)
 
-            let html = `<option value="${hd_page.VatRateId}" data-vatrate="${hd_page.VatRate}" data-viewvatrate="${hd_page.VatRate * 100}">${hd_page.VatName}</option>`
-            $('#vat-type-select').html(html);
+            // let html = `<option value="${hd_page.VatRateId}" data-vatrate="${hd_page.VatRate}" data-viewvatrate="${hd_page.VatRate * 100}">${hd_page.VatName}</option>`
+            // $('#vat-type-select').html(html);
+            // $('#vat-type-txt').val(hd_page.VatName)
             $('#vat-type-select').val(hd_page.VatRateId)
-            $('#vat-type-txt').val(hd_page.VatName)
             set_vat_type_rate('#vat-type-select', false);
 
-            $('#delivery-txt').val(hd_page.Delivery)
-            $('#payTerms-txt').val(hd_page.PayTerms)
-            $('#destination-txt').val(hd_page.Destination)
-            $('#column1-txt').val(hd_page.Column1)
-            $('#column2-txt').val(hd_page.Column2)
+            // $('#delivery-txt').val(hd_page.Delivery)
+            // $('#payTerms-txt').val(hd_page.PayTerms)
+            // $('#destination-txt').val(hd_page.Destination)
+            // $('#column1-txt').val(hd_page.Column1)
+            // $('#column2-txt').val(hd_page.Column2)
 
             $('#remarks-txt-area').val(hd_page.Remarks)
             $('#remarks-preview').html(hd_page.Remarks)
@@ -1249,7 +1314,13 @@
             $('#modal-slip').modal('hide');
         }
 
+        function scrollToTop() {
+            var scrollArea = document.getElementById("scroll-area");
+            scrollArea.scrollTop = 0;
+        }
+
         const purchModal = {!! json_encode($purchModal) !!};
+        const porderModal = {!! json_encode($porderModal) !!};
         const companyModal = {!! json_encode($companyModal) !!};
         const itemModal = {!! json_encode($itemModal) !!};
         const slipCacheData = {!! json_encode($slipCacheData) !!};

+ 111 - 12
resources/views/front/dabory/erp/revenue/sales.blade.php

@@ -89,6 +89,21 @@
                                             </button>
                                         </div>
                                     </div>
+                                    <div class="form-group d-flex flex-column mb-2">
+                                        <label class="m-0">{{ $formB['FormVars']['Title']['SorderNo'] }}</label>
+                                        <div class="d-flex">
+                                            <input type="text" class="rounded w-100 radius-r0" id="sorder-no-txt"
+                                                maxlength="{{ $formB['FormVars']['MaxLength']['SorderNo'] }}"
+                                                {{ $formB['FormVars']['Required']['SorderNo'] }}>
+                                                <button type="button"
+                                                class="btn-dark rounded btn-open-modal border-0 radius-l0 col-3 window sorder-modal-btn"
+                                                data-target="slip"
+                                                data-clicked="get_sorder_no"
+                                                data-variable="sorderModal">
+                                                <i class="icon-folder-open"></i>
+                                            </button>
+                                            </div>
+                                    </div>
                                 </div>
                             </div>
                         </div>
@@ -350,6 +365,7 @@
 
 @section('modal')
     @include('front.outline.static.slip', ['moealSetFile' => $salesModal])
+    @include('front.outline.static.slip', ['moealSetFile' => $sorderModal])
     @include('front.outline.static.company', ['moealSetFile' => $companyModal])
     @include('front.outline.static.item', ['moealSetFile' => $itemModal])
     @include('front.outline.static.memo2')
@@ -382,6 +398,7 @@
             await Btype.create_sgroup_select_box_options(slipInit.SgroupPage)
             await create_etc_select_box_options(slipInit)
             $('#user-txt').val(window.User['NickName'])
+            console.log('NickName: ', window.User['NickName']);
 
             if (formB['SlipCommonSetup']['IsNewRecAutoSlipNo']) {
                 $('.is-new-rec-auto-slip-no').text('자동채번')
@@ -482,6 +499,8 @@
             $('#up-btn').prop('disabled', false);
         }
 
+<<<<<<< HEAD
+=======
 <<<<<<< HEAD
 =======
 
@@ -501,6 +520,7 @@
             Btype.btn_bd_act_multi_update('.sales-table')
         }
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
 
         function save_data_when_entering_text() {
             let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
@@ -525,9 +545,20 @@
                     add_tr();
                 }
             });
+<<<<<<< HEAD
+        }
+
+        // 수주번호 찾기 -> 수주번호 입력
+        function get_sorder_no(id){
+            $('#sorder-no-txt').val(id)
+	        $('#modal-slip').modal('hide');
+=======
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
         }
 
         function btn_bd_act_body_copy(parameter_name) {
+            console.log('btn_bd_act_body_copy : ', $('#sorder-no-txt').val());
+            console.log('btn_bd_act_body_copy : ', parameter_name);
             if (parseInt($('#frm').find('#Id').val()) == 0) {
                 iziToast.error({
                     title: 'Error',
@@ -536,7 +567,8 @@
                 return;
             }
 
-            $(`#modal-bodycopy.${parameter_name}`).find('.slip_no-txt').val($('#auto-slip-no-txt').val())
+            // $(`#modal-bodycopy.${parameter_name}`).find('.slip_no-txt').val($('#auto-slip-no-txt').val())
+            $(`#modal-bodycopy.${parameter_name}`).find('.slip_no-txt').val($('#sorder-no-txt').val())
             $(`#modal-bodycopy.${parameter_name}`).find('.company_name-txt').val($('#supplier-txt').val())
 
             let data = formB['BodySelectOptions'].filter(selectOption => selectOption['ModalClassName'] == parameter_name)[0];
@@ -544,17 +576,23 @@
             $('.revenue').find('.modal-btn').data('variable', data['Parameter'])
             $('.revenue').find('.modal-btn').data('class', parameter_name)
             $('.revenue').find('.modal-btn').trigger('click')
-            $(`#modal-bodycopy.${parameter_name}`).find('.body-copy-act').data('slip_no', $('#auto-slip-no-txt').val() )
+            // $(`#modal-bodycopy.${parameter_name}`).find('.body-copy-act').data('slip_no', $('#auto-slip-no-txt').val() )
+            $(`#modal-bodycopy.${parameter_name}`).find('.body-copy-act').data('slip_no', $('#sorder-no-txt').val() )
         }
 
         function btn_act_new() {
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             data_init()
             if (formB['SlipCommonSetup']['IsNewRecAutoSlipNo']) {
                 get_last_slip_no()
             }
+<<<<<<< HEAD
+=======
 =======
             console.log('btn_act_new');
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
@@ -567,6 +605,7 @@
             // }
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
         }
 
         function btn_act_copy_to_another(parameter_name) {
@@ -628,6 +667,9 @@
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             const itmtot_amt = bd_page.reduce((accumulator, bd) => {
                 return accumulator + parseFloat(bd.SalesSupply) + parseFloat(bd.SalesVat) // 합계금액 (공급가액 + 세액)
             }, 0)
@@ -635,6 +677,8 @@
             const total_qty = bd_page.reduce((accumulator, bd) => {
                 return accumulator + parseFloat(bd.SalesQty)
             }, 0)
+<<<<<<< HEAD
+=======
 =======
             // console.log('first_sales : ', bd_page[0]);
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
@@ -652,6 +696,7 @@
             // }, 0)
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             let id = parseInt($(`#frm`).find(`input[name="Id"]`).val());
             let parameter = {
                 Id: id,
@@ -688,20 +733,28 @@
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                 // FirstThumb : first_thumb,
                 TotalQty : String(Number(total_qty) - 0)
             }
 
+            console.log('save : ', parameter);
+
             if (typeof first_thumb !== 'undefined') {
                 parameter.FirstThumb = first_thumb;
 <<<<<<< HEAD
 =======
+<<<<<<< HEAD
+=======
 =======
                 //TotalQty : String(Number(total_qty) - 0),
                 FirstThumb : first_thumb
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             }
             if (id < 0) {
                 parameter = { Id: id }
@@ -713,12 +766,15 @@
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
 =======
 
             console.log('save : ', parameter);
 
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             return parameter;
         }
 
@@ -726,7 +782,6 @@
             bd_page = [];
             $(`#frm`).find(`input[name="Id"]`).val(0)
             $('.save-button').prop('disabled', false)
-
             $('#auto-slip-no-txt').val('')
             Btype.set_slip_no_btn_abled()
             $('#sales-date').val(date_to_sting(new Date()))
@@ -734,25 +789,21 @@
             $('#supplier-txt').data('id', 0)
             $('#supplier-txt').data('contact', '')
             $('#supplier-contact-txt').val('')
-
             select_box_first_selected('#deal-type-select')
             select_box_first_selected('#vat-type-select')
             $('#vat-type-select').trigger('change');
             select_box_first_selected('#status-select')
             $('#status-select').data('closed', 0)
-
             select_box_first_selected('#sgroup-id-select')
             select_box_first_selected('#delivery-select')
             select_box_first_selected('#payTerms-select')
             select_box_first_selected('#destination-select')
             $('#ref-no-txt').val('')
-
             $('#remarks-txt-area').val('')
             $('#remarks-preview').html('')
             $('#sorder-no-txt').val('')
             $('#is-closed-check').prop('checked', false)
-            // select_box_first_selected('#is-closed-select')
-
+            select_box_first_selected('#is-closed-select')
             select_box_first_selected('#our-contact-select')
 
             // table body 초기화
@@ -787,17 +838,19 @@
             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)
+            // let our_contact = create_options(data.EtcOurContactPage)
 
             $('#delivery-select').html(delivery);
             $('#payTerms-select').html(payTerms);
             $('#destination-select').html(destination);
-            $('#our-contact-select').html(our_contact);
+            // $('#our-contact-select').html(our_contact);
         }
 
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
 =======
         // function set_vat_type_rate($this, msg = true) {
         //     let vate_rate = $($this).find('option:selected').data('viewvatrate');
@@ -809,6 +862,7 @@
 
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
         function set_vat_type_rate($this, msg = true) {
             let vate_rate = $($this).find('option:selected').data('viewvatrate');
             $('#vat-type-rate-text').val(vate_rate + '%')
@@ -843,7 +897,10 @@
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                 // ConfirmDate: isEmpty(bd.ConfirmDate) ? '' : moment(bd.ConfirmDate).format('YYYYMMDD'),
                 // DeliDate: isEmpty(bd.DeliDate) ? '' : moment(bd.DeliDate).format('YYYYMMDD'),
                 // DiscountRate: String(discount_rate),
@@ -855,12 +912,15 @@
                 Ip: window.User['Ip']
 <<<<<<< HEAD
 =======
+<<<<<<< HEAD
+=======
 =======
                 CostPrc: String(bd.CostPrc),
                 Ip: window.User['Ip'],
                 FirstThumb: bd.TurboThumb
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             }
 
             if (id < 0) {
@@ -896,7 +956,10 @@
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                 // if (bd_page[index].SorderBdId == 0) {
                 //     console.log('bd_page[index] : ', bd_page[index]);
                 //     iziToast.error({
@@ -917,6 +980,8 @@
                     Btype.call_bd_act_api([ get_bd_parameter(bd_page[index]) ], function (page) {
                         bd_page[index].Id = page[0].Id;
 
+<<<<<<< HEAD
+=======
 =======
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
 
@@ -930,6 +995,7 @@
                         bd_page[index].Id = page[0].Id;
 
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                         body_act_success_callback($this, tr);
                         Btype.check_the_checkbox_when_changing($this, false)
                     });
@@ -940,6 +1006,7 @@
                     });
                 }
             });
+            scrollToTop();
         }
 
         function body_act_success_callback($this, tr) {
@@ -1056,8 +1123,9 @@
                     <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
+<<<<<<< HEAD
+=======
 =======
 <<<<<<< 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
@@ -1065,6 +1133,7 @@
                         <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
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="override_amt_calc_txt_is_changed()"
                         require>
@@ -1088,8 +1157,9 @@
                     <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
+<<<<<<< HEAD
+=======
 =======
 <<<<<<< 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
@@ -1097,6 +1167,7 @@
                         <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
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                         onchange="Btype.check_the_checkbox_when_changing(this)"
                         onfocusout="override_custom_sum_amt()"
                         required>
@@ -1107,6 +1178,8 @@
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
 =======
 
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
@@ -1119,6 +1192,7 @@
                     </td>
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                     <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                         class="text-${formB.ListVars['Align'].Ref1}" ${formB.ListVars['Hidden'].Ref1}
                         >
@@ -1135,6 +1209,9 @@
                         onfocusout="save_data_when_entering_text()">
                     </td>
                     <td
+<<<<<<< HEAD
+                        class="text-${formB.ListVars['Align'].SorderMemo}" ${formB.ListVars['Hidden'].SorderMemo}>
+=======
 <<<<<<< HEAD
                         class="text-${formB.ListVars['Align'].SalesMemo}" ${formB.ListVars['Hidden'].SorderMemo}>
 =======
@@ -1144,6 +1221,7 @@
                         class="text-${formB.ListVars['Align'].SorderMemo}" ${formB.ListVars['Hidden'].SordderMemo}>
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                         <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>
@@ -1239,6 +1317,8 @@
                     class="text-${formB.ListVars['Align'].StdSalesPrc}" ${formB.ListVars['Hidden'].StdSalesPrc}>
                 </td>
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
 
 =======
 <<<<<<< HEAD
@@ -1254,6 +1334,7 @@
                 </td>
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                 <td onkeydown="Btype.handleEnterPressedinTabCell(event)"
                     class="text-${formB.ListVars['Align'].Ref1}" ${formB.ListVars['Hidden'].Ref1}
                     >
@@ -1312,6 +1393,9 @@
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             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)
@@ -1344,6 +1428,8 @@
             // if (bd_page[index].Id === 0) {
             //     $(tr).children('td:eq(16)').find('textarea').val(item.ItemMemo)
             //     bd_page[index].SalesMemo = item.ItemMemo
+<<<<<<< HEAD
+=======
 =======
             console.log('item : ', item);
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
@@ -1384,6 +1470,7 @@
             //     $(tr).children('td:eq(16)').find('textarea').val(item.ItemMemo)
             //     bd_page[index].PorderMemo = item.ItemMemo
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             // }
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
 
@@ -1403,19 +1490,25 @@
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             let thumb = response.data.HdPage[0]['FirstThumb']
 
             if(!thumb){
                 ThumbArr = thumb;
             }
 
+<<<<<<< HEAD
+=======
 <<<<<<< HEAD
 =======
 =======
             console.log('response : ', response);
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             $('#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'))
@@ -1464,7 +1557,13 @@
             $('#modal-slip').modal('hide');
         }
 
+        function scrollToTop() {
+            var scrollArea = document.getElementById("scroll-area");
+            scrollArea.scrollTop = 0;
+        }
+
         const salesModal = {!! json_encode($salesModal) !!};
+        const sorderModal = {!! json_encode($sorderModal) !!};
         const companyModal = {!! json_encode($companyModal) !!};
         const itemModal = {!! json_encode($itemModal) !!};
         const slipCacheData = {!! json_encode($slipCacheData) !!};

+ 46 - 5
resources/views/front/dabory/erp/revenue/sorder.blade.php

@@ -71,8 +71,9 @@
                                     <div class="form-group d-flex flex-column mb-2">
                                         <label class="m-0 ">{{ $formB['FormVars']['Title']['Buyer'] }}</label>
                                         <div class="d-flex">
+                                            <input type="hidden" id="seller-id-txt" value="1">
                                             <input type="text" id="buyer-txt" data-id="0" class="rounded w-100 radius-r0" autocomplete="off"
-                                            onkeydown="company_model_show_cell_enter_key(event, 'BB')"
+                                            onkeydown="company_model_show_cell_enter_key(event, '')"
                                                    maxlength="{{ $formB['FormVars']['MaxLength']['Buyer'] }}"
                                                 {{ $formB['FormVars']['Required']['Buyer'] }}>
                                             <button type="button"
@@ -327,14 +328,16 @@
 <script src="{{ csset('/js/modals-controller/b-type/common.js') }}"></script>
     <script>
         window.onload = async function () {
-<<<<<<< HEAD
             ThumbArr = [];
+<<<<<<< HEAD
+=======
 =======
 <<<<<<< HEAD
             ThumbArr = [];
 =======
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             //await Btype.fetch_slip_form_book(query['QueryVars']['FilterValue']);
             make_dynamic_table_css('.sorder-table', make_dynamic_table_px(formB['ListVars']['Size']))
 
@@ -519,8 +522,9 @@
         }
 
         async function add_td_last_tap_out($this, id) {
-<<<<<<< HEAD
             Btype.btn_act_save('#sorder-form #frm', async function () {
+<<<<<<< HEAD
+=======
 =======
 <<<<<<< HEAD
             Btype.btn_act_save('#sorder-form #frm', async function () {
@@ -528,6 +532,7 @@
             Btype.btn_act_save('#squote-form #frm', async function () {
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                 let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
                 let index = $(tr).prevAll().length
 
@@ -538,10 +543,13 @@
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
 =======
                         console.log('seq_no : ', seq_no);
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                         bd_page[index].SeqNo = seq_no;
                     }
 
@@ -552,10 +560,13 @@
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
 =======
                         // Btype.btn_act_save('#sorder-form #frm');
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
                     });
                 } else {
                     iziToast.error({
@@ -733,6 +744,7 @@
                 BranchId: window.User['BranchId'],
                 StorageId: window.User['StorageId'],
                 BuyerId: parseInt($('#buyer-txt').data('id')),
+                SellerId: parseInt($('#seller-id-txt').val()),
                 VatRateId: parseInt($('#vat-type-select').val()),
                 BuyerContact: $('#buyer-txt').data('contact'),
                 PayTerms: $('#payTerms-select').val(),
@@ -769,10 +781,13 @@
 <<<<<<< HEAD
 =======
 <<<<<<< HEAD
+=======
+<<<<<<< HEAD
 =======
             console.log('save : ', parameter)
 >>>>>>> 79e2e07b19fcabaccbe8bd7b4812a3a803613323
 >>>>>>> 34d34dd987216b37bfdf5b9f01963501a217140c
+>>>>>>> ce722376f5bce912f655f431d3049b9d7a0e3dc5
             return parameter;
         }
 
@@ -782,9 +797,34 @@
             $('#auto-slip-no-txt').val(moment(new Date()).format('YYMMDD') + '-' + response.data.LastSlipNo)
         }
 
+
         async function get_override_supplier_id(company_id) {
-            await get_supplier_id(company_id, '#buyer-txt');
-            $('#buyer-contact-txt').val($('#buyer-txt').data('contact'))
+            await get_local_supplier_id(company_id, '#buyer-txt');
+        }
+
+        async function get_local_supplier_id(supplier_id, dom_val = '#supplier-txt') {
+            let response = await get_api_data('company-pick', {
+                Page : [
+                    {Id: Number(supplier_id) }
+                ]
+            })
+
+            if (response.data.Page) {
+                const company = response.data.Page[0];
+                $(dom_val).data('id', company.Id);
+                $(dom_val).val(company.CompanyName);
+                $(dom_val).data('contact', company.MainContact);
+
+                $('#buyer-contact-txt').val($('#buyer-txt').data('contact'))
+                $('#seller-id-txt').val(company.SellerId)
+
+                $('#modal-company.show').modal('hide');
+
+                return company
+            }
+
+
+
         }
 
         async function create_etc_select_box_options(data) {
@@ -1214,6 +1254,7 @@
             $('#buyer-txt').data('id', hd_page.BuyerId)
             $('#buyer-txt').data('contact', hd_page.BuyerContact)
             $('#buyer-contact-txt').val(hd_page.BuyerContact)
+            $('#seller-id-txt').val(hd_page.SellerId)
 
             $('#deal-type-select').val(hd_page.DealTypeId)
             $('#vat-type-select').val(hd_page.VatRateId)