change accounting-number

This commit is contained in:
2026-11-04 11:56:53 +03:30
parent 21da78943c
commit 9ec71efcbb
3 changed files with 47 additions and 3 deletions
+13 -3
View File
@@ -114,14 +114,13 @@ class ShayeganSyncService
return ['ok' => false, 'message' => 'شماره معین مشتریان (shayegan_moin_customer) در تنظیمات خالی است'];
}
$moinRaw = trim($this->config->getString('shayegan_moin_customer', ''));
$name = trim((string) ($customer->name ?? ''));
if ($name === '') {
$name = 'مشتری ' . $customer->id;
}
// مشتری تفصیلی شناور است (Job/Put)، نه حساب زیر معین. شماره = معین + کد کاربری.
$requestedAccountNumber = $moinRaw . ((string) (int) $customer->id);
// تفصیلی شناور: کل ثابت + کد کاربری ۷رقمی. مشتری ۱ → 1210000001
$requestedAccountNumber = $this->customerTafsilNumber((int) $customer->id);
$guid = (string) Str::uuid();
$put = [[
@@ -653,6 +652,17 @@ class ShayeganSyncService
return trim((string) ($customer->moshtari_code ?? ''));
}
/** کد کل (پیش‌فرض 121) + کد کاربری با صفر تا ۷ رقم. */
private function customerTafsilNumber(int $customerId): string
{
$kol = trim($this->config->getString('shayegan_kol_customer', '121'));
if ($kol === '') {
$kol = '121';
}
return $kol . str_pad((string) $customerId, 7, '0', STR_PAD_LEFT);
}
private function scaleAmount(float $amount): float
{
$scale = (float) $this->config->getString('shayegan_amount_scale', '1');