feat: 2계좌 매도 팝업은 전량매도일 때만 + 매도 보유수량 현재/전체(그룹) 병기

- 팝업 조건: 입력 수량 == 매도가능 전량(max_qty)일 때만 sell-choice 팝업,
  일부매도는 팝업 없이 단일 진행. lastCheck 미수신 시에도 단일 진행
- 매도 정보영역: 같은 그룹 다른 계좌도 보유 시 '보유: 141주 / 전체 280주' 병기
  (단독 보유면 기존 표시 유지). 팝업 문구도 양쪽 '매도가능 전량'으로 통일

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hyowons
2026-06-12 15:16:23 +09:00
parent 5c884a0de6
commit 9239901028
+13 -5
View File
@@ -8723,8 +8723,14 @@ function renderOrderInfo(){
var pl = (price - avg) * qty;
var plCls = pl>=0?'pl-up':'pl-down';
var plSign = pl>=0?'+':'';
// 같은 소유자 그룹(본인 일반ISA / 가희끼리) 다른 계좌도 보유 중이면 현재계좌/전체 병기
var selAcc = (($('[data-order-account]')||{}).value) || '';
var sibAcc = selAcc ? siblingAccount(selAcc) : null;
var sibHold = (sibAcc && state.accStatus && state.accStatus.byLabel && state.accStatus.byLabel[sibAcc]) ? (state.accStatus.byLabel[sibAcc].hold_qty||0) : 0;
var holdPart = '보유: <b>'+fmt(d.hold_qty||0)+'</b>주';
if(sibHold > 0) holdPart += ' / 전체 <b>'+fmt((d.hold_qty||0)+sibHold)+'</b>주';
infoEl.innerHTML =
'보유: <b>'+fmt(d.hold_qty||0)+'</b>주 (매도가능 '+fmt(d.trde_able_qty||0)+'주)<br>'+
holdPart+' (매도가능 '+fmt(d.trde_able_qty||0)+'주)<br>'+
'평단가: <b>'+fmt(avg)+'</b>원<br>'+
'예상수익: <span class="'+plCls+'">'+plSign+fmt(pl)+'원</span> ('+fmt(qty)+'주 매도)<br>'+
'주문예상액: <b>'+fmt(amount)+'</b>원';
@@ -9153,12 +9159,14 @@ function doPropose(){
}
return;
}
// 매도인데 같은 소유자 그룹의 다른 계좌에도 같은 종목 보유 선택 팝업 ( 계좌 모두 / 선택 계좌만 / 취소)
// 전량매도(입력 수량 = 매도가능 전량)이고 같은 소유자 그룹의 다른 계좌에도 같은 종목 보유
// 선택 팝업 ( 계좌 모두 / 선택 계좌만 / 취소). 일부매도는 팝업 없이 단일 진행.
if(state.side === 'SELL'){
var fullSell = lc && typeof lc.max_qty === 'number' && lc.max_qty > 0 && qty === lc.max_qty;
var sib = siblingAccount(account);
var sibInfo = (sib && state.accStatus && state.accStatus.byLabel) ? state.accStatus.byLabel[sib] : null;
var sibQty = sibInfo ? (sibInfo.trde_able_qty || 0) : 0;
if(sibQty > 0){
if(fullSell && sibQty > 0){
openSellChoice({account: account, qty: qty, sibling: sib, siblingQty: sibQty, orderType: orderType, price: price});
return;
}
@@ -9233,8 +9241,8 @@ function openSellChoice(opts){
if(sum){
sum.innerHTML = '<b>' + (state.name || state.code) + '</b> 종목을 <b>' + (disp[opts.account]||opts.account) +
'</b> · <b>' + (disp[opts.sibling]||opts.sibling) + '</b> 두 계좌 모두 보유하고 있습니다.<br><br>' +
'· ' + (disp[opts.account]||opts.account) + ': <b>' + fmt(opts.qty) + '주</b> 매도 (입력 수량)<br>' +
'· ' + (disp[opts.sibling]||opts.sibling) + ': <b>' + fmt(opts.siblingQty) + '주</b> 매도 (보유 전량)<br>' +
'· ' + (disp[opts.account]||opts.account) + ': <b>' + fmt(opts.qty) + '주</b> 매도 (매도가능 전량)<br>' +
'· ' + (disp[opts.sibling]||opts.sibling) + ': <b>' + fmt(opts.siblingQty) + '주</b> 매도 (매도가능 전량)<br>' +
'· 단가: ' + priceStr + ' (두 계좌 동일)';
}
var sb = $sc('[data-sell-choice-single]');