من یک وب اپلیکیشن میخام که با پایتون نوشته بشه و میخام در اون بتونم تسهیلات بانکی رو تعریف کمک نوع تسهیلات ، مبلغ تسهیلات، تعداد اقساط، مبلغ هر قسط رو دستی وارد کنم ،تاریخ سررسید هر قسط رو مشخص کنم ، درصد سود ، درصد جریمه رو مشخص کنم و به تفکیک بانک و شماره تسهیلات ثبت کنم بعد میخام جدول پرداخت رو داشته باشم و بتونم هر پرداخت مربوط به هر شماهر تسهیلات رو با تاریخ و مبلغ پرداخت ثبت کنم و همچین مشخص کنم هر پرداخت که انجام شده چقدرش برای اصل تسهیلات برداشت شده چقدر برای سود تسهیلات و چقدر برای جریمه . میخام اینها رو به صورت دستی ثبت کنم در قدم بعدی میخام طی چند روش محاسبات سیستمی انجام بدم و بدونم بانک مبالغ برداشت شده به درستی به تفکیک اصل ، سود و جریمه برداشته یا نه و مغایرتها رو گزارش بگیرم معمولا بانکها از چند روش استفاده می کنند روش اول : از هر پرداخت به نسبت مساوی از اصل ، سود و جریمه برداشت میکنن روش دوم : در هر پرداخت ابتدا سود و جرایم را برداشت میکنن و سپس از اصل وام میخام تمامی کپشن ها به صورت فارسی باشه فیلدهای دارای تاریخ به صورت تقویم شمسی باشه مبالغ به صورت 3 رقم جدا کننده داشته باشه - Initial Deployment
Browse files- README.md +7 -5
- index.html +785 -19
- prompts.txt +1 -0
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: https-huggingface-co-amiali62623
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: green
|
5 |
+
colorTo: green
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html dir="rtl" lang="fa">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>سیستم مدیریت تسهیلات بانکی</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/persian-datepicker/dist/css/persian-datepicker.min.css">
|
9 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
10 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/persian-date.min.js"></script>
|
11 |
+
<script src="https://cdn.jsdelivr.net/npm/persian-datepicker/dist/js/persian-datepicker.min.js"></script>
|
12 |
+
<script src="https://unpkg.com/[email protected]/dist/persian-number.min.js"></script>
|
13 |
+
<style>
|
14 |
+
@font-face {
|
15 |
+
font-family: 'IRANSans';
|
16 |
+
src: url('https://cdn.fontcdn.ir/Font/Persian/IRANSans/IRANSansWeb.eot');
|
17 |
+
src: url('https://cdn.fontcdn.ir/Font/Persian/IRANSans/IRANSansWeb.eot?#iefix') format('embedded-opentype'),
|
18 |
+
url('https://cdn.fontcdn.ir/Font/Persian/IRANSans/IRANSansWeb.woff2') format('woff2'),
|
19 |
+
url('https://cdn.fontcdn.ir/Font/Persian/IRANSans/IRANSansWeb.woff') format('woff'),
|
20 |
+
url('https://cdn.fontcdn.ir/Font/Persian/IRANSans/IRANSansWeb.ttf') format('truetype');
|
21 |
+
font-weight: normal;
|
22 |
+
font-style: normal;
|
23 |
+
}
|
24 |
+
body {
|
25 |
+
font-family: 'IRANSans', sans-serif;
|
26 |
+
}
|
27 |
+
.table-container {
|
28 |
+
overflow-x: auto;
|
29 |
+
}
|
30 |
+
.active-tab {
|
31 |
+
background-color: #3b82f6;
|
32 |
+
color: white;
|
33 |
+
}
|
34 |
+
.hidden {
|
35 |
+
display: none;
|
36 |
+
}
|
37 |
+
</style>
|
38 |
+
</head>
|
39 |
+
<body class="bg-gray-100">
|
40 |
+
<div class="container mx-auto px-4 py-8">
|
41 |
+
<h1 class="text-3xl font-bold text-center mb-8 text-blue-700">سیستم مدیریت تسهیلات بانکی</h1>
|
42 |
+
|
43 |
+
<!-- Navigation Tabs -->
|
44 |
+
<div class="flex mb-6 border-b">
|
45 |
+
<button id="loanTabBtn" class="px-6 py-2 rounded-t-lg active-tab" onclick="showTab('loanTab')">تعریف تسهیلات</button>
|
46 |
+
<button id="paymentTabBtn" class="px-6 py-2 rounded-t-lg bg-gray-200" onclick="showTab('paymentTab')">ثبت پرداخت</button>
|
47 |
+
<button id="reportTabBtn" class="px-6 py-2 rounded-t-lg bg-gray-200" onclick="showTab('reportTab')">گزارش مغایرت</button>
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<!-- Loan Definition Tab -->
|
51 |
+
<div id="loanTab" class="bg-white p-6 rounded-lg shadow-md">
|
52 |
+
<h2 class="text-xl font-semibold mb-4 text-blue-600">فرم تعریف تسهیلات بانکی</h2>
|
53 |
+
|
54 |
+
<form id="loanForm" class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
55 |
+
<div>
|
56 |
+
<label for="loanNumber" class="block mb-2 font-medium">شماره تسهیلات</label>
|
57 |
+
<input type="text" id="loanNumber" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500" required>
|
58 |
+
</div>
|
59 |
+
|
60 |
+
<div>
|
61 |
+
<label for="bankName" class="block mb-2 font-medium">نام بانک</label>
|
62 |
+
<select id="bankName" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500" required>
|
63 |
+
<option value="">انتخاب کنید</option>
|
64 |
+
<option value="بانک ملی">بانک ملی</option>
|
65 |
+
<option value="بانک صادرات">بانک صادرات</option>
|
66 |
+
<option value="بانک ملت">بانک ملت</option>
|
67 |
+
<option value="بانک تجارت">بانک تجارت</option>
|
68 |
+
<option value="بانک رفاه">بانک رفاه</option>
|
69 |
+
<option value="بانک سپه">بانک سپه</option>
|
70 |
+
<option value="بانک کشاورزی">بانک کشاورزی</option>
|
71 |
+
<option value="بانک پارسیان">بانک پارسیان</option>
|
72 |
+
</select>
|
73 |
+
</div>
|
74 |
+
|
75 |
+
<div>
|
76 |
+
<label for="loanType" class="block mb-2 font-medium">نوع تسهیلات</label>
|
77 |
+
<select id="loanType" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500" required>
|
78 |
+
<option value="">انتخاب کنید</option>
|
79 |
+
<option value="مسکن">مسکن</option>
|
80 |
+
<option value="خودرو">خودرو</option>
|
81 |
+
<option value="مادهی ۹۱">مادهی ۹۱</option>
|
82 |
+
<option value="قرضالحسنه">قرضالحسنه</option>
|
83 |
+
<option value="تجاری">تجاری</option>
|
84 |
+
</select>
|
85 |
+
</div>
|
86 |
+
|
87 |
+
<div>
|
88 |
+
<label for="loanAmount" class="block mb-2 font-medium">مبلغ تسهیلات (ریال)</label>
|
89 |
+
<input type="text" id="loanAmount" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500 persian-number" required>
|
90 |
+
</div>
|
91 |
+
|
92 |
+
<div>
|
93 |
+
<label for="installmentCount" class="block mb-2 font-medium">تعداد اقساط</label>
|
94 |
+
<input type="number" id="installmentCount" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500" required>
|
95 |
+
</div>
|
96 |
+
|
97 |
+
<div>
|
98 |
+
<label for="installmentAmount" class="block mb-2 font-medium">مبلغ هر قسط (ریال)</label>
|
99 |
+
<input type="text" id="installmentAmount" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500 persian-number" required>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
<div>
|
103 |
+
<label for="interestRate" class="block mb-2 font-medium">درصد سود (%)</label>
|
104 |
+
<input type="number" step="0.01" id="interestRate" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500" required>
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<div>
|
108 |
+
<label for="penaltyRate" class="block mb-2 font-medium">درصد جریمه (%)</label>
|
109 |
+
<input type="number" step="0.01" id="penaltyRate" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500" required>
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<div class="md:col-span-2">
|
113 |
+
<button type="submit" class="w-full md:w-auto bg-blue-600 text-white px-6 py-2 rounded hover:bg-blue-700 transition">ذخیره تسهیلات</button>
|
114 |
+
<button type="button" onclick="generateInstallments()" class="w-full md:w-auto mt-2 md:mt-0 md:mr-2 bg-green-600 text-white px-6 py-2 rounded hover:bg-green-700 transition">تولید اقساط</button>
|
115 |
+
</div>
|
116 |
+
</form>
|
117 |
+
|
118 |
+
<div id="installmentsSection" class="mt-8 hidden">
|
119 |
+
<h3 class="text-lg font-semibold mb-4 text-blue-600">جدول اقساط</h3>
|
120 |
+
<div class="table-container">
|
121 |
+
<table id="installmentsTable" class="min-w-full bg-white border">
|
122 |
+
<thead>
|
123 |
+
<tr class="bg-gray-200">
|
124 |
+
<th class="py-2 px-4 border">ردیف</th>
|
125 |
+
<th class="py-2 px-4 border">تاریخ سررسید</th>
|
126 |
+
<th class="py-2 px-4 border">مبلغ قسط</th>
|
127 |
+
<th class="py-2 px-4 border">سود</th>
|
128 |
+
<th class="py-2 px-4 border">جریمه</th>
|
129 |
+
<th class="py-2 px-4 border">اصل تسهیلات</th>
|
130 |
+
</tr>
|
131 |
+
</thead>
|
132 |
+
<tbody id="installmentsBody">
|
133 |
+
<!-- Installments will be added here -->
|
134 |
+
</tbody>
|
135 |
+
</table>
|
136 |
+
</div>
|
137 |
+
<div class="mt-4">
|
138 |
+
<button id="saveInstallmentsBtn" class="bg-blue-600 text-white px-6 py-2 rounded hover:bg-blue-700 transition hidden">ذخیره اقساط</button>
|
139 |
+
</div>
|
140 |
+
</div>
|
141 |
+
</div>
|
142 |
+
|
143 |
+
<!-- Payment Registration Tab -->
|
144 |
+
<div id="paymentTab" class="hidden bg-white p-6 rounded-lg shadow-md">
|
145 |
+
<h2 class="text-xl font-semibold mb-4 text-blue-600">فرم ثبت پرداخت</h2>
|
146 |
+
|
147 |
+
<form id="paymentForm" class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
148 |
+
<div>
|
149 |
+
<label for="paymentLoanNumber" class="block mb-2 font-medium">شماره تسهیلات</label>
|
150 |
+
<select id="paymentLoanNumber" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500" required>
|
151 |
+
<option value="">انتخاب کنید</option>
|
152 |
+
<!-- Loans will be populated here -->
|
153 |
+
</select>
|
154 |
+
</div>
|
155 |
+
|
156 |
+
<div>
|
157 |
+
<label for="paymentBankName" class="block mb-2 font-medium">نام بانک</label>
|
158 |
+
<input type="text" id="paymentBankName" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500" readonly>
|
159 |
+
</div>
|
160 |
+
|
161 |
+
<div>
|
162 |
+
<label for="paymentDate" class="block mb-2 font-medium">تاریخ پرداخت</label>
|
163 |
+
<input type="text" id="paymentDate" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500 datepicker" required>
|
164 |
+
</div>
|
165 |
+
|
166 |
+
<div>
|
167 |
+
<label for="paymentAmount" class="block mb-2 font-medium">مبلغ پرداخت (ریال)</label>
|
168 |
+
<input type="text" id="paymentAmount" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500 persian-number" required>
|
169 |
+
</div>
|
170 |
+
|
171 |
+
<div class="md:col-span-2">
|
172 |
+
<h3 class="text-lg font-semibold mb-2 text-blue-600">توزیع مبلغ پرداختی</h3>
|
173 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
174 |
+
<div>
|
175 |
+
<label for="principalAmount" class="block mb-2 font-medium">اصل تسهیلات (ریال)</label>
|
176 |
+
<input type="text" id="principalAmount" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500 persian-number" required>
|
177 |
+
</div>
|
178 |
+
<div>
|
179 |
+
<label for="interestAmount" class="block mb-2 font-medium">سود تسهیلات (ریال)</label>
|
180 |
+
<input type="text" id="interestAmount" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500 persian-number" required>
|
181 |
+
</div>
|
182 |
+
<div>
|
183 |
+
<label for="penaltyAmount" class="block mb-2 font-medium">جریمه (ریال)</label>
|
184 |
+
<input type="text" id="penaltyAmount" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500 persian-number">
|
185 |
+
</div>
|
186 |
+
</div>
|
187 |
+
</div>
|
188 |
+
|
189 |
+
<div class="md:col-span-2">
|
190 |
+
<button type="submit" class="w-full md:w-auto bg-blue-600 text-white px-6 py-2 rounded hover:bg-blue-700 transition">ثبت پرداخت</button>
|
191 |
+
</div>
|
192 |
+
</form>
|
193 |
+
|
194 |
+
<div class="mt-8">
|
195 |
+
<h3 class="text-lg font-semibold mb-4 text-blue-600">پرداختهای ثبت شده</h3>
|
196 |
+
<div class="table-container">
|
197 |
+
<table id="paymentsTable" class="min-w-full bg-white border">
|
198 |
+
<thead>
|
199 |
+
<tr class="bg-gray-200">
|
200 |
+
<th class="py-2 px-4 border">ردیف</th>
|
201 |
+
<th class="py-2 px-4 border">شماره تسهیلات</th>
|
202 |
+
<th class="py-2 px-4 border">بانک</th>
|
203 |
+
<th class="py-2 px-4 border">تاریخ پرداخت</th>
|
204 |
+
<th class="py-2 px-4 border">مبلغ پرداخت</th>
|
205 |
+
<th class="py-2 px-4 border">اصل</th>
|
206 |
+
<th class="py-2 px-4 border">سود</th>
|
207 |
+
<th class="py-2 px-4 border">جریمه</th>
|
208 |
+
<th class="py-2 px-4 border">اقدامات</th>
|
209 |
+
</tr>
|
210 |
+
</thead>
|
211 |
+
<tbody id="paymentsBody">
|
212 |
+
<!-- Payments will be added here -->
|
213 |
+
</tbody>
|
214 |
+
</table>
|
215 |
+
</div>
|
216 |
+
</div>
|
217 |
+
</div>
|
218 |
+
|
219 |
+
<!-- Discrepancy Report Tab -->
|
220 |
+
<div id="reportTab" class="hidden bg-white p-6 rounded-lg shadow-md">
|
221 |
+
<h2 class="text-xl font-semibold mb-4 text-blue-600">گزارش مغایرت بانکی</h2>
|
222 |
+
|
223 |
+
<form id="reportForm" class="mb-6">
|
224 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
225 |
+
<div>
|
226 |
+
<label for="reportLoanNumber" class="block mb-2 font-medium">شماره تسهیلات</label>
|
227 |
+
<select id="reportLoanNumber" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500">
|
228 |
+
<option value="">همه تسهیلات</option>
|
229 |
+
<!-- Loans will be populated here -->
|
230 |
+
</select>
|
231 |
+
</div>
|
232 |
+
|
233 |
+
<div>
|
234 |
+
<label for="reportBankName" class="block mb-2 font-medium">بانک</label>
|
235 |
+
<select id="reportBankName" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500">
|
236 |
+
<option value="">همه بانکها</option>
|
237 |
+
<option value="بانک ملی">بانک ملی</option>
|
238 |
+
<option value="بانک صادرات">بانک صادرات</option>
|
239 |
+
<option value="بانک ملت">بانک ملت</option>
|
240 |
+
<option value="بانک تجارت">بانک تجارت</option>
|
241 |
+
<option value="بانک رفاه">بانک رفاه</option>
|
242 |
+
<option value="بانک سپه">بانک سپه</option>
|
243 |
+
<option value="بانک کشاورزی">بانک کشاورزی</option>
|
244 |
+
<option value="بانک پارسیان">بانک پارسیان</option>
|
245 |
+
</select>
|
246 |
+
</div>
|
247 |
+
|
248 |
+
<div>
|
249 |
+
<label for="reportMethod" class="block mb-2 font-medium">روش محاسباتی</label>
|
250 |
+
<select id="reportMethod" class="w-full p-2 border rounded focus:ring-2 focus:ring-blue-500">
|
251 |
+
<option value="equal">تقسیم مساوی (اصل/سود/جریمه)</option>
|
252 |
+
<option value="interestFirst">پرداخت سود و جریمه قبل از اصل</option>
|
253 |
+
</select>
|
254 |
+
</div>
|
255 |
+
</div>
|
256 |
+
|
257 |
+
<div class="mt-4">
|
258 |
+
<button type="button" onclick="generateReport()" class="w-full md:w-auto bg-blue-600 text-white px-6 py-2 rounded hover:bg-blue-700 transition">تهیه گزارش</button>
|
259 |
+
</div>
|
260 |
+
</form>
|
261 |
+
|
262 |
+
<div id="reportResult" class="hidden">
|
263 |
+
<h3 class="text-lg font-semibold mb-4 text-blue-600">نتایج گزارش مغایرت</h3>
|
264 |
+
<div class="mb-4 p-4 bg-blue-50 rounded">
|
265 |
+
<p id="summaryText"></p>
|
266 |
+
</div>
|
267 |
+
|
268 |
+
<div class="table-container">
|
269 |
+
<table id="discrepancyTable" class="min-w-full bg-white border">
|
270 |
+
<thead>
|
271 |
+
<tr class="bg-gray-200">
|
272 |
+
<th class="py-2 px-4 border">ردیف</th>
|
273 |
+
<th class="py-2 px-4 border">شماره تسهیلات</th>
|
274 |
+
<th class="py-2 px-4 border">بانک</th>
|
275 |
+
<th class="py-2 px-4 border">تاریخ پرداخت</th>
|
276 |
+
<th class="py-2 px-4 border">مبلغ ثبت شده</th>
|
277 |
+
<th class="py-2 px-4 border">مبلغ محاسبه شده</th>
|
278 |
+
<th class="py-2 px-4 border">اختلاف</th>
|
279 |
+
<th class="py-2 px-4 border">نوع اختلاف</th>
|
280 |
+
</tr>
|
281 |
+
</thead>
|
282 |
+
<tbody id="discrepancyBody">
|
283 |
+
<!-- Report results will be added here -->
|
284 |
+
</tbody>
|
285 |
+
</table>
|
286 |
+
</div>
|
287 |
+
</div>
|
288 |
+
</div>
|
289 |
+
</div>
|
290 |
+
|
291 |
+
<script>
|
292 |
+
// Persian date picker initialization
|
293 |
+
$(document).ready(function() {
|
294 |
+
$(".datepicker").pDatepicker({
|
295 |
+
observer: true,
|
296 |
+
format: 'YYYY/MM/DD',
|
297 |
+
initialValue: false
|
298 |
+
});
|
299 |
+
|
300 |
+
// Format Persian numbers
|
301 |
+
$('.persian-number').on('input', function() {
|
302 |
+
this.value = persianJs(this.value).englishNumber().toString();
|
303 |
+
});
|
304 |
+
});
|
305 |
+
|
306 |
+
// Data storage
|
307 |
+
let loans = [];
|
308 |
+
let payments = [];
|
309 |
+
|
310 |
+
// Switch between tabs
|
311 |
+
function showTab(tabId) {
|
312 |
+
document.getElementById('loanTab').classList.add('hidden');
|
313 |
+
document.getElementById('paymentTab').classList.add('hidden');
|
314 |
+
document.getElementById('reportTab').classList.add('hidden');
|
315 |
+
|
316 |
+
document.getElementById('loanTabBtn').classList.remove('active-tab');
|
317 |
+
document.getElementById('paymentTabBtn').classList.remove('active-tab');
|
318 |
+
document.getElementById('reportTabBtn').classList.remove('active-tab');
|
319 |
+
|
320 |
+
document.getElementById(tabId).classList.remove('hidden');
|
321 |
+
document.getElementById(tabId + 'Btn').classList.add('active-tab');
|
322 |
+
|
323 |
+
if (tabId === 'paymentTab') {
|
324 |
+
populateLoanNumbers('paymentLoanNumber');
|
325 |
+
document.getElementById('paymentBankName').value = '';
|
326 |
+
} else if (tabId === 'reportTab') {
|
327 |
+
populateLoanNumbers('reportLoanNumber');
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
// Populate loan numbers in dropdowns
|
332 |
+
function populateLoanNumbers(elementId) {
|
333 |
+
const selectElement = document.getElementById(elementId);
|
334 |
+
|
335 |
+
// Save the current selected value
|
336 |
+
const currentValue = selectElement.value;
|
337 |
+
|
338 |
+
// Clear existing options except the first one
|
339 |
+
while (selectElement.options.length > 1) {
|
340 |
+
selectElement.remove(1);
|
341 |
+
}
|
342 |
+
|
343 |
+
// Add loan numbers from the loans array
|
344 |
+
loans.forEach(loan => {
|
345 |
+
const option = document.createElement('option');
|
346 |
+
option.value = loan.loanNumber;
|
347 |
+
option.textContent = loan.loanNumber;
|
348 |
+
selectElement.appendChild(option);
|
349 |
+
});
|
350 |
+
|
351 |
+
// Restore the previous selection if it still exists
|
352 |
+
if (currentValue && Array.from(selectElement.options).some(o => o.value === currentValue)) {
|
353 |
+
selectElement.value = currentValue;
|
354 |
+
}
|
355 |
+
}
|
356 |
+
|
357 |
+
// Handle loan form submission
|
358 |
+
document.getElementById('loanForm').addEventListener('submit', function(e) {
|
359 |
+
e.preventDefault();
|
360 |
+
|
361 |
+
const loan = {
|
362 |
+
loanNumber: document.getElementById('loanNumber').value,
|
363 |
+
bankName: document.getElementById('bankName').value,
|
364 |
+
loanType: document.getElementById('loanType').value,
|
365 |
+
loanAmount: parseFloat(document.getElementById('loanAmount').value.replace(/,/g, '')),
|
366 |
+
installmentCount: parseInt(document.getElementById('installmentCount').value),
|
367 |
+
installmentAmount: parseFloat(document.getElementById('installmentAmount').value.replace(/,/g, '')),
|
368 |
+
interestRate: parseFloat(document.getElementById('interestRate').value),
|
369 |
+
penaltyRate: parseFloat(document.getElementById('penaltyRate').value),
|
370 |
+
installments: [],
|
371 |
+
createdAt: new Date().toISOString()
|
372 |
+
};
|
373 |
+
|
374 |
+
// Check if this loan number already exists
|
375 |
+
const existingIndex = loans.findIndex(l => l.loanNumber === loan.loanNumber);
|
376 |
+
if (existingIndex !== -1) {
|
377 |
+
loans[existingIndex] = loan; // Update existing loan
|
378 |
+
alert('تسهیلات با این شماره قبلاً ثبت شده و اطلاعات آن بهروزرسانی شد.');
|
379 |
+
} else {
|
380 |
+
loans.push(loan); // Add new loan
|
381 |
+
alert('تسهیلات جدید با موفقیت ثبت شد.');
|
382 |
+
}
|
383 |
+
|
384 |
+
// Clear the form
|
385 |
+
// this.reset();
|
386 |
+
|
387 |
+
// Show the installments section
|
388 |
+
document.getElementById('installmentsSection').classList.remove('hidden');
|
389 |
+
});
|
390 |
+
|
391 |
+
// Generate installments
|
392 |
+
function generateInstallments() {
|
393 |
+
const loanNumber = document.getElementById('loanNumber').value;
|
394 |
+
const installmentCount = parseInt(document.getElementById('installmentCount').value);
|
395 |
+
const installmentAmount = parseFloat(document.getElementById('installmentAmount').value.replace(/,/g, ''));
|
396 |
+
const interestRate = parseFloat(document.getElementById('interestRate').value);
|
397 |
+
const penaltyRate = parseFloat(document.getElementById('penaltyRate').value);
|
398 |
+
|
399 |
+
if (!loanNumber || isNaN(installmentCount) || isNaN(installmentAmount) || isNaN(interestRate)) {
|
400 |
+
alert('لطفاً اطلاعات تسهیلات را کامل کنید.');
|
401 |
+
return;
|
402 |
+
}
|
403 |
+
|
404 |
+
const loanIndex = loans.findIndex(l => l.loanNumber === loanNumber);
|
405 |
+
if (loanIndex === -1) {
|
406 |
+
alert('ابتدا باید تسهیلات را ذخیره کنید.');
|
407 |
+
return;
|
408 |
+
}
|
409 |
+
|
410 |
+
const tbody = document.getElementById('installmentsBody');
|
411 |
+
tbody.innerHTML = '';
|
412 |
+
|
413 |
+
const loanAmount = loans[loanIndex].loanAmount;
|
414 |
+
const fixedPrincipal = loanAmount / installmentCount;
|
415 |
+
|
416 |
+
for (let i = 0; i < installmentCount; i++) {
|
417 |
+
const tr = document.createElement('tr');
|
418 |
+
tr.className = 'hover:bg-gray-50';
|
419 |
+
|
420 |
+
const td1 = document.createElement('td');
|
421 |
+
td1.className = 'py-2 px-4 border text-center';
|
422 |
+
td1.textContent = i + 1;
|
423 |
+
|
424 |
+
const td2 = document.createElement('td');
|
425 |
+
td2.className = 'py-2 px-4 border';
|
426 |
+
const dateInput = document.createElement('input');
|
427 |
+
dateInput.type = 'text';
|
428 |
+
dateInput.className = 'w-full p-2 border rounded datepicker';
|
429 |
+
dateInput.placeholder = 'انتخاب تاریخ';
|
430 |
+
dateInput.required = true;
|
431 |
+
td2.appendChild(dateInput);
|
432 |
+
$(dateInput).pDatepicker({
|
433 |
+
observer: true,
|
434 |
+
format: 'YYYY/MM/DD',
|
435 |
+
initialValue: false
|
436 |
+
});
|
437 |
+
|
438 |
+
const td3 = document.createElement('td');
|
439 |
+
td3.className = 'py-2 px-4 border text-left';
|
440 |
+
td3.textContent = installmentAmount.toLocaleString('fa-IR');
|
441 |
+
|
442 |
+
// Calculate interest
|
443 |
+
const remainingAmount = loanAmount - (fixedPrincipal * i);
|
444 |
+
const interest = (remainingAmount * interestRate / 100) / 12;
|
445 |
+
|
446 |
+
const td4 = document.createElement('td');
|
447 |
+
td4.className = 'py-2 px-4 border text-left';
|
448 |
+
td4.textContent = Math.round(interest).toLocaleString('fa-IR');
|
449 |
+
|
450 |
+
const td5 = document.createElement('td');
|
451 |
+
td5.className = 'py-2 px-4 border text-left';
|
452 |
+
td5.textContent = '۰'; // Default to 0 for penalty
|
453 |
+
|
454 |
+
const td6 = document.createElement('td');
|
455 |
+
td6.className = 'py-2 px-4 border text-left';
|
456 |
+
td6.textContent = Math.round(installmentAmount - interest).toLocaleString('fa-IR');
|
457 |
+
|
458 |
+
tr.appendChild(td1);
|
459 |
+
tr.appendChild(td2);
|
460 |
+
tr.appendChild(td3);
|
461 |
+
tr.appendChild(td4);
|
462 |
+
tr.appendChild(td5);
|
463 |
+
tr.appendChild(td6);
|
464 |
+
|
465 |
+
tbody.appendChild(tr);
|
466 |
+
}
|
467 |
+
|
468 |
+
document.getElementById('saveInstallmentsBtn').classList.remove('hidden');
|
469 |
+
}
|
470 |
+
|
471 |
+
// Save installments
|
472 |
+
document.getElementById('saveInstallmentsBtn').addEventListener('click', function() {
|
473 |
+
const loanNumber = document.getElementById('loanNumber').value;
|
474 |
+
const loanIndex = loans.findIndex(l => l.loanNumber === loanNumber);
|
475 |
+
|
476 |
+
if (loanIndex === -1) {
|
477 |
+
alert('تسهیلات یافت نشد.');
|
478 |
+
return;
|
479 |
+
}
|
480 |
+
|
481 |
+
const rows = document.getElementById('installmentsBody').rows;
|
482 |
+
const installments = [];
|
483 |
+
|
484 |
+
for (let i = 0; i < rows.length; i++) {
|
485 |
+
const cells = rows[i].cells;
|
486 |
+
|
487 |
+
const installment = {
|
488 |
+
number: i + 1,
|
489 |
+
dueDate: cells[1].querySelector('input').value,
|
490 |
+
amount: parseFloat(document.getElementById('installmentAmount').value.replace(/,/g, '')),
|
491 |
+
interest: parseFloat(persianJs(cells[3].textContent).englishNumber().toString().replace(/,/g, '')),
|
492 |
+
penalty: parseFloat(persianJs(cells[4].textContent).englishNumber().toString().replace(/,/g, '')),
|
493 |
+
principal: parseFloat(persianJs(cells[5].textContent).englishNumber().toString().replace(/,/g, ''))
|
494 |
+
};
|
495 |
+
|
496 |
+
installments.push(installment);
|
497 |
+
}
|
498 |
+
|
499 |
+
loans[loanIndex].installments = installments;
|
500 |
+
alert('اقساط با موفقیت ذخیره شدند.');
|
501 |
+
});
|
502 |
+
|
503 |
+
// Update bank name when loan number is selected in payment form
|
504 |
+
document.getElementById('paymentLoanNumber').addEventListener('change', function() {
|
505 |
+
const loanNumber = this.value;
|
506 |
+
if (!loanNumber) {
|
507 |
+
document.getElementById('paymentBankName').value = '';
|
508 |
+
return;
|
509 |
+
}
|
510 |
+
|
511 |
+
const loan = loans.find(l => l.loanNumber === loanNumber);
|
512 |
+
if (loan) {
|
513 |
+
document.getElementById('paymentBankName').value = loan.bankName;
|
514 |
+
}
|
515 |
+
});
|
516 |
+
|
517 |
+
// Handle payment form submission
|
518 |
+
document.getElementById('paymentForm').addEventListener('submit', function(e) {
|
519 |
+
e.preventDefault();
|
520 |
+
|
521 |
+
const payment = {
|
522 |
+
loanNumber: document.getElementById('paymentLoanNumber').value,
|
523 |
+
bankName: document.getElementById('paymentBankName').value,
|
524 |
+
paymentDate: document.getElementById('paymentDate').value,
|
525 |
+
paymentAmount: parseFloat(document.getElementById('paymentAmount').value.replace(/,/g, '')),
|
526 |
+
principalAmount: parseFloat(document.getElementById('principalAmount').value.replace(/,/g, '')),
|
527 |
+
interestAmount: parseFloat(document.getElementById('interestAmount').value.replace(/,/g, '')),
|
528 |
+
penaltyAmount: parseFloat((document.getElementById('penaltyAmount').value || '').replace(/,/g, '')) || 0,
|
529 |
+
createdAt: new Date().toISOString()
|
530 |
+
};
|
531 |
+
|
532 |
+
// Validate payment
|
533 |
+
const calculatedTotal = payment.principalAmount + payment.interestAmount + payment.penaltyAmount;
|
534 |
+
if (Math.abs(calculatedTotal - payment.paymentAmount) > 1) {
|
535 |
+
alert(`جمع مبالغ جزء (${calculatedTotal.toLocaleString('fa-IR')}) با مبلغ کل پرداختی (${payment.paymentAmount.toLocaleString('fa-IR')}) مغایرت دارد.`);
|
536 |
+
return;
|
537 |
+
}
|
538 |
+
|
539 |
+
payments.push(payment);
|
540 |
+
addPaymentToTable(payment);
|
541 |
+
|
542 |
+
// Clear the form (except for loan number)
|
543 |
+
document.getElementById('paymentDate').value = '';
|
544 |
+
document.getElementById('paymentAmount').value = '';
|
545 |
+
document.getElementById('principalAmount').value = '';
|
546 |
+
document.getElementById('interestAmount').value = '';
|
547 |
+
document.getElementById('penaltyAmount').value = '';
|
548 |
+
|
549 |
+
alert('پرداخت با موفقیت ثبت شد.');
|
550 |
+
});
|
551 |
+
|
552 |
+
// Add payment to payments table
|
553 |
+
function addPaymentToTable(payment) {
|
554 |
+
const tbody = document.getElementById('paymentsBody');
|
555 |
+
const tr = document.createElement('tr');
|
556 |
+
tr.className = 'hover:bg-gray-50';
|
557 |
+
tr.dataset.paymentId = payments.length - 1;
|
558 |
+
|
559 |
+
const td1 = document.createElement('td');
|
560 |
+
td1.className = 'py-2 px-4 border text-center';
|
561 |
+
td1.textContent = payments.length;
|
562 |
+
|
563 |
+
const td2 = document.createElement('td');
|
564 |
+
td2.className = 'py-2 px-4 border text-center';
|
565 |
+
td2.textContent = payment.loanNumber;
|
566 |
+
|
567 |
+
const td3 = document.createElement('td');
|
568 |
+
td3.className = 'py-2 px-4 border';
|
569 |
+
td3.textContent = payment.bankName;
|
570 |
+
|
571 |
+
const td4 = document.createElement('td');
|
572 |
+
td4.className = 'py-2 px-4 border text-center';
|
573 |
+
td4.textContent = payment.paymentDate;
|
574 |
+
|
575 |
+
const td5 = document.createElement('td');
|
576 |
+
td5.className = 'py-2 px-4 border text-left';
|
577 |
+
td5.textContent = payment.paymentAmount.toLocaleString('fa-IR');
|
578 |
+
|
579 |
+
const td6 = document.createElement('td');
|
580 |
+
td6.className = 'py-2 px-4 border text-left';
|
581 |
+
td6.textContent = payment.principalAmount.toLocaleString('fa-IR');
|
582 |
+
|
583 |
+
const td7 = document.createElement('td');
|
584 |
+
td7.className = 'py-2 px-4 border text-left';
|
585 |
+
td7.textContent = payment.interestAmount.toLocaleString('fa-IR');
|
586 |
+
|
587 |
+
const td8 = document.createElement('td');
|
588 |
+
td8.className = 'py-2 px-4 border text-left';
|
589 |
+
td8.textContent = payment.penaltyAmount.toLocaleString('fa-IR');
|
590 |
+
|
591 |
+
const td9 = document.createElement('td');
|
592 |
+
td9.className = 'py-2 px-4 border text-center';
|
593 |
+
const deleteBtn = document.createElement('button');
|
594 |
+
deleteBtn.className = 'text-red-600 hover:text-red-800';
|
595 |
+
deleteBtn.innerHTML = 'حذف';
|
596 |
+
deleteBtn.addEventListener('click', function() {
|
597 |
+
deletePayment(this.closest('tr').dataset.paymentId);
|
598 |
+
});
|
599 |
+
td9.appendChild(deleteBtn);
|
600 |
+
|
601 |
+
tr.appendChild(td1);
|
602 |
+
tr.appendChild(td2);
|
603 |
+
tr.appendChild(td3);
|
604 |
+
tr.appendChild(td4);
|
605 |
+
tr.appendChild(td5);
|
606 |
+
tr.appendChild(td6);
|
607 |
+
tr.appendChild(td7);
|
608 |
+
tr.appendChild(td8);
|
609 |
+
tr.appendChild(td9);
|
610 |
+
|
611 |
+
tbody.appendChild(tr);
|
612 |
+
}
|
613 |
+
|
614 |
+
// Delete a payment
|
615 |
+
function deletePayment(paymentId) {
|
616 |
+
if (confirm('آیا از حذف این پرداخت مطمئن هستید؟')) {
|
617 |
+
payments.splice(paymentId, 1);
|
618 |
+
refreshPaymentsTable();
|
619 |
+
|
620 |
+
// Reindex payments
|
621 |
+
payments = payments.map((payment, index) => {
|
622 |
+
return {...payment, id: index};
|
623 |
+
});
|
624 |
+
}
|
625 |
+
}
|
626 |
+
|
627 |
+
// Refresh payments table
|
628 |
+
function refreshPaymentsTable() {
|
629 |
+
const tbody = document.getElementById('paymentsBody');
|
630 |
+
tbody.innerHTML = '';
|
631 |
+
|
632 |
+
payments.forEach((payment, index) => {
|
633 |
+
payment.id = index; // Update payment ID
|
634 |
+
addPaymentToTable(payment);
|
635 |
+
});
|
636 |
+
}
|
637 |
+
|
638 |
+
// Generate discrepancy report
|
639 |
+
function generateReport() {
|
640 |
+
const loanNumberFilter = document.getElementById('reportLoanNumber').value;
|
641 |
+
const bankNameFilter = document.getElementById('reportBankName').value;
|
642 |
+
const method = document.getElementById('reportMethod').value;
|
643 |
+
|
644 |
+
// Filter payments
|
645 |
+
let filteredPayments = [...payments];
|
646 |
+
|
647 |
+
if (loanNumberFilter) {
|
648 |
+
filteredPayments = filteredPayments.filter(p => p.loanNumber === loanNumberFilter);
|
649 |
+
}
|
650 |
+
|
651 |
+
if (bankNameFilter) {
|
652 |
+
filteredPayments = filteredPayments.filter(p => p.bankName === bankNameFilter);
|
653 |
+
}
|
654 |
+
|
655 |
+
if (filteredPayments.length === 0) {
|
656 |
+
alert('با فیلترهای انتخاب شده پرداختی یافت نشد.');
|
657 |
+
return;
|
658 |
+
}
|
659 |
+
|
660 |
+
// Process each payment based on the selected method
|
661 |
+
const discrepancies = [];
|
662 |
+
|
663 |
+
filteredPayments.forEach(payment => {
|
664 |
+
const loan = loans.find(l => l.loanNumber === payment.loanNumber);
|
665 |
+
if (!loan) return;
|
666 |
+
|
667 |
+
if (method === 'equal') {
|
668 |
+
// Equal distribution method
|
669 |
+
const calculatedPrincipal = Math.round(payment.paymentAmount / 3);
|
670 |
+
const calculatedInterest = Math.round(payment.paymentAmount / 3);
|
671 |
+
const calculatedPenalty = Math.round(payment.paymentAmount / 3);
|
672 |
+
|
673 |
+
// Calculate differences
|
674 |
+
const principalDiff = payment.principalAmount - calculatedPrincipal;
|
675 |
+
const interestDiff = payment.interestAmount - calculatedInterest;
|
676 |
+
const penaltyDiff = payment.penaltyAmount - calculatedPenalty;
|
677 |
+
|
678 |
+
if (principalDiff !== 0 || interestDiff !== 0 || penaltyDiff !== 0) {
|
679 |
+
discrepancies.push({
|
680 |
+
loanNumber: payment.loanNumber,
|
681 |
+
bankName: payment.bankName,
|
682 |
+
paymentDate: payment.paymentDate,
|
683 |
+
recordedAmount: `${payment.principalAmount.toLocaleString('fa-IR')} + ${payment.interestAmount.toLocaleString('fa-IR')} + ${payment.penaltyAmount.toLocaleString('fa-IR')}`,
|
684 |
+
calculatedAmount: `${calculatedPrincipal.toLocaleString('fa-IR')} + ${calculatedInterest.toLocaleString('fa-IR')} + ${calculatedPenalty.toLocaleString('fa-IR')}`,
|
685 |
+
difference: (principalDiff + interestDiff + penaltyDiff).toLocaleString('fa-IR'),
|
686 |
+
type: 'تقسیم مساوی'
|
687 |
+
});
|
688 |
+
}
|
689 |
+
} else if (method === 'interestFirst') {
|
690 |
+
// Interest and penalty first method
|
691 |
+
|
692 |
+
// 1. Apply to penalty
|
693 |
+
const remainingAfterPenalty = Math.max(0, payment.paymentAmount - payment.penaltyAmount);
|
694 |
+
|
695 |
+
// 2. Apply to interest
|
696 |
+
const remainingAfterInterest = Math.max(0, remainingAfterPenalty - payment.interestAmount);
|
697 |
+
|
698 |
+
// 3. Remainder goes to principal
|
699 |
+
const calculatedPrincipal = remainingAfterInterest;
|
700 |
+
const calculatedInterest = payment.interestAmount;
|
701 |
+
const calculatedPenalty = payment.penaltyAmount;
|
702 |
+
|
703 |
+
// Calculate differences
|
704 |
+
const principalDiff = payment.principalAmount - calculatedPrincipal;
|
705 |
+
const interestDiff = 0; // No difference in interest as we use the exact amount
|
706 |
+
const penaltyDiff = 0; // No difference in penalty as we use the exact amount
|
707 |
+
|
708 |
+
if (principalDiff !== 0 || interestDiff !== 0 || penaltyDiff !== 0) {
|
709 |
+
discrepancies.push({
|
710 |
+
loanNumber: payment.loanNumber,
|
711 |
+
bankName: payment.bankName,
|
712 |
+
paymentDate: payment.paymentDate,
|
713 |
+
recordedAmount: `${payment.principalAmount.toLocaleString('fa-IR')} + ${payment.interestAmount.toLocaleString('fa-IR')} + ${payment.penaltyAmount.toLocaleString('fa-IR')}`,
|
714 |
+
calculatedAmount: `${calculatedPrincipal.toLocaleString('fa-IR')} + ${calculatedInterest.toLocaleString('fa-IR')} + ${calculatedPenalty.toLocaleString('fa-IR')}`,
|
715 |
+
difference: (principalDiff + interestDiff + penaltyDiff).toLocaleString('fa-IR'),
|
716 |
+
type: 'سود و جریمه قبل از اصل'
|
717 |
+
});
|
718 |
+
}
|
719 |
+
}
|
720 |
+
});
|
721 |
+
|
722 |
+
// Display results
|
723 |
+
if (discrepancies.length === 0) {
|
724 |
+
document.getElementById('summaryText').textContent = `هیچ مغایرتی با روش "${method === 'equal' ? 'تقسیم مساوی' : 'سود و جریمه قبل از اصل'}" یافت نشد.`;
|
725 |
+
document.getElementById('discrepancyBody').innerHTML = '';
|
726 |
+
} else {
|
727 |
+
document.getElementById('summaryText').textContent = `${discrepancies.length} مغایرت با روش "${method === 'equal' ? 'تقسیم مساوی' : 'سود و جریمه قبل از اصل'}" یافت شد.`;
|
728 |
+
|
729 |
+
const tbody = document.getElementById('discrepancyBody');
|
730 |
+
tbody.innerHTML = '';
|
731 |
+
|
732 |
+
discrepancies.forEach((item, index) => {
|
733 |
+
const tr = document.createElement('tr');
|
734 |
+
tr.className = 'hover:bg-gray-50';
|
735 |
+
|
736 |
+
const td1 = document.createElement('td');
|
737 |
+
td1.className = 'py-2 px-4 border text-center';
|
738 |
+
td1.textContent = index + 1;
|
739 |
+
|
740 |
+
const td2 = document.createElement('td');
|
741 |
+
td2.className = 'py-2 px-4 border text-center';
|
742 |
+
td2.textContent = item.loanNumber;
|
743 |
+
|
744 |
+
const td3 = document.createElement('td');
|
745 |
+
td3.className = 'py-2 px-4 border';
|
746 |
+
td3.textContent = item.bankName;
|
747 |
+
|
748 |
+
const td4 = document.createElement('td');
|
749 |
+
td4.className = 'py-2 px-4 border text-center';
|
750 |
+
td4.textContent = item.paymentDate;
|
751 |
+
|
752 |
+
const td5 = document.createElement('td');
|
753 |
+
td5.className = 'py-2 px-4 border text-left';
|
754 |
+
td5.textContent = item.recordedAmount;
|
755 |
+
|
756 |
+
const td6 = document.createElement('td');
|
757 |
+
td6.className = 'py-2 px-4 border text-left';
|
758 |
+
td6.textContent = item.calculatedAmount;
|
759 |
+
|
760 |
+
const td7 = document.createElement('td');
|
761 |
+
td7.className = 'py-2 px-4 border text-left';
|
762 |
+
td7.textContent = item.difference;
|
763 |
+
|
764 |
+
const td8 = document.createElement('td');
|
765 |
+
td8.className = 'py-2 px-4 border';
|
766 |
+
td8.textContent = item.type;
|
767 |
+
|
768 |
+
tr.appendChild(td1);
|
769 |
+
tr.appendChild(td2);
|
770 |
+
tr.appendChild(td3);
|
771 |
+
tr.appendChild(td4);
|
772 |
+
tr.appendChild(td5);
|
773 |
+
tr.appendChild(td6);
|
774 |
+
tr.appendChild(td7);
|
775 |
+
tr.appendChild(td8);
|
776 |
+
|
777 |
+
tbody.appendChild(tr);
|
778 |
+
});
|
779 |
+
}
|
780 |
+
|
781 |
+
document.getElementById('reportResult').classList.remove('hidden');
|
782 |
+
}
|
783 |
+
</script>
|
784 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Amiali6262/https-huggingface-co-amiali62623" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
785 |
+
</html>
|
prompts.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
من یک وب اپلیکیشن میخام که با پایتون نوشته بشه و میخام در اون بتونم تسهیلات بانکی رو تعریف کمک نوع تسهیلات ، مبلغ تسهیلات، تعداد اقساط، مبلغ هر قسط رو دستی وارد کنم ،تاریخ سررسید هر قسط رو مشخص کنم ، درصد سود ، درصد جریمه رو مشخص کنم و به تفکیک بانک و شماره تسهیلات ثبت کنم بعد میخام جدول پرداخت رو داشته باشم و بتونم هر پرداخت مربوط به هر شماهر تسهیلات رو با تاریخ و مبلغ پرداخت ثبت کنم و همچین مشخص کنم هر پرداخت که انجام شده چقدرش برای اصل تسهیلات برداشت شده چقدر برای سود تسهیلات و چقدر برای جریمه . میخام اینها رو به صورت دستی ثبت کنم در قدم بعدی میخام طی چند روش محاسبات سیستمی انجام بدم و بدونم بانک مبالغ برداشت شده به درستی به تفکیک اصل ، سود و جریمه برداشته یا نه و مغایرتها رو گزارش بگیرم معمولا بانکها از چند روش استفاده می کنند روش اول : از هر پرداخت به نسبت مساوی از اصل ، سود و جریمه برداشت میکنن روش دوم : در هر پرداخت ابتدا سود و جرایم را برداشت میکنن و سپس از اصل وام میخام تمامی کپشن ها به صورت فارسی باشه فیلدهای دارای تاریخ به صورت تقویم شمسی باشه مبالغ به صورت 3 رقم جدا کننده داشته باشه
|