diff --git a/Modules/HrmAddon/Database/migrations/2025_05_12_094745_create_departments_table.php b/Modules/HrmAddon/Database/migrations/2025_05_12_094745_create_departments_table.php index 00fadca7..593bfe29 100644 --- a/Modules/HrmAddon/Database/migrations/2025_05_12_094745_create_departments_table.php +++ b/Modules/HrmAddon/Database/migrations/2025_05_12_094745_create_departments_table.php @@ -11,14 +11,16 @@ */ public function up(): void { - Schema::create('departments', function (Blueprint $table) { - $table->id(); - $table->foreignId('business_id')->constrained()->cascadeOnDelete(); - $table->string('name')->nullable(); - $table->text('description')->nullable(); - $table->boolean('status')->default(1); - $table->timestamps(); - }); + if (!Schema::hasTable('departments')) { + Schema::create('departments', function (Blueprint $table) { + $table->id(); + $table->foreignId('business_id')->constrained()->cascadeOnDelete(); + $table->string('name')->nullable(); + $table->text('description')->nullable(); + $table->boolean('status')->default(1); + $table->timestamps(); + }); + } } /** diff --git a/Modules/HrmAddon/Database/migrations/2025_05_12_130921_create_designations_table.php b/Modules/HrmAddon/Database/migrations/2025_05_12_130921_create_designations_table.php index 9acaf54f..66d3cc4a 100644 --- a/Modules/HrmAddon/Database/migrations/2025_05_12_130921_create_designations_table.php +++ b/Modules/HrmAddon/Database/migrations/2025_05_12_130921_create_designations_table.php @@ -11,14 +11,16 @@ */ public function up(): void { - Schema::create('designations', function (Blueprint $table) { - $table->id(); - $table->string('name')->nullable(); - $table->foreignId('business_id')->constrained()->cascadeOnDelete(); - $table->text('description')->nullable(); - $table->boolean('status')->default(1); - $table->timestamps(); - }); + if (!Schema::hasTable('designations')) { + Schema::create('designations', function (Blueprint $table) { + $table->id(); + $table->string('name')->nullable(); + $table->foreignId('business_id')->constrained()->cascadeOnDelete(); + $table->text('description')->nullable(); + $table->boolean('status')->default(1); + $table->timestamps(); + }); + } } /** diff --git a/Modules/HrmAddon/Database/migrations/2025_05_12_152226_create_shifts_table.php b/Modules/HrmAddon/Database/migrations/2025_05_12_152226_create_shifts_table.php index 4b2d8cb5..87936b86 100644 --- a/Modules/HrmAddon/Database/migrations/2025_05_12_152226_create_shifts_table.php +++ b/Modules/HrmAddon/Database/migrations/2025_05_12_152226_create_shifts_table.php @@ -11,19 +11,21 @@ */ public function up(): void { - Schema::create('shifts', function (Blueprint $table) { - $table->id(); - $table->string('name'); - $table->foreignId('business_id')->constrained()->cascadeOnDelete(); - $table->time('start_time'); - $table->time('end_time'); - $table->time('start_break_time')->nullable(); - $table->time('end_break_time')->nullable(); - $table->time('break_time')->nullable(); - $table->string('break_status')->nullable(); - $table->boolean('status')->default(1); - $table->timestamps(); - }); + if (!Schema::hasTable('shifts')) { + Schema::create('shifts', function (Blueprint $table) { + $table->id(); + $table->string('name'); + $table->foreignId('business_id')->constrained()->cascadeOnDelete(); + $table->time('start_time'); + $table->time('end_time'); + $table->time('start_break_time')->nullable(); + $table->time('end_break_time')->nullable(); + $table->time('break_time')->nullable(); + $table->string('break_status')->nullable(); + $table->boolean('status')->default(1); + $table->timestamps(); + }); + } } /** diff --git a/Modules/ThermalPrinterAddon/App/Http/Controllers/.gitkeep b/Modules/ThermalPrinterAddon/App/Http/Controllers/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Modules/ThermalPrinterAddon/App/Providers/.gitkeep b/Modules/ThermalPrinterAddon/App/Providers/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Modules/ThermalPrinterAddon/App/Providers/RouteServiceProvider.php b/Modules/ThermalPrinterAddon/App/Providers/RouteServiceProvider.php new file mode 100644 index 00000000..f0c4da4e --- /dev/null +++ b/Modules/ThermalPrinterAddon/App/Providers/RouteServiceProvider.php @@ -0,0 +1,59 @@ +mapApiRoutes(); + + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web') + ->namespace($this->moduleNamespace) + ->group(module_path('ThermalPrinterAddon', '/routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::prefix('api') + ->middleware('api') + ->namespace($this->moduleNamespace) + ->group(module_path('ThermalPrinterAddon', '/routes/api.php')); + } +} diff --git a/Modules/ThermalPrinterAddon/App/Providers/ThermalPrinterAddonServiceProvider.php b/Modules/ThermalPrinterAddon/App/Providers/ThermalPrinterAddonServiceProvider.php new file mode 100644 index 00000000..c15c7ade --- /dev/null +++ b/Modules/ThermalPrinterAddon/App/Providers/ThermalPrinterAddonServiceProvider.php @@ -0,0 +1,111 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/' . $this->moduleNameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); + $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower . '.php')], 'config'); + $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/' . $this->moduleNameLower); + $sourcePath = module_path($this->moduleName, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower . '-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + + $componentNamespace = str_replace('/', '\\', config('modules.namespace') . '\\' . $this->moduleName . '\\' . config('modules.paths.generator.component-class.path')); + Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + } + + /** + * Get the services provided by the provider. + */ + public function provides(): array + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path . '/modules/' . $this->moduleNameLower)) { + $paths[] = $path . '/modules/' . $this->moduleNameLower; + } + } + + return $paths; + } +} diff --git a/Modules/ThermalPrinterAddon/Database/Seeders/.gitkeep b/Modules/ThermalPrinterAddon/Database/Seeders/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Modules/ThermalPrinterAddon/composer.json b/Modules/ThermalPrinterAddon/composer.json new file mode 100644 index 00000000..1074c9b1 --- /dev/null +++ b/Modules/ThermalPrinterAddon/composer.json @@ -0,0 +1,31 @@ +{ + "name": "nwidart/thermalprinteraddon", + "description": "", + "authors": [ + { + "name": "Nicolas Widart", + "email": "n.widart@gmail.com" + } + ], + "extra": { + "laravel": { + "providers": [], + "aliases": { + + } + } + }, + "autoload": { + "psr-4": { + "Modules\\ThermalPrinterAddon\\": "", + "Modules\\ThermalPrinterAddon\\App\\": "app/", + "Modules\\ThermalPrinterAddon\\Database\\Factories\\": "database/factories/", + "Modules\\ThermalPrinterAddon\\Database\\Seeders\\": "database/seeders/" + } + }, + "autoload-dev": { + "psr-4": { + "Modules\\ThermalPrinterAddon\\Tests\\": "tests/" + } + } +} diff --git a/Modules/ThermalPrinterAddon/config/.gitkeep b/Modules/ThermalPrinterAddon/config/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Modules/ThermalPrinterAddon/config/config.php b/Modules/ThermalPrinterAddon/config/config.php new file mode 100644 index 00000000..40ef63e6 --- /dev/null +++ b/Modules/ThermalPrinterAddon/config/config.php @@ -0,0 +1,5 @@ + 'ThermalPrinterAddon', +]; diff --git a/Modules/ThermalPrinterAddon/module.json b/Modules/ThermalPrinterAddon/module.json new file mode 100644 index 00000000..91460ae2 --- /dev/null +++ b/Modules/ThermalPrinterAddon/module.json @@ -0,0 +1,12 @@ +{ + "name": "ThermalPrinterAddon", + "alias": "thermalprinteraddon", + "version": "1.0", + "description": "", + "keywords": [], + "priority": 0, + "providers": [ + "Modules\\ThermalPrinterAddon\\App\\Providers\\ThermalPrinterAddonServiceProvider" + ], + "files": [] +} diff --git a/Modules/ThermalPrinterAddon/package.json b/Modules/ThermalPrinterAddon/package.json new file mode 100644 index 00000000..d6fbfc83 --- /dev/null +++ b/Modules/ThermalPrinterAddon/package.json @@ -0,0 +1,15 @@ +{ + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build" + }, + "devDependencies": { + "axios": "^1.1.2", + "laravel-vite-plugin": "^0.7.5", + "sass": "^1.69.5", + "postcss": "^8.3.7", + "vite": "^4.0.0" + } +} diff --git a/Modules/ThermalPrinterAddon/resources/assets/js/app.js b/Modules/ThermalPrinterAddon/resources/assets/js/app.js new file mode 100644 index 00000000..e69de29b diff --git a/Modules/ThermalPrinterAddon/resources/assets/sass/app.scss b/Modules/ThermalPrinterAddon/resources/assets/sass/app.scss new file mode 100644 index 00000000..e69de29b diff --git a/Modules/ThermalPrinterAddon/resources/views/.gitkeep b/Modules/ThermalPrinterAddon/resources/views/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Modules/ThermalPrinterAddon/resources/views/due-collects/3_inch_80mm.blade.php b/Modules/ThermalPrinterAddon/resources/views/due-collects/3_inch_80mm.blade.php new file mode 100644 index 00000000..690b47c7 --- /dev/null +++ b/Modules/ThermalPrinterAddon/resources/views/due-collects/3_inch_80mm.blade.php @@ -0,0 +1,103 @@ +
Address: {{ auth()->user()->business->address ?? '' }}
+Mobile: {{ auth()->user()->business->phoneNumber ?? '' }}
+Email: {{ auth()->user()->email ?? '' }}
+{{ get_business_option('business-settings')['vat_name'] ?? '' }}: {{ get_business_option('business-settings')['vat_no'] ?? '' }}
+Invoice : {{ $party->dueCollect->invoiceNumber ?? '' }}
+Bill To: {{ $party->name ?? 'Guest' }}
+Mobile: {{ $party->phone ?? '' }}
+Date : {{ formatted_date($party->dueCollect->paymentDate ?? '') }}
+Time: {{ formatted_time($party->dueCollect->paymentDate ?? '') }}
+Collected By: {{ $party->dueCollect->business->companyName ?? '' }}
+| SL | +Total Due | +Payment Amount | +Remaining Due | +|
|---|---|---|---|---|
| 1 | +{{ currency_format($due_collect->totalDue ?? 0, currency: business_currency()) }} | ++ {{ currency_format($due_collect->payDueAmount ?? 0, currency: business_currency()) }} | ++ {{ currency_format($due_collect->dueAmountAfterPay ?? 0, currency: business_currency()) }} + | +|
|
+
+
+ Payment Type: + {{ $due_collect->payment_type_id != null ? $due_collect->payment_type->name ?? '' : $due_collect->paymentType }} ++Product sold will not be Exchanged Without invice + |
+
+
+
+
+
+
+
+ Payable Amount: +{{ currency_format($due_collect->totalDue ?? 0, currency: business_currency()) }} + +
+
+
+ Received Amount: +{{ currency_format($due_collect->payDueAmount ?? 0, currency: business_currency()) }} + +
+
+ Change Amt/Due: +{{ currency_format($due_collect->dueAmountAfterPay ?? 0, currency: business_currency()) }} + + |
+ |||
{{__('Address')}} : {{ $purchase->business->address ?? '' }}
+{{__('Mobile')}} : {{ $purchase->business->phoneNumber ?? '' }}
+{{__('Email')}} : {{ auth()->user()->email ?? '' }}
+ @if (!empty($purchase->business->vat_name)) +{{ $purchase->business->vat_name }} : {{ $purchase->business->vat_no ?? '' }}
+ @endif +{{__('Invoice')}} : {{ $purchase->invoiceNumber ?? '' }}
+{{__('Name')}} : {{ $purchase->party->name ?? '' }}
+{{__('Mobile')}} : {{ $purchase->party->phone ?? '' }}
+{{__('Date')}} : {{ formatted_date($purchase->purchaseDate ?? '') }}
+{{__('Time')}} : {{ formatted_time($purchase->purchaseDate ?? '') }}
+{{__('Purchase By')}} : {{ $purchase->user->name }}
+| {{__('SL')}}. | +{{__('Product')}} | +{{__('QTY')}} | +{{__('U.Price')}} | +{{__('Amount')}} | +
|---|---|---|---|---|
| {{ $loop->iteration }} | +{{ $detail->product->productName ?? '' }} | +{{ $detail->quantities ?? '' }} | ++ {{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency()) }} + | +{{ currency_format($productTotal, currency: business_currency()) }} | +
|
+
+
+ {{__('Payment Type')}} : + {{ $purchase->payment_type_id != null ? $purchase->payment_type->name ?? '' : $purchase->paymentType }} ++ |
+
+
+
+
+
+ {{__('Sub-Total')}} : +{{ currency_format($subtotal, currency: business_currency()) }} +
+
+ {{__('Vat')}} : +{{ currency_format($purchase->vat_amount, currency: business_currency()) }} + +
+
+ {{__('Discount')}} : +{{ currency_format($purchase->discountAmount, currency: business_currency()) }} + +
+
+
+ {{__('Shipping Charge')}} : +{{ currency_format($purchase->shipping_charge, currency: business_currency()) }} + +
+
+ {{__('Net Payable')}} : +{{ currency_format($subtotal + $purchase->vat_amount - ($purchase->discountAmount + $total_discount) + $purchase->shipping_charge, currency: business_currency()) }} + +
+
+ {{__('Paid')}} : +{{ currency_format($purchase->paidAmount, currency: business_currency()) }} + +
+
+ {{__('Due')}} : +{{ currency_format($purchase->dueAmount, currency: business_currency()) }} + + |
+ |||
| {{ __('Date') }} | +{{ __('Return Product') }} | +{{ __('QTY') }} | +{{ __('Amount') }} | +|
|---|---|---|---|---|
| {{ formatted_date($return->return_date) }} | +{{ $detail->purchaseDetail->product->productName ?? '' }} | +{{ $detail->return_qty ?? 0 }} | +{{ currency_format($detail->return_amount ?? 0, currency: business_currency()) }} | +|
|
+
+
+ {{ __('Payment Type') }}: {{ $purchase->payment_type_id != null ? $purchase->payment_type->name ?? '' : $purchase->paymentType }}+ + |
+
+
+
+
+
+
+
+ {{ __('Total Return') }}: +{{ currency_format($total_return_amount, currency: business_currency()) }} +
+
+ {{ __('Payable') }}: +{{ currency_format($purchase->totalAmount, currency: business_currency()) }} +
+
+ {{ __('Paid') }}: +{{ currency_format($purchase->paidAmount, currency: business_currency()) }} +
+
+ {{ __('Due') }}: +{{ currency_format($purchase->dueAmount, currency: business_currency()) }} + |
+ |||
| {{__('SL')}}. | +{{__('Product')}} | +{{__('QTY')}} | +{{__('U.Price')}} | +{{__('Amount')}} | +
|---|---|---|---|---|
| {{ $loop->iteration }} | +{{ $detail->product->productName ?? '' }} | +{{ $detail->quantities ?? '' }} | ++ {{ currency_format($detail->productPurchasePrice ?? 0, currency: business_currency()) }} + | +{{ currency_format($productTotal, currency: business_currency()) }} | +
|
+
+
+ {{__('Payment Type')}} : + {{ $purchase->payment_type_id != null ? $purchase->payment_type->name ?? '' : $purchase->paymentType }} ++ |
+
+
+
+
+
+ {{__('Sub-Total')}} : +{{ currency_format($subtotal, currency: business_currency()) }} +
+
+ {{__('Vat')}} : +{{ currency_format($purchase->vat_amount, currency: business_currency()) }} + +
+
+ {{__('Discount')}} : +{{ currency_format($purchase->discountAmount, currency: business_currency()) }} + +
+
+
+ {{__('Shipping Charge')}} : +{{ currency_format($purchase->shipping_charge, currency: business_currency()) }} + +
+
+ {{__('Net Payable')}} : +{{ currency_format($subtotal + $purchase->vat_amount - ($purchase->discountAmount + $total_discount) + $purchase->shipping_charge, currency: business_currency()) }} + +
+
+ {{__('Paid')}} : +{{ currency_format($purchase->paidAmount, currency: business_currency()) }} + +
+
+ {{__('Due')}} : +{{ currency_format($purchase->dueAmount, currency: business_currency()) }} + + |
+ |||
{{__('Address')}} : {{ $sale->business->address ?? '' }}
+{{__('Mobile')}} : {{ $sale->business->phoneNumber ?? '' }}
+{{__('Email')}} : {{ auth()->user()->email ?? '' }}
+ @if (!empty($sale->business->vat_name)) +{{ $sale->business->vat_name }} : {{ $sale->business->vat_no ?? '' }}
+ @endif +{{__('Invoice')}} : {{ $sale->invoiceNumber ?? '' }}
+{{__('Name')}} : {{ $sale->party->name ?? 'Cash' }}
+{{__('Mobile')}} : {{ $sale->party->phone ?? '' }}
+{{__('Date')}} : {{ formatted_date($sale->saleDate ?? '') }}
+{{__('Time')}} : {{ formatted_time($sale->saleDate ?? '') }}
+{{__('Sales By')}} : {{ $sale->user->name }}
+| {{ __('SL') }} | +{{ __('Product') }} | +{{ __('QTY') }} | +{{ __('U.Price') }} | +{{ __('Amount') }} | +
|---|---|---|---|---|
| {{ $loop->iteration }} | +{{ $detail->product->productName ?? '' }} | +{{ $detail->quantities ?? '' }} | ++ {{ currency_format($detail->price ?? 0, currency: business_currency()) }} | ++ {{ currency_format($productTotal, currency: business_currency()) }} + | +
|
+
+
+ {{ __('Payment Type') }}: + {{ $sale->payment_type_id != null ? $sale->payment_type->name ?? '' : $sale->paymentType }} ++{{ $sale->meta['notes'] ?? ($sale->meta['note'] ?? '') }} + + |
+
+
+
+
+
+ {{ __('Sub-Total') }}: +{{ currency_format($subtotal, currency: business_currency()) }} +
+
+ {{ __('Vat') }}: +{{ currency_format($sale->tax_amount, currency: business_currency()) }} + +
+
+ {{ __('Delivery charge') }}: +{{ currency_format($sale->shipping_charge, currency: business_currency()) }} + +
+
+
+
+ {{ __('Discount') }} + @if ($sale->discount_type == 'percent') + ({{ $sale->discount_percent }}%) + @endif: + +{{ currency_format($sale->discountAmount + $total_discount, currency: business_currency()) }} + +
+
+ {{ __('Net Payable') }}: +{{ currency_format($subtotal + $sale->tax_amount - ($sale->discountAmount + $total_discount) + $sale->shipping_charge + $sale->rounding_amount, currency: business_currency()) }} + +
+
+ {{ __('Total Payable') }}: +{{ currency_format($subtotal + $sale->tax_amount - ($sale->discountAmount + $total_discount) + $sale->shipping_charge, currency: business_currency()) }} + + |
+ |||
| {{ __('Date') }} | +{{ __('Return Product') }} | +{{ __('QTY') }} | +{{ __('Amount') }} | +|
|---|---|---|---|---|
| {{ formatted_date($return->return_date) }} | +{{ $detail->saleDetail->product->productName ?? '' }} | +{{ $detail->return_qty ?? 0 }} | ++ {{ currency_format($detail->return_amount ?? 0, currency: business_currency()) }} + | +|
|
+
+
+ {{ __('Payment Type') }}: + {{ $sale->payment_type_id != null ? $sale->payment_type->name ?? '' : $sale->paymentType }} ++{{ $sale->meta['notes'] ?? ($sale->meta['note'] ?? '') }} + + |
+
+
+
+
+
+
+
+ {{ __('Total Return') }}: +{{ currency_format($total_return_amount, currency: business_currency()) }} + +
+
+ {{ __('Payable') }}: +{{ currency_format($sale->totalAmount, currency: business_currency()) }} + +
+
+ {{ __('Paid') }}: +{{ currency_format($sale->paidAmount, currency: business_currency()) }} +
+
+ {{ __('Due') }}: +{{ currency_format($sale->dueAmount, currency: business_currency()) }} + |
+ |||
| {{__('SL')}}. | +{{__('Product')}} | +{{__('QTY')}} | +{{__('U.Price')}} | +{{__('Amount')}} | +
|---|---|---|---|---|
| {{ $loop->iteration }} | +{{ $detail->product->productName ?? '' }} | +{{ $detail->quantities ?? '' }} | ++ {{ currency_format($detail->price ?? 0, currency: business_currency()) }} + | ++ {{ currency_format($productTotal, currency: business_currency()) }} | +
|
+
+
+ {{__('Payment Type')}} : + {{ $sale->payment_type_id != null ? $sale->payment_type->name ?? '' : $sale->paymentType }} ++ + |
+
+
+
+
+
+ {{__('Sub-Total')}} : +{{ currency_format($subtotal, currency: business_currency()) }} +
+
+ {{__('Vat')}} : +{{ currency_format($sale->vat_amount, currency: business_currency()) }} + +
+
+ {{__('Discount')}} : +{{ currency_format($sale->discountAmount, currency: business_currency()) }} + +
+
+
+ {{__('Shipping Charge')}} : +{{ currency_format($sale->shipping_charge, currency: business_currency()) }} + +
+
+ {{__('Net Payable')}} : +{{ currency_format($sale->totalAmount, currency: business_currency()) }} + +
+
+ {{__('Paid')}} : +{{ currency_format($sale->paidAmount, currency: business_currency()) }} + +
+
+ {{__('Due')}} : +{{ currency_format($sale->dueAmount, currency: business_currency()) }} + + |
+ |||