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
@@ -3,6 +3,7 @@
فرمت هر خط:
- YYYY-MM-DD | موضوع | مسیر فایل(ها) | نکتهٔ ۱ خطی
- 2026-11-04 | فرمت کد تفصیلی شایگان | `ShayeganSyncService::customerTafsilNumber` | کل `shayegan_kol_customer` (121) + کد کاربر ۷رقمی: مشتری 1 → `1210000001`. کد ذخیره‌شدهٔ قبلی عوض نمی‌شود
- 2026-11-02 | جدول اسناد شایگان | `shayeganTable.vue` + `ShayeganController::table` | BaseTable؛ پاسخ بدون `query` را خود فرانت به `{rows,query}` برمی‌گرداند. ستون عملیات `ops` است تا در RTL هشدار fixed ندهد
- 2026-11-02 | ویرایش کد حسابداری شایگان | `CustomerAccountingCodeModal.vue` | provider شایگان هم `moshtari_code` ذخیره می‌کند؛ قبلاً فقط پرگار/ته‌حساب/زرین قبول می‌شد و پیام «حسابداری فعال نیست» می‌آمد
- 2026-11-02 | مشتری تفصیلی شناور | `ShayeganSyncService::registerCustomer` → `Job/Put` | معین 12101 حساب جدا نمی‌سازد؛ `JobNumber` = معین+کد (`12101530`). گروه: setting `shayegan_job_group`
+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');
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
/**
* تفصیلی = کد کل + کد کاربری ۷رقمی. مثال: 121 و مشتری 1 → 1210000001.
* مقدار تنظیمات عوض نمی‌شود.
*/
return new class extends Migration
{
public function up(): void
{
if (! Schema::hasTable('settings')) {
return;
}
DB::table('settings')->where('key', 'shayegan_kol_customer')->update([
'description' => 'ابتدای ثابت کد تفصیلی. کد = این مقدار + کد کاربری ۷رقمی با صفر. مثال: 121 و مشتری 1 → 1210000001.',
'updated_at' => now(),
]);
DB::table('settings')->where('key', 'shayegan_moin_customer')->update([
'description' => 'معین مشتریان. به شماره تفصیلی چسبانده نمی‌شود؛ شماره = کد کل + کد کاربری ۷رقمی.',
'updated_at' => now(),
]);
}
public function down(): void
{
}
};