feat(malaysia): 이동 이력 일자별 낱개 수량 엑셀 다운로드

기간 전체를 일자 x 낱개 아이템 피벗으로 내려받는 /movements/export-daily 추가.
콤보(세트) 출고는 등록 시 이미 BOM 으로 분해돼 구성 낱개 OUT movement 로
저장되므로 별도 분해 없이 낱개 기준 합계에 포함된다.

- db.movement_totals_by_date(): 기간/종류별 일자 x 아이템 합계
- 시트 '일자별'(행=날짜, 열=아이템, 합계 행/열) + '상세'(긴 형식, 자동필터)
- 이동 이력 카드에 종류/기간 선택 + 다운로드 버튼

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-09 23:33:23 +09:00
parent af87f317ab
commit bc6e2a3417
4 changed files with 202 additions and 0 deletions
@@ -123,6 +123,21 @@
+ '&date=' + encodeURIComponent(date);
window.location.href = url;
}
// 이동 이력 — 기간 전체를 일자별 낱개 수량(콤보는 BOM 분해 합산)으로 다운로드
function mysDownloadDaily(btn) {
var box = btn.closest('.mys-daily-dl');
var type = box.querySelector('[name=dl_type]').value;
var from = box.querySelector('[name=dl_from]').value;
var to = box.querySelector('[name=dl_to]').value;
var wh = box.getAttribute('data-wh');
if (from && to && from > to) { alert('시작일이 종료일보다 늦습니다.'); return; }
var url = '/malaysia/movements/export-daily?wh=' + encodeURIComponent(wh)
+ '&type=' + encodeURIComponent(type)
+ '&from=' + encodeURIComponent(from)
+ '&to=' + encodeURIComponent(to);
window.location.href = url;
}
</script>
<!-- 이동 이력 -->
@@ -142,6 +157,22 @@
{% endfor %}
</span>
</div>
<!-- 일자별 낱개 수량 엑셀 (기간 전체, 콤보는 낱개로 분해 합산) -->
<div class="mys-daily-dl" data-wh="{{ selected_wh }}"
style="display:flex;gap:6px;align-items:center;flex-wrap:wrap;padding:8px 0 12px;">
<span class="erp-muted i18n">일자별 낱개 수량 엑셀</span>
<select class="erp-input" name="dl_type" style="width:110px;">
{% for t in ['OUT','IN','ADJUST','STOCKTAKE'] %}
<option value="{{ t }}" {% if filter_type==t %}selected{% endif %}>{{ t }}</option>
{% endfor %}
</select>
<input class="erp-input" type="date" name="dl_from" value="" />
<span class="erp-muted">~</span>
<input class="erp-input" type="date" name="dl_to" value="" />
<button type="button" class="erp-btn erp-btn-outline i18n" onclick="mysDownloadDaily(this)">엑셀 다운로드</button>
<span class="erp-muted i18n" style="font-size:12px;">기간 비우면 전체 · 콤보는 낱개로 분해해 합산</span>
</div>
<div class="erp-table-wrap">
<table class="erp-table">
<thead><tr><th>Date</th><th class="i18n">구분</th><th>Type</th><th>Item</th><th style="text-align:right">Qty</th><th>Memo</th><th>By</th></tr></thead>