œ_#ÁÕ§TE NAŒ“KeÉ:”(åŽÖJÞùY’‚ñùž7; «]Û ý`8g“¯B© jdÖÖ¸ðzœ¸¦4Ç3Kó^(ÍÖ¼ Õ€pvìwšõB4df$Èü^0˜…åÌC$#2FŽÑ§±¦ÛZ/÷š&m£ñzÒÖ ’.Î]!Î;ƒ(Õ–¢d/—#Kª+tZyuÏB>NÛÖ†(¸ŒSà'³„Y˜´-_•¦¼´˜OlNK§¶ÒàŠˆTHµƒeTPå·fïM’…þuÏÍüp6دªE£åü‡ZØ'CKF#â«;‹eyO Qp„†l"ö1èíÙP ÏŒúl! BÝ2ñª•_VÁÉ÷3eu`–F¸ìI--ö<¿žë¯4õ캿¢)34Å{wMÉ2ÆÖFŸ¥`e9Ú¶¸P‡.”FÔï rY ‚²ÈTB,{ÛœéJ}«àQ4¹0Rû4D‚B§S‘ dO•v¾„™Sן¯3FeŸ™«+ÓâwH dÕÛÌì·P4ë&¥#rÜÉ Ù¦ê†ý·xòqk¯2,¹§™E\ék‚×Sá”ÚºÙ⺷ö£6…à ʾ qSá³Å|;àû}4Ÿ($â¹VY~óÍ!èÜÒŒËX½Ù1j‚VíÍŸš³+œ]«½g{_{/vµ½\¢¶vÉWKÿ:ñám½ ¥ S²x‘t ŽšÝÙÿÀÇ^ný PK IW™k‚½÷ á _rels/.relsUT dìd dìd dìd’ÏNÃ0‡ï{ŠÈ÷ÕÝ@¡¥» ¤Ý*`%îÑ&QâÁöö‚J£ì°cœŸ¿|¶²ÙÆA½rL½wVE Šñ¶w†çúay * 9Kƒw¬áÈ ¶ÕbóÄIîI]’Ê—4t"á1™ŽGJ…ìòMããH’±Å@æ…ZÆuYÞ`üÍ€jÂT;«!îì T}|Û7MoøÞ›ýÈNN<|v–í2ÄÜ¥ÏèšbË¢Ázó˜Ë )„"£OÏ7ú{ZYÈ’yÞç#1'tuÉM?6o>Z´_å9›ëKÚ˜}?þ³žÏÌ·N>fµx PK IWª½e ¢ U € word/document.xmlUT dìdPK IWþË3” z €J¢ word/settings.xmlUT dìdPK IWC‡{š' ƒ €¤ docProps/custom.xmlUT dìdPK IW츱=Œ €‡¥ [Content_Types].xmlUT dìdPK IWV%ë±" €U§ docProps/app.xmlUT dìdPK IW€RŒ 3 €¶¨ docProps/core.xmlUT dìdPK IWkòDn ô €ª word/_rels/document.xml.relsUT dìdPK IW;$î €Î« word/fontTable.xmlUT dìdPK IW+åäz] ÷. €ý¬ word/numbering.xmlUT dìdPK IW¤2×r- ¿ €›° word/styles.xmlUT dìdPK IWMFÒ ø €´ word/header1.xmlUT dìdPK IWF— T e €· word/media/image1.jpegUT dìdPK IW!Yéáå €°Ë word/media/image2.pngUT dìdPK IW°Àºë ú €ÙÌ word/media/image3.pngUT dìdPK IW$“†ª L €Î word/footer1.xmlUT dìdPK IWzaGôM €ñÑ word/footer2.xmlUT dìdPK IW–µâº P €}Õ word/theme/theme1.xmlUT dìdPK IW™k‚½÷ á €{Û _rels/.relsUT PK ! bîh^ [Content_Types].xml ¢( ¬”ËNÃ0E÷HüCä-Jܲ@5í‚Ç*Q>Àēƪc[žiiÿž‰ûB¡j7±ÏÜ{2ñÍh²nm¶‚ˆÆ»R‹ÈÀU^7/ÅÇì%¿’rZYï @1__f› ˜q·ÃR4DáAJ¬h>€ãÚÇV߯¹ªZ¨9ÈÛÁàNVÞ8Ê©ÓãÑÔji){^óã-I‹"{Üv^¥P!XS)bR¹rú—K¾s(¸3Õ`cÞ0†½ÝÎß»¾7M4²©ŠôªZÆk+¿|\|z¿(Ž‹ôPúº6h_-[ž@!‚ÒØ Pk‹´2nÏ}Ä?£LËð Ýû%áÄßdºždN"m,à¥ÇžDO97*‚~§Èɸ8ÀOíc|n¦Ñ äEøÿöéºóÀBÉÀ!$}‡íàÈé;{ìÐå[ƒîñ–é2þ ÿÿ PK ! µU0#ô L _rels/.rels ¢( ¬’MOÃ0†ïHü‡È÷ÕÝBKwAH»!T~€Iܵ£$Ý¿'TƒG½~üÊÛÝ<êÈ!öâ4¬‹;#¶w†—úqu *&r–Fq¬áÄvÕõÕö™GJy(v½*«¸¨¡KÉß#FÓñD±Ï.W ¥†=™ZÆMYÞbø®ÕBS톰·7 ê“Ï›×–¦é ?ˆ9LìÒ™ÈsbgÙ®|Èl!õùUSh9i°bžr:"y_dlÀóD›¿ý|-NœÈR"4ø2ÏGÇ% õZ´4ñËyÄ7 ëÈðÉ‚‹¨Þ ÿÿ PK ! Q48wÛ — xl/workbook.xml¤UÙnâ0}iþ!cñ‡ *–¢AšVU×$dC¬&vÆv UÕŸë@XÊK§/¹p|Žï¹N÷b“¥Ö •Š ÞC¸î"‹òHÄŒ¯zèá~b·‘¥4á1I§=ôJºèÿüÑ] ù¼âÙ ®z(Ñ:GE ͈ª‹œrˆ,…̈†©\9*—”Ä*¡Tg©ã¹nàd„q´Eåg0ÄrÉ":Q‘Q®· ’¦D}•°\UhYô¸ŒÈç"·#‘å ±`)Ó¯%(²²(œ®¸d‘‚ì nZ w v¡ñª• t¶TÆ")”Xê:@;[Ògú±ë`|²›ó=ø’ïHúÂL÷¬dðEVÁ+8€a÷Ûh¬Uz%„Íû"ZsÏÍCýî’¥ôqk]‹äù5ÉL¦Rd¥Dé˘i÷P ¦bM/|dÉ",…¨çãFNoçiûéë>aêiçsó#ðÄ ÕTr¢éHp ÜIú®ÝJìQ"ÀÜÖ-ý[0I¡¦ÀZ Z…d¡nˆN¬B¦=4 g %PDF-1.4 %âãÏÓ 3 0 obj << /Linearized 1 /L 422775 ÿØÿà JFIF ÿÛ C ÿÛ C ÿÀ X" ÿÄ ÿÄ H !1A"Qaq2‘¡#±ÁBRÑ3Cbrá$S‚¢²ð4ñ%6DTc’ÂsÿÄ ÿÄ = !1AQ"aq‘Á2R¡±BÑð#3br’²4á$‚¢ÂñÿÚ ? áHBßÝ`„! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! ! stream
<?php
include 'connection/config.php';
// ---------- READ latest 24K rate ----------
$stmt = $pdo->query("SELECT * FROM gold_rates WHERE purity='24KT' ORDER BY effective_date DESC LIMIT 1");
$rate_24k = $stmt->fetch();
$price_24k = $rate_24k ? floatval($rate_24k['price_per_gram']) : 0;
// ---------- Karat ratios ----------
$karat_ratios = [
'24K' => 1,
'22K' => 22 / 24,
'18K' => 18 / 24,
'14K' => 14 / 24,
'9K' =>9/24
];
// ---------- Calculate rates for each purity ----------
$prices = [];
foreach ($karat_ratios as $karat => $ratio) {
$prices[$karat] = $price_24k * $ratio;
}
?>
<!-- Gold Calculator Modal -->
<div class="modal fade" id="goldCalculatorModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg modal-fullscreen-sm-down">
<div class="modal-content border-0 shadow-lg rounded-4 overflow-hidden">
<div class="modal-body p-0 position-relative d-flex flex-column">
<!-- Close button -->
<button type="button"
class="btn-close position-absolute top-0 end-0 m-3 bg-white rounded-circle shadow-sm"
data-bs-dismiss="modal"
aria-label="Close"></button>
<div class="row g-0 flex-grow-1 h-100 overflow-auto">
<!-- Left side: Calculator Form -->
<div class="col-12 col-md-6 d-flex flex-column form-side">
<div class="flex-grow-1 p-4">
<h3 class="mb-4 fw-bold text-center gold-title">💎 Gold Calculator</h3>
<form id="goldCalcForm" class="gold-form">
<div class="row g-3">
<!-- Gold Purity -->
<div class="col-12 col-sm-6">
<label for="purity" class="form-label fw-semibold">Gold Purity</label>
<select id="purity" class="form-select rounded-3 shadow-sm">
<?php foreach($prices as $karat => $rate): ?>
<option value="<?= $rate*10 ?>" <?= $karat=='24K'?'selected':'' ?>>
<?= $karat ?>
</option>
<?php endforeach; ?>
</select>
</div>
<!-- Gold Rate -->
<div class="col-12 col-sm-6">
<label for="rate" class="form-label fw-semibold">Gold Rate (per 10g ₹)</label>
<input type="number" id="rate" class="form-control rounded-3 shadow-sm"
value="<?= $prices['24K']*10 ?>" min="0">
</div>
<!-- Weight -->
<div class="col-12 col-sm-6">
<label for="weight" class="form-label fw-semibold">Weight (grams)</label>
<input type="number" id="weight" class="form-control rounded-3 shadow-sm" value="10" min="0">
</div>
<!-- Making Charges (%) -->
<div class="col-12 col-sm-6">
<label for="making" class="form-label fw-semibold">Making Charges (%)</label>
<input type="number" id="making" class="form-control rounded-3 shadow-sm" value="2" min="0">
</div>
<!-- Hallmark Charge -->
<div class="col-12 col-sm-6">
<label for="hallmark" class="form-label fw-semibold">Hallmark Charge (per piece ₹)</label>
<input type="number" id="hallmark" class="form-control rounded-3 shadow-sm" value="50" min="0">
</div>
<!-- Quantity -->
<div class="col-12 col-sm-6">
<label for="quantity" class="form-label fw-semibold">Product Quantity</label>
<input type="number" id="quantity" class="form-control rounded-3 shadow-sm" value="1" min="1">
</div>
<!-- Discount -->
<div class="col-12">
<label for="discount" class="form-label fw-semibold">Discount (%)</label>
<input type="number" id="discount" class="form-control rounded-3 shadow-sm" value="2" min="0">
</div>
<!-- GST Checkbox -->
<div class="col-12">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="gst" checked>
<label class="form-check-label fw-semibold ms-lg-1 mt-lg-1" for="gst">Include GST (3%)</label>
</div>
</div>
</div>
<!-- Reset button -->
<div class="p-3">
<button type="reset" id="reset" class="btn w-100 rounded-3 shadow-sm reset">Reset</button>
</div>
</form>
</div>
</div>
<!-- Right side: Result -->
<div class="col-12 col-md-6 d-flex flex-column result-side">
<div class="flex-grow-1 p-4">
<h3 class="mb-4 fw-bold text-white text-center">📊 Calculation Result</h3>
<ul class="list-unstyled fs-6 mb-4 result-list">
<li><span>Total Gold Price:</span> <strong>₹<span id="gold-price">0</span></strong></li>
<li><span>Making Charges:</span> <strong>₹<span id="making-price">0</span></strong></li>
<li><span>GST:</span> <strong>₹<span id="gst-price">0</span></strong></li>
<li><span>Discount:</span> <strong>- ₹<span id="discount-price">0</span></strong></li>
<li><span>Hallmark Charge (Total):</span> <strong>₹<span id="hallmark-price">0</span></strong></li>
<li><span>Price Per Piece:</span> <strong>₹<span id="per-piece-price">0</span></strong></li>
</ul>
</div>
<div class="p-4">
<div class="text-center p-4 final-box rounded-3 shadow-lg">
<h4 class="fw-bold mb-0">Final Price (All Pieces)</h4>
<h2 class="fw-bold gold-gradient mt-2">₹<span id="final-price">0</span></h2>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<style>
.modal-dialog { max-width: 80vw; margin: auto; }
.modal-content { max-height: 90vh; }
.form-side { background: linear-gradient(135deg, #fff, #fdf6f6); }
.result-side { background: linear-gradient(135deg, #800010, #b30b2fff); color: #f1f1f1; }
.gold-title { background: -webkit-linear-gradient(45deg, #800000, #ed5561ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.final-box { background: #fff; border: 2px solid #800000; box-shadow: 0 0 20px rgba(212,175,55,0.4); }
.gold-gradient { background: -webkit-linear-gradient(45deg, #800000, #ed5561ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: 2rem; }
.result-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed rgba(255,255,255,0.3); }
.reset { background: -webkit-linear-gradient(45deg, #800000, #e21f2fff); color:#fff; }
@media (max-width: 768px) {
.modal-dialog { max-width: 100% !important; }
.modal-content { border-radius: 0 !important; height: 100vh !important; }
.form-side, .result-side { min-height: auto; }
}
</style>
<script>
// Truncate a number to 2 decimals without rounding
function truncateTwoDecimals(num) {
return Math.floor(num * 100) / 100;
}
const hallmarkInput = document.getElementById("hallmark");
const quantityInput = document.getElementById("quantity");
const baseHallmark = 50; // per-piece hallmark
// Recalculate and update hallmark input when quantity changes
quantityInput.addEventListener("input", function() {
let quantity = parseInt(this.value) || 1;
hallmarkInput.value = baseHallmark * quantity; // show total hallmark in input
calculateGold();
});
// Reset button restores values
document.getElementById("reset").addEventListener("click", function() {
quantityInput.value = 1;
hallmarkInput.value = baseHallmark;
calculateGold();
});
function calculateGold() {
let ratePer10g = parseFloat(document.getElementById("rate").value);
let weight = parseFloat(document.getElementById("weight").value);
let makingPercent = parseFloat(document.getElementById("making").value) || 0;
let gstChecked = document.getElementById("gst").checked;
let discount = parseFloat(document.getElementById("discount").value) || 0;
let quantity = parseInt(quantityInput.value) || 1;
// Use baseHallmark (per piece) for calculations
let hallmarkPerPiece = baseHallmark;
if (isNaN(weight) || isNaN(ratePer10g)) return;
let ratePerGram = ratePer10g / 10;
let goldPrice = ratePerGram * weight;
let makingPrice = (makingPercent / 100) * goldPrice;
let gstPrice = gstChecked ? 0.03 * (goldPrice + makingPrice) : 0;
let discountPrice = ((goldPrice + makingPrice + gstPrice) * discount) / 100;
let pricePerPiece = goldPrice + makingPrice + gstPrice - discountPrice + hallmarkPerPiece;
let totalHallmark = hallmarkPerPiece * quantity;
let finalPrice = pricePerPiece * quantity;
// Update results
document.getElementById("gold-price").innerText = goldPrice.toFixed(2);
document.getElementById("making-price").innerText = makingPrice.toFixed(2);
document.getElementById("gst-price").innerText = gstPrice.toFixed(2);
document.getElementById("discount-price").innerText = discountPrice.toFixed(2);
document.getElementById("hallmark-price").innerText = totalHallmark.toFixed(2);
document.getElementById("per-piece-price").innerText = pricePerPiece.toFixed(2);
document.getElementById("final-price").innerText = finalPrice.toFixed(2);
}
// Update rate when purity changes
document.getElementById("purity").addEventListener("change", function() {
let truncatedRate = Math.floor(parseFloat(this.value) * 100) / 100;
document.getElementById("rate").value = truncatedRate.toFixed(2);
calculateGold();
});
// Update calculation on any input change
document.querySelectorAll("#goldCalcForm input, #goldCalcForm select").forEach(el => {
el.addEventListener("input", calculateGold);
el.addEventListener("change", calculateGold);
});
// Initial calculation
document.addEventListener("DOMContentLoaded", function() {
hallmarkInput.value = baseHallmark; // initialize input
calculateGold();
});
</script>