{% extends "base.html" %} {% block title %}လစဉ် စာရင်းချုပ်နှင့် စာရင်းပိတ်သိမ်းခြင်း | myplayer Biz{% endblock %} {% block content %} {# ========================================================================= #} {# 🌟 JINJA BULLET-PROOF ENGINE & THREE-STATE RESOLVER #} {# ========================================================================= #} {% set cur_year = today_year | default(2026) %} {% set cur_month = today_month | default(10) %} {# အခြေအနေ ၁: စာရင်းပိတ်ပြီး ဟုတ်/မဟုတ် #} {% set is_locked = (existing_closing and existing_closing.is_locked == 1) %} {# အခြေအနေ ၂: လမကုန်သေးသော လည်ပတ်ဆဲ လက်ရှိလ သို့မဟုတ် အနာဂတ်လ ဟုတ်/မဟုတ် #} {% set is_ongoing = (selected_year > cur_year) or (selected_year == cur_year and selected_month >= cur_month) %} {# အခြေအနေ ၃: စာရင်းပိတ်ရန် အမှန်တကယ် အသင့်ဖြစ်သော လဟောင်း ဟုတ်/မဟုတ် #} {% set is_ready_to_close = (not is_locked and not is_ongoing) %} {% set dmg_loss = total_damage_loss | default(0) %} {% set oth_inc = other_income | default(0) %}

🔒 လစဉ် စာရင်းချုပ်နှင့် စာရင်းပိတ်သိမ်းခြင်း (Monthly Period Closing)

{{ selected_year }} ခုနှစ်၊ {{ selected_month }} လပိုင်း ဘဏ္ဍာရေးစာရင်း စစ်ဆေးခြင်း၊ ကုန်ကျစရိတ်ခွဲဝေခြင်းနှင့် စာရင်းများ Lock ချခြင်း
{% if is_locked %} PERIOD LOCKED (စာရင်းပိတ်ပြီး) {% elif is_ongoing %} ONGOING PERIOD (လည်ပတ်ဆဲကာလ) {% else %} READY TO CLOSE (ပိတ်ရန် အသင့်) {% endif %}
စာရင်းမပိတ်မီ စစ်ဆေးရမည့် အချက်များ
{% if is_ongoing %}
သတိပြုရန်: {{ selected_year }} ခုနှစ်၊ {{ selected_month }} လပိုင်းသည် လည်ပတ်ဆဲ ကာလဖြစ်သောကြောင့် အရောင်းအဝယ်များနှင့် အသုံးစရိတ်များ ဆက်လက်ဖြစ်ပေါ်နေမည် ဖြစ်ပါသည်။
{% endif %}
၁။ နေ့စဉ် ကောင်တာ အဆိုင်းပိတ်သိမ်းမှု {% if unclosed_sessions %} {{ unclosed_sessions|length }} ခု ပွင့်နေဆဲ {% else %} အဆိုင်းအားလုံး ပိတ်ပြီး {% endif %}
{% if unclosed_sessions %} သတိပေးချက်: အဆိုင်းမပိတ်ရသေးသော POS Session များ ရှိနေပါသည်။ သွားရောက်ပိတ်သိမ်းရန် → {% else %} ဤလအတွင်း ကောင်တာအဆိုင်းအားလုံး အောင်မြင်စွာ ပိတ်သိမ်းပြီး ဖြစ်ပါသည်။ {% endif %}
၂။ ကြိုတင်ပေးစရိတ် ခွဲဝေမှု (Amortization) {% if unposted_prepaids %} {{ unposted_prepaids|length }} ခု သွင်းရန်ကျန် {% else %} စရိတ်ခွဲဝေပြီး {% endif %}
ဆိုင်ခန်းငှားခ၊ အာမခံကြေး စသည့် ကြိုပေးစရိတ်များကို စရိတ်ထဲ အလိုအလျောက် ပေါင်းထည့်ပေးမည်။ {% if unposted_prepaids %} စစ်ဆေးရန် → {% endif %}
၃။ လစဉ် ဝန်ထမ်းလစာ ရှင်းတမ်း {% if unpaid_payrolls %} {{ unpaid_payrolls|length }} ယောက် ကျန်ရှိ {% else %} လစာအားလုံး ရှင်းပြီး {% endif %}
လစာမရှင်းရသေးသည့် ဝန်ထမ်းစာရင်းများ ရှိ/မရှိ စစ်ဆေးခြင်း။ {% if unpaid_payrolls %} လစာစာရင်းသို့ → {% endif %}
{{ selected_year }} ခုနှစ်၊ {{ selected_month }} လပိုင်း ဘဏ္ဍာရေး အနှစ်ချုပ်
Live Calculation
စုစုပေါင်း အရောင်းအသားတင် (Net Sales)
{{ "{:,.0f}".format(net_sales) }} Ks
{% if oth_inc > 0 %} + အခြားဝင်ငွေ: {{ "{:,.0f}".format(oth_inc) }} Ks {% endif %}
ရောင်းကုန်အရင်း + ပျက်စီးဆုံးရှုံးမှု (COGS & Damages)
{{ "{:,.0f}".format(total_cogs + dmg_loss) }} Ks
{% if dmg_loss > 0 %} (COGS: {{ "{:,.0f}".format(total_cogs) }} | ပျက်စီး: {{ "{:,.0f}".format(dmg_loss) }}) {% endif %}
အထွေထွေစရိတ် + လစာ (Total OPEX)
{{ "{:,.0f}".format(total_expenses + total_payroll) }} Ks
(ဆိုင်စရိတ်: {{ "{:,.0f}".format(total_expenses) }} | လစာ: {{ "{:,.0f}".format(total_payroll) }})
အသားတင် အမြတ်/အရှုံး (Net Profit)
{{ "{:,.0f}".format(net_profit) }} Ks
အကြမ်းအမြတ်: {{ "{:,.0f}".format(gross_profit) }} Ks
{% if is_locked %}
ဤလပိုင်းအတွက် စာရင်းပိတ်သိမ်းပြီးဖြစ်ပါသည် ပိတ်သိမ်းခဲ့သည့်အချိန်: {{ existing_closing.closed_at }}
{% if session.get('user_role') in ['SUPER_ADMIN', 'OWNER'] %}
{% endif %} {% elif is_ongoing %}
လည်ပတ်ဆဲ ကာလဖြစ်ပါသည် ဤလပိုင်းသည် မကုန်ဆုံးသေးသောကြောင့် ရက်စွဲကုန်ဆုံးပြီးမှသာ စာရင်း အပြီးပိုင် ပိတ်သိမ်းနိုင်ပါမည်။
{% else %}
{% endif %}
ပြီးခဲ့သော လချုပ် သမိုင်းမှတ်တမ်းများ (Monthly Closing History)
{% for h in closing_history %} {% else %} {% endfor %}
ကာလ (PERIOD) ဆိုင်ခွဲ အရောင်းအသားတင် ရောင်းကုန်အရင်း + ပျက်စီး ကုန်ကျစရိတ် + လစာ အသားတင်အမြတ် (NET PROFIT) အခြေအနေ ပိတ်သိမ်းခဲ့သည့်ရက်
{{ h.closing_year }}-{{ "%02d"|format(h.closing_month) }} {{ h.branch_name or 'ဆိုင်ခွဲအားလုံး ပေါင်းချုပ်' }} {{ "{:,.0f}".format(h.total_sales or 0) }} Ks {{ "{:,.0f}".format((h.total_cogs or 0) + (h.total_damage_loss or 0)) }} Ks {{ "{:,.0f}".format((h.total_operating_expenses or 0) + (h.total_payroll or 0)) }} Ks {{ "{:,.0f}".format(h.net_profit or 0) }} Ks {% if h.is_locked == 1 %} LOCKED {% else %} UNLOCKED {% endif %} {{ (h.closed_at | string)[:16] if h.closed_at else '-' }}
လချုပ်မှတ်တမ်း မရှိသေးပါ။
{% endblock %}