<!DOCTYPE html>

<html lang="mr">

<head>

  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>एच.पी. सिलेंडर मल्टी-वेंडर सॉफ्टवेअर</title>

  <style>

    :root {

      --primary: #003366;

      --secondary: #e6b800;

      --bg: #eef2f5;

      --text: #333;

    }

    body { font-family: 'Segoe UI', Arial, sans-serif; margin: 0; background: var(--bg); color: var(--text); font-size: 13px; }

    

    header { 

      background: var(--primary); 

      color: white; 

      padding: 8px 15px; 

      display: flex; 

      align-items: center; 

      justify-content: space-between; 

      position: relative;

    }

    

    .header-left { display: flex; align-items: center; gap: 12px; }


    .app-logo {

      height: 40px;

      width: auto;

      background: white;

      padding: 2px;

      border-radius: 4px;

      object-fit: contain;

    }


    .header-titles h2 { margin: 0; font-size: 16px; }

    

    .owner-tag {

      font-size: 10px;

      color: #ffda79;

      font-weight: 600;

      margin-right: 10px;

      white-space: nowrap;

    }


    nav { display: flex; background: #002244; overflow-x: auto; }

    nav button { background: none; border: none; color: white; padding: 8px 12px; cursor: pointer; font-size: 13px; white-space: nowrap; }

    nav button:hover, nav button.active { background: var(--secondary); color: black; font-weight: bold; }

    

    .container { padding: 12px; max-width: 1000px; margin: auto; }

    .card { background: white; padding: 15px; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin-bottom: 15px; }

    .card h3 { margin-top: 0; margin-bottom: 12px; font-size: 15px; color: var(--primary); border-bottom: 1.5px solid var(--primary); padding-bottom: 4px; display: flex; justify-content: space-between; align-items: center; }

    

    .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 12px; }

    .form-group { margin-bottom: 4px; }

    label { display: block; margin-bottom: 2px; font-weight: 600; font-size: 12px; }

    input, select { width: 100%; padding: 6px 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 12px; }

    

    .btn-submit { background: var(--primary); color: white; font-weight: bold; border: none; cursor: pointer; padding: 8px; border-radius: 4px; font-size: 13px; margin-top: 10px; width: 100%; }

    .btn-submit:hover { background: #001f3f; }

    .logout-btn { background: #dc3545; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 11px; font-weight: bold; }

    .btn-print { background: #17a2b8; color: white; border: none; padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 11px; font-weight: bold; }

    

    table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }

    th, td { border: 1px solid #ddd; padding: 6px 8px; text-align: left; }

    th { background: #f2f2f2; }

    

    .btn-edit { background: #ffc107; color: #000; border: none; padding: 3px 6px; border-radius: 3px; cursor: pointer; font-size: 11px; font-weight: bold; }

    .btn-delete { background: #dc3545; color: #fff; border: none; padding: 3px 6px; border-radius: 3px; cursor: pointer; font-size: 11px; font-weight: bold; margin-left: 2px; }

    .btn-receipt-print { background: #28a745; color: #fff; border: none; padding: 3px 6px; border-radius: 3px; cursor: pointer; font-size: 11px; font-weight: bold; margin-left: 2px; }

    .btn-activate { background: #28a745; color: #fff; border: none; padding: 4px 8px; border-radius: 3px; cursor: pointer; font-size: 11px; font-weight: bold; }

    .btn-reset-pass { background: #17a2b8; color: #fff; border: none; padding: 4px 8px; border-radius: 3px; cursor: pointer; font-size: 11px; font-weight: bold; margin-left: 4px; }

    

    .auth-box { max-width: 340px; margin: 30px auto; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); text-align: center; }

    .toggle-auth-btn { background: #6c757d; color: white; margin-top: 8px; cursor: pointer; padding: 6px; border-radius: 4px; font-size: 12px; border: none; width: 100%; }

    .forgot-btn { background: none; border: none; color: #0056b3; cursor: pointer; text-decoration: underline; font-size: 11px; margin-top: 8px; }


    /* Paywall Screen & Modal */

    .paywall-modal { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.85); z-index: 9999; justify-content: center; align-items: center; }

    .paywall-box { background: white; padding: 20px; border-radius: 10px; max-width: 400px; width: 90%; text-align: center; max-height: 90vh; overflow-y: auto; }

    .qr-img { width: 160px; border: 2px solid #ddd; border-radius: 8px; margin: 8px 0; }

    .status-badge { padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: bold; }

    .active-bg { background: #d4edda; color: #155724; }

    .expired-bg { background: #f8d7da; color: #721c24; }

    .pending-bg { background: #fff3cd; color: #856404; }

    

    .plan-box { border: 1px solid #ddd; padding: 8px; border-radius: 6px; margin-bottom: 8px; text-align: left; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }

    .plan-box:hover { border-color: var(--primary); background: #f8f9fa; }


    @media print {

      body * { visibility: hidden; }

      #printableArea, #printableArea * { visibility: visible; }

      #printableArea { position: absolute; left: 0; top: 0; width: 100%; }

    }


    .receipt-copy {

      border: 2px dashed #333;

      padding: 12px;

      margin-bottom: 20px;

      height: 420px;

      box-sizing: border-box;

    }

  </style>

</head>

<body>


<!-- AUTH SECTION -->

<div id="authSection">

  <div id="loginCard" class="auth-box">

    <img src="logo.png" alt="VM India Logo" class="app-logo" style="height: 60px; margin-bottom: 10px;">

    <h2 style="color: var(--primary); margin-top: 0; font-size: 18px;">दुकानदार / ॲडमिन लॉगिन</h2>

    <form onsubmit="handleLogin(event)" style="text-align: left;">

      <div class="form-group"><label>मोबाईल नंबर / आयडी</label><input type="text" id="loginUser" placeholder="उदा. 9876543210 किंवा admin" required></div>

      <div class="form-group"><label>पासवर्ड</label><input type="password" id="loginPass" placeholder="पासवर्ड" required></div>

      <button type="submit" class="btn-submit">लॉगिन करा</button>

    </form>

    <button type="button" class="forgot-btn" onclick="showForgotInfo()">पासवर्ड विसरलात? (Forgot Password)</button>

    <hr style="margin: 12px 0;">

    <button type="button" class="toggle-auth-btn" onclick="openRegisterForm()">नवीन नोंदणी (Register) करा</button>

  </div>


  <div id="registerCard" class="auth-box" style="display:none;">

    <img src="logo.png" alt="VM India Logo" class="app-logo" style="height: 60px; margin-bottom: 10px;">

    <h2 style="color: var(--primary); margin-top: 0; font-size: 18px;">नवीन दुकान नोंदणी</h2>

    <form onsubmit="handleRegister(event)" style="text-align: left;">

      <div class="form-group"><label>दुकानाचे / एजन्सीचे नाव</label><input type="text" id="regShop" placeholder="उदा. श्री गणेश गॅस" required></div>

      <div class="form-group"><label>मोबाईल नंबर (लॉगिन आयडी)</label><input type="tel" id="regUser" pattern="[0-9]{10}" placeholder="१० अंकी मोबाईल नंबर" required></div>

      <div class="form-group"><label>पासवर्ड तयार करा</label><input type="password" id="regPass" placeholder="पासवर्ड टाका" required></div>

      <button type="submit" class="btn-submit" style="background: #28a745;">खाते तयार करा</button>

    </form>

    <hr style="margin: 15px 0;">

    <button type="button" class="toggle-auth-btn" onclick="openLoginForm()">आधीच खाते आहे? लॉगिन करा</button>

  </div>

</div>


<!-- ADMIN PANEL SECTION -->

<div id="adminSection" style="display:none;">

  <header style="background: #222;">

    <div class="header-left">

      <img src="logo.png" alt="VM India Logo" class="app-logo">

      <div class="header-titles">

        <h2>ॲडमिन कंट्रोल पॅनल (Admin Panel)</h2>

        <div style="font-size: 11px; color: #ccc;">वेंडर खाते व रिचार्ज पडताळणी</div>

      </div>

    </div>

    <div style="display:flex; align-items:center;">

      <span class="owner-tag">Software Owner - Vrundesh</span>

      <button class="logout-btn" onclick="handleLogout()">लॉगआउट</button>

    </div>

  </header>

  

  <div class="container">

    <div class="card">

      <h3>

        <span>नोंदणीकृत वेंडर्स व पेमेंट अप्रूव्हल</span>

        <button class="btn-print" onclick="printSection('adminVendorTable', 'नोंदणीकृत वेंडर्स यादी')">प्रिंट</button>

      </h3>

      <table id="adminVendorTable">

        <thead>

          <tr>

            <th>दुकानाचे नाव</th>

            <th>मोबाईल क्र.</th>

            <th>पासवर्ड</th>

            <th>स्टेटस</th>

            <th>एक्स्पायरी तारीख</th>

            <th>मागणी केलेला प्लॅन</th>

            <th>UTR / Ref</th>

            <th>अ‍ॅक्शन</th>

          </tr>

        </thead>

        <tbody></tbody>

      </table>

    </div>

  </div>

</div>


<!-- MAIN SOFTWARE APP SECTION FOR VENDOR -->

<div id="appSection" style="display:none;">

  <header>

    <div class="header-left">

      <img src="logo.png" alt="VM India Logo" class="app-logo">

      <div class="header-titles">

        <h2 id="headerShopName">एच.पी. ग्राहक माहिती व सिलेंडर व्यवस्थापन</h2>

        <div id="subStatus" style="font-size: 11px; margin-top: 2px;">तपासत आहे...</div>

      </div>

    </div>

    <div style="display:flex; align-items:center; gap: 10px;">

      <button onclick="openRechargeModal()" style="background: #ffc107; color: black; border:none; padding: 5px 10px; border-radius: 4px; font-weight: bold; cursor: pointer; font-size: 11px;">⚡ प्लॅन बदला / रिचार्ज करा</button>

      <span class="owner-tag">Software Owner - Vrundesh</span>

      <button class="logout-btn" onclick="handleLogout()">लॉगआउट</button>

    </div>

  </header>


  <nav id="navBar">

    <button onclick="showTab('saleTab', event)" class="active">विक्री</button>

    <button onclick="showTab('purchaseTab', event)">खरेदी</button>

    <button onclick="showTab('incomeTab', event)">इतर जमा</button>

    <button onclick="showTab('expenseTab', event)">इतर खर्च</button>

    <button onclick="showTab('stockTab', event)">स्टॉक</button>

    <button onclick="showTab('daybookTab', event)">डे बुक</button>

    <button onclick="showTab('reportsTab', event)">P&L व ताळेबंद</button>

    <button onclick="showTab('rechargeHistoryTab', event)" style="background: #0d6efd; color: white;">रिचार्ज हिस्ट्री</button>

  </nav>


  <div class="container">

    <!-- SALES TAB -->

    <div id="saleTab" class="tab-content card">

      <h3>सिलेंडर विक्री एन्ट्री</h3>

      <form onsubmit="addTransaction(event, 'SALE')">

        <div class="form-grid">

          <div class="form-group"><label>पावती क्रमांक</label><input type="number" id="saleReceipt" required></div>

          <div class="form-group"><label>तारीख</label><input type="date" id="saleDate" required></div>

          <div class="form-group"><label>ग्राहक नंबर</label><input type="text" id="saleCustNo"></div>

          <div class="form-group"><label>मोबाईल OTP</label><input type="text" id="saleOtp"></div>

          <div class="form-group"><label>ग्राहकाचे नाव</label><input type="text" id="saleCustName" required></div>

          <div class="form-group"><label>संख्या</label><input type="number" id="saleQty" value="1" oninput="calcSaleTotal()" required></div>

          <div class="form-group"><label>दर (₹)</label><input type="number" step="0.01" id="saleRate" value="990" oninput="calcSaleTotal()" required></div>

          <div class="form-group"><label>एकूण (₹)</label><input type="number" step="0.01" id="saleTotal" readonly></div>

        </div>

        <button type="submit" class="btn-submit">सिलेंडर विक्री नोंदवा</button>

      </form>

    </div>


    <!-- PURCHASE TAB -->

    <div id="purchaseTab" class="tab-content card" style="display:none;">

      <h3>सिलेंडर खरेदी एन्ट्री</h3>

      <form onsubmit="addTransaction(event, 'PURCHASE')">

        <div class="form-grid">

          <div class="form-group"><label>तारीख</label><input type="date" id="purDate" required></div>

          <div class="form-group"><label>पुरवठादार / कंपनी</label><input type="text" id="purSupplier" value="HPCL" required></div>

          <div class="form-group"><label>खरेदी संख्या</label><input type="number" id="purQty" required></div>

          <div class="form-group"><label>दर प्रति सिलेंडर (₹)</label><input type="number" step="0.01" id="purRate" required></div>

        </div>

        <button type="submit" class="btn-submit">सिलेंडर खरेदी नोंदवा</button>

      </form>

    </div>


    <!-- INCOME TAB -->

    <div id="incomeTab" class="tab-content card" style="display:none;">

      <h3>इतर जमा साईट एन्ट्री</h3>

      <form onsubmit="addTransaction(event, 'INCOME')">

        <div class="form-grid">

          <div class="form-group"><label>तारीख</label><input type="date" id="incDate" required></div>

          <div class="form-group"><label>जमा तपशील</label><input type="text" id="incDesc" placeholder="उदा. डिलिव्हरी चार्ज" required></div>

          <div class="form-group"><label>रक्कम (₹)</label><input type="number" step="0.01" id="incAmount" required></div>

        </div>

        <button type="submit" class="btn-submit">जमा नोंदवा</button>

      </form>

    </div>


    <!-- EXPENSE TAB -->

    <div id="expenseTab" class="tab-content card" style="display:none;">

      <h3>इतर खर्च साईट एन्ट्री</h3>

      <form onsubmit="addTransaction(event, 'EXPENSE')">

        <div class="form-grid">

          <div class="form-group"><label>तारीख</label><input type="date" id="expDate" required></div>

          <div class="form-group"><label>खर्च प्रकार</label><input type="text" id="expDesc" placeholder="उदा. लाईट बिल, पगार" required></div>

          <div class="form-group"><label>रक्कम (₹)</label><input type="number" step="0.01" id="expAmount" required></div>

        </div>

        <button type="submit" class="btn-submit">खर्च नोंदवा</button>

      </form>

    </div>


    <!-- STOCK TAB -->

    <div id="stockTab" class="tab-content card" style="display:none;">

      <h3>

        <span>साठा रजिस्टर (Stock Register)</span>

        <button class="btn-print" onclick="printSection('stockPrintArea', 'स्टॉक रजिस्टर')">प्रिंट</button>

      </h3>

      <div id="stockPrintArea">

        <table>

          <tr><th>एकूण खरेदी सिलेंडर</th><td id="stkPurchased">0</td></tr>

          <tr><th>एकूण विक्री सिलेंडर</th><td id="stkSold">0</td></tr>

          <tr><th>शिल्लक स्टॉक (Available Stock)</th><td id="stkAvailable" style="font-weight:bold; color:blue;">0</td></tr>

        </table>

      </div>

    </div>


    <!-- DAYBOOK TAB -->

    <div id="daybookTab" class="tab-content card" style="display:none;">

      <h3>

        <span>डे बुक (Daybook)</span>

        <button class="btn-print" onclick="printSection('daybookPrintArea', 'डे बुक रिपोर्ट')">प्रिंट</button>

      </h3>

      <div id="daybookPrintArea" style="overflow-x:auto;">

        <table id="daybookTable">

          <thead>

            <tr>

              <th>तारीख</th>

              <th>प्रकार</th>

              <th>पावती क्र.</th>

              <th>ग्राहकाचे नाव</th>

              <th>ग्राहक क्र.</th>

              <th>OTP</th>

              <th>तपशील</th>

              <th>जमा (+)</th>

              <th>नावे (-)</th>

              <th style="width: 120px;" class="no-print">अ‍ॅक्शन</th>

            </tr>

          </thead>

          <tbody></tbody>

        </table>

      </div>

    </div>


    <!-- REPORTS TAB -->

    <div id="reportsTab" class="tab-content card" style="display:none;">

      <div style="background: #f8f9fa; padding: 12px; border-radius: 6px; border: 1px solid #cce5ff; margin-bottom: 15px;">

        <h4 style="margin: 0 0 8px 0; color: #004085;">कस्टम कालावधीचा नफा रिपोर्ट (Date-Range Profit Report)</h4>

        <div class="form-grid">

          <div class="form-group"><label>पासून (From Date):</label><input type="date" id="profitFromDate"></div>

          <div class="form-group"><label>पर्यंत (To Date):</label><input type="date" id="profitToDate"></div>

          <div class="form-group" style="display: flex; align-items: flex-end;">

            <button class="btn-submit" onclick="generateDateRangeReport()" style="margin: 0; background: #28a745;">रिपोर्ट शोधा</button>

          </div>

        </div>


        <div id="customProfitResult" style="margin-top: 10px; display:none;">

          <hr>

          <div style="display:flex; justify-content:space-between; align-items:center;">

            <h5 style="margin: 5px 0;">निवडलेल्या कालावधीचा तपशील:</h5>

            <button class="btn-print" onclick="printSection('customProfitPrintArea', 'कालावधी नफा रिपोर्ट')">प्रिंट</button>

          </div>

          <div id="customProfitPrintArea">

            <table>

              <tr><th>एकूण विक्री (Sales)</th><td id="rngSales">₹ 0</td></tr>

              <tr><th>एकूण खरेदी (Purchase)</th><td id="rngPurchase">₹ 0</td></tr>

              <tr><th>इतर जमा (Other Income)</th><td id="rngIncome">₹ 0</td></tr>

              <tr><th>इतर खर्च (Expenses)</th><td id="rngExpense">₹ 0</td></tr>

              <tr><th>सिलेंडर विक्री निव्वळ नफा (Net Profit)</th><th id="rngNetProfit" style="color: green;">₹ 0</th></tr>

            </table>

          </div>

        </div>

      </div>


      <h3>

        <span>एकूण ट्रेडिंग, Profit & Loss आणि Balance Sheet</span>

        <button class="btn-print" onclick="printSection('pnlPrintArea', 'Profit and Loss Report')">प्रिंट</button>

      </h3>

      <div id="pnlPrintArea">

        <h4 style="margin: 5px 0;">१. ट्रेडिंग अकाउंट</h4>

        <table>

          <tr><td>एकूण विक्री</td><td id="trdSales">₹ 0</td></tr>

          <tr><td>वजा: खरेदी खर्च</td><td id="trdPurchase">₹ 0</td></tr>

          <tr><th>ग्रॉस प्रॉफिट</th><th id="trdGross">₹ 0</th></tr>

        </table>


        <h4 style="margin: 10px 0 5px 0;">२. नफा-तोटा पत्रक (Profit & Loss)</h4>

        <table>

          <tr><td>ग्रॉस प्रॉफिट</td><td id="pnlGross">₹ 0</td></tr>

          <tr><td>अधिक: इतर जमा</td><td id="pnlIncome">₹ 0</td></tr>

          <tr><td>वजा: इतर खर्च</td><td id="pnlExpenses">₹ 0</td></tr>

          <tr><th>निव्वळ नफा / तोटा</th><th id="pnlNet">₹ 0</th></tr>

        </table>


        <h4 style="margin: 10px 0 5px 0;">३. ताळेबंद (Balance Sheet)</h4>

        <table>

          <tr><th>देयता (Liabilities)</th><th>रक्कम</th><th>मालमत्ता (Assets)</th><th>रक्कम</th></tr>

          <tr><td>कॅपिटल / नेट प्रॉफिट</td><td id="bsProfit">₹ 0</td><td>क्लोजिंग स्टॉक मूल्य</td><td id="bsStockVal">₹ 0</td></tr>

          <tr><td>-</td><td>-</td><td>कॅश / बँक शिल्लक</td><td id="bsCash">₹ 0</td></tr>

        </table>

      </div>

    </div>


    <!-- RECHARGE HISTORY TAB -->

    <div id="rechargeHistoryTab" class="tab-content card" style="display:none;">

      <h3>

        <span>माझी रिचार्ज पेमेंट हिस्ट्री (Recharge History)</span>

        <button onclick="openRechargeModal()" style="background: #28a745; color: white; border:none; padding: 4px 10px; border-radius: 4px; font-weight: bold; cursor: pointer; font-size: 11px;">+ नवीन रिचार्ज करा</button>

      </h3>

      <table id="rechargeHistoryTable">

        <thead>

          <tr>

            <th>तारीख</th>

            <th>प्लॅन (कालावधी)</th>

            <th>भरलेली रक्कम</th>

            <th>UTR / ट्रांझॅक्शन क्र.</th>

            <th>स्टेटस</th>

          </tr>

        </thead>

        <tbody></tbody>

      </table>

    </div>


  </div>

</div>


<!-- PAYWALL / RECHARGE MODAL -->

<div id="paywall" class="paywall-modal">

  <div class="paywall-box">

    <div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid #ddd; padding-bottom:5px; margin-bottom:10px;">

      <h3 style="margin:0; color:var(--primary); font-size:16px;">सॉफ्टवेअर रिचार्ज / प्लॅन बदला</h3>

      <!-- बदल: एक्झिट बटण (Close Button) नेहमी चालू ठेवले आहे -->

      <button onclick="closeRechargeModal()" id="closeModalBtn" style="background:none; border:none; font-size:20px; font-weight:bold; color:#dc3545; cursor:pointer;" title="बंद करा">✖</button>

    </div>


    <div id="paywallStep1">

      <p style="margin:2px 0 10px 0; font-size:12px;">कृपया तुम्हाला हवा तो नवीन रिचार्ज प्लॅन निवडा:</p>

      

      <div class="plan-box" onclick="selectPlan(1, 1)">

        <div><b>१ दिवस (Trial Plan)</b></div><div><b>₹ १</b></div>

      </div>

      <div class="plan-box" onclick="selectPlan(30, 10)">

        <div><b>१ महिना (३० दिवस)</b></div><div><b>₹ १०</b></div>

      </div>

      <div class="plan-box" onclick="selectPlan(180, 60)">

        <div><b>६ महिने (१८० दिवस)</b></div><div><b>₹ ६०</b></div>

      </div>

      <div class="plan-box" onclick="selectPlan(365, 120)">

        <div><b>१ वर्ष (३६५ दिवस)</b></div><div><b>₹ १२०</b></div>

      </div>


      <div id="qrPayArea" style="display:none; margin-top:10px;">

        <hr>

        <p style="margin: 2px; font-weight:bold; color: green;" id="selectedPlanText">निवडलेला प्लॅन: ₹१०</p>

        <img id="qrImg" src="" class="qr-img" alt="UPI QR Code">

        <p style="margin:2px 0; font-size:11px;"><b>UPI ID:</b> vrundesh.mestry@okhdfcbank</p>

        

        <div style="text-align:left; margin-top:8px;">

          <label>पेमेंट UTR / Transaction Ref No. टाका:</label>

          <input type="text" id="payUtrInput" placeholder="12 Digit UTR Number" style="margin-top:2px;">

        </div>

        <button class="btn-submit" onclick="submitRechargeRequest()" style="background: green; padding: 8px;">पेमेंट माहिती सबमिट करा (Submit)</button>

      </div>

    </div>


    <div id="paywallStep2" style="display:none;">

      <h3 style="color: #856404; margin-top:0;">पेमेंट पडताळणी चालू आहे!</h3>

      <p style="font-size:13px;">तुमची रिचार्ज विनंती ॲडमिनकडे पाठवली आहे. अप्रूव्हल मिळताच मुदत वाढवली जाईल.</p>

      <div class="status-badge pending-bg" style="display:inline-block; margin-bottom:10px;">Status: Pending Approval</div>

      <p style="font-size:11px; color:#666;">मदत किंवा त्वरित अ‍ॅक्टिव्हेशनसाठी ॲडमिनशी संपर्क साधा.</p>

    </div>


    <!-- बदल: रिचार्ज स्क्रीनवरून थेट बाहेर पडण्यासाठी (लॉगआउटसाठी) जोडलेले बटण -->

    <hr style="margin: 15px 0 10px 0;">

    <div style="display: flex; justify-content: space-between; gap: 8px;">

      <button class="logout-btn" onclick="handleLogout()" style="width: 100%; padding: 8px; font-size: 12px;">🚪 सॉफ्टवेअरमधून लॉगआउट करा</button>

    </div>

  </div>

</div>


<script>

  let users = JSON.parse(localStorage.getItem('hp_sw_users')) || {};

  let currentUser = localStorage.getItem('hp_sw_current_user') || null;

  let selectedDays = 30;

  let selectedAmount = 10;


  window.onload = function() {

    if (currentUser === 'admin') {

      initAdminSession();

    } else if (currentUser && users[currentUser]) {

      initVendorSession();

    } else {

      openLoginForm();

    }

  };


  function openRegisterForm() {

    document.getElementById('loginCard').style.display = 'none';

    document.getElementById('registerCard').style.display = 'block';

  }


  function openLoginForm() {

    document.getElementById('registerCard').style.display = 'none';

    document.getElementById('loginCard').style.display = 'block';

  }


  function showForgotInfo() {

    alert("पासवर्ड विसरला असाल तर कृपया ॲडमिनशी संपर्क साधा.\n\nॲडमिन तुमचे खाते व्हेरिफाय करून नवीन पासवर्ड सेट करून देतील.");

  }


  function handleRegister(e) {

    e.preventDefault();

    const shop = document.getElementById('regShop').value.trim();

    const username = document.getElementById('regUser').value.trim();

    const password = document.getElementById('regPass').value.trim();


    if (username === 'admin') {

      alert('admin हे नाव वापरता येणार नाही!');

      return;

    }


    if (users[username]) {

      alert('हा मोबाईल नंबर आधीच नोंदणीकृत आहे! कृपया याच नंबरने लॉगिन करा.');

      openLoginForm();

      document.getElementById('loginUser').value = username;

      return;

    }


    let expiry = new Date();

    expiry.setDate(expiry.getDate() + 1);


    users[username] = {

      shopName: shop,

      password: password,

      expiryDate: expiry.toISOString(),

      paymentStatus: 'ACTIVE',

      pendingPlan: null,

      utr: '',

      transactions: [],

      rechargeHistory: [

        {

          date: new Date().toLocaleDateString('mr-IN'),

          days: 1,

          amount: 0,

          utr: 'Trial Plan',

          status: 'ACTIVE'

        }

      ]

    };


    localStorage.setItem('hp_sw_users', JSON.stringify(users));

    currentUser = username;

    localStorage.setItem('hp_sw_current_user', currentUser);


    alert('नोंदणी यशस्वी झाली!\n\nतुमचा आयडी: ' + username + '\nपासवर्ड: ' + password + '\n\nतुम्हाला १ दिवसाचा फ्री ट्रायअल देण्यात आला आहे.');

    initVendorSession();

  }


  function handleLogin(e) {

    e.preventDefault();

    const username = document.getElementById('loginUser').value.trim();

    const password = document.getElementById('loginPass').value.trim();


    if (username === 'admin' && password === 'admin123') {

      currentUser = 'admin';

      localStorage.setItem('hp_sw_current_user', 'admin');

      initAdminSession();

      return;

    }


    if (users[username]) {

      if (users[username].password === password) {

        currentUser = username;

        localStorage.setItem('hp_sw_current_user', currentUser);

        initVendorSession();

      } else {

        alert('चुकीचा पासवर्ड! जर पासवर्ड विसरला असाल तर ॲडमिनशी संपर्क साधा.');

      }

    } else {

      alert('हा मोबाईल नंबर नोंदणीकृत नाही. कृपया प्रथम नवीन नोंदणी करा.');

    }

  }


  function handleLogout() {

    if (confirm('तुम्हाला खरोखर लॉगआउट करायचे आहे का?')) {

      currentUser = null;

      localStorage.removeItem('hp_sw_current_user');

      document.getElementById('appSection').style.display = 'none';

      document.getElementById('adminSection').style.display = 'none';

      document.getElementById('paywall').style.display = 'none';

      document.getElementById('authSection').style.display = 'block';

      openLoginForm();

    }

  }


  /* --- ADMIN PANEL FUNCTIONS --- */

  function initAdminSession() {

    document.getElementById('authSection').style.display = 'none';

    document.getElementById('appSection').style.display = 'none';

    document.getElementById('paywall').style.display = 'none';

    document.getElementById('adminSection').style.display = 'block';

    renderAdminPanel();

  }


  function renderAdminPanel() {

    const tbody = document.querySelector('#adminVendorTable tbody');

    tbody.innerHTML = '';


    Object.keys(users).forEach(u => {

      let vendor = users[u];

      let expStr = new Date(vendor.expiryDate).toLocaleDateString('mr-IN');

      let statusHtml = vendor.paymentStatus === 'PENDING' 

        ? `<span class="status-badge pending-bg">Pending</span>`

        : `<span class="status-badge active-bg">Active</span>`;


      let planText = vendor.pendingPlan ? `${vendor.pendingPlan.days} दिवस (₹${vendor.pendingPlan.amount})` : '-';


      let row = `<tr>

        <td><b>${vendor.shopName}</b></td>

        <td>${u}</td>

        <td style="color:#d9534f; font-weight:bold;">${vendor.password}</td>

        <td>${statusHtml}</td>

        <td>${expStr}</td>

        <td>${planText}</td>

        <td><b>${vendor.utr || '-'}</b></td>

        <td>

          <button class="btn-activate" onclick="adminApproveVendor('${u}')">अ‍ॅक्टिव्हेट करा</button>

          <button class="btn-reset-pass" onclick="adminResetPassword('${u}')">पासवर्ड बदला</button>

        </td>

      </tr>`;

      tbody.innerHTML += row;

    });

  }


  function adminApproveVendor(username) {

    let vendor = users[username];

    let daysToAdd = vendor.pendingPlan ? vendor.pendingPlan.days : 30;


    let newExp = new Date();

    const currExp = new Date(vendor.expiryDate);

    if (currExp.getTime() > new Date().getTime()) {

      newExp = currExp;

    }

    newExp.setDate(newExp.getDate() + daysToAdd);


    vendor.expiryDate = newExp.toISOString();

    vendor.paymentStatus = 'ACTIVE';


    if(!vendor.rechargeHistory) vendor.rechargeHistory = [];

    

    // Update history item to ACTIVE

    if(vendor.rechargeHistory.length > 0) {

      let lastRec = vendor.rechargeHistory[vendor.rechargeHistory.length - 1];

      if(lastRec.status === 'PENDING') {

        lastRec.status = 'ACTIVE';

      }

    }


    vendor.pendingPlan = null;

    vendor.utr = '';


    users[username] = vendor;

    localStorage.setItem('hp_sw_users', JSON.stringify(users));

    alert(`${vendor.shopName} चे खाते ${daysToAdd} दिवसांसाठी यशस्वीपणे अ‍ॅक्टिव्हेट केले!`);

    renderAdminPanel();

  }


  function adminResetPassword(username) {

    let vendor = users[username];

    let newPass = prompt(`'${vendor.shopName}' साठी नवीन पासवर्ड प्रविष्ट करा:`, vendor.password);

    

    if (newPass && newPass.trim() !== '') {

      vendor.password = newPass.trim();

      users[username] = vendor;

      localStorage.setItem('hp_sw_users', JSON.stringify(users));

      alert('पासवर्ड यशस्वीपणे बदलला आहे!');

      renderAdminPanel();

    }

  }


  /* --- VENDOR SOFTWARE FUNCTIONS --- */

  function initVendorSession() {

    document.getElementById('authSection').style.display = 'none';

    document.getElementById('adminSection').style.display = 'none';

    document.getElementById('appSection').style.display = 'block';

    

    const userObj = users[currentUser];

    document.getElementById('headerShopName').innerText = userObj.shopName + " - सिलेंडर व्यवस्थापन";


    document.getElementById('saleDate').valueAsDate = new Date();

    document.getElementById('purDate').valueAsDate = new Date();

    document.getElementById('incDate').valueAsDate = new Date();

    document.getElementById('expDate').valueAsDate = new Date();


    calcSaleTotal();

    checkSubscription();

    renderAll();

  }


  function checkSubscription() {

    const userObj = users[currentUser];

    const now = new Date().getTime();

    const subStatusEl = document.getElementById('subStatus');

    const paywall = document.getElementById('paywall');


    if (userObj.expiryDate && new Date(userObj.expiryDate).getTime() > now) {

      const daysLeft = Math.ceil((new Date(userObj.expiryDate).getTime() - now) / (1000 * 60 * 60 * 24));

      subStatusEl.innerHTML = `<span class="status-badge active-bg">सक्रिय: ${daysLeft} दिवस शिल्लक (वैधता: ${new Date(userObj.expiryDate).toLocaleDateString('mr-IN')})</span>`;

    } else {

      subStatusEl.innerHTML = `<span class="status-badge expired-bg">मुदत संपली आहे - रिचार्ज करा</span>`;

      paywall.style.display = 'flex';

    }

  }


  function openRechargeModal() {

    document.getElementById('paywall').style.display = 'flex';

    document.getElementById('paywallStep1').style.display = 'block';

    document.getElementById('paywallStep2').style.display = 'none';

  }


  /* बदल: Close बटणावर क्लिक केल्यावर पॉपअप सहज बंद होईल */

  function closeRechargeModal() {

    document.getElementById('paywall').style.display = 'none';

  }


  function selectPlan(days, amount) {

    selectedDays = days;

    selectedAmount = amount;

    document.getElementById('qrPayArea').style.display = 'block';

    document.getElementById('selectedPlanText').innerText = `निवडलेला प्लॅन: ${days} दिवस (₹ ${amount})`;

    

    let qrUrl = `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=upi://pay?pa=vrundesh.mestry@okhdfcbank&pn=VRUNDESH%20MESTRY&am=${amount}&cu=INR`;

    document.getElementById('qrImg').src = qrUrl;

  }


  function submitRechargeRequest() {

    const utr = document.getElementById('payUtrInput').value.trim();

    if (!utr) {

      alert('कृपया पेमेंट UTR / Transaction Number टाका!');

      return;

    }


    users[currentUser].paymentStatus = 'PENDING';

    users[currentUser].pendingPlan = { days: selectedDays, amount: selectedAmount };

    users[currentUser].utr = utr;


    if(!users[currentUser].rechargeHistory) users[currentUser].rechargeHistory = [];


    users[currentUser].rechargeHistory.push({

      date: new Date().toLocaleDateString('mr-IN'),

      days: selectedDays,

      amount: selectedAmount,

      utr: utr,

      status: 'PENDING'

    });


    localStorage.setItem('hp_sw_users', JSON.stringify(users));

    alert('तुमची पेमेंट माहिती सबमिट झाली आहे. ॲडमिन पडताळणी करून खाते अ‍ॅक्टिव्हेट करतील.');

    

    document.getElementById('paywallStep1').style.display = 'none';

    document.getElementById('paywallStep2').style.display = 'block';

    renderRechargeHistory();

  }


  function showTab(tabId, evt) {

    document.querySelectorAll('.tab-content').forEach(el => el.style.display = 'none');

    document.querySelectorAll('nav button').forEach(el => el.classList.remove('active'));

    document.getElementById(tabId).style.display = 'block';

    evt.target.classList.add('active');

    renderAll();

  }


  function calcSaleTotal() {

    const qty = parseFloat(document.getElementById('saleQty').value) || 0;

    const rate = parseFloat(document.getElementById('saleRate').value) || 0;

    document.getElementById('saleTotal').value = (qty * rate).toFixed(2);

  }


  function addTransaction(e, type) {

    e.preventDefault();

    let entry = { type: type, timestamp: new Date().getTime() };


    if (type === 'SALE') {

      entry.date = document.getElementById('saleDate').value;

      entry.receipt = document.getElementById('saleReceipt').value;

      entry.custNo = document.getElementById('saleCustNo').value || '-';

      entry.otp = document.getElementById('saleOtp').value || '-';

      entry.custName = document.getElementById('saleCustName').value;

      entry.qty = parseInt(document.getElementById('saleQty').value);

      entry.rate = parseFloat(document.getElementById('saleRate').value);

      entry.amount = parseFloat((entry.qty * entry.rate).toFixed(2));

      entry.desc = `सिलेंडर विक्री (दर: ₹${entry.rate}, संख्या: ${entry.qty})`;

    } else if (type === 'PURCHASE') {

      entry.date = document.getElementById('purDate').value;

      entry.supplier = document.getElementById('purSupplier').value;

      entry.qty = parseInt(document.getElementById('purQty').value);

      entry.rate = parseFloat(document.getElementById('purRate').value);

      entry.amount = parseFloat((entry.qty * entry.rate).toFixed(2));

      entry.receipt = '-';

      entry.custName = '-';

      entry.custNo = '-';

      entry.otp = '-';

      entry.desc = `खरेदी (${entry.supplier})`;

    } else if (type === 'INCOME') {

      entry.date = document.getElementById('incDate').value;

      entry.desc = document.getElementById('incDesc').value;

      entry.amount = parseFloat(parseFloat(document.getElementById('incAmount').value).toFixed(2));

      entry.receipt = '-';

      entry.custName = '-';

      entry.custNo = '-';

      entry.otp = '-';

      entry.qty = 0;

    } else if (type === 'EXPENSE') {

      entry.date = document.getElementById('expDate').value;

      entry.desc = document.getElementById('expDesc').value;

      entry.amount = parseFloat(parseFloat(document.getElementById('expAmount').value).toFixed(2));

      entry.receipt = '-';

      entry.custName = '-';

      entry.custNo = '-';

      entry.otp = '-';

      entry.qty = 0;

    }


    users[currentUser].transactions.push(entry);

    localStorage.setItem('hp_sw_users', JSON.stringify(users));

    alert('नोंदणी झाली!');

    e.target.reset();

    renderAll();

  }


  function deleteTransaction(index) {

    if (confirm('तुम्हाला ही एन्ट्री खरंच डिलीट करायची आहे का?')) {

      users[currentUser].transactions.splice(index, 1);

      localStorage.setItem('hp_sw_users', JSON.stringify(users));

      renderAll();

    }

  }


  function editTransaction(index) {

    let t = users[currentUser].transactions[index];

    

    let newDate = prompt("नवीन तारीख टाका (YYYY-MM-DD):", t.date);

    if (!newDate) return;


    if (t.type === 'SALE') {

      t.receipt = prompt("पावती क्रमांक:", t.receipt || '') || t.receipt;

      t.custName = prompt("ग्राहकाचे नाव:", t.custName || '') || t.custName;

      t.custNo = prompt("ग्राहक क्रमांक:", t.custNo || '') || t.custNo;

      t.otp = prompt("OTP नंबर:", t.otp || '') || t.otp;

    }


    let newDesc = prompt("तपशील बदला:", t.desc);

    if (!newDesc) return;


    let newAmount = prompt("नवीन एकूण रक्कम (₹) टाका:", t.amount);

    if (newAmount === null) return;


    t.date = newDate;

    t.desc = newDesc;

    t.amount = parseFloat(parseFloat(newAmount).toFixed(2)) || 0;


    if (t.type === 'SALE' || t.type === 'PURCHASE') {

      let newQty = prompt("नवीन संख्या (Quantity) टाका:", t.qty);

      if (newQty !== null) {

        t.qty = parseInt(newQty) || 0;

      }

    }


    users[currentUser].transactions[index] = t;

    localStorage.setItem('hp_sw_users', JSON.stringify(users));

    alert('एन्ट्री यशस्वीपणे अपडेट झाली!');

    renderAll();

  }


  function renderRechargeHistory() {

    const tbody = document.querySelector('#rechargeHistoryTable tbody');

    if(!tbody) return;

    tbody.innerHTML = '';


    const list = users[currentUser].rechargeHistory || [];

    list.forEach(rec => {

      let stBadge = rec.status === 'ACTIVE' 

        ? `<span class="status-badge active-bg">Active</span>` 

        : `<span class="status-badge pending-bg">Pending</span>`;


      let row = `<tr>

        <td>${rec.date}</td>

        <td><b>${rec.days} दिवस</b></td>

        <td>₹ ${rec.amount}</td>

        <td><b>${rec.utr}</b></td>

        <td>${stBadge}</td>

      </tr>`;

      tbody.innerHTML += row;

    });

  }


  function generateDateRangeReport() {

    const fromStr = document.getElementById('profitFromDate').value;

    const toStr = document.getElementById('profitToDate').value;


    if(!fromStr || !toStr) {

      alert("कृपया दोन्ही तारखा (पासून आणि पर्यंत) निवडा!");

      return;

    }


    const fromDate = new Date(fromStr);

    const toDate = new Date(toStr);

    toDate.setHours(23, 59, 59);


    let rngSales = 0, rngPurchase = 0, rngIncome = 0, rngExpense = 0;

    const vendorData = users[currentUser].transactions || [];


    vendorData.forEach(t => {

      let tDate = new Date(t.date);

      if(tDate >= fromDate && tDate <= toDate) {

        if (t.type === 'SALE') rngSales += t.amount;

        if (t.type === 'PURCHASE') rngPurchase += t.amount;

        if (t.type === 'INCOME') rngIncome += t.amount;

        if (t.type === 'EXPENSE') rngExpense += t.amount;

      }

    });


    const netProfit = (rngSales + rngIncome) - (rngPurchase + rngExpense);


    document.getElementById('rngSales').innerText = '₹ ' + rngSales.toFixed(2);

    document.getElementById('rngPurchase').innerText = '₹ ' + rngPurchase.toFixed(2);

    document.getElementById('rngIncome').innerText = '₹ ' + rngIncome.toFixed(2);

    document.getElementById('rngExpense').innerText = '₹ ' + rngExpense.toFixed(2);

    document.getElementById('rngNetProfit').innerText = '₹ ' + netProfit.toFixed(2);


    document.getElementById('customProfitResult').style.display = 'block';

  }


  function printSection(elementId, title) {

    const shopName = users[currentUser] ? users[currentUser].shopName : "एच.पी. गॅस एजन्सी";

    const content = document.getElementById(elementId).outerHTML;

    const printWin = window.open('', '', 'height=600,width=800');

    

    printWin.document.write(`

      <html>

      <head>

        <title>${title}</title>

        <style>

          body { font-family: Arial, sans-serif; font-size: 12px; padding: 15px; }

          h2, h3 { text-align: center; margin: 5px 0; }

          table { width: 100%; border-collapse: collapse; margin-top: 10px; }

          th, td { border: 1px solid #333; padding: 6px 8px; text-align: left; }

          th { background: #f2f2f2; }

          .no-print { display: none; }

        </style>

      </head>

      <body>

        <h2>${shopName}</h2>

        <h3>${title}</h3>

        <p style="text-align:right; font-size:10px;">तारीख: ${new Date().toLocaleDateString('mr-IN')}</p>

        <hr>

        ${content}

      </body>

      </html>

    `);


    printWin.document.close();

    printWin.focus();

    setTimeout(() => { printWin.print(); printWin.close(); }, 500);

  }


  function printBillReceipt(index) {

    const t = users[currentUser].transactions[index];

    const shopName = users[currentUser].shopName;


    const buildReceiptHTML = (copyType) => `

      <div class="receipt-copy">

        <div style="display:flex; justify-content:space-between; align-items:center;">

          <h2 style="margin:0; font-size:16px; color:#003366;">${shopName}</h2>

          <span style="font-size:11px; font-weight:bold; border:1px solid #000; padding:2px 6px;">${copyType}</span>

        </div>

        <p style="margin:2px 0 8px 0; font-size:11px;">एच.पी. गॅस अधिकृत वितरक | पावती क्रमांक: <b>${t.receipt || '-'}</b></p>

        <hr>

        <table style="width:100%; font-size:12px; border:none;">

          <tr><td><b>तारीख:</b> ${t.date}</td><td><b>प्रकार:</b> ${t.type}</td></tr>

          <tr><td><b>ग्राहकाचे नाव:</b> ${t.custName || '-'}</td><td><b>ग्राहक क्र.:</b> ${t.custNo || '-'}</td></tr>

          <tr><td><b>OTP नंबर:</b> ${t.otp || '-'}</td><td><b>संख्या:</b> ${t.qty || 1}</td></tr>

          <tr><td><b>दर प्रति सिलेंडर:</b> ₹ ${t.rate || t.amount}</td><td><b>एकूण रक्कम:</b> ₹ ${t.amount}</td></tr>

        </table>

        <hr style="margin-top:15px;">

        <p style="margin:2px;"><b>तपशील:</b> ${t.desc}</p>

        <br><br>

        <div style="display:flex; justify-content:space-between; margin-top:15px;">

          <span>ग्राहकाची स्वाक्षरी</span>

          <span>श्री गणेश गॅस (ऑथोराईज्ड सही)</span>

        </div>

      </div>

    `;


    const printWin = window.open('', '', 'height=800,width=700');

    printWin.document.write(`

      <html>

      <head>

        <title>पावती प्रिंट - ${t.receipt || ''}</title>

        <style>

          body { font-family: Arial, sans-serif; margin: 0; padding: 10px; }

          .receipt-copy { border: 1.5px dashed #000; padding: 12px; height: 420px; box-sizing: border-box; }

          table td { padding: 4px; }

        </style>

      </head>

      <body>

        <div id="printableArea">

          ${buildReceiptHTML('CUSTOMER COPY')}

          <div style="text-align:center; margin: 5px 0; font-size:10px;">✂ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</div>

          ${buildReceiptHTML('OWNER COPY')}

        </div>

      </body>

      </html>

    `);


    printWin.document.close();

    printWin.focus();

    setTimeout(() => { printWin.print(); printWin.close(); }, 500);

  }


  function renderAll() {

    if(!currentUser || !users[currentUser] || currentUser === 'admin') return;


    let purQty = 0, saleQty = 0;

    let purTotal = 0, saleTotal = 0, incTotal = 0, expTotal = 0;

    

    const tbody = document.querySelector('#daybookTable tbody');

    if(tbody) tbody.innerHTML = '';


    const vendorData = users[currentUser].transactions || [];


    vendorData.forEach((t, index) => {

      let printBtn = (t.type === 'SALE' || t.type === 'PURCHASE') 

        ? `<button class="btn-receipt-print" onclick="printBillReceipt(${index})">पावती</button>` 

        : '';


      let row = `<tr>

        <td>${t.date}</td>

        <td>${t.type}</td>

        <td>${t.receipt || '-'}</td>

        <td>${t.custName || '-'}</td>

        <td>${t.custNo || '-'}</td>

        <td>${t.otp || '-'}</td>

        <td>${t.desc}</td>

        <td style="color:green;">${(t.type === 'SALE' || t.type === 'INCOME') ? '₹ ' + t.amount.toFixed(2) : '-'}</td>

        <td style="color:red;">${(t.type === 'PURCHASE' || t.type === 'EXPENSE') ? '₹ ' + t.amount.toFixed(2) : '-'}</td>

        <td class="no-print">

          <button class="btn-edit" onclick="editTransaction(${index})">Edit</button>

          <button class="btn-delete" onclick="deleteTransaction(${index})">Del</button>

          ${printBtn}

        </td>

      </tr>`;

      if(tbody) tbody.innerHTML += row;


      if (t.type === 'PURCHASE') { purQty += t.qty; purTotal += t.amount; }

      if (t.type === 'SALE') { saleQty += t.qty; saleTotal += t.amount; }

      if (t.type === 'INCOME') { incTotal += t.amount; }

      if (t.type === 'EXPENSE') { expTotal += t.amount; }

    });


    document.getElementById('stkPurchased').innerText = purQty;

    document.getElementById('stkSold').innerText = saleQty;

    const availStock = purQty - saleQty;

    document.getElementById('stkAvailable').innerText = availStock;


    const avgCost = purQty > 0 ? (purTotal / purQty) : 0;

    const closingStockValue = availStock * avgCost;


    document.getElementById('trdSales').innerText = '₹ ' + saleTotal.toFixed(2);

    document.getElementById('trdPurchase').innerText = '₹ ' + purTotal.toFixed(2);

    const grossProfit = saleTotal - (purTotal - closingStockValue);

    document.getElementById('trdGross').innerText = '₹ ' + grossProfit.toFixed(2);


    document.getElementById('pnlGross').innerText = '₹ ' + grossProfit.toFixed(2);

    document.getElementById('pnlIncome').innerText = '₹ ' + incTotal.toFixed(2);

    document.getElementById('pnlExpenses').innerText = '₹ ' + expTotal.toFixed(2);

    const netProfit = grossProfit + incTotal - expTotal;

    document.getElementById('pnlNet').innerText = '₹ ' + netProfit.toFixed(2);


    const cashInHand = (saleTotal + incTotal) - (purTotal + expTotal);

    document.getElementById('bsProfit').innerText = '₹ ' + netProfit.toFixed(2);

    document.getElementById('bsStockVal').innerText = '₹ ' + closingStockValue.toFixed(2);

    document.getElementById('bsCash').innerText = '₹ ' + cashInHand.toFixed(2);


    renderRechargeHistory();

  }

</script>


</body>

</html>


Comments

Popular posts from this blog