Spaces:
Running
Running
FIX TRIỆT ĐỂ: 'BRAND ck X%' (Malloca ck 35%) → discountPercent toàn đơn trong qr-payment parsePrompt (đơn lưu + Excel từ đơn đều có CK)
Browse files- qr-payment.js +3 -0
qr-payment.js
CHANGED
|
@@ -67,6 +67,9 @@ function parsePrompt(text){
|
|
| 67 |
if(nt) notes.push(nt);
|
| 68 |
return;
|
| 69 |
}
|
|
|
|
|
|
|
|
|
|
| 70 |
parseItemDiscountLine(line,itemDiscounts);
|
| 71 |
if(Object.keys(itemDiscounts).length&&line.match(/\b[A-Za-z]{1,8}[A-Za-z0-9._\-\/]{1,30}\d[A-Za-z0-9._\-\/]*\b/i)&&line.match(/\b(ck|chiết khấu|chiet khau|giảm|giam|discount)\b/i))return;
|
| 72 |
// FIX: also match 'WORD ck X%' (e.g. 'Malloca ck 35%') — global discount
|
|
|
|
| 67 |
if(nt) notes.push(nt);
|
| 68 |
return;
|
| 69 |
}
|
| 70 |
+
// FIX TRIỆT ĐỂ: 'BRAND ck X%' (vd 'Malloca ck 35%') → chiết khấu TOÀN ĐƠN (discountPercent), không chỉ itemDiscount
|
| 71 |
+
var _brandCk=line.match(/\b(malloca|eurogold|grob|canzy|demax|hafele|garis|boss|binova|tekakj|govitek)\s+ck\s*([\d.,]+)\s*%?/i);
|
| 72 |
+
if(_brandCk){var _bv=parseFloat(_brandCk[2].replace(/\./g,'').replace(',','.'));if(_bv>0&&_bv<=100)discountPercent=_bv;}
|
| 73 |
parseItemDiscountLine(line,itemDiscounts);
|
| 74 |
if(Object.keys(itemDiscounts).length&&line.match(/\b[A-Za-z]{1,8}[A-Za-z0-9._\-\/]{1,30}\d[A-Za-z0-9._\-\/]*\b/i)&&line.match(/\b(ck|chiết khấu|chiet khau|giảm|giam|discount)\b/i))return;
|
| 75 |
// FIX: also match 'WORD ck X%' (e.g. 'Malloca ck 35%') — global discount
|