change accounting-number
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user