|
@@ -7,7 +7,7 @@
|
|
<div class="col-xl-12">
|
|
<div class="col-xl-12">
|
|
<div class="mb-1 pt-2 text-right">
|
|
<div class="mb-1 pt-2 text-right">
|
|
<button type="button" hidden
|
|
<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-target="item"
|
|
data-clicked="Btype.get_item_id"
|
|
data-clicked="Btype.get_item_id"
|
|
data-variable="itemModal">
|
|
data-variable="itemModal">
|
|
@@ -45,6 +45,7 @@
|
|
<div class="col-12 col-md-4 col-lg card-header-item">
|
|
<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 card card-primary mb-3 mb-md-2 mb-lg-0 border-light" style="height: 310px">
|
|
<div class="card-header p-0 mb-2">
|
|
<div class="card-header p-0 mb-2">
|
|
|
|
+ {{-- <p class="card-title p-1 ml-2">주요 정보</p> --}}
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="card-body">
|
|
<input type="hidden" id="Id" name="Id" value="0">
|
|
<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="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 card card-info mb-3 mb-md-2 mb-lg-0 border-light" style="height: 310px">
|
|
<div class="card-header p-0 mb-2">
|
|
<div class="card-header p-0 mb-2">
|
|
|
|
+ {{-- <p class="card-title p-1 ml-2">거래구분 / 세율</p> --}}
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="card-body">
|
|
<div class="form-group d-flex flex-column mb-2">
|
|
<div class="form-group d-flex flex-column mb-2">
|
|
@@ -204,8 +206,7 @@
|
|
<div class="card-body">
|
|
<div class="card-body">
|
|
<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']['SgroupName'] }}</label>
|
|
<label class="m-0">{{ $formB['FormVars']['Title']['SgroupName'] }}</label>
|
|
- {{ $formB['FormVars']['Required']['SgroupName'] }}
|
|
|
|
- <select class="rounded w-100" data-closed="0" id="sgroup-id-select"
|
|
|
|
|
|
+ <select class="rounded w-100" data-closed="0" id="sgroup-id-select"
|
|
maxlength="{{ $formB['FormVars']['MaxLength']['SgroupName'] }}"
|
|
maxlength="{{ $formB['FormVars']['MaxLength']['SgroupName'] }}"
|
|
{{ $formB['FormVars']['Required']['SgroupName'] }}>
|
|
{{ $formB['FormVars']['Required']['SgroupName'] }}>
|
|
</select>
|
|
</select>
|
|
@@ -237,7 +238,6 @@
|
|
<button class="btn btn-sm btn-primary sales-bd-act" data-parameter="{{ $formB['BodySelectOptions'][0]['ParameterName'] ?? '' }}" data-value="{{ $formB['BodySelectOptions'][0]['Value'] }}">
|
|
<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'] }}
|
|
{{ $formB['BodySelectOptions'][0]['Caption'] }}
|
|
</button>
|
|
</button>
|
|
-
|
|
|
|
@include('front.dabory.erp.partial.select-btn-options', [
|
|
@include('front.dabory.erp.partial.select-btn-options', [
|
|
'selectBtns' => array_slice($formB['BodySelectOptions'], 1),
|
|
'selectBtns' => array_slice($formB['BodySelectOptions'], 1),
|
|
'eventClassName' => 'sales-bd-act'
|
|
'eventClassName' => 'sales-bd-act'
|
|
@@ -248,7 +248,6 @@
|
|
<button class="btn btn-sm btn-primary sales-bd-act" data-value="add">
|
|
<button class="btn btn-sm btn-primary sales-bd-act" data-value="add">
|
|
{{ $formB['FormVars']['Title']['AddNewBdButton'] }}
|
|
{{ $formB['FormVars']['Title']['AddNewBdButton'] }}
|
|
</button>
|
|
</button>
|
|
-
|
|
|
|
@include('front.dabory.erp.partial.select-btn-options', [
|
|
@include('front.dabory.erp.partial.select-btn-options', [
|
|
'selectBtns' => $formB['BodySelectOptions'],
|
|
'selectBtns' => $formB['BodySelectOptions'],
|
|
'eventClassName' => 'sales-bd-act'
|
|
'eventClassName' => 'sales-bd-act'
|
|
@@ -360,13 +359,14 @@
|
|
<script src="{{ csset('/js/modals-controller/b-type/common.js') }}"></script>
|
|
<script src="{{ csset('/js/modals-controller/b-type/common.js') }}"></script>
|
|
<script>
|
|
<script>
|
|
window.onload = async function () {
|
|
window.onload = async function () {
|
|
|
|
+ ThumbArr = [];
|
|
make_dynamic_table_css('.sales-table', make_dynamic_table_px(formB['ListVars']['Size']))
|
|
make_dynamic_table_css('.sales-table', make_dynamic_table_px(formB['ListVars']['Size']))
|
|
|
|
|
|
|
|
+ $('#sales-date').val(date_to_sting(new Date()))
|
|
|
|
+ $('#stock-date').val(date_to_sting(new Date()))
|
|
var test = Btype.get_storage_name_and_branch_name()
|
|
var test = Btype.get_storage_name_and_branch_name()
|
|
- console.log();
|
|
|
|
- // let sgroup_pick = await get_api_data('sgroup-pick', { Page: [ { Id: parseInt(window.User['SgroupId']) } ] });
|
|
|
|
- // window.User['SgroupName'] = sgroup_pick['data']['Page'][0]['SgroupName'];
|
|
|
|
- // console.log('sgroup_pick : ', sgroup_pick);
|
|
|
|
|
|
+ let sgroup_pick = await get_api_data('sgroup-pick', { Page: [ { Id: parseInt(window.User['SgroupId']) } ] });
|
|
|
|
+ window.User['SgroupName'] = sgroup_pick['data']['Page'][0]['SgroupName'];
|
|
|
|
|
|
slipInit = await Btype.get_slip_form_init()
|
|
slipInit = await Btype.get_slip_form_init()
|
|
// slipInit = @json($slipFormInitCacheData);
|
|
// slipInit = @json($slipFormInitCacheData);
|
|
@@ -383,9 +383,7 @@
|
|
// get_last_slip_no()
|
|
// get_last_slip_no()
|
|
}
|
|
}
|
|
|
|
|
|
- // slip-search cache 사용
|
|
|
|
if (formB['SlipCommonSetup']['IsLastSlipGet']) {
|
|
if (formB['SlipCommonSetup']['IsLastSlipGet']) {
|
|
- console.log('여기 체크');
|
|
|
|
// slip-search cache 사용
|
|
// slip-search cache 사용
|
|
Btype.set_slip_cache_data();
|
|
Btype.set_slip_cache_data();
|
|
|
|
|
|
@@ -394,8 +392,6 @@
|
|
await Btype.fetch_slip_form_book(query['QueryVars']['FilterValue']);
|
|
await Btype.fetch_slip_form_book(query['QueryVars']['FilterValue']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // Btype.set_slip_cache_data();
|
|
|
|
-
|
|
|
|
|
|
|
|
$('#sales-table-body').on('click', 'tr', function() {
|
|
$('#sales-table-body').on('click', 'tr', function() {
|
|
// Find the input element with name="bd-cursor-state" within the clicked row
|
|
// Find the input element with name="bd-cursor-state" within the clicked row
|
|
@@ -405,13 +401,9 @@
|
|
Btype.bd_cursor_click($bdCursorStateInput)
|
|
Btype.bd_cursor_click($bdCursorStateInput)
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-
|
|
|
|
Btype.set_slip_no_btn_disabled()
|
|
Btype.set_slip_no_btn_disabled()
|
|
- $('#sales-date').val(date_to_sting(new Date()))
|
|
|
|
- $('#stock-date').val(date_to_sting(new Date()))
|
|
|
|
|
|
|
|
$('.sales-act').on('click', function () {
|
|
$('.sales-act').on('click', function () {
|
|
- // console.log($(this).data('value'))
|
|
|
|
switch( $(this).data('value') ) {
|
|
switch( $(this).data('value') ) {
|
|
case 'save': Btype.btn_act_save('#sales-form #frm'); break;
|
|
case 'save': Btype.btn_act_save('#sales-form #frm'); break;
|
|
case 'new': btn_act_new(); break;
|
|
case 'new': btn_act_new(); break;
|
|
@@ -439,9 +431,21 @@
|
|
$('#modal-memo2').find('#memo-textarea').val($('#remarks-txt-area').val())
|
|
$('#modal-memo2').find('#memo-textarea').val($('#remarks-txt-area').val())
|
|
$('#modal-memo2').modal('show')
|
|
$('#modal-memo2').modal('show')
|
|
});
|
|
});
|
|
-
|
|
|
|
activate_button_group()
|
|
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) {
|
|
async function override_seq_no_up_down(move) {
|
|
@@ -476,35 +480,25 @@
|
|
function save_data_when_entering_text() {
|
|
function save_data_when_entering_text() {
|
|
let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
|
|
let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
|
|
let index = $(tr).prevAll().length
|
|
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].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].Ref1 = $(tr).children('td:eq(14)').find('input').val()
|
|
bd_page[index].Ref2 = $(tr).children('td:eq(15)').find('input').val()
|
|
bd_page[index].Ref2 = $(tr).children('td:eq(15)').find('input').val()
|
|
}
|
|
}
|
|
|
|
|
|
- // 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 btn_bd_act_add() {
|
|
async function btn_bd_act_add() {
|
|
- console.log('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('#sales-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 btn_bd_act_body_copy(parameter_name) {
|
|
function btn_bd_act_body_copy(parameter_name) {
|
|
@@ -528,12 +522,10 @@
|
|
}
|
|
}
|
|
|
|
|
|
function btn_act_new() {
|
|
function btn_act_new() {
|
|
- console.log('btn_act_new');
|
|
|
|
data_init()
|
|
data_init()
|
|
-
|
|
|
|
- // if (formB['SlipCommonSetup']['IsNewRecAutoSlipNo']) {
|
|
|
|
|
|
+ if (formB['SlipCommonSetup']['IsNewRecAutoSlipNo']) {
|
|
get_last_slip_no()
|
|
get_last_slip_no()
|
|
- // }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
function btn_act_copy_to_another(parameter_name) {
|
|
function btn_act_copy_to_another(parameter_name) {
|
|
@@ -592,15 +584,13 @@
|
|
first_thumb = first_sales['TurboThumb']
|
|
first_thumb = first_sales['TurboThumb']
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // console.log('first_sales : ', bd_page[0]);
|
|
|
|
const itmtot_amt = bd_page.reduce((accumulator, bd) => {
|
|
const itmtot_amt = bd_page.reduce((accumulator, bd) => {
|
|
- // return accumulator + parseFloat(bd.SalesSupply) + parseFloat(bd.SalesVat) // 합계금액 (공급가액 + 세액)
|
|
|
|
- return accumulator + parseFloat(bd.SalesSupply)
|
|
|
|
|
|
+ return accumulator + parseFloat(bd.SalesSupply) + parseFloat(bd.SalesVat) // 합계금액 (공급가액 + 세액)
|
|
}, 0)
|
|
}, 0)
|
|
|
|
|
|
- // const total_qty = bd_page.reduce((accumulator, bd) => {
|
|
|
|
- // return accumulator + parseFloat(bd.PorderQty)
|
|
|
|
- // }, 0)
|
|
|
|
|
|
+ const total_qty = bd_page.reduce((accumulator, bd) => {
|
|
|
|
+ return accumulator + parseFloat(bd.SalesQty)
|
|
|
|
+ }, 0)
|
|
let id = parseInt($(`#frm`).find(`input[name="Id"]`).val());
|
|
let id = parseInt($(`#frm`).find(`input[name="Id"]`).val());
|
|
let parameter = {
|
|
let parameter = {
|
|
Id: id,
|
|
Id: id,
|
|
@@ -634,8 +624,12 @@
|
|
VatRate: vat_rate,
|
|
VatRate: vat_rate,
|
|
VatName: vat_name,
|
|
VatName: vat_name,
|
|
SgroupName: window.User['SgroupName'],
|
|
SgroupName: window.User['SgroupName'],
|
|
- //TotalQty : String(Number(total_qty) - 0),
|
|
|
|
- FirstThumb : first_thumb
|
|
|
|
|
|
+ // FirstThumb : first_thumb,
|
|
|
|
+ TotalQty : String(Number(total_qty) - 0)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (typeof first_thumb !== 'undefined') {
|
|
|
|
+ parameter.FirstThumb = first_thumb;
|
|
}
|
|
}
|
|
if (id < 0) {
|
|
if (id < 0) {
|
|
parameter = { Id: id }
|
|
parameter = { Id: id }
|
|
@@ -644,9 +638,6 @@
|
|
} else {
|
|
} else {
|
|
delete parameter.UpdatedOn;
|
|
delete parameter.UpdatedOn;
|
|
}
|
|
}
|
|
-
|
|
|
|
- console.log('save : ', parameter);
|
|
|
|
-
|
|
|
|
return parameter;
|
|
return parameter;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -723,14 +714,6 @@
|
|
$('#our-contact-select').html(our_contact);
|
|
$('#our-contact-select').html(our_contact);
|
|
}
|
|
}
|
|
|
|
|
|
- // function set_vat_type_rate($this, msg = true) {
|
|
|
|
- // let vate_rate = $($this).find('option:selected').data('viewvatrate');
|
|
|
|
- // console.log('vate_rate : ', vate_rate);
|
|
|
|
- // $('#vat-type-rate-text').val(vate_rate + '%')
|
|
|
|
-
|
|
|
|
- // if (parseInt($(`#frm`).find(`input[name="Id"]`).val()) == 0 || ! msg) return;
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
function set_vat_type_rate($this, msg = true) {
|
|
function set_vat_type_rate($this, msg = true) {
|
|
let vate_rate = $($this).find('option:selected').data('viewvatrate');
|
|
let vate_rate = $($this).find('option:selected').data('viewvatrate');
|
|
$('#vat-type-rate-text').val(vate_rate + '%')
|
|
$('#vat-type-rate-text').val(vate_rate + '%')
|
|
@@ -747,6 +730,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
function get_bd_parameter(bd) {
|
|
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 id = parseInt(bd.Id);
|
|
|
|
|
|
let parameter = {
|
|
let parameter = {
|
|
@@ -755,13 +739,21 @@
|
|
UpdatedOn: get_now_time_stamp(),
|
|
UpdatedOn: get_now_time_stamp(),
|
|
SalesId: parseInt(bd.SalesId),
|
|
SalesId: parseInt(bd.SalesId),
|
|
SeqNo: bd.SeqNo,
|
|
SeqNo: bd.SeqNo,
|
|
|
|
+ ItemId: parseInt(bd.ItemId),
|
|
SalesQty: String(bd.SalesQty),
|
|
SalesQty: String(bd.SalesQty),
|
|
|
|
+ CostPrc: String(bd.SorderPrc),
|
|
SalesSupply: String(bd.SalesSupply),
|
|
SalesSupply: String(bd.SalesSupply),
|
|
SalesVat: String(bd.SalesVat),
|
|
SalesVat: String(bd.SalesVat),
|
|
SalesSum: String(bd.SalesSum),
|
|
SalesSum: String(bd.SalesSum),
|
|
- CostPrc: String(bd.CostPrc),
|
|
|
|
- Ip: window.User['Ip'],
|
|
|
|
- FirstThumb: bd.TurboThumb
|
|
|
|
|
|
+ // 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']
|
|
}
|
|
}
|
|
|
|
|
|
if (id < 0) {
|
|
if (id < 0) {
|
|
@@ -771,7 +763,6 @@
|
|
} else {
|
|
} else {
|
|
delete parameter.UpdatedOn;
|
|
delete parameter.UpdatedOn;
|
|
}
|
|
}
|
|
-
|
|
|
|
return parameter;
|
|
return parameter;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -795,17 +786,17 @@
|
|
Btype.btn_act_save('#sales-form #frm', async function () {
|
|
Btype.btn_act_save('#sales-form #frm', async function () {
|
|
let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
|
|
let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
|
|
let index = $(tr).prevAll().length
|
|
let index = $(tr).prevAll().length
|
|
-
|
|
|
|
- if (bd_page[index].SorderBdId == 0) {
|
|
|
|
- iziToast.error({
|
|
|
|
- title: 'Error',
|
|
|
|
- message: @json(_e('Action failed')),
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- // 필수텍스트가 안비어있으고 fouces out == 다음 tr 추가
|
|
|
|
- if (! dom_required_check($(tr).find(`input`))) {
|
|
|
|
|
|
+ // 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')) {
|
|
if ($($this).data('last')) {
|
|
let seq_no = await Btype.get_last_seq_no('sales', $('#auto-slip-no-txt').val())
|
|
let seq_no = await Btype.get_last_seq_no('sales', $('#auto-slip-no-txt').val())
|
|
bd_page[index].SeqNo = seq_no;
|
|
bd_page[index].SeqNo = seq_no;
|
|
@@ -837,11 +828,11 @@
|
|
let std_sales_price = $(tr).children('td:eq(11)')
|
|
let std_sales_price = $(tr).children('td:eq(11)')
|
|
|
|
|
|
$(qty).val( format_conver_for(minusComma($(qty).val()), formB.ListVars['Format'].SalesQty) )
|
|
$(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) )
|
|
$(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) )
|
|
$(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) )
|
|
$(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')) {
|
|
if ($($this).data('last')) {
|
|
add_tr();
|
|
add_tr();
|
|
@@ -890,7 +881,6 @@
|
|
}
|
|
}
|
|
|
|
|
|
function create_bd_page() {
|
|
function create_bd_page() {
|
|
- console.log('create_bd_page()');
|
|
|
|
let html = []
|
|
let html = []
|
|
let qty_total = 0, supply_total = 0, vat_amt_vat_total = 0, sum_total = 0;
|
|
let qty_total = 0, supply_total = 0, vat_amt_vat_total = 0, sum_total = 0;
|
|
bd_page.forEach(bd => {
|
|
bd_page.forEach(bd => {
|
|
@@ -940,7 +930,7 @@
|
|
<td onkeydown="Btype.handleEnterPressedinTabCell(event)"
|
|
<td onkeydown="Btype.handleEnterPressedinTabCell(event)"
|
|
class="text-${formB.ListVars['Align'].SorderPrc}" ${formB.ListVars['Hidden'].SorderPrc}
|
|
class="text-${formB.ListVars['Align'].SorderPrc}" ${formB.ListVars['Hidden'].SorderPrc}
|
|
>
|
|
>
|
|
- <input type="text" class="text-${formB.ListVars['Align'].SorderPrc} border-0 bg-white" value="${format_conver_for(bd.SorderPrc, formB.ListVars['Format'].SorderPrc)}" readonly
|
|
|
|
|
|
+ <input type="text" class="text-${formB.ListVars['Align'].SorderPrc} border-0 bg-white" value="${format_conver_for(bd.CostPrc, formB.ListVars['Format'].SorderPrc)}" readonly
|
|
onchange="Btype.check_the_checkbox_when_changing(this)"
|
|
onchange="Btype.check_the_checkbox_when_changing(this)"
|
|
onfocusout="override_amt_calc_txt_is_changed()"
|
|
onfocusout="override_amt_calc_txt_is_changed()"
|
|
require>
|
|
require>
|
|
@@ -964,7 +954,7 @@
|
|
<td onkeydown="Btype.handleEnterPressedinTabCell(event)"
|
|
<td onkeydown="Btype.handleEnterPressedinTabCell(event)"
|
|
class="text-${formB.ListVars['Align'].SumAmt}" ${formB.ListVars['Hidden'].SumAmt}
|
|
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.SorderSum, formB.ListVars['Format'].SumAmt)}" readonly
|
|
|
|
|
|
+ <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)"
|
|
onchange="Btype.check_the_checkbox_when_changing(this)"
|
|
onfocusout="override_custom_sum_amt()"
|
|
onfocusout="override_custom_sum_amt()"
|
|
required>
|
|
required>
|
|
@@ -972,15 +962,6 @@
|
|
<td
|
|
<td
|
|
class="text-${formB.ListVars['Align'].StdSalesPrc}" ${formB.ListVars['Hidden'].StdSalesPrc}>${format_conver_for(bd.StdSalesPrc, formB.ListVars['Format'].StdSalesPrc)}
|
|
class="text-${formB.ListVars['Align'].StdSalesPrc}" ${formB.ListVars['Hidden'].StdSalesPrc}>${format_conver_for(bd.StdSalesPrc, formB.ListVars['Format'].StdSalesPrc)}
|
|
</td>
|
|
</td>
|
|
-
|
|
|
|
- <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('YYYY-MM-DD')}" readonly
|
|
|
|
- onchange="Btype.check_the_checkbox_when_changing(this)"
|
|
|
|
- onfocusout="save_data_when_entering_text()"
|
|
|
|
- required>
|
|
|
|
- </td>
|
|
|
|
<td onkeydown="Btype.handleEnterPressedinTabCell(event)"
|
|
<td onkeydown="Btype.handleEnterPressedinTabCell(event)"
|
|
class="text-${formB.ListVars['Align'].Ref1}" ${formB.ListVars['Hidden'].Ref1}
|
|
class="text-${formB.ListVars['Align'].Ref1}" ${formB.ListVars['Hidden'].Ref1}
|
|
>
|
|
>
|
|
@@ -997,7 +978,7 @@
|
|
onfocusout="save_data_when_entering_text()">
|
|
onfocusout="save_data_when_entering_text()">
|
|
</td>
|
|
</td>
|
|
<td
|
|
<td
|
|
- class="text-${formB.ListVars['Align'].SorderMemo}" ${formB.ListVars['Hidden'].SordderMemo}>
|
|
|
|
|
|
+ class="text-${formB.ListVars['Align'].SalesMemo}" ${formB.ListVars['Hidden'].SorderMemo}>
|
|
<textarea style="max-height: 30px;" class="rounded w-100 bg-white memo-textarea" id="memo-textarea-${bd.Id}"
|
|
<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>
|
|
ondblclick="Btype.dblclick_memo_textarea(this, ${bd.Id})" role="button" readonly>${bd.SorderMemo}</textarea>
|
|
</td>
|
|
</td>
|
|
@@ -1010,7 +991,6 @@
|
|
$('#SumTotal').val(format_conver_for(sum_total, formB.ListVars['Format'].SumAmt));
|
|
$('#SumTotal').val(format_conver_for(sum_total, formB.ListVars['Format'].SumAmt));
|
|
|
|
|
|
document.getElementById('sales-table-body').innerHTML = html.join('');
|
|
document.getElementById('sales-table-body').innerHTML = html.join('');
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
async function add_tr() {
|
|
async function add_tr() {
|
|
@@ -1093,15 +1073,7 @@
|
|
<td
|
|
<td
|
|
class="text-${formB.ListVars['Align'].StdSalesPrc}" ${formB.ListVars['Hidden'].StdSalesPrc}>
|
|
class="text-${formB.ListVars['Align'].StdSalesPrc}" ${formB.ListVars['Hidden'].StdSalesPrc}>
|
|
</td>
|
|
</td>
|
|
- <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" readonly
|
|
|
|
- value="${moment().format('YYYY-MM-DD')}"
|
|
|
|
- onchange="Btype.check_the_checkbox_when_changing(this)"
|
|
|
|
- onfocusout="save_data_when_entering_text()"
|
|
|
|
- required>
|
|
|
|
- </td>
|
|
|
|
|
|
+
|
|
<td onkeydown="Btype.handleEnterPressedinTabCell(event)"
|
|
<td onkeydown="Btype.handleEnterPressedinTabCell(event)"
|
|
class="text-${formB.ListVars['Align'].Ref1}" ${formB.ListVars['Hidden'].Ref1}
|
|
class="text-${formB.ListVars['Align'].Ref1}" ${formB.ListVars['Hidden'].Ref1}
|
|
>
|
|
>
|
|
@@ -1110,14 +1082,17 @@
|
|
onfocusout="save_data_when_entering_text()">
|
|
onfocusout="save_data_when_entering_text()">
|
|
</td>
|
|
</td>
|
|
<td onkeydown="Btype.handleEnterPressedinTabCell(event)"
|
|
<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}
|
|
class="text-${formB.ListVars['Align'].Ref2}" ${formB.ListVars['Hidden'].Ref2}
|
|
>
|
|
>
|
|
<input type="text" class="text-${formB.ListVars['Align'].Ref2} border-0 bg-white" readonly
|
|
<input type="text" class="text-${formB.ListVars['Align'].Ref2} border-0 bg-white" readonly
|
|
onchange="Btype.check_the_checkbox_when_changing(this)"
|
|
onchange="Btype.check_the_checkbox_when_changing(this)"
|
|
onfocusout="save_data_when_entering_text()">
|
|
onfocusout="save_data_when_entering_text()">
|
|
</td>
|
|
</td>
|
|
- <td
|
|
|
|
|
|
+ <td
|
|
class="text-${formB.ListVars['Align'].SorderMemo}" ${formB.ListVars['Hidden'].SorderMemo}>
|
|
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>
|
|
</td>
|
|
</tr>`;
|
|
</tr>`;
|
|
|
|
|
|
@@ -1128,6 +1103,7 @@
|
|
}, 100);
|
|
}, 100);
|
|
|
|
|
|
bd_page.push({
|
|
bd_page.push({
|
|
|
|
+
|
|
cursorId: last_bd_id_inc,
|
|
cursorId: last_bd_id_inc,
|
|
Id: 0,
|
|
Id: 0,
|
|
ItemId: 0,
|
|
ItemId: 0,
|
|
@@ -1153,56 +1129,68 @@
|
|
}
|
|
}
|
|
|
|
|
|
function set_item_data_to_textbox(item) {
|
|
function set_item_data_to_textbox(item) {
|
|
- console.log('item : ', item);
|
|
|
|
let tr = $(`input[name='bd-cursor-state']:checked`).closest('tr')
|
|
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.PurchPrc).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].StdSalesPrc = item.PurchPrc
|
|
|
|
- // bd_page[index].StdPurchPrc = item.PurchPrc// override_amt_calc_txt_is_changed();
|
|
|
|
- // 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
|
|
|
|
- // }
|
|
|
|
|
|
+ $(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']))
|
|
|
|
+ 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.SalesPrc
|
|
|
|
+ bd_page[index].CurrSalesPrc = item.PurchPrc// 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
|
|
|
|
+ }
|
|
|
|
|
|
return $(tr).children('td:eq(6)').find('input')
|
|
return $(tr).children('td:eq(6)').find('input')
|
|
}
|
|
}
|
|
|
|
|
|
function update_hd_ui(response) {
|
|
function update_hd_ui(response) {
|
|
- console.log('update_hd_ui');
|
|
|
|
if (isEmpty(response.data) || response.data.apiStatus) {
|
|
if (isEmpty(response.data) || response.data.apiStatus) {
|
|
- console.log('isEmpty(response.data) || response.data.apiStatus');
|
|
|
|
$('#modal-slip').modal('hide');
|
|
$('#modal-slip').modal('hide');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ console.log(response);
|
|
Btype.set_slip_no_btn_disabled()
|
|
Btype.set_slip_no_btn_disabled()
|
|
|
|
|
|
let hd_page = response.data.HdPage[0]
|
|
let hd_page = response.data.HdPage[0]
|
|
bd_page = response.data.BdPage ?? []
|
|
bd_page = response.data.BdPage ?? []
|
|
- console.log('response : ', response);
|
|
|
|
|
|
+ let thumb = response.data.HdPage[0]['FirstThumb']
|
|
|
|
+
|
|
|
|
+ if(!thumb){
|
|
|
|
+ ThumbArr = thumb;
|
|
|
|
+ }
|
|
|
|
+
|
|
$('#Id').val(hd_page.Id)
|
|
$('#Id').val(hd_page.Id)
|
|
$('#auto-slip-no-txt').val(hd_page.SalesNo)
|
|
$('#auto-slip-no-txt').val(hd_page.SalesNo)
|
|
$('#sales-date').val(moment(to_date(hd_page.SalesDate)).format('YYYY-MM-DD'))
|
|
$('#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'))
|
|
$('#stock-date').val(moment(to_date(hd_page.StockDate)).format('YYYY-MM-DD'))
|
|
$('#sorder-no-txt').val(hd_page.SorderNo)
|
|
$('#sorder-no-txt').val(hd_page.SorderNo)
|
|
$('#sorder-no-txt').data('id', hd_page.SorderId)
|
|
$('#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')"))
|
|
$('#deal-type-txt').val(format_conver_for(hd_page.DealCode, "deal_type('deal-type')"))
|
|
$('#supplier-txt').val(hd_page.CompanyName)
|
|
$('#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-txt').data('contact', hd_page.BuyerContact)
|
|
$('#supplier-contact-txt').val(hd_page.BuyerContact)
|
|
$('#supplier-contact-txt').val(hd_page.BuyerContact)
|
|
|
|
|