ツール管理へ戻るv1 のソース
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>原価単価 転記支援</title>
<style>
:root {
color-scheme: light;
--ink: #1f2937;
--muted: #5b6472;
--line: #d7dee8;
--surface: #ffffff;
--background: #f3f6fa;
--primary: #174ea6;
--primary-dark: #123d82;
--info: #edf4ff;
--warning: #fff7e6;
--warning-line: #e7ad37;
--success: #edf8f0;
--success-line: #30834d;
--danger: #a32020;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
background: var(--background);
color: var(--ink);
font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans JP",
"Yu Gothic UI", Meiryo, sans-serif;
line-height: 1.6;
}
main {
width: min(920px, calc(100% - 32px));
margin: 32px auto;
}
header,
section {
background: var(--surface);
border: 1px solid var(--line);
border-radius: 12px;
padding: 24px;
margin-bottom: 16px;
box-shadow: 0 2px 8px rgba(25, 40, 65, 0.04);
}
h1 {
margin: 0 0 8px;
font-size: clamp(1.45rem, 3vw, 2rem);
line-height: 1.3;
}
h2 {
margin: 0 0 14px;
font-size: 1.15rem;
}
p {
margin: 8px 0;
}
.lead,
.muted {
color: var(--muted);
}
.notice {
border-left: 4px solid var(--warning-line);
background: var(--warning);
padding: 12px 14px;
border-radius: 6px;
margin-top: 16px;
}
.info {
border-left: 4px solid var(--primary);
background: var(--info);
padding: 12px 14px;
border-radius: 6px;
}
.grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.field {
display: flex;
flex-direction: column;
gap: 6px;
}
.field.full {
grid-column: 1 / -1;
}
label {
font-weight: 650;
}
.hint {
color: var(--muted);
font-size: 0.9rem;
}
input,
select,
textarea,
button {
font: inherit;
}
input,
select,
textarea {
width: 100%;
border: 1px solid #aab5c4;
border-radius: 7px;
padding: 10px 12px;
background: #fff;
color: var(--ink);
}
input:focus,
select:focus,
textarea:focus,
button:focus-visible {
outline: 3px solid rgba(23, 78, 166, 0.22);
outline-offset: 1px;
border-color: var(--primary);
}
textarea {
min-height: 84px;
resize: vertical;
}
.actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: 18px;
}
button {
border: 0;
border-radius: 7px;
padding: 10px 16px;
cursor: pointer;
font-weight: 650;
}
.primary {
color: #fff;
background: var(--primary);
}
.primary:hover {
background: var(--primary-dark);
}
.secondary {
color: var(--ink);
background: #e8edf4;
}
.danger {
color: var(--danger);
background: #fff0f0;
border: 1px solid #e4b6b6;
}
.result {
display: none;
}
.result.visible {
display: block;
}
.status {
background: var(--success);
border-left: 4px solid var(--success-line);
padding: 12px 14px;
border-radius: 6px;
margin: 10px 0 16px;
}
.checklist {
padding-left: 1.25rem;
}
.checklist li {
margin: 7px 0;
}
.mapping {
width: 100%;
border-collapse: collapse;
margin: 12px 0;
}
.mapping th,
.mapping td {
border: 1px solid var(--line);
padding: 9px 10px;
text-align: left;
vertical-align: top;
}
.mapping th {
background: #f0f3f8;
width: 34%;
}
.small {
font-size: 0.9rem;
}
footer {
color: var(--muted);
font-size: 0.88rem;
padding: 4px 2px 20px;
}
@media (max-width: 640px) {
main {
width: min(100% - 20px, 920px);
margin: 16px auto;
}
header,
section {
padding: 18px;
}
.grid {
grid-template-columns: 1fr;
}
.field.full {
grid-column: auto;
}
.mapping th {
width: 40%;
}
}
@media print {
body {
background: #fff;
}
main {
width: 100%;
margin: 0;
}
header,
section {
box-shadow: none;
break-inside: avoid;
}
.actions,
footer {
display: none;
}
}
</style>
</head>
<body>
<main>
<header>
<h1>原価単価 転記支援</h1>
<p class="lead">
原価算出マスターシートの「単価」を、原価報告書の「原価(単価)」へ反映するための確認・手順作成ツールです。
</p>
<div class="notice">
<strong>重要:</strong>
このページはExcelファイルを読み書きしません。共有フォルダ上のブックをブラウザから直接変更する機能もありません。
対応する工程・セル番地を確認し、Excelで転記してください。
</div>
</header>
<section aria-labelledby="facts-title">
<h2 id="facts-title">確認済みの運用情報</h2>
<table class="mapping">
<tbody>
<tr>
<th scope="row">利用環境</th>
<td>Microsoft Excel 2019 MSO(バージョン 2508、ビルド 16.0.19127.20800、32ビット)</td>
</tr>
<tr>
<th scope="row">ファイル保管場所</th>
<td>社内の共有フォルダ</td>
</tr>
<tr>
<th scope="row">同時編集</th>
<td>複数担当者による同一ブックの同時編集はない</td>
</tr>
<tr>
<th scope="row">転記したい項目</th>
<td>原価算出マスターシートの「単価」から、原価報告書の「原価(単価)」へ</td>
</tr>
</tbody>
</table>
<p class="small muted">
アップロード資料のテキスト化内容では、原価報告書に工程名の一覧と「原価(単価)」欄があります。
原価算出マスターには工程別の単価項目がありますが、実際のセル番地と工程ごとの対応は読み取れません。
</p>
</section>
<section aria-labelledby="input-title">
<h2 id="input-title">転記内容を指定</h2>
<form id="transferForm">
<div class="grid">
<div class="field">
<label for="process">工程名</label>
<input id="process" name="process" type="text"
placeholder="例:洗浄、工程内検査、購入品" required>
<span class="hint">マスター側と報告書側で同じ工程に対応する名称を入力してください。</span>
</div>
<div class="field">
<label for="unitPrice">マスターの単価</label>
<input id="unitPrice" name="unitPrice" type="number"
min="0" step="any" inputmode="decimal" placeholder="例:12.5" required>
<span class="hint">マスターシートに表示されている単価を入力します。</span>
</div>
<div class="field">
<label for="masterCell">マスター側のセル番地(任意)</label>
<input id="masterCell" name="masterCell" type="text"
placeholder="例:H42">
</div>
<div class="field">
<label for="reportCell">報告書側のセル番地(任意)</label>
<input id="reportCell" name="reportCell" type="text"
placeholder="例:C8">
</div>
<div class="field full">
<label for="notes">確認メモ(任意)</label>
<textarea id="notes" name="notes"
placeholder="例:数量行1に対応。単価の単位が円/個であることを確認。"></textarea>
</div>
</div>
<div class="actions">
<button class="primary" type="submit">転記手順を表示</button>
<button class="secondary" type="reset">入力をクリア</button>
</div>
</form>
</section>
<section id="result" class="result" aria-live="polite" aria-labelledby="result-title">
<h2 id="result-title">転記内容と手順</h2>
<div id="status" class="status"></div>
<table class="mapping">
<tbody>
<tr>
<th scope="row">工程</th>
<td id="outProcess"></td>
</tr>
<tr>
<th scope="row">単価</th>
<td id="outPrice"></td>
</tr>
<tr>
<th scope="row">コピー元</th>
<td id="outMasterCell"></td>
</tr>
<tr>
<th scope="row">貼り付け先</th>
<td id="outReportCell"></td>
</tr>
</tbody>
</table>
<h3>Excelでの作業</h3>
<ol class="checklist">
<li>共有フォルダの原価算出マスターを開き、入力した工程の単価セルを確認します。</li>
<li>同じ工程に対応する原価報告書の「原価(単価)」欄を確認します。</li>
<li>単価の値と単位(例:円/個)を確認してから、報告書の該当セルへ値を入力します。</li>
<li>報告書の「数量×原価」や金額が、入力した単価・数量と整合することを確認します。</li>
<li>保存後、ファイルを開き直して値が保持されていることを確認します。</li>
</ol>
<div class="info small">
<strong>注意:</strong>
マスターシートの「単価」がどの工程・セルに対応するか、また報告書のどの行に転記するかは、
資料のテキスト化内容だけでは確定できません。実ファイルの見出し、セル位置、単位、
工程内容を照合してから転記してください。
</div>
<div class="actions">
<button id="copyButton" class="primary" type="button">手順をコピー</button>
<button id="printButton" class="secondary" type="button">印刷</button>
</div>
</section>
<footer>
入力値はこのページ内でのみ処理します。ネットワーク通信、ブラウザへの自動保存、ログイン機能はありません。
ページを閉じると入力内容は保持されません。
</footer>
</main>
<script>
"use strict";
const form = document.getElementById("transferForm");
const result = document.getElementById("result");
function setText(id, value) {
document.getElementById(id).textContent = value;
}
function formatPrice(value) {
const number = Number(value);
if (!Number.isFinite(number)) {
return value;
}
return new Intl.NumberFormat("ja-JP", {
maximumFractionDigits: 10
}).format(number);
}
function buildInstructions(data) {
const lines = [
"原価単価の転記手順",
"工程:" + data.process,
"マスター単価:" + formatPrice(data.unitPrice),
"コピー元セル:" + (data.masterCell || "未指定。実ファイルで確認"),
"貼り付け先セル:" + (data.reportCell || "未指定。実ファイルで確認"),
"",
"1. 原価算出マスターで工程名と単価セルを確認する。",
"2. 原価報告書で同じ工程に対応する「原価(単価)」欄を確認する。",
"3. 単価の値・単位・工程の対応を照合して入力する。",
"4. 数量×原価および金額の整合を確認して保存する。",
"注意:このページはExcelを直接編集しない。セル位置と対応関係は実ファイルで確認する。"
];
if (data.notes) {
lines.push("", "確認メモ:" + data.notes);
}
return lines.join("\n");
}
form.addEventListener("submit", function (event) {
event.preventDefault();
if (!form.reportValidity()) {
return;
}
const data = {
process: document.getElementById("process").value.trim(),
unitPrice: document.getElementById("unitPrice").value,
masterCell: document.getElementById("masterCell").value.trim(),
reportCell: document.getElementById("reportCell").value.trim(),
notes: document.getElementById("notes").value.trim()
};
if (!data.process || data.unitPrice === "") {
return;
}
setText("outProcess", data.process);
setText("outPrice", formatPrice(data.unitPrice));
setText("outMasterCell", data.masterCell || "未指定(実ファイルで確認)");
setText("outReportCell", data.reportCell || "未指定(実ファイルで確認)");
setText(
"status",
"転記候補を整理しました。工程・単位・セル位置をExcel上で確認してから転記してください。"
);
result.classList.add("visible");
result.scrollIntoView({ behavior: "smooth", block: "start" });
result.dataset.instructions = buildInstructions(data);
});
document.getElementById("copyButton").addEventListener("click", async function () {
const text = result.dataset.instructions || "";
if (!text) {
return;
}
try {
await navigator.clipboard.writeText(text);
this.textContent = "コピーしました";
window.setTimeout(() => {
this.textContent = "手順をコピー";
}, 1800);
} catch (error) {
const temporary = document.createElement("textarea");
temporary.value = text;
temporary.setAttribute("readonly", "");
temporary.style.position = "fixed";
temporary.style.left = "-9999px";
document.body.appendChild(temporary);
temporary.select();
let copied = false;
try {
copied = document.execCommand("copy");
} finally {
temporary.remove();
}
this.textContent = copied ? "コピーしました" : "コピーできませんでした";
window.setTimeout(() => {
this.textContent = "手順をコピー";
}, 1800);
}
});
document.getElementById("printButton").addEventListener("click", function () {
window.print();
});
form.addEventListener("reset", function () {
result.classList.remove("visible");
delete result.dataset.instructions;
});
</script>
</body>
</html>