first commit
This commit is contained in:
commit
ca72d4492a
18
.editorconfig
Normal file
18
.editorconfig
Normal file
@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
38
.gitattributes
vendored
Normal file
38
.gitattributes
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
* text=auto eol=lf
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
# Ignorar archivos de configuración y herramientas de desarrollo
|
||||
.editorconfig export-ignore
|
||||
.prettierrc.json export-ignore
|
||||
.prettierignore export-ignore
|
||||
.eslintrc.json export-ignore
|
||||
|
||||
# Ignorar node_modules y dependencias locales
|
||||
node_modules/ export-ignore
|
||||
vendor/ export-ignore
|
||||
|
||||
# Ignorar archivos de build
|
||||
npm-debug.log export-ignore
|
||||
|
||||
# Ignorar carpetas de logs y caché
|
||||
storage/logs/ export-ignore
|
||||
storage/framework/ export-ignore
|
||||
|
||||
# Ignorar carpetas de compilación de frontend
|
||||
public/build/ export-ignore
|
||||
dist/ export-ignore
|
||||
|
||||
# Ignorar archivos de CI/CD
|
||||
.github/ export-ignore
|
||||
.gitlab-ci.yml export-ignore
|
||||
.vscode/ export-ignore
|
||||
.idea/ export-ignore
|
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/node_modules
|
||||
/vendor
|
||||
/.vscode
|
||||
/.nova
|
||||
/.fleet
|
||||
/.phpactor.json
|
||||
/.phpunit.cache
|
||||
/.phpunit.result.cache
|
||||
/.zed
|
||||
/.idea
|
16
.prettierignore
Normal file
16
.prettierignore
Normal file
@ -0,0 +1,16 @@
|
||||
# Dependencias de Composer y Node.js
|
||||
/vendor/
|
||||
/node_modules/
|
||||
|
||||
# Caché y logs
|
||||
/storage/
|
||||
*.log
|
||||
*.cache
|
||||
|
||||
# Archivos del sistema
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Configuración de editores
|
||||
.idea/
|
||||
.vscode/
|
29
.prettierrc.json
Normal file
29
.prettierrc.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"arrowParens": "avoid",
|
||||
"bracketSpacing": true,
|
||||
"bracketSameLine": true,
|
||||
"htmlWhitespaceSensitivity": "css",
|
||||
"insertPragma": false,
|
||||
"jsxSingleQuote": true,
|
||||
"printWidth": 120,
|
||||
"proseWrap": "preserve",
|
||||
"quoteProps": "as-needed",
|
||||
"requirePragma": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 4,
|
||||
"trailingComma": "none",
|
||||
"useTabs": false,
|
||||
"endOfLine": "lf",
|
||||
"embeddedLanguageFormatting": "auto",
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"resources/assets/**/*.js"
|
||||
],
|
||||
"options": {
|
||||
"semi": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
0
CHANGELOG.md
Normal file
0
CHANGELOG.md
Normal file
0
CONTRIBUTING.md
Normal file
0
CONTRIBUTING.md
Normal file
9
LICENSE
Normal file
9
LICENSE
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 koneko
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
47
Models/PriceList.php
Normal file
47
Models/PriceList.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace koneko\VuexyPos\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Koneko\VuexyStoreManager\Models\Currency;
|
||||
|
||||
class PriceList extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'price_lists';
|
||||
protected $primaryKey = 'id';
|
||||
public $incrementing = false;
|
||||
protected $keyType = 'smallint';
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'type',
|
||||
'c_currency',
|
||||
'status',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'type' => 'integer',
|
||||
'status' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Relación con los precios de productos.
|
||||
*/
|
||||
public function productPrices(): HasMany
|
||||
{
|
||||
return $this->hasMany(ProductPrice::class, 'pricelist_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Relación con la moneda de la lista de precios.
|
||||
*/
|
||||
public function currency(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Currency::class, 'c_currency', 'c_currency');
|
||||
}
|
||||
}
|
61
Models/ProductPrice.php
Normal file
61
Models/ProductPrice.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Koneko\VuexyWarehouse\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class ProductPrice extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'product_prices';
|
||||
protected $primaryKey = 'id';
|
||||
public $incrementing = false;
|
||||
protected $keyType = 'mediumint';
|
||||
|
||||
protected $fillable = [
|
||||
'product_id',
|
||||
'pricelist_id',
|
||||
'unit_price',
|
||||
'discount_percentage',
|
||||
'final_price',
|
||||
'taxes_transferred',
|
||||
'taxes_retained',
|
||||
'total_amount',
|
||||
'valid_from',
|
||||
'valid_to',
|
||||
'min_quantity',
|
||||
'max_quantity',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'unit_price' => 'decimal:6',
|
||||
'discount_percentage' => 'decimal:2',
|
||||
'final_price' => 'decimal:6',
|
||||
'taxes_transferred' => 'decimal:6',
|
||||
'taxes_retained' => 'decimal:6',
|
||||
'total_amount' => 'decimal:6',
|
||||
'valid_from' => 'date',
|
||||
'valid_to' => 'date',
|
||||
'min_quantity' => 'integer',
|
||||
'max_quantity' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* Relación con el producto.
|
||||
*/
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Product::class, 'product_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Relación con la lista de precios.
|
||||
*/
|
||||
public function priceList(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PriceList::class, 'pricelist_id');
|
||||
}
|
||||
}
|
51
Providers/VuexyPosServiceProvider.php
Normal file
51
Providers/VuexyPosServiceProvider.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Koneko\VuexyPos\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Livewire\Livewire;
|
||||
use Koneko\VuexyPos\Livewire\Cache\CacheFunctions;
|
||||
use Koneko\VuexyPos\Models\User;
|
||||
use OwenIt\Auditing\AuditableObserver;
|
||||
|
||||
class VuexyPosServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// Register the module's routes
|
||||
$this->loadRoutesFrom(__DIR__.'/../routes/admin.php');
|
||||
|
||||
|
||||
// Cargar vistas del paquete
|
||||
$this->loadViewsFrom(__DIR__.'/../resources/views', 'vuexy-pos');
|
||||
|
||||
|
||||
// Register the migrations
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
|
||||
|
||||
|
||||
// Registrar Livewire Components
|
||||
$components = [
|
||||
//'cache-functions' => CacheFunctions::class,
|
||||
];
|
||||
|
||||
foreach ($components as $alias => $component) {
|
||||
//Livewire::component($alias, $component);
|
||||
}
|
||||
|
||||
|
||||
// Registrar auditoría en usuarios
|
||||
//User::observe(AuditableObserver::class);
|
||||
}
|
||||
}
|
16
README.md
Normal file
16
README.md
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="https://koneko.mx" target="_blank">
|
||||
<img src="https://git.koneko.mx/Koneko-ST/koneko-st/raw/branch/main/logo-images/horizontal-05.png" width="400" alt="Koneko Soluciones Tecnológicas Logo">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://packagist.org/packages/koneko/laravel-vuexy-admin"><img src="https://img.shields.io/packagist/v/koneko/laravel-vuexy-admin" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/koneko/laravel-vuexy-admin"><img src="https://img.shields.io/packagist/l/koneko/laravel-vuexy-admin" alt="License"></a>
|
||||
<a href="mailto:contacto@koneko.mx"><img src="https://img.shields.io/badge/contact-email-green" alt="Email"></a>
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
# Laravel Vuexy
|
42
composer.json
Normal file
42
composer.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "koneko/laravel-vuexy-pos",
|
||||
"description": "Laravel Vuexy POS para México, un modulo de Puntos de Venta optimizado para México.",
|
||||
"keywords": ["laravel", "koneko", "framework", "vuexy", "pos", "point of sale", "tpv", "Terminal punto de venta", "mexico"],
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"koneko/laravel-exchange-rates-api": "dev-main",
|
||||
"koneko/laravel-vuexy-warehouse": "dev-main",
|
||||
"laravel/framework": "^11.31"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "path",
|
||||
"url": "../laravel-vuexy-warehouse",
|
||||
"options": {
|
||||
"symlink": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Koneko\\VuexyPos\\": "./"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Koneko\\VuexyPos\\Providers\\VuexyPosServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arturo Corro Pacheco",
|
||||
"email": "arturo@koneko.mx"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
|
||||
Schema::create('product_store_prices', function (Blueprint $table) {
|
||||
$table->mediumIncrements('id');
|
||||
|
||||
$table->unsignedMediumInteger('product_id')->index();
|
||||
$table->unsignedSmallInteger('store_id')->index();
|
||||
|
||||
$table->decimal('price', 9, 2)->unsigned()->default(0);
|
||||
$table->char('currency', 3)->charset('ascii')->collation('ascii_general_ci');
|
||||
|
||||
$table->boolean('is_discounted')->index();
|
||||
$table->decimal('discount_price', 9, 2)->unsigned()->nullable();
|
||||
$table->date('discount_start')->nullable();
|
||||
$table->date('discount_end')->nullable();
|
||||
|
||||
// Auditoría
|
||||
$table->timestamps();
|
||||
|
||||
// Relaciones
|
||||
$table->foreign('product_id')->references('id')->on('products')->onUpdate('restrict')->onDelete('cascade');
|
||||
$table->foreign('store_id')->references('id')->on('stores')->onUpdate('restrict')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('product_store_prices');
|
||||
Schema::dropIfExists('product_property');
|
||||
}
|
||||
};
|
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('price_lists', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->string('name')->index();
|
||||
|
||||
$table->unsignedTinyInteger('type')->index();
|
||||
$table->char('c_currency', 3)->charset('ascii')->collation('ascii_general_ci')->nullable(); // Moneda
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
$table->unsignedTinyInteger('status');
|
||||
});
|
||||
|
||||
Schema::create('product_prices', function (Blueprint $table) {
|
||||
$table->mediumIncrements('id');
|
||||
|
||||
$table->unsignedMediumInteger('product_id')->index(); // products.id
|
||||
$table->unsignedSmallInteger('pricelist_id')->index(); // price_lists.id
|
||||
|
||||
$table->decimal('unit_price', 13, 6)->unsigned()->nullable(); // Precio unitario
|
||||
$table->decimal('discount_percentage', 5, 2)->unsigned()->nullable(); // Descuento %
|
||||
$table->decimal('final_price', 13, 6)->unsigned()->nullable(); // Precio después del descuento
|
||||
|
||||
$table->decimal('taxes_transferred', 13, 6)->unsigned()->nullable(); // Impuestos trasladados
|
||||
$table->decimal('taxes_retained', 13, 6)->unsigned()->nullable(); // Impuestos retenidos
|
||||
$table->decimal('total_amount', 13, 6)->unsigned()->nullable(); // Importe final
|
||||
|
||||
$table->date('valid_from')->nullable(); // Fecha de inicio de validez
|
||||
$table->date('valid_to')->nullable(); // Fecha de fin de validez
|
||||
|
||||
$table->unsignedInteger('min_quantity')->nullable(); // Cantidad mínima para este precio
|
||||
$table->unsignedInteger('max_quantity')->nullable(); // Cantidad máxima para este precio
|
||||
|
||||
// Auditoría
|
||||
$table->timestamps();
|
||||
|
||||
// Índices y restricciones
|
||||
$table->unique(['product_id', 'pricelist_id', 'valid_from', 'valid_to', 'min_quantity', 'max_quantity'])->name('product_pricelist_valid_from_to_min_max_quantity');
|
||||
|
||||
// Relaciones
|
||||
$table->foreign('product_id')
|
||||
->references('id')
|
||||
->on('products')
|
||||
->onUpdate('restrict')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign('pricelist_id')
|
||||
->references('id')
|
||||
->on('price_lists')
|
||||
->onUpdate('restrict')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('price_lists');
|
||||
Schema::dropIfExists('product_prices');
|
||||
}
|
||||
};
|
192
database/migrations/2024_12_19_112507_create_pos_tables.php
Normal file
192
database/migrations/2024_12_19_112507_create_pos_tables.php
Normal file
@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sales_transactions', function (Blueprint $table) {
|
||||
$table->mediumIncrements('id');
|
||||
|
||||
$table->unsignedSmallInteger('store_id')->index();
|
||||
|
||||
$table->unsignedTinyInteger('document_type')->index(); // Tipo de documento (venta, cotización, Remisión, Nota de credito)
|
||||
$table->unsignedMediumInteger('document_id')->nullable(); // UID específico por tienda
|
||||
|
||||
$table->unsignedMediumInteger('seller_id')->index(); // ID del vendedor
|
||||
$table->unsignedMediumInteger('customer_id')->nullable(); // ID del cliente
|
||||
$table->unsignedMediumInteger('customer_tax_id')->nullable(); // ID del cliente para impuestos
|
||||
|
||||
$table->decimal('quantity', 13, 6)->unsigned()->nullable();
|
||||
|
||||
$table->datetime('transaction_date')->index(); // Fecha de la transacción
|
||||
$table->date('date_to_pay')->nullable()->index();
|
||||
|
||||
$table->char('moneda', 3)->index();
|
||||
$table->decimal('tipo_de_cambio', 12, 4)->nullable(); // Sin unsigned para permitir valores negativos si es necesario
|
||||
|
||||
$table->char('c_uso_cfdi', 4)->charset('ascii')->collation('ascii_general_ci')->nullable()->index();
|
||||
$table->char('c_metodo_pago', 3)->nullable()->index(); // c_metodo_pago.c_metodo_pago
|
||||
$table->string('condiciones_de_pago', 512)->nullable()->index();
|
||||
|
||||
$table->decimal('subtotal', 9, 2)->unsigned()->default(0);
|
||||
$table->decimal('impuestos_trasladados', 9, 2)->unsigned()->default(0);
|
||||
$table->decimal('impuestos_retenidos', 9, 2)->unsigned()->default(0);
|
||||
$table->decimal('amount', 9, 2)->unsigned()->default(0);
|
||||
$table->decimal('paid_amount', 9, 2)->unsigned()->default(0);
|
||||
|
||||
$table->mediumText('document_notes')->nullable(); // Notas adicionales
|
||||
$table->json('internal_notes')->nullable();
|
||||
|
||||
$table->boolean('should_send_ticket')->nullable(); //
|
||||
$table->boolean('should_send_invoice')->nullable(); //
|
||||
|
||||
$table->boolean('print_ticket')->nullable();
|
||||
$table->boolean('print_invoice')->nullable();
|
||||
$table->boolean('print_payment_peceipt')->nullable(); //
|
||||
|
||||
$table->unsignedTinyInteger('transaction_status')->index(); // Estatus de la orden ('pending', 'approved', 'received', 'cancelled')
|
||||
$table->unsignedTinyInteger('payment_status')->nullable()->index();
|
||||
$table->unsignedTinyInteger('billing_status')->nullable()->index();
|
||||
$table->unsignedTinyInteger('delivery_status')->nullable()->index(); // 'pending', 'processing', 'shipped', 'delivered', 'canceled', no requiere envio, cliente recoge
|
||||
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
|
||||
$table->index(['store_id', 'document_type', 'document_id']);
|
||||
$table->index(['store_id', 'document_type', 'date_to_pay']);
|
||||
$table->index(['store_id', 'document_type', 'transaction_date'])->name('purchase_transactions_store_document_date_index');
|
||||
$table->index(['store_id', 'document_type', 'transaction_date', 'seller_id'])->name('purchase_transactions_store_document_date_seller_index');
|
||||
$table->index(['store_id', 'document_type', 'transaction_date', 'customer_id'])->name('purchase_transactions_store_document_date_customer_index');
|
||||
$table->index(['store_id', 'document_type', 'transaction_date', 'customer_tax_id'])->name('purchase_transactions_store_document_date_customer_tax_index');
|
||||
|
||||
$table->foreign('store_id')
|
||||
->references('id')
|
||||
->on('stores')
|
||||
->onDelete('restrict');
|
||||
|
||||
$table->foreign('seller_id')
|
||||
->references('id')
|
||||
->on('users')
|
||||
->onDelete('restrict');
|
||||
|
||||
$table->foreign('customer_id')
|
||||
->references('id')
|
||||
->on('users')
|
||||
->onDelete('restrict');
|
||||
|
||||
$table->foreign('customer_tax_id')
|
||||
->references('id')
|
||||
->on('users')
|
||||
->onDelete('restrict');
|
||||
|
||||
$table->foreign('c_uso_cfdi')
|
||||
->references('c_uso_cfdi')
|
||||
->on('sat_uso_cfdi')
|
||||
->onDelete('restrict');
|
||||
|
||||
});
|
||||
|
||||
Schema::create('sales_transactions_concepts', function (Blueprint $table) {
|
||||
$table->mediumIncrements('id');
|
||||
|
||||
$table->unsignedMediumInteger('sales_transaction_id')->index(); // sales.id
|
||||
|
||||
$table->decimal('cantidad', 13, 6)->unsigned();
|
||||
$table->unsignedMediumInteger('product_id')->index(); // products.id
|
||||
$table->string('no_identificacion', 100)->nullable()->index();
|
||||
$table->string('descripcion');
|
||||
$table->string('c_clave_unidad', 3)->nullable()->index(); // sat_clave_unidad.c_clave_unidad
|
||||
|
||||
$table->decimal('cost', 13, 6)->unsigned()->default(0);
|
||||
|
||||
$table->mediumText('observations')->nullable();
|
||||
|
||||
$table->decimal('valorunitario', 13, 6)->unsigned();
|
||||
$table->decimal('importe', 13, 6)->unsigned();
|
||||
|
||||
$table->unsignedTinyInteger('c_objeto_imp')->nullable()->index(); // sat_objeto_imp.c_objeto_imp
|
||||
|
||||
$table->json('impuestos')->nullable();
|
||||
$table->decimal('impuestos_trasladados', 13, 6)->unsigned()->default(0);
|
||||
$table->decimal('impuestos_retenidos', 13, 6)->unsigned()->default(0);
|
||||
|
||||
|
||||
// Indices
|
||||
$table->foreign('sales_transaction_id')
|
||||
->references('id')
|
||||
->on('sales_transactions')
|
||||
->onUpdate('restrict')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign('product_id')
|
||||
->references('id')
|
||||
->on('products')
|
||||
->onUpdate('restrict')
|
||||
->onDelete('restrict');
|
||||
|
||||
$table->foreign('c_clave_unidad')
|
||||
->references('c_clave_unidad')
|
||||
->on('sat_clave_unidad')
|
||||
->onUpdate('restrict')
|
||||
->onDelete('restrict');
|
||||
});
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->unsignedSmallInteger('pricelist_id') // dropdown_lists.id
|
||||
->after('c_uso_cfdi')
|
||||
->nullable();
|
||||
|
||||
$table->unsignedTinyInteger('enable_credit')
|
||||
->after('pricelist_id')
|
||||
->nullable();
|
||||
|
||||
$table->unsignedSmallInteger('credit_days')
|
||||
->after('enable_credit')
|
||||
->nullable();
|
||||
|
||||
$table->decimal('credit_limit', 14, 2)
|
||||
->after('credit_days')
|
||||
->nullable();
|
||||
|
||||
// Indices
|
||||
$table->foreign('pricelist_id')
|
||||
->references('id')
|
||||
->on('price_lists')
|
||||
->onUpdate('restrict')
|
||||
->onDelete('restrict');
|
||||
});
|
||||
|
||||
/*
|
||||
DB::unprepared('CREATE TRIGGER prevent_pricelist_delete
|
||||
BEFORE DELETE ON dropdown_lists
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
IF EXISTS (SELECT 1 FROM users WHERE pricelist_id = OLD.id) THEN
|
||||
SIGNAL SQLSTATE "45000" SET MESSAGE_TEXT = "No se puede eliminar la lista de precios porque está en uso por un usuario";
|
||||
END IF;
|
||||
END;');
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sales_transactions');
|
||||
DB::unprepared('DROP TRIGGER IF EXISTS sales_transactions_before_insert');
|
||||
|
||||
Schema::dropIfExists('sales_transactions_concepts');
|
||||
|
||||
DB::unprepared('DROP TRIGGER IF EXISTS prevent_pricelist_delete');
|
||||
}
|
||||
};
|
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('stores', function (Blueprint $table) {
|
||||
// Series de documentos
|
||||
$table->string('serie_ordenes_compra', 50)->nullable()->after('domicilio_fiscal');
|
||||
$table->string('serie_compras', 50)->nullable()->after('serie_ordenes_compra');
|
||||
$table->string('serie_gastos', 50)->nullable()->after('serie_compras');
|
||||
$table->string('serie_cotizaciones', 50)->nullable()->after('serie_gastos');
|
||||
$table->string('serie_ventas', 50)->nullable()->after('serie_cotizaciones');
|
||||
$table->string('serie_remisiones', 50)->nullable()->after('serie_ventas');
|
||||
$table->string('serie_notas_credito', 50)->nullable()->after('serie_remisiones');
|
||||
$table->string('serie_pagos', 50)->nullable()->after('serie_notas_credito');
|
||||
$table->string('serie_traspasos', 50)->nullable()->after('serie_pagos');
|
||||
$table->string('serie_ajustes_inventario', 50)->nullable()->after('serie_traspasos');
|
||||
|
||||
// Configuración del ticket
|
||||
$table->unsignedTinyInteger('ticket_digital')->nullable()->after('serie_ajustes_inventario');
|
||||
$table->boolean('ticket_digital_show_customer')->nullable()->after('ticket_digital');
|
||||
$table->boolean('ticket_digital_show_email')->nullable()->after('ticket_digital_show_customer');
|
||||
$table->boolean('ticket_digital_show_address')->nullable()->after('ticket_digital_show_email');
|
||||
$table->boolean('ticket_digital_show_unit_price')->nullable()->after('ticket_digital_show_address');
|
||||
$table->boolean('ticket_digital_show_taxes')->nullable()->after('ticket_digital_show_unit_price');
|
||||
$table->boolean('ticket_digital_show_import')->nullable()->after('ticket_digital_show_taxes');
|
||||
$table->unsignedTinyInteger('ticket_printed')->nullable()->after('ticket_digital_show_import');
|
||||
$table->boolean('ticket_show_customer')->nullable()->after('ticket_printed');
|
||||
$table->boolean('ticket_show_email')->nullable()->after('ticket_show_customer');
|
||||
$table->boolean('ticket_show_address')->nullable()->after('ticket_show_email');
|
||||
$table->boolean('ticket_show_unit_price')->nullable()->after('ticket_show_address');
|
||||
$table->boolean('ticket_show_taxes')->nullable()->after('ticket_show_unit_price');
|
||||
$table->boolean('ticket_show_import')->nullable()->after('ticket_show_taxes');
|
||||
$table->string('ticket_image_path', 255)->nullable()->after('ticket_show_import');
|
||||
$table->mediumText('ticket_image_base64', 255)->nullable()->after('ticket_image_path');
|
||||
$table->string('ticket_header', 255)->nullable()->after('ticket_image_base64');
|
||||
$table->string('ticket_footer', 255)->nullable()->after('ticket_header');
|
||||
$table->string('ticket_footer_2', 255)->nullable()->after('ticket_footer');
|
||||
$table->boolean('ticket_enable_cash_register')->nullable()->after('ticket_footer_2');
|
||||
$table->unsignedTinyInteger('ticket_cash_register')->nullable()->after('ticket_enable_cash_register');
|
||||
$table->boolean('ticket_enable_warehouse')->nullable()->after('ticket_cash_register');
|
||||
$table->unsignedTinyInteger('ticket_warehouse')->nullable()->after('ticket_enable_warehouse');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
};
|
43
database/seeders/PriceListSeeder.php
Normal file
43
database/seeders/PriceListSeeder.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Catalog\DropdownList;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PriceListSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$divisas_array = [
|
||||
[
|
||||
'label' => 'pos_pricelist',
|
||||
'single' => 'Público en general',
|
||||
'param1' => 1,
|
||||
'param2' => 30,
|
||||
'order' => 0,
|
||||
'status' => DropdownList::STATUS_ENABLED,
|
||||
],
|
||||
[
|
||||
'label' => 'pos_pricelist',
|
||||
'single' => 'Preferente',
|
||||
'param1' => 1,
|
||||
'param2' => 15,
|
||||
'order' => 0,
|
||||
'status' => DropdownList::STATUS_ENABLED,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($divisas_array as $divisa) {
|
||||
DropdownList::create($divisa);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
9
routes/admin.php
Normal file
9
routes/admin.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Koneko\VuexyAdmin\Http\Controllers\UUserController;
|
||||
|
||||
// Grupo raíz para admin con middleware y prefijos comunes
|
||||
Route::prefix('admin/ventas')->name('admin.sales.')->middleware(['web', 'auth', 'admin'])->group(function () {
|
||||
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user