سامانه صدور فاکتور و حسابداری
Update products.js
davoodmehraban89 committed
Sep 28, 2026 at 00:11 UTC
b5b1a56f20f53d2f7c9fffcab662001f151d648a
1 file changed
+3
-3
js/products.js
+3
-3
@@ -6,8 +6,8 @@ function commitSaveProduct(){
6
const name=document.getElementById('prod-name-input').value;
7
const spec=document.getElementById('prod-spec-input').value||'';
8
const unit=document.getElementById('prod-unit-input').value||'عدد';
9
- const buy_price=parseFloat(document.getElementById('prod-buy-input').value)||0;
10
- const sale_price=parseFloat(document.getElementById('prod-sale-input').value)||0;
9
+ const buy_price=parseFormattedNumber(document.getElementById('prod-buy-input').value);
10
+ const sale_price=parseFormattedNumber(document.getElementById('prod-sale-input').value);
11
const internal_id=document.getElementById('prod-internal-id-input').value||'';
12
if(!name){alert('عنوان کالا الزامی است.');return;}
13
datastore.products.push({id:'P_'+Date.now(),ownerUserId:currentUser.id,code,name,spec,type:'good',unit,buy_price,sale_price,stock:0,internal_id});
@@ -42,7 +42,7 @@ function saveQuickProduct(){
42
const name=document.getElementById('quick-p-name').value;
43
const spec=document.getElementById('quick-p-spec').value||'';
44
const unit=document.getElementById('quick-p-unit').value||'عدد';
45
- const price=parseFloat(document.getElementById('quick-p-price').value)||0;
45
+ const price=parseFormattedNumber(document.getElementById('quick-p-price').value);
46
const internal_id=document.getElementById('quick-p-internal-id').value||'';
47
if(!name){alert('عنوان کالا الزامی است.');return;}
48
const newId='P_'+Date.now();