wngur6076 4 months ago
parent
commit
f832725863

BIN
.DS_Store


+ 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": [

+ 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')"

+ 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');
         }
 

+ 28 - 4
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"
@@ -709,6 +710,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(),
@@ -752,9 +754,30 @@
             $('#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'))
+        async function get_override_supplier_id(supplier_id, dom_val = '#supplier-txt') {
+            let response = await get_api_data('company-pick', {
+                Page : [
+                    {Id: Number(supplier_id) }
+                ]
+            })
+
+            // console.log(response)
+            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) {
@@ -1180,6 +1203,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)